diff --git a/.gitattributes b/.gitattributes index 280c374d5b6aacfa735c88051cb2b7bf25ef7590..bb25f6542bd763ebb01906462024f92ccb7b7005 100644 --- a/.gitattributes +++ b/.gitattributes @@ -105,3 +105,5 @@ tools/ui/node_modules/@tailwindcss/oxide-linux-x64-gnu/tailwindcss-oxide.linux-x tools/ui/node_modules/@tailwindcss/oxide-linux-x64-musl/tailwindcss-oxide.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text tools/ui/node_modules/lightningcss-linux-x64-gnu/lightningcss.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text tools/ui/node_modules/lightningcss-linux-x64-musl/lightningcss.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/mermaid/dist/mermaid.js.map filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/mermaid/dist/mermaid.min.js.map filter=lfs diff=lfs merge=lfs -text diff --git a/tools/ui/node_modules/mermaid/dist/diagram-api/loadDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagram-api/loadDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc1cd3de4f270930662a93411489edb81eebbbb0 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagram-api/loadDiagram.d.ts @@ -0,0 +1 @@ +export declare const loadRegisteredDiagrams: () => Promise; diff --git a/tools/ui/node_modules/mermaid/dist/diagram-api/regexes.d.ts b/tools/ui/node_modules/mermaid/dist/diagram-api/regexes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5672014474fd0fd4df60822c88f4e50219a25120 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagram-api/regexes.d.ts @@ -0,0 +1,3 @@ +export declare const frontMatterRegex: RegExp; +export declare const directiveRegex: RegExp; +export declare const anyCommentRegex: RegExp; diff --git a/tools/ui/node_modules/mermaid/dist/diagram-api/types.d.ts b/tools/ui/node_modules/mermaid/dist/diagram-api/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..699c7d3854fe0732cc87bf4fbf2a15ea3b6c44c8 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagram-api/types.d.ts @@ -0,0 +1,99 @@ +import type * as d3 from 'd3'; +import type { SetOptional, SetRequired } from 'type-fest'; +import type { Diagram } from '../Diagram.js'; +import type { BaseDiagramConfig, MermaidConfig } from '../config.type.js'; +import type { DiagramOrientation } from '../diagrams/git/gitGraphTypes.js'; +export interface DiagramMetadata { + title?: string; + config?: MermaidConfig; +} +export interface InjectUtils { + _log: any; + _setLogLevel: any; + _getConfig: any; + _sanitizeText: any; + _setupGraphViewbox: any; + _commonDb: any; + /** @deprecated as directives will be pre-processed since https://github.com/mermaid-js/mermaid/pull/4759 */ + _parseDirective: any; +} +/** + * Generic Diagram DB that may apply to any diagram type. + */ +export interface DiagramDB { + getConfig?: () => BaseDiagramConfig | undefined; + clear?: () => void; + setDiagramTitle?: (title: string) => void; + getDiagramTitle?: () => string; + setAccTitle?: (title: string) => void; + getAccTitle?: () => string; + setAccDescription?: (description: string) => void; + getAccDescription?: () => string; + getDirection?: () => string | undefined; + setDirection?: (dir: DiagramOrientation) => void; + setDisplayMode?: (title: string) => void; + setDiagramId?: (svgElementId: string) => void; + bindFunctions?: (element: Element) => void; +} +/** + * DiagramDB with fields that is required for all new diagrams. + */ +export type DiagramDBBase = { + getConfig: () => Required; +} & SetRequired; +export interface DiagramStyleClassDef { + id: string; + /** + * The styles to apply to the class for HTML rendering. + * These are expected to be CSS property declarations without a trailing semicolon, e.g. `color: red`. + */ + styles?: string[]; + /** + * The styles to apply to `` elements with the given class. + */ + textStyles?: string[]; +} +export interface DiagramRenderer { + draw: DrawDefinition; + getClasses?: (text: string, diagram: Pick) => Map; +} +export interface DiagramDefinition { + db: DiagramDB; + renderer: DiagramRenderer; + parser: ParserDefinition; + styles?: any; + init?: (config: MermaidConfig) => void; + injectUtils?: (_log: InjectUtils['_log'], _setLogLevel: InjectUtils['_setLogLevel'], _getConfig: InjectUtils['_getConfig'], _sanitizeText: InjectUtils['_sanitizeText'], _setupGraphViewbox: InjectUtils['_setupGraphViewbox'], _commonDb: InjectUtils['_commonDb'], + /** @deprecated as directives will be pre-processed since https://github.com/mermaid-js/mermaid/pull/4759 */ + _parseDirective: InjectUtils['_parseDirective']) => void; +} +export interface ExternalDiagramDefinition { + id: string; + detector: DiagramDetector; + loader: DiagramLoader; +} +export type DetectorRecord = SetOptional, 'loader'>; +export type DiagramDetector = (text: string, config?: MermaidConfig) => boolean; +export type DiagramLoader = () => Promise<{ + id: string; + diagram: DiagramDefinition; +}>; +/** + * Type for function draws diagram in the tag with id: id based on the graph definition in text. + * + * @param text - The text of the diagram. + * @param id - The id of the diagram which will be used as a DOM element id. + * @param version - MermaidJS version from package.json. + * @param diagramObject - A standard diagram containing the DB and the text and type etc of the diagram. + */ +export type DrawDefinition = (text: string, id: string, version: string, diagramObject: Diagram) => void | Promise; +export interface ParserDefinition { + parse: (text: string) => void | Promise; + parser?: { + yy: DiagramDB; + }; +} +export type HTML = d3.Selection; +export type SVG = d3.Selection; +export type SVGGroup = d3.Selection; +export type DiagramStylesProvider = (options?: any, svgId?: string) => string; diff --git a/tools/ui/node_modules/mermaid/dist/diagram.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagram.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagram.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architecture.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architecture.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architecture.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..71be3ebfa56506d49317d83e8aea2933c12ef5e6 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureDb.d.ts @@ -0,0 +1,48 @@ +import type { ArchitectureDiagramConfig } from '../../config.type.js'; +import type { DiagramDB } from '../../diagram-api/types.js'; +import type { D3Element } from '../../types.js'; +import type { ArchitectureEdge, ArchitectureGroup, ArchitectureJunction, ArchitectureNode, ArchitectureService } from './architectureTypes.js'; +export declare class ArchitectureDB implements DiagramDB { + private nodes; + private groups; + private edges; + private registeredIds; + private dataStructures?; + private elements; + private diagramId; + constructor(); + setDiagramId(id: string): void; + getDiagramId(): string; + clear(): void; + addService({ id, icon, in: parent, title, iconText, }: Omit): void; + getServices(): ArchitectureService[]; + addJunction({ id, in: parent }: Omit): void; + getJunctions(): ArchitectureJunction[]; + getNodes(): ArchitectureNode[]; + getNode(id: string): ArchitectureNode | null; + addGroup({ id, icon, in: parent, title }: ArchitectureGroup): void; + getGroups(): ArchitectureGroup[]; + addEdge({ lhsId, rhsId, lhsDir, rhsDir, lhsInto, rhsInto, lhsGroup, rhsGroup, title, }: ArchitectureEdge): void; + getEdges(): ArchitectureEdge[]; + /** + * Returns the current diagram's adjacency list, spatial map, & group alignments. + * If they have not been created, run the algorithms to generate them. + * @returns + */ + getDataStructures(): import("./architectureTypes.js").ArchitectureDataStructures; + setElementForId(id: string, element: D3Element): void; + getElementById(id: string): D3Element; + getConfig(): Required; + getConfigField(field: T): Required[T]; + setAccTitle: (txt: string) => void; + getAccTitle: () => string; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; + getAccDescription: () => string; + setAccDescription: (txt: string) => void; +} +/** + * Typed wrapper for resolving an architecture diagram's config fields. Returns the default value if undefined + * @param field - the config field to access + * @returns + */ diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..845b1cc1e2d2eaa69d44c6651fafcce37a10c81f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const architecture: ExternalDiagramDefinition; +export default architecture; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureIcons.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureIcons.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..677f0397ff0e05785c01b7c16cdbdf7c1de5a617 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureIcons.d.ts @@ -0,0 +1,2 @@ +import type { IconifyJSON } from '@iconify/types'; +export declare const architectureIcons: IconifyJSON; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureParser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureParser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureParser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f7005466b6024ecf1077d664ffe0494e105082f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureRenderer.d.ts @@ -0,0 +1,5 @@ +import type { DrawDefinition } from '../../diagram-api/types.js'; +export declare const draw: DrawDefinition; +export declare const renderer: { + draw: DrawDefinition; +}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureStyles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureStyles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0377ad11cd5117c45305eb530d0fd2f0d382b2c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureStyles.d.ts @@ -0,0 +1,3 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +declare const getStyles: DiagramStylesProvider; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d7d6b39372b9afbab288ab4704e71d156928b05 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/architectureTypes.d.ts @@ -0,0 +1,227 @@ +import type { DiagramDBBase } from '../../diagram-api/types.js'; +import type { ArchitectureDiagramConfig } from '../../config.type.js'; +import type { D3Element } from '../../types.js'; +import type cytoscape from 'cytoscape'; +export type ArchitectureAlignment = 'vertical' | 'horizontal' | 'bend'; +export type ArchitectureDirection = 'L' | 'R' | 'T' | 'B'; +export type ArchitectureDirectionX = Extract; +export type ArchitectureDirectionY = Extract; +/** + * Contains LL, RR, TT, BB which are impossible connections + */ +export type InvalidArchitectureDirectionPair = `${ArchitectureDirection}${ArchitectureDirection}`; +export type ArchitectureDirectionPair = Exclude; +export type ArchitectureDirectionPairXY = Exclude; +export declare const ArchitectureDirectionName: { + readonly L: "left"; + readonly R: "right"; + readonly T: "top"; + readonly B: "bottom"; +}; +export declare const ArchitectureDirectionArrow: { + readonly L: (scale: number) => string; + readonly R: (scale: number) => string; + readonly T: (scale: number) => string; + readonly B: (scale: number) => string; +}; +export declare const ArchitectureDirectionArrowShift: { + readonly L: (orig: number, arrowSize: number) => number; + readonly R: (orig: number, _arrowSize: number) => number; + readonly T: (orig: number, arrowSize: number) => number; + readonly B: (orig: number, _arrowSize: number) => number; +}; +export declare const getOppositeArchitectureDirection: (x: ArchitectureDirection) => ArchitectureDirection; +export declare const isArchitectureDirection: (x: unknown) => x is ArchitectureDirection; +export declare const isArchitectureDirectionX: (x: ArchitectureDirection) => x is ArchitectureDirectionX; +export declare const isArchitectureDirectionY: (x: ArchitectureDirection) => x is ArchitectureDirectionY; +export declare const isArchitectureDirectionXY: (a: ArchitectureDirection, b: ArchitectureDirection) => boolean; +export declare const isArchitecturePairXY: (pair: ArchitectureDirectionPair) => pair is ArchitectureDirectionPairXY; +/** + * Verifies that the architecture direction pair does not contain an invalid match (LL, RR, TT, BB) + * @param x - architecture direction pair which could potentially be invalid + * @returns true if the pair is not LL, RR, TT, or BB + */ +export declare const isValidArchitectureDirectionPair: (x: InvalidArchitectureDirectionPair) => x is ArchitectureDirectionPair; +export type ArchitectureDirectionPairMap = Partial>; +/** + * Creates a pair of the directions of each side of an edge. This function should be used instead of manually creating it to ensure that the source is always the first character. + * + * Note: Undefined is returned when sourceDir and targetDir are the same. In theory this should never happen since the diagram parser throws an error if a user defines it as such. + * @param sourceDir - source direction + * @param targetDir - target direction + * @returns + */ +export declare const getArchitectureDirectionPair: (sourceDir: ArchitectureDirection, targetDir: ArchitectureDirection) => ArchitectureDirectionPair | undefined; +/** + * Given an x,y position for an arrow and the direction of the edge it belongs to, return a factor for slightly shifting the edge + * @param param0 - [x, y] coordinate pair + * @param pair - architecture direction pair + * @returns a new [x, y] coordinate pair + */ +export declare const shiftPositionByArchitectureDirectionPair: ([x, y]: number[], pair: ArchitectureDirectionPair) => number[]; +/** + * Given the directional pair of an XY edge, get the scale factors necessary to shift the coordinates inwards towards the edge + * @param pair - XY pair of an edge + * @returns - number[] containing [+/- 1, +/- 1] + */ +export declare const getArchitectureDirectionXYFactors: (pair: ArchitectureDirectionPairXY) => number[]; +export declare const getArchitectureDirectionAlignment: (a: ArchitectureDirection, b: ArchitectureDirection) => ArchitectureAlignment; +export interface ArchitectureStyleOptions { + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: string; + archGroupBorderWidth: string; +} +export interface ArchitectureService { + id: string; + type: 'service'; + edges: ArchitectureEdge[]; + icon?: string; + iconText?: string; + title?: string; + in?: string; + width?: number; + height?: number; +} +export interface ArchitectureJunction { + id: string; + type: 'junction'; + edges: ArchitectureEdge[]; + in?: string; + width?: number; + height?: number; +} +export type ArchitectureNode = ArchitectureService | ArchitectureJunction; +export declare const isArchitectureService: (x: ArchitectureNode) => x is ArchitectureService; +export declare const isArchitectureJunction: (x: ArchitectureNode) => x is ArchitectureJunction; +export interface ArchitectureGroup { + id: string; + icon?: string; + title?: string; + in?: string; +} +export interface ArchitectureEdge
{ + lhsId: string; + lhsDir: DT; + lhsInto?: boolean; + lhsGroup?: boolean; + rhsId: string; + rhsDir: DT; + rhsInto?: boolean; + rhsGroup?: boolean; + title?: string; +} +export interface ArchitectureDB extends DiagramDBBase { + clear: () => void; + addService: (service: Omit) => void; + getServices: () => ArchitectureService[]; + addJunction: (service: Omit) => void; + getJunctions: () => ArchitectureJunction[]; + getNodes: () => ArchitectureNode[]; + getNode: (id: string) => ArchitectureNode | null; + addGroup: (group: ArchitectureGroup) => void; + getGroups: () => ArchitectureGroup[]; + addEdge: (edge: ArchitectureEdge) => void; + getEdges: () => ArchitectureEdge[]; + setElementForId: (id: string, element: D3Element) => void; + getElementById: (id: string) => D3Element; + getDataStructures: () => ArchitectureDataStructures; +} +export type ArchitectureAdjacencyList = Record; +export type ArchitectureSpatialMap = Record; +/** + * Maps the direction that groups connect from. + * + * **Outer key**: ID of group A + * + * **Inner key**: ID of group B + * + * **Value**: 'vertical' or 'horizontal' + * + * Note: tmp[groupA][groupB] == tmp[groupB][groupA] + */ +export type ArchitectureGroupAlignments = Record>>; +export interface ArchitectureDataStructures { + adjList: ArchitectureAdjacencyList; + spatialMaps: ArchitectureSpatialMap[]; + groupAlignments: ArchitectureGroupAlignments; +} +export interface ArchitectureState extends Record { + nodes: Record; + groups: Record; + edges: ArchitectureEdge[]; + registeredIds: Record; + dataStructures?: ArchitectureDataStructures; + elements: Record; + config: ArchitectureDiagramConfig; +} +export interface EdgeSingularData { + id: string; + label?: string; + source: string; + sourceDir: ArchitectureDirection; + sourceArrow?: boolean; + sourceGroup?: boolean; + target: string; + targetDir: ArchitectureDirection; + targetArrow?: boolean; + targetGroup?: boolean; + [key: string]: any; +} +export declare const edgeData: (edge: cytoscape.EdgeSingular) => EdgeSingularData; +export interface EdgeSingular extends cytoscape.EdgeSingular { + _private: { + bodyBounds: unknown; + rscratch: { + startX: number; + startY: number; + midX: number; + midY: number; + endX: number; + endY: number; + }; + }; + data(): EdgeSingularData; + data(key: T): EdgeSingularData[T]; +} +export type NodeSingularData = { + type: 'service'; + id: string; + icon?: string; + label?: string; + parent?: string; + width: number; + height: number; + [key: string]: any; +} | { + type: 'junction'; + id: string; + parent?: string; + width: number; + height: number; + [key: string]: any; +} | { + type: 'group'; + id: string; + icon?: string; + label?: string; + parent?: string; + [key: string]: any; +}; +export declare const nodeData: (node: cytoscape.NodeSingular) => NodeSingularData; +export interface NodeSingular extends cytoscape.NodeSingular { + _private: { + bodyBounds: { + h: number; + w: number; + x1: number; + x2: number; + y1: number; + y2: number; + }; + children: cytoscape.NodeSingular[]; + }; + data(): NodeSingularData; + data(key: T): NodeSingularData[T]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/svgDraw.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/svgDraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e7bcf32d9d90b0a99e0c5e372dede756672f985 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/svgDraw.d.ts @@ -0,0 +1,8 @@ +import type cytoscape from 'cytoscape'; +import type { D3Element } from '../../types.js'; +import type { ArchitectureDB } from './architectureDb.js'; +import { type ArchitectureJunction, type ArchitectureService } from './architectureTypes.js'; +export declare const drawEdges: (edgesEl: D3Element, cy: cytoscape.Core, db: ArchitectureDB, diagramId: string) => Promise; +export declare const drawGroups: (groupsEl: D3Element, cy: cytoscape.Core, db: ArchitectureDB, diagramId: string) => Promise; +export declare const drawServices: (db: ArchitectureDB, elem: D3Element, services: ArchitectureService[], diagramId: string) => Promise; +export declare const drawJunctions: (db: ArchitectureDB, elem: D3Element, junctions: ArchitectureJunction[], diagramId: string) => void; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/architecture/svgDraw.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/svgDraw.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/architecture/svgDraw.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDB.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDB.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..479804c07a5026b31dd19143d7c718b0111b0473 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDB.d.ts @@ -0,0 +1,65 @@ +import type { DiagramDB } from '../../diagram-api/types.js'; +import type { Block, ClassDef } from './blockTypes.js'; +/** + * Called when the parser comes across a (style) class definition + * @example classDef my-style fill:#f96; + * + * @param id - the id of this (style) class + * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma) + */ +export declare const addStyleClass: (id: string, styleAttributes?: string) => void; +/** + * Called when the parser comes across a style definition + * @example style my-block-id fill:#f96; + * + * @param id - the id of the block to style + * @param styles - the string with 1 or more style attributes (each separated by a comma) + */ +export declare const addStyle2Node: (id: string, styles?: string) => void; +/** + * Add a CSS/style class to the block with the given id. + * If the block isn't already in the list of known blocks, add it. + * Might be called by parser when a CSS/style class should be applied to a block + * + * @param itemIds - The id or a list of ids of the item(s) to apply the css class to + * @param cssClassName - CSS class name + */ +export declare const setCssClass: (itemIds: string, cssClassName: string) => void; +export declare function typeStr2Type(typeStr: string): "stadium" | "subroutine" | "cylinder" | "circle" | "diamond" | "hexagon" | "lean_right" | "lean_left" | "trapezoid" | "inv_trapezoid" | "doublecircle" | "rect_left_inv_arrow" | "square" | "round" | "na" | "block_arrow"; +export declare function edgeTypeStr2Type(typeStr: string): string; +export declare function edgeStrToEdgeData(typeStr: string): string; +export declare function edgeStrToEdgeStartData(typeStr: string): string; +export declare function edgeStrToThickness(typeStr: string): string; +export declare function edgeStrToPattern(typeStr: string): string; +export declare const generateId: () => string; +/** + * Return all of the style classes + */ +export declare const getClasses: () => Map; +declare const db: { + readonly getConfig: () => import("./blockTypes.js").BlockConfig | undefined; + readonly typeStr2Type: typeof typeStr2Type; + readonly edgeTypeStr2Type: typeof edgeTypeStr2Type; + readonly edgeStrToEdgeData: typeof edgeStrToEdgeData; + readonly edgeStrToEdgeStartData: typeof edgeStrToEdgeStartData; + readonly edgeStrToThickness: typeof edgeStrToThickness; + readonly edgeStrToPattern: typeof edgeStrToPattern; + readonly getLogger: () => Record; + readonly getBlocksFlat: () => Block[]; + readonly getBlocks: () => Block[]; + readonly getEdges: () => Block[]; + readonly setHierarchy: (block: Block[]) => void; + readonly getBlock: (id: string) => Block | undefined; + readonly setBlock: (block: Block) => void; + readonly getColumns: (blockId: string) => number; + readonly getClasses: () => Map; + readonly clear: () => void; + readonly generateId: () => string; + readonly setDiagramId: (id: string) => void; + readonly getDiagramId: () => string; +}; +export type BlockDB = typeof db & DiagramDB; +export default db; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDB.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDB.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDB.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/blockRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ac18f711ced56bdfd6038124e951e2e69b3805d3 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockRenderer.d.ts @@ -0,0 +1,8 @@ +import type { Diagram } from '../../Diagram.js'; +export declare const getClasses: (text: any, diagObj: any) => any; +export declare const draw: (text: string, id: string, _version: string, diagObj: Diagram) => Promise; +declare const _default: { + draw: (text: string, id: string, _version: string, diagObj: Diagram) => Promise; + getClasses: (text: any, diagObj: any) => any; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/blockTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..07d572678d9d7ad6d3f358e9f7c2f3aef7299283 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockTypes.d.ts @@ -0,0 +1,38 @@ +export type { BlockDiagramConfig as BlockConfig } from '../../config.type.js'; +export type BlockType = 'na' | 'column-setting' | 'edge' | 'round' | 'block_arrow' | 'space' | 'square' | 'diamond' | 'hexagon' | 'odd' | 'lean_right' | 'lean_left' | 'trapezoid' | 'inv_trapezoid' | 'rect_left_inv_arrow' | 'odd_right' | 'circle' | 'ellipse' | 'stadium' | 'subroutine' | 'cylinder' | 'group' | 'doublecircle' | 'classDef' | 'applyClass' | 'applyStyles' | 'composite'; +export interface Block { + start?: string; + end?: string; + arrowTypeEnd?: string; + arrowTypeStart?: string; + thickness?: string; + pattern?: string; + width?: number; + id: string; + label?: string; + intersect?: any; + parent?: Block; + type?: BlockType; + children: Block[]; + size?: { + width: number; + height: number; + x: number; + y: number; + }; + node?: any; + columns?: number; + classes?: string[]; + directions?: string[]; + css?: string; + styleClass?: string; + styles?: string[]; + stylesStr?: string; + widthInColumns?: number; +} +export interface ClassDef { + id: string; + textStyles: string[]; + styles: string[]; +} +export type Direction = 'up' | 'down' | 'left' | 'right' | 'x' | 'y'; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/blockUtils.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockUtils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9448d4c39f25a389fff39d969e18bbad5810bf7 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/blockUtils.d.ts @@ -0,0 +1 @@ +export declare const prepareTextForParsing: (text: string) => string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/layout.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/layout.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1a2c54e14f3ca97786424cc9ff22dd34df8632dd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/layout.d.ts @@ -0,0 +1,13 @@ +import type { BlockDB } from './blockDB.js'; +interface BlockPosition { + px: number; + py: number; +} +export declare function calculateBlockPosition(columns: number, position: number): BlockPosition; +export declare function layout(db: BlockDB): { + x: number; + y: number; + width: number; + height: number; +} | undefined; +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/layout.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/layout.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/layout.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/parser/block.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/parser/block.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/parser/block.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/renderHelpers.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/renderHelpers.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..83574f10d36b79921d500b8e8b12679e89f5f176 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/renderHelpers.d.ts @@ -0,0 +1,10 @@ +import type { BlockDB } from './blockDB.js'; +import type { Block } from './blockTypes.js'; +declare function calculateBlockSize(elem: d3.Selection, block: any, db: any): Promise; +type ActionFun = typeof calculateBlockSize; +export declare function insertBlockPositioned(elem: any, block: Block, db: any): Promise; +export declare function performOperations(elem: d3.Selection, blocks: Block[], db: BlockDB, operation: ActionFun): Promise; +export declare function calculateBlockSizes(elem: any, blocks: Block[], db: BlockDB): Promise; +export declare function insertBlocks(elem: d3.Selection, blocks: Block[], db: BlockDB): Promise; +export declare function insertEdges(elem: any, edges: Block[], blocks: Block[], db: BlockDB, id: string): Promise; +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/block/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/block/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..14b37692a6f0c6943126e229d7195869ea5fb7c0 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/block/styles.d.ts @@ -0,0 +1,18 @@ +/** Returns the styles given options */ +export interface BlockChartStyleOptions { + arrowheadColor: string; + border2: string; + clusterBkg: string; + clusterBorder: string; + edgeLabelBackground: string; + fontFamily: string; + lineColor: string; + mainBkg: string; + nodeBorder: string; + nodeTextColor: string; + tertiaryColor: string; + textColor: string; + titleColor: string; +} +declare const getStyles: (options: BlockChartStyleOptions) => string; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Db.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Db.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..23d8348db1f756ce39acb6ff4a1ab85253162cbc --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Db.d.ts @@ -0,0 +1,127 @@ +export function getC4Type(): any; +export function setC4Type(c4TypeParam: any): void; +export function addRel(type: any, from: any, to: any, label: any, techn: any, descr: any, sprite: any, tags: any, link: any): void; +export function addPersonOrSystem(typeC4Shape: any, alias: any, label: any, descr: any, sprite: any, tags: any, link: any): void; +export function addContainer(typeC4Shape: any, alias: any, label: any, techn: any, descr: any, sprite: any, tags: any, link: any): void; +export function addComponent(typeC4Shape: any, alias: any, label: any, techn: any, descr: any, sprite: any, tags: any, link: any): void; +export function addPersonOrSystemBoundary(alias: any, label: any, type: any, tags: any, link: any): void; +export function addContainerBoundary(alias: any, label: any, type: any, tags: any, link: any): void; +export function addDeploymentNode(nodeType: any, alias: any, label: any, type: any, descr: any, sprite: any, tags: any, link: any): void; +export function popBoundaryParseStack(): void; +export function updateElStyle(typeC4Shape: any, elementName: any, bgColor: any, fontColor: any, borderColor: any, shadowing: any, shape: any, sprite: any, techn: any, legendText: any, legendSprite: any): void; +export function updateRelStyle(typeC4Shape: any, from: any, to: any, textColor: any, lineColor: any, offsetX: any, offsetY: any): void; +export function updateLayoutConfig(typeC4Shape: any, c4ShapeInRowParam: any, c4BoundaryInRowParam: any): void; +export function getC4ShapeInRow(): number; +export function getC4BoundaryInRow(): number; +export function getCurrentBoundaryParse(): string; +export function getParentBoundaryParse(): string; +export function getC4ShapeArray(parentBoundary: any): any[]; +export function getC4Shape(alias: any): any; +export function getC4ShapeKeys(parentBoundary: any): string[]; +export function getBoundaries(parentBoundary: any): { + alias: string; + label: { + text: string; + }; + type: { + text: string; + }; + tags: null; + link: null; + parentBoundary: string; +}[]; +export function getBoundarys(parentBoundary: any): { + alias: string; + label: { + text: string; + }; + type: { + text: string; + }; + tags: null; + link: null; + parentBoundary: string; +}[]; +export function getRels(): any[]; +export function getTitle(): string; +export function setWrap(wrapSetting: any): void; +export function autoWrap(): boolean; +export function clear(): void; +export namespace LINETYPE { + let SOLID: number; + let DOTTED: number; + let NOTE: number; + let SOLID_CROSS: number; + let DOTTED_CROSS: number; + let SOLID_OPEN: number; + let DOTTED_OPEN: number; + let LOOP_START: number; + let LOOP_END: number; + let ALT_START: number; + let ALT_ELSE: number; + let ALT_END: number; + let OPT_START: number; + let OPT_END: number; + let ACTIVE_START: number; + let ACTIVE_END: number; + let PAR_START: number; + let PAR_AND: number; + let PAR_END: number; + let RECT_START: number; + let RECT_END: number; + let SOLID_POINT: number; + let DOTTED_POINT: number; +} +export namespace ARROWTYPE { + let FILLED: number; + let OPEN: number; +} +export namespace PLACEMENT { + let LEFTOF: number; + let RIGHTOF: number; + let OVER: number; +} +export function setTitle(txt: any): void; +declare namespace _default { + export { addPersonOrSystem }; + export { addPersonOrSystemBoundary }; + export { addContainer }; + export { addContainerBoundary }; + export { addComponent }; + export { addDeploymentNode }; + export { popBoundaryParseStack }; + export { addRel }; + export { updateElStyle }; + export { updateRelStyle }; + export { updateLayoutConfig }; + export { autoWrap }; + export { setWrap }; + export { getC4ShapeArray }; + export { getC4Shape }; + export { getC4ShapeKeys }; + export { getBoundaries }; + export { getBoundarys }; + export { getCurrentBoundaryParse }; + export { getParentBoundaryParse }; + export { getRels }; + export { getTitle }; + export { getC4Type }; + export { getC4ShapeInRow }; + export { getC4BoundaryInRow }; + export { setAccTitle }; + export { getAccTitle }; + export { getAccDescription }; + export { setAccDescription }; + export function getConfig(): import("../../config.type.js").C4DiagramConfig | undefined; + export { clear }; + export { LINETYPE }; + export { ARROWTYPE }; + export { PLACEMENT }; + export { setTitle }; + export { setC4Type }; +} +export default _default; +import { setAccTitle } from '../common/commonDb.js'; +import { getAccTitle } from '../common/commonDb.js'; +import { getAccDescription } from '../common/commonDb.js'; +import { setAccDescription } from '../common/commonDb.js'; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Detector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Diagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Diagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Diagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Renderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Renderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f1ea5fe24190c38f044a6274d336b2315a1a5a39 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/c4/c4Renderer.d.ts @@ -0,0 +1,12 @@ +export function setConf(cnf: any): void; +export function drawBoundary(diagram: any, boundary: any, bounds: any): void; +export function drawC4ShapeArray(currentBounds: any, diagram: any, c4ShapeArray: any, c4ShapeKeys: any): void; +export function drawRels(diagram: any, rels: any, getC4ShapeObj: any, diagObj: any, diagramId: any): void; +export function draw(_text: any, id: any, _version: any, diagObj: any): void; +declare namespace _default { + export { drawC4ShapeArray as drawPersonOrSystemArray }; + export { drawBoundary }; + export { setConf }; + export { draw }; +} +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/c4/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/c4/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/c4/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/c4/svgDraw.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/c4/svgDraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0af80a3343070b865a466a711ae5fff5237d517e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/c4/svgDraw.d.ts @@ -0,0 +1,34 @@ +export function drawRect(elem: any, rectData: any): import("../common/commonTypes.js").D3RectElement; +export function drawImage(elem: any, width: any, height: any, x: any, y: any, link: any): void; +export function drawRels(elem: any, rels: any, conf: any, diagramId: any): void; +export function drawC4Shape(elem: any, c4Shape: any, conf: any): any; +export function insertDatabaseIcon(elem: any, id: any): void; +export function insertComputerIcon(elem: any, id: any): void; +export function insertClockIcon(elem: any, id: any): void; +export function insertArrowHead(elem: any, id: any): void; +export function insertArrowEnd(elem: any, id: any): void; +export function insertArrowFilledHead(elem: any, id: any): void; +export function insertArrowCrossHead(elem: any, id: any): void; +declare namespace _default { + export { drawRect }; + export { drawBoundary }; + export { drawC4Shape }; + export { drawRels }; + export { drawImage }; + export { insertArrowHead }; + export { insertArrowEnd }; + export { insertArrowFilledHead }; + export { insertArrowCrossHead }; + export { insertDatabaseIcon }; + export { insertComputerIcon }; + export { insertClockIcon }; +} +export default _default; +/** + * Draws a boundary in the diagram + * + * @param {any} elem - The diagram we'll draw to. + * @param {any} boundary - The boundary to draw. + * @param {any} conf - DrawText implementation discriminator object + */ +declare function drawBoundary(elem: any, boundary: any, conf: any): void; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6ded1fb5442df989bc1670df6a77a01c2bdba004 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDb.d.ts @@ -0,0 +1,163 @@ +import type { ClassRelation, ClassNode, ClassNote, ClassNoteMap, ClassMap, NamespaceMap, NamespaceNode } from './classTypes.js'; +import type { Node, Edge } from '../../rendering-util/types.js'; +import type { DiagramDB } from '../../diagram-api/types.js'; +export declare class ClassDB implements DiagramDB { + private relations; + private classes; + private readonly styleClasses; + private notes; + private interfaces; + private namespaces; + private namespaceCounter; + private namespaceStack; + private diagramId; + private functions; + constructor(); + private splitClassNameAndType; + setClassLabel(_id: string, label: string): void; + /** + * Function called by parser when a node definition has been found. + * + * @param id - ID of the class to add + * @public + */ + addClass(_id: string): void; + private addInterface; + /** + * Sets the diagram's SVG element ID, used to prefix domIds for uniqueness + * across multiple diagrams on the same page. + */ + setDiagramId(svgElementId: string): void; + /** + * Function to lookup domId from id in the graph definition. + * When diagramId is set, returns the prefixed version for DOM uniqueness. + * + * @param id - class ID to lookup + * @public + */ + lookUpDomId(_id: string): string; + clear(): void; + getClass(id: string): ClassNode; + getClasses(): ClassMap; + getRelations(): ClassRelation[]; + getNote(id: string | number): ClassNote; + getNotes(): ClassNoteMap; + addRelation(classRelation: ClassRelation): void; + /** + * Adds an annotation to the specified class Annotations mark special properties of the given type + * (like 'interface' or 'service') + * + * @param className - The class name + * @param annotation - The name of the annotation without any brackets + * @public + */ + addAnnotation(className: string, annotation: string): void; + /** + * Adds a member to the specified class + * + * @param className - The class name + * @param member - The full name of the member. If the member is enclosed in `<>` it is + * treated as an annotation If the member is ending with a closing bracket ) it is treated as a + * method Otherwise the member will be treated as a normal property + * @public + */ + addMember(className: string, member: string): void; + addMembers(className: string, members: string[]): void; + addNote(text: string, className: string): string; + cleanupLabel(label: string): string; + /** + * Called by parser when assigning cssClass to a class + * + * @param ids - Comma separated list of ids + * @param className - Class to add + */ + setCssClass(ids: string, className: string): void; + defineClass(ids: string[], style: string[]): void; + /** + * Called by parser when a tooltip is found, e.g. a clickable element. + * + * @param ids - Comma separated list of ids + * @param tooltip - Tooltip to add + */ + setTooltip(ids: string, tooltip?: string): void; + getTooltip(id: string, namespace?: string): string | undefined; + /** + * Called by parser when a link is found. Adds the URL to the vertex data. + * + * @param ids - Comma separated list of ids + * @param linkStr - URL to create a link for + * @param target - Target of the link, _blank by default as originally defined in the svgDraw.js file + */ + setLink(ids: string, linkStr: string, target: string): void; + /** + * Called by parser when a click definition is found. Registers an event handler. + * + * @param ids - Comma separated list of ids + * @param functionName - Function to be called on click + * @param functionArgs - Function args the function should be called with + */ + setClickEvent(ids: string, functionName: string, functionArgs: string): void; + private setClickFunc; + bindFunctions(element: Element): void; + readonly lineType: { + LINE: number; + DOTTED_LINE: number; + }; + readonly relationType: { + AGGREGATION: number; + EXTENSION: number; + COMPOSITION: number; + DEPENDENCY: number; + LOLLIPOP: number; + }; + private escapeHtml; + private readonly setupToolTips; + private direction; + getDirection(): string; + setDirection(dir: string): void; + private static resolveQualifiedId; + private static getAncestorIds; + private createNamespaceNode; + private linkParentChild; + addNamespace(id: string, label?: string): string; + popNamespace(): void; + getNamespace(name: string): NamespaceNode; + getNamespaces(): NamespaceMap; + /** + * Function called by parser when a namespace definition has been found. + * + * @param id - ID of the namespace to add + * @param classNames - IDs of the class to add + * @param noteNames - IDs of the notes to add + * @public + */ + addClassesToNamespace(id: string, classNames: string[], noteNames: string[]): void; + setCssStyle(id: string, styles: string[]): void; + /** + * Gets the arrow marker for a type index + * + * @param type - The type to look for + * @returns The arrow marker + */ + private getArrowMarker; + /** + * Walks up the namespace tree from the given id and returns the nearest ancestor + * (or the id itself) that is marked as explicit. Used by compact rendering mode + * to reassign children to the nearest user-declared namespace. + */ + private resolveExplicitAncestor; + getData(): { + nodes: Node[]; + edges: Edge[]; + other: {}; + config: import("../../config.type.js").MermaidConfig; + direction: string; + }; + setAccTitle: (txt: string) => void; + getAccTitle: () => string; + setAccDescription: (txt: string) => void; + getAccDescription: () => string; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; + getConfig: () => import("../../config.type.js").ClassDiagramConfig | undefined; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classDetector-V2.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDetector-V2.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDetector-V2.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classDiagram-v2.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDiagram-v2.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDiagram-v2.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classDiagram.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDiagram.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classDiagram.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classRenderer-v2.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classRenderer-v2.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1dcd97772a36c7023c0fe8358b95ffa9c6f90c50 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classRenderer-v2.d.ts @@ -0,0 +1,57 @@ +import * as graphlib from 'dagre-d3-es/src/graphlib/index.js'; +import type { ClassRelation, ClassMap, ClassNoteMap, NamespaceMap } from './classTypes.js'; +/** + * Function that adds the vertices found during parsing to the graph to be rendered. + * + * @param namespaces - Object containing the vertices. + * @param g - The graph that is to be drawn. + * @param _id - id of the graph + * @param diagObj - The diagram object + */ +export declare const addNamespaces: (namespaces: NamespaceMap, g: graphlib.Graph, _id: string, diagObj: any) => void; +/** + * Function that adds the vertices found during parsing to the graph to be rendered. + * + * @param classes - Object containing the vertices. + * @param g - The graph that is to be drawn. + * @param _id - id of the graph + * @param diagObj - The diagram object + * @param parent - id of the parent namespace, if it exists + */ +export declare const addClasses: (classes: ClassMap, g: graphlib.Graph, _id: string, diagObj: any, parent?: string) => void; +/** + * Function that adds the additional vertices (notes) found during parsing to the graph to be rendered. + * + * @param notes - Object containing the additional vertices (notes). + * @param g - The graph that is to be drawn. + * @param startEdgeId - starting index for note edge + * @param classes - Classes + */ +export declare const addNotes: (notes: ClassNoteMap, g: graphlib.Graph, startEdgeId: number, classes: ClassMap, parent?: string) => void; +/** + * Add edges to graph based on parsed graph definition + * + * @param relations - + * @param g - The graph object + */ +export declare const addRelations: (relations: ClassRelation[], g: graphlib.Graph) => void; +/** + * Merges the value of `conf` with the passed `cnf` + * + * @param cnf - Config to merge + */ +export declare const setConf: (cnf: any) => void; +/** + * Draws a class diagram in the tag with id: id based on the definition in text. + * + * @param text - + * @param id - + * @param _version - + * @param diagObj - + */ +export declare const draw: (text: string, id: string, _version: string, diagObj: any) => Promise; +declare const _default: { + setConf: (cnf: any) => void; + draw: (text: string, id: string, _version: string, diagObj: any) => Promise; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classRenderer-v3-unified.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classRenderer-v3-unified.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b46fc4f65e8683b0555a106561c5c8e49a417c38 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classRenderer-v3-unified.d.ts @@ -0,0 +1,18 @@ +import type { DiagramStyleClassDef } from '../../diagram-api/types.js'; +/** + * Get the direction from the statement items. + * Look through all of the documents (docs) in the parsedItems + * Because is a _document_ direction, the default direction is not necessarily the same as the overall default _diagram_ direction. + * @param parsedItem - the parsed statement item to look through + * @param defaultDir - the direction to use if none is found + * @returns The direction to use + */ +export declare const getDir: (parsedItem: any, defaultDir?: string) => string; +export declare const getClasses: (text: string, diagramObj: any) => Map; +export declare const draw: (text: string, id: string, _version: string, diag: any) => Promise; +declare const _default: { + getClasses: (text: string, diagramObj: any) => Map; + draw: (text: string, id: string, _version: string, diag: any) => Promise; + getDir: (parsedItem: any, defaultDir?: string) => string; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6532d50d53008b6ee377b458eb0382139df2c46 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classRenderer.d.ts @@ -0,0 +1,5 @@ +export function draw(text: string, id: string, _version: any, diagObj: any): void; +declare namespace _default { + export { draw }; +} +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d8a8400dcdd889e6ef824cd3fb321af84e140ab5 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classTypes.d.ts @@ -0,0 +1,104 @@ +export interface ClassNode { + id: string; + type: string; + label: string; + shape: 'classBox'; + text: string; + cssClasses: string; + methods: ClassMember[]; + members: ClassMember[]; + annotations: string[]; + domId: string; + styles: string[]; + parent?: string; + link?: string; + linkTarget?: string; + haveCallback?: boolean; + tooltip?: string; + look?: string; +} +export type Visibility = '#' | '+' | '~' | '-' | ''; +export declare const visibilityValues: string[]; +/** + * Parses and stores class diagram member variables/methods. + * + */ +export declare class ClassMember { + id: string; + cssStyle: string; + memberType: 'method' | 'attribute'; + visibility: Visibility; + text: string; + /** + * denote if static or to determine which css class to apply to the node + * @defaultValue '' + */ + classifier: string; + /** + * parameters for method + * @defaultValue '' + */ + parameters: string; + /** + * return type for method + * @defaultValue '' + */ + returnType: string; + constructor(input: string, memberType: 'method' | 'attribute'); + getDisplayDetails(): { + displayText: string; + cssStyle: string; + }; + parseMember(input: string): void; + parseClassifier(): "" | "font-style:italic;" | "text-decoration:underline;"; +} +export interface ClassNote { + id: string; + class: string; + text: string; + index: number; + parent?: string; +} +export interface ClassRelation { + id1: string; + id2: string; + relationTitle1: string; + relationTitle2: string; + type: string; + title: string; + text: string; + style: string[]; + relation: { + type1: number; + type2: number; + lineType: number; + }; +} +export interface Interface { + id: string; + label: string; + classId: string; +} +export interface NamespaceNode { + id: string; + label: string; + domId: string; + classes: ClassMap; + notes: ClassNoteMap; + children: NamespaceMap; + parent?: string; + /** + * True if this namespace was explicitly declared by the user (e.g. `namespace A.B { ... }`). + * False for intermediate ancestors auto-created when parsing a dotted name. + * Used by compact (non-hierarchical) rendering mode to only emit declared namespaces. + */ + explicit: boolean; +} +export interface StyleClass { + id: string; + styles: string[]; + textStyles: string[]; +} +export type ClassMap = Map; +export type ClassNoteMap = Map; +export type NamespaceMap = Map; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/classTypes.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/classTypes.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/classTypes.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/shapeUtil.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/shapeUtil.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1807a411817bbcc064610a7ea69bf1dcfacd3dc --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/shapeUtil.d.ts @@ -0,0 +1,6 @@ +import type { MermaidConfig } from '../../config.type.js'; +import type { D3Selection } from '../../types.js'; +export declare function textHelper(parent: D3Selection, node: any, config: MermaidConfig, useHtmlLabels: boolean, GAP?: number): Promise<{ + shapeSvg: import("d3-selection").Selection; + bbox: DOMRect; +}>; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/class/svgDraw.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/class/svgDraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..25896a243996db3dc2bb67e0285807057940be40 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/class/svgDraw.d.ts @@ -0,0 +1,25 @@ +export function drawEdge(elem: any, path: any, relation: any, conf: any, diagObj: any): void; +export function drawClass(elem: SVGSVGElement, classDef: any, conf: any, diagObj: any): { + id: any; + label: any; + width: number; + height: number; +}; +export function getClassTitleString(classDef: any): any; +export function drawNote(elem: SVGSVGElement, note: { + id: string; + text: string; + class: string; +}, conf: any, _diagObj: any): { + id: string; + text: string; + width: number; + height: number; +}; +declare namespace _default { + export { getClassTitleString }; + export { drawClass }; + export { drawEdge }; + export { drawNote }; +} +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/common/common.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/common/common.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ac4ac7580cf90de6bc5ad519ba951643a6e0bb1f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/common/common.d.ts @@ -0,0 +1,112 @@ +import { evaluate } from '../../config.js'; +import type { MermaidConfig } from '../../config.type.js'; +export declare const lineBreakRegex: RegExp; +/** + * Gets the rows of lines in a string + * + * @param s - The string to check the lines for + * @returns The rows in that string + */ +export declare const getRows: (s?: string) => string[]; +/** + * Removes script tags from a text + * + * @param txt - The text to sanitize + * @returns The safer text + */ +export declare const removeScript: (txt: string) => string; +export declare const sanitizeText: (text: string, config: MermaidConfig) => string; +export declare const sanitizeTextOrArray: (a: string | string[] | string[][], config: MermaidConfig) => string | string[]; +/** + * Whether or not a text has any line breaks + * + * @param text - The text to test + * @returns Whether or not the text has breaks + */ +export declare const hasBreaks: (text: string) => boolean; +/** + * Splits on
tags + * + * @param text - Text to split + * @returns List of lines as strings + */ +export declare const splitBreaks: (text: string) => string[]; +/** + * Gets the current URL + * + * @param useAbsolute - Whether to return the absolute URL or not + * @returns The current URL + */ +export declare const getUrl: (useAbsolute: boolean) => string; +export { evaluate }; +/** + * Wrapper around Math.max which removes non-numeric values + * Returns the larger of a set of supplied numeric expressions. + * @param values - Numeric expressions to be evaluated + * @returns The smaller value + */ +export declare const getMax: (...values: number[]) => number; +/** + * Wrapper around Math.min which removes non-numeric values + * Returns the smaller of a set of supplied numeric expressions. + * @param values - Numeric expressions to be evaluated + * @returns The smaller value + */ +export declare const getMin: (...values: number[]) => number; +/** + * Makes generics in typescript syntax + * + * @example + * Array of array of strings in typescript syntax + * + * ```js + * // returns "Array>" + * parseGenericTypes('Array~Array~string~~'); + * ``` + * @param text - The text to convert + * @returns The converted string + */ +export declare const parseGenericTypes: (input: string) => string; +export declare const countOccurrence: (string: string, substring: string) => number; +export declare const isMathMLSupported: () => boolean; +export declare const katexRegex: RegExp; +/** + * Whether or not a text has KaTeX delimiters + * + * @param text - The text to test + * @returns Whether or not the text has KaTeX delimiters + */ +export declare const hasKatex: (text: string) => boolean; +/** + * Computes the minimum dimensions needed to display a div containing MathML + * + * @param text - The text to test + * @param config - Configuration for Mermaid + * @returns Object containing \{width, height\} + */ +export declare const calculateMathMLDimensions: (text: string, config: MermaidConfig) => Promise<{ + width: number; + height: number; +}>; +/** + * Attempts to render and return the KaTeX portion of a string with MathML + * + * @param text - The text to test + * @param config - Configuration for Mermaid + * @returns String containing MathML if KaTeX is supported, or an error message if it is not and stylesheets aren't present + */ +export declare const renderKatexSanitized: (text: string, config: MermaidConfig) => Promise; +declare const _default: { + getRows: (s?: string) => string[]; + sanitizeText: (text: string, config: MermaidConfig) => string; + sanitizeTextOrArray: (a: string | string[] | string[][], config: MermaidConfig) => string | string[]; + hasBreaks: (text: string) => boolean; + splitBreaks: (text: string) => string[]; + lineBreakRegex: RegExp; + removeScript: (txt: string) => string; + getUrl: (useAbsolute: boolean) => string; + evaluate: (val?: string | boolean | null) => boolean; + getMax: (...values: number[]) => number; + getMin: (...values: number[]) => number; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/common/common.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/common/common.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/common/common.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/common/commonDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/common/commonDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..143f5eea8e71cdc787ae7945091bd9620ebdb1bc --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/common/commonDb.d.ts @@ -0,0 +1,7 @@ +export declare const clear: () => void; +export declare const setAccTitle: (txt: string) => void; +export declare const getAccTitle: () => string; +export declare const setAccDescription: (txt: string) => void; +export declare const getAccDescription: () => string; +export declare const setDiagramTitle: (txt: string) => void; +export declare const getDiagramTitle: () => string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/common/commonTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/common/commonTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..671f19f4387e515c5a25eaa184f186c11119ad17 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/common/commonTypes.d.ts @@ -0,0 +1,51 @@ +export interface RectData { + x: number; + y: number; + fill: string; + width: number; + height: number; + stroke: string; + class?: string; + color?: string; + rx?: number; + ry?: number; + attrs?: Record; + anchor?: string; + name?: string; +} +export interface Bound { + startx: number; + stopx: number; + starty: number; + stopy: number; + fill: string; + stroke: string; +} +export interface TextData { + x: number; + y: number; + anchor: string; + text: string; + textMargin: number; + class?: string; +} +export interface TextObject { + x: number; + y: number; + width: number; + height: number; + fill?: string; + anchor?: string; + 'text-anchor': string; + style: string; + textMargin: number; + rx: number; + ry: number; + tspan: boolean; + valign?: string; +} +export type D3RectElement = d3.Selection; +export type D3UseElement = d3.Selection; +export type D3ImageElement = d3.Selection; +export type D3TextElement = d3.Selection; +export type D3TSpanElement = d3.Selection; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/common/populateCommonDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/common/populateCommonDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a4daf2e23faa0dcb243c3207b05706e69f66c06 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/common/populateCommonDb.d.ts @@ -0,0 +1,3 @@ +import type { DiagramAST } from '@mermaid-js/parser'; +import type { DiagramDB } from '../../diagram-api/types.js'; +export declare function populateCommonDb(ast: DiagramAST, db: DiagramDB): void; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/common/svgDrawCommon.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/common/svgDrawCommon.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..65c4d478c3ca4e4702cafd85b63422d680d56193 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/common/svgDrawCommon.d.ts @@ -0,0 +1,16 @@ +import type { SVG, SVGGroup } from '../../diagram-api/types.js'; +import type { Bound, D3RectElement, D3TextElement, RectData, TextData, TextObject } from './commonTypes.js'; +export declare const drawRect: (element: SVG | SVGGroup, rectData: RectData) => D3RectElement; +/** + * Draws a background rectangle + * + * @param element - Diagram (reference for bounds) + * @param bounds - Shape of the rectangle + */ +export declare const drawBackgroundRect: (element: SVG | SVGGroup, bounds: Bound) => void; +export declare const drawText: (element: SVG | SVGGroup, textData: TextData) => D3TextElement; +export declare const drawImage: (elem: SVG | SVGGroup, x: number, y: number, link: string) => void; +export declare const drawEmbeddedImage: (element: SVG | SVGGroup, x: number, y: number, link: string) => void; +export declare const getNoteRect: () => RectData; +export declare const getTextObj: () => TextObject; +export declare const createTooltip: () => import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/er/erDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/er/erDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3f21a3d949742e4bfe406a01be7d29f5f938e856 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/er/erDb.d.ts @@ -0,0 +1,53 @@ +import type { Edge, Node } from '../../rendering-util/types.js'; +import type { EntityNode, Attribute, Relationship, EntityClass, RelSpec } from './erTypes.js'; +import type { DiagramDB } from '../../diagram-api/types.js'; +export declare class ErDB implements DiagramDB { + private entities; + private relationships; + private classes; + private direction; + private Cardinality; + private Identification; + constructor(); + /** + * Add entity + * @param name - The name of the entity + * @param alias - The alias of the entity + */ + addEntity(name: string, alias?: string): EntityNode; + getEntity(name: string): EntityNode | undefined; + getEntities(): Map; + getClasses(): Map; + addAttributes(entityName: string, attribs: Attribute[]): void; + /** + * Add a relationship + * + * @param entA - The first entity in the relationship + * @param rolA - The role played by the first entity in relation to the second + * @param entB - The second entity in the relationship + * @param rSpec - The details of the relationship between the two entities + */ + addRelationship(entA: string, rolA: string, entB: string, rSpec: RelSpec): void; + getRelationships(): Relationship[]; + getDirection(): string; + setDirection(dir: string): void; + private getCompiledStyles; + addCssStyles(ids: string[], styles: string[]): void; + addClass(ids: string[], style: string[]): void; + setClass(ids: string[], classNames: string[]): void; + clear(): void; + getData(): { + nodes: Node[]; + edges: Edge[]; + other: {}; + config: import("../../config.type.js").MermaidConfig; + direction: string; + }; + setAccTitle: (txt: string) => void; + getAccTitle: () => string; + setAccDescription: (txt: string) => void; + getAccDescription: () => string; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; + getConfig: () => import("../../config.type.js").ErDiagramConfig | undefined; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/er/erDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/er/erDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/er/erDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/er/erDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/er/erDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7734661b659f338a4ae08835225bdd58024e0ba9 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/er/erDiagram.d.ts @@ -0,0 +1,8 @@ +import { ErDB } from './erDb.js'; +import * as renderer from './erRenderer-unified.js'; +export declare const diagram: { + parser: any; + readonly db: ErDB; + renderer: typeof renderer; + styles: import("../../diagram-api/types.js").DiagramStylesProvider; +}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/er/erMarkers.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/er/erMarkers.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fb88be25e7d3f764cf0991bdcd6b8d9a85d54637 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/er/erMarkers.d.ts @@ -0,0 +1,24 @@ +declare namespace _default { + export { ERMarkers }; + export { insertMarkers }; +} +export default _default; +declare namespace ERMarkers { + let ONLY_ONE_START: string; + let ONLY_ONE_END: string; + let ZERO_OR_ONE_START: string; + let ZERO_OR_ONE_END: string; + let ONE_OR_MORE_START: string; + let ONE_OR_MORE_END: string; + let ZERO_OR_MORE_START: string; + let ZERO_OR_MORE_END: string; + let MD_PARENT_END: string; + let MD_PARENT_START: string; +} +/** + * Put the markers into the svg DOM for later use with edge paths + * + * @param elem + * @param conf + */ +declare function insertMarkers(elem: any, conf: any): void; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/er/erRenderer-unified.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/er/erRenderer-unified.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cffe69b5cdc8c34202877724687f7ea1a2afd049 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/er/erRenderer-unified.d.ts @@ -0,0 +1 @@ +export declare const draw: (text: string, id: string, _version: string, diag: any) => Promise; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/er/erRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/er/erRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..247bfdedee20d004500e345729a9e261f8898162 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/er/erRenderer.d.ts @@ -0,0 +1,19 @@ +/** + * Return a unique id based on the given string. Start with the prefix, then a hyphen, then the + * simplified str, then a hyphen, then a unique uuid based on the str. (Hyphens are only included if needed.) + * Although the official XML standard for ids says that many more characters are valid in the id, + * this keeps things simple by accepting only A-Za-z0-9. + * + * @param {string} str Given string to use as the basis for the id. Default is `''` + * @param {string} prefix String to put at the start, followed by '-'. Default is `''` + * @returns {string} + * @see https://www.w3.org/TR/xml/#NT-Name + */ +export function generateId(str?: string, prefix?: string): string; +export function setConf(cnf: any): void; +export function draw(text: any, id: any, _version: any, diagObj: any): void; +declare namespace _default { + export { setConf }; + export { draw }; +} +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/er/erRenderer.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/er/erRenderer.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/er/erRenderer.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/er/erTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/er/erTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b48d292d9219f9d53bc3edd41260dd5449d269b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/er/erTypes.d.ts @@ -0,0 +1,35 @@ +export interface EntityNode { + id: string; + label: string; + attributes: Attribute[]; + alias: string; + shape: string; + look?: string; + cssClasses?: string; + cssStyles?: string[]; + cssCompiledStyles?: string[]; + labelType?: string; + colorIndex?: number; +} +export interface Attribute { + type: string; + name: string; + keys: ('PK' | 'FK' | 'UK')[]; + comment: string; +} +export interface Relationship { + entityA: string; + roleA: string; + entityB: string; + relSpec: RelSpec; +} +export interface RelSpec { + cardA: string; + cardB: string; + relType: string; +} +export interface EntityClass { + id: string; + styles: string[]; + textStyles: string[]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/er/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/er/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0377ad11cd5117c45305eb530d0fd2f0d382b2c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/er/styles.d.ts @@ -0,0 +1,3 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +declare const getStyles: DiagramStylesProvider; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/error/errorDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/error/errorDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c733f14fd91e6211717d389f9cac1867b70180f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/error/errorDiagram.d.ts @@ -0,0 +1,3 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +declare const diagram: DiagramDefinition; +export default diagram; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/error/errorRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/error/errorRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ff6dd7baf9a87476395e986c9236ddfaa6887c36 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/error/errorRenderer.d.ts @@ -0,0 +1,12 @@ +/** + * Draws an info picture in the tag with id: id based on the graph definition in text. + * + * @param _text - Mermaid graph definition. + * @param id - The text for the error + * @param version - The version + */ +export declare const draw: (_text: string, id: string, version: string) => void; +export declare const renderer: { + draw: (_text: string, id: string, version: string) => void; +}; +export default renderer; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/db.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/db.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3b77e27cc2a5440646c2499088da8033d7694dd3 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/db.d.ts @@ -0,0 +1,6 @@ +import type { EventModelingDB } from './types.js'; +export declare const setOptions: (_rawOptString: string) => void; +export declare const getOptions: () => {}; +export declare const clear: () => void; +export declare const getDirection: () => string; +export declare const db: EventModelingDB; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/detector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/diagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/diagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/diagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/eventmodeling.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/eventmodeling.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/eventmodeling.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/parser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/parser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/parser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/renderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/renderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0fa7acf184c7e503057cc30bdc3230085a059cb4 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/renderer.d.ts @@ -0,0 +1,6 @@ +import type { DrawDefinition } from '../../diagram-api/types.js'; +export declare const draw: DrawDefinition; +declare const _default: { + draw: DrawDefinition; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d316624ad70ff8d4afb6ae43fb634054621e803f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(_options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/types.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cda8d412a2381d0b4c43b612298878edb21c40f2 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/eventmodeling/types.d.ts @@ -0,0 +1,140 @@ +import type { EventModelingDiagramConfig } from '../../config.type.js'; +import type { DiagramDBBase } from '../../diagram-api/types.js'; +import type { EmFrame, EventModel } from '@mermaid-js/parser'; +export interface EventModelingDB extends DiagramDBBase { + setOptions: (rawOptString: string) => void; + getOptions: () => any; + setAst: (ast: EventModel) => void; + getDiagramProps: () => DiagramProps; + getState: () => Context; +} +export interface DiagramProps { + swimlaneMinHeight: number; + swimlanePadding: number; + swimlaneGap: number; + boxPadding: number; + boxOverlap: number; + boxDefaultY: number; + boxMinWidth: number; + boxMaxWidth: number; + boxMinHeight: number; + boxMaxHeight: number; + contentStartX: number; + textMaxWidth: number; + boxTextFontWeight: string; + boxTextPadding: number; + swimlaneTextFontWeight: string; + labelUiAutomation: string; + labelUiAutomationPrefix: string; + labelCommandReadModel: string; + labelCommandReadModelPrefix: string; + labelEvents: string; + labelEventsPrefix: string; +} +/** + * Visual + */ +export interface Dimension { + width: number; + height: number; +} +export interface Coordinate { + x: number; + y: number; +} +export type Color = string; +export interface VisualProps { + fill: Color; + stroke: Color; +} +export interface TextProps { + content: string; + width: number; + height: number; +} +export interface Box { + r: number; + x: number; + /** This has no meaning for the time being. It is calculated from Swimlane.y ATM. */ + y: number; + dimension: Dimension; + leftSibling: boolean; + swimlane: Swimlane; + visual: VisualProps; + text: string; + frame: EmFrame; + /** Line index */ + index: number; +} +export interface SwimlaneProps { + index: number; + label: string; + namespace?: string; +} +export type Swimlane = { + r: number; + y: number; + height: number; + maxHeight: number; +} & SwimlaneProps; +export interface Relation { + visual: VisualProps; + source: Coordinate; + target: Coordinate; + sourceBox: Box; + targetBox: Box; +} +export interface Context { + boxes: Box[]; + swimlanes: Record; + relations: Relation[]; + previousFrame?: EmFrame; + previousSwimlaneNumber?: number; + maxR: number; + sortedSwimlanesArray: Swimlane[]; +} +/** + * Commands & Events + */ +export declare const PositionFrameKind = "position frame"; +export type PositionFrame = { + index: number; + frame: EmFrame; + textProps: TextProps; +} & CommandBase; +export declare const FramePositionedKind = "frame positioned"; +export type FramePositioned = { + index: number; + frame: EmFrame; + visual: VisualProps; + dimension: Dimension; + textProps: TextProps; +} & EventBase; +export declare const PositionRelationKind = "position relation"; +export type PositionRelation = { + index: number; + frame: EmFrame; + sourceFrame?: EmFrame; +} & CommandBase; +export declare const RelationPositionedKind = "relation positioned"; +export type RelationPositioned = { + index: number; + frame: EmFrame; + sourceBox: Box; + targetBox: Box; +} & EventBase; +/** + * Decider & Event Sourcing support + */ +export type Command = PositionFrame | PositionRelation; +export type Event = FramePositioned | RelationPositioned; +export interface CommandBase { + $kind: string; +} +export interface EventBase { + $kind: string; +} +export type DecideFn = (state: Context, command: Command) => Event[]; +export type EvolveFn = (state: Context, event: Event) => Context; +export type Deciders = Record; +export type Evolvers = Record; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/elk/detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/elk/detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..487b54807ce4b3c1b3ebcce76ff1c875787350a8 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/elk/detector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..84fc42dab0a8910a3d44ebe55fc291b0502289ec --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDb.d.ts @@ -0,0 +1,165 @@ +import type { DiagramDB } from '../../diagram-api/types.js'; +import type { Edge, Node } from '../../rendering-util/types.js'; +import type { FlowClass, FlowEdge, FlowLink, FlowSubGraph, FlowText, FlowVertex, FlowVertexTypeParam } from './types.js'; +export declare class FlowDB implements DiagramDB { + private vertexCounter; + private config; + private diagramId; + private vertices; + private edges; + private classes; + private subGraphs; + private subGraphLookup; + private tooltips; + private subCount; + private firstGraphFlag; + private direction; + private version; + private secCount; + private posCrossRef; + private funs; + constructor(); + private sanitizeText; + private sanitizeNodeLabelType; + /** + * Sets the diagram's SVG element ID, used to prefix domIds for uniqueness + * across multiple diagrams on the same page. + */ + setDiagramId(svgElementId: string): void; + /** + * Function to lookup domId from id in the graph definition. + * When diagramId is set, returns the prefixed version for DOM uniqueness. + * + * @param id - id of the node + */ + lookUpDomId(id: string): string; + /** + * Function called by parser when a node definition has been found + */ + addVertex(id: string, textObj: FlowText, type: FlowVertexTypeParam, style: string[], classes: string[], dir: string, props: {} | undefined, metadata: any): void; + /** + * Function called by parser when a link/edge definition has been found + * + */ + addSingleLink(_start: string, _end: string, type: any, id?: string): void; + private isLinkData; + addLink(_start: string[], _end: string[], linkData: unknown): void; + /** + * Updates a link's line interpolation algorithm + */ + updateLinkInterpolate(positions: ('default' | number)[], interpolate: string): void; + /** + * Updates a link with a style + * + */ + updateLink(positions: ('default' | number)[], style: string[]): void; + addClass(ids: string, _style: string[]): void; + /** + * Called by parser when a graph definition is found, stores the direction of the chart. + * + */ + setDirection(dir: string): void; + /** + * Called by parser when a special node is found, e.g. a clickable element. + * + * @param ids - Comma separated list of ids + * @param className - Class to add + */ + setClass(ids: string, className: string): void; + setTooltip(ids: string, tooltip: string): void; + private setClickFun; + /** + * Called by parser when a link is found. Adds the URL to the vertex data. + * + * @param ids - Comma separated list of ids + * @param linkStr - URL to create a link for + * @param target - Target attribute for the link + */ + setLink(ids: string, linkStr: string, target: string): void; + getTooltip(id: string): string | undefined; + /** + * Called by parser when a click definition is found. Registers an event handler. + * + * @param ids - Comma separated list of ids + * @param functionName - Function to be called on click + * @param functionArgs - Arguments to be passed to the function + */ + setClickEvent(ids: string, functionName: string, functionArgs: string): void; + bindFunctions(element: Element): void; + getDirection(): string | undefined; + /** + * Retrieval function for fetching the found nodes after parsing has completed. + * + */ + getVertices(): Map; + /** + * Retrieval function for fetching the found links after parsing has completed. + * + */ + getEdges(): FlowEdge[] & { + defaultInterpolate?: string; + defaultStyle?: string[]; + }; + /** + * Retrieval function for fetching the found class definitions after parsing has completed. + * + */ + getClasses(): Map; + private setupToolTips; + /** + * Clears the internal graph db so that a new graph can be parsed. + * + */ + clear(ver?: string): void; + setGen(ver: string): void; + defaultStyle(): string; + addSubGraph(_id: { + text: string; + }, list: string[], _title: { + text: string; + type: string; + }): string; + private getPosForId; + private indexNodes2; + getDepthFirstPos(pos: number): number; + indexNodes(): void; + getSubGraphs(): FlowSubGraph[]; + firstGraph(): boolean; + private destructStartLink; + private countChar; + private destructEndLink; + destructLink(_str: string, _startStr: string): FlowLink | { + type: string; + stroke: string; + length: number; + }; + exists(allSgs: FlowSubGraph[], _id: string): boolean; + /** + * Deletes an id from all subgraphs + * + */ + makeUniq(sg: FlowSubGraph, allSubgraphs: FlowSubGraph[]): { + nodes: string[]; + }; + lex: { + firstGraph: typeof FlowDB.prototype.firstGraph; + }; + private getTypeFromVertex; + private findNode; + private destructEdgeType; + private addNodeFromVertex; + private getCompiledStyles; + getData(): { + nodes: Node[]; + edges: Edge[]; + other: {}; + config: import("../../config.type.js").MermaidConfig; + }; + defaultConfig(): import("../../config.type.js").FlowchartDiagramConfig | undefined; + setAccTitle: (txt: string) => void; + setAccDescription: (txt: string) => void; + setDiagramTitle: (txt: string) => void; + getAccTitle: () => string; + getAccDescription: () => string; + getDiagramTitle: () => string; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDb.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDb.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDb.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDetector-v2.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDetector-v2.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDetector-v2.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a9ca1e31e6c60c5c4704c37dd68a16614c75cbd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowDiagram.d.ts @@ -0,0 +1,12 @@ +import type { MermaidConfig } from '../../config.type.js'; +import { FlowDB } from './flowDb.js'; +export declare const diagram: { + parser: any; + readonly db: FlowDB; + renderer: { + getClasses: (text: string, diagramObj: any) => Map; + draw: (text: string, id: string, _version: string, diag: any) => Promise; + }; + styles: (options: import("./styles.js").FlowChartStyleOptions) => string; + init: (cnf: MermaidConfig) => void; +}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowRenderer-v3-unified.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowRenderer-v3-unified.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8948342ee736a2b4fe28961dd58625c7ffeff103 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowRenderer-v3-unified.d.ts @@ -0,0 +1,8 @@ +import type { DiagramStyleClassDef } from '../../diagram-api/types.js'; +export declare const getClasses: (text: string, diagramObj: any) => Map; +export declare const draw: (text: string, id: string, _version: string, diag: any) => Promise; +declare const _default: { + getClasses: (text: string, diagramObj: any) => Map; + draw: (text: string, id: string, _version: string, diag: any) => Promise; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowRenderer-v3-unified.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowRenderer-v3-unified.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/flowRenderer-v3-unified.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/parser/flowParser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/parser/flowParser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8b504b24655d40a67de677647d14a48907ce96fe --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/parser/flowParser.d.ts @@ -0,0 +1,2 @@ +declare const newParser: any; +export default newParser; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f54d2504ab7a93a12828901502e670511c6d2759 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/styles.d.ts @@ -0,0 +1,19 @@ +/** Returns the styles given options */ +export interface FlowChartStyleOptions { + arrowheadColor: string; + border2: string; + clusterBkg: string; + clusterBorder: string; + edgeLabelBackground: string; + fontFamily: string; + lineColor: string; + mainBkg: string; + nodeBorder: string; + nodeTextColor: string; + tertiaryColor: string; + textColor: string; + titleColor: string; + strokeWidth: string; +} +declare const getStyles: (options: FlowChartStyleOptions) => string; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/types.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f79a956665a0fb36698431fcfc18bdfcc828402 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/flowchart/types.d.ts @@ -0,0 +1,68 @@ +import type { ShapeID } from '../../rendering-util/rendering-elements/shapes.js'; +/** + * Valid `type` args to `yy.addVertex` taken from + * `packages/mermaid/src/diagrams/flowchart/parser/flow.jison` + */ +export type FlowVertexTypeParam = undefined | 'square' | 'doublecircle' | 'circle' | 'ellipse' | 'stadium' | 'subroutine' | 'rect' | 'cylinder' | 'round' | 'diamond' | 'hexagon' | 'odd' | 'trapezoid' | 'inv_trapezoid' | 'lean_right' | 'lean_left'; +export interface FlowVertex { + classes: string[]; + dir?: string; + domId: string; + haveCallback?: boolean; + id: string; + labelType: 'markdown' | 'string' | 'text'; + link?: string; + linkTarget?: string; + props?: any; + styles: string[]; + text?: string; + type?: ShapeID | FlowVertexTypeParam; + icon?: string; + form?: string; + pos?: 't' | 'b'; + img?: string; + assetWidth?: number; + assetHeight?: number; + defaultWidth?: number; + imageAspectRatio?: number; + constraint?: 'on' | 'off'; +} +export interface FlowText { + text: string; + type: 'text'; +} +export interface FlowEdge { + isUserDefinedId: boolean; + start: string; + end: string; + interpolate?: string; + type?: string; + stroke?: 'normal' | 'thick' | 'invisible' | 'dotted'; + style?: string[]; + length?: number; + text: string; + labelType: 'markdown' | 'string' | 'text'; + classes: string[]; + id?: string; + animation?: 'fast' | 'slow'; + animate?: boolean; +} +export interface FlowClass { + id: string; + styles: string[]; + textStyles: string[]; +} +export interface FlowSubGraph { + classes: string[]; + dir?: string; + id: string; + labelType: string; + nodes: string[]; + title: string; +} +export interface FlowLink { + length?: number; + stroke: string; + type: string; + text?: string; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0d3386306ca4b9036f1096e35d4da9e57e773b93 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDb.d.ts @@ -0,0 +1,110 @@ +export function clear(): void; +export function setDiagramId(id: any): void; +export function setAxisFormat(txt: any): void; +export function getAxisFormat(): string; +export function setTickInterval(txt: any): void; +export function getTickInterval(): any; +export function setTodayMarker(txt: any): void; +export function getTodayMarker(): string; +export function setDateFormat(txt: any): void; +export function enableInclusiveEndDates(): void; +export function endDatesAreInclusive(): boolean; +export function enableTopAxis(): void; +export function topAxisEnabled(): boolean; +export function setDisplayMode(txt: any): void; +export function getDisplayMode(): string; +export function getDateFormat(): string; +export function setIncludes(txt: any): void; +export function getIncludes(): any[]; +export function setExcludes(txt: any): void; +export function getExcludes(): any[]; +export function getLinks(): Map; +export function addSection(txt: any): void; +export function getSections(): any[]; +export function getTasks(): any[]; +export function isInvalidDate(date: any, dateFormat: any, excludes: any, includes: any): any; +export function setWeekday(txt: any): void; +export function getWeekday(): string; +export function setWeekend(startDay: any): void; +export function addTask(descr: any, data: any): void; +export function findTaskById(id: any): any; +export function addTaskOrg(descr: any, data: any): void; +export function setLink(ids: any, _linkStr: any): void; +export function setClass(ids: any, className: any): void; +export function setClickEvent(ids: any, functionName: any, functionArgs: any): void; +export function bindFunctions(element: any): void; +declare namespace _default { + export function getConfig(): import("../../config.type.js").GanttDiagramConfig | undefined; + export { clear }; + export { setDateFormat }; + export { getDateFormat }; + export { enableInclusiveEndDates }; + export { endDatesAreInclusive }; + export { enableTopAxis }; + export { topAxisEnabled }; + export { setAxisFormat }; + export { getAxisFormat }; + export { setTickInterval }; + export { getTickInterval }; + export { setTodayMarker }; + export { getTodayMarker }; + export { setAccTitle }; + export { getAccTitle }; + export { setDiagramTitle }; + export { getDiagramTitle }; + export { setDiagramId }; + export { setDisplayMode }; + export { getDisplayMode }; + export { setAccDescription }; + export { getAccDescription }; + export { addSection }; + export { getSections }; + export { getTasks }; + export { addTask }; + export { findTaskById }; + export { addTaskOrg }; + export { setIncludes }; + export { getIncludes }; + export { setExcludes }; + export { getExcludes }; + export { setClickEvent }; + export { setLink }; + export { getLinks }; + export { bindFunctions }; + export { parseDuration }; + export { isInvalidDate }; + export { setWeekday }; + export { getWeekday }; + export { setWeekend }; +} +export default _default; +import { setAccTitle } from '../common/commonDb.js'; +import { getAccTitle } from '../common/commonDb.js'; +import { setDiagramTitle } from '../common/commonDb.js'; +import { getDiagramTitle } from '../common/commonDb.js'; +import { setAccDescription } from '../common/commonDb.js'; +import { getAccDescription } from '../common/commonDb.js'; +/** + * Parse a string into the args for `dayjs.add()`. + * + * The string have to be compound by a value and a shorthand duration unit. For example `5d` + * represents 5 days. + * + * Please be aware that 1 day may be 23 or 25 hours, if the user lives in an area + * that has daylight savings time (or even 23.5/24.5 hours in Lord Howe Island!) + * + * Shorthand unit supported are: + * + * - `y` for years + * - `M` for months + * - `w` for weeks + * - `d` for days + * - `h` for hours + * - `s` for seconds + * - `ms` for milliseconds + * + * @param {string} str - A string representing the duration. + * @returns {[value: number, unit: dayjs.ManipulateType]} Arguments to pass to `dayjs.add()` + */ +declare function parseDuration(str: string): [value: number, unit: dayjs.ManipulateType]; +import dayjs from 'dayjs'; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDb.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDb.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDb.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..27307d8a9127666e93c5625f64bc47b9ac3a8e66 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/ganttRenderer.d.ts @@ -0,0 +1,7 @@ +export function setConf(): void; +export function draw(text: any, id: any, version: any, diagObj: any): void; +declare namespace _default { + export { setConf }; + export { draw }; +} +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/gantt/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/gantt/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraph.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraph.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraph.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphAst.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphAst.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2171d715dd83fda4705c82963b2f181f1e36c032 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphAst.d.ts @@ -0,0 +1,21 @@ +import type { DiagramOrientation, Commit, GitGraphDB, CommitDB, MergeDB, BranchDB, CherryPickDB } from './gitGraphTypes.js'; +export declare const setDirection: (dir: DiagramOrientation) => void; +export declare const setOptions: (rawOptString: string) => void; +export declare const getOptions: () => any; +export declare const commit: (commitDB: CommitDB) => void; +export declare const branch: (branchDB: BranchDB) => void; +export declare const merge: (mergeDB: MergeDB) => void; +export declare const cherryPick: (cherryPickDB: CherryPickDB) => void; +export declare const checkout: (branch: string) => void; +export declare const prettyPrint: () => void; +export declare const clear: () => void; +export declare const getBranchesAsObjArray: () => { + name: string; +}[]; +export declare const getBranches: () => Map; +export declare const getCommits: () => Map; +export declare const getCommitsArray: () => Commit[]; +export declare const getCurrentBranch: () => string; +export declare const getDirection: () => DiagramOrientation; +export declare const getHead: () => Commit | null; +export declare const db: GitGraphDB; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphParser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphParser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphParser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..88ea5756e125b5d18b488b6d1a2eb9d4cc282817 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphRenderer.d.ts @@ -0,0 +1,13 @@ +import type { DrawDefinition } from '../../diagram-api/types.js'; +/** + * Map a raw branch index to a CSS color-class index. + * When avoidMainColor is true (redux-color / redux-dark-color themes only), + * non-main branches cycle through 1…(limit-1) so color 0 is never reused. + * For all other themes the plain modulo is used. + */ +export declare const calcColorIndex: (rawIndex: number, limit: number, avoidDefaultColor?: boolean) => number; +export declare const draw: DrawDefinition; +declare const _default: { + draw: DrawDefinition; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b61f8c62da3348c7ad82f1605a2239e291cac018 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/git/gitGraphTypes.d.ts @@ -0,0 +1,121 @@ +import type { GitGraphDiagramConfig } from '../../config.type.js'; +import type { DiagramDBBase } from '../../diagram-api/types.js'; +export declare const commitType: { + readonly NORMAL: 0; + readonly REVERSE: 1; + readonly HIGHLIGHT: 2; + readonly MERGE: 3; + readonly CHERRY_PICK: 4; +}; +export interface CommitDB { + msg: string; + id: string; + type: number; + tags?: string[]; +} +export interface BranchDB { + name: string; + order: number; +} +export interface MergeDB { + branch: string; + id: string; + type?: number; + tags?: string[]; +} +export interface CherryPickDB { + id: string; + targetId: string; + parent: string; + tags?: string[]; +} +export interface Commit { + id: string; + message: string; + seq: number; + type: number; + tags: string[]; + parents: string[]; + branch: string; + customType?: number; + customId?: boolean; +} +export interface GitGraph { + statements: Statement[]; +} +export type Statement = CommitAst | BranchAst | MergeAst | CheckoutAst | CherryPickingAst; +export interface CommitAst { + $type: 'Commit'; + id: string; + message?: string; + tags?: string[]; + type?: 'NORMAL' | 'REVERSE' | 'HIGHLIGHT'; +} +export interface BranchAst { + $type: 'Branch'; + name: string; + order?: number; +} +export interface MergeAst { + $type: 'Merge'; + branch: string; + id?: string; + tags?: string[]; + type?: 'NORMAL' | 'REVERSE' | 'HIGHLIGHT'; +} +export interface CheckoutAst { + $type: 'Checkout'; + branch: string; +} +export interface CherryPickingAst { + $type: 'CherryPicking'; + id: string; + parent: string; + tags?: string[]; +} +export interface GitGraphDB extends DiagramDBBase { + commitType: typeof commitType; + setDirection: (dir: DiagramOrientation) => void; + setOptions: (rawOptString: string) => void; + getOptions: () => any; + commit: (commitDB: CommitDB) => void; + branch: (branchDB: BranchDB) => void; + merge: (mergeDB: MergeDB) => void; + cherryPick: (cherryPickDB: CherryPickDB) => void; + checkout: (branch: string) => void; + prettyPrint: () => void; + clear: () => void; + getBranchesAsObjArray: () => { + name: string; + }[]; + getBranches: () => Map; + getCommits: () => Map; + getCommitsArray: () => Commit[]; + getCurrentBranch: () => string; + getDirection: () => DiagramOrientation; + getHead: () => Commit | null; +} +export interface GitGraphDBParseProvider extends Partial { + commitType: typeof commitType; + setDirection: (dir: DiagramOrientation) => void; + commit: (commitDB: CommitDB) => void; + branch: (branchDB: BranchDB) => void; + merge: (mergeDB: MergeDB) => void; + cherryPick: (cherryPickDB: CherryPickDB) => void; + checkout: (branch: string) => void; +} +export interface GitGraphDBRenderProvider extends Partial { + prettyPrint: () => void; + clear: () => void; + getBranchesAsObjArray: () => { + name: string; + }[]; + getBranches: () => Map; + getCommits: () => Map; + getCommitsArray: () => Commit[]; + getCurrentBranch: () => string; + getDirection: () => DiagramOrientation; + getHead: () => Commit | null; + getDiagramTitle: () => string; +} +export type DiagramOrientation = 'LR' | 'TB' | 'BT'; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/git/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/git/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/git/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/globalStyles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/globalStyles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f60556c286ad79ba4d79d35a7fe91bb6a22802cf --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/globalStyles.d.ts @@ -0,0 +1 @@ +export declare const getIconStyles: () => string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/info/info.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/info/info.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/info/info.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/info/infoDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6298e73d3434968d14bd12c721ebbc167b69044 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoDb.d.ts @@ -0,0 +1,4 @@ +import type { InfoFields, InfoDB } from './infoTypes.js'; +export declare const DEFAULT_INFO_DB: InfoFields; +export declare const getVersion: () => string; +export declare const db: InfoDB; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/info/infoDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7b9ac784e304d84af2e4175f9dfb5a97e6e3e7b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoDetector.d.ts @@ -0,0 +1,2 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +export declare const info: ExternalDiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/info/infoDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/info/infoParser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoParser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoParser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/info/infoRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf6d2abf72c3fe319b9eb6ff42d1eaa0ca39fb20 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoRenderer.d.ts @@ -0,0 +1,4 @@ +import type { DrawDefinition } from '../../diagram-api/types.js'; +export declare const renderer: { + draw: DrawDefinition; +}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/info/infoTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0b6f33d678b6bde10825c2255c3e57458407883d --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/info/infoTypes.d.ts @@ -0,0 +1,7 @@ +import type { DiagramDB } from '../../diagram-api/types.js'; +export interface InfoFields { + version: string; +} +export interface InfoDB extends DiagramDB { + getVersion: () => string; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawa.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawa.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawa.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5c8f8732f92e177606ff611198e8d299535aa514 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaDb.d.ts @@ -0,0 +1,17 @@ +import type { DiagramDB } from '../../diagram-api/types.js'; +import type { IshikawaNode } from './ishikawaTypes.js'; +export declare class IshikawaDB implements DiagramDB { + private root?; + private stack; + private baseLevel?; + constructor(); + clear(): void; + getRoot(): IshikawaNode | undefined; + addNode(rawLevel: number, text: string): void; + getAccTitle(): string; + setAccTitle(title: string): void; + getAccDescription(): string; + setAccDescription(description: string): void; + getDiagramTitle(): string; + setDiagramTitle(title: string): void; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b5f9ae8af98e53261781417d85277e40d6029837 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaDetector.d.ts @@ -0,0 +1,2 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +export declare const ishikawa: ExternalDiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ed26d8b0f8c09ea60230a21d8114326c425679c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaRenderer.d.ts @@ -0,0 +1,2 @@ +import type { DiagramRenderer } from '../../diagram-api/types.js'; +export declare const renderer: DiagramRenderer; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaStyles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaStyles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0377ad11cd5117c45305eb530d0fd2f0d382b2c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaStyles.d.ts @@ -0,0 +1,3 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +declare const getStyles: DiagramStylesProvider; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8faa1b77df0511361b4d72d89230baecc3519304 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/ishikawa/ishikawaTypes.d.ts @@ -0,0 +1,4 @@ +export interface IshikawaNode { + text: string; + children: IshikawaNode[]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/kanban/detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/detector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanban-definition.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanban-definition.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanban-definition.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanban.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanban.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanban.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanbanDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanbanDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c713226efd7a9f60666f29d46a761bd479dcf702 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanbanDb.d.ts @@ -0,0 +1,36 @@ +import type { D3Element } from '../../types.js'; +import type { Edge, KanbanNode } from '../../rendering-util/types.js'; +declare const db: { + readonly clear: () => void; + readonly addNode: (level: number, id: string, descr: string, type: number, shapeData: string) => void; + readonly getSections: () => KanbanNode[]; + readonly getData: () => { + nodes: KanbanNode[]; + edges: Edge[]; + other: {}; + config: import("../../config.type.js").MermaidConfig; + }; + readonly nodeType: { + DEFAULT: number; + NO_BORDER: number; + ROUNDED_RECT: number; + RECT: number; + CIRCLE: number; + CLOUD: number; + BANG: number; + HEXAGON: number; + }; + readonly getType: (startStr: string, endStr: string) => number; + readonly setElementForId: (id: number, element: D3Element) => void; + readonly decorateNode: (decoration?: { + class?: string; + icon?: string; + }) => void; + readonly type2Str: (type: number) => "rect" | "circle" | "bang" | "cloud" | "no-border" | "rounded-rect" | "hexgon"; + readonly getLogger: () => Record; + readonly getElementById: (id: number) => any; +}; +export default db; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanbanRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanbanRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0fa7acf184c7e503057cc30bdc3230085a059cb4 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanbanRenderer.d.ts @@ -0,0 +1,6 @@ +import type { DrawDefinition } from '../../diagram-api/types.js'; +export declare const draw: DrawDefinition; +declare const _default: { + draw: DrawDefinition; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanbanTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanbanTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ce1a772ac7db4ce1b9d8318aa7ad4b7e3aab81a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/kanbanTypes.d.ts @@ -0,0 +1,2 @@ +import type kanbanDb from './kanbanDb.js'; +export type KanbanDB = typeof kanbanDb; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/kanban/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0377ad11cd5117c45305eb530d0fd2f0d382b2c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/kanban/styles.d.ts @@ -0,0 +1,3 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +declare const getStyles: DiagramStylesProvider; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/detector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmap-definition.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmap-definition.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmap-definition.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmap.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmap.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmap.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..32a5b5e687da51ab3c98fd0054c05079d6f1e3a9 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapDb.d.ts @@ -0,0 +1,72 @@ +import type { D3Element } from '../../types.js'; +import type { MindmapNode } from './mindmapTypes.js'; +import type { LayoutData, Node, Edge } from '../../rendering-util/types.js'; +export type MindmapLayoutNode = Node & { + level: number; + nodeId: string; + type: number; + section?: number; +}; +export type MindmapLayoutEdge = Edge & { + depth: number; + section?: number; +}; +declare const nodeType: { + readonly DEFAULT: 0; + readonly NO_BORDER: 0; + readonly ROUNDED_RECT: 1; + readonly RECT: 2; + readonly CIRCLE: 3; + readonly CLOUD: 4; + readonly BANG: 5; + readonly HEXAGON: 6; +}; +export declare class MindmapDB { + private nodes; + private count; + private elements; + private baseLevel?; + readonly nodeType: typeof nodeType; + constructor(); + clear(): void; + getParent(level: number): MindmapNode | null; + getMindmap(): MindmapNode | null; + addNode(level: number, id: string, descr: string, type: number): void; + getType(startStr: string, endStr: string): 0 | 2 | 1 | 3 | 4 | 5 | 6; + setElementForId(id: number, element: D3Element): void; + getElementById(id: number): any; + decorateNode(decoration?: { + class?: string; + icon?: string; + }): void; + type2Str(type: number): string; + /** + * Assign section numbers to nodes based on their position relative to root + * @param node - The mindmap node to process + * @param sectionNumber - The section number to assign (undefined for root) + */ + assignSections(node: MindmapNode, sectionNumber?: number): void; + /** + * Convert mindmap tree structure to flat array of nodes + * @param node - The mindmap node to process + * @param processedNodes - Array to collect processed nodes + */ + flattenNodes(node: MindmapNode, processedNodes: MindmapLayoutNode[]): void; + /** + * Generate edges from parent-child relationships in mindmap tree + * @param node - The mindmap node to process + * @param edges - Array to collect edges + */ + generateEdges(node: MindmapNode, edges: MindmapLayoutEdge[]): void; + /** + * Get structured data for layout algorithms + * Following the pattern established by ER diagrams + * @returns Structured data containing nodes, edges, and config + */ + getData(): LayoutData; + getLogger(): Record; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapDb.getData.test.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapDb.getData.test.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapDb.getData.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0fa7acf184c7e503057cc30bdc3230085a059cb4 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapRenderer.d.ts @@ -0,0 +1,6 @@ +import type { DrawDefinition } from '../../diagram-api/types.js'; +export declare const draw: DrawDefinition; +declare const _default: { + draw: DrawDefinition; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3533677f02ade6ee756398b0d173fca16802ceec --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/mindmapTypes.d.ts @@ -0,0 +1,20 @@ +import type { RequiredDeep } from 'type-fest'; +export interface MindmapNode { + id: number; + nodeId: string; + level: number; + descr: string; + type: number; + children: MindmapNode[]; + width: number; + padding: number; + section?: number; + height?: number; + class?: string; + icon?: string; + x?: number; + y?: number; + isRoot?: boolean; + labelType?: string; +} +export type FilledMindMapNode = RequiredDeep; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0377ad11cd5117c45305eb530d0fd2f0d382b2c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/styles.d.ts @@ -0,0 +1,3 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +declare const getStyles: DiagramStylesProvider; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/svgDraw.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/svgDraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9c20ea04e3b45196006cc9835156b8bc5e1f1ed5 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/mindmap/svgDraw.d.ts @@ -0,0 +1,15 @@ +import type { FilledMindMapNode } from './mindmapTypes.js'; +import type { D3Element } from '../../types.js'; +import type { MermaidConfig } from '../../config.type.js'; +import type { MindmapDB } from './mindmapDb.js'; +export declare const MAX_SECTIONS = 12; +/** + * @param db - The database + * @param elem - The D3 dom element in which the node is to be added + * @param node - The node to be added + * @param fullSection - ? + * @param conf - The configuration object + * @returns The height nodes dom element + */ +export declare const drawNode: (db: MindmapDB, elem: D3Element, node: FilledMindMapNode, fullSection: number, conf: MermaidConfig) => Promise; +export declare const positionNode: (db: MindmapDB, node: FilledMindMapNode) => void; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/packet/db.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/packet/db.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..72df335fc40819aae8b113f8fcf8322245424df0 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/packet/db.d.ts @@ -0,0 +1,24 @@ +import type { DiagramDB } from '../../diagram-api/types.js'; +import type { PacketWord } from './types.js'; +export declare class PacketDB implements DiagramDB { + private packet; + getConfig(): { + rowHeight: number; + bitWidth: number; + bitsPerRow: number; + showBits: boolean; + paddingX: number; + paddingY: number; + useWidth: number; + useMaxWidth: boolean; + }; + getPacket(): PacketWord[]; + pushWord(word: PacketWord): void; + clear(): void; + setAccTitle: (txt: string) => void; + getAccTitle: () => string; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; + getAccDescription: () => string; + setAccDescription: (txt: string) => void; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/packet/detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/packet/detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c955b1e30117cb24d04fb2ac8bab0339d4718e1 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/packet/detector.d.ts @@ -0,0 +1,2 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +export declare const packet: ExternalDiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/packet/diagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/packet/diagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/packet/diagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/packet/packet.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/packet/packet.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/packet/packet.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/packet/parser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/packet/parser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/packet/parser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/packet/renderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/packet/renderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ed26d8b0f8c09ea60230a21d8114326c425679c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/packet/renderer.d.ts @@ -0,0 +1,2 @@ +import type { DiagramRenderer } from '../../diagram-api/types.js'; +export declare const renderer: DiagramRenderer; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/packet/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/packet/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..737663938d281d06d7664c535a0157075d6abf1b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/packet/styles.d.ts @@ -0,0 +1,3 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +export declare const styles: DiagramStylesProvider; +export default styles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/packet/types.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/packet/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..61b3c813d24287b2808df0cd4d40be51797f8723 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/packet/types.d.ts @@ -0,0 +1,25 @@ +import type { Packet, RecursiveAstOmit } from '@mermaid-js/parser'; +import type { PacketDiagramConfig } from '../../config.type.js'; +import type { DiagramDBBase } from '../../diagram-api/types.js'; +import type { ArrayElement } from '../../types.js'; +export type PacketBlock = RecursiveAstOmit>; +export type PacketWord = Required[]; +export interface PacketDB extends DiagramDBBase { + pushWord: (word: PacketWord) => void; + getPacket: () => PacketWord[]; +} +export interface PacketStyleOptions { + byteFontSize?: string; + startByteColor?: string; + endByteColor?: string; + labelColor?: string; + labelFontSize?: string; + blockStrokeColor?: string; + blockStrokeWidth?: string; + blockFillColor?: string; + titleColor?: string; + titleFontSize?: string; +} +export interface PacketData { + packet: PacketWord[]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/pie/pie.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pie.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pie.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c06dbbc45e745d418df2c7c86a25ede4e2f5bdf9 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieDb.d.ts @@ -0,0 +1,6 @@ +import type { PieFields, PieDB } from './pieTypes.js'; +import type { RequiredDeep } from 'type-fest'; +import type { PieDiagramConfig } from '../../config.type.js'; +export declare const DEFAULT_PIE_CONFIG: Required; +export declare const DEFAULT_PIE_DB: RequiredDeep; +export declare const db: PieDB; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0b9a849af0c940e32098f57b553084e161b17a35 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieDetector.d.ts @@ -0,0 +1,2 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +export declare const pie: ExternalDiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieParser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieParser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieParser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..396d8de9beb63cf9edf2a1e943278d4052c5ce70 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieRenderer.d.ts @@ -0,0 +1,13 @@ +import type { DrawDefinition } from '../../diagram-api/types.js'; +/** + * Draws a Pie Chart with the data given in text. + * + * @param text - pie chart code + * @param id - diagram id + * @param _version - MermaidJS version from package.json. + * @param diagObj - A standard diagram containing the DB and the text and type etc of the diagram. + */ +export declare const draw: DrawDefinition; +export declare const renderer: { + draw: DrawDefinition; +}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieRenderer.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieRenderer.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieRenderer.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieStyles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieStyles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0377ad11cd5117c45305eb530d0fd2f0d382b2c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieStyles.d.ts @@ -0,0 +1,3 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +declare const getStyles: DiagramStylesProvider; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..34d1818a54b54323e36fe22b1234fce57130ba41 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/pie/pieTypes.d.ts @@ -0,0 +1,52 @@ +import type { PieDiagramConfig } from '../../config.type.js'; +import type { DiagramDB } from '../../diagram-api/types.js'; +export interface PieFields { + sections: Sections; + showData: boolean; + config: PieDiagramConfig; +} +export interface PieStyleOptions { + fontFamily: string; + pie1: string; + pie2: string; + pie3: string; + pie4: string; + pie5: string; + pie6: string; + pie7: string; + pie8: string; + pie9: string; + pie10: string; + pie11: string; + pie12: string; + pieTitleTextSize: string; + pieTitleTextColor: string; + pieSectionTextSize: string; + pieSectionTextColor: string; + pieLegendTextSize: string; + pieLegendTextColor: string; + pieStrokeColor: string; + pieStrokeWidth: string; + pieOuterStrokeWidth: string; + pieOuterStrokeColor: string; + pieOpacity: string; +} +export type Sections = Map; +export interface D3Section { + label: string; + value: number; +} +export interface PieDB extends DiagramDB { + getConfig: () => Required; + clear: () => void; + setDiagramTitle: (title: string) => void; + getDiagramTitle: () => string; + setAccTitle: (title: string) => void; + getAccTitle: () => string; + setAccDescription: (description: string) => void; + getAccDescription: () => string; + addSection: ({ label, value }: D3Section) => void; + getSections: () => Sections; + setShowData: (toggle: boolean) => void; + getShowData: () => boolean; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/parser/quadrant.jison.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/parser/quadrant.jison.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/parser/quadrant.jison.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantBuilder.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantBuilder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9fa6938aa6897f252a225fad0b6175762b872010 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantBuilder.d.ts @@ -0,0 +1,127 @@ +import type { BaseDiagramConfig, QuadrantChartConfig } from '../../config.type.js'; +import type { Point } from '../../types.js'; +export type TextVerticalPos = 'left' | 'center' | 'right'; +export type TextHorizontalPos = 'top' | 'middle' | 'bottom'; +export interface StylesObject { + className?: string; + radius?: number; + color?: string; + strokeColor?: string; + strokeWidth?: string; +} +export interface QuadrantPointInputType extends Point, StylesObject { + text: string; +} +export interface QuadrantTextType extends Point { + text: string; + fill: string; + verticalPos: TextVerticalPos; + horizontalPos: TextHorizontalPos; + fontSize: number; + rotation: number; +} +export interface QuadrantPointType extends Point, Pick { + fill: string; + radius: number; + text: QuadrantTextType; +} +export interface QuadrantQuadrantsType extends Point { + text: QuadrantTextType; + width: number; + height: number; + fill: string; +} +export interface QuadrantLineType { + strokeWidth: number; + strokeFill: string; + x1: number; + y1: number; + x2: number; + y2: number; +} +export interface QuadrantBuildType { + points: QuadrantPointType[]; + quadrants: QuadrantQuadrantsType[]; + axisLabels: QuadrantTextType[]; + title?: QuadrantTextType; + borderLines?: QuadrantLineType[]; +} +export interface QuadrantBuilderData { + titleText: string; + quadrant1Text: string; + quadrant2Text: string; + quadrant3Text: string; + quadrant4Text: string; + xAxisLeftText: string; + xAxisRightText: string; + yAxisBottomText: string; + yAxisTopText: string; + points: QuadrantPointInputType[]; +} +export interface QuadrantBuilderConfig extends Required> { + showXAxis: boolean; + showYAxis: boolean; + showTitle: boolean; +} +export interface QuadrantBuilderThemeConfig { + quadrantTitleFill: string; + quadrant1Fill: string; + quadrant2Fill: string; + quadrant3Fill: string; + quadrant4Fill: string; + quadrant1TextFill: string; + quadrant2TextFill: string; + quadrant3TextFill: string; + quadrant4TextFill: string; + quadrantPointFill: string; + quadrantPointTextFill: string; + quadrantXAxisTextFill: string; + quadrantYAxisTextFill: string; + quadrantInternalBorderStrokeFill: string; + quadrantExternalBorderStrokeFill: string; +} +interface CalculateSpaceData { + xAxisSpace: { + top: number; + bottom: number; + }; + yAxisSpace: { + left: number; + right: number; + }; + titleSpace: { + top: number; + }; + quadrantSpace: { + quadrantLeft: number; + quadrantTop: number; + quadrantWidth: number; + quadrantHalfWidth: number; + quadrantHeight: number; + quadrantHalfHeight: number; + }; +} +export declare class QuadrantBuilder { + private config; + private themeConfig; + private data; + private classes; + constructor(); + getDefaultData(): QuadrantBuilderData; + getDefaultConfig(): QuadrantBuilderConfig; + getDefaultThemeConfig(): QuadrantBuilderThemeConfig; + clear(): void; + setData(data: Partial): void; + addPoints(points: QuadrantPointInputType[]): void; + addClass(className: string, styles: StylesObject): void; + setConfig(config: Partial): void; + setThemeConfig(themeConfig: Partial): void; + calculateSpace(xAxisPosition: typeof this.config.xAxisPosition, showXAxis: boolean, showYAxis: boolean, showTitle: boolean): CalculateSpaceData; + getAxisLabels(xAxisPosition: typeof this.config.xAxisPosition, showXAxis: boolean, showYAxis: boolean, spaceData: CalculateSpaceData): QuadrantTextType[]; + getQuadrants(spaceData: CalculateSpaceData): QuadrantQuadrantsType[]; + getQuadrantPoints(spaceData: CalculateSpaceData): QuadrantPointType[]; + getBorders(spaceData: CalculateSpaceData): QuadrantLineType[]; + getTitle(showTitle: boolean): QuadrantTextType | undefined; + build(): QuadrantBuildType; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bcbaec48da1f17df3e5d1b735f7566717d1d5cb0 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDb.d.ts @@ -0,0 +1,43 @@ +import type { StylesObject } from './quadrantBuilder.js'; +interface LexTextObj { + text: string; + type: 'text' | 'markdown'; +} +declare function setQuadrant1Text(textObj: LexTextObj): void; +declare function setQuadrant2Text(textObj: LexTextObj): void; +declare function setQuadrant3Text(textObj: LexTextObj): void; +declare function setQuadrant4Text(textObj: LexTextObj): void; +declare function setXAxisLeftText(textObj: LexTextObj): void; +declare function setXAxisRightText(textObj: LexTextObj): void; +declare function setYAxisTopText(textObj: LexTextObj): void; +declare function setYAxisBottomText(textObj: LexTextObj): void; +declare function parseStyles(styles: string[]): StylesObject; +declare function addPoint(textObj: LexTextObj, className: string, x: number, y: number, styles: string[]): void; +declare function addClass(className: string, styles: string[]): void; +declare function setWidth(width: number): void; +declare function setHeight(height: number): void; +declare function getQuadrantData(): import("./quadrantBuilder.js").QuadrantBuildType; +declare const _default: { + setWidth: typeof setWidth; + setHeight: typeof setHeight; + setQuadrant1Text: typeof setQuadrant1Text; + setQuadrant2Text: typeof setQuadrant2Text; + setQuadrant3Text: typeof setQuadrant3Text; + setQuadrant4Text: typeof setQuadrant4Text; + setXAxisLeftText: typeof setXAxisLeftText; + setXAxisRightText: typeof setXAxisRightText; + setYAxisTopText: typeof setYAxisTopText; + setYAxisBottomText: typeof setYAxisBottomText; + parseStyles: typeof parseStyles; + addPoint: typeof addPoint; + addClass: typeof addClass; + getQuadrantData: typeof getQuadrantData; + clear: () => void; + setAccTitle: (txt: string) => void; + getAccTitle: () => string; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; + getAccDescription: () => string; + setAccDescription: (txt: string) => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDb.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDb.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDb.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b91b5309e94fe5e80e9507bce25e6f2df7aaf31d --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/quadrantRenderer.d.ts @@ -0,0 +1,6 @@ +import type { Diagram } from '../../Diagram.js'; +export declare const draw: (txt: string, id: string, _version: string, diagObj: Diagram) => void; +declare const _default: { + draw: (txt: string, id: string, _version: string, diagObj: Diagram) => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/utils.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7aeae3a02680b5ed81065dd35f8f8c6e1b5fa7b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/quadrant-chart/utils.d.ts @@ -0,0 +1,7 @@ +declare class InvalidStyleError extends Error { + constructor(style: string, value: string, type: string); +} +declare function validateHexCode(value: string): boolean; +declare function validateNumber(value: string): boolean; +declare function validateSizeInPixels(value: string): boolean; +export { validateHexCode, validateNumber, validateSizeInPixels, InvalidStyleError }; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/radar/db.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/radar/db.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3545e49f91cf9b0d1033e5146ff5d63bbd7649e7 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/radar/db.d.ts @@ -0,0 +1,2 @@ +import type { RadarDB } from './types.js'; +export declare const db: RadarDB; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/radar/detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/radar/detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..299263f036c92ce45a15562db91a3bd49b542e2c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/radar/detector.d.ts @@ -0,0 +1,2 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +export declare const radar: ExternalDiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/radar/diagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/radar/diagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/radar/diagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/radar/parser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/radar/parser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/radar/parser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/radar/radar.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/radar/radar.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/radar/radar.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/radar/renderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/radar/renderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..56fb8f0ce5ee0ec40809ee6f20a6df46e0c1930e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/radar/renderer.d.ts @@ -0,0 +1,7 @@ +import type { DiagramRenderer } from '../../diagram-api/types.js'; +export declare function relativeRadius(value: number, minValue: number, maxValue: number, radius: number): number; +export declare function closedRoundCurve(points: { + x: number; + y: number; +}[], tension: number): string; +export declare const renderer: DiagramRenderer; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/radar/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/radar/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9815a239d582ddba157357e075e89052994ac95 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/radar/styles.d.ts @@ -0,0 +1,236 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +import type { RadarStyleOptions } from './types.js'; +export declare const buildRadarStyleOptions: (radar?: RadarStyleOptions) => { + themeVariables: { + background: string; + primaryColor: string; + secondaryColor: string; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: string; + textColor: string; + mainBkg: string; + secondBkg: string; + border1: string; + border2: string; + arrowheadColor: string; + fontFamily: string; + fontSize: string; + labelBackground: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + nodeBkg: string; + nodeBorder: string; + clusterBkg: string; + clusterBorder: string; + defaultLinkColor: string; + titleColor: string; + edgeLabelBackground: string; + actorBorder: string; + actorBkg: string; + actorTextColor: string; + actorLineColor: string; + signalColor: string; + signalTextColor: string; + labelBoxBkgColor: string; + labelBoxBorderColor: string; + labelTextColor: string; + loopTextColor: string; + noteBorderColor: string; + noteBkgColor: string; + noteTextColor: string; + activationBorderColor: string; + activationBkgColor: string; + sequenceNumberColor: string; + sectionBkgColor: any; + altSectionBkgColor: string; + sectionBkgColor2: string; + excludeBkgColor: string; + taskBorderColor: string; + taskBkgColor: string; + taskTextLightColor: string; + taskTextColor: string; + taskTextDarkColor: string; + taskTextOutsideColor: string; + taskTextClickableColor: string; + activeTaskBorderColor: string; + activeTaskBkgColor: string; + gridColor: string; + doneTaskBkgColor: string; + doneTaskBorderColor: string; + critBorderColor: string; + critBkgColor: string; + todayLineColor: string; + vertLineColor: string; + noteFontWeight: string; + fontWeight: string; + personBorder: any; + personBkg: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + rowOdd: string; + rowEven: string; + labelColor: string; + errorBkgColor: string; + errorTextColor: string; + useGradient: boolean; + gradientStart: any; + gradientStop: any; + dropShadow: string; + updateColors(): void; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + cScaleLabel0: any; + cScaleLabel3: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + specialStateColor: string | undefined; + classText: any; + fillType0: string | undefined; + fillType1: string | undefined; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + venn1: any; + venn2: any; + venn3: any; + venn4: any; + venn5: any; + venn6: any; + venn7: any; + venn8: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + radarOptions: RadarStyleOptions; +}; +export declare const styles: DiagramStylesProvider; +export default styles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/radar/types.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/radar/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2d7285b523671023c6ef3e370abe62777e628880 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/radar/types.d.ts @@ -0,0 +1,44 @@ +import type { Axis, Curve, Option } from '../../../../parser/dist/src/language/generated/ast.js'; +import type { RadarDiagramConfig } from '../../config.type.js'; +import type { DiagramDBBase } from '../../diagram-api/types.js'; +export interface RadarAxis { + name: string; + label: string; +} +export interface RadarCurve { + name: string; + entries: number[]; + label: string; +} +export interface RadarOptions { + showLegend: boolean; + ticks: number; + max: number | null; + min: number; + graticule: 'circle' | 'polygon'; +} +export interface RadarDB extends DiagramDBBase { + getAxes: () => RadarAxis[]; + getCurves: () => RadarCurve[]; + getOptions: () => RadarOptions; + setAxes: (axes: Axis[]) => void; + setCurves: (curves: Curve[]) => void; + setOptions: (options: Option[]) => void; +} +export interface RadarStyleOptions { + axisColor?: string; + axisStrokeWidth?: number; + axisLabelFontSize?: number; + curveOpacity?: number; + curveStrokeWidth?: number; + graticuleColor?: string; + graticuleOpacity?: number; + graticuleStrokeWidth?: number; + legendBoxSize?: number; + legendFontSize?: number; +} +export interface RadarData { + axes: RadarAxis[]; + curves: RadarCurve[]; + options: RadarOptions; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6cdb31064eb2499787ac9644691c1e43864a0460 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDb.d.ts @@ -0,0 +1,54 @@ +import type { DiagramDB } from '../../diagram-api/types.js'; +import type { Node, Edge } from '../../rendering-util/types.js'; +import type { Element, Relation, RelationshipType, Requirement, RequirementClass, RequirementType, RiskLevel, VerifyType } from './types.js'; +export declare class RequirementDB implements DiagramDB { + private relations; + private latestRequirement; + private requirements; + private latestElement; + private elements; + private classes; + private direction; + private RequirementType; + private RiskLevel; + private VerifyType; + private Relationships; + constructor(); + getDirection(): string; + setDirection(dir: string): void; + private resetLatestRequirement; + private resetLatestElement; + private getInitialRequirement; + private getInitialElement; + addRequirement(name: string, type: RequirementType): Requirement | undefined; + getRequirements(): Map; + setNewReqId(id: string): void; + setNewReqText(text: string): void; + setNewReqRisk(risk: RiskLevel): void; + setNewReqVerifyMethod(verifyMethod: VerifyType): void; + addElement(name: string): Element | undefined; + getElements(): Map; + setNewElementType(type: string): void; + setNewElementDocRef(docRef: string): void; + addRelationship(type: RelationshipType, src: string, dst: string): void; + getRelationships(): Relation[]; + clear(): void; + setCssStyle(ids: string[], styles: string[]): void; + setClass(ids: string[], classNames: string[]): void; + defineClass(ids: string[], style: string[]): void; + getClasses(): Map; + getData(): { + nodes: Node[]; + edges: Edge[]; + other: {}; + config: import("../../config.type.js").MermaidConfig; + direction: string; + }; + setAccTitle: (txt: string) => void; + getAccTitle: () => string; + setAccDescription: (txt: string) => void; + getAccDescription: () => string; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; + getConfig: () => import("../../config.type.js").RequirementDiagramConfig | undefined; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDb.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDb.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDb.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cffe69b5cdc8c34202877724687f7ea1a2afd049 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/requirementRenderer.d.ts @@ -0,0 +1 @@ +export declare const draw: (text: string, id: string, _version: string, diag: any) => Promise; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/requirement/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/requirement/types.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..adb1ce5abf63a613a0aa58329801b2cb42ab1153 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/requirement/types.d.ts @@ -0,0 +1,31 @@ +export type RequirementType = 'Requirement' | 'Functional Requirement' | 'Interface Requirement' | 'Performance Requirement' | 'Physical Requirement' | 'Design Constraint'; +export type RiskLevel = 'Low' | 'Medium' | 'High'; +export type VerifyType = 'Analysis' | 'Demonstration' | 'Inspection' | 'Test'; +export interface Requirement { + name: string; + type: RequirementType; + requirementId: string; + text: string; + risk: RiskLevel; + verifyMethod: VerifyType; + cssStyles: string[]; + classes: string[]; +} +export type RelationshipType = 'contains' | 'copies' | 'derives' | 'satisfies' | 'verifies' | 'refines' | 'traces'; +export interface Relation { + type: RelationshipType; + src: string; + dst: string; +} +export interface Element { + name: string; + type: string; + docRef: string; + cssStyles: string[]; + classes: string[]; +} +export interface RequirementClass { + id: string; + styles: string[]; + textStyles: string[]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sankey/parser/sankey.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/parser/sankey.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/parser/sankey.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyDB.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyDB.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b71d39da99fbf76d3ea3c0cb16fb0665af4068f4 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyDB.d.ts @@ -0,0 +1,36 @@ +declare class SankeyLink { + source: SankeyNode; + target: SankeyNode; + value: number; + constructor(source: SankeyNode, target: SankeyNode, value?: number); +} +declare class SankeyNode { + ID: string; + constructor(ID: string); +} +declare const _default: { + nodesMap: Map; + getConfig: () => import("../../config.type.js").SankeyDiagramConfig | undefined; + getNodes: () => SankeyNode[]; + getLinks: () => SankeyLink[]; + getGraph: () => { + nodes: { + id: string; + }[]; + links: { + source: string; + target: string; + value: number; + }[]; + }; + addLink: (source: SankeyNode, target: SankeyNode, value: number) => void; + findOrCreateNode: (ID: string) => SankeyNode; + getAccTitle: () => string; + setAccTitle: (txt: string) => void; + getAccDescription: () => string; + setAccDescription: (txt: string) => void; + getDiagramTitle: () => string; + setDiagramTitle: (txt: string) => void; + clear: () => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..556d3178212ebebe7942bf20fd6c4e04f98976d6 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyRenderer.d.ts @@ -0,0 +1,14 @@ +import type { Diagram } from '../../Diagram.js'; +/** + * Draws Sankey diagram. + * + * @param text - The text of the diagram + * @param id - The id of the diagram which will be used as a DOM element id¨ + * @param _version - Mermaid version from package.json + * @param diagObj - A standard diagram containing the db and the text and type etc of the diagram + */ +export declare const draw: (text: string, id: string, _version: string, diagObj: Diagram) => void; +declare const _default: { + draw: (text: string, id: string, _version: string, diagObj: Diagram) => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyUtils.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyUtils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9448d4c39f25a389fff39d969e18bbad5810bf7 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/sankeyUtils.d.ts @@ -0,0 +1 @@ +export declare const prepareTextForParsing: (text: string) => string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sankey/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sankey/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6db13abee0180903b5ba20bd2c002cc3bfc66cd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceDb.d.ts @@ -0,0 +1,156 @@ +import type { DiagramDB } from '../../diagram-api/types.js'; +import type { Actor, AddMessageParams, Box, Message } from './types.js'; +declare const LINETYPE: { + readonly SOLID: 0; + readonly DOTTED: 1; + readonly NOTE: 2; + readonly SOLID_CROSS: 3; + readonly DOTTED_CROSS: 4; + readonly SOLID_OPEN: 5; + readonly DOTTED_OPEN: 6; + readonly LOOP_START: 10; + readonly LOOP_END: 11; + readonly ALT_START: 12; + readonly ALT_ELSE: 13; + readonly ALT_END: 14; + readonly OPT_START: 15; + readonly OPT_END: 16; + readonly ACTIVE_START: 17; + readonly ACTIVE_END: 18; + readonly PAR_START: 19; + readonly PAR_AND: 20; + readonly PAR_END: 21; + readonly RECT_START: 22; + readonly RECT_END: 23; + readonly SOLID_POINT: 24; + readonly DOTTED_POINT: 25; + readonly AUTONUMBER: 26; + readonly CRITICAL_START: 27; + readonly CRITICAL_OPTION: 28; + readonly CRITICAL_END: 29; + readonly BREAK_START: 30; + readonly BREAK_END: 31; + readonly PAR_OVER_START: 32; + readonly BIDIRECTIONAL_SOLID: 33; + readonly BIDIRECTIONAL_DOTTED: 34; + readonly SOLID_TOP: 41; + readonly SOLID_BOTTOM: 42; + readonly STICK_TOP: 43; + readonly STICK_BOTTOM: 44; + readonly SOLID_ARROW_TOP_REVERSE: 45; + readonly SOLID_ARROW_BOTTOM_REVERSE: 46; + readonly STICK_ARROW_TOP_REVERSE: 47; + readonly STICK_ARROW_BOTTOM_REVERSE: 48; + readonly SOLID_TOP_DOTTED: 51; + readonly SOLID_BOTTOM_DOTTED: 52; + readonly STICK_TOP_DOTTED: 53; + readonly STICK_BOTTOM_DOTTED: 54; + readonly SOLID_ARROW_TOP_REVERSE_DOTTED: 55; + readonly SOLID_ARROW_BOTTOM_REVERSE_DOTTED: 56; + readonly STICK_ARROW_TOP_REVERSE_DOTTED: 57; + readonly STICK_ARROW_BOTTOM_REVERSE_DOTTED: 58; + readonly CENTRAL_CONNECTION: 59; + readonly CENTRAL_CONNECTION_REVERSE: 60; + readonly CENTRAL_CONNECTION_DUAL: 61; +}; +declare const ARROWTYPE: { + readonly FILLED: 0; + readonly OPEN: 1; +}; +declare const PLACEMENT: { + readonly LEFTOF: 0; + readonly RIGHTOF: 1; + readonly OVER: 2; +}; +export declare const PARTICIPANT_TYPE: { + readonly ACTOR: "actor"; + readonly BOUNDARY: "boundary"; + readonly COLLECTIONS: "collections"; + readonly CONTROL: "control"; + readonly DATABASE: "database"; + readonly ENTITY: "entity"; + readonly PARTICIPANT: "participant"; + readonly QUEUE: "queue"; +}; +export declare class SequenceDB implements DiagramDB { + private readonly state; + constructor(); + addBox(data: { + text: string; + color: string; + wrap: boolean; + }): void; + addActor(id: string, name: string, description: { + text: string; + wrap?: boolean | null; + type: string; + }, type: string, metadata?: any): void; + private activationCount; + addMessage(idFrom: Message['from'], idTo: Message['to'], message: { + text: string; + wrap?: boolean; + }, answer: Message['answer']): void; + addSignal(idFrom?: Message['from'], idTo?: Message['to'], message?: { + text: string; + wrap: boolean; + }, messageType?: number, activate?: boolean, centralConnection?: number): boolean; + hasAtLeastOneBox(): boolean; + hasAtLeastOneBoxWithTitle(): boolean; + getMessages(): Message[]; + getBoxes(): Box[]; + getActors(): Map; + getCreatedActors(): Map; + getDestroyedActors(): Map; + getActor(id: string): Actor; + getActorKeys(): string[]; + enableSequenceNumbers(): void; + disableSequenceNumbers(): void; + showSequenceNumbers(): boolean; + setWrap(wrapSetting?: boolean): void; + private extractWrap; + autoWrap(): boolean; + clear(): void; + parseMessage(str: string): { + text: string | undefined; + wrap: boolean | undefined; + }; + parseBoxData(str: string): { + text: string | undefined; + color: string; + wrap: boolean | undefined; + }; + readonly LINETYPE: typeof LINETYPE; + readonly ARROWTYPE: typeof ARROWTYPE; + readonly PLACEMENT: typeof PLACEMENT; + addNote(actor: { + actor: string; + }, placement: Message['placement'], message: { + text: string; + wrap?: boolean; + }): void; + addLinks(actorId: string, text: { + text: string; + }): void; + addALink(actorId: string, text: { + text: string; + }): void; + private insertLinks; + addProperties(actorId: string, text: { + text: string; + }): void; + private insertProperties; + private boxEnd; + addDetails(actorId: string, text: { + text: string; + }): void; + getActorProperty(actor: Actor, key: string): unknown; + apply(param: any | AddMessageParams | AddMessageParams[]): void; + setAccTitle: (txt: string) => void; + setAccDescription: (txt: string) => void; + setDiagramTitle: (txt: string) => void; + getAccTitle: () => string; + getAccDescription: () => string; + getDiagramTitle: () => string; + getConfig(): import("../../config.type.js").SequenceDiagramConfig | undefined; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..14e9d121ba9871dcf4d1f32bf558d03fd374b23c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/sequenceRenderer.d.ts @@ -0,0 +1,212 @@ +import type { Diagram } from '../../Diagram.js'; +export declare const bounds: { + data: { + startx: undefined; + stopx: undefined; + starty: undefined; + stopy: undefined; + }; + verticalPos: number; + sequenceItems: never[]; + activations: never[]; + models: { + getHeight: () => any; + clear: () => void; + addBox: (boxModel: any) => void; + addActor: (actorModel: any) => void; + addLoop: (loopModel: any) => void; + addMessage: (msgModel: any) => void; + addNote: (noteModel: any) => void; + lastActor: () => never; + lastLoop: () => never; + lastMessage: () => never; + lastNote: () => never; + actors: never[]; + boxes: never[]; + loops: never[]; + messages: never[]; + notes: never[]; + }; + init: () => void; + updateVal: (obj: any, key: any, val: any, fun: any) => void; + updateBounds: (startx: any, starty: any, stopx: any, stopy: any) => void; + insert: (startx: any, starty: any, stopx: any, stopy: any) => void; + newActivation: (message: any, diagram: any, actors: any) => void; + endActivation: (message: any) => never; + createLoop: (title: { + message: undefined; + wrap: boolean; + width: undefined; + } | undefined, fill: any) => { + startx: undefined; + starty: number; + stopx: undefined; + stopy: undefined; + title: undefined; + wrap: boolean; + width: undefined; + height: number; + fill: any; + }; + newLoop: (title: { + message: undefined; + wrap: boolean; + width: undefined; + } | undefined, fill: any) => void; + endLoop: () => undefined; + isLoopOverlap: () => any; + addSectionToLoop: (message: any) => void; + saveVerticalPos: () => void; + resetVerticalPos: () => void; + bumpVerticalPos: (bump: any) => void; + getVerticalPos: () => number; + getBounds: () => { + bounds: { + startx: undefined; + stopx: undefined; + starty: undefined; + stopy: undefined; + }; + models: { + getHeight: () => any; + clear: () => void; + addBox: (boxModel: any) => void; + addActor: (actorModel: any) => void; + addLoop: (loopModel: any) => void; + addMessage: (msgModel: any) => void; + addNote: (noteModel: any) => void; + lastActor: () => never; + lastLoop: () => never; + lastMessage: () => never; + lastNote: () => never; + actors: never[]; + boxes: never[]; + loops: never[]; + messages: never[]; + notes: never[]; + }; + }; +}; +/** + * Draws a message. Note that the bounds have previously been updated by boundMessage. + * + * @param diagram - The parent of the message element + * @param msgModel - The model containing fields describing a message + * @param lineStartY - The Y coordinate at which the message line starts + * @param diagObj - The diagram object. + */ +export declare const drawMessage: (diagram: any, msgModel: any, lineStartY: number, diagObj: Diagram, msg: any, diagramId: string) => Promise; +export declare const drawActors: (diagram: any, actors: any, actorKeys: any, isFooter: any, diagramId: any, diagObj: any, actorIndexMap: any) => Promise; +export declare const drawActorsPopup: (diagram: any, actors: any, actorKeys: any, doc: any) => { + maxHeight: number; + maxWidth: number; +}; +export declare const setConf: (cnf: any) => void; +/** + * Draws a sequenceDiagram in the tag with id: id based on the graph definition in text. + * + * @param _text - The text of the diagram + * @param id - The id of the diagram which will be used as a DOM element id¨ + * @param _version - Mermaid version from package.json + * @param diagObj - A standard diagram containing the db and the text and type etc of the diagram + */ +export declare const draw: (_text: string, id: string, _version: string, diagObj: Diagram) => Promise; +export declare const adjustValueByDirection: (msg: any, actors: any, value: any) => any; +declare const _default: { + bounds: { + data: { + startx: undefined; + stopx: undefined; + starty: undefined; + stopy: undefined; + }; + verticalPos: number; + sequenceItems: never[]; + activations: never[]; + models: { + getHeight: () => any; + clear: () => void; + addBox: (boxModel: any) => void; + addActor: (actorModel: any) => void; + addLoop: (loopModel: any) => void; + addMessage: (msgModel: any) => void; + addNote: (noteModel: any) => void; + lastActor: () => never; + lastLoop: () => never; + lastMessage: () => never; + lastNote: () => never; + actors: never[]; + boxes: never[]; + loops: never[]; + messages: never[]; + notes: never[]; + }; + init: () => void; + updateVal: (obj: any, key: any, val: any, fun: any) => void; + updateBounds: (startx: any, starty: any, stopx: any, stopy: any) => void; + insert: (startx: any, starty: any, stopx: any, stopy: any) => void; + newActivation: (message: any, diagram: any, actors: any) => void; + endActivation: (message: any) => never; + createLoop: (title: { + message: undefined; + wrap: boolean; + width: undefined; + } | undefined, fill: any) => { + startx: undefined; + starty: number; + stopx: undefined; + stopy: undefined; + title: undefined; + wrap: boolean; + width: undefined; + height: number; + fill: any; + }; + newLoop: (title: { + message: undefined; + wrap: boolean; + width: undefined; + } | undefined, fill: any) => void; + endLoop: () => undefined; + isLoopOverlap: () => any; + addSectionToLoop: (message: any) => void; + saveVerticalPos: () => void; + resetVerticalPos: () => void; + bumpVerticalPos: (bump: any) => void; + getVerticalPos: () => number; + getBounds: () => { + bounds: { + startx: undefined; + stopx: undefined; + starty: undefined; + stopy: undefined; + }; + models: { + getHeight: () => any; + clear: () => void; + addBox: (boxModel: any) => void; + addActor: (actorModel: any) => void; + addLoop: (loopModel: any) => void; + addMessage: (msgModel: any) => void; + addNote: (noteModel: any) => void; + lastActor: () => never; + lastLoop: () => never; + lastMessage: () => never; + lastNote: () => never; + actors: never[]; + boxes: never[]; + loops: never[]; + messages: never[]; + notes: never[]; + }; + }; + }; + drawActors: (diagram: any, actors: any, actorKeys: any, isFooter: any, diagramId: any, diagObj: any, actorIndexMap: any) => Promise; + drawActorsPopup: (diagram: any, actors: any, actorKeys: any, doc: any) => { + maxHeight: number; + maxWidth: number; + }; + setConf: (cnf: any) => void; + draw: (_text: string, id: string, _version: string, diagObj: Diagram) => Promise; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sequence/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sequence/svgDraw.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/svgDraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7b39646b986712a3235922f17b54c28fdb3ff46 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/svgDraw.d.ts @@ -0,0 +1,83 @@ +export const ACTOR_TYPE_WIDTH: number; +export function drawRect(elem: any, rectData: any): import("../common/commonTypes.js").D3RectElement; +export function drawPopup(elem: any, actor: any, minMenuWidth: any, textAttrs: any, forceMenus: any): { + height: any; + width: any; +}; +export function drawKatex(elem: any, textData: any, msgModel?: null): Promise; +export function drawText(elem: any, textData: any): any[]; +export function drawLabel(elem: any, txtObject: any): any; +export function fixLifeLineHeights(diagram: any, actors: any, actorKeys: any, conf: any): void; +export function drawActor(elem: any, actor: any, conf: any, isFooter: any, diagramId: any, diagObj: any, actorIndexMap: any): Promise; +export function drawBox(elem: any, box: any, conf: any): void; +export function anchorElement(elem: any): any; +export function drawActivation(_elem: any, bounds: any, verticalPos: any, conf: any, actorActivations: any, diagObj: any, actorIndexMap: any): void; +export function drawLoop(elem: any, loopModel: any, labelText: any, conf: any, msg: any): any; +export function drawBackgroundRect(elem: any, bounds: any): void; +export function insertDatabaseIcon(elem: any, id: any): void; +export function insertComputerIcon(elem: any, id: any): void; +export function insertClockIcon(elem: any, id: any): void; +export function insertArrowHead(elem: any, id: any): void; +export function insertArrowFilledHead(elem: any, id: any): void; +export function insertSequenceNumber(elem: any, id: any): void; +export function insertArrowCrossHead(elem: any, id: any): void; +export function insertDropShadow(elem: any, conf: any): void; +export function getTextObj(): { + x: number; + y: number; + fill: undefined; + anchor: undefined; + style: string; + width: undefined; + height: undefined; + textMargin: number; + rx: number; + ry: number; + tspan: boolean; + valign: undefined; +}; +export function getNoteRect(): { + x: number; + y: number; + fill: string; + stroke: string; + width: number; + anchor: string; + height: number; + rx: number; + ry: number; +}; +export function insertSolidTopArrowHead(elem: any, id: any): void; +export function insertSolidBottomArrowHead(elem: any, id: any): void; +export function insertStickTopArrowHead(elem: any, id: any): void; +export function insertStickBottomArrowHead(elem: any, id: any): void; +declare namespace _default { + export { drawRect }; + export { drawText }; + export { drawLabel }; + export { drawActor }; + export { drawBox }; + export { drawPopup }; + export { anchorElement }; + export { drawActivation }; + export { drawLoop }; + export { drawBackgroundRect }; + export { insertArrowHead }; + export { insertArrowFilledHead }; + export { insertSequenceNumber }; + export { insertArrowCrossHead }; + export { insertDatabaseIcon }; + export { insertComputerIcon }; + export { insertClockIcon }; + export { getTextObj }; + export { getNoteRect }; + export { fixLifeLineHeights }; + export { sanitizeUrl }; + export { insertDropShadow }; + export { insertSolidTopArrowHead }; + export { insertSolidBottomArrowHead }; + export { insertStickTopArrowHead }; + export { insertStickBottomArrowHead }; +} +export default _default; +import { sanitizeUrl } from '@braintree/sanitize-url'; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/sequence/types.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4cbcedfb32d0ac6b1529e60bee42566327a0de81 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/sequence/types.d.ts @@ -0,0 +1,51 @@ +export interface Box { + name: string; + wrap: boolean; + fill: string; + actorKeys: string[]; +} +export interface Actor { + box?: Box; + name: string; + description: string; + wrap: boolean; + prevActor?: string; + nextActor?: string; + links: Record; + properties: Record; + actorCnt: number | null; + rectData: unknown; + type: string; +} +export interface Message { + id: string; + from?: string; + to?: string; + message: string | { + start: number; + step: number; + visible: boolean; + }; + wrap: boolean; + answer?: unknown; + type?: number; + activate?: boolean; + placement?: string; + centralConnection?: number; +} +export interface AddMessageParams { + from: string; + to: string; + msg: string; + signalType: number; + type: 'addMessage' | 'sequenceIndex' | 'addParticipant' | 'createParticipant' | 'destroyParticipant' | 'activeStart' | 'activeEnd' | 'centralConnection' | 'centralConnectionReverse' | 'addNote' | 'addLinks' | 'addALink' | 'addProperties' | 'addDetails' | 'boxStart' | 'boxEnd' | 'loopStart' | 'loopEnd' | 'rectStart' | 'rectEnd' | 'optStart' | 'optEnd' | 'altStart' | 'else' | 'altEnd' | 'setAccTitle' | 'parStart' | 'parAnd' | 'parEnd' | 'and' | 'criticalStart' | 'criticalOption' | 'option' | 'criticalEnd' | 'breakStart' | 'breakEnd' | 'parOverStart' | 'parOverEnd' | 'parOverAnd'; + activate: boolean; +} +export interface Note { + actor: { + actor: string; + }; + placement: Message['placement']; + message: string; + wrap: boolean; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/dataFetcher.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/dataFetcher.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bd1dc893a796f6a23ecefeb85cee73107937f0df --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/dataFetcher.d.ts @@ -0,0 +1,10 @@ +import type { MermaidConfig } from '../../config.type.js'; +import type { Edge, NodeData, StateStmt, StyleClass } from './stateDb.js'; +/** + * Create a standard string for the dom ID of an item. + * If a type is given, insert that before the counter, preceded by the type spacer + * + */ +export declare function stateDomId(itemId?: string, counter?: number, type?: string | null, typeSpacer?: string): string; +export declare const dataFetcher: (parent: StateStmt | undefined, parsedItem: StateStmt, diagramStates: Map, nodes: NodeData[], edges: Edge[], altFlag: boolean, look: MermaidConfig["look"], classes: Map) => void; +export declare const reset: () => void; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/shapes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/shapes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c4f443999a36b23e18ee83ac348721cb63a551dd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/shapes.d.ts @@ -0,0 +1,14 @@ +export function drawStartState(g: any): any; +export function drawDivider(g: any): any; +export function drawSimpleState(g: any, stateDef: any): any; +export function drawDescrState(g: any, stateDef: any): any; +export function addTitleAndBox(g: any, stateDef: any, altBkg: any): any; +export function drawText(elem: any, textData: any): any; +export function drawNote(text: any, g: any): any; +export function drawState(elem: any, stateDef: any): { + id: any; + label: any; + width: number; + height: number; +}; +export function drawEdge(elem: any, path: any, relation: any): void; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/stateCommon.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateCommon.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1c2518e86cefdc346b1090825e5ab1952a8c197 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateCommon.d.ts @@ -0,0 +1,88 @@ +/** + * Constants common to all State Diagram code + */ +export declare const DEFAULT_DIAGRAM_DIRECTION = "TB"; +export declare const DEFAULT_NESTED_DOC_DIR = "TB"; +export declare const STMT_DIRECTION = "dir"; +export declare const STMT_STATE = "state"; +export declare const STMT_ROOT = "root"; +export declare const STMT_RELATION = "relation"; +export declare const STMT_CLASSDEF = "classDef"; +export declare const STMT_STYLEDEF = "style"; +export declare const STMT_APPLYCLASS = "applyClass"; +export declare const DEFAULT_STATE_TYPE = "default"; +export declare const DIVIDER_TYPE = "divider"; +export declare const G_EDGE_STYLE = "fill:none"; +export declare const G_EDGE_ARROWHEADSTYLE = "fill: #333"; +export declare const G_EDGE_LABELPOS = "c"; +export declare const G_EDGE_LABELTYPE = "markdown"; +export declare const G_EDGE_THICKNESS = "normal"; +export declare const SHAPE_STATE = "rect"; +export declare const SHAPE_STATE_WITH_DESC = "rectWithTitle"; +export declare const SHAPE_START = "stateStart"; +export declare const SHAPE_END = "stateEnd"; +export declare const SHAPE_DIVIDER = "divider"; +export declare const SHAPE_GROUP = "roundedWithTitle"; +export declare const SHAPE_NOTE = "note"; +export declare const SHAPE_NOTEGROUP = "noteGroup"; +export declare const CSS_DIAGRAM = "statediagram"; +export declare const CSS_STATE = "state"; +export declare const CSS_DIAGRAM_STATE = "statediagram-state"; +export declare const CSS_EDGE = "transition"; +export declare const CSS_NOTE = "note"; +export declare const CSS_NOTE_EDGE = "note-edge"; +export declare const CSS_EDGE_NOTE_EDGE = "transition note-edge"; +export declare const CSS_DIAGRAM_NOTE = "statediagram-note"; +export declare const CSS_CLUSTER = "cluster"; +export declare const CSS_DIAGRAM_CLUSTER = "statediagram-cluster"; +export declare const CSS_CLUSTER_ALT = "cluster-alt"; +export declare const CSS_DIAGRAM_CLUSTER_ALT = "statediagram-cluster-alt"; +export declare const PARENT = "parent"; +export declare const NOTE = "note"; +export declare const DOMID_STATE = "state"; +export declare const DOMID_TYPE_SPACER = "----"; +export declare const NOTE_ID = "----note"; +export declare const PARENT_ID = "----parent"; +declare const _default: { + DEFAULT_DIAGRAM_DIRECTION: string; + DEFAULT_NESTED_DOC_DIR: string; + STMT_STATE: string; + STMT_RELATION: string; + STMT_CLASSDEF: string; + STMT_STYLEDEF: string; + STMT_APPLYCLASS: string; + DEFAULT_STATE_TYPE: string; + DIVIDER_TYPE: string; + G_EDGE_STYLE: string; + G_EDGE_ARROWHEADSTYLE: string; + G_EDGE_LABELPOS: string; + G_EDGE_LABELTYPE: string; + G_EDGE_THICKNESS: string; + CSS_EDGE: string; + CSS_DIAGRAM: string; + SHAPE_STATE: string; + SHAPE_STATE_WITH_DESC: string; + SHAPE_START: string; + SHAPE_END: string; + SHAPE_DIVIDER: string; + SHAPE_GROUP: string; + SHAPE_NOTE: string; + SHAPE_NOTEGROUP: string; + CSS_STATE: string; + CSS_DIAGRAM_STATE: string; + CSS_NOTE: string; + CSS_NOTE_EDGE: string; + CSS_EDGE_NOTE_EDGE: string; + CSS_DIAGRAM_NOTE: string; + CSS_CLUSTER: string; + CSS_DIAGRAM_CLUSTER: string; + CSS_CLUSTER_ALT: string; + CSS_DIAGRAM_CLUSTER_ALT: string; + PARENT: string; + NOTE: string; + DOMID_STATE: string; + DOMID_TYPE_SPACER: string; + NOTE_ID: string; + PARENT_ID: string; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecf2cd222b1eb87b9bacd3ab71b67afecec03d69 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDb.d.ts @@ -0,0 +1,256 @@ +import type { MermaidConfig } from '../../config.type.js'; +interface BaseStmt { + stmt: 'applyClass' | 'classDef' | 'dir' | 'relation' | 'state' | 'style' | 'root' | 'default' | 'click'; +} +interface ApplyClassStmt extends BaseStmt { + stmt: 'applyClass'; + id: string; + styleClass: string; +} +interface ClassDefStmt extends BaseStmt { + stmt: 'classDef'; + id: string; + classes: string; +} +interface DirectionStmt extends BaseStmt { + stmt: 'dir'; + value: 'TB' | 'BT' | 'RL' | 'LR'; +} +interface RelationStmt extends BaseStmt { + stmt: 'relation'; + state1: StateStmt; + state2: StateStmt; + description?: string; +} +export interface StateStmt extends BaseStmt { + stmt: 'state' | 'default'; + id: string; + type: 'default' | 'fork' | 'join' | 'choice' | 'divider' | 'start' | 'end'; + description?: string; + descriptions?: string[]; + doc?: Stmt[]; + note?: Note; + start?: boolean; + classes?: string[]; + styles?: string[]; + textStyles?: string[]; +} +interface StyleStmt extends BaseStmt { + stmt: 'style'; + id: string; + styleClass: string; +} +export interface RootStmt { + id: 'root'; + stmt: 'root'; + doc?: Stmt[]; +} +export interface ClickStmt extends BaseStmt { + stmt: 'click'; + id: string; + url: string; + tooltip: string; +} +interface Note { + position?: 'left of' | 'right of'; + text: string; +} +export type Stmt = ApplyClassStmt | ClassDefStmt | DirectionStmt | RelationStmt | StateStmt | StyleStmt | RootStmt | ClickStmt; +interface DiagramEdge { + id1: string; + id2: string; + relationTitle?: string; +} +export interface StyleClass { + id: string; + styles: string[]; + textStyles: string[]; +} +export interface NodeData { + labelStyle?: string; + shape: string; + label?: string | string[]; + cssClasses: string; + cssCompiledStyles?: string[]; + cssStyles: string[]; + id: string; + dir?: string; + domId?: string; + type?: string; + isGroup?: boolean; + padding?: number; + rx?: number; + ry?: number; + look?: MermaidConfig['look']; + parentId?: string; + centerLabel?: boolean; + position?: string; + description?: string | string[]; + labelType?: string; +} +export interface Edge { + id: string; + start: string; + end: string; + arrowhead: string; + arrowTypeEnd: string; + style: string; + labelStyle: string; + label?: string; + arrowheadStyle: string; + labelpos: string; + labelType: string; + thickness: string; + classes: string; + look: MermaidConfig['look']; +} +export declare class StateDB { + private version; + private nodes; + private edges; + private rootDoc; + private classes; + private documents; + private currentDocument; + private startEndCount; + private dividerCnt; + private links; + static readonly relationType: { + readonly AGGREGATION: 0; + readonly EXTENSION: 1; + readonly COMPOSITION: 2; + readonly DEPENDENCY: 3; + }; + constructor(version: 1 | 2); + /** + * Convert all of the statements (stmts) that were parsed into states and relationships. + * This is done because a state diagram may have nested sections, + * where each section is a 'document' and has its own set of statements. + * Ex: the section within a fork has its own statements, and incoming and outgoing statements + * refer to the fork as a whole (document). + * See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement. + * This will push the statement into the list of statements for the current document. + */ + extract(statements: Stmt[] | { + doc: Stmt[]; + }): void; + private handleStyleDef; + setRootDoc(o: Stmt[]): void; + docTranslator(parent: RootStmt | StateStmt, node: Stmt, first: boolean): void; + private getRootDocV2; + /** + * Function called by parser when a node definition has been found. + * + * @param descr - description for the state. Can be a string or a list or strings + * @param classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class. + * @param styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style. + * @param textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style. + */ + addState(id: string, type?: StateStmt['type'], doc?: Stmt[] | undefined, descr?: string | string[] | undefined, note?: Note | undefined, classes?: string | string[] | undefined, styles?: string | string[] | undefined, textStyles?: string | string[] | undefined): void; + clear(saveCommon?: boolean): void; + getState(id: string): StateStmt | undefined; + getStates(): Map; + logDocuments(): void; + getRelations(): DiagramEdge[]; + /** + * Adds a clickable link to a state. + */ + addLink(stateId: string, url: string, tooltip: string): void; + /** + * Get all registered links. + */ + getLinks(): Map; + /** + * If the id is a start node ( [*] ), then return a new id constructed from + * the start node name and the current start node count. + * else return the given id + */ + startIdIfNeeded(id?: string): string; + /** + * If the id is a start node ( [*] ), then return the start type ('start') + * else return the given type + */ + startTypeIfNeeded(id?: string, type?: StateStmt['type']): "join" | "default" | "start" | "end" | "divider" | "choice" | "fork"; + /** + * If the id is an end node ( [*] ), then return a new id constructed from + * the end node name and the current start_end node count. + * else return the given id + */ + endIdIfNeeded(id?: string): string; + /** + * If the id is an end node ( [*] ), then return the end type + * else return the given type + * + */ + endTypeIfNeeded(id?: string, type?: StateStmt['type']): "join" | "default" | "start" | "end" | "divider" | "choice" | "fork"; + addRelationObjs(item1: StateStmt, item2: StateStmt, relationTitle?: string): void; + /** + * Add a relation between two items. The items may be full objects or just the string id of a state. + */ + addRelation(item1: string | StateStmt, item2: string | StateStmt, title?: string): void; + addDescription(id: string, descr: string): void; + cleanupLabel(label: string): string; + getDividerId(): string; + /** + * Called when the parser comes across a (style) class definition + * @example classDef my-style fill:#f96; + * + * @param id - the id of this (style) class + * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma) + */ + addStyleClass(id: string, styleAttributes?: string): void; + getClasses(): Map; + /** + * Add a (style) class or css class to a state with the given id. + * If the state isn't already in the list of known states, add it. + * Might be called by parser when a style class or CSS class should be applied to a state + * + * @param itemIds - The id or a list of ids of the item(s) to apply the css class to + * @param cssClassName - CSS class name + */ + setCssClass(itemIds: string, cssClassName: string): void; + /** + * Add a style to a state with the given id. + * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px + * where 'style' is the keyword + * stateId is the id of a state + * the rest of the string is the styleText (all of the attributes to be applied to the state) + * + * @param itemId - The id of item to apply the style to + * @param styleText - the text of the attributes for the style + */ + setStyle(itemId: string, styleText: string): void; + /** + * Add a text style to a state with the given id + * + * @param itemId - The id of item to apply the css class to + * @param cssClassName - CSS class name + */ + setTextStyle(itemId: string, cssClassName: string): void; + /** + * Finds the direction statement in the root document. + * @returns the direction statement if present + */ + private getDirectionStatement; + getDirection(): "TB" | "BT" | "LR" | "RL"; + setDirection(dir: DirectionStmt['value']): void; + trimColon(str: string): string; + getData(): { + nodes: NodeData[]; + edges: Edge[]; + other: {}; + config: MermaidConfig; + direction: string; + }; + getConfig(): import("../../config.type.js").StateDiagramConfig | undefined; + getAccTitle: () => string; + setAccTitle: (txt: string) => void; + getAccDescription: () => string; + setAccDescription: (txt: string) => void; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDetector-V2.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDetector-V2.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDetector-V2.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDiagram-v2.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDiagram-v2.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDiagram-v2.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/stateRenderer-v3-unified.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateRenderer-v3-unified.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b46fc4f65e8683b0555a106561c5c8e49a417c38 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateRenderer-v3-unified.d.ts @@ -0,0 +1,18 @@ +import type { DiagramStyleClassDef } from '../../diagram-api/types.js'; +/** + * Get the direction from the statement items. + * Look through all of the documents (docs) in the parsedItems + * Because is a _document_ direction, the default direction is not necessarily the same as the overall default _diagram_ direction. + * @param parsedItem - the parsed statement item to look through + * @param defaultDir - the direction to use if none is found + * @returns The direction to use + */ +export declare const getDir: (parsedItem: any, defaultDir?: string) => string; +export declare const getClasses: (text: string, diagramObj: any) => Map; +export declare const draw: (text: string, id: string, _version: string, diag: any) => Promise; +declare const _default: { + getClasses: (text: string, diagramObj: any) => Map; + draw: (text: string, id: string, _version: string, diag: any) => Promise; + getDir: (parsedItem: any, defaultDir?: string) => string; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/stateRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..43eebd3b2ffcbb838f930760afc4e8ecd35cd043 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/stateRenderer.d.ts @@ -0,0 +1,7 @@ +export function setConf(): void; +export function draw(text: any, id: any, _version: any, diagObj: any): void; +declare namespace _default { + export { setConf }; + export { draw }; +} +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/state/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/state/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/state/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/timeline/detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/detector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/timeline/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/timeline/svgDraw.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/svgDraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b82e3281bfa20ae46ef228f776a4f54c32b55d52 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/svgDraw.d.ts @@ -0,0 +1,46 @@ +export function drawRect(elem: any, rectData: any): any; +export function drawFace(element: any, faceData: any): any; +export function drawCircle(element: any, circleData: any): any; +export function drawText(elem: any, textData: any): any; +export function drawLabel(elem: any, txtObject: any): void; +export function drawSection(elem: any, section: any, conf: any): void; +export function drawTask(elem: any, task: any, conf: any, diagramId: any): void; +export function drawBackgroundRect(elem: any, bounds: any): void; +export function getTextObj(): { + x: number; + y: number; + fill: undefined; + 'text-anchor': string; + width: number; + height: number; + textMargin: number; + rx: number; + ry: number; +}; +export function getNoteRect(): { + x: number; + y: number; + width: number; + anchor: string; + height: number; + rx: number; + ry: number; +}; +export function drawNode(elem: any, node: any, fullSection: any, conf: any, diagramId: any, isEvent?: boolean): any; +export function getVirtualNodeHeight(elem: any, node: any, conf: any): any; +declare namespace _default { + export { drawRect }; + export { drawCircle }; + export { drawSection }; + export { drawText }; + export { drawLabel }; + export { drawTask }; + export { drawBackgroundRect }; + export { getTextObj }; + export { getNoteRect }; + export { initGraphics }; + export { drawNode }; + export { getVirtualNodeHeight }; +} +export default _default; +declare function initGraphics(graphics: any, id: any): void; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timeline-definition.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timeline-definition.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a11df3c37c3dd016a97ff9169a0dd727c7841ce4 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timeline-definition.d.ts @@ -0,0 +1,10 @@ +import * as db from './timelineDb.js'; +export declare const diagram: { + db: typeof db; + renderer: { + setConf: () => void; + draw: (text: string, id: string, version: string, diagObj: any) => void; + }; + parser: any; + styles: (options: any) => string; +}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timelineDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timelineDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bef1c0fe9c729ec50cfd8ec1b40f70dec89cad71 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timelineDb.d.ts @@ -0,0 +1,24 @@ +export function getCommonDb(): typeof commonDb; +export function clear(): void; +export function setDirection(dir: any): void; +export function getDirection(): string; +export function addSection(txt: any): void; +export function getSections(): any[]; +export function getTasks(): any[]; +export function addTask(period: any, length: any, event: any): void; +export function addEvent(event: any): void; +export function addTaskOrg(descr: any): void; +declare namespace _default { + export { clear }; + export { getCommonDb }; + export { getDirection }; + export { setDirection }; + export { addSection }; + export { getSections }; + export { getTasks }; + export { addTask }; + export { addTaskOrg }; + export { addEvent }; +} +export default _default; +import * as commonDb from '../common/commonDb.js'; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timelineRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timelineRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..03f70b4ead946e274db0a6104c11e0fb51ca14f1 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timelineRenderer.d.ts @@ -0,0 +1,19 @@ +import type { Selection } from 'd3'; +import type { Diagram } from '../../Diagram.js'; +import type { MermaidConfig } from '../../config.type.js'; +interface TimelineTask { + id: number; + section: string; + type: string; + task: string; + score: number; + events: string[]; +} +export declare const draw: (text: string, id: string, version: string, diagObj: Diagram) => void; +export declare const drawTasks: (diagram: Selection, tasks: TimelineTask[], sectionColor: number, masterX: number, masterY: number, maxTaskHeight: number, conf: MermaidConfig, maxEventCount: number, maxEventLineLength: number, maxSectionHeight: number, isWithoutSections: boolean, diagramId: string) => void; +export declare const drawEvents: (diagram: Selection, events: string[], sectionColor: number, masterX: number, masterY: number, conf: MermaidConfig, diagramId: string) => number; +declare const _default: { + setConf: () => void; + draw: (text: string, id: string, version: string, diagObj: Diagram) => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timelineRendererVertical.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timelineRendererVertical.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..45dfaee6737c55d926b00b06bae51b4319c5b955 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/timeline/timelineRendererVertical.d.ts @@ -0,0 +1,19 @@ +import type { Diagram } from '../../Diagram.js'; +import type { MermaidConfig } from '../../config.type.js'; +import type { SVG } from '../../diagram-api/types.js'; +interface TimelineTask { + id: number; + section: string; + type: string; + task: string; + score: number; + events: string[]; +} +export declare const draw: (text: string, id: string, version: string, diagObj: Diagram) => void; +export declare const drawTasks: (diagram: SVG, tasks: TimelineTask[], sectionColor: number, timelineX: number, masterY: number, maxTaskHeight: number, conf: MermaidConfig, taskSpacing: number, isWithoutSections: boolean) => void; +export declare const drawEvents: (diagram: SVG, events: string[], sectionColor: number, axisX: number, eventsX: number, startY: number, conf: MermaidConfig) => number; +declare const _default: { + setConf: () => void; + draw: (text: string, id: string, version: string, diagObj: Diagram) => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treeView/db.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/db.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..87e01d8a266628ab54929eb70b14c30f7f1559c6 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/db.d.ts @@ -0,0 +1,3 @@ +import type { TreeViewDB } from './types.js'; +declare const db: TreeViewDB; +export default db; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treeView/detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/detector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treeView/diagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/diagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/diagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treeView/parser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/parser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/parser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treeView/renderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/renderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..19afad987ff3fc5aee6bc6003ba7bcc0b7df6173 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/renderer.d.ts @@ -0,0 +1,3 @@ +import type { DiagramRenderer } from '../../diagram-api/types.js'; +declare const renderer: DiagramRenderer; +export default renderer; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treeView/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..18de9be44fcd0785a04ee3ed07b2500d3508ef23 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/styles.d.ts @@ -0,0 +1,3 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +declare const styles: DiagramStylesProvider; +export default styles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treeView/types.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3e812dfb8e0b9d99f18d3960243a159f099bd11a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treeView/types.d.ts @@ -0,0 +1,28 @@ +import type { TreeViewDiagramConfig } from '../../config.type.js'; +import type { DiagramDBBase } from '../../diagram-api/types.js'; +import type { Selection } from 'd3-selection'; +interface BBox { + x: number; + y: number; + width: number; + height: number; +} +export interface Node { + id: number; + level: number; + name: string; + BBox?: BBox; + children: Node[]; +} +export interface TreeViewDB extends DiagramDBBase { + addNode: (level: number, name: string) => void; + getRoot: () => Node; + getCount: () => number; +} +export interface TreeViewDiagramStyles { + labelColor?: string; + labelFontSize?: string; + lineColor?: string; +} +export type D3SVGElement = Selection; +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treemap/db.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/db.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cae02939d4324f9bbf11db7c3c1f49bbb2e89673 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/db.d.ts @@ -0,0 +1,27 @@ +import type { DiagramDB } from '../../diagram-api/types.js'; +import type { DiagramStyleClassDef } from '../../diagram-api/types.js'; +import type { TreemapDiagramConfig, TreemapNode } from './types.js'; +export declare class TreeMapDB implements DiagramDB { + private nodes; + private levels; + private outerNodes; + private classes; + private root?; + getNodes(): TreemapNode[]; + getConfig(): Required; + addNode(node: TreemapNode, level: number): void; + getRoot(): { + name: string; + children: TreemapNode[]; + }; + addClass(id: string, _style: string): void; + getClasses(): Map; + getStylesForClass(classSelector: string): string[]; + clear(): void; + setAccTitle: (txt: string) => void; + getAccTitle: () => string; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; + getAccDescription: () => string; + setAccDescription: (txt: string) => void; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treemap/detector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/detector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..92462abef11daaf3ae532e49e86796690946c886 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/detector.d.ts @@ -0,0 +1,2 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +export declare const treemap: ExternalDiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treemap/diagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/diagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/diagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treemap/parser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/parser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/parser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treemap/renderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/renderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9ed26d8b0f8c09ea60230a21d8114326c425679c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/renderer.d.ts @@ -0,0 +1,2 @@ +import type { DiagramRenderer } from '../../diagram-api/types.js'; +export declare const renderer: DiagramRenderer; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treemap/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..132678fc0778fb702618895dbe2ff5e999598620 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/styles.d.ts @@ -0,0 +1,3 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +export declare const getStyles: DiagramStylesProvider; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treemap/types.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea57aa0c68967d26b7dcdd92e5a2752e0ad1427f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/types.d.ts @@ -0,0 +1,71 @@ +import type { DiagramDBBase, DiagramStyleClassDef } from '../../diagram-api/types.js'; +import type { BaseDiagramConfig } from '../../config.type.js'; +export interface TreemapNode { + name: string; + children?: TreemapNode[]; + value?: number; + parent?: TreemapNode; + classSelector?: string; + cssCompiledStyles?: string[]; +} +export interface TreemapDB extends DiagramDBBase { + getNodes: () => TreemapNode[]; + addNode: (node: TreemapNode, level: number) => void; + getRoot: () => TreemapNode | undefined; + getClasses: () => Map; + addClass: (className: string, style: string) => void; + getStylesForClass: (classSelector: string) => string[]; +} +export interface TreemapStyleOptions { + sectionStrokeColor?: string; + sectionStrokeWidth?: string; + sectionFillColor?: string; + leafStrokeColor?: string; + leafStrokeWidth?: string; + leafFillColor?: string; + labelColor?: string; + labelFontSize?: string; + valueFontSize?: string; + valueColor?: string; + titleColor?: string; + titleFontSize?: string; +} +export interface TreemapData { + nodes: TreemapNode[]; + levels: Map; + root?: TreemapNode; + outerNodes: TreemapNode[]; + classes: Map; +} +export interface TreemapItem { + $type: string; + name: string; + value?: number; + classSelector?: string; +} +export interface TreemapRow { + $type: string; + indent?: string; + item?: TreemapItem; + className?: string; + styleText?: string; +} +export interface TreemapAst { + TreemapRows?: TreemapRow[]; + title?: string; + description?: string; + accDescription?: string; + accTitle?: string; + diagramTitle?: string; +} +export interface TreemapDiagramConfig extends BaseDiagramConfig { + padding?: number; + diagramPadding?: number; + showValues?: boolean; + nodeWidth?: number; + nodeHeight?: number; + borderWidth?: number; + valueFontSize?: number; + labelFontSize?: number; + valueFormat?: string; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treemap/utils.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4fecbb27ca4bcc10cb9db926af007b8c42a816cc --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/utils.d.ts @@ -0,0 +1,14 @@ +import type { TreemapNode } from './types.js'; +/** + * Converts a flat array of treemap items into a hierarchical structure + * @param items - Array of flat treemap items with level, name, type, and optional value + * @returns A hierarchical tree structure + */ +export declare function buildHierarchy(items: { + level: number; + name: string; + type: string; + value?: number; + classSelector?: string; + cssCompiledStyles?: string[]; +}[]): TreemapNode[]; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/treemap/utils.test.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/utils.test.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/treemap/utils.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ef7a69439f64f6f15995d0845d16bac4bf1fdcac --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyDb.d.ts @@ -0,0 +1,30 @@ +export function clear(): void; +export function addSection(txt: any): void; +export function getSections(): any[]; +export function getTasks(): any[]; +export function addTask(descr: any, taskData: any): void; +export function addTaskOrg(descr: any): void; +declare namespace _default { + export function getConfig(): import("../../config.type.js").JourneyDiagramConfig | undefined; + export { clear }; + export { setDiagramTitle }; + export { getDiagramTitle }; + export { setAccTitle }; + export { getAccTitle }; + export { setAccDescription }; + export { getAccDescription }; + export { addSection }; + export { getSections }; + export { getTasks }; + export { addTask }; + export { addTaskOrg }; + export { getActors }; +} +export default _default; +import { setDiagramTitle } from '../common/commonDb.js'; +import { getDiagramTitle } from '../common/commonDb.js'; +import { setAccTitle } from '../common/commonDb.js'; +import { getAccTitle } from '../common/commonDb.js'; +import { setAccDescription } from '../common/commonDb.js'; +import { getAccDescription } from '../common/commonDb.js'; +declare function getActors(): any[]; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc0ea0d5189f44b0d72dc759edd62c773bf5ac76 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/journeyRenderer.d.ts @@ -0,0 +1,30 @@ +export declare const setConf: (cnf: any) => void; +export declare const draw: (text: any, id: any, version: any, diagObj: any) => void; +export declare const bounds: { + data: { + startx: undefined; + stopx: undefined; + starty: undefined; + stopy: undefined; + }; + verticalPos: number; + sequenceItems: never[]; + init: () => void; + updateVal: (obj: any, key: any, val: any, fun: any) => void; + updateBounds: (startx: any, starty: any, stopx: any, stopy: any) => void; + insert: (startx: any, starty: any, stopx: any, stopy: any) => void; + bumpVerticalPos: (bump: any) => void; + getVerticalPos: () => number; + getBounds: () => { + startx: undefined; + stopx: undefined; + starty: undefined; + stopy: undefined; + }; +}; +export declare const drawTasks: (diagram: any, tasks: any, verticalPos: any, diagramId: any) => void; +declare const _default: { + setConf: (cnf: any) => void; + draw: (text: any, id: any, version: any, diagObj: any) => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d8e7c59d91a6f4acf834d91e44d1d66b6181a1c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/styles.d.ts @@ -0,0 +1,2 @@ +export default getStyles; +declare function getStyles(options: any): string; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/svgDraw.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/svgDraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ceb131ff98b4ab0297e542f947673706eb04a102 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/user-journey/svgDraw.d.ts @@ -0,0 +1,20 @@ +export function drawRect(elem: any, rectData: any): import("../common/commonTypes.js").D3RectElement; +export function drawFace(element: any, faceData: any): any; +export function drawCircle(element: any, circleData: any): any; +export function drawText(elem: any, textData: any): import("../common/commonTypes.js").D3TextElement; +export function drawLabel(elem: any, txtObject: any): void; +export function drawSection(elem: any, section: any, conf: any): void; +export function drawTask(elem: any, task: any, conf: any, diagramId: string): void; +export function drawBackgroundRect(elem: any, bounds: any): void; +declare namespace _default { + export { drawRect }; + export { drawCircle }; + export { drawSection }; + export { drawText }; + export { drawLabel }; + export { drawTask }; + export { drawBackgroundRect }; + export { initGraphics }; +} +export default _default; +declare function initGraphics(graphics: any, id: any): void; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/venn/parser/venn.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/venn/parser/venn.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/venn/parser/venn.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/venn/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/venn/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0f1153f5e6318de360ccd85cd4d7e75c0da0005d --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/venn/styles.d.ts @@ -0,0 +1,8 @@ +export interface VennChartStyleOptions { + vennTitleTextColor: string; + vennSetTextColor: string; + fontFamily: string; + textColor: string; +} +declare const getStyles: (options: VennChartStyleOptions) => string; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennDB.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennDB.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..de21ff0192591904fc32ff68a4470274ce7d3000 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennDB.d.ts @@ -0,0 +1,12 @@ +import type { VennDB, VennData, VennTextData, VennStyleData } from './vennTypes.js'; +export declare const addSubsetData: VennDB['addSubsetData']; +export declare const getSubsetData: () => VennData[]; +export declare const addTextData: VennDB['addTextData']; +export declare const addStyleData: VennDB['addStyleData']; +export declare const getStyleData: () => VennStyleData[]; +export declare const validateUnionIdentifiers: VennDB['validateUnionIdentifiers']; +export declare const getTextData: () => VennTextData[]; +export declare const getCurrentSets: VennDB['getCurrentSets']; +export declare const getIndentMode: VennDB['getIndentMode']; +export declare const setIndentMode: VennDB['setIndentMode']; +export declare const db: VennDB; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e33ea23b51a8033c2212de803e1f39c1ce449954 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennRenderer.d.ts @@ -0,0 +1,3 @@ +import type { DiagramRenderer, DrawDefinition } from '../../diagram-api/types.js'; +export declare const draw: DrawDefinition; +export declare const renderer: DiagramRenderer; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennRenderer.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennRenderer.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennRenderer.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..68d51c036954a3f142eb4f027823222ca5262e4c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/venn/vennTypes.d.ts @@ -0,0 +1,28 @@ +import type { DiagramDBBase } from '../../diagram-api/types.js'; +import type { VennDiagramConfig } from '../../config.type.js'; +export interface VennData { + sets: string[]; + size: number; + label: string | undefined; +} +export interface VennTextData { + sets: string[]; + id: string; + label: string | undefined; +} +export interface VennStyleData { + targets: string[]; + styles: Record; +} +export interface VennDB extends DiagramDBBase { + addSubsetData: (identifierList: string[], label: string | undefined, size: number | undefined) => void; + addTextData: (identifierList: string[], id: string, label: string | undefined) => void; + addStyleData: (identifierList: string[], data: [string, string][]) => void; + validateUnionIdentifiers: (identifierList: string[]) => void; + getSubsetData: () => VennData[]; + getTextData: () => VennTextData[]; + getStyleData: () => VennStyleData[]; + getCurrentSets: () => string[] | undefined; + getIndentMode: () => boolean; + setIndentMode: (enabled: boolean) => void; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/styles.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4093ff4836488e65c4451ea7e8fcabbac64a0912 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/styles.d.ts @@ -0,0 +1,17 @@ +import type { DiagramStylesProvider } from '../../diagram-api/types.js'; +export interface WardleyStyleOptions { + backgroundColor?: string; + axisColor?: string; + axisTextColor?: string; + gridColor?: string; + componentFill?: string; + componentStroke?: string; + componentLabelColor?: string; + linkStroke?: string; + evolutionStroke?: string; + annotationStroke?: string; + annotationTextColor?: string; + annotationFill?: string; +} +export declare const styles: DiagramStylesProvider; +export default styles; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyBuilder.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyBuilder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f70c277491bc2a9662a81324d9a150a5c25ea57e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyBuilder.d.ts @@ -0,0 +1,111 @@ +export interface WardleyNode { + id: string; + label: string; + x?: number; + y?: number; + className?: string; + labelOffsetX?: number; + labelOffsetY?: number; + inPipeline?: boolean; + isPipelineParent?: boolean; + inertia?: boolean; + sourceStrategy?: 'build' | 'buy' | 'outsource' | 'market'; +} +export interface WardleyLink { + source: string; + target: string; + dashed?: boolean; + label?: string; + flow?: 'forward' | 'backward' | 'bidirectional'; +} +export interface WardleyTrend { + nodeId: string; + targetX: number; + targetY: number; +} +export interface WardleyPipeline { + nodeId: string; + componentIds: string[]; +} +export interface WardleyAnnotation { + number: number; + coordinates: { + x: number; + y: number; + }[]; + text?: string; +} +export interface WardleyNote { + text: string; + x: number; + y: number; +} +export interface WardleyAccelerator { + name: string; + x: number; + y: number; +} +export interface WardleyDeaccelerator { + name: string; + x: number; + y: number; +} +export interface WardleyAxesConfig { + xLabel?: string; + yLabel?: string; + stages?: string[]; + stageBoundaries?: number[]; +} +export interface WardleyBuildResult { + nodes: WardleyNode[]; + links: WardleyLink[]; + trends: WardleyTrend[]; + pipelines: WardleyPipeline[]; + annotations: WardleyAnnotation[]; + notes: WardleyNote[]; + accelerators: WardleyAccelerator[]; + deaccelerators: WardleyDeaccelerator[]; + annotationsBox?: { + x: number; + y: number; + }; + axes: WardleyAxesConfig; + size?: { + width: number; + height: number; + }; +} +export declare class WardleyBuilder { + private nodes; + private links; + private trends; + private pipelines; + private annotations; + private notes; + private accelerators; + private deaccelerators; + private annotationsBox?; + private axes; + private size?; + addNode(node: WardleyNode): void; + addLink(link: WardleyLink): void; + addTrend(trend: WardleyTrend): void; + startPipeline(nodeId: string): void; + addPipelineComponent(pipelineNodeId: string, componentId: string): void; + addAnnotation(annotation: WardleyAnnotation): void; + addNote(note: WardleyNote): void; + addAccelerator(accelerator: WardleyAccelerator): void; + addDeaccelerator(deaccelerator: WardleyDeaccelerator): void; + setAnnotationsBox(x: number, y: number): void; + setAxes(partial: WardleyAxesConfig): void; + setSize(width: number, height: number): void; + getNode(id: string): WardleyNode | undefined; + /** + * Resolve a name to a node ID. Tries exact ID match first, + * then falls back to finding a node whose label matches the name + * (handles pipeline components which have synthetic IDs like "Parent_Child"). + */ + resolveNodeId(name: string): string; + build(): WardleyBuildResult; + clear(): void; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyBuilder.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyBuilder.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyBuilder.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..62c6fea91116aedd40e93f01544a5fe816f1c8ab --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyDb.d.ts @@ -0,0 +1,47 @@ +import type { WardleyAxesConfig } from './wardleyBuilder.js'; +declare function getConfig(): import("../../config.type.js").WardleyDiagramConfig | undefined; +declare function addNode(id: string, label: string, x: number, y: number, className?: string, labelOffsetX?: number, labelOffsetY?: number, inertia?: boolean, sourceStrategy?: 'build' | 'buy' | 'outsource' | 'market'): void; +declare function addLink(sourceId: string, targetId: string, dashed?: boolean, label?: string, flow?: 'forward' | 'backward' | 'bidirectional'): void; +declare function addTrend(nodeId: string, targetX: number, targetY: number): void; +declare function addAnnotation(number: number, coordinates: { + x: number; + y: number; +}[], text?: string): void; +declare function addNote(text: string, x: number, y: number): void; +declare function addAccelerator(name: string, x: number, y: number): void; +declare function addDeaccelerator(name: string, x: number, y: number): void; +declare function setAnnotationsBox(x: number, y: number): void; +declare function setSize(width: number, height: number): void; +declare function startPipeline(nodeId: string): void; +declare function addPipelineComponent(pipelineNodeId: string, componentId: string): void; +declare function updateAxes(partial: WardleyAxesConfig): void; +declare function getNode(id: string): import("./wardleyBuilder.js").WardleyNode | undefined; +declare function resolveNodeId(name: string): string; +declare function getWardleyData(): import("./wardleyBuilder.js").WardleyBuildResult; +declare function clear(): void; +declare const _default: { + getConfig: typeof getConfig; + addNode: typeof addNode; + addLink: typeof addLink; + addTrend: typeof addTrend; + addAnnotation: typeof addAnnotation; + addNote: typeof addNote; + addAccelerator: typeof addAccelerator; + addDeaccelerator: typeof addDeaccelerator; + setAnnotationsBox: typeof setAnnotationsBox; + setSize: typeof setSize; + startPipeline: typeof startPipeline; + addPipelineComponent: typeof addPipelineComponent; + updateAxes: typeof updateAxes; + getNode: typeof getNode; + resolveNodeId: typeof resolveNodeId; + getWardleyData: typeof getWardleyData; + clear: typeof clear; + setAccTitle: (txt: string) => void; + getAccTitle: () => string; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; + getAccDescription: () => string; + setAccDescription: (txt: string) => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyParser.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyParser.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fba77f0e521c77dd449fa6d06188b35fda000a7e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyParser.d.ts @@ -0,0 +1,2 @@ +import type { ParserDefinition } from '../../diagram-api/types.js'; +export declare const parser: ParserDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyParser.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyParser.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyParser.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eae36e260279d1d463e7000c8ab792363f4c066e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyRenderer.d.ts @@ -0,0 +1,6 @@ +import type { Diagram } from '../../Diagram.js'; +export declare const draw: (text: string, id: string, _version: string, diagObj: Diagram) => void; +declare const _default: { + draw: (text: string, id: string, _version: string, diagObj: Diagram) => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyTypes.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyTypes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7836e372e0c7f7ebd0ea6c5ddc0b036d477dcaa --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/wardley/wardleyTypes.d.ts @@ -0,0 +1,2 @@ +import type wardleyDb from './wardleyDb.js'; +export type WardleyDB = typeof wardleyDb; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/bandAxis.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/bandAxis.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..91cea4099b15da30e2bcb3f690c7e9ab7d18ee53 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/bandAxis.d.ts @@ -0,0 +1,12 @@ +import type { TextDimensionCalculator } from '../../textDimensionCalculator.js'; +import { BaseAxis } from './baseAxis.js'; +import type { XYChartAxisThemeConfig, XYChartAxisConfig } from '../../interfaces.js'; +export declare class BandAxis extends BaseAxis { + private scale; + private categories; + constructor(axisConfig: XYChartAxisConfig, axisThemeConfig: XYChartAxisThemeConfig, categories: string[], title: string, textDimensionCalculator: TextDimensionCalculator); + setRange(range: [number, number]): void; + recalculateScale(): void; + getTickValues(): (string | number)[]; + getScaleValue(value: string): number; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/baseAxis.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/baseAxis.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d6069e6a94fed4326762c7d3f8cd71653f0ff844 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/baseAxis.d.ts @@ -0,0 +1,38 @@ +import type { BoundingRect, Dimension, DrawableElem, Point, XYChartAxisConfig, XYChartAxisThemeConfig } from '../../interfaces.js'; +import type { TextDimensionCalculator } from '../../textDimensionCalculator.js'; +import type { Axis, AxisPosition } from './index.js'; +export declare abstract class BaseAxis implements Axis { + protected axisConfig: XYChartAxisConfig; + protected title: string; + protected textDimensionCalculator: TextDimensionCalculator; + protected axisThemeConfig: XYChartAxisThemeConfig; + protected boundingRect: BoundingRect; + protected axisPosition: AxisPosition; + private range; + protected showTitle: boolean; + protected showLabel: boolean; + protected showTick: boolean; + protected showAxisLine: boolean; + protected outerPadding: number; + protected titleTextHeight: number; + protected labelTextHeight: number; + constructor(axisConfig: XYChartAxisConfig, title: string, textDimensionCalculator: TextDimensionCalculator, axisThemeConfig: XYChartAxisThemeConfig); + setRange(range: [number, number]): void; + getRange(): [number, number]; + setAxisPosition(axisPosition: AxisPosition): void; + abstract getScaleValue(value: number | string): number; + abstract recalculateScale(): void; + abstract getTickValues(): (string | number)[]; + getTickDistance(): number; + getAxisOuterPadding(): number; + private getLabelDimension; + recalculateOuterPaddingToDrawBar(): void; + private calculateSpaceIfDrawnHorizontally; + private calculateSpaceIfDrawnVertical; + calculateSpace(availableSpace: Dimension): Dimension; + setBoundingBoxXY(point: Point): void; + private getDrawableElementsForLeftAxis; + private getDrawableElementsForBottomAxis; + private getDrawableElementsForTopAxis; + getDrawableElements(): DrawableElem[]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/index.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d98e91fffeabf07d689e9d87c9fb5b9e597a9cc3 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/index.d.ts @@ -0,0 +1,12 @@ +import type { SVGGroup } from '../../../../../diagram-api/types.js'; +import type { AxisDataType, ChartComponent, XYChartAxisConfig, XYChartAxisThemeConfig } from '../../interfaces.js'; +export type AxisPosition = 'left' | 'right' | 'top' | 'bottom'; +export interface Axis extends ChartComponent { + getScaleValue(value: string | number): number; + setAxisPosition(axisPosition: AxisPosition): void; + getAxisOuterPadding(): number; + getTickDistance(): number; + recalculateOuterPaddingToDrawBar(): void; + setRange(range: [number, number]): void; +} +export declare function getAxis(data: AxisDataType, axisConfig: XYChartAxisConfig, axisThemeConfig: XYChartAxisThemeConfig, tmpSVGGroup: SVGGroup): Axis; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/linearAxis.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/linearAxis.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..869b7510c573b87b4b32aecf3e479f5884bd13c0 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/axis/linearAxis.d.ts @@ -0,0 +1,11 @@ +import type { TextDimensionCalculator } from '../../textDimensionCalculator.js'; +import { BaseAxis } from './baseAxis.js'; +import type { XYChartAxisThemeConfig, XYChartAxisConfig } from '../../interfaces.js'; +export declare class LinearAxis extends BaseAxis { + private scale; + private domain; + constructor(axisConfig: XYChartAxisConfig, axisThemeConfig: XYChartAxisThemeConfig, domain: [number, number], title: string, textDimensionCalculator: TextDimensionCalculator); + getTickValues(): (string | number)[]; + recalculateScale(): void; + getScaleValue(value: number): number; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/chartTitle.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/chartTitle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1075bbfd9fc508623019e6be31a75b663448d45c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/chartTitle.d.ts @@ -0,0 +1,16 @@ +import type { SVGGroup } from '../../../../diagram-api/types.js'; +import type { ChartComponent, Dimension, DrawableElem, Point, XYChartConfig, XYChartData, XYChartThemeConfig } from '../interfaces.js'; +import type { TextDimensionCalculator } from '../textDimensionCalculator.js'; +export declare class ChartTitle implements ChartComponent { + private textDimensionCalculator; + private chartConfig; + private chartData; + private chartThemeConfig; + private boundingRect; + private showChartTitle; + constructor(textDimensionCalculator: TextDimensionCalculator, chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig); + setBoundingBoxXY(point: Point): void; + calculateSpace(availableSpace: Dimension): Dimension; + getDrawableElements(): DrawableElem[]; +} +export declare function getChartTitleComponent(chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig, tmpSVGGroup: SVGGroup): ChartComponent; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/plot/barPlot.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/plot/barPlot.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..60bc08e6b4082e39aa0da94929870b28af48c467 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/plot/barPlot.d.ts @@ -0,0 +1,12 @@ +import type { BarPlotData, BoundingRect, DrawableElem, XYChartConfig } from '../../interfaces.js'; +import type { Axis } from '../axis/index.js'; +export declare class BarPlot { + private barData; + private boundingRect; + private xAxis; + private yAxis; + private orientation; + private plotIndex; + constructor(barData: BarPlotData, boundingRect: BoundingRect, xAxis: Axis, yAxis: Axis, orientation: XYChartConfig['chartOrientation'], plotIndex: number); + getDrawableElement(): DrawableElem[]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/plot/index.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/plot/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae8b5a090c9e236f0ec19752700b79fb4e2eebfc --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/plot/index.d.ts @@ -0,0 +1,20 @@ +import type { XYChartData, Dimension, DrawableElem, Point, XYChartThemeConfig, XYChartConfig } from '../../interfaces.js'; +import type { Axis } from '../axis/index.js'; +import type { ChartComponent } from '../../interfaces.js'; +export interface Plot extends ChartComponent { + setAxes(xAxis: Axis, yAxis: Axis): void; +} +export declare class BasePlot implements Plot { + private chartConfig; + private chartData; + private chartThemeConfig; + private boundingRect; + private xAxis?; + private yAxis?; + constructor(chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig); + setAxes(xAxis: Axis, yAxis: Axis): void; + setBoundingBoxXY(point: Point): void; + calculateSpace(availableSpace: Dimension): Dimension; + getDrawableElements(): DrawableElem[]; +} +export declare function getPlotComponent(chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig): Plot; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/plot/linePlot.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/plot/linePlot.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bc268c3f5fa0f14765a36728cc5387a3b55b7494 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/components/plot/linePlot.d.ts @@ -0,0 +1,11 @@ +import type { DrawableElem, LinePlotData, XYChartConfig } from '../../interfaces.js'; +import type { Axis } from '../axis/index.js'; +export declare class LinePlot { + private plotData; + private xAxis; + private yAxis; + private orientation; + private plotIndex; + constructor(plotData: LinePlotData, xAxis: Axis, yAxis: Axis, orientation: XYChartConfig['chartOrientation'], plotIndex: number); + getDrawableElement(): DrawableElem[]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/index.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..96946a535ad47a901bb1125ef0c714407521574e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/index.d.ts @@ -0,0 +1,5 @@ +import type { SVGGroup } from '../../../diagram-api/types.js'; +import type { DrawableElem, XYChartConfig, XYChartData, XYChartThemeConfig } from './interfaces.js'; +export declare class XYChartBuilder { + static build(config: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig, tmpSVGGroup: SVGGroup): DrawableElem[]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/interfaces.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/interfaces.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3ccd2bf162a623eb74e35e27b938a333878cb07f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/interfaces.d.ts @@ -0,0 +1,135 @@ +export interface XYChartAxisThemeConfig { + titleColor: string; + labelColor: string; + tickColor: string; + axisLineColor: string; +} +export interface XYChartThemeConfig { + backgroundColor: string; + titleColor: string; + dataLabelColor: string; + xAxisLabelColor: string; + xAxisTitleColor: string; + xAxisTickColor: string; + xAxisLineColor: string; + yAxisLabelColor: string; + yAxisTitleColor: string; + yAxisTickColor: string; + yAxisLineColor: string; + plotColorPalette: string; +} +export interface ChartComponent { + calculateSpace(availableSpace: Dimension): Dimension; + setBoundingBoxXY(point: Point): void; + getDrawableElements(): DrawableElem[]; +} +export type SimplePlotDataType = [string, number][]; +export interface LinePlotData { + type: 'line'; + strokeFill: string; + strokeWidth: number; + data: SimplePlotDataType; +} +export interface BarPlotData { + type: 'bar'; + fill: string; + data: SimplePlotDataType; +} +export type PlotData = LinePlotData | BarPlotData; +export declare function isBarPlot(data: PlotData): data is BarPlotData; +export interface BandAxisDataType { + type: 'band'; + title: string; + categories: string[]; +} +export interface LinearAxisDataType { + type: 'linear'; + title: string; + min: number; + max: number; +} +export type AxisDataType = LinearAxisDataType | BandAxisDataType; +export declare function isBandAxisData(data: AxisDataType): data is BandAxisDataType; +export declare function isLinearAxisData(data: AxisDataType): data is LinearAxisDataType; +/** + * For now we are keeping this configs as we are removing the required fields while generating the config.type.ts file + * we should remove `XYChartAxisConfig` and `XYChartConfig` after we started using required fields + */ +export interface XYChartAxisConfig { + showLabel: boolean; + labelFontSize: number; + labelPadding: number; + showTitle: boolean; + titleFontSize: number; + titlePadding: number; + showTick: boolean; + tickLength: number; + tickWidth: number; + showAxisLine: boolean; + axisLineWidth: number; +} +export interface XYChartConfig { + width: number; + height: number; + titleFontSize: number; + titlePadding: number; + showTitle: boolean; + showDataLabel: boolean; + showDataLabelOutsideBar: boolean; + xAxis: XYChartAxisConfig; + yAxis: XYChartAxisConfig; + chartOrientation: 'vertical' | 'horizontal'; + plotReservedSpacePercent: number; +} +export interface XYChartData { + xAxis: AxisDataType; + yAxis: AxisDataType; + title: string; + plots: PlotData[]; +} +export interface Dimension { + width: number; + height: number; +} +export interface BoundingRect extends Point, Dimension { +} +export interface Point { + x: number; + y: number; +} +export type TextHorizontalPos = 'left' | 'center' | 'right'; +export type TextVerticalPos = 'top' | 'middle'; +export interface RectElem extends Point { + width: number; + height: number; + fill: string; + strokeWidth: number; + strokeFill: string; +} +export interface TextElem extends Point { + text: string; + fill: string; + verticalPos: TextVerticalPos; + horizontalPos: TextHorizontalPos; + fontSize: number; + rotation: number; +} +export interface PathElem { + path: string; + fill?: string; + strokeWidth: number; + strokeFill: string; +} +export type DrawableElem = { + groupTexts: string[]; + type: 'rect'; + data: RectElem[]; +} | { + groupTexts: string[]; + type: 'text'; + data: TextElem[]; +} | { + groupTexts: string[]; + type: 'path'; + data: PathElem[]; +}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/orchestrator.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/orchestrator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d36aba7cf855c08bb010d0ca928121b5bb33706 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/orchestrator.d.ts @@ -0,0 +1,12 @@ +import type { SVGGroup } from '../../../diagram-api/types.js'; +import type { DrawableElem, XYChartConfig, XYChartData, XYChartThemeConfig } from './interfaces.js'; +export declare class Orchestrator { + private chartConfig; + private chartData; + private componentStore; + constructor(chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig, tmpSVGGroup: SVGGroup); + private calculateVerticalSpace; + private calculateHorizontalSpace; + private calculateSpace; + getDrawableElement(): DrawableElem[]; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/textDimensionCalculator.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/textDimensionCalculator.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a25ed0105eefddf70cfacf4526902e140f9487e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/chartBuilder/textDimensionCalculator.d.ts @@ -0,0 +1,10 @@ +import type { SVGGroup } from '../../../diagram-api/types.js'; +import type { Dimension } from './interfaces.js'; +export interface TextDimensionCalculator { + getMaxDimension(texts: string[], fontSize: number): Dimension; +} +export declare class TextDimensionCalculatorWithFont implements TextDimensionCalculator { + private parentGroup; + constructor(parentGroup: SVGGroup); + getMaxDimension(texts: string[], fontSize: number): Dimension; +} diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/parser/xychart.jison.spec.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/parser/xychart.jison.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/parser/xychart.jison.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartDb.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..49dd387c640ffda4d8a264a6c5a6e333f49213a9 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartDb.d.ts @@ -0,0 +1,42 @@ +import type { SVGGroup } from '../../diagram-api/types.js'; +import type { DrawableElem, XYChartConfig, XYChartData, XYChartThemeConfig } from './chartBuilder/interfaces.js'; +interface NormalTextType { + type: 'text'; + text: string; +} +declare function setTmpSVGG(SVGG: SVGGroup): void; +declare function setOrientation(orientation: string): void; +declare function setXAxisTitle(title: NormalTextType): void; +declare function setXAxisRangeData(min: number, max: number): void; +declare function setXAxisBand(categories: NormalTextType[]): void; +declare function setYAxisTitle(title: NormalTextType): void; +declare function setYAxisRangeData(min: number, max: number): void; +declare function setLineData(title: NormalTextType, data: number[]): void; +declare function setBarData(title: NormalTextType, data: number[]): void; +declare function getDrawableElem(): DrawableElem[]; +declare function getChartThemeConfig(): XYChartThemeConfig; +declare function getChartConfig(): XYChartConfig; +declare function getXYChartData(): XYChartData; +declare const _default: { + getDrawableElem: typeof getDrawableElem; + clear: () => void; + setAccTitle: (txt: string) => void; + getAccTitle: () => string; + setDiagramTitle: (txt: string) => void; + getDiagramTitle: () => string; + getAccDescription: () => string; + setAccDescription: (txt: string) => void; + setOrientation: typeof setOrientation; + setXAxisTitle: typeof setXAxisTitle; + setXAxisRangeData: typeof setXAxisRangeData; + setXAxisBand: typeof setXAxisBand; + setYAxisTitle: typeof setYAxisTitle; + setYAxisRangeData: typeof setYAxisRangeData; + setLineData: typeof setLineData; + setBarData: typeof setBarData; + setTmpSVGG: typeof setTmpSVGG; + getChartThemeConfig: typeof getChartThemeConfig; + getChartConfig: typeof getChartConfig; + getXYChartData: typeof getXYChartData; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartDetector.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartDetector.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46efe8484dac159e69805ec805419b8041c41717 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartDetector.d.ts @@ -0,0 +1,3 @@ +import type { ExternalDiagramDefinition } from '../../diagram-api/types.js'; +declare const plugin: ExternalDiagramDefinition; +export default plugin; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartDiagram.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartDiagram.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f7aaea1b2edc4456245ab86a23f4c458fb794c37 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartDiagram.d.ts @@ -0,0 +1,2 @@ +import type { DiagramDefinition } from '../../diagram-api/types.js'; +export declare const diagram: DiagramDefinition; diff --git a/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartRenderer.d.ts b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartRenderer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b91b5309e94fe5e80e9507bce25e6f2df7aaf31d --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/diagrams/xychart/xychartRenderer.d.ts @@ -0,0 +1,6 @@ +import type { Diagram } from '../../Diagram.js'; +export declare const draw: (txt: string, id: string, _version: string, diagObj: Diagram) => void; +declare const _default: { + draw: (txt: string, id: string, _version: string, diagObj: Diagram) => void; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/docs/vite.config.d.ts b/tools/ui/node_modules/mermaid/dist/docs/vite.config.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..340562aff103906b000e905d3c228c55c71decc9 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/docs/vite.config.d.ts @@ -0,0 +1,2 @@ +declare const _default: import("vite").UserConfig; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/errors.d.ts b/tools/ui/node_modules/mermaid/dist/errors.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..90e14e7dffac3d5b8f306d8f686e2c6a28b1d2ee --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/errors.d.ts @@ -0,0 +1,3 @@ +export declare class UnknownDiagramError extends Error { + constructor(message: string); +} diff --git a/tools/ui/node_modules/mermaid/dist/interactionDb.d.ts b/tools/ui/node_modules/mermaid/dist/interactionDb.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aad64b193aca6d781886a0150edbaf58502837c2 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/interactionDb.d.ts @@ -0,0 +1,2 @@ +export declare const addFunction: (func: () => void) => void; +export declare const attachFunctions: () => void; diff --git a/tools/ui/node_modules/mermaid/dist/internals.d.ts b/tools/ui/node_modules/mermaid/dist/internals.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dfe957054b02dd8d1abc89a25927b2c17aae7370 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/internals.d.ts @@ -0,0 +1,43 @@ +import { insertNode } from './rendering-util/rendering-elements/nodes.js'; +import { interpolateToCurve } from './utils.js'; +/** + * Internal helpers for mermaid + * @deprecated - This should not be used by external packages, as the definitions will change without notice. + */ +export declare const internalHelpers: { + common: { + getRows: (s?: string) => string[]; + sanitizeText: (text: string, config: import("./config.type.js").MermaidConfig) => string; + sanitizeTextOrArray: (a: string | string[] | string[][], config: import("./config.type.js").MermaidConfig) => string | string[]; + hasBreaks: (text: string) => boolean; + splitBreaks: (text: string) => string[]; + lineBreakRegex: RegExp; + removeScript: (txt: string) => string; + getUrl: (useAbsolute: boolean) => string; + evaluate: (val?: string | boolean | null) => boolean; + getMax: (...values: number[]) => number; + getMin: (...values: number[]) => number; + }; + getConfig: () => import("./config.type.js").MermaidConfig; + insertCluster: (elem: any, node: import("./rendering-util/types.js").ClusterNode) => Promise; + insertEdge: (elem: any, edge: any, clusterDb: any, diagramType: any, startNode: any, endNode: any, diagramId: any, skipIntersect?: boolean) => { + updatedPath: any; + originalPath: any; + }; + insertEdgeLabel: (elem: any, edge: any) => Promise; + insertMarkers: (elem: any, markerArray: any, type: any, id: any) => void; + insertNode: typeof insertNode; + interpolateToCurve: typeof interpolateToCurve; + labelHelper: (parent: import("./types.js").D3Selection, node: import("./rendering-util/types.js").Node, _classes?: string) => Promise<{ + shapeSvg: import("d3-selection").Selection; + bbox: DOMRect; + halfPadding: number; + label: import("d3-selection").Selection; + }>; + log: Record; + positionEdgeLabel: (edge: any, paths: any) => void; +}; +export type InternalHelpers = typeof internalHelpers; diff --git a/tools/ui/node_modules/mermaid/dist/logger.d.ts b/tools/ui/node_modules/mermaid/dist/logger.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a29264ffa4f2ced2d3676e4f478e1ca039406981 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/logger.d.ts @@ -0,0 +1,9 @@ +export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; +export declare const LEVELS: Record; +export declare const log: Record; +/** + * Sets a log level + * + * @param level - The level to set the logging to. Default is `"fatal"` + */ +export declare const setLogLevel: (level?: keyof typeof LEVELS | number) => void; diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.core.mjs b/tools/ui/node_modules/mermaid/dist/mermaid.core.mjs new file mode 100644 index 0000000000000000000000000000000000000000..207098ff5f42315d21cd94a3db5b3ed09f1f662d --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.core.mjs @@ -0,0 +1,1514 @@ +import { + selectSvgElement +} from "./chunks/mermaid.core/chunk-WU5MYG2G.mjs"; +import { + JSON_SCHEMA, + load +} from "./chunks/mermaid.core/chunk-XPW4576I.mjs"; +import { + registerLayoutLoaders +} from "./chunks/mermaid.core/chunk-LZXEDZCA.mjs"; +import "./chunks/mermaid.core/chunk-KSCS5N6A.mjs"; +import "./chunks/mermaid.core/chunk-BSJP7CBP.mjs"; +import "./chunks/mermaid.core/chunk-3OPIFGDE.mjs"; +import "./chunks/mermaid.core/chunk-L5ZTLDWV.mjs"; +import "./chunks/mermaid.core/chunk-NZK2D7GU.mjs"; +import { + registerIconPacks +} from "./chunks/mermaid.core/chunk-O5CBEL6O.mjs"; +import { + cleanAndMerge, + decodeEntities, + encodeEntities, + isDetailedError, + removeDirectives, + utils_default +} from "./chunks/mermaid.core/chunk-5ZQYHXKU.mjs"; +import { + UnknownDiagramError, + addDirective, + assignWithDepth_default, + configureSvgSize, + cssStyleSheetToString, + defaultConfig, + detectType, + detectors, + evaluate, + frontMatterRegex, + getConfig, + getDiagram, + getDiagramLoader, + getEffectiveHtmlLabels, + getSiteConfig, + registerDiagram, + registerLazyLoadedDiagrams, + reset, + sanitizeCss, + saveConfigFromInitialize, + setConfig, + setSiteConfig, + styles_default, + themes_default, + updateSiteConfig +} from "./chunks/mermaid.core/chunk-CSCIHK7Q.mjs"; +import { + __name, + log, + setLogLevel +} from "./chunks/mermaid.core/chunk-AGHRB4JF.mjs"; + +// src/mermaid.ts +import { dedent } from "ts-dedent"; + +// src/diagrams/c4/c4Detector.ts +var id = "c4"; +var detector = /* @__PURE__ */ __name((txt) => { + return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt); +}, "detector"); +var loader = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/c4Diagram-AAUBKEIU.mjs"); + return { id, diagram: diagram2 }; +}, "loader"); +var plugin = { + id, + detector, + loader +}; +var c4Detector_default = plugin; + +// src/diagrams/flowchart/flowDetector.ts +var id2 = "flowchart"; +var detector2 = /* @__PURE__ */ __name((txt, config) => { + if (config?.flowchart?.defaultRenderer === "dagre-wrapper" || config?.flowchart?.defaultRenderer === "elk") { + return false; + } + return /^\s*graph/.test(txt); +}, "detector"); +var loader2 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/flowDiagram-I6XJVG4X.mjs"); + return { id: id2, diagram: diagram2 }; +}, "loader"); +var plugin2 = { + id: id2, + detector: detector2, + loader: loader2 +}; +var flowDetector_default = plugin2; + +// src/diagrams/flowchart/flowDetector-v2.ts +var id3 = "flowchart-v2"; +var detector3 = /* @__PURE__ */ __name((txt, config) => { + if (config?.flowchart?.defaultRenderer === "dagre-d3") { + return false; + } + if (config?.flowchart?.defaultRenderer === "elk") { + config.layout = "elk"; + } + if (/^\s*graph/.test(txt) && config?.flowchart?.defaultRenderer === "dagre-wrapper") { + return true; + } + return /^\s*flowchart/.test(txt); +}, "detector"); +var loader3 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/flowDiagram-I6XJVG4X.mjs"); + return { id: id3, diagram: diagram2 }; +}, "loader"); +var plugin3 = { + id: id3, + detector: detector3, + loader: loader3 +}; +var flowDetector_v2_default = plugin3; + +// src/diagrams/er/erDetector.ts +var id4 = "er"; +var detector4 = /* @__PURE__ */ __name((txt) => { + return /^\s*erDiagram/.test(txt); +}, "detector"); +var loader4 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/erDiagram-TEJ5UH35.mjs"); + return { id: id4, diagram: diagram2 }; +}, "loader"); +var plugin4 = { + id: id4, + detector: detector4, + loader: loader4 +}; +var erDetector_default = plugin4; + +// src/diagrams/git/gitGraphDetector.ts +var id5 = "gitGraph"; +var detector5 = /* @__PURE__ */ __name((txt) => { + return /^\s*gitGraph/.test(txt); +}, "detector"); +var loader5 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/gitGraphDiagram-PVQCEYII.mjs"); + return { id: id5, diagram: diagram2 }; +}, "loader"); +var plugin5 = { + id: id5, + detector: detector5, + loader: loader5 +}; +var gitGraphDetector_default = plugin5; + +// src/diagrams/gantt/ganttDetector.ts +var id6 = "gantt"; +var detector6 = /* @__PURE__ */ __name((txt) => { + return /^\s*gantt/.test(txt); +}, "detector"); +var loader6 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/ganttDiagram-6RSMTGT7.mjs"); + return { id: id6, diagram: diagram2 }; +}, "loader"); +var plugin6 = { + id: id6, + detector: detector6, + loader: loader6 +}; +var ganttDetector_default = plugin6; + +// src/diagrams/info/infoDetector.ts +var id7 = "info"; +var detector7 = /* @__PURE__ */ __name((txt) => { + return /^\s*info/.test(txt); +}, "detector"); +var loader7 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/infoDiagram-5YYISTIA.mjs"); + return { id: id7, diagram: diagram2 }; +}, "loader"); +var info = { + id: id7, + detector: detector7, + loader: loader7 +}; + +// src/diagrams/pie/pieDetector.ts +var id8 = "pie"; +var detector8 = /* @__PURE__ */ __name((txt) => { + return /^\s*pie/.test(txt); +}, "detector"); +var loader8 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/pieDiagram-4H26LBE5.mjs"); + return { id: id8, diagram: diagram2 }; +}, "loader"); +var pie = { + id: id8, + detector: detector8, + loader: loader8 +}; + +// src/diagrams/quadrant-chart/quadrantDetector.ts +var id9 = "quadrantChart"; +var detector9 = /* @__PURE__ */ __name((txt) => { + return /^\s*quadrantChart/.test(txt); +}, "detector"); +var loader9 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/quadrantDiagram-W4KKPZXB.mjs"); + return { id: id9, diagram: diagram2 }; +}, "loader"); +var plugin7 = { + id: id9, + detector: detector9, + loader: loader9 +}; +var quadrantDetector_default = plugin7; + +// src/diagrams/xychart/xychartDetector.ts +var id10 = "xychart"; +var detector10 = /* @__PURE__ */ __name((txt) => { + return /^\s*xychart(-beta)?/.test(txt); +}, "detector"); +var loader10 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/xychartDiagram-2RQKCTM6.mjs"); + return { id: id10, diagram: diagram2 }; +}, "loader"); +var plugin8 = { + id: id10, + detector: detector10, + loader: loader10 +}; +var xychartDetector_default = plugin8; + +// src/diagrams/requirement/requirementDetector.ts +var id11 = "requirement"; +var detector11 = /* @__PURE__ */ __name((txt) => { + return /^\s*requirement(Diagram)?/.test(txt); +}, "detector"); +var loader11 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/requirementDiagram-4Y6WPE33.mjs"); + return { id: id11, diagram: diagram2 }; +}, "loader"); +var plugin9 = { + id: id11, + detector: detector11, + loader: loader11 +}; +var requirementDetector_default = plugin9; + +// src/diagrams/sequence/sequenceDetector.ts +var id12 = "sequence"; +var detector12 = /* @__PURE__ */ __name((txt) => { + return /^\s*sequenceDiagram/.test(txt); +}, "detector"); +var loader12 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/sequenceDiagram-3UESZ5HK.mjs"); + return { id: id12, diagram: diagram2 }; +}, "loader"); +var plugin10 = { + id: id12, + detector: detector12, + loader: loader12 +}; +var sequenceDetector_default = plugin10; + +// src/diagrams/class/classDetector.ts +var id13 = "class"; +var detector13 = /* @__PURE__ */ __name((txt, config) => { + if (config?.class?.defaultRenderer === "dagre-wrapper") { + return false; + } + return /^\s*classDiagram/.test(txt); +}, "detector"); +var loader13 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/classDiagram-4FO5ZUOK.mjs"); + return { id: id13, diagram: diagram2 }; +}, "loader"); +var plugin11 = { + id: id13, + detector: detector13, + loader: loader13 +}; +var classDetector_default = plugin11; + +// src/diagrams/class/classDetector-V2.ts +var id14 = "classDiagram"; +var detector14 = /* @__PURE__ */ __name((txt, config) => { + if (/^\s*classDiagram/.test(txt) && config?.class?.defaultRenderer === "dagre-wrapper") { + return true; + } + return /^\s*classDiagram-v2/.test(txt); +}, "detector"); +var loader14 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/classDiagram-v2-Q7XG4LA2.mjs"); + return { id: id14, diagram: diagram2 }; +}, "loader"); +var plugin12 = { + id: id14, + detector: detector14, + loader: loader14 +}; +var classDetector_V2_default = plugin12; + +// src/diagrams/state/stateDetector.ts +var id15 = "state"; +var detector15 = /* @__PURE__ */ __name((txt, config) => { + if (config?.state?.defaultRenderer === "dagre-wrapper") { + return false; + } + return /^\s*stateDiagram/.test(txt); +}, "detector"); +var loader15 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/stateDiagram-AJRCARHV.mjs"); + return { id: id15, diagram: diagram2 }; +}, "loader"); +var plugin13 = { + id: id15, + detector: detector15, + loader: loader15 +}; +var stateDetector_default = plugin13; + +// src/diagrams/state/stateDetector-V2.ts +var id16 = "stateDiagram"; +var detector16 = /* @__PURE__ */ __name((txt, config) => { + if (/^\s*stateDiagram-v2/.test(txt)) { + return true; + } + if (/^\s*stateDiagram/.test(txt) && config?.state?.defaultRenderer === "dagre-wrapper") { + return true; + } + return false; +}, "detector"); +var loader16 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/stateDiagram-v2-BHNVJYJU.mjs"); + return { id: id16, diagram: diagram2 }; +}, "loader"); +var plugin14 = { + id: id16, + detector: detector16, + loader: loader16 +}; +var stateDetector_V2_default = plugin14; + +// src/diagrams/user-journey/journeyDetector.ts +var id17 = "journey"; +var detector17 = /* @__PURE__ */ __name((txt) => { + return /^\s*journey/.test(txt); +}, "detector"); +var loader17 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/journeyDiagram-JHISSGLW.mjs"); + return { id: id17, diagram: diagram2 }; +}, "loader"); +var plugin15 = { + id: id17, + detector: detector17, + loader: loader17 +}; +var journeyDetector_default = plugin15; + +// src/diagrams/error/errorRenderer.ts +var draw = /* @__PURE__ */ __name((_text, id33, version) => { + log.debug("rendering svg for syntax error\n"); + const svg = selectSvgElement(id33); + const g = svg.append("g"); + svg.attr("viewBox", "0 0 2412 512"); + configureSvgSize(svg, 100, 512, true); + g.append("path").attr("class", "error-icon").attr( + "d", + "m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z" + ); + g.append("text").attr("class", "error-text").attr("x", 1440).attr("y", 250).attr("font-size", "150px").style("text-anchor", "middle").text("Syntax error in text"); + g.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${version}`); +}, "draw"); +var renderer = { draw }; +var errorRenderer_default = renderer; + +// src/diagrams/error/errorDiagram.ts +var diagram = { + db: {}, + renderer, + parser: { + parse: /* @__PURE__ */ __name(() => { + return; + }, "parse") + } +}; +var errorDiagram_default = diagram; + +// src/diagrams/flowchart/elk/detector.ts +var id18 = "flowchart-elk"; +var detector18 = /* @__PURE__ */ __name((txt, config = {}) => { + if ( + // If diagram explicitly states flowchart-elk + /^\s*flowchart-elk/.test(txt) || // If a flowchart/graph diagram has their default renderer set to elk + /^\s*(flowchart|graph)/.test(txt) && config?.flowchart?.defaultRenderer === "elk" + ) { + config.layout = "elk"; + return true; + } + return false; +}, "detector"); +var loader18 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/flowDiagram-I6XJVG4X.mjs"); + return { id: id18, diagram: diagram2 }; +}, "loader"); +var plugin16 = { + id: id18, + detector: detector18, + loader: loader18 +}; +var detector_default = plugin16; + +// src/diagrams/timeline/detector.ts +var id19 = "timeline"; +var detector19 = /* @__PURE__ */ __name((txt) => { + return /^\s*timeline/.test(txt); +}, "detector"); +var loader19 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/timeline-definition-PNZ67QCA.mjs"); + return { id: id19, diagram: diagram2 }; +}, "loader"); +var plugin17 = { + id: id19, + detector: detector19, + loader: loader19 +}; +var detector_default2 = plugin17; + +// src/diagrams/mindmap/detector.ts +var id20 = "mindmap"; +var detector20 = /* @__PURE__ */ __name((txt) => { + return /^\s*mindmap/.test(txt); +}, "detector"); +var loader20 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/mindmap-definition-RKZ34NQL.mjs"); + return { id: id20, diagram: diagram2 }; +}, "loader"); +var plugin18 = { + id: id20, + detector: detector20, + loader: loader20 +}; +var detector_default3 = plugin18; + +// src/diagrams/kanban/detector.ts +var id21 = "kanban"; +var detector21 = /* @__PURE__ */ __name((txt) => { + return /^\s*kanban/.test(txt); +}, "detector"); +var loader21 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/kanban-definition-UN3LZRKU.mjs"); + return { id: id21, diagram: diagram2 }; +}, "loader"); +var plugin19 = { + id: id21, + detector: detector21, + loader: loader21 +}; +var detector_default4 = plugin19; + +// src/diagrams/sankey/sankeyDetector.ts +var id22 = "sankey"; +var detector22 = /* @__PURE__ */ __name((txt) => { + return /^\s*sankey(-beta)?/.test(txt); +}, "detector"); +var loader22 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/sankeyDiagram-5OEKKPKP.mjs"); + return { id: id22, diagram: diagram2 }; +}, "loader"); +var plugin20 = { + id: id22, + detector: detector22, + loader: loader22 +}; +var sankeyDetector_default = plugin20; + +// src/diagrams/packet/detector.ts +var id23 = "packet"; +var detector23 = /* @__PURE__ */ __name((txt) => { + return /^\s*packet(-beta)?/.test(txt); +}, "detector"); +var loader23 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/diagram-LMA3HP47.mjs"); + return { id: id23, diagram: diagram2 }; +}, "loader"); +var packet = { + id: id23, + detector: detector23, + loader: loader23 +}; + +// src/diagrams/radar/detector.ts +var id24 = "radar"; +var detector24 = /* @__PURE__ */ __name((txt) => { + return /^\s*radar-beta/.test(txt); +}, "detector"); +var loader24 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/diagram-2AECGRRQ.mjs"); + return { id: id24, diagram: diagram2 }; +}, "loader"); +var radar = { + id: id24, + detector: detector24, + loader: loader24 +}; + +// src/diagrams/block/blockDetector.ts +var id25 = "block"; +var detector25 = /* @__PURE__ */ __name((txt) => { + return /^\s*block(-beta)?/.test(txt); +}, "detector"); +var loader25 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/blockDiagram-GPEHLZMM.mjs"); + return { id: id25, diagram: diagram2 }; +}, "loader"); +var plugin21 = { + id: id25, + detector: detector25, + loader: loader25 +}; +var blockDetector_default = plugin21; + +// src/diagrams/treeView/detector.ts +var id26 = "treeView"; +var detector26 = /* @__PURE__ */ __name((txt) => { + return /^\s*treeView-beta/.test(txt); +}, "detector"); +var loader26 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/diagram-5GNKFQAL.mjs"); + return { id: id26, diagram: diagram2 }; +}, "loader"); +var plugin22 = { + id: id26, + detector: detector26, + loader: loader26 +}; +var detector_default5 = plugin22; + +// src/diagrams/architecture/architectureDetector.ts +var id27 = "architecture"; +var detector27 = /* @__PURE__ */ __name((txt) => { + return /^\s*architecture/.test(txt); +}, "detector"); +var loader27 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/architectureDiagram-3BPJPVTR.mjs"); + return { id: id27, diagram: diagram2 }; +}, "loader"); +var architecture = { + id: id27, + detector: detector27, + loader: loader27 +}; +var architectureDetector_default = architecture; + +// src/diagrams/eventmodeling/detector.ts +var id28 = "eventmodeling"; +var detector28 = /* @__PURE__ */ __name((txt) => { + return /^\s*eventmodeling/.test(txt); +}, "detector"); +var loader28 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/diagram-KO2AKTUF.mjs"); + return { id: id28, diagram: diagram2 }; +}, "loader"); +var plugin23 = { + id: id28, + detector: detector28, + loader: loader28 +}; +var detector_default6 = plugin23; + +// src/diagrams/ishikawa/ishikawaDetector.ts +var id29 = "ishikawa"; +var detector29 = /* @__PURE__ */ __name((txt) => { + return /^\s*ishikawa(-beta)?\b/i.test(txt); +}, "detector"); +var loader29 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/ishikawaDiagram-YF4QCWOH.mjs"); + return { id: id29, diagram: diagram2 }; +}, "loader"); +var ishikawa = { + id: id29, + detector: detector29, + loader: loader29 +}; + +// src/diagrams/venn/vennDetector.ts +var id30 = "venn"; +var detector30 = /* @__PURE__ */ __name((txt) => { + return /^\s*venn-beta/.test(txt); +}, "detector"); +var loader30 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/vennDiagram-CIIHVFJN.mjs"); + return { id: id30, diagram: diagram2 }; +}, "loader"); +var plugin24 = { + id: id30, + detector: detector30, + loader: loader30 +}; +var vennDetector_default = plugin24; + +// src/diagrams/treemap/detector.ts +var id31 = "treemap"; +var detector31 = /* @__PURE__ */ __name((txt) => { + return /^\s*treemap/.test(txt); +}, "detector"); +var loader31 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/diagram-OG6HWLK6.mjs"); + return { id: id31, diagram: diagram2 }; +}, "loader"); +var treemap = { + id: id31, + detector: detector31, + loader: loader31 +}; + +// src/diagrams/wardley/wardleyDetector.ts +var id32 = "wardley-beta"; +var detector32 = /* @__PURE__ */ __name((text) => { + return /^\s*wardley-beta/i.test(text); +}, "detector"); +var loader32 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.core/wardleyDiagram-YWT4CUSO.mjs"); + return { id: id32, diagram: diagram2 }; +}, "loader"); +var plugin25 = { + id: id32, + detector: detector32, + loader: loader32 +}; +var wardleyDetector_default = plugin25; + +// src/diagram-api/diagram-orchestration.ts +var hasLoadedDiagrams = false; +var addDiagrams = /* @__PURE__ */ __name(() => { + if (hasLoadedDiagrams) { + return; + } + hasLoadedDiagrams = true; + registerDiagram("error", errorDiagram_default, (text) => { + return text.toLowerCase().trim() === "error"; + }); + registerDiagram( + "---", + // --- diagram type may appear if YAML front-matter is not parsed correctly + { + db: { + clear: /* @__PURE__ */ __name(() => { + }, "clear") + }, + styles: {}, + // should never be used + renderer: { + draw: /* @__PURE__ */ __name(() => { + }, "draw") + }, + parser: { + parse: /* @__PURE__ */ __name(() => { + throw new Error( + "Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks" + ); + }, "parse") + }, + init: /* @__PURE__ */ __name(() => null, "init") + // no op + }, + (text) => { + return text.toLowerCase().trimStart().startsWith("---"); + } + ); + if (true) { + registerLazyLoadedDiagrams(detector_default, detector_default3, architectureDetector_default); + } + registerLazyLoadedDiagrams( + c4Detector_default, + detector_default4, + classDetector_V2_default, + classDetector_default, + erDetector_default, + ganttDetector_default, + info, + pie, + requirementDetector_default, + sequenceDetector_default, + flowDetector_v2_default, + flowDetector_default, + detector_default2, + gitGraphDetector_default, + stateDetector_V2_default, + stateDetector_default, + journeyDetector_default, + quadrantDetector_default, + sankeyDetector_default, + packet, + xychartDetector_default, + blockDetector_default, + detector_default6, + detector_default5, + radar, + ishikawa, + treemap, + vennDetector_default, + wardleyDetector_default + ); +}, "addDiagrams"); + +// src/diagram-api/loadDiagram.ts +var loadRegisteredDiagrams = /* @__PURE__ */ __name(async () => { + log.debug(`Loading registered diagrams`); + const results = await Promise.allSettled( + Object.entries(detectors).map(async ([key, { detector: detector33, loader: loader33 }]) => { + if (!loader33) { + return; + } + try { + getDiagram(key); + } catch { + try { + const { diagram: diagram2, id: id33 } = await loader33(); + registerDiagram(id33, diagram2, detector33); + } catch (err) { + log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`); + delete detectors[key]; + throw err; + } + } + }) + ); + const failed = results.filter((result) => result.status === "rejected"); + if (failed.length > 0) { + log.error(`Failed to load ${failed.length} external diagrams`); + for (const res of failed) { + log.error(res); + } + throw new Error(`Failed to load ${failed.length} external diagrams`); + } +}, "loadRegisteredDiagrams"); + +// src/mermaidAPI.ts +import { select } from "d3"; +import { + COMMENT, + compile, + KEYFRAMES, + LAYER, + MEDIA, + middleware, + SCOPE, + serialize, + stringify, + SUPPORTS +} from "stylis"; +import DOMPurify from "dompurify"; +import { isEmpty } from "es-toolkit/compat"; + +// src/accessibility.ts +var SVG_ROLE = "graphics-document document"; +function setA11yDiagramInfo(svg, diagramType) { + svg.attr("role", SVG_ROLE); + if (diagramType !== "") { + svg.attr("aria-roledescription", diagramType); + } +} +__name(setA11yDiagramInfo, "setA11yDiagramInfo"); +function addSVGa11yTitleDescription(svg, a11yTitle, a11yDesc, baseId) { + if (svg.insert === void 0) { + return; + } + if (a11yDesc) { + const descId = `chart-desc-${baseId}`; + svg.attr("aria-describedby", descId); + svg.insert("desc", ":first-child").attr("id", descId).text(a11yDesc); + } + if (a11yTitle) { + const titleId = `chart-title-${baseId}`; + svg.attr("aria-labelledby", titleId); + svg.insert("title", ":first-child").attr("id", titleId).text(a11yTitle); + } +} +__name(addSVGa11yTitleDescription, "addSVGa11yTitleDescription"); + +// src/Diagram.ts +var Diagram = class _Diagram { + constructor(type, text, db, parser, renderer2) { + this.type = type; + this.text = text; + this.db = db; + this.parser = parser; + this.renderer = renderer2; + } + static { + __name(this, "Diagram"); + } + static async fromText(text, metadata = {}) { + const config = getConfig(); + const type = detectType(text, config); + text = encodeEntities(text) + "\n"; + try { + getDiagram(type); + } catch { + const loader33 = getDiagramLoader(type); + if (!loader33) { + throw new UnknownDiagramError(`Diagram ${type} not found.`); + } + const { id: id33, diagram: diagram2 } = await loader33(); + registerDiagram(id33, diagram2); + } + const { db, parser, renderer: renderer2, init: init2 } = getDiagram(type); + if (parser.parser) { + parser.parser.yy = db; + } + db.clear?.(); + init2?.(config); + if (metadata.title) { + db.setDiagramTitle?.(metadata.title); + } + await parser.parse(text); + return new _Diagram(type, text, db, parser, renderer2); + } + async render(id33, version) { + await this.renderer.draw(this.text, id33, version, this); + } + getParser() { + return this.parser; + } + getType() { + return this.type; + } +}; + +// src/interactionDb.ts +var interactionFunctions = []; +var attachFunctions = /* @__PURE__ */ __name(() => { + interactionFunctions.forEach((f) => { + f(); + }); + interactionFunctions = []; +}, "attachFunctions"); + +// src/diagram-api/comments.ts +var cleanupComments = /* @__PURE__ */ __name((text) => { + return text.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart(); +}, "cleanupComments"); + +// src/diagram-api/frontmatter.ts +function extractFrontMatter(text) { + const matches = text.match(frontMatterRegex); + if (!matches) { + return { + text, + metadata: {} + }; + } + let parsed = load(matches[1], { + // To support config, we need JSON schema. + // https://www.yaml.org/spec/1.2/spec.html#id2803231 + schema: JSON_SCHEMA + }) ?? {}; + parsed = typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {}; + const metadata = {}; + if (parsed.displayMode) { + metadata.displayMode = parsed.displayMode.toString(); + } + if (parsed.title) { + metadata.title = parsed.title.toString(); + } + if (parsed.config) { + metadata.config = parsed.config; + } + return { + text: text.slice(matches[0].length), + metadata + }; +} +__name(extractFrontMatter, "extractFrontMatter"); + +// src/preprocess.ts +var cleanupText = /* @__PURE__ */ __name((code) => { + return code.replace(/\r\n?/g, "\n").replace( + /<(\w+)([^>]*)>/g, + (match, tag, attributes) => "<" + tag + attributes.replace(/="([^"]*)"/g, "='$1'") + ">" + ); +}, "cleanupText"); +var processFrontmatter = /* @__PURE__ */ __name((code) => { + const { text, metadata } = extractFrontMatter(code); + const { displayMode, title, config = {} } = metadata; + if (displayMode) { + if (!config.gantt) { + config.gantt = {}; + } + config.gantt.displayMode = displayMode; + } + return { title, config, text }; +}, "processFrontmatter"); +var processDirectives = /* @__PURE__ */ __name((code) => { + const initDirective = utils_default.detectInit(code) ?? {}; + const wrapDirectives = utils_default.detectDirective(code, "wrap"); + if (Array.isArray(wrapDirectives)) { + initDirective.wrap = wrapDirectives.some(({ type }) => type === "wrap"); + } else if (wrapDirectives?.type === "wrap") { + initDirective.wrap = true; + } + return { + text: removeDirectives(code), + directive: initDirective + }; +}, "processDirectives"); +function preprocessDiagram(code) { + const cleanedCode = cleanupText(code); + const frontMatterResult = processFrontmatter(cleanedCode); + const directiveResult = processDirectives(frontMatterResult.text); + const config = cleanAndMerge(frontMatterResult.config, directiveResult.directive); + code = cleanupComments(directiveResult.text); + return { + code, + title: frontMatterResult.title, + config + }; +} +__name(preprocessDiagram, "preprocessDiagram"); + +// src/utils/base64.ts +function toBase64(str) { + const utf8Bytes = new TextEncoder().encode(str); + const utf8Str = Array.from(utf8Bytes, (byte) => String.fromCodePoint(byte)).join(""); + return btoa(utf8Str); +} +__name(toBase64, "toBase64"); + +// src/mermaidAPI.ts +var MAX_TEXTLENGTH = 5e4; +var MAX_TEXTLENGTH_EXCEEDED_MSG = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa"; +var SECURITY_LVL_SANDBOX = "sandbox"; +var SECURITY_LVL_LOOSE = "loose"; +var XMLNS_SVG_STD = "http://www.w3.org/2000/svg"; +var XMLNS_XLINK_STD = "http://www.w3.org/1999/xlink"; +var XMLNS_XHTML_STD = "http://www.w3.org/1999/xhtml"; +var IFRAME_WIDTH = "100%"; +var IFRAME_HEIGHT = "100%"; +var IFRAME_STYLES = "border:0;margin:0;"; +var IFRAME_BODY_STYLE = "margin:0"; +var IFRAME_SANDBOX_OPTS = "allow-top-navigation-by-user-activation allow-popups"; +var IFRAME_NOT_SUPPORTED_MSG = 'The "iframe" tag is not supported by your browser.'; +var DOMPURIFY_TAGS = ["foreignobject"]; +var DOMPURIFY_ATTR = ["dominant-baseline"]; +function processAndSetConfigs(text) { + const processed = preprocessDiagram(text); + reset(); + addDirective(processed.config ?? {}); + return processed; +} +__name(processAndSetConfigs, "processAndSetConfigs"); +async function parse(text, parseOptions) { + addDiagrams(); + try { + const { code, config } = processAndSetConfigs(text); + const diagram2 = await getDiagramFromText(code); + return { diagramType: diagram2.type, config }; + } catch (error) { + if (parseOptions?.suppressErrors) { + return false; + } + throw error; + } +} +__name(parse, "parse"); +var cssImportantStyles = /* @__PURE__ */ __name((cssClass, element, cssClasses = []) => { + const declarationBlock = sanitizeCss(`{ ${cssClasses.join(" !important; ")} !important; }`); + return `.${cssClass} ${element} ${declarationBlock}`; +}, "cssImportantStyles"); +var createCssStyles = /* @__PURE__ */ __name((config, classDefs = /* @__PURE__ */ new Map()) => { + const cssStyles = new CSSStyleSheet(); + if (config.fontFamily !== void 0) { + cssStyles.insertRule( + `:root { --mermaid-font-family: ${config.fontFamily}}`, + cssStyles.cssRules.length + ); + } + if (config.altFontFamily !== void 0) { + cssStyles.insertRule( + `:root { --mermaid-alt-font-family: ${config.altFontFamily}}`, + cssStyles.cssRules.length + ); + } + if (classDefs instanceof Map) { + const htmlLabels = getEffectiveHtmlLabels(config); + const cssHtmlElements = ["> *", "span"]; + const cssShapeElements = ["rect", "polygon", "ellipse", "circle", "path"]; + const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements; + classDefs.forEach((styleClassDef) => { + if (!isEmpty(styleClassDef.styles)) { + cssElements.forEach((cssElement) => { + cssStyles.insertRule( + cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles), + cssStyles.cssRules.length + ); + }); + } + if (!isEmpty(styleClassDef.textStyles)) { + cssStyles.insertRule( + cssImportantStyles( + styleClassDef.id, + "tspan", + (styleClassDef?.textStyles || []).map((s) => s.replace("color", "fill")) + ), + cssStyles.cssRules.length + ); + } + }); + } + let cssString = ""; + if (config.themeCSS !== void 0) { + if (typeof cssStyles.replaceSync === "function") { + const themeCssStyleSheet = new CSSStyleSheet(); + themeCssStyleSheet.replaceSync(config.themeCSS); + cssString = cssStyleSheetToString(themeCssStyleSheet) + "\n"; + } else { + cssString += `${config.themeCSS} +`; + } + } + return cssString + cssStyleSheetToString(cssStyles); +}, "createCssStyles"); +var compileCSS = /* @__PURE__ */ __name((namespace, css) => { + return serialize( + compile(`${namespace}{${css}}`), + middleware([ + /* @__PURE__ */ __name(function addNamespace(element, _index, _children, _callback) { + if (element.type === "rule" && Array.isArray(element.props)) { + if (element.parent && element.parent.type === KEYFRAMES) { + return; + } + element.props = element.props.map((prop) => { + if (!prop.startsWith(namespace)) { + return `${namespace} ${prop}`; + } + return prop; + }); + } else if (element.type.startsWith("@")) { + const nestedAtRules = [ + MEDIA, + SUPPORTS, + LAYER, + SCOPE, + "@container", + "@starting-style" + ]; + const allowedAtRules = [ + ...nestedAtRules, + KEYFRAMES + // needed for Mermaid's animation feature + ]; + if (!allowedAtRules.includes(element.type)) { + log.warn(`Removing unsupported at-rule ${element.type} from CSS`); + element.type = COMMENT; + } + } + }, "addNamespace"), + stringify + ]) + ); +}, "compileCSS"); +var createUserStyles = /* @__PURE__ */ __name((config, graphType, classDefs, svgId) => { + const userCSSstyles = createCssStyles(config, classDefs); + const allStyles = styles_default( + graphType, + userCSSstyles, + { ...config.themeVariables, theme: config.theme, look: config.look }, + svgId + ); + return compileCSS(svgId, allStyles); +}, "createUserStyles"); +var cleanUpSvgCode = /* @__PURE__ */ __name((svgCode = "", inSandboxMode, useArrowMarkerUrls) => { + let cleanedUpSvg = svgCode; + if (!useArrowMarkerUrls && !inSandboxMode) { + cleanedUpSvg = cleanedUpSvg.replace( + /marker-end="url\([\d+./:=?A-Za-z-]*?#/g, + 'marker-end="url(#' + ); + } + cleanedUpSvg = decodeEntities(cleanedUpSvg); + cleanedUpSvg = cleanedUpSvg.replace(/
/g, "
"); + return cleanedUpSvg; +}, "cleanUpSvgCode"); +var putIntoIFrame = /* @__PURE__ */ __name((svgCode = "", svgElement) => { + const height = svgElement?.viewBox?.baseVal?.height ? svgElement.viewBox.baseVal.height + "px" : IFRAME_HEIGHT; + const base64encodedSrc = toBase64(`${svgCode}`); + return ``; +}, "putIntoIFrame"); +var appendDivSvgG = /* @__PURE__ */ __name((parentRoot, id33, enclosingDivId, divStyle, svgXlink) => { + const enclosingDiv = parentRoot.append("div"); + enclosingDiv.attr("id", enclosingDivId); + if (divStyle) { + enclosingDiv.attr("style", divStyle); + } + const svgNode = enclosingDiv.append("svg").attr("id", id33).attr("width", "100%").attr("xmlns", XMLNS_SVG_STD); + if (svgXlink) { + svgNode.attr("xmlns:xlink", svgXlink); + } + svgNode.append("g"); + return parentRoot; +}, "appendDivSvgG"); +function sandboxedIframe(parentNode, iFrameId) { + return parentNode.append("iframe").attr("id", iFrameId).attr("style", "width: 100%; height: 100%;").attr("sandbox", ""); +} +__name(sandboxedIframe, "sandboxedIframe"); +var removeExistingElements = /* @__PURE__ */ __name((doc, id33, divId, iFrameId) => { + doc.getElementById(id33)?.remove(); + doc.getElementById(divId)?.remove(); + doc.getElementById(iFrameId)?.remove(); +}, "removeExistingElements"); +var render = /* @__PURE__ */ __name(async function(id33, text, svgContainingElement) { + addDiagrams(); + const processed = processAndSetConfigs(text); + text = processed.code; + const config = getConfig(); + log.debug(config); + if (text.length > (config?.maxTextSize ?? MAX_TEXTLENGTH)) { + text = MAX_TEXTLENGTH_EXCEEDED_MSG; + } + const idSelector = `#${id33}`; + const iFrameID = "i" + id33; + const iFrameID_selector = "#" + iFrameID; + const enclosingDivID = "d" + id33; + const enclosingDivID_selector = "#" + enclosingDivID; + const removeTempElements = /* @__PURE__ */ __name(() => { + const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector; + const node = select(tmpElementSelector).node(); + if (node && "remove" in node) { + node.remove(); + } + }, "removeTempElements"); + let root = select(document.body); + const isSandboxed = config.securityLevel === SECURITY_LVL_SANDBOX; + const isLooseSecurityLevel = config.securityLevel === SECURITY_LVL_LOOSE; + const fontFamily = config.fontFamily; + if (svgContainingElement !== void 0) { + if (svgContainingElement) { + svgContainingElement.innerHTML = ""; + } + if (isSandboxed) { + const iframe = sandboxedIframe(select(svgContainingElement), iFrameID); + root = select(iframe.nodes()[0].contentDocument.body); + root.node().style.margin = "0"; + } else { + root = select(svgContainingElement); + } + appendDivSvgG(root, id33, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD); + } else { + removeExistingElements(document, id33, enclosingDivID, iFrameID); + if (isSandboxed) { + const iframe = sandboxedIframe(select(document.body), iFrameID); + root = select(iframe.nodes()[0].contentDocument.body); + root.node().style.margin = "0"; + } else { + root = select("body"); + } + appendDivSvgG(root, id33, enclosingDivID); + } + let diag; + let parseEncounteredException; + try { + diag = await Diagram.fromText(text, { title: processed.title }); + } catch (error) { + if (config.suppressErrorRendering) { + removeTempElements(); + throw error; + } + diag = await Diagram.fromText("error"); + parseEncounteredException = error; + } + const element = root.select(enclosingDivID_selector).node(); + const diagramType = diag.type; + const svg = element.firstChild; + const firstChild = svg.firstChild; + const diagramClassDefs = diag.renderer.getClasses?.(text, diag); + const rules = createUserStyles(config, diagramType, diagramClassDefs, idSelector); + const style1 = document.createElement("style"); + style1.innerHTML = rules; + svg.insertBefore(style1, firstChild); + try { + await diag.renderer.draw(text, id33, "11.15.0", diag); + } catch (e) { + if (config.suppressErrorRendering) { + removeTempElements(); + } else { + errorRenderer_default.draw(text, id33, "11.15.0"); + } + throw e; + } + const svgNode = root.select(`${enclosingDivID_selector} svg`); + const a11yTitle = diag.db.getAccTitle?.(); + const a11yDescr = diag.db.getAccDescription?.(); + addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr); + root.select(`[id="${id33}"]`).selectAll("foreignobject > *").attr("xmlns", XMLNS_XHTML_STD); + let svgCode = root.select(enclosingDivID_selector).node().innerHTML; + log.debug("config.arrowMarkerAbsolute", config.arrowMarkerAbsolute); + svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config.arrowMarkerAbsolute)); + if (isSandboxed) { + const svgEl = root.select(enclosingDivID_selector + " svg").node(); + svgCode = putIntoIFrame(svgCode, svgEl); + } else if (!isLooseSecurityLevel) { + svgCode = DOMPurify.sanitize(svgCode, { + ADD_TAGS: DOMPURIFY_TAGS, + ADD_ATTR: DOMPURIFY_ATTR, + HTML_INTEGRATION_POINTS: { foreignobject: true } + }); + } + attachFunctions(); + if (parseEncounteredException) { + throw parseEncounteredException; + } + removeTempElements(); + return { + diagramType, + svg: svgCode, + bindFunctions: diag.db.bindFunctions + }; +}, "render"); +function initialize(userOptions = {}) { + const options = assignWithDepth_default({}, userOptions); + if (options?.fontFamily && !options.themeVariables?.fontFamily) { + if (!options.themeVariables) { + options.themeVariables = {}; + } + options.themeVariables.fontFamily = options.fontFamily; + } + saveConfigFromInitialize(options); + if (options?.theme && options.theme in themes_default) { + options.themeVariables = themes_default[options.theme].getThemeVariables( + options.themeVariables + ); + } else if (options) { + options.themeVariables = themes_default.default.getThemeVariables(options.themeVariables); + } + const config = typeof options === "object" ? setSiteConfig(options) : getSiteConfig(); + setLogLevel(config.logLevel); + addDiagrams(); +} +__name(initialize, "initialize"); +var getDiagramFromText = /* @__PURE__ */ __name((text, metadata = {}) => { + const { code } = preprocessDiagram(text); + return Diagram.fromText(code, metadata); +}, "getDiagramFromText"); +function addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr) { + setA11yDiagramInfo(svgNode, diagramType); + addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr("id")); +} +__name(addA11yInfo, "addA11yInfo"); +var mermaidAPI = Object.freeze({ + render, + parse, + getDiagramFromText, + initialize, + getConfig, + setConfig, + getSiteConfig, + updateSiteConfig, + reset: /* @__PURE__ */ __name(() => { + reset(); + }, "reset"), + globalReset: /* @__PURE__ */ __name(() => { + reset(defaultConfig); + }, "globalReset"), + defaultConfig +}); +setLogLevel(getConfig().logLevel); +reset(getConfig()); + +// src/mermaid.ts +var handleError = /* @__PURE__ */ __name((error, errors, parseError) => { + log.warn(error); + if (isDetailedError(error)) { + if (parseError) { + parseError(error.str, error.hash); + } + errors.push({ ...error, message: error.str, error }); + } else { + if (parseError) { + parseError(error); + } + if (error instanceof Error) { + errors.push({ + str: error.message, + message: error.message, + hash: error.name, + error + }); + } + } +}, "handleError"); +var run = /* @__PURE__ */ __name(async function(options = { + querySelector: ".mermaid" +}) { + try { + await runThrowsErrors(options); + } catch (e) { + if (isDetailedError(e)) { + log.error(e.str); + } + if (mermaid.parseError) { + mermaid.parseError(e); + } + if (!options.suppressErrors) { + log.error("Use the suppressErrors option to suppress these errors"); + throw e; + } + } +}, "run"); +var runThrowsErrors = /* @__PURE__ */ __name(async function({ postRenderCallback, querySelector, nodes } = { + querySelector: ".mermaid" +}) { + const conf = mermaidAPI.getConfig(); + log.debug(`${!postRenderCallback ? "No " : ""}Callback function found`); + let nodesToProcess; + if (nodes) { + nodesToProcess = nodes; + } else if (querySelector) { + nodesToProcess = document.querySelectorAll(querySelector); + } else { + throw new Error("Nodes and querySelector are both undefined"); + } + log.debug(`Found ${nodesToProcess.length} diagrams`); + if (conf?.startOnLoad !== void 0) { + log.debug("Start On Load: " + conf?.startOnLoad); + mermaidAPI.updateSiteConfig({ startOnLoad: conf?.startOnLoad }); + } + const idGenerator = new utils_default.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed); + let txt; + const errors = []; + for (const element of Array.from(nodesToProcess)) { + log.info("Rendering diagram: " + element.id); + if (element.getAttribute("data-processed")) { + continue; + } + element.setAttribute("data-processed", "true"); + const id33 = `mermaid-${idGenerator.next()}`; + txt = element.innerHTML; + txt = dedent(utils_default.entityDecode(txt)).trim().replace(//gi, "
"); + const init2 = utils_default.detectInit(txt); + if (init2) { + log.debug("Detected early reinit: ", init2); + } + try { + const { svg, bindFunctions } = await render2(id33, txt, element); + element.innerHTML = svg; + if (postRenderCallback) { + await postRenderCallback(id33); + } + if (bindFunctions) { + bindFunctions(element); + } + } catch (error) { + handleError(error, errors, mermaid.parseError); + } + } + if (errors.length > 0) { + throw errors[0]; + } +}, "runThrowsErrors"); +var initialize2 = /* @__PURE__ */ __name(function(config) { + mermaidAPI.initialize(config); +}, "initialize"); +var init = /* @__PURE__ */ __name(async function(config, nodes, callback) { + log.warn("mermaid.init is deprecated. Please use run instead."); + if (config) { + initialize2(config); + } + const runOptions = { postRenderCallback: callback, querySelector: ".mermaid" }; + if (typeof nodes === "string") { + runOptions.querySelector = nodes; + } else if (nodes) { + if (nodes instanceof HTMLElement) { + runOptions.nodes = [nodes]; + } else { + runOptions.nodes = nodes; + } + } + await run(runOptions); +}, "init"); +var registerExternalDiagrams = /* @__PURE__ */ __name(async (diagrams, { + lazyLoad = true +} = {}) => { + addDiagrams(); + registerLazyLoadedDiagrams(...diagrams); + if (lazyLoad === false) { + await loadRegisteredDiagrams(); + } +}, "registerExternalDiagrams"); +var contentLoaded = /* @__PURE__ */ __name(function() { + if (mermaid.startOnLoad) { + const { startOnLoad } = mermaidAPI.getConfig(); + if (startOnLoad) { + mermaid.run().catch((err) => log.error("Mermaid failed to initialize", err)); + } + } +}, "contentLoaded"); +if (typeof document !== "undefined") { + window.addEventListener("load", contentLoaded, false); +} +var setParseErrorHandler = /* @__PURE__ */ __name(function(parseErrorHandler) { + mermaid.parseError = parseErrorHandler; +}, "setParseErrorHandler"); +var executionQueue = []; +var executionQueueRunning = false; +var executeQueue = /* @__PURE__ */ __name(async () => { + if (executionQueueRunning) { + return; + } + executionQueueRunning = true; + while (executionQueue.length > 0) { + const f = executionQueue.shift(); + if (f) { + try { + await f(); + } catch (e) { + log.error("Error executing queue", e); + } + } + } + executionQueueRunning = false; +}, "executeQueue"); +var parse2 = /* @__PURE__ */ __name(async (text, parseOptions) => { + return new Promise((resolve, reject) => { + const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => { + mermaidAPI.parse(text, parseOptions).then( + (r) => { + res(r); + resolve(r); + }, + (e) => { + log.error("Error parsing", e); + mermaid.parseError?.(e); + rej(e); + reject(e); + } + ); + }), "performCall"); + executionQueue.push(performCall); + executeQueue().catch(reject); + }); +}, "parse"); +var render2 = /* @__PURE__ */ __name((id33, text, container) => { + return new Promise((resolve, reject) => { + const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => { + mermaidAPI.render(id33, text, container).then( + (r) => { + res(r); + resolve(r); + }, + (e) => { + log.error("Error parsing", e); + mermaid.parseError?.(e); + rej(e); + reject(e); + } + ); + }), "performCall"); + executionQueue.push(performCall); + executeQueue().catch(reject); + }); +}, "render"); +var getRegisteredDiagramsMetadata = /* @__PURE__ */ __name(() => { + return Object.keys(detectors).map((id33) => ({ + id: id33 + })); +}, "getRegisteredDiagramsMetadata"); +var mermaid = { + startOnLoad: true, + mermaidAPI, + parse: parse2, + render: render2, + init, + run, + registerExternalDiagrams, + registerLayoutLoaders, + initialize: initialize2, + parseError: void 0, + contentLoaded, + setParseErrorHandler, + detectType, + registerIconPacks, + getRegisteredDiagramsMetadata +}; +var mermaid_default = mermaid; +export { + mermaid_default as default +}; +/*! Check if previously processed */ +/*! + * Wait for document loaded before starting the execution + */ diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.core.mjs.map b/tools/ui/node_modules/mermaid/dist/mermaid.core.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..9c251c12b861f04392878cdba72d30a3cabfd7c6 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.core.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/mermaid.ts", "../src/diagrams/c4/c4Detector.ts", "../src/diagrams/flowchart/flowDetector.ts", "../src/diagrams/flowchart/flowDetector-v2.ts", "../src/diagrams/er/erDetector.ts", "../src/diagrams/git/gitGraphDetector.ts", "../src/diagrams/gantt/ganttDetector.ts", "../src/diagrams/info/infoDetector.ts", "../src/diagrams/pie/pieDetector.ts", "../src/diagrams/quadrant-chart/quadrantDetector.ts", "../src/diagrams/xychart/xychartDetector.ts", "../src/diagrams/requirement/requirementDetector.ts", "../src/diagrams/sequence/sequenceDetector.ts", "../src/diagrams/class/classDetector.ts", "../src/diagrams/class/classDetector-V2.ts", "../src/diagrams/state/stateDetector.ts", "../src/diagrams/state/stateDetector-V2.ts", "../src/diagrams/user-journey/journeyDetector.ts", "../src/diagrams/error/errorRenderer.ts", "../src/diagrams/error/errorDiagram.ts", "../src/diagrams/flowchart/elk/detector.ts", "../src/diagrams/timeline/detector.ts", "../src/diagrams/mindmap/detector.ts", "../src/diagrams/kanban/detector.ts", "../src/diagrams/sankey/sankeyDetector.ts", "../src/diagrams/packet/detector.ts", "../src/diagrams/radar/detector.ts", "../src/diagrams/block/blockDetector.ts", "../src/diagrams/treeView/detector.ts", "../src/diagrams/architecture/architectureDetector.ts", "../src/diagrams/eventmodeling/detector.ts", "../src/diagrams/ishikawa/ishikawaDetector.ts", "../src/diagrams/venn/vennDetector.ts", "../src/diagrams/treemap/detector.ts", "../src/diagrams/wardley/wardleyDetector.ts", "../src/diagram-api/diagram-orchestration.ts", "../src/diagram-api/loadDiagram.ts", "../src/mermaidAPI.ts", "../src/accessibility.ts", "../src/Diagram.ts", "../src/interactionDb.ts", "../src/diagram-api/comments.ts", "../src/diagram-api/frontmatter.ts", "../src/preprocess.ts", "../src/utils/base64.ts"], + "sourcesContent": ["/**\n * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid\n * functionality and to render the diagrams to svg code!\n */\nimport type { AsyncIconLoader, IconLoader, SyncIconLoader } from './rendering-util/icons.js';\nimport { registerIconPacks } from './rendering-util/icons.js';\nimport { dedent } from 'ts-dedent';\nimport type { MermaidConfig } from './config.type.js';\nimport { detectType, detectors, registerLazyLoadedDiagrams } from './diagram-api/detectType.js';\nimport { addDiagrams } from './diagram-api/diagram-orchestration.js';\nimport { loadRegisteredDiagrams } from './diagram-api/loadDiagram.js';\nimport type { ExternalDiagramDefinition, SVG, SVGGroup } from './diagram-api/types.js';\nimport type { ParseErrorFunction } from './Diagram.js';\nimport type { UnknownDiagramError } from './errors.js';\nimport type { InternalHelpers } from './internals.js';\nimport { log } from './logger.js';\nimport { mermaidAPI } from './mermaidAPI.js';\nimport type { LayoutLoaderDefinition, RenderOptions } from './rendering-util/render.js';\nimport { registerLayoutLoaders } from './rendering-util/render.js';\nimport type { LayoutData } from './rendering-util/types.js';\nimport type { ParseOptions, ParseResult, RenderResult } from './types.js';\nimport type { DetailedError } from './utils.js';\nimport utils, { isDetailedError } from './utils.js';\n\nexport type {\n AsyncIconLoader,\n DetailedError,\n ExternalDiagramDefinition,\n IconLoader,\n InternalHelpers,\n LayoutData,\n LayoutLoaderDefinition,\n MermaidConfig,\n ParseErrorFunction,\n ParseOptions,\n ParseResult,\n RenderOptions,\n RenderResult,\n SVG,\n SVGGroup,\n SyncIconLoader,\n UnknownDiagramError,\n};\n\nexport interface RunOptions {\n /**\n * The query selector to use when finding elements to render. Default: `\".mermaid\"`.\n */\n querySelector?: string;\n /**\n * The nodes to render. If this is set, `querySelector` will be ignored.\n */\n nodes?: ArrayLike;\n /**\n * A callback to call after each diagram is rendered.\n */\n postRenderCallback?: (id: string) => unknown;\n /**\n * If `true`, errors will be logged to the console, but not thrown. Default: `false`\n */\n suppressErrors?: boolean;\n}\n\nconst handleError = (error: unknown, errors: DetailedError[], parseError?: ParseErrorFunction) => {\n log.warn(error);\n if (isDetailedError(error)) {\n // handle case where error string and hash were\n // wrapped in object like`const error = { str, hash };`\n if (parseError) {\n parseError(error.str, error.hash);\n }\n errors.push({ ...error, message: error.str, error });\n } else {\n // assume it is just error string and pass it on\n if (parseError) {\n parseError(error);\n }\n if (error instanceof Error) {\n errors.push({\n str: error.message,\n message: error.message,\n hash: error.name,\n error,\n });\n }\n }\n};\n\n/**\n * ## run\n *\n * Function that goes through the document to find the chart definitions in there and render them.\n *\n * The function tags the processed attributes with the attribute data-processed and ignores found\n * elements with the attribute already set. This way the init function can be triggered several\n * times.\n *\n * ```mermaid\n * graph LR;\n * a(Find elements)-->b{Processed}\n * b-->|Yes|c(Leave element)\n * b-->|No |d(Transform)\n * ```\n *\n * Renders the mermaid diagrams\n *\n * @param options - Optional runtime configs\n */\nconst run = async function (\n options: RunOptions = {\n querySelector: '.mermaid',\n }\n) {\n try {\n await runThrowsErrors(options);\n } catch (e) {\n if (isDetailedError(e)) {\n log.error(e.str);\n }\n if (mermaid.parseError) {\n mermaid.parseError(e as string);\n }\n if (!options.suppressErrors) {\n log.error('Use the suppressErrors option to suppress these errors');\n throw e;\n }\n }\n};\n\nconst runThrowsErrors = async function (\n { postRenderCallback, querySelector, nodes }: Omit = {\n querySelector: '.mermaid',\n }\n) {\n const conf = mermaidAPI.getConfig();\n\n log.debug(`${!postRenderCallback ? 'No ' : ''}Callback function found`);\n\n let nodesToProcess: ArrayLike;\n if (nodes) {\n nodesToProcess = nodes;\n } else if (querySelector) {\n nodesToProcess = document.querySelectorAll(querySelector);\n } else {\n throw new Error('Nodes and querySelector are both undefined');\n }\n\n log.debug(`Found ${nodesToProcess.length} diagrams`);\n if (conf?.startOnLoad !== undefined) {\n log.debug('Start On Load: ' + conf?.startOnLoad);\n mermaidAPI.updateSiteConfig({ startOnLoad: conf?.startOnLoad });\n }\n\n // generate the id of the diagram\n const idGenerator = new utils.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed);\n\n let txt: string;\n const errors: DetailedError[] = [];\n\n // element is the current div with mermaid class\n // eslint-disable-next-line unicorn/prefer-spread\n for (const element of Array.from(nodesToProcess)) {\n log.info('Rendering diagram: ' + element.id);\n /*! Check if previously processed */\n if (element.getAttribute('data-processed')) {\n continue;\n }\n element.setAttribute('data-processed', 'true');\n\n const id = `mermaid-${idGenerator.next()}`;\n\n // Fetch the graph definition including tags\n txt = element.innerHTML;\n\n // transforms the html to pure text\n txt = dedent(utils.entityDecode(txt)) // removes indentation, required for YAML parsing\n .trim()\n .replace(//gi, '
');\n\n const init = utils.detectInit(txt);\n if (init) {\n log.debug('Detected early reinit: ', init);\n }\n try {\n const { svg, bindFunctions } = await render(id, txt, element);\n element.innerHTML = svg;\n if (postRenderCallback) {\n await postRenderCallback(id);\n }\n if (bindFunctions) {\n bindFunctions(element);\n }\n } catch (error) {\n handleError(error, errors, mermaid.parseError);\n }\n }\n if (errors.length > 0) {\n // TODO: We should be throwing an error object.\n throw errors[0];\n }\n};\n\n/**\n * Used to set configurations for mermaid.\n * This function should be called before the run function.\n * @param config - Configuration object for mermaid.\n */\n\nconst initialize = function (config: MermaidConfig) {\n mermaidAPI.initialize(config);\n};\n\n/**\n * ## init\n *\n * @deprecated Use {@link initialize} and {@link run} instead.\n *\n * Renders the mermaid diagrams\n *\n * @param config - **Deprecated**, please set configuration in {@link initialize}.\n * @param nodes - **Default**: `.mermaid`. One of the following:\n * - A DOM Node\n * - An array of DOM nodes (as would come from a jQuery selector)\n * - A W3C selector, a la `.mermaid`\n * @param callback - Called once for each rendered diagram's id.\n */\nconst init = async function (\n config?: MermaidConfig,\n nodes?: string | HTMLElement | NodeListOf,\n callback?: (id: string) => unknown\n) {\n log.warn('mermaid.init is deprecated. Please use run instead.');\n if (config) {\n initialize(config);\n }\n const runOptions: RunOptions = { postRenderCallback: callback, querySelector: '.mermaid' };\n if (typeof nodes === 'string') {\n runOptions.querySelector = nodes;\n } else if (nodes) {\n if (nodes instanceof HTMLElement) {\n runOptions.nodes = [nodes];\n } else {\n runOptions.nodes = nodes;\n }\n }\n await run(runOptions);\n};\n\n/**\n * Used to register external diagram types.\n * @param diagrams - Array of {@link ExternalDiagramDefinition}.\n * @param opts - If opts.lazyLoad is false, the diagrams will be loaded immediately.\n */\nconst registerExternalDiagrams = async (\n diagrams: ExternalDiagramDefinition[],\n {\n lazyLoad = true,\n }: {\n lazyLoad?: boolean;\n } = {}\n) => {\n addDiagrams();\n registerLazyLoadedDiagrams(...diagrams);\n if (lazyLoad === false) {\n await loadRegisteredDiagrams();\n }\n};\n\n/**\n * ##contentLoaded Callback function that is called when page is loaded. This functions fetches\n * configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the\n * page.\n */\nconst contentLoaded = function () {\n if (mermaid.startOnLoad) {\n const { startOnLoad } = mermaidAPI.getConfig();\n if (startOnLoad) {\n mermaid.run().catch((err) => log.error('Mermaid failed to initialize', err));\n }\n }\n};\n\nif (typeof document !== 'undefined') {\n /*!\n * Wait for document loaded before starting the execution\n */\n window.addEventListener('load', contentLoaded, false);\n}\n\n/**\n * ## setParseErrorHandler Alternative to directly setting parseError using:\n *\n * ```js\n * mermaid.parseError = function(err,hash) {\n * forExampleDisplayErrorInGui(err); // do something with the error\n * };\n * ```\n *\n * This is provided for environments where the mermaid object can't directly have a new member added\n * to it (eg. dart interop wrapper). (Initially there is no parseError member of mermaid).\n *\n * @param parseErrorHandler - New parseError() callback.\n */\nconst setParseErrorHandler = function (parseErrorHandler: (err: any, hash: any) => void) {\n mermaid.parseError = parseErrorHandler;\n};\n\nconst executionQueue: (() => Promise)[] = [];\nlet executionQueueRunning = false;\nconst executeQueue = async () => {\n if (executionQueueRunning) {\n return;\n }\n executionQueueRunning = true;\n while (executionQueue.length > 0) {\n const f = executionQueue.shift();\n if (f) {\n try {\n await f();\n } catch (e) {\n log.error('Error executing queue', e);\n }\n }\n }\n executionQueueRunning = false;\n};\n\n/**\n * Parse the text and validate the syntax.\n * @param text - The mermaid diagram definition.\n * @param parseOptions - Options for parsing. @see {@link ParseOptions}\n * @returns If valid, {@link ParseResult} otherwise `false` if parseOptions.suppressErrors is `true`.\n * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.\n *\n * @example\n * ```js\n * console.log(await mermaid.parse('flowchart \\n a --> b'));\n * // { diagramType: 'flowchart-v2' }\n * console.log(await mermaid.parse('wrong \\n a --> b', { suppressErrors: true }));\n * // false\n * console.log(await mermaid.parse('wrong \\n a --> b', { suppressErrors: false }));\n * // throws Error\n * console.log(await mermaid.parse('wrong \\n a --> b'));\n * // throws Error\n * ```\n */\nconst parse: typeof mermaidAPI.parse = async (text, parseOptions) => {\n return new Promise((resolve, reject) => {\n // This promise will resolve when the render call is done.\n // It will be queued first and will be executed when it is first in line\n const performCall = () =>\n new Promise((res, rej) => {\n mermaidAPI.parse(text, parseOptions).then(\n (r) => {\n // This resolves for the promise for the queue handling\n res(r);\n // This fulfills the promise sent to the value back to the original caller\n resolve(r);\n },\n (e) => {\n log.error('Error parsing', e);\n mermaid.parseError?.(e);\n rej(e);\n reject(e);\n }\n );\n });\n executionQueue.push(performCall);\n executeQueue().catch(reject);\n });\n};\n\n/**\n * Function that renders an SVG with a graph from a chart definition. Usage example below.\n *\n * ```javascript\n * element = document.querySelector('#graphDiv');\n * const graphDefinition = 'graph TB\\na-->b';\n * const { svg, bindFunctions } = await mermaid.render('graphDiv', graphDefinition);\n * element.innerHTML = svg;\n * bindFunctions?.(element);\n * ```\n *\n * @remarks\n * Multiple calls to this function will be enqueued to run serially.\n *\n * @param id - The id for the SVG element (the element to be rendered)\n * @param text - The text for the graph definition\n * @param container - HTML element where the svg will be inserted. (Is usually element with the .mermaid class)\n * If no svgContainingElement is provided then the SVG element will be appended to the body.\n * Selector to element in which a div with the graph temporarily will be\n * inserted. If one is provided a hidden div will be inserted in the body of the page instead. The\n * element will be removed when rendering is completed.\n * @returns Returns the SVG Definition and BindFunctions.\n */\nconst render: typeof mermaidAPI.render = (id, text, container) => {\n return new Promise((resolve, reject) => {\n // This promise will resolve when the mermaidAPI.render call is done.\n // It will be queued first and will be executed when it is first in line\n const performCall = () =>\n new Promise((res, rej) => {\n mermaidAPI.render(id, text, container).then(\n (r) => {\n // This resolves for the promise for the queue handling\n res(r);\n // This fulfills the promise sent to the value back to the original caller\n resolve(r);\n },\n (e) => {\n log.error('Error parsing', e);\n mermaid.parseError?.(e);\n rej(e);\n reject(e);\n }\n );\n });\n executionQueue.push(performCall);\n executeQueue().catch(reject);\n });\n};\n\n/**\n * Gets the metadata for all registered diagrams.\n * Currently only the id is returned.\n * @returns An array of objects with the id of the diagram.\n */\nconst getRegisteredDiagramsMetadata = (): Pick[] => {\n return Object.keys(detectors).map((id) => ({\n id,\n }));\n};\n\nexport interface Mermaid {\n startOnLoad: boolean;\n parseError?: ParseErrorFunction;\n /**\n * @deprecated Use {@link parse} and {@link render} instead. Please [open a discussion](https://github.com/mermaid-js/mermaid/discussions) if your use case does not fit the new API.\n * @internal\n */\n mermaidAPI: typeof mermaidAPI;\n parse: typeof parse;\n render: typeof render;\n /**\n * @deprecated Use {@link initialize} and {@link run} instead.\n */\n init: typeof init;\n run: typeof run;\n registerLayoutLoaders: typeof registerLayoutLoaders;\n registerExternalDiagrams: typeof registerExternalDiagrams;\n initialize: typeof initialize;\n contentLoaded: typeof contentLoaded;\n setParseErrorHandler: typeof setParseErrorHandler;\n detectType: typeof detectType;\n registerIconPacks: typeof registerIconPacks;\n getRegisteredDiagramsMetadata: typeof getRegisteredDiagramsMetadata;\n}\n\nconst mermaid: Mermaid = {\n startOnLoad: true,\n mermaidAPI,\n parse,\n render,\n init,\n run,\n registerExternalDiagrams,\n registerLayoutLoaders,\n initialize,\n parseError: undefined,\n contentLoaded,\n setParseErrorHandler,\n detectType,\n registerIconPacks,\n getRegisteredDiagramsMetadata,\n};\n\nexport default mermaid;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'c4';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./c4Diagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'flowchart';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have conferred to only use new flow charts this function should always return false\n // as in not signalling true for a legacy flowchart\n if (\n config?.flowchart?.defaultRenderer === 'dagre-wrapper' ||\n config?.flowchart?.defaultRenderer === 'elk'\n ) {\n return false;\n }\n return /^\\s*graph/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./flowDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'flowchart-v2';\n\nconst detector: DiagramDetector = (txt, config) => {\n if (config?.flowchart?.defaultRenderer === 'dagre-d3') {\n return false;\n }\n\n if (config?.flowchart?.defaultRenderer === 'elk') {\n config.layout = 'elk';\n }\n\n // If we have configured to use dagre-wrapper then we should return true in this function for graph code thus making it use the new flowchart diagram\n if (/^\\s*graph/.test(txt) && config?.flowchart?.defaultRenderer === 'dagre-wrapper') {\n return true;\n }\n return /^\\s*flowchart/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./flowDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'er';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*erDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./erDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { DiagramDetector, DiagramLoader } from '../../diagram-api/types.js';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'gitGraph';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*gitGraph/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./gitGraphDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'gantt';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*gantt/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./ganttDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'info';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*info/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./infoDiagram.js');\n return { id, diagram };\n};\n\nexport const info: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'pie';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*pie/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./pieDiagram.js');\n return { id, diagram };\n};\n\nexport const pie: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'quadrantChart';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*quadrantChart/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./quadrantDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'xychart';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*xychart(-beta)?/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./xychartDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'requirement';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*requirement(Diagram)?/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./requirementDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'sequence';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*sequenceDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./sequenceDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'class';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have configured to use dagre-wrapper then we should never return true in this function\n if (config?.class?.defaultRenderer === 'dagre-wrapper') {\n return false;\n }\n // We have not opted to use the new renderer so we should return true if we detect a class diagram\n return /^\\s*classDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./classDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'classDiagram';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have configured to use dagre-wrapper then we should return true in this function for classDiagram code thus making it use the new class diagram\n if (/^\\s*classDiagram/.test(txt) && config?.class?.defaultRenderer === 'dagre-wrapper') {\n return true;\n }\n // We have not opted to use the new renderer so we should return true if we detect a class diagram\n return /^\\s*classDiagram-v2/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./classDiagram-v2.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'state';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have confirmed to only use new state diagrams this function should always return false\n // as in not signalling true for a legacy state diagram\n if (config?.state?.defaultRenderer === 'dagre-wrapper') {\n return false;\n }\n return /^\\s*stateDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./stateDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'stateDiagram';\n\nconst detector: DiagramDetector = (txt, config) => {\n if (/^\\s*stateDiagram-v2/.test(txt)) {\n return true;\n }\n if (/^\\s*stateDiagram/.test(txt) && config?.state?.defaultRenderer === 'dagre-wrapper') {\n return true;\n }\n return false;\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./stateDiagram-v2.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'journey';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*journey/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./journeyDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { SVG, SVGGroup } from '../../diagram-api/types.js';\nimport { log } from '../../logger.js';\nimport { selectSvgElement } from '../../rendering-util/selectSvgElement.js';\nimport { configureSvgSize } from '../../setupGraphViewbox.js';\n\n/**\n * Draws an info picture in the tag with id: id based on the graph definition in text.\n *\n * @param _text - Mermaid graph definition.\n * @param id - The text for the error\n * @param version - The version\n */\nexport const draw = (_text: string, id: string, version: string) => {\n log.debug('rendering svg for syntax error\\n');\n const svg: SVG = selectSvgElement(id);\n const g: SVGGroup = svg.append('g');\n\n svg.attr('viewBox', '0 0 2412 512');\n configureSvgSize(svg, 100, 512, true);\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z'\n );\n\n g.append('text') // text label for the x axis\n .attr('class', 'error-text')\n .attr('x', 1440)\n .attr('y', 250)\n .attr('font-size', '150px')\n .style('text-anchor', 'middle')\n .text('Syntax error in text');\n g.append('text') // text label for the x axis\n .attr('class', 'error-text')\n .attr('x', 1250)\n .attr('y', 400)\n .attr('font-size', '100px')\n .style('text-anchor', 'middle')\n .text(`mermaid version ${version}`);\n};\n\nexport const renderer = { draw };\n\nexport default renderer;\n", "import type { DiagramDefinition } from '../../diagram-api/types.js';\nimport { renderer } from './errorRenderer.js';\n\nconst diagram: DiagramDefinition = {\n db: {},\n renderer,\n parser: {\n parse: (): void => {\n return;\n },\n },\n};\n\nexport default diagram;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../../diagram-api/types.js';\n\nconst id = 'flowchart-elk';\n\nconst detector: DiagramDetector = (txt, config = {}): boolean => {\n if (\n // If diagram explicitly states flowchart-elk\n /^\\s*flowchart-elk/.test(txt) ||\n // If a flowchart/graph diagram has their default renderer set to elk\n (/^\\s*(flowchart|graph)/.test(txt) && config?.flowchart?.defaultRenderer === 'elk')\n ) {\n config.layout = 'elk';\n return true;\n }\n return false;\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('../flowDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'timeline';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*timeline/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./timeline-definition.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\nconst id = 'mindmap';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*mindmap/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./mindmap-definition.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\nconst id = 'kanban';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*kanban/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./kanban-definition.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'sankey';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*sankey(-beta)?/.test(txt);\n};\n\nconst loader = async () => {\n const { diagram } = await import('./sankeyDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'packet';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*packet(-beta)?/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nexport const packet: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'radar';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*radar-beta/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nexport const radar: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'block';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*block(-beta)?/.test(txt);\n};\n\nconst loader = async () => {\n const { diagram } = await import('./blockDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { DiagramDetector, DiagramLoader } from '../../diagram-api/types.js';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'treeView';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*treeView-beta/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'architecture';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*architecture/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./architectureDiagram.js');\n return { id, diagram };\n};\n\nconst architecture: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default architecture;\n", "import type { DiagramDetector, DiagramLoader } from '../../diagram-api/types.js';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'eventmodeling';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*eventmodeling/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'ishikawa';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*ishikawa(-beta)?\\b/i.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./ishikawaDiagram.js');\n return { id, diagram };\n};\n\nexport const ishikawa: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'venn';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*venn-beta/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./vennDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'treemap';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*treemap/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nexport const treemap: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'wardley-beta';\n\nconst detector: DiagramDetector = (text) => {\n return /^\\s*wardley-beta/i.test(text);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./wardleyDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import c4 from '../diagrams/c4/c4Detector.js';\nimport flowchart from '../diagrams/flowchart/flowDetector.js';\nimport flowchartV2 from '../diagrams/flowchart/flowDetector-v2.js';\nimport er from '../diagrams/er/erDetector.js';\nimport git from '../diagrams/git/gitGraphDetector.js';\nimport gantt from '../diagrams/gantt/ganttDetector.js';\nimport { info } from '../diagrams/info/infoDetector.js';\nimport { pie } from '../diagrams/pie/pieDetector.js';\nimport quadrantChart from '../diagrams/quadrant-chart/quadrantDetector.js';\nimport xychart from '../diagrams/xychart/xychartDetector.js';\nimport requirement from '../diagrams/requirement/requirementDetector.js';\nimport sequence from '../diagrams/sequence/sequenceDetector.js';\nimport classDiagram from '../diagrams/class/classDetector.js';\nimport classDiagramV2 from '../diagrams/class/classDetector-V2.js';\nimport state from '../diagrams/state/stateDetector.js';\nimport stateV2 from '../diagrams/state/stateDetector-V2.js';\nimport journey from '../diagrams/user-journey/journeyDetector.js';\nimport errorDiagram from '../diagrams/error/errorDiagram.js';\nimport flowchartElk from '../diagrams/flowchart/elk/detector.js';\nimport timeline from '../diagrams/timeline/detector.js';\nimport mindmap from '../diagrams/mindmap/detector.js';\nimport kanban from '../diagrams/kanban/detector.js';\nimport sankey from '../diagrams/sankey/sankeyDetector.js';\nimport { packet } from '../diagrams/packet/detector.js';\nimport { radar } from '../diagrams/radar/detector.js';\nimport block from '../diagrams/block/blockDetector.js';\nimport treeView from '../diagrams/treeView/detector.js';\nimport architecture from '../diagrams/architecture/architectureDetector.js';\nimport eventmodeling from '../diagrams/eventmodeling/detector.js';\nimport { ishikawa } from '../diagrams/ishikawa/ishikawaDetector.js';\nimport venn from '../diagrams/venn/vennDetector.js';\nimport { registerLazyLoadedDiagrams } from './detectType.js';\nimport { registerDiagram } from './diagramAPI.js';\nimport { treemap } from '../diagrams/treemap/detector.js';\nimport wardley from '../diagrams/wardley/wardleyDetector.js';\nimport '../type.d.ts';\n\nlet hasLoadedDiagrams = false;\nexport const addDiagrams = () => {\n if (hasLoadedDiagrams) {\n return;\n }\n // This is added here to avoid race-conditions.\n // We could optimize the loading logic somehow.\n hasLoadedDiagrams = true;\n registerDiagram('error', errorDiagram, (text) => {\n return text.toLowerCase().trim() === 'error';\n });\n registerDiagram(\n '---',\n // --- diagram type may appear if YAML front-matter is not parsed correctly\n {\n db: {\n clear: () => {\n // Quite ok, clear needs to be there for --- to work as a regular diagram\n },\n },\n styles: {}, // should never be used\n renderer: {\n draw: () => {\n // should never be used\n },\n },\n parser: {\n parse: () => {\n throw new Error(\n 'Diagrams beginning with --- are not valid. ' +\n 'If you were trying to use a YAML front-matter, please ensure that ' +\n \"you've correctly opened and closed the YAML front-matter with un-indented `---` blocks\"\n );\n },\n },\n init: () => null, // no op\n },\n (text) => {\n return text.toLowerCase().trimStart().startsWith('---');\n }\n );\n\n if (injected.includeLargeFeatures) {\n registerLazyLoadedDiagrams(flowchartElk, mindmap, architecture);\n }\n\n // Ordering of detectors is important. The first one to return true will be used.\n registerLazyLoadedDiagrams(\n c4,\n kanban,\n classDiagramV2,\n classDiagram,\n er,\n gantt,\n info,\n pie,\n requirement,\n sequence,\n flowchartV2,\n flowchart,\n timeline,\n git,\n stateV2,\n state,\n journey,\n quadrantChart,\n sankey,\n packet,\n xychart,\n block,\n eventmodeling,\n treeView,\n radar,\n ishikawa,\n treemap,\n venn,\n wardley\n );\n};\n", "import { log } from '../logger.js';\nimport { detectors } from './detectType.js';\nimport { getDiagram, registerDiagram } from './diagramAPI.js';\n\nexport const loadRegisteredDiagrams = async () => {\n log.debug(`Loading registered diagrams`);\n // Load all lazy loaded diagrams in parallel\n const results = await Promise.allSettled(\n Object.entries(detectors).map(async ([key, { detector, loader }]) => {\n if (!loader) {\n return;\n }\n try {\n getDiagram(key);\n } catch {\n try {\n // Register diagram if it is not already registered\n const { diagram, id } = await loader();\n registerDiagram(id, diagram, detector);\n } catch (err) {\n // Remove failed diagram from detectors\n log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);\n delete detectors[key];\n throw err;\n }\n }\n })\n );\n const failed = results.filter((result) => result.status === 'rejected');\n if (failed.length > 0) {\n log.error(`Failed to load ${failed.length} external diagrams`);\n for (const res of failed) {\n log.error(res);\n }\n throw new Error(`Failed to load ${failed.length} external diagrams`);\n }\n};\n", "/**\n * This file contains functions that are used internally by mermaid\n * and is not intended to be used by the end user.\n */\n// @ts-ignore TODO: Investigate D3 issue\nimport { select } from 'd3';\nimport {\n COMMENT,\n compile,\n KEYFRAMES,\n LAYER,\n MEDIA,\n middleware,\n SCOPE,\n serialize,\n stringify,\n SUPPORTS,\n} from 'stylis';\nimport DOMPurify from 'dompurify';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { addSVGa11yTitleDescription, setA11yDiagramInfo } from './accessibility.js';\nimport assignWithDepth from './assignWithDepth.js';\nimport * as configApi from './config.js';\nimport { getEffectiveHtmlLabels } from './config.js';\nimport type { MermaidConfig } from './config.type.js';\nimport { addDiagrams } from './diagram-api/diagram-orchestration.js';\nimport type { DiagramMetadata, DiagramStyleClassDef } from './diagram-api/types.js';\nimport { Diagram } from './Diagram.js';\nimport { evaluate } from './diagrams/common/common.js';\nimport errorRenderer from './diagrams/error/errorRenderer.js';\nimport { attachFunctions } from './interactionDb.js';\nimport { log, setLogLevel } from './logger.js';\nimport { preprocessDiagram } from './preprocess.js';\nimport getStyles, { cssStyleSheetToString } from './styles.js';\nimport theme from './themes/index.js';\nimport type {\n D3HtmlSelection,\n D3Selection,\n ParseOptions,\n ParseResult,\n RenderResult,\n} from './types.js';\nimport { decodeEntities } from './utils.js';\nimport { toBase64 } from './utils/base64.js';\nimport { sanitizeCss } from './utils/sanitizeDirective.js';\n\nconst MAX_TEXTLENGTH = 50_000;\nconst MAX_TEXTLENGTH_EXCEEDED_MSG =\n 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';\n\nconst SECURITY_LVL_SANDBOX = 'sandbox';\nconst SECURITY_LVL_LOOSE = 'loose';\n\nconst XMLNS_SVG_STD = 'http://www.w3.org/2000/svg';\nconst XMLNS_XLINK_STD = 'http://www.w3.org/1999/xlink';\nconst XMLNS_XHTML_STD = 'http://www.w3.org/1999/xhtml';\n\n// ------------------------------\n// iFrame\nconst IFRAME_WIDTH = '100%';\nconst IFRAME_HEIGHT = '100%';\nconst IFRAME_STYLES = 'border:0;margin:0;';\nconst IFRAME_BODY_STYLE = 'margin:0';\nconst IFRAME_SANDBOX_OPTS = 'allow-top-navigation-by-user-activation allow-popups';\nconst IFRAME_NOT_SUPPORTED_MSG = 'The \"iframe\" tag is not supported by your browser.';\n\n// DOMPurify settings for svgCode\nconst DOMPURIFY_TAGS = ['foreignobject'];\nconst DOMPURIFY_ATTR = ['dominant-baseline'];\n\nfunction processAndSetConfigs(text: string) {\n const processed = preprocessDiagram(text);\n configApi.reset();\n configApi.addDirective(processed.config ?? {});\n return processed;\n}\n\n/**\n * Parse the text and validate the syntax.\n * @param text - The mermaid diagram definition.\n * @param parseOptions - Options for parsing. @see {@link ParseOptions}\n * @returns An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.\n * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.\n */\nasync function parse(\n text: string,\n parseOptions: ParseOptions & { suppressErrors: true }\n): Promise;\nasync function parse(text: string, parseOptions?: ParseOptions): Promise;\nasync function parse(text: string, parseOptions?: ParseOptions): Promise {\n addDiagrams();\n try {\n const { code, config } = processAndSetConfigs(text);\n const diagram = await getDiagramFromText(code);\n return { diagramType: diagram.type, config };\n } catch (error) {\n if (parseOptions?.suppressErrors) {\n return false;\n }\n throw error;\n }\n}\n\n/**\n * Create a CSS style that starts with the given class name, then the element,\n * with an enclosing block that has each of the cssClasses followed by !important;\n * @param cssClass - CSS class name\n * @param element - CSS element\n * @param cssClasses - list of CSS styles to append after the element\n * @returns - the constructed string\n */\nexport const cssImportantStyles = (\n cssClass: string,\n element: string,\n cssClasses: string[] = []\n): string => {\n const declarationBlock = sanitizeCss(`{ ${cssClasses.join(' !important; ')} !important; }`);\n return `.${cssClass} ${element} ${declarationBlock}`;\n};\n\n/**\n * Create the user styles\n * @internal\n * @param config - configuration that has style and theme settings to use\n * @param classDefs - the classDefs in the diagram text. Might be null if none were defined. Usually is the result of a call to getClasses(...)\n * @returns the string with all the user styles\n */\nexport const createCssStyles = (\n config: MermaidConfig,\n classDefs: Map | null | undefined = new Map()\n): string => {\n const cssStyles = new CSSStyleSheet();\n\n // user provided theme CSS info\n // If you add more configuration driven data into the user styles make sure that the value is\n // sanitized by the sanitize CSS function TODO where is this method? what should be used to replace it? refactor so that it's always sanitized\n if (config.fontFamily !== undefined) {\n cssStyles.insertRule(\n `:root { --mermaid-font-family: ${config.fontFamily}}`,\n cssStyles.cssRules.length\n );\n }\n if (config.altFontFamily !== undefined) {\n cssStyles.insertRule(\n `:root { --mermaid-alt-font-family: ${config.altFontFamily}}`,\n cssStyles.cssRules.length\n );\n }\n\n // classDefs defined in the diagram text\n if (classDefs instanceof Map) {\n const htmlLabels = getEffectiveHtmlLabels(config);\n\n const cssHtmlElements = ['> *', 'span']; // TODO make a constant\n const cssShapeElements = ['rect', 'polygon', 'ellipse', 'circle', 'path']; // TODO make a constant\n\n const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;\n\n // create the CSS styles needed for each styleClass definition and css element\n classDefs.forEach((styleClassDef) => {\n // create the css styles for each cssElement and the styles (only if there are styles)\n if (!isEmpty(styleClassDef.styles)) {\n cssElements.forEach((cssElement) => {\n cssStyles.insertRule(\n cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles),\n cssStyles.cssRules.length\n );\n });\n }\n // create the css styles for the tspan element and the text styles (only if there are textStyles)\n if (!isEmpty(styleClassDef.textStyles)) {\n cssStyles.insertRule(\n cssImportantStyles(\n styleClassDef.id,\n 'tspan',\n (styleClassDef?.textStyles || []).map((s) => s.replace('color', 'fill'))\n ),\n cssStyles.cssRules.length\n );\n }\n });\n }\n\n let cssString = '';\n if (config.themeCSS !== undefined) {\n if (typeof cssStyles.replaceSync === 'function') {\n const themeCssStyleSheet = new CSSStyleSheet();\n themeCssStyleSheet.replaceSync(config.themeCSS);\n cssString = cssStyleSheetToString(themeCssStyleSheet) + '\\n';\n } else {\n /**\n * Ideally we'd do a `CSSStyleSheet.replaceSync`, but it's not supported\n * in some older browsers and in JSDOM.\n */\n cssString += `${config.themeCSS}\\n`;\n }\n }\n\n return cssString + cssStyleSheetToString(cssStyles);\n};\n\n/**\n * Use `stylis` to compile the CSS to only apply to the given namespace.\n *\n * This will also remove some newer CSS features (e.g. nesting) to better\n * support older browsers and does some minification. It also removes some\n * at-rules that can't be namespaced.\n *\n * @internal\n * @param namespace - the namespace to add in front of all the CSS styles, e.g. `#idOfSvgElement`\n * @param css - the CSS styles to add the namespace to.\n * @see https://github.com/thysultan/stylis\n *\n * @example\n * // Returns `#id .class1{fill:red;}`\n * compileCSS('#id', `.class1 { fill: red }`)\n */\nconst compileCSS = (namespace: `#${string}`, css: string) => {\n return serialize(\n compile(`${namespace}{${css}}`),\n middleware([\n function addNamespace(element, _index, _children, _callback) {\n /**\n * CSS normally automatically adds the `&` selector in front of each\n * element. But, if there's already an `&` selector, it doesn't add this.\n *\n * This code will explicitly make sure it's always added, to ensure\n * that the CSS never applies outside the SVG.\n *\n * E.g. `#svgId { .nested-class :not(&) { fill: red } }` will be\n * transformed to `#svgId { & .nested-class :not(&) { fill: red } }`\n */\n if (element.type === 'rule' && Array.isArray(element.props)) {\n if (element.parent && element.parent.type === KEYFRAMES) {\n /**\n * Don't namespace CSSKeyframeRule, since they don't have selectors.\n */\n return;\n }\n element.props = element.props.map((prop) => {\n if (!prop.startsWith(namespace)) {\n return `${namespace} ${prop}`;\n }\n return prop;\n });\n } else if (element.type.startsWith('@')) {\n // Only allow certain at-rules to avoid namespace escape.\n //\n // Nested ones are allowed, since they'd get namespaced appropriately.\n // @keyframes are required for Mermaid's animation features, even\n // if they can potentially pollute the page.\n\n /**\n * At-rules that contain nested rules.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@container}\n */\n const nestedAtRules = [\n MEDIA,\n SUPPORTS,\n LAYER,\n SCOPE,\n '@container',\n '@starting-style',\n ] as const;\n const allowedAtRules = [\n ...nestedAtRules,\n KEYFRAMES, // needed for Mermaid's animation feature\n ] as const;\n if (!allowedAtRules.includes(element.type as (typeof allowedAtRules)[number])) {\n log.warn(`Removing unsupported at-rule ${element.type} from CSS`);\n element.type = COMMENT;\n }\n }\n },\n stringify,\n ])\n );\n};\n\nexport const createUserStyles = (\n config: MermaidConfig,\n graphType: string,\n classDefs: Map | undefined,\n // CSS selector for the SVG element, e.g. `#idOfSvgElement`\n svgId: `#${string}`\n): string => {\n const userCSSstyles = createCssStyles(config, classDefs);\n const allStyles = getStyles(\n graphType,\n userCSSstyles,\n { ...config.themeVariables, theme: config.theme, look: config.look },\n svgId\n );\n return compileCSS(svgId, allStyles);\n};\n\n/**\n * Clean up svgCode. Do replacements needed\n *\n * @param svgCode - the code to clean up\n * @param inSandboxMode - security level\n * @param useArrowMarkerUrls - should arrow marker's use full urls? (vs. just the anchors)\n * @returns the cleaned up svgCode\n */\nexport const cleanUpSvgCode = (\n svgCode = '',\n inSandboxMode: boolean,\n useArrowMarkerUrls: boolean\n): string => {\n let cleanedUpSvg = svgCode;\n\n // Replace marker-end urls with just the # anchor (remove the preceding part of the URL)\n if (!useArrowMarkerUrls && !inSandboxMode) {\n cleanedUpSvg = cleanedUpSvg.replace(\n /marker-end=\"url\\([\\d+./:=?A-Za-z-]*?#/g,\n 'marker-end=\"url(#'\n );\n }\n\n cleanedUpSvg = decodeEntities(cleanedUpSvg);\n\n // replace old br tags with newer style\n cleanedUpSvg = cleanedUpSvg.replace(/
/g, '
');\n\n return cleanedUpSvg;\n};\n\n/**\n * Put the svgCode into an iFrame. Return the iFrame code\n *\n * @param svgCode - the svg code to put inside the iFrame\n * @param svgElement - the d3 node that has the current svgElement so we can get the height from it\n * @returns - the code with the iFrame that now contains the svgCode\n */\nexport const putIntoIFrame = (svgCode = '', svgElement?: SVGSVGElement): string => {\n const height = svgElement?.viewBox?.baseVal?.height\n ? svgElement.viewBox.baseVal.height + 'px'\n : IFRAME_HEIGHT;\n const base64encodedSrc = toBase64(`${svgCode}`);\n return ``;\n};\n\n/**\n * Append an enclosing div, then svg, then g (group) to the d3 parentRoot. Set attributes.\n * Only set the style attribute on the enclosing div if divStyle is given.\n * Only set the xmlns:xlink attribute on svg if svgXlink is given.\n * Return the last node appended\n *\n * @param parentRoot - the d3 node to append things to\n * @param id - the value to set the id attr to\n * @param enclosingDivId - the id to set the enclosing div to\n * @param divStyle - if given, the style to set the enclosing div to\n * @param svgXlink - if given, the link to set the new svg element to\n * @returns - returns the parentRoot that had nodes appended\n */\nexport const appendDivSvgG = (\n parentRoot: D3HtmlSelection | D3HtmlSelection,\n id: string,\n enclosingDivId: string,\n divStyle?: string,\n svgXlink?: string\n) => {\n const enclosingDiv = parentRoot.append('div');\n enclosingDiv.attr('id', enclosingDivId);\n if (divStyle) {\n enclosingDiv.attr('style', divStyle);\n }\n\n const svgNode = enclosingDiv\n .append('svg')\n .attr('id', id)\n .attr('width', '100%')\n .attr('xmlns', XMLNS_SVG_STD);\n if (svgXlink) {\n svgNode.attr('xmlns:xlink', svgXlink);\n }\n\n svgNode.append('g');\n return parentRoot;\n};\n\n/**\n * Append an iFrame node to the given parentNode and set the id, style, and 'sandbox' attributes\n * Return the appended iframe d3 node\n *\n * @param parentNode - the d3 node to append the iFrame node to\n * @param iFrameId - id to use for the iFrame\n * @returns the appended iframe d3 node\n */\nfunction sandboxedIframe(\n parentNode: D3HtmlSelection | D3HtmlSelection,\n iFrameId: string\n) {\n return parentNode\n .append('iframe')\n .attr('id', iFrameId)\n .attr('style', 'width: 100%; height: 100%;')\n .attr('sandbox', '');\n}\n\n/**\n * Remove any existing elements from the given document\n *\n * @param doc - the document to removed elements from\n * @param id - id for any existing SVG element\n * @param divSelector - selector for any existing enclosing div element\n * @param iFrameSelector - selector for any existing iFrame element\n */\nexport const removeExistingElements = (\n doc: Document,\n id: string,\n divId: string,\n iFrameId: string\n) => {\n // Remove existing SVG element if it exists\n doc.getElementById(id)?.remove();\n // Remove previous temporary element if it exists\n // Both div and iframe needs to be cleared in case there is a config change happening between renders.\n doc.getElementById(divId)?.remove();\n doc.getElementById(iFrameId)?.remove();\n};\n\n/**\n * @deprecated - use the `mermaid.render` function instead of `mermaid.mermaidAPI.render`\n *\n * Deprecated for external use.\n */\n\nconst render = async function (\n id: string,\n text: string,\n svgContainingElement?: Element\n): Promise {\n addDiagrams();\n\n const processed = processAndSetConfigs(text);\n text = processed.code;\n\n const config = configApi.getConfig();\n log.debug(config);\n\n // Check the maximum allowed text size\n if (text.length > (config?.maxTextSize ?? MAX_TEXTLENGTH)) {\n text = MAX_TEXTLENGTH_EXCEEDED_MSG;\n }\n\n const idSelector = `#${id}` as const;\n const iFrameID = 'i' + id;\n const iFrameID_selector = '#' + iFrameID;\n const enclosingDivID = 'd' + id;\n const enclosingDivID_selector = '#' + enclosingDivID;\n\n const removeTempElements = () => {\n // -------------------------------------------------------------------------------\n // Remove the temporary HTML element if appropriate\n const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector;\n const node = select(tmpElementSelector).node();\n if (node && 'remove' in node) {\n node.remove();\n }\n };\n\n let root: D3HtmlSelection | D3HtmlSelection = select(document.body);\n\n const isSandboxed = config.securityLevel === SECURITY_LVL_SANDBOX;\n const isLooseSecurityLevel = config.securityLevel === SECURITY_LVL_LOOSE;\n\n const fontFamily = config.fontFamily;\n\n // -------------------------------------------------------------------------------\n // Define the root d3 node\n // In regular execution the svgContainingElement will be the element with a mermaid class\n\n if (svgContainingElement !== undefined) {\n if (svgContainingElement) {\n svgContainingElement.innerHTML = '';\n }\n\n if (isSandboxed) {\n // If we are in sandboxed mode, we do everything mermaid related in a (sandboxed )iFrame\n const iframe = sandboxedIframe(select(svgContainingElement), iFrameID);\n root = select(iframe.nodes()[0].contentDocument!.body);\n root.node()!.style.margin = '0';\n } else {\n root = select(svgContainingElement);\n }\n appendDivSvgG(root, id, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);\n } else {\n // No svgContainingElement was provided\n\n // If there is an existing element with the id, we remove it. This likely a previously rendered diagram\n removeExistingElements(document, id, enclosingDivID, iFrameID);\n\n // Add the temporary div used for rendering with the enclosingDivID.\n // This temporary div will contain a svg with the id == id\n\n if (isSandboxed) {\n // If we are in sandboxed mode, we do everything mermaid related in a (sandboxed) iFrame\n const iframe = sandboxedIframe(select(document.body), iFrameID);\n root = select(iframe.nodes()[0].contentDocument!.body);\n root.node()!.style.margin = '0';\n } else {\n root = select('body');\n }\n\n appendDivSvgG(root, id, enclosingDivID);\n }\n\n // -------------------------------------------------------------------------------\n // Create the diagram\n\n // Important that we do not create the diagram until after the directives have been included\n let diag: Diagram;\n let parseEncounteredException;\n\n try {\n diag = await Diagram.fromText(text, { title: processed.title });\n } catch (error) {\n if (config.suppressErrorRendering) {\n removeTempElements();\n throw error;\n }\n diag = await Diagram.fromText('error');\n parseEncounteredException = error;\n }\n\n // Get the temporary div element containing the svg\n const element = root.select(enclosingDivID_selector).node()!;\n const diagramType = diag.type;\n\n // -------------------------------------------------------------------------------\n // Create and insert the styles (user styles, theme styles, config styles)\n\n // Insert an element into svg. This is where we put the styles\n const svg = element.firstChild!;\n const firstChild = svg.firstChild;\n const diagramClassDefs = diag.renderer.getClasses?.(text, diag);\n\n const rules = createUserStyles(config, diagramType, diagramClassDefs, idSelector);\n\n const style1 = document.createElement('style');\n style1.innerHTML = rules;\n svg.insertBefore(style1, firstChild);\n\n // -------------------------------------------------------------------------------\n // Draw the diagram with the renderer\n try {\n await diag.renderer.draw(text, id, injected.version, diag);\n } catch (e) {\n if (config.suppressErrorRendering) {\n removeTempElements();\n } else {\n errorRenderer.draw(text, id, injected.version);\n }\n throw e;\n }\n\n // This is the d3 node for the svg element\n const svgNode = root.select(`${enclosingDivID_selector} svg`);\n const a11yTitle: string | undefined = diag.db.getAccTitle?.();\n const a11yDescr: string | undefined = diag.db.getAccDescription?.();\n addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr);\n // -------------------------------------------------------------------------------\n // Clean up SVG code\n root.select(`[id=\"${id}\"]`).selectAll('foreignobject > *').attr('xmlns', XMLNS_XHTML_STD);\n\n // Fix for when the base tag is used\n let svgCode: string = root.select(enclosingDivID_selector).node()!.innerHTML;\n\n log.debug('config.arrowMarkerAbsolute', config.arrowMarkerAbsolute);\n svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config.arrowMarkerAbsolute));\n\n if (isSandboxed) {\n const svgEl = root.select(enclosingDivID_selector + ' svg').node()!;\n svgCode = putIntoIFrame(svgCode, svgEl);\n } else if (!isLooseSecurityLevel) {\n // Sanitize the svgCode using DOMPurify\n svgCode = DOMPurify.sanitize(svgCode, {\n ADD_TAGS: DOMPURIFY_TAGS,\n ADD_ATTR: DOMPURIFY_ATTR,\n HTML_INTEGRATION_POINTS: { foreignobject: true },\n });\n }\n\n attachFunctions();\n\n if (parseEncounteredException) {\n throw parseEncounteredException;\n }\n\n removeTempElements();\n\n return {\n diagramType,\n svg: svgCode,\n bindFunctions: diag.db.bindFunctions,\n };\n};\n\n/**\n * @param userOptions - Initial Mermaid options\n */\nfunction initialize(userOptions: MermaidConfig = {}) {\n const options: MermaidConfig = assignWithDepth({}, userOptions);\n // Handle legacy location of font-family configuration\n if (options?.fontFamily && !options.themeVariables?.fontFamily) {\n if (!options.themeVariables) {\n options.themeVariables = {};\n }\n options.themeVariables.fontFamily = options.fontFamily;\n }\n\n // Set default options\n configApi.saveConfigFromInitialize(options);\n\n if (options?.theme && options.theme in theme) {\n // Todo merge with user options\n options.themeVariables = theme[options.theme as keyof typeof theme].getThemeVariables(\n options.themeVariables\n );\n } else if (options) {\n options.themeVariables = theme.default.getThemeVariables(options.themeVariables);\n }\n\n const config =\n typeof options === 'object' ? configApi.setSiteConfig(options) : configApi.getSiteConfig();\n\n setLogLevel(config.logLevel);\n addDiagrams();\n}\n\nconst getDiagramFromText = (text: string, metadata: Pick = {}) => {\n const { code } = preprocessDiagram(text);\n return Diagram.fromText(code, metadata);\n};\n\n/**\n * Add accessibility (a11y) information to the diagram.\n *\n * @param diagramType - diagram type\n * @param svgNode - d3 node to insert the a11y title and desc info\n * @param a11yTitle - a11y title\n * @param a11yDescr - a11y description\n */\nfunction addA11yInfo(\n diagramType: string,\n svgNode: D3Selection,\n a11yTitle?: string,\n a11yDescr?: string\n): void {\n setA11yDiagramInfo(svgNode, diagramType);\n addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr('id'));\n}\n\n/**\n * @internal - Use mermaid.function instead of mermaid.mermaidAPI.function\n */\nexport const mermaidAPI = Object.freeze({\n render,\n parse,\n getDiagramFromText,\n initialize,\n getConfig: configApi.getConfig,\n setConfig: configApi.setConfig,\n getSiteConfig: configApi.getSiteConfig,\n updateSiteConfig: configApi.updateSiteConfig,\n reset: () => {\n configApi.reset();\n },\n globalReset: () => {\n configApi.reset(configApi.defaultConfig);\n },\n defaultConfig: configApi.defaultConfig,\n});\n\nsetLogLevel(configApi.getConfig().logLevel);\nconfigApi.reset(configApi.getConfig());\nexport default mermaidAPI;\n", "/**\n * Accessibility (a11y) functions, types, helpers.\n *\n * @see https://www.w3.org/WAI/\n * @see https://www.w3.org/TR/wai-aria-1.1/\n * @see https://www.w3.org/TR/svg-aam-1.0/\n */\nimport type { D3Element } from './types.js';\n\n/**\n * SVG element role:\n * The SVG element role _should_ be set to 'graphics-document' per SVG standard\n * but in practice is not always done by browsers, etc. (As of 2022-12-08).\n * A fallback role of 'document' should be set for those browsers, etc., that only support ARIA 1.0.\n *\n * @see https://www.w3.org/TR/svg-aam-1.0/#roleMappingGeneralRules\n * @see https://www.w3.org/TR/graphics-aria-1.0/#graphics-document\n */\nconst SVG_ROLE = 'graphics-document document';\n\n/**\n * Add role and aria-roledescription to the svg element.\n *\n * @param svg - d3 object that contains the SVG HTML element\n * @param diagramType - diagram name for to the aria-roledescription\n */\nexport function setA11yDiagramInfo(svg: D3Element, diagramType: string) {\n svg.attr('role', SVG_ROLE);\n if (diagramType !== '') {\n svg.attr('aria-roledescription', diagramType);\n }\n}\n\n/**\n * Add an accessible title and/or description element to a chart.\n * The title is usually not displayed and the description is never displayed.\n *\n * The following charts display their title as a visual and accessibility element: gantt.\n *\n * @param svg - d3 node to insert the a11y title and desc info\n * @param a11yTitle - a11y title. undefined or empty strings mean to skip them\n * @param a11yDesc - a11y description. undefined or empty strings mean to skip them\n * @param baseId - id used to construct the a11y title and description id\n */\nexport function addSVGa11yTitleDescription(\n svg: D3Element,\n a11yTitle: string | undefined,\n a11yDesc: string | undefined,\n baseId: string\n): void {\n if (svg.insert === undefined) {\n return;\n }\n\n if (a11yDesc) {\n const descId = `chart-desc-${baseId}`;\n svg.attr('aria-describedby', descId);\n svg.insert('desc', ':first-child').attr('id', descId).text(a11yDesc);\n }\n if (a11yTitle) {\n const titleId = `chart-title-${baseId}`;\n svg.attr('aria-labelledby', titleId);\n svg.insert('title', ':first-child').attr('id', titleId).text(a11yTitle);\n }\n}\n", "import * as configApi from './config.js';\nimport { getDiagram, registerDiagram } from './diagram-api/diagramAPI.js';\nimport { detectType, getDiagramLoader } from './diagram-api/detectType.js';\nimport { UnknownDiagramError } from './errors.js';\nimport { encodeEntities } from './utils.js';\nimport type { DetailedError } from './utils.js';\nimport type { DiagramDefinition, DiagramMetadata } from './diagram-api/types.js';\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nexport type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;\n\n/**\n * An object representing a parsed mermaid diagram definition.\n * @privateRemarks This is exported as part of the public mermaidAPI.\n */\nexport class Diagram {\n public static async fromText(text: string, metadata: Pick = {}) {\n const config = configApi.getConfig();\n const type = detectType(text, config);\n text = encodeEntities(text) + '\\n';\n try {\n getDiagram(type);\n } catch {\n const loader = getDiagramLoader(type);\n if (!loader) {\n throw new UnknownDiagramError(`Diagram ${type} not found.`);\n }\n // Diagram not available, loading it.\n // new diagram will try getDiagram again and if fails then it is a valid throw\n const { id, diagram } = await loader();\n registerDiagram(id, diagram);\n }\n const { db, parser, renderer, init } = getDiagram(type);\n if (parser.parser) {\n // The parser.parser.yy is only present in JISON parsers. So, we'll only set if required.\n parser.parser.yy = db;\n }\n db.clear?.();\n init?.(config);\n // This block was added for legacy compatibility. Use frontmatter instead of adding more special cases.\n if (metadata.title) {\n db.setDiagramTitle?.(metadata.title);\n }\n await parser.parse(text);\n return new Diagram(type, text, db, parser, renderer);\n }\n\n private constructor(\n public type: string,\n public text: string,\n public db: DiagramDefinition['db'],\n public parser: DiagramDefinition['parser'],\n public renderer: DiagramDefinition['renderer']\n ) {}\n\n async render(id: string, version: string) {\n await this.renderer.draw(this.text, id, version, this);\n }\n\n getParser() {\n return this.parser;\n }\n\n getType() {\n return this.type;\n }\n}\n", "let interactionFunctions: (() => void)[] = [];\nexport const addFunction = (func: () => void) => {\n interactionFunctions.push(func);\n};\nexport const attachFunctions = () => {\n interactionFunctions.forEach((f) => {\n f();\n });\n interactionFunctions = [];\n};\n", "/**\n * Remove all lines starting with `%%` from the text that don't contain a `%%{`\n * @param text - The text to remove comments from\n * @returns cleaned text\n */\nexport const cleanupComments = (text: string): string => {\n return text.replace(/^\\s*%%(?!{)[^\\n]+\\n?/gm, '').trimStart();\n};\n", "import type { GanttDiagramConfig, MermaidConfig } from '../config.type.js';\nimport { frontMatterRegex } from './regexes.js';\n// The \"* as yaml\" part is necessary for tree-shaking\nimport * as yaml from 'js-yaml';\n\ninterface FrontMatterMetadata {\n title?: string;\n // Allows custom display modes. Currently used for compact mode in gantt charts.\n displayMode?: GanttDiagramConfig['displayMode'];\n config?: MermaidConfig;\n}\n\nexport interface FrontMatterResult {\n text: string;\n metadata: FrontMatterMetadata;\n}\n\n/**\n * Extract and parse frontmatter from text, if present, and sets appropriate\n * properties in the provided db.\n * @param text - The text that may have a YAML frontmatter.\n * @returns text with frontmatter stripped out\n */\nexport function extractFrontMatter(text: string): FrontMatterResult {\n const matches = text.match(frontMatterRegex);\n if (!matches) {\n return {\n text,\n metadata: {},\n };\n }\n\n let parsed: FrontMatterMetadata =\n yaml.load(matches[1], {\n // To support config, we need JSON schema.\n // https://www.yaml.org/spec/1.2/spec.html#id2803231\n schema: yaml.JSON_SCHEMA,\n }) ?? {};\n\n // To handle runtime data type changes\n parsed = typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};\n\n const metadata: FrontMatterMetadata = {};\n\n // Only add properties that are explicitly supported, if they exist\n if (parsed.displayMode) {\n metadata.displayMode = parsed.displayMode.toString() as GanttDiagramConfig['displayMode'];\n }\n if (parsed.title) {\n metadata.title = parsed.title.toString();\n }\n if (parsed.config) {\n metadata.config = parsed.config;\n }\n\n return {\n text: text.slice(matches[0].length),\n metadata,\n };\n}\n", "import { cleanupComments } from './diagram-api/comments.js';\nimport { extractFrontMatter } from './diagram-api/frontmatter.js';\nimport type { DiagramMetadata } from './diagram-api/types.js';\nimport utils, { cleanAndMerge, removeDirectives } from './utils.js';\n\nconst cleanupText = (code: string) => {\n return (\n code\n // parser problems on CRLF ignore all CR and leave LF;;\n .replace(/\\r\\n?/g, '\\n')\n // clean up html tags so that all attributes use single quotes, parser throws error on double quotes\n .replace(\n /<(\\w+)([^>]*)>/g,\n (match, tag, attributes) => '<' + tag + attributes.replace(/=\"([^\"]*)\"/g, \"='$1'\") + '>'\n )\n );\n};\n\nconst processFrontmatter = (code: string) => {\n const { text, metadata } = extractFrontMatter(code);\n const { displayMode, title, config = {} } = metadata;\n if (displayMode) {\n // Needs to be supported for legacy reasons\n if (!config.gantt) {\n config.gantt = {};\n }\n config.gantt.displayMode = displayMode;\n }\n\n return { title, config, text };\n};\n\nconst processDirectives = (code: string) => {\n const initDirective = utils.detectInit(code) ?? {};\n const wrapDirectives = utils.detectDirective(code, 'wrap');\n if (Array.isArray(wrapDirectives)) {\n initDirective.wrap = wrapDirectives.some(({ type }) => type === 'wrap');\n } else if (wrapDirectives?.type === 'wrap') {\n initDirective.wrap = true;\n }\n return {\n text: removeDirectives(code),\n directive: initDirective,\n };\n};\n\n/**\n * Preprocess the given code by cleaning it up, extracting front matter and directives,\n * cleaning and merging configuration, and removing comments.\n * @param code - The code to preprocess.\n * @returns The object containing the preprocessed code, title, and configuration.\n */\nexport function preprocessDiagram(code: string) {\n const cleanedCode = cleanupText(code);\n const frontMatterResult = processFrontmatter(cleanedCode);\n const directiveResult = processDirectives(frontMatterResult.text);\n const config = cleanAndMerge(frontMatterResult.config, directiveResult.directive);\n code = cleanupComments(directiveResult.text);\n return {\n code,\n title: frontMatterResult.title,\n config,\n } satisfies DiagramMetadata & { code: string };\n}\n", "export function toBase64(str: string) {\n // ref: https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem\n const utf8Bytes = new TextEncoder().encode(str);\n const utf8Str = Array.from(utf8Bytes, (byte) => String.fromCodePoint(byte)).join('');\n return btoa(utf8Str);\n}\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,cAAc;;;ACAvB,IAAM,KAAK;AAEX,IAAM,WAA4B,wBAAC,QAAQ;AACzC,SAAO,+DAA+D,KAAK,GAAG;AAChF,GAFkC;AAIlC,IAAM,SAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAA,SAAQ,IAAI,MAAM,OAAO,8CAAgB;AACjD,SAAO,EAAE,IAAI,SAAAA,SAAQ;AACvB,GAH8B;AAK9B,IAAM,SAAoC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAO,qBAAQ;;;ACjBf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,KAAK,WAAW;AAGjD,MACE,QAAQ,WAAW,oBAAoB,mBACvC,QAAQ,WAAW,oBAAoB,OACvC;AACA,WAAO;AAAA,EACT;AACA,SAAO,YAAY,KAAK,GAAG;AAC7B,GAVkC;AAYlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,gDAAkB;AACnD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,uBAAQE;;;ACzBf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,KAAK,WAAW;AACjD,MAAI,QAAQ,WAAW,oBAAoB,YAAY;AACrD,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,WAAW,oBAAoB,OAAO;AAChD,WAAO,SAAS;AAAA,EAClB;AAGA,MAAI,YAAY,KAAK,GAAG,KAAK,QAAQ,WAAW,oBAAoB,iBAAiB;AACnF,WAAO;AAAA,EACT;AACA,SAAO,gBAAgB,KAAK,GAAG;AACjC,GAdkC;AAgBlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,gDAAkB;AACnD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,0BAAQE;;;AC7Bf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,gBAAgB,KAAK,GAAG;AACjC,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,8CAAgB;AACjD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,qBAAQE;;;ACpBf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,eAAe,KAAK,GAAG;AAChC,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,oDAAsB;AACvD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACdf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,YAAY,KAAK,GAAG;AAC7B,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,iDAAmB;AACpD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,wBAAQE;;;ACjBf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,WAAW,KAAK,GAAG;AAC5B,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,gDAAkB;AACnD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,OAAkC;AAAA,EAC7C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,UAAU,KAAK,GAAG;AAC3B,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,+CAAiB;AAClD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,MAAiC;AAAA,EAC5C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,oBAAoB,KAAK,GAAG;AACrC,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,oDAAsB;AACvD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,sBAAsB,KAAK,GAAG;AACvC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,mDAAqB;AACtD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,0BAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,4BAA4B,KAAK,GAAG;AAC7C,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,uDAAyB;AAC1D,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,8BAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,sBAAsB,KAAK,GAAG;AACvC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,oDAAsB;AACvD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,WAAW;AAEjD,MAAI,QAAQ,OAAO,oBAAoB,iBAAiB;AACtD,WAAO;AAAA,EACT;AAEA,SAAO,mBAAmB,KAAK,GAAG;AACpC,GAPkC;AASlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,iDAAmB;AACpD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,wBAAQE;;;ACtBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,WAAW;AAEjD,MAAI,mBAAmB,KAAK,GAAG,KAAK,QAAQ,OAAO,oBAAoB,iBAAiB;AACtF,WAAO;AAAA,EACT;AAEA,SAAO,sBAAsB,KAAK,GAAG;AACvC,GAPkC;AASlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,oDAAsB;AACvD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACtBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,WAAW;AAGjD,MAAI,QAAQ,OAAO,oBAAoB,iBAAiB;AACtD,WAAO;AAAA,EACT;AACA,SAAO,mBAAmB,KAAK,GAAG;AACpC,GAPkC;AASlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,iDAAmB;AACpD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,wBAAQE;;;ACtBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,WAAW;AACjD,MAAI,sBAAsB,KAAK,GAAG,GAAG;AACnC,WAAO;AAAA,EACT;AACA,MAAI,mBAAmB,KAAK,GAAG,KAAK,QAAQ,OAAO,oBAAoB,iBAAiB;AACtF,WAAO;AAAA,EACT;AACA,SAAO;AACT,GARkC;AAUlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,oDAAsB;AACvD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACvBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,cAAc,KAAK,GAAG;AAC/B,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,mDAAqB;AACtD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,0BAAQE;;;ACXR,IAAM,OAAO,wBAAC,OAAeC,MAAY,YAAoB;AAClE,MAAI,MAAM,kCAAkC;AAC5C,QAAM,MAAW,iBAAiBA,IAAE;AACpC,QAAM,IAAc,IAAI,OAAO,GAAG;AAElC,MAAI,KAAK,WAAW,cAAc;AAClC,mBAAiB,KAAK,KAAK,KAAK,IAAI;AAEpC,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B,KAAK,KAAK,IAAI,EACd,KAAK,KAAK,GAAG,EACb,KAAK,aAAa,OAAO,EACzB,MAAM,eAAe,QAAQ,EAC7B,KAAK,sBAAsB;AAC9B,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B,KAAK,KAAK,IAAI,EACd,KAAK,KAAK,GAAG,EACb,KAAK,aAAa,OAAO,EACzB,MAAM,eAAe,QAAQ,EAC7B,KAAK,mBAAmB,OAAO,EAAE;AACtC,GAhEoB;AAkEb,IAAM,WAAW,EAAE,KAAK;AAE/B,IAAO,wBAAQ;;;AC7Ef,IAAM,UAA6B;AAAA,EACjC,IAAI,CAAC;AAAA,EACL;AAAA,EACA,QAAQ;AAAA,IACN,OAAO,6BAAY;AACjB;AAAA,IACF,GAFO;AAAA,EAGT;AACF;AAEA,IAAO,uBAAQ;;;ACPf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,SAAS,CAAC,MAAe;AAC/D;AAAA;AAAA,IAEE,oBAAoB,KAAK,GAAG;AAAA,IAE3B,wBAAwB,KAAK,GAAG,KAAK,QAAQ,WAAW,oBAAoB;AAAA,IAC7E;AACA,WAAO,SAAS;AAChB,WAAO;AAAA,EACT;AACA,SAAO;AACT,GAXkC;AAalC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,gDAAmB;AACpD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,mBAAQE;;;AC1Bf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,eAAe,KAAK,GAAG;AAChC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,wDAA0B;AAC3D,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;AClBf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,cAAc,KAAK,GAAG;AAC/B,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,uDAAyB;AAC1D,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;ACjBf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,aAAa,KAAK,GAAG;AAC9B,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,sDAAwB;AACzD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;ACpBf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,qBAAqB,KAAK,GAAG;AACtC,GAFkC;AAIlC,IAAMC,WAAS,mCAAY;AACzB,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,kDAAoB;AACrD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAHe;AAKf,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,yBAAQE;;;ACbf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,qBAAqB,KAAK,GAAG;AACtC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,4CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,SAAoC;AAAA,EAC/C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,iBAAiB,KAAK,GAAG;AAClC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,4CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,QAAmC;AAAA,EAC9C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACnBA,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,oBAAoB,KAAK,GAAG;AACrC,GAFkC;AAIlC,IAAMC,WAAS,mCAAY;AACzB,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,iDAAmB;AACpD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAHe;AAKf,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,wBAAQE;;;AChBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,oBAAoB,KAAK,GAAG;AACrC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,4CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;ACdf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,mBAAmB,KAAK,GAAG;AACpC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,wDAA0B;AAC3D,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAM,eAA0C;AAAA,EAC9C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,+BAAQ;;;ACpBf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,oBAAoB,KAAK,GAAG;AACrC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,4CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;ACdf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,0BAA0B,KAAK,GAAG;AAC3C,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,oDAAsB;AACvD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,WAAsC;AAAA,EACjD,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,gBAAgB,KAAK,GAAG;AACjC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,gDAAkB;AACnD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,uBAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,cAAc,KAAK,GAAG;AAC/B,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,4CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,UAAqC;AAAA,EAChD,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,SAAS;AAC1C,SAAO,oBAAoB,KAAK,IAAI;AACtC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,mDAAqB;AACtD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,0BAAQE;;;ACcf,IAAI,oBAAoB;AACjB,IAAM,cAAc,6BAAM;AAC/B,MAAI,mBAAmB;AACrB;AAAA,EACF;AAGA,sBAAoB;AACpB,kBAAgB,SAAS,sBAAc,CAAC,SAAS;AAC/C,WAAO,KAAK,YAAY,EAAE,KAAK,MAAM;AAAA,EACvC,CAAC;AACD;AAAA,IACE;AAAA;AAAA,IAEA;AAAA,MACE,IAAI;AAAA,QACF,OAAO,6BAAM;AAAA,QAEb,GAFO;AAAA,MAGT;AAAA,MACA,QAAQ,CAAC;AAAA;AAAA,MACT,UAAU;AAAA,QACR,MAAM,6BAAM;AAAA,QAEZ,GAFM;AAAA,MAGR;AAAA,MACA,QAAQ;AAAA,QACN,OAAO,6BAAM;AACX,gBAAM,IAAI;AAAA,YACR;AAAA,UAGF;AAAA,QACF,GANO;AAAA,MAOT;AAAA,MACA,MAAM,6BAAM,MAAN;AAAA;AAAA,IACR;AAAA,IACA,CAAC,SAAS;AACR,aAAO,KAAK,YAAY,EAAE,UAAU,EAAE,WAAW,KAAK;AAAA,IACxD;AAAA,EACF;AAEA,MAAI,MAA+B;AACjC,+BAA2B,kBAAcC,mBAAS,4BAAY;AAAA,EAChE;AAGA;AAAA,IACE;AAAA,IACAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAA;AAAA,IACAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GA7E2B;;;AClCpB,IAAM,yBAAyB,mCAAY;AAChD,MAAI,MAAM,6BAA6B;AAEvC,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,OAAO,QAAQ,SAAS,EAAE,IAAI,OAAO,CAAC,KAAK,EAAE,UAAAC,YAAU,QAAAC,SAAO,CAAC,MAAM;AACnE,UAAI,CAACA,UAAQ;AACX;AAAA,MACF;AACA,UAAI;AACF,mBAAW,GAAG;AAAA,MAChB,QAAQ;AACN,YAAI;AAEF,gBAAM,EAAE,SAAAC,UAAS,IAAAC,KAAG,IAAI,MAAMF,SAAO;AACrC,0BAAgBE,MAAID,UAASF,UAAQ;AAAA,QACvC,SAAS,KAAK;AAEZ,cAAI,MAAM,4CAA4C,GAAG,4BAA4B;AACrF,iBAAO,UAAU,GAAG;AACpB,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACA,QAAM,SAAS,QAAQ,OAAO,CAAC,WAAW,OAAO,WAAW,UAAU;AACtE,MAAI,OAAO,SAAS,GAAG;AACrB,QAAI,MAAM,kBAAkB,OAAO,MAAM,oBAAoB;AAC7D,eAAW,OAAO,QAAQ;AACxB,UAAI,MAAM,GAAG;AAAA,IACf;AACA,UAAM,IAAI,MAAM,kBAAkB,OAAO,MAAM,oBAAoB;AAAA,EACrE;AACF,GAhCsC;;;ACCtC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,eAAe;AACtB,SAAS,eAAe;;;ACDxB,IAAM,WAAW;AAQV,SAAS,mBAAmB,KAAgB,aAAqB;AACtE,MAAI,KAAK,QAAQ,QAAQ;AACzB,MAAI,gBAAgB,IAAI;AACtB,QAAI,KAAK,wBAAwB,WAAW;AAAA,EAC9C;AACF;AALgB;AAkBT,SAAS,2BACd,KACA,WACA,UACA,QACM;AACN,MAAI,IAAI,WAAW,QAAW;AAC5B;AAAA,EACF;AAEA,MAAI,UAAU;AACZ,UAAM,SAAS,cAAc,MAAM;AACnC,QAAI,KAAK,oBAAoB,MAAM;AACnC,QAAI,OAAO,QAAQ,cAAc,EAAE,KAAK,MAAM,MAAM,EAAE,KAAK,QAAQ;AAAA,EACrE;AACA,MAAI,WAAW;AACb,UAAM,UAAU,eAAe,MAAM;AACrC,QAAI,KAAK,mBAAmB,OAAO;AACnC,QAAI,OAAO,SAAS,cAAc,EAAE,KAAK,MAAM,OAAO,EAAE,KAAK,SAAS;AAAA,EACxE;AACF;AApBgB;;;AC7BT,IAAM,UAAN,MAAM,SAAQ;AAAA,EAgCX,YACC,MACA,MACA,IACA,QACAI,WACP;AALO;AACA;AACA;AACA;AACA,oBAAAA;AAAA,EACN;AAAA,EArDL,OAeqB;AAAA;AAAA;AAAA,EACnB,aAAoB,SAAS,MAAc,WAA2C,CAAC,GAAG;AACxF,UAAM,SAAmB,UAAU;AACnC,UAAM,OAAO,WAAW,MAAM,MAAM;AACpC,WAAO,eAAe,IAAI,IAAI;AAC9B,QAAI;AACF,iBAAW,IAAI;AAAA,IACjB,QAAQ;AACN,YAAMC,WAAS,iBAAiB,IAAI;AACpC,UAAI,CAACA,UAAQ;AACX,cAAM,IAAI,oBAAoB,WAAW,IAAI,aAAa;AAAA,MAC5D;AAGA,YAAM,EAAE,IAAAC,MAAI,SAAAC,SAAQ,IAAI,MAAMF,SAAO;AACrC,sBAAgBC,MAAIC,QAAO;AAAA,IAC7B;AACA,UAAM,EAAE,IAAI,QAAQ,UAAAH,WAAU,MAAAI,MAAK,IAAI,WAAW,IAAI;AACtD,QAAI,OAAO,QAAQ;AAEjB,aAAO,OAAO,KAAK;AAAA,IACrB;AACA,OAAG,QAAQ;AACX,IAAAA,QAAO,MAAM;AAEb,QAAI,SAAS,OAAO;AAClB,SAAG,kBAAkB,SAAS,KAAK;AAAA,IACrC;AACA,UAAM,OAAO,MAAM,IAAI;AACvB,WAAO,IAAI,SAAQ,MAAM,MAAM,IAAI,QAAQJ,SAAQ;AAAA,EACrD;AAAA,EAUA,MAAM,OAAOE,MAAY,SAAiB;AACxC,UAAM,KAAK,SAAS,KAAK,KAAK,MAAMA,MAAI,SAAS,IAAI;AAAA,EACvD;AAAA,EAEA,YAAY;AACV,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,UAAU;AACR,WAAO,KAAK;AAAA,EACd;AACF;;;AClEA,IAAI,uBAAuC,CAAC;AAIrC,IAAM,kBAAkB,6BAAM;AACnC,uBAAqB,QAAQ,CAAC,MAAM;AAClC,MAAE;AAAA,EACJ,CAAC;AACD,yBAAuB,CAAC;AAC1B,GAL+B;;;ACCxB,IAAM,kBAAkB,wBAAC,SAAyB;AACvD,SAAO,KAAK,QAAQ,0BAA0B,EAAE,EAAE,UAAU;AAC9D,GAF+B;;;ACkBxB,SAAS,mBAAmB,MAAiC;AAClE,QAAM,UAAU,KAAK,MAAM,gBAAgB;AAC3C,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,MACL;AAAA,MACA,UAAU,CAAC;AAAA,IACb;AAAA,EACF;AAEA,MAAI,SACG,KAAK,QAAQ,CAAC,GAAG;AAAA;AAAA;AAAA,IAGpB,QAAa;AAAA,EACf,CAAC,KAAK,CAAC;AAGT,WAAS,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC;AAE1E,QAAM,WAAgC,CAAC;AAGvC,MAAI,OAAO,aAAa;AACtB,aAAS,cAAc,OAAO,YAAY,SAAS;AAAA,EACrD;AACA,MAAI,OAAO,OAAO;AAChB,aAAS,QAAQ,OAAO,MAAM,SAAS;AAAA,EACzC;AACA,MAAI,OAAO,QAAQ;AACjB,aAAS,SAAS,OAAO;AAAA,EAC3B;AAEA,SAAO;AAAA,IACL,MAAM,KAAK,MAAM,QAAQ,CAAC,EAAE,MAAM;AAAA,IAClC;AAAA,EACF;AACF;AApCgB;;;AClBhB,IAAM,cAAc,wBAAC,SAAiB;AACpC,SACE,KAEG,QAAQ,UAAU,IAAI,EAEtB;AAAA,IACC;AAAA,IACA,CAAC,OAAO,KAAK,eAAe,MAAM,MAAM,WAAW,QAAQ,eAAe,OAAO,IAAI;AAAA,EACvF;AAEN,GAXoB;AAapB,IAAM,qBAAqB,wBAAC,SAAiB;AAC3C,QAAM,EAAE,MAAM,SAAS,IAAI,mBAAmB,IAAI;AAClD,QAAM,EAAE,aAAa,OAAO,SAAS,CAAC,EAAE,IAAI;AAC5C,MAAI,aAAa;AAEf,QAAI,CAAC,OAAO,OAAO;AACjB,aAAO,QAAQ,CAAC;AAAA,IAClB;AACA,WAAO,MAAM,cAAc;AAAA,EAC7B;AAEA,SAAO,EAAE,OAAO,QAAQ,KAAK;AAC/B,GAZ2B;AAc3B,IAAM,oBAAoB,wBAAC,SAAiB;AAC1C,QAAM,gBAAgB,cAAM,WAAW,IAAI,KAAK,CAAC;AACjD,QAAM,iBAAiB,cAAM,gBAAgB,MAAM,MAAM;AACzD,MAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,kBAAc,OAAO,eAAe,KAAK,CAAC,EAAE,KAAK,MAAM,SAAS,MAAM;AAAA,EACxE,WAAW,gBAAgB,SAAS,QAAQ;AAC1C,kBAAc,OAAO;AAAA,EACvB;AACA,SAAO;AAAA,IACL,MAAM,iBAAiB,IAAI;AAAA,IAC3B,WAAW;AAAA,EACb;AACF,GAZ0B;AAoBnB,SAAS,kBAAkB,MAAc;AAC9C,QAAM,cAAc,YAAY,IAAI;AACpC,QAAM,oBAAoB,mBAAmB,WAAW;AACxD,QAAM,kBAAkB,kBAAkB,kBAAkB,IAAI;AAChE,QAAM,SAAS,cAAc,kBAAkB,QAAQ,gBAAgB,SAAS;AAChF,SAAO,gBAAgB,gBAAgB,IAAI;AAC3C,SAAO;AAAA,IACL;AAAA,IACA,OAAO,kBAAkB;AAAA,IACzB;AAAA,EACF;AACF;AAXgB;;;ACpDT,SAAS,SAAS,KAAa;AAEpC,QAAM,YAAY,IAAI,YAAY,EAAE,OAAO,GAAG;AAC9C,QAAM,UAAU,MAAM,KAAK,WAAW,CAAC,SAAS,OAAO,cAAc,IAAI,CAAC,EAAE,KAAK,EAAE;AACnF,SAAO,KAAK,OAAO;AACrB;AALgB;;;AP8ChB,IAAM,iBAAiB;AACvB,IAAM,8BACJ;AAEF,IAAM,uBAAuB;AAC7B,IAAM,qBAAqB;AAE3B,IAAM,gBAAgB;AACtB,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AAIxB,IAAM,eAAe;AACrB,IAAM,gBAAgB;AACtB,IAAM,gBAAgB;AACtB,IAAM,oBAAoB;AAC1B,IAAM,sBAAsB;AAC5B,IAAM,2BAA2B;AAGjC,IAAM,iBAAiB,CAAC,eAAe;AACvC,IAAM,iBAAiB,CAAC,mBAAmB;AAE3C,SAAS,qBAAqB,MAAc;AAC1C,QAAM,YAAY,kBAAkB,IAAI;AACxC,EAAU,MAAM;AAChB,EAAU,aAAa,UAAU,UAAU,CAAC,CAAC;AAC7C,SAAO;AACT;AALS;AAmBT,eAAe,MAAM,MAAc,cAA2D;AAC5F,cAAY;AACZ,MAAI;AACF,UAAM,EAAE,MAAM,OAAO,IAAI,qBAAqB,IAAI;AAClD,UAAMG,WAAU,MAAM,mBAAmB,IAAI;AAC7C,WAAO,EAAE,aAAaA,SAAQ,MAAM,OAAO;AAAA,EAC7C,SAAS,OAAO;AACd,QAAI,cAAc,gBAAgB;AAChC,aAAO;AAAA,IACT;AACA,UAAM;AAAA,EACR;AACF;AAZe;AAsBR,IAAM,qBAAqB,wBAChC,UACA,SACA,aAAuB,CAAC,MACb;AACX,QAAM,mBAAmB,YAAY,KAAK,WAAW,KAAK,eAAe,CAAC,gBAAgB;AAC1F,SAAO,IAAI,QAAQ,IAAI,OAAO,IAAI,gBAAgB;AACpD,GAPkC;AAgB3B,IAAM,kBAAkB,wBAC7B,QACA,YAAkE,oBAAI,IAAI,MAC/D;AACX,QAAM,YAAY,IAAI,cAAc;AAKpC,MAAI,OAAO,eAAe,QAAW;AACnC,cAAU;AAAA,MACR,kCAAkC,OAAO,UAAU;AAAA,MACnD,UAAU,SAAS;AAAA,IACrB;AAAA,EACF;AACA,MAAI,OAAO,kBAAkB,QAAW;AACtC,cAAU;AAAA,MACR,sCAAsC,OAAO,aAAa;AAAA,MAC1D,UAAU,SAAS;AAAA,IACrB;AAAA,EACF;AAGA,MAAI,qBAAqB,KAAK;AAC5B,UAAM,aAAa,uBAAuB,MAAM;AAEhD,UAAM,kBAAkB,CAAC,OAAO,MAAM;AACtC,UAAM,mBAAmB,CAAC,QAAQ,WAAW,WAAW,UAAU,MAAM;AAExE,UAAM,cAAc,aAAa,kBAAkB;AAGnD,cAAU,QAAQ,CAAC,kBAAkB;AAEnC,UAAI,CAAC,QAAQ,cAAc,MAAM,GAAG;AAClC,oBAAY,QAAQ,CAAC,eAAe;AAClC,oBAAU;AAAA,YACR,mBAAmB,cAAc,IAAI,YAAY,cAAc,MAAM;AAAA,YACrE,UAAU,SAAS;AAAA,UACrB;AAAA,QACF,CAAC;AAAA,MACH;AAEA,UAAI,CAAC,QAAQ,cAAc,UAAU,GAAG;AACtC,kBAAU;AAAA,UACR;AAAA,YACE,cAAc;AAAA,YACd;AAAA,aACC,eAAe,cAAc,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,SAAS,MAAM,CAAC;AAAA,UACzE;AAAA,UACA,UAAU,SAAS;AAAA,QACrB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,YAAY;AAChB,MAAI,OAAO,aAAa,QAAW;AACjC,QAAI,OAAO,UAAU,gBAAgB,YAAY;AAC/C,YAAM,qBAAqB,IAAI,cAAc;AAC7C,yBAAmB,YAAY,OAAO,QAAQ;AAC9C,kBAAY,sBAAsB,kBAAkB,IAAI;AAAA,IAC1D,OAAO;AAKL,mBAAa,GAAG,OAAO,QAAQ;AAAA;AAAA,IACjC;AAAA,EACF;AAEA,SAAO,YAAY,sBAAsB,SAAS;AACpD,GAxE+B;AA0F/B,IAAM,aAAa,wBAAC,WAAyB,QAAgB;AAC3D,SAAO;AAAA,IACL,QAAQ,GAAG,SAAS,IAAI,GAAG,GAAG;AAAA,IAC9B,WAAW;AAAA,MACT,gCAAS,aAAa,SAAS,QAAQ,WAAW,WAAW;AAW3D,YAAI,QAAQ,SAAS,UAAU,MAAM,QAAQ,QAAQ,KAAK,GAAG;AAC3D,cAAI,QAAQ,UAAU,QAAQ,OAAO,SAAS,WAAW;AAIvD;AAAA,UACF;AACA,kBAAQ,QAAQ,QAAQ,MAAM,IAAI,CAAC,SAAS;AAC1C,gBAAI,CAAC,KAAK,WAAW,SAAS,GAAG;AAC/B,qBAAO,GAAG,SAAS,IAAI,IAAI;AAAA,YAC7B;AACA,mBAAO;AAAA,UACT,CAAC;AAAA,QACH,WAAW,QAAQ,KAAK,WAAW,GAAG,GAAG;AAYvC,gBAAM,gBAAgB;AAAA,YACpB;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AACA,gBAAM,iBAAiB;AAAA,YACrB,GAAG;AAAA,YACH;AAAA;AAAA,UACF;AACA,cAAI,CAAC,eAAe,SAAS,QAAQ,IAAuC,GAAG;AAC7E,gBAAI,KAAK,gCAAgC,QAAQ,IAAI,WAAW;AAChE,oBAAQ,OAAO;AAAA,UACjB;AAAA,QACF;AAAA,MACF,GArDA;AAAA,MAsDA;AAAA,IACF,CAAC;AAAA,EACH;AACF,GA7DmB;AA+DZ,IAAM,mBAAmB,wBAC9B,QACA,WACA,WAEA,UACW;AACX,QAAM,gBAAgB,gBAAgB,QAAQ,SAAS;AACvD,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,IACA,EAAE,GAAG,OAAO,gBAAgB,OAAO,OAAO,OAAO,MAAM,OAAO,KAAK;AAAA,IACnE;AAAA,EACF;AACA,SAAO,WAAW,OAAO,SAAS;AACpC,GAfgC;AAyBzB,IAAM,iBAAiB,wBAC5B,UAAU,IACV,eACA,uBACW;AACX,MAAI,eAAe;AAGnB,MAAI,CAAC,sBAAsB,CAAC,eAAe;AACzC,mBAAe,aAAa;AAAA,MAC1B;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,iBAAe,eAAe,YAAY;AAG1C,iBAAe,aAAa,QAAQ,SAAS,OAAO;AAEpD,SAAO;AACT,GArB8B;AA8BvB,IAAM,gBAAgB,wBAAC,UAAU,IAAI,eAAuC;AACjF,QAAM,SAAS,YAAY,SAAS,SAAS,SACzC,WAAW,QAAQ,QAAQ,SAAS,OACpC;AACJ,QAAM,mBAAmB,SAAS,gBAAgB,iBAAiB,KAAK,OAAO,SAAS;AACxF,SAAO,wBAAwB,YAAY,WAAW,MAAM,IAAI,aAAa,8CAA8C,gBAAgB,cAAc,mBAAmB;AAAA,IAC1K,wBAAwB;AAAA;AAE5B,GAR6B;AAuBtB,IAAM,gBAAgB,wBAC3B,YACAC,MACA,gBACA,UACA,aACG;AACH,QAAM,eAAe,WAAW,OAAO,KAAK;AAC5C,eAAa,KAAK,MAAM,cAAc;AACtC,MAAI,UAAU;AACZ,iBAAa,KAAK,SAAS,QAAQ;AAAA,EACrC;AAEA,QAAM,UAAU,aACb,OAAO,KAAK,EACZ,KAAK,MAAMA,IAAE,EACb,KAAK,SAAS,MAAM,EACpB,KAAK,SAAS,aAAa;AAC9B,MAAI,UAAU;AACZ,YAAQ,KAAK,eAAe,QAAQ;AAAA,EACtC;AAEA,UAAQ,OAAO,GAAG;AAClB,SAAO;AACT,GAxB6B;AAkC7B,SAAS,gBACP,YACA,UACA;AACA,SAAO,WACJ,OAAO,QAAQ,EACf,KAAK,MAAM,QAAQ,EACnB,KAAK,SAAS,4BAA4B,EAC1C,KAAK,WAAW,EAAE;AACvB;AATS;AAmBF,IAAM,yBAAyB,wBACpC,KACAA,MACA,OACA,aACG;AAEH,MAAI,eAAeA,IAAE,GAAG,OAAO;AAG/B,MAAI,eAAe,KAAK,GAAG,OAAO;AAClC,MAAI,eAAe,QAAQ,GAAG,OAAO;AACvC,GAZsC;AAoBtC,IAAM,SAAS,sCACbA,MACA,MACA,sBACuB;AACvB,cAAY;AAEZ,QAAM,YAAY,qBAAqB,IAAI;AAC3C,SAAO,UAAU;AAEjB,QAAM,SAAmB,UAAU;AACnC,MAAI,MAAM,MAAM;AAGhB,MAAI,KAAK,UAAU,QAAQ,eAAe,iBAAiB;AACzD,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,IAAIA,IAAE;AACzB,QAAM,WAAW,MAAMA;AACvB,QAAM,oBAAoB,MAAM;AAChC,QAAM,iBAAiB,MAAMA;AAC7B,QAAM,0BAA0B,MAAM;AAEtC,QAAM,qBAAqB,6BAAM;AAG/B,UAAM,qBAAqB,cAAc,oBAAoB;AAC7D,UAAM,OAAO,OAAO,kBAAkB,EAAE,KAAK;AAC7C,QAAI,QAAQ,YAAY,MAAM;AAC5B,WAAK,OAAO;AAAA,IACd;AAAA,EACF,GAR2B;AAU3B,MAAI,OAAgE,OAAO,SAAS,IAAI;AAExF,QAAM,cAAc,OAAO,kBAAkB;AAC7C,QAAM,uBAAuB,OAAO,kBAAkB;AAEtD,QAAM,aAAa,OAAO;AAM1B,MAAI,yBAAyB,QAAW;AACtC,QAAI,sBAAsB;AACxB,2BAAqB,YAAY;AAAA,IACnC;AAEA,QAAI,aAAa;AAEf,YAAM,SAAS,gBAAgB,OAAO,oBAAoB,GAAG,QAAQ;AACrE,aAAO,OAAO,OAAO,MAAM,EAAE,CAAC,EAAE,gBAAiB,IAAI;AACrD,WAAK,KAAK,EAAG,MAAM,SAAS;AAAA,IAC9B,OAAO;AACL,aAAO,OAAO,oBAAoB;AAAA,IACpC;AACA,kBAAc,MAAMA,MAAI,gBAAgB,gBAAgB,UAAU,IAAI,eAAe;AAAA,EACvF,OAAO;AAIL,2BAAuB,UAAUA,MAAI,gBAAgB,QAAQ;AAK7D,QAAI,aAAa;AAEf,YAAM,SAAS,gBAAgB,OAAO,SAAS,IAAI,GAAG,QAAQ;AAC9D,aAAO,OAAO,OAAO,MAAM,EAAE,CAAC,EAAE,gBAAiB,IAAI;AACrD,WAAK,KAAK,EAAG,MAAM,SAAS;AAAA,IAC9B,OAAO;AACL,aAAO,OAAO,MAAM;AAAA,IACtB;AAEA,kBAAc,MAAMA,MAAI,cAAc;AAAA,EACxC;AAMA,MAAI;AACJ,MAAI;AAEJ,MAAI;AACF,WAAO,MAAM,QAAQ,SAAS,MAAM,EAAE,OAAO,UAAU,MAAM,CAAC;AAAA,EAChE,SAAS,OAAO;AACd,QAAI,OAAO,wBAAwB;AACjC,yBAAmB;AACnB,YAAM;AAAA,IACR;AACA,WAAO,MAAM,QAAQ,SAAS,OAAO;AACrC,gCAA4B;AAAA,EAC9B;AAGA,QAAM,UAAU,KAAK,OAAuB,uBAAuB,EAAE,KAAK;AAC1E,QAAM,cAAc,KAAK;AAMzB,QAAM,MAAM,QAAQ;AACpB,QAAM,aAAa,IAAI;AACvB,QAAM,mBAAmB,KAAK,SAAS,aAAa,MAAM,IAAI;AAE9D,QAAM,QAAQ,iBAAiB,QAAQ,aAAa,kBAAkB,UAAU;AAEhF,QAAM,SAAS,SAAS,cAAc,OAAO;AAC7C,SAAO,YAAY;AACnB,MAAI,aAAa,QAAQ,UAAU;AAInC,MAAI;AACF,UAAM,KAAK,SAAS,KAAK,MAAMA,MAAI,WAAkB,IAAI;AAAA,EAC3D,SAAS,GAAG;AACV,QAAI,OAAO,wBAAwB;AACjC,yBAAmB;AAAA,IACrB,OAAO;AACL,4BAAc,KAAK,MAAMA,MAAI,SAAgB;AAAA,IAC/C;AACA,UAAM;AAAA,EACR;AAGA,QAAM,UAAU,KAAK,OAAsB,GAAG,uBAAuB,MAAM;AAC3E,QAAM,YAAgC,KAAK,GAAG,cAAc;AAC5D,QAAM,YAAgC,KAAK,GAAG,oBAAoB;AAClE,cAAY,aAAa,SAAS,WAAW,SAAS;AAGtD,OAAK,OAAO,QAAQA,IAAE,IAAI,EAAE,UAAU,mBAAmB,EAAE,KAAK,SAAS,eAAe;AAGxF,MAAI,UAAkB,KAAK,OAAuB,uBAAuB,EAAE,KAAK,EAAG;AAEnF,MAAI,MAAM,8BAA8B,OAAO,mBAAmB;AAClE,YAAU,eAAe,SAAS,aAAa,SAAS,OAAO,mBAAmB,CAAC;AAEnF,MAAI,aAAa;AACf,UAAM,QAAQ,KAAK,OAAsB,0BAA0B,MAAM,EAAE,KAAK;AAChF,cAAU,cAAc,SAAS,KAAK;AAAA,EACxC,WAAW,CAAC,sBAAsB;AAEhC,cAAU,UAAU,SAAS,SAAS;AAAA,MACpC,UAAU;AAAA,MACV,UAAU;AAAA,MACV,yBAAyB,EAAE,eAAe,KAAK;AAAA,IACjD,CAAC;AAAA,EACH;AAEA,kBAAgB;AAEhB,MAAI,2BAA2B;AAC7B,UAAM;AAAA,EACR;AAEA,qBAAmB;AAEnB,SAAO;AAAA,IACL;AAAA,IACA,KAAK;AAAA,IACL,eAAe,KAAK,GAAG;AAAA,EACzB;AACF,GAzKe;AA8Kf,SAAS,WAAW,cAA6B,CAAC,GAAG;AACnD,QAAM,UAAyB,wBAAgB,CAAC,GAAG,WAAW;AAE9D,MAAI,SAAS,cAAc,CAAC,QAAQ,gBAAgB,YAAY;AAC9D,QAAI,CAAC,QAAQ,gBAAgB;AAC3B,cAAQ,iBAAiB,CAAC;AAAA,IAC5B;AACA,YAAQ,eAAe,aAAa,QAAQ;AAAA,EAC9C;AAGA,EAAU,yBAAyB,OAAO;AAE1C,MAAI,SAAS,SAAS,QAAQ,SAAS,gBAAO;AAE5C,YAAQ,iBAAiB,eAAM,QAAQ,KAA2B,EAAE;AAAA,MAClE,QAAQ;AAAA,IACV;AAAA,EACF,WAAW,SAAS;AAClB,YAAQ,iBAAiB,eAAM,QAAQ,kBAAkB,QAAQ,cAAc;AAAA,EACjF;AAEA,QAAM,SACJ,OAAO,YAAY,WAAqB,cAAc,OAAO,IAAc,cAAc;AAE3F,cAAY,OAAO,QAAQ;AAC3B,cAAY;AACd;AA3BS;AA6BT,IAAM,qBAAqB,wBAAC,MAAc,WAA2C,CAAC,MAAM;AAC1F,QAAM,EAAE,KAAK,IAAI,kBAAkB,IAAI;AACvC,SAAO,QAAQ,SAAS,MAAM,QAAQ;AACxC,GAH2B;AAa3B,SAAS,YACP,aACA,SACA,WACA,WACM;AACN,qBAAmB,SAAS,WAAW;AACvC,6BAA2B,SAAS,WAAW,WAAW,QAAQ,KAAK,IAAI,CAAC;AAC9E;AARS;AAaF,IAAM,aAAa,OAAO,OAAO;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,6BAAM;AACX,IAAU,MAAM;AAAA,EAClB,GAFO;AAAA,EAGP,aAAa,6BAAM;AACjB,IAAU,MAAgB,aAAa;AAAA,EACzC,GAFa;AAAA,EAGb;AACF,CAAC;AAED,YAAsB,UAAU,EAAE,QAAQ;AAChC,MAAgB,UAAU,CAAC;;;ArCxmBrC,IAAM,cAAc,wBAAC,OAAgB,QAAyB,eAAoC;AAChG,MAAI,KAAK,KAAK;AACd,MAAI,gBAAgB,KAAK,GAAG;AAG1B,QAAI,YAAY;AACd,iBAAW,MAAM,KAAK,MAAM,IAAI;AAAA,IAClC;AACA,WAAO,KAAK,EAAE,GAAG,OAAO,SAAS,MAAM,KAAK,MAAM,CAAC;AAAA,EACrD,OAAO;AAEL,QAAI,YAAY;AACd,iBAAW,KAAK;AAAA,IAClB;AACA,QAAI,iBAAiB,OAAO;AAC1B,aAAO,KAAK;AAAA,QACV,KAAK,MAAM;AAAA,QACX,SAAS,MAAM;AAAA,QACf,MAAM,MAAM;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF,GAvBoB;AA6CpB,IAAM,MAAM,sCACV,UAAsB;AAAA,EACpB,eAAe;AACjB,GACA;AACA,MAAI;AACF,UAAM,gBAAgB,OAAO;AAAA,EAC/B,SAAS,GAAG;AACV,QAAI,gBAAgB,CAAC,GAAG;AACtB,UAAI,MAAM,EAAE,GAAG;AAAA,IACjB;AACA,QAAI,QAAQ,YAAY;AACtB,cAAQ,WAAW,CAAW;AAAA,IAChC;AACA,QAAI,CAAC,QAAQ,gBAAgB;AAC3B,UAAI,MAAM,wDAAwD;AAClE,YAAM;AAAA,IACR;AAAA,EACF;AACF,GAnBY;AAqBZ,IAAM,kBAAkB,sCACtB,EAAE,oBAAoB,eAAe,MAAM,IAAwC;AAAA,EACjF,eAAe;AACjB,GACA;AACA,QAAM,OAAO,WAAW,UAAU;AAElC,MAAI,MAAM,GAAG,CAAC,qBAAqB,QAAQ,EAAE,yBAAyB;AAEtE,MAAI;AACJ,MAAI,OAAO;AACT,qBAAiB;AAAA,EACnB,WAAW,eAAe;AACxB,qBAAiB,SAAS,iBAAiB,aAAa;AAAA,EAC1D,OAAO;AACL,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,MAAI,MAAM,SAAS,eAAe,MAAM,WAAW;AACnD,MAAI,MAAM,gBAAgB,QAAW;AACnC,QAAI,MAAM,oBAAoB,MAAM,WAAW;AAC/C,eAAW,iBAAiB,EAAE,aAAa,MAAM,YAAY,CAAC;AAAA,EAChE;AAGA,QAAM,cAAc,IAAI,cAAM,gBAAgB,KAAK,kBAAkB,KAAK,mBAAmB;AAE7F,MAAI;AACJ,QAAM,SAA0B,CAAC;AAIjC,aAAW,WAAW,MAAM,KAAK,cAAc,GAAG;AAChD,QAAI,KAAK,wBAAwB,QAAQ,EAAE;AAE3C,QAAI,QAAQ,aAAa,gBAAgB,GAAG;AAC1C;AAAA,IACF;AACA,YAAQ,aAAa,kBAAkB,MAAM;AAE7C,UAAMC,OAAK,WAAW,YAAY,KAAK,CAAC;AAGxC,UAAM,QAAQ;AAGd,UAAM,OAAO,cAAM,aAAa,GAAG,CAAC,EACjC,KAAK,EACL,QAAQ,gBAAgB,OAAO;AAElC,UAAMC,QAAO,cAAM,WAAW,GAAG;AACjC,QAAIA,OAAM;AACR,UAAI,MAAM,2BAA2BA,KAAI;AAAA,IAC3C;AACA,QAAI;AACF,YAAM,EAAE,KAAK,cAAc,IAAI,MAAMC,QAAOF,MAAI,KAAK,OAAO;AAC5D,cAAQ,YAAY;AACpB,UAAI,oBAAoB;AACtB,cAAM,mBAAmBA,IAAE;AAAA,MAC7B;AACA,UAAI,eAAe;AACjB,sBAAc,OAAO;AAAA,MACvB;AAAA,IACF,SAAS,OAAO;AACd,kBAAY,OAAO,QAAQ,QAAQ,UAAU;AAAA,IAC/C;AAAA,EACF;AACA,MAAI,OAAO,SAAS,GAAG;AAErB,UAAM,OAAO,CAAC;AAAA,EAChB;AACF,GAvEwB;AA+ExB,IAAMG,cAAa,gCAAU,QAAuB;AAClD,aAAW,WAAW,MAAM;AAC9B,GAFmB;AAkBnB,IAAM,OAAO,sCACX,QACA,OACA,UACA;AACA,MAAI,KAAK,qDAAqD;AAC9D,MAAI,QAAQ;AACV,IAAAA,YAAW,MAAM;AAAA,EACnB;AACA,QAAM,aAAyB,EAAE,oBAAoB,UAAU,eAAe,WAAW;AACzF,MAAI,OAAO,UAAU,UAAU;AAC7B,eAAW,gBAAgB;AAAA,EAC7B,WAAW,OAAO;AAChB,QAAI,iBAAiB,aAAa;AAChC,iBAAW,QAAQ,CAAC,KAAK;AAAA,IAC3B,OAAO;AACL,iBAAW,QAAQ;AAAA,IACrB;AAAA,EACF;AACA,QAAM,IAAI,UAAU;AACtB,GApBa;AA2Bb,IAAM,2BAA2B,8BAC/B,UACA;AAAA,EACE,WAAW;AACb,IAEI,CAAC,MACF;AACH,cAAY;AACZ,6BAA2B,GAAG,QAAQ;AACtC,MAAI,aAAa,OAAO;AACtB,UAAM,uBAAuB;AAAA,EAC/B;AACF,GAbiC;AAoBjC,IAAM,gBAAgB,kCAAY;AAChC,MAAI,QAAQ,aAAa;AACvB,UAAM,EAAE,YAAY,IAAI,WAAW,UAAU;AAC7C,QAAI,aAAa;AACf,cAAQ,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,MAAM,gCAAgC,GAAG,CAAC;AAAA,IAC7E;AAAA,EACF;AACF,GAPsB;AAStB,IAAI,OAAO,aAAa,aAAa;AAInC,SAAO,iBAAiB,QAAQ,eAAe,KAAK;AACtD;AAgBA,IAAM,uBAAuB,gCAAU,mBAAkD;AACvF,UAAQ,aAAa;AACvB,GAF6B;AAI7B,IAAM,iBAA6C,CAAC;AACpD,IAAI,wBAAwB;AAC5B,IAAM,eAAe,mCAAY;AAC/B,MAAI,uBAAuB;AACzB;AAAA,EACF;AACA,0BAAwB;AACxB,SAAO,eAAe,SAAS,GAAG;AAChC,UAAM,IAAI,eAAe,MAAM;AAC/B,QAAI,GAAG;AACL,UAAI;AACF,cAAM,EAAE;AAAA,MACV,SAAS,GAAG;AACV,YAAI,MAAM,yBAAyB,CAAC;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AACA,0BAAwB;AAC1B,GAhBqB;AAqCrB,IAAMC,SAAiC,8BAAO,MAAM,iBAAiB;AACnE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAGtC,UAAM,cAAc,6BAClB,IAAI,QAAQ,CAAC,KAAK,QAAQ;AACxB,iBAAW,MAAM,MAAM,YAAY,EAAE;AAAA,QACnC,CAAC,MAAM;AAEL,cAAI,CAAC;AAEL,kBAAQ,CAAC;AAAA,QACX;AAAA,QACA,CAAC,MAAM;AACL,cAAI,MAAM,iBAAiB,CAAC;AAC5B,kBAAQ,aAAa,CAAC;AACtB,cAAI,CAAC;AACL,iBAAO,CAAC;AAAA,QACV;AAAA,MACF;AAAA,IACF,CAAC,GAhBiB;AAiBpB,mBAAe,KAAK,WAAW;AAC/B,iBAAa,EAAE,MAAM,MAAM;AAAA,EAC7B,CAAC;AACH,GAxBuC;AAiDvC,IAAMF,UAAmC,wBAACF,MAAI,MAAM,cAAc;AAChE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAGtC,UAAM,cAAc,6BAClB,IAAI,QAAQ,CAAC,KAAK,QAAQ;AACxB,iBAAW,OAAOA,MAAI,MAAM,SAAS,EAAE;AAAA,QACrC,CAAC,MAAM;AAEL,cAAI,CAAC;AAEL,kBAAQ,CAAC;AAAA,QACX;AAAA,QACA,CAAC,MAAM;AACL,cAAI,MAAM,iBAAiB,CAAC;AAC5B,kBAAQ,aAAa,CAAC;AACtB,cAAI,CAAC;AACL,iBAAO,CAAC;AAAA,QACV;AAAA,MACF;AAAA,IACF,CAAC,GAhBiB;AAiBpB,mBAAe,KAAK,WAAW;AAC/B,iBAAa,EAAE,MAAM,MAAM;AAAA,EAC7B,CAAC;AACH,GAxByC;AA+BzC,IAAM,gCAAgC,6BAA+C;AACnF,SAAO,OAAO,KAAK,SAAS,EAAE,IAAI,CAACA,UAAQ;AAAA,IACzC,IAAAA;AAAA,EACF,EAAE;AACJ,GAJsC;AA+BtC,IAAM,UAAmB;AAAA,EACvB,aAAa;AAAA,EACb;AAAA,EACA,OAAAI;AAAA,EACA,QAAAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAAC;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAO,kBAAQ;", + "names": ["diagram", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "detector_default", "detector", "loader", "diagram", "id", "renderer", "loader", "id", "diagram", "init", "diagram", "id", "id", "init", "render", "initialize", "parse"] +} diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.d.ts b/tools/ui/node_modules/mermaid/dist/mermaid.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fa7e88c645dcd1a0bf44b633283d1e72e68d6190 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.d.ts @@ -0,0 +1,184 @@ +/** + * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid + * functionality and to render the diagrams to svg code! + */ +import type { AsyncIconLoader, IconLoader, SyncIconLoader } from './rendering-util/icons.js'; +import { registerIconPacks } from './rendering-util/icons.js'; +import type { MermaidConfig } from './config.type.js'; +import { detectType } from './diagram-api/detectType.js'; +import type { ExternalDiagramDefinition, SVG, SVGGroup } from './diagram-api/types.js'; +import type { ParseErrorFunction } from './Diagram.js'; +import type { UnknownDiagramError } from './errors.js'; +import type { InternalHelpers } from './internals.js'; +import { mermaidAPI } from './mermaidAPI.js'; +import type { LayoutLoaderDefinition, RenderOptions } from './rendering-util/render.js'; +import { registerLayoutLoaders } from './rendering-util/render.js'; +import type { LayoutData } from './rendering-util/types.js'; +import type { ParseOptions, ParseResult, RenderResult } from './types.js'; +import type { DetailedError } from './utils.js'; +export type { AsyncIconLoader, DetailedError, ExternalDiagramDefinition, IconLoader, InternalHelpers, LayoutData, LayoutLoaderDefinition, MermaidConfig, ParseErrorFunction, ParseOptions, ParseResult, RenderOptions, RenderResult, SVG, SVGGroup, SyncIconLoader, UnknownDiagramError, }; +export interface RunOptions { + /** + * The query selector to use when finding elements to render. Default: `".mermaid"`. + */ + querySelector?: string; + /** + * The nodes to render. If this is set, `querySelector` will be ignored. + */ + nodes?: ArrayLike; + /** + * A callback to call after each diagram is rendered. + */ + postRenderCallback?: (id: string) => unknown; + /** + * If `true`, errors will be logged to the console, but not thrown. Default: `false` + */ + suppressErrors?: boolean; +} +/** + * ## run + * + * Function that goes through the document to find the chart definitions in there and render them. + * + * The function tags the processed attributes with the attribute data-processed and ignores found + * elements with the attribute already set. This way the init function can be triggered several + * times. + * + * ```mermaid + * graph LR; + * a(Find elements)-->b{Processed} + * b-->|Yes|c(Leave element) + * b-->|No |d(Transform) + * ``` + * + * Renders the mermaid diagrams + * + * @param options - Optional runtime configs + */ +declare const run: (options?: RunOptions) => Promise; +/** + * Used to set configurations for mermaid. + * This function should be called before the run function. + * @param config - Configuration object for mermaid. + */ +declare const initialize: (config: MermaidConfig) => void; +/** + * ## init + * + * @deprecated Use {@link initialize} and {@link run} instead. + * + * Renders the mermaid diagrams + * + * @param config - **Deprecated**, please set configuration in {@link initialize}. + * @param nodes - **Default**: `.mermaid`. One of the following: + * - A DOM Node + * - An array of DOM nodes (as would come from a jQuery selector) + * - A W3C selector, a la `.mermaid` + * @param callback - Called once for each rendered diagram's id. + */ +declare const init: (config?: MermaidConfig, nodes?: string | HTMLElement | NodeListOf, callback?: (id: string) => unknown) => Promise; +/** + * Used to register external diagram types. + * @param diagrams - Array of {@link ExternalDiagramDefinition}. + * @param opts - If opts.lazyLoad is false, the diagrams will be loaded immediately. + */ +declare const registerExternalDiagrams: (diagrams: ExternalDiagramDefinition[], { lazyLoad, }?: { + lazyLoad?: boolean; +}) => Promise; +/** + * ##contentLoaded Callback function that is called when page is loaded. This functions fetches + * configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the + * page. + */ +declare const contentLoaded: () => void; +/** + * ## setParseErrorHandler Alternative to directly setting parseError using: + * + * ```js + * mermaid.parseError = function(err,hash) { + * forExampleDisplayErrorInGui(err); // do something with the error + * }; + * ``` + * + * This is provided for environments where the mermaid object can't directly have a new member added + * to it (eg. dart interop wrapper). (Initially there is no parseError member of mermaid). + * + * @param parseErrorHandler - New parseError() callback. + */ +declare const setParseErrorHandler: (parseErrorHandler: (err: any, hash: any) => void) => void; +/** + * Parse the text and validate the syntax. + * @param text - The mermaid diagram definition. + * @param parseOptions - Options for parsing. @see {@link ParseOptions} + * @returns If valid, {@link ParseResult} otherwise `false` if parseOptions.suppressErrors is `true`. + * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set. + * + * @example + * ```js + * console.log(await mermaid.parse('flowchart \n a --> b')); + * // { diagramType: 'flowchart-v2' } + * console.log(await mermaid.parse('wrong \n a --> b', { suppressErrors: true })); + * // false + * console.log(await mermaid.parse('wrong \n a --> b', { suppressErrors: false })); + * // throws Error + * console.log(await mermaid.parse('wrong \n a --> b')); + * // throws Error + * ``` + */ +declare const parse: typeof mermaidAPI.parse; +/** + * Function that renders an SVG with a graph from a chart definition. Usage example below. + * + * ```javascript + * element = document.querySelector('#graphDiv'); + * const graphDefinition = 'graph TB\na-->b'; + * const { svg, bindFunctions } = await mermaid.render('graphDiv', graphDefinition); + * element.innerHTML = svg; + * bindFunctions?.(element); + * ``` + * + * @remarks + * Multiple calls to this function will be enqueued to run serially. + * + * @param id - The id for the SVG element (the element to be rendered) + * @param text - The text for the graph definition + * @param container - HTML element where the svg will be inserted. (Is usually element with the .mermaid class) + * If no svgContainingElement is provided then the SVG element will be appended to the body. + * Selector to element in which a div with the graph temporarily will be + * inserted. If one is provided a hidden div will be inserted in the body of the page instead. The + * element will be removed when rendering is completed. + * @returns Returns the SVG Definition and BindFunctions. + */ +declare const render: typeof mermaidAPI.render; +/** + * Gets the metadata for all registered diagrams. + * Currently only the id is returned. + * @returns An array of objects with the id of the diagram. + */ +declare const getRegisteredDiagramsMetadata: () => Pick[]; +export interface Mermaid { + startOnLoad: boolean; + parseError?: ParseErrorFunction; + /** + * @deprecated Use {@link parse} and {@link render} instead. Please [open a discussion](https://github.com/mermaid-js/mermaid/discussions) if your use case does not fit the new API. + * @internal + */ + mermaidAPI: typeof mermaidAPI; + parse: typeof parse; + render: typeof render; + /** + * @deprecated Use {@link initialize} and {@link run} instead. + */ + init: typeof init; + run: typeof run; + registerLayoutLoaders: typeof registerLayoutLoaders; + registerExternalDiagrams: typeof registerExternalDiagrams; + initialize: typeof initialize; + contentLoaded: typeof contentLoaded; + setParseErrorHandler: typeof setParseErrorHandler; + detectType: typeof detectType; + registerIconPacks: typeof registerIconPacks; + getRegisteredDiagramsMetadata: typeof getRegisteredDiagramsMetadata; +} +declare const mermaid: Mermaid; +export default mermaid; diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.esm.min.mjs b/tools/ui/node_modules/mermaid/dist/mermaid.esm.min.mjs new file mode 100644 index 0000000000000000000000000000000000000000..f3cb54322bb43f9701d4b4a89cd0ae1cb6a68990 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.esm.min.mjs @@ -0,0 +1,12 @@ +import{a as Zt}from"./chunks/mermaid.esm.min/chunk-LRIF4GLE.mjs";import{a as Wt,b as Kt}from"./chunks/mermaid.esm.min/chunk-7FYTHRHK.mjs";import{a as Qt}from"./chunks/mermaid.esm.min/chunk-VU6ZFW4Y.mjs";import"./chunks/mermaid.esm.min/chunk-7J6CGLKN.mjs";import"./chunks/mermaid.esm.min/chunk-KGFNY3KK.mjs";import"./chunks/mermaid.esm.min/chunk-5IMINLNL.mjs";import"./chunks/mermaid.esm.min/chunk-T2UQINTJ.mjs";import"./chunks/mermaid.esm.min/chunk-5VCL7Z4A.mjs";import"./chunks/mermaid.esm.min/chunk-UY5QBCOK.mjs";import{b as _t,d as Gt}from"./chunks/mermaid.esm.min/chunk-INKRHTLW.mjs";import{b as wt,d as Bt,m as Lt,o as Yt,p as $,q as qt,r as Xt}from"./chunks/mermaid.esm.min/chunk-QA3QBVWF.mjs";import"./chunks/mermaid.esm.min/chunk-KNLZD3CH.mjs";import{H as $t,J as Ht,K,L as at,M as Q,N as zt,O as Nt,Q as Et,R as Ut,a as Rt,da as G,ea as Z,i as et,l as Tt,m as xt,n as Ct,o as kt,p as jt,q as Ot,r as ht,s as It,t as _,u as Pt,v as W,x as Ft,y as Vt}from"./chunks/mermaid.esm.min/chunk-67TQ5CYL.mjs";import{b as f,c as yt,h as k}from"./chunks/mermaid.esm.min/chunk-7W6UQGC5.mjs";import{a as r}from"./chunks/mermaid.esm.min/chunk-AQ6EADP3.mjs";var Ke=r(t=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t),"detector"),Qe=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/c4Diagram-Y2BXMSZH.mjs");return{id:"c4",diagram:t}},"loader"),Ze={id:"c4",detector:Ke,loader:Qe},Jt=Ze;var tr="flowchart",Je=r((t,e)=>e?.flowchart?.defaultRenderer==="dagre-wrapper"||e?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(t),"detector"),ta=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/flowDiagram-H6V6AXG4.mjs");return{id:tr,diagram:t}},"loader"),ra={id:tr,detector:Je,loader:ta},rr=ra;var er="flowchart-v2",ea=r((t,e)=>e?.flowchart?.defaultRenderer==="dagre-d3"?!1:(e?.flowchart?.defaultRenderer==="elk"&&(e.layout="elk"),/^\s*graph/.test(t)&&e?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(t)),"detector"),aa=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/flowDiagram-H6V6AXG4.mjs");return{id:er,diagram:t}},"loader"),ia={id:er,detector:ea,loader:aa},ar=ia;var oa=r(t=>/^\s*erDiagram/.test(t),"detector"),na=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/erDiagram-L5TCEMPS.mjs");return{id:"er",diagram:t}},"loader"),sa={id:"er",detector:oa,loader:na},ir=sa;var or="gitGraph",ca=r(t=>/^\s*gitGraph/.test(t),"detector"),ma=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/gitGraphDiagram-S2ZK5IYY.mjs");return{id:or,diagram:t}},"loader"),pa={id:or,detector:ca,loader:ma},nr=pa;var sr="gantt",da=r(t=>/^\s*gantt/.test(t),"detector"),fa=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/ganttDiagram-JCBTUEKG.mjs");return{id:sr,diagram:t}},"loader"),ga={id:sr,detector:da,loader:fa},cr=ga;var mr="info",la=r(t=>/^\s*info/.test(t),"detector"),ua=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/infoDiagram-3YFTVSEB.mjs");return{id:mr,diagram:t}},"loader"),pr={id:mr,detector:la,loader:ua};var Da=r(t=>/^\s*pie/.test(t),"detector"),ya=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/pieDiagram-CU6KROY3.mjs");return{id:"pie",diagram:t}},"loader"),dr={id:"pie",detector:Da,loader:ya};var fr="quadrantChart",xa=r(t=>/^\s*quadrantChart/.test(t),"detector"),ha=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/quadrantDiagram-VICAPDV7.mjs");return{id:fr,diagram:t}},"loader"),Ea={id:fr,detector:xa,loader:ha},gr=Ea;var lr="xychart",wa=r(t=>/^\s*xychart(-beta)?/.test(t),"detector"),La=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/xychartDiagram-N2JHSOCM.mjs");return{id:lr,diagram:t}},"loader"),Sa={id:lr,detector:wa,loader:La},ur=Sa;var Dr="requirement",ba=r(t=>/^\s*requirement(Diagram)?/.test(t),"detector"),Ma=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/requirementDiagram-JXO7QTGE.mjs");return{id:Dr,diagram:t}},"loader"),va={id:Dr,detector:ba,loader:Ma},yr=va;var xr="sequence",Aa=r(t=>/^\s*sequenceDiagram/.test(t),"detector"),Ra=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/sequenceDiagram-VS2MUI6T.mjs");return{id:xr,diagram:t}},"loader"),Ta={id:xr,detector:Aa,loader:Ra},hr=Ta;var Er="class",Ca=r((t,e)=>e?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(t),"detector"),ka=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/classDiagram-KGZ6W3CR.mjs");return{id:Er,diagram:t}},"loader"),ja={id:Er,detector:Ca,loader:ka},wr=ja;var Lr="classDiagram",Oa=r((t,e)=>/^\s*classDiagram/.test(t)&&e?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(t),"detector"),Ia=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/classDiagram-v2-72OJOZXJ.mjs");return{id:Lr,diagram:t}},"loader"),Pa={id:Lr,detector:Oa,loader:Ia},Sr=Pa;var br="state",Fa=r((t,e)=>e?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(t),"detector"),Va=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/stateDiagram-7D4R322I.mjs");return{id:br,diagram:t}},"loader"),_a={id:br,detector:Fa,loader:Va},Mr=_a;var vr="stateDiagram",Ga=r((t,e)=>!!(/^\s*stateDiagram-v2/.test(t)||/^\s*stateDiagram/.test(t)&&e?.state?.defaultRenderer==="dagre-wrapper"),"detector"),$a=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/stateDiagram-v2-36443NZ5.mjs");return{id:vr,diagram:t}},"loader"),Ha={id:vr,detector:Ga,loader:$a},Ar=Ha;var Rr="journey",za=r(t=>/^\s*journey/.test(t),"detector"),Na=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/journeyDiagram-M6C3CM3L.mjs");return{id:Rr,diagram:t}},"loader"),Ua={id:Rr,detector:za,loader:Na},Tr=Ua;var Ba=r((t,e,a)=>{f.debug(`rendering svg for syntax error +`);let i=Zt(e),o=i.append("g");i.attr("viewBox","0 0 2412 512"),Nt(i,100,512,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${a}`)},"draw"),St={draw:Ba},Cr=St;var Ya={db:{},renderer:St,parser:{parse:r(()=>{},"parse")}},kr=Ya;var jr="flowchart-elk",qa=r((t,e={})=>/^\s*flowchart-elk/.test(t)||/^\s*(flowchart|graph)/.test(t)&&e?.flowchart?.defaultRenderer==="elk"?(e.layout="elk",!0):!1,"detector"),Xa=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/flowDiagram-H6V6AXG4.mjs");return{id:jr,diagram:t}},"loader"),Wa={id:jr,detector:qa,loader:Xa},Or=Wa;var Ir="timeline",Ka=r(t=>/^\s*timeline/.test(t),"detector"),Qa=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/timeline-definition-O6YCAMPW.mjs");return{id:Ir,diagram:t}},"loader"),Za={id:Ir,detector:Ka,loader:Qa},Pr=Za;var Fr="mindmap",Ja=r(t=>/^\s*mindmap/.test(t),"detector"),ti=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/mindmap-definition-2TDM6QVE.mjs");return{id:Fr,diagram:t}},"loader"),ri={id:Fr,detector:Ja,loader:ti},Vr=ri;var _r="kanban",ei=r(t=>/^\s*kanban/.test(t),"detector"),ai=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/kanban-definition-75IXJCU3.mjs");return{id:_r,diagram:t}},"loader"),ii={id:_r,detector:ei,loader:ai},Gr=ii;var $r="sankey",oi=r(t=>/^\s*sankey(-beta)?/.test(t),"detector"),ni=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/sankeyDiagram-URQDO5SZ.mjs");return{id:$r,diagram:t}},"loader"),si={id:$r,detector:oi,loader:ni},Hr=si;var zr="packet",ci=r(t=>/^\s*packet(-beta)?/.test(t),"detector"),mi=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/diagram-QXG6HAR7.mjs");return{id:zr,diagram:t}},"loader"),Nr={id:zr,detector:ci,loader:mi};var Ur="radar",pi=r(t=>/^\s*radar-beta/.test(t),"detector"),di=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/diagram-3NCE3AQN.mjs");return{id:Ur,diagram:t}},"loader"),Br={id:Ur,detector:pi,loader:di};var Yr="block",fi=r(t=>/^\s*block(-beta)?/.test(t),"detector"),gi=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/blockDiagram-7IZFK4PR.mjs");return{id:Yr,diagram:t}},"loader"),li={id:Yr,detector:fi,loader:gi},qr=li;var Xr="treeView",ui=r(t=>/^\s*treeView-beta/.test(t),"detector"),Di=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/diagram-WEQXMOUZ.mjs");return{id:Xr,diagram:t}},"loader"),yi={id:Xr,detector:ui,loader:Di},Wr=yi;var Kr="architecture",xi=r(t=>/^\s*architecture/.test(t),"detector"),hi=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/architectureDiagram-UL44E2DR.mjs");return{id:Kr,diagram:t}},"loader"),Ei={id:Kr,detector:xi,loader:hi},Qr=Ei;var Zr="eventmodeling",wi=r(t=>/^\s*eventmodeling/.test(t),"detector"),Li=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/diagram-HNR7UZ2L.mjs");return{id:Zr,diagram:t}},"loader"),Si={id:Zr,detector:wi,loader:Li},Jr=Si;var te="ishikawa",bi=r(t=>/^\s*ishikawa(-beta)?\b/i.test(t),"detector"),Mi=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/ishikawaDiagram-BNXS4ZKH.mjs");return{id:te,diagram:t}},"loader"),re={id:te,detector:bi,loader:Mi};var ee="venn",vi=r(t=>/^\s*venn-beta/.test(t),"detector"),Ai=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/vennDiagram-MWXL3ELB.mjs");return{id:ee,diagram:t}},"loader"),Ri={id:ee,detector:vi,loader:Ai},ae=Ri;var ie="treemap",Ti=r(t=>/^\s*treemap/.test(t),"detector"),Ci=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/diagram-GF46GFSD.mjs");return{id:ie,diagram:t}},"loader"),oe={id:ie,detector:Ti,loader:Ci};var ne="wardley-beta",ki=r(t=>/^\s*wardley-beta/i.test(t),"detector"),ji=r(async()=>{let{diagram:t}=await import("./chunks/mermaid.esm.min/wardleyDiagram-CUQ6CDDI.mjs");return{id:ne,diagram:t}},"loader"),Oi={id:ne,detector:ki,loader:ji},se=Oi;var ce=!1,H=r(()=>{ce||(ce=!0,G("error",kr,t=>t.toLowerCase().trim()==="error"),G("---",{db:{clear:r(()=>{},"clear")},styles:{},renderer:{draw:r(()=>{},"draw")},parser:{parse:r(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:r(()=>null,"init")},t=>t.toLowerCase().trimStart().startsWith("---")),Q(Or,Vr,Qr),Q(Jt,Gr,Sr,wr,ir,cr,pr,dr,yr,hr,ar,rr,Pr,nr,Ar,Mr,Tr,gr,Hr,Nr,ur,qr,Jr,Wr,Br,re,oe,ae,se))},"addDiagrams");var me=r(async()=>{f.debug("Loading registered diagrams");let e=(await Promise.allSettled(Object.entries(K).map(async([a,{detector:i,loader:o}])=>{if(o)try{Z(a)}catch{try{let{diagram:n,id:m}=await o();G(m,n,i)}catch(n){throw f.error(`Failed to load external diagram with key ${a}. Removing from detectors.`),delete K[a],n}}}))).filter(a=>a.status==="rejected");if(e.length>0){f.error(`Failed to load ${e.length} external diagrams`);for(let a of e)f.error(a);throw new Error(`Failed to load ${e.length} external diagrams`)}},"loadRegisteredDiagrams");var z="comm",it="rule",ot="decl";var pe="@media",de="@import";var fe="@supports";var ge="@namespace",J="@keyframes";var nt="@layer",le="@scope";var bt=Math.abs,tt=String.fromCharCode;function st(t){return t.trim()}r(st,"trim");function N(t,e,a){return t.replace(e,a)}r(N,"replace");function ue(t,e,a){return t.indexOf(e,a)}r(ue,"indexof");function j(t,e){return t.charCodeAt(e)|0}r(j,"charat");function O(t,e,a){return t.slice(e,a)}r(O,"substr");function h(t){return t.length}r(h,"strlen");function ct(t){return t.length}r(ct,"sizeof");function U(t,e){return e.push(t),t}r(U,"append");var mt=1,B=1,De=0,w=0,D=0,q="";function pt(t,e,a,i,o,n,m,s){return{value:t,root:e,parent:a,type:i,props:o,children:n,line:mt,column:B,length:m,return:"",siblings:s}}r(pt,"node");function ye(){return D}r(ye,"char");function xe(){return D=w>0?j(q,--w):0,B--,D===10&&(B=1,mt--),D}r(xe,"prev");function L(){return D=w2||Y(D)>3?"":" "}r(we,"whitespace");function Le(t,e){for(;--e&&L()&&!(D<48||D>102||D>57&&D<65||D>70&&D<97););return dt(t,rt()+(e<6&&I()==32&&L()==32))}r(Le,"escaping");function Mt(t){for(;L();)switch(D){case t:return w;case 34:case 39:t!==34&&t!==39&&Mt(D);break;case 40:t===41&&Mt(t);break;case 92:L();break}return w}r(Mt,"delimiter");function Se(t,e){for(;L()&&t+D!==57;)if(t+D===84&&I()===47)break;return"/*"+dt(e,w-1)+"*"+tt(t===47?t:L())}r(Se,"commenter");function be(t){for(;!Y(I());)L();return dt(t,w)}r(be,"identifier");function Ae(t){return Ee(gt("",null,null,null,[""],t=he(t),0,[0],t))}r(Ae,"compile");function gt(t,e,a,i,o,n,m,s,c){for(var g=0,y=0,p=m,x=0,A=0,S=0,l=1,T=1,b=1,u=0,M="",C=o,R=n,E=i,d=M;T;)switch(S=u,u=L()){case 40:if(S!=108&&j(d,p-1)==58){ue(d+=N(ft(u),"&","&\f"),"&\f",bt(g?s[g-1]:0))!=-1&&(b=-1);break}case 34:case 39:case 91:d+=ft(u);break;case 9:case 10:case 13:case 32:d+=we(S);break;case 92:d+=Le(rt()-1,7);continue;case 47:switch(I()){case 42:case 47:U(Pi(Se(L(),rt()),e,a,c),c),(Y(S||1)==5||Y(I()||1)==5)&&h(d)&&O(d,-1,void 0)!==" "&&(d+=" ");break;default:d+="/"}break;case 123*l:s[g++]=h(d)*b;case 125*l:case 59:case 0:switch(u){case 0:case 125:T=0;case 59+y:b==-1&&(d=N(d,/\f/g,"")),A>0&&(h(d)-p||l===0&&S===47)&&U(A>32?ve(d+";",i,a,p-1,c):ve(N(d," ","")+";",i,a,p-2,c),c);break;case 59:d+=";";default:if(U(E=Me(d,e,a,g,y,o,s,M,C=[],R=[],p,n),n),u===123)if(y===0)gt(d,e,E,E,C,n,p,s,R);else{switch(x){case 99:if(j(d,3)===110)break;case 108:if(j(d,2)===97)break;default:y=0;case 100:case 109:case 115:}y?gt(t,E,E,i&&U(Me(t,E,E,0,0,o,s,M,o,C=[],p,R),R),o,R,p,s,i?C:R):gt(d,E,E,E,[""],R,0,s,R)}}g=y=A=0,l=b=1,M=d="",p=m;break;case 58:p=1+h(d),A=S;default:if(l<1){if(u==123)--l;else if(u==125&&l++==0&&xe()==125)continue}switch(d+=tt(u),u*l){case 38:b=y>0?1:(d+="\f",-1);break;case 44:s[g++]=(h(d)-1)*b,b=1;break;case 64:I()===45&&(d+=ft(L())),x=I(),y=p=h(M=d+=be(rt())),u++;break;case 45:S===45&&h(d)==2&&(l=0)}}return n}r(gt,"parse");function Me(t,e,a,i,o,n,m,s,c,g,y,p){for(var x=o-1,A=o===0?n:[""],S=ct(A),l=0,T=0,b=0;l0?A[u]+" "+M:N(M,/&\f/g,A[u])))&&(c[b++]=C);return pt(t,e,a,o===0?it:s,c,g,y,p)}r(Me,"ruleset");function Pi(t,e,a,i){return pt(t,e,a,z,tt(ye()),O(t,2,-2),0,i)}r(Pi,"comment");function ve(t,e,a,i,o){return pt(t,e,a,ot,O(t,0,i),O(t,i+1,-1),i,o)}r(ve,"declaration");function lt(t,e){for(var a="",i=0;i{je.forEach(t=>{t()}),je=[]},"attachFunctions");var Ie=r(t=>t.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function Pe(t){let e=t.match($t);if(!e)return{text:t,metadata:{}};let a=Kt(e[1],{schema:Wt})??{};a=typeof a=="object"&&!Array.isArray(a)?a:{};let i={};return a.displayMode&&(i.displayMode=a.displayMode.toString()),a.title&&(i.title=a.title.toString()),a.config&&(i.config=a.config),{text:t.slice(e[0].length),metadata:i}}r(Pe,"extractFrontMatter");var _i=r(t=>t.replace(/\r\n?/g,` +`).replace(/<(\w+)([^>]*)>/g,(e,a,i)=>"<"+a+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),Gi=r(t=>{let{text:e,metadata:a}=Pe(t),{displayMode:i,title:o,config:n={}}=a;return i&&(n.gantt||(n.gantt={}),n.gantt.displayMode=i),{title:o,config:n,text:e}},"processFrontmatter"),$i=r(t=>{let e=$.detectInit(t)??{},a=$.detectDirective(t,"wrap");return Array.isArray(a)?e.wrap=a.some(({type:i})=>i==="wrap"):a?.type==="wrap"&&(e.wrap=!0),{text:Bt(t),directive:e}},"processDirectives");function vt(t){let e=_i(t),a=Gi(e),i=$i(a.text),o=Yt(a.config,i.directive);return t=Ie(i.text),{code:t,title:a.title,config:o}}r(vt,"preprocessDiagram");function Fe(t){let e=new TextEncoder().encode(t),a=Array.from(e,i=>String.fromCodePoint(i)).join("");return btoa(a)}r(Fe,"toBase64");var Hi=5e4,zi="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",Ni="sandbox",Ui="loose",Bi="http://www.w3.org/2000/svg",Yi="http://www.w3.org/1999/xlink",qi="http://www.w3.org/1999/xhtml",Xi="100%",Wi="100%",Ki="border:0;margin:0;",Qi="margin:0",Zi="allow-top-navigation-by-user-activation allow-popups",Ji='The "iframe" tag is not supported by your browser.',to=["foreignobject"],ro=["dominant-baseline"];function $e(t){let e=vt(t);return W(),Pt(e.config??{}),e}r($e,"processAndSetConfigs");async function eo(t,e){H();try{let{code:a,config:i}=$e(t);return{diagramType:(await He(a)).type,config:i}}catch(a){if(e?.suppressErrors)return!1;throw a}}r(eo,"parse");var Ve=r((t,e,a=[])=>{let i=Tt(`{ ${a.join(" !important; ")} !important; }`);return`.${t} ${e} ${i}`},"cssImportantStyles"),ao=r((t,e=new Map)=>{let a=new CSSStyleSheet;if(t.fontFamily!==void 0&&a.insertRule(`:root { --mermaid-font-family: ${t.fontFamily}}`,a.cssRules.length),t.altFontFamily!==void 0&&a.insertRule(`:root { --mermaid-alt-font-family: ${t.altFontFamily}}`,a.cssRules.length),e instanceof Map){let s=Ft(t)?["> *","span"]:["rect","polygon","ellipse","circle","path"];e.forEach(c=>{wt(c.styles)||s.forEach(g=>{a.insertRule(Ve(c.id,g,c.styles),a.cssRules.length)}),wt(c.textStyles)||a.insertRule(Ve(c.id,"tspan",(c?.textStyles||[]).map(g=>g.replace("color","fill"))),a.cssRules.length)})}let i="";if(t.themeCSS!==void 0)if(typeof a.replaceSync=="function"){let o=new CSSStyleSheet;o.replaceSync(t.themeCSS),i=Et(o)+` +`}else i+=`${t.themeCSS} +`;return i+Et(a)},"createCssStyles"),io=r((t,e)=>lt(Ae(`${t}{${e}}`),Te([r(function(i,o,n,m){if(i.type==="rule"&&Array.isArray(i.props)){if(i.parent&&i.parent.type===J)return;i.props=i.props.map(s=>s.startsWith(t)?s:`${t} ${s}`)}else i.type.startsWith("@")&&([...[pe,fe,nt,le,"@container","@starting-style"],J].includes(i.type)||(f.warn(`Removing unsupported at-rule ${i.type} from CSS`),i.type=z))},"addNamespace"),Re])),"compileCSS"),oo=r((t,e,a,i)=>{let o=ao(t,a),n=Ut(e,o,{...t.themeVariables,theme:t.theme,look:t.look},i);return io(i,n)},"createUserStyles"),no=r((t="",e,a)=>{let i=t;return!a&&!e&&(i=i.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),i=Xt(i),i=i.replace(/
/g,"
"),i},"cleanUpSvgCode"),so=r((t="",e)=>{let a=e?.viewBox?.baseVal?.height?e.viewBox.baseVal.height+"px":Wi,i=Fe(`${t}`);return``},"putIntoIFrame"),_e=r((t,e,a,i,o)=>{let n=t.append("div");n.attr("id",a),i&&n.attr("style",i);let m=n.append("svg").attr("id",e).attr("width","100%").attr("xmlns",Bi);return o&&m.attr("xmlns:xlink",o),m.append("g"),t},"appendDivSvgG");function Ge(t,e){return t.append("iframe").attr("id",e).attr("style","width: 100%; height: 100%;").attr("sandbox","")}r(Ge,"sandboxedIframe");var co=r((t,e,a,i)=>{t.getElementById(e)?.remove(),t.getElementById(a)?.remove(),t.getElementById(i)?.remove()},"removeExistingElements"),mo=r(async function(t,e,a){H();let i=$e(e);e=i.code;let o=_();f.debug(o),e.length>(o?.maxTextSize??Hi)&&(e=zi);let n=`#${t}`,m="i"+t,s="#"+m,c="d"+t,g="#"+c,y=r(()=>{let Dt=k(x?s:g).node();Dt&&"remove"in Dt&&Dt.remove()},"removeTempElements"),p=k(document.body),x=o.securityLevel===Ni,A=o.securityLevel===Ui,S=o.fontFamily;if(a!==void 0){if(a&&(a.innerHTML=""),x){let v=Ge(k(a),m);p=k(v.nodes()[0].contentDocument.body),p.node().style.margin="0"}else p=k(a);_e(p,t,c,`font-family: ${S}`,Yi)}else{if(co(document,t,c,m),x){let v=Ge(k(document.body),m);p=k(v.nodes()[0].contentDocument.body),p.node().style.margin="0"}else p=k("body");_e(p,t,c)}let l,T;try{l=await X.fromText(e,{title:i.title})}catch(v){if(o.suppressErrorRendering)throw y(),v;l=await X.fromText("error"),T=v}let b=p.select(g).node(),u=l.type,M=b.firstChild,C=M.firstChild,R=l.renderer.getClasses?.(e,l),E=oo(o,u,R,n),d=document.createElement("style");d.innerHTML=E,M.insertBefore(d,C);try{await l.renderer.draw(e,t,"11.15.0",l)}catch(v){throw o.suppressErrorRendering?y():Cr.draw(e,t,"11.15.0"),v}let qe=p.select(`${g} svg`),Xe=l.db.getAccTitle?.(),We=l.db.getAccDescription?.();fo(u,qe,Xe,We),p.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns",qi);let V=p.select(g).node().innerHTML;if(f.debug("config.arrowMarkerAbsolute",o.arrowMarkerAbsolute),V=no(V,x,Ct(o.arrowMarkerAbsolute)),x){let v=p.select(g+" svg").node();V=so(V,v)}else A||(V=Vt.sanitize(V,{ADD_TAGS:to,ADD_ATTR:ro,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(Oe(),T)throw T;return y(),{diagramType:u,svg:V,bindFunctions:l.db.bindFunctions}},"render");function po(t={}){let e=Rt({},t);e?.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables||(e.themeVariables={}),e.themeVariables.fontFamily=e.fontFamily),jt(e),e?.theme&&e.theme in et?e.themeVariables=et[e.theme].getThemeVariables(e.themeVariables):e&&(e.themeVariables=et.default.getThemeVariables(e.themeVariables));let a=typeof e=="object"?kt(e):ht();yt(a.logLevel),H()}r(po,"initialize");var He=r((t,e={})=>{let{code:a}=vt(t);return X.fromText(a,e)},"getDiagramFromText");function fo(t,e,a,i){Ce(e,t),ke(e,a,i,e.attr("id"))}r(fo,"addA11yInfo");var F=Object.freeze({render:mo,parse:eo,getDiagramFromText:He,initialize:po,getConfig:_,setConfig:It,getSiteConfig:ht,updateSiteConfig:Ot,reset:r(()=>{W()},"reset"),globalReset:r(()=>{W(xt)},"globalReset"),defaultConfig:xt});yt(_().logLevel);W(_());var go=r((t,e,a)=>{f.warn(t),Lt(t)?(a&&a(t.str,t.hash),e.push({...t,message:t.str,error:t})):(a&&a(t),t instanceof Error&&e.push({str:t.message,message:t.message,hash:t.name,error:t}))},"handleError"),ze=r(async function(t={querySelector:".mermaid"}){try{await lo(t)}catch(e){if(Lt(e)&&f.error(e.str),P.parseError&&P.parseError(e),!t.suppressErrors)throw f.error("Use the suppressErrors option to suppress these errors"),e}},"run"),lo=r(async function({postRenderCallback:t,querySelector:e,nodes:a}={querySelector:".mermaid"}){let i=F.getConfig();f.debug(`${t?"":"No "}Callback function found`);let o;if(a)o=a;else if(e)o=document.querySelectorAll(e);else throw new Error("Nodes and querySelector are both undefined");f.debug(`Found ${o.length} diagrams`),i?.startOnLoad!==void 0&&(f.debug("Start On Load: "+i?.startOnLoad),F.updateSiteConfig({startOnLoad:i?.startOnLoad}));let n=new $.InitIDGenerator(i.deterministicIds,i.deterministicIDSeed),m,s=[];for(let c of Array.from(o)){f.info("Rendering diagram: "+c.id);if(c.getAttribute("data-processed"))continue;c.setAttribute("data-processed","true");let g=`mermaid-${n.next()}`;m=c.innerHTML,m=Gt($.entityDecode(m)).trim().replace(//gi,"
");let y=$.detectInit(m);y&&f.debug("Detected early reinit: ",y);try{let{svg:p,bindFunctions:x}=await Ye(g,m,c);c.innerHTML=p,t&&await t(g),x&&x(c)}catch(p){go(p,s,P.parseError)}}if(s.length>0)throw s[0]},"runThrowsErrors"),Ne=r(function(t){F.initialize(t)},"initialize"),uo=r(async function(t,e,a){f.warn("mermaid.init is deprecated. Please use run instead."),t&&Ne(t);let i={postRenderCallback:a,querySelector:".mermaid"};typeof e=="string"?i.querySelector=e:e&&(e instanceof HTMLElement?i.nodes=[e]:i.nodes=e),await ze(i)},"init"),Do=r(async(t,{lazyLoad:e=!0}={})=>{H(),Q(...t),e===!1&&await me()},"registerExternalDiagrams"),Ue=r(function(){if(P.startOnLoad){let{startOnLoad:t}=F.getConfig();t&&P.run().catch(e=>f.error("Mermaid failed to initialize",e))}},"contentLoaded");if(typeof document<"u"){window.addEventListener("load",Ue,!1)}var yo=r(function(t){P.parseError=t},"setParseErrorHandler"),ut=[],At=!1,Be=r(async()=>{if(!At){for(At=!0;ut.length>0;){let t=ut.shift();if(t)try{await t()}catch(e){f.error("Error executing queue",e)}}At=!1}},"executeQueue"),xo=r(async(t,e)=>new Promise((a,i)=>{let o=r(()=>new Promise((n,m)=>{F.parse(t,e).then(s=>{n(s),a(s)},s=>{f.error("Error parsing",s),P.parseError?.(s),m(s),i(s)})}),"performCall");ut.push(o),Be().catch(i)}),"parse"),Ye=r((t,e,a)=>new Promise((i,o)=>{let n=r(()=>new Promise((m,s)=>{F.render(t,e,a).then(c=>{m(c),i(c)},c=>{f.error("Error parsing",c),P.parseError?.(c),s(c),o(c)})}),"performCall");ut.push(n),Be().catch(o)}),"render"),ho=r(()=>Object.keys(K).map(t=>({id:t})),"getRegisteredDiagramsMetadata"),P={startOnLoad:!0,mermaidAPI:F,parse:xo,render:Ye,init:uo,run:ze,registerExternalDiagrams:Do,registerLayoutLoaders:Qt,initialize:Ne,parseError:void 0,contentLoaded:Ue,setParseErrorHandler:yo,detectType:at,registerIconPacks:_t,getRegisteredDiagramsMetadata:ho},qc=P;export{qc as default}; +/*! Check if previously processed */ +/*! + * Wait for document loaded before starting the execution + */ diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.esm.min.mjs.map b/tools/ui/node_modules/mermaid/dist/mermaid.esm.min.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..8571fa6b1c5b6472a787f298463c17497fabd7fb --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.esm.min.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/diagrams/c4/c4Detector.ts", "../src/diagrams/flowchart/flowDetector.ts", "../src/diagrams/flowchart/flowDetector-v2.ts", "../src/diagrams/er/erDetector.ts", "../src/diagrams/git/gitGraphDetector.ts", "../src/diagrams/gantt/ganttDetector.ts", "../src/diagrams/info/infoDetector.ts", "../src/diagrams/pie/pieDetector.ts", "../src/diagrams/quadrant-chart/quadrantDetector.ts", "../src/diagrams/xychart/xychartDetector.ts", "../src/diagrams/requirement/requirementDetector.ts", "../src/diagrams/sequence/sequenceDetector.ts", "../src/diagrams/class/classDetector.ts", "../src/diagrams/class/classDetector-V2.ts", "../src/diagrams/state/stateDetector.ts", "../src/diagrams/state/stateDetector-V2.ts", "../src/diagrams/user-journey/journeyDetector.ts", "../src/diagrams/error/errorRenderer.ts", "../src/diagrams/error/errorDiagram.ts", "../src/diagrams/flowchart/elk/detector.ts", "../src/diagrams/timeline/detector.ts", "../src/diagrams/mindmap/detector.ts", "../src/diagrams/kanban/detector.ts", "../src/diagrams/sankey/sankeyDetector.ts", "../src/diagrams/packet/detector.ts", "../src/diagrams/radar/detector.ts", "../src/diagrams/block/blockDetector.ts", "../src/diagrams/treeView/detector.ts", "../src/diagrams/architecture/architectureDetector.ts", "../src/diagrams/eventmodeling/detector.ts", "../src/diagrams/ishikawa/ishikawaDetector.ts", "../src/diagrams/venn/vennDetector.ts", "../src/diagrams/treemap/detector.ts", "../src/diagrams/wardley/wardleyDetector.ts", "../src/diagram-api/diagram-orchestration.ts", "../src/diagram-api/loadDiagram.ts", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Enum.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Utility.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Tokenizer.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Parser.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Serializer.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Middleware.js", "../src/accessibility.ts", "../src/Diagram.ts", "../src/interactionDb.ts", "../src/diagram-api/comments.ts", "../src/diagram-api/frontmatter.ts", "../src/preprocess.ts", "../src/utils/base64.ts", "../src/mermaidAPI.ts", "../src/mermaid.ts"], + "sourcesContent": ["import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'c4';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./c4Diagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'flowchart';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have conferred to only use new flow charts this function should always return false\n // as in not signalling true for a legacy flowchart\n if (\n config?.flowchart?.defaultRenderer === 'dagre-wrapper' ||\n config?.flowchart?.defaultRenderer === 'elk'\n ) {\n return false;\n }\n return /^\\s*graph/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./flowDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'flowchart-v2';\n\nconst detector: DiagramDetector = (txt, config) => {\n if (config?.flowchart?.defaultRenderer === 'dagre-d3') {\n return false;\n }\n\n if (config?.flowchart?.defaultRenderer === 'elk') {\n config.layout = 'elk';\n }\n\n // If we have configured to use dagre-wrapper then we should return true in this function for graph code thus making it use the new flowchart diagram\n if (/^\\s*graph/.test(txt) && config?.flowchart?.defaultRenderer === 'dagre-wrapper') {\n return true;\n }\n return /^\\s*flowchart/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./flowDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'er';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*erDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./erDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { DiagramDetector, DiagramLoader } from '../../diagram-api/types.js';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'gitGraph';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*gitGraph/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./gitGraphDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'gantt';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*gantt/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./ganttDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'info';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*info/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./infoDiagram.js');\n return { id, diagram };\n};\n\nexport const info: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'pie';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*pie/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./pieDiagram.js');\n return { id, diagram };\n};\n\nexport const pie: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'quadrantChart';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*quadrantChart/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./quadrantDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'xychart';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*xychart(-beta)?/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./xychartDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'requirement';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*requirement(Diagram)?/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./requirementDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'sequence';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*sequenceDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./sequenceDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'class';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have configured to use dagre-wrapper then we should never return true in this function\n if (config?.class?.defaultRenderer === 'dagre-wrapper') {\n return false;\n }\n // We have not opted to use the new renderer so we should return true if we detect a class diagram\n return /^\\s*classDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./classDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'classDiagram';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have configured to use dagre-wrapper then we should return true in this function for classDiagram code thus making it use the new class diagram\n if (/^\\s*classDiagram/.test(txt) && config?.class?.defaultRenderer === 'dagre-wrapper') {\n return true;\n }\n // We have not opted to use the new renderer so we should return true if we detect a class diagram\n return /^\\s*classDiagram-v2/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./classDiagram-v2.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'state';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have confirmed to only use new state diagrams this function should always return false\n // as in not signalling true for a legacy state diagram\n if (config?.state?.defaultRenderer === 'dagre-wrapper') {\n return false;\n }\n return /^\\s*stateDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./stateDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'stateDiagram';\n\nconst detector: DiagramDetector = (txt, config) => {\n if (/^\\s*stateDiagram-v2/.test(txt)) {\n return true;\n }\n if (/^\\s*stateDiagram/.test(txt) && config?.state?.defaultRenderer === 'dagre-wrapper') {\n return true;\n }\n return false;\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./stateDiagram-v2.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'journey';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*journey/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./journeyDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { SVG, SVGGroup } from '../../diagram-api/types.js';\nimport { log } from '../../logger.js';\nimport { selectSvgElement } from '../../rendering-util/selectSvgElement.js';\nimport { configureSvgSize } from '../../setupGraphViewbox.js';\n\n/**\n * Draws an info picture in the tag with id: id based on the graph definition in text.\n *\n * @param _text - Mermaid graph definition.\n * @param id - The text for the error\n * @param version - The version\n */\nexport const draw = (_text: string, id: string, version: string) => {\n log.debug('rendering svg for syntax error\\n');\n const svg: SVG = selectSvgElement(id);\n const g: SVGGroup = svg.append('g');\n\n svg.attr('viewBox', '0 0 2412 512');\n configureSvgSize(svg, 100, 512, true);\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z'\n );\n\n g.append('text') // text label for the x axis\n .attr('class', 'error-text')\n .attr('x', 1440)\n .attr('y', 250)\n .attr('font-size', '150px')\n .style('text-anchor', 'middle')\n .text('Syntax error in text');\n g.append('text') // text label for the x axis\n .attr('class', 'error-text')\n .attr('x', 1250)\n .attr('y', 400)\n .attr('font-size', '100px')\n .style('text-anchor', 'middle')\n .text(`mermaid version ${version}`);\n};\n\nexport const renderer = { draw };\n\nexport default renderer;\n", "import type { DiagramDefinition } from '../../diagram-api/types.js';\nimport { renderer } from './errorRenderer.js';\n\nconst diagram: DiagramDefinition = {\n db: {},\n renderer,\n parser: {\n parse: (): void => {\n return;\n },\n },\n};\n\nexport default diagram;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../../diagram-api/types.js';\n\nconst id = 'flowchart-elk';\n\nconst detector: DiagramDetector = (txt, config = {}): boolean => {\n if (\n // If diagram explicitly states flowchart-elk\n /^\\s*flowchart-elk/.test(txt) ||\n // If a flowchart/graph diagram has their default renderer set to elk\n (/^\\s*(flowchart|graph)/.test(txt) && config?.flowchart?.defaultRenderer === 'elk')\n ) {\n config.layout = 'elk';\n return true;\n }\n return false;\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('../flowDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'timeline';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*timeline/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./timeline-definition.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\nconst id = 'mindmap';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*mindmap/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./mindmap-definition.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\nconst id = 'kanban';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*kanban/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./kanban-definition.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'sankey';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*sankey(-beta)?/.test(txt);\n};\n\nconst loader = async () => {\n const { diagram } = await import('./sankeyDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'packet';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*packet(-beta)?/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nexport const packet: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'radar';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*radar-beta/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nexport const radar: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'block';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*block(-beta)?/.test(txt);\n};\n\nconst loader = async () => {\n const { diagram } = await import('./blockDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { DiagramDetector, DiagramLoader } from '../../diagram-api/types.js';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'treeView';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*treeView-beta/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'architecture';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*architecture/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./architectureDiagram.js');\n return { id, diagram };\n};\n\nconst architecture: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default architecture;\n", "import type { DiagramDetector, DiagramLoader } from '../../diagram-api/types.js';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'eventmodeling';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*eventmodeling/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'ishikawa';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*ishikawa(-beta)?\\b/i.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./ishikawaDiagram.js');\n return { id, diagram };\n};\n\nexport const ishikawa: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'venn';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*venn-beta/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./vennDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'treemap';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*treemap/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nexport const treemap: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'wardley-beta';\n\nconst detector: DiagramDetector = (text) => {\n return /^\\s*wardley-beta/i.test(text);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./wardleyDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import c4 from '../diagrams/c4/c4Detector.js';\nimport flowchart from '../diagrams/flowchart/flowDetector.js';\nimport flowchartV2 from '../diagrams/flowchart/flowDetector-v2.js';\nimport er from '../diagrams/er/erDetector.js';\nimport git from '../diagrams/git/gitGraphDetector.js';\nimport gantt from '../diagrams/gantt/ganttDetector.js';\nimport { info } from '../diagrams/info/infoDetector.js';\nimport { pie } from '../diagrams/pie/pieDetector.js';\nimport quadrantChart from '../diagrams/quadrant-chart/quadrantDetector.js';\nimport xychart from '../diagrams/xychart/xychartDetector.js';\nimport requirement from '../diagrams/requirement/requirementDetector.js';\nimport sequence from '../diagrams/sequence/sequenceDetector.js';\nimport classDiagram from '../diagrams/class/classDetector.js';\nimport classDiagramV2 from '../diagrams/class/classDetector-V2.js';\nimport state from '../diagrams/state/stateDetector.js';\nimport stateV2 from '../diagrams/state/stateDetector-V2.js';\nimport journey from '../diagrams/user-journey/journeyDetector.js';\nimport errorDiagram from '../diagrams/error/errorDiagram.js';\nimport flowchartElk from '../diagrams/flowchart/elk/detector.js';\nimport timeline from '../diagrams/timeline/detector.js';\nimport mindmap from '../diagrams/mindmap/detector.js';\nimport kanban from '../diagrams/kanban/detector.js';\nimport sankey from '../diagrams/sankey/sankeyDetector.js';\nimport { packet } from '../diagrams/packet/detector.js';\nimport { radar } from '../diagrams/radar/detector.js';\nimport block from '../diagrams/block/blockDetector.js';\nimport treeView from '../diagrams/treeView/detector.js';\nimport architecture from '../diagrams/architecture/architectureDetector.js';\nimport eventmodeling from '../diagrams/eventmodeling/detector.js';\nimport { ishikawa } from '../diagrams/ishikawa/ishikawaDetector.js';\nimport venn from '../diagrams/venn/vennDetector.js';\nimport { registerLazyLoadedDiagrams } from './detectType.js';\nimport { registerDiagram } from './diagramAPI.js';\nimport { treemap } from '../diagrams/treemap/detector.js';\nimport wardley from '../diagrams/wardley/wardleyDetector.js';\nimport '../type.d.ts';\n\nlet hasLoadedDiagrams = false;\nexport const addDiagrams = () => {\n if (hasLoadedDiagrams) {\n return;\n }\n // This is added here to avoid race-conditions.\n // We could optimize the loading logic somehow.\n hasLoadedDiagrams = true;\n registerDiagram('error', errorDiagram, (text) => {\n return text.toLowerCase().trim() === 'error';\n });\n registerDiagram(\n '---',\n // --- diagram type may appear if YAML front-matter is not parsed correctly\n {\n db: {\n clear: () => {\n // Quite ok, clear needs to be there for --- to work as a regular diagram\n },\n },\n styles: {}, // should never be used\n renderer: {\n draw: () => {\n // should never be used\n },\n },\n parser: {\n parse: () => {\n throw new Error(\n 'Diagrams beginning with --- are not valid. ' +\n 'If you were trying to use a YAML front-matter, please ensure that ' +\n \"you've correctly opened and closed the YAML front-matter with un-indented `---` blocks\"\n );\n },\n },\n init: () => null, // no op\n },\n (text) => {\n return text.toLowerCase().trimStart().startsWith('---');\n }\n );\n\n if (injected.includeLargeFeatures) {\n registerLazyLoadedDiagrams(flowchartElk, mindmap, architecture);\n }\n\n // Ordering of detectors is important. The first one to return true will be used.\n registerLazyLoadedDiagrams(\n c4,\n kanban,\n classDiagramV2,\n classDiagram,\n er,\n gantt,\n info,\n pie,\n requirement,\n sequence,\n flowchartV2,\n flowchart,\n timeline,\n git,\n stateV2,\n state,\n journey,\n quadrantChart,\n sankey,\n packet,\n xychart,\n block,\n eventmodeling,\n treeView,\n radar,\n ishikawa,\n treemap,\n venn,\n wardley\n );\n};\n", "import { log } from '../logger.js';\nimport { detectors } from './detectType.js';\nimport { getDiagram, registerDiagram } from './diagramAPI.js';\n\nexport const loadRegisteredDiagrams = async () => {\n log.debug(`Loading registered diagrams`);\n // Load all lazy loaded diagrams in parallel\n const results = await Promise.allSettled(\n Object.entries(detectors).map(async ([key, { detector, loader }]) => {\n if (!loader) {\n return;\n }\n try {\n getDiagram(key);\n } catch {\n try {\n // Register diagram if it is not already registered\n const { diagram, id } = await loader();\n registerDiagram(id, diagram, detector);\n } catch (err) {\n // Remove failed diagram from detectors\n log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);\n delete detectors[key];\n throw err;\n }\n }\n })\n );\n const failed = results.filter((result) => result.status === 'rejected');\n if (failed.length > 0) {\n log.error(`Failed to load ${failed.length} external diagrams`);\n for (const res of failed) {\n log.error(res);\n }\n throw new Error(`Failed to load ${failed.length} external diagrams`);\n }\n};\n", "export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\nexport var SCOPE = '@scope'\n", "/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @param {number} position\n * @return {number}\n */\nexport function indexof (value, search, position) {\n\treturn value.indexOf(search, position)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n\n/**\n * @param {string[]} array\n * @param {RegExp} pattern\n * @return {string[]}\n */\nexport function filter (array, pattern) {\n\treturn array.filter(function (value) { return !match(value, pattern) })\n}\n", "import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {object[]} siblings\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length, siblings) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props)\n}\n\n/**\n * @param {object} root\n */\nexport function lift (root) {\n\twhile (root.root)\n\t\troot = copy(root.root, {children: [root]})\n\n\tappend(root, root.siblings)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n", "import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, token, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f', abs(index ? points[index - 1] : 0)) != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent, declarations), declarations)\n\t\t\t\t\t\tif ((token(previous || 1) == 5 || token(peek() || 1) == 5) && strlen(characters) && substr(characters, -1, void 0) !== ' ') characters += ' '\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length || (variable === 0 && previous === 47)))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tswitch (atrule) {\n\t\t\t\t\t\t\t\t\t// c(ontainer)\n\t\t\t\t\t\t\t\t\tcase 99:\n\t\t\t\t\t\t\t\t\t\tif (charat(characters, 3) === 110) break\n\t\t\t\t\t\t\t\t\t// l(ayer)\n\t\t\t\t\t\t\t\t\tcase 108:\n\t\t\t\t\t\t\t\t\t\tif (charat(characters, 2) === 97) break\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\toffset = 0\n\t\t\t\t\t\t\t\t\t// d(ocument) m(edia) s(upports)\n\t\t\t\t\t\t\t\t\tcase 100: case 109: case 115:\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (offset) parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\telse parse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @param {object[]} siblings\n * @return {object}\n */\nexport function comment (value, root, parent, siblings) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function declaration (value, root, parent, length, siblings) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings)\n}\n", "import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES, NAMESPACE} from './Enum.js'\nimport {strlen} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\n\tfor (var i = 0; i < children.length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case NAMESPACE: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: if (!strlen(element.value = element.props.join(','))) return ''\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n", "import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'\nimport {match, charat, substr, strlen, sizeof, replace, combine, filter, assign} from './Utility.js'\nimport {copy, lift, tokenize} from './Tokenizer.js'\nimport {serialize} from './Serializer.js'\nimport {prefix} from './Prefixer.js'\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nexport function middleware (collection) {\n\tvar length = sizeof(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nexport function rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nexport function prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase DECLARATION: element.return = prefix(element.value, element.length, children)\n\t\t\t\t\treturn\n\t\t\t\tcase KEYFRAMES:\n\t\t\t\t\treturn serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)\n\t\t\t\tcase RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn combine(children = element.props, function (value) {\n\t\t\t\t\t\t\tswitch (match(value, callback = /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [value]}))\n\t\t\t\t\t\t\t\t\tassign(element, {props: filter(children, callback)})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [value]}))\n\t\t\t\t\t\t\t\t\tassign(element, {props: filter(children, callback)})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nexport function namespace (element) {\n\tswitch (element.type) {\n\t\tcase RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn combine(tokenize(value), function (value, index, children) {\n\t\t\t\t\tswitch (charat(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn substr(value, 1, strlen(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + substr(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn sizeof(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = sizeof(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n", "/**\n * Accessibility (a11y) functions, types, helpers.\n *\n * @see https://www.w3.org/WAI/\n * @see https://www.w3.org/TR/wai-aria-1.1/\n * @see https://www.w3.org/TR/svg-aam-1.0/\n */\nimport type { D3Element } from './types.js';\n\n/**\n * SVG element role:\n * The SVG element role _should_ be set to 'graphics-document' per SVG standard\n * but in practice is not always done by browsers, etc. (As of 2022-12-08).\n * A fallback role of 'document' should be set for those browsers, etc., that only support ARIA 1.0.\n *\n * @see https://www.w3.org/TR/svg-aam-1.0/#roleMappingGeneralRules\n * @see https://www.w3.org/TR/graphics-aria-1.0/#graphics-document\n */\nconst SVG_ROLE = 'graphics-document document';\n\n/**\n * Add role and aria-roledescription to the svg element.\n *\n * @param svg - d3 object that contains the SVG HTML element\n * @param diagramType - diagram name for to the aria-roledescription\n */\nexport function setA11yDiagramInfo(svg: D3Element, diagramType: string) {\n svg.attr('role', SVG_ROLE);\n if (diagramType !== '') {\n svg.attr('aria-roledescription', diagramType);\n }\n}\n\n/**\n * Add an accessible title and/or description element to a chart.\n * The title is usually not displayed and the description is never displayed.\n *\n * The following charts display their title as a visual and accessibility element: gantt.\n *\n * @param svg - d3 node to insert the a11y title and desc info\n * @param a11yTitle - a11y title. undefined or empty strings mean to skip them\n * @param a11yDesc - a11y description. undefined or empty strings mean to skip them\n * @param baseId - id used to construct the a11y title and description id\n */\nexport function addSVGa11yTitleDescription(\n svg: D3Element,\n a11yTitle: string | undefined,\n a11yDesc: string | undefined,\n baseId: string\n): void {\n if (svg.insert === undefined) {\n return;\n }\n\n if (a11yDesc) {\n const descId = `chart-desc-${baseId}`;\n svg.attr('aria-describedby', descId);\n svg.insert('desc', ':first-child').attr('id', descId).text(a11yDesc);\n }\n if (a11yTitle) {\n const titleId = `chart-title-${baseId}`;\n svg.attr('aria-labelledby', titleId);\n svg.insert('title', ':first-child').attr('id', titleId).text(a11yTitle);\n }\n}\n", "import * as configApi from './config.js';\nimport { getDiagram, registerDiagram } from './diagram-api/diagramAPI.js';\nimport { detectType, getDiagramLoader } from './diagram-api/detectType.js';\nimport { UnknownDiagramError } from './errors.js';\nimport { encodeEntities } from './utils.js';\nimport type { DetailedError } from './utils.js';\nimport type { DiagramDefinition, DiagramMetadata } from './diagram-api/types.js';\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nexport type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;\n\n/**\n * An object representing a parsed mermaid diagram definition.\n * @privateRemarks This is exported as part of the public mermaidAPI.\n */\nexport class Diagram {\n public static async fromText(text: string, metadata: Pick = {}) {\n const config = configApi.getConfig();\n const type = detectType(text, config);\n text = encodeEntities(text) + '\\n';\n try {\n getDiagram(type);\n } catch {\n const loader = getDiagramLoader(type);\n if (!loader) {\n throw new UnknownDiagramError(`Diagram ${type} not found.`);\n }\n // Diagram not available, loading it.\n // new diagram will try getDiagram again and if fails then it is a valid throw\n const { id, diagram } = await loader();\n registerDiagram(id, diagram);\n }\n const { db, parser, renderer, init } = getDiagram(type);\n if (parser.parser) {\n // The parser.parser.yy is only present in JISON parsers. So, we'll only set if required.\n parser.parser.yy = db;\n }\n db.clear?.();\n init?.(config);\n // This block was added for legacy compatibility. Use frontmatter instead of adding more special cases.\n if (metadata.title) {\n db.setDiagramTitle?.(metadata.title);\n }\n await parser.parse(text);\n return new Diagram(type, text, db, parser, renderer);\n }\n\n private constructor(\n public type: string,\n public text: string,\n public db: DiagramDefinition['db'],\n public parser: DiagramDefinition['parser'],\n public renderer: DiagramDefinition['renderer']\n ) {}\n\n async render(id: string, version: string) {\n await this.renderer.draw(this.text, id, version, this);\n }\n\n getParser() {\n return this.parser;\n }\n\n getType() {\n return this.type;\n }\n}\n", "let interactionFunctions: (() => void)[] = [];\nexport const addFunction = (func: () => void) => {\n interactionFunctions.push(func);\n};\nexport const attachFunctions = () => {\n interactionFunctions.forEach((f) => {\n f();\n });\n interactionFunctions = [];\n};\n", "/**\n * Remove all lines starting with `%%` from the text that don't contain a `%%{`\n * @param text - The text to remove comments from\n * @returns cleaned text\n */\nexport const cleanupComments = (text: string): string => {\n return text.replace(/^\\s*%%(?!{)[^\\n]+\\n?/gm, '').trimStart();\n};\n", "import type { GanttDiagramConfig, MermaidConfig } from '../config.type.js';\nimport { frontMatterRegex } from './regexes.js';\n// The \"* as yaml\" part is necessary for tree-shaking\nimport * as yaml from 'js-yaml';\n\ninterface FrontMatterMetadata {\n title?: string;\n // Allows custom display modes. Currently used for compact mode in gantt charts.\n displayMode?: GanttDiagramConfig['displayMode'];\n config?: MermaidConfig;\n}\n\nexport interface FrontMatterResult {\n text: string;\n metadata: FrontMatterMetadata;\n}\n\n/**\n * Extract and parse frontmatter from text, if present, and sets appropriate\n * properties in the provided db.\n * @param text - The text that may have a YAML frontmatter.\n * @returns text with frontmatter stripped out\n */\nexport function extractFrontMatter(text: string): FrontMatterResult {\n const matches = text.match(frontMatterRegex);\n if (!matches) {\n return {\n text,\n metadata: {},\n };\n }\n\n let parsed: FrontMatterMetadata =\n yaml.load(matches[1], {\n // To support config, we need JSON schema.\n // https://www.yaml.org/spec/1.2/spec.html#id2803231\n schema: yaml.JSON_SCHEMA,\n }) ?? {};\n\n // To handle runtime data type changes\n parsed = typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};\n\n const metadata: FrontMatterMetadata = {};\n\n // Only add properties that are explicitly supported, if they exist\n if (parsed.displayMode) {\n metadata.displayMode = parsed.displayMode.toString() as GanttDiagramConfig['displayMode'];\n }\n if (parsed.title) {\n metadata.title = parsed.title.toString();\n }\n if (parsed.config) {\n metadata.config = parsed.config;\n }\n\n return {\n text: text.slice(matches[0].length),\n metadata,\n };\n}\n", "import { cleanupComments } from './diagram-api/comments.js';\nimport { extractFrontMatter } from './diagram-api/frontmatter.js';\nimport type { DiagramMetadata } from './diagram-api/types.js';\nimport utils, { cleanAndMerge, removeDirectives } from './utils.js';\n\nconst cleanupText = (code: string) => {\n return (\n code\n // parser problems on CRLF ignore all CR and leave LF;;\n .replace(/\\r\\n?/g, '\\n')\n // clean up html tags so that all attributes use single quotes, parser throws error on double quotes\n .replace(\n /<(\\w+)([^>]*)>/g,\n (match, tag, attributes) => '<' + tag + attributes.replace(/=\"([^\"]*)\"/g, \"='$1'\") + '>'\n )\n );\n};\n\nconst processFrontmatter = (code: string) => {\n const { text, metadata } = extractFrontMatter(code);\n const { displayMode, title, config = {} } = metadata;\n if (displayMode) {\n // Needs to be supported for legacy reasons\n if (!config.gantt) {\n config.gantt = {};\n }\n config.gantt.displayMode = displayMode;\n }\n\n return { title, config, text };\n};\n\nconst processDirectives = (code: string) => {\n const initDirective = utils.detectInit(code) ?? {};\n const wrapDirectives = utils.detectDirective(code, 'wrap');\n if (Array.isArray(wrapDirectives)) {\n initDirective.wrap = wrapDirectives.some(({ type }) => type === 'wrap');\n } else if (wrapDirectives?.type === 'wrap') {\n initDirective.wrap = true;\n }\n return {\n text: removeDirectives(code),\n directive: initDirective,\n };\n};\n\n/**\n * Preprocess the given code by cleaning it up, extracting front matter and directives,\n * cleaning and merging configuration, and removing comments.\n * @param code - The code to preprocess.\n * @returns The object containing the preprocessed code, title, and configuration.\n */\nexport function preprocessDiagram(code: string) {\n const cleanedCode = cleanupText(code);\n const frontMatterResult = processFrontmatter(cleanedCode);\n const directiveResult = processDirectives(frontMatterResult.text);\n const config = cleanAndMerge(frontMatterResult.config, directiveResult.directive);\n code = cleanupComments(directiveResult.text);\n return {\n code,\n title: frontMatterResult.title,\n config,\n } satisfies DiagramMetadata & { code: string };\n}\n", "export function toBase64(str: string) {\n // ref: https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem\n const utf8Bytes = new TextEncoder().encode(str);\n const utf8Str = Array.from(utf8Bytes, (byte) => String.fromCodePoint(byte)).join('');\n return btoa(utf8Str);\n}\n", "/**\n * This file contains functions that are used internally by mermaid\n * and is not intended to be used by the end user.\n */\n// @ts-ignore TODO: Investigate D3 issue\nimport { select } from 'd3';\nimport {\n COMMENT,\n compile,\n KEYFRAMES,\n LAYER,\n MEDIA,\n middleware,\n SCOPE,\n serialize,\n stringify,\n SUPPORTS,\n} from 'stylis';\nimport DOMPurify from 'dompurify';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { addSVGa11yTitleDescription, setA11yDiagramInfo } from './accessibility.js';\nimport assignWithDepth from './assignWithDepth.js';\nimport * as configApi from './config.js';\nimport { getEffectiveHtmlLabels } from './config.js';\nimport type { MermaidConfig } from './config.type.js';\nimport { addDiagrams } from './diagram-api/diagram-orchestration.js';\nimport type { DiagramMetadata, DiagramStyleClassDef } from './diagram-api/types.js';\nimport { Diagram } from './Diagram.js';\nimport { evaluate } from './diagrams/common/common.js';\nimport errorRenderer from './diagrams/error/errorRenderer.js';\nimport { attachFunctions } from './interactionDb.js';\nimport { log, setLogLevel } from './logger.js';\nimport { preprocessDiagram } from './preprocess.js';\nimport getStyles, { cssStyleSheetToString } from './styles.js';\nimport theme from './themes/index.js';\nimport type {\n D3HtmlSelection,\n D3Selection,\n ParseOptions,\n ParseResult,\n RenderResult,\n} from './types.js';\nimport { decodeEntities } from './utils.js';\nimport { toBase64 } from './utils/base64.js';\nimport { sanitizeCss } from './utils/sanitizeDirective.js';\n\nconst MAX_TEXTLENGTH = 50_000;\nconst MAX_TEXTLENGTH_EXCEEDED_MSG =\n 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';\n\nconst SECURITY_LVL_SANDBOX = 'sandbox';\nconst SECURITY_LVL_LOOSE = 'loose';\n\nconst XMLNS_SVG_STD = 'http://www.w3.org/2000/svg';\nconst XMLNS_XLINK_STD = 'http://www.w3.org/1999/xlink';\nconst XMLNS_XHTML_STD = 'http://www.w3.org/1999/xhtml';\n\n// ------------------------------\n// iFrame\nconst IFRAME_WIDTH = '100%';\nconst IFRAME_HEIGHT = '100%';\nconst IFRAME_STYLES = 'border:0;margin:0;';\nconst IFRAME_BODY_STYLE = 'margin:0';\nconst IFRAME_SANDBOX_OPTS = 'allow-top-navigation-by-user-activation allow-popups';\nconst IFRAME_NOT_SUPPORTED_MSG = 'The \"iframe\" tag is not supported by your browser.';\n\n// DOMPurify settings for svgCode\nconst DOMPURIFY_TAGS = ['foreignobject'];\nconst DOMPURIFY_ATTR = ['dominant-baseline'];\n\nfunction processAndSetConfigs(text: string) {\n const processed = preprocessDiagram(text);\n configApi.reset();\n configApi.addDirective(processed.config ?? {});\n return processed;\n}\n\n/**\n * Parse the text and validate the syntax.\n * @param text - The mermaid diagram definition.\n * @param parseOptions - Options for parsing. @see {@link ParseOptions}\n * @returns An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.\n * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.\n */\nasync function parse(\n text: string,\n parseOptions: ParseOptions & { suppressErrors: true }\n): Promise;\nasync function parse(text: string, parseOptions?: ParseOptions): Promise;\nasync function parse(text: string, parseOptions?: ParseOptions): Promise {\n addDiagrams();\n try {\n const { code, config } = processAndSetConfigs(text);\n const diagram = await getDiagramFromText(code);\n return { diagramType: diagram.type, config };\n } catch (error) {\n if (parseOptions?.suppressErrors) {\n return false;\n }\n throw error;\n }\n}\n\n/**\n * Create a CSS style that starts with the given class name, then the element,\n * with an enclosing block that has each of the cssClasses followed by !important;\n * @param cssClass - CSS class name\n * @param element - CSS element\n * @param cssClasses - list of CSS styles to append after the element\n * @returns - the constructed string\n */\nexport const cssImportantStyles = (\n cssClass: string,\n element: string,\n cssClasses: string[] = []\n): string => {\n const declarationBlock = sanitizeCss(`{ ${cssClasses.join(' !important; ')} !important; }`);\n return `.${cssClass} ${element} ${declarationBlock}`;\n};\n\n/**\n * Create the user styles\n * @internal\n * @param config - configuration that has style and theme settings to use\n * @param classDefs - the classDefs in the diagram text. Might be null if none were defined. Usually is the result of a call to getClasses(...)\n * @returns the string with all the user styles\n */\nexport const createCssStyles = (\n config: MermaidConfig,\n classDefs: Map | null | undefined = new Map()\n): string => {\n const cssStyles = new CSSStyleSheet();\n\n // user provided theme CSS info\n // If you add more configuration driven data into the user styles make sure that the value is\n // sanitized by the sanitize CSS function TODO where is this method? what should be used to replace it? refactor so that it's always sanitized\n if (config.fontFamily !== undefined) {\n cssStyles.insertRule(\n `:root { --mermaid-font-family: ${config.fontFamily}}`,\n cssStyles.cssRules.length\n );\n }\n if (config.altFontFamily !== undefined) {\n cssStyles.insertRule(\n `:root { --mermaid-alt-font-family: ${config.altFontFamily}}`,\n cssStyles.cssRules.length\n );\n }\n\n // classDefs defined in the diagram text\n if (classDefs instanceof Map) {\n const htmlLabels = getEffectiveHtmlLabels(config);\n\n const cssHtmlElements = ['> *', 'span']; // TODO make a constant\n const cssShapeElements = ['rect', 'polygon', 'ellipse', 'circle', 'path']; // TODO make a constant\n\n const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;\n\n // create the CSS styles needed for each styleClass definition and css element\n classDefs.forEach((styleClassDef) => {\n // create the css styles for each cssElement and the styles (only if there are styles)\n if (!isEmpty(styleClassDef.styles)) {\n cssElements.forEach((cssElement) => {\n cssStyles.insertRule(\n cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles),\n cssStyles.cssRules.length\n );\n });\n }\n // create the css styles for the tspan element and the text styles (only if there are textStyles)\n if (!isEmpty(styleClassDef.textStyles)) {\n cssStyles.insertRule(\n cssImportantStyles(\n styleClassDef.id,\n 'tspan',\n (styleClassDef?.textStyles || []).map((s) => s.replace('color', 'fill'))\n ),\n cssStyles.cssRules.length\n );\n }\n });\n }\n\n let cssString = '';\n if (config.themeCSS !== undefined) {\n if (typeof cssStyles.replaceSync === 'function') {\n const themeCssStyleSheet = new CSSStyleSheet();\n themeCssStyleSheet.replaceSync(config.themeCSS);\n cssString = cssStyleSheetToString(themeCssStyleSheet) + '\\n';\n } else {\n /**\n * Ideally we'd do a `CSSStyleSheet.replaceSync`, but it's not supported\n * in some older browsers and in JSDOM.\n */\n cssString += `${config.themeCSS}\\n`;\n }\n }\n\n return cssString + cssStyleSheetToString(cssStyles);\n};\n\n/**\n * Use `stylis` to compile the CSS to only apply to the given namespace.\n *\n * This will also remove some newer CSS features (e.g. nesting) to better\n * support older browsers and does some minification. It also removes some\n * at-rules that can't be namespaced.\n *\n * @internal\n * @param namespace - the namespace to add in front of all the CSS styles, e.g. `#idOfSvgElement`\n * @param css - the CSS styles to add the namespace to.\n * @see https://github.com/thysultan/stylis\n *\n * @example\n * // Returns `#id .class1{fill:red;}`\n * compileCSS('#id', `.class1 { fill: red }`)\n */\nconst compileCSS = (namespace: `#${string}`, css: string) => {\n return serialize(\n compile(`${namespace}{${css}}`),\n middleware([\n function addNamespace(element, _index, _children, _callback) {\n /**\n * CSS normally automatically adds the `&` selector in front of each\n * element. But, if there's already an `&` selector, it doesn't add this.\n *\n * This code will explicitly make sure it's always added, to ensure\n * that the CSS never applies outside the SVG.\n *\n * E.g. `#svgId { .nested-class :not(&) { fill: red } }` will be\n * transformed to `#svgId { & .nested-class :not(&) { fill: red } }`\n */\n if (element.type === 'rule' && Array.isArray(element.props)) {\n if (element.parent && element.parent.type === KEYFRAMES) {\n /**\n * Don't namespace CSSKeyframeRule, since they don't have selectors.\n */\n return;\n }\n element.props = element.props.map((prop) => {\n if (!prop.startsWith(namespace)) {\n return `${namespace} ${prop}`;\n }\n return prop;\n });\n } else if (element.type.startsWith('@')) {\n // Only allow certain at-rules to avoid namespace escape.\n //\n // Nested ones are allowed, since they'd get namespaced appropriately.\n // @keyframes are required for Mermaid's animation features, even\n // if they can potentially pollute the page.\n\n /**\n * At-rules that contain nested rules.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@container}\n */\n const nestedAtRules = [\n MEDIA,\n SUPPORTS,\n LAYER,\n SCOPE,\n '@container',\n '@starting-style',\n ] as const;\n const allowedAtRules = [\n ...nestedAtRules,\n KEYFRAMES, // needed for Mermaid's animation feature\n ] as const;\n if (!allowedAtRules.includes(element.type as (typeof allowedAtRules)[number])) {\n log.warn(`Removing unsupported at-rule ${element.type} from CSS`);\n element.type = COMMENT;\n }\n }\n },\n stringify,\n ])\n );\n};\n\nexport const createUserStyles = (\n config: MermaidConfig,\n graphType: string,\n classDefs: Map | undefined,\n // CSS selector for the SVG element, e.g. `#idOfSvgElement`\n svgId: `#${string}`\n): string => {\n const userCSSstyles = createCssStyles(config, classDefs);\n const allStyles = getStyles(\n graphType,\n userCSSstyles,\n { ...config.themeVariables, theme: config.theme, look: config.look },\n svgId\n );\n return compileCSS(svgId, allStyles);\n};\n\n/**\n * Clean up svgCode. Do replacements needed\n *\n * @param svgCode - the code to clean up\n * @param inSandboxMode - security level\n * @param useArrowMarkerUrls - should arrow marker's use full urls? (vs. just the anchors)\n * @returns the cleaned up svgCode\n */\nexport const cleanUpSvgCode = (\n svgCode = '',\n inSandboxMode: boolean,\n useArrowMarkerUrls: boolean\n): string => {\n let cleanedUpSvg = svgCode;\n\n // Replace marker-end urls with just the # anchor (remove the preceding part of the URL)\n if (!useArrowMarkerUrls && !inSandboxMode) {\n cleanedUpSvg = cleanedUpSvg.replace(\n /marker-end=\"url\\([\\d+./:=?A-Za-z-]*?#/g,\n 'marker-end=\"url(#'\n );\n }\n\n cleanedUpSvg = decodeEntities(cleanedUpSvg);\n\n // replace old br tags with newer style\n cleanedUpSvg = cleanedUpSvg.replace(/
/g, '
');\n\n return cleanedUpSvg;\n};\n\n/**\n * Put the svgCode into an iFrame. Return the iFrame code\n *\n * @param svgCode - the svg code to put inside the iFrame\n * @param svgElement - the d3 node that has the current svgElement so we can get the height from it\n * @returns - the code with the iFrame that now contains the svgCode\n */\nexport const putIntoIFrame = (svgCode = '', svgElement?: SVGSVGElement): string => {\n const height = svgElement?.viewBox?.baseVal?.height\n ? svgElement.viewBox.baseVal.height + 'px'\n : IFRAME_HEIGHT;\n const base64encodedSrc = toBase64(`${svgCode}`);\n return ``;\n};\n\n/**\n * Append an enclosing div, then svg, then g (group) to the d3 parentRoot. Set attributes.\n * Only set the style attribute on the enclosing div if divStyle is given.\n * Only set the xmlns:xlink attribute on svg if svgXlink is given.\n * Return the last node appended\n *\n * @param parentRoot - the d3 node to append things to\n * @param id - the value to set the id attr to\n * @param enclosingDivId - the id to set the enclosing div to\n * @param divStyle - if given, the style to set the enclosing div to\n * @param svgXlink - if given, the link to set the new svg element to\n * @returns - returns the parentRoot that had nodes appended\n */\nexport const appendDivSvgG = (\n parentRoot: D3HtmlSelection | D3HtmlSelection,\n id: string,\n enclosingDivId: string,\n divStyle?: string,\n svgXlink?: string\n) => {\n const enclosingDiv = parentRoot.append('div');\n enclosingDiv.attr('id', enclosingDivId);\n if (divStyle) {\n enclosingDiv.attr('style', divStyle);\n }\n\n const svgNode = enclosingDiv\n .append('svg')\n .attr('id', id)\n .attr('width', '100%')\n .attr('xmlns', XMLNS_SVG_STD);\n if (svgXlink) {\n svgNode.attr('xmlns:xlink', svgXlink);\n }\n\n svgNode.append('g');\n return parentRoot;\n};\n\n/**\n * Append an iFrame node to the given parentNode and set the id, style, and 'sandbox' attributes\n * Return the appended iframe d3 node\n *\n * @param parentNode - the d3 node to append the iFrame node to\n * @param iFrameId - id to use for the iFrame\n * @returns the appended iframe d3 node\n */\nfunction sandboxedIframe(\n parentNode: D3HtmlSelection | D3HtmlSelection,\n iFrameId: string\n) {\n return parentNode\n .append('iframe')\n .attr('id', iFrameId)\n .attr('style', 'width: 100%; height: 100%;')\n .attr('sandbox', '');\n}\n\n/**\n * Remove any existing elements from the given document\n *\n * @param doc - the document to removed elements from\n * @param id - id for any existing SVG element\n * @param divSelector - selector for any existing enclosing div element\n * @param iFrameSelector - selector for any existing iFrame element\n */\nexport const removeExistingElements = (\n doc: Document,\n id: string,\n divId: string,\n iFrameId: string\n) => {\n // Remove existing SVG element if it exists\n doc.getElementById(id)?.remove();\n // Remove previous temporary element if it exists\n // Both div and iframe needs to be cleared in case there is a config change happening between renders.\n doc.getElementById(divId)?.remove();\n doc.getElementById(iFrameId)?.remove();\n};\n\n/**\n * @deprecated - use the `mermaid.render` function instead of `mermaid.mermaidAPI.render`\n *\n * Deprecated for external use.\n */\n\nconst render = async function (\n id: string,\n text: string,\n svgContainingElement?: Element\n): Promise {\n addDiagrams();\n\n const processed = processAndSetConfigs(text);\n text = processed.code;\n\n const config = configApi.getConfig();\n log.debug(config);\n\n // Check the maximum allowed text size\n if (text.length > (config?.maxTextSize ?? MAX_TEXTLENGTH)) {\n text = MAX_TEXTLENGTH_EXCEEDED_MSG;\n }\n\n const idSelector = `#${id}` as const;\n const iFrameID = 'i' + id;\n const iFrameID_selector = '#' + iFrameID;\n const enclosingDivID = 'd' + id;\n const enclosingDivID_selector = '#' + enclosingDivID;\n\n const removeTempElements = () => {\n // -------------------------------------------------------------------------------\n // Remove the temporary HTML element if appropriate\n const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector;\n const node = select(tmpElementSelector).node();\n if (node && 'remove' in node) {\n node.remove();\n }\n };\n\n let root: D3HtmlSelection | D3HtmlSelection = select(document.body);\n\n const isSandboxed = config.securityLevel === SECURITY_LVL_SANDBOX;\n const isLooseSecurityLevel = config.securityLevel === SECURITY_LVL_LOOSE;\n\n const fontFamily = config.fontFamily;\n\n // -------------------------------------------------------------------------------\n // Define the root d3 node\n // In regular execution the svgContainingElement will be the element with a mermaid class\n\n if (svgContainingElement !== undefined) {\n if (svgContainingElement) {\n svgContainingElement.innerHTML = '';\n }\n\n if (isSandboxed) {\n // If we are in sandboxed mode, we do everything mermaid related in a (sandboxed )iFrame\n const iframe = sandboxedIframe(select(svgContainingElement), iFrameID);\n root = select(iframe.nodes()[0].contentDocument!.body);\n root.node()!.style.margin = '0';\n } else {\n root = select(svgContainingElement);\n }\n appendDivSvgG(root, id, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);\n } else {\n // No svgContainingElement was provided\n\n // If there is an existing element with the id, we remove it. This likely a previously rendered diagram\n removeExistingElements(document, id, enclosingDivID, iFrameID);\n\n // Add the temporary div used for rendering with the enclosingDivID.\n // This temporary div will contain a svg with the id == id\n\n if (isSandboxed) {\n // If we are in sandboxed mode, we do everything mermaid related in a (sandboxed) iFrame\n const iframe = sandboxedIframe(select(document.body), iFrameID);\n root = select(iframe.nodes()[0].contentDocument!.body);\n root.node()!.style.margin = '0';\n } else {\n root = select('body');\n }\n\n appendDivSvgG(root, id, enclosingDivID);\n }\n\n // -------------------------------------------------------------------------------\n // Create the diagram\n\n // Important that we do not create the diagram until after the directives have been included\n let diag: Diagram;\n let parseEncounteredException;\n\n try {\n diag = await Diagram.fromText(text, { title: processed.title });\n } catch (error) {\n if (config.suppressErrorRendering) {\n removeTempElements();\n throw error;\n }\n diag = await Diagram.fromText('error');\n parseEncounteredException = error;\n }\n\n // Get the temporary div element containing the svg\n const element = root.select(enclosingDivID_selector).node()!;\n const diagramType = diag.type;\n\n // -------------------------------------------------------------------------------\n // Create and insert the styles (user styles, theme styles, config styles)\n\n // Insert an element into svg. This is where we put the styles\n const svg = element.firstChild!;\n const firstChild = svg.firstChild;\n const diagramClassDefs = diag.renderer.getClasses?.(text, diag);\n\n const rules = createUserStyles(config, diagramType, diagramClassDefs, idSelector);\n\n const style1 = document.createElement('style');\n style1.innerHTML = rules;\n svg.insertBefore(style1, firstChild);\n\n // -------------------------------------------------------------------------------\n // Draw the diagram with the renderer\n try {\n await diag.renderer.draw(text, id, injected.version, diag);\n } catch (e) {\n if (config.suppressErrorRendering) {\n removeTempElements();\n } else {\n errorRenderer.draw(text, id, injected.version);\n }\n throw e;\n }\n\n // This is the d3 node for the svg element\n const svgNode = root.select(`${enclosingDivID_selector} svg`);\n const a11yTitle: string | undefined = diag.db.getAccTitle?.();\n const a11yDescr: string | undefined = diag.db.getAccDescription?.();\n addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr);\n // -------------------------------------------------------------------------------\n // Clean up SVG code\n root.select(`[id=\"${id}\"]`).selectAll('foreignobject > *').attr('xmlns', XMLNS_XHTML_STD);\n\n // Fix for when the base tag is used\n let svgCode: string = root.select(enclosingDivID_selector).node()!.innerHTML;\n\n log.debug('config.arrowMarkerAbsolute', config.arrowMarkerAbsolute);\n svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config.arrowMarkerAbsolute));\n\n if (isSandboxed) {\n const svgEl = root.select(enclosingDivID_selector + ' svg').node()!;\n svgCode = putIntoIFrame(svgCode, svgEl);\n } else if (!isLooseSecurityLevel) {\n // Sanitize the svgCode using DOMPurify\n svgCode = DOMPurify.sanitize(svgCode, {\n ADD_TAGS: DOMPURIFY_TAGS,\n ADD_ATTR: DOMPURIFY_ATTR,\n HTML_INTEGRATION_POINTS: { foreignobject: true },\n });\n }\n\n attachFunctions();\n\n if (parseEncounteredException) {\n throw parseEncounteredException;\n }\n\n removeTempElements();\n\n return {\n diagramType,\n svg: svgCode,\n bindFunctions: diag.db.bindFunctions,\n };\n};\n\n/**\n * @param userOptions - Initial Mermaid options\n */\nfunction initialize(userOptions: MermaidConfig = {}) {\n const options: MermaidConfig = assignWithDepth({}, userOptions);\n // Handle legacy location of font-family configuration\n if (options?.fontFamily && !options.themeVariables?.fontFamily) {\n if (!options.themeVariables) {\n options.themeVariables = {};\n }\n options.themeVariables.fontFamily = options.fontFamily;\n }\n\n // Set default options\n configApi.saveConfigFromInitialize(options);\n\n if (options?.theme && options.theme in theme) {\n // Todo merge with user options\n options.themeVariables = theme[options.theme as keyof typeof theme].getThemeVariables(\n options.themeVariables\n );\n } else if (options) {\n options.themeVariables = theme.default.getThemeVariables(options.themeVariables);\n }\n\n const config =\n typeof options === 'object' ? configApi.setSiteConfig(options) : configApi.getSiteConfig();\n\n setLogLevel(config.logLevel);\n addDiagrams();\n}\n\nconst getDiagramFromText = (text: string, metadata: Pick = {}) => {\n const { code } = preprocessDiagram(text);\n return Diagram.fromText(code, metadata);\n};\n\n/**\n * Add accessibility (a11y) information to the diagram.\n *\n * @param diagramType - diagram type\n * @param svgNode - d3 node to insert the a11y title and desc info\n * @param a11yTitle - a11y title\n * @param a11yDescr - a11y description\n */\nfunction addA11yInfo(\n diagramType: string,\n svgNode: D3Selection,\n a11yTitle?: string,\n a11yDescr?: string\n): void {\n setA11yDiagramInfo(svgNode, diagramType);\n addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr('id'));\n}\n\n/**\n * @internal - Use mermaid.function instead of mermaid.mermaidAPI.function\n */\nexport const mermaidAPI = Object.freeze({\n render,\n parse,\n getDiagramFromText,\n initialize,\n getConfig: configApi.getConfig,\n setConfig: configApi.setConfig,\n getSiteConfig: configApi.getSiteConfig,\n updateSiteConfig: configApi.updateSiteConfig,\n reset: () => {\n configApi.reset();\n },\n globalReset: () => {\n configApi.reset(configApi.defaultConfig);\n },\n defaultConfig: configApi.defaultConfig,\n});\n\nsetLogLevel(configApi.getConfig().logLevel);\nconfigApi.reset(configApi.getConfig());\nexport default mermaidAPI;\n", "/**\n * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid\n * functionality and to render the diagrams to svg code!\n */\nimport type { AsyncIconLoader, IconLoader, SyncIconLoader } from './rendering-util/icons.js';\nimport { registerIconPacks } from './rendering-util/icons.js';\nimport { dedent } from 'ts-dedent';\nimport type { MermaidConfig } from './config.type.js';\nimport { detectType, detectors, registerLazyLoadedDiagrams } from './diagram-api/detectType.js';\nimport { addDiagrams } from './diagram-api/diagram-orchestration.js';\nimport { loadRegisteredDiagrams } from './diagram-api/loadDiagram.js';\nimport type { ExternalDiagramDefinition, SVG, SVGGroup } from './diagram-api/types.js';\nimport type { ParseErrorFunction } from './Diagram.js';\nimport type { UnknownDiagramError } from './errors.js';\nimport type { InternalHelpers } from './internals.js';\nimport { log } from './logger.js';\nimport { mermaidAPI } from './mermaidAPI.js';\nimport type { LayoutLoaderDefinition, RenderOptions } from './rendering-util/render.js';\nimport { registerLayoutLoaders } from './rendering-util/render.js';\nimport type { LayoutData } from './rendering-util/types.js';\nimport type { ParseOptions, ParseResult, RenderResult } from './types.js';\nimport type { DetailedError } from './utils.js';\nimport utils, { isDetailedError } from './utils.js';\n\nexport type {\n AsyncIconLoader,\n DetailedError,\n ExternalDiagramDefinition,\n IconLoader,\n InternalHelpers,\n LayoutData,\n LayoutLoaderDefinition,\n MermaidConfig,\n ParseErrorFunction,\n ParseOptions,\n ParseResult,\n RenderOptions,\n RenderResult,\n SVG,\n SVGGroup,\n SyncIconLoader,\n UnknownDiagramError,\n};\n\nexport interface RunOptions {\n /**\n * The query selector to use when finding elements to render. Default: `\".mermaid\"`.\n */\n querySelector?: string;\n /**\n * The nodes to render. If this is set, `querySelector` will be ignored.\n */\n nodes?: ArrayLike;\n /**\n * A callback to call after each diagram is rendered.\n */\n postRenderCallback?: (id: string) => unknown;\n /**\n * If `true`, errors will be logged to the console, but not thrown. Default: `false`\n */\n suppressErrors?: boolean;\n}\n\nconst handleError = (error: unknown, errors: DetailedError[], parseError?: ParseErrorFunction) => {\n log.warn(error);\n if (isDetailedError(error)) {\n // handle case where error string and hash were\n // wrapped in object like`const error = { str, hash };`\n if (parseError) {\n parseError(error.str, error.hash);\n }\n errors.push({ ...error, message: error.str, error });\n } else {\n // assume it is just error string and pass it on\n if (parseError) {\n parseError(error);\n }\n if (error instanceof Error) {\n errors.push({\n str: error.message,\n message: error.message,\n hash: error.name,\n error,\n });\n }\n }\n};\n\n/**\n * ## run\n *\n * Function that goes through the document to find the chart definitions in there and render them.\n *\n * The function tags the processed attributes with the attribute data-processed and ignores found\n * elements with the attribute already set. This way the init function can be triggered several\n * times.\n *\n * ```mermaid\n * graph LR;\n * a(Find elements)-->b{Processed}\n * b-->|Yes|c(Leave element)\n * b-->|No |d(Transform)\n * ```\n *\n * Renders the mermaid diagrams\n *\n * @param options - Optional runtime configs\n */\nconst run = async function (\n options: RunOptions = {\n querySelector: '.mermaid',\n }\n) {\n try {\n await runThrowsErrors(options);\n } catch (e) {\n if (isDetailedError(e)) {\n log.error(e.str);\n }\n if (mermaid.parseError) {\n mermaid.parseError(e as string);\n }\n if (!options.suppressErrors) {\n log.error('Use the suppressErrors option to suppress these errors');\n throw e;\n }\n }\n};\n\nconst runThrowsErrors = async function (\n { postRenderCallback, querySelector, nodes }: Omit = {\n querySelector: '.mermaid',\n }\n) {\n const conf = mermaidAPI.getConfig();\n\n log.debug(`${!postRenderCallback ? 'No ' : ''}Callback function found`);\n\n let nodesToProcess: ArrayLike;\n if (nodes) {\n nodesToProcess = nodes;\n } else if (querySelector) {\n nodesToProcess = document.querySelectorAll(querySelector);\n } else {\n throw new Error('Nodes and querySelector are both undefined');\n }\n\n log.debug(`Found ${nodesToProcess.length} diagrams`);\n if (conf?.startOnLoad !== undefined) {\n log.debug('Start On Load: ' + conf?.startOnLoad);\n mermaidAPI.updateSiteConfig({ startOnLoad: conf?.startOnLoad });\n }\n\n // generate the id of the diagram\n const idGenerator = new utils.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed);\n\n let txt: string;\n const errors: DetailedError[] = [];\n\n // element is the current div with mermaid class\n // eslint-disable-next-line unicorn/prefer-spread\n for (const element of Array.from(nodesToProcess)) {\n log.info('Rendering diagram: ' + element.id);\n /*! Check if previously processed */\n if (element.getAttribute('data-processed')) {\n continue;\n }\n element.setAttribute('data-processed', 'true');\n\n const id = `mermaid-${idGenerator.next()}`;\n\n // Fetch the graph definition including tags\n txt = element.innerHTML;\n\n // transforms the html to pure text\n txt = dedent(utils.entityDecode(txt)) // removes indentation, required for YAML parsing\n .trim()\n .replace(//gi, '
');\n\n const init = utils.detectInit(txt);\n if (init) {\n log.debug('Detected early reinit: ', init);\n }\n try {\n const { svg, bindFunctions } = await render(id, txt, element);\n element.innerHTML = svg;\n if (postRenderCallback) {\n await postRenderCallback(id);\n }\n if (bindFunctions) {\n bindFunctions(element);\n }\n } catch (error) {\n handleError(error, errors, mermaid.parseError);\n }\n }\n if (errors.length > 0) {\n // TODO: We should be throwing an error object.\n throw errors[0];\n }\n};\n\n/**\n * Used to set configurations for mermaid.\n * This function should be called before the run function.\n * @param config - Configuration object for mermaid.\n */\n\nconst initialize = function (config: MermaidConfig) {\n mermaidAPI.initialize(config);\n};\n\n/**\n * ## init\n *\n * @deprecated Use {@link initialize} and {@link run} instead.\n *\n * Renders the mermaid diagrams\n *\n * @param config - **Deprecated**, please set configuration in {@link initialize}.\n * @param nodes - **Default**: `.mermaid`. One of the following:\n * - A DOM Node\n * - An array of DOM nodes (as would come from a jQuery selector)\n * - A W3C selector, a la `.mermaid`\n * @param callback - Called once for each rendered diagram's id.\n */\nconst init = async function (\n config?: MermaidConfig,\n nodes?: string | HTMLElement | NodeListOf,\n callback?: (id: string) => unknown\n) {\n log.warn('mermaid.init is deprecated. Please use run instead.');\n if (config) {\n initialize(config);\n }\n const runOptions: RunOptions = { postRenderCallback: callback, querySelector: '.mermaid' };\n if (typeof nodes === 'string') {\n runOptions.querySelector = nodes;\n } else if (nodes) {\n if (nodes instanceof HTMLElement) {\n runOptions.nodes = [nodes];\n } else {\n runOptions.nodes = nodes;\n }\n }\n await run(runOptions);\n};\n\n/**\n * Used to register external diagram types.\n * @param diagrams - Array of {@link ExternalDiagramDefinition}.\n * @param opts - If opts.lazyLoad is false, the diagrams will be loaded immediately.\n */\nconst registerExternalDiagrams = async (\n diagrams: ExternalDiagramDefinition[],\n {\n lazyLoad = true,\n }: {\n lazyLoad?: boolean;\n } = {}\n) => {\n addDiagrams();\n registerLazyLoadedDiagrams(...diagrams);\n if (lazyLoad === false) {\n await loadRegisteredDiagrams();\n }\n};\n\n/**\n * ##contentLoaded Callback function that is called when page is loaded. This functions fetches\n * configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the\n * page.\n */\nconst contentLoaded = function () {\n if (mermaid.startOnLoad) {\n const { startOnLoad } = mermaidAPI.getConfig();\n if (startOnLoad) {\n mermaid.run().catch((err) => log.error('Mermaid failed to initialize', err));\n }\n }\n};\n\nif (typeof document !== 'undefined') {\n /*!\n * Wait for document loaded before starting the execution\n */\n window.addEventListener('load', contentLoaded, false);\n}\n\n/**\n * ## setParseErrorHandler Alternative to directly setting parseError using:\n *\n * ```js\n * mermaid.parseError = function(err,hash) {\n * forExampleDisplayErrorInGui(err); // do something with the error\n * };\n * ```\n *\n * This is provided for environments where the mermaid object can't directly have a new member added\n * to it (eg. dart interop wrapper). (Initially there is no parseError member of mermaid).\n *\n * @param parseErrorHandler - New parseError() callback.\n */\nconst setParseErrorHandler = function (parseErrorHandler: (err: any, hash: any) => void) {\n mermaid.parseError = parseErrorHandler;\n};\n\nconst executionQueue: (() => Promise)[] = [];\nlet executionQueueRunning = false;\nconst executeQueue = async () => {\n if (executionQueueRunning) {\n return;\n }\n executionQueueRunning = true;\n while (executionQueue.length > 0) {\n const f = executionQueue.shift();\n if (f) {\n try {\n await f();\n } catch (e) {\n log.error('Error executing queue', e);\n }\n }\n }\n executionQueueRunning = false;\n};\n\n/**\n * Parse the text and validate the syntax.\n * @param text - The mermaid diagram definition.\n * @param parseOptions - Options for parsing. @see {@link ParseOptions}\n * @returns If valid, {@link ParseResult} otherwise `false` if parseOptions.suppressErrors is `true`.\n * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.\n *\n * @example\n * ```js\n * console.log(await mermaid.parse('flowchart \\n a --> b'));\n * // { diagramType: 'flowchart-v2' }\n * console.log(await mermaid.parse('wrong \\n a --> b', { suppressErrors: true }));\n * // false\n * console.log(await mermaid.parse('wrong \\n a --> b', { suppressErrors: false }));\n * // throws Error\n * console.log(await mermaid.parse('wrong \\n a --> b'));\n * // throws Error\n * ```\n */\nconst parse: typeof mermaidAPI.parse = async (text, parseOptions) => {\n return new Promise((resolve, reject) => {\n // This promise will resolve when the render call is done.\n // It will be queued first and will be executed when it is first in line\n const performCall = () =>\n new Promise((res, rej) => {\n mermaidAPI.parse(text, parseOptions).then(\n (r) => {\n // This resolves for the promise for the queue handling\n res(r);\n // This fulfills the promise sent to the value back to the original caller\n resolve(r);\n },\n (e) => {\n log.error('Error parsing', e);\n mermaid.parseError?.(e);\n rej(e);\n reject(e);\n }\n );\n });\n executionQueue.push(performCall);\n executeQueue().catch(reject);\n });\n};\n\n/**\n * Function that renders an SVG with a graph from a chart definition. Usage example below.\n *\n * ```javascript\n * element = document.querySelector('#graphDiv');\n * const graphDefinition = 'graph TB\\na-->b';\n * const { svg, bindFunctions } = await mermaid.render('graphDiv', graphDefinition);\n * element.innerHTML = svg;\n * bindFunctions?.(element);\n * ```\n *\n * @remarks\n * Multiple calls to this function will be enqueued to run serially.\n *\n * @param id - The id for the SVG element (the element to be rendered)\n * @param text - The text for the graph definition\n * @param container - HTML element where the svg will be inserted. (Is usually element with the .mermaid class)\n * If no svgContainingElement is provided then the SVG element will be appended to the body.\n * Selector to element in which a div with the graph temporarily will be\n * inserted. If one is provided a hidden div will be inserted in the body of the page instead. The\n * element will be removed when rendering is completed.\n * @returns Returns the SVG Definition and BindFunctions.\n */\nconst render: typeof mermaidAPI.render = (id, text, container) => {\n return new Promise((resolve, reject) => {\n // This promise will resolve when the mermaidAPI.render call is done.\n // It will be queued first and will be executed when it is first in line\n const performCall = () =>\n new Promise((res, rej) => {\n mermaidAPI.render(id, text, container).then(\n (r) => {\n // This resolves for the promise for the queue handling\n res(r);\n // This fulfills the promise sent to the value back to the original caller\n resolve(r);\n },\n (e) => {\n log.error('Error parsing', e);\n mermaid.parseError?.(e);\n rej(e);\n reject(e);\n }\n );\n });\n executionQueue.push(performCall);\n executeQueue().catch(reject);\n });\n};\n\n/**\n * Gets the metadata for all registered diagrams.\n * Currently only the id is returned.\n * @returns An array of objects with the id of the diagram.\n */\nconst getRegisteredDiagramsMetadata = (): Pick[] => {\n return Object.keys(detectors).map((id) => ({\n id,\n }));\n};\n\nexport interface Mermaid {\n startOnLoad: boolean;\n parseError?: ParseErrorFunction;\n /**\n * @deprecated Use {@link parse} and {@link render} instead. Please [open a discussion](https://github.com/mermaid-js/mermaid/discussions) if your use case does not fit the new API.\n * @internal\n */\n mermaidAPI: typeof mermaidAPI;\n parse: typeof parse;\n render: typeof render;\n /**\n * @deprecated Use {@link initialize} and {@link run} instead.\n */\n init: typeof init;\n run: typeof run;\n registerLayoutLoaders: typeof registerLayoutLoaders;\n registerExternalDiagrams: typeof registerExternalDiagrams;\n initialize: typeof initialize;\n contentLoaded: typeof contentLoaded;\n setParseErrorHandler: typeof setParseErrorHandler;\n detectType: typeof detectType;\n registerIconPacks: typeof registerIconPacks;\n getRegisteredDiagramsMetadata: typeof getRegisteredDiagramsMetadata;\n}\n\nconst mermaid: Mermaid = {\n startOnLoad: true,\n mermaidAPI,\n parse,\n render,\n init,\n run,\n registerExternalDiagrams,\n registerLayoutLoaders,\n initialize,\n parseError: undefined,\n contentLoaded,\n setParseErrorHandler,\n detectType,\n registerIconPacks,\n getRegisteredDiagramsMetadata,\n};\n\nexport default mermaid;\n"], + "mappings": "+nCAQA,IAAMA,GAA4BC,EAACC,GAC1B,+DAA+D,KAAKA,CAAG,EAD9C,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,iDAAgB,EACjD,MAAO,CAAE,QAAI,QAAAA,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,QACA,SAAAL,GACA,OAAAG,EACF,EAEOG,GAAQD,GCjBf,IAAME,GAAK,YAELC,GAA4BC,EAAA,CAACC,EAAKC,IAIpCA,GAAQ,WAAW,kBAAoB,iBACvCA,GAAQ,WAAW,kBAAoB,MAEhC,GAEF,YAAY,KAAKD,CAAG,EATK,YAY5BE,GAAwBH,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAI,CAAQ,EAAI,KAAM,QAAO,mDAAkB,EACnD,MAAO,CAAE,GAAAN,GAAI,QAAAM,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAP,GACA,SAAAC,GACA,OAAAI,EACF,EAEOG,GAAQD,GCzBf,IAAME,GAAK,eAELC,GAA4BC,EAAA,CAACC,EAAKC,IAClCA,GAAQ,WAAW,kBAAoB,WAClC,IAGLA,GAAQ,WAAW,kBAAoB,QACzCA,EAAO,OAAS,OAId,YAAY,KAAKD,CAAG,GAAKC,GAAQ,WAAW,kBAAoB,gBAC3D,GAEF,gBAAgB,KAAKD,CAAG,GAbC,YAgB5BE,GAAwBH,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAI,CAAQ,EAAI,KAAM,QAAO,mDAAkB,EACnD,MAAO,CAAE,GAAAN,GAAI,QAAAM,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAP,GACA,SAAAC,GACA,OAAAI,EACF,EAEOG,GAAQD,GC3Bf,IAAME,GAA4BC,EAACC,GAC1B,gBAAgB,KAAKA,CAAG,EADC,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,iDAAgB,EACjD,MAAO,CAAE,QAAI,QAAAA,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,QACA,SAAAL,GACA,OAAAG,EACF,EAEOG,GAAQD,GCpBf,IAAME,GAAK,WAELC,GAA4BC,EAACC,GAC1B,eAAe,KAAKA,CAAG,EADE,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,uDAAsB,EACvD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCdf,IAAME,GAAK,QAELC,GAA4BC,EAACC,GAC1B,YAAY,KAAKA,CAAG,EADK,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,oDAAmB,EACpD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCjBf,IAAME,GAAK,OAELC,GAA4BC,EAACC,GAC1B,WAAW,KAAKA,CAAG,EADM,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,mDAAkB,EACnD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKjBC,GAAkC,CAC7C,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,ECbA,IAAMG,GAA4BC,EAACC,GAC1B,UAAU,KAAKA,CAAG,EADO,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,kDAAiB,EAClD,MAAO,CAAE,SAAI,QAAAA,CAAQ,CACvB,EAH8B,UAKjBC,GAAiC,CAC5C,SACA,SAAAL,GACA,OAAAG,EACF,ECfA,IAAMG,GAAK,gBAELC,GAA4BC,EAACC,GAC1B,oBAAoB,KAAKA,CAAG,EADH,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,uDAAsB,EACvD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCjBf,IAAME,GAAK,UAELC,GAA4BC,EAACC,GAC1B,sBAAsB,KAAKA,CAAG,EADL,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,sDAAqB,EACtD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCjBf,IAAME,GAAK,cAELC,GAA4BC,EAACC,GAC1B,4BAA4B,KAAKA,CAAG,EADX,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,0DAAyB,EAC1D,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCjBf,IAAME,GAAK,WAELC,GAA4BC,EAACC,GAC1B,sBAAsB,KAAKA,CAAG,EADL,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,uDAAsB,EACvD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCjBf,IAAME,GAAK,QAELC,GAA4BC,EAAA,CAACC,EAAKC,IAElCA,GAAQ,OAAO,kBAAoB,gBAC9B,GAGF,mBAAmB,KAAKD,CAAG,EANF,YAS5BE,GAAwBH,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAI,CAAQ,EAAI,KAAM,QAAO,oDAAmB,EACpD,MAAO,CAAE,GAAAN,GAAI,QAAAM,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAP,GACA,SAAAC,GACA,OAAAI,EACF,EAEOG,GAAQD,GCtBf,IAAME,GAAK,eAELC,GAA4BC,EAAA,CAACC,EAAKC,IAElC,mBAAmB,KAAKD,CAAG,GAAKC,GAAQ,OAAO,kBAAoB,gBAC9D,GAGF,sBAAsB,KAAKD,CAAG,EANL,YAS5BE,GAAwBH,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAI,CAAQ,EAAI,KAAM,QAAO,uDAAsB,EACvD,MAAO,CAAE,GAAAN,GAAI,QAAAM,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAP,GACA,SAAAC,GACA,OAAAI,EACF,EAEOG,GAAQD,GCtBf,IAAME,GAAK,QAELC,GAA4BC,EAAA,CAACC,EAAKC,IAGlCA,GAAQ,OAAO,kBAAoB,gBAC9B,GAEF,mBAAmB,KAAKD,CAAG,EANF,YAS5BE,GAAwBH,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAI,CAAQ,EAAI,KAAM,QAAO,oDAAmB,EACpD,MAAO,CAAE,GAAAN,GAAI,QAAAM,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAP,GACA,SAAAC,GACA,OAAAI,EACF,EAEOG,GAAQD,GCtBf,IAAME,GAAK,eAELC,GAA4BC,EAAA,CAACC,EAAKC,IAClC,yBAAsB,KAAKD,CAAG,GAG9B,mBAAmB,KAAKA,CAAG,GAAKC,GAAQ,OAAO,kBAAoB,iBAJvC,YAU5BC,GAAwBH,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAI,CAAQ,EAAI,KAAM,QAAO,uDAAsB,EACvD,MAAO,CAAE,GAAAN,GAAI,QAAAM,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAP,GACA,SAAAC,GACA,OAAAI,EACF,EAEOG,GAAQD,GCvBf,IAAME,GAAK,UAELC,GAA4BC,EAACC,GAC1B,cAAc,KAAKA,CAAG,EADG,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,sDAAqB,EACtD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCXR,IAAME,GAAOC,EAAA,CAACC,EAAeC,EAAYC,IAAoB,CAClEC,EAAI,MAAM;AAAA,CAAkC,EAC5C,IAAMC,EAAWC,GAAiBJ,CAAE,EAC9BK,EAAcF,EAAI,OAAO,GAAG,EAElCA,EAAI,KAAK,UAAW,cAAc,EAClCG,GAAiBH,EAAK,IAAK,IAAK,EAAI,EAEpCE,EAAE,OAAO,MAAM,EACZ,KAAK,QAAS,YAAY,EAC1B,KACC,IACA,4kBACF,EAEFA,EAAE,OAAO,MAAM,EACZ,KAAK,QAAS,YAAY,EAC1B,KACC,IACA,6LACF,EAEFA,EAAE,OAAO,MAAM,EACZ,KAAK,QAAS,YAAY,EAC1B,KACC,IACA,8LACF,EAEFA,EAAE,OAAO,MAAM,EACZ,KAAK,QAAS,YAAY,EAC1B,KACC,IACA,6GACF,EAEFA,EAAE,OAAO,MAAM,EACZ,KAAK,QAAS,YAAY,EAC1B,KACC,IACA,kHACF,EAEFA,EAAE,OAAO,MAAM,EACZ,KAAK,QAAS,YAAY,EAC1B,KACC,IACA,+LACF,EAEFA,EAAE,OAAO,MAAM,EACZ,KAAK,QAAS,YAAY,EAC1B,KAAK,IAAK,IAAI,EACd,KAAK,IAAK,GAAG,EACb,KAAK,YAAa,OAAO,EACzB,MAAM,cAAe,QAAQ,EAC7B,KAAK,sBAAsB,EAC9BA,EAAE,OAAO,MAAM,EACZ,KAAK,QAAS,YAAY,EAC1B,KAAK,IAAK,IAAI,EACd,KAAK,IAAK,GAAG,EACb,KAAK,YAAa,OAAO,EACzB,MAAM,cAAe,QAAQ,EAC7B,KAAK,mBAAmBJ,CAAO,EAAE,CACtC,EAhEoB,QAkEPM,GAAW,CAAE,KAAAV,EAAK,EAExBW,GAAQD,GC7Ef,IAAME,GAA6B,CACjC,GAAI,CAAC,EACL,SAAAC,GACA,OAAQ,CACN,MAAOC,EAAA,IAAY,CAEnB,EAFO,QAGT,CACF,EAEOC,GAAQH,GCPf,IAAMI,GAAK,gBAELC,GAA4BC,EAAA,CAACC,EAAKC,EAAS,CAAC,IAG9C,oBAAoB,KAAKD,CAAG,GAE3B,wBAAwB,KAAKA,CAAG,GAAKC,GAAQ,WAAW,kBAAoB,OAE7EA,EAAO,OAAS,MACT,IAEF,GAVyB,YAa5BC,GAAwBH,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAI,CAAQ,EAAI,KAAM,QAAO,mDAAmB,EACpD,MAAO,CAAE,GAAAN,GAAI,QAAAM,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAP,GACA,SAAAC,GACA,OAAAI,EACF,EAEOG,GAAQD,GC1Bf,IAAME,GAAK,WAELC,GAA4BC,EAACC,GAC1B,eAAe,KAAKA,CAAG,EADE,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,2DAA0B,EAC3D,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GClBf,IAAME,GAAK,UAELC,GAA4BC,EAACC,GAC1B,cAAc,KAAKA,CAAG,EADG,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,0DAAyB,EAC1D,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCjBf,IAAME,GAAK,SAELC,GAA4BC,EAACC,GAC1B,aAAa,KAAKA,CAAG,EADI,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,yDAAwB,EACzD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCpBf,IAAME,GAAK,SAELC,GAA4BC,EAACC,GAC1B,qBAAqB,KAAKA,CAAG,EADJ,YAI5BC,GAASF,EAAA,SAAY,CACzB,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,qDAAoB,EACrD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAHe,UAKTC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCbf,IAAME,GAAK,SAELC,GAA4BC,EAACC,GAC1B,qBAAqB,KAAKA,CAAG,EADJ,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,+CAAc,EAC/C,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKjBC,GAAoC,CAC/C,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,ECfA,IAAMG,GAAK,QAELC,GAA4BC,EAACC,GAC1B,iBAAiB,KAAKA,CAAG,EADA,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,+CAAc,EAC/C,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKjBC,GAAmC,CAC9C,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,ECnBA,IAAMG,GAAK,QAELC,GAA4BC,EAACC,GAC1B,oBAAoB,KAAKA,CAAG,EADH,YAI5BC,GAASF,EAAA,SAAY,CACzB,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,oDAAmB,EACpD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAHe,UAKTC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GChBf,IAAME,GAAK,WAELC,GAA4BC,EAACC,GAC1B,oBAAoB,KAAKA,CAAG,EADH,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,+CAAc,EAC/C,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCdf,IAAME,GAAK,eAELC,GAA4BC,EAACC,GAC1B,mBAAmB,KAAKA,CAAG,EADF,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,2DAA0B,EAC3D,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAA0C,CAC9C,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCpBf,IAAME,GAAK,gBAELC,GAA4BC,EAACC,GAC1B,oBAAoB,KAAKA,CAAG,EADH,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,+CAAc,EAC/C,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCdf,IAAME,GAAK,WAELC,GAA4BC,EAACC,GAC1B,0BAA0B,KAAKA,CAAG,EADT,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,uDAAsB,EACvD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKjBC,GAAsC,CACjD,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,ECfA,IAAMG,GAAK,OAELC,GAA4BC,EAACC,GAC1B,gBAAgB,KAAKA,CAAG,EADC,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,mDAAkB,EACnD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCjBf,IAAME,GAAK,UAELC,GAA4BC,EAACC,GAC1B,cAAc,KAAKA,CAAG,EADG,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,+CAAc,EAC/C,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKjBC,GAAqC,CAChD,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,ECfA,IAAMG,GAAK,eAELC,GAA4BC,EAACC,GAC1B,oBAAoB,KAAKA,CAAI,EADJ,YAI5BC,GAAwBF,EAAA,SAAY,CACxC,GAAM,CAAE,QAAAG,CAAQ,EAAI,KAAM,QAAO,sDAAqB,EACtD,MAAO,CAAE,GAAAL,GAAI,QAAAK,CAAQ,CACvB,EAH8B,UAKxBC,GAAoC,CACxC,GAAAN,GACA,SAAAC,GACA,OAAAG,EACF,EAEOG,GAAQD,GCcf,IAAIE,GAAoB,GACXC,EAAcC,EAAA,IAAM,CAC3BF,KAKJA,GAAoB,GACpBG,EAAgB,QAASC,GAAeC,GAC/BA,EAAK,YAAY,EAAE,KAAK,IAAM,OACtC,EACDF,EACE,MAEA,CACE,GAAI,CACF,MAAOD,EAAA,IAAM,CAEb,EAFO,QAGT,EACA,OAAQ,CAAC,EACT,SAAU,CACR,KAAMA,EAAA,IAAM,CAEZ,EAFM,OAGR,EACA,OAAQ,CACN,MAAOA,EAAA,IAAM,CACX,MAAM,IAAI,MACR,qMAGF,CACF,EANO,QAOT,EACA,KAAMA,EAAA,IAAM,KAAN,OACR,EACCG,GACQA,EAAK,YAAY,EAAE,UAAU,EAAE,WAAW,KAAK,CAE1D,EAGEC,EAA2BC,GAAcA,GAASC,EAAY,EAIhEF,EACEG,GACAF,GACAG,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAZ,GACAa,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACArB,GACAA,GACAsB,GACAC,GACAC,GACAC,GACAC,EACF,EACF,EA7E2B,eClCpB,IAAMC,GAAyBC,EAAA,SAAY,CAChDC,EAAI,MAAM,6BAA6B,EAuBvC,IAAMC,GArBU,MAAM,QAAQ,WAC5B,OAAO,QAAQC,CAAS,EAAE,IAAI,MAAO,CAACC,EAAK,CAAE,SAAAC,EAAU,OAAAC,CAAO,CAAC,IAAM,CACnE,GAAKA,EAGL,GAAI,CACFC,EAAWH,CAAG,CAChB,MAAQ,CACN,GAAI,CAEF,GAAM,CAAE,QAAAI,EAAS,GAAAC,CAAG,EAAI,MAAMH,EAAO,EACrCI,EAAgBD,EAAID,EAASH,CAAQ,CACvC,OAASM,EAAK,CAEZ,MAAAV,EAAI,MAAM,4CAA4CG,CAAG,4BAA4B,EACrF,OAAOD,EAAUC,CAAG,EACdO,CACR,CACF,CACF,CAAC,CACH,GACuB,OAAQC,GAAWA,EAAO,SAAW,UAAU,EACtE,GAAIV,EAAO,OAAS,EAAG,CACrBD,EAAI,MAAM,kBAAkBC,EAAO,MAAM,oBAAoB,EAC7D,QAAWW,KAAOX,EAChBD,EAAI,MAAMY,CAAG,EAEf,MAAM,IAAI,MAAM,kBAAkBX,EAAO,MAAM,oBAAoB,CACrE,CACF,EAhCsC,0BCA/B,IAAIY,EAAU,OACVC,GAAU,OACVC,GAAc,OAGlB,IAAIC,GAAQ,SACRC,GAAS,UAGb,IAAIC,GAAW,YAEf,IAAIC,GAAY,aACZC,EAAY,aAIhB,IAAIC,GAAQ,SACRC,GAAQ,SCjBZ,IAAIC,GAAM,KAAK,IAMXC,GAAO,OAAO,aAqBlB,SAASC,GAAMC,EAAO,CAC5B,OAAOA,EAAM,KAAK,CACnB,CAFgBC,EAAAF,GAAA,QAmBT,SAASG,EAASC,EAAOC,EAASC,EAAa,CACrD,OAAOF,EAAM,QAAQC,EAASC,CAAW,CAC1C,CAFgBC,EAAAJ,EAAA,WAUT,SAASK,GAASJ,EAAOK,EAAQC,EAAU,CACjD,OAAON,EAAM,QAAQK,EAAQC,CAAQ,CACtC,CAFgBH,EAAAC,GAAA,WAST,SAASG,EAAQP,EAAOQ,EAAO,CACrC,OAAOR,EAAM,WAAWQ,CAAK,EAAI,CAClC,CAFgBL,EAAAI,EAAA,UAUT,SAASE,EAAQT,EAAOU,EAAOC,EAAK,CAC1C,OAAOX,EAAM,MAAMU,EAAOC,CAAG,CAC9B,CAFgBR,EAAAM,EAAA,UAQT,SAASG,EAAQZ,EAAO,CAC9B,OAAOA,EAAM,MACd,CAFgBG,EAAAS,EAAA,UAQT,SAASC,GAAQb,EAAO,CAC9B,OAAOA,EAAM,MACd,CAFgBG,EAAAU,GAAA,UAST,SAASC,EAAQd,EAAOe,EAAO,CACrC,OAAOA,EAAM,KAAKf,CAAK,EAAGA,CAC3B,CAFgBG,EAAAW,EAAA,UCtGT,IAAIE,GAAO,EACPC,EAAS,EACTC,GAAS,EACTC,EAAW,EACXC,EAAY,EACZC,EAAa,GAYjB,SAASC,GAAMC,EAAOC,EAAMC,EAAQC,EAAMC,EAAOC,EAAUV,EAAQW,EAAU,CACnF,MAAO,CAAC,MAAON,EAAO,KAAMC,EAAM,OAAQC,EAAQ,KAAMC,EAAM,MAAOC,EAAO,SAAUC,EAAU,KAAMZ,GAAM,OAAQC,EAAQ,OAAQC,EAAQ,OAAQ,GAAI,SAAUW,CAAQ,CAC3K,CAFgBC,EAAAR,GAAA,QA0BT,SAASS,IAAQ,CACvB,OAAOC,CACR,CAFgBC,EAAAF,GAAA,QAOT,SAASG,IAAQ,CACvB,OAAAF,EAAYG,EAAW,EAAIC,EAAOC,EAAY,EAAEF,CAAQ,EAAI,EAExDG,IAAUN,IAAc,KAC3BM,EAAS,EAAGC,MAENP,CACR,CAPgBC,EAAAC,GAAA,QAYT,SAASM,GAAQ,CACvB,OAAAR,EAAYG,EAAWM,GAASL,EAAOC,EAAYF,GAAU,EAAI,EAE7DG,IAAUN,IAAc,KAC3BM,EAAS,EAAGC,MAENP,CACR,CAPgBC,EAAAO,EAAA,QAYT,SAASE,GAAQ,CACvB,OAAON,EAAOC,EAAYF,CAAQ,CACnC,CAFgBF,EAAAS,EAAA,QAOT,SAASC,IAAS,CACxB,OAAOR,CACR,CAFgBF,EAAAU,GAAA,SAST,SAASC,GAAOC,EAAOC,EAAK,CAClC,OAAOC,EAAOV,EAAYQ,EAAOC,CAAG,CACrC,CAFgBb,EAAAW,GAAA,SAQT,SAASI,EAAOC,EAAM,CAC5B,OAAQA,EAAM,CAEb,IAAK,GAAG,IAAK,GAAG,IAAK,IAAI,IAAK,IAAI,IAAK,IACtC,MAAO,GAER,IAAK,IAAI,IAAK,IAAI,IAAK,IAAI,IAAK,IAAI,IAAK,IAAI,IAAK,IAAI,IAAK,KAE3D,IAAK,IAAI,IAAK,KAAK,IAAK,KACvB,MAAO,GAER,IAAK,IACJ,MAAO,GAER,IAAK,IAAI,IAAK,IAAI,IAAK,IAAI,IAAK,IAC/B,MAAO,GAER,IAAK,IAAI,IAAK,IACb,MAAO,EACT,CAEA,MAAO,EACR,CAtBgBhB,EAAAe,EAAA,SA4BT,SAASE,GAAOC,EAAO,CAC7B,OAAOZ,GAAOD,EAAS,EAAGG,GAASW,EAAOf,EAAac,CAAK,EAAGhB,EAAW,EAAG,CAAC,CAC/E,CAFgBF,EAAAiB,GAAA,SAQT,SAASG,GAASF,EAAO,CAC/B,OAAOd,EAAa,GAAIc,CACzB,CAFgBlB,EAAAoB,GAAA,WAQT,SAASC,GAASL,EAAM,CAC9B,OAAOM,GAAKX,GAAMT,EAAW,EAAGqB,GAAUP,IAAS,GAAKA,EAAO,EAAIA,IAAS,GAAKA,EAAO,EAAIA,CAAI,CAAC,CAAC,CACnG,CAFgBhB,EAAAqB,GAAA,WAgBT,SAASG,GAAYC,EAAM,CACjC,MAAOC,EAAYC,EAAK,IACnBD,EAAY,IACfE,EAAK,EAIP,OAAOC,EAAMJ,CAAI,EAAI,GAAKI,EAAMH,CAAS,EAAI,EAAI,GAAK,GACvD,CARgBI,EAAAN,GAAA,cAgCT,SAASO,GAAUC,EAAOC,EAAO,CACvC,KAAO,EAAEA,GAASC,EAAK,GAElB,EAAAC,EAAY,IAAMA,EAAY,KAAQA,EAAY,IAAMA,EAAY,IAAQA,EAAY,IAAMA,EAAY,KAA9G,CAGD,OAAOC,GAAMJ,EAAOK,GAAM,GAAKJ,EAAQ,GAAKK,EAAK,GAAK,IAAMJ,EAAK,GAAK,GAAG,CAC1E,CAPgBK,EAAAR,GAAA,YAaT,SAASS,GAAWC,EAAM,CAChC,KAAOP,EAAK,GACX,OAAQC,EAAW,CAElB,KAAKM,EACJ,OAAOC,EAER,IAAK,IAAI,IAAK,IACTD,IAAS,IAAMA,IAAS,IAC3BD,GAAUL,CAAS,EACpB,MAED,IAAK,IACAM,IAAS,IACZD,GAAUC,CAAI,EACf,MAED,IAAK,IACJP,EAAK,EACL,KACF,CAED,OAAOQ,CACR,CAvBgBH,EAAAC,GAAA,aA8BT,SAASG,GAAWF,EAAMT,EAAO,CACvC,KAAOE,EAAK,GAEPO,EAAON,IAAc,IAGpB,GAAIM,EAAON,IAAc,IAAWG,EAAK,IAAM,GACnD,MAEF,MAAO,KAAOF,GAAMJ,EAAOU,EAAW,CAAC,EAAI,IAAME,GAAKH,IAAS,GAAKA,EAAOP,EAAK,CAAC,CAClF,CAVgBK,EAAAI,GAAA,aAgBT,SAASE,GAAYb,EAAO,CAClC,KAAO,CAACc,EAAMR,EAAK,CAAC,GACnBJ,EAAK,EAEN,OAAOE,GAAMJ,EAAOU,CAAQ,CAC7B,CALgBH,EAAAM,GAAA,cCnPT,SAASE,GAASC,EAAO,CAC/B,OAAOC,GAAQC,GAAM,GAAI,KAAM,KAAM,KAAM,CAAC,EAAE,EAAGF,EAAQG,GAAMH,CAAK,EAAG,EAAG,CAAC,CAAC,EAAGA,CAAK,CAAC,CACtF,CAFgBI,EAAAL,GAAA,WAgBT,SAASG,GAAOF,EAAOK,EAAMC,EAAQC,EAAMC,EAAOC,EAAUC,EAAQC,EAAQC,EAAc,CAiBhG,QAhBIC,EAAQ,EACRC,EAAS,EACTC,EAASL,EACTM,EAAS,EACTC,EAAW,EACXC,EAAW,EACXC,EAAW,EACXC,EAAW,EACXC,EAAY,EACZC,EAAY,EACZC,EAAO,GACPC,EAAQhB,EACRiB,EAAWhB,EACXiB,EAAYnB,EACZoB,EAAaJ,EAEVH,GACN,OAAQF,EAAWI,EAAWA,EAAYM,EAAK,EAAG,CAEjD,IAAK,IACJ,GAAIV,GAAY,KAAOW,EAAOF,EAAYZ,EAAS,CAAC,GAAK,GAAI,CACxDe,GAAQH,GAAcI,EAAQC,GAAQV,CAAS,EAAG,IAAK,KAAK,EAAG,MAAOW,GAAIpB,EAAQF,EAAOE,EAAQ,CAAC,EAAI,CAAC,CAAC,GAAK,KAChHQ,EAAY,IACb,KACD,CAED,IAAK,IAAI,IAAK,IAAI,IAAK,IACtBM,GAAcK,GAAQV,CAAS,EAC/B,MAED,IAAK,GAAG,IAAK,IAAI,IAAK,IAAI,IAAK,IAC9BK,GAAcO,GAAWhB,CAAQ,EACjC,MAED,IAAK,IACJS,GAAcQ,GAASC,GAAM,EAAI,EAAG,CAAC,EACrC,SAED,IAAK,IACJ,OAAQC,EAAK,EAAG,CACf,IAAK,IAAI,IAAK,IACbC,EAAOC,GAAQC,GAAUZ,EAAK,EAAGQ,GAAM,CAAC,EAAG/B,EAAMC,EAAQM,CAAY,EAAGA,CAAY,GAC/E6B,EAAMvB,GAAY,CAAC,GAAK,GAAKuB,EAAMJ,EAAK,GAAK,CAAC,GAAK,IAAMK,EAAOf,CAAU,GAAKgB,EAAOhB,EAAY,GAAI,MAAM,IAAM,MAAKA,GAAc,KAC1I,MACD,QACCA,GAAc,GAChB,CACA,MAED,IAAK,KAAMR,EACVR,EAAOE,GAAO,EAAI6B,EAAOf,CAAU,EAAIN,EAExC,IAAK,KAAMF,EAAU,IAAK,IAAI,IAAK,GAClC,OAAQG,EAAW,CAElB,IAAK,GAAG,IAAK,KAAKF,EAAW,EAE7B,IAAK,IAAKN,EAAYO,GAAa,KAAIM,EAAaI,EAAQJ,EAAY,MAAO,EAAE,GAC5EV,EAAW,IAAMyB,EAAOf,CAAU,EAAIZ,GAAWI,IAAa,GAAKD,IAAa,KACnFoB,EAAOrB,EAAW,GAAK2B,GAAYjB,EAAa,IAAKpB,EAAMD,EAAQS,EAAS,EAAGH,CAAY,EAAIgC,GAAYb,EAAQJ,EAAY,IAAK,EAAE,EAAI,IAAKpB,EAAMD,EAAQS,EAAS,EAAGH,CAAY,EAAGA,CAAY,EACrM,MAED,IAAK,IAAIe,GAAc,IAEvB,QAGC,GAFAW,EAAOZ,EAAYmB,GAAQlB,EAAYtB,EAAMC,EAAQO,EAAOC,EAAQN,EAAOG,EAAQY,EAAMC,EAAQ,CAAC,EAAGC,EAAW,CAAC,EAAGV,EAAQN,CAAQ,EAAGA,CAAQ,EAE3Ia,IAAc,IACjB,GAAIR,IAAW,EACdZ,GAAMyB,EAAYtB,EAAMqB,EAAWA,EAAWF,EAAOf,EAAUM,EAAQJ,EAAQc,CAAQ,MACnF,CACJ,OAAQT,EAAQ,CAEf,IAAK,IACJ,GAAIa,EAAOF,EAAY,CAAC,IAAM,IAAK,MAEpC,IAAK,KACJ,GAAIE,EAAOF,EAAY,CAAC,IAAM,GAAI,MACnC,QACCb,EAAS,EAEV,IAAK,KAAK,IAAK,KAAK,IAAK,KAC1B,CACIA,EAAQZ,GAAMF,EAAO0B,EAAWA,EAAWnB,GAAQ+B,EAAOO,GAAQ7C,EAAO0B,EAAWA,EAAW,EAAG,EAAGlB,EAAOG,EAAQY,EAAMf,EAAOgB,EAAQ,CAAC,EAAGT,EAAQU,CAAQ,EAAGA,CAAQ,EAAGjB,EAAOiB,EAAUV,EAAQJ,EAAQJ,EAAOiB,EAAQC,CAAQ,EAClOvB,GAAMyB,EAAYD,EAAWA,EAAWA,EAAW,CAAC,EAAE,EAAGD,EAAU,EAAGd,EAAQc,CAAQ,CAC5F,CACH,CAEAZ,EAAQC,EAASG,EAAW,EAAGE,EAAWE,EAAY,EAAGE,EAAOI,EAAa,GAAIZ,EAASL,EAC1F,MAED,IAAK,IACJK,EAAS,EAAI2B,EAAOf,CAAU,EAAGV,EAAWC,EAC7C,QACC,GAAIC,EAAW,GACd,GAAIG,GAAa,IAChB,EAAEH,UACMG,GAAa,KAAOH,KAAc,GAAK2B,GAAK,GAAK,IACzD,SAEF,OAAQnB,GAAcoB,GAAKzB,CAAS,EAAGA,EAAYH,EAAU,CAE5D,IAAK,IACJE,EAAYP,EAAS,EAAI,GAAKa,GAAc,KAAM,IAClD,MAED,IAAK,IACJhB,EAAOE,GAAO,GAAK6B,EAAOf,CAAU,EAAI,GAAKN,EAAWA,EAAY,EACpE,MAED,IAAK,IAEAgB,EAAK,IAAM,KACdV,GAAcK,GAAQJ,EAAK,CAAC,GAE7BZ,EAASqB,EAAK,EAAGvB,EAASC,EAAS2B,EAAOnB,EAAOI,GAAcqB,GAAWZ,GAAM,CAAC,CAAC,EAAGd,IACrF,MAED,IAAK,IACAJ,IAAa,IAAMwB,EAAOf,CAAU,GAAK,IAC5CR,EAAW,EACd,CACF,CAED,OAAOV,CACR,CA9HgBL,EAAAF,GAAA,SA+IT,SAAS2C,GAAS7C,EAAOK,EAAMC,EAAQO,EAAOC,EAAQN,EAAOG,EAAQY,EAAMC,EAAOC,EAAUV,EAAQkC,EAAU,CAKpH,QAJIC,EAAOpC,EAAS,EAChBP,EAAOO,IAAW,EAAIN,EAAQ,CAAC,EAAE,EACjC2C,EAAOC,GAAO7C,CAAI,EAEb8C,EAAI,EAAGC,EAAI,EAAGC,EAAI,EAAGF,EAAIxC,EAAO,EAAEwC,EAC1C,QAASG,EAAI,EAAGC,EAAId,EAAO3C,EAAOkD,EAAO,EAAGA,EAAOjB,GAAIqB,EAAI3C,EAAO0C,CAAC,CAAC,CAAC,EAAGK,EAAI1D,EAAOwD,EAAIL,EAAM,EAAEK,GAC1FE,EAAIC,GAAKL,EAAI,EAAI/C,EAAKiD,CAAC,EAAI,IAAMC,EAAI1B,EAAQ0B,EAAG,OAAQlD,EAAKiD,CAAC,CAAC,CAAC,KACnEhC,EAAM+B,GAAG,EAAIG,GAEhB,OAAOE,GAAK5D,EAAOK,EAAMC,EAAQQ,IAAW,EAAI+C,GAAUtC,EAAMC,EAAOC,EAAUV,EAAQkC,CAAQ,CAClG,CAXgB7C,EAAAyC,GAAA,WAoBT,SAASN,GAASvC,EAAOK,EAAMC,EAAQ2C,EAAU,CACvD,OAAOW,GAAK5D,EAAOK,EAAMC,EAAQwD,EAASf,GAAKgB,GAAK,CAAC,EAAGpB,EAAO3C,EAAO,EAAG,EAAE,EAAG,EAAGiD,CAAQ,CAC1F,CAFgB7C,EAAAmC,GAAA,WAYT,SAASK,GAAa5C,EAAOK,EAAMC,EAAQS,EAAQkC,EAAU,CACnE,OAAOW,GAAK5D,EAAOK,EAAMC,EAAQ0D,GAAarB,EAAO3C,EAAO,EAAGe,CAAM,EAAG4B,EAAO3C,EAAOe,EAAS,EAAG,EAAE,EAAGA,EAAQkC,CAAQ,CACxH,CAFgB7C,EAAAwC,GAAA,eC/LT,SAASqB,GAAWC,EAAUC,EAAU,CAG9C,QAFIC,EAAS,GAEJ,EAAI,EAAG,EAAIF,EAAS,OAAQ,IACpCE,GAAUD,EAASD,EAAS,CAAC,EAAG,EAAGA,EAAUC,CAAQ,GAAK,GAE3D,OAAOC,CACR,CAPgBC,EAAAJ,GAAA,aAgBT,SAASK,GAAWC,EAASC,EAAON,EAAUC,EAAU,CAC9D,OAAQI,EAAQ,KAAM,CACrB,KAAKE,GAAO,GAAIF,EAAQ,SAAS,OAAQ,MACzC,KAAKG,GAAQ,KAAKC,GAAW,KAAKC,GAAa,OAAOL,EAAQ,OAASA,EAAQ,QAAUA,EAAQ,MACjG,KAAKM,EAAS,MAAO,GACrB,KAAKC,EAAW,OAAOP,EAAQ,OAASA,EAAQ,MAAQ,IAAMN,GAAUM,EAAQ,SAAUJ,CAAQ,EAAI,IACtG,KAAKY,GAAS,GAAI,CAACC,EAAOT,EAAQ,MAAQA,EAAQ,MAAM,KAAK,GAAG,CAAC,EAAG,MAAO,EAC5E,CAEA,OAAOS,EAAOd,EAAWD,GAAUM,EAAQ,SAAUJ,CAAQ,CAAC,EAAII,EAAQ,OAASA,EAAQ,MAAQ,IAAML,EAAW,IAAM,EAC3H,CAVgBG,EAAAC,GAAA,aCdT,SAASW,GAAYC,EAAY,CACvC,IAAIC,EAASC,GAAOF,CAAU,EAE9B,OAAO,SAAUG,EAASC,EAAOC,EAAUC,EAAU,CAGpD,QAFIC,EAAS,GAEJC,EAAI,EAAGA,EAAIP,EAAQO,IAC3BD,GAAUP,EAAWQ,CAAC,EAAEL,EAASC,EAAOC,EAAUC,CAAQ,GAAK,GAEhE,OAAOC,CACR,CACD,CAXgBE,EAAAV,GAAA,cCQhB,IAAMW,GAAW,6BAQV,SAASC,GAAmBC,EAAgBC,EAAqB,CACtED,EAAI,KAAK,OAAQF,EAAQ,EACrBG,IAAgB,IAClBD,EAAI,KAAK,uBAAwBC,CAAW,CAEhD,CALgBC,EAAAH,GAAA,sBAkBT,SAASI,GACdH,EACAI,EACAC,EACAC,EACM,CACN,GAAIN,EAAI,SAAW,OAInB,IAAIK,EAAU,CACZ,IAAME,EAAS,cAAcD,CAAM,GACnCN,EAAI,KAAK,mBAAoBO,CAAM,EACnCP,EAAI,OAAO,OAAQ,cAAc,EAAE,KAAK,KAAMO,CAAM,EAAE,KAAKF,CAAQ,CACrE,CACA,GAAID,EAAW,CACb,IAAMI,EAAU,eAAeF,CAAM,GACrCN,EAAI,KAAK,kBAAmBQ,CAAO,EACnCR,EAAI,OAAO,QAAS,cAAc,EAAE,KAAK,KAAMQ,CAAO,EAAE,KAAKJ,CAAS,CACxE,EACF,CApBgBF,EAAAC,GAAA,8BC7BT,IAAMM,EAAN,MAAMC,CAAQ,CAgCX,YACCC,EACAC,EACAC,EACAC,EACAC,EACP,CALO,UAAAJ,EACA,UAAAC,EACA,QAAAC,EACA,YAAAC,EACA,cAAAC,CACN,CArDL,MAeqB,CAAAC,EAAA,gBACnB,aAAoB,SAASJ,EAAcK,EAA2C,CAAC,EAAG,CACxF,IAAMC,EAAmBC,EAAU,EAC7BR,EAAOS,GAAWR,EAAMM,CAAM,EACpCN,EAAOS,GAAeT,CAAI,EAAI;AAAA,EAC9B,GAAI,CACFU,EAAWX,CAAI,CACjB,MAAQ,CACN,IAAMY,EAASC,GAAiBb,CAAI,EACpC,GAAI,CAACY,EACH,MAAM,IAAIE,GAAoB,WAAWd,CAAI,aAAa,EAI5D,GAAM,CAAE,GAAAe,EAAI,QAAAC,CAAQ,EAAI,MAAMJ,EAAO,EACrCK,EAAgBF,EAAIC,CAAO,CAC7B,CACA,GAAM,CAAE,GAAAd,EAAI,OAAAC,EAAQ,SAAAC,EAAU,KAAAc,CAAK,EAAIP,EAAWX,CAAI,EACtD,OAAIG,EAAO,SAETA,EAAO,OAAO,GAAKD,GAErBA,EAAG,QAAQ,EACXgB,IAAOX,CAAM,EAETD,EAAS,OACXJ,EAAG,kBAAkBI,EAAS,KAAK,EAErC,MAAMH,EAAO,MAAMF,CAAI,EAChB,IAAIF,EAAQC,EAAMC,EAAMC,EAAIC,EAAQC,CAAQ,CACrD,CAUA,MAAM,OAAOW,EAAYI,EAAiB,CACxC,MAAM,KAAK,SAAS,KAAK,KAAK,KAAMJ,EAAII,EAAS,IAAI,CACvD,CAEA,WAAY,CACV,OAAO,KAAK,MACd,CAEA,SAAU,CACR,OAAO,KAAK,IACd,CACF,EClEA,IAAIC,GAAuC,CAAC,EAIrC,IAAMC,GAAkBC,EAAA,IAAM,CACnCC,GAAqB,QAASC,GAAM,CAClCA,EAAE,CACJ,CAAC,EACDD,GAAuB,CAAC,CAC1B,EAL+B,mBCCxB,IAAME,GAAkBC,EAACC,GACvBA,EAAK,QAAQ,yBAA0B,EAAE,EAAE,UAAU,EAD/B,mBCkBxB,SAASC,GAAmBC,EAAiC,CAClE,IAAMC,EAAUD,EAAK,MAAME,EAAgB,EAC3C,GAAI,CAACD,EACH,MAAO,CACL,KAAAD,EACA,SAAU,CAAC,CACb,EAGF,IAAIG,EACGC,GAAKH,EAAQ,CAAC,EAAG,CAGpB,OAAaI,EACf,CAAC,GAAK,CAAC,EAGTF,EAAS,OAAOA,GAAW,UAAY,CAAC,MAAM,QAAQA,CAAM,EAAIA,EAAS,CAAC,EAE1E,IAAMG,EAAgC,CAAC,EAGvC,OAAIH,EAAO,cACTG,EAAS,YAAcH,EAAO,YAAY,SAAS,GAEjDA,EAAO,QACTG,EAAS,MAAQH,EAAO,MAAM,SAAS,GAErCA,EAAO,SACTG,EAAS,OAASH,EAAO,QAGpB,CACL,KAAMH,EAAK,MAAMC,EAAQ,CAAC,EAAE,MAAM,EAClC,SAAAK,CACF,CACF,CApCgBC,EAAAR,GAAA,sBClBhB,IAAMS,GAAcC,EAACC,GAEjBA,EAEG,QAAQ,SAAU;AAAA,CAAI,EAEtB,QACC,kBACA,CAACC,EAAOC,EAAKC,IAAe,IAAMD,EAAMC,EAAW,QAAQ,cAAe,OAAO,EAAI,GACvF,EATc,eAadC,GAAqBL,EAACC,GAAiB,CAC3C,GAAM,CAAE,KAAAK,EAAM,SAAAC,CAAS,EAAIC,GAAmBP,CAAI,EAC5C,CAAE,YAAAQ,EAAa,MAAAC,EAAO,OAAAC,EAAS,CAAC,CAAE,EAAIJ,EAC5C,OAAIE,IAEGE,EAAO,QACVA,EAAO,MAAQ,CAAC,GAElBA,EAAO,MAAM,YAAcF,GAGtB,CAAE,MAAAC,EAAO,OAAAC,EAAQ,KAAAL,CAAK,CAC/B,EAZ2B,sBAcrBM,GAAoBZ,EAACC,GAAiB,CAC1C,IAAMY,EAAgBC,EAAM,WAAWb,CAAI,GAAK,CAAC,EAC3Cc,EAAiBD,EAAM,gBAAgBb,EAAM,MAAM,EACzD,OAAI,MAAM,QAAQc,CAAc,EAC9BF,EAAc,KAAOE,EAAe,KAAK,CAAC,CAAE,KAAAC,CAAK,IAAMA,IAAS,MAAM,EAC7DD,GAAgB,OAAS,SAClCF,EAAc,KAAO,IAEhB,CACL,KAAMI,GAAiBhB,CAAI,EAC3B,UAAWY,CACb,CACF,EAZ0B,qBAoBnB,SAASK,GAAkBjB,EAAc,CAC9C,IAAMkB,EAAcpB,GAAYE,CAAI,EAC9BmB,EAAoBf,GAAmBc,CAAW,EAClDE,EAAkBT,GAAkBQ,EAAkB,IAAI,EAC1DT,EAASW,GAAcF,EAAkB,OAAQC,EAAgB,SAAS,EAChF,OAAApB,EAAOsB,GAAgBF,EAAgB,IAAI,EACpC,CACL,KAAApB,EACA,MAAOmB,EAAkB,MACzB,OAAAT,CACF,CACF,CAXgBX,EAAAkB,GAAA,qBCpDT,SAASM,GAASC,EAAa,CAEpC,IAAMC,EAAY,IAAI,YAAY,EAAE,OAAOD,CAAG,EACxCE,EAAU,MAAM,KAAKD,EAAYE,GAAS,OAAO,cAAcA,CAAI,CAAC,EAAE,KAAK,EAAE,EACnF,OAAO,KAAKD,CAAO,CACrB,CALgBE,EAAAL,GAAA,YC8ChB,IAAMM,GAAiB,IACjBC,GACJ,sEAEIC,GAAuB,UACvBC,GAAqB,QAErBC,GAAgB,6BAChBC,GAAkB,+BAClBC,GAAkB,+BAIlBC,GAAe,OACfC,GAAgB,OAChBC,GAAgB,qBAChBC,GAAoB,WACpBC,GAAsB,uDACtBC,GAA2B,qDAG3BC,GAAiB,CAAC,eAAe,EACjCC,GAAiB,CAAC,mBAAmB,EAE3C,SAASC,GAAqBC,EAAc,CAC1C,IAAMC,EAAYC,GAAkBF,CAAI,EACxC,OAAUG,EAAM,EACNC,GAAaH,EAAU,QAAU,CAAC,CAAC,EACtCA,CACT,CALSI,EAAAN,GAAA,wBAmBT,eAAeO,GAAMN,EAAcO,EAA2D,CAC5FC,EAAY,EACZ,GAAI,CACF,GAAM,CAAE,KAAAC,EAAM,OAAAC,CAAO,EAAIX,GAAqBC,CAAI,EAElD,MAAO,CAAE,aADO,MAAMW,GAAmBF,CAAI,GACf,KAAM,OAAAC,CAAO,CAC7C,OAASE,EAAO,CACd,GAAIL,GAAc,eAChB,MAAO,GAET,MAAMK,CACR,CACF,CAZeP,EAAAC,GAAA,SAsBR,IAAMO,GAAqBR,EAAA,CAChCS,EACAC,EACAC,EAAuB,CAAC,IACb,CACX,IAAMC,EAAmBC,GAAY,KAAKF,EAAW,KAAK,eAAe,CAAC,gBAAgB,EAC1F,MAAO,IAAIF,CAAQ,IAAIC,CAAO,IAAIE,CAAgB,EACpD,EAPkC,sBAgBrBE,GAAkBd,EAAA,CAC7BK,EACAU,EAAkE,IAAI,MAC3D,CACX,IAAMC,EAAY,IAAI,cAmBtB,GAdIX,EAAO,aAAe,QACxBW,EAAU,WACR,kCAAkCX,EAAO,UAAU,IACnDW,EAAU,SAAS,MACrB,EAEEX,EAAO,gBAAkB,QAC3BW,EAAU,WACR,sCAAsCX,EAAO,aAAa,IAC1DW,EAAU,SAAS,MACrB,EAIED,aAAqB,IAAK,CAM5B,IAAME,EALaC,GAAuBb,CAAM,EAExB,CAAC,MAAO,MAAM,EACb,CAAC,OAAQ,UAAW,UAAW,SAAU,MAAM,EAKxEU,EAAU,QAASI,GAAkB,CAE9BC,GAAQD,EAAc,MAAM,GAC/BF,EAAY,QAASI,GAAe,CAClCL,EAAU,WACRR,GAAmBW,EAAc,GAAIE,EAAYF,EAAc,MAAM,EACrEH,EAAU,SAAS,MACrB,CACF,CAAC,EAGEI,GAAQD,EAAc,UAAU,GACnCH,EAAU,WACRR,GACEW,EAAc,GACd,SACCA,GAAe,YAAc,CAAC,GAAG,IAAKG,GAAMA,EAAE,QAAQ,QAAS,MAAM,CAAC,CACzE,EACAN,EAAU,SAAS,MACrB,CAEJ,CAAC,CACH,CAEA,IAAIO,EAAY,GAChB,GAAIlB,EAAO,WAAa,OACtB,GAAI,OAAOW,EAAU,aAAgB,WAAY,CAC/C,IAAMQ,EAAqB,IAAI,cAC/BA,EAAmB,YAAYnB,EAAO,QAAQ,EAC9CkB,EAAYE,GAAsBD,CAAkB,EAAI;AAAA,CAC1D,MAKED,GAAa,GAAGlB,EAAO,QAAQ;AAAA,EAInC,OAAOkB,EAAYE,GAAsBT,CAAS,CACpD,EAxE+B,mBA0FzBU,GAAa1B,EAAA,CAAC2B,EAAyBC,IACpCC,GACLC,GAAQ,GAAGH,CAAS,IAAIC,CAAG,GAAG,EAC9BG,GAAW,CACT/B,EAAA,SAAsBU,EAASsB,EAAQC,EAAWC,EAAW,CAW3D,GAAIxB,EAAQ,OAAS,QAAU,MAAM,QAAQA,EAAQ,KAAK,EAAG,CAC3D,GAAIA,EAAQ,QAAUA,EAAQ,OAAO,OAASyB,EAI5C,OAEFzB,EAAQ,MAAQA,EAAQ,MAAM,IAAK0B,GAC5BA,EAAK,WAAWT,CAAS,EAGvBS,EAFE,GAAGT,CAAS,IAAIS,CAAI,EAG9B,CACH,MAAW1B,EAAQ,KAAK,WAAW,GAAG,IAoBb,CACrB,GAToB,CACpB2B,GACAC,GACAC,GACAC,GACA,aACA,iBACF,EAGEL,CACF,EACoB,SAASzB,EAAQ,IAAuC,IAC1E+B,EAAI,KAAK,gCAAgC/B,EAAQ,IAAI,WAAW,EAChEA,EAAQ,KAAOgC,GAGrB,EArDA,gBAsDAC,EACF,CAAC,CACH,EA5DiB,cA+DNC,GAAmB5C,EAAA,CAC9BK,EACAwC,EACA9B,EAEA+B,IACW,CACX,IAAMC,EAAgBjC,GAAgBT,EAAQU,CAAS,EACjDiC,EAAYC,GAChBJ,EACAE,EACA,CAAE,GAAG1C,EAAO,eAAgB,MAAOA,EAAO,MAAO,KAAMA,EAAO,IAAK,EACnEyC,CACF,EACA,OAAOpB,GAAWoB,EAAOE,CAAS,CACpC,EAfgC,oBAyBnBE,GAAiBlD,EAAA,CAC5BmD,EAAU,GACVC,EACAC,IACW,CACX,IAAIC,EAAeH,EAGnB,MAAI,CAACE,GAAsB,CAACD,IAC1BE,EAAeA,EAAa,QAC1B,yCACA,mBACF,GAGFA,EAAeC,GAAeD,CAAY,EAG1CA,EAAeA,EAAa,QAAQ,QAAS,OAAO,EAE7CA,CACT,EArB8B,kBA8BjBE,GAAgBxD,EAAA,CAACmD,EAAU,GAAIM,IAAuC,CACjF,IAAMC,EAASD,GAAY,SAAS,SAAS,OACzCA,EAAW,QAAQ,QAAQ,OAAS,KACpCtE,GACEwE,EAAmBC,GAAS,gBAAgBvE,EAAiB,KAAK8D,CAAO,SAAS,EACxF,MAAO,wBAAwBjE,EAAY,WAAWwE,CAAM,IAAItE,EAAa,8CAA8CuE,CAAgB,cAAcrE,EAAmB;AAAA,IAC1KC,EAAwB;AAAA,UAE5B,EAR6B,iBAuBhBsE,GAAgB7D,EAAA,CAC3B8D,EACAC,EACAC,EACAC,EACAC,IACG,CACH,IAAMC,EAAeL,EAAW,OAAO,KAAK,EAC5CK,EAAa,KAAK,KAAMH,CAAc,EAClCC,GACFE,EAAa,KAAK,QAASF,CAAQ,EAGrC,IAAMG,EAAUD,EACb,OAAO,KAAK,EACZ,KAAK,KAAMJ,CAAE,EACb,KAAK,QAAS,MAAM,EACpB,KAAK,QAAShF,EAAa,EAC9B,OAAImF,GACFE,EAAQ,KAAK,cAAeF,CAAQ,EAGtCE,EAAQ,OAAO,GAAG,EACXN,CACT,EAxB6B,iBAkC7B,SAASO,GACPC,EACAC,EACA,CACA,OAAOD,EACJ,OAAO,QAAQ,EACf,KAAK,KAAMC,CAAQ,EACnB,KAAK,QAAS,4BAA4B,EAC1C,KAAK,UAAW,EAAE,CACvB,CATSvE,EAAAqE,GAAA,mBAmBF,IAAMG,GAAyBxE,EAAA,CACpCyE,EACAV,EACAW,EACAH,IACG,CAEHE,EAAI,eAAeV,CAAE,GAAG,OAAO,EAG/BU,EAAI,eAAeC,CAAK,GAAG,OAAO,EAClCD,EAAI,eAAeF,CAAQ,GAAG,OAAO,CACvC,EAZsC,0BAoBhCI,GAAS3E,EAAA,eACb+D,EACApE,EACAiF,EACuB,CACvBzE,EAAY,EAEZ,IAAMP,EAAYF,GAAqBC,CAAI,EAC3CA,EAAOC,EAAU,KAEjB,IAAMS,EAAmBwE,EAAU,EACnCpC,EAAI,MAAMpC,CAAM,EAGZV,EAAK,QAAUU,GAAQ,aAAe1B,MACxCgB,EAAOf,IAGT,IAAMkG,EAAa,IAAIf,CAAE,GACnBgB,EAAW,IAAMhB,EACjBiB,EAAoB,IAAMD,EAC1BE,EAAiB,IAAMlB,EACvBmB,EAA0B,IAAMD,EAEhCE,EAAqBnF,EAAA,IAAM,CAI/B,IAAMoF,GAAOC,EADcC,EAAcN,EAAoBE,CACvB,EAAE,KAAK,EACzCE,IAAQ,WAAYA,IACtBA,GAAK,OAAO,CAEhB,EAR2B,sBAUvBG,EAAgEF,EAAO,SAAS,IAAI,EAElFC,EAAcjF,EAAO,gBAAkBxB,GACvC2G,EAAuBnF,EAAO,gBAAkBvB,GAEhD2G,EAAapF,EAAO,WAM1B,GAAIuE,IAAyB,OAAW,CAKtC,GAJIA,IACFA,EAAqB,UAAY,IAG/BU,EAAa,CAEf,IAAMI,EAASrB,GAAgBgB,EAAOT,CAAoB,EAAGG,CAAQ,EACrEQ,EAAOF,EAAOK,EAAO,MAAM,EAAE,CAAC,EAAE,gBAAiB,IAAI,EACrDH,EAAK,KAAK,EAAG,MAAM,OAAS,GAC9B,MACEA,EAAOF,EAAOT,CAAoB,EAEpCf,GAAc0B,EAAMxB,EAAIkB,EAAgB,gBAAgBQ,CAAU,GAAIzG,EAAe,CACvF,KAAO,CASL,GALAwF,GAAuB,SAAUT,EAAIkB,EAAgBF,CAAQ,EAKzDO,EAAa,CAEf,IAAMI,EAASrB,GAAgBgB,EAAO,SAAS,IAAI,EAAGN,CAAQ,EAC9DQ,EAAOF,EAAOK,EAAO,MAAM,EAAE,CAAC,EAAE,gBAAiB,IAAI,EACrDH,EAAK,KAAK,EAAG,MAAM,OAAS,GAC9B,MACEA,EAAOF,EAAO,MAAM,EAGtBxB,GAAc0B,EAAMxB,EAAIkB,CAAc,CACxC,CAMA,IAAIU,EACAC,EAEJ,GAAI,CACFD,EAAO,MAAME,EAAQ,SAASlG,EAAM,CAAE,MAAOC,EAAU,KAAM,CAAC,CAChE,OAASW,EAAO,CACd,GAAIF,EAAO,uBACT,MAAA8E,EAAmB,EACb5E,EAERoF,EAAO,MAAME,EAAQ,SAAS,OAAO,EACrCD,EAA4BrF,CAC9B,CAGA,IAAMG,EAAU6E,EAAK,OAAuBL,CAAuB,EAAE,KAAK,EACpEY,EAAcH,EAAK,KAMnBI,EAAMrF,EAAQ,WACdsF,EAAaD,EAAI,WACjBE,EAAmBN,EAAK,SAAS,aAAahG,EAAMgG,CAAI,EAExDO,EAAQtD,GAAiBvC,EAAQyF,EAAaG,EAAkBnB,CAAU,EAE1EqB,EAAS,SAAS,cAAc,OAAO,EAC7CA,EAAO,UAAYD,EACnBH,EAAI,aAAaI,EAAQH,CAAU,EAInC,GAAI,CACF,MAAML,EAAK,SAAS,KAAKhG,EAAMoE,EAAI,UAAkB4B,CAAI,CAC3D,OAASS,EAAG,CACV,MAAI/F,EAAO,uBACT8E,EAAmB,EAEnBkB,GAAc,KAAK1G,EAAMoE,EAAI,SAAgB,EAEzCqC,CACR,CAGA,IAAMhC,GAAUmB,EAAK,OAAsB,GAAGL,CAAuB,MAAM,EACrEoB,GAAgCX,EAAK,GAAG,cAAc,EACtDY,GAAgCZ,EAAK,GAAG,oBAAoB,EAClEa,GAAYV,EAAa1B,GAASkC,GAAWC,EAAS,EAGtDhB,EAAK,OAAO,QAAQxB,CAAE,IAAI,EAAE,UAAU,mBAAmB,EAAE,KAAK,QAAS9E,EAAe,EAGxF,IAAIkE,EAAkBoC,EAAK,OAAuBL,CAAuB,EAAE,KAAK,EAAG,UAKnF,GAHAzC,EAAI,MAAM,6BAA8BpC,EAAO,mBAAmB,EAClE8C,EAAUD,GAAeC,EAASmC,EAAamB,GAASpG,EAAO,mBAAmB,CAAC,EAE/EiF,EAAa,CACf,IAAMoB,EAAQnB,EAAK,OAAsBL,EAA0B,MAAM,EAAE,KAAK,EAChF/B,EAAUK,GAAcL,EAASuD,CAAK,CACxC,MAAYlB,IAEVrC,EAAUwD,GAAU,SAASxD,EAAS,CACpC,SAAU3D,GACV,SAAUC,GACV,wBAAyB,CAAE,cAAe,EAAK,CACjD,CAAC,GAKH,GAFAmH,GAAgB,EAEZhB,EACF,MAAMA,EAGR,OAAAT,EAAmB,EAEZ,CACL,YAAAW,EACA,IAAK3C,EACL,cAAewC,EAAK,GAAG,aACzB,CACF,EAzKe,UA8Kf,SAASkB,GAAWC,EAA6B,CAAC,EAAG,CACnD,IAAMC,EAAyBC,GAAgB,CAAC,EAAGF,CAAW,EAE1DC,GAAS,YAAc,CAACA,EAAQ,gBAAgB,aAC7CA,EAAQ,iBACXA,EAAQ,eAAiB,CAAC,GAE5BA,EAAQ,eAAe,WAAaA,EAAQ,YAIpCE,GAAyBF,CAAO,EAEtCA,GAAS,OAASA,EAAQ,SAASG,GAErCH,EAAQ,eAAiBG,GAAMH,EAAQ,KAA2B,EAAE,kBAClEA,EAAQ,cACV,EACSA,IACTA,EAAQ,eAAiBG,GAAM,QAAQ,kBAAkBH,EAAQ,cAAc,GAGjF,IAAM1G,EACJ,OAAO0G,GAAY,SAAqBI,GAAcJ,CAAO,EAAcK,GAAc,EAE3FC,GAAYhH,EAAO,QAAQ,EAC3BF,EAAY,CACd,CA3BSH,EAAA6G,GAAA,cA6BT,IAAMvG,GAAqBN,EAAA,CAACL,EAAc2H,EAA2C,CAAC,IAAM,CAC1F,GAAM,CAAE,KAAAlH,CAAK,EAAIP,GAAkBF,CAAI,EACvC,OAAOkG,EAAQ,SAASzF,EAAMkH,CAAQ,CACxC,EAH2B,sBAa3B,SAASd,GACPV,EACA1B,EACAkC,EACAC,EACM,CACNgB,GAAmBnD,EAAS0B,CAAW,EACvC0B,GAA2BpD,EAASkC,EAAWC,EAAWnC,EAAQ,KAAK,IAAI,CAAC,CAC9E,CARSpE,EAAAwG,GAAA,eAaF,IAAMiB,EAAa,OAAO,OAAO,CACtC,OAAA9C,GACA,MAAA1E,GACA,mBAAAK,GACA,WAAAuG,GACA,UAAqBhC,EACrB,UAAqB6C,GACrB,cAAyBN,GACzB,iBAA4BO,GAC5B,MAAO3H,EAAA,IAAM,CACDF,EAAM,CAClB,EAFO,SAGP,YAAaE,EAAA,IAAM,CACPF,EAAgB8H,EAAa,CACzC,EAFa,eAGb,cAAyBA,EAC3B,CAAC,EAEDP,GAAsBxC,EAAU,EAAE,QAAQ,EAChC/E,EAAgB+E,EAAU,CAAC,ECxmBrC,IAAMgD,GAAcC,EAAA,CAACC,EAAgBC,EAAyBC,IAAoC,CAChGC,EAAI,KAAKH,CAAK,EACVI,GAAgBJ,CAAK,GAGnBE,GACFA,EAAWF,EAAM,IAAKA,EAAM,IAAI,EAElCC,EAAO,KAAK,CAAE,GAAGD,EAAO,QAASA,EAAM,IAAK,MAAAA,CAAM,CAAC,IAG/CE,GACFA,EAAWF,CAAK,EAEdA,aAAiB,OACnBC,EAAO,KAAK,CACV,IAAKD,EAAM,QACX,QAASA,EAAM,QACf,KAAMA,EAAM,KACZ,MAAAA,CACF,CAAC,EAGP,EAvBoB,eA6CdK,GAAMN,EAAA,eACVO,EAAsB,CACpB,cAAe,UACjB,EACA,CACA,GAAI,CACF,MAAMC,GAAgBD,CAAO,CAC/B,OAAS,EAAG,CAOV,GANIF,GAAgB,CAAC,GACnBD,EAAI,MAAM,EAAE,GAAG,EAEbK,EAAQ,YACVA,EAAQ,WAAW,CAAW,EAE5B,CAACF,EAAQ,eACX,MAAAH,EAAI,MAAM,wDAAwD,EAC5D,CAEV,CACF,EAnBY,OAqBNI,GAAkBR,EAAA,eACtB,CAAE,mBAAAU,EAAoB,cAAAC,EAAe,MAAAC,CAAM,EAAwC,CACjF,cAAe,UACjB,EACA,CACA,IAAMC,EAAOC,EAAW,UAAU,EAElCV,EAAI,MAAM,GAAIM,EAA6B,GAAR,KAAU,yBAAyB,EAEtE,IAAIK,EACJ,GAAIH,EACFG,EAAiBH,UACRD,EACTI,EAAiB,SAAS,iBAAiBJ,CAAa,MAExD,OAAM,IAAI,MAAM,4CAA4C,EAG9DP,EAAI,MAAM,SAASW,EAAe,MAAM,WAAW,EAC/CF,GAAM,cAAgB,SACxBT,EAAI,MAAM,kBAAoBS,GAAM,WAAW,EAC/CC,EAAW,iBAAiB,CAAE,YAAaD,GAAM,WAAY,CAAC,GAIhE,IAAMG,EAAc,IAAIC,EAAM,gBAAgBJ,EAAK,iBAAkBA,EAAK,mBAAmB,EAEzFK,EACEhB,EAA0B,CAAC,EAIjC,QAAWiB,KAAW,MAAM,KAAKJ,CAAc,EAAG,CAChDX,EAAI,KAAK,sBAAwBe,EAAQ,EAAE,EAE3C,GAAIA,EAAQ,aAAa,gBAAgB,EACvC,SAEFA,EAAQ,aAAa,iBAAkB,MAAM,EAE7C,IAAMC,EAAK,WAAWJ,EAAY,KAAK,CAAC,GAGxCE,EAAMC,EAAQ,UAGdD,EAAMG,GAAOJ,EAAM,aAAaC,CAAG,CAAC,EACjC,KAAK,EACL,QAAQ,eAAgB,OAAO,EAElC,IAAMI,EAAOL,EAAM,WAAWC,CAAG,EAC7BI,GACFlB,EAAI,MAAM,0BAA2BkB,CAAI,EAE3C,GAAI,CACF,GAAM,CAAE,IAAAC,EAAK,cAAAC,CAAc,EAAI,MAAMC,GAAOL,EAAIF,EAAKC,CAAO,EAC5DA,EAAQ,UAAYI,EAChBb,GACF,MAAMA,EAAmBU,CAAE,EAEzBI,GACFA,EAAcL,CAAO,CAEzB,OAASlB,EAAO,CACdF,GAAYE,EAAOC,EAAQO,EAAQ,UAAU,CAC/C,CACF,CACA,GAAIP,EAAO,OAAS,EAElB,MAAMA,EAAO,CAAC,CAElB,EAvEwB,mBA+ElBwB,GAAa1B,EAAA,SAAU2B,EAAuB,CAClDb,EAAW,WAAWa,CAAM,CAC9B,EAFmB,cAkBbL,GAAOtB,EAAA,eACX2B,EACAf,EACAgB,EACA,CACAxB,EAAI,KAAK,qDAAqD,EAC1DuB,GACFD,GAAWC,CAAM,EAEnB,IAAME,EAAyB,CAAE,mBAAoBD,EAAU,cAAe,UAAW,EACrF,OAAOhB,GAAU,SACnBiB,EAAW,cAAgBjB,EAClBA,IACLA,aAAiB,YACnBiB,EAAW,MAAQ,CAACjB,CAAK,EAEzBiB,EAAW,MAAQjB,GAGvB,MAAMN,GAAIuB,CAAU,CACtB,EApBa,QA2BPC,GAA2B9B,EAAA,MAC/B+B,EACA,CACE,SAAAC,EAAW,EACb,EAEI,CAAC,IACF,CACHC,EAAY,EACZC,EAA2B,GAAGH,CAAQ,EAClCC,IAAa,IACf,MAAMG,GAAuB,CAEjC,EAbiC,4BAoB3BC,GAAgBpC,EAAA,UAAY,CAChC,GAAIS,EAAQ,YAAa,CACvB,GAAM,CAAE,YAAA4B,CAAY,EAAIvB,EAAW,UAAU,EACzCuB,GACF5B,EAAQ,IAAI,EAAE,MAAO6B,GAAQlC,EAAI,MAAM,+BAAgCkC,CAAG,CAAC,CAE/E,CACF,EAPsB,iBAStB,GAAI,OAAO,SAAa,IAAa,CAInC,OAAO,iBAAiB,OAAQF,GAAe,EAAK,CACtD,CAgBA,IAAMG,GAAuBvC,EAAA,SAAUwC,EAAkD,CACvF/B,EAAQ,WAAa+B,CACvB,EAF6B,wBAIvBC,GAA6C,CAAC,EAChDC,GAAwB,GACtBC,GAAe3C,EAAA,SAAY,CAC/B,GAAI,CAAA0C,GAIJ,KADAA,GAAwB,GACjBD,GAAe,OAAS,GAAG,CAChC,IAAMG,EAAIH,GAAe,MAAM,EAC/B,GAAIG,EACF,GAAI,CACF,MAAMA,EAAE,CACV,OAAS,EAAG,CACVxC,EAAI,MAAM,wBAAyB,CAAC,CACtC,CAEJ,CACAsC,GAAwB,GAC1B,EAhBqB,gBAqCfG,GAAiC7C,EAAA,MAAO8C,EAAMC,IAC3C,IAAI,QAAQ,CAACC,EAASC,IAAW,CAGtC,IAAMC,EAAclD,EAAA,IAClB,IAAI,QAAQ,CAACmD,EAAKC,IAAQ,CACxBtC,EAAW,MAAMgC,EAAMC,CAAY,EAAE,KAClCM,GAAM,CAELF,EAAIE,CAAC,EAELL,EAAQK,CAAC,CACX,EACCC,GAAM,CACLlD,EAAI,MAAM,gBAAiBkD,CAAC,EAC5B7C,EAAQ,aAAa6C,CAAC,EACtBF,EAAIE,CAAC,EACLL,EAAOK,CAAC,CACV,CACF,CACF,CAAC,EAhBiB,eAiBpBb,GAAe,KAAKS,CAAW,EAC/BP,GAAa,EAAE,MAAMM,CAAM,CAC7B,CAAC,EAvBoC,SAiDjCxB,GAAmCzB,EAAA,CAACoB,EAAI0B,EAAMS,IAC3C,IAAI,QAAQ,CAACP,EAASC,IAAW,CAGtC,IAAMC,EAAclD,EAAA,IAClB,IAAI,QAAQ,CAACmD,EAAKC,IAAQ,CACxBtC,EAAW,OAAOM,EAAI0B,EAAMS,CAAS,EAAE,KACpCF,GAAM,CAELF,EAAIE,CAAC,EAELL,EAAQK,CAAC,CACX,EACCC,GAAM,CACLlD,EAAI,MAAM,gBAAiBkD,CAAC,EAC5B7C,EAAQ,aAAa6C,CAAC,EACtBF,EAAIE,CAAC,EACLL,EAAOK,CAAC,CACV,CACF,CACF,CAAC,EAhBiB,eAiBpBb,GAAe,KAAKS,CAAW,EAC/BP,GAAa,EAAE,MAAMM,CAAM,CAC7B,CAAC,EAvBsC,UA+BnCO,GAAgCxD,EAAA,IAC7B,OAAO,KAAKyD,CAAS,EAAE,IAAKrC,IAAQ,CACzC,GAAAA,CACF,EAAE,EAHkC,iCA+BhCX,EAAmB,CACvB,YAAa,GACb,WAAAK,EACA,MAAA+B,GACA,OAAApB,GACA,KAAAH,GACA,IAAAhB,GACA,yBAAAwB,GACA,sBAAA4B,GACA,WAAAhC,GACA,WAAY,OACZ,cAAAU,GACA,qBAAAG,GACA,WAAAoB,GACA,kBAAAC,GACA,8BAAAJ,EACF,EAEOK,GAAQpD", + "names": ["detector", "__name", "txt", "loader", "diagram", "plugin", "c4Detector_default", "id", "detector", "__name", "txt", "config", "loader", "diagram", "plugin", "flowDetector_default", "id", "detector", "__name", "txt", "config", "loader", "diagram", "plugin", "flowDetector_v2_default", "detector", "__name", "txt", "loader", "diagram", "plugin", "erDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "gitGraphDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "ganttDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "info", "detector", "__name", "txt", "loader", "diagram", "pie", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "quadrantDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "xychartDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "requirementDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "sequenceDetector_default", "id", "detector", "__name", "txt", "config", "loader", "diagram", "plugin", "classDetector_default", "id", "detector", "__name", "txt", "config", "loader", "diagram", "plugin", "classDetector_V2_default", "id", "detector", "__name", "txt", "config", "loader", "diagram", "plugin", "stateDetector_default", "id", "detector", "__name", "txt", "config", "loader", "diagram", "plugin", "stateDetector_V2_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "journeyDetector_default", "draw", "__name", "_text", "id", "version", "log", "svg", "selectSvgElement", "g", "configureSvgSize", "renderer", "errorRenderer_default", "diagram", "renderer", "__name", "errorDiagram_default", "id", "detector", "__name", "txt", "config", "loader", "diagram", "plugin", "detector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "detector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "detector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "detector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "sankeyDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "packet", "id", "detector", "__name", "txt", "loader", "diagram", "radar", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "blockDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "detector_default", "id", "detector", "__name", "txt", "loader", "diagram", "architecture", "architectureDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "detector_default", "id", "detector", "__name", "txt", "loader", "diagram", "ishikawa", "id", "detector", "__name", "txt", "loader", "diagram", "plugin", "vennDetector_default", "id", "detector", "__name", "txt", "loader", "diagram", "treemap", "id", "detector", "__name", "text", "loader", "diagram", "plugin", "wardleyDetector_default", "hasLoadedDiagrams", "addDiagrams", "__name", "registerDiagram", "errorDiagram_default", "text", "registerLazyLoadedDiagrams", "detector_default", "architectureDetector_default", "c4Detector_default", "classDetector_V2_default", "classDetector_default", "erDetector_default", "ganttDetector_default", "info", "pie", "requirementDetector_default", "sequenceDetector_default", "flowDetector_v2_default", "flowDetector_default", "gitGraphDetector_default", "stateDetector_V2_default", "stateDetector_default", "journeyDetector_default", "quadrantDetector_default", "sankeyDetector_default", "packet", "xychartDetector_default", "blockDetector_default", "radar", "ishikawa", "treemap", "vennDetector_default", "wardleyDetector_default", "loadRegisteredDiagrams", "__name", "log", "failed", "detectors", "key", "detector", "loader", "getDiagram", "diagram", "id", "registerDiagram", "err", "result", "res", "COMMENT", "RULESET", "DECLARATION", "MEDIA", "IMPORT", "SUPPORTS", "NAMESPACE", "KEYFRAMES", "LAYER", "SCOPE", "abs", "from", "trim", "value", "__name", "replace", "value", "pattern", "replacement", "__name", "indexof", "search", "position", "charat", "index", "substr", "begin", "end", "strlen", "sizeof", "append", "array", "line", "column", "length", "position", "character", "characters", "node", "value", "root", "parent", "type", "props", "children", "siblings", "__name", "char", "character", "__name", "prev", "position", "charat", "characters", "column", "line", "next", "length", "peek", "caret", "slice", "begin", "end", "substr", "token", "type", "alloc", "value", "strlen", "dealloc", "delimit", "trim", "delimiter", "whitespace", "type", "character", "peek", "next", "token", "__name", "escaping", "index", "count", "next", "character", "slice", "caret", "peek", "__name", "delimiter", "type", "position", "commenter", "from", "identifier", "token", "compile", "value", "dealloc", "parse", "alloc", "__name", "root", "parent", "rule", "rules", "rulesets", "pseudo", "points", "declarations", "index", "offset", "length", "atrule", "property", "previous", "variable", "scanning", "ampersand", "character", "type", "props", "children", "reference", "characters", "next", "charat", "indexof", "replace", "delimit", "abs", "whitespace", "escaping", "caret", "peek", "append", "comment", "commenter", "token", "strlen", "substr", "declaration", "ruleset", "prev", "from", "identifier", "siblings", "post", "size", "sizeof", "i", "j", "k", "x", "y", "z", "trim", "node", "RULESET", "COMMENT", "char", "DECLARATION", "serialize", "children", "callback", "output", "__name", "stringify", "element", "index", "LAYER", "IMPORT", "NAMESPACE", "DECLARATION", "COMMENT", "KEYFRAMES", "RULESET", "strlen", "middleware", "collection", "length", "sizeof", "element", "index", "children", "callback", "output", "i", "__name", "SVG_ROLE", "setA11yDiagramInfo", "svg", "diagramType", "__name", "addSVGa11yTitleDescription", "a11yTitle", "a11yDesc", "baseId", "descId", "titleId", "Diagram", "_Diagram", "type", "text", "db", "parser", "renderer", "__name", "metadata", "config", "getConfig", "detectType", "encodeEntities", "getDiagram", "loader", "getDiagramLoader", "UnknownDiagramError", "id", "diagram", "registerDiagram", "init", "version", "interactionFunctions", "attachFunctions", "__name", "interactionFunctions", "f", "cleanupComments", "__name", "text", "extractFrontMatter", "text", "matches", "frontMatterRegex", "parsed", "load", "JSON_SCHEMA", "metadata", "__name", "cleanupText", "__name", "code", "match", "tag", "attributes", "processFrontmatter", "text", "metadata", "extractFrontMatter", "displayMode", "title", "config", "processDirectives", "initDirective", "utils_default", "wrapDirectives", "type", "removeDirectives", "preprocessDiagram", "cleanedCode", "frontMatterResult", "directiveResult", "cleanAndMerge", "cleanupComments", "toBase64", "str", "utf8Bytes", "utf8Str", "byte", "__name", "MAX_TEXTLENGTH", "MAX_TEXTLENGTH_EXCEEDED_MSG", "SECURITY_LVL_SANDBOX", "SECURITY_LVL_LOOSE", "XMLNS_SVG_STD", "XMLNS_XLINK_STD", "XMLNS_XHTML_STD", "IFRAME_WIDTH", "IFRAME_HEIGHT", "IFRAME_STYLES", "IFRAME_BODY_STYLE", "IFRAME_SANDBOX_OPTS", "IFRAME_NOT_SUPPORTED_MSG", "DOMPURIFY_TAGS", "DOMPURIFY_ATTR", "processAndSetConfigs", "text", "processed", "preprocessDiagram", "reset", "addDirective", "__name", "parse", "parseOptions", "addDiagrams", "code", "config", "getDiagramFromText", "error", "cssImportantStyles", "cssClass", "element", "cssClasses", "declarationBlock", "sanitizeCss", "createCssStyles", "classDefs", "cssStyles", "cssElements", "getEffectiveHtmlLabels", "styleClassDef", "isEmpty", "cssElement", "s", "cssString", "themeCssStyleSheet", "cssStyleSheetToString", "compileCSS", "namespace", "css", "serialize", "compile", "middleware", "_index", "_children", "_callback", "KEYFRAMES", "prop", "MEDIA", "SUPPORTS", "LAYER", "SCOPE", "log", "COMMENT", "stringify", "createUserStyles", "graphType", "svgId", "userCSSstyles", "allStyles", "styles_default", "cleanUpSvgCode", "svgCode", "inSandboxMode", "useArrowMarkerUrls", "cleanedUpSvg", "decodeEntities", "putIntoIFrame", "svgElement", "height", "base64encodedSrc", "toBase64", "appendDivSvgG", "parentRoot", "id", "enclosingDivId", "divStyle", "svgXlink", "enclosingDiv", "svgNode", "sandboxedIframe", "parentNode", "iFrameId", "removeExistingElements", "doc", "divId", "render", "svgContainingElement", "getConfig", "idSelector", "iFrameID", "iFrameID_selector", "enclosingDivID", "enclosingDivID_selector", "removeTempElements", "node", "select_default", "isSandboxed", "root", "isLooseSecurityLevel", "fontFamily", "iframe", "diag", "parseEncounteredException", "Diagram", "diagramType", "svg", "firstChild", "diagramClassDefs", "rules", "style1", "e", "errorRenderer_default", "a11yTitle", "a11yDescr", "addA11yInfo", "evaluate", "svgEl", "purify", "attachFunctions", "initialize", "userOptions", "options", "assignWithDepth_default", "saveConfigFromInitialize", "themes_default", "setSiteConfig", "getSiteConfig", "setLogLevel", "metadata", "setA11yDiagramInfo", "addSVGa11yTitleDescription", "mermaidAPI", "setConfig", "updateSiteConfig", "defaultConfig", "handleError", "__name", "error", "errors", "parseError", "log", "isDetailedError", "run", "options", "runThrowsErrors", "mermaid", "postRenderCallback", "querySelector", "nodes", "conf", "mermaidAPI", "nodesToProcess", "idGenerator", "utils_default", "txt", "element", "id", "dedent", "init", "svg", "bindFunctions", "render", "initialize", "config", "callback", "runOptions", "registerExternalDiagrams", "diagrams", "lazyLoad", "addDiagrams", "registerLazyLoadedDiagrams", "loadRegisteredDiagrams", "contentLoaded", "startOnLoad", "err", "setParseErrorHandler", "parseErrorHandler", "executionQueue", "executionQueueRunning", "executeQueue", "f", "parse", "text", "parseOptions", "resolve", "reject", "performCall", "res", "rej", "r", "e", "container", "getRegisteredDiagramsMetadata", "detectors", "registerLayoutLoaders", "detectType", "registerIconPacks", "mermaid_default"] +} diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.esm.mjs b/tools/ui/node_modules/mermaid/dist/mermaid.esm.mjs new file mode 100644 index 0000000000000000000000000000000000000000..48d7e3632fdeb1edaa2890d4164e48cd5c27408b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.esm.mjs @@ -0,0 +1,1899 @@ +import { + selectSvgElement +} from "./chunks/mermaid.esm/chunk-PUIB63ON.mjs"; +import { + JSON_SCHEMA, + load +} from "./chunks/mermaid.esm/chunk-PWCFYZI5.mjs"; +import { + registerLayoutLoaders +} from "./chunks/mermaid.esm/chunk-SNQTKDUU.mjs"; +import "./chunks/mermaid.esm/chunk-TRQY2T3P.mjs"; +import "./chunks/mermaid.esm/chunk-HQMLCRZ6.mjs"; +import "./chunks/mermaid.esm/chunk-PLCLPJVV.mjs"; +import "./chunks/mermaid.esm/chunk-GTILCTU2.mjs"; +import "./chunks/mermaid.esm/chunk-RTI7CJYH.mjs"; +import "./chunks/mermaid.esm/chunk-SZ5Y56Q4.mjs"; +import { + dedent, + registerIconPacks +} from "./chunks/mermaid.esm/chunk-YSJUE5HW.mjs"; +import { + cleanAndMerge, + decodeEntities, + encodeEntities, + isDetailedError, + isEmpty, + removeDirectives, + utils_default +} from "./chunks/mermaid.esm/chunk-BSZA5ISF.mjs"; +import "./chunks/mermaid.esm/chunk-7TFACZ55.mjs"; +import { + UnknownDiagramError, + addDirective, + assignWithDepth_default, + configureSvgSize, + cssStyleSheetToString, + defaultConfig, + detectType, + detectors, + evaluate, + frontMatterRegex, + getConfig, + getDiagram, + getDiagramLoader, + getEffectiveHtmlLabels, + getSiteConfig, + purify, + registerDiagram, + registerLazyLoadedDiagrams, + reset, + sanitizeCss, + saveConfigFromInitialize, + setConfig, + setSiteConfig, + styles_default, + themes_default, + updateSiteConfig +} from "./chunks/mermaid.esm/chunk-Q52JI7PB.mjs"; +import { + log, + select_default, + setLogLevel +} from "./chunks/mermaid.esm/chunk-V7P66DNM.mjs"; +import { + __name +} from "./chunks/mermaid.esm/chunk-PTVI3W5X.mjs"; + +// src/diagrams/c4/c4Detector.ts +var id = "c4"; +var detector = /* @__PURE__ */ __name((txt) => { + return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt); +}, "detector"); +var loader = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/c4Diagram-MWKDPP7W.mjs"); + return { id, diagram: diagram2 }; +}, "loader"); +var plugin = { + id, + detector, + loader +}; +var c4Detector_default = plugin; + +// src/diagrams/flowchart/flowDetector.ts +var id2 = "flowchart"; +var detector2 = /* @__PURE__ */ __name((txt, config) => { + if (config?.flowchart?.defaultRenderer === "dagre-wrapper" || config?.flowchart?.defaultRenderer === "elk") { + return false; + } + return /^\s*graph/.test(txt); +}, "detector"); +var loader2 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/flowDiagram-3HAHYXQ6.mjs"); + return { id: id2, diagram: diagram2 }; +}, "loader"); +var plugin2 = { + id: id2, + detector: detector2, + loader: loader2 +}; +var flowDetector_default = plugin2; + +// src/diagrams/flowchart/flowDetector-v2.ts +var id3 = "flowchart-v2"; +var detector3 = /* @__PURE__ */ __name((txt, config) => { + if (config?.flowchart?.defaultRenderer === "dagre-d3") { + return false; + } + if (config?.flowchart?.defaultRenderer === "elk") { + config.layout = "elk"; + } + if (/^\s*graph/.test(txt) && config?.flowchart?.defaultRenderer === "dagre-wrapper") { + return true; + } + return /^\s*flowchart/.test(txt); +}, "detector"); +var loader3 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/flowDiagram-3HAHYXQ6.mjs"); + return { id: id3, diagram: diagram2 }; +}, "loader"); +var plugin3 = { + id: id3, + detector: detector3, + loader: loader3 +}; +var flowDetector_v2_default = plugin3; + +// src/diagrams/er/erDetector.ts +var id4 = "er"; +var detector4 = /* @__PURE__ */ __name((txt) => { + return /^\s*erDiagram/.test(txt); +}, "detector"); +var loader4 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/erDiagram-T2DQBZM5.mjs"); + return { id: id4, diagram: diagram2 }; +}, "loader"); +var plugin4 = { + id: id4, + detector: detector4, + loader: loader4 +}; +var erDetector_default = plugin4; + +// src/diagrams/git/gitGraphDetector.ts +var id5 = "gitGraph"; +var detector5 = /* @__PURE__ */ __name((txt) => { + return /^\s*gitGraph/.test(txt); +}, "detector"); +var loader5 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/gitGraphDiagram-6WOFZIJB.mjs"); + return { id: id5, diagram: diagram2 }; +}, "loader"); +var plugin5 = { + id: id5, + detector: detector5, + loader: loader5 +}; +var gitGraphDetector_default = plugin5; + +// src/diagrams/gantt/ganttDetector.ts +var id6 = "gantt"; +var detector6 = /* @__PURE__ */ __name((txt) => { + return /^\s*gantt/.test(txt); +}, "detector"); +var loader6 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/ganttDiagram-2ISF3G2B.mjs"); + return { id: id6, diagram: diagram2 }; +}, "loader"); +var plugin6 = { + id: id6, + detector: detector6, + loader: loader6 +}; +var ganttDetector_default = plugin6; + +// src/diagrams/info/infoDetector.ts +var id7 = "info"; +var detector7 = /* @__PURE__ */ __name((txt) => { + return /^\s*info/.test(txt); +}, "detector"); +var loader7 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/infoDiagram-EYWOMQDI.mjs"); + return { id: id7, diagram: diagram2 }; +}, "loader"); +var info = { + id: id7, + detector: detector7, + loader: loader7 +}; + +// src/diagrams/pie/pieDetector.ts +var id8 = "pie"; +var detector8 = /* @__PURE__ */ __name((txt) => { + return /^\s*pie/.test(txt); +}, "detector"); +var loader8 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/pieDiagram-2C4A3L6T.mjs"); + return { id: id8, diagram: diagram2 }; +}, "loader"); +var pie = { + id: id8, + detector: detector8, + loader: loader8 +}; + +// src/diagrams/quadrant-chart/quadrantDetector.ts +var id9 = "quadrantChart"; +var detector9 = /* @__PURE__ */ __name((txt) => { + return /^\s*quadrantChart/.test(txt); +}, "detector"); +var loader9 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/quadrantDiagram-K3KQ5NL4.mjs"); + return { id: id9, diagram: diagram2 }; +}, "loader"); +var plugin7 = { + id: id9, + detector: detector9, + loader: loader9 +}; +var quadrantDetector_default = plugin7; + +// src/diagrams/xychart/xychartDetector.ts +var id10 = "xychart"; +var detector10 = /* @__PURE__ */ __name((txt) => { + return /^\s*xychart(-beta)?/.test(txt); +}, "detector"); +var loader10 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/xychartDiagram-2MMURBJR.mjs"); + return { id: id10, diagram: diagram2 }; +}, "loader"); +var plugin8 = { + id: id10, + detector: detector10, + loader: loader10 +}; +var xychartDetector_default = plugin8; + +// src/diagrams/requirement/requirementDetector.ts +var id11 = "requirement"; +var detector11 = /* @__PURE__ */ __name((txt) => { + return /^\s*requirement(Diagram)?/.test(txt); +}, "detector"); +var loader11 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/requirementDiagram-WYUPVDHP.mjs"); + return { id: id11, diagram: diagram2 }; +}, "loader"); +var plugin9 = { + id: id11, + detector: detector11, + loader: loader11 +}; +var requirementDetector_default = plugin9; + +// src/diagrams/sequence/sequenceDetector.ts +var id12 = "sequence"; +var detector12 = /* @__PURE__ */ __name((txt) => { + return /^\s*sequenceDiagram/.test(txt); +}, "detector"); +var loader12 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/sequenceDiagram-37ID66UD.mjs"); + return { id: id12, diagram: diagram2 }; +}, "loader"); +var plugin10 = { + id: id12, + detector: detector12, + loader: loader12 +}; +var sequenceDetector_default = plugin10; + +// src/diagrams/class/classDetector.ts +var id13 = "class"; +var detector13 = /* @__PURE__ */ __name((txt, config) => { + if (config?.class?.defaultRenderer === "dagre-wrapper") { + return false; + } + return /^\s*classDiagram/.test(txt); +}, "detector"); +var loader13 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/classDiagram-SEOGYEGJ.mjs"); + return { id: id13, diagram: diagram2 }; +}, "loader"); +var plugin11 = { + id: id13, + detector: detector13, + loader: loader13 +}; +var classDetector_default = plugin11; + +// src/diagrams/class/classDetector-V2.ts +var id14 = "classDiagram"; +var detector14 = /* @__PURE__ */ __name((txt, config) => { + if (/^\s*classDiagram/.test(txt) && config?.class?.defaultRenderer === "dagre-wrapper") { + return true; + } + return /^\s*classDiagram-v2/.test(txt); +}, "detector"); +var loader14 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/classDiagram-v2-AOBZDD47.mjs"); + return { id: id14, diagram: diagram2 }; +}, "loader"); +var plugin12 = { + id: id14, + detector: detector14, + loader: loader14 +}; +var classDetector_V2_default = plugin12; + +// src/diagrams/state/stateDetector.ts +var id15 = "state"; +var detector15 = /* @__PURE__ */ __name((txt, config) => { + if (config?.state?.defaultRenderer === "dagre-wrapper") { + return false; + } + return /^\s*stateDiagram/.test(txt); +}, "detector"); +var loader15 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/stateDiagram-FKBH27AD.mjs"); + return { id: id15, diagram: diagram2 }; +}, "loader"); +var plugin13 = { + id: id15, + detector: detector15, + loader: loader15 +}; +var stateDetector_default = plugin13; + +// src/diagrams/state/stateDetector-V2.ts +var id16 = "stateDiagram"; +var detector16 = /* @__PURE__ */ __name((txt, config) => { + if (/^\s*stateDiagram-v2/.test(txt)) { + return true; + } + if (/^\s*stateDiagram/.test(txt) && config?.state?.defaultRenderer === "dagre-wrapper") { + return true; + } + return false; +}, "detector"); +var loader16 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/stateDiagram-v2-PT3EUVB6.mjs"); + return { id: id16, diagram: diagram2 }; +}, "loader"); +var plugin14 = { + id: id16, + detector: detector16, + loader: loader16 +}; +var stateDetector_V2_default = plugin14; + +// src/diagrams/user-journey/journeyDetector.ts +var id17 = "journey"; +var detector17 = /* @__PURE__ */ __name((txt) => { + return /^\s*journey/.test(txt); +}, "detector"); +var loader17 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/journeyDiagram-MYZUOU3L.mjs"); + return { id: id17, diagram: diagram2 }; +}, "loader"); +var plugin15 = { + id: id17, + detector: detector17, + loader: loader17 +}; +var journeyDetector_default = plugin15; + +// src/diagrams/error/errorRenderer.ts +var draw = /* @__PURE__ */ __name((_text, id33, version) => { + log.debug("rendering svg for syntax error\n"); + const svg = selectSvgElement(id33); + const g = svg.append("g"); + svg.attr("viewBox", "0 0 2412 512"); + configureSvgSize(svg, 100, 512, true); + g.append("path").attr("class", "error-icon").attr( + "d", + "m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z" + ); + g.append("path").attr("class", "error-icon").attr( + "d", + "m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z" + ); + g.append("text").attr("class", "error-text").attr("x", 1440).attr("y", 250).attr("font-size", "150px").style("text-anchor", "middle").text("Syntax error in text"); + g.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${version}`); +}, "draw"); +var renderer = { draw }; +var errorRenderer_default = renderer; + +// src/diagrams/error/errorDiagram.ts +var diagram = { + db: {}, + renderer, + parser: { + parse: /* @__PURE__ */ __name(() => { + return; + }, "parse") + } +}; +var errorDiagram_default = diagram; + +// src/diagrams/flowchart/elk/detector.ts +var id18 = "flowchart-elk"; +var detector18 = /* @__PURE__ */ __name((txt, config = {}) => { + if ( + // If diagram explicitly states flowchart-elk + /^\s*flowchart-elk/.test(txt) || // If a flowchart/graph diagram has their default renderer set to elk + /^\s*(flowchart|graph)/.test(txt) && config?.flowchart?.defaultRenderer === "elk" + ) { + config.layout = "elk"; + return true; + } + return false; +}, "detector"); +var loader18 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/flowDiagram-3HAHYXQ6.mjs"); + return { id: id18, diagram: diagram2 }; +}, "loader"); +var plugin16 = { + id: id18, + detector: detector18, + loader: loader18 +}; +var detector_default = plugin16; + +// src/diagrams/timeline/detector.ts +var id19 = "timeline"; +var detector19 = /* @__PURE__ */ __name((txt) => { + return /^\s*timeline/.test(txt); +}, "detector"); +var loader19 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/timeline-definition-VWZII4OX.mjs"); + return { id: id19, diagram: diagram2 }; +}, "loader"); +var plugin17 = { + id: id19, + detector: detector19, + loader: loader19 +}; +var detector_default2 = plugin17; + +// src/diagrams/mindmap/detector.ts +var id20 = "mindmap"; +var detector20 = /* @__PURE__ */ __name((txt) => { + return /^\s*mindmap/.test(txt); +}, "detector"); +var loader20 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/mindmap-definition-AITDCVNG.mjs"); + return { id: id20, diagram: diagram2 }; +}, "loader"); +var plugin18 = { + id: id20, + detector: detector20, + loader: loader20 +}; +var detector_default3 = plugin18; + +// src/diagrams/kanban/detector.ts +var id21 = "kanban"; +var detector21 = /* @__PURE__ */ __name((txt) => { + return /^\s*kanban/.test(txt); +}, "detector"); +var loader21 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/kanban-definition-ERDM4LRJ.mjs"); + return { id: id21, diagram: diagram2 }; +}, "loader"); +var plugin19 = { + id: id21, + detector: detector21, + loader: loader21 +}; +var detector_default4 = plugin19; + +// src/diagrams/sankey/sankeyDetector.ts +var id22 = "sankey"; +var detector22 = /* @__PURE__ */ __name((txt) => { + return /^\s*sankey(-beta)?/.test(txt); +}, "detector"); +var loader22 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/sankeyDiagram-TAHJUD2B.mjs"); + return { id: id22, diagram: diagram2 }; +}, "loader"); +var plugin20 = { + id: id22, + detector: detector22, + loader: loader22 +}; +var sankeyDetector_default = plugin20; + +// src/diagrams/packet/detector.ts +var id23 = "packet"; +var detector23 = /* @__PURE__ */ __name((txt) => { + return /^\s*packet(-beta)?/.test(txt); +}, "detector"); +var loader23 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/diagram-N34NG4AO.mjs"); + return { id: id23, diagram: diagram2 }; +}, "loader"); +var packet = { + id: id23, + detector: detector23, + loader: loader23 +}; + +// src/diagrams/radar/detector.ts +var id24 = "radar"; +var detector24 = /* @__PURE__ */ __name((txt) => { + return /^\s*radar-beta/.test(txt); +}, "detector"); +var loader24 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/diagram-ZEGC52LS.mjs"); + return { id: id24, diagram: diagram2 }; +}, "loader"); +var radar = { + id: id24, + detector: detector24, + loader: loader24 +}; + +// src/diagrams/block/blockDetector.ts +var id25 = "block"; +var detector25 = /* @__PURE__ */ __name((txt) => { + return /^\s*block(-beta)?/.test(txt); +}, "detector"); +var loader25 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/blockDiagram-DM4EUEQ4.mjs"); + return { id: id25, diagram: diagram2 }; +}, "loader"); +var plugin21 = { + id: id25, + detector: detector25, + loader: loader25 +}; +var blockDetector_default = plugin21; + +// src/diagrams/treeView/detector.ts +var id26 = "treeView"; +var detector26 = /* @__PURE__ */ __name((txt) => { + return /^\s*treeView-beta/.test(txt); +}, "detector"); +var loader26 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/diagram-CAG56N7L.mjs"); + return { id: id26, diagram: diagram2 }; +}, "loader"); +var plugin22 = { + id: id26, + detector: detector26, + loader: loader26 +}; +var detector_default5 = plugin22; + +// src/diagrams/architecture/architectureDetector.ts +var id27 = "architecture"; +var detector27 = /* @__PURE__ */ __name((txt) => { + return /^\s*architecture/.test(txt); +}, "detector"); +var loader27 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/architectureDiagram-BSNNHI6N.mjs"); + return { id: id27, diagram: diagram2 }; +}, "loader"); +var architecture = { + id: id27, + detector: detector27, + loader: loader27 +}; +var architectureDetector_default = architecture; + +// src/diagrams/eventmodeling/detector.ts +var id28 = "eventmodeling"; +var detector28 = /* @__PURE__ */ __name((txt) => { + return /^\s*eventmodeling/.test(txt); +}, "detector"); +var loader28 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/diagram-AU3YPP64.mjs"); + return { id: id28, diagram: diagram2 }; +}, "loader"); +var plugin23 = { + id: id28, + detector: detector28, + loader: loader28 +}; +var detector_default6 = plugin23; + +// src/diagrams/ishikawa/ishikawaDetector.ts +var id29 = "ishikawa"; +var detector29 = /* @__PURE__ */ __name((txt) => { + return /^\s*ishikawa(-beta)?\b/i.test(txt); +}, "detector"); +var loader29 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/ishikawaDiagram-RFIIXC3A.mjs"); + return { id: id29, diagram: diagram2 }; +}, "loader"); +var ishikawa = { + id: id29, + detector: detector29, + loader: loader29 +}; + +// src/diagrams/venn/vennDetector.ts +var id30 = "venn"; +var detector30 = /* @__PURE__ */ __name((txt) => { + return /^\s*venn-beta/.test(txt); +}, "detector"); +var loader30 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/vennDiagram-CDPVD3PM.mjs"); + return { id: id30, diagram: diagram2 }; +}, "loader"); +var plugin24 = { + id: id30, + detector: detector30, + loader: loader30 +}; +var vennDetector_default = plugin24; + +// src/diagrams/treemap/detector.ts +var id31 = "treemap"; +var detector31 = /* @__PURE__ */ __name((txt) => { + return /^\s*treemap/.test(txt); +}, "detector"); +var loader31 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/diagram-OKXK7GIF.mjs"); + return { id: id31, diagram: diagram2 }; +}, "loader"); +var treemap = { + id: id31, + detector: detector31, + loader: loader31 +}; + +// src/diagrams/wardley/wardleyDetector.ts +var id32 = "wardley-beta"; +var detector32 = /* @__PURE__ */ __name((text) => { + return /^\s*wardley-beta/i.test(text); +}, "detector"); +var loader32 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram2 } = await import("./chunks/mermaid.esm/wardleyDiagram-OB3YXH5L.mjs"); + return { id: id32, diagram: diagram2 }; +}, "loader"); +var plugin25 = { + id: id32, + detector: detector32, + loader: loader32 +}; +var wardleyDetector_default = plugin25; + +// src/diagram-api/diagram-orchestration.ts +var hasLoadedDiagrams = false; +var addDiagrams = /* @__PURE__ */ __name(() => { + if (hasLoadedDiagrams) { + return; + } + hasLoadedDiagrams = true; + registerDiagram("error", errorDiagram_default, (text) => { + return text.toLowerCase().trim() === "error"; + }); + registerDiagram( + "---", + // --- diagram type may appear if YAML front-matter is not parsed correctly + { + db: { + clear: /* @__PURE__ */ __name(() => { + }, "clear") + }, + styles: {}, + // should never be used + renderer: { + draw: /* @__PURE__ */ __name(() => { + }, "draw") + }, + parser: { + parse: /* @__PURE__ */ __name(() => { + throw new Error( + "Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks" + ); + }, "parse") + }, + init: /* @__PURE__ */ __name(() => null, "init") + // no op + }, + (text) => { + return text.toLowerCase().trimStart().startsWith("---"); + } + ); + if (true) { + registerLazyLoadedDiagrams(detector_default, detector_default3, architectureDetector_default); + } + registerLazyLoadedDiagrams( + c4Detector_default, + detector_default4, + classDetector_V2_default, + classDetector_default, + erDetector_default, + ganttDetector_default, + info, + pie, + requirementDetector_default, + sequenceDetector_default, + flowDetector_v2_default, + flowDetector_default, + detector_default2, + gitGraphDetector_default, + stateDetector_V2_default, + stateDetector_default, + journeyDetector_default, + quadrantDetector_default, + sankeyDetector_default, + packet, + xychartDetector_default, + blockDetector_default, + detector_default6, + detector_default5, + radar, + ishikawa, + treemap, + vennDetector_default, + wardleyDetector_default + ); +}, "addDiagrams"); + +// src/diagram-api/loadDiagram.ts +var loadRegisteredDiagrams = /* @__PURE__ */ __name(async () => { + log.debug(`Loading registered diagrams`); + const results = await Promise.allSettled( + Object.entries(detectors).map(async ([key, { detector: detector33, loader: loader33 }]) => { + if (!loader33) { + return; + } + try { + getDiagram(key); + } catch { + try { + const { diagram: diagram2, id: id33 } = await loader33(); + registerDiagram(id33, diagram2, detector33); + } catch (err) { + log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`); + delete detectors[key]; + throw err; + } + } + }) + ); + const failed = results.filter((result) => result.status === "rejected"); + if (failed.length > 0) { + log.error(`Failed to load ${failed.length} external diagrams`); + for (const res of failed) { + log.error(res); + } + throw new Error(`Failed to load ${failed.length} external diagrams`); + } +}, "loadRegisteredDiagrams"); + +// ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Enum.js +var COMMENT = "comm"; +var RULESET = "rule"; +var DECLARATION = "decl"; +var MEDIA = "@media"; +var IMPORT = "@import"; +var SUPPORTS = "@supports"; +var NAMESPACE = "@namespace"; +var KEYFRAMES = "@keyframes"; +var LAYER = "@layer"; +var SCOPE = "@scope"; + +// ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Utility.js +var abs = Math.abs; +var from = String.fromCharCode; +function trim(value) { + return value.trim(); +} +__name(trim, "trim"); +function replace(value, pattern, replacement) { + return value.replace(pattern, replacement); +} +__name(replace, "replace"); +function indexof(value, search, position2) { + return value.indexOf(search, position2); +} +__name(indexof, "indexof"); +function charat(value, index) { + return value.charCodeAt(index) | 0; +} +__name(charat, "charat"); +function substr(value, begin, end) { + return value.slice(begin, end); +} +__name(substr, "substr"); +function strlen(value) { + return value.length; +} +__name(strlen, "strlen"); +function sizeof(value) { + return value.length; +} +__name(sizeof, "sizeof"); +function append(value, array) { + return array.push(value), value; +} +__name(append, "append"); + +// ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Tokenizer.js +var line = 1; +var column = 1; +var length = 0; +var position = 0; +var character = 0; +var characters = ""; +function node(value, root, parent, type, props, children, length2, siblings) { + return { value, root, parent, type, props, children, line, column, length: length2, return: "", siblings }; +} +__name(node, "node"); +function char() { + return character; +} +__name(char, "char"); +function prev() { + character = position > 0 ? charat(characters, --position) : 0; + if (column--, character === 10) + column = 1, line--; + return character; +} +__name(prev, "prev"); +function next() { + character = position < length ? charat(characters, position++) : 0; + if (column++, character === 10) + column = 1, line++; + return character; +} +__name(next, "next"); +function peek() { + return charat(characters, position); +} +__name(peek, "peek"); +function caret() { + return position; +} +__name(caret, "caret"); +function slice(begin, end) { + return substr(characters, begin, end); +} +__name(slice, "slice"); +function token(type) { + switch (type) { + // \0 \t \n \r \s whitespace token + case 0: + case 9: + case 10: + case 13: + case 32: + return 5; + // ! + , / > @ ~ isolate token + case 33: + case 43: + case 44: + case 47: + case 62: + case 64: + case 126: + // ; { } breakpoint token + case 59: + case 123: + case 125: + return 4; + // : accompanied token + case 58: + return 3; + // " ' ( [ opening delimit token + case 34: + case 39: + case 40: + case 91: + return 2; + // ) ] closing delimit token + case 41: + case 93: + return 1; + } + return 0; +} +__name(token, "token"); +function alloc(value) { + return line = column = 1, length = strlen(characters = value), position = 0, []; +} +__name(alloc, "alloc"); +function dealloc(value) { + return characters = "", value; +} +__name(dealloc, "dealloc"); +function delimit(type) { + return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type))); +} +__name(delimit, "delimit"); +function whitespace(type) { + while (character = peek()) + if (character < 33) + next(); + else + break; + return token(type) > 2 || token(character) > 3 ? "" : " "; +} +__name(whitespace, "whitespace"); +function escaping(index, count) { + while (--count && next()) + if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) + break; + return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32)); +} +__name(escaping, "escaping"); +function delimiter(type) { + while (next()) + switch (character) { + // ] ) " ' + case type: + return position; + // " ' + case 34: + case 39: + if (type !== 34 && type !== 39) + delimiter(character); + break; + // ( + case 40: + if (type === 41) + delimiter(type); + break; + // \ + case 92: + next(); + break; + } + return position; +} +__name(delimiter, "delimiter"); +function commenter(type, index) { + while (next()) + if (type + character === 47 + 10) + break; + else if (type + character === 42 + 42 && peek() === 47) + break; + return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next()); +} +__name(commenter, "commenter"); +function identifier(index) { + while (!token(peek())) + next(); + return slice(index, position); +} +__name(identifier, "identifier"); + +// ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Parser.js +function compile(value) { + return dealloc(parse("", null, null, null, [""], value = alloc(value), 0, [0], value)); +} +__name(compile, "compile"); +function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) { + var index = 0; + var offset = 0; + var length2 = pseudo; + var atrule = 0; + var property = 0; + var previous = 0; + var variable = 1; + var scanning = 1; + var ampersand = 1; + var character2 = 0; + var type = ""; + var props = rules; + var children = rulesets; + var reference = rule; + var characters2 = type; + while (scanning) + switch (previous = character2, character2 = next()) { + // ( + case 40: + if (previous != 108 && charat(characters2, length2 - 1) == 58) { + if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f", abs(index ? points[index - 1] : 0)) != -1) + ampersand = -1; + break; + } + // " ' [ + case 34: + case 39: + case 91: + characters2 += delimit(character2); + break; + // \t \n \r \s + case 9: + case 10: + case 13: + case 32: + characters2 += whitespace(previous); + break; + // \ + case 92: + characters2 += escaping(caret() - 1, 7); + continue; + // / + case 47: + switch (peek()) { + case 42: + case 47: + append(comment(commenter(next(), caret()), root, parent, declarations), declarations); + if ((token(previous || 1) == 5 || token(peek() || 1) == 5) && strlen(characters2) && substr(characters2, -1, void 0) !== " ") characters2 += " "; + break; + default: + characters2 += "/"; + } + break; + // { + case 123 * variable: + points[index++] = strlen(characters2) * ampersand; + // } ; \0 + case 125 * variable: + case 59: + case 0: + switch (character2) { + // \0 } + case 0: + case 125: + scanning = 0; + // ; + case 59 + offset: + if (ampersand == -1) characters2 = replace(characters2, /\f/g, ""); + if (property > 0 && (strlen(characters2) - length2 || variable === 0 && previous === 47)) + append(property > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1, declarations) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2, declarations), declarations); + break; + // @ ; + case 59: + characters2 += ";"; + // { rule/at-rule + default: + append(reference = ruleset(characters2, root, parent, index, offset, rules, points, type, props = [], children = [], length2, rulesets), rulesets); + if (character2 === 123) + if (offset === 0) + parse(characters2, root, reference, reference, props, rulesets, length2, points, children); + else { + switch (atrule) { + // c(ontainer) + case 99: + if (charat(characters2, 3) === 110) break; + // l(ayer) + case 108: + if (charat(characters2, 2) === 97) break; + default: + offset = 0; + // d(ocument) m(edia) s(upports) + case 100: + case 109: + case 115: + } + if (offset) parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length2, children), children), rules, children, length2, points, rule ? props : children); + else parse(characters2, reference, reference, reference, [""], children, 0, points, children); + } + } + index = offset = property = 0, variable = ampersand = 1, type = characters2 = "", length2 = pseudo; + break; + // : + case 58: + length2 = 1 + strlen(characters2), property = previous; + default: + if (variable < 1) { + if (character2 == 123) + --variable; + else if (character2 == 125 && variable++ == 0 && prev() == 125) + continue; + } + switch (characters2 += from(character2), character2 * variable) { + // & + case 38: + ampersand = offset > 0 ? 1 : (characters2 += "\f", -1); + break; + // , + case 44: + points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1; + break; + // @ + case 64: + if (peek() === 45) + characters2 += delimit(next()); + atrule = peek(), offset = length2 = strlen(type = characters2 += identifier(caret())), character2++; + break; + // - + case 45: + if (previous === 45 && strlen(characters2) == 2) + variable = 0; + } + } + return rulesets; +} +__name(parse, "parse"); +function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length2, siblings) { + var post = offset - 1; + var rule = offset === 0 ? rules : [""]; + var size = sizeof(rule); + for (var i = 0, j = 0, k = 0; i < index; ++i) + for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) + if (z = trim(j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x]))) + props[k++] = z; + return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length2, siblings); +} +__name(ruleset, "ruleset"); +function comment(value, root, parent, siblings) { + return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings); +} +__name(comment, "comment"); +function declaration(value, root, parent, length2, siblings) { + return node(value, root, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2, siblings); +} +__name(declaration, "declaration"); + +// ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Serializer.js +function serialize(children, callback) { + var output = ""; + for (var i = 0; i < children.length; i++) + output += callback(children[i], i, children, callback) || ""; + return output; +} +__name(serialize, "serialize"); +function stringify(element, index, children, callback) { + switch (element.type) { + case LAYER: + if (element.children.length) break; + case IMPORT: + case NAMESPACE: + case DECLARATION: + return element.return = element.return || element.value; + case COMMENT: + return ""; + case KEYFRAMES: + return element.return = element.value + "{" + serialize(element.children, callback) + "}"; + case RULESET: + if (!strlen(element.value = element.props.join(","))) return ""; + } + return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : ""; +} +__name(stringify, "stringify"); + +// ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Middleware.js +function middleware(collection) { + var length2 = sizeof(collection); + return function(element, index, children, callback) { + var output = ""; + for (var i = 0; i < length2; i++) + output += collection[i](element, index, children, callback) || ""; + return output; + }; +} +__name(middleware, "middleware"); + +// src/accessibility.ts +var SVG_ROLE = "graphics-document document"; +function setA11yDiagramInfo(svg, diagramType) { + svg.attr("role", SVG_ROLE); + if (diagramType !== "") { + svg.attr("aria-roledescription", diagramType); + } +} +__name(setA11yDiagramInfo, "setA11yDiagramInfo"); +function addSVGa11yTitleDescription(svg, a11yTitle, a11yDesc, baseId) { + if (svg.insert === void 0) { + return; + } + if (a11yDesc) { + const descId = `chart-desc-${baseId}`; + svg.attr("aria-describedby", descId); + svg.insert("desc", ":first-child").attr("id", descId).text(a11yDesc); + } + if (a11yTitle) { + const titleId = `chart-title-${baseId}`; + svg.attr("aria-labelledby", titleId); + svg.insert("title", ":first-child").attr("id", titleId).text(a11yTitle); + } +} +__name(addSVGa11yTitleDescription, "addSVGa11yTitleDescription"); + +// src/Diagram.ts +var Diagram = class _Diagram { + constructor(type, text, db, parser, renderer2) { + this.type = type; + this.text = text; + this.db = db; + this.parser = parser; + this.renderer = renderer2; + } + static { + __name(this, "Diagram"); + } + static async fromText(text, metadata = {}) { + const config = getConfig(); + const type = detectType(text, config); + text = encodeEntities(text) + "\n"; + try { + getDiagram(type); + } catch { + const loader33 = getDiagramLoader(type); + if (!loader33) { + throw new UnknownDiagramError(`Diagram ${type} not found.`); + } + const { id: id33, diagram: diagram2 } = await loader33(); + registerDiagram(id33, diagram2); + } + const { db, parser, renderer: renderer2, init: init2 } = getDiagram(type); + if (parser.parser) { + parser.parser.yy = db; + } + db.clear?.(); + init2?.(config); + if (metadata.title) { + db.setDiagramTitle?.(metadata.title); + } + await parser.parse(text); + return new _Diagram(type, text, db, parser, renderer2); + } + async render(id33, version) { + await this.renderer.draw(this.text, id33, version, this); + } + getParser() { + return this.parser; + } + getType() { + return this.type; + } +}; + +// src/interactionDb.ts +var interactionFunctions = []; +var attachFunctions = /* @__PURE__ */ __name(() => { + interactionFunctions.forEach((f) => { + f(); + }); + interactionFunctions = []; +}, "attachFunctions"); + +// src/diagram-api/comments.ts +var cleanupComments = /* @__PURE__ */ __name((text) => { + return text.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart(); +}, "cleanupComments"); + +// src/diagram-api/frontmatter.ts +function extractFrontMatter(text) { + const matches = text.match(frontMatterRegex); + if (!matches) { + return { + text, + metadata: {} + }; + } + let parsed = load(matches[1], { + // To support config, we need JSON schema. + // https://www.yaml.org/spec/1.2/spec.html#id2803231 + schema: JSON_SCHEMA + }) ?? {}; + parsed = typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {}; + const metadata = {}; + if (parsed.displayMode) { + metadata.displayMode = parsed.displayMode.toString(); + } + if (parsed.title) { + metadata.title = parsed.title.toString(); + } + if (parsed.config) { + metadata.config = parsed.config; + } + return { + text: text.slice(matches[0].length), + metadata + }; +} +__name(extractFrontMatter, "extractFrontMatter"); + +// src/preprocess.ts +var cleanupText = /* @__PURE__ */ __name((code) => { + return code.replace(/\r\n?/g, "\n").replace( + /<(\w+)([^>]*)>/g, + (match2, tag, attributes) => "<" + tag + attributes.replace(/="([^"]*)"/g, "='$1'") + ">" + ); +}, "cleanupText"); +var processFrontmatter = /* @__PURE__ */ __name((code) => { + const { text, metadata } = extractFrontMatter(code); + const { displayMode, title, config = {} } = metadata; + if (displayMode) { + if (!config.gantt) { + config.gantt = {}; + } + config.gantt.displayMode = displayMode; + } + return { title, config, text }; +}, "processFrontmatter"); +var processDirectives = /* @__PURE__ */ __name((code) => { + const initDirective = utils_default.detectInit(code) ?? {}; + const wrapDirectives = utils_default.detectDirective(code, "wrap"); + if (Array.isArray(wrapDirectives)) { + initDirective.wrap = wrapDirectives.some(({ type }) => type === "wrap"); + } else if (wrapDirectives?.type === "wrap") { + initDirective.wrap = true; + } + return { + text: removeDirectives(code), + directive: initDirective + }; +}, "processDirectives"); +function preprocessDiagram(code) { + const cleanedCode = cleanupText(code); + const frontMatterResult = processFrontmatter(cleanedCode); + const directiveResult = processDirectives(frontMatterResult.text); + const config = cleanAndMerge(frontMatterResult.config, directiveResult.directive); + code = cleanupComments(directiveResult.text); + return { + code, + title: frontMatterResult.title, + config + }; +} +__name(preprocessDiagram, "preprocessDiagram"); + +// src/utils/base64.ts +function toBase64(str) { + const utf8Bytes = new TextEncoder().encode(str); + const utf8Str = Array.from(utf8Bytes, (byte) => String.fromCodePoint(byte)).join(""); + return btoa(utf8Str); +} +__name(toBase64, "toBase64"); + +// src/mermaidAPI.ts +var MAX_TEXTLENGTH = 5e4; +var MAX_TEXTLENGTH_EXCEEDED_MSG = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa"; +var SECURITY_LVL_SANDBOX = "sandbox"; +var SECURITY_LVL_LOOSE = "loose"; +var XMLNS_SVG_STD = "http://www.w3.org/2000/svg"; +var XMLNS_XLINK_STD = "http://www.w3.org/1999/xlink"; +var XMLNS_XHTML_STD = "http://www.w3.org/1999/xhtml"; +var IFRAME_WIDTH = "100%"; +var IFRAME_HEIGHT = "100%"; +var IFRAME_STYLES = "border:0;margin:0;"; +var IFRAME_BODY_STYLE = "margin:0"; +var IFRAME_SANDBOX_OPTS = "allow-top-navigation-by-user-activation allow-popups"; +var IFRAME_NOT_SUPPORTED_MSG = 'The "iframe" tag is not supported by your browser.'; +var DOMPURIFY_TAGS = ["foreignobject"]; +var DOMPURIFY_ATTR = ["dominant-baseline"]; +function processAndSetConfigs(text) { + const processed = preprocessDiagram(text); + reset(); + addDirective(processed.config ?? {}); + return processed; +} +__name(processAndSetConfigs, "processAndSetConfigs"); +async function parse2(text, parseOptions) { + addDiagrams(); + try { + const { code, config } = processAndSetConfigs(text); + const diagram2 = await getDiagramFromText(code); + return { diagramType: diagram2.type, config }; + } catch (error) { + if (parseOptions?.suppressErrors) { + return false; + } + throw error; + } +} +__name(parse2, "parse"); +var cssImportantStyles = /* @__PURE__ */ __name((cssClass, element, cssClasses = []) => { + const declarationBlock = sanitizeCss(`{ ${cssClasses.join(" !important; ")} !important; }`); + return `.${cssClass} ${element} ${declarationBlock}`; +}, "cssImportantStyles"); +var createCssStyles = /* @__PURE__ */ __name((config, classDefs = /* @__PURE__ */ new Map()) => { + const cssStyles = new CSSStyleSheet(); + if (config.fontFamily !== void 0) { + cssStyles.insertRule( + `:root { --mermaid-font-family: ${config.fontFamily}}`, + cssStyles.cssRules.length + ); + } + if (config.altFontFamily !== void 0) { + cssStyles.insertRule( + `:root { --mermaid-alt-font-family: ${config.altFontFamily}}`, + cssStyles.cssRules.length + ); + } + if (classDefs instanceof Map) { + const htmlLabels = getEffectiveHtmlLabels(config); + const cssHtmlElements = ["> *", "span"]; + const cssShapeElements = ["rect", "polygon", "ellipse", "circle", "path"]; + const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements; + classDefs.forEach((styleClassDef) => { + if (!isEmpty(styleClassDef.styles)) { + cssElements.forEach((cssElement) => { + cssStyles.insertRule( + cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles), + cssStyles.cssRules.length + ); + }); + } + if (!isEmpty(styleClassDef.textStyles)) { + cssStyles.insertRule( + cssImportantStyles( + styleClassDef.id, + "tspan", + (styleClassDef?.textStyles || []).map((s) => s.replace("color", "fill")) + ), + cssStyles.cssRules.length + ); + } + }); + } + let cssString = ""; + if (config.themeCSS !== void 0) { + if (typeof cssStyles.replaceSync === "function") { + const themeCssStyleSheet = new CSSStyleSheet(); + themeCssStyleSheet.replaceSync(config.themeCSS); + cssString = cssStyleSheetToString(themeCssStyleSheet) + "\n"; + } else { + cssString += `${config.themeCSS} +`; + } + } + return cssString + cssStyleSheetToString(cssStyles); +}, "createCssStyles"); +var compileCSS = /* @__PURE__ */ __name((namespace, css) => { + return serialize( + compile(`${namespace}{${css}}`), + middleware([ + /* @__PURE__ */ __name(function addNamespace(element, _index, _children, _callback) { + if (element.type === "rule" && Array.isArray(element.props)) { + if (element.parent && element.parent.type === KEYFRAMES) { + return; + } + element.props = element.props.map((prop) => { + if (!prop.startsWith(namespace)) { + return `${namespace} ${prop}`; + } + return prop; + }); + } else if (element.type.startsWith("@")) { + const nestedAtRules = [ + MEDIA, + SUPPORTS, + LAYER, + SCOPE, + "@container", + "@starting-style" + ]; + const allowedAtRules = [ + ...nestedAtRules, + KEYFRAMES + // needed for Mermaid's animation feature + ]; + if (!allowedAtRules.includes(element.type)) { + log.warn(`Removing unsupported at-rule ${element.type} from CSS`); + element.type = COMMENT; + } + } + }, "addNamespace"), + stringify + ]) + ); +}, "compileCSS"); +var createUserStyles = /* @__PURE__ */ __name((config, graphType, classDefs, svgId) => { + const userCSSstyles = createCssStyles(config, classDefs); + const allStyles = styles_default( + graphType, + userCSSstyles, + { ...config.themeVariables, theme: config.theme, look: config.look }, + svgId + ); + return compileCSS(svgId, allStyles); +}, "createUserStyles"); +var cleanUpSvgCode = /* @__PURE__ */ __name((svgCode = "", inSandboxMode, useArrowMarkerUrls) => { + let cleanedUpSvg = svgCode; + if (!useArrowMarkerUrls && !inSandboxMode) { + cleanedUpSvg = cleanedUpSvg.replace( + /marker-end="url\([\d+./:=?A-Za-z-]*?#/g, + 'marker-end="url(#' + ); + } + cleanedUpSvg = decodeEntities(cleanedUpSvg); + cleanedUpSvg = cleanedUpSvg.replace(/
/g, "
"); + return cleanedUpSvg; +}, "cleanUpSvgCode"); +var putIntoIFrame = /* @__PURE__ */ __name((svgCode = "", svgElement) => { + const height = svgElement?.viewBox?.baseVal?.height ? svgElement.viewBox.baseVal.height + "px" : IFRAME_HEIGHT; + const base64encodedSrc = toBase64(`${svgCode}`); + return ``; +}, "putIntoIFrame"); +var appendDivSvgG = /* @__PURE__ */ __name((parentRoot, id33, enclosingDivId, divStyle, svgXlink) => { + const enclosingDiv = parentRoot.append("div"); + enclosingDiv.attr("id", enclosingDivId); + if (divStyle) { + enclosingDiv.attr("style", divStyle); + } + const svgNode = enclosingDiv.append("svg").attr("id", id33).attr("width", "100%").attr("xmlns", XMLNS_SVG_STD); + if (svgXlink) { + svgNode.attr("xmlns:xlink", svgXlink); + } + svgNode.append("g"); + return parentRoot; +}, "appendDivSvgG"); +function sandboxedIframe(parentNode, iFrameId) { + return parentNode.append("iframe").attr("id", iFrameId).attr("style", "width: 100%; height: 100%;").attr("sandbox", ""); +} +__name(sandboxedIframe, "sandboxedIframe"); +var removeExistingElements = /* @__PURE__ */ __name((doc, id33, divId, iFrameId) => { + doc.getElementById(id33)?.remove(); + doc.getElementById(divId)?.remove(); + doc.getElementById(iFrameId)?.remove(); +}, "removeExistingElements"); +var render = /* @__PURE__ */ __name(async function(id33, text, svgContainingElement) { + addDiagrams(); + const processed = processAndSetConfigs(text); + text = processed.code; + const config = getConfig(); + log.debug(config); + if (text.length > (config?.maxTextSize ?? MAX_TEXTLENGTH)) { + text = MAX_TEXTLENGTH_EXCEEDED_MSG; + } + const idSelector = `#${id33}`; + const iFrameID = "i" + id33; + const iFrameID_selector = "#" + iFrameID; + const enclosingDivID = "d" + id33; + const enclosingDivID_selector = "#" + enclosingDivID; + const removeTempElements = /* @__PURE__ */ __name(() => { + const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector; + const node2 = select_default(tmpElementSelector).node(); + if (node2 && "remove" in node2) { + node2.remove(); + } + }, "removeTempElements"); + let root = select_default(document.body); + const isSandboxed = config.securityLevel === SECURITY_LVL_SANDBOX; + const isLooseSecurityLevel = config.securityLevel === SECURITY_LVL_LOOSE; + const fontFamily = config.fontFamily; + if (svgContainingElement !== void 0) { + if (svgContainingElement) { + svgContainingElement.innerHTML = ""; + } + if (isSandboxed) { + const iframe = sandboxedIframe(select_default(svgContainingElement), iFrameID); + root = select_default(iframe.nodes()[0].contentDocument.body); + root.node().style.margin = "0"; + } else { + root = select_default(svgContainingElement); + } + appendDivSvgG(root, id33, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD); + } else { + removeExistingElements(document, id33, enclosingDivID, iFrameID); + if (isSandboxed) { + const iframe = sandboxedIframe(select_default(document.body), iFrameID); + root = select_default(iframe.nodes()[0].contentDocument.body); + root.node().style.margin = "0"; + } else { + root = select_default("body"); + } + appendDivSvgG(root, id33, enclosingDivID); + } + let diag; + let parseEncounteredException; + try { + diag = await Diagram.fromText(text, { title: processed.title }); + } catch (error) { + if (config.suppressErrorRendering) { + removeTempElements(); + throw error; + } + diag = await Diagram.fromText("error"); + parseEncounteredException = error; + } + const element = root.select(enclosingDivID_selector).node(); + const diagramType = diag.type; + const svg = element.firstChild; + const firstChild = svg.firstChild; + const diagramClassDefs = diag.renderer.getClasses?.(text, diag); + const rules = createUserStyles(config, diagramType, diagramClassDefs, idSelector); + const style1 = document.createElement("style"); + style1.innerHTML = rules; + svg.insertBefore(style1, firstChild); + try { + await diag.renderer.draw(text, id33, "11.15.0", diag); + } catch (e) { + if (config.suppressErrorRendering) { + removeTempElements(); + } else { + errorRenderer_default.draw(text, id33, "11.15.0"); + } + throw e; + } + const svgNode = root.select(`${enclosingDivID_selector} svg`); + const a11yTitle = diag.db.getAccTitle?.(); + const a11yDescr = diag.db.getAccDescription?.(); + addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr); + root.select(`[id="${id33}"]`).selectAll("foreignobject > *").attr("xmlns", XMLNS_XHTML_STD); + let svgCode = root.select(enclosingDivID_selector).node().innerHTML; + log.debug("config.arrowMarkerAbsolute", config.arrowMarkerAbsolute); + svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config.arrowMarkerAbsolute)); + if (isSandboxed) { + const svgEl = root.select(enclosingDivID_selector + " svg").node(); + svgCode = putIntoIFrame(svgCode, svgEl); + } else if (!isLooseSecurityLevel) { + svgCode = purify.sanitize(svgCode, { + ADD_TAGS: DOMPURIFY_TAGS, + ADD_ATTR: DOMPURIFY_ATTR, + HTML_INTEGRATION_POINTS: { foreignobject: true } + }); + } + attachFunctions(); + if (parseEncounteredException) { + throw parseEncounteredException; + } + removeTempElements(); + return { + diagramType, + svg: svgCode, + bindFunctions: diag.db.bindFunctions + }; +}, "render"); +function initialize(userOptions = {}) { + const options = assignWithDepth_default({}, userOptions); + if (options?.fontFamily && !options.themeVariables?.fontFamily) { + if (!options.themeVariables) { + options.themeVariables = {}; + } + options.themeVariables.fontFamily = options.fontFamily; + } + saveConfigFromInitialize(options); + if (options?.theme && options.theme in themes_default) { + options.themeVariables = themes_default[options.theme].getThemeVariables( + options.themeVariables + ); + } else if (options) { + options.themeVariables = themes_default.default.getThemeVariables(options.themeVariables); + } + const config = typeof options === "object" ? setSiteConfig(options) : getSiteConfig(); + setLogLevel(config.logLevel); + addDiagrams(); +} +__name(initialize, "initialize"); +var getDiagramFromText = /* @__PURE__ */ __name((text, metadata = {}) => { + const { code } = preprocessDiagram(text); + return Diagram.fromText(code, metadata); +}, "getDiagramFromText"); +function addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr) { + setA11yDiagramInfo(svgNode, diagramType); + addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr("id")); +} +__name(addA11yInfo, "addA11yInfo"); +var mermaidAPI = Object.freeze({ + render, + parse: parse2, + getDiagramFromText, + initialize, + getConfig, + setConfig, + getSiteConfig, + updateSiteConfig, + reset: /* @__PURE__ */ __name(() => { + reset(); + }, "reset"), + globalReset: /* @__PURE__ */ __name(() => { + reset(defaultConfig); + }, "globalReset"), + defaultConfig +}); +setLogLevel(getConfig().logLevel); +reset(getConfig()); + +// src/mermaid.ts +var handleError = /* @__PURE__ */ __name((error, errors, parseError) => { + log.warn(error); + if (isDetailedError(error)) { + if (parseError) { + parseError(error.str, error.hash); + } + errors.push({ ...error, message: error.str, error }); + } else { + if (parseError) { + parseError(error); + } + if (error instanceof Error) { + errors.push({ + str: error.message, + message: error.message, + hash: error.name, + error + }); + } + } +}, "handleError"); +var run = /* @__PURE__ */ __name(async function(options = { + querySelector: ".mermaid" +}) { + try { + await runThrowsErrors(options); + } catch (e) { + if (isDetailedError(e)) { + log.error(e.str); + } + if (mermaid.parseError) { + mermaid.parseError(e); + } + if (!options.suppressErrors) { + log.error("Use the suppressErrors option to suppress these errors"); + throw e; + } + } +}, "run"); +var runThrowsErrors = /* @__PURE__ */ __name(async function({ postRenderCallback, querySelector, nodes } = { + querySelector: ".mermaid" +}) { + const conf = mermaidAPI.getConfig(); + log.debug(`${!postRenderCallback ? "No " : ""}Callback function found`); + let nodesToProcess; + if (nodes) { + nodesToProcess = nodes; + } else if (querySelector) { + nodesToProcess = document.querySelectorAll(querySelector); + } else { + throw new Error("Nodes and querySelector are both undefined"); + } + log.debug(`Found ${nodesToProcess.length} diagrams`); + if (conf?.startOnLoad !== void 0) { + log.debug("Start On Load: " + conf?.startOnLoad); + mermaidAPI.updateSiteConfig({ startOnLoad: conf?.startOnLoad }); + } + const idGenerator = new utils_default.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed); + let txt; + const errors = []; + for (const element of Array.from(nodesToProcess)) { + log.info("Rendering diagram: " + element.id); + if (element.getAttribute("data-processed")) { + continue; + } + element.setAttribute("data-processed", "true"); + const id33 = `mermaid-${idGenerator.next()}`; + txt = element.innerHTML; + txt = dedent(utils_default.entityDecode(txt)).trim().replace(//gi, "
"); + const init2 = utils_default.detectInit(txt); + if (init2) { + log.debug("Detected early reinit: ", init2); + } + try { + const { svg, bindFunctions } = await render2(id33, txt, element); + element.innerHTML = svg; + if (postRenderCallback) { + await postRenderCallback(id33); + } + if (bindFunctions) { + bindFunctions(element); + } + } catch (error) { + handleError(error, errors, mermaid.parseError); + } + } + if (errors.length > 0) { + throw errors[0]; + } +}, "runThrowsErrors"); +var initialize2 = /* @__PURE__ */ __name(function(config) { + mermaidAPI.initialize(config); +}, "initialize"); +var init = /* @__PURE__ */ __name(async function(config, nodes, callback) { + log.warn("mermaid.init is deprecated. Please use run instead."); + if (config) { + initialize2(config); + } + const runOptions = { postRenderCallback: callback, querySelector: ".mermaid" }; + if (typeof nodes === "string") { + runOptions.querySelector = nodes; + } else if (nodes) { + if (nodes instanceof HTMLElement) { + runOptions.nodes = [nodes]; + } else { + runOptions.nodes = nodes; + } + } + await run(runOptions); +}, "init"); +var registerExternalDiagrams = /* @__PURE__ */ __name(async (diagrams, { + lazyLoad = true +} = {}) => { + addDiagrams(); + registerLazyLoadedDiagrams(...diagrams); + if (lazyLoad === false) { + await loadRegisteredDiagrams(); + } +}, "registerExternalDiagrams"); +var contentLoaded = /* @__PURE__ */ __name(function() { + if (mermaid.startOnLoad) { + const { startOnLoad } = mermaidAPI.getConfig(); + if (startOnLoad) { + mermaid.run().catch((err) => log.error("Mermaid failed to initialize", err)); + } + } +}, "contentLoaded"); +if (typeof document !== "undefined") { + window.addEventListener("load", contentLoaded, false); +} +var setParseErrorHandler = /* @__PURE__ */ __name(function(parseErrorHandler) { + mermaid.parseError = parseErrorHandler; +}, "setParseErrorHandler"); +var executionQueue = []; +var executionQueueRunning = false; +var executeQueue = /* @__PURE__ */ __name(async () => { + if (executionQueueRunning) { + return; + } + executionQueueRunning = true; + while (executionQueue.length > 0) { + const f = executionQueue.shift(); + if (f) { + try { + await f(); + } catch (e) { + log.error("Error executing queue", e); + } + } + } + executionQueueRunning = false; +}, "executeQueue"); +var parse3 = /* @__PURE__ */ __name(async (text, parseOptions) => { + return new Promise((resolve, reject) => { + const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => { + mermaidAPI.parse(text, parseOptions).then( + (r) => { + res(r); + resolve(r); + }, + (e) => { + log.error("Error parsing", e); + mermaid.parseError?.(e); + rej(e); + reject(e); + } + ); + }), "performCall"); + executionQueue.push(performCall); + executeQueue().catch(reject); + }); +}, "parse"); +var render2 = /* @__PURE__ */ __name((id33, text, container) => { + return new Promise((resolve, reject) => { + const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => { + mermaidAPI.render(id33, text, container).then( + (r) => { + res(r); + resolve(r); + }, + (e) => { + log.error("Error parsing", e); + mermaid.parseError?.(e); + rej(e); + reject(e); + } + ); + }), "performCall"); + executionQueue.push(performCall); + executeQueue().catch(reject); + }); +}, "render"); +var getRegisteredDiagramsMetadata = /* @__PURE__ */ __name(() => { + return Object.keys(detectors).map((id33) => ({ + id: id33 + })); +}, "getRegisteredDiagramsMetadata"); +var mermaid = { + startOnLoad: true, + mermaidAPI, + parse: parse3, + render: render2, + init, + run, + registerExternalDiagrams, + registerLayoutLoaders, + initialize: initialize2, + parseError: void 0, + contentLoaded, + setParseErrorHandler, + detectType, + registerIconPacks, + getRegisteredDiagramsMetadata +}; +var mermaid_default = mermaid; +export { + mermaid_default as default +}; +/*! Check if previously processed */ +/*! + * Wait for document loaded before starting the execution + */ diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.esm.mjs.map b/tools/ui/node_modules/mermaid/dist/mermaid.esm.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..8a7e9ba87a27f7583a49c180491850fb8e6b1fe1 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.esm.mjs.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/diagrams/c4/c4Detector.ts", "../src/diagrams/flowchart/flowDetector.ts", "../src/diagrams/flowchart/flowDetector-v2.ts", "../src/diagrams/er/erDetector.ts", "../src/diagrams/git/gitGraphDetector.ts", "../src/diagrams/gantt/ganttDetector.ts", "../src/diagrams/info/infoDetector.ts", "../src/diagrams/pie/pieDetector.ts", "../src/diagrams/quadrant-chart/quadrantDetector.ts", "../src/diagrams/xychart/xychartDetector.ts", "../src/diagrams/requirement/requirementDetector.ts", "../src/diagrams/sequence/sequenceDetector.ts", "../src/diagrams/class/classDetector.ts", "../src/diagrams/class/classDetector-V2.ts", "../src/diagrams/state/stateDetector.ts", "../src/diagrams/state/stateDetector-V2.ts", "../src/diagrams/user-journey/journeyDetector.ts", "../src/diagrams/error/errorRenderer.ts", "../src/diagrams/error/errorDiagram.ts", "../src/diagrams/flowchart/elk/detector.ts", "../src/diagrams/timeline/detector.ts", "../src/diagrams/mindmap/detector.ts", "../src/diagrams/kanban/detector.ts", "../src/diagrams/sankey/sankeyDetector.ts", "../src/diagrams/packet/detector.ts", "../src/diagrams/radar/detector.ts", "../src/diagrams/block/blockDetector.ts", "../src/diagrams/treeView/detector.ts", "../src/diagrams/architecture/architectureDetector.ts", "../src/diagrams/eventmodeling/detector.ts", "../src/diagrams/ishikawa/ishikawaDetector.ts", "../src/diagrams/venn/vennDetector.ts", "../src/diagrams/treemap/detector.ts", "../src/diagrams/wardley/wardleyDetector.ts", "../src/diagram-api/diagram-orchestration.ts", "../src/diagram-api/loadDiagram.ts", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Enum.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Utility.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Tokenizer.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Parser.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Serializer.js", "../../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Middleware.js", "../src/accessibility.ts", "../src/Diagram.ts", "../src/interactionDb.ts", "../src/diagram-api/comments.ts", "../src/diagram-api/frontmatter.ts", "../src/preprocess.ts", "../src/utils/base64.ts", "../src/mermaidAPI.ts", "../src/mermaid.ts"], + "sourcesContent": ["import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'c4';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./c4Diagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'flowchart';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have conferred to only use new flow charts this function should always return false\n // as in not signalling true for a legacy flowchart\n if (\n config?.flowchart?.defaultRenderer === 'dagre-wrapper' ||\n config?.flowchart?.defaultRenderer === 'elk'\n ) {\n return false;\n }\n return /^\\s*graph/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./flowDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'flowchart-v2';\n\nconst detector: DiagramDetector = (txt, config) => {\n if (config?.flowchart?.defaultRenderer === 'dagre-d3') {\n return false;\n }\n\n if (config?.flowchart?.defaultRenderer === 'elk') {\n config.layout = 'elk';\n }\n\n // If we have configured to use dagre-wrapper then we should return true in this function for graph code thus making it use the new flowchart diagram\n if (/^\\s*graph/.test(txt) && config?.flowchart?.defaultRenderer === 'dagre-wrapper') {\n return true;\n }\n return /^\\s*flowchart/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./flowDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'er';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*erDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./erDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { DiagramDetector, DiagramLoader } from '../../diagram-api/types.js';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'gitGraph';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*gitGraph/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./gitGraphDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'gantt';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*gantt/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./ganttDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'info';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*info/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./infoDiagram.js');\n return { id, diagram };\n};\n\nexport const info: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'pie';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*pie/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./pieDiagram.js');\n return { id, diagram };\n};\n\nexport const pie: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'quadrantChart';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*quadrantChart/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./quadrantDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'xychart';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*xychart(-beta)?/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./xychartDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'requirement';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*requirement(Diagram)?/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./requirementDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'sequence';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*sequenceDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./sequenceDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'class';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have configured to use dagre-wrapper then we should never return true in this function\n if (config?.class?.defaultRenderer === 'dagre-wrapper') {\n return false;\n }\n // We have not opted to use the new renderer so we should return true if we detect a class diagram\n return /^\\s*classDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./classDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'classDiagram';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have configured to use dagre-wrapper then we should return true in this function for classDiagram code thus making it use the new class diagram\n if (/^\\s*classDiagram/.test(txt) && config?.class?.defaultRenderer === 'dagre-wrapper') {\n return true;\n }\n // We have not opted to use the new renderer so we should return true if we detect a class diagram\n return /^\\s*classDiagram-v2/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./classDiagram-v2.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'state';\n\nconst detector: DiagramDetector = (txt, config) => {\n // If we have confirmed to only use new state diagrams this function should always return false\n // as in not signalling true for a legacy state diagram\n if (config?.state?.defaultRenderer === 'dagre-wrapper') {\n return false;\n }\n return /^\\s*stateDiagram/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./stateDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'stateDiagram';\n\nconst detector: DiagramDetector = (txt, config) => {\n if (/^\\s*stateDiagram-v2/.test(txt)) {\n return true;\n }\n if (/^\\s*stateDiagram/.test(txt) && config?.state?.defaultRenderer === 'dagre-wrapper') {\n return true;\n }\n return false;\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./stateDiagram-v2.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'journey';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*journey/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./journeyDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { SVG, SVGGroup } from '../../diagram-api/types.js';\nimport { log } from '../../logger.js';\nimport { selectSvgElement } from '../../rendering-util/selectSvgElement.js';\nimport { configureSvgSize } from '../../setupGraphViewbox.js';\n\n/**\n * Draws an info picture in the tag with id: id based on the graph definition in text.\n *\n * @param _text - Mermaid graph definition.\n * @param id - The text for the error\n * @param version - The version\n */\nexport const draw = (_text: string, id: string, version: string) => {\n log.debug('rendering svg for syntax error\\n');\n const svg: SVG = selectSvgElement(id);\n const g: SVGGroup = svg.append('g');\n\n svg.attr('viewBox', '0 0 2412 512');\n configureSvgSize(svg, 100, 512, true);\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z'\n );\n\n g.append('path')\n .attr('class', 'error-icon')\n .attr(\n 'd',\n 'm436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z'\n );\n\n g.append('text') // text label for the x axis\n .attr('class', 'error-text')\n .attr('x', 1440)\n .attr('y', 250)\n .attr('font-size', '150px')\n .style('text-anchor', 'middle')\n .text('Syntax error in text');\n g.append('text') // text label for the x axis\n .attr('class', 'error-text')\n .attr('x', 1250)\n .attr('y', 400)\n .attr('font-size', '100px')\n .style('text-anchor', 'middle')\n .text(`mermaid version ${version}`);\n};\n\nexport const renderer = { draw };\n\nexport default renderer;\n", "import type { DiagramDefinition } from '../../diagram-api/types.js';\nimport { renderer } from './errorRenderer.js';\n\nconst diagram: DiagramDefinition = {\n db: {},\n renderer,\n parser: {\n parse: (): void => {\n return;\n },\n },\n};\n\nexport default diagram;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../../diagram-api/types.js';\n\nconst id = 'flowchart-elk';\n\nconst detector: DiagramDetector = (txt, config = {}): boolean => {\n if (\n // If diagram explicitly states flowchart-elk\n /^\\s*flowchart-elk/.test(txt) ||\n // If a flowchart/graph diagram has their default renderer set to elk\n (/^\\s*(flowchart|graph)/.test(txt) && config?.flowchart?.defaultRenderer === 'elk')\n ) {\n config.layout = 'elk';\n return true;\n }\n return false;\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('../flowDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'timeline';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*timeline/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./timeline-definition.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\nconst id = 'mindmap';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*mindmap/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./mindmap-definition.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\nconst id = 'kanban';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*kanban/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./kanban-definition.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'sankey';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*sankey(-beta)?/.test(txt);\n};\n\nconst loader = async () => {\n const { diagram } = await import('./sankeyDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'packet';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*packet(-beta)?/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nexport const packet: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'radar';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*radar-beta/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nexport const radar: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'block';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*block(-beta)?/.test(txt);\n};\n\nconst loader = async () => {\n const { diagram } = await import('./blockDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type { DiagramDetector, DiagramLoader } from '../../diagram-api/types.js';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'treeView';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*treeView-beta/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'architecture';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*architecture/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./architectureDiagram.js');\n return { id, diagram };\n};\n\nconst architecture: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default architecture;\n", "import type { DiagramDetector, DiagramLoader } from '../../diagram-api/types.js';\nimport type { ExternalDiagramDefinition } from '../../diagram-api/types.js';\n\nconst id = 'eventmodeling';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*eventmodeling/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'ishikawa';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*ishikawa(-beta)?\\b/i.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./ishikawaDiagram.js');\n return { id, diagram };\n};\n\nexport const ishikawa: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'venn';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*venn-beta/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./vennDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'treemap';\n\nconst detector: DiagramDetector = (txt) => {\n return /^\\s*treemap/.test(txt);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./diagram.js');\n return { id, diagram };\n};\n\nexport const treemap: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n", "import type {\n DiagramDetector,\n DiagramLoader,\n ExternalDiagramDefinition,\n} from '../../diagram-api/types.js';\n\nconst id = 'wardley-beta';\n\nconst detector: DiagramDetector = (text) => {\n return /^\\s*wardley-beta/i.test(text);\n};\n\nconst loader: DiagramLoader = async () => {\n const { diagram } = await import('./wardleyDiagram.js');\n return { id, diagram };\n};\n\nconst plugin: ExternalDiagramDefinition = {\n id,\n detector,\n loader,\n};\n\nexport default plugin;\n", "import c4 from '../diagrams/c4/c4Detector.js';\nimport flowchart from '../diagrams/flowchart/flowDetector.js';\nimport flowchartV2 from '../diagrams/flowchart/flowDetector-v2.js';\nimport er from '../diagrams/er/erDetector.js';\nimport git from '../diagrams/git/gitGraphDetector.js';\nimport gantt from '../diagrams/gantt/ganttDetector.js';\nimport { info } from '../diagrams/info/infoDetector.js';\nimport { pie } from '../diagrams/pie/pieDetector.js';\nimport quadrantChart from '../diagrams/quadrant-chart/quadrantDetector.js';\nimport xychart from '../diagrams/xychart/xychartDetector.js';\nimport requirement from '../diagrams/requirement/requirementDetector.js';\nimport sequence from '../diagrams/sequence/sequenceDetector.js';\nimport classDiagram from '../diagrams/class/classDetector.js';\nimport classDiagramV2 from '../diagrams/class/classDetector-V2.js';\nimport state from '../diagrams/state/stateDetector.js';\nimport stateV2 from '../diagrams/state/stateDetector-V2.js';\nimport journey from '../diagrams/user-journey/journeyDetector.js';\nimport errorDiagram from '../diagrams/error/errorDiagram.js';\nimport flowchartElk from '../diagrams/flowchart/elk/detector.js';\nimport timeline from '../diagrams/timeline/detector.js';\nimport mindmap from '../diagrams/mindmap/detector.js';\nimport kanban from '../diagrams/kanban/detector.js';\nimport sankey from '../diagrams/sankey/sankeyDetector.js';\nimport { packet } from '../diagrams/packet/detector.js';\nimport { radar } from '../diagrams/radar/detector.js';\nimport block from '../diagrams/block/blockDetector.js';\nimport treeView from '../diagrams/treeView/detector.js';\nimport architecture from '../diagrams/architecture/architectureDetector.js';\nimport eventmodeling from '../diagrams/eventmodeling/detector.js';\nimport { ishikawa } from '../diagrams/ishikawa/ishikawaDetector.js';\nimport venn from '../diagrams/venn/vennDetector.js';\nimport { registerLazyLoadedDiagrams } from './detectType.js';\nimport { registerDiagram } from './diagramAPI.js';\nimport { treemap } from '../diagrams/treemap/detector.js';\nimport wardley from '../diagrams/wardley/wardleyDetector.js';\nimport '../type.d.ts';\n\nlet hasLoadedDiagrams = false;\nexport const addDiagrams = () => {\n if (hasLoadedDiagrams) {\n return;\n }\n // This is added here to avoid race-conditions.\n // We could optimize the loading logic somehow.\n hasLoadedDiagrams = true;\n registerDiagram('error', errorDiagram, (text) => {\n return text.toLowerCase().trim() === 'error';\n });\n registerDiagram(\n '---',\n // --- diagram type may appear if YAML front-matter is not parsed correctly\n {\n db: {\n clear: () => {\n // Quite ok, clear needs to be there for --- to work as a regular diagram\n },\n },\n styles: {}, // should never be used\n renderer: {\n draw: () => {\n // should never be used\n },\n },\n parser: {\n parse: () => {\n throw new Error(\n 'Diagrams beginning with --- are not valid. ' +\n 'If you were trying to use a YAML front-matter, please ensure that ' +\n \"you've correctly opened and closed the YAML front-matter with un-indented `---` blocks\"\n );\n },\n },\n init: () => null, // no op\n },\n (text) => {\n return text.toLowerCase().trimStart().startsWith('---');\n }\n );\n\n if (injected.includeLargeFeatures) {\n registerLazyLoadedDiagrams(flowchartElk, mindmap, architecture);\n }\n\n // Ordering of detectors is important. The first one to return true will be used.\n registerLazyLoadedDiagrams(\n c4,\n kanban,\n classDiagramV2,\n classDiagram,\n er,\n gantt,\n info,\n pie,\n requirement,\n sequence,\n flowchartV2,\n flowchart,\n timeline,\n git,\n stateV2,\n state,\n journey,\n quadrantChart,\n sankey,\n packet,\n xychart,\n block,\n eventmodeling,\n treeView,\n radar,\n ishikawa,\n treemap,\n venn,\n wardley\n );\n};\n", "import { log } from '../logger.js';\nimport { detectors } from './detectType.js';\nimport { getDiagram, registerDiagram } from './diagramAPI.js';\n\nexport const loadRegisteredDiagrams = async () => {\n log.debug(`Loading registered diagrams`);\n // Load all lazy loaded diagrams in parallel\n const results = await Promise.allSettled(\n Object.entries(detectors).map(async ([key, { detector, loader }]) => {\n if (!loader) {\n return;\n }\n try {\n getDiagram(key);\n } catch {\n try {\n // Register diagram if it is not already registered\n const { diagram, id } = await loader();\n registerDiagram(id, diagram, detector);\n } catch (err) {\n // Remove failed diagram from detectors\n log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);\n delete detectors[key];\n throw err;\n }\n }\n })\n );\n const failed = results.filter((result) => result.status === 'rejected');\n if (failed.length > 0) {\n log.error(`Failed to load ${failed.length} external diagrams`);\n for (const res of failed) {\n log.error(res);\n }\n throw new Error(`Failed to load ${failed.length} external diagrams`);\n }\n};\n", "export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\nexport var SCOPE = '@scope'\n", "/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @param {number} position\n * @return {number}\n */\nexport function indexof (value, search, position) {\n\treturn value.indexOf(search, position)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n\n/**\n * @param {string[]} array\n * @param {RegExp} pattern\n * @return {string[]}\n */\nexport function filter (array, pattern) {\n\treturn array.filter(function (value) { return !match(value, pattern) })\n}\n", "import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {object[]} siblings\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length, siblings) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props)\n}\n\n/**\n * @param {object} root\n */\nexport function lift (root) {\n\twhile (root.root)\n\t\troot = copy(root.root, {children: [root]})\n\n\tappend(root, root.siblings)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n", "import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, token, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f', abs(index ? points[index - 1] : 0)) != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent, declarations), declarations)\n\t\t\t\t\t\tif ((token(previous || 1) == 5 || token(peek() || 1) == 5) && strlen(characters) && substr(characters, -1, void 0) !== ' ') characters += ' '\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length || (variable === 0 && previous === 47)))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tswitch (atrule) {\n\t\t\t\t\t\t\t\t\t// c(ontainer)\n\t\t\t\t\t\t\t\t\tcase 99:\n\t\t\t\t\t\t\t\t\t\tif (charat(characters, 3) === 110) break\n\t\t\t\t\t\t\t\t\t// l(ayer)\n\t\t\t\t\t\t\t\t\tcase 108:\n\t\t\t\t\t\t\t\t\t\tif (charat(characters, 2) === 97) break\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\toffset = 0\n\t\t\t\t\t\t\t\t\t// d(ocument) m(edia) s(upports)\n\t\t\t\t\t\t\t\t\tcase 100: case 109: case 115:\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (offset) parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\telse parse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @param {object[]} siblings\n * @return {object}\n */\nexport function comment (value, root, parent, siblings) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function declaration (value, root, parent, length, siblings) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings)\n}\n", "import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES, NAMESPACE} from './Enum.js'\nimport {strlen} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\n\tfor (var i = 0; i < children.length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case NAMESPACE: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: if (!strlen(element.value = element.props.join(','))) return ''\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n", "import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'\nimport {match, charat, substr, strlen, sizeof, replace, combine, filter, assign} from './Utility.js'\nimport {copy, lift, tokenize} from './Tokenizer.js'\nimport {serialize} from './Serializer.js'\nimport {prefix} from './Prefixer.js'\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nexport function middleware (collection) {\n\tvar length = sizeof(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nexport function rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nexport function prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase DECLARATION: element.return = prefix(element.value, element.length, children)\n\t\t\t\t\treturn\n\t\t\t\tcase KEYFRAMES:\n\t\t\t\t\treturn serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)\n\t\t\t\tcase RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn combine(children = element.props, function (value) {\n\t\t\t\t\t\t\tswitch (match(value, callback = /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [value]}))\n\t\t\t\t\t\t\t\t\tassign(element, {props: filter(children, callback)})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [value]}))\n\t\t\t\t\t\t\t\t\tassign(element, {props: filter(children, callback)})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nexport function namespace (element) {\n\tswitch (element.type) {\n\t\tcase RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn combine(tokenize(value), function (value, index, children) {\n\t\t\t\t\tswitch (charat(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn substr(value, 1, strlen(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + substr(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn sizeof(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = sizeof(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n", "/**\n * Accessibility (a11y) functions, types, helpers.\n *\n * @see https://www.w3.org/WAI/\n * @see https://www.w3.org/TR/wai-aria-1.1/\n * @see https://www.w3.org/TR/svg-aam-1.0/\n */\nimport type { D3Element } from './types.js';\n\n/**\n * SVG element role:\n * The SVG element role _should_ be set to 'graphics-document' per SVG standard\n * but in practice is not always done by browsers, etc. (As of 2022-12-08).\n * A fallback role of 'document' should be set for those browsers, etc., that only support ARIA 1.0.\n *\n * @see https://www.w3.org/TR/svg-aam-1.0/#roleMappingGeneralRules\n * @see https://www.w3.org/TR/graphics-aria-1.0/#graphics-document\n */\nconst SVG_ROLE = 'graphics-document document';\n\n/**\n * Add role and aria-roledescription to the svg element.\n *\n * @param svg - d3 object that contains the SVG HTML element\n * @param diagramType - diagram name for to the aria-roledescription\n */\nexport function setA11yDiagramInfo(svg: D3Element, diagramType: string) {\n svg.attr('role', SVG_ROLE);\n if (diagramType !== '') {\n svg.attr('aria-roledescription', diagramType);\n }\n}\n\n/**\n * Add an accessible title and/or description element to a chart.\n * The title is usually not displayed and the description is never displayed.\n *\n * The following charts display their title as a visual and accessibility element: gantt.\n *\n * @param svg - d3 node to insert the a11y title and desc info\n * @param a11yTitle - a11y title. undefined or empty strings mean to skip them\n * @param a11yDesc - a11y description. undefined or empty strings mean to skip them\n * @param baseId - id used to construct the a11y title and description id\n */\nexport function addSVGa11yTitleDescription(\n svg: D3Element,\n a11yTitle: string | undefined,\n a11yDesc: string | undefined,\n baseId: string\n): void {\n if (svg.insert === undefined) {\n return;\n }\n\n if (a11yDesc) {\n const descId = `chart-desc-${baseId}`;\n svg.attr('aria-describedby', descId);\n svg.insert('desc', ':first-child').attr('id', descId).text(a11yDesc);\n }\n if (a11yTitle) {\n const titleId = `chart-title-${baseId}`;\n svg.attr('aria-labelledby', titleId);\n svg.insert('title', ':first-child').attr('id', titleId).text(a11yTitle);\n }\n}\n", "import * as configApi from './config.js';\nimport { getDiagram, registerDiagram } from './diagram-api/diagramAPI.js';\nimport { detectType, getDiagramLoader } from './diagram-api/detectType.js';\nimport { UnknownDiagramError } from './errors.js';\nimport { encodeEntities } from './utils.js';\nimport type { DetailedError } from './utils.js';\nimport type { DiagramDefinition, DiagramMetadata } from './diagram-api/types.js';\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nexport type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void;\n\n/**\n * An object representing a parsed mermaid diagram definition.\n * @privateRemarks This is exported as part of the public mermaidAPI.\n */\nexport class Diagram {\n public static async fromText(text: string, metadata: Pick = {}) {\n const config = configApi.getConfig();\n const type = detectType(text, config);\n text = encodeEntities(text) + '\\n';\n try {\n getDiagram(type);\n } catch {\n const loader = getDiagramLoader(type);\n if (!loader) {\n throw new UnknownDiagramError(`Diagram ${type} not found.`);\n }\n // Diagram not available, loading it.\n // new diagram will try getDiagram again and if fails then it is a valid throw\n const { id, diagram } = await loader();\n registerDiagram(id, diagram);\n }\n const { db, parser, renderer, init } = getDiagram(type);\n if (parser.parser) {\n // The parser.parser.yy is only present in JISON parsers. So, we'll only set if required.\n parser.parser.yy = db;\n }\n db.clear?.();\n init?.(config);\n // This block was added for legacy compatibility. Use frontmatter instead of adding more special cases.\n if (metadata.title) {\n db.setDiagramTitle?.(metadata.title);\n }\n await parser.parse(text);\n return new Diagram(type, text, db, parser, renderer);\n }\n\n private constructor(\n public type: string,\n public text: string,\n public db: DiagramDefinition['db'],\n public parser: DiagramDefinition['parser'],\n public renderer: DiagramDefinition['renderer']\n ) {}\n\n async render(id: string, version: string) {\n await this.renderer.draw(this.text, id, version, this);\n }\n\n getParser() {\n return this.parser;\n }\n\n getType() {\n return this.type;\n }\n}\n", "let interactionFunctions: (() => void)[] = [];\nexport const addFunction = (func: () => void) => {\n interactionFunctions.push(func);\n};\nexport const attachFunctions = () => {\n interactionFunctions.forEach((f) => {\n f();\n });\n interactionFunctions = [];\n};\n", "/**\n * Remove all lines starting with `%%` from the text that don't contain a `%%{`\n * @param text - The text to remove comments from\n * @returns cleaned text\n */\nexport const cleanupComments = (text: string): string => {\n return text.replace(/^\\s*%%(?!{)[^\\n]+\\n?/gm, '').trimStart();\n};\n", "import type { GanttDiagramConfig, MermaidConfig } from '../config.type.js';\nimport { frontMatterRegex } from './regexes.js';\n// The \"* as yaml\" part is necessary for tree-shaking\nimport * as yaml from 'js-yaml';\n\ninterface FrontMatterMetadata {\n title?: string;\n // Allows custom display modes. Currently used for compact mode in gantt charts.\n displayMode?: GanttDiagramConfig['displayMode'];\n config?: MermaidConfig;\n}\n\nexport interface FrontMatterResult {\n text: string;\n metadata: FrontMatterMetadata;\n}\n\n/**\n * Extract and parse frontmatter from text, if present, and sets appropriate\n * properties in the provided db.\n * @param text - The text that may have a YAML frontmatter.\n * @returns text with frontmatter stripped out\n */\nexport function extractFrontMatter(text: string): FrontMatterResult {\n const matches = text.match(frontMatterRegex);\n if (!matches) {\n return {\n text,\n metadata: {},\n };\n }\n\n let parsed: FrontMatterMetadata =\n yaml.load(matches[1], {\n // To support config, we need JSON schema.\n // https://www.yaml.org/spec/1.2/spec.html#id2803231\n schema: yaml.JSON_SCHEMA,\n }) ?? {};\n\n // To handle runtime data type changes\n parsed = typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};\n\n const metadata: FrontMatterMetadata = {};\n\n // Only add properties that are explicitly supported, if they exist\n if (parsed.displayMode) {\n metadata.displayMode = parsed.displayMode.toString() as GanttDiagramConfig['displayMode'];\n }\n if (parsed.title) {\n metadata.title = parsed.title.toString();\n }\n if (parsed.config) {\n metadata.config = parsed.config;\n }\n\n return {\n text: text.slice(matches[0].length),\n metadata,\n };\n}\n", "import { cleanupComments } from './diagram-api/comments.js';\nimport { extractFrontMatter } from './diagram-api/frontmatter.js';\nimport type { DiagramMetadata } from './diagram-api/types.js';\nimport utils, { cleanAndMerge, removeDirectives } from './utils.js';\n\nconst cleanupText = (code: string) => {\n return (\n code\n // parser problems on CRLF ignore all CR and leave LF;;\n .replace(/\\r\\n?/g, '\\n')\n // clean up html tags so that all attributes use single quotes, parser throws error on double quotes\n .replace(\n /<(\\w+)([^>]*)>/g,\n (match, tag, attributes) => '<' + tag + attributes.replace(/=\"([^\"]*)\"/g, \"='$1'\") + '>'\n )\n );\n};\n\nconst processFrontmatter = (code: string) => {\n const { text, metadata } = extractFrontMatter(code);\n const { displayMode, title, config = {} } = metadata;\n if (displayMode) {\n // Needs to be supported for legacy reasons\n if (!config.gantt) {\n config.gantt = {};\n }\n config.gantt.displayMode = displayMode;\n }\n\n return { title, config, text };\n};\n\nconst processDirectives = (code: string) => {\n const initDirective = utils.detectInit(code) ?? {};\n const wrapDirectives = utils.detectDirective(code, 'wrap');\n if (Array.isArray(wrapDirectives)) {\n initDirective.wrap = wrapDirectives.some(({ type }) => type === 'wrap');\n } else if (wrapDirectives?.type === 'wrap') {\n initDirective.wrap = true;\n }\n return {\n text: removeDirectives(code),\n directive: initDirective,\n };\n};\n\n/**\n * Preprocess the given code by cleaning it up, extracting front matter and directives,\n * cleaning and merging configuration, and removing comments.\n * @param code - The code to preprocess.\n * @returns The object containing the preprocessed code, title, and configuration.\n */\nexport function preprocessDiagram(code: string) {\n const cleanedCode = cleanupText(code);\n const frontMatterResult = processFrontmatter(cleanedCode);\n const directiveResult = processDirectives(frontMatterResult.text);\n const config = cleanAndMerge(frontMatterResult.config, directiveResult.directive);\n code = cleanupComments(directiveResult.text);\n return {\n code,\n title: frontMatterResult.title,\n config,\n } satisfies DiagramMetadata & { code: string };\n}\n", "export function toBase64(str: string) {\n // ref: https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem\n const utf8Bytes = new TextEncoder().encode(str);\n const utf8Str = Array.from(utf8Bytes, (byte) => String.fromCodePoint(byte)).join('');\n return btoa(utf8Str);\n}\n", "/**\n * This file contains functions that are used internally by mermaid\n * and is not intended to be used by the end user.\n */\n// @ts-ignore TODO: Investigate D3 issue\nimport { select } from 'd3';\nimport {\n COMMENT,\n compile,\n KEYFRAMES,\n LAYER,\n MEDIA,\n middleware,\n SCOPE,\n serialize,\n stringify,\n SUPPORTS,\n} from 'stylis';\nimport DOMPurify from 'dompurify';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { addSVGa11yTitleDescription, setA11yDiagramInfo } from './accessibility.js';\nimport assignWithDepth from './assignWithDepth.js';\nimport * as configApi from './config.js';\nimport { getEffectiveHtmlLabels } from './config.js';\nimport type { MermaidConfig } from './config.type.js';\nimport { addDiagrams } from './diagram-api/diagram-orchestration.js';\nimport type { DiagramMetadata, DiagramStyleClassDef } from './diagram-api/types.js';\nimport { Diagram } from './Diagram.js';\nimport { evaluate } from './diagrams/common/common.js';\nimport errorRenderer from './diagrams/error/errorRenderer.js';\nimport { attachFunctions } from './interactionDb.js';\nimport { log, setLogLevel } from './logger.js';\nimport { preprocessDiagram } from './preprocess.js';\nimport getStyles, { cssStyleSheetToString } from './styles.js';\nimport theme from './themes/index.js';\nimport type {\n D3HtmlSelection,\n D3Selection,\n ParseOptions,\n ParseResult,\n RenderResult,\n} from './types.js';\nimport { decodeEntities } from './utils.js';\nimport { toBase64 } from './utils/base64.js';\nimport { sanitizeCss } from './utils/sanitizeDirective.js';\n\nconst MAX_TEXTLENGTH = 50_000;\nconst MAX_TEXTLENGTH_EXCEEDED_MSG =\n 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';\n\nconst SECURITY_LVL_SANDBOX = 'sandbox';\nconst SECURITY_LVL_LOOSE = 'loose';\n\nconst XMLNS_SVG_STD = 'http://www.w3.org/2000/svg';\nconst XMLNS_XLINK_STD = 'http://www.w3.org/1999/xlink';\nconst XMLNS_XHTML_STD = 'http://www.w3.org/1999/xhtml';\n\n// ------------------------------\n// iFrame\nconst IFRAME_WIDTH = '100%';\nconst IFRAME_HEIGHT = '100%';\nconst IFRAME_STYLES = 'border:0;margin:0;';\nconst IFRAME_BODY_STYLE = 'margin:0';\nconst IFRAME_SANDBOX_OPTS = 'allow-top-navigation-by-user-activation allow-popups';\nconst IFRAME_NOT_SUPPORTED_MSG = 'The \"iframe\" tag is not supported by your browser.';\n\n// DOMPurify settings for svgCode\nconst DOMPURIFY_TAGS = ['foreignobject'];\nconst DOMPURIFY_ATTR = ['dominant-baseline'];\n\nfunction processAndSetConfigs(text: string) {\n const processed = preprocessDiagram(text);\n configApi.reset();\n configApi.addDirective(processed.config ?? {});\n return processed;\n}\n\n/**\n * Parse the text and validate the syntax.\n * @param text - The mermaid diagram definition.\n * @param parseOptions - Options for parsing. @see {@link ParseOptions}\n * @returns An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.\n * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.\n */\nasync function parse(\n text: string,\n parseOptions: ParseOptions & { suppressErrors: true }\n): Promise;\nasync function parse(text: string, parseOptions?: ParseOptions): Promise;\nasync function parse(text: string, parseOptions?: ParseOptions): Promise {\n addDiagrams();\n try {\n const { code, config } = processAndSetConfigs(text);\n const diagram = await getDiagramFromText(code);\n return { diagramType: diagram.type, config };\n } catch (error) {\n if (parseOptions?.suppressErrors) {\n return false;\n }\n throw error;\n }\n}\n\n/**\n * Create a CSS style that starts with the given class name, then the element,\n * with an enclosing block that has each of the cssClasses followed by !important;\n * @param cssClass - CSS class name\n * @param element - CSS element\n * @param cssClasses - list of CSS styles to append after the element\n * @returns - the constructed string\n */\nexport const cssImportantStyles = (\n cssClass: string,\n element: string,\n cssClasses: string[] = []\n): string => {\n const declarationBlock = sanitizeCss(`{ ${cssClasses.join(' !important; ')} !important; }`);\n return `.${cssClass} ${element} ${declarationBlock}`;\n};\n\n/**\n * Create the user styles\n * @internal\n * @param config - configuration that has style and theme settings to use\n * @param classDefs - the classDefs in the diagram text. Might be null if none were defined. Usually is the result of a call to getClasses(...)\n * @returns the string with all the user styles\n */\nexport const createCssStyles = (\n config: MermaidConfig,\n classDefs: Map | null | undefined = new Map()\n): string => {\n const cssStyles = new CSSStyleSheet();\n\n // user provided theme CSS info\n // If you add more configuration driven data into the user styles make sure that the value is\n // sanitized by the sanitize CSS function TODO where is this method? what should be used to replace it? refactor so that it's always sanitized\n if (config.fontFamily !== undefined) {\n cssStyles.insertRule(\n `:root { --mermaid-font-family: ${config.fontFamily}}`,\n cssStyles.cssRules.length\n );\n }\n if (config.altFontFamily !== undefined) {\n cssStyles.insertRule(\n `:root { --mermaid-alt-font-family: ${config.altFontFamily}}`,\n cssStyles.cssRules.length\n );\n }\n\n // classDefs defined in the diagram text\n if (classDefs instanceof Map) {\n const htmlLabels = getEffectiveHtmlLabels(config);\n\n const cssHtmlElements = ['> *', 'span']; // TODO make a constant\n const cssShapeElements = ['rect', 'polygon', 'ellipse', 'circle', 'path']; // TODO make a constant\n\n const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;\n\n // create the CSS styles needed for each styleClass definition and css element\n classDefs.forEach((styleClassDef) => {\n // create the css styles for each cssElement and the styles (only if there are styles)\n if (!isEmpty(styleClassDef.styles)) {\n cssElements.forEach((cssElement) => {\n cssStyles.insertRule(\n cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles),\n cssStyles.cssRules.length\n );\n });\n }\n // create the css styles for the tspan element and the text styles (only if there are textStyles)\n if (!isEmpty(styleClassDef.textStyles)) {\n cssStyles.insertRule(\n cssImportantStyles(\n styleClassDef.id,\n 'tspan',\n (styleClassDef?.textStyles || []).map((s) => s.replace('color', 'fill'))\n ),\n cssStyles.cssRules.length\n );\n }\n });\n }\n\n let cssString = '';\n if (config.themeCSS !== undefined) {\n if (typeof cssStyles.replaceSync === 'function') {\n const themeCssStyleSheet = new CSSStyleSheet();\n themeCssStyleSheet.replaceSync(config.themeCSS);\n cssString = cssStyleSheetToString(themeCssStyleSheet) + '\\n';\n } else {\n /**\n * Ideally we'd do a `CSSStyleSheet.replaceSync`, but it's not supported\n * in some older browsers and in JSDOM.\n */\n cssString += `${config.themeCSS}\\n`;\n }\n }\n\n return cssString + cssStyleSheetToString(cssStyles);\n};\n\n/**\n * Use `stylis` to compile the CSS to only apply to the given namespace.\n *\n * This will also remove some newer CSS features (e.g. nesting) to better\n * support older browsers and does some minification. It also removes some\n * at-rules that can't be namespaced.\n *\n * @internal\n * @param namespace - the namespace to add in front of all the CSS styles, e.g. `#idOfSvgElement`\n * @param css - the CSS styles to add the namespace to.\n * @see https://github.com/thysultan/stylis\n *\n * @example\n * // Returns `#id .class1{fill:red;}`\n * compileCSS('#id', `.class1 { fill: red }`)\n */\nconst compileCSS = (namespace: `#${string}`, css: string) => {\n return serialize(\n compile(`${namespace}{${css}}`),\n middleware([\n function addNamespace(element, _index, _children, _callback) {\n /**\n * CSS normally automatically adds the `&` selector in front of each\n * element. But, if there's already an `&` selector, it doesn't add this.\n *\n * This code will explicitly make sure it's always added, to ensure\n * that the CSS never applies outside the SVG.\n *\n * E.g. `#svgId { .nested-class :not(&) { fill: red } }` will be\n * transformed to `#svgId { & .nested-class :not(&) { fill: red } }`\n */\n if (element.type === 'rule' && Array.isArray(element.props)) {\n if (element.parent && element.parent.type === KEYFRAMES) {\n /**\n * Don't namespace CSSKeyframeRule, since they don't have selectors.\n */\n return;\n }\n element.props = element.props.map((prop) => {\n if (!prop.startsWith(namespace)) {\n return `${namespace} ${prop}`;\n }\n return prop;\n });\n } else if (element.type.startsWith('@')) {\n // Only allow certain at-rules to avoid namespace escape.\n //\n // Nested ones are allowed, since they'd get namespaced appropriately.\n // @keyframes are required for Mermaid's animation features, even\n // if they can potentially pollute the page.\n\n /**\n * At-rules that contain nested rules.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@container}\n */\n const nestedAtRules = [\n MEDIA,\n SUPPORTS,\n LAYER,\n SCOPE,\n '@container',\n '@starting-style',\n ] as const;\n const allowedAtRules = [\n ...nestedAtRules,\n KEYFRAMES, // needed for Mermaid's animation feature\n ] as const;\n if (!allowedAtRules.includes(element.type as (typeof allowedAtRules)[number])) {\n log.warn(`Removing unsupported at-rule ${element.type} from CSS`);\n element.type = COMMENT;\n }\n }\n },\n stringify,\n ])\n );\n};\n\nexport const createUserStyles = (\n config: MermaidConfig,\n graphType: string,\n classDefs: Map | undefined,\n // CSS selector for the SVG element, e.g. `#idOfSvgElement`\n svgId: `#${string}`\n): string => {\n const userCSSstyles = createCssStyles(config, classDefs);\n const allStyles = getStyles(\n graphType,\n userCSSstyles,\n { ...config.themeVariables, theme: config.theme, look: config.look },\n svgId\n );\n return compileCSS(svgId, allStyles);\n};\n\n/**\n * Clean up svgCode. Do replacements needed\n *\n * @param svgCode - the code to clean up\n * @param inSandboxMode - security level\n * @param useArrowMarkerUrls - should arrow marker's use full urls? (vs. just the anchors)\n * @returns the cleaned up svgCode\n */\nexport const cleanUpSvgCode = (\n svgCode = '',\n inSandboxMode: boolean,\n useArrowMarkerUrls: boolean\n): string => {\n let cleanedUpSvg = svgCode;\n\n // Replace marker-end urls with just the # anchor (remove the preceding part of the URL)\n if (!useArrowMarkerUrls && !inSandboxMode) {\n cleanedUpSvg = cleanedUpSvg.replace(\n /marker-end=\"url\\([\\d+./:=?A-Za-z-]*?#/g,\n 'marker-end=\"url(#'\n );\n }\n\n cleanedUpSvg = decodeEntities(cleanedUpSvg);\n\n // replace old br tags with newer style\n cleanedUpSvg = cleanedUpSvg.replace(/
/g, '
');\n\n return cleanedUpSvg;\n};\n\n/**\n * Put the svgCode into an iFrame. Return the iFrame code\n *\n * @param svgCode - the svg code to put inside the iFrame\n * @param svgElement - the d3 node that has the current svgElement so we can get the height from it\n * @returns - the code with the iFrame that now contains the svgCode\n */\nexport const putIntoIFrame = (svgCode = '', svgElement?: SVGSVGElement): string => {\n const height = svgElement?.viewBox?.baseVal?.height\n ? svgElement.viewBox.baseVal.height + 'px'\n : IFRAME_HEIGHT;\n const base64encodedSrc = toBase64(`${svgCode}`);\n return ``;\n};\n\n/**\n * Append an enclosing div, then svg, then g (group) to the d3 parentRoot. Set attributes.\n * Only set the style attribute on the enclosing div if divStyle is given.\n * Only set the xmlns:xlink attribute on svg if svgXlink is given.\n * Return the last node appended\n *\n * @param parentRoot - the d3 node to append things to\n * @param id - the value to set the id attr to\n * @param enclosingDivId - the id to set the enclosing div to\n * @param divStyle - if given, the style to set the enclosing div to\n * @param svgXlink - if given, the link to set the new svg element to\n * @returns - returns the parentRoot that had nodes appended\n */\nexport const appendDivSvgG = (\n parentRoot: D3HtmlSelection | D3HtmlSelection,\n id: string,\n enclosingDivId: string,\n divStyle?: string,\n svgXlink?: string\n) => {\n const enclosingDiv = parentRoot.append('div');\n enclosingDiv.attr('id', enclosingDivId);\n if (divStyle) {\n enclosingDiv.attr('style', divStyle);\n }\n\n const svgNode = enclosingDiv\n .append('svg')\n .attr('id', id)\n .attr('width', '100%')\n .attr('xmlns', XMLNS_SVG_STD);\n if (svgXlink) {\n svgNode.attr('xmlns:xlink', svgXlink);\n }\n\n svgNode.append('g');\n return parentRoot;\n};\n\n/**\n * Append an iFrame node to the given parentNode and set the id, style, and 'sandbox' attributes\n * Return the appended iframe d3 node\n *\n * @param parentNode - the d3 node to append the iFrame node to\n * @param iFrameId - id to use for the iFrame\n * @returns the appended iframe d3 node\n */\nfunction sandboxedIframe(\n parentNode: D3HtmlSelection | D3HtmlSelection,\n iFrameId: string\n) {\n return parentNode\n .append('iframe')\n .attr('id', iFrameId)\n .attr('style', 'width: 100%; height: 100%;')\n .attr('sandbox', '');\n}\n\n/**\n * Remove any existing elements from the given document\n *\n * @param doc - the document to removed elements from\n * @param id - id for any existing SVG element\n * @param divSelector - selector for any existing enclosing div element\n * @param iFrameSelector - selector for any existing iFrame element\n */\nexport const removeExistingElements = (\n doc: Document,\n id: string,\n divId: string,\n iFrameId: string\n) => {\n // Remove existing SVG element if it exists\n doc.getElementById(id)?.remove();\n // Remove previous temporary element if it exists\n // Both div and iframe needs to be cleared in case there is a config change happening between renders.\n doc.getElementById(divId)?.remove();\n doc.getElementById(iFrameId)?.remove();\n};\n\n/**\n * @deprecated - use the `mermaid.render` function instead of `mermaid.mermaidAPI.render`\n *\n * Deprecated for external use.\n */\n\nconst render = async function (\n id: string,\n text: string,\n svgContainingElement?: Element\n): Promise {\n addDiagrams();\n\n const processed = processAndSetConfigs(text);\n text = processed.code;\n\n const config = configApi.getConfig();\n log.debug(config);\n\n // Check the maximum allowed text size\n if (text.length > (config?.maxTextSize ?? MAX_TEXTLENGTH)) {\n text = MAX_TEXTLENGTH_EXCEEDED_MSG;\n }\n\n const idSelector = `#${id}` as const;\n const iFrameID = 'i' + id;\n const iFrameID_selector = '#' + iFrameID;\n const enclosingDivID = 'd' + id;\n const enclosingDivID_selector = '#' + enclosingDivID;\n\n const removeTempElements = () => {\n // -------------------------------------------------------------------------------\n // Remove the temporary HTML element if appropriate\n const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector;\n const node = select(tmpElementSelector).node();\n if (node && 'remove' in node) {\n node.remove();\n }\n };\n\n let root: D3HtmlSelection | D3HtmlSelection = select(document.body);\n\n const isSandboxed = config.securityLevel === SECURITY_LVL_SANDBOX;\n const isLooseSecurityLevel = config.securityLevel === SECURITY_LVL_LOOSE;\n\n const fontFamily = config.fontFamily;\n\n // -------------------------------------------------------------------------------\n // Define the root d3 node\n // In regular execution the svgContainingElement will be the element with a mermaid class\n\n if (svgContainingElement !== undefined) {\n if (svgContainingElement) {\n svgContainingElement.innerHTML = '';\n }\n\n if (isSandboxed) {\n // If we are in sandboxed mode, we do everything mermaid related in a (sandboxed )iFrame\n const iframe = sandboxedIframe(select(svgContainingElement), iFrameID);\n root = select(iframe.nodes()[0].contentDocument!.body);\n root.node()!.style.margin = '0';\n } else {\n root = select(svgContainingElement);\n }\n appendDivSvgG(root, id, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);\n } else {\n // No svgContainingElement was provided\n\n // If there is an existing element with the id, we remove it. This likely a previously rendered diagram\n removeExistingElements(document, id, enclosingDivID, iFrameID);\n\n // Add the temporary div used for rendering with the enclosingDivID.\n // This temporary div will contain a svg with the id == id\n\n if (isSandboxed) {\n // If we are in sandboxed mode, we do everything mermaid related in a (sandboxed) iFrame\n const iframe = sandboxedIframe(select(document.body), iFrameID);\n root = select(iframe.nodes()[0].contentDocument!.body);\n root.node()!.style.margin = '0';\n } else {\n root = select('body');\n }\n\n appendDivSvgG(root, id, enclosingDivID);\n }\n\n // -------------------------------------------------------------------------------\n // Create the diagram\n\n // Important that we do not create the diagram until after the directives have been included\n let diag: Diagram;\n let parseEncounteredException;\n\n try {\n diag = await Diagram.fromText(text, { title: processed.title });\n } catch (error) {\n if (config.suppressErrorRendering) {\n removeTempElements();\n throw error;\n }\n diag = await Diagram.fromText('error');\n parseEncounteredException = error;\n }\n\n // Get the temporary div element containing the svg\n const element = root.select(enclosingDivID_selector).node()!;\n const diagramType = diag.type;\n\n // -------------------------------------------------------------------------------\n // Create and insert the styles (user styles, theme styles, config styles)\n\n // Insert an element into svg. This is where we put the styles\n const svg = element.firstChild!;\n const firstChild = svg.firstChild;\n const diagramClassDefs = diag.renderer.getClasses?.(text, diag);\n\n const rules = createUserStyles(config, diagramType, diagramClassDefs, idSelector);\n\n const style1 = document.createElement('style');\n style1.innerHTML = rules;\n svg.insertBefore(style1, firstChild);\n\n // -------------------------------------------------------------------------------\n // Draw the diagram with the renderer\n try {\n await diag.renderer.draw(text, id, injected.version, diag);\n } catch (e) {\n if (config.suppressErrorRendering) {\n removeTempElements();\n } else {\n errorRenderer.draw(text, id, injected.version);\n }\n throw e;\n }\n\n // This is the d3 node for the svg element\n const svgNode = root.select(`${enclosingDivID_selector} svg`);\n const a11yTitle: string | undefined = diag.db.getAccTitle?.();\n const a11yDescr: string | undefined = diag.db.getAccDescription?.();\n addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr);\n // -------------------------------------------------------------------------------\n // Clean up SVG code\n root.select(`[id=\"${id}\"]`).selectAll('foreignobject > *').attr('xmlns', XMLNS_XHTML_STD);\n\n // Fix for when the base tag is used\n let svgCode: string = root.select(enclosingDivID_selector).node()!.innerHTML;\n\n log.debug('config.arrowMarkerAbsolute', config.arrowMarkerAbsolute);\n svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config.arrowMarkerAbsolute));\n\n if (isSandboxed) {\n const svgEl = root.select(enclosingDivID_selector + ' svg').node()!;\n svgCode = putIntoIFrame(svgCode, svgEl);\n } else if (!isLooseSecurityLevel) {\n // Sanitize the svgCode using DOMPurify\n svgCode = DOMPurify.sanitize(svgCode, {\n ADD_TAGS: DOMPURIFY_TAGS,\n ADD_ATTR: DOMPURIFY_ATTR,\n HTML_INTEGRATION_POINTS: { foreignobject: true },\n });\n }\n\n attachFunctions();\n\n if (parseEncounteredException) {\n throw parseEncounteredException;\n }\n\n removeTempElements();\n\n return {\n diagramType,\n svg: svgCode,\n bindFunctions: diag.db.bindFunctions,\n };\n};\n\n/**\n * @param userOptions - Initial Mermaid options\n */\nfunction initialize(userOptions: MermaidConfig = {}) {\n const options: MermaidConfig = assignWithDepth({}, userOptions);\n // Handle legacy location of font-family configuration\n if (options?.fontFamily && !options.themeVariables?.fontFamily) {\n if (!options.themeVariables) {\n options.themeVariables = {};\n }\n options.themeVariables.fontFamily = options.fontFamily;\n }\n\n // Set default options\n configApi.saveConfigFromInitialize(options);\n\n if (options?.theme && options.theme in theme) {\n // Todo merge with user options\n options.themeVariables = theme[options.theme as keyof typeof theme].getThemeVariables(\n options.themeVariables\n );\n } else if (options) {\n options.themeVariables = theme.default.getThemeVariables(options.themeVariables);\n }\n\n const config =\n typeof options === 'object' ? configApi.setSiteConfig(options) : configApi.getSiteConfig();\n\n setLogLevel(config.logLevel);\n addDiagrams();\n}\n\nconst getDiagramFromText = (text: string, metadata: Pick = {}) => {\n const { code } = preprocessDiagram(text);\n return Diagram.fromText(code, metadata);\n};\n\n/**\n * Add accessibility (a11y) information to the diagram.\n *\n * @param diagramType - diagram type\n * @param svgNode - d3 node to insert the a11y title and desc info\n * @param a11yTitle - a11y title\n * @param a11yDescr - a11y description\n */\nfunction addA11yInfo(\n diagramType: string,\n svgNode: D3Selection,\n a11yTitle?: string,\n a11yDescr?: string\n): void {\n setA11yDiagramInfo(svgNode, diagramType);\n addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr('id'));\n}\n\n/**\n * @internal - Use mermaid.function instead of mermaid.mermaidAPI.function\n */\nexport const mermaidAPI = Object.freeze({\n render,\n parse,\n getDiagramFromText,\n initialize,\n getConfig: configApi.getConfig,\n setConfig: configApi.setConfig,\n getSiteConfig: configApi.getSiteConfig,\n updateSiteConfig: configApi.updateSiteConfig,\n reset: () => {\n configApi.reset();\n },\n globalReset: () => {\n configApi.reset(configApi.defaultConfig);\n },\n defaultConfig: configApi.defaultConfig,\n});\n\nsetLogLevel(configApi.getConfig().logLevel);\nconfigApi.reset(configApi.getConfig());\nexport default mermaidAPI;\n", "/**\n * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid\n * functionality and to render the diagrams to svg code!\n */\nimport type { AsyncIconLoader, IconLoader, SyncIconLoader } from './rendering-util/icons.js';\nimport { registerIconPacks } from './rendering-util/icons.js';\nimport { dedent } from 'ts-dedent';\nimport type { MermaidConfig } from './config.type.js';\nimport { detectType, detectors, registerLazyLoadedDiagrams } from './diagram-api/detectType.js';\nimport { addDiagrams } from './diagram-api/diagram-orchestration.js';\nimport { loadRegisteredDiagrams } from './diagram-api/loadDiagram.js';\nimport type { ExternalDiagramDefinition, SVG, SVGGroup } from './diagram-api/types.js';\nimport type { ParseErrorFunction } from './Diagram.js';\nimport type { UnknownDiagramError } from './errors.js';\nimport type { InternalHelpers } from './internals.js';\nimport { log } from './logger.js';\nimport { mermaidAPI } from './mermaidAPI.js';\nimport type { LayoutLoaderDefinition, RenderOptions } from './rendering-util/render.js';\nimport { registerLayoutLoaders } from './rendering-util/render.js';\nimport type { LayoutData } from './rendering-util/types.js';\nimport type { ParseOptions, ParseResult, RenderResult } from './types.js';\nimport type { DetailedError } from './utils.js';\nimport utils, { isDetailedError } from './utils.js';\n\nexport type {\n AsyncIconLoader,\n DetailedError,\n ExternalDiagramDefinition,\n IconLoader,\n InternalHelpers,\n LayoutData,\n LayoutLoaderDefinition,\n MermaidConfig,\n ParseErrorFunction,\n ParseOptions,\n ParseResult,\n RenderOptions,\n RenderResult,\n SVG,\n SVGGroup,\n SyncIconLoader,\n UnknownDiagramError,\n};\n\nexport interface RunOptions {\n /**\n * The query selector to use when finding elements to render. Default: `\".mermaid\"`.\n */\n querySelector?: string;\n /**\n * The nodes to render. If this is set, `querySelector` will be ignored.\n */\n nodes?: ArrayLike;\n /**\n * A callback to call after each diagram is rendered.\n */\n postRenderCallback?: (id: string) => unknown;\n /**\n * If `true`, errors will be logged to the console, but not thrown. Default: `false`\n */\n suppressErrors?: boolean;\n}\n\nconst handleError = (error: unknown, errors: DetailedError[], parseError?: ParseErrorFunction) => {\n log.warn(error);\n if (isDetailedError(error)) {\n // handle case where error string and hash were\n // wrapped in object like`const error = { str, hash };`\n if (parseError) {\n parseError(error.str, error.hash);\n }\n errors.push({ ...error, message: error.str, error });\n } else {\n // assume it is just error string and pass it on\n if (parseError) {\n parseError(error);\n }\n if (error instanceof Error) {\n errors.push({\n str: error.message,\n message: error.message,\n hash: error.name,\n error,\n });\n }\n }\n};\n\n/**\n * ## run\n *\n * Function that goes through the document to find the chart definitions in there and render them.\n *\n * The function tags the processed attributes with the attribute data-processed and ignores found\n * elements with the attribute already set. This way the init function can be triggered several\n * times.\n *\n * ```mermaid\n * graph LR;\n * a(Find elements)-->b{Processed}\n * b-->|Yes|c(Leave element)\n * b-->|No |d(Transform)\n * ```\n *\n * Renders the mermaid diagrams\n *\n * @param options - Optional runtime configs\n */\nconst run = async function (\n options: RunOptions = {\n querySelector: '.mermaid',\n }\n) {\n try {\n await runThrowsErrors(options);\n } catch (e) {\n if (isDetailedError(e)) {\n log.error(e.str);\n }\n if (mermaid.parseError) {\n mermaid.parseError(e as string);\n }\n if (!options.suppressErrors) {\n log.error('Use the suppressErrors option to suppress these errors');\n throw e;\n }\n }\n};\n\nconst runThrowsErrors = async function (\n { postRenderCallback, querySelector, nodes }: Omit = {\n querySelector: '.mermaid',\n }\n) {\n const conf = mermaidAPI.getConfig();\n\n log.debug(`${!postRenderCallback ? 'No ' : ''}Callback function found`);\n\n let nodesToProcess: ArrayLike;\n if (nodes) {\n nodesToProcess = nodes;\n } else if (querySelector) {\n nodesToProcess = document.querySelectorAll(querySelector);\n } else {\n throw new Error('Nodes and querySelector are both undefined');\n }\n\n log.debug(`Found ${nodesToProcess.length} diagrams`);\n if (conf?.startOnLoad !== undefined) {\n log.debug('Start On Load: ' + conf?.startOnLoad);\n mermaidAPI.updateSiteConfig({ startOnLoad: conf?.startOnLoad });\n }\n\n // generate the id of the diagram\n const idGenerator = new utils.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed);\n\n let txt: string;\n const errors: DetailedError[] = [];\n\n // element is the current div with mermaid class\n // eslint-disable-next-line unicorn/prefer-spread\n for (const element of Array.from(nodesToProcess)) {\n log.info('Rendering diagram: ' + element.id);\n /*! Check if previously processed */\n if (element.getAttribute('data-processed')) {\n continue;\n }\n element.setAttribute('data-processed', 'true');\n\n const id = `mermaid-${idGenerator.next()}`;\n\n // Fetch the graph definition including tags\n txt = element.innerHTML;\n\n // transforms the html to pure text\n txt = dedent(utils.entityDecode(txt)) // removes indentation, required for YAML parsing\n .trim()\n .replace(//gi, '
');\n\n const init = utils.detectInit(txt);\n if (init) {\n log.debug('Detected early reinit: ', init);\n }\n try {\n const { svg, bindFunctions } = await render(id, txt, element);\n element.innerHTML = svg;\n if (postRenderCallback) {\n await postRenderCallback(id);\n }\n if (bindFunctions) {\n bindFunctions(element);\n }\n } catch (error) {\n handleError(error, errors, mermaid.parseError);\n }\n }\n if (errors.length > 0) {\n // TODO: We should be throwing an error object.\n throw errors[0];\n }\n};\n\n/**\n * Used to set configurations for mermaid.\n * This function should be called before the run function.\n * @param config - Configuration object for mermaid.\n */\n\nconst initialize = function (config: MermaidConfig) {\n mermaidAPI.initialize(config);\n};\n\n/**\n * ## init\n *\n * @deprecated Use {@link initialize} and {@link run} instead.\n *\n * Renders the mermaid diagrams\n *\n * @param config - **Deprecated**, please set configuration in {@link initialize}.\n * @param nodes - **Default**: `.mermaid`. One of the following:\n * - A DOM Node\n * - An array of DOM nodes (as would come from a jQuery selector)\n * - A W3C selector, a la `.mermaid`\n * @param callback - Called once for each rendered diagram's id.\n */\nconst init = async function (\n config?: MermaidConfig,\n nodes?: string | HTMLElement | NodeListOf,\n callback?: (id: string) => unknown\n) {\n log.warn('mermaid.init is deprecated. Please use run instead.');\n if (config) {\n initialize(config);\n }\n const runOptions: RunOptions = { postRenderCallback: callback, querySelector: '.mermaid' };\n if (typeof nodes === 'string') {\n runOptions.querySelector = nodes;\n } else if (nodes) {\n if (nodes instanceof HTMLElement) {\n runOptions.nodes = [nodes];\n } else {\n runOptions.nodes = nodes;\n }\n }\n await run(runOptions);\n};\n\n/**\n * Used to register external diagram types.\n * @param diagrams - Array of {@link ExternalDiagramDefinition}.\n * @param opts - If opts.lazyLoad is false, the diagrams will be loaded immediately.\n */\nconst registerExternalDiagrams = async (\n diagrams: ExternalDiagramDefinition[],\n {\n lazyLoad = true,\n }: {\n lazyLoad?: boolean;\n } = {}\n) => {\n addDiagrams();\n registerLazyLoadedDiagrams(...diagrams);\n if (lazyLoad === false) {\n await loadRegisteredDiagrams();\n }\n};\n\n/**\n * ##contentLoaded Callback function that is called when page is loaded. This functions fetches\n * configuration for mermaid rendering and calls init for rendering the mermaid diagrams on the\n * page.\n */\nconst contentLoaded = function () {\n if (mermaid.startOnLoad) {\n const { startOnLoad } = mermaidAPI.getConfig();\n if (startOnLoad) {\n mermaid.run().catch((err) => log.error('Mermaid failed to initialize', err));\n }\n }\n};\n\nif (typeof document !== 'undefined') {\n /*!\n * Wait for document loaded before starting the execution\n */\n window.addEventListener('load', contentLoaded, false);\n}\n\n/**\n * ## setParseErrorHandler Alternative to directly setting parseError using:\n *\n * ```js\n * mermaid.parseError = function(err,hash) {\n * forExampleDisplayErrorInGui(err); // do something with the error\n * };\n * ```\n *\n * This is provided for environments where the mermaid object can't directly have a new member added\n * to it (eg. dart interop wrapper). (Initially there is no parseError member of mermaid).\n *\n * @param parseErrorHandler - New parseError() callback.\n */\nconst setParseErrorHandler = function (parseErrorHandler: (err: any, hash: any) => void) {\n mermaid.parseError = parseErrorHandler;\n};\n\nconst executionQueue: (() => Promise)[] = [];\nlet executionQueueRunning = false;\nconst executeQueue = async () => {\n if (executionQueueRunning) {\n return;\n }\n executionQueueRunning = true;\n while (executionQueue.length > 0) {\n const f = executionQueue.shift();\n if (f) {\n try {\n await f();\n } catch (e) {\n log.error('Error executing queue', e);\n }\n }\n }\n executionQueueRunning = false;\n};\n\n/**\n * Parse the text and validate the syntax.\n * @param text - The mermaid diagram definition.\n * @param parseOptions - Options for parsing. @see {@link ParseOptions}\n * @returns If valid, {@link ParseResult} otherwise `false` if parseOptions.suppressErrors is `true`.\n * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.\n *\n * @example\n * ```js\n * console.log(await mermaid.parse('flowchart \\n a --> b'));\n * // { diagramType: 'flowchart-v2' }\n * console.log(await mermaid.parse('wrong \\n a --> b', { suppressErrors: true }));\n * // false\n * console.log(await mermaid.parse('wrong \\n a --> b', { suppressErrors: false }));\n * // throws Error\n * console.log(await mermaid.parse('wrong \\n a --> b'));\n * // throws Error\n * ```\n */\nconst parse: typeof mermaidAPI.parse = async (text, parseOptions) => {\n return new Promise((resolve, reject) => {\n // This promise will resolve when the render call is done.\n // It will be queued first and will be executed when it is first in line\n const performCall = () =>\n new Promise((res, rej) => {\n mermaidAPI.parse(text, parseOptions).then(\n (r) => {\n // This resolves for the promise for the queue handling\n res(r);\n // This fulfills the promise sent to the value back to the original caller\n resolve(r);\n },\n (e) => {\n log.error('Error parsing', e);\n mermaid.parseError?.(e);\n rej(e);\n reject(e);\n }\n );\n });\n executionQueue.push(performCall);\n executeQueue().catch(reject);\n });\n};\n\n/**\n * Function that renders an SVG with a graph from a chart definition. Usage example below.\n *\n * ```javascript\n * element = document.querySelector('#graphDiv');\n * const graphDefinition = 'graph TB\\na-->b';\n * const { svg, bindFunctions } = await mermaid.render('graphDiv', graphDefinition);\n * element.innerHTML = svg;\n * bindFunctions?.(element);\n * ```\n *\n * @remarks\n * Multiple calls to this function will be enqueued to run serially.\n *\n * @param id - The id for the SVG element (the element to be rendered)\n * @param text - The text for the graph definition\n * @param container - HTML element where the svg will be inserted. (Is usually element with the .mermaid class)\n * If no svgContainingElement is provided then the SVG element will be appended to the body.\n * Selector to element in which a div with the graph temporarily will be\n * inserted. If one is provided a hidden div will be inserted in the body of the page instead. The\n * element will be removed when rendering is completed.\n * @returns Returns the SVG Definition and BindFunctions.\n */\nconst render: typeof mermaidAPI.render = (id, text, container) => {\n return new Promise((resolve, reject) => {\n // This promise will resolve when the mermaidAPI.render call is done.\n // It will be queued first and will be executed when it is first in line\n const performCall = () =>\n new Promise((res, rej) => {\n mermaidAPI.render(id, text, container).then(\n (r) => {\n // This resolves for the promise for the queue handling\n res(r);\n // This fulfills the promise sent to the value back to the original caller\n resolve(r);\n },\n (e) => {\n log.error('Error parsing', e);\n mermaid.parseError?.(e);\n rej(e);\n reject(e);\n }\n );\n });\n executionQueue.push(performCall);\n executeQueue().catch(reject);\n });\n};\n\n/**\n * Gets the metadata for all registered diagrams.\n * Currently only the id is returned.\n * @returns An array of objects with the id of the diagram.\n */\nconst getRegisteredDiagramsMetadata = (): Pick[] => {\n return Object.keys(detectors).map((id) => ({\n id,\n }));\n};\n\nexport interface Mermaid {\n startOnLoad: boolean;\n parseError?: ParseErrorFunction;\n /**\n * @deprecated Use {@link parse} and {@link render} instead. Please [open a discussion](https://github.com/mermaid-js/mermaid/discussions) if your use case does not fit the new API.\n * @internal\n */\n mermaidAPI: typeof mermaidAPI;\n parse: typeof parse;\n render: typeof render;\n /**\n * @deprecated Use {@link initialize} and {@link run} instead.\n */\n init: typeof init;\n run: typeof run;\n registerLayoutLoaders: typeof registerLayoutLoaders;\n registerExternalDiagrams: typeof registerExternalDiagrams;\n initialize: typeof initialize;\n contentLoaded: typeof contentLoaded;\n setParseErrorHandler: typeof setParseErrorHandler;\n detectType: typeof detectType;\n registerIconPacks: typeof registerIconPacks;\n getRegisteredDiagramsMetadata: typeof getRegisteredDiagramsMetadata;\n}\n\nconst mermaid: Mermaid = {\n startOnLoad: true,\n mermaidAPI,\n parse,\n render,\n init,\n run,\n registerExternalDiagrams,\n registerLayoutLoaders,\n initialize,\n parseError: undefined,\n contentLoaded,\n setParseErrorHandler,\n detectType,\n registerIconPacks,\n getRegisteredDiagramsMetadata,\n};\n\nexport default mermaid;\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAM,KAAK;AAEX,IAAM,WAA4B,wBAAC,QAAQ;AACzC,SAAO,+DAA+D,KAAK,GAAG;AAChF,GAFkC;AAIlC,IAAM,SAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAA,SAAQ,IAAI,MAAM,OAAO,6CAAgB;AACjD,SAAO,EAAE,IAAI,SAAAA,SAAQ;AACvB,GAH8B;AAK9B,IAAM,SAAoC;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAO,qBAAQ;;;ACjBf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,KAAK,WAAW;AAGjD,MACE,QAAQ,WAAW,oBAAoB,mBACvC,QAAQ,WAAW,oBAAoB,OACvC;AACA,WAAO;AAAA,EACT;AACA,SAAO,YAAY,KAAK,GAAG;AAC7B,GAVkC;AAYlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,+CAAkB;AACnD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,uBAAQE;;;ACzBf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,KAAK,WAAW;AACjD,MAAI,QAAQ,WAAW,oBAAoB,YAAY;AACrD,WAAO;AAAA,EACT;AAEA,MAAI,QAAQ,WAAW,oBAAoB,OAAO;AAChD,WAAO,SAAS;AAAA,EAClB;AAGA,MAAI,YAAY,KAAK,GAAG,KAAK,QAAQ,WAAW,oBAAoB,iBAAiB;AACnF,WAAO;AAAA,EACT;AACA,SAAO,gBAAgB,KAAK,GAAG;AACjC,GAdkC;AAgBlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,+CAAkB;AACnD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,0BAAQE;;;AC7Bf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,gBAAgB,KAAK,GAAG;AACjC,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,6CAAgB;AACjD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,qBAAQE;;;ACpBf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,eAAe,KAAK,GAAG;AAChC,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,mDAAsB;AACvD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACdf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,YAAY,KAAK,GAAG;AAC7B,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,gDAAmB;AACpD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,wBAAQE;;;ACjBf,IAAMC,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,WAAW,KAAK,GAAG;AAC5B,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,+CAAkB;AACnD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,OAAkC;AAAA,EAC7C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,UAAU,KAAK,GAAG;AAC3B,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,8CAAiB;AAClD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,MAAiC;AAAA,EAC5C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,MAAK;AAEX,IAAMC,YAA4B,wBAAC,QAAQ;AACzC,SAAO,oBAAoB,KAAK,GAAG;AACrC,GAFkC;AAIlC,IAAMC,UAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,mDAAsB;AACvD,SAAO,EAAE,IAAAH,KAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,sBAAsB,KAAK,GAAG;AACvC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,kDAAqB;AACtD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,0BAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,4BAA4B,KAAK,GAAG;AAC7C,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,sDAAyB;AAC1D,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,UAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,8BAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,sBAAsB,KAAK,GAAG;AACvC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,mDAAsB;AACvD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,WAAW;AAEjD,MAAI,QAAQ,OAAO,oBAAoB,iBAAiB;AACtD,WAAO;AAAA,EACT;AAEA,SAAO,mBAAmB,KAAK,GAAG;AACpC,GAPkC;AASlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,gDAAmB;AACpD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,wBAAQE;;;ACtBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,WAAW;AAEjD,MAAI,mBAAmB,KAAK,GAAG,KAAK,QAAQ,OAAO,oBAAoB,iBAAiB;AACtF,WAAO;AAAA,EACT;AAEA,SAAO,sBAAsB,KAAK,GAAG;AACvC,GAPkC;AASlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,mDAAsB;AACvD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACtBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,WAAW;AAGjD,MAAI,QAAQ,OAAO,oBAAoB,iBAAiB;AACtD,WAAO;AAAA,EACT;AACA,SAAO,mBAAmB,KAAK,GAAG;AACpC,GAPkC;AASlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,gDAAmB;AACpD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,wBAAQE;;;ACtBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,WAAW;AACjD,MAAI,sBAAsB,KAAK,GAAG,GAAG;AACnC,WAAO;AAAA,EACT;AACA,MAAI,mBAAmB,KAAK,GAAG,KAAK,QAAQ,OAAO,oBAAoB,iBAAiB;AACtF,WAAO;AAAA,EACT;AACA,SAAO;AACT,GARkC;AAUlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,mDAAsB;AACvD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,2BAAQE;;;ACvBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,cAAc,KAAK,GAAG;AAC/B,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,kDAAqB;AACtD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,0BAAQE;;;ACXR,IAAM,OAAO,wBAAC,OAAeC,MAAY,YAAoB;AAClE,MAAI,MAAM,kCAAkC;AAC5C,QAAM,MAAW,iBAAiBA,IAAE;AACpC,QAAM,IAAc,IAAI,OAAO,GAAG;AAElC,MAAI,KAAK,WAAW,cAAc;AAClC,mBAAiB,KAAK,KAAK,KAAK,IAAI;AAEpC,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B;AAAA,IACC;AAAA,IACA;AAAA,EACF;AAEF,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B,KAAK,KAAK,IAAI,EACd,KAAK,KAAK,GAAG,EACb,KAAK,aAAa,OAAO,EACzB,MAAM,eAAe,QAAQ,EAC7B,KAAK,sBAAsB;AAC9B,IAAE,OAAO,MAAM,EACZ,KAAK,SAAS,YAAY,EAC1B,KAAK,KAAK,IAAI,EACd,KAAK,KAAK,GAAG,EACb,KAAK,aAAa,OAAO,EACzB,MAAM,eAAe,QAAQ,EAC7B,KAAK,mBAAmB,OAAO,EAAE;AACtC,GAhEoB;AAkEb,IAAM,WAAW,EAAE,KAAK;AAE/B,IAAO,wBAAQ;;;AC7Ef,IAAM,UAA6B;AAAA,EACjC,IAAI,CAAC;AAAA,EACL;AAAA,EACA,QAAQ;AAAA,IACN,OAAO,6BAAY;AACjB;AAAA,IACF,GAFO;AAAA,EAGT;AACF;AAEA,IAAO,uBAAQ;;;ACPf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,KAAK,SAAS,CAAC,MAAe;AAC/D;AAAA;AAAA,IAEE,oBAAoB,KAAK,GAAG;AAAA,IAE3B,wBAAwB,KAAK,GAAG,KAAK,QAAQ,WAAW,oBAAoB;AAAA,IAC7E;AACA,WAAO,SAAS;AAChB,WAAO;AAAA,EACT;AACA,SAAO;AACT,GAXkC;AAalC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,+CAAmB;AACpD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,mBAAQE;;;AC1Bf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,eAAe,KAAK,GAAG;AAChC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,uDAA0B;AAC3D,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;AClBf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,cAAc,KAAK,GAAG;AAC/B,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,sDAAyB;AAC1D,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;ACjBf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,aAAa,KAAK,GAAG;AAC9B,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,qDAAwB;AACzD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;ACpBf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,qBAAqB,KAAK,GAAG;AACtC,GAFkC;AAIlC,IAAMC,WAAS,mCAAY;AACzB,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,iDAAoB;AACrD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAHe;AAKf,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,yBAAQE;;;ACbf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,qBAAqB,KAAK,GAAG;AACtC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,2CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,SAAoC;AAAA,EAC/C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,iBAAiB,KAAK,GAAG;AAClC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,2CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,QAAmC;AAAA,EAC9C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACnBA,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,oBAAoB,KAAK,GAAG;AACrC,GAFkC;AAIlC,IAAMC,WAAS,mCAAY;AACzB,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,gDAAmB;AACpD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAHe;AAKf,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,wBAAQE;;;AChBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,oBAAoB,KAAK,GAAG;AACrC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,2CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;ACdf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,mBAAmB,KAAK,GAAG;AACpC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,uDAA0B;AAC3D,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAM,eAA0C;AAAA,EAC9C,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,+BAAQ;;;ACpBf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,oBAAoB,KAAK,GAAG;AACrC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,2CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAOG,oBAAQD;;;ACdf,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,0BAA0B,KAAK,GAAG;AAC3C,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,mDAAsB;AACvD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,WAAsC;AAAA,EACjD,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,gBAAgB,KAAK,GAAG;AACjC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,+CAAkB;AACnD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,uBAAQE;;;ACjBf,IAAMC,OAAK;AAEX,IAAMC,aAA4B,wBAAC,QAAQ;AACzC,SAAO,cAAc,KAAK,GAAG;AAC/B,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,2CAAc;AAC/C,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAKvB,IAAM,UAAqC;AAAA,EAChD,IAAAH;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;;;ACfA,IAAME,OAAK;AAEX,IAAMC,aAA4B,wBAAC,SAAS;AAC1C,SAAO,oBAAoB,KAAK,IAAI;AACtC,GAFkC;AAIlC,IAAMC,WAAwB,mCAAY;AACxC,QAAM,EAAE,SAAAC,SAAQ,IAAI,MAAM,OAAO,kDAAqB;AACtD,SAAO,EAAE,IAAAH,MAAI,SAAAG,SAAQ;AACvB,GAH8B;AAK9B,IAAMC,WAAoC;AAAA,EACxC,IAAAJ;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACF;AAEA,IAAO,0BAAQE;;;ACcf,IAAI,oBAAoB;AACjB,IAAM,cAAc,6BAAM;AAC/B,MAAI,mBAAmB;AACrB;AAAA,EACF;AAGA,sBAAoB;AACpB,kBAAgB,SAAS,sBAAc,CAAC,SAAS;AAC/C,WAAO,KAAK,YAAY,EAAE,KAAK,MAAM;AAAA,EACvC,CAAC;AACD;AAAA,IACE;AAAA;AAAA,IAEA;AAAA,MACE,IAAI;AAAA,QACF,OAAO,6BAAM;AAAA,QAEb,GAFO;AAAA,MAGT;AAAA,MACA,QAAQ,CAAC;AAAA;AAAA,MACT,UAAU;AAAA,QACR,MAAM,6BAAM;AAAA,QAEZ,GAFM;AAAA,MAGR;AAAA,MACA,QAAQ;AAAA,QACN,OAAO,6BAAM;AACX,gBAAM,IAAI;AAAA,YACR;AAAA,UAGF;AAAA,QACF,GANO;AAAA,MAOT;AAAA,MACA,MAAM,6BAAM,MAAN;AAAA;AAAA,IACR;AAAA,IACA,CAAC,SAAS;AACR,aAAO,KAAK,YAAY,EAAE,UAAU,EAAE,WAAW,KAAK;AAAA,IACxD;AAAA,EACF;AAEA,MAAI,MAA+B;AACjC,+BAA2B,kBAAcC,mBAAS,4BAAY;AAAA,EAChE;AAGA;AAAA,IACE;AAAA,IACAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAA;AAAA,IACAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GA7E2B;;;AClCpB,IAAM,yBAAyB,mCAAY;AAChD,MAAI,MAAM,6BAA6B;AAEvC,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,OAAO,QAAQ,SAAS,EAAE,IAAI,OAAO,CAAC,KAAK,EAAE,UAAAC,YAAU,QAAAC,SAAO,CAAC,MAAM;AACnE,UAAI,CAACA,UAAQ;AACX;AAAA,MACF;AACA,UAAI;AACF,mBAAW,GAAG;AAAA,MAChB,QAAQ;AACN,YAAI;AAEF,gBAAM,EAAE,SAAAC,UAAS,IAAAC,KAAG,IAAI,MAAMF,SAAO;AACrC,0BAAgBE,MAAID,UAASF,UAAQ;AAAA,QACvC,SAAS,KAAK;AAEZ,cAAI,MAAM,4CAA4C,GAAG,4BAA4B;AACrF,iBAAO,UAAU,GAAG;AACpB,gBAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACA,QAAM,SAAS,QAAQ,OAAO,CAAC,WAAW,OAAO,WAAW,UAAU;AACtE,MAAI,OAAO,SAAS,GAAG;AACrB,QAAI,MAAM,kBAAkB,OAAO,MAAM,oBAAoB;AAC7D,eAAW,OAAO,QAAQ;AACxB,UAAI,MAAM,GAAG;AAAA,IACf;AACA,UAAM,IAAI,MAAM,kBAAkB,OAAO,MAAM,oBAAoB;AAAA,EACrE;AACF,GAhCsC;;;ACA/B,IAAI,UAAU;AACd,IAAI,UAAU;AACd,IAAI,cAAc;AAGlB,IAAI,QAAQ;AACZ,IAAI,SAAS;AAGb,IAAI,WAAW;AAEf,IAAI,YAAY;AAChB,IAAI,YAAY;AAIhB,IAAI,QAAQ;AACZ,IAAI,QAAQ;;;ACjBZ,IAAI,MAAM,KAAK;AAMf,IAAI,OAAO,OAAO;AAqBlB,SAAS,KAAM,OAAO;AAC5B,SAAO,MAAM,KAAK;AACnB;AAFgB;AAmBT,SAAS,QAAS,OAAO,SAAS,aAAa;AACrD,SAAO,MAAM,QAAQ,SAAS,WAAW;AAC1C;AAFgB;AAUT,SAAS,QAAS,OAAO,QAAQI,WAAU;AACjD,SAAO,MAAM,QAAQ,QAAQA,SAAQ;AACtC;AAFgB;AAST,SAAS,OAAQ,OAAO,OAAO;AACrC,SAAO,MAAM,WAAW,KAAK,IAAI;AAClC;AAFgB;AAUT,SAAS,OAAQ,OAAO,OAAO,KAAK;AAC1C,SAAO,MAAM,MAAM,OAAO,GAAG;AAC9B;AAFgB;AAQT,SAAS,OAAQ,OAAO;AAC9B,SAAO,MAAM;AACd;AAFgB;AAQT,SAAS,OAAQ,OAAO;AAC9B,SAAO,MAAM;AACd;AAFgB;AAST,SAAS,OAAQ,OAAO,OAAO;AACrC,SAAO,MAAM,KAAK,KAAK,GAAG;AAC3B;AAFgB;;;ACtGT,IAAI,OAAO;AACX,IAAI,SAAS;AACb,IAAI,SAAS;AACb,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,aAAa;AAYjB,SAAS,KAAM,OAAO,MAAM,QAAQ,MAAM,OAAO,UAAUC,SAAQ,UAAU;AACnF,SAAO,EAAC,OAAc,MAAY,QAAgB,MAAY,OAAc,UAAoB,MAAY,QAAgB,QAAQA,SAAQ,QAAQ,IAAI,SAAkB;AAC3K;AAFgB;AA0BT,SAAS,OAAQ;AACvB,SAAO;AACR;AAFgB;AAOT,SAAS,OAAQ;AACvB,cAAY,WAAW,IAAI,OAAO,YAAY,EAAE,QAAQ,IAAI;AAE5D,MAAI,UAAU,cAAc;AAC3B,aAAS,GAAG;AAEb,SAAO;AACR;AAPgB;AAYT,SAAS,OAAQ;AACvB,cAAY,WAAW,SAAS,OAAO,YAAY,UAAU,IAAI;AAEjE,MAAI,UAAU,cAAc;AAC3B,aAAS,GAAG;AAEb,SAAO;AACR;AAPgB;AAYT,SAAS,OAAQ;AACvB,SAAO,OAAO,YAAY,QAAQ;AACnC;AAFgB;AAOT,SAAS,QAAS;AACxB,SAAO;AACR;AAFgB;AAST,SAAS,MAAO,OAAO,KAAK;AAClC,SAAO,OAAO,YAAY,OAAO,GAAG;AACrC;AAFgB;AAQT,SAAS,MAAO,MAAM;AAC5B,UAAQ,MAAM;AAAA;AAAA,IAEb,KAAK;AAAA,IAAG,KAAK;AAAA,IAAG,KAAK;AAAA,IAAI,KAAK;AAAA,IAAI,KAAK;AACtC,aAAO;AAAA;AAAA,IAER,KAAK;AAAA,IAAI,KAAK;AAAA,IAAI,KAAK;AAAA,IAAI,KAAK;AAAA,IAAI,KAAK;AAAA,IAAI,KAAK;AAAA,IAAI,KAAK;AAAA;AAAA,IAE3D,KAAK;AAAA,IAAI,KAAK;AAAA,IAAK,KAAK;AACvB,aAAO;AAAA;AAAA,IAER,KAAK;AACJ,aAAO;AAAA;AAAA,IAER,KAAK;AAAA,IAAI,KAAK;AAAA,IAAI,KAAK;AAAA,IAAI,KAAK;AAC/B,aAAO;AAAA;AAAA,IAER,KAAK;AAAA,IAAI,KAAK;AACb,aAAO;AAAA,EACT;AAEA,SAAO;AACR;AAtBgB;AA4BT,SAAS,MAAO,OAAO;AAC7B,SAAO,OAAO,SAAS,GAAG,SAAS,OAAO,aAAa,KAAK,GAAG,WAAW,GAAG,CAAC;AAC/E;AAFgB;AAQT,SAAS,QAAS,OAAO;AAC/B,SAAO,aAAa,IAAI;AACzB;AAFgB;AAQT,SAAS,QAAS,MAAM;AAC9B,SAAO,KAAK,MAAM,WAAW,GAAG,UAAU,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,OAAO,IAAI,IAAI,CAAC,CAAC;AACnG;AAFgB;AAgBT,SAAS,WAAY,MAAM;AACjC,SAAO,YAAY,KAAK;AACvB,QAAI,YAAY;AACf,WAAK;AAAA;AAEL;AAEF,SAAO,MAAM,IAAI,IAAI,KAAK,MAAM,SAAS,IAAI,IAAI,KAAK;AACvD;AARgB;AAgCT,SAAS,SAAU,OAAO,OAAO;AACvC,SAAO,EAAE,SAAS,KAAK;AAEtB,QAAI,YAAY,MAAM,YAAY,OAAQ,YAAY,MAAM,YAAY,MAAQ,YAAY,MAAM,YAAY;AAC7G;AAEF,SAAO,MAAM,OAAO,MAAM,KAAK,QAAQ,KAAK,KAAK,KAAK,MAAM,KAAK,KAAK,GAAG;AAC1E;AAPgB;AAaT,SAAS,UAAW,MAAM;AAChC,SAAO,KAAK;AACX,YAAQ,WAAW;AAAA;AAAA,MAElB,KAAK;AACJ,eAAO;AAAA;AAAA,MAER,KAAK;AAAA,MAAI,KAAK;AACb,YAAI,SAAS,MAAM,SAAS;AAC3B,oBAAU,SAAS;AACpB;AAAA;AAAA,MAED,KAAK;AACJ,YAAI,SAAS;AACZ,oBAAU,IAAI;AACf;AAAA;AAAA,MAED,KAAK;AACJ,aAAK;AACL;AAAA,IACF;AAED,SAAO;AACR;AAvBgB;AA8BT,SAAS,UAAW,MAAM,OAAO;AACvC,SAAO,KAAK;AAEX,QAAI,OAAO,cAAc,KAAK;AAC7B;AAAA,aAEQ,OAAO,cAAc,KAAK,MAAM,KAAK,MAAM;AACnD;AAEF,SAAO,OAAO,MAAM,OAAO,WAAW,CAAC,IAAI,MAAM,KAAK,SAAS,KAAK,OAAO,KAAK,CAAC;AAClF;AAVgB;AAgBT,SAAS,WAAY,OAAO;AAClC,SAAO,CAAC,MAAM,KAAK,CAAC;AACnB,SAAK;AAEN,SAAO,MAAM,OAAO,QAAQ;AAC7B;AALgB;;;ACnPT,SAAS,QAAS,OAAO;AAC/B,SAAO,QAAQ,MAAM,IAAI,MAAM,MAAM,MAAM,CAAC,EAAE,GAAG,QAAQ,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AACtF;AAFgB;AAgBT,SAAS,MAAO,OAAO,MAAM,QAAQ,MAAM,OAAO,UAAU,QAAQ,QAAQ,cAAc;AAChG,MAAI,QAAQ;AACZ,MAAI,SAAS;AACb,MAAIC,UAAS;AACb,MAAI,SAAS;AACb,MAAI,WAAW;AACf,MAAI,WAAW;AACf,MAAI,WAAW;AACf,MAAI,WAAW;AACf,MAAI,YAAY;AAChB,MAAIC,aAAY;AAChB,MAAI,OAAO;AACX,MAAI,QAAQ;AACZ,MAAI,WAAW;AACf,MAAI,YAAY;AAChB,MAAIC,cAAa;AAEjB,SAAO;AACN,YAAQ,WAAWD,YAAWA,aAAY,KAAK,GAAG;AAAA;AAAA,MAEjD,KAAK;AACJ,YAAI,YAAY,OAAO,OAAOC,aAAYF,UAAS,CAAC,KAAK,IAAI;AAC5D,cAAI,QAAQE,eAAc,QAAQ,QAAQD,UAAS,GAAG,KAAK,KAAK,GAAG,OAAO,IAAI,QAAQ,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK;AAChH,wBAAY;AACb;AAAA,QACD;AAAA;AAAA,MAED,KAAK;AAAA,MAAI,KAAK;AAAA,MAAI,KAAK;AACtB,QAAAC,eAAc,QAAQD,UAAS;AAC/B;AAAA;AAAA,MAED,KAAK;AAAA,MAAG,KAAK;AAAA,MAAI,KAAK;AAAA,MAAI,KAAK;AAC9B,QAAAC,eAAc,WAAW,QAAQ;AACjC;AAAA;AAAA,MAED,KAAK;AACJ,QAAAA,eAAc,SAAS,MAAM,IAAI,GAAG,CAAC;AACrC;AAAA;AAAA,MAED,KAAK;AACJ,gBAAQ,KAAK,GAAG;AAAA,UACf,KAAK;AAAA,UAAI,KAAK;AACb,mBAAO,QAAQ,UAAU,KAAK,GAAG,MAAM,CAAC,GAAG,MAAM,QAAQ,YAAY,GAAG,YAAY;AACpF,iBAAK,MAAM,YAAY,CAAC,KAAK,KAAK,MAAM,KAAK,KAAK,CAAC,KAAK,MAAM,OAAOA,WAAU,KAAK,OAAOA,aAAY,IAAI,MAAM,MAAM,IAAK,CAAAA,eAAc;AAC1I;AAAA,UACD;AACC,YAAAA,eAAc;AAAA,QAChB;AACA;AAAA;AAAA,MAED,KAAK,MAAM;AACV,eAAO,OAAO,IAAI,OAAOA,WAAU,IAAI;AAAA;AAAA,MAExC,KAAK,MAAM;AAAA,MAAU,KAAK;AAAA,MAAI,KAAK;AAClC,gBAAQD,YAAW;AAAA;AAAA,UAElB,KAAK;AAAA,UAAG,KAAK;AAAK,uBAAW;AAAA;AAAA,UAE7B,KAAK,KAAK;AAAQ,gBAAI,aAAa,GAAI,CAAAC,cAAa,QAAQA,aAAY,OAAO,EAAE;AAChF,gBAAI,WAAW,MAAM,OAAOA,WAAU,IAAIF,WAAW,aAAa,KAAK,aAAa;AACnF,qBAAO,WAAW,KAAK,YAAYE,cAAa,KAAK,MAAM,QAAQF,UAAS,GAAG,YAAY,IAAI,YAAY,QAAQE,aAAY,KAAK,EAAE,IAAI,KAAK,MAAM,QAAQF,UAAS,GAAG,YAAY,GAAG,YAAY;AACrM;AAAA;AAAA,UAED,KAAK;AAAI,YAAAE,eAAc;AAAA;AAAA,UAEvB;AACC,mBAAO,YAAY,QAAQA,aAAY,MAAM,QAAQ,OAAO,QAAQ,OAAO,QAAQ,MAAM,QAAQ,CAAC,GAAG,WAAW,CAAC,GAAGF,SAAQ,QAAQ,GAAG,QAAQ;AAE/I,gBAAIC,eAAc;AACjB,kBAAI,WAAW;AACd,sBAAMC,aAAY,MAAM,WAAW,WAAW,OAAO,UAAUF,SAAQ,QAAQ,QAAQ;AAAA,mBACnF;AACJ,wBAAQ,QAAQ;AAAA;AAAA,kBAEf,KAAK;AACJ,wBAAI,OAAOE,aAAY,CAAC,MAAM,IAAK;AAAA;AAAA,kBAEpC,KAAK;AACJ,wBAAI,OAAOA,aAAY,CAAC,MAAM,GAAI;AAAA,kBACnC;AACC,6BAAS;AAAA;AAAA,kBAEV,KAAK;AAAA,kBAAK,KAAK;AAAA,kBAAK,KAAK;AAAA,gBAC1B;AACA,oBAAI,OAAQ,OAAM,OAAO,WAAW,WAAW,QAAQ,OAAO,QAAQ,OAAO,WAAW,WAAW,GAAG,GAAG,OAAO,QAAQ,MAAM,OAAO,QAAQ,CAAC,GAAGF,SAAQ,QAAQ,GAAG,QAAQ,GAAG,OAAO,UAAUA,SAAQ,QAAQ,OAAO,QAAQ,QAAQ;AAAA,oBAClO,OAAME,aAAY,WAAW,WAAW,WAAW,CAAC,EAAE,GAAG,UAAU,GAAG,QAAQ,QAAQ;AAAA,cAC5F;AAAA,QACH;AAEA,gBAAQ,SAAS,WAAW,GAAG,WAAW,YAAY,GAAG,OAAOA,cAAa,IAAIF,UAAS;AAC1F;AAAA;AAAA,MAED,KAAK;AACJ,QAAAA,UAAS,IAAI,OAAOE,WAAU,GAAG,WAAW;AAAA,MAC7C;AACC,YAAI,WAAW;AACd,cAAID,cAAa;AAChB,cAAE;AAAA,mBACMA,cAAa,OAAO,cAAc,KAAK,KAAK,KAAK;AACzD;AAAA;AAEF,gBAAQC,eAAc,KAAKD,UAAS,GAAGA,aAAY,UAAU;AAAA;AAAA,UAE5D,KAAK;AACJ,wBAAY,SAAS,IAAI,KAAKC,eAAc,MAAM;AAClD;AAAA;AAAA,UAED,KAAK;AACJ,mBAAO,OAAO,KAAK,OAAOA,WAAU,IAAI,KAAK,WAAW,YAAY;AACpE;AAAA;AAAA,UAED,KAAK;AAEJ,gBAAI,KAAK,MAAM;AACd,cAAAA,eAAc,QAAQ,KAAK,CAAC;AAE7B,qBAAS,KAAK,GAAG,SAASF,UAAS,OAAO,OAAOE,eAAc,WAAW,MAAM,CAAC,CAAC,GAAGD;AACrF;AAAA;AAAA,UAED,KAAK;AACJ,gBAAI,aAAa,MAAM,OAAOC,WAAU,KAAK;AAC5C,yBAAW;AAAA,QACd;AAAA,IACF;AAED,SAAO;AACR;AA9HgB;AA+IT,SAAS,QAAS,OAAO,MAAM,QAAQ,OAAO,QAAQ,OAAO,QAAQ,MAAM,OAAO,UAAUF,SAAQ,UAAU;AACpH,MAAI,OAAO,SAAS;AACpB,MAAI,OAAO,WAAW,IAAI,QAAQ,CAAC,EAAE;AACrC,MAAI,OAAO,OAAO,IAAI;AAEtB,WAAS,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,EAAE;AAC1C,aAAS,IAAI,GAAG,IAAI,OAAO,OAAO,OAAO,GAAG,OAAO,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,IAAI,MAAM,EAAE;AAC9F,UAAI,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,MAAM,IAAI,QAAQ,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC;AACnE,cAAM,GAAG,IAAI;AAEhB,SAAO,KAAK,OAAO,MAAM,QAAQ,WAAW,IAAI,UAAU,MAAM,OAAO,UAAUA,SAAQ,QAAQ;AAClG;AAXgB;AAoBT,SAAS,QAAS,OAAO,MAAM,QAAQ,UAAU;AACvD,SAAO,KAAK,OAAO,MAAM,QAAQ,SAAS,KAAK,KAAK,CAAC,GAAG,OAAO,OAAO,GAAG,EAAE,GAAG,GAAG,QAAQ;AAC1F;AAFgB;AAYT,SAAS,YAAa,OAAO,MAAM,QAAQA,SAAQ,UAAU;AACnE,SAAO,KAAK,OAAO,MAAM,QAAQ,aAAa,OAAO,OAAO,GAAGA,OAAM,GAAG,OAAO,OAAOA,UAAS,GAAG,EAAE,GAAGA,SAAQ,QAAQ;AACxH;AAFgB;;;AC/LT,SAAS,UAAW,UAAU,UAAU;AAC9C,MAAI,SAAS;AAEb,WAAS,IAAI,GAAG,IAAI,SAAS,QAAQ;AACpC,cAAU,SAAS,SAAS,CAAC,GAAG,GAAG,UAAU,QAAQ,KAAK;AAE3D,SAAO;AACR;AAPgB;AAgBT,SAAS,UAAW,SAAS,OAAO,UAAU,UAAU;AAC9D,UAAQ,QAAQ,MAAM;AAAA,IACrB,KAAK;AAAO,UAAI,QAAQ,SAAS,OAAQ;AAAA,IACzC,KAAK;AAAA,IAAQ,KAAK;AAAA,IAAW,KAAK;AAAa,aAAO,QAAQ,SAAS,QAAQ,UAAU,QAAQ;AAAA,IACjG,KAAK;AAAS,aAAO;AAAA,IACrB,KAAK;AAAW,aAAO,QAAQ,SAAS,QAAQ,QAAQ,MAAM,UAAU,QAAQ,UAAU,QAAQ,IAAI;AAAA,IACtG,KAAK;AAAS,UAAI,CAAC,OAAO,QAAQ,QAAQ,QAAQ,MAAM,KAAK,GAAG,CAAC,EAAG,QAAO;AAAA,EAC5E;AAEA,SAAO,OAAO,WAAW,UAAU,QAAQ,UAAU,QAAQ,CAAC,IAAI,QAAQ,SAAS,QAAQ,QAAQ,MAAM,WAAW,MAAM;AAC3H;AAVgB;;;ACdT,SAAS,WAAY,YAAY;AACvC,MAAIG,UAAS,OAAO,UAAU;AAE9B,SAAO,SAAU,SAAS,OAAO,UAAU,UAAU;AACpD,QAAI,SAAS;AAEb,aAAS,IAAI,GAAG,IAAIA,SAAQ;AAC3B,gBAAU,WAAW,CAAC,EAAE,SAAS,OAAO,UAAU,QAAQ,KAAK;AAEhE,WAAO;AAAA,EACR;AACD;AAXgB;;;ACQhB,IAAM,WAAW;AAQV,SAAS,mBAAmB,KAAgB,aAAqB;AACtE,MAAI,KAAK,QAAQ,QAAQ;AACzB,MAAI,gBAAgB,IAAI;AACtB,QAAI,KAAK,wBAAwB,WAAW;AAAA,EAC9C;AACF;AALgB;AAkBT,SAAS,2BACd,KACA,WACA,UACA,QACM;AACN,MAAI,IAAI,WAAW,QAAW;AAC5B;AAAA,EACF;AAEA,MAAI,UAAU;AACZ,UAAM,SAAS,cAAc,MAAM;AACnC,QAAI,KAAK,oBAAoB,MAAM;AACnC,QAAI,OAAO,QAAQ,cAAc,EAAE,KAAK,MAAM,MAAM,EAAE,KAAK,QAAQ;AAAA,EACrE;AACA,MAAI,WAAW;AACb,UAAM,UAAU,eAAe,MAAM;AACrC,QAAI,KAAK,mBAAmB,OAAO;AACnC,QAAI,OAAO,SAAS,cAAc,EAAE,KAAK,MAAM,OAAO,EAAE,KAAK,SAAS;AAAA,EACxE;AACF;AApBgB;;;AC7BT,IAAM,UAAN,MAAM,SAAQ;AAAA,EAgCX,YACC,MACA,MACA,IACA,QACAC,WACP;AALO;AACA;AACA;AACA;AACA,oBAAAA;AAAA,EACN;AAAA,EArDL,OAeqB;AAAA;AAAA;AAAA,EACnB,aAAoB,SAAS,MAAc,WAA2C,CAAC,GAAG;AACxF,UAAM,SAAmB,UAAU;AACnC,UAAM,OAAO,WAAW,MAAM,MAAM;AACpC,WAAO,eAAe,IAAI,IAAI;AAC9B,QAAI;AACF,iBAAW,IAAI;AAAA,IACjB,QAAQ;AACN,YAAMC,WAAS,iBAAiB,IAAI;AACpC,UAAI,CAACA,UAAQ;AACX,cAAM,IAAI,oBAAoB,WAAW,IAAI,aAAa;AAAA,MAC5D;AAGA,YAAM,EAAE,IAAAC,MAAI,SAAAC,SAAQ,IAAI,MAAMF,SAAO;AACrC,sBAAgBC,MAAIC,QAAO;AAAA,IAC7B;AACA,UAAM,EAAE,IAAI,QAAQ,UAAAH,WAAU,MAAAI,MAAK,IAAI,WAAW,IAAI;AACtD,QAAI,OAAO,QAAQ;AAEjB,aAAO,OAAO,KAAK;AAAA,IACrB;AACA,OAAG,QAAQ;AACX,IAAAA,QAAO,MAAM;AAEb,QAAI,SAAS,OAAO;AAClB,SAAG,kBAAkB,SAAS,KAAK;AAAA,IACrC;AACA,UAAM,OAAO,MAAM,IAAI;AACvB,WAAO,IAAI,SAAQ,MAAM,MAAM,IAAI,QAAQJ,SAAQ;AAAA,EACrD;AAAA,EAUA,MAAM,OAAOE,MAAY,SAAiB;AACxC,UAAM,KAAK,SAAS,KAAK,KAAK,MAAMA,MAAI,SAAS,IAAI;AAAA,EACvD;AAAA,EAEA,YAAY;AACV,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,UAAU;AACR,WAAO,KAAK;AAAA,EACd;AACF;;;AClEA,IAAI,uBAAuC,CAAC;AAIrC,IAAM,kBAAkB,6BAAM;AACnC,uBAAqB,QAAQ,CAAC,MAAM;AAClC,MAAE;AAAA,EACJ,CAAC;AACD,yBAAuB,CAAC;AAC1B,GAL+B;;;ACCxB,IAAM,kBAAkB,wBAAC,SAAyB;AACvD,SAAO,KAAK,QAAQ,0BAA0B,EAAE,EAAE,UAAU;AAC9D,GAF+B;;;ACkBxB,SAAS,mBAAmB,MAAiC;AAClE,QAAM,UAAU,KAAK,MAAM,gBAAgB;AAC3C,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,MACL;AAAA,MACA,UAAU,CAAC;AAAA,IACb;AAAA,EACF;AAEA,MAAI,SACG,KAAK,QAAQ,CAAC,GAAG;AAAA;AAAA;AAAA,IAGpB,QAAa;AAAA,EACf,CAAC,KAAK,CAAC;AAGT,WAAS,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC;AAE1E,QAAM,WAAgC,CAAC;AAGvC,MAAI,OAAO,aAAa;AACtB,aAAS,cAAc,OAAO,YAAY,SAAS;AAAA,EACrD;AACA,MAAI,OAAO,OAAO;AAChB,aAAS,QAAQ,OAAO,MAAM,SAAS;AAAA,EACzC;AACA,MAAI,OAAO,QAAQ;AACjB,aAAS,SAAS,OAAO;AAAA,EAC3B;AAEA,SAAO;AAAA,IACL,MAAM,KAAK,MAAM,QAAQ,CAAC,EAAE,MAAM;AAAA,IAClC;AAAA,EACF;AACF;AApCgB;;;AClBhB,IAAM,cAAc,wBAAC,SAAiB;AACpC,SACE,KAEG,QAAQ,UAAU,IAAI,EAEtB;AAAA,IACC;AAAA,IACA,CAACG,QAAO,KAAK,eAAe,MAAM,MAAM,WAAW,QAAQ,eAAe,OAAO,IAAI;AAAA,EACvF;AAEN,GAXoB;AAapB,IAAM,qBAAqB,wBAAC,SAAiB;AAC3C,QAAM,EAAE,MAAM,SAAS,IAAI,mBAAmB,IAAI;AAClD,QAAM,EAAE,aAAa,OAAO,SAAS,CAAC,EAAE,IAAI;AAC5C,MAAI,aAAa;AAEf,QAAI,CAAC,OAAO,OAAO;AACjB,aAAO,QAAQ,CAAC;AAAA,IAClB;AACA,WAAO,MAAM,cAAc;AAAA,EAC7B;AAEA,SAAO,EAAE,OAAO,QAAQ,KAAK;AAC/B,GAZ2B;AAc3B,IAAM,oBAAoB,wBAAC,SAAiB;AAC1C,QAAM,gBAAgB,cAAM,WAAW,IAAI,KAAK,CAAC;AACjD,QAAM,iBAAiB,cAAM,gBAAgB,MAAM,MAAM;AACzD,MAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,kBAAc,OAAO,eAAe,KAAK,CAAC,EAAE,KAAK,MAAM,SAAS,MAAM;AAAA,EACxE,WAAW,gBAAgB,SAAS,QAAQ;AAC1C,kBAAc,OAAO;AAAA,EACvB;AACA,SAAO;AAAA,IACL,MAAM,iBAAiB,IAAI;AAAA,IAC3B,WAAW;AAAA,EACb;AACF,GAZ0B;AAoBnB,SAAS,kBAAkB,MAAc;AAC9C,QAAM,cAAc,YAAY,IAAI;AACpC,QAAM,oBAAoB,mBAAmB,WAAW;AACxD,QAAM,kBAAkB,kBAAkB,kBAAkB,IAAI;AAChE,QAAM,SAAS,cAAc,kBAAkB,QAAQ,gBAAgB,SAAS;AAChF,SAAO,gBAAgB,gBAAgB,IAAI;AAC3C,SAAO;AAAA,IACL;AAAA,IACA,OAAO,kBAAkB;AAAA,IACzB;AAAA,EACF;AACF;AAXgB;;;ACpDT,SAAS,SAAS,KAAa;AAEpC,QAAM,YAAY,IAAI,YAAY,EAAE,OAAO,GAAG;AAC9C,QAAM,UAAU,MAAM,KAAK,WAAW,CAAC,SAAS,OAAO,cAAc,IAAI,CAAC,EAAE,KAAK,EAAE;AACnF,SAAO,KAAK,OAAO;AACrB;AALgB;;;AC8ChB,IAAM,iBAAiB;AACvB,IAAM,8BACJ;AAEF,IAAM,uBAAuB;AAC7B,IAAM,qBAAqB;AAE3B,IAAM,gBAAgB;AACtB,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AAIxB,IAAM,eAAe;AACrB,IAAM,gBAAgB;AACtB,IAAM,gBAAgB;AACtB,IAAM,oBAAoB;AAC1B,IAAM,sBAAsB;AAC5B,IAAM,2BAA2B;AAGjC,IAAM,iBAAiB,CAAC,eAAe;AACvC,IAAM,iBAAiB,CAAC,mBAAmB;AAE3C,SAAS,qBAAqB,MAAc;AAC1C,QAAM,YAAY,kBAAkB,IAAI;AACxC,EAAU,MAAM;AAChB,EAAU,aAAa,UAAU,UAAU,CAAC,CAAC;AAC7C,SAAO;AACT;AALS;AAmBT,eAAeC,OAAM,MAAc,cAA2D;AAC5F,cAAY;AACZ,MAAI;AACF,UAAM,EAAE,MAAM,OAAO,IAAI,qBAAqB,IAAI;AAClD,UAAMC,WAAU,MAAM,mBAAmB,IAAI;AAC7C,WAAO,EAAE,aAAaA,SAAQ,MAAM,OAAO;AAAA,EAC7C,SAAS,OAAO;AACd,QAAI,cAAc,gBAAgB;AAChC,aAAO;AAAA,IACT;AACA,UAAM;AAAA,EACR;AACF;AAZe,OAAAD,QAAA;AAsBR,IAAM,qBAAqB,wBAChC,UACA,SACA,aAAuB,CAAC,MACb;AACX,QAAM,mBAAmB,YAAY,KAAK,WAAW,KAAK,eAAe,CAAC,gBAAgB;AAC1F,SAAO,IAAI,QAAQ,IAAI,OAAO,IAAI,gBAAgB;AACpD,GAPkC;AAgB3B,IAAM,kBAAkB,wBAC7B,QACA,YAAkE,oBAAI,IAAI,MAC/D;AACX,QAAM,YAAY,IAAI,cAAc;AAKpC,MAAI,OAAO,eAAe,QAAW;AACnC,cAAU;AAAA,MACR,kCAAkC,OAAO,UAAU;AAAA,MACnD,UAAU,SAAS;AAAA,IACrB;AAAA,EACF;AACA,MAAI,OAAO,kBAAkB,QAAW;AACtC,cAAU;AAAA,MACR,sCAAsC,OAAO,aAAa;AAAA,MAC1D,UAAU,SAAS;AAAA,IACrB;AAAA,EACF;AAGA,MAAI,qBAAqB,KAAK;AAC5B,UAAM,aAAa,uBAAuB,MAAM;AAEhD,UAAM,kBAAkB,CAAC,OAAO,MAAM;AACtC,UAAM,mBAAmB,CAAC,QAAQ,WAAW,WAAW,UAAU,MAAM;AAExE,UAAM,cAAc,aAAa,kBAAkB;AAGnD,cAAU,QAAQ,CAAC,kBAAkB;AAEnC,UAAI,CAAC,QAAQ,cAAc,MAAM,GAAG;AAClC,oBAAY,QAAQ,CAAC,eAAe;AAClC,oBAAU;AAAA,YACR,mBAAmB,cAAc,IAAI,YAAY,cAAc,MAAM;AAAA,YACrE,UAAU,SAAS;AAAA,UACrB;AAAA,QACF,CAAC;AAAA,MACH;AAEA,UAAI,CAAC,QAAQ,cAAc,UAAU,GAAG;AACtC,kBAAU;AAAA,UACR;AAAA,YACE,cAAc;AAAA,YACd;AAAA,aACC,eAAe,cAAc,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,SAAS,MAAM,CAAC;AAAA,UACzE;AAAA,UACA,UAAU,SAAS;AAAA,QACrB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,YAAY;AAChB,MAAI,OAAO,aAAa,QAAW;AACjC,QAAI,OAAO,UAAU,gBAAgB,YAAY;AAC/C,YAAM,qBAAqB,IAAI,cAAc;AAC7C,yBAAmB,YAAY,OAAO,QAAQ;AAC9C,kBAAY,sBAAsB,kBAAkB,IAAI;AAAA,IAC1D,OAAO;AAKL,mBAAa,GAAG,OAAO,QAAQ;AAAA;AAAA,IACjC;AAAA,EACF;AAEA,SAAO,YAAY,sBAAsB,SAAS;AACpD,GAxE+B;AA0F/B,IAAM,aAAa,wBAAC,WAAyB,QAAgB;AAC3D,SAAO;AAAA,IACL,QAAQ,GAAG,SAAS,IAAI,GAAG,GAAG;AAAA,IAC9B,WAAW;AAAA,MACT,gCAAS,aAAa,SAAS,QAAQ,WAAW,WAAW;AAW3D,YAAI,QAAQ,SAAS,UAAU,MAAM,QAAQ,QAAQ,KAAK,GAAG;AAC3D,cAAI,QAAQ,UAAU,QAAQ,OAAO,SAAS,WAAW;AAIvD;AAAA,UACF;AACA,kBAAQ,QAAQ,QAAQ,MAAM,IAAI,CAAC,SAAS;AAC1C,gBAAI,CAAC,KAAK,WAAW,SAAS,GAAG;AAC/B,qBAAO,GAAG,SAAS,IAAI,IAAI;AAAA,YAC7B;AACA,mBAAO;AAAA,UACT,CAAC;AAAA,QACH,WAAW,QAAQ,KAAK,WAAW,GAAG,GAAG;AAYvC,gBAAM,gBAAgB;AAAA,YACpB;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACF;AACA,gBAAM,iBAAiB;AAAA,YACrB,GAAG;AAAA,YACH;AAAA;AAAA,UACF;AACA,cAAI,CAAC,eAAe,SAAS,QAAQ,IAAuC,GAAG;AAC7E,gBAAI,KAAK,gCAAgC,QAAQ,IAAI,WAAW;AAChE,oBAAQ,OAAO;AAAA,UACjB;AAAA,QACF;AAAA,MACF,GArDA;AAAA,MAsDA;AAAA,IACF,CAAC;AAAA,EACH;AACF,GA7DmB;AA+DZ,IAAM,mBAAmB,wBAC9B,QACA,WACA,WAEA,UACW;AACX,QAAM,gBAAgB,gBAAgB,QAAQ,SAAS;AACvD,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,IACA,EAAE,GAAG,OAAO,gBAAgB,OAAO,OAAO,OAAO,MAAM,OAAO,KAAK;AAAA,IACnE;AAAA,EACF;AACA,SAAO,WAAW,OAAO,SAAS;AACpC,GAfgC;AAyBzB,IAAM,iBAAiB,wBAC5B,UAAU,IACV,eACA,uBACW;AACX,MAAI,eAAe;AAGnB,MAAI,CAAC,sBAAsB,CAAC,eAAe;AACzC,mBAAe,aAAa;AAAA,MAC1B;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,iBAAe,eAAe,YAAY;AAG1C,iBAAe,aAAa,QAAQ,SAAS,OAAO;AAEpD,SAAO;AACT,GArB8B;AA8BvB,IAAM,gBAAgB,wBAAC,UAAU,IAAI,eAAuC;AACjF,QAAM,SAAS,YAAY,SAAS,SAAS,SACzC,WAAW,QAAQ,QAAQ,SAAS,OACpC;AACJ,QAAM,mBAAmB,SAAS,gBAAgB,iBAAiB,KAAK,OAAO,SAAS;AACxF,SAAO,wBAAwB,YAAY,WAAW,MAAM,IAAI,aAAa,8CAA8C,gBAAgB,cAAc,mBAAmB;AAAA,IAC1K,wBAAwB;AAAA;AAE5B,GAR6B;AAuBtB,IAAM,gBAAgB,wBAC3B,YACAE,MACA,gBACA,UACA,aACG;AACH,QAAM,eAAe,WAAW,OAAO,KAAK;AAC5C,eAAa,KAAK,MAAM,cAAc;AACtC,MAAI,UAAU;AACZ,iBAAa,KAAK,SAAS,QAAQ;AAAA,EACrC;AAEA,QAAM,UAAU,aACb,OAAO,KAAK,EACZ,KAAK,MAAMA,IAAE,EACb,KAAK,SAAS,MAAM,EACpB,KAAK,SAAS,aAAa;AAC9B,MAAI,UAAU;AACZ,YAAQ,KAAK,eAAe,QAAQ;AAAA,EACtC;AAEA,UAAQ,OAAO,GAAG;AAClB,SAAO;AACT,GAxB6B;AAkC7B,SAAS,gBACP,YACA,UACA;AACA,SAAO,WACJ,OAAO,QAAQ,EACf,KAAK,MAAM,QAAQ,EACnB,KAAK,SAAS,4BAA4B,EAC1C,KAAK,WAAW,EAAE;AACvB;AATS;AAmBF,IAAM,yBAAyB,wBACpC,KACAA,MACA,OACA,aACG;AAEH,MAAI,eAAeA,IAAE,GAAG,OAAO;AAG/B,MAAI,eAAe,KAAK,GAAG,OAAO;AAClC,MAAI,eAAe,QAAQ,GAAG,OAAO;AACvC,GAZsC;AAoBtC,IAAM,SAAS,sCACbA,MACA,MACA,sBACuB;AACvB,cAAY;AAEZ,QAAM,YAAY,qBAAqB,IAAI;AAC3C,SAAO,UAAU;AAEjB,QAAM,SAAmB,UAAU;AACnC,MAAI,MAAM,MAAM;AAGhB,MAAI,KAAK,UAAU,QAAQ,eAAe,iBAAiB;AACzD,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,IAAIA,IAAE;AACzB,QAAM,WAAW,MAAMA;AACvB,QAAM,oBAAoB,MAAM;AAChC,QAAM,iBAAiB,MAAMA;AAC7B,QAAM,0BAA0B,MAAM;AAEtC,QAAM,qBAAqB,6BAAM;AAG/B,UAAM,qBAAqB,cAAc,oBAAoB;AAC7D,UAAMC,QAAO,eAAO,kBAAkB,EAAE,KAAK;AAC7C,QAAIA,SAAQ,YAAYA,OAAM;AAC5B,MAAAA,MAAK,OAAO;AAAA,IACd;AAAA,EACF,GAR2B;AAU3B,MAAI,OAAgE,eAAO,SAAS,IAAI;AAExF,QAAM,cAAc,OAAO,kBAAkB;AAC7C,QAAM,uBAAuB,OAAO,kBAAkB;AAEtD,QAAM,aAAa,OAAO;AAM1B,MAAI,yBAAyB,QAAW;AACtC,QAAI,sBAAsB;AACxB,2BAAqB,YAAY;AAAA,IACnC;AAEA,QAAI,aAAa;AAEf,YAAM,SAAS,gBAAgB,eAAO,oBAAoB,GAAG,QAAQ;AACrE,aAAO,eAAO,OAAO,MAAM,EAAE,CAAC,EAAE,gBAAiB,IAAI;AACrD,WAAK,KAAK,EAAG,MAAM,SAAS;AAAA,IAC9B,OAAO;AACL,aAAO,eAAO,oBAAoB;AAAA,IACpC;AACA,kBAAc,MAAMD,MAAI,gBAAgB,gBAAgB,UAAU,IAAI,eAAe;AAAA,EACvF,OAAO;AAIL,2BAAuB,UAAUA,MAAI,gBAAgB,QAAQ;AAK7D,QAAI,aAAa;AAEf,YAAM,SAAS,gBAAgB,eAAO,SAAS,IAAI,GAAG,QAAQ;AAC9D,aAAO,eAAO,OAAO,MAAM,EAAE,CAAC,EAAE,gBAAiB,IAAI;AACrD,WAAK,KAAK,EAAG,MAAM,SAAS;AAAA,IAC9B,OAAO;AACL,aAAO,eAAO,MAAM;AAAA,IACtB;AAEA,kBAAc,MAAMA,MAAI,cAAc;AAAA,EACxC;AAMA,MAAI;AACJ,MAAI;AAEJ,MAAI;AACF,WAAO,MAAM,QAAQ,SAAS,MAAM,EAAE,OAAO,UAAU,MAAM,CAAC;AAAA,EAChE,SAAS,OAAO;AACd,QAAI,OAAO,wBAAwB;AACjC,yBAAmB;AACnB,YAAM;AAAA,IACR;AACA,WAAO,MAAM,QAAQ,SAAS,OAAO;AACrC,gCAA4B;AAAA,EAC9B;AAGA,QAAM,UAAU,KAAK,OAAuB,uBAAuB,EAAE,KAAK;AAC1E,QAAM,cAAc,KAAK;AAMzB,QAAM,MAAM,QAAQ;AACpB,QAAM,aAAa,IAAI;AACvB,QAAM,mBAAmB,KAAK,SAAS,aAAa,MAAM,IAAI;AAE9D,QAAM,QAAQ,iBAAiB,QAAQ,aAAa,kBAAkB,UAAU;AAEhF,QAAM,SAAS,SAAS,cAAc,OAAO;AAC7C,SAAO,YAAY;AACnB,MAAI,aAAa,QAAQ,UAAU;AAInC,MAAI;AACF,UAAM,KAAK,SAAS,KAAK,MAAMA,MAAI,WAAkB,IAAI;AAAA,EAC3D,SAAS,GAAG;AACV,QAAI,OAAO,wBAAwB;AACjC,yBAAmB;AAAA,IACrB,OAAO;AACL,4BAAc,KAAK,MAAMA,MAAI,SAAgB;AAAA,IAC/C;AACA,UAAM;AAAA,EACR;AAGA,QAAM,UAAU,KAAK,OAAsB,GAAG,uBAAuB,MAAM;AAC3E,QAAM,YAAgC,KAAK,GAAG,cAAc;AAC5D,QAAM,YAAgC,KAAK,GAAG,oBAAoB;AAClE,cAAY,aAAa,SAAS,WAAW,SAAS;AAGtD,OAAK,OAAO,QAAQA,IAAE,IAAI,EAAE,UAAU,mBAAmB,EAAE,KAAK,SAAS,eAAe;AAGxF,MAAI,UAAkB,KAAK,OAAuB,uBAAuB,EAAE,KAAK,EAAG;AAEnF,MAAI,MAAM,8BAA8B,OAAO,mBAAmB;AAClE,YAAU,eAAe,SAAS,aAAa,SAAS,OAAO,mBAAmB,CAAC;AAEnF,MAAI,aAAa;AACf,UAAM,QAAQ,KAAK,OAAsB,0BAA0B,MAAM,EAAE,KAAK;AAChF,cAAU,cAAc,SAAS,KAAK;AAAA,EACxC,WAAW,CAAC,sBAAsB;AAEhC,cAAU,OAAU,SAAS,SAAS;AAAA,MACpC,UAAU;AAAA,MACV,UAAU;AAAA,MACV,yBAAyB,EAAE,eAAe,KAAK;AAAA,IACjD,CAAC;AAAA,EACH;AAEA,kBAAgB;AAEhB,MAAI,2BAA2B;AAC7B,UAAM;AAAA,EACR;AAEA,qBAAmB;AAEnB,SAAO;AAAA,IACL;AAAA,IACA,KAAK;AAAA,IACL,eAAe,KAAK,GAAG;AAAA,EACzB;AACF,GAzKe;AA8Kf,SAAS,WAAW,cAA6B,CAAC,GAAG;AACnD,QAAM,UAAyB,wBAAgB,CAAC,GAAG,WAAW;AAE9D,MAAI,SAAS,cAAc,CAAC,QAAQ,gBAAgB,YAAY;AAC9D,QAAI,CAAC,QAAQ,gBAAgB;AAC3B,cAAQ,iBAAiB,CAAC;AAAA,IAC5B;AACA,YAAQ,eAAe,aAAa,QAAQ;AAAA,EAC9C;AAGA,EAAU,yBAAyB,OAAO;AAE1C,MAAI,SAAS,SAAS,QAAQ,SAAS,gBAAO;AAE5C,YAAQ,iBAAiB,eAAM,QAAQ,KAA2B,EAAE;AAAA,MAClE,QAAQ;AAAA,IACV;AAAA,EACF,WAAW,SAAS;AAClB,YAAQ,iBAAiB,eAAM,QAAQ,kBAAkB,QAAQ,cAAc;AAAA,EACjF;AAEA,QAAM,SACJ,OAAO,YAAY,WAAqB,cAAc,OAAO,IAAc,cAAc;AAE3F,cAAY,OAAO,QAAQ;AAC3B,cAAY;AACd;AA3BS;AA6BT,IAAM,qBAAqB,wBAAC,MAAc,WAA2C,CAAC,MAAM;AAC1F,QAAM,EAAE,KAAK,IAAI,kBAAkB,IAAI;AACvC,SAAO,QAAQ,SAAS,MAAM,QAAQ;AACxC,GAH2B;AAa3B,SAAS,YACP,aACA,SACA,WACA,WACM;AACN,qBAAmB,SAAS,WAAW;AACvC,6BAA2B,SAAS,WAAW,WAAW,QAAQ,KAAK,IAAI,CAAC;AAC9E;AARS;AAaF,IAAM,aAAa,OAAO,OAAO;AAAA,EACtC;AAAA,EACA,OAAAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,6BAAM;AACX,IAAU,MAAM;AAAA,EAClB,GAFO;AAAA,EAGP,aAAa,6BAAM;AACjB,IAAU,MAAgB,aAAa;AAAA,EACzC,GAFa;AAAA,EAGb;AACF,CAAC;AAED,YAAsB,UAAU,EAAE,QAAQ;AAChC,MAAgB,UAAU,CAAC;;;ACxmBrC,IAAM,cAAc,wBAAC,OAAgB,QAAyB,eAAoC;AAChG,MAAI,KAAK,KAAK;AACd,MAAI,gBAAgB,KAAK,GAAG;AAG1B,QAAI,YAAY;AACd,iBAAW,MAAM,KAAK,MAAM,IAAI;AAAA,IAClC;AACA,WAAO,KAAK,EAAE,GAAG,OAAO,SAAS,MAAM,KAAK,MAAM,CAAC;AAAA,EACrD,OAAO;AAEL,QAAI,YAAY;AACd,iBAAW,KAAK;AAAA,IAClB;AACA,QAAI,iBAAiB,OAAO;AAC1B,aAAO,KAAK;AAAA,QACV,KAAK,MAAM;AAAA,QACX,SAAS,MAAM;AAAA,QACf,MAAM,MAAM;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF,GAvBoB;AA6CpB,IAAM,MAAM,sCACV,UAAsB;AAAA,EACpB,eAAe;AACjB,GACA;AACA,MAAI;AACF,UAAM,gBAAgB,OAAO;AAAA,EAC/B,SAAS,GAAG;AACV,QAAI,gBAAgB,CAAC,GAAG;AACtB,UAAI,MAAM,EAAE,GAAG;AAAA,IACjB;AACA,QAAI,QAAQ,YAAY;AACtB,cAAQ,WAAW,CAAW;AAAA,IAChC;AACA,QAAI,CAAC,QAAQ,gBAAgB;AAC3B,UAAI,MAAM,wDAAwD;AAClE,YAAM;AAAA,IACR;AAAA,EACF;AACF,GAnBY;AAqBZ,IAAM,kBAAkB,sCACtB,EAAE,oBAAoB,eAAe,MAAM,IAAwC;AAAA,EACjF,eAAe;AACjB,GACA;AACA,QAAM,OAAO,WAAW,UAAU;AAElC,MAAI,MAAM,GAAG,CAAC,qBAAqB,QAAQ,EAAE,yBAAyB;AAEtE,MAAI;AACJ,MAAI,OAAO;AACT,qBAAiB;AAAA,EACnB,WAAW,eAAe;AACxB,qBAAiB,SAAS,iBAAiB,aAAa;AAAA,EAC1D,OAAO;AACL,UAAM,IAAI,MAAM,4CAA4C;AAAA,EAC9D;AAEA,MAAI,MAAM,SAAS,eAAe,MAAM,WAAW;AACnD,MAAI,MAAM,gBAAgB,QAAW;AACnC,QAAI,MAAM,oBAAoB,MAAM,WAAW;AAC/C,eAAW,iBAAiB,EAAE,aAAa,MAAM,YAAY,CAAC;AAAA,EAChE;AAGA,QAAM,cAAc,IAAI,cAAM,gBAAgB,KAAK,kBAAkB,KAAK,mBAAmB;AAE7F,MAAI;AACJ,QAAM,SAA0B,CAAC;AAIjC,aAAW,WAAW,MAAM,KAAK,cAAc,GAAG;AAChD,QAAI,KAAK,wBAAwB,QAAQ,EAAE;AAE3C,QAAI,QAAQ,aAAa,gBAAgB,GAAG;AAC1C;AAAA,IACF;AACA,YAAQ,aAAa,kBAAkB,MAAM;AAE7C,UAAMI,OAAK,WAAW,YAAY,KAAK,CAAC;AAGxC,UAAM,QAAQ;AAGd,UAAM,OAAO,cAAM,aAAa,GAAG,CAAC,EACjC,KAAK,EACL,QAAQ,gBAAgB,OAAO;AAElC,UAAMC,QAAO,cAAM,WAAW,GAAG;AACjC,QAAIA,OAAM;AACR,UAAI,MAAM,2BAA2BA,KAAI;AAAA,IAC3C;AACA,QAAI;AACF,YAAM,EAAE,KAAK,cAAc,IAAI,MAAMC,QAAOF,MAAI,KAAK,OAAO;AAC5D,cAAQ,YAAY;AACpB,UAAI,oBAAoB;AACtB,cAAM,mBAAmBA,IAAE;AAAA,MAC7B;AACA,UAAI,eAAe;AACjB,sBAAc,OAAO;AAAA,MACvB;AAAA,IACF,SAAS,OAAO;AACd,kBAAY,OAAO,QAAQ,QAAQ,UAAU;AAAA,IAC/C;AAAA,EACF;AACA,MAAI,OAAO,SAAS,GAAG;AAErB,UAAM,OAAO,CAAC;AAAA,EAChB;AACF,GAvEwB;AA+ExB,IAAMG,cAAa,gCAAU,QAAuB;AAClD,aAAW,WAAW,MAAM;AAC9B,GAFmB;AAkBnB,IAAM,OAAO,sCACX,QACA,OACA,UACA;AACA,MAAI,KAAK,qDAAqD;AAC9D,MAAI,QAAQ;AACV,IAAAA,YAAW,MAAM;AAAA,EACnB;AACA,QAAM,aAAyB,EAAE,oBAAoB,UAAU,eAAe,WAAW;AACzF,MAAI,OAAO,UAAU,UAAU;AAC7B,eAAW,gBAAgB;AAAA,EAC7B,WAAW,OAAO;AAChB,QAAI,iBAAiB,aAAa;AAChC,iBAAW,QAAQ,CAAC,KAAK;AAAA,IAC3B,OAAO;AACL,iBAAW,QAAQ;AAAA,IACrB;AAAA,EACF;AACA,QAAM,IAAI,UAAU;AACtB,GApBa;AA2Bb,IAAM,2BAA2B,8BAC/B,UACA;AAAA,EACE,WAAW;AACb,IAEI,CAAC,MACF;AACH,cAAY;AACZ,6BAA2B,GAAG,QAAQ;AACtC,MAAI,aAAa,OAAO;AACtB,UAAM,uBAAuB;AAAA,EAC/B;AACF,GAbiC;AAoBjC,IAAM,gBAAgB,kCAAY;AAChC,MAAI,QAAQ,aAAa;AACvB,UAAM,EAAE,YAAY,IAAI,WAAW,UAAU;AAC7C,QAAI,aAAa;AACf,cAAQ,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,MAAM,gCAAgC,GAAG,CAAC;AAAA,IAC7E;AAAA,EACF;AACF,GAPsB;AAStB,IAAI,OAAO,aAAa,aAAa;AAInC,SAAO,iBAAiB,QAAQ,eAAe,KAAK;AACtD;AAgBA,IAAM,uBAAuB,gCAAU,mBAAkD;AACvF,UAAQ,aAAa;AACvB,GAF6B;AAI7B,IAAM,iBAA6C,CAAC;AACpD,IAAI,wBAAwB;AAC5B,IAAM,eAAe,mCAAY;AAC/B,MAAI,uBAAuB;AACzB;AAAA,EACF;AACA,0BAAwB;AACxB,SAAO,eAAe,SAAS,GAAG;AAChC,UAAM,IAAI,eAAe,MAAM;AAC/B,QAAI,GAAG;AACL,UAAI;AACF,cAAM,EAAE;AAAA,MACV,SAAS,GAAG;AACV,YAAI,MAAM,yBAAyB,CAAC;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AACA,0BAAwB;AAC1B,GAhBqB;AAqCrB,IAAMC,SAAiC,8BAAO,MAAM,iBAAiB;AACnE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAGtC,UAAM,cAAc,6BAClB,IAAI,QAAQ,CAAC,KAAK,QAAQ;AACxB,iBAAW,MAAM,MAAM,YAAY,EAAE;AAAA,QACnC,CAAC,MAAM;AAEL,cAAI,CAAC;AAEL,kBAAQ,CAAC;AAAA,QACX;AAAA,QACA,CAAC,MAAM;AACL,cAAI,MAAM,iBAAiB,CAAC;AAC5B,kBAAQ,aAAa,CAAC;AACtB,cAAI,CAAC;AACL,iBAAO,CAAC;AAAA,QACV;AAAA,MACF;AAAA,IACF,CAAC,GAhBiB;AAiBpB,mBAAe,KAAK,WAAW;AAC/B,iBAAa,EAAE,MAAM,MAAM;AAAA,EAC7B,CAAC;AACH,GAxBuC;AAiDvC,IAAMF,UAAmC,wBAACF,MAAI,MAAM,cAAc;AAChE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AAGtC,UAAM,cAAc,6BAClB,IAAI,QAAQ,CAAC,KAAK,QAAQ;AACxB,iBAAW,OAAOA,MAAI,MAAM,SAAS,EAAE;AAAA,QACrC,CAAC,MAAM;AAEL,cAAI,CAAC;AAEL,kBAAQ,CAAC;AAAA,QACX;AAAA,QACA,CAAC,MAAM;AACL,cAAI,MAAM,iBAAiB,CAAC;AAC5B,kBAAQ,aAAa,CAAC;AACtB,cAAI,CAAC;AACL,iBAAO,CAAC;AAAA,QACV;AAAA,MACF;AAAA,IACF,CAAC,GAhBiB;AAiBpB,mBAAe,KAAK,WAAW;AAC/B,iBAAa,EAAE,MAAM,MAAM;AAAA,EAC7B,CAAC;AACH,GAxByC;AA+BzC,IAAM,gCAAgC,6BAA+C;AACnF,SAAO,OAAO,KAAK,SAAS,EAAE,IAAI,CAACA,UAAQ;AAAA,IACzC,IAAAA;AAAA,EACF,EAAE;AACJ,GAJsC;AA+BtC,IAAM,UAAmB;AAAA,EACvB,aAAa;AAAA,EACb;AAAA,EACA,OAAAI;AAAA,EACA,QAAAF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAAC;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAO,kBAAQ;", + "names": ["diagram", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "id", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "detector_default", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "id", "detector", "loader", "diagram", "id", "detector", "loader", "diagram", "plugin", "detector_default", "detector", "loader", "diagram", "id", "position", "length", "length", "character", "characters", "length", "renderer", "loader", "id", "diagram", "init", "match", "parse", "diagram", "id", "node", "id", "init", "render", "initialize", "parse"] +} diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.js b/tools/ui/node_modules/mermaid/dist/mermaid.js new file mode 100644 index 0000000000000000000000000000000000000000..785a42701c432f99e4b0f496bae18b89a4f3da02 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.js @@ -0,0 +1,178186 @@ +"use strict"; +var __esbuild_esm_mermaid_nm; +(__esbuild_esm_mermaid_nm ||= {}).mermaid = (() => { + var __create = Object.create; + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __getProtoOf = Object.getPrototypeOf; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __name = (target, value2) => __defProp(target, "name", { value: value2, configurable: true }); + var __esm = (fn3, res) => function __init() { + return fn3 && (res = (0, fn3[__getOwnPropNames(fn3)[0]])(fn3 = 0)), res; + }; + var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + }; + var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps = (to, from2, except, desc) => { + if (from2 && typeof from2 === "object" || typeof from2 === "function") { + for (let key of __getOwnPropNames(from2)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable }); + } + return to; + }; + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/defaults.js + var defaultIconDimensions, defaultIconTransformations, defaultIconProps, defaultExtendedIconProps; + var init_defaults = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/defaults.js"() { + "use strict"; + defaultIconDimensions = Object.freeze({ + left: 0, + top: 0, + width: 16, + height: 16 + }); + defaultIconTransformations = Object.freeze({ + rotate: 0, + vFlip: false, + hFlip: false + }); + defaultIconProps = Object.freeze({ + ...defaultIconDimensions, + ...defaultIconTransformations + }); + defaultExtendedIconProps = Object.freeze({ + ...defaultIconProps, + body: "", + hidden: false + }); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/customisations/defaults.js + var defaultIconSizeCustomisations, defaultIconCustomisations; + var init_defaults2 = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/customisations/defaults.js"() { + "use strict"; + init_defaults(); + defaultIconSizeCustomisations = Object.freeze({ + width: null, + height: null + }); + defaultIconCustomisations = Object.freeze({ + ...defaultIconSizeCustomisations, + ...defaultIconTransformations + }); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/name.js + var stringToIcon, validateIconName; + var init_name = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/name.js"() { + "use strict"; + stringToIcon = /* @__PURE__ */ __name((value2, validate, allowSimpleName, provider = "") => { + const colonSeparated = value2.split(":"); + if (value2.slice(0, 1) === "@") { + if (colonSeparated.length < 2 || colonSeparated.length > 3) return null; + provider = colonSeparated.shift().slice(1); + } + if (colonSeparated.length > 3 || !colonSeparated.length) return null; + if (colonSeparated.length > 1) { + const name$1 = colonSeparated.pop(); + const prefix = colonSeparated.pop(); + const result = { + provider: colonSeparated.length > 0 ? colonSeparated[0] : provider, + prefix, + name: name$1 + }; + return validate && !validateIconName(result) ? null : result; + } + const name = colonSeparated[0]; + const dashSeparated = name.split("-"); + if (dashSeparated.length > 1) { + const result = { + provider, + prefix: dashSeparated.shift(), + name: dashSeparated.join("-") + }; + return validate && !validateIconName(result) ? null : result; + } + if (allowSimpleName && provider === "") { + const result = { + provider, + prefix: "", + name + }; + return validate && !validateIconName(result, allowSimpleName) ? null : result; + } + return null; + }, "stringToIcon"); + validateIconName = /* @__PURE__ */ __name((icon2, allowSimpleName) => { + if (!icon2) return false; + return !!((allowSimpleName && icon2.prefix === "" || !!icon2.prefix) && !!icon2.name); + }, "validateIconName"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/transformations.js + function mergeIconTransformations(obj1, obj2) { + const result = {}; + if (!obj1.hFlip !== !obj2.hFlip) result.hFlip = true; + if (!obj1.vFlip !== !obj2.vFlip) result.vFlip = true; + const rotate2 = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4; + if (rotate2) result.rotate = rotate2; + return result; + } + var init_transformations = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/transformations.js"() { + "use strict"; + __name(mergeIconTransformations, "mergeIconTransformations"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/merge.js + function mergeIconData(parent4, child) { + const result = mergeIconTransformations(parent4, child); + for (const key in defaultExtendedIconProps) if (key in defaultIconTransformations) { + if (key in parent4 && !(key in result)) result[key] = defaultIconTransformations[key]; + } else if (key in child) result[key] = child[key]; + else if (key in parent4) result[key] = parent4[key]; + return result; + } + var init_merge = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon/merge.js"() { + "use strict"; + init_defaults(); + init_transformations(); + __name(mergeIconData, "mergeIconData"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon-set/tree.js + function getIconsTree(data5, names) { + const icons = data5.icons; + const aliases = data5.aliases || /* @__PURE__ */ Object.create(null); + const resolved = /* @__PURE__ */ Object.create(null); + function resolve2(name) { + if (icons[name]) return resolved[name] = []; + if (!(name in resolved)) { + resolved[name] = null; + const parent4 = aliases[name] && aliases[name].parent; + const value2 = parent4 && resolve2(parent4); + if (value2) resolved[name] = [parent4].concat(value2); + } + return resolved[name]; + } + __name(resolve2, "resolve"); + (names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve2); + return resolved; + } + var init_tree = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon-set/tree.js"() { + "use strict"; + __name(getIconsTree, "getIconsTree"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon-set/get-icon.js + function internalGetIconData(data5, name, tree) { + const icons = data5.icons; + const aliases = data5.aliases || /* @__PURE__ */ Object.create(null); + let currentProps = {}; + function parse7(name$1) { + currentProps = mergeIconData(icons[name$1] || aliases[name$1], currentProps); + } + __name(parse7, "parse"); + parse7(name); + tree.forEach(parse7); + return mergeIconData(data5, currentProps); + } + function getIconData(data5, name) { + if (data5.icons[name]) return internalGetIconData(data5, name, []); + const tree = getIconsTree(data5, [name])[name]; + return tree ? internalGetIconData(data5, name, tree) : null; + } + var init_get_icon = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/icon-set/get-icon.js"() { + "use strict"; + init_merge(); + init_tree(); + __name(internalGetIconData, "internalGetIconData"); + __name(getIconData, "getIconData"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/size.js + function calculateSize(size4, ratio, precision) { + if (ratio === 1) return size4; + precision = precision || 100; + if (typeof size4 === "number") return Math.ceil(size4 * ratio * precision) / precision; + if (typeof size4 !== "string") return size4; + const oldParts = size4.split(unitsSplit); + if (oldParts === null || !oldParts.length) return size4; + const newParts = []; + let code = oldParts.shift(); + let isNumber = unitsTest.test(code); + while (true) { + if (isNumber) { + const num = parseFloat(code); + if (isNaN(num)) newParts.push(code); + else newParts.push(Math.ceil(num * ratio * precision) / precision); + } else newParts.push(code); + code = oldParts.shift(); + if (code === void 0) return newParts.join(""); + isNumber = !isNumber; + } + } + var unitsSplit, unitsTest; + var init_size = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/size.js"() { + "use strict"; + unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g; + unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g; + __name(calculateSize, "calculateSize"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/defs.js + function splitSVGDefs(content, tag = "defs") { + let defs2 = ""; + const index = content.indexOf("<" + tag); + while (index >= 0) { + const start3 = content.indexOf(">", index); + const end2 = content.indexOf("", end2); + if (endEnd === -1) break; + defs2 += content.slice(start3 + 1, end2).trim(); + content = content.slice(0, index).trim() + content.slice(endEnd + 1); + } + return { + defs: defs2, + content + }; + } + function mergeDefsAndContent(defs2, content) { + return defs2 ? "" + defs2 + "" + content : content; + } + function wrapSVGContent(body, start3, end2) { + const split = splitSVGDefs(body); + return mergeDefsAndContent(split.defs, start3 + split.content + end2); + } + var init_defs = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/defs.js"() { + "use strict"; + __name(splitSVGDefs, "splitSVGDefs"); + __name(mergeDefsAndContent, "mergeDefsAndContent"); + __name(wrapSVGContent, "wrapSVGContent"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/build.js + function iconToSVG(icon2, customisations) { + const fullIcon = { + ...defaultIconProps, + ...icon2 + }; + const fullCustomisations = { + ...defaultIconCustomisations, + ...customisations + }; + const box = { + left: fullIcon.left, + top: fullIcon.top, + width: fullIcon.width, + height: fullIcon.height + }; + let body = fullIcon.body; + [fullIcon, fullCustomisations].forEach((props) => { + const transformations = []; + const hFlip = props.hFlip; + const vFlip = props.vFlip; + let rotation = props.rotate; + if (hFlip) if (vFlip) rotation += 2; + else { + transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"); + transformations.push("scale(-1 1)"); + box.top = box.left = 0; + } + else if (vFlip) { + transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"); + transformations.push("scale(1 -1)"); + box.top = box.left = 0; + } + let tempValue; + if (rotation < 0) rotation -= Math.floor(rotation / 4) * 4; + rotation = rotation % 4; + switch (rotation) { + case 1: + tempValue = box.height / 2 + box.top; + transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"); + break; + case 2: + transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"); + break; + case 3: + tempValue = box.width / 2 + box.left; + transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"); + break; + } + if (rotation % 2 === 1) { + if (box.left !== box.top) { + tempValue = box.left; + box.left = box.top; + box.top = tempValue; + } + if (box.width !== box.height) { + tempValue = box.width; + box.width = box.height; + box.height = tempValue; + } + } + if (transformations.length) body = wrapSVGContent(body, '', ""); + }); + const customisationsWidth = fullCustomisations.width; + const customisationsHeight = fullCustomisations.height; + const boxWidth = box.width; + const boxHeight = box.height; + let width3; + let height2; + if (customisationsWidth === null) { + height2 = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight; + width3 = calculateSize(height2, boxWidth / boxHeight); + } else { + width3 = customisationsWidth === "auto" ? boxWidth : customisationsWidth; + height2 = customisationsHeight === null ? calculateSize(width3, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight; + } + const attributes = {}; + const setAttr = /* @__PURE__ */ __name((prop, value2) => { + if (!isUnsetKeyword(value2)) attributes[prop] = value2.toString(); + }, "setAttr"); + setAttr("width", width3); + setAttr("height", height2); + const viewBox = [ + box.left, + box.top, + boxWidth, + boxHeight + ]; + attributes.viewBox = viewBox.join(" "); + return { + attributes, + viewBox, + body + }; + } + var isUnsetKeyword; + var init_build = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/build.js"() { + "use strict"; + init_defaults(); + init_defaults2(); + init_size(); + init_defs(); + isUnsetKeyword = /* @__PURE__ */ __name((value2) => value2 === "unset" || value2 === "undefined" || value2 === "none", "isUnsetKeyword"); + __name(iconToSVG, "iconToSVG"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/id.js + function replaceIDs(body, prefix = randomPrefix) { + const ids = []; + let match3; + while (match3 = regex.exec(body)) ids.push(match3[1]); + if (!ids.length) return body; + const suffix = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16); + ids.forEach((id35) => { + const newID = typeof prefix === "function" ? prefix(id35) : prefix + (counter++).toString(); + const escapedID = id35.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + suffix + "$3"); + }); + body = body.replace(new RegExp(suffix, "g"), ""); + return body; + } + var regex, randomPrefix, counter; + var init_id = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/id.js"() { + "use strict"; + regex = /\sid="(\S+)"/g; + randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16); + counter = 0; + __name(replaceIDs, "replaceIDs"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/html.js + function iconToHTML(body, attributes) { + let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"'; + for (const attr in attributes) renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"'; + return '" + body + ""; + } + var init_html = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/svg/html.js"() { + "use strict"; + __name(iconToHTML, "iconToHTML"); + } + }); + + // ../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/index.js + var init_lib = __esm({ + "../../node_modules/.pnpm/@iconify+utils@3.0.2/node_modules/@iconify/utils/lib/index.js"() { + "use strict"; + init_name(); + init_get_icon(); + init_build(); + init_id(); + init_html(); + } + }); + + // src/assignWithDepth.ts + var assignWithDepth, assignWithDepth_default; + var init_assignWithDepth = __esm({ + "src/assignWithDepth.ts"() { + "use strict"; + assignWithDepth = /* @__PURE__ */ __name((dst, src, { depth = 2, clobber = false } = {}) => { + const config5 = { depth, clobber }; + if (Array.isArray(src) && !Array.isArray(dst)) { + src.forEach((s2) => assignWithDepth(dst, s2, config5)); + return dst; + } else if (Array.isArray(src) && Array.isArray(dst)) { + src.forEach((s2) => { + if (!dst.includes(s2)) { + dst.push(s2); + } + }); + return dst; + } + if (dst === void 0 || depth <= 0) { + if (dst !== void 0 && dst !== null && typeof dst === "object" && typeof src === "object") { + return Object.assign(dst, src); + } else { + return src; + } + } + if (src !== void 0 && typeof dst === "object" && typeof src === "object") { + Object.keys(src).forEach((key) => { + if (typeof src[key] === "object" && src[key] !== null && (dst[key] === void 0 || typeof dst[key] === "object")) { + if (dst[key] === void 0) { + dst[key] = Array.isArray(src[key]) ? [] : {}; + } + dst[key] = assignWithDepth(dst[key], src[key], { depth: depth - 1, clobber }); + } else if (clobber || typeof dst[key] !== "object" && typeof src[key] !== "object") { + dst[key] = src[key]; + } + }); + } + return dst; + }, "assignWithDepth"); + assignWithDepth_default = assignWithDepth; + } + }); + + // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js + var require_dayjs_min = __commonJS({ + "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js"(exports2, module2) { + "use strict"; + !(function(t4, e3) { + "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = e3() : "function" == typeof define && define.amd ? define(e3) : (t4 = "undefined" != typeof globalThis ? globalThis : t4 || self).dayjs = e3(); + })(exports2, (function() { + "use strict"; + var t4 = 1e3, e3 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c3 = "month", f2 = "quarter", h3 = "year", d3 = "date", l4 = "Invalid Date", $4 = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y6 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M3 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: /* @__PURE__ */ __name(function(t5) { + var e4 = ["th", "st", "nd", "rd"], n3 = t5 % 100; + return "[" + t5 + (e4[(n3 - 20) % 10] || e4[n3] || e4[0]) + "]"; + }, "ordinal") }, m3 = /* @__PURE__ */ __name(function(t5, e4, n3) { + var r3 = String(t5); + return !r3 || r3.length >= e4 ? t5 : "" + Array(e4 + 1 - r3.length).join(n3) + t5; + }, "m"), v3 = { s: m3, z: /* @__PURE__ */ __name(function(t5) { + var e4 = -t5.utcOffset(), n3 = Math.abs(e4), r3 = Math.floor(n3 / 60), i3 = n3 % 60; + return (e4 <= 0 ? "+" : "-") + m3(r3, 2, "0") + ":" + m3(i3, 2, "0"); + }, "z"), m: /* @__PURE__ */ __name(function t5(e4, n3) { + if (e4.date() < n3.date()) return -t5(n3, e4); + var r3 = 12 * (n3.year() - e4.year()) + (n3.month() - e4.month()), i3 = e4.clone().add(r3, c3), s3 = n3 - i3 < 0, u3 = e4.clone().add(r3 + (s3 ? -1 : 1), c3); + return +(-(r3 + (n3 - i3) / (s3 ? i3 - u3 : u3 - i3)) || 0); + }, "t"), a: /* @__PURE__ */ __name(function(t5) { + return t5 < 0 ? Math.ceil(t5) || 0 : Math.floor(t5); + }, "a"), p: /* @__PURE__ */ __name(function(t5) { + return { M: c3, y: h3, w: o2, d: a2, D: d3, h: u2, m: s2, s: i2, ms: r2, Q: f2 }[t5] || String(t5 || "").toLowerCase().replace(/s$/, ""); + }, "p"), u: /* @__PURE__ */ __name(function(t5) { + return void 0 === t5; + }, "u") }, g2 = "en", D4 = {}; + D4[g2] = M3; + var p3 = "$isDayjsObject", S4 = /* @__PURE__ */ __name(function(t5) { + return t5 instanceof _3 || !(!t5 || !t5[p3]); + }, "S"), w4 = /* @__PURE__ */ __name(function t5(e4, n3, r3) { + var i3; + if (!e4) return g2; + if ("string" == typeof e4) { + var s3 = e4.toLowerCase(); + D4[s3] && (i3 = s3), n3 && (D4[s3] = n3, i3 = s3); + var u3 = e4.split("-"); + if (!i3 && u3.length > 1) return t5(u3[0]); + } else { + var a3 = e4.name; + D4[a3] = e4, i3 = a3; + } + return !r3 && i3 && (g2 = i3), i3 || !r3 && g2; + }, "t"), O3 = /* @__PURE__ */ __name(function(t5, e4) { + if (S4(t5)) return t5.clone(); + var n3 = "object" == typeof e4 ? e4 : {}; + return n3.date = t5, n3.args = arguments, new _3(n3); + }, "O"), b3 = v3; + b3.l = w4, b3.i = S4, b3.w = function(t5, e4) { + return O3(t5, { locale: e4.$L, utc: e4.$u, x: e4.$x, $offset: e4.$offset }); + }; + var _3 = (function() { + function M4(t5) { + this.$L = w4(t5.locale, null, true), this.parse(t5), this.$x = this.$x || t5.x || {}, this[p3] = true; + } + __name(M4, "M"); + var m4 = M4.prototype; + return m4.parse = function(t5) { + this.$d = (function(t6) { + var e4 = t6.date, n3 = t6.utc; + if (null === e4) return /* @__PURE__ */ new Date(NaN); + if (b3.u(e4)) return /* @__PURE__ */ new Date(); + if (e4 instanceof Date) return new Date(e4); + if ("string" == typeof e4 && !/Z$/i.test(e4)) { + var r3 = e4.match($4); + if (r3) { + var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3); + return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3); + } + } + return new Date(e4); + })(t5), this.init(); + }, m4.init = function() { + var t5 = this.$d; + this.$y = t5.getFullYear(), this.$M = t5.getMonth(), this.$D = t5.getDate(), this.$W = t5.getDay(), this.$H = t5.getHours(), this.$m = t5.getMinutes(), this.$s = t5.getSeconds(), this.$ms = t5.getMilliseconds(); + }, m4.$utils = function() { + return b3; + }, m4.isValid = function() { + return !(this.$d.toString() === l4); + }, m4.isSame = function(t5, e4) { + var n3 = O3(t5); + return this.startOf(e4) <= n3 && n3 <= this.endOf(e4); + }, m4.isAfter = function(t5, e4) { + return O3(t5) < this.startOf(e4); + }, m4.isBefore = function(t5, e4) { + return this.endOf(e4) < O3(t5); + }, m4.$g = function(t5, e4, n3) { + return b3.u(t5) ? this[e4] : this.set(n3, t5); + }, m4.unix = function() { + return Math.floor(this.valueOf() / 1e3); + }, m4.valueOf = function() { + return this.$d.getTime(); + }, m4.startOf = function(t5, e4) { + var n3 = this, r3 = !!b3.u(e4) || e4, f3 = b3.p(t5), l5 = /* @__PURE__ */ __name(function(t6, e6) { + var i3 = b3.w(n3.$u ? Date.UTC(n3.$y, e6, t6) : new Date(n3.$y, e6, t6), n3); + return r3 ? i3 : i3.endOf(a2); + }, "l"), $5 = /* @__PURE__ */ __name(function(t6, e6) { + return b3.w(n3.toDate()[t6].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e6)), n3); + }, "$"), y7 = this.$W, M5 = this.$M, m5 = this.$D, v5 = "set" + (this.$u ? "UTC" : ""); + switch (f3) { + case h3: + return r3 ? l5(1, 0) : l5(31, 11); + case c3: + return r3 ? l5(1, M5) : l5(0, M5 + 1); + case o2: + var g3 = this.$locale().weekStart || 0, D5 = (y7 < g3 ? y7 + 7 : y7) - g3; + return l5(r3 ? m5 - D5 : m5 + (6 - D5), M5); + case a2: + case d3: + return $5(v5 + "Hours", 0); + case u2: + return $5(v5 + "Minutes", 1); + case s2: + return $5(v5 + "Seconds", 2); + case i2: + return $5(v5 + "Milliseconds", 3); + default: + return this.clone(); + } + }, m4.endOf = function(t5) { + return this.startOf(t5, false); + }, m4.$set = function(t5, e4) { + var n3, o3 = b3.p(t5), f3 = "set" + (this.$u ? "UTC" : ""), l5 = (n3 = {}, n3[a2] = f3 + "Date", n3[d3] = f3 + "Date", n3[c3] = f3 + "Month", n3[h3] = f3 + "FullYear", n3[u2] = f3 + "Hours", n3[s2] = f3 + "Minutes", n3[i2] = f3 + "Seconds", n3[r2] = f3 + "Milliseconds", n3)[o3], $5 = o3 === a2 ? this.$D + (e4 - this.$W) : e4; + if (o3 === c3 || o3 === h3) { + var y7 = this.clone().set(d3, 1); + y7.$d[l5]($5), y7.init(), this.$d = y7.set(d3, Math.min(this.$D, y7.daysInMonth())).$d; + } else l5 && this.$d[l5]($5); + return this.init(), this; + }, m4.set = function(t5, e4) { + return this.clone().$set(t5, e4); + }, m4.get = function(t5) { + return this[b3.p(t5)](); + }, m4.add = function(r3, f3) { + var d4, l5 = this; + r3 = Number(r3); + var $5 = b3.p(f3), y7 = /* @__PURE__ */ __name(function(t5) { + var e4 = O3(l5); + return b3.w(e4.date(e4.date() + Math.round(t5 * r3)), l5); + }, "y"); + if ($5 === c3) return this.set(c3, this.$M + r3); + if ($5 === h3) return this.set(h3, this.$y + r3); + if ($5 === a2) return y7(1); + if ($5 === o2) return y7(7); + var M5 = (d4 = {}, d4[s2] = e3, d4[u2] = n2, d4[i2] = t4, d4)[$5] || 1, m5 = this.$d.getTime() + r3 * M5; + return b3.w(m5, this); + }, m4.subtract = function(t5, e4) { + return this.add(-1 * t5, e4); + }, m4.format = function(t5) { + var e4 = this, n3 = this.$locale(); + if (!this.isValid()) return n3.invalidDate || l4; + var r3 = t5 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b3.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n3.weekdays, c4 = n3.months, f3 = n3.meridiem, h4 = /* @__PURE__ */ __name(function(t6, n4, i4, s4) { + return t6 && (t6[n4] || t6(e4, r3)) || i4[n4].slice(0, s4); + }, "h"), d4 = /* @__PURE__ */ __name(function(t6) { + return b3.s(s3 % 12 || 12, t6, "0"); + }, "d"), $5 = f3 || function(t6, e6, n4) { + var r4 = t6 < 12 ? "AM" : "PM"; + return n4 ? r4.toLowerCase() : r4; + }; + return r3.replace(y6, (function(t6, r4) { + return r4 || (function(t7) { + switch (t7) { + case "YY": + return String(e4.$y).slice(-2); + case "YYYY": + return b3.s(e4.$y, 4, "0"); + case "M": + return a3 + 1; + case "MM": + return b3.s(a3 + 1, 2, "0"); + case "MMM": + return h4(n3.monthsShort, a3, c4, 3); + case "MMMM": + return h4(c4, a3); + case "D": + return e4.$D; + case "DD": + return b3.s(e4.$D, 2, "0"); + case "d": + return String(e4.$W); + case "dd": + return h4(n3.weekdaysMin, e4.$W, o3, 2); + case "ddd": + return h4(n3.weekdaysShort, e4.$W, o3, 3); + case "dddd": + return o3[e4.$W]; + case "H": + return String(s3); + case "HH": + return b3.s(s3, 2, "0"); + case "h": + return d4(1); + case "hh": + return d4(2); + case "a": + return $5(s3, u3, true); + case "A": + return $5(s3, u3, false); + case "m": + return String(u3); + case "mm": + return b3.s(u3, 2, "0"); + case "s": + return String(e4.$s); + case "ss": + return b3.s(e4.$s, 2, "0"); + case "SSS": + return b3.s(e4.$ms, 3, "0"); + case "Z": + return i3; + } + return null; + })(t6) || i3.replace(":", ""); + })); + }, m4.utcOffset = function() { + return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); + }, m4.diff = function(r3, d4, l5) { + var $5, y7 = this, M5 = b3.p(d4), m5 = O3(r3), v5 = (m5.utcOffset() - this.utcOffset()) * e3, g3 = this - m5, D5 = /* @__PURE__ */ __name(function() { + return b3.m(y7, m5); + }, "D"); + switch (M5) { + case h3: + $5 = D5() / 12; + break; + case c3: + $5 = D5(); + break; + case f2: + $5 = D5() / 3; + break; + case o2: + $5 = (g3 - v5) / 6048e5; + break; + case a2: + $5 = (g3 - v5) / 864e5; + break; + case u2: + $5 = g3 / n2; + break; + case s2: + $5 = g3 / e3; + break; + case i2: + $5 = g3 / t4; + break; + default: + $5 = g3; + } + return l5 ? $5 : b3.a($5); + }, m4.daysInMonth = function() { + return this.endOf(c3).$D; + }, m4.$locale = function() { + return D4[this.$L]; + }, m4.locale = function(t5, e4) { + if (!t5) return this.$L; + var n3 = this.clone(), r3 = w4(t5, e4, true); + return r3 && (n3.$L = r3), n3; + }, m4.clone = function() { + return b3.w(this.$d, this); + }, m4.toDate = function() { + return new Date(this.valueOf()); + }, m4.toJSON = function() { + return this.isValid() ? this.toISOString() : null; + }, m4.toISOString = function() { + return this.$d.toISOString(); + }, m4.toString = function() { + return this.$d.toUTCString(); + }, M4; + })(), k2 = _3.prototype; + return O3.prototype = k2, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c3], ["$y", h3], ["$D", d3]].forEach((function(t5) { + k2[t5[1]] = function(e4) { + return this.$g(e4, t5[0], t5[1]); + }; + })), O3.extend = function(t5, e4) { + return t5.$i || (t5(e4, _3, O3), t5.$i = true), O3; + }, O3.locale = w4, O3.isDayjs = S4, O3.unix = function(t5) { + return O3(1e3 * t5); + }, O3.en = D4[g2], O3.Ls = D4, O3.p = {}, O3; + })); + } + }); + + // src/logger.ts + var import_dayjs, LEVELS, log, setLogLevel, format; + var init_logger = __esm({ + "src/logger.ts"() { + "use strict"; + import_dayjs = __toESM(require_dayjs_min(), 1); + LEVELS = { + trace: 0, + debug: 1, + info: 2, + warn: 3, + error: 4, + fatal: 5 + }; + log = { + trace: /* @__PURE__ */ __name((..._args) => { + }, "trace"), + debug: /* @__PURE__ */ __name((..._args) => { + }, "debug"), + info: /* @__PURE__ */ __name((..._args) => { + }, "info"), + warn: /* @__PURE__ */ __name((..._args) => { + }, "warn"), + error: /* @__PURE__ */ __name((..._args) => { + }, "error"), + fatal: /* @__PURE__ */ __name((..._args) => { + }, "fatal") + }; + setLogLevel = /* @__PURE__ */ __name(function(level = "fatal") { + let numericLevel = LEVELS.fatal; + if (typeof level === "string") { + if (level.toLowerCase() in LEVELS) { + numericLevel = LEVELS[level]; + } + } else if (typeof level === "number") { + numericLevel = level; + } + log.trace = () => { + }; + log.debug = () => { + }; + log.info = () => { + }; + log.warn = () => { + }; + log.error = () => { + }; + log.fatal = () => { + }; + if (numericLevel <= LEVELS.fatal) { + log.fatal = console.error ? console.error.bind(console, format("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format("FATAL")); + } + if (numericLevel <= LEVELS.error) { + log.error = console.error ? console.error.bind(console, format("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format("ERROR")); + } + if (numericLevel <= LEVELS.warn) { + log.warn = console.warn ? console.warn.bind(console, format("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format("WARN")); + } + if (numericLevel <= LEVELS.info) { + log.info = console.info ? console.info.bind(console, format("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format("INFO")); + } + if (numericLevel <= LEVELS.debug) { + log.debug = console.debug ? console.debug.bind(console, format("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("DEBUG")); + } + if (numericLevel <= LEVELS.trace) { + log.trace = console.debug ? console.debug.bind(console, format("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("TRACE")); + } + }, "setLogLevel"); + format = /* @__PURE__ */ __name((level) => { + const time4 = (0, import_dayjs.default)().format("ss.SSS"); + return `%c${time4} : ${level} : `; + }, "format"); + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/channel.js + var Channel, channel_default; + var init_channel = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/channel.js"() { + "use strict"; + Channel = { + /* CLAMP */ + min: { + r: 0, + g: 0, + b: 0, + s: 0, + l: 0, + a: 0 + }, + max: { + r: 255, + g: 255, + b: 255, + h: 360, + s: 100, + l: 100, + a: 1 + }, + clamp: { + r: /* @__PURE__ */ __name((r2) => r2 >= 255 ? 255 : r2 < 0 ? 0 : r2, "r"), + g: /* @__PURE__ */ __name((g2) => g2 >= 255 ? 255 : g2 < 0 ? 0 : g2, "g"), + b: /* @__PURE__ */ __name((b3) => b3 >= 255 ? 255 : b3 < 0 ? 0 : b3, "b"), + h: /* @__PURE__ */ __name((h3) => h3 % 360, "h"), + s: /* @__PURE__ */ __name((s2) => s2 >= 100 ? 100 : s2 < 0 ? 0 : s2, "s"), + l: /* @__PURE__ */ __name((l4) => l4 >= 100 ? 100 : l4 < 0 ? 0 : l4, "l"), + a: /* @__PURE__ */ __name((a2) => a2 >= 1 ? 1 : a2 < 0 ? 0 : a2, "a") + }, + /* CONVERSION */ + //SOURCE: https://planetcalc.com/7779 + toLinear: /* @__PURE__ */ __name((c3) => { + const n2 = c3 / 255; + return c3 > 0.03928 ? Math.pow((n2 + 0.055) / 1.055, 2.4) : n2 / 12.92; + }, "toLinear"), + //SOURCE: https://gist.github.com/mjackson/5311256 + hue2rgb: /* @__PURE__ */ __name((p3, q3, t4) => { + if (t4 < 0) + t4 += 1; + if (t4 > 1) + t4 -= 1; + if (t4 < 1 / 6) + return p3 + (q3 - p3) * 6 * t4; + if (t4 < 1 / 2) + return q3; + if (t4 < 2 / 3) + return p3 + (q3 - p3) * (2 / 3 - t4) * 6; + return p3; + }, "hue2rgb"), + hsl2rgb: /* @__PURE__ */ __name(({ h: h3, s: s2, l: l4 }, channel2) => { + if (!s2) + return l4 * 2.55; + h3 /= 360; + s2 /= 100; + l4 /= 100; + const q3 = l4 < 0.5 ? l4 * (1 + s2) : l4 + s2 - l4 * s2; + const p3 = 2 * l4 - q3; + switch (channel2) { + case "r": + return Channel.hue2rgb(p3, q3, h3 + 1 / 3) * 255; + case "g": + return Channel.hue2rgb(p3, q3, h3) * 255; + case "b": + return Channel.hue2rgb(p3, q3, h3 - 1 / 3) * 255; + } + }, "hsl2rgb"), + rgb2hsl: /* @__PURE__ */ __name(({ r: r2, g: g2, b: b3 }, channel2) => { + r2 /= 255; + g2 /= 255; + b3 /= 255; + const max10 = Math.max(r2, g2, b3); + const min10 = Math.min(r2, g2, b3); + const l4 = (max10 + min10) / 2; + if (channel2 === "l") + return l4 * 100; + if (max10 === min10) + return 0; + const d3 = max10 - min10; + const s2 = l4 > 0.5 ? d3 / (2 - max10 - min10) : d3 / (max10 + min10); + if (channel2 === "s") + return s2 * 100; + switch (max10) { + case r2: + return ((g2 - b3) / d3 + (g2 < b3 ? 6 : 0)) * 60; + case g2: + return ((b3 - r2) / d3 + 2) * 60; + case b3: + return ((r2 - g2) / d3 + 4) * 60; + default: + return -1; + } + }, "rgb2hsl") + }; + channel_default = Channel; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/lang.js + var Lang, lang_default; + var init_lang = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/lang.js"() { + "use strict"; + Lang = { + /* API */ + clamp: /* @__PURE__ */ __name((number7, lower2, upper) => { + if (lower2 > upper) + return Math.min(lower2, Math.max(upper, number7)); + return Math.min(upper, Math.max(lower2, number7)); + }, "clamp"), + round: /* @__PURE__ */ __name((number7) => { + return Math.round(number7 * 1e10) / 1e10; + }, "round") + }; + lang_default = Lang; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/unit.js + var Unit, unit_default; + var init_unit = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/unit.js"() { + "use strict"; + Unit = { + /* API */ + dec2hex: /* @__PURE__ */ __name((dec) => { + const hex2 = Math.round(dec).toString(16); + return hex2.length > 1 ? hex2 : `0${hex2}`; + }, "dec2hex") + }; + unit_default = Unit; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/index.js + var Utils, utils_default; + var init_utils = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/utils/index.js"() { + "use strict"; + init_channel(); + init_lang(); + init_unit(); + Utils = { + channel: channel_default, + lang: lang_default, + unit: unit_default + }; + utils_default = Utils; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/constants.js + var DEC2HEX, TYPE; + var init_constants = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/constants.js"() { + "use strict"; + init_utils(); + DEC2HEX = {}; + for (let i2 = 0; i2 <= 255; i2++) + DEC2HEX[i2] = utils_default.unit.dec2hex(i2); + TYPE = { + ALL: 0, + RGB: 1, + HSL: 2 + }; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/type.js + var Type, type_default; + var init_type = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/type.js"() { + "use strict"; + init_constants(); + Type = class { + static { + __name(this, "Type"); + } + constructor() { + this.type = TYPE.ALL; + } + /* API */ + get() { + return this.type; + } + set(type3) { + if (this.type && this.type !== type3) + throw new Error("Cannot change both RGB and HSL channels at the same time"); + this.type = type3; + } + reset() { + this.type = TYPE.ALL; + } + is(type3) { + return this.type === type3; + } + }; + type_default = Type; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/index.js + var Channels, channels_default; + var init_channels = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/index.js"() { + "use strict"; + init_utils(); + init_type(); + init_constants(); + Channels = class { + static { + __name(this, "Channels"); + } + /* CONSTRUCTOR */ + constructor(data5, color2) { + this.color = color2; + this.changed = false; + this.data = data5; + this.type = new type_default(); + } + /* API */ + set(data5, color2) { + this.color = color2; + this.changed = false; + this.data = data5; + this.type.type = TYPE.ALL; + return this; + } + /* HELPERS */ + _ensureHSL() { + const data5 = this.data; + const { h: h3, s: s2, l: l4 } = data5; + if (h3 === void 0) + data5.h = utils_default.channel.rgb2hsl(data5, "h"); + if (s2 === void 0) + data5.s = utils_default.channel.rgb2hsl(data5, "s"); + if (l4 === void 0) + data5.l = utils_default.channel.rgb2hsl(data5, "l"); + } + _ensureRGB() { + const data5 = this.data; + const { r: r2, g: g2, b: b3 } = data5; + if (r2 === void 0) + data5.r = utils_default.channel.hsl2rgb(data5, "r"); + if (g2 === void 0) + data5.g = utils_default.channel.hsl2rgb(data5, "g"); + if (b3 === void 0) + data5.b = utils_default.channel.hsl2rgb(data5, "b"); + } + /* GETTERS */ + get r() { + const data5 = this.data; + const r2 = data5.r; + if (!this.type.is(TYPE.HSL) && r2 !== void 0) + return r2; + this._ensureHSL(); + return utils_default.channel.hsl2rgb(data5, "r"); + } + get g() { + const data5 = this.data; + const g2 = data5.g; + if (!this.type.is(TYPE.HSL) && g2 !== void 0) + return g2; + this._ensureHSL(); + return utils_default.channel.hsl2rgb(data5, "g"); + } + get b() { + const data5 = this.data; + const b3 = data5.b; + if (!this.type.is(TYPE.HSL) && b3 !== void 0) + return b3; + this._ensureHSL(); + return utils_default.channel.hsl2rgb(data5, "b"); + } + get h() { + const data5 = this.data; + const h3 = data5.h; + if (!this.type.is(TYPE.RGB) && h3 !== void 0) + return h3; + this._ensureRGB(); + return utils_default.channel.rgb2hsl(data5, "h"); + } + get s() { + const data5 = this.data; + const s2 = data5.s; + if (!this.type.is(TYPE.RGB) && s2 !== void 0) + return s2; + this._ensureRGB(); + return utils_default.channel.rgb2hsl(data5, "s"); + } + get l() { + const data5 = this.data; + const l4 = data5.l; + if (!this.type.is(TYPE.RGB) && l4 !== void 0) + return l4; + this._ensureRGB(); + return utils_default.channel.rgb2hsl(data5, "l"); + } + get a() { + return this.data.a; + } + /* SETTERS */ + set r(r2) { + this.type.set(TYPE.RGB); + this.changed = true; + this.data.r = r2; + } + set g(g2) { + this.type.set(TYPE.RGB); + this.changed = true; + this.data.g = g2; + } + set b(b3) { + this.type.set(TYPE.RGB); + this.changed = true; + this.data.b = b3; + } + set h(h3) { + this.type.set(TYPE.HSL); + this.changed = true; + this.data.h = h3; + } + set s(s2) { + this.type.set(TYPE.HSL); + this.changed = true; + this.data.s = s2; + } + set l(l4) { + this.type.set(TYPE.HSL); + this.changed = true; + this.data.l = l4; + } + set a(a2) { + this.changed = true; + this.data.a = a2; + } + }; + channels_default = Channels; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/reusable.js + var channels, reusable_default; + var init_reusable = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/channels/reusable.js"() { + "use strict"; + init_channels(); + channels = new channels_default({ r: 0, g: 0, b: 0, a: 0 }, "transparent"); + reusable_default = channels; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hex.js + var Hex, hex_default; + var init_hex = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hex.js"() { + "use strict"; + init_reusable(); + init_constants(); + Hex = { + /* VARIABLES */ + re: /^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i, + /* API */ + parse: /* @__PURE__ */ __name((color2) => { + if (color2.charCodeAt(0) !== 35) + return; + const match3 = color2.match(Hex.re); + if (!match3) + return; + const hex2 = match3[1]; + const dec = parseInt(hex2, 16); + const length2 = hex2.length; + const hasAlpha = length2 % 4 === 0; + const isFullLength = length2 > 4; + const multiplier = isFullLength ? 1 : 17; + const bits = isFullLength ? 8 : 4; + const bitsOffset = hasAlpha ? 0 : -1; + const mask = isFullLength ? 255 : 15; + return reusable_default.set({ + r: (dec >> bits * (bitsOffset + 3) & mask) * multiplier, + g: (dec >> bits * (bitsOffset + 2) & mask) * multiplier, + b: (dec >> bits * (bitsOffset + 1) & mask) * multiplier, + a: hasAlpha ? (dec & mask) * multiplier / 255 : 1 + }, color2); + }, "parse"), + stringify: /* @__PURE__ */ __name((channels2) => { + const { r: r2, g: g2, b: b3, a: a2 } = channels2; + if (a2 < 1) { + return `#${DEC2HEX[Math.round(r2)]}${DEC2HEX[Math.round(g2)]}${DEC2HEX[Math.round(b3)]}${DEC2HEX[Math.round(a2 * 255)]}`; + } else { + return `#${DEC2HEX[Math.round(r2)]}${DEC2HEX[Math.round(g2)]}${DEC2HEX[Math.round(b3)]}`; + } + }, "stringify") + }; + hex_default = Hex; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hsl.js + var HSL, hsl_default; + var init_hsl = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/hsl.js"() { + "use strict"; + init_utils(); + init_reusable(); + HSL = { + /* VARIABLES */ + re: /^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i, + hueRe: /^(.+?)(deg|grad|rad|turn)$/i, + /* HELPERS */ + _hue2deg: /* @__PURE__ */ __name((hue2) => { + const match3 = hue2.match(HSL.hueRe); + if (match3) { + const [, number7, unit2] = match3; + switch (unit2) { + case "grad": + return utils_default.channel.clamp.h(parseFloat(number7) * 0.9); + case "rad": + return utils_default.channel.clamp.h(parseFloat(number7) * 180 / Math.PI); + case "turn": + return utils_default.channel.clamp.h(parseFloat(number7) * 360); + } + } + return utils_default.channel.clamp.h(parseFloat(hue2)); + }, "_hue2deg"), + /* API */ + parse: /* @__PURE__ */ __name((color2) => { + const charCode = color2.charCodeAt(0); + if (charCode !== 104 && charCode !== 72) + return; + const match3 = color2.match(HSL.re); + if (!match3) + return; + const [, h3, s2, l4, a2, isAlphaPercentage] = match3; + return reusable_default.set({ + h: HSL._hue2deg(h3), + s: utils_default.channel.clamp.s(parseFloat(s2)), + l: utils_default.channel.clamp.l(parseFloat(l4)), + a: a2 ? utils_default.channel.clamp.a(isAlphaPercentage ? parseFloat(a2) / 100 : parseFloat(a2)) : 1 + }, color2); + }, "parse"), + stringify: /* @__PURE__ */ __name((channels2) => { + const { h: h3, s: s2, l: l4, a: a2 } = channels2; + if (a2 < 1) { + return `hsla(${utils_default.lang.round(h3)}, ${utils_default.lang.round(s2)}%, ${utils_default.lang.round(l4)}%, ${a2})`; + } else { + return `hsl(${utils_default.lang.round(h3)}, ${utils_default.lang.round(s2)}%, ${utils_default.lang.round(l4)}%)`; + } + }, "stringify") + }; + hsl_default = HSL; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/keyword.js + var Keyword, keyword_default; + var init_keyword = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/keyword.js"() { + "use strict"; + init_hex(); + Keyword = { + /* VARIABLES */ + colors: { + aliceblue: "#f0f8ff", + antiquewhite: "#faebd7", + aqua: "#00ffff", + aquamarine: "#7fffd4", + azure: "#f0ffff", + beige: "#f5f5dc", + bisque: "#ffe4c4", + black: "#000000", + blanchedalmond: "#ffebcd", + blue: "#0000ff", + blueviolet: "#8a2be2", + brown: "#a52a2a", + burlywood: "#deb887", + cadetblue: "#5f9ea0", + chartreuse: "#7fff00", + chocolate: "#d2691e", + coral: "#ff7f50", + cornflowerblue: "#6495ed", + cornsilk: "#fff8dc", + crimson: "#dc143c", + cyanaqua: "#00ffff", + darkblue: "#00008b", + darkcyan: "#008b8b", + darkgoldenrod: "#b8860b", + darkgray: "#a9a9a9", + darkgreen: "#006400", + darkgrey: "#a9a9a9", + darkkhaki: "#bdb76b", + darkmagenta: "#8b008b", + darkolivegreen: "#556b2f", + darkorange: "#ff8c00", + darkorchid: "#9932cc", + darkred: "#8b0000", + darksalmon: "#e9967a", + darkseagreen: "#8fbc8f", + darkslateblue: "#483d8b", + darkslategray: "#2f4f4f", + darkslategrey: "#2f4f4f", + darkturquoise: "#00ced1", + darkviolet: "#9400d3", + deeppink: "#ff1493", + deepskyblue: "#00bfff", + dimgray: "#696969", + dimgrey: "#696969", + dodgerblue: "#1e90ff", + firebrick: "#b22222", + floralwhite: "#fffaf0", + forestgreen: "#228b22", + fuchsia: "#ff00ff", + gainsboro: "#dcdcdc", + ghostwhite: "#f8f8ff", + gold: "#ffd700", + goldenrod: "#daa520", + gray: "#808080", + green: "#008000", + greenyellow: "#adff2f", + grey: "#808080", + honeydew: "#f0fff0", + hotpink: "#ff69b4", + indianred: "#cd5c5c", + indigo: "#4b0082", + ivory: "#fffff0", + khaki: "#f0e68c", + lavender: "#e6e6fa", + lavenderblush: "#fff0f5", + lawngreen: "#7cfc00", + lemonchiffon: "#fffacd", + lightblue: "#add8e6", + lightcoral: "#f08080", + lightcyan: "#e0ffff", + lightgoldenrodyellow: "#fafad2", + lightgray: "#d3d3d3", + lightgreen: "#90ee90", + lightgrey: "#d3d3d3", + lightpink: "#ffb6c1", + lightsalmon: "#ffa07a", + lightseagreen: "#20b2aa", + lightskyblue: "#87cefa", + lightslategray: "#778899", + lightslategrey: "#778899", + lightsteelblue: "#b0c4de", + lightyellow: "#ffffe0", + lime: "#00ff00", + limegreen: "#32cd32", + linen: "#faf0e6", + magenta: "#ff00ff", + maroon: "#800000", + mediumaquamarine: "#66cdaa", + mediumblue: "#0000cd", + mediumorchid: "#ba55d3", + mediumpurple: "#9370db", + mediumseagreen: "#3cb371", + mediumslateblue: "#7b68ee", + mediumspringgreen: "#00fa9a", + mediumturquoise: "#48d1cc", + mediumvioletred: "#c71585", + midnightblue: "#191970", + mintcream: "#f5fffa", + mistyrose: "#ffe4e1", + moccasin: "#ffe4b5", + navajowhite: "#ffdead", + navy: "#000080", + oldlace: "#fdf5e6", + olive: "#808000", + olivedrab: "#6b8e23", + orange: "#ffa500", + orangered: "#ff4500", + orchid: "#da70d6", + palegoldenrod: "#eee8aa", + palegreen: "#98fb98", + paleturquoise: "#afeeee", + palevioletred: "#db7093", + papayawhip: "#ffefd5", + peachpuff: "#ffdab9", + peru: "#cd853f", + pink: "#ffc0cb", + plum: "#dda0dd", + powderblue: "#b0e0e6", + purple: "#800080", + rebeccapurple: "#663399", + red: "#ff0000", + rosybrown: "#bc8f8f", + royalblue: "#4169e1", + saddlebrown: "#8b4513", + salmon: "#fa8072", + sandybrown: "#f4a460", + seagreen: "#2e8b57", + seashell: "#fff5ee", + sienna: "#a0522d", + silver: "#c0c0c0", + skyblue: "#87ceeb", + slateblue: "#6a5acd", + slategray: "#708090", + slategrey: "#708090", + snow: "#fffafa", + springgreen: "#00ff7f", + tan: "#d2b48c", + teal: "#008080", + thistle: "#d8bfd8", + transparent: "#00000000", + turquoise: "#40e0d0", + violet: "#ee82ee", + wheat: "#f5deb3", + white: "#ffffff", + whitesmoke: "#f5f5f5", + yellow: "#ffff00", + yellowgreen: "#9acd32" + }, + /* API */ + parse: /* @__PURE__ */ __name((color2) => { + color2 = color2.toLowerCase(); + const hex2 = Keyword.colors[color2]; + if (!hex2) + return; + return hex_default.parse(hex2); + }, "parse"), + stringify: /* @__PURE__ */ __name((channels2) => { + const hex2 = hex_default.stringify(channels2); + for (const name in Keyword.colors) { + if (Keyword.colors[name] === hex2) + return name; + } + return; + }, "stringify") + }; + keyword_default = Keyword; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/rgb.js + var RGB, rgb_default; + var init_rgb = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/rgb.js"() { + "use strict"; + init_utils(); + init_reusable(); + RGB = { + /* VARIABLES */ + re: /^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i, + /* API */ + parse: /* @__PURE__ */ __name((color2) => { + const charCode = color2.charCodeAt(0); + if (charCode !== 114 && charCode !== 82) + return; + const match3 = color2.match(RGB.re); + if (!match3) + return; + const [, r2, isRedPercentage, g2, isGreenPercentage, b3, isBluePercentage, a2, isAlphaPercentage] = match3; + return reusable_default.set({ + r: utils_default.channel.clamp.r(isRedPercentage ? parseFloat(r2) * 2.55 : parseFloat(r2)), + g: utils_default.channel.clamp.g(isGreenPercentage ? parseFloat(g2) * 2.55 : parseFloat(g2)), + b: utils_default.channel.clamp.b(isBluePercentage ? parseFloat(b3) * 2.55 : parseFloat(b3)), + a: a2 ? utils_default.channel.clamp.a(isAlphaPercentage ? parseFloat(a2) / 100 : parseFloat(a2)) : 1 + }, color2); + }, "parse"), + stringify: /* @__PURE__ */ __name((channels2) => { + const { r: r2, g: g2, b: b3, a: a2 } = channels2; + if (a2 < 1) { + return `rgba(${utils_default.lang.round(r2)}, ${utils_default.lang.round(g2)}, ${utils_default.lang.round(b3)}, ${utils_default.lang.round(a2)})`; + } else { + return `rgb(${utils_default.lang.round(r2)}, ${utils_default.lang.round(g2)}, ${utils_default.lang.round(b3)})`; + } + }, "stringify") + }; + rgb_default = RGB; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/index.js + var Color, color_default; + var init_color = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/color/index.js"() { + "use strict"; + init_hex(); + init_hsl(); + init_keyword(); + init_rgb(); + init_constants(); + Color = { + /* VARIABLES */ + format: { + keyword: keyword_default, + hex: hex_default, + rgb: rgb_default, + rgba: rgb_default, + hsl: hsl_default, + hsla: hsl_default + }, + /* API */ + parse: /* @__PURE__ */ __name((color2) => { + if (typeof color2 !== "string") + return color2; + const channels2 = hex_default.parse(color2) || rgb_default.parse(color2) || hsl_default.parse(color2) || keyword_default.parse(color2); + if (channels2) + return channels2; + throw new Error(`Unsupported color format: "${color2}"`); + }, "parse"), + stringify: /* @__PURE__ */ __name((channels2) => { + if (!channels2.changed && channels2.color) + return channels2.color; + if (channels2.type.is(TYPE.HSL) || channels2.data.r === void 0) { + return hsl_default.stringify(channels2); + } else if (channels2.a < 1 || !Number.isInteger(channels2.r) || !Number.isInteger(channels2.g) || !Number.isInteger(channels2.b)) { + return rgb_default.stringify(channels2); + } else { + return hex_default.stringify(channels2); + } + }, "stringify") + }; + color_default = Color; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/change.js + var change, change_default; + var init_change = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/change.js"() { + "use strict"; + init_utils(); + init_color(); + change = /* @__PURE__ */ __name((color2, channels2) => { + const ch = color_default.parse(color2); + for (const c3 in channels2) { + ch[c3] = utils_default.channel.clamp[c3](channels2[c3]); + } + return color_default.stringify(ch); + }, "change"); + change_default = change; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/rgba.js + var rgba, rgba_default; + var init_rgba = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/rgba.js"() { + "use strict"; + init_utils(); + init_reusable(); + init_color(); + init_change(); + rgba = /* @__PURE__ */ __name((r2, g2, b3 = 0, a2 = 1) => { + if (typeof r2 !== "number") + return change_default(r2, { a: g2 }); + const channels2 = reusable_default.set({ + r: utils_default.channel.clamp.r(r2), + g: utils_default.channel.clamp.g(g2), + b: utils_default.channel.clamp.b(b3), + a: utils_default.channel.clamp.a(a2) + }); + return color_default.stringify(channels2); + }, "rgba"); + rgba_default = rgba; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/channel.js + var channel, channel_default2; + var init_channel2 = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/channel.js"() { + "use strict"; + init_utils(); + init_color(); + channel = /* @__PURE__ */ __name((color2, channel2) => { + return utils_default.lang.round(color_default.parse(color2)[channel2]); + }, "channel"); + channel_default2 = channel; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/luminance.js + var luminance, luminance_default; + var init_luminance = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/luminance.js"() { + "use strict"; + init_utils(); + init_color(); + luminance = /* @__PURE__ */ __name((color2) => { + const { r: r2, g: g2, b: b3 } = color_default.parse(color2); + const luminance2 = 0.2126 * utils_default.channel.toLinear(r2) + 0.7152 * utils_default.channel.toLinear(g2) + 0.0722 * utils_default.channel.toLinear(b3); + return utils_default.lang.round(luminance2); + }, "luminance"); + luminance_default = luminance; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_light.js + var isLight, is_light_default; + var init_is_light = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_light.js"() { + "use strict"; + init_luminance(); + isLight = /* @__PURE__ */ __name((color2) => { + return luminance_default(color2) >= 0.5; + }, "isLight"); + is_light_default = isLight; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_dark.js + var isDark, is_dark_default; + var init_is_dark = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/is_dark.js"() { + "use strict"; + init_is_light(); + isDark = /* @__PURE__ */ __name((color2) => { + return !is_light_default(color2); + }, "isDark"); + is_dark_default = isDark; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust_channel.js + var adjustChannel, adjust_channel_default; + var init_adjust_channel = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust_channel.js"() { + "use strict"; + init_utils(); + init_color(); + adjustChannel = /* @__PURE__ */ __name((color2, channel2, amount) => { + const channels2 = color_default.parse(color2); + const amountCurrent = channels2[channel2]; + const amountNext = utils_default.channel.clamp[channel2](amountCurrent + amount); + if (amountCurrent !== amountNext) + channels2[channel2] = amountNext; + return color_default.stringify(channels2); + }, "adjustChannel"); + adjust_channel_default = adjustChannel; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/lighten.js + var lighten, lighten_default; + var init_lighten = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/lighten.js"() { + "use strict"; + init_adjust_channel(); + lighten = /* @__PURE__ */ __name((color2, amount) => { + return adjust_channel_default(color2, "l", amount); + }, "lighten"); + lighten_default = lighten; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/darken.js + var darken, darken_default; + var init_darken = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/darken.js"() { + "use strict"; + init_adjust_channel(); + darken = /* @__PURE__ */ __name((color2, amount) => { + return adjust_channel_default(color2, "l", -amount); + }, "darken"); + darken_default = darken; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/transparentize.js + var transparentize, transparentize_default; + var init_transparentize = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/transparentize.js"() { + "use strict"; + init_adjust_channel(); + transparentize = /* @__PURE__ */ __name((color2, amount) => { + return adjust_channel_default(color2, "a", -amount); + }, "transparentize"); + transparentize_default = transparentize; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust.js + var adjust, adjust_default; + var init_adjust = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/adjust.js"() { + "use strict"; + init_color(); + init_change(); + adjust = /* @__PURE__ */ __name((color2, channels2) => { + const ch = color_default.parse(color2); + const changes = {}; + for (const c3 in channels2) { + if (!channels2[c3]) + continue; + changes[c3] = ch[c3] + channels2[c3]; + } + return change_default(color2, changes); + }, "adjust"); + adjust_default = adjust; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/mix.js + var mix, mix_default; + var init_mix = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/mix.js"() { + "use strict"; + init_color(); + init_rgba(); + mix = /* @__PURE__ */ __name((color1, color2, weight8 = 50) => { + const { r: r1, g: g1, b: b1, a: a1 } = color_default.parse(color1); + const { r: r2, g: g2, b: b22, a: a2 } = color_default.parse(color2); + const weightScale = weight8 / 100; + const weightNormalized = weightScale * 2 - 1; + const alphaDelta = a1 - a2; + const weight1combined = weightNormalized * alphaDelta === -1 ? weightNormalized : (weightNormalized + alphaDelta) / (1 + weightNormalized * alphaDelta); + const weight1 = (weight1combined + 1) / 2; + const weight22 = 1 - weight1; + const r3 = r1 * weight1 + r2 * weight22; + const g3 = g1 * weight1 + g2 * weight22; + const b3 = b1 * weight1 + b22 * weight22; + const a3 = a1 * weightScale + a2 * (1 - weightScale); + return rgba_default(r3, g3, b3, a3); + }, "mix"); + mix_default = mix; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/invert.js + var invert, invert_default; + var init_invert = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/invert.js"() { + "use strict"; + init_color(); + init_mix(); + invert = /* @__PURE__ */ __name((color2, weight8 = 100) => { + const inverse = color_default.parse(color2); + inverse.r = 255 - inverse.r; + inverse.g = 255 - inverse.g; + inverse.b = 255 - inverse.b; + return mix_default(inverse, color2, weight8); + }, "invert"); + invert_default = invert; + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/index.js + var init_methods = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/methods/index.js"() { + "use strict"; + init_rgba(); + init_channel2(); + init_is_dark(); + init_lighten(); + init_darken(); + init_transparentize(); + init_adjust(); + init_invert(); + } + }); + + // ../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/index.js + var init_dist = __esm({ + "../../node_modules/.pnpm/khroma@2.1.0/node_modules/khroma/dist/index.js"() { + "use strict"; + init_methods(); + } + }); + + // src/themes/erDiagram-oldHardcodedValues.ts + var oldAttributeBackgroundColorOdd, oldAttributeBackgroundColorEven; + var init_erDiagram_oldHardcodedValues = __esm({ + "src/themes/erDiagram-oldHardcodedValues.ts"() { + "use strict"; + oldAttributeBackgroundColorOdd = "#ffffff"; + oldAttributeBackgroundColorEven = "#f2f2f2"; + } + }); + + // src/themes/theme-helpers.js + var mkBorder; + var init_theme_helpers = __esm({ + "src/themes/theme-helpers.js"() { + "use strict"; + init_dist(); + mkBorder = /* @__PURE__ */ __name((col, darkMode) => darkMode ? adjust_default(col, { s: -40, l: 10 }) : adjust_default(col, { s: -40, l: -10 }), "mkBorder"); + } + }); + + // src/themes/theme-base.js + var Theme, getThemeVariables; + var init_theme_base = __esm({ + "src/themes/theme-base.js"() { + "use strict"; + init_dist(); + init_erDiagram_oldHardcodedValues(); + init_theme_helpers(); + Theme = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#f4f4f4"; + this.primaryColor = "#fff4dd"; + this.noteBkgColor = "#fff5ad"; + this.noteTextColor = "#333"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 5; + this.strokeWidth = 1; + this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; + this.fontSize = "16px"; + this.useGradient = true; + this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,1))"; + } + updateColors() { + this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333"); + this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 }); + this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 }); + this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode); + this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode); + this.noteBkgColor = this.noteBkgColor || "#fff5ad"; + this.noteTextColor = this.noteTextColor || "#333"; + this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor); + this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor); + this.lineColor = this.lineColor || invert_default(this.background); + this.arrowheadColor = this.arrowheadColor || invert_default(this.background); + this.textColor = this.textColor || this.primaryTextColor; + this.border2 = this.border2 || this.tertiaryBorderColor; + this.nodeBkg = this.nodeBkg || this.primaryColor; + this.mainBkg = this.mainBkg || this.primaryColor; + this.nodeBorder = this.nodeBorder || this.primaryBorderColor; + this.clusterBkg = this.clusterBkg || this.tertiaryColor; + this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor; + this.defaultLinkColor = this.defaultLinkColor || this.lineColor; + this.titleColor = this.titleColor || this.tertiaryTextColor; + this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.nodeTextColor = this.nodeTextColor || this.primaryTextColor; + this.actorBorder = this.actorBorder || this.primaryBorderColor; + this.actorBkg = this.actorBkg || this.mainBkg; + this.actorTextColor = this.actorTextColor || this.primaryTextColor; + this.actorLineColor = this.actorLineColor || this.actorBorder; + this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg; + this.signalColor = this.signalColor || this.textColor; + this.signalTextColor = this.signalTextColor || this.textColor; + this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder; + this.labelTextColor = this.labelTextColor || this.actorTextColor; + this.loopTextColor = this.loopTextColor || this.actorTextColor; + this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10); + this.activationBkgColor = this.activationBkgColor || this.secondaryColor; + this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor); + this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor; + this.altSectionBkgColor = this.altSectionBkgColor || "white"; + this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor; + this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor; + this.excludeBkgColor = this.excludeBkgColor || "#eeeeee"; + this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor; + this.taskBkgColor = this.taskBkgColor || this.primaryColor; + this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor; + this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(this.primaryColor, 23); + this.gridColor = this.gridColor || "lightgrey"; + this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey"; + this.doneTaskBorderColor = this.doneTaskBorderColor || "grey"; + this.critBorderColor = this.critBorderColor || "#ff8888"; + this.critBkgColor = this.critBkgColor || "red"; + this.todayLineColor = this.todayLineColor || "red"; + this.vertLineColor = this.vertLineColor || "navy"; + this.taskTextColor = this.taskTextColor || this.textColor; + this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor; + this.taskTextLightColor = this.taskTextLightColor || this.textColor; + this.taskTextColor = this.taskTextColor || this.primaryTextColor; + this.taskTextDarkColor = this.taskTextDarkColor || this.textColor; + this.taskTextClickableColor = this.taskTextClickableColor || "#003163"; + this.noteFontWeight = this.noteFontWeight || "normal"; + this.fontWeight = this.fontWeight || "normal"; + this.personBorder = this.personBorder || this.primaryBorderColor; + this.personBkg = this.personBkg || this.mainBkg; + if (this.darkMode) { + this.rowOdd = this.rowOdd || darken_default(this.mainBkg, 5) || "#ffffff"; + this.rowEven = this.rowEven || darken_default(this.mainBkg, 10); + } else { + this.rowOdd = this.rowOdd || lighten_default(this.mainBkg, 75) || "#ffffff"; + this.rowEven = this.rowEven || lighten_default(this.mainBkg, 5); + } + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || this.tertiaryColor; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.nodeBorder; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.specialStateColor = this.lineColor; + this.cScale0 = this.cScale0 || this.primaryColor; + this.cScale1 = this.cScale1 || this.secondaryColor; + this.cScale2 = this.cScale2 || this.tertiaryColor; + this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 }); + this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 }); + this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 }); + this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 }); + this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 }); + this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210, l: 150 }); + this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 }); + this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 }); + this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 }); + if (this.darkMode) { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 75); + } + } else { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 25); + } + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + if (this.darkMode) { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10); + } else { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10); + } + } + this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor; + } + const multiplier = this.darkMode ? -4 : -1; + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) }); + } + this.classText = this.classText || this.textColor; + this.fillType0 = this.fillType0 || this.primaryColor; + this.fillType1 = this.fillType1 || this.secondaryColor; + this.fillType2 = this.fillType2 || adjust_default(this.primaryColor, { h: 64 }); + this.fillType3 = this.fillType3 || adjust_default(this.secondaryColor, { h: 64 }); + this.fillType4 = this.fillType4 || adjust_default(this.primaryColor, { h: -64 }); + this.fillType5 = this.fillType5 || adjust_default(this.secondaryColor, { h: -64 }); + this.fillType6 = this.fillType6 || adjust_default(this.primaryColor, { h: 128 }); + this.fillType7 = this.fillType7 || adjust_default(this.secondaryColor, { h: 128 }); + this.pie1 = this.pie1 || this.primaryColor; + this.pie2 = this.pie2 || this.secondaryColor; + this.pie3 = this.pie3 || this.tertiaryColor; + this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 }); + this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -10 }); + this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -10 }); + this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 }); + this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 }); + this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 }); + this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -20 }); + this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -20 }); + this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -10 }); + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + this.venn1 = this.venn1 ?? adjust_default(this.primaryColor, { l: -30 }); + this.venn2 = this.venn2 ?? adjust_default(this.secondaryColor, { l: -30 }); + this.venn3 = this.venn3 ?? adjust_default(this.tertiaryColor, { l: -30 }); + this.venn4 = this.venn4 ?? adjust_default(this.primaryColor, { h: 60, l: -30 }); + this.venn5 = this.venn5 ?? adjust_default(this.primaryColor, { h: -60, l: -30 }); + this.venn6 = this.venn6 ?? adjust_default(this.secondaryColor, { h: 60, l: -30 }); + this.venn7 = this.venn7 ?? adjust_default(this.primaryColor, { h: 120, l: -30 }); + this.venn8 = this.venn8 ?? adjust_default(this.secondaryColor, { h: 120, l: -30 }); + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.radar = { + axisColor: this.radar?.axisColor || this.lineColor, + axisStrokeWidth: this.radar?.axisStrokeWidth || 2, + axisLabelFontSize: this.radar?.axisLabelFontSize || 12, + curveOpacity: this.radar?.curveOpacity || 0.5, + curveStrokeWidth: this.radar?.curveStrokeWidth || 2, + graticuleColor: this.radar?.graticuleColor || "#DEDEDE", + graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1, + graticuleOpacity: this.radar?.graticuleOpacity || 0.3, + legendBoxSize: this.radar?.legendBoxSize || 12, + legendFontSize: this.radar?.legendFontSize || 12 + }; + this.wardleyEvolutionColor = this.wardleyEvolutionColor || "#dc3545"; + this.wardley = { + backgroundColor: this.wardley?.backgroundColor || this.background, + axisColor: this.wardley?.axisColor || this.lineColor, + axisTextColor: this.wardley?.axisTextColor || this.primaryTextColor, + gridColor: this.wardley?.gridColor || this.gridColor, + componentFill: this.wardley?.componentFill || this.background, + componentStroke: this.wardley?.componentStroke || this.lineColor, + componentLabelColor: this.wardley?.componentLabelColor || this.primaryTextColor, + linkStroke: this.wardley?.linkStroke || this.lineColor, + evolutionStroke: this.wardley?.evolutionStroke || this.wardleyEvolutionColor, + annotationStroke: this.wardley?.annotationStroke || this.lineColor, + annotationTextColor: this.wardley?.annotationTextColor || this.primaryTextColor, + annotationFill: this.wardley?.annotationFill || this.background + }; + this.archEdgeColor = this.archEdgeColor || "#777"; + this.archEdgeArrowColor = this.archEdgeArrowColor || "#777"; + this.archEdgeWidth = this.archEdgeWidth || "3"; + this.archGroupBorderColor = this.archGroupBorderColor || "#000"; + this.archGroupBorderWidth = this.archGroupBorderWidth || "2px"; + this.quadrant1Fill = this.quadrant1Fill || this.primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0" + }; + this.requirementBackground = this.requirementBackground || this.primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.git0 = this.git0 || this.primaryColor; + this.git1 = this.git1 || this.secondaryColor; + this.git2 = this.git2 || this.tertiaryColor; + this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 }); + this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 }); + this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 }); + this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 }); + this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 }); + if (this.darkMode) { + this.git0 = lighten_default(this.git0, 25); + this.git1 = lighten_default(this.git1, 25); + this.git2 = lighten_default(this.git2, 25); + this.git3 = lighten_default(this.git3, 25); + this.git4 = lighten_default(this.git4, 25); + this.git5 = lighten_default(this.git5, 25); + this.git6 = lighten_default(this.git6, 25); + this.git7 = lighten_default(this.git7, 25); + } else { + this.git0 = darken_default(this.git0, 25); + this.git1 = darken_default(this.git1, 25); + this.git2 = darken_default(this.git2, 25); + this.git3 = darken_default(this.git3, 25); + this.git4 = darken_default(this.git4, 25); + this.git5 = darken_default(this.git5, 25); + this.git6 = darken_default(this.git6, 25); + this.git7 = darken_default(this.git7, 25); + } + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor); + this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor; + this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor; + this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.emUiFill = this.emUiFill || "white"; + this.emUiStroke = this.emUiStroke || "#dbdada"; + this.emProcessorFill = this.emProcessorFill || "#edb3f6"; + this.emProcessorStroke = this.emProcessorStroke || "#b88cbf"; + this.emReadModelFill = this.emReadModelFill || "#d3f1a2"; + this.emReadModelStroke = this.emReadModelStroke || "#a3b732"; + this.emCommandFill = this.emCommandFill || "#bcd6fe"; + this.emCommandStroke = this.emCommandStroke || "#679ac3"; + this.emEventFill = this.emEventFill || "#ffb778"; + this.emEventStroke = this.emEventStroke || "#c19a0f"; + this.emSwimlaneBackgroundOdd = this.emSwimlaneBackgroundOdd || "rgb(250,250,250)"; + this.emSwimlaneBackgroundStroke = this.emSwimlaneBackgroundStroke || "rgb(240,240,240)"; + this.emArrowhead = this.emArrowhead || this.lineColor; + this.emRelationStroke = this.emRelationStroke || this.lineColor; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + this.gradientStart = this.primaryBorderColor; + this.gradientStop = this.secondaryBorderColor; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-dark.js + var Theme2, getThemeVariables2; + var init_theme_dark = __esm({ + "src/themes/theme-dark.js"() { + "use strict"; + init_dist(); + init_theme_helpers(); + Theme2 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#333"; + this.primaryColor = "#1f2020"; + this.secondaryColor = lighten_default(this.primaryColor, 16); + this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 }); + this.primaryBorderColor = invert_default(this.background); + this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode); + this.primaryTextColor = invert_default(this.primaryColor); + this.secondaryTextColor = invert_default(this.secondaryColor); + this.tertiaryTextColor = invert_default(this.tertiaryColor); + this.lineColor = invert_default(this.background); + this.textColor = invert_default(this.background); + this.mainBkg = "#1f2020"; + this.secondBkg = "calculated"; + this.mainContrastColor = "lightgrey"; + this.darkTextColor = lighten_default(invert_default("#323D47"), 10); + this.lineColor = "calculated"; + this.border1 = "#ccc"; + this.border2 = rgba_default(255, 255, 255, 0.25); + this.arrowheadColor = "calculated"; + this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; + this.fontSize = "16px"; + this.labelBackground = "#181818"; + this.textColor = "#ccc"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 5; + this.strokeWidth = 1; + this.nodeBkg = "calculated"; + this.nodeBorder = "calculated"; + this.clusterBkg = "calculated"; + this.clusterBorder = "calculated"; + this.defaultLinkColor = "calculated"; + this.titleColor = "#F9FFFE"; + this.edgeLabelBackground = "calculated"; + this.actorBorder = "calculated"; + this.actorBkg = "calculated"; + this.actorTextColor = "calculated"; + this.actorLineColor = "calculated"; + this.signalColor = "calculated"; + this.signalTextColor = "calculated"; + this.labelBoxBkgColor = "calculated"; + this.labelBoxBorderColor = "calculated"; + this.labelTextColor = "calculated"; + this.loopTextColor = "calculated"; + this.noteBorderColor = "calculated"; + this.noteBkgColor = "#fff5ad"; + this.noteTextColor = "calculated"; + this.activationBorderColor = "calculated"; + this.activationBkgColor = "calculated"; + this.sequenceNumberColor = "black"; + this.clusterBkg = "#302F3D"; + this.sectionBkgColor = darken_default("#EAE8D9", 30); + this.altSectionBkgColor = "calculated"; + this.sectionBkgColor2 = "#EAE8D9"; + this.excludeBkgColor = darken_default(this.sectionBkgColor, 10); + this.taskBorderColor = rgba_default(255, 255, 255, 70); + this.taskBkgColor = "calculated"; + this.taskTextColor = "calculated"; + this.taskTextLightColor = "calculated"; + this.taskTextOutsideColor = "calculated"; + this.taskTextClickableColor = "#003163"; + this.activeTaskBorderColor = rgba_default(255, 255, 255, 50); + this.activeTaskBkgColor = "#81B1DB"; + this.gridColor = "calculated"; + this.doneTaskBkgColor = "calculated"; + this.doneTaskBorderColor = "grey"; + this.critBorderColor = "#E83737"; + this.critBkgColor = "#E83737"; + this.taskTextDarkColor = "calculated"; + this.todayLineColor = "#DB5757"; + this.vertLineColor = "#00BFFF"; + this.personBorder = this.primaryBorderColor; + this.personBkg = this.mainBkg; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.rowOdd = this.rowOdd || lighten_default(this.mainBkg, 5) || "#ffffff"; + this.rowEven = this.rowEven || darken_default(this.mainBkg, 10); + this.labelColor = "calculated"; + this.errorBkgColor = "#a44141"; + this.errorTextColor = "#ddd"; + this.useGradient = true; + this.gradientStart = this.primaryBorderColor; + this.gradientStop = this.secondaryBorderColor; + this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,1))"; + this.noteFontWeight = this.noteFontWeight || "normal"; + this.fontWeight = this.fontWeight || "normal"; + } + updateColors() { + this.secondBkg = lighten_default(this.mainBkg, 16); + this.lineColor = this.mainContrastColor; + this.arrowheadColor = this.mainContrastColor; + this.nodeBkg = this.mainBkg; + this.nodeBorder = this.border1; + this.clusterBkg = this.secondBkg; + this.clusterBorder = this.border2; + this.defaultLinkColor = this.lineColor; + this.edgeLabelBackground = lighten_default(this.labelBackground, 25); + this.actorBorder = this.border1; + this.actorBkg = this.mainBkg; + this.actorTextColor = this.mainContrastColor; + this.actorLineColor = this.actorBorder; + this.signalColor = this.mainContrastColor; + this.signalTextColor = this.mainContrastColor; + this.labelBoxBkgColor = this.actorBkg; + this.labelBoxBorderColor = this.actorBorder; + this.labelTextColor = this.mainContrastColor; + this.loopTextColor = this.mainContrastColor; + this.noteBorderColor = this.secondaryBorderColor; + this.noteBkgColor = this.secondBkg; + this.noteTextColor = this.secondaryTextColor; + this.activationBorderColor = this.border1; + this.activationBkgColor = this.secondBkg; + this.altSectionBkgColor = this.background; + this.taskBkgColor = lighten_default(this.mainBkg, 23); + this.taskTextColor = this.darkTextColor; + this.taskTextLightColor = this.mainContrastColor; + this.taskTextOutsideColor = this.taskTextLightColor; + this.gridColor = this.mainContrastColor; + this.doneTaskBkgColor = this.mainContrastColor; + this.taskTextDarkColor = invert_default(this.doneTaskBkgColor); + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#555"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.primaryBorderColor; + this.specialStateColor = "#f4f4f4"; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.fillType0 = this.primaryColor; + this.fillType1 = this.secondaryColor; + this.fillType2 = adjust_default(this.primaryColor, { h: 64 }); + this.fillType3 = adjust_default(this.secondaryColor, { h: 64 }); + this.fillType4 = adjust_default(this.primaryColor, { h: -64 }); + this.fillType5 = adjust_default(this.secondaryColor, { h: -64 }); + this.fillType6 = adjust_default(this.primaryColor, { h: 128 }); + this.fillType7 = adjust_default(this.secondaryColor, { h: 128 }); + this.cScale1 = this.cScale1 || "#0b0000"; + this.cScale2 = this.cScale2 || "#4d1037"; + this.cScale3 = this.cScale3 || "#3f5258"; + this.cScale4 = this.cScale4 || "#4f2f1b"; + this.cScale5 = this.cScale5 || "#6e0a0a"; + this.cScale6 = this.cScale6 || "#3b0048"; + this.cScale7 = this.cScale7 || "#995a01"; + this.cScale8 = this.cScale8 || "#154706"; + this.cScale9 = this.cScale9 || "#161722"; + this.cScale10 = this.cScale10 || "#00296f"; + this.cScale11 = this.cScale11 || "#01629c"; + this.cScale12 = this.cScale12 || "#010029"; + this.cScale0 = this.cScale0 || this.primaryColor; + this.cScale1 = this.cScale1 || this.secondaryColor; + this.cScale2 = this.cScale2 || this.tertiaryColor; + this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 }); + this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 }); + this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 }); + this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 }); + this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 }); + this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210 }); + this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 }); + this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 }); + this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 }); + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10); + } + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 30, s: -30, l: -(-10 + i2 * 4) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 30, s: -30, l: -(-7 + i2 * 4) }); + } + this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor); + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor; + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["pie" + i2] = this["cScale" + i2]; + } + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.mainContrastColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.mainContrastColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + for (let i2 = 0; i2 < 8; i2++) { + this["venn" + (i2 + 1)] = this["venn" + (i2 + 1)] ?? lighten_default(this["cScale" + i2], 30); + } + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || this.primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22" + }; + this.packet = { + startByteColor: this.primaryTextColor, + endByteColor: this.primaryTextColor, + labelColor: this.primaryTextColor, + titleColor: this.primaryTextColor, + blockStrokeColor: this.primaryTextColor, + blockFillColor: this.background + }; + this.radar = { + axisColor: this.radar?.axisColor || this.lineColor, + axisStrokeWidth: this.radar?.axisStrokeWidth || 2, + axisLabelFontSize: this.radar?.axisLabelFontSize || 12, + curveOpacity: this.radar?.curveOpacity || 0.5, + curveStrokeWidth: this.radar?.curveStrokeWidth || 2, + graticuleColor: this.radar?.graticuleColor || "#DEDEDE", + graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1, + graticuleOpacity: this.radar?.graticuleOpacity || 0.3, + legendBoxSize: this.radar?.legendBoxSize || 12, + legendFontSize: this.radar?.legendFontSize || 12 + }; + this.wardleyEvolutionColor = this.wardleyEvolutionColor || "#ff6b6b"; + this.wardley = { + backgroundColor: this.wardley?.backgroundColor || this.background, + axisColor: this.wardley?.axisColor || this.lineColor, + axisTextColor: this.wardley?.axisTextColor || this.primaryTextColor, + gridColor: this.wardley?.gridColor || this.gridColor, + componentFill: this.wardley?.componentFill || this.mainBkg, + componentStroke: this.wardley?.componentStroke || this.lineColor, + componentLabelColor: this.wardley?.componentLabelColor || this.primaryTextColor, + linkStroke: this.wardley?.linkStroke || this.lineColor, + evolutionStroke: this.wardley?.evolutionStroke || this.wardleyEvolutionColor, + annotationStroke: this.wardley?.annotationStroke || this.lineColor, + annotationTextColor: this.wardley?.annotationTextColor || this.primaryTextColor, + annotationFill: this.wardley?.annotationFill || this.mainBkg + }; + this.classText = this.primaryTextColor; + this.requirementBackground = this.requirementBackground || this.primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.git0 = lighten_default(this.secondaryColor, 20); + this.git1 = lighten_default(this.pie2 || this.secondaryColor, 20); + this.git2 = lighten_default(this.pie3 || this.tertiaryColor, 20); + this.git3 = lighten_default(this.pie4 || adjust_default(this.primaryColor, { h: -30 }), 20); + this.git4 = lighten_default(this.pie5 || adjust_default(this.primaryColor, { h: -60 }), 20); + this.git5 = lighten_default(this.pie6 || adjust_default(this.primaryColor, { h: -90 }), 10); + this.git6 = lighten_default(this.pie7 || adjust_default(this.primaryColor, { h: 60 }), 10); + this.git7 = lighten_default(this.pie8 || adjust_default(this.primaryColor, { h: 120 }), 20); + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.gitBranchLabel0 = this.gitBranchLabel0 || invert_default(this.labelTextColor); + this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || invert_default(this.labelTextColor); + this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.emUiFill = this.emUiFill || "#2d2d2d"; + this.emUiStroke = this.emUiStroke || "#555"; + this.emProcessorFill = this.emProcessorFill || lighten_default("#5a3d5c", 10); + this.emProcessorStroke = this.emProcessorStroke || "#8a6d8c"; + this.emReadModelFill = this.emReadModelFill || lighten_default("#3d5a2d", 10); + this.emReadModelStroke = this.emReadModelStroke || "#6d8c5c"; + this.emCommandFill = this.emCommandFill || lighten_default("#2d3d5a", 10); + this.emCommandStroke = this.emCommandStroke || "#5c6d8c"; + this.emEventFill = this.emEventFill || lighten_default("#5a452d", 10); + this.emEventStroke = this.emEventStroke || "#8c755c"; + this.emSwimlaneBackgroundOdd = this.emSwimlaneBackgroundOdd || lighten_default(this.background, 5); + this.emSwimlaneBackgroundStroke = this.emSwimlaneBackgroundStroke || lighten_default(this.background, 12); + this.emArrowhead = this.emArrowhead || this.lineColor; + this.emRelationStroke = this.emRelationStroke || this.lineColor; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || lighten_default(this.background, 12); + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || lighten_default(this.background, 2); + this.nodeBorder = this.nodeBorder || "#999"; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables2 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme2(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-default.js + var Theme3, getThemeVariables3; + var init_theme_default = __esm({ + "src/themes/theme-default.js"() { + "use strict"; + init_dist(); + init_theme_helpers(); + init_erDiagram_oldHardcodedValues(); + Theme3 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#f4f4f4"; + this.primaryColor = "#ECECFF"; + this.secondaryColor = adjust_default(this.primaryColor, { h: 120 }); + this.secondaryColor = "#ffffde"; + this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 }); + this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode); + this.primaryTextColor = invert_default(this.primaryColor); + this.secondaryTextColor = invert_default(this.secondaryColor); + this.tertiaryTextColor = invert_default(this.tertiaryColor); + this.lineColor = invert_default(this.background); + this.textColor = invert_default(this.background); + this.background = "white"; + this.mainBkg = "#ECECFF"; + this.secondBkg = "#ffffde"; + this.lineColor = "#333333"; + this.border1 = "#9370DB"; + this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode); + this.border2 = "#aaaa33"; + this.arrowheadColor = "#333333"; + this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; + this.fontSize = "16px"; + this.labelBackground = "rgba(232,232,232, 0.8)"; + this.textColor = "#333"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 5; + this.strokeWidth = 1; + this.nodeBkg = "calculated"; + this.nodeBorder = "calculated"; + this.clusterBkg = "calculated"; + this.clusterBorder = "calculated"; + this.defaultLinkColor = "calculated"; + this.titleColor = "calculated"; + this.edgeLabelBackground = "calculated"; + this.actorBorder = "calculated"; + this.actorBkg = "calculated"; + this.actorTextColor = "black"; + this.actorLineColor = "calculated"; + this.signalColor = "calculated"; + this.signalTextColor = "calculated"; + this.labelBoxBkgColor = "calculated"; + this.labelBoxBorderColor = "calculated"; + this.labelTextColor = "calculated"; + this.loopTextColor = "calculated"; + this.noteBorderColor = "calculated"; + this.noteBkgColor = "#fff5ad"; + this.noteTextColor = "calculated"; + this.activationBorderColor = "#666"; + this.activationBkgColor = "#f4f4f4"; + this.sequenceNumberColor = "white"; + this.clusterBkg = "#FBFBFF"; + this.sectionBkgColor = "calculated"; + this.altSectionBkgColor = "calculated"; + this.sectionBkgColor2 = "calculated"; + this.excludeBkgColor = "#eeeeee"; + this.taskBorderColor = "calculated"; + this.taskBkgColor = "calculated"; + this.taskTextLightColor = "calculated"; + this.taskTextColor = this.taskTextLightColor; + this.taskTextDarkColor = "calculated"; + this.taskTextOutsideColor = this.taskTextDarkColor; + this.taskTextClickableColor = "calculated"; + this.activeTaskBorderColor = "calculated"; + this.activeTaskBkgColor = "calculated"; + this.gridColor = "calculated"; + this.doneTaskBkgColor = "calculated"; + this.doneTaskBorderColor = "calculated"; + this.critBorderColor = "calculated"; + this.critBkgColor = "calculated"; + this.todayLineColor = "calculated"; + this.vertLineColor = "calculated"; + this.sectionBkgColor = rgba_default(102, 102, 255, 0.49); + this.altSectionBkgColor = "white"; + this.sectionBkgColor2 = "#fff400"; + this.taskBorderColor = "#534fbc"; + this.taskBkgColor = "#8a90dd"; + this.taskTextLightColor = "white"; + this.taskTextColor = "calculated"; + this.taskTextDarkColor = "black"; + this.taskTextOutsideColor = "calculated"; + this.taskTextClickableColor = "#003163"; + this.activeTaskBorderColor = "#534fbc"; + this.activeTaskBkgColor = "#bfc7ff"; + this.gridColor = "lightgrey"; + this.doneTaskBkgColor = "lightgrey"; + this.doneTaskBorderColor = "grey"; + this.critBorderColor = "#ff8888"; + this.critBkgColor = "red"; + this.todayLineColor = "red"; + this.vertLineColor = "navy"; + this.noteFontWeight = this.noteFontWeight || "normal"; + this.fontWeight = this.fontWeight || "normal"; + this.personBorder = this.primaryBorderColor; + this.personBkg = this.mainBkg; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.rowOdd = "calculated"; + this.rowEven = "calculated"; + this.labelColor = "black"; + this.errorBkgColor = "#552222"; + this.errorTextColor = "#552222"; + this.useGradient = false; + this.gradientStart = this.primaryBorderColor; + this.gradientStop = this.secondaryBorderColor; + this.dropShadow = "drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))"; + this.updateColors(); + } + updateColors() { + this.cScale0 = this.cScale0 || this.primaryColor; + this.cScale1 = this.cScale1 || this.secondaryColor; + this.cScale2 = this.cScale2 || this.tertiaryColor; + this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 }); + this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 }); + this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 }); + this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 }); + this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 }); + this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210 }); + this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 }); + this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 }); + this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 }); + this["cScalePeer1"] = this["cScalePeer1"] || darken_default(this.secondaryColor, 45); + this["cScalePeer2"] = this["cScalePeer2"] || darken_default(this.tertiaryColor, 40); + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 10); + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 25); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || adjust_default(this["cScale" + i2], { h: 180 }); + } + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 30, l: -(5 + i2 * 5) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 30, l: -(7 + i2 * 5) }); + } + this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor; + if (this.labelTextColor !== "calculated") { + this.cScaleLabel0 = this.cScaleLabel0 || invert_default(this.labelTextColor); + this.cScaleLabel3 = this.cScaleLabel3 || invert_default(this.labelTextColor); + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.labelTextColor; + } + } + this.nodeBkg = this.mainBkg; + this.nodeBorder = this.border1; + this.clusterBkg = this.secondBkg; + this.clusterBorder = this.border2; + this.defaultLinkColor = this.lineColor; + this.titleColor = this.textColor; + this.edgeLabelBackground = this.labelBackground; + this.actorBorder = this.border1; + this.actorBkg = this.mainBkg; + this.labelBoxBkgColor = this.actorBkg; + this.signalColor = this.textColor; + this.signalTextColor = this.textColor; + this.labelBoxBorderColor = this.actorBorder; + this.labelTextColor = this.actorTextColor; + this.loopTextColor = this.actorTextColor; + this.noteBorderColor = this.border2; + this.noteTextColor = this.actorTextColor; + this.actorLineColor = this.actorBorder; + this.taskTextColor = this.taskTextLightColor; + this.taskTextOutsideColor = this.taskTextDarkColor; + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.rowOdd = this.rowOdd || lighten_default(this.primaryColor, 75) || "#ffffff"; + this.rowEven = this.rowEven || lighten_default(this.primaryColor, 1); + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#f0f0f0"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.nodeBorder; + this.specialStateColor = this.lineColor; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.classText = this.primaryTextColor; + this.fillType0 = this.primaryColor; + this.fillType1 = this.secondaryColor; + this.fillType2 = adjust_default(this.primaryColor, { h: 64 }); + this.fillType3 = adjust_default(this.secondaryColor, { h: 64 }); + this.fillType4 = adjust_default(this.primaryColor, { h: -64 }); + this.fillType5 = adjust_default(this.secondaryColor, { h: -64 }); + this.fillType6 = adjust_default(this.primaryColor, { h: 128 }); + this.fillType7 = adjust_default(this.secondaryColor, { h: 128 }); + this.pie1 = this.pie1 || this.primaryColor; + this.pie2 = this.pie2 || this.secondaryColor; + this.pie3 = this.pie3 || adjust_default(this.tertiaryColor, { l: -40 }); + this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 }); + this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -30 }); + this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -20 }); + this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -20 }); + this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -40 }); + this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: -40 }); + this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -40 }); + this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -90, l: -40 }); + this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -30 }); + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + this.venn1 = this.venn1 ?? adjust_default(this.primaryColor, { l: -30 }); + this.venn2 = this.venn2 ?? adjust_default(this.secondaryColor, { l: -30 }); + this.venn3 = this.venn3 ?? adjust_default(this.tertiaryColor, { l: -40 }); + this.venn4 = this.venn4 ?? adjust_default(this.primaryColor, { h: 60, l: -30 }); + this.venn5 = this.venn5 ?? adjust_default(this.primaryColor, { h: -60, l: -30 }); + this.venn6 = this.venn6 ?? adjust_default(this.secondaryColor, { h: 60, l: -30 }); + this.venn7 = this.venn7 ?? adjust_default(this.primaryColor, { h: 120, l: -30 }); + this.venn8 = this.venn8 ?? adjust_default(this.secondaryColor, { h: 120, l: -30 }); + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || this.primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.radar = { + axisColor: this.radar?.axisColor || this.lineColor, + axisStrokeWidth: this.radar?.axisStrokeWidth || 2, + axisLabelFontSize: this.radar?.axisLabelFontSize || 12, + curveOpacity: this.radar?.curveOpacity || 0.5, + curveStrokeWidth: this.radar?.curveStrokeWidth || 2, + graticuleColor: this.radar?.graticuleColor || "#DEDEDE", + graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1, + graticuleOpacity: this.radar?.graticuleOpacity || 0.3, + legendBoxSize: this.radar?.legendBoxSize || 12, + legendFontSize: this.radar?.legendFontSize || 12 + }; + this.wardleyEvolutionColor = this.wardleyEvolutionColor || "#dc3545"; + this.wardley = { + backgroundColor: this.wardley?.backgroundColor || this.background, + axisColor: this.wardley?.axisColor || this.lineColor, + axisTextColor: this.wardley?.axisTextColor || this.primaryTextColor, + gridColor: this.wardley?.gridColor || this.gridColor, + componentFill: this.wardley?.componentFill || this.background, + componentStroke: this.wardley?.componentStroke || this.lineColor, + componentLabelColor: this.wardley?.componentLabelColor || this.primaryTextColor, + linkStroke: this.wardley?.linkStroke || this.lineColor, + evolutionStroke: this.wardley?.evolutionStroke || this.wardleyEvolutionColor, + annotationStroke: this.wardley?.annotationStroke || this.lineColor, + annotationTextColor: this.wardley?.annotationTextColor || this.primaryTextColor, + annotationFill: this.wardley?.annotationFill || this.background + }; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3" + }; + this.requirementBackground = this.requirementBackground || this.primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || this.labelBackground; + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.git0 = this.git0 || this.primaryColor; + this.git1 = this.git1 || this.secondaryColor; + this.git2 = this.git2 || this.tertiaryColor; + this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 }); + this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 }); + this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 }); + this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 }); + this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 }); + if (this.darkMode) { + this.git0 = lighten_default(this.git0, 25); + this.git1 = lighten_default(this.git1, 25); + this.git2 = lighten_default(this.git2, 25); + this.git3 = lighten_default(this.git3, 25); + this.git4 = lighten_default(this.git4, 25); + this.git5 = lighten_default(this.git5, 25); + this.git6 = lighten_default(this.git6, 25); + this.git7 = lighten_default(this.git7, 25); + } else { + this.git0 = darken_default(this.git0, 25); + this.git1 = darken_default(this.git1, 25); + this.git2 = darken_default(this.git2, 25); + this.git3 = darken_default(this.git3, 25); + this.git4 = darken_default(this.git4, 25); + this.git5 = darken_default(this.git5, 25); + this.git6 = darken_default(this.git6, 25); + this.git7 = darken_default(this.git7, 25); + } + this.gitInv0 = this.gitInv0 || darken_default(invert_default(this.git0), 25); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.gitBranchLabel0 = this.gitBranchLabel0 || invert_default(this.labelTextColor); + this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || invert_default(this.labelTextColor); + this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.emUiFill = this.emUiFill || "white"; + this.emUiStroke = this.emUiStroke || "#dbdada"; + this.emProcessorFill = this.emProcessorFill || "#edb3f6"; + this.emProcessorStroke = this.emProcessorStroke || "#b88cbf"; + this.emReadModelFill = this.emReadModelFill || "#d3f1a2"; + this.emReadModelStroke = this.emReadModelStroke || "#a3b732"; + this.emCommandFill = this.emCommandFill || "#bcd6fe"; + this.emCommandStroke = this.emCommandStroke || "#679ac3"; + this.emEventFill = this.emEventFill || "#ffb778"; + this.emEventStroke = this.emEventStroke || "#c19a0f"; + this.emSwimlaneBackgroundOdd = this.emSwimlaneBackgroundOdd || "rgb(250,250,250)"; + this.emSwimlaneBackgroundStroke = this.emSwimlaneBackgroundStroke || "rgb(240,240,240)"; + this.emArrowhead = this.emArrowhead || this.lineColor; + this.emRelationStroke = this.emRelationStroke || this.lineColor; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + } + calculate(overrides) { + Object.keys(this).forEach((k2) => { + if (this[k2] === "calculated") { + this[k2] = void 0; + } + }); + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables3 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme3(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-forest.js + var Theme4, getThemeVariables4; + var init_theme_forest = __esm({ + "src/themes/theme-forest.js"() { + "use strict"; + init_dist(); + init_erDiagram_oldHardcodedValues(); + init_theme_helpers(); + Theme4 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#f4f4f4"; + this.primaryColor = "#cde498"; + this.secondaryColor = "#cdffb2"; + this.background = "white"; + this.mainBkg = "#cde498"; + this.secondBkg = "#cdffb2"; + this.lineColor = "green"; + this.border1 = "#13540c"; + this.border2 = "#6eaa49"; + this.arrowheadColor = "green"; + this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; + this.fontSize = "16px"; + this.tertiaryColor = lighten_default("#cde498", 10); + this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode); + this.primaryTextColor = invert_default(this.primaryColor); + this.secondaryTextColor = invert_default(this.secondaryColor); + this.tertiaryTextColor = invert_default(this.primaryColor); + this.lineColor = invert_default(this.background); + this.textColor = invert_default(this.background); + this.THEME_COLOR_LIMIT = 12; + this.radius = 5; + this.strokeWidth = 1; + this.nodeBkg = "calculated"; + this.nodeBorder = "calculated"; + this.clusterBkg = "calculated"; + this.clusterBorder = "calculated"; + this.defaultLinkColor = "calculated"; + this.titleColor = "#333"; + this.edgeLabelBackground = "#e8e8e8"; + this.actorBorder = "calculated"; + this.actorBkg = "calculated"; + this.actorTextColor = "black"; + this.actorLineColor = "calculated"; + this.signalColor = "#333"; + this.signalTextColor = "#333"; + this.labelBoxBkgColor = "calculated"; + this.labelBoxBorderColor = "#326932"; + this.labelTextColor = "calculated"; + this.loopTextColor = "calculated"; + this.noteBorderColor = "calculated"; + this.noteBkgColor = "#fff5ad"; + this.noteTextColor = "calculated"; + this.activationBorderColor = "#666"; + this.activationBkgColor = "#f4f4f4"; + this.sequenceNumberColor = "white"; + this.sectionBkgColor = "#6eaa49"; + this.altSectionBkgColor = "white"; + this.sectionBkgColor2 = "#6eaa49"; + this.excludeBkgColor = "#eeeeee"; + this.taskBorderColor = "calculated"; + this.taskBkgColor = "#487e3a"; + this.taskTextLightColor = "white"; + this.taskTextColor = "calculated"; + this.taskTextDarkColor = "black"; + this.taskTextOutsideColor = "calculated"; + this.taskTextClickableColor = "#003163"; + this.activeTaskBorderColor = "calculated"; + this.activeTaskBkgColor = "calculated"; + this.gridColor = "lightgrey"; + this.doneTaskBkgColor = "lightgrey"; + this.doneTaskBorderColor = "grey"; + this.critBorderColor = "#ff8888"; + this.critBkgColor = "red"; + this.todayLineColor = "red"; + this.vertLineColor = "#00BFFF"; + this.personBorder = this.primaryBorderColor; + this.personBkg = this.mainBkg; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.noteFontWeight = "normal"; + this.fontWeight = "normal"; + this.labelColor = "black"; + this.errorBkgColor = "#552222"; + this.errorTextColor = "#552222"; + this.useGradient = true; + this.gradientStart = this.primaryBorderColor; + this.gradientStop = this.secondaryBorderColor; + this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"; + } + updateColors() { + this.actorBorder = darken_default(this.mainBkg, 20); + this.actorBkg = this.mainBkg; + this.labelBoxBkgColor = this.actorBkg; + this.labelTextColor = this.actorTextColor; + this.loopTextColor = this.actorTextColor; + this.noteBorderColor = this.border2; + this.noteTextColor = this.actorTextColor; + this.actorLineColor = this.actorBorder; + this.cScale0 = this.cScale0 || this.primaryColor; + this.cScale1 = this.cScale1 || this.secondaryColor; + this.cScale2 = this.cScale2 || this.tertiaryColor; + this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 }); + this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 }); + this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 }); + this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 }); + this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 }); + this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210 }); + this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 }); + this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 }); + this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 }); + this["cScalePeer1"] = this["cScalePeer1"] || darken_default(this.secondaryColor, 45); + this["cScalePeer2"] = this["cScalePeer2"] || darken_default(this.tertiaryColor, 40); + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 10); + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 25); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || adjust_default(this["cScale" + i2], { h: 180 }); + } + this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor; + } + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 30, s: -30, l: -(5 + i2 * 5) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 30, s: -30, l: -(8 + i2 * 5) }); + } + this.nodeBkg = this.mainBkg; + this.nodeBorder = this.border1; + this.clusterBkg = this.secondBkg; + this.clusterBorder = this.border2; + this.defaultLinkColor = this.lineColor; + this.taskBorderColor = this.border1; + this.taskTextColor = this.taskTextLightColor; + this.taskTextOutsideColor = this.taskTextDarkColor; + this.activeTaskBorderColor = this.taskBorderColor; + this.activeTaskBkgColor = this.mainBkg; + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.rowOdd = this.rowOdd || lighten_default(this.mainBkg, 75) || "#ffffff"; + this.rowEven = this.rowEven || lighten_default(this.mainBkg, 20); + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#f0f0f0"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.primaryBorderColor; + this.specialStateColor = this.lineColor; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.classText = this.primaryTextColor; + this.fillType0 = this.primaryColor; + this.fillType1 = this.secondaryColor; + this.fillType2 = adjust_default(this.primaryColor, { h: 64 }); + this.fillType3 = adjust_default(this.secondaryColor, { h: 64 }); + this.fillType4 = adjust_default(this.primaryColor, { h: -64 }); + this.fillType5 = adjust_default(this.secondaryColor, { h: -64 }); + this.fillType6 = adjust_default(this.primaryColor, { h: 128 }); + this.fillType7 = adjust_default(this.secondaryColor, { h: 128 }); + this.pie1 = this.pie1 || this.primaryColor; + this.pie2 = this.pie2 || this.secondaryColor; + this.pie3 = this.pie3 || this.tertiaryColor; + this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -30 }); + this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -30 }); + this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { h: 40, l: -40 }); + this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 }); + this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 }); + this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 }); + this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -50 }); + this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -50 }); + this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -50 }); + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + this.venn1 = this.venn1 ?? adjust_default(this.primaryColor, { l: -30 }); + this.venn2 = this.venn2 ?? adjust_default(this.secondaryColor, { l: -30 }); + this.venn3 = this.venn3 ?? adjust_default(this.tertiaryColor, { l: -30 }); + this.venn4 = this.venn4 ?? adjust_default(this.primaryColor, { h: 60, l: -30 }); + this.venn5 = this.venn5 ?? adjust_default(this.primaryColor, { h: -60, l: -30 }); + this.venn6 = this.venn6 ?? adjust_default(this.secondaryColor, { h: 60, l: -30 }); + this.venn7 = this.venn7 ?? adjust_default(this.primaryColor, { h: 120, l: -30 }); + this.venn8 = this.venn8 ?? adjust_default(this.secondaryColor, { h: 120, l: -30 }); + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || this.primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.packet = { + startByteColor: this.primaryTextColor, + endByteColor: this.primaryTextColor, + labelColor: this.primaryTextColor, + titleColor: this.primaryTextColor, + blockStrokeColor: this.primaryTextColor, + blockFillColor: this.mainBkg + }; + this.radar = { + axisColor: this.radar?.axisColor || this.lineColor, + axisStrokeWidth: this.radar?.axisStrokeWidth || 2, + axisLabelFontSize: this.radar?.axisLabelFontSize || 12, + curveOpacity: this.radar?.curveOpacity || 0.5, + curveStrokeWidth: this.radar?.curveStrokeWidth || 2, + graticuleColor: this.radar?.graticuleColor || "#DEDEDE", + graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1, + graticuleOpacity: this.radar?.graticuleOpacity || 0.3, + legendBoxSize: this.radar?.legendBoxSize || 12, + legendFontSize: this.radar?.legendFontSize || 12 + }; + this.wardleyEvolutionColor = this.wardleyEvolutionColor || "#dc3545"; + this.wardley = { + backgroundColor: this.wardley?.backgroundColor || this.background, + axisColor: this.wardley?.axisColor || this.lineColor, + axisTextColor: this.wardley?.axisTextColor || this.primaryTextColor, + gridColor: this.wardley?.gridColor || this.gridColor, + componentFill: this.wardley?.componentFill || this.background, + componentStroke: this.wardley?.componentStroke || this.lineColor, + componentLabelColor: this.wardley?.componentLabelColor || this.primaryTextColor, + linkStroke: this.wardley?.linkStroke || this.lineColor, + evolutionStroke: this.wardley?.evolutionStroke || this.wardleyEvolutionColor, + annotationStroke: this.wardley?.annotationStroke || this.lineColor, + annotationTextColor: this.wardley?.annotationTextColor || this.primaryTextColor, + annotationFill: this.wardley?.annotationFill || this.background + }; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176" + }; + this.requirementBackground = this.requirementBackground || this.primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground; + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.git0 = this.git0 || this.primaryColor; + this.git1 = this.git1 || this.secondaryColor; + this.git2 = this.git2 || this.tertiaryColor; + this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 }); + this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 }); + this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 }); + this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 }); + this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 }); + if (this.darkMode) { + this.git0 = lighten_default(this.git0, 25); + this.git1 = lighten_default(this.git1, 25); + this.git2 = lighten_default(this.git2, 25); + this.git3 = lighten_default(this.git3, 25); + this.git4 = lighten_default(this.git4, 25); + this.git5 = lighten_default(this.git5, 25); + this.git6 = lighten_default(this.git6, 25); + this.git7 = lighten_default(this.git7, 25); + } else { + this.git0 = darken_default(this.git0, 25); + this.git1 = darken_default(this.git1, 25); + this.git2 = darken_default(this.git2, 25); + this.git3 = darken_default(this.git3, 25); + this.git4 = darken_default(this.git4, 25); + this.git5 = darken_default(this.git5, 25); + this.git6 = darken_default(this.git6, 25); + this.git7 = darken_default(this.git7, 25); + } + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.gitBranchLabel0 = this.gitBranchLabel0 || invert_default(this.labelTextColor); + this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || invert_default(this.labelTextColor); + this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.emUiFill = this.emUiFill || "white"; + this.emUiStroke = this.emUiStroke || "#dbdada"; + this.emProcessorFill = this.emProcessorFill || "#edb3f6"; + this.emProcessorStroke = this.emProcessorStroke || "#b88cbf"; + this.emReadModelFill = this.emReadModelFill || "#d3f1a2"; + this.emReadModelStroke = this.emReadModelStroke || "#a3b732"; + this.emCommandFill = this.emCommandFill || "#bcd6fe"; + this.emCommandStroke = this.emCommandStroke || "#679ac3"; + this.emEventFill = this.emEventFill || "#ffb778"; + this.emEventStroke = this.emEventStroke || "#c19a0f"; + this.emSwimlaneBackgroundOdd = this.emSwimlaneBackgroundOdd || "rgb(250,250,250)"; + this.emSwimlaneBackgroundStroke = this.emSwimlaneBackgroundStroke || "rgb(240,240,240)"; + this.emArrowhead = this.emArrowhead || this.lineColor; + this.emRelationStroke = this.emRelationStroke || this.lineColor; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables4 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme4(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-neutral.js + var Theme5, getThemeVariables5; + var init_theme_neutral = __esm({ + "src/themes/theme-neutral.js"() { + "use strict"; + init_dist(); + init_theme_helpers(); + init_erDiagram_oldHardcodedValues(); + Theme5 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.primaryColor = "#eee"; + this.contrast = "#707070"; + this.secondaryColor = lighten_default(this.contrast, 55); + this.background = "#ffffff"; + this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 }); + this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode); + this.primaryTextColor = invert_default(this.primaryColor); + this.secondaryTextColor = invert_default(this.secondaryColor); + this.tertiaryTextColor = invert_default(this.tertiaryColor); + this.lineColor = invert_default(this.background); + this.textColor = invert_default(this.background); + this.mainBkg = "#eee"; + this.secondBkg = "calculated"; + this.lineColor = "#666"; + this.border1 = "#999"; + this.border2 = "calculated"; + this.note = "#ffa"; + this.text = "#333"; + this.critical = "#d42"; + this.done = "#bbb"; + this.arrowheadColor = "#333333"; + this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif'; + this.fontSize = "16px"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 5; + this.strokeWidth = 1; + this.nodeBkg = "calculated"; + this.nodeBorder = "calculated"; + this.clusterBkg = "calculated"; + this.clusterBorder = "calculated"; + this.defaultLinkColor = "calculated"; + this.titleColor = "calculated"; + this.edgeLabelBackground = "white"; + this.actorBorder = "calculated"; + this.actorBkg = "calculated"; + this.actorTextColor = "calculated"; + this.actorLineColor = this.actorBorder; + this.signalColor = "calculated"; + this.signalTextColor = "calculated"; + this.labelBoxBkgColor = "calculated"; + this.labelBoxBorderColor = "calculated"; + this.labelTextColor = "calculated"; + this.loopTextColor = "calculated"; + this.noteBorderColor = "calculated"; + this.noteBkgColor = "calculated"; + this.noteTextColor = "calculated"; + this.activationBorderColor = "#666"; + this.activationBkgColor = "#f4f4f4"; + this.sequenceNumberColor = "white"; + this.sectionBkgColor = "calculated"; + this.altSectionBkgColor = "white"; + this.sectionBkgColor2 = "calculated"; + this.excludeBkgColor = "#eeeeee"; + this.taskBorderColor = "calculated"; + this.taskBkgColor = "calculated"; + this.taskTextLightColor = "white"; + this.taskTextColor = "calculated"; + this.taskTextDarkColor = "calculated"; + this.taskTextOutsideColor = "calculated"; + this.taskTextClickableColor = "#003163"; + this.activeTaskBorderColor = "calculated"; + this.activeTaskBkgColor = "calculated"; + this.gridColor = "calculated"; + this.doneTaskBkgColor = "calculated"; + this.doneTaskBorderColor = "calculated"; + this.critBkgColor = "calculated"; + this.critBorderColor = "calculated"; + this.todayLineColor = "calculated"; + this.vertLineColor = "calculated"; + this.personBorder = this.primaryBorderColor; + this.personBkg = this.mainBkg; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.noteFontWeight = "normal"; + this.fontWeight = "normal"; + this.rowOdd = this.rowOdd || lighten_default(this.mainBkg, 75) || "#ffffff"; + this.rowEven = this.rowEven || "#f4f4f4"; + this.labelColor = "black"; + this.errorBkgColor = "#552222"; + this.errorTextColor = "#552222"; + this.useGradient = true; + this.gradientStart = this.primaryBorderColor; + this.gradientStop = this.secondaryBorderColor; + this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,1))"; + } + updateColors() { + this.secondBkg = lighten_default(this.contrast, 55); + this.border2 = this.contrast; + this.actorBorder = lighten_default(this.border1, 23); + this.actorBkg = this.mainBkg; + this.actorTextColor = this.text; + this.actorLineColor = this.actorBorder; + this.signalColor = this.text; + this.signalTextColor = this.text; + this.labelBoxBkgColor = this.actorBkg; + this.labelBoxBorderColor = this.actorBorder; + this.labelTextColor = this.text; + this.loopTextColor = this.text; + this.noteBorderColor = "#999"; + this.noteBkgColor = "#666"; + this.noteTextColor = "#fff"; + this.cScale0 = this.cScale0 || "#555"; + this.cScale1 = this.cScale1 || "#F4F4F4"; + this.cScale2 = this.cScale2 || "#555"; + this.cScale3 = this.cScale3 || "#BBB"; + this.cScale4 = this.cScale4 || "#777"; + this.cScale5 = this.cScale5 || "#999"; + this.cScale6 = this.cScale6 || "#DDD"; + this.cScale7 = this.cScale7 || "#FFF"; + this.cScale8 = this.cScale8 || "#DDD"; + this.cScale9 = this.cScale9 || "#BBB"; + this.cScale10 = this.cScale10 || "#999"; + this.cScale11 = this.cScale11 || "#777"; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + if (this.darkMode) { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10); + } else { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10); + } + } + this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor); + this.cScaleLabel0 = this.cScaleLabel0 || this.cScale1; + this.cScaleLabel2 = this.cScaleLabel2 || this.cScale1; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor; + } + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { l: -(5 + i2 * 5) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { l: -(8 + i2 * 5) }); + } + this.nodeBkg = this.mainBkg; + this.nodeBorder = this.border1; + this.clusterBkg = this.secondBkg; + this.clusterBorder = this.border2; + this.defaultLinkColor = this.lineColor; + this.titleColor = this.text; + this.sectionBkgColor = lighten_default(this.contrast, 30); + this.sectionBkgColor2 = lighten_default(this.contrast, 30); + this.taskBorderColor = darken_default(this.contrast, 10); + this.taskBkgColor = this.contrast; + this.taskTextColor = this.taskTextLightColor; + this.taskTextDarkColor = this.text; + this.taskTextOutsideColor = this.taskTextDarkColor; + this.activeTaskBorderColor = this.taskBorderColor; + this.activeTaskBkgColor = this.mainBkg; + this.gridColor = lighten_default(this.border1, 30); + this.doneTaskBkgColor = this.done; + this.doneTaskBorderColor = this.lineColor; + this.critBkgColor = this.critical; + this.critBorderColor = darken_default(this.critBkgColor, 10); + this.todayLineColor = this.critBkgColor; + this.vertLineColor = this.critBkgColor; + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.transitionColor = this.transitionColor || "#000"; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#f4f4f4"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.stateBorder = this.stateBorder || "#000"; + this.innerEndBackground = this.primaryBorderColor; + this.specialStateColor = "#222"; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.classText = this.primaryTextColor; + this.fillType0 = this.primaryColor; + this.fillType1 = this.secondaryColor; + this.fillType2 = adjust_default(this.primaryColor, { h: 64 }); + this.fillType3 = adjust_default(this.secondaryColor, { h: 64 }); + this.fillType4 = adjust_default(this.primaryColor, { h: -64 }); + this.fillType5 = adjust_default(this.secondaryColor, { h: -64 }); + this.fillType6 = adjust_default(this.primaryColor, { h: 128 }); + this.fillType7 = adjust_default(this.secondaryColor, { h: 128 }); + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["pie" + i2] = this["cScale" + i2]; + } + this.pie12 = this.pie0; + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + for (let i2 = 0; i2 < 8; i2++) { + this["venn" + (i2 + 1)] = this["venn" + (i2 + 1)] ?? this["cScale" + i2]; + } + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || this.primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + dataLabelColor: this.xyChart?.dataLabelColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0" + }; + this.radar = { + axisColor: this.radar?.axisColor || this.lineColor, + axisStrokeWidth: this.radar?.axisStrokeWidth || 2, + axisLabelFontSize: this.radar?.axisLabelFontSize || 12, + curveOpacity: this.radar?.curveOpacity || 0.5, + curveStrokeWidth: this.radar?.curveStrokeWidth || 2, + graticuleColor: this.radar?.graticuleColor || "#DEDEDE", + graticuleStrokeWidth: this.radar?.graticuleStrokeWidth || 1, + graticuleOpacity: this.radar?.graticuleOpacity || 0.3, + legendBoxSize: this.radar?.legendBoxSize || 12, + legendFontSize: this.radar?.legendFontSize || 12 + }; + this.wardleyEvolutionColor = this.wardleyEvolutionColor || "#dc3545"; + this.wardley = { + backgroundColor: this.wardley?.backgroundColor || this.background, + axisColor: this.wardley?.axisColor || this.lineColor, + axisTextColor: this.wardley?.axisTextColor || this.primaryTextColor, + gridColor: this.wardley?.gridColor || this.gridColor, + componentFill: this.wardley?.componentFill || this.background, + componentStroke: this.wardley?.componentStroke || this.lineColor, + componentLabelColor: this.wardley?.componentLabelColor || this.primaryTextColor, + linkStroke: this.wardley?.linkStroke || this.lineColor, + evolutionStroke: this.wardley?.evolutionStroke || this.wardleyEvolutionColor, + annotationStroke: this.wardley?.annotationStroke || this.lineColor, + annotationTextColor: this.wardley?.annotationTextColor || this.primaryTextColor, + annotationFill: this.wardley?.annotationFill || this.background + }; + this.requirementBackground = this.requirementBackground || this.primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground; + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.git0 = darken_default(this.pie1, 25) || this.primaryColor; + this.git1 = this.pie2 || this.secondaryColor; + this.git2 = this.pie3 || this.tertiaryColor; + this.git3 = this.pie4 || adjust_default(this.primaryColor, { h: -30 }); + this.git4 = this.pie5 || adjust_default(this.primaryColor, { h: -60 }); + this.git5 = this.pie6 || adjust_default(this.primaryColor, { h: -90 }); + this.git6 = this.pie7 || adjust_default(this.primaryColor, { h: 60 }); + this.git7 = this.pie8 || adjust_default(this.primaryColor, { h: 120 }); + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.branchLabelColor = this.branchLabelColor || this.labelTextColor; + this.gitBranchLabel0 = this.branchLabelColor; + this.gitBranchLabel1 = "white"; + this.gitBranchLabel2 = this.branchLabelColor; + this.gitBranchLabel3 = "white"; + this.gitBranchLabel4 = this.branchLabelColor; + this.gitBranchLabel5 = this.branchLabelColor; + this.gitBranchLabel6 = this.branchLabelColor; + this.gitBranchLabel7 = this.branchLabelColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.emUiFill = this.emUiFill || "white"; + this.emUiStroke = this.emUiStroke || "#dbdada"; + this.emProcessorFill = this.emProcessorFill || "#edb3f6"; + this.emProcessorStroke = this.emProcessorStroke || "#b88cbf"; + this.emReadModelFill = this.emReadModelFill || "#d3f1a2"; + this.emReadModelStroke = this.emReadModelStroke || "#a3b732"; + this.emCommandFill = this.emCommandFill || "#bcd6fe"; + this.emCommandStroke = this.emCommandStroke || "#679ac3"; + this.emEventFill = this.emEventFill || "#ffb778"; + this.emEventStroke = this.emEventStroke || "#c19a0f"; + this.emSwimlaneBackgroundOdd = this.emSwimlaneBackgroundOdd || "rgb(250,250,250)"; + this.emSwimlaneBackgroundStroke = this.emSwimlaneBackgroundStroke || "rgb(240,240,240)"; + this.emArrowhead = this.emArrowhead || this.lineColor; + this.emRelationStroke = this.emRelationStroke || this.lineColor; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables5 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme5(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-neo.js + var Theme6, getThemeVariables6; + var init_theme_neo = __esm({ + "src/themes/theme-neo.js"() { + "use strict"; + init_dist(); + init_theme_helpers(); + init_erDiagram_oldHardcodedValues(); + Theme6 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#ffffff"; + this.primaryColor = "#cccccc"; + this.mainBkg = "#ffffff"; + this.noteBkgColor = "#fff5ad"; + this.noteTextColor = "#333"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 3; + this.strokeWidth = 2; + this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode); + this.fontFamily = "arial, sans-serif"; + this.fontSize = "14px"; + this.nodeBorder = "#000000"; + this.stateBorder = "#000000"; + this.useGradient = true; + this.gradientStart = "#0042eb"; + this.gradientStop = "#eb0042"; + this.dropShadow = "drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));"; + this.tertiaryColor = "#ffffff"; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.noteFontWeight = "normal"; + this.fontWeight = "normal"; + } + updateColors() { + this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333"); + this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 }); + this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 }); + this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode); + this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode); + this.noteBkgColor = this.noteBkgColor || "#fff5ad"; + this.noteTextColor = this.noteTextColor || "#333"; + this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor); + this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor); + this.lineColor = this.lineColor || invert_default(this.background); + this.arrowheadColor = this.arrowheadColor || invert_default(this.background); + this.textColor = this.textColor || this.primaryTextColor; + this.border2 = this.border2 || this.tertiaryBorderColor; + this.nodeBkg = this.nodeBkg || this.primaryColor; + this.mainBkg = this.mainBkg || this.primaryColor; + this.nodeBorder = this.nodeBorder || this.primaryBorderColor; + this.clusterBkg = this.clusterBkg || this.tertiaryColor; + this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor; + this.defaultLinkColor = this.defaultLinkColor || this.lineColor; + this.titleColor = this.titleColor || this.tertiaryTextColor; + this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.nodeTextColor = this.nodeTextColor || this.primaryTextColor; + this.actorBorder = this.actorBorder || this.primaryBorderColor; + this.actorBkg = this.actorBkg || this.mainBkg; + this.actorTextColor = this.actorTextColor || this.primaryTextColor; + this.actorLineColor = this.actorLineColor || this.actorBorder; + this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg; + this.signalColor = this.signalColor || this.textColor; + this.signalTextColor = this.signalTextColor || this.textColor; + this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder; + this.labelTextColor = this.labelTextColor || this.actorTextColor; + this.loopTextColor = this.loopTextColor || this.actorTextColor; + this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10); + this.activationBkgColor = this.activationBkgColor || this.secondaryColor; + this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor); + const primaryColor = "#ECECFE"; + const secondaryColor = "#E9E9F1"; + const tertiaryColor = adjust_default(primaryColor, { h: 180, l: 5 }); + this.sectionBkgColor = this.sectionBkgColor || tertiaryColor; + this.altSectionBkgColor = this.altSectionBkgColor || "white"; + this.sectionBkgColor = this.sectionBkgColor || secondaryColor; + this.sectionBkgColor2 = this.sectionBkgColor2 || primaryColor; + this.excludeBkgColor = this.excludeBkgColor || "#eeeeee"; + this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor; + this.taskBkgColor = this.taskBkgColor || primaryColor; + this.activeTaskBorderColor = this.activeTaskBorderColor || primaryColor; + this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(primaryColor, 23); + this.gridColor = this.gridColor || "lightgrey"; + this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey"; + this.doneTaskBorderColor = this.doneTaskBorderColor || "grey"; + this.critBorderColor = this.critBorderColor || "#ff8888"; + this.critBkgColor = this.critBkgColor || "red"; + this.todayLineColor = this.todayLineColor || "red"; + this.taskTextColor = this.taskTextColor || this.textColor; + this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor; + this.vertLineColor = this.vertLineColor || this.primaryBorderColor; + this.taskTextLightColor = this.taskTextLightColor || this.textColor; + this.taskTextColor = this.taskTextColor || this.primaryTextColor; + this.taskTextDarkColor = this.taskTextDarkColor || this.textColor; + this.taskTextClickableColor = this.taskTextClickableColor || "#003163"; + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.personBorder = this.personBorder || this.primaryBorderColor; + this.personBkg = this.personBkg || this.mainBkg; + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#f0f0f0"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.nodeBorder; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.specialStateColor = this.lineColor; + this.cScale0 = this.cScale0 || primaryColor; + this.cScale1 = this.cScale1 || secondaryColor; + this.cScale2 = this.cScale2 || tertiaryColor; + this.cScale3 = this.cScale3 || adjust_default(primaryColor, { h: 30 }); + this.cScale4 = this.cScale4 || adjust_default(primaryColor, { h: 60 }); + this.cScale5 = this.cScale5 || adjust_default(primaryColor, { h: 90 }); + this.cScale6 = this.cScale6 || adjust_default(primaryColor, { h: 120 }); + this.cScale7 = this.cScale7 || adjust_default(primaryColor, { h: 150 }); + this.cScale8 = this.cScale8 || adjust_default(primaryColor, { h: 210, l: 150 }); + this.cScale9 = this.cScale9 || adjust_default(primaryColor, { h: 270 }); + this.cScale10 = this.cScale10 || adjust_default(primaryColor, { h: 300 }); + this.cScale11 = this.cScale11 || adjust_default(primaryColor, { h: 330 }); + if (this.darkMode) { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 75); + } + } else { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 25); + } + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + if (this.darkMode) { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10); + } else { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10); + } + } + this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor; + } + const multiplier = this.darkMode ? -4 : -1; + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) }); + } + this.classText = this.classText || this.textColor; + this.fillType0 = this.fillType0 || primaryColor; + this.fillType1 = this.fillType1 || secondaryColor; + this.fillType2 = this.fillType2 || adjust_default(primaryColor, { h: 64 }); + this.fillType3 = this.fillType3 || adjust_default(secondaryColor, { h: 64 }); + this.fillType4 = this.fillType4 || adjust_default(primaryColor, { h: -64 }); + this.fillType5 = this.fillType5 || adjust_default(secondaryColor, { h: -64 }); + this.fillType6 = this.fillType6 || adjust_default(primaryColor, { h: 128 }); + this.fillType7 = this.fillType7 || adjust_default(secondaryColor, { h: 128 }); + this.pie1 = this.pie1 || primaryColor; + this.pie2 = this.pie2 || secondaryColor; + this.pie3 = this.pie3 || tertiaryColor; + this.pie4 = this.pie4 || adjust_default(primaryColor, { l: -10 }); + this.pie5 = this.pie5 || adjust_default(secondaryColor, { l: -10 }); + this.pie6 = this.pie6 || adjust_default(tertiaryColor, { l: -10 }); + this.pie7 = this.pie7 || adjust_default(primaryColor, { h: 60, l: -10 }); + this.pie8 = this.pie8 || adjust_default(primaryColor, { h: -60, l: -10 }); + this.pie9 = this.pie9 || adjust_default(primaryColor, { h: 120, l: 0 }); + this.pie10 = this.pie10 || adjust_default(primaryColor, { h: 60, l: -20 }); + this.pie11 = this.pie11 || adjust_default(primaryColor, { h: -60, l: -20 }); + this.pie12 = this.pie12 || adjust_default(primaryColor, { h: 120, l: -10 }); + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0" + }; + this.requirementBackground = this.requirementBackground || primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.git0 = this.git0 || primaryColor; + this.git1 = this.git1 || secondaryColor; + this.git2 = this.git2 || tertiaryColor; + this.git3 = this.git3 || adjust_default(primaryColor, { h: -30 }); + this.git4 = this.git4 || adjust_default(primaryColor, { h: -60 }); + this.git5 = this.git5 || adjust_default(primaryColor, { h: -90 }); + this.git6 = this.git6 || adjust_default(primaryColor, { h: 60 }); + this.git7 = this.git7 || adjust_default(primaryColor, { h: 120 }); + if (this.darkMode) { + this.git0 = lighten_default(this.git0, 25); + this.git1 = lighten_default(this.git1, 25); + this.git2 = lighten_default(this.git2, 25); + this.git3 = lighten_default(this.git3, 25); + this.git4 = lighten_default(this.git4, 25); + this.git5 = lighten_default(this.git5, 25); + this.git6 = lighten_default(this.git6, 25); + this.git7 = lighten_default(this.git7, 25); + } else { + this.git0 = darken_default(this.git0, 25); + this.git1 = darken_default(this.git1, 25); + this.git2 = darken_default(this.git2, 25); + this.git3 = darken_default(this.git3, 25); + this.git4 = darken_default(this.git4, 25); + this.git5 = darken_default(this.git5, 25); + this.git6 = darken_default(this.git6, 25); + this.git7 = darken_default(this.git7, 25); + } + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor); + this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor; + this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor; + this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables6 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme6(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-neo-dark.js + var Theme7, getThemeVariables7; + var init_theme_neo_dark = __esm({ + "src/themes/theme-neo-dark.js"() { + "use strict"; + init_dist(); + init_theme_helpers(); + init_erDiagram_oldHardcodedValues(); + Theme7 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#333"; + this.primaryColor = "#1f2020"; + this.secondaryColor = lighten_default(this.primaryColor, 16); + this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 }); + this.primaryBorderColor = invert_default(this.background); + this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode); + this.primaryTextColor = invert_default(this.primaryColor); + this.secondaryTextColor = invert_default(this.secondaryColor); + this.tertiaryTextColor = invert_default(this.tertiaryColor); + this.mainBkg = "#2a2020"; + this.secondBkg = "calculated"; + this.mainContrastColor = "lightgrey"; + this.darkTextColor = lighten_default(invert_default("#323D47"), 10); + this.border1 = "#ccc"; + this.border2 = rgba_default(255, 255, 255, 0.25); + this.arrowheadColor = invert_default(this.background); + this.fontFamily = "arial, sans-serif"; + this.fontSize = "14px"; + this.labelBackground = "#181818"; + this.textColor = "#ccc"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 3; + this.strokeWidth = 1; + this.noteBkgColor = "#fff5ad"; + this.noteTextColor = "#333"; + this.THEME_COLOR_LIMIT = 12; + this.fontFamily = "arial, sans-serif"; + this.fontSize = "14px"; + this.useGradient = true; + this.gradientStart = "#0042eb"; + this.gradientStop = "#eb0042"; + this.dropShadow = "drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))"; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.noteFontWeight = "normal"; + this.fontWeight = "normal"; + } + updateColors() { + this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333"); + this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 }); + this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 }); + this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode); + this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode); + this.noteBkgColor = this.noteBkgColor || "#fff5ad"; + this.noteTextColor = this.noteTextColor || "#333"; + this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor); + this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor); + this.lineColor = this.lineColor || invert_default(this.background); + this.arrowheadColor = this.arrowheadColor || invert_default(this.background); + this.textColor = this.textColor || this.primaryTextColor; + this.border2 = this.border2 || this.tertiaryBorderColor; + this.nodeBkg = this.nodeBkg || this.primaryColor; + this.mainBkg = this.mainBkg || this.primaryColor; + this.nodeBorder = this.nodeBorder || this.border1; + this.clusterBkg = this.clusterBkg || this.tertiaryColor; + this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor; + this.defaultLinkColor = this.defaultLinkColor || this.lineColor; + this.titleColor = this.titleColor || this.tertiaryTextColor; + this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.nodeTextColor = this.nodeTextColor || this.primaryTextColor; + this.actorBorder = this.actorBorder || this.primaryBorderColor; + this.actorBkg = this.actorBkg || this.mainBkg; + this.actorTextColor = this.actorTextColor || this.primaryTextColor; + this.actorLineColor = this.actorLineColor || this.actorBorder; + this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg; + this.signalColor = this.signalColor || this.textColor; + this.signalTextColor = this.signalTextColor || this.textColor; + this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder; + this.labelTextColor = this.labelTextColor || this.actorTextColor; + this.loopTextColor = this.loopTextColor || this.actorTextColor; + this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10); + this.activationBkgColor = this.activationBkgColor || this.secondaryColor; + this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor); + this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor; + this.altSectionBkgColor = this.altSectionBkgColor || "white"; + this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor; + this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor; + this.excludeBkgColor = this.excludeBkgColor || "#eeeeee"; + this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor; + this.taskBkgColor = this.taskBkgColor || this.primaryColor; + this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor; + this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(this.primaryColor, 23); + this.gridColor = this.gridColor || "lightgrey"; + this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey"; + this.doneTaskBorderColor = this.doneTaskBorderColor || "grey"; + this.critBorderColor = this.critBorderColor || "#ff8888"; + this.critBkgColor = this.critBkgColor || "red"; + this.todayLineColor = this.todayLineColor || "red"; + this.vertLineColor = this.vertLineColor || this.primaryBorderColor; + this.taskTextColor = this.taskTextColor || this.textColor; + this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor; + this.taskTextLightColor = this.taskTextLightColor || this.textColor; + this.taskTextColor = this.taskTextColor || this.primaryTextColor; + this.taskTextDarkColor = this.taskTextDarkColor || this.textColor; + this.taskTextClickableColor = this.taskTextClickableColor || "#003163"; + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.personBorder = this.personBorder || this.primaryBorderColor; + this.personBkg = this.personBkg || this.mainBkg; + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#f0f0f0"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.nodeBorder; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.specialStateColor = this.lineColor; + this.cScale0 = this.cScale0 || this.primaryColor; + this.cScale1 = this.cScale1 || this.secondaryColor; + this.cScale2 = this.cScale2 || this.tertiaryColor; + this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 }); + this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 }); + this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 }); + this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 }); + this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 }); + this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210, l: 150 }); + this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 }); + this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 }); + this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 }); + if (this.darkMode) { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 75); + } + } else { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 25); + } + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + if (this.darkMode) { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10); + } else { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10); + } + } + this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor; + } + const multiplier = this.darkMode ? -4 : -1; + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) }); + } + this.classText = this.classText || this.textColor; + this.fillType0 = this.fillType0 || this.primaryColor; + this.fillType1 = this.fillType1 || this.secondaryColor; + this.fillType2 = this.fillType2 || adjust_default(this.primaryColor, { h: 64 }); + this.fillType3 = this.fillType3 || adjust_default(this.secondaryColor, { h: 64 }); + this.fillType4 = this.fillType4 || adjust_default(this.primaryColor, { h: -64 }); + this.fillType5 = this.fillType5 || adjust_default(this.secondaryColor, { h: -64 }); + this.fillType6 = this.fillType6 || adjust_default(this.primaryColor, { h: 128 }); + this.fillType7 = this.fillType7 || adjust_default(this.secondaryColor, { h: 128 }); + this.pie1 = this.pie1 || this.primaryColor; + this.pie2 = this.pie2 || this.secondaryColor; + this.pie3 = this.pie3 || this.tertiaryColor; + this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 }); + this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -10 }); + this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -10 }); + this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 }); + this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 }); + this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 }); + this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -20 }); + this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -20 }); + this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -10 }); + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || this.primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0" + }; + this.requirementBackground = this.requirementBackground || this.primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.git0 = this.git0 || "#0b0000"; + this.git1 = this.git1 || "#4d1037"; + this.git2 = this.git2 || "#3f5258"; + this.git3 = this.git3 || "#4f2f1b"; + this.git4 = this.git4 || "#6e0a0a"; + this.git5 = this.git5 || "#3b0048"; + this.git6 = this.git6 || "#995a01"; + this.git7 = this.git7 || "#154706"; + this.gitDarkMode = true; + if (this.gitDarkMode) { + this.git0 = lighten_default(this.git0, 25); + this.git1 = lighten_default(this.git1, 25); + this.git2 = lighten_default(this.git2, 25); + this.git3 = lighten_default(this.git3, 25); + this.git4 = lighten_default(this.git4, 25); + this.git5 = lighten_default(this.git5, 25); + this.git6 = lighten_default(this.git6, 25); + this.git7 = lighten_default(this.git7, 25); + } else { + this.git0 = darken_default(this.git0, 25); + this.git1 = darken_default(this.git1, 25); + this.git2 = darken_default(this.git2, 25); + this.git3 = darken_default(this.git3, 25); + this.git4 = darken_default(this.git4, 25); + this.git5 = darken_default(this.git5, 25); + this.git6 = darken_default(this.git6, 25); + this.git7 = darken_default(this.git7, 25); + } + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor); + this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor; + this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor; + this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables7 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme7(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-redux.js + var Theme8, getThemeVariables8; + var init_theme_redux = __esm({ + "src/themes/theme-redux.js"() { + "use strict"; + init_dist(); + init_theme_helpers(); + init_erDiagram_oldHardcodedValues(); + Theme8 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#ffffff"; + this.primaryColor = "#cccccc"; + this.mainBkg = "#ffffff"; + this.noteBkgColor = "#fff5ad"; + this.noteTextColor = "#28253D"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 12; + this.strokeWidth = 2; + this.primaryBorderColor = mkBorder("#28253D", this.darkMode); + this.fontFamily = '"Recursive Variable", arial, sans-serif'; + this.fontSize = "14px"; + this.nodeBorder = "#28253D"; + this.stateBorder = "#28253D"; + this.useGradient = false; + this.gradientStart = "#0042eb"; + this.gradientStop = "#eb0042"; + this.dropShadow = "url(#drop-shadow)"; + this.nodeShadow = true; + this.tertiaryColor = "#ffffff"; + this.clusterBkg = "#F9F9FB"; + this.clusterBorder = "#BDBCCC"; + this.noteBorderColor = "#FACC15"; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.actorBorder = "#28253D"; + this.filterColor = "#000000"; + } + updateColors() { + this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#28253D"); + this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 }); + this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 }); + this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode); + this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode); + this.noteBkgColor = this.noteBkgColor || "#FEF9C3"; + this.noteTextColor = this.noteTextColor || "#28253D"; + this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor); + this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor); + this.lineColor = this.lineColor || invert_default(this.background); + this.arrowheadColor = this.arrowheadColor || invert_default(this.background); + this.textColor = this.textColor || this.primaryTextColor; + this.border2 = this.border2 || this.tertiaryBorderColor; + this.nodeBkg = this.nodeBkg || this.primaryColor; + this.mainBkg = this.mainBkg || this.primaryColor; + this.nodeBorder = this.nodeBorder || this.primaryBorderColor; + this.clusterBkg = this.clusterBkg || this.tertiaryColor; + this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor; + this.defaultLinkColor = this.defaultLinkColor || this.lineColor; + this.titleColor = this.titleColor || this.tertiaryTextColor; + this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.nodeTextColor = this.nodeTextColor || this.primaryTextColor; + this.noteFontWeight = 600; + this.actorBorder = this.actorBorder || this.primaryBorderColor; + this.actorBkg = this.actorBkg || this.mainBkg; + this.actorTextColor = this.actorTextColor || this.primaryTextColor; + this.actorLineColor = this.actorLineColor || this.actorBorder; + this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg; + this.signalColor = this.signalColor || this.textColor; + this.signalTextColor = this.signalTextColor || this.textColor; + this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder; + this.labelTextColor = this.labelTextColor || this.actorTextColor; + this.loopTextColor = this.loopTextColor || this.actorTextColor; + this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10); + this.activationBkgColor = this.activationBkgColor || this.secondaryColor; + this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor); + const primaryColor = "#ECECFE"; + const secondaryColor = "#E9E9F1"; + const tertiaryColor = adjust_default(primaryColor, { h: 180, l: 5 }); + this.sectionBkgColor = this.sectionBkgColor || tertiaryColor; + this.altSectionBkgColor = this.altSectionBkgColor || "white"; + this.sectionBkgColor = this.sectionBkgColor || secondaryColor; + this.sectionBkgColor2 = this.sectionBkgColor2 || primaryColor; + this.excludeBkgColor = this.excludeBkgColor || "#eeeeee"; + this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor; + this.taskBkgColor = this.taskBkgColor || primaryColor; + this.activeTaskBorderColor = this.activeTaskBorderColor || primaryColor; + this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(primaryColor, 23); + this.gridColor = this.gridColor || "lightgrey"; + this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey"; + this.doneTaskBorderColor = this.doneTaskBorderColor || "grey"; + this.critBorderColor = this.critBorderColor || "#ff8888"; + this.critBkgColor = this.critBkgColor || "red"; + this.todayLineColor = this.todayLineColor || "red"; + this.taskTextColor = this.taskTextColor || this.textColor; + this.vertLineColor = this.vertLineColor || this.primaryBorderColor; + this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor; + this.taskTextLightColor = this.taskTextLightColor || this.textColor; + this.taskTextColor = this.taskTextColor || this.primaryTextColor; + this.taskTextDarkColor = this.taskTextDarkColor || this.textColor; + this.taskTextClickableColor = this.taskTextClickableColor || "#003163"; + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.personBorder = this.personBorder || this.primaryBorderColor; + this.personBkg = this.personBkg || this.mainBkg; + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.compositeTitleBackground = "#F9F9FB"; + this.altBackground = "#F9F9FB"; + this.stateEdgeLabelBackground = "#FFFFFF"; + this.fontWeight = 600; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#f0f0f0"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.nodeBorder; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.specialStateColor = this.lineColor; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = this.mainBkg; + } + if (this.darkMode) { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 75); + } + } else { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 25); + } + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + if (this.darkMode) { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10); + } else { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10); + } + } + this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor; + } + const multiplier = this.darkMode ? -4 : -1; + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) }); + } + this.classText = this.classText || this.textColor; + this.fillType0 = this.fillType0 || primaryColor; + this.fillType1 = this.fillType1 || secondaryColor; + this.fillType2 = this.fillType2 || adjust_default(primaryColor, { h: 64 }); + this.fillType3 = this.fillType3 || adjust_default(secondaryColor, { h: 64 }); + this.fillType4 = this.fillType4 || adjust_default(primaryColor, { h: -64 }); + this.fillType5 = this.fillType5 || adjust_default(secondaryColor, { h: -64 }); + this.fillType6 = this.fillType6 || adjust_default(primaryColor, { h: 128 }); + this.fillType7 = this.fillType7 || adjust_default(secondaryColor, { h: 128 }); + this.pie1 = this.pie1 || primaryColor; + this.pie2 = this.pie2 || secondaryColor; + this.pie3 = this.pie3 || tertiaryColor; + this.pie4 = this.pie4 || adjust_default(primaryColor, { l: -10 }); + this.pie5 = this.pie5 || adjust_default(secondaryColor, { l: -10 }); + this.pie6 = this.pie6 || adjust_default(tertiaryColor, { l: -10 }); + this.pie7 = this.pie7 || adjust_default(primaryColor, { h: 60, l: -10 }); + this.pie8 = this.pie8 || adjust_default(primaryColor, { h: -60, l: -10 }); + this.pie9 = this.pie9 || adjust_default(primaryColor, { h: 120, l: 0 }); + this.pie10 = this.pie10 || adjust_default(primaryColor, { h: 60, l: -20 }); + this.pie11 = this.pie11 || adjust_default(primaryColor, { h: -60, l: -20 }); + this.pie12 = this.pie12 || adjust_default(primaryColor, { h: 120, l: -10 }); + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0" + }; + this.requirementBackground = this.requirementBackground || primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.requirementEdgeLabelBackground = "#FFFFFF"; + this.git0 = this.git0 || primaryColor; + this.git1 = this.git1 || secondaryColor; + this.git2 = this.git2 || tertiaryColor; + this.git3 = this.git3 || adjust_default(primaryColor, { h: -30 }); + this.git4 = this.git4 || adjust_default(primaryColor, { h: -60 }); + this.git5 = this.git5 || adjust_default(primaryColor, { h: -90 }); + this.git6 = this.git6 || adjust_default(primaryColor, { h: 60 }); + this.git7 = this.git7 || adjust_default(primaryColor, { h: 120 }); + if (this.darkMode) { + this.git0 = lighten_default(this.git0, 25); + this.git1 = lighten_default(this.git1, 25); + this.git2 = lighten_default(this.git2, 25); + this.git3 = lighten_default(this.git3, 25); + this.git4 = lighten_default(this.git4, 25); + this.git5 = lighten_default(this.git5, 25); + this.git6 = lighten_default(this.git6, 25); + this.git7 = lighten_default(this.git7, 25); + } else { + this.git0 = darken_default(this.git0, 25); + this.git1 = darken_default(this.git1, 25); + this.git2 = darken_default(this.git2, 25); + this.git3 = darken_default(this.git3, 25); + this.git4 = darken_default(this.git4, 25); + this.git5 = darken_default(this.git5, 25); + this.git6 = darken_default(this.git6, 25); + this.git7 = darken_default(this.git7, 25); + } + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor); + this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor; + this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor; + this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.commitLineColor = this.commitLineColor ?? "#BDBCCC"; + this.erEdgeLabelBackground = "#FFFFFF"; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables8 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme8(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-redux-dark.js + var Theme9, getThemeVariables9; + var init_theme_redux_dark = __esm({ + "src/themes/theme-redux-dark.js"() { + "use strict"; + init_dist(); + init_theme_helpers(); + init_erDiagram_oldHardcodedValues(); + Theme9 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#333"; + this.primaryColor = "#1f2020"; + this.secondaryColor = lighten_default(this.primaryColor, 16); + this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 }); + this.primaryBorderColor = invert_default(this.background); + this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode); + this.primaryTextColor = invert_default(this.primaryColor); + this.secondaryTextColor = invert_default(this.secondaryColor); + this.tertiaryTextColor = invert_default(this.tertiaryColor); + this.mainBkg = "#111113"; + this.secondBkg = "calculated"; + this.mainContrastColor = "lightgrey"; + this.darkTextColor = lighten_default(invert_default("#323D47"), 10); + this.border1 = "#ccc"; + this.border2 = rgba_default(255, 255, 255, 0.25); + this.arrowheadColor = invert_default(this.background); + this.fontFamily = '"Recursive Variable", arial, sans-serif'; + this.fontSize = "14px"; + this.labelBackground = "#111113"; + this.textColor = "#ccc"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 12; + this.strokeWidth = 2; + this.noteBkgColor = this.noteBkgColor ?? "#FEF9C3"; + this.noteTextColor = this.noteTextColor ?? "#28253D"; + this.THEME_COLOR_LIMIT = 12; + this.fontFamily = '"Recursive Variable", arial, sans-serif'; + this.fontSize = "14px"; + this.nodeBorder = "#FFFFFF"; + this.stateBorder = "#FFFFFF"; + this.useGradient = false; + this.gradientStart = "#0042eb"; + this.gradientStop = "#eb0042"; + this.dropShadow = "url(#drop-shadow)"; + this.nodeShadow = true; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.clusterBkg = "#1E1A2E"; + this.clusterBorder = "#BDBCCC"; + this.noteBorderColor = "#FACC15"; + this.noteFontWeight = 600; + this.filterColor = "#FFFFFF"; + } + updateColors() { + this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#FFFFFF"); + this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 }); + this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 }); + this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode); + this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode); + this.noteBkgColor = this.noteBkgColor || "#fff5ad"; + this.noteTextColor = this.noteTextColor || "#FFFFFF"; + this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor); + this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor); + this.lineColor = this.lineColor || invert_default(this.background); + this.arrowheadColor = this.arrowheadColor || invert_default(this.background); + this.textColor = this.textColor || this.primaryTextColor; + this.border2 = this.border2 || this.tertiaryBorderColor; + this.nodeBkg = this.nodeBkg || this.primaryColor; + this.mainBkg = this.mainBkg || this.primaryColor; + this.nodeBorder = this.nodeBorder || this.border1; + this.clusterBkg = this.clusterBkg || this.tertiaryColor; + this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor; + this.defaultLinkColor = this.defaultLinkColor || this.lineColor; + this.titleColor = this.titleColor || this.tertiaryTextColor; + this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.nodeTextColor = this.nodeTextColor || this.primaryTextColor; + this.actorBorder = "#FFFFFF"; + this.signalColor = "#FFFFFF"; + this.labelBoxBorderColor = "#BDBCCC"; + this.actorBorder = this.actorBorder || this.primaryBorderColor; + this.actorBkg = this.actorBkg || this.mainBkg; + this.actorTextColor = this.actorTextColor || this.primaryTextColor; + this.actorLineColor = this.actorLineColor || this.actorBorder; + this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg; + this.signalColor = this.signalColor || this.textColor; + this.signalTextColor = this.signalTextColor || this.textColor; + this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder; + this.labelTextColor = this.labelTextColor || this.actorTextColor; + this.loopTextColor = this.loopTextColor || this.actorTextColor; + this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10); + this.activationBkgColor = this.activationBkgColor || this.secondaryColor; + this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor); + this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor; + this.altSectionBkgColor = this.altSectionBkgColor || "white"; + this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor; + this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor; + this.excludeBkgColor = this.excludeBkgColor || "#eeeeee"; + this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor; + this.taskBkgColor = this.taskBkgColor || this.primaryColor; + this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor; + this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(this.primaryColor, 23); + this.gridColor = this.gridColor || "lightgrey"; + this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey"; + this.doneTaskBorderColor = this.doneTaskBorderColor || "grey"; + this.critBorderColor = this.critBorderColor || "#ff8888"; + this.critBkgColor = this.critBkgColor || "red"; + this.todayLineColor = this.todayLineColor || "red"; + this.taskTextColor = this.taskTextColor || this.textColor; + this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor; + this.taskTextLightColor = this.taskTextLightColor || this.textColor; + this.taskTextColor = this.taskTextColor || this.primaryTextColor; + this.taskTextDarkColor = this.taskTextDarkColor || this.textColor; + this.taskTextClickableColor = this.taskTextClickableColor || "#003163"; + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.personBorder = this.personBorder || this.primaryBorderColor; + this.personBkg = this.personBkg || this.mainBkg; + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.vertLineColor = this.vertLineColor || this.primaryBorderColor; + this.compositeBackground = "#16141F"; + this.altBackground = "#16141F"; + this.compositeTitleBackground = "#16141F"; + this.stateEdgeLabelBackground = "#16141F"; + this.fontWeight = 600; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#f0f0f0"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.nodeBorder; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.specialStateColor = this.lineColor; + this.cScale0 = this.cScale0 || this.primaryColor; + this.cScale1 = this.cScale1 || this.secondaryColor; + this.cScale2 = this.cScale2 || this.tertiaryColor; + this.cScale3 = this.cScale3 || adjust_default(this.primaryColor, { h: 30 }); + this.cScale4 = this.cScale4 || adjust_default(this.primaryColor, { h: 60 }); + this.cScale5 = this.cScale5 || adjust_default(this.primaryColor, { h: 90 }); + this.cScale6 = this.cScale6 || adjust_default(this.primaryColor, { h: 120 }); + this.cScale7 = this.cScale7 || adjust_default(this.primaryColor, { h: 150 }); + this.cScale8 = this.cScale8 || adjust_default(this.primaryColor, { h: 210, l: 150 }); + this.cScale9 = this.cScale9 || adjust_default(this.primaryColor, { h: 270 }); + this.cScale10 = this.cScale10 || adjust_default(this.primaryColor, { h: 300 }); + this.cScale11 = this.cScale11 || adjust_default(this.primaryColor, { h: 330 }); + if (this.darkMode) { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 75); + } + } else { + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScale" + i2] = darken_default(this["cScale" + i2], 25); + } + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + if (this.darkMode) { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10); + } else { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10); + } + } + this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor; + } + const multiplier = this.darkMode ? -4 : -1; + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) }); + } + this.classText = this.classText || this.textColor; + this.fillType0 = this.fillType0 || this.primaryColor; + this.fillType1 = this.fillType1 || this.secondaryColor; + this.fillType2 = this.fillType2 || adjust_default(this.primaryColor, { h: 64 }); + this.fillType3 = this.fillType3 || adjust_default(this.secondaryColor, { h: 64 }); + this.fillType4 = this.fillType4 || adjust_default(this.primaryColor, { h: -64 }); + this.fillType5 = this.fillType5 || adjust_default(this.secondaryColor, { h: -64 }); + this.fillType6 = this.fillType6 || adjust_default(this.primaryColor, { h: 128 }); + this.fillType7 = this.fillType7 || adjust_default(this.secondaryColor, { h: 128 }); + this.pie1 = this.pie1 || this.primaryColor; + this.pie2 = this.pie2 || this.secondaryColor; + this.pie3 = this.pie3 || this.tertiaryColor; + this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 }); + this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -10 }); + this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -10 }); + this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 }); + this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 }); + this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 }); + this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -20 }); + this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -20 }); + this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -10 }); + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || this.primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0" + }; + this.requirementBackground = this.requirementBackground || this.primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.requirementEdgeLabelBackground = "#16141F"; + this.git0 = this.git0 || this.primaryColor; + this.git1 = this.git1 || this.secondaryColor; + this.git2 = this.git2 || this.tertiaryColor; + this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 }); + this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 }); + this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 }); + this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 }); + this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 }); + if (this.darkMode) { + this.git0 = lighten_default(this.git0, 25); + this.git1 = lighten_default(this.git1, 25); + this.git2 = lighten_default(this.git2, 25); + this.git3 = lighten_default(this.git3, 25); + this.git4 = lighten_default(this.git4, 25); + this.git5 = lighten_default(this.git5, 25); + this.git6 = lighten_default(this.git6, 25); + this.git7 = lighten_default(this.git7, 25); + } else { + this.git0 = darken_default(this.git0, 25); + this.git1 = darken_default(this.git1, 25); + this.git2 = darken_default(this.git2, 25); + this.git3 = darken_default(this.git3, 25); + this.git4 = darken_default(this.git4, 25); + this.git5 = darken_default(this.git5, 25); + this.git6 = darken_default(this.git6, 25); + this.git7 = darken_default(this.git7, 25); + } + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor); + this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor; + this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor; + this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.commitLineColor = this.commitLineColor ?? "#BDBCCC"; + this.erEdgeLabelBackground = "#16141F"; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables9 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme9(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-redux-color.js + var Theme10, getThemeVariables10; + var init_theme_redux_color = __esm({ + "src/themes/theme-redux-color.js"() { + "use strict"; + init_dist(); + init_theme_helpers(); + init_erDiagram_oldHardcodedValues(); + Theme10 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#ffffff"; + this.primaryColor = "#cccccc"; + this.mainBkg = "#ffffff"; + this.noteBkgColor = "#fff5ad"; + this.noteTextColor = "#28253D"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 12; + this.strokeWidth = 2; + this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode); + this.fontFamily = '"Recursive Variable", arial, sans-serif'; + this.fontSize = "14px"; + this.nodeBorder = "#28253D"; + this.stateBorder = "#28253D"; + this.useGradient = false; + this.gradientStart = "#0042eb"; + this.gradientStop = "#eb0042"; + this.dropShadow = "url(#drop-shadow)"; + this.nodeShadow = true; + this.tertiaryColor = "#ffffff"; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.actorBorder = "#28253D"; + this.noteBorderColor = "#FACC15"; + this.noteFontWeight = 600; + this.borderColorArray = [ + "#E879F9", + //Fuchsia-400 + "#2DD4BF", + //Teal-400 + "#FB923C", + //Orange-400 + "#22D3EE", + // Cyan-400 + "#4ADE80", + // Green-400 + "#A78BFA", + //Violet-400 + "#F87171", + //red-400 + "#FACC15", + //yellow-400 + "#818CF8", + //indigo-400 + "#A3E635 ", + //Lime-400 + "#38BDF8", + //Sky-400 + "#FB7185" + //Rose-400 + ]; + this.bkgColorArray = [ + "#FDF4FF", + //Fuchsia-50 + "#F0FDFA", + //Teal-50 + "#FFF7ED", + //Orange-50 + "#ECFEFF", + // Cyan-50 + "#F0FDF4", + // Green-50 + "#F5F3FF", + //Violet-50 + "#FEF2F2", + //red-50 + "#FEFCE8", + //yellow-50 + "#EEF2FF", + //indigo-50 + "#F7FEE7", + //Lime-50 + "#F0F9FF", + //Sky-50 + "#FFF1F2" + //Rose-50 + ]; + this.filterColor = "#000000"; + } + updateColors() { + this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#28253D"); + this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 }); + this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 }); + this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode); + this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode); + this.noteBkgColor = this.noteBkgColor || "#fff5ad"; + this.noteTextColor = this.noteTextColor || "#28253D"; + this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor); + this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor); + this.lineColor = this.lineColor || invert_default(this.background); + this.arrowheadColor = this.arrowheadColor || invert_default(this.background); + this.textColor = this.textColor || this.primaryTextColor; + this.border2 = this.border2 || this.tertiaryBorderColor; + this.nodeBkg = this.nodeBkg || this.primaryColor; + this.mainBkg = this.mainBkg || this.primaryColor; + this.nodeBorder = this.nodeBorder || this.primaryBorderColor; + this.clusterBkg = this.clusterBkg || this.tertiaryColor; + this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor; + this.defaultLinkColor = this.defaultLinkColor || this.lineColor; + this.titleColor = this.titleColor || this.tertiaryTextColor; + this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.nodeTextColor = this.nodeTextColor || this.primaryTextColor; + this.actorBorder = this.actorBorder || this.primaryBorderColor; + this.actorBkg = this.actorBkg || this.mainBkg; + this.actorTextColor = this.actorTextColor || this.primaryTextColor; + this.actorLineColor = this.actorLineColor || this.actorBorder; + this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg; + this.signalColor = this.signalColor || this.textColor; + this.signalTextColor = this.signalTextColor || this.textColor; + this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder; + this.labelTextColor = this.labelTextColor || this.actorTextColor; + this.loopTextColor = this.loopTextColor || this.actorTextColor; + this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10); + this.activationBkgColor = this.activationBkgColor || this.secondaryColor; + this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor); + const primaryColor = "#ECECFE"; + const secondaryColor = "#E9E9F1"; + const tertiaryColor = adjust_default(primaryColor, { h: 180, l: 5 }); + this.sectionBkgColor = this.sectionBkgColor || tertiaryColor; + this.altSectionBkgColor = this.altSectionBkgColor || "white"; + this.sectionBkgColor = this.sectionBkgColor || secondaryColor; + this.sectionBkgColor2 = this.sectionBkgColor2 || primaryColor; + this.excludeBkgColor = this.excludeBkgColor || "#eeeeee"; + this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor; + this.taskBkgColor = this.taskBkgColor || primaryColor; + this.activeTaskBorderColor = this.activeTaskBorderColor || primaryColor; + this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(primaryColor, 23); + this.gridColor = this.gridColor || "lightgrey"; + this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey"; + this.doneTaskBorderColor = this.doneTaskBorderColor || "grey"; + this.critBorderColor = this.critBorderColor || "#ff8888"; + this.critBkgColor = this.critBkgColor || "red"; + this.todayLineColor = this.todayLineColor || "red"; + this.taskTextColor = this.taskTextColor || this.textColor; + this.vertLineColor = this.vertLineColor || this.primaryBorderColor; + this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor; + this.taskTextLightColor = this.taskTextLightColor || this.textColor; + this.taskTextColor = this.taskTextColor || this.primaryTextColor; + this.taskTextDarkColor = this.taskTextDarkColor || this.textColor; + this.taskTextClickableColor = this.taskTextClickableColor || "#003163"; + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.personBorder = this.personBorder || this.primaryBorderColor; + this.personBkg = this.personBkg || this.mainBkg; + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#f0f0f0"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.nodeBorder; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.specialStateColor = this.lineColor; + this.cScale0 = this.cScale0 || "#f4a8ff"; + this.cScale1 = this.cScale1 || "#46ecd5"; + this.cScale2 = this.cScale2 || "#ffb86a"; + this.cScale3 = this.cScale3 || "#dab2ff"; + this.cScale4 = this.cScale4 || "#7bf1a8"; + this.cScale5 = this.cScale5 || "#c4b4ff"; + this.cScale6 = this.cScale6 || "#ffa2a2"; + this.cScale7 = this.cScale7 || "#ffdf20"; + this.cScale8 = this.cScale8 || "#a3b3ff"; + this.cScale9 = this.cScale9 || "#bbf451"; + this.cScale10 = this.cScale10 || "#74d4ff"; + this.cScale11 = this.cScale11 || "#ffa1ad"; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + if (this.darkMode) { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10); + } else { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10); + } + } + this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = this["cScaleLabel" + i2] || this.scaleLabelColor; + } + const multiplier = this.darkMode ? -4 : -1; + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) }); + } + this.classText = this.classText || this.textColor; + this.fillType0 = this.fillType0 || primaryColor; + this.fillType1 = this.fillType1 || secondaryColor; + this.fillType2 = this.fillType2 || adjust_default(primaryColor, { h: 64 }); + this.fillType3 = this.fillType3 || adjust_default(secondaryColor, { h: 64 }); + this.fillType4 = this.fillType4 || adjust_default(primaryColor, { h: -64 }); + this.fillType5 = this.fillType5 || adjust_default(secondaryColor, { h: -64 }); + this.fillType6 = this.fillType6 || adjust_default(primaryColor, { h: 128 }); + this.fillType7 = this.fillType7 || adjust_default(secondaryColor, { h: 128 }); + this.pie1 = this.pie1 || primaryColor; + this.pie2 = this.pie2 || secondaryColor; + this.pie3 = this.pie3 || tertiaryColor; + this.pie4 = this.pie4 || adjust_default(primaryColor, { l: -10 }); + this.pie5 = this.pie5 || adjust_default(secondaryColor, { l: -10 }); + this.pie6 = this.pie6 || adjust_default(tertiaryColor, { l: -10 }); + this.pie7 = this.pie7 || adjust_default(primaryColor, { h: 60, l: -10 }); + this.pie8 = this.pie8 || adjust_default(primaryColor, { h: -60, l: -10 }); + this.pie9 = this.pie9 || adjust_default(primaryColor, { h: 120, l: 0 }); + this.pie10 = this.pie10 || adjust_default(primaryColor, { h: 60, l: -20 }); + this.pie11 = this.pie11 || adjust_default(primaryColor, { h: -60, l: -20 }); + this.pie12 = this.pie12 || adjust_default(primaryColor, { h: 120, l: -10 }); + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0" + }; + this.requirementBackground = this.requirementBackground || primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.git0 = this.git0 || primaryColor; + this.git1 = this.git1 || secondaryColor; + this.git2 = this.git2 || tertiaryColor; + this.git3 = this.git3 || adjust_default(primaryColor, { h: -30 }); + this.git4 = this.git4 || adjust_default(primaryColor, { h: -60 }); + this.git5 = this.git5 || adjust_default(primaryColor, { h: -90 }); + this.git6 = this.git6 || adjust_default(primaryColor, { h: 60 }); + this.git7 = this.git7 || adjust_default(primaryColor, { h: 120 }); + if (this.darkMode) { + this.git0 = lighten_default(this.git0, 25); + this.git1 = lighten_default(this.git1, 25); + this.git2 = lighten_default(this.git2, 25); + this.git3 = lighten_default(this.git3, 25); + this.git4 = lighten_default(this.git4, 25); + this.git5 = lighten_default(this.git5, 25); + this.git6 = lighten_default(this.git6, 25); + this.git7 = lighten_default(this.git7, 25); + } else { + this.git0 = darken_default(this.git0, 25); + this.git1 = darken_default(this.git1, 25); + this.git2 = darken_default(this.git2, 25); + this.git3 = darken_default(this.git3, 25); + this.git4 = darken_default(this.git4, 25); + this.git5 = darken_default(this.git5, 25); + this.git6 = darken_default(this.git6, 25); + this.git7 = darken_default(this.git7, 25); + } + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor); + this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor; + this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor; + this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLineColor = this.commitLineColor ?? "#BDBCCC"; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.fontWeight = 600; + this.erEdgeLabelBackground = "#FFFFFF"; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables10 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme10(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/theme-redux-dark-color.js + var Theme11, getThemeVariables11; + var init_theme_redux_dark_color = __esm({ + "src/themes/theme-redux-dark-color.js"() { + "use strict"; + init_dist(); + init_theme_helpers(); + init_erDiagram_oldHardcodedValues(); + Theme11 = class { + static { + __name(this, "Theme"); + } + constructor() { + this.background = "#333"; + this.primaryColor = "#1f2020"; + this.secondaryColor = lighten_default(this.primaryColor, 16); + this.tertiaryColor = adjust_default(this.primaryColor, { h: -160 }); + this.primaryBorderColor = invert_default(this.background); + this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode); + this.primaryTextColor = invert_default(this.primaryColor); + this.secondaryTextColor = invert_default(this.secondaryColor); + this.tertiaryTextColor = invert_default(this.tertiaryColor); + this.mainBkg = "#111113"; + this.secondBkg = "calculated"; + this.mainContrastColor = "lightgrey"; + this.darkTextColor = lighten_default(invert_default("#323D47"), 10); + this.border1 = "#ccc"; + this.border2 = rgba_default(255, 255, 255, 0.25); + this.arrowheadColor = invert_default(this.background); + this.fontFamily = '"Recursive Variable", arial, sans-serif'; + this.fontSize = "14px"; + this.labelBackground = "#111113"; + this.textColor = "#ccc"; + this.THEME_COLOR_LIMIT = 12; + this.radius = 12; + this.strokeWidth = 2; + this.noteBkgColor = this.noteBkgColor ?? "#FEF9C3"; + this.noteTextColor = this.noteTextColor ?? "#28253D"; + this.THEME_COLOR_LIMIT = 12; + this.fontFamily = '"Recursive Variable", arial, sans-serif'; + this.fontSize = "14px"; + this.nodeBorder = "#FFFFFF"; + this.stateBorder = "#FFFFFF"; + this.useGradient = false; + this.gradientStart = "#0042eb"; + this.gradientStop = "#eb0042"; + this.dropShadow = "url(#drop-shadow)"; + this.nodeShadow = true; + this.archEdgeColor = "calculated"; + this.archEdgeArrowColor = "calculated"; + this.archEdgeWidth = "3"; + this.archGroupBorderColor = this.primaryBorderColor; + this.archGroupBorderWidth = "2px"; + this.clusterBkg = "#1E1A2E"; + this.clusterBorder = "#BDBCCC"; + this.noteBorderColor = "#FACC15"; + this.noteFontWeight = 600; + this.borderColorArray = [ + "#E879F9", + //Fuchsia-400 + "#2DD4BF", + //Teal-400 + "#FB923C", + //Orange-400 + "#22D3EE", + // Cyan-400 + "#4ADE80", + // Green-400 + "#A78BFA", + //Violet-400 + "#F87171", + //red-400 + "#FACC15", + //yellow-400 + "#818CF8", + //indigo-400 + "#A3E635 ", + //Lime-400 + "#38BDF8", + //Sky-400 + "#FB7185" + //Rose-400 + ]; + this.bkgColorArray = []; + this.filterColor = "#FFFFFF"; + } + updateColors() { + this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#FFFFFF"); + this.secondaryColor = this.secondaryColor || adjust_default(this.primaryColor, { h: -120 }); + this.tertiaryColor = this.tertiaryColor || adjust_default(this.primaryColor, { h: 180, l: 5 }); + this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode); + this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode); + this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode); + this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode); + this.noteBkgColor = this.noteBkgColor || "#fff5ad"; + this.noteTextColor = this.noteTextColor || "#FFFFFF"; + this.secondaryTextColor = this.secondaryTextColor || invert_default(this.secondaryColor); + this.tertiaryTextColor = this.tertiaryTextColor || invert_default(this.tertiaryColor); + this.lineColor = this.lineColor || invert_default(this.background); + this.arrowheadColor = this.arrowheadColor || invert_default(this.background); + this.textColor = this.textColor || this.primaryTextColor; + this.border2 = this.border2 || this.tertiaryBorderColor; + this.nodeBkg = this.nodeBkg || this.primaryColor; + this.mainBkg = this.mainBkg || this.primaryColor; + this.nodeBorder = this.nodeBorder || this.border1; + this.clusterBkg = this.clusterBkg || this.tertiaryColor; + this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor; + this.defaultLinkColor = this.defaultLinkColor || this.lineColor; + this.titleColor = this.titleColor || this.tertiaryTextColor; + this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.nodeTextColor = this.nodeTextColor || this.primaryTextColor; + this.actorBorder = "#FFFFFF"; + this.signalColor = "#FFFFFF"; + this.labelBoxBorderColor = "#BDBCCC"; + this.actorBorder = this.actorBorder || this.primaryBorderColor; + this.actorBkg = this.actorBkg || this.mainBkg; + this.actorTextColor = this.actorTextColor || this.primaryTextColor; + this.actorLineColor = this.actorLineColor || this.actorBorder; + this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg; + this.signalColor = this.signalColor || this.textColor; + this.signalTextColor = this.signalTextColor || this.textColor; + this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder; + this.labelTextColor = this.labelTextColor || this.actorTextColor; + this.loopTextColor = this.loopTextColor || this.actorTextColor; + this.activationBorderColor = this.activationBorderColor || darken_default(this.secondaryColor, 10); + this.activationBkgColor = this.activationBkgColor || this.secondaryColor; + this.sequenceNumberColor = this.sequenceNumberColor || invert_default(this.lineColor); + this.rootLabelColor = "#FFFFFF"; + this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor; + this.altSectionBkgColor = this.altSectionBkgColor || "white"; + this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor; + this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor; + this.excludeBkgColor = this.excludeBkgColor || "#eeeeee"; + this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor; + this.taskBkgColor = this.taskBkgColor || this.primaryColor; + this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor; + this.activeTaskBkgColor = this.activeTaskBkgColor || lighten_default(this.primaryColor, 23); + this.gridColor = this.gridColor || "lightgrey"; + this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey"; + this.doneTaskBorderColor = this.doneTaskBorderColor || "grey"; + this.critBorderColor = this.critBorderColor || "#ff8888"; + this.critBkgColor = this.critBkgColor || "red"; + this.todayLineColor = this.todayLineColor || "red"; + this.taskTextColor = this.taskTextColor || this.textColor; + this.vertLineColor = this.vertLineColor || this.primaryBorderColor; + this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor; + this.taskTextLightColor = this.taskTextLightColor || this.textColor; + this.taskTextColor = this.taskTextColor || this.primaryTextColor; + this.taskTextDarkColor = this.taskTextDarkColor || this.textColor; + this.taskTextClickableColor = this.taskTextClickableColor || "#003163"; + this.archEdgeColor = this.lineColor; + this.archEdgeArrowColor = this.lineColor; + this.personBorder = this.personBorder || this.primaryBorderColor; + this.personBkg = this.personBkg || this.mainBkg; + this.transitionColor = this.transitionColor || this.lineColor; + this.transitionLabelColor = this.transitionLabelColor || this.textColor; + this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; + this.stateBkg = this.stateBkg || this.mainBkg; + this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg; + this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor; + this.altBackground = this.altBackground || "#f0f0f0"; + this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg; + this.compositeBorder = this.compositeBorder || this.nodeBorder; + this.innerEndBackground = this.nodeBorder; + this.errorBkgColor = this.errorBkgColor || this.tertiaryColor; + this.errorTextColor = this.errorTextColor || this.tertiaryTextColor; + this.transitionColor = this.transitionColor || this.lineColor; + this.specialStateColor = this.lineColor; + this.cScale0 = this.cScale0 || "#f4a8ff"; + this.cScale1 = this.cScale1 || "#46ecd5"; + this.cScale2 = this.cScale2 || "#ffb86a"; + this.cScale3 = this.cScale3 || "#dab2ff"; + this.cScale4 = this.cScale4 || "#7bf1a8"; + this.cScale5 = this.cScale5 || "#c4b4ff"; + this.cScale6 = this.cScale6 || "#ffa2a2"; + this.cScale7 = this.cScale7 || "#ffdf20"; + this.cScale8 = this.cScale8 || "#a3b3ff"; + this.cScale9 = this.cScale9 || "#bbf451"; + this.cScale10 = this.cScale10 || "#74d4ff"; + this.cScale11 = this.cScale11 || "#ffa1ad"; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleInv" + i2] = this["cScaleInv" + i2] || invert_default(this["cScale" + i2]); + } + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + if (this.darkMode) { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || lighten_default(this["cScale" + i2], 10); + } else { + this["cScalePeer" + i2] = this["cScalePeer" + i2] || darken_default(this["cScale" + i2], 10); + } + } + this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor; + for (let i2 = 0; i2 < this.THEME_COLOR_LIMIT; i2++) { + this["cScaleLabel" + i2] = darken_default(this["cScale" + i2], 75); + } + const multiplier = this.darkMode ? -4 : -1; + for (let i2 = 0; i2 < 5; i2++) { + this["surface" + i2] = this["surface" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i2 * 3) }); + this["surfacePeer" + i2] = this["surfacePeer" + i2] || adjust_default(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i2 * 3) }); + } + this.classText = this.classText || this.textColor; + this.fillType0 = this.fillType0 || this.primaryColor; + this.fillType1 = this.fillType1 || this.secondaryColor; + this.fillType2 = this.fillType2 || adjust_default(this.primaryColor, { h: 64 }); + this.fillType3 = this.fillType3 || adjust_default(this.secondaryColor, { h: 64 }); + this.fillType4 = this.fillType4 || adjust_default(this.primaryColor, { h: -64 }); + this.fillType5 = this.fillType5 || adjust_default(this.secondaryColor, { h: -64 }); + this.fillType6 = this.fillType6 || adjust_default(this.primaryColor, { h: 128 }); + this.fillType7 = this.fillType7 || adjust_default(this.secondaryColor, { h: 128 }); + this.pie1 = this.pie1 || this.primaryColor; + this.pie2 = this.pie2 || this.secondaryColor; + this.pie3 = this.pie3 || this.tertiaryColor; + this.pie4 = this.pie4 || adjust_default(this.primaryColor, { l: -10 }); + this.pie5 = this.pie5 || adjust_default(this.secondaryColor, { l: -10 }); + this.pie6 = this.pie6 || adjust_default(this.tertiaryColor, { l: -10 }); + this.pie7 = this.pie7 || adjust_default(this.primaryColor, { h: 60, l: -10 }); + this.pie8 = this.pie8 || adjust_default(this.primaryColor, { h: -60, l: -10 }); + this.pie9 = this.pie9 || adjust_default(this.primaryColor, { h: 120, l: 0 }); + this.pie10 = this.pie10 || adjust_default(this.primaryColor, { h: 60, l: -20 }); + this.pie11 = this.pie11 || adjust_default(this.primaryColor, { h: -60, l: -20 }); + this.pie12 = this.pie12 || adjust_default(this.primaryColor, { h: 120, l: -10 }); + this.pieTitleTextSize = this.pieTitleTextSize || "25px"; + this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor; + this.pieSectionTextSize = this.pieSectionTextSize || "17px"; + this.pieSectionTextColor = this.pieSectionTextColor || this.textColor; + this.pieLegendTextSize = this.pieLegendTextSize || "17px"; + this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor; + this.pieStrokeColor = this.pieStrokeColor || "black"; + this.pieStrokeWidth = this.pieStrokeWidth || "2px"; + this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px"; + this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black"; + this.pieOpacity = this.pieOpacity || "0.7"; + this.vennTitleTextColor = this.vennTitleTextColor ?? this.titleColor; + this.vennSetTextColor = this.vennSetTextColor ?? this.textColor; + this.quadrant1Fill = this.quadrant1Fill || this.primaryColor; + this.quadrant2Fill = this.quadrant2Fill || adjust_default(this.primaryColor, { r: 5, g: 5, b: 5 }); + this.quadrant3Fill = this.quadrant3Fill || adjust_default(this.primaryColor, { r: 10, g: 10, b: 10 }); + this.quadrant4Fill = this.quadrant4Fill || adjust_default(this.primaryColor, { r: 15, g: 15, b: 15 }); + this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor; + this.quadrant2TextFill = this.quadrant2TextFill || adjust_default(this.primaryTextColor, { r: -5, g: -5, b: -5 }); + this.quadrant3TextFill = this.quadrant3TextFill || adjust_default(this.primaryTextColor, { r: -10, g: -10, b: -10 }); + this.quadrant4TextFill = this.quadrant4TextFill || adjust_default(this.primaryTextColor, { r: -15, g: -15, b: -15 }); + this.quadrantPointFill = this.quadrantPointFill || is_dark_default(this.quadrant1Fill) ? lighten_default(this.quadrant1Fill) : darken_default(this.quadrant1Fill); + this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor; + this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor; + this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor; + this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor; + this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor; + this.xyChart = { + backgroundColor: this.xyChart?.backgroundColor || this.background, + titleColor: this.xyChart?.titleColor || this.primaryTextColor, + xAxisTitleColor: this.xyChart?.xAxisTitleColor || this.primaryTextColor, + xAxisLabelColor: this.xyChart?.xAxisLabelColor || this.primaryTextColor, + xAxisTickColor: this.xyChart?.xAxisTickColor || this.primaryTextColor, + xAxisLineColor: this.xyChart?.xAxisLineColor || this.primaryTextColor, + yAxisTitleColor: this.xyChart?.yAxisTitleColor || this.primaryTextColor, + yAxisLabelColor: this.xyChart?.yAxisLabelColor || this.primaryTextColor, + yAxisTickColor: this.xyChart?.yAxisTickColor || this.primaryTextColor, + yAxisLineColor: this.xyChart?.yAxisLineColor || this.primaryTextColor, + plotColorPalette: this.xyChart?.plotColorPalette || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0" + }; + this.requirementBackground = this.requirementBackground || this.primaryColor; + this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor; + this.requirementBorderSize = this.requirementBorderSize || "1"; + this.requirementTextColor = this.requirementTextColor || this.primaryTextColor; + this.relationColor = this.relationColor || this.lineColor; + this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken_default(this.secondaryColor, 30) : this.secondaryColor); + this.relationLabelColor = this.relationLabelColor || this.actorTextColor; + this.git0 = this.git0 || this.primaryColor; + this.git1 = this.git1 || this.secondaryColor; + this.git2 = this.git2 || this.tertiaryColor; + this.git3 = this.git3 || adjust_default(this.primaryColor, { h: -30 }); + this.git4 = this.git4 || adjust_default(this.primaryColor, { h: -60 }); + this.git5 = this.git5 || adjust_default(this.primaryColor, { h: -90 }); + this.git6 = this.git6 || adjust_default(this.primaryColor, { h: 60 }); + this.git7 = this.git7 || adjust_default(this.primaryColor, { h: 120 }); + if (this.darkMode) { + this.git0 = lighten_default(this.git0, 25); + this.git1 = lighten_default(this.git1, 25); + this.git2 = lighten_default(this.git2, 25); + this.git3 = lighten_default(this.git3, 25); + this.git4 = lighten_default(this.git4, 25); + this.git5 = lighten_default(this.git5, 25); + this.git6 = lighten_default(this.git6, 25); + this.git7 = lighten_default(this.git7, 25); + } else { + this.git0 = darken_default(this.git0, 25); + this.git1 = darken_default(this.git1, 25); + this.git2 = darken_default(this.git2, 25); + this.git3 = darken_default(this.git3, 25); + this.git4 = darken_default(this.git4, 25); + this.git5 = darken_default(this.git5, 25); + this.git6 = darken_default(this.git6, 25); + this.git7 = darken_default(this.git7, 25); + } + this.gitInv0 = this.gitInv0 || invert_default(this.git0); + this.gitInv1 = this.gitInv1 || invert_default(this.git1); + this.gitInv2 = this.gitInv2 || invert_default(this.git2); + this.gitInv3 = this.gitInv3 || invert_default(this.git3); + this.gitInv4 = this.gitInv4 || invert_default(this.git4); + this.gitInv5 = this.gitInv5 || invert_default(this.git5); + this.gitInv6 = this.gitInv6 || invert_default(this.git6); + this.gitInv7 = this.gitInv7 || invert_default(this.git7); + this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor); + this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor; + this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor; + this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor; + this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor; + this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor; + this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor; + this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor; + this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor; + this.tagLabelColor = this.tagLabelColor || this.primaryTextColor; + this.tagLabelBackground = this.tagLabelBackground || this.primaryColor; + this.tagLabelBorder = this.tagBorder || this.primaryBorderColor; + this.tagLabelFontSize = this.tagLabelFontSize || "10px"; + this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor; + this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor; + this.commitLabelFontSize = this.commitLabelFontSize || "10px"; + this.commitLineColor = this.commitLineColor ?? "#BDBCCC"; + this.fontWeight = 600; + this.erEdgeLabelBackground = "#16141F"; + this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd; + this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven; + } + calculate(overrides) { + if (typeof overrides !== "object") { + this.updateColors(); + return; + } + const keys3 = Object.keys(overrides); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + this.updateColors(); + keys3.forEach((k2) => { + this[k2] = overrides[k2]; + }); + } + }; + getThemeVariables11 = /* @__PURE__ */ __name((userOverrides) => { + const theme = new Theme11(); + theme.calculate(userOverrides); + return theme; + }, "getThemeVariables"); + } + }); + + // src/themes/index.js + var themes_default; + var init_themes = __esm({ + "src/themes/index.js"() { + "use strict"; + init_theme_base(); + init_theme_dark(); + init_theme_default(); + init_theme_forest(); + init_theme_neutral(); + init_theme_neo(); + init_theme_neo_dark(); + init_theme_redux(); + init_theme_redux_dark(); + init_theme_redux_color(); + init_theme_redux_dark_color(); + themes_default = { + base: { + getThemeVariables + }, + dark: { + getThemeVariables: getThemeVariables2 + }, + default: { + getThemeVariables: getThemeVariables3 + }, + forest: { + getThemeVariables: getThemeVariables4 + }, + neutral: { + getThemeVariables: getThemeVariables5 + }, + neo: { + getThemeVariables: getThemeVariables6 + }, + "neo-dark": { + getThemeVariables: getThemeVariables7 + }, + redux: { + getThemeVariables: getThemeVariables8 + }, + "redux-dark": { + getThemeVariables: getThemeVariables9 + }, + "redux-color": { + getThemeVariables: getThemeVariables10 + }, + "redux-dark-color": { + getThemeVariables: getThemeVariables11 + } + }; + } + }); + + // src/schemas/config.schema.yaml?only-defaults=true + var config_schema_default; + var init_config_schema = __esm({ + "src/schemas/config.schema.yaml?only-defaults=true"() { + "use strict"; + config_schema_default = { + "flowchart": { + "useMaxWidth": true, + "titleTopMargin": 25, + "subGraphTitleMargin": { + "top": 0, + "bottom": 0 + }, + "diagramPadding": 8, + "htmlLabels": null, + "nodeSpacing": 50, + "rankSpacing": 50, + "curve": "basis", + "padding": 15, + "defaultRenderer": "dagre-wrapper", + "wrappingWidth": 200, + "inheritDir": false + }, + "sequence": { + "useMaxWidth": true, + "hideUnusedParticipants": false, + "activationWidth": 10, + "diagramMarginX": 50, + "diagramMarginY": 10, + "actorMargin": 50, + "width": 150, + "height": 65, + "boxMargin": 10, + "boxTextMargin": 5, + "noteMargin": 10, + "messageMargin": 35, + "messageAlign": "center", + "mirrorActors": true, + "forceMenus": false, + "bottomMarginAdj": 1, + "rightAngles": false, + "showSequenceNumbers": false, + "actorFontSize": 14, + "actorFontFamily": '"Open Sans", sans-serif', + "actorFontWeight": 400, + "noteFontSize": 14, + "noteFontFamily": '"trebuchet ms", verdana, arial, sans-serif', + "noteFontWeight": 400, + "noteAlign": "center", + "messageFontSize": 16, + "messageFontFamily": '"trebuchet ms", verdana, arial, sans-serif', + "messageFontWeight": 400, + "wrap": false, + "wrapPadding": 10, + "labelBoxWidth": 50, + "labelBoxHeight": 20 + }, + "gantt": { + "useMaxWidth": true, + "titleTopMargin": 25, + "barHeight": 20, + "barGap": 4, + "topPadding": 50, + "rightPadding": 75, + "leftPadding": 75, + "gridLineStartPadding": 35, + "fontSize": 11, + "sectionFontSize": 11, + "numberSectionStyles": 4, + "axisFormat": "%Y-%m-%d", + "topAxis": false, + "displayMode": "", + "weekday": "sunday" + }, + "journey": { + "useMaxWidth": true, + "diagramMarginX": 50, + "diagramMarginY": 10, + "leftMargin": 150, + "maxLabelWidth": 360, + "width": 150, + "height": 50, + "boxMargin": 10, + "boxTextMargin": 5, + "noteMargin": 10, + "messageMargin": 35, + "messageAlign": "center", + "bottomMarginAdj": 1, + "rightAngles": false, + "taskFontSize": 14, + "taskFontFamily": '"Open Sans", sans-serif', + "taskMargin": 50, + "activationWidth": 10, + "textPlacement": "fo", + "actorColours": [ + "#8FBC8F", + "#7CFC00", + "#00FFFF", + "#20B2AA", + "#B0E0E6", + "#FFFFE0" + ], + "sectionFills": [ + "#191970", + "#8B008B", + "#4B0082", + "#2F4F4F", + "#800000", + "#8B4513", + "#00008B" + ], + "sectionColours": [ + "#fff" + ], + "titleColor": "", + "titleFontFamily": '"trebuchet ms", verdana, arial, sans-serif', + "titleFontSize": "4ex" + }, + "class": { + "useMaxWidth": true, + "titleTopMargin": 25, + "arrowMarkerAbsolute": false, + "dividerMargin": 10, + "padding": 5, + "textHeight": 10, + "defaultRenderer": "dagre-wrapper", + "htmlLabels": false, + "hideEmptyMembersBox": false, + "hierarchicalNamespaces": true + }, + "state": { + "useMaxWidth": true, + "titleTopMargin": 25, + "dividerMargin": 10, + "sizeUnit": 5, + "padding": 8, + "textHeight": 10, + "titleShift": -15, + "noteMargin": 10, + "forkWidth": 70, + "forkHeight": 7, + "miniPadding": 2, + "fontSizeFactor": 5.02, + "fontSize": 24, + "labelHeight": 16, + "edgeLengthFactor": "20", + "compositTitleSize": 35, + "radius": 5, + "defaultRenderer": "dagre-wrapper" + }, + "er": { + "useMaxWidth": true, + "titleTopMargin": 25, + "diagramPadding": 20, + "layoutDirection": "TB", + "minEntityWidth": 100, + "minEntityHeight": 75, + "entityPadding": 15, + "nodeSpacing": 140, + "rankSpacing": 80, + "stroke": "gray", + "fill": "honeydew", + "fontSize": 12 + }, + "pie": { + "useMaxWidth": true, + "textPosition": 0.75 + }, + "quadrantChart": { + "useMaxWidth": true, + "chartWidth": 500, + "chartHeight": 500, + "titleFontSize": 20, + "titlePadding": 10, + "quadrantPadding": 5, + "xAxisLabelPadding": 5, + "yAxisLabelPadding": 5, + "xAxisLabelFontSize": 16, + "yAxisLabelFontSize": 16, + "quadrantLabelFontSize": 16, + "quadrantTextTopPadding": 5, + "pointTextPadding": 5, + "pointLabelFontSize": 12, + "pointRadius": 5, + "xAxisPosition": "top", + "yAxisPosition": "left", + "quadrantInternalBorderStrokeWidth": 1, + "quadrantExternalBorderStrokeWidth": 2 + }, + "xyChart": { + "useMaxWidth": true, + "width": 700, + "height": 500, + "titleFontSize": 20, + "titlePadding": 10, + "showDataLabel": false, + "showDataLabelOutsideBar": false, + "showTitle": true, + "xAxis": { + "$ref": "#/$defs/XYChartAxisConfig", + "showLabel": true, + "labelFontSize": 14, + "labelPadding": 5, + "showTitle": true, + "titleFontSize": 16, + "titlePadding": 5, + "showTick": true, + "tickLength": 5, + "tickWidth": 2, + "showAxisLine": true, + "axisLineWidth": 2 + }, + "yAxis": { + "$ref": "#/$defs/XYChartAxisConfig", + "showLabel": true, + "labelFontSize": 14, + "labelPadding": 5, + "showTitle": true, + "titleFontSize": 16, + "titlePadding": 5, + "showTick": true, + "tickLength": 5, + "tickWidth": 2, + "showAxisLine": true, + "axisLineWidth": 2 + }, + "chartOrientation": "vertical", + "plotReservedSpacePercent": 50 + }, + "requirement": { + "useMaxWidth": true, + "rect_fill": "#f9f9f9", + "text_color": "#333", + "rect_border_size": "0.5px", + "rect_border_color": "#bbb", + "rect_min_width": 200, + "rect_min_height": 200, + "fontSize": 14, + "rect_padding": 10, + "line_height": 20 + }, + "mindmap": { + "useMaxWidth": true, + "padding": 10, + "maxNodeWidth": 200, + "layoutAlgorithm": "cose-bilkent" + }, + "ishikawa": { + "useMaxWidth": true, + "diagramPadding": 20 + }, + "kanban": { + "useMaxWidth": true, + "padding": 8, + "sectionWidth": 200, + "ticketBaseUrl": "" + }, + "timeline": { + "useMaxWidth": true, + "diagramMarginX": 50, + "diagramMarginY": 10, + "leftMargin": 150, + "width": 150, + "height": 50, + "boxMargin": 10, + "boxTextMargin": 5, + "noteMargin": 10, + "messageMargin": 35, + "messageAlign": "center", + "bottomMarginAdj": 1, + "rightAngles": false, + "taskFontSize": 14, + "taskFontFamily": '"Open Sans", sans-serif', + "taskMargin": 50, + "activationWidth": 10, + "textPlacement": "fo", + "actorColours": [ + "#8FBC8F", + "#7CFC00", + "#00FFFF", + "#20B2AA", + "#B0E0E6", + "#FFFFE0" + ], + "sectionFills": [ + "#191970", + "#8B008B", + "#4B0082", + "#2F4F4F", + "#800000", + "#8B4513", + "#00008B" + ], + "sectionColours": [ + "#fff" + ], + "disableMulticolor": false + }, + "gitGraph": { + "useMaxWidth": true, + "titleTopMargin": 25, + "diagramPadding": 8, + "nodeLabel": { + "width": 75, + "height": 100, + "x": -25, + "y": 0 + }, + "mainBranchName": "main", + "mainBranchOrder": 0, + "showCommitLabel": true, + "showBranches": true, + "rotateCommitLabel": true, + "parallelCommits": false, + "arrowMarkerAbsolute": false + }, + "c4": { + "useMaxWidth": true, + "diagramMarginX": 50, + "diagramMarginY": 10, + "c4ShapeMargin": 50, + "c4ShapePadding": 20, + "width": 216, + "height": 60, + "boxMargin": 10, + "c4ShapeInRow": 4, + "nextLinePaddingX": 0, + "c4BoundaryInRow": 2, + "personFontSize": 14, + "personFontFamily": '"Open Sans", sans-serif', + "personFontWeight": "normal", + "external_personFontSize": 14, + "external_personFontFamily": '"Open Sans", sans-serif', + "external_personFontWeight": "normal", + "systemFontSize": 14, + "systemFontFamily": '"Open Sans", sans-serif', + "systemFontWeight": "normal", + "external_systemFontSize": 14, + "external_systemFontFamily": '"Open Sans", sans-serif', + "external_systemFontWeight": "normal", + "system_dbFontSize": 14, + "system_dbFontFamily": '"Open Sans", sans-serif', + "system_dbFontWeight": "normal", + "external_system_dbFontSize": 14, + "external_system_dbFontFamily": '"Open Sans", sans-serif', + "external_system_dbFontWeight": "normal", + "system_queueFontSize": 14, + "system_queueFontFamily": '"Open Sans", sans-serif', + "system_queueFontWeight": "normal", + "external_system_queueFontSize": 14, + "external_system_queueFontFamily": '"Open Sans", sans-serif', + "external_system_queueFontWeight": "normal", + "boundaryFontSize": 14, + "boundaryFontFamily": '"Open Sans", sans-serif', + "boundaryFontWeight": "normal", + "messageFontSize": 12, + "messageFontFamily": '"Open Sans", sans-serif', + "messageFontWeight": "normal", + "containerFontSize": 14, + "containerFontFamily": '"Open Sans", sans-serif', + "containerFontWeight": "normal", + "external_containerFontSize": 14, + "external_containerFontFamily": '"Open Sans", sans-serif', + "external_containerFontWeight": "normal", + "container_dbFontSize": 14, + "container_dbFontFamily": '"Open Sans", sans-serif', + "container_dbFontWeight": "normal", + "external_container_dbFontSize": 14, + "external_container_dbFontFamily": '"Open Sans", sans-serif', + "external_container_dbFontWeight": "normal", + "container_queueFontSize": 14, + "container_queueFontFamily": '"Open Sans", sans-serif', + "container_queueFontWeight": "normal", + "external_container_queueFontSize": 14, + "external_container_queueFontFamily": '"Open Sans", sans-serif', + "external_container_queueFontWeight": "normal", + "componentFontSize": 14, + "componentFontFamily": '"Open Sans", sans-serif', + "componentFontWeight": "normal", + "external_componentFontSize": 14, + "external_componentFontFamily": '"Open Sans", sans-serif', + "external_componentFontWeight": "normal", + "component_dbFontSize": 14, + "component_dbFontFamily": '"Open Sans", sans-serif', + "component_dbFontWeight": "normal", + "external_component_dbFontSize": 14, + "external_component_dbFontFamily": '"Open Sans", sans-serif', + "external_component_dbFontWeight": "normal", + "component_queueFontSize": 14, + "component_queueFontFamily": '"Open Sans", sans-serif', + "component_queueFontWeight": "normal", + "external_component_queueFontSize": 14, + "external_component_queueFontFamily": '"Open Sans", sans-serif', + "external_component_queueFontWeight": "normal", + "wrap": true, + "wrapPadding": 10, + "person_bg_color": "#08427B", + "person_border_color": "#073B6F", + "external_person_bg_color": "#686868", + "external_person_border_color": "#8A8A8A", + "system_bg_color": "#1168BD", + "system_border_color": "#3C7FC0", + "system_db_bg_color": "#1168BD", + "system_db_border_color": "#3C7FC0", + "system_queue_bg_color": "#1168BD", + "system_queue_border_color": "#3C7FC0", + "external_system_bg_color": "#999999", + "external_system_border_color": "#8A8A8A", + "external_system_db_bg_color": "#999999", + "external_system_db_border_color": "#8A8A8A", + "external_system_queue_bg_color": "#999999", + "external_system_queue_border_color": "#8A8A8A", + "container_bg_color": "#438DD5", + "container_border_color": "#3C7FC0", + "container_db_bg_color": "#438DD5", + "container_db_border_color": "#3C7FC0", + "container_queue_bg_color": "#438DD5", + "container_queue_border_color": "#3C7FC0", + "external_container_bg_color": "#B3B3B3", + "external_container_border_color": "#A6A6A6", + "external_container_db_bg_color": "#B3B3B3", + "external_container_db_border_color": "#A6A6A6", + "external_container_queue_bg_color": "#B3B3B3", + "external_container_queue_border_color": "#A6A6A6", + "component_bg_color": "#85BBF0", + "component_border_color": "#78A8D8", + "component_db_bg_color": "#85BBF0", + "component_db_border_color": "#78A8D8", + "component_queue_bg_color": "#85BBF0", + "component_queue_border_color": "#78A8D8", + "external_component_bg_color": "#CCCCCC", + "external_component_border_color": "#BFBFBF", + "external_component_db_bg_color": "#CCCCCC", + "external_component_db_border_color": "#BFBFBF", + "external_component_queue_bg_color": "#CCCCCC", + "external_component_queue_border_color": "#BFBFBF" + }, + "sankey": { + "useMaxWidth": true, + "width": 600, + "height": 400, + "linkColor": "gradient", + "nodeAlignment": "justify", + "showValues": true, + "prefix": "", + "suffix": "", + "nodeWidth": 10, + "nodePadding": 12, + "labelStyle": "legacy" + }, + "block": { + "useMaxWidth": true, + "padding": 8 + }, + "packet": { + "useMaxWidth": true, + "rowHeight": 32, + "bitWidth": 32, + "bitsPerRow": 32, + "showBits": true, + "paddingX": 5, + "paddingY": 5 + }, + "treeView": { + "useMaxWidth": true, + "rowIndent": 10, + "paddingX": 5, + "paddingY": 5, + "lineThickness": 1 + }, + "architecture": { + "useMaxWidth": true, + "padding": 40, + "iconSize": 80, + "fontSize": 16, + "randomize": false, + "nodeSeparation": 75, + "idealEdgeLengthMultiplier": 1.5, + "edgeElasticity": 0.45, + "numIter": 2500 + }, + "eventmodeling": { + "useMaxWidth": true, + "padding": 30, + "rowHeight": 32 + }, + "radar": { + "useMaxWidth": true, + "width": 600, + "height": 600, + "marginTop": 50, + "marginRight": 50, + "marginBottom": 50, + "marginLeft": 50, + "axisScaleFactor": 1, + "axisLabelFactor": 1.05, + "curveTension": 0.17 + }, + "venn": { + "useMaxWidth": true, + "width": 800, + "height": 450, + "padding": 8, + "useDebugLayout": false + }, + "theme": "default", + "look": "classic", + "handDrawnSeed": 0, + "layout": "dagre", + "maxTextSize": 5e4, + "maxEdges": 500, + "darkMode": false, + "fontFamily": '"trebuchet ms", verdana, arial, sans-serif;', + "logLevel": 5, + "securityLevel": "strict", + "startOnLoad": true, + "arrowMarkerAbsolute": false, + "secure": [ + "secure", + "securityLevel", + "startOnLoad", + "maxTextSize", + "suppressErrorRendering", + "maxEdges" + ], + "legacyMathML": false, + "forceLegacyMathML": false, + "deterministicIds": false, + "fontSize": 16, + "markdownAutoWrap": true, + "suppressErrorRendering": false + }; + } + }); + + // src/defaultConfig.ts + var config, keyify, configKeys, defaultConfig_default; + var init_defaultConfig = __esm({ + "src/defaultConfig.ts"() { + "use strict"; + init_themes(); + init_config_schema(); + config = { + ...config_schema_default, + // Set, even though they're `undefined` so that `configKeys` finds these keys + // TODO: Should we replace these with `null` so that they can go in the JSON Schema? + deterministicIDSeed: void 0, + elk: { + // mergeEdges is needed here to be considered + mergeEdges: false, + nodePlacementStrategy: "BRANDES_KOEPF", + forceNodeModelOrder: false, + considerModelOrder: "NODES_AND_EDGES" + }, + themeCSS: void 0, + // add non-JSON default config values + themeVariables: themes_default.default.getThemeVariables(), + sequence: { + ...config_schema_default.sequence, + messageFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.messageFontFamily, + fontSize: this.messageFontSize, + fontWeight: this.messageFontWeight + }; + }, "messageFont"), + noteFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.noteFontFamily, + fontSize: this.noteFontSize, + fontWeight: this.noteFontWeight + }; + }, "noteFont"), + actorFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.actorFontFamily, + fontSize: this.actorFontSize, + fontWeight: this.actorFontWeight + }; + }, "actorFont") + }, + class: { + hideEmptyMembersBox: false, + hierarchicalNamespaces: true + }, + gantt: { + ...config_schema_default.gantt, + tickInterval: void 0, + useWidth: void 0 + // can probably be removed since `configKeys` already includes this + }, + c4: { + ...config_schema_default.c4, + useWidth: void 0, + personFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.personFontFamily, + fontSize: this.personFontSize, + fontWeight: this.personFontWeight + }; + }, "personFont"), + flowchart: { + ...config_schema_default.flowchart, + inheritDir: false + // default to legacy behavior + }, + external_personFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_personFontFamily, + fontSize: this.external_personFontSize, + fontWeight: this.external_personFontWeight + }; + }, "external_personFont"), + systemFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.systemFontFamily, + fontSize: this.systemFontSize, + fontWeight: this.systemFontWeight + }; + }, "systemFont"), + external_systemFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_systemFontFamily, + fontSize: this.external_systemFontSize, + fontWeight: this.external_systemFontWeight + }; + }, "external_systemFont"), + system_dbFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.system_dbFontFamily, + fontSize: this.system_dbFontSize, + fontWeight: this.system_dbFontWeight + }; + }, "system_dbFont"), + external_system_dbFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_system_dbFontFamily, + fontSize: this.external_system_dbFontSize, + fontWeight: this.external_system_dbFontWeight + }; + }, "external_system_dbFont"), + system_queueFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.system_queueFontFamily, + fontSize: this.system_queueFontSize, + fontWeight: this.system_queueFontWeight + }; + }, "system_queueFont"), + external_system_queueFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_system_queueFontFamily, + fontSize: this.external_system_queueFontSize, + fontWeight: this.external_system_queueFontWeight + }; + }, "external_system_queueFont"), + containerFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.containerFontFamily, + fontSize: this.containerFontSize, + fontWeight: this.containerFontWeight + }; + }, "containerFont"), + external_containerFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_containerFontFamily, + fontSize: this.external_containerFontSize, + fontWeight: this.external_containerFontWeight + }; + }, "external_containerFont"), + container_dbFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.container_dbFontFamily, + fontSize: this.container_dbFontSize, + fontWeight: this.container_dbFontWeight + }; + }, "container_dbFont"), + external_container_dbFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_container_dbFontFamily, + fontSize: this.external_container_dbFontSize, + fontWeight: this.external_container_dbFontWeight + }; + }, "external_container_dbFont"), + container_queueFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.container_queueFontFamily, + fontSize: this.container_queueFontSize, + fontWeight: this.container_queueFontWeight + }; + }, "container_queueFont"), + external_container_queueFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_container_queueFontFamily, + fontSize: this.external_container_queueFontSize, + fontWeight: this.external_container_queueFontWeight + }; + }, "external_container_queueFont"), + componentFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.componentFontFamily, + fontSize: this.componentFontSize, + fontWeight: this.componentFontWeight + }; + }, "componentFont"), + external_componentFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_componentFontFamily, + fontSize: this.external_componentFontSize, + fontWeight: this.external_componentFontWeight + }; + }, "external_componentFont"), + component_dbFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.component_dbFontFamily, + fontSize: this.component_dbFontSize, + fontWeight: this.component_dbFontWeight + }; + }, "component_dbFont"), + external_component_dbFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_component_dbFontFamily, + fontSize: this.external_component_dbFontSize, + fontWeight: this.external_component_dbFontWeight + }; + }, "external_component_dbFont"), + component_queueFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.component_queueFontFamily, + fontSize: this.component_queueFontSize, + fontWeight: this.component_queueFontWeight + }; + }, "component_queueFont"), + external_component_queueFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.external_component_queueFontFamily, + fontSize: this.external_component_queueFontSize, + fontWeight: this.external_component_queueFontWeight + }; + }, "external_component_queueFont"), + boundaryFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.boundaryFontFamily, + fontSize: this.boundaryFontSize, + fontWeight: this.boundaryFontWeight + }; + }, "boundaryFont"), + messageFont: /* @__PURE__ */ __name(function() { + return { + fontFamily: this.messageFontFamily, + fontSize: this.messageFontSize, + fontWeight: this.messageFontWeight + }; + }, "messageFont") + }, + pie: { + ...config_schema_default.pie, + useWidth: 984 + }, + xyChart: { + ...config_schema_default.xyChart, + useWidth: void 0 + }, + requirement: { + ...config_schema_default.requirement, + useWidth: void 0 + }, + packet: { + ...config_schema_default.packet + }, + eventmodeling: { + ...config_schema_default.eventmodeling + }, + treeView: { + ...config_schema_default.treeView, + useWidth: void 0 + }, + radar: { + ...config_schema_default.radar + }, + ishikawa: { + ...config_schema_default.ishikawa + }, + sankey: { + ...config_schema_default.sankey, + // Set so that `configKeys` includes this key for sanitizeDirective + nodeColors: void 0 + }, + treemap: { + useMaxWidth: true, + padding: 10, + diagramPadding: 8, + showValues: true, + nodeWidth: 100, + nodeHeight: 40, + borderWidth: 1, + valueFontSize: 12, + labelFontSize: 14, + valueFormat: "," + }, + venn: { + ...config_schema_default.venn + } + }; + keyify = /* @__PURE__ */ __name((obj, prefix = "") => Object.keys(obj).reduce((res, el) => { + if (Array.isArray(obj[el])) { + return res; + } else if (typeof obj[el] === "object" && obj[el] !== null) { + return [...res, prefix + el, ...keyify(obj[el], "")]; + } + return [...res, prefix + el]; + }, []), "keyify"); + configKeys = new Set(keyify(config, "")); + defaultConfig_default = config; + } + }); + + // src/utils/sanitizeDirective.ts + var sanitizeDirective, sanitizeCss; + var init_sanitizeDirective = __esm({ + "src/utils/sanitizeDirective.ts"() { + "use strict"; + init_defaultConfig(); + init_logger(); + sanitizeDirective = /* @__PURE__ */ __name((args) => { + log.debug("sanitizeDirective called with", args); + if (typeof args !== "object" || args == null) { + return; + } + if (Array.isArray(args)) { + args.forEach((arg) => sanitizeDirective(arg)); + return; + } + for (const key of Object.keys(args)) { + log.debug("Checking key", key); + if (key.startsWith("__") || key.includes("proto") || key.includes("constr") || !configKeys.has(key) || args[key] == null) { + log.debug("sanitize deleting key: ", key); + delete args[key]; + continue; + } + if (typeof args[key] === "object") { + if (key === "nodeColors") { + const colorPattern = /^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i; + for (const colorKey of Object.keys(args[key])) { + if (typeof args[key][colorKey] !== "string" || !colorPattern.test(args[key][colorKey])) { + log.debug("sanitize deleting invalid color:", colorKey, args[key][colorKey]); + delete args[key][colorKey]; + } + } + } else { + log.debug("sanitizing object", key); + sanitizeDirective(args[key]); + } + continue; + } + const cssMatchers = ["themeCSS", "fontFamily", "altFontFamily"]; + for (const cssKey of cssMatchers) { + if (key.includes(cssKey)) { + log.debug("sanitizing css option", key); + args[key] = sanitizeCss(args[key]); + } + } + } + if (args.themeVariables) { + for (const k2 of Object.keys(args.themeVariables)) { + const val = args.themeVariables[k2]; + if (val?.match && !val.match(/^[\d "#%(),.;A-Za-z]+$/)) { + args.themeVariables[k2] = ""; + } + } + } + log.debug("After sanitization", args); + }, "sanitizeDirective"); + sanitizeCss = /* @__PURE__ */ __name((str2) => { + let startCnt = 0; + let endCnt = 0; + for (const element3 of str2) { + if (startCnt < endCnt) { + return "{ /* ERROR: Unbalanced CSS */ }"; + } + if (element3 === "{") { + startCnt++; + } else if (element3 === "}") { + endCnt++; + } + } + if (startCnt !== endCnt) { + return "{ /* ERROR: Unbalanced CSS */ }"; + } + return str2; + }, "sanitizeCss"); + } + }); + + // src/config.ts + var defaultConfig, evaluate, siteConfig, configFromInitialize, directives, currentConfig, updateCurrentConfig, setSiteConfig, saveConfigFromInitialize, updateSiteConfig, getSiteConfig, setConfig, getConfig, sanitize, addDirective, reset, ConfigWarning, issuedWarnings, issueWarning, checkConfig, getUserDefinedConfig, getEffectiveHtmlLabels; + var init_config = __esm({ + "src/config.ts"() { + "use strict"; + init_assignWithDepth(); + init_logger(); + init_themes(); + init_defaultConfig(); + init_sanitizeDirective(); + defaultConfig = Object.freeze(defaultConfig_default); + evaluate = /* @__PURE__ */ __name((val) => val === false || ["false", "null", "0"].includes(String(val).trim().toLowerCase()) ? false : true, "evaluate"); + siteConfig = assignWithDepth_default({}, defaultConfig); + directives = []; + currentConfig = assignWithDepth_default({}, defaultConfig); + updateCurrentConfig = /* @__PURE__ */ __name((siteCfg, _directives) => { + let cfg = assignWithDepth_default({}, siteCfg); + let sumOfDirectives = {}; + for (const d3 of _directives) { + sanitize(d3); + sumOfDirectives = assignWithDepth_default(sumOfDirectives, d3); + } + cfg = assignWithDepth_default(cfg, sumOfDirectives); + if (sumOfDirectives.theme && sumOfDirectives.theme in themes_default) { + const tmpConfigFromInitialize = assignWithDepth_default({}, configFromInitialize); + const themeVariables = assignWithDepth_default( + tmpConfigFromInitialize.themeVariables || {}, + sumOfDirectives.themeVariables + ); + if (cfg.theme && cfg.theme in themes_default) { + cfg.themeVariables = themes_default[cfg.theme].getThemeVariables(themeVariables); + } + } + currentConfig = cfg; + checkConfig(currentConfig); + return currentConfig; + }, "updateCurrentConfig"); + setSiteConfig = /* @__PURE__ */ __name((conf5) => { + siteConfig = assignWithDepth_default({}, defaultConfig); + siteConfig = assignWithDepth_default(siteConfig, conf5); + if (conf5.theme && themes_default[conf5.theme]) { + siteConfig.themeVariables = themes_default[conf5.theme].getThemeVariables(conf5.themeVariables); + } + updateCurrentConfig(siteConfig, directives); + return siteConfig; + }, "setSiteConfig"); + saveConfigFromInitialize = /* @__PURE__ */ __name((conf5) => { + configFromInitialize = assignWithDepth_default({}, conf5); + }, "saveConfigFromInitialize"); + updateSiteConfig = /* @__PURE__ */ __name((conf5) => { + siteConfig = assignWithDepth_default(siteConfig, conf5); + updateCurrentConfig(siteConfig, directives); + return siteConfig; + }, "updateSiteConfig"); + getSiteConfig = /* @__PURE__ */ __name(() => { + return assignWithDepth_default({}, siteConfig); + }, "getSiteConfig"); + setConfig = /* @__PURE__ */ __name((conf5) => { + checkConfig(conf5); + assignWithDepth_default(currentConfig, conf5); + return getConfig(); + }, "setConfig"); + getConfig = /* @__PURE__ */ __name(() => { + return assignWithDepth_default({}, currentConfig); + }, "getConfig"); + sanitize = /* @__PURE__ */ __name((options2) => { + if (!options2) { + return; + } + ["secure", ...siteConfig.secure ?? []].forEach((key) => { + if (Object.hasOwn(options2, key)) { + log.debug(`Denied attempt to modify a secure key ${key}`, options2[key]); + delete options2[key]; + } + }); + Object.keys(options2).forEach((key) => { + if (key.startsWith("__")) { + delete options2[key]; + } + }); + Object.keys(options2).forEach((key) => { + if (typeof options2[key] === "string" && (options2[key].includes("<") || options2[key].includes(">") || options2[key].includes("url(data:"))) { + delete options2[key]; + } + if (typeof options2[key] === "object") { + sanitize(options2[key]); + } + }); + }, "sanitize"); + addDirective = /* @__PURE__ */ __name((directive) => { + sanitizeDirective(directive); + if (directive.fontFamily && !directive.themeVariables?.fontFamily) { + directive.themeVariables = { + ...directive.themeVariables, + fontFamily: directive.fontFamily + }; + } + directives.push(directive); + updateCurrentConfig(siteConfig, directives); + }, "addDirective"); + reset = /* @__PURE__ */ __name((config5 = siteConfig) => { + directives = []; + updateCurrentConfig(config5, directives); + }, "reset"); + ConfigWarning = { + LAZY_LOAD_DEPRECATED: "The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.", + FLOWCHART_HTML_LABELS_DEPRECATED: "flowchart.htmlLabels is deprecated. Please use global htmlLabels instead." + }; + issuedWarnings = {}; + issueWarning = /* @__PURE__ */ __name((warning) => { + if (issuedWarnings[warning]) { + return; + } + log.warn(ConfigWarning[warning]); + issuedWarnings[warning] = true; + }, "issueWarning"); + checkConfig = /* @__PURE__ */ __name((config5) => { + if (!config5) { + return; + } + if (config5.lazyLoadedDiagrams || config5.loadExternalDiagramsAtStartup) { + issueWarning("LAZY_LOAD_DEPRECATED"); + } + }, "checkConfig"); + getUserDefinedConfig = /* @__PURE__ */ __name(() => { + let userConfig = {}; + if (configFromInitialize) { + userConfig = assignWithDepth_default(userConfig, configFromInitialize); + } + for (const d3 of directives) { + userConfig = assignWithDepth_default(userConfig, d3); + } + return userConfig; + }, "getUserDefinedConfig"); + getEffectiveHtmlLabels = /* @__PURE__ */ __name((config5) => { + if (config5.flowchart?.htmlLabels != void 0) { + issueWarning("FLOWCHART_HTML_LABELS_DEPRECATED"); + } + return evaluate(config5.htmlLabels ?? config5.flowchart?.htmlLabels ?? true); + }, "getEffectiveHtmlLabels"); + } + }); + + // ../../node_modules/.pnpm/dompurify@3.4.0/node_modules/dompurify/dist/purify.es.mjs + function unapply(func) { + return function(thisArg) { + if (thisArg instanceof RegExp) { + thisArg.lastIndex = 0; + } + for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + args[_key3 - 1] = arguments[_key3]; + } + return apply(func, thisArg, args); + }; + } + function unconstruct(Func) { + return function() { + for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; + } + return construct(Func, args); + }; + } + function addToSet(set5, array4) { + let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase; + if (setPrototypeOf) { + setPrototypeOf(set5, null); + } + let l4 = array4.length; + while (l4--) { + let element3 = array4[l4]; + if (typeof element3 === "string") { + const lcElement = transformCaseFunc(element3); + if (lcElement !== element3) { + if (!isFrozen(array4)) { + array4[l4] = lcElement; + } + element3 = lcElement; + } + } + set5[element3] = true; + } + return set5; + } + function cleanArray(array4) { + for (let index = 0; index < array4.length; index++) { + const isPropertyExist = objectHasOwnProperty(array4, index); + if (!isPropertyExist) { + array4[index] = null; + } + } + return array4; + } + function clone(object3) { + const newObject = create(null); + for (const [property3, value2] of entries(object3)) { + const isPropertyExist = objectHasOwnProperty(object3, property3); + if (isPropertyExist) { + if (Array.isArray(value2)) { + newObject[property3] = cleanArray(value2); + } else if (value2 && typeof value2 === "object" && value2.constructor === Object) { + newObject[property3] = clone(value2); + } else { + newObject[property3] = value2; + } + } + } + return newObject; + } + function lookupGetter(object3, prop) { + while (object3 !== null) { + const desc = getOwnPropertyDescriptor(object3, prop); + if (desc) { + if (desc.get) { + return unapply(desc.get); + } + if (typeof desc.value === "function") { + return unapply(desc.value); + } + } + object3 = getPrototypeOf(object3); + } + function fallbackValue() { + return null; + } + __name(fallbackValue, "fallbackValue"); + return fallbackValue; + } + function createDOMPurify() { + let window3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(); + const DOMPurify = /* @__PURE__ */ __name((root4) => createDOMPurify(root4), "DOMPurify"); + DOMPurify.version = "3.4.0"; + DOMPurify.removed = []; + if (!window3 || !window3.document || window3.document.nodeType !== NODE_TYPE.document || !window3.Element) { + DOMPurify.isSupported = false; + return DOMPurify; + } + let { + document: document2 + } = window3; + const originalDocument = document2; + const currentScript = originalDocument.currentScript; + const { + DocumentFragment: DocumentFragment2, + HTMLTemplateElement, + Node: Node2, + Element: Element3, + NodeFilter, + NamedNodeMap = window3.NamedNodeMap || window3.MozNamedAttrMap, + HTMLFormElement, + DOMParser, + trustedTypes + } = window3; + const ElementPrototype = Element3.prototype; + const cloneNode = lookupGetter(ElementPrototype, "cloneNode"); + const remove3 = lookupGetter(ElementPrototype, "remove"); + const getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); + const getChildNodes = lookupGetter(ElementPrototype, "childNodes"); + const getParentNode = lookupGetter(ElementPrototype, "parentNode"); + if (typeof HTMLTemplateElement === "function") { + const template = document2.createElement("template"); + if (template.content && template.content.ownerDocument) { + document2 = template.content.ownerDocument; + } + } + let trustedTypesPolicy; + let emptyHTML = ""; + const { + implementation, + createNodeIterator, + createDocumentFragment, + getElementsByTagName + } = document2; + const { + importNode + } = originalDocument; + let hooks = _createHooksMap(); + DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0; + const { + MUSTACHE_EXPR: MUSTACHE_EXPR2, + ERB_EXPR: ERB_EXPR2, + TMPLIT_EXPR: TMPLIT_EXPR2, + DATA_ATTR: DATA_ATTR2, + ARIA_ATTR: ARIA_ATTR2, + IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2, + ATTR_WHITESPACE: ATTR_WHITESPACE2, + CUSTOM_ELEMENT: CUSTOM_ELEMENT2 + } = EXPRESSIONS; + let { + IS_ALLOWED_URI: IS_ALLOWED_URI$1 + } = EXPRESSIONS; + let ALLOWED_TAGS = null; + const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]); + let ALLOWED_ATTR = null; + const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]); + let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, { + tagNameCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + }, + attributeNameCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + }, + allowCustomizedBuiltInElements: { + writable: true, + configurable: false, + enumerable: true, + value: false + } + })); + let FORBID_TAGS = null; + let FORBID_ATTR = null; + const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, { + tagCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + }, + attributeCheck: { + writable: true, + configurable: false, + enumerable: true, + value: null + } + })); + let ALLOW_ARIA_ATTR = true; + let ALLOW_DATA_ATTR = true; + let ALLOW_UNKNOWN_PROTOCOLS = false; + let ALLOW_SELF_CLOSE_IN_ATTR = true; + let SAFE_FOR_TEMPLATES = false; + let SAFE_FOR_XML = true; + let WHOLE_DOCUMENT = false; + let SET_CONFIG = false; + let FORCE_BODY = false; + let RETURN_DOM = false; + let RETURN_DOM_FRAGMENT = false; + let RETURN_TRUSTED_TYPE = false; + let SANITIZE_DOM = true; + let SANITIZE_NAMED_PROPS = false; + const SANITIZE_NAMED_PROPS_PREFIX = "user-content-"; + let KEEP_CONTENT = true; + let IN_PLACE = false; + let USE_PROFILES = {}; + let FORBID_CONTENTS = null; + const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]); + let DATA_URI_TAGS = null; + const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]); + let URI_SAFE_ATTRIBUTES = null; + const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]); + const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; + const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; + const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; + let NAMESPACE2 = HTML_NAMESPACE; + let IS_EMPTY_INPUT = false; + let ALLOWED_NAMESPACES = null; + const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString); + let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]); + let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]); + const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]); + let PARSER_MEDIA_TYPE = null; + const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"]; + const DEFAULT_PARSER_MEDIA_TYPE = "text/html"; + let transformCaseFunc = null; + let CONFIG = null; + const formElement = document2.createElement("form"); + const isRegexOrFunction = /* @__PURE__ */ __name(function isRegexOrFunction2(testValue) { + return testValue instanceof RegExp || testValue instanceof Function; + }, "isRegexOrFunction"); + const _parseConfig = /* @__PURE__ */ __name(function _parseConfig2() { + let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + if (CONFIG && CONFIG === cfg) { + return; + } + if (!cfg || typeof cfg !== "object") { + cfg = {}; + } + cfg = clone(cfg); + PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes + SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE; + transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase; + ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; + ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; + ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; + URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES; + DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS; + FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; + FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({}); + FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({}); + USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false; + ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; + ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; + ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; + ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; + SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; + SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; + WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; + RETURN_DOM = cfg.RETURN_DOM || false; + RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; + RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; + FORCE_BODY = cfg.FORCE_BODY || false; + SANITIZE_DOM = cfg.SANITIZE_DOM !== false; + SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; + KEEP_CONTENT = cfg.KEEP_CONTENT !== false; + IN_PLACE = cfg.IN_PLACE || false; + IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI; + NAMESPACE2 = cfg.NAMESPACE || HTML_NAMESPACE; + MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS; + HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS; + CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || create(null); + if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { + CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; + } + if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { + CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; + } + if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") { + CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; + } + if (SAFE_FOR_TEMPLATES) { + ALLOW_DATA_ATTR = false; + } + if (RETURN_DOM_FRAGMENT) { + RETURN_DOM = true; + } + if (USE_PROFILES) { + ALLOWED_TAGS = addToSet({}, text); + ALLOWED_ATTR = create(null); + if (USE_PROFILES.html === true) { + addToSet(ALLOWED_TAGS, html$1); + addToSet(ALLOWED_ATTR, html); + } + if (USE_PROFILES.svg === true) { + addToSet(ALLOWED_TAGS, svg$1); + addToSet(ALLOWED_ATTR, svg); + addToSet(ALLOWED_ATTR, xml); + } + if (USE_PROFILES.svgFilters === true) { + addToSet(ALLOWED_TAGS, svgFilters); + addToSet(ALLOWED_ATTR, svg); + addToSet(ALLOWED_ATTR, xml); + } + if (USE_PROFILES.mathMl === true) { + addToSet(ALLOWED_TAGS, mathMl$1); + addToSet(ALLOWED_ATTR, mathMl); + addToSet(ALLOWED_ATTR, xml); + } + } + EXTRA_ELEMENT_HANDLING.tagCheck = null; + EXTRA_ELEMENT_HANDLING.attributeCheck = null; + if (cfg.ADD_TAGS) { + if (typeof cfg.ADD_TAGS === "function") { + EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS; + } else { + if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { + ALLOWED_TAGS = clone(ALLOWED_TAGS); + } + addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); + } + } + if (cfg.ADD_ATTR) { + if (typeof cfg.ADD_ATTR === "function") { + EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR; + } else { + if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { + ALLOWED_ATTR = clone(ALLOWED_ATTR); + } + addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); + } + } + if (cfg.ADD_URI_SAFE_ATTR) { + addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); + } + if (cfg.FORBID_CONTENTS) { + if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { + FORBID_CONTENTS = clone(FORBID_CONTENTS); + } + addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); + } + if (cfg.ADD_FORBID_CONTENTS) { + if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { + FORBID_CONTENTS = clone(FORBID_CONTENTS); + } + addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc); + } + if (KEEP_CONTENT) { + ALLOWED_TAGS["#text"] = true; + } + if (WHOLE_DOCUMENT) { + addToSet(ALLOWED_TAGS, ["html", "head", "body"]); + } + if (ALLOWED_TAGS.table) { + addToSet(ALLOWED_TAGS, ["tbody"]); + delete FORBID_TAGS.tbody; + } + if (cfg.TRUSTED_TYPES_POLICY) { + if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") { + throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.'); + } + if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") { + throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.'); + } + trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; + emptyHTML = trustedTypesPolicy.createHTML(""); + } else { + if (trustedTypesPolicy === void 0) { + trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript); + } + if (trustedTypesPolicy !== null && typeof emptyHTML === "string") { + emptyHTML = trustedTypesPolicy.createHTML(""); + } + } + if (freeze) { + freeze(cfg); + } + CONFIG = cfg; + }, "_parseConfig"); + const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]); + const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]); + const _checkValidNamespace = /* @__PURE__ */ __name(function _checkValidNamespace2(element3) { + let parent4 = getParentNode(element3); + if (!parent4 || !parent4.tagName) { + parent4 = { + namespaceURI: NAMESPACE2, + tagName: "template" + }; + } + const tagName = stringToLowerCase(element3.tagName); + const parentTagName = stringToLowerCase(parent4.tagName); + if (!ALLOWED_NAMESPACES[element3.namespaceURI]) { + return false; + } + if (element3.namespaceURI === SVG_NAMESPACE) { + if (parent4.namespaceURI === HTML_NAMESPACE) { + return tagName === "svg"; + } + if (parent4.namespaceURI === MATHML_NAMESPACE) { + return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); + } + return Boolean(ALL_SVG_TAGS[tagName]); + } + if (element3.namespaceURI === MATHML_NAMESPACE) { + if (parent4.namespaceURI === HTML_NAMESPACE) { + return tagName === "math"; + } + if (parent4.namespaceURI === SVG_NAMESPACE) { + return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName]; + } + return Boolean(ALL_MATHML_TAGS[tagName]); + } + if (element3.namespaceURI === HTML_NAMESPACE) { + if (parent4.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { + return false; + } + if (parent4.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { + return false; + } + return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); + } + if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element3.namespaceURI]) { + return true; + } + return false; + }, "_checkValidNamespace"); + const _forceRemove = /* @__PURE__ */ __name(function _forceRemove2(node2) { + arrayPush(DOMPurify.removed, { + element: node2 + }); + try { + getParentNode(node2).removeChild(node2); + } catch (_3) { + remove3(node2); + } + }, "_forceRemove"); + const _removeAttribute = /* @__PURE__ */ __name(function _removeAttribute2(name, element3) { + try { + arrayPush(DOMPurify.removed, { + attribute: element3.getAttributeNode(name), + from: element3 + }); + } catch (_3) { + arrayPush(DOMPurify.removed, { + attribute: null, + from: element3 + }); + } + element3.removeAttribute(name); + if (name === "is") { + if (RETURN_DOM || RETURN_DOM_FRAGMENT) { + try { + _forceRemove(element3); + } catch (_3) { + } + } else { + try { + element3.setAttribute(name, ""); + } catch (_3) { + } + } + } + }, "_removeAttribute"); + const _initDocument = /* @__PURE__ */ __name(function _initDocument2(dirty) { + let doc = null; + let leadingWhitespace = null; + if (FORCE_BODY) { + dirty = "" + dirty; + } else { + const matches33 = stringMatch(dirty, /^[\r\n\t ]+/); + leadingWhitespace = matches33 && matches33[0]; + } + if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE2 === HTML_NAMESPACE) { + dirty = '' + dirty + ""; + } + const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; + if (NAMESPACE2 === HTML_NAMESPACE) { + try { + doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); + } catch (_3) { + } + } + if (!doc || !doc.documentElement) { + doc = implementation.createDocument(NAMESPACE2, "template", null); + try { + doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; + } catch (_3) { + } + } + const body = doc.body || doc.documentElement; + if (dirty && leadingWhitespace) { + body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null); + } + if (NAMESPACE2 === HTML_NAMESPACE) { + return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0]; + } + return WHOLE_DOCUMENT ? doc.documentElement : body; + }, "_initDocument"); + const _createNodeIterator = /* @__PURE__ */ __name(function _createNodeIterator2(root4) { + return createNodeIterator.call( + root4.ownerDocument || root4, + root4, + // eslint-disable-next-line no-bitwise + NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, + null + ); + }, "_createNodeIterator"); + const _isClobbered = /* @__PURE__ */ __name(function _isClobbered2(element3) { + return element3 instanceof HTMLFormElement && (typeof element3.nodeName !== "string" || typeof element3.textContent !== "string" || typeof element3.removeChild !== "function" || !(element3.attributes instanceof NamedNodeMap) || typeof element3.removeAttribute !== "function" || typeof element3.setAttribute !== "function" || typeof element3.namespaceURI !== "string" || typeof element3.insertBefore !== "function" || typeof element3.hasChildNodes !== "function"); + }, "_isClobbered"); + const _isNode = /* @__PURE__ */ __name(function _isNode2(value2) { + return typeof Node2 === "function" && value2 instanceof Node2; + }, "_isNode"); + function _executeHooks(hooks2, currentNode, data5) { + arrayForEach(hooks2, (hook2) => { + hook2.call(DOMPurify, currentNode, data5, CONFIG); + }); + } + __name(_executeHooks, "_executeHooks"); + const _sanitizeElements = /* @__PURE__ */ __name(function _sanitizeElements2(currentNode) { + let content = null; + _executeHooks(hooks.beforeSanitizeElements, currentNode, null); + if (_isClobbered(currentNode)) { + _forceRemove(currentNode); + return true; + } + const tagName = transformCaseFunc(currentNode.nodeName); + _executeHooks(hooks.uponSanitizeElement, currentNode, { + tagName, + allowedTags: ALLOWED_TAGS + }); + if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) { + _forceRemove(currentNode); + return true; + } + if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) { + _forceRemove(currentNode); + return true; + } + if (currentNode.nodeType === NODE_TYPE.progressingInstruction) { + _forceRemove(currentNode); + return true; + } + if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) { + _forceRemove(currentNode); + return true; + } + if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) { + if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) { + if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) { + return false; + } + if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) { + return false; + } + } + if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) { + const parentNode = getParentNode(currentNode) || currentNode.parentNode; + const childNodes = getChildNodes(currentNode) || currentNode.childNodes; + if (childNodes && parentNode) { + const childCount = childNodes.length; + for (let i2 = childCount - 1; i2 >= 0; --i2) { + const childClone = cloneNode(childNodes[i2], true); + childClone.__removalCount = (currentNode.__removalCount || 0) + 1; + parentNode.insertBefore(childClone, getNextSibling(currentNode)); + } + } + } + _forceRemove(currentNode); + return true; + } + if (currentNode instanceof Element3 && !_checkValidNamespace(currentNode)) { + _forceRemove(currentNode); + return true; + } + if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) { + _forceRemove(currentNode); + return true; + } + if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) { + content = currentNode.textContent; + arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { + content = stringReplace(content, expr, " "); + }); + if (currentNode.textContent !== content) { + arrayPush(DOMPurify.removed, { + element: currentNode.cloneNode() + }); + currentNode.textContent = content; + } + } + _executeHooks(hooks.afterSanitizeElements, currentNode, null); + return false; + }, "_sanitizeElements"); + const _isValidAttribute = /* @__PURE__ */ __name(function _isValidAttribute2(lcTag, lcName, value2) { + if (FORBID_ATTR[lcName]) { + return false; + } + if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value2 in document2 || value2 in formElement)) { + return false; + } + if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ; + else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ; + else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; + else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) { + if ( + // First condition does a very basic check if a) it's basically a valid custom element tagname AND + // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck + // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck + _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || // Alternative, second condition checks if it's an `is`-attribute, AND + // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck + lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value2) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value2)) + ) ; + else { + return false; + } + } else if (URI_SAFE_ATTRIBUTES[lcName]) ; + else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value2, ATTR_WHITESPACE2, ""))) ; + else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value2, "data:") === 0 && DATA_URI_TAGS[lcTag]) ; + else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value2, ATTR_WHITESPACE2, ""))) ; + else if (value2) { + return false; + } else ; + return true; + }, "_isValidAttribute"); + const _isBasicCustomElement = /* @__PURE__ */ __name(function _isBasicCustomElement2(tagName) { + return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2); + }, "_isBasicCustomElement"); + const _sanitizeAttributes = /* @__PURE__ */ __name(function _sanitizeAttributes2(currentNode) { + _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null); + const { + attributes + } = currentNode; + if (!attributes || _isClobbered(currentNode)) { + return; + } + const hookEvent = { + attrName: "", + attrValue: "", + keepAttr: true, + allowedAttributes: ALLOWED_ATTR, + forceKeepAttr: void 0 + }; + let l4 = attributes.length; + while (l4--) { + const attr = attributes[l4]; + const { + name, + namespaceURI, + value: attrValue + } = attr; + const lcName = transformCaseFunc(name); + const initValue = attrValue; + let value2 = name === "value" ? initValue : stringTrim(initValue); + hookEvent.attrName = lcName; + hookEvent.attrValue = value2; + hookEvent.keepAttr = true; + hookEvent.forceKeepAttr = void 0; + _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent); + value2 = hookEvent.attrValue; + if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) { + _removeAttribute(name, currentNode); + value2 = SANITIZE_NAMED_PROPS_PREFIX + value2; + } + if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value2)) { + _removeAttribute(name, currentNode); + continue; + } + if (lcName === "attributename" && stringMatch(value2, "href")) { + _removeAttribute(name, currentNode); + continue; + } + if (hookEvent.forceKeepAttr) { + continue; + } + if (!hookEvent.keepAttr) { + _removeAttribute(name, currentNode); + continue; + } + if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value2)) { + _removeAttribute(name, currentNode); + continue; + } + if (SAFE_FOR_TEMPLATES) { + arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { + value2 = stringReplace(value2, expr, " "); + }); + } + const lcTag = transformCaseFunc(currentNode.nodeName); + if (!_isValidAttribute(lcTag, lcName, value2)) { + _removeAttribute(name, currentNode); + continue; + } + if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") { + if (namespaceURI) ; + else { + switch (trustedTypes.getAttributeType(lcTag, lcName)) { + case "TrustedHTML": { + value2 = trustedTypesPolicy.createHTML(value2); + break; + } + case "TrustedScriptURL": { + value2 = trustedTypesPolicy.createScriptURL(value2); + break; + } + } + } + } + if (value2 !== initValue) { + try { + if (namespaceURI) { + currentNode.setAttributeNS(namespaceURI, name, value2); + } else { + currentNode.setAttribute(name, value2); + } + if (_isClobbered(currentNode)) { + _forceRemove(currentNode); + } else { + arrayPop(DOMPurify.removed); + } + } catch (_3) { + _removeAttribute(name, currentNode); + } + } + } + _executeHooks(hooks.afterSanitizeAttributes, currentNode, null); + }, "_sanitizeAttributes"); + const _sanitizeShadowDOM2 = /* @__PURE__ */ __name(function _sanitizeShadowDOM(fragment) { + let shadowNode = null; + const shadowIterator = _createNodeIterator(fragment); + _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null); + while (shadowNode = shadowIterator.nextNode()) { + _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null); + _sanitizeElements(shadowNode); + _sanitizeAttributes(shadowNode); + if (shadowNode.content instanceof DocumentFragment2) { + _sanitizeShadowDOM2(shadowNode.content); + } + } + _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null); + }, "_sanitizeShadowDOM"); + DOMPurify.sanitize = function(dirty) { + let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; + let body = null; + let importedNode = null; + let currentNode = null; + let returnNode = null; + IS_EMPTY_INPUT = !dirty; + if (IS_EMPTY_INPUT) { + dirty = ""; + } + if (typeof dirty !== "string" && !_isNode(dirty)) { + if (typeof dirty.toString === "function") { + dirty = dirty.toString(); + if (typeof dirty !== "string") { + throw typeErrorCreate("dirty is not a string, aborting"); + } + } else { + throw typeErrorCreate("toString is not a function"); + } + } + if (!DOMPurify.isSupported) { + return dirty; + } + if (!SET_CONFIG) { + _parseConfig(cfg); + } + DOMPurify.removed = []; + if (typeof dirty === "string") { + IN_PLACE = false; + } + if (IN_PLACE) { + if (dirty.nodeName) { + const tagName = transformCaseFunc(dirty.nodeName); + if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { + throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place"); + } + } + } else if (dirty instanceof Node2) { + body = _initDocument(""); + importedNode = body.ownerDocument.importNode(dirty, true); + if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") { + body = importedNode; + } else if (importedNode.nodeName === "HTML") { + body = importedNode; + } else { + body.appendChild(importedNode); + } + } else { + if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes + dirty.indexOf("<") === -1) { + return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty; + } + body = _initDocument(dirty); + if (!body) { + return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : ""; + } + } + if (body && FORCE_BODY) { + _forceRemove(body.firstChild); + } + const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body); + while (currentNode = nodeIterator.nextNode()) { + _sanitizeElements(currentNode); + _sanitizeAttributes(currentNode); + if (currentNode.content instanceof DocumentFragment2) { + _sanitizeShadowDOM2(currentNode.content); + } + } + if (IN_PLACE) { + return dirty; + } + if (RETURN_DOM) { + if (SAFE_FOR_TEMPLATES) { + body.normalize(); + let html2 = body.innerHTML; + arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { + html2 = stringReplace(html2, expr, " "); + }); + body.innerHTML = html2; + } + if (RETURN_DOM_FRAGMENT) { + returnNode = createDocumentFragment.call(body.ownerDocument); + while (body.firstChild) { + returnNode.appendChild(body.firstChild); + } + } else { + returnNode = body; + } + if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) { + returnNode = importNode.call(originalDocument, returnNode, true); + } + return returnNode; + } + let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML; + if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) { + serializedHTML = "\n" + serializedHTML; + } + if (SAFE_FOR_TEMPLATES) { + arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => { + serializedHTML = stringReplace(serializedHTML, expr, " "); + }); + } + return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML; + }; + DOMPurify.setConfig = function() { + let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; + _parseConfig(cfg); + SET_CONFIG = true; + }; + DOMPurify.clearConfig = function() { + CONFIG = null; + SET_CONFIG = false; + }; + DOMPurify.isValidAttribute = function(tag, attr, value2) { + if (!CONFIG) { + _parseConfig({}); + } + const lcTag = transformCaseFunc(tag); + const lcName = transformCaseFunc(attr); + return _isValidAttribute(lcTag, lcName, value2); + }; + DOMPurify.addHook = function(entryPoint, hookFunction) { + if (typeof hookFunction !== "function") { + return; + } + arrayPush(hooks[entryPoint], hookFunction); + }; + DOMPurify.removeHook = function(entryPoint, hookFunction) { + if (hookFunction !== void 0) { + const index = arrayLastIndexOf(hooks[entryPoint], hookFunction); + return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0]; + } + return arrayPop(hooks[entryPoint]); + }; + DOMPurify.removeHooks = function(entryPoint) { + hooks[entryPoint] = []; + }; + DOMPurify.removeAllHooks = function() { + hooks = _createHooksMap(); + }; + return DOMPurify; + } + var entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor, freeze, seal, create, apply, construct, arrayForEach, arrayLastIndexOf, arrayPop, arrayPush, arraySplice, stringToLowerCase, stringToString, stringMatch, stringReplace, stringIndexOf, stringTrim, objectHasOwnProperty, regExpTest, typeErrorCreate, html$1, svg$1, svgFilters, svgDisallowed, mathMl$1, mathMlDisallowed, text, html, svg, mathMl, xml, MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR, DATA_ATTR, ARIA_ATTR, IS_ALLOWED_URI, IS_SCRIPT_OR_DATA, ATTR_WHITESPACE, DOCTYPE_NAME, CUSTOM_ELEMENT, EXPRESSIONS, NODE_TYPE, getGlobal, _createTrustedTypesPolicy, _createHooksMap, purify; + var init_purify_es = __esm({ + "../../node_modules/.pnpm/dompurify@3.4.0/node_modules/dompurify/dist/purify.es.mjs"() { + "use strict"; + ({ + entries, + setPrototypeOf, + isFrozen, + getPrototypeOf, + getOwnPropertyDescriptor + } = Object); + ({ + freeze, + seal, + create + } = Object); + ({ + apply, + construct + } = typeof Reflect !== "undefined" && Reflect); + if (!freeze) { + freeze = /* @__PURE__ */ __name(function freeze2(x5) { + return x5; + }, "freeze"); + } + if (!seal) { + seal = /* @__PURE__ */ __name(function seal2(x5) { + return x5; + }, "seal"); + } + if (!apply) { + apply = /* @__PURE__ */ __name(function apply5(func, thisArg) { + for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } + return func.apply(thisArg, args); + }, "apply"); + } + if (!construct) { + construct = /* @__PURE__ */ __name(function construct2(Func) { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + return new Func(...args); + }, "construct"); + } + arrayForEach = unapply(Array.prototype.forEach); + arrayLastIndexOf = unapply(Array.prototype.lastIndexOf); + arrayPop = unapply(Array.prototype.pop); + arrayPush = unapply(Array.prototype.push); + arraySplice = unapply(Array.prototype.splice); + stringToLowerCase = unapply(String.prototype.toLowerCase); + stringToString = unapply(String.prototype.toString); + stringMatch = unapply(String.prototype.match); + stringReplace = unapply(String.prototype.replace); + stringIndexOf = unapply(String.prototype.indexOf); + stringTrim = unapply(String.prototype.trim); + objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty); + regExpTest = unapply(RegExp.prototype.test); + typeErrorCreate = unconstruct(TypeError); + __name(unapply, "unapply"); + __name(unconstruct, "unconstruct"); + __name(addToSet, "addToSet"); + __name(cleanArray, "cleanArray"); + __name(clone, "clone"); + __name(lookupGetter, "lookupGetter"); + html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]); + svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]); + svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]); + svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]); + mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]); + mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]); + text = freeze(["#text"]); + html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]); + svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]); + mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]); + xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]); + MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); + ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); + TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); + DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); + ARIA_ATTR = seal(/^aria-[\-\w]+$/); + IS_ALLOWED_URI = seal( + /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i + // eslint-disable-line no-useless-escape + ); + IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); + ATTR_WHITESPACE = seal( + /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g + // eslint-disable-line no-control-regex + ); + DOCTYPE_NAME = seal(/^html$/i); + CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i); + EXPRESSIONS = /* @__PURE__ */ Object.freeze({ + __proto__: null, + ARIA_ATTR, + ATTR_WHITESPACE, + CUSTOM_ELEMENT, + DATA_ATTR, + DOCTYPE_NAME, + ERB_EXPR, + IS_ALLOWED_URI, + IS_SCRIPT_OR_DATA, + MUSTACHE_EXPR, + TMPLIT_EXPR + }); + NODE_TYPE = { + element: 1, + text: 3, + // Deprecated + progressingInstruction: 7, + comment: 8, + document: 9 + }; + getGlobal = /* @__PURE__ */ __name(function getGlobal2() { + return typeof window === "undefined" ? null : window; + }, "getGlobal"); + _createTrustedTypesPolicy = /* @__PURE__ */ __name(function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) { + if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") { + return null; + } + let suffix = null; + const ATTR_NAME = "data-tt-policy-suffix"; + if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) { + suffix = purifyHostElement.getAttribute(ATTR_NAME); + } + const policyName = "dompurify" + (suffix ? "#" + suffix : ""); + try { + return trustedTypes.createPolicy(policyName, { + createHTML(html2) { + return html2; + }, + createScriptURL(scriptUrl) { + return scriptUrl; + } + }); + } catch (_3) { + console.warn("TrustedTypes policy " + policyName + " could not be created."); + return null; + } + }, "_createTrustedTypesPolicy"); + _createHooksMap = /* @__PURE__ */ __name(function _createHooksMap2() { + return { + afterSanitizeAttributes: [], + afterSanitizeElements: [], + afterSanitizeShadowDOM: [], + beforeSanitizeAttributes: [], + beforeSanitizeElements: [], + beforeSanitizeShadowDOM: [], + uponSanitizeAttribute: [], + uponSanitizeElement: [], + uponSanitizeShadowNode: [] + }; + }, "_createHooksMap"); + __name(createDOMPurify, "createDOMPurify"); + purify = createDOMPurify(); + } + }); + + // ../../node_modules/.pnpm/katex@0.16.25/node_modules/katex/dist/katex.mjs + var katex_exports = {}; + __export(katex_exports, { + ParseError: () => ParseError, + SETTINGS_SCHEMA: () => SETTINGS_SCHEMA, + __defineFunction: () => defineFunction, + __defineMacro: () => defineMacro, + __defineSymbol: () => defineSymbol, + __domTree: () => __domTree, + __parse: () => generateParseTree, + __renderToDomTree: () => renderToDomTree, + __renderToHTMLTree: () => renderToHTMLTree, + __setFontMetrics: () => setFontMetrics, + default: () => katex, + render: () => render, + renderToString: () => renderToString, + version: () => version + }); + function escape2(text4) { + return String(text4).replace(ESCAPE_REGEX, (match3) => ESCAPE_LOOKUP[match3]); + } + function getDefaultValue(schema2) { + if (schema2.default) { + return schema2.default; + } + var type3 = schema2.type; + var defaultType = Array.isArray(type3) ? type3[0] : type3; + if (typeof defaultType !== "string") { + return defaultType.enum[0]; + } + switch (defaultType) { + case "boolean": + return false; + case "string": + return ""; + case "number": + return 0; + case "object": + return {}; + } + } + function scriptFromCodepoint(codepoint) { + for (var i2 = 0; i2 < scriptData.length; i2++) { + var script = scriptData[i2]; + for (var _i = 0; _i < script.blocks.length; _i++) { + var block2 = script.blocks[_i]; + if (codepoint >= block2[0] && codepoint <= block2[1]) { + return script.name; + } + } + } + return null; + } + function supportedCodepoint(codepoint) { + for (var i2 = 0; i2 < allBlocks.length; i2 += 2) { + if (codepoint >= allBlocks[i2] && codepoint <= allBlocks[i2 + 1]) { + return true; + } + } + return false; + } + function setFontMetrics(fontName, metrics) { + fontMetricsData[fontName] = metrics; + } + function getCharacterMetrics(character2, font, mode) { + if (!fontMetricsData[font]) { + throw new Error("Font metrics not found for font: " + font + "."); + } + var ch = character2.charCodeAt(0); + var metrics = fontMetricsData[font][ch]; + if (!metrics && character2[0] in extraCharacterMap) { + ch = extraCharacterMap[character2[0]].charCodeAt(0); + metrics = fontMetricsData[font][ch]; + } + if (!metrics && mode === "text") { + if (supportedCodepoint(ch)) { + metrics = fontMetricsData[font][77]; + } + } + if (metrics) { + return { + depth: metrics[0], + height: metrics[1], + italic: metrics[2], + skew: metrics[3], + width: metrics[4] + }; + } + } + function getGlobalMetrics(size4) { + var sizeIndex; + if (size4 >= 5) { + sizeIndex = 0; + } else if (size4 >= 3) { + sizeIndex = 1; + } else { + sizeIndex = 2; + } + if (!fontMetricsBySizeIndex[sizeIndex]) { + var metrics = fontMetricsBySizeIndex[sizeIndex] = { + cssEmPerMu: sigmasAndXis.quad[sizeIndex] / 18 + }; + for (var key in sigmasAndXis) { + if (sigmasAndXis.hasOwnProperty(key)) { + metrics[key] = sigmasAndXis[key][sizeIndex]; + } + } + } + return fontMetricsBySizeIndex[sizeIndex]; + } + function assertSymbolDomNode(group2) { + if (group2 instanceof SymbolNode) { + return group2; + } else { + throw new Error("Expected symbolNode but got " + String(group2) + "."); + } + } + function assertSpan(group2) { + if (group2 instanceof Span) { + return group2; + } else { + throw new Error("Expected span but got " + String(group2) + "."); + } + } + function defineSymbol(mode, font, group2, replace2, name, acceptUnicodeChar) { + symbols[mode][name] = { + font, + group: group2, + replace: replace2 + }; + if (acceptUnicodeChar && replace2) { + symbols[mode][replace2] = symbols[mode][name]; + } + } + function defineFunction(_ref) { + var { + type: type3, + names, + props, + handler, + htmlBuilder: htmlBuilder3, + mathmlBuilder: mathmlBuilder3 + } = _ref; + var data5 = { + type: type3, + numArgs: props.numArgs, + argTypes: props.argTypes, + allowedInArgument: !!props.allowedInArgument, + allowedInText: !!props.allowedInText, + allowedInMath: props.allowedInMath === void 0 ? true : props.allowedInMath, + numOptionalArgs: props.numOptionalArgs || 0, + infix: !!props.infix, + primitive: !!props.primitive, + handler + }; + for (var i2 = 0; i2 < names.length; ++i2) { + _functions[names[i2]] = data5; + } + if (type3) { + if (htmlBuilder3) { + _htmlGroupBuilders[type3] = htmlBuilder3; + } + if (mathmlBuilder3) { + _mathmlGroupBuilders[type3] = mathmlBuilder3; + } + } + } + function defineFunctionBuilders(_ref2) { + var { + type: type3, + htmlBuilder: htmlBuilder3, + mathmlBuilder: mathmlBuilder3 + } = _ref2; + defineFunction({ + type: type3, + names: [], + props: { + numArgs: 0 + }, + handler() { + throw new Error("Should never be called."); + }, + htmlBuilder: htmlBuilder3, + mathmlBuilder: mathmlBuilder3 + }); + } + function buildHTMLUnbreakable(children2, options2) { + var body = makeSpan$1(["base"], children2, options2); + var strut = makeSpan$1(["strut"]); + strut.style.height = makeEm(body.height + body.depth); + if (body.depth) { + strut.style.verticalAlign = makeEm(-body.depth); + } + body.children.unshift(strut); + return body; + } + function buildHTML(tree, options2) { + var tag = null; + if (tree.length === 1 && tree[0].type === "tag") { + tag = tree[0].tag; + tree = tree[0].body; + } + var expression = buildExpression$1(tree, options2, "root"); + var eqnNum; + if (expression.length === 2 && expression[1].hasClass("tag")) { + eqnNum = expression.pop(); + } + var children2 = []; + var parts = []; + for (var i2 = 0; i2 < expression.length; i2++) { + parts.push(expression[i2]); + if (expression[i2].hasClass("mbin") || expression[i2].hasClass("mrel") || expression[i2].hasClass("allowbreak")) { + var nobreak = false; + while (i2 < expression.length - 1 && expression[i2 + 1].hasClass("mspace") && !expression[i2 + 1].hasClass("newline")) { + i2++; + parts.push(expression[i2]); + if (expression[i2].hasClass("nobreak")) { + nobreak = true; + } + } + if (!nobreak) { + children2.push(buildHTMLUnbreakable(parts, options2)); + parts = []; + } + } else if (expression[i2].hasClass("newline")) { + parts.pop(); + if (parts.length > 0) { + children2.push(buildHTMLUnbreakable(parts, options2)); + parts = []; + } + children2.push(expression[i2]); + } + } + if (parts.length > 0) { + children2.push(buildHTMLUnbreakable(parts, options2)); + } + var tagChild; + if (tag) { + tagChild = buildHTMLUnbreakable(buildExpression$1(tag, options2, true)); + tagChild.classes = ["tag"]; + children2.push(tagChild); + } else if (eqnNum) { + children2.push(eqnNum); + } + var htmlNode = makeSpan$1(["katex-html"], children2); + htmlNode.setAttribute("aria-hidden", "true"); + if (tagChild) { + var strut = tagChild.children[0]; + strut.style.height = makeEm(htmlNode.height + htmlNode.depth); + if (htmlNode.depth) { + strut.style.verticalAlign = makeEm(-htmlNode.depth); + } + } + return htmlNode; + } + function newDocumentFragment(children2) { + return new DocumentFragment(children2); + } + function isNumberPunctuation(group2) { + if (!group2) { + return false; + } + if (group2.type === "mi" && group2.children.length === 1) { + var child = group2.children[0]; + return child instanceof TextNode && child.text === "."; + } else if (group2.type === "mo" && group2.children.length === 1 && group2.getAttribute("separator") === "true" && group2.getAttribute("lspace") === "0em" && group2.getAttribute("rspace") === "0em") { + var _child = group2.children[0]; + return _child instanceof TextNode && _child.text === ","; + } else { + return false; + } + } + function buildMathML(tree, texExpression, options2, isDisplayMode, forMathmlOnly) { + var expression = buildExpression2(tree, options2); + var wrapper; + if (expression.length === 1 && expression[0] instanceof MathNode && ["mrow", "mtable"].includes(expression[0].type)) { + wrapper = expression[0]; + } else { + wrapper = new mathMLTree.MathNode("mrow", expression); + } + var annotation = new mathMLTree.MathNode("annotation", [new mathMLTree.TextNode(texExpression)]); + annotation.setAttribute("encoding", "application/x-tex"); + var semantics = new mathMLTree.MathNode("semantics", [wrapper, annotation]); + var math2 = new mathMLTree.MathNode("math", [semantics]); + math2.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"); + if (isDisplayMode) { + math2.setAttribute("display", "block"); + } + var wrapperClass = forMathmlOnly ? "katex" : "katex-mathml"; + return buildCommon.makeSpan([wrapperClass], [math2]); + } + function assertNodeType(node2, type3) { + if (!node2 || node2.type !== type3) { + throw new Error("Expected node of type " + type3 + ", but got " + (node2 ? "node of type " + node2.type : String(node2))); + } + return node2; + } + function assertSymbolNodeType(node2) { + var typedNode = checkSymbolNodeType(node2); + if (!typedNode) { + throw new Error("Expected node of symbol group type, but got " + (node2 ? "node of type " + node2.type : String(node2))); + } + return typedNode; + } + function checkSymbolNodeType(node2) { + if (node2 && (node2.type === "atom" || NON_ATOMS.hasOwnProperty(node2.type))) { + return node2; + } + return null; + } + function htmlBuilder$9(group2, options2) { + var elements2 = buildExpression$1(group2.body, options2, true); + return makeSpan2([group2.mclass], elements2, options2); + } + function mathmlBuilder$8(group2, options2) { + var node2; + var inner2 = buildExpression2(group2.body, options2); + if (group2.mclass === "minner") { + node2 = new mathMLTree.MathNode("mpadded", inner2); + } else if (group2.mclass === "mord") { + if (group2.isCharacterBox) { + node2 = inner2[0]; + node2.type = "mi"; + } else { + node2 = new mathMLTree.MathNode("mi", inner2); + } + } else { + if (group2.isCharacterBox) { + node2 = inner2[0]; + node2.type = "mo"; + } else { + node2 = new mathMLTree.MathNode("mo", inner2); + } + if (group2.mclass === "mbin") { + node2.attributes.lspace = "0.22em"; + node2.attributes.rspace = "0.22em"; + } else if (group2.mclass === "mpunct") { + node2.attributes.lspace = "0em"; + node2.attributes.rspace = "0.17em"; + } else if (group2.mclass === "mopen" || group2.mclass === "mclose") { + node2.attributes.lspace = "0em"; + node2.attributes.rspace = "0em"; + } else if (group2.mclass === "minner") { + node2.attributes.lspace = "0.0556em"; + node2.attributes.width = "+0.1111em"; + } + } + return node2; + } + function cdArrow(arrowChar, labels, parser29) { + var funcName = cdArrowFunctionName[arrowChar]; + switch (funcName) { + case "\\\\cdrightarrow": + case "\\\\cdleftarrow": + return parser29.callFunction(funcName, [labels[0]], [labels[1]]); + case "\\uparrow": + case "\\downarrow": { + var leftLabel = parser29.callFunction("\\\\cdleft", [labels[0]], []); + var bareArrow = { + type: "atom", + text: funcName, + mode: "math", + family: "rel" + }; + var sizedArrow = parser29.callFunction("\\Big", [bareArrow], []); + var rightLabel = parser29.callFunction("\\\\cdright", [labels[1]], []); + var arrowGroup = { + type: "ordgroup", + mode: "math", + body: [leftLabel, sizedArrow, rightLabel] + }; + return parser29.callFunction("\\\\cdparent", [arrowGroup], []); + } + case "\\\\cdlongequal": + return parser29.callFunction("\\\\cdlongequal", [], []); + case "\\Vert": { + var arrow = { + type: "textord", + text: "\\Vert", + mode: "math" + }; + return parser29.callFunction("\\Big", [arrow], []); + } + default: + return { + type: "textord", + text: " ", + mode: "math" + }; + } + } + function parseCD(parser29) { + var parsedRows = []; + parser29.gullet.beginGroup(); + parser29.gullet.macros.set("\\cr", "\\\\\\relax"); + parser29.gullet.beginGroup(); + while (true) { + parsedRows.push(parser29.parseExpression(false, "\\\\")); + parser29.gullet.endGroup(); + parser29.gullet.beginGroup(); + var next3 = parser29.fetch().text; + if (next3 === "&" || next3 === "\\\\") { + parser29.consume(); + } else if (next3 === "\\end") { + if (parsedRows[parsedRows.length - 1].length === 0) { + parsedRows.pop(); + } + break; + } else { + throw new ParseError("Expected \\\\ or \\cr or \\end", parser29.nextToken); + } + } + var row = []; + var body = [row]; + for (var i2 = 0; i2 < parsedRows.length; i2++) { + var rowNodes = parsedRows[i2]; + var cell = newCell(); + for (var j3 = 0; j3 < rowNodes.length; j3++) { + if (!isStartOfArrow(rowNodes[j3])) { + cell.body.push(rowNodes[j3]); + } else { + row.push(cell); + j3 += 1; + var arrowChar = assertSymbolNodeType(rowNodes[j3]).text; + var labels = new Array(2); + labels[0] = { + type: "ordgroup", + mode: "math", + body: [] + }; + labels[1] = { + type: "ordgroup", + mode: "math", + body: [] + }; + if ("=|.".indexOf(arrowChar) > -1) ; + else if ("<>AV".indexOf(arrowChar) > -1) { + for (var labelNum = 0; labelNum < 2; labelNum++) { + var inLabel = true; + for (var k2 = j3 + 1; k2 < rowNodes.length; k2++) { + if (isLabelEnd(rowNodes[k2], arrowChar)) { + inLabel = false; + j3 = k2; + break; + } + if (isStartOfArrow(rowNodes[k2])) { + throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[k2]); + } + labels[labelNum].body.push(rowNodes[k2]); + } + if (inLabel) { + throw new ParseError("Missing a " + arrowChar + " character to complete a CD arrow.", rowNodes[j3]); + } + } + } else { + throw new ParseError('Expected one of "<>AV=|." after @', rowNodes[j3]); + } + var arrow = cdArrow(arrowChar, labels, parser29); + var wrappedArrow = { + type: "styling", + body: [arrow], + mode: "math", + style: "display" + // CD is always displaystyle. + }; + row.push(wrappedArrow); + cell = newCell(); + } + } + if (i2 % 2 === 0) { + row.push(cell); + } else { + row.shift(); + } + row = []; + body.push(row); + } + parser29.gullet.endGroup(); + parser29.gullet.endGroup(); + var cols = new Array(body[0].length).fill({ + type: "align", + align: "c", + pregap: 0.25, + // CD package sets \enskip between columns. + postgap: 0.25 + // So pre and post each get half an \enskip, i.e. 0.25em. + }); + return { + type: "array", + mode: "math", + body, + arraystretch: 1, + addJot: true, + rowGaps: [null], + cols, + colSeparationType: "CD", + hLinesBeforeRow: new Array(body.length + 1).fill([]) + }; + } + function checkDelimiter(delim, context) { + var symDelim = checkSymbolNodeType(delim); + if (symDelim && delimiters.includes(symDelim.text)) { + return symDelim; + } else if (symDelim) { + throw new ParseError("Invalid delimiter '" + symDelim.text + "' after '" + context.funcName + "'", delim); + } else { + throw new ParseError("Invalid delimiter type '" + delim.type + "'", delim); + } + } + function assertParsed(group2) { + if (!group2.body) { + throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); + } + } + function defineEnvironment(_ref) { + var { + type: type3, + names, + props, + handler, + htmlBuilder: htmlBuilder3, + mathmlBuilder: mathmlBuilder3 + } = _ref; + var data5 = { + type: type3, + numArgs: props.numArgs || 0, + allowedInText: false, + numOptionalArgs: 0, + handler + }; + for (var i2 = 0; i2 < names.length; ++i2) { + _environments[names[i2]] = data5; + } + if (htmlBuilder3) { + _htmlGroupBuilders[type3] = htmlBuilder3; + } + if (mathmlBuilder3) { + _mathmlGroupBuilders[type3] = mathmlBuilder3; + } + } + function defineMacro(name, body) { + _macros[name] = body; + } + function getHLines(parser29) { + var hlineInfo = []; + parser29.consumeSpaces(); + var nxt = parser29.fetch().text; + if (nxt === "\\relax") { + parser29.consume(); + parser29.consumeSpaces(); + nxt = parser29.fetch().text; + } + while (nxt === "\\hline" || nxt === "\\hdashline") { + parser29.consume(); + hlineInfo.push(nxt === "\\hdashline"); + parser29.consumeSpaces(); + nxt = parser29.fetch().text; + } + return hlineInfo; + } + function getAutoTag(name) { + if (name.indexOf("ed") === -1) { + return name.indexOf("*") === -1; + } + } + function parseArray(parser29, _ref, style3) { + var { + hskipBeforeAndAfter, + addJot, + cols, + arraystretch, + colSeparationType, + autoTag, + singleRow, + emptySingleRow, + maxNumCols, + leqno + } = _ref; + parser29.gullet.beginGroup(); + if (!singleRow) { + parser29.gullet.macros.set("\\cr", "\\\\\\relax"); + } + if (!arraystretch) { + var stretch = parser29.gullet.expandMacroAsText("\\arraystretch"); + if (stretch == null) { + arraystretch = 1; + } else { + arraystretch = parseFloat(stretch); + if (!arraystretch || arraystretch < 0) { + throw new ParseError("Invalid \\arraystretch: " + stretch); + } + } + } + parser29.gullet.beginGroup(); + var row = []; + var body = [row]; + var rowGaps = []; + var hLinesBeforeRow = []; + var tags2 = autoTag != null ? [] : void 0; + function beginRow() { + if (autoTag) { + parser29.gullet.macros.set("\\@eqnsw", "1", true); + } + } + __name(beginRow, "beginRow"); + function endRow() { + if (tags2) { + if (parser29.gullet.macros.get("\\df@tag")) { + tags2.push(parser29.subparse([new Token("\\df@tag")])); + parser29.gullet.macros.set("\\df@tag", void 0, true); + } else { + tags2.push(Boolean(autoTag) && parser29.gullet.macros.get("\\@eqnsw") === "1"); + } + } + } + __name(endRow, "endRow"); + beginRow(); + hLinesBeforeRow.push(getHLines(parser29)); + while (true) { + var cell = parser29.parseExpression(false, singleRow ? "\\end" : "\\\\"); + parser29.gullet.endGroup(); + parser29.gullet.beginGroup(); + cell = { + type: "ordgroup", + mode: parser29.mode, + body: cell + }; + if (style3) { + cell = { + type: "styling", + mode: parser29.mode, + style: style3, + body: [cell] + }; + } + row.push(cell); + var next3 = parser29.fetch().text; + if (next3 === "&") { + if (maxNumCols && row.length === maxNumCols) { + if (singleRow || colSeparationType) { + throw new ParseError("Too many tab characters: &", parser29.nextToken); + } else { + parser29.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument."); + } + } + parser29.consume(); + } else if (next3 === "\\end") { + endRow(); + if (row.length === 1 && cell.type === "styling" && cell.body[0].body.length === 0 && (body.length > 1 || !emptySingleRow)) { + body.pop(); + } + if (hLinesBeforeRow.length < body.length + 1) { + hLinesBeforeRow.push([]); + } + break; + } else if (next3 === "\\\\") { + parser29.consume(); + var size4 = void 0; + if (parser29.gullet.future().text !== " ") { + size4 = parser29.parseSizeGroup(true); + } + rowGaps.push(size4 ? size4.value : null); + endRow(); + hLinesBeforeRow.push(getHLines(parser29)); + row = []; + body.push(row); + beginRow(); + } else { + throw new ParseError("Expected & or \\\\ or \\cr or \\end", parser29.nextToken); + } + } + parser29.gullet.endGroup(); + parser29.gullet.endGroup(); + return { + type: "array", + mode: parser29.mode, + addJot, + arraystretch, + body, + cols, + rowGaps, + hskipBeforeAndAfter, + hLinesBeforeRow, + colSeparationType, + tags: tags2, + leqno + }; + } + function dCellStyle(envName) { + if (envName.slice(0, 1) === "d") { + return "display"; + } else { + return "text"; + } + } + function sizingGroup(value2, options2, baseOptions) { + var inner2 = buildExpression$1(value2, options2, false); + var multiplier = options2.sizeMultiplier / baseOptions.sizeMultiplier; + for (var i2 = 0; i2 < inner2.length; i2++) { + var pos = inner2[i2].classes.indexOf("sizing"); + if (pos < 0) { + Array.prototype.push.apply(inner2[i2].classes, options2.sizingClasses(baseOptions)); + } else if (inner2[i2].classes[pos + 1] === "reset-size" + options2.size) { + inner2[i2].classes[pos + 1] = "reset-size" + baseOptions.size; + } + inner2[i2].height *= multiplier; + inner2[i2].depth *= multiplier; + } + return buildCommon.makeFragment(inner2); + } + var SourceLocation, Token, ParseError, deflt, uppercase, hyphenate, ESCAPE_LOOKUP, ESCAPE_REGEX, getBaseElem, isCharacterBox, assert, protocolFromUrl, utils, SETTINGS_SCHEMA, Settings, Style, D, Dc, T, Tc, S, Sc, SS, SSc, styles, sup, sub, fracNum, fracDen, cramp, text$1, Style$1, scriptData, allBlocks, hLinePad, sqrtMain, sqrtSize1, sqrtSize2, sqrtSize3, sqrtSize4, phasePath, sqrtTall, sqrtPath, innerPath, path, tallDelim, DocumentFragment, fontMetricsData, sigmasAndXis, extraCharacterMap, fontMetricsBySizeIndex, sizeStyleMap, sizeMultipliers, sizeAtStyle, Options, ptPerUnit, relativeUnit, validUnit, calculateSize2, makeEm, createClass, initNode, toNode, invalidAttributeNameRegex, toMarkup, Span, Anchor, Img, iCombinations, SymbolNode, SvgNode, PathNode, LineNode, ATOMS, NON_ATOMS, symbols, math, text2, main, ams, accent, bin, close, inner, mathord, op, open, punct, rel, spacing, textord, ligatures, mathTextSymbols, ch, i2, textSymbols, _ch, _i, letters, _ch2, _i2, wideChar, _ch3, _i3, _ch4, _i4, extraLatin, _ch5, _i5, wideLatinLetterData, wideNumeralData, wideCharacterFont, lookupSymbol, makeSymbol, mathsym, boldsymbol, makeOrd, canCombine, tryCombineChars, sizeElementFromChildren, makeSpan$2, makeSvgSpan, makeLineSpan, makeAnchor, makeFragment, wrapFragment, getVListChildrenAndDepth, makeVList, makeGlue, retrieveTextFontName, fontMap, svgData, staticSvg, buildCommon, thinspace, mediumspace, thickspace, spacings, tightSpacings, _functions, _htmlGroupBuilders, _mathmlGroupBuilders, normalizeArgument, ordargument, makeSpan$1, binLeftCanceller, binRightCanceller, styleMap$1, DomEnum, buildExpression$1, traverseNonSpaceNodes, checkPartialGroup, getOutermostNode, getTypeOfDomTree, makeNullDelimiter, buildGroup$1, MathNode, TextNode, SpaceNode, mathMLTree, makeText, makeRow, getVariant, buildExpression2, buildExpressionRow, buildGroup2, optionsFromSettings, displayWrap, buildTree, buildHTMLTree, stretchyCodePoint, mathMLnode, katexImagesData, groupLength, svgSpan, encloseSpan, stretchy, htmlBuilder$a, mathmlBuilder$9, NON_STRETCHY_ACCENT_REGEX, paddedNode, makeSpan2, binrelClass, cdArrowFunctionName, newCell, isStartOfArrow, isLabelEnd, htmlBuilder$8, mathmlBuilder$7, globalMap, checkControlSequence, getRHS, letCommand, getMetrics, styleWrap, centerSpan, makeSmallDelim, mathrmSize, makeLargeDelim, makeGlyphSpan, makeInner, lapInEms, lap, verts, doubleVerts, makeStackedDelim, vbPad, emPad, sqrtSvg, makeSqrtImage, stackLargeDelimiters, stackAlwaysDelimiters, stackNeverDelimiters, sizeToMaxHeight, makeSizedDelim, stackNeverDelimiterSequence, stackAlwaysDelimiterSequence, stackLargeDelimiterSequence, delimTypeToFont, traverseSequence, makeCustomSizedDelim, makeLeftRightDelim, delimiter, delimiterSizes, delimiters, htmlBuilder$7, mathmlBuilder$6, _environments, _macros, validateAmsEnvironmentContext, htmlBuilder$6, alignMap, mathmlBuilder$5, alignedHandler, environments, htmlBuilder$5, mathmlBuilder$4, fontAliases, adjustStyle, htmlBuilder$4, mathmlBuilder$3, stylArray, delimFromValue, htmlBuilder$3, mathmlBuilder$2, sizeData, chooseMathStyle, assembleSupSub, noSuccessor, htmlBuilder$2, mathmlBuilder$1, singleCharBigOps, singleCharIntegrals, htmlBuilder$1, mathmlBuilder2, sizeFuncs, htmlBuilder2, styleMap, htmlBuilderDelegate, defaultVariant, cssSpace, regularSpace, pad, textFontFamilies, textFontWeights, textFontShapes, optionsWithFont, makeVerb, functions, spaceRegexString, controlWordRegexString, controlSymbolRegexString, controlWordWhitespaceRegexString, controlSpaceRegexString, combiningDiacriticalMarkString, combiningDiacriticalMarksEndRegex, tokenRegexString, Lexer, Namespace, macros, digitToNumber, newcommand, dotsByToken, spaceAfterDots, latexRaiseA, braketHelper, implicitCommands, MacroExpander, unicodeSubRegEx, uSubsAndSups, unicodeAccents, unicodeSymbols, Parser, parseTree, render, renderToString, generateParseTree, renderError, renderToDomTree, renderToHTMLTree, version, __domTree, katex; + var init_katex = __esm({ + "../../node_modules/.pnpm/katex@0.16.25/node_modules/katex/dist/katex.mjs"() { + "use strict"; + SourceLocation = class _SourceLocation { + static { + __name(this, "SourceLocation"); + } + // The + prefix indicates that these fields aren't writeable + // Lexer holding the input string. + // Start offset, zero-based inclusive. + // End offset, zero-based exclusive. + constructor(lexer, start3, end2) { + this.lexer = void 0; + this.start = void 0; + this.end = void 0; + this.lexer = lexer; + this.start = start3; + this.end = end2; + } + /** + * Merges two `SourceLocation`s from location providers, given they are + * provided in order of appearance. + * - Returns the first one's location if only the first is provided. + * - Returns a merged range of the first and the last if both are provided + * and their lexers match. + * - Otherwise, returns null. + */ + static range(first3, second2) { + if (!second2) { + return first3 && first3.loc; + } else if (!first3 || !first3.loc || !second2.loc || first3.loc.lexer !== second2.loc.lexer) { + return null; + } else { + return new _SourceLocation(first3.loc.lexer, first3.loc.start, second2.loc.end); + } + } + }; + Token = class _Token { + static { + __name(this, "Token"); + } + // don't expand the token + // used in \noexpand + constructor(text4, loc) { + this.text = void 0; + this.loc = void 0; + this.noexpand = void 0; + this.treatAsRelax = void 0; + this.text = text4; + this.loc = loc; + } + /** + * Given a pair of tokens (this and endToken), compute a `Token` encompassing + * the whole input range enclosed by these two. + */ + range(endToken, text4) { + return new _Token(text4, SourceLocation.range(this, endToken)); + } + }; + ParseError = class _ParseError { + static { + __name(this, "ParseError"); + } + // Error start position based on passed-in Token or ParseNode. + // Length of affected text based on passed-in Token or ParseNode. + // The underlying error message without any context added. + constructor(message, token2) { + this.name = void 0; + this.position = void 0; + this.length = void 0; + this.rawMessage = void 0; + var error3 = "KaTeX parse error: " + message; + var start3; + var end2; + var loc = token2 && token2.loc; + if (loc && loc.start <= loc.end) { + var input = loc.lexer.input; + start3 = loc.start; + end2 = loc.end; + if (start3 === input.length) { + error3 += " at end of input: "; + } else { + error3 += " at position " + (start3 + 1) + ": "; + } + var underlined = input.slice(start3, end2).replace(/[^]/g, "$&\u0332"); + var left3; + if (start3 > 15) { + left3 = "\u2026" + input.slice(start3 - 15, start3); + } else { + left3 = input.slice(0, start3); + } + var right3; + if (end2 + 15 < input.length) { + right3 = input.slice(end2, end2 + 15) + "\u2026"; + } else { + right3 = input.slice(end2); + } + error3 += left3 + underlined + right3; + } + var self2 = new Error(error3); + self2.name = "ParseError"; + self2.__proto__ = _ParseError.prototype; + self2.position = start3; + if (start3 != null && end2 != null) { + self2.length = end2 - start3; + } + self2.rawMessage = message; + return self2; + } + }; + ParseError.prototype.__proto__ = Error.prototype; + deflt = /* @__PURE__ */ __name(function deflt2(setting, defaultIfUndefined) { + return setting === void 0 ? defaultIfUndefined : setting; + }, "deflt"); + uppercase = /([A-Z])/g; + hyphenate = /* @__PURE__ */ __name(function hyphenate2(str2) { + return str2.replace(uppercase, "-$1").toLowerCase(); + }, "hyphenate"); + ESCAPE_LOOKUP = { + "&": "&", + ">": ">", + "<": "<", + '"': """, + "'": "'" + }; + ESCAPE_REGEX = /[&><"']/g; + __name(escape2, "escape"); + getBaseElem = /* @__PURE__ */ __name(function getBaseElem2(group2) { + if (group2.type === "ordgroup") { + if (group2.body.length === 1) { + return getBaseElem2(group2.body[0]); + } else { + return group2; + } + } else if (group2.type === "color") { + if (group2.body.length === 1) { + return getBaseElem2(group2.body[0]); + } else { + return group2; + } + } else if (group2.type === "font") { + return getBaseElem2(group2.body); + } else { + return group2; + } + }, "getBaseElem"); + isCharacterBox = /* @__PURE__ */ __name(function isCharacterBox2(group2) { + var baseElem = getBaseElem(group2); + return baseElem.type === "mathord" || baseElem.type === "textord" || baseElem.type === "atom"; + }, "isCharacterBox"); + assert = /* @__PURE__ */ __name(function assert2(value2) { + if (!value2) { + throw new Error("Expected non-null, but got " + String(value2)); + } + return value2; + }, "assert"); + protocolFromUrl = /* @__PURE__ */ __name(function protocolFromUrl2(url) { + var protocol = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(url); + if (!protocol) { + return "_relative"; + } + if (protocol[2] !== ":") { + return null; + } + if (!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(protocol[1])) { + return null; + } + return protocol[1].toLowerCase(); + }, "protocolFromUrl"); + utils = { + deflt, + escape: escape2, + hyphenate, + getBaseElem, + isCharacterBox, + protocolFromUrl + }; + SETTINGS_SCHEMA = { + displayMode: { + type: "boolean", + description: "Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.", + cli: "-d, --display-mode" + }, + output: { + type: { + enum: ["htmlAndMathml", "html", "mathml"] + }, + description: "Determines the markup language of the output.", + cli: "-F, --format " + }, + leqno: { + type: "boolean", + description: "Render display math in leqno style (left-justified tags)." + }, + fleqn: { + type: "boolean", + description: "Render display math flush left." + }, + throwOnError: { + type: "boolean", + default: true, + cli: "-t, --no-throw-on-error", + cliDescription: "Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error." + }, + errorColor: { + type: "string", + default: "#cc0000", + cli: "-c, --error-color ", + cliDescription: "A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.", + cliProcessor: /* @__PURE__ */ __name((color2) => "#" + color2, "cliProcessor") + }, + macros: { + type: "object", + cli: "-m, --macro ", + cliDescription: "Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).", + cliDefault: [], + cliProcessor: /* @__PURE__ */ __name((def, defs2) => { + defs2.push(def); + return defs2; + }, "cliProcessor") + }, + minRuleThickness: { + type: "number", + description: "Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.", + processor: /* @__PURE__ */ __name((t4) => Math.max(0, t4), "processor"), + cli: "--min-rule-thickness ", + cliProcessor: parseFloat + }, + colorIsTextColor: { + type: "boolean", + description: "Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.", + cli: "-b, --color-is-text-color" + }, + strict: { + type: [{ + enum: ["warn", "ignore", "error"] + }, "boolean", "function"], + description: "Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.", + cli: "-S, --strict", + cliDefault: false + }, + trust: { + type: ["boolean", "function"], + description: "Trust the input, enabling all HTML features such as \\url.", + cli: "-T, --trust" + }, + maxSize: { + type: "number", + default: Infinity, + description: "If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large", + processor: /* @__PURE__ */ __name((s2) => Math.max(0, s2), "processor"), + cli: "-s, --max-size ", + cliProcessor: parseInt + }, + maxExpand: { + type: "number", + default: 1e3, + description: "Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.", + processor: /* @__PURE__ */ __name((n2) => Math.max(0, n2), "processor"), + cli: "-e, --max-expand ", + cliProcessor: /* @__PURE__ */ __name((n2) => n2 === "Infinity" ? Infinity : parseInt(n2), "cliProcessor") + }, + globalGroup: { + type: "boolean", + cli: false + } + }; + __name(getDefaultValue, "getDefaultValue"); + Settings = class { + static { + __name(this, "Settings"); + } + constructor(options2) { + this.displayMode = void 0; + this.output = void 0; + this.leqno = void 0; + this.fleqn = void 0; + this.throwOnError = void 0; + this.errorColor = void 0; + this.macros = void 0; + this.minRuleThickness = void 0; + this.colorIsTextColor = void 0; + this.strict = void 0; + this.trust = void 0; + this.maxSize = void 0; + this.maxExpand = void 0; + this.globalGroup = void 0; + options2 = options2 || {}; + for (var prop in SETTINGS_SCHEMA) { + if (SETTINGS_SCHEMA.hasOwnProperty(prop)) { + var schema2 = SETTINGS_SCHEMA[prop]; + this[prop] = options2[prop] !== void 0 ? schema2.processor ? schema2.processor(options2[prop]) : options2[prop] : getDefaultValue(schema2); + } + } + } + /** + * Report nonstrict (non-LaTeX-compatible) input. + * Can safely not be called if `this.strict` is false in JavaScript. + */ + reportNonstrict(errorCode, errorMsg, token2) { + var strict = this.strict; + if (typeof strict === "function") { + strict = strict(errorCode, errorMsg, token2); + } + if (!strict || strict === "ignore") { + return; + } else if (strict === true || strict === "error") { + throw new ParseError("LaTeX-incompatible input and strict mode is set to 'error': " + (errorMsg + " [" + errorCode + "]"), token2); + } else if (strict === "warn") { + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); + } else { + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); + } + } + /** + * Check whether to apply strict (LaTeX-adhering) behavior for unusual + * input (like `\\`). Unlike `nonstrict`, will not throw an error; + * instead, "error" translates to a return value of `true`, while "ignore" + * translates to a return value of `false`. May still print a warning: + * "warn" prints a warning and returns `false`. + * This is for the second category of `errorCode`s listed in the README. + */ + useStrictBehavior(errorCode, errorMsg, token2) { + var strict = this.strict; + if (typeof strict === "function") { + try { + strict = strict(errorCode, errorMsg, token2); + } catch (error3) { + strict = "error"; + } + } + if (!strict || strict === "ignore") { + return false; + } else if (strict === true || strict === "error") { + return true; + } else if (strict === "warn") { + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (errorMsg + " [" + errorCode + "]")); + return false; + } else { + typeof console !== "undefined" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + strict + "': " + errorMsg + " [" + errorCode + "]")); + return false; + } + } + /** + * Check whether to test potentially dangerous input, and return + * `true` (trusted) or `false` (untrusted). The sole argument `context` + * should be an object with `command` field specifying the relevant LaTeX + * command (as a string starting with `\`), and any other arguments, etc. + * If `context` has a `url` field, a `protocol` field will automatically + * get added by this function (changing the specified object). + */ + isTrusted(context) { + if (context.url && !context.protocol) { + var protocol = utils.protocolFromUrl(context.url); + if (protocol == null) { + return false; + } + context.protocol = protocol; + } + var trust = typeof this.trust === "function" ? this.trust(context) : this.trust; + return Boolean(trust); + } + }; + Style = class { + static { + __name(this, "Style"); + } + constructor(id35, size4, cramped) { + this.id = void 0; + this.size = void 0; + this.cramped = void 0; + this.id = id35; + this.size = size4; + this.cramped = cramped; + } + /** + * Get the style of a superscript given a base in the current style. + */ + sup() { + return styles[sup[this.id]]; + } + /** + * Get the style of a subscript given a base in the current style. + */ + sub() { + return styles[sub[this.id]]; + } + /** + * Get the style of a fraction numerator given the fraction in the current + * style. + */ + fracNum() { + return styles[fracNum[this.id]]; + } + /** + * Get the style of a fraction denominator given the fraction in the current + * style. + */ + fracDen() { + return styles[fracDen[this.id]]; + } + /** + * Get the cramped version of a style (in particular, cramping a cramped style + * doesn't change the style). + */ + cramp() { + return styles[cramp[this.id]]; + } + /** + * Get a text or display version of this style. + */ + text() { + return styles[text$1[this.id]]; + } + /** + * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) + */ + isTight() { + return this.size >= 2; + } + }; + D = 0; + Dc = 1; + T = 2; + Tc = 3; + S = 4; + Sc = 5; + SS = 6; + SSc = 7; + styles = [new Style(D, 0, false), new Style(Dc, 0, true), new Style(T, 1, false), new Style(Tc, 1, true), new Style(S, 2, false), new Style(Sc, 2, true), new Style(SS, 3, false), new Style(SSc, 3, true)]; + sup = [S, Sc, S, Sc, SS, SSc, SS, SSc]; + sub = [Sc, Sc, Sc, Sc, SSc, SSc, SSc, SSc]; + fracNum = [T, Tc, S, Sc, SS, SSc, SS, SSc]; + fracDen = [Tc, Tc, Sc, Sc, SSc, SSc, SSc, SSc]; + cramp = [Dc, Dc, Tc, Tc, Sc, Sc, SSc, SSc]; + text$1 = [D, Dc, T, Tc, T, Tc, T, Tc]; + Style$1 = { + DISPLAY: styles[D], + TEXT: styles[T], + SCRIPT: styles[S], + SCRIPTSCRIPT: styles[SS] + }; + scriptData = [{ + // Latin characters beyond the Latin-1 characters we have metrics for. + // Needed for Czech, Hungarian and Turkish text, for example. + name: "latin", + blocks: [ + [256, 591], + // Latin Extended-A and Latin Extended-B + [768, 879] + // Combining Diacritical marks + ] + }, { + // The Cyrillic script used by Russian and related languages. + // A Cyrillic subset used to be supported as explicitly defined + // symbols in symbols.js + name: "cyrillic", + blocks: [[1024, 1279]] + }, { + // Armenian + name: "armenian", + blocks: [[1328, 1423]] + }, { + // The Brahmic scripts of South and Southeast Asia + // Devanagari (0900–097F) + // Bengali (0980–09FF) + // Gurmukhi (0A00–0A7F) + // Gujarati (0A80–0AFF) + // Oriya (0B00–0B7F) + // Tamil (0B80–0BFF) + // Telugu (0C00–0C7F) + // Kannada (0C80–0CFF) + // Malayalam (0D00–0D7F) + // Sinhala (0D80–0DFF) + // Thai (0E00–0E7F) + // Lao (0E80–0EFF) + // Tibetan (0F00–0FFF) + // Myanmar (1000–109F) + name: "brahmic", + blocks: [[2304, 4255]] + }, { + name: "georgian", + blocks: [[4256, 4351]] + }, { + // Chinese and Japanese. + // The "k" in cjk is for Korean, but we've separated Korean out + name: "cjk", + blocks: [ + [12288, 12543], + // CJK symbols and punctuation, Hiragana, Katakana + [19968, 40879], + // CJK ideograms + [65280, 65376] + // Fullwidth punctuation + // TODO: add halfwidth Katakana and Romanji glyphs + ] + }, { + // Korean + name: "hangul", + blocks: [[44032, 55215]] + }]; + __name(scriptFromCodepoint, "scriptFromCodepoint"); + allBlocks = []; + scriptData.forEach((s2) => s2.blocks.forEach((b3) => allBlocks.push(...b3))); + __name(supportedCodepoint, "supportedCodepoint"); + hLinePad = 80; + sqrtMain = /* @__PURE__ */ __name(function sqrtMain2(extraVinculum, hLinePad2) { + return "M95," + (622 + extraVinculum + hLinePad2) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraVinculum / 2.075 + " -" + extraVinculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraVinculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z"; + }, "sqrtMain"); + sqrtSize1 = /* @__PURE__ */ __name(function sqrtSize12(extraVinculum, hLinePad2) { + return "M263," + (601 + extraVinculum + hLinePad2) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraVinculum / 2.084 + " -" + extraVinculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraVinculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z"; + }, "sqrtSize1"); + sqrtSize2 = /* @__PURE__ */ __name(function sqrtSize22(extraVinculum, hLinePad2) { + return "M983 " + (10 + extraVinculum + hLinePad2) + "\nl" + extraVinculum / 3.13 + " -" + extraVinculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraVinculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "h-400000z"; + }, "sqrtSize2"); + sqrtSize3 = /* @__PURE__ */ __name(function sqrtSize32(extraVinculum, hLinePad2) { + return "M424," + (2398 + extraVinculum + hLinePad2) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraVinculum / 4.223 + " -" + extraVinculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraVinculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraVinculum) + " " + hLinePad2 + "\nh400000v" + (40 + extraVinculum) + "h-400000z"; + }, "sqrtSize3"); + sqrtSize4 = /* @__PURE__ */ __name(function sqrtSize42(extraVinculum, hLinePad2) { + return "M473," + (2713 + extraVinculum + hLinePad2) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraVinculum / 5.298 + " -" + extraVinculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraVinculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraVinculum) + " " + hLinePad2 + "h400000v" + (40 + extraVinculum) + "H1017.7z"; + }, "sqrtSize4"); + phasePath = /* @__PURE__ */ __name(function phasePath2(y6) { + var x5 = y6 / 2; + return "M400000 " + y6 + " H0 L" + x5 + " 0 l65 45 L145 " + (y6 - 80) + " H400000z"; + }, "phasePath"); + sqrtTall = /* @__PURE__ */ __name(function sqrtTall2(extraVinculum, hLinePad2, viewBoxHeight) { + var vertSegment = viewBoxHeight - 54 - hLinePad2 - extraVinculum; + return "M702 " + (extraVinculum + hLinePad2) + "H400000" + (40 + extraVinculum) + "\nH742v" + vertSegment + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad2 + "H400000v" + (40 + extraVinculum) + "H742z"; + }, "sqrtTall"); + sqrtPath = /* @__PURE__ */ __name(function sqrtPath2(size4, extraVinculum, viewBoxHeight) { + extraVinculum = 1e3 * extraVinculum; + var path4 = ""; + switch (size4) { + case "sqrtMain": + path4 = sqrtMain(extraVinculum, hLinePad); + break; + case "sqrtSize1": + path4 = sqrtSize1(extraVinculum, hLinePad); + break; + case "sqrtSize2": + path4 = sqrtSize2(extraVinculum, hLinePad); + break; + case "sqrtSize3": + path4 = sqrtSize3(extraVinculum, hLinePad); + break; + case "sqrtSize4": + path4 = sqrtSize4(extraVinculum, hLinePad); + break; + case "sqrtTall": + path4 = sqrtTall(extraVinculum, hLinePad, viewBoxHeight); + } + return path4; + }, "sqrtPath"); + innerPath = /* @__PURE__ */ __name(function innerPath2(name, height2) { + switch (name) { + case "\u239C": + return "M291 0 H417 V" + height2 + " H291z M291 0 H417 V" + height2 + " H291z"; + case "\u2223": + return "M145 0 H188 V" + height2 + " H145z M145 0 H188 V" + height2 + " H145z"; + case "\u2225": + return "M145 0 H188 V" + height2 + " H145z M145 0 H188 V" + height2 + " H145z" + ("M367 0 H410 V" + height2 + " H367z M367 0 H410 V" + height2 + " H367z"); + case "\u239F": + return "M457 0 H583 V" + height2 + " H457z M457 0 H583 V" + height2 + " H457z"; + case "\u23A2": + return "M319 0 H403 V" + height2 + " H319z M319 0 H403 V" + height2 + " H319z"; + case "\u23A5": + return "M263 0 H347 V" + height2 + " H263z M263 0 H347 V" + height2 + " H263z"; + case "\u23AA": + return "M384 0 H504 V" + height2 + " H384z M384 0 H504 V" + height2 + " H384z"; + case "\u23D0": + return "M312 0 H355 V" + height2 + " H312z M312 0 H355 V" + height2 + " H312z"; + case "\u2016": + return "M257 0 H300 V" + height2 + " H257z M257 0 H300 V" + height2 + " H257z" + ("M478 0 H521 V" + height2 + " H478z M478 0 H521 V" + height2 + " H478z"); + default: + return ""; + } + }, "innerPath"); + path = { + // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main + doubleleftarrow: "M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z", + // doublerightarrow is from glyph U+21D2 in font KaTeX Main + doublerightarrow: "M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z", + // leftarrow is from glyph U+2190 in font KaTeX Main + leftarrow: "M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z", + // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular + leftbrace: "M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z", + leftbraceunder: "M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z", + // overgroup is from the MnSymbol package (public domain) + leftgroup: "M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z", + leftgroupunder: "M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z", + // Harpoons are from glyph U+21BD in font KaTeX Main + leftharpoon: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z", + leftharpoonplus: "M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z", + leftharpoondown: "M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z", + leftharpoondownplus: "M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z", + // hook is from glyph U+21A9 in font KaTeX Main + lefthook: "M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z", + leftlinesegment: "M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z", + leftmapsto: "M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z", + // tofrom is from glyph U+21C4 in font KaTeX AMS Regular + leftToFrom: "M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z", + longequal: "M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z", + midbrace: "M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z", + midbraceunder: "M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z", + oiintSize1: "M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z", + oiintSize2: "M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z", + oiiintSize1: "M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z", + oiiintSize2: "M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z", + rightarrow: "M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z", + rightbrace: "M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z", + rightbraceunder: "M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z", + rightgroup: "M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z", + rightgroupunder: "M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z", + rightharpoon: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z", + rightharpoonplus: "M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z", + rightharpoondown: "M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z", + rightharpoondownplus: "M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z", + righthook: "M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z", + rightlinesegment: "M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z", + rightToFrom: "M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z", + // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular + twoheadleftarrow: "M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z", + twoheadrightarrow: "M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z", + // tilde1 is a modified version of a glyph from the MnSymbol package + tilde1: "M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z", + // ditto tilde2, tilde3, & tilde4 + tilde2: "M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z", + tilde3: "M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z", + tilde4: "M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z", + // vec is from glyph U+20D7 in font KaTeX Main + vec: "M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z", + // widehat1 is a modified version of a glyph from the MnSymbol package + widehat1: "M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z", + // ditto widehat2, widehat3, & widehat4 + widehat2: "M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", + widehat3: "M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", + widehat4: "M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z", + // widecheck paths are all inverted versions of widehat + widecheck1: "M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z", + widecheck2: "M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", + widecheck3: "M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", + widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z", + // The next ten paths support reaction arrows from the mhchem package. + // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX + // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main + baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z", + // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main + rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z", + // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end. + // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em + baraboveshortleftharpoon: "M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z", + rightharpoonaboveshortbar: "M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z", + shortbaraboveleftharpoon: "M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z", + shortrightharpoonabovebar: "M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z" + }; + tallDelim = /* @__PURE__ */ __name(function tallDelim2(label, midHeight) { + switch (label) { + case "lbrack": + return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v1759 h347 v-84\nH403z M403 1759 V0 H319 V1759 v" + midHeight + " v1759 h84z"; + case "rbrack": + return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v1759 H0 v84 H347z\nM347 1759 V0 H263 V1759 v" + midHeight + " v1759 h84z"; + case "vert": + return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z"; + case "doublevert": + return "M145 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M188 15 H145 v585 v" + midHeight + " v585 h43z\nM367 15 v585 v" + midHeight + " v585 c2.667,10,9.667,15,21,15\nc10,0,16.667,-5,20,-15 v-585 v" + -midHeight + " v-585 c-2.667,-10,-9.667,-15,-21,-15\nc-10,0,-16.667,5,-20,15z M410 15 H367 v585 v" + midHeight + " v585 h43z"; + case "lfloor": + return "M319 602 V0 H403 V602 v" + midHeight + " v1715 h263 v84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z"; + case "rfloor": + return "M319 602 V0 H403 V602 v" + midHeight + " v1799 H0 v-84 H319z\nMM319 602 V0 H403 V602 v" + midHeight + " v1715 H319z"; + case "lceil": + return "M403 1759 V84 H666 V0 H319 V1759 v" + midHeight + " v602 h84z\nM403 1759 V0 H319 V1759 v" + midHeight + " v602 h84z"; + case "rceil": + return "M347 1759 V0 H0 V84 H263 V1759 v" + midHeight + " v602 h84z\nM347 1759 V0 h-84 V1759 v" + midHeight + " v602 h84z"; + case "lparen": + return "M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1\nc-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,\n-36,557 l0," + (midHeight + 84) + "c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,\n949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9\nc0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,\n-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189\nl0,-" + (midHeight + 92) + "c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,\n-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z"; + case "rparen": + return "M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,\n63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5\nc11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0," + (midHeight + 9) + "\nc-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664\nc-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11\nc0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17\nc242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558\nl0,-" + (midHeight + 144) + "c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,\n-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z"; + default: + throw new Error("Unknown stretchy delimiter."); + } + }, "tallDelim"); + DocumentFragment = class { + static { + __name(this, "DocumentFragment"); + } + // Never used; needed for satisfying interface. + constructor(children2) { + this.children = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + this.children = children2; + this.classes = []; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = {}; + } + hasClass(className) { + return this.classes.includes(className); + } + /** Convert the fragment into a node. */ + toNode() { + var frag = document.createDocumentFragment(); + for (var i2 = 0; i2 < this.children.length; i2++) { + frag.appendChild(this.children[i2].toNode()); + } + return frag; + } + /** Convert the fragment into HTML markup. */ + toMarkup() { + var markup = ""; + for (var i2 = 0; i2 < this.children.length; i2++) { + markup += this.children[i2].toMarkup(); + } + return markup; + } + /** + * Converts the math node into a string, similar to innerText. Applies to + * MathDomNode's only. + */ + toText() { + var toText = /* @__PURE__ */ __name((child) => child.toText(), "toText"); + return this.children.map(toText).join(""); + } + }; + fontMetricsData = { + "AMS-Regular": { + "32": [0, 0, 0, 0, 0.25], + "65": [0, 0.68889, 0, 0, 0.72222], + "66": [0, 0.68889, 0, 0, 0.66667], + "67": [0, 0.68889, 0, 0, 0.72222], + "68": [0, 0.68889, 0, 0, 0.72222], + "69": [0, 0.68889, 0, 0, 0.66667], + "70": [0, 0.68889, 0, 0, 0.61111], + "71": [0, 0.68889, 0, 0, 0.77778], + "72": [0, 0.68889, 0, 0, 0.77778], + "73": [0, 0.68889, 0, 0, 0.38889], + "74": [0.16667, 0.68889, 0, 0, 0.5], + "75": [0, 0.68889, 0, 0, 0.77778], + "76": [0, 0.68889, 0, 0, 0.66667], + "77": [0, 0.68889, 0, 0, 0.94445], + "78": [0, 0.68889, 0, 0, 0.72222], + "79": [0.16667, 0.68889, 0, 0, 0.77778], + "80": [0, 0.68889, 0, 0, 0.61111], + "81": [0.16667, 0.68889, 0, 0, 0.77778], + "82": [0, 0.68889, 0, 0, 0.72222], + "83": [0, 0.68889, 0, 0, 0.55556], + "84": [0, 0.68889, 0, 0, 0.66667], + "85": [0, 0.68889, 0, 0, 0.72222], + "86": [0, 0.68889, 0, 0, 0.72222], + "87": [0, 0.68889, 0, 0, 1], + "88": [0, 0.68889, 0, 0, 0.72222], + "89": [0, 0.68889, 0, 0, 0.72222], + "90": [0, 0.68889, 0, 0, 0.66667], + "107": [0, 0.68889, 0, 0, 0.55556], + "160": [0, 0, 0, 0, 0.25], + "165": [0, 0.675, 0.025, 0, 0.75], + "174": [0.15559, 0.69224, 0, 0, 0.94666], + "240": [0, 0.68889, 0, 0, 0.55556], + "295": [0, 0.68889, 0, 0, 0.54028], + "710": [0, 0.825, 0, 0, 2.33334], + "732": [0, 0.9, 0, 0, 2.33334], + "770": [0, 0.825, 0, 0, 2.33334], + "771": [0, 0.9, 0, 0, 2.33334], + "989": [0.08167, 0.58167, 0, 0, 0.77778], + "1008": [0, 0.43056, 0.04028, 0, 0.66667], + "8245": [0, 0.54986, 0, 0, 0.275], + "8463": [0, 0.68889, 0, 0, 0.54028], + "8487": [0, 0.68889, 0, 0, 0.72222], + "8498": [0, 0.68889, 0, 0, 0.55556], + "8502": [0, 0.68889, 0, 0, 0.66667], + "8503": [0, 0.68889, 0, 0, 0.44445], + "8504": [0, 0.68889, 0, 0, 0.66667], + "8513": [0, 0.68889, 0, 0, 0.63889], + "8592": [-0.03598, 0.46402, 0, 0, 0.5], + "8594": [-0.03598, 0.46402, 0, 0, 0.5], + "8602": [-0.13313, 0.36687, 0, 0, 1], + "8603": [-0.13313, 0.36687, 0, 0, 1], + "8606": [0.01354, 0.52239, 0, 0, 1], + "8608": [0.01354, 0.52239, 0, 0, 1], + "8610": [0.01354, 0.52239, 0, 0, 1.11111], + "8611": [0.01354, 0.52239, 0, 0, 1.11111], + "8619": [0, 0.54986, 0, 0, 1], + "8620": [0, 0.54986, 0, 0, 1], + "8621": [-0.13313, 0.37788, 0, 0, 1.38889], + "8622": [-0.13313, 0.36687, 0, 0, 1], + "8624": [0, 0.69224, 0, 0, 0.5], + "8625": [0, 0.69224, 0, 0, 0.5], + "8630": [0, 0.43056, 0, 0, 1], + "8631": [0, 0.43056, 0, 0, 1], + "8634": [0.08198, 0.58198, 0, 0, 0.77778], + "8635": [0.08198, 0.58198, 0, 0, 0.77778], + "8638": [0.19444, 0.69224, 0, 0, 0.41667], + "8639": [0.19444, 0.69224, 0, 0, 0.41667], + "8642": [0.19444, 0.69224, 0, 0, 0.41667], + "8643": [0.19444, 0.69224, 0, 0, 0.41667], + "8644": [0.1808, 0.675, 0, 0, 1], + "8646": [0.1808, 0.675, 0, 0, 1], + "8647": [0.1808, 0.675, 0, 0, 1], + "8648": [0.19444, 0.69224, 0, 0, 0.83334], + "8649": [0.1808, 0.675, 0, 0, 1], + "8650": [0.19444, 0.69224, 0, 0, 0.83334], + "8651": [0.01354, 0.52239, 0, 0, 1], + "8652": [0.01354, 0.52239, 0, 0, 1], + "8653": [-0.13313, 0.36687, 0, 0, 1], + "8654": [-0.13313, 0.36687, 0, 0, 1], + "8655": [-0.13313, 0.36687, 0, 0, 1], + "8666": [0.13667, 0.63667, 0, 0, 1], + "8667": [0.13667, 0.63667, 0, 0, 1], + "8669": [-0.13313, 0.37788, 0, 0, 1], + "8672": [-0.064, 0.437, 0, 0, 1.334], + "8674": [-0.064, 0.437, 0, 0, 1.334], + "8705": [0, 0.825, 0, 0, 0.5], + "8708": [0, 0.68889, 0, 0, 0.55556], + "8709": [0.08167, 0.58167, 0, 0, 0.77778], + "8717": [0, 0.43056, 0, 0, 0.42917], + "8722": [-0.03598, 0.46402, 0, 0, 0.5], + "8724": [0.08198, 0.69224, 0, 0, 0.77778], + "8726": [0.08167, 0.58167, 0, 0, 0.77778], + "8733": [0, 0.69224, 0, 0, 0.77778], + "8736": [0, 0.69224, 0, 0, 0.72222], + "8737": [0, 0.69224, 0, 0, 0.72222], + "8738": [0.03517, 0.52239, 0, 0, 0.72222], + "8739": [0.08167, 0.58167, 0, 0, 0.22222], + "8740": [0.25142, 0.74111, 0, 0, 0.27778], + "8741": [0.08167, 0.58167, 0, 0, 0.38889], + "8742": [0.25142, 0.74111, 0, 0, 0.5], + "8756": [0, 0.69224, 0, 0, 0.66667], + "8757": [0, 0.69224, 0, 0, 0.66667], + "8764": [-0.13313, 0.36687, 0, 0, 0.77778], + "8765": [-0.13313, 0.37788, 0, 0, 0.77778], + "8769": [-0.13313, 0.36687, 0, 0, 0.77778], + "8770": [-0.03625, 0.46375, 0, 0, 0.77778], + "8774": [0.30274, 0.79383, 0, 0, 0.77778], + "8776": [-0.01688, 0.48312, 0, 0, 0.77778], + "8778": [0.08167, 0.58167, 0, 0, 0.77778], + "8782": [0.06062, 0.54986, 0, 0, 0.77778], + "8783": [0.06062, 0.54986, 0, 0, 0.77778], + "8785": [0.08198, 0.58198, 0, 0, 0.77778], + "8786": [0.08198, 0.58198, 0, 0, 0.77778], + "8787": [0.08198, 0.58198, 0, 0, 0.77778], + "8790": [0, 0.69224, 0, 0, 0.77778], + "8791": [0.22958, 0.72958, 0, 0, 0.77778], + "8796": [0.08198, 0.91667, 0, 0, 0.77778], + "8806": [0.25583, 0.75583, 0, 0, 0.77778], + "8807": [0.25583, 0.75583, 0, 0, 0.77778], + "8808": [0.25142, 0.75726, 0, 0, 0.77778], + "8809": [0.25142, 0.75726, 0, 0, 0.77778], + "8812": [0.25583, 0.75583, 0, 0, 0.5], + "8814": [0.20576, 0.70576, 0, 0, 0.77778], + "8815": [0.20576, 0.70576, 0, 0, 0.77778], + "8816": [0.30274, 0.79383, 0, 0, 0.77778], + "8817": [0.30274, 0.79383, 0, 0, 0.77778], + "8818": [0.22958, 0.72958, 0, 0, 0.77778], + "8819": [0.22958, 0.72958, 0, 0, 0.77778], + "8822": [0.1808, 0.675, 0, 0, 0.77778], + "8823": [0.1808, 0.675, 0, 0, 0.77778], + "8828": [0.13667, 0.63667, 0, 0, 0.77778], + "8829": [0.13667, 0.63667, 0, 0, 0.77778], + "8830": [0.22958, 0.72958, 0, 0, 0.77778], + "8831": [0.22958, 0.72958, 0, 0, 0.77778], + "8832": [0.20576, 0.70576, 0, 0, 0.77778], + "8833": [0.20576, 0.70576, 0, 0, 0.77778], + "8840": [0.30274, 0.79383, 0, 0, 0.77778], + "8841": [0.30274, 0.79383, 0, 0, 0.77778], + "8842": [0.13597, 0.63597, 0, 0, 0.77778], + "8843": [0.13597, 0.63597, 0, 0, 0.77778], + "8847": [0.03517, 0.54986, 0, 0, 0.77778], + "8848": [0.03517, 0.54986, 0, 0, 0.77778], + "8858": [0.08198, 0.58198, 0, 0, 0.77778], + "8859": [0.08198, 0.58198, 0, 0, 0.77778], + "8861": [0.08198, 0.58198, 0, 0, 0.77778], + "8862": [0, 0.675, 0, 0, 0.77778], + "8863": [0, 0.675, 0, 0, 0.77778], + "8864": [0, 0.675, 0, 0, 0.77778], + "8865": [0, 0.675, 0, 0, 0.77778], + "8872": [0, 0.69224, 0, 0, 0.61111], + "8873": [0, 0.69224, 0, 0, 0.72222], + "8874": [0, 0.69224, 0, 0, 0.88889], + "8876": [0, 0.68889, 0, 0, 0.61111], + "8877": [0, 0.68889, 0, 0, 0.61111], + "8878": [0, 0.68889, 0, 0, 0.72222], + "8879": [0, 0.68889, 0, 0, 0.72222], + "8882": [0.03517, 0.54986, 0, 0, 0.77778], + "8883": [0.03517, 0.54986, 0, 0, 0.77778], + "8884": [0.13667, 0.63667, 0, 0, 0.77778], + "8885": [0.13667, 0.63667, 0, 0, 0.77778], + "8888": [0, 0.54986, 0, 0, 1.11111], + "8890": [0.19444, 0.43056, 0, 0, 0.55556], + "8891": [0.19444, 0.69224, 0, 0, 0.61111], + "8892": [0.19444, 0.69224, 0, 0, 0.61111], + "8901": [0, 0.54986, 0, 0, 0.27778], + "8903": [0.08167, 0.58167, 0, 0, 0.77778], + "8905": [0.08167, 0.58167, 0, 0, 0.77778], + "8906": [0.08167, 0.58167, 0, 0, 0.77778], + "8907": [0, 0.69224, 0, 0, 0.77778], + "8908": [0, 0.69224, 0, 0, 0.77778], + "8909": [-0.03598, 0.46402, 0, 0, 0.77778], + "8910": [0, 0.54986, 0, 0, 0.76042], + "8911": [0, 0.54986, 0, 0, 0.76042], + "8912": [0.03517, 0.54986, 0, 0, 0.77778], + "8913": [0.03517, 0.54986, 0, 0, 0.77778], + "8914": [0, 0.54986, 0, 0, 0.66667], + "8915": [0, 0.54986, 0, 0, 0.66667], + "8916": [0, 0.69224, 0, 0, 0.66667], + "8918": [0.0391, 0.5391, 0, 0, 0.77778], + "8919": [0.0391, 0.5391, 0, 0, 0.77778], + "8920": [0.03517, 0.54986, 0, 0, 1.33334], + "8921": [0.03517, 0.54986, 0, 0, 1.33334], + "8922": [0.38569, 0.88569, 0, 0, 0.77778], + "8923": [0.38569, 0.88569, 0, 0, 0.77778], + "8926": [0.13667, 0.63667, 0, 0, 0.77778], + "8927": [0.13667, 0.63667, 0, 0, 0.77778], + "8928": [0.30274, 0.79383, 0, 0, 0.77778], + "8929": [0.30274, 0.79383, 0, 0, 0.77778], + "8934": [0.23222, 0.74111, 0, 0, 0.77778], + "8935": [0.23222, 0.74111, 0, 0, 0.77778], + "8936": [0.23222, 0.74111, 0, 0, 0.77778], + "8937": [0.23222, 0.74111, 0, 0, 0.77778], + "8938": [0.20576, 0.70576, 0, 0, 0.77778], + "8939": [0.20576, 0.70576, 0, 0, 0.77778], + "8940": [0.30274, 0.79383, 0, 0, 0.77778], + "8941": [0.30274, 0.79383, 0, 0, 0.77778], + "8994": [0.19444, 0.69224, 0, 0, 0.77778], + "8995": [0.19444, 0.69224, 0, 0, 0.77778], + "9416": [0.15559, 0.69224, 0, 0, 0.90222], + "9484": [0, 0.69224, 0, 0, 0.5], + "9488": [0, 0.69224, 0, 0, 0.5], + "9492": [0, 0.37788, 0, 0, 0.5], + "9496": [0, 0.37788, 0, 0, 0.5], + "9585": [0.19444, 0.68889, 0, 0, 0.88889], + "9586": [0.19444, 0.74111, 0, 0, 0.88889], + "9632": [0, 0.675, 0, 0, 0.77778], + "9633": [0, 0.675, 0, 0, 0.77778], + "9650": [0, 0.54986, 0, 0, 0.72222], + "9651": [0, 0.54986, 0, 0, 0.72222], + "9654": [0.03517, 0.54986, 0, 0, 0.77778], + "9660": [0, 0.54986, 0, 0, 0.72222], + "9661": [0, 0.54986, 0, 0, 0.72222], + "9664": [0.03517, 0.54986, 0, 0, 0.77778], + "9674": [0.11111, 0.69224, 0, 0, 0.66667], + "9733": [0.19444, 0.69224, 0, 0, 0.94445], + "10003": [0, 0.69224, 0, 0, 0.83334], + "10016": [0, 0.69224, 0, 0, 0.83334], + "10731": [0.11111, 0.69224, 0, 0, 0.66667], + "10846": [0.19444, 0.75583, 0, 0, 0.61111], + "10877": [0.13667, 0.63667, 0, 0, 0.77778], + "10878": [0.13667, 0.63667, 0, 0, 0.77778], + "10885": [0.25583, 0.75583, 0, 0, 0.77778], + "10886": [0.25583, 0.75583, 0, 0, 0.77778], + "10887": [0.13597, 0.63597, 0, 0, 0.77778], + "10888": [0.13597, 0.63597, 0, 0, 0.77778], + "10889": [0.26167, 0.75726, 0, 0, 0.77778], + "10890": [0.26167, 0.75726, 0, 0, 0.77778], + "10891": [0.48256, 0.98256, 0, 0, 0.77778], + "10892": [0.48256, 0.98256, 0, 0, 0.77778], + "10901": [0.13667, 0.63667, 0, 0, 0.77778], + "10902": [0.13667, 0.63667, 0, 0, 0.77778], + "10933": [0.25142, 0.75726, 0, 0, 0.77778], + "10934": [0.25142, 0.75726, 0, 0, 0.77778], + "10935": [0.26167, 0.75726, 0, 0, 0.77778], + "10936": [0.26167, 0.75726, 0, 0, 0.77778], + "10937": [0.26167, 0.75726, 0, 0, 0.77778], + "10938": [0.26167, 0.75726, 0, 0, 0.77778], + "10949": [0.25583, 0.75583, 0, 0, 0.77778], + "10950": [0.25583, 0.75583, 0, 0, 0.77778], + "10955": [0.28481, 0.79383, 0, 0, 0.77778], + "10956": [0.28481, 0.79383, 0, 0, 0.77778], + "57350": [0.08167, 0.58167, 0, 0, 0.22222], + "57351": [0.08167, 0.58167, 0, 0, 0.38889], + "57352": [0.08167, 0.58167, 0, 0, 0.77778], + "57353": [0, 0.43056, 0.04028, 0, 0.66667], + "57356": [0.25142, 0.75726, 0, 0, 0.77778], + "57357": [0.25142, 0.75726, 0, 0, 0.77778], + "57358": [0.41951, 0.91951, 0, 0, 0.77778], + "57359": [0.30274, 0.79383, 0, 0, 0.77778], + "57360": [0.30274, 0.79383, 0, 0, 0.77778], + "57361": [0.41951, 0.91951, 0, 0, 0.77778], + "57366": [0.25142, 0.75726, 0, 0, 0.77778], + "57367": [0.25142, 0.75726, 0, 0, 0.77778], + "57368": [0.25142, 0.75726, 0, 0, 0.77778], + "57369": [0.25142, 0.75726, 0, 0, 0.77778], + "57370": [0.13597, 0.63597, 0, 0, 0.77778], + "57371": [0.13597, 0.63597, 0, 0, 0.77778] + }, + "Caligraphic-Regular": { + "32": [0, 0, 0, 0, 0.25], + "65": [0, 0.68333, 0, 0.19445, 0.79847], + "66": [0, 0.68333, 0.03041, 0.13889, 0.65681], + "67": [0, 0.68333, 0.05834, 0.13889, 0.52653], + "68": [0, 0.68333, 0.02778, 0.08334, 0.77139], + "69": [0, 0.68333, 0.08944, 0.11111, 0.52778], + "70": [0, 0.68333, 0.09931, 0.11111, 0.71875], + "71": [0.09722, 0.68333, 0.0593, 0.11111, 0.59487], + "72": [0, 0.68333, 965e-5, 0.11111, 0.84452], + "73": [0, 0.68333, 0.07382, 0, 0.54452], + "74": [0.09722, 0.68333, 0.18472, 0.16667, 0.67778], + "75": [0, 0.68333, 0.01445, 0.05556, 0.76195], + "76": [0, 0.68333, 0, 0.13889, 0.68972], + "77": [0, 0.68333, 0, 0.13889, 1.2009], + "78": [0, 0.68333, 0.14736, 0.08334, 0.82049], + "79": [0, 0.68333, 0.02778, 0.11111, 0.79611], + "80": [0, 0.68333, 0.08222, 0.08334, 0.69556], + "81": [0.09722, 0.68333, 0, 0.11111, 0.81667], + "82": [0, 0.68333, 0, 0.08334, 0.8475], + "83": [0, 0.68333, 0.075, 0.13889, 0.60556], + "84": [0, 0.68333, 0.25417, 0, 0.54464], + "85": [0, 0.68333, 0.09931, 0.08334, 0.62583], + "86": [0, 0.68333, 0.08222, 0, 0.61278], + "87": [0, 0.68333, 0.08222, 0.08334, 0.98778], + "88": [0, 0.68333, 0.14643, 0.13889, 0.7133], + "89": [0.09722, 0.68333, 0.08222, 0.08334, 0.66834], + "90": [0, 0.68333, 0.07944, 0.13889, 0.72473], + "160": [0, 0, 0, 0, 0.25] + }, + "Fraktur-Regular": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69141, 0, 0, 0.29574], + "34": [0, 0.69141, 0, 0, 0.21471], + "38": [0, 0.69141, 0, 0, 0.73786], + "39": [0, 0.69141, 0, 0, 0.21201], + "40": [0.24982, 0.74947, 0, 0, 0.38865], + "41": [0.24982, 0.74947, 0, 0, 0.38865], + "42": [0, 0.62119, 0, 0, 0.27764], + "43": [0.08319, 0.58283, 0, 0, 0.75623], + "44": [0, 0.10803, 0, 0, 0.27764], + "45": [0.08319, 0.58283, 0, 0, 0.75623], + "46": [0, 0.10803, 0, 0, 0.27764], + "47": [0.24982, 0.74947, 0, 0, 0.50181], + "48": [0, 0.47534, 0, 0, 0.50181], + "49": [0, 0.47534, 0, 0, 0.50181], + "50": [0, 0.47534, 0, 0, 0.50181], + "51": [0.18906, 0.47534, 0, 0, 0.50181], + "52": [0.18906, 0.47534, 0, 0, 0.50181], + "53": [0.18906, 0.47534, 0, 0, 0.50181], + "54": [0, 0.69141, 0, 0, 0.50181], + "55": [0.18906, 0.47534, 0, 0, 0.50181], + "56": [0, 0.69141, 0, 0, 0.50181], + "57": [0.18906, 0.47534, 0, 0, 0.50181], + "58": [0, 0.47534, 0, 0, 0.21606], + "59": [0.12604, 0.47534, 0, 0, 0.21606], + "61": [-0.13099, 0.36866, 0, 0, 0.75623], + "63": [0, 0.69141, 0, 0, 0.36245], + "65": [0, 0.69141, 0, 0, 0.7176], + "66": [0, 0.69141, 0, 0, 0.88397], + "67": [0, 0.69141, 0, 0, 0.61254], + "68": [0, 0.69141, 0, 0, 0.83158], + "69": [0, 0.69141, 0, 0, 0.66278], + "70": [0.12604, 0.69141, 0, 0, 0.61119], + "71": [0, 0.69141, 0, 0, 0.78539], + "72": [0.06302, 0.69141, 0, 0, 0.7203], + "73": [0, 0.69141, 0, 0, 0.55448], + "74": [0.12604, 0.69141, 0, 0, 0.55231], + "75": [0, 0.69141, 0, 0, 0.66845], + "76": [0, 0.69141, 0, 0, 0.66602], + "77": [0, 0.69141, 0, 0, 1.04953], + "78": [0, 0.69141, 0, 0, 0.83212], + "79": [0, 0.69141, 0, 0, 0.82699], + "80": [0.18906, 0.69141, 0, 0, 0.82753], + "81": [0.03781, 0.69141, 0, 0, 0.82699], + "82": [0, 0.69141, 0, 0, 0.82807], + "83": [0, 0.69141, 0, 0, 0.82861], + "84": [0, 0.69141, 0, 0, 0.66899], + "85": [0, 0.69141, 0, 0, 0.64576], + "86": [0, 0.69141, 0, 0, 0.83131], + "87": [0, 0.69141, 0, 0, 1.04602], + "88": [0, 0.69141, 0, 0, 0.71922], + "89": [0.18906, 0.69141, 0, 0, 0.83293], + "90": [0.12604, 0.69141, 0, 0, 0.60201], + "91": [0.24982, 0.74947, 0, 0, 0.27764], + "93": [0.24982, 0.74947, 0, 0, 0.27764], + "94": [0, 0.69141, 0, 0, 0.49965], + "97": [0, 0.47534, 0, 0, 0.50046], + "98": [0, 0.69141, 0, 0, 0.51315], + "99": [0, 0.47534, 0, 0, 0.38946], + "100": [0, 0.62119, 0, 0, 0.49857], + "101": [0, 0.47534, 0, 0, 0.40053], + "102": [0.18906, 0.69141, 0, 0, 0.32626], + "103": [0.18906, 0.47534, 0, 0, 0.5037], + "104": [0.18906, 0.69141, 0, 0, 0.52126], + "105": [0, 0.69141, 0, 0, 0.27899], + "106": [0, 0.69141, 0, 0, 0.28088], + "107": [0, 0.69141, 0, 0, 0.38946], + "108": [0, 0.69141, 0, 0, 0.27953], + "109": [0, 0.47534, 0, 0, 0.76676], + "110": [0, 0.47534, 0, 0, 0.52666], + "111": [0, 0.47534, 0, 0, 0.48885], + "112": [0.18906, 0.52396, 0, 0, 0.50046], + "113": [0.18906, 0.47534, 0, 0, 0.48912], + "114": [0, 0.47534, 0, 0, 0.38919], + "115": [0, 0.47534, 0, 0, 0.44266], + "116": [0, 0.62119, 0, 0, 0.33301], + "117": [0, 0.47534, 0, 0, 0.5172], + "118": [0, 0.52396, 0, 0, 0.5118], + "119": [0, 0.52396, 0, 0, 0.77351], + "120": [0.18906, 0.47534, 0, 0, 0.38865], + "121": [0.18906, 0.47534, 0, 0, 0.49884], + "122": [0.18906, 0.47534, 0, 0, 0.39054], + "160": [0, 0, 0, 0, 0.25], + "8216": [0, 0.69141, 0, 0, 0.21471], + "8217": [0, 0.69141, 0, 0, 0.21471], + "58112": [0, 0.62119, 0, 0, 0.49749], + "58113": [0, 0.62119, 0, 0, 0.4983], + "58114": [0.18906, 0.69141, 0, 0, 0.33328], + "58115": [0.18906, 0.69141, 0, 0, 0.32923], + "58116": [0.18906, 0.47534, 0, 0, 0.50343], + "58117": [0, 0.69141, 0, 0, 0.33301], + "58118": [0, 0.62119, 0, 0, 0.33409], + "58119": [0, 0.47534, 0, 0, 0.50073] + }, + "Main-Bold": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69444, 0, 0, 0.35], + "34": [0, 0.69444, 0, 0, 0.60278], + "35": [0.19444, 0.69444, 0, 0, 0.95833], + "36": [0.05556, 0.75, 0, 0, 0.575], + "37": [0.05556, 0.75, 0, 0, 0.95833], + "38": [0, 0.69444, 0, 0, 0.89444], + "39": [0, 0.69444, 0, 0, 0.31944], + "40": [0.25, 0.75, 0, 0, 0.44722], + "41": [0.25, 0.75, 0, 0, 0.44722], + "42": [0, 0.75, 0, 0, 0.575], + "43": [0.13333, 0.63333, 0, 0, 0.89444], + "44": [0.19444, 0.15556, 0, 0, 0.31944], + "45": [0, 0.44444, 0, 0, 0.38333], + "46": [0, 0.15556, 0, 0, 0.31944], + "47": [0.25, 0.75, 0, 0, 0.575], + "48": [0, 0.64444, 0, 0, 0.575], + "49": [0, 0.64444, 0, 0, 0.575], + "50": [0, 0.64444, 0, 0, 0.575], + "51": [0, 0.64444, 0, 0, 0.575], + "52": [0, 0.64444, 0, 0, 0.575], + "53": [0, 0.64444, 0, 0, 0.575], + "54": [0, 0.64444, 0, 0, 0.575], + "55": [0, 0.64444, 0, 0, 0.575], + "56": [0, 0.64444, 0, 0, 0.575], + "57": [0, 0.64444, 0, 0, 0.575], + "58": [0, 0.44444, 0, 0, 0.31944], + "59": [0.19444, 0.44444, 0, 0, 0.31944], + "60": [0.08556, 0.58556, 0, 0, 0.89444], + "61": [-0.10889, 0.39111, 0, 0, 0.89444], + "62": [0.08556, 0.58556, 0, 0, 0.89444], + "63": [0, 0.69444, 0, 0, 0.54305], + "64": [0, 0.69444, 0, 0, 0.89444], + "65": [0, 0.68611, 0, 0, 0.86944], + "66": [0, 0.68611, 0, 0, 0.81805], + "67": [0, 0.68611, 0, 0, 0.83055], + "68": [0, 0.68611, 0, 0, 0.88194], + "69": [0, 0.68611, 0, 0, 0.75555], + "70": [0, 0.68611, 0, 0, 0.72361], + "71": [0, 0.68611, 0, 0, 0.90416], + "72": [0, 0.68611, 0, 0, 0.9], + "73": [0, 0.68611, 0, 0, 0.43611], + "74": [0, 0.68611, 0, 0, 0.59444], + "75": [0, 0.68611, 0, 0, 0.90138], + "76": [0, 0.68611, 0, 0, 0.69166], + "77": [0, 0.68611, 0, 0, 1.09166], + "78": [0, 0.68611, 0, 0, 0.9], + "79": [0, 0.68611, 0, 0, 0.86388], + "80": [0, 0.68611, 0, 0, 0.78611], + "81": [0.19444, 0.68611, 0, 0, 0.86388], + "82": [0, 0.68611, 0, 0, 0.8625], + "83": [0, 0.68611, 0, 0, 0.63889], + "84": [0, 0.68611, 0, 0, 0.8], + "85": [0, 0.68611, 0, 0, 0.88472], + "86": [0, 0.68611, 0.01597, 0, 0.86944], + "87": [0, 0.68611, 0.01597, 0, 1.18888], + "88": [0, 0.68611, 0, 0, 0.86944], + "89": [0, 0.68611, 0.02875, 0, 0.86944], + "90": [0, 0.68611, 0, 0, 0.70277], + "91": [0.25, 0.75, 0, 0, 0.31944], + "92": [0.25, 0.75, 0, 0, 0.575], + "93": [0.25, 0.75, 0, 0, 0.31944], + "94": [0, 0.69444, 0, 0, 0.575], + "95": [0.31, 0.13444, 0.03194, 0, 0.575], + "97": [0, 0.44444, 0, 0, 0.55902], + "98": [0, 0.69444, 0, 0, 0.63889], + "99": [0, 0.44444, 0, 0, 0.51111], + "100": [0, 0.69444, 0, 0, 0.63889], + "101": [0, 0.44444, 0, 0, 0.52708], + "102": [0, 0.69444, 0.10903, 0, 0.35139], + "103": [0.19444, 0.44444, 0.01597, 0, 0.575], + "104": [0, 0.69444, 0, 0, 0.63889], + "105": [0, 0.69444, 0, 0, 0.31944], + "106": [0.19444, 0.69444, 0, 0, 0.35139], + "107": [0, 0.69444, 0, 0, 0.60694], + "108": [0, 0.69444, 0, 0, 0.31944], + "109": [0, 0.44444, 0, 0, 0.95833], + "110": [0, 0.44444, 0, 0, 0.63889], + "111": [0, 0.44444, 0, 0, 0.575], + "112": [0.19444, 0.44444, 0, 0, 0.63889], + "113": [0.19444, 0.44444, 0, 0, 0.60694], + "114": [0, 0.44444, 0, 0, 0.47361], + "115": [0, 0.44444, 0, 0, 0.45361], + "116": [0, 0.63492, 0, 0, 0.44722], + "117": [0, 0.44444, 0, 0, 0.63889], + "118": [0, 0.44444, 0.01597, 0, 0.60694], + "119": [0, 0.44444, 0.01597, 0, 0.83055], + "120": [0, 0.44444, 0, 0, 0.60694], + "121": [0.19444, 0.44444, 0.01597, 0, 0.60694], + "122": [0, 0.44444, 0, 0, 0.51111], + "123": [0.25, 0.75, 0, 0, 0.575], + "124": [0.25, 0.75, 0, 0, 0.31944], + "125": [0.25, 0.75, 0, 0, 0.575], + "126": [0.35, 0.34444, 0, 0, 0.575], + "160": [0, 0, 0, 0, 0.25], + "163": [0, 0.69444, 0, 0, 0.86853], + "168": [0, 0.69444, 0, 0, 0.575], + "172": [0, 0.44444, 0, 0, 0.76666], + "176": [0, 0.69444, 0, 0, 0.86944], + "177": [0.13333, 0.63333, 0, 0, 0.89444], + "184": [0.17014, 0, 0, 0, 0.51111], + "198": [0, 0.68611, 0, 0, 1.04166], + "215": [0.13333, 0.63333, 0, 0, 0.89444], + "216": [0.04861, 0.73472, 0, 0, 0.89444], + "223": [0, 0.69444, 0, 0, 0.59722], + "230": [0, 0.44444, 0, 0, 0.83055], + "247": [0.13333, 0.63333, 0, 0, 0.89444], + "248": [0.09722, 0.54167, 0, 0, 0.575], + "305": [0, 0.44444, 0, 0, 0.31944], + "338": [0, 0.68611, 0, 0, 1.16944], + "339": [0, 0.44444, 0, 0, 0.89444], + "567": [0.19444, 0.44444, 0, 0, 0.35139], + "710": [0, 0.69444, 0, 0, 0.575], + "711": [0, 0.63194, 0, 0, 0.575], + "713": [0, 0.59611, 0, 0, 0.575], + "714": [0, 0.69444, 0, 0, 0.575], + "715": [0, 0.69444, 0, 0, 0.575], + "728": [0, 0.69444, 0, 0, 0.575], + "729": [0, 0.69444, 0, 0, 0.31944], + "730": [0, 0.69444, 0, 0, 0.86944], + "732": [0, 0.69444, 0, 0, 0.575], + "733": [0, 0.69444, 0, 0, 0.575], + "915": [0, 0.68611, 0, 0, 0.69166], + "916": [0, 0.68611, 0, 0, 0.95833], + "920": [0, 0.68611, 0, 0, 0.89444], + "923": [0, 0.68611, 0, 0, 0.80555], + "926": [0, 0.68611, 0, 0, 0.76666], + "928": [0, 0.68611, 0, 0, 0.9], + "931": [0, 0.68611, 0, 0, 0.83055], + "933": [0, 0.68611, 0, 0, 0.89444], + "934": [0, 0.68611, 0, 0, 0.83055], + "936": [0, 0.68611, 0, 0, 0.89444], + "937": [0, 0.68611, 0, 0, 0.83055], + "8211": [0, 0.44444, 0.03194, 0, 0.575], + "8212": [0, 0.44444, 0.03194, 0, 1.14999], + "8216": [0, 0.69444, 0, 0, 0.31944], + "8217": [0, 0.69444, 0, 0, 0.31944], + "8220": [0, 0.69444, 0, 0, 0.60278], + "8221": [0, 0.69444, 0, 0, 0.60278], + "8224": [0.19444, 0.69444, 0, 0, 0.51111], + "8225": [0.19444, 0.69444, 0, 0, 0.51111], + "8242": [0, 0.55556, 0, 0, 0.34444], + "8407": [0, 0.72444, 0.15486, 0, 0.575], + "8463": [0, 0.69444, 0, 0, 0.66759], + "8465": [0, 0.69444, 0, 0, 0.83055], + "8467": [0, 0.69444, 0, 0, 0.47361], + "8472": [0.19444, 0.44444, 0, 0, 0.74027], + "8476": [0, 0.69444, 0, 0, 0.83055], + "8501": [0, 0.69444, 0, 0, 0.70277], + "8592": [-0.10889, 0.39111, 0, 0, 1.14999], + "8593": [0.19444, 0.69444, 0, 0, 0.575], + "8594": [-0.10889, 0.39111, 0, 0, 1.14999], + "8595": [0.19444, 0.69444, 0, 0, 0.575], + "8596": [-0.10889, 0.39111, 0, 0, 1.14999], + "8597": [0.25, 0.75, 0, 0, 0.575], + "8598": [0.19444, 0.69444, 0, 0, 1.14999], + "8599": [0.19444, 0.69444, 0, 0, 1.14999], + "8600": [0.19444, 0.69444, 0, 0, 1.14999], + "8601": [0.19444, 0.69444, 0, 0, 1.14999], + "8636": [-0.10889, 0.39111, 0, 0, 1.14999], + "8637": [-0.10889, 0.39111, 0, 0, 1.14999], + "8640": [-0.10889, 0.39111, 0, 0, 1.14999], + "8641": [-0.10889, 0.39111, 0, 0, 1.14999], + "8656": [-0.10889, 0.39111, 0, 0, 1.14999], + "8657": [0.19444, 0.69444, 0, 0, 0.70277], + "8658": [-0.10889, 0.39111, 0, 0, 1.14999], + "8659": [0.19444, 0.69444, 0, 0, 0.70277], + "8660": [-0.10889, 0.39111, 0, 0, 1.14999], + "8661": [0.25, 0.75, 0, 0, 0.70277], + "8704": [0, 0.69444, 0, 0, 0.63889], + "8706": [0, 0.69444, 0.06389, 0, 0.62847], + "8707": [0, 0.69444, 0, 0, 0.63889], + "8709": [0.05556, 0.75, 0, 0, 0.575], + "8711": [0, 0.68611, 0, 0, 0.95833], + "8712": [0.08556, 0.58556, 0, 0, 0.76666], + "8715": [0.08556, 0.58556, 0, 0, 0.76666], + "8722": [0.13333, 0.63333, 0, 0, 0.89444], + "8723": [0.13333, 0.63333, 0, 0, 0.89444], + "8725": [0.25, 0.75, 0, 0, 0.575], + "8726": [0.25, 0.75, 0, 0, 0.575], + "8727": [-0.02778, 0.47222, 0, 0, 0.575], + "8728": [-0.02639, 0.47361, 0, 0, 0.575], + "8729": [-0.02639, 0.47361, 0, 0, 0.575], + "8730": [0.18, 0.82, 0, 0, 0.95833], + "8733": [0, 0.44444, 0, 0, 0.89444], + "8734": [0, 0.44444, 0, 0, 1.14999], + "8736": [0, 0.69224, 0, 0, 0.72222], + "8739": [0.25, 0.75, 0, 0, 0.31944], + "8741": [0.25, 0.75, 0, 0, 0.575], + "8743": [0, 0.55556, 0, 0, 0.76666], + "8744": [0, 0.55556, 0, 0, 0.76666], + "8745": [0, 0.55556, 0, 0, 0.76666], + "8746": [0, 0.55556, 0, 0, 0.76666], + "8747": [0.19444, 0.69444, 0.12778, 0, 0.56875], + "8764": [-0.10889, 0.39111, 0, 0, 0.89444], + "8768": [0.19444, 0.69444, 0, 0, 0.31944], + "8771": [222e-5, 0.50222, 0, 0, 0.89444], + "8773": [0.027, 0.638, 0, 0, 0.894], + "8776": [0.02444, 0.52444, 0, 0, 0.89444], + "8781": [222e-5, 0.50222, 0, 0, 0.89444], + "8801": [222e-5, 0.50222, 0, 0, 0.89444], + "8804": [0.19667, 0.69667, 0, 0, 0.89444], + "8805": [0.19667, 0.69667, 0, 0, 0.89444], + "8810": [0.08556, 0.58556, 0, 0, 1.14999], + "8811": [0.08556, 0.58556, 0, 0, 1.14999], + "8826": [0.08556, 0.58556, 0, 0, 0.89444], + "8827": [0.08556, 0.58556, 0, 0, 0.89444], + "8834": [0.08556, 0.58556, 0, 0, 0.89444], + "8835": [0.08556, 0.58556, 0, 0, 0.89444], + "8838": [0.19667, 0.69667, 0, 0, 0.89444], + "8839": [0.19667, 0.69667, 0, 0, 0.89444], + "8846": [0, 0.55556, 0, 0, 0.76666], + "8849": [0.19667, 0.69667, 0, 0, 0.89444], + "8850": [0.19667, 0.69667, 0, 0, 0.89444], + "8851": [0, 0.55556, 0, 0, 0.76666], + "8852": [0, 0.55556, 0, 0, 0.76666], + "8853": [0.13333, 0.63333, 0, 0, 0.89444], + "8854": [0.13333, 0.63333, 0, 0, 0.89444], + "8855": [0.13333, 0.63333, 0, 0, 0.89444], + "8856": [0.13333, 0.63333, 0, 0, 0.89444], + "8857": [0.13333, 0.63333, 0, 0, 0.89444], + "8866": [0, 0.69444, 0, 0, 0.70277], + "8867": [0, 0.69444, 0, 0, 0.70277], + "8868": [0, 0.69444, 0, 0, 0.89444], + "8869": [0, 0.69444, 0, 0, 0.89444], + "8900": [-0.02639, 0.47361, 0, 0, 0.575], + "8901": [-0.02639, 0.47361, 0, 0, 0.31944], + "8902": [-0.02778, 0.47222, 0, 0, 0.575], + "8968": [0.25, 0.75, 0, 0, 0.51111], + "8969": [0.25, 0.75, 0, 0, 0.51111], + "8970": [0.25, 0.75, 0, 0, 0.51111], + "8971": [0.25, 0.75, 0, 0, 0.51111], + "8994": [-0.13889, 0.36111, 0, 0, 1.14999], + "8995": [-0.13889, 0.36111, 0, 0, 1.14999], + "9651": [0.19444, 0.69444, 0, 0, 1.02222], + "9657": [-0.02778, 0.47222, 0, 0, 0.575], + "9661": [0.19444, 0.69444, 0, 0, 1.02222], + "9667": [-0.02778, 0.47222, 0, 0, 0.575], + "9711": [0.19444, 0.69444, 0, 0, 1.14999], + "9824": [0.12963, 0.69444, 0, 0, 0.89444], + "9825": [0.12963, 0.69444, 0, 0, 0.89444], + "9826": [0.12963, 0.69444, 0, 0, 0.89444], + "9827": [0.12963, 0.69444, 0, 0, 0.89444], + "9837": [0, 0.75, 0, 0, 0.44722], + "9838": [0.19444, 0.69444, 0, 0, 0.44722], + "9839": [0.19444, 0.69444, 0, 0, 0.44722], + "10216": [0.25, 0.75, 0, 0, 0.44722], + "10217": [0.25, 0.75, 0, 0, 0.44722], + "10815": [0, 0.68611, 0, 0, 0.9], + "10927": [0.19667, 0.69667, 0, 0, 0.89444], + "10928": [0.19667, 0.69667, 0, 0, 0.89444], + "57376": [0.19444, 0.69444, 0, 0, 0] + }, + "Main-BoldItalic": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69444, 0.11417, 0, 0.38611], + "34": [0, 0.69444, 0.07939, 0, 0.62055], + "35": [0.19444, 0.69444, 0.06833, 0, 0.94444], + "37": [0.05556, 0.75, 0.12861, 0, 0.94444], + "38": [0, 0.69444, 0.08528, 0, 0.88555], + "39": [0, 0.69444, 0.12945, 0, 0.35555], + "40": [0.25, 0.75, 0.15806, 0, 0.47333], + "41": [0.25, 0.75, 0.03306, 0, 0.47333], + "42": [0, 0.75, 0.14333, 0, 0.59111], + "43": [0.10333, 0.60333, 0.03306, 0, 0.88555], + "44": [0.19444, 0.14722, 0, 0, 0.35555], + "45": [0, 0.44444, 0.02611, 0, 0.41444], + "46": [0, 0.14722, 0, 0, 0.35555], + "47": [0.25, 0.75, 0.15806, 0, 0.59111], + "48": [0, 0.64444, 0.13167, 0, 0.59111], + "49": [0, 0.64444, 0.13167, 0, 0.59111], + "50": [0, 0.64444, 0.13167, 0, 0.59111], + "51": [0, 0.64444, 0.13167, 0, 0.59111], + "52": [0.19444, 0.64444, 0.13167, 0, 0.59111], + "53": [0, 0.64444, 0.13167, 0, 0.59111], + "54": [0, 0.64444, 0.13167, 0, 0.59111], + "55": [0.19444, 0.64444, 0.13167, 0, 0.59111], + "56": [0, 0.64444, 0.13167, 0, 0.59111], + "57": [0, 0.64444, 0.13167, 0, 0.59111], + "58": [0, 0.44444, 0.06695, 0, 0.35555], + "59": [0.19444, 0.44444, 0.06695, 0, 0.35555], + "61": [-0.10889, 0.39111, 0.06833, 0, 0.88555], + "63": [0, 0.69444, 0.11472, 0, 0.59111], + "64": [0, 0.69444, 0.09208, 0, 0.88555], + "65": [0, 0.68611, 0, 0, 0.86555], + "66": [0, 0.68611, 0.0992, 0, 0.81666], + "67": [0, 0.68611, 0.14208, 0, 0.82666], + "68": [0, 0.68611, 0.09062, 0, 0.87555], + "69": [0, 0.68611, 0.11431, 0, 0.75666], + "70": [0, 0.68611, 0.12903, 0, 0.72722], + "71": [0, 0.68611, 0.07347, 0, 0.89527], + "72": [0, 0.68611, 0.17208, 0, 0.8961], + "73": [0, 0.68611, 0.15681, 0, 0.47166], + "74": [0, 0.68611, 0.145, 0, 0.61055], + "75": [0, 0.68611, 0.14208, 0, 0.89499], + "76": [0, 0.68611, 0, 0, 0.69777], + "77": [0, 0.68611, 0.17208, 0, 1.07277], + "78": [0, 0.68611, 0.17208, 0, 0.8961], + "79": [0, 0.68611, 0.09062, 0, 0.85499], + "80": [0, 0.68611, 0.0992, 0, 0.78721], + "81": [0.19444, 0.68611, 0.09062, 0, 0.85499], + "82": [0, 0.68611, 0.02559, 0, 0.85944], + "83": [0, 0.68611, 0.11264, 0, 0.64999], + "84": [0, 0.68611, 0.12903, 0, 0.7961], + "85": [0, 0.68611, 0.17208, 0, 0.88083], + "86": [0, 0.68611, 0.18625, 0, 0.86555], + "87": [0, 0.68611, 0.18625, 0, 1.15999], + "88": [0, 0.68611, 0.15681, 0, 0.86555], + "89": [0, 0.68611, 0.19803, 0, 0.86555], + "90": [0, 0.68611, 0.14208, 0, 0.70888], + "91": [0.25, 0.75, 0.1875, 0, 0.35611], + "93": [0.25, 0.75, 0.09972, 0, 0.35611], + "94": [0, 0.69444, 0.06709, 0, 0.59111], + "95": [0.31, 0.13444, 0.09811, 0, 0.59111], + "97": [0, 0.44444, 0.09426, 0, 0.59111], + "98": [0, 0.69444, 0.07861, 0, 0.53222], + "99": [0, 0.44444, 0.05222, 0, 0.53222], + "100": [0, 0.69444, 0.10861, 0, 0.59111], + "101": [0, 0.44444, 0.085, 0, 0.53222], + "102": [0.19444, 0.69444, 0.21778, 0, 0.4], + "103": [0.19444, 0.44444, 0.105, 0, 0.53222], + "104": [0, 0.69444, 0.09426, 0, 0.59111], + "105": [0, 0.69326, 0.11387, 0, 0.35555], + "106": [0.19444, 0.69326, 0.1672, 0, 0.35555], + "107": [0, 0.69444, 0.11111, 0, 0.53222], + "108": [0, 0.69444, 0.10861, 0, 0.29666], + "109": [0, 0.44444, 0.09426, 0, 0.94444], + "110": [0, 0.44444, 0.09426, 0, 0.64999], + "111": [0, 0.44444, 0.07861, 0, 0.59111], + "112": [0.19444, 0.44444, 0.07861, 0, 0.59111], + "113": [0.19444, 0.44444, 0.105, 0, 0.53222], + "114": [0, 0.44444, 0.11111, 0, 0.50167], + "115": [0, 0.44444, 0.08167, 0, 0.48694], + "116": [0, 0.63492, 0.09639, 0, 0.385], + "117": [0, 0.44444, 0.09426, 0, 0.62055], + "118": [0, 0.44444, 0.11111, 0, 0.53222], + "119": [0, 0.44444, 0.11111, 0, 0.76777], + "120": [0, 0.44444, 0.12583, 0, 0.56055], + "121": [0.19444, 0.44444, 0.105, 0, 0.56166], + "122": [0, 0.44444, 0.13889, 0, 0.49055], + "126": [0.35, 0.34444, 0.11472, 0, 0.59111], + "160": [0, 0, 0, 0, 0.25], + "168": [0, 0.69444, 0.11473, 0, 0.59111], + "176": [0, 0.69444, 0, 0, 0.94888], + "184": [0.17014, 0, 0, 0, 0.53222], + "198": [0, 0.68611, 0.11431, 0, 1.02277], + "216": [0.04861, 0.73472, 0.09062, 0, 0.88555], + "223": [0.19444, 0.69444, 0.09736, 0, 0.665], + "230": [0, 0.44444, 0.085, 0, 0.82666], + "248": [0.09722, 0.54167, 0.09458, 0, 0.59111], + "305": [0, 0.44444, 0.09426, 0, 0.35555], + "338": [0, 0.68611, 0.11431, 0, 1.14054], + "339": [0, 0.44444, 0.085, 0, 0.82666], + "567": [0.19444, 0.44444, 0.04611, 0, 0.385], + "710": [0, 0.69444, 0.06709, 0, 0.59111], + "711": [0, 0.63194, 0.08271, 0, 0.59111], + "713": [0, 0.59444, 0.10444, 0, 0.59111], + "714": [0, 0.69444, 0.08528, 0, 0.59111], + "715": [0, 0.69444, 0, 0, 0.59111], + "728": [0, 0.69444, 0.10333, 0, 0.59111], + "729": [0, 0.69444, 0.12945, 0, 0.35555], + "730": [0, 0.69444, 0, 0, 0.94888], + "732": [0, 0.69444, 0.11472, 0, 0.59111], + "733": [0, 0.69444, 0.11472, 0, 0.59111], + "915": [0, 0.68611, 0.12903, 0, 0.69777], + "916": [0, 0.68611, 0, 0, 0.94444], + "920": [0, 0.68611, 0.09062, 0, 0.88555], + "923": [0, 0.68611, 0, 0, 0.80666], + "926": [0, 0.68611, 0.15092, 0, 0.76777], + "928": [0, 0.68611, 0.17208, 0, 0.8961], + "931": [0, 0.68611, 0.11431, 0, 0.82666], + "933": [0, 0.68611, 0.10778, 0, 0.88555], + "934": [0, 0.68611, 0.05632, 0, 0.82666], + "936": [0, 0.68611, 0.10778, 0, 0.88555], + "937": [0, 0.68611, 0.0992, 0, 0.82666], + "8211": [0, 0.44444, 0.09811, 0, 0.59111], + "8212": [0, 0.44444, 0.09811, 0, 1.18221], + "8216": [0, 0.69444, 0.12945, 0, 0.35555], + "8217": [0, 0.69444, 0.12945, 0, 0.35555], + "8220": [0, 0.69444, 0.16772, 0, 0.62055], + "8221": [0, 0.69444, 0.07939, 0, 0.62055] + }, + "Main-Italic": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69444, 0.12417, 0, 0.30667], + "34": [0, 0.69444, 0.06961, 0, 0.51444], + "35": [0.19444, 0.69444, 0.06616, 0, 0.81777], + "37": [0.05556, 0.75, 0.13639, 0, 0.81777], + "38": [0, 0.69444, 0.09694, 0, 0.76666], + "39": [0, 0.69444, 0.12417, 0, 0.30667], + "40": [0.25, 0.75, 0.16194, 0, 0.40889], + "41": [0.25, 0.75, 0.03694, 0, 0.40889], + "42": [0, 0.75, 0.14917, 0, 0.51111], + "43": [0.05667, 0.56167, 0.03694, 0, 0.76666], + "44": [0.19444, 0.10556, 0, 0, 0.30667], + "45": [0, 0.43056, 0.02826, 0, 0.35778], + "46": [0, 0.10556, 0, 0, 0.30667], + "47": [0.25, 0.75, 0.16194, 0, 0.51111], + "48": [0, 0.64444, 0.13556, 0, 0.51111], + "49": [0, 0.64444, 0.13556, 0, 0.51111], + "50": [0, 0.64444, 0.13556, 0, 0.51111], + "51": [0, 0.64444, 0.13556, 0, 0.51111], + "52": [0.19444, 0.64444, 0.13556, 0, 0.51111], + "53": [0, 0.64444, 0.13556, 0, 0.51111], + "54": [0, 0.64444, 0.13556, 0, 0.51111], + "55": [0.19444, 0.64444, 0.13556, 0, 0.51111], + "56": [0, 0.64444, 0.13556, 0, 0.51111], + "57": [0, 0.64444, 0.13556, 0, 0.51111], + "58": [0, 0.43056, 0.0582, 0, 0.30667], + "59": [0.19444, 0.43056, 0.0582, 0, 0.30667], + "61": [-0.13313, 0.36687, 0.06616, 0, 0.76666], + "63": [0, 0.69444, 0.1225, 0, 0.51111], + "64": [0, 0.69444, 0.09597, 0, 0.76666], + "65": [0, 0.68333, 0, 0, 0.74333], + "66": [0, 0.68333, 0.10257, 0, 0.70389], + "67": [0, 0.68333, 0.14528, 0, 0.71555], + "68": [0, 0.68333, 0.09403, 0, 0.755], + "69": [0, 0.68333, 0.12028, 0, 0.67833], + "70": [0, 0.68333, 0.13305, 0, 0.65277], + "71": [0, 0.68333, 0.08722, 0, 0.77361], + "72": [0, 0.68333, 0.16389, 0, 0.74333], + "73": [0, 0.68333, 0.15806, 0, 0.38555], + "74": [0, 0.68333, 0.14028, 0, 0.525], + "75": [0, 0.68333, 0.14528, 0, 0.76888], + "76": [0, 0.68333, 0, 0, 0.62722], + "77": [0, 0.68333, 0.16389, 0, 0.89666], + "78": [0, 0.68333, 0.16389, 0, 0.74333], + "79": [0, 0.68333, 0.09403, 0, 0.76666], + "80": [0, 0.68333, 0.10257, 0, 0.67833], + "81": [0.19444, 0.68333, 0.09403, 0, 0.76666], + "82": [0, 0.68333, 0.03868, 0, 0.72944], + "83": [0, 0.68333, 0.11972, 0, 0.56222], + "84": [0, 0.68333, 0.13305, 0, 0.71555], + "85": [0, 0.68333, 0.16389, 0, 0.74333], + "86": [0, 0.68333, 0.18361, 0, 0.74333], + "87": [0, 0.68333, 0.18361, 0, 0.99888], + "88": [0, 0.68333, 0.15806, 0, 0.74333], + "89": [0, 0.68333, 0.19383, 0, 0.74333], + "90": [0, 0.68333, 0.14528, 0, 0.61333], + "91": [0.25, 0.75, 0.1875, 0, 0.30667], + "93": [0.25, 0.75, 0.10528, 0, 0.30667], + "94": [0, 0.69444, 0.06646, 0, 0.51111], + "95": [0.31, 0.12056, 0.09208, 0, 0.51111], + "97": [0, 0.43056, 0.07671, 0, 0.51111], + "98": [0, 0.69444, 0.06312, 0, 0.46], + "99": [0, 0.43056, 0.05653, 0, 0.46], + "100": [0, 0.69444, 0.10333, 0, 0.51111], + "101": [0, 0.43056, 0.07514, 0, 0.46], + "102": [0.19444, 0.69444, 0.21194, 0, 0.30667], + "103": [0.19444, 0.43056, 0.08847, 0, 0.46], + "104": [0, 0.69444, 0.07671, 0, 0.51111], + "105": [0, 0.65536, 0.1019, 0, 0.30667], + "106": [0.19444, 0.65536, 0.14467, 0, 0.30667], + "107": [0, 0.69444, 0.10764, 0, 0.46], + "108": [0, 0.69444, 0.10333, 0, 0.25555], + "109": [0, 0.43056, 0.07671, 0, 0.81777], + "110": [0, 0.43056, 0.07671, 0, 0.56222], + "111": [0, 0.43056, 0.06312, 0, 0.51111], + "112": [0.19444, 0.43056, 0.06312, 0, 0.51111], + "113": [0.19444, 0.43056, 0.08847, 0, 0.46], + "114": [0, 0.43056, 0.10764, 0, 0.42166], + "115": [0, 0.43056, 0.08208, 0, 0.40889], + "116": [0, 0.61508, 0.09486, 0, 0.33222], + "117": [0, 0.43056, 0.07671, 0, 0.53666], + "118": [0, 0.43056, 0.10764, 0, 0.46], + "119": [0, 0.43056, 0.10764, 0, 0.66444], + "120": [0, 0.43056, 0.12042, 0, 0.46389], + "121": [0.19444, 0.43056, 0.08847, 0, 0.48555], + "122": [0, 0.43056, 0.12292, 0, 0.40889], + "126": [0.35, 0.31786, 0.11585, 0, 0.51111], + "160": [0, 0, 0, 0, 0.25], + "168": [0, 0.66786, 0.10474, 0, 0.51111], + "176": [0, 0.69444, 0, 0, 0.83129], + "184": [0.17014, 0, 0, 0, 0.46], + "198": [0, 0.68333, 0.12028, 0, 0.88277], + "216": [0.04861, 0.73194, 0.09403, 0, 0.76666], + "223": [0.19444, 0.69444, 0.10514, 0, 0.53666], + "230": [0, 0.43056, 0.07514, 0, 0.71555], + "248": [0.09722, 0.52778, 0.09194, 0, 0.51111], + "338": [0, 0.68333, 0.12028, 0, 0.98499], + "339": [0, 0.43056, 0.07514, 0, 0.71555], + "710": [0, 0.69444, 0.06646, 0, 0.51111], + "711": [0, 0.62847, 0.08295, 0, 0.51111], + "713": [0, 0.56167, 0.10333, 0, 0.51111], + "714": [0, 0.69444, 0.09694, 0, 0.51111], + "715": [0, 0.69444, 0, 0, 0.51111], + "728": [0, 0.69444, 0.10806, 0, 0.51111], + "729": [0, 0.66786, 0.11752, 0, 0.30667], + "730": [0, 0.69444, 0, 0, 0.83129], + "732": [0, 0.66786, 0.11585, 0, 0.51111], + "733": [0, 0.69444, 0.1225, 0, 0.51111], + "915": [0, 0.68333, 0.13305, 0, 0.62722], + "916": [0, 0.68333, 0, 0, 0.81777], + "920": [0, 0.68333, 0.09403, 0, 0.76666], + "923": [0, 0.68333, 0, 0, 0.69222], + "926": [0, 0.68333, 0.15294, 0, 0.66444], + "928": [0, 0.68333, 0.16389, 0, 0.74333], + "931": [0, 0.68333, 0.12028, 0, 0.71555], + "933": [0, 0.68333, 0.11111, 0, 0.76666], + "934": [0, 0.68333, 0.05986, 0, 0.71555], + "936": [0, 0.68333, 0.11111, 0, 0.76666], + "937": [0, 0.68333, 0.10257, 0, 0.71555], + "8211": [0, 0.43056, 0.09208, 0, 0.51111], + "8212": [0, 0.43056, 0.09208, 0, 1.02222], + "8216": [0, 0.69444, 0.12417, 0, 0.30667], + "8217": [0, 0.69444, 0.12417, 0, 0.30667], + "8220": [0, 0.69444, 0.1685, 0, 0.51444], + "8221": [0, 0.69444, 0.06961, 0, 0.51444], + "8463": [0, 0.68889, 0, 0, 0.54028] + }, + "Main-Regular": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69444, 0, 0, 0.27778], + "34": [0, 0.69444, 0, 0, 0.5], + "35": [0.19444, 0.69444, 0, 0, 0.83334], + "36": [0.05556, 0.75, 0, 0, 0.5], + "37": [0.05556, 0.75, 0, 0, 0.83334], + "38": [0, 0.69444, 0, 0, 0.77778], + "39": [0, 0.69444, 0, 0, 0.27778], + "40": [0.25, 0.75, 0, 0, 0.38889], + "41": [0.25, 0.75, 0, 0, 0.38889], + "42": [0, 0.75, 0, 0, 0.5], + "43": [0.08333, 0.58333, 0, 0, 0.77778], + "44": [0.19444, 0.10556, 0, 0, 0.27778], + "45": [0, 0.43056, 0, 0, 0.33333], + "46": [0, 0.10556, 0, 0, 0.27778], + "47": [0.25, 0.75, 0, 0, 0.5], + "48": [0, 0.64444, 0, 0, 0.5], + "49": [0, 0.64444, 0, 0, 0.5], + "50": [0, 0.64444, 0, 0, 0.5], + "51": [0, 0.64444, 0, 0, 0.5], + "52": [0, 0.64444, 0, 0, 0.5], + "53": [0, 0.64444, 0, 0, 0.5], + "54": [0, 0.64444, 0, 0, 0.5], + "55": [0, 0.64444, 0, 0, 0.5], + "56": [0, 0.64444, 0, 0, 0.5], + "57": [0, 0.64444, 0, 0, 0.5], + "58": [0, 0.43056, 0, 0, 0.27778], + "59": [0.19444, 0.43056, 0, 0, 0.27778], + "60": [0.0391, 0.5391, 0, 0, 0.77778], + "61": [-0.13313, 0.36687, 0, 0, 0.77778], + "62": [0.0391, 0.5391, 0, 0, 0.77778], + "63": [0, 0.69444, 0, 0, 0.47222], + "64": [0, 0.69444, 0, 0, 0.77778], + "65": [0, 0.68333, 0, 0, 0.75], + "66": [0, 0.68333, 0, 0, 0.70834], + "67": [0, 0.68333, 0, 0, 0.72222], + "68": [0, 0.68333, 0, 0, 0.76389], + "69": [0, 0.68333, 0, 0, 0.68056], + "70": [0, 0.68333, 0, 0, 0.65278], + "71": [0, 0.68333, 0, 0, 0.78472], + "72": [0, 0.68333, 0, 0, 0.75], + "73": [0, 0.68333, 0, 0, 0.36111], + "74": [0, 0.68333, 0, 0, 0.51389], + "75": [0, 0.68333, 0, 0, 0.77778], + "76": [0, 0.68333, 0, 0, 0.625], + "77": [0, 0.68333, 0, 0, 0.91667], + "78": [0, 0.68333, 0, 0, 0.75], + "79": [0, 0.68333, 0, 0, 0.77778], + "80": [0, 0.68333, 0, 0, 0.68056], + "81": [0.19444, 0.68333, 0, 0, 0.77778], + "82": [0, 0.68333, 0, 0, 0.73611], + "83": [0, 0.68333, 0, 0, 0.55556], + "84": [0, 0.68333, 0, 0, 0.72222], + "85": [0, 0.68333, 0, 0, 0.75], + "86": [0, 0.68333, 0.01389, 0, 0.75], + "87": [0, 0.68333, 0.01389, 0, 1.02778], + "88": [0, 0.68333, 0, 0, 0.75], + "89": [0, 0.68333, 0.025, 0, 0.75], + "90": [0, 0.68333, 0, 0, 0.61111], + "91": [0.25, 0.75, 0, 0, 0.27778], + "92": [0.25, 0.75, 0, 0, 0.5], + "93": [0.25, 0.75, 0, 0, 0.27778], + "94": [0, 0.69444, 0, 0, 0.5], + "95": [0.31, 0.12056, 0.02778, 0, 0.5], + "97": [0, 0.43056, 0, 0, 0.5], + "98": [0, 0.69444, 0, 0, 0.55556], + "99": [0, 0.43056, 0, 0, 0.44445], + "100": [0, 0.69444, 0, 0, 0.55556], + "101": [0, 0.43056, 0, 0, 0.44445], + "102": [0, 0.69444, 0.07778, 0, 0.30556], + "103": [0.19444, 0.43056, 0.01389, 0, 0.5], + "104": [0, 0.69444, 0, 0, 0.55556], + "105": [0, 0.66786, 0, 0, 0.27778], + "106": [0.19444, 0.66786, 0, 0, 0.30556], + "107": [0, 0.69444, 0, 0, 0.52778], + "108": [0, 0.69444, 0, 0, 0.27778], + "109": [0, 0.43056, 0, 0, 0.83334], + "110": [0, 0.43056, 0, 0, 0.55556], + "111": [0, 0.43056, 0, 0, 0.5], + "112": [0.19444, 0.43056, 0, 0, 0.55556], + "113": [0.19444, 0.43056, 0, 0, 0.52778], + "114": [0, 0.43056, 0, 0, 0.39167], + "115": [0, 0.43056, 0, 0, 0.39445], + "116": [0, 0.61508, 0, 0, 0.38889], + "117": [0, 0.43056, 0, 0, 0.55556], + "118": [0, 0.43056, 0.01389, 0, 0.52778], + "119": [0, 0.43056, 0.01389, 0, 0.72222], + "120": [0, 0.43056, 0, 0, 0.52778], + "121": [0.19444, 0.43056, 0.01389, 0, 0.52778], + "122": [0, 0.43056, 0, 0, 0.44445], + "123": [0.25, 0.75, 0, 0, 0.5], + "124": [0.25, 0.75, 0, 0, 0.27778], + "125": [0.25, 0.75, 0, 0, 0.5], + "126": [0.35, 0.31786, 0, 0, 0.5], + "160": [0, 0, 0, 0, 0.25], + "163": [0, 0.69444, 0, 0, 0.76909], + "167": [0.19444, 0.69444, 0, 0, 0.44445], + "168": [0, 0.66786, 0, 0, 0.5], + "172": [0, 0.43056, 0, 0, 0.66667], + "176": [0, 0.69444, 0, 0, 0.75], + "177": [0.08333, 0.58333, 0, 0, 0.77778], + "182": [0.19444, 0.69444, 0, 0, 0.61111], + "184": [0.17014, 0, 0, 0, 0.44445], + "198": [0, 0.68333, 0, 0, 0.90278], + "215": [0.08333, 0.58333, 0, 0, 0.77778], + "216": [0.04861, 0.73194, 0, 0, 0.77778], + "223": [0, 0.69444, 0, 0, 0.5], + "230": [0, 0.43056, 0, 0, 0.72222], + "247": [0.08333, 0.58333, 0, 0, 0.77778], + "248": [0.09722, 0.52778, 0, 0, 0.5], + "305": [0, 0.43056, 0, 0, 0.27778], + "338": [0, 0.68333, 0, 0, 1.01389], + "339": [0, 0.43056, 0, 0, 0.77778], + "567": [0.19444, 0.43056, 0, 0, 0.30556], + "710": [0, 0.69444, 0, 0, 0.5], + "711": [0, 0.62847, 0, 0, 0.5], + "713": [0, 0.56778, 0, 0, 0.5], + "714": [0, 0.69444, 0, 0, 0.5], + "715": [0, 0.69444, 0, 0, 0.5], + "728": [0, 0.69444, 0, 0, 0.5], + "729": [0, 0.66786, 0, 0, 0.27778], + "730": [0, 0.69444, 0, 0, 0.75], + "732": [0, 0.66786, 0, 0, 0.5], + "733": [0, 0.69444, 0, 0, 0.5], + "915": [0, 0.68333, 0, 0, 0.625], + "916": [0, 0.68333, 0, 0, 0.83334], + "920": [0, 0.68333, 0, 0, 0.77778], + "923": [0, 0.68333, 0, 0, 0.69445], + "926": [0, 0.68333, 0, 0, 0.66667], + "928": [0, 0.68333, 0, 0, 0.75], + "931": [0, 0.68333, 0, 0, 0.72222], + "933": [0, 0.68333, 0, 0, 0.77778], + "934": [0, 0.68333, 0, 0, 0.72222], + "936": [0, 0.68333, 0, 0, 0.77778], + "937": [0, 0.68333, 0, 0, 0.72222], + "8211": [0, 0.43056, 0.02778, 0, 0.5], + "8212": [0, 0.43056, 0.02778, 0, 1], + "8216": [0, 0.69444, 0, 0, 0.27778], + "8217": [0, 0.69444, 0, 0, 0.27778], + "8220": [0, 0.69444, 0, 0, 0.5], + "8221": [0, 0.69444, 0, 0, 0.5], + "8224": [0.19444, 0.69444, 0, 0, 0.44445], + "8225": [0.19444, 0.69444, 0, 0, 0.44445], + "8230": [0, 0.123, 0, 0, 1.172], + "8242": [0, 0.55556, 0, 0, 0.275], + "8407": [0, 0.71444, 0.15382, 0, 0.5], + "8463": [0, 0.68889, 0, 0, 0.54028], + "8465": [0, 0.69444, 0, 0, 0.72222], + "8467": [0, 0.69444, 0, 0.11111, 0.41667], + "8472": [0.19444, 0.43056, 0, 0.11111, 0.63646], + "8476": [0, 0.69444, 0, 0, 0.72222], + "8501": [0, 0.69444, 0, 0, 0.61111], + "8592": [-0.13313, 0.36687, 0, 0, 1], + "8593": [0.19444, 0.69444, 0, 0, 0.5], + "8594": [-0.13313, 0.36687, 0, 0, 1], + "8595": [0.19444, 0.69444, 0, 0, 0.5], + "8596": [-0.13313, 0.36687, 0, 0, 1], + "8597": [0.25, 0.75, 0, 0, 0.5], + "8598": [0.19444, 0.69444, 0, 0, 1], + "8599": [0.19444, 0.69444, 0, 0, 1], + "8600": [0.19444, 0.69444, 0, 0, 1], + "8601": [0.19444, 0.69444, 0, 0, 1], + "8614": [0.011, 0.511, 0, 0, 1], + "8617": [0.011, 0.511, 0, 0, 1.126], + "8618": [0.011, 0.511, 0, 0, 1.126], + "8636": [-0.13313, 0.36687, 0, 0, 1], + "8637": [-0.13313, 0.36687, 0, 0, 1], + "8640": [-0.13313, 0.36687, 0, 0, 1], + "8641": [-0.13313, 0.36687, 0, 0, 1], + "8652": [0.011, 0.671, 0, 0, 1], + "8656": [-0.13313, 0.36687, 0, 0, 1], + "8657": [0.19444, 0.69444, 0, 0, 0.61111], + "8658": [-0.13313, 0.36687, 0, 0, 1], + "8659": [0.19444, 0.69444, 0, 0, 0.61111], + "8660": [-0.13313, 0.36687, 0, 0, 1], + "8661": [0.25, 0.75, 0, 0, 0.61111], + "8704": [0, 0.69444, 0, 0, 0.55556], + "8706": [0, 0.69444, 0.05556, 0.08334, 0.5309], + "8707": [0, 0.69444, 0, 0, 0.55556], + "8709": [0.05556, 0.75, 0, 0, 0.5], + "8711": [0, 0.68333, 0, 0, 0.83334], + "8712": [0.0391, 0.5391, 0, 0, 0.66667], + "8715": [0.0391, 0.5391, 0, 0, 0.66667], + "8722": [0.08333, 0.58333, 0, 0, 0.77778], + "8723": [0.08333, 0.58333, 0, 0, 0.77778], + "8725": [0.25, 0.75, 0, 0, 0.5], + "8726": [0.25, 0.75, 0, 0, 0.5], + "8727": [-0.03472, 0.46528, 0, 0, 0.5], + "8728": [-0.05555, 0.44445, 0, 0, 0.5], + "8729": [-0.05555, 0.44445, 0, 0, 0.5], + "8730": [0.2, 0.8, 0, 0, 0.83334], + "8733": [0, 0.43056, 0, 0, 0.77778], + "8734": [0, 0.43056, 0, 0, 1], + "8736": [0, 0.69224, 0, 0, 0.72222], + "8739": [0.25, 0.75, 0, 0, 0.27778], + "8741": [0.25, 0.75, 0, 0, 0.5], + "8743": [0, 0.55556, 0, 0, 0.66667], + "8744": [0, 0.55556, 0, 0, 0.66667], + "8745": [0, 0.55556, 0, 0, 0.66667], + "8746": [0, 0.55556, 0, 0, 0.66667], + "8747": [0.19444, 0.69444, 0.11111, 0, 0.41667], + "8764": [-0.13313, 0.36687, 0, 0, 0.77778], + "8768": [0.19444, 0.69444, 0, 0, 0.27778], + "8771": [-0.03625, 0.46375, 0, 0, 0.77778], + "8773": [-0.022, 0.589, 0, 0, 0.778], + "8776": [-0.01688, 0.48312, 0, 0, 0.77778], + "8781": [-0.03625, 0.46375, 0, 0, 0.77778], + "8784": [-0.133, 0.673, 0, 0, 0.778], + "8801": [-0.03625, 0.46375, 0, 0, 0.77778], + "8804": [0.13597, 0.63597, 0, 0, 0.77778], + "8805": [0.13597, 0.63597, 0, 0, 0.77778], + "8810": [0.0391, 0.5391, 0, 0, 1], + "8811": [0.0391, 0.5391, 0, 0, 1], + "8826": [0.0391, 0.5391, 0, 0, 0.77778], + "8827": [0.0391, 0.5391, 0, 0, 0.77778], + "8834": [0.0391, 0.5391, 0, 0, 0.77778], + "8835": [0.0391, 0.5391, 0, 0, 0.77778], + "8838": [0.13597, 0.63597, 0, 0, 0.77778], + "8839": [0.13597, 0.63597, 0, 0, 0.77778], + "8846": [0, 0.55556, 0, 0, 0.66667], + "8849": [0.13597, 0.63597, 0, 0, 0.77778], + "8850": [0.13597, 0.63597, 0, 0, 0.77778], + "8851": [0, 0.55556, 0, 0, 0.66667], + "8852": [0, 0.55556, 0, 0, 0.66667], + "8853": [0.08333, 0.58333, 0, 0, 0.77778], + "8854": [0.08333, 0.58333, 0, 0, 0.77778], + "8855": [0.08333, 0.58333, 0, 0, 0.77778], + "8856": [0.08333, 0.58333, 0, 0, 0.77778], + "8857": [0.08333, 0.58333, 0, 0, 0.77778], + "8866": [0, 0.69444, 0, 0, 0.61111], + "8867": [0, 0.69444, 0, 0, 0.61111], + "8868": [0, 0.69444, 0, 0, 0.77778], + "8869": [0, 0.69444, 0, 0, 0.77778], + "8872": [0.249, 0.75, 0, 0, 0.867], + "8900": [-0.05555, 0.44445, 0, 0, 0.5], + "8901": [-0.05555, 0.44445, 0, 0, 0.27778], + "8902": [-0.03472, 0.46528, 0, 0, 0.5], + "8904": [5e-3, 0.505, 0, 0, 0.9], + "8942": [0.03, 0.903, 0, 0, 0.278], + "8943": [-0.19, 0.313, 0, 0, 1.172], + "8945": [-0.1, 0.823, 0, 0, 1.282], + "8968": [0.25, 0.75, 0, 0, 0.44445], + "8969": [0.25, 0.75, 0, 0, 0.44445], + "8970": [0.25, 0.75, 0, 0, 0.44445], + "8971": [0.25, 0.75, 0, 0, 0.44445], + "8994": [-0.14236, 0.35764, 0, 0, 1], + "8995": [-0.14236, 0.35764, 0, 0, 1], + "9136": [0.244, 0.744, 0, 0, 0.412], + "9137": [0.244, 0.745, 0, 0, 0.412], + "9651": [0.19444, 0.69444, 0, 0, 0.88889], + "9657": [-0.03472, 0.46528, 0, 0, 0.5], + "9661": [0.19444, 0.69444, 0, 0, 0.88889], + "9667": [-0.03472, 0.46528, 0, 0, 0.5], + "9711": [0.19444, 0.69444, 0, 0, 1], + "9824": [0.12963, 0.69444, 0, 0, 0.77778], + "9825": [0.12963, 0.69444, 0, 0, 0.77778], + "9826": [0.12963, 0.69444, 0, 0, 0.77778], + "9827": [0.12963, 0.69444, 0, 0, 0.77778], + "9837": [0, 0.75, 0, 0, 0.38889], + "9838": [0.19444, 0.69444, 0, 0, 0.38889], + "9839": [0.19444, 0.69444, 0, 0, 0.38889], + "10216": [0.25, 0.75, 0, 0, 0.38889], + "10217": [0.25, 0.75, 0, 0, 0.38889], + "10222": [0.244, 0.744, 0, 0, 0.412], + "10223": [0.244, 0.745, 0, 0, 0.412], + "10229": [0.011, 0.511, 0, 0, 1.609], + "10230": [0.011, 0.511, 0, 0, 1.638], + "10231": [0.011, 0.511, 0, 0, 1.859], + "10232": [0.024, 0.525, 0, 0, 1.609], + "10233": [0.024, 0.525, 0, 0, 1.638], + "10234": [0.024, 0.525, 0, 0, 1.858], + "10236": [0.011, 0.511, 0, 0, 1.638], + "10815": [0, 0.68333, 0, 0, 0.75], + "10927": [0.13597, 0.63597, 0, 0, 0.77778], + "10928": [0.13597, 0.63597, 0, 0, 0.77778], + "57376": [0.19444, 0.69444, 0, 0, 0] + }, + "Math-BoldItalic": { + "32": [0, 0, 0, 0, 0.25], + "48": [0, 0.44444, 0, 0, 0.575], + "49": [0, 0.44444, 0, 0, 0.575], + "50": [0, 0.44444, 0, 0, 0.575], + "51": [0.19444, 0.44444, 0, 0, 0.575], + "52": [0.19444, 0.44444, 0, 0, 0.575], + "53": [0.19444, 0.44444, 0, 0, 0.575], + "54": [0, 0.64444, 0, 0, 0.575], + "55": [0.19444, 0.44444, 0, 0, 0.575], + "56": [0, 0.64444, 0, 0, 0.575], + "57": [0.19444, 0.44444, 0, 0, 0.575], + "65": [0, 0.68611, 0, 0, 0.86944], + "66": [0, 0.68611, 0.04835, 0, 0.8664], + "67": [0, 0.68611, 0.06979, 0, 0.81694], + "68": [0, 0.68611, 0.03194, 0, 0.93812], + "69": [0, 0.68611, 0.05451, 0, 0.81007], + "70": [0, 0.68611, 0.15972, 0, 0.68889], + "71": [0, 0.68611, 0, 0, 0.88673], + "72": [0, 0.68611, 0.08229, 0, 0.98229], + "73": [0, 0.68611, 0.07778, 0, 0.51111], + "74": [0, 0.68611, 0.10069, 0, 0.63125], + "75": [0, 0.68611, 0.06979, 0, 0.97118], + "76": [0, 0.68611, 0, 0, 0.75555], + "77": [0, 0.68611, 0.11424, 0, 1.14201], + "78": [0, 0.68611, 0.11424, 0, 0.95034], + "79": [0, 0.68611, 0.03194, 0, 0.83666], + "80": [0, 0.68611, 0.15972, 0, 0.72309], + "81": [0.19444, 0.68611, 0, 0, 0.86861], + "82": [0, 0.68611, 421e-5, 0, 0.87235], + "83": [0, 0.68611, 0.05382, 0, 0.69271], + "84": [0, 0.68611, 0.15972, 0, 0.63663], + "85": [0, 0.68611, 0.11424, 0, 0.80027], + "86": [0, 0.68611, 0.25555, 0, 0.67778], + "87": [0, 0.68611, 0.15972, 0, 1.09305], + "88": [0, 0.68611, 0.07778, 0, 0.94722], + "89": [0, 0.68611, 0.25555, 0, 0.67458], + "90": [0, 0.68611, 0.06979, 0, 0.77257], + "97": [0, 0.44444, 0, 0, 0.63287], + "98": [0, 0.69444, 0, 0, 0.52083], + "99": [0, 0.44444, 0, 0, 0.51342], + "100": [0, 0.69444, 0, 0, 0.60972], + "101": [0, 0.44444, 0, 0, 0.55361], + "102": [0.19444, 0.69444, 0.11042, 0, 0.56806], + "103": [0.19444, 0.44444, 0.03704, 0, 0.5449], + "104": [0, 0.69444, 0, 0, 0.66759], + "105": [0, 0.69326, 0, 0, 0.4048], + "106": [0.19444, 0.69326, 0.0622, 0, 0.47083], + "107": [0, 0.69444, 0.01852, 0, 0.6037], + "108": [0, 0.69444, 88e-4, 0, 0.34815], + "109": [0, 0.44444, 0, 0, 1.0324], + "110": [0, 0.44444, 0, 0, 0.71296], + "111": [0, 0.44444, 0, 0, 0.58472], + "112": [0.19444, 0.44444, 0, 0, 0.60092], + "113": [0.19444, 0.44444, 0.03704, 0, 0.54213], + "114": [0, 0.44444, 0.03194, 0, 0.5287], + "115": [0, 0.44444, 0, 0, 0.53125], + "116": [0, 0.63492, 0, 0, 0.41528], + "117": [0, 0.44444, 0, 0, 0.68102], + "118": [0, 0.44444, 0.03704, 0, 0.56666], + "119": [0, 0.44444, 0.02778, 0, 0.83148], + "120": [0, 0.44444, 0, 0, 0.65903], + "121": [0.19444, 0.44444, 0.03704, 0, 0.59028], + "122": [0, 0.44444, 0.04213, 0, 0.55509], + "160": [0, 0, 0, 0, 0.25], + "915": [0, 0.68611, 0.15972, 0, 0.65694], + "916": [0, 0.68611, 0, 0, 0.95833], + "920": [0, 0.68611, 0.03194, 0, 0.86722], + "923": [0, 0.68611, 0, 0, 0.80555], + "926": [0, 0.68611, 0.07458, 0, 0.84125], + "928": [0, 0.68611, 0.08229, 0, 0.98229], + "931": [0, 0.68611, 0.05451, 0, 0.88507], + "933": [0, 0.68611, 0.15972, 0, 0.67083], + "934": [0, 0.68611, 0, 0, 0.76666], + "936": [0, 0.68611, 0.11653, 0, 0.71402], + "937": [0, 0.68611, 0.04835, 0, 0.8789], + "945": [0, 0.44444, 0, 0, 0.76064], + "946": [0.19444, 0.69444, 0.03403, 0, 0.65972], + "947": [0.19444, 0.44444, 0.06389, 0, 0.59003], + "948": [0, 0.69444, 0.03819, 0, 0.52222], + "949": [0, 0.44444, 0, 0, 0.52882], + "950": [0.19444, 0.69444, 0.06215, 0, 0.50833], + "951": [0.19444, 0.44444, 0.03704, 0, 0.6], + "952": [0, 0.69444, 0.03194, 0, 0.5618], + "953": [0, 0.44444, 0, 0, 0.41204], + "954": [0, 0.44444, 0, 0, 0.66759], + "955": [0, 0.69444, 0, 0, 0.67083], + "956": [0.19444, 0.44444, 0, 0, 0.70787], + "957": [0, 0.44444, 0.06898, 0, 0.57685], + "958": [0.19444, 0.69444, 0.03021, 0, 0.50833], + "959": [0, 0.44444, 0, 0, 0.58472], + "960": [0, 0.44444, 0.03704, 0, 0.68241], + "961": [0.19444, 0.44444, 0, 0, 0.6118], + "962": [0.09722, 0.44444, 0.07917, 0, 0.42361], + "963": [0, 0.44444, 0.03704, 0, 0.68588], + "964": [0, 0.44444, 0.13472, 0, 0.52083], + "965": [0, 0.44444, 0.03704, 0, 0.63055], + "966": [0.19444, 0.44444, 0, 0, 0.74722], + "967": [0.19444, 0.44444, 0, 0, 0.71805], + "968": [0.19444, 0.69444, 0.03704, 0, 0.75833], + "969": [0, 0.44444, 0.03704, 0, 0.71782], + "977": [0, 0.69444, 0, 0, 0.69155], + "981": [0.19444, 0.69444, 0, 0, 0.7125], + "982": [0, 0.44444, 0.03194, 0, 0.975], + "1009": [0.19444, 0.44444, 0, 0, 0.6118], + "1013": [0, 0.44444, 0, 0, 0.48333], + "57649": [0, 0.44444, 0, 0, 0.39352], + "57911": [0.19444, 0.44444, 0, 0, 0.43889] + }, + "Math-Italic": { + "32": [0, 0, 0, 0, 0.25], + "48": [0, 0.43056, 0, 0, 0.5], + "49": [0, 0.43056, 0, 0, 0.5], + "50": [0, 0.43056, 0, 0, 0.5], + "51": [0.19444, 0.43056, 0, 0, 0.5], + "52": [0.19444, 0.43056, 0, 0, 0.5], + "53": [0.19444, 0.43056, 0, 0, 0.5], + "54": [0, 0.64444, 0, 0, 0.5], + "55": [0.19444, 0.43056, 0, 0, 0.5], + "56": [0, 0.64444, 0, 0, 0.5], + "57": [0.19444, 0.43056, 0, 0, 0.5], + "65": [0, 0.68333, 0, 0.13889, 0.75], + "66": [0, 0.68333, 0.05017, 0.08334, 0.75851], + "67": [0, 0.68333, 0.07153, 0.08334, 0.71472], + "68": [0, 0.68333, 0.02778, 0.05556, 0.82792], + "69": [0, 0.68333, 0.05764, 0.08334, 0.7382], + "70": [0, 0.68333, 0.13889, 0.08334, 0.64306], + "71": [0, 0.68333, 0, 0.08334, 0.78625], + "72": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "73": [0, 0.68333, 0.07847, 0.11111, 0.43958], + "74": [0, 0.68333, 0.09618, 0.16667, 0.55451], + "75": [0, 0.68333, 0.07153, 0.05556, 0.84931], + "76": [0, 0.68333, 0, 0.02778, 0.68056], + "77": [0, 0.68333, 0.10903, 0.08334, 0.97014], + "78": [0, 0.68333, 0.10903, 0.08334, 0.80347], + "79": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "80": [0, 0.68333, 0.13889, 0.08334, 0.64201], + "81": [0.19444, 0.68333, 0, 0.08334, 0.79056], + "82": [0, 0.68333, 773e-5, 0.08334, 0.75929], + "83": [0, 0.68333, 0.05764, 0.08334, 0.6132], + "84": [0, 0.68333, 0.13889, 0.08334, 0.58438], + "85": [0, 0.68333, 0.10903, 0.02778, 0.68278], + "86": [0, 0.68333, 0.22222, 0, 0.58333], + "87": [0, 0.68333, 0.13889, 0, 0.94445], + "88": [0, 0.68333, 0.07847, 0.08334, 0.82847], + "89": [0, 0.68333, 0.22222, 0, 0.58056], + "90": [0, 0.68333, 0.07153, 0.08334, 0.68264], + "97": [0, 0.43056, 0, 0, 0.52859], + "98": [0, 0.69444, 0, 0, 0.42917], + "99": [0, 0.43056, 0, 0.05556, 0.43276], + "100": [0, 0.69444, 0, 0.16667, 0.52049], + "101": [0, 0.43056, 0, 0.05556, 0.46563], + "102": [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], + "103": [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], + "104": [0, 0.69444, 0, 0, 0.57616], + "105": [0, 0.65952, 0, 0, 0.34451], + "106": [0.19444, 0.65952, 0.05724, 0, 0.41181], + "107": [0, 0.69444, 0.03148, 0, 0.5206], + "108": [0, 0.69444, 0.01968, 0.08334, 0.29838], + "109": [0, 0.43056, 0, 0, 0.87801], + "110": [0, 0.43056, 0, 0, 0.60023], + "111": [0, 0.43056, 0, 0.05556, 0.48472], + "112": [0.19444, 0.43056, 0, 0.08334, 0.50313], + "113": [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], + "114": [0, 0.43056, 0.02778, 0.05556, 0.45116], + "115": [0, 0.43056, 0, 0.05556, 0.46875], + "116": [0, 0.61508, 0, 0.08334, 0.36111], + "117": [0, 0.43056, 0, 0.02778, 0.57246], + "118": [0, 0.43056, 0.03588, 0.02778, 0.48472], + "119": [0, 0.43056, 0.02691, 0.08334, 0.71592], + "120": [0, 0.43056, 0, 0.02778, 0.57153], + "121": [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], + "122": [0, 0.43056, 0.04398, 0.05556, 0.46505], + "160": [0, 0, 0, 0, 0.25], + "915": [0, 0.68333, 0.13889, 0.08334, 0.61528], + "916": [0, 0.68333, 0, 0.16667, 0.83334], + "920": [0, 0.68333, 0.02778, 0.08334, 0.76278], + "923": [0, 0.68333, 0, 0.16667, 0.69445], + "926": [0, 0.68333, 0.07569, 0.08334, 0.74236], + "928": [0, 0.68333, 0.08125, 0.05556, 0.83125], + "931": [0, 0.68333, 0.05764, 0.08334, 0.77986], + "933": [0, 0.68333, 0.13889, 0.05556, 0.58333], + "934": [0, 0.68333, 0, 0.08334, 0.66667], + "936": [0, 0.68333, 0.11, 0.05556, 0.61222], + "937": [0, 0.68333, 0.05017, 0.08334, 0.7724], + "945": [0, 0.43056, 37e-4, 0.02778, 0.6397], + "946": [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], + "947": [0.19444, 0.43056, 0.05556, 0, 0.51773], + "948": [0, 0.69444, 0.03785, 0.05556, 0.44444], + "949": [0, 0.43056, 0, 0.08334, 0.46632], + "950": [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], + "951": [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], + "952": [0, 0.69444, 0.02778, 0.08334, 0.46944], + "953": [0, 0.43056, 0, 0.05556, 0.35394], + "954": [0, 0.43056, 0, 0, 0.57616], + "955": [0, 0.69444, 0, 0, 0.58334], + "956": [0.19444, 0.43056, 0, 0.02778, 0.60255], + "957": [0, 0.43056, 0.06366, 0.02778, 0.49398], + "958": [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], + "959": [0, 0.43056, 0, 0.05556, 0.48472], + "960": [0, 0.43056, 0.03588, 0, 0.57003], + "961": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "962": [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], + "963": [0, 0.43056, 0.03588, 0, 0.57141], + "964": [0, 0.43056, 0.1132, 0.02778, 0.43715], + "965": [0, 0.43056, 0.03588, 0.02778, 0.54028], + "966": [0.19444, 0.43056, 0, 0.08334, 0.65417], + "967": [0.19444, 0.43056, 0, 0.05556, 0.62569], + "968": [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], + "969": [0, 0.43056, 0.03588, 0, 0.62245], + "977": [0, 0.69444, 0, 0.08334, 0.59144], + "981": [0.19444, 0.69444, 0, 0.08334, 0.59583], + "982": [0, 0.43056, 0.02778, 0, 0.82813], + "1009": [0.19444, 0.43056, 0, 0.08334, 0.51702], + "1013": [0, 0.43056, 0, 0.05556, 0.4059], + "57649": [0, 0.43056, 0, 0.02778, 0.32246], + "57911": [0.19444, 0.43056, 0, 0.08334, 0.38403] + }, + "SansSerif-Bold": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69444, 0, 0, 0.36667], + "34": [0, 0.69444, 0, 0, 0.55834], + "35": [0.19444, 0.69444, 0, 0, 0.91667], + "36": [0.05556, 0.75, 0, 0, 0.55], + "37": [0.05556, 0.75, 0, 0, 1.02912], + "38": [0, 0.69444, 0, 0, 0.83056], + "39": [0, 0.69444, 0, 0, 0.30556], + "40": [0.25, 0.75, 0, 0, 0.42778], + "41": [0.25, 0.75, 0, 0, 0.42778], + "42": [0, 0.75, 0, 0, 0.55], + "43": [0.11667, 0.61667, 0, 0, 0.85556], + "44": [0.10556, 0.13056, 0, 0, 0.30556], + "45": [0, 0.45833, 0, 0, 0.36667], + "46": [0, 0.13056, 0, 0, 0.30556], + "47": [0.25, 0.75, 0, 0, 0.55], + "48": [0, 0.69444, 0, 0, 0.55], + "49": [0, 0.69444, 0, 0, 0.55], + "50": [0, 0.69444, 0, 0, 0.55], + "51": [0, 0.69444, 0, 0, 0.55], + "52": [0, 0.69444, 0, 0, 0.55], + "53": [0, 0.69444, 0, 0, 0.55], + "54": [0, 0.69444, 0, 0, 0.55], + "55": [0, 0.69444, 0, 0, 0.55], + "56": [0, 0.69444, 0, 0, 0.55], + "57": [0, 0.69444, 0, 0, 0.55], + "58": [0, 0.45833, 0, 0, 0.30556], + "59": [0.10556, 0.45833, 0, 0, 0.30556], + "61": [-0.09375, 0.40625, 0, 0, 0.85556], + "63": [0, 0.69444, 0, 0, 0.51945], + "64": [0, 0.69444, 0, 0, 0.73334], + "65": [0, 0.69444, 0, 0, 0.73334], + "66": [0, 0.69444, 0, 0, 0.73334], + "67": [0, 0.69444, 0, 0, 0.70278], + "68": [0, 0.69444, 0, 0, 0.79445], + "69": [0, 0.69444, 0, 0, 0.64167], + "70": [0, 0.69444, 0, 0, 0.61111], + "71": [0, 0.69444, 0, 0, 0.73334], + "72": [0, 0.69444, 0, 0, 0.79445], + "73": [0, 0.69444, 0, 0, 0.33056], + "74": [0, 0.69444, 0, 0, 0.51945], + "75": [0, 0.69444, 0, 0, 0.76389], + "76": [0, 0.69444, 0, 0, 0.58056], + "77": [0, 0.69444, 0, 0, 0.97778], + "78": [0, 0.69444, 0, 0, 0.79445], + "79": [0, 0.69444, 0, 0, 0.79445], + "80": [0, 0.69444, 0, 0, 0.70278], + "81": [0.10556, 0.69444, 0, 0, 0.79445], + "82": [0, 0.69444, 0, 0, 0.70278], + "83": [0, 0.69444, 0, 0, 0.61111], + "84": [0, 0.69444, 0, 0, 0.73334], + "85": [0, 0.69444, 0, 0, 0.76389], + "86": [0, 0.69444, 0.01528, 0, 0.73334], + "87": [0, 0.69444, 0.01528, 0, 1.03889], + "88": [0, 0.69444, 0, 0, 0.73334], + "89": [0, 0.69444, 0.0275, 0, 0.73334], + "90": [0, 0.69444, 0, 0, 0.67223], + "91": [0.25, 0.75, 0, 0, 0.34306], + "93": [0.25, 0.75, 0, 0, 0.34306], + "94": [0, 0.69444, 0, 0, 0.55], + "95": [0.35, 0.10833, 0.03056, 0, 0.55], + "97": [0, 0.45833, 0, 0, 0.525], + "98": [0, 0.69444, 0, 0, 0.56111], + "99": [0, 0.45833, 0, 0, 0.48889], + "100": [0, 0.69444, 0, 0, 0.56111], + "101": [0, 0.45833, 0, 0, 0.51111], + "102": [0, 0.69444, 0.07639, 0, 0.33611], + "103": [0.19444, 0.45833, 0.01528, 0, 0.55], + "104": [0, 0.69444, 0, 0, 0.56111], + "105": [0, 0.69444, 0, 0, 0.25556], + "106": [0.19444, 0.69444, 0, 0, 0.28611], + "107": [0, 0.69444, 0, 0, 0.53056], + "108": [0, 0.69444, 0, 0, 0.25556], + "109": [0, 0.45833, 0, 0, 0.86667], + "110": [0, 0.45833, 0, 0, 0.56111], + "111": [0, 0.45833, 0, 0, 0.55], + "112": [0.19444, 0.45833, 0, 0, 0.56111], + "113": [0.19444, 0.45833, 0, 0, 0.56111], + "114": [0, 0.45833, 0.01528, 0, 0.37222], + "115": [0, 0.45833, 0, 0, 0.42167], + "116": [0, 0.58929, 0, 0, 0.40417], + "117": [0, 0.45833, 0, 0, 0.56111], + "118": [0, 0.45833, 0.01528, 0, 0.5], + "119": [0, 0.45833, 0.01528, 0, 0.74445], + "120": [0, 0.45833, 0, 0, 0.5], + "121": [0.19444, 0.45833, 0.01528, 0, 0.5], + "122": [0, 0.45833, 0, 0, 0.47639], + "126": [0.35, 0.34444, 0, 0, 0.55], + "160": [0, 0, 0, 0, 0.25], + "168": [0, 0.69444, 0, 0, 0.55], + "176": [0, 0.69444, 0, 0, 0.73334], + "180": [0, 0.69444, 0, 0, 0.55], + "184": [0.17014, 0, 0, 0, 0.48889], + "305": [0, 0.45833, 0, 0, 0.25556], + "567": [0.19444, 0.45833, 0, 0, 0.28611], + "710": [0, 0.69444, 0, 0, 0.55], + "711": [0, 0.63542, 0, 0, 0.55], + "713": [0, 0.63778, 0, 0, 0.55], + "728": [0, 0.69444, 0, 0, 0.55], + "729": [0, 0.69444, 0, 0, 0.30556], + "730": [0, 0.69444, 0, 0, 0.73334], + "732": [0, 0.69444, 0, 0, 0.55], + "733": [0, 0.69444, 0, 0, 0.55], + "915": [0, 0.69444, 0, 0, 0.58056], + "916": [0, 0.69444, 0, 0, 0.91667], + "920": [0, 0.69444, 0, 0, 0.85556], + "923": [0, 0.69444, 0, 0, 0.67223], + "926": [0, 0.69444, 0, 0, 0.73334], + "928": [0, 0.69444, 0, 0, 0.79445], + "931": [0, 0.69444, 0, 0, 0.79445], + "933": [0, 0.69444, 0, 0, 0.85556], + "934": [0, 0.69444, 0, 0, 0.79445], + "936": [0, 0.69444, 0, 0, 0.85556], + "937": [0, 0.69444, 0, 0, 0.79445], + "8211": [0, 0.45833, 0.03056, 0, 0.55], + "8212": [0, 0.45833, 0.03056, 0, 1.10001], + "8216": [0, 0.69444, 0, 0, 0.30556], + "8217": [0, 0.69444, 0, 0, 0.30556], + "8220": [0, 0.69444, 0, 0, 0.55834], + "8221": [0, 0.69444, 0, 0, 0.55834] + }, + "SansSerif-Italic": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69444, 0.05733, 0, 0.31945], + "34": [0, 0.69444, 316e-5, 0, 0.5], + "35": [0.19444, 0.69444, 0.05087, 0, 0.83334], + "36": [0.05556, 0.75, 0.11156, 0, 0.5], + "37": [0.05556, 0.75, 0.03126, 0, 0.83334], + "38": [0, 0.69444, 0.03058, 0, 0.75834], + "39": [0, 0.69444, 0.07816, 0, 0.27778], + "40": [0.25, 0.75, 0.13164, 0, 0.38889], + "41": [0.25, 0.75, 0.02536, 0, 0.38889], + "42": [0, 0.75, 0.11775, 0, 0.5], + "43": [0.08333, 0.58333, 0.02536, 0, 0.77778], + "44": [0.125, 0.08333, 0, 0, 0.27778], + "45": [0, 0.44444, 0.01946, 0, 0.33333], + "46": [0, 0.08333, 0, 0, 0.27778], + "47": [0.25, 0.75, 0.13164, 0, 0.5], + "48": [0, 0.65556, 0.11156, 0, 0.5], + "49": [0, 0.65556, 0.11156, 0, 0.5], + "50": [0, 0.65556, 0.11156, 0, 0.5], + "51": [0, 0.65556, 0.11156, 0, 0.5], + "52": [0, 0.65556, 0.11156, 0, 0.5], + "53": [0, 0.65556, 0.11156, 0, 0.5], + "54": [0, 0.65556, 0.11156, 0, 0.5], + "55": [0, 0.65556, 0.11156, 0, 0.5], + "56": [0, 0.65556, 0.11156, 0, 0.5], + "57": [0, 0.65556, 0.11156, 0, 0.5], + "58": [0, 0.44444, 0.02502, 0, 0.27778], + "59": [0.125, 0.44444, 0.02502, 0, 0.27778], + "61": [-0.13, 0.37, 0.05087, 0, 0.77778], + "63": [0, 0.69444, 0.11809, 0, 0.47222], + "64": [0, 0.69444, 0.07555, 0, 0.66667], + "65": [0, 0.69444, 0, 0, 0.66667], + "66": [0, 0.69444, 0.08293, 0, 0.66667], + "67": [0, 0.69444, 0.11983, 0, 0.63889], + "68": [0, 0.69444, 0.07555, 0, 0.72223], + "69": [0, 0.69444, 0.11983, 0, 0.59722], + "70": [0, 0.69444, 0.13372, 0, 0.56945], + "71": [0, 0.69444, 0.11983, 0, 0.66667], + "72": [0, 0.69444, 0.08094, 0, 0.70834], + "73": [0, 0.69444, 0.13372, 0, 0.27778], + "74": [0, 0.69444, 0.08094, 0, 0.47222], + "75": [0, 0.69444, 0.11983, 0, 0.69445], + "76": [0, 0.69444, 0, 0, 0.54167], + "77": [0, 0.69444, 0.08094, 0, 0.875], + "78": [0, 0.69444, 0.08094, 0, 0.70834], + "79": [0, 0.69444, 0.07555, 0, 0.73611], + "80": [0, 0.69444, 0.08293, 0, 0.63889], + "81": [0.125, 0.69444, 0.07555, 0, 0.73611], + "82": [0, 0.69444, 0.08293, 0, 0.64584], + "83": [0, 0.69444, 0.09205, 0, 0.55556], + "84": [0, 0.69444, 0.13372, 0, 0.68056], + "85": [0, 0.69444, 0.08094, 0, 0.6875], + "86": [0, 0.69444, 0.1615, 0, 0.66667], + "87": [0, 0.69444, 0.1615, 0, 0.94445], + "88": [0, 0.69444, 0.13372, 0, 0.66667], + "89": [0, 0.69444, 0.17261, 0, 0.66667], + "90": [0, 0.69444, 0.11983, 0, 0.61111], + "91": [0.25, 0.75, 0.15942, 0, 0.28889], + "93": [0.25, 0.75, 0.08719, 0, 0.28889], + "94": [0, 0.69444, 0.0799, 0, 0.5], + "95": [0.35, 0.09444, 0.08616, 0, 0.5], + "97": [0, 0.44444, 981e-5, 0, 0.48056], + "98": [0, 0.69444, 0.03057, 0, 0.51667], + "99": [0, 0.44444, 0.08336, 0, 0.44445], + "100": [0, 0.69444, 0.09483, 0, 0.51667], + "101": [0, 0.44444, 0.06778, 0, 0.44445], + "102": [0, 0.69444, 0.21705, 0, 0.30556], + "103": [0.19444, 0.44444, 0.10836, 0, 0.5], + "104": [0, 0.69444, 0.01778, 0, 0.51667], + "105": [0, 0.67937, 0.09718, 0, 0.23889], + "106": [0.19444, 0.67937, 0.09162, 0, 0.26667], + "107": [0, 0.69444, 0.08336, 0, 0.48889], + "108": [0, 0.69444, 0.09483, 0, 0.23889], + "109": [0, 0.44444, 0.01778, 0, 0.79445], + "110": [0, 0.44444, 0.01778, 0, 0.51667], + "111": [0, 0.44444, 0.06613, 0, 0.5], + "112": [0.19444, 0.44444, 0.0389, 0, 0.51667], + "113": [0.19444, 0.44444, 0.04169, 0, 0.51667], + "114": [0, 0.44444, 0.10836, 0, 0.34167], + "115": [0, 0.44444, 0.0778, 0, 0.38333], + "116": [0, 0.57143, 0.07225, 0, 0.36111], + "117": [0, 0.44444, 0.04169, 0, 0.51667], + "118": [0, 0.44444, 0.10836, 0, 0.46111], + "119": [0, 0.44444, 0.10836, 0, 0.68334], + "120": [0, 0.44444, 0.09169, 0, 0.46111], + "121": [0.19444, 0.44444, 0.10836, 0, 0.46111], + "122": [0, 0.44444, 0.08752, 0, 0.43472], + "126": [0.35, 0.32659, 0.08826, 0, 0.5], + "160": [0, 0, 0, 0, 0.25], + "168": [0, 0.67937, 0.06385, 0, 0.5], + "176": [0, 0.69444, 0, 0, 0.73752], + "184": [0.17014, 0, 0, 0, 0.44445], + "305": [0, 0.44444, 0.04169, 0, 0.23889], + "567": [0.19444, 0.44444, 0.04169, 0, 0.26667], + "710": [0, 0.69444, 0.0799, 0, 0.5], + "711": [0, 0.63194, 0.08432, 0, 0.5], + "713": [0, 0.60889, 0.08776, 0, 0.5], + "714": [0, 0.69444, 0.09205, 0, 0.5], + "715": [0, 0.69444, 0, 0, 0.5], + "728": [0, 0.69444, 0.09483, 0, 0.5], + "729": [0, 0.67937, 0.07774, 0, 0.27778], + "730": [0, 0.69444, 0, 0, 0.73752], + "732": [0, 0.67659, 0.08826, 0, 0.5], + "733": [0, 0.69444, 0.09205, 0, 0.5], + "915": [0, 0.69444, 0.13372, 0, 0.54167], + "916": [0, 0.69444, 0, 0, 0.83334], + "920": [0, 0.69444, 0.07555, 0, 0.77778], + "923": [0, 0.69444, 0, 0, 0.61111], + "926": [0, 0.69444, 0.12816, 0, 0.66667], + "928": [0, 0.69444, 0.08094, 0, 0.70834], + "931": [0, 0.69444, 0.11983, 0, 0.72222], + "933": [0, 0.69444, 0.09031, 0, 0.77778], + "934": [0, 0.69444, 0.04603, 0, 0.72222], + "936": [0, 0.69444, 0.09031, 0, 0.77778], + "937": [0, 0.69444, 0.08293, 0, 0.72222], + "8211": [0, 0.44444, 0.08616, 0, 0.5], + "8212": [0, 0.44444, 0.08616, 0, 1], + "8216": [0, 0.69444, 0.07816, 0, 0.27778], + "8217": [0, 0.69444, 0.07816, 0, 0.27778], + "8220": [0, 0.69444, 0.14205, 0, 0.5], + "8221": [0, 0.69444, 316e-5, 0, 0.5] + }, + "SansSerif-Regular": { + "32": [0, 0, 0, 0, 0.25], + "33": [0, 0.69444, 0, 0, 0.31945], + "34": [0, 0.69444, 0, 0, 0.5], + "35": [0.19444, 0.69444, 0, 0, 0.83334], + "36": [0.05556, 0.75, 0, 0, 0.5], + "37": [0.05556, 0.75, 0, 0, 0.83334], + "38": [0, 0.69444, 0, 0, 0.75834], + "39": [0, 0.69444, 0, 0, 0.27778], + "40": [0.25, 0.75, 0, 0, 0.38889], + "41": [0.25, 0.75, 0, 0, 0.38889], + "42": [0, 0.75, 0, 0, 0.5], + "43": [0.08333, 0.58333, 0, 0, 0.77778], + "44": [0.125, 0.08333, 0, 0, 0.27778], + "45": [0, 0.44444, 0, 0, 0.33333], + "46": [0, 0.08333, 0, 0, 0.27778], + "47": [0.25, 0.75, 0, 0, 0.5], + "48": [0, 0.65556, 0, 0, 0.5], + "49": [0, 0.65556, 0, 0, 0.5], + "50": [0, 0.65556, 0, 0, 0.5], + "51": [0, 0.65556, 0, 0, 0.5], + "52": [0, 0.65556, 0, 0, 0.5], + "53": [0, 0.65556, 0, 0, 0.5], + "54": [0, 0.65556, 0, 0, 0.5], + "55": [0, 0.65556, 0, 0, 0.5], + "56": [0, 0.65556, 0, 0, 0.5], + "57": [0, 0.65556, 0, 0, 0.5], + "58": [0, 0.44444, 0, 0, 0.27778], + "59": [0.125, 0.44444, 0, 0, 0.27778], + "61": [-0.13, 0.37, 0, 0, 0.77778], + "63": [0, 0.69444, 0, 0, 0.47222], + "64": [0, 0.69444, 0, 0, 0.66667], + "65": [0, 0.69444, 0, 0, 0.66667], + "66": [0, 0.69444, 0, 0, 0.66667], + "67": [0, 0.69444, 0, 0, 0.63889], + "68": [0, 0.69444, 0, 0, 0.72223], + "69": [0, 0.69444, 0, 0, 0.59722], + "70": [0, 0.69444, 0, 0, 0.56945], + "71": [0, 0.69444, 0, 0, 0.66667], + "72": [0, 0.69444, 0, 0, 0.70834], + "73": [0, 0.69444, 0, 0, 0.27778], + "74": [0, 0.69444, 0, 0, 0.47222], + "75": [0, 0.69444, 0, 0, 0.69445], + "76": [0, 0.69444, 0, 0, 0.54167], + "77": [0, 0.69444, 0, 0, 0.875], + "78": [0, 0.69444, 0, 0, 0.70834], + "79": [0, 0.69444, 0, 0, 0.73611], + "80": [0, 0.69444, 0, 0, 0.63889], + "81": [0.125, 0.69444, 0, 0, 0.73611], + "82": [0, 0.69444, 0, 0, 0.64584], + "83": [0, 0.69444, 0, 0, 0.55556], + "84": [0, 0.69444, 0, 0, 0.68056], + "85": [0, 0.69444, 0, 0, 0.6875], + "86": [0, 0.69444, 0.01389, 0, 0.66667], + "87": [0, 0.69444, 0.01389, 0, 0.94445], + "88": [0, 0.69444, 0, 0, 0.66667], + "89": [0, 0.69444, 0.025, 0, 0.66667], + "90": [0, 0.69444, 0, 0, 0.61111], + "91": [0.25, 0.75, 0, 0, 0.28889], + "93": [0.25, 0.75, 0, 0, 0.28889], + "94": [0, 0.69444, 0, 0, 0.5], + "95": [0.35, 0.09444, 0.02778, 0, 0.5], + "97": [0, 0.44444, 0, 0, 0.48056], + "98": [0, 0.69444, 0, 0, 0.51667], + "99": [0, 0.44444, 0, 0, 0.44445], + "100": [0, 0.69444, 0, 0, 0.51667], + "101": [0, 0.44444, 0, 0, 0.44445], + "102": [0, 0.69444, 0.06944, 0, 0.30556], + "103": [0.19444, 0.44444, 0.01389, 0, 0.5], + "104": [0, 0.69444, 0, 0, 0.51667], + "105": [0, 0.67937, 0, 0, 0.23889], + "106": [0.19444, 0.67937, 0, 0, 0.26667], + "107": [0, 0.69444, 0, 0, 0.48889], + "108": [0, 0.69444, 0, 0, 0.23889], + "109": [0, 0.44444, 0, 0, 0.79445], + "110": [0, 0.44444, 0, 0, 0.51667], + "111": [0, 0.44444, 0, 0, 0.5], + "112": [0.19444, 0.44444, 0, 0, 0.51667], + "113": [0.19444, 0.44444, 0, 0, 0.51667], + "114": [0, 0.44444, 0.01389, 0, 0.34167], + "115": [0, 0.44444, 0, 0, 0.38333], + "116": [0, 0.57143, 0, 0, 0.36111], + "117": [0, 0.44444, 0, 0, 0.51667], + "118": [0, 0.44444, 0.01389, 0, 0.46111], + "119": [0, 0.44444, 0.01389, 0, 0.68334], + "120": [0, 0.44444, 0, 0, 0.46111], + "121": [0.19444, 0.44444, 0.01389, 0, 0.46111], + "122": [0, 0.44444, 0, 0, 0.43472], + "126": [0.35, 0.32659, 0, 0, 0.5], + "160": [0, 0, 0, 0, 0.25], + "168": [0, 0.67937, 0, 0, 0.5], + "176": [0, 0.69444, 0, 0, 0.66667], + "184": [0.17014, 0, 0, 0, 0.44445], + "305": [0, 0.44444, 0, 0, 0.23889], + "567": [0.19444, 0.44444, 0, 0, 0.26667], + "710": [0, 0.69444, 0, 0, 0.5], + "711": [0, 0.63194, 0, 0, 0.5], + "713": [0, 0.60889, 0, 0, 0.5], + "714": [0, 0.69444, 0, 0, 0.5], + "715": [0, 0.69444, 0, 0, 0.5], + "728": [0, 0.69444, 0, 0, 0.5], + "729": [0, 0.67937, 0, 0, 0.27778], + "730": [0, 0.69444, 0, 0, 0.66667], + "732": [0, 0.67659, 0, 0, 0.5], + "733": [0, 0.69444, 0, 0, 0.5], + "915": [0, 0.69444, 0, 0, 0.54167], + "916": [0, 0.69444, 0, 0, 0.83334], + "920": [0, 0.69444, 0, 0, 0.77778], + "923": [0, 0.69444, 0, 0, 0.61111], + "926": [0, 0.69444, 0, 0, 0.66667], + "928": [0, 0.69444, 0, 0, 0.70834], + "931": [0, 0.69444, 0, 0, 0.72222], + "933": [0, 0.69444, 0, 0, 0.77778], + "934": [0, 0.69444, 0, 0, 0.72222], + "936": [0, 0.69444, 0, 0, 0.77778], + "937": [0, 0.69444, 0, 0, 0.72222], + "8211": [0, 0.44444, 0.02778, 0, 0.5], + "8212": [0, 0.44444, 0.02778, 0, 1], + "8216": [0, 0.69444, 0, 0, 0.27778], + "8217": [0, 0.69444, 0, 0, 0.27778], + "8220": [0, 0.69444, 0, 0, 0.5], + "8221": [0, 0.69444, 0, 0, 0.5] + }, + "Script-Regular": { + "32": [0, 0, 0, 0, 0.25], + "65": [0, 0.7, 0.22925, 0, 0.80253], + "66": [0, 0.7, 0.04087, 0, 0.90757], + "67": [0, 0.7, 0.1689, 0, 0.66619], + "68": [0, 0.7, 0.09371, 0, 0.77443], + "69": [0, 0.7, 0.18583, 0, 0.56162], + "70": [0, 0.7, 0.13634, 0, 0.89544], + "71": [0, 0.7, 0.17322, 0, 0.60961], + "72": [0, 0.7, 0.29694, 0, 0.96919], + "73": [0, 0.7, 0.19189, 0, 0.80907], + "74": [0.27778, 0.7, 0.19189, 0, 1.05159], + "75": [0, 0.7, 0.31259, 0, 0.91364], + "76": [0, 0.7, 0.19189, 0, 0.87373], + "77": [0, 0.7, 0.15981, 0, 1.08031], + "78": [0, 0.7, 0.3525, 0, 0.9015], + "79": [0, 0.7, 0.08078, 0, 0.73787], + "80": [0, 0.7, 0.08078, 0, 1.01262], + "81": [0, 0.7, 0.03305, 0, 0.88282], + "82": [0, 0.7, 0.06259, 0, 0.85], + "83": [0, 0.7, 0.19189, 0, 0.86767], + "84": [0, 0.7, 0.29087, 0, 0.74697], + "85": [0, 0.7, 0.25815, 0, 0.79996], + "86": [0, 0.7, 0.27523, 0, 0.62204], + "87": [0, 0.7, 0.27523, 0, 0.80532], + "88": [0, 0.7, 0.26006, 0, 0.94445], + "89": [0, 0.7, 0.2939, 0, 0.70961], + "90": [0, 0.7, 0.24037, 0, 0.8212], + "160": [0, 0, 0, 0, 0.25] + }, + "Size1-Regular": { + "32": [0, 0, 0, 0, 0.25], + "40": [0.35001, 0.85, 0, 0, 0.45834], + "41": [0.35001, 0.85, 0, 0, 0.45834], + "47": [0.35001, 0.85, 0, 0, 0.57778], + "91": [0.35001, 0.85, 0, 0, 0.41667], + "92": [0.35001, 0.85, 0, 0, 0.57778], + "93": [0.35001, 0.85, 0, 0, 0.41667], + "123": [0.35001, 0.85, 0, 0, 0.58334], + "125": [0.35001, 0.85, 0, 0, 0.58334], + "160": [0, 0, 0, 0, 0.25], + "710": [0, 0.72222, 0, 0, 0.55556], + "732": [0, 0.72222, 0, 0, 0.55556], + "770": [0, 0.72222, 0, 0, 0.55556], + "771": [0, 0.72222, 0, 0, 0.55556], + "8214": [-99e-5, 0.601, 0, 0, 0.77778], + "8593": [1e-5, 0.6, 0, 0, 0.66667], + "8595": [1e-5, 0.6, 0, 0, 0.66667], + "8657": [1e-5, 0.6, 0, 0, 0.77778], + "8659": [1e-5, 0.6, 0, 0, 0.77778], + "8719": [0.25001, 0.75, 0, 0, 0.94445], + "8720": [0.25001, 0.75, 0, 0, 0.94445], + "8721": [0.25001, 0.75, 0, 0, 1.05556], + "8730": [0.35001, 0.85, 0, 0, 1], + "8739": [-599e-5, 0.606, 0, 0, 0.33333], + "8741": [-599e-5, 0.606, 0, 0, 0.55556], + "8747": [0.30612, 0.805, 0.19445, 0, 0.47222], + "8748": [0.306, 0.805, 0.19445, 0, 0.47222], + "8749": [0.306, 0.805, 0.19445, 0, 0.47222], + "8750": [0.30612, 0.805, 0.19445, 0, 0.47222], + "8896": [0.25001, 0.75, 0, 0, 0.83334], + "8897": [0.25001, 0.75, 0, 0, 0.83334], + "8898": [0.25001, 0.75, 0, 0, 0.83334], + "8899": [0.25001, 0.75, 0, 0, 0.83334], + "8968": [0.35001, 0.85, 0, 0, 0.47222], + "8969": [0.35001, 0.85, 0, 0, 0.47222], + "8970": [0.35001, 0.85, 0, 0, 0.47222], + "8971": [0.35001, 0.85, 0, 0, 0.47222], + "9168": [-99e-5, 0.601, 0, 0, 0.66667], + "10216": [0.35001, 0.85, 0, 0, 0.47222], + "10217": [0.35001, 0.85, 0, 0, 0.47222], + "10752": [0.25001, 0.75, 0, 0, 1.11111], + "10753": [0.25001, 0.75, 0, 0, 1.11111], + "10754": [0.25001, 0.75, 0, 0, 1.11111], + "10756": [0.25001, 0.75, 0, 0, 0.83334], + "10758": [0.25001, 0.75, 0, 0, 0.83334] + }, + "Size2-Regular": { + "32": [0, 0, 0, 0, 0.25], + "40": [0.65002, 1.15, 0, 0, 0.59722], + "41": [0.65002, 1.15, 0, 0, 0.59722], + "47": [0.65002, 1.15, 0, 0, 0.81111], + "91": [0.65002, 1.15, 0, 0, 0.47222], + "92": [0.65002, 1.15, 0, 0, 0.81111], + "93": [0.65002, 1.15, 0, 0, 0.47222], + "123": [0.65002, 1.15, 0, 0, 0.66667], + "125": [0.65002, 1.15, 0, 0, 0.66667], + "160": [0, 0, 0, 0, 0.25], + "710": [0, 0.75, 0, 0, 1], + "732": [0, 0.75, 0, 0, 1], + "770": [0, 0.75, 0, 0, 1], + "771": [0, 0.75, 0, 0, 1], + "8719": [0.55001, 1.05, 0, 0, 1.27778], + "8720": [0.55001, 1.05, 0, 0, 1.27778], + "8721": [0.55001, 1.05, 0, 0, 1.44445], + "8730": [0.65002, 1.15, 0, 0, 1], + "8747": [0.86225, 1.36, 0.44445, 0, 0.55556], + "8748": [0.862, 1.36, 0.44445, 0, 0.55556], + "8749": [0.862, 1.36, 0.44445, 0, 0.55556], + "8750": [0.86225, 1.36, 0.44445, 0, 0.55556], + "8896": [0.55001, 1.05, 0, 0, 1.11111], + "8897": [0.55001, 1.05, 0, 0, 1.11111], + "8898": [0.55001, 1.05, 0, 0, 1.11111], + "8899": [0.55001, 1.05, 0, 0, 1.11111], + "8968": [0.65002, 1.15, 0, 0, 0.52778], + "8969": [0.65002, 1.15, 0, 0, 0.52778], + "8970": [0.65002, 1.15, 0, 0, 0.52778], + "8971": [0.65002, 1.15, 0, 0, 0.52778], + "10216": [0.65002, 1.15, 0, 0, 0.61111], + "10217": [0.65002, 1.15, 0, 0, 0.61111], + "10752": [0.55001, 1.05, 0, 0, 1.51112], + "10753": [0.55001, 1.05, 0, 0, 1.51112], + "10754": [0.55001, 1.05, 0, 0, 1.51112], + "10756": [0.55001, 1.05, 0, 0, 1.11111], + "10758": [0.55001, 1.05, 0, 0, 1.11111] + }, + "Size3-Regular": { + "32": [0, 0, 0, 0, 0.25], + "40": [0.95003, 1.45, 0, 0, 0.73611], + "41": [0.95003, 1.45, 0, 0, 0.73611], + "47": [0.95003, 1.45, 0, 0, 1.04445], + "91": [0.95003, 1.45, 0, 0, 0.52778], + "92": [0.95003, 1.45, 0, 0, 1.04445], + "93": [0.95003, 1.45, 0, 0, 0.52778], + "123": [0.95003, 1.45, 0, 0, 0.75], + "125": [0.95003, 1.45, 0, 0, 0.75], + "160": [0, 0, 0, 0, 0.25], + "710": [0, 0.75, 0, 0, 1.44445], + "732": [0, 0.75, 0, 0, 1.44445], + "770": [0, 0.75, 0, 0, 1.44445], + "771": [0, 0.75, 0, 0, 1.44445], + "8730": [0.95003, 1.45, 0, 0, 1], + "8968": [0.95003, 1.45, 0, 0, 0.58334], + "8969": [0.95003, 1.45, 0, 0, 0.58334], + "8970": [0.95003, 1.45, 0, 0, 0.58334], + "8971": [0.95003, 1.45, 0, 0, 0.58334], + "10216": [0.95003, 1.45, 0, 0, 0.75], + "10217": [0.95003, 1.45, 0, 0, 0.75] + }, + "Size4-Regular": { + "32": [0, 0, 0, 0, 0.25], + "40": [1.25003, 1.75, 0, 0, 0.79167], + "41": [1.25003, 1.75, 0, 0, 0.79167], + "47": [1.25003, 1.75, 0, 0, 1.27778], + "91": [1.25003, 1.75, 0, 0, 0.58334], + "92": [1.25003, 1.75, 0, 0, 1.27778], + "93": [1.25003, 1.75, 0, 0, 0.58334], + "123": [1.25003, 1.75, 0, 0, 0.80556], + "125": [1.25003, 1.75, 0, 0, 0.80556], + "160": [0, 0, 0, 0, 0.25], + "710": [0, 0.825, 0, 0, 1.8889], + "732": [0, 0.825, 0, 0, 1.8889], + "770": [0, 0.825, 0, 0, 1.8889], + "771": [0, 0.825, 0, 0, 1.8889], + "8730": [1.25003, 1.75, 0, 0, 1], + "8968": [1.25003, 1.75, 0, 0, 0.63889], + "8969": [1.25003, 1.75, 0, 0, 0.63889], + "8970": [1.25003, 1.75, 0, 0, 0.63889], + "8971": [1.25003, 1.75, 0, 0, 0.63889], + "9115": [0.64502, 1.155, 0, 0, 0.875], + "9116": [1e-5, 0.6, 0, 0, 0.875], + "9117": [0.64502, 1.155, 0, 0, 0.875], + "9118": [0.64502, 1.155, 0, 0, 0.875], + "9119": [1e-5, 0.6, 0, 0, 0.875], + "9120": [0.64502, 1.155, 0, 0, 0.875], + "9121": [0.64502, 1.155, 0, 0, 0.66667], + "9122": [-99e-5, 0.601, 0, 0, 0.66667], + "9123": [0.64502, 1.155, 0, 0, 0.66667], + "9124": [0.64502, 1.155, 0, 0, 0.66667], + "9125": [-99e-5, 0.601, 0, 0, 0.66667], + "9126": [0.64502, 1.155, 0, 0, 0.66667], + "9127": [1e-5, 0.9, 0, 0, 0.88889], + "9128": [0.65002, 1.15, 0, 0, 0.88889], + "9129": [0.90001, 0, 0, 0, 0.88889], + "9130": [0, 0.3, 0, 0, 0.88889], + "9131": [1e-5, 0.9, 0, 0, 0.88889], + "9132": [0.65002, 1.15, 0, 0, 0.88889], + "9133": [0.90001, 0, 0, 0, 0.88889], + "9143": [0.88502, 0.915, 0, 0, 1.05556], + "10216": [1.25003, 1.75, 0, 0, 0.80556], + "10217": [1.25003, 1.75, 0, 0, 0.80556], + "57344": [-499e-5, 0.605, 0, 0, 1.05556], + "57345": [-499e-5, 0.605, 0, 0, 1.05556], + "57680": [0, 0.12, 0, 0, 0.45], + "57681": [0, 0.12, 0, 0, 0.45], + "57682": [0, 0.12, 0, 0, 0.45], + "57683": [0, 0.12, 0, 0, 0.45] + }, + "Typewriter-Regular": { + "32": [0, 0, 0, 0, 0.525], + "33": [0, 0.61111, 0, 0, 0.525], + "34": [0, 0.61111, 0, 0, 0.525], + "35": [0, 0.61111, 0, 0, 0.525], + "36": [0.08333, 0.69444, 0, 0, 0.525], + "37": [0.08333, 0.69444, 0, 0, 0.525], + "38": [0, 0.61111, 0, 0, 0.525], + "39": [0, 0.61111, 0, 0, 0.525], + "40": [0.08333, 0.69444, 0, 0, 0.525], + "41": [0.08333, 0.69444, 0, 0, 0.525], + "42": [0, 0.52083, 0, 0, 0.525], + "43": [-0.08056, 0.53055, 0, 0, 0.525], + "44": [0.13889, 0.125, 0, 0, 0.525], + "45": [-0.08056, 0.53055, 0, 0, 0.525], + "46": [0, 0.125, 0, 0, 0.525], + "47": [0.08333, 0.69444, 0, 0, 0.525], + "48": [0, 0.61111, 0, 0, 0.525], + "49": [0, 0.61111, 0, 0, 0.525], + "50": [0, 0.61111, 0, 0, 0.525], + "51": [0, 0.61111, 0, 0, 0.525], + "52": [0, 0.61111, 0, 0, 0.525], + "53": [0, 0.61111, 0, 0, 0.525], + "54": [0, 0.61111, 0, 0, 0.525], + "55": [0, 0.61111, 0, 0, 0.525], + "56": [0, 0.61111, 0, 0, 0.525], + "57": [0, 0.61111, 0, 0, 0.525], + "58": [0, 0.43056, 0, 0, 0.525], + "59": [0.13889, 0.43056, 0, 0, 0.525], + "60": [-0.05556, 0.55556, 0, 0, 0.525], + "61": [-0.19549, 0.41562, 0, 0, 0.525], + "62": [-0.05556, 0.55556, 0, 0, 0.525], + "63": [0, 0.61111, 0, 0, 0.525], + "64": [0, 0.61111, 0, 0, 0.525], + "65": [0, 0.61111, 0, 0, 0.525], + "66": [0, 0.61111, 0, 0, 0.525], + "67": [0, 0.61111, 0, 0, 0.525], + "68": [0, 0.61111, 0, 0, 0.525], + "69": [0, 0.61111, 0, 0, 0.525], + "70": [0, 0.61111, 0, 0, 0.525], + "71": [0, 0.61111, 0, 0, 0.525], + "72": [0, 0.61111, 0, 0, 0.525], + "73": [0, 0.61111, 0, 0, 0.525], + "74": [0, 0.61111, 0, 0, 0.525], + "75": [0, 0.61111, 0, 0, 0.525], + "76": [0, 0.61111, 0, 0, 0.525], + "77": [0, 0.61111, 0, 0, 0.525], + "78": [0, 0.61111, 0, 0, 0.525], + "79": [0, 0.61111, 0, 0, 0.525], + "80": [0, 0.61111, 0, 0, 0.525], + "81": [0.13889, 0.61111, 0, 0, 0.525], + "82": [0, 0.61111, 0, 0, 0.525], + "83": [0, 0.61111, 0, 0, 0.525], + "84": [0, 0.61111, 0, 0, 0.525], + "85": [0, 0.61111, 0, 0, 0.525], + "86": [0, 0.61111, 0, 0, 0.525], + "87": [0, 0.61111, 0, 0, 0.525], + "88": [0, 0.61111, 0, 0, 0.525], + "89": [0, 0.61111, 0, 0, 0.525], + "90": [0, 0.61111, 0, 0, 0.525], + "91": [0.08333, 0.69444, 0, 0, 0.525], + "92": [0.08333, 0.69444, 0, 0, 0.525], + "93": [0.08333, 0.69444, 0, 0, 0.525], + "94": [0, 0.61111, 0, 0, 0.525], + "95": [0.09514, 0, 0, 0, 0.525], + "96": [0, 0.61111, 0, 0, 0.525], + "97": [0, 0.43056, 0, 0, 0.525], + "98": [0, 0.61111, 0, 0, 0.525], + "99": [0, 0.43056, 0, 0, 0.525], + "100": [0, 0.61111, 0, 0, 0.525], + "101": [0, 0.43056, 0, 0, 0.525], + "102": [0, 0.61111, 0, 0, 0.525], + "103": [0.22222, 0.43056, 0, 0, 0.525], + "104": [0, 0.61111, 0, 0, 0.525], + "105": [0, 0.61111, 0, 0, 0.525], + "106": [0.22222, 0.61111, 0, 0, 0.525], + "107": [0, 0.61111, 0, 0, 0.525], + "108": [0, 0.61111, 0, 0, 0.525], + "109": [0, 0.43056, 0, 0, 0.525], + "110": [0, 0.43056, 0, 0, 0.525], + "111": [0, 0.43056, 0, 0, 0.525], + "112": [0.22222, 0.43056, 0, 0, 0.525], + "113": [0.22222, 0.43056, 0, 0, 0.525], + "114": [0, 0.43056, 0, 0, 0.525], + "115": [0, 0.43056, 0, 0, 0.525], + "116": [0, 0.55358, 0, 0, 0.525], + "117": [0, 0.43056, 0, 0, 0.525], + "118": [0, 0.43056, 0, 0, 0.525], + "119": [0, 0.43056, 0, 0, 0.525], + "120": [0, 0.43056, 0, 0, 0.525], + "121": [0.22222, 0.43056, 0, 0, 0.525], + "122": [0, 0.43056, 0, 0, 0.525], + "123": [0.08333, 0.69444, 0, 0, 0.525], + "124": [0.08333, 0.69444, 0, 0, 0.525], + "125": [0.08333, 0.69444, 0, 0, 0.525], + "126": [0, 0.61111, 0, 0, 0.525], + "127": [0, 0.61111, 0, 0, 0.525], + "160": [0, 0, 0, 0, 0.525], + "176": [0, 0.61111, 0, 0, 0.525], + "184": [0.19445, 0, 0, 0, 0.525], + "305": [0, 0.43056, 0, 0, 0.525], + "567": [0.22222, 0.43056, 0, 0, 0.525], + "711": [0, 0.56597, 0, 0, 0.525], + "713": [0, 0.56555, 0, 0, 0.525], + "714": [0, 0.61111, 0, 0, 0.525], + "715": [0, 0.61111, 0, 0, 0.525], + "728": [0, 0.61111, 0, 0, 0.525], + "730": [0, 0.61111, 0, 0, 0.525], + "770": [0, 0.61111, 0, 0, 0.525], + "771": [0, 0.61111, 0, 0, 0.525], + "776": [0, 0.61111, 0, 0, 0.525], + "915": [0, 0.61111, 0, 0, 0.525], + "916": [0, 0.61111, 0, 0, 0.525], + "920": [0, 0.61111, 0, 0, 0.525], + "923": [0, 0.61111, 0, 0, 0.525], + "926": [0, 0.61111, 0, 0, 0.525], + "928": [0, 0.61111, 0, 0, 0.525], + "931": [0, 0.61111, 0, 0, 0.525], + "933": [0, 0.61111, 0, 0, 0.525], + "934": [0, 0.61111, 0, 0, 0.525], + "936": [0, 0.61111, 0, 0, 0.525], + "937": [0, 0.61111, 0, 0, 0.525], + "8216": [0, 0.61111, 0, 0, 0.525], + "8217": [0, 0.61111, 0, 0, 0.525], + "8242": [0, 0.61111, 0, 0, 0.525], + "9251": [0.11111, 0.21944, 0, 0, 0.525] + } + }; + sigmasAndXis = { + slant: [0.25, 0.25, 0.25], + // sigma1 + space: [0, 0, 0], + // sigma2 + stretch: [0, 0, 0], + // sigma3 + shrink: [0, 0, 0], + // sigma4 + xHeight: [0.431, 0.431, 0.431], + // sigma5 + quad: [1, 1.171, 1.472], + // sigma6 + extraSpace: [0, 0, 0], + // sigma7 + num1: [0.677, 0.732, 0.925], + // sigma8 + num2: [0.394, 0.384, 0.387], + // sigma9 + num3: [0.444, 0.471, 0.504], + // sigma10 + denom1: [0.686, 0.752, 1.025], + // sigma11 + denom2: [0.345, 0.344, 0.532], + // sigma12 + sup1: [0.413, 0.503, 0.504], + // sigma13 + sup2: [0.363, 0.431, 0.404], + // sigma14 + sup3: [0.289, 0.286, 0.294], + // sigma15 + sub1: [0.15, 0.143, 0.2], + // sigma16 + sub2: [0.247, 0.286, 0.4], + // sigma17 + supDrop: [0.386, 0.353, 0.494], + // sigma18 + subDrop: [0.05, 0.071, 0.1], + // sigma19 + delim1: [2.39, 1.7, 1.98], + // sigma20 + delim2: [1.01, 1.157, 1.42], + // sigma21 + axisHeight: [0.25, 0.25, 0.25], + // sigma22 + // These font metrics are extracted from TeX by using tftopl on cmex10.tfm; + // they correspond to the font parameters of the extension fonts (family 3). + // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to + // match cmex7, we'd use cmex7.tfm values for script and scriptscript + // values. + defaultRuleThickness: [0.04, 0.049, 0.049], + // xi8; cmex7: 0.049 + bigOpSpacing1: [0.111, 0.111, 0.111], + // xi9 + bigOpSpacing2: [0.166, 0.166, 0.166], + // xi10 + bigOpSpacing3: [0.2, 0.2, 0.2], + // xi11 + bigOpSpacing4: [0.6, 0.611, 0.611], + // xi12; cmex7: 0.611 + bigOpSpacing5: [0.1, 0.143, 0.143], + // xi13; cmex7: 0.143 + // The \sqrt rule width is taken from the height of the surd character. + // Since we use the same font at all sizes, this thickness doesn't scale. + sqrtRuleThickness: [0.04, 0.04, 0.04], + // This value determines how large a pt is, for metrics which are defined + // in terms of pts. + // This value is also used in katex.scss; if you change it make sure the + // values match. + ptPerEm: [10, 10, 10], + // The space between adjacent `|` columns in an array definition. From + // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm. + doubleRuleSep: [0.2, 0.2, 0.2], + // The width of separator lines in {array} environments. From + // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm. + arrayRuleWidth: [0.04, 0.04, 0.04], + // Two values from LaTeX source2e: + fboxsep: [0.3, 0.3, 0.3], + // 3 pt / ptPerEm + fboxrule: [0.04, 0.04, 0.04] + // 0.4 pt / ptPerEm + }; + extraCharacterMap = { + // Latin-1 + "\xC5": "A", + "\xD0": "D", + "\xDE": "o", + "\xE5": "a", + "\xF0": "d", + "\xFE": "o", + // Cyrillic + "\u0410": "A", + "\u0411": "B", + "\u0412": "B", + "\u0413": "F", + "\u0414": "A", + "\u0415": "E", + "\u0416": "K", + "\u0417": "3", + "\u0418": "N", + "\u0419": "N", + "\u041A": "K", + "\u041B": "N", + "\u041C": "M", + "\u041D": "H", + "\u041E": "O", + "\u041F": "N", + "\u0420": "P", + "\u0421": "C", + "\u0422": "T", + "\u0423": "y", + "\u0424": "O", + "\u0425": "X", + "\u0426": "U", + "\u0427": "h", + "\u0428": "W", + "\u0429": "W", + "\u042A": "B", + "\u042B": "X", + "\u042C": "B", + "\u042D": "3", + "\u042E": "X", + "\u042F": "R", + "\u0430": "a", + "\u0431": "b", + "\u0432": "a", + "\u0433": "r", + "\u0434": "y", + "\u0435": "e", + "\u0436": "m", + "\u0437": "e", + "\u0438": "n", + "\u0439": "n", + "\u043A": "n", + "\u043B": "n", + "\u043C": "m", + "\u043D": "n", + "\u043E": "o", + "\u043F": "n", + "\u0440": "p", + "\u0441": "c", + "\u0442": "o", + "\u0443": "y", + "\u0444": "b", + "\u0445": "x", + "\u0446": "n", + "\u0447": "n", + "\u0448": "w", + "\u0449": "w", + "\u044A": "a", + "\u044B": "m", + "\u044C": "a", + "\u044D": "e", + "\u044E": "m", + "\u044F": "r" + }; + __name(setFontMetrics, "setFontMetrics"); + __name(getCharacterMetrics, "getCharacterMetrics"); + fontMetricsBySizeIndex = {}; + __name(getGlobalMetrics, "getGlobalMetrics"); + sizeStyleMap = [ + // Each element contains [textsize, scriptsize, scriptscriptsize]. + // The size mappings are taken from TeX with \normalsize=10pt. + [1, 1, 1], + // size1: [5, 5, 5] \tiny + [2, 1, 1], + // size2: [6, 5, 5] + [3, 1, 1], + // size3: [7, 5, 5] \scriptsize + [4, 2, 1], + // size4: [8, 6, 5] \footnotesize + [5, 2, 1], + // size5: [9, 6, 5] \small + [6, 3, 1], + // size6: [10, 7, 5] \normalsize + [7, 4, 2], + // size7: [12, 8, 6] \large + [8, 6, 3], + // size8: [14.4, 10, 7] \Large + [9, 7, 6], + // size9: [17.28, 12, 10] \LARGE + [10, 8, 7], + // size10: [20.74, 14.4, 12] \huge + [11, 10, 9] + // size11: [24.88, 20.74, 17.28] \HUGE + ]; + sizeMultipliers = [ + // fontMetrics.js:getGlobalMetrics also uses size indexes, so if + // you change size indexes, change that function. + 0.5, + 0.6, + 0.7, + 0.8, + 0.9, + 1, + 1.2, + 1.44, + 1.728, + 2.074, + 2.488 + ]; + sizeAtStyle = /* @__PURE__ */ __name(function sizeAtStyle2(size4, style3) { + return style3.size < 2 ? size4 : sizeStyleMap[size4 - 1][style3.size - 1]; + }, "sizeAtStyle"); + Options = class _Options { + static { + __name(this, "Options"); + } + // A font family applies to a group of fonts (i.e. SansSerif), while a font + // represents a specific font (i.e. SansSerif Bold). + // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm + /** + * The base size index. + */ + constructor(data5) { + this.style = void 0; + this.color = void 0; + this.size = void 0; + this.textSize = void 0; + this.phantom = void 0; + this.font = void 0; + this.fontFamily = void 0; + this.fontWeight = void 0; + this.fontShape = void 0; + this.sizeMultiplier = void 0; + this.maxSize = void 0; + this.minRuleThickness = void 0; + this._fontMetrics = void 0; + this.style = data5.style; + this.color = data5.color; + this.size = data5.size || _Options.BASESIZE; + this.textSize = data5.textSize || this.size; + this.phantom = !!data5.phantom; + this.font = data5.font || ""; + this.fontFamily = data5.fontFamily || ""; + this.fontWeight = data5.fontWeight || ""; + this.fontShape = data5.fontShape || ""; + this.sizeMultiplier = sizeMultipliers[this.size - 1]; + this.maxSize = data5.maxSize; + this.minRuleThickness = data5.minRuleThickness; + this._fontMetrics = void 0; + } + /** + * Returns a new options object with the same properties as "this". Properties + * from "extension" will be copied to the new options object. + */ + extend(extension5) { + var data5 = { + style: this.style, + size: this.size, + textSize: this.textSize, + color: this.color, + phantom: this.phantom, + font: this.font, + fontFamily: this.fontFamily, + fontWeight: this.fontWeight, + fontShape: this.fontShape, + maxSize: this.maxSize, + minRuleThickness: this.minRuleThickness + }; + for (var key in extension5) { + if (extension5.hasOwnProperty(key)) { + data5[key] = extension5[key]; + } + } + return new _Options(data5); + } + /** + * Return an options object with the given style. If `this.style === style`, + * returns `this`. + */ + havingStyle(style3) { + if (this.style === style3) { + return this; + } else { + return this.extend({ + style: style3, + size: sizeAtStyle(this.textSize, style3) + }); + } + } + /** + * Return an options object with a cramped version of the current style. If + * the current style is cramped, returns `this`. + */ + havingCrampedStyle() { + return this.havingStyle(this.style.cramp()); + } + /** + * Return an options object with the given size and in at least `\textstyle`. + * Returns `this` if appropriate. + */ + havingSize(size4) { + if (this.size === size4 && this.textSize === size4) { + return this; + } else { + return this.extend({ + style: this.style.text(), + size: size4, + textSize: size4, + sizeMultiplier: sizeMultipliers[size4 - 1] + }); + } + } + /** + * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted, + * changes to at least `\textstyle`. + */ + havingBaseStyle(style3) { + style3 = style3 || this.style.text(); + var wantSize = sizeAtStyle(_Options.BASESIZE, style3); + if (this.size === wantSize && this.textSize === _Options.BASESIZE && this.style === style3) { + return this; + } else { + return this.extend({ + style: style3, + size: wantSize + }); + } + } + /** + * Remove the effect of sizing changes such as \Huge. + * Keep the effect of the current style, such as \scriptstyle. + */ + havingBaseSizing() { + var size4; + switch (this.style.id) { + case 4: + case 5: + size4 = 3; + break; + case 6: + case 7: + size4 = 1; + break; + default: + size4 = 6; + } + return this.extend({ + style: this.style.text(), + size: size4 + }); + } + /** + * Create a new options object with the given color. + */ + withColor(color2) { + return this.extend({ + color: color2 + }); + } + /** + * Create a new options object with "phantom" set to true. + */ + withPhantom() { + return this.extend({ + phantom: true + }); + } + /** + * Creates a new options object with the given math font or old text font. + * @type {[type]} + */ + withFont(font) { + return this.extend({ + font + }); + } + /** + * Create a new options objects with the given fontFamily. + */ + withTextFontFamily(fontFamily) { + return this.extend({ + fontFamily, + font: "" + }); + } + /** + * Creates a new options object with the given font weight + */ + withTextFontWeight(fontWeight) { + return this.extend({ + fontWeight, + font: "" + }); + } + /** + * Creates a new options object with the given font weight + */ + withTextFontShape(fontShape) { + return this.extend({ + fontShape, + font: "" + }); + } + /** + * Return the CSS sizing classes required to switch from enclosing options + * `oldOptions` to `this`. Returns an array of classes. + */ + sizingClasses(oldOptions) { + if (oldOptions.size !== this.size) { + return ["sizing", "reset-size" + oldOptions.size, "size" + this.size]; + } else { + return []; + } + } + /** + * Return the CSS sizing classes required to switch to the base size. Like + * `this.havingSize(BASESIZE).sizingClasses(this)`. + */ + baseSizingClasses() { + if (this.size !== _Options.BASESIZE) { + return ["sizing", "reset-size" + this.size, "size" + _Options.BASESIZE]; + } else { + return []; + } + } + /** + * Return the font metrics for this size. + */ + fontMetrics() { + if (!this._fontMetrics) { + this._fontMetrics = getGlobalMetrics(this.size); + } + return this._fontMetrics; + } + /** + * Gets the CSS color of the current options object + */ + getColor() { + if (this.phantom) { + return "transparent"; + } else { + return this.color; + } + } + }; + Options.BASESIZE = 6; + ptPerUnit = { + // https://en.wikibooks.org/wiki/LaTeX/Lengths and + // https://tex.stackexchange.com/a/8263 + "pt": 1, + // TeX point + "mm": 7227 / 2540, + // millimeter + "cm": 7227 / 254, + // centimeter + "in": 72.27, + // inch + "bp": 803 / 800, + // big (PostScript) points + "pc": 12, + // pica + "dd": 1238 / 1157, + // didot + "cc": 14856 / 1157, + // cicero (12 didot) + "nd": 685 / 642, + // new didot + "nc": 1370 / 107, + // new cicero (12 new didot) + "sp": 1 / 65536, + // scaled point (TeX's internal smallest unit) + // https://tex.stackexchange.com/a/41371 + "px": 803 / 800 + // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX + }; + relativeUnit = { + "ex": true, + "em": true, + "mu": true + }; + validUnit = /* @__PURE__ */ __name(function validUnit2(unit2) { + if (typeof unit2 !== "string") { + unit2 = unit2.unit; + } + return unit2 in ptPerUnit || unit2 in relativeUnit || unit2 === "ex"; + }, "validUnit"); + calculateSize2 = /* @__PURE__ */ __name(function calculateSize3(sizeValue, options2) { + var scale3; + if (sizeValue.unit in ptPerUnit) { + scale3 = ptPerUnit[sizeValue.unit] / options2.fontMetrics().ptPerEm / options2.sizeMultiplier; + } else if (sizeValue.unit === "mu") { + scale3 = options2.fontMetrics().cssEmPerMu; + } else { + var unitOptions; + if (options2.style.isTight()) { + unitOptions = options2.havingStyle(options2.style.text()); + } else { + unitOptions = options2; + } + if (sizeValue.unit === "ex") { + scale3 = unitOptions.fontMetrics().xHeight; + } else if (sizeValue.unit === "em") { + scale3 = unitOptions.fontMetrics().quad; + } else { + throw new ParseError("Invalid unit: '" + sizeValue.unit + "'"); + } + if (unitOptions !== options2) { + scale3 *= unitOptions.sizeMultiplier / options2.sizeMultiplier; + } + } + return Math.min(sizeValue.number * scale3, options2.maxSize); + }, "calculateSize"); + makeEm = /* @__PURE__ */ __name(function makeEm2(n2) { + return +n2.toFixed(4) + "em"; + }, "makeEm"); + createClass = /* @__PURE__ */ __name(function createClass2(classes3) { + return classes3.filter((cls) => cls).join(" "); + }, "createClass"); + initNode = /* @__PURE__ */ __name(function initNode2(classes3, options2, style3) { + this.classes = classes3 || []; + this.attributes = {}; + this.height = 0; + this.depth = 0; + this.maxFontSize = 0; + this.style = style3 || {}; + if (options2) { + if (options2.style.isTight()) { + this.classes.push("mtight"); + } + var color2 = options2.getColor(); + if (color2) { + this.style.color = color2; + } + } + }, "initNode"); + toNode = /* @__PURE__ */ __name(function toNode2(tagName) { + var node2 = document.createElement(tagName); + node2.className = createClass(this.classes); + for (var style3 in this.style) { + if (this.style.hasOwnProperty(style3)) { + node2.style[style3] = this.style[style3]; + } + } + for (var attr in this.attributes) { + if (this.attributes.hasOwnProperty(attr)) { + node2.setAttribute(attr, this.attributes[attr]); + } + } + for (var i2 = 0; i2 < this.children.length; i2++) { + node2.appendChild(this.children[i2].toNode()); + } + return node2; + }, "toNode"); + invalidAttributeNameRegex = /[\s"'>/=\x00-\x1f]/; + toMarkup = /* @__PURE__ */ __name(function toMarkup2(tagName) { + var markup = "<" + tagName; + if (this.classes.length) { + markup += ' class="' + utils.escape(createClass(this.classes)) + '"'; + } + var styles6 = ""; + for (var style3 in this.style) { + if (this.style.hasOwnProperty(style3)) { + styles6 += utils.hyphenate(style3) + ":" + this.style[style3] + ";"; + } + } + if (styles6) { + markup += ' style="' + utils.escape(styles6) + '"'; + } + for (var attr in this.attributes) { + if (this.attributes.hasOwnProperty(attr)) { + if (invalidAttributeNameRegex.test(attr)) { + throw new ParseError("Invalid attribute name '" + attr + "'"); + } + markup += " " + attr + '="' + utils.escape(this.attributes[attr]) + '"'; + } + } + markup += ">"; + for (var i2 = 0; i2 < this.children.length; i2++) { + markup += this.children[i2].toMarkup(); + } + markup += ""; + return markup; + }, "toMarkup"); + Span = class { + static { + __name(this, "Span"); + } + constructor(classes3, children2, options2, style3) { + this.children = void 0; + this.attributes = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.width = void 0; + this.maxFontSize = void 0; + this.style = void 0; + initNode.call(this, classes3, options2, style3); + this.children = children2 || []; + } + /** + * Sets an arbitrary attribute on the span. Warning: use this wisely. Not + * all browsers support attributes the same, and having too many custom + * attributes is probably bad. + */ + setAttribute(attribute, value2) { + this.attributes[attribute] = value2; + } + hasClass(className) { + return this.classes.includes(className); + } + toNode() { + return toNode.call(this, "span"); + } + toMarkup() { + return toMarkup.call(this, "span"); + } + }; + Anchor = class { + static { + __name(this, "Anchor"); + } + constructor(href, classes3, children2, options2) { + this.children = void 0; + this.attributes = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + initNode.call(this, classes3, options2); + this.children = children2 || []; + this.setAttribute("href", href); + } + setAttribute(attribute, value2) { + this.attributes[attribute] = value2; + } + hasClass(className) { + return this.classes.includes(className); + } + toNode() { + return toNode.call(this, "a"); + } + toMarkup() { + return toMarkup.call(this, "a"); + } + }; + Img = class { + static { + __name(this, "Img"); + } + constructor(src, alt, style3) { + this.src = void 0; + this.alt = void 0; + this.classes = void 0; + this.height = void 0; + this.depth = void 0; + this.maxFontSize = void 0; + this.style = void 0; + this.alt = alt; + this.src = src; + this.classes = ["mord"]; + this.style = style3; + } + hasClass(className) { + return this.classes.includes(className); + } + toNode() { + var node2 = document.createElement("img"); + node2.src = this.src; + node2.alt = this.alt; + node2.className = "mord"; + for (var style3 in this.style) { + if (this.style.hasOwnProperty(style3)) { + node2.style[style3] = this.style[style3]; + } + } + return node2; + } + toMarkup() { + var markup = '' + utils.escape(this.alt) + ' 0) { + span = document.createElement("span"); + span.style.marginRight = makeEm(this.italic); + } + if (this.classes.length > 0) { + span = span || document.createElement("span"); + span.className = createClass(this.classes); + } + for (var style3 in this.style) { + if (this.style.hasOwnProperty(style3)) { + span = span || document.createElement("span"); + span.style[style3] = this.style[style3]; + } + } + if (span) { + span.appendChild(node2); + return span; + } else { + return node2; + } + } + /** + * Creates markup for a symbol node. + */ + toMarkup() { + var needsSpan = false; + var markup = " 0) { + styles6 += "margin-right:" + this.italic + "em;"; + } + for (var style3 in this.style) { + if (this.style.hasOwnProperty(style3)) { + styles6 += utils.hyphenate(style3) + ":" + this.style[style3] + ";"; + } + } + if (styles6) { + needsSpan = true; + markup += ' style="' + utils.escape(styles6) + '"'; + } + var escaped = utils.escape(this.text); + if (needsSpan) { + markup += ">"; + markup += escaped; + markup += ""; + return markup; + } else { + return escaped; + } + } + }; + SvgNode = class { + static { + __name(this, "SvgNode"); + } + constructor(children2, attributes) { + this.children = void 0; + this.attributes = void 0; + this.children = children2 || []; + this.attributes = attributes || {}; + } + toNode() { + var svgNS = "http://www.w3.org/2000/svg"; + var node2 = document.createElementNS(svgNS, "svg"); + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node2.setAttribute(attr, this.attributes[attr]); + } + } + for (var i2 = 0; i2 < this.children.length; i2++) { + node2.appendChild(this.children[i2].toNode()); + } + return node2; + } + toMarkup() { + var markup = ''; + } else { + return ''; + } + } + }; + LineNode = class { + static { + __name(this, "LineNode"); + } + constructor(attributes) { + this.attributes = void 0; + this.attributes = attributes || {}; + } + toNode() { + var svgNS = "http://www.w3.org/2000/svg"; + var node2 = document.createElementNS(svgNS, "line"); + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node2.setAttribute(attr, this.attributes[attr]); + } + } + return node2; + } + toMarkup() { + var markup = "", "\\gt", true); + defineSymbol(math, main, rel, "\u2208", "\\in", true); + defineSymbol(math, main, rel, "\uE020", "\\@not"); + defineSymbol(math, main, rel, "\u2282", "\\subset", true); + defineSymbol(math, main, rel, "\u2283", "\\supset", true); + defineSymbol(math, main, rel, "\u2286", "\\subseteq", true); + defineSymbol(math, main, rel, "\u2287", "\\supseteq", true); + defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true); + defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true); + defineSymbol(math, main, rel, "\u22A8", "\\models"); + defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true); + defineSymbol(math, main, rel, "\u2264", "\\le"); + defineSymbol(math, main, rel, "\u2264", "\\leq", true); + defineSymbol(math, main, rel, "<", "\\lt", true); + defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true); + defineSymbol(math, main, rel, "\u2192", "\\to"); + defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true); + defineSymbol(math, ams, rel, "\u2270", "\\nleq", true); + defineSymbol(math, main, spacing, "\xA0", "\\ "); + defineSymbol(math, main, spacing, "\xA0", "\\space"); + defineSymbol(math, main, spacing, "\xA0", "\\nobreakspace"); + defineSymbol(text2, main, spacing, "\xA0", "\\ "); + defineSymbol(text2, main, spacing, "\xA0", " "); + defineSymbol(text2, main, spacing, "\xA0", "\\space"); + defineSymbol(text2, main, spacing, "\xA0", "\\nobreakspace"); + defineSymbol(math, main, spacing, null, "\\nobreak"); + defineSymbol(math, main, spacing, null, "\\allowbreak"); + defineSymbol(math, main, punct, ",", ","); + defineSymbol(math, main, punct, ";", ";"); + defineSymbol(math, ams, bin, "\u22BC", "\\barwedge", true); + defineSymbol(math, ams, bin, "\u22BB", "\\veebar", true); + defineSymbol(math, main, bin, "\u2299", "\\odot", true); + defineSymbol(math, main, bin, "\u2295", "\\oplus", true); + defineSymbol(math, main, bin, "\u2297", "\\otimes", true); + defineSymbol(math, main, textord, "\u2202", "\\partial", true); + defineSymbol(math, main, bin, "\u2298", "\\oslash", true); + defineSymbol(math, ams, bin, "\u229A", "\\circledcirc", true); + defineSymbol(math, ams, bin, "\u22A1", "\\boxdot", true); + defineSymbol(math, main, bin, "\u25B3", "\\bigtriangleup"); + defineSymbol(math, main, bin, "\u25BD", "\\bigtriangledown"); + defineSymbol(math, main, bin, "\u2020", "\\dagger"); + defineSymbol(math, main, bin, "\u22C4", "\\diamond"); + defineSymbol(math, main, bin, "\u22C6", "\\star"); + defineSymbol(math, main, bin, "\u25C3", "\\triangleleft"); + defineSymbol(math, main, bin, "\u25B9", "\\triangleright"); + defineSymbol(math, main, open, "{", "\\{"); + defineSymbol(text2, main, textord, "{", "\\{"); + defineSymbol(text2, main, textord, "{", "\\textbraceleft"); + defineSymbol(math, main, close, "}", "\\}"); + defineSymbol(text2, main, textord, "}", "\\}"); + defineSymbol(text2, main, textord, "}", "\\textbraceright"); + defineSymbol(math, main, open, "{", "\\lbrace"); + defineSymbol(math, main, close, "}", "\\rbrace"); + defineSymbol(math, main, open, "[", "\\lbrack", true); + defineSymbol(text2, main, textord, "[", "\\lbrack", true); + defineSymbol(math, main, close, "]", "\\rbrack", true); + defineSymbol(text2, main, textord, "]", "\\rbrack", true); + defineSymbol(math, main, open, "(", "\\lparen", true); + defineSymbol(math, main, close, ")", "\\rparen", true); + defineSymbol(text2, main, textord, "<", "\\textless", true); + defineSymbol(text2, main, textord, ">", "\\textgreater", true); + defineSymbol(math, main, open, "\u230A", "\\lfloor", true); + defineSymbol(math, main, close, "\u230B", "\\rfloor", true); + defineSymbol(math, main, open, "\u2308", "\\lceil", true); + defineSymbol(math, main, close, "\u2309", "\\rceil", true); + defineSymbol(math, main, textord, "\\", "\\backslash"); + defineSymbol(math, main, textord, "\u2223", "|"); + defineSymbol(math, main, textord, "\u2223", "\\vert"); + defineSymbol(text2, main, textord, "|", "\\textbar", true); + defineSymbol(math, main, textord, "\u2225", "\\|"); + defineSymbol(math, main, textord, "\u2225", "\\Vert"); + defineSymbol(text2, main, textord, "\u2225", "\\textbardbl"); + defineSymbol(text2, main, textord, "~", "\\textasciitilde"); + defineSymbol(text2, main, textord, "\\", "\\textbackslash"); + defineSymbol(text2, main, textord, "^", "\\textasciicircum"); + defineSymbol(math, main, rel, "\u2191", "\\uparrow", true); + defineSymbol(math, main, rel, "\u21D1", "\\Uparrow", true); + defineSymbol(math, main, rel, "\u2193", "\\downarrow", true); + defineSymbol(math, main, rel, "\u21D3", "\\Downarrow", true); + defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true); + defineSymbol(math, main, rel, "\u21D5", "\\Updownarrow", true); + defineSymbol(math, main, op, "\u2210", "\\coprod"); + defineSymbol(math, main, op, "\u22C1", "\\bigvee"); + defineSymbol(math, main, op, "\u22C0", "\\bigwedge"); + defineSymbol(math, main, op, "\u2A04", "\\biguplus"); + defineSymbol(math, main, op, "\u22C2", "\\bigcap"); + defineSymbol(math, main, op, "\u22C3", "\\bigcup"); + defineSymbol(math, main, op, "\u222B", "\\int"); + defineSymbol(math, main, op, "\u222B", "\\intop"); + defineSymbol(math, main, op, "\u222C", "\\iint"); + defineSymbol(math, main, op, "\u222D", "\\iiint"); + defineSymbol(math, main, op, "\u220F", "\\prod"); + defineSymbol(math, main, op, "\u2211", "\\sum"); + defineSymbol(math, main, op, "\u2A02", "\\bigotimes"); + defineSymbol(math, main, op, "\u2A01", "\\bigoplus"); + defineSymbol(math, main, op, "\u2A00", "\\bigodot"); + defineSymbol(math, main, op, "\u222E", "\\oint"); + defineSymbol(math, main, op, "\u222F", "\\oiint"); + defineSymbol(math, main, op, "\u2230", "\\oiiint"); + defineSymbol(math, main, op, "\u2A06", "\\bigsqcup"); + defineSymbol(math, main, op, "\u222B", "\\smallint"); + defineSymbol(text2, main, inner, "\u2026", "\\textellipsis"); + defineSymbol(math, main, inner, "\u2026", "\\mathellipsis"); + defineSymbol(text2, main, inner, "\u2026", "\\ldots", true); + defineSymbol(math, main, inner, "\u2026", "\\ldots", true); + defineSymbol(math, main, inner, "\u22EF", "\\@cdots", true); + defineSymbol(math, main, inner, "\u22F1", "\\ddots", true); + defineSymbol(math, main, textord, "\u22EE", "\\varvdots"); + defineSymbol(text2, main, textord, "\u22EE", "\\varvdots"); + defineSymbol(math, main, accent, "\u02CA", "\\acute"); + defineSymbol(math, main, accent, "\u02CB", "\\grave"); + defineSymbol(math, main, accent, "\xA8", "\\ddot"); + defineSymbol(math, main, accent, "~", "\\tilde"); + defineSymbol(math, main, accent, "\u02C9", "\\bar"); + defineSymbol(math, main, accent, "\u02D8", "\\breve"); + defineSymbol(math, main, accent, "\u02C7", "\\check"); + defineSymbol(math, main, accent, "^", "\\hat"); + defineSymbol(math, main, accent, "\u20D7", "\\vec"); + defineSymbol(math, main, accent, "\u02D9", "\\dot"); + defineSymbol(math, main, accent, "\u02DA", "\\mathring"); + defineSymbol(math, main, mathord, "\uE131", "\\@imath"); + defineSymbol(math, main, mathord, "\uE237", "\\@jmath"); + defineSymbol(math, main, textord, "\u0131", "\u0131"); + defineSymbol(math, main, textord, "\u0237", "\u0237"); + defineSymbol(text2, main, textord, "\u0131", "\\i", true); + defineSymbol(text2, main, textord, "\u0237", "\\j", true); + defineSymbol(text2, main, textord, "\xDF", "\\ss", true); + defineSymbol(text2, main, textord, "\xE6", "\\ae", true); + defineSymbol(text2, main, textord, "\u0153", "\\oe", true); + defineSymbol(text2, main, textord, "\xF8", "\\o", true); + defineSymbol(text2, main, textord, "\xC6", "\\AE", true); + defineSymbol(text2, main, textord, "\u0152", "\\OE", true); + defineSymbol(text2, main, textord, "\xD8", "\\O", true); + defineSymbol(text2, main, accent, "\u02CA", "\\'"); + defineSymbol(text2, main, accent, "\u02CB", "\\`"); + defineSymbol(text2, main, accent, "\u02C6", "\\^"); + defineSymbol(text2, main, accent, "\u02DC", "\\~"); + defineSymbol(text2, main, accent, "\u02C9", "\\="); + defineSymbol(text2, main, accent, "\u02D8", "\\u"); + defineSymbol(text2, main, accent, "\u02D9", "\\."); + defineSymbol(text2, main, accent, "\xB8", "\\c"); + defineSymbol(text2, main, accent, "\u02DA", "\\r"); + defineSymbol(text2, main, accent, "\u02C7", "\\v"); + defineSymbol(text2, main, accent, "\xA8", '\\"'); + defineSymbol(text2, main, accent, "\u02DD", "\\H"); + defineSymbol(text2, main, accent, "\u25EF", "\\textcircled"); + ligatures = { + "--": true, + "---": true, + "``": true, + "''": true + }; + defineSymbol(text2, main, textord, "\u2013", "--", true); + defineSymbol(text2, main, textord, "\u2013", "\\textendash"); + defineSymbol(text2, main, textord, "\u2014", "---", true); + defineSymbol(text2, main, textord, "\u2014", "\\textemdash"); + defineSymbol(text2, main, textord, "\u2018", "`", true); + defineSymbol(text2, main, textord, "\u2018", "\\textquoteleft"); + defineSymbol(text2, main, textord, "\u2019", "'", true); + defineSymbol(text2, main, textord, "\u2019", "\\textquoteright"); + defineSymbol(text2, main, textord, "\u201C", "``", true); + defineSymbol(text2, main, textord, "\u201C", "\\textquotedblleft"); + defineSymbol(text2, main, textord, "\u201D", "''", true); + defineSymbol(text2, main, textord, "\u201D", "\\textquotedblright"); + defineSymbol(math, main, textord, "\xB0", "\\degree", true); + defineSymbol(text2, main, textord, "\xB0", "\\degree"); + defineSymbol(text2, main, textord, "\xB0", "\\textdegree", true); + defineSymbol(math, main, textord, "\xA3", "\\pounds"); + defineSymbol(math, main, textord, "\xA3", "\\mathsterling", true); + defineSymbol(text2, main, textord, "\xA3", "\\pounds"); + defineSymbol(text2, main, textord, "\xA3", "\\textsterling", true); + defineSymbol(math, ams, textord, "\u2720", "\\maltese"); + defineSymbol(text2, ams, textord, "\u2720", "\\maltese"); + mathTextSymbols = '0123456789/@."'; + for (i2 = 0; i2 < mathTextSymbols.length; i2++) { + ch = mathTextSymbols.charAt(i2); + defineSymbol(math, main, textord, ch, ch); + } + textSymbols = '0123456789!@*()-=+";:?/.,'; + for (_i = 0; _i < textSymbols.length; _i++) { + _ch = textSymbols.charAt(_i); + defineSymbol(text2, main, textord, _ch, _ch); + } + letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + for (_i2 = 0; _i2 < letters.length; _i2++) { + _ch2 = letters.charAt(_i2); + defineSymbol(math, main, mathord, _ch2, _ch2); + defineSymbol(text2, main, textord, _ch2, _ch2); + } + defineSymbol(math, ams, textord, "C", "\u2102"); + defineSymbol(text2, ams, textord, "C", "\u2102"); + defineSymbol(math, ams, textord, "H", "\u210D"); + defineSymbol(text2, ams, textord, "H", "\u210D"); + defineSymbol(math, ams, textord, "N", "\u2115"); + defineSymbol(text2, ams, textord, "N", "\u2115"); + defineSymbol(math, ams, textord, "P", "\u2119"); + defineSymbol(text2, ams, textord, "P", "\u2119"); + defineSymbol(math, ams, textord, "Q", "\u211A"); + defineSymbol(text2, ams, textord, "Q", "\u211A"); + defineSymbol(math, ams, textord, "R", "\u211D"); + defineSymbol(text2, ams, textord, "R", "\u211D"); + defineSymbol(math, ams, textord, "Z", "\u2124"); + defineSymbol(text2, ams, textord, "Z", "\u2124"); + defineSymbol(math, main, mathord, "h", "\u210E"); + defineSymbol(text2, main, mathord, "h", "\u210E"); + wideChar = ""; + for (_i3 = 0; _i3 < letters.length; _i3++) { + _ch3 = letters.charAt(_i3); + wideChar = String.fromCharCode(55349, 56320 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56372 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56424 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56580 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56684 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56736 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56788 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56840 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56944 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + if (_i3 < 26) { + wideChar = String.fromCharCode(55349, 56632 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + wideChar = String.fromCharCode(55349, 56476 + _i3); + defineSymbol(math, main, mathord, _ch3, wideChar); + defineSymbol(text2, main, textord, _ch3, wideChar); + } + } + wideChar = String.fromCharCode(55349, 56668); + defineSymbol(math, main, mathord, "k", wideChar); + defineSymbol(text2, main, textord, "k", wideChar); + for (_i4 = 0; _i4 < 10; _i4++) { + _ch4 = _i4.toString(); + wideChar = String.fromCharCode(55349, 57294 + _i4); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text2, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(55349, 57314 + _i4); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text2, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(55349, 57324 + _i4); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text2, main, textord, _ch4, wideChar); + wideChar = String.fromCharCode(55349, 57334 + _i4); + defineSymbol(math, main, mathord, _ch4, wideChar); + defineSymbol(text2, main, textord, _ch4, wideChar); + } + extraLatin = "\xD0\xDE\xFE"; + for (_i5 = 0; _i5 < extraLatin.length; _i5++) { + _ch5 = extraLatin.charAt(_i5); + defineSymbol(math, main, mathord, _ch5, _ch5); + defineSymbol(text2, main, textord, _ch5, _ch5); + } + wideLatinLetterData = [ + ["mathbf", "textbf", "Main-Bold"], + // A-Z bold upright + ["mathbf", "textbf", "Main-Bold"], + // a-z bold upright + ["mathnormal", "textit", "Math-Italic"], + // A-Z italic + ["mathnormal", "textit", "Math-Italic"], + // a-z italic + ["boldsymbol", "boldsymbol", "Main-BoldItalic"], + // A-Z bold italic + ["boldsymbol", "boldsymbol", "Main-BoldItalic"], + // a-z bold italic + // Map fancy A-Z letters to script, not calligraphic. + // This aligns with unicode-math and math fonts (except Cambria Math). + ["mathscr", "textscr", "Script-Regular"], + // A-Z script + ["", "", ""], + // a-z script. No font + ["", "", ""], + // A-Z bold script. No font + ["", "", ""], + // a-z bold script. No font + ["mathfrak", "textfrak", "Fraktur-Regular"], + // A-Z Fraktur + ["mathfrak", "textfrak", "Fraktur-Regular"], + // a-z Fraktur + ["mathbb", "textbb", "AMS-Regular"], + // A-Z double-struck + ["mathbb", "textbb", "AMS-Regular"], + // k double-struck + // Note that we are using a bold font, but font metrics for regular Fraktur. + ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], + // A-Z bold Fraktur + ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], + // a-z bold Fraktur + ["mathsf", "textsf", "SansSerif-Regular"], + // A-Z sans-serif + ["mathsf", "textsf", "SansSerif-Regular"], + // a-z sans-serif + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + // A-Z bold sans-serif + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + // a-z bold sans-serif + ["mathitsf", "textitsf", "SansSerif-Italic"], + // A-Z italic sans-serif + ["mathitsf", "textitsf", "SansSerif-Italic"], + // a-z italic sans-serif + ["", "", ""], + // A-Z bold italic sans. No font + ["", "", ""], + // a-z bold italic sans. No font + ["mathtt", "texttt", "Typewriter-Regular"], + // A-Z monospace + ["mathtt", "texttt", "Typewriter-Regular"] + // a-z monospace + ]; + wideNumeralData = [ + ["mathbf", "textbf", "Main-Bold"], + // 0-9 bold + ["", "", ""], + // 0-9 double-struck. No KaTeX font. + ["mathsf", "textsf", "SansSerif-Regular"], + // 0-9 sans-serif + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + // 0-9 bold sans-serif + ["mathtt", "texttt", "Typewriter-Regular"] + // 0-9 monospace + ]; + wideCharacterFont = /* @__PURE__ */ __name(function wideCharacterFont2(wideChar2, mode) { + var H2 = wideChar2.charCodeAt(0); + var L3 = wideChar2.charCodeAt(1); + var codePoint = (H2 - 55296) * 1024 + (L3 - 56320) + 65536; + var j3 = mode === "math" ? 0 : 1; + if (119808 <= codePoint && codePoint < 120484) { + var i2 = Math.floor((codePoint - 119808) / 26); + return [wideLatinLetterData[i2][2], wideLatinLetterData[i2][j3]]; + } else if (120782 <= codePoint && codePoint <= 120831) { + var _i = Math.floor((codePoint - 120782) / 10); + return [wideNumeralData[_i][2], wideNumeralData[_i][j3]]; + } else if (codePoint === 120485 || codePoint === 120486) { + return [wideLatinLetterData[0][2], wideLatinLetterData[0][j3]]; + } else if (120486 < codePoint && codePoint < 120782) { + return ["", ""]; + } else { + throw new ParseError("Unsupported character: " + wideChar2); + } + }, "wideCharacterFont"); + lookupSymbol = /* @__PURE__ */ __name(function lookupSymbol2(value2, fontName, mode) { + if (symbols[mode][value2] && symbols[mode][value2].replace) { + value2 = symbols[mode][value2].replace; + } + return { + value: value2, + metrics: getCharacterMetrics(value2, fontName, mode) + }; + }, "lookupSymbol"); + makeSymbol = /* @__PURE__ */ __name(function makeSymbol2(value2, fontName, mode, options2, classes3) { + var lookup2 = lookupSymbol(value2, fontName, mode); + var metrics = lookup2.metrics; + value2 = lookup2.value; + var symbolNode; + if (metrics) { + var italic = metrics.italic; + if (mode === "text" || options2 && options2.font === "mathit") { + italic = 0; + } + symbolNode = new SymbolNode(value2, metrics.height, metrics.depth, italic, metrics.skew, metrics.width, classes3); + } else { + typeof console !== "undefined" && console.warn("No character metrics " + ("for '" + value2 + "' in style '" + fontName + "' and mode '" + mode + "'")); + symbolNode = new SymbolNode(value2, 0, 0, 0, 0, 0, classes3); + } + if (options2) { + symbolNode.maxFontSize = options2.sizeMultiplier; + if (options2.style.isTight()) { + symbolNode.classes.push("mtight"); + } + var color2 = options2.getColor(); + if (color2) { + symbolNode.style.color = color2; + } + } + return symbolNode; + }, "makeSymbol"); + mathsym = /* @__PURE__ */ __name(function mathsym2(value2, mode, options2, classes3) { + if (classes3 === void 0) { + classes3 = []; + } + if (options2.font === "boldsymbol" && lookupSymbol(value2, "Main-Bold", mode).metrics) { + return makeSymbol(value2, "Main-Bold", mode, options2, classes3.concat(["mathbf"])); + } else if (value2 === "\\" || symbols[mode][value2].font === "main") { + return makeSymbol(value2, "Main-Regular", mode, options2, classes3); + } else { + return makeSymbol(value2, "AMS-Regular", mode, options2, classes3.concat(["amsrm"])); + } + }, "mathsym"); + boldsymbol = /* @__PURE__ */ __name(function boldsymbol2(value2, mode, options2, classes3, type3) { + if (type3 !== "textord" && lookupSymbol(value2, "Math-BoldItalic", mode).metrics) { + return { + fontName: "Math-BoldItalic", + fontClass: "boldsymbol" + }; + } else { + return { + fontName: "Main-Bold", + fontClass: "mathbf" + }; + } + }, "boldsymbol"); + makeOrd = /* @__PURE__ */ __name(function makeOrd2(group2, options2, type3) { + var mode = group2.mode; + var text4 = group2.text; + var classes3 = ["mord"]; + var isFont = mode === "math" || mode === "text" && options2.font; + var fontOrFamily = isFont ? options2.font : options2.fontFamily; + var wideFontName = ""; + var wideFontClass = ""; + if (text4.charCodeAt(0) === 55349) { + [wideFontName, wideFontClass] = wideCharacterFont(text4, mode); + } + if (wideFontName.length > 0) { + return makeSymbol(text4, wideFontName, mode, options2, classes3.concat(wideFontClass)); + } else if (fontOrFamily) { + var fontName; + var fontClasses; + if (fontOrFamily === "boldsymbol") { + var fontData = boldsymbol(text4, mode, options2, classes3, type3); + fontName = fontData.fontName; + fontClasses = [fontData.fontClass]; + } else if (isFont) { + fontName = fontMap[fontOrFamily].fontName; + fontClasses = [fontOrFamily]; + } else { + fontName = retrieveTextFontName(fontOrFamily, options2.fontWeight, options2.fontShape); + fontClasses = [fontOrFamily, options2.fontWeight, options2.fontShape]; + } + if (lookupSymbol(text4, fontName, mode).metrics) { + return makeSymbol(text4, fontName, mode, options2, classes3.concat(fontClasses)); + } else if (ligatures.hasOwnProperty(text4) && fontName.slice(0, 10) === "Typewriter") { + var parts = []; + for (var i2 = 0; i2 < text4.length; i2++) { + parts.push(makeSymbol(text4[i2], fontName, mode, options2, classes3.concat(fontClasses))); + } + return makeFragment(parts); + } + } + if (type3 === "mathord") { + return makeSymbol(text4, "Math-Italic", mode, options2, classes3.concat(["mathnormal"])); + } else if (type3 === "textord") { + var font = symbols[mode][text4] && symbols[mode][text4].font; + if (font === "ams") { + var _fontName = retrieveTextFontName("amsrm", options2.fontWeight, options2.fontShape); + return makeSymbol(text4, _fontName, mode, options2, classes3.concat("amsrm", options2.fontWeight, options2.fontShape)); + } else if (font === "main" || !font) { + var _fontName2 = retrieveTextFontName("textrm", options2.fontWeight, options2.fontShape); + return makeSymbol(text4, _fontName2, mode, options2, classes3.concat(options2.fontWeight, options2.fontShape)); + } else { + var _fontName3 = retrieveTextFontName(font, options2.fontWeight, options2.fontShape); + return makeSymbol(text4, _fontName3, mode, options2, classes3.concat(_fontName3, options2.fontWeight, options2.fontShape)); + } + } else { + throw new Error("unexpected type: " + type3 + " in makeOrd"); + } + }, "makeOrd"); + canCombine = /* @__PURE__ */ __name((prev2, next3) => { + if (createClass(prev2.classes) !== createClass(next3.classes) || prev2.skew !== next3.skew || prev2.maxFontSize !== next3.maxFontSize) { + return false; + } + if (prev2.classes.length === 1) { + var cls = prev2.classes[0]; + if (cls === "mbin" || cls === "mord") { + return false; + } + } + for (var style3 in prev2.style) { + if (prev2.style.hasOwnProperty(style3) && prev2.style[style3] !== next3.style[style3]) { + return false; + } + } + for (var _style in next3.style) { + if (next3.style.hasOwnProperty(_style) && prev2.style[_style] !== next3.style[_style]) { + return false; + } + } + return true; + }, "canCombine"); + tryCombineChars = /* @__PURE__ */ __name((chars) => { + for (var i2 = 0; i2 < chars.length - 1; i2++) { + var prev2 = chars[i2]; + var next3 = chars[i2 + 1]; + if (prev2 instanceof SymbolNode && next3 instanceof SymbolNode && canCombine(prev2, next3)) { + prev2.text += next3.text; + prev2.height = Math.max(prev2.height, next3.height); + prev2.depth = Math.max(prev2.depth, next3.depth); + prev2.italic = next3.italic; + chars.splice(i2 + 1, 1); + i2--; + } + } + return chars; + }, "tryCombineChars"); + sizeElementFromChildren = /* @__PURE__ */ __name(function sizeElementFromChildren2(elem) { + var height2 = 0; + var depth = 0; + var maxFontSize = 0; + for (var i2 = 0; i2 < elem.children.length; i2++) { + var child = elem.children[i2]; + if (child.height > height2) { + height2 = child.height; + } + if (child.depth > depth) { + depth = child.depth; + } + if (child.maxFontSize > maxFontSize) { + maxFontSize = child.maxFontSize; + } + } + elem.height = height2; + elem.depth = depth; + elem.maxFontSize = maxFontSize; + }, "sizeElementFromChildren"); + makeSpan$2 = /* @__PURE__ */ __name(function makeSpan(classes3, children2, options2, style3) { + var span = new Span(classes3, children2, options2, style3); + sizeElementFromChildren(span); + return span; + }, "makeSpan"); + makeSvgSpan = /* @__PURE__ */ __name((classes3, children2, options2, style3) => new Span(classes3, children2, options2, style3), "makeSvgSpan"); + makeLineSpan = /* @__PURE__ */ __name(function makeLineSpan2(className, options2, thickness) { + var line2 = makeSpan$2([className], [], options2); + line2.height = Math.max(thickness || options2.fontMetrics().defaultRuleThickness, options2.minRuleThickness); + line2.style.borderBottomWidth = makeEm(line2.height); + line2.maxFontSize = 1; + return line2; + }, "makeLineSpan"); + makeAnchor = /* @__PURE__ */ __name(function makeAnchor2(href, classes3, children2, options2) { + var anchor2 = new Anchor(href, classes3, children2, options2); + sizeElementFromChildren(anchor2); + return anchor2; + }, "makeAnchor"); + makeFragment = /* @__PURE__ */ __name(function makeFragment2(children2) { + var fragment = new DocumentFragment(children2); + sizeElementFromChildren(fragment); + return fragment; + }, "makeFragment"); + wrapFragment = /* @__PURE__ */ __name(function wrapFragment2(group2, options2) { + if (group2 instanceof DocumentFragment) { + return makeSpan$2([], [group2], options2); + } + return group2; + }, "wrapFragment"); + getVListChildrenAndDepth = /* @__PURE__ */ __name(function getVListChildrenAndDepth2(params) { + if (params.positionType === "individualShift") { + var oldChildren = params.children; + var children2 = [oldChildren[0]]; + var _depth = -oldChildren[0].shift - oldChildren[0].elem.depth; + var currPos = _depth; + for (var i2 = 1; i2 < oldChildren.length; i2++) { + var diff2 = -oldChildren[i2].shift - currPos - oldChildren[i2].elem.depth; + var size4 = diff2 - (oldChildren[i2 - 1].elem.height + oldChildren[i2 - 1].elem.depth); + currPos = currPos + diff2; + children2.push({ + type: "kern", + size: size4 + }); + children2.push(oldChildren[i2]); + } + return { + children: children2, + depth: _depth + }; + } + var depth; + if (params.positionType === "top") { + var bottom2 = params.positionData; + for (var _i = 0; _i < params.children.length; _i++) { + var child = params.children[_i]; + bottom2 -= child.type === "kern" ? child.size : child.elem.height + child.elem.depth; + } + depth = bottom2; + } else if (params.positionType === "bottom") { + depth = -params.positionData; + } else { + var firstChild = params.children[0]; + if (firstChild.type !== "elem") { + throw new Error('First child must have type "elem".'); + } + if (params.positionType === "shift") { + depth = -firstChild.elem.depth - params.positionData; + } else if (params.positionType === "firstBaseline") { + depth = -firstChild.elem.depth; + } else { + throw new Error("Invalid positionType " + params.positionType + "."); + } + } + return { + children: params.children, + depth + }; + }, "getVListChildrenAndDepth"); + makeVList = /* @__PURE__ */ __name(function makeVList2(params, options2) { + var { + children: children2, + depth + } = getVListChildrenAndDepth(params); + var pstrutSize = 0; + for (var i2 = 0; i2 < children2.length; i2++) { + var child = children2[i2]; + if (child.type === "elem") { + var elem = child.elem; + pstrutSize = Math.max(pstrutSize, elem.maxFontSize, elem.height); + } + } + pstrutSize += 2; + var pstrut = makeSpan$2(["pstrut"], []); + pstrut.style.height = makeEm(pstrutSize); + var realChildren = []; + var minPos = depth; + var maxPos2 = depth; + var currPos = depth; + for (var _i2 = 0; _i2 < children2.length; _i2++) { + var _child = children2[_i2]; + if (_child.type === "kern") { + currPos += _child.size; + } else { + var _elem = _child.elem; + var classes3 = _child.wrapperClasses || []; + var style3 = _child.wrapperStyle || {}; + var childWrap = makeSpan$2(classes3, [pstrut, _elem], void 0, style3); + childWrap.style.top = makeEm(-pstrutSize - currPos - _elem.depth); + if (_child.marginLeft) { + childWrap.style.marginLeft = _child.marginLeft; + } + if (_child.marginRight) { + childWrap.style.marginRight = _child.marginRight; + } + realChildren.push(childWrap); + currPos += _elem.height + _elem.depth; + } + minPos = Math.min(minPos, currPos); + maxPos2 = Math.max(maxPos2, currPos); + } + var vlist = makeSpan$2(["vlist"], realChildren); + vlist.style.height = makeEm(maxPos2); + var rows; + if (minPos < 0) { + var emptySpan = makeSpan$2([], []); + var depthStrut = makeSpan$2(["vlist"], [emptySpan]); + depthStrut.style.height = makeEm(-minPos); + var topStrut = makeSpan$2(["vlist-s"], [new SymbolNode("\u200B")]); + rows = [makeSpan$2(["vlist-r"], [vlist, topStrut]), makeSpan$2(["vlist-r"], [depthStrut])]; + } else { + rows = [makeSpan$2(["vlist-r"], [vlist])]; + } + var vtable = makeSpan$2(["vlist-t"], rows); + if (rows.length === 2) { + vtable.classes.push("vlist-t2"); + } + vtable.height = maxPos2; + vtable.depth = -minPos; + return vtable; + }, "makeVList"); + makeGlue = /* @__PURE__ */ __name((measurement, options2) => { + var rule = makeSpan$2(["mspace"], [], options2); + var size4 = calculateSize2(measurement, options2); + rule.style.marginRight = makeEm(size4); + return rule; + }, "makeGlue"); + retrieveTextFontName = /* @__PURE__ */ __name(function retrieveTextFontName2(fontFamily, fontWeight, fontShape) { + var baseFontName = ""; + switch (fontFamily) { + case "amsrm": + baseFontName = "AMS"; + break; + case "textrm": + baseFontName = "Main"; + break; + case "textsf": + baseFontName = "SansSerif"; + break; + case "texttt": + baseFontName = "Typewriter"; + break; + default: + baseFontName = fontFamily; + } + var fontStylesName; + if (fontWeight === "textbf" && fontShape === "textit") { + fontStylesName = "BoldItalic"; + } else if (fontWeight === "textbf") { + fontStylesName = "Bold"; + } else if (fontWeight === "textit") { + fontStylesName = "Italic"; + } else { + fontStylesName = "Regular"; + } + return baseFontName + "-" + fontStylesName; + }, "retrieveTextFontName"); + fontMap = { + // styles + "mathbf": { + variant: "bold", + fontName: "Main-Bold" + }, + "mathrm": { + variant: "normal", + fontName: "Main-Regular" + }, + "textit": { + variant: "italic", + fontName: "Main-Italic" + }, + "mathit": { + variant: "italic", + fontName: "Main-Italic" + }, + "mathnormal": { + variant: "italic", + fontName: "Math-Italic" + }, + "mathsfit": { + variant: "sans-serif-italic", + fontName: "SansSerif-Italic" + }, + // "boldsymbol" is missing because they require the use of multiple fonts: + // Math-BoldItalic and Main-Bold. This is handled by a special case in + // makeOrd which ends up calling boldsymbol. + // families + "mathbb": { + variant: "double-struck", + fontName: "AMS-Regular" + }, + "mathcal": { + variant: "script", + fontName: "Caligraphic-Regular" + }, + "mathfrak": { + variant: "fraktur", + fontName: "Fraktur-Regular" + }, + "mathscr": { + variant: "script", + fontName: "Script-Regular" + }, + "mathsf": { + variant: "sans-serif", + fontName: "SansSerif-Regular" + }, + "mathtt": { + variant: "monospace", + fontName: "Typewriter-Regular" + } + }; + svgData = { + // path, width, height + vec: ["vec", 0.471, 0.714], + // values from the font glyph + oiintSize1: ["oiintSize1", 0.957, 0.499], + // oval to overlay the integrand + oiintSize2: ["oiintSize2", 1.472, 0.659], + oiiintSize1: ["oiiintSize1", 1.304, 0.499], + oiiintSize2: ["oiiintSize2", 1.98, 0.659] + }; + staticSvg = /* @__PURE__ */ __name(function staticSvg2(value2, options2) { + var [pathName, width3, height2] = svgData[value2]; + var path4 = new PathNode(pathName); + var svgNode2 = new SvgNode([path4], { + "width": makeEm(width3), + "height": makeEm(height2), + // Override CSS rule `.katex svg { width: 100% }` + "style": "width:" + makeEm(width3), + "viewBox": "0 0 " + 1e3 * width3 + " " + 1e3 * height2, + "preserveAspectRatio": "xMinYMin" + }); + var span = makeSvgSpan(["overlay"], [svgNode2], options2); + span.height = height2; + span.style.height = makeEm(height2); + span.style.width = makeEm(width3); + return span; + }, "staticSvg"); + buildCommon = { + fontMap, + makeSymbol, + mathsym, + makeSpan: makeSpan$2, + makeSvgSpan, + makeLineSpan, + makeAnchor, + makeFragment, + wrapFragment, + makeVList, + makeOrd, + makeGlue, + staticSvg, + svgData, + tryCombineChars + }; + thinspace = { + number: 3, + unit: "mu" + }; + mediumspace = { + number: 4, + unit: "mu" + }; + thickspace = { + number: 5, + unit: "mu" + }; + spacings = { + mord: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace + }, + mop: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + minner: thinspace + }, + mbin: { + mord: mediumspace, + mop: mediumspace, + mopen: mediumspace, + minner: mediumspace + }, + mrel: { + mord: thickspace, + mop: thickspace, + mopen: thickspace, + minner: thickspace + }, + mopen: {}, + mclose: { + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + minner: thinspace + }, + mpunct: { + mord: thinspace, + mop: thinspace, + mrel: thickspace, + mopen: thinspace, + mclose: thinspace, + mpunct: thinspace, + minner: thinspace + }, + minner: { + mord: thinspace, + mop: thinspace, + mbin: mediumspace, + mrel: thickspace, + mopen: thinspace, + mpunct: thinspace, + minner: thinspace + } + }; + tightSpacings = { + mord: { + mop: thinspace + }, + mop: { + mord: thinspace, + mop: thinspace + }, + mbin: {}, + mrel: {}, + mopen: {}, + mclose: { + mop: thinspace + }, + mpunct: {}, + minner: { + mop: thinspace + } + }; + _functions = {}; + _htmlGroupBuilders = {}; + _mathmlGroupBuilders = {}; + __name(defineFunction, "defineFunction"); + __name(defineFunctionBuilders, "defineFunctionBuilders"); + normalizeArgument = /* @__PURE__ */ __name(function normalizeArgument2(arg) { + return arg.type === "ordgroup" && arg.body.length === 1 ? arg.body[0] : arg; + }, "normalizeArgument"); + ordargument = /* @__PURE__ */ __name(function ordargument2(arg) { + return arg.type === "ordgroup" ? arg.body : [arg]; + }, "ordargument"); + makeSpan$1 = buildCommon.makeSpan; + binLeftCanceller = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"]; + binRightCanceller = ["rightmost", "mrel", "mclose", "mpunct"]; + styleMap$1 = { + "display": Style$1.DISPLAY, + "text": Style$1.TEXT, + "script": Style$1.SCRIPT, + "scriptscript": Style$1.SCRIPTSCRIPT + }; + DomEnum = { + mord: "mord", + mop: "mop", + mbin: "mbin", + mrel: "mrel", + mopen: "mopen", + mclose: "mclose", + mpunct: "mpunct", + minner: "minner" + }; + buildExpression$1 = /* @__PURE__ */ __name(function buildExpression(expression, options2, isRealGroup, surrounding) { + if (surrounding === void 0) { + surrounding = [null, null]; + } + var groups = []; + for (var i2 = 0; i2 < expression.length; i2++) { + var output2 = buildGroup$1(expression[i2], options2); + if (output2 instanceof DocumentFragment) { + var children2 = output2.children; + groups.push(...children2); + } else { + groups.push(output2); + } + } + buildCommon.tryCombineChars(groups); + if (!isRealGroup) { + return groups; + } + var glueOptions = options2; + if (expression.length === 1) { + var node2 = expression[0]; + if (node2.type === "sizing") { + glueOptions = options2.havingSize(node2.size); + } else if (node2.type === "styling") { + glueOptions = options2.havingStyle(styleMap$1[node2.style]); + } + } + var dummyPrev = makeSpan$1([surrounding[0] || "leftmost"], [], options2); + var dummyNext = makeSpan$1([surrounding[1] || "rightmost"], [], options2); + var isRoot = isRealGroup === "root"; + traverseNonSpaceNodes(groups, (node3, prev2) => { + var prevType = prev2.classes[0]; + var type3 = node3.classes[0]; + if (prevType === "mbin" && binRightCanceller.includes(type3)) { + prev2.classes[0] = "mord"; + } else if (type3 === "mbin" && binLeftCanceller.includes(prevType)) { + node3.classes[0] = "mord"; + } + }, { + node: dummyPrev + }, dummyNext, isRoot); + traverseNonSpaceNodes(groups, (node3, prev2) => { + var prevType = getTypeOfDomTree(prev2); + var type3 = getTypeOfDomTree(node3); + var space = prevType && type3 ? node3.hasClass("mtight") ? tightSpacings[prevType][type3] : spacings[prevType][type3] : null; + if (space) { + return buildCommon.makeGlue(space, glueOptions); + } + }, { + node: dummyPrev + }, dummyNext, isRoot); + return groups; + }, "buildExpression"); + traverseNonSpaceNodes = /* @__PURE__ */ __name(function traverseNonSpaceNodes2(nodes5, callback, prev2, next3, isRoot) { + if (next3) { + nodes5.push(next3); + } + var i2 = 0; + for (; i2 < nodes5.length; i2++) { + var node2 = nodes5[i2]; + var partialGroup = checkPartialGroup(node2); + if (partialGroup) { + traverseNonSpaceNodes2(partialGroup.children, callback, prev2, null, isRoot); + continue; + } + var nonspace = !node2.hasClass("mspace"); + if (nonspace) { + var result = callback(node2, prev2.node); + if (result) { + if (prev2.insertAfter) { + prev2.insertAfter(result); + } else { + nodes5.unshift(result); + i2++; + } + } + } + if (nonspace) { + prev2.node = node2; + } else if (isRoot && node2.hasClass("newline")) { + prev2.node = makeSpan$1(["leftmost"]); + } + prev2.insertAfter = /* @__PURE__ */ ((index) => (n2) => { + nodes5.splice(index + 1, 0, n2); + i2++; + })(i2); + } + if (next3) { + nodes5.pop(); + } + }, "traverseNonSpaceNodes"); + checkPartialGroup = /* @__PURE__ */ __name(function checkPartialGroup2(node2) { + if (node2 instanceof DocumentFragment || node2 instanceof Anchor || node2 instanceof Span && node2.hasClass("enclosing")) { + return node2; + } + return null; + }, "checkPartialGroup"); + getOutermostNode = /* @__PURE__ */ __name(function getOutermostNode2(node2, side) { + var partialGroup = checkPartialGroup(node2); + if (partialGroup) { + var children2 = partialGroup.children; + if (children2.length) { + if (side === "right") { + return getOutermostNode2(children2[children2.length - 1], "right"); + } else if (side === "left") { + return getOutermostNode2(children2[0], "left"); + } + } + } + return node2; + }, "getOutermostNode"); + getTypeOfDomTree = /* @__PURE__ */ __name(function getTypeOfDomTree2(node2, side) { + if (!node2) { + return null; + } + if (side) { + node2 = getOutermostNode(node2, side); + } + return DomEnum[node2.classes[0]] || null; + }, "getTypeOfDomTree"); + makeNullDelimiter = /* @__PURE__ */ __name(function makeNullDelimiter2(options2, classes3) { + var moreClasses = ["nulldelimiter"].concat(options2.baseSizingClasses()); + return makeSpan$1(classes3.concat(moreClasses)); + }, "makeNullDelimiter"); + buildGroup$1 = /* @__PURE__ */ __name(function buildGroup(group2, options2, baseOptions) { + if (!group2) { + return makeSpan$1(); + } + if (_htmlGroupBuilders[group2.type]) { + var groupNode = _htmlGroupBuilders[group2.type](group2, options2); + if (baseOptions && options2.size !== baseOptions.size) { + groupNode = makeSpan$1(options2.sizingClasses(baseOptions), [groupNode], options2); + var multiplier = options2.sizeMultiplier / baseOptions.sizeMultiplier; + groupNode.height *= multiplier; + groupNode.depth *= multiplier; + } + return groupNode; + } else { + throw new ParseError("Got group of unknown type: '" + group2.type + "'"); + } + }, "buildGroup"); + __name(buildHTMLUnbreakable, "buildHTMLUnbreakable"); + __name(buildHTML, "buildHTML"); + __name(newDocumentFragment, "newDocumentFragment"); + MathNode = class { + static { + __name(this, "MathNode"); + } + constructor(type3, children2, classes3) { + this.type = void 0; + this.attributes = void 0; + this.children = void 0; + this.classes = void 0; + this.type = type3; + this.attributes = {}; + this.children = children2 || []; + this.classes = classes3 || []; + } + /** + * Sets an attribute on a MathML node. MathML depends on attributes to convey a + * semantic content, so this is used heavily. + */ + setAttribute(name, value2) { + this.attributes[name] = value2; + } + /** + * Gets an attribute on a MathML node. + */ + getAttribute(name) { + return this.attributes[name]; + } + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + toNode() { + var node2 = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + node2.setAttribute(attr, this.attributes[attr]); + } + } + if (this.classes.length > 0) { + node2.className = createClass(this.classes); + } + for (var i2 = 0; i2 < this.children.length; i2++) { + if (this.children[i2] instanceof TextNode && this.children[i2 + 1] instanceof TextNode) { + var text4 = this.children[i2].toText() + this.children[++i2].toText(); + while (this.children[i2 + 1] instanceof TextNode) { + text4 += this.children[++i2].toText(); + } + node2.appendChild(new TextNode(text4).toNode()); + } else { + node2.appendChild(this.children[i2].toNode()); + } + } + return node2; + } + /** + * Converts the math node into an HTML markup string. + */ + toMarkup() { + var markup = "<" + this.type; + for (var attr in this.attributes) { + if (Object.prototype.hasOwnProperty.call(this.attributes, attr)) { + markup += " " + attr + '="'; + markup += utils.escape(this.attributes[attr]); + markup += '"'; + } + } + if (this.classes.length > 0) { + markup += ' class ="' + utils.escape(createClass(this.classes)) + '"'; + } + markup += ">"; + for (var i2 = 0; i2 < this.children.length; i2++) { + markup += this.children[i2].toMarkup(); + } + markup += ""; + return markup; + } + /** + * Converts the math node into a string, similar to innerText, but escaped. + */ + toText() { + return this.children.map((child) => child.toText()).join(""); + } + }; + TextNode = class { + static { + __name(this, "TextNode"); + } + constructor(text4) { + this.text = void 0; + this.text = text4; + } + /** + * Converts the text node into a DOM text node. + */ + toNode() { + return document.createTextNode(this.text); + } + /** + * Converts the text node into escaped HTML markup + * (representing the text itself). + */ + toMarkup() { + return utils.escape(this.toText()); + } + /** + * Converts the text node into a string + * (representing the text itself). + */ + toText() { + return this.text; + } + }; + SpaceNode = class { + static { + __name(this, "SpaceNode"); + } + /** + * Create a Space node with width given in CSS ems. + */ + constructor(width3) { + this.width = void 0; + this.character = void 0; + this.width = width3; + if (width3 >= 0.05555 && width3 <= 0.05556) { + this.character = "\u200A"; + } else if (width3 >= 0.1666 && width3 <= 0.1667) { + this.character = "\u2009"; + } else if (width3 >= 0.2222 && width3 <= 0.2223) { + this.character = "\u2005"; + } else if (width3 >= 0.2777 && width3 <= 0.2778) { + this.character = "\u2005\u200A"; + } else if (width3 >= -0.05556 && width3 <= -0.05555) { + this.character = "\u200A\u2063"; + } else if (width3 >= -0.1667 && width3 <= -0.1666) { + this.character = "\u2009\u2063"; + } else if (width3 >= -0.2223 && width3 <= -0.2222) { + this.character = "\u205F\u2063"; + } else if (width3 >= -0.2778 && width3 <= -0.2777) { + this.character = "\u2005\u2063"; + } else { + this.character = null; + } + } + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + toNode() { + if (this.character) { + return document.createTextNode(this.character); + } else { + var node2 = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); + node2.setAttribute("width", makeEm(this.width)); + return node2; + } + } + /** + * Converts the math node into an HTML markup string. + */ + toMarkup() { + if (this.character) { + return "" + this.character + ""; + } else { + return ''; + } + } + /** + * Converts the math node into a string, similar to innerText. + */ + toText() { + if (this.character) { + return this.character; + } else { + return " "; + } + } + }; + mathMLTree = { + MathNode, + TextNode, + SpaceNode, + newDocumentFragment + }; + makeText = /* @__PURE__ */ __name(function makeText2(text4, mode, options2) { + if (symbols[mode][text4] && symbols[mode][text4].replace && text4.charCodeAt(0) !== 55349 && !(ligatures.hasOwnProperty(text4) && options2 && (options2.fontFamily && options2.fontFamily.slice(4, 6) === "tt" || options2.font && options2.font.slice(4, 6) === "tt"))) { + text4 = symbols[mode][text4].replace; + } + return new mathMLTree.TextNode(text4); + }, "makeText"); + makeRow = /* @__PURE__ */ __name(function makeRow2(body) { + if (body.length === 1) { + return body[0]; + } else { + return new mathMLTree.MathNode("mrow", body); + } + }, "makeRow"); + getVariant = /* @__PURE__ */ __name(function getVariant2(group2, options2) { + if (options2.fontFamily === "texttt") { + return "monospace"; + } else if (options2.fontFamily === "textsf") { + if (options2.fontShape === "textit" && options2.fontWeight === "textbf") { + return "sans-serif-bold-italic"; + } else if (options2.fontShape === "textit") { + return "sans-serif-italic"; + } else if (options2.fontWeight === "textbf") { + return "bold-sans-serif"; + } else { + return "sans-serif"; + } + } else if (options2.fontShape === "textit" && options2.fontWeight === "textbf") { + return "bold-italic"; + } else if (options2.fontShape === "textit") { + return "italic"; + } else if (options2.fontWeight === "textbf") { + return "bold"; + } + var font = options2.font; + if (!font || font === "mathnormal") { + return null; + } + var mode = group2.mode; + if (font === "mathit") { + return "italic"; + } else if (font === "boldsymbol") { + return group2.type === "textord" ? "bold" : "bold-italic"; + } else if (font === "mathbf") { + return "bold"; + } else if (font === "mathbb") { + return "double-struck"; + } else if (font === "mathsfit") { + return "sans-serif-italic"; + } else if (font === "mathfrak") { + return "fraktur"; + } else if (font === "mathscr" || font === "mathcal") { + return "script"; + } else if (font === "mathsf") { + return "sans-serif"; + } else if (font === "mathtt") { + return "monospace"; + } + var text4 = group2.text; + if (["\\imath", "\\jmath"].includes(text4)) { + return null; + } + if (symbols[mode][text4] && symbols[mode][text4].replace) { + text4 = symbols[mode][text4].replace; + } + var fontName = buildCommon.fontMap[font].fontName; + if (getCharacterMetrics(text4, fontName, mode)) { + return buildCommon.fontMap[font].variant; + } + return null; + }, "getVariant"); + __name(isNumberPunctuation, "isNumberPunctuation"); + buildExpression2 = /* @__PURE__ */ __name(function buildExpression3(expression, options2, isOrdgroup) { + if (expression.length === 1) { + var group2 = buildGroup2(expression[0], options2); + if (isOrdgroup && group2 instanceof MathNode && group2.type === "mo") { + group2.setAttribute("lspace", "0em"); + group2.setAttribute("rspace", "0em"); + } + return [group2]; + } + var groups = []; + var lastGroup; + for (var i2 = 0; i2 < expression.length; i2++) { + var _group = buildGroup2(expression[i2], options2); + if (_group instanceof MathNode && lastGroup instanceof MathNode) { + if (_group.type === "mtext" && lastGroup.type === "mtext" && _group.getAttribute("mathvariant") === lastGroup.getAttribute("mathvariant")) { + lastGroup.children.push(..._group.children); + continue; + } else if (_group.type === "mn" && lastGroup.type === "mn") { + lastGroup.children.push(..._group.children); + continue; + } else if (isNumberPunctuation(_group) && lastGroup.type === "mn") { + lastGroup.children.push(..._group.children); + continue; + } else if (_group.type === "mn" && isNumberPunctuation(lastGroup)) { + _group.children = [...lastGroup.children, ..._group.children]; + groups.pop(); + } else if ((_group.type === "msup" || _group.type === "msub") && _group.children.length >= 1 && (lastGroup.type === "mn" || isNumberPunctuation(lastGroup))) { + var base = _group.children[0]; + if (base instanceof MathNode && base.type === "mn") { + base.children = [...lastGroup.children, ...base.children]; + groups.pop(); + } + } else if (lastGroup.type === "mi" && lastGroup.children.length === 1) { + var lastChild = lastGroup.children[0]; + if (lastChild instanceof TextNode && lastChild.text === "\u0338" && (_group.type === "mo" || _group.type === "mi" || _group.type === "mn")) { + var child = _group.children[0]; + if (child instanceof TextNode && child.text.length > 0) { + child.text = child.text.slice(0, 1) + "\u0338" + child.text.slice(1); + groups.pop(); + } + } + } + } + groups.push(_group); + lastGroup = _group; + } + return groups; + }, "buildExpression"); + buildExpressionRow = /* @__PURE__ */ __name(function buildExpressionRow2(expression, options2, isOrdgroup) { + return makeRow(buildExpression2(expression, options2, isOrdgroup)); + }, "buildExpressionRow"); + buildGroup2 = /* @__PURE__ */ __name(function buildGroup3(group2, options2) { + if (!group2) { + return new mathMLTree.MathNode("mrow"); + } + if (_mathmlGroupBuilders[group2.type]) { + var result = _mathmlGroupBuilders[group2.type](group2, options2); + return result; + } else { + throw new ParseError("Got group of unknown type: '" + group2.type + "'"); + } + }, "buildGroup"); + __name(buildMathML, "buildMathML"); + optionsFromSettings = /* @__PURE__ */ __name(function optionsFromSettings2(settings) { + return new Options({ + style: settings.displayMode ? Style$1.DISPLAY : Style$1.TEXT, + maxSize: settings.maxSize, + minRuleThickness: settings.minRuleThickness + }); + }, "optionsFromSettings"); + displayWrap = /* @__PURE__ */ __name(function displayWrap2(node2, settings) { + if (settings.displayMode) { + var classes3 = ["katex-display"]; + if (settings.leqno) { + classes3.push("leqno"); + } + if (settings.fleqn) { + classes3.push("fleqn"); + } + node2 = buildCommon.makeSpan(classes3, [node2]); + } + return node2; + }, "displayWrap"); + buildTree = /* @__PURE__ */ __name(function buildTree2(tree, expression, settings) { + var options2 = optionsFromSettings(settings); + var katexNode; + if (settings.output === "mathml") { + return buildMathML(tree, expression, options2, settings.displayMode, true); + } else if (settings.output === "html") { + var htmlNode = buildHTML(tree, options2); + katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); + } else { + var mathMLNode = buildMathML(tree, expression, options2, settings.displayMode, false); + var _htmlNode = buildHTML(tree, options2); + katexNode = buildCommon.makeSpan(["katex"], [mathMLNode, _htmlNode]); + } + return displayWrap(katexNode, settings); + }, "buildTree"); + buildHTMLTree = /* @__PURE__ */ __name(function buildHTMLTree2(tree, expression, settings) { + var options2 = optionsFromSettings(settings); + var htmlNode = buildHTML(tree, options2); + var katexNode = buildCommon.makeSpan(["katex"], [htmlNode]); + return displayWrap(katexNode, settings); + }, "buildHTMLTree"); + stretchyCodePoint = { + widehat: "^", + widecheck: "\u02C7", + widetilde: "~", + utilde: "~", + overleftarrow: "\u2190", + underleftarrow: "\u2190", + xleftarrow: "\u2190", + overrightarrow: "\u2192", + underrightarrow: "\u2192", + xrightarrow: "\u2192", + underbrace: "\u23DF", + overbrace: "\u23DE", + overgroup: "\u23E0", + undergroup: "\u23E1", + overleftrightarrow: "\u2194", + underleftrightarrow: "\u2194", + xleftrightarrow: "\u2194", + Overrightarrow: "\u21D2", + xRightarrow: "\u21D2", + overleftharpoon: "\u21BC", + xleftharpoonup: "\u21BC", + overrightharpoon: "\u21C0", + xrightharpoonup: "\u21C0", + xLeftarrow: "\u21D0", + xLeftrightarrow: "\u21D4", + xhookleftarrow: "\u21A9", + xhookrightarrow: "\u21AA", + xmapsto: "\u21A6", + xrightharpoondown: "\u21C1", + xleftharpoondown: "\u21BD", + xrightleftharpoons: "\u21CC", + xleftrightharpoons: "\u21CB", + xtwoheadleftarrow: "\u219E", + xtwoheadrightarrow: "\u21A0", + xlongequal: "=", + xtofrom: "\u21C4", + xrightleftarrows: "\u21C4", + xrightequilibrium: "\u21CC", + // Not a perfect match. + xleftequilibrium: "\u21CB", + // None better available. + "\\cdrightarrow": "\u2192", + "\\cdleftarrow": "\u2190", + "\\cdlongequal": "=" + }; + mathMLnode = /* @__PURE__ */ __name(function mathMLnode2(label) { + var node2 = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(stretchyCodePoint[label.replace(/^\\/, "")])]); + node2.setAttribute("stretchy", "true"); + return node2; + }, "mathMLnode"); + katexImagesData = { + // path(s), minWidth, height, align + overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], + "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"], + // CD minwwidth2.5pc + xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], + "\\cdleftarrow": [["leftarrow"], 3, 522, "xMinYMin"], + Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], + xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], + xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], + overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], + overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], + xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], + "\\cdlongequal": [["longequal"], 3, 334, "xMinYMin"], + xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], + xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], + overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], + underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], + underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], + xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], + xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], + xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], + xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], + xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], + overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + overgroup: [["leftgroup", "rightgroup"], 0.888, 342], + undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], + xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], + xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528], + // The next three arrows are from the mhchem package. + // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the + // document as \xrightarrow or \xrightleftharpoons. Those have + // min-length = 1.75em, so we set min-length on these next three to match. + xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], + xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], + xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] + }; + groupLength = /* @__PURE__ */ __name(function groupLength2(arg) { + if (arg.type === "ordgroup") { + return arg.body.length; + } else { + return 1; + } + }, "groupLength"); + svgSpan = /* @__PURE__ */ __name(function svgSpan2(group2, options2) { + function buildSvgSpan_() { + var viewBoxWidth = 4e5; + var label = group2.label.slice(1); + if (["widehat", "widecheck", "widetilde", "utilde"].includes(label)) { + var grp = group2; + var numChars = groupLength(grp.base); + var viewBoxHeight; + var pathName; + var _height; + if (numChars > 5) { + if (label === "widehat" || label === "widecheck") { + viewBoxHeight = 420; + viewBoxWidth = 2364; + _height = 0.42; + pathName = label + "4"; + } else { + viewBoxHeight = 312; + viewBoxWidth = 2340; + _height = 0.34; + pathName = "tilde4"; + } + } else { + var imgIndex = [1, 1, 2, 2, 3, 3][numChars]; + if (label === "widehat" || label === "widecheck") { + viewBoxWidth = [0, 1062, 2364, 2364, 2364][imgIndex]; + viewBoxHeight = [0, 239, 300, 360, 420][imgIndex]; + _height = [0, 0.24, 0.3, 0.3, 0.36, 0.42][imgIndex]; + pathName = label + imgIndex; + } else { + viewBoxWidth = [0, 600, 1033, 2339, 2340][imgIndex]; + viewBoxHeight = [0, 260, 286, 306, 312][imgIndex]; + _height = [0, 0.26, 0.286, 0.3, 0.306, 0.34][imgIndex]; + pathName = "tilde" + imgIndex; + } + } + var path4 = new PathNode(pathName); + var svgNode2 = new SvgNode([path4], { + "width": "100%", + "height": makeEm(_height), + "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight, + "preserveAspectRatio": "none" + }); + return { + span: buildCommon.makeSvgSpan([], [svgNode2], options2), + minWidth: 0, + height: _height + }; + } else { + var spans = []; + var data5 = katexImagesData[label]; + var [paths, _minWidth, _viewBoxHeight] = data5; + var _height2 = _viewBoxHeight / 1e3; + var numSvgChildren = paths.length; + var widthClasses; + var aligns; + if (numSvgChildren === 1) { + var align1 = data5[3]; + widthClasses = ["hide-tail"]; + aligns = [align1]; + } else if (numSvgChildren === 2) { + widthClasses = ["halfarrow-left", "halfarrow-right"]; + aligns = ["xMinYMin", "xMaxYMin"]; + } else if (numSvgChildren === 3) { + widthClasses = ["brace-left", "brace-center", "brace-right"]; + aligns = ["xMinYMin", "xMidYMin", "xMaxYMin"]; + } else { + throw new Error("Correct katexImagesData or update code here to support\n " + numSvgChildren + " children."); + } + for (var i2 = 0; i2 < numSvgChildren; i2++) { + var _path = new PathNode(paths[i2]); + var _svgNode = new SvgNode([_path], { + "width": "400em", + "height": makeEm(_height2), + "viewBox": "0 0 " + viewBoxWidth + " " + _viewBoxHeight, + "preserveAspectRatio": aligns[i2] + " slice" + }); + var _span = buildCommon.makeSvgSpan([widthClasses[i2]], [_svgNode], options2); + if (numSvgChildren === 1) { + return { + span: _span, + minWidth: _minWidth, + height: _height2 + }; + } else { + _span.style.height = makeEm(_height2); + spans.push(_span); + } + } + return { + span: buildCommon.makeSpan(["stretchy"], spans, options2), + minWidth: _minWidth, + height: _height2 + }; + } + } + __name(buildSvgSpan_, "buildSvgSpan_"); + var { + span, + minWidth, + height: height2 + } = buildSvgSpan_(); + span.height = height2; + span.style.height = makeEm(height2); + if (minWidth > 0) { + span.style.minWidth = makeEm(minWidth); + } + return span; + }, "svgSpan"); + encloseSpan = /* @__PURE__ */ __name(function encloseSpan2(inner2, label, topPad, bottomPad, options2) { + var img; + var totalHeight = inner2.height + inner2.depth + topPad + bottomPad; + if (/fbox|color|angl/.test(label)) { + img = buildCommon.makeSpan(["stretchy", label], [], options2); + if (label === "fbox") { + var color2 = options2.color && options2.getColor(); + if (color2) { + img.style.borderColor = color2; + } + } + } else { + var lines = []; + if (/^[bx]cancel$/.test(label)) { + lines.push(new LineNode({ + "x1": "0", + "y1": "0", + "x2": "100%", + "y2": "100%", + "stroke-width": "0.046em" + })); + } + if (/^x?cancel$/.test(label)) { + lines.push(new LineNode({ + "x1": "0", + "y1": "100%", + "x2": "100%", + "y2": "0", + "stroke-width": "0.046em" + })); + } + var svgNode2 = new SvgNode(lines, { + "width": "100%", + "height": makeEm(totalHeight) + }); + img = buildCommon.makeSvgSpan([], [svgNode2], options2); + } + img.height = totalHeight; + img.style.height = makeEm(totalHeight); + return img; + }, "encloseSpan"); + stretchy = { + encloseSpan, + mathMLnode, + svgSpan + }; + __name(assertNodeType, "assertNodeType"); + __name(assertSymbolNodeType, "assertSymbolNodeType"); + __name(checkSymbolNodeType, "checkSymbolNodeType"); + htmlBuilder$a = /* @__PURE__ */ __name((grp, options2) => { + var base; + var group2; + var supSubGroup; + if (grp && grp.type === "supsub") { + group2 = assertNodeType(grp.base, "accent"); + base = group2.base; + grp.base = base; + supSubGroup = assertSpan(buildGroup$1(grp, options2)); + grp.base = group2; + } else { + group2 = assertNodeType(grp, "accent"); + base = group2.base; + } + var body = buildGroup$1(base, options2.havingCrampedStyle()); + var mustShift = group2.isShifty && utils.isCharacterBox(base); + var skew = 0; + if (mustShift) { + var baseChar = utils.getBaseElem(base); + var baseGroup = buildGroup$1(baseChar, options2.havingCrampedStyle()); + skew = assertSymbolDomNode(baseGroup).skew; + } + var accentBelow = group2.label === "\\c"; + var clearance = accentBelow ? body.height + body.depth : Math.min(body.height, options2.fontMetrics().xHeight); + var accentBody; + if (!group2.isStretchy) { + var accent2; + var width3; + if (group2.label === "\\vec") { + accent2 = buildCommon.staticSvg("vec", options2); + width3 = buildCommon.svgData.vec[1]; + } else { + accent2 = buildCommon.makeOrd({ + mode: group2.mode, + text: group2.label + }, options2, "textord"); + accent2 = assertSymbolDomNode(accent2); + accent2.italic = 0; + width3 = accent2.width; + if (accentBelow) { + clearance += accent2.depth; + } + } + accentBody = buildCommon.makeSpan(["accent-body"], [accent2]); + var accentFull = group2.label === "\\textcircled"; + if (accentFull) { + accentBody.classes.push("accent-full"); + clearance = body.height; + } + var left3 = skew; + if (!accentFull) { + left3 -= width3 / 2; + } + accentBody.style.left = makeEm(left3); + if (group2.label === "\\textcircled") { + accentBody.style.top = ".2em"; + } + accentBody = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: body + }, { + type: "kern", + size: -clearance + }, { + type: "elem", + elem: accentBody + }] + }, options2); + } else { + accentBody = stretchy.svgSpan(group2, options2); + accentBody = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: body + }, { + type: "elem", + elem: accentBody, + wrapperClasses: ["svg-align"], + wrapperStyle: skew > 0 ? { + width: "calc(100% - " + makeEm(2 * skew) + ")", + marginLeft: makeEm(2 * skew) + } : void 0 + }] + }, options2); + } + var accentWrap = buildCommon.makeSpan(["mord", "accent"], [accentBody], options2); + if (supSubGroup) { + supSubGroup.children[0] = accentWrap; + supSubGroup.height = Math.max(accentWrap.height, supSubGroup.height); + supSubGroup.classes[0] = "mord"; + return supSubGroup; + } else { + return accentWrap; + } + }, "htmlBuilder$a"); + mathmlBuilder$9 = /* @__PURE__ */ __name((group2, options2) => { + var accentNode = group2.isStretchy ? stretchy.mathMLnode(group2.label) : new mathMLTree.MathNode("mo", [makeText(group2.label, group2.mode)]); + var node2 = new mathMLTree.MathNode("mover", [buildGroup2(group2.base, options2), accentNode]); + node2.setAttribute("accent", "true"); + return node2; + }, "mathmlBuilder$9"); + NON_STRETCHY_ACCENT_REGEX = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map((accent2) => "\\" + accent2).join("|")); + defineFunction({ + type: "accent", + names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], + props: { + numArgs: 1 + }, + handler: /* @__PURE__ */ __name((context, args) => { + var base = normalizeArgument(args[0]); + var isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName); + var isShifty = !isStretchy || context.funcName === "\\widehat" || context.funcName === "\\widetilde" || context.funcName === "\\widecheck"; + return { + type: "accent", + mode: context.parser.mode, + label: context.funcName, + isStretchy, + isShifty, + base + }; + }, "handler"), + htmlBuilder: htmlBuilder$a, + mathmlBuilder: mathmlBuilder$9 + }); + defineFunction({ + type: "accent", + names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"], + props: { + numArgs: 1, + allowedInText: true, + allowedInMath: true, + // unless in strict mode + argTypes: ["primitive"] + }, + handler: /* @__PURE__ */ __name((context, args) => { + var base = args[0]; + var mode = context.parser.mode; + if (mode === "math") { + context.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + context.funcName + " works only in text mode"); + mode = "text"; + } + return { + type: "accent", + mode, + label: context.funcName, + isStretchy: false, + isShifty: true, + base + }; + }, "handler"), + htmlBuilder: htmlBuilder$a, + mathmlBuilder: mathmlBuilder$9 + }); + defineFunction({ + type: "accentUnder", + names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], + props: { + numArgs: 1 + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29, + funcName + } = _ref; + var base = args[0]; + return { + type: "accentUnder", + mode: parser29.mode, + label: funcName, + base + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var innerGroup = buildGroup$1(group2.base, options2); + var accentBody = stretchy.svgSpan(group2, options2); + var kern = group2.label === "\\utilde" ? 0.12 : 0; + var vlist = buildCommon.makeVList({ + positionType: "top", + positionData: innerGroup.height, + children: [{ + type: "elem", + elem: accentBody, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: kern + }, { + type: "elem", + elem: innerGroup + }] + }, options2); + return buildCommon.makeSpan(["mord", "accentunder"], [vlist], options2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var accentNode = stretchy.mathMLnode(group2.label); + var node2 = new mathMLTree.MathNode("munder", [buildGroup2(group2.base, options2), accentNode]); + node2.setAttribute("accentunder", "true"); + return node2; + }, "mathmlBuilder") + }); + paddedNode = /* @__PURE__ */ __name((group2) => { + var node2 = new mathMLTree.MathNode("mpadded", group2 ? [group2] : []); + node2.setAttribute("width", "+0.6em"); + node2.setAttribute("lspace", "0.3em"); + return node2; + }, "paddedNode"); + defineFunction({ + type: "xArrow", + names: [ + "\\xleftarrow", + "\\xrightarrow", + "\\xLeftarrow", + "\\xRightarrow", + "\\xleftrightarrow", + "\\xLeftrightarrow", + "\\xhookleftarrow", + "\\xhookrightarrow", + "\\xmapsto", + "\\xrightharpoondown", + "\\xrightharpoonup", + "\\xleftharpoondown", + "\\xleftharpoonup", + "\\xrightleftharpoons", + "\\xleftrightharpoons", + "\\xlongequal", + "\\xtwoheadrightarrow", + "\\xtwoheadleftarrow", + "\\xtofrom", + // The next 3 functions are here to support the mhchem extension. + // Direct use of these functions is discouraged and may break someday. + "\\xrightleftarrows", + "\\xrightequilibrium", + "\\xleftequilibrium", + // The next 3 functions are here only to support the {CD} environment. + "\\\\cdrightarrow", + "\\\\cdleftarrow", + "\\\\cdlongequal" + ], + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + handler(_ref, args, optArgs) { + var { + parser: parser29, + funcName + } = _ref; + return { + type: "xArrow", + mode: parser29.mode, + label: funcName, + body: args[0], + below: optArgs[0] + }; + }, + // Flow is unable to correctly infer the type of `group`, even though it's + // unambiguously determined from the passed-in `type` above. + htmlBuilder(group2, options2) { + var style3 = options2.style; + var newOptions = options2.havingStyle(style3.sup()); + var upperGroup = buildCommon.wrapFragment(buildGroup$1(group2.body, newOptions, options2), options2); + var arrowPrefix = group2.label.slice(0, 2) === "\\x" ? "x" : "cd"; + upperGroup.classes.push(arrowPrefix + "-arrow-pad"); + var lowerGroup; + if (group2.below) { + newOptions = options2.havingStyle(style3.sub()); + lowerGroup = buildCommon.wrapFragment(buildGroup$1(group2.below, newOptions, options2), options2); + lowerGroup.classes.push(arrowPrefix + "-arrow-pad"); + } + var arrowBody = stretchy.svgSpan(group2, options2); + var arrowShift = -options2.fontMetrics().axisHeight + 0.5 * arrowBody.height; + var upperShift = -options2.fontMetrics().axisHeight - 0.5 * arrowBody.height - 0.111; + if (upperGroup.depth > 0.25 || group2.label === "\\xleftequilibrium") { + upperShift -= upperGroup.depth; + } + var vlist; + if (lowerGroup) { + var lowerShift = -options2.fontMetrics().axisHeight + lowerGroup.height + 0.5 * arrowBody.height + 0.111; + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: upperGroup, + shift: upperShift + }, { + type: "elem", + elem: arrowBody, + shift: arrowShift + }, { + type: "elem", + elem: lowerGroup, + shift: lowerShift + }] + }, options2); + } else { + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: upperGroup, + shift: upperShift + }, { + type: "elem", + elem: arrowBody, + shift: arrowShift + }] + }, options2); + } + vlist.children[0].children[0].children[1].classes.push("svg-align"); + return buildCommon.makeSpan(["mrel", "x-arrow"], [vlist], options2); + }, + mathmlBuilder(group2, options2) { + var arrowNode = stretchy.mathMLnode(group2.label); + arrowNode.setAttribute("minsize", group2.label.charAt(0) === "x" ? "1.75em" : "3.0em"); + var node2; + if (group2.body) { + var upperNode = paddedNode(buildGroup2(group2.body, options2)); + if (group2.below) { + var lowerNode = paddedNode(buildGroup2(group2.below, options2)); + node2 = new mathMLTree.MathNode("munderover", [arrowNode, lowerNode, upperNode]); + } else { + node2 = new mathMLTree.MathNode("mover", [arrowNode, upperNode]); + } + } else if (group2.below) { + var _lowerNode = paddedNode(buildGroup2(group2.below, options2)); + node2 = new mathMLTree.MathNode("munder", [arrowNode, _lowerNode]); + } else { + node2 = paddedNode(); + node2 = new mathMLTree.MathNode("mover", [arrowNode, node2]); + } + return node2; + } + }); + makeSpan2 = buildCommon.makeSpan; + __name(htmlBuilder$9, "htmlBuilder$9"); + __name(mathmlBuilder$8, "mathmlBuilder$8"); + defineFunction({ + type: "mclass", + names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], + props: { + numArgs: 1, + primitive: true + }, + handler(_ref, args) { + var { + parser: parser29, + funcName + } = _ref; + var body = args[0]; + return { + type: "mclass", + mode: parser29.mode, + mclass: "m" + funcName.slice(5), + // TODO(kevinb): don't prefix with 'm' + body: ordargument(body), + isCharacterBox: utils.isCharacterBox(body) + }; + }, + htmlBuilder: htmlBuilder$9, + mathmlBuilder: mathmlBuilder$8 + }); + binrelClass = /* @__PURE__ */ __name((arg) => { + var atom2 = arg.type === "ordgroup" && arg.body.length ? arg.body[0] : arg; + if (atom2.type === "atom" && (atom2.family === "bin" || atom2.family === "rel")) { + return "m" + atom2.family; + } else { + return "mord"; + } + }, "binrelClass"); + defineFunction({ + type: "mclass", + names: ["\\@binrel"], + props: { + numArgs: 2 + }, + handler(_ref2, args) { + var { + parser: parser29 + } = _ref2; + return { + type: "mclass", + mode: parser29.mode, + mclass: binrelClass(args[0]), + body: ordargument(args[1]), + isCharacterBox: utils.isCharacterBox(args[1]) + }; + } + }); + defineFunction({ + type: "mclass", + names: ["\\stackrel", "\\overset", "\\underset"], + props: { + numArgs: 2 + }, + handler(_ref3, args) { + var { + parser: parser29, + funcName + } = _ref3; + var baseArg = args[1]; + var shiftedArg = args[0]; + var mclass; + if (funcName !== "\\stackrel") { + mclass = binrelClass(baseArg); + } else { + mclass = "mrel"; + } + var baseOp = { + type: "op", + mode: baseArg.mode, + limits: true, + alwaysHandleSupSub: true, + parentIsSupSub: false, + symbol: false, + suppressBaseShift: funcName !== "\\stackrel", + body: ordargument(baseArg) + }; + var supsub = { + type: "supsub", + mode: shiftedArg.mode, + base: baseOp, + sup: funcName === "\\underset" ? null : shiftedArg, + sub: funcName === "\\underset" ? shiftedArg : null + }; + return { + type: "mclass", + mode: parser29.mode, + mclass, + body: [supsub], + isCharacterBox: utils.isCharacterBox(supsub) + }; + }, + htmlBuilder: htmlBuilder$9, + mathmlBuilder: mathmlBuilder$8 + }); + defineFunction({ + type: "pmb", + names: ["\\pmb"], + props: { + numArgs: 1, + allowedInText: true + }, + handler(_ref, args) { + var { + parser: parser29 + } = _ref; + return { + type: "pmb", + mode: parser29.mode, + mclass: binrelClass(args[0]), + body: ordargument(args[0]) + }; + }, + htmlBuilder(group2, options2) { + var elements2 = buildExpression$1(group2.body, options2, true); + var node2 = buildCommon.makeSpan([group2.mclass], elements2, options2); + node2.style.textShadow = "0.02em 0.01em 0.04px"; + return node2; + }, + mathmlBuilder(group2, style3) { + var inner2 = buildExpression2(group2.body, style3); + var node2 = new mathMLTree.MathNode("mstyle", inner2); + node2.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px"); + return node2; + } + }); + cdArrowFunctionName = { + ">": "\\\\cdrightarrow", + "<": "\\\\cdleftarrow", + "=": "\\\\cdlongequal", + "A": "\\uparrow", + "V": "\\downarrow", + "|": "\\Vert", + ".": "no arrow" + }; + newCell = /* @__PURE__ */ __name(() => { + return { + type: "styling", + body: [], + mode: "math", + style: "display" + }; + }, "newCell"); + isStartOfArrow = /* @__PURE__ */ __name((node2) => { + return node2.type === "textord" && node2.text === "@"; + }, "isStartOfArrow"); + isLabelEnd = /* @__PURE__ */ __name((node2, endChar) => { + return (node2.type === "mathord" || node2.type === "atom") && node2.text === endChar; + }, "isLabelEnd"); + __name(cdArrow, "cdArrow"); + __name(parseCD, "parseCD"); + defineFunction({ + type: "cdlabel", + names: ["\\\\cdleft", "\\\\cdright"], + props: { + numArgs: 1 + }, + handler(_ref, args) { + var { + parser: parser29, + funcName + } = _ref; + return { + type: "cdlabel", + mode: parser29.mode, + side: funcName.slice(4), + label: args[0] + }; + }, + htmlBuilder(group2, options2) { + var newOptions = options2.havingStyle(options2.style.sup()); + var label = buildCommon.wrapFragment(buildGroup$1(group2.label, newOptions, options2), options2); + label.classes.push("cd-label-" + group2.side); + label.style.bottom = makeEm(0.8 - label.depth); + label.height = 0; + label.depth = 0; + return label; + }, + mathmlBuilder(group2, options2) { + var label = new mathMLTree.MathNode("mrow", [buildGroup2(group2.label, options2)]); + label = new mathMLTree.MathNode("mpadded", [label]); + label.setAttribute("width", "0"); + if (group2.side === "left") { + label.setAttribute("lspace", "-1width"); + } + label.setAttribute("voffset", "0.7em"); + label = new mathMLTree.MathNode("mstyle", [label]); + label.setAttribute("displaystyle", "false"); + label.setAttribute("scriptlevel", "1"); + return label; + } + }); + defineFunction({ + type: "cdlabelparent", + names: ["\\\\cdparent"], + props: { + numArgs: 1 + }, + handler(_ref2, args) { + var { + parser: parser29 + } = _ref2; + return { + type: "cdlabelparent", + mode: parser29.mode, + fragment: args[0] + }; + }, + htmlBuilder(group2, options2) { + var parent4 = buildCommon.wrapFragment(buildGroup$1(group2.fragment, options2), options2); + parent4.classes.push("cd-vert-arrow"); + return parent4; + }, + mathmlBuilder(group2, options2) { + return new mathMLTree.MathNode("mrow", [buildGroup2(group2.fragment, options2)]); + } + }); + defineFunction({ + type: "textord", + names: ["\\@char"], + props: { + numArgs: 1, + allowedInText: true + }, + handler(_ref, args) { + var { + parser: parser29 + } = _ref; + var arg = assertNodeType(args[0], "ordgroup"); + var group2 = arg.body; + var number7 = ""; + for (var i2 = 0; i2 < group2.length; i2++) { + var node2 = assertNodeType(group2[i2], "textord"); + number7 += node2.text; + } + var code = parseInt(number7); + var text4; + if (isNaN(code)) { + throw new ParseError("\\@char has non-numeric argument " + number7); + } else if (code < 0 || code >= 1114111) { + throw new ParseError("\\@char with invalid code point " + number7); + } else if (code <= 65535) { + text4 = String.fromCharCode(code); + } else { + code -= 65536; + text4 = String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320); + } + return { + type: "textord", + mode: parser29.mode, + text: text4 + }; + } + }); + htmlBuilder$8 = /* @__PURE__ */ __name((group2, options2) => { + var elements2 = buildExpression$1(group2.body, options2.withColor(group2.color), false); + return buildCommon.makeFragment(elements2); + }, "htmlBuilder$8"); + mathmlBuilder$7 = /* @__PURE__ */ __name((group2, options2) => { + var inner2 = buildExpression2(group2.body, options2.withColor(group2.color)); + var node2 = new mathMLTree.MathNode("mstyle", inner2); + node2.setAttribute("mathcolor", group2.color); + return node2; + }, "mathmlBuilder$7"); + defineFunction({ + type: "color", + names: ["\\textcolor"], + props: { + numArgs: 2, + allowedInText: true, + argTypes: ["color", "original"] + }, + handler(_ref, args) { + var { + parser: parser29 + } = _ref; + var color2 = assertNodeType(args[0], "color-token").color; + var body = args[1]; + return { + type: "color", + mode: parser29.mode, + color: color2, + body: ordargument(body) + }; + }, + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$7 + }); + defineFunction({ + type: "color", + names: ["\\color"], + props: { + numArgs: 1, + allowedInText: true, + argTypes: ["color"] + }, + handler(_ref2, args) { + var { + parser: parser29, + breakOnTokenText + } = _ref2; + var color2 = assertNodeType(args[0], "color-token").color; + parser29.gullet.macros.set("\\current@color", color2); + var body = parser29.parseExpression(true, breakOnTokenText); + return { + type: "color", + mode: parser29.mode, + color: color2, + body + }; + }, + htmlBuilder: htmlBuilder$8, + mathmlBuilder: mathmlBuilder$7 + }); + defineFunction({ + type: "cr", + names: ["\\\\"], + props: { + numArgs: 0, + numOptionalArgs: 0, + allowedInText: true + }, + handler(_ref, args, optArgs) { + var { + parser: parser29 + } = _ref; + var size4 = parser29.gullet.future().text === "[" ? parser29.parseSizeGroup(true) : null; + var newLine = !parser29.settings.displayMode || !parser29.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode"); + return { + type: "cr", + mode: parser29.mode, + newLine, + size: size4 && assertNodeType(size4, "size").value + }; + }, + // The following builders are called only at the top level, + // not within tabular/array environments. + htmlBuilder(group2, options2) { + var span = buildCommon.makeSpan(["mspace"], [], options2); + if (group2.newLine) { + span.classes.push("newline"); + if (group2.size) { + span.style.marginTop = makeEm(calculateSize2(group2.size, options2)); + } + } + return span; + }, + mathmlBuilder(group2, options2) { + var node2 = new mathMLTree.MathNode("mspace"); + if (group2.newLine) { + node2.setAttribute("linebreak", "newline"); + if (group2.size) { + node2.setAttribute("height", makeEm(calculateSize2(group2.size, options2))); + } + } + return node2; + } + }); + globalMap = { + "\\global": "\\global", + "\\long": "\\\\globallong", + "\\\\globallong": "\\\\globallong", + "\\def": "\\gdef", + "\\gdef": "\\gdef", + "\\edef": "\\xdef", + "\\xdef": "\\xdef", + "\\let": "\\\\globallet", + "\\futurelet": "\\\\globalfuture" + }; + checkControlSequence = /* @__PURE__ */ __name((tok) => { + var name = tok.text; + if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { + throw new ParseError("Expected a control sequence", tok); + } + return name; + }, "checkControlSequence"); + getRHS = /* @__PURE__ */ __name((parser29) => { + var tok = parser29.gullet.popToken(); + if (tok.text === "=") { + tok = parser29.gullet.popToken(); + if (tok.text === " ") { + tok = parser29.gullet.popToken(); + } + } + return tok; + }, "getRHS"); + letCommand = /* @__PURE__ */ __name((parser29, name, tok, global2) => { + var macro = parser29.gullet.macros.get(tok.text); + if (macro == null) { + tok.noexpand = true; + macro = { + tokens: [tok], + numArgs: 0, + // reproduce the same behavior in expansion + unexpandable: !parser29.gullet.isExpandable(tok.text) + }; + } + parser29.gullet.macros.set(name, macro, global2); + }, "letCommand"); + defineFunction({ + type: "internal", + names: [ + "\\global", + "\\long", + "\\\\globallong" + // can’t be entered directly + ], + props: { + numArgs: 0, + allowedInText: true + }, + handler(_ref) { + var { + parser: parser29, + funcName + } = _ref; + parser29.consumeSpaces(); + var token2 = parser29.fetch(); + if (globalMap[token2.text]) { + if (funcName === "\\global" || funcName === "\\\\globallong") { + token2.text = globalMap[token2.text]; + } + return assertNodeType(parser29.parseFunction(), "internal"); + } + throw new ParseError("Invalid token after macro prefix", token2); + } + }); + defineFunction({ + type: "internal", + names: ["\\def", "\\gdef", "\\edef", "\\xdef"], + props: { + numArgs: 0, + allowedInText: true, + primitive: true + }, + handler(_ref2) { + var { + parser: parser29, + funcName + } = _ref2; + var tok = parser29.gullet.popToken(); + var name = tok.text; + if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) { + throw new ParseError("Expected a control sequence", tok); + } + var numArgs = 0; + var insert; + var delimiters2 = [[]]; + while (parser29.gullet.future().text !== "{") { + tok = parser29.gullet.popToken(); + if (tok.text === "#") { + if (parser29.gullet.future().text === "{") { + insert = parser29.gullet.future(); + delimiters2[numArgs].push("{"); + break; + } + tok = parser29.gullet.popToken(); + if (!/^[1-9]$/.test(tok.text)) { + throw new ParseError('Invalid argument number "' + tok.text + '"'); + } + if (parseInt(tok.text) !== numArgs + 1) { + throw new ParseError('Argument number "' + tok.text + '" out of order'); + } + numArgs++; + delimiters2.push([]); + } else if (tok.text === "EOF") { + throw new ParseError("Expected a macro definition"); + } else { + delimiters2[numArgs].push(tok.text); + } + } + var { + tokens: tokens2 + } = parser29.gullet.consumeArg(); + if (insert) { + tokens2.unshift(insert); + } + if (funcName === "\\edef" || funcName === "\\xdef") { + tokens2 = parser29.gullet.expandTokens(tokens2); + tokens2.reverse(); + } + parser29.gullet.macros.set(name, { + tokens: tokens2, + numArgs, + delimiters: delimiters2 + }, funcName === globalMap[funcName]); + return { + type: "internal", + mode: parser29.mode + }; + } + }); + defineFunction({ + type: "internal", + names: [ + "\\let", + "\\\\globallet" + // can’t be entered directly + ], + props: { + numArgs: 0, + allowedInText: true, + primitive: true + }, + handler(_ref3) { + var { + parser: parser29, + funcName + } = _ref3; + var name = checkControlSequence(parser29.gullet.popToken()); + parser29.gullet.consumeSpaces(); + var tok = getRHS(parser29); + letCommand(parser29, name, tok, funcName === "\\\\globallet"); + return { + type: "internal", + mode: parser29.mode + }; + } + }); + defineFunction({ + type: "internal", + names: [ + "\\futurelet", + "\\\\globalfuture" + // can’t be entered directly + ], + props: { + numArgs: 0, + allowedInText: true, + primitive: true + }, + handler(_ref4) { + var { + parser: parser29, + funcName + } = _ref4; + var name = checkControlSequence(parser29.gullet.popToken()); + var middle = parser29.gullet.popToken(); + var tok = parser29.gullet.popToken(); + letCommand(parser29, name, tok, funcName === "\\\\globalfuture"); + parser29.gullet.pushToken(tok); + parser29.gullet.pushToken(middle); + return { + type: "internal", + mode: parser29.mode + }; + } + }); + getMetrics = /* @__PURE__ */ __name(function getMetrics2(symbol, font, mode) { + var replace2 = symbols.math[symbol] && symbols.math[symbol].replace; + var metrics = getCharacterMetrics(replace2 || symbol, font, mode); + if (!metrics) { + throw new Error("Unsupported symbol " + symbol + " and font size " + font + "."); + } + return metrics; + }, "getMetrics"); + styleWrap = /* @__PURE__ */ __name(function styleWrap2(delim, toStyle, options2, classes3) { + var newOptions = options2.havingBaseStyle(toStyle); + var span = buildCommon.makeSpan(classes3.concat(newOptions.sizingClasses(options2)), [delim], options2); + var delimSizeMultiplier = newOptions.sizeMultiplier / options2.sizeMultiplier; + span.height *= delimSizeMultiplier; + span.depth *= delimSizeMultiplier; + span.maxFontSize = newOptions.sizeMultiplier; + return span; + }, "styleWrap"); + centerSpan = /* @__PURE__ */ __name(function centerSpan2(span, options2, style3) { + var newOptions = options2.havingBaseStyle(style3); + var shift2 = (1 - options2.sizeMultiplier / newOptions.sizeMultiplier) * options2.fontMetrics().axisHeight; + span.classes.push("delimcenter"); + span.style.top = makeEm(shift2); + span.height -= shift2; + span.depth += shift2; + }, "centerSpan"); + makeSmallDelim = /* @__PURE__ */ __name(function makeSmallDelim2(delim, style3, center4, options2, mode, classes3) { + var text4 = buildCommon.makeSymbol(delim, "Main-Regular", mode, options2); + var span = styleWrap(text4, style3, options2, classes3); + if (center4) { + centerSpan(span, options2, style3); + } + return span; + }, "makeSmallDelim"); + mathrmSize = /* @__PURE__ */ __name(function mathrmSize2(value2, size4, mode, options2) { + return buildCommon.makeSymbol(value2, "Size" + size4 + "-Regular", mode, options2); + }, "mathrmSize"); + makeLargeDelim = /* @__PURE__ */ __name(function makeLargeDelim2(delim, size4, center4, options2, mode, classes3) { + var inner2 = mathrmSize(delim, size4, mode, options2); + var span = styleWrap(buildCommon.makeSpan(["delimsizing", "size" + size4], [inner2], options2), Style$1.TEXT, options2, classes3); + if (center4) { + centerSpan(span, options2, Style$1.TEXT); + } + return span; + }, "makeLargeDelim"); + makeGlyphSpan = /* @__PURE__ */ __name(function makeGlyphSpan2(symbol, font, mode) { + var sizeClass; + if (font === "Size1-Regular") { + sizeClass = "delim-size1"; + } else { + sizeClass = "delim-size4"; + } + var corner = buildCommon.makeSpan(["delimsizinginner", sizeClass], [buildCommon.makeSpan([], [buildCommon.makeSymbol(symbol, font, mode)])]); + return { + type: "elem", + elem: corner + }; + }, "makeGlyphSpan"); + makeInner = /* @__PURE__ */ __name(function makeInner2(ch, height2, options2) { + var width3 = fontMetricsData["Size4-Regular"][ch.charCodeAt(0)] ? fontMetricsData["Size4-Regular"][ch.charCodeAt(0)][4] : fontMetricsData["Size1-Regular"][ch.charCodeAt(0)][4]; + var path4 = new PathNode("inner", innerPath(ch, Math.round(1e3 * height2))); + var svgNode2 = new SvgNode([path4], { + "width": makeEm(width3), + "height": makeEm(height2), + // Override CSS rule `.katex svg { width: 100% }` + "style": "width:" + makeEm(width3), + "viewBox": "0 0 " + 1e3 * width3 + " " + Math.round(1e3 * height2), + "preserveAspectRatio": "xMinYMin" + }); + var span = buildCommon.makeSvgSpan([], [svgNode2], options2); + span.height = height2; + span.style.height = makeEm(height2); + span.style.width = makeEm(width3); + return { + type: "elem", + elem: span + }; + }, "makeInner"); + lapInEms = 8e-3; + lap = { + type: "kern", + size: -1 * lapInEms + }; + verts = ["|", "\\lvert", "\\rvert", "\\vert"]; + doubleVerts = ["\\|", "\\lVert", "\\rVert", "\\Vert"]; + makeStackedDelim = /* @__PURE__ */ __name(function makeStackedDelim2(delim, heightTotal, center4, options2, mode, classes3) { + var top2; + var middle; + var repeat2; + var bottom2; + var svgLabel = ""; + var viewBoxWidth = 0; + top2 = repeat2 = bottom2 = delim; + middle = null; + var font = "Size1-Regular"; + if (delim === "\\uparrow") { + repeat2 = bottom2 = "\u23D0"; + } else if (delim === "\\Uparrow") { + repeat2 = bottom2 = "\u2016"; + } else if (delim === "\\downarrow") { + top2 = repeat2 = "\u23D0"; + } else if (delim === "\\Downarrow") { + top2 = repeat2 = "\u2016"; + } else if (delim === "\\updownarrow") { + top2 = "\\uparrow"; + repeat2 = "\u23D0"; + bottom2 = "\\downarrow"; + } else if (delim === "\\Updownarrow") { + top2 = "\\Uparrow"; + repeat2 = "\u2016"; + bottom2 = "\\Downarrow"; + } else if (verts.includes(delim)) { + repeat2 = "\u2223"; + svgLabel = "vert"; + viewBoxWidth = 333; + } else if (doubleVerts.includes(delim)) { + repeat2 = "\u2225"; + svgLabel = "doublevert"; + viewBoxWidth = 556; + } else if (delim === "[" || delim === "\\lbrack") { + top2 = "\u23A1"; + repeat2 = "\u23A2"; + bottom2 = "\u23A3"; + font = "Size4-Regular"; + svgLabel = "lbrack"; + viewBoxWidth = 667; + } else if (delim === "]" || delim === "\\rbrack") { + top2 = "\u23A4"; + repeat2 = "\u23A5"; + bottom2 = "\u23A6"; + font = "Size4-Regular"; + svgLabel = "rbrack"; + viewBoxWidth = 667; + } else if (delim === "\\lfloor" || delim === "\u230A") { + repeat2 = top2 = "\u23A2"; + bottom2 = "\u23A3"; + font = "Size4-Regular"; + svgLabel = "lfloor"; + viewBoxWidth = 667; + } else if (delim === "\\lceil" || delim === "\u2308") { + top2 = "\u23A1"; + repeat2 = bottom2 = "\u23A2"; + font = "Size4-Regular"; + svgLabel = "lceil"; + viewBoxWidth = 667; + } else if (delim === "\\rfloor" || delim === "\u230B") { + repeat2 = top2 = "\u23A5"; + bottom2 = "\u23A6"; + font = "Size4-Regular"; + svgLabel = "rfloor"; + viewBoxWidth = 667; + } else if (delim === "\\rceil" || delim === "\u2309") { + top2 = "\u23A4"; + repeat2 = bottom2 = "\u23A5"; + font = "Size4-Regular"; + svgLabel = "rceil"; + viewBoxWidth = 667; + } else if (delim === "(" || delim === "\\lparen") { + top2 = "\u239B"; + repeat2 = "\u239C"; + bottom2 = "\u239D"; + font = "Size4-Regular"; + svgLabel = "lparen"; + viewBoxWidth = 875; + } else if (delim === ")" || delim === "\\rparen") { + top2 = "\u239E"; + repeat2 = "\u239F"; + bottom2 = "\u23A0"; + font = "Size4-Regular"; + svgLabel = "rparen"; + viewBoxWidth = 875; + } else if (delim === "\\{" || delim === "\\lbrace") { + top2 = "\u23A7"; + middle = "\u23A8"; + bottom2 = "\u23A9"; + repeat2 = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\}" || delim === "\\rbrace") { + top2 = "\u23AB"; + middle = "\u23AC"; + bottom2 = "\u23AD"; + repeat2 = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\lgroup" || delim === "\u27EE") { + top2 = "\u23A7"; + bottom2 = "\u23A9"; + repeat2 = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\rgroup" || delim === "\u27EF") { + top2 = "\u23AB"; + bottom2 = "\u23AD"; + repeat2 = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\lmoustache" || delim === "\u23B0") { + top2 = "\u23A7"; + bottom2 = "\u23AD"; + repeat2 = "\u23AA"; + font = "Size4-Regular"; + } else if (delim === "\\rmoustache" || delim === "\u23B1") { + top2 = "\u23AB"; + bottom2 = "\u23A9"; + repeat2 = "\u23AA"; + font = "Size4-Regular"; + } + var topMetrics = getMetrics(top2, font, mode); + var topHeightTotal = topMetrics.height + topMetrics.depth; + var repeatMetrics = getMetrics(repeat2, font, mode); + var repeatHeightTotal = repeatMetrics.height + repeatMetrics.depth; + var bottomMetrics = getMetrics(bottom2, font, mode); + var bottomHeightTotal = bottomMetrics.height + bottomMetrics.depth; + var middleHeightTotal = 0; + var middleFactor = 1; + if (middle !== null) { + var middleMetrics = getMetrics(middle, font, mode); + middleHeightTotal = middleMetrics.height + middleMetrics.depth; + middleFactor = 2; + } + var minHeight = topHeightTotal + bottomHeightTotal + middleHeightTotal; + var repeatCount = Math.max(0, Math.ceil((heightTotal - minHeight) / (middleFactor * repeatHeightTotal))); + var realHeightTotal = minHeight + repeatCount * middleFactor * repeatHeightTotal; + var axisHeight = options2.fontMetrics().axisHeight; + if (center4) { + axisHeight *= options2.sizeMultiplier; + } + var depth = realHeightTotal / 2 - axisHeight; + var stack = []; + if (svgLabel.length > 0) { + var midHeight = realHeightTotal - topHeightTotal - bottomHeightTotal; + var viewBoxHeight = Math.round(realHeightTotal * 1e3); + var pathStr = tallDelim(svgLabel, Math.round(midHeight * 1e3)); + var path4 = new PathNode(svgLabel, pathStr); + var width3 = (viewBoxWidth / 1e3).toFixed(3) + "em"; + var height2 = (viewBoxHeight / 1e3).toFixed(3) + "em"; + var svg2 = new SvgNode([path4], { + "width": width3, + "height": height2, + "viewBox": "0 0 " + viewBoxWidth + " " + viewBoxHeight + }); + var wrapper = buildCommon.makeSvgSpan([], [svg2], options2); + wrapper.height = viewBoxHeight / 1e3; + wrapper.style.width = width3; + wrapper.style.height = height2; + stack.push({ + type: "elem", + elem: wrapper + }); + } else { + stack.push(makeGlyphSpan(bottom2, font, mode)); + stack.push(lap); + if (middle === null) { + var innerHeight = realHeightTotal - topHeightTotal - bottomHeightTotal + 2 * lapInEms; + stack.push(makeInner(repeat2, innerHeight, options2)); + } else { + var _innerHeight = (realHeightTotal - topHeightTotal - bottomHeightTotal - middleHeightTotal) / 2 + 2 * lapInEms; + stack.push(makeInner(repeat2, _innerHeight, options2)); + stack.push(lap); + stack.push(makeGlyphSpan(middle, font, mode)); + stack.push(lap); + stack.push(makeInner(repeat2, _innerHeight, options2)); + } + stack.push(lap); + stack.push(makeGlyphSpan(top2, font, mode)); + } + var newOptions = options2.havingBaseStyle(Style$1.TEXT); + var inner2 = buildCommon.makeVList({ + positionType: "bottom", + positionData: depth, + children: stack + }, newOptions); + return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner2], newOptions), Style$1.TEXT, options2, classes3); + }, "makeStackedDelim"); + vbPad = 80; + emPad = 0.08; + sqrtSvg = /* @__PURE__ */ __name(function sqrtSvg2(sqrtName, height2, viewBoxHeight, extraVinculum, options2) { + var path4 = sqrtPath(sqrtName, extraVinculum, viewBoxHeight); + var pathNode = new PathNode(sqrtName, path4); + var svg2 = new SvgNode([pathNode], { + // Note: 1000:1 ratio of viewBox to document em width. + "width": "400em", + "height": makeEm(height2), + "viewBox": "0 0 400000 " + viewBoxHeight, + "preserveAspectRatio": "xMinYMin slice" + }); + return buildCommon.makeSvgSpan(["hide-tail"], [svg2], options2); + }, "sqrtSvg"); + makeSqrtImage = /* @__PURE__ */ __name(function makeSqrtImage2(height2, options2) { + var newOptions = options2.havingBaseSizing(); + var delim = traverseSequence("\\surd", height2 * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions); + var sizeMultiplier = newOptions.sizeMultiplier; + var extraVinculum = Math.max(0, options2.minRuleThickness - options2.fontMetrics().sqrtRuleThickness); + var span; + var spanHeight = 0; + var texHeight = 0; + var viewBoxHeight = 0; + var advanceWidth; + if (delim.type === "small") { + viewBoxHeight = 1e3 + 1e3 * extraVinculum + vbPad; + if (height2 < 1) { + sizeMultiplier = 1; + } else if (height2 < 1.4) { + sizeMultiplier = 0.7; + } + spanHeight = (1 + extraVinculum + emPad) / sizeMultiplier; + texHeight = (1 + extraVinculum) / sizeMultiplier; + span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraVinculum, options2); + span.style.minWidth = "0.853em"; + advanceWidth = 0.833 / sizeMultiplier; + } else if (delim.type === "large") { + viewBoxHeight = (1e3 + vbPad) * sizeToMaxHeight[delim.size]; + texHeight = (sizeToMaxHeight[delim.size] + extraVinculum) / sizeMultiplier; + spanHeight = (sizeToMaxHeight[delim.size] + extraVinculum + emPad) / sizeMultiplier; + span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraVinculum, options2); + span.style.minWidth = "1.02em"; + advanceWidth = 1 / sizeMultiplier; + } else { + spanHeight = height2 + extraVinculum + emPad; + texHeight = height2 + extraVinculum; + viewBoxHeight = Math.floor(1e3 * height2 + extraVinculum) + vbPad; + span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraVinculum, options2); + span.style.minWidth = "0.742em"; + advanceWidth = 1.056; + } + span.height = texHeight; + span.style.height = makeEm(spanHeight); + return { + span, + advanceWidth, + // Calculate the actual line width. + // This actually should depend on the chosen font -- e.g. \boldmath + // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and + // have thicker rules. + ruleWidth: (options2.fontMetrics().sqrtRuleThickness + extraVinculum) * sizeMultiplier + }; + }, "makeSqrtImage"); + stackLargeDelimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "\\surd"]; + stackAlwaysDelimiters = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1"]; + stackNeverDelimiters = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"]; + sizeToMaxHeight = [0, 1.2, 1.8, 2.4, 3]; + makeSizedDelim = /* @__PURE__ */ __name(function makeSizedDelim2(delim, size4, options2, mode, classes3) { + if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { + delim = "\\langle"; + } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { + delim = "\\rangle"; + } + if (stackLargeDelimiters.includes(delim) || stackNeverDelimiters.includes(delim)) { + return makeLargeDelim(delim, size4, false, options2, mode, classes3); + } else if (stackAlwaysDelimiters.includes(delim)) { + return makeStackedDelim(delim, sizeToMaxHeight[size4], false, options2, mode, classes3); + } else { + throw new ParseError("Illegal delimiter: '" + delim + "'"); + } + }, "makeSizedDelim"); + stackNeverDelimiterSequence = [{ + type: "small", + style: Style$1.SCRIPTSCRIPT + }, { + type: "small", + style: Style$1.SCRIPT + }, { + type: "small", + style: Style$1.TEXT + }, { + type: "large", + size: 1 + }, { + type: "large", + size: 2 + }, { + type: "large", + size: 3 + }, { + type: "large", + size: 4 + }]; + stackAlwaysDelimiterSequence = [{ + type: "small", + style: Style$1.SCRIPTSCRIPT + }, { + type: "small", + style: Style$1.SCRIPT + }, { + type: "small", + style: Style$1.TEXT + }, { + type: "stack" + }]; + stackLargeDelimiterSequence = [{ + type: "small", + style: Style$1.SCRIPTSCRIPT + }, { + type: "small", + style: Style$1.SCRIPT + }, { + type: "small", + style: Style$1.TEXT + }, { + type: "large", + size: 1 + }, { + type: "large", + size: 2 + }, { + type: "large", + size: 3 + }, { + type: "large", + size: 4 + }, { + type: "stack" + }]; + delimTypeToFont = /* @__PURE__ */ __name(function delimTypeToFont2(type3) { + if (type3.type === "small") { + return "Main-Regular"; + } else if (type3.type === "large") { + return "Size" + type3.size + "-Regular"; + } else if (type3.type === "stack") { + return "Size4-Regular"; + } else { + throw new Error("Add support for delim type '" + type3.type + "' here."); + } + }, "delimTypeToFont"); + traverseSequence = /* @__PURE__ */ __name(function traverseSequence2(delim, height2, sequence, options2) { + var start3 = Math.min(2, 3 - options2.style.size); + for (var i2 = start3; i2 < sequence.length; i2++) { + if (sequence[i2].type === "stack") { + break; + } + var metrics = getMetrics(delim, delimTypeToFont(sequence[i2]), "math"); + var heightDepth = metrics.height + metrics.depth; + if (sequence[i2].type === "small") { + var newOptions = options2.havingBaseStyle(sequence[i2].style); + heightDepth *= newOptions.sizeMultiplier; + } + if (heightDepth > height2) { + return sequence[i2]; + } + } + return sequence[sequence.length - 1]; + }, "traverseSequence"); + makeCustomSizedDelim = /* @__PURE__ */ __name(function makeCustomSizedDelim2(delim, height2, center4, options2, mode, classes3) { + if (delim === "<" || delim === "\\lt" || delim === "\u27E8") { + delim = "\\langle"; + } else if (delim === ">" || delim === "\\gt" || delim === "\u27E9") { + delim = "\\rangle"; + } + var sequence; + if (stackNeverDelimiters.includes(delim)) { + sequence = stackNeverDelimiterSequence; + } else if (stackLargeDelimiters.includes(delim)) { + sequence = stackLargeDelimiterSequence; + } else { + sequence = stackAlwaysDelimiterSequence; + } + var delimType = traverseSequence(delim, height2, sequence, options2); + if (delimType.type === "small") { + return makeSmallDelim(delim, delimType.style, center4, options2, mode, classes3); + } else if (delimType.type === "large") { + return makeLargeDelim(delim, delimType.size, center4, options2, mode, classes3); + } else { + return makeStackedDelim(delim, height2, center4, options2, mode, classes3); + } + }, "makeCustomSizedDelim"); + makeLeftRightDelim = /* @__PURE__ */ __name(function makeLeftRightDelim2(delim, height2, depth, options2, mode, classes3) { + var axisHeight = options2.fontMetrics().axisHeight * options2.sizeMultiplier; + var delimiterFactor = 901; + var delimiterExtend = 5 / options2.fontMetrics().ptPerEm; + var maxDistFromAxis = Math.max(height2 - axisHeight, depth + axisHeight); + var totalHeight = Math.max( + // In real TeX, calculations are done using integral values which are + // 65536 per pt, or 655360 per em. So, the division here truncates in + // TeX but doesn't here, producing different results. If we wanted to + // exactly match TeX's calculation, we could do + // Math.floor(655360 * maxDistFromAxis / 500) * + // delimiterFactor / 655360 + // (To see the difference, compare + // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} + // in TeX and KaTeX) + maxDistFromAxis / 500 * delimiterFactor, + 2 * maxDistFromAxis - delimiterExtend + ); + return makeCustomSizedDelim(delim, totalHeight, true, options2, mode, classes3); + }, "makeLeftRightDelim"); + delimiter = { + sqrtImage: makeSqrtImage, + sizedDelim: makeSizedDelim, + sizeToMaxHeight, + customSizedDelim: makeCustomSizedDelim, + leftRightDelim: makeLeftRightDelim + }; + delimiterSizes = { + "\\bigl": { + mclass: "mopen", + size: 1 + }, + "\\Bigl": { + mclass: "mopen", + size: 2 + }, + "\\biggl": { + mclass: "mopen", + size: 3 + }, + "\\Biggl": { + mclass: "mopen", + size: 4 + }, + "\\bigr": { + mclass: "mclose", + size: 1 + }, + "\\Bigr": { + mclass: "mclose", + size: 2 + }, + "\\biggr": { + mclass: "mclose", + size: 3 + }, + "\\Biggr": { + mclass: "mclose", + size: 4 + }, + "\\bigm": { + mclass: "mrel", + size: 1 + }, + "\\Bigm": { + mclass: "mrel", + size: 2 + }, + "\\biggm": { + mclass: "mrel", + size: 3 + }, + "\\Biggm": { + mclass: "mrel", + size: 4 + }, + "\\big": { + mclass: "mord", + size: 1 + }, + "\\Big": { + mclass: "mord", + size: 2 + }, + "\\bigg": { + mclass: "mord", + size: 3 + }, + "\\Bigg": { + mclass: "mord", + size: 4 + } + }; + delimiters = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "\u230A", "\u230B", "\\lceil", "\\rceil", "\u2308", "\u2309", "<", ">", "\\langle", "\u27E8", "\\rangle", "\u27E9", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "\u27EE", "\u27EF", "\\lmoustache", "\\rmoustache", "\u23B0", "\u23B1", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; + __name(checkDelimiter, "checkDelimiter"); + defineFunction({ + type: "delimsizing", + names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], + props: { + numArgs: 1, + argTypes: ["primitive"] + }, + handler: /* @__PURE__ */ __name((context, args) => { + var delim = checkDelimiter(args[0], context); + return { + type: "delimsizing", + mode: context.parser.mode, + size: delimiterSizes[context.funcName].size, + mclass: delimiterSizes[context.funcName].mclass, + delim: delim.text + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + if (group2.delim === ".") { + return buildCommon.makeSpan([group2.mclass]); + } + return delimiter.sizedDelim(group2.delim, group2.size, options2, group2.mode, [group2.mclass]); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2) => { + var children2 = []; + if (group2.delim !== ".") { + children2.push(makeText(group2.delim, group2.mode)); + } + var node2 = new mathMLTree.MathNode("mo", children2); + if (group2.mclass === "mopen" || group2.mclass === "mclose") { + node2.setAttribute("fence", "true"); + } else { + node2.setAttribute("fence", "false"); + } + node2.setAttribute("stretchy", "true"); + var size4 = makeEm(delimiter.sizeToMaxHeight[group2.size]); + node2.setAttribute("minsize", size4); + node2.setAttribute("maxsize", size4); + return node2; + }, "mathmlBuilder") + }); + __name(assertParsed, "assertParsed"); + defineFunction({ + type: "leftright-right", + names: ["\\right"], + props: { + numArgs: 1, + primitive: true + }, + handler: /* @__PURE__ */ __name((context, args) => { + var color2 = context.parser.gullet.macros.get("\\current@color"); + if (color2 && typeof color2 !== "string") { + throw new ParseError("\\current@color set to non-string in \\right"); + } + return { + type: "leftright-right", + mode: context.parser.mode, + delim: checkDelimiter(args[0], context).text, + color: color2 + // undefined if not set via \color + }; + }, "handler") + }); + defineFunction({ + type: "leftright", + names: ["\\left"], + props: { + numArgs: 1, + primitive: true + }, + handler: /* @__PURE__ */ __name((context, args) => { + var delim = checkDelimiter(args[0], context); + var parser29 = context.parser; + ++parser29.leftrightDepth; + var body = parser29.parseExpression(false); + --parser29.leftrightDepth; + parser29.expect("\\right", false); + var right3 = assertNodeType(parser29.parseFunction(), "leftright-right"); + return { + type: "leftright", + mode: parser29.mode, + body, + left: delim.text, + right: right3.delim, + rightColor: right3.color + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + assertParsed(group2); + var inner2 = buildExpression$1(group2.body, options2, true, ["mopen", "mclose"]); + var innerHeight = 0; + var innerDepth = 0; + var hadMiddle = false; + for (var i2 = 0; i2 < inner2.length; i2++) { + if (inner2[i2].isMiddle) { + hadMiddle = true; + } else { + innerHeight = Math.max(inner2[i2].height, innerHeight); + innerDepth = Math.max(inner2[i2].depth, innerDepth); + } + } + innerHeight *= options2.sizeMultiplier; + innerDepth *= options2.sizeMultiplier; + var leftDelim; + if (group2.left === ".") { + leftDelim = makeNullDelimiter(options2, ["mopen"]); + } else { + leftDelim = delimiter.leftRightDelim(group2.left, innerHeight, innerDepth, options2, group2.mode, ["mopen"]); + } + inner2.unshift(leftDelim); + if (hadMiddle) { + for (var _i = 1; _i < inner2.length; _i++) { + var middleDelim = inner2[_i]; + var isMiddle = middleDelim.isMiddle; + if (isMiddle) { + inner2[_i] = delimiter.leftRightDelim(isMiddle.delim, innerHeight, innerDepth, isMiddle.options, group2.mode, []); + } + } + } + var rightDelim; + if (group2.right === ".") { + rightDelim = makeNullDelimiter(options2, ["mclose"]); + } else { + var colorOptions = group2.rightColor ? options2.withColor(group2.rightColor) : options2; + rightDelim = delimiter.leftRightDelim(group2.right, innerHeight, innerDepth, colorOptions, group2.mode, ["mclose"]); + } + inner2.push(rightDelim); + return buildCommon.makeSpan(["minner"], inner2, options2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + assertParsed(group2); + var inner2 = buildExpression2(group2.body, options2); + if (group2.left !== ".") { + var leftNode = new mathMLTree.MathNode("mo", [makeText(group2.left, group2.mode)]); + leftNode.setAttribute("fence", "true"); + inner2.unshift(leftNode); + } + if (group2.right !== ".") { + var rightNode = new mathMLTree.MathNode("mo", [makeText(group2.right, group2.mode)]); + rightNode.setAttribute("fence", "true"); + if (group2.rightColor) { + rightNode.setAttribute("mathcolor", group2.rightColor); + } + inner2.push(rightNode); + } + return makeRow(inner2); + }, "mathmlBuilder") + }); + defineFunction({ + type: "middle", + names: ["\\middle"], + props: { + numArgs: 1, + primitive: true + }, + handler: /* @__PURE__ */ __name((context, args) => { + var delim = checkDelimiter(args[0], context); + if (!context.parser.leftrightDepth) { + throw new ParseError("\\middle without preceding \\left", delim); + } + return { + type: "middle", + mode: context.parser.mode, + delim: delim.text + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var middleDelim; + if (group2.delim === ".") { + middleDelim = makeNullDelimiter(options2, []); + } else { + middleDelim = delimiter.sizedDelim(group2.delim, 1, options2, group2.mode, []); + var isMiddle = { + delim: group2.delim, + options: options2 + }; + middleDelim.isMiddle = isMiddle; + } + return middleDelim; + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var textNode = group2.delim === "\\vert" || group2.delim === "|" ? makeText("|", "text") : makeText(group2.delim, group2.mode); + var middleNode = new mathMLTree.MathNode("mo", [textNode]); + middleNode.setAttribute("fence", "true"); + middleNode.setAttribute("lspace", "0.05em"); + middleNode.setAttribute("rspace", "0.05em"); + return middleNode; + }, "mathmlBuilder") + }); + htmlBuilder$7 = /* @__PURE__ */ __name((group2, options2) => { + var inner2 = buildCommon.wrapFragment(buildGroup$1(group2.body, options2), options2); + var label = group2.label.slice(1); + var scale3 = options2.sizeMultiplier; + var img; + var imgShift = 0; + var isSingleChar = utils.isCharacterBox(group2.body); + if (label === "sout") { + img = buildCommon.makeSpan(["stretchy", "sout"]); + img.height = options2.fontMetrics().defaultRuleThickness / scale3; + imgShift = -0.5 * options2.fontMetrics().xHeight; + } else if (label === "phase") { + var lineWeight = calculateSize2({ + number: 0.6, + unit: "pt" + }, options2); + var clearance = calculateSize2({ + number: 0.35, + unit: "ex" + }, options2); + var newOptions = options2.havingBaseSizing(); + scale3 = scale3 / newOptions.sizeMultiplier; + var angleHeight = inner2.height + inner2.depth + lineWeight + clearance; + inner2.style.paddingLeft = makeEm(angleHeight / 2 + lineWeight); + var viewBoxHeight = Math.floor(1e3 * angleHeight * scale3); + var path4 = phasePath(viewBoxHeight); + var svgNode2 = new SvgNode([new PathNode("phase", path4)], { + "width": "400em", + "height": makeEm(viewBoxHeight / 1e3), + "viewBox": "0 0 400000 " + viewBoxHeight, + "preserveAspectRatio": "xMinYMin slice" + }); + img = buildCommon.makeSvgSpan(["hide-tail"], [svgNode2], options2); + img.style.height = makeEm(angleHeight); + imgShift = inner2.depth + lineWeight + clearance; + } else { + if (/cancel/.test(label)) { + if (!isSingleChar) { + inner2.classes.push("cancel-pad"); + } + } else if (label === "angl") { + inner2.classes.push("anglpad"); + } else { + inner2.classes.push("boxpad"); + } + var topPad = 0; + var bottomPad = 0; + var ruleThickness = 0; + if (/box/.test(label)) { + ruleThickness = Math.max( + options2.fontMetrics().fboxrule, + // default + options2.minRuleThickness + // User override. + ); + topPad = options2.fontMetrics().fboxsep + (label === "colorbox" ? 0 : ruleThickness); + bottomPad = topPad; + } else if (label === "angl") { + ruleThickness = Math.max(options2.fontMetrics().defaultRuleThickness, options2.minRuleThickness); + topPad = 4 * ruleThickness; + bottomPad = Math.max(0, 0.25 - inner2.depth); + } else { + topPad = isSingleChar ? 0.2 : 0; + bottomPad = topPad; + } + img = stretchy.encloseSpan(inner2, label, topPad, bottomPad, options2); + if (/fbox|boxed|fcolorbox/.test(label)) { + img.style.borderStyle = "solid"; + img.style.borderWidth = makeEm(ruleThickness); + } else if (label === "angl" && ruleThickness !== 0.049) { + img.style.borderTopWidth = makeEm(ruleThickness); + img.style.borderRightWidth = makeEm(ruleThickness); + } + imgShift = inner2.depth + bottomPad; + if (group2.backgroundColor) { + img.style.backgroundColor = group2.backgroundColor; + if (group2.borderColor) { + img.style.borderColor = group2.borderColor; + } + } + } + var vlist; + if (group2.backgroundColor) { + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [ + // Put the color background behind inner; + { + type: "elem", + elem: img, + shift: imgShift + }, + { + type: "elem", + elem: inner2, + shift: 0 + } + ] + }, options2); + } else { + var classes3 = /cancel|phase/.test(label) ? ["svg-align"] : []; + vlist = buildCommon.makeVList({ + positionType: "individualShift", + children: [ + // Write the \cancel stroke on top of inner. + { + type: "elem", + elem: inner2, + shift: 0 + }, + { + type: "elem", + elem: img, + shift: imgShift, + wrapperClasses: classes3 + } + ] + }, options2); + } + if (/cancel/.test(label)) { + vlist.height = inner2.height; + vlist.depth = inner2.depth; + } + if (/cancel/.test(label) && !isSingleChar) { + return buildCommon.makeSpan(["mord", "cancel-lap"], [vlist], options2); + } else { + return buildCommon.makeSpan(["mord"], [vlist], options2); + } + }, "htmlBuilder$7"); + mathmlBuilder$6 = /* @__PURE__ */ __name((group2, options2) => { + var fboxsep = 0; + var node2 = new mathMLTree.MathNode(group2.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [buildGroup2(group2.body, options2)]); + switch (group2.label) { + case "\\cancel": + node2.setAttribute("notation", "updiagonalstrike"); + break; + case "\\bcancel": + node2.setAttribute("notation", "downdiagonalstrike"); + break; + case "\\phase": + node2.setAttribute("notation", "phasorangle"); + break; + case "\\sout": + node2.setAttribute("notation", "horizontalstrike"); + break; + case "\\fbox": + node2.setAttribute("notation", "box"); + break; + case "\\angl": + node2.setAttribute("notation", "actuarial"); + break; + case "\\fcolorbox": + case "\\colorbox": + fboxsep = options2.fontMetrics().fboxsep * options2.fontMetrics().ptPerEm; + node2.setAttribute("width", "+" + 2 * fboxsep + "pt"); + node2.setAttribute("height", "+" + 2 * fboxsep + "pt"); + node2.setAttribute("lspace", fboxsep + "pt"); + node2.setAttribute("voffset", fboxsep + "pt"); + if (group2.label === "\\fcolorbox") { + var thk = Math.max( + options2.fontMetrics().fboxrule, + // default + options2.minRuleThickness + // user override + ); + node2.setAttribute("style", "border: " + thk + "em solid " + String(group2.borderColor)); + } + break; + case "\\xcancel": + node2.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); + break; + } + if (group2.backgroundColor) { + node2.setAttribute("mathbackground", group2.backgroundColor); + } + return node2; + }, "mathmlBuilder$6"); + defineFunction({ + type: "enclose", + names: ["\\colorbox"], + props: { + numArgs: 2, + allowedInText: true, + argTypes: ["color", "text"] + }, + handler(_ref, args, optArgs) { + var { + parser: parser29, + funcName + } = _ref; + var color2 = assertNodeType(args[0], "color-token").color; + var body = args[1]; + return { + type: "enclose", + mode: parser29.mode, + label: funcName, + backgroundColor: color2, + body + }; + }, + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$6 + }); + defineFunction({ + type: "enclose", + names: ["\\fcolorbox"], + props: { + numArgs: 3, + allowedInText: true, + argTypes: ["color", "color", "text"] + }, + handler(_ref2, args, optArgs) { + var { + parser: parser29, + funcName + } = _ref2; + var borderColor = assertNodeType(args[0], "color-token").color; + var backgroundColor = assertNodeType(args[1], "color-token").color; + var body = args[2]; + return { + type: "enclose", + mode: parser29.mode, + label: funcName, + backgroundColor, + borderColor, + body + }; + }, + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$6 + }); + defineFunction({ + type: "enclose", + names: ["\\fbox"], + props: { + numArgs: 1, + argTypes: ["hbox"], + allowedInText: true + }, + handler(_ref3, args) { + var { + parser: parser29 + } = _ref3; + return { + type: "enclose", + mode: parser29.mode, + label: "\\fbox", + body: args[0] + }; + } + }); + defineFunction({ + type: "enclose", + names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"], + props: { + numArgs: 1 + }, + handler(_ref4, args) { + var { + parser: parser29, + funcName + } = _ref4; + var body = args[0]; + return { + type: "enclose", + mode: parser29.mode, + label: funcName, + body + }; + }, + htmlBuilder: htmlBuilder$7, + mathmlBuilder: mathmlBuilder$6 + }); + defineFunction({ + type: "enclose", + names: ["\\angl"], + props: { + numArgs: 1, + argTypes: ["hbox"], + allowedInText: false + }, + handler(_ref5, args) { + var { + parser: parser29 + } = _ref5; + return { + type: "enclose", + mode: parser29.mode, + label: "\\angl", + body: args[0] + }; + } + }); + _environments = {}; + __name(defineEnvironment, "defineEnvironment"); + _macros = {}; + __name(defineMacro, "defineMacro"); + __name(getHLines, "getHLines"); + validateAmsEnvironmentContext = /* @__PURE__ */ __name((context) => { + var settings = context.parser.settings; + if (!settings.displayMode) { + throw new ParseError("{" + context.envName + "} can be used only in display mode."); + } + }, "validateAmsEnvironmentContext"); + __name(getAutoTag, "getAutoTag"); + __name(parseArray, "parseArray"); + __name(dCellStyle, "dCellStyle"); + htmlBuilder$6 = /* @__PURE__ */ __name(function htmlBuilder(group2, options2) { + var r2; + var c3; + var nr = group2.body.length; + var hLinesBeforeRow = group2.hLinesBeforeRow; + var nc = 0; + var body = new Array(nr); + var hlines = []; + var ruleThickness = Math.max( + // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em. + options2.fontMetrics().arrayRuleWidth, + options2.minRuleThickness + // User override. + ); + var pt = 1 / options2.fontMetrics().ptPerEm; + var arraycolsep = 5 * pt; + if (group2.colSeparationType && group2.colSeparationType === "small") { + var localMultiplier = options2.havingStyle(Style$1.SCRIPT).sizeMultiplier; + arraycolsep = 0.2778 * (localMultiplier / options2.sizeMultiplier); + } + var baselineskip = group2.colSeparationType === "CD" ? calculateSize2({ + number: 3, + unit: "ex" + }, options2) : 12 * pt; + var jot = 3 * pt; + var arrayskip = group2.arraystretch * baselineskip; + var arstrutHeight = 0.7 * arrayskip; + var arstrutDepth = 0.3 * arrayskip; + var totalHeight = 0; + function setHLinePos(hlinesInGap) { + for (var i2 = 0; i2 < hlinesInGap.length; ++i2) { + if (i2 > 0) { + totalHeight += 0.25; + } + hlines.push({ + pos: totalHeight, + isDashed: hlinesInGap[i2] + }); + } + } + __name(setHLinePos, "setHLinePos"); + setHLinePos(hLinesBeforeRow[0]); + for (r2 = 0; r2 < group2.body.length; ++r2) { + var inrow = group2.body[r2]; + var height2 = arstrutHeight; + var depth = arstrutDepth; + if (nc < inrow.length) { + nc = inrow.length; + } + var outrow = new Array(inrow.length); + for (c3 = 0; c3 < inrow.length; ++c3) { + var elt = buildGroup$1(inrow[c3], options2); + if (depth < elt.depth) { + depth = elt.depth; + } + if (height2 < elt.height) { + height2 = elt.height; + } + outrow[c3] = elt; + } + var rowGap = group2.rowGaps[r2]; + var gap = 0; + if (rowGap) { + gap = calculateSize2(rowGap, options2); + if (gap > 0) { + gap += arstrutDepth; + if (depth < gap) { + depth = gap; + } + gap = 0; + } + } + if (group2.addJot) { + depth += jot; + } + outrow.height = height2; + outrow.depth = depth; + totalHeight += height2; + outrow.pos = totalHeight; + totalHeight += depth + gap; + body[r2] = outrow; + setHLinePos(hLinesBeforeRow[r2 + 1]); + } + var offset = totalHeight / 2 + options2.fontMetrics().axisHeight; + var colDescriptions = group2.cols || []; + var cols = []; + var colSep; + var colDescrNum; + var tagSpans = []; + if (group2.tags && group2.tags.some((tag2) => tag2)) { + for (r2 = 0; r2 < nr; ++r2) { + var rw = body[r2]; + var shift2 = rw.pos - offset; + var tag = group2.tags[r2]; + var tagSpan = void 0; + if (tag === true) { + tagSpan = buildCommon.makeSpan(["eqn-num"], [], options2); + } else if (tag === false) { + tagSpan = buildCommon.makeSpan([], [], options2); + } else { + tagSpan = buildCommon.makeSpan([], buildExpression$1(tag, options2, true), options2); + } + tagSpan.depth = rw.depth; + tagSpan.height = rw.height; + tagSpans.push({ + type: "elem", + elem: tagSpan, + shift: shift2 + }); + } + } + for ( + c3 = 0, colDescrNum = 0; + // Continue while either there are more columns or more column + // descriptions, so trailing separators don't get lost. + c3 < nc || colDescrNum < colDescriptions.length; + ++c3, ++colDescrNum + ) { + var colDescr = colDescriptions[colDescrNum] || {}; + var firstSeparator = true; + while (colDescr.type === "separator") { + if (!firstSeparator) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = makeEm(options2.fontMetrics().doubleRuleSep); + cols.push(colSep); + } + if (colDescr.separator === "|" || colDescr.separator === ":") { + var lineType = colDescr.separator === "|" ? "solid" : "dashed"; + var separator = buildCommon.makeSpan(["vertical-separator"], [], options2); + separator.style.height = makeEm(totalHeight); + separator.style.borderRightWidth = makeEm(ruleThickness); + separator.style.borderRightStyle = lineType; + separator.style.margin = "0 " + makeEm(-ruleThickness / 2); + var _shift = totalHeight - offset; + if (_shift) { + separator.style.verticalAlign = makeEm(-_shift); + } + cols.push(separator); + } else { + throw new ParseError("Invalid separator type: " + colDescr.separator); + } + colDescrNum++; + colDescr = colDescriptions[colDescrNum] || {}; + firstSeparator = false; + } + if (c3 >= nc) { + continue; + } + var sepwidth = void 0; + if (c3 > 0 || group2.hskipBeforeAndAfter) { + sepwidth = utils.deflt(colDescr.pregap, arraycolsep); + if (sepwidth !== 0) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = makeEm(sepwidth); + cols.push(colSep); + } + } + var col = []; + for (r2 = 0; r2 < nr; ++r2) { + var row = body[r2]; + var elem = row[c3]; + if (!elem) { + continue; + } + var _shift2 = row.pos - offset; + elem.depth = row.depth; + elem.height = row.height; + col.push({ + type: "elem", + elem, + shift: _shift2 + }); + } + col = buildCommon.makeVList({ + positionType: "individualShift", + children: col + }, options2); + col = buildCommon.makeSpan(["col-align-" + (colDescr.align || "c")], [col]); + cols.push(col); + if (c3 < nc - 1 || group2.hskipBeforeAndAfter) { + sepwidth = utils.deflt(colDescr.postgap, arraycolsep); + if (sepwidth !== 0) { + colSep = buildCommon.makeSpan(["arraycolsep"], []); + colSep.style.width = makeEm(sepwidth); + cols.push(colSep); + } + } + } + body = buildCommon.makeSpan(["mtable"], cols); + if (hlines.length > 0) { + var line2 = buildCommon.makeLineSpan("hline", options2, ruleThickness); + var dashes = buildCommon.makeLineSpan("hdashline", options2, ruleThickness); + var vListElems = [{ + type: "elem", + elem: body, + shift: 0 + }]; + while (hlines.length > 0) { + var hline = hlines.pop(); + var lineShift = hline.pos - offset; + if (hline.isDashed) { + vListElems.push({ + type: "elem", + elem: dashes, + shift: lineShift + }); + } else { + vListElems.push({ + type: "elem", + elem: line2, + shift: lineShift + }); + } + } + body = buildCommon.makeVList({ + positionType: "individualShift", + children: vListElems + }, options2); + } + if (tagSpans.length === 0) { + return buildCommon.makeSpan(["mord"], [body], options2); + } else { + var eqnNumCol = buildCommon.makeVList({ + positionType: "individualShift", + children: tagSpans + }, options2); + eqnNumCol = buildCommon.makeSpan(["tag"], [eqnNumCol], options2); + return buildCommon.makeFragment([body, eqnNumCol]); + } + }, "htmlBuilder"); + alignMap = { + c: "center ", + l: "left ", + r: "right " + }; + mathmlBuilder$5 = /* @__PURE__ */ __name(function mathmlBuilder(group2, options2) { + var tbl = []; + var glue = new mathMLTree.MathNode("mtd", [], ["mtr-glue"]); + var tag = new mathMLTree.MathNode("mtd", [], ["mml-eqn-num"]); + for (var i2 = 0; i2 < group2.body.length; i2++) { + var rw = group2.body[i2]; + var row = []; + for (var j3 = 0; j3 < rw.length; j3++) { + row.push(new mathMLTree.MathNode("mtd", [buildGroup2(rw[j3], options2)])); + } + if (group2.tags && group2.tags[i2]) { + row.unshift(glue); + row.push(glue); + if (group2.leqno) { + row.unshift(tag); + } else { + row.push(tag); + } + } + tbl.push(new mathMLTree.MathNode("mtr", row)); + } + var table = new mathMLTree.MathNode("mtable", tbl); + var gap = group2.arraystretch === 0.5 ? 0.1 : 0.16 + group2.arraystretch - 1 + (group2.addJot ? 0.09 : 0); + table.setAttribute("rowspacing", makeEm(gap)); + var menclose = ""; + var align = ""; + if (group2.cols && group2.cols.length > 0) { + var cols = group2.cols; + var columnLines = ""; + var prevTypeWasAlign = false; + var iStart = 0; + var iEnd = cols.length; + if (cols[0].type === "separator") { + menclose += "top "; + iStart = 1; + } + if (cols[cols.length - 1].type === "separator") { + menclose += "bottom "; + iEnd -= 1; + } + for (var _i = iStart; _i < iEnd; _i++) { + if (cols[_i].type === "align") { + align += alignMap[cols[_i].align]; + if (prevTypeWasAlign) { + columnLines += "none "; + } + prevTypeWasAlign = true; + } else if (cols[_i].type === "separator") { + if (prevTypeWasAlign) { + columnLines += cols[_i].separator === "|" ? "solid " : "dashed "; + prevTypeWasAlign = false; + } + } + } + table.setAttribute("columnalign", align.trim()); + if (/[sd]/.test(columnLines)) { + table.setAttribute("columnlines", columnLines.trim()); + } + } + if (group2.colSeparationType === "align") { + var _cols = group2.cols || []; + var spacing2 = ""; + for (var _i2 = 1; _i2 < _cols.length; _i2++) { + spacing2 += _i2 % 2 ? "0em " : "1em "; + } + table.setAttribute("columnspacing", spacing2.trim()); + } else if (group2.colSeparationType === "alignat" || group2.colSeparationType === "gather") { + table.setAttribute("columnspacing", "0em"); + } else if (group2.colSeparationType === "small") { + table.setAttribute("columnspacing", "0.2778em"); + } else if (group2.colSeparationType === "CD") { + table.setAttribute("columnspacing", "0.5em"); + } else { + table.setAttribute("columnspacing", "1em"); + } + var rowLines = ""; + var hlines = group2.hLinesBeforeRow; + menclose += hlines[0].length > 0 ? "left " : ""; + menclose += hlines[hlines.length - 1].length > 0 ? "right " : ""; + for (var _i3 = 1; _i3 < hlines.length - 1; _i3++) { + rowLines += hlines[_i3].length === 0 ? "none " : hlines[_i3][0] ? "dashed " : "solid "; + } + if (/[sd]/.test(rowLines)) { + table.setAttribute("rowlines", rowLines.trim()); + } + if (menclose !== "") { + table = new mathMLTree.MathNode("menclose", [table]); + table.setAttribute("notation", menclose.trim()); + } + if (group2.arraystretch && group2.arraystretch < 1) { + table = new mathMLTree.MathNode("mstyle", [table]); + table.setAttribute("scriptlevel", "1"); + } + return table; + }, "mathmlBuilder"); + alignedHandler = /* @__PURE__ */ __name(function alignedHandler2(context, args) { + if (context.envName.indexOf("ed") === -1) { + validateAmsEnvironmentContext(context); + } + var cols = []; + var separationType = context.envName.indexOf("at") > -1 ? "alignat" : "align"; + var isSplit = context.envName === "split"; + var res = parseArray(context.parser, { + cols, + addJot: true, + autoTag: isSplit ? void 0 : getAutoTag(context.envName), + emptySingleRow: true, + colSeparationType: separationType, + maxNumCols: isSplit ? 2 : void 0, + leqno: context.parser.settings.leqno + }, "display"); + var numMaths; + var numCols = 0; + var emptyGroup = { + type: "ordgroup", + mode: context.mode, + body: [] + }; + if (args[0] && args[0].type === "ordgroup") { + var arg0 = ""; + for (var i2 = 0; i2 < args[0].body.length; i2++) { + var textord2 = assertNodeType(args[0].body[i2], "textord"); + arg0 += textord2.text; + } + numMaths = Number(arg0); + numCols = numMaths * 2; + } + var isAligned = !numCols; + res.body.forEach(function(row) { + for (var _i4 = 1; _i4 < row.length; _i4 += 2) { + var styling = assertNodeType(row[_i4], "styling"); + var ordgroup = assertNodeType(styling.body[0], "ordgroup"); + ordgroup.body.unshift(emptyGroup); + } + if (!isAligned) { + var curMaths = row.length / 2; + if (numMaths < curMaths) { + throw new ParseError("Too many math in a row: " + ("expected " + numMaths + ", but got " + curMaths), row[0]); + } + } else if (numCols < row.length) { + numCols = row.length; + } + }); + for (var _i5 = 0; _i5 < numCols; ++_i5) { + var align = "r"; + var pregap = 0; + if (_i5 % 2 === 1) { + align = "l"; + } else if (_i5 > 0 && isAligned) { + pregap = 1; + } + cols[_i5] = { + type: "align", + align, + pregap, + postgap: 0 + }; + } + res.colSeparationType = isAligned ? "align" : "alignat"; + return res; + }, "alignedHandler"); + defineEnvironment({ + type: "array", + names: ["array", "darray"], + props: { + numArgs: 1 + }, + handler(context, args) { + var symNode = checkSymbolNodeType(args[0]); + var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; + var cols = colalign.map(function(nde) { + var node2 = assertSymbolNodeType(nde); + var ca = node2.text; + if ("lcr".indexOf(ca) !== -1) { + return { + type: "align", + align: ca + }; + } else if (ca === "|") { + return { + type: "separator", + separator: "|" + }; + } else if (ca === ":") { + return { + type: "separator", + separator: ":" + }; + } + throw new ParseError("Unknown column alignment: " + ca, nde); + }); + var res = { + cols, + hskipBeforeAndAfter: true, + // \@preamble in lttab.dtx + maxNumCols: cols.length + }; + return parseArray(context.parser, res, dCellStyle(context.envName)); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineEnvironment({ + type: "array", + names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"], + props: { + numArgs: 0 + }, + handler(context) { + var delimiters2 = { + "matrix": null, + "pmatrix": ["(", ")"], + "bmatrix": ["[", "]"], + "Bmatrix": ["\\{", "\\}"], + "vmatrix": ["|", "|"], + "Vmatrix": ["\\Vert", "\\Vert"] + }[context.envName.replace("*", "")]; + var colAlign = "c"; + var payload = { + hskipBeforeAndAfter: false, + cols: [{ + type: "align", + align: colAlign + }] + }; + if (context.envName.charAt(context.envName.length - 1) === "*") { + var parser29 = context.parser; + parser29.consumeSpaces(); + if (parser29.fetch().text === "[") { + parser29.consume(); + parser29.consumeSpaces(); + colAlign = parser29.fetch().text; + if ("lcr".indexOf(colAlign) === -1) { + throw new ParseError("Expected l or c or r", parser29.nextToken); + } + parser29.consume(); + parser29.consumeSpaces(); + parser29.expect("]"); + parser29.consume(); + payload.cols = [{ + type: "align", + align: colAlign + }]; + } + } + var res = parseArray(context.parser, payload, dCellStyle(context.envName)); + var numCols = Math.max(0, ...res.body.map((row) => row.length)); + res.cols = new Array(numCols).fill({ + type: "align", + align: colAlign + }); + return delimiters2 ? { + type: "leftright", + mode: context.mode, + body: [res], + left: delimiters2[0], + right: delimiters2[1], + rightColor: void 0 + // \right uninfluenced by \color in array + } : res; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineEnvironment({ + type: "array", + names: ["smallmatrix"], + props: { + numArgs: 0 + }, + handler(context) { + var payload = { + arraystretch: 0.5 + }; + var res = parseArray(context.parser, payload, "script"); + res.colSeparationType = "small"; + return res; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineEnvironment({ + type: "array", + names: ["subarray"], + props: { + numArgs: 1 + }, + handler(context, args) { + var symNode = checkSymbolNodeType(args[0]); + var colalign = symNode ? [args[0]] : assertNodeType(args[0], "ordgroup").body; + var cols = colalign.map(function(nde) { + var node2 = assertSymbolNodeType(nde); + var ca = node2.text; + if ("lc".indexOf(ca) !== -1) { + return { + type: "align", + align: ca + }; + } + throw new ParseError("Unknown column alignment: " + ca, nde); + }); + if (cols.length > 1) { + throw new ParseError("{subarray} can contain only one column"); + } + var res = { + cols, + hskipBeforeAndAfter: false, + arraystretch: 0.5 + }; + res = parseArray(context.parser, res, "script"); + if (res.body.length > 0 && res.body[0].length > 1) { + throw new ParseError("{subarray} can contain only one column"); + } + return res; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineEnvironment({ + type: "array", + names: ["cases", "dcases", "rcases", "drcases"], + props: { + numArgs: 0 + }, + handler(context) { + var payload = { + arraystretch: 1.2, + cols: [{ + type: "align", + align: "l", + pregap: 0, + // TODO(kevinb) get the current style. + // For now we use the metrics for TEXT style which is what we were + // doing before. Before attempting to get the current style we + // should look at TeX's behavior especially for \over and matrices. + postgap: 1 + /* 1em quad */ + }, { + type: "align", + align: "l", + pregap: 0, + postgap: 0 + }] + }; + var res = parseArray(context.parser, payload, dCellStyle(context.envName)); + return { + type: "leftright", + mode: context.mode, + body: [res], + left: context.envName.indexOf("r") > -1 ? "." : "\\{", + right: context.envName.indexOf("r") > -1 ? "\\}" : ".", + rightColor: void 0 + }; + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineEnvironment({ + type: "array", + names: ["align", "align*", "aligned", "split"], + props: { + numArgs: 0 + }, + handler: alignedHandler, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineEnvironment({ + type: "array", + names: ["gathered", "gather", "gather*"], + props: { + numArgs: 0 + }, + handler(context) { + if (["gather", "gather*"].includes(context.envName)) { + validateAmsEnvironmentContext(context); + } + var res = { + cols: [{ + type: "align", + align: "c" + }], + addJot: true, + colSeparationType: "gather", + autoTag: getAutoTag(context.envName), + emptySingleRow: true, + leqno: context.parser.settings.leqno + }; + return parseArray(context.parser, res, "display"); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineEnvironment({ + type: "array", + names: ["alignat", "alignat*", "alignedat"], + props: { + numArgs: 1 + }, + handler: alignedHandler, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineEnvironment({ + type: "array", + names: ["equation", "equation*"], + props: { + numArgs: 0 + }, + handler(context) { + validateAmsEnvironmentContext(context); + var res = { + autoTag: getAutoTag(context.envName), + emptySingleRow: true, + singleRow: true, + maxNumCols: 1, + leqno: context.parser.settings.leqno + }; + return parseArray(context.parser, res, "display"); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineEnvironment({ + type: "array", + names: ["CD"], + props: { + numArgs: 0 + }, + handler(context) { + validateAmsEnvironmentContext(context); + return parseCD(context.parser); + }, + htmlBuilder: htmlBuilder$6, + mathmlBuilder: mathmlBuilder$5 + }); + defineMacro("\\nonumber", "\\gdef\\@eqnsw{0}"); + defineMacro("\\notag", "\\nonumber"); + defineFunction({ + type: "text", + // Doesn't matter what this is. + names: ["\\hline", "\\hdashline"], + props: { + numArgs: 0, + allowedInText: true, + allowedInMath: true + }, + handler(context, args) { + throw new ParseError(context.funcName + " valid only within array environment"); + } + }); + environments = _environments; + defineFunction({ + type: "environment", + names: ["\\begin", "\\end"], + props: { + numArgs: 1, + argTypes: ["text"] + }, + handler(_ref, args) { + var { + parser: parser29, + funcName + } = _ref; + var nameGroup = args[0]; + if (nameGroup.type !== "ordgroup") { + throw new ParseError("Invalid environment name", nameGroup); + } + var envName = ""; + for (var i2 = 0; i2 < nameGroup.body.length; ++i2) { + envName += assertNodeType(nameGroup.body[i2], "textord").text; + } + if (funcName === "\\begin") { + if (!environments.hasOwnProperty(envName)) { + throw new ParseError("No such environment: " + envName, nameGroup); + } + var env = environments[envName]; + var { + args: _args, + optArgs + } = parser29.parseArguments("\\begin{" + envName + "}", env); + var context = { + mode: parser29.mode, + envName, + parser: parser29 + }; + var result = env.handler(context, _args, optArgs); + parser29.expect("\\end", false); + var endNameToken = parser29.nextToken; + var end2 = assertNodeType(parser29.parseFunction(), "environment"); + if (end2.name !== envName) { + throw new ParseError("Mismatch: \\begin{" + envName + "} matched by \\end{" + end2.name + "}", endNameToken); + } + return result; + } + return { + type: "environment", + mode: parser29.mode, + name: envName, + nameGroup + }; + } + }); + htmlBuilder$5 = /* @__PURE__ */ __name((group2, options2) => { + var font = group2.font; + var newOptions = options2.withFont(font); + return buildGroup$1(group2.body, newOptions); + }, "htmlBuilder$5"); + mathmlBuilder$4 = /* @__PURE__ */ __name((group2, options2) => { + var font = group2.font; + var newOptions = options2.withFont(font); + return buildGroup2(group2.body, newOptions); + }, "mathmlBuilder$4"); + fontAliases = { + "\\Bbb": "\\mathbb", + "\\bold": "\\mathbf", + "\\frak": "\\mathfrak", + "\\bm": "\\boldsymbol" + }; + defineFunction({ + type: "font", + names: [ + // styles, except \boldsymbol defined below + "\\mathrm", + "\\mathit", + "\\mathbf", + "\\mathnormal", + "\\mathsfit", + // families + "\\mathbb", + "\\mathcal", + "\\mathfrak", + "\\mathscr", + "\\mathsf", + "\\mathtt", + // aliases, except \bm defined below + "\\Bbb", + "\\bold", + "\\frak" + ], + props: { + numArgs: 1, + allowedInArgument: true + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29, + funcName + } = _ref; + var body = normalizeArgument(args[0]); + var func = funcName; + if (func in fontAliases) { + func = fontAliases[func]; + } + return { + type: "font", + mode: parser29.mode, + font: func.slice(1), + body + }; + }, "handler"), + htmlBuilder: htmlBuilder$5, + mathmlBuilder: mathmlBuilder$4 + }); + defineFunction({ + type: "mclass", + names: ["\\boldsymbol", "\\bm"], + props: { + numArgs: 1 + }, + handler: /* @__PURE__ */ __name((_ref2, args) => { + var { + parser: parser29 + } = _ref2; + var body = args[0]; + var isCharacterBox3 = utils.isCharacterBox(body); + return { + type: "mclass", + mode: parser29.mode, + mclass: binrelClass(body), + body: [{ + type: "font", + mode: parser29.mode, + font: "boldsymbol", + body + }], + isCharacterBox: isCharacterBox3 + }; + }, "handler") + }); + defineFunction({ + type: "font", + names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"], + props: { + numArgs: 0, + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref3, args) => { + var { + parser: parser29, + funcName, + breakOnTokenText + } = _ref3; + var { + mode + } = parser29; + var body = parser29.parseExpression(true, breakOnTokenText); + var style3 = "math" + funcName.slice(1); + return { + type: "font", + mode, + font: style3, + body: { + type: "ordgroup", + mode: parser29.mode, + body + } + }; + }, "handler"), + htmlBuilder: htmlBuilder$5, + mathmlBuilder: mathmlBuilder$4 + }); + adjustStyle = /* @__PURE__ */ __name((size4, originalStyle) => { + var style3 = originalStyle; + if (size4 === "display") { + style3 = style3.id >= Style$1.SCRIPT.id ? style3.text() : Style$1.DISPLAY; + } else if (size4 === "text" && style3.size === Style$1.DISPLAY.size) { + style3 = Style$1.TEXT; + } else if (size4 === "script") { + style3 = Style$1.SCRIPT; + } else if (size4 === "scriptscript") { + style3 = Style$1.SCRIPTSCRIPT; + } + return style3; + }, "adjustStyle"); + htmlBuilder$4 = /* @__PURE__ */ __name((group2, options2) => { + var style3 = adjustStyle(group2.size, options2.style); + var nstyle = style3.fracNum(); + var dstyle = style3.fracDen(); + var newOptions; + newOptions = options2.havingStyle(nstyle); + var numerm = buildGroup$1(group2.numer, newOptions, options2); + if (group2.continued) { + var hStrut = 8.5 / options2.fontMetrics().ptPerEm; + var dStrut = 3.5 / options2.fontMetrics().ptPerEm; + numerm.height = numerm.height < hStrut ? hStrut : numerm.height; + numerm.depth = numerm.depth < dStrut ? dStrut : numerm.depth; + } + newOptions = options2.havingStyle(dstyle); + var denomm = buildGroup$1(group2.denom, newOptions, options2); + var rule; + var ruleWidth; + var ruleSpacing; + if (group2.hasBarLine) { + if (group2.barSize) { + ruleWidth = calculateSize2(group2.barSize, options2); + rule = buildCommon.makeLineSpan("frac-line", options2, ruleWidth); + } else { + rule = buildCommon.makeLineSpan("frac-line", options2); + } + ruleWidth = rule.height; + ruleSpacing = rule.height; + } else { + rule = null; + ruleWidth = 0; + ruleSpacing = options2.fontMetrics().defaultRuleThickness; + } + var numShift; + var clearance; + var denomShift; + if (style3.size === Style$1.DISPLAY.size || group2.size === "display") { + numShift = options2.fontMetrics().num1; + if (ruleWidth > 0) { + clearance = 3 * ruleSpacing; + } else { + clearance = 7 * ruleSpacing; + } + denomShift = options2.fontMetrics().denom1; + } else { + if (ruleWidth > 0) { + numShift = options2.fontMetrics().num2; + clearance = ruleSpacing; + } else { + numShift = options2.fontMetrics().num3; + clearance = 3 * ruleSpacing; + } + denomShift = options2.fontMetrics().denom2; + } + var frac; + if (!rule) { + var candidateClearance = numShift - numerm.depth - (denomm.height - denomShift); + if (candidateClearance < clearance) { + numShift += 0.5 * (clearance - candidateClearance); + denomShift += 0.5 * (clearance - candidateClearance); + } + frac = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: denomm, + shift: denomShift + }, { + type: "elem", + elem: numerm, + shift: -numShift + }] + }, options2); + } else { + var axisHeight = options2.fontMetrics().axisHeight; + if (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth) < clearance) { + numShift += clearance - (numShift - numerm.depth - (axisHeight + 0.5 * ruleWidth)); + } + if (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift) < clearance) { + denomShift += clearance - (axisHeight - 0.5 * ruleWidth - (denomm.height - denomShift)); + } + var midShift = -(axisHeight - 0.5 * ruleWidth); + frac = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: denomm, + shift: denomShift + }, { + type: "elem", + elem: rule, + shift: midShift + }, { + type: "elem", + elem: numerm, + shift: -numShift + }] + }, options2); + } + newOptions = options2.havingStyle(style3); + frac.height *= newOptions.sizeMultiplier / options2.sizeMultiplier; + frac.depth *= newOptions.sizeMultiplier / options2.sizeMultiplier; + var delimSize; + if (style3.size === Style$1.DISPLAY.size) { + delimSize = options2.fontMetrics().delim1; + } else if (style3.size === Style$1.SCRIPTSCRIPT.size) { + delimSize = options2.havingStyle(Style$1.SCRIPT).fontMetrics().delim2; + } else { + delimSize = options2.fontMetrics().delim2; + } + var leftDelim; + var rightDelim; + if (group2.leftDelim == null) { + leftDelim = makeNullDelimiter(options2, ["mopen"]); + } else { + leftDelim = delimiter.customSizedDelim(group2.leftDelim, delimSize, true, options2.havingStyle(style3), group2.mode, ["mopen"]); + } + if (group2.continued) { + rightDelim = buildCommon.makeSpan([]); + } else if (group2.rightDelim == null) { + rightDelim = makeNullDelimiter(options2, ["mclose"]); + } else { + rightDelim = delimiter.customSizedDelim(group2.rightDelim, delimSize, true, options2.havingStyle(style3), group2.mode, ["mclose"]); + } + return buildCommon.makeSpan(["mord"].concat(newOptions.sizingClasses(options2)), [leftDelim, buildCommon.makeSpan(["mfrac"], [frac]), rightDelim], options2); + }, "htmlBuilder$4"); + mathmlBuilder$3 = /* @__PURE__ */ __name((group2, options2) => { + var node2 = new mathMLTree.MathNode("mfrac", [buildGroup2(group2.numer, options2), buildGroup2(group2.denom, options2)]); + if (!group2.hasBarLine) { + node2.setAttribute("linethickness", "0px"); + } else if (group2.barSize) { + var ruleWidth = calculateSize2(group2.barSize, options2); + node2.setAttribute("linethickness", makeEm(ruleWidth)); + } + var style3 = adjustStyle(group2.size, options2.style); + if (style3.size !== options2.style.size) { + node2 = new mathMLTree.MathNode("mstyle", [node2]); + var isDisplay = style3.size === Style$1.DISPLAY.size ? "true" : "false"; + node2.setAttribute("displaystyle", isDisplay); + node2.setAttribute("scriptlevel", "0"); + } + if (group2.leftDelim != null || group2.rightDelim != null) { + var withDelims = []; + if (group2.leftDelim != null) { + var leftOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group2.leftDelim.replace("\\", ""))]); + leftOp.setAttribute("fence", "true"); + withDelims.push(leftOp); + } + withDelims.push(node2); + if (group2.rightDelim != null) { + var rightOp = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode(group2.rightDelim.replace("\\", ""))]); + rightOp.setAttribute("fence", "true"); + withDelims.push(rightOp); + } + return makeRow(withDelims); + } + return node2; + }, "mathmlBuilder$3"); + defineFunction({ + type: "genfrac", + names: [ + "\\dfrac", + "\\frac", + "\\tfrac", + "\\dbinom", + "\\binom", + "\\tbinom", + "\\\\atopfrac", + // can’t be entered directly + "\\\\bracefrac", + "\\\\brackfrac" + // ditto + ], + props: { + numArgs: 2, + allowedInArgument: true + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29, + funcName + } = _ref; + var numer = args[0]; + var denom = args[1]; + var hasBarLine; + var leftDelim = null; + var rightDelim = null; + var size4 = "auto"; + switch (funcName) { + case "\\dfrac": + case "\\frac": + case "\\tfrac": + hasBarLine = true; + break; + case "\\\\atopfrac": + hasBarLine = false; + break; + case "\\dbinom": + case "\\binom": + case "\\tbinom": + hasBarLine = false; + leftDelim = "("; + rightDelim = ")"; + break; + case "\\\\bracefrac": + hasBarLine = false; + leftDelim = "\\{"; + rightDelim = "\\}"; + break; + case "\\\\brackfrac": + hasBarLine = false; + leftDelim = "["; + rightDelim = "]"; + break; + default: + throw new Error("Unrecognized genfrac command"); + } + switch (funcName) { + case "\\dfrac": + case "\\dbinom": + size4 = "display"; + break; + case "\\tfrac": + case "\\tbinom": + size4 = "text"; + break; + } + return { + type: "genfrac", + mode: parser29.mode, + continued: false, + numer, + denom, + hasBarLine, + leftDelim, + rightDelim, + size: size4, + barSize: null + }; + }, "handler"), + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$3 + }); + defineFunction({ + type: "genfrac", + names: ["\\cfrac"], + props: { + numArgs: 2 + }, + handler: /* @__PURE__ */ __name((_ref2, args) => { + var { + parser: parser29, + funcName + } = _ref2; + var numer = args[0]; + var denom = args[1]; + return { + type: "genfrac", + mode: parser29.mode, + continued: true, + numer, + denom, + hasBarLine: true, + leftDelim: null, + rightDelim: null, + size: "display", + barSize: null + }; + }, "handler") + }); + defineFunction({ + type: "infix", + names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], + props: { + numArgs: 0, + infix: true + }, + handler(_ref3) { + var { + parser: parser29, + funcName, + token: token2 + } = _ref3; + var replaceWith; + switch (funcName) { + case "\\over": + replaceWith = "\\frac"; + break; + case "\\choose": + replaceWith = "\\binom"; + break; + case "\\atop": + replaceWith = "\\\\atopfrac"; + break; + case "\\brace": + replaceWith = "\\\\bracefrac"; + break; + case "\\brack": + replaceWith = "\\\\brackfrac"; + break; + default: + throw new Error("Unrecognized infix genfrac command"); + } + return { + type: "infix", + mode: parser29.mode, + replaceWith, + token: token2 + }; + } + }); + stylArray = ["display", "text", "script", "scriptscript"]; + delimFromValue = /* @__PURE__ */ __name(function delimFromValue2(delimString) { + var delim = null; + if (delimString.length > 0) { + delim = delimString; + delim = delim === "." ? null : delim; + } + return delim; + }, "delimFromValue"); + defineFunction({ + type: "genfrac", + names: ["\\genfrac"], + props: { + numArgs: 6, + allowedInArgument: true, + argTypes: ["math", "math", "size", "text", "math", "math"] + }, + handler(_ref4, args) { + var { + parser: parser29 + } = _ref4; + var numer = args[4]; + var denom = args[5]; + var leftNode = normalizeArgument(args[0]); + var leftDelim = leftNode.type === "atom" && leftNode.family === "open" ? delimFromValue(leftNode.text) : null; + var rightNode = normalizeArgument(args[1]); + var rightDelim = rightNode.type === "atom" && rightNode.family === "close" ? delimFromValue(rightNode.text) : null; + var barNode = assertNodeType(args[2], "size"); + var hasBarLine; + var barSize = null; + if (barNode.isBlank) { + hasBarLine = true; + } else { + barSize = barNode.value; + hasBarLine = barSize.number > 0; + } + var size4 = "auto"; + var styl = args[3]; + if (styl.type === "ordgroup") { + if (styl.body.length > 0) { + var textOrd = assertNodeType(styl.body[0], "textord"); + size4 = stylArray[Number(textOrd.text)]; + } + } else { + styl = assertNodeType(styl, "textord"); + size4 = stylArray[Number(styl.text)]; + } + return { + type: "genfrac", + mode: parser29.mode, + numer, + denom, + continued: false, + hasBarLine, + barSize, + leftDelim, + rightDelim, + size: size4 + }; + }, + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$3 + }); + defineFunction({ + type: "infix", + names: ["\\above"], + props: { + numArgs: 1, + argTypes: ["size"], + infix: true + }, + handler(_ref5, args) { + var { + parser: parser29, + funcName, + token: token2 + } = _ref5; + return { + type: "infix", + mode: parser29.mode, + replaceWith: "\\\\abovefrac", + size: assertNodeType(args[0], "size").value, + token: token2 + }; + } + }); + defineFunction({ + type: "genfrac", + names: ["\\\\abovefrac"], + props: { + numArgs: 3, + argTypes: ["math", "size", "math"] + }, + handler: /* @__PURE__ */ __name((_ref6, args) => { + var { + parser: parser29, + funcName + } = _ref6; + var numer = args[0]; + var barSize = assert(assertNodeType(args[1], "infix").size); + var denom = args[2]; + var hasBarLine = barSize.number > 0; + return { + type: "genfrac", + mode: parser29.mode, + numer, + denom, + continued: false, + hasBarLine, + barSize, + leftDelim: null, + rightDelim: null, + size: "auto" + }; + }, "handler"), + htmlBuilder: htmlBuilder$4, + mathmlBuilder: mathmlBuilder$3 + }); + htmlBuilder$3 = /* @__PURE__ */ __name((grp, options2) => { + var style3 = options2.style; + var supSubGroup; + var group2; + if (grp.type === "supsub") { + supSubGroup = grp.sup ? buildGroup$1(grp.sup, options2.havingStyle(style3.sup()), options2) : buildGroup$1(grp.sub, options2.havingStyle(style3.sub()), options2); + group2 = assertNodeType(grp.base, "horizBrace"); + } else { + group2 = assertNodeType(grp, "horizBrace"); + } + var body = buildGroup$1(group2.base, options2.havingBaseStyle(Style$1.DISPLAY)); + var braceBody = stretchy.svgSpan(group2, options2); + var vlist; + if (group2.isOver) { + vlist = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: body + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: braceBody + }] + }, options2); + vlist.children[0].children[0].children[1].classes.push("svg-align"); + } else { + vlist = buildCommon.makeVList({ + positionType: "bottom", + positionData: body.depth + 0.1 + braceBody.height, + children: [{ + type: "elem", + elem: braceBody + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: body + }] + }, options2); + vlist.children[0].children[0].children[0].classes.push("svg-align"); + } + if (supSubGroup) { + var vSpan = buildCommon.makeSpan(["mord", group2.isOver ? "mover" : "munder"], [vlist], options2); + if (group2.isOver) { + vlist = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: vSpan + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: supSubGroup + }] + }, options2); + } else { + vlist = buildCommon.makeVList({ + positionType: "bottom", + positionData: vSpan.depth + 0.2 + supSubGroup.height + supSubGroup.depth, + children: [{ + type: "elem", + elem: supSubGroup + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: vSpan + }] + }, options2); + } + } + return buildCommon.makeSpan(["mord", group2.isOver ? "mover" : "munder"], [vlist], options2); + }, "htmlBuilder$3"); + mathmlBuilder$2 = /* @__PURE__ */ __name((group2, options2) => { + var accentNode = stretchy.mathMLnode(group2.label); + return new mathMLTree.MathNode(group2.isOver ? "mover" : "munder", [buildGroup2(group2.base, options2), accentNode]); + }, "mathmlBuilder$2"); + defineFunction({ + type: "horizBrace", + names: ["\\overbrace", "\\underbrace"], + props: { + numArgs: 1 + }, + handler(_ref, args) { + var { + parser: parser29, + funcName + } = _ref; + return { + type: "horizBrace", + mode: parser29.mode, + label: funcName, + isOver: /^\\over/.test(funcName), + base: args[0] + }; + }, + htmlBuilder: htmlBuilder$3, + mathmlBuilder: mathmlBuilder$2 + }); + defineFunction({ + type: "href", + names: ["\\href"], + props: { + numArgs: 2, + argTypes: ["url", "original"], + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29 + } = _ref; + var body = args[1]; + var href = assertNodeType(args[0], "url").url; + if (!parser29.settings.isTrusted({ + command: "\\href", + url: href + })) { + return parser29.formatUnsupportedCmd("\\href"); + } + return { + type: "href", + mode: parser29.mode, + href, + body: ordargument(body) + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var elements2 = buildExpression$1(group2.body, options2, false); + return buildCommon.makeAnchor(group2.href, [], elements2, options2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var math2 = buildExpressionRow(group2.body, options2); + if (!(math2 instanceof MathNode)) { + math2 = new MathNode("mrow", [math2]); + } + math2.setAttribute("href", group2.href); + return math2; + }, "mathmlBuilder") + }); + defineFunction({ + type: "href", + names: ["\\url"], + props: { + numArgs: 1, + argTypes: ["url"], + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref2, args) => { + var { + parser: parser29 + } = _ref2; + var href = assertNodeType(args[0], "url").url; + if (!parser29.settings.isTrusted({ + command: "\\url", + url: href + })) { + return parser29.formatUnsupportedCmd("\\url"); + } + var chars = []; + for (var i2 = 0; i2 < href.length; i2++) { + var c3 = href[i2]; + if (c3 === "~") { + c3 = "\\textasciitilde"; + } + chars.push({ + type: "textord", + mode: "text", + text: c3 + }); + } + var body = { + type: "text", + mode: parser29.mode, + font: "\\texttt", + body: chars + }; + return { + type: "href", + mode: parser29.mode, + href, + body: ordargument(body) + }; + }, "handler") + }); + defineFunction({ + type: "hbox", + names: ["\\hbox"], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInText: true, + primitive: true + }, + handler(_ref, args) { + var { + parser: parser29 + } = _ref; + return { + type: "hbox", + mode: parser29.mode, + body: ordargument(args[0]) + }; + }, + htmlBuilder(group2, options2) { + var elements2 = buildExpression$1(group2.body, options2, false); + return buildCommon.makeFragment(elements2); + }, + mathmlBuilder(group2, options2) { + return new mathMLTree.MathNode("mrow", buildExpression2(group2.body, options2)); + } + }); + defineFunction({ + type: "html", + names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"], + props: { + numArgs: 2, + argTypes: ["raw", "original"], + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29, + funcName, + token: token2 + } = _ref; + var value2 = assertNodeType(args[0], "raw").string; + var body = args[1]; + if (parser29.settings.strict) { + parser29.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode"); + } + var trustContext; + var attributes = {}; + switch (funcName) { + case "\\htmlClass": + attributes.class = value2; + trustContext = { + command: "\\htmlClass", + class: value2 + }; + break; + case "\\htmlId": + attributes.id = value2; + trustContext = { + command: "\\htmlId", + id: value2 + }; + break; + case "\\htmlStyle": + attributes.style = value2; + trustContext = { + command: "\\htmlStyle", + style: value2 + }; + break; + case "\\htmlData": { + var data5 = value2.split(","); + for (var i2 = 0; i2 < data5.length; i2++) { + var keyVal = data5[i2].split("="); + if (keyVal.length !== 2) { + throw new ParseError("Error parsing key-value for \\htmlData"); + } + attributes["data-" + keyVal[0].trim()] = keyVal[1].trim(); + } + trustContext = { + command: "\\htmlData", + attributes + }; + break; + } + default: + throw new Error("Unrecognized html command"); + } + if (!parser29.settings.isTrusted(trustContext)) { + return parser29.formatUnsupportedCmd(funcName); + } + return { + type: "html", + mode: parser29.mode, + attributes, + body: ordargument(body) + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var elements2 = buildExpression$1(group2.body, options2, false); + var classes3 = ["enclosing"]; + if (group2.attributes.class) { + classes3.push(...group2.attributes.class.trim().split(/\s+/)); + } + var span = buildCommon.makeSpan(classes3, elements2, options2); + for (var attr in group2.attributes) { + if (attr !== "class" && group2.attributes.hasOwnProperty(attr)) { + span.setAttribute(attr, group2.attributes[attr]); + } + } + return span; + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + return buildExpressionRow(group2.body, options2); + }, "mathmlBuilder") + }); + defineFunction({ + type: "htmlmathml", + names: ["\\html@mathml"], + props: { + numArgs: 2, + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29 + } = _ref; + return { + type: "htmlmathml", + mode: parser29.mode, + html: ordargument(args[0]), + mathml: ordargument(args[1]) + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var elements2 = buildExpression$1(group2.html, options2, false); + return buildCommon.makeFragment(elements2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + return buildExpressionRow(group2.mathml, options2); + }, "mathmlBuilder") + }); + sizeData = /* @__PURE__ */ __name(function sizeData2(str2) { + if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(str2)) { + return { + number: +str2, + unit: "bp" + }; + } else { + var match3 = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(str2); + if (!match3) { + throw new ParseError("Invalid size: '" + str2 + "' in \\includegraphics"); + } + var data5 = { + number: +(match3[1] + match3[2]), + // sign + magnitude, cast to number + unit: match3[3] + }; + if (!validUnit(data5)) { + throw new ParseError("Invalid unit: '" + data5.unit + "' in \\includegraphics."); + } + return data5; + } + }, "sizeData"); + defineFunction({ + type: "includegraphics", + names: ["\\includegraphics"], + props: { + numArgs: 1, + numOptionalArgs: 1, + argTypes: ["raw", "url"], + allowedInText: false + }, + handler: /* @__PURE__ */ __name((_ref, args, optArgs) => { + var { + parser: parser29 + } = _ref; + var width3 = { + number: 0, + unit: "em" + }; + var height2 = { + number: 0.9, + unit: "em" + }; + var totalheight = { + number: 0, + unit: "em" + }; + var alt = ""; + if (optArgs[0]) { + var attributeStr = assertNodeType(optArgs[0], "raw").string; + var attributes = attributeStr.split(","); + for (var i2 = 0; i2 < attributes.length; i2++) { + var keyVal = attributes[i2].split("="); + if (keyVal.length === 2) { + var str2 = keyVal[1].trim(); + switch (keyVal[0].trim()) { + case "alt": + alt = str2; + break; + case "width": + width3 = sizeData(str2); + break; + case "height": + height2 = sizeData(str2); + break; + case "totalheight": + totalheight = sizeData(str2); + break; + default: + throw new ParseError("Invalid key: '" + keyVal[0] + "' in \\includegraphics."); + } + } + } + } + var src = assertNodeType(args[0], "url").url; + if (alt === "") { + alt = src; + alt = alt.replace(/^.*[\\/]/, ""); + alt = alt.substring(0, alt.lastIndexOf(".")); + } + if (!parser29.settings.isTrusted({ + command: "\\includegraphics", + url: src + })) { + return parser29.formatUnsupportedCmd("\\includegraphics"); + } + return { + type: "includegraphics", + mode: parser29.mode, + alt, + width: width3, + height: height2, + totalheight, + src + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var height2 = calculateSize2(group2.height, options2); + var depth = 0; + if (group2.totalheight.number > 0) { + depth = calculateSize2(group2.totalheight, options2) - height2; + } + var width3 = 0; + if (group2.width.number > 0) { + width3 = calculateSize2(group2.width, options2); + } + var style3 = { + height: makeEm(height2 + depth) + }; + if (width3 > 0) { + style3.width = makeEm(width3); + } + if (depth > 0) { + style3.verticalAlign = makeEm(-depth); + } + var node2 = new Img(group2.src, group2.alt, style3); + node2.height = height2; + node2.depth = depth; + return node2; + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var node2 = new mathMLTree.MathNode("mglyph", []); + node2.setAttribute("alt", group2.alt); + var height2 = calculateSize2(group2.height, options2); + var depth = 0; + if (group2.totalheight.number > 0) { + depth = calculateSize2(group2.totalheight, options2) - height2; + node2.setAttribute("valign", makeEm(-depth)); + } + node2.setAttribute("height", makeEm(height2 + depth)); + if (group2.width.number > 0) { + var width3 = calculateSize2(group2.width, options2); + node2.setAttribute("width", makeEm(width3)); + } + node2.setAttribute("src", group2.src); + return node2; + }, "mathmlBuilder") + }); + defineFunction({ + type: "kern", + names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], + props: { + numArgs: 1, + argTypes: ["size"], + primitive: true, + allowedInText: true + }, + handler(_ref, args) { + var { + parser: parser29, + funcName + } = _ref; + var size4 = assertNodeType(args[0], "size"); + if (parser29.settings.strict) { + var mathFunction = funcName[1] === "m"; + var muUnit = size4.value.unit === "mu"; + if (mathFunction) { + if (!muUnit) { + parser29.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " supports only mu units, " + ("not " + size4.value.unit + " units")); + } + if (parser29.mode !== "math") { + parser29.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " works only in math mode"); + } + } else { + if (muUnit) { + parser29.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + funcName + " doesn't support mu units"); + } + } + } + return { + type: "kern", + mode: parser29.mode, + dimension: size4.value + }; + }, + htmlBuilder(group2, options2) { + return buildCommon.makeGlue(group2.dimension, options2); + }, + mathmlBuilder(group2, options2) { + var dimension = calculateSize2(group2.dimension, options2); + return new mathMLTree.SpaceNode(dimension); + } + }); + defineFunction({ + type: "lap", + names: ["\\mathllap", "\\mathrlap", "\\mathclap"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29, + funcName + } = _ref; + var body = args[0]; + return { + type: "lap", + mode: parser29.mode, + alignment: funcName.slice(5), + body + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var inner2; + if (group2.alignment === "clap") { + inner2 = buildCommon.makeSpan([], [buildGroup$1(group2.body, options2)]); + inner2 = buildCommon.makeSpan(["inner"], [inner2], options2); + } else { + inner2 = buildCommon.makeSpan(["inner"], [buildGroup$1(group2.body, options2)]); + } + var fix = buildCommon.makeSpan(["fix"], []); + var node2 = buildCommon.makeSpan([group2.alignment], [inner2, fix], options2); + var strut = buildCommon.makeSpan(["strut"]); + strut.style.height = makeEm(node2.height + node2.depth); + if (node2.depth) { + strut.style.verticalAlign = makeEm(-node2.depth); + } + node2.children.unshift(strut); + node2 = buildCommon.makeSpan(["thinbox"], [node2], options2); + return buildCommon.makeSpan(["mord", "vbox"], [node2], options2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var node2 = new mathMLTree.MathNode("mpadded", [buildGroup2(group2.body, options2)]); + if (group2.alignment !== "rlap") { + var offset = group2.alignment === "llap" ? "-1" : "-0.5"; + node2.setAttribute("lspace", offset + "width"); + } + node2.setAttribute("width", "0px"); + return node2; + }, "mathmlBuilder") + }); + defineFunction({ + type: "styling", + names: ["\\(", "$"], + props: { + numArgs: 0, + allowedInText: true, + allowedInMath: false + }, + handler(_ref, args) { + var { + funcName, + parser: parser29 + } = _ref; + var outerMode = parser29.mode; + parser29.switchMode("math"); + var close2 = funcName === "\\(" ? "\\)" : "$"; + var body = parser29.parseExpression(false, close2); + parser29.expect(close2); + parser29.switchMode(outerMode); + return { + type: "styling", + mode: parser29.mode, + style: "text", + body + }; + } + }); + defineFunction({ + type: "text", + // Doesn't matter what this is. + names: ["\\)", "\\]"], + props: { + numArgs: 0, + allowedInText: true, + allowedInMath: false + }, + handler(context, args) { + throw new ParseError("Mismatched " + context.funcName); + } + }); + chooseMathStyle = /* @__PURE__ */ __name((group2, options2) => { + switch (options2.style.size) { + case Style$1.DISPLAY.size: + return group2.display; + case Style$1.TEXT.size: + return group2.text; + case Style$1.SCRIPT.size: + return group2.script; + case Style$1.SCRIPTSCRIPT.size: + return group2.scriptscript; + default: + return group2.text; + } + }, "chooseMathStyle"); + defineFunction({ + type: "mathchoice", + names: ["\\mathchoice"], + props: { + numArgs: 4, + primitive: true + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29 + } = _ref; + return { + type: "mathchoice", + mode: parser29.mode, + display: ordargument(args[0]), + text: ordargument(args[1]), + script: ordargument(args[2]), + scriptscript: ordargument(args[3]) + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var body = chooseMathStyle(group2, options2); + var elements2 = buildExpression$1(body, options2, false); + return buildCommon.makeFragment(elements2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var body = chooseMathStyle(group2, options2); + return buildExpressionRow(body, options2); + }, "mathmlBuilder") + }); + assembleSupSub = /* @__PURE__ */ __name((base, supGroup, subGroup, options2, style3, slant, baseShift) => { + base = buildCommon.makeSpan([], [base]); + var subIsSingleCharacter = subGroup && utils.isCharacterBox(subGroup); + var sub2; + var sup2; + if (supGroup) { + var elem = buildGroup$1(supGroup, options2.havingStyle(style3.sup()), options2); + sup2 = { + elem, + kern: Math.max(options2.fontMetrics().bigOpSpacing1, options2.fontMetrics().bigOpSpacing3 - elem.depth) + }; + } + if (subGroup) { + var _elem = buildGroup$1(subGroup, options2.havingStyle(style3.sub()), options2); + sub2 = { + elem: _elem, + kern: Math.max(options2.fontMetrics().bigOpSpacing2, options2.fontMetrics().bigOpSpacing4 - _elem.height) + }; + } + var finalGroup; + if (sup2 && sub2) { + var bottom2 = options2.fontMetrics().bigOpSpacing5 + sub2.elem.height + sub2.elem.depth + sub2.kern + base.depth + baseShift; + finalGroup = buildCommon.makeVList({ + positionType: "bottom", + positionData: bottom2, + children: [{ + type: "kern", + size: options2.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: sub2.elem, + marginLeft: makeEm(-slant) + }, { + type: "kern", + size: sub2.kern + }, { + type: "elem", + elem: base + }, { + type: "kern", + size: sup2.kern + }, { + type: "elem", + elem: sup2.elem, + marginLeft: makeEm(slant) + }, { + type: "kern", + size: options2.fontMetrics().bigOpSpacing5 + }] + }, options2); + } else if (sub2) { + var top2 = base.height - baseShift; + finalGroup = buildCommon.makeVList({ + positionType: "top", + positionData: top2, + children: [{ + type: "kern", + size: options2.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: sub2.elem, + marginLeft: makeEm(-slant) + }, { + type: "kern", + size: sub2.kern + }, { + type: "elem", + elem: base + }] + }, options2); + } else if (sup2) { + var _bottom = base.depth + baseShift; + finalGroup = buildCommon.makeVList({ + positionType: "bottom", + positionData: _bottom, + children: [{ + type: "elem", + elem: base + }, { + type: "kern", + size: sup2.kern + }, { + type: "elem", + elem: sup2.elem, + marginLeft: makeEm(slant) + }, { + type: "kern", + size: options2.fontMetrics().bigOpSpacing5 + }] + }, options2); + } else { + return base; + } + var parts = [finalGroup]; + if (sub2 && slant !== 0 && !subIsSingleCharacter) { + var spacer = buildCommon.makeSpan(["mspace"], [], options2); + spacer.style.marginRight = makeEm(slant); + parts.unshift(spacer); + } + return buildCommon.makeSpan(["mop", "op-limits"], parts, options2); + }, "assembleSupSub"); + noSuccessor = ["\\smallint"]; + htmlBuilder$2 = /* @__PURE__ */ __name((grp, options2) => { + var supGroup; + var subGroup; + var hasLimits = false; + var group2; + if (grp.type === "supsub") { + supGroup = grp.sup; + subGroup = grp.sub; + group2 = assertNodeType(grp.base, "op"); + hasLimits = true; + } else { + group2 = assertNodeType(grp, "op"); + } + var style3 = options2.style; + var large = false; + if (style3.size === Style$1.DISPLAY.size && group2.symbol && !noSuccessor.includes(group2.name)) { + large = true; + } + var base; + if (group2.symbol) { + var fontName = large ? "Size2-Regular" : "Size1-Regular"; + var stash = ""; + if (group2.name === "\\oiint" || group2.name === "\\oiiint") { + stash = group2.name.slice(1); + group2.name = stash === "oiint" ? "\\iint" : "\\iiint"; + } + base = buildCommon.makeSymbol(group2.name, fontName, "math", options2, ["mop", "op-symbol", large ? "large-op" : "small-op"]); + if (stash.length > 0) { + var italic = base.italic; + var oval = buildCommon.staticSvg(stash + "Size" + (large ? "2" : "1"), options2); + base = buildCommon.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: base, + shift: 0 + }, { + type: "elem", + elem: oval, + shift: large ? 0.08 : 0 + }] + }, options2); + group2.name = "\\" + stash; + base.classes.unshift("mop"); + base.italic = italic; + } + } else if (group2.body) { + var inner2 = buildExpression$1(group2.body, options2, true); + if (inner2.length === 1 && inner2[0] instanceof SymbolNode) { + base = inner2[0]; + base.classes[0] = "mop"; + } else { + base = buildCommon.makeSpan(["mop"], inner2, options2); + } + } else { + var output2 = []; + for (var i2 = 1; i2 < group2.name.length; i2++) { + output2.push(buildCommon.mathsym(group2.name[i2], group2.mode, options2)); + } + base = buildCommon.makeSpan(["mop"], output2, options2); + } + var baseShift = 0; + var slant = 0; + if ((base instanceof SymbolNode || group2.name === "\\oiint" || group2.name === "\\oiiint") && !group2.suppressBaseShift) { + baseShift = (base.height - base.depth) / 2 - options2.fontMetrics().axisHeight; + slant = base.italic; + } + if (hasLimits) { + return assembleSupSub(base, supGroup, subGroup, options2, style3, slant, baseShift); + } else { + if (baseShift) { + base.style.position = "relative"; + base.style.top = makeEm(baseShift); + } + return base; + } + }, "htmlBuilder$2"); + mathmlBuilder$1 = /* @__PURE__ */ __name((group2, options2) => { + var node2; + if (group2.symbol) { + node2 = new MathNode("mo", [makeText(group2.name, group2.mode)]); + if (noSuccessor.includes(group2.name)) { + node2.setAttribute("largeop", "false"); + } + } else if (group2.body) { + node2 = new MathNode("mo", buildExpression2(group2.body, options2)); + } else { + node2 = new MathNode("mi", [new TextNode(group2.name.slice(1))]); + var operator = new MathNode("mo", [makeText("\u2061", "text")]); + if (group2.parentIsSupSub) { + node2 = new MathNode("mrow", [node2, operator]); + } else { + node2 = newDocumentFragment([node2, operator]); + } + } + return node2; + }, "mathmlBuilder$1"); + singleCharBigOps = { + "\u220F": "\\prod", + "\u2210": "\\coprod", + "\u2211": "\\sum", + "\u22C0": "\\bigwedge", + "\u22C1": "\\bigvee", + "\u22C2": "\\bigcap", + "\u22C3": "\\bigcup", + "\u2A00": "\\bigodot", + "\u2A01": "\\bigoplus", + "\u2A02": "\\bigotimes", + "\u2A04": "\\biguplus", + "\u2A06": "\\bigsqcup" + }; + defineFunction({ + type: "op", + names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "\u220F", "\u2210", "\u2211", "\u22C0", "\u22C1", "\u22C2", "\u22C3", "\u2A00", "\u2A01", "\u2A02", "\u2A04", "\u2A06"], + props: { + numArgs: 0 + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29, + funcName + } = _ref; + var fName = funcName; + if (fName.length === 1) { + fName = singleCharBigOps[fName]; + } + return { + type: "op", + mode: parser29.mode, + limits: true, + parentIsSupSub: false, + symbol: true, + name: fName + }; + }, "handler"), + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 + }); + defineFunction({ + type: "op", + names: ["\\mathop"], + props: { + numArgs: 1, + primitive: true + }, + handler: /* @__PURE__ */ __name((_ref2, args) => { + var { + parser: parser29 + } = _ref2; + var body = args[0]; + return { + type: "op", + mode: parser29.mode, + limits: false, + parentIsSupSub: false, + symbol: false, + body: ordargument(body) + }; + }, "handler"), + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 + }); + singleCharIntegrals = { + "\u222B": "\\int", + "\u222C": "\\iint", + "\u222D": "\\iiint", + "\u222E": "\\oint", + "\u222F": "\\oiint", + "\u2230": "\\oiiint" + }; + defineFunction({ + type: "op", + names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], + props: { + numArgs: 0 + }, + handler(_ref3) { + var { + parser: parser29, + funcName + } = _ref3; + return { + type: "op", + mode: parser29.mode, + limits: false, + parentIsSupSub: false, + symbol: false, + name: funcName + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 + }); + defineFunction({ + type: "op", + names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"], + props: { + numArgs: 0 + }, + handler(_ref4) { + var { + parser: parser29, + funcName + } = _ref4; + return { + type: "op", + mode: parser29.mode, + limits: true, + parentIsSupSub: false, + symbol: false, + name: funcName + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 + }); + defineFunction({ + type: "op", + names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "\u222B", "\u222C", "\u222D", "\u222E", "\u222F", "\u2230"], + props: { + numArgs: 0 + }, + handler(_ref5) { + var { + parser: parser29, + funcName + } = _ref5; + var fName = funcName; + if (fName.length === 1) { + fName = singleCharIntegrals[fName]; + } + return { + type: "op", + mode: parser29.mode, + limits: false, + parentIsSupSub: false, + symbol: true, + name: fName + }; + }, + htmlBuilder: htmlBuilder$2, + mathmlBuilder: mathmlBuilder$1 + }); + htmlBuilder$1 = /* @__PURE__ */ __name((grp, options2) => { + var supGroup; + var subGroup; + var hasLimits = false; + var group2; + if (grp.type === "supsub") { + supGroup = grp.sup; + subGroup = grp.sub; + group2 = assertNodeType(grp.base, "operatorname"); + hasLimits = true; + } else { + group2 = assertNodeType(grp, "operatorname"); + } + var base; + if (group2.body.length > 0) { + var body = group2.body.map((child2) => { + var childText = child2.text; + if (typeof childText === "string") { + return { + type: "textord", + mode: child2.mode, + text: childText + }; + } else { + return child2; + } + }); + var expression = buildExpression$1(body, options2.withFont("mathrm"), true); + for (var i2 = 0; i2 < expression.length; i2++) { + var child = expression[i2]; + if (child instanceof SymbolNode) { + child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); + } + } + base = buildCommon.makeSpan(["mop"], expression, options2); + } else { + base = buildCommon.makeSpan(["mop"], [], options2); + } + if (hasLimits) { + return assembleSupSub(base, supGroup, subGroup, options2, options2.style, 0, 0); + } else { + return base; + } + }, "htmlBuilder$1"); + mathmlBuilder2 = /* @__PURE__ */ __name((group2, options2) => { + var expression = buildExpression2(group2.body, options2.withFont("mathrm")); + var isAllString = true; + for (var i2 = 0; i2 < expression.length; i2++) { + var node2 = expression[i2]; + if (node2 instanceof mathMLTree.SpaceNode) ; + else if (node2 instanceof mathMLTree.MathNode) { + switch (node2.type) { + case "mi": + case "mn": + case "ms": + case "mspace": + case "mtext": + break; + // Do nothing yet. + case "mo": { + var child = node2.children[0]; + if (node2.children.length === 1 && child instanceof mathMLTree.TextNode) { + child.text = child.text.replace(/\u2212/, "-").replace(/\u2217/, "*"); + } else { + isAllString = false; + } + break; + } + default: + isAllString = false; + } + } else { + isAllString = false; + } + } + if (isAllString) { + var word = expression.map((node3) => node3.toText()).join(""); + expression = [new mathMLTree.TextNode(word)]; + } + var identifier2 = new mathMLTree.MathNode("mi", expression); + identifier2.setAttribute("mathvariant", "normal"); + var operator = new mathMLTree.MathNode("mo", [makeText("\u2061", "text")]); + if (group2.parentIsSupSub) { + return new mathMLTree.MathNode("mrow", [identifier2, operator]); + } else { + return mathMLTree.newDocumentFragment([identifier2, operator]); + } + }, "mathmlBuilder"); + defineFunction({ + type: "operatorname", + names: ["\\operatorname@", "\\operatornamewithlimits"], + props: { + numArgs: 1 + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29, + funcName + } = _ref; + var body = args[0]; + return { + type: "operatorname", + mode: parser29.mode, + body: ordargument(body), + alwaysHandleSupSub: funcName === "\\operatornamewithlimits", + limits: false, + parentIsSupSub: false + }; + }, "handler"), + htmlBuilder: htmlBuilder$1, + mathmlBuilder: mathmlBuilder2 + }); + defineMacro("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@"); + defineFunctionBuilders({ + type: "ordgroup", + htmlBuilder(group2, options2) { + if (group2.semisimple) { + return buildCommon.makeFragment(buildExpression$1(group2.body, options2, false)); + } + return buildCommon.makeSpan(["mord"], buildExpression$1(group2.body, options2, true), options2); + }, + mathmlBuilder(group2, options2) { + return buildExpressionRow(group2.body, options2, true); + } + }); + defineFunction({ + type: "overline", + names: ["\\overline"], + props: { + numArgs: 1 + }, + handler(_ref, args) { + var { + parser: parser29 + } = _ref; + var body = args[0]; + return { + type: "overline", + mode: parser29.mode, + body + }; + }, + htmlBuilder(group2, options2) { + var innerGroup = buildGroup$1(group2.body, options2.havingCrampedStyle()); + var line2 = buildCommon.makeLineSpan("overline-line", options2); + var defaultRuleThickness = options2.fontMetrics().defaultRuleThickness; + var vlist = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: innerGroup + }, { + type: "kern", + size: 3 * defaultRuleThickness + }, { + type: "elem", + elem: line2 + }, { + type: "kern", + size: defaultRuleThickness + }] + }, options2); + return buildCommon.makeSpan(["mord", "overline"], [vlist], options2); + }, + mathmlBuilder(group2, options2) { + var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]); + operator.setAttribute("stretchy", "true"); + var node2 = new mathMLTree.MathNode("mover", [buildGroup2(group2.body, options2), operator]); + node2.setAttribute("accent", "true"); + return node2; + } + }); + defineFunction({ + type: "phantom", + names: ["\\phantom"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + parser: parser29 + } = _ref; + var body = args[0]; + return { + type: "phantom", + mode: parser29.mode, + body: ordargument(body) + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var elements2 = buildExpression$1(group2.body, options2.withPhantom(), false); + return buildCommon.makeFragment(elements2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var inner2 = buildExpression2(group2.body, options2); + return new mathMLTree.MathNode("mphantom", inner2); + }, "mathmlBuilder") + }); + defineFunction({ + type: "hphantom", + names: ["\\hphantom"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref2, args) => { + var { + parser: parser29 + } = _ref2; + var body = args[0]; + return { + type: "hphantom", + mode: parser29.mode, + body + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var node2 = buildCommon.makeSpan([], [buildGroup$1(group2.body, options2.withPhantom())]); + node2.height = 0; + node2.depth = 0; + if (node2.children) { + for (var i2 = 0; i2 < node2.children.length; i2++) { + node2.children[i2].height = 0; + node2.children[i2].depth = 0; + } + } + node2 = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: node2 + }] + }, options2); + return buildCommon.makeSpan(["mord"], [node2], options2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var inner2 = buildExpression2(ordargument(group2.body), options2); + var phantom = new mathMLTree.MathNode("mphantom", inner2); + var node2 = new mathMLTree.MathNode("mpadded", [phantom]); + node2.setAttribute("height", "0px"); + node2.setAttribute("depth", "0px"); + return node2; + }, "mathmlBuilder") + }); + defineFunction({ + type: "vphantom", + names: ["\\vphantom"], + props: { + numArgs: 1, + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref3, args) => { + var { + parser: parser29 + } = _ref3; + var body = args[0]; + return { + type: "vphantom", + mode: parser29.mode, + body + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var inner2 = buildCommon.makeSpan(["inner"], [buildGroup$1(group2.body, options2.withPhantom())]); + var fix = buildCommon.makeSpan(["fix"], []); + return buildCommon.makeSpan(["mord", "rlap"], [inner2, fix], options2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var inner2 = buildExpression2(ordargument(group2.body), options2); + var phantom = new mathMLTree.MathNode("mphantom", inner2); + var node2 = new mathMLTree.MathNode("mpadded", [phantom]); + node2.setAttribute("width", "0px"); + return node2; + }, "mathmlBuilder") + }); + defineFunction({ + type: "raisebox", + names: ["\\raisebox"], + props: { + numArgs: 2, + argTypes: ["size", "hbox"], + allowedInText: true + }, + handler(_ref, args) { + var { + parser: parser29 + } = _ref; + var amount = assertNodeType(args[0], "size").value; + var body = args[1]; + return { + type: "raisebox", + mode: parser29.mode, + dy: amount, + body + }; + }, + htmlBuilder(group2, options2) { + var body = buildGroup$1(group2.body, options2); + var dy = calculateSize2(group2.dy, options2); + return buildCommon.makeVList({ + positionType: "shift", + positionData: -dy, + children: [{ + type: "elem", + elem: body + }] + }, options2); + }, + mathmlBuilder(group2, options2) { + var node2 = new mathMLTree.MathNode("mpadded", [buildGroup2(group2.body, options2)]); + var dy = group2.dy.number + group2.dy.unit; + node2.setAttribute("voffset", dy); + return node2; + } + }); + defineFunction({ + type: "internal", + names: ["\\relax"], + props: { + numArgs: 0, + allowedInText: true, + allowedInArgument: true + }, + handler(_ref) { + var { + parser: parser29 + } = _ref; + return { + type: "internal", + mode: parser29.mode + }; + } + }); + defineFunction({ + type: "rule", + names: ["\\rule"], + props: { + numArgs: 2, + numOptionalArgs: 1, + allowedInText: true, + allowedInMath: true, + argTypes: ["size", "size", "size"] + }, + handler(_ref, args, optArgs) { + var { + parser: parser29 + } = _ref; + var shift2 = optArgs[0]; + var width3 = assertNodeType(args[0], "size"); + var height2 = assertNodeType(args[1], "size"); + return { + type: "rule", + mode: parser29.mode, + shift: shift2 && assertNodeType(shift2, "size").value, + width: width3.value, + height: height2.value + }; + }, + htmlBuilder(group2, options2) { + var rule = buildCommon.makeSpan(["mord", "rule"], [], options2); + var width3 = calculateSize2(group2.width, options2); + var height2 = calculateSize2(group2.height, options2); + var shift2 = group2.shift ? calculateSize2(group2.shift, options2) : 0; + rule.style.borderRightWidth = makeEm(width3); + rule.style.borderTopWidth = makeEm(height2); + rule.style.bottom = makeEm(shift2); + rule.width = width3; + rule.height = height2 + shift2; + rule.depth = -shift2; + rule.maxFontSize = height2 * 1.125 * options2.sizeMultiplier; + return rule; + }, + mathmlBuilder(group2, options2) { + var width3 = calculateSize2(group2.width, options2); + var height2 = calculateSize2(group2.height, options2); + var shift2 = group2.shift ? calculateSize2(group2.shift, options2) : 0; + var color2 = options2.color && options2.getColor() || "black"; + var rule = new mathMLTree.MathNode("mspace"); + rule.setAttribute("mathbackground", color2); + rule.setAttribute("width", makeEm(width3)); + rule.setAttribute("height", makeEm(height2)); + var wrapper = new mathMLTree.MathNode("mpadded", [rule]); + if (shift2 >= 0) { + wrapper.setAttribute("height", makeEm(shift2)); + } else { + wrapper.setAttribute("height", makeEm(shift2)); + wrapper.setAttribute("depth", makeEm(-shift2)); + } + wrapper.setAttribute("voffset", makeEm(shift2)); + return wrapper; + } + }); + __name(sizingGroup, "sizingGroup"); + sizeFuncs = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"]; + htmlBuilder2 = /* @__PURE__ */ __name((group2, options2) => { + var newOptions = options2.havingSize(group2.size); + return sizingGroup(group2.body, newOptions, options2); + }, "htmlBuilder"); + defineFunction({ + type: "sizing", + names: sizeFuncs, + props: { + numArgs: 0, + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref, args) => { + var { + breakOnTokenText, + funcName, + parser: parser29 + } = _ref; + var body = parser29.parseExpression(false, breakOnTokenText); + return { + type: "sizing", + mode: parser29.mode, + // Figure out what size to use based on the list of functions above + size: sizeFuncs.indexOf(funcName) + 1, + body + }; + }, "handler"), + htmlBuilder: htmlBuilder2, + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var newOptions = options2.havingSize(group2.size); + var inner2 = buildExpression2(group2.body, newOptions); + var node2 = new mathMLTree.MathNode("mstyle", inner2); + node2.setAttribute("mathsize", makeEm(newOptions.sizeMultiplier)); + return node2; + }, "mathmlBuilder") + }); + defineFunction({ + type: "smash", + names: ["\\smash"], + props: { + numArgs: 1, + numOptionalArgs: 1, + allowedInText: true + }, + handler: /* @__PURE__ */ __name((_ref, args, optArgs) => { + var { + parser: parser29 + } = _ref; + var smashHeight = false; + var smashDepth = false; + var tbArg = optArgs[0] && assertNodeType(optArgs[0], "ordgroup"); + if (tbArg) { + var letter = ""; + for (var i2 = 0; i2 < tbArg.body.length; ++i2) { + var node2 = tbArg.body[i2]; + letter = node2.text; + if (letter === "t") { + smashHeight = true; + } else if (letter === "b") { + smashDepth = true; + } else { + smashHeight = false; + smashDepth = false; + break; + } + } + } else { + smashHeight = true; + smashDepth = true; + } + var body = args[0]; + return { + type: "smash", + mode: parser29.mode, + body, + smashHeight, + smashDepth + }; + }, "handler"), + htmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var node2 = buildCommon.makeSpan([], [buildGroup$1(group2.body, options2)]); + if (!group2.smashHeight && !group2.smashDepth) { + return node2; + } + if (group2.smashHeight) { + node2.height = 0; + if (node2.children) { + for (var i2 = 0; i2 < node2.children.length; i2++) { + node2.children[i2].height = 0; + } + } + } + if (group2.smashDepth) { + node2.depth = 0; + if (node2.children) { + for (var _i = 0; _i < node2.children.length; _i++) { + node2.children[_i].depth = 0; + } + } + } + var smashedNode = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: node2 + }] + }, options2); + return buildCommon.makeSpan(["mord"], [smashedNode], options2); + }, "htmlBuilder"), + mathmlBuilder: /* @__PURE__ */ __name((group2, options2) => { + var node2 = new mathMLTree.MathNode("mpadded", [buildGroup2(group2.body, options2)]); + if (group2.smashHeight) { + node2.setAttribute("height", "0px"); + } + if (group2.smashDepth) { + node2.setAttribute("depth", "0px"); + } + return node2; + }, "mathmlBuilder") + }); + defineFunction({ + type: "sqrt", + names: ["\\sqrt"], + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + handler(_ref, args, optArgs) { + var { + parser: parser29 + } = _ref; + var index = optArgs[0]; + var body = args[0]; + return { + type: "sqrt", + mode: parser29.mode, + body, + index + }; + }, + htmlBuilder(group2, options2) { + var inner2 = buildGroup$1(group2.body, options2.havingCrampedStyle()); + if (inner2.height === 0) { + inner2.height = options2.fontMetrics().xHeight; + } + inner2 = buildCommon.wrapFragment(inner2, options2); + var metrics = options2.fontMetrics(); + var theta = metrics.defaultRuleThickness; + var phi2 = theta; + if (options2.style.id < Style$1.TEXT.id) { + phi2 = options2.fontMetrics().xHeight; + } + var lineClearance = theta + phi2 / 4; + var minDelimiterHeight = inner2.height + inner2.depth + lineClearance + theta; + var { + span: img, + ruleWidth, + advanceWidth + } = delimiter.sqrtImage(minDelimiterHeight, options2); + var delimDepth = img.height - ruleWidth; + if (delimDepth > inner2.height + inner2.depth + lineClearance) { + lineClearance = (lineClearance + delimDepth - inner2.height - inner2.depth) / 2; + } + var imgShift = img.height - inner2.height - lineClearance - ruleWidth; + inner2.style.paddingLeft = makeEm(advanceWidth); + var body = buildCommon.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: inner2, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: -(inner2.height + imgShift) + }, { + type: "elem", + elem: img + }, { + type: "kern", + size: ruleWidth + }] + }, options2); + if (!group2.index) { + return buildCommon.makeSpan(["mord", "sqrt"], [body], options2); + } else { + var newOptions = options2.havingStyle(Style$1.SCRIPTSCRIPT); + var rootm = buildGroup$1(group2.index, newOptions, options2); + var toShift = 0.6 * (body.height - body.depth); + var rootVList = buildCommon.makeVList({ + positionType: "shift", + positionData: -toShift, + children: [{ + type: "elem", + elem: rootm + }] + }, options2); + var rootVListWrap = buildCommon.makeSpan(["root"], [rootVList]); + return buildCommon.makeSpan(["mord", "sqrt"], [rootVListWrap, body], options2); + } + }, + mathmlBuilder(group2, options2) { + var { + body, + index + } = group2; + return index ? new mathMLTree.MathNode("mroot", [buildGroup2(body, options2), buildGroup2(index, options2)]) : new mathMLTree.MathNode("msqrt", [buildGroup2(body, options2)]); + } + }); + styleMap = { + "display": Style$1.DISPLAY, + "text": Style$1.TEXT, + "script": Style$1.SCRIPT, + "scriptscript": Style$1.SCRIPTSCRIPT + }; + defineFunction({ + type: "styling", + names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], + props: { + numArgs: 0, + allowedInText: true, + primitive: true + }, + handler(_ref, args) { + var { + breakOnTokenText, + funcName, + parser: parser29 + } = _ref; + var body = parser29.parseExpression(true, breakOnTokenText); + var style3 = funcName.slice(1, funcName.length - 5); + return { + type: "styling", + mode: parser29.mode, + // Figure out what style to use by pulling out the style from + // the function name + style: style3, + body + }; + }, + htmlBuilder(group2, options2) { + var newStyle = styleMap[group2.style]; + var newOptions = options2.havingStyle(newStyle).withFont(""); + return sizingGroup(group2.body, newOptions, options2); + }, + mathmlBuilder(group2, options2) { + var newStyle = styleMap[group2.style]; + var newOptions = options2.havingStyle(newStyle); + var inner2 = buildExpression2(group2.body, newOptions); + var node2 = new mathMLTree.MathNode("mstyle", inner2); + var styleAttributes = { + "display": ["0", "true"], + "text": ["0", "false"], + "script": ["1", "false"], + "scriptscript": ["2", "false"] + }; + var attr = styleAttributes[group2.style]; + node2.setAttribute("scriptlevel", attr[0]); + node2.setAttribute("displaystyle", attr[1]); + return node2; + } + }); + htmlBuilderDelegate = /* @__PURE__ */ __name(function htmlBuilderDelegate2(group2, options2) { + var base = group2.base; + if (!base) { + return null; + } else if (base.type === "op") { + var delegate = base.limits && (options2.style.size === Style$1.DISPLAY.size || base.alwaysHandleSupSub); + return delegate ? htmlBuilder$2 : null; + } else if (base.type === "operatorname") { + var _delegate = base.alwaysHandleSupSub && (options2.style.size === Style$1.DISPLAY.size || base.limits); + return _delegate ? htmlBuilder$1 : null; + } else if (base.type === "accent") { + return utils.isCharacterBox(base.base) ? htmlBuilder$a : null; + } else if (base.type === "horizBrace") { + var isSup = !group2.sub; + return isSup === base.isOver ? htmlBuilder$3 : null; + } else { + return null; + } + }, "htmlBuilderDelegate"); + defineFunctionBuilders({ + type: "supsub", + htmlBuilder(group2, options2) { + var builderDelegate = htmlBuilderDelegate(group2, options2); + if (builderDelegate) { + return builderDelegate(group2, options2); + } + var { + base: valueBase, + sup: valueSup, + sub: valueSub + } = group2; + var base = buildGroup$1(valueBase, options2); + var supm; + var subm; + var metrics = options2.fontMetrics(); + var supShift = 0; + var subShift = 0; + var isCharacterBox3 = valueBase && utils.isCharacterBox(valueBase); + if (valueSup) { + var newOptions = options2.havingStyle(options2.style.sup()); + supm = buildGroup$1(valueSup, newOptions, options2); + if (!isCharacterBox3) { + supShift = base.height - newOptions.fontMetrics().supDrop * newOptions.sizeMultiplier / options2.sizeMultiplier; + } + } + if (valueSub) { + var _newOptions = options2.havingStyle(options2.style.sub()); + subm = buildGroup$1(valueSub, _newOptions, options2); + if (!isCharacterBox3) { + subShift = base.depth + _newOptions.fontMetrics().subDrop * _newOptions.sizeMultiplier / options2.sizeMultiplier; + } + } + var minSupShift; + if (options2.style === Style$1.DISPLAY) { + minSupShift = metrics.sup1; + } else if (options2.style.cramped) { + minSupShift = metrics.sup3; + } else { + minSupShift = metrics.sup2; + } + var multiplier = options2.sizeMultiplier; + var marginRight = makeEm(0.5 / metrics.ptPerEm / multiplier); + var marginLeft = null; + if (subm) { + var isOiint = group2.base && group2.base.type === "op" && group2.base.name && (group2.base.name === "\\oiint" || group2.base.name === "\\oiiint"); + if (base instanceof SymbolNode || isOiint) { + marginLeft = makeEm(-base.italic); + } + } + var supsub; + if (supm && subm) { + supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); + subShift = Math.max(subShift, metrics.sub2); + var ruleWidth = metrics.defaultRuleThickness; + var maxWidth2 = 4 * ruleWidth; + if (supShift - supm.depth - (subm.height - subShift) < maxWidth2) { + subShift = maxWidth2 - (supShift - supm.depth) + subm.height; + var psi = 0.8 * metrics.xHeight - (supShift - supm.depth); + if (psi > 0) { + supShift += psi; + subShift -= psi; + } + } + var vlistElem = [{ + type: "elem", + elem: subm, + shift: subShift, + marginRight, + marginLeft + }, { + type: "elem", + elem: supm, + shift: -supShift, + marginRight + }]; + supsub = buildCommon.makeVList({ + positionType: "individualShift", + children: vlistElem + }, options2); + } else if (subm) { + subShift = Math.max(subShift, metrics.sub1, subm.height - 0.8 * metrics.xHeight); + var _vlistElem = [{ + type: "elem", + elem: subm, + marginLeft, + marginRight + }]; + supsub = buildCommon.makeVList({ + positionType: "shift", + positionData: subShift, + children: _vlistElem + }, options2); + } else if (supm) { + supShift = Math.max(supShift, minSupShift, supm.depth + 0.25 * metrics.xHeight); + supsub = buildCommon.makeVList({ + positionType: "shift", + positionData: -supShift, + children: [{ + type: "elem", + elem: supm, + marginRight + }] + }, options2); + } else { + throw new Error("supsub must have either sup or sub."); + } + var mclass = getTypeOfDomTree(base, "right") || "mord"; + return buildCommon.makeSpan([mclass], [base, buildCommon.makeSpan(["msupsub"], [supsub])], options2); + }, + mathmlBuilder(group2, options2) { + var isBrace = false; + var isOver; + var isSup; + if (group2.base && group2.base.type === "horizBrace") { + isSup = !!group2.sup; + if (isSup === group2.base.isOver) { + isBrace = true; + isOver = group2.base.isOver; + } + } + if (group2.base && (group2.base.type === "op" || group2.base.type === "operatorname")) { + group2.base.parentIsSupSub = true; + } + var children2 = [buildGroup2(group2.base, options2)]; + if (group2.sub) { + children2.push(buildGroup2(group2.sub, options2)); + } + if (group2.sup) { + children2.push(buildGroup2(group2.sup, options2)); + } + var nodeType3; + if (isBrace) { + nodeType3 = isOver ? "mover" : "munder"; + } else if (!group2.sub) { + var base = group2.base; + if (base && base.type === "op" && base.limits && (options2.style === Style$1.DISPLAY || base.alwaysHandleSupSub)) { + nodeType3 = "mover"; + } else if (base && base.type === "operatorname" && base.alwaysHandleSupSub && (base.limits || options2.style === Style$1.DISPLAY)) { + nodeType3 = "mover"; + } else { + nodeType3 = "msup"; + } + } else if (!group2.sup) { + var _base = group2.base; + if (_base && _base.type === "op" && _base.limits && (options2.style === Style$1.DISPLAY || _base.alwaysHandleSupSub)) { + nodeType3 = "munder"; + } else if (_base && _base.type === "operatorname" && _base.alwaysHandleSupSub && (_base.limits || options2.style === Style$1.DISPLAY)) { + nodeType3 = "munder"; + } else { + nodeType3 = "msub"; + } + } else { + var _base2 = group2.base; + if (_base2 && _base2.type === "op" && _base2.limits && options2.style === Style$1.DISPLAY) { + nodeType3 = "munderover"; + } else if (_base2 && _base2.type === "operatorname" && _base2.alwaysHandleSupSub && (options2.style === Style$1.DISPLAY || _base2.limits)) { + nodeType3 = "munderover"; + } else { + nodeType3 = "msubsup"; + } + } + return new mathMLTree.MathNode(nodeType3, children2); + } + }); + defineFunctionBuilders({ + type: "atom", + htmlBuilder(group2, options2) { + return buildCommon.mathsym(group2.text, group2.mode, options2, ["m" + group2.family]); + }, + mathmlBuilder(group2, options2) { + var node2 = new mathMLTree.MathNode("mo", [makeText(group2.text, group2.mode)]); + if (group2.family === "bin") { + var variant = getVariant(group2, options2); + if (variant === "bold-italic") { + node2.setAttribute("mathvariant", variant); + } + } else if (group2.family === "punct") { + node2.setAttribute("separator", "true"); + } else if (group2.family === "open" || group2.family === "close") { + node2.setAttribute("stretchy", "false"); + } + return node2; + } + }); + defaultVariant = { + "mi": "italic", + "mn": "normal", + "mtext": "normal" + }; + defineFunctionBuilders({ + type: "mathord", + htmlBuilder(group2, options2) { + return buildCommon.makeOrd(group2, options2, "mathord"); + }, + mathmlBuilder(group2, options2) { + var node2 = new mathMLTree.MathNode("mi", [makeText(group2.text, group2.mode, options2)]); + var variant = getVariant(group2, options2) || "italic"; + if (variant !== defaultVariant[node2.type]) { + node2.setAttribute("mathvariant", variant); + } + return node2; + } + }); + defineFunctionBuilders({ + type: "textord", + htmlBuilder(group2, options2) { + return buildCommon.makeOrd(group2, options2, "textord"); + }, + mathmlBuilder(group2, options2) { + var text4 = makeText(group2.text, group2.mode, options2); + var variant = getVariant(group2, options2) || "normal"; + var node2; + if (group2.mode === "text") { + node2 = new mathMLTree.MathNode("mtext", [text4]); + } else if (/[0-9]/.test(group2.text)) { + node2 = new mathMLTree.MathNode("mn", [text4]); + } else if (group2.text === "\\prime") { + node2 = new mathMLTree.MathNode("mo", [text4]); + } else { + node2 = new mathMLTree.MathNode("mi", [text4]); + } + if (variant !== defaultVariant[node2.type]) { + node2.setAttribute("mathvariant", variant); + } + return node2; + } + }); + cssSpace = { + "\\nobreak": "nobreak", + "\\allowbreak": "allowbreak" + }; + regularSpace = { + " ": {}, + "\\ ": {}, + "~": { + className: "nobreak" + }, + "\\space": {}, + "\\nobreakspace": { + className: "nobreak" + } + }; + defineFunctionBuilders({ + type: "spacing", + htmlBuilder(group2, options2) { + if (regularSpace.hasOwnProperty(group2.text)) { + var className = regularSpace[group2.text].className || ""; + if (group2.mode === "text") { + var ord = buildCommon.makeOrd(group2, options2, "textord"); + ord.classes.push(className); + return ord; + } else { + return buildCommon.makeSpan(["mspace", className], [buildCommon.mathsym(group2.text, group2.mode, options2)], options2); + } + } else if (cssSpace.hasOwnProperty(group2.text)) { + return buildCommon.makeSpan(["mspace", cssSpace[group2.text]], [], options2); + } else { + throw new ParseError('Unknown type of space "' + group2.text + '"'); + } + }, + mathmlBuilder(group2, options2) { + var node2; + if (regularSpace.hasOwnProperty(group2.text)) { + node2 = new mathMLTree.MathNode("mtext", [new mathMLTree.TextNode("\xA0")]); + } else if (cssSpace.hasOwnProperty(group2.text)) { + return new mathMLTree.MathNode("mspace"); + } else { + throw new ParseError('Unknown type of space "' + group2.text + '"'); + } + return node2; + } + }); + pad = /* @__PURE__ */ __name(() => { + var padNode = new mathMLTree.MathNode("mtd", []); + padNode.setAttribute("width", "50%"); + return padNode; + }, "pad"); + defineFunctionBuilders({ + type: "tag", + mathmlBuilder(group2, options2) { + var table = new mathMLTree.MathNode("mtable", [new mathMLTree.MathNode("mtr", [pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group2.body, options2)]), pad(), new mathMLTree.MathNode("mtd", [buildExpressionRow(group2.tag, options2)])])]); + table.setAttribute("width", "100%"); + return table; + } + }); + textFontFamilies = { + "\\text": void 0, + "\\textrm": "textrm", + "\\textsf": "textsf", + "\\texttt": "texttt", + "\\textnormal": "textrm" + }; + textFontWeights = { + "\\textbf": "textbf", + "\\textmd": "textmd" + }; + textFontShapes = { + "\\textit": "textit", + "\\textup": "textup" + }; + optionsWithFont = /* @__PURE__ */ __name((group2, options2) => { + var font = group2.font; + if (!font) { + return options2; + } else if (textFontFamilies[font]) { + return options2.withTextFontFamily(textFontFamilies[font]); + } else if (textFontWeights[font]) { + return options2.withTextFontWeight(textFontWeights[font]); + } else if (font === "\\emph") { + return options2.fontShape === "textit" ? options2.withTextFontShape("textup") : options2.withTextFontShape("textit"); + } + return options2.withTextFontShape(textFontShapes[font]); + }, "optionsWithFont"); + defineFunction({ + type: "text", + names: [ + // Font families + "\\text", + "\\textrm", + "\\textsf", + "\\texttt", + "\\textnormal", + // Font weights + "\\textbf", + "\\textmd", + // Font Shapes + "\\textit", + "\\textup", + "\\emph" + ], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInArgument: true, + allowedInText: true + }, + handler(_ref, args) { + var { + parser: parser29, + funcName + } = _ref; + var body = args[0]; + return { + type: "text", + mode: parser29.mode, + body: ordargument(body), + font: funcName + }; + }, + htmlBuilder(group2, options2) { + var newOptions = optionsWithFont(group2, options2); + var inner2 = buildExpression$1(group2.body, newOptions, true); + return buildCommon.makeSpan(["mord", "text"], inner2, newOptions); + }, + mathmlBuilder(group2, options2) { + var newOptions = optionsWithFont(group2, options2); + return buildExpressionRow(group2.body, newOptions); + } + }); + defineFunction({ + type: "underline", + names: ["\\underline"], + props: { + numArgs: 1, + allowedInText: true + }, + handler(_ref, args) { + var { + parser: parser29 + } = _ref; + return { + type: "underline", + mode: parser29.mode, + body: args[0] + }; + }, + htmlBuilder(group2, options2) { + var innerGroup = buildGroup$1(group2.body, options2); + var line2 = buildCommon.makeLineSpan("underline-line", options2); + var defaultRuleThickness = options2.fontMetrics().defaultRuleThickness; + var vlist = buildCommon.makeVList({ + positionType: "top", + positionData: innerGroup.height, + children: [{ + type: "kern", + size: defaultRuleThickness + }, { + type: "elem", + elem: line2 + }, { + type: "kern", + size: 3 * defaultRuleThickness + }, { + type: "elem", + elem: innerGroup + }] + }, options2); + return buildCommon.makeSpan(["mord", "underline"], [vlist], options2); + }, + mathmlBuilder(group2, options2) { + var operator = new mathMLTree.MathNode("mo", [new mathMLTree.TextNode("\u203E")]); + operator.setAttribute("stretchy", "true"); + var node2 = new mathMLTree.MathNode("munder", [buildGroup2(group2.body, options2), operator]); + node2.setAttribute("accentunder", "true"); + return node2; + } + }); + defineFunction({ + type: "vcenter", + names: ["\\vcenter"], + props: { + numArgs: 1, + argTypes: ["original"], + // In LaTeX, \vcenter can act only on a box. + allowedInText: false + }, + handler(_ref, args) { + var { + parser: parser29 + } = _ref; + return { + type: "vcenter", + mode: parser29.mode, + body: args[0] + }; + }, + htmlBuilder(group2, options2) { + var body = buildGroup$1(group2.body, options2); + var axisHeight = options2.fontMetrics().axisHeight; + var dy = 0.5 * (body.height - axisHeight - (body.depth + axisHeight)); + return buildCommon.makeVList({ + positionType: "shift", + positionData: dy, + children: [{ + type: "elem", + elem: body + }] + }, options2); + }, + mathmlBuilder(group2, options2) { + return new mathMLTree.MathNode("mpadded", [buildGroup2(group2.body, options2)], ["vcenter"]); + } + }); + defineFunction({ + type: "verb", + names: ["\\verb"], + props: { + numArgs: 0, + allowedInText: true + }, + handler(context, args, optArgs) { + throw new ParseError("\\verb ended by end of line instead of matching delimiter"); + }, + htmlBuilder(group2, options2) { + var text4 = makeVerb(group2); + var body = []; + var newOptions = options2.havingStyle(options2.style.text()); + for (var i2 = 0; i2 < text4.length; i2++) { + var c3 = text4[i2]; + if (c3 === "~") { + c3 = "\\textasciitilde"; + } + body.push(buildCommon.makeSymbol(c3, "Typewriter-Regular", group2.mode, newOptions, ["mord", "texttt"])); + } + return buildCommon.makeSpan(["mord", "text"].concat(newOptions.sizingClasses(options2)), buildCommon.tryCombineChars(body), newOptions); + }, + mathmlBuilder(group2, options2) { + var text4 = new mathMLTree.TextNode(makeVerb(group2)); + var node2 = new mathMLTree.MathNode("mtext", [text4]); + node2.setAttribute("mathvariant", "monospace"); + return node2; + } + }); + makeVerb = /* @__PURE__ */ __name((group2) => group2.body.replace(/ /g, group2.star ? "\u2423" : "\xA0"), "makeVerb"); + functions = _functions; + spaceRegexString = "[ \r\n ]"; + controlWordRegexString = "\\\\[a-zA-Z@]+"; + controlSymbolRegexString = "\\\\[^\uD800-\uDFFF]"; + controlWordWhitespaceRegexString = "(" + controlWordRegexString + ")" + spaceRegexString + "*"; + controlSpaceRegexString = "\\\\(\n|[ \r ]+\n?)[ \r ]*"; + combiningDiacriticalMarkString = "[\u0300-\u036F]"; + combiningDiacriticalMarksEndRegex = new RegExp(combiningDiacriticalMarkString + "+$"); + tokenRegexString = "(" + spaceRegexString + "+)|" + // whitespace + (controlSpaceRegexString + "|") + // \whitespace + "([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]" + // single codepoint + (combiningDiacriticalMarkString + "*") + // ...plus accents + "|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair + (combiningDiacriticalMarkString + "*") + // ...plus accents + "|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5" + // \verb unstarred + ("|" + controlWordWhitespaceRegexString) + // \macroName + spaces + ("|" + controlSymbolRegexString + ")"); + Lexer = class { + static { + __name(this, "Lexer"); + } + // Category codes. The lexer only supports comment characters (14) for now. + // MacroExpander additionally distinguishes active (13). + constructor(input, settings) { + this.input = void 0; + this.settings = void 0; + this.tokenRegex = void 0; + this.catcodes = void 0; + this.input = input; + this.settings = settings; + this.tokenRegex = new RegExp(tokenRegexString, "g"); + this.catcodes = { + "%": 14, + // comment character + "~": 13 + // active character + }; + } + setCatcode(char2, code) { + this.catcodes[char2] = code; + } + /** + * This function lexes a single token. + */ + lex() { + var input = this.input; + var pos = this.tokenRegex.lastIndex; + if (pos === input.length) { + return new Token("EOF", new SourceLocation(this, pos, pos)); + } + var match3 = this.tokenRegex.exec(input); + if (match3 === null || match3.index !== pos) { + throw new ParseError("Unexpected character: '" + input[pos] + "'", new Token(input[pos], new SourceLocation(this, pos, pos + 1))); + } + var text4 = match3[6] || match3[3] || (match3[2] ? "\\ " : " "); + if (this.catcodes[text4] === 14) { + var nlIndex = input.indexOf("\n", this.tokenRegex.lastIndex); + if (nlIndex === -1) { + this.tokenRegex.lastIndex = input.length; + this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)"); + } else { + this.tokenRegex.lastIndex = nlIndex + 1; + } + return this.lex(); + } + return new Token(text4, new SourceLocation(this, pos, this.tokenRegex.lastIndex)); + } + }; + Namespace = class { + static { + __name(this, "Namespace"); + } + /** + * Both arguments are optional. The first argument is an object of + * built-in mappings which never change. The second argument is an object + * of initial (global-level) mappings, which will constantly change + * according to any global/top-level `set`s done. + */ + constructor(builtins, globalMacros) { + if (builtins === void 0) { + builtins = {}; + } + if (globalMacros === void 0) { + globalMacros = {}; + } + this.current = void 0; + this.builtins = void 0; + this.undefStack = void 0; + this.current = globalMacros; + this.builtins = builtins; + this.undefStack = []; + } + /** + * Start a new nested group, affecting future local `set`s. + */ + beginGroup() { + this.undefStack.push({}); + } + /** + * End current nested group, restoring values before the group began. + */ + endGroup() { + if (this.undefStack.length === 0) { + throw new ParseError("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug"); + } + var undefs = this.undefStack.pop(); + for (var undef2 in undefs) { + if (undefs.hasOwnProperty(undef2)) { + if (undefs[undef2] == null) { + delete this.current[undef2]; + } else { + this.current[undef2] = undefs[undef2]; + } + } + } + } + /** + * Ends all currently nested groups (if any), restoring values before the + * groups began. Useful in case of an error in the middle of parsing. + */ + endGroups() { + while (this.undefStack.length > 0) { + this.endGroup(); + } + } + /** + * Detect whether `name` has a definition. Equivalent to + * `get(name) != null`. + */ + has(name) { + return this.current.hasOwnProperty(name) || this.builtins.hasOwnProperty(name); + } + /** + * Get the current value of a name, or `undefined` if there is no value. + * + * Note: Do not use `if (namespace.get(...))` to detect whether a macro + * is defined, as the definition may be the empty string which evaluates + * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or + * `if (namespace.has(...))`. + */ + get(name) { + if (this.current.hasOwnProperty(name)) { + return this.current[name]; + } else { + return this.builtins[name]; + } + } + /** + * Set the current value of a name, and optionally set it globally too. + * Local set() sets the current value and (when appropriate) adds an undo + * operation to the undo stack. Global set() may change the undo + * operation at every level, so takes time linear in their number. + * A value of undefined means to delete existing definitions. + */ + set(name, value2, global2) { + if (global2 === void 0) { + global2 = false; + } + if (global2) { + for (var i2 = 0; i2 < this.undefStack.length; i2++) { + delete this.undefStack[i2][name]; + } + if (this.undefStack.length > 0) { + this.undefStack[this.undefStack.length - 1][name] = value2; + } + } else { + var top2 = this.undefStack[this.undefStack.length - 1]; + if (top2 && !top2.hasOwnProperty(name)) { + top2[name] = this.current[name]; + } + } + if (value2 == null) { + delete this.current[name]; + } else { + this.current[name] = value2; + } + } + }; + macros = _macros; + defineMacro("\\noexpand", function(context) { + var t4 = context.popToken(); + if (context.isExpandable(t4.text)) { + t4.noexpand = true; + t4.treatAsRelax = true; + } + return { + tokens: [t4], + numArgs: 0 + }; + }); + defineMacro("\\expandafter", function(context) { + var t4 = context.popToken(); + context.expandOnce(true); + return { + tokens: [t4], + numArgs: 0 + }; + }); + defineMacro("\\@firstoftwo", function(context) { + var args = context.consumeArgs(2); + return { + tokens: args[0], + numArgs: 0 + }; + }); + defineMacro("\\@secondoftwo", function(context) { + var args = context.consumeArgs(2); + return { + tokens: args[1], + numArgs: 0 + }; + }); + defineMacro("\\@ifnextchar", function(context) { + var args = context.consumeArgs(3); + context.consumeSpaces(); + var nextToken = context.future(); + if (args[0].length === 1 && args[0][0].text === nextToken.text) { + return { + tokens: args[1], + numArgs: 0 + }; + } else { + return { + tokens: args[2], + numArgs: 0 + }; + } + }); + defineMacro("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); + defineMacro("\\TextOrMath", function(context) { + var args = context.consumeArgs(2); + if (context.mode === "text") { + return { + tokens: args[0], + numArgs: 0 + }; + } else { + return { + tokens: args[1], + numArgs: 0 + }; + } + }); + digitToNumber = { + "0": 0, + "1": 1, + "2": 2, + "3": 3, + "4": 4, + "5": 5, + "6": 6, + "7": 7, + "8": 8, + "9": 9, + "a": 10, + "A": 10, + "b": 11, + "B": 11, + "c": 12, + "C": 12, + "d": 13, + "D": 13, + "e": 14, + "E": 14, + "f": 15, + "F": 15 + }; + defineMacro("\\char", function(context) { + var token2 = context.popToken(); + var base; + var number7 = ""; + if (token2.text === "'") { + base = 8; + token2 = context.popToken(); + } else if (token2.text === '"') { + base = 16; + token2 = context.popToken(); + } else if (token2.text === "`") { + token2 = context.popToken(); + if (token2.text[0] === "\\") { + number7 = token2.text.charCodeAt(1); + } else if (token2.text === "EOF") { + throw new ParseError("\\char` missing argument"); + } else { + number7 = token2.text.charCodeAt(0); + } + } else { + base = 10; + } + if (base) { + number7 = digitToNumber[token2.text]; + if (number7 == null || number7 >= base) { + throw new ParseError("Invalid base-" + base + " digit " + token2.text); + } + var digit; + while ((digit = digitToNumber[context.future().text]) != null && digit < base) { + number7 *= base; + number7 += digit; + context.popToken(); + } + } + return "\\@char{" + number7 + "}"; + }); + newcommand = /* @__PURE__ */ __name((context, existsOK, nonexistsOK, skipIfExists) => { + var arg = context.consumeArg().tokens; + if (arg.length !== 1) { + throw new ParseError("\\newcommand's first argument must be a macro name"); + } + var name = arg[0].text; + var exists = context.isDefined(name); + if (exists && !existsOK) { + throw new ParseError("\\newcommand{" + name + "} attempting to redefine " + (name + "; use \\renewcommand")); + } + if (!exists && !nonexistsOK) { + throw new ParseError("\\renewcommand{" + name + "} when command " + name + " does not yet exist; use \\newcommand"); + } + var numArgs = 0; + arg = context.consumeArg().tokens; + if (arg.length === 1 && arg[0].text === "[") { + var argText = ""; + var token2 = context.expandNextToken(); + while (token2.text !== "]" && token2.text !== "EOF") { + argText += token2.text; + token2 = context.expandNextToken(); + } + if (!argText.match(/^\s*[0-9]+\s*$/)) { + throw new ParseError("Invalid number of arguments: " + argText); + } + numArgs = parseInt(argText); + arg = context.consumeArg().tokens; + } + if (!(exists && skipIfExists)) { + context.macros.set(name, { + tokens: arg, + numArgs + }); + } + return ""; + }, "newcommand"); + defineMacro("\\newcommand", (context) => newcommand(context, false, true, false)); + defineMacro("\\renewcommand", (context) => newcommand(context, true, false, false)); + defineMacro("\\providecommand", (context) => newcommand(context, true, true, true)); + defineMacro("\\message", (context) => { + var arg = context.consumeArgs(1)[0]; + console.log(arg.reverse().map((token2) => token2.text).join("")); + return ""; + }); + defineMacro("\\errmessage", (context) => { + var arg = context.consumeArgs(1)[0]; + console.error(arg.reverse().map((token2) => token2.text).join("")); + return ""; + }); + defineMacro("\\show", (context) => { + var tok = context.popToken(); + var name = tok.text; + console.log(tok, context.macros.get(name), functions[name], symbols.math[name], symbols.text[name]); + return ""; + }); + defineMacro("\\bgroup", "{"); + defineMacro("\\egroup", "}"); + defineMacro("~", "\\nobreakspace"); + defineMacro("\\lq", "`"); + defineMacro("\\rq", "'"); + defineMacro("\\aa", "\\r a"); + defineMacro("\\AA", "\\r A"); + defineMacro("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`\xA9}"); + defineMacro("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"); + defineMacro("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}"); + defineMacro("\u212C", "\\mathscr{B}"); + defineMacro("\u2130", "\\mathscr{E}"); + defineMacro("\u2131", "\\mathscr{F}"); + defineMacro("\u210B", "\\mathscr{H}"); + defineMacro("\u2110", "\\mathscr{I}"); + defineMacro("\u2112", "\\mathscr{L}"); + defineMacro("\u2133", "\\mathscr{M}"); + defineMacro("\u211B", "\\mathscr{R}"); + defineMacro("\u212D", "\\mathfrak{C}"); + defineMacro("\u210C", "\\mathfrak{H}"); + defineMacro("\u2128", "\\mathfrak{Z}"); + defineMacro("\\Bbbk", "\\Bbb{k}"); + defineMacro("\xB7", "\\cdotp"); + defineMacro("\\llap", "\\mathllap{\\textrm{#1}}"); + defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}"); + defineMacro("\\clap", "\\mathclap{\\textrm{#1}}"); + defineMacro("\\mathstrut", "\\vphantom{(}"); + defineMacro("\\underbar", "\\underline{\\text{#1}}"); + defineMacro("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); + defineMacro("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}"); + defineMacro("\\ne", "\\neq"); + defineMacro("\u2260", "\\neq"); + defineMacro("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}"); + defineMacro("\u2209", "\\notin"); + defineMacro("\u2258", "\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}"); + defineMacro("\u2259", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}"); + defineMacro("\u225A", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}"); + defineMacro("\u225B", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}"); + defineMacro("\u225D", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}"); + defineMacro("\u225E", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}"); + defineMacro("\u225F", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}"); + defineMacro("\u27C2", "\\perp"); + defineMacro("\u203C", "\\mathclose{!\\mkern-0.8mu!}"); + defineMacro("\u220C", "\\notni"); + defineMacro("\u231C", "\\ulcorner"); + defineMacro("\u231D", "\\urcorner"); + defineMacro("\u231E", "\\llcorner"); + defineMacro("\u231F", "\\lrcorner"); + defineMacro("\xA9", "\\copyright"); + defineMacro("\xAE", "\\textregistered"); + defineMacro("\uFE0F", "\\textregistered"); + defineMacro("\\ulcorner", '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'); + defineMacro("\\urcorner", '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'); + defineMacro("\\llcorner", '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'); + defineMacro("\\lrcorner", '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'); + defineMacro("\\vdots", "{\\varvdots\\rule{0pt}{15pt}}"); + defineMacro("\u22EE", "\\vdots"); + defineMacro("\\varGamma", "\\mathit{\\Gamma}"); + defineMacro("\\varDelta", "\\mathit{\\Delta}"); + defineMacro("\\varTheta", "\\mathit{\\Theta}"); + defineMacro("\\varLambda", "\\mathit{\\Lambda}"); + defineMacro("\\varXi", "\\mathit{\\Xi}"); + defineMacro("\\varPi", "\\mathit{\\Pi}"); + defineMacro("\\varSigma", "\\mathit{\\Sigma}"); + defineMacro("\\varUpsilon", "\\mathit{\\Upsilon}"); + defineMacro("\\varPhi", "\\mathit{\\Phi}"); + defineMacro("\\varPsi", "\\mathit{\\Psi}"); + defineMacro("\\varOmega", "\\mathit{\\Omega}"); + defineMacro("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); + defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"); + defineMacro("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); + defineMacro("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); + defineMacro("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); + defineMacro("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); + defineMacro("\\dddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}"); + defineMacro("\\ddddot", "{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}"); + dotsByToken = { + ",": "\\dotsc", + "\\not": "\\dotsb", + // \keybin@ checks for the following: + "+": "\\dotsb", + "=": "\\dotsb", + "<": "\\dotsb", + ">": "\\dotsb", + "-": "\\dotsb", + "*": "\\dotsb", + ":": "\\dotsb", + // Symbols whose definition starts with \DOTSB: + "\\DOTSB": "\\dotsb", + "\\coprod": "\\dotsb", + "\\bigvee": "\\dotsb", + "\\bigwedge": "\\dotsb", + "\\biguplus": "\\dotsb", + "\\bigcap": "\\dotsb", + "\\bigcup": "\\dotsb", + "\\prod": "\\dotsb", + "\\sum": "\\dotsb", + "\\bigotimes": "\\dotsb", + "\\bigoplus": "\\dotsb", + "\\bigodot": "\\dotsb", + "\\bigsqcup": "\\dotsb", + "\\And": "\\dotsb", + "\\longrightarrow": "\\dotsb", + "\\Longrightarrow": "\\dotsb", + "\\longleftarrow": "\\dotsb", + "\\Longleftarrow": "\\dotsb", + "\\longleftrightarrow": "\\dotsb", + "\\Longleftrightarrow": "\\dotsb", + "\\mapsto": "\\dotsb", + "\\longmapsto": "\\dotsb", + "\\hookrightarrow": "\\dotsb", + "\\doteq": "\\dotsb", + // Symbols whose definition starts with \mathbin: + "\\mathbin": "\\dotsb", + // Symbols whose definition starts with \mathrel: + "\\mathrel": "\\dotsb", + "\\relbar": "\\dotsb", + "\\Relbar": "\\dotsb", + "\\xrightarrow": "\\dotsb", + "\\xleftarrow": "\\dotsb", + // Symbols whose definition starts with \DOTSI: + "\\DOTSI": "\\dotsi", + "\\int": "\\dotsi", + "\\oint": "\\dotsi", + "\\iint": "\\dotsi", + "\\iiint": "\\dotsi", + "\\iiiint": "\\dotsi", + "\\idotsint": "\\dotsi", + // Symbols whose definition starts with \DOTSX: + "\\DOTSX": "\\dotsx" + }; + defineMacro("\\dots", function(context) { + var thedots = "\\dotso"; + var next3 = context.expandAfterFuture().text; + if (next3 in dotsByToken) { + thedots = dotsByToken[next3]; + } else if (next3.slice(0, 4) === "\\not") { + thedots = "\\dotsb"; + } else if (next3 in symbols.math) { + if (["bin", "rel"].includes(symbols.math[next3].group)) { + thedots = "\\dotsb"; + } + } + return thedots; + }); + spaceAfterDots = { + // \rightdelim@ checks for the following: + ")": true, + "]": true, + "\\rbrack": true, + "\\}": true, + "\\rbrace": true, + "\\rangle": true, + "\\rceil": true, + "\\rfloor": true, + "\\rgroup": true, + "\\rmoustache": true, + "\\right": true, + "\\bigr": true, + "\\biggr": true, + "\\Bigr": true, + "\\Biggr": true, + // \extra@ also tests for the following: + "$": true, + // \extrap@ checks for the following: + ";": true, + ".": true, + ",": true + }; + defineMacro("\\dotso", function(context) { + var next3 = context.future().text; + if (next3 in spaceAfterDots) { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } + }); + defineMacro("\\dotsc", function(context) { + var next3 = context.future().text; + if (next3 in spaceAfterDots && next3 !== ",") { + return "\\ldots\\,"; + } else { + return "\\ldots"; + } + }); + defineMacro("\\cdots", function(context) { + var next3 = context.future().text; + if (next3 in spaceAfterDots) { + return "\\@cdots\\,"; + } else { + return "\\@cdots"; + } + }); + defineMacro("\\dotsb", "\\cdots"); + defineMacro("\\dotsm", "\\cdots"); + defineMacro("\\dotsi", "\\!\\cdots"); + defineMacro("\\dotsx", "\\ldots\\,"); + defineMacro("\\DOTSI", "\\relax"); + defineMacro("\\DOTSB", "\\relax"); + defineMacro("\\DOTSX", "\\relax"); + defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); + defineMacro("\\,", "\\tmspace+{3mu}{.1667em}"); + defineMacro("\\thinspace", "\\,"); + defineMacro("\\>", "\\mskip{4mu}"); + defineMacro("\\:", "\\tmspace+{4mu}{.2222em}"); + defineMacro("\\medspace", "\\:"); + defineMacro("\\;", "\\tmspace+{5mu}{.2777em}"); + defineMacro("\\thickspace", "\\;"); + defineMacro("\\!", "\\tmspace-{3mu}{.1667em}"); + defineMacro("\\negthinspace", "\\!"); + defineMacro("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); + defineMacro("\\negthickspace", "\\tmspace-{5mu}{.277em}"); + defineMacro("\\enspace", "\\kern.5em "); + defineMacro("\\enskip", "\\hskip.5em\\relax"); + defineMacro("\\quad", "\\hskip1em\\relax"); + defineMacro("\\qquad", "\\hskip2em\\relax"); + defineMacro("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); + defineMacro("\\tag@paren", "\\tag@literal{({#1})}"); + defineMacro("\\tag@literal", (context) => { + if (context.macros.get("\\df@tag")) { + throw new ParseError("Multiple \\tag"); + } + return "\\gdef\\df@tag{\\text{#1}}"; + }); + defineMacro("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"); + defineMacro("\\pod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"); + defineMacro("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); + defineMacro("\\mod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"); + defineMacro("\\newline", "\\\\\\relax"); + defineMacro("\\TeX", "\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}"); + latexRaiseA = makeEm(fontMetricsData["Main-Regular"]["T".charCodeAt(0)][1] - 0.7 * fontMetricsData["Main-Regular"]["A".charCodeAt(0)][1]); + defineMacro("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); + defineMacro("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + latexRaiseA + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); + defineMacro("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); + defineMacro("\\@hspace", "\\hskip #1\\relax"); + defineMacro("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); + defineMacro("\\ordinarycolon", ":"); + defineMacro("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); + defineMacro("\\dblcolon", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'); + defineMacro("\\coloneqq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'); + defineMacro("\\Coloneqq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'); + defineMacro("\\coloneq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'); + defineMacro("\\Coloneq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'); + defineMacro("\\eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'); + defineMacro("\\Eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'); + defineMacro("\\eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'); + defineMacro("\\Eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'); + defineMacro("\\colonapprox", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'); + defineMacro("\\Colonapprox", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'); + defineMacro("\\colonsim", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'); + defineMacro("\\Colonsim", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'); + defineMacro("\u2237", "\\dblcolon"); + defineMacro("\u2239", "\\eqcolon"); + defineMacro("\u2254", "\\coloneqq"); + defineMacro("\u2255", "\\eqqcolon"); + defineMacro("\u2A74", "\\Coloneqq"); + defineMacro("\\ratio", "\\vcentcolon"); + defineMacro("\\coloncolon", "\\dblcolon"); + defineMacro("\\colonequals", "\\coloneqq"); + defineMacro("\\coloncolonequals", "\\Coloneqq"); + defineMacro("\\equalscolon", "\\eqqcolon"); + defineMacro("\\equalscoloncolon", "\\Eqqcolon"); + defineMacro("\\colonminus", "\\coloneq"); + defineMacro("\\coloncolonminus", "\\Coloneq"); + defineMacro("\\minuscolon", "\\eqcolon"); + defineMacro("\\minuscoloncolon", "\\Eqcolon"); + defineMacro("\\coloncolonapprox", "\\Colonapprox"); + defineMacro("\\coloncolonsim", "\\Colonsim"); + defineMacro("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); + defineMacro("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"); + defineMacro("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); + defineMacro("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); + defineMacro("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}"); + defineMacro("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); + defineMacro("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); + defineMacro("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}"); + defineMacro("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}"); + defineMacro("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}"); + defineMacro("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}"); + defineMacro("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}"); + defineMacro("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}"); + defineMacro("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{\u2269}"); + defineMacro("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{\u2268}"); + defineMacro("\\ngeqq", "\\html@mathml{\\@ngeqq}{\u2271}"); + defineMacro("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{\u2271}"); + defineMacro("\\nleqq", "\\html@mathml{\\@nleqq}{\u2270}"); + defineMacro("\\nleqslant", "\\html@mathml{\\@nleqslant}{\u2270}"); + defineMacro("\\nshortmid", "\\html@mathml{\\@nshortmid}{\u2224}"); + defineMacro("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{\u2226}"); + defineMacro("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{\u2288}"); + defineMacro("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{\u2289}"); + defineMacro("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{\u228A}"); + defineMacro("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{\u2ACB}"); + defineMacro("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{\u228B}"); + defineMacro("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{\u2ACC}"); + defineMacro("\\imath", "\\html@mathml{\\@imath}{\u0131}"); + defineMacro("\\jmath", "\\html@mathml{\\@jmath}{\u0237}"); + defineMacro("\\llbracket", "\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}"); + defineMacro("\\rrbracket", "\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}"); + defineMacro("\u27E6", "\\llbracket"); + defineMacro("\u27E7", "\\rrbracket"); + defineMacro("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}"); + defineMacro("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}"); + defineMacro("\u2983", "\\lBrace"); + defineMacro("\u2984", "\\rBrace"); + defineMacro("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}"); + defineMacro("\u29B5", "\\minuso"); + defineMacro("\\darr", "\\downarrow"); + defineMacro("\\dArr", "\\Downarrow"); + defineMacro("\\Darr", "\\Downarrow"); + defineMacro("\\lang", "\\langle"); + defineMacro("\\rang", "\\rangle"); + defineMacro("\\uarr", "\\uparrow"); + defineMacro("\\uArr", "\\Uparrow"); + defineMacro("\\Uarr", "\\Uparrow"); + defineMacro("\\N", "\\mathbb{N}"); + defineMacro("\\R", "\\mathbb{R}"); + defineMacro("\\Z", "\\mathbb{Z}"); + defineMacro("\\alef", "\\aleph"); + defineMacro("\\alefsym", "\\aleph"); + defineMacro("\\Alpha", "\\mathrm{A}"); + defineMacro("\\Beta", "\\mathrm{B}"); + defineMacro("\\bull", "\\bullet"); + defineMacro("\\Chi", "\\mathrm{X}"); + defineMacro("\\clubs", "\\clubsuit"); + defineMacro("\\cnums", "\\mathbb{C}"); + defineMacro("\\Complex", "\\mathbb{C}"); + defineMacro("\\Dagger", "\\ddagger"); + defineMacro("\\diamonds", "\\diamondsuit"); + defineMacro("\\empty", "\\emptyset"); + defineMacro("\\Epsilon", "\\mathrm{E}"); + defineMacro("\\Eta", "\\mathrm{H}"); + defineMacro("\\exist", "\\exists"); + defineMacro("\\harr", "\\leftrightarrow"); + defineMacro("\\hArr", "\\Leftrightarrow"); + defineMacro("\\Harr", "\\Leftrightarrow"); + defineMacro("\\hearts", "\\heartsuit"); + defineMacro("\\image", "\\Im"); + defineMacro("\\infin", "\\infty"); + defineMacro("\\Iota", "\\mathrm{I}"); + defineMacro("\\isin", "\\in"); + defineMacro("\\Kappa", "\\mathrm{K}"); + defineMacro("\\larr", "\\leftarrow"); + defineMacro("\\lArr", "\\Leftarrow"); + defineMacro("\\Larr", "\\Leftarrow"); + defineMacro("\\lrarr", "\\leftrightarrow"); + defineMacro("\\lrArr", "\\Leftrightarrow"); + defineMacro("\\Lrarr", "\\Leftrightarrow"); + defineMacro("\\Mu", "\\mathrm{M}"); + defineMacro("\\natnums", "\\mathbb{N}"); + defineMacro("\\Nu", "\\mathrm{N}"); + defineMacro("\\Omicron", "\\mathrm{O}"); + defineMacro("\\plusmn", "\\pm"); + defineMacro("\\rarr", "\\rightarrow"); + defineMacro("\\rArr", "\\Rightarrow"); + defineMacro("\\Rarr", "\\Rightarrow"); + defineMacro("\\real", "\\Re"); + defineMacro("\\reals", "\\mathbb{R}"); + defineMacro("\\Reals", "\\mathbb{R}"); + defineMacro("\\Rho", "\\mathrm{P}"); + defineMacro("\\sdot", "\\cdot"); + defineMacro("\\sect", "\\S"); + defineMacro("\\spades", "\\spadesuit"); + defineMacro("\\sub", "\\subset"); + defineMacro("\\sube", "\\subseteq"); + defineMacro("\\supe", "\\supseteq"); + defineMacro("\\Tau", "\\mathrm{T}"); + defineMacro("\\thetasym", "\\vartheta"); + defineMacro("\\weierp", "\\wp"); + defineMacro("\\Zeta", "\\mathrm{Z}"); + defineMacro("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}"); + defineMacro("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}"); + defineMacro("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); + defineMacro("\\bra", "\\mathinner{\\langle{#1}|}"); + defineMacro("\\ket", "\\mathinner{|{#1}\\rangle}"); + defineMacro("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); + defineMacro("\\Bra", "\\left\\langle#1\\right|"); + defineMacro("\\Ket", "\\left|#1\\right\\rangle"); + braketHelper = /* @__PURE__ */ __name((one4) => (context) => { + var left3 = context.consumeArg().tokens; + var middle = context.consumeArg().tokens; + var middleDouble = context.consumeArg().tokens; + var right3 = context.consumeArg().tokens; + var oldMiddle = context.macros.get("|"); + var oldMiddleDouble = context.macros.get("\\|"); + context.macros.beginGroup(); + var midMacro = /* @__PURE__ */ __name((double) => (context2) => { + if (one4) { + context2.macros.set("|", oldMiddle); + if (middleDouble.length) { + context2.macros.set("\\|", oldMiddleDouble); + } + } + var doubled = double; + if (!double && middleDouble.length) { + var nextToken = context2.future(); + if (nextToken.text === "|") { + context2.popToken(); + doubled = true; + } + } + return { + tokens: doubled ? middleDouble : middle, + numArgs: 0 + }; + }, "midMacro"); + context.macros.set("|", midMacro(false)); + if (middleDouble.length) { + context.macros.set("\\|", midMacro(true)); + } + var arg = context.consumeArg().tokens; + var expanded = context.expandTokens([ + ...right3, + ...arg, + ...left3 + // reversed + ]); + context.macros.endGroup(); + return { + tokens: expanded.reverse(), + numArgs: 0 + }; + }, "braketHelper"); + defineMacro("\\bra@ket", braketHelper(false)); + defineMacro("\\bra@set", braketHelper(true)); + defineMacro("\\Braket", "\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"); + defineMacro("\\Set", "\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"); + defineMacro("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"); + defineMacro("\\angln", "{\\angl n}"); + defineMacro("\\blue", "\\textcolor{##6495ed}{#1}"); + defineMacro("\\orange", "\\textcolor{##ffa500}{#1}"); + defineMacro("\\pink", "\\textcolor{##ff00af}{#1}"); + defineMacro("\\red", "\\textcolor{##df0030}{#1}"); + defineMacro("\\green", "\\textcolor{##28ae7b}{#1}"); + defineMacro("\\gray", "\\textcolor{gray}{#1}"); + defineMacro("\\purple", "\\textcolor{##9d38bd}{#1}"); + defineMacro("\\blueA", "\\textcolor{##ccfaff}{#1}"); + defineMacro("\\blueB", "\\textcolor{##80f6ff}{#1}"); + defineMacro("\\blueC", "\\textcolor{##63d9ea}{#1}"); + defineMacro("\\blueD", "\\textcolor{##11accd}{#1}"); + defineMacro("\\blueE", "\\textcolor{##0c7f99}{#1}"); + defineMacro("\\tealA", "\\textcolor{##94fff5}{#1}"); + defineMacro("\\tealB", "\\textcolor{##26edd5}{#1}"); + defineMacro("\\tealC", "\\textcolor{##01d1c1}{#1}"); + defineMacro("\\tealD", "\\textcolor{##01a995}{#1}"); + defineMacro("\\tealE", "\\textcolor{##208170}{#1}"); + defineMacro("\\greenA", "\\textcolor{##b6ffb0}{#1}"); + defineMacro("\\greenB", "\\textcolor{##8af281}{#1}"); + defineMacro("\\greenC", "\\textcolor{##74cf70}{#1}"); + defineMacro("\\greenD", "\\textcolor{##1fab54}{#1}"); + defineMacro("\\greenE", "\\textcolor{##0d923f}{#1}"); + defineMacro("\\goldA", "\\textcolor{##ffd0a9}{#1}"); + defineMacro("\\goldB", "\\textcolor{##ffbb71}{#1}"); + defineMacro("\\goldC", "\\textcolor{##ff9c39}{#1}"); + defineMacro("\\goldD", "\\textcolor{##e07d10}{#1}"); + defineMacro("\\goldE", "\\textcolor{##a75a05}{#1}"); + defineMacro("\\redA", "\\textcolor{##fca9a9}{#1}"); + defineMacro("\\redB", "\\textcolor{##ff8482}{#1}"); + defineMacro("\\redC", "\\textcolor{##f9685d}{#1}"); + defineMacro("\\redD", "\\textcolor{##e84d39}{#1}"); + defineMacro("\\redE", "\\textcolor{##bc2612}{#1}"); + defineMacro("\\maroonA", "\\textcolor{##ffbde0}{#1}"); + defineMacro("\\maroonB", "\\textcolor{##ff92c6}{#1}"); + defineMacro("\\maroonC", "\\textcolor{##ed5fa6}{#1}"); + defineMacro("\\maroonD", "\\textcolor{##ca337c}{#1}"); + defineMacro("\\maroonE", "\\textcolor{##9e034e}{#1}"); + defineMacro("\\purpleA", "\\textcolor{##ddd7ff}{#1}"); + defineMacro("\\purpleB", "\\textcolor{##c6b9fc}{#1}"); + defineMacro("\\purpleC", "\\textcolor{##aa87ff}{#1}"); + defineMacro("\\purpleD", "\\textcolor{##7854ab}{#1}"); + defineMacro("\\purpleE", "\\textcolor{##543b78}{#1}"); + defineMacro("\\mintA", "\\textcolor{##f5f9e8}{#1}"); + defineMacro("\\mintB", "\\textcolor{##edf2df}{#1}"); + defineMacro("\\mintC", "\\textcolor{##e0e5cc}{#1}"); + defineMacro("\\grayA", "\\textcolor{##f6f7f7}{#1}"); + defineMacro("\\grayB", "\\textcolor{##f0f1f2}{#1}"); + defineMacro("\\grayC", "\\textcolor{##e3e5e6}{#1}"); + defineMacro("\\grayD", "\\textcolor{##d6d8da}{#1}"); + defineMacro("\\grayE", "\\textcolor{##babec2}{#1}"); + defineMacro("\\grayF", "\\textcolor{##888d93}{#1}"); + defineMacro("\\grayG", "\\textcolor{##626569}{#1}"); + defineMacro("\\grayH", "\\textcolor{##3b3e40}{#1}"); + defineMacro("\\grayI", "\\textcolor{##21242c}{#1}"); + defineMacro("\\kaBlue", "\\textcolor{##314453}{#1}"); + defineMacro("\\kaGreen", "\\textcolor{##71B307}{#1}"); + implicitCommands = { + "^": true, + // Parser.js + "_": true, + // Parser.js + "\\limits": true, + // Parser.js + "\\nolimits": true + // Parser.js + }; + MacroExpander = class { + static { + __name(this, "MacroExpander"); + } + constructor(input, settings, mode) { + this.settings = void 0; + this.expansionCount = void 0; + this.lexer = void 0; + this.macros = void 0; + this.stack = void 0; + this.mode = void 0; + this.settings = settings; + this.expansionCount = 0; + this.feed(input); + this.macros = new Namespace(macros, settings.macros); + this.mode = mode; + this.stack = []; + } + /** + * Feed a new input string to the same MacroExpander + * (with existing macros etc.). + */ + feed(input) { + this.lexer = new Lexer(input, this.settings); + } + /** + * Switches between "text" and "math" modes. + */ + switchMode(newMode) { + this.mode = newMode; + } + /** + * Start a new group nesting within all namespaces. + */ + beginGroup() { + this.macros.beginGroup(); + } + /** + * End current group nesting within all namespaces. + */ + endGroup() { + this.macros.endGroup(); + } + /** + * Ends all currently nested groups (if any), restoring values before the + * groups began. Useful in case of an error in the middle of parsing. + */ + endGroups() { + this.macros.endGroups(); + } + /** + * Returns the topmost token on the stack, without expanding it. + * Similar in behavior to TeX's `\futurelet`. + */ + future() { + if (this.stack.length === 0) { + this.pushToken(this.lexer.lex()); + } + return this.stack[this.stack.length - 1]; + } + /** + * Remove and return the next unexpanded token. + */ + popToken() { + this.future(); + return this.stack.pop(); + } + /** + * Add a given token to the token stack. In particular, this get be used + * to put back a token returned from one of the other methods. + */ + pushToken(token2) { + this.stack.push(token2); + } + /** + * Append an array of tokens to the token stack. + */ + pushTokens(tokens2) { + this.stack.push(...tokens2); + } + /** + * Find an macro argument without expanding tokens and append the array of + * tokens to the token stack. Uses Token as a container for the result. + */ + scanArgument(isOptional) { + var start3; + var end2; + var tokens2; + if (isOptional) { + this.consumeSpaces(); + if (this.future().text !== "[") { + return null; + } + start3 = this.popToken(); + ({ + tokens: tokens2, + end: end2 + } = this.consumeArg(["]"])); + } else { + ({ + tokens: tokens2, + start: start3, + end: end2 + } = this.consumeArg()); + } + this.pushToken(new Token("EOF", end2.loc)); + this.pushTokens(tokens2); + return new Token("", SourceLocation.range(start3, end2)); + } + /** + * Consume all following space tokens, without expansion. + */ + consumeSpaces() { + for (; ; ) { + var token2 = this.future(); + if (token2.text === " ") { + this.stack.pop(); + } else { + break; + } + } + } + /** + * Consume an argument from the token stream, and return the resulting array + * of tokens and start/end token. + */ + consumeArg(delims) { + var tokens2 = []; + var isDelimited = delims && delims.length > 0; + if (!isDelimited) { + this.consumeSpaces(); + } + var start3 = this.future(); + var tok; + var depth = 0; + var match3 = 0; + do { + tok = this.popToken(); + tokens2.push(tok); + if (tok.text === "{") { + ++depth; + } else if (tok.text === "}") { + --depth; + if (depth === -1) { + throw new ParseError("Extra }", tok); + } + } else if (tok.text === "EOF") { + throw new ParseError("Unexpected end of input in a macro argument, expected '" + (delims && isDelimited ? delims[match3] : "}") + "'", tok); + } + if (delims && isDelimited) { + if ((depth === 0 || depth === 1 && delims[match3] === "{") && tok.text === delims[match3]) { + ++match3; + if (match3 === delims.length) { + tokens2.splice(-match3, match3); + break; + } + } else { + match3 = 0; + } + } + } while (depth !== 0 || isDelimited); + if (start3.text === "{" && tokens2[tokens2.length - 1].text === "}") { + tokens2.pop(); + tokens2.shift(); + } + tokens2.reverse(); + return { + tokens: tokens2, + start: start3, + end: tok + }; + } + /** + * Consume the specified number of (delimited) arguments from the token + * stream and return the resulting array of arguments. + */ + consumeArgs(numArgs, delimiters2) { + if (delimiters2) { + if (delimiters2.length !== numArgs + 1) { + throw new ParseError("The length of delimiters doesn't match the number of args!"); + } + var delims = delimiters2[0]; + for (var i2 = 0; i2 < delims.length; i2++) { + var tok = this.popToken(); + if (delims[i2] !== tok.text) { + throw new ParseError("Use of the macro doesn't match its definition", tok); + } + } + } + var args = []; + for (var _i = 0; _i < numArgs; _i++) { + args.push(this.consumeArg(delimiters2 && delimiters2[_i + 1]).tokens); + } + return args; + } + /** + * Increment `expansionCount` by the specified amount. + * Throw an error if it exceeds `maxExpand`. + */ + countExpansion(amount) { + this.expansionCount += amount; + if (this.expansionCount > this.settings.maxExpand) { + throw new ParseError("Too many expansions: infinite loop or need to increase maxExpand setting"); + } + } + /** + * Expand the next token only once if possible. + * + * If the token is expanded, the resulting tokens will be pushed onto + * the stack in reverse order, and the number of such tokens will be + * returned. This number might be zero or positive. + * + * If not, the return value is `false`, and the next token remains at the + * top of the stack. + * + * In either case, the next token will be on the top of the stack, + * or the stack will be empty (in case of empty expansion + * and no other tokens). + * + * Used to implement `expandAfterFuture` and `expandNextToken`. + * + * If expandableOnly, only expandable tokens are expanded and + * an undefined control sequence results in an error. + */ + expandOnce(expandableOnly) { + var topToken = this.popToken(); + var name = topToken.text; + var expansion = !topToken.noexpand ? this._getExpansion(name) : null; + if (expansion == null || expandableOnly && expansion.unexpandable) { + if (expandableOnly && expansion == null && name[0] === "\\" && !this.isDefined(name)) { + throw new ParseError("Undefined control sequence: " + name); + } + this.pushToken(topToken); + return false; + } + this.countExpansion(1); + var tokens2 = expansion.tokens; + var args = this.consumeArgs(expansion.numArgs, expansion.delimiters); + if (expansion.numArgs) { + tokens2 = tokens2.slice(); + for (var i2 = tokens2.length - 1; i2 >= 0; --i2) { + var tok = tokens2[i2]; + if (tok.text === "#") { + if (i2 === 0) { + throw new ParseError("Incomplete placeholder at end of macro body", tok); + } + tok = tokens2[--i2]; + if (tok.text === "#") { + tokens2.splice(i2 + 1, 1); + } else if (/^[1-9]$/.test(tok.text)) { + tokens2.splice(i2, 2, ...args[+tok.text - 1]); + } else { + throw new ParseError("Not a valid argument number", tok); + } + } + } + } + this.pushTokens(tokens2); + return tokens2.length; + } + /** + * Expand the next token only once (if possible), and return the resulting + * top token on the stack (without removing anything from the stack). + * Similar in behavior to TeX's `\expandafter\futurelet`. + * Equivalent to expandOnce() followed by future(). + */ + expandAfterFuture() { + this.expandOnce(); + return this.future(); + } + /** + * Recursively expand first token, then return first non-expandable token. + */ + expandNextToken() { + for (; ; ) { + if (this.expandOnce() === false) { + var token2 = this.stack.pop(); + if (token2.treatAsRelax) { + token2.text = "\\relax"; + } + return token2; + } + } + throw new Error(); + } + /** + * Fully expand the given macro name and return the resulting list of + * tokens, or return `undefined` if no such macro is defined. + */ + expandMacro(name) { + return this.macros.has(name) ? this.expandTokens([new Token(name)]) : void 0; + } + /** + * Fully expand the given token stream and return the resulting list of + * tokens. Note that the input tokens are in reverse order, but the + * output tokens are in forward order. + */ + expandTokens(tokens2) { + var output2 = []; + var oldStackLength = this.stack.length; + this.pushTokens(tokens2); + while (this.stack.length > oldStackLength) { + if (this.expandOnce(true) === false) { + var token2 = this.stack.pop(); + if (token2.treatAsRelax) { + token2.noexpand = false; + token2.treatAsRelax = false; + } + output2.push(token2); + } + } + this.countExpansion(output2.length); + return output2; + } + /** + * Fully expand the given macro name and return the result as a string, + * or return `undefined` if no such macro is defined. + */ + expandMacroAsText(name) { + var tokens2 = this.expandMacro(name); + if (tokens2) { + return tokens2.map((token2) => token2.text).join(""); + } else { + return tokens2; + } + } + /** + * Returns the expanded macro as a reversed array of tokens and a macro + * argument count. Or returns `null` if no such macro. + */ + _getExpansion(name) { + var definition = this.macros.get(name); + if (definition == null) { + return definition; + } + if (name.length === 1) { + var catcode = this.lexer.catcodes[name]; + if (catcode != null && catcode !== 13) { + return; + } + } + var expansion = typeof definition === "function" ? definition(this) : definition; + if (typeof expansion === "string") { + var numArgs = 0; + if (expansion.indexOf("#") !== -1) { + var stripped = expansion.replace(/##/g, ""); + while (stripped.indexOf("#" + (numArgs + 1)) !== -1) { + ++numArgs; + } + } + var bodyLexer = new Lexer(expansion, this.settings); + var tokens2 = []; + var tok = bodyLexer.lex(); + while (tok.text !== "EOF") { + tokens2.push(tok); + tok = bodyLexer.lex(); + } + tokens2.reverse(); + var expanded = { + tokens: tokens2, + numArgs + }; + return expanded; + } + return expansion; + } + /** + * Determine whether a command is currently "defined" (has some + * functionality), meaning that it's a macro (in the current group), + * a function, a symbol, or one of the special commands listed in + * `implicitCommands`. + */ + isDefined(name) { + return this.macros.has(name) || functions.hasOwnProperty(name) || symbols.math.hasOwnProperty(name) || symbols.text.hasOwnProperty(name) || implicitCommands.hasOwnProperty(name); + } + /** + * Determine whether a command is expandable. + */ + isExpandable(name) { + var macro = this.macros.get(name); + return macro != null ? typeof macro === "string" || typeof macro === "function" || !macro.unexpandable : functions.hasOwnProperty(name) && !functions[name].primitive; + } + }; + unicodeSubRegEx = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/; + uSubsAndSups = Object.freeze({ + "\u208A": "+", + "\u208B": "-", + "\u208C": "=", + "\u208D": "(", + "\u208E": ")", + "\u2080": "0", + "\u2081": "1", + "\u2082": "2", + "\u2083": "3", + "\u2084": "4", + "\u2085": "5", + "\u2086": "6", + "\u2087": "7", + "\u2088": "8", + "\u2089": "9", + "\u2090": "a", + "\u2091": "e", + "\u2095": "h", + "\u1D62": "i", + "\u2C7C": "j", + "\u2096": "k", + "\u2097": "l", + "\u2098": "m", + "\u2099": "n", + "\u2092": "o", + "\u209A": "p", + "\u1D63": "r", + "\u209B": "s", + "\u209C": "t", + "\u1D64": "u", + "\u1D65": "v", + "\u2093": "x", + "\u1D66": "\u03B2", + "\u1D67": "\u03B3", + "\u1D68": "\u03C1", + "\u1D69": "\u03D5", + "\u1D6A": "\u03C7", + "\u207A": "+", + "\u207B": "-", + "\u207C": "=", + "\u207D": "(", + "\u207E": ")", + "\u2070": "0", + "\xB9": "1", + "\xB2": "2", + "\xB3": "3", + "\u2074": "4", + "\u2075": "5", + "\u2076": "6", + "\u2077": "7", + "\u2078": "8", + "\u2079": "9", + "\u1D2C": "A", + "\u1D2E": "B", + "\u1D30": "D", + "\u1D31": "E", + "\u1D33": "G", + "\u1D34": "H", + "\u1D35": "I", + "\u1D36": "J", + "\u1D37": "K", + "\u1D38": "L", + "\u1D39": "M", + "\u1D3A": "N", + "\u1D3C": "O", + "\u1D3E": "P", + "\u1D3F": "R", + "\u1D40": "T", + "\u1D41": "U", + "\u2C7D": "V", + "\u1D42": "W", + "\u1D43": "a", + "\u1D47": "b", + "\u1D9C": "c", + "\u1D48": "d", + "\u1D49": "e", + "\u1DA0": "f", + "\u1D4D": "g", + "\u02B0": "h", + "\u2071": "i", + "\u02B2": "j", + "\u1D4F": "k", + "\u02E1": "l", + "\u1D50": "m", + "\u207F": "n", + "\u1D52": "o", + "\u1D56": "p", + "\u02B3": "r", + "\u02E2": "s", + "\u1D57": "t", + "\u1D58": "u", + "\u1D5B": "v", + "\u02B7": "w", + "\u02E3": "x", + "\u02B8": "y", + "\u1DBB": "z", + "\u1D5D": "\u03B2", + "\u1D5E": "\u03B3", + "\u1D5F": "\u03B4", + "\u1D60": "\u03D5", + "\u1D61": "\u03C7", + "\u1DBF": "\u03B8" + }); + unicodeAccents = { + "\u0301": { + "text": "\\'", + "math": "\\acute" + }, + "\u0300": { + "text": "\\`", + "math": "\\grave" + }, + "\u0308": { + "text": '\\"', + "math": "\\ddot" + }, + "\u0303": { + "text": "\\~", + "math": "\\tilde" + }, + "\u0304": { + "text": "\\=", + "math": "\\bar" + }, + "\u0306": { + "text": "\\u", + "math": "\\breve" + }, + "\u030C": { + "text": "\\v", + "math": "\\check" + }, + "\u0302": { + "text": "\\^", + "math": "\\hat" + }, + "\u0307": { + "text": "\\.", + "math": "\\dot" + }, + "\u030A": { + "text": "\\r", + "math": "\\mathring" + }, + "\u030B": { + "text": "\\H" + }, + "\u0327": { + "text": "\\c" + } + }; + unicodeSymbols = { + "\xE1": "a\u0301", + "\xE0": "a\u0300", + "\xE4": "a\u0308", + "\u01DF": "a\u0308\u0304", + "\xE3": "a\u0303", + "\u0101": "a\u0304", + "\u0103": "a\u0306", + "\u1EAF": "a\u0306\u0301", + "\u1EB1": "a\u0306\u0300", + "\u1EB5": "a\u0306\u0303", + "\u01CE": "a\u030C", + "\xE2": "a\u0302", + "\u1EA5": "a\u0302\u0301", + "\u1EA7": "a\u0302\u0300", + "\u1EAB": "a\u0302\u0303", + "\u0227": "a\u0307", + "\u01E1": "a\u0307\u0304", + "\xE5": "a\u030A", + "\u01FB": "a\u030A\u0301", + "\u1E03": "b\u0307", + "\u0107": "c\u0301", + "\u1E09": "c\u0327\u0301", + "\u010D": "c\u030C", + "\u0109": "c\u0302", + "\u010B": "c\u0307", + "\xE7": "c\u0327", + "\u010F": "d\u030C", + "\u1E0B": "d\u0307", + "\u1E11": "d\u0327", + "\xE9": "e\u0301", + "\xE8": "e\u0300", + "\xEB": "e\u0308", + "\u1EBD": "e\u0303", + "\u0113": "e\u0304", + "\u1E17": "e\u0304\u0301", + "\u1E15": "e\u0304\u0300", + "\u0115": "e\u0306", + "\u1E1D": "e\u0327\u0306", + "\u011B": "e\u030C", + "\xEA": "e\u0302", + "\u1EBF": "e\u0302\u0301", + "\u1EC1": "e\u0302\u0300", + "\u1EC5": "e\u0302\u0303", + "\u0117": "e\u0307", + "\u0229": "e\u0327", + "\u1E1F": "f\u0307", + "\u01F5": "g\u0301", + "\u1E21": "g\u0304", + "\u011F": "g\u0306", + "\u01E7": "g\u030C", + "\u011D": "g\u0302", + "\u0121": "g\u0307", + "\u0123": "g\u0327", + "\u1E27": "h\u0308", + "\u021F": "h\u030C", + "\u0125": "h\u0302", + "\u1E23": "h\u0307", + "\u1E29": "h\u0327", + "\xED": "i\u0301", + "\xEC": "i\u0300", + "\xEF": "i\u0308", + "\u1E2F": "i\u0308\u0301", + "\u0129": "i\u0303", + "\u012B": "i\u0304", + "\u012D": "i\u0306", + "\u01D0": "i\u030C", + "\xEE": "i\u0302", + "\u01F0": "j\u030C", + "\u0135": "j\u0302", + "\u1E31": "k\u0301", + "\u01E9": "k\u030C", + "\u0137": "k\u0327", + "\u013A": "l\u0301", + "\u013E": "l\u030C", + "\u013C": "l\u0327", + "\u1E3F": "m\u0301", + "\u1E41": "m\u0307", + "\u0144": "n\u0301", + "\u01F9": "n\u0300", + "\xF1": "n\u0303", + "\u0148": "n\u030C", + "\u1E45": "n\u0307", + "\u0146": "n\u0327", + "\xF3": "o\u0301", + "\xF2": "o\u0300", + "\xF6": "o\u0308", + "\u022B": "o\u0308\u0304", + "\xF5": "o\u0303", + "\u1E4D": "o\u0303\u0301", + "\u1E4F": "o\u0303\u0308", + "\u022D": "o\u0303\u0304", + "\u014D": "o\u0304", + "\u1E53": "o\u0304\u0301", + "\u1E51": "o\u0304\u0300", + "\u014F": "o\u0306", + "\u01D2": "o\u030C", + "\xF4": "o\u0302", + "\u1ED1": "o\u0302\u0301", + "\u1ED3": "o\u0302\u0300", + "\u1ED7": "o\u0302\u0303", + "\u022F": "o\u0307", + "\u0231": "o\u0307\u0304", + "\u0151": "o\u030B", + "\u1E55": "p\u0301", + "\u1E57": "p\u0307", + "\u0155": "r\u0301", + "\u0159": "r\u030C", + "\u1E59": "r\u0307", + "\u0157": "r\u0327", + "\u015B": "s\u0301", + "\u1E65": "s\u0301\u0307", + "\u0161": "s\u030C", + "\u1E67": "s\u030C\u0307", + "\u015D": "s\u0302", + "\u1E61": "s\u0307", + "\u015F": "s\u0327", + "\u1E97": "t\u0308", + "\u0165": "t\u030C", + "\u1E6B": "t\u0307", + "\u0163": "t\u0327", + "\xFA": "u\u0301", + "\xF9": "u\u0300", + "\xFC": "u\u0308", + "\u01D8": "u\u0308\u0301", + "\u01DC": "u\u0308\u0300", + "\u01D6": "u\u0308\u0304", + "\u01DA": "u\u0308\u030C", + "\u0169": "u\u0303", + "\u1E79": "u\u0303\u0301", + "\u016B": "u\u0304", + "\u1E7B": "u\u0304\u0308", + "\u016D": "u\u0306", + "\u01D4": "u\u030C", + "\xFB": "u\u0302", + "\u016F": "u\u030A", + "\u0171": "u\u030B", + "\u1E7D": "v\u0303", + "\u1E83": "w\u0301", + "\u1E81": "w\u0300", + "\u1E85": "w\u0308", + "\u0175": "w\u0302", + "\u1E87": "w\u0307", + "\u1E98": "w\u030A", + "\u1E8D": "x\u0308", + "\u1E8B": "x\u0307", + "\xFD": "y\u0301", + "\u1EF3": "y\u0300", + "\xFF": "y\u0308", + "\u1EF9": "y\u0303", + "\u0233": "y\u0304", + "\u0177": "y\u0302", + "\u1E8F": "y\u0307", + "\u1E99": "y\u030A", + "\u017A": "z\u0301", + "\u017E": "z\u030C", + "\u1E91": "z\u0302", + "\u017C": "z\u0307", + "\xC1": "A\u0301", + "\xC0": "A\u0300", + "\xC4": "A\u0308", + "\u01DE": "A\u0308\u0304", + "\xC3": "A\u0303", + "\u0100": "A\u0304", + "\u0102": "A\u0306", + "\u1EAE": "A\u0306\u0301", + "\u1EB0": "A\u0306\u0300", + "\u1EB4": "A\u0306\u0303", + "\u01CD": "A\u030C", + "\xC2": "A\u0302", + "\u1EA4": "A\u0302\u0301", + "\u1EA6": "A\u0302\u0300", + "\u1EAA": "A\u0302\u0303", + "\u0226": "A\u0307", + "\u01E0": "A\u0307\u0304", + "\xC5": "A\u030A", + "\u01FA": "A\u030A\u0301", + "\u1E02": "B\u0307", + "\u0106": "C\u0301", + "\u1E08": "C\u0327\u0301", + "\u010C": "C\u030C", + "\u0108": "C\u0302", + "\u010A": "C\u0307", + "\xC7": "C\u0327", + "\u010E": "D\u030C", + "\u1E0A": "D\u0307", + "\u1E10": "D\u0327", + "\xC9": "E\u0301", + "\xC8": "E\u0300", + "\xCB": "E\u0308", + "\u1EBC": "E\u0303", + "\u0112": "E\u0304", + "\u1E16": "E\u0304\u0301", + "\u1E14": "E\u0304\u0300", + "\u0114": "E\u0306", + "\u1E1C": "E\u0327\u0306", + "\u011A": "E\u030C", + "\xCA": "E\u0302", + "\u1EBE": "E\u0302\u0301", + "\u1EC0": "E\u0302\u0300", + "\u1EC4": "E\u0302\u0303", + "\u0116": "E\u0307", + "\u0228": "E\u0327", + "\u1E1E": "F\u0307", + "\u01F4": "G\u0301", + "\u1E20": "G\u0304", + "\u011E": "G\u0306", + "\u01E6": "G\u030C", + "\u011C": "G\u0302", + "\u0120": "G\u0307", + "\u0122": "G\u0327", + "\u1E26": "H\u0308", + "\u021E": "H\u030C", + "\u0124": "H\u0302", + "\u1E22": "H\u0307", + "\u1E28": "H\u0327", + "\xCD": "I\u0301", + "\xCC": "I\u0300", + "\xCF": "I\u0308", + "\u1E2E": "I\u0308\u0301", + "\u0128": "I\u0303", + "\u012A": "I\u0304", + "\u012C": "I\u0306", + "\u01CF": "I\u030C", + "\xCE": "I\u0302", + "\u0130": "I\u0307", + "\u0134": "J\u0302", + "\u1E30": "K\u0301", + "\u01E8": "K\u030C", + "\u0136": "K\u0327", + "\u0139": "L\u0301", + "\u013D": "L\u030C", + "\u013B": "L\u0327", + "\u1E3E": "M\u0301", + "\u1E40": "M\u0307", + "\u0143": "N\u0301", + "\u01F8": "N\u0300", + "\xD1": "N\u0303", + "\u0147": "N\u030C", + "\u1E44": "N\u0307", + "\u0145": "N\u0327", + "\xD3": "O\u0301", + "\xD2": "O\u0300", + "\xD6": "O\u0308", + "\u022A": "O\u0308\u0304", + "\xD5": "O\u0303", + "\u1E4C": "O\u0303\u0301", + "\u1E4E": "O\u0303\u0308", + "\u022C": "O\u0303\u0304", + "\u014C": "O\u0304", + "\u1E52": "O\u0304\u0301", + "\u1E50": "O\u0304\u0300", + "\u014E": "O\u0306", + "\u01D1": "O\u030C", + "\xD4": "O\u0302", + "\u1ED0": "O\u0302\u0301", + "\u1ED2": "O\u0302\u0300", + "\u1ED6": "O\u0302\u0303", + "\u022E": "O\u0307", + "\u0230": "O\u0307\u0304", + "\u0150": "O\u030B", + "\u1E54": "P\u0301", + "\u1E56": "P\u0307", + "\u0154": "R\u0301", + "\u0158": "R\u030C", + "\u1E58": "R\u0307", + "\u0156": "R\u0327", + "\u015A": "S\u0301", + "\u1E64": "S\u0301\u0307", + "\u0160": "S\u030C", + "\u1E66": "S\u030C\u0307", + "\u015C": "S\u0302", + "\u1E60": "S\u0307", + "\u015E": "S\u0327", + "\u0164": "T\u030C", + "\u1E6A": "T\u0307", + "\u0162": "T\u0327", + "\xDA": "U\u0301", + "\xD9": "U\u0300", + "\xDC": "U\u0308", + "\u01D7": "U\u0308\u0301", + "\u01DB": "U\u0308\u0300", + "\u01D5": "U\u0308\u0304", + "\u01D9": "U\u0308\u030C", + "\u0168": "U\u0303", + "\u1E78": "U\u0303\u0301", + "\u016A": "U\u0304", + "\u1E7A": "U\u0304\u0308", + "\u016C": "U\u0306", + "\u01D3": "U\u030C", + "\xDB": "U\u0302", + "\u016E": "U\u030A", + "\u0170": "U\u030B", + "\u1E7C": "V\u0303", + "\u1E82": "W\u0301", + "\u1E80": "W\u0300", + "\u1E84": "W\u0308", + "\u0174": "W\u0302", + "\u1E86": "W\u0307", + "\u1E8C": "X\u0308", + "\u1E8A": "X\u0307", + "\xDD": "Y\u0301", + "\u1EF2": "Y\u0300", + "\u0178": "Y\u0308", + "\u1EF8": "Y\u0303", + "\u0232": "Y\u0304", + "\u0176": "Y\u0302", + "\u1E8E": "Y\u0307", + "\u0179": "Z\u0301", + "\u017D": "Z\u030C", + "\u1E90": "Z\u0302", + "\u017B": "Z\u0307", + "\u03AC": "\u03B1\u0301", + "\u1F70": "\u03B1\u0300", + "\u1FB1": "\u03B1\u0304", + "\u1FB0": "\u03B1\u0306", + "\u03AD": "\u03B5\u0301", + "\u1F72": "\u03B5\u0300", + "\u03AE": "\u03B7\u0301", + "\u1F74": "\u03B7\u0300", + "\u03AF": "\u03B9\u0301", + "\u1F76": "\u03B9\u0300", + "\u03CA": "\u03B9\u0308", + "\u0390": "\u03B9\u0308\u0301", + "\u1FD2": "\u03B9\u0308\u0300", + "\u1FD1": "\u03B9\u0304", + "\u1FD0": "\u03B9\u0306", + "\u03CC": "\u03BF\u0301", + "\u1F78": "\u03BF\u0300", + "\u03CD": "\u03C5\u0301", + "\u1F7A": "\u03C5\u0300", + "\u03CB": "\u03C5\u0308", + "\u03B0": "\u03C5\u0308\u0301", + "\u1FE2": "\u03C5\u0308\u0300", + "\u1FE1": "\u03C5\u0304", + "\u1FE0": "\u03C5\u0306", + "\u03CE": "\u03C9\u0301", + "\u1F7C": "\u03C9\u0300", + "\u038E": "\u03A5\u0301", + "\u1FEA": "\u03A5\u0300", + "\u03AB": "\u03A5\u0308", + "\u1FE9": "\u03A5\u0304", + "\u1FE8": "\u03A5\u0306", + "\u038F": "\u03A9\u0301", + "\u1FFA": "\u03A9\u0300" + }; + Parser = class _Parser2 { + static { + __name(this, "Parser"); + } + constructor(input, settings) { + this.mode = void 0; + this.gullet = void 0; + this.settings = void 0; + this.leftrightDepth = void 0; + this.nextToken = void 0; + this.mode = "math"; + this.gullet = new MacroExpander(input, settings, this.mode); + this.settings = settings; + this.leftrightDepth = 0; + } + /** + * Checks a result to make sure it has the right type, and throws an + * appropriate error otherwise. + */ + expect(text4, consume) { + if (consume === void 0) { + consume = true; + } + if (this.fetch().text !== text4) { + throw new ParseError("Expected '" + text4 + "', got '" + this.fetch().text + "'", this.fetch()); + } + if (consume) { + this.consume(); + } + } + /** + * Discards the current lookahead token, considering it consumed. + */ + consume() { + this.nextToken = null; + } + /** + * Return the current lookahead token, or if there isn't one (at the + * beginning, or if the previous lookahead token was consume()d), + * fetch the next token as the new lookahead token and return it. + */ + fetch() { + if (this.nextToken == null) { + this.nextToken = this.gullet.expandNextToken(); + } + return this.nextToken; + } + /** + * Switches between "text" and "math" modes. + */ + switchMode(newMode) { + this.mode = newMode; + this.gullet.switchMode(newMode); + } + /** + * Main parsing function, which parses an entire input. + */ + parse() { + if (!this.settings.globalGroup) { + this.gullet.beginGroup(); + } + if (this.settings.colorIsTextColor) { + this.gullet.macros.set("\\color", "\\textcolor"); + } + try { + var parse7 = this.parseExpression(false); + this.expect("EOF"); + if (!this.settings.globalGroup) { + this.gullet.endGroup(); + } + return parse7; + } finally { + this.gullet.endGroups(); + } + } + /** + * Fully parse a separate sequence of tokens as a separate job. + * Tokens should be specified in reverse order, as in a MacroDefinition. + */ + subparse(tokens2) { + var oldToken = this.nextToken; + this.consume(); + this.gullet.pushToken(new Token("}")); + this.gullet.pushTokens(tokens2); + var parse7 = this.parseExpression(false); + this.expect("}"); + this.nextToken = oldToken; + return parse7; + } + /** + * Parses an "expression", which is a list of atoms. + * + * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This + * happens when functions have higher precedence han infix + * nodes in implicit parses. + * + * `breakOnTokenText`: The text of the token that the expression should end + * with, or `null` if something else should end the + * expression. + */ + parseExpression(breakOnInfix, breakOnTokenText) { + var body = []; + while (true) { + if (this.mode === "math") { + this.consumeSpaces(); + } + var lex = this.fetch(); + if (_Parser2.endOfExpression.indexOf(lex.text) !== -1) { + break; + } + if (breakOnTokenText && lex.text === breakOnTokenText) { + break; + } + if (breakOnInfix && functions[lex.text] && functions[lex.text].infix) { + break; + } + var atom2 = this.parseAtom(breakOnTokenText); + if (!atom2) { + break; + } else if (atom2.type === "internal") { + continue; + } + body.push(atom2); + } + if (this.mode === "text") { + this.formLigatures(body); + } + return this.handleInfixNodes(body); + } + /** + * Rewrites infix operators such as \over with corresponding commands such + * as \frac. + * + * There can only be one infix operator per group. If there's more than one + * then the expression is ambiguous. This can be resolved by adding {}. + */ + handleInfixNodes(body) { + var overIndex = -1; + var funcName; + for (var i2 = 0; i2 < body.length; i2++) { + if (body[i2].type === "infix") { + if (overIndex !== -1) { + throw new ParseError("only one infix operator per group", body[i2].token); + } + overIndex = i2; + funcName = body[i2].replaceWith; + } + } + if (overIndex !== -1 && funcName) { + var numerNode; + var denomNode; + var numerBody = body.slice(0, overIndex); + var denomBody = body.slice(overIndex + 1); + if (numerBody.length === 1 && numerBody[0].type === "ordgroup") { + numerNode = numerBody[0]; + } else { + numerNode = { + type: "ordgroup", + mode: this.mode, + body: numerBody + }; + } + if (denomBody.length === 1 && denomBody[0].type === "ordgroup") { + denomNode = denomBody[0]; + } else { + denomNode = { + type: "ordgroup", + mode: this.mode, + body: denomBody + }; + } + var node2; + if (funcName === "\\\\abovefrac") { + node2 = this.callFunction(funcName, [numerNode, body[overIndex], denomNode], []); + } else { + node2 = this.callFunction(funcName, [numerNode, denomNode], []); + } + return [node2]; + } else { + return body; + } + } + /** + * Handle a subscript or superscript with nice errors. + */ + handleSupSubscript(name) { + var symbolToken = this.fetch(); + var symbol = symbolToken.text; + this.consume(); + this.consumeSpaces(); + var group2; + do { + var _group; + group2 = this.parseGroup(name); + } while (((_group = group2) == null ? void 0 : _group.type) === "internal"); + if (!group2) { + throw new ParseError("Expected group after '" + symbol + "'", symbolToken); + } + return group2; + } + /** + * Converts the textual input of an unsupported command into a text node + * contained within a color node whose color is determined by errorColor + */ + formatUnsupportedCmd(text4) { + var textordArray = []; + for (var i2 = 0; i2 < text4.length; i2++) { + textordArray.push({ + type: "textord", + mode: "text", + text: text4[i2] + }); + } + var textNode = { + type: "text", + mode: this.mode, + body: textordArray + }; + var colorNode = { + type: "color", + mode: this.mode, + color: this.settings.errorColor, + body: [textNode] + }; + return colorNode; + } + /** + * Parses a group with optional super/subscripts. + */ + parseAtom(breakOnTokenText) { + var base = this.parseGroup("atom", breakOnTokenText); + if ((base == null ? void 0 : base.type) === "internal") { + return base; + } + if (this.mode === "text") { + return base; + } + var superscript; + var subscript; + while (true) { + this.consumeSpaces(); + var lex = this.fetch(); + if (lex.text === "\\limits" || lex.text === "\\nolimits") { + if (base && base.type === "op") { + var limits = lex.text === "\\limits"; + base.limits = limits; + base.alwaysHandleSupSub = true; + } else if (base && base.type === "operatorname") { + if (base.alwaysHandleSupSub) { + base.limits = lex.text === "\\limits"; + } + } else { + throw new ParseError("Limit controls must follow a math operator", lex); + } + this.consume(); + } else if (lex.text === "^") { + if (superscript) { + throw new ParseError("Double superscript", lex); + } + superscript = this.handleSupSubscript("superscript"); + } else if (lex.text === "_") { + if (subscript) { + throw new ParseError("Double subscript", lex); + } + subscript = this.handleSupSubscript("subscript"); + } else if (lex.text === "'") { + if (superscript) { + throw new ParseError("Double superscript", lex); + } + var prime = { + type: "textord", + mode: this.mode, + text: "\\prime" + }; + var primes = [prime]; + this.consume(); + while (this.fetch().text === "'") { + primes.push(prime); + this.consume(); + } + if (this.fetch().text === "^") { + primes.push(this.handleSupSubscript("superscript")); + } + superscript = { + type: "ordgroup", + mode: this.mode, + body: primes + }; + } else if (uSubsAndSups[lex.text]) { + var isSub = unicodeSubRegEx.test(lex.text); + var subsupTokens = []; + subsupTokens.push(new Token(uSubsAndSups[lex.text])); + this.consume(); + while (true) { + var token2 = this.fetch().text; + if (!uSubsAndSups[token2]) { + break; + } + if (unicodeSubRegEx.test(token2) !== isSub) { + break; + } + subsupTokens.unshift(new Token(uSubsAndSups[token2])); + this.consume(); + } + var body = this.subparse(subsupTokens); + if (isSub) { + subscript = { + type: "ordgroup", + mode: "math", + body + }; + } else { + superscript = { + type: "ordgroup", + mode: "math", + body + }; + } + } else { + break; + } + } + if (superscript || subscript) { + return { + type: "supsub", + mode: this.mode, + base, + sup: superscript, + sub: subscript + }; + } else { + return base; + } + } + /** + * Parses an entire function, including its base and all of its arguments. + */ + parseFunction(breakOnTokenText, name) { + var token2 = this.fetch(); + var func = token2.text; + var funcData = functions[func]; + if (!funcData) { + return null; + } + this.consume(); + if (name && name !== "atom" && !funcData.allowedInArgument) { + throw new ParseError("Got function '" + func + "' with no arguments" + (name ? " as " + name : ""), token2); + } else if (this.mode === "text" && !funcData.allowedInText) { + throw new ParseError("Can't use function '" + func + "' in text mode", token2); + } else if (this.mode === "math" && funcData.allowedInMath === false) { + throw new ParseError("Can't use function '" + func + "' in math mode", token2); + } + var { + args, + optArgs + } = this.parseArguments(func, funcData); + return this.callFunction(func, args, optArgs, token2, breakOnTokenText); + } + /** + * Call a function handler with a suitable context and arguments. + */ + callFunction(name, args, optArgs, token2, breakOnTokenText) { + var context = { + funcName: name, + parser: this, + token: token2, + breakOnTokenText + }; + var func = functions[name]; + if (func && func.handler) { + return func.handler(context, args, optArgs); + } else { + throw new ParseError("No function handler for " + name); + } + } + /** + * Parses the arguments of a function or environment + */ + parseArguments(func, funcData) { + var totalArgs = funcData.numArgs + funcData.numOptionalArgs; + if (totalArgs === 0) { + return { + args: [], + optArgs: [] + }; + } + var args = []; + var optArgs = []; + for (var i2 = 0; i2 < totalArgs; i2++) { + var argType = funcData.argTypes && funcData.argTypes[i2]; + var isOptional = i2 < funcData.numOptionalArgs; + if (funcData.primitive && argType == null || // \sqrt expands into primitive if optional argument doesn't exist + funcData.type === "sqrt" && i2 === 1 && optArgs[0] == null) { + argType = "primitive"; + } + var arg = this.parseGroupOfType("argument to '" + func + "'", argType, isOptional); + if (isOptional) { + optArgs.push(arg); + } else if (arg != null) { + args.push(arg); + } else { + throw new ParseError("Null argument, please report this as a bug"); + } + } + return { + args, + optArgs + }; + } + /** + * Parses a group when the mode is changing. + */ + parseGroupOfType(name, type3, optional2) { + switch (type3) { + case "color": + return this.parseColorGroup(optional2); + case "size": + return this.parseSizeGroup(optional2); + case "url": + return this.parseUrlGroup(optional2); + case "math": + case "text": + return this.parseArgumentGroup(optional2, type3); + case "hbox": { + var group2 = this.parseArgumentGroup(optional2, "text"); + return group2 != null ? { + type: "styling", + mode: group2.mode, + body: [group2], + style: "text" + // simulate \textstyle + } : null; + } + case "raw": { + var token2 = this.parseStringGroup("raw", optional2); + return token2 != null ? { + type: "raw", + mode: "text", + string: token2.text + } : null; + } + case "primitive": { + if (optional2) { + throw new ParseError("A primitive argument cannot be optional"); + } + var _group2 = this.parseGroup(name); + if (_group2 == null) { + throw new ParseError("Expected group as " + name, this.fetch()); + } + return _group2; + } + case "original": + case null: + case void 0: + return this.parseArgumentGroup(optional2); + default: + throw new ParseError("Unknown group type as " + name, this.fetch()); + } + } + /** + * Discard any space tokens, fetching the next non-space token. + */ + consumeSpaces() { + while (this.fetch().text === " ") { + this.consume(); + } + } + /** + * Parses a group, essentially returning the string formed by the + * brace-enclosed tokens plus some position information. + */ + parseStringGroup(modeName, optional2) { + var argToken = this.gullet.scanArgument(optional2); + if (argToken == null) { + return null; + } + var str2 = ""; + var nextToken; + while ((nextToken = this.fetch()).text !== "EOF") { + str2 += nextToken.text; + this.consume(); + } + this.consume(); + argToken.text = str2; + return argToken; + } + /** + * Parses a regex-delimited group: the largest sequence of tokens + * whose concatenated strings match `regex`. Returns the string + * formed by the tokens plus some position information. + */ + parseRegexGroup(regex2, modeName) { + var firstToken = this.fetch(); + var lastToken = firstToken; + var str2 = ""; + var nextToken; + while ((nextToken = this.fetch()).text !== "EOF" && regex2.test(str2 + nextToken.text)) { + lastToken = nextToken; + str2 += lastToken.text; + this.consume(); + } + if (str2 === "") { + throw new ParseError("Invalid " + modeName + ": '" + firstToken.text + "'", firstToken); + } + return firstToken.range(lastToken, str2); + } + /** + * Parses a color description. + */ + parseColorGroup(optional2) { + var res = this.parseStringGroup("color", optional2); + if (res == null) { + return null; + } + var match3 = /^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(res.text); + if (!match3) { + throw new ParseError("Invalid color: '" + res.text + "'", res); + } + var color2 = match3[0]; + if (/^[0-9a-f]{6}$/i.test(color2)) { + color2 = "#" + color2; + } + return { + type: "color-token", + mode: this.mode, + color: color2 + }; + } + /** + * Parses a size specification, consisting of magnitude and unit. + */ + parseSizeGroup(optional2) { + var res; + var isBlank = false; + this.gullet.consumeSpaces(); + if (!optional2 && this.gullet.future().text !== "{") { + res = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size"); + } else { + res = this.parseStringGroup("size", optional2); + } + if (!res) { + return null; + } + if (!optional2 && res.text.length === 0) { + res.text = "0pt"; + isBlank = true; + } + var match3 = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(res.text); + if (!match3) { + throw new ParseError("Invalid size: '" + res.text + "'", res); + } + var data5 = { + number: +(match3[1] + match3[2]), + // sign + magnitude, cast to number + unit: match3[3] + }; + if (!validUnit(data5)) { + throw new ParseError("Invalid unit: '" + data5.unit + "'", res); + } + return { + type: "size", + mode: this.mode, + value: data5, + isBlank + }; + } + /** + * Parses an URL, checking escaped letters and allowed protocols, + * and setting the catcode of % as an active character (as in \hyperref). + */ + parseUrlGroup(optional2) { + this.gullet.lexer.setCatcode("%", 13); + this.gullet.lexer.setCatcode("~", 12); + var res = this.parseStringGroup("url", optional2); + this.gullet.lexer.setCatcode("%", 14); + this.gullet.lexer.setCatcode("~", 13); + if (res == null) { + return null; + } + var url = res.text.replace(/\\([#$%&~_^{}])/g, "$1"); + return { + type: "url", + mode: this.mode, + url + }; + } + /** + * Parses an argument with the mode specified. + */ + parseArgumentGroup(optional2, mode) { + var argToken = this.gullet.scanArgument(optional2); + if (argToken == null) { + return null; + } + var outerMode = this.mode; + if (mode) { + this.switchMode(mode); + } + this.gullet.beginGroup(); + var expression = this.parseExpression(false, "EOF"); + this.expect("EOF"); + this.gullet.endGroup(); + var result = { + type: "ordgroup", + mode: this.mode, + loc: argToken.loc, + body: expression + }; + if (mode) { + this.switchMode(outerMode); + } + return result; + } + /** + * Parses an ordinary group, which is either a single nucleus (like "x") + * or an expression in braces (like "{x+y}") or an implicit group, a group + * that starts at the current position, and ends right before a higher explicit + * group ends, or at EOF. + */ + parseGroup(name, breakOnTokenText) { + var firstToken = this.fetch(); + var text4 = firstToken.text; + var result; + if (text4 === "{" || text4 === "\\begingroup") { + this.consume(); + var groupEnd = text4 === "{" ? "}" : "\\endgroup"; + this.gullet.beginGroup(); + var expression = this.parseExpression(false, groupEnd); + var lastToken = this.fetch(); + this.expect(groupEnd); + this.gullet.endGroup(); + result = { + type: "ordgroup", + mode: this.mode, + loc: SourceLocation.range(firstToken, lastToken), + body: expression, + // A group formed by \begingroup...\endgroup is a semi-simple group + // which doesn't affect spacing in math mode, i.e., is transparent. + // https://tex.stackexchange.com/questions/1930/when-should-one- + // use-begingroup-instead-of-bgroup + semisimple: text4 === "\\begingroup" || void 0 + }; + } else { + result = this.parseFunction(breakOnTokenText, name) || this.parseSymbol(); + if (result == null && text4[0] === "\\" && !implicitCommands.hasOwnProperty(text4)) { + if (this.settings.throwOnError) { + throw new ParseError("Undefined control sequence: " + text4, firstToken); + } + result = this.formatUnsupportedCmd(text4); + this.consume(); + } + } + return result; + } + /** + * Form ligature-like combinations of characters for text mode. + * This includes inputs like "--", "---", "``" and "''". + * The result will simply replace multiple textord nodes with a single + * character in each value by a single textord node having multiple + * characters in its value. The representation is still ASCII source. + * The group will be modified in place. + */ + formLigatures(group2) { + var n2 = group2.length - 1; + for (var i2 = 0; i2 < n2; ++i2) { + var a2 = group2[i2]; + var v3 = a2.text; + if (v3 === "-" && group2[i2 + 1].text === "-") { + if (i2 + 1 < n2 && group2[i2 + 2].text === "-") { + group2.splice(i2, 3, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a2, group2[i2 + 2]), + text: "---" + }); + n2 -= 2; + } else { + group2.splice(i2, 2, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a2, group2[i2 + 1]), + text: "--" + }); + n2 -= 1; + } + } + if ((v3 === "'" || v3 === "`") && group2[i2 + 1].text === v3) { + group2.splice(i2, 2, { + type: "textord", + mode: "text", + loc: SourceLocation.range(a2, group2[i2 + 1]), + text: v3 + v3 + }); + n2 -= 1; + } + } + } + /** + * Parse a single symbol out of the string. Here, we handle single character + * symbols and special functions like \verb. + */ + parseSymbol() { + var nucleus = this.fetch(); + var text4 = nucleus.text; + if (/^\\verb[^a-zA-Z]/.test(text4)) { + this.consume(); + var arg = text4.slice(5); + var star2 = arg.charAt(0) === "*"; + if (star2) { + arg = arg.slice(1); + } + if (arg.length < 2 || arg.charAt(0) !== arg.slice(-1)) { + throw new ParseError("\\verb assertion failed --\n please report what input caused this bug"); + } + arg = arg.slice(1, -1); + return { + type: "verb", + mode: "text", + body: arg, + star: star2 + }; + } + if (unicodeSymbols.hasOwnProperty(text4[0]) && !symbols[this.mode][text4[0]]) { + if (this.settings.strict && this.mode === "math") { + this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + text4[0] + '" used in math mode', nucleus); + } + text4 = unicodeSymbols[text4[0]] + text4.slice(1); + } + var match3 = combiningDiacriticalMarksEndRegex.exec(text4); + if (match3) { + text4 = text4.substring(0, match3.index); + if (text4 === "i") { + text4 = "\u0131"; + } else if (text4 === "j") { + text4 = "\u0237"; + } + } + var symbol; + if (symbols[this.mode][text4]) { + if (this.settings.strict && this.mode === "math" && extraLatin.indexOf(text4) >= 0) { + this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + text4[0] + '" used in math mode', nucleus); + } + var group2 = symbols[this.mode][text4].group; + var loc = SourceLocation.range(nucleus); + var s2; + if (ATOMS.hasOwnProperty(group2)) { + var family = group2; + s2 = { + type: "atom", + mode: this.mode, + family, + loc, + text: text4 + }; + } else { + s2 = { + type: group2, + mode: this.mode, + loc, + text: text4 + }; + } + symbol = s2; + } else if (text4.charCodeAt(0) >= 128) { + if (this.settings.strict) { + if (!supportedCodepoint(text4.charCodeAt(0))) { + this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + text4[0] + '"' + (" (" + text4.charCodeAt(0) + ")"), nucleus); + } else if (this.mode === "math") { + this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + text4[0] + '" used in math mode', nucleus); + } + } + symbol = { + type: "textord", + mode: "text", + loc: SourceLocation.range(nucleus), + text: text4 + }; + } else { + return null; + } + this.consume(); + if (match3) { + for (var i2 = 0; i2 < match3[0].length; i2++) { + var accent2 = match3[0][i2]; + if (!unicodeAccents[accent2]) { + throw new ParseError("Unknown accent ' " + accent2 + "'", nucleus); + } + var command = unicodeAccents[accent2][this.mode] || unicodeAccents[accent2].text; + if (!command) { + throw new ParseError("Accent " + accent2 + " unsupported in " + this.mode + " mode", nucleus); + } + symbol = { + type: "accent", + mode: this.mode, + loc: SourceLocation.range(nucleus), + label: command, + isStretchy: false, + isShifty: true, + // $FlowFixMe + base: symbol + }; + } + } + return symbol; + } + }; + Parser.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; + parseTree = /* @__PURE__ */ __name(function parseTree2(toParse, settings) { + if (!(typeof toParse === "string" || toParse instanceof String)) { + throw new TypeError("KaTeX can only parse string typed expression"); + } + var parser29 = new Parser(toParse, settings); + delete parser29.gullet.macros.current["\\df@tag"]; + var tree = parser29.parse(); + delete parser29.gullet.macros.current["\\current@color"]; + delete parser29.gullet.macros.current["\\color"]; + if (parser29.gullet.macros.get("\\df@tag")) { + if (!settings.displayMode) { + throw new ParseError("\\tag works only in display equations"); + } + tree = [{ + type: "tag", + mode: "text", + body: tree, + tag: parser29.subparse([new Token("\\df@tag")]) + }]; + } + return tree; + }, "parseTree"); + render = /* @__PURE__ */ __name(function render2(expression, baseNode, options2) { + baseNode.textContent = ""; + var node2 = renderToDomTree(expression, options2).toNode(); + baseNode.appendChild(node2); + }, "render"); + if (typeof document !== "undefined") { + if (document.compatMode !== "CSS1Compat") { + typeof console !== "undefined" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."); + render = /* @__PURE__ */ __name(function render9() { + throw new ParseError("KaTeX doesn't work in quirks mode."); + }, "render"); + } + } + renderToString = /* @__PURE__ */ __name(function renderToString2(expression, options2) { + var markup = renderToDomTree(expression, options2).toMarkup(); + return markup; + }, "renderToString"); + generateParseTree = /* @__PURE__ */ __name(function generateParseTree2(expression, options2) { + var settings = new Settings(options2); + return parseTree(expression, settings); + }, "generateParseTree"); + renderError = /* @__PURE__ */ __name(function renderError2(error3, expression, options2) { + if (options2.throwOnError || !(error3 instanceof ParseError)) { + throw error3; + } + var node2 = buildCommon.makeSpan(["katex-error"], [new SymbolNode(expression)]); + node2.setAttribute("title", error3.toString()); + node2.setAttribute("style", "color:" + options2.errorColor); + return node2; + }, "renderError"); + renderToDomTree = /* @__PURE__ */ __name(function renderToDomTree2(expression, options2) { + var settings = new Settings(options2); + try { + var tree = parseTree(expression, settings); + return buildTree(tree, expression, settings); + } catch (error3) { + return renderError(error3, expression, settings); + } + }, "renderToDomTree"); + renderToHTMLTree = /* @__PURE__ */ __name(function renderToHTMLTree2(expression, options2) { + var settings = new Settings(options2); + try { + var tree = parseTree(expression, settings); + return buildHTMLTree(tree, expression, settings); + } catch (error3) { + return renderError(error3, expression, settings); + } + }, "renderToHTMLTree"); + version = "0.16.25"; + __domTree = { + Span, + Anchor, + SymbolNode, + SvgNode, + PathNode, + LineNode + }; + katex = { + /** + * Current KaTeX version + */ + version, + /** + * Renders the given LaTeX into an HTML+MathML combination, and adds + * it as a child to the specified DOM node. + */ + render, + /** + * Renders the given LaTeX into an HTML+MathML combination string, + * for sending to the client. + */ + renderToString, + /** + * KaTeX error, usually during parsing. + */ + ParseError, + /** + * The schema of Settings + */ + SETTINGS_SCHEMA, + /** + * Parses the given LaTeX into KaTeX's internal parse tree structure, + * without rendering to HTML or MathML. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __parse: generateParseTree, + /** + * Renders the given LaTeX into an HTML+MathML internal DOM tree + * representation, without flattening that representation to a string. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __renderToDomTree: renderToDomTree, + /** + * Renders the given LaTeX into an HTML internal DOM tree representation, + * without MathML and without flattening that representation to a string. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __renderToHTMLTree: renderToHTMLTree, + /** + * extends internal font metrics object with a new object + * each key in the new object represents a font name + */ + __setFontMetrics: setFontMetrics, + /** + * adds a new symbol to builtin symbols table + */ + __defineSymbol: defineSymbol, + /** + * adds a new function to builtin function list, + * which directly produce parse tree elements + * and have their own html/mathml builders + */ + __defineFunction: defineFunction, + /** + * adds a new macro to builtin macro list + */ + __defineMacro: defineMacro, + /** + * Expose the dom tree node types, which can be useful for type checking nodes. + * + * NOTE: These methods are not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __domTree + }; + } + }); + + // src/diagrams/common/common.ts + function setupDompurifyHooks() { + const TEMPORARY_ATTRIBUTE = "data-temp-href-target"; + purify.addHook("beforeSanitizeAttributes", (node2) => { + if (node2.tagName === "A" && node2.hasAttribute("target")) { + node2.setAttribute(TEMPORARY_ATTRIBUTE, node2.getAttribute("target") ?? ""); + } + }); + purify.addHook("afterSanitizeAttributes", (node2) => { + if (node2.tagName === "A" && node2.hasAttribute(TEMPORARY_ATTRIBUTE)) { + node2.setAttribute("target", node2.getAttribute(TEMPORARY_ATTRIBUTE) ?? ""); + node2.removeAttribute(TEMPORARY_ATTRIBUTE); + if (node2.getAttribute("target") === "_blank") { + node2.setAttribute("rel", "noopener"); + } + } + }); + } + var lineBreakRegex, getRows, setupDompurifyHooksIfNotSetup, removeScript, sanitizeMore, sanitizeText, sanitizeTextOrArray, hasBreaks, splitBreaks, placeholderToBreak, breakToPlaceholder, getUrl, getMax, getMin, parseGenericTypes, countOccurrence, shouldCombineSets, processSet, isMathMLSupported, katexRegex, hasKatex, calculateMathMLDimensions, renderKatexUnsanitized, renderKatexSanitized, common_default; + var init_common = __esm({ + "src/diagrams/common/common.ts"() { + "use strict"; + init_purify_es(); + init_config(); + lineBreakRegex = //gi; + getRows = /* @__PURE__ */ __name((s2) => { + if (!s2) { + return [""]; + } + const str2 = breakToPlaceholder(s2).replace(/\\n/g, "#br#"); + return str2.split("#br#"); + }, "getRows"); + setupDompurifyHooksIfNotSetup = /* @__PURE__ */ (() => { + let setup = false; + return () => { + if (!setup) { + setupDompurifyHooks(); + setup = true; + } + }; + })(); + __name(setupDompurifyHooks, "setupDompurifyHooks"); + removeScript = /* @__PURE__ */ __name((txt) => { + setupDompurifyHooksIfNotSetup(); + const sanitizedText = purify.sanitize(txt); + return sanitizedText; + }, "removeScript"); + sanitizeMore = /* @__PURE__ */ __name((text4, config5) => { + if (getEffectiveHtmlLabels(config5)) { + const level = config5.securityLevel; + if (level === "antiscript" || level === "strict" || level === "sandbox") { + text4 = removeScript(text4); + } else if (level !== "loose") { + text4 = breakToPlaceholder(text4); + text4 = text4.replace(//g, ">"); + text4 = text4.replace(/=/g, "="); + text4 = placeholderToBreak(text4); + } + } + return text4; + }, "sanitizeMore"); + sanitizeText = /* @__PURE__ */ __name((text4, config5) => { + if (!text4) { + return text4; + } + if (config5.dompurifyConfig) { + text4 = purify.sanitize(sanitizeMore(text4, config5), config5.dompurifyConfig).toString(); + } else { + text4 = purify.sanitize(sanitizeMore(text4, config5), { + FORBID_TAGS: ["style"] + }).toString(); + } + return text4; + }, "sanitizeText"); + sanitizeTextOrArray = /* @__PURE__ */ __name((a2, config5) => { + if (typeof a2 === "string") { + return sanitizeText(a2, config5); + } + return a2.flat().map((x5) => sanitizeText(x5, config5)); + }, "sanitizeTextOrArray"); + hasBreaks = /* @__PURE__ */ __name((text4) => { + return lineBreakRegex.test(text4); + }, "hasBreaks"); + splitBreaks = /* @__PURE__ */ __name((text4) => { + return text4.split(lineBreakRegex); + }, "splitBreaks"); + placeholderToBreak = /* @__PURE__ */ __name((s2) => { + return s2.replace(/#br#/g, "
"); + }, "placeholderToBreak"); + breakToPlaceholder = /* @__PURE__ */ __name((s2) => { + return s2.replace(lineBreakRegex, "#br#"); + }, "breakToPlaceholder"); + getUrl = /* @__PURE__ */ __name((useAbsolute) => { + let url = ""; + if (useAbsolute) { + url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search; + url = CSS.escape(url); + } + return url; + }, "getUrl"); + getMax = /* @__PURE__ */ __name(function(...values3) { + const newValues = values3.filter((value2) => { + return !isNaN(value2); + }); + return Math.max(...newValues); + }, "getMax"); + getMin = /* @__PURE__ */ __name(function(...values3) { + const newValues = values3.filter((value2) => { + return !isNaN(value2); + }); + return Math.min(...newValues); + }, "getMin"); + parseGenericTypes = /* @__PURE__ */ __name(function(input) { + const inputSets = input.split(/(,)/); + const output2 = []; + for (let i2 = 0; i2 < inputSets.length; i2++) { + let thisSet = inputSets[i2]; + if (thisSet === "," && i2 > 0 && i2 + 1 < inputSets.length) { + const previousSet = inputSets[i2 - 1]; + const nextSet = inputSets[i2 + 1]; + if (shouldCombineSets(previousSet, nextSet)) { + thisSet = previousSet + "," + nextSet; + i2++; + output2.pop(); + } + } + output2.push(processSet(thisSet)); + } + return output2.join(""); + }, "parseGenericTypes"); + countOccurrence = /* @__PURE__ */ __name((string3, substring) => { + return Math.max(0, string3.split(substring).length - 1); + }, "countOccurrence"); + shouldCombineSets = /* @__PURE__ */ __name((previousSet, nextSet) => { + const prevCount = countOccurrence(previousSet, "~"); + const nextCount = countOccurrence(nextSet, "~"); + return prevCount === 1 && nextCount === 1; + }, "shouldCombineSets"); + processSet = /* @__PURE__ */ __name((input) => { + const tildeCount = countOccurrence(input, "~"); + let hasStartingTilde = false; + if (tildeCount <= 1) { + return input; + } + if (tildeCount % 2 !== 0 && input.startsWith("~")) { + input = input.substring(1); + hasStartingTilde = true; + } + const chars = [...input]; + let first3 = chars.indexOf("~"); + let last4 = chars.lastIndexOf("~"); + while (first3 !== -1 && last4 !== -1 && first3 !== last4) { + chars[first3] = "<"; + chars[last4] = ">"; + first3 = chars.indexOf("~"); + last4 = chars.lastIndexOf("~"); + } + if (hasStartingTilde) { + chars.unshift("~"); + } + return chars.join(""); + }, "processSet"); + isMathMLSupported = /* @__PURE__ */ __name(() => window.MathMLElement !== void 0, "isMathMLSupported"); + katexRegex = /\$\$(.*)\$\$/g; + hasKatex = /* @__PURE__ */ __name((text4) => (text4.match(katexRegex)?.length ?? 0) > 0, "hasKatex"); + calculateMathMLDimensions = /* @__PURE__ */ __name(async (text4, config5) => { + const divElem = document.createElement("div"); + divElem.innerHTML = await renderKatexSanitized(text4, config5); + divElem.id = "katex-temp"; + divElem.style.visibility = "hidden"; + divElem.style.position = "absolute"; + divElem.style.top = "0"; + const body = document.querySelector("body"); + body?.insertAdjacentElement("beforeend", divElem); + const dim = { width: divElem.clientWidth, height: divElem.clientHeight }; + divElem.remove(); + return dim; + }, "calculateMathMLDimensions"); + renderKatexUnsanitized = /* @__PURE__ */ __name(async (text4, config5) => { + if (!hasKatex(text4)) { + return text4; + } + if (!(isMathMLSupported() || config5.legacyMathML || config5.forceLegacyMathML)) { + return text4.replace(katexRegex, "MathML is unsupported in this environment."); + } + if (true) { + const { default: katex2 } = await Promise.resolve().then(() => (init_katex(), katex_exports)); + const outputMode = config5.forceLegacyMathML || !isMathMLSupported() && config5.legacyMathML ? "htmlAndMathml" : "mathml"; + return text4.split(lineBreakRegex).map( + (line2) => hasKatex(line2) ? `
${line2}
` : `
${line2}
` + ).join("").replace( + katexRegex, + (_3, c3) => katex2.renderToString(c3, { + throwOnError: true, + displayMode: true, + output: outputMode + }).replace(/\n/g, " ").replace(//g, "") + ); + } + return text4.replace( + katexRegex, + "Katex is not supported in @mermaid-js/tiny. Please use the full mermaid library." + ); + }, "renderKatexUnsanitized"); + renderKatexSanitized = /* @__PURE__ */ __name(async (text4, config5) => { + return sanitizeText(await renderKatexUnsanitized(text4, config5), config5); + }, "renderKatexSanitized"); + common_default = { + getRows, + sanitizeText, + sanitizeTextOrArray, + hasBreaks, + splitBreaks, + lineBreakRegex, + removeScript, + getUrl, + evaluate, + getMax, + getMin + }; + } + }); + + // src/rendering-util/icons.ts + var unknownIcon, iconsStore, loaderStore, registerIconPacks, getRegisteredIconData, isIconAvailable, getIconSVG; + var init_icons = __esm({ + "src/rendering-util/icons.ts"() { + "use strict"; + init_lib(); + init_config(); + init_common(); + init_logger(); + unknownIcon = { + body: '?', + height: 80, + width: 80 + }; + iconsStore = /* @__PURE__ */ new Map(); + loaderStore = /* @__PURE__ */ new Map(); + registerIconPacks = /* @__PURE__ */ __name((iconLoaders) => { + for (const iconLoader of iconLoaders) { + if (!iconLoader.name) { + throw new Error( + 'Invalid icon loader. Must have a "name" property with non-empty string value.' + ); + } + log.debug("Registering icon pack:", iconLoader.name); + if ("loader" in iconLoader) { + loaderStore.set(iconLoader.name, iconLoader.loader); + } else if ("icons" in iconLoader) { + iconsStore.set(iconLoader.name, iconLoader.icons); + } else { + log.error("Invalid icon loader:", iconLoader); + throw new Error('Invalid icon loader. Must have either "icons" or "loader" property.'); + } + } + }, "registerIconPacks"); + getRegisteredIconData = /* @__PURE__ */ __name(async (iconName, fallbackPrefix) => { + const data5 = stringToIcon(iconName, true, fallbackPrefix !== void 0); + if (!data5) { + throw new Error(`Invalid icon name: ${iconName}`); + } + const prefix = data5.prefix || fallbackPrefix; + if (!prefix) { + throw new Error(`Icon name must contain a prefix: ${iconName}`); + } + let icons = iconsStore.get(prefix); + if (!icons) { + const loader34 = loaderStore.get(prefix); + if (!loader34) { + throw new Error(`Icon set not found: ${data5.prefix}`); + } + try { + const loaded = await loader34(); + icons = { ...loaded, prefix }; + iconsStore.set(prefix, icons); + } catch (e3) { + log.error(e3); + throw new Error(`Failed to load icon set: ${data5.prefix}`); + } + } + const iconData = getIconData(icons, data5.name); + if (!iconData) { + throw new Error(`Icon not found: ${iconName}`); + } + return iconData; + }, "getRegisteredIconData"); + isIconAvailable = /* @__PURE__ */ __name(async (iconName) => { + try { + await getRegisteredIconData(iconName); + return true; + } catch { + return false; + } + }, "isIconAvailable"); + getIconSVG = /* @__PURE__ */ __name(async (iconName, customisations, extraAttributes) => { + let iconData; + try { + iconData = await getRegisteredIconData(iconName, customisations?.fallbackPrefix); + } catch (e3) { + log.error(e3); + iconData = unknownIcon; + } + const renderData = iconToSVG(iconData, customisations); + const svg2 = iconToHTML(replaceIDs(renderData.body), { + ...renderData.attributes, + ...extraAttributes + }); + return sanitizeText(svg2, getConfig()); + }, "getIconSVG"); + } + }); + + // ../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js + function dedent(templ) { + var values3 = []; + for (var _i = 1; _i < arguments.length; _i++) { + values3[_i - 1] = arguments[_i]; + } + var strings = Array.from(typeof templ === "string" ? [templ] : templ); + strings[strings.length - 1] = strings[strings.length - 1].replace(/\r?\n([\t ]*)$/, ""); + var indentLengths = strings.reduce(function(arr, str2) { + var matches33 = str2.match(/\n([\t ]+|(?!\s).)/g); + if (matches33) { + return arr.concat(matches33.map(function(match3) { + var _a, _b; + return (_b = (_a = match3.match(/[\t ]/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; + })); + } + return arr; + }, []); + if (indentLengths.length) { + var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g"); + strings = strings.map(function(str2) { + return str2.replace(pattern_1, "\n"); + }); + } + strings[0] = strings[0].replace(/^\r?\n/, ""); + var string3 = strings[0]; + values3.forEach(function(value2, i2) { + var endentations = string3.match(/(?:^|\n)( *)$/); + var endentation = endentations ? endentations[1] : ""; + var indentedValue = value2; + if (typeof value2 === "string" && value2.includes("\n")) { + indentedValue = String(value2).split("\n").map(function(str2, i3) { + return i3 === 0 ? str2 : "" + endentation + str2; + }).join("\n"); + } + string3 += indentedValue + strings[i2 + 1]; + }); + return string3; + } + var init_esm = __esm({ + "../../node_modules/.pnpm/ts-dedent@2.2.0/node_modules/ts-dedent/esm/index.js"() { + "use strict"; + __name(dedent, "dedent"); + } + }); + + // src/diagram-api/regexes.ts + var frontMatterRegex, directiveRegex, anyCommentRegex; + var init_regexes = __esm({ + "src/diagram-api/regexes.ts"() { + "use strict"; + frontMatterRegex = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s; + directiveRegex = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi; + anyCommentRegex = /\s*%%.*\n/gm; + } + }); + + // src/errors.ts + var UnknownDiagramError; + var init_errors = __esm({ + "src/errors.ts"() { + "use strict"; + UnknownDiagramError = class extends Error { + static { + __name(this, "UnknownDiagramError"); + } + constructor(message) { + super(message); + this.name = "UnknownDiagramError"; + } + }; + } + }); + + // src/diagram-api/detectType.ts + var detectors, detectType, registerLazyLoadedDiagrams, addDetector, getDiagramLoader; + var init_detectType = __esm({ + "src/diagram-api/detectType.ts"() { + "use strict"; + init_logger(); + init_regexes(); + init_errors(); + detectors = {}; + detectType = /* @__PURE__ */ __name(function(text4, config5) { + text4 = text4.replace(frontMatterRegex, "").replace(directiveRegex, "").replace(anyCommentRegex, "\n"); + for (const [key, { detector: detector33 }] of Object.entries(detectors)) { + const diagram32 = detector33(text4, config5); + if (diagram32) { + return key; + } + } + throw new UnknownDiagramError( + `No diagram type detected matching given configuration for text: ${text4}` + ); + }, "detectType"); + registerLazyLoadedDiagrams = /* @__PURE__ */ __name((...diagrams2) => { + for (const { id: id35, detector: detector33, loader: loader34 } of diagrams2) { + addDetector(id35, detector33, loader34); + } + }, "registerLazyLoadedDiagrams"); + addDetector = /* @__PURE__ */ __name((key, detector33, loader34) => { + if (detectors[key]) { + log.warn(`Detector with key ${key} already exists. Overwriting.`); + } + detectors[key] = { detector: detector33, loader: loader34 }; + log.debug(`Detector with key ${key} added${loader34 ? " with loader" : ""}`); + }, "addDetector"); + getDiagramLoader = /* @__PURE__ */ __name((key) => { + return detectors[key].loader; + }, "getDiagramLoader"); + } + }); + + // src/diagrams/c4/parser/c4Diagram.jison + var parser, c4Diagram_default; + var init_c4Diagram = __esm({ + "src/diagrams/c4/parser/c4Diagram.jison"() { + "use strict"; + parser = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 24], $V1 = [1, 25], $V2 = [1, 26], $V3 = [1, 27], $V4 = [1, 28], $V5 = [1, 63], $V6 = [1, 64], $V7 = [1, 65], $V8 = [1, 66], $V9 = [1, 67], $Va = [1, 68], $Vb = [1, 69], $Vc = [1, 29], $Vd = [1, 30], $Ve = [1, 31], $Vf = [1, 32], $Vg = [1, 33], $Vh = [1, 34], $Vi = [1, 35], $Vj = [1, 36], $Vk = [1, 37], $Vl = [1, 38], $Vm = [1, 39], $Vn = [1, 40], $Vo = [1, 41], $Vp = [1, 42], $Vq = [1, 43], $Vr = [1, 44], $Vs = [1, 45], $Vt = [1, 46], $Vu = [1, 47], $Vv = [1, 48], $Vw = [1, 50], $Vx = [1, 51], $Vy = [1, 52], $Vz = [1, 53], $VA = [1, 54], $VB = [1, 55], $VC = [1, 56], $VD = [1, 57], $VE = [1, 58], $VF = [1, 59], $VG = [1, 60], $VH = [14, 42], $VI = [14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], $VJ = [12, 14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], $VK = [1, 82], $VL = [1, 83], $VM = [1, 84], $VN = [1, 85], $VO = [12, 14, 42], $VP = [12, 14, 33, 42], $VQ = [12, 14, 33, 42, 76, 77, 79, 80], $VR = [12, 33], $VS = [34, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "mermaidDoc": 4, "direction": 5, "direction_tb": 6, "direction_bt": 7, "direction_rl": 8, "direction_lr": 9, "graphConfig": 10, "C4_CONTEXT": 11, "NEWLINE": 12, "statements": 13, "EOF": 14, "C4_CONTAINER": 15, "C4_COMPONENT": 16, "C4_DYNAMIC": 17, "C4_DEPLOYMENT": 18, "otherStatements": 19, "diagramStatements": 20, "otherStatement": 21, "title": 22, "accDescription": 23, "acc_title": 24, "acc_title_value": 25, "acc_descr": 26, "acc_descr_value": 27, "acc_descr_multiline_value": 28, "boundaryStatement": 29, "boundaryStartStatement": 30, "boundaryStopStatement": 31, "boundaryStart": 32, "LBRACE": 33, "ENTERPRISE_BOUNDARY": 34, "attributes": 35, "SYSTEM_BOUNDARY": 36, "BOUNDARY": 37, "CONTAINER_BOUNDARY": 38, "NODE": 39, "NODE_L": 40, "NODE_R": 41, "RBRACE": 42, "diagramStatement": 43, "PERSON": 44, "PERSON_EXT": 45, "SYSTEM": 46, "SYSTEM_DB": 47, "SYSTEM_QUEUE": 48, "SYSTEM_EXT": 49, "SYSTEM_EXT_DB": 50, "SYSTEM_EXT_QUEUE": 51, "CONTAINER": 52, "CONTAINER_DB": 53, "CONTAINER_QUEUE": 54, "CONTAINER_EXT": 55, "CONTAINER_EXT_DB": 56, "CONTAINER_EXT_QUEUE": 57, "COMPONENT": 58, "COMPONENT_DB": 59, "COMPONENT_QUEUE": 60, "COMPONENT_EXT": 61, "COMPONENT_EXT_DB": 62, "COMPONENT_EXT_QUEUE": 63, "REL": 64, "BIREL": 65, "REL_U": 66, "REL_D": 67, "REL_L": 68, "REL_R": 69, "REL_B": 70, "REL_INDEX": 71, "UPDATE_EL_STYLE": 72, "UPDATE_REL_STYLE": 73, "UPDATE_LAYOUT_CONFIG": 74, "attribute": 75, "STR": 76, "STR_KEY": 77, "STR_VALUE": 78, "ATTRIBUTE": 79, "ATTRIBUTE_EMPTY": 80, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 6: "direction_tb", 7: "direction_bt", 8: "direction_rl", 9: "direction_lr", 11: "C4_CONTEXT", 12: "NEWLINE", 14: "EOF", 15: "C4_CONTAINER", 16: "C4_COMPONENT", 17: "C4_DYNAMIC", 18: "C4_DEPLOYMENT", 22: "title", 23: "accDescription", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "LBRACE", 34: "ENTERPRISE_BOUNDARY", 36: "SYSTEM_BOUNDARY", 37: "BOUNDARY", 38: "CONTAINER_BOUNDARY", 39: "NODE", 40: "NODE_L", 41: "NODE_R", 42: "RBRACE", 44: "PERSON", 45: "PERSON_EXT", 46: "SYSTEM", 47: "SYSTEM_DB", 48: "SYSTEM_QUEUE", 49: "SYSTEM_EXT", 50: "SYSTEM_EXT_DB", 51: "SYSTEM_EXT_QUEUE", 52: "CONTAINER", 53: "CONTAINER_DB", 54: "CONTAINER_QUEUE", 55: "CONTAINER_EXT", 56: "CONTAINER_EXT_DB", 57: "CONTAINER_EXT_QUEUE", 58: "COMPONENT", 59: "COMPONENT_DB", 60: "COMPONENT_QUEUE", 61: "COMPONENT_EXT", 62: "COMPONENT_EXT_DB", 63: "COMPONENT_EXT_QUEUE", 64: "REL", 65: "BIREL", 66: "REL_U", 67: "REL_D", 68: "REL_L", 69: "REL_R", 70: "REL_B", 71: "REL_INDEX", 72: "UPDATE_EL_STYLE", 73: "UPDATE_REL_STYLE", 74: "UPDATE_LAYOUT_CONFIG", 76: "STR", 77: "STR_KEY", 78: "STR_VALUE", 79: "ATTRIBUTE", 80: "ATTRIBUTE_EMPTY" }, + productions_: [0, [3, 1], [3, 1], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [13, 1], [13, 1], [13, 2], [19, 1], [19, 2], [19, 3], [21, 1], [21, 1], [21, 2], [21, 2], [21, 1], [29, 3], [30, 3], [30, 3], [30, 4], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [31, 1], [20, 1], [20, 2], [20, 3], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 1], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [35, 1], [35, 2], [75, 1], [75, 2], [75, 1], [75, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 3: + yy.setDirection("TB"); + break; + case 4: + yy.setDirection("BT"); + break; + case 5: + yy.setDirection("RL"); + break; + case 6: + yy.setDirection("LR"); + break; + case 8: + case 9: + case 10: + case 11: + case 12: + yy.setC4Type($$[$0 - 3]); + break; + case 19: + yy.setTitle($$[$0].substring(6)); + this.$ = $$[$0].substring(6); + break; + case 20: + yy.setAccDescription($$[$0].substring(15)); + this.$ = $$[$0].substring(15); + break; + case 21: + this.$ = $$[$0].trim(); + yy.setTitle(this.$); + break; + case 22: + case 23: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 28: + $$[$0].splice(2, 0, "ENTERPRISE"); + yy.addPersonOrSystemBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 29: + $$[$0].splice(2, 0, "SYSTEM"); + yy.addPersonOrSystemBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 30: + yy.addPersonOrSystemBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 31: + $$[$0].splice(2, 0, "CONTAINER"); + yy.addContainerBoundary(...$$[$0]); + this.$ = $$[$0]; + break; + case 32: + yy.addDeploymentNode("node", ...$$[$0]); + this.$ = $$[$0]; + break; + case 33: + yy.addDeploymentNode("nodeL", ...$$[$0]); + this.$ = $$[$0]; + break; + case 34: + yy.addDeploymentNode("nodeR", ...$$[$0]); + this.$ = $$[$0]; + break; + case 35: + yy.popBoundaryParseStack(); + break; + case 39: + yy.addPersonOrSystem("person", ...$$[$0]); + this.$ = $$[$0]; + break; + case 40: + yy.addPersonOrSystem("external_person", ...$$[$0]); + this.$ = $$[$0]; + break; + case 41: + yy.addPersonOrSystem("system", ...$$[$0]); + this.$ = $$[$0]; + break; + case 42: + yy.addPersonOrSystem("system_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 43: + yy.addPersonOrSystem("system_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 44: + yy.addPersonOrSystem("external_system", ...$$[$0]); + this.$ = $$[$0]; + break; + case 45: + yy.addPersonOrSystem("external_system_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 46: + yy.addPersonOrSystem("external_system_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 47: + yy.addContainer("container", ...$$[$0]); + this.$ = $$[$0]; + break; + case 48: + yy.addContainer("container_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 49: + yy.addContainer("container_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 50: + yy.addContainer("external_container", ...$$[$0]); + this.$ = $$[$0]; + break; + case 51: + yy.addContainer("external_container_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 52: + yy.addContainer("external_container_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 53: + yy.addComponent("component", ...$$[$0]); + this.$ = $$[$0]; + break; + case 54: + yy.addComponent("component_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 55: + yy.addComponent("component_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 56: + yy.addComponent("external_component", ...$$[$0]); + this.$ = $$[$0]; + break; + case 57: + yy.addComponent("external_component_db", ...$$[$0]); + this.$ = $$[$0]; + break; + case 58: + yy.addComponent("external_component_queue", ...$$[$0]); + this.$ = $$[$0]; + break; + case 60: + yy.addRel("rel", ...$$[$0]); + this.$ = $$[$0]; + break; + case 61: + yy.addRel("birel", ...$$[$0]); + this.$ = $$[$0]; + break; + case 62: + yy.addRel("rel_u", ...$$[$0]); + this.$ = $$[$0]; + break; + case 63: + yy.addRel("rel_d", ...$$[$0]); + this.$ = $$[$0]; + break; + case 64: + yy.addRel("rel_l", ...$$[$0]); + this.$ = $$[$0]; + break; + case 65: + yy.addRel("rel_r", ...$$[$0]); + this.$ = $$[$0]; + break; + case 66: + yy.addRel("rel_b", ...$$[$0]); + this.$ = $$[$0]; + break; + case 67: + $$[$0].splice(0, 1); + yy.addRel("rel", ...$$[$0]); + this.$ = $$[$0]; + break; + case 68: + yy.updateElStyle("update_el_style", ...$$[$0]); + this.$ = $$[$0]; + break; + case 69: + yy.updateRelStyle("update_rel_style", ...$$[$0]); + this.$ = $$[$0]; + break; + case 70: + yy.updateLayoutConfig("update_layout_config", ...$$[$0]); + this.$ = $$[$0]; + break; + case 71: + this.$ = [$$[$0]]; + break; + case 72: + $$[$0].unshift($$[$0 - 1]); + this.$ = $$[$0]; + break; + case 73: + case 75: + this.$ = $$[$0].trim(); + break; + case 74: + let kv = {}; + kv[$$[$0 - 1].trim()] = $$[$0].trim(); + this.$ = kv; + break; + case 76: + this.$ = ""; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 7: [1, 6], 8: [1, 7], 9: [1, 8], 10: 4, 11: [1, 9], 15: [1, 10], 16: [1, 11], 17: [1, 12], 18: [1, 13] }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 7] }, { 1: [2, 3] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 12: [1, 14] }, { 12: [1, 15] }, { 12: [1, 16] }, { 12: [1, 17] }, { 12: [1, 18] }, { 13: 19, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 70, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 71, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 72, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 13: 73, 19: 20, 20: 21, 21: 22, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 14: [1, 74] }, o2($VH, [2, 13], { 43: 23, 29: 49, 30: 61, 32: 62, 20: 75, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }), o2($VH, [2, 14]), o2($VI, [2, 16], { 12: [1, 76] }), o2($VH, [2, 36], { 12: [1, 77] }), o2($VJ, [2, 19]), o2($VJ, [2, 20]), { 25: [1, 78] }, { 27: [1, 79] }, o2($VJ, [2, 23]), { 35: 80, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 86, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 87, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 88, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 89, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 90, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 91, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 92, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 93, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 94, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 95, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 96, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 97, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 98, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 99, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 100, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 101, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 102, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 103, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 104, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, o2($VO, [2, 59]), { 35: 105, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 106, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 107, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 108, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 109, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 110, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 111, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 112, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 113, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 114, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 115, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 20: 116, 29: 49, 30: 61, 32: 62, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 43: 23, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }, { 12: [1, 118], 33: [1, 117] }, { 35: 119, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 120, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 121, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 122, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 123, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 124, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 35: 125, 75: 81, 76: $VK, 77: $VL, 79: $VM, 80: $VN }, { 14: [1, 126] }, { 14: [1, 127] }, { 14: [1, 128] }, { 14: [1, 129] }, { 1: [2, 8] }, o2($VH, [2, 15]), o2($VI, [2, 17], { 21: 22, 19: 130, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4 }), o2($VH, [2, 37], { 19: 20, 20: 21, 21: 22, 43: 23, 29: 49, 30: 61, 32: 62, 13: 131, 22: $V0, 23: $V1, 24: $V2, 26: $V3, 28: $V4, 34: $V5, 36: $V6, 37: $V7, 38: $V8, 39: $V9, 40: $Va, 41: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi, 51: $Vj, 52: $Vk, 53: $Vl, 54: $Vm, 55: $Vn, 56: $Vo, 57: $Vp, 58: $Vq, 59: $Vr, 60: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz, 68: $VA, 69: $VB, 70: $VC, 71: $VD, 72: $VE, 73: $VF, 74: $VG }), o2($VJ, [2, 21]), o2($VJ, [2, 22]), o2($VO, [2, 39]), o2($VP, [2, 71], { 75: 81, 35: 132, 76: $VK, 77: $VL, 79: $VM, 80: $VN }), o2($VQ, [2, 73]), { 78: [1, 133] }, o2($VQ, [2, 75]), o2($VQ, [2, 76]), o2($VO, [2, 40]), o2($VO, [2, 41]), o2($VO, [2, 42]), o2($VO, [2, 43]), o2($VO, [2, 44]), o2($VO, [2, 45]), o2($VO, [2, 46]), o2($VO, [2, 47]), o2($VO, [2, 48]), o2($VO, [2, 49]), o2($VO, [2, 50]), o2($VO, [2, 51]), o2($VO, [2, 52]), o2($VO, [2, 53]), o2($VO, [2, 54]), o2($VO, [2, 55]), o2($VO, [2, 56]), o2($VO, [2, 57]), o2($VO, [2, 58]), o2($VO, [2, 60]), o2($VO, [2, 61]), o2($VO, [2, 62]), o2($VO, [2, 63]), o2($VO, [2, 64]), o2($VO, [2, 65]), o2($VO, [2, 66]), o2($VO, [2, 67]), o2($VO, [2, 68]), o2($VO, [2, 69]), o2($VO, [2, 70]), { 31: 134, 42: [1, 135] }, { 12: [1, 136] }, { 33: [1, 137] }, o2($VR, [2, 28]), o2($VR, [2, 29]), o2($VR, [2, 30]), o2($VR, [2, 31]), o2($VR, [2, 32]), o2($VR, [2, 33]), o2($VR, [2, 34]), { 1: [2, 9] }, { 1: [2, 10] }, { 1: [2, 11] }, { 1: [2, 12] }, o2($VI, [2, 18]), o2($VH, [2, 38]), o2($VP, [2, 72]), o2($VQ, [2, 74]), o2($VO, [2, 24]), o2($VO, [2, 35]), o2($VS, [2, 25]), o2($VS, [2, 26], { 12: [1, 138] }), o2($VS, [2, 27])], + defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 7], 5: [2, 3], 6: [2, 4], 7: [2, 5], 8: [2, 6], 74: [2, 8], 126: [2, 9], 127: [2, 10], 128: [2, 11], 129: [2, 12] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: {}, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + return 6; + break; + case 1: + return 7; + break; + case 2: + return 8; + break; + case 3: + return 9; + break; + case 4: + return 22; + break; + case 5: + return 23; + break; + case 6: + this.begin("acc_title"); + return 24; + break; + case 7: + this.popState(); + return "acc_title_value"; + break; + case 8: + this.begin("acc_descr"); + return 26; + break; + case 9: + this.popState(); + return "acc_descr_value"; + break; + case 10: + this.begin("acc_descr_multiline"); + break; + case 11: + this.popState(); + break; + case 12: + return "acc_descr_multiline_value"; + break; + case 13: + break; + case 14: + c; + break; + case 15: + return 12; + break; + case 16: + break; + case 17: + return 11; + break; + case 18: + return 15; + break; + case 19: + return 16; + break; + case 20: + return 17; + break; + case 21: + return 18; + break; + case 22: + this.begin("person_ext"); + return 45; + break; + case 23: + this.begin("person"); + return 44; + break; + case 24: + this.begin("system_ext_queue"); + return 51; + break; + case 25: + this.begin("system_ext_db"); + return 50; + break; + case 26: + this.begin("system_ext"); + return 49; + break; + case 27: + this.begin("system_queue"); + return 48; + break; + case 28: + this.begin("system_db"); + return 47; + break; + case 29: + this.begin("system"); + return 46; + break; + case 30: + this.begin("boundary"); + return 37; + break; + case 31: + this.begin("enterprise_boundary"); + return 34; + break; + case 32: + this.begin("system_boundary"); + return 36; + break; + case 33: + this.begin("container_ext_queue"); + return 57; + break; + case 34: + this.begin("container_ext_db"); + return 56; + break; + case 35: + this.begin("container_ext"); + return 55; + break; + case 36: + this.begin("container_queue"); + return 54; + break; + case 37: + this.begin("container_db"); + return 53; + break; + case 38: + this.begin("container"); + return 52; + break; + case 39: + this.begin("container_boundary"); + return 38; + break; + case 40: + this.begin("component_ext_queue"); + return 63; + break; + case 41: + this.begin("component_ext_db"); + return 62; + break; + case 42: + this.begin("component_ext"); + return 61; + break; + case 43: + this.begin("component_queue"); + return 60; + break; + case 44: + this.begin("component_db"); + return 59; + break; + case 45: + this.begin("component"); + return 58; + break; + case 46: + this.begin("node"); + return 39; + break; + case 47: + this.begin("node"); + return 39; + break; + case 48: + this.begin("node_l"); + return 40; + break; + case 49: + this.begin("node_r"); + return 41; + break; + case 50: + this.begin("rel"); + return 64; + break; + case 51: + this.begin("birel"); + return 65; + break; + case 52: + this.begin("rel_u"); + return 66; + break; + case 53: + this.begin("rel_u"); + return 66; + break; + case 54: + this.begin("rel_d"); + return 67; + break; + case 55: + this.begin("rel_d"); + return 67; + break; + case 56: + this.begin("rel_l"); + return 68; + break; + case 57: + this.begin("rel_l"); + return 68; + break; + case 58: + this.begin("rel_r"); + return 69; + break; + case 59: + this.begin("rel_r"); + return 69; + break; + case 60: + this.begin("rel_b"); + return 70; + break; + case 61: + this.begin("rel_index"); + return 71; + break; + case 62: + this.begin("update_el_style"); + return 72; + break; + case 63: + this.begin("update_rel_style"); + return 73; + break; + case 64: + this.begin("update_layout_config"); + return 74; + break; + case 65: + return "EOF_IN_STRUCT"; + break; + case 66: + this.begin("attribute"); + return "ATTRIBUTE_EMPTY"; + break; + case 67: + this.begin("attribute"); + break; + case 68: + this.popState(); + this.popState(); + break; + case 69: + return 80; + break; + case 70: + break; + case 71: + return 80; + break; + case 72: + this.begin("string"); + break; + case 73: + this.popState(); + break; + case 74: + return "STR"; + break; + case 75: + this.begin("string_kv"); + break; + case 76: + this.begin("string_kv_key"); + return "STR_KEY"; + break; + case 77: + this.popState(); + this.begin("string_kv_value"); + break; + case 78: + return "STR_VALUE"; + break; + case 79: + this.popState(); + this.popState(); + break; + case 80: + return "STR"; + break; + case 81: + return "LBRACE"; + break; + case 82: + return "RBRACE"; + break; + case 83: + return "SPACE"; + break; + case 84: + return "EOL"; + break; + case 85: + return 14; + break; + } + }, "anonymous"), + rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:title\s[^#\n;]+)/, /^(?:accDescription\s[^#\n;]+)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:C4Context\b)/, /^(?:C4Container\b)/, /^(?:C4Component\b)/, /^(?:C4Dynamic\b)/, /^(?:C4Deployment\b)/, /^(?:Person_Ext\b)/, /^(?:Person\b)/, /^(?:SystemQueue_Ext\b)/, /^(?:SystemDb_Ext\b)/, /^(?:System_Ext\b)/, /^(?:SystemQueue\b)/, /^(?:SystemDb\b)/, /^(?:System\b)/, /^(?:Boundary\b)/, /^(?:Enterprise_Boundary\b)/, /^(?:System_Boundary\b)/, /^(?:ContainerQueue_Ext\b)/, /^(?:ContainerDb_Ext\b)/, /^(?:Container_Ext\b)/, /^(?:ContainerQueue\b)/, /^(?:ContainerDb\b)/, /^(?:Container\b)/, /^(?:Container_Boundary\b)/, /^(?:ComponentQueue_Ext\b)/, /^(?:ComponentDb_Ext\b)/, /^(?:Component_Ext\b)/, /^(?:ComponentQueue\b)/, /^(?:ComponentDb\b)/, /^(?:Component\b)/, /^(?:Deployment_Node\b)/, /^(?:Node\b)/, /^(?:Node_L\b)/, /^(?:Node_R\b)/, /^(?:Rel\b)/, /^(?:BiRel\b)/, /^(?:Rel_Up\b)/, /^(?:Rel_U\b)/, /^(?:Rel_Down\b)/, /^(?:Rel_D\b)/, /^(?:Rel_Left\b)/, /^(?:Rel_L\b)/, /^(?:Rel_Right\b)/, /^(?:Rel_R\b)/, /^(?:Rel_Back\b)/, /^(?:RelIndex\b)/, /^(?:UpdateElementStyle\b)/, /^(?:UpdateRelStyle\b)/, /^(?:UpdateLayoutConfig\b)/, /^(?:$)/, /^(?:[(][ ]*[,])/, /^(?:[(])/, /^(?:[)])/, /^(?:,,)/, /^(?:,)/, /^(?:[ ]*["]["])/, /^(?:[ ]*["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:[ ]*[\$])/, /^(?:[^=]*)/, /^(?:[=][ ]*["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:[^,]+)/, /^(?:\{)/, /^(?:\})/, /^(?:[\s]+)/, /^(?:[\n\r]+)/, /^(?:$)/], + conditions: { "acc_descr_multiline": { "rules": [11, 12], "inclusive": false }, "acc_descr": { "rules": [9], "inclusive": false }, "acc_title": { "rules": [7], "inclusive": false }, "string_kv_value": { "rules": [78, 79], "inclusive": false }, "string_kv_key": { "rules": [77], "inclusive": false }, "string_kv": { "rules": [76], "inclusive": false }, "string": { "rules": [73, 74], "inclusive": false }, "attribute": { "rules": [68, 69, 70, 71, 72, 75, 80], "inclusive": false }, "update_layout_config": { "rules": [65, 66, 67, 68], "inclusive": false }, "update_rel_style": { "rules": [65, 66, 67, 68], "inclusive": false }, "update_el_style": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_b": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_r": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_l": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_d": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_u": { "rules": [65, 66, 67, 68], "inclusive": false }, "rel_bi": { "rules": [], "inclusive": false }, "rel": { "rules": [65, 66, 67, 68], "inclusive": false }, "node_r": { "rules": [65, 66, 67, 68], "inclusive": false }, "node_l": { "rules": [65, 66, 67, 68], "inclusive": false }, "node": { "rules": [65, 66, 67, 68], "inclusive": false }, "index": { "rules": [], "inclusive": false }, "rel_index": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_ext_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_ext_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "component_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "component": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_ext_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_ext_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "container_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "container": { "rules": [65, 66, 67, 68], "inclusive": false }, "birel": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "enterprise_boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "boundary": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_ext_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_ext_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_queue": { "rules": [65, 66, 67, 68], "inclusive": false }, "system_db": { "rules": [65, 66, 67, 68], "inclusive": false }, "system": { "rules": [65, 66, 67, 68], "inclusive": false }, "person_ext": { "rules": [65, 66, 67, 68], "inclusive": false }, "person": { "rules": [65, 66, 67, 68], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 81, 82, 83, 84, 85], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser.parser = parser; + c4Diagram_default = parser; + } + }); + + // src/setupGraphViewbox.js + var d3Attrs, calculateSvgSizeAttrs, configureSvgSize, setupGraphViewbox; + var init_setupGraphViewbox = __esm({ + "src/setupGraphViewbox.js"() { + "use strict"; + init_logger(); + d3Attrs = /* @__PURE__ */ __name(function(d3Elem, attrs) { + for (let attr of attrs) { + d3Elem.attr(attr[0], attr[1]); + } + }, "d3Attrs"); + calculateSvgSizeAttrs = /* @__PURE__ */ __name(function(height2, width3, useMaxWidth) { + let attrs = /* @__PURE__ */ new Map(); + if (useMaxWidth) { + attrs.set("width", "100%"); + attrs.set("style", `max-width: ${width3}px;`); + } else { + attrs.set("height", height2); + attrs.set("width", width3); + } + return attrs; + }, "calculateSvgSizeAttrs"); + configureSvgSize = /* @__PURE__ */ __name(function(svgElem, height2, width3, useMaxWidth) { + const attrs = calculateSvgSizeAttrs(height2, width3, useMaxWidth); + d3Attrs(svgElem, attrs); + }, "configureSvgSize"); + setupGraphViewbox = /* @__PURE__ */ __name(function(graph, svgElem, padding2, useMaxWidth) { + const svgBounds = svgElem.node().getBBox(); + const sWidth = svgBounds.width; + const sHeight = svgBounds.height; + log.info(`SVG bounds: ${sWidth}x${sHeight}`, svgBounds); + let width3 = 0; + let height2 = 0; + log.info(`Graph bounds: ${width3}x${height2}`, graph); + width3 = sWidth + padding2 * 2; + height2 = sHeight + padding2 * 2; + log.info(`Calculated bounds: ${width3}x${height2}`); + configureSvgSize(svgElem, height2, width3, useMaxWidth); + const vBox = `${svgBounds.x - padding2} ${svgBounds.y - padding2} ${svgBounds.width + 2 * padding2} ${svgBounds.height + 2 * padding2}`; + svgElem.attr("viewBox", vBox); + }, "setupGraphViewbox"); + } + }); + + // src/styles.ts + function cssStyleSheetToString(cssStyleSheet) { + return [...cssStyleSheet.cssRules].map((rule) => rule.cssText).join("\n"); + } + var themes, getStyles, addStylesForDiagram, styles_default; + var init_styles = __esm({ + "src/styles.ts"() { + "use strict"; + init_logger(); + themes = {}; + __name(cssStyleSheetToString, "cssStyleSheetToString"); + getStyles = /* @__PURE__ */ __name((type3, userStyles, options2, svgId) => { + let diagramStyles = ""; + if (type3 in themes && themes[type3]) { + diagramStyles = themes[type3]({ ...options2, svgId }); + } else { + log.warn(`No theme found for ${type3}`); + } + return ` & { + font-family: ${options2.fontFamily}; + font-size: ${options2.fontSize}; + fill: ${options2.textColor} + } + @keyframes edge-animation-frame { + from { + stroke-dashoffset: 0; + } + } + @keyframes dash { + to { + stroke-dashoffset: 0; + } + } + & .edge-animation-slow { + stroke-dasharray: 9,5 !important; + stroke-dashoffset: 900; + animation: dash 50s linear infinite; + stroke-linecap: round; + } + & .edge-animation-fast { + stroke-dasharray: 9,5 !important; + stroke-dashoffset: 900; + animation: dash 20s linear infinite; + stroke-linecap: round; + } + /* Classes common for multiple diagrams */ + + & .error-icon { + fill: ${options2.errorBkgColor}; + } + & .error-text { + fill: ${options2.errorTextColor}; + stroke: ${options2.errorTextColor}; + } + + & .edge-thickness-normal { + stroke-width: ${options2.strokeWidth ?? 1}px; + } + & .edge-thickness-thick { + stroke-width: 3.5px + } + & .edge-pattern-solid { + stroke-dasharray: 0; + } + & .edge-thickness-invisible { + stroke-width: 0; + fill: none; + } + & .edge-pattern-dashed{ + stroke-dasharray: 3; + } + .edge-pattern-dotted { + stroke-dasharray: 2; + } + + & .marker { + fill: ${options2.lineColor}; + stroke: ${options2.lineColor}; + } + & .marker.cross { + stroke: ${options2.lineColor}; + } + + & svg { + font-family: ${options2.fontFamily}; + font-size: ${options2.fontSize}; + } + & p { + margin: 0 + } + + ${diagramStyles} + .node .neo-node { + stroke: ${options2.nodeBorder}; + } + + [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon { + stroke: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder}; + filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"}; + } + + + [data-look="neo"].node path { + stroke: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder}; + stroke-width: ${options2.strokeWidth ?? 1}px; + } + + [data-look="neo"].node .outer-path { + filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"}; + } + + [data-look="neo"].node .neo-line path { + stroke: ${options2.nodeBorder}; + filter: none; + } + + [data-look="neo"].node circle{ + stroke: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder}; + filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"}; + } + + [data-look="neo"].node circle .state-start{ + fill: #000000; + } + + [data-look="neo"].icon-shape .icon { + fill: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder}; + filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"}; + } + + [data-look="neo"].icon-shape .icon-neo path { + stroke: ${options2.useGradient ? "url(" + svgId + "-gradient)" : options2.nodeBorder}; + filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"}; + } + + ${userStyles} +`; + }, "getStyles"); + addStylesForDiagram = /* @__PURE__ */ __name((type3, diagramTheme) => { + if (diagramTheme !== void 0) { + themes[type3] = diagramTheme; + } + }, "addStylesForDiagram"); + styles_default = getStyles; + } + }); + + // src/diagrams/common/commonDb.ts + var commonDb_exports = {}; + __export(commonDb_exports, { + clear: () => clear, + getAccDescription: () => getAccDescription, + getAccTitle: () => getAccTitle, + getDiagramTitle: () => getDiagramTitle, + setAccDescription: () => setAccDescription, + setAccTitle: () => setAccTitle, + setDiagramTitle: () => setDiagramTitle + }); + var accTitle, diagramTitle, accDescription, sanitizeText2, clear, setAccTitle, getAccTitle, setAccDescription, getAccDescription, setDiagramTitle, getDiagramTitle; + var init_commonDb = __esm({ + "src/diagrams/common/commonDb.ts"() { + "use strict"; + init_common(); + init_config(); + accTitle = ""; + diagramTitle = ""; + accDescription = ""; + sanitizeText2 = /* @__PURE__ */ __name((txt) => sanitizeText(txt, getConfig()), "sanitizeText"); + clear = /* @__PURE__ */ __name(() => { + accTitle = ""; + accDescription = ""; + diagramTitle = ""; + }, "clear"); + setAccTitle = /* @__PURE__ */ __name((txt) => { + accTitle = sanitizeText2(txt).replace(/^\s+/g, ""); + }, "setAccTitle"); + getAccTitle = /* @__PURE__ */ __name(() => accTitle, "getAccTitle"); + setAccDescription = /* @__PURE__ */ __name((txt) => { + accDescription = sanitizeText2(txt).replace(/\n\s+/g, "\n"); + }, "setAccDescription"); + getAccDescription = /* @__PURE__ */ __name(() => accDescription, "getAccDescription"); + setDiagramTitle = /* @__PURE__ */ __name((txt) => { + diagramTitle = sanitizeText2(txt); + }, "setDiagramTitle"); + getDiagramTitle = /* @__PURE__ */ __name(() => diagramTitle, "getDiagramTitle"); + } + }); + + // src/diagram-api/diagramAPI.ts + var log2, setLogLevel2, getConfig2, setConfig2, defaultConfig2, sanitizeText3, setupGraphViewbox2, getCommonDb, diagrams, registerDiagram, getDiagram, DiagramNotFoundError; + var init_diagramAPI = __esm({ + "src/diagram-api/diagramAPI.ts"() { + "use strict"; + init_detectType(); + init_logger(); + init_config(); + init_common(); + init_setupGraphViewbox(); + init_styles(); + init_commonDb(); + log2 = log; + setLogLevel2 = setLogLevel; + getConfig2 = getConfig; + setConfig2 = setConfig; + defaultConfig2 = defaultConfig; + sanitizeText3 = /* @__PURE__ */ __name((text4) => sanitizeText(text4, getConfig2()), "sanitizeText"); + setupGraphViewbox2 = setupGraphViewbox; + getCommonDb = /* @__PURE__ */ __name(() => { + return commonDb_exports; + }, "getCommonDb"); + diagrams = {}; + registerDiagram = /* @__PURE__ */ __name((id35, diagram32, detector33) => { + if (diagrams[id35]) { + log2.warn(`Diagram with id ${id35} already registered. Overwriting.`); + } + diagrams[id35] = diagram32; + if (detector33) { + addDetector(id35, detector33); + } + addStylesForDiagram(id35, diagram32.styles); + diagram32.injectUtils?.( + log2, + setLogLevel2, + getConfig2, + sanitizeText3, + setupGraphViewbox2, + getCommonDb(), + () => { + } + ); + }, "registerDiagram"); + getDiagram = /* @__PURE__ */ __name((name) => { + if (name in diagrams) { + return diagrams[name]; + } + throw new DiagramNotFoundError(name); + }, "getDiagram"); + DiagramNotFoundError = class extends Error { + static { + __name(this, "DiagramNotFoundError"); + } + constructor(name) { + super(`Diagram ${name} not found.`); + } + }; + } + }); + + // src/diagrams/c4/c4Db.js + var c4ShapeArray, boundaryParseStack, currentBoundaryParse, parentBoundaryParse, boundaries, rels, title, wrapEnabled, c4ShapeInRow, c4BoundaryInRow, c4Type, getC4Type, setC4Type, addRel, addPersonOrSystem, addContainer, addComponent, addPersonOrSystemBoundary, addContainerBoundary, addDeploymentNode, popBoundaryParseStack, updateElStyle, updateRelStyle, updateLayoutConfig, getC4ShapeInRow, getC4BoundaryInRow, getCurrentBoundaryParse, getParentBoundaryParse, getC4ShapeArray, getC4Shape, getC4ShapeKeys, getBoundaries, getBoundarys, getRels, getTitle, setWrap, autoWrap, clear2, LINETYPE, ARROWTYPE, PLACEMENT, setTitle, c4Db_default; + var init_c4Db = __esm({ + "src/diagrams/c4/c4Db.js"() { + "use strict"; + init_diagramAPI(); + init_common(); + init_commonDb(); + c4ShapeArray = []; + boundaryParseStack = [""]; + currentBoundaryParse = "global"; + parentBoundaryParse = ""; + boundaries = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } + ]; + rels = []; + title = ""; + wrapEnabled = false; + c4ShapeInRow = 4; + c4BoundaryInRow = 2; + getC4Type = /* @__PURE__ */ __name(function() { + return c4Type; + }, "getC4Type"); + setC4Type = /* @__PURE__ */ __name(function(c4TypeParam) { + let sanitizedText = sanitizeText(c4TypeParam, getConfig2()); + c4Type = sanitizedText; + }, "setC4Type"); + addRel = /* @__PURE__ */ __name(function(type3, from2, to, label, techn, descr, sprite, tags2, link2) { + if (type3 === void 0 || type3 === null || from2 === void 0 || from2 === null || to === void 0 || to === null || label === void 0 || label === null) { + return; + } + let rel2 = {}; + const old = rels.find((rel3) => rel3.from === from2 && rel3.to === to); + if (old) { + rel2 = old; + } else { + rels.push(rel2); + } + rel2.type = type3; + rel2.from = from2; + rel2.to = to; + rel2.label = { text: label }; + if (techn === void 0 || techn === null) { + rel2.techn = { text: "" }; + } else { + if (typeof techn === "object") { + let [key, value2] = Object.entries(techn)[0]; + rel2[key] = { text: value2 }; + } else { + rel2.techn = { text: techn }; + } + } + if (descr === void 0 || descr === null) { + rel2.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value2] = Object.entries(descr)[0]; + rel2[key] = { text: value2 }; + } else { + rel2.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value2] = Object.entries(sprite)[0]; + rel2[key] = value2; + } else { + rel2.sprite = sprite; + } + if (typeof tags2 === "object") { + let [key, value2] = Object.entries(tags2)[0]; + rel2[key] = value2; + } else { + rel2.tags = tags2; + } + if (typeof link2 === "object") { + let [key, value2] = Object.entries(link2)[0]; + rel2[key] = value2; + } else { + rel2.link = link2; + } + rel2.wrap = autoWrap(); + }, "addRel"); + addPersonOrSystem = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, descr, sprite, tags2, link2) { + if (alias === null || label === null) { + return; + } + let personOrSystem = {}; + const old = c4ShapeArray.find((personOrSystem2) => personOrSystem2.alias === alias); + if (old && alias === old.alias) { + personOrSystem = old; + } else { + personOrSystem.alias = alias; + c4ShapeArray.push(personOrSystem); + } + if (label === void 0 || label === null) { + personOrSystem.label = { text: "" }; + } else { + personOrSystem.label = { text: label }; + } + if (descr === void 0 || descr === null) { + personOrSystem.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value2] = Object.entries(descr)[0]; + personOrSystem[key] = { text: value2 }; + } else { + personOrSystem.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value2] = Object.entries(sprite)[0]; + personOrSystem[key] = value2; + } else { + personOrSystem.sprite = sprite; + } + if (typeof tags2 === "object") { + let [key, value2] = Object.entries(tags2)[0]; + personOrSystem[key] = value2; + } else { + personOrSystem.tags = tags2; + } + if (typeof link2 === "object") { + let [key, value2] = Object.entries(link2)[0]; + personOrSystem[key] = value2; + } else { + personOrSystem.link = link2; + } + personOrSystem.typeC4Shape = { text: typeC4Shape }; + personOrSystem.parentBoundary = currentBoundaryParse; + personOrSystem.wrap = autoWrap(); + }, "addPersonOrSystem"); + addContainer = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, techn, descr, sprite, tags2, link2) { + if (alias === null || label === null) { + return; + } + let container2 = {}; + const old = c4ShapeArray.find((container3) => container3.alias === alias); + if (old && alias === old.alias) { + container2 = old; + } else { + container2.alias = alias; + c4ShapeArray.push(container2); + } + if (label === void 0 || label === null) { + container2.label = { text: "" }; + } else { + container2.label = { text: label }; + } + if (techn === void 0 || techn === null) { + container2.techn = { text: "" }; + } else { + if (typeof techn === "object") { + let [key, value2] = Object.entries(techn)[0]; + container2[key] = { text: value2 }; + } else { + container2.techn = { text: techn }; + } + } + if (descr === void 0 || descr === null) { + container2.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value2] = Object.entries(descr)[0]; + container2[key] = { text: value2 }; + } else { + container2.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value2] = Object.entries(sprite)[0]; + container2[key] = value2; + } else { + container2.sprite = sprite; + } + if (typeof tags2 === "object") { + let [key, value2] = Object.entries(tags2)[0]; + container2[key] = value2; + } else { + container2.tags = tags2; + } + if (typeof link2 === "object") { + let [key, value2] = Object.entries(link2)[0]; + container2[key] = value2; + } else { + container2.link = link2; + } + container2.wrap = autoWrap(); + container2.typeC4Shape = { text: typeC4Shape }; + container2.parentBoundary = currentBoundaryParse; + }, "addContainer"); + addComponent = /* @__PURE__ */ __name(function(typeC4Shape, alias, label, techn, descr, sprite, tags2, link2) { + if (alias === null || label === null) { + return; + } + let component2 = {}; + const old = c4ShapeArray.find((component3) => component3.alias === alias); + if (old && alias === old.alias) { + component2 = old; + } else { + component2.alias = alias; + c4ShapeArray.push(component2); + } + if (label === void 0 || label === null) { + component2.label = { text: "" }; + } else { + component2.label = { text: label }; + } + if (techn === void 0 || techn === null) { + component2.techn = { text: "" }; + } else { + if (typeof techn === "object") { + let [key, value2] = Object.entries(techn)[0]; + component2[key] = { text: value2 }; + } else { + component2.techn = { text: techn }; + } + } + if (descr === void 0 || descr === null) { + component2.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value2] = Object.entries(descr)[0]; + component2[key] = { text: value2 }; + } else { + component2.descr = { text: descr }; + } + } + if (typeof sprite === "object") { + let [key, value2] = Object.entries(sprite)[0]; + component2[key] = value2; + } else { + component2.sprite = sprite; + } + if (typeof tags2 === "object") { + let [key, value2] = Object.entries(tags2)[0]; + component2[key] = value2; + } else { + component2.tags = tags2; + } + if (typeof link2 === "object") { + let [key, value2] = Object.entries(link2)[0]; + component2[key] = value2; + } else { + component2.link = link2; + } + component2.wrap = autoWrap(); + component2.typeC4Shape = { text: typeC4Shape }; + component2.parentBoundary = currentBoundaryParse; + }, "addComponent"); + addPersonOrSystemBoundary = /* @__PURE__ */ __name(function(alias, label, type3, tags2, link2) { + if (alias === null || label === null) { + return; + } + let boundary = {}; + const old = boundaries.find((boundary2) => boundary2.alias === alias); + if (old && alias === old.alias) { + boundary = old; + } else { + boundary.alias = alias; + boundaries.push(boundary); + } + if (label === void 0 || label === null) { + boundary.label = { text: "" }; + } else { + boundary.label = { text: label }; + } + if (type3 === void 0 || type3 === null) { + boundary.type = { text: "system" }; + } else { + if (typeof type3 === "object") { + let [key, value2] = Object.entries(type3)[0]; + boundary[key] = { text: value2 }; + } else { + boundary.type = { text: type3 }; + } + } + if (typeof tags2 === "object") { + let [key, value2] = Object.entries(tags2)[0]; + boundary[key] = value2; + } else { + boundary.tags = tags2; + } + if (typeof link2 === "object") { + let [key, value2] = Object.entries(link2)[0]; + boundary[key] = value2; + } else { + boundary.link = link2; + } + boundary.parentBoundary = currentBoundaryParse; + boundary.wrap = autoWrap(); + parentBoundaryParse = currentBoundaryParse; + currentBoundaryParse = alias; + boundaryParseStack.push(parentBoundaryParse); + }, "addPersonOrSystemBoundary"); + addContainerBoundary = /* @__PURE__ */ __name(function(alias, label, type3, tags2, link2) { + if (alias === null || label === null) { + return; + } + let boundary = {}; + const old = boundaries.find((boundary2) => boundary2.alias === alias); + if (old && alias === old.alias) { + boundary = old; + } else { + boundary.alias = alias; + boundaries.push(boundary); + } + if (label === void 0 || label === null) { + boundary.label = { text: "" }; + } else { + boundary.label = { text: label }; + } + if (type3 === void 0 || type3 === null) { + boundary.type = { text: "container" }; + } else { + if (typeof type3 === "object") { + let [key, value2] = Object.entries(type3)[0]; + boundary[key] = { text: value2 }; + } else { + boundary.type = { text: type3 }; + } + } + if (typeof tags2 === "object") { + let [key, value2] = Object.entries(tags2)[0]; + boundary[key] = value2; + } else { + boundary.tags = tags2; + } + if (typeof link2 === "object") { + let [key, value2] = Object.entries(link2)[0]; + boundary[key] = value2; + } else { + boundary.link = link2; + } + boundary.parentBoundary = currentBoundaryParse; + boundary.wrap = autoWrap(); + parentBoundaryParse = currentBoundaryParse; + currentBoundaryParse = alias; + boundaryParseStack.push(parentBoundaryParse); + }, "addContainerBoundary"); + addDeploymentNode = /* @__PURE__ */ __name(function(nodeType3, alias, label, type3, descr, sprite, tags2, link2) { + if (alias === null || label === null) { + return; + } + let boundary = {}; + const old = boundaries.find((boundary2) => boundary2.alias === alias); + if (old && alias === old.alias) { + boundary = old; + } else { + boundary.alias = alias; + boundaries.push(boundary); + } + if (label === void 0 || label === null) { + boundary.label = { text: "" }; + } else { + boundary.label = { text: label }; + } + if (type3 === void 0 || type3 === null) { + boundary.type = { text: "node" }; + } else { + if (typeof type3 === "object") { + let [key, value2] = Object.entries(type3)[0]; + boundary[key] = { text: value2 }; + } else { + boundary.type = { text: type3 }; + } + } + if (descr === void 0 || descr === null) { + boundary.descr = { text: "" }; + } else { + if (typeof descr === "object") { + let [key, value2] = Object.entries(descr)[0]; + boundary[key] = { text: value2 }; + } else { + boundary.descr = { text: descr }; + } + } + if (typeof tags2 === "object") { + let [key, value2] = Object.entries(tags2)[0]; + boundary[key] = value2; + } else { + boundary.tags = tags2; + } + if (typeof link2 === "object") { + let [key, value2] = Object.entries(link2)[0]; + boundary[key] = value2; + } else { + boundary.link = link2; + } + boundary.nodeType = nodeType3; + boundary.parentBoundary = currentBoundaryParse; + boundary.wrap = autoWrap(); + parentBoundaryParse = currentBoundaryParse; + currentBoundaryParse = alias; + boundaryParseStack.push(parentBoundaryParse); + }, "addDeploymentNode"); + popBoundaryParseStack = /* @__PURE__ */ __name(function() { + currentBoundaryParse = parentBoundaryParse; + boundaryParseStack.pop(); + parentBoundaryParse = boundaryParseStack.pop(); + boundaryParseStack.push(parentBoundaryParse); + }, "popBoundaryParseStack"); + updateElStyle = /* @__PURE__ */ __name(function(typeC4Shape, elementName, bgColor, fontColor, borderColor, shadowing, shape, sprite, techn, legendText, legendSprite) { + let old = c4ShapeArray.find((element3) => element3.alias === elementName); + if (old === void 0) { + old = boundaries.find((element3) => element3.alias === elementName); + if (old === void 0) { + return; + } + } + if (bgColor !== void 0 && bgColor !== null) { + if (typeof bgColor === "object") { + let [key, value2] = Object.entries(bgColor)[0]; + old[key] = value2; + } else { + old.bgColor = bgColor; + } + } + if (fontColor !== void 0 && fontColor !== null) { + if (typeof fontColor === "object") { + let [key, value2] = Object.entries(fontColor)[0]; + old[key] = value2; + } else { + old.fontColor = fontColor; + } + } + if (borderColor !== void 0 && borderColor !== null) { + if (typeof borderColor === "object") { + let [key, value2] = Object.entries(borderColor)[0]; + old[key] = value2; + } else { + old.borderColor = borderColor; + } + } + if (shadowing !== void 0 && shadowing !== null) { + if (typeof shadowing === "object") { + let [key, value2] = Object.entries(shadowing)[0]; + old[key] = value2; + } else { + old.shadowing = shadowing; + } + } + if (shape !== void 0 && shape !== null) { + if (typeof shape === "object") { + let [key, value2] = Object.entries(shape)[0]; + old[key] = value2; + } else { + old.shape = shape; + } + } + if (sprite !== void 0 && sprite !== null) { + if (typeof sprite === "object") { + let [key, value2] = Object.entries(sprite)[0]; + old[key] = value2; + } else { + old.sprite = sprite; + } + } + if (techn !== void 0 && techn !== null) { + if (typeof techn === "object") { + let [key, value2] = Object.entries(techn)[0]; + old[key] = value2; + } else { + old.techn = techn; + } + } + if (legendText !== void 0 && legendText !== null) { + if (typeof legendText === "object") { + let [key, value2] = Object.entries(legendText)[0]; + old[key] = value2; + } else { + old.legendText = legendText; + } + } + if (legendSprite !== void 0 && legendSprite !== null) { + if (typeof legendSprite === "object") { + let [key, value2] = Object.entries(legendSprite)[0]; + old[key] = value2; + } else { + old.legendSprite = legendSprite; + } + } + }, "updateElStyle"); + updateRelStyle = /* @__PURE__ */ __name(function(typeC4Shape, from2, to, textColor, lineColor, offsetX, offsetY) { + const old = rels.find((rel2) => rel2.from === from2 && rel2.to === to); + if (old === void 0) { + return; + } + if (textColor !== void 0 && textColor !== null) { + if (typeof textColor === "object") { + let [key, value2] = Object.entries(textColor)[0]; + old[key] = value2; + } else { + old.textColor = textColor; + } + } + if (lineColor !== void 0 && lineColor !== null) { + if (typeof lineColor === "object") { + let [key, value2] = Object.entries(lineColor)[0]; + old[key] = value2; + } else { + old.lineColor = lineColor; + } + } + if (offsetX !== void 0 && offsetX !== null) { + if (typeof offsetX === "object") { + let [key, value2] = Object.entries(offsetX)[0]; + old[key] = parseInt(value2); + } else { + old.offsetX = parseInt(offsetX); + } + } + if (offsetY !== void 0 && offsetY !== null) { + if (typeof offsetY === "object") { + let [key, value2] = Object.entries(offsetY)[0]; + old[key] = parseInt(value2); + } else { + old.offsetY = parseInt(offsetY); + } + } + }, "updateRelStyle"); + updateLayoutConfig = /* @__PURE__ */ __name(function(typeC4Shape, c4ShapeInRowParam, c4BoundaryInRowParam) { + let c4ShapeInRowValue = c4ShapeInRow; + let c4BoundaryInRowValue = c4BoundaryInRow; + if (typeof c4ShapeInRowParam === "object") { + const value2 = Object.values(c4ShapeInRowParam)[0]; + c4ShapeInRowValue = parseInt(value2); + } else { + c4ShapeInRowValue = parseInt(c4ShapeInRowParam); + } + if (typeof c4BoundaryInRowParam === "object") { + const value2 = Object.values(c4BoundaryInRowParam)[0]; + c4BoundaryInRowValue = parseInt(value2); + } else { + c4BoundaryInRowValue = parseInt(c4BoundaryInRowParam); + } + if (c4ShapeInRowValue >= 1) { + c4ShapeInRow = c4ShapeInRowValue; + } + if (c4BoundaryInRowValue >= 1) { + c4BoundaryInRow = c4BoundaryInRowValue; + } + }, "updateLayoutConfig"); + getC4ShapeInRow = /* @__PURE__ */ __name(function() { + return c4ShapeInRow; + }, "getC4ShapeInRow"); + getC4BoundaryInRow = /* @__PURE__ */ __name(function() { + return c4BoundaryInRow; + }, "getC4BoundaryInRow"); + getCurrentBoundaryParse = /* @__PURE__ */ __name(function() { + return currentBoundaryParse; + }, "getCurrentBoundaryParse"); + getParentBoundaryParse = /* @__PURE__ */ __name(function() { + return parentBoundaryParse; + }, "getParentBoundaryParse"); + getC4ShapeArray = /* @__PURE__ */ __name(function(parentBoundary) { + if (parentBoundary === void 0 || parentBoundary === null) { + return c4ShapeArray; + } else { + return c4ShapeArray.filter((personOrSystem) => { + return personOrSystem.parentBoundary === parentBoundary; + }); + } + }, "getC4ShapeArray"); + getC4Shape = /* @__PURE__ */ __name(function(alias) { + return c4ShapeArray.find((personOrSystem) => personOrSystem.alias === alias); + }, "getC4Shape"); + getC4ShapeKeys = /* @__PURE__ */ __name(function(parentBoundary) { + return Object.keys(getC4ShapeArray(parentBoundary)); + }, "getC4ShapeKeys"); + getBoundaries = /* @__PURE__ */ __name(function(parentBoundary) { + if (parentBoundary === void 0 || parentBoundary === null) { + return boundaries; + } else { + return boundaries.filter((boundary) => boundary.parentBoundary === parentBoundary); + } + }, "getBoundaries"); + getBoundarys = getBoundaries; + getRels = /* @__PURE__ */ __name(function() { + return rels; + }, "getRels"); + getTitle = /* @__PURE__ */ __name(function() { + return title; + }, "getTitle"); + setWrap = /* @__PURE__ */ __name(function(wrapSetting) { + wrapEnabled = wrapSetting; + }, "setWrap"); + autoWrap = /* @__PURE__ */ __name(function() { + return wrapEnabled; + }, "autoWrap"); + clear2 = /* @__PURE__ */ __name(function() { + c4ShapeArray = []; + boundaries = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } + ]; + parentBoundaryParse = ""; + currentBoundaryParse = "global"; + boundaryParseStack = [""]; + rels = []; + boundaryParseStack = [""]; + title = ""; + wrapEnabled = false; + c4ShapeInRow = 4; + c4BoundaryInRow = 2; + }, "clear"); + LINETYPE = { + SOLID: 0, + DOTTED: 1, + NOTE: 2, + SOLID_CROSS: 3, + DOTTED_CROSS: 4, + SOLID_OPEN: 5, + DOTTED_OPEN: 6, + LOOP_START: 10, + LOOP_END: 11, + ALT_START: 12, + ALT_ELSE: 13, + ALT_END: 14, + OPT_START: 15, + OPT_END: 16, + ACTIVE_START: 17, + ACTIVE_END: 18, + PAR_START: 19, + PAR_AND: 20, + PAR_END: 21, + RECT_START: 22, + RECT_END: 23, + SOLID_POINT: 24, + DOTTED_POINT: 25 + }; + ARROWTYPE = { + FILLED: 0, + OPEN: 1 + }; + PLACEMENT = { + LEFTOF: 0, + RIGHTOF: 1, + OVER: 2 + }; + setTitle = /* @__PURE__ */ __name(function(txt) { + let sanitizedText = sanitizeText(txt, getConfig2()); + title = sanitizedText; + }, "setTitle"); + c4Db_default = { + addPersonOrSystem, + addPersonOrSystemBoundary, + addContainer, + addContainerBoundary, + addComponent, + addDeploymentNode, + popBoundaryParseStack, + addRel, + updateElStyle, + updateRelStyle, + updateLayoutConfig, + autoWrap, + setWrap, + getC4ShapeArray, + getC4Shape, + getC4ShapeKeys, + getBoundaries, + getBoundarys, + getCurrentBoundaryParse, + getParentBoundaryParse, + getRels, + getTitle, + getC4Type, + getC4ShapeInRow, + getC4BoundaryInRow, + setAccTitle, + getAccTitle, + getAccDescription, + setAccDescription, + getConfig: /* @__PURE__ */ __name(() => getConfig2().c4, "getConfig"), + clear: clear2, + LINETYPE, + ARROWTYPE, + PLACEMENT, + setTitle, + setC4Type + // apply, + }; + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ascending.js + function ascending(a2, b3) { + return a2 == null || b3 == null ? NaN : a2 < b3 ? -1 : a2 > b3 ? 1 : a2 >= b3 ? 0 : NaN; + } + var init_ascending = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ascending.js"() { + "use strict"; + __name(ascending, "ascending"); + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/descending.js + function descending(a2, b3) { + return a2 == null || b3 == null ? NaN : b3 < a2 ? -1 : b3 > a2 ? 1 : b3 >= a2 ? 0 : NaN; + } + var init_descending = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/descending.js"() { + "use strict"; + __name(descending, "descending"); + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisector.js + function bisector(f2) { + let compare1, compare2, delta; + if (f2.length !== 2) { + compare1 = ascending; + compare2 = /* @__PURE__ */ __name((d3, x5) => ascending(f2(d3), x5), "compare2"); + delta = /* @__PURE__ */ __name((d3, x5) => f2(d3) - x5, "delta"); + } else { + compare1 = f2 === ascending || f2 === descending ? f2 : zero; + compare2 = f2; + delta = f2; + } + function left3(a2, x5, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare1(x5, x5) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x5) < 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; + } + __name(left3, "left"); + function right3(a2, x5, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare1(x5, x5) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x5) <= 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; + } + __name(right3, "right"); + function center4(a2, x5, lo = 0, hi = a2.length) { + const i2 = left3(a2, x5, lo, hi - 1); + return i2 > lo && delta(a2[i2 - 1], x5) > -delta(a2[i2], x5) ? i2 - 1 : i2; + } + __name(center4, "center"); + return { left: left3, center: center4, right: right3 }; + } + function zero() { + return 0; + } + var init_bisector = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisector.js"() { + "use strict"; + init_ascending(); + init_descending(); + __name(bisector, "bisector"); + __name(zero, "zero"); + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/number.js + function number(x5) { + return x5 === null ? NaN : +x5; + } + var init_number = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/number.js"() { + "use strict"; + __name(number, "number"); + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisect.js + var ascendingBisect, bisectRight, bisectLeft, bisectCenter, bisect_default; + var init_bisect = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/bisect.js"() { + "use strict"; + init_ascending(); + init_bisector(); + init_number(); + ascendingBisect = bisector(ascending); + bisectRight = ascendingBisect.right; + bisectLeft = ascendingBisect.left; + bisectCenter = bisector(number).center; + bisect_default = bisectRight; + } + }); + + // ../../node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js + function intern_get({ _intern, _key }, value2) { + const key = _key(value2); + return _intern.has(key) ? _intern.get(key) : value2; + } + function intern_set({ _intern, _key }, value2) { + const key = _key(value2); + if (_intern.has(key)) return _intern.get(key); + _intern.set(key, value2); + return value2; + } + function intern_delete({ _intern, _key }, value2) { + const key = _key(value2); + if (_intern.has(key)) { + value2 = _intern.get(key); + _intern.delete(key); + } + return value2; + } + function keyof(value2) { + return value2 !== null && typeof value2 === "object" ? value2.valueOf() : value2; + } + var InternMap; + var init_src = __esm({ + "../../node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js"() { + "use strict"; + InternMap = class extends Map { + static { + __name(this, "InternMap"); + } + constructor(entries2, key = keyof) { + super(); + Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } }); + if (entries2 != null) for (const [key2, value2] of entries2) this.set(key2, value2); + } + get(key) { + return super.get(intern_get(this, key)); + } + has(key) { + return super.has(intern_get(this, key)); + } + set(key, value2) { + return super.set(intern_set(this, key), value2); + } + delete(key) { + return super.delete(intern_delete(this, key)); + } + }; + __name(intern_get, "intern_get"); + __name(intern_set, "intern_set"); + __name(intern_delete, "intern_delete"); + __name(keyof, "keyof"); + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ticks.js + function tickSpec(start3, stop5, count2) { + const step3 = (stop5 - start3) / Math.max(0, count2), power = Math.floor(Math.log10(step3)), error3 = step3 / Math.pow(10, power), factor = error3 >= e10 ? 10 : error3 >= e5 ? 5 : error3 >= e2 ? 2 : 1; + let i1, i2, inc; + if (power < 0) { + inc = Math.pow(10, -power) / factor; + i1 = Math.round(start3 * inc); + i2 = Math.round(stop5 * inc); + if (i1 / inc < start3) ++i1; + if (i2 / inc > stop5) --i2; + inc = -inc; + } else { + inc = Math.pow(10, power) * factor; + i1 = Math.round(start3 / inc); + i2 = Math.round(stop5 / inc); + if (i1 * inc < start3) ++i1; + if (i2 * inc > stop5) --i2; + } + if (i2 < i1 && 0.5 <= count2 && count2 < 2) return tickSpec(start3, stop5, count2 * 2); + return [i1, i2, inc]; + } + function ticks(start3, stop5, count2) { + stop5 = +stop5, start3 = +start3, count2 = +count2; + if (!(count2 > 0)) return []; + if (start3 === stop5) return [start3]; + const reverse2 = stop5 < start3, [i1, i2, inc] = reverse2 ? tickSpec(stop5, start3, count2) : tickSpec(start3, stop5, count2); + if (!(i2 >= i1)) return []; + const n2 = i2 - i1 + 1, ticks2 = new Array(n2); + if (reverse2) { + if (inc < 0) for (let i3 = 0; i3 < n2; ++i3) ticks2[i3] = (i2 - i3) / -inc; + else for (let i3 = 0; i3 < n2; ++i3) ticks2[i3] = (i2 - i3) * inc; + } else { + if (inc < 0) for (let i3 = 0; i3 < n2; ++i3) ticks2[i3] = (i1 + i3) / -inc; + else for (let i3 = 0; i3 < n2; ++i3) ticks2[i3] = (i1 + i3) * inc; + } + return ticks2; + } + function tickIncrement(start3, stop5, count2) { + stop5 = +stop5, start3 = +start3, count2 = +count2; + return tickSpec(start3, stop5, count2)[2]; + } + function tickStep(start3, stop5, count2) { + stop5 = +stop5, start3 = +start3, count2 = +count2; + const reverse2 = stop5 < start3, inc = reverse2 ? tickIncrement(stop5, start3, count2) : tickIncrement(start3, stop5, count2); + return (reverse2 ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); + } + var e10, e5, e2; + var init_ticks = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/ticks.js"() { + "use strict"; + e10 = Math.sqrt(50); + e5 = Math.sqrt(10); + e2 = Math.sqrt(2); + __name(tickSpec, "tickSpec"); + __name(ticks, "ticks"); + __name(tickIncrement, "tickIncrement"); + __name(tickStep, "tickStep"); + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js + function max(values3, valueof) { + let max10; + if (valueof === void 0) { + for (const value2 of values3) { + if (value2 != null && (max10 < value2 || max10 === void 0 && value2 >= value2)) { + max10 = value2; + } + } + } else { + let index = -1; + for (let value2 of values3) { + if ((value2 = valueof(value2, ++index, values3)) != null && (max10 < value2 || max10 === void 0 && value2 >= value2)) { + max10 = value2; + } + } + } + return max10; + } + var init_max = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/max.js"() { + "use strict"; + __name(max, "max"); + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js + function min(values3, valueof) { + let min10; + if (valueof === void 0) { + for (const value2 of values3) { + if (value2 != null && (min10 > value2 || min10 === void 0 && value2 >= value2)) { + min10 = value2; + } + } + } else { + let index = -1; + for (let value2 of values3) { + if ((value2 = valueof(value2, ++index, values3)) != null && (min10 > value2 || min10 === void 0 && value2 >= value2)) { + min10 = value2; + } + } + } + return min10; + } + var init_min = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/min.js"() { + "use strict"; + __name(min, "min"); + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/range.js + function range(start3, stop5, step3) { + start3 = +start3, stop5 = +stop5, step3 = (n2 = arguments.length) < 2 ? (stop5 = start3, start3 = 0, 1) : n2 < 3 ? 1 : +step3; + var i2 = -1, n2 = Math.max(0, Math.ceil((stop5 - start3) / step3)) | 0, range3 = new Array(n2); + while (++i2 < n2) { + range3[i2] = start3 + i2 * step3; + } + return range3; + } + var init_range = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/range.js"() { + "use strict"; + __name(range, "range"); + } + }); + + // ../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/index.js + var init_src2 = __esm({ + "../../node_modules/.pnpm/d3-array@3.2.4/node_modules/d3-array/src/index.js"() { + "use strict"; + init_bisect(); + init_bisector(); + init_max(); + init_min(); + init_range(); + init_ticks(); + init_src(); + } + }); + + // ../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/identity.js + function identity_default(x5) { + return x5; + } + var init_identity = __esm({ + "../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/identity.js"() { + "use strict"; + __name(identity_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/axis.js + function translateX(x5) { + return "translate(" + x5 + ",0)"; + } + function translateY(y6) { + return "translate(0," + y6 + ")"; + } + function number2(scale3) { + return (d3) => +scale3(d3); + } + function center(scale3, offset) { + offset = Math.max(0, scale3.bandwidth() - offset * 2) / 2; + if (scale3.round()) offset = Math.round(offset); + return (d3) => +scale3(d3) + offset; + } + function entering() { + return !this.__axis; + } + function axis(orient, scale3) { + var tickArguments = [], tickValues = null, tickFormat2 = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k2 = orient === top || orient === left ? -1 : 1, x5 = orient === left || orient === right ? "x" : "y", transform8 = orient === top || orient === bottom ? translateX : translateY; + function axis2(context) { + var values3 = tickValues == null ? scale3.ticks ? scale3.ticks.apply(scale3, tickArguments) : scale3.domain() : tickValues, format3 = tickFormat2 == null ? scale3.tickFormat ? scale3.tickFormat.apply(scale3, tickArguments) : identity_default : tickFormat2, spacing2 = Math.max(tickSizeInner, 0) + tickPadding, range3 = scale3.range(), range0 = +range3[0] + offset, range1 = +range3[range3.length - 1] + offset, position5 = (scale3.bandwidth ? center : number2)(scale3.copy(), offset), selection2 = context.selection ? context.selection() : context, path4 = selection2.selectAll(".domain").data([null]), tick = selection2.selectAll(".tick").data(values3, scale3).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line2 = tick.select("line"), text4 = tick.select("text"); + path4 = path4.merge(path4.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")); + tick = tick.merge(tickEnter); + line2 = line2.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x5 + "2", k2 * tickSizeInner)); + text4 = text4.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x5, k2 * spacing2).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em")); + if (context !== selection2) { + path4 = path4.transition(context); + tick = tick.transition(context); + line2 = line2.transition(context); + text4 = text4.transition(context); + tickExit = tickExit.transition(context).attr("opacity", epsilon).attr("transform", function(d3) { + return isFinite(d3 = position5(d3)) ? transform8(d3 + offset) : this.getAttribute("transform"); + }); + tickEnter.attr("opacity", epsilon).attr("transform", function(d3) { + var p3 = this.parentNode.__axis; + return transform8((p3 && isFinite(p3 = p3(d3)) ? p3 : position5(d3)) + offset); + }); + } + tickExit.remove(); + path4.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k2 * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k2 * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k2 * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k2 * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1); + tick.attr("opacity", 1).attr("transform", function(d3) { + return transform8(position5(d3) + offset); + }); + line2.attr(x5 + "2", k2 * tickSizeInner); + text4.attr(x5, k2 * spacing2).text(format3); + selection2.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle"); + selection2.each(function() { + this.__axis = position5; + }); + } + __name(axis2, "axis"); + axis2.scale = function(_3) { + return arguments.length ? (scale3 = _3, axis2) : scale3; + }; + axis2.ticks = function() { + return tickArguments = Array.from(arguments), axis2; + }; + axis2.tickArguments = function(_3) { + return arguments.length ? (tickArguments = _3 == null ? [] : Array.from(_3), axis2) : tickArguments.slice(); + }; + axis2.tickValues = function(_3) { + return arguments.length ? (tickValues = _3 == null ? null : Array.from(_3), axis2) : tickValues && tickValues.slice(); + }; + axis2.tickFormat = function(_3) { + return arguments.length ? (tickFormat2 = _3, axis2) : tickFormat2; + }; + axis2.tickSize = function(_3) { + return arguments.length ? (tickSizeInner = tickSizeOuter = +_3, axis2) : tickSizeInner; + }; + axis2.tickSizeInner = function(_3) { + return arguments.length ? (tickSizeInner = +_3, axis2) : tickSizeInner; + }; + axis2.tickSizeOuter = function(_3) { + return arguments.length ? (tickSizeOuter = +_3, axis2) : tickSizeOuter; + }; + axis2.tickPadding = function(_3) { + return arguments.length ? (tickPadding = +_3, axis2) : tickPadding; + }; + axis2.offset = function(_3) { + return arguments.length ? (offset = +_3, axis2) : offset; + }; + return axis2; + } + function axisTop(scale3) { + return axis(top, scale3); + } + function axisBottom(scale3) { + return axis(bottom, scale3); + } + var top, right, bottom, left, epsilon; + var init_axis = __esm({ + "../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/axis.js"() { + "use strict"; + init_identity(); + top = 1; + right = 2; + bottom = 3; + left = 4; + epsilon = 1e-6; + __name(translateX, "translateX"); + __name(translateY, "translateY"); + __name(number2, "number"); + __name(center, "center"); + __name(entering, "entering"); + __name(axis, "axis"); + __name(axisTop, "axisTop"); + __name(axisBottom, "axisBottom"); + } + }); + + // ../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/index.js + var init_src3 = __esm({ + "../../node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/index.js"() { + "use strict"; + init_axis(); + } + }); + + // ../../node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js + function dispatch() { + for (var i2 = 0, n2 = arguments.length, _3 = {}, t4; i2 < n2; ++i2) { + if (!(t4 = arguments[i2] + "") || t4 in _3 || /[\s.]/.test(t4)) throw new Error("illegal type: " + t4); + _3[t4] = []; + } + return new Dispatch(_3); + } + function Dispatch(_3) { + this._ = _3; + } + function parseTypenames(typenames, types) { + return typenames.trim().split(/^|\s+/).map(function(t4) { + var name = "", i2 = t4.indexOf("."); + if (i2 >= 0) name = t4.slice(i2 + 1), t4 = t4.slice(0, i2); + if (t4 && !types.hasOwnProperty(t4)) throw new Error("unknown type: " + t4); + return { type: t4, name }; + }); + } + function get(type3, name) { + for (var i2 = 0, n2 = type3.length, c3; i2 < n2; ++i2) { + if ((c3 = type3[i2]).name === name) { + return c3.value; + } + } + } + function set(type3, name, callback) { + for (var i2 = 0, n2 = type3.length; i2 < n2; ++i2) { + if (type3[i2].name === name) { + type3[i2] = noop, type3 = type3.slice(0, i2).concat(type3.slice(i2 + 1)); + break; + } + } + if (callback != null) type3.push({ name, value: callback }); + return type3; + } + var noop, dispatch_default; + var init_dispatch = __esm({ + "../../node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/dispatch.js"() { + "use strict"; + noop = { value: /* @__PURE__ */ __name(() => { + }, "value") }; + __name(dispatch, "dispatch"); + __name(Dispatch, "Dispatch"); + __name(parseTypenames, "parseTypenames"); + Dispatch.prototype = dispatch.prototype = { + constructor: Dispatch, + on: /* @__PURE__ */ __name(function(typename, callback) { + var _3 = this._, T3 = parseTypenames(typename + "", _3), t4, i2 = -1, n2 = T3.length; + if (arguments.length < 2) { + while (++i2 < n2) if ((t4 = (typename = T3[i2]).type) && (t4 = get(_3[t4], typename.name))) return t4; + return; + } + if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); + while (++i2 < n2) { + if (t4 = (typename = T3[i2]).type) _3[t4] = set(_3[t4], typename.name, callback); + else if (callback == null) for (t4 in _3) _3[t4] = set(_3[t4], typename.name, null); + } + return this; + }, "on"), + copy: /* @__PURE__ */ __name(function() { + var copy5 = {}, _3 = this._; + for (var t4 in _3) copy5[t4] = _3[t4].slice(); + return new Dispatch(copy5); + }, "copy"), + call: /* @__PURE__ */ __name(function(type3, that) { + if ((n2 = arguments.length - 2) > 0) for (var args = new Array(n2), i2 = 0, n2, t4; i2 < n2; ++i2) args[i2] = arguments[i2 + 2]; + if (!this._.hasOwnProperty(type3)) throw new Error("unknown type: " + type3); + for (t4 = this._[type3], i2 = 0, n2 = t4.length; i2 < n2; ++i2) t4[i2].value.apply(that, args); + }, "call"), + apply: /* @__PURE__ */ __name(function(type3, that, args) { + if (!this._.hasOwnProperty(type3)) throw new Error("unknown type: " + type3); + for (var t4 = this._[type3], i2 = 0, n2 = t4.length; i2 < n2; ++i2) t4[i2].value.apply(that, args); + }, "apply") + }; + __name(get, "get"); + __name(set, "set"); + dispatch_default = dispatch; + } + }); + + // ../../node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/index.js + var init_src4 = __esm({ + "../../node_modules/.pnpm/d3-dispatch@3.0.1/node_modules/d3-dispatch/src/index.js"() { + "use strict"; + init_dispatch(); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespaces.js + var xhtml, namespaces_default; + var init_namespaces = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespaces.js"() { + "use strict"; + xhtml = "http://www.w3.org/1999/xhtml"; + namespaces_default = { + svg: "http://www.w3.org/2000/svg", + xhtml, + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" + }; + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespace.js + function namespace_default(name) { + var prefix = name += "", i2 = prefix.indexOf(":"); + if (i2 >= 0 && (prefix = name.slice(0, i2)) !== "xmlns") name = name.slice(i2 + 1); + return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name; + } + var init_namespace = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/namespace.js"() { + "use strict"; + init_namespaces(); + __name(namespace_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/creator.js + function creatorInherit(name) { + return function() { + var document2 = this.ownerDocument, uri = this.namespaceURI; + return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name); + }; + } + function creatorFixed(fullname) { + return function() { + return this.ownerDocument.createElementNS(fullname.space, fullname.local); + }; + } + function creator_default(name) { + var fullname = namespace_default(name); + return (fullname.local ? creatorFixed : creatorInherit)(fullname); + } + var init_creator = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/creator.js"() { + "use strict"; + init_namespace(); + init_namespaces(); + __name(creatorInherit, "creatorInherit"); + __name(creatorFixed, "creatorFixed"); + __name(creator_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selector.js + function none() { + } + function selector_default(selector) { + return selector == null ? none : function() { + return this.querySelector(selector); + }; + } + var init_selector = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selector.js"() { + "use strict"; + __name(none, "none"); + __name(selector_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/select.js + function select_default(select) { + if (typeof select !== "function") select = selector_default(select); + for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) { + for (var group2 = groups[j3], n2 = group2.length, subgroup = subgroups[j3] = new Array(n2), node2, subnode, i2 = 0; i2 < n2; ++i2) { + if ((node2 = group2[i2]) && (subnode = select.call(node2, node2.__data__, i2, group2))) { + if ("__data__" in node2) subnode.__data__ = node2.__data__; + subgroup[i2] = subnode; + } + } + } + return new Selection(subgroups, this._parents); + } + var init_select = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/select.js"() { + "use strict"; + init_selection(); + init_selector(); + __name(select_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/array.js + function array(x5) { + return x5 == null ? [] : Array.isArray(x5) ? x5 : Array.from(x5); + } + var init_array = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/array.js"() { + "use strict"; + __name(array, "array"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selectorAll.js + function empty() { + return []; + } + function selectorAll_default(selector) { + return selector == null ? empty : function() { + return this.querySelectorAll(selector); + }; + } + var init_selectorAll = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selectorAll.js"() { + "use strict"; + __name(empty, "empty"); + __name(selectorAll_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectAll.js + function arrayAll(select) { + return function() { + return array(select.apply(this, arguments)); + }; + } + function selectAll_default(select) { + if (typeof select === "function") select = arrayAll(select); + else select = selectorAll_default(select); + for (var groups = this._groups, m3 = groups.length, subgroups = [], parents3 = [], j3 = 0; j3 < m3; ++j3) { + for (var group2 = groups[j3], n2 = group2.length, node2, i2 = 0; i2 < n2; ++i2) { + if (node2 = group2[i2]) { + subgroups.push(select.call(node2, node2.__data__, i2, group2)); + parents3.push(node2); + } + } + } + return new Selection(subgroups, parents3); + } + var init_selectAll = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectAll.js"() { + "use strict"; + init_selection(); + init_array(); + init_selectorAll(); + __name(arrayAll, "arrayAll"); + __name(selectAll_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/matcher.js + function matcher_default(selector) { + return function() { + return this.matches(selector); + }; + } + function childMatcher(selector) { + return function(node2) { + return node2.matches(selector); + }; + } + var init_matcher = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/matcher.js"() { + "use strict"; + __name(matcher_default, "default"); + __name(childMatcher, "childMatcher"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChild.js + function childFind(match3) { + return function() { + return find.call(this.children, match3); + }; + } + function childFirst() { + return this.firstElementChild; + } + function selectChild_default(match3) { + return this.select(match3 == null ? childFirst : childFind(typeof match3 === "function" ? match3 : childMatcher(match3))); + } + var find; + var init_selectChild = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChild.js"() { + "use strict"; + init_matcher(); + find = Array.prototype.find; + __name(childFind, "childFind"); + __name(childFirst, "childFirst"); + __name(selectChild_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChildren.js + function children() { + return Array.from(this.children); + } + function childrenFilter(match3) { + return function() { + return filter.call(this.children, match3); + }; + } + function selectChildren_default(match3) { + return this.selectAll(match3 == null ? children : childrenFilter(typeof match3 === "function" ? match3 : childMatcher(match3))); + } + var filter; + var init_selectChildren = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/selectChildren.js"() { + "use strict"; + init_matcher(); + filter = Array.prototype.filter; + __name(children, "children"); + __name(childrenFilter, "childrenFilter"); + __name(selectChildren_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/filter.js + function filter_default(match3) { + if (typeof match3 !== "function") match3 = matcher_default(match3); + for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) { + for (var group2 = groups[j3], n2 = group2.length, subgroup = subgroups[j3] = [], node2, i2 = 0; i2 < n2; ++i2) { + if ((node2 = group2[i2]) && match3.call(node2, node2.__data__, i2, group2)) { + subgroup.push(node2); + } + } + } + return new Selection(subgroups, this._parents); + } + var init_filter = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/filter.js"() { + "use strict"; + init_selection(); + init_matcher(); + __name(filter_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js + function sparse_default(update2) { + return new Array(update2.length); + } + var init_sparse = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sparse.js"() { + "use strict"; + __name(sparse_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/enter.js + function enter_default() { + return new Selection(this._enter || this._groups.map(sparse_default), this._parents); + } + function EnterNode(parent4, datum2) { + this.ownerDocument = parent4.ownerDocument; + this.namespaceURI = parent4.namespaceURI; + this._next = null; + this._parent = parent4; + this.__data__ = datum2; + } + var init_enter = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/enter.js"() { + "use strict"; + init_sparse(); + init_selection(); + __name(enter_default, "default"); + __name(EnterNode, "EnterNode"); + EnterNode.prototype = { + constructor: EnterNode, + appendChild: /* @__PURE__ */ __name(function(child) { + return this._parent.insertBefore(child, this._next); + }, "appendChild"), + insertBefore: /* @__PURE__ */ __name(function(child, next3) { + return this._parent.insertBefore(child, next3); + }, "insertBefore"), + querySelector: /* @__PURE__ */ __name(function(selector) { + return this._parent.querySelector(selector); + }, "querySelector"), + querySelectorAll: /* @__PURE__ */ __name(function(selector) { + return this._parent.querySelectorAll(selector); + }, "querySelectorAll") + }; + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/constant.js + function constant_default(x5) { + return function() { + return x5; + }; + } + var init_constant = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/constant.js"() { + "use strict"; + __name(constant_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/data.js + function bindIndex(parent4, group2, enter, update2, exit, data5) { + var i2 = 0, node2, groupLength3 = group2.length, dataLength = data5.length; + for (; i2 < dataLength; ++i2) { + if (node2 = group2[i2]) { + node2.__data__ = data5[i2]; + update2[i2] = node2; + } else { + enter[i2] = new EnterNode(parent4, data5[i2]); + } + } + for (; i2 < groupLength3; ++i2) { + if (node2 = group2[i2]) { + exit[i2] = node2; + } + } + } + function bindKey(parent4, group2, enter, update2, exit, data5, key) { + var i2, node2, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength3 = group2.length, dataLength = data5.length, keyValues = new Array(groupLength3), keyValue; + for (i2 = 0; i2 < groupLength3; ++i2) { + if (node2 = group2[i2]) { + keyValues[i2] = keyValue = key.call(node2, node2.__data__, i2, group2) + ""; + if (nodeByKeyValue.has(keyValue)) { + exit[i2] = node2; + } else { + nodeByKeyValue.set(keyValue, node2); + } + } + } + for (i2 = 0; i2 < dataLength; ++i2) { + keyValue = key.call(parent4, data5[i2], i2, data5) + ""; + if (node2 = nodeByKeyValue.get(keyValue)) { + update2[i2] = node2; + node2.__data__ = data5[i2]; + nodeByKeyValue.delete(keyValue); + } else { + enter[i2] = new EnterNode(parent4, data5[i2]); + } + } + for (i2 = 0; i2 < groupLength3; ++i2) { + if ((node2 = group2[i2]) && nodeByKeyValue.get(keyValues[i2]) === node2) { + exit[i2] = node2; + } + } + } + function datum(node2) { + return node2.__data__; + } + function data_default(value2, key) { + if (!arguments.length) return Array.from(this, datum); + var bind = key ? bindKey : bindIndex, parents3 = this._parents, groups = this._groups; + if (typeof value2 !== "function") value2 = constant_default(value2); + for (var m3 = groups.length, update2 = new Array(m3), enter = new Array(m3), exit = new Array(m3), j3 = 0; j3 < m3; ++j3) { + var parent4 = parents3[j3], group2 = groups[j3], groupLength3 = group2.length, data5 = arraylike(value2.call(parent4, parent4 && parent4.__data__, j3, parents3)), dataLength = data5.length, enterGroup = enter[j3] = new Array(dataLength), updateGroup = update2[j3] = new Array(dataLength), exitGroup = exit[j3] = new Array(groupLength3); + bind(parent4, group2, enterGroup, updateGroup, exitGroup, data5, key); + for (var i0 = 0, i1 = 0, previous, next3; i0 < dataLength; ++i0) { + if (previous = enterGroup[i0]) { + if (i0 >= i1) i1 = i0 + 1; + while (!(next3 = updateGroup[i1]) && ++i1 < dataLength) ; + previous._next = next3 || null; + } + } + } + update2 = new Selection(update2, parents3); + update2._enter = enter; + update2._exit = exit; + return update2; + } + function arraylike(data5) { + return typeof data5 === "object" && "length" in data5 ? data5 : Array.from(data5); + } + var init_data = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/data.js"() { + "use strict"; + init_selection(); + init_enter(); + init_constant(); + __name(bindIndex, "bindIndex"); + __name(bindKey, "bindKey"); + __name(datum, "datum"); + __name(data_default, "default"); + __name(arraylike, "arraylike"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/exit.js + function exit_default() { + return new Selection(this._exit || this._groups.map(sparse_default), this._parents); + } + var init_exit = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/exit.js"() { + "use strict"; + init_sparse(); + init_selection(); + __name(exit_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/join.js + function join_default(onenter, onupdate, onexit) { + var enter = this.enter(), update2 = this, exit = this.exit(); + if (typeof onenter === "function") { + enter = onenter(enter); + if (enter) enter = enter.selection(); + } else { + enter = enter.append(onenter + ""); + } + if (onupdate != null) { + update2 = onupdate(update2); + if (update2) update2 = update2.selection(); + } + if (onexit == null) exit.remove(); + else onexit(exit); + return enter && update2 ? enter.merge(update2).order() : update2; + } + var init_join = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/join.js"() { + "use strict"; + __name(join_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/merge.js + function merge_default(context) { + var selection2 = context.selection ? context.selection() : context; + for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m3 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m3; ++j3) { + for (var group0 = groups0[j3], group1 = groups1[j3], n2 = group0.length, merge6 = merges[j3] = new Array(n2), node2, i2 = 0; i2 < n2; ++i2) { + if (node2 = group0[i2] || group1[i2]) { + merge6[i2] = node2; + } + } + } + for (; j3 < m0; ++j3) { + merges[j3] = groups0[j3]; + } + return new Selection(merges, this._parents); + } + var init_merge2 = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/merge.js"() { + "use strict"; + init_selection(); + __name(merge_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/order.js + function order_default() { + for (var groups = this._groups, j3 = -1, m3 = groups.length; ++j3 < m3; ) { + for (var group2 = groups[j3], i2 = group2.length - 1, next3 = group2[i2], node2; --i2 >= 0; ) { + if (node2 = group2[i2]) { + if (next3 && node2.compareDocumentPosition(next3) ^ 4) next3.parentNode.insertBefore(node2, next3); + next3 = node2; + } + } + } + return this; + } + var init_order = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/order.js"() { + "use strict"; + __name(order_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sort.js + function sort_default(compare) { + if (!compare) compare = ascending2; + function compareNode(a2, b3) { + return a2 && b3 ? compare(a2.__data__, b3.__data__) : !a2 - !b3; + } + __name(compareNode, "compareNode"); + for (var groups = this._groups, m3 = groups.length, sortgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) { + for (var group2 = groups[j3], n2 = group2.length, sortgroup = sortgroups[j3] = new Array(n2), node2, i2 = 0; i2 < n2; ++i2) { + if (node2 = group2[i2]) { + sortgroup[i2] = node2; + } + } + sortgroup.sort(compareNode); + } + return new Selection(sortgroups, this._parents).order(); + } + function ascending2(a2, b3) { + return a2 < b3 ? -1 : a2 > b3 ? 1 : a2 >= b3 ? 0 : NaN; + } + var init_sort = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/sort.js"() { + "use strict"; + init_selection(); + __name(sort_default, "default"); + __name(ascending2, "ascending"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/call.js + function call_default() { + var callback = arguments[0]; + arguments[0] = this; + callback.apply(null, arguments); + return this; + } + var init_call = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/call.js"() { + "use strict"; + __name(call_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/nodes.js + function nodes_default() { + return Array.from(this); + } + var init_nodes = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/nodes.js"() { + "use strict"; + __name(nodes_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/node.js + function node_default() { + for (var groups = this._groups, j3 = 0, m3 = groups.length; j3 < m3; ++j3) { + for (var group2 = groups[j3], i2 = 0, n2 = group2.length; i2 < n2; ++i2) { + var node2 = group2[i2]; + if (node2) return node2; + } + } + return null; + } + var init_node = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/node.js"() { + "use strict"; + __name(node_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/size.js + function size_default() { + let size4 = 0; + for (const node2 of this) ++size4; + return size4; + } + var init_size2 = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/size.js"() { + "use strict"; + __name(size_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/empty.js + function empty_default() { + return !this.node(); + } + var init_empty = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/empty.js"() { + "use strict"; + __name(empty_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/each.js + function each_default(callback) { + for (var groups = this._groups, j3 = 0, m3 = groups.length; j3 < m3; ++j3) { + for (var group2 = groups[j3], i2 = 0, n2 = group2.length, node2; i2 < n2; ++i2) { + if (node2 = group2[i2]) callback.call(node2, node2.__data__, i2, group2); + } + } + return this; + } + var init_each = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/each.js"() { + "use strict"; + __name(each_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/attr.js + function attrRemove(name) { + return function() { + this.removeAttribute(name); + }; + } + function attrRemoveNS(fullname) { + return function() { + this.removeAttributeNS(fullname.space, fullname.local); + }; + } + function attrConstant(name, value2) { + return function() { + this.setAttribute(name, value2); + }; + } + function attrConstantNS(fullname, value2) { + return function() { + this.setAttributeNS(fullname.space, fullname.local, value2); + }; + } + function attrFunction(name, value2) { + return function() { + var v3 = value2.apply(this, arguments); + if (v3 == null) this.removeAttribute(name); + else this.setAttribute(name, v3); + }; + } + function attrFunctionNS(fullname, value2) { + return function() { + var v3 = value2.apply(this, arguments); + if (v3 == null) this.removeAttributeNS(fullname.space, fullname.local); + else this.setAttributeNS(fullname.space, fullname.local, v3); + }; + } + function attr_default(name, value2) { + var fullname = namespace_default(name); + if (arguments.length < 2) { + var node2 = this.node(); + return fullname.local ? node2.getAttributeNS(fullname.space, fullname.local) : node2.getAttribute(fullname); + } + return this.each((value2 == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value2 === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value2)); + } + var init_attr = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/attr.js"() { + "use strict"; + init_namespace(); + __name(attrRemove, "attrRemove"); + __name(attrRemoveNS, "attrRemoveNS"); + __name(attrConstant, "attrConstant"); + __name(attrConstantNS, "attrConstantNS"); + __name(attrFunction, "attrFunction"); + __name(attrFunctionNS, "attrFunctionNS"); + __name(attr_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/window.js + function window_default(node2) { + return node2.ownerDocument && node2.ownerDocument.defaultView || node2.document && node2 || node2.defaultView; + } + var init_window = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/window.js"() { + "use strict"; + __name(window_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/style.js + function styleRemove(name) { + return function() { + this.style.removeProperty(name); + }; + } + function styleConstant(name, value2, priority3) { + return function() { + this.style.setProperty(name, value2, priority3); + }; + } + function styleFunction(name, value2, priority3) { + return function() { + var v3 = value2.apply(this, arguments); + if (v3 == null) this.style.removeProperty(name); + else this.style.setProperty(name, v3, priority3); + }; + } + function style_default(name, value2, priority3) { + return arguments.length > 1 ? this.each((value2 == null ? styleRemove : typeof value2 === "function" ? styleFunction : styleConstant)(name, value2, priority3 == null ? "" : priority3)) : styleValue(this.node(), name); + } + function styleValue(node2, name) { + return node2.style.getPropertyValue(name) || window_default(node2).getComputedStyle(node2, null).getPropertyValue(name); + } + var init_style = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/style.js"() { + "use strict"; + init_window(); + __name(styleRemove, "styleRemove"); + __name(styleConstant, "styleConstant"); + __name(styleFunction, "styleFunction"); + __name(style_default, "default"); + __name(styleValue, "styleValue"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/property.js + function propertyRemove(name) { + return function() { + delete this[name]; + }; + } + function propertyConstant(name, value2) { + return function() { + this[name] = value2; + }; + } + function propertyFunction(name, value2) { + return function() { + var v3 = value2.apply(this, arguments); + if (v3 == null) delete this[name]; + else this[name] = v3; + }; + } + function property_default(name, value2) { + return arguments.length > 1 ? this.each((value2 == null ? propertyRemove : typeof value2 === "function" ? propertyFunction : propertyConstant)(name, value2)) : this.node()[name]; + } + var init_property = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/property.js"() { + "use strict"; + __name(propertyRemove, "propertyRemove"); + __name(propertyConstant, "propertyConstant"); + __name(propertyFunction, "propertyFunction"); + __name(property_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/classed.js + function classArray(string3) { + return string3.trim().split(/^|\s+/); + } + function classList(node2) { + return node2.classList || new ClassList(node2); + } + function ClassList(node2) { + this._node = node2; + this._names = classArray(node2.getAttribute("class") || ""); + } + function classedAdd(node2, names) { + var list = classList(node2), i2 = -1, n2 = names.length; + while (++i2 < n2) list.add(names[i2]); + } + function classedRemove(node2, names) { + var list = classList(node2), i2 = -1, n2 = names.length; + while (++i2 < n2) list.remove(names[i2]); + } + function classedTrue(names) { + return function() { + classedAdd(this, names); + }; + } + function classedFalse(names) { + return function() { + classedRemove(this, names); + }; + } + function classedFunction(names, value2) { + return function() { + (value2.apply(this, arguments) ? classedAdd : classedRemove)(this, names); + }; + } + function classed_default(name, value2) { + var names = classArray(name + ""); + if (arguments.length < 2) { + var list = classList(this.node()), i2 = -1, n2 = names.length; + while (++i2 < n2) if (!list.contains(names[i2])) return false; + return true; + } + return this.each((typeof value2 === "function" ? classedFunction : value2 ? classedTrue : classedFalse)(names, value2)); + } + var init_classed = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/classed.js"() { + "use strict"; + __name(classArray, "classArray"); + __name(classList, "classList"); + __name(ClassList, "ClassList"); + ClassList.prototype = { + add: /* @__PURE__ */ __name(function(name) { + var i2 = this._names.indexOf(name); + if (i2 < 0) { + this._names.push(name); + this._node.setAttribute("class", this._names.join(" ")); + } + }, "add"), + remove: /* @__PURE__ */ __name(function(name) { + var i2 = this._names.indexOf(name); + if (i2 >= 0) { + this._names.splice(i2, 1); + this._node.setAttribute("class", this._names.join(" ")); + } + }, "remove"), + contains: /* @__PURE__ */ __name(function(name) { + return this._names.indexOf(name) >= 0; + }, "contains") + }; + __name(classedAdd, "classedAdd"); + __name(classedRemove, "classedRemove"); + __name(classedTrue, "classedTrue"); + __name(classedFalse, "classedFalse"); + __name(classedFunction, "classedFunction"); + __name(classed_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/text.js + function textRemove() { + this.textContent = ""; + } + function textConstant(value2) { + return function() { + this.textContent = value2; + }; + } + function textFunction(value2) { + return function() { + var v3 = value2.apply(this, arguments); + this.textContent = v3 == null ? "" : v3; + }; + } + function text_default(value2) { + return arguments.length ? this.each(value2 == null ? textRemove : (typeof value2 === "function" ? textFunction : textConstant)(value2)) : this.node().textContent; + } + var init_text = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/text.js"() { + "use strict"; + __name(textRemove, "textRemove"); + __name(textConstant, "textConstant"); + __name(textFunction, "textFunction"); + __name(text_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/html.js + function htmlRemove() { + this.innerHTML = ""; + } + function htmlConstant(value2) { + return function() { + this.innerHTML = value2; + }; + } + function htmlFunction(value2) { + return function() { + var v3 = value2.apply(this, arguments); + this.innerHTML = v3 == null ? "" : v3; + }; + } + function html_default(value2) { + return arguments.length ? this.each(value2 == null ? htmlRemove : (typeof value2 === "function" ? htmlFunction : htmlConstant)(value2)) : this.node().innerHTML; + } + var init_html2 = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/html.js"() { + "use strict"; + __name(htmlRemove, "htmlRemove"); + __name(htmlConstant, "htmlConstant"); + __name(htmlFunction, "htmlFunction"); + __name(html_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/raise.js + function raise() { + if (this.nextSibling) this.parentNode.appendChild(this); + } + function raise_default() { + return this.each(raise); + } + var init_raise = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/raise.js"() { + "use strict"; + __name(raise, "raise"); + __name(raise_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/lower.js + function lower() { + if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild); + } + function lower_default() { + return this.each(lower); + } + var init_lower = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/lower.js"() { + "use strict"; + __name(lower, "lower"); + __name(lower_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/append.js + function append_default(name) { + var create4 = typeof name === "function" ? name : creator_default(name); + return this.select(function() { + return this.appendChild(create4.apply(this, arguments)); + }); + } + var init_append = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/append.js"() { + "use strict"; + init_creator(); + __name(append_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/insert.js + function constantNull() { + return null; + } + function insert_default(name, before) { + var create4 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before); + return this.select(function() { + return this.insertBefore(create4.apply(this, arguments), select.apply(this, arguments) || null); + }); + } + var init_insert = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/insert.js"() { + "use strict"; + init_creator(); + init_selector(); + __name(constantNull, "constantNull"); + __name(insert_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/remove.js + function remove() { + var parent4 = this.parentNode; + if (parent4) parent4.removeChild(this); + } + function remove_default() { + return this.each(remove); + } + var init_remove = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/remove.js"() { + "use strict"; + __name(remove, "remove"); + __name(remove_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/clone.js + function selection_cloneShallow() { + var clone9 = this.cloneNode(false), parent4 = this.parentNode; + return parent4 ? parent4.insertBefore(clone9, this.nextSibling) : clone9; + } + function selection_cloneDeep() { + var clone9 = this.cloneNode(true), parent4 = this.parentNode; + return parent4 ? parent4.insertBefore(clone9, this.nextSibling) : clone9; + } + function clone_default(deep) { + return this.select(deep ? selection_cloneDeep : selection_cloneShallow); + } + var init_clone = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/clone.js"() { + "use strict"; + __name(selection_cloneShallow, "selection_cloneShallow"); + __name(selection_cloneDeep, "selection_cloneDeep"); + __name(clone_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/datum.js + function datum_default(value2) { + return arguments.length ? this.property("__data__", value2) : this.node().__data__; + } + var init_datum = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/datum.js"() { + "use strict"; + __name(datum_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/on.js + function contextListener(listener) { + return function(event3) { + listener.call(this, event3, this.__data__); + }; + } + function parseTypenames2(typenames) { + return typenames.trim().split(/^|\s+/).map(function(t4) { + var name = "", i2 = t4.indexOf("."); + if (i2 >= 0) name = t4.slice(i2 + 1), t4 = t4.slice(0, i2); + return { type: t4, name }; + }); + } + function onRemove(typename) { + return function() { + var on3 = this.__on; + if (!on3) return; + for (var j3 = 0, i2 = -1, m3 = on3.length, o2; j3 < m3; ++j3) { + if (o2 = on3[j3], (!typename.type || o2.type === typename.type) && o2.name === typename.name) { + this.removeEventListener(o2.type, o2.listener, o2.options); + } else { + on3[++i2] = o2; + } + } + if (++i2) on3.length = i2; + else delete this.__on; + }; + } + function onAdd(typename, value2, options2) { + return function() { + var on3 = this.__on, o2, listener = contextListener(value2); + if (on3) for (var j3 = 0, m3 = on3.length; j3 < m3; ++j3) { + if ((o2 = on3[j3]).type === typename.type && o2.name === typename.name) { + this.removeEventListener(o2.type, o2.listener, o2.options); + this.addEventListener(o2.type, o2.listener = listener, o2.options = options2); + o2.value = value2; + return; + } + } + this.addEventListener(typename.type, listener, options2); + o2 = { type: typename.type, name: typename.name, value: value2, listener, options: options2 }; + if (!on3) this.__on = [o2]; + else on3.push(o2); + }; + } + function on_default(typename, value2, options2) { + var typenames = parseTypenames2(typename + ""), i2, n2 = typenames.length, t4; + if (arguments.length < 2) { + var on3 = this.node().__on; + if (on3) for (var j3 = 0, m3 = on3.length, o2; j3 < m3; ++j3) { + for (i2 = 0, o2 = on3[j3]; i2 < n2; ++i2) { + if ((t4 = typenames[i2]).type === o2.type && t4.name === o2.name) { + return o2.value; + } + } + } + return; + } + on3 = value2 ? onAdd : onRemove; + for (i2 = 0; i2 < n2; ++i2) this.each(on3(typenames[i2], value2, options2)); + return this; + } + var init_on = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/on.js"() { + "use strict"; + __name(contextListener, "contextListener"); + __name(parseTypenames2, "parseTypenames"); + __name(onRemove, "onRemove"); + __name(onAdd, "onAdd"); + __name(on_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/dispatch.js + function dispatchEvent(node2, type3, params) { + var window3 = window_default(node2), event3 = window3.CustomEvent; + if (typeof event3 === "function") { + event3 = new event3(type3, params); + } else { + event3 = window3.document.createEvent("Event"); + if (params) event3.initEvent(type3, params.bubbles, params.cancelable), event3.detail = params.detail; + else event3.initEvent(type3, false, false); + } + node2.dispatchEvent(event3); + } + function dispatchConstant(type3, params) { + return function() { + return dispatchEvent(this, type3, params); + }; + } + function dispatchFunction(type3, params) { + return function() { + return dispatchEvent(this, type3, params.apply(this, arguments)); + }; + } + function dispatch_default2(type3, params) { + return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type3, params)); + } + var init_dispatch2 = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/dispatch.js"() { + "use strict"; + init_window(); + __name(dispatchEvent, "dispatchEvent"); + __name(dispatchConstant, "dispatchConstant"); + __name(dispatchFunction, "dispatchFunction"); + __name(dispatch_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/iterator.js + function* iterator_default() { + for (var groups = this._groups, j3 = 0, m3 = groups.length; j3 < m3; ++j3) { + for (var group2 = groups[j3], i2 = 0, n2 = group2.length, node2; i2 < n2; ++i2) { + if (node2 = group2[i2]) yield node2; + } + } + } + var init_iterator = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/iterator.js"() { + "use strict"; + __name(iterator_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/index.js + function Selection(groups, parents3) { + this._groups = groups; + this._parents = parents3; + } + function selection() { + return new Selection([[document.documentElement]], root); + } + function selection_selection() { + return this; + } + var root, selection_default; + var init_selection = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/selection/index.js"() { + "use strict"; + init_select(); + init_selectAll(); + init_selectChild(); + init_selectChildren(); + init_filter(); + init_data(); + init_enter(); + init_exit(); + init_join(); + init_merge2(); + init_order(); + init_sort(); + init_call(); + init_nodes(); + init_node(); + init_size2(); + init_empty(); + init_each(); + init_attr(); + init_style(); + init_property(); + init_classed(); + init_text(); + init_html2(); + init_raise(); + init_lower(); + init_append(); + init_insert(); + init_remove(); + init_clone(); + init_datum(); + init_on(); + init_dispatch2(); + init_iterator(); + root = [null]; + __name(Selection, "Selection"); + __name(selection, "selection"); + __name(selection_selection, "selection_selection"); + Selection.prototype = selection.prototype = { + constructor: Selection, + select: select_default, + selectAll: selectAll_default, + selectChild: selectChild_default, + selectChildren: selectChildren_default, + filter: filter_default, + data: data_default, + enter: enter_default, + exit: exit_default, + join: join_default, + merge: merge_default, + selection: selection_selection, + order: order_default, + sort: sort_default, + call: call_default, + nodes: nodes_default, + node: node_default, + size: size_default, + empty: empty_default, + each: each_default, + attr: attr_default, + style: style_default, + property: property_default, + classed: classed_default, + text: text_default, + html: html_default, + raise: raise_default, + lower: lower_default, + append: append_default, + insert: insert_default, + remove: remove_default, + clone: clone_default, + datum: datum_default, + on: on_default, + dispatch: dispatch_default2, + [Symbol.iterator]: iterator_default + }; + selection_default = selection; + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js + function select_default2(selector) { + return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root); + } + var init_select2 = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/select.js"() { + "use strict"; + init_selection(); + __name(select_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/index.js + var init_src5 = __esm({ + "../../node_modules/.pnpm/d3-selection@3.0.0/node_modules/d3-selection/src/index.js"() { + "use strict"; + init_matcher(); + init_namespace(); + init_select2(); + init_selection(); + init_selector(); + init_selectorAll(); + init_style(); + } + }); + + // ../../node_modules/.pnpm/d3-drag@3.0.0/node_modules/d3-drag/src/index.js + var init_src6 = __esm({ + "../../node_modules/.pnpm/d3-drag@3.0.0/node_modules/d3-drag/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js + function define_default(constructor, factory, prototype) { + constructor.prototype = factory.prototype = prototype; + prototype.constructor = constructor; + } + function extend(parent4, definition) { + var prototype = Object.create(parent4.prototype); + for (var key in definition) prototype[key] = definition[key]; + return prototype; + } + var init_define = __esm({ + "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js"() { + "use strict"; + __name(define_default, "default"); + __name(extend, "extend"); + } + }); + + // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js + function Color2() { + } + function color_formatHex() { + return this.rgb().formatHex(); + } + function color_formatHex8() { + return this.rgb().formatHex8(); + } + function color_formatHsl() { + return hslConvert(this).formatHsl(); + } + function color_formatRgb() { + return this.rgb().formatRgb(); + } + function color(format3) { + var m3, l4; + format3 = (format3 + "").trim().toLowerCase(); + return (m3 = reHex.exec(format3)) ? (l4 = m3[1].length, m3 = parseInt(m3[1], 16), l4 === 6 ? rgbn(m3) : l4 === 3 ? new Rgb(m3 >> 8 & 15 | m3 >> 4 & 240, m3 >> 4 & 15 | m3 & 240, (m3 & 15) << 4 | m3 & 15, 1) : l4 === 8 ? rgba2(m3 >> 24 & 255, m3 >> 16 & 255, m3 >> 8 & 255, (m3 & 255) / 255) : l4 === 4 ? rgba2(m3 >> 12 & 15 | m3 >> 8 & 240, m3 >> 8 & 15 | m3 >> 4 & 240, m3 >> 4 & 15 | m3 & 240, ((m3 & 15) << 4 | m3 & 15) / 255) : null) : (m3 = reRgbInteger.exec(format3)) ? new Rgb(m3[1], m3[2], m3[3], 1) : (m3 = reRgbPercent.exec(format3)) ? new Rgb(m3[1] * 255 / 100, m3[2] * 255 / 100, m3[3] * 255 / 100, 1) : (m3 = reRgbaInteger.exec(format3)) ? rgba2(m3[1], m3[2], m3[3], m3[4]) : (m3 = reRgbaPercent.exec(format3)) ? rgba2(m3[1] * 255 / 100, m3[2] * 255 / 100, m3[3] * 255 / 100, m3[4]) : (m3 = reHslPercent.exec(format3)) ? hsla(m3[1], m3[2] / 100, m3[3] / 100, 1) : (m3 = reHslaPercent.exec(format3)) ? hsla(m3[1], m3[2] / 100, m3[3] / 100, m3[4]) : named.hasOwnProperty(format3) ? rgbn(named[format3]) : format3 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; + } + function rgbn(n2) { + return new Rgb(n2 >> 16 & 255, n2 >> 8 & 255, n2 & 255, 1); + } + function rgba2(r2, g2, b3, a2) { + if (a2 <= 0) r2 = g2 = b3 = NaN; + return new Rgb(r2, g2, b3, a2); + } + function rgbConvert(o2) { + if (!(o2 instanceof Color2)) o2 = color(o2); + if (!o2) return new Rgb(); + o2 = o2.rgb(); + return new Rgb(o2.r, o2.g, o2.b, o2.opacity); + } + function rgb(r2, g2, b3, opacity) { + return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g2, b3, opacity == null ? 1 : opacity); + } + function Rgb(r2, g2, b3, opacity) { + this.r = +r2; + this.g = +g2; + this.b = +b3; + this.opacity = +opacity; + } + function rgb_formatHex() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; + } + function rgb_formatHex8() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; + } + function rgb_formatRgb() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`; + } + function clampa(opacity) { + return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); + } + function clampi(value2) { + return Math.max(0, Math.min(255, Math.round(value2) || 0)); + } + function hex(value2) { + value2 = clampi(value2); + return (value2 < 16 ? "0" : "") + value2.toString(16); + } + function hsla(h3, s2, l4, a2) { + if (a2 <= 0) h3 = s2 = l4 = NaN; + else if (l4 <= 0 || l4 >= 1) h3 = s2 = NaN; + else if (s2 <= 0) h3 = NaN; + return new Hsl(h3, s2, l4, a2); + } + function hslConvert(o2) { + if (o2 instanceof Hsl) return new Hsl(o2.h, o2.s, o2.l, o2.opacity); + if (!(o2 instanceof Color2)) o2 = color(o2); + if (!o2) return new Hsl(); + if (o2 instanceof Hsl) return o2; + o2 = o2.rgb(); + var r2 = o2.r / 255, g2 = o2.g / 255, b3 = o2.b / 255, min10 = Math.min(r2, g2, b3), max10 = Math.max(r2, g2, b3), h3 = NaN, s2 = max10 - min10, l4 = (max10 + min10) / 2; + if (s2) { + if (r2 === max10) h3 = (g2 - b3) / s2 + (g2 < b3) * 6; + else if (g2 === max10) h3 = (b3 - r2) / s2 + 2; + else h3 = (r2 - g2) / s2 + 4; + s2 /= l4 < 0.5 ? max10 + min10 : 2 - max10 - min10; + h3 *= 60; + } else { + s2 = l4 > 0 && l4 < 1 ? 0 : h3; + } + return new Hsl(h3, s2, l4, o2.opacity); + } + function hsl(h3, s2, l4, opacity) { + return arguments.length === 1 ? hslConvert(h3) : new Hsl(h3, s2, l4, opacity == null ? 1 : opacity); + } + function Hsl(h3, s2, l4, opacity) { + this.h = +h3; + this.s = +s2; + this.l = +l4; + this.opacity = +opacity; + } + function clamph(value2) { + value2 = (value2 || 0) % 360; + return value2 < 0 ? value2 + 360 : value2; + } + function clampt(value2) { + return Math.max(0, Math.min(1, value2 || 0)); + } + function hsl2rgb(h3, m1, m22) { + return (h3 < 60 ? m1 + (m22 - m1) * h3 / 60 : h3 < 180 ? m22 : h3 < 240 ? m1 + (m22 - m1) * (240 - h3) / 60 : m1) * 255; + } + var darker, brighter, reI, reN, reP, reHex, reRgbInteger, reRgbPercent, reRgbaInteger, reRgbaPercent, reHslPercent, reHslaPercent, named; + var init_color2 = __esm({ + "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js"() { + "use strict"; + init_define(); + __name(Color2, "Color"); + darker = 0.7; + brighter = 1 / darker; + reI = "\\s*([+-]?\\d+)\\s*"; + reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*"; + reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*"; + reHex = /^#([0-9a-f]{3,8})$/; + reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`); + reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`); + reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`); + reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`); + reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`); + reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); + named = { + aliceblue: 15792383, + antiquewhite: 16444375, + aqua: 65535, + aquamarine: 8388564, + azure: 15794175, + beige: 16119260, + bisque: 16770244, + black: 0, + blanchedalmond: 16772045, + blue: 255, + blueviolet: 9055202, + brown: 10824234, + burlywood: 14596231, + cadetblue: 6266528, + chartreuse: 8388352, + chocolate: 13789470, + coral: 16744272, + cornflowerblue: 6591981, + cornsilk: 16775388, + crimson: 14423100, + cyan: 65535, + darkblue: 139, + darkcyan: 35723, + darkgoldenrod: 12092939, + darkgray: 11119017, + darkgreen: 25600, + darkgrey: 11119017, + darkkhaki: 12433259, + darkmagenta: 9109643, + darkolivegreen: 5597999, + darkorange: 16747520, + darkorchid: 10040012, + darkred: 9109504, + darksalmon: 15308410, + darkseagreen: 9419919, + darkslateblue: 4734347, + darkslategray: 3100495, + darkslategrey: 3100495, + darkturquoise: 52945, + darkviolet: 9699539, + deeppink: 16716947, + deepskyblue: 49151, + dimgray: 6908265, + dimgrey: 6908265, + dodgerblue: 2003199, + firebrick: 11674146, + floralwhite: 16775920, + forestgreen: 2263842, + fuchsia: 16711935, + gainsboro: 14474460, + ghostwhite: 16316671, + gold: 16766720, + goldenrod: 14329120, + gray: 8421504, + green: 32768, + greenyellow: 11403055, + grey: 8421504, + honeydew: 15794160, + hotpink: 16738740, + indianred: 13458524, + indigo: 4915330, + ivory: 16777200, + khaki: 15787660, + lavender: 15132410, + lavenderblush: 16773365, + lawngreen: 8190976, + lemonchiffon: 16775885, + lightblue: 11393254, + lightcoral: 15761536, + lightcyan: 14745599, + lightgoldenrodyellow: 16448210, + lightgray: 13882323, + lightgreen: 9498256, + lightgrey: 13882323, + lightpink: 16758465, + lightsalmon: 16752762, + lightseagreen: 2142890, + lightskyblue: 8900346, + lightslategray: 7833753, + lightslategrey: 7833753, + lightsteelblue: 11584734, + lightyellow: 16777184, + lime: 65280, + limegreen: 3329330, + linen: 16445670, + magenta: 16711935, + maroon: 8388608, + mediumaquamarine: 6737322, + mediumblue: 205, + mediumorchid: 12211667, + mediumpurple: 9662683, + mediumseagreen: 3978097, + mediumslateblue: 8087790, + mediumspringgreen: 64154, + mediumturquoise: 4772300, + mediumvioletred: 13047173, + midnightblue: 1644912, + mintcream: 16121850, + mistyrose: 16770273, + moccasin: 16770229, + navajowhite: 16768685, + navy: 128, + oldlace: 16643558, + olive: 8421376, + olivedrab: 7048739, + orange: 16753920, + orangered: 16729344, + orchid: 14315734, + palegoldenrod: 15657130, + palegreen: 10025880, + paleturquoise: 11529966, + palevioletred: 14381203, + papayawhip: 16773077, + peachpuff: 16767673, + peru: 13468991, + pink: 16761035, + plum: 14524637, + powderblue: 11591910, + purple: 8388736, + rebeccapurple: 6697881, + red: 16711680, + rosybrown: 12357519, + royalblue: 4286945, + saddlebrown: 9127187, + salmon: 16416882, + sandybrown: 16032864, + seagreen: 3050327, + seashell: 16774638, + sienna: 10506797, + silver: 12632256, + skyblue: 8900331, + slateblue: 6970061, + slategray: 7372944, + slategrey: 7372944, + snow: 16775930, + springgreen: 65407, + steelblue: 4620980, + tan: 13808780, + teal: 32896, + thistle: 14204888, + tomato: 16737095, + turquoise: 4251856, + violet: 15631086, + wheat: 16113331, + white: 16777215, + whitesmoke: 16119285, + yellow: 16776960, + yellowgreen: 10145074 + }; + define_default(Color2, color, { + copy(channels2) { + return Object.assign(new this.constructor(), this, channels2); + }, + displayable() { + return this.rgb().displayable(); + }, + hex: color_formatHex, + // Deprecated! Use color.formatHex. + formatHex: color_formatHex, + formatHex8: color_formatHex8, + formatHsl: color_formatHsl, + formatRgb: color_formatRgb, + toString: color_formatRgb + }); + __name(color_formatHex, "color_formatHex"); + __name(color_formatHex8, "color_formatHex8"); + __name(color_formatHsl, "color_formatHsl"); + __name(color_formatRgb, "color_formatRgb"); + __name(color, "color"); + __name(rgbn, "rgbn"); + __name(rgba2, "rgba"); + __name(rgbConvert, "rgbConvert"); + __name(rgb, "rgb"); + __name(Rgb, "Rgb"); + define_default(Rgb, rgb, extend(Color2, { + brighter(k2) { + k2 = k2 == null ? brighter : Math.pow(brighter, k2); + return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity); + }, + darker(k2) { + k2 = k2 == null ? darker : Math.pow(darker, k2); + return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity); + }, + rgb() { + return this; + }, + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); + }, + displayable() { + return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1); + }, + hex: rgb_formatHex, + // Deprecated! Use color.formatHex. + formatHex: rgb_formatHex, + formatHex8: rgb_formatHex8, + formatRgb: rgb_formatRgb, + toString: rgb_formatRgb + })); + __name(rgb_formatHex, "rgb_formatHex"); + __name(rgb_formatHex8, "rgb_formatHex8"); + __name(rgb_formatRgb, "rgb_formatRgb"); + __name(clampa, "clampa"); + __name(clampi, "clampi"); + __name(hex, "hex"); + __name(hsla, "hsla"); + __name(hslConvert, "hslConvert"); + __name(hsl, "hsl"); + __name(Hsl, "Hsl"); + define_default(Hsl, hsl, extend(Color2, { + brighter(k2) { + k2 = k2 == null ? brighter : Math.pow(brighter, k2); + return new Hsl(this.h, this.s, this.l * k2, this.opacity); + }, + darker(k2) { + k2 = k2 == null ? darker : Math.pow(darker, k2); + return new Hsl(this.h, this.s, this.l * k2, this.opacity); + }, + rgb() { + var h3 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h3) || isNaN(this.s) ? 0 : this.s, l4 = this.l, m22 = l4 + (l4 < 0.5 ? l4 : 1 - l4) * s2, m1 = 2 * l4 - m22; + return new Rgb( + hsl2rgb(h3 >= 240 ? h3 - 240 : h3 + 120, m1, m22), + hsl2rgb(h3, m1, m22), + hsl2rgb(h3 < 120 ? h3 + 240 : h3 - 120, m1, m22), + this.opacity + ); + }, + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); + }, + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1); + }, + formatHsl() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`; + } + })); + __name(clamph, "clamph"); + __name(clampt, "clampt"); + __name(hsl2rgb, "hsl2rgb"); + } + }); + + // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/math.js + var radians, degrees; + var init_math = __esm({ + "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/math.js"() { + "use strict"; + radians = Math.PI / 180; + degrees = 180 / Math.PI; + } + }); + + // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/lab.js + function labConvert(o2) { + if (o2 instanceof Lab) return new Lab(o2.l, o2.a, o2.b, o2.opacity); + if (o2 instanceof Hcl) return hcl2lab(o2); + if (!(o2 instanceof Rgb)) o2 = rgbConvert(o2); + var r2 = rgb2lrgb(o2.r), g2 = rgb2lrgb(o2.g), b3 = rgb2lrgb(o2.b), y6 = xyz2lab((0.2225045 * r2 + 0.7168786 * g2 + 0.0606169 * b3) / Yn), x5, z3; + if (r2 === g2 && g2 === b3) x5 = z3 = y6; + else { + x5 = xyz2lab((0.4360747 * r2 + 0.3850649 * g2 + 0.1430804 * b3) / Xn); + z3 = xyz2lab((0.0139322 * r2 + 0.0971045 * g2 + 0.7141733 * b3) / Zn); + } + return new Lab(116 * y6 - 16, 500 * (x5 - y6), 200 * (y6 - z3), o2.opacity); + } + function lab(l4, a2, b3, opacity) { + return arguments.length === 1 ? labConvert(l4) : new Lab(l4, a2, b3, opacity == null ? 1 : opacity); + } + function Lab(l4, a2, b3, opacity) { + this.l = +l4; + this.a = +a2; + this.b = +b3; + this.opacity = +opacity; + } + function xyz2lab(t4) { + return t4 > t3 ? Math.pow(t4, 1 / 3) : t4 / t2 + t0; + } + function lab2xyz(t4) { + return t4 > t1 ? t4 * t4 * t4 : t2 * (t4 - t0); + } + function lrgb2rgb(x5) { + return 255 * (x5 <= 31308e-7 ? 12.92 * x5 : 1.055 * Math.pow(x5, 1 / 2.4) - 0.055); + } + function rgb2lrgb(x5) { + return (x5 /= 255) <= 0.04045 ? x5 / 12.92 : Math.pow((x5 + 0.055) / 1.055, 2.4); + } + function hclConvert(o2) { + if (o2 instanceof Hcl) return new Hcl(o2.h, o2.c, o2.l, o2.opacity); + if (!(o2 instanceof Lab)) o2 = labConvert(o2); + if (o2.a === 0 && o2.b === 0) return new Hcl(NaN, 0 < o2.l && o2.l < 100 ? 0 : NaN, o2.l, o2.opacity); + var h3 = Math.atan2(o2.b, o2.a) * degrees; + return new Hcl(h3 < 0 ? h3 + 360 : h3, Math.sqrt(o2.a * o2.a + o2.b * o2.b), o2.l, o2.opacity); + } + function hcl(h3, c3, l4, opacity) { + return arguments.length === 1 ? hclConvert(h3) : new Hcl(h3, c3, l4, opacity == null ? 1 : opacity); + } + function Hcl(h3, c3, l4, opacity) { + this.h = +h3; + this.c = +c3; + this.l = +l4; + this.opacity = +opacity; + } + function hcl2lab(o2) { + if (isNaN(o2.h)) return new Lab(o2.l, 0, 0, o2.opacity); + var h3 = o2.h * radians; + return new Lab(o2.l, Math.cos(h3) * o2.c, Math.sin(h3) * o2.c, o2.opacity); + } + var K, Xn, Yn, Zn, t0, t1, t2, t3; + var init_lab = __esm({ + "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/lab.js"() { + "use strict"; + init_define(); + init_color2(); + init_math(); + K = 18; + Xn = 0.96422; + Yn = 1; + Zn = 0.82521; + t0 = 4 / 29; + t1 = 6 / 29; + t2 = 3 * t1 * t1; + t3 = t1 * t1 * t1; + __name(labConvert, "labConvert"); + __name(lab, "lab"); + __name(Lab, "Lab"); + define_default(Lab, lab, extend(Color2, { + brighter(k2) { + return new Lab(this.l + K * (k2 == null ? 1 : k2), this.a, this.b, this.opacity); + }, + darker(k2) { + return new Lab(this.l - K * (k2 == null ? 1 : k2), this.a, this.b, this.opacity); + }, + rgb() { + var y6 = (this.l + 16) / 116, x5 = isNaN(this.a) ? y6 : y6 + this.a / 500, z3 = isNaN(this.b) ? y6 : y6 - this.b / 200; + x5 = Xn * lab2xyz(x5); + y6 = Yn * lab2xyz(y6); + z3 = Zn * lab2xyz(z3); + return new Rgb( + lrgb2rgb(3.1338561 * x5 - 1.6168667 * y6 - 0.4906146 * z3), + lrgb2rgb(-0.9787684 * x5 + 1.9161415 * y6 + 0.033454 * z3), + lrgb2rgb(0.0719453 * x5 - 0.2289914 * y6 + 1.4052427 * z3), + this.opacity + ); + } + })); + __name(xyz2lab, "xyz2lab"); + __name(lab2xyz, "lab2xyz"); + __name(lrgb2rgb, "lrgb2rgb"); + __name(rgb2lrgb, "rgb2lrgb"); + __name(hclConvert, "hclConvert"); + __name(hcl, "hcl"); + __name(Hcl, "Hcl"); + __name(hcl2lab, "hcl2lab"); + define_default(Hcl, hcl, extend(Color2, { + brighter(k2) { + return new Hcl(this.h, this.c, this.l + K * (k2 == null ? 1 : k2), this.opacity); + }, + darker(k2) { + return new Hcl(this.h, this.c, this.l - K * (k2 == null ? 1 : k2), this.opacity); + }, + rgb() { + return hcl2lab(this).rgb(); + } + })); + } + }); + + // ../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/index.js + var init_src7 = __esm({ + "../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/index.js"() { + "use strict"; + init_color2(); + init_lab(); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basis.js + function basis(t13, v0, v12, v23, v3) { + var t22 = t13 * t13, t32 = t22 * t13; + return ((1 - 3 * t13 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v12 + (1 + 3 * t13 + 3 * t22 - 3 * t32) * v23 + t32 * v3) / 6; + } + function basis_default(values3) { + var n2 = values3.length - 1; + return function(t4) { + var i2 = t4 <= 0 ? t4 = 0 : t4 >= 1 ? (t4 = 1, n2 - 1) : Math.floor(t4 * n2), v12 = values3[i2], v23 = values3[i2 + 1], v0 = i2 > 0 ? values3[i2 - 1] : 2 * v12 - v23, v3 = i2 < n2 - 1 ? values3[i2 + 2] : 2 * v23 - v12; + return basis((t4 - i2 / n2) * n2, v0, v12, v23, v3); + }; + } + var init_basis = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basis.js"() { + "use strict"; + __name(basis, "basis"); + __name(basis_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basisClosed.js + function basisClosed_default(values3) { + var n2 = values3.length; + return function(t4) { + var i2 = Math.floor(((t4 %= 1) < 0 ? ++t4 : t4) * n2), v0 = values3[(i2 + n2 - 1) % n2], v12 = values3[i2 % n2], v23 = values3[(i2 + 1) % n2], v3 = values3[(i2 + 2) % n2]; + return basis((t4 - i2 / n2) * n2, v0, v12, v23, v3); + }; + } + var init_basisClosed = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/basisClosed.js"() { + "use strict"; + init_basis(); + __name(basisClosed_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js + var constant_default2; + var init_constant2 = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/constant.js"() { + "use strict"; + constant_default2 = /* @__PURE__ */ __name((x5) => () => x5, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js + function linear(a2, d3) { + return function(t4) { + return a2 + t4 * d3; + }; + } + function exponential(a2, b3, y6) { + return a2 = Math.pow(a2, y6), b3 = Math.pow(b3, y6) - a2, y6 = 1 / y6, function(t4) { + return Math.pow(a2 + t4 * b3, y6); + }; + } + function hue(a2, b3) { + var d3 = b3 - a2; + return d3 ? linear(a2, d3 > 180 || d3 < -180 ? d3 - 360 * Math.round(d3 / 360) : d3) : constant_default2(isNaN(a2) ? b3 : a2); + } + function gamma(y6) { + return (y6 = +y6) === 1 ? nogamma : function(a2, b3) { + return b3 - a2 ? exponential(a2, b3, y6) : constant_default2(isNaN(a2) ? b3 : a2); + }; + } + function nogamma(a2, b3) { + var d3 = b3 - a2; + return d3 ? linear(a2, d3) : constant_default2(isNaN(a2) ? b3 : a2); + } + var init_color3 = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/color.js"() { + "use strict"; + init_constant2(); + __name(linear, "linear"); + __name(exponential, "exponential"); + __name(hue, "hue"); + __name(gamma, "gamma"); + __name(nogamma, "nogamma"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js + function rgbSpline(spline) { + return function(colors2) { + var n2 = colors2.length, r2 = new Array(n2), g2 = new Array(n2), b3 = new Array(n2), i2, color2; + for (i2 = 0; i2 < n2; ++i2) { + color2 = rgb(colors2[i2]); + r2[i2] = color2.r || 0; + g2[i2] = color2.g || 0; + b3[i2] = color2.b || 0; + } + r2 = spline(r2); + g2 = spline(g2); + b3 = spline(b3); + color2.opacity = 1; + return function(t4) { + color2.r = r2(t4); + color2.g = g2(t4); + color2.b = b3(t4); + return color2 + ""; + }; + }; + } + var rgb_default2, rgbBasis, rgbBasisClosed; + var init_rgb2 = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/rgb.js"() { + "use strict"; + init_src7(); + init_basis(); + init_basisClosed(); + init_color3(); + rgb_default2 = (/* @__PURE__ */ __name((function rgbGamma(y6) { + var color2 = gamma(y6); + function rgb2(start3, end2) { + var r2 = color2((start3 = rgb(start3)).r, (end2 = rgb(end2)).r), g2 = color2(start3.g, end2.g), b3 = color2(start3.b, end2.b), opacity = nogamma(start3.opacity, end2.opacity); + return function(t4) { + start3.r = r2(t4); + start3.g = g2(t4); + start3.b = b3(t4); + start3.opacity = opacity(t4); + return start3 + ""; + }; + } + __name(rgb2, "rgb"); + rgb2.gamma = rgbGamma; + return rgb2; + }), "rgbGamma"))(1); + __name(rgbSpline, "rgbSpline"); + rgbBasis = rgbSpline(basis_default); + rgbBasisClosed = rgbSpline(basisClosed_default); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/numberArray.js + function numberArray_default(a2, b3) { + if (!b3) b3 = []; + var n2 = a2 ? Math.min(b3.length, a2.length) : 0, c3 = b3.slice(), i2; + return function(t4) { + for (i2 = 0; i2 < n2; ++i2) c3[i2] = a2[i2] * (1 - t4) + b3[i2] * t4; + return c3; + }; + } + function isNumberArray(x5) { + return ArrayBuffer.isView(x5) && !(x5 instanceof DataView); + } + var init_numberArray = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/numberArray.js"() { + "use strict"; + __name(numberArray_default, "default"); + __name(isNumberArray, "isNumberArray"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/array.js + function genericArray(a2, b3) { + var nb = b3 ? b3.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x5 = new Array(na), c3 = new Array(nb), i2; + for (i2 = 0; i2 < na; ++i2) x5[i2] = value_default(a2[i2], b3[i2]); + for (; i2 < nb; ++i2) c3[i2] = b3[i2]; + return function(t4) { + for (i2 = 0; i2 < na; ++i2) c3[i2] = x5[i2](t4); + return c3; + }; + } + var init_array2 = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/array.js"() { + "use strict"; + init_value(); + __name(genericArray, "genericArray"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/date.js + function date_default(a2, b3) { + var d3 = /* @__PURE__ */ new Date(); + return a2 = +a2, b3 = +b3, function(t4) { + return d3.setTime(a2 * (1 - t4) + b3 * t4), d3; + }; + } + var init_date = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/date.js"() { + "use strict"; + __name(date_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js + function number_default(a2, b3) { + return a2 = +a2, b3 = +b3, function(t4) { + return a2 * (1 - t4) + b3 * t4; + }; + } + var init_number2 = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/number.js"() { + "use strict"; + __name(number_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/object.js + function object_default(a2, b3) { + var i2 = {}, c3 = {}, k2; + if (a2 === null || typeof a2 !== "object") a2 = {}; + if (b3 === null || typeof b3 !== "object") b3 = {}; + for (k2 in b3) { + if (k2 in a2) { + i2[k2] = value_default(a2[k2], b3[k2]); + } else { + c3[k2] = b3[k2]; + } + } + return function(t4) { + for (k2 in i2) c3[k2] = i2[k2](t4); + return c3; + }; + } + var init_object = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/object.js"() { + "use strict"; + init_value(); + __name(object_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js + function zero2(b3) { + return function() { + return b3; + }; + } + function one(b3) { + return function(t4) { + return b3(t4) + ""; + }; + } + function string_default(a2, b3) { + var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i2 = -1, s2 = [], q3 = []; + a2 = a2 + "", b3 = b3 + ""; + while ((am = reA.exec(a2)) && (bm = reB.exec(b3))) { + if ((bs = bm.index) > bi) { + bs = b3.slice(bi, bs); + if (s2[i2]) s2[i2] += bs; + else s2[++i2] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { + if (s2[i2]) s2[i2] += bm; + else s2[++i2] = bm; + } else { + s2[++i2] = null; + q3.push({ i: i2, x: number_default(am, bm) }); + } + bi = reB.lastIndex; + } + if (bi < b3.length) { + bs = b3.slice(bi); + if (s2[i2]) s2[i2] += bs; + else s2[++i2] = bs; + } + return s2.length < 2 ? q3[0] ? one(q3[0].x) : zero2(b3) : (b3 = q3.length, function(t4) { + for (var i3 = 0, o2; i3 < b3; ++i3) s2[(o2 = q3[i3]).i] = o2.x(t4); + return s2.join(""); + }); + } + var reA, reB; + var init_string = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/string.js"() { + "use strict"; + init_number2(); + reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; + reB = new RegExp(reA.source, "g"); + __name(zero2, "zero"); + __name(one, "one"); + __name(string_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/value.js + function value_default(a2, b3) { + var t4 = typeof b3, c3; + return b3 == null || t4 === "boolean" ? constant_default2(b3) : (t4 === "number" ? number_default : t4 === "string" ? (c3 = color(b3)) ? (b3 = c3, rgb_default2) : string_default : b3 instanceof color ? rgb_default2 : b3 instanceof Date ? date_default : isNumberArray(b3) ? numberArray_default : Array.isArray(b3) ? genericArray : typeof b3.valueOf !== "function" && typeof b3.toString !== "function" || isNaN(b3) ? object_default : number_default)(a2, b3); + } + var init_value = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/value.js"() { + "use strict"; + init_src7(); + init_rgb2(); + init_array2(); + init_date(); + init_number2(); + init_object(); + init_string(); + init_constant2(); + init_numberArray(); + __name(value_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/round.js + function round_default(a2, b3) { + return a2 = +a2, b3 = +b3, function(t4) { + return Math.round(a2 * (1 - t4) + b3 * t4); + }; + } + var init_round = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/round.js"() { + "use strict"; + __name(round_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js + function decompose_default(a2, b3, c3, d3, e3, f2) { + var scaleX, scaleY, skewX; + if (scaleX = Math.sqrt(a2 * a2 + b3 * b3)) a2 /= scaleX, b3 /= scaleX; + if (skewX = a2 * c3 + b3 * d3) c3 -= a2 * skewX, d3 -= b3 * skewX; + if (scaleY = Math.sqrt(c3 * c3 + d3 * d3)) c3 /= scaleY, d3 /= scaleY, skewX /= scaleY; + if (a2 * d3 < b3 * c3) a2 = -a2, b3 = -b3, skewX = -skewX, scaleX = -scaleX; + return { + translateX: e3, + translateY: f2, + rotate: Math.atan2(b3, a2) * degrees2, + skewX: Math.atan(skewX) * degrees2, + scaleX, + scaleY + }; + } + var degrees2, identity; + var init_decompose = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/decompose.js"() { + "use strict"; + degrees2 = 180 / Math.PI; + identity = { + translateX: 0, + translateY: 0, + rotate: 0, + skewX: 0, + scaleX: 1, + scaleY: 1 + }; + __name(decompose_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js + function parseCss(value2) { + const m3 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value2 + ""); + return m3.isIdentity ? identity : decompose_default(m3.a, m3.b, m3.c, m3.d, m3.e, m3.f); + } + function parseSvg(value2) { + if (value2 == null) return identity; + if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); + svgNode.setAttribute("transform", value2); + if (!(value2 = svgNode.transform.baseVal.consolidate())) return identity; + value2 = value2.matrix; + return decompose_default(value2.a, value2.b, value2.c, value2.d, value2.e, value2.f); + } + var svgNode; + var init_parse = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/parse.js"() { + "use strict"; + init_decompose(); + __name(parseCss, "parseCss"); + __name(parseSvg, "parseSvg"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js + function interpolateTransform(parse7, pxComma, pxParen, degParen) { + function pop(s2) { + return s2.length ? s2.pop() + " " : ""; + } + __name(pop, "pop"); + function translate2(xa, ya, xb, yb, s2, q3) { + if (xa !== xb || ya !== yb) { + var i2 = s2.push("translate(", null, pxComma, null, pxParen); + q3.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) }); + } else if (xb || yb) { + s2.push("translate(" + xb + pxComma + yb + pxParen); + } + } + __name(translate2, "translate"); + function rotate2(a2, b3, s2, q3) { + if (a2 !== b3) { + if (a2 - b3 > 180) b3 += 360; + else if (b3 - a2 > 180) a2 += 360; + q3.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a2, b3) }); + } else if (b3) { + s2.push(pop(s2) + "rotate(" + b3 + degParen); + } + } + __name(rotate2, "rotate"); + function skewX(a2, b3, s2, q3) { + if (a2 !== b3) { + q3.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a2, b3) }); + } else if (b3) { + s2.push(pop(s2) + "skewX(" + b3 + degParen); + } + } + __name(skewX, "skewX"); + function scale3(xa, ya, xb, yb, s2, q3) { + if (xa !== xb || ya !== yb) { + var i2 = s2.push(pop(s2) + "scale(", null, ",", null, ")"); + q3.push({ i: i2 - 4, x: number_default(xa, xb) }, { i: i2 - 2, x: number_default(ya, yb) }); + } else if (xb !== 1 || yb !== 1) { + s2.push(pop(s2) + "scale(" + xb + "," + yb + ")"); + } + } + __name(scale3, "scale"); + return function(a2, b3) { + var s2 = [], q3 = []; + a2 = parse7(a2), b3 = parse7(b3); + translate2(a2.translateX, a2.translateY, b3.translateX, b3.translateY, s2, q3); + rotate2(a2.rotate, b3.rotate, s2, q3); + skewX(a2.skewX, b3.skewX, s2, q3); + scale3(a2.scaleX, a2.scaleY, b3.scaleX, b3.scaleY, s2, q3); + a2 = b3 = null; + return function(t4) { + var i2 = -1, n2 = q3.length, o2; + while (++i2 < n2) s2[(o2 = q3[i2]).i] = o2.x(t4); + return s2.join(""); + }; + }; + } + var interpolateTransformCss, interpolateTransformSvg; + var init_transform = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/transform/index.js"() { + "use strict"; + init_number2(); + init_parse(); + __name(interpolateTransform, "interpolateTransform"); + interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); + interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/hcl.js + function hcl2(hue2) { + return function(start3, end2) { + var h3 = hue2((start3 = hcl(start3)).h, (end2 = hcl(end2)).h), c3 = nogamma(start3.c, end2.c), l4 = nogamma(start3.l, end2.l), opacity = nogamma(start3.opacity, end2.opacity); + return function(t4) { + start3.h = h3(t4); + start3.c = c3(t4); + start3.l = l4(t4); + start3.opacity = opacity(t4); + return start3 + ""; + }; + }; + } + var hcl_default, hclLong; + var init_hcl = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/hcl.js"() { + "use strict"; + init_src7(); + init_color3(); + __name(hcl2, "hcl"); + hcl_default = hcl2(hue); + hclLong = hcl2(nogamma); + } + }); + + // ../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/index.js + var init_src8 = __esm({ + "../../node_modules/.pnpm/d3-interpolate@3.0.1/node_modules/d3-interpolate/src/index.js"() { + "use strict"; + init_value(); + init_number2(); + init_round(); + init_string(); + init_transform(); + init_rgb2(); + init_hcl(); + } + }); + + // ../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js + function now() { + return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); + } + function clearNow() { + clockNow = 0; + } + function Timer() { + this._call = this._time = this._next = null; + } + function timer(callback, delay2, time4) { + var t4 = new Timer(); + t4.restart(callback, delay2, time4); + return t4; + } + function timerFlush() { + now(); + ++frame; + var t4 = taskHead, e3; + while (t4) { + if ((e3 = clockNow - t4._time) >= 0) t4._call.call(void 0, e3); + t4 = t4._next; + } + --frame; + } + function wake() { + clockNow = (clockLast = clock.now()) + clockSkew; + frame = timeout = 0; + try { + timerFlush(); + } finally { + frame = 0; + nap(); + clockNow = 0; + } + } + function poke() { + var now3 = clock.now(), delay2 = now3 - clockLast; + if (delay2 > pokeDelay) clockSkew -= delay2, clockLast = now3; + } + function nap() { + var t03, t13 = taskHead, t22, time4 = Infinity; + while (t13) { + if (t13._call) { + if (time4 > t13._time) time4 = t13._time; + t03 = t13, t13 = t13._next; + } else { + t22 = t13._next, t13._next = null; + t13 = t03 ? t03._next = t22 : taskHead = t22; + } + } + taskTail = t03; + sleep(time4); + } + function sleep(time4) { + if (frame) return; + if (timeout) timeout = clearTimeout(timeout); + var delay2 = time4 - clockNow; + if (delay2 > 24) { + if (time4 < Infinity) timeout = setTimeout(wake, time4 - clock.now() - clockSkew); + if (interval) interval = clearInterval(interval); + } else { + if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); + frame = 1, setFrame(wake); + } + } + var frame, timeout, interval, pokeDelay, taskHead, taskTail, clockLast, clockNow, clockSkew, clock, setFrame; + var init_timer = __esm({ + "../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timer.js"() { + "use strict"; + frame = 0; + timeout = 0; + interval = 0; + pokeDelay = 1e3; + clockLast = 0; + clockNow = 0; + clockSkew = 0; + clock = typeof performance === "object" && performance.now ? performance : Date; + setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) { + setTimeout(f2, 17); + }; + __name(now, "now"); + __name(clearNow, "clearNow"); + __name(Timer, "Timer"); + Timer.prototype = timer.prototype = { + constructor: Timer, + restart: /* @__PURE__ */ __name(function(callback, delay2, time4) { + if (typeof callback !== "function") throw new TypeError("callback is not a function"); + time4 = (time4 == null ? now() : +time4) + (delay2 == null ? 0 : +delay2); + if (!this._next && taskTail !== this) { + if (taskTail) taskTail._next = this; + else taskHead = this; + taskTail = this; + } + this._call = callback; + this._time = time4; + sleep(); + }, "restart"), + stop: /* @__PURE__ */ __name(function() { + if (this._call) { + this._call = null; + this._time = Infinity; + sleep(); + } + }, "stop") + }; + __name(timer, "timer"); + __name(timerFlush, "timerFlush"); + __name(wake, "wake"); + __name(poke, "poke"); + __name(nap, "nap"); + __name(sleep, "sleep"); + } + }); + + // ../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js + function timeout_default(callback, delay2, time4) { + var t4 = new Timer(); + delay2 = delay2 == null ? 0 : +delay2; + t4.restart((elapsed) => { + t4.stop(); + callback(elapsed + delay2); + }, delay2, time4); + return t4; + } + var init_timeout = __esm({ + "../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/timeout.js"() { + "use strict"; + init_timer(); + __name(timeout_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js + var init_src9 = __esm({ + "../../node_modules/.pnpm/d3-timer@3.0.1/node_modules/d3-timer/src/index.js"() { + "use strict"; + init_timer(); + init_timeout(); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/schedule.js + function schedule_default(node2, name, id35, index, group2, timing) { + var schedules = node2.__transition; + if (!schedules) node2.__transition = {}; + else if (id35 in schedules) return; + create2(node2, id35, { + name, + index, + // For context during callback. + group: group2, + // For context during callback. + on: emptyOn, + tween: emptyTween, + time: timing.time, + delay: timing.delay, + duration: timing.duration, + ease: timing.ease, + timer: null, + state: CREATED + }); + } + function init(node2, id35) { + var schedule = get2(node2, id35); + if (schedule.state > CREATED) throw new Error("too late; already scheduled"); + return schedule; + } + function set2(node2, id35) { + var schedule = get2(node2, id35); + if (schedule.state > STARTED) throw new Error("too late; already running"); + return schedule; + } + function get2(node2, id35) { + var schedule = node2.__transition; + if (!schedule || !(schedule = schedule[id35])) throw new Error("transition not found"); + return schedule; + } + function create2(node2, id35, self2) { + var schedules = node2.__transition, tween; + schedules[id35] = self2; + self2.timer = timer(schedule, 0, self2.time); + function schedule(elapsed) { + self2.state = SCHEDULED; + self2.timer.restart(start3, self2.delay, self2.time); + if (self2.delay <= elapsed) start3(elapsed - self2.delay); + } + __name(schedule, "schedule"); + function start3(elapsed) { + var i2, j3, n2, o2; + if (self2.state !== SCHEDULED) return stop5(); + for (i2 in schedules) { + o2 = schedules[i2]; + if (o2.name !== self2.name) continue; + if (o2.state === STARTED) return timeout_default(start3); + if (o2.state === RUNNING) { + o2.state = ENDED; + o2.timer.stop(); + o2.on.call("interrupt", node2, node2.__data__, o2.index, o2.group); + delete schedules[i2]; + } else if (+i2 < id35) { + o2.state = ENDED; + o2.timer.stop(); + o2.on.call("cancel", node2, node2.__data__, o2.index, o2.group); + delete schedules[i2]; + } + } + timeout_default(function() { + if (self2.state === STARTED) { + self2.state = RUNNING; + self2.timer.restart(tick, self2.delay, self2.time); + tick(elapsed); + } + }); + self2.state = STARTING; + self2.on.call("start", node2, node2.__data__, self2.index, self2.group); + if (self2.state !== STARTING) return; + self2.state = STARTED; + tween = new Array(n2 = self2.tween.length); + for (i2 = 0, j3 = -1; i2 < n2; ++i2) { + if (o2 = self2.tween[i2].value.call(node2, node2.__data__, self2.index, self2.group)) { + tween[++j3] = o2; + } + } + tween.length = j3 + 1; + } + __name(start3, "start"); + function tick(elapsed) { + var t4 = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop5), self2.state = ENDING, 1), i2 = -1, n2 = tween.length; + while (++i2 < n2) { + tween[i2].call(node2, t4); + } + if (self2.state === ENDING) { + self2.on.call("end", node2, node2.__data__, self2.index, self2.group); + stop5(); + } + } + __name(tick, "tick"); + function stop5() { + self2.state = ENDED; + self2.timer.stop(); + delete schedules[id35]; + for (var i2 in schedules) return; + delete node2.__transition; + } + __name(stop5, "stop"); + } + var emptyOn, emptyTween, CREATED, SCHEDULED, STARTING, STARTED, RUNNING, ENDING, ENDED; + var init_schedule = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/schedule.js"() { + "use strict"; + init_src4(); + init_src9(); + emptyOn = dispatch_default("start", "end", "cancel", "interrupt"); + emptyTween = []; + CREATED = 0; + SCHEDULED = 1; + STARTING = 2; + STARTED = 3; + RUNNING = 4; + ENDING = 5; + ENDED = 6; + __name(schedule_default, "default"); + __name(init, "init"); + __name(set2, "set"); + __name(get2, "get"); + __name(create2, "create"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/interrupt.js + function interrupt_default(node2, name) { + var schedules = node2.__transition, schedule, active, empty3 = true, i2; + if (!schedules) return; + name = name == null ? null : name + ""; + for (i2 in schedules) { + if ((schedule = schedules[i2]).name !== name) { + empty3 = false; + continue; + } + active = schedule.state > STARTING && schedule.state < ENDING; + schedule.state = ENDED; + schedule.timer.stop(); + schedule.on.call(active ? "interrupt" : "cancel", node2, node2.__data__, schedule.index, schedule.group); + delete schedules[i2]; + } + if (empty3) delete node2.__transition; + } + var init_interrupt = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/interrupt.js"() { + "use strict"; + init_schedule(); + __name(interrupt_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/interrupt.js + function interrupt_default2(name) { + return this.each(function() { + interrupt_default(this, name); + }); + } + var init_interrupt2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/interrupt.js"() { + "use strict"; + init_interrupt(); + __name(interrupt_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/tween.js + function tweenRemove(id35, name) { + var tween0, tween1; + return function() { + var schedule = set2(this, id35), tween = schedule.tween; + if (tween !== tween0) { + tween1 = tween0 = tween; + for (var i2 = 0, n2 = tween1.length; i2 < n2; ++i2) { + if (tween1[i2].name === name) { + tween1 = tween1.slice(); + tween1.splice(i2, 1); + break; + } + } + } + schedule.tween = tween1; + }; + } + function tweenFunction(id35, name, value2) { + var tween0, tween1; + if (typeof value2 !== "function") throw new Error(); + return function() { + var schedule = set2(this, id35), tween = schedule.tween; + if (tween !== tween0) { + tween1 = (tween0 = tween).slice(); + for (var t4 = { name, value: value2 }, i2 = 0, n2 = tween1.length; i2 < n2; ++i2) { + if (tween1[i2].name === name) { + tween1[i2] = t4; + break; + } + } + if (i2 === n2) tween1.push(t4); + } + schedule.tween = tween1; + }; + } + function tween_default(name, value2) { + var id35 = this._id; + name += ""; + if (arguments.length < 2) { + var tween = get2(this.node(), id35).tween; + for (var i2 = 0, n2 = tween.length, t4; i2 < n2; ++i2) { + if ((t4 = tween[i2]).name === name) { + return t4.value; + } + } + return null; + } + return this.each((value2 == null ? tweenRemove : tweenFunction)(id35, name, value2)); + } + function tweenValue(transition2, name, value2) { + var id35 = transition2._id; + transition2.each(function() { + var schedule = set2(this, id35); + (schedule.value || (schedule.value = {}))[name] = value2.apply(this, arguments); + }); + return function(node2) { + return get2(node2, id35).value[name]; + }; + } + var init_tween = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/tween.js"() { + "use strict"; + init_schedule(); + __name(tweenRemove, "tweenRemove"); + __name(tweenFunction, "tweenFunction"); + __name(tween_default, "default"); + __name(tweenValue, "tweenValue"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/interpolate.js + function interpolate_default(a2, b3) { + var c3; + return (typeof b3 === "number" ? number_default : b3 instanceof color ? rgb_default2 : (c3 = color(b3)) ? (b3 = c3, rgb_default2) : string_default)(a2, b3); + } + var init_interpolate = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/interpolate.js"() { + "use strict"; + init_src7(); + init_src8(); + __name(interpolate_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attr.js + function attrRemove2(name) { + return function() { + this.removeAttribute(name); + }; + } + function attrRemoveNS2(fullname) { + return function() { + this.removeAttributeNS(fullname.space, fullname.local); + }; + } + function attrConstant2(name, interpolate, value1) { + var string00, string1 = value1 + "", interpolate0; + return function() { + var string0 = this.getAttribute(name); + return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1); + }; + } + function attrConstantNS2(fullname, interpolate, value1) { + var string00, string1 = value1 + "", interpolate0; + return function() { + var string0 = this.getAttributeNS(fullname.space, fullname.local); + return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1); + }; + } + function attrFunction2(name, interpolate, value2) { + var string00, string10, interpolate0; + return function() { + var string0, value1 = value2(this), string1; + if (value1 == null) return void this.removeAttribute(name); + string0 = this.getAttribute(name); + string1 = value1 + ""; + return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1)); + }; + } + function attrFunctionNS2(fullname, interpolate, value2) { + var string00, string10, interpolate0; + return function() { + var string0, value1 = value2(this), string1; + if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local); + string0 = this.getAttributeNS(fullname.space, fullname.local); + string1 = value1 + ""; + return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1)); + }; + } + function attr_default2(name, value2) { + var fullname = namespace_default(name), i2 = fullname === "transform" ? interpolateTransformSvg : interpolate_default; + return this.attrTween(name, typeof value2 === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i2, tweenValue(this, "attr." + name, value2)) : value2 == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i2, value2)); + } + var init_attr2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attr.js"() { + "use strict"; + init_src8(); + init_src5(); + init_tween(); + init_interpolate(); + __name(attrRemove2, "attrRemove"); + __name(attrRemoveNS2, "attrRemoveNS"); + __name(attrConstant2, "attrConstant"); + __name(attrConstantNS2, "attrConstantNS"); + __name(attrFunction2, "attrFunction"); + __name(attrFunctionNS2, "attrFunctionNS"); + __name(attr_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attrTween.js + function attrInterpolate(name, i2) { + return function(t4) { + this.setAttribute(name, i2.call(this, t4)); + }; + } + function attrInterpolateNS(fullname, i2) { + return function(t4) { + this.setAttributeNS(fullname.space, fullname.local, i2.call(this, t4)); + }; + } + function attrTweenNS(fullname, value2) { + var t03, i0; + function tween() { + var i2 = value2.apply(this, arguments); + if (i2 !== i0) t03 = (i0 = i2) && attrInterpolateNS(fullname, i2); + return t03; + } + __name(tween, "tween"); + tween._value = value2; + return tween; + } + function attrTween(name, value2) { + var t03, i0; + function tween() { + var i2 = value2.apply(this, arguments); + if (i2 !== i0) t03 = (i0 = i2) && attrInterpolate(name, i2); + return t03; + } + __name(tween, "tween"); + tween._value = value2; + return tween; + } + function attrTween_default(name, value2) { + var key = "attr." + name; + if (arguments.length < 2) return (key = this.tween(key)) && key._value; + if (value2 == null) return this.tween(key, null); + if (typeof value2 !== "function") throw new Error(); + var fullname = namespace_default(name); + return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value2)); + } + var init_attrTween = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/attrTween.js"() { + "use strict"; + init_src5(); + __name(attrInterpolate, "attrInterpolate"); + __name(attrInterpolateNS, "attrInterpolateNS"); + __name(attrTweenNS, "attrTweenNS"); + __name(attrTween, "attrTween"); + __name(attrTween_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/delay.js + function delayFunction(id35, value2) { + return function() { + init(this, id35).delay = +value2.apply(this, arguments); + }; + } + function delayConstant(id35, value2) { + return value2 = +value2, function() { + init(this, id35).delay = value2; + }; + } + function delay_default(value2) { + var id35 = this._id; + return arguments.length ? this.each((typeof value2 === "function" ? delayFunction : delayConstant)(id35, value2)) : get2(this.node(), id35).delay; + } + var init_delay = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/delay.js"() { + "use strict"; + init_schedule(); + __name(delayFunction, "delayFunction"); + __name(delayConstant, "delayConstant"); + __name(delay_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/duration.js + function durationFunction(id35, value2) { + return function() { + set2(this, id35).duration = +value2.apply(this, arguments); + }; + } + function durationConstant(id35, value2) { + return value2 = +value2, function() { + set2(this, id35).duration = value2; + }; + } + function duration_default(value2) { + var id35 = this._id; + return arguments.length ? this.each((typeof value2 === "function" ? durationFunction : durationConstant)(id35, value2)) : get2(this.node(), id35).duration; + } + var init_duration = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/duration.js"() { + "use strict"; + init_schedule(); + __name(durationFunction, "durationFunction"); + __name(durationConstant, "durationConstant"); + __name(duration_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/ease.js + function easeConstant(id35, value2) { + if (typeof value2 !== "function") throw new Error(); + return function() { + set2(this, id35).ease = value2; + }; + } + function ease_default(value2) { + var id35 = this._id; + return arguments.length ? this.each(easeConstant(id35, value2)) : get2(this.node(), id35).ease; + } + var init_ease = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/ease.js"() { + "use strict"; + init_schedule(); + __name(easeConstant, "easeConstant"); + __name(ease_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/easeVarying.js + function easeVarying(id35, value2) { + return function() { + var v3 = value2.apply(this, arguments); + if (typeof v3 !== "function") throw new Error(); + set2(this, id35).ease = v3; + }; + } + function easeVarying_default(value2) { + if (typeof value2 !== "function") throw new Error(); + return this.each(easeVarying(this._id, value2)); + } + var init_easeVarying = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/easeVarying.js"() { + "use strict"; + init_schedule(); + __name(easeVarying, "easeVarying"); + __name(easeVarying_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/filter.js + function filter_default2(match3) { + if (typeof match3 !== "function") match3 = matcher_default(match3); + for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) { + for (var group2 = groups[j3], n2 = group2.length, subgroup = subgroups[j3] = [], node2, i2 = 0; i2 < n2; ++i2) { + if ((node2 = group2[i2]) && match3.call(node2, node2.__data__, i2, group2)) { + subgroup.push(node2); + } + } + } + return new Transition(subgroups, this._parents, this._name, this._id); + } + var init_filter2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/filter.js"() { + "use strict"; + init_src5(); + init_transition2(); + __name(filter_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/merge.js + function merge_default2(transition2) { + if (transition2._id !== this._id) throw new Error(); + for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m3 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m3; ++j3) { + for (var group0 = groups0[j3], group1 = groups1[j3], n2 = group0.length, merge6 = merges[j3] = new Array(n2), node2, i2 = 0; i2 < n2; ++i2) { + if (node2 = group0[i2] || group1[i2]) { + merge6[i2] = node2; + } + } + } + for (; j3 < m0; ++j3) { + merges[j3] = groups0[j3]; + } + return new Transition(merges, this._parents, this._name, this._id); + } + var init_merge3 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/merge.js"() { + "use strict"; + init_transition2(); + __name(merge_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/on.js + function start(name) { + return (name + "").trim().split(/^|\s+/).every(function(t4) { + var i2 = t4.indexOf("."); + if (i2 >= 0) t4 = t4.slice(0, i2); + return !t4 || t4 === "start"; + }); + } + function onFunction(id35, name, listener) { + var on0, on1, sit = start(name) ? init : set2; + return function() { + var schedule = sit(this, id35), on3 = schedule.on; + if (on3 !== on0) (on1 = (on0 = on3).copy()).on(name, listener); + schedule.on = on1; + }; + } + function on_default2(name, listener) { + var id35 = this._id; + return arguments.length < 2 ? get2(this.node(), id35).on.on(name) : this.each(onFunction(id35, name, listener)); + } + var init_on2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/on.js"() { + "use strict"; + init_schedule(); + __name(start, "start"); + __name(onFunction, "onFunction"); + __name(on_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/remove.js + function removeFunction(id35) { + return function() { + var parent4 = this.parentNode; + for (var i2 in this.__transition) if (+i2 !== id35) return; + if (parent4) parent4.removeChild(this); + }; + } + function remove_default2() { + return this.on("end.remove", removeFunction(this._id)); + } + var init_remove2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/remove.js"() { + "use strict"; + __name(removeFunction, "removeFunction"); + __name(remove_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/select.js + function select_default3(select) { + var name = this._name, id35 = this._id; + if (typeof select !== "function") select = selector_default(select); + for (var groups = this._groups, m3 = groups.length, subgroups = new Array(m3), j3 = 0; j3 < m3; ++j3) { + for (var group2 = groups[j3], n2 = group2.length, subgroup = subgroups[j3] = new Array(n2), node2, subnode, i2 = 0; i2 < n2; ++i2) { + if ((node2 = group2[i2]) && (subnode = select.call(node2, node2.__data__, i2, group2))) { + if ("__data__" in node2) subnode.__data__ = node2.__data__; + subgroup[i2] = subnode; + schedule_default(subgroup[i2], name, id35, i2, subgroup, get2(node2, id35)); + } + } + } + return new Transition(subgroups, this._parents, name, id35); + } + var init_select3 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/select.js"() { + "use strict"; + init_src5(); + init_transition2(); + init_schedule(); + __name(select_default3, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selectAll.js + function selectAll_default2(select) { + var name = this._name, id35 = this._id; + if (typeof select !== "function") select = selectorAll_default(select); + for (var groups = this._groups, m3 = groups.length, subgroups = [], parents3 = [], j3 = 0; j3 < m3; ++j3) { + for (var group2 = groups[j3], n2 = group2.length, node2, i2 = 0; i2 < n2; ++i2) { + if (node2 = group2[i2]) { + for (var children2 = select.call(node2, node2.__data__, i2, group2), child, inherit2 = get2(node2, id35), k2 = 0, l4 = children2.length; k2 < l4; ++k2) { + if (child = children2[k2]) { + schedule_default(child, name, id35, k2, children2, inherit2); + } + } + subgroups.push(children2); + parents3.push(node2); + } + } + } + return new Transition(subgroups, parents3, name, id35); + } + var init_selectAll2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selectAll.js"() { + "use strict"; + init_src5(); + init_transition2(); + init_schedule(); + __name(selectAll_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selection.js + function selection_default2() { + return new Selection2(this._groups, this._parents); + } + var Selection2; + var init_selection2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/selection.js"() { + "use strict"; + init_src5(); + Selection2 = selection_default.prototype.constructor; + __name(selection_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/style.js + function styleNull(name, interpolate) { + var string00, string10, interpolate0; + return function() { + var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name)); + return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1); + }; + } + function styleRemove2(name) { + return function() { + this.style.removeProperty(name); + }; + } + function styleConstant2(name, interpolate, value1) { + var string00, string1 = value1 + "", interpolate0; + return function() { + var string0 = styleValue(this, name); + return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1); + }; + } + function styleFunction2(name, interpolate, value2) { + var string00, string10, interpolate0; + return function() { + var string0 = styleValue(this, name), value1 = value2(this), string1 = value1 + ""; + if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name)); + return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1)); + }; + } + function styleMaybeRemove(id35, name) { + var on0, on1, listener0, key = "style." + name, event3 = "end." + key, remove3; + return function() { + var schedule = set2(this, id35), on3 = schedule.on, listener = schedule.value[key] == null ? remove3 || (remove3 = styleRemove2(name)) : void 0; + if (on3 !== on0 || listener0 !== listener) (on1 = (on0 = on3).copy()).on(event3, listener0 = listener); + schedule.on = on1; + }; + } + function style_default2(name, value2, priority3) { + var i2 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default; + return value2 == null ? this.styleTween(name, styleNull(name, i2)).on("end.style." + name, styleRemove2(name)) : typeof value2 === "function" ? this.styleTween(name, styleFunction2(name, i2, tweenValue(this, "style." + name, value2))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i2, value2), priority3).on("end.style." + name, null); + } + var init_style2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/style.js"() { + "use strict"; + init_src8(); + init_src5(); + init_schedule(); + init_tween(); + init_interpolate(); + __name(styleNull, "styleNull"); + __name(styleRemove2, "styleRemove"); + __name(styleConstant2, "styleConstant"); + __name(styleFunction2, "styleFunction"); + __name(styleMaybeRemove, "styleMaybeRemove"); + __name(style_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/styleTween.js + function styleInterpolate(name, i2, priority3) { + return function(t4) { + this.style.setProperty(name, i2.call(this, t4), priority3); + }; + } + function styleTween(name, value2, priority3) { + var t4, i0; + function tween() { + var i2 = value2.apply(this, arguments); + if (i2 !== i0) t4 = (i0 = i2) && styleInterpolate(name, i2, priority3); + return t4; + } + __name(tween, "tween"); + tween._value = value2; + return tween; + } + function styleTween_default(name, value2, priority3) { + var key = "style." + (name += ""); + if (arguments.length < 2) return (key = this.tween(key)) && key._value; + if (value2 == null) return this.tween(key, null); + if (typeof value2 !== "function") throw new Error(); + return this.tween(key, styleTween(name, value2, priority3 == null ? "" : priority3)); + } + var init_styleTween = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/styleTween.js"() { + "use strict"; + __name(styleInterpolate, "styleInterpolate"); + __name(styleTween, "styleTween"); + __name(styleTween_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/text.js + function textConstant2(value2) { + return function() { + this.textContent = value2; + }; + } + function textFunction2(value2) { + return function() { + var value1 = value2(this); + this.textContent = value1 == null ? "" : value1; + }; + } + function text_default2(value2) { + return this.tween("text", typeof value2 === "function" ? textFunction2(tweenValue(this, "text", value2)) : textConstant2(value2 == null ? "" : value2 + "")); + } + var init_text2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/text.js"() { + "use strict"; + init_tween(); + __name(textConstant2, "textConstant"); + __name(textFunction2, "textFunction"); + __name(text_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/textTween.js + function textInterpolate(i2) { + return function(t4) { + this.textContent = i2.call(this, t4); + }; + } + function textTween(value2) { + var t03, i0; + function tween() { + var i2 = value2.apply(this, arguments); + if (i2 !== i0) t03 = (i0 = i2) && textInterpolate(i2); + return t03; + } + __name(tween, "tween"); + tween._value = value2; + return tween; + } + function textTween_default(value2) { + var key = "text"; + if (arguments.length < 1) return (key = this.tween(key)) && key._value; + if (value2 == null) return this.tween(key, null); + if (typeof value2 !== "function") throw new Error(); + return this.tween(key, textTween(value2)); + } + var init_textTween = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/textTween.js"() { + "use strict"; + __name(textInterpolate, "textInterpolate"); + __name(textTween, "textTween"); + __name(textTween_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/transition.js + function transition_default() { + var name = this._name, id0 = this._id, id1 = newId(); + for (var groups = this._groups, m3 = groups.length, j3 = 0; j3 < m3; ++j3) { + for (var group2 = groups[j3], n2 = group2.length, node2, i2 = 0; i2 < n2; ++i2) { + if (node2 = group2[i2]) { + var inherit2 = get2(node2, id0); + schedule_default(node2, name, id1, i2, group2, { + time: inherit2.time + inherit2.delay + inherit2.duration, + delay: 0, + duration: inherit2.duration, + ease: inherit2.ease + }); + } + } + } + return new Transition(groups, this._parents, name, id1); + } + var init_transition = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/transition.js"() { + "use strict"; + init_transition2(); + init_schedule(); + __name(transition_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/end.js + function end_default() { + var on0, on1, that = this, id35 = that._id, size4 = that.size(); + return new Promise(function(resolve2, reject3) { + var cancel = { value: reject3 }, end2 = { value: /* @__PURE__ */ __name(function() { + if (--size4 === 0) resolve2(); + }, "value") }; + that.each(function() { + var schedule = set2(this, id35), on3 = schedule.on; + if (on3 !== on0) { + on1 = (on0 = on3).copy(); + on1._.cancel.push(cancel); + on1._.interrupt.push(cancel); + on1._.end.push(end2); + } + schedule.on = on1; + }); + if (size4 === 0) resolve2(); + }); + } + var init_end = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/end.js"() { + "use strict"; + init_schedule(); + __name(end_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/index.js + function Transition(groups, parents3, name, id35) { + this._groups = groups; + this._parents = parents3; + this._name = name; + this._id = id35; + } + function transition(name) { + return selection_default().transition(name); + } + function newId() { + return ++id; + } + var id, selection_prototype; + var init_transition2 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/transition/index.js"() { + "use strict"; + init_src5(); + init_attr2(); + init_attrTween(); + init_delay(); + init_duration(); + init_ease(); + init_easeVarying(); + init_filter2(); + init_merge3(); + init_on2(); + init_remove2(); + init_select3(); + init_selectAll2(); + init_selection2(); + init_style2(); + init_styleTween(); + init_text2(); + init_textTween(); + init_transition(); + init_tween(); + init_end(); + id = 0; + __name(Transition, "Transition"); + __name(transition, "transition"); + __name(newId, "newId"); + selection_prototype = selection_default.prototype; + Transition.prototype = transition.prototype = { + constructor: Transition, + select: select_default3, + selectAll: selectAll_default2, + selectChild: selection_prototype.selectChild, + selectChildren: selection_prototype.selectChildren, + filter: filter_default2, + merge: merge_default2, + selection: selection_default2, + transition: transition_default, + call: selection_prototype.call, + nodes: selection_prototype.nodes, + node: selection_prototype.node, + size: selection_prototype.size, + empty: selection_prototype.empty, + each: selection_prototype.each, + on: on_default2, + attr: attr_default2, + attrTween: attrTween_default, + style: style_default2, + styleTween: styleTween_default, + text: text_default2, + textTween: textTween_default, + remove: remove_default2, + tween: tween_default, + delay: delay_default, + duration: duration_default, + ease: ease_default, + easeVarying: easeVarying_default, + end: end_default, + [Symbol.iterator]: selection_prototype[Symbol.iterator] + }; + } + }); + + // ../../node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/cubic.js + function cubicInOut(t4) { + return ((t4 *= 2) <= 1 ? t4 * t4 * t4 : (t4 -= 2) * t4 * t4 + 2) / 2; + } + var init_cubic = __esm({ + "../../node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/cubic.js"() { + "use strict"; + __name(cubicInOut, "cubicInOut"); + } + }); + + // ../../node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/index.js + var init_src10 = __esm({ + "../../node_modules/.pnpm/d3-ease@3.0.1/node_modules/d3-ease/src/index.js"() { + "use strict"; + init_cubic(); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/transition.js + function inherit(node2, id35) { + var timing; + while (!(timing = node2.__transition) || !(timing = timing[id35])) { + if (!(node2 = node2.parentNode)) { + throw new Error(`transition ${id35} not found`); + } + } + return timing; + } + function transition_default2(name) { + var id35, timing; + if (name instanceof Transition) { + id35 = name._id, name = name._name; + } else { + id35 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + ""; + } + for (var groups = this._groups, m3 = groups.length, j3 = 0; j3 < m3; ++j3) { + for (var group2 = groups[j3], n2 = group2.length, node2, i2 = 0; i2 < n2; ++i2) { + if (node2 = group2[i2]) { + schedule_default(node2, name, id35, i2, group2, timing || inherit(node2, id35)); + } + } + } + return new Transition(groups, this._parents, name, id35); + } + var defaultTiming; + var init_transition3 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/transition.js"() { + "use strict"; + init_transition2(); + init_schedule(); + init_src10(); + init_src9(); + defaultTiming = { + time: null, + // Set on use. + delay: 0, + duration: 250, + ease: cubicInOut + }; + __name(inherit, "inherit"); + __name(transition_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js + var init_selection3 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js"() { + "use strict"; + init_src5(); + init_interrupt2(); + init_transition3(); + selection_default.prototype.interrupt = interrupt_default2; + selection_default.prototype.transition = transition_default2; + } + }); + + // ../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/index.js + var init_src11 = __esm({ + "../../node_modules/.pnpm/d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/index.js"() { + "use strict"; + init_selection3(); + } + }); + + // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/constant.js + var init_constant3 = __esm({ + "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/constant.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/event.js + var init_event = __esm({ + "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/event.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/noevent.js + var init_noevent = __esm({ + "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/noevent.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/brush.js + function number1(e3) { + return [+e3[0], +e3[1]]; + } + function number22(e3) { + return [number1(e3[0]), number1(e3[1])]; + } + function type(t4) { + return { type: t4 }; + } + var abs, max2, min2, X, Y, XY; + var init_brush = __esm({ + "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/brush.js"() { + "use strict"; + init_src11(); + init_constant3(); + init_event(); + init_noevent(); + ({ abs, max: max2, min: min2 } = Math); + __name(number1, "number1"); + __name(number22, "number2"); + X = { + name: "x", + handles: ["w", "e"].map(type), + input: /* @__PURE__ */ __name(function(x5, e3) { + return x5 == null ? null : [[+x5[0], e3[0][1]], [+x5[1], e3[1][1]]]; + }, "input"), + output: /* @__PURE__ */ __name(function(xy) { + return xy && [xy[0][0], xy[1][0]]; + }, "output") + }; + Y = { + name: "y", + handles: ["n", "s"].map(type), + input: /* @__PURE__ */ __name(function(y6, e3) { + return y6 == null ? null : [[e3[0][0], +y6[0]], [e3[1][0], +y6[1]]]; + }, "input"), + output: /* @__PURE__ */ __name(function(xy) { + return xy && [xy[0][1], xy[1][1]]; + }, "output") + }; + XY = { + name: "xy", + handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type), + input: /* @__PURE__ */ __name(function(xy) { + return xy == null ? null : number22(xy); + }, "input"), + output: /* @__PURE__ */ __name(function(xy) { + return xy; + }, "output") + }; + __name(type, "type"); + } + }); + + // ../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/index.js + var init_src12 = __esm({ + "../../node_modules/.pnpm/d3-brush@3.0.0/node_modules/d3-brush/src/index.js"() { + "use strict"; + init_brush(); + } + }); + + // ../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js + function append(strings) { + this._ += strings[0]; + for (let i2 = 1, n2 = strings.length; i2 < n2; ++i2) { + this._ += arguments[i2] + strings[i2]; + } + } + function appendRound(digits) { + let d3 = Math.floor(digits); + if (!(d3 >= 0)) throw new Error(`invalid digits: ${digits}`); + if (d3 > 15) return append; + const k2 = 10 ** d3; + return function(strings) { + this._ += strings[0]; + for (let i2 = 1, n2 = strings.length; i2 < n2; ++i2) { + this._ += Math.round(arguments[i2] * k2) / k2 + strings[i2]; + } + }; + } + function path2() { + return new Path(); + } + var pi, tau, epsilon2, tauEpsilon, Path; + var init_path = __esm({ + "../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js"() { + "use strict"; + pi = Math.PI; + tau = 2 * pi; + epsilon2 = 1e-6; + tauEpsilon = tau - epsilon2; + __name(append, "append"); + __name(appendRound, "appendRound"); + Path = class { + static { + __name(this, "Path"); + } + constructor(digits) { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; + this._append = digits == null ? append : appendRound(digits); + } + moveTo(x5, y6) { + this._append`M${this._x0 = this._x1 = +x5},${this._y0 = this._y1 = +y6}`; + } + closePath() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._append`Z`; + } + } + lineTo(x5, y6) { + this._append`L${this._x1 = +x5},${this._y1 = +y6}`; + } + quadraticCurveTo(x1, y1, x5, y6) { + this._append`Q${+x1},${+y1},${this._x1 = +x5},${this._y1 = +y6}`; + } + bezierCurveTo(x1, y1, x22, y22, x5, y6) { + this._append`C${+x1},${+y1},${+x22},${+y22},${this._x1 = +x5},${this._y1 = +y6}`; + } + arcTo(x1, y1, x22, y22, r2) { + x1 = +x1, y1 = +y1, x22 = +x22, y22 = +y22, r2 = +r2; + if (r2 < 0) throw new Error(`negative radius: ${r2}`); + let x0 = this._x1, y0 = this._y1, x21 = x22 - x1, y21 = y22 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01; + if (this._x1 === null) { + this._append`M${this._x1 = x1},${this._y1 = y1}`; + } else if (!(l01_2 > epsilon2)) ; + else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon2) || !r2) { + this._append`L${this._x1 = x1},${this._y1 = y1}`; + } else { + let x20 = x22 - x0, y20 = y22 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l4 = r2 * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l4 / l01, t21 = l4 / l21; + if (Math.abs(t01 - 1) > epsilon2) { + this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`; + } + this._append`A${r2},${r2},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`; + } + } + arc(x5, y6, r2, a0, a1, ccw) { + x5 = +x5, y6 = +y6, r2 = +r2, ccw = !!ccw; + if (r2 < 0) throw new Error(`negative radius: ${r2}`); + let dx = r2 * Math.cos(a0), dy = r2 * Math.sin(a0), x0 = x5 + dx, y0 = y6 + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; + if (this._x1 === null) { + this._append`M${x0},${y0}`; + } else if (Math.abs(this._x1 - x0) > epsilon2 || Math.abs(this._y1 - y0) > epsilon2) { + this._append`L${x0},${y0}`; + } + if (!r2) return; + if (da < 0) da = da % tau + tau; + if (da > tauEpsilon) { + this._append`A${r2},${r2},0,1,${cw},${x5 - dx},${y6 - dy}A${r2},${r2},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`; + } else if (da > epsilon2) { + this._append`A${r2},${r2},0,${+(da >= pi)},${cw},${this._x1 = x5 + r2 * Math.cos(a1)},${this._y1 = y6 + r2 * Math.sin(a1)}`; + } + } + rect(x5, y6, w4, h3) { + this._append`M${this._x0 = this._x1 = +x5},${this._y0 = this._y1 = +y6}h${w4 = +w4}v${+h3}h${-w4}Z`; + } + toString() { + return this._; + } + }; + __name(path2, "path"); + path2.prototype = Path.prototype; + } + }); + + // ../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/index.js + var init_src13 = __esm({ + "../../node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/index.js"() { + "use strict"; + init_path(); + } + }); + + // ../../node_modules/.pnpm/d3-chord@3.0.1/node_modules/d3-chord/src/index.js + var init_src14 = __esm({ + "../../node_modules/.pnpm/d3-chord@3.0.1/node_modules/d3-chord/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-contour@4.0.2/node_modules/d3-contour/src/index.js + var init_src15 = __esm({ + "../../node_modules/.pnpm/d3-contour@4.0.2/node_modules/d3-contour/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-delaunay@6.0.4/node_modules/d3-delaunay/src/index.js + var init_src16 = __esm({ + "../../node_modules/.pnpm/d3-delaunay@6.0.4/node_modules/d3-delaunay/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-dsv@3.0.1/node_modules/d3-dsv/src/index.js + var init_src17 = __esm({ + "../../node_modules/.pnpm/d3-dsv@3.0.1/node_modules/d3-dsv/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-fetch@3.0.1/node_modules/d3-fetch/src/index.js + var init_src18 = __esm({ + "../../node_modules/.pnpm/d3-fetch@3.0.1/node_modules/d3-fetch/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/index.js + var init_src19 = __esm({ + "../../node_modules/.pnpm/d3-quadtree@3.0.1/node_modules/d3-quadtree/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-force@3.0.0/node_modules/d3-force/src/index.js + var init_src20 = __esm({ + "../../node_modules/.pnpm/d3-force@3.0.0/node_modules/d3-force/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatDecimal.js + function formatDecimal_default(x5) { + return Math.abs(x5 = Math.round(x5)) >= 1e21 ? x5.toLocaleString("en").replace(/,/g, "") : x5.toString(10); + } + function formatDecimalParts(x5, p3) { + if ((i2 = (x5 = p3 ? x5.toExponential(p3 - 1) : x5.toExponential()).indexOf("e")) < 0) return null; + var i2, coefficient = x5.slice(0, i2); + return [ + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x5.slice(i2 + 1) + ]; + } + var init_formatDecimal = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatDecimal.js"() { + "use strict"; + __name(formatDecimal_default, "default"); + __name(formatDecimalParts, "formatDecimalParts"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/exponent.js + function exponent_default(x5) { + return x5 = formatDecimalParts(Math.abs(x5)), x5 ? x5[1] : NaN; + } + var init_exponent = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/exponent.js"() { + "use strict"; + init_formatDecimal(); + __name(exponent_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatGroup.js + function formatGroup_default(grouping, thousands) { + return function(value2, width3) { + var i2 = value2.length, t4 = [], j3 = 0, g2 = grouping[0], length2 = 0; + while (i2 > 0 && g2 > 0) { + if (length2 + g2 + 1 > width3) g2 = Math.max(1, width3 - length2); + t4.push(value2.substring(i2 -= g2, i2 + g2)); + if ((length2 += g2 + 1) > width3) break; + g2 = grouping[j3 = (j3 + 1) % grouping.length]; + } + return t4.reverse().join(thousands); + }; + } + var init_formatGroup = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatGroup.js"() { + "use strict"; + __name(formatGroup_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatNumerals.js + function formatNumerals_default(numerals) { + return function(value2) { + return value2.replace(/[0-9]/g, function(i2) { + return numerals[+i2]; + }); + }; + } + var init_formatNumerals = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatNumerals.js"() { + "use strict"; + __name(formatNumerals_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatSpecifier.js + function formatSpecifier(specifier) { + if (!(match3 = re.exec(specifier))) throw new Error("invalid format: " + specifier); + var match3; + return new FormatSpecifier({ + fill: match3[1], + align: match3[2], + sign: match3[3], + symbol: match3[4], + zero: match3[5], + width: match3[6], + comma: match3[7], + precision: match3[8] && match3[8].slice(1), + trim: match3[9], + type: match3[10] + }); + } + function FormatSpecifier(specifier) { + this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; + this.align = specifier.align === void 0 ? ">" : specifier.align + ""; + this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; + this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; + this.zero = !!specifier.zero; + this.width = specifier.width === void 0 ? void 0 : +specifier.width; + this.comma = !!specifier.comma; + this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; + this.trim = !!specifier.trim; + this.type = specifier.type === void 0 ? "" : specifier.type + ""; + } + var re; + var init_formatSpecifier = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatSpecifier.js"() { + "use strict"; + re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; + __name(formatSpecifier, "formatSpecifier"); + formatSpecifier.prototype = FormatSpecifier.prototype; + __name(FormatSpecifier, "FormatSpecifier"); + FormatSpecifier.prototype.toString = function() { + return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; + }; + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTrim.js + function formatTrim_default(s2) { + out: for (var n2 = s2.length, i2 = 1, i0 = -1, i1; i2 < n2; ++i2) { + switch (s2[i2]) { + case ".": + i0 = i1 = i2; + break; + case "0": + if (i0 === 0) i0 = i2; + i1 = i2; + break; + default: + if (!+s2[i2]) break out; + if (i0 > 0) i0 = 0; + break; + } + } + return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2; + } + var init_formatTrim = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTrim.js"() { + "use strict"; + __name(formatTrim_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatPrefixAuto.js + function formatPrefixAuto_default(x5, p3) { + var d3 = formatDecimalParts(x5, p3); + if (!d3) return x5 + ""; + var coefficient = d3[0], exponent = d3[1], i2 = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n2 = coefficient.length; + return i2 === n2 ? coefficient : i2 > n2 ? coefficient + new Array(i2 - n2 + 1).join("0") : i2 > 0 ? coefficient.slice(0, i2) + "." + coefficient.slice(i2) : "0." + new Array(1 - i2).join("0") + formatDecimalParts(x5, Math.max(0, p3 + i2 - 1))[0]; + } + var prefixExponent; + var init_formatPrefixAuto = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatPrefixAuto.js"() { + "use strict"; + init_formatDecimal(); + __name(formatPrefixAuto_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatRounded.js + function formatRounded_default(x5, p3) { + var d3 = formatDecimalParts(x5, p3); + if (!d3) return x5 + ""; + var coefficient = d3[0], exponent = d3[1]; + return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); + } + var init_formatRounded = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatRounded.js"() { + "use strict"; + init_formatDecimal(); + __name(formatRounded_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTypes.js + var formatTypes_default; + var init_formatTypes = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/formatTypes.js"() { + "use strict"; + init_formatDecimal(); + init_formatPrefixAuto(); + init_formatRounded(); + formatTypes_default = { + "%": /* @__PURE__ */ __name((x5, p3) => (x5 * 100).toFixed(p3), "%"), + "b": /* @__PURE__ */ __name((x5) => Math.round(x5).toString(2), "b"), + "c": /* @__PURE__ */ __name((x5) => x5 + "", "c"), + "d": formatDecimal_default, + "e": /* @__PURE__ */ __name((x5, p3) => x5.toExponential(p3), "e"), + "f": /* @__PURE__ */ __name((x5, p3) => x5.toFixed(p3), "f"), + "g": /* @__PURE__ */ __name((x5, p3) => x5.toPrecision(p3), "g"), + "o": /* @__PURE__ */ __name((x5) => Math.round(x5).toString(8), "o"), + "p": /* @__PURE__ */ __name((x5, p3) => formatRounded_default(x5 * 100, p3), "p"), + "r": formatRounded_default, + "s": formatPrefixAuto_default, + "X": /* @__PURE__ */ __name((x5) => Math.round(x5).toString(16).toUpperCase(), "X"), + "x": /* @__PURE__ */ __name((x5) => Math.round(x5).toString(16), "x") + }; + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/identity.js + function identity_default2(x5) { + return x5; + } + var init_identity2 = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/identity.js"() { + "use strict"; + __name(identity_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/locale.js + function locale_default(locale3) { + var group2 = locale3.grouping === void 0 || locale3.thousands === void 0 ? identity_default2 : formatGroup_default(map.call(locale3.grouping, Number), locale3.thousands + ""), currencyPrefix = locale3.currency === void 0 ? "" : locale3.currency[0] + "", currencySuffix = locale3.currency === void 0 ? "" : locale3.currency[1] + "", decimal = locale3.decimal === void 0 ? "." : locale3.decimal + "", numerals = locale3.numerals === void 0 ? identity_default2 : formatNumerals_default(map.call(locale3.numerals, String)), percent = locale3.percent === void 0 ? "%" : locale3.percent + "", minus = locale3.minus === void 0 ? "\u2212" : locale3.minus + "", nan = locale3.nan === void 0 ? "NaN" : locale3.nan + ""; + function newFormat(specifier) { + specifier = formatSpecifier(specifier); + var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width3 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim2 = specifier.trim, type3 = specifier.type; + if (type3 === "n") comma = true, type3 = "g"; + else if (!formatTypes_default[type3]) precision === void 0 && (precision = 12), trim2 = true, type3 = "g"; + if (zero3 || fill === "0" && align === "=") zero3 = true, fill = "0", align = "="; + var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type3) ? "0" + type3.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type3) ? percent : ""; + var formatType = formatTypes_default[type3], maybeSuffix = /[defgprs%]/.test(type3); + precision = precision === void 0 ? 6 : /[gprs]/.test(type3) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); + function format3(value2) { + var valuePrefix = prefix, valueSuffix = suffix, i2, n2, c3; + if (type3 === "c") { + valueSuffix = formatType(value2) + valueSuffix; + value2 = ""; + } else { + value2 = +value2; + var valueNegative = value2 < 0 || 1 / value2 < 0; + value2 = isNaN(value2) ? nan : formatType(Math.abs(value2), precision); + if (trim2) value2 = formatTrim_default(value2); + if (valueNegative && +value2 === 0 && sign2 !== "+") valueNegative = false; + valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix; + valueSuffix = (type3 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : ""); + if (maybeSuffix) { + i2 = -1, n2 = value2.length; + while (++i2 < n2) { + if (c3 = value2.charCodeAt(i2), 48 > c3 || c3 > 57) { + valueSuffix = (c3 === 46 ? decimal + value2.slice(i2 + 1) : value2.slice(i2)) + valueSuffix; + value2 = value2.slice(0, i2); + break; + } + } + } + } + if (comma && !zero3) value2 = group2(value2, Infinity); + var length2 = valuePrefix.length + value2.length + valueSuffix.length, padding2 = length2 < width3 ? new Array(width3 - length2 + 1).join(fill) : ""; + if (comma && zero3) value2 = group2(padding2 + value2, padding2.length ? width3 - valueSuffix.length : Infinity), padding2 = ""; + switch (align) { + case "<": + value2 = valuePrefix + value2 + valueSuffix + padding2; + break; + case "=": + value2 = valuePrefix + padding2 + value2 + valueSuffix; + break; + case "^": + value2 = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value2 + valueSuffix + padding2.slice(length2); + break; + default: + value2 = padding2 + valuePrefix + value2 + valueSuffix; + break; + } + return numerals(value2); + } + __name(format3, "format"); + format3.toString = function() { + return specifier + ""; + }; + return format3; + } + __name(newFormat, "newFormat"); + function formatPrefix2(specifier, value2) { + var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value2) / 3))) * 3, k2 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3]; + return function(value3) { + return f2(k2 * value3) + prefix; + }; + } + __name(formatPrefix2, "formatPrefix"); + return { + format: newFormat, + formatPrefix: formatPrefix2 + }; + } + var map, prefixes; + var init_locale = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/locale.js"() { + "use strict"; + init_exponent(); + init_formatGroup(); + init_formatNumerals(); + init_formatSpecifier(); + init_formatTrim(); + init_formatTypes(); + init_formatPrefixAuto(); + init_identity2(); + map = Array.prototype.map; + prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; + __name(locale_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/defaultLocale.js + function defaultLocale(definition) { + locale = locale_default(definition); + format2 = locale.format; + formatPrefix = locale.formatPrefix; + return locale; + } + var locale, format2, formatPrefix; + var init_defaultLocale = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/defaultLocale.js"() { + "use strict"; + init_locale(); + defaultLocale({ + thousands: ",", + grouping: [3], + currency: ["$", ""] + }); + __name(defaultLocale, "defaultLocale"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionFixed.js + function precisionFixed_default(step3) { + return Math.max(0, -exponent_default(Math.abs(step3))); + } + var init_precisionFixed = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionFixed.js"() { + "use strict"; + init_exponent(); + __name(precisionFixed_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionPrefix.js + function precisionPrefix_default(step3, value2) { + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value2) / 3))) * 3 - exponent_default(Math.abs(step3))); + } + var init_precisionPrefix = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionPrefix.js"() { + "use strict"; + init_exponent(); + __name(precisionPrefix_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionRound.js + function precisionRound_default(step3, max10) { + step3 = Math.abs(step3), max10 = Math.abs(max10) - step3; + return Math.max(0, exponent_default(max10) - exponent_default(step3)) + 1; + } + var init_precisionRound = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/precisionRound.js"() { + "use strict"; + init_exponent(); + __name(precisionRound_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/index.js + var init_src21 = __esm({ + "../../node_modules/.pnpm/d3-format@3.1.0/node_modules/d3-format/src/index.js"() { + "use strict"; + init_defaultLocale(); + init_formatSpecifier(); + init_precisionFixed(); + init_precisionPrefix(); + init_precisionRound(); + } + }); + + // ../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/index.js + var init_src22 = __esm({ + "../../node_modules/.pnpm/d3-geo@3.1.1/node_modules/d3-geo/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/count.js + function count(node2) { + var sum2 = 0, children2 = node2.children, i2 = children2 && children2.length; + if (!i2) sum2 = 1; + else while (--i2 >= 0) sum2 += children2[i2].value; + node2.value = sum2; + } + function count_default() { + return this.eachAfter(count); + } + var init_count = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/count.js"() { + "use strict"; + __name(count, "count"); + __name(count_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/each.js + function each_default2(callback, that) { + let index = -1; + for (const node2 of this) { + callback.call(that, node2, ++index, this); + } + return this; + } + var init_each2 = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/each.js"() { + "use strict"; + __name(each_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js + function eachBefore_default(callback, that) { + var node2 = this, nodes5 = [node2], children2, i2, index = -1; + while (node2 = nodes5.pop()) { + callback.call(that, node2, ++index, this); + if (children2 = node2.children) { + for (i2 = children2.length - 1; i2 >= 0; --i2) { + nodes5.push(children2[i2]); + } + } + } + return this; + } + var init_eachBefore = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js"() { + "use strict"; + __name(eachBefore_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js + function eachAfter_default(callback, that) { + var node2 = this, nodes5 = [node2], next3 = [], children2, i2, n2, index = -1; + while (node2 = nodes5.pop()) { + next3.push(node2); + if (children2 = node2.children) { + for (i2 = 0, n2 = children2.length; i2 < n2; ++i2) { + nodes5.push(children2[i2]); + } + } + } + while (node2 = next3.pop()) { + callback.call(that, node2, ++index, this); + } + return this; + } + var init_eachAfter = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js"() { + "use strict"; + __name(eachAfter_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/find.js + function find_default(callback, that) { + let index = -1; + for (const node2 of this) { + if (callback.call(that, node2, ++index, this)) { + return node2; + } + } + } + var init_find = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/find.js"() { + "use strict"; + __name(find_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sum.js + function sum_default(value2) { + return this.eachAfter(function(node2) { + var sum2 = +value2(node2.data) || 0, children2 = node2.children, i2 = children2 && children2.length; + while (--i2 >= 0) sum2 += children2[i2].value; + node2.value = sum2; + }); + } + var init_sum = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sum.js"() { + "use strict"; + __name(sum_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sort.js + function sort_default2(compare) { + return this.eachBefore(function(node2) { + if (node2.children) { + node2.children.sort(compare); + } + }); + } + var init_sort2 = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sort.js"() { + "use strict"; + __name(sort_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/path.js + function path_default(end2) { + var start3 = this, ancestor = leastCommonAncestor(start3, end2), nodes5 = [start3]; + while (start3 !== ancestor) { + start3 = start3.parent; + nodes5.push(start3); + } + var k2 = nodes5.length; + while (end2 !== ancestor) { + nodes5.splice(k2, 0, end2); + end2 = end2.parent; + } + return nodes5; + } + function leastCommonAncestor(a2, b3) { + if (a2 === b3) return a2; + var aNodes = a2.ancestors(), bNodes = b3.ancestors(), c3 = null; + a2 = aNodes.pop(); + b3 = bNodes.pop(); + while (a2 === b3) { + c3 = a2; + a2 = aNodes.pop(); + b3 = bNodes.pop(); + } + return c3; + } + var init_path2 = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/path.js"() { + "use strict"; + __name(path_default, "default"); + __name(leastCommonAncestor, "leastCommonAncestor"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/ancestors.js + function ancestors_default() { + var node2 = this, nodes5 = [node2]; + while (node2 = node2.parent) { + nodes5.push(node2); + } + return nodes5; + } + var init_ancestors = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/ancestors.js"() { + "use strict"; + __name(ancestors_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/descendants.js + function descendants_default() { + return Array.from(this); + } + var init_descendants = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/descendants.js"() { + "use strict"; + __name(descendants_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/leaves.js + function leaves_default() { + var leaves = []; + this.eachBefore(function(node2) { + if (!node2.children) { + leaves.push(node2); + } + }); + return leaves; + } + var init_leaves = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/leaves.js"() { + "use strict"; + __name(leaves_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/links.js + function links_default() { + var root4 = this, links3 = []; + root4.each(function(node2) { + if (node2 !== root4) { + links3.push({ source: node2.parent, target: node2 }); + } + }); + return links3; + } + var init_links = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/links.js"() { + "use strict"; + __name(links_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/iterator.js + function* iterator_default2() { + var node2 = this, current, next3 = [node2], children2, i2, n2; + do { + current = next3.reverse(), next3 = []; + while (node2 = current.pop()) { + yield node2; + if (children2 = node2.children) { + for (i2 = 0, n2 = children2.length; i2 < n2; ++i2) { + next3.push(children2[i2]); + } + } + } + } while (next3.length); + } + var init_iterator2 = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/iterator.js"() { + "use strict"; + __name(iterator_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/index.js + function hierarchy(data5, children2) { + if (data5 instanceof Map) { + data5 = [void 0, data5]; + if (children2 === void 0) children2 = mapChildren; + } else if (children2 === void 0) { + children2 = objectChildren; + } + var root4 = new Node(data5), node2, nodes5 = [root4], child, childs, i2, n2; + while (node2 = nodes5.pop()) { + if ((childs = children2(node2.data)) && (n2 = (childs = Array.from(childs)).length)) { + node2.children = childs; + for (i2 = n2 - 1; i2 >= 0; --i2) { + nodes5.push(child = childs[i2] = new Node(childs[i2])); + child.parent = node2; + child.depth = node2.depth + 1; + } + } + } + return root4.eachBefore(computeHeight); + } + function node_copy() { + return hierarchy(this).eachBefore(copyData); + } + function objectChildren(d3) { + return d3.children; + } + function mapChildren(d3) { + return Array.isArray(d3) ? d3[1] : null; + } + function copyData(node2) { + if (node2.data.value !== void 0) node2.value = node2.data.value; + node2.data = node2.data.data; + } + function computeHeight(node2) { + var height2 = 0; + do + node2.height = height2; + while ((node2 = node2.parent) && node2.height < ++height2); + } + function Node(data5) { + this.data = data5; + this.depth = this.height = 0; + this.parent = null; + } + var init_hierarchy = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/index.js"() { + "use strict"; + init_count(); + init_each2(); + init_eachBefore(); + init_eachAfter(); + init_find(); + init_sum(); + init_sort2(); + init_path2(); + init_ancestors(); + init_descendants(); + init_leaves(); + init_links(); + init_iterator2(); + __name(hierarchy, "hierarchy"); + __name(node_copy, "node_copy"); + __name(objectChildren, "objectChildren"); + __name(mapChildren, "mapChildren"); + __name(copyData, "copyData"); + __name(computeHeight, "computeHeight"); + __name(Node, "Node"); + Node.prototype = hierarchy.prototype = { + constructor: Node, + count: count_default, + each: each_default2, + eachAfter: eachAfter_default, + eachBefore: eachBefore_default, + find: find_default, + sum: sum_default, + sort: sort_default2, + path: path_default, + ancestors: ancestors_default, + descendants: descendants_default, + leaves: leaves_default, + links: links_default, + copy: node_copy, + [Symbol.iterator]: iterator_default2 + }; + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/accessors.js + function required(f2) { + if (typeof f2 !== "function") throw new Error(); + return f2; + } + var init_accessors = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/accessors.js"() { + "use strict"; + __name(required, "required"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/constant.js + function constantZero() { + return 0; + } + function constant_default4(x5) { + return function() { + return x5; + }; + } + var init_constant4 = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/constant.js"() { + "use strict"; + __name(constantZero, "constantZero"); + __name(constant_default4, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/round.js + function round_default2(node2) { + node2.x0 = Math.round(node2.x0); + node2.y0 = Math.round(node2.y0); + node2.x1 = Math.round(node2.x1); + node2.y1 = Math.round(node2.y1); + } + var init_round2 = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/round.js"() { + "use strict"; + __name(round_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/dice.js + function dice_default(parent4, x0, y0, x1, y1) { + var nodes5 = parent4.children, node2, i2 = -1, n2 = nodes5.length, k2 = parent4.value && (x1 - x0) / parent4.value; + while (++i2 < n2) { + node2 = nodes5[i2], node2.y0 = y0, node2.y1 = y1; + node2.x0 = x0, node2.x1 = x0 += node2.value * k2; + } + } + var init_dice = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/dice.js"() { + "use strict"; + __name(dice_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/slice.js + function slice_default(parent4, x0, y0, x1, y1) { + var nodes5 = parent4.children, node2, i2 = -1, n2 = nodes5.length, k2 = parent4.value && (y1 - y0) / parent4.value; + while (++i2 < n2) { + node2 = nodes5[i2], node2.x0 = x0, node2.x1 = x1; + node2.y0 = y0, node2.y1 = y0 += node2.value * k2; + } + } + var init_slice = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/slice.js"() { + "use strict"; + __name(slice_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/squarify.js + function squarifyRatio(ratio, parent4, x0, y0, x1, y1) { + var rows = [], nodes5 = parent4.children, row, nodeValue, i0 = 0, i1 = 0, n2 = nodes5.length, dx, dy, value2 = parent4.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; + while (i0 < n2) { + dx = x1 - x0, dy = y1 - y0; + do + sumValue = nodes5[i1++].value; + while (!sumValue && i1 < n2); + minValue = maxValue = sumValue; + alpha = Math.max(dy / dx, dx / dy) / (value2 * ratio); + beta = sumValue * sumValue * alpha; + minRatio = Math.max(maxValue / beta, beta / minValue); + for (; i1 < n2; ++i1) { + sumValue += nodeValue = nodes5[i1].value; + if (nodeValue < minValue) minValue = nodeValue; + if (nodeValue > maxValue) maxValue = nodeValue; + beta = sumValue * sumValue * alpha; + newRatio = Math.max(maxValue / beta, beta / minValue); + if (newRatio > minRatio) { + sumValue -= nodeValue; + break; + } + minRatio = newRatio; + } + rows.push(row = { value: sumValue, dice: dx < dy, children: nodes5.slice(i0, i1) }); + if (row.dice) dice_default(row, x0, y0, x1, value2 ? y0 += dy * sumValue / value2 : y1); + else slice_default(row, x0, y0, value2 ? x0 += dx * sumValue / value2 : x1, y1); + value2 -= sumValue, i0 = i1; + } + return rows; + } + var phi, squarify_default; + var init_squarify = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/squarify.js"() { + "use strict"; + init_dice(); + init_slice(); + phi = (1 + Math.sqrt(5)) / 2; + __name(squarifyRatio, "squarifyRatio"); + squarify_default = (/* @__PURE__ */ __name((function custom(ratio) { + function squarify(parent4, x0, y0, x1, y1) { + squarifyRatio(ratio, parent4, x0, y0, x1, y1); + } + __name(squarify, "squarify"); + squarify.ratio = function(x5) { + return custom((x5 = +x5) > 1 ? x5 : 1); + }; + return squarify; + }), "custom"))(phi); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/index.js + function treemap_default() { + var tile = squarify_default, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero; + function treemap2(root4) { + root4.x0 = root4.y0 = 0; + root4.x1 = dx; + root4.y1 = dy; + root4.eachBefore(positionNode3); + paddingStack = [0]; + if (round) root4.eachBefore(round_default2); + return root4; + } + __name(treemap2, "treemap"); + function positionNode3(node2) { + var p3 = paddingStack[node2.depth], x0 = node2.x0 + p3, y0 = node2.y0 + p3, x1 = node2.x1 - p3, y1 = node2.y1 - p3; + if (x1 < x0) x0 = x1 = (x0 + x1) / 2; + if (y1 < y0) y0 = y1 = (y0 + y1) / 2; + node2.x0 = x0; + node2.y0 = y0; + node2.x1 = x1; + node2.y1 = y1; + if (node2.children) { + p3 = paddingStack[node2.depth + 1] = paddingInner(node2) / 2; + x0 += paddingLeft(node2) - p3; + y0 += paddingTop(node2) - p3; + x1 -= paddingRight(node2) - p3; + y1 -= paddingBottom(node2) - p3; + if (x1 < x0) x0 = x1 = (x0 + x1) / 2; + if (y1 < y0) y0 = y1 = (y0 + y1) / 2; + tile(node2, x0, y0, x1, y1); + } + } + __name(positionNode3, "positionNode"); + treemap2.round = function(x5) { + return arguments.length ? (round = !!x5, treemap2) : round; + }; + treemap2.size = function(x5) { + return arguments.length ? (dx = +x5[0], dy = +x5[1], treemap2) : [dx, dy]; + }; + treemap2.tile = function(x5) { + return arguments.length ? (tile = required(x5), treemap2) : tile; + }; + treemap2.padding = function(x5) { + return arguments.length ? treemap2.paddingInner(x5).paddingOuter(x5) : treemap2.paddingInner(); + }; + treemap2.paddingInner = function(x5) { + return arguments.length ? (paddingInner = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingInner; + }; + treemap2.paddingOuter = function(x5) { + return arguments.length ? treemap2.paddingTop(x5).paddingRight(x5).paddingBottom(x5).paddingLeft(x5) : treemap2.paddingTop(); + }; + treemap2.paddingTop = function(x5) { + return arguments.length ? (paddingTop = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingTop; + }; + treemap2.paddingRight = function(x5) { + return arguments.length ? (paddingRight = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingRight; + }; + treemap2.paddingBottom = function(x5) { + return arguments.length ? (paddingBottom = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingBottom; + }; + treemap2.paddingLeft = function(x5) { + return arguments.length ? (paddingLeft = typeof x5 === "function" ? x5 : constant_default4(+x5), treemap2) : paddingLeft; + }; + return treemap2; + } + var init_treemap = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/index.js"() { + "use strict"; + init_round2(); + init_squarify(); + init_accessors(); + init_constant4(); + __name(treemap_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/index.js + var init_src23 = __esm({ + "../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/index.js"() { + "use strict"; + init_hierarchy(); + init_treemap(); + } + }); + + // ../../node_modules/.pnpm/d3-polygon@3.0.1/node_modules/d3-polygon/src/index.js + var init_src24 = __esm({ + "../../node_modules/.pnpm/d3-polygon@3.0.1/node_modules/d3-polygon/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-random@3.0.1/node_modules/d3-random/src/index.js + var init_src25 = __esm({ + "../../node_modules/.pnpm/d3-random@3.0.1/node_modules/d3-random/src/index.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/init.js + function initRange(domain, range3) { + switch (arguments.length) { + case 0: + break; + case 1: + this.range(domain); + break; + default: + this.range(range3).domain(domain); + break; + } + return this; + } + var init_init = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/init.js"() { + "use strict"; + __name(initRange, "initRange"); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js + function ordinal() { + var index = new InternMap(), domain = [], range3 = [], unknown = implicit; + function scale3(d3) { + let i2 = index.get(d3); + if (i2 === void 0) { + if (unknown !== implicit) return unknown; + index.set(d3, i2 = domain.push(d3) - 1); + } + return range3[i2 % range3.length]; + } + __name(scale3, "scale"); + scale3.domain = function(_3) { + if (!arguments.length) return domain.slice(); + domain = [], index = new InternMap(); + for (const value2 of _3) { + if (index.has(value2)) continue; + index.set(value2, domain.push(value2) - 1); + } + return scale3; + }; + scale3.range = function(_3) { + return arguments.length ? (range3 = Array.from(_3), scale3) : range3.slice(); + }; + scale3.unknown = function(_3) { + return arguments.length ? (unknown = _3, scale3) : unknown; + }; + scale3.copy = function() { + return ordinal(domain, range3).unknown(unknown); + }; + initRange.apply(scale3, arguments); + return scale3; + } + var implicit; + var init_ordinal = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js"() { + "use strict"; + init_src2(); + init_init(); + implicit = Symbol("implicit"); + __name(ordinal, "ordinal"); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js + function band() { + var scale3 = ordinal().unknown(void 0), domain = scale3.domain, ordinalRange = scale3.range, r0 = 0, r1 = 1, step3, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; + delete scale3.unknown; + function rescale() { + var n2 = domain().length, reverse2 = r1 < r0, start3 = reverse2 ? r1 : r0, stop5 = reverse2 ? r0 : r1; + step3 = (stop5 - start3) / Math.max(1, n2 - paddingInner + paddingOuter * 2); + if (round) step3 = Math.floor(step3); + start3 += (stop5 - start3 - step3 * (n2 - paddingInner)) * align; + bandwidth = step3 * (1 - paddingInner); + if (round) start3 = Math.round(start3), bandwidth = Math.round(bandwidth); + var values3 = range(n2).map(function(i2) { + return start3 + step3 * i2; + }); + return ordinalRange(reverse2 ? values3.reverse() : values3); + } + __name(rescale, "rescale"); + scale3.domain = function(_3) { + return arguments.length ? (domain(_3), rescale()) : domain(); + }; + scale3.range = function(_3) { + return arguments.length ? ([r0, r1] = _3, r0 = +r0, r1 = +r1, rescale()) : [r0, r1]; + }; + scale3.rangeRound = function(_3) { + return [r0, r1] = _3, r0 = +r0, r1 = +r1, round = true, rescale(); + }; + scale3.bandwidth = function() { + return bandwidth; + }; + scale3.step = function() { + return step3; + }; + scale3.round = function(_3) { + return arguments.length ? (round = !!_3, rescale()) : round; + }; + scale3.padding = function(_3) { + return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_3), rescale()) : paddingInner; + }; + scale3.paddingInner = function(_3) { + return arguments.length ? (paddingInner = Math.min(1, _3), rescale()) : paddingInner; + }; + scale3.paddingOuter = function(_3) { + return arguments.length ? (paddingOuter = +_3, rescale()) : paddingOuter; + }; + scale3.align = function(_3) { + return arguments.length ? (align = Math.max(0, Math.min(1, _3)), rescale()) : align; + }; + scale3.copy = function() { + return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); + }; + return initRange.apply(rescale(), arguments); + } + var init_band = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/band.js"() { + "use strict"; + init_src2(); + init_init(); + init_ordinal(); + __name(band, "band"); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/constant.js + function constants(x5) { + return function() { + return x5; + }; + } + var init_constant5 = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/constant.js"() { + "use strict"; + __name(constants, "constants"); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/number.js + function number3(x5) { + return +x5; + } + var init_number3 = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/number.js"() { + "use strict"; + __name(number3, "number"); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/continuous.js + function identity2(x5) { + return x5; + } + function normalize(a2, b3) { + return (b3 -= a2 = +a2) ? function(x5) { + return (x5 - a2) / b3; + } : constants(isNaN(b3) ? NaN : 0.5); + } + function clamper(a2, b3) { + var t4; + if (a2 > b3) t4 = a2, a2 = b3, b3 = t4; + return function(x5) { + return Math.max(a2, Math.min(b3, x5)); + }; + } + function bimap(domain, range3, interpolate) { + var d0 = domain[0], d1 = domain[1], r0 = range3[0], r1 = range3[1]; + if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); + else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); + return function(x5) { + return r0(d0(x5)); + }; + } + function polymap(domain, range3, interpolate) { + var j3 = Math.min(domain.length, range3.length) - 1, d3 = new Array(j3), r2 = new Array(j3), i2 = -1; + if (domain[j3] < domain[0]) { + domain = domain.slice().reverse(); + range3 = range3.slice().reverse(); + } + while (++i2 < j3) { + d3[i2] = normalize(domain[i2], domain[i2 + 1]); + r2[i2] = interpolate(range3[i2], range3[i2 + 1]); + } + return function(x5) { + var i3 = bisect_default(domain, x5, 1, j3) - 1; + return r2[i3](d3[i3](x5)); + }; + } + function copy(source, target) { + return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown()); + } + function transformer() { + var domain = unit, range3 = unit, interpolate = value_default, transform8, untransform, unknown, clamp = identity2, piecewise, output2, input; + function rescale() { + var n2 = Math.min(domain.length, range3.length); + if (clamp !== identity2) clamp = clamper(domain[0], domain[n2 - 1]); + piecewise = n2 > 2 ? polymap : bimap; + output2 = input = null; + return scale3; + } + __name(rescale, "rescale"); + function scale3(x5) { + return x5 == null || isNaN(x5 = +x5) ? unknown : (output2 || (output2 = piecewise(domain.map(transform8), range3, interpolate)))(transform8(clamp(x5))); + } + __name(scale3, "scale"); + scale3.invert = function(y6) { + return clamp(untransform((input || (input = piecewise(range3, domain.map(transform8), number_default)))(y6))); + }; + scale3.domain = function(_3) { + return arguments.length ? (domain = Array.from(_3, number3), rescale()) : domain.slice(); + }; + scale3.range = function(_3) { + return arguments.length ? (range3 = Array.from(_3), rescale()) : range3.slice(); + }; + scale3.rangeRound = function(_3) { + return range3 = Array.from(_3), interpolate = round_default, rescale(); + }; + scale3.clamp = function(_3) { + return arguments.length ? (clamp = _3 ? true : identity2, rescale()) : clamp !== identity2; + }; + scale3.interpolate = function(_3) { + return arguments.length ? (interpolate = _3, rescale()) : interpolate; + }; + scale3.unknown = function(_3) { + return arguments.length ? (unknown = _3, scale3) : unknown; + }; + return function(t4, u2) { + transform8 = t4, untransform = u2; + return rescale(); + }; + } + function continuous() { + return transformer()(identity2, identity2); + } + var unit; + var init_continuous = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/continuous.js"() { + "use strict"; + init_src2(); + init_src8(); + init_constant5(); + init_number3(); + unit = [0, 1]; + __name(identity2, "identity"); + __name(normalize, "normalize"); + __name(clamper, "clamper"); + __name(bimap, "bimap"); + __name(polymap, "polymap"); + __name(copy, "copy"); + __name(transformer, "transformer"); + __name(continuous, "continuous"); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/tickFormat.js + function tickFormat(start3, stop5, count2, specifier) { + var step3 = tickStep(start3, stop5, count2), precision; + specifier = formatSpecifier(specifier == null ? ",f" : specifier); + switch (specifier.type) { + case "s": { + var value2 = Math.max(Math.abs(start3), Math.abs(stop5)); + if (specifier.precision == null && !isNaN(precision = precisionPrefix_default(step3, value2))) specifier.precision = precision; + return formatPrefix(specifier, value2); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (specifier.precision == null && !isNaN(precision = precisionRound_default(step3, Math.max(Math.abs(start3), Math.abs(stop5))))) specifier.precision = precision - (specifier.type === "e"); + break; + } + case "f": + case "%": { + if (specifier.precision == null && !isNaN(precision = precisionFixed_default(step3))) specifier.precision = precision - (specifier.type === "%") * 2; + break; + } + } + return format2(specifier); + } + var init_tickFormat = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/tickFormat.js"() { + "use strict"; + init_src2(); + init_src21(); + __name(tickFormat, "tickFormat"); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js + function linearish(scale3) { + var domain = scale3.domain; + scale3.ticks = function(count2) { + var d3 = domain(); + return ticks(d3[0], d3[d3.length - 1], count2 == null ? 10 : count2); + }; + scale3.tickFormat = function(count2, specifier) { + var d3 = domain(); + return tickFormat(d3[0], d3[d3.length - 1], count2 == null ? 10 : count2, specifier); + }; + scale3.nice = function(count2) { + if (count2 == null) count2 = 10; + var d3 = domain(); + var i0 = 0; + var i1 = d3.length - 1; + var start3 = d3[i0]; + var stop5 = d3[i1]; + var prestep; + var step3; + var maxIter = 10; + if (stop5 < start3) { + step3 = start3, start3 = stop5, stop5 = step3; + step3 = i0, i0 = i1, i1 = step3; + } + while (maxIter-- > 0) { + step3 = tickIncrement(start3, stop5, count2); + if (step3 === prestep) { + d3[i0] = start3; + d3[i1] = stop5; + return domain(d3); + } else if (step3 > 0) { + start3 = Math.floor(start3 / step3) * step3; + stop5 = Math.ceil(stop5 / step3) * step3; + } else if (step3 < 0) { + start3 = Math.ceil(start3 * step3) / step3; + stop5 = Math.floor(stop5 * step3) / step3; + } else { + break; + } + prestep = step3; + } + return scale3; + }; + return scale3; + } + function linear2() { + var scale3 = continuous(); + scale3.copy = function() { + return copy(scale3, linear2()); + }; + initRange.apply(scale3, arguments); + return linearish(scale3); + } + var init_linear = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/linear.js"() { + "use strict"; + init_src2(); + init_continuous(); + init_init(); + init_tickFormat(); + __name(linearish, "linearish"); + __name(linear2, "linear"); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/nice.js + function nice(domain, interval2) { + domain = domain.slice(); + var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t4; + if (x1 < x0) { + t4 = i0, i0 = i1, i1 = t4; + t4 = x0, x0 = x1, x1 = t4; + } + domain[i0] = interval2.floor(x0); + domain[i1] = interval2.ceil(x1); + return domain; + } + var init_nice = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/nice.js"() { + "use strict"; + __name(nice, "nice"); + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/interval.js + function timeInterval(floori, offseti, count2, field) { + function interval2(date2) { + return floori(date2 = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date2)), date2; + } + __name(interval2, "interval"); + interval2.floor = (date2) => { + return floori(date2 = /* @__PURE__ */ new Date(+date2)), date2; + }; + interval2.ceil = (date2) => { + return floori(date2 = new Date(date2 - 1)), offseti(date2, 1), floori(date2), date2; + }; + interval2.round = (date2) => { + const d0 = interval2(date2), d1 = interval2.ceil(date2); + return date2 - d0 < d1 - date2 ? d0 : d1; + }; + interval2.offset = (date2, step3) => { + return offseti(date2 = /* @__PURE__ */ new Date(+date2), step3 == null ? 1 : Math.floor(step3)), date2; + }; + interval2.range = (start3, stop5, step3) => { + const range3 = []; + start3 = interval2.ceil(start3); + step3 = step3 == null ? 1 : Math.floor(step3); + if (!(start3 < stop5) || !(step3 > 0)) return range3; + let previous; + do + range3.push(previous = /* @__PURE__ */ new Date(+start3)), offseti(start3, step3), floori(start3); + while (previous < start3 && start3 < stop5); + return range3; + }; + interval2.filter = (test) => { + return timeInterval((date2) => { + if (date2 >= date2) while (floori(date2), !test(date2)) date2.setTime(date2 - 1); + }, (date2, step3) => { + if (date2 >= date2) { + if (step3 < 0) while (++step3 <= 0) { + while (offseti(date2, -1), !test(date2)) { + } + } + else while (--step3 >= 0) { + while (offseti(date2, 1), !test(date2)) { + } + } + } + }); + }; + if (count2) { + interval2.count = (start3, end2) => { + t02.setTime(+start3), t12.setTime(+end2); + floori(t02), floori(t12); + return Math.floor(count2(t02, t12)); + }; + interval2.every = (step3) => { + step3 = Math.floor(step3); + return !isFinite(step3) || !(step3 > 0) ? null : !(step3 > 1) ? interval2 : interval2.filter(field ? (d3) => field(d3) % step3 === 0 : (d3) => interval2.count(0, d3) % step3 === 0); + }; + } + return interval2; + } + var t02, t12; + var init_interval = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/interval.js"() { + "use strict"; + t02 = /* @__PURE__ */ new Date(); + t12 = /* @__PURE__ */ new Date(); + __name(timeInterval, "timeInterval"); + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/millisecond.js + var millisecond, milliseconds; + var init_millisecond = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/millisecond.js"() { + "use strict"; + init_interval(); + millisecond = timeInterval(() => { + }, (date2, step3) => { + date2.setTime(+date2 + step3); + }, (start3, end2) => { + return end2 - start3; + }); + millisecond.every = (k2) => { + k2 = Math.floor(k2); + if (!isFinite(k2) || !(k2 > 0)) return null; + if (!(k2 > 1)) return millisecond; + return timeInterval((date2) => { + date2.setTime(Math.floor(date2 / k2) * k2); + }, (date2, step3) => { + date2.setTime(+date2 + step3 * k2); + }, (start3, end2) => { + return (end2 - start3) / k2; + }); + }; + milliseconds = millisecond.range; + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/duration.js + var durationSecond, durationMinute, durationHour, durationDay, durationWeek, durationMonth, durationYear; + var init_duration2 = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/duration.js"() { + "use strict"; + durationSecond = 1e3; + durationMinute = durationSecond * 60; + durationHour = durationMinute * 60; + durationDay = durationHour * 24; + durationWeek = durationDay * 7; + durationMonth = durationDay * 30; + durationYear = durationDay * 365; + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/second.js + var second, seconds; + var init_second = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/second.js"() { + "use strict"; + init_interval(); + init_duration2(); + second = timeInterval((date2) => { + date2.setTime(date2 - date2.getMilliseconds()); + }, (date2, step3) => { + date2.setTime(+date2 + step3 * durationSecond); + }, (start3, end2) => { + return (end2 - start3) / durationSecond; + }, (date2) => { + return date2.getUTCSeconds(); + }); + seconds = second.range; + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/minute.js + var timeMinute, timeMinutes, utcMinute, utcMinutes; + var init_minute = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/minute.js"() { + "use strict"; + init_interval(); + init_duration2(); + timeMinute = timeInterval((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond); + }, (date2, step3) => { + date2.setTime(+date2 + step3 * durationMinute); + }, (start3, end2) => { + return (end2 - start3) / durationMinute; + }, (date2) => { + return date2.getMinutes(); + }); + timeMinutes = timeMinute.range; + utcMinute = timeInterval((date2) => { + date2.setUTCSeconds(0, 0); + }, (date2, step3) => { + date2.setTime(+date2 + step3 * durationMinute); + }, (start3, end2) => { + return (end2 - start3) / durationMinute; + }, (date2) => { + return date2.getUTCMinutes(); + }); + utcMinutes = utcMinute.range; + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/hour.js + var timeHour, timeHours, utcHour, utcHours; + var init_hour = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/hour.js"() { + "use strict"; + init_interval(); + init_duration2(); + timeHour = timeInterval((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond - date2.getMinutes() * durationMinute); + }, (date2, step3) => { + date2.setTime(+date2 + step3 * durationHour); + }, (start3, end2) => { + return (end2 - start3) / durationHour; + }, (date2) => { + return date2.getHours(); + }); + timeHours = timeHour.range; + utcHour = timeInterval((date2) => { + date2.setUTCMinutes(0, 0, 0); + }, (date2, step3) => { + date2.setTime(+date2 + step3 * durationHour); + }, (start3, end2) => { + return (end2 - start3) / durationHour; + }, (date2) => { + return date2.getUTCHours(); + }); + utcHours = utcHour.range; + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/day.js + var timeDay, timeDays, utcDay, utcDays, unixDay, unixDays; + var init_day = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/day.js"() { + "use strict"; + init_interval(); + init_duration2(); + timeDay = timeInterval( + (date2) => date2.setHours(0, 0, 0, 0), + (date2, step3) => date2.setDate(date2.getDate() + step3), + (start3, end2) => (end2 - start3 - (end2.getTimezoneOffset() - start3.getTimezoneOffset()) * durationMinute) / durationDay, + (date2) => date2.getDate() - 1 + ); + timeDays = timeDay.range; + utcDay = timeInterval((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setUTCDate(date2.getUTCDate() + step3); + }, (start3, end2) => { + return (end2 - start3) / durationDay; + }, (date2) => { + return date2.getUTCDate() - 1; + }); + utcDays = utcDay.range; + unixDay = timeInterval((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setUTCDate(date2.getUTCDate() + step3); + }, (start3, end2) => { + return (end2 - start3) / durationDay; + }, (date2) => { + return Math.floor(date2 / durationDay); + }); + unixDays = unixDay.range; + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/week.js + function timeWeekday(i2) { + return timeInterval((date2) => { + date2.setDate(date2.getDate() - (date2.getDay() + 7 - i2) % 7); + date2.setHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setDate(date2.getDate() + step3 * 7); + }, (start3, end2) => { + return (end2 - start3 - (end2.getTimezoneOffset() - start3.getTimezoneOffset()) * durationMinute) / durationWeek; + }); + } + function utcWeekday(i2) { + return timeInterval((date2) => { + date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 7 - i2) % 7); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setUTCDate(date2.getUTCDate() + step3 * 7); + }, (start3, end2) => { + return (end2 - start3) / durationWeek; + }); + } + var timeSunday, timeMonday, timeTuesday, timeWednesday, timeThursday, timeFriday, timeSaturday, timeSundays, timeMondays, timeTuesdays, timeWednesdays, timeThursdays, timeFridays, timeSaturdays, utcSunday, utcMonday, utcTuesday, utcWednesday, utcThursday, utcFriday, utcSaturday, utcSundays, utcMondays, utcTuesdays, utcWednesdays, utcThursdays, utcFridays, utcSaturdays; + var init_week = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/week.js"() { + "use strict"; + init_interval(); + init_duration2(); + __name(timeWeekday, "timeWeekday"); + timeSunday = timeWeekday(0); + timeMonday = timeWeekday(1); + timeTuesday = timeWeekday(2); + timeWednesday = timeWeekday(3); + timeThursday = timeWeekday(4); + timeFriday = timeWeekday(5); + timeSaturday = timeWeekday(6); + timeSundays = timeSunday.range; + timeMondays = timeMonday.range; + timeTuesdays = timeTuesday.range; + timeWednesdays = timeWednesday.range; + timeThursdays = timeThursday.range; + timeFridays = timeFriday.range; + timeSaturdays = timeSaturday.range; + __name(utcWeekday, "utcWeekday"); + utcSunday = utcWeekday(0); + utcMonday = utcWeekday(1); + utcTuesday = utcWeekday(2); + utcWednesday = utcWeekday(3); + utcThursday = utcWeekday(4); + utcFriday = utcWeekday(5); + utcSaturday = utcWeekday(6); + utcSundays = utcSunday.range; + utcMondays = utcMonday.range; + utcTuesdays = utcTuesday.range; + utcWednesdays = utcWednesday.range; + utcThursdays = utcThursday.range; + utcFridays = utcFriday.range; + utcSaturdays = utcSaturday.range; + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/month.js + var timeMonth, timeMonths, utcMonth, utcMonths; + var init_month = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/month.js"() { + "use strict"; + init_interval(); + timeMonth = timeInterval((date2) => { + date2.setDate(1); + date2.setHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setMonth(date2.getMonth() + step3); + }, (start3, end2) => { + return end2.getMonth() - start3.getMonth() + (end2.getFullYear() - start3.getFullYear()) * 12; + }, (date2) => { + return date2.getMonth(); + }); + timeMonths = timeMonth.range; + utcMonth = timeInterval((date2) => { + date2.setUTCDate(1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setUTCMonth(date2.getUTCMonth() + step3); + }, (start3, end2) => { + return end2.getUTCMonth() - start3.getUTCMonth() + (end2.getUTCFullYear() - start3.getUTCFullYear()) * 12; + }, (date2) => { + return date2.getUTCMonth(); + }); + utcMonths = utcMonth.range; + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/year.js + var timeYear, timeYears, utcYear, utcYears; + var init_year = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/year.js"() { + "use strict"; + init_interval(); + timeYear = timeInterval((date2) => { + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setFullYear(date2.getFullYear() + step3); + }, (start3, end2) => { + return end2.getFullYear() - start3.getFullYear(); + }, (date2) => { + return date2.getFullYear(); + }); + timeYear.every = (k2) => { + return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : timeInterval((date2) => { + date2.setFullYear(Math.floor(date2.getFullYear() / k2) * k2); + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setFullYear(date2.getFullYear() + step3 * k2); + }); + }; + timeYears = timeYear.range; + utcYear = timeInterval((date2) => { + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step3); + }, (start3, end2) => { + return end2.getUTCFullYear() - start3.getUTCFullYear(); + }, (date2) => { + return date2.getUTCFullYear(); + }); + utcYear.every = (k2) => { + return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : timeInterval((date2) => { + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / k2) * k2); + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step3) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step3 * k2); + }); + }; + utcYears = utcYear.range; + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/ticks.js + function ticker(year, month, week, day, hour, minute) { + const tickIntervals = [ + [second, 1, durationSecond], + [second, 5, 5 * durationSecond], + [second, 15, 15 * durationSecond], + [second, 30, 30 * durationSecond], + [minute, 1, durationMinute], + [minute, 5, 5 * durationMinute], + [minute, 15, 15 * durationMinute], + [minute, 30, 30 * durationMinute], + [hour, 1, durationHour], + [hour, 3, 3 * durationHour], + [hour, 6, 6 * durationHour], + [hour, 12, 12 * durationHour], + [day, 1, durationDay], + [day, 2, 2 * durationDay], + [week, 1, durationWeek], + [month, 1, durationMonth], + [month, 3, 3 * durationMonth], + [year, 1, durationYear] + ]; + function ticks2(start3, stop5, count2) { + const reverse2 = stop5 < start3; + if (reverse2) [start3, stop5] = [stop5, start3]; + const interval2 = count2 && typeof count2.range === "function" ? count2 : tickInterval2(start3, stop5, count2); + const ticks3 = interval2 ? interval2.range(start3, +stop5 + 1) : []; + return reverse2 ? ticks3.reverse() : ticks3; + } + __name(ticks2, "ticks"); + function tickInterval2(start3, stop5, count2) { + const target = Math.abs(stop5 - start3) / count2; + const i2 = bisector(([, , step4]) => step4).right(tickIntervals, target); + if (i2 === tickIntervals.length) return year.every(tickStep(start3 / durationYear, stop5 / durationYear, count2)); + if (i2 === 0) return millisecond.every(Math.max(tickStep(start3, stop5, count2), 1)); + const [t4, step3] = tickIntervals[target / tickIntervals[i2 - 1][2] < tickIntervals[i2][2] / target ? i2 - 1 : i2]; + return t4.every(step3); + } + __name(tickInterval2, "tickInterval"); + return [ticks2, tickInterval2]; + } + var utcTicks, utcTickInterval, timeTicks, timeTickInterval; + var init_ticks2 = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/ticks.js"() { + "use strict"; + init_src2(); + init_duration2(); + init_millisecond(); + init_second(); + init_minute(); + init_hour(); + init_day(); + init_week(); + init_month(); + init_year(); + __name(ticker, "ticker"); + [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute); + [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute); + } + }); + + // ../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/index.js + var init_src26 = __esm({ + "../../node_modules/.pnpm/d3-time@3.1.0/node_modules/d3-time/src/index.js"() { + "use strict"; + init_millisecond(); + init_second(); + init_minute(); + init_hour(); + init_day(); + init_week(); + init_month(); + init_year(); + init_ticks2(); + } + }); + + // ../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/locale.js + function localDate(d3) { + if (0 <= d3.y && d3.y < 100) { + var date2 = new Date(-1, d3.m, d3.d, d3.H, d3.M, d3.S, d3.L); + date2.setFullYear(d3.y); + return date2; + } + return new Date(d3.y, d3.m, d3.d, d3.H, d3.M, d3.S, d3.L); + } + function utcDate(d3) { + if (0 <= d3.y && d3.y < 100) { + var date2 = new Date(Date.UTC(-1, d3.m, d3.d, d3.H, d3.M, d3.S, d3.L)); + date2.setUTCFullYear(d3.y); + return date2; + } + return new Date(Date.UTC(d3.y, d3.m, d3.d, d3.H, d3.M, d3.S, d3.L)); + } + function newDate(y6, m3, d3) { + return { y: y6, m: m3, d: d3, H: 0, M: 0, S: 0, L: 0 }; + } + function formatLocale(locale3) { + var locale_dateTime = locale3.dateTime, locale_date = locale3.date, locale_time = locale3.time, locale_periods = locale3.periods, locale_weekdays = locale3.days, locale_shortWeekdays = locale3.shortDays, locale_months = locale3.months, locale_shortMonths = locale3.shortMonths; + var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); + var formats = { + "a": formatShortWeekday, + "A": formatWeekday, + "b": formatShortMonth, + "B": formatMonth, + "c": null, + "d": formatDayOfMonth, + "e": formatDayOfMonth, + "f": formatMicroseconds, + "g": formatYearISO, + "G": formatFullYearISO, + "H": formatHour24, + "I": formatHour12, + "j": formatDayOfYear, + "L": formatMilliseconds, + "m": formatMonthNumber, + "M": formatMinutes, + "p": formatPeriod, + "q": formatQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatSeconds, + "u": formatWeekdayNumberMonday, + "U": formatWeekNumberSunday, + "V": formatWeekNumberISO, + "w": formatWeekdayNumberSunday, + "W": formatWeekNumberMonday, + "x": null, + "X": null, + "y": formatYear, + "Y": formatFullYear, + "Z": formatZone, + "%": formatLiteralPercent + }; + var utcFormats = { + "a": formatUTCShortWeekday, + "A": formatUTCWeekday, + "b": formatUTCShortMonth, + "B": formatUTCMonth, + "c": null, + "d": formatUTCDayOfMonth, + "e": formatUTCDayOfMonth, + "f": formatUTCMicroseconds, + "g": formatUTCYearISO, + "G": formatUTCFullYearISO, + "H": formatUTCHour24, + "I": formatUTCHour12, + "j": formatUTCDayOfYear, + "L": formatUTCMilliseconds, + "m": formatUTCMonthNumber, + "M": formatUTCMinutes, + "p": formatUTCPeriod, + "q": formatUTCQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatUTCSeconds, + "u": formatUTCWeekdayNumberMonday, + "U": formatUTCWeekNumberSunday, + "V": formatUTCWeekNumberISO, + "w": formatUTCWeekdayNumberSunday, + "W": formatUTCWeekNumberMonday, + "x": null, + "X": null, + "y": formatUTCYear, + "Y": formatUTCFullYear, + "Z": formatUTCZone, + "%": formatLiteralPercent + }; + var parses = { + "a": parseShortWeekday, + "A": parseWeekday, + "b": parseShortMonth, + "B": parseMonth, + "c": parseLocaleDateTime, + "d": parseDayOfMonth, + "e": parseDayOfMonth, + "f": parseMicroseconds, + "g": parseYear, + "G": parseFullYear, + "H": parseHour24, + "I": parseHour24, + "j": parseDayOfYear, + "L": parseMilliseconds, + "m": parseMonthNumber, + "M": parseMinutes, + "p": parsePeriod, + "q": parseQuarter, + "Q": parseUnixTimestamp, + "s": parseUnixTimestampSeconds, + "S": parseSeconds, + "u": parseWeekdayNumberMonday, + "U": parseWeekNumberSunday, + "V": parseWeekNumberISO, + "w": parseWeekdayNumberSunday, + "W": parseWeekNumberMonday, + "x": parseLocaleDate, + "X": parseLocaleTime, + "y": parseYear, + "Y": parseFullYear, + "Z": parseZone, + "%": parseLiteralPercent + }; + formats.x = newFormat(locale_date, formats); + formats.X = newFormat(locale_time, formats); + formats.c = newFormat(locale_dateTime, formats); + utcFormats.x = newFormat(locale_date, utcFormats); + utcFormats.X = newFormat(locale_time, utcFormats); + utcFormats.c = newFormat(locale_dateTime, utcFormats); + function newFormat(specifier, formats2) { + return function(date2) { + var string3 = [], i2 = -1, j3 = 0, n2 = specifier.length, c3, pad3, format3; + if (!(date2 instanceof Date)) date2 = /* @__PURE__ */ new Date(+date2); + while (++i2 < n2) { + if (specifier.charCodeAt(i2) === 37) { + string3.push(specifier.slice(j3, i2)); + if ((pad3 = pads[c3 = specifier.charAt(++i2)]) != null) c3 = specifier.charAt(++i2); + else pad3 = c3 === "e" ? " " : "0"; + if (format3 = formats2[c3]) c3 = format3(date2, pad3); + string3.push(c3); + j3 = i2 + 1; + } + } + string3.push(specifier.slice(j3, i2)); + return string3.join(""); + }; + } + __name(newFormat, "newFormat"); + function newParse(specifier, Z2) { + return function(string3) { + var d3 = newDate(1900, void 0, 1), i2 = parseSpecifier(d3, specifier, string3 += "", 0), week, day; + if (i2 != string3.length) return null; + if ("Q" in d3) return new Date(d3.Q); + if ("s" in d3) return new Date(d3.s * 1e3 + ("L" in d3 ? d3.L : 0)); + if (Z2 && !("Z" in d3)) d3.Z = 0; + if ("p" in d3) d3.H = d3.H % 12 + d3.p * 12; + if (d3.m === void 0) d3.m = "q" in d3 ? d3.q : 0; + if ("V" in d3) { + if (d3.V < 1 || d3.V > 53) return null; + if (!("w" in d3)) d3.w = 1; + if ("Z" in d3) { + week = utcDate(newDate(d3.y, 0, 1)), day = week.getUTCDay(); + week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week); + week = utcDay.offset(week, (d3.V - 1) * 7); + d3.y = week.getUTCFullYear(); + d3.m = week.getUTCMonth(); + d3.d = week.getUTCDate() + (d3.w + 6) % 7; + } else { + week = localDate(newDate(d3.y, 0, 1)), day = week.getDay(); + week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week); + week = timeDay.offset(week, (d3.V - 1) * 7); + d3.y = week.getFullYear(); + d3.m = week.getMonth(); + d3.d = week.getDate() + (d3.w + 6) % 7; + } + } else if ("W" in d3 || "U" in d3) { + if (!("w" in d3)) d3.w = "u" in d3 ? d3.u % 7 : "W" in d3 ? 1 : 0; + day = "Z" in d3 ? utcDate(newDate(d3.y, 0, 1)).getUTCDay() : localDate(newDate(d3.y, 0, 1)).getDay(); + d3.m = 0; + d3.d = "W" in d3 ? (d3.w + 6) % 7 + d3.W * 7 - (day + 5) % 7 : d3.w + d3.U * 7 - (day + 6) % 7; + } + if ("Z" in d3) { + d3.H += d3.Z / 100 | 0; + d3.M += d3.Z % 100; + return utcDate(d3); + } + return localDate(d3); + }; + } + __name(newParse, "newParse"); + function parseSpecifier(d3, specifier, string3, j3) { + var i2 = 0, n2 = specifier.length, m3 = string3.length, c3, parse7; + while (i2 < n2) { + if (j3 >= m3) return -1; + c3 = specifier.charCodeAt(i2++); + if (c3 === 37) { + c3 = specifier.charAt(i2++); + parse7 = parses[c3 in pads ? specifier.charAt(i2++) : c3]; + if (!parse7 || (j3 = parse7(d3, string3, j3)) < 0) return -1; + } else if (c3 != string3.charCodeAt(j3++)) { + return -1; + } + } + return j3; + } + __name(parseSpecifier, "parseSpecifier"); + function parsePeriod(d3, string3, i2) { + var n2 = periodRe.exec(string3.slice(i2)); + return n2 ? (d3.p = periodLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1; + } + __name(parsePeriod, "parsePeriod"); + function parseShortWeekday(d3, string3, i2) { + var n2 = shortWeekdayRe.exec(string3.slice(i2)); + return n2 ? (d3.w = shortWeekdayLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1; + } + __name(parseShortWeekday, "parseShortWeekday"); + function parseWeekday(d3, string3, i2) { + var n2 = weekdayRe.exec(string3.slice(i2)); + return n2 ? (d3.w = weekdayLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1; + } + __name(parseWeekday, "parseWeekday"); + function parseShortMonth(d3, string3, i2) { + var n2 = shortMonthRe.exec(string3.slice(i2)); + return n2 ? (d3.m = shortMonthLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1; + } + __name(parseShortMonth, "parseShortMonth"); + function parseMonth(d3, string3, i2) { + var n2 = monthRe.exec(string3.slice(i2)); + return n2 ? (d3.m = monthLookup.get(n2[0].toLowerCase()), i2 + n2[0].length) : -1; + } + __name(parseMonth, "parseMonth"); + function parseLocaleDateTime(d3, string3, i2) { + return parseSpecifier(d3, locale_dateTime, string3, i2); + } + __name(parseLocaleDateTime, "parseLocaleDateTime"); + function parseLocaleDate(d3, string3, i2) { + return parseSpecifier(d3, locale_date, string3, i2); + } + __name(parseLocaleDate, "parseLocaleDate"); + function parseLocaleTime(d3, string3, i2) { + return parseSpecifier(d3, locale_time, string3, i2); + } + __name(parseLocaleTime, "parseLocaleTime"); + function formatShortWeekday(d3) { + return locale_shortWeekdays[d3.getDay()]; + } + __name(formatShortWeekday, "formatShortWeekday"); + function formatWeekday(d3) { + return locale_weekdays[d3.getDay()]; + } + __name(formatWeekday, "formatWeekday"); + function formatShortMonth(d3) { + return locale_shortMonths[d3.getMonth()]; + } + __name(formatShortMonth, "formatShortMonth"); + function formatMonth(d3) { + return locale_months[d3.getMonth()]; + } + __name(formatMonth, "formatMonth"); + function formatPeriod(d3) { + return locale_periods[+(d3.getHours() >= 12)]; + } + __name(formatPeriod, "formatPeriod"); + function formatQuarter(d3) { + return 1 + ~~(d3.getMonth() / 3); + } + __name(formatQuarter, "formatQuarter"); + function formatUTCShortWeekday(d3) { + return locale_shortWeekdays[d3.getUTCDay()]; + } + __name(formatUTCShortWeekday, "formatUTCShortWeekday"); + function formatUTCWeekday(d3) { + return locale_weekdays[d3.getUTCDay()]; + } + __name(formatUTCWeekday, "formatUTCWeekday"); + function formatUTCShortMonth(d3) { + return locale_shortMonths[d3.getUTCMonth()]; + } + __name(formatUTCShortMonth, "formatUTCShortMonth"); + function formatUTCMonth(d3) { + return locale_months[d3.getUTCMonth()]; + } + __name(formatUTCMonth, "formatUTCMonth"); + function formatUTCPeriod(d3) { + return locale_periods[+(d3.getUTCHours() >= 12)]; + } + __name(formatUTCPeriod, "formatUTCPeriod"); + function formatUTCQuarter(d3) { + return 1 + ~~(d3.getUTCMonth() / 3); + } + __name(formatUTCQuarter, "formatUTCQuarter"); + return { + format: /* @__PURE__ */ __name(function(specifier) { + var f2 = newFormat(specifier += "", formats); + f2.toString = function() { + return specifier; + }; + return f2; + }, "format"), + parse: /* @__PURE__ */ __name(function(specifier) { + var p3 = newParse(specifier += "", false); + p3.toString = function() { + return specifier; + }; + return p3; + }, "parse"), + utcFormat: /* @__PURE__ */ __name(function(specifier) { + var f2 = newFormat(specifier += "", utcFormats); + f2.toString = function() { + return specifier; + }; + return f2; + }, "utcFormat"), + utcParse: /* @__PURE__ */ __name(function(specifier) { + var p3 = newParse(specifier += "", true); + p3.toString = function() { + return specifier; + }; + return p3; + }, "utcParse") + }; + } + function pad2(value2, fill, width3) { + var sign2 = value2 < 0 ? "-" : "", string3 = (sign2 ? -value2 : value2) + "", length2 = string3.length; + return sign2 + (length2 < width3 ? new Array(width3 - length2 + 1).join(fill) + string3 : string3); + } + function requote(s2) { + return s2.replace(requoteRe, "\\$&"); + } + function formatRe(names) { + return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); + } + function formatLookup(names) { + return new Map(names.map((name, i2) => [name.toLowerCase(), i2])); + } + function parseWeekdayNumberSunday(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 1)); + return n2 ? (d3.w = +n2[0], i2 + n2[0].length) : -1; + } + function parseWeekdayNumberMonday(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 1)); + return n2 ? (d3.u = +n2[0], i2 + n2[0].length) : -1; + } + function parseWeekNumberSunday(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 2)); + return n2 ? (d3.U = +n2[0], i2 + n2[0].length) : -1; + } + function parseWeekNumberISO(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 2)); + return n2 ? (d3.V = +n2[0], i2 + n2[0].length) : -1; + } + function parseWeekNumberMonday(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 2)); + return n2 ? (d3.W = +n2[0], i2 + n2[0].length) : -1; + } + function parseFullYear(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 4)); + return n2 ? (d3.y = +n2[0], i2 + n2[0].length) : -1; + } + function parseYear(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 2)); + return n2 ? (d3.y = +n2[0] + (+n2[0] > 68 ? 1900 : 2e3), i2 + n2[0].length) : -1; + } + function parseZone(d3, string3, i2) { + var n2 = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string3.slice(i2, i2 + 6)); + return n2 ? (d3.Z = n2[1] ? 0 : -(n2[2] + (n2[3] || "00")), i2 + n2[0].length) : -1; + } + function parseQuarter(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 1)); + return n2 ? (d3.q = n2[0] * 3 - 3, i2 + n2[0].length) : -1; + } + function parseMonthNumber(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 2)); + return n2 ? (d3.m = n2[0] - 1, i2 + n2[0].length) : -1; + } + function parseDayOfMonth(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 2)); + return n2 ? (d3.d = +n2[0], i2 + n2[0].length) : -1; + } + function parseDayOfYear(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 3)); + return n2 ? (d3.m = 0, d3.d = +n2[0], i2 + n2[0].length) : -1; + } + function parseHour24(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 2)); + return n2 ? (d3.H = +n2[0], i2 + n2[0].length) : -1; + } + function parseMinutes(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 2)); + return n2 ? (d3.M = +n2[0], i2 + n2[0].length) : -1; + } + function parseSeconds(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 2)); + return n2 ? (d3.S = +n2[0], i2 + n2[0].length) : -1; + } + function parseMilliseconds(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 3)); + return n2 ? (d3.L = +n2[0], i2 + n2[0].length) : -1; + } + function parseMicroseconds(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2, i2 + 6)); + return n2 ? (d3.L = Math.floor(n2[0] / 1e3), i2 + n2[0].length) : -1; + } + function parseLiteralPercent(d3, string3, i2) { + var n2 = percentRe.exec(string3.slice(i2, i2 + 1)); + return n2 ? i2 + n2[0].length : -1; + } + function parseUnixTimestamp(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2)); + return n2 ? (d3.Q = +n2[0], i2 + n2[0].length) : -1; + } + function parseUnixTimestampSeconds(d3, string3, i2) { + var n2 = numberRe.exec(string3.slice(i2)); + return n2 ? (d3.s = +n2[0], i2 + n2[0].length) : -1; + } + function formatDayOfMonth(d3, p3) { + return pad2(d3.getDate(), p3, 2); + } + function formatHour24(d3, p3) { + return pad2(d3.getHours(), p3, 2); + } + function formatHour12(d3, p3) { + return pad2(d3.getHours() % 12 || 12, p3, 2); + } + function formatDayOfYear(d3, p3) { + return pad2(1 + timeDay.count(timeYear(d3), d3), p3, 3); + } + function formatMilliseconds(d3, p3) { + return pad2(d3.getMilliseconds(), p3, 3); + } + function formatMicroseconds(d3, p3) { + return formatMilliseconds(d3, p3) + "000"; + } + function formatMonthNumber(d3, p3) { + return pad2(d3.getMonth() + 1, p3, 2); + } + function formatMinutes(d3, p3) { + return pad2(d3.getMinutes(), p3, 2); + } + function formatSeconds(d3, p3) { + return pad2(d3.getSeconds(), p3, 2); + } + function formatWeekdayNumberMonday(d3) { + var day = d3.getDay(); + return day === 0 ? 7 : day; + } + function formatWeekNumberSunday(d3, p3) { + return pad2(timeSunday.count(timeYear(d3) - 1, d3), p3, 2); + } + function dISO(d3) { + var day = d3.getDay(); + return day >= 4 || day === 0 ? timeThursday(d3) : timeThursday.ceil(d3); + } + function formatWeekNumberISO(d3, p3) { + d3 = dISO(d3); + return pad2(timeThursday.count(timeYear(d3), d3) + (timeYear(d3).getDay() === 4), p3, 2); + } + function formatWeekdayNumberSunday(d3) { + return d3.getDay(); + } + function formatWeekNumberMonday(d3, p3) { + return pad2(timeMonday.count(timeYear(d3) - 1, d3), p3, 2); + } + function formatYear(d3, p3) { + return pad2(d3.getFullYear() % 100, p3, 2); + } + function formatYearISO(d3, p3) { + d3 = dISO(d3); + return pad2(d3.getFullYear() % 100, p3, 2); + } + function formatFullYear(d3, p3) { + return pad2(d3.getFullYear() % 1e4, p3, 4); + } + function formatFullYearISO(d3, p3) { + var day = d3.getDay(); + d3 = day >= 4 || day === 0 ? timeThursday(d3) : timeThursday.ceil(d3); + return pad2(d3.getFullYear() % 1e4, p3, 4); + } + function formatZone(d3) { + var z3 = d3.getTimezoneOffset(); + return (z3 > 0 ? "-" : (z3 *= -1, "+")) + pad2(z3 / 60 | 0, "0", 2) + pad2(z3 % 60, "0", 2); + } + function formatUTCDayOfMonth(d3, p3) { + return pad2(d3.getUTCDate(), p3, 2); + } + function formatUTCHour24(d3, p3) { + return pad2(d3.getUTCHours(), p3, 2); + } + function formatUTCHour12(d3, p3) { + return pad2(d3.getUTCHours() % 12 || 12, p3, 2); + } + function formatUTCDayOfYear(d3, p3) { + return pad2(1 + utcDay.count(utcYear(d3), d3), p3, 3); + } + function formatUTCMilliseconds(d3, p3) { + return pad2(d3.getUTCMilliseconds(), p3, 3); + } + function formatUTCMicroseconds(d3, p3) { + return formatUTCMilliseconds(d3, p3) + "000"; + } + function formatUTCMonthNumber(d3, p3) { + return pad2(d3.getUTCMonth() + 1, p3, 2); + } + function formatUTCMinutes(d3, p3) { + return pad2(d3.getUTCMinutes(), p3, 2); + } + function formatUTCSeconds(d3, p3) { + return pad2(d3.getUTCSeconds(), p3, 2); + } + function formatUTCWeekdayNumberMonday(d3) { + var dow = d3.getUTCDay(); + return dow === 0 ? 7 : dow; + } + function formatUTCWeekNumberSunday(d3, p3) { + return pad2(utcSunday.count(utcYear(d3) - 1, d3), p3, 2); + } + function UTCdISO(d3) { + var day = d3.getUTCDay(); + return day >= 4 || day === 0 ? utcThursday(d3) : utcThursday.ceil(d3); + } + function formatUTCWeekNumberISO(d3, p3) { + d3 = UTCdISO(d3); + return pad2(utcThursday.count(utcYear(d3), d3) + (utcYear(d3).getUTCDay() === 4), p3, 2); + } + function formatUTCWeekdayNumberSunday(d3) { + return d3.getUTCDay(); + } + function formatUTCWeekNumberMonday(d3, p3) { + return pad2(utcMonday.count(utcYear(d3) - 1, d3), p3, 2); + } + function formatUTCYear(d3, p3) { + return pad2(d3.getUTCFullYear() % 100, p3, 2); + } + function formatUTCYearISO(d3, p3) { + d3 = UTCdISO(d3); + return pad2(d3.getUTCFullYear() % 100, p3, 2); + } + function formatUTCFullYear(d3, p3) { + return pad2(d3.getUTCFullYear() % 1e4, p3, 4); + } + function formatUTCFullYearISO(d3, p3) { + var day = d3.getUTCDay(); + d3 = day >= 4 || day === 0 ? utcThursday(d3) : utcThursday.ceil(d3); + return pad2(d3.getUTCFullYear() % 1e4, p3, 4); + } + function formatUTCZone() { + return "+0000"; + } + function formatLiteralPercent() { + return "%"; + } + function formatUnixTimestamp(d3) { + return +d3; + } + function formatUnixTimestampSeconds(d3) { + return Math.floor(+d3 / 1e3); + } + var pads, numberRe, percentRe, requoteRe; + var init_locale2 = __esm({ + "../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/locale.js"() { + "use strict"; + init_src26(); + __name(localDate, "localDate"); + __name(utcDate, "utcDate"); + __name(newDate, "newDate"); + __name(formatLocale, "formatLocale"); + pads = { "-": "", "_": " ", "0": "0" }; + numberRe = /^\s*\d+/; + percentRe = /^%/; + requoteRe = /[\\^$*+?|[\]().{}]/g; + __name(pad2, "pad"); + __name(requote, "requote"); + __name(formatRe, "formatRe"); + __name(formatLookup, "formatLookup"); + __name(parseWeekdayNumberSunday, "parseWeekdayNumberSunday"); + __name(parseWeekdayNumberMonday, "parseWeekdayNumberMonday"); + __name(parseWeekNumberSunday, "parseWeekNumberSunday"); + __name(parseWeekNumberISO, "parseWeekNumberISO"); + __name(parseWeekNumberMonday, "parseWeekNumberMonday"); + __name(parseFullYear, "parseFullYear"); + __name(parseYear, "parseYear"); + __name(parseZone, "parseZone"); + __name(parseQuarter, "parseQuarter"); + __name(parseMonthNumber, "parseMonthNumber"); + __name(parseDayOfMonth, "parseDayOfMonth"); + __name(parseDayOfYear, "parseDayOfYear"); + __name(parseHour24, "parseHour24"); + __name(parseMinutes, "parseMinutes"); + __name(parseSeconds, "parseSeconds"); + __name(parseMilliseconds, "parseMilliseconds"); + __name(parseMicroseconds, "parseMicroseconds"); + __name(parseLiteralPercent, "parseLiteralPercent"); + __name(parseUnixTimestamp, "parseUnixTimestamp"); + __name(parseUnixTimestampSeconds, "parseUnixTimestampSeconds"); + __name(formatDayOfMonth, "formatDayOfMonth"); + __name(formatHour24, "formatHour24"); + __name(formatHour12, "formatHour12"); + __name(formatDayOfYear, "formatDayOfYear"); + __name(formatMilliseconds, "formatMilliseconds"); + __name(formatMicroseconds, "formatMicroseconds"); + __name(formatMonthNumber, "formatMonthNumber"); + __name(formatMinutes, "formatMinutes"); + __name(formatSeconds, "formatSeconds"); + __name(formatWeekdayNumberMonday, "formatWeekdayNumberMonday"); + __name(formatWeekNumberSunday, "formatWeekNumberSunday"); + __name(dISO, "dISO"); + __name(formatWeekNumberISO, "formatWeekNumberISO"); + __name(formatWeekdayNumberSunday, "formatWeekdayNumberSunday"); + __name(formatWeekNumberMonday, "formatWeekNumberMonday"); + __name(formatYear, "formatYear"); + __name(formatYearISO, "formatYearISO"); + __name(formatFullYear, "formatFullYear"); + __name(formatFullYearISO, "formatFullYearISO"); + __name(formatZone, "formatZone"); + __name(formatUTCDayOfMonth, "formatUTCDayOfMonth"); + __name(formatUTCHour24, "formatUTCHour24"); + __name(formatUTCHour12, "formatUTCHour12"); + __name(formatUTCDayOfYear, "formatUTCDayOfYear"); + __name(formatUTCMilliseconds, "formatUTCMilliseconds"); + __name(formatUTCMicroseconds, "formatUTCMicroseconds"); + __name(formatUTCMonthNumber, "formatUTCMonthNumber"); + __name(formatUTCMinutes, "formatUTCMinutes"); + __name(formatUTCSeconds, "formatUTCSeconds"); + __name(formatUTCWeekdayNumberMonday, "formatUTCWeekdayNumberMonday"); + __name(formatUTCWeekNumberSunday, "formatUTCWeekNumberSunday"); + __name(UTCdISO, "UTCdISO"); + __name(formatUTCWeekNumberISO, "formatUTCWeekNumberISO"); + __name(formatUTCWeekdayNumberSunday, "formatUTCWeekdayNumberSunday"); + __name(formatUTCWeekNumberMonday, "formatUTCWeekNumberMonday"); + __name(formatUTCYear, "formatUTCYear"); + __name(formatUTCYearISO, "formatUTCYearISO"); + __name(formatUTCFullYear, "formatUTCFullYear"); + __name(formatUTCFullYearISO, "formatUTCFullYearISO"); + __name(formatUTCZone, "formatUTCZone"); + __name(formatLiteralPercent, "formatLiteralPercent"); + __name(formatUnixTimestamp, "formatUnixTimestamp"); + __name(formatUnixTimestampSeconds, "formatUnixTimestampSeconds"); + } + }); + + // ../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/defaultLocale.js + function defaultLocale2(definition) { + locale2 = formatLocale(definition); + timeFormat = locale2.format; + timeParse = locale2.parse; + utcFormat = locale2.utcFormat; + utcParse = locale2.utcParse; + return locale2; + } + var locale2, timeFormat, timeParse, utcFormat, utcParse; + var init_defaultLocale2 = __esm({ + "../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/defaultLocale.js"() { + "use strict"; + init_locale2(); + defaultLocale2({ + dateTime: "%x, %X", + date: "%-m/%-d/%Y", + time: "%-I:%M:%S %p", + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + }); + __name(defaultLocale2, "defaultLocale"); + } + }); + + // ../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/index.js + var init_src27 = __esm({ + "../../node_modules/.pnpm/d3-time-format@4.1.0/node_modules/d3-time-format/src/index.js"() { + "use strict"; + init_defaultLocale2(); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/time.js + function date(t4) { + return new Date(t4); + } + function number4(t4) { + return t4 instanceof Date ? +t4 : +/* @__PURE__ */ new Date(+t4); + } + function calendar(ticks2, tickInterval2, year, month, week, day, hour, minute, second2, format3) { + var scale3 = continuous(), invert2 = scale3.invert, domain = scale3.domain; + var formatMillisecond = format3(".%L"), formatSecond = format3(":%S"), formatMinute = format3("%I:%M"), formatHour = format3("%I %p"), formatDay = format3("%a %d"), formatWeek = format3("%b %d"), formatMonth = format3("%B"), formatYear2 = format3("%Y"); + function tickFormat2(date2) { + return (second2(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear2)(date2); + } + __name(tickFormat2, "tickFormat"); + scale3.invert = function(y6) { + return new Date(invert2(y6)); + }; + scale3.domain = function(_3) { + return arguments.length ? domain(Array.from(_3, number4)) : domain().map(date); + }; + scale3.ticks = function(interval2) { + var d3 = domain(); + return ticks2(d3[0], d3[d3.length - 1], interval2 == null ? 10 : interval2); + }; + scale3.tickFormat = function(count2, specifier) { + return specifier == null ? tickFormat2 : format3(specifier); + }; + scale3.nice = function(interval2) { + var d3 = domain(); + if (!interval2 || typeof interval2.range !== "function") interval2 = tickInterval2(d3[0], d3[d3.length - 1], interval2 == null ? 10 : interval2); + return interval2 ? domain(nice(d3, interval2)) : scale3; + }; + scale3.copy = function() { + return copy(scale3, calendar(ticks2, tickInterval2, year, month, week, day, hour, minute, second2, format3)); + }; + return scale3; + } + function time() { + return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); + } + var init_time = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/time.js"() { + "use strict"; + init_src26(); + init_src27(); + init_continuous(); + init_init(); + init_nice(); + __name(date, "date"); + __name(number4, "number"); + __name(calendar, "calendar"); + __name(time, "time"); + } + }); + + // ../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/index.js + var init_src28 = __esm({ + "../../node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/index.js"() { + "use strict"; + init_band(); + init_linear(); + init_ordinal(); + init_time(); + } + }); + + // ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js + function colors_default(specifier) { + var n2 = specifier.length / 6 | 0, colors2 = new Array(n2), i2 = 0; + while (i2 < n2) colors2[i2] = "#" + specifier.slice(i2 * 6, ++i2 * 6); + return colors2; + } + var init_colors = __esm({ + "../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/colors.js"() { + "use strict"; + __name(colors_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Tableau10.js + var Tableau10_default; + var init_Tableau10 = __esm({ + "../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Tableau10.js"() { + "use strict"; + init_colors(); + Tableau10_default = colors_default("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"); + } + }); + + // ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/index.js + var init_src29 = __esm({ + "../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/index.js"() { + "use strict"; + init_Tableau10(); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js + function constant_default5(x5) { + return /* @__PURE__ */ __name(function constant4() { + return x5; + }, "constant"); + } + var init_constant6 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js"() { + "use strict"; + __name(constant_default5, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/math.js + function acos(x5) { + return x5 > 1 ? 0 : x5 < -1 ? pi2 : Math.acos(x5); + } + function asin(x5) { + return x5 >= 1 ? halfPi : x5 <= -1 ? -halfPi : Math.asin(x5); + } + var abs2, atan2, cos, max3, min3, sin, sqrt, epsilon3, pi2, halfPi, tau2; + var init_math2 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/math.js"() { + "use strict"; + abs2 = Math.abs; + atan2 = Math.atan2; + cos = Math.cos; + max3 = Math.max; + min3 = Math.min; + sin = Math.sin; + sqrt = Math.sqrt; + epsilon3 = 1e-12; + pi2 = Math.PI; + halfPi = pi2 / 2; + tau2 = 2 * pi2; + __name(acos, "acos"); + __name(asin, "asin"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js + function withPath(shape) { + let digits = 3; + shape.digits = function(_3) { + if (!arguments.length) return digits; + if (_3 == null) { + digits = null; + } else { + const d3 = Math.floor(_3); + if (!(d3 >= 0)) throw new RangeError(`invalid digits: ${_3}`); + digits = d3; + } + return shape; + }; + return () => new Path(digits); + } + var init_path3 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js"() { + "use strict"; + init_src13(); + __name(withPath, "withPath"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/arc.js + function arcInnerRadius(d3) { + return d3.innerRadius; + } + function arcOuterRadius(d3) { + return d3.outerRadius; + } + function arcStartAngle(d3) { + return d3.startAngle; + } + function arcEndAngle(d3) { + return d3.endAngle; + } + function arcPadAngle(d3) { + return d3 && d3.padAngle; + } + function intersect(x0, y0, x1, y1, x22, y22, x32, y32) { + var x10 = x1 - x0, y10 = y1 - y0, x322 = x32 - x22, y322 = y32 - y22, t4 = y322 * x10 - x322 * y10; + if (t4 * t4 < epsilon3) return; + t4 = (x322 * (y0 - y22) - y322 * (x0 - x22)) / t4; + return [x0 + t4 * x10, y0 + t4 * y10]; + } + function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { + var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d22 = dx * dx + dy * dy, r2 = r1 - rc, D4 = x11 * y10 - x10 * y11, d3 = (dy < 0 ? -1 : 1) * sqrt(max3(0, r2 * r2 * d22 - D4 * D4)), cx0 = (D4 * dy - dx * d3) / d22, cy0 = (-D4 * dx - dy * d3) / d22, cx1 = (D4 * dy + dx * d3) / d22, cy1 = (-D4 * dx + dy * d3) / d22, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; + return { + cx: cx0, + cy: cy0, + x01: -ox, + y01: -oy, + x11: cx0 * (r1 / r2 - 1), + y11: cy0 * (r1 / r2 - 1) + }; + } + function arc_default() { + var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant_default5(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path4 = withPath(arc); + function arc() { + var buffer, r2, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs2(a1 - a0), cw = a1 > a0; + if (!context) context = buffer = path4(); + if (r1 < r0) r2 = r1, r1 = r0, r0 = r2; + if (!(r1 > epsilon3)) context.moveTo(0, 0); + else if (da > tau2 - epsilon3) { + context.moveTo(r1 * cos(a0), r1 * sin(a0)); + context.arc(0, 0, r1, a0, a1, !cw); + if (r0 > epsilon3) { + context.moveTo(r0 * cos(a1), r0 * sin(a1)); + context.arc(0, 0, r0, a1, a0, cw); + } + } else { + var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon3 && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min3(abs2(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t03, t13; + if (rp > epsilon3) { + var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap)); + if ((da0 -= p0 * 2) > epsilon3) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0; + else da0 = 0, a00 = a10 = (a0 + a1) / 2; + if ((da1 -= p1 * 2) > epsilon3) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1; + else da1 = 0, a01 = a11 = (a0 + a1) / 2; + } + var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10); + if (rc > epsilon3) { + var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc; + if (da < pi2) { + if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) { + var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = min3(rc, (r0 - lc) / (kc - 1)); + rc1 = min3(rc, (r1 - lc) / (kc + 1)); + } else { + rc0 = rc1 = 0; + } + } + } + if (!(da1 > epsilon3)) context.moveTo(x01, y01); + else if (rc1 > epsilon3) { + t03 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); + t13 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); + context.moveTo(t03.cx + t03.x01, t03.cy + t03.y01); + if (rc1 < rc) context.arc(t03.cx, t03.cy, rc1, atan2(t03.y01, t03.x01), atan2(t13.y01, t13.x01), !cw); + else { + context.arc(t03.cx, t03.cy, rc1, atan2(t03.y01, t03.x01), atan2(t03.y11, t03.x11), !cw); + context.arc(0, 0, r1, atan2(t03.cy + t03.y11, t03.cx + t03.x11), atan2(t13.cy + t13.y11, t13.cx + t13.x11), !cw); + context.arc(t13.cx, t13.cy, rc1, atan2(t13.y11, t13.x11), atan2(t13.y01, t13.x01), !cw); + } + } else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); + if (!(r0 > epsilon3) || !(da0 > epsilon3)) context.lineTo(x10, y10); + else if (rc0 > epsilon3) { + t03 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); + t13 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); + context.lineTo(t03.cx + t03.x01, t03.cy + t03.y01); + if (rc0 < rc) context.arc(t03.cx, t03.cy, rc0, atan2(t03.y01, t03.x01), atan2(t13.y01, t13.x01), !cw); + else { + context.arc(t03.cx, t03.cy, rc0, atan2(t03.y01, t03.x01), atan2(t03.y11, t03.x11), !cw); + context.arc(0, 0, r0, atan2(t03.cy + t03.y11, t03.cx + t03.x11), atan2(t13.cy + t13.y11, t13.cx + t13.x11), cw); + context.arc(t13.cx, t13.cy, rc0, atan2(t13.y11, t13.x11), atan2(t13.y01, t13.x01), !cw); + } + } else context.arc(0, 0, r0, a10, a00, cw); + } + context.closePath(); + if (buffer) return context = null, buffer + "" || null; + } + __name(arc, "arc"); + arc.centroid = function() { + var r2 = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi2 / 2; + return [cos(a2) * r2, sin(a2) * r2]; + }; + arc.innerRadius = function(_3) { + return arguments.length ? (innerRadius = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : innerRadius; + }; + arc.outerRadius = function(_3) { + return arguments.length ? (outerRadius = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : outerRadius; + }; + arc.cornerRadius = function(_3) { + return arguments.length ? (cornerRadius = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : cornerRadius; + }; + arc.padRadius = function(_3) { + return arguments.length ? (padRadius = _3 == null ? null : typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : padRadius; + }; + arc.startAngle = function(_3) { + return arguments.length ? (startAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : startAngle; + }; + arc.endAngle = function(_3) { + return arguments.length ? (endAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : endAngle; + }; + arc.padAngle = function(_3) { + return arguments.length ? (padAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), arc) : padAngle; + }; + arc.context = function(_3) { + return arguments.length ? (context = _3 == null ? null : _3, arc) : context; + }; + return arc; + } + var init_arc = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/arc.js"() { + "use strict"; + init_constant6(); + init_math2(); + init_path3(); + __name(arcInnerRadius, "arcInnerRadius"); + __name(arcOuterRadius, "arcOuterRadius"); + __name(arcStartAngle, "arcStartAngle"); + __name(arcEndAngle, "arcEndAngle"); + __name(arcPadAngle, "arcPadAngle"); + __name(intersect, "intersect"); + __name(cornerTangents, "cornerTangents"); + __name(arc_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js + function array_default(x5) { + return typeof x5 === "object" && "length" in x5 ? x5 : Array.from(x5); + } + var slice; + var init_array3 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js"() { + "use strict"; + slice = Array.prototype.slice; + __name(array_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js + function Linear(context) { + this._context = context; + } + function linear_default(context) { + return new Linear(context); + } + var init_linear2 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js"() { + "use strict"; + __name(Linear, "Linear"); + Linear.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6); + break; + case 1: + this._point = 2; + // falls through + default: + this._context.lineTo(x5, y6); + break; + } + }, "point") + }; + __name(linear_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js + function x(p3) { + return p3[0]; + } + function y(p3) { + return p3[1]; + } + var init_point = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js"() { + "use strict"; + __name(x, "x"); + __name(y, "y"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js + function line_default(x5, y6) { + var defined = constant_default5(true), context = null, curve = linear_default, output2 = null, path4 = withPath(line2); + x5 = typeof x5 === "function" ? x5 : x5 === void 0 ? x : constant_default5(x5); + y6 = typeof y6 === "function" ? y6 : y6 === void 0 ? y : constant_default5(y6); + function line2(data5) { + var i2, n2 = (data5 = array_default(data5)).length, d3, defined0 = false, buffer; + if (context == null) output2 = curve(buffer = path4()); + for (i2 = 0; i2 <= n2; ++i2) { + if (!(i2 < n2 && defined(d3 = data5[i2], i2, data5)) === defined0) { + if (defined0 = !defined0) output2.lineStart(); + else output2.lineEnd(); + } + if (defined0) output2.point(+x5(d3, i2, data5), +y6(d3, i2, data5)); + } + if (buffer) return output2 = null, buffer + "" || null; + } + __name(line2, "line"); + line2.x = function(_3) { + return arguments.length ? (x5 = typeof _3 === "function" ? _3 : constant_default5(+_3), line2) : x5; + }; + line2.y = function(_3) { + return arguments.length ? (y6 = typeof _3 === "function" ? _3 : constant_default5(+_3), line2) : y6; + }; + line2.defined = function(_3) { + return arguments.length ? (defined = typeof _3 === "function" ? _3 : constant_default5(!!_3), line2) : defined; + }; + line2.curve = function(_3) { + return arguments.length ? (curve = _3, context != null && (output2 = curve(context)), line2) : curve; + }; + line2.context = function(_3) { + return arguments.length ? (_3 == null ? context = output2 = null : output2 = curve(context = _3), line2) : context; + }; + return line2; + } + var init_line = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js"() { + "use strict"; + init_array3(); + init_constant6(); + init_linear2(); + init_path3(); + init_point(); + __name(line_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/descending.js + function descending_default(a2, b3) { + return b3 < a2 ? -1 : b3 > a2 ? 1 : b3 >= a2 ? 0 : NaN; + } + var init_descending2 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/descending.js"() { + "use strict"; + __name(descending_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/identity.js + function identity_default3(d3) { + return d3; + } + var init_identity3 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/identity.js"() { + "use strict"; + __name(identity_default3, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/pie.js + function pie_default() { + var value2 = identity_default3, sortValues = descending_default, sort3 = null, startAngle = constant_default5(0), endAngle = constant_default5(tau2), padAngle = constant_default5(0); + function pie2(data5) { + var i2, n2 = (data5 = array_default(data5)).length, j3, k2, sum2 = 0, index = new Array(n2), arcs = new Array(n2), a0 = +startAngle.apply(this, arguments), da = Math.min(tau2, Math.max(-tau2, endAngle.apply(this, arguments) - a0)), a1, p3 = Math.min(Math.abs(da) / n2, padAngle.apply(this, arguments)), pa = p3 * (da < 0 ? -1 : 1), v3; + for (i2 = 0; i2 < n2; ++i2) { + if ((v3 = arcs[index[i2] = i2] = +value2(data5[i2], i2, data5)) > 0) { + sum2 += v3; + } + } + if (sortValues != null) index.sort(function(i3, j4) { + return sortValues(arcs[i3], arcs[j4]); + }); + else if (sort3 != null) index.sort(function(i3, j4) { + return sort3(data5[i3], data5[j4]); + }); + for (i2 = 0, k2 = sum2 ? (da - n2 * pa) / sum2 : 0; i2 < n2; ++i2, a0 = a1) { + j3 = index[i2], v3 = arcs[j3], a1 = a0 + (v3 > 0 ? v3 * k2 : 0) + pa, arcs[j3] = { + data: data5[j3], + index: i2, + value: v3, + startAngle: a0, + endAngle: a1, + padAngle: p3 + }; + } + return arcs; + } + __name(pie2, "pie"); + pie2.value = function(_3) { + return arguments.length ? (value2 = typeof _3 === "function" ? _3 : constant_default5(+_3), pie2) : value2; + }; + pie2.sortValues = function(_3) { + return arguments.length ? (sortValues = _3, sort3 = null, pie2) : sortValues; + }; + pie2.sort = function(_3) { + return arguments.length ? (sort3 = _3, sortValues = null, pie2) : sort3; + }; + pie2.startAngle = function(_3) { + return arguments.length ? (startAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), pie2) : startAngle; + }; + pie2.endAngle = function(_3) { + return arguments.length ? (endAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), pie2) : endAngle; + }; + pie2.padAngle = function(_3) { + return arguments.length ? (padAngle = typeof _3 === "function" ? _3 : constant_default5(+_3), pie2) : padAngle; + }; + return pie2; + } + var init_pie = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/pie.js"() { + "use strict"; + init_array3(); + init_constant6(); + init_descending2(); + init_identity3(); + init_math2(); + __name(pie_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bump.js + function bumpX(context) { + return new Bump(context, true); + } + function bumpY(context) { + return new Bump(context, false); + } + var Bump; + var init_bump = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bump.js"() { + "use strict"; + Bump = class { + static { + __name(this, "Bump"); + } + constructor(context, x5) { + this._context = context; + this._x = x5; + } + areaStart() { + this._line = 0; + } + areaEnd() { + this._line = NaN; + } + lineStart() { + this._point = 0; + } + lineEnd() { + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + } + point(x5, y6) { + x5 = +x5, y6 = +y6; + switch (this._point) { + case 0: { + this._point = 1; + if (this._line) this._context.lineTo(x5, y6); + else this._context.moveTo(x5, y6); + break; + } + case 1: + this._point = 2; + // falls through + default: { + if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x5) / 2, this._y0, this._x0, y6, x5, y6); + else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y6) / 2, x5, this._y0, x5, y6); + break; + } + } + this._x0 = x5, this._y0 = y6; + } + }; + __name(bumpX, "bumpX"); + __name(bumpY, "bumpY"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/noop.js + function noop_default() { + } + var init_noop = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/noop.js"() { + "use strict"; + __name(noop_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basis.js + function point2(that, x5, y6) { + that._context.bezierCurveTo( + (2 * that._x0 + that._x1) / 3, + (2 * that._y0 + that._y1) / 3, + (that._x0 + 2 * that._x1) / 3, + (that._y0 + 2 * that._y1) / 3, + (that._x0 + 4 * that._x1 + x5) / 6, + (that._y0 + 4 * that._y1 + y6) / 6 + ); + } + function Basis(context) { + this._context = context; + } + function basis_default2(context) { + return new Basis(context); + } + var init_basis2 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basis.js"() { + "use strict"; + __name(point2, "point"); + __name(Basis, "Basis"); + Basis.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + switch (this._point) { + case 3: + point2(this, this._x1, this._y1); + // falls through + case 2: + this._context.lineTo(this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); + // falls through + default: + point2(this, x5, y6); + break; + } + this._x0 = this._x1, this._x1 = x5; + this._y0 = this._y1, this._y1 = y6; + }, "point") + }; + __name(basis_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisClosed.js + function BasisClosed(context) { + this._context = context; + } + function basisClosed_default2(context) { + return new BasisClosed(context); + } + var init_basisClosed2 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisClosed.js"() { + "use strict"; + init_noop(); + init_basis2(); + __name(BasisClosed, "BasisClosed"); + BasisClosed.prototype = { + areaStart: noop_default, + areaEnd: noop_default, + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x2, this._y2); + this._context.closePath(); + break; + } + case 2: { + this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); + this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x2, this._y2); + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + break; + } + } + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + switch (this._point) { + case 0: + this._point = 1; + this._x2 = x5, this._y2 = y6; + break; + case 1: + this._point = 2; + this._x3 = x5, this._y3 = y6; + break; + case 2: + this._point = 3; + this._x4 = x5, this._y4 = y6; + this._context.moveTo((this._x0 + 4 * this._x1 + x5) / 6, (this._y0 + 4 * this._y1 + y6) / 6); + break; + default: + point2(this, x5, y6); + break; + } + this._x0 = this._x1, this._x1 = x5; + this._y0 = this._y1, this._y1 = y6; + }, "point") + }; + __name(basisClosed_default2, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisOpen.js + function BasisOpen(context) { + this._context = context; + } + function basisOpen_default(context) { + return new BasisOpen(context); + } + var init_basisOpen = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/basisOpen.js"() { + "use strict"; + init_basis2(); + __name(BasisOpen, "BasisOpen"); + BasisOpen.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + var x0 = (this._x0 + 4 * this._x1 + x5) / 6, y0 = (this._y0 + 4 * this._y1 + y6) / 6; + this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); + break; + case 3: + this._point = 4; + // falls through + default: + point2(this, x5, y6); + break; + } + this._x0 = this._x1, this._x1 = x5; + this._y0 = this._y1, this._y1 = y6; + }, "point") + }; + __name(basisOpen_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bundle.js + function Bundle(context, beta) { + this._basis = new Basis(context); + this._beta = beta; + } + var bundle_default; + var init_bundle = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/bundle.js"() { + "use strict"; + init_basis2(); + __name(Bundle, "Bundle"); + Bundle.prototype = { + lineStart: /* @__PURE__ */ __name(function() { + this._x = []; + this._y = []; + this._basis.lineStart(); + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + var x5 = this._x, y6 = this._y, j3 = x5.length - 1; + if (j3 > 0) { + var x0 = x5[0], y0 = y6[0], dx = x5[j3] - x0, dy = y6[j3] - y0, i2 = -1, t4; + while (++i2 <= j3) { + t4 = i2 / j3; + this._basis.point( + this._beta * x5[i2] + (1 - this._beta) * (x0 + t4 * dx), + this._beta * y6[i2] + (1 - this._beta) * (y0 + t4 * dy) + ); + } + } + this._x = this._y = null; + this._basis.lineEnd(); + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + this._x.push(+x5); + this._y.push(+y6); + }, "point") + }; + bundle_default = (/* @__PURE__ */ __name((function custom2(beta) { + function bundle(context) { + return beta === 1 ? new Basis(context) : new Bundle(context, beta); + } + __name(bundle, "bundle"); + bundle.beta = function(beta2) { + return custom2(+beta2); + }; + return bundle; + }), "custom"))(0.85); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinal.js + function point3(that, x5, y6) { + that._context.bezierCurveTo( + that._x1 + that._k * (that._x2 - that._x0), + that._y1 + that._k * (that._y2 - that._y0), + that._x2 + that._k * (that._x1 - x5), + that._y2 + that._k * (that._y1 - y6), + that._x2, + that._y2 + ); + } + function Cardinal(context, tension) { + this._context = context; + this._k = (1 - tension) / 6; + } + var cardinal_default; + var init_cardinal = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinal.js"() { + "use strict"; + __name(point3, "point"); + __name(Cardinal, "Cardinal"); + Cardinal.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + point3(this, this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6); + break; + case 1: + this._point = 2; + this._x1 = x5, this._y1 = y6; + break; + case 2: + this._point = 3; + // falls through + default: + point3(this, x5, y6); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6; + }, "point") + }; + cardinal_default = (/* @__PURE__ */ __name((function custom3(tension) { + function cardinal(context) { + return new Cardinal(context, tension); + } + __name(cardinal, "cardinal"); + cardinal.tension = function(tension2) { + return custom3(+tension2); + }; + return cardinal; + }), "custom"))(0); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalClosed.js + function CardinalClosed(context, tension) { + this._context = context; + this._k = (1 - tension) / 6; + } + var cardinalClosed_default; + var init_cardinalClosed = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalClosed.js"() { + "use strict"; + init_noop(); + init_cardinal(); + __name(CardinalClosed, "CardinalClosed"); + CardinalClosed.prototype = { + areaStart: noop_default, + areaEnd: noop_default, + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; + } + } + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x5, this._y3 = y6; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x5, this._y4 = y6); + break; + case 2: + this._point = 3; + this._x5 = x5, this._y5 = y6; + break; + default: + point3(this, x5, y6); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6; + }, "point") + }; + cardinalClosed_default = (/* @__PURE__ */ __name((function custom4(tension) { + function cardinal(context) { + return new CardinalClosed(context, tension); + } + __name(cardinal, "cardinal"); + cardinal.tension = function(tension2) { + return custom4(+tension2); + }; + return cardinal; + }), "custom"))(0); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalOpen.js + function CardinalOpen(context, tension) { + this._context = context; + this._k = (1 - tension) / 6; + } + var cardinalOpen_default; + var init_cardinalOpen = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/cardinalOpen.js"() { + "use strict"; + init_cardinal(); + __name(CardinalOpen, "CardinalOpen"); + CardinalOpen.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point3(this, x5, y6); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6; + }, "point") + }; + cardinalOpen_default = (/* @__PURE__ */ __name((function custom5(tension) { + function cardinal(context) { + return new CardinalOpen(context, tension); + } + __name(cardinal, "cardinal"); + cardinal.tension = function(tension2) { + return custom5(+tension2); + }; + return cardinal; + }), "custom"))(0); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRom.js + function point4(that, x5, y6) { + var x1 = that._x1, y1 = that._y1, x22 = that._x2, y22 = that._y2; + if (that._l01_a > epsilon3) { + var a2 = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n2 = 3 * that._l01_a * (that._l01_a + that._l12_a); + x1 = (x1 * a2 - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n2; + y1 = (y1 * a2 - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n2; + } + if (that._l23_a > epsilon3) { + var b3 = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m3 = 3 * that._l23_a * (that._l23_a + that._l12_a); + x22 = (x22 * b3 + that._x1 * that._l23_2a - x5 * that._l12_2a) / m3; + y22 = (y22 * b3 + that._y1 * that._l23_2a - y6 * that._l12_2a) / m3; + } + that._context.bezierCurveTo(x1, y1, x22, y22, that._x2, that._y2); + } + function CatmullRom(context, alpha) { + this._context = context; + this._alpha = alpha; + } + var catmullRom_default; + var init_catmullRom = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRom.js"() { + "use strict"; + init_math2(); + init_cardinal(); + __name(point4, "point"); + __name(CatmullRom, "CatmullRom"); + CatmullRom.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + this.point(this._x2, this._y2); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + if (this._point) { + var x23 = this._x2 - x5, y23 = this._y2 - y6; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + // falls through + default: + point4(this, x5, y6); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6; + }, "point") + }; + catmullRom_default = (/* @__PURE__ */ __name((function custom6(alpha) { + function catmullRom(context) { + return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); + } + __name(catmullRom, "catmullRom"); + catmullRom.alpha = function(alpha2) { + return custom6(+alpha2); + }; + return catmullRom; + }), "custom"))(0.5); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomClosed.js + function CatmullRomClosed(context, alpha) { + this._context = context; + this._alpha = alpha; + } + var catmullRomClosed_default; + var init_catmullRomClosed = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomClosed.js"() { + "use strict"; + init_cardinalClosed(); + init_noop(); + init_catmullRom(); + __name(CatmullRomClosed, "CatmullRomClosed"); + CatmullRomClosed.prototype = { + areaStart: noop_default, + areaEnd: noop_default, + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; + } + } + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + if (this._point) { + var x23 = this._x2 - x5, y23 = this._y2 - y6; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x5, this._y3 = y6; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x5, this._y4 = y6); + break; + case 2: + this._point = 3; + this._x5 = x5, this._y5 = y6; + break; + default: + point4(this, x5, y6); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6; + }, "point") + }; + catmullRomClosed_default = (/* @__PURE__ */ __name((function custom7(alpha) { + function catmullRom(context) { + return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); + } + __name(catmullRom, "catmullRom"); + catmullRom.alpha = function(alpha2) { + return custom7(+alpha2); + }; + return catmullRom; + }), "custom"))(0.5); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomOpen.js + function CatmullRomOpen(context, alpha) { + this._context = context; + this._alpha = alpha; + } + var catmullRomOpen_default; + var init_catmullRomOpen = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/catmullRomOpen.js"() { + "use strict"; + init_cardinalOpen(); + init_catmullRom(); + __name(CatmullRomOpen, "CatmullRomOpen"); + CatmullRomOpen.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + if (this._point) { + var x23 = this._x2 - x5, y23 = this._y2 - y6; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point4(this, x5, y6); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x5; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y6; + }, "point") + }; + catmullRomOpen_default = (/* @__PURE__ */ __name((function custom8(alpha) { + function catmullRom(context) { + return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); + } + __name(catmullRom, "catmullRom"); + catmullRom.alpha = function(alpha2) { + return custom8(+alpha2); + }; + return catmullRom; + }), "custom"))(0.5); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linearClosed.js + function LinearClosed(context) { + this._context = context; + } + function linearClosed_default(context) { + return new LinearClosed(context); + } + var init_linearClosed = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linearClosed.js"() { + "use strict"; + init_noop(); + __name(LinearClosed, "LinearClosed"); + LinearClosed.prototype = { + areaStart: noop_default, + areaEnd: noop_default, + lineStart: /* @__PURE__ */ __name(function() { + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + if (this._point) this._context.closePath(); + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + if (this._point) this._context.lineTo(x5, y6); + else this._point = 1, this._context.moveTo(x5, y6); + }, "point") + }; + __name(linearClosed_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/monotone.js + function sign(x5) { + return x5 < 0 ? -1 : 1; + } + function slope3(that, x22, y22) { + var h0 = that._x1 - that._x0, h1 = x22 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y22 - that._y1) / (h1 || h0 < 0 && -0), p3 = (s0 * h1 + s1 * h0) / (h0 + h1); + return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p3)) || 0; + } + function slope2(that, t4) { + var h3 = that._x1 - that._x0; + return h3 ? (3 * (that._y1 - that._y0) / h3 - t4) / 2 : t4; + } + function point5(that, t03, t13) { + var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3; + that._context.bezierCurveTo(x0 + dx, y0 + dx * t03, x1 - dx, y1 - dx * t13, x1, y1); + } + function MonotoneX(context) { + this._context = context; + } + function MonotoneY(context) { + this._context = new ReflectContext(context); + } + function ReflectContext(context) { + this._context = context; + } + function monotoneX(context) { + return new MonotoneX(context); + } + function monotoneY(context) { + return new MonotoneY(context); + } + var init_monotone = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/monotone.js"() { + "use strict"; + __name(sign, "sign"); + __name(slope3, "slope3"); + __name(slope2, "slope2"); + __name(point5, "point"); + __name(MonotoneX, "MonotoneX"); + MonotoneX.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x1, this._y1); + break; + case 3: + point5(this, this._t0, slope2(this, this._t0)); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + var t13 = NaN; + x5 = +x5, y6 = +y6; + if (x5 === this._x1 && y6 === this._y1) return; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + point5(this, slope2(this, t13 = slope3(this, x5, y6)), t13); + break; + default: + point5(this, this._t0, t13 = slope3(this, x5, y6)); + break; + } + this._x0 = this._x1, this._x1 = x5; + this._y0 = this._y1, this._y1 = y6; + this._t0 = t13; + }, "point") + }; + __name(MonotoneY, "MonotoneY"); + (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x5, y6) { + MonotoneX.prototype.point.call(this, y6, x5); + }; + __name(ReflectContext, "ReflectContext"); + ReflectContext.prototype = { + moveTo: /* @__PURE__ */ __name(function(x5, y6) { + this._context.moveTo(y6, x5); + }, "moveTo"), + closePath: /* @__PURE__ */ __name(function() { + this._context.closePath(); + }, "closePath"), + lineTo: /* @__PURE__ */ __name(function(x5, y6) { + this._context.lineTo(y6, x5); + }, "lineTo"), + bezierCurveTo: /* @__PURE__ */ __name(function(x1, y1, x22, y22, x5, y6) { + this._context.bezierCurveTo(y1, x1, y22, x22, y6, x5); + }, "bezierCurveTo") + }; + __name(monotoneX, "monotoneX"); + __name(monotoneY, "monotoneY"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/natural.js + function Natural(context) { + this._context = context; + } + function controlPoints(x5) { + var i2, n2 = x5.length - 1, m3, a2 = new Array(n2), b3 = new Array(n2), r2 = new Array(n2); + a2[0] = 0, b3[0] = 2, r2[0] = x5[0] + 2 * x5[1]; + for (i2 = 1; i2 < n2 - 1; ++i2) a2[i2] = 1, b3[i2] = 4, r2[i2] = 4 * x5[i2] + 2 * x5[i2 + 1]; + a2[n2 - 1] = 2, b3[n2 - 1] = 7, r2[n2 - 1] = 8 * x5[n2 - 1] + x5[n2]; + for (i2 = 1; i2 < n2; ++i2) m3 = a2[i2] / b3[i2 - 1], b3[i2] -= m3, r2[i2] -= m3 * r2[i2 - 1]; + a2[n2 - 1] = r2[n2 - 1] / b3[n2 - 1]; + for (i2 = n2 - 2; i2 >= 0; --i2) a2[i2] = (r2[i2] - a2[i2 + 1]) / b3[i2]; + b3[n2 - 1] = (x5[n2] + a2[n2 - 1]) / 2; + for (i2 = 0; i2 < n2 - 1; ++i2) b3[i2] = 2 * x5[i2 + 1] - a2[i2 + 1]; + return [a2, b3]; + } + function natural_default(context) { + return new Natural(context); + } + var init_natural = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/natural.js"() { + "use strict"; + __name(Natural, "Natural"); + Natural.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._x = []; + this._y = []; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + var x5 = this._x, y6 = this._y, n2 = x5.length; + if (n2) { + this._line ? this._context.lineTo(x5[0], y6[0]) : this._context.moveTo(x5[0], y6[0]); + if (n2 === 2) { + this._context.lineTo(x5[1], y6[1]); + } else { + var px = controlPoints(x5), py = controlPoints(y6); + for (var i0 = 0, i1 = 1; i1 < n2; ++i0, ++i1) { + this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x5[i1], y6[i1]); + } + } + } + if (this._line || this._line !== 0 && n2 === 1) this._context.closePath(); + this._line = 1 - this._line; + this._x = this._y = null; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + this._x.push(+x5); + this._y.push(+y6); + }, "point") + }; + __name(controlPoints, "controlPoints"); + __name(natural_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/step.js + function Step(context, t4) { + this._context = context; + this._t = t4; + } + function step_default(context) { + return new Step(context, 0.5); + } + function stepBefore(context) { + return new Step(context, 0); + } + function stepAfter(context) { + return new Step(context, 1); + } + var init_step = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/step.js"() { + "use strict"; + __name(Step, "Step"); + Step.prototype = { + areaStart: /* @__PURE__ */ __name(function() { + this._line = 0; + }, "areaStart"), + areaEnd: /* @__PURE__ */ __name(function() { + this._line = NaN; + }, "areaEnd"), + lineStart: /* @__PURE__ */ __name(function() { + this._x = this._y = NaN; + this._point = 0; + }, "lineStart"), + lineEnd: /* @__PURE__ */ __name(function() { + if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; + }, "lineEnd"), + point: /* @__PURE__ */ __name(function(x5, y6) { + x5 = +x5, y6 = +y6; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x5, y6) : this._context.moveTo(x5, y6); + break; + case 1: + this._point = 2; + // falls through + default: { + if (this._t <= 0) { + this._context.lineTo(this._x, y6); + this._context.lineTo(x5, y6); + } else { + var x1 = this._x * (1 - this._t) + x5 * this._t; + this._context.lineTo(x1, this._y); + this._context.lineTo(x1, y6); + } + break; + } + } + this._x = x5, this._y = y6; + }, "point") + }; + __name(step_default, "default"); + __name(stepBefore, "stepBefore"); + __name(stepAfter, "stepAfter"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/index.js + var init_src30 = __esm({ + "../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/index.js"() { + "use strict"; + init_arc(); + init_line(); + init_pie(); + init_basisClosed2(); + init_basisOpen(); + init_basis2(); + init_bump(); + init_bundle(); + init_cardinalClosed(); + init_cardinalOpen(); + init_cardinal(); + init_catmullRomClosed(); + init_catmullRomOpen(); + init_catmullRom(); + init_linearClosed(); + init_linear2(); + init_monotone(); + init_natural(); + init_step(); + } + }); + + // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/constant.js + var init_constant7 = __esm({ + "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/constant.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/event.js + var init_event2 = __esm({ + "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/event.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js + function Transform(k2, x5, y6) { + this.k = k2; + this.x = x5; + this.y = y6; + } + function transform(node2) { + while (!node2.__zoom) if (!(node2 = node2.parentNode)) return identity3; + return node2.__zoom; + } + var identity3; + var init_transform2 = __esm({ + "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js"() { + "use strict"; + __name(Transform, "Transform"); + Transform.prototype = { + constructor: Transform, + scale: /* @__PURE__ */ __name(function(k2) { + return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y); + }, "scale"), + translate: /* @__PURE__ */ __name(function(x5, y6) { + return x5 === 0 & y6 === 0 ? this : new Transform(this.k, this.x + this.k * x5, this.y + this.k * y6); + }, "translate"), + apply: /* @__PURE__ */ __name(function(point8) { + return [point8[0] * this.k + this.x, point8[1] * this.k + this.y]; + }, "apply"), + applyX: /* @__PURE__ */ __name(function(x5) { + return x5 * this.k + this.x; + }, "applyX"), + applyY: /* @__PURE__ */ __name(function(y6) { + return y6 * this.k + this.y; + }, "applyY"), + invert: /* @__PURE__ */ __name(function(location) { + return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k]; + }, "invert"), + invertX: /* @__PURE__ */ __name(function(x5) { + return (x5 - this.x) / this.k; + }, "invertX"), + invertY: /* @__PURE__ */ __name(function(y6) { + return (y6 - this.y) / this.k; + }, "invertY"), + rescaleX: /* @__PURE__ */ __name(function(x5) { + return x5.copy().domain(x5.range().map(this.invertX, this).map(x5.invert, x5)); + }, "rescaleX"), + rescaleY: /* @__PURE__ */ __name(function(y6) { + return y6.copy().domain(y6.range().map(this.invertY, this).map(y6.invert, y6)); + }, "rescaleY"), + toString: /* @__PURE__ */ __name(function() { + return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")"; + }, "toString") + }; + identity3 = new Transform(1, 0, 0); + transform.prototype = Transform.prototype; + __name(transform, "transform"); + } + }); + + // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/noevent.js + var init_noevent2 = __esm({ + "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/noevent.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/zoom.js + var init_zoom = __esm({ + "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/zoom.js"() { + "use strict"; + init_src11(); + init_constant7(); + init_event2(); + init_transform2(); + init_noevent2(); + } + }); + + // ../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/index.js + var init_src31 = __esm({ + "../../node_modules/.pnpm/d3-zoom@3.0.0/node_modules/d3-zoom/src/index.js"() { + "use strict"; + init_zoom(); + init_transform2(); + } + }); + + // ../../node_modules/.pnpm/d3@7.9.0/node_modules/d3/src/index.js + var init_src32 = __esm({ + "../../node_modules/.pnpm/d3@7.9.0/node_modules/d3/src/index.js"() { + "use strict"; + init_src2(); + init_src3(); + init_src12(); + init_src14(); + init_src7(); + init_src15(); + init_src16(); + init_src4(); + init_src6(); + init_src17(); + init_src10(); + init_src18(); + init_src20(); + init_src21(); + init_src22(); + init_src23(); + init_src8(); + init_src13(); + init_src24(); + init_src19(); + init_src25(); + init_src28(); + init_src29(); + init_src5(); + init_src30(); + init_src26(); + init_src27(); + init_src9(); + init_src11(); + init_src31(); + } + }); + + // ../../node_modules/.pnpm/@braintree+sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/constants.js + var require_constants = __commonJS({ + "../../node_modules/.pnpm/@braintree+sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/constants.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BLANK_URL = exports2.relativeFirstCharacters = exports2.whitespaceEscapeCharsRegex = exports2.urlSchemeRegex = exports2.ctrlCharactersRegex = exports2.htmlCtrlEntityRegex = exports2.htmlEntitiesRegex = exports2.invalidProtocolRegex = void 0; + exports2.invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im; + exports2.htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g; + exports2.htmlCtrlEntityRegex = /&(newline|tab);/gi; + exports2.ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim; + exports2.urlSchemeRegex = /^.+(:|:)/gim; + exports2.whitespaceEscapeCharsRegex = /(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g; + exports2.relativeFirstCharacters = [".", "/"]; + exports2.BLANK_URL = "about:blank"; + } + }); + + // ../../node_modules/.pnpm/@braintree+sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.js + var require_dist = __commonJS({ + "../../node_modules/.pnpm/@braintree+sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.sanitizeUrl = void 0; + var constants_1 = require_constants(); + function isRelativeUrlWithoutProtocol(url) { + return constants_1.relativeFirstCharacters.indexOf(url[0]) > -1; + } + __name(isRelativeUrlWithoutProtocol, "isRelativeUrlWithoutProtocol"); + function decodeHtmlCharacters(str2) { + var removedNullByte = str2.replace(constants_1.ctrlCharactersRegex, ""); + return removedNullByte.replace(constants_1.htmlEntitiesRegex, function(match3, dec) { + return String.fromCharCode(dec); + }); + } + __name(decodeHtmlCharacters, "decodeHtmlCharacters"); + function isValidUrl(url) { + return URL.canParse(url); + } + __name(isValidUrl, "isValidUrl"); + function decodeURI(uri) { + try { + return decodeURIComponent(uri); + } catch (e3) { + return uri; + } + } + __name(decodeURI, "decodeURI"); + function sanitizeUrl6(url) { + if (!url) { + return constants_1.BLANK_URL; + } + var charsToDecode; + var decodedUrl = decodeURI(url.trim()); + do { + decodedUrl = decodeHtmlCharacters(decodedUrl).replace(constants_1.htmlCtrlEntityRegex, "").replace(constants_1.ctrlCharactersRegex, "").replace(constants_1.whitespaceEscapeCharsRegex, "").trim(); + decodedUrl = decodeURI(decodedUrl); + charsToDecode = decodedUrl.match(constants_1.ctrlCharactersRegex) || decodedUrl.match(constants_1.htmlEntitiesRegex) || decodedUrl.match(constants_1.htmlCtrlEntityRegex) || decodedUrl.match(constants_1.whitespaceEscapeCharsRegex); + } while (charsToDecode && charsToDecode.length > 0); + var sanitizedUrl = decodedUrl; + if (!sanitizedUrl) { + return constants_1.BLANK_URL; + } + if (isRelativeUrlWithoutProtocol(sanitizedUrl)) { + return sanitizedUrl; + } + var trimmedUrl = sanitizedUrl.trimStart(); + var urlSchemeParseResults = trimmedUrl.match(constants_1.urlSchemeRegex); + if (!urlSchemeParseResults) { + return sanitizedUrl; + } + var urlScheme = urlSchemeParseResults[0].toLowerCase().trim(); + if (constants_1.invalidProtocolRegex.test(urlScheme)) { + return constants_1.BLANK_URL; + } + var backSanitized = trimmedUrl.replace(/\\/g, "/"); + if (urlScheme === "mailto:" || urlScheme.includes("://")) { + return backSanitized; + } + if (urlScheme === "http:" || urlScheme === "https:") { + if (!isValidUrl(backSanitized)) { + return constants_1.BLANK_URL; + } + var url_1 = new URL(backSanitized); + url_1.protocol = url_1.protocol.toLowerCase(); + url_1.hostname = url_1.hostname.toLowerCase(); + return url_1.toString(); + } + return backSanitized; + } + __name(sanitizeUrl6, "sanitizeUrl"); + exports2.sanitizeUrl = sanitizeUrl6; + } + }); + + // src/diagrams/common/svgDrawCommon.ts + var import_sanitize_url, drawRect, drawBackgroundRect, drawText, drawImage, drawEmbeddedImage, getNoteRect, getTextObj, createTooltip; + var init_svgDrawCommon = __esm({ + "src/diagrams/common/svgDrawCommon.ts"() { + "use strict"; + import_sanitize_url = __toESM(require_dist(), 1); + init_src32(); + init_common(); + drawRect = /* @__PURE__ */ __name((element3, rectData) => { + const rectElement = element3.append("rect"); + rectElement.attr("x", rectData.x); + rectElement.attr("y", rectData.y); + rectElement.attr("fill", rectData.fill); + rectElement.attr("stroke", rectData.stroke); + rectElement.attr("width", rectData.width); + rectElement.attr("height", rectData.height); + if (rectData.name) { + rectElement.attr("name", rectData.name); + } + if (rectData.rx) { + rectElement.attr("rx", rectData.rx); + } + if (rectData.ry) { + rectElement.attr("ry", rectData.ry); + } + if (rectData.attrs !== void 0) { + for (const attrKey in rectData.attrs) { + rectElement.attr(attrKey, rectData.attrs[attrKey]); + } + } + if (rectData.class) { + rectElement.attr("class", rectData.class); + } + return rectElement; + }, "drawRect"); + drawBackgroundRect = /* @__PURE__ */ __name((element3, bounds4) => { + const rectData = { + x: bounds4.startx, + y: bounds4.starty, + width: bounds4.stopx - bounds4.startx, + height: bounds4.stopy - bounds4.starty, + fill: bounds4.fill, + stroke: bounds4.stroke, + class: "rect" + }; + const rectElement = drawRect(element3, rectData); + rectElement.lower(); + }, "drawBackgroundRect"); + drawText = /* @__PURE__ */ __name((element3, textData) => { + const nText = textData.text.replace(lineBreakRegex, " "); + const textElem = element3.append("text"); + textElem.attr("x", textData.x); + textElem.attr("y", textData.y); + textElem.attr("class", "legend"); + textElem.style("text-anchor", textData.anchor); + if (textData.class) { + textElem.attr("class", textData.class); + } + const tspan = textElem.append("tspan"); + tspan.attr("x", textData.x + textData.textMargin * 2); + tspan.text(nText); + return textElem; + }, "drawText"); + drawImage = /* @__PURE__ */ __name((elem, x5, y6, link2) => { + const imageElement = elem.append("image"); + imageElement.attr("x", x5); + imageElement.attr("y", y6); + const sanitizedLink = (0, import_sanitize_url.sanitizeUrl)(link2); + imageElement.attr("xlink:href", sanitizedLink); + }, "drawImage"); + drawEmbeddedImage = /* @__PURE__ */ __name((element3, x5, y6, link2) => { + const imageElement = element3.append("use"); + imageElement.attr("x", x5); + imageElement.attr("y", y6); + const sanitizedLink = (0, import_sanitize_url.sanitizeUrl)(link2); + imageElement.attr("xlink:href", `#${sanitizedLink}`); + }, "drawEmbeddedImage"); + getNoteRect = /* @__PURE__ */ __name(() => { + const noteRectData = { + x: 0, + y: 0, + width: 100, + height: 100, + fill: "#EDF2AE", + stroke: "#666", + anchor: "start", + rx: 0, + ry: 0 + }; + return noteRectData; + }, "getNoteRect"); + getTextObj = /* @__PURE__ */ __name(() => { + const testObject = { + x: 0, + y: 0, + width: 100, + height: 100, + "text-anchor": "start", + style: "#666", + textMargin: 0, + rx: 0, + ry: 0, + tspan: true + }; + return testObject; + }, "getTextObj"); + createTooltip = /* @__PURE__ */ __name(() => { + let tooltipElem = select_default2(".mermaidTooltip"); + if (tooltipElem.empty()) { + tooltipElem = select_default2("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0).style("position", "absolute").style("text-align", "center").style("max-width", "200px").style("padding", "2px").style("font-size", "12px").style("background", "#ffffde").style("border", "1px solid #333").style("border-radius", "2px").style("pointer-events", "none").style("z-index", "100"); + } + return tooltipElem; + }, "createTooltip"); + } + }); + + // src/diagrams/c4/svgDraw.js + var import_sanitize_url2, drawRect2, drawImage2, drawRels, drawBoundary, drawC4Shape, insertDatabaseIcon, insertComputerIcon, insertClockIcon, insertArrowHead, insertArrowEnd, insertArrowFilledHead, insertArrowCrossHead, getC4ShapeFont, _drawTextCandidateFunc, svgDraw_default; + var init_svgDraw = __esm({ + "src/diagrams/c4/svgDraw.js"() { + "use strict"; + init_common(); + init_svgDrawCommon(); + import_sanitize_url2 = __toESM(require_dist(), 1); + drawRect2 = /* @__PURE__ */ __name(function(elem, rectData) { + return drawRect(elem, rectData); + }, "drawRect"); + drawImage2 = /* @__PURE__ */ __name(function(elem, width3, height2, x5, y6, link2) { + const imageElem = elem.append("image"); + imageElem.attr("width", width3); + imageElem.attr("height", height2); + imageElem.attr("x", x5); + imageElem.attr("y", y6); + let sanitizedLink = link2.startsWith("data:image/png;base64") ? link2 : (0, import_sanitize_url2.sanitizeUrl)(link2); + imageElem.attr("xlink:href", sanitizedLink); + }, "drawImage"); + drawRels = /* @__PURE__ */ __name((elem, rels2, conf5, diagramId3) => { + const relsElem = elem.append("g"); + let i2 = 0; + for (let rel2 of rels2) { + let textColor = rel2.textColor ? rel2.textColor : "#444444"; + let strokeColor = rel2.lineColor ? rel2.lineColor : "#444444"; + let offsetX = rel2.offsetX ? parseInt(rel2.offsetX) : 0; + let offsetY = rel2.offsetY ? parseInt(rel2.offsetY) : 0; + let url = ""; + if (i2 === 0) { + let line2 = relsElem.append("line"); + line2.attr("x1", rel2.startPoint.x); + line2.attr("y1", rel2.startPoint.y); + line2.attr("x2", rel2.endPoint.x); + line2.attr("y2", rel2.endPoint.y); + line2.attr("stroke-width", "1"); + line2.attr("stroke", strokeColor); + line2.style("fill", "none"); + if (rel2.type !== "rel_b") { + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-arrowhead)"); + } + if (rel2.type === "birel" || rel2.type === "rel_b") { + line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-arrowend)"); + } + i2 = -1; + } else { + let line2 = relsElem.append("path"); + line2.attr("fill", "none").attr("stroke-width", "1").attr("stroke", strokeColor).attr( + "d", + "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", rel2.startPoint.x).replaceAll("starty", rel2.startPoint.y).replaceAll( + "controlx", + rel2.startPoint.x + (rel2.endPoint.x - rel2.startPoint.x) / 2 - (rel2.endPoint.x - rel2.startPoint.x) / 4 + ).replaceAll("controly", rel2.startPoint.y + (rel2.endPoint.y - rel2.startPoint.y) / 2).replaceAll("stopx", rel2.endPoint.x).replaceAll("stopy", rel2.endPoint.y) + ); + if (rel2.type !== "rel_b") { + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-arrowhead)"); + } + if (rel2.type === "birel" || rel2.type === "rel_b") { + line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-arrowend)"); + } + } + let messageConf = conf5.messageFont(); + _drawTextCandidateFunc(conf5)( + rel2.label.text, + relsElem, + Math.min(rel2.startPoint.x, rel2.endPoint.x) + Math.abs(rel2.endPoint.x - rel2.startPoint.x) / 2 + offsetX, + Math.min(rel2.startPoint.y, rel2.endPoint.y) + Math.abs(rel2.endPoint.y - rel2.startPoint.y) / 2 + offsetY, + rel2.label.width, + rel2.label.height, + { fill: textColor }, + messageConf + ); + if (rel2.techn && rel2.techn.text !== "") { + messageConf = conf5.messageFont(); + _drawTextCandidateFunc(conf5)( + "[" + rel2.techn.text + "]", + relsElem, + Math.min(rel2.startPoint.x, rel2.endPoint.x) + Math.abs(rel2.endPoint.x - rel2.startPoint.x) / 2 + offsetX, + Math.min(rel2.startPoint.y, rel2.endPoint.y) + Math.abs(rel2.endPoint.y - rel2.startPoint.y) / 2 + conf5.messageFontSize + 5 + offsetY, + Math.max(rel2.label.width, rel2.techn.width), + rel2.techn.height, + { fill: textColor, "font-style": "italic" }, + messageConf + ); + } + } + }, "drawRels"); + drawBoundary = /* @__PURE__ */ __name(function(elem, boundary, conf5) { + const boundaryElem = elem.append("g"); + let fillColor = boundary.bgColor ? boundary.bgColor : "none"; + let strokeColor = boundary.borderColor ? boundary.borderColor : "#444444"; + let fontColor = boundary.fontColor ? boundary.fontColor : "black"; + let attrsValue = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" }; + if (boundary.nodeType) { + attrsValue = { "stroke-width": 1 }; + } + let rectData = { + x: boundary.x, + y: boundary.y, + fill: fillColor, + stroke: strokeColor, + width: boundary.width, + height: boundary.height, + rx: 2.5, + ry: 2.5, + attrs: attrsValue + }; + drawRect2(boundaryElem, rectData); + let boundaryConf = conf5.boundaryFont(); + boundaryConf.fontWeight = "bold"; + boundaryConf.fontSize = boundaryConf.fontSize + 2; + boundaryConf.fontColor = fontColor; + _drawTextCandidateFunc(conf5)( + boundary.label.text, + boundaryElem, + boundary.x, + boundary.y + boundary.label.Y, + boundary.width, + boundary.height, + { fill: "#444444" }, + boundaryConf + ); + if (boundary.type && boundary.type.text !== "") { + boundaryConf = conf5.boundaryFont(); + boundaryConf.fontColor = fontColor; + _drawTextCandidateFunc(conf5)( + boundary.type.text, + boundaryElem, + boundary.x, + boundary.y + boundary.type.Y, + boundary.width, + boundary.height, + { fill: "#444444" }, + boundaryConf + ); + } + if (boundary.descr && boundary.descr.text !== "") { + boundaryConf = conf5.boundaryFont(); + boundaryConf.fontSize = boundaryConf.fontSize - 2; + boundaryConf.fontColor = fontColor; + _drawTextCandidateFunc(conf5)( + boundary.descr.text, + boundaryElem, + boundary.x, + boundary.y + boundary.descr.Y, + boundary.width, + boundary.height, + { fill: "#444444" }, + boundaryConf + ); + } + }, "drawBoundary"); + drawC4Shape = /* @__PURE__ */ __name(function(elem, c4Shape, conf5) { + let fillColor = c4Shape.bgColor ? c4Shape.bgColor : conf5[c4Shape.typeC4Shape.text + "_bg_color"]; + let strokeColor = c4Shape.borderColor ? c4Shape.borderColor : conf5[c4Shape.typeC4Shape.text + "_border_color"]; + let fontColor = c4Shape.fontColor ? c4Shape.fontColor : "#FFFFFF"; + let personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII="; + switch (c4Shape.typeC4Shape.text) { + case "person": + personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII="; + break; + case "external_person": + personImg = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII="; + break; + } + const c4ShapeElem = elem.append("g"); + c4ShapeElem.attr("class", "person-man"); + const rect3 = getNoteRect(); + switch (c4Shape.typeC4Shape.text) { + case "person": + case "external_person": + case "system": + case "external_system": + case "container": + case "external_container": + case "component": + case "external_component": + rect3.x = c4Shape.x; + rect3.y = c4Shape.y; + rect3.fill = fillColor; + rect3.width = c4Shape.width; + rect3.height = c4Shape.height; + rect3.stroke = strokeColor; + rect3.rx = 2.5; + rect3.ry = 2.5; + rect3.attrs = { "stroke-width": 0.5 }; + drawRect2(c4ShapeElem, rect3); + break; + case "system_db": + case "external_system_db": + case "container_db": + case "external_container_db": + case "component_db": + case "external_component_db": + c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr( + "d", + "Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2).replaceAll("height", c4Shape.height) + ); + c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr( + "d", + "Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.width / 2) + ); + break; + case "system_queue": + case "external_system_queue": + case "container_queue": + case "external_container_queue": + case "component_queue": + case "external_component_queue": + c4ShapeElem.append("path").attr("fill", fillColor).attr("stroke-width", "0.5").attr("stroke", strokeColor).attr( + "d", + "Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx", c4Shape.x).replaceAll("starty", c4Shape.y).replaceAll("width", c4Shape.width).replaceAll("half", c4Shape.height / 2) + ); + c4ShapeElem.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", strokeColor).attr( + "d", + "Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx", c4Shape.x + c4Shape.width).replaceAll("starty", c4Shape.y).replaceAll("half", c4Shape.height / 2) + ); + break; + } + let c4ShapeFontConf = getC4ShapeFont(conf5, c4Shape.typeC4Shape.text); + c4ShapeElem.append("text").attr("fill", fontColor).attr("font-family", c4ShapeFontConf.fontFamily).attr("font-size", c4ShapeFontConf.fontSize - 2).attr("font-style", "italic").attr("lengthAdjust", "spacing").attr("textLength", c4Shape.typeC4Shape.width).attr("x", c4Shape.x + c4Shape.width / 2 - c4Shape.typeC4Shape.width / 2).attr("y", c4Shape.y + c4Shape.typeC4Shape.Y).text("<<" + c4Shape.typeC4Shape.text + ">>"); + switch (c4Shape.typeC4Shape.text) { + case "person": + case "external_person": + drawImage2( + c4ShapeElem, + 48, + 48, + c4Shape.x + c4Shape.width / 2 - 24, + c4Shape.y + c4Shape.image.Y, + personImg + ); + break; + } + let textFontConf = conf5[c4Shape.typeC4Shape.text + "Font"](); + textFontConf.fontWeight = "bold"; + textFontConf.fontSize = textFontConf.fontSize + 2; + textFontConf.fontColor = fontColor; + _drawTextCandidateFunc(conf5)( + c4Shape.label.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.label.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor }, + textFontConf + ); + textFontConf = conf5[c4Shape.typeC4Shape.text + "Font"](); + textFontConf.fontColor = fontColor; + if (c4Shape.techn && c4Shape.techn?.text !== "") { + _drawTextCandidateFunc(conf5)( + c4Shape.techn.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.techn.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor, "font-style": "italic" }, + textFontConf + ); + } else if (c4Shape.type && c4Shape.type.text !== "") { + _drawTextCandidateFunc(conf5)( + c4Shape.type.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.type.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor, "font-style": "italic" }, + textFontConf + ); + } + if (c4Shape.descr && c4Shape.descr.text !== "") { + textFontConf = conf5.personFont(); + textFontConf.fontColor = fontColor; + _drawTextCandidateFunc(conf5)( + c4Shape.descr.text, + c4ShapeElem, + c4Shape.x, + c4Shape.y + c4Shape.descr.Y, + c4Shape.width, + c4Shape.height, + { fill: fontColor }, + textFontConf + ); + } + return c4Shape.height; + }, "drawC4Shape"); + insertDatabaseIcon = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("symbol").attr("id", id35 + "-database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr( + "d", + "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z" + ); + }, "insertDatabaseIcon"); + insertComputerIcon = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("symbol").attr("id", id35 + "-computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr( + "d", + "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z" + ); + }, "insertComputerIcon"); + insertClockIcon = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("symbol").attr("id", id35 + "-clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr( + "d", + "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z" + ); + }, "insertClockIcon"); + insertArrowHead = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-arrowhead").attr("refX", 9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z"); + }, "insertArrowHead"); + insertArrowEnd = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-arrowend").attr("refX", 1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z"); + }, "insertArrowEnd"); + insertArrowFilledHead = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-filled-head").attr("refX", 18).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z"); + }, "insertArrowFilledHead"); + insertArrowCrossHead = /* @__PURE__ */ __name(function(elem, id35) { + const defs2 = elem.append("defs"); + const marker = defs2.append("marker").attr("id", id35 + "-crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4); + marker.append("path").attr("fill", "black").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 9,2 V 6 L16,4 Z"); + marker.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 0,1 L 6,7 M 6,1 L 0,7"); + }, "insertArrowCrossHead"); + getC4ShapeFont = /* @__PURE__ */ __name((cnf, typeC4Shape) => { + return { + fontFamily: cnf[typeC4Shape + "FontFamily"], + fontSize: cnf[typeC4Shape + "FontSize"], + fontWeight: cnf[typeC4Shape + "FontWeight"] + }; + }, "getC4ShapeFont"); + _drawTextCandidateFunc = /* @__PURE__ */ (function() { + function byText(content, g2, x5, y6, width3, height2, textAttrs) { + const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6 + height2 / 2 + 5).style("text-anchor", "middle").text(content); + _setTextAttrs(text4, textAttrs); + } + __name(byText, "byText"); + function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5) { + const { fontSize, fontFamily, fontWeight } = conf5; + const lines = content.split(common_default.lineBreakRegex); + for (let i2 = 0; i2 < lines.length; i2++) { + const dy = i2 * fontSize - fontSize * (lines.length - 1) / 2; + const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", fontSize).style("font-weight", fontWeight).style("font-family", fontFamily); + text4.append("tspan").attr("dy", dy).text(lines[i2]).attr("alignment-baseline", "mathematical"); + _setTextAttrs(text4, textAttrs); + } + } + __name(byTspan, "byTspan"); + function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) { + const s2 = g2.append("switch"); + const f2 = s2.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2); + const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text4.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content); + byTspan(content, s2, x5, y6, width3, height2, textAttrs, conf5); + _setTextAttrs(text4, textAttrs); + } + __name(byFo, "byFo"); + function _setTextAttrs(toText, fromTextAttrsDict) { + for (const key in fromTextAttrsDict) { + if (fromTextAttrsDict.hasOwnProperty(key)) { + toText.attr(key, fromTextAttrsDict[key]); + } + } + } + __name(_setTextAttrs, "_setTextAttrs"); + return function(conf5) { + return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan; + }; + })(); + svgDraw_default = { + drawRect: drawRect2, + drawBoundary, + drawC4Shape, + drawRels, + drawImage: drawImage2, + insertArrowHead, + insertArrowEnd, + insertArrowFilledHead, + insertArrowCrossHead, + insertDatabaseIcon, + insertComputerIcon, + insertClockIcon + }; + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isLength.mjs + function isLength(value2) { + return Number.isSafeInteger(value2) && value2 >= 0; + } + var init_isLength = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isLength.mjs"() { + "use strict"; + __name(isLength, "isLength"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs + function isArrayLike(value2) { + return value2 != null && typeof value2 !== "function" && isLength(value2.length); + } + var init_isArrayLike = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs"() { + "use strict"; + init_isLength(); + __name(isArrayLike, "isArrayLike"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs + function isUnsafeProperty(key) { + return key === "__proto__"; + } + var init_isUnsafeProperty = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs"() { + "use strict"; + __name(isUnsafeProperty, "isUnsafeProperty"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs + function isPrimitive(value2) { + return value2 == null || typeof value2 !== "object" && typeof value2 !== "function"; + } + var init_isPrimitive = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs"() { + "use strict"; + __name(isPrimitive, "isPrimitive"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs + function getSymbols(object3) { + return Object.getOwnPropertySymbols(object3).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object3, symbol)); + } + var init_getSymbols = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs"() { + "use strict"; + __name(getSymbols, "getSymbols"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs + function getTag(value2) { + if (value2 == null) { + return value2 === void 0 ? "[object Undefined]" : "[object Null]"; + } + return Object.prototype.toString.call(value2); + } + var init_getTag = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs"() { + "use strict"; + __name(getTag, "getTag"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/tags.mjs + var regexpTag, stringTag, numberTag, booleanTag, argumentsTag, symbolTag, dateTag, mapTag, setTag, arrayTag, arrayBufferTag, objectTag, dataViewTag, uint8ArrayTag, uint8ClampedArrayTag, uint16ArrayTag, uint32ArrayTag, int8ArrayTag, int16ArrayTag, int32ArrayTag, float32ArrayTag, float64ArrayTag; + var init_tags = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/tags.mjs"() { + "use strict"; + regexpTag = "[object RegExp]"; + stringTag = "[object String]"; + numberTag = "[object Number]"; + booleanTag = "[object Boolean]"; + argumentsTag = "[object Arguments]"; + symbolTag = "[object Symbol]"; + dateTag = "[object Date]"; + mapTag = "[object Map]"; + setTag = "[object Set]"; + arrayTag = "[object Array]"; + arrayBufferTag = "[object ArrayBuffer]"; + objectTag = "[object Object]"; + dataViewTag = "[object DataView]"; + uint8ArrayTag = "[object Uint8Array]"; + uint8ClampedArrayTag = "[object Uint8ClampedArray]"; + uint16ArrayTag = "[object Uint16Array]"; + uint32ArrayTag = "[object Uint32Array]"; + int8ArrayTag = "[object Int8Array]"; + int16ArrayTag = "[object Int16Array]"; + int32ArrayTag = "[object Int32Array]"; + float32ArrayTag = "[object Float32Array]"; + float64ArrayTag = "[object Float64Array]"; + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs + function isTypedArray(x5) { + return ArrayBuffer.isView(x5) && !(x5 instanceof DataView); + } + var init_isTypedArray = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs"() { + "use strict"; + __name(isTypedArray, "isTypedArray"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/cloneDeepWith.mjs + function cloneDeepWith(obj, cloneValue) { + return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), cloneValue); + } + function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = /* @__PURE__ */ new Map(), cloneValue = void 0) { + const cloned = cloneValue?.(valueToClone, keyToClone, objectToClone, stack); + if (cloned !== void 0) { + return cloned; + } + if (isPrimitive(valueToClone)) { + return valueToClone; + } + if (stack.has(valueToClone)) { + return stack.get(valueToClone); + } + if (Array.isArray(valueToClone)) { + const result = new Array(valueToClone.length); + stack.set(valueToClone, result); + for (let i2 = 0; i2 < valueToClone.length; i2++) { + result[i2] = cloneDeepWithImpl(valueToClone[i2], i2, objectToClone, stack, cloneValue); + } + if (Object.hasOwn(valueToClone, "index")) { + result.index = valueToClone.index; + } + if (Object.hasOwn(valueToClone, "input")) { + result.input = valueToClone.input; + } + return result; + } + if (valueToClone instanceof Date) { + return new Date(valueToClone.getTime()); + } + if (valueToClone instanceof RegExp) { + const result = new RegExp(valueToClone.source, valueToClone.flags); + result.lastIndex = valueToClone.lastIndex; + return result; + } + if (valueToClone instanceof Map) { + const result = /* @__PURE__ */ new Map(); + stack.set(valueToClone, result); + for (const [key, value2] of valueToClone) { + result.set(key, cloneDeepWithImpl(value2, key, objectToClone, stack, cloneValue)); + } + return result; + } + if (valueToClone instanceof Set) { + const result = /* @__PURE__ */ new Set(); + stack.set(valueToClone, result); + for (const value2 of valueToClone) { + result.add(cloneDeepWithImpl(value2, void 0, objectToClone, stack, cloneValue)); + } + return result; + } + if (typeof Buffer !== "undefined" && Buffer.isBuffer(valueToClone)) { + return valueToClone.subarray(); + } + if (isTypedArray(valueToClone)) { + const result = new (Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length); + stack.set(valueToClone, result); + for (let i2 = 0; i2 < valueToClone.length; i2++) { + result[i2] = cloneDeepWithImpl(valueToClone[i2], i2, objectToClone, stack, cloneValue); + } + return result; + } + if (valueToClone instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && valueToClone instanceof SharedArrayBuffer) { + return valueToClone.slice(0); + } + if (valueToClone instanceof DataView) { + const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength); + stack.set(valueToClone, result); + copyProperties(result, valueToClone, objectToClone, stack, cloneValue); + return result; + } + if (typeof File !== "undefined" && valueToClone instanceof File) { + const result = new File([valueToClone], valueToClone.name, { + type: valueToClone.type + }); + stack.set(valueToClone, result); + copyProperties(result, valueToClone, objectToClone, stack, cloneValue); + return result; + } + if (typeof Blob !== "undefined" && valueToClone instanceof Blob) { + const result = new Blob([valueToClone], { type: valueToClone.type }); + stack.set(valueToClone, result); + copyProperties(result, valueToClone, objectToClone, stack, cloneValue); + return result; + } + if (valueToClone instanceof Error) { + const result = structuredClone(valueToClone); + stack.set(valueToClone, result); + result.message = valueToClone.message; + result.name = valueToClone.name; + result.stack = valueToClone.stack; + result.cause = valueToClone.cause; + result.constructor = valueToClone.constructor; + copyProperties(result, valueToClone, objectToClone, stack, cloneValue); + return result; + } + if (valueToClone instanceof Boolean) { + const result = new Boolean(valueToClone.valueOf()); + stack.set(valueToClone, result); + copyProperties(result, valueToClone, objectToClone, stack, cloneValue); + return result; + } + if (valueToClone instanceof Number) { + const result = new Number(valueToClone.valueOf()); + stack.set(valueToClone, result); + copyProperties(result, valueToClone, objectToClone, stack, cloneValue); + return result; + } + if (valueToClone instanceof String) { + const result = new String(valueToClone.valueOf()); + stack.set(valueToClone, result); + copyProperties(result, valueToClone, objectToClone, stack, cloneValue); + return result; + } + if (typeof valueToClone === "object" && isCloneableObject(valueToClone)) { + const result = Object.create(Object.getPrototypeOf(valueToClone)); + stack.set(valueToClone, result); + copyProperties(result, valueToClone, objectToClone, stack, cloneValue); + return result; + } + return valueToClone; + } + function copyProperties(target, source, objectToClone = target, stack, cloneValue) { + const keys3 = [...Object.keys(source), ...getSymbols(source)]; + for (let i2 = 0; i2 < keys3.length; i2++) { + const key = keys3[i2]; + const descriptor = Object.getOwnPropertyDescriptor(target, key); + if (descriptor == null || descriptor.writable) { + target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue); + } + } + } + function isCloneableObject(object3) { + switch (getTag(object3)) { + case argumentsTag: + case arrayTag: + case arrayBufferTag: + case dataViewTag: + case booleanTag: + case dateTag: + case float32ArrayTag: + case float64ArrayTag: + case int8ArrayTag: + case int16ArrayTag: + case int32ArrayTag: + case mapTag: + case numberTag: + case objectTag: + case regexpTag: + case setTag: + case stringTag: + case symbolTag: + case uint8ArrayTag: + case uint8ClampedArrayTag: + case uint16ArrayTag: + case uint32ArrayTag: { + return true; + } + default: { + return false; + } + } + } + var init_cloneDeepWith = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/cloneDeepWith.mjs"() { + "use strict"; + init_getSymbols(); + init_getTag(); + init_tags(); + init_isPrimitive(); + init_isTypedArray(); + __name(cloneDeepWith, "cloneDeepWith"); + __name(cloneDeepWithImpl, "cloneDeepWithImpl"); + __name(copyProperties, "copyProperties"); + __name(isCloneableObject, "isCloneableObject"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.mjs + function cloneDeepWith2(obj, customizer) { + return cloneDeepWith(obj, (value2, key, object3, stack) => { + const cloned = customizer?.(value2, key, object3, stack); + if (cloned !== void 0) { + return cloned; + } + if (typeof obj !== "object") { + return void 0; + } + if (getTag(obj) === objectTag && typeof obj.constructor !== "function") { + const result = {}; + stack.set(obj, result); + copyProperties(result, obj, object3, stack); + return result; + } + switch (Object.prototype.toString.call(obj)) { + case numberTag: + case stringTag: + case booleanTag: { + const result = new obj.constructor(obj?.valueOf()); + copyProperties(result, obj); + return result; + } + case argumentsTag: { + const result = {}; + copyProperties(result, obj); + result.length = obj.length; + result[Symbol.iterator] = obj[Symbol.iterator]; + return result; + } + default: { + return void 0; + } + } + }); + } + var init_cloneDeepWith2 = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.mjs"() { + "use strict"; + init_cloneDeepWith(); + init_getTag(); + init_tags(); + __name(cloneDeepWith2, "cloneDeepWith"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/cloneDeep.mjs + function cloneDeep(obj) { + return cloneDeepWith2(obj); + } + var init_cloneDeep = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/cloneDeep.mjs"() { + "use strict"; + init_cloneDeepWith2(); + __name(cloneDeep, "cloneDeep"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs + function isArguments(value2) { + return value2 !== null && typeof value2 === "object" && getTag(value2) === "[object Arguments]"; + } + var init_isArguments = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs"() { + "use strict"; + init_getTag(); + __name(isArguments, "isArguments"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs + function isObjectLike(value2) { + return typeof value2 === "object" && value2 !== null; + } + var init_isObjectLike = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs"() { + "use strict"; + __name(isObjectLike, "isObjectLike"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.mjs + function isArrayLikeObject(value2) { + return isObjectLike(value2) && isArrayLike(value2); + } + var init_isArrayLikeObject = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.mjs"() { + "use strict"; + init_isArrayLike(); + init_isObjectLike(); + __name(isArrayLikeObject, "isArrayLikeObject"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArray.mjs + function isArray(value2) { + return Array.isArray(value2); + } + var init_isArray = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isArray.mjs"() { + "use strict"; + __name(isArray, "isArray"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/function/memoize.mjs + function memoize(func, resolver3) { + if (typeof func !== "function" || resolver3 != null && typeof resolver3 !== "function") { + throw new TypeError("Expected a function"); + } + const memoized = /* @__PURE__ */ __name(function(...args) { + const key = resolver3 ? resolver3.apply(this, args) : args[0]; + const cache3 = memoized.cache; + if (cache3.has(key)) { + return cache3.get(key); + } + const result = func.apply(this, args); + memoized.cache = cache3.set(key, result) || cache3; + return result; + }, "memoized"); + const CacheConstructor = memoize.Cache || Map; + memoized.cache = new CacheConstructor(); + return memoized; + } + var init_memoize = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/function/memoize.mjs"() { + "use strict"; + __name(memoize, "memoize"); + memoize.Cache = Map; + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/noop.mjs + function noop2() { + } + var init_noop2 = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/function/noop.mjs"() { + "use strict"; + __name(noop2, "noop"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs + function isPrototype(value2) { + const constructor = value2?.constructor; + const prototype = typeof constructor === "function" ? constructor.prototype : Object.prototype; + return value2 === prototype; + } + var init_isPrototype = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs"() { + "use strict"; + __name(isPrototype, "isPrototype"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs + function isTypedArray2(x5) { + return isTypedArray(x5); + } + var init_isTypedArray2 = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs"() { + "use strict"; + init_isTypedArray(); + __name(isTypedArray2, "isTypedArray"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/clone.mjs + function clone2(obj) { + if (isPrimitive(obj)) { + return obj; + } + const tag = getTag(obj); + if (!isCloneableObject2(obj)) { + return {}; + } + if (isArray(obj)) { + const result2 = Array.from(obj); + if (obj.length > 0 && typeof obj[0] === "string" && Object.hasOwn(obj, "index")) { + result2.index = obj.index; + result2.input = obj.input; + } + return result2; + } + if (isTypedArray2(obj)) { + const typedArray = obj; + const Ctor = typedArray.constructor; + return new Ctor(typedArray.buffer, typedArray.byteOffset, typedArray.length); + } + if (tag === arrayBufferTag) { + return new ArrayBuffer(obj.byteLength); + } + if (tag === dataViewTag) { + const dataView = obj; + const buffer = dataView.buffer; + const byteOffset = dataView.byteOffset; + const byteLength = dataView.byteLength; + const clonedBuffer = new ArrayBuffer(byteLength); + const srcView = new Uint8Array(buffer, byteOffset, byteLength); + const destView = new Uint8Array(clonedBuffer); + destView.set(srcView); + return new DataView(clonedBuffer); + } + if (tag === booleanTag || tag === numberTag || tag === stringTag) { + const Ctor = obj.constructor; + const clone9 = new Ctor(obj.valueOf()); + if (tag === stringTag) { + cloneStringObjectProperties(clone9, obj); + } else { + copyOwnProperties(clone9, obj); + } + return clone9; + } + if (tag === dateTag) { + return new Date(Number(obj)); + } + if (tag === regexpTag) { + const regExp = obj; + const clone9 = new RegExp(regExp.source, regExp.flags); + clone9.lastIndex = regExp.lastIndex; + return clone9; + } + if (tag === symbolTag) { + return Object(Symbol.prototype.valueOf.call(obj)); + } + if (tag === mapTag) { + const map6 = obj; + const result2 = /* @__PURE__ */ new Map(); + map6.forEach((obj2, key) => { + result2.set(key, obj2); + }); + return result2; + } + if (tag === setTag) { + const set5 = obj; + const result2 = /* @__PURE__ */ new Set(); + set5.forEach((obj2) => { + result2.add(obj2); + }); + return result2; + } + if (tag === argumentsTag) { + const args = obj; + const result2 = {}; + copyOwnProperties(result2, args); + result2.length = args.length; + result2[Symbol.iterator] = args[Symbol.iterator]; + return result2; + } + const result = {}; + copyPrototype(result, obj); + copyOwnProperties(result, obj); + copySymbolProperties(result, obj); + return result; + } + function isCloneableObject2(object3) { + switch (getTag(object3)) { + case argumentsTag: + case arrayTag: + case arrayBufferTag: + case dataViewTag: + case booleanTag: + case dateTag: + case float32ArrayTag: + case float64ArrayTag: + case int8ArrayTag: + case int16ArrayTag: + case int32ArrayTag: + case mapTag: + case numberTag: + case objectTag: + case regexpTag: + case setTag: + case stringTag: + case symbolTag: + case uint8ArrayTag: + case uint8ClampedArrayTag: + case uint16ArrayTag: + case uint32ArrayTag: { + return true; + } + default: { + return false; + } + } + } + function copyOwnProperties(target, source) { + for (const key in source) { + if (Object.hasOwn(source, key)) { + target[key] = source[key]; + } + } + } + function copySymbolProperties(target, source) { + const symbols2 = Object.getOwnPropertySymbols(source); + for (let i2 = 0; i2 < symbols2.length; i2++) { + const symbol = symbols2[i2]; + if (Object.prototype.propertyIsEnumerable.call(source, symbol)) { + target[symbol] = source[symbol]; + } + } + } + function cloneStringObjectProperties(target, source) { + const stringLength = source.valueOf().length; + for (const key in source) { + if (Object.hasOwn(source, key) && (Number.isNaN(Number(key)) || Number(key) >= stringLength)) { + target[key] = source[key]; + } + } + } + function copyPrototype(target, source) { + const proto = Object.getPrototypeOf(source); + if (proto !== null) { + const Ctor = source.constructor; + if (typeof Ctor === "function") { + Object.setPrototypeOf(target, proto); + } + } + } + var init_clone2 = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/clone.mjs"() { + "use strict"; + init_isPrimitive(); + init_getTag(); + init_tags(); + init_isArray(); + init_isTypedArray2(); + __name(clone2, "clone"); + __name(isCloneableObject2, "isCloneableObject"); + __name(copyOwnProperties, "copyOwnProperties"); + __name(copySymbolProperties, "copySymbolProperties"); + __name(cloneStringObjectProperties, "cloneStringObjectProperties"); + __name(copyPrototype, "copyPrototype"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.mjs + function isPlainObject(object3) { + if (typeof object3 !== "object") { + return false; + } + if (object3 == null) { + return false; + } + if (Object.getPrototypeOf(object3) === null) { + return true; + } + if (Object.prototype.toString.call(object3) !== "[object Object]") { + const tag = object3[Symbol.toStringTag]; + if (tag == null) { + return false; + } + const isTagReadonly = !Object.getOwnPropertyDescriptor(object3, Symbol.toStringTag)?.writable; + if (isTagReadonly) { + return false; + } + return object3.toString() === `[object ${tag}]`; + } + let proto = object3; + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + return Object.getPrototypeOf(object3) === proto; + } + var init_isPlainObject = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.mjs"() { + "use strict"; + __name(isPlainObject, "isPlainObject"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/clone.mjs + function clone3(obj) { + if (isPrimitive(obj)) { + return obj; + } + if (Array.isArray(obj) || isTypedArray(obj) || obj instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && obj instanceof SharedArrayBuffer) { + return obj.slice(0); + } + const prototype = Object.getPrototypeOf(obj); + if (prototype == null) { + return Object.assign(Object.create(prototype), obj); + } + const Constructor = prototype.constructor; + if (obj instanceof Date || obj instanceof Map || obj instanceof Set) { + return new Constructor(obj); + } + if (obj instanceof RegExp) { + const newRegExp = new Constructor(obj); + newRegExp.lastIndex = obj.lastIndex; + return newRegExp; + } + if (obj instanceof DataView) { + return new Constructor(obj.buffer.slice(0)); + } + if (obj instanceof Error) { + let newError; + if (obj instanceof AggregateError) { + newError = new Constructor(obj.errors, obj.message, { cause: obj.cause }); + } else { + newError = new Constructor(obj.message, { cause: obj.cause }); + } + newError.stack = obj.stack; + Object.assign(newError, obj); + return newError; + } + if (typeof File !== "undefined" && obj instanceof File) { + const newFile = new Constructor([obj], obj.name, { type: obj.type, lastModified: obj.lastModified }); + return newFile; + } + if (typeof obj === "object") { + const newObject = Object.create(prototype); + return Object.assign(newObject, obj); + } + return obj; + } + var init_clone3 = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/clone.mjs"() { + "use strict"; + init_isPrimitive(); + init_isTypedArray(); + __name(clone3, "clone"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/mergeWith.mjs + function mergeWith(object3, ...otherArgs) { + const sources = otherArgs.slice(0, -1); + const merge6 = otherArgs[otherArgs.length - 1]; + let result = object3; + for (let i2 = 0; i2 < sources.length; i2++) { + const source = sources[i2]; + result = mergeWithDeep(result, source, merge6, /* @__PURE__ */ new Map()); + } + return result; + } + function mergeWithDeep(target, source, merge6, stack) { + if (isPrimitive(target)) { + target = Object(target); + } + if (source == null || typeof source !== "object") { + return target; + } + if (stack.has(source)) { + return clone3(stack.get(source)); + } + stack.set(source, target); + if (Array.isArray(source)) { + source = source.slice(); + for (let i2 = 0; i2 < source.length; i2++) { + source[i2] = source[i2] ?? void 0; + } + } + const sourceKeys = [...Object.keys(source), ...getSymbols(source)]; + for (let i2 = 0; i2 < sourceKeys.length; i2++) { + const key = sourceKeys[i2]; + if (isUnsafeProperty(key)) { + continue; + } + let sourceValue = source[key]; + let targetValue = target[key]; + if (isArguments(sourceValue)) { + sourceValue = { ...sourceValue }; + } + if (isArguments(targetValue)) { + targetValue = { ...targetValue }; + } + if (typeof Buffer !== "undefined" && Buffer.isBuffer(sourceValue)) { + sourceValue = cloneDeep(sourceValue); + } + if (Array.isArray(sourceValue)) { + if (Array.isArray(targetValue)) { + const cloned = []; + const targetKeys = Reflect.ownKeys(targetValue); + for (let i3 = 0; i3 < targetKeys.length; i3++) { + const targetKey = targetKeys[i3]; + cloned[targetKey] = targetValue[targetKey]; + } + targetValue = cloned; + } else if (isArrayLikeObject(targetValue)) { + const cloned = []; + for (let i3 = 0; i3 < targetValue.length; i3++) { + cloned[i3] = targetValue[i3]; + } + targetValue = cloned; + } else { + targetValue = []; + } + } + const merged = merge6(targetValue, sourceValue, key, target, source, stack); + if (merged !== void 0) { + target[key] = merged; + } else if (Array.isArray(sourceValue)) { + target[key] = mergeWithDeep(targetValue, sourceValue, merge6, stack); + } else if (isObjectLike(targetValue) && isObjectLike(sourceValue) && (isPlainObject(targetValue) || isPlainObject(sourceValue) || isTypedArray2(targetValue) || isTypedArray2(sourceValue))) { + target[key] = mergeWithDeep(targetValue, sourceValue, merge6, stack); + } else if (targetValue == null && isPlainObject(sourceValue)) { + target[key] = mergeWithDeep({}, sourceValue, merge6, stack); + } else if (targetValue == null && isTypedArray2(sourceValue)) { + target[key] = cloneDeep(sourceValue); + } else if (targetValue === void 0 || sourceValue !== void 0) { + target[key] = sourceValue; + } + } + return target; + } + var init_mergeWith = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/mergeWith.mjs"() { + "use strict"; + init_cloneDeep(); + init_isUnsafeProperty(); + init_clone3(); + init_isPrimitive(); + init_getSymbols(); + init_isArguments(); + init_isArrayLikeObject(); + init_isObjectLike(); + init_isPlainObject(); + init_isTypedArray2(); + __name(mergeWith, "mergeWith"); + __name(mergeWithDeep, "mergeWithDeep"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/merge.mjs + function merge(object3, ...sources) { + return mergeWith(object3, ...sources, noop2); + } + var init_merge4 = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/object/merge.mjs"() { + "use strict"; + init_mergeWith(); + init_noop2(); + __name(merge, "merge"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs + function isEmpty(value2) { + if (value2 == null) { + return true; + } + if (isArrayLike(value2)) { + if (typeof value2.splice !== "function" && typeof value2 !== "string" && (typeof Buffer === "undefined" || !Buffer.isBuffer(value2)) && !isTypedArray2(value2) && !isArguments(value2)) { + return false; + } + return value2.length === 0; + } + if (typeof value2 === "object") { + if (value2 instanceof Map || value2 instanceof Set) { + return value2.size === 0; + } + const keys3 = Object.keys(value2); + if (isPrototype(value2)) { + return keys3.filter((x5) => x5 !== "constructor").length === 0; + } + return keys3.length === 0; + } + return true; + } + var init_isEmpty = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs"() { + "use strict"; + init_isArguments(); + init_isArrayLike(); + init_isTypedArray2(); + init_isPrototype(); + __name(isEmpty, "isEmpty"); + } + }); + + // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/index.mjs + var init_compat = __esm({ + "../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/compat/index.mjs"() { + "use strict"; + init_memoize(); + init_clone2(); + init_merge4(); + init_isEmpty(); + } + }); + + // src/utils.ts + function interpolateToCurve(interpolate, defaultCurve) { + if (!interpolate) { + return defaultCurve; + } + const curveName = `curve${interpolate.charAt(0).toUpperCase() + interpolate.slice(1)}`; + return d3CurveTypes[curveName] ?? defaultCurve; + } + function formatUrl(linkStr, config5) { + const url = linkStr.trim(); + if (!url) { + return void 0; + } + if (config5.securityLevel !== "loose") { + return (0, import_sanitize_url3.sanitizeUrl)(url); + } + return url; + } + function distance(p1, p22) { + if (!p1 || !p22) { + return 0; + } + return Math.sqrt(Math.pow(p22.x - p1.x, 2) + Math.pow(p22.y - p1.y, 2)); + } + function traverseEdge(points) { + let prevPoint; + let totalDistance = 0; + points.forEach((point8) => { + totalDistance += distance(point8, prevPoint); + prevPoint = point8; + }); + const remainingDistance = totalDistance / 2; + return calculatePoint(points, remainingDistance); + } + function calcLabelPosition(points) { + if (points.length === 1) { + return points[0]; + } + return traverseEdge(points); + } + function calcTerminalLabelPosition(terminalMarkerSize, position5, _points) { + const points = structuredClone(_points); + log.info("our points", points); + if (position5 !== "start_left" && position5 !== "start_right") { + points.reverse(); + } + const distanceToCardinalityPoint = 25 + terminalMarkerSize; + const center4 = calculatePoint(points, distanceToCardinalityPoint); + const d3 = 10 + terminalMarkerSize * 0.5; + const angle2 = Math.atan2(points[0].y - center4.y, points[0].x - center4.x); + const cardinalityPosition = { x: 0, y: 0 }; + if (position5 === "start_left") { + cardinalityPosition.x = Math.sin(angle2 + Math.PI) * d3 + (points[0].x + center4.x) / 2; + cardinalityPosition.y = -Math.cos(angle2 + Math.PI) * d3 + (points[0].y + center4.y) / 2; + } else if (position5 === "end_right") { + cardinalityPosition.x = Math.sin(angle2 - Math.PI) * d3 + (points[0].x + center4.x) / 2 - 5; + cardinalityPosition.y = -Math.cos(angle2 - Math.PI) * d3 + (points[0].y + center4.y) / 2 - 5; + } else if (position5 === "end_left") { + cardinalityPosition.x = Math.sin(angle2) * d3 + (points[0].x + center4.x) / 2 - 5; + cardinalityPosition.y = -Math.cos(angle2) * d3 + (points[0].y + center4.y) / 2 - 5; + } else { + cardinalityPosition.x = Math.sin(angle2) * d3 + (points[0].x + center4.x) / 2; + cardinalityPosition.y = -Math.cos(angle2) * d3 + (points[0].y + center4.y) / 2; + } + return cardinalityPosition; + } + function getStylesFromArray(arr) { + let style3 = ""; + let labelStyle = ""; + for (const element3 of arr) { + if (element3 !== void 0) { + if (element3.startsWith("color:") || element3.startsWith("text-align:")) { + labelStyle = labelStyle + element3 + ";"; + } else { + style3 = style3 + element3 + ";"; + } + } + } + return { style: style3, labelStyle }; + } + function makeRandomHex(length2) { + let result = ""; + const characters2 = "0123456789abcdef"; + const charactersLength = characters2.length; + for (let i2 = 0; i2 < length2; i2++) { + result += characters2.charAt(Math.floor(Math.random() * charactersLength)); + } + return result; + } + function calculateTextHeight(text4, config5) { + return calculateTextDimensions(text4, config5).height; + } + function calculateTextWidth(text4, config5) { + return calculateTextDimensions(text4, config5).width; + } + function isDetailedError(error3) { + return "str" in error3; + } + function cleanAndMerge(defaultData, data5) { + return merge({}, defaultData, data5); + } + function handleUndefinedAttr(attrValue) { + return attrValue ?? null; + } + function isLabelCoordinateInPath(point8, dAttr) { + const roundedX = Math.round(point8.x); + const roundedY = Math.round(point8.y); + const sanitizedD = dAttr.replace( + /(\d+\.\d+)/g, + (match3) => Math.round(parseFloat(match3)).toString() + ); + return sanitizedD.includes(roundedX.toString()) || sanitizedD.includes(roundedY.toString()); + } + var import_sanitize_url3, ZERO_WIDTH_SPACE, d3CurveTypes, directiveWithoutOpen, detectInit, detectDirective, removeDirectives, isSubstringInArray, runFunc, roundNumber, calculatePoint, calcCardinalityPosition, cnt, generateId, random, getTextObj2, drawSimpleText, wrapLabel, breakString, calculateTextDimensions, InitIDGenerator, decoder, entityDecode, insertTitle, parseFontSize, utils_default2, encodeEntities, decodeEntities, getEdgeId; + var init_utils2 = __esm({ + "src/utils.ts"() { + "use strict"; + import_sanitize_url3 = __toESM(require_dist(), 1); + init_src32(); + init_common(); + init_sanitizeDirective(); + init_logger(); + init_detectType(); + init_assignWithDepth(); + init_compat(); + init_regexes(); + ZERO_WIDTH_SPACE = "\u200B"; + d3CurveTypes = { + curveBasis: basis_default2, + curveBasisClosed: basisClosed_default2, + curveBasisOpen: basisOpen_default, + curveBumpX: bumpX, + curveBumpY: bumpY, + curveBundle: bundle_default, + curveCardinalClosed: cardinalClosed_default, + curveCardinalOpen: cardinalOpen_default, + curveCardinal: cardinal_default, + curveCatmullRomClosed: catmullRomClosed_default, + curveCatmullRomOpen: catmullRomOpen_default, + curveCatmullRom: catmullRom_default, + curveLinear: linear_default, + curveLinearClosed: linearClosed_default, + curveMonotoneX: monotoneX, + curveMonotoneY: monotoneY, + curveNatural: natural_default, + curveStep: step_default, + curveStepAfter: stepAfter, + curveStepBefore: stepBefore + }; + directiveWithoutOpen = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi; + detectInit = /* @__PURE__ */ __name(function(text4, config5) { + const inits = detectDirective(text4, /(?:init\b)|(?:initialize\b)/); + let results = {}; + if (Array.isArray(inits)) { + const args = inits.map((init3) => init3.args); + sanitizeDirective(args); + results = assignWithDepth_default(results, [...args]); + } else { + results = inits.args; + } + if (!results) { + return; + } + let type3 = detectType(text4, config5); + const prop = "config"; + if (results[prop] !== void 0) { + if (type3 === "flowchart-v2") { + type3 = "flowchart"; + } + results[type3] = results[prop]; + delete results[prop]; + } + return results; + }, "detectInit"); + detectDirective = /* @__PURE__ */ __name(function(text4, type3 = null) { + try { + const commentWithoutDirectives = new RegExp( + `[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).* +`, + "ig" + ); + text4 = text4.trim().replace(commentWithoutDirectives, "").replace(/'/gm, '"'); + log.debug( + `Detecting diagram directive${type3 !== null ? " type:" + type3 : ""} based on the text:${text4}` + ); + let match3; + const result = []; + while ((match3 = directiveRegex.exec(text4)) !== null) { + if (match3.index === directiveRegex.lastIndex) { + directiveRegex.lastIndex++; + } + if (match3 && !type3 || type3 && match3[1]?.match(type3) || type3 && match3[2]?.match(type3)) { + const type4 = match3[1] ? match3[1] : match3[2]; + const args = match3[3] ? match3[3].trim() : match3[4] ? JSON.parse(match3[4].trim()) : null; + result.push({ type: type4, args }); + } + } + if (result.length === 0) { + return { type: text4, args: null }; + } + return result.length === 1 ? result[0] : result; + } catch (error3) { + log.error( + `ERROR: ${error3.message} - Unable to parse directive type: '${type3}' based on the text: '${text4}'` + ); + return { type: void 0, args: null }; + } + }, "detectDirective"); + removeDirectives = /* @__PURE__ */ __name(function(text4) { + return text4.replace(directiveRegex, ""); + }, "removeDirectives"); + isSubstringInArray = /* @__PURE__ */ __name(function(str2, arr) { + for (const [i2, element3] of arr.entries()) { + if (element3.match(str2)) { + return i2; + } + } + return -1; + }, "isSubstringInArray"); + __name(interpolateToCurve, "interpolateToCurve"); + __name(formatUrl, "formatUrl"); + runFunc = /* @__PURE__ */ __name((functionName, ...params) => { + const arrPaths = functionName.split("."); + const len = arrPaths.length - 1; + const fnName = arrPaths[len]; + let obj = window; + for (let i2 = 0; i2 < len; i2++) { + obj = obj[arrPaths[i2]]; + if (!obj) { + log.error(`Function name: ${functionName} not found in window`); + return; + } + } + obj[fnName](...params); + }, "runFunc"); + __name(distance, "distance"); + __name(traverseEdge, "traverseEdge"); + __name(calcLabelPosition, "calcLabelPosition"); + roundNumber = /* @__PURE__ */ __name((num, precision = 2) => { + const factor = Math.pow(10, precision); + return Math.round(num * factor) / factor; + }, "roundNumber"); + calculatePoint = /* @__PURE__ */ __name((points, distanceToTraverse) => { + let prevPoint = void 0; + let remainingDistance = distanceToTraverse; + for (const point8 of points) { + if (prevPoint) { + const vectorDistance = distance(point8, prevPoint); + if (vectorDistance === 0) { + return prevPoint; + } + if (vectorDistance < remainingDistance) { + remainingDistance -= vectorDistance; + } else { + const distanceRatio = remainingDistance / vectorDistance; + if (distanceRatio <= 0) { + return prevPoint; + } + if (distanceRatio >= 1) { + return { x: point8.x, y: point8.y }; + } + if (distanceRatio > 0 && distanceRatio < 1) { + return { + x: roundNumber((1 - distanceRatio) * prevPoint.x + distanceRatio * point8.x, 5), + y: roundNumber((1 - distanceRatio) * prevPoint.y + distanceRatio * point8.y, 5) + }; + } + } + } + prevPoint = point8; + } + throw new Error("Could not find a suitable point for the given distance"); + }, "calculatePoint"); + calcCardinalityPosition = /* @__PURE__ */ __name((isRelationTypePresent, points, initialPosition) => { + log.info(`our points ${JSON.stringify(points)}`); + if (points[0] !== initialPosition) { + points = points.reverse(); + } + const distanceToCardinalityPoint = 25; + const center4 = calculatePoint(points, distanceToCardinalityPoint); + const d3 = isRelationTypePresent ? 10 : 5; + const angle2 = Math.atan2(points[0].y - center4.y, points[0].x - center4.x); + const cardinalityPosition = { x: 0, y: 0 }; + cardinalityPosition.x = Math.sin(angle2) * d3 + (points[0].x + center4.x) / 2; + cardinalityPosition.y = -Math.cos(angle2) * d3 + (points[0].y + center4.y) / 2; + return cardinalityPosition; + }, "calcCardinalityPosition"); + __name(calcTerminalLabelPosition, "calcTerminalLabelPosition"); + __name(getStylesFromArray, "getStylesFromArray"); + cnt = 0; + generateId = /* @__PURE__ */ __name(() => { + cnt++; + return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt; + }, "generateId"); + __name(makeRandomHex, "makeRandomHex"); + random = /* @__PURE__ */ __name((options2) => { + return makeRandomHex(options2.length); + }, "random"); + getTextObj2 = /* @__PURE__ */ __name(function() { + return { + x: 0, + y: 0, + fill: void 0, + anchor: "start", + style: "#666", + width: 100, + height: 100, + textMargin: 0, + rx: 0, + ry: 0, + valign: void 0, + text: "" + }; + }, "getTextObj"); + drawSimpleText = /* @__PURE__ */ __name(function(elem, textData) { + const nText = textData.text.replace(common_default.lineBreakRegex, " "); + const [, _fontSizePx] = parseFontSize(textData.fontSize); + const textElem = elem.append("text"); + textElem.attr("x", textData.x); + textElem.attr("y", textData.y); + textElem.style("text-anchor", textData.anchor); + textElem.style("font-family", textData.fontFamily); + textElem.style("font-size", _fontSizePx); + textElem.style("font-weight", textData.fontWeight); + textElem.attr("fill", textData.fill); + if (textData.class !== void 0) { + textElem.attr("class", textData.class); + } + const span = textElem.append("tspan"); + span.attr("x", textData.x + textData.textMargin * 2); + span.attr("fill", textData.fill); + span.text(nText); + return textElem; + }, "drawSimpleText"); + wrapLabel = memoize( + (label, maxWidth2, config5) => { + if (!label) { + return label; + } + config5 = Object.assign( + { fontSize: 12, fontWeight: 400, fontFamily: "Arial", joinWith: "
" }, + config5 + ); + if (common_default.lineBreakRegex.test(label)) { + return label; + } + const words = label.split(" ").filter(Boolean); + const completedLines = []; + let nextLine = ""; + words.forEach((word, index) => { + const wordLength = calculateTextWidth(`${word} `, config5); + const nextLineLength = calculateTextWidth(nextLine, config5); + if (wordLength > maxWidth2) { + const { hyphenatedStrings, remainingWord } = breakString(word, maxWidth2, "-", config5); + completedLines.push(nextLine, ...hyphenatedStrings); + nextLine = remainingWord; + } else if (nextLineLength + wordLength >= maxWidth2) { + completedLines.push(nextLine); + nextLine = word; + } else { + nextLine = [nextLine, word].filter(Boolean).join(" "); + } + const currentWord = index + 1; + const isLastWord = currentWord === words.length; + if (isLastWord) { + completedLines.push(nextLine); + } + }); + return completedLines.filter((line2) => line2 !== "").join(config5.joinWith); + }, + (label, maxWidth2, config5) => `${label}${maxWidth2}${config5.fontSize}${config5.fontWeight}${config5.fontFamily}${config5.joinWith}` + ); + breakString = memoize( + (word, maxWidth2, hyphenCharacter = "-", config5) => { + config5 = Object.assign( + { fontSize: 12, fontWeight: 400, fontFamily: "Arial", margin: 0 }, + config5 + ); + const characters2 = [...word]; + const lines = []; + let currentLine = ""; + characters2.forEach((character2, index) => { + const nextLine = `${currentLine}${character2}`; + const lineWidth = calculateTextWidth(nextLine, config5); + if (lineWidth >= maxWidth2) { + const currentCharacter = index + 1; + const isLastLine = characters2.length === currentCharacter; + const hyphenatedNextLine = `${nextLine}${hyphenCharacter}`; + lines.push(isLastLine ? nextLine : hyphenatedNextLine); + currentLine = ""; + } else { + currentLine = nextLine; + } + }); + return { hyphenatedStrings: lines, remainingWord: currentLine }; + }, + (word, maxWidth2, hyphenCharacter = "-", config5) => `${word}${maxWidth2}${hyphenCharacter}${config5.fontSize}${config5.fontWeight}${config5.fontFamily}` + ); + __name(calculateTextHeight, "calculateTextHeight"); + __name(calculateTextWidth, "calculateTextWidth"); + calculateTextDimensions = memoize( + (text4, config5) => { + const { fontSize = 12, fontFamily = "Arial", fontWeight = 400 } = config5; + if (!text4) { + return { width: 0, height: 0 }; + } + const [, _fontSizePx] = parseFontSize(fontSize); + const fontFamilies = ["sans-serif", fontFamily]; + const lines = text4.split(common_default.lineBreakRegex); + const dims = []; + const body = select_default2("body"); + if (!body.remove) { + return { width: 0, height: 0, lineHeight: 0 }; + } + const g2 = body.append("svg"); + for (const fontFamily2 of fontFamilies) { + let cHeight = 0; + const dim = { width: 0, height: 0, lineHeight: 0 }; + for (const line2 of lines) { + const textObj = getTextObj2(); + textObj.text = line2 || ZERO_WIDTH_SPACE; + const textElem = drawSimpleText(g2, textObj).style("font-size", _fontSizePx).style("font-weight", fontWeight).style("font-family", fontFamily2); + const bBox = (textElem._groups || textElem)[0][0].getBBox(); + if (bBox.width === 0 && bBox.height === 0) { + throw new Error("svg element not in render tree"); + } + dim.width = Math.round(Math.max(dim.width, bBox.width)); + cHeight = Math.round(bBox.height); + dim.height += cHeight; + dim.lineHeight = Math.round(Math.max(dim.lineHeight, cHeight)); + } + dims.push(dim); + } + g2.remove(); + const index = isNaN(dims[1].height) || isNaN(dims[1].width) || isNaN(dims[1].lineHeight) || dims[0].height > dims[1].height && dims[0].width > dims[1].width && dims[0].lineHeight > dims[1].lineHeight ? 0 : 1; + return dims[index]; + }, + (text4, config5) => `${text4}${config5.fontSize}${config5.fontWeight}${config5.fontFamily}` + ); + InitIDGenerator = class { + constructor(deterministic = false, seed) { + this.count = 0; + this.count = seed ? seed.length : 0; + this.next = deterministic ? () => this.count++ : () => Date.now(); + } + static { + __name(this, "InitIDGenerator"); + } + }; + entityDecode = /* @__PURE__ */ __name(function(html2) { + decoder = decoder || document.createElement("div"); + html2 = escape(html2).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";"); + decoder.innerHTML = html2; + return unescape(decoder.textContent); + }, "entityDecode"); + __name(isDetailedError, "isDetailedError"); + insertTitle = /* @__PURE__ */ __name((parent4, cssClass, titleTopMargin, title2) => { + if (!title2) { + return; + } + const bounds4 = parent4.node()?.getBBox(); + if (!bounds4) { + return; + } + parent4.append("text").text(title2).attr("text-anchor", "middle").attr("x", bounds4.x + bounds4.width / 2).attr("y", -titleTopMargin).attr("class", cssClass); + }, "insertTitle"); + parseFontSize = /* @__PURE__ */ __name((fontSize) => { + if (typeof fontSize === "number") { + return [fontSize, fontSize + "px"]; + } + const fontSizeNumber = parseInt(fontSize ?? "", 10); + if (Number.isNaN(fontSizeNumber)) { + return [void 0, void 0]; + } else if (fontSize === String(fontSizeNumber)) { + return [fontSizeNumber, fontSize + "px"]; + } else { + return [fontSizeNumber, fontSize]; + } + }, "parseFontSize"); + __name(cleanAndMerge, "cleanAndMerge"); + utils_default2 = { + assignWithDepth: assignWithDepth_default, + wrapLabel, + calculateTextHeight, + calculateTextWidth, + calculateTextDimensions, + cleanAndMerge, + detectInit, + detectDirective, + isSubstringInArray, + interpolateToCurve, + calcLabelPosition, + calcCardinalityPosition, + calcTerminalLabelPosition, + formatUrl, + getStylesFromArray, + generateId, + random, + runFunc, + entityDecode, + insertTitle, + isLabelCoordinateInPath, + parseFontSize, + InitIDGenerator + }; + encodeEntities = /* @__PURE__ */ __name(function(text4) { + let txt = text4; + txt = txt.replace(/style.*:\S*#.*;/g, function(s2) { + return s2.substring(0, s2.length - 1); + }); + txt = txt.replace(/classDef.*:\S*#.*;/g, function(s2) { + return s2.substring(0, s2.length - 1); + }); + txt = txt.replace(/#\w+;/g, function(s2) { + const innerTxt = s2.substring(1, s2.length - 1); + const isInt = /^\+?\d+$/.test(innerTxt); + if (isInt) { + return "\uFB02\xB0\xB0" + innerTxt + "\xB6\xDF"; + } else { + return "\uFB02\xB0" + innerTxt + "\xB6\xDF"; + } + }); + return txt; + }, "encodeEntities"); + decodeEntities = /* @__PURE__ */ __name(function(text4) { + return text4.replace(/fl°°/g, "&#").replace(/fl°/g, "&").replace(/¶ß/g, ";"); + }, "decodeEntities"); + getEdgeId = /* @__PURE__ */ __name((from2, to, { + counter: counter2 = 0, + prefix, + suffix + }, id35) => { + if (id35) { + return id35; + } + return `${prefix ? `${prefix}_` : ""}${from2}_${to}_${counter2}${suffix ? `_${suffix}` : ""}`; + }, "getEdgeId"); + __name(handleUndefinedAttr, "handleUndefinedAttr"); + __name(isLabelCoordinateInPath, "isLabelCoordinateInPath"); + } + }); + + // src/diagrams/c4/c4Renderer.js + function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLimitWidth) { + if (!c4Shape[textType].width) { + if (c4ShapeTextWrap) { + c4Shape[textType].text = wrapLabel(c4Shape[textType].text, textLimitWidth, textConf); + c4Shape[textType].textLines = c4Shape[textType].text.split(common_default.lineBreakRegex).length; + c4Shape[textType].width = textLimitWidth; + c4Shape[textType].height = calculateTextHeight(c4Shape[textType].text, textConf); + } else { + let lines = c4Shape[textType].text.split(common_default.lineBreakRegex); + c4Shape[textType].textLines = lines.length; + let lineHeight = 0; + c4Shape[textType].height = 0; + c4Shape[textType].width = 0; + for (const line2 of lines) { + c4Shape[textType].width = Math.max( + calculateTextWidth(line2, textConf), + c4Shape[textType].width + ); + lineHeight = calculateTextHeight(line2, textConf); + c4Shape[textType].height = c4Shape[textType].height + lineHeight; + } + } + } + } + function drawInsideBoundary(diagram32, parentBoundaryAlias, parentBounds, currentBoundaries, diagObj) { + let currentBounds = new Bounds(diagObj); + currentBounds.data.widthLimit = parentBounds.data.widthLimit / Math.min(c4BoundaryInRow2, currentBoundaries.length); + for (let [i2, currentBoundary] of currentBoundaries.entries()) { + let Y3 = 0; + currentBoundary.image = { width: 0, height: 0, Y: 0 }; + if (currentBoundary.sprite) { + currentBoundary.image.width = 48; + currentBoundary.image.height = 48; + currentBoundary.image.Y = Y3; + Y3 = currentBoundary.image.Y + currentBoundary.image.height; + } + let currentBoundaryTextWrap = currentBoundary.wrap && conf.wrap; + let currentBoundaryLabelConf = boundaryFont(conf); + currentBoundaryLabelConf.fontSize = currentBoundaryLabelConf.fontSize + 2; + currentBoundaryLabelConf.fontWeight = "bold"; + calcC4ShapeTextWH( + "label", + currentBoundary, + currentBoundaryTextWrap, + currentBoundaryLabelConf, + currentBounds.data.widthLimit + ); + currentBoundary.label.Y = Y3 + 8; + Y3 = currentBoundary.label.Y + currentBoundary.label.height; + if (currentBoundary.type && currentBoundary.type.text !== "") { + currentBoundary.type.text = "[" + currentBoundary.type.text + "]"; + let currentBoundaryTypeConf = boundaryFont(conf); + calcC4ShapeTextWH( + "type", + currentBoundary, + currentBoundaryTextWrap, + currentBoundaryTypeConf, + currentBounds.data.widthLimit + ); + currentBoundary.type.Y = Y3 + 5; + Y3 = currentBoundary.type.Y + currentBoundary.type.height; + } + if (currentBoundary.descr && currentBoundary.descr.text !== "") { + let currentBoundaryDescrConf = boundaryFont(conf); + currentBoundaryDescrConf.fontSize = currentBoundaryDescrConf.fontSize - 2; + calcC4ShapeTextWH( + "descr", + currentBoundary, + currentBoundaryTextWrap, + currentBoundaryDescrConf, + currentBounds.data.widthLimit + ); + currentBoundary.descr.Y = Y3 + 20; + Y3 = currentBoundary.descr.Y + currentBoundary.descr.height; + } + if (i2 == 0 || i2 % c4BoundaryInRow2 === 0) { + let _x = parentBounds.data.startx + conf.diagramMarginX; + let _y = parentBounds.data.stopy + conf.diagramMarginY + Y3; + currentBounds.setData(_x, _x, _y, _y); + } else { + let _x = currentBounds.data.stopx !== currentBounds.data.startx ? currentBounds.data.stopx + conf.diagramMarginX : currentBounds.data.startx; + let _y = currentBounds.data.starty; + currentBounds.setData(_x, _x, _y, _y); + } + currentBounds.name = currentBoundary.alias; + let currentPersonOrSystemArray = diagObj.db.getC4ShapeArray(currentBoundary.alias); + let currentPersonOrSystemKeys = diagObj.db.getC4ShapeKeys(currentBoundary.alias); + if (currentPersonOrSystemKeys.length > 0) { + drawC4ShapeArray( + currentBounds, + diagram32, + currentPersonOrSystemArray, + currentPersonOrSystemKeys + ); + } + parentBoundaryAlias = currentBoundary.alias; + let nextCurrentBoundaries = diagObj.db.getBoundaries(parentBoundaryAlias); + if (nextCurrentBoundaries.length > 0) { + drawInsideBoundary( + diagram32, + parentBoundaryAlias, + currentBounds, + nextCurrentBoundaries, + diagObj + ); + } + if (currentBoundary.alias !== "global") { + drawBoundary2(diagram32, currentBoundary, currentBounds); + } + parentBounds.data.stopy = Math.max( + currentBounds.data.stopy + conf.c4ShapeMargin, + parentBounds.data.stopy + ); + parentBounds.data.stopx = Math.max( + currentBounds.data.stopx + conf.c4ShapeMargin, + parentBounds.data.stopx + ); + globalBoundaryMaxX = Math.max(globalBoundaryMaxX, parentBounds.data.stopx); + globalBoundaryMaxY = Math.max(globalBoundaryMaxY, parentBounds.data.stopy); + } + } + var globalBoundaryMaxX, globalBoundaryMaxY, c4ShapeInRow2, c4BoundaryInRow2, conf, Bounds, setConf, c4ShapeFont, boundaryFont, messageFont, drawBoundary2, drawC4ShapeArray, Point2, getIntersectPoint, getIntersectPoints, drawRels2, draw, c4Renderer_default; + var init_c4Renderer = __esm({ + "src/diagrams/c4/c4Renderer.js"() { + "use strict"; + init_src32(); + init_svgDraw(); + init_logger(); + init_c4Diagram(); + init_common(); + init_c4Db(); + init_diagramAPI(); + init_assignWithDepth(); + init_utils2(); + init_setupGraphViewbox(); + globalBoundaryMaxX = 0; + globalBoundaryMaxY = 0; + c4ShapeInRow2 = 4; + c4BoundaryInRow2 = 2; + parser.yy = c4Db_default; + conf = {}; + Bounds = class { + static { + __name(this, "Bounds"); + } + constructor(diagObj) { + this.name = ""; + this.data = {}; + this.data.startx = void 0; + this.data.stopx = void 0; + this.data.starty = void 0; + this.data.stopy = void 0; + this.data.widthLimit = void 0; + this.nextData = {}; + this.nextData.startx = void 0; + this.nextData.stopx = void 0; + this.nextData.starty = void 0; + this.nextData.stopy = void 0; + this.nextData.cnt = 0; + setConf(diagObj.db.getConfig()); + } + setData(startx, stopx, starty, stopy) { + this.nextData.startx = this.data.startx = startx; + this.nextData.stopx = this.data.stopx = stopx; + this.nextData.starty = this.data.starty = starty; + this.nextData.stopy = this.data.stopy = stopy; + } + updateVal(obj, key, val, fun) { + if (obj[key] === void 0) { + obj[key] = val; + } else { + obj[key] = fun(val, obj[key]); + } + } + insert(c4Shape) { + this.nextData.cnt = this.nextData.cnt + 1; + let _startx = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + c4Shape.margin : this.nextData.stopx + c4Shape.margin * 2; + let _stopx = _startx + c4Shape.width; + let _starty = this.nextData.starty + c4Shape.margin * 2; + let _stopy = _starty + c4Shape.height; + if (_startx >= this.data.widthLimit || _stopx >= this.data.widthLimit || this.nextData.cnt > c4ShapeInRow2) { + _startx = this.nextData.startx + c4Shape.margin + conf.nextLinePaddingX; + _starty = this.nextData.stopy + c4Shape.margin * 2; + this.nextData.stopx = _stopx = _startx + c4Shape.width; + this.nextData.starty = this.nextData.stopy; + this.nextData.stopy = _stopy = _starty + c4Shape.height; + this.nextData.cnt = 1; + } + c4Shape.x = _startx; + c4Shape.y = _starty; + this.updateVal(this.data, "startx", _startx, Math.min); + this.updateVal(this.data, "starty", _starty, Math.min); + this.updateVal(this.data, "stopx", _stopx, Math.max); + this.updateVal(this.data, "stopy", _stopy, Math.max); + this.updateVal(this.nextData, "startx", _startx, Math.min); + this.updateVal(this.nextData, "starty", _starty, Math.min); + this.updateVal(this.nextData, "stopx", _stopx, Math.max); + this.updateVal(this.nextData, "stopy", _stopy, Math.max); + } + init(diagObj) { + this.name = ""; + this.data = { + startx: void 0, + stopx: void 0, + starty: void 0, + stopy: void 0, + widthLimit: void 0 + }; + this.nextData = { + startx: void 0, + stopx: void 0, + starty: void 0, + stopy: void 0, + cnt: 0 + }; + setConf(diagObj.db.getConfig()); + } + bumpLastMargin(margin) { + this.data.stopx += margin; + this.data.stopy += margin; + } + }; + setConf = /* @__PURE__ */ __name(function(cnf) { + assignWithDepth_default(conf, cnf); + if (cnf.fontFamily) { + conf.personFontFamily = conf.systemFontFamily = conf.messageFontFamily = cnf.fontFamily; + } + if (cnf.fontSize) { + conf.personFontSize = conf.systemFontSize = conf.messageFontSize = cnf.fontSize; + } + if (cnf.fontWeight) { + conf.personFontWeight = conf.systemFontWeight = conf.messageFontWeight = cnf.fontWeight; + } + }, "setConf"); + c4ShapeFont = /* @__PURE__ */ __name((cnf, typeC4Shape) => { + return { + fontFamily: cnf[typeC4Shape + "FontFamily"], + fontSize: cnf[typeC4Shape + "FontSize"], + fontWeight: cnf[typeC4Shape + "FontWeight"] + }; + }, "c4ShapeFont"); + boundaryFont = /* @__PURE__ */ __name((cnf) => { + return { + fontFamily: cnf.boundaryFontFamily, + fontSize: cnf.boundaryFontSize, + fontWeight: cnf.boundaryFontWeight + }; + }, "boundaryFont"); + messageFont = /* @__PURE__ */ __name((cnf) => { + return { + fontFamily: cnf.messageFontFamily, + fontSize: cnf.messageFontSize, + fontWeight: cnf.messageFontWeight + }; + }, "messageFont"); + __name(calcC4ShapeTextWH, "calcC4ShapeTextWH"); + drawBoundary2 = /* @__PURE__ */ __name(function(diagram32, boundary, bounds4) { + boundary.x = bounds4.data.startx; + boundary.y = bounds4.data.starty; + boundary.width = bounds4.data.stopx - bounds4.data.startx; + boundary.height = bounds4.data.stopy - bounds4.data.starty; + boundary.label.y = conf.c4ShapeMargin - 35; + let boundaryTextWrap = boundary.wrap && conf.wrap; + let boundaryLabelConf = boundaryFont(conf); + boundaryLabelConf.fontSize = boundaryLabelConf.fontSize + 2; + boundaryLabelConf.fontWeight = "bold"; + let textLimitWidth = calculateTextWidth(boundary.label.text, boundaryLabelConf); + calcC4ShapeTextWH("label", boundary, boundaryTextWrap, boundaryLabelConf, textLimitWidth); + svgDraw_default.drawBoundary(diagram32, boundary, conf); + }, "drawBoundary"); + drawC4ShapeArray = /* @__PURE__ */ __name(function(currentBounds, diagram32, c4ShapeArray2, c4ShapeKeys) { + let Y3 = 0; + for (const c4ShapeKey of c4ShapeKeys) { + Y3 = 0; + const c4Shape = c4ShapeArray2[c4ShapeKey]; + let c4ShapeTypeConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + c4ShapeTypeConf.fontSize = c4ShapeTypeConf.fontSize - 2; + c4Shape.typeC4Shape.width = calculateTextWidth( + "\xAB" + c4Shape.typeC4Shape.text + "\xBB", + c4ShapeTypeConf + ); + c4Shape.typeC4Shape.height = c4ShapeTypeConf.fontSize + 2; + c4Shape.typeC4Shape.Y = conf.c4ShapePadding; + Y3 = c4Shape.typeC4Shape.Y + c4Shape.typeC4Shape.height - 4; + c4Shape.image = { width: 0, height: 0, Y: 0 }; + switch (c4Shape.typeC4Shape.text) { + case "person": + case "external_person": + c4Shape.image.width = 48; + c4Shape.image.height = 48; + c4Shape.image.Y = Y3; + Y3 = c4Shape.image.Y + c4Shape.image.height; + break; + } + if (c4Shape.sprite) { + c4Shape.image.width = 48; + c4Shape.image.height = 48; + c4Shape.image.Y = Y3; + Y3 = c4Shape.image.Y + c4Shape.image.height; + } + let c4ShapeTextWrap = c4Shape.wrap && conf.wrap; + let textLimitWidth = conf.width - conf.c4ShapePadding * 2; + let c4ShapeLabelConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + c4ShapeLabelConf.fontSize = c4ShapeLabelConf.fontSize + 2; + c4ShapeLabelConf.fontWeight = "bold"; + calcC4ShapeTextWH("label", c4Shape, c4ShapeTextWrap, c4ShapeLabelConf, textLimitWidth); + c4Shape.label.Y = Y3 + 8; + Y3 = c4Shape.label.Y + c4Shape.label.height; + if (c4Shape.type && c4Shape.type.text !== "") { + c4Shape.type.text = "[" + c4Shape.type.text + "]"; + let c4ShapeTypeConf2 = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + calcC4ShapeTextWH("type", c4Shape, c4ShapeTextWrap, c4ShapeTypeConf2, textLimitWidth); + c4Shape.type.Y = Y3 + 5; + Y3 = c4Shape.type.Y + c4Shape.type.height; + } else if (c4Shape.techn && c4Shape.techn.text !== "") { + c4Shape.techn.text = "[" + c4Shape.techn.text + "]"; + let c4ShapeTechnConf = c4ShapeFont(conf, c4Shape.techn.text); + calcC4ShapeTextWH("techn", c4Shape, c4ShapeTextWrap, c4ShapeTechnConf, textLimitWidth); + c4Shape.techn.Y = Y3 + 5; + Y3 = c4Shape.techn.Y + c4Shape.techn.height; + } + let rectHeight = Y3; + let rectWidth = c4Shape.label.width; + if (c4Shape.descr && c4Shape.descr.text !== "") { + let c4ShapeDescrConf = c4ShapeFont(conf, c4Shape.typeC4Shape.text); + calcC4ShapeTextWH("descr", c4Shape, c4ShapeTextWrap, c4ShapeDescrConf, textLimitWidth); + c4Shape.descr.Y = Y3 + 20; + Y3 = c4Shape.descr.Y + c4Shape.descr.height; + rectWidth = Math.max(c4Shape.label.width, c4Shape.descr.width); + rectHeight = Y3 - c4Shape.descr.textLines * 5; + } + rectWidth = rectWidth + conf.c4ShapePadding; + c4Shape.width = Math.max(c4Shape.width || conf.width, rectWidth, conf.width); + c4Shape.height = Math.max(c4Shape.height || conf.height, rectHeight, conf.height); + c4Shape.margin = c4Shape.margin || conf.c4ShapeMargin; + currentBounds.insert(c4Shape); + svgDraw_default.drawC4Shape(diagram32, c4Shape, conf); + } + currentBounds.bumpLastMargin(conf.c4ShapeMargin); + }, "drawC4ShapeArray"); + Point2 = class { + static { + __name(this, "Point"); + } + constructor(x5, y6) { + this.x = x5; + this.y = y6; + } + }; + getIntersectPoint = /* @__PURE__ */ __name(function(fromNode, endPoint) { + let x1 = fromNode.x; + let y1 = fromNode.y; + let x22 = endPoint.x; + let y22 = endPoint.y; + let fromCenterX = x1 + fromNode.width / 2; + let fromCenterY = y1 + fromNode.height / 2; + let dx = Math.abs(x1 - x22); + let dy = Math.abs(y1 - y22); + let tanDYX = dy / dx; + let fromDYX = fromNode.height / fromNode.width; + let returnPoint = null; + if (y1 == y22 && x1 < x22) { + returnPoint = new Point2(x1 + fromNode.width, fromCenterY); + } else if (y1 == y22 && x1 > x22) { + returnPoint = new Point2(x1, fromCenterY); + } else if (x1 == x22 && y1 < y22) { + returnPoint = new Point2(fromCenterX, y1 + fromNode.height); + } else if (x1 == x22 && y1 > y22) { + returnPoint = new Point2(fromCenterX, y1); + } + if (x1 > x22 && y1 < y22) { + if (fromDYX >= tanDYX) { + returnPoint = new Point2(x1, fromCenterY + tanDYX * fromNode.width / 2); + } else { + returnPoint = new Point2( + fromCenterX - dx / dy * fromNode.height / 2, + y1 + fromNode.height + ); + } + } else if (x1 < x22 && y1 < y22) { + if (fromDYX >= tanDYX) { + returnPoint = new Point2(x1 + fromNode.width, fromCenterY + tanDYX * fromNode.width / 2); + } else { + returnPoint = new Point2( + fromCenterX + dx / dy * fromNode.height / 2, + y1 + fromNode.height + ); + } + } else if (x1 < x22 && y1 > y22) { + if (fromDYX >= tanDYX) { + returnPoint = new Point2(x1 + fromNode.width, fromCenterY - tanDYX * fromNode.width / 2); + } else { + returnPoint = new Point2(fromCenterX + fromNode.height / 2 * dx / dy, y1); + } + } else if (x1 > x22 && y1 > y22) { + if (fromDYX >= tanDYX) { + returnPoint = new Point2(x1, fromCenterY - fromNode.width / 2 * tanDYX); + } else { + returnPoint = new Point2(fromCenterX - fromNode.height / 2 * dx / dy, y1); + } + } + return returnPoint; + }, "getIntersectPoint"); + getIntersectPoints = /* @__PURE__ */ __name(function(fromNode, endNode) { + let endIntersectPoint = { x: 0, y: 0 }; + endIntersectPoint.x = endNode.x + endNode.width / 2; + endIntersectPoint.y = endNode.y + endNode.height / 2; + let startPoint = getIntersectPoint(fromNode, endIntersectPoint); + endIntersectPoint.x = fromNode.x + fromNode.width / 2; + endIntersectPoint.y = fromNode.y + fromNode.height / 2; + let endPoint = getIntersectPoint(endNode, endIntersectPoint); + return { startPoint, endPoint }; + }, "getIntersectPoints"); + drawRels2 = /* @__PURE__ */ __name(function(diagram32, rels2, getC4ShapeObj, diagObj, diagramId3) { + let i2 = 0; + for (let rel2 of rels2) { + i2 = i2 + 1; + let relTextWrap = rel2.wrap && conf.wrap; + let relConf = messageFont(conf); + let diagramType = diagObj.db.getC4Type(); + if (diagramType === "C4Dynamic") { + rel2.label.text = i2 + ": " + rel2.label.text; + } + let textLimitWidth = calculateTextWidth(rel2.label.text, relConf); + calcC4ShapeTextWH("label", rel2, relTextWrap, relConf, textLimitWidth); + if (rel2.techn && rel2.techn.text !== "") { + textLimitWidth = calculateTextWidth(rel2.techn.text, relConf); + calcC4ShapeTextWH("techn", rel2, relTextWrap, relConf, textLimitWidth); + } + if (rel2.descr && rel2.descr.text !== "") { + textLimitWidth = calculateTextWidth(rel2.descr.text, relConf); + calcC4ShapeTextWH("descr", rel2, relTextWrap, relConf, textLimitWidth); + } + let fromNode = getC4ShapeObj(rel2.from); + let endNode = getC4ShapeObj(rel2.to); + let points = getIntersectPoints(fromNode, endNode); + rel2.startPoint = points.startPoint; + rel2.endPoint = points.endPoint; + } + svgDraw_default.drawRels(diagram32, rels2, conf, diagramId3); + }, "drawRels"); + __name(drawInsideBoundary, "drawInsideBoundary"); + draw = /* @__PURE__ */ __name(function(_text, id35, _version, diagObj) { + conf = getConfig2().c4; + const securityLevel = getConfig2().securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + let db10 = diagObj.db; + diagObj.db.setWrap(conf.wrap); + c4ShapeInRow2 = db10.getC4ShapeInRow(); + c4BoundaryInRow2 = db10.getC4BoundaryInRow(); + log.debug(`C:${JSON.stringify(conf, null, 2)}`); + const diagram32 = securityLevel === "sandbox" ? root4.select(`[id="${id35}"]`) : select_default2(`[id="${id35}"]`); + svgDraw_default.insertComputerIcon(diagram32, id35); + svgDraw_default.insertDatabaseIcon(diagram32, id35); + svgDraw_default.insertClockIcon(diagram32, id35); + let screenBounds = new Bounds(diagObj); + screenBounds.setData( + conf.diagramMarginX, + conf.diagramMarginX, + conf.diagramMarginY, + conf.diagramMarginY + ); + screenBounds.data.widthLimit = screen.availWidth; + globalBoundaryMaxX = conf.diagramMarginX; + globalBoundaryMaxY = conf.diagramMarginY; + const title2 = diagObj.db.getTitle(); + let currentBoundaries = diagObj.db.getBoundaries(""); + drawInsideBoundary(diagram32, "", screenBounds, currentBoundaries, diagObj); + svgDraw_default.insertArrowHead(diagram32, id35); + svgDraw_default.insertArrowEnd(diagram32, id35); + svgDraw_default.insertArrowCrossHead(diagram32, id35); + svgDraw_default.insertArrowFilledHead(diagram32, id35); + drawRels2(diagram32, diagObj.db.getRels(), diagObj.db.getC4Shape, diagObj, id35); + screenBounds.data.stopx = globalBoundaryMaxX; + screenBounds.data.stopy = globalBoundaryMaxY; + const box = screenBounds.data; + let boxHeight = box.stopy - box.starty; + let height2 = boxHeight + 2 * conf.diagramMarginY; + let boxWidth = box.stopx - box.startx; + const width3 = boxWidth + 2 * conf.diagramMarginX; + if (title2) { + diagram32.append("text").text(title2).attr("x", (box.stopx - box.startx) / 2 - 4 * conf.diagramMarginX).attr("y", box.starty + conf.diagramMarginY); + } + configureSvgSize(diagram32, height2, width3, conf.useMaxWidth); + const extraVertForTitle = title2 ? 60 : 0; + diagram32.attr( + "viewBox", + box.startx - conf.diagramMarginX + " -" + (conf.diagramMarginY + extraVertForTitle) + " " + width3 + " " + (height2 + extraVertForTitle) + ); + log.debug(`models:`, box); + }, "draw"); + c4Renderer_default = { + drawPersonOrSystemArray: drawC4ShapeArray, + drawBoundary: drawBoundary2, + setConf, + draw + }; + } + }); + + // src/diagrams/c4/styles.js + var getStyles2, styles_default2; + var init_styles2 = __esm({ + "src/diagrams/c4/styles.js"() { + "use strict"; + getStyles2 = /* @__PURE__ */ __name((options2) => `.person { + stroke: ${options2.personBorder}; + fill: ${options2.personBkg}; + } +`, "getStyles"); + styles_default2 = getStyles2; + } + }); + + // src/diagrams/c4/c4Diagram.ts + var c4Diagram_exports = {}; + __export(c4Diagram_exports, { + diagram: () => diagram + }); + var diagram; + var init_c4Diagram2 = __esm({ + "src/diagrams/c4/c4Diagram.ts"() { + "use strict"; + init_c4Diagram(); + init_c4Db(); + init_c4Renderer(); + init_styles2(); + diagram = { + parser: c4Diagram_default, + db: c4Db_default, + renderer: c4Renderer_default, + styles: styles_default2, + init: /* @__PURE__ */ __name(({ c4, wrap: wrap3 }) => { + c4Renderer_default.setConf(c4); + c4Db_default.setWrap(wrap3); + }, "init") + }; + } + }); + + // ../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs + function isNothing(subject) { + return typeof subject === "undefined" || subject === null; + } + function isObject(subject) { + return typeof subject === "object" && subject !== null; + } + function toArray(sequence) { + if (Array.isArray(sequence)) return sequence; + else if (isNothing(sequence)) return []; + return [sequence]; + } + function extend2(target, source) { + var index, length2, key, sourceKeys; + if (source) { + sourceKeys = Object.keys(source); + for (index = 0, length2 = sourceKeys.length; index < length2; index += 1) { + key = sourceKeys[index]; + target[key] = source[key]; + } + } + return target; + } + function repeat(string3, count2) { + var result = "", cycle; + for (cycle = 0; cycle < count2; cycle += 1) { + result += string3; + } + return result; + } + function isNegativeZero(number7) { + return number7 === 0 && Number.NEGATIVE_INFINITY === 1 / number7; + } + function formatError(exception2, compact2) { + var where = "", message = exception2.reason || "(unknown reason)"; + if (!exception2.mark) return message; + if (exception2.mark.name) { + where += 'in "' + exception2.mark.name + '" '; + } + where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")"; + if (!compact2 && exception2.mark.snippet) { + where += "\n\n" + exception2.mark.snippet; + } + return message + " " + where; + } + function YAMLException$1(reason, mark) { + Error.call(this); + this.name = "YAMLException"; + this.reason = reason; + this.mark = mark; + this.message = formatError(this, false); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = new Error().stack || ""; + } + } + function getLine(buffer, lineStart, lineEnd, position5, maxLineLength) { + var head2 = ""; + var tail = ""; + var maxHalfLength = Math.floor(maxLineLength / 2) - 1; + if (position5 - lineStart > maxHalfLength) { + head2 = " ... "; + lineStart = position5 - maxHalfLength + head2.length; + } + if (lineEnd - position5 > maxHalfLength) { + tail = " ..."; + lineEnd = position5 + maxHalfLength - tail.length; + } + return { + str: head2 + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail, + pos: position5 - lineStart + head2.length + // relative position + }; + } + function padStart(string3, max10) { + return common.repeat(" ", max10 - string3.length) + string3; + } + function makeSnippet(mark, options2) { + options2 = Object.create(options2 || null); + if (!mark.buffer) return null; + if (!options2.maxLength) options2.maxLength = 79; + if (typeof options2.indent !== "number") options2.indent = 1; + if (typeof options2.linesBefore !== "number") options2.linesBefore = 3; + if (typeof options2.linesAfter !== "number") options2.linesAfter = 2; + var re3 = /\r?\n|\r|\0/g; + var lineStarts = [0]; + var lineEnds = []; + var match3; + var foundLineNo = -1; + while (match3 = re3.exec(mark.buffer)) { + lineEnds.push(match3.index); + lineStarts.push(match3.index + match3[0].length); + if (mark.position <= match3.index && foundLineNo < 0) { + foundLineNo = lineStarts.length - 2; + } + } + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; + var result = "", i2, line2; + var lineNoLength = Math.min(mark.line + options2.linesAfter, lineEnds.length).toString().length; + var maxLineLength = options2.maxLength - (options2.indent + lineNoLength + 3); + for (i2 = 1; i2 <= options2.linesBefore; i2++) { + if (foundLineNo - i2 < 0) break; + line2 = getLine( + mark.buffer, + lineStarts[foundLineNo - i2], + lineEnds[foundLineNo - i2], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i2]), + maxLineLength + ); + result = common.repeat(" ", options2.indent) + padStart((mark.line - i2 + 1).toString(), lineNoLength) + " | " + line2.str + "\n" + result; + } + line2 = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + result += common.repeat(" ", options2.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line2.str + "\n"; + result += common.repeat("-", options2.indent + lineNoLength + 3 + line2.pos) + "^\n"; + for (i2 = 1; i2 <= options2.linesAfter; i2++) { + if (foundLineNo + i2 >= lineEnds.length) break; + line2 = getLine( + mark.buffer, + lineStarts[foundLineNo + i2], + lineEnds[foundLineNo + i2], + mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i2]), + maxLineLength + ); + result += common.repeat(" ", options2.indent) + padStart((mark.line + i2 + 1).toString(), lineNoLength) + " | " + line2.str + "\n"; + } + return result.replace(/\n$/, ""); + } + function compileStyleAliases(map6) { + var result = {}; + if (map6 !== null) { + Object.keys(map6).forEach(function(style3) { + map6[style3].forEach(function(alias) { + result[String(alias)] = style3; + }); + }); + } + return result; + } + function Type$1(tag, options2) { + options2 = options2 || {}; + Object.keys(options2).forEach(function(name) { + if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { + throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + } + }); + this.options = options2; + this.tag = tag; + this.kind = options2["kind"] || null; + this.resolve = options2["resolve"] || function() { + return true; + }; + this.construct = options2["construct"] || function(data5) { + return data5; + }; + this.instanceOf = options2["instanceOf"] || null; + this.predicate = options2["predicate"] || null; + this.represent = options2["represent"] || null; + this.representName = options2["representName"] || null; + this.defaultStyle = options2["defaultStyle"] || null; + this.multi = options2["multi"] || false; + this.styleAliases = compileStyleAliases(options2["styleAliases"] || null); + if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { + throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + } + } + function compileList(schema2, name) { + var result = []; + schema2[name].forEach(function(currentType) { + var newIndex = result.length; + result.forEach(function(previousType, previousIndex) { + if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) { + newIndex = previousIndex; + } + }); + result[newIndex] = currentType; + }); + return result; + } + function compileMap() { + var result = { + scalar: {}, + sequence: {}, + mapping: {}, + fallback: {}, + multi: { + scalar: [], + sequence: [], + mapping: [], + fallback: [] + } + }, index, length2; + function collectType(type3) { + if (type3.multi) { + result.multi[type3.kind].push(type3); + result.multi["fallback"].push(type3); + } else { + result[type3.kind][type3.tag] = result["fallback"][type3.tag] = type3; + } + } + __name(collectType, "collectType"); + for (index = 0, length2 = arguments.length; index < length2; index += 1) { + arguments[index].forEach(collectType); + } + return result; + } + function Schema$1(definition) { + return this.extend(definition); + } + function resolveYamlNull(data5) { + if (data5 === null) return true; + var max10 = data5.length; + return max10 === 1 && data5 === "~" || max10 === 4 && (data5 === "null" || data5 === "Null" || data5 === "NULL"); + } + function constructYamlNull() { + return null; + } + function isNull(object3) { + return object3 === null; + } + function resolveYamlBoolean(data5) { + if (data5 === null) return false; + var max10 = data5.length; + return max10 === 4 && (data5 === "true" || data5 === "True" || data5 === "TRUE") || max10 === 5 && (data5 === "false" || data5 === "False" || data5 === "FALSE"); + } + function constructYamlBoolean(data5) { + return data5 === "true" || data5 === "True" || data5 === "TRUE"; + } + function isBoolean(object3) { + return Object.prototype.toString.call(object3) === "[object Boolean]"; + } + function isHexCode(c3) { + return 48 <= c3 && c3 <= 57 || 65 <= c3 && c3 <= 70 || 97 <= c3 && c3 <= 102; + } + function isOctCode(c3) { + return 48 <= c3 && c3 <= 55; + } + function isDecCode(c3) { + return 48 <= c3 && c3 <= 57; + } + function resolveYamlInteger(data5) { + if (data5 === null) return false; + var max10 = data5.length, index = 0, hasDigits = false, ch; + if (!max10) return false; + ch = data5[index]; + if (ch === "-" || ch === "+") { + ch = data5[++index]; + } + if (ch === "0") { + if (index + 1 === max10) return true; + ch = data5[++index]; + if (ch === "b") { + index++; + for (; index < max10; index++) { + ch = data5[index]; + if (ch === "_") continue; + if (ch !== "0" && ch !== "1") return false; + hasDigits = true; + } + return hasDigits && ch !== "_"; + } + if (ch === "x") { + index++; + for (; index < max10; index++) { + ch = data5[index]; + if (ch === "_") continue; + if (!isHexCode(data5.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== "_"; + } + if (ch === "o") { + index++; + for (; index < max10; index++) { + ch = data5[index]; + if (ch === "_") continue; + if (!isOctCode(data5.charCodeAt(index))) return false; + hasDigits = true; + } + return hasDigits && ch !== "_"; + } + } + if (ch === "_") return false; + for (; index < max10; index++) { + ch = data5[index]; + if (ch === "_") continue; + if (!isDecCode(data5.charCodeAt(index))) { + return false; + } + hasDigits = true; + } + if (!hasDigits || ch === "_") return false; + return true; + } + function constructYamlInteger(data5) { + var value2 = data5, sign2 = 1, ch; + if (value2.indexOf("_") !== -1) { + value2 = value2.replace(/_/g, ""); + } + ch = value2[0]; + if (ch === "-" || ch === "+") { + if (ch === "-") sign2 = -1; + value2 = value2.slice(1); + ch = value2[0]; + } + if (value2 === "0") return 0; + if (ch === "0") { + if (value2[1] === "b") return sign2 * parseInt(value2.slice(2), 2); + if (value2[1] === "x") return sign2 * parseInt(value2.slice(2), 16); + if (value2[1] === "o") return sign2 * parseInt(value2.slice(2), 8); + } + return sign2 * parseInt(value2, 10); + } + function isInteger(object3) { + return Object.prototype.toString.call(object3) === "[object Number]" && (object3 % 1 === 0 && !common.isNegativeZero(object3)); + } + function resolveYamlFloat(data5) { + if (data5 === null) return false; + if (!YAML_FLOAT_PATTERN.test(data5) || // Quick hack to not allow integers end with `_` + // Probably should update regexp & check speed + data5[data5.length - 1] === "_") { + return false; + } + return true; + } + function constructYamlFloat(data5) { + var value2, sign2; + value2 = data5.replace(/_/g, "").toLowerCase(); + sign2 = value2[0] === "-" ? -1 : 1; + if ("+-".indexOf(value2[0]) >= 0) { + value2 = value2.slice(1); + } + if (value2 === ".inf") { + return sign2 === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; + } else if (value2 === ".nan") { + return NaN; + } + return sign2 * parseFloat(value2, 10); + } + function representYamlFloat(object3, style3) { + var res; + if (isNaN(object3)) { + switch (style3) { + case "lowercase": + return ".nan"; + case "uppercase": + return ".NAN"; + case "camelcase": + return ".NaN"; + } + } else if (Number.POSITIVE_INFINITY === object3) { + switch (style3) { + case "lowercase": + return ".inf"; + case "uppercase": + return ".INF"; + case "camelcase": + return ".Inf"; + } + } else if (Number.NEGATIVE_INFINITY === object3) { + switch (style3) { + case "lowercase": + return "-.inf"; + case "uppercase": + return "-.INF"; + case "camelcase": + return "-.Inf"; + } + } else if (common.isNegativeZero(object3)) { + return "-0.0"; + } + res = object3.toString(10); + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res; + } + function isFloat(object3) { + return Object.prototype.toString.call(object3) === "[object Number]" && (object3 % 1 !== 0 || common.isNegativeZero(object3)); + } + function resolveYamlTimestamp(data5) { + if (data5 === null) return false; + if (YAML_DATE_REGEXP.exec(data5) !== null) return true; + if (YAML_TIMESTAMP_REGEXP.exec(data5) !== null) return true; + return false; + } + function constructYamlTimestamp(data5) { + var match3, year, month, day, hour, minute, second2, fraction = 0, delta = null, tz_hour, tz_minute, date2; + match3 = YAML_DATE_REGEXP.exec(data5); + if (match3 === null) match3 = YAML_TIMESTAMP_REGEXP.exec(data5); + if (match3 === null) throw new Error("Date resolve error"); + year = +match3[1]; + month = +match3[2] - 1; + day = +match3[3]; + if (!match3[4]) { + return new Date(Date.UTC(year, month, day)); + } + hour = +match3[4]; + minute = +match3[5]; + second2 = +match3[6]; + if (match3[7]) { + fraction = match3[7].slice(0, 3); + while (fraction.length < 3) { + fraction += "0"; + } + fraction = +fraction; + } + if (match3[9]) { + tz_hour = +match3[10]; + tz_minute = +(match3[11] || 0); + delta = (tz_hour * 60 + tz_minute) * 6e4; + if (match3[9] === "-") delta = -delta; + } + date2 = new Date(Date.UTC(year, month, day, hour, minute, second2, fraction)); + if (delta) date2.setTime(date2.getTime() - delta); + return date2; + } + function representYamlTimestamp(object3) { + return object3.toISOString(); + } + function resolveYamlMerge(data5) { + return data5 === "<<" || data5 === null; + } + function resolveYamlBinary(data5) { + if (data5 === null) return false; + var code, idx, bitlen = 0, max10 = data5.length, map6 = BASE64_MAP; + for (idx = 0; idx < max10; idx++) { + code = map6.indexOf(data5.charAt(idx)); + if (code > 64) continue; + if (code < 0) return false; + bitlen += 6; + } + return bitlen % 8 === 0; + } + function constructYamlBinary(data5) { + var idx, tailbits, input = data5.replace(/[\r\n=]/g, ""), max10 = input.length, map6 = BASE64_MAP, bits = 0, result = []; + for (idx = 0; idx < max10; idx++) { + if (idx % 4 === 0 && idx) { + result.push(bits >> 16 & 255); + result.push(bits >> 8 & 255); + result.push(bits & 255); + } + bits = bits << 6 | map6.indexOf(input.charAt(idx)); + } + tailbits = max10 % 4 * 6; + if (tailbits === 0) { + result.push(bits >> 16 & 255); + result.push(bits >> 8 & 255); + result.push(bits & 255); + } else if (tailbits === 18) { + result.push(bits >> 10 & 255); + result.push(bits >> 2 & 255); + } else if (tailbits === 12) { + result.push(bits >> 4 & 255); + } + return new Uint8Array(result); + } + function representYamlBinary(object3) { + var result = "", bits = 0, idx, tail, max10 = object3.length, map6 = BASE64_MAP; + for (idx = 0; idx < max10; idx++) { + if (idx % 3 === 0 && idx) { + result += map6[bits >> 18 & 63]; + result += map6[bits >> 12 & 63]; + result += map6[bits >> 6 & 63]; + result += map6[bits & 63]; + } + bits = (bits << 8) + object3[idx]; + } + tail = max10 % 3; + if (tail === 0) { + result += map6[bits >> 18 & 63]; + result += map6[bits >> 12 & 63]; + result += map6[bits >> 6 & 63]; + result += map6[bits & 63]; + } else if (tail === 2) { + result += map6[bits >> 10 & 63]; + result += map6[bits >> 4 & 63]; + result += map6[bits << 2 & 63]; + result += map6[64]; + } else if (tail === 1) { + result += map6[bits >> 2 & 63]; + result += map6[bits << 4 & 63]; + result += map6[64]; + result += map6[64]; + } + return result; + } + function isBinary(obj) { + return Object.prototype.toString.call(obj) === "[object Uint8Array]"; + } + function resolveYamlOmap(data5) { + if (data5 === null) return true; + var objectKeys = [], index, length2, pair, pairKey, pairHasKey, object3 = data5; + for (index = 0, length2 = object3.length; index < length2; index += 1) { + pair = object3[index]; + pairHasKey = false; + if (_toString$2.call(pair) !== "[object Object]") return false; + for (pairKey in pair) { + if (_hasOwnProperty$3.call(pair, pairKey)) { + if (!pairHasKey) pairHasKey = true; + else return false; + } + } + if (!pairHasKey) return false; + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); + else return false; + } + return true; + } + function constructYamlOmap(data5) { + return data5 !== null ? data5 : []; + } + function resolveYamlPairs(data5) { + if (data5 === null) return true; + var index, length2, pair, keys3, result, object3 = data5; + result = new Array(object3.length); + for (index = 0, length2 = object3.length; index < length2; index += 1) { + pair = object3[index]; + if (_toString$1.call(pair) !== "[object Object]") return false; + keys3 = Object.keys(pair); + if (keys3.length !== 1) return false; + result[index] = [keys3[0], pair[keys3[0]]]; + } + return true; + } + function constructYamlPairs(data5) { + if (data5 === null) return []; + var index, length2, pair, keys3, result, object3 = data5; + result = new Array(object3.length); + for (index = 0, length2 = object3.length; index < length2; index += 1) { + pair = object3[index]; + keys3 = Object.keys(pair); + result[index] = [keys3[0], pair[keys3[0]]]; + } + return result; + } + function resolveYamlSet(data5) { + if (data5 === null) return true; + var key, object3 = data5; + for (key in object3) { + if (_hasOwnProperty$2.call(object3, key)) { + if (object3[key] !== null) return false; + } + } + return true; + } + function constructYamlSet(data5) { + return data5 !== null ? data5 : {}; + } + function _class(obj) { + return Object.prototype.toString.call(obj); + } + function is_EOL(c3) { + return c3 === 10 || c3 === 13; + } + function is_WHITE_SPACE(c3) { + return c3 === 9 || c3 === 32; + } + function is_WS_OR_EOL(c3) { + return c3 === 9 || c3 === 32 || c3 === 10 || c3 === 13; + } + function is_FLOW_INDICATOR(c3) { + return c3 === 44 || c3 === 91 || c3 === 93 || c3 === 123 || c3 === 125; + } + function fromHexCode(c3) { + var lc; + if (48 <= c3 && c3 <= 57) { + return c3 - 48; + } + lc = c3 | 32; + if (97 <= lc && lc <= 102) { + return lc - 97 + 10; + } + return -1; + } + function escapedHexLen(c3) { + if (c3 === 120) { + return 2; + } + if (c3 === 117) { + return 4; + } + if (c3 === 85) { + return 8; + } + return 0; + } + function fromDecimalCode(c3) { + if (48 <= c3 && c3 <= 57) { + return c3 - 48; + } + return -1; + } + function simpleEscapeSequence(c3) { + return c3 === 48 ? "\0" : c3 === 97 ? "\x07" : c3 === 98 ? "\b" : c3 === 116 ? " " : c3 === 9 ? " " : c3 === 110 ? "\n" : c3 === 118 ? "\v" : c3 === 102 ? "\f" : c3 === 114 ? "\r" : c3 === 101 ? "\x1B" : c3 === 32 ? " " : c3 === 34 ? '"' : c3 === 47 ? "/" : c3 === 92 ? "\\" : c3 === 78 ? "\x85" : c3 === 95 ? "\xA0" : c3 === 76 ? "\u2028" : c3 === 80 ? "\u2029" : ""; + } + function charFromCodepoint(c3) { + if (c3 <= 65535) { + return String.fromCharCode(c3); + } + return String.fromCharCode( + (c3 - 65536 >> 10) + 55296, + (c3 - 65536 & 1023) + 56320 + ); + } + function setProperty(object3, key, value2) { + if (key === "__proto__") { + Object.defineProperty(object3, key, { + configurable: true, + enumerable: true, + writable: true, + value: value2 + }); + } else { + object3[key] = value2; + } + } + function State$1(input, options2) { + this.input = input; + this.filename = options2["filename"] || null; + this.schema = options2["schema"] || _default; + this.onWarning = options2["onWarning"] || null; + this.legacy = options2["legacy"] || false; + this.json = options2["json"] || false; + this.listener = options2["listener"] || null; + this.implicitTypes = this.schema.compiledImplicit; + this.typeMap = this.schema.compiledTypeMap; + this.length = input.length; + this.position = 0; + this.line = 0; + this.lineStart = 0; + this.lineIndent = 0; + this.firstTabInLine = -1; + this.documents = []; + } + function generateError(state4, message) { + var mark = { + name: state4.filename, + buffer: state4.input.slice(0, -1), + // omit trailing \0 + position: state4.position, + line: state4.line, + column: state4.position - state4.lineStart + }; + mark.snippet = snippet(mark); + return new exception(message, mark); + } + function throwError(state4, message) { + throw generateError(state4, message); + } + function throwWarning(state4, message) { + if (state4.onWarning) { + state4.onWarning.call(null, generateError(state4, message)); + } + } + function captureSegment(state4, start3, end2, checkJson) { + var _position, _length, _character, _result; + if (start3 < end2) { + _result = state4.input.slice(start3, end2); + if (checkJson) { + for (_position = 0, _length = _result.length; _position < _length; _position += 1) { + _character = _result.charCodeAt(_position); + if (!(_character === 9 || 32 <= _character && _character <= 1114111)) { + throwError(state4, "expected valid JSON character"); + } + } + } else if (PATTERN_NON_PRINTABLE.test(_result)) { + throwError(state4, "the stream contains non-printable characters"); + } + state4.result += _result; + } + } + function mergeMappings(state4, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity; + if (!common.isObject(source)) { + throwError(state4, "cannot merge mappings; the provided source object is unacceptable"); + } + sourceKeys = Object.keys(source); + for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + key = sourceKeys[index]; + if (!_hasOwnProperty$1.call(destination, key)) { + setProperty(destination, key, source[key]); + overridableKeys[key] = true; + } + } + } + function storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) { + var index, quantity; + if (Array.isArray(keyNode)) { + keyNode = Array.prototype.slice.call(keyNode); + for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + if (Array.isArray(keyNode[index])) { + throwError(state4, "nested arrays are not supported inside keys"); + } + if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") { + keyNode[index] = "[object Object]"; + } + } + } + if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") { + keyNode = "[object Object]"; + } + keyNode = String(keyNode); + if (_result === null) { + _result = {}; + } + if (keyTag === "tag:yaml.org,2002:merge") { + if (Array.isArray(valueNode)) { + for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + mergeMappings(state4, _result, valueNode[index], overridableKeys); + } + } else { + mergeMappings(state4, _result, valueNode, overridableKeys); + } + } else { + if (!state4.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) { + state4.line = startLine || state4.line; + state4.lineStart = startLineStart || state4.lineStart; + state4.position = startPos || state4.position; + throwError(state4, "duplicated mapping key"); + } + setProperty(_result, keyNode, valueNode); + delete overridableKeys[keyNode]; + } + return _result; + } + function readLineBreak(state4) { + var ch; + ch = state4.input.charCodeAt(state4.position); + if (ch === 10) { + state4.position++; + } else if (ch === 13) { + state4.position++; + if (state4.input.charCodeAt(state4.position) === 10) { + state4.position++; + } + } else { + throwError(state4, "a line break is expected"); + } + state4.line += 1; + state4.lineStart = state4.position; + state4.firstTabInLine = -1; + } + function skipSeparationSpace(state4, allowComments, checkIndent) { + var lineBreaks = 0, ch = state4.input.charCodeAt(state4.position); + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + if (ch === 9 && state4.firstTabInLine === -1) { + state4.firstTabInLine = state4.position; + } + ch = state4.input.charCodeAt(++state4.position); + } + if (allowComments && ch === 35) { + do { + ch = state4.input.charCodeAt(++state4.position); + } while (ch !== 10 && ch !== 13 && ch !== 0); + } + if (is_EOL(ch)) { + readLineBreak(state4); + ch = state4.input.charCodeAt(state4.position); + lineBreaks++; + state4.lineIndent = 0; + while (ch === 32) { + state4.lineIndent++; + ch = state4.input.charCodeAt(++state4.position); + } + } else { + break; + } + } + if (checkIndent !== -1 && lineBreaks !== 0 && state4.lineIndent < checkIndent) { + throwWarning(state4, "deficient indentation"); + } + return lineBreaks; + } + function testDocumentSeparator(state4) { + var _position = state4.position, ch; + ch = state4.input.charCodeAt(_position); + if ((ch === 45 || ch === 46) && ch === state4.input.charCodeAt(_position + 1) && ch === state4.input.charCodeAt(_position + 2)) { + _position += 3; + ch = state4.input.charCodeAt(_position); + if (ch === 0 || is_WS_OR_EOL(ch)) { + return true; + } + } + return false; + } + function writeFoldedLines(state4, count2) { + if (count2 === 1) { + state4.result += " "; + } else if (count2 > 1) { + state4.result += common.repeat("\n", count2 - 1); + } + } + function readPlainScalar(state4, nodeIndent, withinFlowCollection) { + var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state4.kind, _result = state4.result, ch; + ch = state4.input.charCodeAt(state4.position); + if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) { + return false; + } + if (ch === 63 || ch === 45) { + following = state4.input.charCodeAt(state4.position + 1); + if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { + return false; + } + } + state4.kind = "scalar"; + state4.result = ""; + captureStart = captureEnd = state4.position; + hasPendingContent = false; + while (ch !== 0) { + if (ch === 58) { + following = state4.input.charCodeAt(state4.position + 1); + if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { + break; + } + } else if (ch === 35) { + preceding = state4.input.charCodeAt(state4.position - 1); + if (is_WS_OR_EOL(preceding)) { + break; + } + } else if (state4.position === state4.lineStart && testDocumentSeparator(state4) || withinFlowCollection && is_FLOW_INDICATOR(ch)) { + break; + } else if (is_EOL(ch)) { + _line = state4.line; + _lineStart = state4.lineStart; + _lineIndent = state4.lineIndent; + skipSeparationSpace(state4, false, -1); + if (state4.lineIndent >= nodeIndent) { + hasPendingContent = true; + ch = state4.input.charCodeAt(state4.position); + continue; + } else { + state4.position = captureEnd; + state4.line = _line; + state4.lineStart = _lineStart; + state4.lineIndent = _lineIndent; + break; + } + } + if (hasPendingContent) { + captureSegment(state4, captureStart, captureEnd, false); + writeFoldedLines(state4, state4.line - _line); + captureStart = captureEnd = state4.position; + hasPendingContent = false; + } + if (!is_WHITE_SPACE(ch)) { + captureEnd = state4.position + 1; + } + ch = state4.input.charCodeAt(++state4.position); + } + captureSegment(state4, captureStart, captureEnd, false); + if (state4.result) { + return true; + } + state4.kind = _kind; + state4.result = _result; + return false; + } + function readSingleQuotedScalar(state4, nodeIndent) { + var ch, captureStart, captureEnd; + ch = state4.input.charCodeAt(state4.position); + if (ch !== 39) { + return false; + } + state4.kind = "scalar"; + state4.result = ""; + state4.position++; + captureStart = captureEnd = state4.position; + while ((ch = state4.input.charCodeAt(state4.position)) !== 0) { + if (ch === 39) { + captureSegment(state4, captureStart, state4.position, true); + ch = state4.input.charCodeAt(++state4.position); + if (ch === 39) { + captureStart = state4.position; + state4.position++; + captureEnd = state4.position; + } else { + return true; + } + } else if (is_EOL(ch)) { + captureSegment(state4, captureStart, captureEnd, true); + writeFoldedLines(state4, skipSeparationSpace(state4, false, nodeIndent)); + captureStart = captureEnd = state4.position; + } else if (state4.position === state4.lineStart && testDocumentSeparator(state4)) { + throwError(state4, "unexpected end of the document within a single quoted scalar"); + } else { + state4.position++; + captureEnd = state4.position; + } + } + throwError(state4, "unexpected end of the stream within a single quoted scalar"); + } + function readDoubleQuotedScalar(state4, nodeIndent) { + var captureStart, captureEnd, hexLength, hexResult, tmp, ch; + ch = state4.input.charCodeAt(state4.position); + if (ch !== 34) { + return false; + } + state4.kind = "scalar"; + state4.result = ""; + state4.position++; + captureStart = captureEnd = state4.position; + while ((ch = state4.input.charCodeAt(state4.position)) !== 0) { + if (ch === 34) { + captureSegment(state4, captureStart, state4.position, true); + state4.position++; + return true; + } else if (ch === 92) { + captureSegment(state4, captureStart, state4.position, true); + ch = state4.input.charCodeAt(++state4.position); + if (is_EOL(ch)) { + skipSeparationSpace(state4, false, nodeIndent); + } else if (ch < 256 && simpleEscapeCheck[ch]) { + state4.result += simpleEscapeMap[ch]; + state4.position++; + } else if ((tmp = escapedHexLen(ch)) > 0) { + hexLength = tmp; + hexResult = 0; + for (; hexLength > 0; hexLength--) { + ch = state4.input.charCodeAt(++state4.position); + if ((tmp = fromHexCode(ch)) >= 0) { + hexResult = (hexResult << 4) + tmp; + } else { + throwError(state4, "expected hexadecimal character"); + } + } + state4.result += charFromCodepoint(hexResult); + state4.position++; + } else { + throwError(state4, "unknown escape sequence"); + } + captureStart = captureEnd = state4.position; + } else if (is_EOL(ch)) { + captureSegment(state4, captureStart, captureEnd, true); + writeFoldedLines(state4, skipSeparationSpace(state4, false, nodeIndent)); + captureStart = captureEnd = state4.position; + } else if (state4.position === state4.lineStart && testDocumentSeparator(state4)) { + throwError(state4, "unexpected end of the document within a double quoted scalar"); + } else { + state4.position++; + captureEnd = state4.position; + } + } + throwError(state4, "unexpected end of the stream within a double quoted scalar"); + } + function readFlowCollection(state4, nodeIndent) { + var readNext = true, _line, _lineStart, _pos, _tag = state4.tag, _result, _anchor = state4.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch; + ch = state4.input.charCodeAt(state4.position); + if (ch === 91) { + terminator = 93; + isMapping = false; + _result = []; + } else if (ch === 123) { + terminator = 125; + isMapping = true; + _result = {}; + } else { + return false; + } + if (state4.anchor !== null) { + state4.anchorMap[state4.anchor] = _result; + } + ch = state4.input.charCodeAt(++state4.position); + while (ch !== 0) { + skipSeparationSpace(state4, true, nodeIndent); + ch = state4.input.charCodeAt(state4.position); + if (ch === terminator) { + state4.position++; + state4.tag = _tag; + state4.anchor = _anchor; + state4.kind = isMapping ? "mapping" : "sequence"; + state4.result = _result; + return true; + } else if (!readNext) { + throwError(state4, "missed comma between flow collection entries"); + } else if (ch === 44) { + throwError(state4, "expected the node content, but found ','"); + } + keyTag = keyNode = valueNode = null; + isPair = isExplicitPair = false; + if (ch === 63) { + following = state4.input.charCodeAt(state4.position + 1); + if (is_WS_OR_EOL(following)) { + isPair = isExplicitPair = true; + state4.position++; + skipSeparationSpace(state4, true, nodeIndent); + } + } + _line = state4.line; + _lineStart = state4.lineStart; + _pos = state4.position; + composeNode(state4, nodeIndent, CONTEXT_FLOW_IN, false, true); + keyTag = state4.tag; + keyNode = state4.result; + skipSeparationSpace(state4, true, nodeIndent); + ch = state4.input.charCodeAt(state4.position); + if ((isExplicitPair || state4.line === _line) && ch === 58) { + isPair = true; + ch = state4.input.charCodeAt(++state4.position); + skipSeparationSpace(state4, true, nodeIndent); + composeNode(state4, nodeIndent, CONTEXT_FLOW_IN, false, true); + valueNode = state4.result; + } + if (isMapping) { + storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + } else if (isPair) { + _result.push(storeMappingPair(state4, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + } else { + _result.push(keyNode); + } + skipSeparationSpace(state4, true, nodeIndent); + ch = state4.input.charCodeAt(state4.position); + if (ch === 44) { + readNext = true; + ch = state4.input.charCodeAt(++state4.position); + } else { + readNext = false; + } + } + throwError(state4, "unexpected end of the stream within a flow collection"); + } + function readBlockScalar(state4, nodeIndent) { + var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch; + ch = state4.input.charCodeAt(state4.position); + if (ch === 124) { + folding = false; + } else if (ch === 62) { + folding = true; + } else { + return false; + } + state4.kind = "scalar"; + state4.result = ""; + while (ch !== 0) { + ch = state4.input.charCodeAt(++state4.position); + if (ch === 43 || ch === 45) { + if (CHOMPING_CLIP === chomping) { + chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP; + } else { + throwError(state4, "repeat of a chomping mode identifier"); + } + } else if ((tmp = fromDecimalCode(ch)) >= 0) { + if (tmp === 0) { + throwError(state4, "bad explicit indentation width of a block scalar; it cannot be less than one"); + } else if (!detectedIndent) { + textIndent = nodeIndent + tmp - 1; + detectedIndent = true; + } else { + throwError(state4, "repeat of an indentation width identifier"); + } + } else { + break; + } + } + if (is_WHITE_SPACE(ch)) { + do { + ch = state4.input.charCodeAt(++state4.position); + } while (is_WHITE_SPACE(ch)); + if (ch === 35) { + do { + ch = state4.input.charCodeAt(++state4.position); + } while (!is_EOL(ch) && ch !== 0); + } + } + while (ch !== 0) { + readLineBreak(state4); + state4.lineIndent = 0; + ch = state4.input.charCodeAt(state4.position); + while ((!detectedIndent || state4.lineIndent < textIndent) && ch === 32) { + state4.lineIndent++; + ch = state4.input.charCodeAt(++state4.position); + } + if (!detectedIndent && state4.lineIndent > textIndent) { + textIndent = state4.lineIndent; + } + if (is_EOL(ch)) { + emptyLines++; + continue; + } + if (state4.lineIndent < textIndent) { + if (chomping === CHOMPING_KEEP) { + state4.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines); + } else if (chomping === CHOMPING_CLIP) { + if (didReadContent) { + state4.result += "\n"; + } + } + break; + } + if (folding) { + if (is_WHITE_SPACE(ch)) { + atMoreIndented = true; + state4.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines); + } else if (atMoreIndented) { + atMoreIndented = false; + state4.result += common.repeat("\n", emptyLines + 1); + } else if (emptyLines === 0) { + if (didReadContent) { + state4.result += " "; + } + } else { + state4.result += common.repeat("\n", emptyLines); + } + } else { + state4.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines); + } + didReadContent = true; + detectedIndent = true; + emptyLines = 0; + captureStart = state4.position; + while (!is_EOL(ch) && ch !== 0) { + ch = state4.input.charCodeAt(++state4.position); + } + captureSegment(state4, captureStart, state4.position, false); + } + return true; + } + function readBlockSequence(state4, nodeIndent) { + var _line, _tag = state4.tag, _anchor = state4.anchor, _result = [], following, detected = false, ch; + if (state4.firstTabInLine !== -1) return false; + if (state4.anchor !== null) { + state4.anchorMap[state4.anchor] = _result; + } + ch = state4.input.charCodeAt(state4.position); + while (ch !== 0) { + if (state4.firstTabInLine !== -1) { + state4.position = state4.firstTabInLine; + throwError(state4, "tab characters must not be used in indentation"); + } + if (ch !== 45) { + break; + } + following = state4.input.charCodeAt(state4.position + 1); + if (!is_WS_OR_EOL(following)) { + break; + } + detected = true; + state4.position++; + if (skipSeparationSpace(state4, true, -1)) { + if (state4.lineIndent <= nodeIndent) { + _result.push(null); + ch = state4.input.charCodeAt(state4.position); + continue; + } + } + _line = state4.line; + composeNode(state4, nodeIndent, CONTEXT_BLOCK_IN, false, true); + _result.push(state4.result); + skipSeparationSpace(state4, true, -1); + ch = state4.input.charCodeAt(state4.position); + if ((state4.line === _line || state4.lineIndent > nodeIndent) && ch !== 0) { + throwError(state4, "bad indentation of a sequence entry"); + } else if (state4.lineIndent < nodeIndent) { + break; + } + } + if (detected) { + state4.tag = _tag; + state4.anchor = _anchor; + state4.kind = "sequence"; + state4.result = _result; + return true; + } + return false; + } + function readBlockMapping(state4, nodeIndent, flowIndent) { + var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state4.tag, _anchor = state4.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch; + if (state4.firstTabInLine !== -1) return false; + if (state4.anchor !== null) { + state4.anchorMap[state4.anchor] = _result; + } + ch = state4.input.charCodeAt(state4.position); + while (ch !== 0) { + if (!atExplicitKey && state4.firstTabInLine !== -1) { + state4.position = state4.firstTabInLine; + throwError(state4, "tab characters must not be used in indentation"); + } + following = state4.input.charCodeAt(state4.position + 1); + _line = state4.line; + if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) { + if (ch === 63) { + if (atExplicitKey) { + storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + detected = true; + atExplicitKey = true; + allowCompact = true; + } else if (atExplicitKey) { + atExplicitKey = false; + allowCompact = true; + } else { + throwError(state4, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"); + } + state4.position += 1; + ch = following; + } else { + _keyLine = state4.line; + _keyLineStart = state4.lineStart; + _keyPos = state4.position; + if (!composeNode(state4, flowIndent, CONTEXT_FLOW_OUT, false, true)) { + break; + } + if (state4.line === _line) { + ch = state4.input.charCodeAt(state4.position); + while (is_WHITE_SPACE(ch)) { + ch = state4.input.charCodeAt(++state4.position); + } + if (ch === 58) { + ch = state4.input.charCodeAt(++state4.position); + if (!is_WS_OR_EOL(ch)) { + throwError(state4, "a whitespace character is expected after the key-value separator within a block mapping"); + } + if (atExplicitKey) { + storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + detected = true; + atExplicitKey = false; + allowCompact = false; + keyTag = state4.tag; + keyNode = state4.result; + } else if (detected) { + throwError(state4, "can not read an implicit mapping pair; a colon is missed"); + } else { + state4.tag = _tag; + state4.anchor = _anchor; + return true; + } + } else if (detected) { + throwError(state4, "can not read a block mapping entry; a multiline key may not be an implicit key"); + } else { + state4.tag = _tag; + state4.anchor = _anchor; + return true; + } + } + if (state4.line === _line || state4.lineIndent > nodeIndent) { + if (atExplicitKey) { + _keyLine = state4.line; + _keyLineStart = state4.lineStart; + _keyPos = state4.position; + } + if (composeNode(state4, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { + if (atExplicitKey) { + keyNode = state4.result; + } else { + valueNode = state4.result; + } + } + if (!atExplicitKey) { + storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); + keyTag = keyNode = valueNode = null; + } + skipSeparationSpace(state4, true, -1); + ch = state4.input.charCodeAt(state4.position); + } + if ((state4.line === _line || state4.lineIndent > nodeIndent) && ch !== 0) { + throwError(state4, "bad indentation of a mapping entry"); + } else if (state4.lineIndent < nodeIndent) { + break; + } + } + if (atExplicitKey) { + storeMappingPair(state4, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + } + if (detected) { + state4.tag = _tag; + state4.anchor = _anchor; + state4.kind = "mapping"; + state4.result = _result; + } + return detected; + } + function readTagProperty(state4) { + var _position, isVerbatim = false, isNamed2 = false, tagHandle, tagName, ch; + ch = state4.input.charCodeAt(state4.position); + if (ch !== 33) return false; + if (state4.tag !== null) { + throwError(state4, "duplication of a tag property"); + } + ch = state4.input.charCodeAt(++state4.position); + if (ch === 60) { + isVerbatim = true; + ch = state4.input.charCodeAt(++state4.position); + } else if (ch === 33) { + isNamed2 = true; + tagHandle = "!!"; + ch = state4.input.charCodeAt(++state4.position); + } else { + tagHandle = "!"; + } + _position = state4.position; + if (isVerbatim) { + do { + ch = state4.input.charCodeAt(++state4.position); + } while (ch !== 0 && ch !== 62); + if (state4.position < state4.length) { + tagName = state4.input.slice(_position, state4.position); + ch = state4.input.charCodeAt(++state4.position); + } else { + throwError(state4, "unexpected end of the stream within a verbatim tag"); + } + } else { + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + if (ch === 33) { + if (!isNamed2) { + tagHandle = state4.input.slice(_position - 1, state4.position + 1); + if (!PATTERN_TAG_HANDLE.test(tagHandle)) { + throwError(state4, "named tag handle cannot contain such characters"); + } + isNamed2 = true; + _position = state4.position + 1; + } else { + throwError(state4, "tag suffix cannot contain exclamation marks"); + } + } + ch = state4.input.charCodeAt(++state4.position); + } + tagName = state4.input.slice(_position, state4.position); + if (PATTERN_FLOW_INDICATORS.test(tagName)) { + throwError(state4, "tag suffix cannot contain flow indicator characters"); + } + } + if (tagName && !PATTERN_TAG_URI.test(tagName)) { + throwError(state4, "tag name cannot contain such characters: " + tagName); + } + try { + tagName = decodeURIComponent(tagName); + } catch (err) { + throwError(state4, "tag name is malformed: " + tagName); + } + if (isVerbatim) { + state4.tag = tagName; + } else if (_hasOwnProperty$1.call(state4.tagMap, tagHandle)) { + state4.tag = state4.tagMap[tagHandle] + tagName; + } else if (tagHandle === "!") { + state4.tag = "!" + tagName; + } else if (tagHandle === "!!") { + state4.tag = "tag:yaml.org,2002:" + tagName; + } else { + throwError(state4, 'undeclared tag handle "' + tagHandle + '"'); + } + return true; + } + function readAnchorProperty(state4) { + var _position, ch; + ch = state4.input.charCodeAt(state4.position); + if (ch !== 38) return false; + if (state4.anchor !== null) { + throwError(state4, "duplication of an anchor property"); + } + ch = state4.input.charCodeAt(++state4.position); + _position = state4.position; + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state4.input.charCodeAt(++state4.position); + } + if (state4.position === _position) { + throwError(state4, "name of an anchor node must contain at least one character"); + } + state4.anchor = state4.input.slice(_position, state4.position); + return true; + } + function readAlias(state4) { + var _position, alias, ch; + ch = state4.input.charCodeAt(state4.position); + if (ch !== 42) return false; + ch = state4.input.charCodeAt(++state4.position); + _position = state4.position; + while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { + ch = state4.input.charCodeAt(++state4.position); + } + if (state4.position === _position) { + throwError(state4, "name of an alias node must contain at least one character"); + } + alias = state4.input.slice(_position, state4.position); + if (!_hasOwnProperty$1.call(state4.anchorMap, alias)) { + throwError(state4, 'unidentified alias "' + alias + '"'); + } + state4.result = state4.anchorMap[alias]; + skipSeparationSpace(state4, true, -1); + return true; + } + function composeNode(state4, parentIndent, nodeContext, allowToSeek, allowCompact) { + var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type3, flowIndent, blockIndent; + if (state4.listener !== null) { + state4.listener("open", state4); + } + state4.tag = null; + state4.anchor = null; + state4.kind = null; + state4.result = null; + allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext; + if (allowToSeek) { + if (skipSeparationSpace(state4, true, -1)) { + atNewLine = true; + if (state4.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state4.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state4.lineIndent < parentIndent) { + indentStatus = -1; + } + } + } + if (indentStatus === 1) { + while (readTagProperty(state4) || readAnchorProperty(state4)) { + if (skipSeparationSpace(state4, true, -1)) { + atNewLine = true; + allowBlockCollections = allowBlockStyles; + if (state4.lineIndent > parentIndent) { + indentStatus = 1; + } else if (state4.lineIndent === parentIndent) { + indentStatus = 0; + } else if (state4.lineIndent < parentIndent) { + indentStatus = -1; + } + } else { + allowBlockCollections = false; + } + } + } + if (allowBlockCollections) { + allowBlockCollections = atNewLine || allowCompact; + } + if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { + if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { + flowIndent = parentIndent; + } else { + flowIndent = parentIndent + 1; + } + blockIndent = state4.position - state4.lineStart; + if (indentStatus === 1) { + if (allowBlockCollections && (readBlockSequence(state4, blockIndent) || readBlockMapping(state4, blockIndent, flowIndent)) || readFlowCollection(state4, flowIndent)) { + hasContent = true; + } else { + if (allowBlockScalars && readBlockScalar(state4, flowIndent) || readSingleQuotedScalar(state4, flowIndent) || readDoubleQuotedScalar(state4, flowIndent)) { + hasContent = true; + } else if (readAlias(state4)) { + hasContent = true; + if (state4.tag !== null || state4.anchor !== null) { + throwError(state4, "alias node should not have any properties"); + } + } else if (readPlainScalar(state4, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { + hasContent = true; + if (state4.tag === null) { + state4.tag = "?"; + } + } + if (state4.anchor !== null) { + state4.anchorMap[state4.anchor] = state4.result; + } + } + } else if (indentStatus === 0) { + hasContent = allowBlockCollections && readBlockSequence(state4, blockIndent); + } + } + if (state4.tag === null) { + if (state4.anchor !== null) { + state4.anchorMap[state4.anchor] = state4.result; + } + } else if (state4.tag === "?") { + if (state4.result !== null && state4.kind !== "scalar") { + throwError(state4, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state4.kind + '"'); + } + for (typeIndex = 0, typeQuantity = state4.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + type3 = state4.implicitTypes[typeIndex]; + if (type3.resolve(state4.result)) { + state4.result = type3.construct(state4.result); + state4.tag = type3.tag; + if (state4.anchor !== null) { + state4.anchorMap[state4.anchor] = state4.result; + } + break; + } + } + } else if (state4.tag !== "!") { + if (_hasOwnProperty$1.call(state4.typeMap[state4.kind || "fallback"], state4.tag)) { + type3 = state4.typeMap[state4.kind || "fallback"][state4.tag]; + } else { + type3 = null; + typeList = state4.typeMap.multi[state4.kind || "fallback"]; + for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + if (state4.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { + type3 = typeList[typeIndex]; + break; + } + } + } + if (!type3) { + throwError(state4, "unknown tag !<" + state4.tag + ">"); + } + if (state4.result !== null && type3.kind !== state4.kind) { + throwError(state4, "unacceptable node kind for !<" + state4.tag + '> tag; it should be "' + type3.kind + '", not "' + state4.kind + '"'); + } + if (!type3.resolve(state4.result, state4.tag)) { + throwError(state4, "cannot resolve a node with !<" + state4.tag + "> explicit tag"); + } else { + state4.result = type3.construct(state4.result, state4.tag); + if (state4.anchor !== null) { + state4.anchorMap[state4.anchor] = state4.result; + } + } + } + if (state4.listener !== null) { + state4.listener("close", state4); + } + return state4.tag !== null || state4.anchor !== null || hasContent; + } + function readDocument(state4) { + var documentStart = state4.position, _position, directiveName, directiveArgs, hasDirectives = false, ch; + state4.version = null; + state4.checkLineBreaks = state4.legacy; + state4.tagMap = /* @__PURE__ */ Object.create(null); + state4.anchorMap = /* @__PURE__ */ Object.create(null); + while ((ch = state4.input.charCodeAt(state4.position)) !== 0) { + skipSeparationSpace(state4, true, -1); + ch = state4.input.charCodeAt(state4.position); + if (state4.lineIndent > 0 || ch !== 37) { + break; + } + hasDirectives = true; + ch = state4.input.charCodeAt(++state4.position); + _position = state4.position; + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state4.input.charCodeAt(++state4.position); + } + directiveName = state4.input.slice(_position, state4.position); + directiveArgs = []; + if (directiveName.length < 1) { + throwError(state4, "directive name must not be less than one character in length"); + } + while (ch !== 0) { + while (is_WHITE_SPACE(ch)) { + ch = state4.input.charCodeAt(++state4.position); + } + if (ch === 35) { + do { + ch = state4.input.charCodeAt(++state4.position); + } while (ch !== 0 && !is_EOL(ch)); + break; + } + if (is_EOL(ch)) break; + _position = state4.position; + while (ch !== 0 && !is_WS_OR_EOL(ch)) { + ch = state4.input.charCodeAt(++state4.position); + } + directiveArgs.push(state4.input.slice(_position, state4.position)); + } + if (ch !== 0) readLineBreak(state4); + if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) { + directiveHandlers[directiveName](state4, directiveName, directiveArgs); + } else { + throwWarning(state4, 'unknown document directive "' + directiveName + '"'); + } + } + skipSeparationSpace(state4, true, -1); + if (state4.lineIndent === 0 && state4.input.charCodeAt(state4.position) === 45 && state4.input.charCodeAt(state4.position + 1) === 45 && state4.input.charCodeAt(state4.position + 2) === 45) { + state4.position += 3; + skipSeparationSpace(state4, true, -1); + } else if (hasDirectives) { + throwError(state4, "directives end mark is expected"); + } + composeNode(state4, state4.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); + skipSeparationSpace(state4, true, -1); + if (state4.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state4.input.slice(documentStart, state4.position))) { + throwWarning(state4, "non-ASCII line breaks are interpreted as content"); + } + state4.documents.push(state4.result); + if (state4.position === state4.lineStart && testDocumentSeparator(state4)) { + if (state4.input.charCodeAt(state4.position) === 46) { + state4.position += 3; + skipSeparationSpace(state4, true, -1); + } + return; + } + if (state4.position < state4.length - 1) { + throwError(state4, "end of the stream or a document separator is expected"); + } else { + return; + } + } + function loadDocuments(input, options2) { + input = String(input); + options2 = options2 || {}; + if (input.length !== 0) { + if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) { + input += "\n"; + } + if (input.charCodeAt(0) === 65279) { + input = input.slice(1); + } + } + var state4 = new State$1(input, options2); + var nullpos = input.indexOf("\0"); + if (nullpos !== -1) { + state4.position = nullpos; + throwError(state4, "null byte is not allowed in input"); + } + state4.input += "\0"; + while (state4.input.charCodeAt(state4.position) === 32) { + state4.lineIndent += 1; + state4.position += 1; + } + while (state4.position < state4.length - 1) { + readDocument(state4); + } + return state4.documents; + } + function loadAll$1(input, iterator, options2) { + if (iterator !== null && typeof iterator === "object" && typeof options2 === "undefined") { + options2 = iterator; + iterator = null; + } + var documents = loadDocuments(input, options2); + if (typeof iterator !== "function") { + return documents; + } + for (var index = 0, length2 = documents.length; index < length2; index += 1) { + iterator(documents[index]); + } + } + function load$1(input, options2) { + var documents = loadDocuments(input, options2); + if (documents.length === 0) { + return void 0; + } else if (documents.length === 1) { + return documents[0]; + } + throw new exception("expected a single document in the stream, but found more"); + } + function compileStyleMap(schema2, map6) { + var result, keys3, index, length2, tag, style3, type3; + if (map6 === null) return {}; + result = {}; + keys3 = Object.keys(map6); + for (index = 0, length2 = keys3.length; index < length2; index += 1) { + tag = keys3[index]; + style3 = String(map6[tag]); + if (tag.slice(0, 2) === "!!") { + tag = "tag:yaml.org,2002:" + tag.slice(2); + } + type3 = schema2.compiledTypeMap["fallback"][tag]; + if (type3 && _hasOwnProperty.call(type3.styleAliases, style3)) { + style3 = type3.styleAliases[style3]; + } + result[tag] = style3; + } + return result; + } + function encodeHex(character2) { + var string3, handle, length2; + string3 = character2.toString(16).toUpperCase(); + if (character2 <= 255) { + handle = "x"; + length2 = 2; + } else if (character2 <= 65535) { + handle = "u"; + length2 = 4; + } else if (character2 <= 4294967295) { + handle = "U"; + length2 = 8; + } else { + throw new exception("code point within a string may not be greater than 0xFFFFFFFF"); + } + return "\\" + handle + common.repeat("0", length2 - string3.length) + string3; + } + function State(options2) { + this.schema = options2["schema"] || _default; + this.indent = Math.max(1, options2["indent"] || 2); + this.noArrayIndent = options2["noArrayIndent"] || false; + this.skipInvalid = options2["skipInvalid"] || false; + this.flowLevel = common.isNothing(options2["flowLevel"]) ? -1 : options2["flowLevel"]; + this.styleMap = compileStyleMap(this.schema, options2["styles"] || null); + this.sortKeys = options2["sortKeys"] || false; + this.lineWidth = options2["lineWidth"] || 80; + this.noRefs = options2["noRefs"] || false; + this.noCompatMode = options2["noCompatMode"] || false; + this.condenseFlow = options2["condenseFlow"] || false; + this.quotingType = options2["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; + this.forceQuotes = options2["forceQuotes"] || false; + this.replacer = typeof options2["replacer"] === "function" ? options2["replacer"] : null; + this.implicitTypes = this.schema.compiledImplicit; + this.explicitTypes = this.schema.compiledExplicit; + this.tag = null; + this.result = ""; + this.duplicates = []; + this.usedDuplicates = null; + } + function indentString(string3, spaces) { + var ind = common.repeat(" ", spaces), position5 = 0, next3 = -1, result = "", line2, length2 = string3.length; + while (position5 < length2) { + next3 = string3.indexOf("\n", position5); + if (next3 === -1) { + line2 = string3.slice(position5); + position5 = length2; + } else { + line2 = string3.slice(position5, next3 + 1); + position5 = next3 + 1; + } + if (line2.length && line2 !== "\n") result += ind; + result += line2; + } + return result; + } + function generateNextLine(state4, level) { + return "\n" + common.repeat(" ", state4.indent * level); + } + function testImplicitResolving(state4, str2) { + var index, length2, type3; + for (index = 0, length2 = state4.implicitTypes.length; index < length2; index += 1) { + type3 = state4.implicitTypes[index]; + if (type3.resolve(str2)) { + return true; + } + } + return false; + } + function isWhitespace(c3) { + return c3 === CHAR_SPACE || c3 === CHAR_TAB; + } + function isPrintable(c3) { + return 32 <= c3 && c3 <= 126 || 161 <= c3 && c3 <= 55295 && c3 !== 8232 && c3 !== 8233 || 57344 <= c3 && c3 <= 65533 && c3 !== CHAR_BOM || 65536 <= c3 && c3 <= 1114111; + } + function isNsCharOrWhitespace(c3) { + return isPrintable(c3) && c3 !== CHAR_BOM && c3 !== CHAR_CARRIAGE_RETURN && c3 !== CHAR_LINE_FEED; + } + function isPlainSafe(c3, prev2, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c3); + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c3); + return ( + // ns-plain-safe + (inblock ? ( + // c = flow-in + cIsNsCharOrWhitespace + ) : cIsNsCharOrWhitespace && c3 !== CHAR_COMMA && c3 !== CHAR_LEFT_SQUARE_BRACKET && c3 !== CHAR_RIGHT_SQUARE_BRACKET && c3 !== CHAR_LEFT_CURLY_BRACKET && c3 !== CHAR_RIGHT_CURLY_BRACKET) && c3 !== CHAR_SHARP && !(prev2 === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev2) && !isWhitespace(prev2) && c3 === CHAR_SHARP || prev2 === CHAR_COLON && cIsNsChar + ); + } + function isPlainSafeFirst(c3) { + return isPrintable(c3) && c3 !== CHAR_BOM && !isWhitespace(c3) && c3 !== CHAR_MINUS && c3 !== CHAR_QUESTION && c3 !== CHAR_COLON && c3 !== CHAR_COMMA && c3 !== CHAR_LEFT_SQUARE_BRACKET && c3 !== CHAR_RIGHT_SQUARE_BRACKET && c3 !== CHAR_LEFT_CURLY_BRACKET && c3 !== CHAR_RIGHT_CURLY_BRACKET && c3 !== CHAR_SHARP && c3 !== CHAR_AMPERSAND && c3 !== CHAR_ASTERISK && c3 !== CHAR_EXCLAMATION && c3 !== CHAR_VERTICAL_LINE && c3 !== CHAR_EQUALS && c3 !== CHAR_GREATER_THAN && c3 !== CHAR_SINGLE_QUOTE && c3 !== CHAR_DOUBLE_QUOTE && c3 !== CHAR_PERCENT && c3 !== CHAR_COMMERCIAL_AT && c3 !== CHAR_GRAVE_ACCENT; + } + function isPlainSafeLast(c3) { + return !isWhitespace(c3) && c3 !== CHAR_COLON; + } + function codePointAt(string3, pos) { + var first3 = string3.charCodeAt(pos), second2; + if (first3 >= 55296 && first3 <= 56319 && pos + 1 < string3.length) { + second2 = string3.charCodeAt(pos + 1); + if (second2 >= 56320 && second2 <= 57343) { + return (first3 - 55296) * 1024 + second2 - 56320 + 65536; + } + } + return first3; + } + function needIndentIndicator(string3) { + var leadingSpaceRe = /^\n* /; + return leadingSpaceRe.test(string3); + } + function chooseScalarStyle(string3, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) { + var i2; + var char2 = 0; + var prevChar = null; + var hasLineBreak = false; + var hasFoldableLine = false; + var shouldTrackWidth = lineWidth !== -1; + var previousLineBreak = -1; + var plain = isPlainSafeFirst(codePointAt(string3, 0)) && isPlainSafeLast(codePointAt(string3, string3.length - 1)); + if (singleLineOnly || forceQuotes) { + for (i2 = 0; i2 < string3.length; char2 >= 65536 ? i2 += 2 : i2++) { + char2 = codePointAt(string3, i2); + if (!isPrintable(char2)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char2, prevChar, inblock); + prevChar = char2; + } + } else { + for (i2 = 0; i2 < string3.length; char2 >= 65536 ? i2 += 2 : i2++) { + char2 = codePointAt(string3, i2); + if (char2 === CHAR_LINE_FEED) { + hasLineBreak = true; + if (shouldTrackWidth) { + hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented. + i2 - previousLineBreak - 1 > lineWidth && string3[previousLineBreak + 1] !== " "; + previousLineBreak = i2; + } + } else if (!isPrintable(char2)) { + return STYLE_DOUBLE; + } + plain = plain && isPlainSafe(char2, prevChar, inblock); + prevChar = char2; + } + hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i2 - previousLineBreak - 1 > lineWidth && string3[previousLineBreak + 1] !== " "); + } + if (!hasLineBreak && !hasFoldableLine) { + if (plain && !forceQuotes && !testAmbiguousType(string3)) { + return STYLE_PLAIN; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + if (indentPerLevel > 9 && needIndentIndicator(string3)) { + return STYLE_DOUBLE; + } + if (!forceQuotes) { + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + } + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + } + function writeScalar(state4, string3, level, iskey, inblock) { + state4.dump = (function() { + if (string3.length === 0) { + return state4.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + } + if (!state4.noCompatMode) { + if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string3) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string3)) { + return state4.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string3 + '"' : "'" + string3 + "'"; + } + } + var indent = state4.indent * Math.max(1, level); + var lineWidth = state4.lineWidth === -1 ? -1 : Math.max(Math.min(state4.lineWidth, 40), state4.lineWidth - indent); + var singleLineOnly = iskey || state4.flowLevel > -1 && level >= state4.flowLevel; + function testAmbiguity(string4) { + return testImplicitResolving(state4, string4); + } + __name(testAmbiguity, "testAmbiguity"); + switch (chooseScalarStyle( + string3, + singleLineOnly, + state4.indent, + lineWidth, + testAmbiguity, + state4.quotingType, + state4.forceQuotes && !iskey, + inblock + )) { + case STYLE_PLAIN: + return string3; + case STYLE_SINGLE: + return "'" + string3.replace(/'/g, "''") + "'"; + case STYLE_LITERAL: + return "|" + blockHeader(string3, state4.indent) + dropEndingNewline(indentString(string3, indent)); + case STYLE_FOLDED: + return ">" + blockHeader(string3, state4.indent) + dropEndingNewline(indentString(foldString(string3, lineWidth), indent)); + case STYLE_DOUBLE: + return '"' + escapeString(string3) + '"'; + default: + throw new exception("impossible error: invalid scalar style"); + } + })(); + } + function blockHeader(string3, indentPerLevel) { + var indentIndicator = needIndentIndicator(string3) ? String(indentPerLevel) : ""; + var clip = string3[string3.length - 1] === "\n"; + var keep = clip && (string3[string3.length - 2] === "\n" || string3 === "\n"); + var chomp = keep ? "+" : clip ? "" : "-"; + return indentIndicator + chomp + "\n"; + } + function dropEndingNewline(string3) { + return string3[string3.length - 1] === "\n" ? string3.slice(0, -1) : string3; + } + function foldString(string3, width3) { + var lineRe = /(\n+)([^\n]*)/g; + var result = (function() { + var nextLF = string3.indexOf("\n"); + nextLF = nextLF !== -1 ? nextLF : string3.length; + lineRe.lastIndex = nextLF; + return foldLine(string3.slice(0, nextLF), width3); + })(); + var prevMoreIndented = string3[0] === "\n" || string3[0] === " "; + var moreIndented; + var match3; + while (match3 = lineRe.exec(string3)) { + var prefix = match3[1], line2 = match3[2]; + moreIndented = line2[0] === " "; + result += prefix + (!prevMoreIndented && !moreIndented && line2 !== "" ? "\n" : "") + foldLine(line2, width3); + prevMoreIndented = moreIndented; + } + return result; + } + function foldLine(line2, width3) { + if (line2 === "" || line2[0] === " ") return line2; + var breakRe = / [^ ]/g; + var match3; + var start3 = 0, end2, curr = 0, next3 = 0; + var result = ""; + while (match3 = breakRe.exec(line2)) { + next3 = match3.index; + if (next3 - start3 > width3) { + end2 = curr > start3 ? curr : next3; + result += "\n" + line2.slice(start3, end2); + start3 = end2 + 1; + } + curr = next3; + } + result += "\n"; + if (line2.length - start3 > width3 && curr > start3) { + result += line2.slice(start3, curr) + "\n" + line2.slice(curr + 1); + } else { + result += line2.slice(start3); + } + return result.slice(1); + } + function escapeString(string3) { + var result = ""; + var char2 = 0; + var escapeSeq; + for (var i2 = 0; i2 < string3.length; char2 >= 65536 ? i2 += 2 : i2++) { + char2 = codePointAt(string3, i2); + escapeSeq = ESCAPE_SEQUENCES[char2]; + if (!escapeSeq && isPrintable(char2)) { + result += string3[i2]; + if (char2 >= 65536) result += string3[i2 + 1]; + } else { + result += escapeSeq || encodeHex(char2); + } + } + return result; + } + function writeFlowSequence(state4, level, object3) { + var _result = "", _tag = state4.tag, index, length2, value2; + for (index = 0, length2 = object3.length; index < length2; index += 1) { + value2 = object3[index]; + if (state4.replacer) { + value2 = state4.replacer.call(object3, String(index), value2); + } + if (writeNode(state4, level, value2, false, false) || typeof value2 === "undefined" && writeNode(state4, level, null, false, false)) { + if (_result !== "") _result += "," + (!state4.condenseFlow ? " " : ""); + _result += state4.dump; + } + } + state4.tag = _tag; + state4.dump = "[" + _result + "]"; + } + function writeBlockSequence(state4, level, object3, compact2) { + var _result = "", _tag = state4.tag, index, length2, value2; + for (index = 0, length2 = object3.length; index < length2; index += 1) { + value2 = object3[index]; + if (state4.replacer) { + value2 = state4.replacer.call(object3, String(index), value2); + } + if (writeNode(state4, level + 1, value2, true, true, false, true) || typeof value2 === "undefined" && writeNode(state4, level + 1, null, true, true, false, true)) { + if (!compact2 || _result !== "") { + _result += generateNextLine(state4, level); + } + if (state4.dump && CHAR_LINE_FEED === state4.dump.charCodeAt(0)) { + _result += "-"; + } else { + _result += "- "; + } + _result += state4.dump; + } + } + state4.tag = _tag; + state4.dump = _result || "[]"; + } + function writeFlowMapping(state4, level, object3) { + var _result = "", _tag = state4.tag, objectKeyList = Object.keys(object3), index, length2, objectKey, objectValue, pairBuffer; + for (index = 0, length2 = objectKeyList.length; index < length2; index += 1) { + pairBuffer = ""; + if (_result !== "") pairBuffer += ", "; + if (state4.condenseFlow) pairBuffer += '"'; + objectKey = objectKeyList[index]; + objectValue = object3[objectKey]; + if (state4.replacer) { + objectValue = state4.replacer.call(object3, objectKey, objectValue); + } + if (!writeNode(state4, level, objectKey, false, false)) { + continue; + } + if (state4.dump.length > 1024) pairBuffer += "? "; + pairBuffer += state4.dump + (state4.condenseFlow ? '"' : "") + ":" + (state4.condenseFlow ? "" : " "); + if (!writeNode(state4, level, objectValue, false, false)) { + continue; + } + pairBuffer += state4.dump; + _result += pairBuffer; + } + state4.tag = _tag; + state4.dump = "{" + _result + "}"; + } + function writeBlockMapping(state4, level, object3, compact2) { + var _result = "", _tag = state4.tag, objectKeyList = Object.keys(object3), index, length2, objectKey, objectValue, explicitPair, pairBuffer; + if (state4.sortKeys === true) { + objectKeyList.sort(); + } else if (typeof state4.sortKeys === "function") { + objectKeyList.sort(state4.sortKeys); + } else if (state4.sortKeys) { + throw new exception("sortKeys must be a boolean or a function"); + } + for (index = 0, length2 = objectKeyList.length; index < length2; index += 1) { + pairBuffer = ""; + if (!compact2 || _result !== "") { + pairBuffer += generateNextLine(state4, level); + } + objectKey = objectKeyList[index]; + objectValue = object3[objectKey]; + if (state4.replacer) { + objectValue = state4.replacer.call(object3, objectKey, objectValue); + } + if (!writeNode(state4, level + 1, objectKey, true, true, true)) { + continue; + } + explicitPair = state4.tag !== null && state4.tag !== "?" || state4.dump && state4.dump.length > 1024; + if (explicitPair) { + if (state4.dump && CHAR_LINE_FEED === state4.dump.charCodeAt(0)) { + pairBuffer += "?"; + } else { + pairBuffer += "? "; + } + } + pairBuffer += state4.dump; + if (explicitPair) { + pairBuffer += generateNextLine(state4, level); + } + if (!writeNode(state4, level + 1, objectValue, true, explicitPair)) { + continue; + } + if (state4.dump && CHAR_LINE_FEED === state4.dump.charCodeAt(0)) { + pairBuffer += ":"; + } else { + pairBuffer += ": "; + } + pairBuffer += state4.dump; + _result += pairBuffer; + } + state4.tag = _tag; + state4.dump = _result || "{}"; + } + function detectType2(state4, object3, explicit) { + var _result, typeList, index, length2, type3, style3; + typeList = explicit ? state4.explicitTypes : state4.implicitTypes; + for (index = 0, length2 = typeList.length; index < length2; index += 1) { + type3 = typeList[index]; + if ((type3.instanceOf || type3.predicate) && (!type3.instanceOf || typeof object3 === "object" && object3 instanceof type3.instanceOf) && (!type3.predicate || type3.predicate(object3))) { + if (explicit) { + if (type3.multi && type3.representName) { + state4.tag = type3.representName(object3); + } else { + state4.tag = type3.tag; + } + } else { + state4.tag = "?"; + } + if (type3.represent) { + style3 = state4.styleMap[type3.tag] || type3.defaultStyle; + if (_toString.call(type3.represent) === "[object Function]") { + _result = type3.represent(object3, style3); + } else if (_hasOwnProperty.call(type3.represent, style3)) { + _result = type3.represent[style3](object3, style3); + } else { + throw new exception("!<" + type3.tag + '> tag resolver accepts not "' + style3 + '" style'); + } + state4.dump = _result; + } + return true; + } + } + return false; + } + function writeNode(state4, level, object3, block2, compact2, iskey, isblockseq) { + state4.tag = null; + state4.dump = object3; + if (!detectType2(state4, object3, false)) { + detectType2(state4, object3, true); + } + var type3 = _toString.call(state4.dump); + var inblock = block2; + var tagStr; + if (block2) { + block2 = state4.flowLevel < 0 || state4.flowLevel > level; + } + var objectOrArray = type3 === "[object Object]" || type3 === "[object Array]", duplicateIndex, duplicate; + if (objectOrArray) { + duplicateIndex = state4.duplicates.indexOf(object3); + duplicate = duplicateIndex !== -1; + } + if (state4.tag !== null && state4.tag !== "?" || duplicate || state4.indent !== 2 && level > 0) { + compact2 = false; + } + if (duplicate && state4.usedDuplicates[duplicateIndex]) { + state4.dump = "*ref_" + duplicateIndex; + } else { + if (objectOrArray && duplicate && !state4.usedDuplicates[duplicateIndex]) { + state4.usedDuplicates[duplicateIndex] = true; + } + if (type3 === "[object Object]") { + if (block2 && Object.keys(state4.dump).length !== 0) { + writeBlockMapping(state4, level, state4.dump, compact2); + if (duplicate) { + state4.dump = "&ref_" + duplicateIndex + state4.dump; + } + } else { + writeFlowMapping(state4, level, state4.dump); + if (duplicate) { + state4.dump = "&ref_" + duplicateIndex + " " + state4.dump; + } + } + } else if (type3 === "[object Array]") { + if (block2 && state4.dump.length !== 0) { + if (state4.noArrayIndent && !isblockseq && level > 0) { + writeBlockSequence(state4, level - 1, state4.dump, compact2); + } else { + writeBlockSequence(state4, level, state4.dump, compact2); + } + if (duplicate) { + state4.dump = "&ref_" + duplicateIndex + state4.dump; + } + } else { + writeFlowSequence(state4, level, state4.dump); + if (duplicate) { + state4.dump = "&ref_" + duplicateIndex + " " + state4.dump; + } + } + } else if (type3 === "[object String]") { + if (state4.tag !== "?") { + writeScalar(state4, state4.dump, level, iskey, inblock); + } + } else if (type3 === "[object Undefined]") { + return false; + } else { + if (state4.skipInvalid) return false; + throw new exception("unacceptable kind of an object to dump " + type3); + } + if (state4.tag !== null && state4.tag !== "?") { + tagStr = encodeURI( + state4.tag[0] === "!" ? state4.tag.slice(1) : state4.tag + ).replace(/!/g, "%21"); + if (state4.tag[0] === "!") { + tagStr = "!" + tagStr; + } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") { + tagStr = "!!" + tagStr.slice(18); + } else { + tagStr = "!<" + tagStr + ">"; + } + state4.dump = tagStr + " " + state4.dump; + } + } + return true; + } + function getDuplicateReferences(object3, state4) { + var objects = [], duplicatesIndexes = [], index, length2; + inspectNode(object3, objects, duplicatesIndexes); + for (index = 0, length2 = duplicatesIndexes.length; index < length2; index += 1) { + state4.duplicates.push(objects[duplicatesIndexes[index]]); + } + state4.usedDuplicates = new Array(length2); + } + function inspectNode(object3, objects, duplicatesIndexes) { + var objectKeyList, index, length2; + if (object3 !== null && typeof object3 === "object") { + index = objects.indexOf(object3); + if (index !== -1) { + if (duplicatesIndexes.indexOf(index) === -1) { + duplicatesIndexes.push(index); + } + } else { + objects.push(object3); + if (Array.isArray(object3)) { + for (index = 0, length2 = object3.length; index < length2; index += 1) { + inspectNode(object3[index], objects, duplicatesIndexes); + } + } else { + objectKeyList = Object.keys(object3); + for (index = 0, length2 = objectKeyList.length; index < length2; index += 1) { + inspectNode(object3[objectKeyList[index]], objects, duplicatesIndexes); + } + } + } + } + } + function dump$1(input, options2) { + options2 = options2 || {}; + var state4 = new State(options2); + if (!state4.noRefs) getDuplicateReferences(input, state4); + var value2 = input; + if (state4.replacer) { + value2 = state4.replacer.call({ "": value2 }, "", value2); + } + if (writeNode(state4, 0, value2, true, true)) return state4.dump + "\n"; + return ""; + } + function renamed(from2, to) { + return function() { + throw new Error("Function yaml." + from2 + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default."); + }; + } + var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type2, schema, str, seq, map2, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge2, BASE64_MAP, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set3, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN, CONTEXT_FLOW_OUT, CONTEXT_BLOCK_IN, CONTEXT_BLOCK_OUT, CHOMPING_CLIP, CHOMPING_STRIP, CHOMPING_KEEP, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i2, directiveHandlers, loadAll_1, load_1, loader2, _toString, _hasOwnProperty, CHAR_BOM, CHAR_TAB, CHAR_LINE_FEED, CHAR_CARRIAGE_RETURN, CHAR_SPACE, CHAR_EXCLAMATION, CHAR_DOUBLE_QUOTE, CHAR_SHARP, CHAR_PERCENT, CHAR_AMPERSAND, CHAR_SINGLE_QUOTE, CHAR_ASTERISK, CHAR_COMMA, CHAR_MINUS, CHAR_COLON, CHAR_EQUALS, CHAR_GREATER_THAN, CHAR_QUESTION, CHAR_COMMERCIAL_AT, CHAR_LEFT_SQUARE_BRACKET, CHAR_RIGHT_SQUARE_BRACKET, CHAR_GRAVE_ACCENT, CHAR_LEFT_CURLY_BRACKET, CHAR_VERTICAL_LINE, CHAR_RIGHT_CURLY_BRACKET, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE, QUOTING_TYPE_DOUBLE, STYLE_PLAIN, STYLE_SINGLE, STYLE_LITERAL, STYLE_FOLDED, STYLE_DOUBLE, dump_1, dumper, JSON_SCHEMA, load, loadAll, dump, safeLoad, safeLoadAll, safeDump; + var init_js_yaml = __esm({ + "../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs"() { + "use strict"; + __name(isNothing, "isNothing"); + __name(isObject, "isObject"); + __name(toArray, "toArray"); + __name(extend2, "extend"); + __name(repeat, "repeat"); + __name(isNegativeZero, "isNegativeZero"); + isNothing_1 = isNothing; + isObject_1 = isObject; + toArray_1 = toArray; + repeat_1 = repeat; + isNegativeZero_1 = isNegativeZero; + extend_1 = extend2; + common = { + isNothing: isNothing_1, + isObject: isObject_1, + toArray: toArray_1, + repeat: repeat_1, + isNegativeZero: isNegativeZero_1, + extend: extend_1 + }; + __name(formatError, "formatError"); + __name(YAMLException$1, "YAMLException$1"); + YAMLException$1.prototype = Object.create(Error.prototype); + YAMLException$1.prototype.constructor = YAMLException$1; + YAMLException$1.prototype.toString = /* @__PURE__ */ __name(function toString(compact2) { + return this.name + ": " + formatError(this, compact2); + }, "toString"); + exception = YAMLException$1; + __name(getLine, "getLine"); + __name(padStart, "padStart"); + __name(makeSnippet, "makeSnippet"); + snippet = makeSnippet; + TYPE_CONSTRUCTOR_OPTIONS = [ + "kind", + "multi", + "resolve", + "construct", + "instanceOf", + "predicate", + "represent", + "representName", + "defaultStyle", + "styleAliases" + ]; + YAML_NODE_KINDS = [ + "scalar", + "sequence", + "mapping" + ]; + __name(compileStyleAliases, "compileStyleAliases"); + __name(Type$1, "Type$1"); + type2 = Type$1; + __name(compileList, "compileList"); + __name(compileMap, "compileMap"); + __name(Schema$1, "Schema$1"); + Schema$1.prototype.extend = /* @__PURE__ */ __name(function extend3(definition) { + var implicit2 = []; + var explicit = []; + if (definition instanceof type2) { + explicit.push(definition); + } else if (Array.isArray(definition)) { + explicit = explicit.concat(definition); + } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { + if (definition.implicit) implicit2 = implicit2.concat(definition.implicit); + if (definition.explicit) explicit = explicit.concat(definition.explicit); + } else { + throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })"); + } + implicit2.forEach(function(type$1) { + if (!(type$1 instanceof type2)) { + throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object."); + } + if (type$1.loadKind && type$1.loadKind !== "scalar") { + throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported."); + } + if (type$1.multi) { + throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit."); + } + }); + explicit.forEach(function(type$1) { + if (!(type$1 instanceof type2)) { + throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object."); + } + }); + var result = Object.create(Schema$1.prototype); + result.implicit = (this.implicit || []).concat(implicit2); + result.explicit = (this.explicit || []).concat(explicit); + result.compiledImplicit = compileList(result, "implicit"); + result.compiledExplicit = compileList(result, "explicit"); + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); + return result; + }, "extend"); + schema = Schema$1; + str = new type2("tag:yaml.org,2002:str", { + kind: "scalar", + construct: /* @__PURE__ */ __name(function(data5) { + return data5 !== null ? data5 : ""; + }, "construct") + }); + seq = new type2("tag:yaml.org,2002:seq", { + kind: "sequence", + construct: /* @__PURE__ */ __name(function(data5) { + return data5 !== null ? data5 : []; + }, "construct") + }); + map2 = new type2("tag:yaml.org,2002:map", { + kind: "mapping", + construct: /* @__PURE__ */ __name(function(data5) { + return data5 !== null ? data5 : {}; + }, "construct") + }); + failsafe = new schema({ + explicit: [ + str, + seq, + map2 + ] + }); + __name(resolveYamlNull, "resolveYamlNull"); + __name(constructYamlNull, "constructYamlNull"); + __name(isNull, "isNull"); + _null = new type2("tag:yaml.org,2002:null", { + kind: "scalar", + resolve: resolveYamlNull, + construct: constructYamlNull, + predicate: isNull, + represent: { + canonical: /* @__PURE__ */ __name(function() { + return "~"; + }, "canonical"), + lowercase: /* @__PURE__ */ __name(function() { + return "null"; + }, "lowercase"), + uppercase: /* @__PURE__ */ __name(function() { + return "NULL"; + }, "uppercase"), + camelcase: /* @__PURE__ */ __name(function() { + return "Null"; + }, "camelcase"), + empty: /* @__PURE__ */ __name(function() { + return ""; + }, "empty") + }, + defaultStyle: "lowercase" + }); + __name(resolveYamlBoolean, "resolveYamlBoolean"); + __name(constructYamlBoolean, "constructYamlBoolean"); + __name(isBoolean, "isBoolean"); + bool = new type2("tag:yaml.org,2002:bool", { + kind: "scalar", + resolve: resolveYamlBoolean, + construct: constructYamlBoolean, + predicate: isBoolean, + represent: { + lowercase: /* @__PURE__ */ __name(function(object3) { + return object3 ? "true" : "false"; + }, "lowercase"), + uppercase: /* @__PURE__ */ __name(function(object3) { + return object3 ? "TRUE" : "FALSE"; + }, "uppercase"), + camelcase: /* @__PURE__ */ __name(function(object3) { + return object3 ? "True" : "False"; + }, "camelcase") + }, + defaultStyle: "lowercase" + }); + __name(isHexCode, "isHexCode"); + __name(isOctCode, "isOctCode"); + __name(isDecCode, "isDecCode"); + __name(resolveYamlInteger, "resolveYamlInteger"); + __name(constructYamlInteger, "constructYamlInteger"); + __name(isInteger, "isInteger"); + int = new type2("tag:yaml.org,2002:int", { + kind: "scalar", + resolve: resolveYamlInteger, + construct: constructYamlInteger, + predicate: isInteger, + represent: { + binary: /* @__PURE__ */ __name(function(obj) { + return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1); + }, "binary"), + octal: /* @__PURE__ */ __name(function(obj) { + return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1); + }, "octal"), + decimal: /* @__PURE__ */ __name(function(obj) { + return obj.toString(10); + }, "decimal"), + /* eslint-disable max-len */ + hexadecimal: /* @__PURE__ */ __name(function(obj) { + return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1); + }, "hexadecimal") + }, + defaultStyle: "decimal", + styleAliases: { + binary: [2, "bin"], + octal: [8, "oct"], + decimal: [10, "dec"], + hexadecimal: [16, "hex"] + } + }); + YAML_FLOAT_PATTERN = new RegExp( + // 2.5e4, 2.5 and integers + "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$" + ); + __name(resolveYamlFloat, "resolveYamlFloat"); + __name(constructYamlFloat, "constructYamlFloat"); + SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; + __name(representYamlFloat, "representYamlFloat"); + __name(isFloat, "isFloat"); + float = new type2("tag:yaml.org,2002:float", { + kind: "scalar", + resolve: resolveYamlFloat, + construct: constructYamlFloat, + predicate: isFloat, + represent: representYamlFloat, + defaultStyle: "lowercase" + }); + json = failsafe.extend({ + implicit: [ + _null, + bool, + int, + float + ] + }); + core = json; + YAML_DATE_REGEXP = new RegExp( + "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$" + ); + YAML_TIMESTAMP_REGEXP = new RegExp( + "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$" + ); + __name(resolveYamlTimestamp, "resolveYamlTimestamp"); + __name(constructYamlTimestamp, "constructYamlTimestamp"); + __name(representYamlTimestamp, "representYamlTimestamp"); + timestamp = new type2("tag:yaml.org,2002:timestamp", { + kind: "scalar", + resolve: resolveYamlTimestamp, + construct: constructYamlTimestamp, + instanceOf: Date, + represent: representYamlTimestamp + }); + __name(resolveYamlMerge, "resolveYamlMerge"); + merge2 = new type2("tag:yaml.org,2002:merge", { + kind: "scalar", + resolve: resolveYamlMerge + }); + BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r"; + __name(resolveYamlBinary, "resolveYamlBinary"); + __name(constructYamlBinary, "constructYamlBinary"); + __name(representYamlBinary, "representYamlBinary"); + __name(isBinary, "isBinary"); + binary = new type2("tag:yaml.org,2002:binary", { + kind: "scalar", + resolve: resolveYamlBinary, + construct: constructYamlBinary, + predicate: isBinary, + represent: representYamlBinary + }); + _hasOwnProperty$3 = Object.prototype.hasOwnProperty; + _toString$2 = Object.prototype.toString; + __name(resolveYamlOmap, "resolveYamlOmap"); + __name(constructYamlOmap, "constructYamlOmap"); + omap = new type2("tag:yaml.org,2002:omap", { + kind: "sequence", + resolve: resolveYamlOmap, + construct: constructYamlOmap + }); + _toString$1 = Object.prototype.toString; + __name(resolveYamlPairs, "resolveYamlPairs"); + __name(constructYamlPairs, "constructYamlPairs"); + pairs = new type2("tag:yaml.org,2002:pairs", { + kind: "sequence", + resolve: resolveYamlPairs, + construct: constructYamlPairs + }); + _hasOwnProperty$2 = Object.prototype.hasOwnProperty; + __name(resolveYamlSet, "resolveYamlSet"); + __name(constructYamlSet, "constructYamlSet"); + set3 = new type2("tag:yaml.org,2002:set", { + kind: "mapping", + resolve: resolveYamlSet, + construct: constructYamlSet + }); + _default = core.extend({ + implicit: [ + timestamp, + merge2 + ], + explicit: [ + binary, + omap, + pairs, + set3 + ] + }); + _hasOwnProperty$1 = Object.prototype.hasOwnProperty; + CONTEXT_FLOW_IN = 1; + CONTEXT_FLOW_OUT = 2; + CONTEXT_BLOCK_IN = 3; + CONTEXT_BLOCK_OUT = 4; + CHOMPING_CLIP = 1; + CHOMPING_STRIP = 2; + CHOMPING_KEEP = 3; + PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; + PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; + PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; + PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; + PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; + __name(_class, "_class"); + __name(is_EOL, "is_EOL"); + __name(is_WHITE_SPACE, "is_WHITE_SPACE"); + __name(is_WS_OR_EOL, "is_WS_OR_EOL"); + __name(is_FLOW_INDICATOR, "is_FLOW_INDICATOR"); + __name(fromHexCode, "fromHexCode"); + __name(escapedHexLen, "escapedHexLen"); + __name(fromDecimalCode, "fromDecimalCode"); + __name(simpleEscapeSequence, "simpleEscapeSequence"); + __name(charFromCodepoint, "charFromCodepoint"); + __name(setProperty, "setProperty"); + simpleEscapeCheck = new Array(256); + simpleEscapeMap = new Array(256); + for (i2 = 0; i2 < 256; i2++) { + simpleEscapeCheck[i2] = simpleEscapeSequence(i2) ? 1 : 0; + simpleEscapeMap[i2] = simpleEscapeSequence(i2); + } + __name(State$1, "State$1"); + __name(generateError, "generateError"); + __name(throwError, "throwError"); + __name(throwWarning, "throwWarning"); + directiveHandlers = { + YAML: /* @__PURE__ */ __name(function handleYamlDirective(state4, name, args) { + var match3, major, minor; + if (state4.version !== null) { + throwError(state4, "duplication of %YAML directive"); + } + if (args.length !== 1) { + throwError(state4, "YAML directive accepts exactly one argument"); + } + match3 = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + if (match3 === null) { + throwError(state4, "ill-formed argument of the YAML directive"); + } + major = parseInt(match3[1], 10); + minor = parseInt(match3[2], 10); + if (major !== 1) { + throwError(state4, "unacceptable YAML version of the document"); + } + state4.version = args[0]; + state4.checkLineBreaks = minor < 2; + if (minor !== 1 && minor !== 2) { + throwWarning(state4, "unsupported YAML version of the document"); + } + }, "handleYamlDirective"), + TAG: /* @__PURE__ */ __name(function handleTagDirective(state4, name, args) { + var handle, prefix; + if (args.length !== 2) { + throwError(state4, "TAG directive accepts exactly two arguments"); + } + handle = args[0]; + prefix = args[1]; + if (!PATTERN_TAG_HANDLE.test(handle)) { + throwError(state4, "ill-formed tag handle (first argument) of the TAG directive"); + } + if (_hasOwnProperty$1.call(state4.tagMap, handle)) { + throwError(state4, 'there is a previously declared suffix for "' + handle + '" tag handle'); + } + if (!PATTERN_TAG_URI.test(prefix)) { + throwError(state4, "ill-formed tag prefix (second argument) of the TAG directive"); + } + try { + prefix = decodeURIComponent(prefix); + } catch (err) { + throwError(state4, "tag prefix is malformed: " + prefix); + } + state4.tagMap[handle] = prefix; + }, "handleTagDirective") + }; + __name(captureSegment, "captureSegment"); + __name(mergeMappings, "mergeMappings"); + __name(storeMappingPair, "storeMappingPair"); + __name(readLineBreak, "readLineBreak"); + __name(skipSeparationSpace, "skipSeparationSpace"); + __name(testDocumentSeparator, "testDocumentSeparator"); + __name(writeFoldedLines, "writeFoldedLines"); + __name(readPlainScalar, "readPlainScalar"); + __name(readSingleQuotedScalar, "readSingleQuotedScalar"); + __name(readDoubleQuotedScalar, "readDoubleQuotedScalar"); + __name(readFlowCollection, "readFlowCollection"); + __name(readBlockScalar, "readBlockScalar"); + __name(readBlockSequence, "readBlockSequence"); + __name(readBlockMapping, "readBlockMapping"); + __name(readTagProperty, "readTagProperty"); + __name(readAnchorProperty, "readAnchorProperty"); + __name(readAlias, "readAlias"); + __name(composeNode, "composeNode"); + __name(readDocument, "readDocument"); + __name(loadDocuments, "loadDocuments"); + __name(loadAll$1, "loadAll$1"); + __name(load$1, "load$1"); + loadAll_1 = loadAll$1; + load_1 = load$1; + loader2 = { + loadAll: loadAll_1, + load: load_1 + }; + _toString = Object.prototype.toString; + _hasOwnProperty = Object.prototype.hasOwnProperty; + CHAR_BOM = 65279; + CHAR_TAB = 9; + CHAR_LINE_FEED = 10; + CHAR_CARRIAGE_RETURN = 13; + CHAR_SPACE = 32; + CHAR_EXCLAMATION = 33; + CHAR_DOUBLE_QUOTE = 34; + CHAR_SHARP = 35; + CHAR_PERCENT = 37; + CHAR_AMPERSAND = 38; + CHAR_SINGLE_QUOTE = 39; + CHAR_ASTERISK = 42; + CHAR_COMMA = 44; + CHAR_MINUS = 45; + CHAR_COLON = 58; + CHAR_EQUALS = 61; + CHAR_GREATER_THAN = 62; + CHAR_QUESTION = 63; + CHAR_COMMERCIAL_AT = 64; + CHAR_LEFT_SQUARE_BRACKET = 91; + CHAR_RIGHT_SQUARE_BRACKET = 93; + CHAR_GRAVE_ACCENT = 96; + CHAR_LEFT_CURLY_BRACKET = 123; + CHAR_VERTICAL_LINE = 124; + CHAR_RIGHT_CURLY_BRACKET = 125; + ESCAPE_SEQUENCES = {}; + ESCAPE_SEQUENCES[0] = "\\0"; + ESCAPE_SEQUENCES[7] = "\\a"; + ESCAPE_SEQUENCES[8] = "\\b"; + ESCAPE_SEQUENCES[9] = "\\t"; + ESCAPE_SEQUENCES[10] = "\\n"; + ESCAPE_SEQUENCES[11] = "\\v"; + ESCAPE_SEQUENCES[12] = "\\f"; + ESCAPE_SEQUENCES[13] = "\\r"; + ESCAPE_SEQUENCES[27] = "\\e"; + ESCAPE_SEQUENCES[34] = '\\"'; + ESCAPE_SEQUENCES[92] = "\\\\"; + ESCAPE_SEQUENCES[133] = "\\N"; + ESCAPE_SEQUENCES[160] = "\\_"; + ESCAPE_SEQUENCES[8232] = "\\L"; + ESCAPE_SEQUENCES[8233] = "\\P"; + DEPRECATED_BOOLEANS_SYNTAX = [ + "y", + "Y", + "yes", + "Yes", + "YES", + "on", + "On", + "ON", + "n", + "N", + "no", + "No", + "NO", + "off", + "Off", + "OFF" + ]; + DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; + __name(compileStyleMap, "compileStyleMap"); + __name(encodeHex, "encodeHex"); + QUOTING_TYPE_SINGLE = 1; + QUOTING_TYPE_DOUBLE = 2; + __name(State, "State"); + __name(indentString, "indentString"); + __name(generateNextLine, "generateNextLine"); + __name(testImplicitResolving, "testImplicitResolving"); + __name(isWhitespace, "isWhitespace"); + __name(isPrintable, "isPrintable"); + __name(isNsCharOrWhitespace, "isNsCharOrWhitespace"); + __name(isPlainSafe, "isPlainSafe"); + __name(isPlainSafeFirst, "isPlainSafeFirst"); + __name(isPlainSafeLast, "isPlainSafeLast"); + __name(codePointAt, "codePointAt"); + __name(needIndentIndicator, "needIndentIndicator"); + STYLE_PLAIN = 1; + STYLE_SINGLE = 2; + STYLE_LITERAL = 3; + STYLE_FOLDED = 4; + STYLE_DOUBLE = 5; + __name(chooseScalarStyle, "chooseScalarStyle"); + __name(writeScalar, "writeScalar"); + __name(blockHeader, "blockHeader"); + __name(dropEndingNewline, "dropEndingNewline"); + __name(foldString, "foldString"); + __name(foldLine, "foldLine"); + __name(escapeString, "escapeString"); + __name(writeFlowSequence, "writeFlowSequence"); + __name(writeBlockSequence, "writeBlockSequence"); + __name(writeFlowMapping, "writeFlowMapping"); + __name(writeBlockMapping, "writeBlockMapping"); + __name(detectType2, "detectType"); + __name(writeNode, "writeNode"); + __name(getDuplicateReferences, "getDuplicateReferences"); + __name(inspectNode, "inspectNode"); + __name(dump$1, "dump$1"); + dump_1 = dump$1; + dumper = { + dump: dump_1 + }; + __name(renamed, "renamed"); + JSON_SCHEMA = json; + load = loader2.load; + loadAll = loader2.loadAll; + dump = dumper.dump; + safeLoad = renamed("safeLoad", "load"); + safeLoadAll = renamed("safeLoadAll", "loadAll"); + safeDump = renamed("safeDump", "dump"); + } + }); + + // ../../node_modules/.pnpm/marked@16.3.0/node_modules/marked/lib/marked.esm.js + function L() { + return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null }; + } + function G(l4) { + O = l4; + } + function h(l4, e3 = "") { + let t4 = typeof l4 == "string" ? l4 : l4.source, n2 = { replace: /* @__PURE__ */ __name((r2, i2) => { + let s2 = typeof i2 == "string" ? i2 : i2.source; + return s2 = s2.replace(m.caret, "$1"), t4 = t4.replace(r2, s2), n2; + }, "replace"), getRegex: /* @__PURE__ */ __name(() => new RegExp(t4, e3), "getRegex") }; + return n2; + } + function w(l4, e3) { + if (e3) { + if (m.escapeTest.test(l4)) return l4.replace(m.escapeReplace, ke); + } else if (m.escapeTestNoEncode.test(l4)) return l4.replace(m.escapeReplaceNoEncode, ke); + return l4; + } + function J(l4) { + try { + l4 = encodeURI(l4).replace(m.percentDecode, "%"); + } catch { + return null; + } + return l4; + } + function V(l4, e3) { + let t4 = l4.replace(m.findPipe, (i2, s2, o2) => { + let a2 = false, u2 = s2; + for (; --u2 >= 0 && o2[u2] === "\\"; ) a2 = !a2; + return a2 ? "|" : " |"; + }), n2 = t4.split(m.splitPipe), r2 = 0; + if (n2[0].trim() || n2.shift(), n2.length > 0 && !n2.at(-1)?.trim() && n2.pop(), e3) if (n2.length > e3) n2.splice(e3); + else for (; n2.length < e3; ) n2.push(""); + for (; r2 < n2.length; r2++) n2[r2] = n2[r2].trim().replace(m.slashPipe, "|"); + return n2; + } + function z(l4, e3, t4) { + let n2 = l4.length; + if (n2 === 0) return ""; + let r2 = 0; + for (; r2 < n2; ) { + let i2 = l4.charAt(n2 - r2 - 1); + if (i2 === e3 && !t4) r2++; + else if (i2 !== e3 && t4) r2++; + else break; + } + return l4.slice(0, n2 - r2); + } + function ge(l4, e3) { + if (l4.indexOf(e3[1]) === -1) return -1; + let t4 = 0; + for (let n2 = 0; n2 < l4.length; n2++) if (l4[n2] === "\\") n2++; + else if (l4[n2] === e3[0]) t4++; + else if (l4[n2] === e3[1] && (t4--, t4 < 0)) return n2; + return t4 > 0 ? -2 : -1; + } + function fe(l4, e3, t4, n2, r2) { + let i2 = e3.href, s2 = e3.title || null, o2 = l4[1].replace(r2.other.outputLinkReplace, "$1"); + n2.state.inLink = true; + let a2 = { type: l4[0].charAt(0) === "!" ? "image" : "link", raw: t4, href: i2, title: s2, text: o2, tokens: n2.inlineTokens(o2) }; + return n2.state.inLink = false, a2; + } + function Je(l4, e3, t4) { + let n2 = l4.match(t4.other.indentCodeCompensation); + if (n2 === null) return e3; + let r2 = n2[1]; + return e3.split(` +`).map((i2) => { + let s2 = i2.match(t4.other.beginningSpace); + if (s2 === null) return i2; + let [o2] = s2; + return o2.length >= r2.length ? i2.slice(r2.length) : i2; + }).join(` +`); + } + function d(l4, e3) { + return _.parse(l4, e3); + } + var O, E, m, xe, be, Re, C, Oe, j, se, ie, Te, F, we, Q, ye, Pe, v, U, Se, oe, $e, K2, re2, _e, Le, Me, ze, ae, Ae, D2, W, le, Ee, ue, Ce, Ie, Be, pe, qe, ve, ce, De, He, Ze, Ge, Ne, je, Fe, q, Qe, he, de, Ue, X2, Ke, N, We, I, M, Xe, ke, y2, b, P, $, R, S2, B, _, Dt, Ht, Zt, Gt, Nt, Ft, Qt; + var init_marked_esm = __esm({ + "../../node_modules/.pnpm/marked@16.3.0/node_modules/marked/lib/marked.esm.js"() { + "use strict"; + __name(L, "L"); + O = L(); + __name(G, "G"); + E = { exec: /* @__PURE__ */ __name(() => null, "exec") }; + __name(h, "h"); + m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^( {0,3}${l4})((?:[ ][^\\n]*)?(?:\\n|$))`), "listItemRegex"), nextBulletRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), "nextBulletRegex"), hrRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), "hrRegex"), fencesBeginRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}(?:\`\`\`|~~~)`), "fencesBeginRegex"), headingBeginRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}#`), "headingBeginRegex"), htmlBeginRegex: /* @__PURE__ */ __name((l4) => new RegExp(`^ {0,${Math.min(3, l4 - 1)}}<(?:[a-z].*>|!--)`, "i"), "htmlBeginRegex") }; + xe = /^(?:[ \t]*(?:\n|$))+/; + be = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/; + Re = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/; + C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/; + Oe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/; + j = /(?:[*+-]|\d{1,9}[.)])/; + se = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/; + ie = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(); + Te = h(se).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(); + F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/; + we = /^[^\n]+/; + Q = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/; + ye = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Q).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(); + Pe = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex(); + v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul"; + U = /|$))/; + Se = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", U).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(); + oe = h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(); + $e = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(); + K2 = { blockquote: $e, code: be, def: ye, fences: Re, heading: Oe, hr: C, html: Se, lheading: ie, list: Pe, newline: xe, paragraph: oe, table: E, text: we }; + re2 = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(); + _e = { ...K2, lheading: Te, table: re2, paragraph: h(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re2).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() }; + Le = { ...K2, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: E, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(F).replace("hr", C).replace("heading", ` *#{1,6} *[^ +]`).replace("lheading", ie).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }; + Me = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/; + ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/; + ae = /^( {2,}|\\)\n(?!\s*$)/; + Ae = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g; + pe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/; + qe = h(pe, "u").replace(/punct/g, D2).getRegex(); + ve = h(pe, "u").replace(/punct/g, ue).getRegex(); + ce = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)"; + De = h(ce, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D2).getRegex(); + He = h(ce, "gu").replace(/notPunctSpace/g, Ie).replace(/punctSpace/g, Ce).replace(/punct/g, ue).getRegex(); + Ze = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, W).replace(/punct/g, D2).getRegex(); + Ge = h(/\\(punct)/, "gu").replace(/punct/g, D2).getRegex(); + Ne = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(); + je = h(U).replace("(?:-->|$)", "-->").getRegex(); + Fe = h("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment", je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(); + q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/; + Qe = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(); + he = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", Q).getRegex(); + de = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Q).getRegex(); + Ue = h("reflink|nolink(?!\\()", "g").replace("reflink", he).replace("nolink", de).getRegex(); + X2 = { _backpedal: E, anyPunctuation: Ge, autolink: Ne, blockSkip: Be, br: ae, code: ze, del: E, emStrongLDelim: qe, emStrongRDelimAst: De, emStrongRDelimUnd: Ze, escape: Me, link: Qe, nolink: de, punctuation: Ee, reflink: he, reflinkSearch: Ue, tag: Fe, text: Ae, url: E }; + Ke = { ...X2, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }; + N = { ...X2, emStrongRDelimAst: He, emStrongLDelim: ve, url: h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\": ">", '"': """, "'": "'" }; + ke = /* @__PURE__ */ __name((l4) => Xe[l4], "ke"); + __name(w, "w"); + __name(J, "J"); + __name(V, "V"); + __name(z, "z"); + __name(ge, "ge"); + __name(fe, "fe"); + __name(Je, "Je"); + y2 = class { + static { + __name(this, "y"); + } + options; + rules; + lexer; + constructor(e3) { + this.options = e3 || O; + } + space(e3) { + let t4 = this.rules.block.newline.exec(e3); + if (t4 && t4[0].length > 0) return { type: "space", raw: t4[0] }; + } + code(e3) { + let t4 = this.rules.block.code.exec(e3); + if (t4) { + let n2 = t4[0].replace(this.rules.other.codeRemoveIndent, ""); + return { type: "code", raw: t4[0], codeBlockStyle: "indented", text: this.options.pedantic ? n2 : z(n2, ` +`) }; + } + } + fences(e3) { + let t4 = this.rules.block.fences.exec(e3); + if (t4) { + let n2 = t4[0], r2 = Je(n2, t4[3] || "", this.rules); + return { type: "code", raw: n2, lang: t4[2] ? t4[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t4[2], text: r2 }; + } + } + heading(e3) { + let t4 = this.rules.block.heading.exec(e3); + if (t4) { + let n2 = t4[2].trim(); + if (this.rules.other.endingHash.test(n2)) { + let r2 = z(n2, "#"); + (this.options.pedantic || !r2 || this.rules.other.endingSpaceChar.test(r2)) && (n2 = r2.trim()); + } + return { type: "heading", raw: t4[0], depth: t4[1].length, text: n2, tokens: this.lexer.inline(n2) }; + } + } + hr(e3) { + let t4 = this.rules.block.hr.exec(e3); + if (t4) return { type: "hr", raw: z(t4[0], ` +`) }; + } + blockquote(e3) { + let t4 = this.rules.block.blockquote.exec(e3); + if (t4) { + let n2 = z(t4[0], ` +`).split(` +`), r2 = "", i2 = "", s2 = []; + for (; n2.length > 0; ) { + let o2 = false, a2 = [], u2; + for (u2 = 0; u2 < n2.length; u2++) if (this.rules.other.blockquoteStart.test(n2[u2])) a2.push(n2[u2]), o2 = true; + else if (!o2) a2.push(n2[u2]); + else break; + n2 = n2.slice(u2); + let p3 = a2.join(` +`), c3 = p3.replace(this.rules.other.blockquoteSetextReplace, ` + $1`).replace(this.rules.other.blockquoteSetextReplace2, ""); + r2 = r2 ? `${r2} +${p3}` : p3, i2 = i2 ? `${i2} +${c3}` : c3; + let f2 = this.lexer.state.top; + if (this.lexer.state.top = true, this.lexer.blockTokens(c3, s2, true), this.lexer.state.top = f2, n2.length === 0) break; + let k2 = s2.at(-1); + if (k2?.type === "code") break; + if (k2?.type === "blockquote") { + let x5 = k2, g2 = x5.raw + ` +` + n2.join(` +`), T3 = this.blockquote(g2); + s2[s2.length - 1] = T3, r2 = r2.substring(0, r2.length - x5.raw.length) + T3.raw, i2 = i2.substring(0, i2.length - x5.text.length) + T3.text; + break; + } else if (k2?.type === "list") { + let x5 = k2, g2 = x5.raw + ` +` + n2.join(` +`), T3 = this.list(g2); + s2[s2.length - 1] = T3, r2 = r2.substring(0, r2.length - k2.raw.length) + T3.raw, i2 = i2.substring(0, i2.length - x5.raw.length) + T3.raw, n2 = g2.substring(s2.at(-1).raw.length).split(` +`); + continue; + } + } + return { type: "blockquote", raw: r2, tokens: s2, text: i2 }; + } + } + list(e3) { + let t4 = this.rules.block.list.exec(e3); + if (t4) { + let n2 = t4[1].trim(), r2 = n2.length > 1, i2 = { type: "list", raw: "", ordered: r2, start: r2 ? +n2.slice(0, -1) : "", loose: false, items: [] }; + n2 = r2 ? `\\d{1,9}\\${n2.slice(-1)}` : `\\${n2}`, this.options.pedantic && (n2 = r2 ? n2 : "[*+-]"); + let s2 = this.rules.other.listItemRegex(n2), o2 = false; + for (; e3; ) { + let u2 = false, p3 = "", c3 = ""; + if (!(t4 = s2.exec(e3)) || this.rules.block.hr.test(e3)) break; + p3 = t4[0], e3 = e3.substring(p3.length); + let f2 = t4[2].split(` +`, 1)[0].replace(this.rules.other.listReplaceTabs, (H2) => " ".repeat(3 * H2.length)), k2 = e3.split(` +`, 1)[0], x5 = !f2.trim(), g2 = 0; + if (this.options.pedantic ? (g2 = 2, c3 = f2.trimStart()) : x5 ? g2 = t4[1].length + 1 : (g2 = t4[2].search(this.rules.other.nonSpaceChar), g2 = g2 > 4 ? 1 : g2, c3 = f2.slice(g2), g2 += t4[1].length), x5 && this.rules.other.blankLine.test(k2) && (p3 += k2 + ` +`, e3 = e3.substring(k2.length + 1), u2 = true), !u2) { + let H2 = this.rules.other.nextBulletRegex(g2), ee = this.rules.other.hrRegex(g2), te = this.rules.other.fencesBeginRegex(g2), ne = this.rules.other.headingBeginRegex(g2), me = this.rules.other.htmlBeginRegex(g2); + for (; e3; ) { + let Z2 = e3.split(` +`, 1)[0], A2; + if (k2 = Z2, this.options.pedantic ? (k2 = k2.replace(this.rules.other.listReplaceNesting, " "), A2 = k2) : A2 = k2.replace(this.rules.other.tabCharGlobal, " "), te.test(k2) || ne.test(k2) || me.test(k2) || H2.test(k2) || ee.test(k2)) break; + if (A2.search(this.rules.other.nonSpaceChar) >= g2 || !k2.trim()) c3 += ` +` + A2.slice(g2); + else { + if (x5 || f2.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || te.test(f2) || ne.test(f2) || ee.test(f2)) break; + c3 += ` +` + k2; + } + !x5 && !k2.trim() && (x5 = true), p3 += Z2 + ` +`, e3 = e3.substring(Z2.length + 1), f2 = A2.slice(g2); + } + } + i2.loose || (o2 ? i2.loose = true : this.rules.other.doubleBlankLine.test(p3) && (o2 = true)); + let T3 = null, Y3; + this.options.gfm && (T3 = this.rules.other.listIsTask.exec(c3), T3 && (Y3 = T3[0] !== "[ ] ", c3 = c3.replace(this.rules.other.listReplaceTask, ""))), i2.items.push({ type: "list_item", raw: p3, task: !!T3, checked: Y3, loose: false, text: c3, tokens: [] }), i2.raw += p3; + } + let a2 = i2.items.at(-1); + if (a2) a2.raw = a2.raw.trimEnd(), a2.text = a2.text.trimEnd(); + else return; + i2.raw = i2.raw.trimEnd(); + for (let u2 = 0; u2 < i2.items.length; u2++) if (this.lexer.state.top = false, i2.items[u2].tokens = this.lexer.blockTokens(i2.items[u2].text, []), !i2.loose) { + let p3 = i2.items[u2].tokens.filter((f2) => f2.type === "space"), c3 = p3.length > 0 && p3.some((f2) => this.rules.other.anyLine.test(f2.raw)); + i2.loose = c3; + } + if (i2.loose) for (let u2 = 0; u2 < i2.items.length; u2++) i2.items[u2].loose = true; + return i2; + } + } + html(e3) { + let t4 = this.rules.block.html.exec(e3); + if (t4) return { type: "html", block: true, raw: t4[0], pre: t4[1] === "pre" || t4[1] === "script" || t4[1] === "style", text: t4[0] }; + } + def(e3) { + let t4 = this.rules.block.def.exec(e3); + if (t4) { + let n2 = t4[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), r2 = t4[2] ? t4[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i2 = t4[3] ? t4[3].substring(1, t4[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t4[3]; + return { type: "def", tag: n2, raw: t4[0], href: r2, title: i2 }; + } + } + table(e3) { + let t4 = this.rules.block.table.exec(e3); + if (!t4 || !this.rules.other.tableDelimiter.test(t4[2])) return; + let n2 = V(t4[1]), r2 = t4[2].replace(this.rules.other.tableAlignChars, "").split("|"), i2 = t4[3]?.trim() ? t4[3].replace(this.rules.other.tableRowBlankLine, "").split(` +`) : [], s2 = { type: "table", raw: t4[0], header: [], align: [], rows: [] }; + if (n2.length === r2.length) { + for (let o2 of r2) this.rules.other.tableAlignRight.test(o2) ? s2.align.push("right") : this.rules.other.tableAlignCenter.test(o2) ? s2.align.push("center") : this.rules.other.tableAlignLeft.test(o2) ? s2.align.push("left") : s2.align.push(null); + for (let o2 = 0; o2 < n2.length; o2++) s2.header.push({ text: n2[o2], tokens: this.lexer.inline(n2[o2]), header: true, align: s2.align[o2] }); + for (let o2 of i2) s2.rows.push(V(o2, s2.header.length).map((a2, u2) => ({ text: a2, tokens: this.lexer.inline(a2), header: false, align: s2.align[u2] }))); + return s2; + } + } + lheading(e3) { + let t4 = this.rules.block.lheading.exec(e3); + if (t4) return { type: "heading", raw: t4[0], depth: t4[2].charAt(0) === "=" ? 1 : 2, text: t4[1], tokens: this.lexer.inline(t4[1]) }; + } + paragraph(e3) { + let t4 = this.rules.block.paragraph.exec(e3); + if (t4) { + let n2 = t4[1].charAt(t4[1].length - 1) === ` +` ? t4[1].slice(0, -1) : t4[1]; + return { type: "paragraph", raw: t4[0], text: n2, tokens: this.lexer.inline(n2) }; + } + } + text(e3) { + let t4 = this.rules.block.text.exec(e3); + if (t4) return { type: "text", raw: t4[0], text: t4[0], tokens: this.lexer.inline(t4[0]) }; + } + escape(e3) { + let t4 = this.rules.inline.escape.exec(e3); + if (t4) return { type: "escape", raw: t4[0], text: t4[1] }; + } + tag(e3) { + let t4 = this.rules.inline.tag.exec(e3); + if (t4) return !this.lexer.state.inLink && this.rules.other.startATag.test(t4[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t4[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t4[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t4[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t4[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t4[0] }; + } + link(e3) { + let t4 = this.rules.inline.link.exec(e3); + if (t4) { + let n2 = t4[2].trim(); + if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n2)) { + if (!this.rules.other.endAngleBracket.test(n2)) return; + let s2 = z(n2.slice(0, -1), "\\"); + if ((n2.length - s2.length) % 2 === 0) return; + } else { + let s2 = ge(t4[2], "()"); + if (s2 === -2) return; + if (s2 > -1) { + let a2 = (t4[0].indexOf("!") === 0 ? 5 : 4) + t4[1].length + s2; + t4[2] = t4[2].substring(0, s2), t4[0] = t4[0].substring(0, a2).trim(), t4[3] = ""; + } + } + let r2 = t4[2], i2 = ""; + if (this.options.pedantic) { + let s2 = this.rules.other.pedanticHrefTitle.exec(r2); + s2 && (r2 = s2[1], i2 = s2[3]); + } else i2 = t4[3] ? t4[3].slice(1, -1) : ""; + return r2 = r2.trim(), this.rules.other.startAngleBracket.test(r2) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n2) ? r2 = r2.slice(1) : r2 = r2.slice(1, -1)), fe(t4, { href: r2 && r2.replace(this.rules.inline.anyPunctuation, "$1"), title: i2 && i2.replace(this.rules.inline.anyPunctuation, "$1") }, t4[0], this.lexer, this.rules); + } + } + reflink(e3, t4) { + let n2; + if ((n2 = this.rules.inline.reflink.exec(e3)) || (n2 = this.rules.inline.nolink.exec(e3))) { + let r2 = (n2[2] || n2[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i2 = t4[r2.toLowerCase()]; + if (!i2) { + let s2 = n2[0].charAt(0); + return { type: "text", raw: s2, text: s2 }; + } + return fe(n2, i2, n2[0], this.lexer, this.rules); + } + } + emStrong(e3, t4, n2 = "") { + let r2 = this.rules.inline.emStrongLDelim.exec(e3); + if (!r2 || r2[3] && n2.match(this.rules.other.unicodeAlphaNumeric)) return; + if (!(r2[1] || r2[2] || "") || !n2 || this.rules.inline.punctuation.exec(n2)) { + let s2 = [...r2[0]].length - 1, o2, a2, u2 = s2, p3 = 0, c3 = r2[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd; + for (c3.lastIndex = 0, t4 = t4.slice(-1 * e3.length + s2); (r2 = c3.exec(t4)) != null; ) { + if (o2 = r2[1] || r2[2] || r2[3] || r2[4] || r2[5] || r2[6], !o2) continue; + if (a2 = [...o2].length, r2[3] || r2[4]) { + u2 += a2; + continue; + } else if ((r2[5] || r2[6]) && s2 % 3 && !((s2 + a2) % 3)) { + p3 += a2; + continue; + } + if (u2 -= a2, u2 > 0) continue; + a2 = Math.min(a2, a2 + u2 + p3); + let f2 = [...r2[0]][0].length, k2 = e3.slice(0, s2 + r2.index + f2 + a2); + if (Math.min(s2, a2) % 2) { + let g2 = k2.slice(1, -1); + return { type: "em", raw: k2, text: g2, tokens: this.lexer.inlineTokens(g2) }; + } + let x5 = k2.slice(2, -2); + return { type: "strong", raw: k2, text: x5, tokens: this.lexer.inlineTokens(x5) }; + } + } + } + codespan(e3) { + let t4 = this.rules.inline.code.exec(e3); + if (t4) { + let n2 = t4[2].replace(this.rules.other.newLineCharGlobal, " "), r2 = this.rules.other.nonSpaceChar.test(n2), i2 = this.rules.other.startingSpaceChar.test(n2) && this.rules.other.endingSpaceChar.test(n2); + return r2 && i2 && (n2 = n2.substring(1, n2.length - 1)), { type: "codespan", raw: t4[0], text: n2 }; + } + } + br(e3) { + let t4 = this.rules.inline.br.exec(e3); + if (t4) return { type: "br", raw: t4[0] }; + } + del(e3) { + let t4 = this.rules.inline.del.exec(e3); + if (t4) return { type: "del", raw: t4[0], text: t4[2], tokens: this.lexer.inlineTokens(t4[2]) }; + } + autolink(e3) { + let t4 = this.rules.inline.autolink.exec(e3); + if (t4) { + let n2, r2; + return t4[2] === "@" ? (n2 = t4[1], r2 = "mailto:" + n2) : (n2 = t4[1], r2 = n2), { type: "link", raw: t4[0], text: n2, href: r2, tokens: [{ type: "text", raw: n2, text: n2 }] }; + } + } + url(e3) { + let t4; + if (t4 = this.rules.inline.url.exec(e3)) { + let n2, r2; + if (t4[2] === "@") n2 = t4[0], r2 = "mailto:" + n2; + else { + let i2; + do + i2 = t4[0], t4[0] = this.rules.inline._backpedal.exec(t4[0])?.[0] ?? ""; + while (i2 !== t4[0]); + n2 = t4[0], t4[1] === "www." ? r2 = "http://" + t4[0] : r2 = t4[0]; + } + return { type: "link", raw: t4[0], text: n2, href: r2, tokens: [{ type: "text", raw: n2, text: n2 }] }; + } + } + inlineText(e3) { + let t4 = this.rules.inline.text.exec(e3); + if (t4) { + let n2 = this.lexer.state.inRawBlock; + return { type: "text", raw: t4[0], text: t4[0], escaped: n2 }; + } + } + }; + b = class l { + static { + __name(this, "l"); + } + tokens; + options; + state; + tokenizer; + inlineQueue; + constructor(e3) { + this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e3 || O, this.options.tokenizer = this.options.tokenizer || new y2(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true }; + let t4 = { other: m, block: I.normal, inline: M.normal }; + this.options.pedantic ? (t4.block = I.pedantic, t4.inline = M.pedantic) : this.options.gfm && (t4.block = I.gfm, this.options.breaks ? t4.inline = M.breaks : t4.inline = M.gfm), this.tokenizer.rules = t4; + } + static get rules() { + return { block: I, inline: M }; + } + static lex(e3, t4) { + return new l(t4).lex(e3); + } + static lexInline(e3, t4) { + return new l(t4).inlineTokens(e3); + } + lex(e3) { + e3 = e3.replace(m.carriageReturn, ` +`), this.blockTokens(e3, this.tokens); + for (let t4 = 0; t4 < this.inlineQueue.length; t4++) { + let n2 = this.inlineQueue[t4]; + this.inlineTokens(n2.src, n2.tokens); + } + return this.inlineQueue = [], this.tokens; + } + blockTokens(e3, t4 = [], n2 = false) { + for (this.options.pedantic && (e3 = e3.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e3; ) { + let r2; + if (this.options.extensions?.block?.some((s2) => (r2 = s2.call({ lexer: this }, e3, t4)) ? (e3 = e3.substring(r2.raw.length), t4.push(r2), true) : false)) continue; + if (r2 = this.tokenizer.space(e3)) { + e3 = e3.substring(r2.raw.length); + let s2 = t4.at(-1); + r2.raw.length === 1 && s2 !== void 0 ? s2.raw += ` +` : t4.push(r2); + continue; + } + if (r2 = this.tokenizer.code(e3)) { + e3 = e3.substring(r2.raw.length); + let s2 = t4.at(-1); + s2?.type === "paragraph" || s2?.type === "text" ? (s2.raw += (s2.raw.endsWith(` +`) ? "" : ` +`) + r2.raw, s2.text += ` +` + r2.text, this.inlineQueue.at(-1).src = s2.text) : t4.push(r2); + continue; + } + if (r2 = this.tokenizer.fences(e3)) { + e3 = e3.substring(r2.raw.length), t4.push(r2); + continue; + } + if (r2 = this.tokenizer.heading(e3)) { + e3 = e3.substring(r2.raw.length), t4.push(r2); + continue; + } + if (r2 = this.tokenizer.hr(e3)) { + e3 = e3.substring(r2.raw.length), t4.push(r2); + continue; + } + if (r2 = this.tokenizer.blockquote(e3)) { + e3 = e3.substring(r2.raw.length), t4.push(r2); + continue; + } + if (r2 = this.tokenizer.list(e3)) { + e3 = e3.substring(r2.raw.length), t4.push(r2); + continue; + } + if (r2 = this.tokenizer.html(e3)) { + e3 = e3.substring(r2.raw.length), t4.push(r2); + continue; + } + if (r2 = this.tokenizer.def(e3)) { + e3 = e3.substring(r2.raw.length); + let s2 = t4.at(-1); + s2?.type === "paragraph" || s2?.type === "text" ? (s2.raw += (s2.raw.endsWith(` +`) ? "" : ` +`) + r2.raw, s2.text += ` +` + r2.raw, this.inlineQueue.at(-1).src = s2.text) : this.tokens.links[r2.tag] || (this.tokens.links[r2.tag] = { href: r2.href, title: r2.title }, t4.push(r2)); + continue; + } + if (r2 = this.tokenizer.table(e3)) { + e3 = e3.substring(r2.raw.length), t4.push(r2); + continue; + } + if (r2 = this.tokenizer.lheading(e3)) { + e3 = e3.substring(r2.raw.length), t4.push(r2); + continue; + } + let i2 = e3; + if (this.options.extensions?.startBlock) { + let s2 = 1 / 0, o2 = e3.slice(1), a2; + this.options.extensions.startBlock.forEach((u2) => { + a2 = u2.call({ lexer: this }, o2), typeof a2 == "number" && a2 >= 0 && (s2 = Math.min(s2, a2)); + }), s2 < 1 / 0 && s2 >= 0 && (i2 = e3.substring(0, s2 + 1)); + } + if (this.state.top && (r2 = this.tokenizer.paragraph(i2))) { + let s2 = t4.at(-1); + n2 && s2?.type === "paragraph" ? (s2.raw += (s2.raw.endsWith(` +`) ? "" : ` +`) + r2.raw, s2.text += ` +` + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s2.text) : t4.push(r2), n2 = i2.length !== e3.length, e3 = e3.substring(r2.raw.length); + continue; + } + if (r2 = this.tokenizer.text(e3)) { + e3 = e3.substring(r2.raw.length); + let s2 = t4.at(-1); + s2?.type === "text" ? (s2.raw += (s2.raw.endsWith(` +`) ? "" : ` +`) + r2.raw, s2.text += ` +` + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = s2.text) : t4.push(r2); + continue; + } + if (e3) { + let s2 = "Infinite loop on byte: " + e3.charCodeAt(0); + if (this.options.silent) { + console.error(s2); + break; + } else throw new Error(s2); + } + } + return this.state.top = true, t4; + } + inline(e3, t4 = []) { + return this.inlineQueue.push({ src: e3, tokens: t4 }), t4; + } + inlineTokens(e3, t4 = []) { + let n2 = e3, r2 = null; + if (this.tokens.links) { + let o2 = Object.keys(this.tokens.links); + if (o2.length > 0) for (; (r2 = this.tokenizer.rules.inline.reflinkSearch.exec(n2)) != null; ) o2.includes(r2[0].slice(r2[0].lastIndexOf("[") + 1, -1)) && (n2 = n2.slice(0, r2.index) + "[" + "a".repeat(r2[0].length - 2) + "]" + n2.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)); + } + for (; (r2 = this.tokenizer.rules.inline.anyPunctuation.exec(n2)) != null; ) n2 = n2.slice(0, r2.index) + "++" + n2.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); + for (; (r2 = this.tokenizer.rules.inline.blockSkip.exec(n2)) != null; ) n2 = n2.slice(0, r2.index) + "[" + "a".repeat(r2[0].length - 2) + "]" + n2.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); + n2 = this.options.hooks?.emStrongMask?.call({ lexer: this }, n2) ?? n2; + let i2 = false, s2 = ""; + for (; e3; ) { + i2 || (s2 = ""), i2 = false; + let o2; + if (this.options.extensions?.inline?.some((u2) => (o2 = u2.call({ lexer: this }, e3, t4)) ? (e3 = e3.substring(o2.raw.length), t4.push(o2), true) : false)) continue; + if (o2 = this.tokenizer.escape(e3)) { + e3 = e3.substring(o2.raw.length), t4.push(o2); + continue; + } + if (o2 = this.tokenizer.tag(e3)) { + e3 = e3.substring(o2.raw.length), t4.push(o2); + continue; + } + if (o2 = this.tokenizer.link(e3)) { + e3 = e3.substring(o2.raw.length), t4.push(o2); + continue; + } + if (o2 = this.tokenizer.reflink(e3, this.tokens.links)) { + e3 = e3.substring(o2.raw.length); + let u2 = t4.at(-1); + o2.type === "text" && u2?.type === "text" ? (u2.raw += o2.raw, u2.text += o2.text) : t4.push(o2); + continue; + } + if (o2 = this.tokenizer.emStrong(e3, n2, s2)) { + e3 = e3.substring(o2.raw.length), t4.push(o2); + continue; + } + if (o2 = this.tokenizer.codespan(e3)) { + e3 = e3.substring(o2.raw.length), t4.push(o2); + continue; + } + if (o2 = this.tokenizer.br(e3)) { + e3 = e3.substring(o2.raw.length), t4.push(o2); + continue; + } + if (o2 = this.tokenizer.del(e3)) { + e3 = e3.substring(o2.raw.length), t4.push(o2); + continue; + } + if (o2 = this.tokenizer.autolink(e3)) { + e3 = e3.substring(o2.raw.length), t4.push(o2); + continue; + } + if (!this.state.inLink && (o2 = this.tokenizer.url(e3))) { + e3 = e3.substring(o2.raw.length), t4.push(o2); + continue; + } + let a2 = e3; + if (this.options.extensions?.startInline) { + let u2 = 1 / 0, p3 = e3.slice(1), c3; + this.options.extensions.startInline.forEach((f2) => { + c3 = f2.call({ lexer: this }, p3), typeof c3 == "number" && c3 >= 0 && (u2 = Math.min(u2, c3)); + }), u2 < 1 / 0 && u2 >= 0 && (a2 = e3.substring(0, u2 + 1)); + } + if (o2 = this.tokenizer.inlineText(a2)) { + e3 = e3.substring(o2.raw.length), o2.raw.slice(-1) !== "_" && (s2 = o2.raw.slice(-1)), i2 = true; + let u2 = t4.at(-1); + u2?.type === "text" ? (u2.raw += o2.raw, u2.text += o2.text) : t4.push(o2); + continue; + } + if (e3) { + let u2 = "Infinite loop on byte: " + e3.charCodeAt(0); + if (this.options.silent) { + console.error(u2); + break; + } else throw new Error(u2); + } + } + return t4; + } + }; + P = class { + static { + __name(this, "P"); + } + options; + parser; + constructor(e3) { + this.options = e3 || O; + } + space(e3) { + return ""; + } + code({ text: e3, lang: t4, escaped: n2 }) { + let r2 = (t4 || "").match(m.notSpaceStart)?.[0], i2 = e3.replace(m.endingNewline, "") + ` +`; + return r2 ? '
' + (n2 ? i2 : w(i2, true)) + `
+` : "
" + (n2 ? i2 : w(i2, true)) + `
+`; + } + blockquote({ tokens: e3 }) { + return `
+${this.parser.parse(e3)}
+`; + } + html({ text: e3 }) { + return e3; + } + def(e3) { + return ""; + } + heading({ tokens: e3, depth: t4 }) { + return `${this.parser.parseInline(e3)} +`; + } + hr(e3) { + return `
+`; + } + list(e3) { + let t4 = e3.ordered, n2 = e3.start, r2 = ""; + for (let o2 = 0; o2 < e3.items.length; o2++) { + let a2 = e3.items[o2]; + r2 += this.listitem(a2); + } + let i2 = t4 ? "ol" : "ul", s2 = t4 && n2 !== 1 ? ' start="' + n2 + '"' : ""; + return "<" + i2 + s2 + `> +` + r2 + " +`; + } + listitem(e3) { + let t4 = ""; + if (e3.task) { + let n2 = this.checkbox({ checked: !!e3.checked }); + e3.loose ? e3.tokens[0]?.type === "paragraph" ? (e3.tokens[0].text = n2 + " " + e3.tokens[0].text, e3.tokens[0].tokens && e3.tokens[0].tokens.length > 0 && e3.tokens[0].tokens[0].type === "text" && (e3.tokens[0].tokens[0].text = n2 + " " + w(e3.tokens[0].tokens[0].text), e3.tokens[0].tokens[0].escaped = true)) : e3.tokens.unshift({ type: "text", raw: n2 + " ", text: n2 + " ", escaped: true }) : t4 += n2 + " "; + } + return t4 += this.parser.parse(e3.tokens, !!e3.loose), `
  • ${t4}
  • +`; + } + checkbox({ checked: e3 }) { + return "'; + } + paragraph({ tokens: e3 }) { + return `

    ${this.parser.parseInline(e3)}

    +`; + } + table(e3) { + let t4 = "", n2 = ""; + for (let i2 = 0; i2 < e3.header.length; i2++) n2 += this.tablecell(e3.header[i2]); + t4 += this.tablerow({ text: n2 }); + let r2 = ""; + for (let i2 = 0; i2 < e3.rows.length; i2++) { + let s2 = e3.rows[i2]; + n2 = ""; + for (let o2 = 0; o2 < s2.length; o2++) n2 += this.tablecell(s2[o2]); + r2 += this.tablerow({ text: n2 }); + } + return r2 && (r2 = `${r2}`), ` + +` + t4 + ` +` + r2 + `
    +`; + } + tablerow({ text: e3 }) { + return ` +${e3} +`; + } + tablecell(e3) { + let t4 = this.parser.parseInline(e3.tokens), n2 = e3.header ? "th" : "td"; + return (e3.align ? `<${n2} align="${e3.align}">` : `<${n2}>`) + t4 + ` +`; + } + strong({ tokens: e3 }) { + return `${this.parser.parseInline(e3)}`; + } + em({ tokens: e3 }) { + return `${this.parser.parseInline(e3)}`; + } + codespan({ text: e3 }) { + return `${w(e3, true)}`; + } + br(e3) { + return "
    "; + } + del({ tokens: e3 }) { + return `${this.parser.parseInline(e3)}`; + } + link({ href: e3, title: t4, tokens: n2 }) { + let r2 = this.parser.parseInline(n2), i2 = J(e3); + if (i2 === null) return r2; + e3 = i2; + let s2 = '
    ", s2; + } + image({ href: e3, title: t4, text: n2, tokens: r2 }) { + r2 && (n2 = this.parser.parseInline(r2, this.parser.textRenderer)); + let i2 = J(e3); + if (i2 === null) return w(n2); + e3 = i2; + let s2 = `${n2} { + let o2 = i2[s2].flat(1 / 0); + n2 = n2.concat(this.walkTokens(o2, t4)); + }) : i2.tokens && (n2 = n2.concat(this.walkTokens(i2.tokens, t4))); + } + } + return n2; + } + use(...e3) { + let t4 = this.defaults.extensions || { renderers: {}, childTokens: {} }; + return e3.forEach((n2) => { + let r2 = { ...n2 }; + if (r2.async = this.defaults.async || r2.async || false, n2.extensions && (n2.extensions.forEach((i2) => { + if (!i2.name) throw new Error("extension name required"); + if ("renderer" in i2) { + let s2 = t4.renderers[i2.name]; + s2 ? t4.renderers[i2.name] = function(...o2) { + let a2 = i2.renderer.apply(this, o2); + return a2 === false && (a2 = s2.apply(this, o2)), a2; + } : t4.renderers[i2.name] = i2.renderer; + } + if ("tokenizer" in i2) { + if (!i2.level || i2.level !== "block" && i2.level !== "inline") throw new Error("extension level must be 'block' or 'inline'"); + let s2 = t4[i2.level]; + s2 ? s2.unshift(i2.tokenizer) : t4[i2.level] = [i2.tokenizer], i2.start && (i2.level === "block" ? t4.startBlock ? t4.startBlock.push(i2.start) : t4.startBlock = [i2.start] : i2.level === "inline" && (t4.startInline ? t4.startInline.push(i2.start) : t4.startInline = [i2.start])); + } + "childTokens" in i2 && i2.childTokens && (t4.childTokens[i2.name] = i2.childTokens); + }), r2.extensions = t4), n2.renderer) { + let i2 = this.defaults.renderer || new P(this.defaults); + for (let s2 in n2.renderer) { + if (!(s2 in i2)) throw new Error(`renderer '${s2}' does not exist`); + if (["options", "parser"].includes(s2)) continue; + let o2 = s2, a2 = n2.renderer[o2], u2 = i2[o2]; + i2[o2] = (...p3) => { + let c3 = a2.apply(i2, p3); + return c3 === false && (c3 = u2.apply(i2, p3)), c3 || ""; + }; + } + r2.renderer = i2; + } + if (n2.tokenizer) { + let i2 = this.defaults.tokenizer || new y2(this.defaults); + for (let s2 in n2.tokenizer) { + if (!(s2 in i2)) throw new Error(`tokenizer '${s2}' does not exist`); + if (["options", "rules", "lexer"].includes(s2)) continue; + let o2 = s2, a2 = n2.tokenizer[o2], u2 = i2[o2]; + i2[o2] = (...p3) => { + let c3 = a2.apply(i2, p3); + return c3 === false && (c3 = u2.apply(i2, p3)), c3; + }; + } + r2.tokenizer = i2; + } + if (n2.hooks) { + let i2 = this.defaults.hooks || new S2(); + for (let s2 in n2.hooks) { + if (!(s2 in i2)) throw new Error(`hook '${s2}' does not exist`); + if (["options", "block"].includes(s2)) continue; + let o2 = s2, a2 = n2.hooks[o2], u2 = i2[o2]; + S2.passThroughHooks.has(s2) ? i2[o2] = (p3) => { + if (this.defaults.async && S2.passThroughHooksRespectAsync.has(s2)) return Promise.resolve(a2.call(i2, p3)).then((f2) => u2.call(i2, f2)); + let c3 = a2.call(i2, p3); + return u2.call(i2, c3); + } : i2[o2] = (...p3) => { + let c3 = a2.apply(i2, p3); + return c3 === false && (c3 = u2.apply(i2, p3)), c3; + }; + } + r2.hooks = i2; + } + if (n2.walkTokens) { + let i2 = this.defaults.walkTokens, s2 = n2.walkTokens; + r2.walkTokens = function(o2) { + let a2 = []; + return a2.push(s2.call(this, o2)), i2 && (a2 = a2.concat(i2.call(this, o2))), a2; + }; + } + this.defaults = { ...this.defaults, ...r2 }; + }), this; + } + setOptions(e3) { + return this.defaults = { ...this.defaults, ...e3 }, this; + } + lexer(e3, t4) { + return b.lex(e3, t4 ?? this.defaults); + } + parser(e3, t4) { + return R.parse(e3, t4 ?? this.defaults); + } + parseMarkdown(e3) { + return (n2, r2) => { + let i2 = { ...r2 }, s2 = { ...this.defaults, ...i2 }, o2 = this.onError(!!s2.silent, !!s2.async); + if (this.defaults.async === true && i2.async === false) return o2(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.")); + if (typeof n2 > "u" || n2 === null) return o2(new Error("marked(): input parameter is undefined or null")); + if (typeof n2 != "string") return o2(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n2) + ", string expected")); + s2.hooks && (s2.hooks.options = s2, s2.hooks.block = e3); + let a2 = s2.hooks ? s2.hooks.provideLexer() : e3 ? b.lex : b.lexInline, u2 = s2.hooks ? s2.hooks.provideParser() : e3 ? R.parse : R.parseInline; + if (s2.async) return Promise.resolve(s2.hooks ? s2.hooks.preprocess(n2) : n2).then((p3) => a2(p3, s2)).then((p3) => s2.hooks ? s2.hooks.processAllTokens(p3) : p3).then((p3) => s2.walkTokens ? Promise.all(this.walkTokens(p3, s2.walkTokens)).then(() => p3) : p3).then((p3) => u2(p3, s2)).then((p3) => s2.hooks ? s2.hooks.postprocess(p3) : p3).catch(o2); + try { + s2.hooks && (n2 = s2.hooks.preprocess(n2)); + let p3 = a2(n2, s2); + s2.hooks && (p3 = s2.hooks.processAllTokens(p3)), s2.walkTokens && this.walkTokens(p3, s2.walkTokens); + let c3 = u2(p3, s2); + return s2.hooks && (c3 = s2.hooks.postprocess(c3)), c3; + } catch (p3) { + return o2(p3); + } + }; + } + onError(e3, t4) { + return (n2) => { + if (n2.message += ` +Please report this to https://github.com/markedjs/marked.`, e3) { + let r2 = "

    An error occurred:

    " + w(n2.message + "", true) + "
    "; + return t4 ? Promise.resolve(r2) : r2; + } + if (t4) return Promise.reject(n2); + throw n2; + }; + } + }; + _ = new B(); + __name(d, "d"); + d.options = d.setOptions = function(l4) { + return _.setOptions(l4), d.defaults = _.defaults, G(d.defaults), d; + }; + d.getDefaults = L; + d.defaults = O; + d.use = function(...l4) { + return _.use(...l4), d.defaults = _.defaults, G(d.defaults), d; + }; + d.walkTokens = function(l4, e3) { + return _.walkTokens(l4, e3); + }; + d.parseInline = _.parseInline; + d.Parser = R; + d.parser = R.parse; + d.Renderer = P; + d.TextRenderer = $; + d.Lexer = b; + d.lexer = b.lex; + d.Tokenizer = y2; + d.Hooks = S2; + d.parse = d; + Dt = d.options; + Ht = d.setOptions; + Zt = d.use; + Gt = d.walkTokens; + Nt = d.parseInline; + Ft = R.parse; + Qt = b.lex; + } + }); + + // src/rendering-util/handle-markdown-text.ts + function preprocessMarkdown(markdown, { markdownAutoWrap }) { + const withoutBR = markdown.replace(//g, "\n"); + const withoutMultipleNewlines = withoutBR.replace(/\n{2,}/g, "\n"); + const withoutExtraSpaces = dedent(withoutMultipleNewlines); + if (markdownAutoWrap === false) { + } + return withoutExtraSpaces; + } + function nonMarkdownToLines(nonMarkdownText) { + return nonMarkdownText.split(/\\n|\n|/gi).map( + (line2) => line2.trim().match(/<[^>]+>|[^\s<>]+/g)?.map((word) => ({ content: word, type: "normal" })) ?? [] + ); + } + function markdownToLines(markdown, config5 = {}) { + const preprocessedMarkdown = preprocessMarkdown(markdown, config5); + const nodes5 = d.lexer(preprocessedMarkdown); + const lines = [[]]; + let currentLine = 0; + function processNode(node2, parentType = "normal") { + if (node2.type === "text") { + const textLines = node2.text.split("\n"); + textLines.forEach((textLine, index) => { + if (index !== 0) { + currentLine++; + lines.push([]); + } + textLine.split(" ").forEach((word) => { + word = word.replace(/'/g, `'`); + if (word) { + lines[currentLine].push({ content: word, type: parentType }); + } + }); + }); + } else if (node2.type === "strong" || node2.type === "em") { + node2.tokens.forEach((contentNode) => { + processNode(contentNode, node2.type); + }); + } else if (node2.type === "html") { + lines[currentLine].push({ content: node2.text, type: "normal" }); + } + } + __name(processNode, "processNode"); + nodes5.forEach((treeNode) => { + if (treeNode.type === "paragraph") { + treeNode.tokens?.forEach((contentNode) => { + processNode(contentNode); + }); + } else if (treeNode.type === "html") { + lines[currentLine].push({ content: treeNode.text, type: "normal" }); + } else { + lines[currentLine].push({ content: treeNode.raw, type: "normal" }); + } + }); + return lines; + } + function nonMarkdownToHTML(text4) { + if (!text4) { + return ""; + } + return `

    ${/** + * Replace new lines with
    tags. + * + * Unlike in markdown text, `\n` sequences are treated as line breaks here. + */ + text4.replace(/\\n|\n/g, "
    ")}

    `; + } + function markdownToHTML(markdown, { markdownAutoWrap } = {}) { + const nodes5 = d.lexer(markdown); + function output2(node2) { + if (node2.type === "text") { + if (markdownAutoWrap === false) { + return node2.text.replace(/\n */g, "
    ").replace(/ /g, " "); + } + return node2.text.replace(/\n */g, "
    "); + } else if (node2.type === "strong") { + return `${node2.tokens?.map(output2).join("")}`; + } else if (node2.type === "em") { + return `${node2.tokens?.map(output2).join("")}`; + } else if (node2.type === "paragraph") { + return `

    ${node2.tokens?.map(output2).join("")}

    `; + } else if (node2.type === "space") { + return ""; + } else if (node2.type === "html") { + return `${node2.text}`; + } else if (node2.type === "escape") { + return node2.text; + } + log.warn(`Unsupported markdown: ${node2.type}`); + return node2.raw; + } + __name(output2, "output"); + return nodes5.map(output2).join(""); + } + var init_handle_markdown_text = __esm({ + "src/rendering-util/handle-markdown-text.ts"() { + "use strict"; + init_marked_esm(); + init_esm(); + init_logger(); + __name(preprocessMarkdown, "preprocessMarkdown"); + __name(nonMarkdownToLines, "nonMarkdownToLines"); + __name(markdownToLines, "markdownToLines"); + __name(nonMarkdownToHTML, "nonMarkdownToHTML"); + __name(markdownToHTML, "markdownToHTML"); + } + }); + + // src/rendering-util/splitText.ts + function splitTextToChars(text4) { + if (Intl.Segmenter) { + return [...new Intl.Segmenter().segment(text4)].map((s2) => s2.segment); + } + return [...text4]; + } + function splitWordToFitWidth(checkFit, word) { + const characters2 = splitTextToChars(word.content); + return splitWordToFitWidthRecursion(checkFit, [], characters2, word.type); + } + function splitWordToFitWidthRecursion(checkFit, usedChars, remainingChars, type3) { + if (remainingChars.length === 0) { + return [ + { content: usedChars.join(""), type: type3 }, + { content: "", type: type3 } + ]; + } + const [nextChar, ...rest] = remainingChars; + const newWord = [...usedChars, nextChar]; + if (checkFit([{ content: newWord.join(""), type: type3 }])) { + return splitWordToFitWidthRecursion(checkFit, newWord, rest, type3); + } + if (usedChars.length === 0 && nextChar) { + usedChars.push(nextChar); + remainingChars.shift(); + } + return [ + { content: usedChars.join(""), type: type3 }, + { content: remainingChars.join(""), type: type3 } + ]; + } + function splitLineToFitWidth(line2, checkFit) { + if (line2.some(({ content }) => content.includes("\n"))) { + throw new Error("splitLineToFitWidth does not support newlines in the line"); + } + return splitLineToFitWidthRecursion(line2, checkFit); + } + function splitLineToFitWidthRecursion(words, checkFit, lines = [], newLine = []) { + if (words.length === 0) { + if (newLine.length > 0) { + lines.push(newLine); + } + return lines.length > 0 ? lines : []; + } + let joiner = ""; + if (words[0].content === " ") { + joiner = " "; + words.shift(); + } + const nextWord = words.shift() ?? { content: " ", type: "normal" }; + const lineWithNextWord = [...newLine]; + if (joiner !== "") { + lineWithNextWord.push({ content: joiner, type: "normal" }); + } + lineWithNextWord.push(nextWord); + if (checkFit(lineWithNextWord)) { + return splitLineToFitWidthRecursion(words, checkFit, lines, lineWithNextWord); + } + if (newLine.length > 0) { + lines.push(newLine); + words.unshift(nextWord); + } else if (nextWord.content) { + const [line2, rest] = splitWordToFitWidth(checkFit, nextWord); + lines.push([line2]); + if (rest.content) { + words.unshift(rest); + } + } + return splitLineToFitWidthRecursion(words, checkFit, lines); + } + var init_splitText = __esm({ + "src/rendering-util/splitText.ts"() { + "use strict"; + __name(splitTextToChars, "splitTextToChars"); + __name(splitWordToFitWidth, "splitWordToFitWidth"); + __name(splitWordToFitWidthRecursion, "splitWordToFitWidthRecursion"); + __name(splitLineToFitWidth, "splitLineToFitWidth"); + __name(splitLineToFitWidthRecursion, "splitLineToFitWidthRecursion"); + } + }); + + // src/rendering-util/createText.ts + function applyStyle(dom, styleFn) { + if (styleFn) { + dom.attr("style", styleFn); + } + } + async function addHtmlSpan(element3, node2, width3, classes3, addBackground = false, config5 = getConfig()) { + const fo = element3.append("foreignObject"); + fo.attr("width", `${Math.min(10 * width3, maxSafeSizeForWidth)}px`); + fo.attr("height", `${Math.min(10 * width3, maxSafeSizeForWidth)}px`); + const div = fo.append("xhtml:div"); + const sanitizedLabel = hasKatex(node2.label) ? await renderKatexSanitized(node2.label.replace(common_default.lineBreakRegex, "\n"), config5) : sanitizeText(node2.label, config5); + const labelClass = node2.isNode ? "nodeLabel" : "edgeLabel"; + const span = div.append("span"); + span.html(sanitizedLabel); + applyStyle(span, node2.labelStyle); + span.attr("class", `${labelClass} ${classes3}`); + applyStyle(div, node2.labelStyle); + div.style("display", "table-cell"); + div.style("white-space", "nowrap"); + div.style("line-height", "1.5"); + if (width3 !== Number.POSITIVE_INFINITY) { + div.style("max-width", width3 + "px"); + div.style("text-align", "center"); + } + div.attr("xmlns", "http://www.w3.org/1999/xhtml"); + if (addBackground) { + div.attr("class", "labelBkg"); + } + let bbox = div.node().getBoundingClientRect(); + if (bbox.width === width3) { + div.style("display", "table"); + div.style("white-space", "break-spaces"); + div.style("width", width3 + "px"); + bbox = div.node().getBoundingClientRect(); + } + return fo.node(); + } + function createTspan(textElement, lineIndex, lineHeight, centerText = false) { + const tspan = textElement.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", lineIndex * lineHeight - 0.1 + "em").attr("dy", lineHeight + "em"); + if (centerText) { + tspan.attr("text-anchor", "middle"); + } + return tspan; + } + function computeWidthOfText(parentNode, lineHeight, line2) { + const testElement = parentNode.append("text"); + const testSpan = createTspan(testElement, 1, lineHeight); + updateTextContentAndStyles(testSpan, line2); + const textLength = testSpan.node().getComputedTextLength(); + testElement.remove(); + return textLength; + } + function computeDimensionOfText(parentNode, lineHeight, text4) { + const testElement = parentNode.append("text"); + const testSpan = createTspan(testElement, 1, lineHeight); + updateTextContentAndStyles(testSpan, [{ content: text4, type: "normal" }]); + const textDimension = testSpan.node()?.getBoundingClientRect(); + if (textDimension) { + testElement.remove(); + } + return textDimension; + } + function createFormattedText(width3, g2, structuredText, addBackground = false, centerText = false) { + const lineHeight = 1.1; + const labelGroup = g2.append("g"); + const bkg = labelGroup.insert("rect").attr("class", "background").attr("style", "stroke: none"); + const textElement = labelGroup.append("text").attr("y", "-10.1"); + if (centerText) { + textElement.attr("text-anchor", "middle"); + } + let lineIndex = 0; + for (const line2 of structuredText) { + const checkWidth = /* @__PURE__ */ __name((line3) => computeWidthOfText(labelGroup, lineHeight, line3) <= width3, "checkWidth"); + const linesUnderWidth = checkWidth(line2) ? [line2] : splitLineToFitWidth(line2, checkWidth); + for (const preparedLine of linesUnderWidth) { + const tspan = createTspan(textElement, lineIndex, lineHeight, centerText); + updateTextContentAndStyles(tspan, preparedLine); + lineIndex++; + } + } + if (addBackground) { + const bbox = textElement.node().getBBox(); + const padding2 = 2; + bkg.attr("x", bbox.x - padding2).attr("y", bbox.y - padding2).attr("width", bbox.width + 2 * padding2).attr("height", bbox.height + 2 * padding2); + return labelGroup.node(); + } else { + return textElement.node(); + } + } + function decodeHTMLEntities(text4) { + const regex2 = /&(amp|lt|gt);/g; + return text4.replace(regex2, (match3, entity) => { + switch (entity) { + case "amp": + return "&"; + case "lt": + return "<"; + case "gt": + return ">"; + default: + return match3; + } + }); + } + function updateTextContentAndStyles(tspan, wrappedLine) { + tspan.text(""); + wrappedLine.forEach((word, index) => { + const innerTspan = tspan.append("tspan").attr("font-style", word.type === "em" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", word.type === "strong" ? "bold" : "normal"); + if (index === 0) { + innerTspan.text(decodeHTMLEntities(word.content)); + } else { + innerTspan.text(" " + decodeHTMLEntities(word.content)); + } + }); + } + async function replaceIconSubstring(text4, config5 = {}) { + const pendingReplacements = []; + text4.replace(/(fa[bklrs]?):fa-([\w-]+)/g, (fullMatch, prefix, iconName) => { + pendingReplacements.push( + (async () => { + const registeredIconName = `${prefix}:${iconName}`; + if (await isIconAvailable(registeredIconName)) { + return await getIconSVG(registeredIconName, void 0, { class: "label-icon" }); + } else { + return ``; + } + })() + ); + return fullMatch; + }); + const replacements = await Promise.all(pendingReplacements); + return text4.replace(/(fa[bklrs]?):fa-([\w-]+)/g, () => replacements.shift() ?? ""); + } + var maxSafeSizeForWidth, createText; + var init_createText = __esm({ + "src/rendering-util/createText.ts"() { + "use strict"; + init_src32(); + init_common(); + init_logger(); + init_handle_markdown_text(); + init_utils2(); + init_icons(); + init_splitText(); + init_config(); + __name(applyStyle, "applyStyle"); + maxSafeSizeForWidth = 16384; + __name(addHtmlSpan, "addHtmlSpan"); + __name(createTspan, "createTspan"); + __name(computeWidthOfText, "computeWidthOfText"); + __name(computeDimensionOfText, "computeDimensionOfText"); + __name(createFormattedText, "createFormattedText"); + __name(decodeHTMLEntities, "decodeHTMLEntities"); + __name(updateTextContentAndStyles, "updateTextContentAndStyles"); + __name(replaceIconSubstring, "replaceIconSubstring"); + createText = /* @__PURE__ */ __name(async (el, text4 = "", { + style: style3 = "", + isTitle = false, + classes: classes3 = "", + useHtmlLabels = true, + markdown = true, + isNode: isNode2 = true, + /** + * The width to wrap the text within. Set to `Number.POSITIVE_INFINITY` for no wrapping. + */ + width: width3 = 200, + addSvgBackground = false + } = {}, config5) => { + log.debug( + "XYZ createText", + text4, + style3, + isTitle, + classes3, + useHtmlLabels, + isNode2, + "addSvgBackground: ", + addSvgBackground + ); + if (useHtmlLabels) { + const htmlText = markdown ? markdownToHTML(text4, config5) : nonMarkdownToHTML(text4); + const decodedReplacedText = await replaceIconSubstring(decodeEntities(htmlText), config5); + const inputForKatex = text4.replace(/\\\\/g, "\\"); + const node2 = { + isNode: isNode2, + label: hasKatex(text4) ? inputForKatex : decodedReplacedText, + labelStyle: style3.replace("fill:", "color:") + }; + const vertexNode = await addHtmlSpan(el, node2, width3, classes3, addSvgBackground, config5); + return vertexNode; + } else { + const sanitizeBR = decodeEntities(text4.replace(//g, "
    ")); + const structuredText = markdown ? markdownToLines(sanitizeBR.replace("
    ", "
    "), config5) : nonMarkdownToLines(sanitizeBR); + const svgLabel = createFormattedText( + width3, + el, + structuredText, + text4 ? addSvgBackground : false, + !isNode2 + ); + if (isNode2) { + if (/stroke:/.exec(style3)) { + style3 = style3.replace("stroke:", "lineColor:"); + } + const nodeLabelTextStyle = style3.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:"); + select_default2(svgLabel).attr("style", nodeLabelTextStyle); + } else { + const edgeLabelRectStyle = style3.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/background:/g, "fill:"); + select_default2(svgLabel).select("rect").attr("style", edgeLabelRectStyle.replace(/background:/g, "fill:")); + const edgeLabelTextStyle = style3.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:"); + select_default2(svgLabel).select("text").attr("style", edgeLabelTextStyle); + } + if (isTitle) { + select_default2(svgLabel).selectAll("tspan.text-outer-tspan").classed("title-row", true); + } else { + select_default2(svgLabel).selectAll("tspan.text-outer-tspan").classed("row", true); + } + return svgLabel; + } + }, "createText"); + } + }); + + // src/rendering-util/rendering-elements/shapes/labelImageUtils.ts + async function configureLabelImages(container2, labelText) { + const images = container2.getElementsByTagName("img"); + if (!images || images.length === 0) { + return; + } + const noImgText = labelText.replace(/]*>/g, "").trim() === ""; + await Promise.all( + [...images].map( + (img) => new Promise((res) => { + function setupImage() { + img.style.display = "flex"; + img.style.flexDirection = "column"; + if (noImgText) { + const bodyFontSize = getConfig2().fontSize ? getConfig2().fontSize : window.getComputedStyle(document.body).fontSize; + const enlargingFactor = 5; + const [parsedBodyFontSize = defaultConfig_default.fontSize] = parseFontSize(bodyFontSize); + const width3 = parsedBodyFontSize * enlargingFactor + "px"; + img.style.minWidth = width3; + img.style.maxWidth = width3; + } else { + img.style.width = "100%"; + } + res(img); + } + __name(setupImage, "setupImage"); + setTimeout(() => { + if (img.complete) { + setupImage(); + } + }); + img.addEventListener("error", setupImage); + img.addEventListener("load", setupImage); + }) + ) + ); + } + var init_labelImageUtils = __esm({ + "src/rendering-util/rendering-elements/shapes/labelImageUtils.ts"() { + "use strict"; + init_diagramAPI(); + init_defaultConfig(); + init_utils2(); + __name(configureLabelImages, "configureLabelImages"); + } + }); + + // src/rendering-util/rendering-elements/shapes/util.ts + function createPathFromPoints(points) { + const pointStrings = points.map((p3, i2) => `${i2 === 0 ? "M" : "L"}${p3.x},${p3.y}`); + pointStrings.push("Z"); + return pointStrings.join(" "); + } + function generateFullSineWavePoints(x1, y1, x22, y22, amplitude, numCycles) { + const points = []; + const steps = 50; + const deltaX = x22 - x1; + const deltaY = y22 - y1; + const cycleLength = deltaX / numCycles; + const frequency = 2 * Math.PI / cycleLength; + const midY = y1 + deltaY / 2; + for (let i2 = 0; i2 <= steps; i2++) { + const t4 = i2 / steps; + const x5 = x1 + t4 * deltaX; + const y6 = midY + amplitude * Math.sin(frequency * (x5 - x1)); + points.push({ x: x5, y: y6 }); + } + return points; + } + function generateCirclePoints(centerX, centerY, radius2, numPoints, startAngle, endAngle) { + const points = []; + const startAngleRad = startAngle * Math.PI / 180; + const endAngleRad = endAngle * Math.PI / 180; + const angleRange = endAngleRad - startAngleRad; + const angleStep = angleRange / (numPoints - 1); + for (let i2 = 0; i2 < numPoints; i2++) { + const angle2 = startAngleRad + i2 * angleStep; + const x5 = centerX + radius2 * Math.cos(angle2); + const y6 = centerY + radius2 * Math.sin(angle2); + points.push({ x: -x5, y: -y6 }); + } + return points; + } + function mergePaths(roughElement) { + const paths = Array.from(roughElement.childNodes).filter( + (node2) => node2.tagName === "path" + ); + const mergedPath = document.createElementNS("http://www.w3.org/2000/svg", "path"); + const combinedPathData = paths.map((path4) => path4.getAttribute("d")).filter((d3) => d3 !== null).join(" "); + mergedPath.setAttribute("d", combinedPathData); + const fillPath = paths.find((path4) => path4.getAttribute("fill") !== "none"); + const strokePath = paths.find((path4) => path4.getAttribute("stroke") !== "none"); + const getAttr = /* @__PURE__ */ __name((element3, attr) => { + return element3?.getAttribute(attr) ?? void 0; + }, "getAttr"); + if (fillPath) { + const fillAttrs = { + fill: getAttr(fillPath, "fill"), + "fill-opacity": getAttr(fillPath, "fill-opacity") ?? "1" + }; + Object.entries(fillAttrs).forEach(([attr, value2]) => { + if (value2) { + mergedPath.setAttribute(attr, value2); + } + }); + } + if (strokePath) { + const strokeAttrs = { + stroke: getAttr(strokePath, "stroke"), + "stroke-width": getAttr(strokePath, "stroke-width") ?? "1", + "stroke-opacity": getAttr(strokePath, "stroke-opacity") ?? "1" + }; + Object.entries(strokeAttrs).forEach(([attr, value2]) => { + if (value2) { + mergedPath.setAttribute(attr, value2); + } + }); + } + const group2 = document.createElementNS("http://www.w3.org/2000/svg", "g"); + group2.appendChild(mergedPath); + return group2; + } + var labelHelper, insertLabel, updateNodeBounds, getNodeClasses; + var init_util = __esm({ + "src/rendering-util/rendering-elements/shapes/util.ts"() { + "use strict"; + init_createText(); + init_diagramAPI(); + init_config(); + init_src32(); + init_common(); + init_utils2(); + init_labelImageUtils(); + labelHelper = /* @__PURE__ */ __name(async (parent4, node2, _classes) => { + let cssClasses; + const useHtmlLabels = node2.useHtmlLabels || evaluate(getConfig2()?.htmlLabels); + if (!_classes) { + cssClasses = "node default"; + } else { + cssClasses = _classes; + } + const shapeSvg = parent4.insert("g").attr("class", cssClasses).attr("id", node2.domId || node2.id); + const labelEl = shapeSvg.insert("g").attr("class", "label").attr("style", handleUndefinedAttr(node2.labelStyle)); + let label; + if (node2.label === void 0) { + label = ""; + } else { + label = typeof node2.label === "string" ? node2.label : node2.label[0]; + } + const addBackground = !!node2.icon || !!node2.img; + const isMarkdown = node2.labelType === "markdown"; + const text4 = await createText( + labelEl, + sanitizeText(decodeEntities(label), getConfig2()), + { + useHtmlLabels, + width: node2.width || getConfig2().flowchart?.wrappingWidth, + classes: isMarkdown ? "markdown-node-label" : "", + style: node2.labelStyle, + addSvgBackground: addBackground, + markdown: isMarkdown + }, + getConfig2() + ); + let bbox = text4.getBBox(); + const halfPadding = (node2?.padding ?? 0) / 2; + if (useHtmlLabels) { + const div = text4.children[0]; + const dv = select_default2(text4); + await configureLabelImages(div, label); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + if (useHtmlLabels) { + labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")"); + } else { + labelEl.attr("transform", "translate(0, " + -bbox.height / 2 + ")"); + } + if (node2.centerLabel) { + labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")"); + } + labelEl.insert("rect", ":first-child"); + return { shapeSvg, bbox, halfPadding, label: labelEl }; + }, "labelHelper"); + insertLabel = /* @__PURE__ */ __name(async (parent4, label, options2) => { + const useHtmlLabels = options2.useHtmlLabels ?? getEffectiveHtmlLabels(getConfig2()); + const labelEl = parent4.insert("g").attr("class", "label").attr("style", options2.labelStyle || ""); + const text4 = await createText(labelEl, sanitizeText(decodeEntities(label), getConfig2()), { + useHtmlLabels, + width: options2.width || getConfig2()?.flowchart?.wrappingWidth, + style: options2.labelStyle, + addSvgBackground: !!options2.icon || !!options2.img + }); + let bbox = text4.getBBox(); + const halfPadding = options2.padding / 2; + if (getEffectiveHtmlLabels(getConfig2())) { + const div = text4.children[0]; + const dv = select_default2(text4); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + if (useHtmlLabels) { + labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")"); + } else { + labelEl.attr("transform", "translate(0, " + -bbox.height / 2 + ")"); + } + if (options2.centerLabel) { + labelEl.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")"); + } + labelEl.insert("rect", ":first-child"); + return { shapeSvg: parent4, bbox, halfPadding, label: labelEl }; + }, "insertLabel"); + updateNodeBounds = /* @__PURE__ */ __name((node2, element3) => { + const bbox = element3.node().getBBox(); + node2.width = bbox.width; + node2.height = bbox.height; + }, "updateNodeBounds"); + getNodeClasses = /* @__PURE__ */ __name((node2, extra) => (node2.look === "handDrawn" ? "rough-node" : "node") + " " + node2.cssClasses + " " + (extra || ""), "getNodeClasses"); + __name(createPathFromPoints, "createPathFromPoints"); + __name(generateFullSineWavePoints, "generateFullSineWavePoints"); + __name(generateCirclePoints, "generateCirclePoints"); + __name(mergePaths, "mergePaths"); + } + }); + + // src/rendering-util/rendering-elements/intersect/intersect-node.js + function intersectNode(node2, point8) { + return node2.intersect(point8); + } + var intersect_node_default; + var init_intersect_node = __esm({ + "src/rendering-util/rendering-elements/intersect/intersect-node.js"() { + "use strict"; + __name(intersectNode, "intersectNode"); + intersect_node_default = intersectNode; + } + }); + + // src/rendering-util/rendering-elements/intersect/intersect-ellipse.js + function intersectEllipse(node2, rx, ry, point8) { + var cx = node2.x; + var cy = node2.y; + var px = cx - point8.x; + var py = cy - point8.y; + var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px); + var dx = Math.abs(rx * ry * px / det); + if (point8.x < cx) { + dx = -dx; + } + var dy = Math.abs(rx * ry * py / det); + if (point8.y < cy) { + dy = -dy; + } + return { x: cx + dx, y: cy + dy }; + } + var intersect_ellipse_default; + var init_intersect_ellipse = __esm({ + "src/rendering-util/rendering-elements/intersect/intersect-ellipse.js"() { + "use strict"; + __name(intersectEllipse, "intersectEllipse"); + intersect_ellipse_default = intersectEllipse; + } + }); + + // src/rendering-util/rendering-elements/intersect/intersect-circle.js + function intersectCircle(node2, rx, point8) { + return intersect_ellipse_default(node2, rx, rx, point8); + } + var intersect_circle_default; + var init_intersect_circle = __esm({ + "src/rendering-util/rendering-elements/intersect/intersect-circle.js"() { + "use strict"; + init_intersect_ellipse(); + __name(intersectCircle, "intersectCircle"); + intersect_circle_default = intersectCircle; + } + }); + + // src/rendering-util/rendering-elements/intersect/intersect-line.js + function intersectLine(p1, p22, q1, q22) { + { + const a1 = p22.y - p1.y; + const b1 = p1.x - p22.x; + const c1 = p22.x * p1.y - p1.x * p22.y; + const r3 = a1 * q1.x + b1 * q1.y + c1; + const r4 = a1 * q22.x + b1 * q22.y + c1; + const epsilon6 = 1e-6; + if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) { + return; + } + const a2 = q22.y - q1.y; + const b22 = q1.x - q22.x; + const c22 = q22.x * q1.y - q1.x * q22.y; + const r1 = a2 * p1.x + b22 * p1.y + c22; + const r2 = a2 * p22.x + b22 * p22.y + c22; + if (Math.abs(r1) < epsilon6 && Math.abs(r2) < epsilon6 && sameSign(r1, r2)) { + return; + } + const denom = a1 * b22 - a2 * b1; + if (denom === 0) { + return; + } + const offset = Math.abs(denom / 2); + let num = b1 * c22 - b22 * c1; + const x5 = num < 0 ? (num - offset) / denom : (num + offset) / denom; + num = a2 * c1 - a1 * c22; + const y6 = num < 0 ? (num - offset) / denom : (num + offset) / denom; + return { x: x5, y: y6 }; + } + } + function sameSign(r1, r2) { + return r1 * r2 > 0; + } + var intersect_line_default; + var init_intersect_line = __esm({ + "src/rendering-util/rendering-elements/intersect/intersect-line.js"() { + "use strict"; + __name(intersectLine, "intersectLine"); + __name(sameSign, "sameSign"); + intersect_line_default = intersectLine; + } + }); + + // src/rendering-util/rendering-elements/intersect/intersect-polygon.js + function intersectPolygon(node2, polyPoints, point8) { + let x1 = node2.x; + let y1 = node2.y; + let intersections = []; + let minX = Number.POSITIVE_INFINITY; + let minY = Number.POSITIVE_INFINITY; + if (typeof polyPoints.forEach === "function") { + polyPoints.forEach(function(entry) { + minX = Math.min(minX, entry.x); + minY = Math.min(minY, entry.y); + }); + } else { + minX = Math.min(minX, polyPoints.x); + minY = Math.min(minY, polyPoints.y); + } + let left3 = x1 - node2.width / 2 - minX; + let top2 = y1 - node2.height / 2 - minY; + for (let i2 = 0; i2 < polyPoints.length; i2++) { + let p1 = polyPoints[i2]; + let p22 = polyPoints[i2 < polyPoints.length - 1 ? i2 + 1 : 0]; + let intersect3 = intersect_line_default( + node2, + point8, + { x: left3 + p1.x, y: top2 + p1.y }, + { x: left3 + p22.x, y: top2 + p22.y } + ); + if (intersect3) { + intersections.push(intersect3); + } + } + if (!intersections.length) { + return node2; + } + if (intersections.length > 1) { + intersections.sort(function(p3, q3) { + let pdx = p3.x - point8.x; + let pdy = p3.y - point8.y; + let distp = Math.sqrt(pdx * pdx + pdy * pdy); + let qdx = q3.x - point8.x; + let qdy = q3.y - point8.y; + let distq = Math.sqrt(qdx * qdx + qdy * qdy); + return distp < distq ? -1 : distp === distq ? 0 : 1; + }); + } + return intersections[0]; + } + var intersect_polygon_default; + var init_intersect_polygon = __esm({ + "src/rendering-util/rendering-elements/intersect/intersect-polygon.js"() { + "use strict"; + init_intersect_line(); + __name(intersectPolygon, "intersectPolygon"); + intersect_polygon_default = intersectPolygon; + } + }); + + // src/rendering-util/rendering-elements/intersect/intersect-rect.js + var intersectRect, intersect_rect_default; + var init_intersect_rect = __esm({ + "src/rendering-util/rendering-elements/intersect/intersect-rect.js"() { + "use strict"; + intersectRect = /* @__PURE__ */ __name((node2, point8) => { + var x5 = node2.x; + var y6 = node2.y; + var dx = point8.x - x5; + var dy = point8.y - y6; + var w4 = node2.width / 2; + var h3 = node2.height / 2; + var sx, sy; + if (Math.abs(dy) * w4 > Math.abs(dx) * h3) { + if (dy < 0) { + h3 = -h3; + } + sx = dy === 0 ? 0 : h3 * dx / dy; + sy = h3; + } else { + if (dx < 0) { + w4 = -w4; + } + sx = w4; + sy = dx === 0 ? 0 : w4 * dy / dx; + } + return { x: x5 + sx, y: y6 + sy }; + }, "intersectRect"); + intersect_rect_default = intersectRect; + } + }); + + // src/rendering-util/rendering-elements/intersect/index.js + var intersect_default; + var init_intersect = __esm({ + "src/rendering-util/rendering-elements/intersect/index.js"() { + "use strict"; + init_intersect_node(); + init_intersect_circle(); + init_intersect_ellipse(); + init_intersect_polygon(); + init_intersect_rect(); + intersect_default = { + node: intersect_node_default, + circle: intersect_circle_default, + ellipse: intersect_ellipse_default, + polygon: intersect_polygon_default, + rect: intersect_rect_default + }; + } + }); + + // src/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.ts + var solidStateFill, compileStyles, styles2Map, isLabelStyle, styles2String, userNodeOverrides, getStrokeDashArray; + var init_handDrawnShapeStyles = __esm({ + "src/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.ts"() { + "use strict"; + init_diagramAPI(); + solidStateFill = /* @__PURE__ */ __name((color2) => { + const { handDrawnSeed } = getConfig2(); + return { + fill: color2, + hachureAngle: 120, + // angle of hachure, + hachureGap: 4, + fillWeight: 2, + roughness: 0.7, + stroke: color2, + seed: handDrawnSeed + }; + }, "solidStateFill"); + compileStyles = /* @__PURE__ */ __name((node2) => { + const stylesMap = styles2Map([ + ...node2.cssCompiledStyles || [], + ...node2.cssStyles || [], + ...node2.labelStyle || [] + ]); + return { stylesMap, stylesArray: [...stylesMap] }; + }, "compileStyles"); + styles2Map = /* @__PURE__ */ __name((styles6) => { + const styleMap2 = /* @__PURE__ */ new Map(); + styles6.forEach((style3) => { + const [key, value2] = style3.split(":"); + styleMap2.set(key.trim(), value2?.trim()); + }); + return styleMap2; + }, "styles2Map"); + isLabelStyle = /* @__PURE__ */ __name((key) => { + return key === "color" || key === "font-size" || key === "font-family" || key === "font-weight" || key === "font-style" || key === "text-decoration" || key === "text-align" || key === "text-transform" || key === "line-height" || key === "letter-spacing" || key === "word-spacing" || key === "text-shadow" || key === "text-overflow" || key === "white-space" || key === "word-wrap" || key === "word-break" || key === "overflow-wrap" || key === "hyphens"; + }, "isLabelStyle"); + styles2String = /* @__PURE__ */ __name((node2) => { + const { stylesArray } = compileStyles(node2); + const labelStyles = []; + const nodeStyles = []; + const borderStyles = []; + const backgroundStyles = []; + stylesArray.forEach((style3) => { + const key = style3[0]; + if (isLabelStyle(key)) { + labelStyles.push(style3.join(":") + " !important"); + } else { + nodeStyles.push(style3.join(":") + " !important"); + if (key.includes("stroke")) { + borderStyles.push(style3.join(":") + " !important"); + } + if (key === "fill") { + backgroundStyles.push(style3.join(":") + " !important"); + } + } + }); + return { + labelStyles: labelStyles.join(";"), + nodeStyles: nodeStyles.join(";"), + stylesArray, + borderStyles, + backgroundStyles + }; + }, "styles2String"); + userNodeOverrides = /* @__PURE__ */ __name((node2, options2) => { + const { themeVariables, handDrawnSeed } = getConfig2(); + const { nodeBorder, mainBkg } = themeVariables; + const { stylesMap } = compileStyles(node2); + const result = Object.assign( + { + roughness: 0.7, + fill: stylesMap.get("fill") || mainBkg, + fillStyle: "hachure", + // solid fill + fillWeight: 4, + hachureGap: 5.2, + stroke: stylesMap.get("stroke") || nodeBorder, + seed: handDrawnSeed, + strokeWidth: stylesMap.get("stroke-width")?.replace("px", "") || 1.3, + fillLineDash: [0, 0], + strokeLineDash: getStrokeDashArray(stylesMap.get("stroke-dasharray")) + }, + options2 + ); + return result; + }, "userNodeOverrides"); + getStrokeDashArray = /* @__PURE__ */ __name((strokeDasharrayStyle) => { + if (!strokeDasharrayStyle) { + return [0, 0]; + } + const dashArray = strokeDasharrayStyle.trim().split(/\s+/).map(Number); + if (dashArray.length === 1) { + const val = isNaN(dashArray[0]) ? 0 : dashArray[0]; + return [val, val]; + } + const first3 = isNaN(dashArray[0]) ? 0 : dashArray[0]; + const second2 = isNaN(dashArray[1]) ? 0 : dashArray[1]; + return [first3, second2]; + }, "getStrokeDashArray"); + } + }); + + // ../../node_modules/.pnpm/roughjs@4.6.6_patch_hash=3543d47108cb41b68ec6a671c0e1f9d0cfe2ce524fea5b0992511ae84c3c6b64/node_modules/roughjs/bundled/rough.esm.js + function t(t4, e3, s2) { + if (t4 && t4.length) { + const [n2, o2] = e3, a2 = Math.PI / 180 * s2, h3 = Math.cos(a2), r2 = Math.sin(a2); + for (const e4 of t4) { + const [t5, s3] = e4; + e4[0] = (t5 - n2) * h3 - (s3 - o2) * r2 + n2, e4[1] = (t5 - n2) * r2 + (s3 - o2) * h3 + o2; + } + } + } + function e(t4, e3) { + return t4[0] === e3[0] && t4[1] === e3[1]; + } + function s(s2, n2, o2, a2 = 1) { + const h3 = o2, r2 = Math.max(n2, 0.1), i2 = s2[0] && s2[0][0] && "number" == typeof s2[0][0] ? [s2] : s2, c3 = [0, 0]; + if (h3) for (const e3 of i2) t(e3, c3, h3); + const l4 = (function(t4, s3, n3) { + const o3 = []; + for (const s4 of t4) { + const t5 = [...s4]; + e(t5[0], t5[t5.length - 1]) || t5.push([t5[0][0], t5[0][1]]), t5.length > 2 && o3.push(t5); + } + const a3 = []; + s3 = Math.max(s3, 0.1); + const h4 = []; + for (const t5 of o3) for (let e3 = 0; e3 < t5.length - 1; e3++) { + const s4 = t5[e3], n4 = t5[e3 + 1]; + if (s4[1] !== n4[1]) { + const t6 = Math.min(s4[1], n4[1]); + h4.push({ ymin: t6, ymax: Math.max(s4[1], n4[1]), x: t6 === s4[1] ? s4[0] : n4[0], islope: (n4[0] - s4[0]) / (n4[1] - s4[1]) }); + } + } + if (h4.sort(((t5, e3) => t5.ymin < e3.ymin ? -1 : t5.ymin > e3.ymin ? 1 : t5.x < e3.x ? -1 : t5.x > e3.x ? 1 : t5.ymax === e3.ymax ? 0 : (t5.ymax - e3.ymax) / Math.abs(t5.ymax - e3.ymax))), !h4.length) return a3; + let r3 = [], i3 = h4[0].ymin, c4 = 0; + for (; r3.length || h4.length; ) { + if (h4.length) { + let t5 = -1; + for (let e3 = 0; e3 < h4.length && !(h4[e3].ymin > i3); e3++) t5 = e3; + h4.splice(0, t5 + 1).forEach(((t6) => { + r3.push({ s: i3, edge: t6 }); + })); + } + if (r3 = r3.filter(((t5) => !(t5.edge.ymax <= i3))), r3.sort(((t5, e3) => t5.edge.x === e3.edge.x ? 0 : (t5.edge.x - e3.edge.x) / Math.abs(t5.edge.x - e3.edge.x))), (1 !== n3 || c4 % s3 == 0) && r3.length > 1) for (let t5 = 0; t5 < r3.length; t5 += 2) { + const e3 = t5 + 1; + if (e3 >= r3.length) break; + const s4 = r3[t5].edge, n4 = r3[e3].edge; + a3.push([[Math.round(s4.x), i3], [Math.round(n4.x), i3]]); + } + i3 += n3, r3.forEach(((t5) => { + t5.edge.x = t5.edge.x + n3 * t5.edge.islope; + })), c4++; + } + return a3; + })(i2, r2, a2); + if (h3) { + for (const e3 of i2) t(e3, c3, -h3); + !(function(e3, s3, n3) { + const o3 = []; + e3.forEach(((t4) => o3.push(...t4))), t(o3, s3, n3); + })(l4, c3, -h3); + } + return l4; + } + function n(t4, e3) { + var n2; + const o2 = e3.hachureAngle + 90; + let a2 = e3.hachureGap; + a2 < 0 && (a2 = 4 * e3.strokeWidth), a2 = Math.round(Math.max(a2, 0.1)); + let h3 = 1; + return e3.roughness >= 1 && ((null === (n2 = e3.randomizer) || void 0 === n2 ? void 0 : n2.next()) || Math.random()) > 0.7 && (h3 = a2), s(t4, a2, o2, h3 || 1); + } + function a(t4) { + const e3 = t4[0], s2 = t4[1]; + return Math.sqrt(Math.pow(e3[0] - s2[0], 2) + Math.pow(e3[1] - s2[1], 2)); + } + function k(t4, e3) { + return t4.type === e3; + } + function b2(t4) { + const e3 = [], s2 = (function(t5) { + const e4 = new Array(); + for (; "" !== t5; ) if (t5.match(/^([ \t\r\n,]+)/)) t5 = t5.substr(RegExp.$1.length); + else if (t5.match(/^([aAcChHlLmMqQsStTvVzZ])/)) e4[e4.length] = { type: f, text: RegExp.$1 }, t5 = t5.substr(RegExp.$1.length); + else { + if (!t5.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return []; + e4[e4.length] = { type: d2, text: `${parseFloat(RegExp.$1)}` }, t5 = t5.substr(RegExp.$1.length); + } + return e4[e4.length] = { type: g, text: "" }, e4; + })(t4); + let n2 = "BOD", o2 = 0, a2 = s2[o2]; + for (; !k(a2, g); ) { + let h3 = 0; + const r2 = []; + if ("BOD" === n2) { + if ("M" !== a2.text && "m" !== a2.text) return b2("M0,0" + t4); + o2++, h3 = M2[a2.text], n2 = a2.text; + } else k(a2, d2) ? h3 = M2[n2] : (o2++, h3 = M2[a2.text], n2 = a2.text); + if (!(o2 + h3 < s2.length)) throw new Error("Path data ended short"); + for (let t5 = o2; t5 < o2 + h3; t5++) { + const e4 = s2[t5]; + if (!k(e4, d2)) throw new Error("Param not a number: " + n2 + "," + e4.text); + r2[r2.length] = +e4.text; + } + if ("number" != typeof M2[n2]) throw new Error("Bad segment: " + n2); + { + const t5 = { key: n2, data: r2 }; + e3.push(t5), o2 += h3, a2 = s2[o2], "M" === n2 && (n2 = "L"), "m" === n2 && (n2 = "l"); + } + } + return e3; + } + function y3(t4) { + let e3 = 0, s2 = 0, n2 = 0, o2 = 0; + const a2 = []; + for (const { key: h3, data: r2 } of t4) switch (h3) { + case "M": + a2.push({ key: "M", data: [...r2] }), [e3, s2] = r2, [n2, o2] = r2; + break; + case "m": + e3 += r2[0], s2 += r2[1], a2.push({ key: "M", data: [e3, s2] }), n2 = e3, o2 = s2; + break; + case "L": + a2.push({ key: "L", data: [...r2] }), [e3, s2] = r2; + break; + case "l": + e3 += r2[0], s2 += r2[1], a2.push({ key: "L", data: [e3, s2] }); + break; + case "C": + a2.push({ key: "C", data: [...r2] }), e3 = r2[4], s2 = r2[5]; + break; + case "c": { + const t5 = r2.map(((t6, n3) => n3 % 2 ? t6 + s2 : t6 + e3)); + a2.push({ key: "C", data: t5 }), e3 = t5[4], s2 = t5[5]; + break; + } + case "Q": + a2.push({ key: "Q", data: [...r2] }), e3 = r2[2], s2 = r2[3]; + break; + case "q": { + const t5 = r2.map(((t6, n3) => n3 % 2 ? t6 + s2 : t6 + e3)); + a2.push({ key: "Q", data: t5 }), e3 = t5[2], s2 = t5[3]; + break; + } + case "A": + a2.push({ key: "A", data: [...r2] }), e3 = r2[5], s2 = r2[6]; + break; + case "a": + e3 += r2[5], s2 += r2[6], a2.push({ key: "A", data: [r2[0], r2[1], r2[2], r2[3], r2[4], e3, s2] }); + break; + case "H": + a2.push({ key: "H", data: [...r2] }), e3 = r2[0]; + break; + case "h": + e3 += r2[0], a2.push({ key: "H", data: [e3] }); + break; + case "V": + a2.push({ key: "V", data: [...r2] }), s2 = r2[0]; + break; + case "v": + s2 += r2[0], a2.push({ key: "V", data: [s2] }); + break; + case "S": + a2.push({ key: "S", data: [...r2] }), e3 = r2[2], s2 = r2[3]; + break; + case "s": { + const t5 = r2.map(((t6, n3) => n3 % 2 ? t6 + s2 : t6 + e3)); + a2.push({ key: "S", data: t5 }), e3 = t5[2], s2 = t5[3]; + break; + } + case "T": + a2.push({ key: "T", data: [...r2] }), e3 = r2[0], s2 = r2[1]; + break; + case "t": + e3 += r2[0], s2 += r2[1], a2.push({ key: "T", data: [e3, s2] }); + break; + case "Z": + case "z": + a2.push({ key: "Z", data: [] }), e3 = n2, s2 = o2; + } + return a2; + } + function m2(t4) { + const e3 = []; + let s2 = "", n2 = 0, o2 = 0, a2 = 0, h3 = 0, r2 = 0, i2 = 0; + for (const { key: c3, data: l4 } of t4) { + switch (c3) { + case "M": + e3.push({ key: "M", data: [...l4] }), [n2, o2] = l4, [a2, h3] = l4; + break; + case "C": + e3.push({ key: "C", data: [...l4] }), n2 = l4[4], o2 = l4[5], r2 = l4[2], i2 = l4[3]; + break; + case "L": + e3.push({ key: "L", data: [...l4] }), [n2, o2] = l4; + break; + case "H": + n2 = l4[0], e3.push({ key: "L", data: [n2, o2] }); + break; + case "V": + o2 = l4[0], e3.push({ key: "L", data: [n2, o2] }); + break; + case "S": { + let t5 = 0, a3 = 0; + "C" === s2 || "S" === s2 ? (t5 = n2 + (n2 - r2), a3 = o2 + (o2 - i2)) : (t5 = n2, a3 = o2), e3.push({ key: "C", data: [t5, a3, ...l4] }), r2 = l4[0], i2 = l4[1], n2 = l4[2], o2 = l4[3]; + break; + } + case "T": { + const [t5, a3] = l4; + let h4 = 0, c4 = 0; + "Q" === s2 || "T" === s2 ? (h4 = n2 + (n2 - r2), c4 = o2 + (o2 - i2)) : (h4 = n2, c4 = o2); + const u2 = n2 + 2 * (h4 - n2) / 3, p3 = o2 + 2 * (c4 - o2) / 3, f2 = t5 + 2 * (h4 - t5) / 3, d3 = a3 + 2 * (c4 - a3) / 3; + e3.push({ key: "C", data: [u2, p3, f2, d3, t5, a3] }), r2 = h4, i2 = c4, n2 = t5, o2 = a3; + break; + } + case "Q": { + const [t5, s3, a3, h4] = l4, c4 = n2 + 2 * (t5 - n2) / 3, u2 = o2 + 2 * (s3 - o2) / 3, p3 = a3 + 2 * (t5 - a3) / 3, f2 = h4 + 2 * (s3 - h4) / 3; + e3.push({ key: "C", data: [c4, u2, p3, f2, a3, h4] }), r2 = t5, i2 = s3, n2 = a3, o2 = h4; + break; + } + case "A": { + const t5 = Math.abs(l4[0]), s3 = Math.abs(l4[1]), a3 = l4[2], h4 = l4[3], r3 = l4[4], i3 = l4[5], c4 = l4[6]; + if (0 === t5 || 0 === s3) e3.push({ key: "C", data: [n2, o2, i3, c4, i3, c4] }), n2 = i3, o2 = c4; + else if (n2 !== i3 || o2 !== c4) { + x2(n2, o2, i3, c4, t5, s3, a3, h4, r3).forEach((function(t6) { + e3.push({ key: "C", data: t6 }); + })), n2 = i3, o2 = c4; + } + break; + } + case "Z": + e3.push({ key: "Z", data: [] }), n2 = a2, o2 = h3; + } + s2 = c3; + } + return e3; + } + function w2(t4, e3, s2) { + return [t4 * Math.cos(s2) - e3 * Math.sin(s2), t4 * Math.sin(s2) + e3 * Math.cos(s2)]; + } + function x2(t4, e3, s2, n2, o2, a2, h3, r2, i2, c3) { + const l4 = (u2 = h3, Math.PI * u2 / 180); + var u2; + let p3 = [], f2 = 0, d3 = 0, g2 = 0, M3 = 0; + if (c3) [f2, d3, g2, M3] = c3; + else { + [t4, e3] = w2(t4, e3, -l4), [s2, n2] = w2(s2, n2, -l4); + const h4 = (t4 - s2) / 2, c4 = (e3 - n2) / 2; + let u3 = h4 * h4 / (o2 * o2) + c4 * c4 / (a2 * a2); + u3 > 1 && (u3 = Math.sqrt(u3), o2 *= u3, a2 *= u3); + const p4 = o2 * o2, k3 = a2 * a2, b4 = p4 * k3 - p4 * c4 * c4 - k3 * h4 * h4, y7 = p4 * c4 * c4 + k3 * h4 * h4, m4 = (r2 === i2 ? -1 : 1) * Math.sqrt(Math.abs(b4 / y7)); + g2 = m4 * o2 * c4 / a2 + (t4 + s2) / 2, M3 = m4 * -a2 * h4 / o2 + (e3 + n2) / 2, f2 = Math.asin(parseFloat(((e3 - M3) / a2).toFixed(9))), d3 = Math.asin(parseFloat(((n2 - M3) / a2).toFixed(9))), t4 < g2 && (f2 = Math.PI - f2), s2 < g2 && (d3 = Math.PI - d3), f2 < 0 && (f2 = 2 * Math.PI + f2), d3 < 0 && (d3 = 2 * Math.PI + d3), i2 && f2 > d3 && (f2 -= 2 * Math.PI), !i2 && d3 > f2 && (d3 -= 2 * Math.PI); + } + let k2 = d3 - f2; + if (Math.abs(k2) > 120 * Math.PI / 180) { + const t5 = d3, e4 = s2, r3 = n2; + d3 = i2 && d3 > f2 ? f2 + 120 * Math.PI / 180 * 1 : f2 + 120 * Math.PI / 180 * -1, p3 = x2(s2 = g2 + o2 * Math.cos(d3), n2 = M3 + a2 * Math.sin(d3), e4, r3, o2, a2, h3, 0, i2, [d3, t5, g2, M3]); + } + k2 = d3 - f2; + const b3 = Math.cos(f2), y6 = Math.sin(f2), m3 = Math.cos(d3), P3 = Math.sin(d3), v3 = Math.tan(k2 / 4), S4 = 4 / 3 * o2 * v3, O3 = 4 / 3 * a2 * v3, L3 = [t4, e3], T3 = [t4 + S4 * y6, e3 - O3 * b3], D4 = [s2 + S4 * P3, n2 - O3 * m3], A2 = [s2, n2]; + if (T3[0] = 2 * L3[0] - T3[0], T3[1] = 2 * L3[1] - T3[1], c3) return [T3, D4, A2].concat(p3); + { + p3 = [T3, D4, A2].concat(p3); + const t5 = []; + for (let e4 = 0; e4 < p3.length; e4 += 3) { + const s3 = w2(p3[e4][0], p3[e4][1], l4), n3 = w2(p3[e4 + 1][0], p3[e4 + 1][1], l4), o3 = w2(p3[e4 + 2][0], p3[e4 + 2][1], l4); + t5.push([s3[0], s3[1], n3[0], n3[1], o3[0], o3[1]]); + } + return t5; + } + } + function v2(t4, e3, s2, n2, o2) { + return { type: "path", ops: $2(t4, e3, s2, n2, o2) }; + } + function S3(t4, e3, s2) { + const n2 = (t4 || []).length; + if (n2 > 2) { + const o2 = []; + for (let e4 = 0; e4 < n2 - 1; e4++) o2.push(...$2(t4[e4][0], t4[e4][1], t4[e4 + 1][0], t4[e4 + 1][1], s2)); + return e3 && o2.push(...$2(t4[n2 - 1][0], t4[n2 - 1][1], t4[0][0], t4[0][1], s2)), { type: "path", ops: o2 }; + } + return 2 === n2 ? v2(t4[0][0], t4[0][1], t4[1][0], t4[1][1], s2) : { type: "path", ops: [] }; + } + function O2(t4, e3, s2, n2, o2) { + return (function(t5, e4) { + return S3(t5, true, e4); + })([[t4, e3], [t4 + s2, e3], [t4 + s2, e3 + n2], [t4, e3 + n2]], o2); + } + function L2(t4, e3) { + if (t4.length) { + const s2 = "number" == typeof t4[0][0] ? [t4] : t4, n2 = j2(s2[0], 1 * (1 + 0.2 * e3.roughness), e3), o2 = e3.disableMultiStroke ? [] : j2(s2[0], 1.5 * (1 + 0.22 * e3.roughness), z2(e3)); + for (let t5 = 1; t5 < s2.length; t5++) { + const a2 = s2[t5]; + if (a2.length) { + const t6 = j2(a2, 1 * (1 + 0.2 * e3.roughness), e3), s3 = e3.disableMultiStroke ? [] : j2(a2, 1.5 * (1 + 0.22 * e3.roughness), z2(e3)); + for (const e4 of t6) "move" !== e4.op && n2.push(e4); + for (const t7 of s3) "move" !== t7.op && o2.push(t7); + } + } + return { type: "path", ops: n2.concat(o2) }; + } + return { type: "path", ops: [] }; + } + function T2(t4, e3, s2) { + const n2 = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t4 / 2, 2) + Math.pow(e3 / 2, 2)) / 2)), o2 = Math.ceil(Math.max(s2.curveStepCount, s2.curveStepCount / Math.sqrt(200) * n2)), a2 = 2 * Math.PI / o2; + let h3 = Math.abs(t4 / 2), r2 = Math.abs(e3 / 2); + const i2 = 1 - s2.curveFitting; + return h3 += G2(h3 * i2, s2), r2 += G2(r2 * i2, s2), { increment: a2, rx: h3, ry: r2 }; + } + function D3(t4, e3, s2, n2) { + const [o2, a2] = F2(n2.increment, t4, e3, n2.rx, n2.ry, 1, n2.increment * E2(0.1, E2(0.4, 1, s2), s2), s2); + let h3 = q2(o2, null, s2); + if (!s2.disableMultiStroke && 0 !== s2.roughness) { + const [o3] = F2(n2.increment, t4, e3, n2.rx, n2.ry, 1.5, 0, s2), a3 = q2(o3, null, s2); + h3 = h3.concat(a3); + } + return { estimatedPoints: a2, opset: { type: "path", ops: h3 } }; + } + function A(t4, e3, s2, n2, o2, a2, h3, r2, i2) { + const c3 = t4, l4 = e3; + let u2 = Math.abs(s2 / 2), p3 = Math.abs(n2 / 2); + u2 += G2(0.01 * u2, i2), p3 += G2(0.01 * p3, i2); + let f2 = o2, d3 = a2; + for (; f2 < 0; ) f2 += 2 * Math.PI, d3 += 2 * Math.PI; + d3 - f2 > 2 * Math.PI && (f2 = 0, d3 = 2 * Math.PI); + const g2 = 2 * Math.PI / i2.curveStepCount, M3 = Math.min(g2 / 2, (d3 - f2) / 2), k2 = V2(M3, c3, l4, u2, p3, f2, d3, 1, i2); + if (!i2.disableMultiStroke) { + const t5 = V2(M3, c3, l4, u2, p3, f2, d3, 1.5, i2); + k2.push(...t5); + } + return h3 && (r2 ? k2.push(...$2(c3, l4, c3 + u2 * Math.cos(f2), l4 + p3 * Math.sin(f2), i2), ...$2(c3, l4, c3 + u2 * Math.cos(d3), l4 + p3 * Math.sin(d3), i2)) : k2.push({ op: "lineTo", data: [c3, l4] }, { op: "lineTo", data: [c3 + u2 * Math.cos(f2), l4 + p3 * Math.sin(f2)] })), { type: "path", ops: k2 }; + } + function _2(t4, e3) { + const s2 = m2(y3(b2(t4))), n2 = []; + let o2 = [0, 0], a2 = [0, 0]; + for (const { key: t5, data: h3 } of s2) switch (t5) { + case "M": + a2 = [h3[0], h3[1]], o2 = [h3[0], h3[1]]; + break; + case "L": + n2.push(...$2(a2[0], a2[1], h3[0], h3[1], e3)), a2 = [h3[0], h3[1]]; + break; + case "C": { + const [t6, s3, o3, r2, i2, c3] = h3; + n2.push(...Z(t6, s3, o3, r2, i2, c3, a2, e3)), a2 = [i2, c3]; + break; + } + case "Z": + n2.push(...$2(a2[0], a2[1], o2[0], o2[1], e3)), a2 = [o2[0], o2[1]]; + } + return { type: "path", ops: n2 }; + } + function I2(t4, e3) { + const s2 = []; + for (const n2 of t4) if (n2.length) { + const t5 = e3.maxRandomnessOffset || 0, o2 = n2.length; + if (o2 > 2) { + s2.push({ op: "move", data: [n2[0][0] + G2(t5, e3), n2[0][1] + G2(t5, e3)] }); + for (let a2 = 1; a2 < o2; a2++) s2.push({ op: "lineTo", data: [n2[a2][0] + G2(t5, e3), n2[a2][1] + G2(t5, e3)] }); + } + } + return { type: "fillPath", ops: s2 }; + } + function C2(t4, e3) { + return (function(t5, e4) { + let s2 = t5.fillStyle || "hachure"; + if (!u[s2]) switch (s2) { + case "zigzag": + u[s2] || (u[s2] = new h2(e4)); + break; + case "cross-hatch": + u[s2] || (u[s2] = new r(e4)); + break; + case "dots": + u[s2] || (u[s2] = new i(e4)); + break; + case "dashed": + u[s2] || (u[s2] = new c2(e4)); + break; + case "zigzag-line": + u[s2] || (u[s2] = new l3(e4)); + break; + default: + s2 = "hachure", u[s2] || (u[s2] = new o(e4)); + } + return u[s2]; + })(e3, P2).fillPolygons(t4, e3); + } + function z2(t4) { + const e3 = Object.assign({}, t4); + return e3.randomizer = void 0, t4.seed && (e3.seed = t4.seed + 1), e3; + } + function W2(t4) { + return t4.randomizer || (t4.randomizer = new p(t4.seed || 0)), t4.randomizer.next(); + } + function E2(t4, e3, s2, n2 = 1) { + return s2.roughness * n2 * (W2(s2) * (e3 - t4) + t4); + } + function G2(t4, e3, s2 = 1) { + return E2(-t4, t4, e3, s2); + } + function $2(t4, e3, s2, n2, o2, a2 = false) { + const h3 = a2 ? o2.disableMultiStrokeFill : o2.disableMultiStroke, r2 = R2(t4, e3, s2, n2, o2, true, false); + if (h3) return r2; + const i2 = R2(t4, e3, s2, n2, o2, true, true); + return r2.concat(i2); + } + function R2(t4, e3, s2, n2, o2, a2, h3) { + const r2 = Math.pow(t4 - s2, 2) + Math.pow(e3 - n2, 2), i2 = Math.sqrt(r2); + let c3 = 1; + c3 = i2 < 200 ? 1 : i2 > 500 ? 0.4 : -16668e-7 * i2 + 1.233334; + let l4 = o2.maxRandomnessOffset || 0; + l4 * l4 * 100 > r2 && (l4 = i2 / 10); + const u2 = l4 / 2, p3 = 0.2 + 0.2 * W2(o2); + let f2 = o2.bowing * o2.maxRandomnessOffset * (n2 - e3) / 200, d3 = o2.bowing * o2.maxRandomnessOffset * (t4 - s2) / 200; + f2 = G2(f2, o2, c3), d3 = G2(d3, o2, c3); + const g2 = [], M3 = /* @__PURE__ */ __name(() => G2(u2, o2, c3), "M"), k2 = /* @__PURE__ */ __name(() => G2(l4, o2, c3), "k"), b3 = o2.preserveVertices; + return a2 && (h3 ? g2.push({ op: "move", data: [t4 + (b3 ? 0 : M3()), e3 + (b3 ? 0 : M3())] }) : g2.push({ op: "move", data: [t4 + (b3 ? 0 : G2(l4, o2, c3)), e3 + (b3 ? 0 : G2(l4, o2, c3))] })), h3 ? g2.push({ op: "bcurveTo", data: [f2 + t4 + (s2 - t4) * p3 + M3(), d3 + e3 + (n2 - e3) * p3 + M3(), f2 + t4 + 2 * (s2 - t4) * p3 + M3(), d3 + e3 + 2 * (n2 - e3) * p3 + M3(), s2 + (b3 ? 0 : M3()), n2 + (b3 ? 0 : M3())] }) : g2.push({ op: "bcurveTo", data: [f2 + t4 + (s2 - t4) * p3 + k2(), d3 + e3 + (n2 - e3) * p3 + k2(), f2 + t4 + 2 * (s2 - t4) * p3 + k2(), d3 + e3 + 2 * (n2 - e3) * p3 + k2(), s2 + (b3 ? 0 : k2()), n2 + (b3 ? 0 : k2())] }), g2; + } + function j2(t4, e3, s2) { + if (!t4.length) return []; + const n2 = []; + n2.push([t4[0][0] + G2(e3, s2), t4[0][1] + G2(e3, s2)]), n2.push([t4[0][0] + G2(e3, s2), t4[0][1] + G2(e3, s2)]); + for (let o2 = 1; o2 < t4.length; o2++) n2.push([t4[o2][0] + G2(e3, s2), t4[o2][1] + G2(e3, s2)]), o2 === t4.length - 1 && n2.push([t4[o2][0] + G2(e3, s2), t4[o2][1] + G2(e3, s2)]); + return q2(n2, null, s2); + } + function q2(t4, e3, s2) { + const n2 = t4.length, o2 = []; + if (n2 > 3) { + const a2 = [], h3 = 1 - s2.curveTightness; + o2.push({ op: "move", data: [t4[1][0], t4[1][1]] }); + for (let e4 = 1; e4 + 2 < n2; e4++) { + const s3 = t4[e4]; + a2[0] = [s3[0], s3[1]], a2[1] = [s3[0] + (h3 * t4[e4 + 1][0] - h3 * t4[e4 - 1][0]) / 6, s3[1] + (h3 * t4[e4 + 1][1] - h3 * t4[e4 - 1][1]) / 6], a2[2] = [t4[e4 + 1][0] + (h3 * t4[e4][0] - h3 * t4[e4 + 2][0]) / 6, t4[e4 + 1][1] + (h3 * t4[e4][1] - h3 * t4[e4 + 2][1]) / 6], a2[3] = [t4[e4 + 1][0], t4[e4 + 1][1]], o2.push({ op: "bcurveTo", data: [a2[1][0], a2[1][1], a2[2][0], a2[2][1], a2[3][0], a2[3][1]] }); + } + if (e3 && 2 === e3.length) { + const t5 = s2.maxRandomnessOffset; + o2.push({ op: "lineTo", data: [e3[0] + G2(t5, s2), e3[1] + G2(t5, s2)] }); + } + } else 3 === n2 ? (o2.push({ op: "move", data: [t4[1][0], t4[1][1]] }), o2.push({ op: "bcurveTo", data: [t4[1][0], t4[1][1], t4[2][0], t4[2][1], t4[2][0], t4[2][1]] })) : 2 === n2 && o2.push(...R2(t4[0][0], t4[0][1], t4[1][0], t4[1][1], s2, true, true)); + return o2; + } + function F2(t4, e3, s2, n2, o2, a2, h3, r2) { + const i2 = [], c3 = []; + if (0 === r2.roughness) { + t4 /= 4, c3.push([e3 + n2 * Math.cos(-t4), s2 + o2 * Math.sin(-t4)]); + for (let a3 = 0; a3 <= 2 * Math.PI; a3 += t4) { + const t5 = [e3 + n2 * Math.cos(a3), s2 + o2 * Math.sin(a3)]; + i2.push(t5), c3.push(t5); + } + c3.push([e3 + n2 * Math.cos(0), s2 + o2 * Math.sin(0)]), c3.push([e3 + n2 * Math.cos(t4), s2 + o2 * Math.sin(t4)]); + } else { + const l4 = G2(0.5, r2) - Math.PI / 2; + c3.push([G2(a2, r2) + e3 + 0.9 * n2 * Math.cos(l4 - t4), G2(a2, r2) + s2 + 0.9 * o2 * Math.sin(l4 - t4)]); + const u2 = 2 * Math.PI + l4 - 0.01; + for (let h4 = l4; h4 < u2; h4 += t4) { + const t5 = [G2(a2, r2) + e3 + n2 * Math.cos(h4), G2(a2, r2) + s2 + o2 * Math.sin(h4)]; + i2.push(t5), c3.push(t5); + } + c3.push([G2(a2, r2) + e3 + n2 * Math.cos(l4 + 2 * Math.PI + 0.5 * h3), G2(a2, r2) + s2 + o2 * Math.sin(l4 + 2 * Math.PI + 0.5 * h3)]), c3.push([G2(a2, r2) + e3 + 0.98 * n2 * Math.cos(l4 + h3), G2(a2, r2) + s2 + 0.98 * o2 * Math.sin(l4 + h3)]), c3.push([G2(a2, r2) + e3 + 0.9 * n2 * Math.cos(l4 + 0.5 * h3), G2(a2, r2) + s2 + 0.9 * o2 * Math.sin(l4 + 0.5 * h3)]); + } + return [c3, i2]; + } + function V2(t4, e3, s2, n2, o2, a2, h3, r2, i2) { + const c3 = a2 + G2(0.1, i2), l4 = []; + l4.push([G2(r2, i2) + e3 + 0.9 * n2 * Math.cos(c3 - t4), G2(r2, i2) + s2 + 0.9 * o2 * Math.sin(c3 - t4)]); + for (let a3 = c3; a3 <= h3; a3 += t4) l4.push([G2(r2, i2) + e3 + n2 * Math.cos(a3), G2(r2, i2) + s2 + o2 * Math.sin(a3)]); + return l4.push([e3 + n2 * Math.cos(h3), s2 + o2 * Math.sin(h3)]), l4.push([e3 + n2 * Math.cos(h3), s2 + o2 * Math.sin(h3)]), q2(l4, null, i2); + } + function Z(t4, e3, s2, n2, o2, a2, h3, r2) { + const i2 = [], c3 = [r2.maxRandomnessOffset || 1, (r2.maxRandomnessOffset || 1) + 0.3]; + let l4 = [0, 0]; + const u2 = r2.disableMultiStroke ? 1 : 2, p3 = r2.preserveVertices; + for (let f2 = 0; f2 < u2; f2++) 0 === f2 ? i2.push({ op: "move", data: [h3[0], h3[1]] }) : i2.push({ op: "move", data: [h3[0] + (p3 ? 0 : G2(c3[0], r2)), h3[1] + (p3 ? 0 : G2(c3[0], r2))] }), l4 = p3 ? [o2, a2] : [o2 + G2(c3[f2], r2), a2 + G2(c3[f2], r2)], i2.push({ op: "bcurveTo", data: [t4 + G2(c3[f2], r2), e3 + G2(c3[f2], r2), s2 + G2(c3[f2], r2), n2 + G2(c3[f2], r2), l4[0], l4[1]] }); + return i2; + } + function Q2(t4) { + return [...t4]; + } + function H(t4, e3 = 0) { + const s2 = t4.length; + if (s2 < 3) throw new Error("A curve must have at least three points."); + const n2 = []; + if (3 === s2) n2.push(Q2(t4[0]), Q2(t4[1]), Q2(t4[2]), Q2(t4[2])); + else { + const s3 = []; + s3.push(t4[0], t4[0]); + for (let e4 = 1; e4 < t4.length; e4++) s3.push(t4[e4]), e4 === t4.length - 1 && s3.push(t4[e4]); + const o2 = [], a2 = 1 - e3; + n2.push(Q2(s3[0])); + for (let t5 = 1; t5 + 2 < s3.length; t5++) { + const e4 = s3[t5]; + o2[0] = [e4[0], e4[1]], o2[1] = [e4[0] + (a2 * s3[t5 + 1][0] - a2 * s3[t5 - 1][0]) / 6, e4[1] + (a2 * s3[t5 + 1][1] - a2 * s3[t5 - 1][1]) / 6], o2[2] = [s3[t5 + 1][0] + (a2 * s3[t5][0] - a2 * s3[t5 + 2][0]) / 6, s3[t5 + 1][1] + (a2 * s3[t5][1] - a2 * s3[t5 + 2][1]) / 6], o2[3] = [s3[t5 + 1][0], s3[t5 + 1][1]], n2.push(o2[1], o2[2], o2[3]); + } + } + return n2; + } + function N2(t4, e3) { + return Math.pow(t4[0] - e3[0], 2) + Math.pow(t4[1] - e3[1], 2); + } + function B2(t4, e3, s2) { + const n2 = N2(e3, s2); + if (0 === n2) return N2(t4, e3); + let o2 = ((t4[0] - e3[0]) * (s2[0] - e3[0]) + (t4[1] - e3[1]) * (s2[1] - e3[1])) / n2; + return o2 = Math.max(0, Math.min(1, o2)), N2(t4, J2(e3, s2, o2)); + } + function J2(t4, e3, s2) { + return [t4[0] + (e3[0] - t4[0]) * s2, t4[1] + (e3[1] - t4[1]) * s2]; + } + function K3(t4, e3, s2, n2) { + const o2 = n2 || []; + if ((function(t5, e4) { + const s3 = t5[e4 + 0], n3 = t5[e4 + 1], o3 = t5[e4 + 2], a3 = t5[e4 + 3]; + let h4 = 3 * n3[0] - 2 * s3[0] - a3[0]; + h4 *= h4; + let r2 = 3 * n3[1] - 2 * s3[1] - a3[1]; + r2 *= r2; + let i2 = 3 * o3[0] - 2 * a3[0] - s3[0]; + i2 *= i2; + let c3 = 3 * o3[1] - 2 * a3[1] - s3[1]; + return c3 *= c3, h4 < i2 && (h4 = i2), r2 < c3 && (r2 = c3), h4 + r2; + })(t4, e3) < s2) { + const s3 = t4[e3 + 0]; + if (o2.length) { + (a2 = o2[o2.length - 1], h3 = s3, Math.sqrt(N2(a2, h3))) > 1 && o2.push(s3); + } else o2.push(s3); + o2.push(t4[e3 + 3]); + } else { + const n3 = 0.5, a3 = t4[e3 + 0], h4 = t4[e3 + 1], r2 = t4[e3 + 2], i2 = t4[e3 + 3], c3 = J2(a3, h4, n3), l4 = J2(h4, r2, n3), u2 = J2(r2, i2, n3), p3 = J2(c3, l4, n3), f2 = J2(l4, u2, n3), d3 = J2(p3, f2, n3); + K3([a3, c3, p3, d3], 0, s2, o2), K3([d3, f2, u2, i2], 0, s2, o2); + } + var a2, h3; + return o2; + } + function U2(t4, e3) { + return X3(t4, 0, t4.length, e3); + } + function X3(t4, e3, s2, n2, o2) { + const a2 = o2 || [], h3 = t4[e3], r2 = t4[s2 - 1]; + let i2 = 0, c3 = 1; + for (let n3 = e3 + 1; n3 < s2 - 1; ++n3) { + const e4 = B2(t4[n3], h3, r2); + e4 > i2 && (i2 = e4, c3 = n3); + } + return Math.sqrt(i2) > n2 ? (X3(t4, e3, c3 + 1, n2, a2), X3(t4, c3, s2, n2, a2)) : (a2.length || a2.push(h3), a2.push(r2)), a2; + } + function Y2(t4, e3 = 0.15, s2) { + const n2 = [], o2 = (t4.length - 1) / 3; + for (let s3 = 0; s3 < o2; s3++) { + K3(t4, 3 * s3, e3, n2); + } + return s2 && s2 > 0 ? X3(n2, 0, n2.length, s2) : n2; + } + var o, h2, r, i, c2, l3, u, p, f, d2, g, M2, P2, tt, et, st, nt, ot, at; + var init_rough_esm = __esm({ + "../../node_modules/.pnpm/roughjs@4.6.6_patch_hash=3543d47108cb41b68ec6a671c0e1f9d0cfe2ce524fea5b0992511ae84c3c6b64/node_modules/roughjs/bundled/rough.esm.js"() { + "use strict"; + __name(t, "t"); + __name(e, "e"); + __name(s, "s"); + __name(n, "n"); + o = class { + static { + __name(this, "o"); + } + constructor(t4) { + this.helper = t4; + } + fillPolygons(t4, e3) { + return this._fillPolygons(t4, e3); + } + _fillPolygons(t4, e3) { + const s2 = n(t4, e3); + return { type: "fillSketch", ops: this.renderLines(s2, e3) }; + } + renderLines(t4, e3) { + const s2 = []; + for (const n2 of t4) s2.push(...this.helper.doubleLineOps(n2[0][0], n2[0][1], n2[1][0], n2[1][1], e3)); + return s2; + } + }; + __name(a, "a"); + h2 = class extends o { + static { + __name(this, "h"); + } + fillPolygons(t4, e3) { + let s2 = e3.hachureGap; + s2 < 0 && (s2 = 4 * e3.strokeWidth), s2 = Math.max(s2, 0.1); + const o2 = n(t4, Object.assign({}, e3, { hachureGap: s2 })), h3 = Math.PI / 180 * e3.hachureAngle, r2 = [], i2 = 0.5 * s2 * Math.cos(h3), c3 = 0.5 * s2 * Math.sin(h3); + for (const [t5, e4] of o2) a([t5, e4]) && r2.push([[t5[0] - i2, t5[1] + c3], [...e4]], [[t5[0] + i2, t5[1] - c3], [...e4]]); + return { type: "fillSketch", ops: this.renderLines(r2, e3) }; + } + }; + r = class extends o { + static { + __name(this, "r"); + } + fillPolygons(t4, e3) { + const s2 = this._fillPolygons(t4, e3), n2 = Object.assign({}, e3, { hachureAngle: e3.hachureAngle + 90 }), o2 = this._fillPolygons(t4, n2); + return s2.ops = s2.ops.concat(o2.ops), s2; + } + }; + i = class { + static { + __name(this, "i"); + } + constructor(t4) { + this.helper = t4; + } + fillPolygons(t4, e3) { + const s2 = n(t4, e3 = Object.assign({}, e3, { hachureAngle: 0 })); + return this.dotsOnLines(s2, e3); + } + dotsOnLines(t4, e3) { + const s2 = []; + let n2 = e3.hachureGap; + n2 < 0 && (n2 = 4 * e3.strokeWidth), n2 = Math.max(n2, 0.1); + let o2 = e3.fillWeight; + o2 < 0 && (o2 = e3.strokeWidth / 2); + const h3 = n2 / 4; + for (const r2 of t4) { + const t5 = a(r2), i2 = t5 / n2, c3 = Math.ceil(i2) - 1, l4 = t5 - c3 * n2, u2 = (r2[0][0] + r2[1][0]) / 2 - n2 / 4, p3 = Math.min(r2[0][1], r2[1][1]); + for (let t6 = 0; t6 < c3; t6++) { + const a2 = p3 + l4 + t6 * n2, r3 = u2 - h3 + 2 * Math.random() * h3, i3 = a2 - h3 + 2 * Math.random() * h3, c4 = this.helper.ellipse(r3, i3, o2, o2, e3); + s2.push(...c4.ops); + } + } + return { type: "fillSketch", ops: s2 }; + } + }; + c2 = class { + static { + __name(this, "c"); + } + constructor(t4) { + this.helper = t4; + } + fillPolygons(t4, e3) { + const s2 = n(t4, e3); + return { type: "fillSketch", ops: this.dashedLine(s2, e3) }; + } + dashedLine(t4, e3) { + const s2 = e3.dashOffset < 0 ? e3.hachureGap < 0 ? 4 * e3.strokeWidth : e3.hachureGap : e3.dashOffset, n2 = e3.dashGap < 0 ? e3.hachureGap < 0 ? 4 * e3.strokeWidth : e3.hachureGap : e3.dashGap, o2 = []; + return t4.forEach(((t5) => { + const h3 = a(t5), r2 = Math.floor(h3 / (s2 + n2)), i2 = (h3 + n2 - r2 * (s2 + n2)) / 2; + let c3 = t5[0], l4 = t5[1]; + c3[0] > l4[0] && (c3 = t5[1], l4 = t5[0]); + const u2 = Math.atan((l4[1] - c3[1]) / (l4[0] - c3[0])); + for (let t6 = 0; t6 < r2; t6++) { + const a2 = t6 * (s2 + n2), h4 = a2 + s2, r3 = [c3[0] + a2 * Math.cos(u2) + i2 * Math.cos(u2), c3[1] + a2 * Math.sin(u2) + i2 * Math.sin(u2)], l5 = [c3[0] + h4 * Math.cos(u2) + i2 * Math.cos(u2), c3[1] + h4 * Math.sin(u2) + i2 * Math.sin(u2)]; + o2.push(...this.helper.doubleLineOps(r3[0], r3[1], l5[0], l5[1], e3)); + } + })), o2; + } + }; + l3 = class { + static { + __name(this, "l"); + } + constructor(t4) { + this.helper = t4; + } + fillPolygons(t4, e3) { + const s2 = e3.hachureGap < 0 ? 4 * e3.strokeWidth : e3.hachureGap, o2 = e3.zigzagOffset < 0 ? s2 : e3.zigzagOffset, a2 = n(t4, e3 = Object.assign({}, e3, { hachureGap: s2 + o2 })); + return { type: "fillSketch", ops: this.zigzagLines(a2, o2, e3) }; + } + zigzagLines(t4, e3, s2) { + const n2 = []; + return t4.forEach(((t5) => { + const o2 = a(t5), h3 = Math.round(o2 / (2 * e3)); + let r2 = t5[0], i2 = t5[1]; + r2[0] > i2[0] && (r2 = t5[1], i2 = t5[0]); + const c3 = Math.atan((i2[1] - r2[1]) / (i2[0] - r2[0])); + for (let t6 = 0; t6 < h3; t6++) { + const o3 = 2 * t6 * e3, a2 = 2 * (t6 + 1) * e3, h4 = Math.sqrt(2 * Math.pow(e3, 2)), i3 = [r2[0] + o3 * Math.cos(c3), r2[1] + o3 * Math.sin(c3)], l4 = [r2[0] + a2 * Math.cos(c3), r2[1] + a2 * Math.sin(c3)], u2 = [i3[0] + h4 * Math.cos(c3 + Math.PI / 4), i3[1] + h4 * Math.sin(c3 + Math.PI / 4)]; + n2.push(...this.helper.doubleLineOps(i3[0], i3[1], u2[0], u2[1], s2), ...this.helper.doubleLineOps(u2[0], u2[1], l4[0], l4[1], s2)); + } + })), n2; + } + }; + u = {}; + p = class { + static { + __name(this, "p"); + } + constructor(t4) { + this.seed = t4; + } + next() { + return this.seed ? (2 ** 31 - 1 & (this.seed = Math.imul(48271, this.seed))) / 2 ** 31 : Math.random(); + } + }; + f = 0; + d2 = 1; + g = 2; + M2 = { A: 7, a: 7, C: 6, c: 6, H: 1, h: 1, L: 2, l: 2, M: 2, m: 2, Q: 4, q: 4, S: 4, s: 4, T: 2, t: 2, V: 1, v: 1, Z: 0, z: 0 }; + __name(k, "k"); + __name(b2, "b"); + __name(y3, "y"); + __name(m2, "m"); + __name(w2, "w"); + __name(x2, "x"); + P2 = { randOffset: /* @__PURE__ */ __name(function(t4, e3) { + return G2(t4, e3); + }, "randOffset"), randOffsetWithRange: /* @__PURE__ */ __name(function(t4, e3, s2) { + return E2(t4, e3, s2); + }, "randOffsetWithRange"), ellipse: /* @__PURE__ */ __name(function(t4, e3, s2, n2, o2) { + const a2 = T2(s2, n2, o2); + return D3(t4, e3, o2, a2).opset; + }, "ellipse"), doubleLineOps: /* @__PURE__ */ __name(function(t4, e3, s2, n2, o2) { + return $2(t4, e3, s2, n2, o2, true); + }, "doubleLineOps") }; + __name(v2, "v"); + __name(S3, "S"); + __name(O2, "O"); + __name(L2, "L"); + __name(T2, "T"); + __name(D3, "D"); + __name(A, "A"); + __name(_2, "_"); + __name(I2, "I"); + __name(C2, "C"); + __name(z2, "z"); + __name(W2, "W"); + __name(E2, "E"); + __name(G2, "G"); + __name($2, "$"); + __name(R2, "R"); + __name(j2, "j"); + __name(q2, "q"); + __name(F2, "F"); + __name(V2, "V"); + __name(Z, "Z"); + __name(Q2, "Q"); + __name(H, "H"); + __name(N2, "N"); + __name(B2, "B"); + __name(J2, "J"); + __name(K3, "K"); + __name(U2, "U"); + __name(X3, "X"); + __name(Y2, "Y"); + tt = "none"; + et = class { + static { + __name(this, "et"); + } + constructor(t4) { + this.defaultOptions = { maxRandomnessOffset: 2, roughness: 1, bowing: 1, stroke: "#000", strokeWidth: 1, curveTightness: 0, curveFitting: 0.95, curveStepCount: 9, fillStyle: "hachure", fillWeight: -1, hachureAngle: -41, hachureGap: -1, dashOffset: -1, dashGap: -1, zigzagOffset: -1, seed: 0, disableMultiStroke: false, disableMultiStrokeFill: false, preserveVertices: false, fillShapeRoughnessGain: 0.8 }, this.config = t4 || {}, this.config.options && (this.defaultOptions = this._o(this.config.options)); + } + static newSeed() { + return Math.floor(Math.random() * 2 ** 31); + } + _o(t4) { + return t4 ? Object.assign({}, this.defaultOptions, t4) : this.defaultOptions; + } + _d(t4, e3, s2) { + return { shape: t4, sets: e3 || [], options: s2 || this.defaultOptions }; + } + line(t4, e3, s2, n2, o2) { + const a2 = this._o(o2); + return this._d("line", [v2(t4, e3, s2, n2, a2)], a2); + } + rectangle(t4, e3, s2, n2, o2) { + const a2 = this._o(o2), h3 = [], r2 = O2(t4, e3, s2, n2, a2); + if (a2.fill) { + const o3 = [[t4, e3], [t4 + s2, e3], [t4 + s2, e3 + n2], [t4, e3 + n2]]; + "solid" === a2.fillStyle ? h3.push(I2([o3], a2)) : h3.push(C2([o3], a2)); + } + return a2.stroke !== tt && h3.push(r2), this._d("rectangle", h3, a2); + } + ellipse(t4, e3, s2, n2, o2) { + const a2 = this._o(o2), h3 = [], r2 = T2(s2, n2, a2), i2 = D3(t4, e3, a2, r2); + if (a2.fill) if ("solid" === a2.fillStyle) { + const s3 = D3(t4, e3, a2, r2).opset; + s3.type = "fillPath", h3.push(s3); + } else h3.push(C2([i2.estimatedPoints], a2)); + return a2.stroke !== tt && h3.push(i2.opset), this._d("ellipse", h3, a2); + } + circle(t4, e3, s2, n2) { + const o2 = this.ellipse(t4, e3, s2, s2, n2); + return o2.shape = "circle", o2; + } + linearPath(t4, e3) { + const s2 = this._o(e3); + return this._d("linearPath", [S3(t4, false, s2)], s2); + } + arc(t4, e3, s2, n2, o2, a2, h3 = false, r2) { + const i2 = this._o(r2), c3 = [], l4 = A(t4, e3, s2, n2, o2, a2, h3, true, i2); + if (h3 && i2.fill) if ("solid" === i2.fillStyle) { + const h4 = Object.assign({}, i2); + h4.disableMultiStroke = true; + const r3 = A(t4, e3, s2, n2, o2, a2, true, false, h4); + r3.type = "fillPath", c3.push(r3); + } else c3.push((function(t5, e4, s3, n3, o3, a3, h4) { + const r3 = t5, i3 = e4; + let c4 = Math.abs(s3 / 2), l5 = Math.abs(n3 / 2); + c4 += G2(0.01 * c4, h4), l5 += G2(0.01 * l5, h4); + let u2 = o3, p3 = a3; + for (; u2 < 0; ) u2 += 2 * Math.PI, p3 += 2 * Math.PI; + p3 - u2 > 2 * Math.PI && (u2 = 0, p3 = 2 * Math.PI); + const f2 = (p3 - u2) / h4.curveStepCount, d3 = []; + for (let t6 = u2; t6 <= p3; t6 += f2) d3.push([r3 + c4 * Math.cos(t6), i3 + l5 * Math.sin(t6)]); + return d3.push([r3 + c4 * Math.cos(p3), i3 + l5 * Math.sin(p3)]), d3.push([r3, i3]), C2([d3], h4); + })(t4, e3, s2, n2, o2, a2, i2)); + return i2.stroke !== tt && c3.push(l4), this._d("arc", c3, i2); + } + curve(t4, e3) { + const s2 = this._o(e3), n2 = [], o2 = L2(t4, s2); + if (s2.fill && s2.fill !== tt) if ("solid" === s2.fillStyle) { + const e4 = L2(t4, Object.assign(Object.assign({}, s2), { disableMultiStroke: true, roughness: s2.roughness ? s2.roughness + s2.fillShapeRoughnessGain : 0 })); + n2.push({ type: "fillPath", ops: this._mergedShape(e4.ops) }); + } else { + const e4 = [], o3 = t4; + if (o3.length) { + const t5 = "number" == typeof o3[0][0] ? [o3] : o3; + for (const n3 of t5) n3.length < 3 ? e4.push(...n3) : 3 === n3.length ? e4.push(...Y2(H([n3[0], n3[0], n3[1], n3[2]]), 10, (1 + s2.roughness) / 2)) : e4.push(...Y2(H(n3), 10, (1 + s2.roughness) / 2)); + } + e4.length && n2.push(C2([e4], s2)); + } + return s2.stroke !== tt && n2.push(o2), this._d("curve", n2, s2); + } + polygon(t4, e3) { + const s2 = this._o(e3), n2 = [], o2 = S3(t4, true, s2); + return s2.fill && ("solid" === s2.fillStyle ? n2.push(I2([t4], s2)) : n2.push(C2([t4], s2))), s2.stroke !== tt && n2.push(o2), this._d("polygon", n2, s2); + } + path(t4, e3) { + const s2 = this._o(e3), n2 = []; + if (!t4) return this._d("path", n2, s2); + t4 = (t4 || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " "); + const o2 = s2.fill && "transparent" !== s2.fill && s2.fill !== tt, a2 = s2.stroke !== tt, h3 = !!(s2.simplification && s2.simplification < 1), r2 = (function(t5, e4, s3) { + const n3 = m2(y3(b2(t5))), o3 = []; + let a3 = [], h4 = [0, 0], r3 = []; + const i3 = /* @__PURE__ */ __name(() => { + r3.length >= 4 && a3.push(...Y2(r3, e4)), r3 = []; + }, "i"), c3 = /* @__PURE__ */ __name(() => { + i3(), a3.length && (o3.push(a3), a3 = []); + }, "c"); + for (const { key: t6, data: e6 } of n3) switch (t6) { + case "M": + c3(), h4 = [e6[0], e6[1]], a3.push(h4); + break; + case "L": + i3(), a3.push([e6[0], e6[1]]); + break; + case "C": + if (!r3.length) { + const t7 = a3.length ? a3[a3.length - 1] : h4; + r3.push([t7[0], t7[1]]); + } + r3.push([e6[0], e6[1]]), r3.push([e6[2], e6[3]]), r3.push([e6[4], e6[5]]); + break; + case "Z": + i3(), a3.push([h4[0], h4[1]]); + } + if (c3(), !s3) return o3; + const l4 = []; + for (const t6 of o3) { + const e6 = U2(t6, s3); + e6.length && l4.push(e6); + } + return l4; + })(t4, 1, h3 ? 4 - 4 * (s2.simplification || 1) : (1 + s2.roughness) / 2), i2 = _2(t4, s2); + if (o2) if ("solid" === s2.fillStyle) if (1 === r2.length) { + const e4 = _2(t4, Object.assign(Object.assign({}, s2), { disableMultiStroke: true, roughness: s2.roughness ? s2.roughness + s2.fillShapeRoughnessGain : 0 })); + n2.push({ type: "fillPath", ops: this._mergedShape(e4.ops) }); + } else n2.push(I2(r2, s2)); + else n2.push(C2(r2, s2)); + return a2 && (h3 ? r2.forEach(((t5) => { + n2.push(S3(t5, false, s2)); + })) : n2.push(i2)), this._d("path", n2, s2); + } + opsToPath(t4, e3) { + let s2 = ""; + for (const n2 of t4.ops) { + const t5 = "number" == typeof e3 && e3 >= 0 ? n2.data.map(((t6) => +t6.toFixed(e3))) : n2.data; + switch (n2.op) { + case "move": + s2 += `M${t5[0]} ${t5[1]} `; + break; + case "bcurveTo": + s2 += `C${t5[0]} ${t5[1]}, ${t5[2]} ${t5[3]}, ${t5[4]} ${t5[5]} `; + break; + case "lineTo": + s2 += `L${t5[0]} ${t5[1]} `; + } + } + return s2.trim(); + } + toPaths(t4) { + const e3 = t4.sets || [], s2 = t4.options || this.defaultOptions, n2 = []; + for (const t5 of e3) { + let e4 = null; + switch (t5.type) { + case "path": + e4 = { d: this.opsToPath(t5), stroke: s2.stroke, strokeWidth: s2.strokeWidth, fill: tt }; + break; + case "fillPath": + e4 = { d: this.opsToPath(t5), stroke: tt, strokeWidth: 0, fill: s2.fill || tt }; + break; + case "fillSketch": + e4 = this.fillSketch(t5, s2); + } + e4 && n2.push(e4); + } + return n2; + } + fillSketch(t4, e3) { + let s2 = e3.fillWeight; + return s2 < 0 && (s2 = e3.strokeWidth / 2), { d: this.opsToPath(t4), stroke: e3.fill || tt, strokeWidth: s2, fill: tt }; + } + _mergedShape(t4) { + return t4.filter(((t5, e3) => 0 === e3 || "move" !== t5.op)); + } + }; + st = class { + static { + __name(this, "st"); + } + constructor(t4, e3) { + this.canvas = t4, this.ctx = this.canvas.getContext("2d"), this.gen = new et(e3); + } + draw(t4) { + const e3 = t4.sets || [], s2 = t4.options || this.getDefaultOptions(), n2 = this.ctx, o2 = t4.options.fixedDecimalPlaceDigits; + for (const a2 of e3) switch (a2.type) { + case "path": + n2.save(), n2.strokeStyle = "none" === s2.stroke ? "transparent" : s2.stroke, n2.lineWidth = s2.strokeWidth, s2.strokeLineDash && n2.setLineDash(s2.strokeLineDash), s2.strokeLineDashOffset && (n2.lineDashOffset = s2.strokeLineDashOffset), this._drawToContext(n2, a2, o2), n2.restore(); + break; + case "fillPath": { + n2.save(), n2.fillStyle = s2.fill || ""; + const e4 = "curve" === t4.shape || "polygon" === t4.shape || "path" === t4.shape ? "evenodd" : "nonzero"; + this._drawToContext(n2, a2, o2, e4), n2.restore(); + break; + } + case "fillSketch": + this.fillSketch(n2, a2, s2); + } + } + fillSketch(t4, e3, s2) { + let n2 = s2.fillWeight; + n2 < 0 && (n2 = s2.strokeWidth / 2), t4.save(), s2.fillLineDash && t4.setLineDash(s2.fillLineDash), s2.fillLineDashOffset && (t4.lineDashOffset = s2.fillLineDashOffset), t4.strokeStyle = s2.fill || "", t4.lineWidth = n2, this._drawToContext(t4, e3, s2.fixedDecimalPlaceDigits), t4.restore(); + } + _drawToContext(t4, e3, s2, n2 = "nonzero") { + t4.beginPath(); + for (const n3 of e3.ops) { + const e4 = "number" == typeof s2 && s2 >= 0 ? n3.data.map(((t5) => +t5.toFixed(s2))) : n3.data; + switch (n3.op) { + case "move": + t4.moveTo(e4[0], e4[1]); + break; + case "bcurveTo": + t4.bezierCurveTo(e4[0], e4[1], e4[2], e4[3], e4[4], e4[5]); + break; + case "lineTo": + t4.lineTo(e4[0], e4[1]); + } + } + "fillPath" === e3.type ? t4.fill(n2) : t4.stroke(); + } + get generator() { + return this.gen; + } + getDefaultOptions() { + return this.gen.defaultOptions; + } + line(t4, e3, s2, n2, o2) { + const a2 = this.gen.line(t4, e3, s2, n2, o2); + return this.draw(a2), a2; + } + rectangle(t4, e3, s2, n2, o2) { + const a2 = this.gen.rectangle(t4, e3, s2, n2, o2); + return this.draw(a2), a2; + } + ellipse(t4, e3, s2, n2, o2) { + const a2 = this.gen.ellipse(t4, e3, s2, n2, o2); + return this.draw(a2), a2; + } + circle(t4, e3, s2, n2) { + const o2 = this.gen.circle(t4, e3, s2, n2); + return this.draw(o2), o2; + } + linearPath(t4, e3) { + const s2 = this.gen.linearPath(t4, e3); + return this.draw(s2), s2; + } + polygon(t4, e3) { + const s2 = this.gen.polygon(t4, e3); + return this.draw(s2), s2; + } + arc(t4, e3, s2, n2, o2, a2, h3 = false, r2) { + const i2 = this.gen.arc(t4, e3, s2, n2, o2, a2, h3, r2); + return this.draw(i2), i2; + } + curve(t4, e3) { + const s2 = this.gen.curve(t4, e3); + return this.draw(s2), s2; + } + path(t4, e3) { + const s2 = this.gen.path(t4, e3); + return this.draw(s2), s2; + } + }; + nt = "http://www.w3.org/2000/svg"; + ot = class { + static { + __name(this, "ot"); + } + constructor(t4, e3) { + this.svg = t4, this.gen = new et(e3); + } + draw(t4) { + const e3 = t4.sets || [], s2 = t4.options || this.getDefaultOptions(), n2 = this.svg.ownerDocument || window.document, o2 = n2.createElementNS(nt, "g"), a2 = t4.options.fixedDecimalPlaceDigits; + for (const h3 of e3) { + let e4 = null; + switch (h3.type) { + case "path": + e4 = n2.createElementNS(nt, "path"), e4.setAttribute("d", this.opsToPath(h3, a2)), e4.setAttribute("stroke", s2.stroke), e4.setAttribute("stroke-width", s2.strokeWidth + ""), e4.setAttribute("fill", "none"), s2.strokeLineDash && e4.setAttribute("stroke-dasharray", s2.strokeLineDash.join(" ").trim()), s2.strokeLineDashOffset && e4.setAttribute("stroke-dashoffset", `${s2.strokeLineDashOffset}`); + break; + case "fillPath": + e4 = n2.createElementNS(nt, "path"), e4.setAttribute("d", this.opsToPath(h3, a2)), e4.setAttribute("stroke", "none"), e4.setAttribute("stroke-width", "0"), e4.setAttribute("fill", s2.fill || ""), "curve" !== t4.shape && "polygon" !== t4.shape || e4.setAttribute("fill-rule", "evenodd"); + break; + case "fillSketch": + e4 = this.fillSketch(n2, h3, s2); + } + e4 && o2.appendChild(e4); + } + return o2; + } + fillSketch(t4, e3, s2) { + let n2 = s2.fillWeight; + n2 < 0 && (n2 = s2.strokeWidth / 2); + const o2 = t4.createElementNS(nt, "path"); + return o2.setAttribute("d", this.opsToPath(e3, s2.fixedDecimalPlaceDigits)), o2.setAttribute("stroke", s2.fill || ""), o2.setAttribute("stroke-width", n2 + ""), o2.setAttribute("fill", "none"), s2.fillLineDash && o2.setAttribute("stroke-dasharray", s2.fillLineDash.join(" ").trim()), s2.fillLineDashOffset && o2.setAttribute("stroke-dashoffset", `${s2.fillLineDashOffset}`), o2; + } + get generator() { + return this.gen; + } + getDefaultOptions() { + return this.gen.defaultOptions; + } + opsToPath(t4, e3) { + return this.gen.opsToPath(t4, e3); + } + line(t4, e3, s2, n2, o2) { + const a2 = this.gen.line(t4, e3, s2, n2, o2); + return this.draw(a2); + } + rectangle(t4, e3, s2, n2, o2) { + const a2 = this.gen.rectangle(t4, e3, s2, n2, o2); + return this.draw(a2); + } + ellipse(t4, e3, s2, n2, o2) { + const a2 = this.gen.ellipse(t4, e3, s2, n2, o2); + return this.draw(a2); + } + circle(t4, e3, s2, n2) { + const o2 = this.gen.circle(t4, e3, s2, n2); + return this.draw(o2); + } + linearPath(t4, e3) { + const s2 = this.gen.linearPath(t4, e3); + return this.draw(s2); + } + polygon(t4, e3) { + const s2 = this.gen.polygon(t4, e3); + return this.draw(s2); + } + arc(t4, e3, s2, n2, o2, a2, h3 = false, r2) { + const i2 = this.gen.arc(t4, e3, s2, n2, o2, a2, h3, r2); + return this.draw(i2); + } + curve(t4, e3) { + const s2 = this.gen.curve(t4, e3); + return this.draw(s2); + } + path(t4, e3) { + const s2 = this.gen.path(t4, e3); + return this.draw(s2); + } + }; + at = { canvas: /* @__PURE__ */ __name((t4, e3) => new st(t4, e3), "canvas"), svg: /* @__PURE__ */ __name((t4, e3) => new ot(t4, e3), "svg"), generator: /* @__PURE__ */ __name((t4) => new et(t4), "generator"), newSeed: /* @__PURE__ */ __name(() => et.newSeed(), "newSeed") }; + } + }); + + // src/rendering-util/rendering-elements/shapes/anchor.ts + function anchor(parent4, node2) { + const { labelStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const classes3 = getNodeClasses(node2); + let cssClasses = classes3; + if (!classes3) { + cssClasses = "anchor"; + } + const shapeSvg = parent4.insert("g").attr("class", cssClasses).attr("id", node2.domId || node2.id); + const radius2 = 1; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, { fill: "black", stroke: "none", fillStyle: "solid" }); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + } + const roughNode = rc.circle(0, 0, radius2 * 2, options2); + const circleElem = shapeSvg.insert(() => roughNode, ":first-child"); + circleElem.attr("class", "anchor").attr("style", handleUndefinedAttr(cssStyles)); + updateNodeBounds(node2, circleElem); + node2.intersect = function(point8) { + log.info("Circle intersect", node2, radius2, point8); + return intersect_default.circle(node2, radius2, point8); + }; + return shapeSvg; + } + var init_anchor = __esm({ + "src/rendering-util/rendering-elements/shapes/anchor.ts"() { + "use strict"; + init_logger(); + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_utils2(); + __name(anchor, "anchor"); + } + }); + + // src/rendering-util/rendering-elements/shapes/bowTieRect.ts + function generateArcPoints(x1, y1, x22, y22, rx, ry, clockwise) { + const numPoints = 20; + const midX = (x1 + x22) / 2; + const midY = (y1 + y22) / 2; + const angle2 = Math.atan2(y22 - y1, x22 - x1); + const dx = (x22 - x1) / 2; + const dy = (y22 - y1) / 2; + const transformedX = dx / rx; + const transformedY = dy / ry; + const distance3 = Math.sqrt(transformedX ** 2 + transformedY ** 2); + if (distance3 > 1) { + throw new Error("The given radii are too small to create an arc between the points."); + } + const scaledCenterDistance = Math.sqrt(1 - distance3 ** 2); + const centerX = midX + scaledCenterDistance * ry * Math.sin(angle2) * (clockwise ? -1 : 1); + const centerY = midY - scaledCenterDistance * rx * Math.cos(angle2) * (clockwise ? -1 : 1); + const startAngle = Math.atan2((y1 - centerY) / ry, (x1 - centerX) / rx); + const endAngle = Math.atan2((y22 - centerY) / ry, (x22 - centerX) / rx); + let angleRange = endAngle - startAngle; + if (clockwise && angleRange < 0) { + angleRange += 2 * Math.PI; + } + if (!clockwise && angleRange > 0) { + angleRange -= 2 * Math.PI; + } + const points = []; + for (let i2 = 0; i2 < numPoints; i2++) { + const t4 = i2 / (numPoints - 1); + const angle3 = startAngle + t4 * angleRange; + const x5 = centerX + rx * Math.cos(angle3); + const y6 = centerY + ry * Math.sin(angle3); + points.push({ x: x5, y: y6 }); + } + return points; + } + function calculateArcSagitta(chord, radiusX, radiusY) { + const [semiMajorAxis, semiMinorAxis] = [radiusX, radiusY].sort((a2, b3) => b3 - a2); + return semiMinorAxis * (1 - Math.sqrt(1 - (chord / semiMajorAxis / 2) ** 2)); + } + async function bowTieRect(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + const calcTotalHeight = /* @__PURE__ */ __name((labelHeight) => labelHeight + labelPaddingY, "calcTotalHeight"); + const calcEllipseRadius = /* @__PURE__ */ __name((totalHeight2) => { + const ry2 = totalHeight2 / 2; + const rx2 = ry2 / (2.5 + totalHeight2 / 50); + return [rx2, ry2]; + }, "calcEllipseRadius"); + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalHeight = calcTotalHeight(node2?.height ? node2?.height : bbox.height); + const [rx, ry] = calcEllipseRadius(totalHeight); + const sagitta = calculateArcSagitta(totalHeight, rx, ry); + const totalWidth = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2 + sagitta; + const w4 = totalWidth - sagitta; + const h3 = totalHeight; + const { cssStyles } = node2; + const points = [ + { x: w4 / 2, y: -h3 / 2 }, + { x: -w4 / 2, y: -h3 / 2 }, + ...generateArcPoints(-w4 / 2, -h3 / 2, -w4 / 2, h3 / 2, rx, ry, false), + { x: w4 / 2, y: h3 / 2 }, + ...generateArcPoints(w4 / 2, h3 / 2, w4 / 2, -h3 / 2, rx, ry, true) + ]; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const bowTieRectPath = createPathFromPoints(points); + const bowTieRectShapePath = rc.path(bowTieRectPath, options2); + const bowTieRectShape = shapeSvg.insert(() => bowTieRectShapePath, ":first-child"); + bowTieRectShape.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + bowTieRectShape.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + bowTieRectShape.selectAll("path").attr("style", nodeStyles); + } + bowTieRectShape.attr("transform", `translate(${rx / 2}, 0)`); + updateNodeBounds(node2, bowTieRectShape); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_bowTieRect = __esm({ + "src/rendering-util/rendering-elements/shapes/bowTieRect.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(generateArcPoints, "generateArcPoints"); + __name(calculateArcSagitta, "calculateArcSagitta"); + __name(bowTieRect, "bowTieRect"); + } + }); + + // src/rendering-util/rendering-elements/shapes/insertPolygonShape.ts + function insertPolygonShape(parent4, w4, h3, points) { + return parent4.insert("polygon", ":first-child").attr( + "points", + points.map(function(d3) { + return d3.x + "," + d3.y; + }).join(" ") + ).attr("class", "label-container").attr("transform", "translate(" + -w4 / 2 + "," + h3 / 2 + ")"); + } + var init_insertPolygonShape = __esm({ + "src/rendering-util/rendering-elements/shapes/insertPolygonShape.ts"() { + "use strict"; + __name(insertPolygonShape, "insertPolygonShape"); + } + }); + + // src/rendering-util/rendering-elements/shapes/card.ts + async function card(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 28 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 24 : nodePadding; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2?.width ?? bbox.width) + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX + NOTCH_SIZE); + const h3 = (node2?.height ?? bbox.height) + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY); + const left3 = 0; + const right3 = w4; + const top2 = -h3; + const bottom2 = 0; + const points = [ + { x: left3 + NOTCH_SIZE, y: top2 }, + { x: right3, y: top2 }, + { x: right3, y: bottom2 }, + { x: left3, y: bottom2 }, + { x: left3, y: top2 + NOTCH_SIZE }, + { x: left3 + NOTCH_SIZE, y: top2 } + ]; + let polygon2; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const pathData = createPathFromPoints(points); + const roughNode = rc.path(pathData, options2); + polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`); + if (cssStyles) { + polygon2.attr("style", cssStyles); + } + } else { + polygon2 = insertPolygonShape(shapeSvg, w4, h3, points); + } + if (nodeStyles) { + polygon2.attr("style", nodeStyles); + } + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var NOTCH_SIZE; + var init_card = __esm({ + "src/rendering-util/rendering-elements/shapes/card.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_insertPolygonShape(); + init_util(); + NOTCH_SIZE = 12; + __name(card, "card"); + } + }); + + // src/rendering-util/rendering-elements/shapes/choice.ts + function choice(parent4, node2) { + const { nodeStyles } = styles2String(node2); + node2.label = ""; + const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id); + const { cssStyles } = node2; + const s2 = Math.max(28, node2.width ?? 0); + const points = [ + { x: 0, y: s2 / 2 }, + { x: s2 / 2, y: 0 }, + { x: 0, y: -s2 / 2 }, + { x: -s2 / 2, y: 0 } + ]; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const choicePath = createPathFromPoints(points); + const roughNode = rc.path(choicePath, options2); + const choiceShape = shapeSvg.insert(() => roughNode, ":first-child"); + if (cssStyles && node2.look !== "handDrawn") { + choiceShape.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + choiceShape.selectAll("path").attr("style", nodeStyles); + } + node2.width = 28; + node2.height = 28; + node2.intersect = function(point8) { + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var init_choice = __esm({ + "src/rendering-util/rendering-elements/shapes/choice.ts"() { + "use strict"; + init_intersect(); + init_rough_esm(); + init_handDrawnShapeStyles(); + init_util(); + __name(choice, "choice"); + } + }); + + // src/rendering-util/rendering-elements/shapes/circle.ts + async function circle(parent4, node2, options2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox, halfPadding } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const labelPadding = 16; + const padding2 = options2?.padding ?? halfPadding; + const radius2 = node2.look === "neo" ? bbox.width / 2 + labelPadding * 2 : bbox.width / 2 + padding2; + let circleElem; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options3 = userNodeOverrides(node2, {}); + const roughNode = rc.circle(0, 0, radius2 * 2, options3); + circleElem = shapeSvg.insert(() => roughNode, ":first-child"); + circleElem.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles)); + } else { + circleElem = shapeSvg.insert("circle", ":first-child").attr("class", "basic label-container").attr("style", nodeStyles).attr("r", radius2).attr("cx", 0).attr("cy", 0); + } + updateNodeBounds(node2, circleElem); + node2.calcIntersect = function(bounds4, point8) { + const radius3 = bounds4.width / 2; + return intersect_default.circle(bounds4, radius3, point8); + }; + node2.intersect = function(point8) { + log.info("Circle intersect", node2, radius2, point8); + return intersect_default.circle(node2, radius2, point8); + }; + return shapeSvg; + } + var init_circle = __esm({ + "src/rendering-util/rendering-elements/shapes/circle.ts"() { + "use strict"; + init_rough_esm(); + init_logger(); + init_utils2(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(circle, "circle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/crossedCircle.ts + function createLine(r2) { + const xAxis45 = Math.cos(Math.PI / 4); + const yAxis45 = Math.sin(Math.PI / 4); + const lineLength = r2 * 2; + const pointQ1 = { x: lineLength / 2 * xAxis45, y: lineLength / 2 * yAxis45 }; + const pointQ2 = { x: -(lineLength / 2) * xAxis45, y: lineLength / 2 * yAxis45 }; + const pointQ3 = { x: -(lineLength / 2) * xAxis45, y: -(lineLength / 2) * yAxis45 }; + const pointQ4 = { x: lineLength / 2 * xAxis45, y: -(lineLength / 2) * yAxis45 }; + return `M ${pointQ2.x},${pointQ2.y} L ${pointQ4.x},${pointQ4.y} + M ${pointQ1.x},${pointQ1.y} L ${pointQ3.x},${pointQ3.y}`; + } + function crossedCircle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + node2.label = ""; + const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id); + const radius2 = Math.max(30, node2?.width ?? 0); + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const circleNode = rc.circle(0, 0, radius2 * 2, options2); + const linePath = createLine(radius2); + const lineNode = rc.path(linePath, options2); + const crossedCircle2 = shapeSvg.insert(() => circleNode, ":first-child"); + crossedCircle2.insert(() => lineNode); + crossedCircle2.attr("class", "outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + crossedCircle2.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + crossedCircle2.selectAll("path").attr("style", nodeStyles); + } + updateNodeBounds(node2, crossedCircle2); + node2.intersect = function(point8) { + log.info("crossedCircle intersect", node2, { radius: radius2, point: point8 }); + const pos = intersect_default.circle(node2, radius2, point8); + return pos; + }; + return shapeSvg; + } + var init_crossedCircle = __esm({ + "src/rendering-util/rendering-elements/shapes/crossedCircle.ts"() { + "use strict"; + init_logger(); + init_util(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_intersect(); + __name(createLine, "createLine"); + __name(crossedCircle, "crossedCircle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/curlyBraceLeft.ts + function generateCirclePoints2(centerX, centerY, radius2, numPoints = 100, startAngle = 0, endAngle = 180) { + const points = []; + const startAngleRad = startAngle * Math.PI / 180; + const endAngleRad = endAngle * Math.PI / 180; + const angleRange = endAngleRad - startAngleRad; + const angleStep = angleRange / (numPoints - 1); + for (let i2 = 0; i2 < numPoints; i2++) { + const angle2 = startAngleRad + i2 * angleStep; + const x5 = centerX + radius2 * Math.cos(angle2); + const y6 = centerY + radius2 * Math.sin(angle2); + points.push({ x: -x5, y: -y6 }); + } + return points; + } + async function curlyBraceLeft(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const paddingX = node2.look === "neo" ? 18 : node2.padding ?? 0; + const paddingY = node2.look === "neo" ? 12 : node2.padding ?? 0; + const w4 = bbox.width + paddingX; + const h3 = bbox.height + paddingY; + const radius2 = Math.max(5, h3 * 0.1); + const { cssStyles } = node2; + const points = [ + ...generateCirclePoints2(w4 / 2, -h3 / 2, radius2, 30, -90, 0), + { x: -w4 / 2 - radius2, y: radius2 }, + ...generateCirclePoints2(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270), + ...generateCirclePoints2(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180), + { x: -w4 / 2 - radius2, y: -h3 / 2 }, + ...generateCirclePoints2(w4 / 2, h3 / 2, radius2, 20, 0, 90) + ]; + const rectPoints = [ + { x: w4 / 2, y: -h3 / 2 - radius2 }, + { x: -w4 / 2, y: -h3 / 2 - radius2 }, + ...generateCirclePoints2(w4 / 2, -h3 / 2, radius2, 20, -90, 0), + { x: -w4 / 2 - radius2, y: -radius2 }, + ...generateCirclePoints2(w4 / 2 + w4 * 0.1, -radius2, radius2, 20, -180, -270), + ...generateCirclePoints2(w4 / 2 + w4 * 0.1, radius2, radius2, 20, -90, -180), + { x: -w4 / 2 - radius2, y: h3 / 2 }, + ...generateCirclePoints2(w4 / 2, h3 / 2, radius2, 20, 0, 90), + { x: -w4 / 2, y: h3 / 2 + radius2 }, + { x: w4 / 2, y: h3 / 2 + radius2 } + ]; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, { fill: "none" }); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const curlyBraceLeftPath = createPathFromPoints(points); + const newCurlyBracePath = curlyBraceLeftPath.replace("Z", ""); + const curlyBraceLeftNode = rc.path(newCurlyBracePath, options2); + const rectPath = createPathFromPoints(rectPoints); + const rectShape = rc.path(rectPath, { ...options2 }); + const curlyBraceLeftShape = shapeSvg.insert("g", ":first-child"); + curlyBraceLeftShape.insert(() => rectShape, ":first-child").attr("stroke-opacity", 0); + curlyBraceLeftShape.insert(() => curlyBraceLeftNode, ":first-child"); + curlyBraceLeftShape.attr("class", "text"); + if (cssStyles && node2.look !== "handDrawn") { + curlyBraceLeftShape.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + curlyBraceLeftShape.selectAll("path").attr("style", nodeStyles); + } + curlyBraceLeftShape.attr("transform", `translate(${radius2}, 0)`); + label.attr( + "transform", + `translate(${-w4 / 2 + radius2 - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, curlyBraceLeftShape); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, rectPoints, point8); + return pos; + }; + return shapeSvg; + } + var init_curlyBraceLeft = __esm({ + "src/rendering-util/rendering-elements/shapes/curlyBraceLeft.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(generateCirclePoints2, "generateCirclePoints"); + __name(curlyBraceLeft, "curlyBraceLeft"); + } + }); + + // src/rendering-util/rendering-elements/shapes/curlyBraceRight.ts + function generateCirclePoints3(centerX, centerY, radius2, numPoints = 100, startAngle = 0, endAngle = 180) { + const points = []; + const startAngleRad = startAngle * Math.PI / 180; + const endAngleRad = endAngle * Math.PI / 180; + const angleRange = endAngleRad - startAngleRad; + const angleStep = angleRange / (numPoints - 1); + for (let i2 = 0; i2 < numPoints; i2++) { + const angle2 = startAngleRad + i2 * angleStep; + const x5 = centerX + radius2 * Math.cos(angle2); + const y6 = centerY + radius2 * Math.sin(angle2); + points.push({ x: x5, y: y6 }); + } + return points; + } + async function curlyBraceRight(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const labelPaddingX = node2.look === "neo" ? 18 : node2.padding ?? 0; + const labelPaddingY = node2.look === "neo" ? 12 : node2.padding ?? 0; + const w4 = bbox.width + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX); + const h3 = bbox.height + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY); + const radius2 = Math.max(5, h3 * 0.1); + const { cssStyles } = node2; + const points = [ + ...generateCirclePoints3(w4 / 2, -h3 / 2, radius2, 20, -90, 0), + { x: w4 / 2 + radius2, y: -radius2 }, + ...generateCirclePoints3(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270), + ...generateCirclePoints3(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180), + { x: w4 / 2 + radius2, y: h3 / 2 }, + ...generateCirclePoints3(w4 / 2, h3 / 2, radius2, 20, 0, 90) + ]; + const rectPoints = [ + { x: -w4 / 2, y: -h3 / 2 - radius2 }, + { x: w4 / 2, y: -h3 / 2 - radius2 }, + ...generateCirclePoints3(w4 / 2, -h3 / 2, radius2, 20, -90, 0), + { x: w4 / 2 + radius2, y: -radius2 }, + ...generateCirclePoints3(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270), + ...generateCirclePoints3(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180), + { x: w4 / 2 + radius2, y: h3 / 2 }, + ...generateCirclePoints3(w4 / 2, h3 / 2, radius2, 20, 0, 90), + { x: w4 / 2, y: h3 / 2 + radius2 }, + { x: -w4 / 2, y: h3 / 2 + radius2 } + ]; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, { fill: "none" }); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const curlyBraceRightPath = createPathFromPoints(points); + const newCurlyBracePath = curlyBraceRightPath.replace("Z", ""); + const curlyBraceRightNode = rc.path(newCurlyBracePath, options2); + const rectPath = createPathFromPoints(rectPoints); + const rectShape = rc.path(rectPath, { ...options2 }); + const curlyBraceRightShape = shapeSvg.insert("g", ":first-child"); + curlyBraceRightShape.insert(() => rectShape, ":first-child").attr("stroke-opacity", 0); + curlyBraceRightShape.insert(() => curlyBraceRightNode, ":first-child"); + curlyBraceRightShape.attr("class", "text"); + if (cssStyles && node2.look !== "handDrawn") { + curlyBraceRightShape.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + curlyBraceRightShape.selectAll("path").attr("style", nodeStyles); + } + curlyBraceRightShape.attr("transform", `translate(${-radius2}, 0)`); + label.attr( + "transform", + `translate(${-w4 / 2 + (node2.padding ?? 0) / 2 - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, curlyBraceRightShape); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, rectPoints, point8); + return pos; + }; + return shapeSvg; + } + var init_curlyBraceRight = __esm({ + "src/rendering-util/rendering-elements/shapes/curlyBraceRight.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(generateCirclePoints3, "generateCirclePoints"); + __name(curlyBraceRight, "curlyBraceRight"); + } + }); + + // src/rendering-util/rendering-elements/shapes/curlyBraces.ts + function generateCirclePoints4(centerX, centerY, radius2, numPoints = 100, startAngle = 0, endAngle = 180) { + const points = []; + const startAngleRad = startAngle * Math.PI / 180; + const endAngleRad = endAngle * Math.PI / 180; + const angleRange = endAngleRad - startAngleRad; + const angleStep = angleRange / (numPoints - 1); + for (let i2 = 0; i2 < numPoints; i2++) { + const angle2 = startAngleRad + i2 * angleStep; + const x5 = centerX + radius2 * Math.cos(angle2); + const y6 = centerY + radius2 * Math.sin(angle2); + points.push({ x: -x5, y: -y6 }); + } + return points; + } + async function curlyBraces(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const labelPaddingX = node2.look === "neo" ? 18 : node2.padding ?? 0; + const labelPaddingY = node2.look === "neo" ? 12 : node2.padding ?? 0; + const w4 = bbox.width + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX); + const h3 = bbox.height + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY); + const radius2 = Math.max(5, h3 * 0.1); + const { cssStyles } = node2; + const leftCurlyBracePoints = [ + ...generateCirclePoints4(w4 / 2, -h3 / 2, radius2, 30, -90, 0), + { x: -w4 / 2 - radius2, y: radius2 }, + ...generateCirclePoints4(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270), + ...generateCirclePoints4(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180), + { x: -w4 / 2 - radius2, y: -h3 / 2 }, + ...generateCirclePoints4(w4 / 2, h3 / 2, radius2, 20, 0, 90) + ]; + const rightCurlyBracePoints = [ + ...generateCirclePoints4(-w4 / 2 + radius2 + radius2 / 2, -h3 / 2, radius2, 20, -90, -180), + { x: w4 / 2 - radius2 / 2, y: radius2 }, + ...generateCirclePoints4(-w4 / 2 - radius2 / 2, -radius2, radius2, 20, 0, 90), + ...generateCirclePoints4(-w4 / 2 - radius2 / 2, radius2, radius2, 20, -90, 0), + { x: w4 / 2 - radius2 / 2, y: -radius2 }, + ...generateCirclePoints4(-w4 / 2 + radius2 + radius2 / 2, h3 / 2, radius2, 30, -180, -270) + ]; + const rectPoints = [ + { x: w4 / 2, y: -h3 / 2 - radius2 }, + { x: -w4 / 2, y: -h3 / 2 - radius2 }, + ...generateCirclePoints4(w4 / 2, -h3 / 2, radius2, 20, -90, 0), + { x: -w4 / 2 - radius2, y: -radius2 }, + ...generateCirclePoints4(w4 / 2 + radius2 * 2, -radius2, radius2, 20, -180, -270), + ...generateCirclePoints4(w4 / 2 + radius2 * 2, radius2, radius2, 20, -90, -180), + { x: -w4 / 2 - radius2, y: h3 / 2 }, + ...generateCirclePoints4(w4 / 2, h3 / 2, radius2, 20, 0, 90), + { x: -w4 / 2, y: h3 / 2 + radius2 }, + { x: w4 / 2 - radius2 - radius2 / 2, y: h3 / 2 + radius2 }, + ...generateCirclePoints4(-w4 / 2 + radius2 + radius2 / 2, -h3 / 2, radius2, 20, -90, -180), + { x: w4 / 2 - radius2 / 2, y: radius2 }, + ...generateCirclePoints4(-w4 / 2 - radius2 / 2, -radius2, radius2, 20, 0, 90), + ...generateCirclePoints4(-w4 / 2 - radius2 / 2, radius2, radius2, 20, -90, 0), + { x: w4 / 2 - radius2 / 2, y: -radius2 }, + ...generateCirclePoints4(-w4 / 2 + radius2 + radius2 / 2, h3 / 2, radius2, 30, -180, -270) + ]; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, { fill: "none" }); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const leftCurlyBracePath = createPathFromPoints(leftCurlyBracePoints); + const newLeftCurlyBracePath = leftCurlyBracePath.replace("Z", ""); + const leftCurlyBraceNode = rc.path(newLeftCurlyBracePath, options2); + const rightCurlyBracePath = createPathFromPoints(rightCurlyBracePoints); + const newRightCurlyBracePath = rightCurlyBracePath.replace("Z", ""); + const rightCurlyBraceNode = rc.path(newRightCurlyBracePath, options2); + const rectPath = createPathFromPoints(rectPoints); + const rectShape = rc.path(rectPath, { ...options2 }); + const curlyBracesShape = shapeSvg.insert("g", ":first-child"); + curlyBracesShape.insert(() => rectShape, ":first-child").attr("stroke-opacity", 0); + curlyBracesShape.insert(() => leftCurlyBraceNode, ":first-child"); + curlyBracesShape.insert(() => rightCurlyBraceNode, ":first-child"); + curlyBracesShape.attr("class", "text"); + if (cssStyles && node2.look !== "handDrawn") { + curlyBracesShape.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + curlyBracesShape.selectAll("path").attr("style", nodeStyles); + } + curlyBracesShape.attr("transform", `translate(${radius2 - radius2 / 4}, 0)`); + label.attr( + "transform", + `translate(${-w4 / 2 + (node2.padding ?? 0) / 2 - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, curlyBracesShape); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, rectPoints, point8); + return pos; + }; + return shapeSvg; + } + var init_curlyBraces = __esm({ + "src/rendering-util/rendering-elements/shapes/curlyBraces.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(generateCirclePoints4, "generateCirclePoints"); + __name(curlyBraces, "curlyBraces"); + } + }); + + // src/rendering-util/rendering-elements/shapes/curvedTrapezoid.ts + async function curvedTrapezoid(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + const minWidth = 20, minHeight = 5; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = Math.max(minWidth, (bbox.width + labelPaddingX * 2) * 1.25, node2?.width ?? 0); + const h3 = Math.max(minHeight, bbox.height + labelPaddingY * 2, node2?.height ?? 0); + const radius2 = h3 / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const totalWidth = w4, totalHeight = h3; + const rw = totalWidth - radius2; + const tw = totalHeight / 4; + const points = [ + { x: rw, y: 0 }, + { x: tw, y: 0 }, + { x: 0, y: totalHeight / 2 }, + { x: tw, y: totalHeight }, + { x: rw, y: totalHeight }, + ...generateCirclePoints(-rw, -totalHeight / 2, radius2, 50, 270, 90) + ]; + const pathData = createPathFromPoints(points); + const shapeNode = rc.path(pathData, options2); + const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child"); + polygon2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", nodeStyles); + } + polygon2.attr("transform", `translate(${-w4 / 2}, ${-h3 / 2})`); + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_curvedTrapezoid = __esm({ + "src/rendering-util/rendering-elements/shapes/curvedTrapezoid.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(curvedTrapezoid, "curvedTrapezoid"); + } + }); + + // src/rendering-util/rendering-elements/shapes/cylinder.ts + async function cylinder(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 24 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 24 : nodePadding; + if (node2.width || node2.height) { + const originalWidth = node2.width ?? 0; + node2.width = (node2.width ?? 0) - labelPaddingY; + if (node2.width < MIN_WIDTH) { + node2.width = MIN_WIDTH; + } + const rx2 = originalWidth / 2; + const ry2 = rx2 / (2.5 + originalWidth / 50); + node2.height = (node2.height ?? 0) - labelPaddingX - ry2 * 3; + if (node2.height < MIN_HEIGHT) { + node2.height = MIN_HEIGHT; + } + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2.width ? node2.width : bbox.width) + labelPaddingY; + const rx = w4 / 2; + const ry = rx / (2.5 + w4 / 50); + const h3 = (node2.height ? node2.height : bbox.height) + labelPaddingX + ry; + let cylinder3; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const outerPathData = createOuterCylinderPathD(0, 0, w4, h3, rx, ry); + const innerPathData = createInnerCylinderPathD(0, ry, w4, h3, rx, ry); + const options2 = userNodeOverrides(node2, {}); + const outerNode = rc.path(outerPathData, options2); + const innerLine = rc.path(innerPathData, userNodeOverrides(node2, { fill: "none" })); + cylinder3 = shapeSvg.insert(() => innerLine, ":first-child"); + cylinder3 = shapeSvg.insert(() => outerNode, ":first-child"); + cylinder3.attr("class", "basic label-container"); + if (cssStyles) { + cylinder3.attr("style", cssStyles); + } + } else { + const pathData = createCylinderPathD(0, 0, w4, h3, rx, ry); + cylinder3 = shapeSvg.insert("path", ":first-child").attr("d", pathData).attr("class", "basic label-container outer-path").attr("style", handleUndefinedAttr(cssStyles)).attr("style", nodeStyles); + } + cylinder3.attr("label-offset-y", ry); + cylinder3.attr("transform", `translate(${-w4 / 2}, ${-(h3 / 2 + ry)})`); + updateNodeBounds(node2, cylinder3); + label.attr( + "transform", + `translate(${-(bbox.width / 2) - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + (node2.padding ?? 0) / 1.5 - (bbox.y - (bbox.top ?? 0))})` + ); + node2.intersect = function(point8) { + const pos = intersect_default.rect(node2, point8); + const x5 = pos.x - (node2.x ?? 0); + if (rx != 0 && (Math.abs(x5) < (node2.width ?? 0) / 2 || Math.abs(x5) == (node2.width ?? 0) / 2 && Math.abs(pos.y - (node2.y ?? 0)) > (node2.height ?? 0) / 2 - ry)) { + let y6 = ry * ry * (1 - x5 * x5 / (rx * rx)); + if (y6 > 0) { + y6 = Math.sqrt(y6); + } + y6 = ry - y6; + if (point8.y - (node2.y ?? 0) > 0) { + y6 = -y6; + } + pos.y += y6; + } + return pos; + }; + return shapeSvg; + } + var createCylinderPathD, createOuterCylinderPathD, createInnerCylinderPathD, MIN_HEIGHT, MIN_WIDTH; + var init_cylinder = __esm({ + "src/rendering-util/rendering-elements/shapes/cylinder.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_utils2(); + createCylinderPathD = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => { + return [ + `M${x5},${y6 + ry}`, + `a${rx},${ry} 0,0,0 ${width3},0`, + `a${rx},${ry} 0,0,0 ${-width3},0`, + `l0,${height2}`, + `a${rx},${ry} 0,0,0 ${width3},0`, + `l0,${-height2}` + ].join(" "); + }, "createCylinderPathD"); + createOuterCylinderPathD = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => { + return [ + `M${x5},${y6 + ry}`, + `M${x5 + width3},${y6 + ry}`, + `a${rx},${ry} 0,0,0 ${-width3},0`, + `l0,${height2}`, + `a${rx},${ry} 0,0,0 ${width3},0`, + `l0,${-height2}` + ].join(" "); + }, "createOuterCylinderPathD"); + createInnerCylinderPathD = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => { + return [`M${x5 - width3 / 2},${-height2 / 2}`, `a${rx},${ry} 0,0,0 ${width3},0`].join(" "); + }, "createInnerCylinderPathD"); + MIN_HEIGHT = 8; + MIN_WIDTH = 8; + __name(cylinder, "cylinder"); + } + }); + + // src/rendering-util/rendering-elements/shapes/roundedRectPath.ts + var createRoundedRectPathD; + var init_roundedRectPath = __esm({ + "src/rendering-util/rendering-elements/shapes/roundedRectPath.ts"() { + "use strict"; + createRoundedRectPathD = /* @__PURE__ */ __name((x5, y6, totalWidth, totalHeight, radius2) => [ + "M", + x5 + radius2, + y6, + // Move to the first point + "H", + x5 + totalWidth - radius2, + // Draw horizontal line to the beginning of the right corner + "A", + radius2, + radius2, + 0, + 0, + 1, + x5 + totalWidth, + y6 + radius2, + // Draw arc to the right top corner + "V", + y6 + totalHeight - radius2, + // Draw vertical line down to the beginning of the right bottom corner + "A", + radius2, + radius2, + 0, + 0, + 1, + x5 + totalWidth - radius2, + y6 + totalHeight, + // Draw arc to the right bottom corner + "H", + x5 + radius2, + // Draw horizontal line to the beginning of the left bottom corner + "A", + radius2, + radius2, + 0, + 0, + 1, + x5, + y6 + totalHeight - radius2, + // Draw arc to the left bottom corner + "V", + y6 + radius2, + // Draw vertical line up to the beginning of the left top corner + "A", + radius2, + radius2, + 0, + 0, + 1, + x5 + radius2, + y6, + // Draw arc to the left top corner + "Z" + // Close the path + ].join(" "), "createRoundedRectPathD"); + } + }); + + // src/rendering-util/rendering-elements/shapes/drawRect.ts + async function drawRect3(parent4, node2, options2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalWidth = Math.max(bbox.width + options2.labelPaddingX * 2, node2?.width || 0); + const totalHeight = Math.max(bbox.height + options2.labelPaddingY * 2, node2?.height || 0); + const x5 = -totalWidth / 2; + const y6 = -totalHeight / 2; + let rect3; + let { rx, ry } = node2; + const { cssStyles } = node2; + if (options2?.rx && options2.ry) { + rx = options2.rx; + ry = options2.ry; + } + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options3 = userNodeOverrides(node2, {}); + const roughNode = rx || ry ? rc.path(createRoundedRectPathD(x5, y6, totalWidth, totalHeight, rx || 0), options3) : rc.rectangle(x5, y6, totalWidth, totalHeight, options3); + rect3 = shapeSvg.insert(() => roughNode, ":first-child"); + rect3.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles)); + } else { + rect3 = shapeSvg.insert("rect", ":first-child"); + rect3.attr("class", "basic label-container").attr("style", nodeStyles).attr("rx", handleUndefinedAttr(rx)).attr("ry", handleUndefinedAttr(ry)).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight); + } + updateNodeBounds(node2, rect3); + node2.calcIntersect = function(bounds4, point8) { + return intersect_default.rect(bounds4, point8); + }; + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_drawRect = __esm({ + "src/rendering-util/rendering-elements/shapes/drawRect.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_roundedRectPath(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_utils2(); + __name(drawRect3, "drawRect"); + } + }); + + // src/rendering-util/rendering-elements/shapes/datastore.ts + async function datastore(parent4, node2) { + const { cssClasses, labelPaddingX, labelPaddingY, padding: padding2, width: width3, height: height2 } = node2; + const rectOptions = { + rx: 0, + ry: 0, + classes: cssClasses ?? "", + labelPaddingX: labelPaddingX ?? (padding2 ?? 0) * 2, + labelPaddingY: labelPaddingY ?? padding2 ?? 0 + }; + const rect3 = await drawRect3(parent4, node2, rectOptions); + if (node2.look === "handDrawn") { + const rc = at.svg(rect3); + const nodeOverrideOptions = userNodeOverrides(node2, {}); + const borderSelection = rect3.select(".basic.label-container > path:nth-child(2)"); + const borderPath = borderSelection.node(); + if (!borderPath) { + return rect3; + } + let bbox = null; + if (borderPath instanceof SVGGraphicsElement) { + bbox = borderPath.getBBox(); + } else { + return rect3; + } + rect3.insert( + () => rc.line(bbox.x, bbox.y, bbox.x + bbox.width, bbox.y, nodeOverrideOptions), + ".basic.label-container g.label" + ); + rect3.insert( + () => rc.line( + bbox.x, + bbox.y + bbox.height, + bbox.x + bbox.width, + bbox.y + bbox.height, + nodeOverrideOptions + ), + ".basic.label-container g.label" + ); + borderSelection.remove(); + return rect3; + } + const selection2 = rect3.select(".basic.label-container"); + const datastoreWidth = (Number(selection2.attr("width")) || width3) ?? 0; + const datastoreHeight = (Number(selection2.attr("height")) || height2) ?? 0; + if (datastoreWidth > 0 && datastoreHeight > 0) { + selection2.attr("stroke-dasharray", `${datastoreWidth} ${datastoreHeight}`); + } + return rect3; + } + var init_datastore = __esm({ + "src/rendering-util/rendering-elements/shapes/datastore.ts"() { + "use strict"; + init_drawRect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(datastore, "datastore"); + } + }); + + // src/rendering-util/rendering-elements/shapes/dividedRect.ts + async function dividedRectangle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const paddingX = node2.look === "neo" ? 16 : node2.padding ?? 0; + const paddingY = node2.look === "neo" ? 16 : node2.padding ?? 0; + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = bbox.width + paddingX; + const h3 = bbox.height + paddingY; + const rectOffset2 = h3 * 0.2; + const x5 = -w4 / 2; + const y6 = -h3 / 2 - rectOffset2 / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const pts2 = [ + { x: x5, y: y6 + rectOffset2 }, + { x: -x5, y: y6 + rectOffset2 }, + { x: -x5, y: -y6 }, + { x: x5, y: -y6 }, + { x: x5, y: y6 }, + { x: -x5, y: y6 }, + { x: -x5, y: y6 + rectOffset2 } + ]; + const poly = rc.polygon( + pts2.map((p3) => [p3.x, p3.y]), + options2 + ); + const polygon2 = shapeSvg.insert(() => poly, ":first-child"); + polygon2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + polygon2.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + polygon2.selectAll("path").attr("style", nodeStyles); + } + label.attr( + "transform", + `translate(${x5 + (node2.padding ?? 0) / 2 - (bbox.x - (bbox.left ?? 0))}, ${y6 + rectOffset2 + (node2.padding ?? 0) / 2 - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + const pos = intersect_default.rect(node2, point8); + return pos; + }; + return shapeSvg; + } + var init_dividedRect = __esm({ + "src/rendering-util/rendering-elements/shapes/dividedRect.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(dividedRectangle, "dividedRectangle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/doubleCircle.ts + async function doublecircle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + const gap = node2.look === "neo" ? 12 : 5; + node2.labelStyle = labelStyles; + const padding2 = node2.padding ?? 0; + const labelPadding = node2.look === "neo" ? 16 : padding2; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const outerRadius = (node2?.width ? node2?.width / 2 : bbox.width / 2) + (labelPadding ?? 0); + const innerRadius = outerRadius - gap; + let circleGroup; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const outerOptions = userNodeOverrides(node2, { roughness: 0.2, strokeWidth: 2.5 }); + const innerOptions = userNodeOverrides(node2, { roughness: 0.2, strokeWidth: 1.5 }); + const outerRoughNode = rc.circle(0, 0, outerRadius * 2, outerOptions); + const innerRoughNode = rc.circle(0, 0, innerRadius * 2, innerOptions); + circleGroup = shapeSvg.insert("g", ":first-child"); + circleGroup.attr("class", handleUndefinedAttr(node2.cssClasses)).attr("style", handleUndefinedAttr(cssStyles)); + circleGroup.node()?.appendChild(outerRoughNode); + circleGroup.node()?.appendChild(innerRoughNode); + } else { + circleGroup = shapeSvg.insert("g", ":first-child"); + const outerCircle = circleGroup.insert("circle", ":first-child"); + const innerCircle = circleGroup.insert("circle"); + circleGroup.attr("class", "basic label-container").attr("style", nodeStyles); + outerCircle.attr("class", "outer-circle").attr("style", nodeStyles).attr("r", outerRadius).attr("cx", 0).attr("cy", 0); + innerCircle.attr("class", "inner-circle").attr("style", nodeStyles).attr("r", innerRadius).attr("cx", 0).attr("cy", 0); + } + updateNodeBounds(node2, circleGroup); + node2.intersect = function(point8) { + log.info("DoubleCircle intersect", node2, outerRadius, point8); + return intersect_default.circle(node2, outerRadius, point8); + }; + return shapeSvg; + } + var init_doubleCircle = __esm({ + "src/rendering-util/rendering-elements/shapes/doubleCircle.ts"() { + "use strict"; + init_logger(); + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_utils2(); + __name(doublecircle, "doublecircle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/filledCircle.ts + function filledCircle(parent4, node2, { config: { themeVariables } }) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.label = ""; + node2.labelStyle = labelStyles; + const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id); + const radius2 = 7; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const { nodeBorder } = themeVariables; + const options2 = userNodeOverrides(node2, { fillStyle: "solid" }); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + } + const circleNode = rc.circle(0, 0, radius2 * 2, options2); + const filledCircle2 = shapeSvg.insert(() => circleNode, ":first-child"); + filledCircle2.selectAll("path").attr("style", `fill: ${nodeBorder} !important;`); + if (cssStyles && cssStyles.length > 0 && node2.look !== "handDrawn") { + filledCircle2.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + filledCircle2.selectAll("path").attr("style", nodeStyles); + } + updateNodeBounds(node2, filledCircle2); + node2.intersect = function(point8) { + log.info("filledCircle intersect", node2, { radius: radius2, point: point8 }); + const pos = intersect_default.circle(node2, radius2, point8); + return pos; + }; + return shapeSvg; + } + var init_filledCircle = __esm({ + "src/rendering-util/rendering-elements/shapes/filledCircle.ts"() { + "use strict"; + init_rough_esm(); + init_logger(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(filledCircle, "filledCircle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/flippedTriangle.ts + async function flippedTriangle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding; + if (node2.width || node2.height) { + node2.height = node2?.height ?? 0; + if (node2.height < MIN_HEIGHT2) { + node2.height = MIN_HEIGHT2; + } + node2.width = (node2?.width ?? 0) - labelPaddingX - labelPaddingX / 2; + if (node2.width < MIN_WIDTH2) { + node2.width = MIN_WIDTH2; + } + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2?.width ? node2?.width : bbox.width) + (labelPaddingX ?? 0); + const h3 = node2?.height ? node2?.height : w4 + bbox.height; + const tw = h3; + const points = [ + { x: 0, y: -h3 }, + { x: tw, y: -h3 }, + { x: tw / 2, y: 0 } + ]; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const pathData = createPathFromPoints(points); + const roughNode = rc.path(pathData, options2); + const flippedTriangle2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-h3 / 2}, ${h3 / 2})`).attr("class", "outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + flippedTriangle2.selectChildren("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + flippedTriangle2.selectChildren("path").attr("style", nodeStyles); + } + node2.width = w4; + node2.height = h3; + updateNodeBounds(node2, flippedTriangle2); + label.attr( + "transform", + `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-h3 / 2 + (node2.padding ?? 0) / 2 + (bbox.y - (bbox.top ?? 0))})` + ); + node2.intersect = function(point8) { + log.info("Triangle intersect", node2, points, point8); + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var MIN_HEIGHT2, MIN_WIDTH2; + var init_flippedTriangle = __esm({ + "src/rendering-util/rendering-elements/shapes/flippedTriangle.ts"() { + "use strict"; + init_logger(); + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_util(); + MIN_HEIGHT2 = 10; + MIN_WIDTH2 = 10; + __name(flippedTriangle, "flippedTriangle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/forkJoin.ts + function forkJoin(parent4, node2, { dir: dir2, config: { state: state4, themeVariables } }) { + const { nodeStyles } = styles2String(node2); + node2.label = ""; + const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id); + const { cssStyles } = node2; + let width3 = Math.max(70, node2?.width ?? 0); + let height2 = Math.max(10, node2?.height ?? 0); + if (dir2 === "LR") { + width3 = Math.max(10, node2?.width ?? 0); + height2 = Math.max(70, node2?.height ?? 0); + } + const x5 = -1 * width3 / 2; + const y6 = -1 * height2 / 2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, { + stroke: themeVariables.lineColor, + fill: themeVariables.lineColor + }); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const roughNode = rc.rectangle(x5, y6, width3, height2, options2); + const shape = shapeSvg.insert(() => roughNode, ":first-child"); + if (cssStyles && node2.look !== "handDrawn") { + shape.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + shape.selectAll("path").attr("style", nodeStyles); + } + updateNodeBounds(node2, shape); + const padding2 = state4?.padding ?? 0; + if (node2.width && node2.height) { + node2.width += padding2 / 2 || 0; + node2.height += padding2 / 2 || 0; + } + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_forkJoin = __esm({ + "src/rendering-util/rendering-elements/shapes/forkJoin.ts"() { + "use strict"; + init_rough_esm(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(forkJoin, "forkJoin"); + } + }); + + // src/rendering-util/rendering-elements/shapes/halfRoundedRectangle.ts + async function halfRoundedRectangle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const minWidth = 15, minHeight = 10; + const paddingX = node2.look === "neo" ? 16 : node2.padding ?? 0; + const paddingY = node2.look === "neo" ? 12 : node2.padding ?? 0; + if (node2.width || node2.height) { + node2.height = (node2?.height ?? 0) - paddingY * 2; + if (node2.height < minHeight) { + node2.height = minHeight; + } + node2.width = (node2?.width ?? 0) - paddingX * 2; + if (node2.width < minWidth) { + node2.width = minWidth; + } + } + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2?.width ? node2?.width : Math.max(minWidth, bbox.width)) + paddingX * 2; + const h3 = (node2?.height ? node2?.height : Math.max(minHeight, bbox.height)) + paddingY * 2; + const radius2 = h3 / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: -w4 / 2, y: -h3 / 2 }, + { x: w4 / 2 - radius2, y: -h3 / 2 }, + ...generateCirclePoints(-w4 / 2 + radius2, 0, radius2, 50, 90, 270), + { x: w4 / 2 - radius2, y: h3 / 2 }, + { x: -w4 / 2, y: h3 / 2 } + ]; + const pathData = createPathFromPoints(points); + const shapeNode = rc.path(pathData, options2); + const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child"); + polygon2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", nodeStyles); + } + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + log.info("Pill intersect", node2, { radius: radius2, point: point8 }); + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_halfRoundedRectangle = __esm({ + "src/rendering-util/rendering-elements/shapes/halfRoundedRectangle.ts"() { + "use strict"; + init_logger(); + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(halfRoundedRectangle, "halfRoundedRectangle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/hexagon.ts + async function hexagon(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + const f2 = node2.look === "neo" ? 3.5 : 4; + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const wa = 70; + const ha = 32; + const labelPaddingX = node2.look === "neo" ? wa : nodePadding; + const labelPaddingY = node2.look === "neo" ? ha : nodePadding; + if (node2.width || node2.height) { + const originalHeight = node2.height ?? 0; + const m4 = originalHeight / f2; + node2.width = (node2?.width ?? 0) - 2 * m4 - labelPaddingY; + node2.height = (node2.height ?? 0) - labelPaddingX; + } + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const h3 = (node2?.height ? node2?.height : bbox.height) + labelPaddingX; + const m3 = h3 / f2; + const w4 = (node2?.width ? node2?.width : bbox.width) + 2 * m3 + labelPaddingY; + const points = [ + { x: m3, y: 0 }, + { x: w4 - m3, y: 0 }, + { x: w4, y: -h3 / 2 }, + { x: w4 - m3, y: -h3 }, + { x: m3, y: -h3 }, + { x: 0, y: -h3 / 2 } + ]; + let polygon2; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const pathData = createHexagonPathD(0, 0, w4, h3, m3); + const roughNode = rc.path(pathData, options2); + polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`); + if (cssStyles) { + polygon2.attr("style", cssStyles); + } + } else { + polygon2 = insertPolygonShape(shapeSvg, w4, h3, points); + } + if (nodeStyles) { + polygon2.attr("style", nodeStyles); + } + node2.width = w4; + node2.height = h3; + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var createHexagonPathD; + var init_hexagon = __esm({ + "src/rendering-util/rendering-elements/shapes/hexagon.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_insertPolygonShape(); + createHexagonPathD = /* @__PURE__ */ __name((x5, y6, width3, height2, m3) => { + return [ + `M${x5 + m3},${y6}`, + `L${x5 + width3 - m3},${y6}`, + `L${x5 + width3},${y6 - height2 / 2}`, + `L${x5 + width3 - m3},${y6 - height2}`, + `L${x5 + m3},${y6 - height2}`, + `L${x5},${y6 - height2 / 2}`, + "Z" + ].join(" "); + }, "createHexagonPathD"); + __name(hexagon, "hexagon"); + } + }); + + // src/rendering-util/rendering-elements/shapes/hourglass.ts + async function hourglass(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.label = ""; + node2.labelStyle = labelStyles; + const { shapeSvg } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = Math.max(30, node2?.width ?? 0); + const h3 = Math.max(30, node2?.height ?? 0); + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: 0, y: 0 }, + { x: w4, y: 0 }, + { x: 0, y: h3 }, + { x: w4, y: h3 } + ]; + const pathData = createPathFromPoints(points); + const shapeNode = rc.path(pathData, options2); + const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child"); + polygon2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", nodeStyles); + } + polygon2.attr("transform", `translate(${-w4 / 2}, ${-h3 / 2})`); + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + log.info("Pill intersect", node2, { points }); + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_hourglass = __esm({ + "src/rendering-util/rendering-elements/shapes/hourglass.ts"() { + "use strict"; + init_logger(); + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(hourglass, "hourglass"); + } + }); + + // src/rendering-util/rendering-elements/shapes/icon.ts + async function icon(parent4, node2, { config: { themeVariables, flowchart } }) { + const { labelStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const assetHeight = node2.assetHeight ?? 48; + const assetWidth = node2.assetWidth ?? 48; + const iconSize = Math.max(assetHeight, assetWidth); + const defaultWidth = flowchart?.wrappingWidth; + node2.width = Math.max(iconSize, defaultWidth ?? 0); + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, "icon-shape default"); + const topLabel = node2.pos === "t"; + const height2 = iconSize; + const width3 = iconSize; + const { nodeBorder } = themeVariables; + const { stylesMap } = compileStyles(node2); + const x5 = -width3 / 2; + const y6 = -height2 / 2; + const labelPadding = node2.label ? 8 : 0; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, { stroke: "none", fill: "none" }); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const iconNode = rc.rectangle(x5, y6, width3, height2, options2); + const outerWidth = Math.max(width3, bbox.width); + const outerHeight = height2 + bbox.height + labelPadding; + const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, { + ...options2, + fill: "transparent", + stroke: "none" + }); + const iconShape = shapeSvg.insert(() => iconNode, ":first-child"); + const outerShape = shapeSvg.insert(() => outerNode); + if (node2.icon) { + const iconElem = shapeSvg.append("g"); + iconElem.html( + `${await getIconSVG(node2.icon, { + height: iconSize, + width: iconSize, + fallbackPrefix: "" + })}` + ); + const iconBBox = iconElem.node().getBBox(); + const iconWidth = iconBBox.width; + const iconHeight = iconBBox.height; + const iconX = iconBBox.x; + const iconY = iconBBox.y; + iconElem.attr( + "transform", + `translate(${-iconWidth / 2 - iconX},${topLabel ? bbox.height / 2 + labelPadding / 2 - iconHeight / 2 - iconY : -bbox.height / 2 - labelPadding / 2 - iconHeight / 2 - iconY})` + ); + iconElem.attr("style", `color: ${stylesMap.get("stroke") ?? nodeBorder};`); + } + label.attr( + "transform", + `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -outerHeight / 2 : outerHeight / 2 - bbox.height})` + ); + iconShape.attr( + "transform", + `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})` + ); + updateNodeBounds(node2, outerShape); + node2.intersect = function(point8) { + log.info("iconSquare intersect", node2, point8); + if (!node2.label) { + return intersect_default.rect(node2, point8); + } + const dx = node2.x ?? 0; + const dy = node2.y ?? 0; + const nodeHeight = node2.height ?? 0; + let points = []; + if (topLabel) { + points = [ + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx + width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx + width3 / 2, y: dy + nodeHeight / 2 }, + { x: dx - width3 / 2, y: dy + nodeHeight / 2 }, + { x: dx - width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding } + ]; + } else { + points = [ + { x: dx - width3 / 2, y: dy - nodeHeight / 2 }, + { x: dx + width3 / 2, y: dy - nodeHeight / 2 }, + { x: dx + width3 / 2, y: dy - nodeHeight / 2 + height2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + height2 }, + { x: dx + bbox.width / 2 / 2, y: dy + nodeHeight / 2 }, + { x: dx - bbox.width / 2, y: dy + nodeHeight / 2 }, + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + height2 }, + { x: dx - width3 / 2, y: dy - nodeHeight / 2 + height2 } + ]; + } + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_icon = __esm({ + "src/rendering-util/rendering-elements/shapes/icon.ts"() { + "use strict"; + init_rough_esm(); + init_logger(); + init_icons(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(icon, "icon"); + } + }); + + // src/rendering-util/rendering-elements/shapes/iconCircle.ts + async function iconCircle(parent4, node2, { config: { themeVariables, flowchart } }) { + const { labelStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const assetHeight = node2.assetHeight ?? 48; + const assetWidth = node2.assetWidth ?? 48; + const iconSize = Math.max(assetHeight, assetWidth); + const defaultWidth = flowchart?.wrappingWidth; + node2.width = Math.max(iconSize, defaultWidth ?? 0); + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, "icon-shape default"); + const padding2 = 20; + const labelPadding = node2.label ? 8 : 0; + const topLabel = node2.pos === "t"; + const { nodeBorder, mainBkg } = themeVariables; + const { stylesMap } = compileStyles(node2); + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const fill = stylesMap.get("fill"); + options2.stroke = fill ?? mainBkg; + const iconElem = shapeSvg.append("g"); + if (node2.icon) { + iconElem.html( + `${await getIconSVG(node2.icon, { + height: iconSize, + width: iconSize, + fallbackPrefix: "" + })}` + ); + } + const iconBBox = iconElem.node().getBBox(); + const iconWidth = iconBBox.width; + const iconHeight = iconBBox.height; + const iconX = iconBBox.x; + const iconY = iconBBox.y; + const diameter = Math.max(iconWidth, iconHeight) * Math.SQRT2 + padding2 * 2; + const iconNode = rc.circle(0, 0, diameter, options2); + const outerWidth = Math.max(diameter, bbox.width); + const outerHeight = diameter + bbox.height + labelPadding; + const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, { + ...options2, + fill: "transparent", + stroke: "none" + }); + const iconShape = shapeSvg.insert(() => iconNode, ":first-child"); + const outerShape = shapeSvg.insert(() => outerNode); + iconElem.attr( + "transform", + `translate(${-iconWidth / 2 - iconX},${topLabel ? bbox.height / 2 + labelPadding / 2 - iconHeight / 2 - iconY : -bbox.height / 2 - labelPadding / 2 - iconHeight / 2 - iconY})` + ); + iconElem.attr("style", `color: ${stylesMap.get("stroke") ?? nodeBorder};`); + label.attr( + "transform", + `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -outerHeight / 2 : outerHeight / 2 - bbox.height})` + ); + iconShape.attr( + "transform", + `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})` + ); + updateNodeBounds(node2, outerShape); + node2.intersect = function(point8) { + log.info("iconSquare intersect", node2, point8); + const pos = intersect_default.rect(node2, point8); + return pos; + }; + return shapeSvg; + } + var init_iconCircle = __esm({ + "src/rendering-util/rendering-elements/shapes/iconCircle.ts"() { + "use strict"; + init_rough_esm(); + init_logger(); + init_icons(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(iconCircle, "iconCircle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/iconRounded.ts + async function iconRounded(parent4, node2, { config: { themeVariables, flowchart } }) { + const { labelStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const assetHeight = node2.assetHeight ?? 48; + const assetWidth = node2.assetWidth ?? 48; + const iconSize = Math.max(assetHeight, assetWidth); + const defaultWidth = flowchart?.wrappingWidth; + node2.width = Math.max(iconSize, defaultWidth ?? 0); + const { shapeSvg, bbox, halfPadding, label } = await labelHelper( + parent4, + node2, + "icon-shape default" + ); + const topLabel = node2.pos === "t"; + const height2 = iconSize + halfPadding * 2; + const width3 = iconSize + halfPadding * 2; + const { nodeBorder, mainBkg } = themeVariables; + const { stylesMap } = compileStyles(node2); + const x5 = -width3 / 2; + const y6 = -height2 / 2; + const labelPadding = node2.label ? 8 : 0; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const fill = stylesMap.get("fill"); + options2.stroke = fill ?? mainBkg; + const iconNode = rc.path(createRoundedRectPathD(x5, y6, width3, height2, 5), options2); + const outerWidth = Math.max(width3, bbox.width); + const outerHeight = height2 + bbox.height + labelPadding; + const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, { + ...options2, + fill: "transparent", + stroke: "none" + }); + const iconShape = shapeSvg.insert(() => iconNode, ":first-child").attr("class", "icon-shape2"); + const outerShape = shapeSvg.insert(() => outerNode); + if (node2.icon) { + const iconElem = shapeSvg.append("g"); + iconElem.html( + `${await getIconSVG(node2.icon, { + height: iconSize, + width: iconSize, + fallbackPrefix: "" + })}` + ); + const iconBBox = iconElem.node().getBBox(); + const iconWidth = iconBBox.width; + const iconHeight = iconBBox.height; + const iconX = iconBBox.x; + const iconY = iconBBox.y; + iconElem.attr( + "transform", + `translate(${-iconWidth / 2 - iconX},${topLabel ? bbox.height / 2 + labelPadding / 2 - iconHeight / 2 - iconY : -bbox.height / 2 - labelPadding / 2 - iconHeight / 2 - iconY})` + ); + iconElem.attr("style", `color: ${stylesMap.get("stroke") ?? nodeBorder};`); + } + label.attr( + "transform", + `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -outerHeight / 2 : outerHeight / 2 - bbox.height})` + ); + iconShape.attr( + "transform", + `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})` + ); + updateNodeBounds(node2, outerShape); + node2.intersect = function(point8) { + log.info("iconSquare intersect", node2, point8); + if (!node2.label) { + return intersect_default.rect(node2, point8); + } + const dx = node2.x ?? 0; + const dy = node2.y ?? 0; + const nodeHeight = node2.height ?? 0; + let points = []; + if (topLabel) { + points = [ + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx + width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx + width3 / 2, y: dy + nodeHeight / 2 }, + { x: dx - width3 / 2, y: dy + nodeHeight / 2 }, + { x: dx - width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding } + ]; + } else { + points = [ + { x: dx - width3 / 2, y: dy - nodeHeight / 2 }, + { x: dx + width3 / 2, y: dy - nodeHeight / 2 }, + { x: dx + width3 / 2, y: dy - nodeHeight / 2 + height2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + height2 }, + { x: dx + bbox.width / 2 / 2, y: dy + nodeHeight / 2 }, + { x: dx - bbox.width / 2, y: dy + nodeHeight / 2 }, + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + height2 }, + { x: dx - width3 / 2, y: dy - nodeHeight / 2 + height2 } + ]; + } + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_iconRounded = __esm({ + "src/rendering-util/rendering-elements/shapes/iconRounded.ts"() { + "use strict"; + init_rough_esm(); + init_logger(); + init_icons(); + init_intersect(); + init_handDrawnShapeStyles(); + init_roundedRectPath(); + init_util(); + __name(iconRounded, "iconRounded"); + } + }); + + // src/rendering-util/rendering-elements/shapes/iconSquare.ts + async function iconSquare(parent4, node2, { config: { themeVariables, flowchart } }) { + const { labelStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const assetHeight = node2.assetHeight ?? 48; + const assetWidth = node2.assetWidth ?? 48; + const iconSize = Math.max(assetHeight, assetWidth); + const defaultWidth = flowchart?.wrappingWidth; + node2.width = Math.max(iconSize, defaultWidth ?? 0); + const { shapeSvg, bbox, halfPadding, label } = await labelHelper( + parent4, + node2, + "icon-shape default" + ); + const topLabel = node2.pos === "t"; + const height2 = iconSize + halfPadding * 2; + const width3 = iconSize + halfPadding * 2; + const { nodeBorder, mainBkg } = themeVariables; + const { stylesMap } = compileStyles(node2); + const x5 = -width3 / 2; + const y6 = -height2 / 2; + const labelPadding = node2.label ? 8 : 0; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const fill = stylesMap.get("fill"); + options2.stroke = fill ?? mainBkg; + const iconNode = rc.path(createRoundedRectPathD(x5, y6, width3, height2, 0.1), options2); + const outerWidth = Math.max(width3, bbox.width); + const outerHeight = height2 + bbox.height + labelPadding; + const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, { + ...options2, + fill: "transparent", + stroke: "none" + }); + const iconShape = shapeSvg.insert(() => iconNode, ":first-child"); + const outerShape = shapeSvg.insert(() => outerNode); + if (node2.icon) { + const iconElem = shapeSvg.append("g"); + iconElem.html( + `${await getIconSVG(node2.icon, { + height: iconSize, + width: iconSize, + fallbackPrefix: "" + })}` + ); + const iconBBox = iconElem.node().getBBox(); + const iconWidth = iconBBox.width; + const iconHeight = iconBBox.height; + const iconX = iconBBox.x; + const iconY = iconBBox.y; + iconElem.attr( + "transform", + `translate(${-iconWidth / 2 - iconX},${topLabel ? bbox.height / 2 + labelPadding / 2 - iconHeight / 2 - iconY : -bbox.height / 2 - labelPadding / 2 - iconHeight / 2 - iconY})` + ); + iconElem.attr("style", `color: ${stylesMap.get("stroke") ?? nodeBorder};`); + } + label.attr( + "transform", + `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -outerHeight / 2 : outerHeight / 2 - bbox.height})` + ); + iconShape.attr( + "transform", + `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})` + ); + updateNodeBounds(node2, outerShape); + node2.intersect = function(point8) { + log.info("iconSquare intersect", node2, point8); + if (!node2.label) { + return intersect_default.rect(node2, point8); + } + const dx = node2.x ?? 0; + const dy = node2.y ?? 0; + const nodeHeight = node2.height ?? 0; + let points = []; + if (topLabel) { + points = [ + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx + width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx + width3 / 2, y: dy + nodeHeight / 2 }, + { x: dx - width3 / 2, y: dy + nodeHeight / 2 }, + { x: dx - width3 / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding } + ]; + } else { + points = [ + { x: dx - width3 / 2, y: dy - nodeHeight / 2 }, + { x: dx + width3 / 2, y: dy - nodeHeight / 2 }, + { x: dx + width3 / 2, y: dy - nodeHeight / 2 + height2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + height2 }, + { x: dx + bbox.width / 2 / 2, y: dy + nodeHeight / 2 }, + { x: dx - bbox.width / 2, y: dy + nodeHeight / 2 }, + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + height2 }, + { x: dx - width3 / 2, y: dy - nodeHeight / 2 + height2 } + ]; + } + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_iconSquare = __esm({ + "src/rendering-util/rendering-elements/shapes/iconSquare.ts"() { + "use strict"; + init_rough_esm(); + init_logger(); + init_icons(); + init_intersect(); + init_roundedRectPath(); + init_handDrawnShapeStyles(); + init_util(); + __name(iconSquare, "iconSquare"); + } + }); + + // src/rendering-util/rendering-elements/shapes/imageSquare.ts + async function imageSquare(parent4, node2, { config: { flowchart } }) { + const img = new Image(); + img.src = node2?.img ?? ""; + await img.decode(); + const imageNaturalWidth = Number(img.naturalWidth.toString().replace("px", "")); + const imageNaturalHeight = Number(img.naturalHeight.toString().replace("px", "")); + node2.imageAspectRatio = imageNaturalWidth / imageNaturalHeight; + const { labelStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const defaultWidth = flowchart?.wrappingWidth; + node2.defaultWidth = flowchart?.wrappingWidth; + const imageRawWidth = Math.max( + node2.label ? defaultWidth ?? 0 : 0, + node2?.assetWidth ?? imageNaturalWidth + ); + const imageWidth = node2.constraint === "on" ? node2?.assetHeight ? node2.assetHeight * node2.imageAspectRatio : imageRawWidth : imageRawWidth; + const imageHeight = node2.constraint === "on" ? imageWidth / node2.imageAspectRatio : node2?.assetHeight ?? imageNaturalHeight; + node2.width = Math.max(imageWidth, defaultWidth ?? 0); + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, "image-shape default"); + const topLabel = node2.pos === "t"; + const x5 = -imageWidth / 2; + const y6 = -imageHeight / 2; + const labelPadding = node2.label ? 8 : 0; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const imageNode = rc.rectangle(x5, y6, imageWidth, imageHeight, options2); + const outerWidth = Math.max(imageWidth, bbox.width); + const outerHeight = imageHeight + bbox.height + labelPadding; + const outerNode = rc.rectangle(-outerWidth / 2, -outerHeight / 2, outerWidth, outerHeight, { + ...options2, + fill: "none", + stroke: "none" + }); + const iconShape = shapeSvg.insert(() => imageNode, ":first-child"); + const outerShape = shapeSvg.insert(() => outerNode); + if (node2.img) { + const image = shapeSvg.append("image"); + image.attr("href", node2.img); + image.attr("width", imageWidth); + image.attr("height", imageHeight); + image.attr("preserveAspectRatio", "none"); + image.attr( + "transform", + `translate(${-imageWidth / 2},${topLabel ? outerHeight / 2 - imageHeight : -outerHeight / 2})` + ); + } + label.attr( + "transform", + `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))},${topLabel ? -imageHeight / 2 - bbox.height / 2 - labelPadding / 2 : imageHeight / 2 - bbox.height / 2 + labelPadding / 2})` + ); + iconShape.attr( + "transform", + `translate(${0},${topLabel ? bbox.height / 2 + labelPadding / 2 : -bbox.height / 2 - labelPadding / 2})` + ); + updateNodeBounds(node2, outerShape); + node2.intersect = function(point8) { + log.info("iconSquare intersect", node2, point8); + if (!node2.label) { + return intersect_default.rect(node2, point8); + } + const dx = node2.x ?? 0; + const dy = node2.y ?? 0; + const nodeHeight = node2.height ?? 0; + let points = []; + if (topLabel) { + points = [ + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx + imageWidth / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx + imageWidth / 2, y: dy + nodeHeight / 2 }, + { x: dx - imageWidth / 2, y: dy + nodeHeight / 2 }, + { x: dx - imageWidth / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding }, + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + bbox.height + labelPadding } + ]; + } else { + points = [ + { x: dx - imageWidth / 2, y: dy - nodeHeight / 2 }, + { x: dx + imageWidth / 2, y: dy - nodeHeight / 2 }, + { x: dx + imageWidth / 2, y: dy - nodeHeight / 2 + imageHeight }, + { x: dx + bbox.width / 2, y: dy - nodeHeight / 2 + imageHeight }, + { x: dx + bbox.width / 2 / 2, y: dy + nodeHeight / 2 }, + { x: dx - bbox.width / 2, y: dy + nodeHeight / 2 }, + { x: dx - bbox.width / 2, y: dy - nodeHeight / 2 + imageHeight }, + { x: dx - imageWidth / 2, y: dy - nodeHeight / 2 + imageHeight } + ]; + } + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_imageSquare = __esm({ + "src/rendering-util/rendering-elements/shapes/imageSquare.ts"() { + "use strict"; + init_rough_esm(); + init_logger(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(imageSquare, "imageSquare"); + } + }); + + // src/rendering-util/rendering-elements/shapes/invertedTrapezoid.ts + async function inv_trapezoid(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingY = nodePadding; + const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = Math.max(bbox.width + (labelPaddingX ?? 0) * 2, node2?.width ?? 0); + const h3 = Math.max(bbox.height + (labelPaddingY ?? 0) * 2, node2?.height ?? 0); + const points = [ + { x: 0, y: 0 }, + { x: w4, y: 0 }, + { x: w4 + 3 * h3 / 6, y: -h3 }, + { x: -3 * h3 / 6, y: -h3 } + ]; + let polygon2; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const pathData = createPathFromPoints(points); + const roughNode = rc.path(pathData, options2); + polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`); + if (cssStyles) { + polygon2.attr("style", cssStyles); + } + } else { + polygon2 = insertPolygonShape(shapeSvg, w4, h3, points); + } + if (nodeStyles) { + polygon2.attr("style", nodeStyles); + } + node2.width = w4; + node2.height = h3; + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var init_invertedTrapezoid = __esm({ + "src/rendering-util/rendering-elements/shapes/invertedTrapezoid.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_insertPolygonShape(); + __name(inv_trapezoid, "inv_trapezoid"); + } + }); + + // src/rendering-util/rendering-elements/shapes/labelRect.ts + async function labelRect(parent4, node2) { + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, "label"); + const rect3 = shapeSvg.insert("rect", ":first-child"); + const totalWidth = 0.1; + const totalHeight = 0.1; + rect3.attr("width", totalWidth).attr("height", totalHeight); + shapeSvg.attr("class", "label edgeLabel"); + label.attr( + "transform", + `translate(${-(bbox.width / 2) - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, rect3); + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_labelRect = __esm({ + "src/rendering-util/rendering-elements/shapes/labelRect.ts"() { + "use strict"; + init_drawRect(); + init_util(); + init_intersect(); + __name(labelRect, "labelRect"); + } + }); + + // src/rendering-util/rendering-elements/shapes/leanLeft.ts + async function lean_left(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingY = nodePadding; + const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const h3 = (node2?.height ?? bbox.height) + labelPaddingY; + const w4 = (node2?.width ?? bbox.width) + labelPaddingX; + const points = [ + { x: 0, y: 0 }, + { x: w4 + 3 * h3 / 6, y: 0 }, + { x: w4, y: -h3 }, + { x: -(3 * h3) / 6, y: -h3 } + ]; + let polygon2; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const pathData = createPathFromPoints(points); + const roughNode = rc.path(pathData, options2); + polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`); + if (cssStyles) { + polygon2.attr("style", cssStyles); + } + } else { + polygon2 = insertPolygonShape(shapeSvg, w4, h3, points); + } + if (nodeStyles) { + polygon2.attr("style", nodeStyles); + } + node2.width = w4; + node2.height = h3; + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var init_leanLeft = __esm({ + "src/rendering-util/rendering-elements/shapes/leanLeft.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_insertPolygonShape(); + __name(lean_left, "lean_left"); + } + }); + + // src/rendering-util/rendering-elements/shapes/leanRight.ts + async function lean_right(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingY = nodePadding; + const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const h3 = (node2?.height ?? bbox.height) + labelPaddingY; + const w4 = (node2?.width ?? bbox.width) + labelPaddingX; + const points = [ + { x: -3 * h3 / 6, y: 0 }, + { x: w4, y: 0 }, + { x: w4 + 3 * h3 / 6, y: -h3 }, + { x: 0, y: -h3 } + ]; + let polygon2; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const pathData = createPathFromPoints(points); + const roughNode = rc.path(pathData, options2); + polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`); + if (cssStyles) { + polygon2.attr("style", cssStyles); + } + } else { + polygon2 = insertPolygonShape(shapeSvg, w4, h3, points); + } + if (nodeStyles) { + polygon2.attr("style", nodeStyles); + } + node2.width = w4; + node2.height = h3; + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var init_leanRight = __esm({ + "src/rendering-util/rendering-elements/shapes/leanRight.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_insertPolygonShape(); + __name(lean_right, "lean_right"); + } + }); + + // src/rendering-util/rendering-elements/shapes/lightningBolt.ts + function lightningBolt(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.label = ""; + node2.labelStyle = labelStyles; + const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId ?? node2.id); + const { cssStyles } = node2; + const width3 = Math.max(35, node2?.width ?? 0); + const height2 = Math.max(35, node2?.height ?? 0); + const gap = 7; + const points = [ + { x: width3, y: 0 }, + { x: 0, y: height2 + gap / 2 }, + { x: width3 - 2 * gap, y: height2 + gap / 2 }, + { x: 0, y: 2 * height2 }, + { x: width3, y: height2 - gap / 2 }, + { x: 2 * gap, y: height2 - gap / 2 } + ]; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const linePath = createPathFromPoints(points); + const lineNode = rc.path(linePath, options2); + const lightningBolt2 = shapeSvg.insert(() => lineNode, ":first-child"); + lightningBolt2.attr("class", "outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + lightningBolt2.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + lightningBolt2.selectAll("path").attr("style", nodeStyles); + } + lightningBolt2.attr("transform", `translate(-${width3 / 2},${-height2})`); + updateNodeBounds(node2, lightningBolt2); + node2.intersect = function(point8) { + log.info("lightningBolt intersect", node2, point8); + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_lightningBolt = __esm({ + "src/rendering-util/rendering-elements/shapes/lightningBolt.ts"() { + "use strict"; + init_logger(); + init_util(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_intersect(); + init_util(); + __name(lightningBolt, "lightningBolt"); + } + }); + + // src/rendering-util/rendering-elements/shapes/linedCylinder.ts + async function linedCylinder(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 24 : nodePadding; + if (node2.width || node2.height) { + const originalWidth = node2.width ?? 0; + node2.width = (node2.width ?? 0) - labelPaddingX; + if (node2.width < MIN_WIDTH3) { + node2.width = MIN_WIDTH3; + } + const rx2 = originalWidth / 2; + const ry2 = rx2 / (2.5 + originalWidth / 50); + node2.height = (node2.height ?? 0) - labelPaddingY - ry2 * 3; + if (node2.height < MIN_HEIGHT3) { + node2.height = MIN_HEIGHT3; + } + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2; + const rx = w4 / 2; + const ry = rx / (2.5 + w4 / 50); + const h3 = (node2?.height ? node2?.height : bbox.height) + ry + labelPaddingY * 2; + const outerOffset = h3 * 0.1; + let cylinder3; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const outerPathData = createOuterCylinderPathD2(0, 0, w4, h3, rx, ry, outerOffset); + const innerPathData = createInnerCylinderPathD2(0, ry, w4, h3, rx, ry); + const options2 = userNodeOverrides(node2, {}); + const outerNode = rc.path(outerPathData, options2); + const innerLine = rc.path(innerPathData, options2); + const innerLineEl = shapeSvg.insert(() => innerLine, ":first-child"); + innerLineEl.attr("class", "line"); + cylinder3 = shapeSvg.insert(() => outerNode, ":first-child"); + cylinder3.attr("class", "basic label-container"); + if (cssStyles) { + cylinder3.attr("style", cssStyles); + } + } else { + const pathData = createCylinderPathD2(0, 0, w4, h3, rx, ry, outerOffset); + cylinder3 = shapeSvg.insert("path", ":first-child").attr("d", pathData).attr("class", "basic label-container outer-path").attr("style", handleUndefinedAttr(cssStyles)).attr("style", nodeStyles); + } + cylinder3.attr("label-offset-y", ry); + cylinder3.attr("transform", `translate(${-w4 / 2}, ${-(h3 / 2 + ry)})`); + updateNodeBounds(node2, cylinder3); + label.attr( + "transform", + `translate(${-(bbox.width / 2) - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + ry - (bbox.y - (bbox.top ?? 0))})` + ); + node2.intersect = function(point8) { + const pos = intersect_default.rect(node2, point8); + const x5 = pos.x - (node2.x ?? 0); + if (rx != 0 && (Math.abs(x5) < (node2.width ?? 0) / 2 || Math.abs(x5) == (node2.width ?? 0) / 2 && Math.abs(pos.y - (node2.y ?? 0)) > (node2.height ?? 0) / 2 - ry)) { + let y6 = ry * ry * (1 - x5 * x5 / (rx * rx)); + if (y6 > 0) { + y6 = Math.sqrt(y6); + } + y6 = ry - y6; + if (point8.y - (node2.y ?? 0) > 0) { + y6 = -y6; + } + pos.y += y6; + } + return pos; + }; + return shapeSvg; + } + var createCylinderPathD2, createOuterCylinderPathD2, createInnerCylinderPathD2, MIN_HEIGHT3, MIN_WIDTH3; + var init_linedCylinder = __esm({ + "src/rendering-util/rendering-elements/shapes/linedCylinder.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_utils2(); + createCylinderPathD2 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry, outerOffset) => { + return [ + `M${x5},${y6 + ry}`, + `a${rx},${ry} 0,0,0 ${width3},0`, + `a${rx},${ry} 0,0,0 ${-width3},0`, + `l0,${height2}`, + `a${rx},${ry} 0,0,0 ${width3},0`, + `l0,${-height2}`, + `M${x5},${y6 + ry + outerOffset}`, + `a${rx},${ry} 0,0,0 ${width3},0` + ].join(" "); + }, "createCylinderPathD"); + createOuterCylinderPathD2 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry, outerOffset) => { + return [ + `M${x5},${y6 + ry}`, + `M${x5 + width3},${y6 + ry}`, + `a${rx},${ry} 0,0,0 ${-width3},0`, + `l0,${height2}`, + `a${rx},${ry} 0,0,0 ${width3},0`, + `l0,${-height2}`, + `M${x5},${y6 + ry + outerOffset}`, + `a${rx},${ry} 0,0,0 ${width3},0` + ].join(" "); + }, "createOuterCylinderPathD"); + createInnerCylinderPathD2 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => { + return [`M${x5 - width3 / 2},${-height2 / 2}`, `a${rx},${ry} 0,0,0 ${width3},0`].join(" "); + }, "createInnerCylinderPathD"); + MIN_HEIGHT3 = 10; + MIN_WIDTH3 = 10; + __name(linedCylinder, "linedCylinder"); + } + }); + + // src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts + async function linedWaveEdgedRect(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + if (node2.width || node2.height) { + const originalWidth = node2.width; + node2.width = (originalWidth ?? 0) * 10 / 11 - labelPaddingX * 2; + if (node2.width < 10) { + node2.width = 10; + } + node2.height = (node2?.height ?? 0) - labelPaddingY * 2; + if (node2.height < 10) { + node2.height = 10; + } + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2?.width ? node2?.width : bbox.width) + (labelPaddingX ?? 0) * 2; + const h3 = (node2?.height ? node2?.height : bbox.height) + (labelPaddingY ?? 0) * 2; + const waveAmplitude = node2.look === "neo" ? h3 / 4 : h3 / 8; + const finalH = h3 + waveAmplitude; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: -w4 / 2 - w4 / 2 * 0.1, y: -finalH / 2 }, + { x: -w4 / 2 - w4 / 2 * 0.1, y: finalH / 2 }, + ...generateFullSineWavePoints( + -w4 / 2 - w4 / 2 * 0.1, + finalH / 2, + w4 / 2 + w4 / 2 * 0.1, + finalH / 2, + waveAmplitude, + 0.8 + ), + { x: w4 / 2 + w4 / 2 * 0.1, y: -finalH / 2 }, + { x: -w4 / 2 - w4 / 2 * 0.1, y: -finalH / 2 }, + { x: -w4 / 2, y: -finalH / 2 }, + { x: -w4 / 2, y: finalH / 2 * 1.1 }, + { x: -w4 / 2, y: -finalH / 2 } + ]; + const poly = rc.polygon( + points.map((p3) => [p3.x, p3.y]), + options2 + ); + const waveEdgeRect = shapeSvg.insert(() => poly, ":first-child"); + waveEdgeRect.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + waveEdgeRect.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + waveEdgeRect.selectAll("path").attr("style", nodeStyles); + } + waveEdgeRect.attr("transform", `translate(0,${-waveAmplitude / 2})`); + label.attr( + "transform", + `translate(${-w4 / 2 + (node2.padding ?? 0) + w4 / 2 * 0.1 / 2 - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, waveEdgeRect); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_linedWaveEdgedRect = __esm({ + "src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_rough_esm(); + init_handDrawnShapeStyles(); + __name(linedWaveEdgedRect, "linedWaveEdgedRect"); + } + }); + + // src/rendering-util/rendering-elements/shapes/multiRect.ts + async function multiRect(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + const rectOffset2 = node2.look === "neo" ? 10 : 5; + if (node2.width || node2.height) { + node2.width = Math.max((node2?.width ?? 0) - labelPaddingX * 2 - 2 * rectOffset2, 10); + node2.height = Math.max((node2?.height ?? 0) - labelPaddingY * 2 - 2 * rectOffset2, 10); + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalWidth = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2 + 2 * rectOffset2; + const totalHeight = (node2?.height ? node2?.height : bbox.height) + labelPaddingY * 2 + 2 * rectOffset2; + const w4 = totalWidth - 2 * rectOffset2; + const h3 = totalHeight - 2 * rectOffset2; + const x5 = -w4 / 2; + const y6 = -h3 / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const outerPathPoints = [ + { x: x5 - rectOffset2, y: y6 + rectOffset2 }, + { x: x5 - rectOffset2, y: y6 + h3 + rectOffset2 }, + { x: x5 + w4 - rectOffset2, y: y6 + h3 + rectOffset2 }, + { x: x5 + w4 - rectOffset2, y: y6 + h3 }, + { x: x5 + w4, y: y6 + h3 }, + { x: x5 + w4, y: y6 + h3 - rectOffset2 }, + { x: x5 + w4 + rectOffset2, y: y6 + h3 - rectOffset2 }, + { x: x5 + w4 + rectOffset2, y: y6 - rectOffset2 }, + { x: x5 + rectOffset2, y: y6 - rectOffset2 }, + { x: x5 + rectOffset2, y: y6 }, + { x: x5, y: y6 }, + { x: x5, y: y6 + rectOffset2 } + ]; + const innerPathPoints = [ + { x: x5, y: y6 + rectOffset2 }, + { x: x5 + w4 - rectOffset2, y: y6 + rectOffset2 }, + { x: x5 + w4 - rectOffset2, y: y6 + h3 }, + { x: x5 + w4, y: y6 + h3 }, + { x: x5 + w4, y: y6 }, + { x: x5, y: y6 } + ]; + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const outerPath = createPathFromPoints(outerPathPoints); + let outerNode = rc.path(outerPath, options2); + const innerPath3 = createPathFromPoints(innerPathPoints); + let innerNode = rc.path(innerPath3, options2); + if (node2.look !== "handDrawn") { + outerNode = mergePaths(outerNode); + innerNode = mergePaths(innerNode); + } + const multiRect2 = shapeSvg.insert("g", ":first-child"); + multiRect2.insert(() => outerNode); + multiRect2.insert(() => innerNode); + multiRect2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + multiRect2.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + multiRect2.selectAll("path").attr("style", nodeStyles); + } + label.attr( + "transform", + `translate(${-(bbox.width / 2) - rectOffset2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset2 - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, multiRect2); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, outerPathPoints, point8); + return pos; + }; + return shapeSvg; + } + var init_multiRect = __esm({ + "src/rendering-util/rendering-elements/shapes/multiRect.ts"() { + "use strict"; + init_util(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_intersect(); + __name(multiRect, "multiRect"); + } + }); + + // src/rendering-util/rendering-elements/shapes/multiWaveEdgedRectangle.ts + async function multiWaveEdgedRectangle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + let adjustFinalHeight = true; + if (node2.width || node2.height) { + adjustFinalHeight = false; + node2.width = (node2?.width ?? 0) - labelPaddingX * 2; + node2.height = (node2?.height ?? 0) - labelPaddingY * 3; + } + const w4 = Math.max(bbox.width, node2?.width ?? 0) + labelPaddingX * 2; + const h3 = Math.max(bbox.height, node2?.height ?? 0) + labelPaddingY * 3; + const waveAmplitude = node2.look === "neo" ? h3 / 4 : h3 / 8; + const finalH = h3 + (adjustFinalHeight ? waveAmplitude / 2 : -waveAmplitude / 2); + const x5 = -w4 / 2; + const y6 = -finalH / 2; + const rectOffset2 = 10; + const { cssStyles } = node2; + const wavePoints = generateFullSineWavePoints( + x5 - rectOffset2, + y6 + finalH + rectOffset2, + x5 + w4 - rectOffset2, + y6 + finalH + rectOffset2, + waveAmplitude, + 0.8 + ); + const lastWavePoint = wavePoints?.[wavePoints.length - 1]; + const outerPathPoints = [ + { x: x5 - rectOffset2, y: y6 + rectOffset2 }, + { x: x5 - rectOffset2, y: y6 + finalH + rectOffset2 }, + ...wavePoints, + { x: x5 + w4 - rectOffset2, y: lastWavePoint.y - rectOffset2 }, + { x: x5 + w4, y: lastWavePoint.y - rectOffset2 }, + { x: x5 + w4, y: lastWavePoint.y - 2 * rectOffset2 }, + { x: x5 + w4 + rectOffset2, y: lastWavePoint.y - 2 * rectOffset2 }, + { x: x5 + w4 + rectOffset2, y: y6 - rectOffset2 }, + { x: x5 + rectOffset2, y: y6 - rectOffset2 }, + { x: x5 + rectOffset2, y: y6 }, + { x: x5, y: y6 }, + { x: x5, y: y6 + rectOffset2 } + ]; + const innerPathPoints = [ + { x: x5, y: y6 + rectOffset2 }, + { x: x5 + w4 - rectOffset2, y: y6 + rectOffset2 }, + { x: x5 + w4 - rectOffset2, y: lastWavePoint.y - rectOffset2 }, + { x: x5 + w4, y: lastWavePoint.y - rectOffset2 }, + { x: x5 + w4, y: y6 }, + { x: x5, y: y6 } + ]; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const outerPath = createPathFromPoints(outerPathPoints); + const outerNode = rc.path(outerPath, options2); + const innerPath3 = createPathFromPoints(innerPathPoints); + const innerNode = rc.path(innerPath3, options2); + const shape = shapeSvg.insert(() => outerNode, ":first-child"); + shape.insert(() => innerNode); + shape.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + shape.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + shape.selectAll("path").attr("style", nodeStyles); + } + shape.attr("transform", `translate(0,${-waveAmplitude / 2})`); + label.attr( + "transform", + `translate(${-(bbox.width / 2) - rectOffset2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset2 - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, shape); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, outerPathPoints, point8); + return pos; + }; + return shapeSvg; + } + var init_multiWaveEdgedRectangle = __esm({ + "src/rendering-util/rendering-elements/shapes/multiWaveEdgedRectangle.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_rough_esm(); + init_handDrawnShapeStyles(); + __name(multiWaveEdgedRectangle, "multiWaveEdgedRectangle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/note.ts + async function note(parent4, node2, { config: { themeVariables } }) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const useHtmlLabels = node2.useHtmlLabels || getEffectiveHtmlLabels(getConfig()); + if (!useHtmlLabels) { + node2.centerLabel = true; + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalWidth = Math.max(bbox.width + (node2.padding ?? 0) * 2, node2?.width ?? 0); + const totalHeight = Math.max(bbox.height + (node2.padding ?? 0) * 2, node2?.height ?? 0); + const x5 = -totalWidth / 2; + const y6 = -totalHeight / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, { + fill: themeVariables.noteBkgColor, + stroke: themeVariables.noteBorderColor + }); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const noteShapeNode = rc.rectangle(x5, y6, totalWidth, totalHeight, options2); + const rect3 = shapeSvg.insert(() => noteShapeNode, ":first-child"); + rect3.attr("class", "basic label-container outer-path"); + label.attr("class", "label noteLabel"); + if (cssStyles && node2.look !== "handDrawn") { + rect3.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + rect3.selectAll("path").attr("style", nodeStyles); + } + label.attr( + "transform", + `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, rect3); + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_note = __esm({ + "src/rendering-util/rendering-elements/shapes/note.ts"() { + "use strict"; + init_rough_esm(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + init_config(); + init_config(); + __name(note, "note"); + } + }); + + // src/rendering-util/rendering-elements/shapes/question.ts + async function question(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = bbox.width + (node2.padding ?? 0); + const h3 = bbox.height + (node2.padding ?? 0); + const s2 = w4 + h3; + const adjustment = 0.5; + const points = [ + { x: s2 / 2, y: 0 }, + { x: s2, y: -s2 / 2 }, + { x: s2 / 2, y: -s2 }, + { x: 0, y: -s2 / 2 } + ]; + let polygon2; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const pathData = createDecisionBoxPathD(0, 0, s2); + const roughNode = rc.path(pathData, options2); + polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-s2 / 2 + adjustment}, ${s2 / 2})`); + if (cssStyles) { + polygon2.attr("style", cssStyles); + } + } else { + polygon2 = insertPolygonShape(shapeSvg, s2, s2, points); + polygon2.attr("transform", `translate(${-s2 / 2 + adjustment}, ${s2 / 2})`); + } + if (nodeStyles) { + polygon2.attr("style", nodeStyles); + } + updateNodeBounds(node2, polygon2); + node2.calcIntersect = function(bounds4, point8) { + const s3 = bounds4.width; + const points2 = [ + { x: s3 / 2, y: 0 }, + { x: s3, y: -s3 / 2 }, + { x: s3 / 2, y: -s3 }, + { x: 0, y: -s3 / 2 } + ]; + const res = intersect_default.polygon(bounds4, points2, point8); + return { x: res.x - 0.5, y: res.y - 0.5 }; + }; + node2.intersect = function(point8) { + return this.calcIntersect(node2, point8); + }; + return shapeSvg; + } + var createDecisionBoxPathD; + var init_question = __esm({ + "src/rendering-util/rendering-elements/shapes/question.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_insertPolygonShape(); + createDecisionBoxPathD = /* @__PURE__ */ __name((x5, y6, size4) => { + return [ + `M${x5 + size4 / 2},${y6}`, + `L${x5 + size4},${y6 - size4 / 2}`, + `L${x5 + size4 / 2},${y6 - size4}`, + `L${x5},${y6 - size4 / 2}`, + "Z" + ].join(" "); + }, "createDecisionBoxPathD"); + __name(question, "question"); + } + }); + + // src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts + async function rect_left_inv_arrow(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 21 : nodePadding ?? 0; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding ?? 0; + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2?.width ?? bbox.width) + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX); + const h3 = (node2?.height ?? bbox.height) + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY); + const x5 = -w4 / 2; + const y6 = -h3 / 2; + const notch = y6 / 2; + const points = [ + { x: x5 + notch, y: y6 }, + { x: x5, y: 0 }, + { x: x5 + notch, y: -y6 }, + { x: -x5, y: -y6 }, + { x: -x5, y: y6 } + ]; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const pathData = createPathFromPoints(points); + const roughNode = rc.path(pathData, options2); + const polygon2 = shapeSvg.insert(() => roughNode, ":first-child"); + polygon2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + polygon2.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + polygon2.selectAll("path").attr("style", nodeStyles); + } + polygon2.attr("transform", `translate(${-notch / 2},0)`); + label.attr( + "transform", + `translate(${-notch / 2 - bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var init_rectLeftInvArrow = __esm({ + "src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(rect_left_inv_arrow, "rect_left_inv_arrow"); + } + }); + + // src/rendering-util/rendering-elements/createLabel.js + var createLabel, createLabel_default; + var init_createLabel = __esm({ + "src/rendering-util/rendering-elements/createLabel.js"() { + "use strict"; + init_config(); + init_diagramAPI(); + init_createText(); + createLabel = /* @__PURE__ */ __name(async (element3, _vertexText, style3, isTitle = false, isNode2 = false) => { + let vertexText = _vertexText || ""; + if (typeof vertexText === "object") { + vertexText = vertexText[0]; + } + const config5 = getConfig2(); + const useHtmlLabels = getEffectiveHtmlLabels(config5); + return await createText( + element3, + vertexText, + { + style: style3, + isTitle, + useHtmlLabels, + markdown: false, + isNode: isNode2, + width: Number.POSITIVE_INFINITY + }, + config5 + ); + }, "createLabel"); + createLabel_default = createLabel; + } + }); + + // src/rendering-util/rendering-elements/shapes/rectWithTitle.ts + async function rectWithTitle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + let classes3; + if (!node2.cssClasses) { + classes3 = "node default"; + } else { + classes3 = "node " + node2.cssClasses; + } + const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId || node2.id); + const g2 = shapeSvg.insert("g"); + const label = shapeSvg.insert("g").attr("class", "label").attr("style", nodeStyles); + const description = node2.description; + const title2 = node2.label; + const text4 = await createLabel_default(label, title2, node2.labelStyle, true, true); + let bbox = { width: 0, height: 0 }; + if (getEffectiveHtmlLabels(getConfig2())) { + const div2 = text4.children[0]; + const dv2 = select_default2(text4); + bbox = div2.getBoundingClientRect(); + dv2.attr("width", bbox.width); + dv2.attr("height", bbox.height); + } + log.info("Text 2", description); + const textRows = description || []; + const titleBox = text4.getBBox(); + const descr = await createLabel_default( + label, + Array.isArray(textRows) ? textRows.join("
    ") : textRows, + node2.labelStyle, + true, + true + ); + const div = descr.children[0]; + const dv = select_default2(descr); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + const halfPadding = (node2.padding || 0) / 2; + select_default2(descr).attr( + "transform", + "translate( " + (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")" + ); + select_default2(text4).attr( + "transform", + "translate( " + (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)" + ); + bbox = label.node().getBBox(); + label.attr( + "transform", + "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")" + ); + const totalWidth = bbox.width + (node2.padding || 0); + const totalHeight = bbox.height + (node2.padding || 0); + const x5 = -bbox.width / 2 - halfPadding; + const y6 = -bbox.height / 2 - halfPadding; + let rect3; + let innerLine; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const roughNode = rc.path( + createRoundedRectPathD(x5, y6, totalWidth, totalHeight, node2.rx || 0), + options2 + ); + const roughLine = rc.line( + -bbox.width / 2 - halfPadding, + -bbox.height / 2 - halfPadding + titleBox.height + halfPadding, + bbox.width / 2 + halfPadding, + -bbox.height / 2 - halfPadding + titleBox.height + halfPadding, + options2 + ); + innerLine = shapeSvg.insert(() => { + log.debug("Rough node insert CXC", roughNode); + return roughLine; + }, ":first-child"); + rect3 = shapeSvg.insert(() => { + log.debug("Rough node insert CXC", roughNode); + return roughNode; + }, ":first-child"); + } else { + rect3 = g2.insert("rect", ":first-child"); + innerLine = g2.insert("line"); + rect3.attr("class", "outer title-state").attr("style", nodeStyles).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + (node2.padding || 0)).attr("height", bbox.height + (node2.padding || 0)); + innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding); + } + updateNodeBounds(node2, rect3); + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_rectWithTitle = __esm({ + "src/rendering-util/rendering-elements/shapes/rectWithTitle.ts"() { + "use strict"; + init_src32(); + init_util(); + init_createLabel(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_diagramAPI(); + init_roundedRectPath(); + init_logger(); + init_config(); + __name(rectWithTitle, "rectWithTitle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/roundedRect.ts + async function roundedRect(parent4, node2, { config: { themeVariables } }) { + const radius2 = themeVariables?.radius ?? 5; + const options2 = { + rx: radius2, + ry: radius2, + classes: "", + labelPaddingX: (node2?.padding ?? 0) * 1, + labelPaddingY: (node2?.padding ?? 0) * 1 + }; + return drawRect3(parent4, node2, options2); + } + var init_roundedRect = __esm({ + "src/rendering-util/rendering-elements/shapes/roundedRect.ts"() { + "use strict"; + init_drawRect(); + __name(roundedRect, "roundedRect"); + } + }); + + // src/rendering-util/rendering-elements/shapes/shadedProcess.ts + async function shadedProcess(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const paddingX = node2.look === "neo" ? 16 : node2.padding ?? 0; + const paddingY = node2.look === "neo" ? 12 : node2.padding ?? 0; + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalWidth = (node2?.width ?? bbox.width) + paddingX * 2 + (node2.look === "neo" ? FRAME_WIDTH : FRAME_WIDTH * 2); + const totalHeight = (node2?.height ?? bbox.height) + paddingY * 2; + const w4 = totalWidth - FRAME_WIDTH; + const h3 = totalHeight; + const x5 = FRAME_WIDTH - totalWidth / 2; + const y6 = -totalHeight / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: x5, y: y6 }, + { x: x5 + w4, y: y6 }, + { x: x5 + w4, y: y6 + h3 }, + { x: x5 - FRAME_WIDTH, y: y6 + h3 }, + { x: x5 - FRAME_WIDTH, y: y6 }, + { x: x5, y: y6 }, + { x: x5, y: y6 + h3 } + ]; + const roughNode = rc.polygon( + points.map((p3) => [p3.x, p3.y]), + options2 + ); + const rect3 = shapeSvg.insert(() => roughNode, ":first-child"); + rect3.attr("class", "basic label-container outer-path").attr("style", handleUndefinedAttr(cssStyles)); + if (nodeStyles && node2.look !== "handDrawn") { + rect3.selectAll("path").attr("style", nodeStyles); + } + if (cssStyles && node2.look !== "handDrawn") { + rect3.selectAll("path").attr("style", nodeStyles); + } + label.attr( + "transform", + `translate(${FRAME_WIDTH / 2 - bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, rect3); + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var FRAME_WIDTH; + var init_shadedProcess = __esm({ + "src/rendering-util/rendering-elements/shapes/shadedProcess.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_utils2(); + FRAME_WIDTH = 8; + __name(shadedProcess, "shadedProcess"); + } + }); + + // src/rendering-util/rendering-elements/shapes/slopedRect.ts + async function slopedRect(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + if (node2.width || node2.height) { + node2.width = Math.max((node2?.width ?? 0) - labelPaddingX * 2, 10); + node2.height = Math.max((node2?.height ?? 0) / 1.5 - labelPaddingY * 2, 10); + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalWidth = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2; + const totalHeight = ((node2?.height ? node2?.height : bbox.height) + labelPaddingY * 2) * 1.5; + const w4 = totalWidth; + const h3 = totalHeight / 1.5; + const x5 = -w4 / 2; + const y6 = -h3 / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: x5, y: y6 }, + { x: x5, y: y6 + h3 }, + { x: x5 + w4, y: y6 + h3 }, + { x: x5 + w4, y: y6 - h3 / 2 } + ]; + const pathData = createPathFromPoints(points); + const shapeNode = rc.path(pathData, options2); + const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child"); + polygon2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", nodeStyles); + } + polygon2.attr("transform", `translate(0, ${h3 / 4})`); + label.attr( + "transform", + `translate(${-w4 / 2 + (node2.padding ?? 0) - (bbox.x - (bbox.left ?? 0))}, ${-h3 / 4 + (node2.padding ?? 0) - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_slopedRect = __esm({ + "src/rendering-util/rendering-elements/shapes/slopedRect.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(slopedRect, "slopedRect"); + } + }); + + // src/rendering-util/rendering-elements/shapes/squareRect.ts + async function squareRect(parent4, node2) { + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding * 2; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + const options2 = { + rx: 0, + ry: 0, + classes: "", + labelPaddingX: node2.labelPaddingX ?? labelPaddingX, + labelPaddingY + }; + return drawRect3(parent4, node2, options2); + } + var init_squareRect = __esm({ + "src/rendering-util/rendering-elements/shapes/squareRect.ts"() { + "use strict"; + init_drawRect(); + __name(squareRect, "squareRect"); + } + }); + + // src/rendering-util/rendering-elements/shapes/stadium.ts + async function stadium(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 20 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const h3 = bbox.height + (node2.look === "neo" ? labelPaddingY * 2 : labelPaddingY); + const w4 = bbox.width + h3 / 4 + (node2.look === "neo" ? labelPaddingX * 2 : labelPaddingX); + const radius2 = h3 / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: -w4 / 2 + radius2, y: -h3 / 2 }, + { x: w4 / 2 - radius2, y: -h3 / 2 }, + ...generateCirclePoints(-w4 / 2 + radius2, 0, radius2, 50, 90, 270), + { x: w4 / 2 - radius2, y: h3 / 2 }, + ...generateCirclePoints(w4 / 2 - radius2, 0, radius2, 50, 270, 450) + ]; + const pathData = createPathFromPoints(points); + const shapeNode = rc.path(pathData, options2); + const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child"); + polygon2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", nodeStyles); + } + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_stadium = __esm({ + "src/rendering-util/rendering-elements/shapes/stadium.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(stadium, "stadium"); + } + }); + + // src/rendering-util/rendering-elements/shapes/state.ts + async function state(parent4, node2) { + const options2 = { + rx: node2.look === "neo" ? 3 : 5, + ry: node2.look === "neo" ? 3 : 5, + classes: "flowchart-node" + }; + return drawRect3(parent4, node2, options2); + } + var init_state = __esm({ + "src/rendering-util/rendering-elements/shapes/state.ts"() { + "use strict"; + init_drawRect(); + __name(state, "state"); + } + }); + + // src/rendering-util/rendering-elements/shapes/stateEnd.ts + function stateEnd(parent4, node2, { config: { themeVariables } }) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { cssStyles } = node2; + const { lineColor, stateBorder, nodeBorder, nodeShadow } = themeVariables; + if (node2.width || node2.height) { + if ((node2.width ?? 0) < 14) { + node2.width = 14; + } + if ((node2.height ?? 0) < 14) { + node2.height = 14; + } + } + if (!node2.width) { + node2.width = 14; + } + if (!node2.height) { + node2.height = 14; + } + const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId ?? node2.id); + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const roughNode = rc.circle(0, 0, node2.width, { + ...options2, + stroke: lineColor, + strokeWidth: 2 + }); + const innerFill = stateBorder ?? nodeBorder; + const innerNodeRadius = (node2.width ?? 0) * 5 / 14; + const roughInnerNode = rc.circle(0, 0, innerNodeRadius, { + ...options2, + fill: innerFill, + stroke: innerFill, + strokeWidth: 2, + fillStyle: "solid" + }); + const circle6 = shapeSvg.insert(() => roughNode, ":first-child"); + circle6.insert(() => roughInnerNode); + if (node2.look !== "handDrawn") { + circle6.attr("class", "outer-path"); + } + if (cssStyles) { + circle6.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles) { + circle6.selectAll("path").attr("style", nodeStyles); + } + if (node2.width < 25 && nodeShadow && node2.look !== "handDrawn") { + const svgId = parent4.node()?.ownerSVGElement?.id ?? ""; + const filterId = svgId ? `${svgId}-drop-shadow-small` : "drop-shadow-small"; + circle6.attr("style", `filter:url(#${filterId})`); + } + updateNodeBounds(node2, circle6); + node2.intersect = function(point8) { + return intersect_default.circle(node2, (node2.width ?? 0) / 2, point8); + }; + return shapeSvg; + } + var init_stateEnd = __esm({ + "src/rendering-util/rendering-elements/shapes/stateEnd.ts"() { + "use strict"; + init_rough_esm(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(stateEnd, "stateEnd"); + } + }); + + // src/rendering-util/rendering-elements/shapes/stateStart.ts + function stateStart(parent4, node2, { config: { themeVariables } }) { + const { lineColor, nodeShadow } = themeVariables; + if (node2.width || node2.height) { + if ((node2.width ?? 0) < 14) { + node2.width = 14; + } + if ((node2.height ?? 0) < 14) { + node2.height = 14; + } + } + if (!node2.width) { + node2.width = 14; + } + if (!node2.height) { + node2.height = 14; + } + const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id); + let circle6; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const roughNode = rc.circle(0, 0, node2.width, solidStateFill(lineColor)); + circle6 = shapeSvg.insert(() => roughNode); + circle6.attr("class", "state-start").attr("r", (node2.width ?? 7) / 2).attr("width", node2.width ?? 14).attr("height", node2.height ?? 14); + } else { + circle6 = shapeSvg.insert("circle", ":first-child"); + circle6.attr("class", "state-start").attr("r", (node2.width ?? 7) / 2).attr("width", node2.width ?? 14).attr("height", node2.height ?? 14); + } + if (node2.width < 25 && nodeShadow && node2.look !== "handDrawn") { + const svgId = parent4.node()?.ownerSVGElement?.id ?? ""; + const filterId = svgId ? `${svgId}-drop-shadow-small` : "drop-shadow-small"; + circle6.attr("style", `filter:url(#${filterId})`); + } + updateNodeBounds(node2, circle6); + node2.intersect = function(point8) { + return intersect_default.circle(node2, (node2.width ?? 7) / 2, point8); + }; + return shapeSvg; + } + var init_stateStart = __esm({ + "src/rendering-util/rendering-elements/shapes/stateStart.ts"() { + "use strict"; + init_rough_esm(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(stateStart, "stateStart"); + } + }); + + // src/rendering-util/rendering-elements/shapes/subroutine.ts + async function subroutine(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2?.padding ?? 8; + const labelPaddingX = node2.look === "neo" ? 28 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalWidth = (node2?.width ?? bbox.width) + 2 * FRAME_WIDTH2 + labelPaddingX; + const totalHeight = (node2?.height ?? bbox.height) + labelPaddingY; + const w4 = totalWidth - 2 * FRAME_WIDTH2; + const h3 = totalHeight; + const x5 = -totalWidth / 2; + const y6 = -totalHeight / 2; + const points = [ + { x: 0, y: 0 }, + { x: w4, y: 0 }, + { x: w4, y: -h3 }, + { x: 0, y: -h3 }, + { x: 0, y: 0 }, + { x: -8, y: 0 }, + { x: w4 + 8, y: 0 }, + { x: w4 + 8, y: -h3 }, + { x: -8, y: -h3 }, + { x: -8, y: 0 } + ]; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const roughNode = rc.rectangle(x5, y6, w4 + 16, h3, options2); + const l1 = rc.line(x5 + FRAME_WIDTH2, y6, x5 + FRAME_WIDTH2, y6 + h3, options2); + const l22 = rc.line(x5 + FRAME_WIDTH2 + w4, y6, x5 + FRAME_WIDTH2 + w4, y6 + h3, options2); + shapeSvg.insert(() => l1, ":first-child"); + shapeSvg.insert(() => l22, ":first-child"); + const rect3 = shapeSvg.insert(() => roughNode, ":first-child"); + const { cssStyles } = node2; + rect3.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles)); + updateNodeBounds(node2, rect3); + } else { + const el = insertPolygonShape(shapeSvg, w4, h3, points); + if (nodeStyles) { + el.attr("style", nodeStyles); + } + updateNodeBounds(node2, el); + } + node2.intersect = function(point8) { + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var FRAME_WIDTH2; + var init_subroutine = __esm({ + "src/rendering-util/rendering-elements/shapes/subroutine.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_insertPolygonShape(); + init_utils2(); + FRAME_WIDTH2 = 8; + __name(subroutine, "subroutine"); + } + }); + + // src/rendering-util/rendering-elements/shapes/taggedRect.ts + async function taggedRect(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + if (node2.width || node2.height) { + node2.height = Math.max((node2?.height ?? 0) - labelPaddingY * 2, 10); + node2.width = Math.max( + (node2?.width ?? 0) - labelPaddingX * 2 - TAG_RATIO * (node2.height + labelPaddingY * 2), + 10 + ); + } + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalHeight = (node2?.height ? node2?.height : bbox.height) + labelPaddingY * 2; + const tagWidth = TAG_RATIO * totalHeight; + const tagHeight = TAG_RATIO * totalHeight; + const totalWidth = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2 + tagWidth; + const w4 = totalWidth - tagWidth; + const h3 = totalHeight; + const x5 = -w4 / 2; + const y6 = -h3 / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const rectPoints = [ + { x: x5 - tagWidth / 2, y: y6 }, + { x: x5 + w4 + tagWidth / 2, y: y6 }, + { x: x5 + w4 + tagWidth / 2, y: y6 + h3 }, + { x: x5 - tagWidth / 2, y: y6 + h3 } + ]; + const tagPoints = [ + { x: x5 + w4 - tagWidth / 2, y: y6 + h3 }, + { x: x5 + w4 + tagWidth / 2, y: y6 + h3 }, + { x: x5 + w4 + tagWidth / 2, y: y6 + h3 - tagHeight } + ]; + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const rectPath = createPathFromPoints(rectPoints); + const rectNode = rc.path(rectPath, options2); + const tagPath = createPathFromPoints(tagPoints); + const tagNode = rc.path(tagPath, { ...options2, fillStyle: "solid" }); + const taggedRect2 = shapeSvg.insert(() => tagNode, ":first-child"); + taggedRect2.insert(() => rectNode, ":first-child"); + taggedRect2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + taggedRect2.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + taggedRect2.selectAll("path").attr("style", nodeStyles); + } + updateNodeBounds(node2, taggedRect2); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, rectPoints, point8); + return pos; + }; + return shapeSvg; + } + var TAG_RATIO; + var init_taggedRect = __esm({ + "src/rendering-util/rendering-elements/shapes/taggedRect.ts"() { + "use strict"; + init_util(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_intersect(); + TAG_RATIO = 0.2; + __name(taggedRect, "taggedRect"); + } + }); + + // src/rendering-util/rendering-elements/shapes/taggedWaveEdgedRectangle.ts + async function taggedWaveEdgedRectangle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = Math.max(bbox.width + (node2.padding ?? 0) * 2, node2?.width ?? 0); + const h3 = Math.max(bbox.height + (node2.padding ?? 0) * 2, node2?.height ?? 0); + const waveAmplitude = h3 / 8; + const tagWidth = 0.2 * w4; + const tagHeight = 0.2 * h3; + const finalH = h3 + waveAmplitude; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: -w4 / 2 - w4 / 2 * 0.1, y: finalH / 2 }, + ...generateFullSineWavePoints( + -w4 / 2 - w4 / 2 * 0.1, + finalH / 2, + w4 / 2 + w4 / 2 * 0.1, + finalH / 2, + waveAmplitude, + 0.8 + ), + { x: w4 / 2 + w4 / 2 * 0.1, y: -finalH / 2 }, + { x: -w4 / 2 - w4 / 2 * 0.1, y: -finalH / 2 } + ]; + const x5 = -w4 / 2 + w4 / 2 * 0.1; + const y6 = -finalH / 2 - tagHeight * 0.4; + const tagPoints = [ + { x: x5 + w4 - tagWidth, y: (y6 + h3) * 1.3 }, + { x: x5 + w4, y: y6 + h3 - tagHeight }, + { x: x5 + w4, y: (y6 + h3) * 0.9 }, + ...generateFullSineWavePoints( + x5 + w4, + (y6 + h3) * 1.25, + x5 + w4 - tagWidth, + (y6 + h3) * 1.3, + -h3 * 0.02, + 0.5 + ) + ]; + const waveEdgeRectPath = createPathFromPoints(points); + const waveEdgeRectNode = rc.path(waveEdgeRectPath, options2); + const taggedWaveEdgeRectPath = createPathFromPoints(tagPoints); + const taggedWaveEdgeRectNode = rc.path(taggedWaveEdgeRectPath, { + ...options2, + fillStyle: "solid" + }); + const waveEdgeRect = shapeSvg.insert(() => taggedWaveEdgeRectNode, ":first-child"); + waveEdgeRect.insert(() => waveEdgeRectNode, ":first-child"); + waveEdgeRect.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + waveEdgeRect.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + waveEdgeRect.selectAll("path").attr("style", nodeStyles); + } + waveEdgeRect.attr("transform", `translate(0,${-waveAmplitude / 2})`); + label.attr( + "transform", + `translate(${-w4 / 2 + (node2.padding ?? 0) - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) - waveAmplitude / 2 - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, waveEdgeRect); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_taggedWaveEdgedRectangle = __esm({ + "src/rendering-util/rendering-elements/shapes/taggedWaveEdgedRectangle.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_rough_esm(); + init_handDrawnShapeStyles(); + __name(taggedWaveEdgedRectangle, "taggedWaveEdgedRectangle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/text.ts + async function text3(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalWidth = Math.max(bbox.width + (node2.padding ?? 0), node2?.width || 0); + const totalHeight = Math.max(bbox.height + (node2.padding ?? 0), node2?.height || 0); + const x5 = -totalWidth / 2; + const y6 = -totalHeight / 2; + const rect3 = shapeSvg.insert("rect", ":first-child"); + rect3.attr("class", "text").attr("style", nodeStyles).attr("rx", 0).attr("ry", 0).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight); + updateNodeBounds(node2, rect3); + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_text3 = __esm({ + "src/rendering-util/rendering-elements/shapes/text.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + __name(text3, "text"); + } + }); + + // src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts + async function tiltedCylinder(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPadding = node2.look === "neo" ? 12 : nodePadding / 2; + if (node2.width || node2.height) { + const originalHeight = node2.height ?? 0; + node2.height = (node2.height ?? 0) - labelPadding; + if (node2.height < MIN_HEIGHT4) { + node2.height = MIN_HEIGHT4; + } + const ry2 = originalHeight / 2; + const rx2 = ry2 / (2.5 + originalHeight / 50); + node2.width = (node2.width ?? 0) - labelPadding - rx2 * 3; + if (node2.width < MIN_WIDTH4) { + node2.width = MIN_WIDTH4; + } + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const h3 = (node2.height ? node2.height : bbox.height) + labelPadding; + const ry = h3 / 2; + const rx = ry / (2.5 + h3 / 50); + const w4 = (node2.width ? node2.width : bbox.width) + rx + labelPadding; + const { cssStyles } = node2; + let cylinder3; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const outerPathData = createOuterCylinderPathD3(0, 0, w4, h3, rx, ry); + const innerPathData = createInnerCylinderPathD3(0, 0, w4, h3, rx, ry); + const outerNode = rc.path(outerPathData, userNodeOverrides(node2, {})); + const innerLine = rc.path(innerPathData, userNodeOverrides(node2, { fill: "none" })); + cylinder3 = shapeSvg.insert(() => innerLine, ":first-child"); + cylinder3 = shapeSvg.insert(() => outerNode, ":first-child"); + cylinder3.attr("class", "basic label-container"); + if (cssStyles) { + cylinder3.attr("style", cssStyles); + } + } else { + const pathData = createCylinderPathD3(0, 0, w4, h3, rx, ry); + cylinder3 = shapeSvg.insert("path", ":first-child").attr("d", pathData).attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles)).attr("style", nodeStyles); + cylinder3.attr("class", "basic label-container outer-path"); + if (cssStyles) { + cylinder3.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles) { + cylinder3.selectAll("path").attr("style", nodeStyles); + } + } + cylinder3.attr("label-offset-x", rx); + cylinder3.attr("transform", `translate(${-w4 / 2}, ${h3 / 2} )`); + label.attr( + "transform", + `translate(${-(bbox.width / 2) - rx - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, cylinder3); + node2.intersect = function(point8) { + const pos = intersect_default.rect(node2, point8); + const y6 = pos.y - (node2.y ?? 0); + if (ry != 0 && (Math.abs(y6) < (node2.height ?? 0) / 2 || Math.abs(y6) == (node2.height ?? 0) / 2 && Math.abs(pos.x - (node2.x ?? 0)) > (node2.width ?? 0) / 2 - rx)) { + let x5 = rx * rx * (1 - y6 * y6 / (ry * ry)); + if (x5 != 0) { + x5 = Math.sqrt(Math.abs(x5)); + } + x5 = rx - x5; + if (point8.x - (node2.x ?? 0) > 0) { + x5 = -x5; + } + pos.x += x5; + } + return pos; + }; + return shapeSvg; + } + var createCylinderPathD3, createOuterCylinderPathD3, createInnerCylinderPathD3, MIN_HEIGHT4, MIN_WIDTH4; + var init_tiltedCylinder = __esm({ + "src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts"() { + "use strict"; + init_util(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_intersect(); + init_utils2(); + createCylinderPathD3 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => { + return `M${x5},${y6} + a${rx},${ry} 0,0,1 ${0},${-height2} + l${width3},${0} + a${rx},${ry} 0,0,1 ${0},${height2} + M${width3},${-height2} + a${rx},${ry} 0,0,0 ${0},${height2} + l${-width3},${0}`; + }, "createCylinderPathD"); + createOuterCylinderPathD3 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => { + return [ + `M${x5},${y6}`, + `M${x5 + width3},${y6}`, + `a${rx},${ry} 0,0,0 ${0},${-height2}`, + `l${-width3},0`, + `a${rx},${ry} 0,0,0 ${0},${height2}`, + `l${width3},0` + ].join(" "); + }, "createOuterCylinderPathD"); + createInnerCylinderPathD3 = /* @__PURE__ */ __name((x5, y6, width3, height2, rx, ry) => { + return [`M${x5 + width3 / 2},${-height2 / 2}`, `a${rx},${ry} 0,0,0 0,${height2}`].join(" "); + }, "createInnerCylinderPathD"); + MIN_HEIGHT4 = 5; + MIN_WIDTH4 = 10; + __name(tiltedCylinder, "tiltedCylinder"); + } + }); + + // src/rendering-util/rendering-elements/shapes/trapezoid.ts + async function trapezoid(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingY = node2.look === "neo" ? nodePadding : nodePadding; + const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding; + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const h3 = (node2?.height ?? bbox.height) + labelPaddingY; + const w4 = (node2?.width ?? bbox.width) + labelPaddingX; + const points = [ + { x: -3 * h3 / 6, y: 0 }, + { x: w4 + 3 * h3 / 6, y: 0 }, + { x: w4, y: -h3 }, + { x: 0, y: -h3 } + ]; + let polygon2; + const { cssStyles } = node2; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const pathData = createPathFromPoints(points); + const roughNode = rc.path(pathData, options2); + polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-w4 / 2}, ${h3 / 2})`); + if (cssStyles) { + polygon2.attr("style", cssStyles); + } + } else { + polygon2 = insertPolygonShape(shapeSvg, w4, h3, points); + } + if (nodeStyles) { + polygon2.attr("style", nodeStyles); + } + node2.width = w4; + node2.height = h3; + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var init_trapezoid = __esm({ + "src/rendering-util/rendering-elements/shapes/trapezoid.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_insertPolygonShape(); + __name(trapezoid, "trapezoid"); + } + }); + + // src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts + async function trapezoidalPentagon(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + const minWidth = 15, minHeight = 5; + if (node2.width || node2.height) { + node2.height = (node2.height ?? 0) - labelPaddingY * 2; + if (node2.height < minHeight) { + node2.height = minHeight; + } + node2.width = (node2.width ?? 0) - labelPaddingX * 2; + if (node2.width < minWidth) { + node2.width = minWidth; + } + } + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2; + const h3 = (node2?.height ? node2?.height : bbox.height) + labelPaddingY * 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: -w4 / 2 * 0.8, y: -h3 / 2 }, + { x: w4 / 2 * 0.8, y: -h3 / 2 }, + { x: w4 / 2, y: -h3 / 2 * 0.6 }, + { x: w4 / 2, y: h3 / 2 }, + { x: -w4 / 2, y: h3 / 2 }, + { x: -w4 / 2, y: -h3 / 2 * 0.6 } + ]; + const pathData = createPathFromPoints(points); + const shapeNode = rc.path(pathData, options2); + const polygon2 = shapeSvg.insert(() => shapeNode, ":first-child"); + polygon2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", nodeStyles); + } + updateNodeBounds(node2, polygon2); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_trapezoidalPentagon = __esm({ + "src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(trapezoidalPentagon, "trapezoidalPentagon"); + } + }); + + // src/rendering-util/rendering-elements/shapes/triangle.ts + async function triangle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? nodePadding * 2 : nodePadding; + if (node2.width || node2.height) { + node2.width = ((node2?.width ?? 0) - labelPaddingX) / 2; + if (node2.width < MIN_WIDTH5) { + node2.width = MIN_WIDTH5; + } + node2.height = node2?.height ?? 0; + if (node2.height < MIN_HEIGHT5) { + node2.height = MIN_HEIGHT5; + } + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const useHtmlLabels = evaluate(getConfig2().flowchart?.htmlLabels); + const w4 = (node2?.width ? node2?.width : bbox.width) + labelPaddingX; + const h3 = node2?.height ? node2?.height : w4 + bbox.height; + const tw = h3; + const points = [ + { x: 0, y: 0 }, + { x: tw, y: 0 }, + { x: tw / 2, y: -h3 } + ]; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const pathData = createPathFromPoints(points); + const roughNode = rc.path(pathData, options2); + const polygon2 = shapeSvg.insert(() => roughNode, ":first-child").attr("transform", `translate(${-h3 / 2}, ${h3 / 2})`).attr("class", "outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + polygon2.selectChildren("path").attr("style", nodeStyles); + } + node2.width = w4; + node2.height = h3; + updateNodeBounds(node2, polygon2); + label.attr( + "transform", + `translate(${-bbox.width / 2 - (bbox.x - (bbox.left ?? 0))}, ${h3 / 2 - (bbox.height + (node2.padding ?? 0) / (useHtmlLabels ? 2 : 1) - (bbox.y - (bbox.top ?? 0)))})` + ); + node2.intersect = function(point8) { + log.info("Triangle intersect", node2, points, point8); + return intersect_default.polygon(node2, points, point8); + }; + return shapeSvg; + } + var MIN_HEIGHT5, MIN_WIDTH5; + var init_triangle = __esm({ + "src/rendering-util/rendering-elements/shapes/triangle.ts"() { + "use strict"; + init_logger(); + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_util(); + init_common(); + init_diagramAPI(); + MIN_HEIGHT5 = 10; + MIN_WIDTH5 = 10; + __name(triangle, "triangle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/waveEdgedRectangle.ts + async function waveEdgedRectangle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 12 : nodePadding; + let adjustFinalHeight = true; + if (node2.width || node2.height) { + adjustFinalHeight = false; + node2.width = (node2?.width ?? 0) - labelPaddingX * 2; + if (node2.width < 10) { + node2.width = 10; + } + node2.height = (node2?.height ?? 0) - labelPaddingY * 2; + if (node2.height < 10) { + node2.height = 10; + } + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2?.width ? node2?.width : bbox.width) + (labelPaddingX ?? 0) * 2; + const h3 = (node2?.height ? node2?.height : bbox.height) + (labelPaddingY ?? 0) * 2; + const waveAmplitude = node2.look === "neo" ? h3 / 4 : h3 / 8; + const finalH = h3 + (adjustFinalHeight ? waveAmplitude : -waveAmplitude); + const { cssStyles } = node2; + const minWidth = 14; + const widthDif = minWidth - w4; + const extraW = widthDif > 0 ? widthDif / 2 : 0; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: -w4 / 2 - extraW, y: finalH / 2 }, + ...generateFullSineWavePoints( + -w4 / 2 - extraW, + finalH / 2, + w4 / 2 + extraW, + finalH / 2, + waveAmplitude, + 0.8 + ), + { x: w4 / 2 + extraW, y: -finalH / 2 }, + { x: -w4 / 2 - extraW, y: -finalH / 2 } + ]; + const waveEdgeRectPath = createPathFromPoints(points); + const waveEdgeRectNode = rc.path(waveEdgeRectPath, options2); + const waveEdgeRect = shapeSvg.insert(() => waveEdgeRectNode, ":first-child"); + waveEdgeRect.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + waveEdgeRect.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + waveEdgeRect.selectAll("path").attr("style", nodeStyles); + } + waveEdgeRect.attr("transform", `translate(0,${-waveAmplitude / 2})`); + label.attr( + "transform", + `translate(${-w4 / 2 + (node2.padding ?? 0) - (bbox.x - (bbox.left ?? 0))},${-h3 / 2 + (node2.padding ?? 0) - waveAmplitude - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, waveEdgeRect); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_waveEdgedRectangle = __esm({ + "src/rendering-util/rendering-elements/shapes/waveEdgedRectangle.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_rough_esm(); + init_handDrawnShapeStyles(); + __name(waveEdgedRectangle, "waveEdgedRectangle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/waveRectangle.ts + async function waveRectangle(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const nodePadding = node2.padding ?? 0; + const labelPaddingX = node2.look === "neo" ? 16 : nodePadding; + const labelPaddingY = node2.look === "neo" ? 20 : nodePadding; + if (node2.width || node2.height) { + node2.width = node2?.width ?? 0; + if (node2.width < 20) { + node2.width = 20; + } + node2.height = node2?.height ?? 0; + if (node2.height < 10) { + node2.height = 10; + } + const waveAmplitude2 = Math.min(node2.height * 0.2, node2.height / 4); + node2.height = Math.ceil(node2.height - labelPaddingY - waveAmplitude2 * (20 / 9)); + node2.width = node2.width - labelPaddingX * 2; + } + const { shapeSvg, bbox } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const w4 = (node2?.width ? node2?.width : bbox.width) + labelPaddingX * 2; + const h3 = (node2?.height ? node2?.height : bbox.height) + labelPaddingY; + const waveAmplitude = h3 / 8; + const finalH = h3 + waveAmplitude * 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const points = [ + { x: -w4 / 2, y: finalH / 2 }, + ...generateFullSineWavePoints(-w4 / 2, finalH / 2, w4 / 2, finalH / 2, waveAmplitude, 1), + { x: w4 / 2, y: -finalH / 2 }, + ...generateFullSineWavePoints(w4 / 2, -finalH / 2, -w4 / 2, -finalH / 2, waveAmplitude, -1) + ]; + const waveRectPath = createPathFromPoints(points); + const waveRectNode = rc.path(waveRectPath, options2); + const waveRect = shapeSvg.insert(() => waveRectNode, ":first-child"); + waveRect.attr("class", "basic label-container"); + if (cssStyles && node2.look !== "handDrawn") { + waveRect.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + waveRect.selectAll("path").attr("style", nodeStyles); + } + updateNodeBounds(node2, waveRect); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, points, point8); + return pos; + }; + return shapeSvg; + } + var init_waveRectangle = __esm({ + "src/rendering-util/rendering-elements/shapes/waveRectangle.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + __name(waveRectangle, "waveRectangle"); + } + }); + + // src/rendering-util/rendering-elements/shapes/windowPane.ts + async function windowPane(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const paddingX = node2.look === "neo" ? 16 : node2.padding ?? 0; + const paddingY = node2.look === "neo" ? 12 : node2.padding ?? 0; + if (node2.width || node2.height) { + node2.width = Math.max((node2?.width ?? 0) - paddingX * 2 - rectOffset, 10); + node2.height = Math.max((node2?.height ?? 0) - paddingY * 2 - rectOffset, 10); + } + const { shapeSvg, bbox, label } = await labelHelper(parent4, node2, getNodeClasses(node2)); + const totalWidth = (node2?.width ? node2?.width : bbox.width) + paddingX * 2 + rectOffset; + const totalHeight = (node2?.height ? node2?.height : bbox.height) + paddingY * 2 + rectOffset; + const w4 = totalWidth - rectOffset; + const h3 = totalHeight - rectOffset; + const x5 = -w4 / 2; + const y6 = -h3 / 2; + const { cssStyles } = node2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const outerPathPoints = [ + { x: x5 - rectOffset, y: y6 - rectOffset }, + { x: x5 - rectOffset, y: y6 + h3 }, + { x: x5 + w4, y: y6 + h3 }, + { x: x5 + w4, y: y6 - rectOffset } + ]; + const path4 = `M${x5 - rectOffset},${y6 - rectOffset} L${x5 + w4},${y6 - rectOffset} L${x5 + w4},${y6 + h3} L${x5 - rectOffset},${y6 + h3} L${x5 - rectOffset},${y6 - rectOffset} + M${x5 - rectOffset},${y6} L${x5 + w4},${y6} + M${x5},${y6 - rectOffset} L${x5},${y6 + h3}`; + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const no = rc.path(path4, options2); + const windowPane2 = shapeSvg.insert(() => no, ":first-child"); + windowPane2.attr("transform", `translate(${rectOffset / 2}, ${rectOffset / 2})`); + windowPane2.attr("class", "basic label-container outer-path"); + if (cssStyles && node2.look !== "handDrawn") { + windowPane2.selectAll("path").attr("style", cssStyles); + } + if (nodeStyles && node2.look !== "handDrawn") { + windowPane2.selectAll("path").attr("style", nodeStyles); + } + label.attr( + "transform", + `translate(${-(bbox.width / 2) + rectOffset / 2 - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) + rectOffset / 2 - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node2, windowPane2); + node2.intersect = function(point8) { + const pos = intersect_default.polygon(node2, outerPathPoints, point8); + return pos; + }; + return shapeSvg; + } + var rectOffset; + var init_windowPane = __esm({ + "src/rendering-util/rendering-elements/shapes/windowPane.ts"() { + "use strict"; + init_util(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_intersect(); + rectOffset = 10; + __name(windowPane, "windowPane"); + } + }); + + // src/rendering-util/rendering-elements/shapes/erBox.ts + async function erBox(parent4, node2) { + const entityNode = node2; + if (entityNode.alias) { + node2.label = entityNode.alias; + } + const { theme, themeVariables } = getConfig(); + const { rowEven, rowOdd, nodeBorder, borderColorArray } = themeVariables; + if (node2.look === "handDrawn") { + const { themeVariables: themeVariables2 } = getConfig(); + const { background } = themeVariables2; + const backgroundNode = { + ...node2, + id: node2.id + "-background", + domId: (node2.domId || node2.id) + "-background", + look: "default", + cssStyles: ["stroke: none", `fill: ${background}`] + }; + await erBox(parent4, backgroundNode); + } + const config5 = getConfig(); + node2.useHtmlLabels = config5.htmlLabels; + let PADDING = config5.er?.diagramPadding ?? 10; + let TEXT_PADDING = config5.er?.entityPadding ?? 6; + const { cssStyles } = node2; + const { labelStyles, nodeStyles } = styles2String(node2); + if (entityNode.attributes.length === 0 && node2.label) { + const options3 = { + rx: 0, + ry: 0, + labelPaddingX: PADDING, + labelPaddingY: PADDING * 1.5, + classes: "" + }; + if (calculateTextWidth(node2.label, config5) + options3.labelPaddingX * 2 < config5.er.minEntityWidth) { + node2.width = config5.er.minEntityWidth; + } + const shapeSvg2 = await drawRect3(parent4, node2, options3); + if (theme != null && COLOR_THEMES.has(theme)) { + const colorIndex = entityNode.colorIndex ?? 0; + shapeSvg2.attr("data-color-id", `color-${colorIndex % borderColorArray.length}`); + } + if (!evaluate(config5.htmlLabels)) { + const textElement = shapeSvg2.select("text"); + const bbox = textElement.node()?.getBBox(); + textElement.attr("transform", `translate(${-bbox.width / 2}, 0)`); + } + return shapeSvg2; + } + if (!config5.htmlLabels) { + PADDING *= 1.25; + TEXT_PADDING *= 1.25; + } + let cssClasses = getNodeClasses(node2); + if (!cssClasses) { + cssClasses = "node default"; + } + const shapeSvg = parent4.insert("g").attr("class", cssClasses).attr("id", node2.domId || node2.id); + const nameBBox = await addText(shapeSvg, node2.label ?? "", config5, 0, 0, ["name"], labelStyles); + nameBBox.height += TEXT_PADDING; + let yOffset = 0; + const yOffsets = []; + const rows = []; + let maxTypeWidth = 0; + let maxNameWidth = 0; + let maxKeysWidth = 0; + let maxCommentWidth = 0; + let keysPresent = true; + let commentPresent = true; + for (const attribute of entityNode.attributes) { + const typeBBox = await addText( + shapeSvg, + attribute.type, + config5, + 0, + yOffset, + ["attribute-type"], + labelStyles + ); + maxTypeWidth = Math.max(maxTypeWidth, typeBBox.width + PADDING); + const nameBBox2 = await addText( + shapeSvg, + attribute.name, + config5, + 0, + yOffset, + ["attribute-name"], + labelStyles + ); + maxNameWidth = Math.max(maxNameWidth, nameBBox2.width + PADDING); + const keysBBox = await addText( + shapeSvg, + attribute.keys.join(), + config5, + 0, + yOffset, + ["attribute-keys"], + labelStyles + ); + maxKeysWidth = Math.max(maxKeysWidth, keysBBox.width + PADDING); + const commentBBox = await addText( + shapeSvg, + attribute.comment, + config5, + 0, + yOffset, + ["attribute-comment"], + labelStyles + ); + maxCommentWidth = Math.max(maxCommentWidth, commentBBox.width + PADDING); + const rowHeight = Math.max(typeBBox.height, nameBBox2.height, keysBBox.height, commentBBox.height) + TEXT_PADDING; + rows.push({ yOffset, rowHeight }); + yOffset += rowHeight; + } + let totalWidthSections = 4; + if (maxKeysWidth <= PADDING) { + keysPresent = false; + maxKeysWidth = 0; + totalWidthSections--; + } + if (maxCommentWidth <= PADDING) { + commentPresent = false; + maxCommentWidth = 0; + totalWidthSections--; + } + const shapeBBox = shapeSvg.node().getBBox(); + if (nameBBox.width + PADDING * 2 - (maxTypeWidth + maxNameWidth + maxKeysWidth + maxCommentWidth) > 0) { + const difference2 = nameBBox.width + PADDING * 2 - (maxTypeWidth + maxNameWidth + maxKeysWidth + maxCommentWidth); + maxTypeWidth += difference2 / totalWidthSections; + maxNameWidth += difference2 / totalWidthSections; + if (maxKeysWidth > 0) { + maxKeysWidth += difference2 / totalWidthSections; + } + if (maxCommentWidth > 0) { + maxCommentWidth += difference2 / totalWidthSections; + } + } + const maxWidth2 = maxTypeWidth + maxNameWidth + maxKeysWidth + maxCommentWidth; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + let totalShapeBBoxHeight = 0; + if (rows.length > 0) { + totalShapeBBoxHeight = rows.reduce((sum2, row) => sum2 + (row?.rowHeight ?? 0), 0); + } + const w4 = Math.max(shapeBBox.width + PADDING * 2, node2?.width || 0, maxWidth2); + const h3 = Math.max((totalShapeBBoxHeight ?? 0) + nameBBox.height, node2?.height || 0); + const x5 = -w4 / 2; + const y6 = -h3 / 2; + shapeSvg.selectAll("g:not(:first-child)").each((_3, i2, nodes5) => { + const text4 = select_default2(nodes5[i2]); + const transform8 = text4.attr("transform"); + let translateX2 = 0; + let translateY2 = 0; + if (transform8) { + const regex2 = RegExp(/translate\(([^,]+),([^)]+)\)/); + const translate2 = regex2.exec(transform8); + if (translate2) { + translateX2 = parseFloat(translate2[1]); + translateY2 = parseFloat(translate2[2]); + if (text4.attr("class").includes("attribute-name")) { + translateX2 += maxTypeWidth; + } else if (text4.attr("class").includes("attribute-keys")) { + translateX2 += maxTypeWidth + maxNameWidth; + } else if (text4.attr("class").includes("attribute-comment")) { + translateX2 += maxTypeWidth + maxNameWidth + maxKeysWidth; + } + } + } + text4.attr( + "transform", + `translate(${x5 + PADDING / 2 + translateX2}, ${translateY2 + y6 + nameBBox.height + TEXT_PADDING / 2})` + ); + }); + shapeSvg.select(".name").attr("transform", "translate(" + -nameBBox.width / 2 + ", " + (y6 + TEXT_PADDING / 2) + ")"); + if (theme != null && COLOR_THEMES.has(theme)) { + const colorIndex = entityNode.colorIndex ?? 0; + shapeSvg.attr("data-color-id", `color-${colorIndex % borderColorArray.length}`); + } + const roughRect = rc.rectangle(x5, y6, w4, h3, options2); + const rect3 = shapeSvg.insert(() => roughRect, ":first-child").attr("class", "outer-path").attr("style", cssStyles.join("")); + yOffsets.push(0); + for (const [i2, row] of rows.entries()) { + const contentRowIndex = i2 + 1; + const isEven = contentRowIndex % 2 === 0 && row.yOffset !== 0; + const roughRect2 = rc.rectangle(x5, nameBBox.height + y6 + row?.yOffset, w4, row?.rowHeight, { + ...options2, + fill: isEven ? rowEven : rowOdd, + stroke: nodeBorder + }); + shapeSvg.insert(() => roughRect2, "g.label").attr("style", cssStyles.join("")).attr("class", `row-rect-${isEven ? "even" : "odd"}`); + } + const thickness = 1e-4; + let points = lineToPolygon(x5, nameBBox.height + y6, w4 + x5, nameBBox.height + y6, thickness); + let roughLine = rc.polygon( + points.map((p3) => [p3.x, p3.y]), + options2 + ); + shapeSvg.insert(() => roughLine).attr("class", "divider"); + points = lineToPolygon(maxTypeWidth + x5, nameBBox.height + y6, maxTypeWidth + x5, h3 + y6, thickness); + roughLine = rc.polygon( + points.map((p3) => [p3.x, p3.y]), + options2 + ); + shapeSvg.insert(() => roughLine).attr("class", "divider"); + if (keysPresent) { + const xCoord = maxTypeWidth + maxNameWidth + x5; + points = lineToPolygon(xCoord, nameBBox.height + y6, xCoord, h3 + y6, thickness); + roughLine = rc.polygon( + points.map((p3) => [p3.x, p3.y]), + options2 + ); + shapeSvg.insert(() => roughLine).attr("class", "divider"); + } + if (commentPresent) { + const xCoord = maxTypeWidth + maxNameWidth + maxKeysWidth + x5; + points = lineToPolygon(xCoord, nameBBox.height + y6, xCoord, h3 + y6, thickness); + roughLine = rc.polygon( + points.map((p3) => [p3.x, p3.y]), + options2 + ); + shapeSvg.insert(() => roughLine).attr("class", "divider"); + } + for (const yOffset2 of yOffsets) { + const yCoord = nameBBox.height + y6 + yOffset2; + points = lineToPolygon(x5, yCoord, w4 + x5, yCoord, thickness); + roughLine = rc.polygon( + points.map((p3) => [p3.x, p3.y]), + options2 + ); + shapeSvg.insert(() => roughLine).attr("class", "divider"); + } + updateNodeBounds(node2, rect3); + if (nodeStyles && node2.look !== "handDrawn") { + if (theme != null && REDUX_THEMES.has(theme)) { + shapeSvg.selectAll("path").attr("style", nodeStyles); + } else { + const allStyle = nodeStyles.split(";"); + const strokeStyles = allStyle?.filter((e3) => { + return e3.includes("stroke"); + })?.map((s2) => `${s2}`).join("; "); + shapeSvg.selectAll("path").attr("style", strokeStyles ?? ""); + shapeSvg.selectAll(".row-rect-even path").attr("style", nodeStyles); + } + } + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + async function addText(shapeSvg, labelText, config5, translateX2 = 0, translateY2 = 0, classes3 = [], style3 = "") { + const label = shapeSvg.insert("g").attr("class", `label ${classes3.join(" ")}`).attr("transform", `translate(${translateX2}, ${translateY2})`).attr("style", style3); + if (labelText !== parseGenericTypes(labelText)) { + labelText = parseGenericTypes(labelText); + labelText = labelText.replaceAll("<", "<").replaceAll(">", ">"); + } + const text4 = label.node().appendChild( + await createText( + label, + labelText, + { + width: calculateTextWidth(labelText, config5) + 100, + style: style3, + useHtmlLabels: config5.htmlLabels + }, + config5 + ) + ); + if (labelText.includes("<") || labelText.includes(">")) { + let child = text4.children[0]; + child.textContent = child.textContent.replaceAll("<", "<").replaceAll(">", ">"); + while (child.childNodes[0]) { + child = child.childNodes[0]; + child.textContent = child.textContent.replaceAll("<", "<").replaceAll(">", ">"); + } + } + let bbox = text4.getBBox(); + if (evaluate(config5.htmlLabels)) { + const div = text4.children[0]; + div.style.textAlign = "start"; + const dv = select_default2(text4); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + return bbox; + } + function lineToPolygon(x1, y1, x22, y22, thickness) { + if (x1 === x22) { + return [ + { x: x1 - thickness / 2, y: y1 }, + { x: x1 + thickness / 2, y: y1 }, + { x: x22 + thickness / 2, y: y22 }, + { x: x22 - thickness / 2, y: y22 } + ]; + } + return [ + { x: x1, y: y1 - thickness / 2 }, + { x: x1, y: y1 + thickness / 2 }, + { x: x22, y: y22 + thickness / 2 }, + { x: x22, y: y22 - thickness / 2 } + ]; + } + var COLOR_THEMES, REDUX_THEMES; + var init_erBox = __esm({ + "src/rendering-util/rendering-elements/shapes/erBox.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_drawRect(); + init_config(); + init_createText(); + init_common(); + init_src32(); + init_utils2(); + COLOR_THEMES = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]); + REDUX_THEMES = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]); + __name(erBox, "erBox"); + __name(addText, "addText"); + __name(lineToPolygon, "lineToPolygon"); + } + }); + + // src/diagrams/class/shapeUtil.ts + async function textHelper(parent4, node2, config5, useHtmlLabels, GAP = config5.class.padding ?? 12) { + const TEXT_PADDING = !useHtmlLabels ? 3 : 0; + const shapeSvg = parent4.insert("g").attr("class", getNodeClasses(node2)).attr("id", node2.domId || node2.id); + let annotationGroup = null; + let labelGroup = null; + let membersGroup = null; + let methodsGroup = null; + let annotationGroupHeight = 0; + let labelGroupHeight = 0; + let membersGroupHeight = 0; + annotationGroup = shapeSvg.insert("g").attr("class", "annotation-group text"); + if (node2.annotations.length > 0) { + const annotation = node2.annotations[0]; + await addText2(annotationGroup, { text: `\xAB${annotation}\xBB` }, 0); + const annotationGroupBBox = annotationGroup.node().getBBox(); + annotationGroupHeight = annotationGroupBBox.height; + } + labelGroup = shapeSvg.insert("g").attr("class", "label-group text"); + await addText2(labelGroup, node2, 0, ["font-weight: bolder"]); + const labelGroupBBox = labelGroup.node().getBBox(); + labelGroupHeight = labelGroupBBox.height; + membersGroup = shapeSvg.insert("g").attr("class", "members-group text"); + let yOffset = 0; + for (const member of node2.members) { + const height2 = await addText2(membersGroup, member, yOffset, [member.parseClassifier()]); + yOffset += height2 + TEXT_PADDING; + } + membersGroupHeight = membersGroup.node().getBBox().height; + if (membersGroupHeight <= 0) { + membersGroupHeight = GAP / 2; + } + methodsGroup = shapeSvg.insert("g").attr("class", "methods-group text"); + let methodsYOffset = 0; + for (const method of node2.methods) { + const height2 = await addText2(methodsGroup, method, methodsYOffset, [method.parseClassifier()]); + methodsYOffset += height2 + TEXT_PADDING; + } + let bbox = shapeSvg.node().getBBox(); + if (annotationGroup !== null) { + const annotationGroupBBox = annotationGroup.node().getBBox(); + annotationGroup.attr("transform", `translate(${-annotationGroupBBox.width / 2})`); + } + labelGroup.attr("transform", `translate(${-labelGroupBBox.width / 2}, ${annotationGroupHeight})`); + bbox = shapeSvg.node().getBBox(); + membersGroup.attr( + "transform", + `translate(${0}, ${annotationGroupHeight + labelGroupHeight + GAP * 2})` + ); + bbox = shapeSvg.node().getBBox(); + methodsGroup.attr( + "transform", + `translate(${0}, ${annotationGroupHeight + labelGroupHeight + (membersGroupHeight ? membersGroupHeight + GAP * 4 : GAP * 2)})` + ); + bbox = shapeSvg.node().getBBox(); + return { shapeSvg, bbox }; + } + async function addText2(parentGroup, node2, yOffset, styles6 = []) { + const textEl = parentGroup.insert("g").attr("class", "label").attr("style", styles6.join("; ")); + const config5 = getConfig(); + let useHtmlLabels = "useHtmlLabels" in node2 ? node2.useHtmlLabels : evaluate(config5.htmlLabels) ?? true; + let textContent = ""; + if ("text" in node2) { + textContent = node2.text; + } else { + textContent = node2.label; + } + if (!useHtmlLabels && textContent.startsWith("\\")) { + textContent = textContent.substring(1); + } + if (hasKatex(textContent)) { + useHtmlLabels = true; + } + const text4 = await createText( + textEl, + sanitizeText3(decodeEntities(textContent)), + { + width: calculateTextWidth(textContent, config5) + 50, + // Add room for error when splitting text into multiple lines + classes: "markdown-node-label", + useHtmlLabels + }, + config5 + ); + let bbox; + let numberOfLines = 1; + if (!useHtmlLabels) { + if (styles6.includes("font-weight: bolder")) { + select_default2(text4).selectAll("tspan").attr("font-weight", ""); + } + numberOfLines = text4.children.length; + const textChild = text4.children[0]; + if (text4.textContent === "" || text4.textContent.includes(">")) { + textChild.textContent = textContent[0] + textContent.substring(1).replaceAll(">", ">").replaceAll("<", "<").trim(); + const preserveSpace = textContent[1] === " "; + if (preserveSpace) { + textChild.textContent = textChild.textContent[0] + " " + textChild.textContent.substring(1); + } + } + if (textChild.textContent === "undefined") { + textChild.textContent = ""; + } + bbox = text4.getBBox(); + } else { + const div = text4.children[0]; + const dv = select_default2(text4); + numberOfLines = div.innerHTML.split("
    ").length; + if (div.innerHTML.includes("")) { + numberOfLines += div.innerHTML.split("").length - 1; + } + const images = div.getElementsByTagName("img"); + if (images) { + const noImgText = textContent.replace(/]*>/g, "").trim() === ""; + await Promise.all( + [...images].map( + (img) => new Promise((res) => { + function setupImage() { + img.style.display = "flex"; + img.style.flexDirection = "column"; + if (noImgText) { + const bodyFontSize = config5.fontSize?.toString() ?? window.getComputedStyle(document.body).fontSize; + const enlargingFactor = 5; + const width3 = parseInt(bodyFontSize, 10) * enlargingFactor + "px"; + img.style.minWidth = width3; + img.style.maxWidth = width3; + } else { + img.style.width = "100%"; + } + res(img); + } + __name(setupImage, "setupImage"); + setTimeout(() => { + if (img.complete) { + setupImage(); + } + }); + img.addEventListener("error", setupImage); + img.addEventListener("load", setupImage); + }) + ) + ); + } + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + textEl.attr("transform", "translate(0," + (-bbox.height / (2 * numberOfLines) + yOffset) + ")"); + return bbox.height; + } + var init_shapeUtil = __esm({ + "src/diagrams/class/shapeUtil.ts"() { + "use strict"; + init_src32(); + init_config(); + init_util(); + init_utils2(); + init_diagramAPI(); + init_createText(); + init_common(); + __name(textHelper, "textHelper"); + __name(addText2, "addText"); + } + }); + + // src/rendering-util/rendering-elements/shapes/classBox.ts + async function classBox(parent4, node2) { + const config5 = getConfig2(); + const { themeVariables } = config5; + const { useGradient } = themeVariables; + const PADDING = config5.class.padding ?? 12; + const GAP = PADDING; + const useHtmlLabels = node2.useHtmlLabels ?? evaluate(config5.htmlLabels) ?? true; + const classNode = node2; + classNode.annotations = classNode.annotations ?? []; + classNode.members = classNode.members ?? []; + classNode.methods = classNode.methods ?? []; + const { shapeSvg, bbox } = await textHelper(parent4, node2, config5, useHtmlLabels, GAP); + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + node2.cssStyles = classNode.styles || ""; + const styles6 = classNode.styles?.join(";") || nodeStyles || ""; + if (!node2.cssStyles) { + node2.cssStyles = styles6.replaceAll("!important", "").split(";"); + } + const renderExtraBox = classNode.members.length === 0 && classNode.methods.length === 0 && !config5.class?.hideEmptyMembersBox; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const w4 = Math.max(node2.width ?? 0, bbox.width); + let h3 = Math.max(node2.height ?? 0, bbox.height); + const nodeHeightGreater = (node2.height ?? 0) > bbox.height; + if (classNode.members.length === 0 && classNode.methods.length === 0) { + h3 += GAP; + } else if (classNode.members.length > 0 && classNode.methods.length === 0) { + h3 += GAP * 2; + } + const x5 = -w4 / 2; + const y6 = -h3 / 2; + let extraHeight = renderExtraBox ? PADDING * 2 : classNode.members.length === 0 && classNode.methods.length === 0 ? -PADDING : 0; + if (nodeHeightGreater) { + extraHeight = PADDING * 2; + } + const roughRect = rc.rectangle( + x5 - PADDING, + y6 - PADDING - (renderExtraBox ? PADDING : classNode.members.length === 0 && classNode.methods.length === 0 ? -PADDING / 2 : 0), + w4 + 2 * PADDING, + h3 + 2 * PADDING + extraHeight, + options2 + ); + const rect3 = shapeSvg.insert(() => roughRect, ":first-child"); + rect3.attr("class", "basic label-container outer-path"); + const rectBBox = rect3.node().getBBox(); + const annotationGroupHeight = shapeSvg.select(".annotation-group").node().getBBox().height - (renderExtraBox ? PADDING / 2 : 0) || 0; + const labelGroupHeight = shapeSvg.select(".label-group").node().getBBox().height - (renderExtraBox ? PADDING / 2 : 0) || 0; + const membersGroupHeight = shapeSvg.select(".members-group").node().getBBox().height - (renderExtraBox ? PADDING / 2 : 0) || 0; + const methodsAreaPlacement = (annotationGroupHeight + labelGroupHeight + y6 + PADDING - (y6 - PADDING - (renderExtraBox ? PADDING : classNode.members.length === 0 && classNode.methods.length === 0 ? -PADDING / 2 : 0))) / 2; + shapeSvg.selectAll(".text").each((_3, i2, nodes5) => { + const text4 = select_default2(nodes5[i2]); + const transform8 = text4.attr("transform"); + let translateY2 = 0; + if (transform8) { + const regex2 = RegExp(/translate\(([^,]+),([^)]+)\)/); + const translate2 = regex2.exec(transform8); + if (translate2) { + translateY2 = parseFloat(translate2[2]); + } + } + let newTranslateY = translateY2 + y6 + PADDING - (renderExtraBox ? PADDING : classNode.members.length === 0 && classNode.methods.length === 0 ? -PADDING / 2 : 0); + if (text4.attr("class").includes("methods-group")) { + const membersGroupHeightForMethods = Math.max(membersGroupHeight, GAP / 2); + if (nodeHeightGreater) { + newTranslateY = Math.max( + methodsAreaPlacement, + annotationGroupHeight + labelGroupHeight + membersGroupHeightForMethods + y6 + GAP * 2 + PADDING + ) + GAP * 2; + } else { + newTranslateY = annotationGroupHeight + labelGroupHeight + membersGroupHeightForMethods + y6 + GAP * 4 + PADDING; + } + } + if (classNode.members.length === 0 && classNode.methods.length === 0 && config5.class?.hideEmptyMembersBox) { + if (classNode.annotations.length > 0) { + newTranslateY = translateY2 - GAP; + } else { + newTranslateY = translateY2; + } + } + if (!useHtmlLabels) { + newTranslateY -= 4; + } + let newTranslateX = x5; + if (text4.attr("class").includes("label-group") || text4.attr("class").includes("annotation-group")) { + newTranslateX = -text4.node()?.getBBox().width / 2 || 0; + shapeSvg.selectAll("text").each(function(_4, i3, nodes6) { + if (window.getComputedStyle(nodes6[i3]).textAnchor === "middle") { + newTranslateX = 0; + } + }); + } + text4.attr("transform", `translate(${newTranslateX}, ${newTranslateY})`); + }); + if (classNode.members.length > 0 || classNode.methods.length > 0 || renderExtraBox) { + const firstLineY = annotationGroupHeight + labelGroupHeight + y6 + PADDING; + const roughLine = rc.line( + rectBBox.x, + firstLineY, + rectBBox.x + rectBBox.width, + firstLineY + 1e-3, + options2 + ); + const line2 = shapeSvg.insert(() => roughLine); + line2.attr("class", `divider${node2.look === "neo" && !useGradient ? " neo-line" : ""}`).attr("style", styles6); + } + if (renderExtraBox || classNode.members.length > 0 || classNode.methods.length > 0) { + const secondLineY = annotationGroupHeight + labelGroupHeight + membersGroupHeight + y6 + GAP * 2 + PADDING; + const roughLine = rc.line( + rectBBox.x, + nodeHeightGreater ? Math.max(methodsAreaPlacement, secondLineY) : secondLineY, + rectBBox.x + rectBBox.width, + (nodeHeightGreater ? Math.max(methodsAreaPlacement, secondLineY) : secondLineY) + 1e-3, + options2 + ); + const line2 = shapeSvg.insert(() => roughLine); + line2.attr("class", `divider${node2.look === "neo" && !useGradient ? " neo-line" : ""}`).attr("style", styles6); + } + if (classNode.look !== "handDrawn") { + shapeSvg.selectAll("path").attr("style", styles6); + } + rect3.select(":nth-child(2)").attr("style", styles6); + shapeSvg.selectAll(".divider").select("path").attr("style", styles6); + if (node2.labelStyle) { + shapeSvg.selectAll("span").attr("style", node2.labelStyle); + } else { + shapeSvg.selectAll("span").attr("style", styles6); + } + if (!useHtmlLabels) { + const colorRegex = RegExp(/color\s*:\s*([^;]*)/); + const match3 = colorRegex.exec(styles6); + if (match3) { + const colorStyle = match3[0].replace("color", "fill"); + shapeSvg.selectAll("tspan").attr("style", colorStyle); + } else if (labelStyles) { + const match4 = colorRegex.exec(labelStyles); + if (match4) { + const colorStyle = match4[0].replace("color", "fill"); + shapeSvg.selectAll("tspan").attr("style", colorStyle); + } + } + } + updateNodeBounds(node2, rect3); + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_classBox = __esm({ + "src/rendering-util/rendering-elements/shapes/classBox.ts"() { + "use strict"; + init_util(); + init_diagramAPI(); + init_src32(); + init_rough_esm(); + init_handDrawnShapeStyles(); + init_intersect(); + init_shapeUtil(); + init_common(); + __name(classBox, "classBox"); + } + }); + + // src/rendering-util/rendering-elements/shapes/requirementBox.ts + async function requirementBox(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const requirementNode = node2; + const elementNode = node2; + const padding2 = 20; + const gap = 20; + const isRequirementNode = "verifyMethod" in node2; + const classes3 = getNodeClasses(node2); + const { themeVariables } = getConfig2(); + const { borderColorArray, requirementEdgeLabelBackground } = themeVariables; + const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId ?? node2.id); + let typeHeight; + if (isRequirementNode) { + typeHeight = await addText3( + shapeSvg, + `<<${requirementNode.type}>>`, + 0, + node2.labelStyle + ); + } else { + typeHeight = await addText3(shapeSvg, "<<Element>>", 0, node2.labelStyle); + } + let accumulativeHeight = typeHeight; + const nameHeight = await addText3( + shapeSvg, + requirementNode.name, + accumulativeHeight, + node2.labelStyle + "; font-weight: bold;" + ); + accumulativeHeight += nameHeight + gap; + if (isRequirementNode) { + const idHeight = await addText3( + shapeSvg, + `${requirementNode.requirementId ? `ID: ${requirementNode.requirementId}` : ""}`, + accumulativeHeight, + node2.labelStyle + ); + accumulativeHeight += idHeight; + const textHeight = await addText3( + shapeSvg, + `${requirementNode.text ? `Text: ${requirementNode.text}` : ""}`, + accumulativeHeight, + node2.labelStyle + ); + accumulativeHeight += textHeight; + const riskHeight = await addText3( + shapeSvg, + `${requirementNode.risk ? `Risk: ${requirementNode.risk}` : ""}`, + accumulativeHeight, + node2.labelStyle + ); + accumulativeHeight += riskHeight; + await addText3( + shapeSvg, + `${requirementNode.verifyMethod ? `Verification: ${requirementNode.verifyMethod}` : ""}`, + accumulativeHeight, + node2.labelStyle + ); + } else { + const typeHeight2 = await addText3( + shapeSvg, + `${elementNode.type ? `Type: ${elementNode.type}` : ""}`, + accumulativeHeight, + node2.labelStyle + ); + accumulativeHeight += typeHeight2; + await addText3( + shapeSvg, + `${elementNode.docRef ? `Doc Ref: ${elementNode.docRef}` : ""}`, + accumulativeHeight, + node2.labelStyle + ); + } + const totalWidth = (shapeSvg.node()?.getBBox().width ?? 200) + padding2; + const totalHeight = (shapeSvg.node()?.getBBox().height ?? 200) + padding2; + const x5 = -totalWidth / 2; + const y6 = -totalHeight / 2; + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + if (node2.look !== "handDrawn") { + options2.roughness = 0; + options2.fillStyle = "solid"; + } + const roughRect = rc.rectangle(x5, y6, totalWidth, totalHeight, options2); + const rect3 = shapeSvg.insert(() => roughRect, ":first-child"); + rect3.attr("class", "basic label-container outer-path").attr("style", nodeStyles); + if (borderColorArray?.length) { + const colorIndex = node2.colorIndex ?? 0; + shapeSvg.attr("data-color-id", `color-${colorIndex % borderColorArray.length}`); + } + shapeSvg.selectAll(".label").each((_3, i2, nodes5) => { + const text4 = select_default2(nodes5[i2]); + const transform8 = text4.attr("transform"); + let translateX2 = 0; + let translateY2 = 0; + if (transform8) { + const regex2 = RegExp(/translate\(([^,]+),([^)]+)\)/); + const translate2 = regex2.exec(transform8); + if (translate2) { + translateX2 = parseFloat(translate2[1]); + translateY2 = parseFloat(translate2[2]); + } + } + const newTranslateY = translateY2 - totalHeight / 2; + let newTranslateX = x5 + padding2 / 2; + if (i2 === 0 || i2 === 1) { + newTranslateX = translateX2; + } + text4.attr("transform", `translate(${newTranslateX}, ${newTranslateY + padding2})`); + }); + if (accumulativeHeight > typeHeight + nameHeight + gap) { + const lineY = y6 + typeHeight + nameHeight + gap; + let roughLine; + if (node2.look === "neo") { + const thickness = 1e-3; + const polygonPoints = [ + [x5, lineY], + [x5 + totalWidth, lineY], + [x5 + totalWidth, lineY + thickness], + [x5, lineY + thickness] + ]; + roughLine = rc.polygon(polygonPoints, options2); + } else { + roughLine = rc.line(x5, lineY, x5 + totalWidth, lineY, options2); + } + const dividerLine = shapeSvg.insert(() => roughLine); + dividerLine.attr("class", "divider"); + } + updateNodeBounds(node2, rect3); + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + if (nodeStyles && node2.look !== "handDrawn" && (requirementEdgeLabelBackground || borderColorArray?.length)) { + shapeSvg.selectAll("path").attr("style", nodeStyles); + } + return shapeSvg; + } + async function addText3(parentGroup, inputText, yOffset, style3 = "") { + if (inputText === "") { + return 0; + } + const textEl = parentGroup.insert("g").attr("class", "label").attr("style", style3); + const config5 = getConfig2(); + const useHtmlLabels = config5.htmlLabels ?? true; + const text4 = await createText( + textEl, + sanitizeText3(decodeEntities(inputText)), + { + width: calculateTextWidth(inputText, config5) + 50, + // Add room for error when splitting text into multiple lines + classes: "markdown-node-label", + useHtmlLabels, + style: style3 + }, + config5 + ); + let bbox; + if (!useHtmlLabels) { + const textChild = text4.children[0]; + for (const child of textChild.children) { + if (style3) { + child.setAttribute("style", style3); + } + } + bbox = text4.getBBox(); + bbox.height += 6; + } else { + const div = text4.children[0]; + const dv = select_default2(text4); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + textEl.attr("transform", `translate(${-bbox.width / 2},${-bbox.height / 2 + yOffset})`); + return bbox.height; + } + var init_requirementBox = __esm({ + "src/rendering-util/rendering-elements/shapes/requirementBox.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_utils2(); + init_diagramAPI(); + init_createText(); + init_src32(); + __name(requirementBox, "requirementBox"); + __name(addText3, "addText"); + } + }); + + // src/rendering-util/rendering-elements/shapes/kanbanItem.ts + async function kanbanItem(parent4, kanbanNode, { config: config5 }) { + const { labelStyles, nodeStyles } = styles2String(kanbanNode); + kanbanNode.labelStyle = labelStyles || ""; + const labelPaddingX = 10; + const orgWidth = kanbanNode.width; + kanbanNode.width = (kanbanNode.width ?? 200) - 10; + const { + shapeSvg, + bbox, + label: labelElTitle + } = await labelHelper(parent4, kanbanNode, getNodeClasses(kanbanNode)); + const padding2 = kanbanNode.padding || 10; + let ticketUrl = ""; + let link2; + if ("ticket" in kanbanNode && kanbanNode.ticket && config5?.kanban?.ticketBaseUrl) { + ticketUrl = config5?.kanban?.ticketBaseUrl.replace("#TICKET#", kanbanNode.ticket); + link2 = shapeSvg.insert("svg:a", ":first-child").attr("class", "kanban-ticket-link").attr("xlink:href", ticketUrl).attr("target", "_blank"); + } + const options2 = { + useHtmlLabels: kanbanNode.useHtmlLabels, + labelStyle: kanbanNode.labelStyle || "", + width: kanbanNode.width, + img: kanbanNode.img, + padding: kanbanNode.padding || 8, + centerLabel: false + }; + let labelEl, bbox2; + if (link2) { + ({ label: labelEl, bbox: bbox2 } = await insertLabel( + link2, + "ticket" in kanbanNode && kanbanNode.ticket || "", + options2 + )); + } else { + ({ label: labelEl, bbox: bbox2 } = await insertLabel( + shapeSvg, + "ticket" in kanbanNode && kanbanNode.ticket || "", + options2 + )); + } + const { label: labelElAssigned, bbox: bboxAssigned } = await insertLabel( + shapeSvg, + "assigned" in kanbanNode && kanbanNode.assigned || "", + options2 + ); + kanbanNode.width = orgWidth; + const labelPaddingY = 10; + const totalWidth = kanbanNode?.width || 0; + const heightAdj = Math.max(bbox2.height, bboxAssigned.height) / 2; + const totalHeight = Math.max(bbox.height + labelPaddingY * 2, kanbanNode?.height || 0) + heightAdj; + const x5 = -totalWidth / 2; + const y6 = -totalHeight / 2; + labelElTitle.attr( + "transform", + "translate(" + (padding2 - totalWidth / 2) + ", " + (-heightAdj - bbox.height / 2) + ")" + ); + labelEl.attr( + "transform", + "translate(" + (padding2 - totalWidth / 2) + ", " + (-heightAdj + bbox.height / 2) + ")" + ); + labelElAssigned.attr( + "transform", + "translate(" + (padding2 + totalWidth / 2 - bboxAssigned.width - 2 * labelPaddingX) + ", " + (-heightAdj + bbox.height / 2) + ")" + ); + let rect3; + const { rx, ry } = kanbanNode; + const { cssStyles } = kanbanNode; + if (kanbanNode.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options3 = userNodeOverrides(kanbanNode, {}); + const roughNode = rx || ry ? rc.path(createRoundedRectPathD(x5, y6, totalWidth, totalHeight, rx || 0), options3) : rc.rectangle(x5, y6, totalWidth, totalHeight, options3); + rect3 = shapeSvg.insert(() => roughNode, ":first-child"); + rect3.attr("class", "basic label-container").attr("style", cssStyles ? cssStyles : null); + } else { + rect3 = shapeSvg.insert("rect", ":first-child"); + rect3.attr("class", "basic label-container __APA__").attr("style", nodeStyles).attr("rx", rx ?? 5).attr("ry", ry ?? 5).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight); + const priority3 = "priority" in kanbanNode && kanbanNode.priority; + if (priority3) { + const line2 = shapeSvg.append("line"); + const lineX = x5 + 2; + const y1 = y6 + Math.floor((rx ?? 0) / 2); + const y22 = y6 + totalHeight - Math.floor((rx ?? 0) / 2); + line2.attr("x1", lineX).attr("y1", y1).attr("x2", lineX).attr("y2", y22).attr("stroke-width", "4").attr("stroke", colorFromPriority(priority3)); + } + } + updateNodeBounds(kanbanNode, rect3); + kanbanNode.height = totalHeight; + kanbanNode.intersect = function(point8) { + return intersect_default.rect(kanbanNode, point8); + }; + return shapeSvg; + } + var colorFromPriority; + var init_kanbanItem = __esm({ + "src/rendering-util/rendering-elements/shapes/kanbanItem.ts"() { + "use strict"; + init_util(); + init_intersect(); + init_roundedRectPath(); + init_handDrawnShapeStyles(); + init_rough_esm(); + colorFromPriority = /* @__PURE__ */ __name((priority3) => { + switch (priority3) { + case "Very High": + return "red"; + case "High": + return "orange"; + case "Medium": + return null; + // no stroke + case "Low": + return "blue"; + case "Very Low": + return "lightblue"; + } + }, "colorFromPriority"); + __name(kanbanItem, "kanbanItem"); + } + }); + + // src/rendering-util/rendering-elements/shapes/bang.ts + async function bang(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox, halfPadding, label } = await labelHelper( + parent4, + node2, + getNodeClasses(node2) + ); + const w4 = bbox.width + 10 * halfPadding; + const h3 = bbox.height + 8 * halfPadding; + const r2 = 0.15 * w4; + const { cssStyles } = node2; + const minWidth = bbox.width + 20; + const minHeight = bbox.height + 20; + const effectiveWidth = Math.max(w4, minWidth); + const effectiveHeight = Math.max(h3, minHeight); + label.attr("transform", `translate(${-bbox.width / 2}, ${-bbox.height / 2})`); + let bangElem; + const path4 = `M0 0 + a${r2},${r2} 1 0,0 ${effectiveWidth * 0.25},${-1 * effectiveHeight * 0.1} + a${r2},${r2} 1 0,0 ${effectiveWidth * 0.25},${0} + a${r2},${r2} 1 0,0 ${effectiveWidth * 0.25},${0} + a${r2},${r2} 1 0,0 ${effectiveWidth * 0.25},${effectiveHeight * 0.1} + + a${r2},${r2} 1 0,0 ${effectiveWidth * 0.15},${effectiveHeight * 0.33} + a${r2 * 0.8},${r2 * 0.8} 1 0,0 0,${effectiveHeight * 0.34} + a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.15},${effectiveHeight * 0.33} + + a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.25},${effectiveHeight * 0.15} + a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.25},0 + a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.25},0 + a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.25},${-1 * effectiveHeight * 0.15} + + a${r2},${r2} 1 0,0 ${-1 * effectiveWidth * 0.1},${-1 * effectiveHeight * 0.33} + a${r2 * 0.8},${r2 * 0.8} 1 0,0 0,${-1 * effectiveHeight * 0.34} + a${r2},${r2} 1 0,0 ${effectiveWidth * 0.1},${-1 * effectiveHeight * 0.33} + H0 V0 Z`; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const roughNode = rc.path(path4, options2); + bangElem = shapeSvg.insert(() => roughNode, ":first-child"); + bangElem.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles)); + } else { + bangElem = shapeSvg.insert("path", ":first-child").attr("class", "basic label-container").attr("style", nodeStyles).attr("d", path4); + } + bangElem.attr("transform", `translate(${-effectiveWidth / 2}, ${-effectiveHeight / 2})`); + updateNodeBounds(node2, bangElem); + node2.calcIntersect = function(bounds4, point8) { + return intersect_default.rect(bounds4, point8); + }; + node2.intersect = function(point8) { + log.info("Bang intersect", node2, point8); + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_bang = __esm({ + "src/rendering-util/rendering-elements/shapes/bang.ts"() { + "use strict"; + init_logger(); + init_util(); + init_intersect(); + init_handDrawnShapeStyles(); + init_rough_esm(); + init_utils2(); + __name(bang, "bang"); + } + }); + + // src/rendering-util/rendering-elements/shapes/cloud.ts + async function cloud(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox, halfPadding, label } = await labelHelper( + parent4, + node2, + getNodeClasses(node2) + ); + const w4 = bbox.width + 2 * halfPadding; + const h3 = bbox.height + 2 * halfPadding; + const r1 = 0.15 * w4; + const r2 = 0.25 * w4; + const r3 = 0.35 * w4; + const r4 = 0.2 * w4; + const { cssStyles } = node2; + let cloudElem; + const path4 = `M0 0 + a${r1},${r1} 0 0,1 ${w4 * 0.25},${-1 * w4 * 0.1} + a${r3},${r3} 1 0,1 ${w4 * 0.4},${-1 * w4 * 0.1} + a${r2},${r2} 1 0,1 ${w4 * 0.35},${w4 * 0.2} + + a${r1},${r1} 1 0,1 ${w4 * 0.15},${h3 * 0.35} + a${r4},${r4} 1 0,1 ${-1 * w4 * 0.15},${h3 * 0.65} + + a${r2},${r1} 1 0,1 ${-1 * w4 * 0.25},${w4 * 0.15} + a${r3},${r3} 1 0,1 ${-1 * w4 * 0.5},0 + a${r1},${r1} 1 0,1 ${-1 * w4 * 0.25},${-1 * w4 * 0.15} + + a${r1},${r1} 1 0,1 ${-1 * w4 * 0.1},${-1 * h3 * 0.35} + a${r4},${r4} 1 0,1 ${w4 * 0.1},${-1 * h3 * 0.65} + H0 V0 Z`; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, {}); + const roughNode = rc.path(path4, options2); + cloudElem = shapeSvg.insert(() => roughNode, ":first-child"); + cloudElem.attr("class", "basic label-container").attr("style", handleUndefinedAttr(cssStyles)); + } else { + cloudElem = shapeSvg.insert("path", ":first-child").attr("class", "basic label-container").attr("style", nodeStyles).attr("d", path4); + } + label.attr("transform", `translate(${-bbox.width / 2}, ${-bbox.height / 2})`); + cloudElem.attr("transform", `translate(${-w4 / 2}, ${-h3 / 2})`); + updateNodeBounds(node2, cloudElem); + node2.calcIntersect = function(bounds4, point8) { + return intersect_default.rect(bounds4, point8); + }; + node2.intersect = function(point8) { + log.info("Cloud intersect", node2, point8); + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_cloud = __esm({ + "src/rendering-util/rendering-elements/shapes/cloud.ts"() { + "use strict"; + init_rough_esm(); + init_logger(); + init_utils2(); + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(cloud, "cloud"); + } + }); + + // src/rendering-util/rendering-elements/shapes/defaultMindmapNode.ts + async function defaultMindmapNode(parent4, node2) { + const { labelStyles, nodeStyles } = styles2String(node2); + node2.labelStyle = labelStyles; + const { shapeSvg, bbox, halfPadding, label } = await labelHelper( + parent4, + node2, + getNodeClasses(node2) + ); + const w4 = bbox.width + 8 * halfPadding; + const h3 = bbox.height + 2 * halfPadding; + const rd = 5; + const rectPath = node2.look === "neo" ? ` + M${-w4 / 2} ${h3 / 2 - rd} + v${-h3 + 2 * rd} + q0,-${rd} ${rd},-${rd} + h${w4 - 2 * rd} + q${rd},0 ${rd},${rd} + v${h3 - rd} + H${-w4 / 2} + Z + ` : ` + M${-w4 / 2} ${h3 / 2 - rd} + v${-h3 + 2 * rd} + q0,-${rd} ${rd},-${rd} + h${w4 - 2 * rd} + q${rd},0 ${rd},${rd} + v${h3 - 2 * rd} + q0,${rd} ${-rd},${rd} + h${-(w4 - 2 * rd)} + q${-rd},0 ${-rd},${-rd} + Z + `; + if (!node2.domId) { + throw new Error( + `defaultMindmapNode: node "${node2.id}" is missing a domId \u2014 was render.ts domId prefixing skipped?` + ); + } + const bg = shapeSvg.append("path").attr("id", node2.domId).attr("class", "node-bkg node-" + node2.type).attr("style", nodeStyles).attr("d", rectPath); + shapeSvg.append("line").attr("class", "node-line-").attr("x1", -w4 / 2).attr("y1", h3 / 2).attr("x2", w4 / 2).attr("y2", h3 / 2); + label.attr("transform", `translate(${-bbox.width / 2}, ${-bbox.height / 2})`); + shapeSvg.append(() => label.node()); + updateNodeBounds(node2, bg); + node2.calcIntersect = function(bounds4, point8) { + return intersect_default.rect(bounds4, point8); + }; + node2.intersect = function(point8) { + return intersect_default.rect(node2, point8); + }; + return shapeSvg; + } + var init_defaultMindmapNode = __esm({ + "src/rendering-util/rendering-elements/shapes/defaultMindmapNode.ts"() { + "use strict"; + init_intersect(); + init_handDrawnShapeStyles(); + init_util(); + __name(defaultMindmapNode, "defaultMindmapNode"); + } + }); + + // src/rendering-util/rendering-elements/shapes/mindmapCircle.ts + async function mindmapCircle(parent4, node2) { + const options2 = { + padding: node2.padding ?? 0 + }; + return circle(parent4, node2, options2); + } + var init_mindmapCircle = __esm({ + "src/rendering-util/rendering-elements/shapes/mindmapCircle.ts"() { + "use strict"; + init_circle(); + __name(mindmapCircle, "mindmapCircle"); + } + }); + + // src/rendering-util/rendering-elements/shapes.ts + function isValidShape(shape) { + return shape in shapes; + } + var shapesDefs, generateShapeMap, shapes; + var init_shapes = __esm({ + "src/rendering-util/rendering-elements/shapes.ts"() { + "use strict"; + init_anchor(); + init_bowTieRect(); + init_card(); + init_choice(); + init_circle(); + init_crossedCircle(); + init_curlyBraceLeft(); + init_curlyBraceRight(); + init_curlyBraces(); + init_curvedTrapezoid(); + init_cylinder(); + init_datastore(); + init_dividedRect(); + init_doubleCircle(); + init_filledCircle(); + init_flippedTriangle(); + init_forkJoin(); + init_halfRoundedRectangle(); + init_hexagon(); + init_hourglass(); + init_icon(); + init_iconCircle(); + init_iconRounded(); + init_iconSquare(); + init_imageSquare(); + init_invertedTrapezoid(); + init_labelRect(); + init_leanLeft(); + init_leanRight(); + init_lightningBolt(); + init_linedCylinder(); + init_linedWaveEdgedRect(); + init_multiRect(); + init_multiWaveEdgedRectangle(); + init_note(); + init_question(); + init_rectLeftInvArrow(); + init_rectWithTitle(); + init_roundedRect(); + init_shadedProcess(); + init_slopedRect(); + init_squareRect(); + init_stadium(); + init_state(); + init_stateEnd(); + init_stateStart(); + init_subroutine(); + init_taggedRect(); + init_taggedWaveEdgedRectangle(); + init_text3(); + init_tiltedCylinder(); + init_trapezoid(); + init_trapezoidalPentagon(); + init_triangle(); + init_waveEdgedRectangle(); + init_waveRectangle(); + init_windowPane(); + init_erBox(); + init_classBox(); + init_requirementBox(); + init_kanbanItem(); + init_bang(); + init_cloud(); + init_defaultMindmapNode(); + init_mindmapCircle(); + shapesDefs = [ + { + semanticName: "Process", + name: "Rectangle", + shortName: "rect", + description: "Standard process shape", + aliases: ["proc", "process", "rectangle"], + internalAliases: ["squareRect"], + handler: squareRect + }, + { + semanticName: "Event", + name: "Rounded Rectangle", + shortName: "rounded", + description: "Represents an event", + aliases: ["event"], + internalAliases: ["roundedRect"], + handler: roundedRect + }, + { + semanticName: "Terminal Point", + name: "Stadium", + shortName: "stadium", + description: "Terminal point", + aliases: ["terminal", "pill"], + handler: stadium + }, + { + semanticName: "Subprocess", + name: "Framed Rectangle", + shortName: "fr-rect", + description: "Subprocess", + aliases: ["subprocess", "subproc", "framed-rectangle", "subroutine"], + handler: subroutine + }, + { + semanticName: "Database", + name: "Cylinder", + shortName: "cyl", + description: "Database storage", + aliases: ["db", "database", "cylinder"], + handler: cylinder + }, + { + semanticName: "Data Store", + name: "Data Store", + shortName: "datastore", + description: "Data flow diagram data store", + aliases: ["data-store"], + handler: datastore + }, + { + semanticName: "Start", + name: "Circle", + shortName: "circle", + description: "Starting point", + aliases: ["circ"], + handler: circle + }, + { + semanticName: "Bang", + name: "Bang", + shortName: "bang", + description: "Bang", + aliases: ["bang"], + handler: bang + }, + { + semanticName: "Cloud", + name: "Cloud", + shortName: "cloud", + description: "cloud", + aliases: ["cloud"], + handler: cloud + }, + { + semanticName: "Decision", + name: "Diamond", + shortName: "diam", + description: "Decision-making step", + aliases: ["decision", "diamond", "question"], + handler: question + }, + { + semanticName: "Prepare Conditional", + name: "Hexagon", + shortName: "hex", + description: "Preparation or condition step", + aliases: ["hexagon", "prepare"], + handler: hexagon + }, + { + semanticName: "Data Input/Output", + name: "Lean Right", + shortName: "lean-r", + description: "Represents input or output", + aliases: ["lean-right", "in-out"], + internalAliases: ["lean_right"], + handler: lean_right + }, + { + semanticName: "Data Input/Output", + name: "Lean Left", + shortName: "lean-l", + description: "Represents output or input", + aliases: ["lean-left", "out-in"], + internalAliases: ["lean_left"], + handler: lean_left + }, + { + semanticName: "Priority Action", + name: "Trapezoid Base Bottom", + shortName: "trap-b", + description: "Priority action", + aliases: ["priority", "trapezoid-bottom", "trapezoid"], + handler: trapezoid + }, + { + semanticName: "Manual Operation", + name: "Trapezoid Base Top", + shortName: "trap-t", + description: "Represents a manual task", + aliases: ["manual", "trapezoid-top", "inv-trapezoid"], + internalAliases: ["inv_trapezoid"], + handler: inv_trapezoid + }, + { + semanticName: "Stop", + name: "Double Circle", + shortName: "dbl-circ", + description: "Represents a stop point", + aliases: ["double-circle"], + internalAliases: ["doublecircle"], + handler: doublecircle + }, + { + semanticName: "Text Block", + name: "Text Block", + shortName: "text", + description: "Text block", + handler: text3 + }, + { + semanticName: "Card", + name: "Notched Rectangle", + shortName: "notch-rect", + description: "Represents a card", + aliases: ["card", "notched-rectangle"], + handler: card + }, + { + semanticName: "Lined/Shaded Process", + name: "Lined Rectangle", + shortName: "lin-rect", + description: "Lined process shape", + aliases: ["lined-rectangle", "lined-process", "lin-proc", "shaded-process"], + handler: shadedProcess + }, + { + semanticName: "Start", + name: "Small Circle", + shortName: "sm-circ", + description: "Small starting point", + aliases: ["start", "small-circle"], + internalAliases: ["stateStart"], + handler: stateStart + }, + { + semanticName: "Stop", + name: "Framed Circle", + shortName: "fr-circ", + description: "Stop point", + aliases: ["stop", "framed-circle"], + internalAliases: ["stateEnd"], + handler: stateEnd + }, + { + semanticName: "Fork/Join", + name: "Filled Rectangle", + shortName: "fork", + description: "Fork or join in process flow", + aliases: ["join"], + internalAliases: ["forkJoin"], + handler: forkJoin + }, + { + semanticName: "Collate", + name: "Hourglass", + shortName: "hourglass", + description: "Represents a collate operation", + aliases: ["hourglass", "collate"], + handler: hourglass + }, + { + semanticName: "Comment", + name: "Curly Brace", + shortName: "brace", + description: "Adds a comment", + aliases: ["comment", "brace-l"], + handler: curlyBraceLeft + }, + { + semanticName: "Comment Right", + name: "Curly Brace", + shortName: "brace-r", + description: "Adds a comment", + handler: curlyBraceRight + }, + { + semanticName: "Comment with braces on both sides", + name: "Curly Braces", + shortName: "braces", + description: "Adds a comment", + handler: curlyBraces + }, + { + semanticName: "Com Link", + name: "Lightning Bolt", + shortName: "bolt", + description: "Communication link", + aliases: ["com-link", "lightning-bolt"], + handler: lightningBolt + }, + { + semanticName: "Document", + name: "Document", + shortName: "doc", + description: "Represents a document", + aliases: ["doc", "document"], + handler: waveEdgedRectangle + }, + { + semanticName: "Delay", + name: "Half-Rounded Rectangle", + shortName: "delay", + description: "Represents a delay", + aliases: ["half-rounded-rectangle"], + handler: halfRoundedRectangle + }, + { + semanticName: "Direct Access Storage", + name: "Horizontal Cylinder", + shortName: "h-cyl", + description: "Direct access storage", + aliases: ["das", "horizontal-cylinder"], + handler: tiltedCylinder + }, + { + semanticName: "Disk Storage", + name: "Lined Cylinder", + shortName: "lin-cyl", + description: "Disk storage", + aliases: ["disk", "lined-cylinder"], + handler: linedCylinder + }, + { + semanticName: "Display", + name: "Curved Trapezoid", + shortName: "curv-trap", + description: "Represents a display", + aliases: ["curved-trapezoid", "display"], + handler: curvedTrapezoid + }, + { + semanticName: "Divided Process", + name: "Divided Rectangle", + shortName: "div-rect", + description: "Divided process shape", + aliases: ["div-proc", "divided-rectangle", "divided-process"], + handler: dividedRectangle + }, + { + semanticName: "Extract", + name: "Triangle", + shortName: "tri", + description: "Extraction process", + aliases: ["extract", "triangle"], + handler: triangle + }, + { + semanticName: "Internal Storage", + name: "Window Pane", + shortName: "win-pane", + description: "Internal storage", + aliases: ["internal-storage", "window-pane"], + handler: windowPane + }, + { + semanticName: "Junction", + name: "Filled Circle", + shortName: "f-circ", + description: "Junction point", + aliases: ["junction", "filled-circle"], + handler: filledCircle + }, + { + semanticName: "Loop Limit", + name: "Trapezoidal Pentagon", + shortName: "notch-pent", + description: "Loop limit step", + aliases: ["loop-limit", "notched-pentagon"], + handler: trapezoidalPentagon + }, + { + semanticName: "Manual File", + name: "Flipped Triangle", + shortName: "flip-tri", + description: "Manual file operation", + aliases: ["manual-file", "flipped-triangle"], + handler: flippedTriangle + }, + { + semanticName: "Manual Input", + name: "Sloped Rectangle", + shortName: "sl-rect", + description: "Manual input step", + aliases: ["manual-input", "sloped-rectangle"], + handler: slopedRect + }, + { + semanticName: "Multi-Document", + name: "Stacked Document", + shortName: "docs", + description: "Multiple documents", + aliases: ["documents", "st-doc", "stacked-document"], + handler: multiWaveEdgedRectangle + }, + { + semanticName: "Multi-Process", + name: "Stacked Rectangle", + shortName: "st-rect", + description: "Multiple processes", + aliases: ["procs", "processes", "stacked-rectangle"], + handler: multiRect + }, + { + semanticName: "Stored Data", + name: "Bow Tie Rectangle", + shortName: "bow-rect", + description: "Stored data", + aliases: ["stored-data", "bow-tie-rectangle"], + handler: bowTieRect + }, + { + semanticName: "Summary", + name: "Crossed Circle", + shortName: "cross-circ", + description: "Summary", + aliases: ["summary", "crossed-circle"], + handler: crossedCircle + }, + { + semanticName: "Tagged Document", + name: "Tagged Document", + shortName: "tag-doc", + description: "Tagged document", + aliases: ["tag-doc", "tagged-document"], + handler: taggedWaveEdgedRectangle + }, + { + semanticName: "Tagged Process", + name: "Tagged Rectangle", + shortName: "tag-rect", + description: "Tagged process", + aliases: ["tagged-rectangle", "tag-proc", "tagged-process"], + handler: taggedRect + }, + { + semanticName: "Paper Tape", + name: "Flag", + shortName: "flag", + description: "Paper tape", + aliases: ["paper-tape"], + handler: waveRectangle + }, + { + semanticName: "Odd", + name: "Odd", + shortName: "odd", + description: "Odd shape", + internalAliases: ["rect_left_inv_arrow"], + handler: rect_left_inv_arrow + }, + { + semanticName: "Lined Document", + name: "Lined Document", + shortName: "lin-doc", + description: "Lined document", + aliases: ["lined-document"], + handler: linedWaveEdgedRect + } + ]; + generateShapeMap = /* @__PURE__ */ __name(() => { + const undocumentedShapes = { + // States + state, + choice, + note, + // Rectangles + rectWithTitle, + labelRect, + // Icons + iconSquare, + iconCircle, + icon, + iconRounded, + imageSquare, + anchor, + // Kanban diagram + kanbanItem, + //Mindmap diagram + mindmapCircle, + defaultMindmapNode, + // class diagram + classBox, + // er diagram + erBox, + // Requirement diagram + requirementBox + }; + const entries2 = [ + ...Object.entries(undocumentedShapes), + ...shapesDefs.flatMap((shape) => { + const aliases = [ + shape.shortName, + ..."aliases" in shape ? shape.aliases : [], + ..."internalAliases" in shape ? shape.internalAliases : [] + ]; + return aliases.map((alias) => [alias, shape.handler]); + }) + ]; + return Object.fromEntries(entries2); + }, "generateShapeMap"); + shapes = generateShapeMap(); + __name(isValidShape, "isValidShape"); + } + }); + + // src/diagrams/flowchart/flowDb.ts + var MERMAID_DOM_ID_PREFIX, FlowDB; + var init_flowDb = __esm({ + "src/diagrams/flowchart/flowDb.ts"() { + "use strict"; + init_src32(); + init_js_yaml(); + init_diagramAPI(); + init_logger(); + init_shapes(); + init_utils2(); + init_common(); + init_commonDb(); + init_svgDrawCommon(); + init_purify_es(); + MERMAID_DOM_ID_PREFIX = "flowchart-"; + FlowDB = class { + // cspell:ignore funs + constructor() { + this.vertexCounter = 0; + this.config = getConfig2(); + this.diagramId = ""; + this.vertices = /* @__PURE__ */ new Map(); + this.edges = []; + this.classes = /* @__PURE__ */ new Map(); + this.subGraphs = []; + this.subGraphLookup = /* @__PURE__ */ new Map(); + this.tooltips = /* @__PURE__ */ new Map(); + this.subCount = 0; + this.firstGraphFlag = true; + // As in graph + this.secCount = -1; + this.posCrossRef = []; + // Functions to be run after graph rendering + this.funs = []; + this.setAccTitle = setAccTitle; + this.setAccDescription = setAccDescription; + this.setDiagramTitle = setDiagramTitle; + this.getAccTitle = getAccTitle; + this.getAccDescription = getAccDescription; + this.getDiagramTitle = getDiagramTitle; + this.funs.push(this.setupToolTips.bind(this)); + this.addVertex = this.addVertex.bind(this); + this.firstGraph = this.firstGraph.bind(this); + this.setDirection = this.setDirection.bind(this); + this.addSubGraph = this.addSubGraph.bind(this); + this.addLink = this.addLink.bind(this); + this.setLink = this.setLink.bind(this); + this.updateLink = this.updateLink.bind(this); + this.addClass = this.addClass.bind(this); + this.setClass = this.setClass.bind(this); + this.destructLink = this.destructLink.bind(this); + this.setClickEvent = this.setClickEvent.bind(this); + this.setTooltip = this.setTooltip.bind(this); + this.updateLinkInterpolate = this.updateLinkInterpolate.bind(this); + this.setClickFun = this.setClickFun.bind(this); + this.bindFunctions = this.bindFunctions.bind(this); + this.lex = { + firstGraph: this.firstGraph.bind(this) + }; + this.clear(); + this.setGen("gen-2"); + } + static { + __name(this, "FlowDB"); + } + sanitizeText(txt) { + return common_default.sanitizeText(txt, this.config); + } + sanitizeNodeLabelType(labelType) { + switch (labelType) { + case "markdown": + case "string": + case "text": + return labelType; + default: + return "markdown"; + } + } + /** + * Sets the diagram's SVG element ID, used to prefix domIds for uniqueness + * across multiple diagrams on the same page. + */ + setDiagramId(svgElementId) { + this.diagramId = svgElementId; + } + /** + * Function to lookup domId from id in the graph definition. + * When diagramId is set, returns the prefixed version for DOM uniqueness. + * + * @param id - id of the node + */ + lookUpDomId(id35) { + for (const vertex of this.vertices.values()) { + if (vertex.id === id35) { + return this.diagramId ? `${this.diagramId}-${vertex.domId}` : vertex.domId; + } + } + return this.diagramId ? `${this.diagramId}-${id35}` : id35; + } + /** + * Function called by parser when a node definition has been found + */ + addVertex(id35, textObj, type3, style3, classes3, dir2, props = {}, metadata) { + if (!id35 || id35.trim().length === 0) { + return; + } + let doc; + if (metadata !== void 0) { + let yamlData; + if (!metadata.includes("\n")) { + yamlData = "{\n" + metadata + "\n}"; + } else { + yamlData = metadata + "\n"; + } + doc = load(yamlData, { schema: JSON_SCHEMA }); + } + const edge = this.edges.find((e3) => e3.id === id35); + if (edge) { + const edgeDoc = doc; + if (edgeDoc?.animate !== void 0) { + edge.animate = edgeDoc.animate; + } + if (edgeDoc?.animation !== void 0) { + edge.animation = edgeDoc.animation; + } + if (edgeDoc?.curve !== void 0) { + edge.interpolate = edgeDoc.curve; + } + return; + } + let txt; + let vertex = this.vertices.get(id35); + if (vertex === void 0) { + if (textObj === void 0 && type3 === void 0 && style3 !== void 0 && style3 !== null) { + log.warn( + `Style applied to unknown node "${id35}". This may indicate a typo. The node will be created automatically.` + ); + } + vertex = { + id: id35, + labelType: "text", + domId: MERMAID_DOM_ID_PREFIX + id35 + "-" + this.vertexCounter, + styles: [], + classes: [] + }; + this.vertices.set(id35, vertex); + } + this.vertexCounter++; + if (textObj !== void 0) { + this.config = getConfig2(); + txt = this.sanitizeText(textObj.text.trim()); + vertex.labelType = textObj.type; + if (txt.startsWith('"') && txt.endsWith('"')) { + txt = txt.substring(1, txt.length - 1); + } + vertex.text = txt; + } else { + if (vertex.text === void 0) { + vertex.text = id35; + } + } + if (type3 !== void 0) { + vertex.type = type3; + } + if (style3 !== void 0 && style3 !== null) { + style3.forEach((s2) => { + vertex.styles.push(s2); + }); + } + if (classes3 !== void 0 && classes3 !== null) { + classes3.forEach((s2) => { + vertex.classes.push(s2); + }); + } + if (dir2 !== void 0) { + vertex.dir = dir2; + } + if (vertex.props === void 0) { + vertex.props = props; + } else if (props !== void 0) { + Object.assign(vertex.props, props); + } + if (doc !== void 0) { + if (doc.shape) { + if (doc.shape !== doc.shape.toLowerCase() || doc.shape.includes("_")) { + throw new Error(`No such shape: ${doc.shape}. Shape names should be lowercase.`); + } else if (!isValidShape(doc.shape)) { + throw new Error(`No such shape: ${doc.shape}.`); + } + vertex.type = doc?.shape; + } + if (doc?.label) { + vertex.text = doc?.label; + vertex.labelType = this.sanitizeNodeLabelType(doc?.labelType); + } + if (doc?.icon) { + vertex.icon = doc?.icon; + if (!doc.label?.trim() && vertex.text === id35) { + vertex.text = ""; + } + } + if (doc?.form) { + vertex.form = doc?.form; + } + if (doc?.pos) { + vertex.pos = doc?.pos; + } + if (doc?.img) { + vertex.img = doc?.img; + if (!doc.label?.trim() && vertex.text === id35) { + vertex.text = ""; + } + } + if (doc?.constraint) { + vertex.constraint = doc.constraint; + } + if (doc.w) { + vertex.assetWidth = Number(doc.w); + } + if (doc.h) { + vertex.assetHeight = Number(doc.h); + } + } + } + /** + * Function called by parser when a link/edge definition has been found + * + */ + addSingleLink(_start, _end, type3, id35) { + const start3 = _start; + const end2 = _end; + const edge = { + start: start3, + end: end2, + type: void 0, + text: "", + labelType: "text", + classes: [], + isUserDefinedId: false, + interpolate: this.edges.defaultInterpolate + }; + log.info("abc78 Got edge...", edge); + const linkTextObj = type3.text; + if (linkTextObj !== void 0) { + edge.text = this.sanitizeText(linkTextObj.text.trim()); + if (edge.text.startsWith('"') && edge.text.endsWith('"')) { + edge.text = edge.text.substring(1, edge.text.length - 1); + } + edge.labelType = this.sanitizeNodeLabelType(linkTextObj.type); + } + if (type3 !== void 0) { + edge.type = type3.type; + edge.stroke = type3.stroke; + edge.length = type3.length > 10 ? 10 : type3.length; + } + if (id35 && !this.edges.some((e3) => e3.id === id35)) { + edge.id = id35; + edge.isUserDefinedId = true; + } else { + const existingLinks = this.edges.filter((e3) => e3.start === edge.start && e3.end === edge.end); + if (existingLinks.length === 0) { + edge.id = getEdgeId(edge.start, edge.end, { counter: 0, prefix: "L" }); + } else { + edge.id = getEdgeId(edge.start, edge.end, { + counter: existingLinks.length + 1, + prefix: "L" + }); + } + } + if (this.edges.length < (this.config.maxEdges ?? 500)) { + log.info("Pushing edge..."); + this.edges.push(edge); + } else { + throw new Error( + `Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}. + +Initialize mermaid with maxEdges set to a higher number to allow more edges. +You cannot set this config via configuration inside the diagram as it is a secure config. +You have to call mermaid.initialize.` + ); + } + } + isLinkData(value2) { + return value2 !== null && typeof value2 === "object" && "id" in value2 && typeof value2.id === "string"; + } + addLink(_start, _end, linkData) { + const id35 = this.isLinkData(linkData) ? linkData.id.replace("@", "") : void 0; + log.info("addLink", _start, _end, id35); + for (const start3 of _start) { + for (const end2 of _end) { + const isLastStart = start3 === _start[_start.length - 1]; + const isFirstEnd = end2 === _end[0]; + if (isLastStart && isFirstEnd) { + this.addSingleLink(start3, end2, linkData, id35); + } else { + this.addSingleLink(start3, end2, linkData, void 0); + } + } + } + } + /** + * Updates a link's line interpolation algorithm + */ + updateLinkInterpolate(positions2, interpolate) { + positions2.forEach((pos) => { + if (pos === "default") { + this.edges.defaultInterpolate = interpolate; + } else { + this.edges[pos].interpolate = interpolate; + } + }); + } + /** + * Updates a link with a style + * + */ + updateLink(positions2, style3) { + positions2.forEach((pos) => { + if (typeof pos === "number" && pos >= this.edges.length) { + throw new Error( + `The index ${pos} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length - 1}. (Help: Ensure that the index is within the range of existing edges.)` + ); + } + if (pos === "default") { + this.edges.defaultStyle = style3; + } else { + this.edges[pos].style = style3; + if ((this.edges[pos]?.style?.length ?? 0) > 0 && !this.edges[pos]?.style?.some((s2) => s2?.startsWith("fill"))) { + this.edges[pos]?.style?.push("fill:none"); + } + } + }); + } + addClass(ids, _style) { + const style3 = _style.join().replace(/\\,/g, "\xA7\xA7\xA7").replace(/,/g, ";").replace(/§§§/g, ",").split(";"); + ids.split(",").forEach((id35) => { + let classNode = this.classes.get(id35); + if (classNode === void 0) { + classNode = { id: id35, styles: [], textStyles: [] }; + this.classes.set(id35, classNode); + } + if (style3 !== void 0 && style3 !== null) { + style3.forEach((s2) => { + if (/color/.exec(s2)) { + const newStyle = s2.replace("fill", "bgFill"); + classNode.textStyles.push(newStyle); + } + classNode.styles.push(s2); + }); + } + }); + } + /** + * Called by parser when a graph definition is found, stores the direction of the chart. + * + */ + setDirection(dir2) { + this.direction = dir2.trim(); + if (/.*/.exec(this.direction)) { + this.direction = "LR"; + } + if (/.*v/.exec(this.direction)) { + this.direction = "TB"; + } + if (this.direction === "TD") { + this.direction = "TB"; + } + } + /** + * Called by parser when a special node is found, e.g. a clickable element. + * + * @param ids - Comma separated list of ids + * @param className - Class to add + */ + setClass(ids, className) { + for (const id35 of ids.split(",")) { + const vertex = this.vertices.get(id35); + if (vertex) { + vertex.classes.push(className); + } + const edge = this.edges.find((e3) => e3.id === id35); + if (edge) { + edge.classes.push(className); + } + const subGraph = this.subGraphLookup.get(id35); + if (subGraph) { + subGraph.classes.push(className); + } + } + } + setTooltip(ids, tooltip) { + if (tooltip === void 0) { + return; + } + tooltip = this.sanitizeText(tooltip); + for (const id35 of ids.split(",")) { + this.tooltips.set(this.version === "gen-1" ? this.lookUpDomId(id35) : id35, tooltip); + } + } + setClickFun(id35, functionName, functionArgs) { + if (getConfig2().securityLevel !== "loose") { + return; + } + if (functionName === void 0) { + return; + } + let argList = []; + if (typeof functionArgs === "string") { + argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); + for (let i2 = 0; i2 < argList.length; i2++) { + let item = argList[i2].trim(); + if (item.startsWith('"') && item.endsWith('"')) { + item = item.substr(1, item.length - 2); + } + argList[i2] = item; + } + } + if (argList.length === 0) { + argList.push(id35); + } + const vertex = this.vertices.get(id35); + if (vertex) { + vertex.haveCallback = true; + this.funs.push(() => { + const domId = this.lookUpDomId(id35); + const elem = document.querySelector(`[id="${domId}"]`); + if (elem !== null) { + elem.addEventListener( + "click", + () => { + utils_default2.runFunc(functionName, ...argList); + }, + false + ); + } + }); + } + } + /** + * Called by parser when a link is found. Adds the URL to the vertex data. + * + * @param ids - Comma separated list of ids + * @param linkStr - URL to create a link for + * @param target - Target attribute for the link + */ + setLink(ids, linkStr, target) { + ids.split(",").forEach((id35) => { + const vertex = this.vertices.get(id35); + if (vertex !== void 0) { + vertex.link = utils_default2.formatUrl(linkStr, this.config); + vertex.linkTarget = target; + } + }); + this.setClass(ids, "clickable"); + } + getTooltip(id35) { + return this.tooltips.get(id35); + } + /** + * Called by parser when a click definition is found. Registers an event handler. + * + * @param ids - Comma separated list of ids + * @param functionName - Function to be called on click + * @param functionArgs - Arguments to be passed to the function + */ + setClickEvent(ids, functionName, functionArgs) { + ids.split(",").forEach((id35) => { + this.setClickFun(id35, functionName, functionArgs); + }); + this.setClass(ids, "clickable"); + } + bindFunctions(element3) { + this.funs.forEach((fun) => { + fun(element3); + }); + } + getDirection() { + return this.direction?.trim(); + } + /** + * Retrieval function for fetching the found nodes after parsing has completed. + * + */ + getVertices() { + return this.vertices; + } + /** + * Retrieval function for fetching the found links after parsing has completed. + * + */ + getEdges() { + return this.edges; + } + /** + * Retrieval function for fetching the found class definitions after parsing has completed. + * + */ + getClasses() { + return this.classes; + } + setupToolTips(element3) { + const tooltipElem = createTooltip(); + const svg2 = select_default2(element3).select("svg"); + const nodes5 = svg2.selectAll("g.node"); + nodes5.on("mouseover", (e3) => { + const el = select_default2(e3.currentTarget); + const title2 = el.attr("title"); + if (title2 === null) { + return; + } + const rect3 = e3.currentTarget?.getBoundingClientRect(); + tooltipElem.transition().duration(200).style("opacity", ".9"); + tooltipElem.text(el.attr("title")).style("left", window.scrollX + rect3.left + (rect3.right - rect3.left) / 2 + "px").style("top", window.scrollY + rect3.bottom + "px"); + tooltipElem.html(purify.sanitize(title2)); + el.classed("hover", true); + }).on("mouseout", (e3) => { + tooltipElem.transition().duration(500).style("opacity", 0); + const el = select_default2(e3.currentTarget); + el.classed("hover", false); + }); + } + /** + * Clears the internal graph db so that a new graph can be parsed. + * + */ + clear(ver = "gen-2") { + this.vertices = /* @__PURE__ */ new Map(); + this.classes = /* @__PURE__ */ new Map(); + this.edges = []; + this.funs = [this.setupToolTips.bind(this)]; + this.diagramId = ""; + this.subGraphs = []; + this.subGraphLookup = /* @__PURE__ */ new Map(); + this.subCount = 0; + this.tooltips = /* @__PURE__ */ new Map(); + this.firstGraphFlag = true; + this.version = ver; + this.config = getConfig2(); + clear(); + } + setGen(ver) { + this.version = ver || "gen-2"; + } + defaultStyle() { + return "fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"; + } + addSubGraph(_id, list, _title) { + let id35 = _id.text.trim(); + let title2 = _title.text; + if (_id === _title && /\s/.exec(_title.text)) { + id35 = void 0; + } + const uniq2 = /* @__PURE__ */ __name((a2) => { + const prims = { boolean: {}, number: {}, string: {} }; + const objs = []; + let dir3; + const nodeList2 = a2.filter(function(item) { + const type3 = typeof item; + if (item.stmt && item.stmt === "dir") { + dir3 = item.value; + return false; + } + if (item.trim() === "") { + return false; + } + if (type3 in prims) { + return prims[type3].hasOwnProperty(item) ? false : prims[type3][item] = true; + } else { + return objs.includes(item) ? false : objs.push(item); + } + }); + return { nodeList: nodeList2, dir: dir3 }; + }, "uniq"); + const result = uniq2(list.flat()); + const nodeList = result.nodeList; + let dir2 = result.dir; + const flowchartConfig = getConfig2().flowchart ?? {}; + dir2 = dir2 ?? (flowchartConfig.inheritDir ? this.getDirection() ?? getConfig2().direction ?? void 0 : void 0); + if (this.version === "gen-1") { + for (let i2 = 0; i2 < nodeList.length; i2++) { + nodeList[i2] = this.lookUpDomId(nodeList[i2]); + } + } + id35 = id35 ?? "subGraph" + this.subCount; + title2 = title2 || ""; + title2 = this.sanitizeText(title2); + this.subCount = this.subCount + 1; + const subGraph = { + id: id35, + nodes: nodeList, + title: title2.trim(), + classes: [], + dir: dir2, + labelType: this.sanitizeNodeLabelType(_title?.type) + }; + log.info("Adding", subGraph.id, subGraph.nodes, subGraph.dir); + subGraph.nodes = this.makeUniq(subGraph, this.subGraphs).nodes; + this.subGraphs.push(subGraph); + this.subGraphLookup.set(id35, subGraph); + return id35; + } + getPosForId(id35) { + for (const [i2, subGraph] of this.subGraphs.entries()) { + if (subGraph.id === id35) { + return i2; + } + } + return -1; + } + indexNodes2(id35, pos) { + const nodes5 = this.subGraphs[pos].nodes; + this.secCount = this.secCount + 1; + if (this.secCount > 2e3) { + return { + result: false, + count: 0 + }; + } + this.posCrossRef[this.secCount] = pos; + if (this.subGraphs[pos].id === id35) { + return { + result: true, + count: 0 + }; + } + let count2 = 0; + let posCount = 1; + while (count2 < nodes5.length) { + const childPos = this.getPosForId(nodes5[count2]); + if (childPos >= 0) { + const res = this.indexNodes2(id35, childPos); + if (res.result) { + return { + result: true, + count: posCount + res.count + }; + } else { + posCount = posCount + res.count; + } + } + count2 = count2 + 1; + } + return { + result: false, + count: posCount + }; + } + getDepthFirstPos(pos) { + return this.posCrossRef[pos]; + } + indexNodes() { + this.secCount = -1; + if (this.subGraphs.length > 0) { + this.indexNodes2("none", this.subGraphs.length - 1); + } + } + getSubGraphs() { + return this.subGraphs; + } + firstGraph() { + if (this.firstGraphFlag) { + this.firstGraphFlag = false; + return true; + } + return false; + } + destructStartLink(_str) { + let str2 = _str.trim(); + let type3 = "arrow_open"; + switch (str2[0]) { + case "<": + type3 = "arrow_point"; + str2 = str2.slice(1); + break; + case "x": + type3 = "arrow_cross"; + str2 = str2.slice(1); + break; + case "o": + type3 = "arrow_circle"; + str2 = str2.slice(1); + break; + } + let stroke = "normal"; + if (str2.includes("=")) { + stroke = "thick"; + } + if (str2.includes(".")) { + stroke = "dotted"; + } + return { type: type3, stroke }; + } + countChar(char2, str2) { + const length2 = str2.length; + let count2 = 0; + for (let i2 = 0; i2 < length2; ++i2) { + if (str2[i2] === char2) { + ++count2; + } + } + return count2; + } + destructEndLink(_str) { + const str2 = _str.trim(); + let line2 = str2.slice(0, -1); + let type3 = "arrow_open"; + switch (str2.slice(-1)) { + case "x": + type3 = "arrow_cross"; + if (str2.startsWith("x")) { + type3 = "double_" + type3; + line2 = line2.slice(1); + } + break; + case ">": + type3 = "arrow_point"; + if (str2.startsWith("<")) { + type3 = "double_" + type3; + line2 = line2.slice(1); + } + break; + case "o": + type3 = "arrow_circle"; + if (str2.startsWith("o")) { + type3 = "double_" + type3; + line2 = line2.slice(1); + } + break; + } + let stroke = "normal"; + let length2 = line2.length - 1; + if (line2.startsWith("=")) { + stroke = "thick"; + } + if (line2.startsWith("~")) { + stroke = "invisible"; + } + const dots = this.countChar(".", line2); + if (dots) { + stroke = "dotted"; + length2 = dots; + } + return { type: type3, stroke, length: length2 }; + } + destructLink(_str, _startStr) { + const info2 = this.destructEndLink(_str); + let startInfo; + if (_startStr) { + startInfo = this.destructStartLink(_startStr); + if (startInfo.stroke !== info2.stroke) { + return { type: "INVALID", stroke: "INVALID" }; + } + if (startInfo.type === "arrow_open") { + startInfo.type = info2.type; + } else { + if (startInfo.type !== info2.type) { + return { type: "INVALID", stroke: "INVALID" }; + } + startInfo.type = "double_" + startInfo.type; + } + if (startInfo.type === "double_arrow") { + startInfo.type = "double_arrow_point"; + } + startInfo.length = info2.length; + return startInfo; + } + return info2; + } + // Todo optimizer this by caching existing nodes + exists(allSgs, _id) { + for (const sg of allSgs) { + if (sg.nodes.includes(_id)) { + return true; + } + } + return false; + } + /** + * Deletes an id from all subgraphs + * + */ + makeUniq(sg, allSubgraphs) { + const res = []; + sg.nodes.forEach((_id, pos) => { + if (!this.exists(allSubgraphs, _id)) { + res.push(sg.nodes[pos]); + } + }); + return { nodes: res }; + } + getTypeFromVertex(vertex) { + if (vertex.img) { + return "imageSquare"; + } + if (vertex.icon) { + if (vertex.form === "circle") { + return "iconCircle"; + } + if (vertex.form === "square") { + return "iconSquare"; + } + if (vertex.form === "rounded") { + return "iconRounded"; + } + return "icon"; + } + switch (vertex.type) { + case "square": + case void 0: + return "squareRect"; + case "round": + return "roundedRect"; + case "ellipse": + return "ellipse"; + default: + return vertex.type; + } + } + findNode(nodes5, id35) { + return nodes5.find((node2) => node2.id === id35); + } + destructEdgeType(type3) { + let arrowTypeStart = "none"; + let arrowTypeEnd = "arrow_point"; + switch (type3) { + case "arrow_point": + case "arrow_circle": + case "arrow_cross": + arrowTypeEnd = type3; + break; + case "double_arrow_point": + case "double_arrow_circle": + case "double_arrow_cross": + arrowTypeStart = type3.replace("double_", ""); + arrowTypeEnd = arrowTypeStart; + break; + } + return { arrowTypeStart, arrowTypeEnd }; + } + addNodeFromVertex(vertex, nodes5, parentDB, subGraphDB, config5, look) { + const parentId = parentDB.get(vertex.id); + const isGroup2 = subGraphDB.get(vertex.id) ?? false; + const node2 = this.findNode(nodes5, vertex.id); + if (node2) { + node2.cssStyles = vertex.styles; + node2.cssCompiledStyles = this.getCompiledStyles(vertex.classes); + node2.cssClasses = vertex.classes.join(" "); + } else { + const baseNode = { + id: vertex.id, + label: vertex.text, + labelType: vertex.labelType, + labelStyle: "", + parentId, + padding: config5.flowchart?.padding || 8, + cssStyles: vertex.styles, + cssCompiledStyles: this.getCompiledStyles(["default", "node", ...vertex.classes]), + cssClasses: "default " + vertex.classes.join(" "), + dir: vertex.dir, + domId: vertex.domId, + look, + link: vertex.link, + linkTarget: vertex.linkTarget, + tooltip: this.getTooltip(vertex.id), + icon: vertex.icon, + pos: vertex.pos, + img: vertex.img, + assetWidth: vertex.assetWidth, + assetHeight: vertex.assetHeight, + constraint: vertex.constraint + }; + if (isGroup2) { + nodes5.push({ + ...baseNode, + isGroup: true, + shape: "rect" + }); + } else { + nodes5.push({ + ...baseNode, + isGroup: false, + shape: this.getTypeFromVertex(vertex) + }); + } + } + } + getCompiledStyles(classDefs) { + let compiledStyles = []; + for (const customClass of classDefs) { + const cssClass = this.classes.get(customClass); + if (cssClass?.styles) { + compiledStyles = [...compiledStyles, ...cssClass.styles ?? []].map((s2) => s2.trim()); + } + if (cssClass?.textStyles) { + compiledStyles = [...compiledStyles, ...cssClass.textStyles ?? []].map((s2) => s2.trim()); + } + } + return compiledStyles; + } + getData() { + const config5 = getConfig2(); + const nodes5 = []; + const edges3 = []; + const subGraphs = this.getSubGraphs(); + const parentDB = /* @__PURE__ */ new Map(); + const subGraphDB = /* @__PURE__ */ new Map(); + for (let i2 = subGraphs.length - 1; i2 >= 0; i2--) { + const subGraph = subGraphs[i2]; + if (subGraph.nodes.length > 0) { + subGraphDB.set(subGraph.id, true); + } + for (const id35 of subGraph.nodes) { + parentDB.set(id35, subGraph.id); + } + } + for (let i2 = subGraphs.length - 1; i2 >= 0; i2--) { + const subGraph = subGraphs[i2]; + nodes5.push({ + id: subGraph.id, + label: subGraph.title, + labelStyle: "", + labelType: subGraph.labelType, + parentId: parentDB.get(subGraph.id), + padding: 8, + cssCompiledStyles: this.getCompiledStyles(subGraph.classes), + cssClasses: subGraph.classes.join(" "), + shape: "rect", + dir: subGraph.dir, + isGroup: true, + look: config5.look + }); + } + const n2 = this.getVertices(); + n2.forEach((vertex) => { + this.addNodeFromVertex(vertex, nodes5, parentDB, subGraphDB, config5, config5.look || "classic"); + }); + const e3 = this.getEdges(); + e3.forEach((rawEdge, index) => { + const { arrowTypeStart, arrowTypeEnd } = this.destructEdgeType(rawEdge.type); + const styles6 = [...e3.defaultStyle ?? []]; + if (rawEdge.style) { + styles6.push(...rawEdge.style); + } + const edge = { + id: getEdgeId(rawEdge.start, rawEdge.end, { counter: index, prefix: "L" }, rawEdge.id), + isUserDefinedId: rawEdge.isUserDefinedId, + start: rawEdge.start, + end: rawEdge.end, + type: rawEdge.type ?? "normal", + label: rawEdge.text, + labelType: rawEdge.labelType, + labelpos: "c", + thickness: rawEdge.stroke, + minlen: rawEdge.length, + classes: rawEdge?.stroke === "invisible" ? "" : "edge-thickness-normal edge-pattern-solid flowchart-link", + arrowTypeStart: rawEdge?.stroke === "invisible" || rawEdge?.type === "arrow_open" ? "none" : arrowTypeStart, + arrowTypeEnd: rawEdge?.stroke === "invisible" || rawEdge?.type === "arrow_open" ? "none" : arrowTypeEnd, + arrowheadStyle: "fill: #333", + cssCompiledStyles: this.getCompiledStyles(rawEdge.classes), + labelStyle: styles6, + style: styles6, + pattern: rawEdge.stroke, + look: config5.look, + animate: rawEdge.animate, + animation: rawEdge.animation, + curve: rawEdge.interpolate || this.edges.defaultInterpolate || config5.flowchart?.curve + }; + edges3.push(edge); + }); + return { nodes: nodes5, edges: edges3, other: {}, config: config5 }; + } + defaultConfig() { + return defaultConfig2.flowchart; + } + }; + } + }); + + // src/rendering-util/insertElementsForSize.js + var getDiagramElement; + var init_insertElementsForSize = __esm({ + "src/rendering-util/insertElementsForSize.js"() { + "use strict"; + init_src32(); + getDiagramElement = /* @__PURE__ */ __name((id35, securityLevel) => { + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + const svg2 = root4.select(`[id="${id35}"]`); + return svg2; + }, "getDiagramElement"); + } + }); + + // src/utils/subGraphTitleMargins.ts + var getSubGraphTitleMargins; + var init_subGraphTitleMargins = __esm({ + "src/utils/subGraphTitleMargins.ts"() { + "use strict"; + getSubGraphTitleMargins = /* @__PURE__ */ __name(({ + flowchart + }) => { + const subGraphTitleTopMargin = flowchart?.subGraphTitleMargin?.top ?? 0; + const subGraphTitleBottomMargin = flowchart?.subGraphTitleMargin?.bottom ?? 0; + const subGraphTitleTotalMargin = subGraphTitleTopMargin + subGraphTitleBottomMargin; + return { + subGraphTitleTopMargin, + subGraphTitleBottomMargin, + subGraphTitleTotalMargin + }; + }, "getSubGraphTitleMargins"); + } + }); + + // src/rendering-util/rendering-elements/clusters.js + var rect, noteGroup, roundedWithTitle, kanbanSection, divider, squareRect2, shapes2, clusterElems, insertCluster, clear3; + var init_clusters = __esm({ + "src/rendering-util/rendering-elements/clusters.js"() { + "use strict"; + init_diagramAPI(); + init_config(); + init_logger(); + init_subGraphTitleMargins(); + init_src32(); + init_rough_esm(); + init_createText(); + init_intersect_rect(); + init_createLabel(); + init_roundedRectPath(); + init_handDrawnShapeStyles(); + rect = /* @__PURE__ */ __name(async (parent4, node2) => { + log.info("Creating subgraph rect for ", node2.id, node2); + const siteConfig2 = getConfig2(); + const { themeVariables, handDrawnSeed } = siteConfig2; + const { clusterBkg, clusterBorder } = themeVariables; + const { labelStyles, nodeStyles, borderStyles, backgroundStyles } = styles2String(node2); + const shapeSvg = parent4.insert("g").attr("class", "cluster " + node2.cssClasses).attr("id", node2.domId).attr("data-look", node2.look); + const useHtmlLabels = getEffectiveHtmlLabels(siteConfig2); + const labelEl = shapeSvg.insert("g").attr("class", "cluster-label "); + let text4; + if (node2.labelType === "markdown") { + text4 = await createText(labelEl, node2.label, { + style: node2.labelStyle, + useHtmlLabels, + isNode: true, + width: node2.width + }); + } else { + text4 = await createLabel_default(labelEl, node2.label, node2.labelStyle || "", false, true); + } + let bbox = text4.getBBox(); + if (getEffectiveHtmlLabels(siteConfig2)) { + const div = text4.children[0]; + const dv = select_default2(text4); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + const width3 = node2.width <= bbox.width + node2.padding ? bbox.width + node2.padding : node2.width; + if (node2.width <= bbox.width + node2.padding) { + node2.diff = (width3 - node2.width) / 2 - node2.padding; + } else { + node2.diff = -node2.padding; + } + const height2 = node2.height; + const x5 = node2.x - width3 / 2; + const y6 = node2.y - height2 / 2; + log.trace("Data ", node2, JSON.stringify(node2)); + let rect3; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, { + roughness: 0.7, + fill: clusterBkg, + // fill: 'red', + stroke: clusterBorder, + fillWeight: 3, + seed: handDrawnSeed + }); + const roughNode = rc.path(createRoundedRectPathD(x5, y6, width3, height2, 0), options2); + rect3 = shapeSvg.insert(() => { + log.debug("Rough node insert CXC", roughNode); + return roughNode; + }, ":first-child"); + rect3.select("path:nth-child(2)").attr("style", borderStyles.join(";")); + rect3.select("path").attr("style", backgroundStyles.join(";").replace("fill", "stroke")); + } else { + rect3 = shapeSvg.insert("rect", ":first-child"); + rect3.attr("style", nodeStyles).attr("rx", node2.rx).attr("ry", node2.ry).attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2); + } + const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig2); + labelEl.attr( + "transform", + // This puts the label on top of the box instead of inside it + `translate(${node2.x - bbox.width / 2}, ${node2.y - node2.height / 2 + subGraphTitleTopMargin})` + ); + if (labelStyles) { + const span = labelEl.select("span"); + if (span) { + span.attr("style", labelStyles); + } + } + const rectBox = rect3.node().getBBox(); + node2.offsetX = 0; + node2.width = rectBox.width; + node2.height = rectBox.height; + node2.offsetY = bbox.height - node2.padding / 2; + node2.intersect = function(point8) { + return intersect_rect_default(node2, point8); + }; + return { cluster: shapeSvg, labelBBox: bbox }; + }, "rect"); + noteGroup = /* @__PURE__ */ __name((parent4, node2) => { + const shapeSvg = parent4.insert("g").attr("class", "note-cluster").attr("id", node2.domId); + const rect3 = shapeSvg.insert("rect", ":first-child"); + const padding2 = 0 * node2.padding; + const halfPadding = padding2 / 2; + rect3.attr("rx", node2.rx).attr("ry", node2.ry).attr("x", node2.x - node2.width / 2 - halfPadding).attr("y", node2.y - node2.height / 2 - halfPadding).attr("width", node2.width + padding2).attr("height", node2.height + padding2).attr("fill", "none"); + const rectBox = rect3.node().getBBox(); + node2.width = rectBox.width; + node2.height = rectBox.height; + node2.intersect = function(point8) { + return intersect_rect_default(node2, point8); + }; + return { cluster: shapeSvg, labelBBox: { width: 0, height: 0 } }; + }, "noteGroup"); + roundedWithTitle = /* @__PURE__ */ __name(async (parent4, node2) => { + const siteConfig2 = getConfig2(); + const { themeVariables, handDrawnSeed } = siteConfig2; + const { altBackground, compositeBackground, compositeTitleBackground, nodeBorder } = themeVariables; + const shapeSvg = parent4.insert("g").attr("class", node2.cssClasses).attr("id", node2.domId).attr("data-id", node2.id).attr("data-look", node2.look); + const outerRectG = shapeSvg.insert("g", ":first-child"); + const label = shapeSvg.insert("g").attr("class", "cluster-label"); + let innerRect = shapeSvg.append("rect"); + const text4 = await createLabel_default(label, node2.label, node2.labelStyle, void 0, true); + let bbox = text4.getBBox(); + if (getEffectiveHtmlLabels(siteConfig2)) { + const div = text4.children[0]; + const dv = select_default2(text4); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + const padding2 = 0 * node2.padding; + const halfPadding = padding2 / 2; + const width3 = (node2.width <= bbox.width + node2.padding ? bbox.width + node2.padding : node2.width) + padding2; + if (node2.width <= bbox.width + node2.padding) { + node2.diff = (width3 - node2.width) / 2 - node2.padding; + } else { + node2.diff = -node2.padding; + } + const height2 = node2.height + padding2; + const innerHeight = node2.height + padding2 - bbox.height - 6; + const x5 = node2.x - width3 / 2; + const y6 = node2.y - height2 / 2; + node2.width = width3; + const innerY = node2.y - node2.height / 2 - halfPadding + bbox.height + 2; + let rect3; + if (node2.look === "handDrawn") { + const isAlt = node2.cssClasses.includes("statediagram-cluster-alt"); + const rc = at.svg(shapeSvg); + const roughOuterNode = node2.rx || node2.ry ? rc.path(createRoundedRectPathD(x5, y6, width3, height2, 10), { + roughness: 0.7, + fill: compositeTitleBackground, + fillStyle: "solid", + stroke: nodeBorder, + seed: handDrawnSeed + }) : rc.rectangle(x5, y6, width3, height2, { seed: handDrawnSeed }); + rect3 = shapeSvg.insert(() => roughOuterNode, ":first-child"); + const roughInnerNode = rc.rectangle(x5, innerY, width3, innerHeight, { + fill: isAlt ? altBackground : compositeBackground, + fillStyle: isAlt ? "hachure" : "solid", + stroke: nodeBorder, + seed: handDrawnSeed + }); + rect3 = shapeSvg.insert(() => roughOuterNode, ":first-child"); + innerRect = shapeSvg.insert(() => roughInnerNode); + } else { + rect3 = outerRectG.insert("rect", ":first-child"); + const outerRectClass = "outer"; + rect3.attr("class", outerRectClass).attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2).attr("data-look", node2.look); + innerRect.attr("class", "inner").attr("x", x5).attr("y", innerY).attr("width", width3).attr("height", innerHeight); + } + label.attr( + "transform", + `translate(${node2.x - bbox.width / 2}, ${y6 + 1 - (getEffectiveHtmlLabels(siteConfig2) ? 0 : 3)})` + ); + const rectBox = rect3.node().getBBox(); + node2.height = rectBox.height; + node2.offsetX = 0; + node2.offsetY = bbox.height - node2.padding / 2; + node2.labelBBox = bbox; + node2.intersect = function(point8) { + return intersect_rect_default(node2, point8); + }; + return { cluster: shapeSvg, labelBBox: bbox }; + }, "roundedWithTitle"); + kanbanSection = /* @__PURE__ */ __name(async (parent4, node2) => { + log.info("Creating subgraph rect for ", node2.id, node2); + const siteConfig2 = getConfig2(); + const { themeVariables, handDrawnSeed } = siteConfig2; + const { clusterBkg, clusterBorder } = themeVariables; + const { labelStyles, nodeStyles, borderStyles, backgroundStyles } = styles2String(node2); + const shapeSvg = parent4.insert("g").attr("class", "cluster " + node2.cssClasses).attr("id", node2.domId).attr("data-look", node2.look); + const useHtmlLabels = getEffectiveHtmlLabels(siteConfig2); + const labelEl = shapeSvg.insert("g").attr("class", "cluster-label "); + const text4 = await createText(labelEl, node2.label, { + style: node2.labelStyle, + useHtmlLabels, + isNode: true, + width: node2.width + }); + let bbox = text4.getBBox(); + if (getEffectiveHtmlLabels(siteConfig2)) { + const div = text4.children[0]; + const dv = select_default2(text4); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + const width3 = node2.width <= bbox.width + node2.padding ? bbox.width + node2.padding : node2.width; + if (node2.width <= bbox.width + node2.padding) { + node2.diff = (width3 - node2.width) / 2 - node2.padding; + } else { + node2.diff = -node2.padding; + } + const height2 = node2.height; + const x5 = node2.x - width3 / 2; + const y6 = node2.y - height2 / 2; + log.trace("Data ", node2, JSON.stringify(node2)); + let rect3; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const options2 = userNodeOverrides(node2, { + roughness: 0.7, + fill: clusterBkg, + // fill: 'red', + stroke: clusterBorder, + fillWeight: 4, + seed: handDrawnSeed + }); + const roughNode = rc.path(createRoundedRectPathD(x5, y6, width3, height2, node2.rx), options2); + rect3 = shapeSvg.insert(() => { + log.debug("Rough node insert CXC", roughNode); + return roughNode; + }, ":first-child"); + rect3.select("path:nth-child(2)").attr("style", borderStyles.join(";")); + rect3.select("path").attr("style", backgroundStyles.join(";").replace("fill", "stroke")); + } else { + rect3 = shapeSvg.insert("rect", ":first-child"); + rect3.attr("style", nodeStyles).attr("rx", node2.rx).attr("ry", node2.ry).attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2); + } + const { subGraphTitleTopMargin } = getSubGraphTitleMargins(siteConfig2); + labelEl.attr( + "transform", + // This puts the label on top of the box instead of inside it + `translate(${node2.x - bbox.width / 2}, ${node2.y - node2.height / 2 + subGraphTitleTopMargin})` + ); + if (labelStyles) { + const span = labelEl.select("span"); + if (span) { + span.attr("style", labelStyles); + } + } + const rectBox = rect3.node().getBBox(); + node2.offsetX = 0; + node2.width = rectBox.width; + node2.height = rectBox.height; + node2.offsetY = bbox.height - node2.padding / 2; + node2.intersect = function(point8) { + return intersect_rect_default(node2, point8); + }; + return { cluster: shapeSvg, labelBBox: bbox }; + }, "kanbanSection"); + divider = /* @__PURE__ */ __name((parent4, node2) => { + const siteConfig2 = getConfig2(); + const { themeVariables, handDrawnSeed } = siteConfig2; + const { nodeBorder } = themeVariables; + const shapeSvg = parent4.insert("g").attr("class", node2.cssClasses).attr("id", node2.domId).attr("data-look", node2.look); + const outerRectG = shapeSvg.insert("g", ":first-child"); + const padding2 = 0 * node2.padding; + const width3 = node2.width + padding2; + node2.diff = -node2.padding; + const height2 = node2.height + padding2; + const x5 = node2.x - width3 / 2; + const y6 = node2.y - height2 / 2; + node2.width = width3; + let rect3; + if (node2.look === "handDrawn") { + const rc = at.svg(shapeSvg); + const roughOuterNode = rc.rectangle(x5, y6, width3, height2, { + fill: "lightgrey", + roughness: 0.5, + strokeLineDash: [5], + stroke: nodeBorder, + seed: handDrawnSeed + }); + rect3 = shapeSvg.insert(() => roughOuterNode, ":first-child"); + } else { + rect3 = outerRectG.insert("rect", ":first-child"); + let outerRectClass = "outer"; + if (node2.look === "neo") { + outerRectClass = "divider"; + } else { + outerRectClass = "divider"; + } + rect3.attr("class", outerRectClass).attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2).attr("data-look", node2.look); + } + const rectBox = rect3.node().getBBox(); + node2.height = rectBox.height; + node2.offsetX = 0; + node2.offsetY = 0; + node2.intersect = function(point8) { + return intersect_rect_default(node2, point8); + }; + return { cluster: shapeSvg, labelBBox: {} }; + }, "divider"); + squareRect2 = rect; + shapes2 = { + rect, + squareRect: squareRect2, + roundedWithTitle, + noteGroup, + divider, + kanbanSection + }; + clusterElems = /* @__PURE__ */ new Map(); + insertCluster = /* @__PURE__ */ __name(async (elem, node2) => { + const shape = node2.shape || "rect"; + const cluster = await shapes2[shape](elem, node2); + clusterElems.set(node2.id, cluster); + return cluster; + }, "insertCluster"); + clear3 = /* @__PURE__ */ __name(() => { + clusterElems = /* @__PURE__ */ new Map(); + }, "clear"); + } + }); + + // src/rendering-util/labelTransform.ts + var computeLabelTransform; + var init_labelTransform = __esm({ + "src/rendering-util/labelTransform.ts"() { + "use strict"; + computeLabelTransform = /* @__PURE__ */ __name((bbox, useHtmlLabels) => { + if (useHtmlLabels) { + return "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")"; + } + const x5 = bbox.x ?? 0; + const y6 = bbox.y ?? 0; + return "translate(" + -(x5 + bbox.width / 2) + ", " + -(y6 + bbox.height / 2) + ")"; + }, "computeLabelTransform"); + } + }); + + // src/utils/lineWithOffset.ts + function calculateDeltaAndAngle(point1, point22) { + if (point1 === void 0 || point22 === void 0) { + return { angle: 0, deltaX: 0, deltaY: 0 }; + } + point1 = pointTransformer(point1); + point22 = pointTransformer(point22); + const [x1, y1] = [point1.x, point1.y]; + const [x22, y22] = [point22.x, point22.y]; + const deltaX = x22 - x1; + const deltaY = y22 - y1; + return { angle: Math.atan(deltaY / deltaX), deltaX, deltaY }; + } + var markerOffsets, markerOffsets2, pointTransformer, getLineFunctionsWithOffset; + var init_lineWithOffset = __esm({ + "src/utils/lineWithOffset.ts"() { + "use strict"; + markerOffsets = { + aggregation: 17.25, + extension: 17.25, + composition: 17.25, + dependency: 6, + lollipop: 13.5, + arrow_point: 4, + arrow_barb: 0, + arrow_barb_neo: 5.5 + //arrow_cross: 24, + }; + markerOffsets2 = { + arrow_point: 4, + arrow_cross: 12.5, + arrow_circle: 12.5 + }; + __name(calculateDeltaAndAngle, "calculateDeltaAndAngle"); + pointTransformer = /* @__PURE__ */ __name((data5) => { + if (Array.isArray(data5)) { + return { x: data5[0], y: data5[1] }; + } + return data5; + }, "pointTransformer"); + getLineFunctionsWithOffset = /* @__PURE__ */ __name((edge) => { + return { + x: /* @__PURE__ */ __name(function(d3, i2, data5) { + let offset = 0; + const DIRECTION = pointTransformer(data5[0]).x < pointTransformer(data5[data5.length - 1]).x ? "left" : "right"; + if (i2 === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) { + const { angle: angle2, deltaX } = calculateDeltaAndAngle(data5[0], data5[1]); + offset = markerOffsets[edge.arrowTypeStart] * Math.cos(angle2) * (deltaX >= 0 ? 1 : -1); + } else if (i2 === data5.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) { + const { angle: angle2, deltaX } = calculateDeltaAndAngle( + data5[data5.length - 1], + data5[data5.length - 2] + ); + offset = markerOffsets[edge.arrowTypeEnd] * Math.cos(angle2) * (deltaX >= 0 ? 1 : -1); + } + const differenceToEnd = Math.abs( + pointTransformer(d3).x - pointTransformer(data5[data5.length - 1]).x + ); + const differenceInYEnd = Math.abs( + pointTransformer(d3).y - pointTransformer(data5[data5.length - 1]).y + ); + const differenceToStart = Math.abs(pointTransformer(d3).x - pointTransformer(data5[0]).x); + const differenceInYStart = Math.abs(pointTransformer(d3).y - pointTransformer(data5[0]).y); + const startMarkerHeight = markerOffsets[edge.arrowTypeStart]; + const endMarkerHeight = markerOffsets[edge.arrowTypeEnd]; + const extraRoom = 1; + if (differenceToEnd < endMarkerHeight && differenceToEnd > 0 && differenceInYEnd < endMarkerHeight) { + let adjustment = endMarkerHeight + extraRoom - differenceToEnd; + adjustment *= DIRECTION === "right" ? -1 : 1; + offset -= adjustment; + } + if (differenceToStart < startMarkerHeight && differenceToStart > 0 && differenceInYStart < startMarkerHeight) { + let adjustment = startMarkerHeight + extraRoom - differenceToStart; + adjustment *= DIRECTION === "right" ? -1 : 1; + offset += adjustment; + } + return pointTransformer(d3).x + offset; + }, "x"), + y: /* @__PURE__ */ __name(function(d3, i2, data5) { + let offset = 0; + const DIRECTION = pointTransformer(data5[0]).y < pointTransformer(data5[data5.length - 1]).y ? "down" : "up"; + if (i2 === 0 && Object.hasOwn(markerOffsets, edge.arrowTypeStart)) { + const { angle: angle2, deltaY } = calculateDeltaAndAngle(data5[0], data5[1]); + offset = markerOffsets[edge.arrowTypeStart] * Math.abs(Math.sin(angle2)) * (deltaY >= 0 ? 1 : -1); + } else if (i2 === data5.length - 1 && Object.hasOwn(markerOffsets, edge.arrowTypeEnd)) { + const { angle: angle2, deltaY } = calculateDeltaAndAngle( + data5[data5.length - 1], + data5[data5.length - 2] + ); + offset = markerOffsets[edge.arrowTypeEnd] * Math.abs(Math.sin(angle2)) * (deltaY >= 0 ? 1 : -1); + } + const differenceToEnd = Math.abs( + pointTransformer(d3).y - pointTransformer(data5[data5.length - 1]).y + ); + const differenceInXEnd = Math.abs( + pointTransformer(d3).x - pointTransformer(data5[data5.length - 1]).x + ); + const differenceToStart = Math.abs(pointTransformer(d3).y - pointTransformer(data5[0]).y); + const differenceInXStart = Math.abs(pointTransformer(d3).x - pointTransformer(data5[0]).x); + const startMarkerHeight = markerOffsets[edge.arrowTypeStart]; + const endMarkerHeight = markerOffsets[edge.arrowTypeEnd]; + const extraRoom = 1; + if (differenceToEnd < endMarkerHeight && differenceToEnd > 0 && differenceInXEnd < endMarkerHeight) { + let adjustment = endMarkerHeight + extraRoom - differenceToEnd; + adjustment *= DIRECTION === "up" ? -1 : 1; + offset -= adjustment; + } + if (differenceToStart < startMarkerHeight && differenceToStart > 0 && differenceInXStart < startMarkerHeight) { + let adjustment = startMarkerHeight + extraRoom - differenceToStart; + adjustment *= DIRECTION === "up" ? -1 : 1; + offset += adjustment; + } + return pointTransformer(d3).y + offset; + }, "y") + }; + }, "getLineFunctionsWithOffset"); + if (void 0) { + const { it, expect, describe } = void 0; + describe("calculateDeltaAndAngle", () => { + it("should calculate the angle and deltas between two points", () => { + expect(calculateDeltaAndAngle([0, 0], [0, 1])).toStrictEqual({ + angle: 1.5707963267948966, + deltaX: 0, + deltaY: 1 + }); + expect(calculateDeltaAndAngle([1, 0], [0, -1])).toStrictEqual({ + angle: 0.7853981633974483, + deltaX: -1, + deltaY: -1 + }); + expect(calculateDeltaAndAngle({ x: 1, y: 0 }, [0, -1])).toStrictEqual({ + angle: 0.7853981633974483, + deltaX: -1, + deltaY: -1 + }); + expect(calculateDeltaAndAngle({ x: 1, y: 0 }, { x: 1, y: 0 })).toStrictEqual({ + angle: NaN, + deltaX: 0, + deltaY: 0 + }); + }); + it("should calculate the angle and deltas if one point in undefined", () => { + expect(calculateDeltaAndAngle(void 0, [0, 1])).toStrictEqual({ + angle: 0, + deltaX: 0, + deltaY: 0 + }); + expect(calculateDeltaAndAngle([0, 1], void 0)).toStrictEqual({ + angle: 0, + deltaX: 0, + deltaY: 0 + }); + }); + }); + } + } + }); + + // src/rendering-util/rendering-elements/edgeMarker.ts + var addEdgeMarkers, arrowTypesMap, arrowTypesWithMarginSupport, addEdgeMarker; + var init_edgeMarker = __esm({ + "src/rendering-util/rendering-elements/edgeMarker.ts"() { + "use strict"; + init_logger(); + addEdgeMarkers = /* @__PURE__ */ __name((svgPath, edge, url, id35, diagramType, useMargin = false, strokeColor) => { + if (edge.arrowTypeStart) { + addEdgeMarker( + svgPath, + "start", + edge.arrowTypeStart, + url, + id35, + diagramType, + useMargin, + strokeColor + ); + } + if (edge.arrowTypeEnd) { + addEdgeMarker(svgPath, "end", edge.arrowTypeEnd, url, id35, diagramType, useMargin, strokeColor); + } + }, "addEdgeMarkers"); + arrowTypesMap = { + arrow_cross: { type: "cross", fill: false }, + arrow_point: { type: "point", fill: true }, + arrow_barb: { type: "barb", fill: true }, + arrow_barb_neo: { type: "barb", fill: true }, + arrow_circle: { type: "circle", fill: false }, + aggregation: { type: "aggregation", fill: false }, + extension: { type: "extension", fill: false }, + composition: { type: "composition", fill: true }, + dependency: { type: "dependency", fill: true }, + lollipop: { type: "lollipop", fill: false }, + only_one: { type: "onlyOne", fill: false }, + zero_or_one: { type: "zeroOrOne", fill: false }, + one_or_more: { type: "oneOrMore", fill: false }, + zero_or_more: { type: "zeroOrMore", fill: false }, + requirement_arrow: { type: "requirement_arrow", fill: false }, + requirement_contains: { type: "requirement_contains", fill: false } + }; + arrowTypesWithMarginSupport = [ + "cross", + "point", + "circle", + "lollipop", + "aggregation", + "extension", + "composition", + "dependency", + "barb" + ]; + addEdgeMarker = /* @__PURE__ */ __name((svgPath, position5, arrowType, url, id35, diagramType, useMargin = false, strokeColor) => { + const arrowTypeInfo = arrowTypesMap[arrowType]; + const marginSupport = arrowTypeInfo && arrowTypesWithMarginSupport.includes(arrowTypeInfo.type); + if (!arrowTypeInfo) { + log.warn(`Unknown arrow type: ${arrowType}`); + return; + } + const endMarkerType = arrowTypeInfo.type; + const suffix = position5 === "start" ? "Start" : "End"; + const offset = useMargin && marginSupport ? "-margin" : ""; + const originalMarkerId = `${id35}_${diagramType}-${endMarkerType}${suffix}${offset}`; + if (strokeColor && strokeColor.trim() !== "") { + const colorId = strokeColor.replace(/[^\dA-Za-z]/g, "_"); + const coloredMarkerId = `${originalMarkerId}_${colorId}`; + if (!document.getElementById(coloredMarkerId)) { + const originalMarker = document.getElementById(originalMarkerId); + if (originalMarker) { + const coloredMarker = originalMarker.cloneNode(true); + coloredMarker.id = coloredMarkerId; + const paths = coloredMarker.querySelectorAll("path, circle, line"); + paths.forEach((path4) => { + path4.setAttribute("stroke", strokeColor); + if (arrowTypeInfo.fill) { + path4.setAttribute("fill", strokeColor); + } + }); + originalMarker.parentNode?.appendChild(coloredMarker); + } + } + svgPath.attr(`marker-${position5}`, `url(${url}#${coloredMarkerId})`); + } else { + svgPath.attr(`marker-${position5}`, `url(${url}#${originalMarkerId})`); + } + }, "addEdgeMarker"); + } + }); + + // src/rendering-util/rendering-elements/edges.js + function setTerminalWidth(fo, value2) { + if (getEffectiveHtmlLabels(getConfig2()) && fo) { + fo.style.width = value2.length * 9 + "px"; + fo.style.height = "12px"; + } + } + function extractCornerPoints(points) { + const cornerPoints = []; + const cornerPointPositions = []; + for (let i2 = 1; i2 < points.length - 1; i2++) { + const prev2 = points[i2 - 1]; + const curr = points[i2]; + const next3 = points[i2 + 1]; + if (prev2.x === curr.x && curr.y === next3.y && Math.abs(curr.x - next3.x) > 5 && Math.abs(curr.y - prev2.y) > 5) { + cornerPoints.push(curr); + cornerPointPositions.push(i2); + } else if (prev2.y === curr.y && curr.x === next3.x && Math.abs(curr.x - prev2.x) > 5 && Math.abs(curr.y - next3.y) > 5) { + cornerPoints.push(curr); + cornerPointPositions.push(i2); + } + } + return { cornerPoints, cornerPointPositions }; + } + function generateRoundedPath(points, radius2) { + if (points.length < 2) { + return ""; + } + let path4 = ""; + const size4 = points.length; + const epsilon6 = 1e-5; + for (let i2 = 0; i2 < size4; i2++) { + const currPoint = points[i2]; + const prevPoint = points[i2 - 1]; + const nextPoint = points[i2 + 1]; + if (i2 === 0) { + path4 += `M${currPoint.x},${currPoint.y}`; + } else if (i2 === size4 - 1) { + path4 += `L${currPoint.x},${currPoint.y}`; + } else { + const dx1 = currPoint.x - prevPoint.x; + const dy1 = currPoint.y - prevPoint.y; + const dx2 = nextPoint.x - currPoint.x; + const dy2 = nextPoint.y - currPoint.y; + const len1 = Math.hypot(dx1, dy1); + const len2 = Math.hypot(dx2, dy2); + if (len1 < epsilon6 || len2 < epsilon6) { + path4 += `L${currPoint.x},${currPoint.y}`; + continue; + } + const nx1 = dx1 / len1; + const ny1 = dy1 / len1; + const nx2 = dx2 / len2; + const ny2 = dy2 / len2; + const dot2 = nx1 * nx2 + ny1 * ny2; + const clampedDot = Math.max(-1, Math.min(1, dot2)); + const angle2 = Math.acos(clampedDot); + if (angle2 < epsilon6 || Math.abs(Math.PI - angle2) < epsilon6) { + path4 += `L${currPoint.x},${currPoint.y}`; + continue; + } + const cutLen = Math.min(radius2 / Math.sin(angle2 / 2), len1 / 2, len2 / 2); + const startX2 = currPoint.x - nx1 * cutLen; + const startY2 = currPoint.y - ny1 * cutLen; + const endX = currPoint.x + nx2 * cutLen; + const endY = currPoint.y + ny2 * cutLen; + path4 += `L${startX2},${startY2}`; + path4 += `Q${currPoint.x},${currPoint.y} ${endX},${endY}`; + } + } + return path4; + } + function calculateDeltaAndAngle2(point1, point22) { + if (!point1 || !point22) { + return { angle: 0, deltaX: 0, deltaY: 0 }; + } + const deltaX = point22.x - point1.x; + const deltaY = point22.y - point1.y; + const angle2 = Math.atan2(deltaY, deltaX); + return { angle: angle2, deltaX, deltaY }; + } + function applyMarkerOffsetsToPoints(points, edge) { + const newPoints = points.map((point8) => ({ ...point8 })); + if (points.length >= 2 && markerOffsets[edge.arrowTypeStart]) { + const offsetValue = markerOffsets[edge.arrowTypeStart]; + const point1 = points[0]; + const point22 = points[1]; + const { angle: angle2 } = calculateDeltaAndAngle2(point1, point22); + const offsetX = offsetValue * Math.cos(angle2); + const offsetY = offsetValue * Math.sin(angle2); + newPoints[0].x = point1.x + offsetX; + newPoints[0].y = point1.y + offsetY; + } + const n2 = points.length; + if (n2 >= 2 && markerOffsets[edge.arrowTypeEnd]) { + const offsetValue = markerOffsets[edge.arrowTypeEnd]; + const point1 = points[n2 - 1]; + const point22 = points[n2 - 2]; + const { angle: angle2 } = calculateDeltaAndAngle2(point22, point1); + const offsetX = offsetValue * Math.cos(angle2); + const offsetY = offsetValue * Math.sin(angle2); + newPoints[n2 - 1].x = point1.x - offsetX; + newPoints[n2 - 1].y = point1.y - offsetY; + } + return newPoints; + } + var resolveEdgeCurveType, edgeLabels, terminalLabels, clear4, getLabelStyles, insertEdgeLabel, positionEdgeLabel, outsideNode, intersection, cutPathAtIntersect, findAdjacentPoint, fixCorners, generateDashArray, insertEdge; + var init_edges = __esm({ + "src/rendering-util/rendering-elements/edges.js"() { + "use strict"; + init_diagramAPI(); + init_config(); + init_logger(); + init_createText(); + init_labelTransform(); + init_utils2(); + init_lineWithOffset(); + init_subGraphTitleMargins(); + init_src32(); + init_rough_esm(); + init_createLabel(); + init_edgeMarker(); + init_handDrawnShapeStyles(); + resolveEdgeCurveType = /* @__PURE__ */ __name((edgeCurve) => { + return typeof edgeCurve === "string" ? edgeCurve : getConfig2()?.flowchart?.curve; + }, "resolveEdgeCurveType"); + edgeLabels = /* @__PURE__ */ new Map(); + terminalLabels = /* @__PURE__ */ new Map(); + clear4 = /* @__PURE__ */ __name(() => { + edgeLabels.clear(); + terminalLabels.clear(); + }, "clear"); + getLabelStyles = /* @__PURE__ */ __name((styleArray) => { + if (!styleArray) { + return ""; + } + if (typeof styleArray === "string") { + return styleArray; + } + return styleArray.reduce((acc, style3) => acc + ";" + style3, ""); + }, "getLabelStyles"); + insertEdgeLabel = /* @__PURE__ */ __name(async (elem, edge) => { + const config5 = getConfig2(); + let useHtmlLabels = getEffectiveHtmlLabels(config5); + const { labelStyles } = styles2String(edge); + edge.labelStyle = labelStyles; + const edgeLabel = elem.insert("g").attr("class", "edgeLabel"); + const label = edgeLabel.insert("g").attr("class", "label").attr("data-id", edge.id); + const isMarkdown = edge.labelType === "markdown"; + const markdownWidth = void 0; + const labelElement = await createText( + elem, + edge.label, + { + style: getLabelStyles(edge.labelStyle), + useHtmlLabels, + addSvgBackground: true, + isNode: false, + markdown: isMarkdown, + // Plain text edge labels should auto-wrap, markdown edge labels respect markdownAutoWrap config + width: isMarkdown ? markdownWidth : void 0 + }, + config5 + ); + label.node().appendChild(labelElement); + log.info("abc82", edge, edge.labelType); + let bbox = labelElement.getBBox(); + let transformBbox = bbox; + if (useHtmlLabels) { + const div = labelElement.children[0]; + const dv = select_default2(labelElement); + bbox = div.getBoundingClientRect(); + transformBbox = bbox; + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } else { + const textEl = select_default2(labelElement).select("text").node(); + if (textEl && typeof textEl.getBBox === "function") { + transformBbox = textEl.getBBox(); + } + } + label.attr("transform", computeLabelTransform(transformBbox, useHtmlLabels)); + edgeLabels.set(edge.id, edgeLabel); + edge.width = bbox.width; + edge.height = bbox.height; + let fo; + if (edge.startLabelLeft) { + const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals"); + const inner2 = startEdgeLabelLeft.insert("g").attr("class", "inner"); + const startLabelElement = await createLabel_default( + inner2, + edge.startLabelLeft, + getLabelStyles(edge.labelStyle) || "", + false, + false + ); + fo = startLabelElement; + let slBox = startLabelElement.getBBox(); + if (useHtmlLabels) { + const div = startLabelElement.children[0]; + const dv = select_default2(startLabelElement); + slBox = div.getBoundingClientRect(); + dv.attr("width", slBox.width); + dv.attr("height", slBox.height); + } + inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels)); + if (!terminalLabels.get(edge.id)) { + terminalLabels.set(edge.id, {}); + } + terminalLabels.get(edge.id).startLeft = startEdgeLabelLeft; + setTerminalWidth(fo, edge.startLabelLeft); + } + if (edge.startLabelRight) { + const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals"); + const inner2 = startEdgeLabelRight.insert("g").attr("class", "inner"); + const startLabelElement = await createLabel_default( + inner2, + edge.startLabelRight, + getLabelStyles(edge.labelStyle) || "", + false, + false + ); + fo = startLabelElement; + let slBox = startLabelElement.getBBox(); + if (useHtmlLabels) { + const div = startLabelElement.children[0]; + const dv = select_default2(startLabelElement); + slBox = div.getBoundingClientRect(); + dv.attr("width", slBox.width); + dv.attr("height", slBox.height); + } + inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels)); + if (!terminalLabels.get(edge.id)) { + terminalLabels.set(edge.id, {}); + } + terminalLabels.get(edge.id).startRight = startEdgeLabelRight; + setTerminalWidth(fo, edge.startLabelRight); + } + if (edge.endLabelLeft) { + const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals"); + const inner2 = endEdgeLabelLeft.insert("g").attr("class", "inner"); + const endLabelElement = await createLabel_default( + endEdgeLabelLeft, + edge.endLabelLeft, + getLabelStyles(edge.labelStyle) || "", + false, + false + ); + fo = endLabelElement; + let slBox = endLabelElement.getBBox(); + if (useHtmlLabels) { + const div = endLabelElement.children[0]; + const dv = select_default2(endLabelElement); + slBox = div.getBoundingClientRect(); + dv.attr("width", slBox.width); + dv.attr("height", slBox.height); + } + inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels)); + if (!terminalLabels.get(edge.id)) { + terminalLabels.set(edge.id, {}); + } + terminalLabels.get(edge.id).endLeft = endEdgeLabelLeft; + setTerminalWidth(fo, edge.endLabelLeft); + } + if (edge.endLabelRight) { + const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals"); + const inner2 = endEdgeLabelRight.insert("g").attr("class", "inner"); + const endLabelElement = await createLabel_default( + endEdgeLabelRight, + edge.endLabelRight, + getLabelStyles(edge.labelStyle) || "", + false, + false + ); + fo = endLabelElement; + let slBox = endLabelElement.getBBox(); + if (useHtmlLabels) { + const div = endLabelElement.children[0]; + const dv = select_default2(endLabelElement); + slBox = div.getBoundingClientRect(); + dv.attr("width", slBox.width); + dv.attr("height", slBox.height); + } + inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels)); + if (!terminalLabels.get(edge.id)) { + terminalLabels.set(edge.id, {}); + } + terminalLabels.get(edge.id).endRight = endEdgeLabelRight; + setTerminalWidth(fo, edge.endLabelRight); + } + return labelElement; + }, "insertEdgeLabel"); + __name(setTerminalWidth, "setTerminalWidth"); + positionEdgeLabel = /* @__PURE__ */ __name((edge, paths) => { + log.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels.get(edge.id), paths); + let path4 = paths.updatedPath ? paths.updatedPath : paths.originalPath; + const siteConfig2 = getConfig2(); + const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig2); + if (edge.label) { + const el = edgeLabels.get(edge.id); + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcLabelPosition(path4); + log.debug( + "Moving label " + edge.label + " from (", + x5, + ",", + y6, + ") to (", + pos.x, + ",", + pos.y, + ") abc88" + ); + if (paths.updatedPath) { + x5 = pos.x; + y6 = pos.y; + } + } + el.attr("transform", `translate(${x5}, ${y6 + subGraphTitleTotalMargin / 2})`); + } + if (edge.startLabelLeft) { + const el = terminalLabels.get(edge.id).startLeft; + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path4); + x5 = pos.x; + y6 = pos.y; + } + el.attr("transform", `translate(${x5}, ${y6})`); + } + if (edge.startLabelRight) { + const el = terminalLabels.get(edge.id).startRight; + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcTerminalLabelPosition( + edge.arrowTypeStart ? 10 : 0, + "start_right", + path4 + ); + x5 = pos.x; + y6 = pos.y; + } + el.attr("transform", `translate(${x5}, ${y6})`); + } + if (edge.endLabelLeft) { + const el = terminalLabels.get(edge.id).endLeft; + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path4); + x5 = pos.x; + y6 = pos.y; + } + el.attr("transform", `translate(${x5}, ${y6})`); + } + if (edge.endLabelRight) { + const el = terminalLabels.get(edge.id).endRight; + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path4); + x5 = pos.x; + y6 = pos.y; + } + el.attr("transform", `translate(${x5}, ${y6})`); + } + }, "positionEdgeLabel"); + outsideNode = /* @__PURE__ */ __name((node2, point8) => { + const x5 = node2.x; + const y6 = node2.y; + const dx = Math.abs(point8.x - x5); + const dy = Math.abs(point8.y - y6); + const w4 = node2.width / 2; + const h3 = node2.height / 2; + return dx >= w4 || dy >= h3; + }, "outsideNode"); + intersection = /* @__PURE__ */ __name((node2, outsidePoint, insidePoint) => { + log.debug(`intersection calc abc89: + outsidePoint: ${JSON.stringify(outsidePoint)} + insidePoint : ${JSON.stringify(insidePoint)} + node : x:${node2.x} y:${node2.y} w:${node2.width} h:${node2.height}`); + const x5 = node2.x; + const y6 = node2.y; + const dx = Math.abs(x5 - insidePoint.x); + const w4 = node2.width / 2; + let r2 = insidePoint.x < outsidePoint.x ? w4 - dx : w4 + dx; + const h3 = node2.height / 2; + const Q3 = Math.abs(outsidePoint.y - insidePoint.y); + const R3 = Math.abs(outsidePoint.x - insidePoint.x); + if (Math.abs(y6 - outsidePoint.y) * w4 > Math.abs(x5 - outsidePoint.x) * h3) { + let q3 = insidePoint.y < outsidePoint.y ? outsidePoint.y - h3 - y6 : y6 - h3 - outsidePoint.y; + r2 = R3 * q3 / Q3; + const res = { + x: insidePoint.x < outsidePoint.x ? insidePoint.x + r2 : insidePoint.x - R3 + r2, + y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q3 - q3 : insidePoint.y - Q3 + q3 + }; + if (r2 === 0) { + res.x = outsidePoint.x; + res.y = outsidePoint.y; + } + if (R3 === 0) { + res.x = outsidePoint.x; + } + if (Q3 === 0) { + res.y = outsidePoint.y; + } + log.debug(`abc89 top/bottom calc, Q ${Q3}, q ${q3}, R ${R3}, r ${r2}`, res); + return res; + } else { + if (insidePoint.x < outsidePoint.x) { + r2 = outsidePoint.x - w4 - x5; + } else { + r2 = x5 - w4 - outsidePoint.x; + } + let q3 = Q3 * r2 / R3; + let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R3 - r2 : insidePoint.x - R3 + r2; + let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q3 : insidePoint.y - q3; + log.debug(`sides calc abc89, Q ${Q3}, q ${q3}, R ${R3}, r ${r2}`, { _x, _y }); + if (r2 === 0) { + _x = outsidePoint.x; + _y = outsidePoint.y; + } + if (R3 === 0) { + _x = outsidePoint.x; + } + if (Q3 === 0) { + _y = outsidePoint.y; + } + return { x: _x, y: _y }; + } + }, "intersection"); + cutPathAtIntersect = /* @__PURE__ */ __name((_points, boundaryNode) => { + log.warn("abc88 cutPathAtIntersect", _points, boundaryNode); + let points = []; + let lastPointOutside = _points[0]; + let isInside = false; + _points.forEach((point8) => { + log.info("abc88 checking point", point8, boundaryNode); + if (!outsideNode(boundaryNode, point8) && !isInside) { + const inter = intersection(boundaryNode, lastPointOutside, point8); + log.debug("abc88 inside", point8, lastPointOutside, inter); + log.debug("abc88 intersection", inter, boundaryNode); + let pointPresent = false; + points.forEach((p3) => { + pointPresent = pointPresent || p3.x === inter.x && p3.y === inter.y; + }); + if (!points.some((e3) => e3.x === inter.x && e3.y === inter.y)) { + points.push(inter); + } else { + log.warn("abc88 no intersect", inter, points); + } + isInside = true; + } else { + log.warn("abc88 outside", point8, lastPointOutside); + lastPointOutside = point8; + if (!isInside) { + points.push(point8); + } + } + }); + log.debug("returning points", points); + return points; + }, "cutPathAtIntersect"); + __name(extractCornerPoints, "extractCornerPoints"); + findAdjacentPoint = /* @__PURE__ */ __name(function(pointA, pointB, distance3) { + const xDiff = pointB.x - pointA.x; + const yDiff = pointB.y - pointA.y; + const length2 = Math.sqrt(xDiff * xDiff + yDiff * yDiff); + const ratio = distance3 / length2; + return { x: pointB.x - ratio * xDiff, y: pointB.y - ratio * yDiff }; + }, "findAdjacentPoint"); + fixCorners = /* @__PURE__ */ __name(function(lineData) { + const { cornerPointPositions } = extractCornerPoints(lineData); + const newLineData = []; + for (let i2 = 0; i2 < lineData.length; i2++) { + if (cornerPointPositions.includes(i2)) { + const prevPoint = lineData[i2 - 1]; + const nextPoint = lineData[i2 + 1]; + const cornerPoint = lineData[i2]; + const newPrevPoint = findAdjacentPoint(prevPoint, cornerPoint, 5); + const newNextPoint = findAdjacentPoint(nextPoint, cornerPoint, 5); + const xDiff = newNextPoint.x - newPrevPoint.x; + const yDiff = newNextPoint.y - newPrevPoint.y; + newLineData.push(newPrevPoint); + const a2 = Math.sqrt(2) * 2; + let newCornerPoint = { x: cornerPoint.x, y: cornerPoint.y }; + if (Math.abs(nextPoint.x - prevPoint.x) > 10 && Math.abs(nextPoint.y - prevPoint.y) >= 10) { + log.debug( + "Corner point fixing", + Math.abs(nextPoint.x - prevPoint.x), + Math.abs(nextPoint.y - prevPoint.y) + ); + const r2 = 5; + if (cornerPoint.x === newPrevPoint.x) { + newCornerPoint = { + x: xDiff < 0 ? newPrevPoint.x - r2 + a2 : newPrevPoint.x + r2 - a2, + y: yDiff < 0 ? newPrevPoint.y - a2 : newPrevPoint.y + a2 + }; + } else { + newCornerPoint = { + x: xDiff < 0 ? newPrevPoint.x - a2 : newPrevPoint.x + a2, + y: yDiff < 0 ? newPrevPoint.y - r2 + a2 : newPrevPoint.y + r2 - a2 + }; + } + } else { + log.debug( + "Corner point skipping fixing", + Math.abs(nextPoint.x - prevPoint.x), + Math.abs(nextPoint.y - prevPoint.y) + ); + } + newLineData.push(newCornerPoint, newNextPoint); + } else { + newLineData.push(lineData[i2]); + } + } + return newLineData; + }, "fixCorners"); + generateDashArray = /* @__PURE__ */ __name((len, oValueS, oValueE) => { + const middleLength = len - oValueS - oValueE; + const dashLength = 2; + const gapLength = 2; + const dashGapPairLength = dashLength + gapLength; + const numberOfPairs = Math.floor(middleLength / dashGapPairLength); + const middlePattern = Array(numberOfPairs).fill(`${dashLength} ${gapLength}`).join(" "); + const dashArray = `0 ${oValueS} ${middlePattern} ${oValueE}`; + return dashArray; + }, "generateDashArray"); + insertEdge = /* @__PURE__ */ __name(function(elem, edge, clusterDb2, diagramType, startNode, endNode, diagramId3, skipIntersect = false) { + if (!diagramId3) { + throw new Error( + `insertEdge: missing diagramId for edge "${edge.id}" \u2014 edge IDs require a diagram prefix for uniqueness` + ); + } + const { handDrawnSeed } = getConfig2(); + let points = edge.points; + let pointsHasChanged = false; + const tail = startNode; + var head2 = endNode; + const edgeClassStyles = []; + for (const key in edge.cssCompiledStyles) { + if (isLabelStyle(key)) { + continue; + } + edgeClassStyles.push(edge.cssCompiledStyles[key]); + } + log.debug("UIO intersect check", edge.points, head2.x, tail.x); + if (head2.intersect && tail.intersect && !skipIntersect) { + points = points.slice(1, edge.points.length - 1); + points.unshift(tail.intersect(points[0])); + log.debug( + "Last point UIO", + edge.start, + "-->", + edge.end, + points[points.length - 1], + head2, + head2.intersect(points[points.length - 1]) + ); + points.push(head2.intersect(points[points.length - 1])); + } + const pointsStr = btoa(JSON.stringify(points)); + if (edge.toCluster) { + log.info("to cluster abc88", clusterDb2.get(edge.toCluster)); + points = cutPathAtIntersect(edge.points, clusterDb2.get(edge.toCluster).node); + pointsHasChanged = true; + } + if (edge.fromCluster) { + log.debug( + "from cluster abc88", + clusterDb2.get(edge.fromCluster), + JSON.stringify(points, null, 2) + ); + points = cutPathAtIntersect(points.reverse(), clusterDb2.get(edge.fromCluster).node).reverse(); + pointsHasChanged = true; + } + let lineData = points.filter((p3) => !Number.isNaN(p3.y)); + const edgeCurveType = resolveEdgeCurveType(edge.curve); + if (edgeCurveType !== "rounded") { + lineData = fixCorners(lineData); + } + let curve = linear_default; + switch (edgeCurveType) { + case "linear": + curve = linear_default; + break; + case "basis": + curve = basis_default2; + break; + case "cardinal": + curve = cardinal_default; + break; + case "bumpX": + curve = bumpX; + break; + case "bumpY": + curve = bumpY; + break; + case "catmullRom": + curve = catmullRom_default; + break; + case "monotoneX": + curve = monotoneX; + break; + case "monotoneY": + curve = monotoneY; + break; + case "natural": + curve = natural_default; + break; + case "step": + curve = step_default; + break; + case "stepAfter": + curve = stepAfter; + break; + case "stepBefore": + curve = stepBefore; + break; + case "rounded": + curve = linear_default; + break; + default: + curve = basis_default2; + } + const { x: x5, y: y6 } = getLineFunctionsWithOffset(edge); + const lineFunction = line_default().x(x5).y(y6).curve(curve); + let strokeClasses; + switch (edge.thickness) { + case "normal": + strokeClasses = "edge-thickness-normal"; + break; + case "thick": + strokeClasses = "edge-thickness-thick"; + break; + case "invisible": + strokeClasses = "edge-thickness-invisible"; + break; + default: + strokeClasses = "edge-thickness-normal"; + } + switch (edge.pattern) { + case "solid": + strokeClasses += " edge-pattern-solid"; + break; + case "dotted": + strokeClasses += " edge-pattern-dotted"; + break; + case "dashed": + strokeClasses += " edge-pattern-dashed"; + break; + default: + strokeClasses += " edge-pattern-solid"; + } + let svgPath; + let linePath = edgeCurveType === "rounded" ? generateRoundedPath(applyMarkerOffsetsToPoints(lineData, edge), 5) : lineFunction(lineData); + const edgeStyles = Array.isArray(edge.style) ? edge.style : [edge.style]; + let strokeColor = edgeStyles.find((style3) => style3?.startsWith("stroke:")); + let animationClass = ""; + if (edge.animate) { + animationClass = "edge-animation-fast"; + } + if (edge.animation) { + animationClass = "edge-animation-" + edge.animation; + } + let animatedEdge = false; + if (edge.look === "handDrawn") { + const rc = at.svg(elem); + Object.assign([], lineData); + const svgPathNode = rc.path(linePath, { + roughness: 0.3, + seed: handDrawnSeed + }); + strokeClasses += " transition"; + svgPath = select_default2(svgPathNode).select("path").attr("id", `${diagramId3}-${edge.id}`).attr( + "class", + " " + strokeClasses + (edge.classes ? " " + edge.classes : "") + (animationClass ? " " + animationClass : "") + ).attr("style", edgeStyles ? edgeStyles.reduce((acc, style3) => acc + ";" + style3, "") : ""); + let d3 = svgPath.attr("d"); + svgPath.attr("d", d3); + elem.node().appendChild(svgPath.node()); + } else { + const stylesFromClasses = edgeClassStyles.join(";"); + const styles6 = edgeStyles ? edgeStyles.reduce((acc, style3) => acc + style3 + ";", "") : ""; + const pathStyle = (stylesFromClasses ? stylesFromClasses + ";" + styles6 + ";" : styles6) + ";" + (edgeStyles ? edgeStyles.reduce((acc, style3) => acc + ";" + style3, "") : ""); + svgPath = elem.append("path").attr("d", linePath).attr("id", `${diagramId3}-${edge.id}`).attr( + "class", + " " + strokeClasses + (edge.classes ? " " + edge.classes : "") + (animationClass ? " " + animationClass : "") + ).attr("style", pathStyle); + strokeColor = pathStyle.match(/stroke:([^;]+)/)?.[1]; + animatedEdge = edge.animate === true || !!edge.animation || stylesFromClasses.includes("animation"); + const pathNode = svgPath.node(); + const len = typeof pathNode.getTotalLength === "function" ? pathNode.getTotalLength() : 0; + const oValueS = markerOffsets2[edge.arrowTypeStart] || 0; + const oValueE = markerOffsets2[edge.arrowTypeEnd] || 0; + if (edge.look === "neo" && !animatedEdge) { + const dashArray = edge.pattern === "dotted" || edge.pattern === "dashed" ? generateDashArray(len, oValueS, oValueE) : `0 ${oValueS} ${len - oValueS - oValueE} ${oValueE}`; + const mOffset = `stroke-dasharray: ${dashArray}; stroke-dashoffset: 0;`; + svgPath.attr("style", mOffset + svgPath.attr("style")); + } + } + svgPath.attr("data-edge", true); + svgPath.attr("data-et", "edge"); + svgPath.attr("data-id", edge.id); + svgPath.attr("data-points", pointsStr); + svgPath.attr("data-look", handleUndefinedAttr(edge.look)); + if (edge.showPoints) { + lineData.forEach((point9) => { + elem.append("circle").style("stroke", "red").style("fill", "red").attr("r", 1).attr("cx", point9.x).attr("cy", point9.y); + }); + } + let url = ""; + if (getConfig2().flowchart.arrowMarkerAbsolute || getConfig2().state.arrowMarkerAbsolute) { + url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search; + url = url.replace(/\(/g, "\\(").replace(/\)/g, "\\)"); + } + log.info("arrowTypeStart", edge.arrowTypeStart); + log.info("arrowTypeEnd", edge.arrowTypeEnd); + const useMargin = !animatedEdge && edge?.look === "neo"; + addEdgeMarkers(svgPath, edge, url, diagramId3, diagramType, useMargin, strokeColor); + const midIndex = Math.floor(points.length / 2); + const point8 = points[midIndex]; + if (!utils_default2.isLabelCoordinateInPath(point8, svgPath.attr("d"))) { + pointsHasChanged = true; + } + let paths = {}; + if (pointsHasChanged) { + paths.updatedPath = points; + } + paths.originalPath = edge.points; + return paths; + }, "insertEdge"); + __name(generateRoundedPath, "generateRoundedPath"); + __name(calculateDeltaAndAngle2, "calculateDeltaAndAngle"); + __name(applyMarkerOffsetsToPoints, "applyMarkerOffsetsToPoints"); + } + }); + + // src/rendering-util/rendering-elements/markers.js + var insertMarkers, extension, composition, aggregation, dependency, lollipop, point6, circle2, cross, barb, barbNeo, only_one, zero_or_one, one_or_more, zero_or_more, only_one_neo, zero_or_one_neo, one_or_more_neo, zero_or_more_neo, requirement_arrow, requirement_arrow_neo, requirement_contains, requirement_contains_neo, markers, markers_default; + var init_markers = __esm({ + "src/rendering-util/rendering-elements/markers.js"() { + "use strict"; + init_logger(); + init_config(); + insertMarkers = /* @__PURE__ */ __name((elem, markerArray, type3, id35) => { + markerArray.forEach((markerName) => { + markers[markerName](elem, type3, id35); + }); + }, "insertMarkers"); + extension = /* @__PURE__ */ __name((elem, type3, id35) => { + log.trace("Making markers for ", id35); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-extensionStart").attr("class", "marker extension " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").attr("d", "M 1,7 L18,13 V 1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-extensionEnd").attr("class", "marker extension " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-extensionStart-margin").attr("class", "marker extension " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").attr("viewBox", "0 0 20 14").append("polygon").attr("points", "10,7 18,13 18,1").style("stroke-width", 2).style("stroke-dasharray", "0"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-extensionEnd-margin").attr("class", "marker extension " + type3).attr("refX", 9).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").attr("viewBox", "0 0 20 14").append("polygon").attr("points", "10,1 10,13 18,7").style("stroke-width", 2).style("stroke-dasharray", "0"); + }, "extension"); + composition = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-compositionStart").attr("class", "marker composition " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-compositionEnd").attr("class", "marker composition " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-compositionStart-margin").attr("class", "marker composition " + type3).attr("refX", 15).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 0).attr("viewBox", "0 0 15 15").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-compositionEnd-margin").attr("class", "marker composition " + type3).attr("refX", 3.5).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 0).attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + }, "composition"); + aggregation = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-aggregationStart").attr("class", "marker aggregation " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-aggregationEnd").attr("class", "marker aggregation " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-aggregationStart-margin").attr("class", "marker aggregation " + type3).attr("refX", 15).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 2).attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-aggregationEnd-margin").attr("class", "marker aggregation " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 2).attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + }, "aggregation"); + dependency = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-dependencyStart").attr("class", "marker dependency " + type3).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-dependencyEnd").attr("class", "marker dependency " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-dependencyStart-margin").attr("class", "marker dependency " + type3).attr("refX", 4).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 0).attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-dependencyEnd-margin").attr("class", "marker dependency " + type3).attr("refX", 16).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").style("stroke-width", 0).attr("d", "M 18,7 L9,13 L14,7 L9,1 Z"); + }, "dependency"); + lollipop = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-lollipopStart").attr("class", "marker lollipop " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-lollipopEnd").attr("class", "marker lollipop " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-lollipopStart-margin").attr("class", "marker lollipop " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("circle").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6).attr("stroke-width", 2); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-lollipopEnd-margin").attr("class", "marker lollipop " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("circle").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6).attr("stroke-width", 2); + }, "lollipop"); + point6 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("marker").attr("id", id35 + "_" + type3 + "-pointEnd").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-pointStart").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 8).attr("markerHeight", 8).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-pointEnd-margin").attr("class", "marker " + type3).attr("viewBox", "0 0 11.5 14").attr("refX", 11.5).attr("refY", 7).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 10.5).attr("markerHeight", 14).attr("orient", "auto").append("path").attr("d", "M 0 0 L 11.5 7 L 0 14 z").attr("class", "arrowMarkerPath").style("stroke-width", 0).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-pointStart-margin").attr("class", "marker " + type3).attr("viewBox", "0 0 11.5 14").attr("refX", 1).attr("refY", 7).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11.5).attr("markerHeight", 14).attr("orient", "auto").append("polygon").attr("points", "0,7 11.5,14 11.5,0").attr("class", "arrowMarkerPath").style("stroke-width", 0).style("stroke-dasharray", "1,0"); + }, "point"); + circle2 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("marker").attr("id", id35 + "_" + type3 + "-circleEnd").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-circleStart").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-circleEnd-margin").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refY", 5).attr("refX", 12.25).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 14).attr("markerHeight", 14).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 0).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-circleStart-margin").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", -2).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 14).attr("markerHeight", 14).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 0).style("stroke-dasharray", "1,0"); + }, "circle"); + cross = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("marker").attr("id", id35 + "_" + type3 + "-crossEnd").attr("class", "marker cross " + type3).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-crossStart").attr("class", "marker cross " + type3).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-crossEnd-margin").attr("class", "marker cross " + type3).attr("viewBox", "0 0 15 15").attr("refX", 17.7).attr("refY", 7.5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 1,1 L 14,14 M 1,14 L 14,1").attr("class", "arrowMarkerPath").style("stroke-width", 2.5); + elem.append("marker").attr("id", id35 + "_" + type3 + "-crossStart-margin").attr("class", "marker cross " + type3).attr("viewBox", "0 0 15 15").attr("refX", -3.5).attr("refY", 7.5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 1,1 L 14,14 M 1,14 L 14,1").attr("class", "arrowMarkerPath").style("stroke-width", 2.5).style("stroke-dasharray", "1,0"); + }, "cross"); + barb = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z"); + }, "barb"); + barbNeo = /* @__PURE__ */ __name((elem, type3, id35) => { + const config5 = getConfig(); + const { themeVariables } = config5; + const { transitionColor } = themeVariables; + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L11,14 L13,7 L11,0 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-barbEnd-margin").attr("refX", 17).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto").append("path").attr("d", "M 19,7 L11,14 L13,7 L11,0 Z").attr("fill", `${transitionColor}`); + }, "barbNeo"); + only_one = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-onlyOneStart").attr("class", "marker onlyOne " + type3).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("d", "M9,0 L9,18 M15,0 L15,18"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-onlyOneEnd").attr("class", "marker onlyOne " + type3).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("d", "M3,0 L3,18 M9,0 L9,18"); + }, "only_one"); + zero_or_one = /* @__PURE__ */ __name((elem, type3, id35) => { + const startMarker = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-zeroOrOneStart").attr("class", "marker zeroOrOne " + type3).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"); + startMarker.append("circle").attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6); + startMarker.append("path").attr("d", "M9,0 L9,18"); + const endMarker = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-zeroOrOneEnd").attr("class", "marker zeroOrOne " + type3).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"); + endMarker.append("circle").attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6); + endMarker.append("path").attr("d", "M21,0 L21,18"); + }, "zero_or_one"); + one_or_more = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-oneOrMoreStart").attr("class", "marker oneOrMore " + type3).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-oneOrMoreEnd").attr("class", "marker oneOrMore " + type3).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"); + }, "one_or_more"); + zero_or_more = /* @__PURE__ */ __name((elem, type3, id35) => { + const startMarker = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-zeroOrMoreStart").attr("class", "marker zeroOrMore " + type3).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"); + startMarker.append("circle").attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6); + startMarker.append("path").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18"); + const endMarker = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-zeroOrMoreEnd").attr("class", "marker zeroOrMore " + type3).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"); + endMarker.append("circle").attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6); + endMarker.append("path").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18"); + }, "zero_or_more"); + only_one_neo = /* @__PURE__ */ __name((elem, type3, id35) => { + const config5 = getConfig(); + const { themeVariables } = config5; + const { strokeWidth } = themeVariables; + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-onlyOneStart").attr("class", "marker onlyOne " + type3).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").attr("d", "M9,0 L9,18 M15,0 L15,18").attr("stroke-width", `${strokeWidth}`); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-onlyOneEnd").attr("class", "marker onlyOne " + type3).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").attr("d", "M3,0 L3,18 M9,0 L9,18").attr("stroke-width", `${strokeWidth}`); + }, "only_one_neo"); + zero_or_one_neo = /* @__PURE__ */ __name((elem, type3, id35) => { + const config5 = getConfig(); + const { themeVariables } = config5; + const { strokeWidth, mainBkg } = themeVariables; + const startMarker = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-zeroOrOneStart").attr("class", "marker zeroOrOne " + type3).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse"); + startMarker.append("circle").attr("fill", mainBkg ?? "white").attr("cx", 21).attr("cy", 9).attr("stroke-width", `${strokeWidth}`).attr("r", 6); + startMarker.append("path").attr("d", "M9,0 L9,18").attr("stroke-width", `${strokeWidth}`); + const endMarker = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-zeroOrOneEnd").attr("class", "marker zeroOrOne " + type3).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto"); + endMarker.append("circle").attr("fill", mainBkg ?? "white").attr("cx", 9).attr("cy", 9).attr("stroke-width", `${strokeWidth}`).attr("r", 6); + endMarker.append("path").attr("d", "M21,0 L21,18").attr("stroke-width", `${strokeWidth}`); + }, "zero_or_one_neo"); + one_or_more_neo = /* @__PURE__ */ __name((elem, type3, id35) => { + const config5 = getConfig(); + const { themeVariables } = config5; + const { strokeWidth } = themeVariables; + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-oneOrMoreStart").attr("class", "marker oneOrMore " + type3).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("path").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27").attr("stroke-width", `${strokeWidth}`); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-oneOrMoreEnd").attr("class", "marker oneOrMore " + type3).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto").append("path").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18").attr("stroke-width", `${strokeWidth}`); + }, "one_or_more_neo"); + zero_or_more_neo = /* @__PURE__ */ __name((elem, type3, id35) => { + const config5 = getConfig(); + const { themeVariables } = config5; + const { strokeWidth, mainBkg } = themeVariables; + const startMarker = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-zeroOrMoreStart").attr("class", "marker zeroOrMore " + type3).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("markerUnits", "userSpaceOnUse").attr("orient", "auto"); + startMarker.append("circle").attr("fill", mainBkg ?? "white").attr("cx", 45.5).attr("cy", 18).attr("r", 6).attr("stroke-width", `${strokeWidth}`); + startMarker.append("path").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18").attr("stroke-width", `${strokeWidth}`); + const endMarker = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-zeroOrMoreEnd").attr("class", "marker zeroOrMore " + type3).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse"); + endMarker.append("circle").attr("fill", mainBkg ?? "white").attr("cx", 11).attr("cy", 18).attr("r", 6).attr("stroke-width", `${strokeWidth}`); + endMarker.append("path").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18").attr("stroke-width", `${strokeWidth}`); + }, "zero_or_more_neo"); + requirement_arrow = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-requirement_arrowEnd").attr("refX", 20).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").append("path").attr( + "d", + `M0,0 + L20,10 + M20,10 + L0,20` + ); + }, "requirement_arrow"); + requirement_arrow_neo = /* @__PURE__ */ __name((elem, type3, id35) => { + const config5 = getConfig(); + const { themeVariables } = config5; + const { strokeWidth } = themeVariables; + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-requirement_arrowEnd").attr("refX", 20).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").attr("stroke-width", `${strokeWidth}`).attr("viewBox", "0 0 25 20").append("path").attr( + "d", + `M0,0 + L20,10 + M20,10 + L0,20` + ).attr("stroke-linejoin", "miter"); + }, "requirement_arrow_neo"); + requirement_contains = /* @__PURE__ */ __name((elem, type3, id35) => { + const containsNode = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-requirement_containsStart").attr("refX", 0).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").append("g"); + containsNode.append("circle").attr("cx", 10).attr("cy", 10).attr("r", 9).attr("fill", "none"); + containsNode.append("line").attr("x1", 1).attr("x2", 19).attr("y1", 10).attr("y2", 10); + containsNode.append("line").attr("y1", 1).attr("y2", 19).attr("x1", 10).attr("x2", 10); + }, "requirement_contains"); + requirement_contains_neo = /* @__PURE__ */ __name((elem, type3, id35) => { + const config5 = getConfig(); + const { themeVariables } = config5; + const { strokeWidth } = themeVariables; + const containsNode = elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-requirement_containsStart").attr("refX", 0).attr("refY", 10).attr("markerWidth", 20).attr("markerHeight", 20).attr("orient", "auto").attr("markerUnits", "userSpaceOnUse").append("g"); + containsNode.append("circle").attr("cx", 10).attr("cy", 10).attr("r", 9).attr("fill", "none"); + containsNode.append("line").attr("x1", 1).attr("x2", 19).attr("y1", 10).attr("y2", 10); + containsNode.append("line").attr("y1", 1).attr("y2", 19).attr("x1", 10).attr("x2", 10); + containsNode.selectAll("*").attr("stroke-width", `${strokeWidth}`); + }, "requirement_contains_neo"); + markers = { + extension, + composition, + aggregation, + dependency, + lollipop, + point: point6, + circle: circle2, + cross, + barb, + barbNeo, + only_one, + zero_or_one, + one_or_more, + zero_or_more, + only_one_neo, + zero_or_one_neo, + one_or_more_neo, + zero_or_more_neo, + requirement_arrow, + requirement_contains, + requirement_arrow_neo, + requirement_contains_neo + }; + markers_default = insertMarkers; + } + }); + + // src/rendering-util/rendering-elements/nodes.ts + async function insertNode(elem, node2, renderOptions) { + let newEl; + let el; + if (node2.shape === "rect") { + if (node2.rx && node2.ry) { + node2.shape = "roundedRect"; + } else { + node2.shape = "squareRect"; + } + } + const shapeHandler = node2.shape ? shapes[node2.shape] : void 0; + if (!shapeHandler) { + throw new Error(`No such shape: ${node2.shape}. Please check your syntax.`); + } + if (node2.link) { + let target; + if (renderOptions.config.securityLevel === "sandbox") { + target = "_top"; + } else if (node2.linkTarget) { + target = node2.linkTarget || "_blank"; + } + newEl = elem.insert("svg:a").attr("xlink:href", node2.link).attr("target", target ?? null); + el = await shapeHandler(newEl, node2, renderOptions); + } else { + el = await shapeHandler(elem, node2, renderOptions); + newEl = el; + } + newEl.attr("data-look", handleUndefinedAttr(node2.look)); + if (node2.tooltip) { + el.attr("title", node2.tooltip); + } + nodeElems.set(node2.id, newEl); + if (node2.haveCallback) { + newEl.attr("class", newEl.attr("class") + " clickable"); + } + return newEl; + } + var nodeElems, setNodeElem, clear5, positionNode; + var init_nodes2 = __esm({ + "src/rendering-util/rendering-elements/nodes.ts"() { + "use strict"; + init_logger(); + init_shapes(); + init_utils2(); + nodeElems = /* @__PURE__ */ new Map(); + __name(insertNode, "insertNode"); + setNodeElem = /* @__PURE__ */ __name((elem, node2) => { + nodeElems.set(node2.id, elem); + }, "setNodeElem"); + clear5 = /* @__PURE__ */ __name(() => { + nodeElems.clear(); + }, "clear"); + positionNode = /* @__PURE__ */ __name((node2) => { + const el = nodeElems.get(node2.id); + log.trace( + "Transforming node", + node2.diff, + node2, + "translate(" + (node2.x - node2.width / 2 - 5) + ", " + node2.width / 2 + ")" + ); + const padding2 = 8; + const diff2 = node2.diff || 0; + if (node2.clusterNode) { + el.attr( + "transform", + "translate(" + (node2.x + diff2 - node2.width / 2) + ", " + (node2.y - node2.height / 2 - padding2) + ")" + ); + } else { + el.attr("transform", "translate(" + node2.x + ", " + node2.y + ")"); + } + return diff2; + }, "positionNode"); + } + }); + + // src/internals.ts + var internalHelpers; + var init_internals = __esm({ + "src/internals.ts"() { + "use strict"; + init_config(); + init_common(); + init_logger(); + init_clusters(); + init_edges(); + init_markers(); + init_nodes2(); + init_util(); + init_utils2(); + internalHelpers = { + common: common_default, + getConfig, + insertCluster, + insertEdge, + insertEdgeLabel, + insertMarkers: markers_default, + insertNode, + interpolateToCurve, + labelHelper, + log, + positionEdgeLabel + }; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js + var freeGlobal, freeGlobal_default; + var init_freeGlobal = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js"() { + "use strict"; + freeGlobal = typeof global == "object" && global && global.Object === Object && global; + freeGlobal_default = freeGlobal; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_root.js + var freeSelf, root2, root_default; + var init_root = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_root.js"() { + "use strict"; + init_freeGlobal(); + freeSelf = typeof self == "object" && self && self.Object === Object && self; + root2 = freeGlobal_default || freeSelf || Function("return this")(); + root_default = root2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js + var Symbol2, Symbol_default; + var init_Symbol = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js"() { + "use strict"; + init_root(); + Symbol2 = root_default.Symbol; + Symbol_default = Symbol2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js + function getRawTag(value2) { + var isOwn = hasOwnProperty.call(value2, symToStringTag), tag = value2[symToStringTag]; + try { + value2[symToStringTag] = void 0; + var unmasked = true; + } catch (e3) { + } + var result = nativeObjectToString.call(value2); + if (unmasked) { + if (isOwn) { + value2[symToStringTag] = tag; + } else { + delete value2[symToStringTag]; + } + } + return result; + } + var objectProto, hasOwnProperty, nativeObjectToString, symToStringTag, getRawTag_default; + var init_getRawTag = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js"() { + "use strict"; + init_Symbol(); + objectProto = Object.prototype; + hasOwnProperty = objectProto.hasOwnProperty; + nativeObjectToString = objectProto.toString; + symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0; + __name(getRawTag, "getRawTag"); + getRawTag_default = getRawTag; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js + function objectToString(value2) { + return nativeObjectToString2.call(value2); + } + var objectProto2, nativeObjectToString2, objectToString_default; + var init_objectToString = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js"() { + "use strict"; + objectProto2 = Object.prototype; + nativeObjectToString2 = objectProto2.toString; + __name(objectToString, "objectToString"); + objectToString_default = objectToString; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js + function baseGetTag(value2) { + if (value2 == null) { + return value2 === void 0 ? undefinedTag : nullTag; + } + return symToStringTag2 && symToStringTag2 in Object(value2) ? getRawTag_default(value2) : objectToString_default(value2); + } + var nullTag, undefinedTag, symToStringTag2, baseGetTag_default; + var init_baseGetTag = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js"() { + "use strict"; + init_Symbol(); + init_getRawTag(); + init_objectToString(); + nullTag = "[object Null]"; + undefinedTag = "[object Undefined]"; + symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0; + __name(baseGetTag, "baseGetTag"); + baseGetTag_default = baseGetTag; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js + function isObjectLike2(value2) { + return value2 != null && typeof value2 == "object"; + } + var isObjectLike_default; + var init_isObjectLike2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js"() { + "use strict"; + __name(isObjectLike2, "isObjectLike"); + isObjectLike_default = isObjectLike2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js + function isSymbol(value2) { + return typeof value2 == "symbol" || isObjectLike_default(value2) && baseGetTag_default(value2) == symbolTag2; + } + var symbolTag2, isSymbol_default; + var init_isSymbol = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js"() { + "use strict"; + init_baseGetTag(); + init_isObjectLike2(); + symbolTag2 = "[object Symbol]"; + __name(isSymbol, "isSymbol"); + isSymbol_default = isSymbol; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js + function arrayMap(array4, iteratee) { + var index = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2); + while (++index < length2) { + result[index] = iteratee(array4[index], index, array4); + } + return result; + } + var arrayMap_default; + var init_arrayMap = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js"() { + "use strict"; + __name(arrayMap, "arrayMap"); + arrayMap_default = arrayMap; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArray.js + var isArray2, isArray_default; + var init_isArray2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArray.js"() { + "use strict"; + isArray2 = Array.isArray; + isArray_default = isArray2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js + function baseToString(value2) { + if (typeof value2 == "string") { + return value2; + } + if (isArray_default(value2)) { + return arrayMap_default(value2, baseToString) + ""; + } + if (isSymbol_default(value2)) { + return symbolToString ? symbolToString.call(value2) : ""; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -INFINITY ? "-0" : result; + } + var INFINITY, symbolProto, symbolToString, baseToString_default; + var init_baseToString = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js"() { + "use strict"; + init_Symbol(); + init_arrayMap(); + init_isArray2(); + init_isSymbol(); + INFINITY = 1 / 0; + symbolProto = Symbol_default ? Symbol_default.prototype : void 0; + symbolToString = symbolProto ? symbolProto.toString : void 0; + __name(baseToString, "baseToString"); + baseToString_default = baseToString; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js + function trimmedEndIndex(string3) { + var index = string3.length; + while (index-- && reWhitespace.test(string3.charAt(index))) { + } + return index; + } + var reWhitespace, trimmedEndIndex_default; + var init_trimmedEndIndex = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js"() { + "use strict"; + reWhitespace = /\s/; + __name(trimmedEndIndex, "trimmedEndIndex"); + trimmedEndIndex_default = trimmedEndIndex; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js + function baseTrim(string3) { + return string3 ? string3.slice(0, trimmedEndIndex_default(string3) + 1).replace(reTrimStart, "") : string3; + } + var reTrimStart, baseTrim_default; + var init_baseTrim = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js"() { + "use strict"; + init_trimmedEndIndex(); + reTrimStart = /^\s+/; + __name(baseTrim, "baseTrim"); + baseTrim_default = baseTrim; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js + function isObject2(value2) { + var type3 = typeof value2; + return value2 != null && (type3 == "object" || type3 == "function"); + } + var isObject_default; + var init_isObject = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js"() { + "use strict"; + __name(isObject2, "isObject"); + isObject_default = isObject2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js + function toNumber(value2) { + if (typeof value2 == "number") { + return value2; + } + if (isSymbol_default(value2)) { + return NAN; + } + if (isObject_default(value2)) { + var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2; + value2 = isObject_default(other) ? other + "" : other; + } + if (typeof value2 != "string") { + return value2 === 0 ? value2 : +value2; + } + value2 = baseTrim_default(value2); + var isBinary2 = reIsBinary.test(value2); + return isBinary2 || reIsOctal.test(value2) ? freeParseInt(value2.slice(2), isBinary2 ? 2 : 8) : reIsBadHex.test(value2) ? NAN : +value2; + } + var NAN, reIsBadHex, reIsBinary, reIsOctal, freeParseInt, toNumber_default; + var init_toNumber = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js"() { + "use strict"; + init_baseTrim(); + init_isObject(); + init_isSymbol(); + NAN = 0 / 0; + reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + reIsBinary = /^0b[01]+$/i; + reIsOctal = /^0o[0-7]+$/i; + freeParseInt = parseInt; + __name(toNumber, "toNumber"); + toNumber_default = toNumber; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toFinite.js + function toFinite(value2) { + if (!value2) { + return value2 === 0 ? value2 : 0; + } + value2 = toNumber_default(value2); + if (value2 === INFINITY2 || value2 === -INFINITY2) { + var sign2 = value2 < 0 ? -1 : 1; + return sign2 * MAX_INTEGER; + } + return value2 === value2 ? value2 : 0; + } + var INFINITY2, MAX_INTEGER, toFinite_default; + var init_toFinite = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toFinite.js"() { + "use strict"; + init_toNumber(); + INFINITY2 = 1 / 0; + MAX_INTEGER = 17976931348623157e292; + __name(toFinite, "toFinite"); + toFinite_default = toFinite; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toInteger.js + function toInteger(value2) { + var result = toFinite_default(value2), remainder = result % 1; + return result === result ? remainder ? result - remainder : result : 0; + } + var toInteger_default; + var init_toInteger = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toInteger.js"() { + "use strict"; + init_toFinite(); + __name(toInteger, "toInteger"); + toInteger_default = toInteger; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/identity.js + function identity4(value2) { + return value2; + } + var identity_default4; + var init_identity4 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/identity.js"() { + "use strict"; + __name(identity4, "identity"); + identity_default4 = identity4; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js + function isFunction(value2) { + if (!isObject_default(value2)) { + return false; + } + var tag = baseGetTag_default(value2); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; + } + var asyncTag, funcTag, genTag, proxyTag, isFunction_default; + var init_isFunction = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js"() { + "use strict"; + init_baseGetTag(); + init_isObject(); + asyncTag = "[object AsyncFunction]"; + funcTag = "[object Function]"; + genTag = "[object GeneratorFunction]"; + proxyTag = "[object Proxy]"; + __name(isFunction, "isFunction"); + isFunction_default = isFunction; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js + var coreJsData, coreJsData_default; + var init_coreJsData = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js"() { + "use strict"; + init_root(); + coreJsData = root_default["__core-js_shared__"]; + coreJsData_default = coreJsData; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js + function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; + } + var maskSrcKey, isMasked_default; + var init_isMasked = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js"() { + "use strict"; + init_coreJsData(); + maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; + })(); + __name(isMasked, "isMasked"); + isMasked_default = isMasked; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js + function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e3) { + } + try { + return func + ""; + } catch (e3) { + } + } + return ""; + } + var funcProto, funcToString, toSource_default; + var init_toSource = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js"() { + "use strict"; + funcProto = Function.prototype; + funcToString = funcProto.toString; + __name(toSource, "toSource"); + toSource_default = toSource; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js + function baseIsNative(value2) { + if (!isObject_default(value2) || isMasked_default(value2)) { + return false; + } + var pattern = isFunction_default(value2) ? reIsNative : reIsHostCtor; + return pattern.test(toSource_default(value2)); + } + var reRegExpChar, reIsHostCtor, funcProto2, objectProto3, funcToString2, hasOwnProperty2, reIsNative, baseIsNative_default; + var init_baseIsNative = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js"() { + "use strict"; + init_isFunction(); + init_isMasked(); + init_isObject(); + init_toSource(); + reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + reIsHostCtor = /^\[object .+?Constructor\]$/; + funcProto2 = Function.prototype; + objectProto3 = Object.prototype; + funcToString2 = funcProto2.toString; + hasOwnProperty2 = objectProto3.hasOwnProperty; + reIsNative = RegExp( + "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + __name(baseIsNative, "baseIsNative"); + baseIsNative_default = baseIsNative; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js + function getValue(object3, key) { + return object3 == null ? void 0 : object3[key]; + } + var getValue_default; + var init_getValue = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js"() { + "use strict"; + __name(getValue, "getValue"); + getValue_default = getValue; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js + function getNative(object3, key) { + var value2 = getValue_default(object3, key); + return baseIsNative_default(value2) ? value2 : void 0; + } + var getNative_default; + var init_getNative = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js"() { + "use strict"; + init_baseIsNative(); + init_getValue(); + __name(getNative, "getNative"); + getNative_default = getNative; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js + var WeakMap, WeakMap_default; + var init_WeakMap = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js"() { + "use strict"; + init_getNative(); + init_root(); + WeakMap = getNative_default(root_default, "WeakMap"); + WeakMap_default = WeakMap; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js + var objectCreate, baseCreate, baseCreate_default; + var init_baseCreate = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js"() { + "use strict"; + init_isObject(); + objectCreate = Object.create; + baseCreate = /* @__PURE__ */ (function() { + function object3() { + } + __name(object3, "object"); + return function(proto) { + if (!isObject_default(proto)) { + return {}; + } + if (objectCreate) { + return objectCreate(proto); + } + object3.prototype = proto; + var result = new object3(); + object3.prototype = void 0; + return result; + }; + })(); + baseCreate_default = baseCreate; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_apply.js + function apply2(func, thisArg, args) { + switch (args.length) { + case 0: + return func.call(thisArg); + case 1: + return func.call(thisArg, args[0]); + case 2: + return func.call(thisArg, args[0], args[1]); + case 3: + return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + var apply_default; + var init_apply = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_apply.js"() { + "use strict"; + __name(apply2, "apply"); + apply_default = apply2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/noop.js + function noop3() { + } + var noop_default2; + var init_noop3 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/noop.js"() { + "use strict"; + __name(noop3, "noop"); + noop_default2 = noop3; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js + function copyArray(source, array4) { + var index = -1, length2 = source.length; + array4 || (array4 = Array(length2)); + while (++index < length2) { + array4[index] = source[index]; + } + return array4; + } + var copyArray_default; + var init_copyArray = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js"() { + "use strict"; + __name(copyArray, "copyArray"); + copyArray_default = copyArray; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js + function shortOut(func) { + var count2 = 0, lastCalled = 0; + return function() { + var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); + lastCalled = stamp; + if (remaining > 0) { + if (++count2 >= HOT_COUNT) { + return arguments[0]; + } + } else { + count2 = 0; + } + return func.apply(void 0, arguments); + }; + } + var HOT_COUNT, HOT_SPAN, nativeNow, shortOut_default; + var init_shortOut = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js"() { + "use strict"; + HOT_COUNT = 800; + HOT_SPAN = 16; + nativeNow = Date.now; + __name(shortOut, "shortOut"); + shortOut_default = shortOut; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/constant.js + function constant(value2) { + return function() { + return value2; + }; + } + var constant_default7; + var init_constant8 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/constant.js"() { + "use strict"; + __name(constant, "constant"); + constant_default7 = constant; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js + var defineProperty, defineProperty_default; + var init_defineProperty = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js"() { + "use strict"; + init_getNative(); + defineProperty = (function() { + try { + var func = getNative_default(Object, "defineProperty"); + func({}, "", {}); + return func; + } catch (e3) { + } + })(); + defineProperty_default = defineProperty; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js + var baseSetToString, baseSetToString_default; + var init_baseSetToString = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js"() { + "use strict"; + init_constant8(); + init_defineProperty(); + init_identity4(); + baseSetToString = !defineProperty_default ? identity_default4 : function(func, string3) { + return defineProperty_default(func, "toString", { + "configurable": true, + "enumerable": false, + "value": constant_default7(string3), + "writable": true + }); + }; + baseSetToString_default = baseSetToString; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js + var setToString, setToString_default; + var init_setToString = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js"() { + "use strict"; + init_baseSetToString(); + init_shortOut(); + setToString = shortOut_default(baseSetToString_default); + setToString_default = setToString; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js + function arrayEach(array4, iteratee) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (iteratee(array4[index], index, array4) === false) { + break; + } + } + return array4; + } + var arrayEach_default; + var init_arrayEach = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js"() { + "use strict"; + __name(arrayEach, "arrayEach"); + arrayEach_default = arrayEach; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFindIndex.js + function baseFindIndex(array4, predicate, fromIndex, fromRight) { + var length2 = array4.length, index = fromIndex + (fromRight ? 1 : -1); + while (fromRight ? index-- : ++index < length2) { + if (predicate(array4[index], index, array4)) { + return index; + } + } + return -1; + } + var baseFindIndex_default; + var init_baseFindIndex = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFindIndex.js"() { + "use strict"; + __name(baseFindIndex, "baseFindIndex"); + baseFindIndex_default = baseFindIndex; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNaN.js + function baseIsNaN(value2) { + return value2 !== value2; + } + var baseIsNaN_default; + var init_baseIsNaN = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNaN.js"() { + "use strict"; + __name(baseIsNaN, "baseIsNaN"); + baseIsNaN_default = baseIsNaN; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_strictIndexOf.js + function strictIndexOf(array4, value2, fromIndex) { + var index = fromIndex - 1, length2 = array4.length; + while (++index < length2) { + if (array4[index] === value2) { + return index; + } + } + return -1; + } + var strictIndexOf_default; + var init_strictIndexOf = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_strictIndexOf.js"() { + "use strict"; + __name(strictIndexOf, "strictIndexOf"); + strictIndexOf_default = strictIndexOf; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIndexOf.js + function baseIndexOf(array4, value2, fromIndex) { + return value2 === value2 ? strictIndexOf_default(array4, value2, fromIndex) : baseFindIndex_default(array4, baseIsNaN_default, fromIndex); + } + var baseIndexOf_default; + var init_baseIndexOf = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIndexOf.js"() { + "use strict"; + init_baseFindIndex(); + init_baseIsNaN(); + init_strictIndexOf(); + __name(baseIndexOf, "baseIndexOf"); + baseIndexOf_default = baseIndexOf; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayIncludes.js + function arrayIncludes(array4, value2) { + var length2 = array4 == null ? 0 : array4.length; + return !!length2 && baseIndexOf_default(array4, value2, 0) > -1; + } + var arrayIncludes_default; + var init_arrayIncludes = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayIncludes.js"() { + "use strict"; + init_baseIndexOf(); + __name(arrayIncludes, "arrayIncludes"); + arrayIncludes_default = arrayIncludes; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js + function isIndex(value2, length2) { + var type3 = typeof value2; + length2 = length2 == null ? MAX_SAFE_INTEGER : length2; + return !!length2 && (type3 == "number" || type3 != "symbol" && reIsUint.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2); + } + var MAX_SAFE_INTEGER, reIsUint, isIndex_default; + var init_isIndex = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js"() { + "use strict"; + MAX_SAFE_INTEGER = 9007199254740991; + reIsUint = /^(?:0|[1-9]\d*)$/; + __name(isIndex, "isIndex"); + isIndex_default = isIndex; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js + function baseAssignValue(object3, key, value2) { + if (key == "__proto__" && defineProperty_default) { + defineProperty_default(object3, key, { + "configurable": true, + "enumerable": true, + "value": value2, + "writable": true + }); + } else { + object3[key] = value2; + } + } + var baseAssignValue_default; + var init_baseAssignValue = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js"() { + "use strict"; + init_defineProperty(); + __name(baseAssignValue, "baseAssignValue"); + baseAssignValue_default = baseAssignValue; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/eq.js + function eq(value2, other) { + return value2 === other || value2 !== value2 && other !== other; + } + var eq_default; + var init_eq = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/eq.js"() { + "use strict"; + __name(eq, "eq"); + eq_default = eq; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js + function assignValue(object3, key, value2) { + var objValue = object3[key]; + if (!(hasOwnProperty3.call(object3, key) && eq_default(objValue, value2)) || value2 === void 0 && !(key in object3)) { + baseAssignValue_default(object3, key, value2); + } + } + var objectProto4, hasOwnProperty3, assignValue_default; + var init_assignValue = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js"() { + "use strict"; + init_baseAssignValue(); + init_eq(); + objectProto4 = Object.prototype; + hasOwnProperty3 = objectProto4.hasOwnProperty; + __name(assignValue, "assignValue"); + assignValue_default = assignValue; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js + function copyObject(source, props, object3, customizer) { + var isNew = !object3; + object3 || (object3 = {}); + var index = -1, length2 = props.length; + while (++index < length2) { + var key = props[index]; + var newValue = customizer ? customizer(object3[key], source[key], key, object3, source) : void 0; + if (newValue === void 0) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue_default(object3, key, newValue); + } else { + assignValue_default(object3, key, newValue); + } + } + return object3; + } + var copyObject_default; + var init_copyObject = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js"() { + "use strict"; + init_assignValue(); + init_baseAssignValue(); + __name(copyObject, "copyObject"); + copyObject_default = copyObject; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js + function overRest(func, start3, transform8) { + start3 = nativeMax(start3 === void 0 ? func.length - 1 : start3, 0); + return function() { + var args = arguments, index = -1, length2 = nativeMax(args.length - start3, 0), array4 = Array(length2); + while (++index < length2) { + array4[index] = args[start3 + index]; + } + index = -1; + var otherArgs = Array(start3 + 1); + while (++index < start3) { + otherArgs[index] = args[index]; + } + otherArgs[start3] = transform8(array4); + return apply_default(func, this, otherArgs); + }; + } + var nativeMax, overRest_default; + var init_overRest = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js"() { + "use strict"; + init_apply(); + nativeMax = Math.max; + __name(overRest, "overRest"); + overRest_default = overRest; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js + function baseRest(func, start3) { + return setToString_default(overRest_default(func, start3, identity_default4), func + ""); + } + var baseRest_default; + var init_baseRest = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js"() { + "use strict"; + init_identity4(); + init_overRest(); + init_setToString(); + __name(baseRest, "baseRest"); + baseRest_default = baseRest; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isLength.js + function isLength2(value2) { + return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER2; + } + var MAX_SAFE_INTEGER2, isLength_default; + var init_isLength2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isLength.js"() { + "use strict"; + MAX_SAFE_INTEGER2 = 9007199254740991; + __name(isLength2, "isLength"); + isLength_default = isLength2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js + function isArrayLike2(value2) { + return value2 != null && isLength_default(value2.length) && !isFunction_default(value2); + } + var isArrayLike_default; + var init_isArrayLike2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js"() { + "use strict"; + init_isFunction(); + init_isLength2(); + __name(isArrayLike2, "isArrayLike"); + isArrayLike_default = isArrayLike2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js + function isIterateeCall(value2, index, object3) { + if (!isObject_default(object3)) { + return false; + } + var type3 = typeof index; + if (type3 == "number" ? isArrayLike_default(object3) && isIndex_default(index, object3.length) : type3 == "string" && index in object3) { + return eq_default(object3[index], value2); + } + return false; + } + var isIterateeCall_default; + var init_isIterateeCall = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js"() { + "use strict"; + init_eq(); + init_isArrayLike2(); + init_isIndex(); + init_isObject(); + __name(isIterateeCall, "isIterateeCall"); + isIterateeCall_default = isIterateeCall; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createAssigner.js + function createAssigner(assigner) { + return baseRest_default(function(object3, sources) { + var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0; + customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0; + if (guard && isIterateeCall_default(sources[0], sources[1], guard)) { + customizer = length2 < 3 ? void 0 : customizer; + length2 = 1; + } + object3 = Object(object3); + while (++index < length2) { + var source = sources[index]; + if (source) { + assigner(object3, source, index, customizer); + } + } + return object3; + }); + } + var createAssigner_default; + var init_createAssigner = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createAssigner.js"() { + "use strict"; + init_baseRest(); + init_isIterateeCall(); + __name(createAssigner, "createAssigner"); + createAssigner_default = createAssigner; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js + function isPrototype2(value2) { + var Ctor = value2 && value2.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5; + return value2 === proto; + } + var objectProto5, isPrototype_default; + var init_isPrototype2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js"() { + "use strict"; + objectProto5 = Object.prototype; + __name(isPrototype2, "isPrototype"); + isPrototype_default = isPrototype2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js + function baseTimes(n2, iteratee) { + var index = -1, result = Array(n2); + while (++index < n2) { + result[index] = iteratee(index); + } + return result; + } + var baseTimes_default; + var init_baseTimes = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js"() { + "use strict"; + __name(baseTimes, "baseTimes"); + baseTimes_default = baseTimes; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js + function baseIsArguments(value2) { + return isObjectLike_default(value2) && baseGetTag_default(value2) == argsTag; + } + var argsTag, baseIsArguments_default; + var init_baseIsArguments = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js"() { + "use strict"; + init_baseGetTag(); + init_isObjectLike2(); + argsTag = "[object Arguments]"; + __name(baseIsArguments, "baseIsArguments"); + baseIsArguments_default = baseIsArguments; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js + var objectProto6, hasOwnProperty4, propertyIsEnumerable, isArguments2, isArguments_default; + var init_isArguments2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js"() { + "use strict"; + init_baseIsArguments(); + init_isObjectLike2(); + objectProto6 = Object.prototype; + hasOwnProperty4 = objectProto6.hasOwnProperty; + propertyIsEnumerable = objectProto6.propertyIsEnumerable; + isArguments2 = baseIsArguments_default(/* @__PURE__ */ (function() { + return arguments; + })()) ? baseIsArguments_default : function(value2) { + return isObjectLike_default(value2) && hasOwnProperty4.call(value2, "callee") && !propertyIsEnumerable.call(value2, "callee"); + }; + isArguments_default = isArguments2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js + function stubFalse() { + return false; + } + var stubFalse_default; + var init_stubFalse = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js"() { + "use strict"; + __name(stubFalse, "stubFalse"); + stubFalse_default = stubFalse; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js + var freeExports, freeModule, moduleExports, Buffer2, nativeIsBuffer, isBuffer, isBuffer_default; + var init_isBuffer = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js"() { + "use strict"; + init_root(); + init_stubFalse(); + freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; + freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; + moduleExports = freeModule && freeModule.exports === freeExports; + Buffer2 = moduleExports ? root_default.Buffer : void 0; + nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0; + isBuffer = nativeIsBuffer || stubFalse_default; + isBuffer_default = isBuffer; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js + function baseIsTypedArray(value2) { + return isObjectLike_default(value2) && isLength_default(value2.length) && !!typedArrayTags[baseGetTag_default(value2)]; + } + var argsTag2, arrayTag2, boolTag, dateTag2, errorTag, funcTag2, mapTag2, numberTag2, objectTag2, regexpTag2, setTag2, stringTag2, weakMapTag, arrayBufferTag2, dataViewTag2, float32Tag, float64Tag, int8Tag, int16Tag, int32Tag, uint8Tag, uint8ClampedTag, uint16Tag, uint32Tag, typedArrayTags, baseIsTypedArray_default; + var init_baseIsTypedArray = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js"() { + "use strict"; + init_baseGetTag(); + init_isLength2(); + init_isObjectLike2(); + argsTag2 = "[object Arguments]"; + arrayTag2 = "[object Array]"; + boolTag = "[object Boolean]"; + dateTag2 = "[object Date]"; + errorTag = "[object Error]"; + funcTag2 = "[object Function]"; + mapTag2 = "[object Map]"; + numberTag2 = "[object Number]"; + objectTag2 = "[object Object]"; + regexpTag2 = "[object RegExp]"; + setTag2 = "[object Set]"; + stringTag2 = "[object String]"; + weakMapTag = "[object WeakMap]"; + arrayBufferTag2 = "[object ArrayBuffer]"; + dataViewTag2 = "[object DataView]"; + float32Tag = "[object Float32Array]"; + float64Tag = "[object Float64Array]"; + int8Tag = "[object Int8Array]"; + int16Tag = "[object Int16Array]"; + int32Tag = "[object Int32Array]"; + uint8Tag = "[object Uint8Array]"; + uint8ClampedTag = "[object Uint8ClampedArray]"; + uint16Tag = "[object Uint16Array]"; + uint32Tag = "[object Uint32Array]"; + typedArrayTags = {}; + typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; + typedArrayTags[argsTag2] = typedArrayTags[arrayTag2] = typedArrayTags[arrayBufferTag2] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag2] = typedArrayTags[dateTag2] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag2] = typedArrayTags[numberTag2] = typedArrayTags[objectTag2] = typedArrayTags[regexpTag2] = typedArrayTags[setTag2] = typedArrayTags[stringTag2] = typedArrayTags[weakMapTag] = false; + __name(baseIsTypedArray, "baseIsTypedArray"); + baseIsTypedArray_default = baseIsTypedArray; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js + function baseUnary(func) { + return function(value2) { + return func(value2); + }; + } + var baseUnary_default; + var init_baseUnary = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js"() { + "use strict"; + __name(baseUnary, "baseUnary"); + baseUnary_default = baseUnary; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js + var freeExports2, freeModule2, moduleExports2, freeProcess, nodeUtil, nodeUtil_default; + var init_nodeUtil = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js"() { + "use strict"; + init_freeGlobal(); + freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports; + freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module; + moduleExports2 = freeModule2 && freeModule2.exports === freeExports2; + freeProcess = moduleExports2 && freeGlobal_default.process; + nodeUtil = (function() { + try { + var types = freeModule2 && freeModule2.require && freeModule2.require("util").types; + if (types) { + return types; + } + return freeProcess && freeProcess.binding && freeProcess.binding("util"); + } catch (e3) { + } + })(); + nodeUtil_default = nodeUtil; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js + var nodeIsTypedArray, isTypedArray3, isTypedArray_default; + var init_isTypedArray3 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js"() { + "use strict"; + init_baseIsTypedArray(); + init_baseUnary(); + init_nodeUtil(); + nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray; + isTypedArray3 = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default; + isTypedArray_default = isTypedArray3; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js + function arrayLikeKeys(value2, inherited) { + var isArr = isArray_default(value2), isArg = !isArr && isArguments_default(value2), isBuff = !isArr && !isArg && isBuffer_default(value2), isType2 = !isArr && !isArg && !isBuff && isTypedArray_default(value2), skipIndexes = isArr || isArg || isBuff || isType2, result = skipIndexes ? baseTimes_default(value2.length, String) : [], length2 = result.length; + for (var key in value2) { + if ((inherited || hasOwnProperty5.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. + (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType2 && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. + isIndex_default(key, length2)))) { + result.push(key); + } + } + return result; + } + var objectProto7, hasOwnProperty5, arrayLikeKeys_default; + var init_arrayLikeKeys = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js"() { + "use strict"; + init_baseTimes(); + init_isArguments2(); + init_isArray2(); + init_isBuffer(); + init_isIndex(); + init_isTypedArray3(); + objectProto7 = Object.prototype; + hasOwnProperty5 = objectProto7.hasOwnProperty; + __name(arrayLikeKeys, "arrayLikeKeys"); + arrayLikeKeys_default = arrayLikeKeys; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js + function overArg(func, transform8) { + return function(arg) { + return func(transform8(arg)); + }; + } + var overArg_default; + var init_overArg = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js"() { + "use strict"; + __name(overArg, "overArg"); + overArg_default = overArg; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js + var nativeKeys, nativeKeys_default; + var init_nativeKeys = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js"() { + "use strict"; + init_overArg(); + nativeKeys = overArg_default(Object.keys, Object); + nativeKeys_default = nativeKeys; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js + function baseKeys(object3) { + if (!isPrototype_default(object3)) { + return nativeKeys_default(object3); + } + var result = []; + for (var key in Object(object3)) { + if (hasOwnProperty6.call(object3, key) && key != "constructor") { + result.push(key); + } + } + return result; + } + var objectProto8, hasOwnProperty6, baseKeys_default; + var init_baseKeys = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js"() { + "use strict"; + init_isPrototype2(); + init_nativeKeys(); + objectProto8 = Object.prototype; + hasOwnProperty6 = objectProto8.hasOwnProperty; + __name(baseKeys, "baseKeys"); + baseKeys_default = baseKeys; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keys.js + function keys(object3) { + return isArrayLike_default(object3) ? arrayLikeKeys_default(object3) : baseKeys_default(object3); + } + var keys_default; + var init_keys = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keys.js"() { + "use strict"; + init_arrayLikeKeys(); + init_baseKeys(); + init_isArrayLike2(); + __name(keys, "keys"); + keys_default = keys; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js + function nativeKeysIn(object3) { + var result = []; + if (object3 != null) { + for (var key in Object(object3)) { + result.push(key); + } + } + return result; + } + var nativeKeysIn_default; + var init_nativeKeysIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js"() { + "use strict"; + __name(nativeKeysIn, "nativeKeysIn"); + nativeKeysIn_default = nativeKeysIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js + function baseKeysIn(object3) { + if (!isObject_default(object3)) { + return nativeKeysIn_default(object3); + } + var isProto = isPrototype_default(object3), result = []; + for (var key in object3) { + if (!(key == "constructor" && (isProto || !hasOwnProperty7.call(object3, key)))) { + result.push(key); + } + } + return result; + } + var objectProto9, hasOwnProperty7, baseKeysIn_default; + var init_baseKeysIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js"() { + "use strict"; + init_isObject(); + init_isPrototype2(); + init_nativeKeysIn(); + objectProto9 = Object.prototype; + hasOwnProperty7 = objectProto9.hasOwnProperty; + __name(baseKeysIn, "baseKeysIn"); + baseKeysIn_default = baseKeysIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js + function keysIn(object3) { + return isArrayLike_default(object3) ? arrayLikeKeys_default(object3, true) : baseKeysIn_default(object3); + } + var keysIn_default; + var init_keysIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js"() { + "use strict"; + init_arrayLikeKeys(); + init_baseKeysIn(); + init_isArrayLike2(); + __name(keysIn, "keysIn"); + keysIn_default = keysIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js + function isKey(value2, object3) { + if (isArray_default(value2)) { + return false; + } + var type3 = typeof value2; + if (type3 == "number" || type3 == "symbol" || type3 == "boolean" || value2 == null || isSymbol_default(value2)) { + return true; + } + return reIsPlainProp.test(value2) || !reIsDeepProp.test(value2) || object3 != null && value2 in Object(object3); + } + var reIsDeepProp, reIsPlainProp, isKey_default; + var init_isKey = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js"() { + "use strict"; + init_isArray2(); + init_isSymbol(); + reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; + reIsPlainProp = /^\w*$/; + __name(isKey, "isKey"); + isKey_default = isKey; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js + var nativeCreate, nativeCreate_default; + var init_nativeCreate = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js"() { + "use strict"; + init_getNative(); + nativeCreate = getNative_default(Object, "create"); + nativeCreate_default = nativeCreate; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js + function hashClear() { + this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {}; + this.size = 0; + } + var hashClear_default; + var init_hashClear = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js"() { + "use strict"; + init_nativeCreate(); + __name(hashClear, "hashClear"); + hashClear_default = hashClear; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js + function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + var hashDelete_default; + var init_hashDelete = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js"() { + "use strict"; + __name(hashDelete, "hashDelete"); + hashDelete_default = hashDelete; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js + function hashGet(key) { + var data5 = this.__data__; + if (nativeCreate_default) { + var result = data5[key]; + return result === HASH_UNDEFINED ? void 0 : result; + } + return hasOwnProperty8.call(data5, key) ? data5[key] : void 0; + } + var HASH_UNDEFINED, objectProto10, hasOwnProperty8, hashGet_default; + var init_hashGet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js"() { + "use strict"; + init_nativeCreate(); + HASH_UNDEFINED = "__lodash_hash_undefined__"; + objectProto10 = Object.prototype; + hasOwnProperty8 = objectProto10.hasOwnProperty; + __name(hashGet, "hashGet"); + hashGet_default = hashGet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js + function hashHas(key) { + var data5 = this.__data__; + return nativeCreate_default ? data5[key] !== void 0 : hasOwnProperty9.call(data5, key); + } + var objectProto11, hasOwnProperty9, hashHas_default; + var init_hashHas = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js"() { + "use strict"; + init_nativeCreate(); + objectProto11 = Object.prototype; + hasOwnProperty9 = objectProto11.hasOwnProperty; + __name(hashHas, "hashHas"); + hashHas_default = hashHas; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js + function hashSet(key, value2) { + var data5 = this.__data__; + this.size += this.has(key) ? 0 : 1; + data5[key] = nativeCreate_default && value2 === void 0 ? HASH_UNDEFINED2 : value2; + return this; + } + var HASH_UNDEFINED2, hashSet_default; + var init_hashSet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js"() { + "use strict"; + init_nativeCreate(); + HASH_UNDEFINED2 = "__lodash_hash_undefined__"; + __name(hashSet, "hashSet"); + hashSet_default = hashSet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js + function Hash(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + var Hash_default; + var init_Hash = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js"() { + "use strict"; + init_hashClear(); + init_hashDelete(); + init_hashGet(); + init_hashHas(); + init_hashSet(); + __name(Hash, "Hash"); + Hash.prototype.clear = hashClear_default; + Hash.prototype["delete"] = hashDelete_default; + Hash.prototype.get = hashGet_default; + Hash.prototype.has = hashHas_default; + Hash.prototype.set = hashSet_default; + Hash_default = Hash; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js + function listCacheClear() { + this.__data__ = []; + this.size = 0; + } + var listCacheClear_default; + var init_listCacheClear = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js"() { + "use strict"; + __name(listCacheClear, "listCacheClear"); + listCacheClear_default = listCacheClear; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js + function assocIndexOf(array4, key) { + var length2 = array4.length; + while (length2--) { + if (eq_default(array4[length2][0], key)) { + return length2; + } + } + return -1; + } + var assocIndexOf_default; + var init_assocIndexOf = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js"() { + "use strict"; + init_eq(); + __name(assocIndexOf, "assocIndexOf"); + assocIndexOf_default = assocIndexOf; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js + function listCacheDelete(key) { + var data5 = this.__data__, index = assocIndexOf_default(data5, key); + if (index < 0) { + return false; + } + var lastIndex = data5.length - 1; + if (index == lastIndex) { + data5.pop(); + } else { + splice.call(data5, index, 1); + } + --this.size; + return true; + } + var arrayProto, splice, listCacheDelete_default; + var init_listCacheDelete = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js"() { + "use strict"; + init_assocIndexOf(); + arrayProto = Array.prototype; + splice = arrayProto.splice; + __name(listCacheDelete, "listCacheDelete"); + listCacheDelete_default = listCacheDelete; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js + function listCacheGet(key) { + var data5 = this.__data__, index = assocIndexOf_default(data5, key); + return index < 0 ? void 0 : data5[index][1]; + } + var listCacheGet_default; + var init_listCacheGet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js"() { + "use strict"; + init_assocIndexOf(); + __name(listCacheGet, "listCacheGet"); + listCacheGet_default = listCacheGet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js + function listCacheHas(key) { + return assocIndexOf_default(this.__data__, key) > -1; + } + var listCacheHas_default; + var init_listCacheHas = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js"() { + "use strict"; + init_assocIndexOf(); + __name(listCacheHas, "listCacheHas"); + listCacheHas_default = listCacheHas; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js + function listCacheSet(key, value2) { + var data5 = this.__data__, index = assocIndexOf_default(data5, key); + if (index < 0) { + ++this.size; + data5.push([key, value2]); + } else { + data5[index][1] = value2; + } + return this; + } + var listCacheSet_default; + var init_listCacheSet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js"() { + "use strict"; + init_assocIndexOf(); + __name(listCacheSet, "listCacheSet"); + listCacheSet_default = listCacheSet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js + function ListCache(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + var ListCache_default; + var init_ListCache = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js"() { + "use strict"; + init_listCacheClear(); + init_listCacheDelete(); + init_listCacheGet(); + init_listCacheHas(); + init_listCacheSet(); + __name(ListCache, "ListCache"); + ListCache.prototype.clear = listCacheClear_default; + ListCache.prototype["delete"] = listCacheDelete_default; + ListCache.prototype.get = listCacheGet_default; + ListCache.prototype.has = listCacheHas_default; + ListCache.prototype.set = listCacheSet_default; + ListCache_default = ListCache; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Map.js + var Map2, Map_default; + var init_Map = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Map.js"() { + "use strict"; + init_getNative(); + init_root(); + Map2 = getNative_default(root_default, "Map"); + Map_default = Map2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js + function mapCacheClear() { + this.size = 0; + this.__data__ = { + "hash": new Hash_default(), + "map": new (Map_default || ListCache_default)(), + "string": new Hash_default() + }; + } + var mapCacheClear_default; + var init_mapCacheClear = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js"() { + "use strict"; + init_Hash(); + init_ListCache(); + init_Map(); + __name(mapCacheClear, "mapCacheClear"); + mapCacheClear_default = mapCacheClear; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js + function isKeyable(value2) { + var type3 = typeof value2; + return type3 == "string" || type3 == "number" || type3 == "symbol" || type3 == "boolean" ? value2 !== "__proto__" : value2 === null; + } + var isKeyable_default; + var init_isKeyable = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js"() { + "use strict"; + __name(isKeyable, "isKeyable"); + isKeyable_default = isKeyable; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js + function getMapData(map6, key) { + var data5 = map6.__data__; + return isKeyable_default(key) ? data5[typeof key == "string" ? "string" : "hash"] : data5.map; + } + var getMapData_default; + var init_getMapData = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js"() { + "use strict"; + init_isKeyable(); + __name(getMapData, "getMapData"); + getMapData_default = getMapData; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js + function mapCacheDelete(key) { + var result = getMapData_default(this, key)["delete"](key); + this.size -= result ? 1 : 0; + return result; + } + var mapCacheDelete_default; + var init_mapCacheDelete = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js"() { + "use strict"; + init_getMapData(); + __name(mapCacheDelete, "mapCacheDelete"); + mapCacheDelete_default = mapCacheDelete; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js + function mapCacheGet(key) { + return getMapData_default(this, key).get(key); + } + var mapCacheGet_default; + var init_mapCacheGet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js"() { + "use strict"; + init_getMapData(); + __name(mapCacheGet, "mapCacheGet"); + mapCacheGet_default = mapCacheGet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js + function mapCacheHas(key) { + return getMapData_default(this, key).has(key); + } + var mapCacheHas_default; + var init_mapCacheHas = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js"() { + "use strict"; + init_getMapData(); + __name(mapCacheHas, "mapCacheHas"); + mapCacheHas_default = mapCacheHas; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js + function mapCacheSet(key, value2) { + var data5 = getMapData_default(this, key), size4 = data5.size; + data5.set(key, value2); + this.size += data5.size == size4 ? 0 : 1; + return this; + } + var mapCacheSet_default; + var init_mapCacheSet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js"() { + "use strict"; + init_getMapData(); + __name(mapCacheSet, "mapCacheSet"); + mapCacheSet_default = mapCacheSet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js + function MapCache(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + var MapCache_default; + var init_MapCache = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js"() { + "use strict"; + init_mapCacheClear(); + init_mapCacheDelete(); + init_mapCacheGet(); + init_mapCacheHas(); + init_mapCacheSet(); + __name(MapCache, "MapCache"); + MapCache.prototype.clear = mapCacheClear_default; + MapCache.prototype["delete"] = mapCacheDelete_default; + MapCache.prototype.get = mapCacheGet_default; + MapCache.prototype.has = mapCacheHas_default; + MapCache.prototype.set = mapCacheSet_default; + MapCache_default = MapCache; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/memoize.js + function memoize2(func, resolver3) { + if (typeof func != "function" || resolver3 != null && typeof resolver3 != "function") { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = /* @__PURE__ */ __name(function() { + var args = arguments, key = resolver3 ? resolver3.apply(this, args) : args[0], cache3 = memoized.cache; + if (cache3.has(key)) { + return cache3.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache3.set(key, result) || cache3; + return result; + }, "memoized"); + memoized.cache = new (memoize2.Cache || MapCache_default)(); + return memoized; + } + var FUNC_ERROR_TEXT, memoize_default; + var init_memoize2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/memoize.js"() { + "use strict"; + init_MapCache(); + FUNC_ERROR_TEXT = "Expected a function"; + __name(memoize2, "memoize"); + memoize2.Cache = MapCache_default; + memoize_default = memoize2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js + function memoizeCapped(func) { + var result = memoize_default(func, function(key) { + if (cache3.size === MAX_MEMOIZE_SIZE) { + cache3.clear(); + } + return key; + }); + var cache3 = result.cache; + return result; + } + var MAX_MEMOIZE_SIZE, memoizeCapped_default; + var init_memoizeCapped = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js"() { + "use strict"; + init_memoize2(); + MAX_MEMOIZE_SIZE = 500; + __name(memoizeCapped, "memoizeCapped"); + memoizeCapped_default = memoizeCapped; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js + var rePropName, reEscapeChar, stringToPath, stringToPath_default; + var init_stringToPath = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js"() { + "use strict"; + init_memoizeCapped(); + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + reEscapeChar = /\\(\\)?/g; + stringToPath = memoizeCapped_default(function(string3) { + var result = []; + if (string3.charCodeAt(0) === 46) { + result.push(""); + } + string3.replace(rePropName, function(match3, number7, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar, "$1") : number7 || match3); + }); + return result; + }); + stringToPath_default = stringToPath; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toString.js + function toString2(value2) { + return value2 == null ? "" : baseToString_default(value2); + } + var toString_default; + var init_toString = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toString.js"() { + "use strict"; + init_baseToString(); + __name(toString2, "toString"); + toString_default = toString2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js + function castPath(value2, object3) { + if (isArray_default(value2)) { + return value2; + } + return isKey_default(value2, object3) ? [value2] : stringToPath_default(toString_default(value2)); + } + var castPath_default; + var init_castPath = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js"() { + "use strict"; + init_isArray2(); + init_isKey(); + init_stringToPath(); + init_toString(); + __name(castPath, "castPath"); + castPath_default = castPath; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js + function toKey(value2) { + if (typeof value2 == "string" || isSymbol_default(value2)) { + return value2; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -INFINITY3 ? "-0" : result; + } + var INFINITY3, toKey_default; + var init_toKey = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js"() { + "use strict"; + init_isSymbol(); + INFINITY3 = 1 / 0; + __name(toKey, "toKey"); + toKey_default = toKey; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js + function baseGet(object3, path4) { + path4 = castPath_default(path4, object3); + var index = 0, length2 = path4.length; + while (object3 != null && index < length2) { + object3 = object3[toKey_default(path4[index++])]; + } + return index && index == length2 ? object3 : void 0; + } + var baseGet_default; + var init_baseGet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js"() { + "use strict"; + init_castPath(); + init_toKey(); + __name(baseGet, "baseGet"); + baseGet_default = baseGet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/get.js + function get3(object3, path4, defaultValue) { + var result = object3 == null ? void 0 : baseGet_default(object3, path4); + return result === void 0 ? defaultValue : result; + } + var get_default; + var init_get = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/get.js"() { + "use strict"; + init_baseGet(); + __name(get3, "get"); + get_default = get3; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js + function arrayPush2(array4, values3) { + var index = -1, length2 = values3.length, offset = array4.length; + while (++index < length2) { + array4[offset + index] = values3[index]; + } + return array4; + } + var arrayPush_default; + var init_arrayPush = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js"() { + "use strict"; + __name(arrayPush2, "arrayPush"); + arrayPush_default = arrayPush2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isFlattenable.js + function isFlattenable(value2) { + return isArray_default(value2) || isArguments_default(value2) || !!(spreadableSymbol && value2 && value2[spreadableSymbol]); + } + var spreadableSymbol, isFlattenable_default; + var init_isFlattenable = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isFlattenable.js"() { + "use strict"; + init_Symbol(); + init_isArguments2(); + init_isArray2(); + spreadableSymbol = Symbol_default ? Symbol_default.isConcatSpreadable : void 0; + __name(isFlattenable, "isFlattenable"); + isFlattenable_default = isFlattenable; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFlatten.js + function baseFlatten(array4, depth, predicate, isStrict, result) { + var index = -1, length2 = array4.length; + predicate || (predicate = isFlattenable_default); + result || (result = []); + while (++index < length2) { + var value2 = array4[index]; + if (depth > 0 && predicate(value2)) { + if (depth > 1) { + baseFlatten(value2, depth - 1, predicate, isStrict, result); + } else { + arrayPush_default(result, value2); + } + } else if (!isStrict) { + result[result.length] = value2; + } + } + return result; + } + var baseFlatten_default; + var init_baseFlatten = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFlatten.js"() { + "use strict"; + init_arrayPush(); + init_isFlattenable(); + __name(baseFlatten, "baseFlatten"); + baseFlatten_default = baseFlatten; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/flatten.js + function flatten(array4) { + var length2 = array4 == null ? 0 : array4.length; + return length2 ? baseFlatten_default(array4, 1) : []; + } + var flatten_default; + var init_flatten = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/flatten.js"() { + "use strict"; + init_baseFlatten(); + __name(flatten, "flatten"); + flatten_default = flatten; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_flatRest.js + function flatRest(func) { + return setToString_default(overRest_default(func, void 0, flatten_default), func + ""); + } + var flatRest_default; + var init_flatRest = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_flatRest.js"() { + "use strict"; + init_flatten(); + init_overRest(); + init_setToString(); + __name(flatRest, "flatRest"); + flatRest_default = flatRest; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js + var getPrototype, getPrototype_default; + var init_getPrototype = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js"() { + "use strict"; + init_overArg(); + getPrototype = overArg_default(Object.getPrototypeOf, Object); + getPrototype_default = getPrototype; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isPlainObject.js + function isPlainObject2(value2) { + if (!isObjectLike_default(value2) || baseGetTag_default(value2) != objectTag3) { + return false; + } + var proto = getPrototype_default(value2); + if (proto === null) { + return true; + } + var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor; + return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString; + } + var objectTag3, funcProto3, objectProto12, funcToString3, hasOwnProperty10, objectCtorString, isPlainObject_default; + var init_isPlainObject2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isPlainObject.js"() { + "use strict"; + init_baseGetTag(); + init_getPrototype(); + init_isObjectLike2(); + objectTag3 = "[object Object]"; + funcProto3 = Function.prototype; + objectProto12 = Object.prototype; + funcToString3 = funcProto3.toString; + hasOwnProperty10 = objectProto12.hasOwnProperty; + objectCtorString = funcToString3.call(Object); + __name(isPlainObject2, "isPlainObject"); + isPlainObject_default = isPlainObject2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hasUnicode.js + function hasUnicode(string3) { + return reHasUnicode.test(string3); + } + var rsAstralRange, rsComboMarksRange, reComboHalfMarksRange, rsComboSymbolsRange, rsComboRange, rsVarRange, rsZWJ, reHasUnicode, hasUnicode_default; + var init_hasUnicode = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hasUnicode.js"() { + "use strict"; + rsAstralRange = "\\ud800-\\udfff"; + rsComboMarksRange = "\\u0300-\\u036f"; + reComboHalfMarksRange = "\\ufe20-\\ufe2f"; + rsComboSymbolsRange = "\\u20d0-\\u20ff"; + rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; + rsVarRange = "\\ufe0e\\ufe0f"; + rsZWJ = "\\u200d"; + reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]"); + __name(hasUnicode, "hasUnicode"); + hasUnicode_default = hasUnicode; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayReduce.js + function arrayReduce(array4, iteratee, accumulator, initAccum) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + if (initAccum && length2) { + accumulator = array4[++index]; + } + while (++index < length2) { + accumulator = iteratee(accumulator, array4[index], index, array4); + } + return accumulator; + } + var arrayReduce_default; + var init_arrayReduce = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayReduce.js"() { + "use strict"; + __name(arrayReduce, "arrayReduce"); + arrayReduce_default = arrayReduce; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js + function stackClear() { + this.__data__ = new ListCache_default(); + this.size = 0; + } + var stackClear_default; + var init_stackClear = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js"() { + "use strict"; + init_ListCache(); + __name(stackClear, "stackClear"); + stackClear_default = stackClear; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js + function stackDelete(key) { + var data5 = this.__data__, result = data5["delete"](key); + this.size = data5.size; + return result; + } + var stackDelete_default; + var init_stackDelete = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js"() { + "use strict"; + __name(stackDelete, "stackDelete"); + stackDelete_default = stackDelete; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js + function stackGet(key) { + return this.__data__.get(key); + } + var stackGet_default; + var init_stackGet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js"() { + "use strict"; + __name(stackGet, "stackGet"); + stackGet_default = stackGet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js + function stackHas(key) { + return this.__data__.has(key); + } + var stackHas_default; + var init_stackHas = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js"() { + "use strict"; + __name(stackHas, "stackHas"); + stackHas_default = stackHas; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js + function stackSet(key, value2) { + var data5 = this.__data__; + if (data5 instanceof ListCache_default) { + var pairs2 = data5.__data__; + if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) { + pairs2.push([key, value2]); + this.size = ++data5.size; + return this; + } + data5 = this.__data__ = new MapCache_default(pairs2); + } + data5.set(key, value2); + this.size = data5.size; + return this; + } + var LARGE_ARRAY_SIZE, stackSet_default; + var init_stackSet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js"() { + "use strict"; + init_ListCache(); + init_Map(); + init_MapCache(); + LARGE_ARRAY_SIZE = 200; + __name(stackSet, "stackSet"); + stackSet_default = stackSet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js + function Stack(entries2) { + var data5 = this.__data__ = new ListCache_default(entries2); + this.size = data5.size; + } + var Stack_default; + var init_Stack = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js"() { + "use strict"; + init_ListCache(); + init_stackClear(); + init_stackDelete(); + init_stackGet(); + init_stackHas(); + init_stackSet(); + __name(Stack, "Stack"); + Stack.prototype.clear = stackClear_default; + Stack.prototype["delete"] = stackDelete_default; + Stack.prototype.get = stackGet_default; + Stack.prototype.has = stackHas_default; + Stack.prototype.set = stackSet_default; + Stack_default = Stack; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js + function baseAssign(object3, source) { + return object3 && copyObject_default(source, keys_default(source), object3); + } + var baseAssign_default; + var init_baseAssign = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js"() { + "use strict"; + init_copyObject(); + init_keys(); + __name(baseAssign, "baseAssign"); + baseAssign_default = baseAssign; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js + function baseAssignIn(object3, source) { + return object3 && copyObject_default(source, keysIn_default(source), object3); + } + var baseAssignIn_default; + var init_baseAssignIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js"() { + "use strict"; + init_copyObject(); + init_keysIn(); + __name(baseAssignIn, "baseAssignIn"); + baseAssignIn_default = baseAssignIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js + function cloneBuffer(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2); + buffer.copy(result); + return result; + } + var freeExports3, freeModule3, moduleExports3, Buffer3, allocUnsafe, cloneBuffer_default; + var init_cloneBuffer = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js"() { + "use strict"; + init_root(); + freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports; + freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module; + moduleExports3 = freeModule3 && freeModule3.exports === freeExports3; + Buffer3 = moduleExports3 ? root_default.Buffer : void 0; + allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : void 0; + __name(cloneBuffer, "cloneBuffer"); + cloneBuffer_default = cloneBuffer; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js + function arrayFilter(array4, predicate) { + var index = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = []; + while (++index < length2) { + var value2 = array4[index]; + if (predicate(value2, index, array4)) { + result[resIndex++] = value2; + } + } + return result; + } + var arrayFilter_default; + var init_arrayFilter = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js"() { + "use strict"; + __name(arrayFilter, "arrayFilter"); + arrayFilter_default = arrayFilter; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js + function stubArray() { + return []; + } + var stubArray_default; + var init_stubArray = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js"() { + "use strict"; + __name(stubArray, "stubArray"); + stubArray_default = stubArray; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js + var objectProto13, propertyIsEnumerable2, nativeGetSymbols, getSymbols2, getSymbols_default; + var init_getSymbols2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js"() { + "use strict"; + init_arrayFilter(); + init_stubArray(); + objectProto13 = Object.prototype; + propertyIsEnumerable2 = objectProto13.propertyIsEnumerable; + nativeGetSymbols = Object.getOwnPropertySymbols; + getSymbols2 = !nativeGetSymbols ? stubArray_default : function(object3) { + if (object3 == null) { + return []; + } + object3 = Object(object3); + return arrayFilter_default(nativeGetSymbols(object3), function(symbol) { + return propertyIsEnumerable2.call(object3, symbol); + }); + }; + getSymbols_default = getSymbols2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js + function copySymbols(source, object3) { + return copyObject_default(source, getSymbols_default(source), object3); + } + var copySymbols_default; + var init_copySymbols = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js"() { + "use strict"; + init_copyObject(); + init_getSymbols2(); + __name(copySymbols, "copySymbols"); + copySymbols_default = copySymbols; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js + var nativeGetSymbols2, getSymbolsIn, getSymbolsIn_default; + var init_getSymbolsIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js"() { + "use strict"; + init_arrayPush(); + init_getPrototype(); + init_getSymbols2(); + init_stubArray(); + nativeGetSymbols2 = Object.getOwnPropertySymbols; + getSymbolsIn = !nativeGetSymbols2 ? stubArray_default : function(object3) { + var result = []; + while (object3) { + arrayPush_default(result, getSymbols_default(object3)); + object3 = getPrototype_default(object3); + } + return result; + }; + getSymbolsIn_default = getSymbolsIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js + function copySymbolsIn(source, object3) { + return copyObject_default(source, getSymbolsIn_default(source), object3); + } + var copySymbolsIn_default; + var init_copySymbolsIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js"() { + "use strict"; + init_copyObject(); + init_getSymbolsIn(); + __name(copySymbolsIn, "copySymbolsIn"); + copySymbolsIn_default = copySymbolsIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js + function baseGetAllKeys(object3, keysFunc, symbolsFunc) { + var result = keysFunc(object3); + return isArray_default(object3) ? result : arrayPush_default(result, symbolsFunc(object3)); + } + var baseGetAllKeys_default; + var init_baseGetAllKeys = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js"() { + "use strict"; + init_arrayPush(); + init_isArray2(); + __name(baseGetAllKeys, "baseGetAllKeys"); + baseGetAllKeys_default = baseGetAllKeys; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js + function getAllKeys(object3) { + return baseGetAllKeys_default(object3, keys_default, getSymbols_default); + } + var getAllKeys_default; + var init_getAllKeys = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js"() { + "use strict"; + init_baseGetAllKeys(); + init_getSymbols2(); + init_keys(); + __name(getAllKeys, "getAllKeys"); + getAllKeys_default = getAllKeys; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js + function getAllKeysIn(object3) { + return baseGetAllKeys_default(object3, keysIn_default, getSymbolsIn_default); + } + var getAllKeysIn_default; + var init_getAllKeysIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js"() { + "use strict"; + init_baseGetAllKeys(); + init_getSymbolsIn(); + init_keysIn(); + __name(getAllKeysIn, "getAllKeysIn"); + getAllKeysIn_default = getAllKeysIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js + var DataView2, DataView_default; + var init_DataView = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js"() { + "use strict"; + init_getNative(); + init_root(); + DataView2 = getNative_default(root_default, "DataView"); + DataView_default = DataView2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js + var Promise2, Promise_default; + var init_Promise = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js"() { + "use strict"; + init_getNative(); + init_root(); + Promise2 = getNative_default(root_default, "Promise"); + Promise_default = Promise2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Set.js + var Set2, Set_default; + var init_Set = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Set.js"() { + "use strict"; + init_getNative(); + init_root(); + Set2 = getNative_default(root_default, "Set"); + Set_default = Set2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js + var mapTag3, objectTag4, promiseTag, setTag3, weakMapTag2, dataViewTag3, dataViewCtorString, mapCtorString, promiseCtorString, setCtorString, weakMapCtorString, getTag2, getTag_default; + var init_getTag2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js"() { + "use strict"; + init_DataView(); + init_Map(); + init_Promise(); + init_Set(); + init_WeakMap(); + init_baseGetTag(); + init_toSource(); + mapTag3 = "[object Map]"; + objectTag4 = "[object Object]"; + promiseTag = "[object Promise]"; + setTag3 = "[object Set]"; + weakMapTag2 = "[object WeakMap]"; + dataViewTag3 = "[object DataView]"; + dataViewCtorString = toSource_default(DataView_default); + mapCtorString = toSource_default(Map_default); + promiseCtorString = toSource_default(Promise_default); + setCtorString = toSource_default(Set_default); + weakMapCtorString = toSource_default(WeakMap_default); + getTag2 = baseGetTag_default; + if (DataView_default && getTag2(new DataView_default(new ArrayBuffer(1))) != dataViewTag3 || Map_default && getTag2(new Map_default()) != mapTag3 || Promise_default && getTag2(Promise_default.resolve()) != promiseTag || Set_default && getTag2(new Set_default()) != setTag3 || WeakMap_default && getTag2(new WeakMap_default()) != weakMapTag2) { + getTag2 = /* @__PURE__ */ __name(function(value2) { + var result = baseGetTag_default(value2), Ctor = result == objectTag4 ? value2.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : ""; + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: + return dataViewTag3; + case mapCtorString: + return mapTag3; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag3; + case weakMapCtorString: + return weakMapTag2; + } + } + return result; + }, "getTag"); + } + getTag_default = getTag2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js + function initCloneArray(array4) { + var length2 = array4.length, result = new array4.constructor(length2); + if (length2 && typeof array4[0] == "string" && hasOwnProperty11.call(array4, "index")) { + result.index = array4.index; + result.input = array4.input; + } + return result; + } + var objectProto14, hasOwnProperty11, initCloneArray_default; + var init_initCloneArray = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js"() { + "use strict"; + objectProto14 = Object.prototype; + hasOwnProperty11 = objectProto14.hasOwnProperty; + __name(initCloneArray, "initCloneArray"); + initCloneArray_default = initCloneArray; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js + var Uint8Array2, Uint8Array_default; + var init_Uint8Array = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js"() { + "use strict"; + init_root(); + Uint8Array2 = root_default.Uint8Array; + Uint8Array_default = Uint8Array2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js + function cloneArrayBuffer(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer)); + return result; + } + var cloneArrayBuffer_default; + var init_cloneArrayBuffer = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js"() { + "use strict"; + init_Uint8Array(); + __name(cloneArrayBuffer, "cloneArrayBuffer"); + cloneArrayBuffer_default = cloneArrayBuffer; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js + function cloneDataView(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer_default(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + var cloneDataView_default; + var init_cloneDataView = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js"() { + "use strict"; + init_cloneArrayBuffer(); + __name(cloneDataView, "cloneDataView"); + cloneDataView_default = cloneDataView; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js + function cloneRegExp(regexp) { + var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; + } + var reFlags, cloneRegExp_default; + var init_cloneRegExp = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js"() { + "use strict"; + reFlags = /\w*$/; + __name(cloneRegExp, "cloneRegExp"); + cloneRegExp_default = cloneRegExp; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js + function cloneSymbol(symbol) { + return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; + } + var symbolProto2, symbolValueOf, cloneSymbol_default; + var init_cloneSymbol = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js"() { + "use strict"; + init_Symbol(); + symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0; + symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0; + __name(cloneSymbol, "cloneSymbol"); + cloneSymbol_default = cloneSymbol; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js + function cloneTypedArray(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + } + var cloneTypedArray_default; + var init_cloneTypedArray = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js"() { + "use strict"; + init_cloneArrayBuffer(); + __name(cloneTypedArray, "cloneTypedArray"); + cloneTypedArray_default = cloneTypedArray; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js + function initCloneByTag(object3, tag, isDeep) { + var Ctor = object3.constructor; + switch (tag) { + case arrayBufferTag3: + return cloneArrayBuffer_default(object3); + case boolTag2: + case dateTag3: + return new Ctor(+object3); + case dataViewTag4: + return cloneDataView_default(object3, isDeep); + case float32Tag2: + case float64Tag2: + case int8Tag2: + case int16Tag2: + case int32Tag2: + case uint8Tag2: + case uint8ClampedTag2: + case uint16Tag2: + case uint32Tag2: + return cloneTypedArray_default(object3, isDeep); + case mapTag4: + return new Ctor(); + case numberTag3: + case stringTag3: + return new Ctor(object3); + case regexpTag3: + return cloneRegExp_default(object3); + case setTag4: + return new Ctor(); + case symbolTag3: + return cloneSymbol_default(object3); + } + } + var boolTag2, dateTag3, mapTag4, numberTag3, regexpTag3, setTag4, stringTag3, symbolTag3, arrayBufferTag3, dataViewTag4, float32Tag2, float64Tag2, int8Tag2, int16Tag2, int32Tag2, uint8Tag2, uint8ClampedTag2, uint16Tag2, uint32Tag2, initCloneByTag_default; + var init_initCloneByTag = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js"() { + "use strict"; + init_cloneArrayBuffer(); + init_cloneDataView(); + init_cloneRegExp(); + init_cloneSymbol(); + init_cloneTypedArray(); + boolTag2 = "[object Boolean]"; + dateTag3 = "[object Date]"; + mapTag4 = "[object Map]"; + numberTag3 = "[object Number]"; + regexpTag3 = "[object RegExp]"; + setTag4 = "[object Set]"; + stringTag3 = "[object String]"; + symbolTag3 = "[object Symbol]"; + arrayBufferTag3 = "[object ArrayBuffer]"; + dataViewTag4 = "[object DataView]"; + float32Tag2 = "[object Float32Array]"; + float64Tag2 = "[object Float64Array]"; + int8Tag2 = "[object Int8Array]"; + int16Tag2 = "[object Int16Array]"; + int32Tag2 = "[object Int32Array]"; + uint8Tag2 = "[object Uint8Array]"; + uint8ClampedTag2 = "[object Uint8ClampedArray]"; + uint16Tag2 = "[object Uint16Array]"; + uint32Tag2 = "[object Uint32Array]"; + __name(initCloneByTag, "initCloneByTag"); + initCloneByTag_default = initCloneByTag; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js + function initCloneObject(object3) { + return typeof object3.constructor == "function" && !isPrototype_default(object3) ? baseCreate_default(getPrototype_default(object3)) : {}; + } + var initCloneObject_default; + var init_initCloneObject = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js"() { + "use strict"; + init_baseCreate(); + init_getPrototype(); + init_isPrototype2(); + __name(initCloneObject, "initCloneObject"); + initCloneObject_default = initCloneObject; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js + function baseIsMap(value2) { + return isObjectLike_default(value2) && getTag_default(value2) == mapTag5; + } + var mapTag5, baseIsMap_default; + var init_baseIsMap = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js"() { + "use strict"; + init_getTag2(); + init_isObjectLike2(); + mapTag5 = "[object Map]"; + __name(baseIsMap, "baseIsMap"); + baseIsMap_default = baseIsMap; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isMap.js + var nodeIsMap, isMap, isMap_default; + var init_isMap = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isMap.js"() { + "use strict"; + init_baseIsMap(); + init_baseUnary(); + init_nodeUtil(); + nodeIsMap = nodeUtil_default && nodeUtil_default.isMap; + isMap = nodeIsMap ? baseUnary_default(nodeIsMap) : baseIsMap_default; + isMap_default = isMap; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js + function baseIsSet(value2) { + return isObjectLike_default(value2) && getTag_default(value2) == setTag5; + } + var setTag5, baseIsSet_default; + var init_baseIsSet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js"() { + "use strict"; + init_getTag2(); + init_isObjectLike2(); + setTag5 = "[object Set]"; + __name(baseIsSet, "baseIsSet"); + baseIsSet_default = baseIsSet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSet.js + var nodeIsSet, isSet, isSet_default; + var init_isSet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSet.js"() { + "use strict"; + init_baseIsSet(); + init_baseUnary(); + init_nodeUtil(); + nodeIsSet = nodeUtil_default && nodeUtil_default.isSet; + isSet = nodeIsSet ? baseUnary_default(nodeIsSet) : baseIsSet_default; + isSet_default = isSet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js + function baseClone(value2, bitmask, customizer, key, object3, stack) { + var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; + if (customizer) { + result = object3 ? customizer(value2, key, object3, stack) : customizer(value2); + } + if (result !== void 0) { + return result; + } + if (!isObject_default(value2)) { + return value2; + } + var isArr = isArray_default(value2); + if (isArr) { + result = initCloneArray_default(value2); + if (!isDeep) { + return copyArray_default(value2, result); + } + } else { + var tag = getTag_default(value2), isFunc = tag == funcTag3 || tag == genTag2; + if (isBuffer_default(value2)) { + return cloneBuffer_default(value2, isDeep); + } + if (tag == objectTag5 || tag == argsTag3 || isFunc && !object3) { + result = isFlat || isFunc ? {} : initCloneObject_default(value2); + if (!isDeep) { + return isFlat ? copySymbolsIn_default(value2, baseAssignIn_default(result, value2)) : copySymbols_default(value2, baseAssign_default(result, value2)); + } + } else { + if (!cloneableTags[tag]) { + return object3 ? value2 : {}; + } + result = initCloneByTag_default(value2, tag, isDeep); + } + } + stack || (stack = new Stack_default()); + var stacked = stack.get(value2); + if (stacked) { + return stacked; + } + stack.set(value2, result); + if (isSet_default(value2)) { + value2.forEach(function(subValue) { + result.add(baseClone(subValue, bitmask, customizer, subValue, value2, stack)); + }); + } else if (isMap_default(value2)) { + value2.forEach(function(subValue, key2) { + result.set(key2, baseClone(subValue, bitmask, customizer, key2, value2, stack)); + }); + } + var keysFunc = isFull ? isFlat ? getAllKeysIn_default : getAllKeys_default : isFlat ? keysIn_default : keys_default; + var props = isArr ? void 0 : keysFunc(value2); + arrayEach_default(props || value2, function(subValue, key2) { + if (props) { + key2 = subValue; + subValue = value2[key2]; + } + assignValue_default(result, key2, baseClone(subValue, bitmask, customizer, key2, value2, stack)); + }); + return result; + } + var CLONE_DEEP_FLAG, CLONE_FLAT_FLAG, CLONE_SYMBOLS_FLAG, argsTag3, arrayTag3, boolTag3, dateTag4, errorTag2, funcTag3, genTag2, mapTag6, numberTag4, objectTag5, regexpTag4, setTag6, stringTag4, symbolTag4, weakMapTag3, arrayBufferTag4, dataViewTag5, float32Tag3, float64Tag3, int8Tag3, int16Tag3, int32Tag3, uint8Tag3, uint8ClampedTag3, uint16Tag3, uint32Tag3, cloneableTags, baseClone_default; + var init_baseClone = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js"() { + "use strict"; + init_Stack(); + init_arrayEach(); + init_assignValue(); + init_baseAssign(); + init_baseAssignIn(); + init_cloneBuffer(); + init_copyArray(); + init_copySymbols(); + init_copySymbolsIn(); + init_getAllKeys(); + init_getAllKeysIn(); + init_getTag2(); + init_initCloneArray(); + init_initCloneByTag(); + init_initCloneObject(); + init_isArray2(); + init_isBuffer(); + init_isMap(); + init_isObject(); + init_isSet(); + init_keys(); + init_keysIn(); + CLONE_DEEP_FLAG = 1; + CLONE_FLAT_FLAG = 2; + CLONE_SYMBOLS_FLAG = 4; + argsTag3 = "[object Arguments]"; + arrayTag3 = "[object Array]"; + boolTag3 = "[object Boolean]"; + dateTag4 = "[object Date]"; + errorTag2 = "[object Error]"; + funcTag3 = "[object Function]"; + genTag2 = "[object GeneratorFunction]"; + mapTag6 = "[object Map]"; + numberTag4 = "[object Number]"; + objectTag5 = "[object Object]"; + regexpTag4 = "[object RegExp]"; + setTag6 = "[object Set]"; + stringTag4 = "[object String]"; + symbolTag4 = "[object Symbol]"; + weakMapTag3 = "[object WeakMap]"; + arrayBufferTag4 = "[object ArrayBuffer]"; + dataViewTag5 = "[object DataView]"; + float32Tag3 = "[object Float32Array]"; + float64Tag3 = "[object Float64Array]"; + int8Tag3 = "[object Int8Array]"; + int16Tag3 = "[object Int16Array]"; + int32Tag3 = "[object Int32Array]"; + uint8Tag3 = "[object Uint8Array]"; + uint8ClampedTag3 = "[object Uint8ClampedArray]"; + uint16Tag3 = "[object Uint16Array]"; + uint32Tag3 = "[object Uint32Array]"; + cloneableTags = {}; + cloneableTags[argsTag3] = cloneableTags[arrayTag3] = cloneableTags[arrayBufferTag4] = cloneableTags[dataViewTag5] = cloneableTags[boolTag3] = cloneableTags[dateTag4] = cloneableTags[float32Tag3] = cloneableTags[float64Tag3] = cloneableTags[int8Tag3] = cloneableTags[int16Tag3] = cloneableTags[int32Tag3] = cloneableTags[mapTag6] = cloneableTags[numberTag4] = cloneableTags[objectTag5] = cloneableTags[regexpTag4] = cloneableTags[setTag6] = cloneableTags[stringTag4] = cloneableTags[symbolTag4] = cloneableTags[uint8Tag3] = cloneableTags[uint8ClampedTag3] = cloneableTags[uint16Tag3] = cloneableTags[uint32Tag3] = true; + cloneableTags[errorTag2] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false; + __name(baseClone, "baseClone"); + baseClone_default = baseClone; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/clone.js + function clone4(value2) { + return baseClone_default(value2, CLONE_SYMBOLS_FLAG2); + } + var CLONE_SYMBOLS_FLAG2, clone_default2; + var init_clone4 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/clone.js"() { + "use strict"; + init_baseClone(); + CLONE_SYMBOLS_FLAG2 = 4; + __name(clone4, "clone"); + clone_default2 = clone4; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js + function cloneDeep2(value2) { + return baseClone_default(value2, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG3); + } + var CLONE_DEEP_FLAG2, CLONE_SYMBOLS_FLAG3, cloneDeep_default; + var init_cloneDeep2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js"() { + "use strict"; + init_baseClone(); + CLONE_DEEP_FLAG2 = 1; + CLONE_SYMBOLS_FLAG3 = 4; + __name(cloneDeep2, "cloneDeep"); + cloneDeep_default = cloneDeep2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js + function setCacheAdd(value2) { + this.__data__.set(value2, HASH_UNDEFINED3); + return this; + } + var HASH_UNDEFINED3, setCacheAdd_default; + var init_setCacheAdd = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js"() { + "use strict"; + HASH_UNDEFINED3 = "__lodash_hash_undefined__"; + __name(setCacheAdd, "setCacheAdd"); + setCacheAdd_default = setCacheAdd; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js + function setCacheHas(value2) { + return this.__data__.has(value2); + } + var setCacheHas_default; + var init_setCacheHas = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js"() { + "use strict"; + __name(setCacheHas, "setCacheHas"); + setCacheHas_default = setCacheHas; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js + function SetCache(values3) { + var index = -1, length2 = values3 == null ? 0 : values3.length; + this.__data__ = new MapCache_default(); + while (++index < length2) { + this.add(values3[index]); + } + } + var SetCache_default; + var init_SetCache = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js"() { + "use strict"; + init_MapCache(); + init_setCacheAdd(); + init_setCacheHas(); + __name(SetCache, "SetCache"); + SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default; + SetCache.prototype.has = setCacheHas_default; + SetCache_default = SetCache; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js + function arraySome(array4, predicate) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (predicate(array4[index], index, array4)) { + return true; + } + } + return false; + } + var arraySome_default; + var init_arraySome = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js"() { + "use strict"; + __name(arraySome, "arraySome"); + arraySome_default = arraySome; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js + function cacheHas(cache3, key) { + return cache3.has(key); + } + var cacheHas_default; + var init_cacheHas = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js"() { + "use strict"; + __name(cacheHas, "cacheHas"); + cacheHas_default = cacheHas; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js + function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array4.length, othLength = other.length; + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + var arrStacked = stack.get(array4); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array4; + } + var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0; + stack.set(array4, other); + stack.set(other, array4); + while (++index < arrLength) { + var arrValue = array4[index], othValue = other[index]; + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack) : customizer(arrValue, othValue, index, array4, other, stack); + } + if (compared !== void 0) { + if (compared) { + continue; + } + result = false; + break; + } + if (seen) { + if (!arraySome_default(other, function(othValue2, othIndex) { + if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + result = false; + break; + } + } + stack["delete"](array4); + stack["delete"](other); + return result; + } + var COMPARE_PARTIAL_FLAG, COMPARE_UNORDERED_FLAG, equalArrays_default; + var init_equalArrays = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js"() { + "use strict"; + init_SetCache(); + init_arraySome(); + init_cacheHas(); + COMPARE_PARTIAL_FLAG = 1; + COMPARE_UNORDERED_FLAG = 2; + __name(equalArrays, "equalArrays"); + equalArrays_default = equalArrays; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js + function mapToArray(map6) { + var index = -1, result = Array(map6.size); + map6.forEach(function(value2, key) { + result[++index] = [key, value2]; + }); + return result; + } + var mapToArray_default; + var init_mapToArray = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js"() { + "use strict"; + __name(mapToArray, "mapToArray"); + mapToArray_default = mapToArray; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js + function setToArray(set5) { + var index = -1, result = Array(set5.size); + set5.forEach(function(value2) { + result[++index] = value2; + }); + return result; + } + var setToArray_default; + var init_setToArray = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js"() { + "use strict"; + __name(setToArray, "setToArray"); + setToArray_default = setToArray; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js + function equalByTag(object3, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag6: + if (object3.byteLength != other.byteLength || object3.byteOffset != other.byteOffset) { + return false; + } + object3 = object3.buffer; + other = other.buffer; + case arrayBufferTag5: + if (object3.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object3), new Uint8Array_default(other))) { + return false; + } + return true; + case boolTag4: + case dateTag5: + case numberTag5: + return eq_default(+object3, +other); + case errorTag3: + return object3.name == other.name && object3.message == other.message; + case regexpTag5: + case stringTag5: + return object3 == other + ""; + case mapTag7: + var convert = mapToArray_default; + case setTag7: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG2; + convert || (convert = setToArray_default); + if (object3.size != other.size && !isPartial) { + return false; + } + var stacked = stack.get(object3); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG2; + stack.set(object3, other); + var result = equalArrays_default(convert(object3), convert(other), bitmask, customizer, equalFunc, stack); + stack["delete"](object3); + return result; + case symbolTag5: + if (symbolValueOf2) { + return symbolValueOf2.call(object3) == symbolValueOf2.call(other); + } + } + return false; + } + var COMPARE_PARTIAL_FLAG2, COMPARE_UNORDERED_FLAG2, boolTag4, dateTag5, errorTag3, mapTag7, numberTag5, regexpTag5, setTag7, stringTag5, symbolTag5, arrayBufferTag5, dataViewTag6, symbolProto3, symbolValueOf2, equalByTag_default; + var init_equalByTag = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js"() { + "use strict"; + init_Symbol(); + init_Uint8Array(); + init_eq(); + init_equalArrays(); + init_mapToArray(); + init_setToArray(); + COMPARE_PARTIAL_FLAG2 = 1; + COMPARE_UNORDERED_FLAG2 = 2; + boolTag4 = "[object Boolean]"; + dateTag5 = "[object Date]"; + errorTag3 = "[object Error]"; + mapTag7 = "[object Map]"; + numberTag5 = "[object Number]"; + regexpTag5 = "[object RegExp]"; + setTag7 = "[object Set]"; + stringTag5 = "[object String]"; + symbolTag5 = "[object Symbol]"; + arrayBufferTag5 = "[object ArrayBuffer]"; + dataViewTag6 = "[object DataView]"; + symbolProto3 = Symbol_default ? Symbol_default.prototype : void 0; + symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : void 0; + __name(equalByTag, "equalByTag"); + equalByTag_default = equalByTag; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js + function equalObjects(object3, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object3), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length; + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty12.call(other, key))) { + return false; + } + } + var objStacked = stack.get(object3); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object3; + } + var result = true; + stack.set(object3, other); + stack.set(other, object3); + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object3[key], othValue = other[key]; + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object3, stack) : customizer(objValue, othValue, key, object3, other, stack); + } + if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result && !skipCtor) { + var objCtor = object3.constructor, othCtor = other.constructor; + if (objCtor != othCtor && ("constructor" in object3 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { + result = false; + } + } + stack["delete"](object3); + stack["delete"](other); + return result; + } + var COMPARE_PARTIAL_FLAG3, objectProto15, hasOwnProperty12, equalObjects_default; + var init_equalObjects = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js"() { + "use strict"; + init_getAllKeys(); + COMPARE_PARTIAL_FLAG3 = 1; + objectProto15 = Object.prototype; + hasOwnProperty12 = objectProto15.hasOwnProperty; + __name(equalObjects, "equalObjects"); + equalObjects_default = equalObjects; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js + function baseIsEqualDeep(object3, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray_default(object3), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag4 : getTag_default(object3), othTag = othIsArr ? arrayTag4 : getTag_default(other); + objTag = objTag == argsTag4 ? objectTag6 : objTag; + othTag = othTag == argsTag4 ? objectTag6 : othTag; + var objIsObj = objTag == objectTag6, othIsObj = othTag == objectTag6, isSameTag = objTag == othTag; + if (isSameTag && isBuffer_default(object3)) { + if (!isBuffer_default(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack_default()); + return objIsArr || isTypedArray_default(object3) ? equalArrays_default(object3, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object3, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG4)) { + var objIsWrapped = objIsObj && hasOwnProperty13.call(object3, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty13.call(other, "__wrapped__"); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object3.value() : object3, othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new Stack_default()); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack_default()); + return equalObjects_default(object3, other, bitmask, customizer, equalFunc, stack); + } + var COMPARE_PARTIAL_FLAG4, argsTag4, arrayTag4, objectTag6, objectProto16, hasOwnProperty13, baseIsEqualDeep_default; + var init_baseIsEqualDeep = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js"() { + "use strict"; + init_Stack(); + init_equalArrays(); + init_equalByTag(); + init_equalObjects(); + init_getTag2(); + init_isArray2(); + init_isBuffer(); + init_isTypedArray3(); + COMPARE_PARTIAL_FLAG4 = 1; + argsTag4 = "[object Arguments]"; + arrayTag4 = "[object Array]"; + objectTag6 = "[object Object]"; + objectProto16 = Object.prototype; + hasOwnProperty13 = objectProto16.hasOwnProperty; + __name(baseIsEqualDeep, "baseIsEqualDeep"); + baseIsEqualDeep_default = baseIsEqualDeep; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js + function baseIsEqual(value2, other, bitmask, customizer, stack) { + if (value2 === other) { + return true; + } + if (value2 == null || other == null || !isObjectLike_default(value2) && !isObjectLike_default(other)) { + return value2 !== value2 && other !== other; + } + return baseIsEqualDeep_default(value2, other, bitmask, customizer, baseIsEqual, stack); + } + var baseIsEqual_default; + var init_baseIsEqual = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js"() { + "use strict"; + init_baseIsEqualDeep(); + init_isObjectLike2(); + __name(baseIsEqual, "baseIsEqual"); + baseIsEqual_default = baseIsEqual; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMatch.js + function baseIsMatch(object3, source, matchData, customizer) { + var index = matchData.length, length2 = index, noCustomizer = !customizer; + if (object3 == null) { + return !length2; + } + object3 = Object(object3); + while (index--) { + var data5 = matchData[index]; + if (noCustomizer && data5[2] ? data5[1] !== object3[data5[0]] : !(data5[0] in object3)) { + return false; + } + } + while (++index < length2) { + data5 = matchData[index]; + var key = data5[0], objValue = object3[key], srcValue = data5[1]; + if (noCustomizer && data5[2]) { + if (objValue === void 0 && !(key in object3)) { + return false; + } + } else { + var stack = new Stack_default(); + if (customizer) { + var result = customizer(objValue, srcValue, key, object3, source, stack); + } + if (!(result === void 0 ? baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result)) { + return false; + } + } + } + return true; + } + var COMPARE_PARTIAL_FLAG5, COMPARE_UNORDERED_FLAG3, baseIsMatch_default; + var init_baseIsMatch = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMatch.js"() { + "use strict"; + init_Stack(); + init_baseIsEqual(); + COMPARE_PARTIAL_FLAG5 = 1; + COMPARE_UNORDERED_FLAG3 = 2; + __name(baseIsMatch, "baseIsMatch"); + baseIsMatch_default = baseIsMatch; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isStrictComparable.js + function isStrictComparable(value2) { + return value2 === value2 && !isObject_default(value2); + } + var isStrictComparable_default; + var init_isStrictComparable = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isStrictComparable.js"() { + "use strict"; + init_isObject(); + __name(isStrictComparable, "isStrictComparable"); + isStrictComparable_default = isStrictComparable; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMatchData.js + function getMatchData(object3) { + var result = keys_default(object3), length2 = result.length; + while (length2--) { + var key = result[length2], value2 = object3[key]; + result[length2] = [key, value2, isStrictComparable_default(value2)]; + } + return result; + } + var getMatchData_default; + var init_getMatchData = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMatchData.js"() { + "use strict"; + init_isStrictComparable(); + init_keys(); + __name(getMatchData, "getMatchData"); + getMatchData_default = getMatchData; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_matchesStrictComparable.js + function matchesStrictComparable(key, srcValue) { + return function(object3) { + if (object3 == null) { + return false; + } + return object3[key] === srcValue && (srcValue !== void 0 || key in Object(object3)); + }; + } + var matchesStrictComparable_default; + var init_matchesStrictComparable = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_matchesStrictComparable.js"() { + "use strict"; + __name(matchesStrictComparable, "matchesStrictComparable"); + matchesStrictComparable_default = matchesStrictComparable; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMatches.js + function baseMatches(source) { + var matchData = getMatchData_default(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable_default(matchData[0][0], matchData[0][1]); + } + return function(object3) { + return object3 === source || baseIsMatch_default(object3, source, matchData); + }; + } + var baseMatches_default; + var init_baseMatches = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMatches.js"() { + "use strict"; + init_baseIsMatch(); + init_getMatchData(); + init_matchesStrictComparable(); + __name(baseMatches, "baseMatches"); + baseMatches_default = baseMatches; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseHasIn.js + function baseHasIn(object3, key) { + return object3 != null && key in Object(object3); + } + var baseHasIn_default; + var init_baseHasIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseHasIn.js"() { + "use strict"; + __name(baseHasIn, "baseHasIn"); + baseHasIn_default = baseHasIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hasPath.js + function hasPath(object3, path4, hasFunc) { + path4 = castPath_default(path4, object3); + var index = -1, length2 = path4.length, result = false; + while (++index < length2) { + var key = toKey_default(path4[index]); + if (!(result = object3 != null && hasFunc(object3, key))) { + break; + } + object3 = object3[key]; + } + if (result || ++index != length2) { + return result; + } + length2 = object3 == null ? 0 : object3.length; + return !!length2 && isLength_default(length2) && isIndex_default(key, length2) && (isArray_default(object3) || isArguments_default(object3)); + } + var hasPath_default; + var init_hasPath = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hasPath.js"() { + "use strict"; + init_castPath(); + init_isArguments2(); + init_isArray2(); + init_isIndex(); + init_isLength2(); + init_toKey(); + __name(hasPath, "hasPath"); + hasPath_default = hasPath; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/hasIn.js + function hasIn(object3, path4) { + return object3 != null && hasPath_default(object3, path4, baseHasIn_default); + } + var hasIn_default; + var init_hasIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/hasIn.js"() { + "use strict"; + init_baseHasIn(); + init_hasPath(); + __name(hasIn, "hasIn"); + hasIn_default = hasIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMatchesProperty.js + function baseMatchesProperty(path4, srcValue) { + if (isKey_default(path4) && isStrictComparable_default(srcValue)) { + return matchesStrictComparable_default(toKey_default(path4), srcValue); + } + return function(object3) { + var objValue = get_default(object3, path4); + return objValue === void 0 && objValue === srcValue ? hasIn_default(object3, path4) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4); + }; + } + var COMPARE_PARTIAL_FLAG6, COMPARE_UNORDERED_FLAG4, baseMatchesProperty_default; + var init_baseMatchesProperty = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMatchesProperty.js"() { + "use strict"; + init_baseIsEqual(); + init_get(); + init_hasIn(); + init_isKey(); + init_isStrictComparable(); + init_matchesStrictComparable(); + init_toKey(); + COMPARE_PARTIAL_FLAG6 = 1; + COMPARE_UNORDERED_FLAG4 = 2; + __name(baseMatchesProperty, "baseMatchesProperty"); + baseMatchesProperty_default = baseMatchesProperty; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseProperty.js + function baseProperty(key) { + return function(object3) { + return object3 == null ? void 0 : object3[key]; + }; + } + var baseProperty_default; + var init_baseProperty = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseProperty.js"() { + "use strict"; + __name(baseProperty, "baseProperty"); + baseProperty_default = baseProperty; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyDeep.js + function basePropertyDeep(path4) { + return function(object3) { + return baseGet_default(object3, path4); + }; + } + var basePropertyDeep_default; + var init_basePropertyDeep = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyDeep.js"() { + "use strict"; + init_baseGet(); + __name(basePropertyDeep, "basePropertyDeep"); + basePropertyDeep_default = basePropertyDeep; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/property.js + function property(path4) { + return isKey_default(path4) ? baseProperty_default(toKey_default(path4)) : basePropertyDeep_default(path4); + } + var property_default2; + var init_property2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/property.js"() { + "use strict"; + init_baseProperty(); + init_basePropertyDeep(); + init_isKey(); + init_toKey(); + __name(property, "property"); + property_default2 = property; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js + function baseIteratee(value2) { + if (typeof value2 == "function") { + return value2; + } + if (value2 == null) { + return identity_default4; + } + if (typeof value2 == "object") { + return isArray_default(value2) ? baseMatchesProperty_default(value2[0], value2[1]) : baseMatches_default(value2); + } + return property_default2(value2); + } + var baseIteratee_default; + var init_baseIteratee = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js"() { + "use strict"; + init_baseMatches(); + init_baseMatchesProperty(); + init_identity4(); + init_isArray2(); + init_property2(); + __name(baseIteratee, "baseIteratee"); + baseIteratee_default = baseIteratee; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js + function createBaseFor(fromRight) { + return function(object3, iteratee, keysFunc) { + var index = -1, iterable = Object(object3), props = keysFunc(object3), length2 = props.length; + while (length2--) { + var key = props[fromRight ? length2 : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object3; + }; + } + var createBaseFor_default; + var init_createBaseFor = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js"() { + "use strict"; + __name(createBaseFor, "createBaseFor"); + createBaseFor_default = createBaseFor; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js + var baseFor, baseFor_default; + var init_baseFor = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js"() { + "use strict"; + init_createBaseFor(); + baseFor = createBaseFor_default(); + baseFor_default = baseFor; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseForOwn.js + function baseForOwn(object3, iteratee) { + return object3 && baseFor_default(object3, iteratee, keys_default); + } + var baseForOwn_default; + var init_baseForOwn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseForOwn.js"() { + "use strict"; + init_baseFor(); + init_keys(); + __name(baseForOwn, "baseForOwn"); + baseForOwn_default = baseForOwn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createBaseEach.js + function createBaseEach(eachFunc, fromRight) { + return function(collection4, iteratee) { + if (collection4 == null) { + return collection4; + } + if (!isArrayLike_default(collection4)) { + return eachFunc(collection4, iteratee); + } + var length2 = collection4.length, index = fromRight ? length2 : -1, iterable = Object(collection4); + while (fromRight ? index-- : ++index < length2) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection4; + }; + } + var createBaseEach_default; + var init_createBaseEach = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createBaseEach.js"() { + "use strict"; + init_isArrayLike2(); + __name(createBaseEach, "createBaseEach"); + createBaseEach_default = createBaseEach; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseEach.js + var baseEach, baseEach_default; + var init_baseEach = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseEach.js"() { + "use strict"; + init_baseForOwn(); + init_createBaseEach(); + baseEach = createBaseEach_default(baseForOwn_default); + baseEach_default = baseEach; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/now.js + var now2, now_default; + var init_now = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/now.js"() { + "use strict"; + init_root(); + now2 = /* @__PURE__ */ __name(function() { + return root_default.Date.now(); + }, "now"); + now_default = now2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/defaults.js + var objectProto17, hasOwnProperty14, defaults, defaults_default; + var init_defaults3 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/defaults.js"() { + "use strict"; + init_baseRest(); + init_eq(); + init_isIterateeCall(); + init_keysIn(); + objectProto17 = Object.prototype; + hasOwnProperty14 = objectProto17.hasOwnProperty; + defaults = baseRest_default(function(object3, sources) { + object3 = Object(object3); + var index = -1; + var length2 = sources.length; + var guard = length2 > 2 ? sources[2] : void 0; + if (guard && isIterateeCall_default(sources[0], sources[1], guard)) { + length2 = 1; + } + while (++index < length2) { + var source = sources[index]; + var props = keysIn_default(source); + var propsIndex = -1; + var propsLength = props.length; + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value2 = object3[key]; + if (value2 === void 0 || eq_default(value2, objectProto17[key]) && !hasOwnProperty14.call(object3, key)) { + object3[key] = source[key]; + } + } + } + return object3; + }); + defaults_default = defaults; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignMergeValue.js + function assignMergeValue(object3, key, value2) { + if (value2 !== void 0 && !eq_default(object3[key], value2) || value2 === void 0 && !(key in object3)) { + baseAssignValue_default(object3, key, value2); + } + } + var assignMergeValue_default; + var init_assignMergeValue = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignMergeValue.js"() { + "use strict"; + init_baseAssignValue(); + init_eq(); + __name(assignMergeValue, "assignMergeValue"); + assignMergeValue_default = assignMergeValue; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArrayLikeObject.js + function isArrayLikeObject2(value2) { + return isObjectLike_default(value2) && isArrayLike_default(value2); + } + var isArrayLikeObject_default; + var init_isArrayLikeObject2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArrayLikeObject.js"() { + "use strict"; + init_isArrayLike2(); + init_isObjectLike2(); + __name(isArrayLikeObject2, "isArrayLikeObject"); + isArrayLikeObject_default = isArrayLikeObject2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_safeGet.js + function safeGet(object3, key) { + if (key === "constructor" && typeof object3[key] === "function") { + return; + } + if (key == "__proto__") { + return; + } + return object3[key]; + } + var safeGet_default; + var init_safeGet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_safeGet.js"() { + "use strict"; + __name(safeGet, "safeGet"); + safeGet_default = safeGet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toPlainObject.js + function toPlainObject(value2) { + return copyObject_default(value2, keysIn_default(value2)); + } + var toPlainObject_default; + var init_toPlainObject = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toPlainObject.js"() { + "use strict"; + init_copyObject(); + init_keysIn(); + __name(toPlainObject, "toPlainObject"); + toPlainObject_default = toPlainObject; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMergeDeep.js + function baseMergeDeep(object3, source, key, srcIndex, mergeFunc, customizer, stack) { + var objValue = safeGet_default(object3, key), srcValue = safeGet_default(source, key), stacked = stack.get(srcValue); + if (stacked) { + assignMergeValue_default(object3, key, stacked); + return; + } + var newValue = customizer ? customizer(objValue, srcValue, key + "", object3, source, stack) : void 0; + var isCommon = newValue === void 0; + if (isCommon) { + var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue); + newValue = srcValue; + if (isArr || isBuff || isTyped) { + if (isArray_default(objValue)) { + newValue = objValue; + } else if (isArrayLikeObject_default(objValue)) { + newValue = copyArray_default(objValue); + } else if (isBuff) { + isCommon = false; + newValue = cloneBuffer_default(srcValue, true); + } else if (isTyped) { + isCommon = false; + newValue = cloneTypedArray_default(srcValue, true); + } else { + newValue = []; + } + } else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) { + newValue = objValue; + if (isArguments_default(objValue)) { + newValue = toPlainObject_default(objValue); + } else if (!isObject_default(objValue) || isFunction_default(objValue)) { + newValue = initCloneObject_default(srcValue); + } + } else { + isCommon = false; + } + } + if (isCommon) { + stack.set(srcValue, newValue); + mergeFunc(newValue, srcValue, srcIndex, customizer, stack); + stack["delete"](srcValue); + } + assignMergeValue_default(object3, key, newValue); + } + var baseMergeDeep_default; + var init_baseMergeDeep = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMergeDeep.js"() { + "use strict"; + init_assignMergeValue(); + init_cloneBuffer(); + init_cloneTypedArray(); + init_copyArray(); + init_initCloneObject(); + init_isArguments2(); + init_isArray2(); + init_isArrayLikeObject2(); + init_isBuffer(); + init_isFunction(); + init_isObject(); + init_isPlainObject2(); + init_isTypedArray3(); + init_safeGet(); + init_toPlainObject(); + __name(baseMergeDeep, "baseMergeDeep"); + baseMergeDeep_default = baseMergeDeep; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMerge.js + function baseMerge(object3, source, srcIndex, customizer, stack) { + if (object3 === source) { + return; + } + baseFor_default(source, function(srcValue, key) { + stack || (stack = new Stack_default()); + if (isObject_default(srcValue)) { + baseMergeDeep_default(object3, source, key, srcIndex, baseMerge, customizer, stack); + } else { + var newValue = customizer ? customizer(safeGet_default(object3, key), srcValue, key + "", object3, source, stack) : void 0; + if (newValue === void 0) { + newValue = srcValue; + } + assignMergeValue_default(object3, key, newValue); + } + }, keysIn_default); + } + var baseMerge_default; + var init_baseMerge = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMerge.js"() { + "use strict"; + init_Stack(); + init_assignMergeValue(); + init_baseFor(); + init_baseMergeDeep(); + init_isObject(); + init_keysIn(); + init_safeGet(); + __name(baseMerge, "baseMerge"); + baseMerge_default = baseMerge; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayIncludesWith.js + function arrayIncludesWith(array4, value2, comparator) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (comparator(value2, array4[index])) { + return true; + } + } + return false; + } + var arrayIncludesWith_default; + var init_arrayIncludesWith = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayIncludesWith.js"() { + "use strict"; + __name(arrayIncludesWith, "arrayIncludesWith"); + arrayIncludesWith_default = arrayIncludesWith; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/last.js + function last(array4) { + var length2 = array4 == null ? 0 : array4.length; + return length2 ? array4[length2 - 1] : void 0; + } + var last_default; + var init_last = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/last.js"() { + "use strict"; + __name(last, "last"); + last_default = last; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_castFunction.js + function castFunction(value2) { + return typeof value2 == "function" ? value2 : identity_default4; + } + var castFunction_default; + var init_castFunction = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_castFunction.js"() { + "use strict"; + init_identity4(); + __name(castFunction, "castFunction"); + castFunction_default = castFunction; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/forEach.js + function forEach(collection4, iteratee) { + var func = isArray_default(collection4) ? arrayEach_default : baseEach_default; + return func(collection4, castFunction_default(iteratee)); + } + var forEach_default; + var init_forEach = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/forEach.js"() { + "use strict"; + init_arrayEach(); + init_baseEach(); + init_castFunction(); + init_isArray2(); + __name(forEach, "forEach"); + forEach_default = forEach; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/each.js + var init_each3 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/each.js"() { + "use strict"; + init_forEach(); + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFilter.js + function baseFilter(collection4, predicate) { + var result = []; + baseEach_default(collection4, function(value2, index, collection5) { + if (predicate(value2, index, collection5)) { + result.push(value2); + } + }); + return result; + } + var baseFilter_default; + var init_baseFilter = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFilter.js"() { + "use strict"; + init_baseEach(); + __name(baseFilter, "baseFilter"); + baseFilter_default = baseFilter; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/filter.js + function filter2(collection4, predicate) { + var func = isArray_default(collection4) ? arrayFilter_default : baseFilter_default; + return func(collection4, baseIteratee_default(predicate, 3)); + } + var filter_default3; + var init_filter3 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/filter.js"() { + "use strict"; + init_arrayFilter(); + init_baseFilter(); + init_baseIteratee(); + init_isArray2(); + __name(filter2, "filter"); + filter_default3 = filter2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createFind.js + function createFind(findIndexFunc) { + return function(collection4, predicate, fromIndex) { + var iterable = Object(collection4); + if (!isArrayLike_default(collection4)) { + var iteratee = baseIteratee_default(predicate, 3); + collection4 = keys_default(collection4); + predicate = /* @__PURE__ */ __name(function(key) { + return iteratee(iterable[key], key, iterable); + }, "predicate"); + } + var index = findIndexFunc(collection4, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection4[index] : index] : void 0; + }; + } + var createFind_default; + var init_createFind = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createFind.js"() { + "use strict"; + init_baseIteratee(); + init_isArrayLike2(); + init_keys(); + __name(createFind, "createFind"); + createFind_default = createFind; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/findIndex.js + function findIndex(array4, predicate, fromIndex) { + var length2 = array4 == null ? 0 : array4.length; + if (!length2) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger_default(fromIndex); + if (index < 0) { + index = nativeMax2(length2 + index, 0); + } + return baseFindIndex_default(array4, baseIteratee_default(predicate, 3), index); + } + var nativeMax2, findIndex_default; + var init_findIndex = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/findIndex.js"() { + "use strict"; + init_baseFindIndex(); + init_baseIteratee(); + init_toInteger(); + nativeMax2 = Math.max; + __name(findIndex, "findIndex"); + findIndex_default = findIndex; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/find.js + var find2, find_default2; + var init_find2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/find.js"() { + "use strict"; + init_createFind(); + init_findIndex(); + find2 = createFind_default(findIndex_default); + find_default2 = find2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMap.js + function baseMap(collection4, iteratee) { + var index = -1, result = isArrayLike_default(collection4) ? Array(collection4.length) : []; + baseEach_default(collection4, function(value2, key, collection5) { + result[++index] = iteratee(value2, key, collection5); + }); + return result; + } + var baseMap_default; + var init_baseMap = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMap.js"() { + "use strict"; + init_baseEach(); + init_isArrayLike2(); + __name(baseMap, "baseMap"); + baseMap_default = baseMap; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/map.js + function map3(collection4, iteratee) { + var func = isArray_default(collection4) ? arrayMap_default : baseMap_default; + return func(collection4, baseIteratee_default(iteratee, 3)); + } + var map_default; + var init_map = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/map.js"() { + "use strict"; + init_arrayMap(); + init_baseIteratee(); + init_baseMap(); + init_isArray2(); + __name(map3, "map"); + map_default = map3; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/forIn.js + function forIn(object3, iteratee) { + return object3 == null ? object3 : baseFor_default(object3, castFunction_default(iteratee), keysIn_default); + } + var forIn_default; + var init_forIn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/forIn.js"() { + "use strict"; + init_baseFor(); + init_castFunction(); + init_keysIn(); + __name(forIn, "forIn"); + forIn_default = forIn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/forOwn.js + function forOwn(object3, iteratee) { + return object3 && baseForOwn_default(object3, castFunction_default(iteratee)); + } + var forOwn_default; + var init_forOwn = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/forOwn.js"() { + "use strict"; + init_baseForOwn(); + init_castFunction(); + __name(forOwn, "forOwn"); + forOwn_default = forOwn; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGt.js + function baseGt(value2, other) { + return value2 > other; + } + var baseGt_default; + var init_baseGt = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGt.js"() { + "use strict"; + __name(baseGt, "baseGt"); + baseGt_default = baseGt; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseHas.js + function baseHas(object3, key) { + return object3 != null && hasOwnProperty15.call(object3, key); + } + var objectProto18, hasOwnProperty15, baseHas_default; + var init_baseHas = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseHas.js"() { + "use strict"; + objectProto18 = Object.prototype; + hasOwnProperty15 = objectProto18.hasOwnProperty; + __name(baseHas, "baseHas"); + baseHas_default = baseHas; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/has.js + function has(object3, path4) { + return object3 != null && hasPath_default(object3, path4, baseHas_default); + } + var has_default; + var init_has = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/has.js"() { + "use strict"; + init_baseHas(); + init_hasPath(); + __name(has, "has"); + has_default = has; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isString.js + function isString(value2) { + return typeof value2 == "string" || !isArray_default(value2) && isObjectLike_default(value2) && baseGetTag_default(value2) == stringTag6; + } + var stringTag6, isString_default; + var init_isString = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isString.js"() { + "use strict"; + init_baseGetTag(); + init_isArray2(); + init_isObjectLike2(); + stringTag6 = "[object String]"; + __name(isString, "isString"); + isString_default = isString; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseValues.js + function baseValues(object3, props) { + return arrayMap_default(props, function(key) { + return object3[key]; + }); + } + var baseValues_default; + var init_baseValues = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseValues.js"() { + "use strict"; + init_arrayMap(); + __name(baseValues, "baseValues"); + baseValues_default = baseValues; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/values.js + function values(object3) { + return object3 == null ? [] : baseValues_default(object3, keys_default(object3)); + } + var values_default; + var init_values = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/values.js"() { + "use strict"; + init_baseValues(); + init_keys(); + __name(values, "values"); + values_default = values; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js + function isEmpty2(value2) { + if (value2 == null) { + return true; + } + if (isArrayLike_default(value2) && (isArray_default(value2) || typeof value2 == "string" || typeof value2.splice == "function" || isBuffer_default(value2) || isTypedArray_default(value2) || isArguments_default(value2))) { + return !value2.length; + } + var tag = getTag_default(value2); + if (tag == mapTag8 || tag == setTag8) { + return !value2.size; + } + if (isPrototype_default(value2)) { + return !baseKeys_default(value2).length; + } + for (var key in value2) { + if (hasOwnProperty16.call(value2, key)) { + return false; + } + } + return true; + } + var mapTag8, setTag8, objectProto19, hasOwnProperty16, isEmpty_default; + var init_isEmpty2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js"() { + "use strict"; + init_baseKeys(); + init_getTag2(); + init_isArguments2(); + init_isArray2(); + init_isArrayLike2(); + init_isBuffer(); + init_isPrototype2(); + init_isTypedArray3(); + mapTag8 = "[object Map]"; + setTag8 = "[object Set]"; + objectProto19 = Object.prototype; + hasOwnProperty16 = objectProto19.hasOwnProperty; + __name(isEmpty2, "isEmpty"); + isEmpty_default = isEmpty2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js + function isUndefined(value2) { + return value2 === void 0; + } + var isUndefined_default; + var init_isUndefined = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js"() { + "use strict"; + __name(isUndefined, "isUndefined"); + isUndefined_default = isUndefined; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseLt.js + function baseLt(value2, other) { + return value2 < other; + } + var baseLt_default; + var init_baseLt = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseLt.js"() { + "use strict"; + __name(baseLt, "baseLt"); + baseLt_default = baseLt; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/mapValues.js + function mapValues(object3, iteratee) { + var result = {}; + iteratee = baseIteratee_default(iteratee, 3); + baseForOwn_default(object3, function(value2, key, object4) { + baseAssignValue_default(result, key, iteratee(value2, key, object4)); + }); + return result; + } + var mapValues_default; + var init_mapValues = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/mapValues.js"() { + "use strict"; + init_baseAssignValue(); + init_baseForOwn(); + init_baseIteratee(); + __name(mapValues, "mapValues"); + mapValues_default = mapValues; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseExtremum.js + function baseExtremum(array4, iteratee, comparator) { + var index = -1, length2 = array4.length; + while (++index < length2) { + var value2 = array4[index], current = iteratee(value2); + if (current != null && (computed === void 0 ? current === current && !isSymbol_default(current) : comparator(current, computed))) { + var computed = current, result = value2; + } + } + return result; + } + var baseExtremum_default; + var init_baseExtremum = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseExtremum.js"() { + "use strict"; + init_isSymbol(); + __name(baseExtremum, "baseExtremum"); + baseExtremum_default = baseExtremum; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/max.js + function max4(array4) { + return array4 && array4.length ? baseExtremum_default(array4, identity_default4, baseGt_default) : void 0; + } + var max_default; + var init_max2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/max.js"() { + "use strict"; + init_baseExtremum(); + init_baseGt(); + init_identity4(); + __name(max4, "max"); + max_default = max4; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/merge.js + var merge3, merge_default3; + var init_merge5 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/merge.js"() { + "use strict"; + init_baseMerge(); + init_createAssigner(); + merge3 = createAssigner_default(function(object3, source, srcIndex) { + baseMerge_default(object3, source, srcIndex); + }); + merge_default3 = merge3; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/min.js + function min4(array4) { + return array4 && array4.length ? baseExtremum_default(array4, identity_default4, baseLt_default) : void 0; + } + var min_default; + var init_min2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/min.js"() { + "use strict"; + init_baseExtremum(); + init_baseLt(); + init_identity4(); + __name(min4, "min"); + min_default = min4; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/minBy.js + function minBy(array4, iteratee) { + return array4 && array4.length ? baseExtremum_default(array4, baseIteratee_default(iteratee, 2), baseLt_default) : void 0; + } + var minBy_default; + var init_minBy = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/minBy.js"() { + "use strict"; + init_baseExtremum(); + init_baseIteratee(); + init_baseLt(); + __name(minBy, "minBy"); + minBy_default = minBy; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSet.js + function baseSet(object3, path4, value2, customizer) { + if (!isObject_default(object3)) { + return object3; + } + path4 = castPath_default(path4, object3); + var index = -1, length2 = path4.length, lastIndex = length2 - 1, nested = object3; + while (nested != null && ++index < length2) { + var key = toKey_default(path4[index]), newValue = value2; + if (key === "__proto__" || key === "constructor" || key === "prototype") { + return object3; + } + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : void 0; + if (newValue === void 0) { + newValue = isObject_default(objValue) ? objValue : isIndex_default(path4[index + 1]) ? [] : {}; + } + } + assignValue_default(nested, key, newValue); + nested = nested[key]; + } + return object3; + } + var baseSet_default; + var init_baseSet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSet.js"() { + "use strict"; + init_assignValue(); + init_castPath(); + init_isIndex(); + init_isObject(); + init_toKey(); + __name(baseSet, "baseSet"); + baseSet_default = baseSet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePickBy.js + function basePickBy(object3, paths, predicate) { + var index = -1, length2 = paths.length, result = {}; + while (++index < length2) { + var path4 = paths[index], value2 = baseGet_default(object3, path4); + if (predicate(value2, path4)) { + baseSet_default(result, castPath_default(path4, object3), value2); + } + } + return result; + } + var basePickBy_default; + var init_basePickBy = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePickBy.js"() { + "use strict"; + init_baseGet(); + init_baseSet(); + init_castPath(); + __name(basePickBy, "basePickBy"); + basePickBy_default = basePickBy; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSortBy.js + function baseSortBy(array4, comparer) { + var length2 = array4.length; + array4.sort(comparer); + while (length2--) { + array4[length2] = array4[length2].value; + } + return array4; + } + var baseSortBy_default; + var init_baseSortBy = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSortBy.js"() { + "use strict"; + __name(baseSortBy, "baseSortBy"); + baseSortBy_default = baseSortBy; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_compareAscending.js + function compareAscending(value2, other) { + if (value2 !== other) { + var valIsDefined = value2 !== void 0, valIsNull = value2 === null, valIsReflexive = value2 === value2, valIsSymbol = isSymbol_default(value2); + var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol_default(other); + if (!othIsNull && !othIsSymbol && !valIsSymbol && value2 > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) { + return 1; + } + if (!valIsNull && !valIsSymbol && !othIsSymbol && value2 < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) { + return -1; + } + } + return 0; + } + var compareAscending_default; + var init_compareAscending = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_compareAscending.js"() { + "use strict"; + init_isSymbol(); + __name(compareAscending, "compareAscending"); + compareAscending_default = compareAscending; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_compareMultiple.js + function compareMultiple(object3, other, orders) { + var index = -1, objCriteria = object3.criteria, othCriteria = other.criteria, length2 = objCriteria.length, ordersLength = orders.length; + while (++index < length2) { + var result = compareAscending_default(objCriteria[index], othCriteria[index]); + if (result) { + if (index >= ordersLength) { + return result; + } + var order2 = orders[index]; + return result * (order2 == "desc" ? -1 : 1); + } + } + return object3.index - other.index; + } + var compareMultiple_default; + var init_compareMultiple = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_compareMultiple.js"() { + "use strict"; + init_compareAscending(); + __name(compareMultiple, "compareMultiple"); + compareMultiple_default = compareMultiple; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseOrderBy.js + function baseOrderBy(collection4, iteratees, orders) { + if (iteratees.length) { + iteratees = arrayMap_default(iteratees, function(iteratee) { + if (isArray_default(iteratee)) { + return function(value2) { + return baseGet_default(value2, iteratee.length === 1 ? iteratee[0] : iteratee); + }; + } + return iteratee; + }); + } else { + iteratees = [identity_default4]; + } + var index = -1; + iteratees = arrayMap_default(iteratees, baseUnary_default(baseIteratee_default)); + var result = baseMap_default(collection4, function(value2, key, collection5) { + var criteria = arrayMap_default(iteratees, function(iteratee) { + return iteratee(value2); + }); + return { "criteria": criteria, "index": ++index, "value": value2 }; + }); + return baseSortBy_default(result, function(object3, other) { + return compareMultiple_default(object3, other, orders); + }); + } + var baseOrderBy_default; + var init_baseOrderBy = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseOrderBy.js"() { + "use strict"; + init_arrayMap(); + init_baseGet(); + init_baseIteratee(); + init_baseMap(); + init_baseSortBy(); + init_baseUnary(); + init_compareMultiple(); + init_identity4(); + init_isArray2(); + __name(baseOrderBy, "baseOrderBy"); + baseOrderBy_default = baseOrderBy; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_asciiSize.js + var asciiSize, asciiSize_default; + var init_asciiSize = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_asciiSize.js"() { + "use strict"; + init_baseProperty(); + asciiSize = baseProperty_default("length"); + asciiSize_default = asciiSize; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_unicodeSize.js + function unicodeSize(string3) { + var result = reUnicode.lastIndex = 0; + while (reUnicode.test(string3)) { + ++result; + } + return result; + } + var rsAstralRange2, rsComboMarksRange2, reComboHalfMarksRange2, rsComboSymbolsRange2, rsComboRange2, rsVarRange2, rsAstral, rsCombo, rsFitz, rsModifier, rsNonAstral, rsRegional, rsSurrPair, rsZWJ2, reOptMod, rsOptVar, rsOptJoin, rsSeq, rsSymbol, reUnicode, unicodeSize_default; + var init_unicodeSize = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_unicodeSize.js"() { + "use strict"; + rsAstralRange2 = "\\ud800-\\udfff"; + rsComboMarksRange2 = "\\u0300-\\u036f"; + reComboHalfMarksRange2 = "\\ufe20-\\ufe2f"; + rsComboSymbolsRange2 = "\\u20d0-\\u20ff"; + rsComboRange2 = rsComboMarksRange2 + reComboHalfMarksRange2 + rsComboSymbolsRange2; + rsVarRange2 = "\\ufe0e\\ufe0f"; + rsAstral = "[" + rsAstralRange2 + "]"; + rsCombo = "[" + rsComboRange2 + "]"; + rsFitz = "\\ud83c[\\udffb-\\udfff]"; + rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")"; + rsNonAstral = "[^" + rsAstralRange2 + "]"; + rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}"; + rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]"; + rsZWJ2 = "\\u200d"; + reOptMod = rsModifier + "?"; + rsOptVar = "[" + rsVarRange2 + "]?"; + rsOptJoin = "(?:" + rsZWJ2 + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*"; + rsSeq = rsOptVar + reOptMod + rsOptJoin; + rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; + reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); + __name(unicodeSize, "unicodeSize"); + unicodeSize_default = unicodeSize; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stringSize.js + function stringSize(string3) { + return hasUnicode_default(string3) ? unicodeSize_default(string3) : asciiSize_default(string3); + } + var stringSize_default; + var init_stringSize = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stringSize.js"() { + "use strict"; + init_asciiSize(); + init_hasUnicode(); + init_unicodeSize(); + __name(stringSize, "stringSize"); + stringSize_default = stringSize; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePick.js + function basePick(object3, paths) { + return basePickBy_default(object3, paths, function(value2, path4) { + return hasIn_default(object3, path4); + }); + } + var basePick_default; + var init_basePick = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePick.js"() { + "use strict"; + init_basePickBy(); + init_hasIn(); + __name(basePick, "basePick"); + basePick_default = basePick; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/pick.js + var pick, pick_default; + var init_pick = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/pick.js"() { + "use strict"; + init_basePick(); + init_flatRest(); + pick = flatRest_default(function(object3, paths) { + return object3 == null ? {} : basePick_default(object3, paths); + }); + pick_default = pick; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseRange.js + function baseRange(start3, end2, step3, fromRight) { + var index = -1, length2 = nativeMax3(nativeCeil((end2 - start3) / (step3 || 1)), 0), result = Array(length2); + while (length2--) { + result[fromRight ? length2 : ++index] = start3; + start3 += step3; + } + return result; + } + var nativeCeil, nativeMax3, baseRange_default; + var init_baseRange = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseRange.js"() { + "use strict"; + nativeCeil = Math.ceil; + nativeMax3 = Math.max; + __name(baseRange, "baseRange"); + baseRange_default = baseRange; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createRange.js + function createRange(fromRight) { + return function(start3, end2, step3) { + if (step3 && typeof step3 != "number" && isIterateeCall_default(start3, end2, step3)) { + end2 = step3 = void 0; + } + start3 = toFinite_default(start3); + if (end2 === void 0) { + end2 = start3; + start3 = 0; + } else { + end2 = toFinite_default(end2); + } + step3 = step3 === void 0 ? start3 < end2 ? 1 : -1 : toFinite_default(step3); + return baseRange_default(start3, end2, step3, fromRight); + }; + } + var createRange_default; + var init_createRange = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createRange.js"() { + "use strict"; + init_baseRange(); + init_isIterateeCall(); + init_toFinite(); + __name(createRange, "createRange"); + createRange_default = createRange; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/range.js + var range2, range_default; + var init_range2 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/range.js"() { + "use strict"; + init_createRange(); + range2 = createRange_default(); + range_default = range2; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseReduce.js + function baseReduce(collection4, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection4, function(value2, index, collection5) { + accumulator = initAccum ? (initAccum = false, value2) : iteratee(accumulator, value2, index, collection5); + }); + return accumulator; + } + var baseReduce_default; + var init_baseReduce = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseReduce.js"() { + "use strict"; + __name(baseReduce, "baseReduce"); + baseReduce_default = baseReduce; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/reduce.js + function reduce(collection4, iteratee, accumulator) { + var func = isArray_default(collection4) ? arrayReduce_default : baseReduce_default, initAccum = arguments.length < 3; + return func(collection4, baseIteratee_default(iteratee, 4), accumulator, initAccum, baseEach_default); + } + var reduce_default; + var init_reduce = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/reduce.js"() { + "use strict"; + init_arrayReduce(); + init_baseEach(); + init_baseIteratee(); + init_baseReduce(); + init_isArray2(); + __name(reduce, "reduce"); + reduce_default = reduce; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/size.js + function size(collection4) { + if (collection4 == null) { + return 0; + } + if (isArrayLike_default(collection4)) { + return isString_default(collection4) ? stringSize_default(collection4) : collection4.length; + } + var tag = getTag_default(collection4); + if (tag == mapTag9 || tag == setTag9) { + return collection4.size; + } + return baseKeys_default(collection4).length; + } + var mapTag9, setTag9, size_default2; + var init_size3 = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/size.js"() { + "use strict"; + init_baseKeys(); + init_getTag2(); + init_isArrayLike2(); + init_isString(); + init_stringSize(); + mapTag9 = "[object Map]"; + setTag9 = "[object Set]"; + __name(size, "size"); + size_default2 = size; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/sortBy.js + var sortBy, sortBy_default; + var init_sortBy = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/sortBy.js"() { + "use strict"; + init_baseFlatten(); + init_baseOrderBy(); + init_baseRest(); + init_isIterateeCall(); + sortBy = baseRest_default(function(collection4, iteratees) { + if (collection4 == null) { + return []; + } + var length2 = iteratees.length; + if (length2 > 1 && isIterateeCall_default(collection4, iteratees[0], iteratees[1])) { + iteratees = []; + } else if (length2 > 2 && isIterateeCall_default(iteratees[0], iteratees[1], iteratees[2])) { + iteratees = [iteratees[0]]; + } + return baseOrderBy_default(collection4, baseFlatten_default(iteratees, 1), []); + }); + sortBy_default = sortBy; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createSet.js + var INFINITY4, createSet, createSet_default; + var init_createSet = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createSet.js"() { + "use strict"; + init_Set(); + init_noop3(); + init_setToArray(); + INFINITY4 = 1 / 0; + createSet = !(Set_default && 1 / setToArray_default(new Set_default([, -0]))[1] == INFINITY4) ? noop_default2 : function(values3) { + return new Set_default(values3); + }; + createSet_default = createSet; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUniq.js + function baseUniq(array4, iteratee, comparator) { + var index = -1, includes3 = arrayIncludes_default, length2 = array4.length, isCommon = true, result = [], seen = result; + if (comparator) { + isCommon = false; + includes3 = arrayIncludesWith_default; + } else if (length2 >= LARGE_ARRAY_SIZE2) { + var set5 = iteratee ? null : createSet_default(array4); + if (set5) { + return setToArray_default(set5); + } + isCommon = false; + includes3 = cacheHas_default; + seen = new SetCache_default(); + } else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length2) { + var value2 = array4[index], computed = iteratee ? iteratee(value2) : value2; + value2 = comparator || value2 !== 0 ? value2 : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value2); + } else if (!includes3(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value2); + } + } + return result; + } + var LARGE_ARRAY_SIZE2, baseUniq_default; + var init_baseUniq = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUniq.js"() { + "use strict"; + init_SetCache(); + init_arrayIncludes(); + init_arrayIncludesWith(); + init_cacheHas(); + init_createSet(); + init_setToArray(); + LARGE_ARRAY_SIZE2 = 200; + __name(baseUniq, "baseUniq"); + baseUniq_default = baseUniq; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/union.js + var union, union_default; + var init_union = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/union.js"() { + "use strict"; + init_baseFlatten(); + init_baseRest(); + init_baseUniq(); + init_isArrayLikeObject2(); + union = baseRest_default(function(arrays) { + return baseUniq_default(baseFlatten_default(arrays, 1, isArrayLikeObject_default, true)); + }); + union_default = union; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/uniqueId.js + function uniqueId(prefix) { + var id35 = ++idCounter; + return toString_default(prefix) + id35; + } + var idCounter, uniqueId_default; + var init_uniqueId = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/uniqueId.js"() { + "use strict"; + init_toString(); + idCounter = 0; + __name(uniqueId, "uniqueId"); + uniqueId_default = uniqueId; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseZipObject.js + function baseZipObject(props, values3, assignFunc) { + var index = -1, length2 = props.length, valsLength = values3.length, result = {}; + while (++index < length2) { + var value2 = index < valsLength ? values3[index] : void 0; + assignFunc(result, props[index], value2); + } + return result; + } + var baseZipObject_default; + var init_baseZipObject = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseZipObject.js"() { + "use strict"; + __name(baseZipObject, "baseZipObject"); + baseZipObject_default = baseZipObject; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/zipObject.js + function zipObject(props, values3) { + return baseZipObject_default(props || [], values3 || [], assignValue_default); + } + var zipObject_default; + var init_zipObject = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/zipObject.js"() { + "use strict"; + init_assignValue(); + init_baseZipObject(); + __name(zipObject, "zipObject"); + zipObject_default = zipObject; + } + }); + + // ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/lodash.js + var init_lodash = __esm({ + "../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/lodash.js"() { + "use strict"; + init_clone4(); + init_cloneDeep2(); + init_constant8(); + init_defaults3(); + init_each3(); + init_filter3(); + init_find2(); + init_flatten(); + init_forEach(); + init_forIn(); + init_forOwn(); + init_has(); + init_isArray2(); + init_isEmpty2(); + init_isFunction(); + init_isUndefined(); + init_keys(); + init_last(); + init_map(); + init_mapValues(); + init_max2(); + init_merge5(); + init_min2(); + init_minBy(); + init_now(); + init_pick(); + init_range2(); + init_reduce(); + init_size3(); + init_sortBy(); + init_union(); + init_uniqueId(); + init_values(); + init_zipObject(); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/graph.js + function incrementOrInitEntry(map6, k2) { + if (map6[k2]) { + map6[k2]++; + } else { + map6[k2] = 1; + } + } + function decrementOrRemoveEntry(map6, k2) { + if (!--map6[k2]) { + delete map6[k2]; + } + } + function edgeArgsToId(isDirected, v_, w_, name) { + var v3 = "" + v_; + var w4 = "" + w_; + if (!isDirected && v3 > w4) { + var tmp = v3; + v3 = w4; + w4 = tmp; + } + return v3 + EDGE_KEY_DELIM + w4 + EDGE_KEY_DELIM + (isUndefined_default(name) ? DEFAULT_EDGE_NAME : name); + } + function edgeArgsToObj(isDirected, v_, w_, name) { + var v3 = "" + v_; + var w4 = "" + w_; + if (!isDirected && v3 > w4) { + var tmp = v3; + v3 = w4; + w4 = tmp; + } + var edgeObj = { v: v3, w: w4 }; + if (name) { + edgeObj.name = name; + } + return edgeObj; + } + function edgeObjToId(isDirected, edgeObj) { + return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name); + } + var DEFAULT_EDGE_NAME, GRAPH_NODE, EDGE_KEY_DELIM, Graph; + var init_graph = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/graph.js"() { + "use strict"; + init_lodash(); + DEFAULT_EDGE_NAME = "\0"; + GRAPH_NODE = "\0"; + EDGE_KEY_DELIM = ""; + Graph = class { + static { + __name(this, "Graph"); + } + /** + * @param {GraphOptions} [opts] - Graph options. + */ + constructor(opts = {}) { + this._isDirected = Object.prototype.hasOwnProperty.call(opts, "directed") ? opts.directed : true; + this._isMultigraph = Object.prototype.hasOwnProperty.call(opts, "multigraph") ? opts.multigraph : false; + this._isCompound = Object.prototype.hasOwnProperty.call(opts, "compound") ? opts.compound : false; + this._label = void 0; + this._defaultNodeLabelFn = constant_default7(void 0); + this._defaultEdgeLabelFn = constant_default7(void 0); + this._nodes = {}; + if (this._isCompound) { + this._parent = {}; + this._children = {}; + this._children[GRAPH_NODE] = {}; + } + this._in = {}; + this._preds = {}; + this._out = {}; + this._sucs = {}; + this._edgeObjs = {}; + this._edgeLabels = {}; + } + /* === Graph functions ========= */ + /** + * + * @returns {boolean} `true` if the graph is [directed](https://en.wikipedia.org/wiki/Directed_graph). + * A directed graph treats the order of nodes in an edge as significant whereas an + * [undirected](https://en.wikipedia.org/wiki/Graph_(mathematics)#Undirected_graph) + * graph does not. + * This example demonstrates the difference: + * + * @example + * + * ```js + * var directed = new Graph({ directed: true }); + * directed.setEdge("a", "b", "my-label"); + * directed.edge("a", "b"); // returns "my-label" + * directed.edge("b", "a"); // returns undefined + * + * var undirected = new Graph({ directed: false }); + * undirected.setEdge("a", "b", "my-label"); + * undirected.edge("a", "b"); // returns "my-label" + * undirected.edge("b", "a"); // returns "my-label" + * ``` + */ + isDirected() { + return this._isDirected; + } + /** + * @returns {boolean} `true` if the graph is a multigraph. + */ + isMultigraph() { + return this._isMultigraph; + } + /** + * @returns {boolean} `true` if the graph is compound. + */ + isCompound() { + return this._isCompound; + } + /** + * Sets the label for the graph to `label`. + * + * @param {GraphLabel} label - Label for the graph. + * @returns {this} + */ + setGraph(label) { + this._label = label; + return this; + } + /** + * @returns {GraphLabel | undefined} the currently assigned label for the graph. + * If no label has been assigned, returns `undefined`. + * + * @example + * + * ```js + * var g = new Graph(); + * g.graph(); // returns undefined + * g.setGraph("graph-label"); + * g.graph(); // returns "graph-label" + * ``` + */ + graph() { + return this._label; + } + /* === Node functions ========== */ + /** + * Sets a new default value that is assigned to nodes that are created without + * a label. + * + * @param {typeof this._defaultNodeLabelFn | NodeLabel} newDefault - If a function, + * it is called with the id of the node being created. + * Otherwise, it is assigned as the label directly. + * @returns {this} + */ + setDefaultNodeLabel(newDefault) { + if (!isFunction_default(newDefault)) { + newDefault = constant_default7(newDefault); + } + this._defaultNodeLabelFn = newDefault; + return this; + } + /** + * @returns {number} the number of nodes in the graph. + */ + nodeCount() { + return this._nodeCount; + } + /** + * @returns {NodeID[]} the ids of the nodes in the graph. + * + * @remarks + * Use {@link node()} to get the label for each node. + * Takes `O(|V|)` time. + */ + nodes() { + return keys_default(this._nodes); + } + /** + * @returns {NodeID[]} those nodes in the graph that have no in-edges. + * @remarks Takes `O(|V|)` time. + */ + sources() { + var self2 = this; + return filter_default3(this.nodes(), function(v3) { + return isEmpty_default(self2._in[v3]); + }); + } + /** + * @returns {NodeID[]} those nodes in the graph that have no out-edges. + * @remarks Takes `O(|V|)` time. + */ + sinks() { + var self2 = this; + return filter_default3(this.nodes(), function(v3) { + return isEmpty_default(self2._out[v3]); + }); + } + /** + * Invokes setNode method for each node in `vs` list. + * + * @param {Collection} vs - List of node IDs to create/set. + * @param {NodeLabel} [value] - If set, update all nodes with this value. + * @returns {this} + * @remarks Complexity: O(|names|). + */ + setNodes(vs, value2) { + var args = arguments; + var self2 = this; + forEach_default(vs, function(v3) { + if (args.length > 1) { + self2.setNode(v3, value2); + } else { + self2.setNode(v3); + } + }); + return this; + } + /** + * Creates or updates the value for the node `v` in the graph. + * + * @param {NodeID | number} v - ID of the node to create/set. + * @param {NodeLabel} [value] - If supplied, it is set as the value for the node. + * If not supplied and the node was created by this call then + * {@link setDefaultNodeLabel} will be used to set the node's value. + * @returns {this} the graph, allowing this to be chained with other functions. + * @remarks Takes `O(1)` time. + */ + setNode(v3, value2) { + if (Object.prototype.hasOwnProperty.call(this._nodes, v3)) { + if (arguments.length > 1) { + this._nodes[v3] = value2; + } + return this; + } + this._nodes[v3] = arguments.length > 1 ? value2 : this._defaultNodeLabelFn(v3); + if (this._isCompound) { + this._parent[v3] = GRAPH_NODE; + this._children[v3] = {}; + this._children[GRAPH_NODE][v3] = true; + } + this._in[v3] = {}; + this._preds[v3] = {}; + this._out[v3] = {}; + this._sucs[v3] = {}; + ++this._nodeCount; + return this; + } + /** + * Gets the label of node with specified name. + * + * @param {NodeID | number} v - Node ID. + * @returns {NodeLabel | undefined} the label assigned to the node with the id `v` + * if it is in the graph. + * Otherwise returns `undefined`. + * @remarks Takes `O(1)` time. + */ + node(v3) { + return this._nodes[v3]; + } + /** + * Detects whether graph has a node with specified name or not. + * + * @param {NodeID | number} v - Node ID. + * @returns {boolean} Returns `true` the graph has a node with the id. + * @remarks Takes `O(1)` time. + */ + hasNode(v3) { + return Object.prototype.hasOwnProperty.call(this._nodes, v3); + } + /** + * Remove the node with the id `v` in the graph or do nothing if the node is + * not in the graph. + * + * If the node was removed this function also removes any incident edges. + * + * @param {NodeID | number} v - Node ID to remove. + * @returns {this} the graph, allowing this to be chained with other functions. + * @remarks Takes `O(|E|)` time. + */ + removeNode(v3) { + if (Object.prototype.hasOwnProperty.call(this._nodes, v3)) { + var removeEdge = /* @__PURE__ */ __name((e3) => this.removeEdge(this._edgeObjs[e3]), "removeEdge"); + delete this._nodes[v3]; + if (this._isCompound) { + this._removeFromParentsChildList(v3); + delete this._parent[v3]; + forEach_default(this.children(v3), (child) => { + this.setParent(child); + }); + delete this._children[v3]; + } + forEach_default(keys_default(this._in[v3]), removeEdge); + delete this._in[v3]; + delete this._preds[v3]; + forEach_default(keys_default(this._out[v3]), removeEdge); + delete this._out[v3]; + delete this._sucs[v3]; + --this._nodeCount; + } + return this; + } + /** + * Sets the parent for `v` to `parent` if it is defined or removes the parent + * for `v` if `parent` is undefined. + * + * @param {NodeID | number} v - Node ID to set the parent for. + * @param {NodeID | number} [parent] - Parent node ID. If not defined, removes the parent. + * @returns {this} the graph, allowing this to be chained with other functions. + * @throws if the graph is not compound. + * @throws if setting the parent would create a cycle. + * @remarks Takes `O(1)` time. + */ + setParent(v3, parent4) { + if (!this._isCompound) { + throw new Error("Cannot set parent in a non-compound graph"); + } + if (isUndefined_default(parent4)) { + parent4 = GRAPH_NODE; + } else { + parent4 += ""; + for (var ancestor = parent4; !isUndefined_default(ancestor); ancestor = this.parent(ancestor)) { + if (ancestor === v3) { + throw new Error("Setting " + parent4 + " as parent of " + v3 + " would create a cycle"); + } + } + this.setNode(parent4); + } + this.setNode(v3); + this._removeFromParentsChildList(v3); + this._parent[v3] = parent4; + this._children[parent4][v3] = true; + return this; + } + /** + * @private + * @param {NodeID | number} v - Node ID. + */ + _removeFromParentsChildList(v3) { + delete this._children[this._parent[v3]][v3]; + } + /** + * Get parent node for node `v`. + * + * @param {NodeID | number} v - Node ID. + * @returns {NodeID | undefined} the node that is a parent of node `v` + * or `undefined` if node `v` does not have a parent or is not a member of + * the graph. + * Always returns `undefined` for graphs that are not compound. + * @remarks Takes `O(1)` time. + */ + parent(v3) { + if (this._isCompound) { + var parent4 = this._parent[v3]; + if (parent4 !== GRAPH_NODE) { + return parent4; + } + } + } + /** + * Gets list of direct children of node v. + * + * @param {NodeID | number} [v] - Node ID. If not specified, gets nodes + * with no parent (top-level nodes). + * @returns {NodeID[] | undefined} all nodes that are children of node `v` or + * `undefined` if node `v` is not in the graph. + * Always returns `[]` for graphs that are not compound. + * @remarks Takes `O(|V|)` time. + */ + children(v3) { + if (isUndefined_default(v3)) { + v3 = GRAPH_NODE; + } + if (this._isCompound) { + var children2 = this._children[v3]; + if (children2) { + return keys_default(children2); + } + } else if (v3 === GRAPH_NODE) { + return this.nodes(); + } else if (this.hasNode(v3)) { + return []; + } + } + /** + * @param {NodeID | number} v - Node ID. + * @returns {NodeID[] | undefined} all nodes that are predecessors of the + * specified node or `undefined` if node `v` is not in the graph. + * @remarks + * Behavior is undefined for undirected graphs - use {@link neighbors} instead. + * Takes `O(|V|)` time. + */ + predecessors(v3) { + var predsV = this._preds[v3]; + if (predsV) { + return keys_default(predsV); + } + } + /** + * @param {NodeID | number} v - Node ID. + * @returns {NodeID[] | undefined} all nodes that are successors of the + * specified node or `undefined` if node `v` is not in the graph. + * @remarks + * Behavior is undefined for undirected graphs - use {@link neighbors} instead. + * Takes `O(|V|)` time. + */ + successors(v3) { + var sucsV = this._sucs[v3]; + if (sucsV) { + return keys_default(sucsV); + } + } + /** + * @param {NodeID | number} v - Node ID. + * @returns {NodeID[] | undefined} all nodes that are predecessors or + * successors of the specified node + * or `undefined` if node `v` is not in the graph. + * @remarks Takes `O(|V|)` time. + */ + neighbors(v3) { + var preds = this.predecessors(v3); + if (preds) { + return union_default(preds, this.successors(v3)); + } + } + /** + * @param {NodeID | number} v - Node ID. + * @returns {boolean} True if the node is a leaf (has no successors), false otherwise. + */ + isLeaf(v3) { + var neighbors; + if (this.isDirected()) { + neighbors = this.successors(v3); + } else { + neighbors = this.neighbors(v3); + } + return neighbors.length === 0; + } + /** + * Creates new graph with nodes filtered via `filter`. + * Edges incident to rejected node + * are also removed. + * + * In case of compound graph, if parent is rejected by `filter`, + * than all its children are rejected too. + + * @param {(v: NodeID) => boolean} filter - Function that returns `true` for nodes to keep. + * @returns {Graph} A new graph containing only the nodes for which `filter` returns `true`. + * @remarks Average-case complexity: O(|E|+|V|). + */ + filterNodes(filter8) { + var copy5 = new this.constructor({ + directed: this._isDirected, + multigraph: this._isMultigraph, + compound: this._isCompound + }); + copy5.setGraph(this.graph()); + var self2 = this; + forEach_default(this._nodes, function(value2, v3) { + if (filter8(v3)) { + copy5.setNode(v3, value2); + } + }); + forEach_default(this._edgeObjs, function(e3) { + if (copy5.hasNode(e3.v) && copy5.hasNode(e3.w)) { + copy5.setEdge(e3, self2.edge(e3)); + } + }); + var parents3 = {}; + function findParent(v3) { + var parent4 = self2.parent(v3); + if (parent4 === void 0 || copy5.hasNode(parent4)) { + parents3[v3] = parent4; + return parent4; + } else if (parent4 in parents3) { + return parents3[parent4]; + } else { + return findParent(parent4); + } + } + __name(findParent, "findParent"); + if (this._isCompound) { + forEach_default(copy5.nodes(), function(v3) { + copy5.setParent(v3, findParent(v3)); + }); + } + return copy5; + } + /* === Edge functions ========== */ + /** + * Sets a new default value that is assigned to edges that are created without + * a label. + * + * @param {typeof this._defaultEdgeLabelFn | EdgeLabel} newDefault - If a function, + * it is called with the parameters `(v, w, name)`. + * Otherwise, it is assigned as the label directly. + * @returns {this} + */ + setDefaultEdgeLabel(newDefault) { + if (!isFunction_default(newDefault)) { + newDefault = constant_default7(newDefault); + } + this._defaultEdgeLabelFn = newDefault; + return this; + } + /** + * @returns {number} the number of edges in the graph. + * @remarks Complexity: O(1). + */ + edgeCount() { + return this._edgeCount; + } + /** + * Gets edges of the graph. + * + * @returns {EdgeObj[]} the {@link EdgeObj} for each edge in the graph. + * + * @remarks + * In case of compound graph subgraphs are not considered. + * Use {@link edge()} to get the label for each edge. + * Takes `O(|E|)` time. + */ + edges() { + return values_default(this._edgeObjs); + } + /** + * Establish an edges path over the nodes in nodes list. + * + * If some edge is already exists, it will update its label, otherwise it will + * create an edge between pair of nodes with label provided or default label + * if no label provided. + * + * @param {Collection} vs - List of node IDs to create edges between. + * @param {EdgeLabel} [value] - If set, update all edges with this value. + * @returns {this} + * @remarks Complexity: O(|nodes|). + */ + setPath(vs, value2) { + var self2 = this; + var args = arguments; + reduce_default(vs, function(v3, w4) { + if (args.length > 1) { + self2.setEdge(v3, w4, value2); + } else { + self2.setEdge(v3, w4); + } + return w4; + }); + return this; + } + /** + * Creates or updates the label for the edge (`v`, `w`) with the optionally + * supplied `name`. + * + * @overload + * @param {EdgeObj} arg0 - Edge object. + * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge. + * If not supplied and the edge was created by this call then + * {@link setDefaultEdgeLabel} will be used to assign the edge's label. + * @returns {this} the graph, allowing this to be chained with other functions. + * @remarks Takes `O(1)` time. + */ + /** + * Creates or updates the label for the edge (`v`, `w`) with the optionally + * supplied `name`. + * + * @overload + * @param {NodeID | number} v - Source node ID. Number values will be coerced to strings. + * @param {NodeID | number} w - Target node ID. Number values will be coerced to strings. + * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge. + * If not supplied and the edge was created by this call then + * {@link setDefaultEdgeLabel} will be used to assign the edge's label. + * @param {string | number} [name] - Edge name. Only useful with multigraphs. + * @returns {this} the graph, allowing this to be chained with other functions. + * @remarks Takes `O(1)` time. + */ + setEdge() { + var v3, w4, name, value2; + var valueSpecified = false; + var arg0 = arguments[0]; + if (typeof arg0 === "object" && arg0 !== null && "v" in arg0) { + v3 = arg0.v; + w4 = arg0.w; + name = arg0.name; + if (arguments.length === 2) { + value2 = arguments[1]; + valueSpecified = true; + } + } else { + v3 = arg0; + w4 = arguments[1]; + name = arguments[3]; + if (arguments.length > 2) { + value2 = arguments[2]; + valueSpecified = true; + } + } + v3 = "" + v3; + w4 = "" + w4; + if (!isUndefined_default(name)) { + name = "" + name; + } + var e3 = edgeArgsToId(this._isDirected, v3, w4, name); + if (Object.prototype.hasOwnProperty.call(this._edgeLabels, e3)) { + if (valueSpecified) { + this._edgeLabels[e3] = value2; + } + return this; + } + if (!isUndefined_default(name) && !this._isMultigraph) { + throw new Error("Cannot set a named edge when isMultigraph = false"); + } + this.setNode(v3); + this.setNode(w4); + this._edgeLabels[e3] = valueSpecified ? value2 : this._defaultEdgeLabelFn(v3, w4, name); + var edgeObj = edgeArgsToObj(this._isDirected, v3, w4, name); + v3 = edgeObj.v; + w4 = edgeObj.w; + Object.freeze(edgeObj); + this._edgeObjs[e3] = edgeObj; + incrementOrInitEntry(this._preds[w4], v3); + incrementOrInitEntry(this._sucs[v3], w4); + this._in[w4][e3] = edgeObj; + this._out[v3][e3] = edgeObj; + this._edgeCount++; + return this; + } + /** + * Gets the label for the specified edge. + * + * @overload + * @param {EdgeObj} v - Edge object. + * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the + * graph has an edge between `v` and `w` with the optional `name`. + * Returned `undefined` if there is no such edge in the graph. + * @remarks + * `v` and `w` can be interchanged for undirected graphs. + * Takes `O(1)` time. + */ + /** + * Gets the label for the specified edge. + * + * @overload + * @param {NodeID | number} v - Source node ID. + * @param {NodeID | number} w - Target node ID. + * @param {string | number} [name] - Edge name. Only useful with multigraphs. + * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the + * graph has an edge between `v` and `w` with the optional `name`. + * Returned `undefined` if there is no such edge in the graph. + * @remarks + * `v` and `w` can be interchanged for undirected graphs. + * Takes `O(1)` time. + */ + edge(v3, w4, name) { + var e3 = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v3, w4, name); + return this._edgeLabels[e3]; + } + /** + * Detects whether the graph contains specified edge or not. + * + * @overload + * @param {EdgeObj} v - Edge object. + * @returns {boolean} `true` if the graph has an edge between `v` and `w` + * with the optional `name`. + * @remarks + * `v` and `w` can be interchanged for undirected graphs. + * No subgraphs are considered. + * Takes `O(1)` time. + */ + /** + * Detects whether the graph contains specified edge or not. + * + * @overload + * @param {NodeID | number} v - Source node ID. + * @param {NodeID | number} w - Target node ID. + * @param {string | number} [name] - Edge name. Only useful with multigraphs. + * @returns {boolean} `true` if the graph has an edge between `v` and `w` + * with the optional `name`. + * @remarks + * `v` and `w` can be interchanged for undirected graphs. + * No subgraphs are considered. + * Takes `O(1)` time. + */ + hasEdge(v3, w4, name) { + var e3 = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v3, w4, name); + return Object.prototype.hasOwnProperty.call(this._edgeLabels, e3); + } + /** + * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w` + * with the optional `name`. If not this function does nothing. + * + * @overload + * @param {EdgeObj} v - Edge object. + * @returns {this} + * @remarks + * `v` and `w` can be interchanged for undirected graphs. + * No subgraphs are considered. + * Takes `O(1)` time. + */ + /** + * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w` + * with the optional `name`. If not this function does nothing. + * + * @overload + * @param {NodeID | number} v - Source node ID. + * @param {NodeID | number} w - Target node ID. + * @param {string | number} [name] - Edge name. Only useful with multigraphs. + * @returns {this} + * @remarks + * `v` and `w` can be interchanged for undirected graphs. + * Takes `O(1)` time. + */ + removeEdge(v3, w4, name) { + var e3 = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v3, w4, name); + var edge = this._edgeObjs[e3]; + if (edge) { + v3 = edge.v; + w4 = edge.w; + delete this._edgeLabels[e3]; + delete this._edgeObjs[e3]; + decrementOrRemoveEntry(this._preds[w4], v3); + decrementOrRemoveEntry(this._sucs[v3], w4); + delete this._in[w4][e3]; + delete this._out[v3][e3]; + this._edgeCount--; + } + return this; + } + /** + * @param {NodeID | number} v - Target node ID. + * @param {NodeID | number} [u] - Optionally filters edges down to just those + * coming from node `u`. + * @returns {EdgeObj[] | undefined} all edges that point to the node `v`. + * Returns `undefined` if node `v` is not in the graph. + * @remarks + * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead. + * Takes `O(|E|)` time. + */ + inEdges(v3, u2) { + var inV = this._in[v3]; + if (inV) { + var edges3 = values_default(inV); + if (!u2) { + return edges3; + } + return filter_default3(edges3, function(edge) { + return edge.v === u2; + }); + } + } + /** + * @param {NodeID | number} v - Target node ID. + * @param {NodeID | number} [w] - Optionally filters edges down to just those + * that point to `w`. + * @returns {EdgeObj[] | undefined} all edges that point to the node `v`. + * Returns `undefined` if node `v` is not in the graph. + * @remarks + * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead. + * Takes `O(|E|)` time. + */ + outEdges(v3, w4) { + var outV = this._out[v3]; + if (outV) { + var edges3 = values_default(outV); + if (!w4) { + return edges3; + } + return filter_default3(edges3, function(edge) { + return edge.w === w4; + }); + } + } + /** + * @param {NodeID | number} v - Target Node ID. + * @param {NodeID | number} [w] - If set, filters those edges down to just + * those between nodes `v` and `w` regardless of direction + * @returns {EdgeObj[] | undefined} all edges to or from node `v` regardless + * of direction. Returns `undefined` if node `v` is not in the graph. + * @remarks Takes `O(|E|)` time. + */ + nodeEdges(v3, w4) { + var inEdges = this.inEdges(v3, w4); + if (inEdges) { + return inEdges.concat(this.outEdges(v3, w4)); + } + } + }; + Graph.prototype._nodeCount = 0; + Graph.prototype._edgeCount = 0; + __name(incrementOrInitEntry, "incrementOrInitEntry"); + __name(decrementOrRemoveEntry, "decrementOrRemoveEntry"); + __name(edgeArgsToId, "edgeArgsToId"); + __name(edgeArgsToObj, "edgeArgsToObj"); + __name(edgeObjToId, "edgeObjToId"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/index.js + var init_graphlib = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/index.js"() { + "use strict"; + init_graph(); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/data/list.js + function unlink(entry) { + entry._prev._next = entry._next; + entry._next._prev = entry._prev; + delete entry._next; + delete entry._prev; + } + function filterOutLinks(k2, v3) { + if (k2 !== "_next" && k2 !== "_prev") { + return v3; + } + } + var List; + var init_list = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/data/list.js"() { + "use strict"; + List = class { + static { + __name(this, "List"); + } + constructor() { + var sentinel = {}; + sentinel._next = sentinel._prev = sentinel; + this._sentinel = sentinel; + } + dequeue() { + var sentinel = this._sentinel; + var entry = sentinel._prev; + if (entry !== sentinel) { + unlink(entry); + return entry; + } + } + enqueue(entry) { + var sentinel = this._sentinel; + if (entry._prev && entry._next) { + unlink(entry); + } + entry._next = sentinel._next; + sentinel._next._prev = entry; + sentinel._next = entry; + entry._prev = sentinel; + } + toString() { + var strs = []; + var sentinel = this._sentinel; + var curr = sentinel._prev; + while (curr !== sentinel) { + strs.push(JSON.stringify(curr, filterOutLinks)); + curr = curr._prev; + } + return "[" + strs.join(", ") + "]"; + } + }; + __name(unlink, "unlink"); + __name(filterOutLinks, "filterOutLinks"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/greedy-fas.js + function greedyFAS(g2, weightFn) { + if (g2.nodeCount() <= 1) { + return []; + } + var state4 = buildState(g2, weightFn || DEFAULT_WEIGHT_FN); + var results = doGreedyFAS(state4.graph, state4.buckets, state4.zeroIdx); + return flatten_default( + map_default(results, function(e3) { + return g2.outEdges(e3.v, e3.w); + }) + ); + } + function doGreedyFAS(g2, buckets, zeroIdx) { + var results = []; + var sources = buckets[buckets.length - 1]; + var sinks = buckets[0]; + var entry; + while (g2.nodeCount()) { + while (entry = sinks.dequeue()) { + removeNode(g2, buckets, zeroIdx, entry); + } + while (entry = sources.dequeue()) { + removeNode(g2, buckets, zeroIdx, entry); + } + if (g2.nodeCount()) { + for (var i2 = buckets.length - 2; i2 > 0; --i2) { + entry = buckets[i2].dequeue(); + if (entry) { + results = results.concat(removeNode(g2, buckets, zeroIdx, entry, true)); + break; + } + } + } + } + return results; + } + function removeNode(g2, buckets, zeroIdx, entry, collectPredecessors) { + var results = collectPredecessors ? [] : void 0; + forEach_default(g2.inEdges(entry.v), function(edge) { + var weight8 = g2.edge(edge); + var uEntry = g2.node(edge.v); + if (collectPredecessors) { + results.push({ v: edge.v, w: edge.w }); + } + uEntry.out -= weight8; + assignBucket(buckets, zeroIdx, uEntry); + }); + forEach_default(g2.outEdges(entry.v), function(edge) { + var weight8 = g2.edge(edge); + var w4 = edge.w; + var wEntry = g2.node(w4); + wEntry["in"] -= weight8; + assignBucket(buckets, zeroIdx, wEntry); + }); + g2.removeNode(entry.v); + return results; + } + function buildState(g2, weightFn) { + var fasGraph = new Graph(); + var maxIn = 0; + var maxOut = 0; + forEach_default(g2.nodes(), function(v3) { + fasGraph.setNode(v3, { v: v3, in: 0, out: 0 }); + }); + forEach_default(g2.edges(), function(e3) { + var prevWeight = fasGraph.edge(e3.v, e3.w) || 0; + var weight8 = weightFn(e3); + var edgeWeight = prevWeight + weight8; + fasGraph.setEdge(e3.v, e3.w, edgeWeight); + maxOut = Math.max(maxOut, fasGraph.node(e3.v).out += weight8); + maxIn = Math.max(maxIn, fasGraph.node(e3.w)["in"] += weight8); + }); + var buckets = range_default(maxOut + maxIn + 3).map(function() { + return new List(); + }); + var zeroIdx = maxIn + 1; + forEach_default(fasGraph.nodes(), function(v3) { + assignBucket(buckets, zeroIdx, fasGraph.node(v3)); + }); + return { graph: fasGraph, buckets, zeroIdx }; + } + function assignBucket(buckets, zeroIdx, entry) { + if (!entry.out) { + buckets[0].enqueue(entry); + } else if (!entry["in"]) { + buckets[buckets.length - 1].enqueue(entry); + } else { + buckets[entry.out - entry["in"] + zeroIdx].enqueue(entry); + } + } + var DEFAULT_WEIGHT_FN; + var init_greedy_fas = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/greedy-fas.js"() { + "use strict"; + init_lodash(); + init_graphlib(); + init_list(); + DEFAULT_WEIGHT_FN = constant_default7(1); + __name(greedyFAS, "greedyFAS"); + __name(doGreedyFAS, "doGreedyFAS"); + __name(removeNode, "removeNode"); + __name(buildState, "buildState"); + __name(assignBucket, "assignBucket"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/acyclic.js + function run(g2) { + var fas = g2.graph().acyclicer === "greedy" ? greedyFAS(g2, weightFn(g2)) : dfsFAS(g2); + forEach_default(fas, function(e3) { + var label = g2.edge(e3); + g2.removeEdge(e3); + label.forwardName = e3.name; + label.reversed = true; + g2.setEdge(e3.w, e3.v, label, uniqueId_default("rev")); + }); + function weightFn(g3) { + return function(e3) { + return g3.edge(e3).weight; + }; + } + __name(weightFn, "weightFn"); + } + function dfsFAS(g2) { + var fas = []; + var stack = {}; + var visited = {}; + function dfs3(v3) { + if (Object.prototype.hasOwnProperty.call(visited, v3)) { + return; + } + visited[v3] = true; + stack[v3] = true; + forEach_default(g2.outEdges(v3), function(e3) { + if (Object.prototype.hasOwnProperty.call(stack, e3.w)) { + fas.push(e3); + } else { + dfs3(e3.w); + } + }); + delete stack[v3]; + } + __name(dfs3, "dfs"); + forEach_default(g2.nodes(), dfs3); + return fas; + } + function undo(g2) { + forEach_default(g2.edges(), function(e3) { + var label = g2.edge(e3); + if (label.reversed) { + g2.removeEdge(e3); + var forwardName = label.forwardName; + delete label.reversed; + delete label.forwardName; + g2.setEdge(e3.w, e3.v, label, forwardName); + } + }); + } + var init_acyclic = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/acyclic.js"() { + "use strict"; + init_lodash(); + init_greedy_fas(); + __name(run, "run"); + __name(dfsFAS, "dfsFAS"); + __name(undo, "undo"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/util.js + function addDummyNode(g2, type3, attrs, name) { + var v3; + do { + v3 = uniqueId_default(name); + } while (g2.hasNode(v3)); + attrs.dummy = type3; + g2.setNode(v3, attrs); + return v3; + } + function simplify(g2) { + var simplified = new Graph().setGraph(g2.graph()); + forEach_default(g2.nodes(), function(v3) { + simplified.setNode(v3, g2.node(v3)); + }); + forEach_default(g2.edges(), function(e3) { + var simpleLabel = simplified.edge(e3.v, e3.w) || { weight: 0, minlen: 1 }; + var label = g2.edge(e3); + simplified.setEdge(e3.v, e3.w, { + weight: simpleLabel.weight + label.weight, + minlen: Math.max(simpleLabel.minlen, label.minlen) + }); + }); + return simplified; + } + function asNonCompoundGraph(g2) { + var simplified = new Graph({ multigraph: g2.isMultigraph() }).setGraph(g2.graph()); + forEach_default(g2.nodes(), function(v3) { + if (!g2.children(v3).length) { + simplified.setNode(v3, g2.node(v3)); + } + }); + forEach_default(g2.edges(), function(e3) { + simplified.setEdge(e3, g2.edge(e3)); + }); + return simplified; + } + function intersectRect2(rect3, point8) { + var x5 = rect3.x; + var y6 = rect3.y; + var dx = point8.x - x5; + var dy = point8.y - y6; + var w4 = rect3.width / 2; + var h3 = rect3.height / 2; + if (!dx && !dy) { + throw new Error("Not possible to find intersection inside of the rectangle"); + } + var sx, sy; + if (Math.abs(dy) * w4 > Math.abs(dx) * h3) { + if (dy < 0) { + h3 = -h3; + } + sx = h3 * dx / dy; + sy = h3; + } else { + if (dx < 0) { + w4 = -w4; + } + sx = w4; + sy = w4 * dy / dx; + } + return { x: x5 + sx, y: y6 + sy }; + } + function buildLayerMatrix(g2) { + var layering = map_default(range_default(maxRank(g2) + 1), function() { + return []; + }); + forEach_default(g2.nodes(), function(v3) { + var node2 = g2.node(v3); + var rank2 = node2.rank; + if (!isUndefined_default(rank2)) { + layering[rank2][node2.order] = v3; + } + }); + return layering; + } + function normalizeRanks(g2) { + var min10 = min_default( + map_default(g2.nodes(), function(v3) { + return g2.node(v3).rank; + }) + ); + forEach_default(g2.nodes(), function(v3) { + var node2 = g2.node(v3); + if (has_default(node2, "rank")) { + node2.rank -= min10; + } + }); + } + function removeEmptyRanks(g2) { + var offset = min_default( + map_default(g2.nodes(), function(v3) { + return g2.node(v3).rank; + }) + ); + var layers = []; + forEach_default(g2.nodes(), function(v3) { + var rank2 = g2.node(v3).rank - offset; + if (!layers[rank2]) { + layers[rank2] = []; + } + layers[rank2].push(v3); + }); + var delta = 0; + var nodeRankFactor = g2.graph().nodeRankFactor; + forEach_default(layers, function(vs, i2) { + if (isUndefined_default(vs) && i2 % nodeRankFactor !== 0) { + --delta; + } else if (delta) { + forEach_default(vs, function(v3) { + g2.node(v3).rank += delta; + }); + } + }); + } + function addBorderNode(g2, prefix, rank2, order2) { + var node2 = { + width: 0, + height: 0 + }; + if (arguments.length >= 4) { + node2.rank = rank2; + node2.order = order2; + } + return addDummyNode(g2, "border", node2, prefix); + } + function maxRank(g2) { + return max_default( + map_default(g2.nodes(), function(v3) { + var rank2 = g2.node(v3).rank; + if (!isUndefined_default(rank2)) { + return rank2; + } + }) + ); + } + function partition(collection4, fn3) { + var result = { lhs: [], rhs: [] }; + forEach_default(collection4, function(value2) { + if (fn3(value2)) { + result.lhs.push(value2); + } else { + result.rhs.push(value2); + } + }); + return result; + } + function time2(name, fn3) { + var start3 = now_default(); + try { + return fn3(); + } finally { + console.log(name + " time: " + (now_default() - start3) + "ms"); + } + } + function notime(name, fn3) { + return fn3(); + } + var init_util2 = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/util.js"() { + "use strict"; + init_lodash(); + init_graphlib(); + __name(addDummyNode, "addDummyNode"); + __name(simplify, "simplify"); + __name(asNonCompoundGraph, "asNonCompoundGraph"); + __name(intersectRect2, "intersectRect"); + __name(buildLayerMatrix, "buildLayerMatrix"); + __name(normalizeRanks, "normalizeRanks"); + __name(removeEmptyRanks, "removeEmptyRanks"); + __name(addBorderNode, "addBorderNode"); + __name(maxRank, "maxRank"); + __name(partition, "partition"); + __name(time2, "time"); + __name(notime, "notime"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/add-border-segments.js + function addBorderSegments(g2) { + function dfs3(v3) { + var children2 = g2.children(v3); + var node2 = g2.node(v3); + if (children2.length) { + forEach_default(children2, dfs3); + } + if (Object.prototype.hasOwnProperty.call(node2, "minRank")) { + node2.borderLeft = []; + node2.borderRight = []; + for (var rank2 = node2.minRank, maxRank2 = node2.maxRank + 1; rank2 < maxRank2; ++rank2) { + addBorderNode2(g2, "borderLeft", "_bl", v3, node2, rank2); + addBorderNode2(g2, "borderRight", "_br", v3, node2, rank2); + } + } + } + __name(dfs3, "dfs"); + forEach_default(g2.children(), dfs3); + } + function addBorderNode2(g2, prop, prefix, sg, sgNode, rank2) { + var label = { width: 0, height: 0, rank: rank2, borderType: prop }; + var prev2 = sgNode[prop][rank2 - 1]; + var curr = addDummyNode(g2, "border", label, prefix); + sgNode[prop][rank2] = curr; + g2.setParent(curr, sg); + if (prev2) { + g2.setEdge(prev2, curr, { weight: 1 }); + } + } + var init_add_border_segments = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/add-border-segments.js"() { + "use strict"; + init_lodash(); + init_util2(); + __name(addBorderSegments, "addBorderSegments"); + __name(addBorderNode2, "addBorderNode"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/coordinate-system.js + function adjust2(g2) { + var rankDir = g2.graph().rankdir.toLowerCase(); + if (rankDir === "lr" || rankDir === "rl") { + swapWidthHeight(g2); + } + } + function undo2(g2) { + var rankDir = g2.graph().rankdir.toLowerCase(); + if (rankDir === "bt" || rankDir === "rl") { + reverseY(g2); + } + if (rankDir === "lr" || rankDir === "rl") { + swapXY(g2); + swapWidthHeight(g2); + } + } + function swapWidthHeight(g2) { + forEach_default(g2.nodes(), function(v3) { + swapWidthHeightOne(g2.node(v3)); + }); + forEach_default(g2.edges(), function(e3) { + swapWidthHeightOne(g2.edge(e3)); + }); + } + function swapWidthHeightOne(attrs) { + var w4 = attrs.width; + attrs.width = attrs.height; + attrs.height = w4; + } + function reverseY(g2) { + forEach_default(g2.nodes(), function(v3) { + reverseYOne(g2.node(v3)); + }); + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + forEach_default(edge.points, reverseYOne); + if (Object.prototype.hasOwnProperty.call(edge, "y")) { + reverseYOne(edge); + } + }); + } + function reverseYOne(attrs) { + attrs.y = -attrs.y; + } + function swapXY(g2) { + forEach_default(g2.nodes(), function(v3) { + swapXYOne(g2.node(v3)); + }); + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + forEach_default(edge.points, swapXYOne); + if (Object.prototype.hasOwnProperty.call(edge, "x")) { + swapXYOne(edge); + } + }); + } + function swapXYOne(attrs) { + var x5 = attrs.x; + attrs.x = attrs.y; + attrs.y = x5; + } + var init_coordinate_system = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/coordinate-system.js"() { + "use strict"; + init_lodash(); + __name(adjust2, "adjust"); + __name(undo2, "undo"); + __name(swapWidthHeight, "swapWidthHeight"); + __name(swapWidthHeightOne, "swapWidthHeightOne"); + __name(reverseY, "reverseY"); + __name(reverseYOne, "reverseYOne"); + __name(swapXY, "swapXY"); + __name(swapXYOne, "swapXYOne"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/normalize.js + function run2(g2) { + g2.graph().dummyChains = []; + forEach_default(g2.edges(), function(edge) { + normalizeEdge(g2, edge); + }); + } + function normalizeEdge(g2, e3) { + var v3 = e3.v; + var vRank = g2.node(v3).rank; + var w4 = e3.w; + var wRank = g2.node(w4).rank; + var name = e3.name; + var edgeLabel = g2.edge(e3); + var labelRank = edgeLabel.labelRank; + if (wRank === vRank + 1) return; + g2.removeEdge(e3); + var attrs = void 0; + var dummy, i2; + for (i2 = 0, ++vRank; vRank < wRank; ++i2, ++vRank) { + edgeLabel.points = []; + attrs = { + width: 0, + height: 0, + edgeLabel, + edgeObj: e3, + rank: vRank + }; + dummy = addDummyNode(g2, "edge", attrs, "_d"); + if (vRank === labelRank) { + attrs.width = edgeLabel.width; + attrs.height = edgeLabel.height; + attrs.dummy = "edge-label"; + attrs.labelpos = edgeLabel.labelpos; + } + g2.setEdge(v3, dummy, { weight: edgeLabel.weight }, name); + if (i2 === 0) { + g2.graph().dummyChains.push(dummy); + } + v3 = dummy; + } + g2.setEdge(v3, w4, { weight: edgeLabel.weight }, name); + } + function undo3(g2) { + forEach_default(g2.graph().dummyChains, function(v3) { + var node2 = g2.node(v3); + var origLabel = node2.edgeLabel; + var w4; + g2.setEdge(node2.edgeObj, origLabel); + while (node2.dummy) { + w4 = g2.successors(v3)[0]; + g2.removeNode(v3); + origLabel.points.push({ x: node2.x, y: node2.y }); + if (node2.dummy === "edge-label") { + origLabel.x = node2.x; + origLabel.y = node2.y; + origLabel.width = node2.width; + origLabel.height = node2.height; + } + v3 = w4; + node2 = g2.node(v3); + } + }); + } + var init_normalize = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/normalize.js"() { + "use strict"; + init_lodash(); + init_util2(); + __name(run2, "run"); + __name(normalizeEdge, "normalizeEdge"); + __name(undo3, "undo"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/util.js + function longestPath(g2) { + var visited = {}; + function dfs3(v3) { + var label = g2.node(v3); + if (Object.prototype.hasOwnProperty.call(visited, v3)) { + return label.rank; + } + visited[v3] = true; + var rank2 = min_default( + map_default(g2.outEdges(v3), function(e3) { + return dfs3(e3.w) - g2.edge(e3).minlen; + }) + ); + if (rank2 === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3 + rank2 === void 0 || // return value of _.map([]) for Lodash 4 + rank2 === null) { + rank2 = 0; + } + return label.rank = rank2; + } + __name(dfs3, "dfs"); + forEach_default(g2.sources(), dfs3); + } + function slack(g2, e3) { + return g2.node(e3.w).rank - g2.node(e3.v).rank - g2.edge(e3).minlen; + } + var init_util3 = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/util.js"() { + "use strict"; + init_lodash(); + __name(longestPath, "longestPath"); + __name(slack, "slack"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/feasible-tree.js + function feasibleTree(g2) { + var t4 = new Graph({ directed: false }); + var start3 = g2.nodes()[0]; + var size4 = g2.nodeCount(); + t4.setNode(start3, {}); + var edge, delta; + while (tightTree(t4, g2) < size4) { + edge = findMinSlackEdge(t4, g2); + delta = t4.hasNode(edge.v) ? slack(g2, edge) : -slack(g2, edge); + shiftRanks(t4, g2, delta); + } + return t4; + } + function tightTree(t4, g2) { + function dfs3(v3) { + forEach_default(g2.nodeEdges(v3), function(e3) { + var edgeV = e3.v, w4 = v3 === edgeV ? e3.w : edgeV; + if (!t4.hasNode(w4) && !slack(g2, e3)) { + t4.setNode(w4, {}); + t4.setEdge(v3, w4, {}); + dfs3(w4); + } + }); + } + __name(dfs3, "dfs"); + forEach_default(t4.nodes(), dfs3); + return t4.nodeCount(); + } + function findMinSlackEdge(t4, g2) { + return minBy_default(g2.edges(), function(e3) { + if (t4.hasNode(e3.v) !== t4.hasNode(e3.w)) { + return slack(g2, e3); + } + }); + } + function shiftRanks(t4, g2, delta) { + forEach_default(t4.nodes(), function(v3) { + g2.node(v3).rank += delta; + }); + } + var init_feasible_tree = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/feasible-tree.js"() { + "use strict"; + init_lodash(); + init_graphlib(); + init_util3(); + __name(feasibleTree, "feasibleTree"); + __name(tightTree, "tightTree"); + __name(findMinSlackEdge, "findMinSlackEdge"); + __name(shiftRanks, "shiftRanks"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/components.js + var init_components = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/components.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/data/priority-queue.js + var init_priority_queue = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/data/priority-queue.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dijkstra.js + var DEFAULT_WEIGHT_FUNC; + var init_dijkstra = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dijkstra.js"() { + "use strict"; + init_lodash(); + init_priority_queue(); + DEFAULT_WEIGHT_FUNC = constant_default7(1); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dijkstra-all.js + var init_dijkstra_all = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dijkstra-all.js"() { + "use strict"; + init_dijkstra(); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/tarjan.js + var init_tarjan = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/tarjan.js"() { + "use strict"; + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/find-cycles.js + var init_find_cycles = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/find-cycles.js"() { + "use strict"; + init_tarjan(); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/floyd-warshall.js + var DEFAULT_WEIGHT_FUNC2; + var init_floyd_warshall = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/floyd-warshall.js"() { + "use strict"; + init_lodash(); + DEFAULT_WEIGHT_FUNC2 = constant_default7(1); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/topsort.js + function topsort(g2) { + var visited = {}; + var stack = {}; + var results = []; + function visit(node2) { + if (Object.prototype.hasOwnProperty.call(stack, node2)) { + throw new CycleException(); + } + if (!Object.prototype.hasOwnProperty.call(visited, node2)) { + stack[node2] = true; + visited[node2] = true; + forEach_default(g2.predecessors(node2), visit); + delete stack[node2]; + results.push(node2); + } + } + __name(visit, "visit"); + forEach_default(g2.sinks(), visit); + if (size_default2(visited) !== g2.nodeCount()) { + throw new CycleException(); + } + return results; + } + function CycleException() { + } + var init_topsort = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/topsort.js"() { + "use strict"; + init_lodash(); + topsort.CycleException = CycleException; + __name(topsort, "topsort"); + __name(CycleException, "CycleException"); + CycleException.prototype = new Error(); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/is-acyclic.js + var init_is_acyclic = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/is-acyclic.js"() { + "use strict"; + init_topsort(); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dfs.js + function dfs(g2, vs, order2) { + if (!isArray_default(vs)) { + vs = [vs]; + } + var navigation = (g2.isDirected() ? g2.successors : g2.neighbors).bind(g2); + var acc = []; + var visited = {}; + forEach_default(vs, function(v3) { + if (!g2.hasNode(v3)) { + throw new Error("Graph does not have node: " + v3); + } + doDfs(g2, v3, order2 === "post", visited, navigation, acc); + }); + return acc; + } + function doDfs(g2, v3, postorder3, visited, navigation, acc) { + if (!Object.prototype.hasOwnProperty.call(visited, v3)) { + visited[v3] = true; + if (!postorder3) { + acc.push(v3); + } + forEach_default(navigation(v3), function(w4) { + doDfs(g2, w4, postorder3, visited, navigation, acc); + }); + if (postorder3) { + acc.push(v3); + } + } + } + var init_dfs = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/dfs.js"() { + "use strict"; + init_lodash(); + __name(dfs, "dfs"); + __name(doDfs, "doDfs"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/postorder.js + function postorder(g2, vs) { + return dfs(g2, vs, "post"); + } + var init_postorder = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/postorder.js"() { + "use strict"; + init_dfs(); + __name(postorder, "postorder"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/preorder.js + function preorder(g2, vs) { + return dfs(g2, vs, "pre"); + } + var init_preorder = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/preorder.js"() { + "use strict"; + init_dfs(); + __name(preorder, "preorder"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/prim.js + var init_prim = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/prim.js"() { + "use strict"; + init_priority_queue(); + init_graph(); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/index.js + var init_alg = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/alg/index.js"() { + "use strict"; + init_components(); + init_dijkstra(); + init_dijkstra_all(); + init_find_cycles(); + init_floyd_warshall(); + init_is_acyclic(); + init_postorder(); + init_preorder(); + init_prim(); + init_tarjan(); + init_topsort(); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js + function networkSimplex(g2) { + g2 = simplify(g2); + longestPath(g2); + var t4 = feasibleTree(g2); + initLowLimValues(t4); + initCutValues(t4, g2); + var e3, f2; + while (e3 = leaveEdge(t4)) { + f2 = enterEdge(t4, g2, e3); + exchangeEdges(t4, g2, e3, f2); + } + } + function initCutValues(t4, g2) { + var vs = postorder(t4, t4.nodes()); + vs = vs.slice(0, vs.length - 1); + forEach_default(vs, function(v3) { + assignCutValue(t4, g2, v3); + }); + } + function assignCutValue(t4, g2, child) { + var childLab = t4.node(child); + var parent4 = childLab.parent; + t4.edge(child, parent4).cutvalue = calcCutValue(t4, g2, child); + } + function calcCutValue(t4, g2, child) { + var childLab = t4.node(child); + var parent4 = childLab.parent; + var childIsTail = true; + var graphEdge = g2.edge(child, parent4); + var cutValue = 0; + if (!graphEdge) { + childIsTail = false; + graphEdge = g2.edge(parent4, child); + } + cutValue = graphEdge.weight; + forEach_default(g2.nodeEdges(child), function(e3) { + var isOutEdge = e3.v === child, other = isOutEdge ? e3.w : e3.v; + if (other !== parent4) { + var pointsToHead = isOutEdge === childIsTail, otherWeight = g2.edge(e3).weight; + cutValue += pointsToHead ? otherWeight : -otherWeight; + if (isTreeEdge(t4, child, other)) { + var otherCutValue = t4.edge(child, other).cutvalue; + cutValue += pointsToHead ? -otherCutValue : otherCutValue; + } + } + }); + return cutValue; + } + function initLowLimValues(tree, root4) { + if (arguments.length < 2) { + root4 = tree.nodes()[0]; + } + dfsAssignLowLim(tree, {}, 1, root4); + } + function dfsAssignLowLim(tree, visited, nextLim, v3, parent4) { + var low = nextLim; + var label = tree.node(v3); + visited[v3] = true; + forEach_default(tree.neighbors(v3), function(w4) { + if (!Object.prototype.hasOwnProperty.call(visited, w4)) { + nextLim = dfsAssignLowLim(tree, visited, nextLim, w4, v3); + } + }); + label.low = low; + label.lim = nextLim++; + if (parent4) { + label.parent = parent4; + } else { + delete label.parent; + } + return nextLim; + } + function leaveEdge(tree) { + return find_default2(tree.edges(), function(e3) { + return tree.edge(e3).cutvalue < 0; + }); + } + function enterEdge(t4, g2, edge) { + var v3 = edge.v; + var w4 = edge.w; + if (!g2.hasEdge(v3, w4)) { + v3 = edge.w; + w4 = edge.v; + } + var vLabel = t4.node(v3); + var wLabel = t4.node(w4); + var tailLabel = vLabel; + var flip = false; + if (vLabel.lim > wLabel.lim) { + tailLabel = wLabel; + flip = true; + } + var candidates = filter_default3(g2.edges(), function(edge2) { + return flip === isDescendant(t4, t4.node(edge2.v), tailLabel) && flip !== isDescendant(t4, t4.node(edge2.w), tailLabel); + }); + return minBy_default(candidates, function(edge2) { + return slack(g2, edge2); + }); + } + function exchangeEdges(t4, g2, e3, f2) { + var v3 = e3.v; + var w4 = e3.w; + t4.removeEdge(v3, w4); + t4.setEdge(f2.v, f2.w, {}); + initLowLimValues(t4); + initCutValues(t4, g2); + updateRanks(t4, g2); + } + function updateRanks(t4, g2) { + var root4 = find_default2(t4.nodes(), function(v3) { + return !g2.node(v3).parent; + }); + var vs = preorder(t4, root4); + vs = vs.slice(1); + forEach_default(vs, function(v3) { + var parent4 = t4.node(v3).parent, edge = g2.edge(v3, parent4), flipped = false; + if (!edge) { + edge = g2.edge(parent4, v3); + flipped = true; + } + g2.node(v3).rank = g2.node(parent4).rank + (flipped ? edge.minlen : -edge.minlen); + }); + } + function isTreeEdge(tree, u2, v3) { + return tree.hasEdge(u2, v3); + } + function isDescendant(tree, vLabel, rootLabel) { + return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim; + } + var init_network_simplex = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js"() { + "use strict"; + init_lodash(); + init_alg(); + init_util2(); + init_feasible_tree(); + init_util3(); + networkSimplex.initLowLimValues = initLowLimValues; + networkSimplex.initCutValues = initCutValues; + networkSimplex.calcCutValue = calcCutValue; + networkSimplex.leaveEdge = leaveEdge; + networkSimplex.enterEdge = enterEdge; + networkSimplex.exchangeEdges = exchangeEdges; + __name(networkSimplex, "networkSimplex"); + __name(initCutValues, "initCutValues"); + __name(assignCutValue, "assignCutValue"); + __name(calcCutValue, "calcCutValue"); + __name(initLowLimValues, "initLowLimValues"); + __name(dfsAssignLowLim, "dfsAssignLowLim"); + __name(leaveEdge, "leaveEdge"); + __name(enterEdge, "enterEdge"); + __name(exchangeEdges, "exchangeEdges"); + __name(updateRanks, "updateRanks"); + __name(isTreeEdge, "isTreeEdge"); + __name(isDescendant, "isDescendant"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/index.js + function rank(g2) { + switch (g2.graph().ranker) { + case "network-simplex": + networkSimplexRanker(g2); + break; + case "tight-tree": + tightTreeRanker(g2); + break; + case "longest-path": + longestPathRanker(g2); + break; + default: + networkSimplexRanker(g2); + } + } + function tightTreeRanker(g2) { + longestPath(g2); + feasibleTree(g2); + } + function networkSimplexRanker(g2) { + networkSimplex(g2); + } + var longestPathRanker; + var init_rank = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/rank/index.js"() { + "use strict"; + init_feasible_tree(); + init_network_simplex(); + init_util3(); + __name(rank, "rank"); + longestPathRanker = longestPath; + __name(tightTreeRanker, "tightTreeRanker"); + __name(networkSimplexRanker, "networkSimplexRanker"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/nesting-graph.js + function run3(g2) { + var root4 = addDummyNode(g2, "root", {}, "_root"); + var depths = treeDepths(g2); + var height2 = max_default(values_default(depths)) - 1; + var nodeSep = 2 * height2 + 1; + g2.graph().nestingRoot = root4; + forEach_default(g2.edges(), function(e3) { + g2.edge(e3).minlen *= nodeSep; + }); + var weight8 = sumWeights(g2) + 1; + forEach_default(g2.children(), function(child) { + dfs2(g2, root4, nodeSep, weight8, height2, depths, child); + }); + g2.graph().nodeRankFactor = nodeSep; + } + function dfs2(g2, root4, nodeSep, weight8, height2, depths, v3) { + var children2 = g2.children(v3); + if (!children2.length) { + if (v3 !== root4) { + g2.setEdge(root4, v3, { weight: 0, minlen: nodeSep }); + } + return; + } + var top2 = addBorderNode(g2, "_bt"); + var bottom2 = addBorderNode(g2, "_bb"); + var label = g2.node(v3); + g2.setParent(top2, v3); + label.borderTop = top2; + g2.setParent(bottom2, v3); + label.borderBottom = bottom2; + forEach_default(children2, function(child) { + dfs2(g2, root4, nodeSep, weight8, height2, depths, child); + var childNode = g2.node(child); + var childTop = childNode.borderTop ? childNode.borderTop : child; + var childBottom = childNode.borderBottom ? childNode.borderBottom : child; + var thisWeight = childNode.borderTop ? weight8 : 2 * weight8; + var minlen = childTop !== childBottom ? 1 : height2 - depths[v3] + 1; + g2.setEdge(top2, childTop, { + weight: thisWeight, + minlen, + nestingEdge: true + }); + g2.setEdge(childBottom, bottom2, { + weight: thisWeight, + minlen, + nestingEdge: true + }); + }); + if (!g2.parent(v3)) { + g2.setEdge(root4, top2, { weight: 0, minlen: height2 + depths[v3] }); + } + } + function treeDepths(g2) { + var depths = {}; + function dfs3(v3, depth) { + var children2 = g2.children(v3); + if (children2 && children2.length) { + forEach_default(children2, function(child) { + dfs3(child, depth + 1); + }); + } + depths[v3] = depth; + } + __name(dfs3, "dfs"); + forEach_default(g2.children(), function(v3) { + dfs3(v3, 1); + }); + return depths; + } + function sumWeights(g2) { + return reduce_default( + g2.edges(), + function(acc, e3) { + return acc + g2.edge(e3).weight; + }, + 0 + ); + } + function cleanup(g2) { + var graphLabel = g2.graph(); + g2.removeNode(graphLabel.nestingRoot); + delete graphLabel.nestingRoot; + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + if (edge.nestingEdge) { + g2.removeEdge(e3); + } + }); + } + var init_nesting_graph = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/nesting-graph.js"() { + "use strict"; + init_lodash(); + init_util2(); + __name(run3, "run"); + __name(dfs2, "dfs"); + __name(treeDepths, "treeDepths"); + __name(sumWeights, "sumWeights"); + __name(cleanup, "cleanup"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/add-subgraph-constraints.js + function addSubgraphConstraints(g2, cg, vs) { + var prev2 = {}, rootPrev; + forEach_default(vs, function(v3) { + var child = g2.parent(v3), parent4, prevChild; + while (child) { + parent4 = g2.parent(child); + if (parent4) { + prevChild = prev2[parent4]; + prev2[parent4] = child; + } else { + prevChild = rootPrev; + rootPrev = child; + } + if (prevChild && prevChild !== child) { + cg.setEdge(prevChild, child); + return; + } + child = parent4; + } + }); + } + var init_add_subgraph_constraints = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/add-subgraph-constraints.js"() { + "use strict"; + init_lodash(); + __name(addSubgraphConstraints, "addSubgraphConstraints"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/build-layer-graph.js + function buildLayerGraph(g2, rank2, relationship) { + var root4 = createRootNode(g2), result = new Graph({ compound: true }).setGraph({ root: root4 }).setDefaultNodeLabel(function(v3) { + return g2.node(v3); + }); + forEach_default(g2.nodes(), function(v3) { + var node2 = g2.node(v3), parent4 = g2.parent(v3); + if (node2.rank === rank2 || node2.minRank <= rank2 && rank2 <= node2.maxRank) { + result.setNode(v3); + result.setParent(v3, parent4 || root4); + forEach_default(g2[relationship](v3), function(e3) { + var u2 = e3.v === v3 ? e3.w : e3.v, edge = result.edge(u2, v3), weight8 = !isUndefined_default(edge) ? edge.weight : 0; + result.setEdge(u2, v3, { weight: g2.edge(e3).weight + weight8 }); + }); + if (Object.prototype.hasOwnProperty.call(node2, "minRank")) { + result.setNode(v3, { + borderLeft: node2.borderLeft[rank2], + borderRight: node2.borderRight[rank2] + }); + } + } + }); + return result; + } + function createRootNode(g2) { + var v3; + while (g2.hasNode(v3 = uniqueId_default("_root"))) ; + return v3; + } + var init_build_layer_graph = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/build-layer-graph.js"() { + "use strict"; + init_lodash(); + init_graphlib(); + __name(buildLayerGraph, "buildLayerGraph"); + __name(createRootNode, "createRootNode"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/cross-count.js + function crossCount(g2, layering) { + var cc2 = 0; + for (var i2 = 1; i2 < layering.length; ++i2) { + cc2 += twoLayerCrossCount(g2, layering[i2 - 1], layering[i2]); + } + return cc2; + } + function twoLayerCrossCount(g2, northLayer, southLayer) { + var southPos = zipObject_default( + southLayer, + map_default(southLayer, function(v3, i2) { + return i2; + }) + ); + var southEntries = flatten_default( + map_default(northLayer, function(v3) { + return sortBy_default( + map_default(g2.outEdges(v3), function(e3) { + return { pos: southPos[e3.w], weight: g2.edge(e3).weight }; + }), + "pos" + ); + }) + ); + var firstIndex = 1; + while (firstIndex < southLayer.length) firstIndex <<= 1; + var treeSize = 2 * firstIndex - 1; + firstIndex -= 1; + var tree = map_default(new Array(treeSize), function() { + return 0; + }); + var cc2 = 0; + forEach_default( + // @ts-expect-error + southEntries.forEach(function(entry) { + var index = entry.pos + firstIndex; + tree[index] += entry.weight; + var weightSum = 0; + while (index > 0) { + if (index % 2) { + weightSum += tree[index + 1]; + } + index = index - 1 >> 1; + tree[index] += entry.weight; + } + cc2 += entry.weight * weightSum; + }) + ); + return cc2; + } + var init_cross_count = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/cross-count.js"() { + "use strict"; + init_lodash(); + __name(crossCount, "crossCount"); + __name(twoLayerCrossCount, "twoLayerCrossCount"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/init-order.js + function initOrder(g2) { + var visited = {}; + var simpleNodes = filter_default3(g2.nodes(), function(v3) { + return !g2.children(v3).length; + }); + var maxRank2 = max_default( + map_default(simpleNodes, function(v3) { + return g2.node(v3).rank; + }) + ); + var layers = map_default(range_default(maxRank2 + 1), function() { + return []; + }); + function dfs3(v3) { + if (has_default(visited, v3)) return; + visited[v3] = true; + var node2 = g2.node(v3); + layers[node2.rank].push(v3); + forEach_default(g2.successors(v3), dfs3); + } + __name(dfs3, "dfs"); + var orderedVs = sortBy_default(simpleNodes, function(v3) { + return g2.node(v3).rank; + }); + forEach_default(orderedVs, dfs3); + return layers; + } + var init_init_order = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/init-order.js"() { + "use strict"; + init_lodash(); + __name(initOrder, "initOrder"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/barycenter.js + function barycenter(g2, movable) { + return map_default(movable, function(v3) { + var inV = g2.inEdges(v3); + if (!inV.length) { + return { v: v3 }; + } else { + var result = reduce_default( + inV, + function(acc, e3) { + var edge = g2.edge(e3), nodeU = g2.node(e3.v); + return { + sum: acc.sum + edge.weight * nodeU.order, + weight: acc.weight + edge.weight + }; + }, + { sum: 0, weight: 0 } + ); + return { + v: v3, + barycenter: result.sum / result.weight, + weight: result.weight + }; + } + }); + } + var init_barycenter = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/barycenter.js"() { + "use strict"; + init_lodash(); + __name(barycenter, "barycenter"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js + function resolveConflicts(entries2, cg) { + var mappedEntries = {}; + forEach_default(entries2, function(entry, i2) { + var tmp = mappedEntries[entry.v] = { + indegree: 0, + in: [], + out: [], + vs: [entry.v], + i: i2 + }; + if (!isUndefined_default(entry.barycenter)) { + tmp.barycenter = entry.barycenter; + tmp.weight = entry.weight; + } + }); + forEach_default(cg.edges(), function(e3) { + var entryV = mappedEntries[e3.v]; + var entryW = mappedEntries[e3.w]; + if (!isUndefined_default(entryV) && !isUndefined_default(entryW)) { + entryW.indegree++; + entryV.out.push(mappedEntries[e3.w]); + } + }); + var sourceSet = filter_default3(mappedEntries, function(entry) { + return !entry.indegree; + }); + return doResolveConflicts(sourceSet); + } + function doResolveConflicts(sourceSet) { + var entries2 = []; + function handleIn(vEntry) { + return function(uEntry) { + if (uEntry.merged) { + return; + } + if (isUndefined_default(uEntry.barycenter) || isUndefined_default(vEntry.barycenter) || uEntry.barycenter >= vEntry.barycenter) { + mergeEntries(vEntry, uEntry); + } + }; + } + __name(handleIn, "handleIn"); + function handleOut(vEntry) { + return function(wEntry) { + wEntry["in"].push(vEntry); + if (--wEntry.indegree === 0) { + sourceSet.push(wEntry); + } + }; + } + __name(handleOut, "handleOut"); + while (sourceSet.length) { + var entry = sourceSet.pop(); + entries2.push(entry); + forEach_default(entry["in"].reverse(), handleIn(entry)); + forEach_default(entry.out, handleOut(entry)); + } + return map_default( + filter_default3(entries2, function(entry2) { + return !entry2.merged; + }), + function(entry2) { + return pick_default(entry2, ["vs", "i", "barycenter", "weight"]); + } + ); + } + function mergeEntries(target, source) { + var sum2 = 0; + var weight8 = 0; + if (target.weight) { + sum2 += target.barycenter * target.weight; + weight8 += target.weight; + } + if (source.weight) { + sum2 += source.barycenter * source.weight; + weight8 += source.weight; + } + target.vs = source.vs.concat(target.vs); + target.barycenter = sum2 / weight8; + target.weight = weight8; + target.i = Math.min(source.i, target.i); + source.merged = true; + } + var init_resolve_conflicts = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js"() { + "use strict"; + init_lodash(); + __name(resolveConflicts, "resolveConflicts"); + __name(doResolveConflicts, "doResolveConflicts"); + __name(mergeEntries, "mergeEntries"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort.js + function sort(entries2, biasRight) { + var parts = partition(entries2, function(entry) { + return Object.prototype.hasOwnProperty.call(entry, "barycenter"); + }); + var sortable = parts.lhs, unsortable = sortBy_default(parts.rhs, function(entry) { + return -entry.i; + }), vs = [], sum2 = 0, weight8 = 0, vsIndex = 0; + sortable.sort(compareWithBias(!!biasRight)); + vsIndex = consumeUnsortable(vs, unsortable, vsIndex); + forEach_default(sortable, function(entry) { + vsIndex += entry.vs.length; + vs.push(entry.vs); + sum2 += entry.barycenter * entry.weight; + weight8 += entry.weight; + vsIndex = consumeUnsortable(vs, unsortable, vsIndex); + }); + var result = { vs: flatten_default(vs) }; + if (weight8) { + result.barycenter = sum2 / weight8; + result.weight = weight8; + } + return result; + } + function consumeUnsortable(vs, unsortable, index) { + var last4; + while (unsortable.length && (last4 = last_default(unsortable)).i <= index) { + unsortable.pop(); + vs.push(last4.vs); + index++; + } + return index; + } + function compareWithBias(bias) { + return function(entryV, entryW) { + if (entryV.barycenter < entryW.barycenter) { + return -1; + } else if (entryV.barycenter > entryW.barycenter) { + return 1; + } + return !bias ? entryV.i - entryW.i : entryW.i - entryV.i; + }; + } + var init_sort3 = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort.js"() { + "use strict"; + init_lodash(); + init_util2(); + __name(sort, "sort"); + __name(consumeUnsortable, "consumeUnsortable"); + __name(compareWithBias, "compareWithBias"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js + function sortSubgraph(g2, v3, cg, biasRight) { + var movable = g2.children(v3); + var node2 = g2.node(v3); + var bl = node2 ? node2.borderLeft : void 0; + var br = node2 ? node2.borderRight : void 0; + var subgraphs = {}; + if (bl) { + movable = filter_default3(movable, function(w4) { + return w4 !== bl && w4 !== br; + }); + } + var barycenters = barycenter(g2, movable); + forEach_default(barycenters, function(entry) { + if (g2.children(entry.v).length) { + var subgraphResult = sortSubgraph(g2, entry.v, cg, biasRight); + subgraphs[entry.v] = subgraphResult; + if (Object.prototype.hasOwnProperty.call(subgraphResult, "barycenter")) { + mergeBarycenters(entry, subgraphResult); + } + } + }); + var entries2 = resolveConflicts(barycenters, cg); + expandSubgraphs(entries2, subgraphs); + var result = sort(entries2, biasRight); + if (bl) { + result.vs = flatten_default([bl, result.vs, br]); + if (g2.predecessors(bl).length) { + var blPred = g2.node(g2.predecessors(bl)[0]), brPred = g2.node(g2.predecessors(br)[0]); + if (!Object.prototype.hasOwnProperty.call(result, "barycenter")) { + result.barycenter = 0; + result.weight = 0; + } + result.barycenter = (result.barycenter * result.weight + blPred.order + brPred.order) / (result.weight + 2); + result.weight += 2; + } + } + return result; + } + function expandSubgraphs(entries2, subgraphs) { + forEach_default(entries2, function(entry) { + entry.vs = flatten_default( + entry.vs.map(function(v3) { + if (subgraphs[v3]) { + return subgraphs[v3].vs; + } + return v3; + }) + ); + }); + } + function mergeBarycenters(target, other) { + if (!isUndefined_default(target.barycenter)) { + target.barycenter = (target.barycenter * target.weight + other.barycenter * other.weight) / (target.weight + other.weight); + target.weight += other.weight; + } else { + target.barycenter = other.barycenter; + target.weight = other.weight; + } + } + var init_sort_subgraph = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js"() { + "use strict"; + init_lodash(); + init_barycenter(); + init_resolve_conflicts(); + init_sort3(); + __name(sortSubgraph, "sortSubgraph"); + __name(expandSubgraphs, "expandSubgraphs"); + __name(mergeBarycenters, "mergeBarycenters"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/index.js + function order(g2) { + var maxRank2 = maxRank(g2), downLayerGraphs = buildLayerGraphs(g2, range_default(1, maxRank2 + 1), "inEdges"), upLayerGraphs = buildLayerGraphs(g2, range_default(maxRank2 - 1, -1, -1), "outEdges"); + var layering = initOrder(g2); + assignOrder(g2, layering); + var bestCC = Number.POSITIVE_INFINITY, best; + for (var i2 = 0, lastBest = 0; lastBest < 4; ++i2, ++lastBest) { + sweepLayerGraphs(i2 % 2 ? downLayerGraphs : upLayerGraphs, i2 % 4 >= 2); + layering = buildLayerMatrix(g2); + var cc2 = crossCount(g2, layering); + if (cc2 < bestCC) { + lastBest = 0; + best = cloneDeep_default(layering); + bestCC = cc2; + } + } + assignOrder(g2, best); + } + function buildLayerGraphs(g2, ranks, relationship) { + return map_default(ranks, function(rank2) { + return buildLayerGraph(g2, rank2, relationship); + }); + } + function sweepLayerGraphs(layerGraphs, biasRight) { + var cg = new Graph(); + forEach_default(layerGraphs, function(lg) { + var root4 = lg.graph().root; + var sorted = sortSubgraph(lg, root4, cg, biasRight); + forEach_default(sorted.vs, function(v3, i2) { + lg.node(v3).order = i2; + }); + addSubgraphConstraints(lg, cg, sorted.vs); + }); + } + function assignOrder(g2, layering) { + forEach_default(layering, function(layer) { + forEach_default(layer, function(v3, i2) { + g2.node(v3).order = i2; + }); + }); + } + var init_order2 = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/order/index.js"() { + "use strict"; + init_lodash(); + init_graphlib(); + init_util2(); + init_add_subgraph_constraints(); + init_build_layer_graph(); + init_cross_count(); + init_init_order(); + init_sort_subgraph(); + __name(order, "order"); + __name(buildLayerGraphs, "buildLayerGraphs"); + __name(sweepLayerGraphs, "sweepLayerGraphs"); + __name(assignOrder, "assignOrder"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/parent-dummy-chains.js + function parentDummyChains(g2) { + var postorderNums = postorder2(g2); + forEach_default(g2.graph().dummyChains, function(v3) { + var node2 = g2.node(v3); + var edgeObj = node2.edgeObj; + var pathData = findPath(g2, postorderNums, edgeObj.v, edgeObj.w); + var path4 = pathData.path; + var lca = pathData.lca; + var pathIdx = 0; + var pathV = path4[pathIdx]; + var ascending5 = true; + while (v3 !== edgeObj.w) { + node2 = g2.node(v3); + if (ascending5) { + while ((pathV = path4[pathIdx]) !== lca && g2.node(pathV).maxRank < node2.rank) { + pathIdx++; + } + if (pathV === lca) { + ascending5 = false; + } + } + if (!ascending5) { + while (pathIdx < path4.length - 1 && g2.node(pathV = path4[pathIdx + 1]).minRank <= node2.rank) { + pathIdx++; + } + pathV = path4[pathIdx]; + } + g2.setParent(v3, pathV); + v3 = g2.successors(v3)[0]; + } + }); + } + function findPath(g2, postorderNums, v3, w4) { + var vPath = []; + var wPath = []; + var low = Math.min(postorderNums[v3].low, postorderNums[w4].low); + var lim = Math.max(postorderNums[v3].lim, postorderNums[w4].lim); + var parent4; + var lca; + parent4 = v3; + do { + parent4 = g2.parent(parent4); + vPath.push(parent4); + } while (parent4 && (postorderNums[parent4].low > low || lim > postorderNums[parent4].lim)); + lca = parent4; + parent4 = w4; + while ((parent4 = g2.parent(parent4)) !== lca) { + wPath.push(parent4); + } + return { path: vPath.concat(wPath.reverse()), lca }; + } + function postorder2(g2) { + var result = {}; + var lim = 0; + function dfs3(v3) { + var low = lim; + forEach_default(g2.children(v3), dfs3); + result[v3] = { low, lim: lim++ }; + } + __name(dfs3, "dfs"); + forEach_default(g2.children(), dfs3); + return result; + } + var init_parent_dummy_chains = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/parent-dummy-chains.js"() { + "use strict"; + init_lodash(); + __name(parentDummyChains, "parentDummyChains"); + __name(findPath, "findPath"); + __name(postorder2, "postorder"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/bk.js + function findType1Conflicts(g2, layering) { + var conflicts = {}; + function visitLayer(prevLayer, layer) { + var k0 = 0, scanPos = 0, prevLayerLength = prevLayer.length, lastNode = last_default(layer); + forEach_default(layer, function(v3, i2) { + var w4 = findOtherInnerSegmentNode(g2, v3), k1 = w4 ? g2.node(w4).order : prevLayerLength; + if (w4 || v3 === lastNode) { + forEach_default(layer.slice(scanPos, i2 + 1), function(scanNode) { + forEach_default(g2.predecessors(scanNode), function(u2) { + var uLabel = g2.node(u2), uPos = uLabel.order; + if ((uPos < k0 || k1 < uPos) && !(uLabel.dummy && g2.node(scanNode).dummy)) { + addConflict(conflicts, u2, scanNode); + } + }); + }); + scanPos = i2 + 1; + k0 = k1; + } + }); + return layer; + } + __name(visitLayer, "visitLayer"); + reduce_default(layering, visitLayer); + return conflicts; + } + function findType2Conflicts(g2, layering) { + var conflicts = {}; + function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) { + var v3; + forEach_default(range_default(southPos, southEnd), function(i2) { + v3 = south[i2]; + if (g2.node(v3).dummy) { + forEach_default(g2.predecessors(v3), function(u2) { + var uNode = g2.node(u2); + if (uNode.dummy && (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) { + addConflict(conflicts, u2, v3); + } + }); + } + }); + } + __name(scan, "scan"); + function visitLayer(north, south) { + var prevNorthPos = -1, nextNorthPos, southPos = 0; + forEach_default(south, function(v3, southLookahead) { + if (g2.node(v3).dummy === "border") { + var predecessors = g2.predecessors(v3); + if (predecessors.length) { + nextNorthPos = g2.node(predecessors[0]).order; + scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos); + southPos = southLookahead; + prevNorthPos = nextNorthPos; + } + } + scan(south, southPos, south.length, nextNorthPos, north.length); + }); + return south; + } + __name(visitLayer, "visitLayer"); + reduce_default(layering, visitLayer); + return conflicts; + } + function findOtherInnerSegmentNode(g2, v3) { + if (g2.node(v3).dummy) { + return find_default2(g2.predecessors(v3), function(u2) { + return g2.node(u2).dummy; + }); + } + } + function addConflict(conflicts, v3, w4) { + if (v3 > w4) { + var tmp = v3; + v3 = w4; + w4 = tmp; + } + if (!Object.prototype.hasOwnProperty.call(conflicts, v3)) { + Object.defineProperty(conflicts, v3, { + enumerable: true, + configurable: true, + value: {}, + writable: true + }); + } + var conflictsV = conflicts[v3]; + Object.defineProperty(conflictsV, w4, { + enumerable: true, + configurable: true, + value: true, + writable: true + }); + } + function hasConflict(conflicts, v3, w4) { + if (v3 > w4) { + var tmp = v3; + v3 = w4; + w4 = tmp; + } + return !!conflicts[v3] && Object.prototype.hasOwnProperty.call(conflicts[v3], w4); + } + function verticalAlignment(g2, layering, conflicts, neighborFn) { + var root4 = {}, align = {}, pos = {}; + forEach_default(layering, function(layer) { + forEach_default(layer, function(v3, order2) { + root4[v3] = v3; + align[v3] = v3; + pos[v3] = order2; + }); + }); + forEach_default(layering, function(layer) { + var prevIdx = -1; + forEach_default(layer, function(v3) { + var ws = neighborFn(v3); + if (ws.length) { + ws = sortBy_default(ws, function(w5) { + return pos[w5]; + }); + var mp = (ws.length - 1) / 2; + for (var i2 = Math.floor(mp), il = Math.ceil(mp); i2 <= il; ++i2) { + var w4 = ws[i2]; + if (align[v3] === v3 && prevIdx < pos[w4] && !hasConflict(conflicts, v3, w4)) { + align[w4] = v3; + align[v3] = root4[v3] = root4[w4]; + prevIdx = pos[w4]; + } + } + } + }); + }); + return { root: root4, align }; + } + function horizontalCompaction(g2, layering, root4, align, reverseSep) { + var xs = {}, blockG = buildBlockGraph(g2, layering, root4, reverseSep), borderType = reverseSep ? "borderLeft" : "borderRight"; + function iterate(setXsFunc, nextNodesFunc) { + var stack = blockG.nodes(); + var elem = stack.pop(); + var visited = {}; + while (elem) { + if (visited[elem]) { + setXsFunc(elem); + } else { + visited[elem] = true; + stack.push(elem); + stack = stack.concat(nextNodesFunc(elem)); + } + elem = stack.pop(); + } + } + __name(iterate, "iterate"); + function pass1(elem) { + xs[elem] = blockG.inEdges(elem).reduce(function(acc, e3) { + return Math.max(acc, xs[e3.v] + blockG.edge(e3)); + }, 0); + } + __name(pass1, "pass1"); + function pass2(elem) { + var min10 = blockG.outEdges(elem).reduce(function(acc, e3) { + return Math.min(acc, xs[e3.w] - blockG.edge(e3)); + }, Number.POSITIVE_INFINITY); + var node2 = g2.node(elem); + if (min10 !== Number.POSITIVE_INFINITY && node2.borderType !== borderType) { + xs[elem] = Math.max(xs[elem], min10); + } + } + __name(pass2, "pass2"); + iterate(pass1, blockG.predecessors.bind(blockG)); + iterate(pass2, blockG.successors.bind(blockG)); + forEach_default(align, function(v3) { + xs[v3] = xs[root4[v3]]; + }); + return xs; + } + function buildBlockGraph(g2, layering, root4, reverseSep) { + var blockGraph = new Graph(), graphLabel = g2.graph(), sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep); + forEach_default(layering, function(layer) { + var u2; + forEach_default(layer, function(v3) { + var vRoot = root4[v3]; + blockGraph.setNode(vRoot); + if (u2) { + var uRoot = root4[u2], prevMax = blockGraph.edge(uRoot, vRoot); + blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g2, v3, u2), prevMax || 0)); + } + u2 = v3; + }); + }); + return blockGraph; + } + function findSmallestWidthAlignment(g2, xss) { + return minBy_default(values_default(xss), function(xs) { + var max10 = Number.NEGATIVE_INFINITY; + var min10 = Number.POSITIVE_INFINITY; + forIn_default(xs, function(x5, v3) { + var halfWidth = width(g2, v3) / 2; + max10 = Math.max(x5 + halfWidth, max10); + min10 = Math.min(x5 - halfWidth, min10); + }); + return max10 - min10; + }); + } + function alignCoordinates(xss, alignTo) { + var alignToVals = values_default(alignTo), alignToMin = min_default(alignToVals), alignToMax = max_default(alignToVals); + forEach_default(["u", "d"], function(vert) { + forEach_default(["l", "r"], function(horiz) { + var alignment = vert + horiz, xs = xss[alignment], delta; + if (xs === alignTo) return; + var xsVals = values_default(xs); + delta = horiz === "l" ? alignToMin - min_default(xsVals) : alignToMax - max_default(xsVals); + if (delta) { + xss[alignment] = mapValues_default(xs, function(x5) { + return x5 + delta; + }); + } + }); + }); + } + function balance(xss, align) { + return mapValues_default(xss.ul, function(ignore, v3) { + if (align) { + return xss[align.toLowerCase()][v3]; + } else { + var xs = sortBy_default(map_default(xss, v3)); + return (xs[1] + xs[2]) / 2; + } + }); + } + function positionX(g2) { + var layering = buildLayerMatrix(g2); + var conflicts = merge_default3(findType1Conflicts(g2, layering), findType2Conflicts(g2, layering)); + var xss = {}; + var adjustedLayering; + forEach_default(["u", "d"], function(vert) { + adjustedLayering = vert === "u" ? layering : values_default(layering).reverse(); + forEach_default(["l", "r"], function(horiz) { + if (horiz === "r") { + adjustedLayering = map_default(adjustedLayering, function(inner2) { + return values_default(inner2).reverse(); + }); + } + var neighborFn = (vert === "u" ? g2.predecessors : g2.successors).bind(g2); + var align = verticalAlignment(g2, adjustedLayering, conflicts, neighborFn); + var xs = horizontalCompaction(g2, adjustedLayering, align.root, align.align, horiz === "r"); + if (horiz === "r") { + xs = mapValues_default(xs, function(x5) { + return -x5; + }); + } + xss[vert + horiz] = xs; + }); + }); + var smallestWidth = findSmallestWidthAlignment(g2, xss); + alignCoordinates(xss, smallestWidth); + return balance(xss, g2.graph().align); + } + function sep(nodeSep, edgeSep, reverseSep) { + return function(g2, v3, w4) { + var vLabel = g2.node(v3); + var wLabel = g2.node(w4); + var sum2 = 0; + var delta; + sum2 += vLabel.width / 2; + if (Object.prototype.hasOwnProperty.call(vLabel, "labelpos")) { + switch (vLabel.labelpos.toLowerCase()) { + case "l": + delta = -vLabel.width / 2; + break; + case "r": + delta = vLabel.width / 2; + break; + } + } + if (delta) { + sum2 += reverseSep ? delta : -delta; + } + delta = 0; + sum2 += (vLabel.dummy ? edgeSep : nodeSep) / 2; + sum2 += (wLabel.dummy ? edgeSep : nodeSep) / 2; + sum2 += wLabel.width / 2; + if (Object.prototype.hasOwnProperty.call(wLabel, "labelpos")) { + switch (wLabel.labelpos.toLowerCase()) { + case "l": + delta = wLabel.width / 2; + break; + case "r": + delta = -wLabel.width / 2; + break; + } + } + if (delta) { + sum2 += reverseSep ? delta : -delta; + } + delta = 0; + return sum2; + }; + } + function width(g2, v3) { + return g2.node(v3).width; + } + var init_bk = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/bk.js"() { + "use strict"; + init_lodash(); + init_graphlib(); + init_util2(); + __name(findType1Conflicts, "findType1Conflicts"); + __name(findType2Conflicts, "findType2Conflicts"); + __name(findOtherInnerSegmentNode, "findOtherInnerSegmentNode"); + __name(addConflict, "addConflict"); + __name(hasConflict, "hasConflict"); + __name(verticalAlignment, "verticalAlignment"); + __name(horizontalCompaction, "horizontalCompaction"); + __name(buildBlockGraph, "buildBlockGraph"); + __name(findSmallestWidthAlignment, "findSmallestWidthAlignment"); + __name(alignCoordinates, "alignCoordinates"); + __name(balance, "balance"); + __name(positionX, "positionX"); + __name(sep, "sep"); + __name(width, "width"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/index.js + function position(g2) { + g2 = asNonCompoundGraph(g2); + positionY(g2); + forOwn_default(positionX(g2), function(x5, v3) { + g2.node(v3).x = x5; + }); + } + function positionY(g2) { + var layering = buildLayerMatrix(g2); + var rankSep = g2.graph().ranksep; + var prevY = 0; + forEach_default(layering, function(layer) { + var maxHeight = max_default( + map_default(layer, function(v3) { + return g2.node(v3).height; + }) + ); + forEach_default(layer, function(v3) { + g2.node(v3).y = prevY + maxHeight / 2; + }); + prevY += maxHeight + rankSep; + }); + } + var init_position = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/position/index.js"() { + "use strict"; + init_lodash(); + init_util2(); + init_bk(); + __name(position, "position"); + __name(positionY, "positionY"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/layout.js + function layout(g2, opts) { + var time4 = opts && opts.debugTiming ? time2 : notime; + time4("layout", () => { + var layoutGraph = time4(" buildLayoutGraph", () => buildLayoutGraph(g2)); + time4(" runLayout", () => runLayout(layoutGraph, time4)); + time4(" updateInputGraph", () => updateInputGraph(g2, layoutGraph)); + }); + } + function runLayout(g2, time4) { + time4(" makeSpaceForEdgeLabels", () => makeSpaceForEdgeLabels(g2)); + time4(" removeSelfEdges", () => removeSelfEdges(g2)); + time4(" acyclic", () => run(g2)); + time4(" nestingGraph.run", () => run3(g2)); + time4(" rank", () => rank(asNonCompoundGraph(g2))); + time4(" injectEdgeLabelProxies", () => injectEdgeLabelProxies(g2)); + time4(" removeEmptyRanks", () => removeEmptyRanks(g2)); + time4(" nestingGraph.cleanup", () => cleanup(g2)); + time4(" normalizeRanks", () => normalizeRanks(g2)); + time4(" assignRankMinMax", () => assignRankMinMax(g2)); + time4(" removeEdgeLabelProxies", () => removeEdgeLabelProxies(g2)); + time4(" normalize.run", () => run2(g2)); + time4(" parentDummyChains", () => parentDummyChains(g2)); + time4(" addBorderSegments", () => addBorderSegments(g2)); + time4(" order", () => order(g2)); + time4(" insertSelfEdges", () => insertSelfEdges(g2)); + time4(" adjustCoordinateSystem", () => adjust2(g2)); + time4(" position", () => position(g2)); + time4(" positionSelfEdges", () => positionSelfEdges(g2)); + time4(" removeBorderNodes", () => removeBorderNodes(g2)); + time4(" normalize.undo", () => undo3(g2)); + time4(" fixupEdgeLabelCoords", () => fixupEdgeLabelCoords(g2)); + time4(" undoCoordinateSystem", () => undo2(g2)); + time4(" translateGraph", () => translateGraph(g2)); + time4(" assignNodeIntersects", () => assignNodeIntersects(g2)); + time4(" reversePoints", () => reversePointsForReversedEdges(g2)); + time4(" acyclic.undo", () => undo(g2)); + } + function updateInputGraph(inputGraph, layoutGraph) { + forEach_default(inputGraph.nodes(), function(v3) { + var inputLabel = inputGraph.node(v3); + var layoutLabel = layoutGraph.node(v3); + if (inputLabel) { + inputLabel.x = layoutLabel.x; + inputLabel.y = layoutLabel.y; + if (layoutGraph.children(v3).length) { + inputLabel.width = layoutLabel.width; + inputLabel.height = layoutLabel.height; + } + } + }); + forEach_default(inputGraph.edges(), function(e3) { + var inputLabel = inputGraph.edge(e3); + var layoutLabel = layoutGraph.edge(e3); + inputLabel.points = layoutLabel.points; + if (Object.prototype.hasOwnProperty.call(layoutLabel, "x")) { + inputLabel.x = layoutLabel.x; + inputLabel.y = layoutLabel.y; + } + }); + inputGraph.graph().width = layoutGraph.graph().width; + inputGraph.graph().height = layoutGraph.graph().height; + } + function buildLayoutGraph(inputGraph) { + var g2 = new Graph({ multigraph: true, compound: true }); + var graph = canonicalize(inputGraph.graph()); + g2.setGraph( + merge_default3({}, graphDefaults, selectNumberAttrs(graph, graphNumAttrs), pick_default(graph, graphAttrs)) + ); + forEach_default(inputGraph.nodes(), function(v3) { + var node2 = canonicalize(inputGraph.node(v3)); + g2.setNode(v3, defaults_default(selectNumberAttrs(node2, nodeNumAttrs), nodeDefaults)); + g2.setParent(v3, inputGraph.parent(v3)); + }); + forEach_default(inputGraph.edges(), function(e3) { + var edge = canonicalize(inputGraph.edge(e3)); + g2.setEdge( + e3, + merge_default3({}, edgeDefaults, selectNumberAttrs(edge, edgeNumAttrs), pick_default(edge, edgeAttrs)) + ); + }); + return g2; + } + function makeSpaceForEdgeLabels(g2) { + var graph = g2.graph(); + graph.ranksep /= 2; + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + edge.minlen *= 2; + if (edge.labelpos.toLowerCase() !== "c") { + if (graph.rankdir === "TB" || graph.rankdir === "BT") { + edge.width += edge.labeloffset; + } else { + edge.height += edge.labeloffset; + } + } + }); + } + function injectEdgeLabelProxies(g2) { + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + if (edge.width && edge.height) { + var v3 = g2.node(e3.v); + var w4 = g2.node(e3.w); + var label = { rank: (w4.rank - v3.rank) / 2 + v3.rank, e: e3 }; + addDummyNode(g2, "edge-proxy", label, "_ep"); + } + }); + } + function assignRankMinMax(g2) { + var maxRank2 = 0; + forEach_default(g2.nodes(), function(v3) { + var node2 = g2.node(v3); + if (node2.borderTop) { + node2.minRank = g2.node(node2.borderTop).rank; + node2.maxRank = g2.node(node2.borderBottom).rank; + maxRank2 = max_default(maxRank2, node2.maxRank); + } + }); + g2.graph().maxRank = maxRank2; + } + function removeEdgeLabelProxies(g2) { + forEach_default(g2.nodes(), function(v3) { + var node2 = g2.node(v3); + if (node2.dummy === "edge-proxy") { + g2.edge(node2.e).labelRank = node2.rank; + g2.removeNode(v3); + } + }); + } + function translateGraph(g2) { + var minX = Number.POSITIVE_INFINITY; + var maxX = 0; + var minY = Number.POSITIVE_INFINITY; + var maxY = 0; + var graphLabel = g2.graph(); + var marginX = graphLabel.marginx || 0; + var marginY = graphLabel.marginy || 0; + function getExtremes(attrs) { + var x5 = attrs.x; + var y6 = attrs.y; + var w4 = attrs.width; + var h3 = attrs.height; + minX = Math.min(minX, x5 - w4 / 2); + maxX = Math.max(maxX, x5 + w4 / 2); + minY = Math.min(minY, y6 - h3 / 2); + maxY = Math.max(maxY, y6 + h3 / 2); + } + __name(getExtremes, "getExtremes"); + forEach_default(g2.nodes(), function(v3) { + getExtremes(g2.node(v3)); + }); + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + if (Object.prototype.hasOwnProperty.call(edge, "x")) { + getExtremes(edge); + } + }); + minX -= marginX; + minY -= marginY; + forEach_default(g2.nodes(), function(v3) { + var node2 = g2.node(v3); + node2.x -= minX; + node2.y -= minY; + }); + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + forEach_default(edge.points, function(p3) { + p3.x -= minX; + p3.y -= minY; + }); + if (Object.prototype.hasOwnProperty.call(edge, "x")) { + edge.x -= minX; + } + if (Object.prototype.hasOwnProperty.call(edge, "y")) { + edge.y -= minY; + } + }); + graphLabel.width = maxX - minX + marginX; + graphLabel.height = maxY - minY + marginY; + } + function assignNodeIntersects(g2) { + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + var nodeV = g2.node(e3.v); + var nodeW = g2.node(e3.w); + var p1, p22; + if (!edge.points) { + edge.points = []; + p1 = nodeW; + p22 = nodeV; + } else { + p1 = edge.points[0]; + p22 = edge.points[edge.points.length - 1]; + } + edge.points.unshift(intersectRect2(nodeV, p1)); + edge.points.push(intersectRect2(nodeW, p22)); + }); + } + function fixupEdgeLabelCoords(g2) { + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + if (Object.prototype.hasOwnProperty.call(edge, "x")) { + if (edge.labelpos === "l" || edge.labelpos === "r") { + edge.width -= edge.labeloffset; + } + switch (edge.labelpos) { + case "l": + edge.x -= edge.width / 2 + edge.labeloffset; + break; + case "r": + edge.x += edge.width / 2 + edge.labeloffset; + break; + } + } + }); + } + function reversePointsForReversedEdges(g2) { + forEach_default(g2.edges(), function(e3) { + var edge = g2.edge(e3); + if (edge.reversed) { + edge.points.reverse(); + } + }); + } + function removeBorderNodes(g2) { + forEach_default(g2.nodes(), function(v3) { + if (g2.children(v3).length) { + var node2 = g2.node(v3); + var t4 = g2.node(node2.borderTop); + var b3 = g2.node(node2.borderBottom); + var l4 = g2.node(last_default(node2.borderLeft)); + var r2 = g2.node(last_default(node2.borderRight)); + node2.width = Math.abs(r2.x - l4.x); + node2.height = Math.abs(b3.y - t4.y); + node2.x = l4.x + node2.width / 2; + node2.y = t4.y + node2.height / 2; + } + }); + forEach_default(g2.nodes(), function(v3) { + if (g2.node(v3).dummy === "border") { + g2.removeNode(v3); + } + }); + } + function removeSelfEdges(g2) { + forEach_default(g2.edges(), function(e3) { + if (e3.v === e3.w) { + var node2 = g2.node(e3.v); + if (!node2.selfEdges) { + node2.selfEdges = []; + } + node2.selfEdges.push({ e: e3, label: g2.edge(e3) }); + g2.removeEdge(e3); + } + }); + } + function insertSelfEdges(g2) { + var layers = buildLayerMatrix(g2); + forEach_default(layers, function(layer) { + var orderShift = 0; + forEach_default(layer, function(v3, i2) { + var node2 = g2.node(v3); + node2.order = i2 + orderShift; + forEach_default(node2.selfEdges, function(selfEdge) { + addDummyNode( + g2, + "selfedge", + { + width: selfEdge.label.width, + height: selfEdge.label.height, + rank: node2.rank, + order: i2 + ++orderShift, + e: selfEdge.e, + label: selfEdge.label + }, + "_se" + ); + }); + delete node2.selfEdges; + }); + }); + } + function positionSelfEdges(g2) { + forEach_default(g2.nodes(), function(v3) { + var node2 = g2.node(v3); + if (node2.dummy === "selfedge") { + var selfNode = g2.node(node2.e.v); + var x5 = selfNode.x + selfNode.width / 2; + var y6 = selfNode.y; + var dx = node2.x - x5; + var dy = selfNode.height / 2; + g2.setEdge(node2.e, node2.label); + g2.removeNode(v3); + node2.label.points = [ + { x: x5 + 2 * dx / 3, y: y6 - dy }, + { x: x5 + 5 * dx / 6, y: y6 - dy }, + { x: x5 + dx, y: y6 }, + { x: x5 + 5 * dx / 6, y: y6 + dy }, + { x: x5 + 2 * dx / 3, y: y6 + dy } + ]; + node2.label.x = node2.x; + node2.label.y = node2.y; + } + }); + } + function selectNumberAttrs(obj, attrs) { + return mapValues_default(pick_default(obj, attrs), Number); + } + function canonicalize(attrs) { + var newAttrs = {}; + forEach_default(attrs, function(v3, k2) { + newAttrs[k2.toLowerCase()] = v3; + }); + return newAttrs; + } + var graphNumAttrs, graphDefaults, graphAttrs, nodeNumAttrs, nodeDefaults, edgeNumAttrs, edgeDefaults, edgeAttrs; + var init_layout = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/layout.js"() { + "use strict"; + init_lodash(); + init_graphlib(); + init_add_border_segments(); + init_coordinate_system(); + init_acyclic(); + init_normalize(); + init_rank(); + init_nesting_graph(); + init_order2(); + init_parent_dummy_chains(); + init_position(); + init_util2(); + __name(layout, "layout"); + __name(runLayout, "runLayout"); + __name(updateInputGraph, "updateInputGraph"); + graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"]; + graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }; + graphAttrs = ["acyclicer", "ranker", "rankdir", "align"]; + nodeNumAttrs = ["width", "height"]; + nodeDefaults = { width: 0, height: 0 }; + edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"]; + edgeDefaults = { + minlen: 1, + weight: 1, + width: 0, + height: 0, + labeloffset: 10, + labelpos: "r" + }; + edgeAttrs = ["labelpos"]; + __name(buildLayoutGraph, "buildLayoutGraph"); + __name(makeSpaceForEdgeLabels, "makeSpaceForEdgeLabels"); + __name(injectEdgeLabelProxies, "injectEdgeLabelProxies"); + __name(assignRankMinMax, "assignRankMinMax"); + __name(removeEdgeLabelProxies, "removeEdgeLabelProxies"); + __name(translateGraph, "translateGraph"); + __name(assignNodeIntersects, "assignNodeIntersects"); + __name(fixupEdgeLabelCoords, "fixupEdgeLabelCoords"); + __name(reversePointsForReversedEdges, "reversePointsForReversedEdges"); + __name(removeBorderNodes, "removeBorderNodes"); + __name(removeSelfEdges, "removeSelfEdges"); + __name(insertSelfEdges, "insertSelfEdges"); + __name(positionSelfEdges, "positionSelfEdges"); + __name(selectNumberAttrs, "selectNumberAttrs"); + __name(canonicalize, "canonicalize"); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/index.js + var init_dagre = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/dagre/index.js"() { + "use strict"; + init_acyclic(); + init_layout(); + init_normalize(); + init_rank(); + } + }); + + // ../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/json.js + function write(g2) { + var json3 = { + options: { + directed: g2.isDirected(), + multigraph: g2.isMultigraph(), + compound: g2.isCompound() + }, + nodes: writeNodes(g2), + edges: writeEdges(g2) + }; + if (!isUndefined_default(g2.graph())) { + json3.value = clone_default2(g2.graph()); + } + return json3; + } + function writeNodes(g2) { + return map_default(g2.nodes(), function(v3) { + var nodeValue = g2.node(v3); + var parent4 = g2.parent(v3); + var node2 = { v: v3 }; + if (!isUndefined_default(nodeValue)) { + node2.value = nodeValue; + } + if (!isUndefined_default(parent4)) { + node2.parent = parent4; + } + return node2; + }); + } + function writeEdges(g2) { + return map_default(g2.edges(), function(e3) { + var edgeValue = g2.edge(e3); + var edge = { v: e3.v, w: e3.w }; + if (!isUndefined_default(e3.name)) { + edge.name = e3.name; + } + if (!isUndefined_default(edgeValue)) { + edge.value = edgeValue; + } + return edge; + }); + } + var init_json = __esm({ + "../../node_modules/.pnpm/dagre-d3-es@7.0.14/node_modules/dagre-d3-es/src/graphlib/json.js"() { + "use strict"; + init_lodash(); + init_graph(); + __name(write, "write"); + __name(writeNodes, "writeNodes"); + __name(writeEdges, "writeEdges"); + } + }); + + // src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js + var clusterDb, descendants, parents, clear6, isDescendant2, edgeInCluster, copy2, extractDescendants, findCommonEdges, findNonClusterChild, getAnchorId, adjustClustersAndEdges, extractor, sorter, sortNodesByHierarchy; + var init_mermaid_graphlib = __esm({ + "src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js"() { + "use strict"; + init_logger(); + init_graphlib(); + init_json(); + clusterDb = /* @__PURE__ */ new Map(); + descendants = /* @__PURE__ */ new Map(); + parents = /* @__PURE__ */ new Map(); + clear6 = /* @__PURE__ */ __name(() => { + descendants.clear(); + parents.clear(); + clusterDb.clear(); + }, "clear"); + isDescendant2 = /* @__PURE__ */ __name((id35, ancestorId) => { + const ancestorDescendants = descendants.get(ancestorId) || []; + log.trace("In isDescendant", ancestorId, " ", id35, " = ", ancestorDescendants.includes(id35)); + return ancestorDescendants.includes(id35); + }, "isDescendant"); + edgeInCluster = /* @__PURE__ */ __name((edge, clusterId) => { + const clusterDescendants = descendants.get(clusterId) || []; + log.info("Descendants of ", clusterId, " is ", clusterDescendants); + log.info("Edge is ", edge); + if (edge.v === clusterId || edge.w === clusterId) { + return false; + } + if (!clusterDescendants) { + log.debug("Tilt, ", clusterId, ",not in descendants"); + return false; + } + return clusterDescendants.includes(edge.v) || isDescendant2(edge.v, clusterId) || isDescendant2(edge.w, clusterId) || clusterDescendants.includes(edge.w); + }, "edgeInCluster"); + copy2 = /* @__PURE__ */ __name((clusterId, graph, newGraph, rootId) => { + log.warn( + "Copying children of ", + clusterId, + "root", + rootId, + "data", + graph.node(clusterId), + rootId + ); + const nodes5 = graph.children(clusterId) || []; + if (clusterId !== rootId) { + nodes5.push(clusterId); + } + log.warn("Copying (nodes) clusterId", clusterId, "nodes", nodes5); + nodes5.forEach((node2) => { + if (graph.children(node2).length > 0) { + copy2(node2, graph, newGraph, rootId); + } else { + const data5 = graph.node(node2); + log.info("cp ", node2, " to ", rootId, " with parent ", clusterId); + newGraph.setNode(node2, data5); + if (rootId !== graph.parent(node2)) { + log.warn("Setting parent", node2, graph.parent(node2)); + newGraph.setParent(node2, graph.parent(node2)); + } + if (clusterId !== rootId && node2 !== clusterId) { + log.debug("Setting parent", node2, clusterId); + newGraph.setParent(node2, clusterId); + } else { + log.info("In copy ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId); + log.debug( + "Not Setting parent for node=", + node2, + "cluster!==rootId", + clusterId !== rootId, + "node!==clusterId", + node2 !== clusterId + ); + } + const edges3 = graph.edges(node2); + log.debug("Copying Edges", edges3); + edges3.forEach((edge) => { + log.info("Edge", edge); + const data6 = graph.edge(edge.v, edge.w, edge.name); + log.info("Edge data", data6, rootId); + try { + if (edgeInCluster(edge, rootId)) { + log.info("Copying as ", edge.v, edge.w, data6, edge.name); + newGraph.setEdge(edge.v, edge.w, data6, edge.name); + log.info("newGraph edges ", newGraph.edges(), newGraph.edge(newGraph.edges()[0])); + } else { + log.info( + "Skipping copy of edge ", + edge.v, + "-->", + edge.w, + " rootId: ", + rootId, + " clusterId:", + clusterId + ); + } + } catch (e3) { + log.error(e3); + } + }); + } + log.debug("Removing node", node2); + graph.removeNode(node2); + }); + }, "copy"); + extractDescendants = /* @__PURE__ */ __name((id35, graph) => { + const children2 = graph.children(id35); + let res = [...children2]; + for (const child of children2) { + parents.set(child, id35); + res = [...res, ...extractDescendants(child, graph)]; + } + return res; + }, "extractDescendants"); + findCommonEdges = /* @__PURE__ */ __name((graph, id1, id210) => { + const edges1 = graph.edges().filter((edge) => edge.v === id1 || edge.w === id1); + const edges22 = graph.edges().filter((edge) => edge.v === id210 || edge.w === id210); + const edges1Prim = edges1.map((edge) => { + return { v: edge.v === id1 ? id210 : edge.v, w: edge.w === id1 ? id1 : edge.w }; + }); + const edges2Prim = edges22.map((edge) => { + return { v: edge.v, w: edge.w }; + }); + const result = edges1Prim.filter((edgeIn1) => { + return edges2Prim.some((edge) => edgeIn1.v === edge.v && edgeIn1.w === edge.w); + }); + return result; + }, "findCommonEdges"); + findNonClusterChild = /* @__PURE__ */ __name((id35, graph, clusterId) => { + const children2 = graph.children(id35); + log.trace("Searching children of id ", id35, children2); + if (children2.length < 1) { + return id35; + } + let reserve; + for (const child of children2) { + const _id = findNonClusterChild(child, graph, clusterId); + const commonEdges = findCommonEdges(graph, clusterId, _id); + if (_id) { + if (commonEdges.length > 0) { + reserve = _id; + } else { + return _id; + } + } + } + return reserve; + }, "findNonClusterChild"); + getAnchorId = /* @__PURE__ */ __name((id35) => { + if (!clusterDb.has(id35)) { + return id35; + } + if (!clusterDb.get(id35).externalConnections) { + return id35; + } + if (clusterDb.has(id35)) { + return clusterDb.get(id35).id; + } + return id35; + }, "getAnchorId"); + adjustClustersAndEdges = /* @__PURE__ */ __name((graph, depth) => { + if (!graph || depth > 10) { + log.debug("Opting out, no graph "); + return; + } else { + log.debug("Opting in, graph "); + } + graph.nodes().forEach(function(id35) { + const children2 = graph.children(id35); + if (children2.length > 0) { + log.warn( + "Cluster identified", + id35, + " Replacement id in edges: ", + findNonClusterChild(id35, graph, id35) + ); + descendants.set(id35, extractDescendants(id35, graph)); + clusterDb.set(id35, { id: findNonClusterChild(id35, graph, id35), clusterData: graph.node(id35) }); + } + }); + graph.nodes().forEach(function(id35) { + const children2 = graph.children(id35); + const edges3 = graph.edges(); + if (children2.length > 0) { + log.debug("Cluster identified", id35, descendants); + edges3.forEach((edge) => { + const d1 = isDescendant2(edge.v, id35); + const d22 = isDescendant2(edge.w, id35); + if (d1 ^ d22) { + log.warn("Edge: ", edge, " leaves cluster ", id35); + log.warn("Descendants of XXX ", id35, ": ", descendants.get(id35)); + clusterDb.get(id35).externalConnections = true; + } + }); + } else { + log.debug("Not a cluster ", id35, descendants); + } + }); + for (let id35 of clusterDb.keys()) { + const nonClusterChild = clusterDb.get(id35).id; + const parent4 = graph.parent(nonClusterChild); + if (parent4 !== id35 && clusterDb.has(parent4) && !clusterDb.get(parent4).externalConnections) { + clusterDb.get(id35).id = parent4; + } + } + graph.edges().forEach(function(e3) { + const edge = graph.edge(e3); + log.warn("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(e3)); + log.warn("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(graph.edge(e3))); + let v3 = e3.v; + let w4 = e3.w; + log.warn( + "Fix XXX", + clusterDb, + "ids:", + e3.v, + e3.w, + "Translating: ", + clusterDb.get(e3.v), + " --- ", + clusterDb.get(e3.w) + ); + if (clusterDb.get(e3.v) || clusterDb.get(e3.w)) { + log.warn("Fixing and trying - removing XXX", e3.v, e3.w, e3.name); + v3 = getAnchorId(e3.v); + w4 = getAnchorId(e3.w); + graph.removeEdge(e3.v, e3.w, e3.name); + if (v3 !== e3.v) { + const parent4 = graph.parent(v3); + clusterDb.get(parent4).externalConnections = true; + edge.fromCluster = e3.v; + } + if (w4 !== e3.w) { + const parent4 = graph.parent(w4); + clusterDb.get(parent4).externalConnections = true; + edge.toCluster = e3.w; + } + log.warn("Fix Replacing with XXX", v3, w4, e3.name); + graph.setEdge(v3, w4, edge, e3.name); + } + }); + log.warn("Adjusted Graph", write(graph)); + extractor(graph, 0); + log.trace(clusterDb); + }, "adjustClustersAndEdges"); + extractor = /* @__PURE__ */ __name((graph, depth) => { + log.warn("extractor - ", depth, write(graph), graph.children("D")); + if (depth > 10) { + log.error("Bailing out"); + return; + } + let nodes5 = graph.nodes(); + let hasChildren = false; + for (const node2 of nodes5) { + const children2 = graph.children(node2); + hasChildren = hasChildren || children2.length > 0; + } + if (!hasChildren) { + log.debug("Done, no node has children", graph.nodes()); + return; + } + log.debug("Nodes = ", nodes5, depth); + for (const node2 of nodes5) { + log.debug( + "Extracting node", + node2, + clusterDb, + clusterDb.has(node2) && !clusterDb.get(node2).externalConnections, + !graph.parent(node2), + graph.node(node2), + graph.children("D"), + " Depth ", + depth + ); + if (!clusterDb.has(node2)) { + log.debug("Not a cluster", node2, depth); + } else if (!clusterDb.get(node2).externalConnections && graph.children(node2) && graph.children(node2).length > 0) { + log.warn( + "Cluster without external connections, without a parent and with children", + node2, + depth + ); + const graphSettings = graph.graph(); + let dir2 = graphSettings.rankdir === "TB" ? "LR" : "TB"; + if (clusterDb.get(node2)?.clusterData?.dir) { + dir2 = clusterDb.get(node2).clusterData.dir; + log.warn("Fixing dir", clusterDb.get(node2).clusterData.dir, dir2); + } + const clusterGraph = new Graph({ + multigraph: true, + compound: true + }).setGraph({ + rankdir: dir2, + nodesep: 50, + ranksep: 50, + marginx: 8, + marginy: 8 + }).setDefaultEdgeLabel(function() { + return {}; + }); + log.warn("Old graph before copy", write(graph)); + copy2(node2, graph, clusterGraph, node2); + graph.setNode(node2, { + clusterNode: true, + id: node2, + clusterData: clusterDb.get(node2).clusterData, + label: clusterDb.get(node2).label, + graph: clusterGraph + }); + log.warn("New graph after copy node: (", node2, ")", write(clusterGraph)); + log.debug("Old graph after copy", write(graph)); + } else { + log.warn( + "Cluster ** ", + node2, + " **not meeting the criteria !externalConnections:", + !clusterDb.get(node2).externalConnections, + " no parent: ", + !graph.parent(node2), + " children ", + graph.children(node2) && graph.children(node2).length > 0, + graph.children("D"), + depth + ); + log.debug(clusterDb); + } + } + nodes5 = graph.nodes(); + log.warn("New list of nodes", nodes5); + for (const node2 of nodes5) { + const data5 = graph.node(node2); + log.warn(" Now next level", node2, data5); + if (data5?.clusterNode) { + extractor(data5.graph, depth + 1); + } + } + }, "extractor"); + sorter = /* @__PURE__ */ __name((graph, nodes5) => { + if (nodes5.length === 0) { + return []; + } + let result = Object.assign([], nodes5); + nodes5.forEach((node2) => { + const children2 = graph.children(node2); + const sorted = sorter(graph, children2); + result = [...result, ...sorted]; + }); + return result; + }, "sorter"); + sortNodesByHierarchy = /* @__PURE__ */ __name((graph) => sorter(graph, graph.children()), "sortNodesByHierarchy"); + } + }); + + // src/rendering-util/layout-algorithms/dagre/index.js + var dagre_exports = {}; + __export(dagre_exports, { + render: () => render3 + }); + var recursiveRender, render3; + var init_dagre2 = __esm({ + "src/rendering-util/layout-algorithms/dagre/index.js"() { + "use strict"; + init_dagre(); + init_json(); + init_graphlib(); + init_markers(); + init_util(); + init_mermaid_graphlib(); + init_nodes2(); + init_clusters(); + init_edges(); + init_logger(); + init_subGraphTitleMargins(); + init_diagramAPI(); + recursiveRender = /* @__PURE__ */ __name(async (_elem, graph, diagramType, id35, parentCluster, siteConfig2) => { + log.warn("Graph in recursive render:XAX", write(graph), parentCluster); + const dir2 = graph.graph().rankdir; + log.trace("Dir in recursive render - dir:", dir2); + const elem = _elem.insert("g").attr("class", "root"); + if (!graph.nodes()) { + log.info("No nodes found for", graph); + } else { + log.info("Recursive render XXX", graph.nodes()); + } + if (graph.edges().length > 0) { + log.info("Recursive edges", graph.edge(graph.edges()[0])); + } + const clusters = elem.insert("g").attr("class", "clusters"); + const edgePaths = elem.insert("g").attr("class", "edgePaths"); + const edgeLabels3 = elem.insert("g").attr("class", "edgeLabels"); + const nodes5 = elem.insert("g").attr("class", "nodes"); + await Promise.all( + graph.nodes().map(async function(v3) { + const node2 = graph.node(v3); + if (parentCluster !== void 0) { + const data5 = JSON.parse(JSON.stringify(parentCluster.clusterData)); + log.trace( + "Setting data for parent cluster XXX\n Node.id = ", + v3, + "\n data=", + data5.height, + "\nParent cluster", + parentCluster.height + ); + graph.setNode(parentCluster.id, data5); + if (!graph.parent(v3)) { + log.trace("Setting parent", v3, parentCluster.id); + graph.setParent(v3, parentCluster.id, data5); + } + } + log.info("(Insert) Node XXX" + v3 + ": " + JSON.stringify(graph.node(v3))); + if (node2?.clusterNode) { + log.info("Cluster identified XBX", v3, node2.width, graph.node(v3)); + const { ranksep, nodesep } = graph.graph(); + node2.graph.setGraph({ + ...node2.graph.graph(), + ranksep: ranksep + 25, + nodesep + }); + const o2 = await recursiveRender( + nodes5, + node2.graph, + diagramType, + id35, + graph.node(v3), + siteConfig2 + ); + const newEl = o2.elem; + updateNodeBounds(node2, newEl); + node2.diff = o2.diff || 0; + log.info( + "New compound node after recursive render XAX", + v3, + "width", + // node, + node2.width, + "height", + node2.height + // node.x, + // node.y + ); + setNodeElem(newEl, node2); + } else { + if (graph.children(v3).length > 0) { + log.trace( + "Cluster - the non recursive path XBX", + v3, + node2.id, + node2, + node2.width, + "Graph:", + graph + ); + log.trace(findNonClusterChild(node2.id, graph)); + clusterDb.set(node2.id, { id: findNonClusterChild(node2.id, graph), node: node2 }); + } else { + log.trace("Node - the non recursive path XAX", v3, nodes5, graph.node(v3), dir2); + await insertNode(nodes5, graph.node(v3), { config: siteConfig2, dir: dir2 }); + } + } + }) + ); + const processEdges = /* @__PURE__ */ __name(async () => { + const edgePromises = graph.edges().map(async function(e3) { + const edge = graph.edge(e3.v, e3.w, e3.name); + log.info("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(e3)); + log.info("Edge " + e3.v + " -> " + e3.w + ": ", e3, " ", JSON.stringify(graph.edge(e3))); + log.info( + "Fix", + clusterDb, + "ids:", + e3.v, + e3.w, + "Translating: ", + clusterDb.get(e3.v), + clusterDb.get(e3.w) + ); + await insertEdgeLabel(edgeLabels3, edge); + }); + await Promise.all(edgePromises); + }, "processEdges"); + await processEdges(); + log.info("Graph before layout:", JSON.stringify(write(graph))); + log.info("############################################# XXX"); + log.info("### Layout ### XXX"); + log.info("############################################# XXX"); + layout(graph); + log.info("Graph after layout:", JSON.stringify(write(graph))); + let diff2 = 0; + let { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig2); + await Promise.all( + sortNodesByHierarchy(graph).map(async function(v3) { + const node2 = graph.node(v3); + log.info( + "Position XBX => " + v3 + ": (" + node2.x, + "," + node2.y, + ") width: ", + node2.width, + " height: ", + node2.height + ); + if (node2?.clusterNode) { + node2.y += subGraphTitleTotalMargin; + log.info( + "A tainted cluster node XBX1", + v3, + node2.id, + node2.width, + node2.height, + node2.x, + node2.y, + graph.parent(v3) + ); + clusterDb.get(node2.id).node = node2; + positionNode(node2); + } else { + if (graph.children(v3).length > 0) { + log.info( + "A pure cluster node XBX1", + v3, + node2.id, + node2.x, + node2.y, + node2.width, + node2.height, + graph.parent(v3) + ); + node2.height += subGraphTitleTotalMargin; + graph.node(node2.parentId); + const halfPadding = node2?.padding / 2 || 0; + const labelHeight = node2?.labelBBox?.height || 0; + const offsetY = labelHeight - halfPadding || 0; + log.debug("OffsetY", offsetY, "labelHeight", labelHeight, "halfPadding", halfPadding); + await insertCluster(clusters, node2); + clusterDb.get(node2.id).node = node2; + } else { + const parent4 = graph.node(node2.parentId); + node2.y += subGraphTitleTotalMargin / 2; + log.info( + "A regular node XBX1 - using the padding", + node2.id, + "parent", + node2.parentId, + node2.width, + node2.height, + node2.x, + node2.y, + "offsetY", + node2.offsetY, + "parent", + parent4, + parent4?.offsetY, + node2 + ); + positionNode(node2); + } + } + }) + ); + graph.edges().forEach(function(e3) { + const edge = graph.edge(e3); + log.info("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(edge), edge); + edge.points.forEach((point8) => point8.y += subGraphTitleTotalMargin / 2); + const startNode = graph.node(e3.v); + var endNode = graph.node(e3.w); + const paths = insertEdge(edgePaths, edge, clusterDb, diagramType, startNode, endNode, id35); + positionEdgeLabel(edge, paths); + }); + graph.nodes().forEach(function(v3) { + const n2 = graph.node(v3); + log.info(v3, n2.type, n2.diff); + if (n2.isGroup) { + diff2 = n2.diff; + } + }); + log.warn("Returning from recursive render XAX", elem, diff2); + return { elem, diff: diff2 }; + }, "recursiveRender"); + render3 = /* @__PURE__ */ __name(async (data4Layout, svg2) => { + const graph = new Graph({ + multigraph: true, + compound: true + }).setGraph({ + rankdir: data4Layout.direction, + nodesep: data4Layout.config?.nodeSpacing || data4Layout.config?.flowchart?.nodeSpacing || data4Layout.nodeSpacing, + ranksep: data4Layout.config?.rankSpacing || data4Layout.config?.flowchart?.rankSpacing || data4Layout.rankSpacing, + marginx: 8, + marginy: 8 + }).setDefaultEdgeLabel(function() { + return {}; + }); + const element3 = svg2.select("g"); + markers_default(element3, data4Layout.markers, data4Layout.type, data4Layout.diagramId); + clear5(); + clear4(); + clear3(); + clear6(); + data4Layout.nodes.forEach((node2) => { + graph.setNode(node2.id, { ...node2 }); + if (node2.parentId) { + graph.setParent(node2.id, node2.parentId); + } + }); + log.debug("Edges:", data4Layout.edges); + data4Layout.edges.forEach((edge) => { + if (edge.start === edge.end) { + const nodeId = edge.start; + const specialId1 = nodeId + "---" + nodeId + "---1"; + const specialId2 = nodeId + "---" + nodeId + "---2"; + const node2 = graph.node(nodeId); + graph.setNode(specialId1, { + domId: specialId1, + id: specialId1, + parentId: node2.parentId, + labelStyle: "", + label: "", + padding: 0, + shape: "labelRect", + // shape: 'rect', + style: "", + width: 10, + height: 10 + }); + graph.setParent(specialId1, node2.parentId); + graph.setNode(specialId2, { + domId: specialId2, + id: specialId2, + parentId: node2.parentId, + labelStyle: "", + padding: 0, + // shape: 'rect', + shape: "labelRect", + label: "", + style: "", + width: 10, + height: 10 + }); + graph.setParent(specialId2, node2.parentId); + const edge1 = structuredClone(edge); + const edgeMid = structuredClone(edge); + const edge2 = structuredClone(edge); + edge1.label = ""; + edge1.arrowTypeEnd = "none"; + edge1.endLabelLeft = ""; + edge1.endLabelRight = ""; + edge1.startLabelLeft = ""; + edge1.id = nodeId + "-cyclic-special-1"; + edgeMid.startLabelRight = ""; + edgeMid.startLabelLeft = ""; + edgeMid.endLabelLeft = ""; + edgeMid.endLabelRight = ""; + edgeMid.arrowTypeStart = "none"; + edgeMid.arrowTypeEnd = "none"; + edgeMid.id = nodeId + "-cyclic-special-mid"; + edge2.label = ""; + edge2.startLabelRight = ""; + edge2.startLabelLeft = ""; + edge2.arrowTypeStart = "none"; + if (node2.isGroup) { + edge1.fromCluster = nodeId; + edge2.toCluster = nodeId; + } + edge2.id = nodeId + "-cyclic-special-2"; + edge2.arrowTypeStart = "none"; + graph.setEdge(nodeId, specialId1, edge1, nodeId + "-cyclic-special-0"); + graph.setEdge(specialId1, specialId2, edgeMid, nodeId + "-cyclic-special-1"); + graph.setEdge(specialId2, nodeId, edge2, nodeId + "-cyc r2.length) && (a2 = r2.length); + for (var e3 = 0, n2 = Array(a2); e3 < a2; e3++) n2[e3] = r2[e3]; + return n2; + } + function _arrayWithHoles(r2) { + if (Array.isArray(r2)) return r2; + } + function _arrayWithoutHoles(r2) { + if (Array.isArray(r2)) return _arrayLikeToArray(r2); + } + function _classCallCheck(a2, n2) { + if (!(a2 instanceof n2)) throw new TypeError("Cannot call a class as a function"); + } + function _defineProperties(e3, r2) { + for (var t4 = 0; t4 < r2.length; t4++) { + var o2 = r2[t4]; + o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e3, _toPropertyKey(o2.key), o2); + } + } + function _createClass(e3, r2, t4) { + return r2 && _defineProperties(e3.prototype, r2), Object.defineProperty(e3, "prototype", { + writable: false + }), e3; + } + function _createForOfIteratorHelper(r2, e3) { + var t4 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; + if (!t4) { + if (Array.isArray(r2) || (t4 = _unsupportedIterableToArray(r2)) || e3) { + t4 && (r2 = t4); + var n2 = 0, F3 = /* @__PURE__ */ __name(function() { + }, "F"); + return { + s: F3, + n: /* @__PURE__ */ __name(function() { + return n2 >= r2.length ? { + done: true + } : { + done: false, + value: r2[n2++] + }; + }, "n"), + e: /* @__PURE__ */ __name(function(r3) { + throw r3; + }, "e"), + f: F3 + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var o2, a2 = true, u2 = false; + return { + s: /* @__PURE__ */ __name(function() { + t4 = t4.call(r2); + }, "s"), + n: /* @__PURE__ */ __name(function() { + var r3 = t4.next(); + return a2 = r3.done, r3; + }, "n"), + e: /* @__PURE__ */ __name(function(r3) { + u2 = true, o2 = r3; + }, "e"), + f: /* @__PURE__ */ __name(function() { + try { + a2 || null == t4.return || t4.return(); + } finally { + if (u2) throw o2; + } + }, "f") + }; + } + function _defineProperty$1(e3, r2, t4) { + return (r2 = _toPropertyKey(r2)) in e3 ? Object.defineProperty(e3, r2, { + value: t4, + enumerable: true, + configurable: true, + writable: true + }) : e3[r2] = t4, e3; + } + function _iterableToArray(r2) { + if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"]) return Array.from(r2); + } + function _iterableToArrayLimit(r2, l4) { + var t4 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; + if (null != t4) { + var e3, n2, i2, u2, a2 = [], f2 = true, o2 = false; + try { + if (i2 = (t4 = t4.call(r2)).next, 0 === l4) { + if (Object(t4) !== t4) return; + f2 = false; + } else for (; !(f2 = (e3 = i2.call(t4)).done) && (a2.push(e3.value), a2.length !== l4); f2 = true) ; + } catch (r3) { + o2 = true, n2 = r3; + } finally { + try { + if (!f2 && null != t4.return && (u2 = t4.return(), Object(u2) !== u2)) return; + } finally { + if (o2) throw n2; + } + } + return a2; + } + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _slicedToArray(r2, e3) { + return _arrayWithHoles(r2) || _iterableToArrayLimit(r2, e3) || _unsupportedIterableToArray(r2, e3) || _nonIterableRest(); + } + function _toConsumableArray(r2) { + return _arrayWithoutHoles(r2) || _iterableToArray(r2) || _unsupportedIterableToArray(r2) || _nonIterableSpread(); + } + function _toPrimitive(t4, r2) { + if ("object" != typeof t4 || !t4) return t4; + var e3 = t4[Symbol.toPrimitive]; + if (void 0 !== e3) { + var i2 = e3.call(t4, r2); + if ("object" != typeof i2) return i2; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return String(t4); + } + function _toPropertyKey(t4) { + var i2 = _toPrimitive(t4, "string"); + return "symbol" == typeof i2 ? i2 : i2 + ""; + } + function _typeof(o2) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { + return typeof o3; + } : function(o3) { + return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; + }, _typeof(o2); + } + function _unsupportedIterableToArray(r2, a2) { + if (r2) { + if ("string" == typeof r2) return _arrayLikeToArray(r2, a2); + var t4 = {}.toString.call(r2).slice(8, -1); + return "Object" === t4 && r2.constructor && (t4 = r2.constructor.name), "Map" === t4 || "Set" === t4 ? Array.from(r2) : "Arguments" === t4 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t4) ? _arrayLikeToArray(r2, a2) : void 0; + } + } + function getDefaultExportFromCjs(x5) { + return x5 && x5.__esModule && Object.prototype.hasOwnProperty.call(x5, "default") ? x5["default"] : x5; + } + function requireIsObject() { + if (hasRequiredIsObject) return isObject_12; + hasRequiredIsObject = 1; + function isObject4(value2) { + var type3 = typeof value2; + return value2 != null && (type3 == "object" || type3 == "function"); + } + __name(isObject4, "isObject"); + isObject_12 = isObject4; + return isObject_12; + } + function require_freeGlobal() { + if (hasRequired_freeGlobal) return _freeGlobal; + hasRequired_freeGlobal = 1; + var freeGlobal3 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; + _freeGlobal = freeGlobal3; + return _freeGlobal; + } + function require_root() { + if (hasRequired_root) return _root; + hasRequired_root = 1; + var freeGlobal3 = require_freeGlobal(); + var freeSelf3 = typeof self == "object" && self && self.Object === Object && self; + var root4 = freeGlobal3 || freeSelf3 || Function("return this")(); + _root = root4; + return _root; + } + function requireNow() { + if (hasRequiredNow) return now_1; + hasRequiredNow = 1; + var root4 = require_root(); + var now3 = /* @__PURE__ */ __name(function() { + return root4.Date.now(); + }, "now"); + now_1 = now3; + return now_1; + } + function require_trimmedEndIndex() { + if (hasRequired_trimmedEndIndex) return _trimmedEndIndex; + hasRequired_trimmedEndIndex = 1; + var reWhitespace3 = /\s/; + function trimmedEndIndex3(string3) { + var index = string3.length; + while (index-- && reWhitespace3.test(string3.charAt(index))) { + } + return index; + } + __name(trimmedEndIndex3, "trimmedEndIndex"); + _trimmedEndIndex = trimmedEndIndex3; + return _trimmedEndIndex; + } + function require_baseTrim() { + if (hasRequired_baseTrim) return _baseTrim; + hasRequired_baseTrim = 1; + var trimmedEndIndex3 = require_trimmedEndIndex(); + var reTrimStart3 = /^\s+/; + function baseTrim3(string3) { + return string3 ? string3.slice(0, trimmedEndIndex3(string3) + 1).replace(reTrimStart3, "") : string3; + } + __name(baseTrim3, "baseTrim"); + _baseTrim = baseTrim3; + return _baseTrim; + } + function require_Symbol() { + if (hasRequired_Symbol) return _Symbol; + hasRequired_Symbol = 1; + var root4 = require_root(); + var Symbol4 = root4.Symbol; + _Symbol = Symbol4; + return _Symbol; + } + function require_getRawTag() { + if (hasRequired_getRawTag) return _getRawTag; + hasRequired_getRawTag = 1; + var Symbol4 = require_Symbol(); + var objectProto34 = Object.prototype; + var hasOwnProperty28 = objectProto34.hasOwnProperty; + var nativeObjectToString5 = objectProto34.toString; + var symToStringTag5 = Symbol4 ? Symbol4.toStringTag : void 0; + function getRawTag3(value2) { + var isOwn = hasOwnProperty28.call(value2, symToStringTag5), tag = value2[symToStringTag5]; + try { + value2[symToStringTag5] = void 0; + var unmasked = true; + } catch (e3) { + } + var result = nativeObjectToString5.call(value2); + if (unmasked) { + if (isOwn) { + value2[symToStringTag5] = tag; + } else { + delete value2[symToStringTag5]; + } + } + return result; + } + __name(getRawTag3, "getRawTag"); + _getRawTag = getRawTag3; + return _getRawTag; + } + function require_objectToString() { + if (hasRequired_objectToString) return _objectToString; + hasRequired_objectToString = 1; + var objectProto34 = Object.prototype; + var nativeObjectToString5 = objectProto34.toString; + function objectToString3(value2) { + return nativeObjectToString5.call(value2); + } + __name(objectToString3, "objectToString"); + _objectToString = objectToString3; + return _objectToString; + } + function require_baseGetTag() { + if (hasRequired_baseGetTag) return _baseGetTag; + hasRequired_baseGetTag = 1; + var Symbol4 = require_Symbol(), getRawTag3 = require_getRawTag(), objectToString3 = require_objectToString(); + var nullTag3 = "[object Null]", undefinedTag3 = "[object Undefined]"; + var symToStringTag5 = Symbol4 ? Symbol4.toStringTag : void 0; + function baseGetTag3(value2) { + if (value2 == null) { + return value2 === void 0 ? undefinedTag3 : nullTag3; + } + return symToStringTag5 && symToStringTag5 in Object(value2) ? getRawTag3(value2) : objectToString3(value2); + } + __name(baseGetTag3, "baseGetTag"); + _baseGetTag = baseGetTag3; + return _baseGetTag; + } + function requireIsObjectLike() { + if (hasRequiredIsObjectLike) return isObjectLike_1; + hasRequiredIsObjectLike = 1; + function isObjectLike4(value2) { + return value2 != null && typeof value2 == "object"; + } + __name(isObjectLike4, "isObjectLike"); + isObjectLike_1 = isObjectLike4; + return isObjectLike_1; + } + function requireIsSymbol() { + if (hasRequiredIsSymbol) return isSymbol_1; + hasRequiredIsSymbol = 1; + var baseGetTag3 = require_baseGetTag(), isObjectLike4 = requireIsObjectLike(); + var symbolTag7 = "[object Symbol]"; + function isSymbol3(value2) { + return typeof value2 == "symbol" || isObjectLike4(value2) && baseGetTag3(value2) == symbolTag7; + } + __name(isSymbol3, "isSymbol"); + isSymbol_1 = isSymbol3; + return isSymbol_1; + } + function requireToNumber() { + if (hasRequiredToNumber) return toNumber_1; + hasRequiredToNumber = 1; + var baseTrim3 = require_baseTrim(), isObject4 = requireIsObject(), isSymbol3 = requireIsSymbol(); + var NAN3 = 0 / 0; + var reIsBadHex3 = /^[-+]0x[0-9a-f]+$/i; + var reIsBinary3 = /^0b[01]+$/i; + var reIsOctal3 = /^0o[0-7]+$/i; + var freeParseInt3 = parseInt; + function toNumber3(value2) { + if (typeof value2 == "number") { + return value2; + } + if (isSymbol3(value2)) { + return NAN3; + } + if (isObject4(value2)) { + var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2; + value2 = isObject4(other) ? other + "" : other; + } + if (typeof value2 != "string") { + return value2 === 0 ? value2 : +value2; + } + value2 = baseTrim3(value2); + var isBinary2 = reIsBinary3.test(value2); + return isBinary2 || reIsOctal3.test(value2) ? freeParseInt3(value2.slice(2), isBinary2 ? 2 : 8) : reIsBadHex3.test(value2) ? NAN3 : +value2; + } + __name(toNumber3, "toNumber"); + toNumber_1 = toNumber3; + return toNumber_1; + } + function requireDebounce() { + if (hasRequiredDebounce) return debounce_1; + hasRequiredDebounce = 1; + var isObject4 = requireIsObject(), now3 = requireNow(), toNumber3 = requireToNumber(); + var FUNC_ERROR_TEXT4 = "Expected a function"; + var nativeMax5 = Math.max, nativeMin = Math.min; + function debounce2(func, wait, options2) { + var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; + if (typeof func != "function") { + throw new TypeError(FUNC_ERROR_TEXT4); + } + wait = toNumber3(wait) || 0; + if (isObject4(options2)) { + leading = !!options2.leading; + maxing = "maxWait" in options2; + maxWait = maxing ? nativeMax5(toNumber3(options2.maxWait) || 0, wait) : maxWait; + trailing = "trailing" in options2 ? !!options2.trailing : trailing; + } + function invokeFunc(time4) { + var args = lastArgs, thisArg = lastThis; + lastArgs = lastThis = void 0; + lastInvokeTime = time4; + result = func.apply(thisArg, args); + return result; + } + __name(invokeFunc, "invokeFunc"); + function leadingEdge(time4) { + lastInvokeTime = time4; + timerId = setTimeout(timerExpired, wait); + return leading ? invokeFunc(time4) : result; + } + __name(leadingEdge, "leadingEdge"); + function remainingWait(time4) { + var timeSinceLastCall = time4 - lastCallTime, timeSinceLastInvoke = time4 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; + return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; + } + __name(remainingWait, "remainingWait"); + function shouldInvoke(time4) { + var timeSinceLastCall = time4 - lastCallTime, timeSinceLastInvoke = time4 - lastInvokeTime; + return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; + } + __name(shouldInvoke, "shouldInvoke"); + function timerExpired() { + var time4 = now3(); + if (shouldInvoke(time4)) { + return trailingEdge(time4); + } + timerId = setTimeout(timerExpired, remainingWait(time4)); + } + __name(timerExpired, "timerExpired"); + function trailingEdge(time4) { + timerId = void 0; + if (trailing && lastArgs) { + return invokeFunc(time4); + } + lastArgs = lastThis = void 0; + return result; + } + __name(trailingEdge, "trailingEdge"); + function cancel() { + if (timerId !== void 0) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = void 0; + } + __name(cancel, "cancel"); + function flush() { + return timerId === void 0 ? result : trailingEdge(now3()); + } + __name(flush, "flush"); + function debounced() { + var time4 = now3(), isInvoking = shouldInvoke(time4); + lastArgs = arguments; + lastThis = this; + lastCallTime = time4; + if (isInvoking) { + if (timerId === void 0) { + return leadingEdge(lastCallTime); + } + if (maxing) { + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === void 0) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + __name(debounced, "debounced"); + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; + } + __name(debounce2, "debounce"); + debounce_1 = debounce2; + return debounce_1; + } + function rotatePoint(x5, y6, centerX, centerY, angleDegrees) { + var angleRadians = angleDegrees * Math.PI / 180; + var rotatedX = Math.cos(angleRadians) * (x5 - centerX) - Math.sin(angleRadians) * (y6 - centerY) + centerX; + var rotatedY = Math.sin(angleRadians) * (x5 - centerX) + Math.cos(angleRadians) * (y6 - centerY) + centerY; + return { + x: rotatedX, + y: rotatedY + }; + } + function rotatePosAndSkewByBox(pos, box, angleDegrees) { + if (angleDegrees === 0) return pos; + var centerX = (box.x1 + box.x2) / 2; + var centerY = (box.y1 + box.y2) / 2; + var skewX = box.w / box.h; + var skewY = 1 / skewX; + var rotated = rotatePoint(pos.x, pos.y, centerX, centerY, angleDegrees); + var skewed = movePointByBoxAspect(rotated.x, rotated.y, centerX, centerY, skewX, skewY); + return { + x: skewed.x, + y: skewed.y + }; + } + function requireHeap$1() { + if (hasRequiredHeap$1) return heap$2.exports; + hasRequiredHeap$1 = 1; + (function(module2, exports2) { + (function() { + var Heap2, defaultCmp, floor, heapify, heappop, heappush, heappushpop, heapreplace, insort, min10, nlargest, nsmallest, updateItem, _siftdown, _siftup; + floor = Math.floor, min10 = Math.min; + defaultCmp = /* @__PURE__ */ __name(function(x5, y6) { + if (x5 < y6) { + return -1; + } + if (x5 > y6) { + return 1; + } + return 0; + }, "defaultCmp"); + insort = /* @__PURE__ */ __name(function(a2, x5, lo, hi, cmp) { + var mid; + if (lo == null) { + lo = 0; + } + if (cmp == null) { + cmp = defaultCmp; + } + if (lo < 0) { + throw new Error("lo must be non-negative"); + } + if (hi == null) { + hi = a2.length; + } + while (lo < hi) { + mid = floor((lo + hi) / 2); + if (cmp(x5, a2[mid]) < 0) { + hi = mid; + } else { + lo = mid + 1; + } + } + return [].splice.apply(a2, [lo, lo - lo].concat(x5)), x5; + }, "insort"); + heappush = /* @__PURE__ */ __name(function(array4, item, cmp) { + if (cmp == null) { + cmp = defaultCmp; + } + array4.push(item); + return _siftdown(array4, 0, array4.length - 1, cmp); + }, "heappush"); + heappop = /* @__PURE__ */ __name(function(array4, cmp) { + var lastelt, returnitem; + if (cmp == null) { + cmp = defaultCmp; + } + lastelt = array4.pop(); + if (array4.length) { + returnitem = array4[0]; + array4[0] = lastelt; + _siftup(array4, 0, cmp); + } else { + returnitem = lastelt; + } + return returnitem; + }, "heappop"); + heapreplace = /* @__PURE__ */ __name(function(array4, item, cmp) { + var returnitem; + if (cmp == null) { + cmp = defaultCmp; + } + returnitem = array4[0]; + array4[0] = item; + _siftup(array4, 0, cmp); + return returnitem; + }, "heapreplace"); + heappushpop = /* @__PURE__ */ __name(function(array4, item, cmp) { + var _ref; + if (cmp == null) { + cmp = defaultCmp; + } + if (array4.length && cmp(array4[0], item) < 0) { + _ref = [array4[0], item], item = _ref[0], array4[0] = _ref[1]; + _siftup(array4, 0, cmp); + } + return item; + }, "heappushpop"); + heapify = /* @__PURE__ */ __name(function(array4, cmp) { + var i2, _i, _len, _ref1, _results, _results1; + if (cmp == null) { + cmp = defaultCmp; + } + _ref1 = (function() { + _results1 = []; + for (var _j = 0, _ref = floor(array4.length / 2); 0 <= _ref ? _j < _ref : _j > _ref; 0 <= _ref ? _j++ : _j--) { + _results1.push(_j); + } + return _results1; + }).apply(this).reverse(); + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + i2 = _ref1[_i]; + _results.push(_siftup(array4, i2, cmp)); + } + return _results; + }, "heapify"); + updateItem = /* @__PURE__ */ __name(function(array4, item, cmp) { + var pos; + if (cmp == null) { + cmp = defaultCmp; + } + pos = array4.indexOf(item); + if (pos === -1) { + return; + } + _siftdown(array4, 0, pos, cmp); + return _siftup(array4, pos, cmp); + }, "updateItem"); + nlargest = /* @__PURE__ */ __name(function(array4, n2, cmp) { + var elem, result, _i, _len, _ref; + if (cmp == null) { + cmp = defaultCmp; + } + result = array4.slice(0, n2); + if (!result.length) { + return result; + } + heapify(result, cmp); + _ref = array4.slice(n2); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + elem = _ref[_i]; + heappushpop(result, elem, cmp); + } + return result.sort(cmp).reverse(); + }, "nlargest"); + nsmallest = /* @__PURE__ */ __name(function(array4, n2, cmp) { + var elem, los, result, _i, _j, _len, _ref, _ref1, _results; + if (cmp == null) { + cmp = defaultCmp; + } + if (n2 * 10 <= array4.length) { + result = array4.slice(0, n2).sort(cmp); + if (!result.length) { + return result; + } + los = result[result.length - 1]; + _ref = array4.slice(n2); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + elem = _ref[_i]; + if (cmp(elem, los) < 0) { + insort(result, elem, 0, null, cmp); + result.pop(); + los = result[result.length - 1]; + } + } + return result; + } + heapify(array4, cmp); + _results = []; + for (_j = 0, _ref1 = min10(n2, array4.length); 0 <= _ref1 ? _j < _ref1 : _j > _ref1; 0 <= _ref1 ? ++_j : --_j) { + _results.push(heappop(array4, cmp)); + } + return _results; + }, "nsmallest"); + _siftdown = /* @__PURE__ */ __name(function(array4, startpos, pos, cmp) { + var newitem, parent4, parentpos; + if (cmp == null) { + cmp = defaultCmp; + } + newitem = array4[pos]; + while (pos > startpos) { + parentpos = pos - 1 >> 1; + parent4 = array4[parentpos]; + if (cmp(newitem, parent4) < 0) { + array4[pos] = parent4; + pos = parentpos; + continue; + } + break; + } + return array4[pos] = newitem; + }, "_siftdown"); + _siftup = /* @__PURE__ */ __name(function(array4, pos, cmp) { + var childpos, endpos, newitem, rightpos, startpos; + if (cmp == null) { + cmp = defaultCmp; + } + endpos = array4.length; + startpos = pos; + newitem = array4[pos]; + childpos = 2 * pos + 1; + while (childpos < endpos) { + rightpos = childpos + 1; + if (rightpos < endpos && !(cmp(array4[childpos], array4[rightpos]) < 0)) { + childpos = rightpos; + } + array4[pos] = array4[childpos]; + pos = childpos; + childpos = 2 * pos + 1; + } + array4[pos] = newitem; + return _siftdown(array4, startpos, pos, cmp); + }, "_siftup"); + Heap2 = (function() { + Heap3.push = heappush; + Heap3.pop = heappop; + Heap3.replace = heapreplace; + Heap3.pushpop = heappushpop; + Heap3.heapify = heapify; + Heap3.updateItem = updateItem; + Heap3.nlargest = nlargest; + Heap3.nsmallest = nsmallest; + function Heap3(cmp) { + this.cmp = cmp != null ? cmp : defaultCmp; + this.nodes = []; + } + __name(Heap3, "Heap"); + Heap3.prototype.push = function(x5) { + return heappush(this.nodes, x5, this.cmp); + }; + Heap3.prototype.pop = function() { + return heappop(this.nodes, this.cmp); + }; + Heap3.prototype.peek = function() { + return this.nodes[0]; + }; + Heap3.prototype.contains = function(x5) { + return this.nodes.indexOf(x5) !== -1; + }; + Heap3.prototype.replace = function(x5) { + return heapreplace(this.nodes, x5, this.cmp); + }; + Heap3.prototype.pushpop = function(x5) { + return heappushpop(this.nodes, x5, this.cmp); + }; + Heap3.prototype.heapify = function() { + return heapify(this.nodes, this.cmp); + }; + Heap3.prototype.updateItem = function(x5) { + return updateItem(this.nodes, x5, this.cmp); + }; + Heap3.prototype.clear = function() { + return this.nodes = []; + }; + Heap3.prototype.empty = function() { + return this.nodes.length === 0; + }; + Heap3.prototype.size = function() { + return this.nodes.length; + }; + Heap3.prototype.clone = function() { + var heap2; + heap2 = new Heap3(); + heap2.nodes = this.nodes.slice(0); + return heap2; + }; + Heap3.prototype.toArray = function() { + return this.nodes.slice(0); + }; + Heap3.prototype.insert = Heap3.prototype.push; + Heap3.prototype.top = Heap3.prototype.peek; + Heap3.prototype.front = Heap3.prototype.peek; + Heap3.prototype.has = Heap3.prototype.contains; + Heap3.prototype.copy = Heap3.prototype.clone; + return Heap3; + })(); + (function(root4, factory) { + { + return module2.exports = factory(); + } + })(this, function() { + return Heap2; + }); + }).call(heap$1); + })(heap$2); + return heap$2.exports; + } + function requireHeap() { + if (hasRequiredHeap) return heap; + hasRequiredHeap = 1; + heap = requireHeap$1(); + return heap; + } + function inflatePolygon(polygon2, d3) { + if (polygon2.length < 3) { + throw new Error("Need at least 3 vertices"); + } + var add3 = /* @__PURE__ */ __name(function add4(a2, b3) { + return { + x: a2.x + b3.x, + y: a2.y + b3.y + }; + }, "add"); + var sub2 = /* @__PURE__ */ __name(function sub3(a2, b3) { + return { + x: a2.x - b3.x, + y: a2.y - b3.y + }; + }, "sub"); + var scale3 = /* @__PURE__ */ __name(function scale4(v3, s2) { + return { + x: v3.x * s2, + y: v3.y * s2 + }; + }, "scale"); + var cross3 = /* @__PURE__ */ __name(function cross4(u2, v3) { + return u2.x * v3.y - u2.y * v3.x; + }, "cross"); + var normalize4 = /* @__PURE__ */ __name(function normalize5(v3) { + var len = hypot(v3.x, v3.y); + return len === 0 ? { + x: 0, + y: 0 + } : { + x: v3.x / len, + y: v3.y / len + }; + }, "normalize"); + var signedArea = /* @__PURE__ */ __name(function signedArea2(pts3) { + var A2 = 0; + for (var i3 = 0; i3 < pts3.length; i3++) { + var p4 = pts3[i3], q4 = pts3[(i3 + 1) % pts3.length]; + A2 += p4.x * q4.y - q4.x * p4.y; + } + return A2 / 2; + }, "signedArea"); + var intersectLines = /* @__PURE__ */ __name(function intersectLines2(p1, p22, p32, p4) { + var r2 = sub2(p22, p1); + var s2 = sub2(p4, p32); + var denom = cross3(r2, s2); + if (Math.abs(denom) < 1e-9) { + return add3(p1, scale3(r2, 0.5)); + } + var t4 = cross3(sub2(p32, p1), s2) / denom; + return add3(p1, scale3(r2, t4)); + }, "intersectLines"); + var pts2 = polygon2.map(function(p4) { + return { + x: p4.x, + y: p4.y + }; + }); + if (signedArea(pts2) < 0) pts2.reverse(); + var n2 = pts2.length; + var normals = []; + for (var i2 = 0; i2 < n2; i2++) { + var p3 = pts2[i2], q3 = pts2[(i2 + 1) % n2]; + var edge = sub2(q3, p3); + var out = normalize4({ + x: edge.y, + y: -edge.x + }); + normals.push(out); + } + var offsetEdges = normals.map(function(nrm, i3) { + var p1 = add3(pts2[i3], scale3(nrm, d3)); + var p22 = add3(pts2[(i3 + 1) % n2], scale3(nrm, d3)); + return { + p1, + p2: p22 + }; + }); + var inflated = []; + for (var _i2 = 0; _i2 < n2; _i2++) { + var prevEdge = offsetEdges[(_i2 - 1 + n2) % n2]; + var currEdge = offsetEdges[_i2]; + var ip = intersectLines(prevEdge.p1, prevEdge.p2, currEdge.p1, currEdge.p2); + inflated.push(ip); + } + return inflated; + } + function miterBox(pts2, centerX, centerY, width3, height2, strokeWidth) { + var tpts = transformPoints(pts2, centerX, centerY, width3, height2); + var offsetPoints = inflatePolygon(tpts, strokeWidth); + var bb = makeBoundingBox(); + offsetPoints.forEach(function(pt) { + return expandBoundingBoxByPoint(bb, pt.x, pt.y); + }); + return bb; + } + function satPolygonIntersection(poly1, poly2) { + function getAxes2(polygon2) { + var axes2 = []; + for (var i2 = 0; i2 < polygon2.length; i2++) { + var p1 = polygon2[i2]; + var p22 = polygon2[(i2 + 1) % polygon2.length]; + var edge = { + x: p22.x - p1.x, + y: p22.y - p1.y + }; + var normal = { + x: -edge.y, + y: edge.x + }; + var length2 = Math.sqrt(normal.x * normal.x + normal.y * normal.y); + axes2.push({ + x: normal.x / length2, + y: normal.y / length2 + }); + } + return axes2; + } + __name(getAxes2, "getAxes"); + function project(polygon2, axis3) { + var min10 = Infinity; + var max10 = -Infinity; + var _iterator = _createForOfIteratorHelper(polygon2), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var point8 = _step.value; + var projection2 = point8.x * axis3.x + point8.y * axis3.y; + min10 = Math.min(min10, projection2); + max10 = Math.max(max10, projection2); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return { + min: min10, + max: max10 + }; + } + __name(project, "project"); + function overlaps(proj12, proj22) { + return !(proj12.max < proj22.min || proj22.max < proj12.min); + } + __name(overlaps, "overlaps"); + var axes = [].concat(_toConsumableArray(getAxes2(poly1)), _toConsumableArray(getAxes2(poly2))); + var _iterator2 = _createForOfIteratorHelper(axes), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var axis2 = _step2.value; + var proj1 = project(poly1, axis2); + var proj2 = project(poly2, axis2); + if (!overlaps(proj1, proj2)) { + return false; + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + return true; + } + function clusteringDistance(method, length2, getP, getQ, nodeP, nodeQ) { + var impl2; + if (fn$6(method)) { + impl2 = method; + } else { + impl2 = distances[method] || distances.euclidean; + } + if (length2 === 0 && fn$6(method)) { + return impl2(nodeP, nodeQ); + } else { + return impl2(length2, getP, getQ, nodeP, nodeQ); + } + } + function requireIsArray() { + if (hasRequiredIsArray) return isArray_1; + hasRequiredIsArray = 1; + var isArray4 = Array.isArray; + isArray_1 = isArray4; + return isArray_1; + } + function require_isKey() { + if (hasRequired_isKey) return _isKey; + hasRequired_isKey = 1; + var isArray4 = requireIsArray(), isSymbol3 = requireIsSymbol(); + var reIsDeepProp3 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp3 = /^\w*$/; + function isKey3(value2, object3) { + if (isArray4(value2)) { + return false; + } + var type3 = typeof value2; + if (type3 == "number" || type3 == "symbol" || type3 == "boolean" || value2 == null || isSymbol3(value2)) { + return true; + } + return reIsPlainProp3.test(value2) || !reIsDeepProp3.test(value2) || object3 != null && value2 in Object(object3); + } + __name(isKey3, "isKey"); + _isKey = isKey3; + return _isKey; + } + function requireIsFunction() { + if (hasRequiredIsFunction) return isFunction_1; + hasRequiredIsFunction = 1; + var baseGetTag3 = require_baseGetTag(), isObject4 = requireIsObject(); + var asyncTag3 = "[object AsyncFunction]", funcTag6 = "[object Function]", genTag4 = "[object GeneratorFunction]", proxyTag3 = "[object Proxy]"; + function isFunction3(value2) { + if (!isObject4(value2)) { + return false; + } + var tag = baseGetTag3(value2); + return tag == funcTag6 || tag == genTag4 || tag == asyncTag3 || tag == proxyTag3; + } + __name(isFunction3, "isFunction"); + isFunction_1 = isFunction3; + return isFunction_1; + } + function require_coreJsData() { + if (hasRequired_coreJsData) return _coreJsData; + hasRequired_coreJsData = 1; + var root4 = require_root(); + var coreJsData3 = root4["__core-js_shared__"]; + _coreJsData = coreJsData3; + return _coreJsData; + } + function require_isMasked() { + if (hasRequired_isMasked) return _isMasked; + hasRequired_isMasked = 1; + var coreJsData3 = require_coreJsData(); + var maskSrcKey3 = (function() { + var uid = /[^.]+$/.exec(coreJsData3 && coreJsData3.keys && coreJsData3.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; + })(); + function isMasked3(func) { + return !!maskSrcKey3 && maskSrcKey3 in func; + } + __name(isMasked3, "isMasked"); + _isMasked = isMasked3; + return _isMasked; + } + function require_toSource() { + if (hasRequired_toSource) return _toSource; + hasRequired_toSource = 1; + var funcProto5 = Function.prototype; + var funcToString5 = funcProto5.toString; + function toSource3(func) { + if (func != null) { + try { + return funcToString5.call(func); + } catch (e3) { + } + try { + return func + ""; + } catch (e3) { + } + } + return ""; + } + __name(toSource3, "toSource"); + _toSource = toSource3; + return _toSource; + } + function require_baseIsNative() { + if (hasRequired_baseIsNative) return _baseIsNative; + hasRequired_baseIsNative = 1; + var isFunction3 = requireIsFunction(), isMasked3 = require_isMasked(), isObject4 = requireIsObject(), toSource3 = require_toSource(); + var reRegExpChar3 = /[\\^$.*+?()[\]{}|]/g; + var reIsHostCtor3 = /^\[object .+?Constructor\]$/; + var funcProto5 = Function.prototype, objectProto34 = Object.prototype; + var funcToString5 = funcProto5.toString; + var hasOwnProperty28 = objectProto34.hasOwnProperty; + var reIsNative3 = RegExp( + "^" + funcToString5.call(hasOwnProperty28).replace(reRegExpChar3, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + function baseIsNative3(value2) { + if (!isObject4(value2) || isMasked3(value2)) { + return false; + } + var pattern = isFunction3(value2) ? reIsNative3 : reIsHostCtor3; + return pattern.test(toSource3(value2)); + } + __name(baseIsNative3, "baseIsNative"); + _baseIsNative = baseIsNative3; + return _baseIsNative; + } + function require_getValue() { + if (hasRequired_getValue) return _getValue; + hasRequired_getValue = 1; + function getValue4(object3, key) { + return object3 == null ? void 0 : object3[key]; + } + __name(getValue4, "getValue"); + _getValue = getValue4; + return _getValue; + } + function require_getNative() { + if (hasRequired_getNative) return _getNative; + hasRequired_getNative = 1; + var baseIsNative3 = require_baseIsNative(), getValue4 = require_getValue(); + function getNative3(object3, key) { + var value2 = getValue4(object3, key); + return baseIsNative3(value2) ? value2 : void 0; + } + __name(getNative3, "getNative"); + _getNative = getNative3; + return _getNative; + } + function require_nativeCreate() { + if (hasRequired_nativeCreate) return _nativeCreate; + hasRequired_nativeCreate = 1; + var getNative3 = require_getNative(); + var nativeCreate3 = getNative3(Object, "create"); + _nativeCreate = nativeCreate3; + return _nativeCreate; + } + function require_hashClear() { + if (hasRequired_hashClear) return _hashClear; + hasRequired_hashClear = 1; + var nativeCreate3 = require_nativeCreate(); + function hashClear3() { + this.__data__ = nativeCreate3 ? nativeCreate3(null) : {}; + this.size = 0; + } + __name(hashClear3, "hashClear"); + _hashClear = hashClear3; + return _hashClear; + } + function require_hashDelete() { + if (hasRequired_hashDelete) return _hashDelete; + hasRequired_hashDelete = 1; + function hashDelete3(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + __name(hashDelete3, "hashDelete"); + _hashDelete = hashDelete3; + return _hashDelete; + } + function require_hashGet() { + if (hasRequired_hashGet) return _hashGet; + hasRequired_hashGet = 1; + var nativeCreate3 = require_nativeCreate(); + var HASH_UNDEFINED7 = "__lodash_hash_undefined__"; + var objectProto34 = Object.prototype; + var hasOwnProperty28 = objectProto34.hasOwnProperty; + function hashGet3(key) { + var data5 = this.__data__; + if (nativeCreate3) { + var result = data5[key]; + return result === HASH_UNDEFINED7 ? void 0 : result; + } + return hasOwnProperty28.call(data5, key) ? data5[key] : void 0; + } + __name(hashGet3, "hashGet"); + _hashGet = hashGet3; + return _hashGet; + } + function require_hashHas() { + if (hasRequired_hashHas) return _hashHas; + hasRequired_hashHas = 1; + var nativeCreate3 = require_nativeCreate(); + var objectProto34 = Object.prototype; + var hasOwnProperty28 = objectProto34.hasOwnProperty; + function hashHas3(key) { + var data5 = this.__data__; + return nativeCreate3 ? data5[key] !== void 0 : hasOwnProperty28.call(data5, key); + } + __name(hashHas3, "hashHas"); + _hashHas = hashHas3; + return _hashHas; + } + function require_hashSet() { + if (hasRequired_hashSet) return _hashSet; + hasRequired_hashSet = 1; + var nativeCreate3 = require_nativeCreate(); + var HASH_UNDEFINED7 = "__lodash_hash_undefined__"; + function hashSet3(key, value2) { + var data5 = this.__data__; + this.size += this.has(key) ? 0 : 1; + data5[key] = nativeCreate3 && value2 === void 0 ? HASH_UNDEFINED7 : value2; + return this; + } + __name(hashSet3, "hashSet"); + _hashSet = hashSet3; + return _hashSet; + } + function require_Hash() { + if (hasRequired_Hash) return _Hash; + hasRequired_Hash = 1; + var hashClear3 = require_hashClear(), hashDelete3 = require_hashDelete(), hashGet3 = require_hashGet(), hashHas3 = require_hashHas(), hashSet3 = require_hashSet(); + function Hash3(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + __name(Hash3, "Hash"); + Hash3.prototype.clear = hashClear3; + Hash3.prototype["delete"] = hashDelete3; + Hash3.prototype.get = hashGet3; + Hash3.prototype.has = hashHas3; + Hash3.prototype.set = hashSet3; + _Hash = Hash3; + return _Hash; + } + function require_listCacheClear() { + if (hasRequired_listCacheClear) return _listCacheClear; + hasRequired_listCacheClear = 1; + function listCacheClear3() { + this.__data__ = []; + this.size = 0; + } + __name(listCacheClear3, "listCacheClear"); + _listCacheClear = listCacheClear3; + return _listCacheClear; + } + function requireEq() { + if (hasRequiredEq) return eq_1; + hasRequiredEq = 1; + function eq4(value2, other) { + return value2 === other || value2 !== value2 && other !== other; + } + __name(eq4, "eq"); + eq_1 = eq4; + return eq_1; + } + function require_assocIndexOf() { + if (hasRequired_assocIndexOf) return _assocIndexOf; + hasRequired_assocIndexOf = 1; + var eq4 = requireEq(); + function assocIndexOf3(array4, key) { + var length2 = array4.length; + while (length2--) { + if (eq4(array4[length2][0], key)) { + return length2; + } + } + return -1; + } + __name(assocIndexOf3, "assocIndexOf"); + _assocIndexOf = assocIndexOf3; + return _assocIndexOf; + } + function require_listCacheDelete() { + if (hasRequired_listCacheDelete) return _listCacheDelete; + hasRequired_listCacheDelete = 1; + var assocIndexOf3 = require_assocIndexOf(); + var arrayProto3 = Array.prototype; + var splice3 = arrayProto3.splice; + function listCacheDelete3(key) { + var data5 = this.__data__, index = assocIndexOf3(data5, key); + if (index < 0) { + return false; + } + var lastIndex = data5.length - 1; + if (index == lastIndex) { + data5.pop(); + } else { + splice3.call(data5, index, 1); + } + --this.size; + return true; + } + __name(listCacheDelete3, "listCacheDelete"); + _listCacheDelete = listCacheDelete3; + return _listCacheDelete; + } + function require_listCacheGet() { + if (hasRequired_listCacheGet) return _listCacheGet; + hasRequired_listCacheGet = 1; + var assocIndexOf3 = require_assocIndexOf(); + function listCacheGet3(key) { + var data5 = this.__data__, index = assocIndexOf3(data5, key); + return index < 0 ? void 0 : data5[index][1]; + } + __name(listCacheGet3, "listCacheGet"); + _listCacheGet = listCacheGet3; + return _listCacheGet; + } + function require_listCacheHas() { + if (hasRequired_listCacheHas) return _listCacheHas; + hasRequired_listCacheHas = 1; + var assocIndexOf3 = require_assocIndexOf(); + function listCacheHas3(key) { + return assocIndexOf3(this.__data__, key) > -1; + } + __name(listCacheHas3, "listCacheHas"); + _listCacheHas = listCacheHas3; + return _listCacheHas; + } + function require_listCacheSet() { + if (hasRequired_listCacheSet) return _listCacheSet; + hasRequired_listCacheSet = 1; + var assocIndexOf3 = require_assocIndexOf(); + function listCacheSet3(key, value2) { + var data5 = this.__data__, index = assocIndexOf3(data5, key); + if (index < 0) { + ++this.size; + data5.push([key, value2]); + } else { + data5[index][1] = value2; + } + return this; + } + __name(listCacheSet3, "listCacheSet"); + _listCacheSet = listCacheSet3; + return _listCacheSet; + } + function require_ListCache() { + if (hasRequired_ListCache) return _ListCache; + hasRequired_ListCache = 1; + var listCacheClear3 = require_listCacheClear(), listCacheDelete3 = require_listCacheDelete(), listCacheGet3 = require_listCacheGet(), listCacheHas3 = require_listCacheHas(), listCacheSet3 = require_listCacheSet(); + function ListCache3(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + __name(ListCache3, "ListCache"); + ListCache3.prototype.clear = listCacheClear3; + ListCache3.prototype["delete"] = listCacheDelete3; + ListCache3.prototype.get = listCacheGet3; + ListCache3.prototype.has = listCacheHas3; + ListCache3.prototype.set = listCacheSet3; + _ListCache = ListCache3; + return _ListCache; + } + function require_Map() { + if (hasRequired_Map) return _Map; + hasRequired_Map = 1; + var getNative3 = require_getNative(), root4 = require_root(); + var Map4 = getNative3(root4, "Map"); + _Map = Map4; + return _Map; + } + function require_mapCacheClear() { + if (hasRequired_mapCacheClear) return _mapCacheClear; + hasRequired_mapCacheClear = 1; + var Hash3 = require_Hash(), ListCache3 = require_ListCache(), Map4 = require_Map(); + function mapCacheClear3() { + this.size = 0; + this.__data__ = { + "hash": new Hash3(), + "map": new (Map4 || ListCache3)(), + "string": new Hash3() + }; + } + __name(mapCacheClear3, "mapCacheClear"); + _mapCacheClear = mapCacheClear3; + return _mapCacheClear; + } + function require_isKeyable() { + if (hasRequired_isKeyable) return _isKeyable; + hasRequired_isKeyable = 1; + function isKeyable3(value2) { + var type3 = typeof value2; + return type3 == "string" || type3 == "number" || type3 == "symbol" || type3 == "boolean" ? value2 !== "__proto__" : value2 === null; + } + __name(isKeyable3, "isKeyable"); + _isKeyable = isKeyable3; + return _isKeyable; + } + function require_getMapData() { + if (hasRequired_getMapData) return _getMapData; + hasRequired_getMapData = 1; + var isKeyable3 = require_isKeyable(); + function getMapData3(map6, key) { + var data5 = map6.__data__; + return isKeyable3(key) ? data5[typeof key == "string" ? "string" : "hash"] : data5.map; + } + __name(getMapData3, "getMapData"); + _getMapData = getMapData3; + return _getMapData; + } + function require_mapCacheDelete() { + if (hasRequired_mapCacheDelete) return _mapCacheDelete; + hasRequired_mapCacheDelete = 1; + var getMapData3 = require_getMapData(); + function mapCacheDelete3(key) { + var result = getMapData3(this, key)["delete"](key); + this.size -= result ? 1 : 0; + return result; + } + __name(mapCacheDelete3, "mapCacheDelete"); + _mapCacheDelete = mapCacheDelete3; + return _mapCacheDelete; + } + function require_mapCacheGet() { + if (hasRequired_mapCacheGet) return _mapCacheGet; + hasRequired_mapCacheGet = 1; + var getMapData3 = require_getMapData(); + function mapCacheGet3(key) { + return getMapData3(this, key).get(key); + } + __name(mapCacheGet3, "mapCacheGet"); + _mapCacheGet = mapCacheGet3; + return _mapCacheGet; + } + function require_mapCacheHas() { + if (hasRequired_mapCacheHas) return _mapCacheHas; + hasRequired_mapCacheHas = 1; + var getMapData3 = require_getMapData(); + function mapCacheHas3(key) { + return getMapData3(this, key).has(key); + } + __name(mapCacheHas3, "mapCacheHas"); + _mapCacheHas = mapCacheHas3; + return _mapCacheHas; + } + function require_mapCacheSet() { + if (hasRequired_mapCacheSet) return _mapCacheSet; + hasRequired_mapCacheSet = 1; + var getMapData3 = require_getMapData(); + function mapCacheSet3(key, value2) { + var data5 = getMapData3(this, key), size4 = data5.size; + data5.set(key, value2); + this.size += data5.size == size4 ? 0 : 1; + return this; + } + __name(mapCacheSet3, "mapCacheSet"); + _mapCacheSet = mapCacheSet3; + return _mapCacheSet; + } + function require_MapCache() { + if (hasRequired_MapCache) return _MapCache; + hasRequired_MapCache = 1; + var mapCacheClear3 = require_mapCacheClear(), mapCacheDelete3 = require_mapCacheDelete(), mapCacheGet3 = require_mapCacheGet(), mapCacheHas3 = require_mapCacheHas(), mapCacheSet3 = require_mapCacheSet(); + function MapCache3(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + __name(MapCache3, "MapCache"); + MapCache3.prototype.clear = mapCacheClear3; + MapCache3.prototype["delete"] = mapCacheDelete3; + MapCache3.prototype.get = mapCacheGet3; + MapCache3.prototype.has = mapCacheHas3; + MapCache3.prototype.set = mapCacheSet3; + _MapCache = MapCache3; + return _MapCache; + } + function requireMemoize() { + if (hasRequiredMemoize) return memoize_1; + hasRequiredMemoize = 1; + var MapCache3 = require_MapCache(); + var FUNC_ERROR_TEXT4 = "Expected a function"; + function memoize6(func, resolver3) { + if (typeof func != "function" || resolver3 != null && typeof resolver3 != "function") { + throw new TypeError(FUNC_ERROR_TEXT4); + } + var memoized = /* @__PURE__ */ __name(function() { + var args = arguments, key = resolver3 ? resolver3.apply(this, args) : args[0], cache3 = memoized.cache; + if (cache3.has(key)) { + return cache3.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache3.set(key, result) || cache3; + return result; + }, "memoized"); + memoized.cache = new (memoize6.Cache || MapCache3)(); + return memoized; + } + __name(memoize6, "memoize"); + memoize6.Cache = MapCache3; + memoize_1 = memoize6; + return memoize_1; + } + function require_memoizeCapped() { + if (hasRequired_memoizeCapped) return _memoizeCapped; + hasRequired_memoizeCapped = 1; + var memoize6 = requireMemoize(); + var MAX_MEMOIZE_SIZE3 = 500; + function memoizeCapped3(func) { + var result = memoize6(func, function(key) { + if (cache3.size === MAX_MEMOIZE_SIZE3) { + cache3.clear(); + } + return key; + }); + var cache3 = result.cache; + return result; + } + __name(memoizeCapped3, "memoizeCapped"); + _memoizeCapped = memoizeCapped3; + return _memoizeCapped; + } + function require_stringToPath() { + if (hasRequired_stringToPath) return _stringToPath; + hasRequired_stringToPath = 1; + var memoizeCapped3 = require_memoizeCapped(); + var rePropName3 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + var reEscapeChar3 = /\\(\\)?/g; + var stringToPath3 = memoizeCapped3(function(string3) { + var result = []; + if (string3.charCodeAt(0) === 46) { + result.push(""); + } + string3.replace(rePropName3, function(match3, number7, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar3, "$1") : number7 || match3); + }); + return result; + }); + _stringToPath = stringToPath3; + return _stringToPath; + } + function require_arrayMap() { + if (hasRequired_arrayMap) return _arrayMap; + hasRequired_arrayMap = 1; + function arrayMap3(array4, iteratee) { + var index = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2); + while (++index < length2) { + result[index] = iteratee(array4[index], index, array4); + } + return result; + } + __name(arrayMap3, "arrayMap"); + _arrayMap = arrayMap3; + return _arrayMap; + } + function require_baseToString() { + if (hasRequired_baseToString) return _baseToString; + hasRequired_baseToString = 1; + var Symbol4 = require_Symbol(), arrayMap3 = require_arrayMap(), isArray4 = requireIsArray(), isSymbol3 = requireIsSymbol(); + var symbolProto6 = Symbol4 ? Symbol4.prototype : void 0, symbolToString3 = symbolProto6 ? symbolProto6.toString : void 0; + function baseToString3(value2) { + if (typeof value2 == "string") { + return value2; + } + if (isArray4(value2)) { + return arrayMap3(value2, baseToString3) + ""; + } + if (isSymbol3(value2)) { + return symbolToString3 ? symbolToString3.call(value2) : ""; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -Infinity ? "-0" : result; + } + __name(baseToString3, "baseToString"); + _baseToString = baseToString3; + return _baseToString; + } + function requireToString() { + if (hasRequiredToString) return toString_1; + hasRequiredToString = 1; + var baseToString3 = require_baseToString(); + function toString6(value2) { + return value2 == null ? "" : baseToString3(value2); + } + __name(toString6, "toString"); + toString_1 = toString6; + return toString_1; + } + function require_castPath() { + if (hasRequired_castPath) return _castPath; + hasRequired_castPath = 1; + var isArray4 = requireIsArray(), isKey3 = require_isKey(), stringToPath3 = require_stringToPath(), toString6 = requireToString(); + function castPath3(value2, object3) { + if (isArray4(value2)) { + return value2; + } + return isKey3(value2, object3) ? [value2] : stringToPath3(toString6(value2)); + } + __name(castPath3, "castPath"); + _castPath = castPath3; + return _castPath; + } + function require_toKey() { + if (hasRequired_toKey) return _toKey; + hasRequired_toKey = 1; + var isSymbol3 = requireIsSymbol(); + function toKey3(value2) { + if (typeof value2 == "string" || isSymbol3(value2)) { + return value2; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -Infinity ? "-0" : result; + } + __name(toKey3, "toKey"); + _toKey = toKey3; + return _toKey; + } + function require_baseGet() { + if (hasRequired_baseGet) return _baseGet; + hasRequired_baseGet = 1; + var castPath3 = require_castPath(), toKey3 = require_toKey(); + function baseGet3(object3, path4) { + path4 = castPath3(path4, object3); + var index = 0, length2 = path4.length; + while (object3 != null && index < length2) { + object3 = object3[toKey3(path4[index++])]; + } + return index && index == length2 ? object3 : void 0; + } + __name(baseGet3, "baseGet"); + _baseGet = baseGet3; + return _baseGet; + } + function requireGet() { + if (hasRequiredGet) return get_1; + hasRequiredGet = 1; + var baseGet3 = require_baseGet(); + function get6(object3, path4, defaultValue) { + var result = object3 == null ? void 0 : baseGet3(object3, path4); + return result === void 0 ? defaultValue : result; + } + __name(get6, "get"); + get_1 = get6; + return get_1; + } + function require_defineProperty() { + if (hasRequired_defineProperty) return _defineProperty; + hasRequired_defineProperty = 1; + var getNative3 = require_getNative(); + var defineProperty3 = (function() { + try { + var func = getNative3(Object, "defineProperty"); + func({}, "", {}); + return func; + } catch (e3) { + } + })(); + _defineProperty = defineProperty3; + return _defineProperty; + } + function require_baseAssignValue() { + if (hasRequired_baseAssignValue) return _baseAssignValue; + hasRequired_baseAssignValue = 1; + var defineProperty3 = require_defineProperty(); + function baseAssignValue3(object3, key, value2) { + if (key == "__proto__" && defineProperty3) { + defineProperty3(object3, key, { + "configurable": true, + "enumerable": true, + "value": value2, + "writable": true + }); + } else { + object3[key] = value2; + } + } + __name(baseAssignValue3, "baseAssignValue"); + _baseAssignValue = baseAssignValue3; + return _baseAssignValue; + } + function require_assignValue() { + if (hasRequired_assignValue) return _assignValue; + hasRequired_assignValue = 1; + var baseAssignValue3 = require_baseAssignValue(), eq4 = requireEq(); + var objectProto34 = Object.prototype; + var hasOwnProperty28 = objectProto34.hasOwnProperty; + function assignValue3(object3, key, value2) { + var objValue = object3[key]; + if (!(hasOwnProperty28.call(object3, key) && eq4(objValue, value2)) || value2 === void 0 && !(key in object3)) { + baseAssignValue3(object3, key, value2); + } + } + __name(assignValue3, "assignValue"); + _assignValue = assignValue3; + return _assignValue; + } + function require_isIndex() { + if (hasRequired_isIndex) return _isIndex; + hasRequired_isIndex = 1; + var MAX_SAFE_INTEGER5 = 9007199254740991; + var reIsUint3 = /^(?:0|[1-9]\d*)$/; + function isIndex3(value2, length2) { + var type3 = typeof value2; + length2 = length2 == null ? MAX_SAFE_INTEGER5 : length2; + return !!length2 && (type3 == "number" || type3 != "symbol" && reIsUint3.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2); + } + __name(isIndex3, "isIndex"); + _isIndex = isIndex3; + return _isIndex; + } + function require_baseSet() { + if (hasRequired_baseSet) return _baseSet; + hasRequired_baseSet = 1; + var assignValue3 = require_assignValue(), castPath3 = require_castPath(), isIndex3 = require_isIndex(), isObject4 = requireIsObject(), toKey3 = require_toKey(); + function baseSet3(object3, path4, value2, customizer) { + if (!isObject4(object3)) { + return object3; + } + path4 = castPath3(path4, object3); + var index = -1, length2 = path4.length, lastIndex = length2 - 1, nested = object3; + while (nested != null && ++index < length2) { + var key = toKey3(path4[index]), newValue = value2; + if (key === "__proto__" || key === "constructor" || key === "prototype") { + return object3; + } + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : void 0; + if (newValue === void 0) { + newValue = isObject4(objValue) ? objValue : isIndex3(path4[index + 1]) ? [] : {}; + } + } + assignValue3(nested, key, newValue); + nested = nested[key]; + } + return object3; + } + __name(baseSet3, "baseSet"); + _baseSet = baseSet3; + return _baseSet; + } + function requireSet() { + if (hasRequiredSet) return set_1; + hasRequiredSet = 1; + var baseSet3 = require_baseSet(); + function set5(object3, path4, value2) { + return object3 == null ? object3 : baseSet3(object3, path4, value2); + } + __name(set5, "set"); + set_1 = set5; + return set_1; + } + function require_copyArray() { + if (hasRequired_copyArray) return _copyArray; + hasRequired_copyArray = 1; + function copyArray5(source, array4) { + var index = -1, length2 = source.length; + array4 || (array4 = Array(length2)); + while (++index < length2) { + array4[index] = source[index]; + } + return array4; + } + __name(copyArray5, "copyArray"); + _copyArray = copyArray5; + return _copyArray; + } + function requireToPath() { + if (hasRequiredToPath) return toPath_1; + hasRequiredToPath = 1; + var arrayMap3 = require_arrayMap(), copyArray5 = require_copyArray(), isArray4 = requireIsArray(), isSymbol3 = requireIsSymbol(), stringToPath3 = require_stringToPath(), toKey3 = require_toKey(), toString6 = requireToString(); + function toPath2(value2) { + if (isArray4(value2)) { + return arrayMap3(value2, toKey3); + } + return isSymbol3(value2) ? [value2] : copyArray5(stringToPath3(toString6(value2))); + } + __name(toPath2, "toPath"); + toPath_1 = toPath2; + return toPath_1; + } + function forEachCompound(eles, fn3, includeSelf, recursiveStep) { + var q3 = []; + var did = new Set$1(); + var cy = eles.cy(); + var hasCompounds = cy.hasCompoundNodes(); + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + if (includeSelf) { + q3.push(ele); + } else if (hasCompounds) { + recursiveStep(q3, did, ele); + } + } + while (q3.length > 0) { + var _ele = q3.shift(); + fn3(_ele); + did.add(_ele.id()); + if (hasCompounds) { + recursiveStep(q3, did, _ele); + } + } + return eles; + } + function addChildren(q3, did, ele) { + if (ele.isParent()) { + var children2 = ele._private.children; + for (var i2 = 0; i2 < children2.length; i2++) { + var child = children2[i2]; + if (!did.has(child.id())) { + q3.push(child); + } + } + } + } + function addParent(q3, did, ele) { + if (ele.isChild()) { + var parent4 = ele._private.parent; + if (!did.has(parent4.id())) { + q3.push(parent4); + } + } + } + function addParentAndChildren(q3, did, ele) { + addParent(q3, did, ele); + addChildren(q3, did, ele); + } + function defineDegreeFunction(callback) { + return function(includeLoops) { + var self2 = this; + if (includeLoops === void 0) { + includeLoops = true; + } + if (self2.length === 0) { + return; + } + if (self2.isNode() && !self2.removed()) { + var degree = 0; + var node2 = self2[0]; + var connectedEdges = node2._private.edges; + for (var i2 = 0; i2 < connectedEdges.length; i2++) { + var edge = connectedEdges[i2]; + if (!includeLoops && edge.isLoop()) { + continue; + } + degree += callback(node2, edge); + } + return degree; + } else { + return; + } + }; + } + function defineDegreeBoundsFunction(degreeFn, callback) { + return function(includeLoops) { + var ret; + var nodes5 = this.nodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + var ele = nodes5[i2]; + var degree = ele[degreeFn](includeLoops); + if (degree !== void 0 && (ret === void 0 || callback(degree, ret))) { + ret = degree; + } + } + return ret; + }; + } + function returnFalse() { + return false; + } + function returnTrue() { + return true; + } + function Emitter() { + var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : emptyOpts; + var context = arguments.length > 1 ? arguments[1] : void 0; + for (var i2 = 0; i2 < defaultsKeys.length; i2++) { + var key = defaultsKeys[i2]; + this[key] = opts[key] || defaults$8[key]; + } + this.context = context || this.context; + this.listeners = []; + this.emitting = 0; + } + function styleCache(key, fn3, ele) { + var _p = ele._private; + var cache3 = _p.styleCache = _p.styleCache || []; + var val; + if ((val = cache3[key]) != null) { + return val; + } else { + val = cache3[key] = fn3(ele); + return val; + } + } + function cacheStyleFunction(key, fn3) { + key = hashString(key); + return /* @__PURE__ */ __name(function cachedStyleFunction(ele) { + return styleCache(key, fn3, ele); + }, "cachedStyleFunction"); + } + function cachePrototypeStyleFunction(key, fn3) { + key = hashString(key); + var selfFn = /* @__PURE__ */ __name(function selfFn2(ele) { + return fn3.call(ele); + }, "selfFn"); + return /* @__PURE__ */ __name(function cachedPrototypeStyleFunction() { + var ele = this[0]; + if (ele) { + return styleCache(key, selfFn, ele); + } + }, "cachedPrototypeStyleFunction"); + } + function checkCompound(ele, parentOk) { + var _p = ele._private; + var parents3 = _p.data.parent ? ele.parents() : null; + if (parents3) { + for (var i2 = 0; i2 < parents3.length; i2++) { + var parent4 = parents3[i2]; + if (!parentOk(parent4)) { + return false; + } + } + } + return true; + } + function defineDerivedStateFunction(specs) { + var ok = specs.ok; + var edgeOkViaNode = specs.edgeOkViaNode || specs.ok; + var parentOk = specs.parentOk || specs.ok; + return function() { + var cy = this.cy(); + if (!cy.styleEnabled()) { + return true; + } + var ele = this[0]; + var hasCompoundNodes2 = cy.hasCompoundNodes(); + if (ele) { + var _p = ele._private; + if (!ok(ele)) { + return false; + } + if (ele.isNode()) { + return !hasCompoundNodes2 || checkCompound(ele, parentOk); + } else { + var src = _p.source; + var tgt = _p.target; + return edgeOkViaNode(src) && (!hasCompoundNodes2 || checkCompound(src, edgeOkViaNode)) && (src === tgt || edgeOkViaNode(tgt) && (!hasCompoundNodes2 || checkCompound(tgt, edgeOkViaNode))); + } + } + }; + } + function defineSwitchFunction(params) { + return function() { + var args = arguments; + var changedEles = []; + if (args.length === 2) { + var data5 = args[0]; + var handler = args[1]; + this.on(params.event, data5, handler); + } else if (args.length === 1 && fn$6(args[0])) { + var _handler = args[0]; + this.on(params.event, _handler); + } else if (args.length === 0 || args.length === 1 && array2(args[0])) { + var addlEvents = args.length === 1 ? args[0] : null; + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var able = !params.ableField || ele._private[params.ableField]; + var changed = ele._private[params.field] != params.value; + if (params.overrideAble) { + var overrideAble2 = params.overrideAble(ele); + if (overrideAble2 !== void 0) { + able = overrideAble2; + if (!overrideAble2) { + return this; + } + } + } + if (able) { + ele._private[params.field] = params.value; + if (changed) { + changedEles.push(ele); + } + } + } + var changedColl = this.spawn(changedEles); + changedColl.updateStyle(); + changedColl.emit(params.event); + if (addlEvents) { + changedColl.emit(addlEvents); + } + } + return this; + }; + } + function defineSwitchSet(params) { + elesfn$3[params.field] = function() { + var ele = this[0]; + if (ele) { + if (params.overrideField) { + var val = params.overrideField(ele); + if (val !== void 0) { + return val; + } + } + return ele._private[params.field]; + } + }; + elesfn$3[params.on] = defineSwitchFunction({ + event: params.on, + field: params.field, + ableField: params.ableField, + overrideAble: params.overrideAble, + value: true + }); + elesfn$3[params.off] = defineSwitchFunction({ + event: params.off, + field: params.field, + ableField: params.ableField, + overrideAble: params.overrideAble, + value: false + }); + } + function defineSourceFunction(params) { + return /* @__PURE__ */ __name(function sourceImpl2(selector) { + var sources = []; + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var src = ele._private[params.attr]; + if (src) { + sources.push(src); + } + } + return this.spawn(sources, true).filter(selector); + }, "sourceImpl"); + } + function defineEdgesWithFunction(params) { + return /* @__PURE__ */ __name(function edgesWithImpl(otherNodes) { + var elements2 = []; + var cy = this._private.cy; + var p3 = params || {}; + if (string(otherNodes)) { + otherNodes = cy.$(otherNodes); + } + for (var h3 = 0; h3 < otherNodes.length; h3++) { + var edges3 = otherNodes[h3]._private.edges; + for (var i2 = 0; i2 < edges3.length; i2++) { + var edge = edges3[i2]; + var edgeData2 = edge._private.data; + var thisToOther = this.hasElementWithId(edgeData2.source) && otherNodes.hasElementWithId(edgeData2.target); + var otherToThis = otherNodes.hasElementWithId(edgeData2.source) && this.hasElementWithId(edgeData2.target); + var edgeConnectsThisAndOther = thisToOther || otherToThis; + if (!edgeConnectsThisAndOther) { + continue; + } + if (p3.thisIsSrc || p3.thisIsTgt) { + if (p3.thisIsSrc && !thisToOther) { + continue; + } + if (p3.thisIsTgt && !otherToThis) { + continue; + } + } + elements2.push(edge); + } + } + return this.spawn(elements2, true); + }, "edgesWithImpl"); + } + function defineParallelEdgesFunction(params) { + var defaults5 = { + codirected: false + }; + params = extend4({}, defaults5, params); + return /* @__PURE__ */ __name(function parallelEdgesImpl(selector) { + var elements2 = []; + var edges3 = this.edges(); + var p3 = params; + for (var i2 = 0; i2 < edges3.length; i2++) { + var edge1 = edges3[i2]; + var edge1_p = edge1._private; + var src1 = edge1_p.source; + var srcid1 = src1._private.data.id; + var tgtid1 = edge1_p.data.target; + var srcEdges1 = src1._private.edges; + for (var j3 = 0; j3 < srcEdges1.length; j3++) { + var edge2 = srcEdges1[j3]; + var edge2data = edge2._private.data; + var tgtid2 = edge2data.target; + var srcid2 = edge2data.source; + var codirected = tgtid2 === tgtid1 && srcid2 === srcid1; + var oppdirected = srcid1 === tgtid2 && tgtid1 === srcid2; + if (p3.codirected && codirected || !p3.codirected && (codirected || oppdirected)) { + elements2.push(edge2); + } + } + } + return this.spawn(elements2, true).filter(selector); + }, "parallelEdgesImpl"); + } + function generateCubicBezier(mX1, mY1, mX2, mY2) { + var NEWTON_ITERATIONS = 4, NEWTON_MIN_SLOPE = 1e-3, SUBDIVISION_PRECISION = 1e-7, SUBDIVISION_MAX_ITERATIONS = 10, kSplineTableSize = 11, kSampleStepSize = 1 / (kSplineTableSize - 1), float32ArraySupported = typeof Float32Array !== "undefined"; + if (arguments.length !== 4) { + return false; + } + for (var i2 = 0; i2 < 4; ++i2) { + if (typeof arguments[i2] !== "number" || isNaN(arguments[i2]) || !isFinite(arguments[i2])) { + return false; + } + } + mX1 = Math.min(mX1, 1); + mX2 = Math.min(mX2, 1); + mX1 = Math.max(mX1, 0); + mX2 = Math.max(mX2, 0); + var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); + function A2(aA1, aA2) { + return 1 - 3 * aA2 + 3 * aA1; + } + __name(A2, "A"); + function B3(aA1, aA2) { + return 3 * aA2 - 6 * aA1; + } + __name(B3, "B"); + function C3(aA1) { + return 3 * aA1; + } + __name(C3, "C"); + function calcBezier(aT, aA1, aA2) { + return ((A2(aA1, aA2) * aT + B3(aA1, aA2)) * aT + C3(aA1)) * aT; + } + __name(calcBezier, "calcBezier"); + function getSlope(aT, aA1, aA2) { + return 3 * A2(aA1, aA2) * aT * aT + 2 * B3(aA1, aA2) * aT + C3(aA1); + } + __name(getSlope, "getSlope"); + function newtonRaphsonIterate(aX, aGuessT) { + for (var _i = 0; _i < NEWTON_ITERATIONS; ++_i) { + var currentSlope = getSlope(aGuessT, mX1, mX2); + if (currentSlope === 0) { + return aGuessT; + } + var currentX = calcBezier(aGuessT, mX1, mX2) - aX; + aGuessT -= currentX / currentSlope; + } + return aGuessT; + } + __name(newtonRaphsonIterate, "newtonRaphsonIterate"); + function calcSampleValues() { + for (var _i2 = 0; _i2 < kSplineTableSize; ++_i2) { + mSampleValues[_i2] = calcBezier(_i2 * kSampleStepSize, mX1, mX2); + } + } + __name(calcSampleValues, "calcSampleValues"); + function binarySubdivide(aX, aA, aB) { + var currentX, currentT, i3 = 0; + do { + currentT = aA + (aB - aA) / 2; + currentX = calcBezier(currentT, mX1, mX2) - aX; + if (currentX > 0) { + aB = currentT; + } else { + aA = currentT; + } + } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i3 < SUBDIVISION_MAX_ITERATIONS); + return currentT; + } + __name(binarySubdivide, "binarySubdivide"); + function getTForX(aX) { + var intervalStart = 0, currentSample = 1, lastSample = kSplineTableSize - 1; + for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { + intervalStart += kSampleStepSize; + } + --currentSample; + var dist3 = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]), guessForT = intervalStart + dist3 * kSampleStepSize, initialSlope = getSlope(guessForT, mX1, mX2); + if (initialSlope >= NEWTON_MIN_SLOPE) { + return newtonRaphsonIterate(aX, guessForT); + } else if (initialSlope === 0) { + return guessForT; + } else { + return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); + } + } + __name(getTForX, "getTForX"); + var _precomputed = false; + function precompute() { + _precomputed = true; + if (mX1 !== mY1 || mX2 !== mY2) { + calcSampleValues(); + } + } + __name(precompute, "precompute"); + var f2 = /* @__PURE__ */ __name(function f3(aX) { + if (!_precomputed) { + precompute(); + } + if (mX1 === mY1 && mX2 === mY2) { + return aX; + } + if (aX === 0) { + return 0; + } + if (aX === 1) { + return 1; + } + return calcBezier(getTForX(aX), mY1, mY2); + }, "f"); + f2.getControlPoints = function() { + return [{ + x: mX1, + y: mY1 + }, { + x: mX2, + y: mY2 + }]; + }; + var str2 = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; + f2.toString = function() { + return str2; + }; + return f2; + } + function getEasedValue(type3, start3, end2, percent, easingFn) { + if (percent === 1) { + return end2; + } + if (start3 === end2) { + return end2; + } + var val = easingFn(start3, end2, percent); + if (type3 == null) { + return val; + } + if (type3.roundValue || type3.color) { + val = Math.round(val); + } + if (type3.min !== void 0) { + val = Math.max(val, type3.min); + } + if (type3.max !== void 0) { + val = Math.min(val, type3.max); + } + return val; + } + function getValue2(prop, spec) { + if (prop.pfValue != null || prop.value != null) { + if (prop.pfValue != null && (spec == null || spec.type.units !== "%")) { + return prop.pfValue; + } else { + return prop.value; + } + } else { + return prop; + } + } + function ease(startProp, endProp, percent, easingFn, propSpec) { + var type3 = propSpec != null ? propSpec.type : null; + if (percent < 0) { + percent = 0; + } else if (percent > 1) { + percent = 1; + } + var start3 = getValue2(startProp, propSpec); + var end2 = getValue2(endProp, propSpec); + if (number$1(start3) && number$1(end2)) { + return getEasedValue(type3, start3, end2, percent, easingFn); + } else if (array2(start3) && array2(end2)) { + var easedArr = []; + for (var i2 = 0; i2 < end2.length; i2++) { + var si = start3[i2]; + var ei = end2[i2]; + if (si != null && ei != null) { + var val = getEasedValue(type3, si, ei, percent, easingFn); + easedArr.push(val); + } else { + easedArr.push(ei); + } + } + return easedArr; + } + return void 0; + } + function step$1(self2, ani, now3, isCore) { + var isEles = !isCore; + var _p = self2._private; + var ani_p = ani._private; + var pEasing = ani_p.easing; + var startTime = ani_p.startTime; + var cy = isCore ? self2 : self2.cy(); + var style3 = cy.style(); + if (!ani_p.easingImpl) { + if (pEasing == null) { + ani_p.easingImpl = easings["linear"]; + } else { + var easingVals; + if (string(pEasing)) { + var easingProp = style3.parse("transition-timing-function", pEasing); + easingVals = easingProp.value; + } else { + easingVals = pEasing; + } + var name, args; + if (string(easingVals)) { + name = easingVals; + args = []; + } else { + name = easingVals[1]; + args = easingVals.slice(2).map(function(n2) { + return +n2; + }); + } + if (args.length > 0) { + if (name === "spring") { + args.push(ani_p.duration); + } + ani_p.easingImpl = easings[name].apply(null, args); + } else { + ani_p.easingImpl = easings[name]; + } + } + } + var easing = ani_p.easingImpl; + var percent; + if (ani_p.duration === 0) { + percent = 1; + } else { + percent = (now3 - startTime) / ani_p.duration; + } + if (ani_p.applying) { + percent = ani_p.progress; + } + if (percent < 0) { + percent = 0; + } else if (percent > 1) { + percent = 1; + } + if (ani_p.delay == null) { + var startPos = ani_p.startPosition; + var endPos = ani_p.position; + if (endPos && isEles && !self2.locked()) { + var newPos = {}; + if (valid(startPos.x, endPos.x)) { + newPos.x = ease(startPos.x, endPos.x, percent, easing); + } + if (valid(startPos.y, endPos.y)) { + newPos.y = ease(startPos.y, endPos.y, percent, easing); + } + self2.position(newPos); + } + var startPan = ani_p.startPan; + var endPan = ani_p.pan; + var pan2 = _p.pan; + var animatingPan = endPan != null && isCore; + if (animatingPan) { + if (valid(startPan.x, endPan.x)) { + pan2.x = ease(startPan.x, endPan.x, percent, easing); + } + if (valid(startPan.y, endPan.y)) { + pan2.y = ease(startPan.y, endPan.y, percent, easing); + } + self2.emit("pan"); + } + var startZoom = ani_p.startZoom; + var endZoom = ani_p.zoom; + var animatingZoom = endZoom != null && isCore; + if (animatingZoom) { + if (valid(startZoom, endZoom)) { + _p.zoom = bound(_p.minZoom, ease(startZoom, endZoom, percent, easing), _p.maxZoom); + } + self2.emit("zoom"); + } + if (animatingPan || animatingZoom) { + self2.emit("viewport"); + } + var props = ani_p.style; + if (props && props.length > 0 && isEles) { + for (var i2 = 0; i2 < props.length; i2++) { + var prop = props[i2]; + var _name = prop.name; + var end2 = prop; + var start3 = ani_p.startStyle[_name]; + var propSpec = style3.properties[start3.name]; + var easedVal = ease(start3, end2, percent, easing, propSpec); + style3.overrideBypass(self2, _name, easedVal); + } + self2.emit("style"); + } + } + ani_p.progress = percent; + return percent; + } + function valid(start3, end2) { + if (start3 == null || end2 == null) { + return false; + } + if (number$1(start3) && number$1(end2)) { + return true; + } else if (start3 && end2) { + return true; + } + return false; + } + function startAnimation(self2, ani, now3, isCore) { + var ani_p = ani._private; + ani_p.started = true; + ani_p.startTime = now3 - ani_p.progress * ani_p.duration; + } + function stepAll(now3, cy) { + var eles = cy._private.aniEles; + var doneEles = []; + function stepOne(ele2, isCore) { + var _p = ele2._private; + var current = _p.animation.current; + var queue = _p.animation.queue; + var ranAnis = false; + if (current.length === 0) { + var next3 = queue.shift(); + if (next3) { + current.push(next3); + } + } + var callbacks = /* @__PURE__ */ __name(function callbacks2(_callbacks) { + for (var j3 = _callbacks.length - 1; j3 >= 0; j3--) { + var cb = _callbacks[j3]; + cb(); + } + _callbacks.splice(0, _callbacks.length); + }, "callbacks"); + for (var i2 = current.length - 1; i2 >= 0; i2--) { + var ani = current[i2]; + var ani_p = ani._private; + if (ani_p.stopped) { + current.splice(i2, 1); + ani_p.hooked = false; + ani_p.playing = false; + ani_p.started = false; + callbacks(ani_p.frames); + continue; + } + if (!ani_p.playing && !ani_p.applying) { + continue; + } + if (ani_p.playing && ani_p.applying) { + ani_p.applying = false; + } + if (!ani_p.started) { + startAnimation(ele2, ani, now3); + } + step$1(ele2, ani, now3, isCore); + if (ani_p.applying) { + ani_p.applying = false; + } + callbacks(ani_p.frames); + if (ani_p.step != null) { + ani_p.step(now3); + } + if (ani.completed()) { + current.splice(i2, 1); + ani_p.hooked = false; + ani_p.playing = false; + ani_p.started = false; + callbacks(ani_p.completes); + } + ranAnis = true; + } + if (!isCore && current.length === 0 && queue.length === 0) { + doneEles.push(ele2); + } + return ranAnis; + } + __name(stepOne, "stepOne"); + var ranEleAni = false; + for (var e3 = 0; e3 < eles.length; e3++) { + var ele = eles[e3]; + var handledThisEle = stepOne(ele); + ranEleAni = ranEleAni || handledThisEle; + } + var ranCoreAni = stepOne(cy, true); + if (ranEleAni || ranCoreAni) { + if (eles.length > 0) { + cy.notify("draw", eles); + } else { + cy.notify("draw"); + } + } + eles.unmerge(doneEles); + cy.emit("step"); + } + function BreadthFirstLayout(options2) { + this.options = extend4({}, defaults$7, deprecatedOptionDefaults, options2); + } + function CircleLayout(options2) { + this.options = extend4({}, defaults$6, options2); + } + function ConcentricLayout(options2) { + this.options = extend4({}, defaults$5, options2); + } + function CoseLayout(options2) { + this.options = extend4({}, defaults$4, options2); + this.options.layout = this; + var nodes5 = this.options.eles.nodes(); + var edges3 = this.options.eles.edges(); + var notEdges = edges3.filter(function(e3) { + var sourceId = e3.source().data("id"); + var targetId = e3.target().data("id"); + var hasSource = nodes5.some(function(n2) { + return n2.data("id") === sourceId; + }); + var hasTarget = nodes5.some(function(n2) { + return n2.data("id") === targetId; + }); + return !hasSource || !hasTarget; + }); + this.options.eles = this.options.eles.not(notEdges); + } + function GridLayout(options2) { + this.options = extend4({}, defaults$3, options2); + } + function NullLayout(options2) { + this.options = extend4({}, defaults$2, options2); + } + function PresetLayout(options2) { + this.options = extend4({}, defaults$1, options2); + } + function RandomLayout(options2) { + this.options = extend4({}, defaults3, options2); + } + function NullRenderer(options2) { + this.options = options2; + this.notifications = 0; + } + function drawPreparedRoundCorner(ctx, roundCorner) { + if (roundCorner.radius === 0) ctx.lineTo(roundCorner.cx, roundCorner.cy); + else ctx.arc(roundCorner.cx, roundCorner.cy, roundCorner.radius, roundCorner.startAngle, roundCorner.endAngle, roundCorner.counterClockwise); + } + function getRoundCorner(previousPoint, currentPoint, nextPoint, radiusMax) { + var isArcRadius = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true; + if (radiusMax === 0 || currentPoint.radius === 0) return { + cx: currentPoint.x, + cy: currentPoint.y, + radius: 0, + startX: currentPoint.x, + startY: currentPoint.y, + stopX: currentPoint.x, + stopY: currentPoint.y, + startAngle: void 0, + endAngle: void 0, + counterClockwise: void 0 + }; + calcCornerArc(previousPoint, currentPoint, nextPoint, radiusMax, isArcRadius); + return { + cx: x3, + cy: y4, + radius: cRadius, + startX, + startY, + stopX, + stopY, + startAngle: v1.ang + Math.PI / 2 * radDirection, + endAngle: v22.ang - Math.PI / 2 * radDirection, + counterClockwise: drawDirection + }; + } + function getPts(pts2) { + var retPts = []; + if (pts2 == null) { + return; + } + for (var i2 = 0; i2 < pts2.length; i2 += 2) { + var x5 = pts2[i2]; + var y6 = pts2[i2 + 1]; + retPts.push({ + x: x5, + y: y6 + }); + } + return retPts; + } + function pushBezierPts(r2, edge, pts2) { + var qbezierAt$1 = /* @__PURE__ */ __name(function qbezierAt$12(p1, p22, p32, t4) { + return qbezierAt(p1, p22, p32, t4); + }, "qbezierAt$1"); + var _p = edge._private; + var bpts = _p.rstyle.bezierPts; + for (var i2 = 0; i2 < r2.bezierProjPcts.length; i2++) { + var p3 = r2.bezierProjPcts[i2]; + bpts.push({ + x: qbezierAt$1(pts2[0], pts2[2], pts2[4], p3), + y: qbezierAt$1(pts2[1], pts2[3], pts2[5], p3) + }); + } + } + function polygon(context, points) { + for (var i2 = 0; i2 < points.length; i2++) { + var pt = points[i2]; + context.lineTo(pt.x, pt.y); + } + } + function triangleBackcurve(context, points, controlPoint) { + var firstPt; + for (var i2 = 0; i2 < points.length; i2++) { + var pt = points[i2]; + if (i2 === 0) { + firstPt = pt; + } + context.lineTo(pt.x, pt.y); + } + context.quadraticCurveTo(controlPoint.x, controlPoint.y, firstPt.x, firstPt.y); + } + function triangleTee(context, trianglePoints, teePoints) { + if (context.beginPath) { + context.beginPath(); + } + var triPts = trianglePoints; + for (var i2 = 0; i2 < triPts.length; i2++) { + var pt = triPts[i2]; + context.lineTo(pt.x, pt.y); + } + var teePts = teePoints; + var firstTeePt = teePoints[0]; + context.moveTo(firstTeePt.x, firstTeePt.y); + for (var i2 = 1; i2 < teePts.length; i2++) { + var pt = teePts[i2]; + context.lineTo(pt.x, pt.y); + } + if (context.closePath) { + context.closePath(); + } + } + function circleTriangle(context, trianglePoints, rx, ry, r2) { + if (context.beginPath) { + context.beginPath(); + } + context.arc(rx, ry, r2, 0, Math.PI * 2, false); + var triPts = trianglePoints; + var firstTrPt = triPts[0]; + context.moveTo(firstTrPt.x, firstTrPt.y); + for (var i2 = 0; i2 < triPts.length; i2++) { + var pt = triPts[i2]; + context.lineTo(pt.x, pt.y); + } + if (context.closePath) { + context.closePath(); + } + } + function circle$1(context, rx, ry, r2) { + context.arc(rx, ry, r2, 0, Math.PI * 2, false); + } + function circle3(ctx, x5, y6, width3, height2) { + var diameter = Math.min(width3, height2); + var radius2 = diameter / 2; + var centerX = x5 + width3 / 2; + var centerY = y6 + height2 / 2; + ctx.beginPath(); + ctx.arc(centerX, centerY, radius2, 0, Math.PI * 2); + ctx.closePath(); + } + function roundRect(ctx, x5, y6, width3, height2) { + var radius2 = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 5; + var r2 = Math.min(radius2, width3 / 2, height2 / 2); + ctx.beginPath(); + ctx.moveTo(x5 + r2, y6); + ctx.lineTo(x5 + width3 - r2, y6); + ctx.quadraticCurveTo(x5 + width3, y6, x5 + width3, y6 + r2); + ctx.lineTo(x5 + width3, y6 + height2 - r2); + ctx.quadraticCurveTo(x5 + width3, y6 + height2, x5 + width3 - r2, y6 + height2); + ctx.lineTo(x5 + r2, y6 + height2); + ctx.quadraticCurveTo(x5, y6 + height2, x5, y6 + height2 - r2); + ctx.lineTo(x5, y6 + r2); + ctx.quadraticCurveTo(x5, y6, x5 + r2, y6); + ctx.closePath(); + } + function compileShader(gl, type3, source) { + var shader = gl.createShader(type3); + gl.shaderSource(shader, source); + gl.compileShader(shader); + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { + throw new Error(gl.getShaderInfoLog(shader)); + } + return shader; + } + function createProgram(gl, vertexSource, fragementSource) { + var vertexShader = compileShader(gl, gl.VERTEX_SHADER, vertexSource); + var fragmentShader = compileShader(gl, gl.FRAGMENT_SHADER, fragementSource); + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + gl.linkProgram(program); + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + throw new Error("Could not initialize shaders"); + } + return program; + } + function createTextureCanvas(r2, width3, height2) { + if (height2 === void 0) { + height2 = width3; + } + var canvas = r2.makeOffscreenCanvas(width3, height2); + var ctx = canvas.context = canvas.getContext("2d"); + canvas.clear = function() { + return ctx.clearRect(0, 0, canvas.width, canvas.height); + }; + canvas.clear(); + return canvas; + } + function getEffectivePanZoom(r2) { + var pixelRatio = r2.pixelRatio; + var zoom2 = r2.cy.zoom(); + var pan2 = r2.cy.pan(); + return { + zoom: zoom2 * pixelRatio, + pan: { + x: pan2.x * pixelRatio, + y: pan2.y * pixelRatio + } + }; + } + function getEffectiveZoom(r2) { + var pixelRatio = r2.pixelRatio; + var zoom2 = r2.cy.zoom(); + return zoom2 * pixelRatio; + } + function modelToRenderedPosition2(r2, pan2, zoom2, x5, y6) { + var rx = x5 * zoom2 + pan2.x; + var ry = y6 * zoom2 + pan2.y; + ry = Math.round(r2.canvasHeight - ry); + return [rx, ry]; + } + function isSimpleShape(node2) { + if (node2.pstyle("background-fill").value !== "solid") return false; + if (node2.pstyle("background-image").strValue !== "none") return false; + if (node2.pstyle("border-width").value === 0) return true; + if (node2.pstyle("border-opacity").value === 0) return true; + if (node2.pstyle("border-style").value !== "solid") return false; + return true; + } + function arrayEqual(a1, a2) { + if (a1.length !== a2.length) { + return false; + } + for (var i2 = 0; i2 < a1.length; i2++) { + if (a1[i2] !== a2[i2]) { + return false; + } + } + return true; + } + function toWebGLColor(color2, opacity, outArray) { + var r2 = color2[0] / 255; + var g2 = color2[1] / 255; + var b3 = color2[2] / 255; + var a2 = opacity; + var arr = outArray || new Array(4); + arr[0] = r2 * a2; + arr[1] = g2 * a2; + arr[2] = b3 * a2; + arr[3] = a2; + return arr; + } + function indexToVec4(index, outArray) { + var arr = outArray || new Array(4); + arr[0] = (index >> 0 & 255) / 255; + arr[1] = (index >> 8 & 255) / 255; + arr[2] = (index >> 16 & 255) / 255; + arr[3] = (index >> 24 & 255) / 255; + return arr; + } + function vec4ToIndex(vec4) { + return vec4[0] + (vec4[1] << 8) + (vec4[2] << 16) + (vec4[3] << 24); + } + function createTexture(gl, debugID) { + var texture = gl.createTexture(); + texture.buffer = function(offscreenCanvas) { + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, offscreenCanvas); + gl.generateMipmap(gl.TEXTURE_2D); + gl.bindTexture(gl.TEXTURE_2D, null); + }; + texture.deleteTexture = function() { + gl.deleteTexture(texture); + }; + return texture; + } + function getTypeInfo(gl, glslType) { + switch (glslType) { + case "float": + return [1, gl.FLOAT, 4]; + case "vec2": + return [2, gl.FLOAT, 4]; + case "vec3": + return [3, gl.FLOAT, 4]; + case "vec4": + return [4, gl.FLOAT, 4]; + case "int": + return [1, gl.INT, 4]; + case "ivec2": + return [2, gl.INT, 4]; + } + } + function createTypedArray(gl, glType, dataOrSize) { + switch (glType) { + case gl.FLOAT: + return new Float32Array(dataOrSize); + case gl.INT: + return new Int32Array(dataOrSize); + } + } + function createTypedArrayView(gl, glType, array4, stride, size4, i2) { + switch (glType) { + case gl.FLOAT: + return new Float32Array(array4.buffer, i2 * stride, size4); + case gl.INT: + return new Int32Array(array4.buffer, i2 * stride, size4); + } + } + function createBufferStaticDraw(gl, type3, attributeLoc, dataArray) { + var _getTypeInfo = getTypeInfo(gl, type3), _getTypeInfo2 = _slicedToArray(_getTypeInfo, 2), size4 = _getTypeInfo2[0], glType = _getTypeInfo2[1]; + var data5 = createTypedArray(gl, glType, dataArray); + var buffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + gl.bufferData(gl.ARRAY_BUFFER, data5, gl.STATIC_DRAW); + if (glType === gl.FLOAT) { + gl.vertexAttribPointer(attributeLoc, size4, glType, false, 0, 0); + } else if (glType === gl.INT) { + gl.vertexAttribIPointer(attributeLoc, size4, glType, 0, 0); + } + gl.enableVertexAttribArray(attributeLoc); + gl.bindBuffer(gl.ARRAY_BUFFER, null); + return buffer; + } + function createBufferDynamicDraw(gl, instances, type3, attributeLoc) { + var _getTypeInfo3 = getTypeInfo(gl, type3), _getTypeInfo4 = _slicedToArray(_getTypeInfo3, 3), size4 = _getTypeInfo4[0], glType = _getTypeInfo4[1], bytes = _getTypeInfo4[2]; + var dataArray = createTypedArray(gl, glType, instances * size4); + var stride = size4 * bytes; + var buffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + gl.bufferData(gl.ARRAY_BUFFER, instances * stride, gl.DYNAMIC_DRAW); + gl.enableVertexAttribArray(attributeLoc); + if (glType === gl.FLOAT) { + gl.vertexAttribPointer(attributeLoc, size4, glType, false, stride, 0); + } else if (glType === gl.INT) { + gl.vertexAttribIPointer(attributeLoc, size4, glType, stride, 0); + } + gl.vertexAttribDivisor(attributeLoc, 1); + gl.bindBuffer(gl.ARRAY_BUFFER, null); + var views = new Array(instances); + for (var i2 = 0; i2 < instances; i2++) { + views[i2] = createTypedArrayView(gl, glType, dataArray, stride, size4, i2); + } + buffer.dataArray = dataArray; + buffer.stride = stride; + buffer.size = size4; + buffer.getView = function(i3) { + return views[i3]; + }; + buffer.setPoint = function(i3, x5, y6) { + var view = views[i3]; + view[0] = x5; + view[1] = y6; + }; + buffer.bufferSubData = function(count2) { + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + if (count2) { + gl.bufferSubData(gl.ARRAY_BUFFER, 0, dataArray, 0, count2 * size4); + } else { + gl.bufferSubData(gl.ARRAY_BUFFER, 0, dataArray); + } + }; + return buffer; + } + function create3x3MatrixBufferDynamicDraw(gl, instances, attributeLoc) { + var matrixSize = 9; + var matrixData = new Float32Array(instances * matrixSize); + var matrixViews = new Array(instances); + for (var i2 = 0; i2 < instances; i2++) { + var byteOffset = i2 * matrixSize * 4; + matrixViews[i2] = new Float32Array(matrixData.buffer, byteOffset, matrixSize); + } + var buffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + gl.bufferData(gl.ARRAY_BUFFER, matrixData.byteLength, gl.DYNAMIC_DRAW); + for (var _i = 0; _i < 3; _i++) { + var loc = attributeLoc + _i; + gl.enableVertexAttribArray(loc); + gl.vertexAttribPointer(loc, 3, gl.FLOAT, false, 3 * 12, _i * 12); + gl.vertexAttribDivisor(loc, 1); + } + gl.bindBuffer(gl.ARRAY_BUFFER, null); + buffer.getMatrixView = function(i3) { + return matrixViews[i3]; + }; + buffer.setData = function(matrix, i3) { + matrixViews[i3].set(matrix, 0); + }; + buffer.bufferSubData = function() { + gl.bindBuffer(gl.ARRAY_BUFFER, buffer); + gl.bufferSubData(gl.ARRAY_BUFFER, 0, matrixData); + }; + return buffer; + } + function createPickingFrameBuffer(gl) { + var fb = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, fb); + var targetTexture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, targetTexture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, targetTexture, 0); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + fb.setFramebufferAttachmentSizes = function(width3, height2) { + gl.bindTexture(gl.TEXTURE_2D, targetTexture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width3, height2, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + }; + return fb; + } + function create3() { + var out = new ARRAY_TYPE(9); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + } + out[0] = 1; + out[4] = 1; + out[8] = 1; + return out; + } + function identity6(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 1; + out[5] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 1; + return out; + } + function multiply(out, a2, b3) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2]; + var a10 = a2[3], a11 = a2[4], a12 = a2[5]; + var a20 = a2[6], a21 = a2[7], a22 = a2[8]; + var b00 = b3[0], b01 = b3[1], b02 = b3[2]; + var b10 = b3[3], b11 = b3[4], b12 = b3[5]; + var b20 = b3[6], b21 = b3[7], b22 = b3[8]; + out[0] = b00 * a00 + b01 * a10 + b02 * a20; + out[1] = b00 * a01 + b01 * a11 + b02 * a21; + out[2] = b00 * a02 + b01 * a12 + b02 * a22; + out[3] = b10 * a00 + b11 * a10 + b12 * a20; + out[4] = b10 * a01 + b11 * a11 + b12 * a21; + out[5] = b10 * a02 + b11 * a12 + b12 * a22; + out[6] = b20 * a00 + b21 * a10 + b22 * a20; + out[7] = b20 * a01 + b21 * a11 + b22 * a21; + out[8] = b20 * a02 + b21 * a12 + b22 * a22; + return out; + } + function translate(out, a2, v3) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a10 = a2[3], a11 = a2[4], a12 = a2[5], a20 = a2[6], a21 = a2[7], a22 = a2[8], x5 = v3[0], y6 = v3[1]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a10; + out[4] = a11; + out[5] = a12; + out[6] = x5 * a00 + y6 * a10 + a20; + out[7] = x5 * a01 + y6 * a11 + a21; + out[8] = x5 * a02 + y6 * a12 + a22; + return out; + } + function rotate(out, a2, rad) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a10 = a2[3], a11 = a2[4], a12 = a2[5], a20 = a2[6], a21 = a2[7], a22 = a2[8], s2 = Math.sin(rad), c3 = Math.cos(rad); + out[0] = c3 * a00 + s2 * a10; + out[1] = c3 * a01 + s2 * a11; + out[2] = c3 * a02 + s2 * a12; + out[3] = c3 * a10 - s2 * a00; + out[4] = c3 * a11 - s2 * a01; + out[5] = c3 * a12 - s2 * a02; + out[6] = a20; + out[7] = a21; + out[8] = a22; + return out; + } + function scale(out, a2, v3) { + var x5 = v3[0], y6 = v3[1]; + out[0] = x5 * a2[0]; + out[1] = x5 * a2[1]; + out[2] = x5 * a2[2]; + out[3] = y6 * a2[3]; + out[4] = y6 * a2[4]; + out[5] = y6 * a2[5]; + out[6] = a2[6]; + out[7] = a2[7]; + out[8] = a2[8]; + return out; + } + function projection(out, width3, height2) { + out[0] = 2 / width3; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = -2 / height2; + out[5] = 0; + out[6] = -1; + out[7] = 1; + out[8] = 1; + return out; + } + function intersection2(set1, set22) { + if (set1.intersection) return set1.intersection(set22); + else return new Set(_toConsumableArray(set1).filter(function(x5) { + return set22.has(x5); + })); + } + function getBGColor(r2) { + var container2 = r2.cy.container(); + var cssColor = container2 && container2.style && container2.style.backgroundColor || "white"; + return color2tuple(cssColor); + } + function getLabelLines(ele, prefix) { + var rs = ele._private.rscratch; + return getPrefixedProperty(rs, "labelWrapCachedLines", prefix) || []; + } + function overrideCanvasRendererFunctions(r2) { + { + var renderCanvas = r2.render; + r2.render = function(options2) { + options2 = options2 || {}; + var cy = r2.cy; + if (r2.webgl) { + if (cy.zoom() > maxZoom$1) { + clearWebgl(r2); + renderCanvas.call(r2, options2); + } else { + clearCanvas(r2); + renderWebgl(r2, options2, RENDER_TARGET.SCREEN); + } + } + }; + } + { + var baseFunc = r2.matchCanvasSize; + r2.matchCanvasSize = function(container2) { + baseFunc.call(r2, container2); + r2.pickingFrameBuffer.setFramebufferAttachmentSizes(r2.canvasWidth, r2.canvasHeight); + r2.pickingFrameBuffer.needsDraw = true; + }; + } + { + r2.findNearestElements = function(x5, y6, interactiveElementsOnly, isTouch) { + return findNearestElementsWebgl(r2, x5, y6); + }; + } + { + var _baseFunc = r2.invalidateCachedZSortedEles; + r2.invalidateCachedZSortedEles = function() { + _baseFunc.call(r2); + r2.pickingFrameBuffer.needsDraw = true; + }; + } + { + var _baseFunc2 = r2.notify; + r2.notify = function(eventName, eles) { + _baseFunc2.call(r2, eventName, eles); + if (eventName === "viewport" || eventName === "bounds") { + r2.pickingFrameBuffer.needsDraw = true; + } else if (eventName === "background") { + r2.drawing.invalidate(eles, { + type: "node-body" + }); + } + }; + } + } + function clearWebgl(r2) { + var gl = r2.data.contexts[r2.WEBGL]; + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + } + function clearCanvas(r2) { + var clear22 = /* @__PURE__ */ __name(function clear23(context) { + context.save(); + context.setTransform(1, 0, 0, 1, 0, 0); + context.clearRect(0, 0, r2.canvasWidth, r2.canvasHeight); + context.restore(); + }, "clear"); + clear22(r2.data.contexts[r2.NODE]); + clear22(r2.data.contexts[r2.DRAG]); + } + function createPanZoomMatrix(r2) { + var width3 = r2.canvasWidth; + var height2 = r2.canvasHeight; + var _util$getEffectivePan = getEffectivePanZoom(r2), pan2 = _util$getEffectivePan.pan, zoom2 = _util$getEffectivePan.zoom; + var transform8 = create3(); + translate(transform8, transform8, [pan2.x, pan2.y]); + scale(transform8, transform8, [zoom2, zoom2]); + var projection$1 = create3(); + projection(projection$1, width3, height2); + var product = create3(); + multiply(product, projection$1, transform8); + return product; + } + function setContextTransform(r2, context) { + var width3 = r2.canvasWidth; + var height2 = r2.canvasHeight; + var _util$getEffectivePan2 = getEffectivePanZoom(r2), pan2 = _util$getEffectivePan2.pan, zoom2 = _util$getEffectivePan2.zoom; + context.setTransform(1, 0, 0, 1, 0, 0); + context.clearRect(0, 0, width3, height2); + context.translate(pan2.x, pan2.y); + context.scale(zoom2, zoom2); + } + function drawSelectionRectangle(r2, options2) { + r2.drawSelectionRectangle(options2, function(context) { + return setContextTransform(r2, context); + }); + } + function drawAxes(r2) { + var context = r2.data.contexts[r2.NODE]; + context.save(); + setContextTransform(r2, context); + context.strokeStyle = "rgba(0, 0, 0, 0.3)"; + context.beginPath(); + context.moveTo(-1e3, 0); + context.lineTo(1e3, 0); + context.stroke(); + context.beginPath(); + context.moveTo(0, -1e3); + context.lineTo(0, 1e3); + context.stroke(); + context.restore(); + } + function drawAtlases(r2) { + var draw32 = /* @__PURE__ */ __name(function draw33(drawing, name, row) { + var collection4 = drawing.atlasManager.getAtlasCollection(name); + var context = r2.data.contexts[r2.NODE]; + var atlases = collection4.atlases; + for (var _i = 0; _i < atlases.length; _i++) { + var atlas = atlases[_i]; + var canvas = atlas.canvas; + if (canvas) { + var w4 = canvas.width; + var h3 = canvas.height; + var x5 = w4 * _i; + var y6 = canvas.height * row; + var scale3 = 0.4; + context.save(); + context.scale(scale3, scale3); + context.drawImage(canvas, x5, y6); + context.strokeStyle = "black"; + context.rect(x5, y6, w4, h3); + context.stroke(); + context.restore(); + } + } + }, "draw"); + var i2 = 0; + draw32(r2.drawing, "node", i2++); + draw32(r2.drawing, "label", i2++); + } + function getPickingIndexes(r2, mX1, mY1, mX2, mY2) { + var x5, y6, w4, h3; + var _util$getEffectivePan3 = getEffectivePanZoom(r2), pan2 = _util$getEffectivePan3.pan, zoom2 = _util$getEffectivePan3.zoom; + { + var _util$modelToRendered = modelToRenderedPosition2(r2, pan2, zoom2, mX1, mY1), _util$modelToRendered2 = _slicedToArray(_util$modelToRendered, 2), cX1 = _util$modelToRendered2[0], cY1 = _util$modelToRendered2[1]; + var t4 = 6; + x5 = cX1 - t4 / 2; + y6 = cY1 - t4 / 2; + w4 = t4; + h3 = t4; + } + if (w4 === 0 || h3 === 0) { + return []; + } + var gl = r2.data.contexts[r2.WEBGL]; + gl.bindFramebuffer(gl.FRAMEBUFFER, r2.pickingFrameBuffer); + if (r2.pickingFrameBuffer.needsDraw) { + gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); + renderWebgl(r2, null, RENDER_TARGET.PICKING); + r2.pickingFrameBuffer.needsDraw = false; + } + var n2 = w4 * h3; + var data5 = new Uint8Array(n2 * 4); + gl.readPixels(x5, y6, w4, h3, gl.RGBA, gl.UNSIGNED_BYTE, data5); + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + var indexes = /* @__PURE__ */ new Set(); + for (var i2 = 0; i2 < n2; i2++) { + var pixel = data5.slice(i2 * 4, i2 * 4 + 4); + var index = vec4ToIndex(pixel) - 1; + if (index >= 0) { + indexes.add(index); + } + } + return indexes; + } + function findNearestElementsWebgl(r2, x5, y6) { + var indexes = getPickingIndexes(r2, x5, y6); + var eles = r2.getCachedZSortedEles(); + var node2, edge; + var _iterator = _createForOfIteratorHelper(indexes), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var index = _step.value; + var ele = eles[index]; + if (!node2 && ele.isNode()) { + node2 = ele; + } + if (!edge && ele.isEdge()) { + edge = ele; + } + if (node2 && edge) { + break; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return [node2, edge].filter(Boolean); + } + function drawEle(r2, index, ele) { + var drawing = r2.drawing; + index += 1; + if (ele.isNode()) { + drawing.drawNode(ele, index, "node-underlay"); + drawing.drawNode(ele, index, "node-body"); + drawing.drawTexture(ele, index, "label"); + drawing.drawNode(ele, index, "node-overlay"); + } else { + drawing.drawEdgeLine(ele, index); + drawing.drawEdgeArrow(ele, index, "source"); + drawing.drawEdgeArrow(ele, index, "target"); + drawing.drawTexture(ele, index, "label"); + drawing.drawTexture(ele, index, "edge-source-label"); + drawing.drawTexture(ele, index, "edge-target-label"); + } + } + function renderWebgl(r2, options2, renderTarget) { + var start3; + if (r2.webglDebug) { + start3 = performance.now(); + } + var drawing = r2.drawing; + var eleCount = 0; + if (renderTarget.screen) { + if (r2.data.canvasNeedsRedraw[r2.SELECT_BOX]) { + drawSelectionRectangle(r2, options2); + } + } + if (r2.data.canvasNeedsRedraw[r2.NODE] || renderTarget.picking) { + var gl = r2.data.contexts[r2.WEBGL]; + if (renderTarget.screen) { + gl.clearColor(0, 0, 0, 0); + gl.enable(gl.BLEND); + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + } else { + gl.disable(gl.BLEND); + } + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); + var panZoomMatrix = createPanZoomMatrix(r2); + var eles = r2.getCachedZSortedEles(); + eleCount = eles.length; + drawing.startFrame(panZoomMatrix, renderTarget); + if (renderTarget.screen) { + for (var i2 = 0; i2 < eles.nondrag.length; i2++) { + drawEle(r2, i2, eles.nondrag[i2]); + } + for (var _i2 = 0; _i2 < eles.drag.length; _i2++) { + drawEle(r2, _i2, eles.drag[_i2]); + } + } else if (renderTarget.picking) { + for (var _i3 = 0; _i3 < eles.length; _i3++) { + drawEle(r2, _i3, eles[_i3]); + } + } + drawing.endFrame(); + if (renderTarget.screen && r2.webglDebugShowAtlases) { + drawAxes(r2); + drawAtlases(r2); + } + r2.data.canvasNeedsRedraw[r2.NODE] = false; + r2.data.canvasNeedsRedraw[r2.DRAG] = false; + } + if (r2.webglDebug) { + var end2 = performance.now(); + var compact2 = false; + var time4 = Math.ceil(end2 - start3); + var debugInfo = drawing.getDebugInfo(); + var report = ["".concat(eleCount, " elements"), "".concat(debugInfo.totalInstances, " instances"), "".concat(debugInfo.batchCount, " batches"), "".concat(debugInfo.totalAtlases, " atlases"), "".concat(debugInfo.wrappedCount, " wrapped textures"), "".concat(debugInfo.simpleCount, " simple shapes")].join(", "); + if (compact2) { + console.log("WebGL (".concat(renderTarget.name, ") - time ").concat(time4, "ms, ").concat(report)); + } else { + console.log("WebGL (".concat(renderTarget.name, ") - frame time ").concat(time4, "ms")); + console.log("Totals:"); + console.log(" ".concat(report)); + console.log("Texture Atlases Used:"); + var atlasInfo = debugInfo.atlasInfo; + var _iterator2 = _createForOfIteratorHelper(atlasInfo), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var info2 = _step2.value; + console.log(" ".concat(info2.type, ": ").concat(info2.keyCount, " keys, ").concat(info2.atlasCount, " atlases")); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + console.log(""); + } + } + if (r2.data.gc) { + console.log("Garbage Collect!"); + r2.data.gc = false; + drawing.gc(); + } + } + function b64ToBlob(b64, mimeType) { + var bytes = atob(b64); + var buff = new ArrayBuffer(bytes.length); + var buffUint8 = new Uint8Array(buff); + for (var i2 = 0; i2 < bytes.length; i2++) { + buffUint8[i2] = bytes.charCodeAt(i2); + } + return new Blob([buff], { + type: mimeType + }); + } + function b64UriToB64(b64uri) { + var i2 = b64uri.indexOf(","); + return b64uri.substr(i2 + 1); + } + function output(options2, canvas, mimeType) { + var getB64Uri = /* @__PURE__ */ __name(function getB64Uri2() { + return canvas.toDataURL(mimeType, options2.quality); + }, "getB64Uri"); + switch (options2.output) { + case "blob-promise": + return new Promise$1(function(resolve2, reject3) { + try { + canvas.toBlob(function(blob) { + if (blob != null) { + resolve2(blob); + } else { + reject3(new Error("`canvas.toBlob()` sent a null value in its callback")); + } + }, mimeType, options2.quality); + } catch (err) { + reject3(err); + } + }); + case "blob": + return b64ToBlob(b64UriToB64(getB64Uri()), mimeType); + case "base64": + return b64UriToB64(getB64Uri()); + case "base64uri": + default: + return getB64Uri(); + } + } + function CanvasRenderer(options2) { + var r2 = this; + var containerWindow = r2.cy.window(); + var document2 = containerWindow.document; + if (options2.webgl) { + CRp.CANVAS_LAYERS = r2.CANVAS_LAYERS = 4; + console.log("webgl rendering enabled"); + } + r2.data = { + canvases: new Array(CRp.CANVAS_LAYERS), + contexts: new Array(CRp.CANVAS_LAYERS), + canvasNeedsRedraw: new Array(CRp.CANVAS_LAYERS), + bufferCanvases: new Array(CRp.BUFFER_COUNT), + bufferContexts: new Array(CRp.CANVAS_LAYERS) + }; + var tapHlOffAttr = "-webkit-tap-highlight-color"; + var tapHlOffStyle = "rgba(0,0,0,0)"; + r2.data.canvasContainer = document2.createElement("div"); + var containerStyle = r2.data.canvasContainer.style; + r2.data.canvasContainer.style[tapHlOffAttr] = tapHlOffStyle; + containerStyle.position = "relative"; + containerStyle.zIndex = "0"; + containerStyle.overflow = "hidden"; + var container2 = options2.cy.container(); + container2.appendChild(r2.data.canvasContainer); + container2.style[tapHlOffAttr] = tapHlOffStyle; + var styleMap2 = { + "-webkit-user-select": "none", + "-moz-user-select": "-moz-none", + "user-select": "none", + "-webkit-tap-highlight-color": "rgba(0,0,0,0)", + "outline-style": "none" + }; + if (ms()) { + styleMap2["-ms-touch-action"] = "none"; + styleMap2["touch-action"] = "none"; + } + for (var i2 = 0; i2 < CRp.CANVAS_LAYERS; i2++) { + var canvas = r2.data.canvases[i2] = document2.createElement("canvas"); + var type3 = CRp.CANVAS_TYPES[i2]; + r2.data.contexts[i2] = canvas.getContext(type3); + if (!r2.data.contexts[i2]) { + error("Could not create canvas of type " + type3); + } + Object.keys(styleMap2).forEach(function(k2) { + canvas.style[k2] = styleMap2[k2]; + }); + canvas.style.position = "absolute"; + canvas.setAttribute("data-id", "layer" + i2); + canvas.style.zIndex = String(CRp.CANVAS_LAYERS - i2); + r2.data.canvasContainer.appendChild(canvas); + r2.data.canvasNeedsRedraw[i2] = false; + } + r2.data.topCanvas = r2.data.canvases[0]; + r2.data.canvases[CRp.NODE].setAttribute("data-id", "layer" + CRp.NODE + "-node"); + r2.data.canvases[CRp.SELECT_BOX].setAttribute("data-id", "layer" + CRp.SELECT_BOX + "-selectbox"); + r2.data.canvases[CRp.DRAG].setAttribute("data-id", "layer" + CRp.DRAG + "-drag"); + if (r2.data.canvases[CRp.WEBGL]) { + r2.data.canvases[CRp.WEBGL].setAttribute("data-id", "layer" + CRp.WEBGL + "-webgl"); + } + for (var i2 = 0; i2 < CRp.BUFFER_COUNT; i2++) { + r2.data.bufferCanvases[i2] = document2.createElement("canvas"); + r2.data.bufferContexts[i2] = r2.data.bufferCanvases[i2].getContext("2d"); + r2.data.bufferCanvases[i2].style.position = "absolute"; + r2.data.bufferCanvases[i2].setAttribute("data-id", "buffer" + i2); + r2.data.bufferCanvases[i2].style.zIndex = String(-i2 - 1); + r2.data.bufferCanvases[i2].style.visibility = "hidden"; + } + r2.pathsEnabled = true; + var emptyBb = makeBoundingBox(); + var getBoxCenter = /* @__PURE__ */ __name(function getBoxCenter2(bb) { + return { + x: (bb.x1 + bb.x2) / 2, + y: (bb.y1 + bb.y2) / 2 + }; + }, "getBoxCenter"); + var getCenterOffset = /* @__PURE__ */ __name(function getCenterOffset2(bb) { + return { + x: -bb.w / 2, + y: -bb.h / 2 + }; + }, "getCenterOffset"); + var backgroundTimestampHasChanged = /* @__PURE__ */ __name(function backgroundTimestampHasChanged2(ele) { + var _p = ele[0]._private; + var same2 = _p.oldBackgroundTimestamp === _p.backgroundTimestamp; + return !same2; + }, "backgroundTimestampHasChanged"); + var getStyleKey = /* @__PURE__ */ __name(function getStyleKey2(ele) { + return ele[0]._private.nodeKey; + }, "getStyleKey"); + var getLabelKey = /* @__PURE__ */ __name(function getLabelKey2(ele) { + return ele[0]._private.labelStyleKey; + }, "getLabelKey"); + var getSourceLabelKey = /* @__PURE__ */ __name(function getSourceLabelKey2(ele) { + return ele[0]._private.sourceLabelStyleKey; + }, "getSourceLabelKey"); + var getTargetLabelKey = /* @__PURE__ */ __name(function getTargetLabelKey2(ele) { + return ele[0]._private.targetLabelStyleKey; + }, "getTargetLabelKey"); + var drawElement = /* @__PURE__ */ __name(function drawElement2(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r2.drawElement(context, ele, bb, false, false, useEleOpacity); + }, "drawElement"); + var drawLabel4 = /* @__PURE__ */ __name(function drawLabel5(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r2.drawElementText(context, ele, bb, scaledLabelShown, "main", useEleOpacity); + }, "drawLabel"); + var drawSourceLabel = /* @__PURE__ */ __name(function drawSourceLabel2(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r2.drawElementText(context, ele, bb, scaledLabelShown, "source", useEleOpacity); + }, "drawSourceLabel"); + var drawTargetLabel = /* @__PURE__ */ __name(function drawTargetLabel2(context, ele, bb, scaledLabelShown, useEleOpacity) { + return r2.drawElementText(context, ele, bb, scaledLabelShown, "target", useEleOpacity); + }, "drawTargetLabel"); + var getElementBox = /* @__PURE__ */ __name(function getElementBox2(ele) { + ele.boundingBox(); + return ele[0]._private.bodyBounds; + }, "getElementBox"); + var getLabelBox = /* @__PURE__ */ __name(function getLabelBox2(ele) { + ele.boundingBox(); + return ele[0]._private.labelBounds.main || emptyBb; + }, "getLabelBox"); + var getSourceLabelBox = /* @__PURE__ */ __name(function getSourceLabelBox2(ele) { + ele.boundingBox(); + return ele[0]._private.labelBounds.source || emptyBb; + }, "getSourceLabelBox"); + var getTargetLabelBox = /* @__PURE__ */ __name(function getTargetLabelBox2(ele) { + ele.boundingBox(); + return ele[0]._private.labelBounds.target || emptyBb; + }, "getTargetLabelBox"); + var isLabelVisibleAtScale = /* @__PURE__ */ __name(function isLabelVisibleAtScale2(ele, scaledLabelShown) { + return scaledLabelShown; + }, "isLabelVisibleAtScale"); + var getElementRotationPoint = /* @__PURE__ */ __name(function getElementRotationPoint2(ele) { + return getBoxCenter(getElementBox(ele)); + }, "getElementRotationPoint"); + var addTextMargin = /* @__PURE__ */ __name(function addTextMargin2(prefix, pt, ele) { + var pre = prefix ? prefix + "-" : ""; + return { + x: pt.x + ele.pstyle(pre + "text-margin-x").pfValue, + y: pt.y + ele.pstyle(pre + "text-margin-y").pfValue + }; + }, "addTextMargin"); + var getRsPt = /* @__PURE__ */ __name(function getRsPt2(ele, x5, y6) { + var rs = ele[0]._private.rscratch; + return { + x: rs[x5], + y: rs[y6] + }; + }, "getRsPt"); + var getLabelRotationPoint = /* @__PURE__ */ __name(function getLabelRotationPoint2(ele) { + return addTextMargin("", getRsPt(ele, "labelX", "labelY"), ele); + }, "getLabelRotationPoint"); + var getSourceLabelRotationPoint = /* @__PURE__ */ __name(function getSourceLabelRotationPoint2(ele) { + return addTextMargin("source", getRsPt(ele, "sourceLabelX", "sourceLabelY"), ele); + }, "getSourceLabelRotationPoint"); + var getTargetLabelRotationPoint = /* @__PURE__ */ __name(function getTargetLabelRotationPoint2(ele) { + return addTextMargin("target", getRsPt(ele, "targetLabelX", "targetLabelY"), ele); + }, "getTargetLabelRotationPoint"); + var getElementRotationOffset = /* @__PURE__ */ __name(function getElementRotationOffset2(ele) { + return getCenterOffset(getElementBox(ele)); + }, "getElementRotationOffset"); + var getSourceLabelRotationOffset = /* @__PURE__ */ __name(function getSourceLabelRotationOffset2(ele) { + return getCenterOffset(getSourceLabelBox(ele)); + }, "getSourceLabelRotationOffset"); + var getTargetLabelRotationOffset = /* @__PURE__ */ __name(function getTargetLabelRotationOffset2(ele) { + return getCenterOffset(getTargetLabelBox(ele)); + }, "getTargetLabelRotationOffset"); + var getLabelRotationOffset = /* @__PURE__ */ __name(function getLabelRotationOffset2(ele) { + var bb = getLabelBox(ele); + var p3 = getCenterOffset(getLabelBox(ele)); + if (ele.isNode()) { + switch (ele.pstyle("text-halign").value) { + case "left": + p3.x = -bb.w - (bb.leftPad || 0); + break; + case "right": + p3.x = -(bb.rightPad || 0); + break; + } + switch (ele.pstyle("text-valign").value) { + case "top": + p3.y = -bb.h - (bb.topPad || 0); + break; + case "bottom": + p3.y = -(bb.botPad || 0); + break; + } + } + return p3; + }, "getLabelRotationOffset"); + var eleTxrCache = r2.data.eleTxrCache = new ElementTextureCache(r2, { + getKey: getStyleKey, + doesEleInvalidateKey: backgroundTimestampHasChanged, + drawElement, + getBoundingBox: getElementBox, + getRotationPoint: getElementRotationPoint, + getRotationOffset: getElementRotationOffset, + allowEdgeTxrCaching: false, + allowParentTxrCaching: false + }); + var lblTxrCache = r2.data.lblTxrCache = new ElementTextureCache(r2, { + getKey: getLabelKey, + drawElement: drawLabel4, + getBoundingBox: getLabelBox, + getRotationPoint: getLabelRotationPoint, + getRotationOffset: getLabelRotationOffset, + isVisible: isLabelVisibleAtScale + }); + var slbTxrCache = r2.data.slbTxrCache = new ElementTextureCache(r2, { + getKey: getSourceLabelKey, + drawElement: drawSourceLabel, + getBoundingBox: getSourceLabelBox, + getRotationPoint: getSourceLabelRotationPoint, + getRotationOffset: getSourceLabelRotationOffset, + isVisible: isLabelVisibleAtScale + }); + var tlbTxrCache = r2.data.tlbTxrCache = new ElementTextureCache(r2, { + getKey: getTargetLabelKey, + drawElement: drawTargetLabel, + getBoundingBox: getTargetLabelBox, + getRotationPoint: getTargetLabelRotationPoint, + getRotationOffset: getTargetLabelRotationOffset, + isVisible: isLabelVisibleAtScale + }); + var lyrTxrCache = r2.data.lyrTxrCache = new LayeredTextureCache(r2); + r2.onUpdateEleCalcs(/* @__PURE__ */ __name(function invalidateTextureCaches(willDraw, eles) { + eleTxrCache.invalidateElements(eles); + lblTxrCache.invalidateElements(eles); + slbTxrCache.invalidateElements(eles); + tlbTxrCache.invalidateElements(eles); + lyrTxrCache.invalidateElements(eles); + for (var _i = 0; _i < eles.length; _i++) { + var _p = eles[_i]._private; + _p.oldBackgroundTimestamp = _p.backgroundTimestamp; + } + }, "invalidateTextureCaches")); + var refineInLayers = /* @__PURE__ */ __name(function refineInLayers2(reqs) { + for (var i3 = 0; i3 < reqs.length; i3++) { + lyrTxrCache.enqueueElementRefinement(reqs[i3].ele); + } + }, "refineInLayers"); + eleTxrCache.onDequeue(refineInLayers); + lblTxrCache.onDequeue(refineInLayers); + slbTxrCache.onDequeue(refineInLayers); + tlbTxrCache.onDequeue(refineInLayers); + if (options2.webgl) { + r2.initWebgl(options2, { + getStyleKey, + getLabelKey, + getSourceLabelKey, + getTargetLabelKey, + drawElement, + drawLabel: drawLabel4, + drawSourceLabel, + drawTargetLabel, + getElementBox, + getLabelBox, + getSourceLabelBox, + getTargetLabelBox, + getElementRotationPoint, + getElementRotationOffset, + getLabelRotationPoint, + getSourceLabelRotationPoint, + getTargetLabelRotationPoint, + getLabelRotationOffset, + getSourceLabelRotationOffset, + getTargetLabelRotationOffset + }); + } + } + function setExtension(type3, name, registrant) { + var ext = registrant; + var overrideErr = /* @__PURE__ */ __name(function overrideErr2(field) { + warn("Can not register `" + name + "` for `" + type3 + "` since `" + field + "` already exists in the prototype and can not be overridden"); + }, "overrideErr"); + if (type3 === "core") { + if (Core.prototype[name]) { + return overrideErr(name); + } else { + Core.prototype[name] = registrant; + } + } else if (type3 === "collection") { + if (Collection.prototype[name]) { + return overrideErr(name); + } else { + Collection.prototype[name] = registrant; + } + } else if (type3 === "layout") { + var Layout2 = /* @__PURE__ */ __name(function Layout3(options2) { + this.options = options2; + registrant.call(this, options2); + if (!plainObject(this._private)) { + this._private = {}; + } + this._private.cy = options2.cy; + this._private.listeners = []; + this.createEmitter(); + }, "Layout"); + var layoutProto = Layout2.prototype = Object.create(registrant.prototype); + var optLayoutFns = []; + for (var i2 = 0; i2 < optLayoutFns.length; i2++) { + var fnName = optLayoutFns[i2]; + layoutProto[fnName] = layoutProto[fnName] || function() { + return this; + }; + } + if (layoutProto.start && !layoutProto.run) { + layoutProto.run = function() { + this.start(); + return this; + }; + } else if (!layoutProto.start && layoutProto.run) { + layoutProto.start = function() { + this.run(); + return this; + }; + } + var regStop = registrant.prototype.stop; + layoutProto.stop = function() { + var opts = this.options; + if (opts && opts.animate) { + var anis = this.animations; + if (anis) { + for (var _i = 0; _i < anis.length; _i++) { + anis[_i].stop(); + } + } + } + if (regStop) { + regStop.call(this); + } else { + this.emit("layoutstop"); + } + return this; + }; + if (!layoutProto.destroy) { + layoutProto.destroy = function() { + return this; + }; + } + layoutProto.cy = function() { + return this._private.cy; + }; + var getCy = /* @__PURE__ */ __name(function getCy2(layout7) { + return layout7._private.cy; + }, "getCy"); + var emitterOpts = { + addEventFields: /* @__PURE__ */ __name(function addEventFields4(layout7, evt) { + evt.layout = layout7; + evt.cy = getCy(layout7); + evt.target = layout7; + }, "addEventFields"), + bubble: /* @__PURE__ */ __name(function bubble3() { + return true; + }, "bubble"), + parent: /* @__PURE__ */ __name(function parent4(layout7) { + return getCy(layout7); + }, "parent") + }; + extend4(layoutProto, { + createEmitter: /* @__PURE__ */ __name(function createEmitter3() { + this._private.emitter = new Emitter(emitterOpts, this); + return this; + }, "createEmitter"), + emitter: /* @__PURE__ */ __name(function emitter3() { + return this._private.emitter; + }, "emitter"), + on: /* @__PURE__ */ __name(function on3(evt, cb) { + this.emitter().on(evt, cb); + return this; + }, "on"), + one: /* @__PURE__ */ __name(function one4(evt, cb) { + this.emitter().one(evt, cb); + return this; + }, "one"), + once: /* @__PURE__ */ __name(function once3(evt, cb) { + this.emitter().one(evt, cb); + return this; + }, "once"), + removeListener: /* @__PURE__ */ __name(function removeListener3(evt, cb) { + this.emitter().removeListener(evt, cb); + return this; + }, "removeListener"), + removeAllListeners: /* @__PURE__ */ __name(function removeAllListeners3() { + this.emitter().removeAllListeners(); + return this; + }, "removeAllListeners"), + emit: /* @__PURE__ */ __name(function emit3(evt, params) { + this.emitter().emit(evt, params); + return this; + }, "emit") + }); + define2.eventAliasesOn(layoutProto); + ext = Layout2; + } else if (type3 === "renderer" && name !== "null" && name !== "base") { + var BaseRenderer3 = getExtension("renderer", "base"); + var bProto = BaseRenderer3.prototype; + var RegistrantRenderer = registrant; + var rProto = registrant.prototype; + var Renderer = /* @__PURE__ */ __name(function Renderer2() { + BaseRenderer3.apply(this, arguments); + RegistrantRenderer.apply(this, arguments); + }, "Renderer"); + var proto = Renderer.prototype; + for (var pName in bProto) { + var pVal = bProto[pName]; + var existsInR = rProto[pName] != null; + if (existsInR) { + return overrideErr(pName); + } + proto[pName] = pVal; + } + for (var _pName in rProto) { + proto[_pName] = rProto[_pName]; + } + bProto.clientFunctions.forEach(function(name2) { + proto[name2] = proto[name2] || function() { + error("Renderer does not implement `renderer." + name2 + "()` on its prototype"); + }; + }); + ext = Renderer; + } else if (type3 === "__proto__" || type3 === "constructor" || type3 === "prototype") { + return error(type3 + " is an illegal type to be registered, possibly lead to prototype pollutions"); + } + return setMap({ + map: extensions, + keys: [type3, name], + value: ext + }); + } + function getExtension(type3, name) { + return getMap({ + map: extensions, + keys: [type3, name] + }); + } + function setModule(type3, name, moduleType, moduleName, registrant) { + return setMap({ + map: modules, + keys: [type3, name, moduleType, moduleName], + value: registrant + }); + } + function getModule(type3, name, moduleType, moduleName) { + return getMap({ + map: modules, + keys: [type3, name, moduleType, moduleName] + }); + } + var _window, navigator2, typeofstr, typeofobj, typeoffn, typeofhtmlele, instanceStr, string, fn$6, array2, plainObject, object, number$1, integer, htmlElement, elementOrCollection, element, collection, core2, stylesheet, event, emptyString, domElement, boundingBox, promise, ms, memoize3, camel2dash, dash2camel, prependCamel, capitalize, endsWith, number6, rgba3, rgbaNoBackRefs, hsla2, hslaNoBackRefs, hex3, hex6, ascending3, descending2, extend4, hex2tuple, hsl2tuple, rgb2tuple, colorname2tuple, color2tuple, colors, setMap, getMap, commonjsGlobal, isObject_12, hasRequiredIsObject, _freeGlobal, hasRequired_freeGlobal, _root, hasRequired_root, now_1, hasRequiredNow, _trimmedEndIndex, hasRequired_trimmedEndIndex, _baseTrim, hasRequired_baseTrim, _Symbol, hasRequired_Symbol, _getRawTag, hasRequired_getRawTag, _objectToString, hasRequired_objectToString, _baseGetTag, hasRequired_baseGetTag, isObjectLike_1, hasRequiredIsObjectLike, isSymbol_1, hasRequiredIsSymbol, toNumber_1, hasRequiredToNumber, debounce_1, hasRequiredDebounce, debounceExports, debounce, performance$1, pnow, raf, requestAnimationFrame2, performanceNow, DEFAULT_HASH_SEED, K4, DEFAULT_HASH_SEED_ALT, hashIterableInts, hashInt, hashIntAlt, combineHashes, combineHashesArray, hashArrays, hashIntsArray, hashString, hashStrings, hashStringsArray, movePointByBoxAspect, warningsEnabled, warnSupported, traceSupported, MAX_INT$1, trueify, falsify, zeroify, noop$1, error, warnings, warn, clone5, copy3, copyArray2, uuid, _staticEmptyObject, staticEmptyObject, defaults$g, removeFromArray, clearArray, push, getPrefixedProperty, setPrefixedProperty, ObjectMap, Map$1, undef, ObjectSet, Set$1, Element, defineSearch, elesfn$v, heap$2, heap$1, hasRequiredHeap$1, heap, hasRequiredHeap, heapExports, Heap, dijkstraDefaults, elesfn$u, elesfn$t, aStarDefaults, elesfn$s, floydWarshallDefaults, elesfn$r, bellmanFordDefaults, elesfn$q, sqrt2, collapse, contractUntil, elesfn$p, _Math$hypot, copyPosition, modelToRenderedPosition$1, renderedToModelPosition, array2point, min5, max5, mean, median, deg2rad, getAngleFromDisp, log22, signum, dist, sqdist, inPlaceSumNormalize, qbezierAt, qbezierPtAt, lineAt, bound, makeBoundingBox, copyBoundingBox, clearBoundingBox, updateBoundingBox, expandBoundingBoxByPoint, expandBoundingBox, expandBoundingBoxSides, assignBoundingBox, boundingBoxesIntersect, inBoundingBox, pointInBoundingBox, boundingBoxInBoundingBox, hypot, roundRectangleIntersectLine, inLineVicinity, inBezierVicinity, solveQuadratic, solveCubic, sqdistToQuadraticBezier, sqdistToFiniteLine, pointInsidePolygonPoints, pointInsidePolygon, pointInsideRoundPolygon, joinLines, expandPolygon, intersectLineEllipse, checkInEllipse, intersectLineCircle, midOfThree, finiteLinesIntersect, transformPoints, polygonIntersectLine, roundPolygonIntersectLine, shortenIntersection, generateUnitNgonPointsFitToSquare, fitPolygonToSquare, generateUnitNgonPoints, getRoundRectangleRadius, getRoundPolygonRadius, getCutRectangleCornerLength, bezierPtsToQuadCoeff, getBarrelCurveConstants, pageRankDefaults, elesfn$o, defaults$f, elesfn$n, defaults$e, elesfn$m, defaults$d, elesfn$l, defaults$c, setOptions$3, getSimilarity$1, addLoops, normalize2, mmult, expand, inflate, hasConverged, assign$2, isDuplicate, removeDuplicates, markovClustering, markovClustering$1, identity$1, absDiff, addAbsDiff, addSquaredDiff, sqrt3, maxAbsDiff, getDistance, distances, defaults$b, setOptions$2, getDist, randomCentroids, classify, buildCluster, haveValuesConverged, haveMatricesConverged, seenBefore, randomMedoids, findCost, kMeans, kMedoids, updateCentroids, updateMembership, assign$1, fuzzyCMeans, kClustering, defaults$a, linkageAliases, setOptions$1, mergeClosest, _getAllChildren, _buildDendrogram, _buildClustersFromTree, hierarchicalClustering, hierarchicalClustering$1, defaults$9, setOptions4, getSimilarity2, getPreference, findExemplars, assignClusters, assign3, affinityPropagation, affinityPropagation$1, hierholzerDefaults, elesfn$k, hopcroftTarjanBiconnected, hopcroftTarjanBiconnected$1, tarjanStronglyConnected, tarjanStronglyConnected$1, elesfn$j, STATE_PENDING, STATE_FULFILLED, STATE_REJECTED, _api, deliver, execute, execute_handlers, resolver, _resolve, Promise$1, Animation, anifn, define$3, isArray_1, hasRequiredIsArray, _isKey, hasRequired_isKey, isFunction_1, hasRequiredIsFunction, _coreJsData, hasRequired_coreJsData, _isMasked, hasRequired_isMasked, _toSource, hasRequired_toSource, _baseIsNative, hasRequired_baseIsNative, _getValue, hasRequired_getValue, _getNative, hasRequired_getNative, _nativeCreate, hasRequired_nativeCreate, _hashClear, hasRequired_hashClear, _hashDelete, hasRequired_hashDelete, _hashGet, hasRequired_hashGet, _hashHas, hasRequired_hashHas, _hashSet, hasRequired_hashSet, _Hash, hasRequired_Hash, _listCacheClear, hasRequired_listCacheClear, eq_1, hasRequiredEq, _assocIndexOf, hasRequired_assocIndexOf, _listCacheDelete, hasRequired_listCacheDelete, _listCacheGet, hasRequired_listCacheGet, _listCacheHas, hasRequired_listCacheHas, _listCacheSet, hasRequired_listCacheSet, _ListCache, hasRequired_ListCache, _Map, hasRequired_Map, _mapCacheClear, hasRequired_mapCacheClear, _isKeyable, hasRequired_isKeyable, _getMapData, hasRequired_getMapData, _mapCacheDelete, hasRequired_mapCacheDelete, _mapCacheGet, hasRequired_mapCacheGet, _mapCacheHas, hasRequired_mapCacheHas, _mapCacheSet, hasRequired_mapCacheSet, _MapCache, hasRequired_MapCache, memoize_1, hasRequiredMemoize, _memoizeCapped, hasRequired_memoizeCapped, _stringToPath, hasRequired_stringToPath, _arrayMap, hasRequired_arrayMap, _baseToString, hasRequired_baseToString, toString_1, hasRequiredToString, _castPath, hasRequired_castPath, _toKey, hasRequired_toKey, _baseGet, hasRequired_baseGet, get_1, hasRequiredGet, getExports, get4, _defineProperty, hasRequired_defineProperty, _baseAssignValue, hasRequired_baseAssignValue, _assignValue, hasRequired_assignValue, _isIndex, hasRequired_isIndex, _baseSet, hasRequired_baseSet, set_1, hasRequiredSet, setExports, set4, _copyArray, hasRequired_copyArray, toPath_1, hasRequiredToPath, toPathExports, toPath, define$2, define$1, define2, elesfn$i, elesfn$h, tokens, newQuery, Type2, stateSelectors, lookup, stateSelectorMatches, stateSelectorRegex, cleanMetaChars, replaceLastQuery, exprs, consumeExpr, consumeWhitespace, parse, toString3, parse$1, valCmp, boolCmp, existCmp, data$1, meta, match, matches$1, filter3, matches31, matching, Selector, selfn, elesfn$g, cache, elesfn$f, fn$5, elesfn$e, data3, elesfn$d, fn$4, elesfn$c, beforePositionSet, positionDef, position2, fn$3, elesfn$b, noninf, updateBounds, updateBoundsFromBox, prefixedProperty, updateBoundsFromArrow, updateBoundsFromLabel, updateBoundsFromOutline, updateBoundsFromMiter, updateBoundsFromMiterBorder, boundingBoxImpl, getKey, getBoundingBoxPosKey, cachedBoundingBoxImpl, defBbOpts, defBbOptsKey, filledBbOpts, bounds, fn$2, elesfn$a, defineDimFns, widthHeight, ifEdge, ifEdgeRenderedPosition, ifEdgeRenderedPositions, controlPoints2, segmentPoints, sourceEndpoint, targetEndpoint, midpoint, pts, renderedName, edgePoints, dimensions, Event, eventRegex, universalNamespace, defaults$8, defaultsKeys, emptyOpts, p2, forEachEvent, makeEventObj, forEachEventObj, emitterOptions$1, argSelector$1, elesfn$9, elesfn$8, fn$1, elesfn$7, zIndexSort, elesfn$6, defineSymbolIterator, getLayoutDimensionOptions, elesfn$5, elesfn$4, eleTakesUpSpace, eleInteractive, parentInteractive, eleVisible, edgeVisibleViaNode, elesfn$3, elesfn$2, defineDagExtremity, defineDagOneHop, defineDagAllHops, Collection, elesfn$1, corefn$9, generateSpringRK4, cubicBezier, easings, corefn$8, emitterOptions, argSelector2, elesfn, corefn$7, corefn$6, corefn$5, rendererDefaults, corefn$4, corefn$3, styfn$8, TRUE, FALSE, styfn$7, styfn$6, styfn$5, styfn$4, styfn$3, styfn$2, styfn$1, _Style, styfn, corefn$2, defaultSelectionType, corefn$1, fn2, Core, corefn, defaults$7, deprecatedOptionDefaults, getInfo, setInfo, defaults$6, defaults$5, DEBUG, defaults$4, createLayoutInfo, findLCA, _findLCA_aux, printLayoutInfo, randomizePositions, getScaleInBoundsFn, refreshPositions, step, calculateNodeForces, randomDistance, nodeRepulsion2, nodesOverlap, findClippingPoint, calculateEdgeForces, calculateGravityForces, propagateForces, updatePositions, limitForce, _updateAncestryBoundaries, separateComponents, defaults$3, defaults$2, defaults$1, defaults3, layout4, noop5, throwImgErr, BRp$f, BRp$e, BRp$d, x3, y4, v1, v22, sinA, sinA90, radDirection, drawDirection, angle, halfAngle, cRadius, lenOut, radius, limit, startX, startY, stopX, stopY, lastPoint, asVec, invertVec, calcCornerArc, AVOID_IMPOSSIBLE_BEZIER_CONSTANT, AVOID_IMPOSSIBLE_BEZIER_CONSTANT_L, BRp$c, BRp$b, BRp$a, BRp$9, lineAngleFromDelta, lineAngle, bezierAngle, BRp$8, TOO_SMALL_CUT_RECT, warnedCutRect, BRp$7, BRp$6, BRp$5, BRp$4, BRp$3, BRp$2, BRp$1, beforeRenderCallbacks, BaseRenderer, BR, BRp, fullFpsTime, defs, ElementTextureCacheLookup, minTxrH, txrStepH, minLvl$1, maxLvl$1, maxZoom$1, eleTxrSpacing, defTxrWidth, maxTxrW, maxTxrH, minUtility, maxFullness, maxFullnessChecks, deqCost$1, deqAvgCost$1, deqNoDrawCost$1, deqFastCost$1, deqRedrawThreshold$1, maxDeqSize$1, getTxrReasons, initDefaults, ElementTextureCache, ETCp, defNumLayers, minLvl, maxLvl, maxZoom2, deqRedrawThreshold, refineEleDebounceTime, deqCost, deqAvgCost, deqNoDrawCost, deqFastCost, maxDeqSize, invalidThreshold, maxLayerArea, maxLayerDim, useHighQualityEleTxrReqs, LayeredTextureCache, LTCp, layerIdPool, MAX_INT, CRp$b, impl, CRp$a, getZeroRotation, getLabelRotation, getSourceLabelRotation, getTargetLabelRotation, getOpacity, getTextOpacity, CRp$9, drawEdgeOverlayUnderlay, CRp$8, CRp$7, CRp$6, drawNodeOverlayUnderlay, CRp$5, motionBlurDelay, fpsHeight, ARRAY_TYPE, Atlas, AtlasCollection, AtlasManager, AtlasBatchManager, circleSD, rectangleSD, roundRectangleSD, ellipseSD, RENDER_TARGET, TEX_PICKING_MODE, TEXTURE, EDGE_STRAIGHT, EDGE_CURVE_SEGMENT, EDGE_ARROW, RECTANGLE, ROUND_RECTANGLE, BOTTOM_ROUND_RECTANGLE, ELLIPSE, ElementDrawingWebGL, CRp$4, getStyleKeysForLabel, getBoundingBoxForLabel, CRp$3, sin0, cos0, sin2, cos2, ellipseStepSize, i2, CRp$2, CRp$1, CR, CRp, pathsImpld, renderer2, incExts, extensions, modules, extension2, _Stylesheet, sheetfn, version2, cytoscape2; + var init_cytoscape_esm = __esm({ + "../../node_modules/.pnpm/cytoscape@3.33.1/node_modules/cytoscape/dist/cytoscape.esm.mjs"() { + "use strict"; + __name(_arrayLikeToArray, "_arrayLikeToArray"); + __name(_arrayWithHoles, "_arrayWithHoles"); + __name(_arrayWithoutHoles, "_arrayWithoutHoles"); + __name(_classCallCheck, "_classCallCheck"); + __name(_defineProperties, "_defineProperties"); + __name(_createClass, "_createClass"); + __name(_createForOfIteratorHelper, "_createForOfIteratorHelper"); + __name(_defineProperty$1, "_defineProperty$1"); + __name(_iterableToArray, "_iterableToArray"); + __name(_iterableToArrayLimit, "_iterableToArrayLimit"); + __name(_nonIterableRest, "_nonIterableRest"); + __name(_nonIterableSpread, "_nonIterableSpread"); + __name(_slicedToArray, "_slicedToArray"); + __name(_toConsumableArray, "_toConsumableArray"); + __name(_toPrimitive, "_toPrimitive"); + __name(_toPropertyKey, "_toPropertyKey"); + __name(_typeof, "_typeof"); + __name(_unsupportedIterableToArray, "_unsupportedIterableToArray"); + _window = typeof window === "undefined" ? null : window; + navigator2 = _window ? _window.navigator : null; + _window ? _window.document : null; + typeofstr = _typeof(""); + typeofobj = _typeof({}); + typeoffn = _typeof(function() { + }); + typeofhtmlele = typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement); + instanceStr = /* @__PURE__ */ __name(function instanceStr2(obj) { + return obj && obj.instanceString && fn$6(obj.instanceString) ? obj.instanceString() : null; + }, "instanceStr"); + string = /* @__PURE__ */ __name(function string2(obj) { + return obj != null && _typeof(obj) == typeofstr; + }, "string"); + fn$6 = /* @__PURE__ */ __name(function fn(obj) { + return obj != null && _typeof(obj) === typeoffn; + }, "fn"); + array2 = /* @__PURE__ */ __name(function array3(obj) { + return !elementOrCollection(obj) && (Array.isArray ? Array.isArray(obj) : obj != null && obj instanceof Array); + }, "array"); + plainObject = /* @__PURE__ */ __name(function plainObject2(obj) { + return obj != null && _typeof(obj) === typeofobj && !array2(obj) && obj.constructor === Object; + }, "plainObject"); + object = /* @__PURE__ */ __name(function object2(obj) { + return obj != null && _typeof(obj) === typeofobj; + }, "object"); + number$1 = /* @__PURE__ */ __name(function number5(obj) { + return obj != null && _typeof(obj) === _typeof(1) && !isNaN(obj); + }, "number"); + integer = /* @__PURE__ */ __name(function integer2(obj) { + return number$1(obj) && Math.floor(obj) === obj; + }, "integer"); + htmlElement = /* @__PURE__ */ __name(function htmlElement2(obj) { + if ("undefined" === typeofhtmlele) { + return void 0; + } else { + return null != obj && obj instanceof HTMLElement; + } + }, "htmlElement"); + elementOrCollection = /* @__PURE__ */ __name(function elementOrCollection2(obj) { + return element(obj) || collection(obj); + }, "elementOrCollection"); + element = /* @__PURE__ */ __name(function element2(obj) { + return instanceStr(obj) === "collection" && obj._private.single; + }, "element"); + collection = /* @__PURE__ */ __name(function collection2(obj) { + return instanceStr(obj) === "collection" && !obj._private.single; + }, "collection"); + core2 = /* @__PURE__ */ __name(function core3(obj) { + return instanceStr(obj) === "core"; + }, "core"); + stylesheet = /* @__PURE__ */ __name(function stylesheet2(obj) { + return instanceStr(obj) === "stylesheet"; + }, "stylesheet"); + event = /* @__PURE__ */ __name(function event2(obj) { + return instanceStr(obj) === "event"; + }, "event"); + emptyString = /* @__PURE__ */ __name(function emptyString2(obj) { + if (obj === void 0 || obj === null) { + return true; + } else if (obj === "" || obj.match(/^\s+$/)) { + return true; + } + return false; + }, "emptyString"); + domElement = /* @__PURE__ */ __name(function domElement2(obj) { + if (typeof HTMLElement === "undefined") { + return false; + } else { + return obj instanceof HTMLElement; + } + }, "domElement"); + boundingBox = /* @__PURE__ */ __name(function boundingBox2(obj) { + return plainObject(obj) && number$1(obj.x1) && number$1(obj.x2) && number$1(obj.y1) && number$1(obj.y2); + }, "boundingBox"); + promise = /* @__PURE__ */ __name(function promise2(obj) { + return object(obj) && fn$6(obj.then); + }, "promise"); + ms = /* @__PURE__ */ __name(function ms2() { + return navigator2 && navigator2.userAgent.match(/msie|trident|edge/i); + }, "ms"); + memoize3 = /* @__PURE__ */ __name(function memoize4(fn3, keyFn) { + if (!keyFn) { + keyFn = /* @__PURE__ */ __name(function keyFn2() { + if (arguments.length === 1) { + return arguments[0]; + } else if (arguments.length === 0) { + return "undefined"; + } + var args = []; + for (var i2 = 0; i2 < arguments.length; i2++) { + args.push(arguments[i2]); + } + return args.join("$"); + }, "keyFn"); + } + var _memoizedFn = /* @__PURE__ */ __name(function memoizedFn() { + var self2 = this; + var args = arguments; + var ret; + var k2 = keyFn.apply(self2, args); + var cache3 = _memoizedFn.cache; + if (!(ret = cache3[k2])) { + ret = cache3[k2] = fn3.apply(self2, args); + } + return ret; + }, "memoizedFn"); + _memoizedFn.cache = {}; + return _memoizedFn; + }, "memoize"); + camel2dash = memoize3(function(str2) { + return str2.replace(/([A-Z])/g, function(v3) { + return "-" + v3.toLowerCase(); + }); + }); + dash2camel = memoize3(function(str2) { + return str2.replace(/(-\w)/g, function(v3) { + return v3[1].toUpperCase(); + }); + }); + prependCamel = memoize3(function(prefix, str2) { + return prefix + str2[0].toUpperCase() + str2.substring(1); + }, function(prefix, str2) { + return prefix + "$" + str2; + }); + capitalize = /* @__PURE__ */ __name(function capitalize2(str2) { + if (emptyString(str2)) { + return str2; + } + return str2.charAt(0).toUpperCase() + str2.substring(1); + }, "capitalize"); + endsWith = /* @__PURE__ */ __name(function endsWith2(string3, suffix) { + return string3.slice(-1 * suffix.length) === suffix; + }, "endsWith"); + number6 = "(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))"; + rgba3 = "rgb[a]?\\((" + number6 + "[%]?)\\s*,\\s*(" + number6 + "[%]?)\\s*,\\s*(" + number6 + "[%]?)(?:\\s*,\\s*(" + number6 + "))?\\)"; + rgbaNoBackRefs = "rgb[a]?\\((?:" + number6 + "[%]?)\\s*,\\s*(?:" + number6 + "[%]?)\\s*,\\s*(?:" + number6 + "[%]?)(?:\\s*,\\s*(?:" + number6 + "))?\\)"; + hsla2 = "hsl[a]?\\((" + number6 + ")\\s*,\\s*(" + number6 + "[%])\\s*,\\s*(" + number6 + "[%])(?:\\s*,\\s*(" + number6 + "))?\\)"; + hslaNoBackRefs = "hsl[a]?\\((?:" + number6 + ")\\s*,\\s*(?:" + number6 + "[%])\\s*,\\s*(?:" + number6 + "[%])(?:\\s*,\\s*(?:" + number6 + "))?\\)"; + hex3 = "\\#[0-9a-fA-F]{3}"; + hex6 = "\\#[0-9a-fA-F]{6}"; + ascending3 = /* @__PURE__ */ __name(function ascending4(a2, b3) { + if (a2 < b3) { + return -1; + } else if (a2 > b3) { + return 1; + } else { + return 0; + } + }, "ascending"); + descending2 = /* @__PURE__ */ __name(function descending3(a2, b3) { + return -1 * ascending3(a2, b3); + }, "descending"); + extend4 = Object.assign != null ? Object.assign.bind(Object) : function(tgt) { + var args = arguments; + for (var i2 = 1; i2 < args.length; i2++) { + var obj = args[i2]; + if (obj == null) { + continue; + } + var keys3 = Object.keys(obj); + for (var j3 = 0; j3 < keys3.length; j3++) { + var k2 = keys3[j3]; + tgt[k2] = obj[k2]; + } + } + return tgt; + }; + hex2tuple = /* @__PURE__ */ __name(function hex2tuple2(hex2) { + if (!(hex2.length === 4 || hex2.length === 7) || hex2[0] !== "#") { + return; + } + var shortHex = hex2.length === 4; + var r2, g2, b3; + var base = 16; + if (shortHex) { + r2 = parseInt(hex2[1] + hex2[1], base); + g2 = parseInt(hex2[2] + hex2[2], base); + b3 = parseInt(hex2[3] + hex2[3], base); + } else { + r2 = parseInt(hex2[1] + hex2[2], base); + g2 = parseInt(hex2[3] + hex2[4], base); + b3 = parseInt(hex2[5] + hex2[6], base); + } + return [r2, g2, b3]; + }, "hex2tuple"); + hsl2tuple = /* @__PURE__ */ __name(function hsl2tuple2(hsl2) { + var ret; + var h3, s2, l4, a2, r2, g2, b3; + function hue2rgb(p4, q4, t4) { + if (t4 < 0) t4 += 1; + if (t4 > 1) t4 -= 1; + if (t4 < 1 / 6) return p4 + (q4 - p4) * 6 * t4; + if (t4 < 1 / 2) return q4; + if (t4 < 2 / 3) return p4 + (q4 - p4) * (2 / 3 - t4) * 6; + return p4; + } + __name(hue2rgb, "hue2rgb"); + var m3 = new RegExp("^" + hsla2 + "$").exec(hsl2); + if (m3) { + h3 = parseInt(m3[1]); + if (h3 < 0) { + h3 = (360 - -1 * h3 % 360) % 360; + } else if (h3 > 360) { + h3 = h3 % 360; + } + h3 /= 360; + s2 = parseFloat(m3[2]); + if (s2 < 0 || s2 > 100) { + return; + } + s2 = s2 / 100; + l4 = parseFloat(m3[3]); + if (l4 < 0 || l4 > 100) { + return; + } + l4 = l4 / 100; + a2 = m3[4]; + if (a2 !== void 0) { + a2 = parseFloat(a2); + if (a2 < 0 || a2 > 1) { + return; + } + } + if (s2 === 0) { + r2 = g2 = b3 = Math.round(l4 * 255); + } else { + var q3 = l4 < 0.5 ? l4 * (1 + s2) : l4 + s2 - l4 * s2; + var p3 = 2 * l4 - q3; + r2 = Math.round(255 * hue2rgb(p3, q3, h3 + 1 / 3)); + g2 = Math.round(255 * hue2rgb(p3, q3, h3)); + b3 = Math.round(255 * hue2rgb(p3, q3, h3 - 1 / 3)); + } + ret = [r2, g2, b3, a2]; + } + return ret; + }, "hsl2tuple"); + rgb2tuple = /* @__PURE__ */ __name(function rgb2tuple2(rgb2) { + var ret; + var m3 = new RegExp("^" + rgba3 + "$").exec(rgb2); + if (m3) { + ret = []; + var isPct = []; + for (var i2 = 1; i2 <= 3; i2++) { + var channel2 = m3[i2]; + if (channel2[channel2.length - 1] === "%") { + isPct[i2] = true; + } + channel2 = parseFloat(channel2); + if (isPct[i2]) { + channel2 = channel2 / 100 * 255; + } + if (channel2 < 0 || channel2 > 255) { + return; + } + ret.push(Math.floor(channel2)); + } + var atLeastOneIsPct = isPct[1] || isPct[2] || isPct[3]; + var allArePct = isPct[1] && isPct[2] && isPct[3]; + if (atLeastOneIsPct && !allArePct) { + return; + } + var alpha = m3[4]; + if (alpha !== void 0) { + alpha = parseFloat(alpha); + if (alpha < 0 || alpha > 1) { + return; + } + ret.push(alpha); + } + } + return ret; + }, "rgb2tuple"); + colorname2tuple = /* @__PURE__ */ __name(function colorname2tuple2(color2) { + return colors[color2.toLowerCase()]; + }, "colorname2tuple"); + color2tuple = /* @__PURE__ */ __name(function color2tuple2(color2) { + return (array2(color2) ? color2 : null) || colorname2tuple(color2) || hex2tuple(color2) || rgb2tuple(color2) || hsl2tuple(color2); + }, "color2tuple"); + colors = { + // special colour names + transparent: [0, 0, 0, 0], + // NB alpha === 0 + // regular colours + aliceblue: [240, 248, 255], + antiquewhite: [250, 235, 215], + aqua: [0, 255, 255], + aquamarine: [127, 255, 212], + azure: [240, 255, 255], + beige: [245, 245, 220], + bisque: [255, 228, 196], + black: [0, 0, 0], + blanchedalmond: [255, 235, 205], + blue: [0, 0, 255], + blueviolet: [138, 43, 226], + brown: [165, 42, 42], + burlywood: [222, 184, 135], + cadetblue: [95, 158, 160], + chartreuse: [127, 255, 0], + chocolate: [210, 105, 30], + coral: [255, 127, 80], + cornflowerblue: [100, 149, 237], + cornsilk: [255, 248, 220], + crimson: [220, 20, 60], + cyan: [0, 255, 255], + darkblue: [0, 0, 139], + darkcyan: [0, 139, 139], + darkgoldenrod: [184, 134, 11], + darkgray: [169, 169, 169], + darkgreen: [0, 100, 0], + darkgrey: [169, 169, 169], + darkkhaki: [189, 183, 107], + darkmagenta: [139, 0, 139], + darkolivegreen: [85, 107, 47], + darkorange: [255, 140, 0], + darkorchid: [153, 50, 204], + darkred: [139, 0, 0], + darksalmon: [233, 150, 122], + darkseagreen: [143, 188, 143], + darkslateblue: [72, 61, 139], + darkslategray: [47, 79, 79], + darkslategrey: [47, 79, 79], + darkturquoise: [0, 206, 209], + darkviolet: [148, 0, 211], + deeppink: [255, 20, 147], + deepskyblue: [0, 191, 255], + dimgray: [105, 105, 105], + dimgrey: [105, 105, 105], + dodgerblue: [30, 144, 255], + firebrick: [178, 34, 34], + floralwhite: [255, 250, 240], + forestgreen: [34, 139, 34], + fuchsia: [255, 0, 255], + gainsboro: [220, 220, 220], + ghostwhite: [248, 248, 255], + gold: [255, 215, 0], + goldenrod: [218, 165, 32], + gray: [128, 128, 128], + grey: [128, 128, 128], + green: [0, 128, 0], + greenyellow: [173, 255, 47], + honeydew: [240, 255, 240], + hotpink: [255, 105, 180], + indianred: [205, 92, 92], + indigo: [75, 0, 130], + ivory: [255, 255, 240], + khaki: [240, 230, 140], + lavender: [230, 230, 250], + lavenderblush: [255, 240, 245], + lawngreen: [124, 252, 0], + lemonchiffon: [255, 250, 205], + lightblue: [173, 216, 230], + lightcoral: [240, 128, 128], + lightcyan: [224, 255, 255], + lightgoldenrodyellow: [250, 250, 210], + lightgray: [211, 211, 211], + lightgreen: [144, 238, 144], + lightgrey: [211, 211, 211], + lightpink: [255, 182, 193], + lightsalmon: [255, 160, 122], + lightseagreen: [32, 178, 170], + lightskyblue: [135, 206, 250], + lightslategray: [119, 136, 153], + lightslategrey: [119, 136, 153], + lightsteelblue: [176, 196, 222], + lightyellow: [255, 255, 224], + lime: [0, 255, 0], + limegreen: [50, 205, 50], + linen: [250, 240, 230], + magenta: [255, 0, 255], + maroon: [128, 0, 0], + mediumaquamarine: [102, 205, 170], + mediumblue: [0, 0, 205], + mediumorchid: [186, 85, 211], + mediumpurple: [147, 112, 219], + mediumseagreen: [60, 179, 113], + mediumslateblue: [123, 104, 238], + mediumspringgreen: [0, 250, 154], + mediumturquoise: [72, 209, 204], + mediumvioletred: [199, 21, 133], + midnightblue: [25, 25, 112], + mintcream: [245, 255, 250], + mistyrose: [255, 228, 225], + moccasin: [255, 228, 181], + navajowhite: [255, 222, 173], + navy: [0, 0, 128], + oldlace: [253, 245, 230], + olive: [128, 128, 0], + olivedrab: [107, 142, 35], + orange: [255, 165, 0], + orangered: [255, 69, 0], + orchid: [218, 112, 214], + palegoldenrod: [238, 232, 170], + palegreen: [152, 251, 152], + paleturquoise: [175, 238, 238], + palevioletred: [219, 112, 147], + papayawhip: [255, 239, 213], + peachpuff: [255, 218, 185], + peru: [205, 133, 63], + pink: [255, 192, 203], + plum: [221, 160, 221], + powderblue: [176, 224, 230], + purple: [128, 0, 128], + red: [255, 0, 0], + rosybrown: [188, 143, 143], + royalblue: [65, 105, 225], + saddlebrown: [139, 69, 19], + salmon: [250, 128, 114], + sandybrown: [244, 164, 96], + seagreen: [46, 139, 87], + seashell: [255, 245, 238], + sienna: [160, 82, 45], + silver: [192, 192, 192], + skyblue: [135, 206, 235], + slateblue: [106, 90, 205], + slategray: [112, 128, 144], + slategrey: [112, 128, 144], + snow: [255, 250, 250], + springgreen: [0, 255, 127], + steelblue: [70, 130, 180], + tan: [210, 180, 140], + teal: [0, 128, 128], + thistle: [216, 191, 216], + tomato: [255, 99, 71], + turquoise: [64, 224, 208], + violet: [238, 130, 238], + wheat: [245, 222, 179], + white: [255, 255, 255], + whitesmoke: [245, 245, 245], + yellow: [255, 255, 0], + yellowgreen: [154, 205, 50] + }; + setMap = /* @__PURE__ */ __name(function setMap2(options2) { + var obj = options2.map; + var keys3 = options2.keys; + var l4 = keys3.length; + for (var i2 = 0; i2 < l4; i2++) { + var key = keys3[i2]; + if (plainObject(key)) { + throw Error("Tried to set map with object key"); + } + if (i2 < keys3.length - 1) { + if (obj[key] == null) { + obj[key] = {}; + } + obj = obj[key]; + } else { + obj[key] = options2.value; + } + } + }, "setMap"); + getMap = /* @__PURE__ */ __name(function getMap2(options2) { + var obj = options2.map; + var keys3 = options2.keys; + var l4 = keys3.length; + for (var i2 = 0; i2 < l4; i2++) { + var key = keys3[i2]; + if (plainObject(key)) { + throw Error("Tried to get map with object key"); + } + obj = obj[key]; + if (obj == null) { + return obj; + } + } + return obj; + }, "getMap"); + commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; + __name(getDefaultExportFromCjs, "getDefaultExportFromCjs"); + __name(requireIsObject, "requireIsObject"); + __name(require_freeGlobal, "require_freeGlobal"); + __name(require_root, "require_root"); + __name(requireNow, "requireNow"); + __name(require_trimmedEndIndex, "require_trimmedEndIndex"); + __name(require_baseTrim, "require_baseTrim"); + __name(require_Symbol, "require_Symbol"); + __name(require_getRawTag, "require_getRawTag"); + __name(require_objectToString, "require_objectToString"); + __name(require_baseGetTag, "require_baseGetTag"); + __name(requireIsObjectLike, "requireIsObjectLike"); + __name(requireIsSymbol, "requireIsSymbol"); + __name(requireToNumber, "requireToNumber"); + __name(requireDebounce, "requireDebounce"); + debounceExports = requireDebounce(); + debounce = /* @__PURE__ */ getDefaultExportFromCjs(debounceExports); + performance$1 = _window ? _window.performance : null; + pnow = performance$1 && performance$1.now ? function() { + return performance$1.now(); + } : function() { + return Date.now(); + }; + raf = (function() { + if (_window) { + if (_window.requestAnimationFrame) { + return function(fn3) { + _window.requestAnimationFrame(fn3); + }; + } else if (_window.mozRequestAnimationFrame) { + return function(fn3) { + _window.mozRequestAnimationFrame(fn3); + }; + } else if (_window.webkitRequestAnimationFrame) { + return function(fn3) { + _window.webkitRequestAnimationFrame(fn3); + }; + } else if (_window.msRequestAnimationFrame) { + return function(fn3) { + _window.msRequestAnimationFrame(fn3); + }; + } + } + return function(fn3) { + if (fn3) { + setTimeout(function() { + fn3(pnow()); + }, 1e3 / 60); + } + }; + })(); + requestAnimationFrame2 = /* @__PURE__ */ __name(function requestAnimationFrame3(fn3) { + return raf(fn3); + }, "requestAnimationFrame"); + performanceNow = pnow; + DEFAULT_HASH_SEED = 9261; + K4 = 65599; + DEFAULT_HASH_SEED_ALT = 5381; + hashIterableInts = /* @__PURE__ */ __name(function hashIterableInts2(iterator) { + var seed = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_HASH_SEED; + var hash = seed; + var entry; + for (; ; ) { + entry = iterator.next(); + if (entry.done) { + break; + } + hash = hash * K4 + entry.value | 0; + } + return hash; + }, "hashIterableInts"); + hashInt = /* @__PURE__ */ __name(function hashInt2(num) { + var seed = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_HASH_SEED; + return seed * K4 + num | 0; + }, "hashInt"); + hashIntAlt = /* @__PURE__ */ __name(function hashIntAlt2(num) { + var seed = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DEFAULT_HASH_SEED_ALT; + return (seed << 5) + seed + num | 0; + }, "hashIntAlt"); + combineHashes = /* @__PURE__ */ __name(function combineHashes2(hash1, hash2) { + return hash1 * 2097152 + hash2; + }, "combineHashes"); + combineHashesArray = /* @__PURE__ */ __name(function combineHashesArray2(hashes) { + return hashes[0] * 2097152 + hashes[1]; + }, "combineHashesArray"); + hashArrays = /* @__PURE__ */ __name(function hashArrays2(hashes1, hashes2) { + return [hashInt(hashes1[0], hashes2[0]), hashIntAlt(hashes1[1], hashes2[1])]; + }, "hashArrays"); + hashIntsArray = /* @__PURE__ */ __name(function hashIntsArray2(ints, seed) { + var entry = { + value: 0, + done: false + }; + var i2 = 0; + var length2 = ints.length; + var iterator = { + next: /* @__PURE__ */ __name(function next3() { + if (i2 < length2) { + entry.value = ints[i2++]; + } else { + entry.done = true; + } + return entry; + }, "next") + }; + return hashIterableInts(iterator, seed); + }, "hashIntsArray"); + hashString = /* @__PURE__ */ __name(function hashString2(str2, seed) { + var entry = { + value: 0, + done: false + }; + var i2 = 0; + var length2 = str2.length; + var iterator = { + next: /* @__PURE__ */ __name(function next3() { + if (i2 < length2) { + entry.value = str2.charCodeAt(i2++); + } else { + entry.done = true; + } + return entry; + }, "next") + }; + return hashIterableInts(iterator, seed); + }, "hashString"); + hashStrings = /* @__PURE__ */ __name(function hashStrings2() { + return hashStringsArray(arguments); + }, "hashStrings"); + hashStringsArray = /* @__PURE__ */ __name(function hashStringsArray2(strs) { + var hash; + for (var i2 = 0; i2 < strs.length; i2++) { + var str2 = strs[i2]; + if (i2 === 0) { + hash = hashString(str2); + } else { + hash = hashString(str2, hash); + } + } + return hash; + }, "hashStringsArray"); + __name(rotatePoint, "rotatePoint"); + movePointByBoxAspect = /* @__PURE__ */ __name(function movePointByBoxAspect2(x5, y6, boxX, boxY, skewX, skewY) { + return { + x: (x5 - boxX) * skewX + boxX, + y: (y6 - boxY) * skewY + boxY + }; + }, "movePointByBoxAspect"); + __name(rotatePosAndSkewByBox, "rotatePosAndSkewByBox"); + warningsEnabled = true; + warnSupported = console.warn != null; + traceSupported = console.trace != null; + MAX_INT$1 = Number.MAX_SAFE_INTEGER || 9007199254740991; + trueify = /* @__PURE__ */ __name(function trueify2() { + return true; + }, "trueify"); + falsify = /* @__PURE__ */ __name(function falsify2() { + return false; + }, "falsify"); + zeroify = /* @__PURE__ */ __name(function zeroify2() { + return 0; + }, "zeroify"); + noop$1 = /* @__PURE__ */ __name(function noop4() { + }, "noop"); + error = /* @__PURE__ */ __name(function error2(msg) { + throw new Error(msg); + }, "error"); + warnings = /* @__PURE__ */ __name(function warnings2(enabled) { + if (enabled !== void 0) { + warningsEnabled = !!enabled; + } else { + return warningsEnabled; + } + }, "warnings"); + warn = /* @__PURE__ */ __name(function warn2(msg) { + if (!warnings()) { + return; + } + if (warnSupported) { + console.warn(msg); + } else { + console.log(msg); + if (traceSupported) { + console.trace(); + } + } + }, "warn"); + clone5 = /* @__PURE__ */ __name(function clone6(obj) { + return extend4({}, obj); + }, "clone"); + copy3 = /* @__PURE__ */ __name(function copy4(obj) { + if (obj == null) { + return obj; + } + if (array2(obj)) { + return obj.slice(); + } else if (plainObject(obj)) { + return clone5(obj); + } else { + return obj; + } + }, "copy"); + copyArray2 = /* @__PURE__ */ __name(function copyArray3(arr) { + return arr.slice(); + }, "copyArray"); + uuid = /* @__PURE__ */ __name(function uuid2(a2, b3) { + for ( + // loop :) + b3 = a2 = ""; + // b - result , a - numeric letiable + a2++ < 36; + // + b3 += a2 * 51 & 52 ? ( + // return a random number or 4 + (a2 ^ 15 ? ( + // generate a random number from 0 to 15 + 8 ^ Math.random() * (a2 ^ 20 ? 16 : 4) + ) : 4).toString(16) + ) : "-" + ) ; + return b3; + }, "uuid"); + _staticEmptyObject = {}; + staticEmptyObject = /* @__PURE__ */ __name(function staticEmptyObject2() { + return _staticEmptyObject; + }, "staticEmptyObject"); + defaults$g = /* @__PURE__ */ __name(function defaults2(_defaults) { + var keys3 = Object.keys(_defaults); + return function(opts) { + var filledOpts = {}; + for (var i2 = 0; i2 < keys3.length; i2++) { + var key = keys3[i2]; + var optVal = opts == null ? void 0 : opts[key]; + filledOpts[key] = optVal === void 0 ? _defaults[key] : optVal; + } + return filledOpts; + }; + }, "defaults"); + removeFromArray = /* @__PURE__ */ __name(function removeFromArray2(arr, ele, oneCopy) { + for (var i2 = arr.length - 1; i2 >= 0; i2--) { + if (arr[i2] === ele) { + arr.splice(i2, 1); + } + } + }, "removeFromArray"); + clearArray = /* @__PURE__ */ __name(function clearArray2(arr) { + arr.splice(0, arr.length); + }, "clearArray"); + push = /* @__PURE__ */ __name(function push2(arr, otherArr) { + for (var i2 = 0; i2 < otherArr.length; i2++) { + var el = otherArr[i2]; + arr.push(el); + } + }, "push"); + getPrefixedProperty = /* @__PURE__ */ __name(function getPrefixedProperty2(obj, propName, prefix) { + if (prefix) { + propName = prependCamel(prefix, propName); + } + return obj[propName]; + }, "getPrefixedProperty"); + setPrefixedProperty = /* @__PURE__ */ __name(function setPrefixedProperty2(obj, propName, prefix, value2) { + if (prefix) { + propName = prependCamel(prefix, propName); + } + obj[propName] = value2; + }, "setPrefixedProperty"); + ObjectMap = /* @__PURE__ */ (function() { + function ObjectMap2() { + _classCallCheck(this, ObjectMap2); + this._obj = {}; + } + __name(ObjectMap2, "ObjectMap"); + return _createClass(ObjectMap2, [{ + key: "set", + value: /* @__PURE__ */ __name(function set5(key, val) { + this._obj[key] = val; + return this; + }, "set") + }, { + key: "delete", + value: /* @__PURE__ */ __name(function _delete(key) { + this._obj[key] = void 0; + return this; + }, "_delete") + }, { + key: "clear", + value: /* @__PURE__ */ __name(function clear22() { + this._obj = {}; + }, "clear") + }, { + key: "has", + value: /* @__PURE__ */ __name(function has3(key) { + return this._obj[key] !== void 0; + }, "has") + }, { + key: "get", + value: /* @__PURE__ */ __name(function get6(key) { + return this._obj[key]; + }, "get") + }]); + })(); + Map$1 = typeof Map !== "undefined" ? Map : ObjectMap; + undef = "undefined"; + ObjectSet = /* @__PURE__ */ (function() { + function ObjectSet2(arrayOrObjectSet) { + _classCallCheck(this, ObjectSet2); + this._obj = /* @__PURE__ */ Object.create(null); + this.size = 0; + if (arrayOrObjectSet != null) { + var arr; + if (arrayOrObjectSet.instanceString != null && arrayOrObjectSet.instanceString() === this.instanceString()) { + arr = arrayOrObjectSet.toArray(); + } else { + arr = arrayOrObjectSet; + } + for (var i2 = 0; i2 < arr.length; i2++) { + this.add(arr[i2]); + } + } + } + __name(ObjectSet2, "ObjectSet"); + return _createClass(ObjectSet2, [{ + key: "instanceString", + value: /* @__PURE__ */ __name(function instanceString4() { + return "set"; + }, "instanceString") + }, { + key: "add", + value: /* @__PURE__ */ __name(function add3(val) { + var o2 = this._obj; + if (o2[val] !== 1) { + o2[val] = 1; + this.size++; + } + }, "add") + }, { + key: "delete", + value: /* @__PURE__ */ __name(function _delete(val) { + var o2 = this._obj; + if (o2[val] === 1) { + o2[val] = 0; + this.size--; + } + }, "_delete") + }, { + key: "clear", + value: /* @__PURE__ */ __name(function clear22() { + this._obj = /* @__PURE__ */ Object.create(null); + }, "clear") + }, { + key: "has", + value: /* @__PURE__ */ __name(function has3(val) { + return this._obj[val] === 1; + }, "has") + }, { + key: "toArray", + value: /* @__PURE__ */ __name(function toArray3() { + var _this = this; + return Object.keys(this._obj).filter(function(key) { + return _this.has(key); + }); + }, "toArray") + }, { + key: "forEach", + value: /* @__PURE__ */ __name(function forEach4(callback, thisArg) { + return this.toArray().forEach(callback, thisArg); + }, "forEach") + }]); + })(); + Set$1 = (typeof Set === "undefined" ? "undefined" : _typeof(Set)) !== undef ? Set : ObjectSet; + Element = /* @__PURE__ */ __name(function Element2(cy, params) { + var restore = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; + if (cy === void 0 || params === void 0 || !core2(cy)) { + error("An element must have a core reference and parameters set"); + return; + } + var group2 = params.group; + if (group2 == null) { + if (params.data && params.data.source != null && params.data.target != null) { + group2 = "edges"; + } else { + group2 = "nodes"; + } + } + if (group2 !== "nodes" && group2 !== "edges") { + error("An element must be of type `nodes` or `edges`; you specified `" + group2 + "`"); + return; + } + this.length = 1; + this[0] = this; + var _p = this._private = { + cy, + single: true, + // indicates this is an element + data: params.data || {}, + // data object + position: params.position || { + x: 0, + y: 0 + }, + // (x, y) position pair + autoWidth: void 0, + // width and height of nodes calculated by the renderer when set to special 'auto' value + autoHeight: void 0, + autoPadding: void 0, + compoundBoundsClean: false, + // whether the compound dimensions need to be recalculated the next time dimensions are read + listeners: [], + // array of bound listeners + group: group2, + // string; 'nodes' or 'edges' + style: {}, + // properties as set by the style + rstyle: {}, + // properties for style sent from the renderer to the core + styleCxts: [], + // applied style contexts from the styler + styleKeys: {}, + // per-group keys of style property values + removed: true, + // whether it's inside the vis; true if removed (set true here since we call restore) + selected: params.selected ? true : false, + // whether it's selected + selectable: params.selectable === void 0 ? true : params.selectable ? true : false, + // whether it's selectable + locked: params.locked ? true : false, + // whether the element is locked (cannot be moved) + grabbed: false, + // whether the element is grabbed by the mouse; renderer sets this privately + grabbable: params.grabbable === void 0 ? true : params.grabbable ? true : false, + // whether the element can be grabbed + pannable: params.pannable === void 0 ? group2 === "edges" ? true : false : params.pannable ? true : false, + // whether the element has passthrough panning enabled + active: false, + // whether the element is active from user interaction + classes: new Set$1(), + // map ( className => true ) + animation: { + // object for currently-running animations + current: [], + queue: [] + }, + rscratch: {}, + // object in which the renderer can store information + scratch: params.scratch || {}, + // scratch objects + edges: [], + // array of connected edges + children: [], + // array of children + parent: params.parent && params.parent.isNode() ? params.parent : null, + // parent ref + traversalCache: {}, + // cache of output of traversal functions + backgrounding: false, + // whether background images are loading + bbCache: null, + // cache of the current bounding box + bbCacheShift: { + x: 0, + y: 0 + }, + // shift applied to cached bb to be applied on next get + bodyBounds: null, + // bounds cache of element body, w/o overlay + overlayBounds: null, + // bounds cache of element body, including overlay + labelBounds: { + // bounds cache of labels + all: null, + source: null, + target: null, + main: null + }, + arrowBounds: { + // bounds cache of edge arrows + source: null, + target: null, + "mid-source": null, + "mid-target": null + } + }; + if (_p.position.x == null) { + _p.position.x = 0; + } + if (_p.position.y == null) { + _p.position.y = 0; + } + if (params.renderedPosition) { + var rpos = params.renderedPosition; + var pan2 = cy.pan(); + var zoom2 = cy.zoom(); + _p.position = { + x: (rpos.x - pan2.x) / zoom2, + y: (rpos.y - pan2.y) / zoom2 + }; + } + var classes3 = []; + if (array2(params.classes)) { + classes3 = params.classes; + } else if (string(params.classes)) { + classes3 = params.classes.split(/\s+/); + } + for (var i2 = 0, l4 = classes3.length; i2 < l4; i2++) { + var cls = classes3[i2]; + if (!cls || cls === "") { + continue; + } + _p.classes.add(cls); + } + this.createEmitter(); + if (restore === void 0 || restore) { + this.restore(); + } + var bypass = params.style || params.css; + if (bypass) { + warn("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."); + this.style(bypass); + } + }, "Element"); + defineSearch = /* @__PURE__ */ __name(function defineSearch2(params) { + params = { + bfs: params.bfs || !params.dfs, + dfs: params.dfs || !params.bfs + }; + return /* @__PURE__ */ __name(function searchFn(roots, fn3, directed) { + var options2; + if (plainObject(roots) && !elementOrCollection(roots)) { + options2 = roots; + roots = options2.roots || options2.root; + fn3 = options2.visit; + directed = options2.directed; + } + directed = arguments.length === 2 && !fn$6(fn3) ? fn3 : directed; + fn3 = fn$6(fn3) ? fn3 : function() { + }; + var cy = this._private.cy; + var v3 = roots = string(roots) ? this.filter(roots) : roots; + var Q3 = []; + var connectedNodes = []; + var connectedBy = {}; + var id2depth = {}; + var V3 = {}; + var j3 = 0; + var found; + var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges; + for (var i2 = 0; i2 < v3.length; i2++) { + var vi2 = v3[i2]; + var viId = vi2.id(); + if (vi2.isNode()) { + Q3.unshift(vi2); + if (params.bfs) { + V3[viId] = true; + connectedNodes.push(vi2); + } + id2depth[viId] = 0; + } + } + var _loop = /* @__PURE__ */ __name(function _loop2() { + var v5 = params.bfs ? Q3.shift() : Q3.pop(); + var vId = v5.id(); + if (params.dfs) { + if (V3[vId]) { + return 0; + } + V3[vId] = true; + connectedNodes.push(v5); + } + var depth = id2depth[vId]; + var prevEdge = connectedBy[vId]; + var src = prevEdge != null ? prevEdge.source() : null; + var tgt = prevEdge != null ? prevEdge.target() : null; + var prevNode = prevEdge == null ? void 0 : v5.same(src) ? tgt[0] : src[0]; + var ret; + ret = fn3(v5, prevEdge, prevNode, j3++, depth); + if (ret === true) { + found = v5; + return 1; + } + if (ret === false) { + return 1; + } + var vwEdges = v5.connectedEdges().filter(function(e4) { + return (!directed || e4.source().same(v5)) && edges3.has(e4); + }); + for (var _i2 = 0; _i2 < vwEdges.length; _i2++) { + var e3 = vwEdges[_i2]; + var w4 = e3.connectedNodes().filter(function(n2) { + return !n2.same(v5) && nodes5.has(n2); + }); + var wId = w4.id(); + if (w4.length !== 0 && !V3[wId]) { + w4 = w4[0]; + Q3.push(w4); + if (params.bfs) { + V3[wId] = true; + connectedNodes.push(w4); + } + connectedBy[wId] = e3; + id2depth[wId] = id2depth[vId] + 1; + } + } + }, "_loop"), _ret; + while (Q3.length !== 0) { + _ret = _loop(); + if (_ret === 0) continue; + if (_ret === 1) break; + } + var connectedEles = cy.collection(); + for (var _i = 0; _i < connectedNodes.length; _i++) { + var node2 = connectedNodes[_i]; + var edge = connectedBy[node2.id()]; + if (edge != null) { + connectedEles.push(edge); + } + connectedEles.push(node2); + } + return { + path: cy.collection(connectedEles), + found: cy.collection(found) + }; + }, "searchFn"); + }, "defineSearch"); + elesfn$v = { + breadthFirstSearch: defineSearch({ + bfs: true + }), + depthFirstSearch: defineSearch({ + dfs: true + }) + }; + elesfn$v.bfs = elesfn$v.breadthFirstSearch; + elesfn$v.dfs = elesfn$v.depthFirstSearch; + heap$2 = { exports: {} }; + heap$1 = heap$2.exports; + __name(requireHeap$1, "requireHeap$1"); + __name(requireHeap, "requireHeap"); + heapExports = requireHeap(); + Heap = /* @__PURE__ */ getDefaultExportFromCjs(heapExports); + dijkstraDefaults = defaults$g({ + root: null, + weight: /* @__PURE__ */ __name(function weight(edge) { + return 1; + }, "weight"), + directed: false + }); + elesfn$u = { + dijkstra: /* @__PURE__ */ __name(function dijkstra2(options2) { + if (!plainObject(options2)) { + var args = arguments; + options2 = { + root: args[0], + weight: args[1], + directed: args[2] + }; + } + var _dijkstraDefaults = dijkstraDefaults(options2), root4 = _dijkstraDefaults.root, weight8 = _dijkstraDefaults.weight, directed = _dijkstraDefaults.directed; + var eles = this; + var weightFn = weight8; + var source = string(root4) ? this.filter(root4)[0] : root4[0]; + var dist3 = {}; + var prev2 = {}; + var knownDist = {}; + var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges; + edges3.unmergeBy(function(ele) { + return ele.isLoop(); + }); + var getDist3 = /* @__PURE__ */ __name(function getDist4(node3) { + return dist3[node3.id()]; + }, "getDist"); + var setDist = /* @__PURE__ */ __name(function setDist2(node3, d3) { + dist3[node3.id()] = d3; + Q3.updateItem(node3); + }, "setDist"); + var Q3 = new Heap(function(a2, b3) { + return getDist3(a2) - getDist3(b3); + }); + for (var i2 = 0; i2 < nodes5.length; i2++) { + var node2 = nodes5[i2]; + dist3[node2.id()] = node2.same(source) ? 0 : Infinity; + Q3.push(node2); + } + var distBetween = /* @__PURE__ */ __name(function distBetween2(u3, v5) { + var uvs = (directed ? u3.edgesTo(v5) : u3.edgesWith(v5)).intersect(edges3); + var smallestDistance = Infinity; + var smallestEdge; + for (var _i = 0; _i < uvs.length; _i++) { + var edge = uvs[_i]; + var _weight = weightFn(edge); + if (_weight < smallestDistance || !smallestEdge) { + smallestDistance = _weight; + smallestEdge = edge; + } + } + return { + edge: smallestEdge, + dist: smallestDistance + }; + }, "distBetween"); + while (Q3.size() > 0) { + var u2 = Q3.pop(); + var smalletsDist = getDist3(u2); + var uid = u2.id(); + knownDist[uid] = smalletsDist; + if (smalletsDist === Infinity) { + continue; + } + var neighbors = u2.neighborhood().intersect(nodes5); + for (var _i2 = 0; _i2 < neighbors.length; _i2++) { + var v3 = neighbors[_i2]; + var vid = v3.id(); + var vDist = distBetween(u2, v3); + var alt = smalletsDist + vDist.dist; + if (alt < getDist3(v3)) { + setDist(v3, alt); + prev2[vid] = { + node: u2, + edge: vDist.edge + }; + } + } + } + return { + distanceTo: /* @__PURE__ */ __name(function distanceTo(node3) { + var target = string(node3) ? nodes5.filter(node3)[0] : node3[0]; + return knownDist[target.id()]; + }, "distanceTo"), + pathTo: /* @__PURE__ */ __name(function pathTo(node3) { + var target = string(node3) ? nodes5.filter(node3)[0] : node3[0]; + var S4 = []; + var u3 = target; + var uid2 = u3.id(); + if (target.length > 0) { + S4.unshift(target); + while (prev2[uid2]) { + var p3 = prev2[uid2]; + S4.unshift(p3.edge); + S4.unshift(p3.node); + u3 = p3.node; + uid2 = u3.id(); + } + } + return eles.spawn(S4); + }, "pathTo") + }; + }, "dijkstra") + }; + elesfn$t = { + // kruskal's algorithm (finds min spanning tree, assuming undirected graph) + // implemented from pseudocode from wikipedia + kruskal: /* @__PURE__ */ __name(function kruskal(weightFn) { + weightFn = weightFn || function(edge2) { + return 1; + }; + var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges; + var numNodes = nodes5.length; + var forest = new Array(numNodes); + var A2 = nodes5; + var findSetIndex = /* @__PURE__ */ __name(function findSetIndex2(ele) { + for (var i3 = 0; i3 < forest.length; i3++) { + var eles = forest[i3]; + if (eles.has(ele)) { + return i3; + } + } + }, "findSetIndex"); + for (var i2 = 0; i2 < numNodes; i2++) { + forest[i2] = this.spawn(nodes5[i2]); + } + var S4 = edges3.sort(function(a2, b3) { + return weightFn(a2) - weightFn(b3); + }); + for (var _i = 0; _i < S4.length; _i++) { + var edge = S4[_i]; + var u2 = edge.source()[0]; + var v3 = edge.target()[0]; + var setUIndex = findSetIndex(u2); + var setVIndex = findSetIndex(v3); + var setU = forest[setUIndex]; + var setV = forest[setVIndex]; + if (setUIndex !== setVIndex) { + A2.merge(edge); + setU.merge(setV); + forest.splice(setVIndex, 1); + } + } + return A2; + }, "kruskal") + }; + aStarDefaults = defaults$g({ + root: null, + goal: null, + weight: /* @__PURE__ */ __name(function weight2(edge) { + return 1; + }, "weight"), + heuristic: /* @__PURE__ */ __name(function heuristic(edge) { + return 0; + }, "heuristic"), + directed: false + }); + elesfn$s = { + // Implemented from pseudocode from wikipedia + aStar: /* @__PURE__ */ __name(function aStar(options2) { + var cy = this.cy(); + var _aStarDefaults = aStarDefaults(options2), root4 = _aStarDefaults.root, goal = _aStarDefaults.goal, heuristic2 = _aStarDefaults.heuristic, directed = _aStarDefaults.directed, weight8 = _aStarDefaults.weight; + root4 = cy.collection(root4)[0]; + goal = cy.collection(goal)[0]; + var sid = root4.id(); + var tid = goal.id(); + var gScore = {}; + var fScore = {}; + var closedSetIds = {}; + var openSet = new Heap(function(a2, b3) { + return fScore[a2.id()] - fScore[b3.id()]; + }); + var openSetIds = new Set$1(); + var cameFrom = {}; + var cameFromEdge = {}; + var addToOpenSet = /* @__PURE__ */ __name(function addToOpenSet2(ele, id35) { + openSet.push(ele); + openSetIds.add(id35); + }, "addToOpenSet"); + var cMin, cMinId; + var popFromOpenSet = /* @__PURE__ */ __name(function popFromOpenSet2() { + cMin = openSet.pop(); + cMinId = cMin.id(); + openSetIds["delete"](cMinId); + }, "popFromOpenSet"); + var isInOpenSet = /* @__PURE__ */ __name(function isInOpenSet2(id35) { + return openSetIds.has(id35); + }, "isInOpenSet"); + addToOpenSet(root4, sid); + gScore[sid] = 0; + fScore[sid] = heuristic2(root4); + var steps = 0; + while (openSet.size() > 0) { + popFromOpenSet(); + steps++; + if (cMinId === tid) { + var path4 = []; + var pathNode = goal; + var pathNodeId = tid; + var pathEdge = cameFromEdge[pathNodeId]; + for (; ; ) { + path4.unshift(pathNode); + if (pathEdge != null) { + path4.unshift(pathEdge); + } + pathNode = cameFrom[pathNodeId]; + if (pathNode == null) { + break; + } + pathNodeId = pathNode.id(); + pathEdge = cameFromEdge[pathNodeId]; + } + return { + found: true, + distance: gScore[cMinId], + path: this.spawn(path4), + steps + }; + } + closedSetIds[cMinId] = true; + var vwEdges = cMin._private.edges; + for (var i2 = 0; i2 < vwEdges.length; i2++) { + var e3 = vwEdges[i2]; + if (!this.hasElementWithId(e3.id())) { + continue; + } + if (directed && e3.data("source") !== cMinId) { + continue; + } + var wSrc = e3.source(); + var wTgt = e3.target(); + var w4 = wSrc.id() !== cMinId ? wSrc : wTgt; + var wid = w4.id(); + if (!this.hasElementWithId(wid)) { + continue; + } + if (closedSetIds[wid]) { + continue; + } + var tempScore = gScore[cMinId] + weight8(e3); + if (!isInOpenSet(wid)) { + gScore[wid] = tempScore; + fScore[wid] = tempScore + heuristic2(w4); + addToOpenSet(w4, wid); + cameFrom[wid] = cMin; + cameFromEdge[wid] = e3; + continue; + } + if (tempScore < gScore[wid]) { + gScore[wid] = tempScore; + fScore[wid] = tempScore + heuristic2(w4); + cameFrom[wid] = cMin; + cameFromEdge[wid] = e3; + } + } + } + return { + found: false, + distance: void 0, + path: void 0, + steps + }; + }, "aStar") + }; + floydWarshallDefaults = defaults$g({ + weight: /* @__PURE__ */ __name(function weight3(edge) { + return 1; + }, "weight"), + directed: false + }); + elesfn$r = { + // Implemented from pseudocode from wikipedia + floydWarshall: /* @__PURE__ */ __name(function floydWarshall2(options2) { + var cy = this.cy(); + var _floydWarshallDefault = floydWarshallDefaults(options2), weight8 = _floydWarshallDefault.weight, directed = _floydWarshallDefault.directed; + var weightFn = weight8; + var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges; + var N3 = nodes5.length; + var Nsq = N3 * N3; + var indexOf2 = /* @__PURE__ */ __name(function indexOf3(node2) { + return nodes5.indexOf(node2); + }, "indexOf"); + var atIndex = /* @__PURE__ */ __name(function atIndex2(i3) { + return nodes5[i3]; + }, "atIndex"); + var dist3 = new Array(Nsq); + for (var n2 = 0; n2 < Nsq; n2++) { + var j3 = n2 % N3; + var i2 = (n2 - j3) / N3; + if (i2 === j3) { + dist3[n2] = 0; + } else { + dist3[n2] = Infinity; + } + } + var next3 = new Array(Nsq); + var edgeNext = new Array(Nsq); + for (var _i = 0; _i < edges3.length; _i++) { + var edge = edges3[_i]; + var src = edge.source()[0]; + var tgt = edge.target()[0]; + if (src === tgt) { + continue; + } + var s2 = indexOf2(src); + var t4 = indexOf2(tgt); + var st2 = s2 * N3 + t4; + var _weight = weightFn(edge); + if (dist3[st2] > _weight) { + dist3[st2] = _weight; + next3[st2] = t4; + edgeNext[st2] = edge; + } + if (!directed) { + var ts = t4 * N3 + s2; + if (!directed && dist3[ts] > _weight) { + dist3[ts] = _weight; + next3[ts] = s2; + edgeNext[ts] = edge; + } + } + } + for (var k2 = 0; k2 < N3; k2++) { + for (var _i2 = 0; _i2 < N3; _i2++) { + var ik = _i2 * N3 + k2; + for (var _j = 0; _j < N3; _j++) { + var ij = _i2 * N3 + _j; + var kj = k2 * N3 + _j; + if (dist3[ik] + dist3[kj] < dist3[ij]) { + dist3[ij] = dist3[ik] + dist3[kj]; + next3[ij] = next3[ik]; + } + } + } + } + var getArgEle = /* @__PURE__ */ __name(function getArgEle2(ele) { + return (string(ele) ? cy.filter(ele) : ele)[0]; + }, "getArgEle"); + var indexOfArgEle = /* @__PURE__ */ __name(function indexOfArgEle2(ele) { + return indexOf2(getArgEle(ele)); + }, "indexOfArgEle"); + var res = { + distance: /* @__PURE__ */ __name(function distance3(from2, to) { + var i3 = indexOfArgEle(from2); + var j4 = indexOfArgEle(to); + return dist3[i3 * N3 + j4]; + }, "distance"), + path: /* @__PURE__ */ __name(function path4(from2, to) { + var i3 = indexOfArgEle(from2); + var j4 = indexOfArgEle(to); + var fromNode = atIndex(i3); + if (i3 === j4) { + return fromNode.collection(); + } + if (next3[i3 * N3 + j4] == null) { + return cy.collection(); + } + var path5 = cy.collection(); + var prev2 = i3; + var edge2; + path5.merge(fromNode); + while (i3 !== j4) { + prev2 = i3; + i3 = next3[i3 * N3 + j4]; + edge2 = edgeNext[prev2 * N3 + i3]; + path5.merge(edge2); + path5.merge(atIndex(i3)); + } + return path5; + }, "path") + }; + return res; + }, "floydWarshall") + // floydWarshall + }; + bellmanFordDefaults = defaults$g({ + weight: /* @__PURE__ */ __name(function weight4(edge) { + return 1; + }, "weight"), + directed: false, + root: null + }); + elesfn$q = { + // Implemented from pseudocode from wikipedia + bellmanFord: /* @__PURE__ */ __name(function bellmanFord(options2) { + var _this = this; + var _bellmanFordDefaults = bellmanFordDefaults(options2), weight8 = _bellmanFordDefaults.weight, directed = _bellmanFordDefaults.directed, root4 = _bellmanFordDefaults.root; + var weightFn = weight8; + var eles = this; + var cy = this.cy(); + var _this$byGroup = this.byGroup(), edges3 = _this$byGroup.edges, nodes5 = _this$byGroup.nodes; + var numNodes = nodes5.length; + var infoMap = new Map$1(); + var hasNegativeWeightCycle = false; + var negativeWeightCycles = []; + root4 = cy.collection(root4)[0]; + edges3.unmergeBy(function(edge2) { + return edge2.isLoop(); + }); + var numEdges = edges3.length; + var getInfo3 = /* @__PURE__ */ __name(function getInfo4(node3) { + var obj = infoMap.get(node3.id()); + if (!obj) { + obj = {}; + infoMap.set(node3.id(), obj); + } + return obj; + }, "getInfo"); + var getNodeFromTo = /* @__PURE__ */ __name(function getNodeFromTo2(to) { + return (string(to) ? cy.$(to) : to)[0]; + }, "getNodeFromTo"); + var distanceTo = /* @__PURE__ */ __name(function distanceTo2(to) { + return getInfo3(getNodeFromTo(to)).dist; + }, "distanceTo"); + var pathTo = /* @__PURE__ */ __name(function pathTo2(to) { + var thisStart = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : root4; + var end2 = getNodeFromTo(to); + var path4 = []; + var node3 = end2; + for (; ; ) { + if (node3 == null) { + return _this.spawn(); + } + var _getInfo = getInfo3(node3), edge2 = _getInfo.edge, pred = _getInfo.pred; + path4.unshift(node3[0]); + if (node3.same(thisStart) && path4.length > 0) { + break; + } + if (edge2 != null) { + path4.unshift(edge2); + } + node3 = pred; + } + return eles.spawn(path4); + }, "pathTo"); + for (var i2 = 0; i2 < numNodes; i2++) { + var node2 = nodes5[i2]; + var info2 = getInfo3(node2); + if (node2.same(root4)) { + info2.dist = 0; + } else { + info2.dist = Infinity; + } + info2.pred = null; + info2.edge = null; + } + var replacedEdge = false; + var checkForEdgeReplacement = /* @__PURE__ */ __name(function checkForEdgeReplacement2(node1, node22, edge2, info1, info22, weight9) { + var dist3 = info1.dist + weight9; + if (dist3 < info22.dist && !edge2.same(info1.edge)) { + info22.dist = dist3; + info22.pred = node1; + info22.edge = edge2; + replacedEdge = true; + } + }, "checkForEdgeReplacement"); + for (var _i = 1; _i < numNodes; _i++) { + replacedEdge = false; + for (var e3 = 0; e3 < numEdges; e3++) { + var edge = edges3[e3]; + var src = edge.source(); + var tgt = edge.target(); + var _weight = weightFn(edge); + var srcInfo = getInfo3(src); + var tgtInfo = getInfo3(tgt); + checkForEdgeReplacement(src, tgt, edge, srcInfo, tgtInfo, _weight); + if (!directed) { + checkForEdgeReplacement(tgt, src, edge, tgtInfo, srcInfo, _weight); + } + } + if (!replacedEdge) { + break; + } + } + if (replacedEdge) { + var negativeWeightCycleIds = []; + for (var _e2 = 0; _e2 < numEdges; _e2++) { + var _edge = edges3[_e2]; + var _src = _edge.source(); + var _tgt = _edge.target(); + var _weight2 = weightFn(_edge); + var srcDist = getInfo3(_src).dist; + var tgtDist = getInfo3(_tgt).dist; + if (srcDist + _weight2 < tgtDist || !directed && tgtDist + _weight2 < srcDist) { + if (!hasNegativeWeightCycle) { + warn("Graph contains a negative weight cycle for Bellman-Ford"); + hasNegativeWeightCycle = true; + } + if (options2.findNegativeWeightCycles !== false) { + var negativeNodes = []; + if (srcDist + _weight2 < tgtDist) { + negativeNodes.push(_src); + } + if (!directed && tgtDist + _weight2 < srcDist) { + negativeNodes.push(_tgt); + } + var numNegativeNodes = negativeNodes.length; + for (var n2 = 0; n2 < numNegativeNodes; n2++) { + var start3 = negativeNodes[n2]; + var cycle = [start3]; + cycle.push(getInfo3(start3).edge); + var _node = getInfo3(start3).pred; + while (cycle.indexOf(_node) === -1) { + cycle.push(_node); + cycle.push(getInfo3(_node).edge); + _node = getInfo3(_node).pred; + } + cycle = cycle.slice(cycle.indexOf(_node)); + var smallestId = cycle[0].id(); + var smallestIndex = 0; + for (var c3 = 2; c3 < cycle.length; c3 += 2) { + if (cycle[c3].id() < smallestId) { + smallestId = cycle[c3].id(); + smallestIndex = c3; + } + } + cycle = cycle.slice(smallestIndex).concat(cycle.slice(0, smallestIndex)); + cycle.push(cycle[0]); + var cycleId = cycle.map(function(el) { + return el.id(); + }).join(","); + if (negativeWeightCycleIds.indexOf(cycleId) === -1) { + negativeWeightCycles.push(eles.spawn(cycle)); + negativeWeightCycleIds.push(cycleId); + } + } + } else { + break; + } + } + } + } + return { + distanceTo, + pathTo, + hasNegativeWeightCycle, + negativeWeightCycles + }; + }, "bellmanFord") + // bellmanFord + }; + sqrt2 = Math.sqrt(2); + collapse = /* @__PURE__ */ __name(function collapse2(edgeIndex, nodeMap, remainingEdges) { + if (remainingEdges.length === 0) { + error("Karger-Stein must be run on a connected (sub)graph"); + } + var edgeInfo = remainingEdges[edgeIndex]; + var sourceIn = edgeInfo[1]; + var targetIn = edgeInfo[2]; + var partition1 = nodeMap[sourceIn]; + var partition2 = nodeMap[targetIn]; + var newEdges = remainingEdges; + for (var i2 = newEdges.length - 1; i2 >= 0; i2--) { + var edge = newEdges[i2]; + var src = edge[1]; + var tgt = edge[2]; + if (nodeMap[src] === partition1 && nodeMap[tgt] === partition2 || nodeMap[src] === partition2 && nodeMap[tgt] === partition1) { + newEdges.splice(i2, 1); + } + } + for (var _i = 0; _i < newEdges.length; _i++) { + var _edge = newEdges[_i]; + if (_edge[1] === partition2) { + newEdges[_i] = _edge.slice(); + newEdges[_i][1] = partition1; + } else if (_edge[2] === partition2) { + newEdges[_i] = _edge.slice(); + newEdges[_i][2] = partition1; + } + } + for (var _i2 = 0; _i2 < nodeMap.length; _i2++) { + if (nodeMap[_i2] === partition2) { + nodeMap[_i2] = partition1; + } + } + return newEdges; + }, "collapse"); + contractUntil = /* @__PURE__ */ __name(function contractUntil2(metaNodeMap, remainingEdges, size4, sizeLimit) { + while (size4 > sizeLimit) { + var edgeIndex = Math.floor(Math.random() * remainingEdges.length); + remainingEdges = collapse(edgeIndex, metaNodeMap, remainingEdges); + size4--; + } + return remainingEdges; + }, "contractUntil"); + elesfn$p = { + // Computes the minimum cut of an undirected graph + // Returns the correct answer with high probability + kargerStein: /* @__PURE__ */ __name(function kargerStein() { + var _this = this; + var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges; + edges3.unmergeBy(function(edge) { + return edge.isLoop(); + }); + var numNodes = nodes5.length; + var numEdges = edges3.length; + var numIter = Math.ceil(Math.pow(Math.log(numNodes) / Math.LN2, 2)); + var stopSize = Math.floor(numNodes / sqrt2); + if (numNodes < 2) { + error("At least 2 nodes are required for Karger-Stein algorithm"); + return void 0; + } + var edgeIndexes = []; + for (var i2 = 0; i2 < numEdges; i2++) { + var e3 = edges3[i2]; + edgeIndexes.push([i2, nodes5.indexOf(e3.source()), nodes5.indexOf(e3.target())]); + } + var minCutSize = Infinity; + var minCutEdgeIndexes = []; + var minCutNodeMap = new Array(numNodes); + var metaNodeMap = new Array(numNodes); + var metaNodeMap2 = new Array(numNodes); + var copyNodesMap = /* @__PURE__ */ __name(function copyNodesMap2(from2, to) { + for (var _i3 = 0; _i3 < numNodes; _i3++) { + to[_i3] = from2[_i3]; + } + }, "copyNodesMap"); + for (var iter = 0; iter <= numIter; iter++) { + for (var _i4 = 0; _i4 < numNodes; _i4++) { + metaNodeMap[_i4] = _i4; + } + var edgesState = contractUntil(metaNodeMap, edgeIndexes.slice(), numNodes, stopSize); + var edgesState2 = edgesState.slice(); + copyNodesMap(metaNodeMap, metaNodeMap2); + var res1 = contractUntil(metaNodeMap, edgesState, stopSize, 2); + var res2 = contractUntil(metaNodeMap2, edgesState2, stopSize, 2); + if (res1.length <= res2.length && res1.length < minCutSize) { + minCutSize = res1.length; + minCutEdgeIndexes = res1; + copyNodesMap(metaNodeMap, minCutNodeMap); + } else if (res2.length <= res1.length && res2.length < minCutSize) { + minCutSize = res2.length; + minCutEdgeIndexes = res2; + copyNodesMap(metaNodeMap2, minCutNodeMap); + } + } + var cut = this.spawn(minCutEdgeIndexes.map(function(e4) { + return edges3[e4[0]]; + })); + var partition1 = this.spawn(); + var partition2 = this.spawn(); + var witnessNodePartition = minCutNodeMap[0]; + for (var _i5 = 0; _i5 < minCutNodeMap.length; _i5++) { + var partitionId = minCutNodeMap[_i5]; + var node2 = nodes5[_i5]; + if (partitionId === witnessNodePartition) { + partition1.merge(node2); + } else { + partition2.merge(node2); + } + } + var constructComponent = /* @__PURE__ */ __name(function constructComponent2(subset) { + var component2 = _this.spawn(); + subset.forEach(function(node3) { + component2.merge(node3); + node3.connectedEdges().forEach(function(edge) { + if (_this.contains(edge) && !cut.contains(edge)) { + component2.merge(edge); + } + }); + }); + return component2; + }, "constructComponent"); + var components3 = [constructComponent(partition1), constructComponent(partition2)]; + var ret = { + cut, + components: components3, + // n.b. partitions are included to be compatible with the old api spec + // (could be removed in a future major version) + partition1, + partition2 + }; + return ret; + }, "kargerStein") + }; + copyPosition = /* @__PURE__ */ __name(function copyPosition2(p3) { + return { + x: p3.x, + y: p3.y + }; + }, "copyPosition"); + modelToRenderedPosition$1 = /* @__PURE__ */ __name(function modelToRenderedPosition(p3, zoom2, pan2) { + return { + x: p3.x * zoom2 + pan2.x, + y: p3.y * zoom2 + pan2.y + }; + }, "modelToRenderedPosition"); + renderedToModelPosition = /* @__PURE__ */ __name(function renderedToModelPosition2(p3, zoom2, pan2) { + return { + x: (p3.x - pan2.x) / zoom2, + y: (p3.y - pan2.y) / zoom2 + }; + }, "renderedToModelPosition"); + array2point = /* @__PURE__ */ __name(function array2point2(arr) { + return { + x: arr[0], + y: arr[1] + }; + }, "array2point"); + min5 = /* @__PURE__ */ __name(function min6(arr) { + var begin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + var end2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : arr.length; + var min10 = Infinity; + for (var i2 = begin; i2 < end2; i2++) { + var val = arr[i2]; + if (isFinite(val)) { + min10 = Math.min(val, min10); + } + } + return min10; + }, "min"); + max5 = /* @__PURE__ */ __name(function max6(arr) { + var begin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + var end2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : arr.length; + var max10 = -Infinity; + for (var i2 = begin; i2 < end2; i2++) { + var val = arr[i2]; + if (isFinite(val)) { + max10 = Math.max(val, max10); + } + } + return max10; + }, "max"); + mean = /* @__PURE__ */ __name(function mean2(arr) { + var begin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + var end2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : arr.length; + var total = 0; + var n2 = 0; + for (var i2 = begin; i2 < end2; i2++) { + var val = arr[i2]; + if (isFinite(val)) { + total += val; + n2++; + } + } + return total / n2; + }, "mean"); + median = /* @__PURE__ */ __name(function median2(arr) { + var begin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + var end2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : arr.length; + var copy5 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true; + var sort3 = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true; + var includeHoles = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true; + if (copy5) { + arr = arr.slice(begin, end2); + } else { + if (end2 < arr.length) { + arr.splice(end2, arr.length - end2); + } + if (begin > 0) { + arr.splice(0, begin); + } + } + var off = 0; + for (var i2 = arr.length - 1; i2 >= 0; i2--) { + var v3 = arr[i2]; + if (includeHoles) { + if (!isFinite(v3)) { + arr[i2] = -Infinity; + off++; + } + } else { + arr.splice(i2, 1); + } + } + if (sort3) { + arr.sort(function(a2, b3) { + return a2 - b3; + }); + } + var len = arr.length; + var mid = Math.floor(len / 2); + if (len % 2 !== 0) { + return arr[mid + 1 + off]; + } else { + return (arr[mid - 1 + off] + arr[mid + off]) / 2; + } + }, "median"); + deg2rad = /* @__PURE__ */ __name(function deg2rad2(deg) { + return Math.PI * deg / 180; + }, "deg2rad"); + getAngleFromDisp = /* @__PURE__ */ __name(function getAngleFromDisp2(dispX, dispY) { + return Math.atan2(dispY, dispX) - Math.PI / 2; + }, "getAngleFromDisp"); + log22 = Math.log2 || function(n2) { + return Math.log(n2) / Math.log(2); + }; + signum = /* @__PURE__ */ __name(function signum2(x5) { + if (x5 > 0) { + return 1; + } else if (x5 < 0) { + return -1; + } else { + return 0; + } + }, "signum"); + dist = /* @__PURE__ */ __name(function dist2(p1, p22) { + return Math.sqrt(sqdist(p1, p22)); + }, "dist"); + sqdist = /* @__PURE__ */ __name(function sqdist2(p1, p22) { + var dx = p22.x - p1.x; + var dy = p22.y - p1.y; + return dx * dx + dy * dy; + }, "sqdist"); + inPlaceSumNormalize = /* @__PURE__ */ __name(function inPlaceSumNormalize2(v3) { + var length2 = v3.length; + var total = 0; + for (var i2 = 0; i2 < length2; i2++) { + total += v3[i2]; + } + for (var _i = 0; _i < length2; _i++) { + v3[_i] = v3[_i] / total; + } + return v3; + }, "inPlaceSumNormalize"); + qbezierAt = /* @__PURE__ */ __name(function qbezierAt2(p0, p1, p22, t4) { + return (1 - t4) * (1 - t4) * p0 + 2 * (1 - t4) * t4 * p1 + t4 * t4 * p22; + }, "qbezierAt"); + qbezierPtAt = /* @__PURE__ */ __name(function qbezierPtAt2(p0, p1, p22, t4) { + return { + x: qbezierAt(p0.x, p1.x, p22.x, t4), + y: qbezierAt(p0.y, p1.y, p22.y, t4) + }; + }, "qbezierPtAt"); + lineAt = /* @__PURE__ */ __name(function lineAt2(p0, p1, t4, d3) { + var vec = { + x: p1.x - p0.x, + y: p1.y - p0.y + }; + var vecDist = dist(p0, p1); + var normVec = { + x: vec.x / vecDist, + y: vec.y / vecDist + }; + t4 = t4 == null ? 0 : t4; + d3 = d3 != null ? d3 : t4 * vecDist; + return { + x: p0.x + normVec.x * d3, + y: p0.y + normVec.y * d3 + }; + }, "lineAt"); + bound = /* @__PURE__ */ __name(function bound2(min10, val, max10) { + return Math.max(min10, Math.min(max10, val)); + }, "bound"); + makeBoundingBox = /* @__PURE__ */ __name(function makeBoundingBox2(bb) { + if (bb == null) { + return { + x1: Infinity, + y1: Infinity, + x2: -Infinity, + y2: -Infinity, + w: 0, + h: 0 + }; + } else if (bb.x1 != null && bb.y1 != null) { + if (bb.x2 != null && bb.y2 != null && bb.x2 >= bb.x1 && bb.y2 >= bb.y1) { + return { + x1: bb.x1, + y1: bb.y1, + x2: bb.x2, + y2: bb.y2, + w: bb.x2 - bb.x1, + h: bb.y2 - bb.y1 + }; + } else if (bb.w != null && bb.h != null && bb.w >= 0 && bb.h >= 0) { + return { + x1: bb.x1, + y1: bb.y1, + x2: bb.x1 + bb.w, + y2: bb.y1 + bb.h, + w: bb.w, + h: bb.h + }; + } + } + }, "makeBoundingBox"); + copyBoundingBox = /* @__PURE__ */ __name(function copyBoundingBox2(bb) { + return { + x1: bb.x1, + x2: bb.x2, + w: bb.w, + y1: bb.y1, + y2: bb.y2, + h: bb.h + }; + }, "copyBoundingBox"); + clearBoundingBox = /* @__PURE__ */ __name(function clearBoundingBox2(bb) { + bb.x1 = Infinity; + bb.y1 = Infinity; + bb.x2 = -Infinity; + bb.y2 = -Infinity; + bb.w = 0; + bb.h = 0; + }, "clearBoundingBox"); + updateBoundingBox = /* @__PURE__ */ __name(function updateBoundingBox2(bb1, bb2) { + bb1.x1 = Math.min(bb1.x1, bb2.x1); + bb1.x2 = Math.max(bb1.x2, bb2.x2); + bb1.w = bb1.x2 - bb1.x1; + bb1.y1 = Math.min(bb1.y1, bb2.y1); + bb1.y2 = Math.max(bb1.y2, bb2.y2); + bb1.h = bb1.y2 - bb1.y1; + }, "updateBoundingBox"); + expandBoundingBoxByPoint = /* @__PURE__ */ __name(function expandBoundingBoxByPoint2(bb, x5, y6) { + bb.x1 = Math.min(bb.x1, x5); + bb.x2 = Math.max(bb.x2, x5); + bb.w = bb.x2 - bb.x1; + bb.y1 = Math.min(bb.y1, y6); + bb.y2 = Math.max(bb.y2, y6); + bb.h = bb.y2 - bb.y1; + }, "expandBoundingBoxByPoint"); + expandBoundingBox = /* @__PURE__ */ __name(function expandBoundingBox2(bb) { + var padding2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + bb.x1 -= padding2; + bb.x2 += padding2; + bb.y1 -= padding2; + bb.y2 += padding2; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + return bb; + }, "expandBoundingBox"); + expandBoundingBoxSides = /* @__PURE__ */ __name(function expandBoundingBoxSides2(bb) { + var padding2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0]; + var top2, right3, bottom2, left3; + if (padding2.length === 1) { + top2 = right3 = bottom2 = left3 = padding2[0]; + } else if (padding2.length === 2) { + top2 = bottom2 = padding2[0]; + left3 = right3 = padding2[1]; + } else if (padding2.length === 4) { + var _padding = _slicedToArray(padding2, 4); + top2 = _padding[0]; + right3 = _padding[1]; + bottom2 = _padding[2]; + left3 = _padding[3]; + } + bb.x1 -= left3; + bb.x2 += right3; + bb.y1 -= top2; + bb.y2 += bottom2; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + return bb; + }, "expandBoundingBoxSides"); + assignBoundingBox = /* @__PURE__ */ __name(function assignBoundingBox2(bb1, bb2) { + bb1.x1 = bb2.x1; + bb1.y1 = bb2.y1; + bb1.x2 = bb2.x2; + bb1.y2 = bb2.y2; + bb1.w = bb1.x2 - bb1.x1; + bb1.h = bb1.y2 - bb1.y1; + }, "assignBoundingBox"); + boundingBoxesIntersect = /* @__PURE__ */ __name(function boundingBoxesIntersect2(bb1, bb2) { + if (bb1.x1 > bb2.x2) { + return false; + } + if (bb2.x1 > bb1.x2) { + return false; + } + if (bb1.x2 < bb2.x1) { + return false; + } + if (bb2.x2 < bb1.x1) { + return false; + } + if (bb1.y2 < bb2.y1) { + return false; + } + if (bb2.y2 < bb1.y1) { + return false; + } + if (bb1.y1 > bb2.y2) { + return false; + } + if (bb2.y1 > bb1.y2) { + return false; + } + return true; + }, "boundingBoxesIntersect"); + inBoundingBox = /* @__PURE__ */ __name(function inBoundingBox2(bb, x5, y6) { + return bb.x1 <= x5 && x5 <= bb.x2 && bb.y1 <= y6 && y6 <= bb.y2; + }, "inBoundingBox"); + pointInBoundingBox = /* @__PURE__ */ __name(function pointInBoundingBox2(bb, pt) { + return inBoundingBox(bb, pt.x, pt.y); + }, "pointInBoundingBox"); + boundingBoxInBoundingBox = /* @__PURE__ */ __name(function boundingBoxInBoundingBox2(bb1, bb2) { + return inBoundingBox(bb1, bb2.x1, bb2.y1) && inBoundingBox(bb1, bb2.x2, bb2.y2); + }, "boundingBoxInBoundingBox"); + hypot = (_Math$hypot = Math.hypot) !== null && _Math$hypot !== void 0 ? _Math$hypot : function(x5, y6) { + return Math.sqrt(x5 * x5 + y6 * y6); + }; + __name(inflatePolygon, "inflatePolygon"); + __name(miterBox, "miterBox"); + roundRectangleIntersectLine = /* @__PURE__ */ __name(function roundRectangleIntersectLine2(x5, y6, nodeX, nodeY, width3, height2, padding2) { + var radius2 = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : "auto"; + var cornerRadius = radius2 === "auto" ? getRoundRectangleRadius(width3, height2) : radius2; + var halfWidth = width3 / 2; + var halfHeight = height2 / 2; + cornerRadius = Math.min(cornerRadius, halfWidth, halfHeight); + var doWidth = cornerRadius !== halfWidth, doHeight = cornerRadius !== halfHeight; + var straightLineIntersections; + if (doWidth) { + var topStartX = nodeX - halfWidth + cornerRadius - padding2; + var topStartY = nodeY - halfHeight - padding2; + var topEndX = nodeX + halfWidth - cornerRadius + padding2; + var topEndY = topStartY; + straightLineIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, topStartX, topStartY, topEndX, topEndY, false); + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } + if (doHeight) { + var rightStartX = nodeX + halfWidth + padding2; + var rightStartY = nodeY - halfHeight + cornerRadius - padding2; + var rightEndX = rightStartX; + var rightEndY = nodeY + halfHeight - cornerRadius + padding2; + straightLineIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, rightStartX, rightStartY, rightEndX, rightEndY, false); + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } + if (doWidth) { + var bottomStartX = nodeX - halfWidth + cornerRadius - padding2; + var bottomStartY = nodeY + halfHeight + padding2; + var bottomEndX = nodeX + halfWidth - cornerRadius + padding2; + var bottomEndY = bottomStartY; + straightLineIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, bottomStartX, bottomStartY, bottomEndX, bottomEndY, false); + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } + if (doHeight) { + var leftStartX = nodeX - halfWidth - padding2; + var leftStartY = nodeY - halfHeight + cornerRadius - padding2; + var leftEndX = leftStartX; + var leftEndY = nodeY + halfHeight - cornerRadius + padding2; + straightLineIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, leftStartX, leftStartY, leftEndX, leftEndY, false); + if (straightLineIntersections.length > 0) { + return straightLineIntersections; + } + } + var arcIntersections; + { + var topLeftCenterX = nodeX - halfWidth + cornerRadius; + var topLeftCenterY = nodeY - halfHeight + cornerRadius; + arcIntersections = intersectLineCircle(x5, y6, nodeX, nodeY, topLeftCenterX, topLeftCenterY, cornerRadius + padding2); + if (arcIntersections.length > 0 && arcIntersections[0] <= topLeftCenterX && arcIntersections[1] <= topLeftCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } + { + var topRightCenterX = nodeX + halfWidth - cornerRadius; + var topRightCenterY = nodeY - halfHeight + cornerRadius; + arcIntersections = intersectLineCircle(x5, y6, nodeX, nodeY, topRightCenterX, topRightCenterY, cornerRadius + padding2); + if (arcIntersections.length > 0 && arcIntersections[0] >= topRightCenterX && arcIntersections[1] <= topRightCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } + { + var bottomRightCenterX = nodeX + halfWidth - cornerRadius; + var bottomRightCenterY = nodeY + halfHeight - cornerRadius; + arcIntersections = intersectLineCircle(x5, y6, nodeX, nodeY, bottomRightCenterX, bottomRightCenterY, cornerRadius + padding2); + if (arcIntersections.length > 0 && arcIntersections[0] >= bottomRightCenterX && arcIntersections[1] >= bottomRightCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } + { + var bottomLeftCenterX = nodeX - halfWidth + cornerRadius; + var bottomLeftCenterY = nodeY + halfHeight - cornerRadius; + arcIntersections = intersectLineCircle(x5, y6, nodeX, nodeY, bottomLeftCenterX, bottomLeftCenterY, cornerRadius + padding2); + if (arcIntersections.length > 0 && arcIntersections[0] <= bottomLeftCenterX && arcIntersections[1] >= bottomLeftCenterY) { + return [arcIntersections[0], arcIntersections[1]]; + } + } + return []; + }, "roundRectangleIntersectLine"); + inLineVicinity = /* @__PURE__ */ __name(function inLineVicinity2(x5, y6, lx1, ly1, lx2, ly2, tolerance) { + var t4 = tolerance; + var x1 = Math.min(lx1, lx2); + var x22 = Math.max(lx1, lx2); + var y1 = Math.min(ly1, ly2); + var y22 = Math.max(ly1, ly2); + return x1 - t4 <= x5 && x5 <= x22 + t4 && y1 - t4 <= y6 && y6 <= y22 + t4; + }, "inLineVicinity"); + inBezierVicinity = /* @__PURE__ */ __name(function inBezierVicinity2(x5, y6, x1, y1, x22, y22, x32, y32, tolerance) { + var bb = { + x1: Math.min(x1, x32, x22) - tolerance, + x2: Math.max(x1, x32, x22) + tolerance, + y1: Math.min(y1, y32, y22) - tolerance, + y2: Math.max(y1, y32, y22) + tolerance + }; + if (x5 < bb.x1 || x5 > bb.x2 || y6 < bb.y1 || y6 > bb.y2) { + return false; + } else { + return true; + } + }, "inBezierVicinity"); + solveQuadratic = /* @__PURE__ */ __name(function solveQuadratic2(a2, b3, c3, val) { + c3 -= val; + var r2 = b3 * b3 - 4 * a2 * c3; + if (r2 < 0) { + return []; + } + var sqrtR = Math.sqrt(r2); + var denom = 2 * a2; + var root1 = (-b3 + sqrtR) / denom; + var root23 = (-b3 - sqrtR) / denom; + return [root1, root23]; + }, "solveQuadratic"); + solveCubic = /* @__PURE__ */ __name(function solveCubic2(a2, b3, c3, d3, result) { + var epsilon6 = 1e-5; + if (a2 === 0) { + a2 = epsilon6; + } + b3 /= a2; + c3 /= a2; + d3 /= a2; + var discriminant, q3, r2, dum1, s2, t4, term1, r13; + q3 = (3 * c3 - b3 * b3) / 9; + r2 = -(27 * d3) + b3 * (9 * c3 - 2 * (b3 * b3)); + r2 /= 54; + discriminant = q3 * q3 * q3 + r2 * r2; + result[1] = 0; + term1 = b3 / 3; + if (discriminant > 0) { + s2 = r2 + Math.sqrt(discriminant); + s2 = s2 < 0 ? -Math.pow(-s2, 1 / 3) : Math.pow(s2, 1 / 3); + t4 = r2 - Math.sqrt(discriminant); + t4 = t4 < 0 ? -Math.pow(-t4, 1 / 3) : Math.pow(t4, 1 / 3); + result[0] = -term1 + s2 + t4; + term1 += (s2 + t4) / 2; + result[4] = result[2] = -term1; + term1 = Math.sqrt(3) * (-t4 + s2) / 2; + result[3] = term1; + result[5] = -term1; + return; + } + result[5] = result[3] = 0; + if (discriminant === 0) { + r13 = r2 < 0 ? -Math.pow(-r2, 1 / 3) : Math.pow(r2, 1 / 3); + result[0] = -term1 + 2 * r13; + result[4] = result[2] = -(r13 + term1); + return; + } + q3 = -q3; + dum1 = q3 * q3 * q3; + dum1 = Math.acos(r2 / Math.sqrt(dum1)); + r13 = 2 * Math.sqrt(q3); + result[0] = -term1 + r13 * Math.cos(dum1 / 3); + result[2] = -term1 + r13 * Math.cos((dum1 + 2 * Math.PI) / 3); + result[4] = -term1 + r13 * Math.cos((dum1 + 4 * Math.PI) / 3); + return; + }, "solveCubic"); + sqdistToQuadraticBezier = /* @__PURE__ */ __name(function sqdistToQuadraticBezier2(x5, y6, x1, y1, x22, y22, x32, y32) { + var a2 = 1 * x1 * x1 - 4 * x1 * x22 + 2 * x1 * x32 + 4 * x22 * x22 - 4 * x22 * x32 + x32 * x32 + y1 * y1 - 4 * y1 * y22 + 2 * y1 * y32 + 4 * y22 * y22 - 4 * y22 * y32 + y32 * y32; + var b3 = 1 * 9 * x1 * x22 - 3 * x1 * x1 - 3 * x1 * x32 - 6 * x22 * x22 + 3 * x22 * x32 + 9 * y1 * y22 - 3 * y1 * y1 - 3 * y1 * y32 - 6 * y22 * y22 + 3 * y22 * y32; + var c3 = 1 * 3 * x1 * x1 - 6 * x1 * x22 + x1 * x32 - x1 * x5 + 2 * x22 * x22 + 2 * x22 * x5 - x32 * x5 + 3 * y1 * y1 - 6 * y1 * y22 + y1 * y32 - y1 * y6 + 2 * y22 * y22 + 2 * y22 * y6 - y32 * y6; + var d3 = 1 * x1 * x22 - x1 * x1 + x1 * x5 - x22 * x5 + y1 * y22 - y1 * y1 + y1 * y6 - y22 * y6; + var roots = []; + solveCubic(a2, b3, c3, d3, roots); + var zeroThreshold = 1e-7; + var params = []; + for (var index = 0; index < 6; index += 2) { + if (Math.abs(roots[index + 1]) < zeroThreshold && roots[index] >= 0 && roots[index] <= 1) { + params.push(roots[index]); + } + } + params.push(1); + params.push(0); + var minDistanceSquared = -1; + var curX, curY, distSquared; + for (var i2 = 0; i2 < params.length; i2++) { + curX = Math.pow(1 - params[i2], 2) * x1 + 2 * (1 - params[i2]) * params[i2] * x22 + params[i2] * params[i2] * x32; + curY = Math.pow(1 - params[i2], 2) * y1 + 2 * (1 - params[i2]) * params[i2] * y22 + params[i2] * params[i2] * y32; + distSquared = Math.pow(curX - x5, 2) + Math.pow(curY - y6, 2); + if (minDistanceSquared >= 0) { + if (distSquared < minDistanceSquared) { + minDistanceSquared = distSquared; + } + } else { + minDistanceSquared = distSquared; + } + } + return minDistanceSquared; + }, "sqdistToQuadraticBezier"); + sqdistToFiniteLine = /* @__PURE__ */ __name(function sqdistToFiniteLine2(x5, y6, x1, y1, x22, y22) { + var offset = [x5 - x1, y6 - y1]; + var line2 = [x22 - x1, y22 - y1]; + var lineSq = line2[0] * line2[0] + line2[1] * line2[1]; + var hypSq = offset[0] * offset[0] + offset[1] * offset[1]; + var dotProduct = offset[0] * line2[0] + offset[1] * line2[1]; + var adjSq = dotProduct * dotProduct / lineSq; + if (dotProduct < 0) { + return hypSq; + } + if (adjSq > lineSq) { + return (x5 - x22) * (x5 - x22) + (y6 - y22) * (y6 - y22); + } + return hypSq - adjSq; + }, "sqdistToFiniteLine"); + pointInsidePolygonPoints = /* @__PURE__ */ __name(function pointInsidePolygonPoints2(x5, y6, points) { + var x1, y1, x22, y22; + var y32; + var up = 0; + for (var i2 = 0; i2 < points.length / 2; i2++) { + x1 = points[i2 * 2]; + y1 = points[i2 * 2 + 1]; + if (i2 + 1 < points.length / 2) { + x22 = points[(i2 + 1) * 2]; + y22 = points[(i2 + 1) * 2 + 1]; + } else { + x22 = points[(i2 + 1 - points.length / 2) * 2]; + y22 = points[(i2 + 1 - points.length / 2) * 2 + 1]; + } + if (x1 == x5 && x22 == x5) ; + else if (x1 >= x5 && x5 >= x22 || x1 <= x5 && x5 <= x22) { + y32 = (x5 - x1) / (x22 - x1) * (y22 - y1) + y1; + if (y32 > y6) { + up++; + } + } else { + continue; + } + } + if (up % 2 === 0) { + return false; + } else { + return true; + } + }, "pointInsidePolygonPoints"); + pointInsidePolygon = /* @__PURE__ */ __name(function pointInsidePolygon2(x5, y6, basePoints, centerX, centerY, width3, height2, direction2, padding2) { + var transformedPoints = new Array(basePoints.length); + var angle2; + if (direction2[0] != null) { + angle2 = Math.atan(direction2[1] / direction2[0]); + if (direction2[0] < 0) { + angle2 = angle2 + Math.PI / 2; + } else { + angle2 = -angle2 - Math.PI / 2; + } + } else { + angle2 = direction2; + } + var cos3 = Math.cos(-angle2); + var sin3 = Math.sin(-angle2); + for (var i2 = 0; i2 < transformedPoints.length / 2; i2++) { + transformedPoints[i2 * 2] = width3 / 2 * (basePoints[i2 * 2] * cos3 - basePoints[i2 * 2 + 1] * sin3); + transformedPoints[i2 * 2 + 1] = height2 / 2 * (basePoints[i2 * 2 + 1] * cos3 + basePoints[i2 * 2] * sin3); + transformedPoints[i2 * 2] += centerX; + transformedPoints[i2 * 2 + 1] += centerY; + } + var points; + if (padding2 > 0) { + var expandedLineSet = expandPolygon(transformedPoints, -padding2); + points = joinLines(expandedLineSet); + } else { + points = transformedPoints; + } + return pointInsidePolygonPoints(x5, y6, points); + }, "pointInsidePolygon"); + pointInsideRoundPolygon = /* @__PURE__ */ __name(function pointInsideRoundPolygon2(x5, y6, basePoints, centerX, centerY, width3, height2, corners) { + var cutPolygonPoints = new Array(basePoints.length * 2); + for (var i2 = 0; i2 < corners.length; i2++) { + var corner = corners[i2]; + cutPolygonPoints[i2 * 4 + 0] = corner.startX; + cutPolygonPoints[i2 * 4 + 1] = corner.startY; + cutPolygonPoints[i2 * 4 + 2] = corner.stopX; + cutPolygonPoints[i2 * 4 + 3] = corner.stopY; + var squaredDistance = Math.pow(corner.cx - x5, 2) + Math.pow(corner.cy - y6, 2); + if (squaredDistance <= Math.pow(corner.radius, 2)) { + return true; + } + } + return pointInsidePolygonPoints(x5, y6, cutPolygonPoints); + }, "pointInsideRoundPolygon"); + joinLines = /* @__PURE__ */ __name(function joinLines2(lineSet) { + var vertices = new Array(lineSet.length / 2); + var currentLineStartX, currentLineStartY, currentLineEndX, currentLineEndY; + var nextLineStartX, nextLineStartY, nextLineEndX, nextLineEndY; + for (var i2 = 0; i2 < lineSet.length / 4; i2++) { + currentLineStartX = lineSet[i2 * 4]; + currentLineStartY = lineSet[i2 * 4 + 1]; + currentLineEndX = lineSet[i2 * 4 + 2]; + currentLineEndY = lineSet[i2 * 4 + 3]; + if (i2 < lineSet.length / 4 - 1) { + nextLineStartX = lineSet[(i2 + 1) * 4]; + nextLineStartY = lineSet[(i2 + 1) * 4 + 1]; + nextLineEndX = lineSet[(i2 + 1) * 4 + 2]; + nextLineEndY = lineSet[(i2 + 1) * 4 + 3]; + } else { + nextLineStartX = lineSet[0]; + nextLineStartY = lineSet[1]; + nextLineEndX = lineSet[2]; + nextLineEndY = lineSet[3]; + } + var intersection4 = finiteLinesIntersect(currentLineStartX, currentLineStartY, currentLineEndX, currentLineEndY, nextLineStartX, nextLineStartY, nextLineEndX, nextLineEndY, true); + vertices[i2 * 2] = intersection4[0]; + vertices[i2 * 2 + 1] = intersection4[1]; + } + return vertices; + }, "joinLines"); + expandPolygon = /* @__PURE__ */ __name(function expandPolygon2(points, pad3) { + var expandedLineSet = new Array(points.length * 2); + var currentPointX, currentPointY, nextPointX, nextPointY; + for (var i2 = 0; i2 < points.length / 2; i2++) { + currentPointX = points[i2 * 2]; + currentPointY = points[i2 * 2 + 1]; + if (i2 < points.length / 2 - 1) { + nextPointX = points[(i2 + 1) * 2]; + nextPointY = points[(i2 + 1) * 2 + 1]; + } else { + nextPointX = points[0]; + nextPointY = points[1]; + } + var offsetX = nextPointY - currentPointY; + var offsetY = -(nextPointX - currentPointX); + var offsetLength = Math.sqrt(offsetX * offsetX + offsetY * offsetY); + var normalizedOffsetX = offsetX / offsetLength; + var normalizedOffsetY = offsetY / offsetLength; + expandedLineSet[i2 * 4] = currentPointX + normalizedOffsetX * pad3; + expandedLineSet[i2 * 4 + 1] = currentPointY + normalizedOffsetY * pad3; + expandedLineSet[i2 * 4 + 2] = nextPointX + normalizedOffsetX * pad3; + expandedLineSet[i2 * 4 + 3] = nextPointY + normalizedOffsetY * pad3; + } + return expandedLineSet; + }, "expandPolygon"); + intersectLineEllipse = /* @__PURE__ */ __name(function intersectLineEllipse2(x5, y6, centerX, centerY, ellipseWradius, ellipseHradius) { + var dispX = centerX - x5; + var dispY = centerY - y6; + dispX /= ellipseWradius; + dispY /= ellipseHradius; + var len = Math.sqrt(dispX * dispX + dispY * dispY); + var newLength = len - 1; + if (newLength < 0) { + return []; + } + var lenProportion = newLength / len; + return [(centerX - x5) * lenProportion + x5, (centerY - y6) * lenProportion + y6]; + }, "intersectLineEllipse"); + checkInEllipse = /* @__PURE__ */ __name(function checkInEllipse2(x5, y6, width3, height2, centerX, centerY, padding2) { + x5 -= centerX; + y6 -= centerY; + x5 /= width3 / 2 + padding2; + y6 /= height2 / 2 + padding2; + return x5 * x5 + y6 * y6 <= 1; + }, "checkInEllipse"); + intersectLineCircle = /* @__PURE__ */ __name(function intersectLineCircle2(x1, y1, x22, y22, centerX, centerY, radius2) { + var d3 = [x22 - x1, y22 - y1]; + var f2 = [x1 - centerX, y1 - centerY]; + var a2 = d3[0] * d3[0] + d3[1] * d3[1]; + var b3 = 2 * (f2[0] * d3[0] + f2[1] * d3[1]); + var c3 = f2[0] * f2[0] + f2[1] * f2[1] - radius2 * radius2; + var discriminant = b3 * b3 - 4 * a2 * c3; + if (discriminant < 0) { + return []; + } + var t13 = (-b3 + Math.sqrt(discriminant)) / (2 * a2); + var t22 = (-b3 - Math.sqrt(discriminant)) / (2 * a2); + var tMin = Math.min(t13, t22); + var tMax = Math.max(t13, t22); + var inRangeParams = []; + if (tMin >= 0 && tMin <= 1) { + inRangeParams.push(tMin); + } + if (tMax >= 0 && tMax <= 1) { + inRangeParams.push(tMax); + } + if (inRangeParams.length === 0) { + return []; + } + var nearIntersectionX = inRangeParams[0] * d3[0] + x1; + var nearIntersectionY = inRangeParams[0] * d3[1] + y1; + if (inRangeParams.length > 1) { + if (inRangeParams[0] == inRangeParams[1]) { + return [nearIntersectionX, nearIntersectionY]; + } else { + var farIntersectionX = inRangeParams[1] * d3[0] + x1; + var farIntersectionY = inRangeParams[1] * d3[1] + y1; + return [nearIntersectionX, nearIntersectionY, farIntersectionX, farIntersectionY]; + } + } else { + return [nearIntersectionX, nearIntersectionY]; + } + }, "intersectLineCircle"); + midOfThree = /* @__PURE__ */ __name(function midOfThree2(a2, b3, c3) { + if (b3 <= a2 && a2 <= c3 || c3 <= a2 && a2 <= b3) { + return a2; + } else if (a2 <= b3 && b3 <= c3 || c3 <= b3 && b3 <= a2) { + return b3; + } else { + return c3; + } + }, "midOfThree"); + finiteLinesIntersect = /* @__PURE__ */ __name(function finiteLinesIntersect2(x1, y1, x22, y22, x32, y32, x42, y42, infiniteLines) { + var dx13 = x1 - x32; + var dx21 = x22 - x1; + var dx43 = x42 - x32; + var dy13 = y1 - y32; + var dy21 = y22 - y1; + var dy43 = y42 - y32; + var ua_t = dx43 * dy13 - dy43 * dx13; + var ub_t = dx21 * dy13 - dy21 * dx13; + var u_b = dy43 * dx21 - dx43 * dy21; + if (u_b !== 0) { + var ua = ua_t / u_b; + var ub = ub_t / u_b; + var flptThreshold = 1e-3; + var _min = 0 - flptThreshold; + var _max = 1 + flptThreshold; + if (_min <= ua && ua <= _max && _min <= ub && ub <= _max) { + return [x1 + ua * dx21, y1 + ua * dy21]; + } else { + if (!infiniteLines) { + return []; + } else { + return [x1 + ua * dx21, y1 + ua * dy21]; + } + } + } else { + if (ua_t === 0 || ub_t === 0) { + if (midOfThree(x1, x22, x42) === x42) { + return [x42, y42]; + } + if (midOfThree(x1, x22, x32) === x32) { + return [x32, y32]; + } + if (midOfThree(x32, x42, x22) === x22) { + return [x22, y22]; + } + return []; + } else { + return []; + } + } + }, "finiteLinesIntersect"); + transformPoints = /* @__PURE__ */ __name(function transformPoints2(points, centerX, centerY, width3, height2) { + var ret = []; + var halfW = width3 / 2; + var halfH = height2 / 2; + var x5 = centerX; + var y6 = centerY; + ret.push({ + x: x5 + halfW * points[0], + y: y6 + halfH * points[1] + }); + for (var i2 = 1; i2 < points.length / 2; i2++) { + ret.push({ + x: x5 + halfW * points[i2 * 2], + y: y6 + halfH * points[i2 * 2 + 1] + }); + } + return ret; + }, "transformPoints"); + polygonIntersectLine = /* @__PURE__ */ __name(function polygonIntersectLine2(x5, y6, basePoints, centerX, centerY, width3, height2, padding2) { + var intersections = []; + var intersection4; + var transformedPoints = new Array(basePoints.length); + var doTransform = true; + if (width3 == null) { + doTransform = false; + } + var points; + if (doTransform) { + for (var i2 = 0; i2 < transformedPoints.length / 2; i2++) { + transformedPoints[i2 * 2] = basePoints[i2 * 2] * width3 + centerX; + transformedPoints[i2 * 2 + 1] = basePoints[i2 * 2 + 1] * height2 + centerY; + } + if (padding2 > 0) { + var expandedLineSet = expandPolygon(transformedPoints, -padding2); + points = joinLines(expandedLineSet); + } else { + points = transformedPoints; + } + } else { + points = basePoints; + } + var currentX, currentY, nextX, nextY; + for (var _i3 = 0; _i3 < points.length / 2; _i3++) { + currentX = points[_i3 * 2]; + currentY = points[_i3 * 2 + 1]; + if (_i3 < points.length / 2 - 1) { + nextX = points[(_i3 + 1) * 2]; + nextY = points[(_i3 + 1) * 2 + 1]; + } else { + nextX = points[0]; + nextY = points[1]; + } + intersection4 = finiteLinesIntersect(x5, y6, centerX, centerY, currentX, currentY, nextX, nextY); + if (intersection4.length !== 0) { + intersections.push(intersection4[0], intersection4[1]); + } + } + return intersections; + }, "polygonIntersectLine"); + roundPolygonIntersectLine = /* @__PURE__ */ __name(function roundPolygonIntersectLine2(x5, y6, basePoints, centerX, centerY, width3, height2, padding2, corners) { + var intersections = []; + var intersection4; + var lines = new Array(basePoints.length * 2); + corners.forEach(function(corner, i3) { + if (i3 === 0) { + lines[lines.length - 2] = corner.startX; + lines[lines.length - 1] = corner.startY; + } else { + lines[i3 * 4 - 2] = corner.startX; + lines[i3 * 4 - 1] = corner.startY; + } + lines[i3 * 4] = corner.stopX; + lines[i3 * 4 + 1] = corner.stopY; + intersection4 = intersectLineCircle(x5, y6, centerX, centerY, corner.cx, corner.cy, corner.radius); + if (intersection4.length !== 0) { + intersections.push(intersection4[0], intersection4[1]); + } + }); + for (var i2 = 0; i2 < lines.length / 4; i2++) { + intersection4 = finiteLinesIntersect(x5, y6, centerX, centerY, lines[i2 * 4], lines[i2 * 4 + 1], lines[i2 * 4 + 2], lines[i2 * 4 + 3], false); + if (intersection4.length !== 0) { + intersections.push(intersection4[0], intersection4[1]); + } + } + if (intersections.length > 2) { + var lowestIntersection = [intersections[0], intersections[1]]; + var lowestSquaredDistance = Math.pow(lowestIntersection[0] - x5, 2) + Math.pow(lowestIntersection[1] - y6, 2); + for (var _i4 = 1; _i4 < intersections.length / 2; _i4++) { + var squaredDistance = Math.pow(intersections[_i4 * 2] - x5, 2) + Math.pow(intersections[_i4 * 2 + 1] - y6, 2); + if (squaredDistance <= lowestSquaredDistance) { + lowestIntersection[0] = intersections[_i4 * 2]; + lowestIntersection[1] = intersections[_i4 * 2 + 1]; + lowestSquaredDistance = squaredDistance; + } + } + return lowestIntersection; + } + return intersections; + }, "roundPolygonIntersectLine"); + shortenIntersection = /* @__PURE__ */ __name(function shortenIntersection2(intersection4, offset, amount) { + var disp = [intersection4[0] - offset[0], intersection4[1] - offset[1]]; + var length2 = Math.sqrt(disp[0] * disp[0] + disp[1] * disp[1]); + var lenRatio = (length2 - amount) / length2; + if (lenRatio < 0) { + lenRatio = 1e-5; + } + return [offset[0] + lenRatio * disp[0], offset[1] + lenRatio * disp[1]]; + }, "shortenIntersection"); + generateUnitNgonPointsFitToSquare = /* @__PURE__ */ __name(function generateUnitNgonPointsFitToSquare2(sides, rotationRadians) { + var points = generateUnitNgonPoints(sides, rotationRadians); + points = fitPolygonToSquare(points); + return points; + }, "generateUnitNgonPointsFitToSquare"); + fitPolygonToSquare = /* @__PURE__ */ __name(function fitPolygonToSquare2(points) { + var x5, y6; + var sides = points.length / 2; + var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity; + for (var i2 = 0; i2 < sides; i2++) { + x5 = points[2 * i2]; + y6 = points[2 * i2 + 1]; + minX = Math.min(minX, x5); + maxX = Math.max(maxX, x5); + minY = Math.min(minY, y6); + maxY = Math.max(maxY, y6); + } + var sx = 2 / (maxX - minX); + var sy = 2 / (maxY - minY); + for (var _i5 = 0; _i5 < sides; _i5++) { + x5 = points[2 * _i5] = points[2 * _i5] * sx; + y6 = points[2 * _i5 + 1] = points[2 * _i5 + 1] * sy; + minX = Math.min(minX, x5); + maxX = Math.max(maxX, x5); + minY = Math.min(minY, y6); + maxY = Math.max(maxY, y6); + } + if (minY < -1) { + for (var _i6 = 0; _i6 < sides; _i6++) { + y6 = points[2 * _i6 + 1] = points[2 * _i6 + 1] + (-1 - minY); + } + } + return points; + }, "fitPolygonToSquare"); + generateUnitNgonPoints = /* @__PURE__ */ __name(function generateUnitNgonPoints2(sides, rotationRadians) { + var increment = 1 / sides * 2 * Math.PI; + var startAngle = sides % 2 === 0 ? Math.PI / 2 + increment / 2 : Math.PI / 2; + startAngle += rotationRadians; + var points = new Array(sides * 2); + var currentAngle; + for (var i2 = 0; i2 < sides; i2++) { + currentAngle = i2 * increment + startAngle; + points[2 * i2] = Math.cos(currentAngle); + points[2 * i2 + 1] = Math.sin(-currentAngle); + } + return points; + }, "generateUnitNgonPoints"); + getRoundRectangleRadius = /* @__PURE__ */ __name(function getRoundRectangleRadius2(width3, height2) { + return Math.min(width3 / 4, height2 / 4, 8); + }, "getRoundRectangleRadius"); + getRoundPolygonRadius = /* @__PURE__ */ __name(function getRoundPolygonRadius2(width3, height2) { + return Math.min(width3 / 10, height2 / 10, 8); + }, "getRoundPolygonRadius"); + getCutRectangleCornerLength = /* @__PURE__ */ __name(function getCutRectangleCornerLength2() { + return 8; + }, "getCutRectangleCornerLength"); + bezierPtsToQuadCoeff = /* @__PURE__ */ __name(function bezierPtsToQuadCoeff2(p0, p1, p22) { + return [p0 - 2 * p1 + p22, 2 * (p1 - p0), p0]; + }, "bezierPtsToQuadCoeff"); + getBarrelCurveConstants = /* @__PURE__ */ __name(function getBarrelCurveConstants2(width3, height2) { + return { + heightOffset: Math.min(15, 0.05 * height2), + widthOffset: Math.min(100, 0.25 * width3), + ctrlPtOffsetPct: 0.05 + }; + }, "getBarrelCurveConstants"); + __name(satPolygonIntersection, "satPolygonIntersection"); + pageRankDefaults = defaults$g({ + dampingFactor: 0.8, + precision: 1e-6, + iterations: 200, + weight: /* @__PURE__ */ __name(function weight5(edge) { + return 1; + }, "weight") + }); + elesfn$o = { + pageRank: /* @__PURE__ */ __name(function pageRank(options2) { + var _pageRankDefaults = pageRankDefaults(options2), dampingFactor = _pageRankDefaults.dampingFactor, precision = _pageRankDefaults.precision, iterations = _pageRankDefaults.iterations, weight8 = _pageRankDefaults.weight; + var cy = this._private.cy; + var _this$byGroup = this.byGroup(), nodes5 = _this$byGroup.nodes, edges3 = _this$byGroup.edges; + var numNodes = nodes5.length; + var numNodesSqd = numNodes * numNodes; + var numEdges = edges3.length; + var matrix = new Array(numNodesSqd); + var columnSum = new Array(numNodes); + var additionalProb = (1 - dampingFactor) / numNodes; + for (var i2 = 0; i2 < numNodes; i2++) { + for (var j3 = 0; j3 < numNodes; j3++) { + var n2 = i2 * numNodes + j3; + matrix[n2] = 0; + } + columnSum[i2] = 0; + } + for (var _i = 0; _i < numEdges; _i++) { + var edge = edges3[_i]; + var srcId = edge.data("source"); + var tgtId = edge.data("target"); + if (srcId === tgtId) { + continue; + } + var s2 = nodes5.indexOfId(srcId); + var t4 = nodes5.indexOfId(tgtId); + var w4 = weight8(edge); + var _n = t4 * numNodes + s2; + matrix[_n] += w4; + columnSum[s2] += w4; + } + var p3 = 1 / numNodes + additionalProb; + for (var _j = 0; _j < numNodes; _j++) { + if (columnSum[_j] === 0) { + for (var _i2 = 0; _i2 < numNodes; _i2++) { + var _n2 = _i2 * numNodes + _j; + matrix[_n2] = p3; + } + } else { + for (var _i3 = 0; _i3 < numNodes; _i3++) { + var _n3 = _i3 * numNodes + _j; + matrix[_n3] = matrix[_n3] / columnSum[_j] + additionalProb; + } + } + } + var eigenvector = new Array(numNodes); + var temp = new Array(numNodes); + var previous; + for (var _i4 = 0; _i4 < numNodes; _i4++) { + eigenvector[_i4] = 1; + } + for (var iter = 0; iter < iterations; iter++) { + for (var _i5 = 0; _i5 < numNodes; _i5++) { + temp[_i5] = 0; + } + for (var _i6 = 0; _i6 < numNodes; _i6++) { + for (var _j2 = 0; _j2 < numNodes; _j2++) { + var _n4 = _i6 * numNodes + _j2; + temp[_i6] += matrix[_n4] * eigenvector[_j2]; + } + } + inPlaceSumNormalize(temp); + previous = eigenvector; + eigenvector = temp; + temp = previous; + var diff2 = 0; + for (var _i7 = 0; _i7 < numNodes; _i7++) { + var delta = previous[_i7] - eigenvector[_i7]; + diff2 += delta * delta; + } + if (diff2 < precision) { + break; + } + } + var res = { + rank: /* @__PURE__ */ __name(function rank2(node2) { + node2 = cy.collection(node2)[0]; + return eigenvector[nodes5.indexOf(node2)]; + }, "rank") + }; + return res; + }, "pageRank") + // pageRank + }; + defaults$f = defaults$g({ + root: null, + weight: /* @__PURE__ */ __name(function weight6(edge) { + return 1; + }, "weight"), + directed: false, + alpha: 0 + }); + elesfn$n = { + degreeCentralityNormalized: /* @__PURE__ */ __name(function degreeCentralityNormalized(options2) { + options2 = defaults$f(options2); + var cy = this.cy(); + var nodes5 = this.nodes(); + var numNodes = nodes5.length; + if (!options2.directed) { + var degrees3 = {}; + var maxDegree = 0; + for (var i2 = 0; i2 < numNodes; i2++) { + var node2 = nodes5[i2]; + options2.root = node2; + var currDegree = this.degreeCentrality(options2); + if (maxDegree < currDegree.degree) { + maxDegree = currDegree.degree; + } + degrees3[node2.id()] = currDegree.degree; + } + return { + degree: /* @__PURE__ */ __name(function degree(node3) { + if (maxDegree === 0) { + return 0; + } + if (string(node3)) { + node3 = cy.filter(node3); + } + return degrees3[node3.id()] / maxDegree; + }, "degree") + }; + } else { + var indegrees = {}; + var outdegrees = {}; + var maxIndegree = 0; + var maxOutdegree = 0; + for (var _i = 0; _i < numNodes; _i++) { + var _node = nodes5[_i]; + var id35 = _node.id(); + options2.root = _node; + var _currDegree = this.degreeCentrality(options2); + if (maxIndegree < _currDegree.indegree) maxIndegree = _currDegree.indegree; + if (maxOutdegree < _currDegree.outdegree) maxOutdegree = _currDegree.outdegree; + indegrees[id35] = _currDegree.indegree; + outdegrees[id35] = _currDegree.outdegree; + } + return { + indegree: /* @__PURE__ */ __name(function indegree(node3) { + if (maxIndegree == 0) { + return 0; + } + if (string(node3)) { + node3 = cy.filter(node3); + } + return indegrees[node3.id()] / maxIndegree; + }, "indegree"), + outdegree: /* @__PURE__ */ __name(function outdegree(node3) { + if (maxOutdegree === 0) { + return 0; + } + if (string(node3)) { + node3 = cy.filter(node3); + } + return outdegrees[node3.id()] / maxOutdegree; + }, "outdegree") + }; + } + }, "degreeCentralityNormalized"), + // degreeCentralityNormalized + // Implemented from the algorithm in Opsahl's paper + // "Node centrality in weighted networks: Generalizing degree and shortest paths" + // check the heading 2 "Degree" + degreeCentrality: /* @__PURE__ */ __name(function degreeCentrality(options2) { + options2 = defaults$f(options2); + var cy = this.cy(); + var callingEles = this; + var _options = options2, root4 = _options.root, weight8 = _options.weight, directed = _options.directed, alpha = _options.alpha; + root4 = cy.collection(root4)[0]; + if (!directed) { + var connEdges = root4.connectedEdges().intersection(callingEles); + var k2 = connEdges.length; + var s2 = 0; + for (var i2 = 0; i2 < connEdges.length; i2++) { + s2 += weight8(connEdges[i2]); + } + return { + degree: Math.pow(k2, 1 - alpha) * Math.pow(s2, alpha) + }; + } else { + var edges3 = root4.connectedEdges(); + var incoming = edges3.filter(function(edge) { + return edge.target().same(root4) && callingEles.has(edge); + }); + var outgoing = edges3.filter(function(edge) { + return edge.source().same(root4) && callingEles.has(edge); + }); + var k_in = incoming.length; + var k_out = outgoing.length; + var s_in = 0; + var s_out = 0; + for (var _i2 = 0; _i2 < incoming.length; _i2++) { + s_in += weight8(incoming[_i2]); + } + for (var _i3 = 0; _i3 < outgoing.length; _i3++) { + s_out += weight8(outgoing[_i3]); + } + return { + indegree: Math.pow(k_in, 1 - alpha) * Math.pow(s_in, alpha), + outdegree: Math.pow(k_out, 1 - alpha) * Math.pow(s_out, alpha) + }; + } + }, "degreeCentrality") + // degreeCentrality + }; + elesfn$n.dc = elesfn$n.degreeCentrality; + elesfn$n.dcn = elesfn$n.degreeCentralityNormalised = elesfn$n.degreeCentralityNormalized; + defaults$e = defaults$g({ + harmonic: true, + weight: /* @__PURE__ */ __name(function weight7() { + return 1; + }, "weight"), + directed: false, + root: null + }); + elesfn$m = { + closenessCentralityNormalized: /* @__PURE__ */ __name(function closenessCentralityNormalized(options2) { + var _defaults = defaults$e(options2), harmonic = _defaults.harmonic, weight8 = _defaults.weight, directed = _defaults.directed; + var cy = this.cy(); + var closenesses = {}; + var maxCloseness = 0; + var nodes5 = this.nodes(); + var fw = this.floydWarshall({ + weight: weight8, + directed + }); + for (var i2 = 0; i2 < nodes5.length; i2++) { + var currCloseness = 0; + var node_i = nodes5[i2]; + for (var j3 = 0; j3 < nodes5.length; j3++) { + if (i2 !== j3) { + var d3 = fw.distance(node_i, nodes5[j3]); + if (harmonic) { + currCloseness += 1 / d3; + } else { + currCloseness += d3; + } + } + } + if (!harmonic) { + currCloseness = 1 / currCloseness; + } + if (maxCloseness < currCloseness) { + maxCloseness = currCloseness; + } + closenesses[node_i.id()] = currCloseness; + } + return { + closeness: /* @__PURE__ */ __name(function closeness(node2) { + if (maxCloseness == 0) { + return 0; + } + if (string(node2)) { + node2 = cy.filter(node2)[0].id(); + } else { + node2 = node2.id(); + } + return closenesses[node2] / maxCloseness; + }, "closeness") + }; + }, "closenessCentralityNormalized"), + // Implemented from pseudocode from wikipedia + closenessCentrality: /* @__PURE__ */ __name(function closenessCentrality(options2) { + var _defaults2 = defaults$e(options2), root4 = _defaults2.root, weight8 = _defaults2.weight, directed = _defaults2.directed, harmonic = _defaults2.harmonic; + root4 = this.filter(root4)[0]; + var dijkstra3 = this.dijkstra({ + root: root4, + weight: weight8, + directed + }); + var totalDistance = 0; + var nodes5 = this.nodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + var n2 = nodes5[i2]; + if (!n2.same(root4)) { + var d3 = dijkstra3.distanceTo(n2); + if (harmonic) { + totalDistance += 1 / d3; + } else { + totalDistance += d3; + } + } + } + return harmonic ? totalDistance : 1 / totalDistance; + }, "closenessCentrality") + // closenessCentrality + }; + elesfn$m.cc = elesfn$m.closenessCentrality; + elesfn$m.ccn = elesfn$m.closenessCentralityNormalised = elesfn$m.closenessCentralityNormalized; + defaults$d = defaults$g({ + weight: null, + directed: false + }); + elesfn$l = { + // Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes + betweennessCentrality: /* @__PURE__ */ __name(function betweennessCentrality(options2) { + var _defaults = defaults$d(options2), directed = _defaults.directed, weight8 = _defaults.weight; + var weighted = weight8 != null; + var cy = this.cy(); + var V3 = this.nodes(); + var A2 = {}; + var _C = {}; + var max10 = 0; + var C3 = { + set: /* @__PURE__ */ __name(function set5(key, val) { + _C[key] = val; + if (val > max10) { + max10 = val; + } + }, "set"), + get: /* @__PURE__ */ __name(function get6(key) { + return _C[key]; + }, "get") + }; + for (var i2 = 0; i2 < V3.length; i2++) { + var v3 = V3[i2]; + var vid = v3.id(); + if (directed) { + A2[vid] = v3.outgoers().nodes(); + } else { + A2[vid] = v3.openNeighborhood().nodes(); + } + C3.set(vid, 0); + } + var _loop = /* @__PURE__ */ __name(function _loop2() { + var sid = V3[s2].id(); + var S4 = []; + var P3 = {}; + var g2 = {}; + var d3 = {}; + var Q3 = new Heap(function(a2, b3) { + return d3[a2] - d3[b3]; + }); + for (var _i = 0; _i < V3.length; _i++) { + var _vid = V3[_i].id(); + P3[_vid] = []; + g2[_vid] = 0; + d3[_vid] = Infinity; + } + g2[sid] = 1; + d3[sid] = 0; + Q3.push(sid); + while (!Q3.empty()) { + var _v = Q3.pop(); + S4.push(_v); + if (weighted) { + for (var j3 = 0; j3 < A2[_v].length; j3++) { + var w4 = A2[_v][j3]; + var vEle = cy.getElementById(_v); + var edge = void 0; + if (vEle.edgesTo(w4).length > 0) { + edge = vEle.edgesTo(w4)[0]; + } else { + edge = w4.edgesTo(vEle)[0]; + } + var edgeWeight = weight8(edge); + w4 = w4.id(); + if (d3[w4] > d3[_v] + edgeWeight) { + d3[w4] = d3[_v] + edgeWeight; + if (Q3.nodes.indexOf(w4) < 0) { + Q3.push(w4); + } else { + Q3.updateItem(w4); + } + g2[w4] = 0; + P3[w4] = []; + } + if (d3[w4] == d3[_v] + edgeWeight) { + g2[w4] = g2[w4] + g2[_v]; + P3[w4].push(_v); + } + } + } else { + for (var _j = 0; _j < A2[_v].length; _j++) { + var _w = A2[_v][_j].id(); + if (d3[_w] == Infinity) { + Q3.push(_w); + d3[_w] = d3[_v] + 1; + } + if (d3[_w] == d3[_v] + 1) { + g2[_w] = g2[_w] + g2[_v]; + P3[_w].push(_v); + } + } + } + } + var e3 = {}; + for (var _i2 = 0; _i2 < V3.length; _i2++) { + e3[V3[_i2].id()] = 0; + } + while (S4.length > 0) { + var _w2 = S4.pop(); + for (var _j2 = 0; _j2 < P3[_w2].length; _j2++) { + var _v2 = P3[_w2][_j2]; + e3[_v2] = e3[_v2] + g2[_v2] / g2[_w2] * (1 + e3[_w2]); + } + if (_w2 != V3[s2].id()) { + C3.set(_w2, C3.get(_w2) + e3[_w2]); + } + } + }, "_loop"); + for (var s2 = 0; s2 < V3.length; s2++) { + _loop(); + } + var ret = { + betweenness: /* @__PURE__ */ __name(function betweenness(node2) { + var id35 = cy.collection(node2).id(); + return C3.get(id35); + }, "betweenness"), + betweennessNormalized: /* @__PURE__ */ __name(function betweennessNormalized(node2) { + if (max10 == 0) { + return 0; + } + var id35 = cy.collection(node2).id(); + return C3.get(id35) / max10; + }, "betweennessNormalized") + }; + ret.betweennessNormalised = ret.betweennessNormalized; + return ret; + }, "betweennessCentrality") + // betweennessCentrality + }; + elesfn$l.bc = elesfn$l.betweennessCentrality; + defaults$c = defaults$g({ + expandFactor: 2, + // affects time of computation and cluster granularity to some extent: M * M + inflateFactor: 2, + // affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j) + multFactor: 1, + // optional self loops for each node. Use a neutral value to improve cluster computations. + maxIterations: 20, + // maximum number of iterations of the MCL algorithm in a single run + attributes: [ + // attributes/features used to group nodes, ie. similarity values between nodes + function(edge) { + return 1; + } + ] + }); + setOptions$3 = /* @__PURE__ */ __name(function setOptions(options2) { + return defaults$c(options2); + }, "setOptions"); + getSimilarity$1 = /* @__PURE__ */ __name(function getSimilarity(edge, attributes) { + var total = 0; + for (var i2 = 0; i2 < attributes.length; i2++) { + total += attributes[i2](edge); + } + return total; + }, "getSimilarity"); + addLoops = /* @__PURE__ */ __name(function addLoops2(M3, n2, val) { + for (var i2 = 0; i2 < n2; i2++) { + M3[i2 * n2 + i2] = val; + } + }, "addLoops"); + normalize2 = /* @__PURE__ */ __name(function normalize3(M3, n2) { + var sum2; + for (var col = 0; col < n2; col++) { + sum2 = 0; + for (var row = 0; row < n2; row++) { + sum2 += M3[row * n2 + col]; + } + for (var _row = 0; _row < n2; _row++) { + M3[_row * n2 + col] = M3[_row * n2 + col] / sum2; + } + } + }, "normalize"); + mmult = /* @__PURE__ */ __name(function mmult2(A2, B3, n2) { + var C3 = new Array(n2 * n2); + for (var i2 = 0; i2 < n2; i2++) { + for (var j3 = 0; j3 < n2; j3++) { + C3[i2 * n2 + j3] = 0; + } + for (var k2 = 0; k2 < n2; k2++) { + for (var _j = 0; _j < n2; _j++) { + C3[i2 * n2 + _j] += A2[i2 * n2 + k2] * B3[k2 * n2 + _j]; + } + } + } + return C3; + }, "mmult"); + expand = /* @__PURE__ */ __name(function expand2(M3, n2, expandFactor) { + var _M = M3.slice(0); + for (var p3 = 1; p3 < expandFactor; p3++) { + M3 = mmult(M3, _M, n2); + } + return M3; + }, "expand"); + inflate = /* @__PURE__ */ __name(function inflate2(M3, n2, inflateFactor) { + var _M = new Array(n2 * n2); + for (var i2 = 0; i2 < n2 * n2; i2++) { + _M[i2] = Math.pow(M3[i2], inflateFactor); + } + normalize2(_M, n2); + return _M; + }, "inflate"); + hasConverged = /* @__PURE__ */ __name(function hasConverged2(M3, _M, n2, roundFactor) { + for (var i2 = 0; i2 < n2; i2++) { + var v12 = Math.round(M3[i2] * Math.pow(10, roundFactor)) / Math.pow(10, roundFactor); + var v23 = Math.round(_M[i2] * Math.pow(10, roundFactor)) / Math.pow(10, roundFactor); + if (v12 !== v23) { + return false; + } + } + return true; + }, "hasConverged"); + assign$2 = /* @__PURE__ */ __name(function assign(M3, n2, nodes5, cy) { + var clusters = []; + for (var i2 = 0; i2 < n2; i2++) { + var cluster = []; + for (var j3 = 0; j3 < n2; j3++) { + if (Math.round(M3[i2 * n2 + j3] * 1e3) / 1e3 > 0) { + cluster.push(nodes5[j3]); + } + } + if (cluster.length !== 0) { + clusters.push(cy.collection(cluster)); + } + } + return clusters; + }, "assign"); + isDuplicate = /* @__PURE__ */ __name(function isDuplicate2(c1, c22) { + for (var i2 = 0; i2 < c1.length; i2++) { + if (!c22[i2] || c1[i2].id() !== c22[i2].id()) { + return false; + } + } + return true; + }, "isDuplicate"); + removeDuplicates = /* @__PURE__ */ __name(function removeDuplicates2(clusters) { + for (var i2 = 0; i2 < clusters.length; i2++) { + for (var j3 = 0; j3 < clusters.length; j3++) { + if (i2 != j3 && isDuplicate(clusters[i2], clusters[j3])) { + clusters.splice(j3, 1); + } + } + } + return clusters; + }, "removeDuplicates"); + markovClustering = /* @__PURE__ */ __name(function markovClustering2(options2) { + var nodes5 = this.nodes(); + var edges3 = this.edges(); + var cy = this.cy(); + var opts = setOptions$3(options2); + var id2position = {}; + for (var i2 = 0; i2 < nodes5.length; i2++) { + id2position[nodes5[i2].id()] = i2; + } + var n2 = nodes5.length, n22 = n2 * n2; + var M3 = new Array(n22), _M; + for (var _i = 0; _i < n22; _i++) { + M3[_i] = 0; + } + for (var e3 = 0; e3 < edges3.length; e3++) { + var edge = edges3[e3]; + var _i2 = id2position[edge.source().id()]; + var j3 = id2position[edge.target().id()]; + var sim = getSimilarity$1(edge, opts.attributes); + M3[_i2 * n2 + j3] += sim; + M3[j3 * n2 + _i2] += sim; + } + addLoops(M3, n2, opts.multFactor); + normalize2(M3, n2); + var isStillMoving = true; + var iterations = 0; + while (isStillMoving && iterations < opts.maxIterations) { + isStillMoving = false; + _M = expand(M3, n2, opts.expandFactor); + M3 = inflate(_M, n2, opts.inflateFactor); + if (!hasConverged(M3, _M, n22, 4)) { + isStillMoving = true; + } + iterations++; + } + var clusters = assign$2(M3, n2, nodes5, cy); + clusters = removeDuplicates(clusters); + return clusters; + }, "markovClustering"); + markovClustering$1 = { + markovClustering, + mcl: markovClustering + }; + identity$1 = /* @__PURE__ */ __name(function identity5(x5) { + return x5; + }, "identity"); + absDiff = /* @__PURE__ */ __name(function absDiff2(p3, q3) { + return Math.abs(q3 - p3); + }, "absDiff"); + addAbsDiff = /* @__PURE__ */ __name(function addAbsDiff2(total, p3, q3) { + return total + absDiff(p3, q3); + }, "addAbsDiff"); + addSquaredDiff = /* @__PURE__ */ __name(function addSquaredDiff2(total, p3, q3) { + return total + Math.pow(q3 - p3, 2); + }, "addSquaredDiff"); + sqrt3 = /* @__PURE__ */ __name(function sqrt4(x5) { + return Math.sqrt(x5); + }, "sqrt"); + maxAbsDiff = /* @__PURE__ */ __name(function maxAbsDiff2(currentMax, p3, q3) { + return Math.max(currentMax, absDiff(p3, q3)); + }, "maxAbsDiff"); + getDistance = /* @__PURE__ */ __name(function getDistance2(length2, getP, getQ, init3, visit) { + var post = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : identity$1; + var ret = init3; + var p3, q3; + for (var dim = 0; dim < length2; dim++) { + p3 = getP(dim); + q3 = getQ(dim); + ret = visit(ret, p3, q3); + } + return post(ret); + }, "getDistance"); + distances = { + euclidean: /* @__PURE__ */ __name(function euclidean(length2, getP, getQ) { + if (length2 >= 2) { + return getDistance(length2, getP, getQ, 0, addSquaredDiff, sqrt3); + } else { + return getDistance(length2, getP, getQ, 0, addAbsDiff); + } + }, "euclidean"), + squaredEuclidean: /* @__PURE__ */ __name(function squaredEuclidean(length2, getP, getQ) { + return getDistance(length2, getP, getQ, 0, addSquaredDiff); + }, "squaredEuclidean"), + manhattan: /* @__PURE__ */ __name(function manhattan(length2, getP, getQ) { + return getDistance(length2, getP, getQ, 0, addAbsDiff); + }, "manhattan"), + max: /* @__PURE__ */ __name(function max7(length2, getP, getQ) { + return getDistance(length2, getP, getQ, -Infinity, maxAbsDiff); + }, "max") + }; + distances["squared-euclidean"] = distances["squaredEuclidean"]; + distances["squaredeuclidean"] = distances["squaredEuclidean"]; + __name(clusteringDistance, "clusteringDistance"); + defaults$b = defaults$g({ + k: 2, + m: 2, + sensitivityThreshold: 1e-4, + distance: "euclidean", + maxIterations: 10, + attributes: [], + testMode: false, + testCentroids: null + }); + setOptions$2 = /* @__PURE__ */ __name(function setOptions2(options2) { + return defaults$b(options2); + }, "setOptions"); + getDist = /* @__PURE__ */ __name(function getDist2(type3, node2, centroid, attributes, mode) { + var noNodeP = mode !== "kMedoids"; + var getP = noNodeP ? function(i2) { + return centroid[i2]; + } : function(i2) { + return attributes[i2](centroid); + }; + var getQ = /* @__PURE__ */ __name(function getQ2(i2) { + return attributes[i2](node2); + }, "getQ"); + var nodeP = centroid; + var nodeQ = node2; + return clusteringDistance(type3, attributes.length, getP, getQ, nodeP, nodeQ); + }, "getDist"); + randomCentroids = /* @__PURE__ */ __name(function randomCentroids2(nodes5, k2, attributes) { + var ndim = attributes.length; + var min10 = new Array(ndim); + var max10 = new Array(ndim); + var centroids = new Array(k2); + var centroid = null; + for (var i2 = 0; i2 < ndim; i2++) { + min10[i2] = nodes5.min(attributes[i2]).value; + max10[i2] = nodes5.max(attributes[i2]).value; + } + for (var c3 = 0; c3 < k2; c3++) { + centroid = []; + for (var _i = 0; _i < ndim; _i++) { + centroid[_i] = Math.random() * (max10[_i] - min10[_i]) + min10[_i]; + } + centroids[c3] = centroid; + } + return centroids; + }, "randomCentroids"); + classify = /* @__PURE__ */ __name(function classify2(node2, centroids, distance3, attributes, type3) { + var min10 = Infinity; + var index = 0; + for (var i2 = 0; i2 < centroids.length; i2++) { + var dist3 = getDist(distance3, node2, centroids[i2], attributes, type3); + if (dist3 < min10) { + min10 = dist3; + index = i2; + } + } + return index; + }, "classify"); + buildCluster = /* @__PURE__ */ __name(function buildCluster2(centroid, nodes5, assignment) { + var cluster = []; + var node2 = null; + for (var n2 = 0; n2 < nodes5.length; n2++) { + node2 = nodes5[n2]; + if (assignment[node2.id()] === centroid) { + cluster.push(node2); + } + } + return cluster; + }, "buildCluster"); + haveValuesConverged = /* @__PURE__ */ __name(function haveValuesConverged2(v12, v23, sensitivityThreshold) { + return Math.abs(v23 - v12) <= sensitivityThreshold; + }, "haveValuesConverged"); + haveMatricesConverged = /* @__PURE__ */ __name(function haveMatricesConverged2(v12, v23, sensitivityThreshold) { + for (var i2 = 0; i2 < v12.length; i2++) { + for (var j3 = 0; j3 < v12[i2].length; j3++) { + var diff2 = Math.abs(v12[i2][j3] - v23[i2][j3]); + if (diff2 > sensitivityThreshold) { + return false; + } + } + } + return true; + }, "haveMatricesConverged"); + seenBefore = /* @__PURE__ */ __name(function seenBefore2(node2, medoids, n2) { + for (var i2 = 0; i2 < n2; i2++) { + if (node2 === medoids[i2]) return true; + } + return false; + }, "seenBefore"); + randomMedoids = /* @__PURE__ */ __name(function randomMedoids2(nodes5, k2) { + var medoids = new Array(k2); + if (nodes5.length < 50) { + for (var i2 = 0; i2 < k2; i2++) { + var node2 = nodes5[Math.floor(Math.random() * nodes5.length)]; + while (seenBefore(node2, medoids, i2)) { + node2 = nodes5[Math.floor(Math.random() * nodes5.length)]; + } + medoids[i2] = node2; + } + } else { + for (var _i2 = 0; _i2 < k2; _i2++) { + medoids[_i2] = nodes5[Math.floor(Math.random() * nodes5.length)]; + } + } + return medoids; + }, "randomMedoids"); + findCost = /* @__PURE__ */ __name(function findCost2(potentialNewMedoid, cluster, attributes) { + var cost = 0; + for (var n2 = 0; n2 < cluster.length; n2++) { + cost += getDist("manhattan", cluster[n2], potentialNewMedoid, attributes, "kMedoids"); + } + return cost; + }, "findCost"); + kMeans = /* @__PURE__ */ __name(function kMeans2(options2) { + var cy = this.cy(); + var nodes5 = this.nodes(); + var node2 = null; + var opts = setOptions$2(options2); + var clusters = new Array(opts.k); + var assignment = {}; + var centroids; + if (opts.testMode) { + if (typeof opts.testCentroids === "number") { + opts.testCentroids; + centroids = randomCentroids(nodes5, opts.k, opts.attributes); + } else if (_typeof(opts.testCentroids) === "object") { + centroids = opts.testCentroids; + } else { + centroids = randomCentroids(nodes5, opts.k, opts.attributes); + } + } else { + centroids = randomCentroids(nodes5, opts.k, opts.attributes); + } + var isStillMoving = true; + var iterations = 0; + while (isStillMoving && iterations < opts.maxIterations) { + for (var n2 = 0; n2 < nodes5.length; n2++) { + node2 = nodes5[n2]; + assignment[node2.id()] = classify(node2, centroids, opts.distance, opts.attributes, "kMeans"); + } + isStillMoving = false; + for (var c3 = 0; c3 < opts.k; c3++) { + var cluster = buildCluster(c3, nodes5, assignment); + if (cluster.length === 0) { + continue; + } + var ndim = opts.attributes.length; + var centroid = centroids[c3]; + var newCentroid = new Array(ndim); + var sum2 = new Array(ndim); + for (var d3 = 0; d3 < ndim; d3++) { + sum2[d3] = 0; + for (var i2 = 0; i2 < cluster.length; i2++) { + node2 = cluster[i2]; + sum2[d3] += opts.attributes[d3](node2); + } + newCentroid[d3] = sum2[d3] / cluster.length; + if (!haveValuesConverged(newCentroid[d3], centroid[d3], opts.sensitivityThreshold)) { + isStillMoving = true; + } + } + centroids[c3] = newCentroid; + clusters[c3] = cy.collection(cluster); + } + iterations++; + } + return clusters; + }, "kMeans"); + kMedoids = /* @__PURE__ */ __name(function kMedoids2(options2) { + var cy = this.cy(); + var nodes5 = this.nodes(); + var node2 = null; + var opts = setOptions$2(options2); + var clusters = new Array(opts.k); + var medoids; + var assignment = {}; + var curCost; + var minCosts = new Array(opts.k); + if (opts.testMode) { + if (typeof opts.testCentroids === "number") ; + else if (_typeof(opts.testCentroids) === "object") { + medoids = opts.testCentroids; + } else { + medoids = randomMedoids(nodes5, opts.k); + } + } else { + medoids = randomMedoids(nodes5, opts.k); + } + var isStillMoving = true; + var iterations = 0; + while (isStillMoving && iterations < opts.maxIterations) { + for (var n2 = 0; n2 < nodes5.length; n2++) { + node2 = nodes5[n2]; + assignment[node2.id()] = classify(node2, medoids, opts.distance, opts.attributes, "kMedoids"); + } + isStillMoving = false; + for (var m3 = 0; m3 < medoids.length; m3++) { + var cluster = buildCluster(m3, nodes5, assignment); + if (cluster.length === 0) { + continue; + } + minCosts[m3] = findCost(medoids[m3], cluster, opts.attributes); + for (var _n = 0; _n < cluster.length; _n++) { + curCost = findCost(cluster[_n], cluster, opts.attributes); + if (curCost < minCosts[m3]) { + minCosts[m3] = curCost; + medoids[m3] = cluster[_n]; + isStillMoving = true; + } + } + clusters[m3] = cy.collection(cluster); + } + iterations++; + } + return clusters; + }, "kMedoids"); + updateCentroids = /* @__PURE__ */ __name(function updateCentroids2(centroids, nodes5, U3, weight8, opts) { + var numerator, denominator; + for (var n2 = 0; n2 < nodes5.length; n2++) { + for (var c3 = 0; c3 < centroids.length; c3++) { + weight8[n2][c3] = Math.pow(U3[n2][c3], opts.m); + } + } + for (var _c = 0; _c < centroids.length; _c++) { + for (var dim = 0; dim < opts.attributes.length; dim++) { + numerator = 0; + denominator = 0; + for (var _n2 = 0; _n2 < nodes5.length; _n2++) { + numerator += weight8[_n2][_c] * opts.attributes[dim](nodes5[_n2]); + denominator += weight8[_n2][_c]; + } + centroids[_c][dim] = numerator / denominator; + } + } + }, "updateCentroids"); + updateMembership = /* @__PURE__ */ __name(function updateMembership2(U3, _U, centroids, nodes5, opts) { + for (var i2 = 0; i2 < U3.length; i2++) { + _U[i2] = U3[i2].slice(); + } + var sum2, numerator, denominator; + var pow = 2 / (opts.m - 1); + for (var c3 = 0; c3 < centroids.length; c3++) { + for (var n2 = 0; n2 < nodes5.length; n2++) { + sum2 = 0; + for (var k2 = 0; k2 < centroids.length; k2++) { + numerator = getDist(opts.distance, nodes5[n2], centroids[c3], opts.attributes, "cmeans"); + denominator = getDist(opts.distance, nodes5[n2], centroids[k2], opts.attributes, "cmeans"); + sum2 += Math.pow(numerator / denominator, pow); + } + U3[n2][c3] = 1 / sum2; + } + } + }, "updateMembership"); + assign$1 = /* @__PURE__ */ __name(function assign2(nodes5, U3, opts, cy) { + var clusters = new Array(opts.k); + for (var c3 = 0; c3 < clusters.length; c3++) { + clusters[c3] = []; + } + var max10; + var index; + for (var n2 = 0; n2 < U3.length; n2++) { + max10 = -Infinity; + index = -1; + for (var _c2 = 0; _c2 < U3[0].length; _c2++) { + if (U3[n2][_c2] > max10) { + max10 = U3[n2][_c2]; + index = _c2; + } + } + clusters[index].push(nodes5[n2]); + } + for (var _c3 = 0; _c3 < clusters.length; _c3++) { + clusters[_c3] = cy.collection(clusters[_c3]); + } + return clusters; + }, "assign"); + fuzzyCMeans = /* @__PURE__ */ __name(function fuzzyCMeans2(options2) { + var cy = this.cy(); + var nodes5 = this.nodes(); + var opts = setOptions$2(options2); + var clusters; + var centroids; + var U3; + var _U; + var weight8; + _U = new Array(nodes5.length); + for (var i2 = 0; i2 < nodes5.length; i2++) { + _U[i2] = new Array(opts.k); + } + U3 = new Array(nodes5.length); + for (var _i3 = 0; _i3 < nodes5.length; _i3++) { + U3[_i3] = new Array(opts.k); + } + for (var _i4 = 0; _i4 < nodes5.length; _i4++) { + var total = 0; + for (var j3 = 0; j3 < opts.k; j3++) { + U3[_i4][j3] = Math.random(); + total += U3[_i4][j3]; + } + for (var _j = 0; _j < opts.k; _j++) { + U3[_i4][_j] = U3[_i4][_j] / total; + } + } + centroids = new Array(opts.k); + for (var _i5 = 0; _i5 < opts.k; _i5++) { + centroids[_i5] = new Array(opts.attributes.length); + } + weight8 = new Array(nodes5.length); + for (var _i6 = 0; _i6 < nodes5.length; _i6++) { + weight8[_i6] = new Array(opts.k); + } + var isStillMoving = true; + var iterations = 0; + while (isStillMoving && iterations < opts.maxIterations) { + isStillMoving = false; + updateCentroids(centroids, nodes5, U3, weight8, opts); + updateMembership(U3, _U, centroids, nodes5, opts); + if (!haveMatricesConverged(U3, _U, opts.sensitivityThreshold)) { + isStillMoving = true; + } + iterations++; + } + clusters = assign$1(nodes5, U3, opts, cy); + return { + clusters, + degreeOfMembership: U3 + }; + }, "fuzzyCMeans"); + kClustering = { + kMeans, + kMedoids, + fuzzyCMeans, + fcm: fuzzyCMeans + }; + defaults$a = defaults$g({ + distance: "euclidean", + // distance metric to compare nodes + linkage: "min", + // linkage criterion : how to determine the distance between clusters of nodes + mode: "threshold", + // mode:'threshold' => clusters must be threshold distance apart + threshold: Infinity, + // the distance threshold + // mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters + addDendrogram: false, + // whether to add the dendrogram to the graph for viz + dendrogramDepth: 0, + // depth at which dendrogram branches are merged into the returned clusters + attributes: [] + // array of attr functions + }); + linkageAliases = { + "single": "min", + "complete": "max" + }; + setOptions$1 = /* @__PURE__ */ __name(function setOptions3(options2) { + var opts = defaults$a(options2); + var preferredAlias = linkageAliases[opts.linkage]; + if (preferredAlias != null) { + opts.linkage = preferredAlias; + } + return opts; + }, "setOptions"); + mergeClosest = /* @__PURE__ */ __name(function mergeClosest2(clusters, index, dists, mins, opts) { + var minKey = 0; + var min10 = Infinity; + var dist3; + var attrs = opts.attributes; + var getDist3 = /* @__PURE__ */ __name(function getDist4(n1, n2) { + return clusteringDistance(opts.distance, attrs.length, function(i3) { + return attrs[i3](n1); + }, function(i3) { + return attrs[i3](n2); + }, n1, n2); + }, "getDist"); + for (var i2 = 0; i2 < clusters.length; i2++) { + var key = clusters[i2].key; + var _dist = dists[key][mins[key]]; + if (_dist < min10) { + minKey = key; + min10 = _dist; + } + } + if (opts.mode === "threshold" && min10 >= opts.threshold || opts.mode === "dendrogram" && clusters.length === 1) { + return false; + } + var c1 = index[minKey]; + var c22 = index[mins[minKey]]; + var merged; + if (opts.mode === "dendrogram") { + merged = { + left: c1, + right: c22, + key: c1.key + }; + } else { + merged = { + value: c1.value.concat(c22.value), + key: c1.key + }; + } + clusters[c1.index] = merged; + clusters.splice(c22.index, 1); + index[c1.key] = merged; + for (var _i = 0; _i < clusters.length; _i++) { + var cur = clusters[_i]; + if (c1.key === cur.key) { + dist3 = Infinity; + } else if (opts.linkage === "min") { + dist3 = dists[c1.key][cur.key]; + if (dists[c1.key][cur.key] > dists[c22.key][cur.key]) { + dist3 = dists[c22.key][cur.key]; + } + } else if (opts.linkage === "max") { + dist3 = dists[c1.key][cur.key]; + if (dists[c1.key][cur.key] < dists[c22.key][cur.key]) { + dist3 = dists[c22.key][cur.key]; + } + } else if (opts.linkage === "mean") { + dist3 = (dists[c1.key][cur.key] * c1.size + dists[c22.key][cur.key] * c22.size) / (c1.size + c22.size); + } else { + if (opts.mode === "dendrogram") dist3 = getDist3(cur.value, c1.value); + else dist3 = getDist3(cur.value[0], c1.value[0]); + } + dists[c1.key][cur.key] = dists[cur.key][c1.key] = dist3; + } + for (var _i2 = 0; _i2 < clusters.length; _i2++) { + var key1 = clusters[_i2].key; + if (mins[key1] === c1.key || mins[key1] === c22.key) { + var _min = key1; + for (var j3 = 0; j3 < clusters.length; j3++) { + var key2 = clusters[j3].key; + if (dists[key1][key2] < dists[key1][_min]) { + _min = key2; + } + } + mins[key1] = _min; + } + clusters[_i2].index = _i2; + } + c1.key = c22.key = c1.index = c22.index = null; + return true; + }, "mergeClosest"); + _getAllChildren = /* @__PURE__ */ __name(function getAllChildren(root4, arr, cy) { + if (!root4) return; + if (root4.value) { + arr.push(root4.value); + } else { + if (root4.left) _getAllChildren(root4.left, arr); + if (root4.right) _getAllChildren(root4.right, arr); + } + }, "getAllChildren"); + _buildDendrogram = /* @__PURE__ */ __name(function buildDendrogram(root4, cy) { + if (!root4) return ""; + if (root4.left && root4.right) { + var leftStr = _buildDendrogram(root4.left, cy); + var rightStr = _buildDendrogram(root4.right, cy); + var node2 = cy.add({ + group: "nodes", + data: { + id: leftStr + "," + rightStr + } + }); + cy.add({ + group: "edges", + data: { + source: leftStr, + target: node2.id() + } + }); + cy.add({ + group: "edges", + data: { + source: rightStr, + target: node2.id() + } + }); + return node2.id(); + } else if (root4.value) { + return root4.value.id(); + } + }, "buildDendrogram"); + _buildClustersFromTree = /* @__PURE__ */ __name(function buildClustersFromTree(root4, k2, cy) { + if (!root4) return []; + var left3 = [], right3 = [], leaves = []; + if (k2 === 0) { + if (root4.left) _getAllChildren(root4.left, left3); + if (root4.right) _getAllChildren(root4.right, right3); + leaves = left3.concat(right3); + return [cy.collection(leaves)]; + } else if (k2 === 1) { + if (root4.value) { + return [cy.collection(root4.value)]; + } else { + if (root4.left) _getAllChildren(root4.left, left3); + if (root4.right) _getAllChildren(root4.right, right3); + return [cy.collection(left3), cy.collection(right3)]; + } + } else { + if (root4.value) { + return [cy.collection(root4.value)]; + } else { + if (root4.left) left3 = _buildClustersFromTree(root4.left, k2 - 1, cy); + if (root4.right) right3 = _buildClustersFromTree(root4.right, k2 - 1, cy); + return left3.concat(right3); + } + } + }, "buildClustersFromTree"); + hierarchicalClustering = /* @__PURE__ */ __name(function hierarchicalClustering2(options2) { + var cy = this.cy(); + var nodes5 = this.nodes(); + var opts = setOptions$1(options2); + var attrs = opts.attributes; + var getDist3 = /* @__PURE__ */ __name(function getDist4(n1, n22) { + return clusteringDistance(opts.distance, attrs.length, function(i3) { + return attrs[i3](n1); + }, function(i3) { + return attrs[i3](n22); + }, n1, n22); + }, "getDist"); + var clusters = []; + var dists = []; + var mins = []; + var index = []; + for (var n2 = 0; n2 < nodes5.length; n2++) { + var cluster = { + value: opts.mode === "dendrogram" ? nodes5[n2] : [nodes5[n2]], + key: n2, + index: n2 + }; + clusters[n2] = cluster; + index[n2] = cluster; + dists[n2] = []; + mins[n2] = 0; + } + for (var i2 = 0; i2 < clusters.length; i2++) { + for (var j3 = 0; j3 <= i2; j3++) { + var dist3 = void 0; + if (opts.mode === "dendrogram") { + dist3 = i2 === j3 ? Infinity : getDist3(clusters[i2].value, clusters[j3].value); + } else { + dist3 = i2 === j3 ? Infinity : getDist3(clusters[i2].value[0], clusters[j3].value[0]); + } + dists[i2][j3] = dist3; + dists[j3][i2] = dist3; + if (dist3 < dists[i2][mins[i2]]) { + mins[i2] = j3; + } + } + } + var merged = mergeClosest(clusters, index, dists, mins, opts); + while (merged) { + merged = mergeClosest(clusters, index, dists, mins, opts); + } + var retClusters; + if (opts.mode === "dendrogram") { + retClusters = _buildClustersFromTree(clusters[0], opts.dendrogramDepth, cy); + if (opts.addDendrogram) _buildDendrogram(clusters[0], cy); + } else { + retClusters = new Array(clusters.length); + clusters.forEach(function(cluster2, i3) { + cluster2.key = cluster2.index = null; + retClusters[i3] = cy.collection(cluster2.value); + }); + } + return retClusters; + }, "hierarchicalClustering"); + hierarchicalClustering$1 = { + hierarchicalClustering, + hca: hierarchicalClustering + }; + defaults$9 = defaults$g({ + distance: "euclidean", + // distance metric to compare attributes between two nodes + preference: "median", + // suitability of a data point to serve as an exemplar + damping: 0.8, + // damping factor between [0.5, 1) + maxIterations: 1e3, + // max number of iterations to run + minIterations: 100, + // min number of iterations to run in order for clustering to stop + attributes: [ + // functions to quantify the similarity between any two points + // e.g. node => node.data('weight') + ] + }); + setOptions4 = /* @__PURE__ */ __name(function setOptions5(options2) { + var dmp = options2.damping; + var pref = options2.preference; + if (!(0.5 <= dmp && dmp < 1)) { + error("Damping must range on [0.5, 1). Got: ".concat(dmp)); + } + var validPrefs = ["median", "mean", "min", "max"]; + if (!(validPrefs.some(function(v3) { + return v3 === pref; + }) || number$1(pref))) { + error("Preference must be one of [".concat(validPrefs.map(function(p3) { + return "'".concat(p3, "'"); + }).join(", "), "] or a number. Got: ").concat(pref)); + } + return defaults$9(options2); + }, "setOptions"); + getSimilarity2 = /* @__PURE__ */ __name(function getSimilarity3(type3, n1, n2, attributes) { + var attr = /* @__PURE__ */ __name(function attr2(n3, i2) { + return attributes[i2](n3); + }, "attr"); + return -clusteringDistance(type3, attributes.length, function(i2) { + return attr(n1, i2); + }, function(i2) { + return attr(n2, i2); + }, n1, n2); + }, "getSimilarity"); + getPreference = /* @__PURE__ */ __name(function getPreference2(S4, preference) { + var p3 = null; + if (preference === "median") { + p3 = median(S4); + } else if (preference === "mean") { + p3 = mean(S4); + } else if (preference === "min") { + p3 = min5(S4); + } else if (preference === "max") { + p3 = max5(S4); + } else { + p3 = preference; + } + return p3; + }, "getPreference"); + findExemplars = /* @__PURE__ */ __name(function findExemplars2(n2, R3, A2) { + var indices = []; + for (var i2 = 0; i2 < n2; i2++) { + if (R3[i2 * n2 + i2] + A2[i2 * n2 + i2] > 0) { + indices.push(i2); + } + } + return indices; + }, "findExemplars"); + assignClusters = /* @__PURE__ */ __name(function assignClusters2(n2, S4, exemplars) { + var clusters = []; + for (var i2 = 0; i2 < n2; i2++) { + var index = -1; + var max10 = -Infinity; + for (var ei = 0; ei < exemplars.length; ei++) { + var e3 = exemplars[ei]; + if (S4[i2 * n2 + e3] > max10) { + index = e3; + max10 = S4[i2 * n2 + e3]; + } + } + if (index > 0) { + clusters.push(index); + } + } + for (var _ei = 0; _ei < exemplars.length; _ei++) { + clusters[exemplars[_ei]] = exemplars[_ei]; + } + return clusters; + }, "assignClusters"); + assign3 = /* @__PURE__ */ __name(function assign4(n2, S4, exemplars) { + var clusters = assignClusters(n2, S4, exemplars); + for (var ei = 0; ei < exemplars.length; ei++) { + var ii = []; + for (var c3 = 0; c3 < clusters.length; c3++) { + if (clusters[c3] === exemplars[ei]) { + ii.push(c3); + } + } + var maxI = -1; + var maxSum = -Infinity; + for (var i2 = 0; i2 < ii.length; i2++) { + var sum2 = 0; + for (var j3 = 0; j3 < ii.length; j3++) { + sum2 += S4[ii[j3] * n2 + ii[i2]]; + } + if (sum2 > maxSum) { + maxI = i2; + maxSum = sum2; + } + } + exemplars[ei] = ii[maxI]; + } + clusters = assignClusters(n2, S4, exemplars); + return clusters; + }, "assign"); + affinityPropagation = /* @__PURE__ */ __name(function affinityPropagation2(options2) { + var cy = this.cy(); + var nodes5 = this.nodes(); + var opts = setOptions4(options2); + var id2position = {}; + for (var i2 = 0; i2 < nodes5.length; i2++) { + id2position[nodes5[i2].id()] = i2; + } + var n2; + var n22; + var S4; + var p3; + var R3; + var A2; + n2 = nodes5.length; + n22 = n2 * n2; + S4 = new Array(n22); + for (var _i = 0; _i < n22; _i++) { + S4[_i] = -Infinity; + } + for (var _i2 = 0; _i2 < n2; _i2++) { + for (var j3 = 0; j3 < n2; j3++) { + if (_i2 !== j3) { + S4[_i2 * n2 + j3] = getSimilarity2(opts.distance, nodes5[_i2], nodes5[j3], opts.attributes); + } + } + } + p3 = getPreference(S4, opts.preference); + for (var _i3 = 0; _i3 < n2; _i3++) { + S4[_i3 * n2 + _i3] = p3; + } + R3 = new Array(n22); + for (var _i4 = 0; _i4 < n22; _i4++) { + R3[_i4] = 0; + } + A2 = new Array(n22); + for (var _i5 = 0; _i5 < n22; _i5++) { + A2[_i5] = 0; + } + var old = new Array(n2); + var Rp = new Array(n2); + var se2 = new Array(n2); + for (var _i6 = 0; _i6 < n2; _i6++) { + old[_i6] = 0; + Rp[_i6] = 0; + se2[_i6] = 0; + } + var e3 = new Array(n2 * opts.minIterations); + for (var _i7 = 0; _i7 < e3.length; _i7++) { + e3[_i7] = 0; + } + var iter; + for (iter = 0; iter < opts.maxIterations; iter++) { + for (var _i8 = 0; _i8 < n2; _i8++) { + var max10 = -Infinity, max22 = -Infinity, maxI = -1, AS = 0; + for (var _j = 0; _j < n2; _j++) { + old[_j] = R3[_i8 * n2 + _j]; + AS = A2[_i8 * n2 + _j] + S4[_i8 * n2 + _j]; + if (AS >= max10) { + max22 = max10; + max10 = AS; + maxI = _j; + } else if (AS > max22) { + max22 = AS; + } + } + for (var _j2 = 0; _j2 < n2; _j2++) { + R3[_i8 * n2 + _j2] = (1 - opts.damping) * (S4[_i8 * n2 + _j2] - max10) + opts.damping * old[_j2]; + } + R3[_i8 * n2 + maxI] = (1 - opts.damping) * (S4[_i8 * n2 + maxI] - max22) + opts.damping * old[maxI]; + } + for (var _i9 = 0; _i9 < n2; _i9++) { + var sum2 = 0; + for (var _j3 = 0; _j3 < n2; _j3++) { + old[_j3] = A2[_j3 * n2 + _i9]; + Rp[_j3] = Math.max(0, R3[_j3 * n2 + _i9]); + sum2 += Rp[_j3]; + } + sum2 -= Rp[_i9]; + Rp[_i9] = R3[_i9 * n2 + _i9]; + sum2 += Rp[_i9]; + for (var _j4 = 0; _j4 < n2; _j4++) { + A2[_j4 * n2 + _i9] = (1 - opts.damping) * Math.min(0, sum2 - Rp[_j4]) + opts.damping * old[_j4]; + } + A2[_i9 * n2 + _i9] = (1 - opts.damping) * (sum2 - Rp[_i9]) + opts.damping * old[_i9]; + } + var K5 = 0; + for (var _i10 = 0; _i10 < n2; _i10++) { + var E3 = A2[_i10 * n2 + _i10] + R3[_i10 * n2 + _i10] > 0 ? 1 : 0; + e3[iter % opts.minIterations * n2 + _i10] = E3; + K5 += E3; + } + if (K5 > 0 && (iter >= opts.minIterations - 1 || iter == opts.maxIterations - 1)) { + var _sum = 0; + for (var _i11 = 0; _i11 < n2; _i11++) { + se2[_i11] = 0; + for (var _j5 = 0; _j5 < opts.minIterations; _j5++) { + se2[_i11] += e3[_j5 * n2 + _i11]; + } + if (se2[_i11] === 0 || se2[_i11] === opts.minIterations) { + _sum++; + } + } + if (_sum === n2) { + break; + } + } + } + var exemplarsIndices = findExemplars(n2, R3, A2); + var clusterIndices = assign3(n2, S4, exemplarsIndices); + var clusters = {}; + for (var c3 = 0; c3 < exemplarsIndices.length; c3++) { + clusters[exemplarsIndices[c3]] = []; + } + for (var _i12 = 0; _i12 < nodes5.length; _i12++) { + var pos = id2position[nodes5[_i12].id()]; + var clusterIndex = clusterIndices[pos]; + if (clusterIndex != null) { + clusters[clusterIndex].push(nodes5[_i12]); + } + } + var retClusters = new Array(exemplarsIndices.length); + for (var _c = 0; _c < exemplarsIndices.length; _c++) { + retClusters[_c] = cy.collection(clusters[exemplarsIndices[_c]]); + } + return retClusters; + }, "affinityPropagation"); + affinityPropagation$1 = { + affinityPropagation, + ap: affinityPropagation + }; + hierholzerDefaults = defaults$g({ + root: void 0, + directed: false + }); + elesfn$k = { + hierholzer: /* @__PURE__ */ __name(function hierholzer(options2) { + if (!plainObject(options2)) { + var args = arguments; + options2 = { + root: args[0], + directed: args[1] + }; + } + var _hierholzerDefaults = hierholzerDefaults(options2), root4 = _hierholzerDefaults.root, directed = _hierholzerDefaults.directed; + var eles = this; + var dflag = false; + var oddIn; + var oddOut; + var startVertex; + if (root4) startVertex = string(root4) ? this.filter(root4)[0].id() : root4[0].id(); + var nodes5 = {}; + var edges3 = {}; + if (directed) { + eles.forEach(function(ele) { + var id35 = ele.id(); + if (ele.isNode()) { + var ind = ele.indegree(true); + var outd = ele.outdegree(true); + var d1 = ind - outd; + var d22 = outd - ind; + if (d1 == 1) { + if (oddIn) dflag = true; + else oddIn = id35; + } else if (d22 == 1) { + if (oddOut) dflag = true; + else oddOut = id35; + } else if (d22 > 1 || d1 > 1) { + dflag = true; + } + nodes5[id35] = []; + ele.outgoers().forEach(function(e3) { + if (e3.isEdge()) nodes5[id35].push(e3.id()); + }); + } else { + edges3[id35] = [void 0, ele.target().id()]; + } + }); + } else { + eles.forEach(function(ele) { + var id35 = ele.id(); + if (ele.isNode()) { + var d4 = ele.degree(true); + if (d4 % 2) { + if (!oddIn) oddIn = id35; + else if (!oddOut) oddOut = id35; + else dflag = true; + } + nodes5[id35] = []; + ele.connectedEdges().forEach(function(e3) { + return nodes5[id35].push(e3.id()); + }); + } else { + edges3[id35] = [ele.source().id(), ele.target().id()]; + } + }); + } + var result = { + found: false, + trail: void 0 + }; + if (dflag) return result; + else if (oddOut && oddIn) { + if (directed) { + if (startVertex && oddOut != startVertex) { + return result; + } + startVertex = oddOut; + } else { + if (startVertex && oddOut != startVertex && oddIn != startVertex) { + return result; + } else if (!startVertex) { + startVertex = oddOut; + } + } + } else { + if (!startVertex) startVertex = eles[0].id(); + } + var walk = /* @__PURE__ */ __name(function walk2(v3) { + var currentNode = v3; + var subtour2 = [v3]; + var adj, adjTail, adjHead; + while (nodes5[currentNode].length) { + adj = nodes5[currentNode].shift(); + adjTail = edges3[adj][0]; + adjHead = edges3[adj][1]; + if (currentNode != adjHead) { + nodes5[adjHead] = nodes5[adjHead].filter(function(e3) { + return e3 != adj; + }); + currentNode = adjHead; + } else if (!directed && currentNode != adjTail) { + nodes5[adjTail] = nodes5[adjTail].filter(function(e3) { + return e3 != adj; + }); + currentNode = adjTail; + } + subtour2.unshift(adj); + subtour2.unshift(currentNode); + } + return subtour2; + }, "walk"); + var trail = []; + var subtour = []; + subtour = walk(startVertex); + while (subtour.length != 1) { + if (nodes5[subtour[0]].length == 0) { + trail.unshift(eles.getElementById(subtour.shift())); + trail.unshift(eles.getElementById(subtour.shift())); + } else { + subtour = walk(subtour.shift()).concat(subtour); + } + } + trail.unshift(eles.getElementById(subtour.shift())); + for (var d3 in nodes5) { + if (nodes5[d3].length) { + return result; + } + } + result.found = true; + result.trail = this.spawn(trail, true); + return result; + }, "hierholzer") + }; + hopcroftTarjanBiconnected = /* @__PURE__ */ __name(function hopcroftTarjanBiconnected2() { + var eles = this; + var nodes5 = {}; + var id35 = 0; + var edgeCount3 = 0; + var components3 = []; + var stack = []; + var visitedEdges = {}; + var buildComponent = /* @__PURE__ */ __name(function buildComponent2(x5, y6) { + var i2 = stack.length - 1; + var cutset = []; + var component2 = eles.spawn(); + while (stack[i2].x != x5 || stack[i2].y != y6) { + cutset.push(stack.pop().edge); + i2--; + } + cutset.push(stack.pop().edge); + cutset.forEach(function(edge) { + var connectedNodes = edge.connectedNodes().intersection(eles); + component2.merge(edge); + connectedNodes.forEach(function(node2) { + var nodeId = node2.id(); + var connectedEdges = node2.connectedEdges().intersection(eles); + component2.merge(node2); + if (!nodes5[nodeId].cutVertex) { + component2.merge(connectedEdges); + } else { + component2.merge(connectedEdges.filter(function(edge2) { + return edge2.isLoop(); + })); + } + }); + }); + components3.push(component2); + }, "buildComponent"); + var _biconnectedSearch = /* @__PURE__ */ __name(function biconnectedSearch(root4, currentNode, parent4) { + if (root4 === parent4) edgeCount3 += 1; + nodes5[currentNode] = { + id: id35, + low: id35++, + cutVertex: false + }; + var edges3 = eles.getElementById(currentNode).connectedEdges().intersection(eles); + if (edges3.size() === 0) { + components3.push(eles.spawn(eles.getElementById(currentNode))); + } else { + var sourceId, targetId, otherNodeId, edgeId; + edges3.forEach(function(edge) { + sourceId = edge.source().id(); + targetId = edge.target().id(); + otherNodeId = sourceId === currentNode ? targetId : sourceId; + if (otherNodeId !== parent4) { + edgeId = edge.id(); + if (!visitedEdges[edgeId]) { + visitedEdges[edgeId] = true; + stack.push({ + x: currentNode, + y: otherNodeId, + edge + }); + } + if (!(otherNodeId in nodes5)) { + _biconnectedSearch(root4, otherNodeId, currentNode); + nodes5[currentNode].low = Math.min(nodes5[currentNode].low, nodes5[otherNodeId].low); + if (nodes5[currentNode].id <= nodes5[otherNodeId].low) { + nodes5[currentNode].cutVertex = true; + buildComponent(currentNode, otherNodeId); + } + } else { + nodes5[currentNode].low = Math.min(nodes5[currentNode].low, nodes5[otherNodeId].id); + } + } + }); + } + }, "biconnectedSearch"); + eles.forEach(function(ele) { + if (ele.isNode()) { + var nodeId = ele.id(); + if (!(nodeId in nodes5)) { + edgeCount3 = 0; + _biconnectedSearch(nodeId, nodeId); + nodes5[nodeId].cutVertex = edgeCount3 > 1; + } + } + }); + var cutVertices = Object.keys(nodes5).filter(function(id36) { + return nodes5[id36].cutVertex; + }).map(function(id36) { + return eles.getElementById(id36); + }); + return { + cut: eles.spawn(cutVertices), + components: components3 + }; + }, "hopcroftTarjanBiconnected"); + hopcroftTarjanBiconnected$1 = { + hopcroftTarjanBiconnected, + htbc: hopcroftTarjanBiconnected, + htb: hopcroftTarjanBiconnected, + hopcroftTarjanBiconnectedComponents: hopcroftTarjanBiconnected + }; + tarjanStronglyConnected = /* @__PURE__ */ __name(function tarjanStronglyConnected2() { + var eles = this; + var nodes5 = {}; + var index = 0; + var components3 = []; + var stack = []; + var cut = eles.spawn(eles); + var _stronglyConnectedSearch = /* @__PURE__ */ __name(function stronglyConnectedSearch(sourceNodeId) { + stack.push(sourceNodeId); + nodes5[sourceNodeId] = { + index, + low: index++, + explored: false + }; + var connectedEdges = eles.getElementById(sourceNodeId).connectedEdges().intersection(eles); + connectedEdges.forEach(function(edge) { + var targetNodeId = edge.target().id(); + if (targetNodeId !== sourceNodeId) { + if (!(targetNodeId in nodes5)) { + _stronglyConnectedSearch(targetNodeId); + } + if (!nodes5[targetNodeId].explored) { + nodes5[sourceNodeId].low = Math.min(nodes5[sourceNodeId].low, nodes5[targetNodeId].low); + } + } + }); + if (nodes5[sourceNodeId].index === nodes5[sourceNodeId].low) { + var componentNodes = eles.spawn(); + for (; ; ) { + var nodeId = stack.pop(); + componentNodes.merge(eles.getElementById(nodeId)); + nodes5[nodeId].low = nodes5[sourceNodeId].index; + nodes5[nodeId].explored = true; + if (nodeId === sourceNodeId) { + break; + } + } + var componentEdges = componentNodes.edgesWith(componentNodes); + var component2 = componentNodes.merge(componentEdges); + components3.push(component2); + cut = cut.difference(component2); + } + }, "stronglyConnectedSearch"); + eles.forEach(function(ele) { + if (ele.isNode()) { + var nodeId = ele.id(); + if (!(nodeId in nodes5)) { + _stronglyConnectedSearch(nodeId); + } + } + }); + return { + cut, + components: components3 + }; + }, "tarjanStronglyConnected"); + tarjanStronglyConnected$1 = { + tarjanStronglyConnected, + tsc: tarjanStronglyConnected, + tscc: tarjanStronglyConnected, + tarjanStronglyConnectedComponents: tarjanStronglyConnected + }; + elesfn$j = {}; + [elesfn$v, elesfn$u, elesfn$t, elesfn$s, elesfn$r, elesfn$q, elesfn$p, elesfn$o, elesfn$n, elesfn$m, elesfn$l, markovClustering$1, kClustering, hierarchicalClustering$1, affinityPropagation$1, elesfn$k, hopcroftTarjanBiconnected$1, tarjanStronglyConnected$1].forEach(function(props) { + extend4(elesfn$j, props); + }); + STATE_PENDING = 0; + STATE_FULFILLED = 1; + STATE_REJECTED = 2; + _api = /* @__PURE__ */ __name(function api(executor) { + if (!(this instanceof _api)) return new _api(executor); + this.id = "Thenable/1.0.7"; + this.state = STATE_PENDING; + this.fulfillValue = void 0; + this.rejectReason = void 0; + this.onFulfilled = []; + this.onRejected = []; + this.proxy = { + then: this.then.bind(this) + }; + if (typeof executor === "function") executor.call(this, this.fulfill.bind(this), this.reject.bind(this)); + }, "api"); + _api.prototype = { + /* promise resolving methods */ + fulfill: /* @__PURE__ */ __name(function fulfill(value2) { + return deliver(this, STATE_FULFILLED, "fulfillValue", value2); + }, "fulfill"), + reject: /* @__PURE__ */ __name(function reject(value2) { + return deliver(this, STATE_REJECTED, "rejectReason", value2); + }, "reject"), + /* "The then Method" [Promises/A+ 1.1, 1.2, 2.2] */ + then: /* @__PURE__ */ __name(function then(onFulfilled, onRejected) { + var curr = this; + var next3 = new _api(); + curr.onFulfilled.push(resolver(onFulfilled, next3, "fulfill")); + curr.onRejected.push(resolver(onRejected, next3, "reject")); + execute(curr); + return next3.proxy; + }, "then") + }; + deliver = /* @__PURE__ */ __name(function deliver2(curr, state4, name, value2) { + if (curr.state === STATE_PENDING) { + curr.state = state4; + curr[name] = value2; + execute(curr); + } + return curr; + }, "deliver"); + execute = /* @__PURE__ */ __name(function execute2(curr) { + if (curr.state === STATE_FULFILLED) execute_handlers(curr, "onFulfilled", curr.fulfillValue); + else if (curr.state === STATE_REJECTED) execute_handlers(curr, "onRejected", curr.rejectReason); + }, "execute"); + execute_handlers = /* @__PURE__ */ __name(function execute_handlers2(curr, name, value2) { + if (curr[name].length === 0) return; + var handlers = curr[name]; + curr[name] = []; + var func = /* @__PURE__ */ __name(function func2() { + for (var i2 = 0; i2 < handlers.length; i2++) handlers[i2](value2); + }, "func"); + if (typeof setImmediate === "function") setImmediate(func); + else setTimeout(func, 0); + }, "execute_handlers"); + resolver = /* @__PURE__ */ __name(function resolver2(cb, next3, method) { + return function(value2) { + if (typeof cb !== "function") + next3[method].call(next3, value2); + else { + var result; + try { + result = cb(value2); + } catch (e3) { + next3.reject(e3); + return; + } + _resolve(next3, result); + } + }; + }, "resolver"); + _resolve = /* @__PURE__ */ __name(function resolve(promise4, x5) { + if (promise4 === x5 || promise4.proxy === x5) { + promise4.reject(new TypeError("cannot resolve promise with itself")); + return; + } + var then2; + if (_typeof(x5) === "object" && x5 !== null || typeof x5 === "function") { + try { + then2 = x5.then; + } catch (e3) { + promise4.reject(e3); + return; + } + } + if (typeof then2 === "function") { + var resolved = false; + try { + then2.call( + x5, + /* resolvePromise */ + /* [Promises/A+ 2.3.3.3.1] */ + function(y6) { + if (resolved) return; + resolved = true; + if (y6 === x5) + promise4.reject(new TypeError("circular thenable chain")); + else _resolve(promise4, y6); + }, + /* rejectPromise */ + /* [Promises/A+ 2.3.3.3.2] */ + function(r2) { + if (resolved) return; + resolved = true; + promise4.reject(r2); + } + ); + } catch (e3) { + if (!resolved) + promise4.reject(e3); + } + return; + } + promise4.fulfill(x5); + }, "resolve"); + _api.all = function(ps) { + return new _api(function(resolveAll, rejectAll) { + var vals = new Array(ps.length); + var doneCount = 0; + var fulfill2 = /* @__PURE__ */ __name(function fulfill3(i3, val) { + vals[i3] = val; + doneCount++; + if (doneCount === ps.length) { + resolveAll(vals); + } + }, "fulfill"); + for (var i2 = 0; i2 < ps.length; i2++) { + (function(i3) { + var p3 = ps[i3]; + var isPromise = p3 != null && p3.then != null; + if (isPromise) { + p3.then(function(val2) { + fulfill2(i3, val2); + }, function(err) { + rejectAll(err); + }); + } else { + var val = p3; + fulfill2(i3, val); + } + })(i2); + } + }); + }; + _api.resolve = function(val) { + return new _api(function(resolve2, reject3) { + resolve2(val); + }); + }; + _api.reject = function(val) { + return new _api(function(resolve2, reject3) { + reject3(val); + }); + }; + Promise$1 = typeof Promise !== "undefined" ? Promise : _api; + Animation = /* @__PURE__ */ __name(function Animation2(target, opts, opts2) { + var isCore = core2(target); + var isEle = !isCore; + var _p = this._private = extend4({ + duration: 1e3 + }, opts, opts2); + _p.target = target; + _p.style = _p.style || _p.css; + _p.started = false; + _p.playing = false; + _p.hooked = false; + _p.applying = false; + _p.progress = 0; + _p.completes = []; + _p.frames = []; + if (_p.complete && fn$6(_p.complete)) { + _p.completes.push(_p.complete); + } + if (isEle) { + var pos = target.position(); + _p.startPosition = _p.startPosition || { + x: pos.x, + y: pos.y + }; + _p.startStyle = _p.startStyle || target.cy().style().getAnimationStartStyle(target, _p.style); + } + if (isCore) { + var pan2 = target.pan(); + _p.startPan = { + x: pan2.x, + y: pan2.y + }; + _p.startZoom = target.zoom(); + } + this.length = 1; + this[0] = this; + }, "Animation"); + anifn = Animation.prototype; + extend4(anifn, { + instanceString: /* @__PURE__ */ __name(function instanceString() { + return "animation"; + }, "instanceString"), + hook: /* @__PURE__ */ __name(function hook() { + var _p = this._private; + if (!_p.hooked) { + var q3; + var tAni = _p.target._private.animation; + if (_p.queue) { + q3 = tAni.queue; + } else { + q3 = tAni.current; + } + q3.push(this); + if (elementOrCollection(_p.target)) { + _p.target.cy().addToAnimationPool(_p.target); + } + _p.hooked = true; + } + return this; + }, "hook"), + play: /* @__PURE__ */ __name(function play() { + var _p = this._private; + if (_p.progress === 1) { + _p.progress = 0; + } + _p.playing = true; + _p.started = false; + _p.stopped = false; + this.hook(); + return this; + }, "play"), + playing: /* @__PURE__ */ __name(function playing() { + return this._private.playing; + }, "playing"), + apply: /* @__PURE__ */ __name(function apply3() { + var _p = this._private; + _p.applying = true; + _p.started = false; + _p.stopped = false; + this.hook(); + return this; + }, "apply"), + applying: /* @__PURE__ */ __name(function applying() { + return this._private.applying; + }, "applying"), + pause: /* @__PURE__ */ __name(function pause() { + var _p = this._private; + _p.playing = false; + _p.started = false; + return this; + }, "pause"), + stop: /* @__PURE__ */ __name(function stop() { + var _p = this._private; + _p.playing = false; + _p.started = false; + _p.stopped = true; + return this; + }, "stop"), + rewind: /* @__PURE__ */ __name(function rewind() { + return this.progress(0); + }, "rewind"), + fastforward: /* @__PURE__ */ __name(function fastforward() { + return this.progress(1); + }, "fastforward"), + time: /* @__PURE__ */ __name(function time3(t4) { + var _p = this._private; + if (t4 === void 0) { + return _p.progress * _p.duration; + } else { + return this.progress(t4 / _p.duration); + } + }, "time"), + progress: /* @__PURE__ */ __name(function progress(p3) { + var _p = this._private; + var wasPlaying = _p.playing; + if (p3 === void 0) { + return _p.progress; + } else { + if (wasPlaying) { + this.pause(); + } + _p.progress = p3; + _p.started = false; + if (wasPlaying) { + this.play(); + } + } + return this; + }, "progress"), + completed: /* @__PURE__ */ __name(function completed() { + return this._private.progress === 1; + }, "completed"), + reverse: /* @__PURE__ */ __name(function reverse() { + var _p = this._private; + var wasPlaying = _p.playing; + if (wasPlaying) { + this.pause(); + } + _p.progress = 1 - _p.progress; + _p.started = false; + var swap = /* @__PURE__ */ __name(function swap2(a2, b3) { + var _pa = _p[a2]; + if (_pa == null) { + return; + } + _p[a2] = _p[b3]; + _p[b3] = _pa; + }, "swap"); + swap("zoom", "startZoom"); + swap("pan", "startPan"); + swap("position", "startPosition"); + if (_p.style) { + for (var i2 = 0; i2 < _p.style.length; i2++) { + var prop = _p.style[i2]; + var name = prop.name; + var startStyleProp = _p.startStyle[name]; + _p.startStyle[name] = prop; + _p.style[i2] = startStyleProp; + } + } + if (wasPlaying) { + this.play(); + } + return this; + }, "reverse"), + promise: /* @__PURE__ */ __name(function promise3(type3) { + var _p = this._private; + var arr; + switch (type3) { + case "frame": + arr = _p.frames; + break; + default: + case "complete": + case "completed": + arr = _p.completes; + } + return new Promise$1(function(resolve2, reject3) { + arr.push(function() { + resolve2(); + }); + }); + }, "promise") + }); + anifn.complete = anifn.completed; + anifn.run = anifn.play; + anifn.running = anifn.playing; + define$3 = { + animated: /* @__PURE__ */ __name(function animated() { + return /* @__PURE__ */ __name(function animatedImpl() { + var self2 = this; + var selfIsArrayLike = self2.length !== void 0; + var all = selfIsArrayLike ? self2 : [self2]; + var cy = this._private.cy || this; + if (!cy.styleEnabled()) { + return false; + } + var ele = all[0]; + if (ele) { + return ele._private.animation.current.length > 0; + } + }, "animatedImpl"); + }, "animated"), + // animated + clearQueue: /* @__PURE__ */ __name(function clearQueue() { + return /* @__PURE__ */ __name(function clearQueueImpl() { + var self2 = this; + var selfIsArrayLike = self2.length !== void 0; + var all = selfIsArrayLike ? self2 : [self2]; + var cy = this._private.cy || this; + if (!cy.styleEnabled()) { + return this; + } + for (var i2 = 0; i2 < all.length; i2++) { + var ele = all[i2]; + ele._private.animation.queue = []; + } + return this; + }, "clearQueueImpl"); + }, "clearQueue"), + // clearQueue + delay: /* @__PURE__ */ __name(function delay() { + return /* @__PURE__ */ __name(function delayImpl(time4, complete) { + var cy = this._private.cy || this; + if (!cy.styleEnabled()) { + return this; + } + return this.animate({ + delay: time4, + duration: time4, + complete + }); + }, "delayImpl"); + }, "delay"), + // delay + delayAnimation: /* @__PURE__ */ __name(function delayAnimation() { + return /* @__PURE__ */ __name(function delayAnimationImpl(time4, complete) { + var cy = this._private.cy || this; + if (!cy.styleEnabled()) { + return this; + } + return this.animation({ + delay: time4, + duration: time4, + complete + }); + }, "delayAnimationImpl"); + }, "delayAnimation"), + // delay + animation: /* @__PURE__ */ __name(function animation() { + return /* @__PURE__ */ __name(function animationImpl(properties, params) { + var self2 = this; + var selfIsArrayLike = self2.length !== void 0; + var all = selfIsArrayLike ? self2 : [self2]; + var cy = this._private.cy || this; + var isCore = !selfIsArrayLike; + var isEles = !isCore; + if (!cy.styleEnabled()) { + return this; + } + var style3 = cy.style(); + properties = extend4({}, properties, params); + var propertiesEmpty = Object.keys(properties).length === 0; + if (propertiesEmpty) { + return new Animation(all[0], properties); + } + if (properties.duration === void 0) { + properties.duration = 400; + } + switch (properties.duration) { + case "slow": + properties.duration = 600; + break; + case "fast": + properties.duration = 200; + break; + } + if (isEles) { + properties.style = style3.getPropsList(properties.style || properties.css); + properties.css = void 0; + } + if (isEles && properties.renderedPosition != null) { + var rpos = properties.renderedPosition; + var pan2 = cy.pan(); + var zoom2 = cy.zoom(); + properties.position = renderedToModelPosition(rpos, zoom2, pan2); + } + if (isCore && properties.panBy != null) { + var panBy2 = properties.panBy; + var cyPan = cy.pan(); + properties.pan = { + x: cyPan.x + panBy2.x, + y: cyPan.y + panBy2.y + }; + } + var center4 = properties.center || properties.centre; + if (isCore && center4 != null) { + var centerPan = cy.getCenterPan(center4.eles, properties.zoom); + if (centerPan != null) { + properties.pan = centerPan; + } + } + if (isCore && properties.fit != null) { + var fit2 = properties.fit; + var fitVp = cy.getFitViewport(fit2.eles || fit2.boundingBox, fit2.padding); + if (fitVp != null) { + properties.pan = fitVp.pan; + properties.zoom = fitVp.zoom; + } + } + if (isCore && plainObject(properties.zoom)) { + var vp = cy.getZoomedViewport(properties.zoom); + if (vp != null) { + if (vp.zoomed) { + properties.zoom = vp.zoom; + } + if (vp.panned) { + properties.pan = vp.pan; + } + } else { + properties.zoom = null; + } + } + return new Animation(all[0], properties); + }, "animationImpl"); + }, "animation"), + // animate + animate: /* @__PURE__ */ __name(function animate() { + return /* @__PURE__ */ __name(function animateImpl(properties, params) { + var self2 = this; + var selfIsArrayLike = self2.length !== void 0; + var all = selfIsArrayLike ? self2 : [self2]; + var cy = this._private.cy || this; + if (!cy.styleEnabled()) { + return this; + } + if (params) { + properties = extend4({}, properties, params); + } + for (var i2 = 0; i2 < all.length; i2++) { + var ele = all[i2]; + var queue = ele.animated() && (properties.queue === void 0 || properties.queue); + var ani = ele.animation(properties, queue ? { + queue: true + } : void 0); + ani.play(); + } + return this; + }, "animateImpl"); + }, "animate"), + // animate + stop: /* @__PURE__ */ __name(function stop2() { + return /* @__PURE__ */ __name(function stopImpl(clearQueue2, jumpToEnd) { + var self2 = this; + var selfIsArrayLike = self2.length !== void 0; + var all = selfIsArrayLike ? self2 : [self2]; + var cy = this._private.cy || this; + if (!cy.styleEnabled()) { + return this; + } + for (var i2 = 0; i2 < all.length; i2++) { + var ele = all[i2]; + var _p = ele._private; + var anis = _p.animation.current; + for (var j3 = 0; j3 < anis.length; j3++) { + var ani = anis[j3]; + var ani_p = ani._private; + if (jumpToEnd) { + ani_p.duration = 0; + } + } + if (clearQueue2) { + _p.animation.queue = []; + } + if (!jumpToEnd) { + _p.animation.current = []; + } + } + cy.notify("draw"); + return this; + }, "stopImpl"); + }, "stop") + // stop + }; + __name(requireIsArray, "requireIsArray"); + __name(require_isKey, "require_isKey"); + __name(requireIsFunction, "requireIsFunction"); + __name(require_coreJsData, "require_coreJsData"); + __name(require_isMasked, "require_isMasked"); + __name(require_toSource, "require_toSource"); + __name(require_baseIsNative, "require_baseIsNative"); + __name(require_getValue, "require_getValue"); + __name(require_getNative, "require_getNative"); + __name(require_nativeCreate, "require_nativeCreate"); + __name(require_hashClear, "require_hashClear"); + __name(require_hashDelete, "require_hashDelete"); + __name(require_hashGet, "require_hashGet"); + __name(require_hashHas, "require_hashHas"); + __name(require_hashSet, "require_hashSet"); + __name(require_Hash, "require_Hash"); + __name(require_listCacheClear, "require_listCacheClear"); + __name(requireEq, "requireEq"); + __name(require_assocIndexOf, "require_assocIndexOf"); + __name(require_listCacheDelete, "require_listCacheDelete"); + __name(require_listCacheGet, "require_listCacheGet"); + __name(require_listCacheHas, "require_listCacheHas"); + __name(require_listCacheSet, "require_listCacheSet"); + __name(require_ListCache, "require_ListCache"); + __name(require_Map, "require_Map"); + __name(require_mapCacheClear, "require_mapCacheClear"); + __name(require_isKeyable, "require_isKeyable"); + __name(require_getMapData, "require_getMapData"); + __name(require_mapCacheDelete, "require_mapCacheDelete"); + __name(require_mapCacheGet, "require_mapCacheGet"); + __name(require_mapCacheHas, "require_mapCacheHas"); + __name(require_mapCacheSet, "require_mapCacheSet"); + __name(require_MapCache, "require_MapCache"); + __name(requireMemoize, "requireMemoize"); + __name(require_memoizeCapped, "require_memoizeCapped"); + __name(require_stringToPath, "require_stringToPath"); + __name(require_arrayMap, "require_arrayMap"); + __name(require_baseToString, "require_baseToString"); + __name(requireToString, "requireToString"); + __name(require_castPath, "require_castPath"); + __name(require_toKey, "require_toKey"); + __name(require_baseGet, "require_baseGet"); + __name(requireGet, "requireGet"); + getExports = requireGet(); + get4 = /* @__PURE__ */ getDefaultExportFromCjs(getExports); + __name(require_defineProperty, "require_defineProperty"); + __name(require_baseAssignValue, "require_baseAssignValue"); + __name(require_assignValue, "require_assignValue"); + __name(require_isIndex, "require_isIndex"); + __name(require_baseSet, "require_baseSet"); + __name(requireSet, "requireSet"); + setExports = requireSet(); + set4 = /* @__PURE__ */ getDefaultExportFromCjs(setExports); + __name(require_copyArray, "require_copyArray"); + __name(requireToPath, "requireToPath"); + toPathExports = requireToPath(); + toPath = /* @__PURE__ */ getDefaultExportFromCjs(toPathExports); + define$2 = { + // access data field + data: /* @__PURE__ */ __name(function data(params) { + var defaults5 = { + field: "data", + bindingEvent: "data", + allowBinding: false, + allowSetting: false, + allowGetting: false, + settingEvent: "data", + settingTriggersEvent: false, + triggerFnName: "trigger", + immutableKeys: {}, + // key => true if immutable + updateStyle: false, + beforeGet: /* @__PURE__ */ __name(function beforeGet2(self2) { + }, "beforeGet"), + beforeSet: /* @__PURE__ */ __name(function beforeSet3(self2, obj) { + }, "beforeSet"), + onSet: /* @__PURE__ */ __name(function onSet3(self2) { + }, "onSet"), + canSet: /* @__PURE__ */ __name(function canSet2(self2) { + return true; + }, "canSet") + }; + params = extend4({}, defaults5, params); + return /* @__PURE__ */ __name(function dataImpl(name, value2) { + var p3 = params; + var self2 = this; + var selfIsArrayLike = self2.length !== void 0; + var all = selfIsArrayLike ? self2 : [self2]; + var single = selfIsArrayLike ? self2[0] : self2; + if (string(name)) { + var isPathLike = name.indexOf(".") !== -1; + var path4 = isPathLike && toPath(name); + if (p3.allowGetting && value2 === void 0) { + var ret; + if (single) { + p3.beforeGet(single); + if (path4 && single._private[p3.field][name] === void 0) { + ret = get4(single._private[p3.field], path4); + } else { + ret = single._private[p3.field][name]; + } + } + return ret; + } else if (p3.allowSetting && value2 !== void 0) { + var valid2 = !p3.immutableKeys[name]; + if (valid2) { + var change2 = _defineProperty$1({}, name, value2); + p3.beforeSet(self2, change2); + for (var i2 = 0, l4 = all.length; i2 < l4; i2++) { + var ele = all[i2]; + if (p3.canSet(ele)) { + if (path4 && single._private[p3.field][name] === void 0) { + set4(ele._private[p3.field], path4, value2); + } else { + ele._private[p3.field][name] = value2; + } + } + } + if (p3.updateStyle) { + self2.updateStyle(); + } + p3.onSet(self2); + if (p3.settingTriggersEvent) { + self2[p3.triggerFnName](p3.settingEvent); + } + } + } + } else if (p3.allowSetting && plainObject(name)) { + var obj = name; + var k2, v3; + var keys3 = Object.keys(obj); + p3.beforeSet(self2, obj); + for (var _i = 0; _i < keys3.length; _i++) { + k2 = keys3[_i]; + v3 = obj[k2]; + var _valid = !p3.immutableKeys[k2]; + if (_valid) { + for (var j3 = 0; j3 < all.length; j3++) { + var _ele = all[j3]; + if (p3.canSet(_ele)) { + _ele._private[p3.field][k2] = v3; + } + } + } + } + if (p3.updateStyle) { + self2.updateStyle(); + } + p3.onSet(self2); + if (p3.settingTriggersEvent) { + self2[p3.triggerFnName](p3.settingEvent); + } + } else if (p3.allowBinding && fn$6(name)) { + var fn3 = name; + self2.on(p3.bindingEvent, fn3); + } else if (p3.allowGetting && name === void 0) { + var _ret; + if (single) { + p3.beforeGet(single); + _ret = single._private[p3.field]; + } + return _ret; + } + return self2; + }, "dataImpl"); + }, "data"), + // data + // remove data field + removeData: /* @__PURE__ */ __name(function removeData(params) { + var defaults5 = { + field: "data", + event: "data", + triggerFnName: "trigger", + triggerEvent: false, + immutableKeys: {} + // key => true if immutable + }; + params = extend4({}, defaults5, params); + return /* @__PURE__ */ __name(function removeDataImpl(names) { + var p3 = params; + var self2 = this; + var selfIsArrayLike = self2.length !== void 0; + var all = selfIsArrayLike ? self2 : [self2]; + if (string(names)) { + var keys3 = names.split(/\s+/); + var l4 = keys3.length; + for (var i2 = 0; i2 < l4; i2++) { + var key = keys3[i2]; + if (emptyString(key)) { + continue; + } + var valid2 = !p3.immutableKeys[key]; + if (valid2) { + for (var i_a = 0, l_a = all.length; i_a < l_a; i_a++) { + all[i_a]._private[p3.field][key] = void 0; + } + } + } + if (p3.triggerEvent) { + self2[p3.triggerFnName](p3.event); + } + } else if (names === void 0) { + for (var _i_a = 0, _l_a = all.length; _i_a < _l_a; _i_a++) { + var _privateFields = all[_i_a]._private[p3.field]; + var _keys = Object.keys(_privateFields); + for (var _i2 = 0; _i2 < _keys.length; _i2++) { + var _key = _keys[_i2]; + var validKeyToDelete = !p3.immutableKeys[_key]; + if (validKeyToDelete) { + _privateFields[_key] = void 0; + } + } + } + if (p3.triggerEvent) { + self2[p3.triggerFnName](p3.event); + } + } + return self2; + }, "removeDataImpl"); + }, "removeData") + // removeData + }; + define$1 = { + eventAliasesOn: /* @__PURE__ */ __name(function eventAliasesOn(proto) { + var p3 = proto; + p3.addListener = p3.listen = p3.bind = p3.on; + p3.unlisten = p3.unbind = p3.off = p3.removeListener; + p3.trigger = p3.emit; + p3.pon = p3.promiseOn = function(events, selector) { + var self2 = this; + var args = Array.prototype.slice.call(arguments, 0); + return new Promise$1(function(resolve2, reject3) { + var callback = /* @__PURE__ */ __name(function callback2(e3) { + self2.off.apply(self2, offArgs); + resolve2(e3); + }, "callback"); + var onArgs = args.concat([callback]); + var offArgs = onArgs.concat([]); + self2.on.apply(self2, onArgs); + }); + }; + }, "eventAliasesOn") + }; + define2 = {}; + [define$3, define$2, define$1].forEach(function(m3) { + extend4(define2, m3); + }); + elesfn$i = { + animate: define2.animate(), + animation: define2.animation(), + animated: define2.animated(), + clearQueue: define2.clearQueue(), + delay: define2.delay(), + delayAnimation: define2.delayAnimation(), + stop: define2.stop() + }; + elesfn$h = { + classes: /* @__PURE__ */ __name(function classes(_classes) { + var self2 = this; + if (_classes === void 0) { + var ret = []; + self2[0]._private.classes.forEach(function(cls2) { + return ret.push(cls2); + }); + return ret; + } else if (!array2(_classes)) { + _classes = (_classes || "").match(/\S+/g) || []; + } + var changed = []; + var classesSet = new Set$1(_classes); + for (var j3 = 0; j3 < self2.length; j3++) { + var ele = self2[j3]; + var _p = ele._private; + var eleClasses = _p.classes; + var changedEle = false; + for (var i2 = 0; i2 < _classes.length; i2++) { + var cls = _classes[i2]; + var eleHasClass = eleClasses.has(cls); + if (!eleHasClass) { + changedEle = true; + break; + } + } + if (!changedEle) { + changedEle = eleClasses.size !== _classes.length; + } + if (changedEle) { + _p.classes = classesSet; + changed.push(ele); + } + } + if (changed.length > 0) { + this.spawn(changed).updateStyle().emit("class"); + } + return self2; + }, "classes"), + addClass: /* @__PURE__ */ __name(function addClass(classes3) { + return this.toggleClass(classes3, true); + }, "addClass"), + hasClass: /* @__PURE__ */ __name(function hasClass(className) { + var ele = this[0]; + return ele != null && ele._private.classes.has(className); + }, "hasClass"), + toggleClass: /* @__PURE__ */ __name(function toggleClass(classes3, toggle) { + if (!array2(classes3)) { + classes3 = classes3.match(/\S+/g) || []; + } + var self2 = this; + var toggleUndefd = toggle === void 0; + var changed = []; + for (var i2 = 0, il = self2.length; i2 < il; i2++) { + var ele = self2[i2]; + var eleClasses = ele._private.classes; + var changedEle = false; + for (var j3 = 0; j3 < classes3.length; j3++) { + var cls = classes3[j3]; + var hasClass2 = eleClasses.has(cls); + var changedNow = false; + if (toggle || toggleUndefd && !hasClass2) { + eleClasses.add(cls); + changedNow = true; + } else if (!toggle || toggleUndefd && hasClass2) { + eleClasses["delete"](cls); + changedNow = true; + } + if (!changedEle && changedNow) { + changed.push(ele); + changedEle = true; + } + } + } + if (changed.length > 0) { + this.spawn(changed).updateStyle().emit("class"); + } + return self2; + }, "toggleClass"), + removeClass: /* @__PURE__ */ __name(function removeClass(classes3) { + return this.toggleClass(classes3, false); + }, "removeClass"), + flashClass: /* @__PURE__ */ __name(function flashClass(classes3, duration) { + var self2 = this; + if (duration == null) { + duration = 250; + } else if (duration === 0) { + return self2; + } + self2.addClass(classes3); + setTimeout(function() { + self2.removeClass(classes3); + }, duration); + return self2; + }, "flashClass") + }; + elesfn$h.className = elesfn$h.classNames = elesfn$h.classes; + tokens = { + metaChar: "[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]", + // chars we need to escape in let names, etc + comparatorOp: "=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=", + // binary comparison op (used in data selectors) + boolOp: "\\?|\\!|\\^", + // boolean (unary) operators (used in data selectors) + string: `"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`, + // string literals (used in data selectors) -- doublequotes | singlequotes + number: number6, + // number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123 + meta: "degree|indegree|outdegree", + // allowed metadata fields (i.e. allowed functions to use from Collection) + separator: "\\s*,\\s*", + // queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass + descendant: "\\s+", + child: "\\s+>\\s+", + subject: "\\$", + group: "node|edge|\\*", + directedEdge: "\\s+->\\s+", + undirectedEdge: "\\s+<->\\s+" + }; + tokens.variable = "(?:[\\w-.]|(?:\\\\" + tokens.metaChar + "))+"; + tokens.className = "(?:[\\w-]|(?:\\\\" + tokens.metaChar + "))+"; + tokens.value = tokens.string + "|" + tokens.number; + tokens.id = tokens.variable; + (function() { + var ops, op2, i2; + ops = tokens.comparatorOp.split("|"); + for (i2 = 0; i2 < ops.length; i2++) { + op2 = ops[i2]; + tokens.comparatorOp += "|@" + op2; + } + ops = tokens.comparatorOp.split("|"); + for (i2 = 0; i2 < ops.length; i2++) { + op2 = ops[i2]; + if (op2.indexOf("!") >= 0) { + continue; + } + if (op2 === "=") { + continue; + } + tokens.comparatorOp += "|\\!" + op2; + } + })(); + newQuery = /* @__PURE__ */ __name(function newQuery2() { + return { + checks: [] + }; + }, "newQuery"); + Type2 = { + /** E.g. node */ + GROUP: 0, + /** A collection of elements */ + COLLECTION: 1, + /** A filter(ele) function */ + FILTER: 2, + /** E.g. [foo > 1] */ + DATA_COMPARE: 3, + /** E.g. [foo] */ + DATA_EXIST: 4, + /** E.g. [?foo] */ + DATA_BOOL: 5, + /** E.g. [[degree > 2]] */ + META_COMPARE: 6, + /** E.g. :selected */ + STATE: 7, + /** E.g. #foo */ + ID: 8, + /** E.g. .foo */ + CLASS: 9, + /** E.g. #foo <-> #bar */ + UNDIRECTED_EDGE: 10, + /** E.g. #foo -> #bar */ + DIRECTED_EDGE: 11, + /** E.g. $#foo -> #bar */ + NODE_SOURCE: 12, + /** E.g. #foo -> $#bar */ + NODE_TARGET: 13, + /** E.g. $#foo <-> #bar */ + NODE_NEIGHBOR: 14, + /** E.g. #foo > #bar */ + CHILD: 15, + /** E.g. #foo #bar */ + DESCENDANT: 16, + /** E.g. $#foo > #bar */ + PARENT: 17, + /** E.g. $#foo #bar */ + ANCESTOR: 18, + /** E.g. #foo > $bar > #baz */ + COMPOUND_SPLIT: 19, + /** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */ + TRUE: 20 + }; + stateSelectors = [{ + selector: ":selected", + matches: /* @__PURE__ */ __name(function matches(ele) { + return ele.selected(); + }, "matches") + }, { + selector: ":unselected", + matches: /* @__PURE__ */ __name(function matches2(ele) { + return !ele.selected(); + }, "matches") + }, { + selector: ":selectable", + matches: /* @__PURE__ */ __name(function matches3(ele) { + return ele.selectable(); + }, "matches") + }, { + selector: ":unselectable", + matches: /* @__PURE__ */ __name(function matches4(ele) { + return !ele.selectable(); + }, "matches") + }, { + selector: ":locked", + matches: /* @__PURE__ */ __name(function matches5(ele) { + return ele.locked(); + }, "matches") + }, { + selector: ":unlocked", + matches: /* @__PURE__ */ __name(function matches6(ele) { + return !ele.locked(); + }, "matches") + }, { + selector: ":visible", + matches: /* @__PURE__ */ __name(function matches7(ele) { + return ele.visible(); + }, "matches") + }, { + selector: ":hidden", + matches: /* @__PURE__ */ __name(function matches8(ele) { + return !ele.visible(); + }, "matches") + }, { + selector: ":transparent", + matches: /* @__PURE__ */ __name(function matches9(ele) { + return ele.transparent(); + }, "matches") + }, { + selector: ":grabbed", + matches: /* @__PURE__ */ __name(function matches10(ele) { + return ele.grabbed(); + }, "matches") + }, { + selector: ":free", + matches: /* @__PURE__ */ __name(function matches11(ele) { + return !ele.grabbed(); + }, "matches") + }, { + selector: ":removed", + matches: /* @__PURE__ */ __name(function matches12(ele) { + return ele.removed(); + }, "matches") + }, { + selector: ":inside", + matches: /* @__PURE__ */ __name(function matches13(ele) { + return !ele.removed(); + }, "matches") + }, { + selector: ":grabbable", + matches: /* @__PURE__ */ __name(function matches14(ele) { + return ele.grabbable(); + }, "matches") + }, { + selector: ":ungrabbable", + matches: /* @__PURE__ */ __name(function matches15(ele) { + return !ele.grabbable(); + }, "matches") + }, { + selector: ":animated", + matches: /* @__PURE__ */ __name(function matches16(ele) { + return ele.animated(); + }, "matches") + }, { + selector: ":unanimated", + matches: /* @__PURE__ */ __name(function matches17(ele) { + return !ele.animated(); + }, "matches") + }, { + selector: ":parent", + matches: /* @__PURE__ */ __name(function matches18(ele) { + return ele.isParent(); + }, "matches") + }, { + selector: ":childless", + matches: /* @__PURE__ */ __name(function matches19(ele) { + return ele.isChildless(); + }, "matches") + }, { + selector: ":child", + matches: /* @__PURE__ */ __name(function matches20(ele) { + return ele.isChild(); + }, "matches") + }, { + selector: ":orphan", + matches: /* @__PURE__ */ __name(function matches21(ele) { + return ele.isOrphan(); + }, "matches") + }, { + selector: ":nonorphan", + matches: /* @__PURE__ */ __name(function matches22(ele) { + return ele.isChild(); + }, "matches") + }, { + selector: ":compound", + matches: /* @__PURE__ */ __name(function matches23(ele) { + if (ele.isNode()) { + return ele.isParent(); + } else { + return ele.source().isParent() || ele.target().isParent(); + } + }, "matches") + }, { + selector: ":loop", + matches: /* @__PURE__ */ __name(function matches24(ele) { + return ele.isLoop(); + }, "matches") + }, { + selector: ":simple", + matches: /* @__PURE__ */ __name(function matches25(ele) { + return ele.isSimple(); + }, "matches") + }, { + selector: ":active", + matches: /* @__PURE__ */ __name(function matches26(ele) { + return ele.active(); + }, "matches") + }, { + selector: ":inactive", + matches: /* @__PURE__ */ __name(function matches27(ele) { + return !ele.active(); + }, "matches") + }, { + selector: ":backgrounding", + matches: /* @__PURE__ */ __name(function matches28(ele) { + return ele.backgrounding(); + }, "matches") + }, { + selector: ":nonbackgrounding", + matches: /* @__PURE__ */ __name(function matches29(ele) { + return !ele.backgrounding(); + }, "matches") + }].sort(function(a2, b3) { + return descending2(a2.selector, b3.selector); + }); + lookup = (function() { + var selToFn = {}; + var s2; + for (var i2 = 0; i2 < stateSelectors.length; i2++) { + s2 = stateSelectors[i2]; + selToFn[s2.selector] = s2.matches; + } + return selToFn; + })(); + stateSelectorMatches = /* @__PURE__ */ __name(function stateSelectorMatches2(sel, ele) { + return lookup[sel](ele); + }, "stateSelectorMatches"); + stateSelectorRegex = "(" + stateSelectors.map(function(s2) { + return s2.selector; + }).join("|") + ")"; + cleanMetaChars = /* @__PURE__ */ __name(function cleanMetaChars2(str2) { + return str2.replace(new RegExp("\\\\(" + tokens.metaChar + ")", "g"), function(match3, $1) { + return $1; + }); + }, "cleanMetaChars"); + replaceLastQuery = /* @__PURE__ */ __name(function replaceLastQuery2(selector, examiningQuery, replacementQuery) { + selector[selector.length - 1] = replacementQuery; + }, "replaceLastQuery"); + exprs = [{ + name: "group", + // just used for identifying when debugging + query: true, + regex: "(" + tokens.group + ")", + populate: /* @__PURE__ */ __name(function populate(selector, query, _ref) { + var _ref2 = _slicedToArray(_ref, 1), group2 = _ref2[0]; + query.checks.push({ + type: Type2.GROUP, + value: group2 === "*" ? group2 : group2 + "s" + }); + }, "populate") + }, { + name: "state", + query: true, + regex: stateSelectorRegex, + populate: /* @__PURE__ */ __name(function populate2(selector, query, _ref3) { + var _ref4 = _slicedToArray(_ref3, 1), state4 = _ref4[0]; + query.checks.push({ + type: Type2.STATE, + value: state4 + }); + }, "populate") + }, { + name: "id", + query: true, + regex: "\\#(" + tokens.id + ")", + populate: /* @__PURE__ */ __name(function populate3(selector, query, _ref5) { + var _ref6 = _slicedToArray(_ref5, 1), id35 = _ref6[0]; + query.checks.push({ + type: Type2.ID, + value: cleanMetaChars(id35) + }); + }, "populate") + }, { + name: "className", + query: true, + regex: "\\.(" + tokens.className + ")", + populate: /* @__PURE__ */ __name(function populate4(selector, query, _ref7) { + var _ref8 = _slicedToArray(_ref7, 1), className = _ref8[0]; + query.checks.push({ + type: Type2.CLASS, + value: cleanMetaChars(className) + }); + }, "populate") + }, { + name: "dataExists", + query: true, + regex: "\\[\\s*(" + tokens.variable + ")\\s*\\]", + populate: /* @__PURE__ */ __name(function populate5(selector, query, _ref9) { + var _ref10 = _slicedToArray(_ref9, 1), variable = _ref10[0]; + query.checks.push({ + type: Type2.DATA_EXIST, + field: cleanMetaChars(variable) + }); + }, "populate") + }, { + name: "dataCompare", + query: true, + regex: "\\[\\s*(" + tokens.variable + ")\\s*(" + tokens.comparatorOp + ")\\s*(" + tokens.value + ")\\s*\\]", + populate: /* @__PURE__ */ __name(function populate6(selector, query, _ref11) { + var _ref12 = _slicedToArray(_ref11, 3), variable = _ref12[0], comparatorOp = _ref12[1], value2 = _ref12[2]; + var valueIsString = new RegExp("^" + tokens.string + "$").exec(value2) != null; + if (valueIsString) { + value2 = value2.substring(1, value2.length - 1); + } else { + value2 = parseFloat(value2); + } + query.checks.push({ + type: Type2.DATA_COMPARE, + field: cleanMetaChars(variable), + operator: comparatorOp, + value: value2 + }); + }, "populate") + }, { + name: "dataBool", + query: true, + regex: "\\[\\s*(" + tokens.boolOp + ")\\s*(" + tokens.variable + ")\\s*\\]", + populate: /* @__PURE__ */ __name(function populate7(selector, query, _ref13) { + var _ref14 = _slicedToArray(_ref13, 2), boolOp = _ref14[0], variable = _ref14[1]; + query.checks.push({ + type: Type2.DATA_BOOL, + field: cleanMetaChars(variable), + operator: boolOp + }); + }, "populate") + }, { + name: "metaCompare", + query: true, + regex: "\\[\\[\\s*(" + tokens.meta + ")\\s*(" + tokens.comparatorOp + ")\\s*(" + tokens.number + ")\\s*\\]\\]", + populate: /* @__PURE__ */ __name(function populate8(selector, query, _ref15) { + var _ref16 = _slicedToArray(_ref15, 3), meta3 = _ref16[0], comparatorOp = _ref16[1], number7 = _ref16[2]; + query.checks.push({ + type: Type2.META_COMPARE, + field: cleanMetaChars(meta3), + operator: comparatorOp, + value: parseFloat(number7) + }); + }, "populate") + }, { + name: "nextQuery", + separator: true, + regex: tokens.separator, + populate: /* @__PURE__ */ __name(function populate9(selector, query) { + var currentSubject = selector.currentSubject; + var edgeCount3 = selector.edgeCount; + var compoundCount = selector.compoundCount; + var lastQ = selector[selector.length - 1]; + if (currentSubject != null) { + lastQ.subject = currentSubject; + selector.currentSubject = null; + } + lastQ.edgeCount = edgeCount3; + lastQ.compoundCount = compoundCount; + selector.edgeCount = 0; + selector.compoundCount = 0; + var nextQuery = selector[selector.length++] = newQuery(); + return nextQuery; + }, "populate") + }, { + name: "directedEdge", + separator: true, + regex: tokens.directedEdge, + populate: /* @__PURE__ */ __name(function populate10(selector, query) { + if (selector.currentSubject == null) { + var edgeQuery = newQuery(); + var source = query; + var target = newQuery(); + edgeQuery.checks.push({ + type: Type2.DIRECTED_EDGE, + source, + target + }); + replaceLastQuery(selector, query, edgeQuery); + selector.edgeCount++; + return target; + } else { + var srcTgtQ = newQuery(); + var _source = query; + var _target = newQuery(); + srcTgtQ.checks.push({ + type: Type2.NODE_SOURCE, + source: _source, + target: _target + }); + replaceLastQuery(selector, query, srcTgtQ); + selector.edgeCount++; + return _target; + } + }, "populate") + }, { + name: "undirectedEdge", + separator: true, + regex: tokens.undirectedEdge, + populate: /* @__PURE__ */ __name(function populate11(selector, query) { + if (selector.currentSubject == null) { + var edgeQuery = newQuery(); + var source = query; + var target = newQuery(); + edgeQuery.checks.push({ + type: Type2.UNDIRECTED_EDGE, + nodes: [source, target] + }); + replaceLastQuery(selector, query, edgeQuery); + selector.edgeCount++; + return target; + } else { + var nhoodQ = newQuery(); + var node2 = query; + var neighbor = newQuery(); + nhoodQ.checks.push({ + type: Type2.NODE_NEIGHBOR, + node: node2, + neighbor + }); + replaceLastQuery(selector, query, nhoodQ); + return neighbor; + } + }, "populate") + }, { + name: "child", + separator: true, + regex: tokens.child, + populate: /* @__PURE__ */ __name(function populate12(selector, query) { + if (selector.currentSubject == null) { + var parentChildQuery = newQuery(); + var child = newQuery(); + var parent4 = selector[selector.length - 1]; + parentChildQuery.checks.push({ + type: Type2.CHILD, + parent: parent4, + child + }); + replaceLastQuery(selector, query, parentChildQuery); + selector.compoundCount++; + return child; + } else if (selector.currentSubject === query) { + var compound = newQuery(); + var left3 = selector[selector.length - 1]; + var right3 = newQuery(); + var subject = newQuery(); + var _child = newQuery(); + var _parent = newQuery(); + compound.checks.push({ + type: Type2.COMPOUND_SPLIT, + left: left3, + right: right3, + subject + }); + subject.checks = query.checks; + query.checks = [{ + type: Type2.TRUE + }]; + _parent.checks.push({ + type: Type2.TRUE + }); + right3.checks.push({ + type: Type2.PARENT, + // type is swapped on right side queries + parent: _parent, + child: _child + // empty for now + }); + replaceLastQuery(selector, left3, compound); + selector.currentSubject = subject; + selector.compoundCount++; + return _child; + } else { + var _parent2 = newQuery(); + var _child2 = newQuery(); + var pcQChecks = [{ + type: Type2.PARENT, + parent: _parent2, + child: _child2 + }]; + _parent2.checks = query.checks; + query.checks = pcQChecks; + selector.compoundCount++; + return _child2; + } + }, "populate") + }, { + name: "descendant", + separator: true, + regex: tokens.descendant, + populate: /* @__PURE__ */ __name(function populate13(selector, query) { + if (selector.currentSubject == null) { + var ancChQuery = newQuery(); + var descendant = newQuery(); + var ancestor = selector[selector.length - 1]; + ancChQuery.checks.push({ + type: Type2.DESCENDANT, + ancestor, + descendant + }); + replaceLastQuery(selector, query, ancChQuery); + selector.compoundCount++; + return descendant; + } else if (selector.currentSubject === query) { + var compound = newQuery(); + var left3 = selector[selector.length - 1]; + var right3 = newQuery(); + var subject = newQuery(); + var _descendant = newQuery(); + var _ancestor = newQuery(); + compound.checks.push({ + type: Type2.COMPOUND_SPLIT, + left: left3, + right: right3, + subject + }); + subject.checks = query.checks; + query.checks = [{ + type: Type2.TRUE + }]; + _ancestor.checks.push({ + type: Type2.TRUE + }); + right3.checks.push({ + type: Type2.ANCESTOR, + // type is swapped on right side queries + ancestor: _ancestor, + descendant: _descendant + // empty for now + }); + replaceLastQuery(selector, left3, compound); + selector.currentSubject = subject; + selector.compoundCount++; + return _descendant; + } else { + var _ancestor2 = newQuery(); + var _descendant2 = newQuery(); + var adQChecks = [{ + type: Type2.ANCESTOR, + ancestor: _ancestor2, + descendant: _descendant2 + }]; + _ancestor2.checks = query.checks; + query.checks = adQChecks; + selector.compoundCount++; + return _descendant2; + } + }, "populate") + }, { + name: "subject", + modifier: true, + regex: tokens.subject, + populate: /* @__PURE__ */ __name(function populate14(selector, query) { + if (selector.currentSubject != null && selector.currentSubject !== query) { + warn("Redefinition of subject in selector `" + selector.toString() + "`"); + return false; + } + selector.currentSubject = query; + var topQ = selector[selector.length - 1]; + var topChk = topQ.checks[0]; + var topType = topChk == null ? null : topChk.type; + if (topType === Type2.DIRECTED_EDGE) { + topChk.type = Type2.NODE_TARGET; + } else if (topType === Type2.UNDIRECTED_EDGE) { + topChk.type = Type2.NODE_NEIGHBOR; + topChk.node = topChk.nodes[1]; + topChk.neighbor = topChk.nodes[0]; + topChk.nodes = null; + } + }, "populate") + }]; + exprs.forEach(function(e3) { + return e3.regexObj = new RegExp("^" + e3.regex); + }); + consumeExpr = /* @__PURE__ */ __name(function consumeExpr2(remaining) { + var expr; + var match3; + var name; + for (var j3 = 0; j3 < exprs.length; j3++) { + var e3 = exprs[j3]; + var n2 = e3.name; + var m3 = remaining.match(e3.regexObj); + if (m3 != null) { + match3 = m3; + expr = e3; + name = n2; + var consumed = m3[0]; + remaining = remaining.substring(consumed.length); + break; + } + } + return { + expr, + match: match3, + name, + remaining + }; + }, "consumeExpr"); + consumeWhitespace = /* @__PURE__ */ __name(function consumeWhitespace2(remaining) { + var match3 = remaining.match(/^\s+/); + if (match3) { + var consumed = match3[0]; + remaining = remaining.substring(consumed.length); + } + return remaining; + }, "consumeWhitespace"); + parse = /* @__PURE__ */ __name(function parse2(selector) { + var self2 = this; + var remaining = self2.inputText = selector; + var currentQuery = self2[0] = newQuery(); + self2.length = 1; + remaining = consumeWhitespace(remaining); + for (; ; ) { + var exprInfo = consumeExpr(remaining); + if (exprInfo.expr == null) { + warn("The selector `" + selector + "`is invalid"); + return false; + } else { + var args = exprInfo.match.slice(1); + var ret = exprInfo.expr.populate(self2, currentQuery, args); + if (ret === false) { + return false; + } else if (ret != null) { + currentQuery = ret; + } + } + remaining = exprInfo.remaining; + if (remaining.match(/^\s*$/)) { + break; + } + } + var lastQ = self2[self2.length - 1]; + if (self2.currentSubject != null) { + lastQ.subject = self2.currentSubject; + } + lastQ.edgeCount = self2.edgeCount; + lastQ.compoundCount = self2.compoundCount; + for (var i2 = 0; i2 < self2.length; i2++) { + var q3 = self2[i2]; + if (q3.compoundCount > 0 && q3.edgeCount > 0) { + warn("The selector `" + selector + "` is invalid because it uses both a compound selector and an edge selector"); + return false; + } + if (q3.edgeCount > 1) { + warn("The selector `" + selector + "` is invalid because it uses multiple edge selectors"); + return false; + } else if (q3.edgeCount === 1) { + warn("The selector `" + selector + "` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes."); + } + } + return true; + }, "parse"); + toString3 = /* @__PURE__ */ __name(function toString4() { + if (this.toStringCache != null) { + return this.toStringCache; + } + var clean = /* @__PURE__ */ __name(function clean2(obj) { + if (obj == null) { + return ""; + } else { + return obj; + } + }, "clean"); + var cleanVal = /* @__PURE__ */ __name(function cleanVal2(val) { + if (string(val)) { + return '"' + val + '"'; + } else { + return clean(val); + } + }, "cleanVal"); + var space = /* @__PURE__ */ __name(function space2(val) { + return " " + val + " "; + }, "space"); + var checkToString = /* @__PURE__ */ __name(function checkToString2(check, subject) { + var type3 = check.type, value2 = check.value; + switch (type3) { + case Type2.GROUP: { + var group2 = clean(value2); + return group2.substring(0, group2.length - 1); + } + case Type2.DATA_COMPARE: { + var field = check.field, operator = check.operator; + return "[" + field + space(clean(operator)) + cleanVal(value2) + "]"; + } + case Type2.DATA_BOOL: { + var _operator = check.operator, _field = check.field; + return "[" + clean(_operator) + _field + "]"; + } + case Type2.DATA_EXIST: { + var _field2 = check.field; + return "[" + _field2 + "]"; + } + case Type2.META_COMPARE: { + var _operator2 = check.operator, _field3 = check.field; + return "[[" + _field3 + space(clean(_operator2)) + cleanVal(value2) + "]]"; + } + case Type2.STATE: { + return value2; + } + case Type2.ID: { + return "#" + value2; + } + case Type2.CLASS: { + return "." + value2; + } + case Type2.PARENT: + case Type2.CHILD: { + return queryToString(check.parent, subject) + space(">") + queryToString(check.child, subject); + } + case Type2.ANCESTOR: + case Type2.DESCENDANT: { + return queryToString(check.ancestor, subject) + " " + queryToString(check.descendant, subject); + } + case Type2.COMPOUND_SPLIT: { + var lhs = queryToString(check.left, subject); + var sub2 = queryToString(check.subject, subject); + var rhs = queryToString(check.right, subject); + return lhs + (lhs.length > 0 ? " " : "") + sub2 + rhs; + } + case Type2.TRUE: { + return ""; + } + } + }, "checkToString"); + var queryToString = /* @__PURE__ */ __name(function queryToString2(query2, subject) { + return query2.checks.reduce(function(str3, chk, i3) { + return str3 + (subject === query2 && i3 === 0 ? "$" : "") + checkToString(chk, subject); + }, ""); + }, "queryToString"); + var str2 = ""; + for (var i2 = 0; i2 < this.length; i2++) { + var query = this[i2]; + str2 += queryToString(query, query.subject); + if (this.length > 1 && i2 < this.length - 1) { + str2 += ", "; + } + } + this.toStringCache = str2; + return str2; + }, "toString"); + parse$1 = { + parse, + toString: toString3 + }; + valCmp = /* @__PURE__ */ __name(function valCmp2(fieldVal, operator, value2) { + var matches33; + var isFieldStr = string(fieldVal); + var isFieldNum = number$1(fieldVal); + var isValStr = string(value2); + var fieldStr, valStr; + var caseInsensitive = false; + var notExpr = false; + var isIneqCmp = false; + if (operator.indexOf("!") >= 0) { + operator = operator.replace("!", ""); + notExpr = true; + } + if (operator.indexOf("@") >= 0) { + operator = operator.replace("@", ""); + caseInsensitive = true; + } + if (isFieldStr || isValStr || caseInsensitive) { + fieldStr = !isFieldStr && !isFieldNum ? "" : "" + fieldVal; + valStr = "" + value2; + } + if (caseInsensitive) { + fieldVal = fieldStr = fieldStr.toLowerCase(); + value2 = valStr = valStr.toLowerCase(); + } + switch (operator) { + case "*=": + matches33 = fieldStr.indexOf(valStr) >= 0; + break; + case "$=": + matches33 = fieldStr.indexOf(valStr, fieldStr.length - valStr.length) >= 0; + break; + case "^=": + matches33 = fieldStr.indexOf(valStr) === 0; + break; + case "=": + matches33 = fieldVal === value2; + break; + case ">": + isIneqCmp = true; + matches33 = fieldVal > value2; + break; + case ">=": + isIneqCmp = true; + matches33 = fieldVal >= value2; + break; + case "<": + isIneqCmp = true; + matches33 = fieldVal < value2; + break; + case "<=": + isIneqCmp = true; + matches33 = fieldVal <= value2; + break; + default: + matches33 = false; + break; + } + if (notExpr && (fieldVal != null || !isIneqCmp)) { + matches33 = !matches33; + } + return matches33; + }, "valCmp"); + boolCmp = /* @__PURE__ */ __name(function boolCmp2(fieldVal, operator) { + switch (operator) { + case "?": + return fieldVal ? true : false; + case "!": + return fieldVal ? false : true; + case "^": + return fieldVal === void 0; + } + }, "boolCmp"); + existCmp = /* @__PURE__ */ __name(function existCmp2(fieldVal) { + return fieldVal !== void 0; + }, "existCmp"); + data$1 = /* @__PURE__ */ __name(function data2(ele, field) { + return ele.data(field); + }, "data"); + meta = /* @__PURE__ */ __name(function meta2(ele, field) { + return ele[field](); + }, "meta"); + match = []; + matches$1 = /* @__PURE__ */ __name(function matches30(query, ele) { + return query.checks.every(function(chk) { + return match[chk.type](chk, ele); + }); + }, "matches"); + match[Type2.GROUP] = function(check, ele) { + var group2 = check.value; + return group2 === "*" || group2 === ele.group(); + }; + match[Type2.STATE] = function(check, ele) { + var stateSelector = check.value; + return stateSelectorMatches(stateSelector, ele); + }; + match[Type2.ID] = function(check, ele) { + var id35 = check.value; + return ele.id() === id35; + }; + match[Type2.CLASS] = function(check, ele) { + var cls = check.value; + return ele.hasClass(cls); + }; + match[Type2.META_COMPARE] = function(check, ele) { + var field = check.field, operator = check.operator, value2 = check.value; + return valCmp(meta(ele, field), operator, value2); + }; + match[Type2.DATA_COMPARE] = function(check, ele) { + var field = check.field, operator = check.operator, value2 = check.value; + return valCmp(data$1(ele, field), operator, value2); + }; + match[Type2.DATA_BOOL] = function(check, ele) { + var field = check.field, operator = check.operator; + return boolCmp(data$1(ele, field), operator); + }; + match[Type2.DATA_EXIST] = function(check, ele) { + var field = check.field; + check.operator; + return existCmp(data$1(ele, field)); + }; + match[Type2.UNDIRECTED_EDGE] = function(check, ele) { + var qA = check.nodes[0]; + var qB = check.nodes[1]; + var src = ele.source(); + var tgt = ele.target(); + return matches$1(qA, src) && matches$1(qB, tgt) || matches$1(qB, src) && matches$1(qA, tgt); + }; + match[Type2.NODE_NEIGHBOR] = function(check, ele) { + return matches$1(check.node, ele) && ele.neighborhood().some(function(n2) { + return n2.isNode() && matches$1(check.neighbor, n2); + }); + }; + match[Type2.DIRECTED_EDGE] = function(check, ele) { + return matches$1(check.source, ele.source()) && matches$1(check.target, ele.target()); + }; + match[Type2.NODE_SOURCE] = function(check, ele) { + return matches$1(check.source, ele) && ele.outgoers().some(function(n2) { + return n2.isNode() && matches$1(check.target, n2); + }); + }; + match[Type2.NODE_TARGET] = function(check, ele) { + return matches$1(check.target, ele) && ele.incomers().some(function(n2) { + return n2.isNode() && matches$1(check.source, n2); + }); + }; + match[Type2.CHILD] = function(check, ele) { + return matches$1(check.child, ele) && matches$1(check.parent, ele.parent()); + }; + match[Type2.PARENT] = function(check, ele) { + return matches$1(check.parent, ele) && ele.children().some(function(c3) { + return matches$1(check.child, c3); + }); + }; + match[Type2.DESCENDANT] = function(check, ele) { + return matches$1(check.descendant, ele) && ele.ancestors().some(function(a2) { + return matches$1(check.ancestor, a2); + }); + }; + match[Type2.ANCESTOR] = function(check, ele) { + return matches$1(check.ancestor, ele) && ele.descendants().some(function(d3) { + return matches$1(check.descendant, d3); + }); + }; + match[Type2.COMPOUND_SPLIT] = function(check, ele) { + return matches$1(check.subject, ele) && matches$1(check.left, ele) && matches$1(check.right, ele); + }; + match[Type2.TRUE] = function() { + return true; + }; + match[Type2.COLLECTION] = function(check, ele) { + var collection4 = check.value; + return collection4.has(ele); + }; + match[Type2.FILTER] = function(check, ele) { + var filter8 = check.value; + return filter8(ele); + }; + filter3 = /* @__PURE__ */ __name(function filter4(collection4) { + var self2 = this; + if (self2.length === 1 && self2[0].checks.length === 1 && self2[0].checks[0].type === Type2.ID) { + return collection4.getElementById(self2[0].checks[0].value).collection(); + } + var selectorFunction = /* @__PURE__ */ __name(function selectorFunction2(element3) { + for (var j3 = 0; j3 < self2.length; j3++) { + var query = self2[j3]; + if (matches$1(query, element3)) { + return true; + } + } + return false; + }, "selectorFunction"); + if (self2.text() == null) { + selectorFunction = /* @__PURE__ */ __name(function selectorFunction2() { + return true; + }, "selectorFunction"); + } + return collection4.filter(selectorFunction); + }, "filter"); + matches31 = /* @__PURE__ */ __name(function matches32(ele) { + var self2 = this; + for (var j3 = 0; j3 < self2.length; j3++) { + var query = self2[j3]; + if (matches$1(query, ele)) { + return true; + } + } + return false; + }, "matches"); + matching = { + matches: matches31, + filter: filter3 + }; + Selector = /* @__PURE__ */ __name(function Selector2(selector) { + this.inputText = selector; + this.currentSubject = null; + this.compoundCount = 0; + this.edgeCount = 0; + this.length = 0; + if (selector == null || string(selector) && selector.match(/^\s*$/)) ; + else if (elementOrCollection(selector)) { + this.addQuery({ + checks: [{ + type: Type2.COLLECTION, + value: selector.collection() + }] + }); + } else if (fn$6(selector)) { + this.addQuery({ + checks: [{ + type: Type2.FILTER, + value: selector + }] + }); + } else if (string(selector)) { + if (!this.parse(selector)) { + this.invalid = true; + } + } else { + error("A selector must be created from a string; found "); + } + }, "Selector"); + selfn = Selector.prototype; + [parse$1, matching].forEach(function(p3) { + return extend4(selfn, p3); + }); + selfn.text = function() { + return this.inputText; + }; + selfn.size = function() { + return this.length; + }; + selfn.eq = function(i2) { + return this[i2]; + }; + selfn.sameText = function(otherSel) { + return !this.invalid && !otherSel.invalid && this.text() === otherSel.text(); + }; + selfn.addQuery = function(q3) { + this[this.length++] = q3; + }; + selfn.selector = selfn.toString; + elesfn$g = { + allAre: /* @__PURE__ */ __name(function allAre(selector) { + var selObj = new Selector(selector); + return this.every(function(ele) { + return selObj.matches(ele); + }); + }, "allAre"), + is: /* @__PURE__ */ __name(function is(selector) { + var selObj = new Selector(selector); + return this.some(function(ele) { + return selObj.matches(ele); + }); + }, "is"), + some: /* @__PURE__ */ __name(function some(fn3, thisArg) { + for (var i2 = 0; i2 < this.length; i2++) { + var ret = !thisArg ? fn3(this[i2], i2, this) : fn3.apply(thisArg, [this[i2], i2, this]); + if (ret) { + return true; + } + } + return false; + }, "some"), + every: /* @__PURE__ */ __name(function every(fn3, thisArg) { + for (var i2 = 0; i2 < this.length; i2++) { + var ret = !thisArg ? fn3(this[i2], i2, this) : fn3.apply(thisArg, [this[i2], i2, this]); + if (!ret) { + return false; + } + } + return true; + }, "every"), + same: /* @__PURE__ */ __name(function same(collection4) { + if (this === collection4) { + return true; + } + collection4 = this.cy().collection(collection4); + var thisLength = this.length; + var collectionLength = collection4.length; + if (thisLength !== collectionLength) { + return false; + } + if (thisLength === 1) { + return this[0] === collection4[0]; + } + return this.every(function(ele) { + return collection4.hasElementWithId(ele.id()); + }); + }, "same"), + anySame: /* @__PURE__ */ __name(function anySame(collection4) { + collection4 = this.cy().collection(collection4); + return this.some(function(ele) { + return collection4.hasElementWithId(ele.id()); + }); + }, "anySame"), + allAreNeighbors: /* @__PURE__ */ __name(function allAreNeighbors(collection4) { + collection4 = this.cy().collection(collection4); + var nhood = this.neighborhood(); + return collection4.every(function(ele) { + return nhood.hasElementWithId(ele.id()); + }); + }, "allAreNeighbors"), + contains: /* @__PURE__ */ __name(function contains(collection4) { + collection4 = this.cy().collection(collection4); + var self2 = this; + return collection4.every(function(ele) { + return self2.hasElementWithId(ele.id()); + }); + }, "contains") + }; + elesfn$g.allAreNeighbours = elesfn$g.allAreNeighbors; + elesfn$g.has = elesfn$g.contains; + elesfn$g.equal = elesfn$g.equals = elesfn$g.same; + cache = /* @__PURE__ */ __name(function cache2(fn3, name) { + return /* @__PURE__ */ __name(function traversalCache(arg1, arg2, arg3, arg4) { + var selectorOrEles = arg1; + var eles = this; + var key; + if (selectorOrEles == null) { + key = ""; + } else if (elementOrCollection(selectorOrEles) && selectorOrEles.length === 1) { + key = selectorOrEles.id(); + } + if (eles.length === 1 && key) { + var _p = eles[0]._private; + var tch = _p.traversalCache = _p.traversalCache || {}; + var ch = tch[name] = tch[name] || []; + var hash = hashString(key); + var cacheHit = ch[hash]; + if (cacheHit) { + return cacheHit; + } else { + return ch[hash] = fn3.call(eles, arg1, arg2, arg3, arg4); + } + } else { + return fn3.call(eles, arg1, arg2, arg3, arg4); + } + }, "traversalCache"); + }, "cache"); + elesfn$f = { + parent: /* @__PURE__ */ __name(function parent(selector) { + var parents3 = []; + if (this.length === 1) { + var parent4 = this[0]._private.parent; + if (parent4) { + return parent4; + } + } + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var _parent = ele._private.parent; + if (_parent) { + parents3.push(_parent); + } + } + return this.spawn(parents3, true).filter(selector); + }, "parent"), + parents: /* @__PURE__ */ __name(function parents2(selector) { + var parents3 = []; + var eles = this.parent(); + while (eles.nonempty()) { + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + parents3.push(ele); + } + eles = eles.parent(); + } + return this.spawn(parents3, true).filter(selector); + }, "parents"), + commonAncestors: /* @__PURE__ */ __name(function commonAncestors(selector) { + var ancestors; + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var parents3 = ele.parents(); + ancestors = ancestors || parents3; + ancestors = ancestors.intersect(parents3); + } + return ancestors.filter(selector); + }, "commonAncestors"), + orphans: /* @__PURE__ */ __name(function orphans(selector) { + return this.stdFilter(function(ele) { + return ele.isOrphan(); + }).filter(selector); + }, "orphans"), + nonorphans: /* @__PURE__ */ __name(function nonorphans(selector) { + return this.stdFilter(function(ele) { + return ele.isChild(); + }).filter(selector); + }, "nonorphans"), + children: cache(function(selector) { + var children2 = []; + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var eleChildren = ele._private.children; + for (var j3 = 0; j3 < eleChildren.length; j3++) { + children2.push(eleChildren[j3]); + } + } + return this.spawn(children2, true).filter(selector); + }, "children"), + siblings: /* @__PURE__ */ __name(function siblings(selector) { + return this.parent().children().not(this).filter(selector); + }, "siblings"), + isParent: /* @__PURE__ */ __name(function isParent() { + var ele = this[0]; + if (ele) { + return ele.isNode() && ele._private.children.length !== 0; + } + }, "isParent"), + isChildless: /* @__PURE__ */ __name(function isChildless() { + var ele = this[0]; + if (ele) { + return ele.isNode() && ele._private.children.length === 0; + } + }, "isChildless"), + isChild: /* @__PURE__ */ __name(function isChild() { + var ele = this[0]; + if (ele) { + return ele.isNode() && ele._private.parent != null; + } + }, "isChild"), + isOrphan: /* @__PURE__ */ __name(function isOrphan() { + var ele = this[0]; + if (ele) { + return ele.isNode() && ele._private.parent == null; + } + }, "isOrphan"), + descendants: /* @__PURE__ */ __name(function descendants2(selector) { + var elements2 = []; + function add3(eles) { + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + elements2.push(ele); + if (ele.children().nonempty()) { + add3(ele.children()); + } + } + } + __name(add3, "add"); + add3(this.children()); + return this.spawn(elements2, true).filter(selector); + }, "descendants") + }; + __name(forEachCompound, "forEachCompound"); + __name(addChildren, "addChildren"); + elesfn$f.forEachDown = function(fn3) { + var includeSelf = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; + return forEachCompound(this, fn3, includeSelf, addChildren); + }; + __name(addParent, "addParent"); + elesfn$f.forEachUp = function(fn3) { + var includeSelf = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; + return forEachCompound(this, fn3, includeSelf, addParent); + }; + __name(addParentAndChildren, "addParentAndChildren"); + elesfn$f.forEachUpAndDown = function(fn3) { + var includeSelf = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; + return forEachCompound(this, fn3, includeSelf, addParentAndChildren); + }; + elesfn$f.ancestors = elesfn$f.parents; + fn$5 = elesfn$e = { + data: define2.data({ + field: "data", + bindingEvent: "data", + allowBinding: true, + allowSetting: true, + settingEvent: "data", + settingTriggersEvent: true, + triggerFnName: "trigger", + allowGetting: true, + immutableKeys: { + "id": true, + "source": true, + "target": true, + "parent": true + }, + updateStyle: true + }), + removeData: define2.removeData({ + field: "data", + event: "data", + triggerFnName: "trigger", + triggerEvent: true, + immutableKeys: { + "id": true, + "source": true, + "target": true, + "parent": true + }, + updateStyle: true + }), + scratch: define2.data({ + field: "scratch", + bindingEvent: "scratch", + allowBinding: true, + allowSetting: true, + settingEvent: "scratch", + settingTriggersEvent: true, + triggerFnName: "trigger", + allowGetting: true, + updateStyle: true + }), + removeScratch: define2.removeData({ + field: "scratch", + event: "scratch", + triggerFnName: "trigger", + triggerEvent: true, + updateStyle: true + }), + rscratch: define2.data({ + field: "rscratch", + allowBinding: false, + allowSetting: true, + settingTriggersEvent: false, + allowGetting: true + }), + removeRscratch: define2.removeData({ + field: "rscratch", + triggerEvent: false + }), + id: /* @__PURE__ */ __name(function id3() { + var ele = this[0]; + if (ele) { + return ele._private.data.id; + } + }, "id") + }; + fn$5.attr = fn$5.data; + fn$5.removeAttr = fn$5.removeData; + data3 = elesfn$e; + elesfn$d = {}; + __name(defineDegreeFunction, "defineDegreeFunction"); + extend4(elesfn$d, { + degree: defineDegreeFunction(function(node2, edge) { + if (edge.source().same(edge.target())) { + return 2; + } else { + return 1; + } + }), + indegree: defineDegreeFunction(function(node2, edge) { + if (edge.target().same(node2)) { + return 1; + } else { + return 0; + } + }), + outdegree: defineDegreeFunction(function(node2, edge) { + if (edge.source().same(node2)) { + return 1; + } else { + return 0; + } + }) + }); + __name(defineDegreeBoundsFunction, "defineDegreeBoundsFunction"); + extend4(elesfn$d, { + minDegree: defineDegreeBoundsFunction("degree", function(degree, min10) { + return degree < min10; + }), + maxDegree: defineDegreeBoundsFunction("degree", function(degree, max10) { + return degree > max10; + }), + minIndegree: defineDegreeBoundsFunction("indegree", function(degree, min10) { + return degree < min10; + }), + maxIndegree: defineDegreeBoundsFunction("indegree", function(degree, max10) { + return degree > max10; + }), + minOutdegree: defineDegreeBoundsFunction("outdegree", function(degree, min10) { + return degree < min10; + }), + maxOutdegree: defineDegreeBoundsFunction("outdegree", function(degree, max10) { + return degree > max10; + }) + }); + extend4(elesfn$d, { + totalDegree: /* @__PURE__ */ __name(function totalDegree(includeLoops) { + var total = 0; + var nodes5 = this.nodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + total += nodes5[i2].degree(includeLoops); + } + return total; + }, "totalDegree") + }); + beforePositionSet = /* @__PURE__ */ __name(function beforePositionSet2(eles, newPos, silent) { + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + if (!ele.locked()) { + var oldPos = ele._private.position; + var delta = { + x: newPos.x != null ? newPos.x - oldPos.x : 0, + y: newPos.y != null ? newPos.y - oldPos.y : 0 + }; + if (ele.isParent() && !(delta.x === 0 && delta.y === 0)) { + ele.children().shift(delta, silent); + } + ele.dirtyBoundingBoxCache(); + } + } + }, "beforePositionSet"); + positionDef = { + field: "position", + bindingEvent: "position", + allowBinding: true, + allowSetting: true, + settingEvent: "position", + settingTriggersEvent: true, + triggerFnName: "emitAndNotify", + allowGetting: true, + validKeys: ["x", "y"], + beforeGet: /* @__PURE__ */ __name(function beforeGet(ele) { + ele.updateCompoundBounds(); + }, "beforeGet"), + beforeSet: /* @__PURE__ */ __name(function beforeSet(eles, newPos) { + beforePositionSet(eles, newPos, false); + }, "beforeSet"), + onSet: /* @__PURE__ */ __name(function onSet(eles) { + eles.dirtyCompoundBoundsCache(); + }, "onSet"), + canSet: /* @__PURE__ */ __name(function canSet(ele) { + return !ele.locked(); + }, "canSet") + }; + fn$4 = elesfn$c = { + position: define2.data(positionDef), + // position but no notification to renderer + silentPosition: define2.data(extend4({}, positionDef, { + allowBinding: false, + allowSetting: true, + settingTriggersEvent: false, + allowGetting: false, + beforeSet: /* @__PURE__ */ __name(function beforeSet2(eles, newPos) { + beforePositionSet(eles, newPos, true); + }, "beforeSet"), + onSet: /* @__PURE__ */ __name(function onSet2(eles) { + eles.dirtyCompoundBoundsCache(); + }, "onSet") + })), + positions: /* @__PURE__ */ __name(function positions(pos, silent) { + if (plainObject(pos)) { + if (silent) { + this.silentPosition(pos); + } else { + this.position(pos); + } + } else if (fn$6(pos)) { + var _fn = pos; + var cy = this.cy(); + cy.startBatch(); + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var _pos = void 0; + if (_pos = _fn(ele, i2)) { + if (silent) { + ele.silentPosition(_pos); + } else { + ele.position(_pos); + } + } + } + cy.endBatch(); + } + return this; + }, "positions"), + silentPositions: /* @__PURE__ */ __name(function silentPositions(pos) { + return this.positions(pos, true); + }, "silentPositions"), + shift: /* @__PURE__ */ __name(function shift(dim, val, silent) { + var delta; + if (plainObject(dim)) { + delta = { + x: number$1(dim.x) ? dim.x : 0, + y: number$1(dim.y) ? dim.y : 0 + }; + silent = val; + } else if (string(dim) && number$1(val)) { + delta = { + x: 0, + y: 0 + }; + delta[dim] = val; + } + if (delta != null) { + var cy = this.cy(); + cy.startBatch(); + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + if (cy.hasCompoundNodes() && ele.isChild() && ele.ancestors().anySame(this)) { + continue; + } + var pos = ele.position(); + var newPos = { + x: pos.x + delta.x, + y: pos.y + delta.y + }; + if (silent) { + ele.silentPosition(newPos); + } else { + ele.position(newPos); + } + } + cy.endBatch(); + } + return this; + }, "shift"), + silentShift: /* @__PURE__ */ __name(function silentShift(dim, val) { + if (plainObject(dim)) { + this.shift(dim, true); + } else if (string(dim) && number$1(val)) { + this.shift(dim, val, true); + } + return this; + }, "silentShift"), + // get/set the rendered (i.e. on screen) positon of the element + renderedPosition: /* @__PURE__ */ __name(function renderedPosition(dim, val) { + var ele = this[0]; + var cy = this.cy(); + var zoom2 = cy.zoom(); + var pan2 = cy.pan(); + var rpos = plainObject(dim) ? dim : void 0; + var setting = rpos !== void 0 || val !== void 0 && string(dim); + if (ele && ele.isNode()) { + if (setting) { + for (var i2 = 0; i2 < this.length; i2++) { + var _ele = this[i2]; + if (val !== void 0) { + _ele.position(dim, (val - pan2[dim]) / zoom2); + } else if (rpos !== void 0) { + _ele.position(renderedToModelPosition(rpos, zoom2, pan2)); + } + } + } else { + var pos = ele.position(); + rpos = modelToRenderedPosition$1(pos, zoom2, pan2); + if (dim === void 0) { + return rpos; + } else { + return rpos[dim]; + } + } + } else if (!setting) { + return void 0; + } + return this; + }, "renderedPosition"), + // get/set the position relative to the parent + relativePosition: /* @__PURE__ */ __name(function relativePosition(dim, val) { + var ele = this[0]; + var cy = this.cy(); + var ppos = plainObject(dim) ? dim : void 0; + var setting = ppos !== void 0 || val !== void 0 && string(dim); + var hasCompoundNodes2 = cy.hasCompoundNodes(); + if (ele && ele.isNode()) { + if (setting) { + for (var i2 = 0; i2 < this.length; i2++) { + var _ele2 = this[i2]; + var parent4 = hasCompoundNodes2 ? _ele2.parent() : null; + var hasParent = parent4 && parent4.length > 0; + var relativeToParent = hasParent; + if (hasParent) { + parent4 = parent4[0]; + } + var origin = relativeToParent ? parent4.position() : { + x: 0, + y: 0 + }; + if (val !== void 0) { + _ele2.position(dim, val + origin[dim]); + } else if (ppos !== void 0) { + _ele2.position({ + x: ppos.x + origin.x, + y: ppos.y + origin.y + }); + } + } + } else { + var pos = ele.position(); + var _parent = hasCompoundNodes2 ? ele.parent() : null; + var _hasParent = _parent && _parent.length > 0; + var _relativeToParent = _hasParent; + if (_hasParent) { + _parent = _parent[0]; + } + var _origin = _relativeToParent ? _parent.position() : { + x: 0, + y: 0 + }; + ppos = { + x: pos.x - _origin.x, + y: pos.y - _origin.y + }; + if (dim === void 0) { + return ppos; + } else { + return ppos[dim]; + } + } + } else if (!setting) { + return void 0; + } + return this; + }, "relativePosition") + }; + fn$4.modelPosition = fn$4.point = fn$4.position; + fn$4.modelPositions = fn$4.points = fn$4.positions; + fn$4.renderedPoint = fn$4.renderedPosition; + fn$4.relativePoint = fn$4.relativePosition; + position2 = elesfn$c; + fn$3 = elesfn$b = {}; + elesfn$b.renderedBoundingBox = function(options2) { + var bb = this.boundingBox(options2); + var cy = this.cy(); + var zoom2 = cy.zoom(); + var pan2 = cy.pan(); + var x1 = bb.x1 * zoom2 + pan2.x; + var x22 = bb.x2 * zoom2 + pan2.x; + var y1 = bb.y1 * zoom2 + pan2.y; + var y22 = bb.y2 * zoom2 + pan2.y; + return { + x1, + x2: x22, + y1, + y2: y22, + w: x22 - x1, + h: y22 - y1 + }; + }; + elesfn$b.dirtyCompoundBoundsCache = function() { + var silent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; + var cy = this.cy(); + if (!cy.styleEnabled() || !cy.hasCompoundNodes()) { + return this; + } + this.forEachUp(function(ele) { + if (ele.isParent()) { + var _p = ele._private; + _p.compoundBoundsClean = false; + _p.bbCache = null; + if (!silent) { + ele.emitAndNotify("bounds"); + } + } + }); + return this; + }; + elesfn$b.updateCompoundBounds = function() { + var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; + var cy = this.cy(); + if (!cy.styleEnabled() || !cy.hasCompoundNodes()) { + return this; + } + if (!force && cy.batching()) { + return this; + } + function update2(parent4) { + if (!parent4.isParent()) { + return; + } + var _p2 = parent4._private; + var children2 = parent4.children(); + var includeLabels = parent4.pstyle("compound-sizing-wrt-labels").value === "include"; + var min10 = { + width: { + val: parent4.pstyle("min-width").pfValue, + left: parent4.pstyle("min-width-bias-left"), + right: parent4.pstyle("min-width-bias-right") + }, + height: { + val: parent4.pstyle("min-height").pfValue, + top: parent4.pstyle("min-height-bias-top"), + bottom: parent4.pstyle("min-height-bias-bottom") + } + }; + var bb = children2.boundingBox({ + includeLabels, + includeOverlays: false, + // updating the compound bounds happens outside of the regular + // cache cycle (i.e. before fired events) + useCache: false + }); + var pos = _p2.position; + if (bb.w === 0 || bb.h === 0) { + bb = { + w: parent4.pstyle("width").pfValue, + h: parent4.pstyle("height").pfValue + }; + bb.x1 = pos.x - bb.w / 2; + bb.x2 = pos.x + bb.w / 2; + bb.y1 = pos.y - bb.h / 2; + bb.y2 = pos.y + bb.h / 2; + } + function computeBiasValues(propDiff, propBias, propBiasComplement) { + var biasDiff = 0; + var biasComplementDiff = 0; + var biasTotal = propBias + propBiasComplement; + if (propDiff > 0 && biasTotal > 0) { + biasDiff = propBias / biasTotal * propDiff; + biasComplementDiff = propBiasComplement / biasTotal * propDiff; + } + return { + biasDiff, + biasComplementDiff + }; + } + __name(computeBiasValues, "computeBiasValues"); + function computePaddingValues(width3, height2, paddingObject, relativeTo) { + if (paddingObject.units === "%") { + switch (relativeTo) { + case "width": + return width3 > 0 ? paddingObject.pfValue * width3 : 0; + case "height": + return height2 > 0 ? paddingObject.pfValue * height2 : 0; + case "average": + return width3 > 0 && height2 > 0 ? paddingObject.pfValue * (width3 + height2) / 2 : 0; + case "min": + return width3 > 0 && height2 > 0 ? width3 > height2 ? paddingObject.pfValue * height2 : paddingObject.pfValue * width3 : 0; + case "max": + return width3 > 0 && height2 > 0 ? width3 > height2 ? paddingObject.pfValue * width3 : paddingObject.pfValue * height2 : 0; + default: + return 0; + } + } else if (paddingObject.units === "px") { + return paddingObject.pfValue; + } else { + return 0; + } + } + __name(computePaddingValues, "computePaddingValues"); + var leftVal = min10.width.left.value; + if (min10.width.left.units === "px" && min10.width.val > 0) { + leftVal = leftVal * 100 / min10.width.val; + } + var rightVal = min10.width.right.value; + if (min10.width.right.units === "px" && min10.width.val > 0) { + rightVal = rightVal * 100 / min10.width.val; + } + var topVal = min10.height.top.value; + if (min10.height.top.units === "px" && min10.height.val > 0) { + topVal = topVal * 100 / min10.height.val; + } + var bottomVal = min10.height.bottom.value; + if (min10.height.bottom.units === "px" && min10.height.val > 0) { + bottomVal = bottomVal * 100 / min10.height.val; + } + var widthBiasDiffs = computeBiasValues(min10.width.val - bb.w, leftVal, rightVal); + var diffLeft = widthBiasDiffs.biasDiff; + var diffRight = widthBiasDiffs.biasComplementDiff; + var heightBiasDiffs = computeBiasValues(min10.height.val - bb.h, topVal, bottomVal); + var diffTop = heightBiasDiffs.biasDiff; + var diffBottom = heightBiasDiffs.biasComplementDiff; + _p2.autoPadding = computePaddingValues(bb.w, bb.h, parent4.pstyle("padding"), parent4.pstyle("padding-relative-to").value); + _p2.autoWidth = Math.max(bb.w, min10.width.val); + pos.x = (-diffLeft + bb.x1 + bb.x2 + diffRight) / 2; + _p2.autoHeight = Math.max(bb.h, min10.height.val); + pos.y = (-diffTop + bb.y1 + bb.y2 + diffBottom) / 2; + } + __name(update2, "update"); + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var _p = ele._private; + if (!_p.compoundBoundsClean || force) { + update2(ele); + if (!cy.batching()) { + _p.compoundBoundsClean = true; + } + } + } + return this; + }; + noninf = /* @__PURE__ */ __name(function noninf2(x5) { + if (x5 === Infinity || x5 === -Infinity) { + return 0; + } + return x5; + }, "noninf"); + updateBounds = /* @__PURE__ */ __name(function updateBounds2(b3, x1, y1, x22, y22) { + if (x22 - x1 === 0 || y22 - y1 === 0) { + return; + } + if (x1 == null || y1 == null || x22 == null || y22 == null) { + return; + } + b3.x1 = x1 < b3.x1 ? x1 : b3.x1; + b3.x2 = x22 > b3.x2 ? x22 : b3.x2; + b3.y1 = y1 < b3.y1 ? y1 : b3.y1; + b3.y2 = y22 > b3.y2 ? y22 : b3.y2; + b3.w = b3.x2 - b3.x1; + b3.h = b3.y2 - b3.y1; + }, "updateBounds"); + updateBoundsFromBox = /* @__PURE__ */ __name(function updateBoundsFromBox2(b3, b22) { + if (b22 == null) { + return b3; + } + return updateBounds(b3, b22.x1, b22.y1, b22.x2, b22.y2); + }, "updateBoundsFromBox"); + prefixedProperty = /* @__PURE__ */ __name(function prefixedProperty2(obj, field, prefix) { + return getPrefixedProperty(obj, field, prefix); + }, "prefixedProperty"); + updateBoundsFromArrow = /* @__PURE__ */ __name(function updateBoundsFromArrow2(bounds4, ele, prefix) { + if (ele.cy().headless()) { + return; + } + var _p = ele._private; + var rstyle = _p.rstyle; + var halfArW = rstyle.arrowWidth / 2; + var arrowType = ele.pstyle(prefix + "-arrow-shape").value; + var x5; + var y6; + if (arrowType !== "none") { + if (prefix === "source") { + x5 = rstyle.srcX; + y6 = rstyle.srcY; + } else if (prefix === "target") { + x5 = rstyle.tgtX; + y6 = rstyle.tgtY; + } else { + x5 = rstyle.midX; + y6 = rstyle.midY; + } + var bbs = _p.arrowBounds = _p.arrowBounds || {}; + var bb = bbs[prefix] = bbs[prefix] || {}; + bb.x1 = x5 - halfArW; + bb.y1 = y6 - halfArW; + bb.x2 = x5 + halfArW; + bb.y2 = y6 + halfArW; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + expandBoundingBox(bb, 1); + updateBounds(bounds4, bb.x1, bb.y1, bb.x2, bb.y2); + } + }, "updateBoundsFromArrow"); + updateBoundsFromLabel = /* @__PURE__ */ __name(function updateBoundsFromLabel2(bounds4, ele, prefix) { + if (ele.cy().headless()) { + return; + } + var prefixDash; + if (prefix) { + prefixDash = prefix + "-"; + } else { + prefixDash = ""; + } + var _p = ele._private; + var rstyle = _p.rstyle; + var label = ele.pstyle(prefixDash + "label").strValue; + if (label) { + var halign = ele.pstyle("text-halign"); + var valign = ele.pstyle("text-valign"); + var labelWidth = prefixedProperty(rstyle, "labelWidth", prefix); + var labelHeight = prefixedProperty(rstyle, "labelHeight", prefix); + var labelX = prefixedProperty(rstyle, "labelX", prefix); + var labelY = prefixedProperty(rstyle, "labelY", prefix); + var marginX = ele.pstyle(prefixDash + "text-margin-x").pfValue; + var marginY = ele.pstyle(prefixDash + "text-margin-y").pfValue; + var isEdge2 = ele.isEdge(); + var rotation = ele.pstyle(prefixDash + "text-rotation"); + var outlineWidth = ele.pstyle("text-outline-width").pfValue; + var borderWidth = ele.pstyle("text-border-width").pfValue; + var halfBorderWidth = borderWidth / 2; + var padding2 = ele.pstyle("text-background-padding").pfValue; + var marginOfError = 2; + var lh = labelHeight; + var lw = labelWidth; + var lw_2 = lw / 2; + var lh_2 = lh / 2; + var lx1, lx2, ly1, ly2; + if (isEdge2) { + lx1 = labelX - lw_2; + lx2 = labelX + lw_2; + ly1 = labelY - lh_2; + ly2 = labelY + lh_2; + } else { + switch (halign.value) { + case "left": + lx1 = labelX - lw; + lx2 = labelX; + break; + case "center": + lx1 = labelX - lw_2; + lx2 = labelX + lw_2; + break; + case "right": + lx1 = labelX; + lx2 = labelX + lw; + break; + } + switch (valign.value) { + case "top": + ly1 = labelY - lh; + ly2 = labelY; + break; + case "center": + ly1 = labelY - lh_2; + ly2 = labelY + lh_2; + break; + case "bottom": + ly1 = labelY; + ly2 = labelY + lh; + break; + } + } + var leftPad = marginX - Math.max(outlineWidth, halfBorderWidth) - padding2 - marginOfError; + var rightPad = marginX + Math.max(outlineWidth, halfBorderWidth) + padding2 + marginOfError; + var topPad = marginY - Math.max(outlineWidth, halfBorderWidth) - padding2 - marginOfError; + var botPad = marginY + Math.max(outlineWidth, halfBorderWidth) + padding2 + marginOfError; + lx1 += leftPad; + lx2 += rightPad; + ly1 += topPad; + ly2 += botPad; + var bbPrefix = prefix || "main"; + var bbs = _p.labelBounds; + var bb = bbs[bbPrefix] = bbs[bbPrefix] || {}; + bb.x1 = lx1; + bb.y1 = ly1; + bb.x2 = lx2; + bb.y2 = ly2; + bb.w = lx2 - lx1; + bb.h = ly2 - ly1; + bb.leftPad = leftPad; + bb.rightPad = rightPad; + bb.topPad = topPad; + bb.botPad = botPad; + var isAutorotate = isEdge2 && rotation.strValue === "autorotate"; + var isPfValue = rotation.pfValue != null && rotation.pfValue !== 0; + if (isAutorotate || isPfValue) { + var theta = isAutorotate ? prefixedProperty(_p.rstyle, "labelAngle", prefix) : rotation.pfValue; + var cos3 = Math.cos(theta); + var sin3 = Math.sin(theta); + var xo = (lx1 + lx2) / 2; + var yo = (ly1 + ly2) / 2; + if (!isEdge2) { + switch (halign.value) { + case "left": + xo = lx2; + break; + case "right": + xo = lx1; + break; + } + switch (valign.value) { + case "top": + yo = ly2; + break; + case "bottom": + yo = ly1; + break; + } + } + var rotate2 = /* @__PURE__ */ __name(function rotate3(x5, y6) { + x5 = x5 - xo; + y6 = y6 - yo; + return { + x: x5 * cos3 - y6 * sin3 + xo, + y: x5 * sin3 + y6 * cos3 + yo + }; + }, "rotate"); + var px1y1 = rotate2(lx1, ly1); + var px1y2 = rotate2(lx1, ly2); + var px2y1 = rotate2(lx2, ly1); + var px2y2 = rotate2(lx2, ly2); + lx1 = Math.min(px1y1.x, px1y2.x, px2y1.x, px2y2.x); + lx2 = Math.max(px1y1.x, px1y2.x, px2y1.x, px2y2.x); + ly1 = Math.min(px1y1.y, px1y2.y, px2y1.y, px2y2.y); + ly2 = Math.max(px1y1.y, px1y2.y, px2y1.y, px2y2.y); + } + var bbPrefixRot = bbPrefix + "Rot"; + var bbRot = bbs[bbPrefixRot] = bbs[bbPrefixRot] || {}; + bbRot.x1 = lx1; + bbRot.y1 = ly1; + bbRot.x2 = lx2; + bbRot.y2 = ly2; + bbRot.w = lx2 - lx1; + bbRot.h = ly2 - ly1; + updateBounds(bounds4, lx1, ly1, lx2, ly2); + updateBounds(_p.labelBounds.all, lx1, ly1, lx2, ly2); + } + return bounds4; + }, "updateBoundsFromLabel"); + updateBoundsFromOutline = /* @__PURE__ */ __name(function updateBoundsFromOutline2(bounds4, ele) { + if (ele.cy().headless()) { + return; + } + var outlineOpacity = ele.pstyle("outline-opacity").value; + var outlineWidth = ele.pstyle("outline-width").value; + var outlineOffset = ele.pstyle("outline-offset").value; + var expansion = outlineWidth + outlineOffset; + updateBoundsFromMiter(bounds4, ele, outlineOpacity, expansion, "outside", expansion / 2); + }, "updateBoundsFromOutline"); + updateBoundsFromMiter = /* @__PURE__ */ __name(function updateBoundsFromMiter2(bounds4, ele, opacity, expansionSize, expansionPosition, useFallbackValue) { + if (opacity === 0 || expansionSize <= 0 || expansionPosition === "inside") { + return; + } + var cy = ele.cy(); + var shape = ele.pstyle("shape").value; + var rshape = cy.renderer().nodeShapes[shape]; + var _ele$position = ele.position(), x5 = _ele$position.x, y6 = _ele$position.y; + var w4 = ele.width(); + var h3 = ele.height(); + if (rshape.hasMiterBounds) { + if (expansionPosition === "center") { + expansionSize /= 2; + } + var mbb = rshape.miterBounds(x5, y6, w4, h3, expansionSize); + updateBoundsFromBox(bounds4, mbb); + } else if (useFallbackValue != null && useFallbackValue > 0) { + expandBoundingBoxSides(bounds4, [useFallbackValue, useFallbackValue, useFallbackValue, useFallbackValue]); + } + }, "updateBoundsFromMiter"); + updateBoundsFromMiterBorder = /* @__PURE__ */ __name(function updateBoundsFromMiterBorder2(bounds4, ele) { + if (ele.cy().headless()) { + return; + } + var borderOpacity = ele.pstyle("border-opacity").value; + var borderWidth = ele.pstyle("border-width").pfValue; + var borderPosition = ele.pstyle("border-position").value; + updateBoundsFromMiter(bounds4, ele, borderOpacity, borderWidth, borderPosition); + }, "updateBoundsFromMiterBorder"); + boundingBoxImpl = /* @__PURE__ */ __name(function boundingBoxImpl2(ele, options2) { + var cy = ele._private.cy; + var styleEnabled2 = cy.styleEnabled(); + var headless2 = cy.headless(); + var bounds4 = makeBoundingBox(); + var _p = ele._private; + var isNode2 = ele.isNode(); + var isEdge2 = ele.isEdge(); + var ex1, ex2, ey1, ey2; + var x5, y6; + var rstyle = _p.rstyle; + var manualExpansion = isNode2 && styleEnabled2 ? ele.pstyle("bounds-expansion").pfValue : [0]; + var isDisplayed = /* @__PURE__ */ __name(function isDisplayed2(ele2) { + return ele2.pstyle("display").value !== "none"; + }, "isDisplayed"); + var displayed = !styleEnabled2 || isDisplayed(ele) && (!isEdge2 || isDisplayed(ele.source()) && isDisplayed(ele.target())); + if (displayed) { + var overlayOpacity = 0; + var overlayPadding = 0; + if (styleEnabled2 && options2.includeOverlays) { + overlayOpacity = ele.pstyle("overlay-opacity").value; + if (overlayOpacity !== 0) { + overlayPadding = ele.pstyle("overlay-padding").value; + } + } + var underlayOpacity = 0; + var underlayPadding = 0; + if (styleEnabled2 && options2.includeUnderlays) { + underlayOpacity = ele.pstyle("underlay-opacity").value; + if (underlayOpacity !== 0) { + underlayPadding = ele.pstyle("underlay-padding").value; + } + } + var padding2 = Math.max(overlayPadding, underlayPadding); + var w4 = 0; + var wHalf = 0; + if (styleEnabled2) { + w4 = ele.pstyle("width").pfValue; + wHalf = w4 / 2; + } + if (isNode2 && options2.includeNodes) { + var pos = ele.position(); + x5 = pos.x; + y6 = pos.y; + var _w = ele.outerWidth(); + var halfW = _w / 2; + var h3 = ele.outerHeight(); + var halfH = h3 / 2; + ex1 = x5 - halfW; + ex2 = x5 + halfW; + ey1 = y6 - halfH; + ey2 = y6 + halfH; + updateBounds(bounds4, ex1, ey1, ex2, ey2); + if (styleEnabled2) { + updateBoundsFromOutline(bounds4, ele); + } + if (styleEnabled2 && options2.includeOutlines && !headless2) { + updateBoundsFromOutline(bounds4, ele); + } + if (styleEnabled2) { + updateBoundsFromMiterBorder(bounds4, ele); + } + } else if (isEdge2 && options2.includeEdges) { + if (styleEnabled2 && !headless2) { + var curveStyle = ele.pstyle("curve-style").strValue; + ex1 = Math.min(rstyle.srcX, rstyle.midX, rstyle.tgtX); + ex2 = Math.max(rstyle.srcX, rstyle.midX, rstyle.tgtX); + ey1 = Math.min(rstyle.srcY, rstyle.midY, rstyle.tgtY); + ey2 = Math.max(rstyle.srcY, rstyle.midY, rstyle.tgtY); + ex1 -= wHalf; + ex2 += wHalf; + ey1 -= wHalf; + ey2 += wHalf; + updateBounds(bounds4, ex1, ey1, ex2, ey2); + if (curveStyle === "haystack") { + var hpts = rstyle.haystackPts; + if (hpts && hpts.length === 2) { + ex1 = hpts[0].x; + ey1 = hpts[0].y; + ex2 = hpts[1].x; + ey2 = hpts[1].y; + if (ex1 > ex2) { + var temp = ex1; + ex1 = ex2; + ex2 = temp; + } + if (ey1 > ey2) { + var _temp = ey1; + ey1 = ey2; + ey2 = _temp; + } + updateBounds(bounds4, ex1 - wHalf, ey1 - wHalf, ex2 + wHalf, ey2 + wHalf); + } + } else if (curveStyle === "bezier" || curveStyle === "unbundled-bezier" || endsWith(curveStyle, "segments") || endsWith(curveStyle, "taxi")) { + var pts2; + switch (curveStyle) { + case "bezier": + case "unbundled-bezier": + pts2 = rstyle.bezierPts; + break; + case "segments": + case "taxi": + case "round-segments": + case "round-taxi": + pts2 = rstyle.linePts; + break; + } + if (pts2 != null) { + for (var j3 = 0; j3 < pts2.length; j3++) { + var pt = pts2[j3]; + ex1 = pt.x - wHalf; + ex2 = pt.x + wHalf; + ey1 = pt.y - wHalf; + ey2 = pt.y + wHalf; + updateBounds(bounds4, ex1, ey1, ex2, ey2); + } + } + } + } else { + var n1 = ele.source(); + var n1pos = n1.position(); + var n2 = ele.target(); + var n2pos = n2.position(); + ex1 = n1pos.x; + ex2 = n2pos.x; + ey1 = n1pos.y; + ey2 = n2pos.y; + if (ex1 > ex2) { + var _temp2 = ex1; + ex1 = ex2; + ex2 = _temp2; + } + if (ey1 > ey2) { + var _temp3 = ey1; + ey1 = ey2; + ey2 = _temp3; + } + ex1 -= wHalf; + ex2 += wHalf; + ey1 -= wHalf; + ey2 += wHalf; + updateBounds(bounds4, ex1, ey1, ex2, ey2); + } + } + if (styleEnabled2 && options2.includeEdges && isEdge2) { + updateBoundsFromArrow(bounds4, ele, "mid-source"); + updateBoundsFromArrow(bounds4, ele, "mid-target"); + updateBoundsFromArrow(bounds4, ele, "source"); + updateBoundsFromArrow(bounds4, ele, "target"); + } + if (styleEnabled2) { + var ghost = ele.pstyle("ghost").value === "yes"; + if (ghost) { + var gx = ele.pstyle("ghost-offset-x").pfValue; + var gy = ele.pstyle("ghost-offset-y").pfValue; + updateBounds(bounds4, bounds4.x1 + gx, bounds4.y1 + gy, bounds4.x2 + gx, bounds4.y2 + gy); + } + } + var bbBody = _p.bodyBounds = _p.bodyBounds || {}; + assignBoundingBox(bbBody, bounds4); + expandBoundingBoxSides(bbBody, manualExpansion); + expandBoundingBox(bbBody, 1); + if (styleEnabled2) { + ex1 = bounds4.x1; + ex2 = bounds4.x2; + ey1 = bounds4.y1; + ey2 = bounds4.y2; + updateBounds(bounds4, ex1 - padding2, ey1 - padding2, ex2 + padding2, ey2 + padding2); + } + var bbOverlay = _p.overlayBounds = _p.overlayBounds || {}; + assignBoundingBox(bbOverlay, bounds4); + expandBoundingBoxSides(bbOverlay, manualExpansion); + expandBoundingBox(bbOverlay, 1); + var bbLabels = _p.labelBounds = _p.labelBounds || {}; + if (bbLabels.all != null) { + clearBoundingBox(bbLabels.all); + } else { + bbLabels.all = makeBoundingBox(); + } + if (styleEnabled2 && options2.includeLabels) { + if (options2.includeMainLabels) { + updateBoundsFromLabel(bounds4, ele, null); + } + if (isEdge2) { + if (options2.includeSourceLabels) { + updateBoundsFromLabel(bounds4, ele, "source"); + } + if (options2.includeTargetLabels) { + updateBoundsFromLabel(bounds4, ele, "target"); + } + } + } + } + bounds4.x1 = noninf(bounds4.x1); + bounds4.y1 = noninf(bounds4.y1); + bounds4.x2 = noninf(bounds4.x2); + bounds4.y2 = noninf(bounds4.y2); + bounds4.w = noninf(bounds4.x2 - bounds4.x1); + bounds4.h = noninf(bounds4.y2 - bounds4.y1); + if (bounds4.w > 0 && bounds4.h > 0 && displayed) { + expandBoundingBoxSides(bounds4, manualExpansion); + expandBoundingBox(bounds4, 1); + } + return bounds4; + }, "boundingBoxImpl"); + getKey = /* @__PURE__ */ __name(function getKey2(opts) { + var i2 = 0; + var tf = /* @__PURE__ */ __name(function tf2(val) { + return (val ? 1 : 0) << i2++; + }, "tf"); + var key = 0; + key += tf(opts.incudeNodes); + key += tf(opts.includeEdges); + key += tf(opts.includeLabels); + key += tf(opts.includeMainLabels); + key += tf(opts.includeSourceLabels); + key += tf(opts.includeTargetLabels); + key += tf(opts.includeOverlays); + key += tf(opts.includeOutlines); + return key; + }, "getKey"); + getBoundingBoxPosKey = /* @__PURE__ */ __name(function getBoundingBoxPosKey2(ele) { + var r2 = /* @__PURE__ */ __name(function r3(x5) { + return Math.round(x5); + }, "r"); + if (ele.isEdge()) { + var p1 = ele.source().position(); + var p22 = ele.target().position(); + return hashIntsArray([r2(p1.x), r2(p1.y), r2(p22.x), r2(p22.y)]); + } else { + var p3 = ele.position(); + return hashIntsArray([r2(p3.x), r2(p3.y)]); + } + }, "getBoundingBoxPosKey"); + cachedBoundingBoxImpl = /* @__PURE__ */ __name(function cachedBoundingBoxImpl2(ele, opts) { + var _p = ele._private; + var bb; + var isEdge2 = ele.isEdge(); + var key = opts == null ? defBbOptsKey : getKey(opts); + var usingDefOpts = key === defBbOptsKey; + if (_p.bbCache == null) { + bb = boundingBoxImpl(ele, defBbOpts); + _p.bbCache = bb; + _p.bbCachePosKey = getBoundingBoxPosKey(ele); + } else { + bb = _p.bbCache; + } + if (!usingDefOpts) { + var isNode2 = ele.isNode(); + bb = makeBoundingBox(); + if (opts.includeNodes && isNode2 || opts.includeEdges && !isNode2) { + if (opts.includeOverlays) { + updateBoundsFromBox(bb, _p.overlayBounds); + } else { + updateBoundsFromBox(bb, _p.bodyBounds); + } + } + if (opts.includeLabels) { + if (opts.includeMainLabels && (!isEdge2 || opts.includeSourceLabels && opts.includeTargetLabels)) { + updateBoundsFromBox(bb, _p.labelBounds.all); + } else { + if (opts.includeMainLabels) { + updateBoundsFromBox(bb, _p.labelBounds.mainRot); + } + if (opts.includeSourceLabels) { + updateBoundsFromBox(bb, _p.labelBounds.sourceRot); + } + if (opts.includeTargetLabels) { + updateBoundsFromBox(bb, _p.labelBounds.targetRot); + } + } + } + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + } + return bb; + }, "cachedBoundingBoxImpl"); + defBbOpts = { + includeNodes: true, + includeEdges: true, + includeLabels: true, + includeMainLabels: true, + includeSourceLabels: true, + includeTargetLabels: true, + includeOverlays: true, + includeUnderlays: true, + includeOutlines: true, + useCache: true + }; + defBbOptsKey = getKey(defBbOpts); + filledBbOpts = defaults$g(defBbOpts); + elesfn$b.boundingBox = function(options2) { + var bounds4; + var useCache = options2 === void 0 || options2.useCache === void 0 || options2.useCache === true; + var isDirty = memoize3(function(ele2) { + var _p = ele2._private; + return _p.bbCache == null || _p.styleDirty || _p.bbCachePosKey !== getBoundingBoxPosKey(ele2); + }, function(ele2) { + return ele2.id(); + }); + if (useCache && this.length === 1 && !isDirty(this[0])) { + if (options2 === void 0) { + options2 = defBbOpts; + } else { + options2 = filledBbOpts(options2); + } + bounds4 = cachedBoundingBoxImpl(this[0], options2); + } else { + bounds4 = makeBoundingBox(); + options2 = options2 || defBbOpts; + var opts = filledBbOpts(options2); + var eles = this; + var cy = eles.cy(); + var styleEnabled2 = cy.styleEnabled(); + this.edges().forEach(isDirty); + this.nodes().forEach(isDirty); + if (styleEnabled2) { + this.recalculateRenderedStyle(useCache); + } + this.updateCompoundBounds(!useCache); + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + if (isDirty(ele)) { + ele.dirtyBoundingBoxCache(); + } + updateBoundsFromBox(bounds4, cachedBoundingBoxImpl(ele, opts)); + } + } + bounds4.x1 = noninf(bounds4.x1); + bounds4.y1 = noninf(bounds4.y1); + bounds4.x2 = noninf(bounds4.x2); + bounds4.y2 = noninf(bounds4.y2); + bounds4.w = noninf(bounds4.x2 - bounds4.x1); + bounds4.h = noninf(bounds4.y2 - bounds4.y1); + return bounds4; + }; + elesfn$b.dirtyBoundingBoxCache = function() { + for (var i2 = 0; i2 < this.length; i2++) { + var _p = this[i2]._private; + _p.bbCache = null; + _p.bbCachePosKey = null; + _p.bodyBounds = null; + _p.overlayBounds = null; + _p.labelBounds.all = null; + _p.labelBounds.source = null; + _p.labelBounds.target = null; + _p.labelBounds.main = null; + _p.labelBounds.sourceRot = null; + _p.labelBounds.targetRot = null; + _p.labelBounds.mainRot = null; + _p.arrowBounds.source = null; + _p.arrowBounds.target = null; + _p.arrowBounds["mid-source"] = null; + _p.arrowBounds["mid-target"] = null; + } + this.emitAndNotify("bounds"); + return this; + }; + elesfn$b.boundingBoxAt = function(fn3) { + var nodes5 = this.nodes(); + var cy = this.cy(); + var hasCompoundNodes2 = cy.hasCompoundNodes(); + var parents3 = cy.collection(); + if (hasCompoundNodes2) { + parents3 = nodes5.filter(function(node2) { + return node2.isParent(); + }); + nodes5 = nodes5.not(parents3); + } + if (plainObject(fn3)) { + var obj = fn3; + fn3 = /* @__PURE__ */ __name(function fn4() { + return obj; + }, "fn"); + } + var storeOldPos = /* @__PURE__ */ __name(function storeOldPos2(node2, i2) { + return node2._private.bbAtOldPos = fn3(node2, i2); + }, "storeOldPos"); + var getOldPos = /* @__PURE__ */ __name(function getOldPos2(node2) { + return node2._private.bbAtOldPos; + }, "getOldPos"); + cy.startBatch(); + nodes5.forEach(storeOldPos).silentPositions(fn3); + if (hasCompoundNodes2) { + parents3.dirtyCompoundBoundsCache(); + parents3.dirtyBoundingBoxCache(); + parents3.updateCompoundBounds(true); + } + var bb = copyBoundingBox(this.boundingBox({ + useCache: false + })); + nodes5.silentPositions(getOldPos); + if (hasCompoundNodes2) { + parents3.dirtyCompoundBoundsCache(); + parents3.dirtyBoundingBoxCache(); + parents3.updateCompoundBounds(true); + } + cy.endBatch(); + return bb; + }; + fn$3.boundingbox = fn$3.bb = fn$3.boundingBox; + fn$3.renderedBoundingbox = fn$3.renderedBoundingBox; + bounds = elesfn$b; + fn$2 = elesfn$a = {}; + defineDimFns = /* @__PURE__ */ __name(function defineDimFns2(opts) { + opts.uppercaseName = capitalize(opts.name); + opts.autoName = "auto" + opts.uppercaseName; + opts.labelName = "label" + opts.uppercaseName; + opts.outerName = "outer" + opts.uppercaseName; + opts.uppercaseOuterName = capitalize(opts.outerName); + fn$2[opts.name] = /* @__PURE__ */ __name(function dimImpl() { + var ele = this[0]; + var _p = ele._private; + var cy = _p.cy; + var styleEnabled2 = cy._private.styleEnabled; + if (ele) { + if (styleEnabled2) { + if (ele.isParent()) { + ele.updateCompoundBounds(); + return _p[opts.autoName] || 0; + } + var d3 = ele.pstyle(opts.name); + switch (d3.strValue) { + case "label": + ele.recalculateRenderedStyle(); + return _p.rstyle[opts.labelName] || 0; + default: + return d3.pfValue; + } + } else { + return 1; + } + } + }, "dimImpl"); + fn$2["outer" + opts.uppercaseName] = /* @__PURE__ */ __name(function outerDimImpl() { + var ele = this[0]; + var _p = ele._private; + var cy = _p.cy; + var styleEnabled2 = cy._private.styleEnabled; + if (ele) { + if (styleEnabled2) { + var dim = ele[opts.name](); + var borderPos = ele.pstyle("border-position").value; + var border; + if (borderPos === "center") { + border = ele.pstyle("border-width").pfValue; + } else if (borderPos === "outside") { + border = 2 * ele.pstyle("border-width").pfValue; + } else { + border = 0; + } + var padding2 = 2 * ele.padding(); + return dim + border + padding2; + } else { + return 1; + } + } + }, "outerDimImpl"); + fn$2["rendered" + opts.uppercaseName] = /* @__PURE__ */ __name(function renderedDimImpl() { + var ele = this[0]; + if (ele) { + var d3 = ele[opts.name](); + return d3 * this.cy().zoom(); + } + }, "renderedDimImpl"); + fn$2["rendered" + opts.uppercaseOuterName] = /* @__PURE__ */ __name(function renderedOuterDimImpl() { + var ele = this[0]; + if (ele) { + var od = ele[opts.outerName](); + return od * this.cy().zoom(); + } + }, "renderedOuterDimImpl"); + }, "defineDimFns"); + defineDimFns({ + name: "width" + }); + defineDimFns({ + name: "height" + }); + elesfn$a.padding = function() { + var ele = this[0]; + var _p = ele._private; + if (ele.isParent()) { + ele.updateCompoundBounds(); + if (_p.autoPadding !== void 0) { + return _p.autoPadding; + } else { + return ele.pstyle("padding").pfValue; + } + } else { + return ele.pstyle("padding").pfValue; + } + }; + elesfn$a.paddedHeight = function() { + var ele = this[0]; + return ele.height() + 2 * ele.padding(); + }; + elesfn$a.paddedWidth = function() { + var ele = this[0]; + return ele.width() + 2 * ele.padding(); + }; + widthHeight = elesfn$a; + ifEdge = /* @__PURE__ */ __name(function ifEdge2(ele, getValue4) { + if (ele.isEdge() && ele.takesUpSpace()) { + return getValue4(ele); + } + }, "ifEdge"); + ifEdgeRenderedPosition = /* @__PURE__ */ __name(function ifEdgeRenderedPosition2(ele, getPoint) { + if (ele.isEdge() && ele.takesUpSpace()) { + var cy = ele.cy(); + return modelToRenderedPosition$1(getPoint(ele), cy.zoom(), cy.pan()); + } + }, "ifEdgeRenderedPosition"); + ifEdgeRenderedPositions = /* @__PURE__ */ __name(function ifEdgeRenderedPositions2(ele, getPoints) { + if (ele.isEdge() && ele.takesUpSpace()) { + var cy = ele.cy(); + var pan2 = cy.pan(); + var zoom2 = cy.zoom(); + return getPoints(ele).map(function(p3) { + return modelToRenderedPosition$1(p3, zoom2, pan2); + }); + } + }, "ifEdgeRenderedPositions"); + controlPoints2 = /* @__PURE__ */ __name(function controlPoints3(ele) { + return ele.renderer().getControlPoints(ele); + }, "controlPoints"); + segmentPoints = /* @__PURE__ */ __name(function segmentPoints2(ele) { + return ele.renderer().getSegmentPoints(ele); + }, "segmentPoints"); + sourceEndpoint = /* @__PURE__ */ __name(function sourceEndpoint2(ele) { + return ele.renderer().getSourceEndpoint(ele); + }, "sourceEndpoint"); + targetEndpoint = /* @__PURE__ */ __name(function targetEndpoint2(ele) { + return ele.renderer().getTargetEndpoint(ele); + }, "targetEndpoint"); + midpoint = /* @__PURE__ */ __name(function midpoint2(ele) { + return ele.renderer().getEdgeMidpoint(ele); + }, "midpoint"); + pts = { + controlPoints: { + get: controlPoints2, + mult: true + }, + segmentPoints: { + get: segmentPoints, + mult: true + }, + sourceEndpoint: { + get: sourceEndpoint + }, + targetEndpoint: { + get: targetEndpoint + }, + midpoint: { + get: midpoint + } + }; + renderedName = /* @__PURE__ */ __name(function renderedName2(name) { + return "rendered" + name[0].toUpperCase() + name.substr(1); + }, "renderedName"); + edgePoints = Object.keys(pts).reduce(function(obj, name) { + var spec = pts[name]; + var rName = renderedName(name); + obj[name] = function() { + return ifEdge(this, spec.get); + }; + if (spec.mult) { + obj[rName] = function() { + return ifEdgeRenderedPositions(this, spec.get); + }; + } else { + obj[rName] = function() { + return ifEdgeRenderedPosition(this, spec.get); + }; + } + return obj; + }, {}); + dimensions = extend4({}, position2, bounds, widthHeight, edgePoints); + Event = /* @__PURE__ */ __name(function Event2(src, props) { + this.recycle(src, props); + }, "Event"); + __name(returnFalse, "returnFalse"); + __name(returnTrue, "returnTrue"); + Event.prototype = { + instanceString: /* @__PURE__ */ __name(function instanceString2() { + return "event"; + }, "instanceString"), + recycle: /* @__PURE__ */ __name(function recycle(src, props) { + this.isImmediatePropagationStopped = this.isPropagationStopped = this.isDefaultPrevented = returnFalse; + if (src != null && src.preventDefault) { + this.type = src.type; + this.isDefaultPrevented = src.defaultPrevented ? returnTrue : returnFalse; + } else if (src != null && src.type) { + props = src; + } else { + this.type = src; + } + if (props != null) { + this.originalEvent = props.originalEvent; + this.type = props.type != null ? props.type : this.type; + this.cy = props.cy; + this.target = props.target; + this.position = props.position; + this.renderedPosition = props.renderedPosition; + this.namespace = props.namespace; + this.layout = props.layout; + } + if (this.cy != null && this.position != null && this.renderedPosition == null) { + var pos = this.position; + var zoom2 = this.cy.zoom(); + var pan2 = this.cy.pan(); + this.renderedPosition = { + x: pos.x * zoom2 + pan2.x, + y: pos.y * zoom2 + pan2.y + }; + } + this.timeStamp = src && src.timeStamp || Date.now(); + }, "recycle"), + preventDefault: /* @__PURE__ */ __name(function preventDefault() { + this.isDefaultPrevented = returnTrue; + var e3 = this.originalEvent; + if (!e3) { + return; + } + if (e3.preventDefault) { + e3.preventDefault(); + } + }, "preventDefault"), + stopPropagation: /* @__PURE__ */ __name(function stopPropagation() { + this.isPropagationStopped = returnTrue; + var e3 = this.originalEvent; + if (!e3) { + return; + } + if (e3.stopPropagation) { + e3.stopPropagation(); + } + }, "stopPropagation"), + stopImmediatePropagation: /* @__PURE__ */ __name(function stopImmediatePropagation() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, "stopImmediatePropagation"), + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse + }; + eventRegex = /^([^.]+)(\.(?:[^.]+))?$/; + universalNamespace = ".*"; + defaults$8 = { + qualifierCompare: /* @__PURE__ */ __name(function qualifierCompare(q1, q22) { + return q1 === q22; + }, "qualifierCompare"), + eventMatches: /* @__PURE__ */ __name(function eventMatches() { + return true; + }, "eventMatches"), + addEventFields: /* @__PURE__ */ __name(function addEventFields() { + }, "addEventFields"), + callbackContext: /* @__PURE__ */ __name(function callbackContext(context) { + return context; + }, "callbackContext"), + beforeEmit: /* @__PURE__ */ __name(function beforeEmit() { + }, "beforeEmit"), + afterEmit: /* @__PURE__ */ __name(function afterEmit() { + }, "afterEmit"), + bubble: /* @__PURE__ */ __name(function bubble() { + return false; + }, "bubble"), + parent: /* @__PURE__ */ __name(function parent2() { + return null; + }, "parent"), + context: null + }; + defaultsKeys = Object.keys(defaults$8); + emptyOpts = {}; + __name(Emitter, "Emitter"); + p2 = Emitter.prototype; + forEachEvent = /* @__PURE__ */ __name(function forEachEvent2(self2, handler, events, qualifier, callback, conf5, confOverrides) { + if (fn$6(qualifier)) { + callback = qualifier; + qualifier = null; + } + if (confOverrides) { + if (conf5 == null) { + conf5 = confOverrides; + } else { + conf5 = extend4({}, conf5, confOverrides); + } + } + var eventList = array2(events) ? events : events.split(/\s+/); + for (var i2 = 0; i2 < eventList.length; i2++) { + var evt = eventList[i2]; + if (emptyString(evt)) { + continue; + } + var match3 = evt.match(eventRegex); + if (match3) { + var type3 = match3[1]; + var namespace = match3[2] ? match3[2] : null; + var ret = handler(self2, evt, type3, namespace, qualifier, callback, conf5); + if (ret === false) { + break; + } + } + } + }, "forEachEvent"); + makeEventObj = /* @__PURE__ */ __name(function makeEventObj2(self2, obj) { + self2.addEventFields(self2.context, obj); + return new Event(obj.type, obj); + }, "makeEventObj"); + forEachEventObj = /* @__PURE__ */ __name(function forEachEventObj2(self2, handler, events) { + if (event(events)) { + handler(self2, events); + return; + } else if (plainObject(events)) { + handler(self2, makeEventObj(self2, events)); + return; + } + var eventList = array2(events) ? events : events.split(/\s+/); + for (var i2 = 0; i2 < eventList.length; i2++) { + var evt = eventList[i2]; + if (emptyString(evt)) { + continue; + } + var match3 = evt.match(eventRegex); + if (match3) { + var type3 = match3[1]; + var namespace = match3[2] ? match3[2] : null; + var eventObj = makeEventObj(self2, { + type: type3, + namespace, + target: self2.context + }); + handler(self2, eventObj); + } + } + }, "forEachEventObj"); + p2.on = p2.addListener = function(events, qualifier, callback, conf5, confOverrides) { + forEachEvent(this, function(self2, event3, type3, namespace, qualifier2, callback2, conf6) { + if (fn$6(callback2)) { + self2.listeners.push({ + event: event3, + // full event string + callback: callback2, + // callback to run + type: type3, + // the event type (e.g. 'click') + namespace, + // the event namespace (e.g. ".foo") + qualifier: qualifier2, + // a restriction on whether to match this emitter + conf: conf6 + // additional configuration + }); + } + }, events, qualifier, callback, conf5, confOverrides); + return this; + }; + p2.one = function(events, qualifier, callback, conf5) { + return this.on(events, qualifier, callback, conf5, { + one: true + }); + }; + p2.removeListener = p2.off = function(events, qualifier, callback, conf5) { + var _this = this; + if (this.emitting !== 0) { + this.listeners = copyArray2(this.listeners); + } + var listeners = this.listeners; + var _loop = /* @__PURE__ */ __name(function _loop2(i3) { + var listener = listeners[i3]; + forEachEvent(_this, function(self2, event3, type3, namespace, qualifier2, callback2) { + if ((listener.type === type3 || events === "*") && (!namespace && listener.namespace !== ".*" || listener.namespace === namespace) && (!qualifier2 || self2.qualifierCompare(listener.qualifier, qualifier2)) && (!callback2 || listener.callback === callback2)) { + listeners.splice(i3, 1); + return false; + } + }, events, qualifier, callback, conf5); + }, "_loop"); + for (var i2 = listeners.length - 1; i2 >= 0; i2--) { + _loop(i2); + } + return this; + }; + p2.removeAllListeners = function() { + return this.removeListener("*"); + }; + p2.emit = p2.trigger = function(events, extraParams, manualCallback) { + var listeners = this.listeners; + var numListenersBeforeEmit = listeners.length; + this.emitting++; + if (!array2(extraParams)) { + extraParams = [extraParams]; + } + forEachEventObj(this, function(self2, eventObj) { + if (manualCallback != null) { + listeners = [{ + event: eventObj.event, + type: eventObj.type, + namespace: eventObj.namespace, + callback: manualCallback + }]; + numListenersBeforeEmit = listeners.length; + } + var _loop2 = /* @__PURE__ */ __name(function _loop22() { + var listener = listeners[i2]; + if (listener.type === eventObj.type && (!listener.namespace || listener.namespace === eventObj.namespace || listener.namespace === universalNamespace) && self2.eventMatches(self2.context, listener, eventObj)) { + var args = [eventObj]; + if (extraParams != null) { + push(args, extraParams); + } + self2.beforeEmit(self2.context, listener, eventObj); + if (listener.conf && listener.conf.one) { + self2.listeners = self2.listeners.filter(function(l4) { + return l4 !== listener; + }); + } + var context = self2.callbackContext(self2.context, listener, eventObj); + var ret = listener.callback.apply(context, args); + self2.afterEmit(self2.context, listener, eventObj); + if (ret === false) { + eventObj.stopPropagation(); + eventObj.preventDefault(); + } + } + }, "_loop2"); + for (var i2 = 0; i2 < numListenersBeforeEmit; i2++) { + _loop2(); + } + if (self2.bubble(self2.context) && !eventObj.isPropagationStopped()) { + self2.parent(self2.context).emit(eventObj, extraParams); + } + }, events); + this.emitting--; + return this; + }; + emitterOptions$1 = { + qualifierCompare: /* @__PURE__ */ __name(function qualifierCompare2(selector1, selector2) { + if (selector1 == null || selector2 == null) { + return selector1 == null && selector2 == null; + } else { + return selector1.sameText(selector2); + } + }, "qualifierCompare"), + eventMatches: /* @__PURE__ */ __name(function eventMatches2(ele, listener, eventObj) { + var selector = listener.qualifier; + if (selector != null) { + return ele !== eventObj.target && element(eventObj.target) && selector.matches(eventObj.target); + } + return true; + }, "eventMatches"), + addEventFields: /* @__PURE__ */ __name(function addEventFields2(ele, evt) { + evt.cy = ele.cy(); + evt.target = ele; + }, "addEventFields"), + callbackContext: /* @__PURE__ */ __name(function callbackContext2(ele, listener, eventObj) { + return listener.qualifier != null ? eventObj.target : ele; + }, "callbackContext"), + beforeEmit: /* @__PURE__ */ __name(function beforeEmit2(context, listener) { + if (listener.conf && listener.conf.once) { + listener.conf.onceCollection.removeListener(listener.event, listener.qualifier, listener.callback); + } + }, "beforeEmit"), + bubble: /* @__PURE__ */ __name(function bubble2() { + return true; + }, "bubble"), + parent: /* @__PURE__ */ __name(function parent3(ele) { + return ele.isChild() ? ele.parent() : ele.cy(); + }, "parent") + }; + argSelector$1 = /* @__PURE__ */ __name(function argSelector(arg) { + if (string(arg)) { + return new Selector(arg); + } else { + return arg; + } + }, "argSelector"); + elesfn$9 = { + createEmitter: /* @__PURE__ */ __name(function createEmitter() { + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var _p = ele._private; + if (!_p.emitter) { + _p.emitter = new Emitter(emitterOptions$1, ele); + } + } + return this; + }, "createEmitter"), + emitter: /* @__PURE__ */ __name(function emitter() { + return this._private.emitter; + }, "emitter"), + on: /* @__PURE__ */ __name(function on(events, selector, callback) { + var argSel = argSelector$1(selector); + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + ele.emitter().on(events, argSel, callback); + } + return this; + }, "on"), + removeListener: /* @__PURE__ */ __name(function removeListener(events, selector, callback) { + var argSel = argSelector$1(selector); + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + ele.emitter().removeListener(events, argSel, callback); + } + return this; + }, "removeListener"), + removeAllListeners: /* @__PURE__ */ __name(function removeAllListeners() { + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + ele.emitter().removeAllListeners(); + } + return this; + }, "removeAllListeners"), + one: /* @__PURE__ */ __name(function one2(events, selector, callback) { + var argSel = argSelector$1(selector); + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + ele.emitter().one(events, argSel, callback); + } + return this; + }, "one"), + once: /* @__PURE__ */ __name(function once(events, selector, callback) { + var argSel = argSelector$1(selector); + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + ele.emitter().on(events, argSel, callback, { + once: true, + onceCollection: this + }); + } + }, "once"), + emit: /* @__PURE__ */ __name(function emit(events, extraParams) { + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + ele.emitter().emit(events, extraParams); + } + return this; + }, "emit"), + emitAndNotify: /* @__PURE__ */ __name(function emitAndNotify(event3, extraParams) { + if (this.length === 0) { + return; + } + this.cy().notify(event3, this); + this.emit(event3, extraParams); + return this; + }, "emitAndNotify") + }; + define2.eventAliasesOn(elesfn$9); + elesfn$8 = { + nodes: /* @__PURE__ */ __name(function nodes(selector) { + return this.filter(function(ele) { + return ele.isNode(); + }).filter(selector); + }, "nodes"), + edges: /* @__PURE__ */ __name(function edges(selector) { + return this.filter(function(ele) { + return ele.isEdge(); + }).filter(selector); + }, "edges"), + // internal helper to get nodes and edges as separate collections with single iteration over elements + byGroup: /* @__PURE__ */ __name(function byGroup() { + var nodes5 = this.spawn(); + var edges3 = this.spawn(); + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + if (ele.isNode()) { + nodes5.push(ele); + } else { + edges3.push(ele); + } + } + return { + nodes: nodes5, + edges: edges3 + }; + }, "byGroup"), + filter: /* @__PURE__ */ __name(function filter5(_filter, thisArg) { + if (_filter === void 0) { + return this; + } else if (string(_filter) || elementOrCollection(_filter)) { + return new Selector(_filter).filter(this); + } else if (fn$6(_filter)) { + var filterEles = this.spawn(); + var eles = this; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var include = thisArg ? _filter.apply(thisArg, [ele, i2, eles]) : _filter(ele, i2, eles); + if (include) { + filterEles.push(ele); + } + } + return filterEles; + } + return this.spawn(); + }, "filter"), + not: /* @__PURE__ */ __name(function not(toRemove) { + if (!toRemove) { + return this; + } else { + if (string(toRemove)) { + toRemove = this.filter(toRemove); + } + var elements2 = this.spawn(); + for (var i2 = 0; i2 < this.length; i2++) { + var element3 = this[i2]; + var remove3 = toRemove.has(element3); + if (!remove3) { + elements2.push(element3); + } + } + return elements2; + } + }, "not"), + absoluteComplement: /* @__PURE__ */ __name(function absoluteComplement() { + var cy = this.cy(); + return cy.mutableElements().not(this); + }, "absoluteComplement"), + intersect: /* @__PURE__ */ __name(function intersect2(other) { + if (string(other)) { + var selector = other; + return this.filter(selector); + } + var elements2 = this.spawn(); + var col1 = this; + var col2 = other; + var col1Smaller = this.length < other.length; + var colS = col1Smaller ? col1 : col2; + var colL = col1Smaller ? col2 : col1; + for (var i2 = 0; i2 < colS.length; i2++) { + var ele = colS[i2]; + if (colL.has(ele)) { + elements2.push(ele); + } + } + return elements2; + }, "intersect"), + xor: /* @__PURE__ */ __name(function xor(other) { + var cy = this._private.cy; + if (string(other)) { + other = cy.$(other); + } + var elements2 = this.spawn(); + var col1 = this; + var col2 = other; + var add3 = /* @__PURE__ */ __name(function add4(col, other2) { + for (var i2 = 0; i2 < col.length; i2++) { + var ele = col[i2]; + var id35 = ele._private.data.id; + var inOther = other2.hasElementWithId(id35); + if (!inOther) { + elements2.push(ele); + } + } + }, "add"); + add3(col1, col2); + add3(col2, col1); + return elements2; + }, "xor"), + diff: /* @__PURE__ */ __name(function diff(other) { + var cy = this._private.cy; + if (string(other)) { + other = cy.$(other); + } + var left3 = this.spawn(); + var right3 = this.spawn(); + var both = this.spawn(); + var col1 = this; + var col2 = other; + var add3 = /* @__PURE__ */ __name(function add4(col, other2, retEles) { + for (var i2 = 0; i2 < col.length; i2++) { + var ele = col[i2]; + var id35 = ele._private.data.id; + var inOther = other2.hasElementWithId(id35); + if (inOther) { + both.merge(ele); + } else { + retEles.push(ele); + } + } + }, "add"); + add3(col1, col2, left3); + add3(col2, col1, right3); + return { + left: left3, + right: right3, + both + }; + }, "diff"), + add: /* @__PURE__ */ __name(function add(toAdd) { + var cy = this._private.cy; + if (!toAdd) { + return this; + } + if (string(toAdd)) { + var selector = toAdd; + toAdd = cy.mutableElements().filter(selector); + } + var elements2 = this.spawnSelf(); + for (var i2 = 0; i2 < toAdd.length; i2++) { + var ele = toAdd[i2]; + var add3 = !this.has(ele); + if (add3) { + elements2.push(ele); + } + } + return elements2; + }, "add"), + // in place merge on calling collection + merge: /* @__PURE__ */ __name(function merge4(toAdd) { + var _p = this._private; + var cy = _p.cy; + if (!toAdd) { + return this; + } + if (toAdd && string(toAdd)) { + var selector = toAdd; + toAdd = cy.mutableElements().filter(selector); + } + var map6 = _p.map; + for (var i2 = 0; i2 < toAdd.length; i2++) { + var toAddEle = toAdd[i2]; + var id35 = toAddEle._private.data.id; + var add3 = !map6.has(id35); + if (add3) { + var index = this.length++; + this[index] = toAddEle; + map6.set(id35, { + ele: toAddEle, + index + }); + } + } + return this; + }, "merge"), + unmergeAt: /* @__PURE__ */ __name(function unmergeAt(i2) { + var ele = this[i2]; + var id35 = ele.id(); + var _p = this._private; + var map6 = _p.map; + this[i2] = void 0; + map6["delete"](id35); + var unmergedLastEle = i2 === this.length - 1; + if (this.length > 1 && !unmergedLastEle) { + var lastEleI = this.length - 1; + var lastEle = this[lastEleI]; + var lastEleId = lastEle._private.data.id; + this[lastEleI] = void 0; + this[i2] = lastEle; + map6.set(lastEleId, { + ele: lastEle, + index: i2 + }); + } + this.length--; + return this; + }, "unmergeAt"), + // remove single ele in place in calling collection + unmergeOne: /* @__PURE__ */ __name(function unmergeOne(ele) { + ele = ele[0]; + var _p = this._private; + var id35 = ele._private.data.id; + var map6 = _p.map; + var entry = map6.get(id35); + if (!entry) { + return this; + } + var i2 = entry.index; + this.unmergeAt(i2); + return this; + }, "unmergeOne"), + // remove eles in place on calling collection + unmerge: /* @__PURE__ */ __name(function unmerge(toRemove) { + var cy = this._private.cy; + if (!toRemove) { + return this; + } + if (toRemove && string(toRemove)) { + var selector = toRemove; + toRemove = cy.mutableElements().filter(selector); + } + for (var i2 = 0; i2 < toRemove.length; i2++) { + this.unmergeOne(toRemove[i2]); + } + return this; + }, "unmerge"), + unmergeBy: /* @__PURE__ */ __name(function unmergeBy(toRmFn) { + for (var i2 = this.length - 1; i2 >= 0; i2--) { + var ele = this[i2]; + if (toRmFn(ele)) { + this.unmergeAt(i2); + } + } + return this; + }, "unmergeBy"), + map: /* @__PURE__ */ __name(function map4(mapFn, thisArg) { + var arr = []; + var eles = this; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var ret = thisArg ? mapFn.apply(thisArg, [ele, i2, eles]) : mapFn(ele, i2, eles); + arr.push(ret); + } + return arr; + }, "map"), + reduce: /* @__PURE__ */ __name(function reduce2(fn3, initialValue) { + var val = initialValue; + var eles = this; + for (var i2 = 0; i2 < eles.length; i2++) { + val = fn3(val, eles[i2], i2, eles); + } + return val; + }, "reduce"), + max: /* @__PURE__ */ __name(function max8(valFn, thisArg) { + var max10 = -Infinity; + var maxEle; + var eles = this; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var val = thisArg ? valFn.apply(thisArg, [ele, i2, eles]) : valFn(ele, i2, eles); + if (val > max10) { + max10 = val; + maxEle = ele; + } + } + return { + value: max10, + ele: maxEle + }; + }, "max"), + min: /* @__PURE__ */ __name(function min7(valFn, thisArg) { + var min10 = Infinity; + var minEle; + var eles = this; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var val = thisArg ? valFn.apply(thisArg, [ele, i2, eles]) : valFn(ele, i2, eles); + if (val < min10) { + min10 = val; + minEle = ele; + } + } + return { + value: min10, + ele: minEle + }; + }, "min") + }; + fn$1 = elesfn$8; + fn$1["u"] = fn$1["|"] = fn$1["+"] = fn$1.union = fn$1.or = fn$1.add; + fn$1["\\"] = fn$1["!"] = fn$1["-"] = fn$1.difference = fn$1.relativeComplement = fn$1.subtract = fn$1.not; + fn$1["n"] = fn$1["&"] = fn$1["."] = fn$1.and = fn$1.intersection = fn$1.intersect; + fn$1["^"] = fn$1["(+)"] = fn$1["(-)"] = fn$1.symmetricDifference = fn$1.symdiff = fn$1.xor; + fn$1.fnFilter = fn$1.filterFn = fn$1.stdFilter = fn$1.filter; + fn$1.complement = fn$1.abscomp = fn$1.absoluteComplement; + elesfn$7 = { + isNode: /* @__PURE__ */ __name(function isNode() { + return this.group() === "nodes"; + }, "isNode"), + isEdge: /* @__PURE__ */ __name(function isEdge() { + return this.group() === "edges"; + }, "isEdge"), + isLoop: /* @__PURE__ */ __name(function isLoop() { + return this.isEdge() && this.source()[0] === this.target()[0]; + }, "isLoop"), + isSimple: /* @__PURE__ */ __name(function isSimple() { + return this.isEdge() && this.source()[0] !== this.target()[0]; + }, "isSimple"), + group: /* @__PURE__ */ __name(function group() { + var ele = this[0]; + if (ele) { + return ele._private.group; + } + }, "group") + }; + zIndexSort = /* @__PURE__ */ __name(function zIndexSort2(a2, b3) { + var cy = a2.cy(); + var hasCompoundNodes2 = cy.hasCompoundNodes(); + function getDepth(ele) { + var style3 = ele.pstyle("z-compound-depth"); + if (style3.value === "auto") { + return hasCompoundNodes2 ? ele.zDepth() : 0; + } else if (style3.value === "bottom") { + return -1; + } else if (style3.value === "top") { + return MAX_INT$1; + } + return 0; + } + __name(getDepth, "getDepth"); + var depthDiff = getDepth(a2) - getDepth(b3); + if (depthDiff !== 0) { + return depthDiff; + } + function getEleDepth(ele) { + var style3 = ele.pstyle("z-index-compare"); + if (style3.value === "auto") { + return ele.isNode() ? 1 : 0; + } + return 0; + } + __name(getEleDepth, "getEleDepth"); + var eleDiff = getEleDepth(a2) - getEleDepth(b3); + if (eleDiff !== 0) { + return eleDiff; + } + var zDiff = a2.pstyle("z-index").value - b3.pstyle("z-index").value; + if (zDiff !== 0) { + return zDiff; + } + return a2.poolIndex() - b3.poolIndex(); + }, "zIndexSort"); + elesfn$6 = { + forEach: /* @__PURE__ */ __name(function forEach2(fn3, thisArg) { + if (fn$6(fn3)) { + var N3 = this.length; + for (var i2 = 0; i2 < N3; i2++) { + var ele = this[i2]; + var ret = thisArg ? fn3.apply(thisArg, [ele, i2, this]) : fn3(ele, i2, this); + if (ret === false) { + break; + } + } + } + return this; + }, "forEach"), + toArray: /* @__PURE__ */ __name(function toArray2() { + var array4 = []; + for (var i2 = 0; i2 < this.length; i2++) { + array4.push(this[i2]); + } + return array4; + }, "toArray"), + slice: /* @__PURE__ */ __name(function slice2(start3, end2) { + var array4 = []; + var thisSize = this.length; + if (end2 == null) { + end2 = thisSize; + } + if (start3 == null) { + start3 = 0; + } + if (start3 < 0) { + start3 = thisSize + start3; + } + if (end2 < 0) { + end2 = thisSize + end2; + } + for (var i2 = start3; i2 >= 0 && i2 < end2 && i2 < thisSize; i2++) { + array4.push(this[i2]); + } + return this.spawn(array4); + }, "slice"), + size: /* @__PURE__ */ __name(function size2() { + return this.length; + }, "size"), + eq: /* @__PURE__ */ __name(function eq2(i2) { + return this[i2] || this.spawn(); + }, "eq"), + first: /* @__PURE__ */ __name(function first() { + return this[0] || this.spawn(); + }, "first"), + last: /* @__PURE__ */ __name(function last2() { + return this[this.length - 1] || this.spawn(); + }, "last"), + empty: /* @__PURE__ */ __name(function empty2() { + return this.length === 0; + }, "empty"), + nonempty: /* @__PURE__ */ __name(function nonempty() { + return !this.empty(); + }, "nonempty"), + sort: /* @__PURE__ */ __name(function sort2(sortFn) { + if (!fn$6(sortFn)) { + return this; + } + var sorted = this.toArray().sort(sortFn); + return this.spawn(sorted); + }, "sort"), + sortByZIndex: /* @__PURE__ */ __name(function sortByZIndex() { + return this.sort(zIndexSort); + }, "sortByZIndex"), + zDepth: /* @__PURE__ */ __name(function zDepth() { + var ele = this[0]; + if (!ele) { + return void 0; + } + var _p = ele._private; + var group2 = _p.group; + if (group2 === "nodes") { + var depth = _p.data.parent ? ele.parents().size() : 0; + if (!ele.isParent()) { + return MAX_INT$1 - 1; + } + return depth; + } else { + var src = _p.source; + var tgt = _p.target; + var srcDepth = src.zDepth(); + var tgtDepth = tgt.zDepth(); + return Math.max(srcDepth, tgtDepth, 0); + } + }, "zDepth") + }; + elesfn$6.each = elesfn$6.forEach; + defineSymbolIterator = /* @__PURE__ */ __name(function defineSymbolIterator2() { + var typeofUndef = "undefined"; + var isIteratorSupported = (typeof Symbol === "undefined" ? "undefined" : _typeof(Symbol)) != typeofUndef && _typeof(Symbol.iterator) != typeofUndef; + if (isIteratorSupported) { + elesfn$6[Symbol.iterator] = function() { + var _this = this; + var entry = { + value: void 0, + done: false + }; + var i2 = 0; + var length2 = this.length; + return _defineProperty$1({ + next: /* @__PURE__ */ __name(function next3() { + if (i2 < length2) { + entry.value = _this[i2++]; + } else { + entry.value = void 0; + entry.done = true; + } + return entry; + }, "next") + }, Symbol.iterator, function() { + return this; + }); + }; + } + }, "defineSymbolIterator"); + defineSymbolIterator(); + getLayoutDimensionOptions = defaults$g({ + nodeDimensionsIncludeLabels: false + }); + elesfn$5 = { + // Calculates and returns node dimensions { x, y } based on options given + layoutDimensions: /* @__PURE__ */ __name(function layoutDimensions(options2) { + options2 = getLayoutDimensionOptions(options2); + var dims; + if (!this.takesUpSpace()) { + dims = { + w: 0, + h: 0 + }; + } else if (options2.nodeDimensionsIncludeLabels) { + var bbDim = this.boundingBox(); + dims = { + w: bbDim.w, + h: bbDim.h + }; + } else { + dims = { + w: this.outerWidth(), + h: this.outerHeight() + }; + } + if (dims.w === 0 || dims.h === 0) { + dims.w = dims.h = 1; + } + return dims; + }, "layoutDimensions"), + // using standard layout options, apply position function (w/ or w/o animation) + layoutPositions: /* @__PURE__ */ __name(function layoutPositions(layout7, options2, fn3) { + var nodes5 = this.nodes().filter(function(n2) { + return !n2.isParent(); + }); + var cy = this.cy(); + var layoutEles = options2.eles; + var getMemoizeKey = /* @__PURE__ */ __name(function getMemoizeKey2(node3) { + return node3.id(); + }, "getMemoizeKey"); + var fnMem = memoize3(fn3, getMemoizeKey); + layout7.emit({ + type: "layoutstart", + layout: layout7 + }); + layout7.animations = []; + var calculateSpacing = /* @__PURE__ */ __name(function calculateSpacing2(spacing2, nodesBb, pos) { + var center4 = { + x: nodesBb.x1 + nodesBb.w / 2, + y: nodesBb.y1 + nodesBb.h / 2 + }; + var spacingVector = { + // scale from center of bounding box (not necessarily 0,0) + x: (pos.x - center4.x) * spacing2, + y: (pos.y - center4.y) * spacing2 + }; + return { + x: center4.x + spacingVector.x, + y: center4.y + spacingVector.y + }; + }, "calculateSpacing"); + var useSpacingFactor = options2.spacingFactor && options2.spacingFactor !== 1; + var spacingBb = /* @__PURE__ */ __name(function spacingBb2() { + if (!useSpacingFactor) { + return null; + } + var bb2 = makeBoundingBox(); + for (var i3 = 0; i3 < nodes5.length; i3++) { + var node3 = nodes5[i3]; + var pos = fnMem(node3, i3); + expandBoundingBoxByPoint(bb2, pos.x, pos.y); + } + return bb2; + }, "spacingBb"); + var bb = spacingBb(); + var getFinalPos = memoize3(function(node3, i3) { + var newPos2 = fnMem(node3, i3); + if (useSpacingFactor) { + var spacing2 = Math.abs(options2.spacingFactor); + newPos2 = calculateSpacing(spacing2, bb, newPos2); + } + if (options2.transform != null) { + newPos2 = options2.transform(node3, newPos2); + } + return newPos2; + }, getMemoizeKey); + if (options2.animate) { + for (var i2 = 0; i2 < nodes5.length; i2++) { + var node2 = nodes5[i2]; + var newPos = getFinalPos(node2, i2); + var animateNode = options2.animateFilter == null || options2.animateFilter(node2, i2); + if (animateNode) { + var ani = node2.animation({ + position: newPos, + duration: options2.animationDuration, + easing: options2.animationEasing + }); + layout7.animations.push(ani); + } else { + node2.position(newPos); + } + } + if (options2.fit) { + var fitAni = cy.animation({ + fit: { + boundingBox: layoutEles.boundingBoxAt(getFinalPos), + padding: options2.padding + }, + duration: options2.animationDuration, + easing: options2.animationEasing + }); + layout7.animations.push(fitAni); + } else if (options2.zoom !== void 0 && options2.pan !== void 0) { + var zoomPanAni = cy.animation({ + zoom: options2.zoom, + pan: options2.pan, + duration: options2.animationDuration, + easing: options2.animationEasing + }); + layout7.animations.push(zoomPanAni); + } + layout7.animations.forEach(function(ani2) { + return ani2.play(); + }); + layout7.one("layoutready", options2.ready); + layout7.emit({ + type: "layoutready", + layout: layout7 + }); + Promise$1.all(layout7.animations.map(function(ani2) { + return ani2.promise(); + })).then(function() { + layout7.one("layoutstop", options2.stop); + layout7.emit({ + type: "layoutstop", + layout: layout7 + }); + }); + } else { + nodes5.positions(getFinalPos); + if (options2.fit) { + cy.fit(options2.eles, options2.padding); + } + if (options2.zoom != null) { + cy.zoom(options2.zoom); + } + if (options2.pan) { + cy.pan(options2.pan); + } + layout7.one("layoutready", options2.ready); + layout7.emit({ + type: "layoutready", + layout: layout7 + }); + layout7.one("layoutstop", options2.stop); + layout7.emit({ + type: "layoutstop", + layout: layout7 + }); + } + return this; + }, "layoutPositions"), + layout: /* @__PURE__ */ __name(function layout2(options2) { + var cy = this.cy(); + return cy.makeLayout(extend4({}, options2, { + eles: this + })); + }, "layout") + }; + elesfn$5.createLayout = elesfn$5.makeLayout = elesfn$5.layout; + __name(styleCache, "styleCache"); + __name(cacheStyleFunction, "cacheStyleFunction"); + __name(cachePrototypeStyleFunction, "cachePrototypeStyleFunction"); + elesfn$4 = { + recalculateRenderedStyle: /* @__PURE__ */ __name(function recalculateRenderedStyle(useCache) { + var cy = this.cy(); + var renderer13 = cy.renderer(); + var styleEnabled2 = cy.styleEnabled(); + if (renderer13 && styleEnabled2) { + renderer13.recalculateRenderedStyle(this, useCache); + } + return this; + }, "recalculateRenderedStyle"), + dirtyStyleCache: /* @__PURE__ */ __name(function dirtyStyleCache() { + var cy = this.cy(); + var dirty = /* @__PURE__ */ __name(function dirty2(ele) { + return ele._private.styleCache = null; + }, "dirty"); + if (cy.hasCompoundNodes()) { + var eles; + eles = this.spawnSelf().merge(this.descendants()).merge(this.parents()); + eles.merge(eles.connectedEdges()); + eles.forEach(dirty); + } else { + this.forEach(function(ele) { + dirty(ele); + ele.connectedEdges().forEach(dirty); + }); + } + return this; + }, "dirtyStyleCache"), + // fully updates (recalculates) the style for the elements + updateStyle: /* @__PURE__ */ __name(function updateStyle(notifyRenderer) { + var cy = this._private.cy; + if (!cy.styleEnabled()) { + return this; + } + if (cy.batching()) { + var bEles = cy._private.batchStyleEles; + bEles.merge(this); + return this; + } + var hasCompounds = cy.hasCompoundNodes(); + var updatedEles = this; + notifyRenderer = notifyRenderer || notifyRenderer === void 0 ? true : false; + if (hasCompounds) { + updatedEles = this.spawnSelf().merge(this.descendants()).merge(this.parents()); + } + var changedEles = updatedEles; + if (notifyRenderer) { + changedEles.emitAndNotify("style"); + } else { + changedEles.emit("style"); + } + updatedEles.forEach(function(ele) { + return ele._private.styleDirty = true; + }); + return this; + }, "updateStyle"), + // private: clears dirty flag and recalculates style + cleanStyle: /* @__PURE__ */ __name(function cleanStyle() { + var cy = this.cy(); + if (!cy.styleEnabled()) { + return; + } + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + if (ele._private.styleDirty) { + ele._private.styleDirty = false; + cy.style().apply(ele); + } + } + }, "cleanStyle"), + // get the internal parsed style object for the specified property + parsedStyle: /* @__PURE__ */ __name(function parsedStyle(property3) { + var includeNonDefault = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; + var ele = this[0]; + var cy = ele.cy(); + if (!cy.styleEnabled()) { + return; + } + if (ele) { + if (ele._private.styleDirty) { + ele._private.styleDirty = false; + cy.style().apply(ele); + } + var overriddenStyle = ele._private.style[property3]; + if (overriddenStyle != null) { + return overriddenStyle; + } else if (includeNonDefault) { + return cy.style().getDefaultProperty(property3); + } else { + return null; + } + } + }, "parsedStyle"), + numericStyle: /* @__PURE__ */ __name(function numericStyle(property3) { + var ele = this[0]; + if (!ele.cy().styleEnabled()) { + return; + } + if (ele) { + var pstyle = ele.pstyle(property3); + return pstyle.pfValue !== void 0 ? pstyle.pfValue : pstyle.value; + } + }, "numericStyle"), + numericStyleUnits: /* @__PURE__ */ __name(function numericStyleUnits(property3) { + var ele = this[0]; + if (!ele.cy().styleEnabled()) { + return; + } + if (ele) { + return ele.pstyle(property3).units; + } + }, "numericStyleUnits"), + // get the specified css property as a rendered value (i.e. on-screen value) + // or get the whole rendered style if no property specified (NB doesn't allow setting) + renderedStyle: /* @__PURE__ */ __name(function renderedStyle(property3) { + var cy = this.cy(); + if (!cy.styleEnabled()) { + return this; + } + var ele = this[0]; + if (ele) { + return cy.style().getRenderedStyle(ele, property3); + } + }, "renderedStyle"), + // read the calculated css style of the element or override the style (via a bypass) + style: /* @__PURE__ */ __name(function style(name, value2) { + var cy = this.cy(); + if (!cy.styleEnabled()) { + return this; + } + var updateTransitions = false; + var style3 = cy.style(); + if (plainObject(name)) { + var props = name; + style3.applyBypass(this, props, updateTransitions); + this.emitAndNotify("style"); + } else if (string(name)) { + if (value2 === void 0) { + var ele = this[0]; + if (ele) { + return style3.getStylePropertyValue(ele, name); + } else { + return; + } + } else { + style3.applyBypass(this, name, value2, updateTransitions); + this.emitAndNotify("style"); + } + } else if (name === void 0) { + var _ele = this[0]; + if (_ele) { + return style3.getRawStyle(_ele); + } else { + return; + } + } + return this; + }, "style"), + removeStyle: /* @__PURE__ */ __name(function removeStyle(names) { + var cy = this.cy(); + if (!cy.styleEnabled()) { + return this; + } + var updateTransitions = false; + var style3 = cy.style(); + var eles = this; + if (names === void 0) { + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + style3.removeAllBypasses(ele, updateTransitions); + } + } else { + names = names.split(/\s+/); + for (var _i = 0; _i < eles.length; _i++) { + var _ele2 = eles[_i]; + style3.removeBypasses(_ele2, names, updateTransitions); + } + } + this.emitAndNotify("style"); + return this; + }, "removeStyle"), + show: /* @__PURE__ */ __name(function show() { + this.css("display", "element"); + return this; + }, "show"), + hide: /* @__PURE__ */ __name(function hide() { + this.css("display", "none"); + return this; + }, "hide"), + effectiveOpacity: /* @__PURE__ */ __name(function effectiveOpacity() { + var cy = this.cy(); + if (!cy.styleEnabled()) { + return 1; + } + var hasCompoundNodes2 = cy.hasCompoundNodes(); + var ele = this[0]; + if (ele) { + var _p = ele._private; + var parentOpacity = ele.pstyle("opacity").value; + if (!hasCompoundNodes2) { + return parentOpacity; + } + var parents3 = !_p.data.parent ? null : ele.parents(); + if (parents3) { + for (var i2 = 0; i2 < parents3.length; i2++) { + var parent4 = parents3[i2]; + var opacity = parent4.pstyle("opacity").value; + parentOpacity = opacity * parentOpacity; + } + } + return parentOpacity; + } + }, "effectiveOpacity"), + transparent: /* @__PURE__ */ __name(function transparent() { + var cy = this.cy(); + if (!cy.styleEnabled()) { + return false; + } + var ele = this[0]; + var hasCompoundNodes2 = ele.cy().hasCompoundNodes(); + if (ele) { + if (!hasCompoundNodes2) { + return ele.pstyle("opacity").value === 0; + } else { + return ele.effectiveOpacity() === 0; + } + } + }, "transparent"), + backgrounding: /* @__PURE__ */ __name(function backgrounding() { + var cy = this.cy(); + if (!cy.styleEnabled()) { + return false; + } + var ele = this[0]; + return ele._private.backgrounding ? true : false; + }, "backgrounding") + }; + __name(checkCompound, "checkCompound"); + __name(defineDerivedStateFunction, "defineDerivedStateFunction"); + eleTakesUpSpace = cacheStyleFunction("eleTakesUpSpace", function(ele) { + return ele.pstyle("display").value === "element" && ele.width() !== 0 && (ele.isNode() ? ele.height() !== 0 : true); + }); + elesfn$4.takesUpSpace = cachePrototypeStyleFunction("takesUpSpace", defineDerivedStateFunction({ + ok: eleTakesUpSpace + })); + eleInteractive = cacheStyleFunction("eleInteractive", function(ele) { + return ele.pstyle("events").value === "yes" && ele.pstyle("visibility").value === "visible" && eleTakesUpSpace(ele); + }); + parentInteractive = cacheStyleFunction("parentInteractive", function(parent4) { + return parent4.pstyle("visibility").value === "visible" && eleTakesUpSpace(parent4); + }); + elesfn$4.interactive = cachePrototypeStyleFunction("interactive", defineDerivedStateFunction({ + ok: eleInteractive, + parentOk: parentInteractive, + edgeOkViaNode: eleTakesUpSpace + })); + elesfn$4.noninteractive = function() { + var ele = this[0]; + if (ele) { + return !ele.interactive(); + } + }; + eleVisible = cacheStyleFunction("eleVisible", function(ele) { + return ele.pstyle("visibility").value === "visible" && ele.pstyle("opacity").pfValue !== 0 && eleTakesUpSpace(ele); + }); + edgeVisibleViaNode = eleTakesUpSpace; + elesfn$4.visible = cachePrototypeStyleFunction("visible", defineDerivedStateFunction({ + ok: eleVisible, + edgeOkViaNode: edgeVisibleViaNode + })); + elesfn$4.hidden = function() { + var ele = this[0]; + if (ele) { + return !ele.visible(); + } + }; + elesfn$4.isBundledBezier = cachePrototypeStyleFunction("isBundledBezier", function() { + if (!this.cy().styleEnabled()) { + return false; + } + return !this.removed() && this.pstyle("curve-style").value === "bezier" && this.takesUpSpace(); + }); + elesfn$4.bypass = elesfn$4.css = elesfn$4.style; + elesfn$4.renderedCss = elesfn$4.renderedStyle; + elesfn$4.removeBypass = elesfn$4.removeCss = elesfn$4.removeStyle; + elesfn$4.pstyle = elesfn$4.parsedStyle; + elesfn$3 = {}; + __name(defineSwitchFunction, "defineSwitchFunction"); + __name(defineSwitchSet, "defineSwitchSet"); + defineSwitchSet({ + field: "locked", + overrideField: /* @__PURE__ */ __name(function overrideField(ele) { + return ele.cy().autolock() ? true : void 0; + }, "overrideField"), + on: "lock", + off: "unlock" + }); + defineSwitchSet({ + field: "grabbable", + overrideField: /* @__PURE__ */ __name(function overrideField2(ele) { + return ele.cy().autoungrabify() || ele.pannable() ? false : void 0; + }, "overrideField"), + on: "grabify", + off: "ungrabify" + }); + defineSwitchSet({ + field: "selected", + ableField: "selectable", + overrideAble: /* @__PURE__ */ __name(function overrideAble(ele) { + return ele.cy().autounselectify() ? false : void 0; + }, "overrideAble"), + on: "select", + off: "unselect" + }); + defineSwitchSet({ + field: "selectable", + overrideField: /* @__PURE__ */ __name(function overrideField3(ele) { + return ele.cy().autounselectify() ? false : void 0; + }, "overrideField"), + on: "selectify", + off: "unselectify" + }); + elesfn$3.deselect = elesfn$3.unselect; + elesfn$3.grabbed = function() { + var ele = this[0]; + if (ele) { + return ele._private.grabbed; + } + }; + defineSwitchSet({ + field: "active", + on: "activate", + off: "unactivate" + }); + defineSwitchSet({ + field: "pannable", + on: "panify", + off: "unpanify" + }); + elesfn$3.inactive = function() { + var ele = this[0]; + if (ele) { + return !ele._private.active; + } + }; + elesfn$2 = {}; + defineDagExtremity = /* @__PURE__ */ __name(function defineDagExtremity2(params) { + return /* @__PURE__ */ __name(function dagExtremityImpl(selector) { + var eles = this; + var ret = []; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + if (!ele.isNode()) { + continue; + } + var disqualified = false; + var edges3 = ele.connectedEdges(); + for (var j3 = 0; j3 < edges3.length; j3++) { + var edge = edges3[j3]; + var src = edge.source(); + var tgt = edge.target(); + if (params.noIncomingEdges && tgt === ele && src !== ele || params.noOutgoingEdges && src === ele && tgt !== ele) { + disqualified = true; + break; + } + } + if (!disqualified) { + ret.push(ele); + } + } + return this.spawn(ret, true).filter(selector); + }, "dagExtremityImpl"); + }, "defineDagExtremity"); + defineDagOneHop = /* @__PURE__ */ __name(function defineDagOneHop2(params) { + return function(selector) { + var eles = this; + var oEles = []; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + if (!ele.isNode()) { + continue; + } + var edges3 = ele.connectedEdges(); + for (var j3 = 0; j3 < edges3.length; j3++) { + var edge = edges3[j3]; + var src = edge.source(); + var tgt = edge.target(); + if (params.outgoing && src === ele) { + oEles.push(edge); + oEles.push(tgt); + } else if (params.incoming && tgt === ele) { + oEles.push(edge); + oEles.push(src); + } + } + } + return this.spawn(oEles, true).filter(selector); + }; + }, "defineDagOneHop"); + defineDagAllHops = /* @__PURE__ */ __name(function defineDagAllHops2(params) { + return function(selector) { + var eles = this; + var sEles = []; + var sElesIds = {}; + for (; ; ) { + var next3 = params.outgoing ? eles.outgoers() : eles.incomers(); + if (next3.length === 0) { + break; + } + var newNext = false; + for (var i2 = 0; i2 < next3.length; i2++) { + var n2 = next3[i2]; + var nid = n2.id(); + if (!sElesIds[nid]) { + sElesIds[nid] = true; + sEles.push(n2); + newNext = true; + } + } + if (!newNext) { + break; + } + eles = next3; + } + return this.spawn(sEles, true).filter(selector); + }; + }, "defineDagAllHops"); + elesfn$2.clearTraversalCache = function() { + for (var i2 = 0; i2 < this.length; i2++) { + this[i2]._private.traversalCache = null; + } + }; + extend4(elesfn$2, { + // get the root nodes in the DAG + roots: defineDagExtremity({ + noIncomingEdges: true + }), + // get the leaf nodes in the DAG + leaves: defineDagExtremity({ + noOutgoingEdges: true + }), + // normally called children in graph theory + // these nodes =edges=> outgoing nodes + outgoers: cache(defineDagOneHop({ + outgoing: true + }), "outgoers"), + // aka DAG descendants + successors: defineDagAllHops({ + outgoing: true + }), + // normally called parents in graph theory + // these nodes <=edges= incoming nodes + incomers: cache(defineDagOneHop({ + incoming: true + }), "incomers"), + // aka DAG ancestors + predecessors: defineDagAllHops({}) + }); + extend4(elesfn$2, { + neighborhood: cache(function(selector) { + var elements2 = []; + var nodes5 = this.nodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + var node2 = nodes5[i2]; + var connectedEdges = node2.connectedEdges(); + for (var j3 = 0; j3 < connectedEdges.length; j3++) { + var edge = connectedEdges[j3]; + var src = edge.source(); + var tgt = edge.target(); + var otherNode = node2 === src ? tgt : src; + if (otherNode.length > 0) { + elements2.push(otherNode[0]); + } + elements2.push(edge[0]); + } + } + return this.spawn(elements2, true).filter(selector); + }, "neighborhood"), + closedNeighborhood: /* @__PURE__ */ __name(function closedNeighborhood(selector) { + return this.neighborhood().add(this).filter(selector); + }, "closedNeighborhood"), + openNeighborhood: /* @__PURE__ */ __name(function openNeighborhood(selector) { + return this.neighborhood(selector); + }, "openNeighborhood") + }); + elesfn$2.neighbourhood = elesfn$2.neighborhood; + elesfn$2.closedNeighbourhood = elesfn$2.closedNeighborhood; + elesfn$2.openNeighbourhood = elesfn$2.openNeighborhood; + extend4(elesfn$2, { + source: cache(/* @__PURE__ */ __name(function sourceImpl(selector) { + var ele = this[0]; + var src; + if (ele) { + src = ele._private.source || ele.cy().collection(); + } + return src && selector ? src.filter(selector) : src; + }, "sourceImpl"), "source"), + target: cache(/* @__PURE__ */ __name(function targetImpl(selector) { + var ele = this[0]; + var tgt; + if (ele) { + tgt = ele._private.target || ele.cy().collection(); + } + return tgt && selector ? tgt.filter(selector) : tgt; + }, "targetImpl"), "target"), + sources: defineSourceFunction({ + attr: "source" + }), + targets: defineSourceFunction({ + attr: "target" + }) + }); + __name(defineSourceFunction, "defineSourceFunction"); + extend4(elesfn$2, { + edgesWith: cache(defineEdgesWithFunction(), "edgesWith"), + edgesTo: cache(defineEdgesWithFunction({ + thisIsSrc: true + }), "edgesTo") + }); + __name(defineEdgesWithFunction, "defineEdgesWithFunction"); + extend4(elesfn$2, { + connectedEdges: cache(function(selector) { + var retEles = []; + var eles = this; + for (var i2 = 0; i2 < eles.length; i2++) { + var node2 = eles[i2]; + if (!node2.isNode()) { + continue; + } + var edges3 = node2._private.edges; + for (var j3 = 0; j3 < edges3.length; j3++) { + var edge = edges3[j3]; + retEles.push(edge); + } + } + return this.spawn(retEles, true).filter(selector); + }, "connectedEdges"), + connectedNodes: cache(function(selector) { + var retEles = []; + var eles = this; + for (var i2 = 0; i2 < eles.length; i2++) { + var edge = eles[i2]; + if (!edge.isEdge()) { + continue; + } + retEles.push(edge.source()[0]); + retEles.push(edge.target()[0]); + } + return this.spawn(retEles, true).filter(selector); + }, "connectedNodes"), + parallelEdges: cache(defineParallelEdgesFunction(), "parallelEdges"), + codirectedEdges: cache(defineParallelEdgesFunction({ + codirected: true + }), "codirectedEdges") + }); + __name(defineParallelEdgesFunction, "defineParallelEdgesFunction"); + extend4(elesfn$2, { + components: /* @__PURE__ */ __name(function components2(root4) { + var self2 = this; + var cy = self2.cy(); + var visited = cy.collection(); + var unvisited = root4 == null ? self2.nodes() : root4.nodes(); + var components3 = []; + if (root4 != null && unvisited.empty()) { + unvisited = root4.sources(); + } + var visitInComponent = /* @__PURE__ */ __name(function visitInComponent2(node2, component2) { + visited.merge(node2); + unvisited.unmerge(node2); + component2.merge(node2); + }, "visitInComponent"); + if (unvisited.empty()) { + return self2.spawn(); + } + var _loop = /* @__PURE__ */ __name(function _loop2() { + var cmpt = cy.collection(); + components3.push(cmpt); + var root5 = unvisited[0]; + visitInComponent(root5, cmpt); + self2.bfs({ + directed: false, + roots: root5, + visit: /* @__PURE__ */ __name(function visit(v3) { + return visitInComponent(v3, cmpt); + }, "visit") + }); + cmpt.forEach(function(node2) { + node2.connectedEdges().forEach(function(e3) { + if (self2.has(e3) && cmpt.has(e3.source()) && cmpt.has(e3.target())) { + cmpt.merge(e3); + } + }); + }); + }, "_loop"); + do { + _loop(); + } while (unvisited.length > 0); + return components3; + }, "components"), + component: /* @__PURE__ */ __name(function component() { + var ele = this[0]; + return ele.cy().mutableElements().components(ele)[0]; + }, "component") + }); + elesfn$2.componentsOf = elesfn$2.components; + Collection = /* @__PURE__ */ __name(function Collection2(cy, elements2) { + var unique = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false; + var removed = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false; + if (cy === void 0) { + error("A collection must have a reference to the core"); + return; + } + var map6 = new Map$1(); + var createdElements = false; + if (!elements2) { + elements2 = []; + } else if (elements2.length > 0 && plainObject(elements2[0]) && !element(elements2[0])) { + createdElements = true; + var eles = []; + var elesIds = new Set$1(); + for (var i2 = 0, l4 = elements2.length; i2 < l4; i2++) { + var json3 = elements2[i2]; + if (json3.data == null) { + json3.data = {}; + } + var _data = json3.data; + if (_data.id == null) { + _data.id = uuid(); + } else if (cy.hasElementWithId(_data.id) || elesIds.has(_data.id)) { + continue; + } + var ele = new Element(cy, json3, false); + eles.push(ele); + elesIds.add(_data.id); + } + elements2 = eles; + } + this.length = 0; + for (var _i = 0, _l = elements2.length; _i < _l; _i++) { + var element$1 = elements2[_i][0]; + if (element$1 == null) { + continue; + } + var id35 = element$1._private.data.id; + if (!unique || !map6.has(id35)) { + if (unique) { + map6.set(id35, { + index: this.length, + ele: element$1 + }); + } + this[this.length] = element$1; + this.length++; + } + } + this._private = { + eles: this, + cy, + get map() { + if (this.lazyMap == null) { + this.rebuildMap(); + } + return this.lazyMap; + }, + set map(m3) { + this.lazyMap = m3; + }, + rebuildMap: /* @__PURE__ */ __name(function rebuildMap() { + var m3 = this.lazyMap = new Map$1(); + var eles2 = this.eles; + for (var _i2 = 0; _i2 < eles2.length; _i2++) { + var _ele = eles2[_i2]; + m3.set(_ele.id(), { + index: _i2, + ele: _ele + }); + } + }, "rebuildMap") + }; + if (unique) { + this._private.map = map6; + } + if (createdElements && !removed) { + this.restore(); + } + }, "Collection"); + elesfn$1 = Element.prototype = Collection.prototype = Object.create(Array.prototype); + elesfn$1.instanceString = function() { + return "collection"; + }; + elesfn$1.spawn = function(eles, unique) { + return new Collection(this.cy(), eles, unique); + }; + elesfn$1.spawnSelf = function() { + return this.spawn(this); + }; + elesfn$1.cy = function() { + return this._private.cy; + }; + elesfn$1.renderer = function() { + return this._private.cy.renderer(); + }; + elesfn$1.element = function() { + return this[0]; + }; + elesfn$1.collection = function() { + if (collection(this)) { + return this; + } else { + return new Collection(this._private.cy, [this]); + } + }; + elesfn$1.unique = function() { + return new Collection(this._private.cy, this, true); + }; + elesfn$1.hasElementWithId = function(id35) { + id35 = "" + id35; + return this._private.map.has(id35); + }; + elesfn$1.getElementById = function(id35) { + id35 = "" + id35; + var cy = this._private.cy; + var entry = this._private.map.get(id35); + return entry ? entry.ele : new Collection(cy); + }; + elesfn$1.$id = elesfn$1.getElementById; + elesfn$1.poolIndex = function() { + var cy = this._private.cy; + var eles = cy._private.elements; + var id35 = this[0]._private.data.id; + return eles._private.map.get(id35).index; + }; + elesfn$1.indexOf = function(ele) { + var id35 = ele[0]._private.data.id; + return this._private.map.get(id35).index; + }; + elesfn$1.indexOfId = function(id35) { + id35 = "" + id35; + return this._private.map.get(id35).index; + }; + elesfn$1.json = function(obj) { + var ele = this.element(); + var cy = this.cy(); + if (ele == null && obj) { + return this; + } + if (ele == null) { + return void 0; + } + var p3 = ele._private; + if (plainObject(obj)) { + cy.startBatch(); + if (obj.data) { + ele.data(obj.data); + var _data2 = p3.data; + if (ele.isEdge()) { + var move = false; + var spec = {}; + var src = obj.data.source; + var tgt = obj.data.target; + if (src != null && src != _data2.source) { + spec.source = "" + src; + move = true; + } + if (tgt != null && tgt != _data2.target) { + spec.target = "" + tgt; + move = true; + } + if (move) { + ele = ele.move(spec); + } + } else { + var newParentValSpecd = "parent" in obj.data; + var parent4 = obj.data.parent; + if (newParentValSpecd && (parent4 != null || _data2.parent != null) && parent4 != _data2.parent) { + if (parent4 === void 0) { + parent4 = null; + } + if (parent4 != null) { + parent4 = "" + parent4; + } + ele = ele.move({ + parent: parent4 + }); + } + } + } + if (obj.position) { + ele.position(obj.position); + } + var checkSwitch = /* @__PURE__ */ __name(function checkSwitch2(k2, trueFnName, falseFnName) { + var obj_k = obj[k2]; + if (obj_k != null && obj_k !== p3[k2]) { + if (obj_k) { + ele[trueFnName](); + } else { + ele[falseFnName](); + } + } + }, "checkSwitch"); + checkSwitch("removed", "remove", "restore"); + checkSwitch("selected", "select", "unselect"); + checkSwitch("selectable", "selectify", "unselectify"); + checkSwitch("locked", "lock", "unlock"); + checkSwitch("grabbable", "grabify", "ungrabify"); + checkSwitch("pannable", "panify", "unpanify"); + if (obj.classes != null) { + ele.classes(obj.classes); + } + cy.endBatch(); + return this; + } else if (obj === void 0) { + var json3 = { + data: copy3(p3.data), + position: copy3(p3.position), + group: p3.group, + removed: p3.removed, + selected: p3.selected, + selectable: p3.selectable, + locked: p3.locked, + grabbable: p3.grabbable, + pannable: p3.pannable, + classes: null + }; + json3.classes = ""; + var i2 = 0; + p3.classes.forEach(function(cls) { + return json3.classes += i2++ === 0 ? cls : " " + cls; + }); + return json3; + } + }; + elesfn$1.jsons = function() { + var jsons = []; + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var json3 = ele.json(); + jsons.push(json3); + } + return jsons; + }; + elesfn$1.clone = function() { + var cy = this.cy(); + var elesArr = []; + for (var i2 = 0; i2 < this.length; i2++) { + var ele = this[i2]; + var json3 = ele.json(); + var clone9 = new Element(cy, json3, false); + elesArr.push(clone9); + } + return new Collection(cy, elesArr); + }; + elesfn$1.copy = elesfn$1.clone; + elesfn$1.restore = function() { + var notifyRenderer = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; + var addToPool2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; + var self2 = this; + var cy = self2.cy(); + var cy_p = cy._private; + var nodes5 = []; + var edges3 = []; + var elements2; + for (var _i3 = 0, l4 = self2.length; _i3 < l4; _i3++) { + var ele = self2[_i3]; + if (addToPool2 && !ele.removed()) { + continue; + } + if (ele.isNode()) { + nodes5.push(ele); + } else { + edges3.push(ele); + } + } + elements2 = nodes5.concat(edges3); + var i2; + var removeFromElements = /* @__PURE__ */ __name(function removeFromElements2() { + elements2.splice(i2, 1); + i2--; + }, "removeFromElements"); + for (i2 = 0; i2 < elements2.length; i2++) { + var _ele2 = elements2[i2]; + var _private = _ele2._private; + var _data3 = _private.data; + _ele2.clearTraversalCache(); + if (!addToPool2 && !_private.removed) ; + else if (_data3.id === void 0) { + _data3.id = uuid(); + } else if (number$1(_data3.id)) { + _data3.id = "" + _data3.id; + } else if (emptyString(_data3.id) || !string(_data3.id)) { + error("Can not create element with invalid string ID `" + _data3.id + "`"); + removeFromElements(); + continue; + } else if (cy.hasElementWithId(_data3.id)) { + error("Can not create second element with ID `" + _data3.id + "`"); + removeFromElements(); + continue; + } + var id35 = _data3.id; + if (_ele2.isNode()) { + var pos = _private.position; + if (pos.x == null) { + pos.x = 0; + } + if (pos.y == null) { + pos.y = 0; + } + } + if (_ele2.isEdge()) { + var edge = _ele2; + var fields = ["source", "target"]; + var fieldsLength = fields.length; + var badSourceOrTarget = false; + for (var j3 = 0; j3 < fieldsLength; j3++) { + var field = fields[j3]; + var val = _data3[field]; + if (number$1(val)) { + val = _data3[field] = "" + _data3[field]; + } + if (val == null || val === "") { + error("Can not create edge `" + id35 + "` with unspecified " + field); + badSourceOrTarget = true; + } else if (!cy.hasElementWithId(val)) { + error("Can not create edge `" + id35 + "` with nonexistant " + field + " `" + val + "`"); + badSourceOrTarget = true; + } + } + if (badSourceOrTarget) { + removeFromElements(); + continue; + } + var src = cy.getElementById(_data3.source); + var tgt = cy.getElementById(_data3.target); + if (src.same(tgt)) { + src._private.edges.push(edge); + } else { + src._private.edges.push(edge); + tgt._private.edges.push(edge); + } + edge._private.source = src; + edge._private.target = tgt; + } + _private.map = new Map$1(); + _private.map.set(id35, { + ele: _ele2, + index: 0 + }); + _private.removed = false; + if (addToPool2) { + cy.addToPool(_ele2); + } + } + for (var _i4 = 0; _i4 < nodes5.length; _i4++) { + var node2 = nodes5[_i4]; + var _data4 = node2._private.data; + if (number$1(_data4.parent)) { + _data4.parent = "" + _data4.parent; + } + var parentId = _data4.parent; + var specifiedParent = parentId != null; + if (specifiedParent || node2._private.parent) { + var parent4 = node2._private.parent ? cy.collection().merge(node2._private.parent) : cy.getElementById(parentId); + if (parent4.empty()) { + _data4.parent = void 0; + } else if (parent4[0].removed()) { + warn("Node added with missing parent, reference to parent removed"); + _data4.parent = void 0; + node2._private.parent = null; + } else { + var selfAsParent = false; + var ancestor = parent4; + while (!ancestor.empty()) { + if (node2.same(ancestor)) { + selfAsParent = true; + _data4.parent = void 0; + break; + } + ancestor = ancestor.parent(); + } + if (!selfAsParent) { + parent4[0]._private.children.push(node2); + node2._private.parent = parent4[0]; + cy_p.hasCompoundNodes = true; + } + } + } + } + if (elements2.length > 0) { + var restored = elements2.length === self2.length ? self2 : new Collection(cy, elements2); + for (var _i5 = 0; _i5 < restored.length; _i5++) { + var _ele3 = restored[_i5]; + if (_ele3.isNode()) { + continue; + } + _ele3.parallelEdges().clearTraversalCache(); + _ele3.source().clearTraversalCache(); + _ele3.target().clearTraversalCache(); + } + var toUpdateStyle; + if (cy_p.hasCompoundNodes) { + toUpdateStyle = cy.collection().merge(restored).merge(restored.connectedNodes()).merge(restored.parent()); + } else { + toUpdateStyle = restored; + } + toUpdateStyle.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(notifyRenderer); + if (notifyRenderer) { + restored.emitAndNotify("add"); + } else if (addToPool2) { + restored.emit("add"); + } + } + return self2; + }; + elesfn$1.removed = function() { + var ele = this[0]; + return ele && ele._private.removed; + }; + elesfn$1.inside = function() { + var ele = this[0]; + return ele && !ele._private.removed; + }; + elesfn$1.remove = function() { + var notifyRenderer = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; + var removeFromPool2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; + var self2 = this; + var elesToRemove = []; + var elesToRemoveIds = {}; + var cy = self2._private.cy; + function addConnectedEdges(node2) { + var edges3 = node2._private.edges; + for (var i3 = 0; i3 < edges3.length; i3++) { + add3(edges3[i3]); + } + } + __name(addConnectedEdges, "addConnectedEdges"); + function addChildren2(node2) { + var children2 = node2._private.children; + for (var i3 = 0; i3 < children2.length; i3++) { + add3(children2[i3]); + } + } + __name(addChildren2, "addChildren"); + function add3(ele2) { + var alreadyAdded = elesToRemoveIds[ele2.id()]; + if (removeFromPool2 && ele2.removed() || alreadyAdded) { + return; + } else { + elesToRemoveIds[ele2.id()] = true; + } + if (ele2.isNode()) { + elesToRemove.push(ele2); + addConnectedEdges(ele2); + addChildren2(ele2); + } else { + elesToRemove.unshift(ele2); + } + } + __name(add3, "add"); + for (var i2 = 0, l4 = self2.length; i2 < l4; i2++) { + var ele = self2[i2]; + add3(ele); + } + function removeEdgeRef(node2, edge) { + var connectedEdges = node2._private.edges; + removeFromArray(connectedEdges, edge); + node2.clearTraversalCache(); + } + __name(removeEdgeRef, "removeEdgeRef"); + function removeParallelRef(pllEdge2) { + pllEdge2.clearTraversalCache(); + } + __name(removeParallelRef, "removeParallelRef"); + var alteredParents = []; + alteredParents.ids = {}; + function removeChildRef(parent5, ele2) { + ele2 = ele2[0]; + parent5 = parent5[0]; + var children2 = parent5._private.children; + var pid = parent5.id(); + removeFromArray(children2, ele2); + ele2._private.parent = null; + if (!alteredParents.ids[pid]) { + alteredParents.ids[pid] = true; + alteredParents.push(parent5); + } + } + __name(removeChildRef, "removeChildRef"); + self2.dirtyCompoundBoundsCache(); + if (removeFromPool2) { + cy.removeFromPool(elesToRemove); + } + for (var _i6 = 0; _i6 < elesToRemove.length; _i6++) { + var _ele4 = elesToRemove[_i6]; + if (_ele4.isEdge()) { + var src = _ele4.source()[0]; + var tgt = _ele4.target()[0]; + removeEdgeRef(src, _ele4); + removeEdgeRef(tgt, _ele4); + var pllEdges = _ele4.parallelEdges(); + for (var j3 = 0; j3 < pllEdges.length; j3++) { + var pllEdge = pllEdges[j3]; + removeParallelRef(pllEdge); + if (pllEdge.isBundledBezier()) { + pllEdge.dirtyBoundingBoxCache(); + } + } + } else { + var parent4 = _ele4.parent(); + if (parent4.length !== 0) { + removeChildRef(parent4, _ele4); + } + } + if (removeFromPool2) { + _ele4._private.removed = true; + } + } + var elesStillInside = cy._private.elements; + cy._private.hasCompoundNodes = false; + for (var _i7 = 0; _i7 < elesStillInside.length; _i7++) { + var _ele5 = elesStillInside[_i7]; + if (_ele5.isParent()) { + cy._private.hasCompoundNodes = true; + break; + } + } + var removedElements = new Collection(this.cy(), elesToRemove); + if (removedElements.size() > 0) { + if (notifyRenderer) { + removedElements.emitAndNotify("remove"); + } else if (removeFromPool2) { + removedElements.emit("remove"); + } + } + for (var _i8 = 0; _i8 < alteredParents.length; _i8++) { + var _ele6 = alteredParents[_i8]; + if (!removeFromPool2 || !_ele6.removed()) { + _ele6.updateStyle(); + } + } + return removedElements; + }; + elesfn$1.move = function(struct) { + var cy = this._private.cy; + var eles = this; + var notifyRenderer = false; + var modifyPool = false; + var toString6 = /* @__PURE__ */ __name(function toString7(id35) { + return id35 == null ? id35 : "" + id35; + }, "toString"); + if (struct.source !== void 0 || struct.target !== void 0) { + var srcId = toString6(struct.source); + var tgtId = toString6(struct.target); + var srcExists = srcId != null && cy.hasElementWithId(srcId); + var tgtExists = tgtId != null && cy.hasElementWithId(tgtId); + if (srcExists || tgtExists) { + cy.batch(function() { + eles.remove(notifyRenderer, modifyPool); + eles.emitAndNotify("moveout"); + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var _data5 = ele._private.data; + if (ele.isEdge()) { + if (srcExists) { + _data5.source = srcId; + } + if (tgtExists) { + _data5.target = tgtId; + } + } + } + eles.restore(notifyRenderer, modifyPool); + }); + eles.emitAndNotify("move"); + } + } else if (struct.parent !== void 0) { + var parentId = toString6(struct.parent); + var parentExists = parentId === null || cy.hasElementWithId(parentId); + if (parentExists) { + var pidToAssign = parentId === null ? void 0 : parentId; + cy.batch(function() { + var updated = eles.remove(notifyRenderer, modifyPool); + updated.emitAndNotify("moveout"); + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var _data6 = ele._private.data; + if (ele.isNode()) { + _data6.parent = pidToAssign; + } + } + updated.restore(notifyRenderer, modifyPool); + }); + eles.emitAndNotify("move"); + } + } + return this; + }; + [elesfn$j, elesfn$i, elesfn$h, elesfn$g, elesfn$f, data3, elesfn$d, dimensions, elesfn$9, elesfn$8, elesfn$7, elesfn$6, elesfn$5, elesfn$4, elesfn$3, elesfn$2].forEach(function(props) { + extend4(elesfn$1, props); + }); + corefn$9 = { + add: /* @__PURE__ */ __name(function add2(opts) { + var elements2; + var cy = this; + if (elementOrCollection(opts)) { + var eles = opts; + if (eles._private.cy === cy) { + elements2 = eles.restore(); + } else { + var jsons = []; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + jsons.push(ele.json()); + } + elements2 = new Collection(cy, jsons); + } + } else if (array2(opts)) { + var _jsons = opts; + elements2 = new Collection(cy, _jsons); + } else if (plainObject(opts) && (array2(opts.nodes) || array2(opts.edges))) { + var elesByGroup = opts; + var _jsons2 = []; + var grs = ["nodes", "edges"]; + for (var _i = 0, il = grs.length; _i < il; _i++) { + var group2 = grs[_i]; + var elesArray = elesByGroup[group2]; + if (array2(elesArray)) { + for (var j3 = 0, jl = elesArray.length; j3 < jl; j3++) { + var json3 = extend4({ + group: group2 + }, elesArray[j3]); + _jsons2.push(json3); + } + } + } + elements2 = new Collection(cy, _jsons2); + } else { + var _json = opts; + elements2 = new Element(cy, _json).collection(); + } + return elements2; + }, "add"), + remove: /* @__PURE__ */ __name(function remove2(collection4) { + if (elementOrCollection(collection4)) ; + else if (string(collection4)) { + var selector = collection4; + collection4 = this.$(selector); + } + return collection4.remove(); + }, "remove") + }; + __name(generateCubicBezier, "generateCubicBezier"); + generateSpringRK4 = /* @__PURE__ */ (function() { + function springAccelerationForState(state4) { + return -state4.tension * state4.x - state4.friction * state4.v; + } + __name(springAccelerationForState, "springAccelerationForState"); + function springEvaluateStateWithDerivative(initialState, dt, derivative) { + var state4 = { + x: initialState.x + derivative.dx * dt, + v: initialState.v + derivative.dv * dt, + tension: initialState.tension, + friction: initialState.friction + }; + return { + dx: state4.v, + dv: springAccelerationForState(state4) + }; + } + __name(springEvaluateStateWithDerivative, "springEvaluateStateWithDerivative"); + function springIntegrateState(state4, dt) { + var a2 = { + dx: state4.v, + dv: springAccelerationForState(state4) + }, b3 = springEvaluateStateWithDerivative(state4, dt * 0.5, a2), c3 = springEvaluateStateWithDerivative(state4, dt * 0.5, b3), d3 = springEvaluateStateWithDerivative(state4, dt, c3), dxdt = 1 / 6 * (a2.dx + 2 * (b3.dx + c3.dx) + d3.dx), dvdt = 1 / 6 * (a2.dv + 2 * (b3.dv + c3.dv) + d3.dv); + state4.x = state4.x + dxdt * dt; + state4.v = state4.v + dvdt * dt; + return state4; + } + __name(springIntegrateState, "springIntegrateState"); + return /* @__PURE__ */ __name(function springRK4Factory(tension, friction, duration) { + var initState = { + x: -1, + v: 0, + tension: null, + friction: null + }, path4 = [0], time_lapsed = 0, tolerance = 1 / 1e4, DT = 16 / 1e3, have_duration, dt, last_state; + tension = parseFloat(tension) || 500; + friction = parseFloat(friction) || 20; + duration = duration || null; + initState.tension = tension; + initState.friction = friction; + have_duration = duration !== null; + if (have_duration) { + time_lapsed = springRK4Factory(tension, friction); + dt = time_lapsed / duration * DT; + } else { + dt = DT; + } + for (; ; ) { + last_state = springIntegrateState(last_state || initState, dt); + path4.push(1 + last_state.x); + time_lapsed += 16; + if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) { + break; + } + } + return !have_duration ? time_lapsed : function(percentComplete) { + return path4[percentComplete * (path4.length - 1) | 0]; + }; + }, "springRK4Factory"); + })(); + cubicBezier = /* @__PURE__ */ __name(function cubicBezier2(t13, p1, t22, p22) { + var bezier = generateCubicBezier(t13, p1, t22, p22); + return function(start3, end2, percent) { + return start3 + (end2 - start3) * bezier(percent); + }; + }, "cubicBezier"); + easings = { + "linear": /* @__PURE__ */ __name(function linear3(start3, end2, percent) { + return start3 + (end2 - start3) * percent; + }, "linear"), + // default easings + "ease": cubicBezier(0.25, 0.1, 0.25, 1), + "ease-in": cubicBezier(0.42, 0, 1, 1), + "ease-out": cubicBezier(0, 0, 0.58, 1), + "ease-in-out": cubicBezier(0.42, 0, 0.58, 1), + // sine + "ease-in-sine": cubicBezier(0.47, 0, 0.745, 0.715), + "ease-out-sine": cubicBezier(0.39, 0.575, 0.565, 1), + "ease-in-out-sine": cubicBezier(0.445, 0.05, 0.55, 0.95), + // quad + "ease-in-quad": cubicBezier(0.55, 0.085, 0.68, 0.53), + "ease-out-quad": cubicBezier(0.25, 0.46, 0.45, 0.94), + "ease-in-out-quad": cubicBezier(0.455, 0.03, 0.515, 0.955), + // cubic + "ease-in-cubic": cubicBezier(0.55, 0.055, 0.675, 0.19), + "ease-out-cubic": cubicBezier(0.215, 0.61, 0.355, 1), + "ease-in-out-cubic": cubicBezier(0.645, 0.045, 0.355, 1), + // quart + "ease-in-quart": cubicBezier(0.895, 0.03, 0.685, 0.22), + "ease-out-quart": cubicBezier(0.165, 0.84, 0.44, 1), + "ease-in-out-quart": cubicBezier(0.77, 0, 0.175, 1), + // quint + "ease-in-quint": cubicBezier(0.755, 0.05, 0.855, 0.06), + "ease-out-quint": cubicBezier(0.23, 1, 0.32, 1), + "ease-in-out-quint": cubicBezier(0.86, 0, 0.07, 1), + // expo + "ease-in-expo": cubicBezier(0.95, 0.05, 0.795, 0.035), + "ease-out-expo": cubicBezier(0.19, 1, 0.22, 1), + "ease-in-out-expo": cubicBezier(1, 0, 0, 1), + // circ + "ease-in-circ": cubicBezier(0.6, 0.04, 0.98, 0.335), + "ease-out-circ": cubicBezier(0.075, 0.82, 0.165, 1), + "ease-in-out-circ": cubicBezier(0.785, 0.135, 0.15, 0.86), + // user param easings... + "spring": /* @__PURE__ */ __name(function spring(tension, friction, duration) { + if (duration === 0) { + return easings.linear; + } + var spring2 = generateSpringRK4(tension, friction, duration); + return function(start3, end2, percent) { + return start3 + (end2 - start3) * spring2(percent); + }; + }, "spring"), + "cubic-bezier": cubicBezier + }; + __name(getEasedValue, "getEasedValue"); + __name(getValue2, "getValue"); + __name(ease, "ease"); + __name(step$1, "step$1"); + __name(valid, "valid"); + __name(startAnimation, "startAnimation"); + __name(stepAll, "stepAll"); + corefn$8 = { + // pull in animation functions + animate: define2.animate(), + animation: define2.animation(), + animated: define2.animated(), + clearQueue: define2.clearQueue(), + delay: define2.delay(), + delayAnimation: define2.delayAnimation(), + stop: define2.stop(), + addToAnimationPool: /* @__PURE__ */ __name(function addToAnimationPool(eles) { + var cy = this; + if (!cy.styleEnabled()) { + return; + } + cy._private.aniEles.merge(eles); + }, "addToAnimationPool"), + stopAnimationLoop: /* @__PURE__ */ __name(function stopAnimationLoop() { + this._private.animationsRunning = false; + }, "stopAnimationLoop"), + startAnimationLoop: /* @__PURE__ */ __name(function startAnimationLoop() { + var cy = this; + cy._private.animationsRunning = true; + if (!cy.styleEnabled()) { + return; + } + function headlessStep() { + if (!cy._private.animationsRunning) { + return; + } + requestAnimationFrame2(/* @__PURE__ */ __name(function animationStep(now3) { + stepAll(now3, cy); + headlessStep(); + }, "animationStep")); + } + __name(headlessStep, "headlessStep"); + var renderer13 = cy.renderer(); + if (renderer13 && renderer13.beforeRender) { + renderer13.beforeRender(/* @__PURE__ */ __name(function rendererAnimationStep(willDraw, now3) { + stepAll(now3, cy); + }, "rendererAnimationStep"), renderer13.beforeRenderPriorities.animations); + } else { + headlessStep(); + } + }, "startAnimationLoop") + }; + emitterOptions = { + qualifierCompare: /* @__PURE__ */ __name(function qualifierCompare3(selector1, selector2) { + if (selector1 == null || selector2 == null) { + return selector1 == null && selector2 == null; + } else { + return selector1.sameText(selector2); + } + }, "qualifierCompare"), + eventMatches: /* @__PURE__ */ __name(function eventMatches3(cy, listener, eventObj) { + var selector = listener.qualifier; + if (selector != null) { + return cy !== eventObj.target && element(eventObj.target) && selector.matches(eventObj.target); + } + return true; + }, "eventMatches"), + addEventFields: /* @__PURE__ */ __name(function addEventFields3(cy, evt) { + evt.cy = cy; + evt.target = cy; + }, "addEventFields"), + callbackContext: /* @__PURE__ */ __name(function callbackContext3(cy, listener, eventObj) { + return listener.qualifier != null ? eventObj.target : cy; + }, "callbackContext") + }; + argSelector2 = /* @__PURE__ */ __name(function argSelector3(arg) { + if (string(arg)) { + return new Selector(arg); + } else { + return arg; + } + }, "argSelector"); + elesfn = { + createEmitter: /* @__PURE__ */ __name(function createEmitter2() { + var _p = this._private; + if (!_p.emitter) { + _p.emitter = new Emitter(emitterOptions, this); + } + return this; + }, "createEmitter"), + emitter: /* @__PURE__ */ __name(function emitter2() { + return this._private.emitter; + }, "emitter"), + on: /* @__PURE__ */ __name(function on2(events, selector, callback) { + this.emitter().on(events, argSelector2(selector), callback); + return this; + }, "on"), + removeListener: /* @__PURE__ */ __name(function removeListener2(events, selector, callback) { + this.emitter().removeListener(events, argSelector2(selector), callback); + return this; + }, "removeListener"), + removeAllListeners: /* @__PURE__ */ __name(function removeAllListeners2() { + this.emitter().removeAllListeners(); + return this; + }, "removeAllListeners"), + one: /* @__PURE__ */ __name(function one3(events, selector, callback) { + this.emitter().one(events, argSelector2(selector), callback); + return this; + }, "one"), + once: /* @__PURE__ */ __name(function once2(events, selector, callback) { + this.emitter().one(events, argSelector2(selector), callback); + return this; + }, "once"), + emit: /* @__PURE__ */ __name(function emit2(events, extraParams) { + this.emitter().emit(events, extraParams); + return this; + }, "emit"), + emitAndNotify: /* @__PURE__ */ __name(function emitAndNotify2(event3, eles) { + this.emit(event3); + this.notify(event3, eles); + return this; + }, "emitAndNotify") + }; + define2.eventAliasesOn(elesfn); + corefn$7 = { + png: /* @__PURE__ */ __name(function png(options2) { + var renderer13 = this._private.renderer; + options2 = options2 || {}; + return renderer13.png(options2); + }, "png"), + jpg: /* @__PURE__ */ __name(function jpg(options2) { + var renderer13 = this._private.renderer; + options2 = options2 || {}; + options2.bg = options2.bg || "#fff"; + return renderer13.jpg(options2); + }, "jpg") + }; + corefn$7.jpeg = corefn$7.jpg; + corefn$6 = { + layout: /* @__PURE__ */ __name(function layout3(options2) { + var cy = this; + if (options2 == null) { + error("Layout options must be specified to make a layout"); + return; + } + if (options2.name == null) { + error("A `name` must be specified to make a layout"); + return; + } + var name = options2.name; + var Layout2 = cy.extension("layout", name); + if (Layout2 == null) { + error("No such layout `" + name + "` found. Did you forget to import it and `cytoscape.use()` it?"); + return; + } + var eles; + if (string(options2.eles)) { + eles = cy.$(options2.eles); + } else { + eles = options2.eles != null ? options2.eles : cy.$(); + } + var layout7 = new Layout2(extend4({}, options2, { + cy, + eles + })); + return layout7; + }, "layout") + }; + corefn$6.createLayout = corefn$6.makeLayout = corefn$6.layout; + corefn$5 = { + notify: /* @__PURE__ */ __name(function notify(eventName, eventEles) { + var _p = this._private; + if (this.batching()) { + _p.batchNotifications = _p.batchNotifications || {}; + var eles = _p.batchNotifications[eventName] = _p.batchNotifications[eventName] || this.collection(); + if (eventEles != null) { + eles.merge(eventEles); + } + return; + } + if (!_p.notificationsEnabled) { + return; + } + var renderer13 = this.renderer(); + if (this.destroyed() || !renderer13) { + return; + } + renderer13.notify(eventName, eventEles); + }, "notify"), + notifications: /* @__PURE__ */ __name(function notifications(bool2) { + var p3 = this._private; + if (bool2 === void 0) { + return p3.notificationsEnabled; + } else { + p3.notificationsEnabled = bool2 ? true : false; + } + return this; + }, "notifications"), + noNotifications: /* @__PURE__ */ __name(function noNotifications(callback) { + this.notifications(false); + callback(); + this.notifications(true); + }, "noNotifications"), + batching: /* @__PURE__ */ __name(function batching() { + return this._private.batchCount > 0; + }, "batching"), + startBatch: /* @__PURE__ */ __name(function startBatch() { + var _p = this._private; + if (_p.batchCount == null) { + _p.batchCount = 0; + } + if (_p.batchCount === 0) { + _p.batchStyleEles = this.collection(); + _p.batchNotifications = {}; + } + _p.batchCount++; + return this; + }, "startBatch"), + endBatch: /* @__PURE__ */ __name(function endBatch() { + var _p = this._private; + if (_p.batchCount === 0) { + return this; + } + _p.batchCount--; + if (_p.batchCount === 0) { + _p.batchStyleEles.updateStyle(); + var renderer13 = this.renderer(); + Object.keys(_p.batchNotifications).forEach(function(eventName) { + var eles = _p.batchNotifications[eventName]; + if (eles.empty()) { + renderer13.notify(eventName); + } else { + renderer13.notify(eventName, eles); + } + }); + } + return this; + }, "endBatch"), + batch: /* @__PURE__ */ __name(function batch(callback) { + this.startBatch(); + callback(); + this.endBatch(); + return this; + }, "batch"), + // for backwards compatibility + batchData: /* @__PURE__ */ __name(function batchData(map6) { + var cy = this; + return this.batch(function() { + var ids = Object.keys(map6); + for (var i2 = 0; i2 < ids.length; i2++) { + var id35 = ids[i2]; + var data5 = map6[id35]; + var ele = cy.getElementById(id35); + ele.data(data5); + } + }); + }, "batchData") + }; + rendererDefaults = defaults$g({ + hideEdgesOnViewport: false, + textureOnViewport: false, + motionBlur: false, + motionBlurOpacity: 0.05, + pixelRatio: void 0, + desktopTapThreshold: 4, + touchTapThreshold: 8, + wheelSensitivity: 1, + debug: false, + showFps: false, + // webgl options + webgl: false, + webglDebug: false, + webglDebugShowAtlases: false, + // defaults good for mobile + webglTexSize: 2048, + webglTexRows: 36, + webglTexRowsNodes: 18, + webglBatchSize: 2048, + webglTexPerBatch: 14, + webglBgColor: [255, 255, 255] + }); + corefn$4 = { + renderTo: /* @__PURE__ */ __name(function renderTo(context, zoom2, pan2, pxRatio) { + var r2 = this._private.renderer; + r2.renderTo(context, zoom2, pan2, pxRatio); + return this; + }, "renderTo"), + renderer: /* @__PURE__ */ __name(function renderer() { + return this._private.renderer; + }, "renderer"), + forceRender: /* @__PURE__ */ __name(function forceRender() { + this.notify("draw"); + return this; + }, "forceRender"), + resize: /* @__PURE__ */ __name(function resize() { + this.invalidateSize(); + this.emitAndNotify("resize"); + return this; + }, "resize"), + initRenderer: /* @__PURE__ */ __name(function initRenderer(options2) { + var cy = this; + var RendererProto = cy.extension("renderer", options2.name); + if (RendererProto == null) { + error("Can not initialise: No such renderer `".concat(options2.name, "` found. Did you forget to import it and `cytoscape.use()` it?")); + return; + } + if (options2.wheelSensitivity !== void 0) { + warn("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine."); + } + var rOpts = rendererDefaults(options2); + rOpts.cy = cy; + cy._private.renderer = new RendererProto(rOpts); + this.notify("init"); + }, "initRenderer"), + destroyRenderer: /* @__PURE__ */ __name(function destroyRenderer() { + var cy = this; + cy.notify("destroy"); + var domEle = cy.container(); + if (domEle) { + domEle._cyreg = null; + while (domEle.childNodes.length > 0) { + domEle.removeChild(domEle.childNodes[0]); + } + } + cy._private.renderer = null; + cy.mutableElements().forEach(function(ele) { + var _p = ele._private; + _p.rscratch = {}; + _p.rstyle = {}; + _p.animation.current = []; + _p.animation.queue = []; + }); + }, "destroyRenderer"), + onRender: /* @__PURE__ */ __name(function onRender(fn3) { + return this.on("render", fn3); + }, "onRender"), + offRender: /* @__PURE__ */ __name(function offRender(fn3) { + return this.off("render", fn3); + }, "offRender") + }; + corefn$4.invalidateDimensions = corefn$4.resize; + corefn$3 = { + // get a collection + // - empty collection on no args + // - collection of elements in the graph on selector arg + // - guarantee a returned collection when elements or collection specified + collection: /* @__PURE__ */ __name(function collection3(eles, opts) { + if (string(eles)) { + return this.$(eles); + } else if (elementOrCollection(eles)) { + return eles.collection(); + } else if (array2(eles)) { + if (!opts) { + opts = {}; + } + return new Collection(this, eles, opts.unique, opts.removed); + } + return new Collection(this); + }, "collection"), + nodes: /* @__PURE__ */ __name(function nodes2(selector) { + var nodes5 = this.$(function(ele) { + return ele.isNode(); + }); + if (selector) { + return nodes5.filter(selector); + } + return nodes5; + }, "nodes"), + edges: /* @__PURE__ */ __name(function edges2(selector) { + var edges3 = this.$(function(ele) { + return ele.isEdge(); + }); + if (selector) { + return edges3.filter(selector); + } + return edges3; + }, "edges"), + // search the graph like jQuery + $: /* @__PURE__ */ __name(function $3(selector) { + var eles = this._private.elements; + if (selector) { + return eles.filter(selector); + } else { + return eles.spawnSelf(); + } + }, "$"), + mutableElements: /* @__PURE__ */ __name(function mutableElements() { + return this._private.elements; + }, "mutableElements") + }; + corefn$3.elements = corefn$3.filter = corefn$3.$; + styfn$8 = {}; + TRUE = "t"; + FALSE = "f"; + styfn$8.apply = function(eles) { + var self2 = this; + var _p = self2._private; + var cy = _p.cy; + var updatedEles = cy.collection(); + for (var ie2 = 0; ie2 < eles.length; ie2++) { + var ele = eles[ie2]; + var cxtMeta = self2.getContextMeta(ele); + if (cxtMeta.empty) { + continue; + } + var cxtStyle = self2.getContextStyle(cxtMeta); + var app = self2.applyContextStyle(cxtMeta, cxtStyle, ele); + if (ele._private.appliedInitStyle) { + self2.updateTransitions(ele, app.diffProps); + } else { + ele._private.appliedInitStyle = true; + } + var hintsDiff = self2.updateStyleHints(ele); + if (hintsDiff) { + updatedEles.push(ele); + } + } + return updatedEles; + }; + styfn$8.getPropertiesDiff = function(oldCxtKey, newCxtKey) { + var self2 = this; + var cache3 = self2._private.propDiffs = self2._private.propDiffs || {}; + var dualCxtKey = oldCxtKey + "-" + newCxtKey; + var cachedVal = cache3[dualCxtKey]; + if (cachedVal) { + return cachedVal; + } + var diffProps = []; + var addedProp = {}; + for (var i2 = 0; i2 < self2.length; i2++) { + var cxt = self2[i2]; + var oldHasCxt = oldCxtKey[i2] === TRUE; + var newHasCxt = newCxtKey[i2] === TRUE; + var cxtHasDiffed = oldHasCxt !== newHasCxt; + var cxtHasMappedProps = cxt.mappedProperties.length > 0; + if (cxtHasDiffed || newHasCxt && cxtHasMappedProps) { + var props = void 0; + if (cxtHasDiffed && cxtHasMappedProps) { + props = cxt.properties; + } else if (cxtHasDiffed) { + props = cxt.properties; + } else if (cxtHasMappedProps) { + props = cxt.mappedProperties; + } + for (var j3 = 0; j3 < props.length; j3++) { + var prop = props[j3]; + var name = prop.name; + var laterCxtOverrides = false; + for (var k2 = i2 + 1; k2 < self2.length; k2++) { + var laterCxt = self2[k2]; + var hasLaterCxt = newCxtKey[k2] === TRUE; + if (!hasLaterCxt) { + continue; + } + laterCxtOverrides = laterCxt.properties[prop.name] != null; + if (laterCxtOverrides) { + break; + } + } + if (!addedProp[name] && !laterCxtOverrides) { + addedProp[name] = true; + diffProps.push(name); + } + } + } + } + cache3[dualCxtKey] = diffProps; + return diffProps; + }; + styfn$8.getContextMeta = function(ele) { + var self2 = this; + var cxtKey = ""; + var diffProps; + var prevKey = ele._private.styleCxtKey || ""; + for (var i2 = 0; i2 < self2.length; i2++) { + var context = self2[i2]; + var contextSelectorMatches = context.selector && context.selector.matches(ele); + if (contextSelectorMatches) { + cxtKey += TRUE; + } else { + cxtKey += FALSE; + } + } + diffProps = self2.getPropertiesDiff(prevKey, cxtKey); + ele._private.styleCxtKey = cxtKey; + return { + key: cxtKey, + diffPropNames: diffProps, + empty: diffProps.length === 0 + }; + }; + styfn$8.getContextStyle = function(cxtMeta) { + var cxtKey = cxtMeta.key; + var self2 = this; + var cxtStyles = this._private.contextStyles = this._private.contextStyles || {}; + if (cxtStyles[cxtKey]) { + return cxtStyles[cxtKey]; + } + var style3 = { + _private: { + key: cxtKey + } + }; + for (var i2 = 0; i2 < self2.length; i2++) { + var cxt = self2[i2]; + var hasCxt = cxtKey[i2] === TRUE; + if (!hasCxt) { + continue; + } + for (var j3 = 0; j3 < cxt.properties.length; j3++) { + var prop = cxt.properties[j3]; + style3[prop.name] = prop; + } + } + cxtStyles[cxtKey] = style3; + return style3; + }; + styfn$8.applyContextStyle = function(cxtMeta, cxtStyle, ele) { + var self2 = this; + var diffProps = cxtMeta.diffPropNames; + var retDiffProps = {}; + var types = self2.types; + for (var i2 = 0; i2 < diffProps.length; i2++) { + var diffPropName = diffProps[i2]; + var cxtProp = cxtStyle[diffPropName]; + var eleProp = ele.pstyle(diffPropName); + if (!cxtProp) { + if (!eleProp) { + continue; + } else if (eleProp.bypass) { + cxtProp = { + name: diffPropName, + deleteBypassed: true + }; + } else { + cxtProp = { + name: diffPropName, + "delete": true + }; + } + } + if (eleProp === cxtProp) { + continue; + } + if (cxtProp.mapped === types.fn && eleProp != null && eleProp.mapping != null && eleProp.mapping.value === cxtProp.value) { + var mapping = eleProp.mapping; + var fnValue = mapping.fnValue = cxtProp.value(ele); + if (fnValue === mapping.prevFnValue) { + continue; + } + } + var retDiffProp = retDiffProps[diffPropName] = { + prev: eleProp + }; + self2.applyParsedProperty(ele, cxtProp); + retDiffProp.next = ele.pstyle(diffPropName); + if (retDiffProp.next && retDiffProp.next.bypass) { + retDiffProp.next = retDiffProp.next.bypassed; + } + } + return { + diffProps: retDiffProps + }; + }; + styfn$8.updateStyleHints = function(ele) { + var _p = ele._private; + var self2 = this; + var propNames = self2.propertyGroupNames; + var propGrKeys = self2.propertyGroupKeys; + var propHash = /* @__PURE__ */ __name(function propHash2(ele2, propNames2, seedKey) { + return self2.getPropertiesHash(ele2, propNames2, seedKey); + }, "propHash"); + var oldStyleKey = _p.styleKey; + if (ele.removed()) { + return false; + } + var isNode2 = _p.group === "nodes"; + var overriddenStyles = ele._private.style; + propNames = Object.keys(overriddenStyles); + for (var i2 = 0; i2 < propGrKeys.length; i2++) { + var grKey = propGrKeys[i2]; + _p.styleKeys[grKey] = [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]; + } + var updateGrKey1 = /* @__PURE__ */ __name(function updateGrKey12(val, grKey2) { + return _p.styleKeys[grKey2][0] = hashInt(val, _p.styleKeys[grKey2][0]); + }, "updateGrKey1"); + var updateGrKey2 = /* @__PURE__ */ __name(function updateGrKey22(val, grKey2) { + return _p.styleKeys[grKey2][1] = hashIntAlt(val, _p.styleKeys[grKey2][1]); + }, "updateGrKey2"); + var updateGrKey = /* @__PURE__ */ __name(function updateGrKey3(val, grKey2) { + updateGrKey1(val, grKey2); + updateGrKey2(val, grKey2); + }, "updateGrKey"); + var updateGrKeyWStr = /* @__PURE__ */ __name(function updateGrKeyWStr2(strVal, grKey2) { + for (var j3 = 0; j3 < strVal.length; j3++) { + var ch = strVal.charCodeAt(j3); + updateGrKey1(ch, grKey2); + updateGrKey2(ch, grKey2); + } + }, "updateGrKeyWStr"); + var N3 = 2e9; + var cleanNum = /* @__PURE__ */ __name(function cleanNum2(val) { + return -128 < val && val < 128 && Math.floor(val) !== val ? N3 - (val * 1024 | 0) : val; + }, "cleanNum"); + for (var _i = 0; _i < propNames.length; _i++) { + var name = propNames[_i]; + var parsedProp = overriddenStyles[name]; + if (parsedProp == null) { + continue; + } + var propInfo = this.properties[name]; + var type3 = propInfo.type; + var _grKey = propInfo.groupKey; + var normalizedNumberVal = void 0; + if (propInfo.hashOverride != null) { + normalizedNumberVal = propInfo.hashOverride(ele, parsedProp); + } else if (parsedProp.pfValue != null) { + normalizedNumberVal = parsedProp.pfValue; + } + var numberVal = propInfo.enums == null ? parsedProp.value : null; + var haveNormNum = normalizedNumberVal != null; + var haveUnitedNum = numberVal != null; + var haveNum = haveNormNum || haveUnitedNum; + var units = parsedProp.units; + if (type3.number && haveNum && !type3.multiple) { + var v3 = haveNormNum ? normalizedNumberVal : numberVal; + updateGrKey(cleanNum(v3), _grKey); + if (!haveNormNum && units != null) { + updateGrKeyWStr(units, _grKey); + } + } else { + updateGrKeyWStr(parsedProp.strValue, _grKey); + } + } + var hash = [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]; + for (var _i2 = 0; _i2 < propGrKeys.length; _i2++) { + var _grKey2 = propGrKeys[_i2]; + var grHash = _p.styleKeys[_grKey2]; + hash[0] = hashInt(grHash[0], hash[0]); + hash[1] = hashIntAlt(grHash[1], hash[1]); + } + _p.styleKey = combineHashes(hash[0], hash[1]); + var sk = _p.styleKeys; + _p.labelDimsKey = combineHashesArray(sk.labelDimensions); + var labelKeys = propHash(ele, ["label"], sk.labelDimensions); + _p.labelKey = combineHashesArray(labelKeys); + _p.labelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, labelKeys)); + if (!isNode2) { + var sourceLabelKeys = propHash(ele, ["source-label"], sk.labelDimensions); + _p.sourceLabelKey = combineHashesArray(sourceLabelKeys); + _p.sourceLabelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, sourceLabelKeys)); + var targetLabelKeys = propHash(ele, ["target-label"], sk.labelDimensions); + _p.targetLabelKey = combineHashesArray(targetLabelKeys); + _p.targetLabelStyleKey = combineHashesArray(hashArrays(sk.commonLabel, targetLabelKeys)); + } + if (isNode2) { + var _p$styleKeys = _p.styleKeys, nodeBody = _p$styleKeys.nodeBody, nodeBorder = _p$styleKeys.nodeBorder, nodeOutline = _p$styleKeys.nodeOutline, backgroundImage = _p$styleKeys.backgroundImage, compound = _p$styleKeys.compound, pie2 = _p$styleKeys.pie, stripe = _p$styleKeys.stripe; + var nodeKeys = [nodeBody, nodeBorder, nodeOutline, backgroundImage, compound, pie2, stripe].filter(function(k2) { + return k2 != null; + }).reduce(hashArrays, [DEFAULT_HASH_SEED, DEFAULT_HASH_SEED_ALT]); + _p.nodeKey = combineHashesArray(nodeKeys); + _p.hasPie = pie2 != null && pie2[0] !== DEFAULT_HASH_SEED && pie2[1] !== DEFAULT_HASH_SEED_ALT; + _p.hasStripe = stripe != null && stripe[0] !== DEFAULT_HASH_SEED && stripe[1] !== DEFAULT_HASH_SEED_ALT; + } + return oldStyleKey !== _p.styleKey; + }; + styfn$8.clearStyleHints = function(ele) { + var _p = ele._private; + _p.styleCxtKey = ""; + _p.styleKeys = {}; + _p.styleKey = null; + _p.labelKey = null; + _p.labelStyleKey = null; + _p.sourceLabelKey = null; + _p.sourceLabelStyleKey = null; + _p.targetLabelKey = null; + _p.targetLabelStyleKey = null; + _p.nodeKey = null; + _p.hasPie = null; + _p.hasStripe = null; + }; + styfn$8.applyParsedProperty = function(ele, parsedProp) { + var self2 = this; + var prop = parsedProp; + var style3 = ele._private.style; + var flatProp; + var types = self2.types; + var type3 = self2.properties[prop.name].type; + var propIsBypass = prop.bypass; + var origProp = style3[prop.name]; + var origPropIsBypass = origProp && origProp.bypass; + var _p = ele._private; + var flatPropMapping = "mapping"; + var getVal = /* @__PURE__ */ __name(function getVal2(p3) { + if (p3 == null) { + return null; + } else if (p3.pfValue != null) { + return p3.pfValue; + } else { + return p3.value; + } + }, "getVal"); + var checkTriggers = /* @__PURE__ */ __name(function checkTriggers2() { + var fromVal = getVal(origProp); + var toVal = getVal(prop); + self2.checkTriggers(ele, prop.name, fromVal, toVal); + }, "checkTriggers"); + if (parsedProp.name === "curve-style" && ele.isEdge() && // loops must be bundled beziers + (parsedProp.value !== "bezier" && ele.isLoop() || // edges connected to compound nodes can not be haystacks + parsedProp.value === "haystack" && (ele.source().isParent() || ele.target().isParent()))) { + prop = parsedProp = this.parse(parsedProp.name, "bezier", propIsBypass); + } + if (prop["delete"]) { + style3[prop.name] = void 0; + checkTriggers(); + return true; + } + if (prop.deleteBypassed) { + if (!origProp) { + checkTriggers(); + return true; + } else if (origProp.bypass) { + origProp.bypassed = void 0; + checkTriggers(); + return true; + } else { + return false; + } + } + if (prop.deleteBypass) { + if (!origProp) { + checkTriggers(); + return true; + } else if (origProp.bypass) { + style3[prop.name] = origProp.bypassed; + checkTriggers(); + return true; + } else { + return false; + } + } + var printMappingErr = /* @__PURE__ */ __name(function printMappingErr2() { + warn("Do not assign mappings to elements without corresponding data (i.e. ele `" + ele.id() + "` has no mapping for property `" + prop.name + "` with data field `" + prop.field + "`); try a `[" + prop.field + "]` selector to limit scope to elements with `" + prop.field + "` defined"); + }, "printMappingErr"); + switch (prop.mapped) { + // flatten the property if mapped + case types.mapData: { + var fields = prop.field.split("."); + var fieldVal = _p.data; + for (var i2 = 0; i2 < fields.length && fieldVal; i2++) { + var field = fields[i2]; + fieldVal = fieldVal[field]; + } + if (fieldVal == null) { + printMappingErr(); + return false; + } + var percent; + if (!number$1(fieldVal)) { + warn("Do not use continuous mappers without specifying numeric data (i.e. `" + prop.field + ": " + fieldVal + "` for `" + ele.id() + "` is non-numeric)"); + return false; + } else { + var fieldWidth = prop.fieldMax - prop.fieldMin; + if (fieldWidth === 0) { + percent = 0; + } else { + percent = (fieldVal - prop.fieldMin) / fieldWidth; + } + } + if (percent < 0) { + percent = 0; + } else if (percent > 1) { + percent = 1; + } + if (type3.color) { + var r1 = prop.valueMin[0]; + var r2 = prop.valueMax[0]; + var g1 = prop.valueMin[1]; + var g2 = prop.valueMax[1]; + var b1 = prop.valueMin[2]; + var b22 = prop.valueMax[2]; + var a1 = prop.valueMin[3] == null ? 1 : prop.valueMin[3]; + var a2 = prop.valueMax[3] == null ? 1 : prop.valueMax[3]; + var clr = [Math.round(r1 + (r2 - r1) * percent), Math.round(g1 + (g2 - g1) * percent), Math.round(b1 + (b22 - b1) * percent), Math.round(a1 + (a2 - a1) * percent)]; + flatProp = { + // colours are simple, so just create the flat property instead of expensive string parsing + bypass: prop.bypass, + // we're a bypass if the mapping property is a bypass + name: prop.name, + value: clr, + strValue: "rgb(" + clr[0] + ", " + clr[1] + ", " + clr[2] + ")" + }; + } else if (type3.number) { + var calcValue = prop.valueMin + (prop.valueMax - prop.valueMin) * percent; + flatProp = this.parse(prop.name, calcValue, prop.bypass, flatPropMapping); + } else { + return false; + } + if (!flatProp) { + printMappingErr(); + return false; + } + flatProp.mapping = prop; + prop = flatProp; + break; + } + // direct mapping + case types.data: { + var _fields = prop.field.split("."); + var _fieldVal = _p.data; + for (var _i3 = 0; _i3 < _fields.length && _fieldVal; _i3++) { + var _field = _fields[_i3]; + _fieldVal = _fieldVal[_field]; + } + if (_fieldVal != null) { + flatProp = this.parse(prop.name, _fieldVal, prop.bypass, flatPropMapping); + } + if (!flatProp) { + printMappingErr(); + return false; + } + flatProp.mapping = prop; + prop = flatProp; + break; + } + case types.fn: { + var fn3 = prop.value; + var fnRetVal = prop.fnValue != null ? prop.fnValue : fn3(ele); + prop.prevFnValue = fnRetVal; + if (fnRetVal == null) { + warn("Custom function mappers may not return null (i.e. `" + prop.name + "` for ele `" + ele.id() + "` is null)"); + return false; + } + flatProp = this.parse(prop.name, fnRetVal, prop.bypass, flatPropMapping); + if (!flatProp) { + warn("Custom function mappers may not return invalid values for the property type (i.e. `" + prop.name + "` for ele `" + ele.id() + "` is invalid)"); + return false; + } + flatProp.mapping = copy3(prop); + prop = flatProp; + break; + } + case void 0: + break; + // just set the property + default: + return false; + } + if (propIsBypass) { + if (origPropIsBypass) { + prop.bypassed = origProp.bypassed; + } else { + prop.bypassed = origProp; + } + style3[prop.name] = prop; + } else { + if (origPropIsBypass) { + origProp.bypassed = prop; + } else { + style3[prop.name] = prop; + } + } + checkTriggers(); + return true; + }; + styfn$8.cleanElements = function(eles, keepBypasses) { + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + this.clearStyleHints(ele); + ele.dirtyCompoundBoundsCache(); + ele.dirtyBoundingBoxCache(); + if (!keepBypasses) { + ele._private.style = {}; + } else { + var style3 = ele._private.style; + var propNames = Object.keys(style3); + for (var j3 = 0; j3 < propNames.length; j3++) { + var propName = propNames[j3]; + var eleProp = style3[propName]; + if (eleProp != null) { + if (eleProp.bypass) { + eleProp.bypassed = null; + } else { + style3[propName] = null; + } + } + } + } + } + }; + styfn$8.update = function() { + var cy = this._private.cy; + var eles = cy.mutableElements(); + eles.updateStyle(); + }; + styfn$8.updateTransitions = function(ele, diffProps) { + var self2 = this; + var _p = ele._private; + var props = ele.pstyle("transition-property").value; + var duration = ele.pstyle("transition-duration").pfValue; + var delay2 = ele.pstyle("transition-delay").pfValue; + if (props.length > 0 && duration > 0) { + var style3 = {}; + var anyPrev = false; + for (var i2 = 0; i2 < props.length; i2++) { + var prop = props[i2]; + var styProp = ele.pstyle(prop); + var diffProp = diffProps[prop]; + if (!diffProp) { + continue; + } + var prevProp = diffProp.prev; + var fromProp = prevProp; + var toProp = diffProp.next != null ? diffProp.next : styProp; + var diff2 = false; + var initVal = void 0; + var initDt = 1e-6; + if (!fromProp) { + continue; + } + if (number$1(fromProp.pfValue) && number$1(toProp.pfValue)) { + diff2 = toProp.pfValue - fromProp.pfValue; + initVal = fromProp.pfValue + initDt * diff2; + } else if (number$1(fromProp.value) && number$1(toProp.value)) { + diff2 = toProp.value - fromProp.value; + initVal = fromProp.value + initDt * diff2; + } else if (array2(fromProp.value) && array2(toProp.value)) { + diff2 = fromProp.value[0] !== toProp.value[0] || fromProp.value[1] !== toProp.value[1] || fromProp.value[2] !== toProp.value[2]; + initVal = fromProp.strValue; + } + if (diff2) { + style3[prop] = toProp.strValue; + this.applyBypass(ele, prop, initVal); + anyPrev = true; + } + } + if (!anyPrev) { + return; + } + _p.transitioning = true; + new Promise$1(function(resolve2) { + if (delay2 > 0) { + ele.delayAnimation(delay2).play().promise().then(resolve2); + } else { + resolve2(); + } + }).then(function() { + return ele.animation({ + style: style3, + duration, + easing: ele.pstyle("transition-timing-function").value, + queue: false + }).play().promise(); + }).then(function() { + self2.removeBypasses(ele, props); + ele.emitAndNotify("style"); + _p.transitioning = false; + }); + } else if (_p.transitioning) { + this.removeBypasses(ele, props); + ele.emitAndNotify("style"); + _p.transitioning = false; + } + }; + styfn$8.checkTrigger = function(ele, name, fromValue, toValue, getTrigger, onTrigger) { + var prop = this.properties[name]; + var triggerCheck = getTrigger(prop); + if (ele.removed()) { + return; + } + if (triggerCheck != null && triggerCheck(fromValue, toValue, ele)) { + onTrigger(prop); + } + }; + styfn$8.checkZOrderTrigger = function(ele, name, fromValue, toValue) { + var _this = this; + this.checkTrigger(ele, name, fromValue, toValue, function(prop) { + return prop.triggersZOrder; + }, function() { + _this._private.cy.notify("zorder", ele); + }); + }; + styfn$8.checkBoundsTrigger = function(ele, name, fromValue, toValue) { + this.checkTrigger(ele, name, fromValue, toValue, function(prop) { + return prop.triggersBounds; + }, function(prop) { + ele.dirtyCompoundBoundsCache(); + ele.dirtyBoundingBoxCache(); + }); + }; + styfn$8.checkConnectedEdgesBoundsTrigger = function(ele, name, fromValue, toValue) { + this.checkTrigger(ele, name, fromValue, toValue, function(prop) { + return prop.triggersBoundsOfConnectedEdges; + }, function(prop) { + ele.connectedEdges().forEach(function(edge) { + edge.dirtyBoundingBoxCache(); + }); + }); + }; + styfn$8.checkParallelEdgesBoundsTrigger = function(ele, name, fromValue, toValue) { + this.checkTrigger(ele, name, fromValue, toValue, function(prop) { + return prop.triggersBoundsOfParallelEdges; + }, function(prop) { + ele.parallelEdges().forEach(function(pllEdge) { + pllEdge.dirtyBoundingBoxCache(); + }); + }); + }; + styfn$8.checkTriggers = function(ele, name, fromValue, toValue) { + ele.dirtyStyleCache(); + this.checkZOrderTrigger(ele, name, fromValue, toValue); + this.checkBoundsTrigger(ele, name, fromValue, toValue); + this.checkConnectedEdgesBoundsTrigger(ele, name, fromValue, toValue); + this.checkParallelEdgesBoundsTrigger(ele, name, fromValue, toValue); + }; + styfn$7 = {}; + styfn$7.applyBypass = function(eles, name, value2, updateTransitions) { + var self2 = this; + var props = []; + var isBypass = true; + if (name === "*" || name === "**") { + if (value2 !== void 0) { + for (var i2 = 0; i2 < self2.properties.length; i2++) { + var prop = self2.properties[i2]; + var _name = prop.name; + var parsedProp = this.parse(_name, value2, true); + if (parsedProp) { + props.push(parsedProp); + } + } + } + } else if (string(name)) { + var _parsedProp = this.parse(name, value2, true); + if (_parsedProp) { + props.push(_parsedProp); + } + } else if (plainObject(name)) { + var specifiedProps = name; + updateTransitions = value2; + var names = Object.keys(specifiedProps); + for (var _i = 0; _i < names.length; _i++) { + var _name2 = names[_i]; + var _value = specifiedProps[_name2]; + if (_value === void 0) { + _value = specifiedProps[dash2camel(_name2)]; + } + if (_value !== void 0) { + var _parsedProp2 = this.parse(_name2, _value, true); + if (_parsedProp2) { + props.push(_parsedProp2); + } + } + } + } else { + return false; + } + if (props.length === 0) { + return false; + } + var ret = false; + for (var _i2 = 0; _i2 < eles.length; _i2++) { + var ele = eles[_i2]; + var diffProps = {}; + var diffProp = void 0; + for (var j3 = 0; j3 < props.length; j3++) { + var _prop = props[j3]; + if (updateTransitions) { + var prevProp = ele.pstyle(_prop.name); + diffProp = diffProps[_prop.name] = { + prev: prevProp + }; + } + ret = this.applyParsedProperty(ele, copy3(_prop)) || ret; + if (updateTransitions) { + diffProp.next = ele.pstyle(_prop.name); + } + } + if (ret) { + this.updateStyleHints(ele); + } + if (updateTransitions) { + this.updateTransitions(ele, diffProps, isBypass); + } + } + return ret; + }; + styfn$7.overrideBypass = function(eles, name, value2) { + name = camel2dash(name); + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var prop = ele._private.style[name]; + var type3 = this.properties[name].type; + var isColor = type3.color; + var isMulti = type3.mutiple; + var oldValue = !prop ? null : prop.pfValue != null ? prop.pfValue : prop.value; + if (!prop || !prop.bypass) { + this.applyBypass(ele, name, value2); + } else { + prop.value = value2; + if (prop.pfValue != null) { + prop.pfValue = value2; + } + if (isColor) { + prop.strValue = "rgb(" + value2.join(",") + ")"; + } else if (isMulti) { + prop.strValue = value2.join(" "); + } else { + prop.strValue = "" + value2; + } + this.updateStyleHints(ele); + } + this.checkTriggers(ele, name, oldValue, value2); + } + }; + styfn$7.removeAllBypasses = function(eles, updateTransitions) { + return this.removeBypasses(eles, this.propertyNames, updateTransitions); + }; + styfn$7.removeBypasses = function(eles, props, updateTransitions) { + var isBypass = true; + for (var j3 = 0; j3 < eles.length; j3++) { + var ele = eles[j3]; + var diffProps = {}; + for (var i2 = 0; i2 < props.length; i2++) { + var name = props[i2]; + var prop = this.properties[name]; + var prevProp = ele.pstyle(prop.name); + if (!prevProp || !prevProp.bypass) { + continue; + } + var value2 = ""; + var parsedProp = this.parse(name, value2, true); + var diffProp = diffProps[prop.name] = { + prev: prevProp + }; + this.applyParsedProperty(ele, parsedProp); + diffProp.next = ele.pstyle(prop.name); + } + this.updateStyleHints(ele); + if (updateTransitions) { + this.updateTransitions(ele, diffProps, isBypass); + } + } + }; + styfn$6 = {}; + styfn$6.getEmSizeInPixels = function() { + var px = this.containerCss("font-size"); + if (px != null) { + return parseFloat(px); + } else { + return 1; + } + }; + styfn$6.containerCss = function(propName) { + var cy = this._private.cy; + var domElement3 = cy.container(); + var containerWindow = cy.window(); + if (containerWindow && domElement3 && containerWindow.getComputedStyle) { + return containerWindow.getComputedStyle(domElement3).getPropertyValue(propName); + } + }; + styfn$5 = {}; + styfn$5.getRenderedStyle = function(ele, prop) { + if (prop) { + return this.getStylePropertyValue(ele, prop, true); + } else { + return this.getRawStyle(ele, true); + } + }; + styfn$5.getRawStyle = function(ele, isRenderedVal) { + var self2 = this; + ele = ele[0]; + if (ele) { + var rstyle = {}; + for (var i2 = 0; i2 < self2.properties.length; i2++) { + var prop = self2.properties[i2]; + var val = self2.getStylePropertyValue(ele, prop.name, isRenderedVal); + if (val != null) { + rstyle[prop.name] = val; + rstyle[dash2camel(prop.name)] = val; + } + } + return rstyle; + } + }; + styfn$5.getIndexedStyle = function(ele, property3, subproperty, index) { + var pstyle = ele.pstyle(property3)[subproperty][index]; + return pstyle != null ? pstyle : ele.cy().style().getDefaultProperty(property3)[subproperty][0]; + }; + styfn$5.getStylePropertyValue = function(ele, propName, isRenderedVal) { + var self2 = this; + ele = ele[0]; + if (ele) { + var prop = self2.properties[propName]; + if (prop.alias) { + prop = prop.pointsTo; + } + var type3 = prop.type; + var styleProp = ele.pstyle(prop.name); + if (styleProp) { + var value2 = styleProp.value, units = styleProp.units, strValue = styleProp.strValue; + if (isRenderedVal && type3.number && value2 != null && number$1(value2)) { + var zoom2 = ele.cy().zoom(); + var getRenderedValue = /* @__PURE__ */ __name(function getRenderedValue2(val) { + return val * zoom2; + }, "getRenderedValue"); + var getValueStringWithUnits = /* @__PURE__ */ __name(function getValueStringWithUnits2(val, units2) { + return getRenderedValue(val) + units2; + }, "getValueStringWithUnits"); + var isArrayValue = array2(value2); + var haveUnits = isArrayValue ? units.every(function(u2) { + return u2 != null; + }) : units != null; + if (haveUnits) { + if (isArrayValue) { + return value2.map(function(v3, i2) { + return getValueStringWithUnits(v3, units[i2]); + }).join(" "); + } else { + return getValueStringWithUnits(value2, units); + } + } else { + if (isArrayValue) { + return value2.map(function(v3) { + return string(v3) ? v3 : "" + getRenderedValue(v3); + }).join(" "); + } else { + return "" + getRenderedValue(value2); + } + } + } else if (strValue != null) { + return strValue; + } + } + return null; + } + }; + styfn$5.getAnimationStartStyle = function(ele, aniProps) { + var rstyle = {}; + for (var i2 = 0; i2 < aniProps.length; i2++) { + var aniProp = aniProps[i2]; + var name = aniProp.name; + var styleProp = ele.pstyle(name); + if (styleProp !== void 0) { + if (plainObject(styleProp)) { + styleProp = this.parse(name, styleProp.strValue); + } else { + styleProp = this.parse(name, styleProp); + } + } + if (styleProp) { + rstyle[name] = styleProp; + } + } + return rstyle; + }; + styfn$5.getPropsList = function(propsObj) { + var self2 = this; + var rstyle = []; + var style3 = propsObj; + var props = self2.properties; + if (style3) { + var names = Object.keys(style3); + for (var i2 = 0; i2 < names.length; i2++) { + var name = names[i2]; + var val = style3[name]; + var prop = props[name] || props[camel2dash(name)]; + var styleProp = this.parse(prop.name, val); + if (styleProp) { + rstyle.push(styleProp); + } + } + } + return rstyle; + }; + styfn$5.getNonDefaultPropertiesHash = function(ele, propNames, seed) { + var hash = seed.slice(); + var name, val, strVal, chVal; + var i2, j3; + for (i2 = 0; i2 < propNames.length; i2++) { + name = propNames[i2]; + val = ele.pstyle(name, false); + if (val == null) { + continue; + } else if (val.pfValue != null) { + hash[0] = hashInt(chVal, hash[0]); + hash[1] = hashIntAlt(chVal, hash[1]); + } else { + strVal = val.strValue; + for (j3 = 0; j3 < strVal.length; j3++) { + chVal = strVal.charCodeAt(j3); + hash[0] = hashInt(chVal, hash[0]); + hash[1] = hashIntAlt(chVal, hash[1]); + } + } + } + return hash; + }; + styfn$5.getPropertiesHash = styfn$5.getNonDefaultPropertiesHash; + styfn$4 = {}; + styfn$4.appendFromJson = function(json3) { + var style3 = this; + for (var i2 = 0; i2 < json3.length; i2++) { + var context = json3[i2]; + var selector = context.selector; + var props = context.style || context.css; + var names = Object.keys(props); + style3.selector(selector); + for (var j3 = 0; j3 < names.length; j3++) { + var name = names[j3]; + var value2 = props[name]; + style3.css(name, value2); + } + } + return style3; + }; + styfn$4.fromJson = function(json3) { + var style3 = this; + style3.resetToDefault(); + style3.appendFromJson(json3); + return style3; + }; + styfn$4.json = function() { + var json3 = []; + for (var i2 = this.defaultLength; i2 < this.length; i2++) { + var cxt = this[i2]; + var selector = cxt.selector; + var props = cxt.properties; + var css = {}; + for (var j3 = 0; j3 < props.length; j3++) { + var prop = props[j3]; + css[prop.name] = prop.strValue; + } + json3.push({ + selector: !selector ? "core" : selector.toString(), + style: css + }); + } + return json3; + }; + styfn$3 = {}; + styfn$3.appendFromString = function(string3) { + var self2 = this; + var style3 = this; + var remaining = "" + string3; + var selAndBlockStr; + var blockRem; + var propAndValStr; + remaining = remaining.replace(/[/][*](\s|.)+?[*][/]/g, ""); + function removeSelAndBlockFromRemaining() { + if (remaining.length > selAndBlockStr.length) { + remaining = remaining.substr(selAndBlockStr.length); + } else { + remaining = ""; + } + } + __name(removeSelAndBlockFromRemaining, "removeSelAndBlockFromRemaining"); + function removePropAndValFromRem() { + if (blockRem.length > propAndValStr.length) { + blockRem = blockRem.substr(propAndValStr.length); + } else { + blockRem = ""; + } + } + __name(removePropAndValFromRem, "removePropAndValFromRem"); + for (; ; ) { + var nothingLeftToParse = remaining.match(/^\s*$/); + if (nothingLeftToParse) { + break; + } + var selAndBlock = remaining.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/); + if (!selAndBlock) { + warn("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: " + remaining); + break; + } + selAndBlockStr = selAndBlock[0]; + var selectorStr = selAndBlock[1]; + if (selectorStr !== "core") { + var selector = new Selector(selectorStr); + if (selector.invalid) { + warn("Skipping parsing of block: Invalid selector found in string stylesheet: " + selectorStr); + removeSelAndBlockFromRemaining(); + continue; + } + } + var blockStr = selAndBlock[2]; + var invalidBlock = false; + blockRem = blockStr; + var props = []; + for (; ; ) { + var _nothingLeftToParse = blockRem.match(/^\s*$/); + if (_nothingLeftToParse) { + break; + } + var propAndVal = blockRem.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/); + if (!propAndVal) { + warn("Skipping parsing of block: Invalid formatting of style property and value definitions found in:" + blockStr); + invalidBlock = true; + break; + } + propAndValStr = propAndVal[0]; + var propStr = propAndVal[1]; + var valStr = propAndVal[2]; + var prop = self2.properties[propStr]; + if (!prop) { + warn("Skipping property: Invalid property name in: " + propAndValStr); + removePropAndValFromRem(); + continue; + } + var parsedProp = style3.parse(propStr, valStr); + if (!parsedProp) { + warn("Skipping property: Invalid property definition in: " + propAndValStr); + removePropAndValFromRem(); + continue; + } + props.push({ + name: propStr, + val: valStr + }); + removePropAndValFromRem(); + } + if (invalidBlock) { + removeSelAndBlockFromRemaining(); + break; + } + style3.selector(selectorStr); + for (var i2 = 0; i2 < props.length; i2++) { + var _prop = props[i2]; + style3.css(_prop.name, _prop.val); + } + removeSelAndBlockFromRemaining(); + } + return style3; + }; + styfn$3.fromString = function(string3) { + var style3 = this; + style3.resetToDefault(); + style3.appendFromString(string3); + return style3; + }; + styfn$2 = {}; + (function() { + var number$12 = number6; + var rgba4 = rgbaNoBackRefs; + var hsla3 = hslaNoBackRefs; + var hex3$1 = hex3; + var hex6$1 = hex6; + var data5 = /* @__PURE__ */ __name(function data6(prefix) { + return "^" + prefix + "\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"; + }, "data"); + var mapData = /* @__PURE__ */ __name(function mapData2(prefix) { + var mapArg = number$12 + "|\\w+|" + rgba4 + "|" + hsla3 + "|" + hex3$1 + "|" + hex6$1; + return "^" + prefix + "\\s*\\(([\\w\\.]+)\\s*\\,\\s*(" + number$12 + ")\\s*\\,\\s*(" + number$12 + ")\\s*,\\s*(" + mapArg + ")\\s*\\,\\s*(" + mapArg + ")\\)$"; + }, "mapData"); + var urlRegexes = [`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`, "^(none)$", "^(.+)$"]; + styfn$2.types = { + time: { + number: true, + min: 0, + units: "s|ms", + implicitUnits: "ms" + }, + percent: { + number: true, + min: 0, + max: 100, + units: "%", + implicitUnits: "%" + }, + percentages: { + number: true, + min: 0, + max: 100, + units: "%", + implicitUnits: "%", + multiple: true + }, + zeroOneNumber: { + number: true, + min: 0, + max: 1, + unitless: true + }, + zeroOneNumbers: { + number: true, + min: 0, + max: 1, + unitless: true, + multiple: true + }, + nOneOneNumber: { + number: true, + min: -1, + max: 1, + unitless: true + }, + nonNegativeInt: { + number: true, + min: 0, + integer: true, + unitless: true + }, + nonNegativeNumber: { + number: true, + min: 0, + unitless: true + }, + position: { + enums: ["parent", "origin"] + }, + nodeSize: { + number: true, + min: 0, + enums: ["label"] + }, + number: { + number: true, + unitless: true + }, + numbers: { + number: true, + unitless: true, + multiple: true + }, + positiveNumber: { + number: true, + unitless: true, + min: 0, + strictMin: true + }, + size: { + number: true, + min: 0 + }, + bidirectionalSize: { + number: true + }, + // allows negative + bidirectionalSizeMaybePercent: { + number: true, + allowPercent: true + }, + // allows negative + bidirectionalSizes: { + number: true, + multiple: true + }, + // allows negative + sizeMaybePercent: { + number: true, + min: 0, + allowPercent: true + }, + axisDirection: { + enums: ["horizontal", "leftward", "rightward", "vertical", "upward", "downward", "auto"] + }, + axisDirectionExplicit: { + enums: ["leftward", "rightward", "upward", "downward"] + }, + axisDirectionPrimary: { + enums: ["horizontal", "vertical"] + }, + paddingRelativeTo: { + enums: ["width", "height", "average", "min", "max"] + }, + bgWH: { + number: true, + min: 0, + allowPercent: true, + enums: ["auto"], + multiple: true + }, + bgPos: { + number: true, + allowPercent: true, + multiple: true + }, + bgRelativeTo: { + enums: ["inner", "include-padding"], + multiple: true + }, + bgRepeat: { + enums: ["repeat", "repeat-x", "repeat-y", "no-repeat"], + multiple: true + }, + bgFit: { + enums: ["none", "contain", "cover"], + multiple: true + }, + bgCrossOrigin: { + enums: ["anonymous", "use-credentials", "null"], + multiple: true + }, + bgClip: { + enums: ["none", "node"], + multiple: true + }, + bgContainment: { + enums: ["inside", "over"], + multiple: true + }, + boxSelection: { + enums: ["contain", "overlap", "none"] + }, + color: { + color: true + }, + colors: { + color: true, + multiple: true + }, + fill: { + enums: ["solid", "linear-gradient", "radial-gradient"] + }, + bool: { + enums: ["yes", "no"] + }, + bools: { + enums: ["yes", "no"], + multiple: true + }, + lineStyle: { + enums: ["solid", "dotted", "dashed"] + }, + lineCap: { + enums: ["butt", "round", "square"] + }, + linePosition: { + enums: ["center", "inside", "outside"] + }, + lineJoin: { + enums: ["round", "bevel", "miter"] + }, + borderStyle: { + enums: ["solid", "dotted", "dashed", "double"] + }, + curveStyle: { + enums: ["bezier", "unbundled-bezier", "haystack", "segments", "straight", "straight-triangle", "taxi", "round-segments", "round-taxi"] + }, + radiusType: { + enums: ["arc-radius", "influence-radius"], + multiple: true + }, + fontFamily: { + regex: '^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$' + }, + fontStyle: { + enums: ["italic", "normal", "oblique"] + }, + fontWeight: { + enums: ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "800", "900", 100, 200, 300, 400, 500, 600, 700, 800, 900] + }, + textDecoration: { + enums: ["none", "underline", "overline", "line-through"] + }, + textTransform: { + enums: ["none", "uppercase", "lowercase"] + }, + textWrap: { + enums: ["none", "wrap", "ellipsis"] + }, + textOverflowWrap: { + enums: ["whitespace", "anywhere"] + }, + textBackgroundShape: { + enums: ["rectangle", "roundrectangle", "round-rectangle", "circle"] + }, + nodeShape: { + enums: ["rectangle", "roundrectangle", "round-rectangle", "cutrectangle", "cut-rectangle", "bottomroundrectangle", "bottom-round-rectangle", "barrel", "ellipse", "triangle", "round-triangle", "square", "pentagon", "round-pentagon", "hexagon", "round-hexagon", "concavehexagon", "concave-hexagon", "heptagon", "round-heptagon", "octagon", "round-octagon", "tag", "round-tag", "star", "diamond", "round-diamond", "vee", "rhomboid", "right-rhomboid", "polygon"] + }, + overlayShape: { + enums: ["roundrectangle", "round-rectangle", "ellipse"] + }, + cornerRadius: { + number: true, + min: 0, + units: "px|em", + implicitUnits: "px", + enums: ["auto"] + }, + compoundIncludeLabels: { + enums: ["include", "exclude"] + }, + arrowShape: { + enums: ["tee", "triangle", "triangle-tee", "circle-triangle", "triangle-cross", "triangle-backcurve", "vee", "square", "circle", "diamond", "chevron", "none"] + }, + arrowFill: { + enums: ["filled", "hollow"] + }, + arrowWidth: { + number: true, + units: "%|px|em", + implicitUnits: "px", + enums: ["match-line"] + }, + display: { + enums: ["element", "none"] + }, + visibility: { + enums: ["hidden", "visible"] + }, + zCompoundDepth: { + enums: ["bottom", "orphan", "auto", "top"] + }, + zIndexCompare: { + enums: ["auto", "manual"] + }, + valign: { + enums: ["top", "center", "bottom"] + }, + halign: { + enums: ["left", "center", "right"] + }, + justification: { + enums: ["left", "center", "right", "auto"] + }, + text: { + string: true + }, + data: { + mapping: true, + regex: data5("data") + }, + layoutData: { + mapping: true, + regex: data5("layoutData") + }, + scratch: { + mapping: true, + regex: data5("scratch") + }, + mapData: { + mapping: true, + regex: mapData("mapData") + }, + mapLayoutData: { + mapping: true, + regex: mapData("mapLayoutData") + }, + mapScratch: { + mapping: true, + regex: mapData("mapScratch") + }, + fn: { + mapping: true, + fn: true + }, + url: { + regexes: urlRegexes, + singleRegexMatchValue: true + }, + urls: { + regexes: urlRegexes, + singleRegexMatchValue: true, + multiple: true + }, + propList: { + propList: true + }, + angle: { + number: true, + units: "deg|rad", + implicitUnits: "rad" + }, + textRotation: { + number: true, + units: "deg|rad", + implicitUnits: "rad", + enums: ["none", "autorotate"] + }, + polygonPointList: { + number: true, + multiple: true, + evenMultiple: true, + min: -1, + max: 1, + unitless: true + }, + edgeDistances: { + enums: ["intersection", "node-position", "endpoints"] + }, + edgeEndpoint: { + number: true, + multiple: true, + units: "%|px|em|deg|rad", + implicitUnits: "px", + enums: ["inside-to-node", "outside-to-node", "outside-to-node-or-label", "outside-to-line", "outside-to-line-or-label"], + singleEnum: true, + validate: /* @__PURE__ */ __name(function validate(valArr, unitsArr) { + switch (valArr.length) { + case 2: + return unitsArr[0] !== "deg" && unitsArr[0] !== "rad" && unitsArr[1] !== "deg" && unitsArr[1] !== "rad"; + case 1: + return string(valArr[0]) || unitsArr[0] === "deg" || unitsArr[0] === "rad"; + default: + return false; + } + }, "validate") + }, + easing: { + regexes: ["^(spring)\\s*\\(\\s*(" + number$12 + ")\\s*,\\s*(" + number$12 + ")\\s*\\)$", "^(cubic-bezier)\\s*\\(\\s*(" + number$12 + ")\\s*,\\s*(" + number$12 + ")\\s*,\\s*(" + number$12 + ")\\s*,\\s*(" + number$12 + ")\\s*\\)$"], + enums: ["linear", "ease", "ease-in", "ease-out", "ease-in-out", "ease-in-sine", "ease-out-sine", "ease-in-out-sine", "ease-in-quad", "ease-out-quad", "ease-in-out-quad", "ease-in-cubic", "ease-out-cubic", "ease-in-out-cubic", "ease-in-quart", "ease-out-quart", "ease-in-out-quart", "ease-in-quint", "ease-out-quint", "ease-in-out-quint", "ease-in-expo", "ease-out-expo", "ease-in-out-expo", "ease-in-circ", "ease-out-circ", "ease-in-out-circ"] + }, + gradientDirection: { + enums: [ + "to-bottom", + "to-top", + "to-left", + "to-right", + "to-bottom-right", + "to-bottom-left", + "to-top-right", + "to-top-left", + "to-right-bottom", + "to-left-bottom", + "to-right-top", + "to-left-top" + // different order + ] + }, + boundsExpansion: { + number: true, + multiple: true, + min: 0, + validate: /* @__PURE__ */ __name(function validate(valArr) { + var length2 = valArr.length; + return length2 === 1 || length2 === 2 || length2 === 4; + }, "validate") + } + }; + var diff2 = { + zeroNonZero: /* @__PURE__ */ __name(function zeroNonZero(val1, val2) { + if ((val1 == null || val2 == null) && val1 !== val2) { + return true; + } + if (val1 == 0 && val2 != 0) { + return true; + } else if (val1 != 0 && val2 == 0) { + return true; + } else { + return false; + } + }, "zeroNonZero"), + any: /* @__PURE__ */ __name(function any(val1, val2) { + return val1 != val2; + }, "any"), + emptyNonEmpty: /* @__PURE__ */ __name(function emptyNonEmpty(str1, str2) { + var empty1 = emptyString(str1); + var empty22 = emptyString(str2); + return empty1 && !empty22 || !empty1 && empty22; + }, "emptyNonEmpty") + }; + var t4 = styfn$2.types; + var mainLabel = [{ + name: "label", + type: t4.text, + triggersBounds: diff2.any, + triggersZOrder: diff2.emptyNonEmpty + }, { + name: "text-rotation", + type: t4.textRotation, + triggersBounds: diff2.any + }, { + name: "text-margin-x", + type: t4.bidirectionalSize, + triggersBounds: diff2.any + }, { + name: "text-margin-y", + type: t4.bidirectionalSize, + triggersBounds: diff2.any + }]; + var sourceLabel = [{ + name: "source-label", + type: t4.text, + triggersBounds: diff2.any + }, { + name: "source-text-rotation", + type: t4.textRotation, + triggersBounds: diff2.any + }, { + name: "source-text-margin-x", + type: t4.bidirectionalSize, + triggersBounds: diff2.any + }, { + name: "source-text-margin-y", + type: t4.bidirectionalSize, + triggersBounds: diff2.any + }, { + name: "source-text-offset", + type: t4.size, + triggersBounds: diff2.any + }]; + var targetLabel = [{ + name: "target-label", + type: t4.text, + triggersBounds: diff2.any + }, { + name: "target-text-rotation", + type: t4.textRotation, + triggersBounds: diff2.any + }, { + name: "target-text-margin-x", + type: t4.bidirectionalSize, + triggersBounds: diff2.any + }, { + name: "target-text-margin-y", + type: t4.bidirectionalSize, + triggersBounds: diff2.any + }, { + name: "target-text-offset", + type: t4.size, + triggersBounds: diff2.any + }]; + var labelDimensions = [{ + name: "font-family", + type: t4.fontFamily, + triggersBounds: diff2.any + }, { + name: "font-style", + type: t4.fontStyle, + triggersBounds: diff2.any + }, { + name: "font-weight", + type: t4.fontWeight, + triggersBounds: diff2.any + }, { + name: "font-size", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "text-transform", + type: t4.textTransform, + triggersBounds: diff2.any + }, { + name: "text-wrap", + type: t4.textWrap, + triggersBounds: diff2.any + }, { + name: "text-overflow-wrap", + type: t4.textOverflowWrap, + triggersBounds: diff2.any + }, { + name: "text-max-width", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "text-outline-width", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "line-height", + type: t4.positiveNumber, + triggersBounds: diff2.any + }]; + var commonLabel = [{ + name: "text-valign", + type: t4.valign, + triggersBounds: diff2.any + }, { + name: "text-halign", + type: t4.halign, + triggersBounds: diff2.any + }, { + name: "color", + type: t4.color + }, { + name: "text-outline-color", + type: t4.color + }, { + name: "text-outline-opacity", + type: t4.zeroOneNumber + }, { + name: "text-background-color", + type: t4.color + }, { + name: "text-background-opacity", + type: t4.zeroOneNumber + }, { + name: "text-background-padding", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "text-border-opacity", + type: t4.zeroOneNumber + }, { + name: "text-border-color", + type: t4.color + }, { + name: "text-border-width", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "text-border-style", + type: t4.borderStyle, + triggersBounds: diff2.any + }, { + name: "text-background-shape", + type: t4.textBackgroundShape, + triggersBounds: diff2.any + }, { + name: "text-justification", + type: t4.justification + }, { + name: "box-select-labels", + type: t4.bool, + triggersBounds: diff2.any + }]; + var behavior = [{ + name: "events", + type: t4.bool, + triggersZOrder: diff2.any + }, { + name: "text-events", + type: t4.bool, + triggersZOrder: diff2.any + }, { + name: "box-selection", + type: t4.boxSelection, + triggersZOrder: diff2.any + }]; + var visibility = [{ + name: "display", + type: t4.display, + triggersZOrder: diff2.any, + triggersBounds: diff2.any, + triggersBoundsOfConnectedEdges: diff2.any, + triggersBoundsOfParallelEdges: /* @__PURE__ */ __name(function triggersBoundsOfParallelEdges(fromValue, toValue, ele) { + if (fromValue === toValue) { + return false; + } + return ele.pstyle("curve-style").value === "bezier"; + }, "triggersBoundsOfParallelEdges") + }, { + name: "visibility", + type: t4.visibility, + triggersZOrder: diff2.any + }, { + name: "opacity", + type: t4.zeroOneNumber, + triggersZOrder: diff2.zeroNonZero + }, { + name: "text-opacity", + type: t4.zeroOneNumber + }, { + name: "min-zoomed-font-size", + type: t4.size + }, { + name: "z-compound-depth", + type: t4.zCompoundDepth, + triggersZOrder: diff2.any + }, { + name: "z-index-compare", + type: t4.zIndexCompare, + triggersZOrder: diff2.any + }, { + name: "z-index", + type: t4.number, + triggersZOrder: diff2.any + }]; + var overlay = [{ + name: "overlay-padding", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "overlay-color", + type: t4.color + }, { + name: "overlay-opacity", + type: t4.zeroOneNumber, + triggersBounds: diff2.zeroNonZero + }, { + name: "overlay-shape", + type: t4.overlayShape, + triggersBounds: diff2.any + }, { + name: "overlay-corner-radius", + type: t4.cornerRadius + }]; + var underlay = [{ + name: "underlay-padding", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "underlay-color", + type: t4.color + }, { + name: "underlay-opacity", + type: t4.zeroOneNumber, + triggersBounds: diff2.zeroNonZero + }, { + name: "underlay-shape", + type: t4.overlayShape, + triggersBounds: diff2.any + }, { + name: "underlay-corner-radius", + type: t4.cornerRadius + }]; + var transition2 = [{ + name: "transition-property", + type: t4.propList + }, { + name: "transition-duration", + type: t4.time + }, { + name: "transition-delay", + type: t4.time + }, { + name: "transition-timing-function", + type: t4.easing + }]; + var nodeSizeHashOverride = /* @__PURE__ */ __name(function nodeSizeHashOverride2(ele, parsedProp) { + if (parsedProp.value === "label") { + return -ele.poolIndex(); + } else { + return parsedProp.pfValue; + } + }, "nodeSizeHashOverride"); + var nodeBody = [{ + name: "height", + type: t4.nodeSize, + triggersBounds: diff2.any, + hashOverride: nodeSizeHashOverride + }, { + name: "width", + type: t4.nodeSize, + triggersBounds: diff2.any, + hashOverride: nodeSizeHashOverride + }, { + name: "shape", + type: t4.nodeShape, + triggersBounds: diff2.any + }, { + name: "shape-polygon-points", + type: t4.polygonPointList, + triggersBounds: diff2.any + }, { + name: "corner-radius", + type: t4.cornerRadius + }, { + name: "background-color", + type: t4.color + }, { + name: "background-fill", + type: t4.fill + }, { + name: "background-opacity", + type: t4.zeroOneNumber + }, { + name: "background-blacken", + type: t4.nOneOneNumber + }, { + name: "background-gradient-stop-colors", + type: t4.colors + }, { + name: "background-gradient-stop-positions", + type: t4.percentages + }, { + name: "background-gradient-direction", + type: t4.gradientDirection + }, { + name: "padding", + type: t4.sizeMaybePercent, + triggersBounds: diff2.any + }, { + name: "padding-relative-to", + type: t4.paddingRelativeTo, + triggersBounds: diff2.any + }, { + name: "bounds-expansion", + type: t4.boundsExpansion, + triggersBounds: diff2.any + }]; + var nodeBorder = [{ + name: "border-color", + type: t4.color + }, { + name: "border-opacity", + type: t4.zeroOneNumber + }, { + name: "border-width", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "border-style", + type: t4.borderStyle + }, { + name: "border-cap", + type: t4.lineCap + }, { + name: "border-join", + type: t4.lineJoin + }, { + name: "border-dash-pattern", + type: t4.numbers + }, { + name: "border-dash-offset", + type: t4.number + }, { + name: "border-position", + type: t4.linePosition + }]; + var nodeOutline = [{ + name: "outline-color", + type: t4.color + }, { + name: "outline-opacity", + type: t4.zeroOneNumber + }, { + name: "outline-width", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "outline-style", + type: t4.borderStyle + }, { + name: "outline-offset", + type: t4.size, + triggersBounds: diff2.any + }]; + var backgroundImage = [{ + name: "background-image", + type: t4.urls + }, { + name: "background-image-crossorigin", + type: t4.bgCrossOrigin + }, { + name: "background-image-opacity", + type: t4.zeroOneNumbers + }, { + name: "background-image-containment", + type: t4.bgContainment + }, { + name: "background-image-smoothing", + type: t4.bools + }, { + name: "background-position-x", + type: t4.bgPos + }, { + name: "background-position-y", + type: t4.bgPos + }, { + name: "background-width-relative-to", + type: t4.bgRelativeTo + }, { + name: "background-height-relative-to", + type: t4.bgRelativeTo + }, { + name: "background-repeat", + type: t4.bgRepeat + }, { + name: "background-fit", + type: t4.bgFit + }, { + name: "background-clip", + type: t4.bgClip + }, { + name: "background-width", + type: t4.bgWH + }, { + name: "background-height", + type: t4.bgWH + }, { + name: "background-offset-x", + type: t4.bgPos + }, { + name: "background-offset-y", + type: t4.bgPos + }]; + var compound = [{ + name: "position", + type: t4.position, + triggersBounds: diff2.any + }, { + name: "compound-sizing-wrt-labels", + type: t4.compoundIncludeLabels, + triggersBounds: diff2.any + }, { + name: "min-width", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "min-width-bias-left", + type: t4.sizeMaybePercent, + triggersBounds: diff2.any + }, { + name: "min-width-bias-right", + type: t4.sizeMaybePercent, + triggersBounds: diff2.any + }, { + name: "min-height", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "min-height-bias-top", + type: t4.sizeMaybePercent, + triggersBounds: diff2.any + }, { + name: "min-height-bias-bottom", + type: t4.sizeMaybePercent, + triggersBounds: diff2.any + }]; + var edgeLine = [{ + name: "line-style", + type: t4.lineStyle + }, { + name: "line-color", + type: t4.color + }, { + name: "line-fill", + type: t4.fill + }, { + name: "line-cap", + type: t4.lineCap + }, { + name: "line-opacity", + type: t4.zeroOneNumber + }, { + name: "line-dash-pattern", + type: t4.numbers + }, { + name: "line-dash-offset", + type: t4.number + }, { + name: "line-outline-width", + type: t4.size + }, { + name: "line-outline-color", + type: t4.color + }, { + name: "line-gradient-stop-colors", + type: t4.colors + }, { + name: "line-gradient-stop-positions", + type: t4.percentages + }, { + name: "curve-style", + type: t4.curveStyle, + triggersBounds: diff2.any, + triggersBoundsOfParallelEdges: /* @__PURE__ */ __name(function triggersBoundsOfParallelEdges(fromValue, toValue) { + if (fromValue === toValue) { + return false; + } + return fromValue === "bezier" || // remove from bundle + toValue === "bezier"; + }, "triggersBoundsOfParallelEdges") + }, { + name: "haystack-radius", + type: t4.zeroOneNumber, + triggersBounds: diff2.any + }, { + name: "source-endpoint", + type: t4.edgeEndpoint, + triggersBounds: diff2.any + }, { + name: "target-endpoint", + type: t4.edgeEndpoint, + triggersBounds: diff2.any + }, { + name: "control-point-step-size", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "control-point-distances", + type: t4.bidirectionalSizes, + triggersBounds: diff2.any + }, { + name: "control-point-weights", + type: t4.numbers, + triggersBounds: diff2.any + }, { + name: "segment-distances", + type: t4.bidirectionalSizes, + triggersBounds: diff2.any + }, { + name: "segment-weights", + type: t4.numbers, + triggersBounds: diff2.any + }, { + name: "segment-radii", + type: t4.numbers, + triggersBounds: diff2.any + }, { + name: "radius-type", + type: t4.radiusType, + triggersBounds: diff2.any + }, { + name: "taxi-turn", + type: t4.bidirectionalSizeMaybePercent, + triggersBounds: diff2.any + }, { + name: "taxi-turn-min-distance", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "taxi-direction", + type: t4.axisDirection, + triggersBounds: diff2.any + }, { + name: "taxi-radius", + type: t4.number, + triggersBounds: diff2.any + }, { + name: "edge-distances", + type: t4.edgeDistances, + triggersBounds: diff2.any + }, { + name: "arrow-scale", + type: t4.positiveNumber, + triggersBounds: diff2.any + }, { + name: "loop-direction", + type: t4.angle, + triggersBounds: diff2.any + }, { + name: "loop-sweep", + type: t4.angle, + triggersBounds: diff2.any + }, { + name: "source-distance-from-node", + type: t4.size, + triggersBounds: diff2.any + }, { + name: "target-distance-from-node", + type: t4.size, + triggersBounds: diff2.any + }]; + var ghost = [{ + name: "ghost", + type: t4.bool, + triggersBounds: diff2.any + }, { + name: "ghost-offset-x", + type: t4.bidirectionalSize, + triggersBounds: diff2.any + }, { + name: "ghost-offset-y", + type: t4.bidirectionalSize, + triggersBounds: diff2.any + }, { + name: "ghost-opacity", + type: t4.zeroOneNumber + }]; + var core4 = [{ + name: "selection-box-color", + type: t4.color + }, { + name: "selection-box-opacity", + type: t4.zeroOneNumber + }, { + name: "selection-box-border-color", + type: t4.color + }, { + name: "selection-box-border-width", + type: t4.size + }, { + name: "active-bg-color", + type: t4.color + }, { + name: "active-bg-opacity", + type: t4.zeroOneNumber + }, { + name: "active-bg-size", + type: t4.size + }, { + name: "outside-texture-bg-color", + type: t4.color + }, { + name: "outside-texture-bg-opacity", + type: t4.zeroOneNumber + }]; + var pie2 = []; + styfn$2.pieBackgroundN = 16; + pie2.push({ + name: "pie-size", + type: t4.sizeMaybePercent + }); + pie2.push({ + name: "pie-hole", + type: t4.sizeMaybePercent + }); + pie2.push({ + name: "pie-start-angle", + type: t4.angle + }); + for (var i2 = 1; i2 <= styfn$2.pieBackgroundN; i2++) { + pie2.push({ + name: "pie-" + i2 + "-background-color", + type: t4.color + }); + pie2.push({ + name: "pie-" + i2 + "-background-size", + type: t4.percent + }); + pie2.push({ + name: "pie-" + i2 + "-background-opacity", + type: t4.zeroOneNumber + }); + } + var stripe = []; + styfn$2.stripeBackgroundN = 16; + stripe.push({ + name: "stripe-size", + type: t4.sizeMaybePercent + }); + stripe.push({ + name: "stripe-direction", + type: t4.axisDirectionPrimary + }); + for (var _i = 1; _i <= styfn$2.stripeBackgroundN; _i++) { + stripe.push({ + name: "stripe-" + _i + "-background-color", + type: t4.color + }); + stripe.push({ + name: "stripe-" + _i + "-background-size", + type: t4.percent + }); + stripe.push({ + name: "stripe-" + _i + "-background-opacity", + type: t4.zeroOneNumber + }); + } + var edgeArrow = []; + var arrowPrefixes = styfn$2.arrowPrefixes = ["source", "mid-source", "target", "mid-target"]; + [{ + name: "arrow-shape", + type: t4.arrowShape, + triggersBounds: diff2.any + }, { + name: "arrow-color", + type: t4.color + }, { + name: "arrow-fill", + type: t4.arrowFill + }, { + name: "arrow-width", + type: t4.arrowWidth + }].forEach(function(prop2) { + arrowPrefixes.forEach(function(prefix) { + var name = prefix + "-" + prop2.name; + var type3 = prop2.type, triggersBounds = prop2.triggersBounds; + edgeArrow.push({ + name, + type: type3, + triggersBounds + }); + }); + }, {}); + var props = styfn$2.properties = [].concat(behavior, transition2, visibility, overlay, underlay, ghost, commonLabel, labelDimensions, mainLabel, sourceLabel, targetLabel, nodeBody, nodeBorder, nodeOutline, backgroundImage, pie2, stripe, compound, edgeLine, edgeArrow, core4); + var propGroups = styfn$2.propertyGroups = { + // common to all eles + behavior, + transition: transition2, + visibility, + overlay, + underlay, + ghost, + // labels + commonLabel, + labelDimensions, + mainLabel, + sourceLabel, + targetLabel, + // node props + nodeBody, + nodeBorder, + nodeOutline, + backgroundImage, + pie: pie2, + stripe, + compound, + // edge props + edgeLine, + edgeArrow, + core: core4 + }; + var propGroupNames = styfn$2.propertyGroupNames = {}; + var propGroupKeys = styfn$2.propertyGroupKeys = Object.keys(propGroups); + propGroupKeys.forEach(function(key) { + propGroupNames[key] = propGroups[key].map(function(prop2) { + return prop2.name; + }); + propGroups[key].forEach(function(prop2) { + return prop2.groupKey = key; + }); + }); + var aliases = styfn$2.aliases = [{ + name: "content", + pointsTo: "label" + }, { + name: "control-point-distance", + pointsTo: "control-point-distances" + }, { + name: "control-point-weight", + pointsTo: "control-point-weights" + }, { + name: "segment-distance", + pointsTo: "segment-distances" + }, { + name: "segment-weight", + pointsTo: "segment-weights" + }, { + name: "segment-radius", + pointsTo: "segment-radii" + }, { + name: "edge-text-rotation", + pointsTo: "text-rotation" + }, { + name: "padding-left", + pointsTo: "padding" + }, { + name: "padding-right", + pointsTo: "padding" + }, { + name: "padding-top", + pointsTo: "padding" + }, { + name: "padding-bottom", + pointsTo: "padding" + }]; + styfn$2.propertyNames = props.map(function(p3) { + return p3.name; + }); + for (var _i2 = 0; _i2 < props.length; _i2++) { + var prop = props[_i2]; + props[prop.name] = prop; + } + for (var _i3 = 0; _i3 < aliases.length; _i3++) { + var alias = aliases[_i3]; + var pointsToProp = props[alias.pointsTo]; + var aliasProp = { + name: alias.name, + alias: true, + pointsTo: pointsToProp + }; + props.push(aliasProp); + props[alias.name] = aliasProp; + } + })(); + styfn$2.getDefaultProperty = function(name) { + return this.getDefaultProperties()[name]; + }; + styfn$2.getDefaultProperties = function() { + var _p = this._private; + if (_p.defaultProperties != null) { + return _p.defaultProperties; + } + var rawProps = extend4({ + // core props + "selection-box-color": "#ddd", + "selection-box-opacity": 0.65, + "selection-box-border-color": "#aaa", + "selection-box-border-width": 1, + "active-bg-color": "black", + "active-bg-opacity": 0.15, + "active-bg-size": 30, + "outside-texture-bg-color": "#000", + "outside-texture-bg-opacity": 0.125, + // common node/edge props + "events": "yes", + "text-events": "no", + "text-valign": "top", + "text-halign": "center", + "text-justification": "auto", + "line-height": 1, + "color": "#000", + "box-selection": "contain", + "text-outline-color": "#000", + "text-outline-width": 0, + "text-outline-opacity": 1, + "text-opacity": 1, + "text-decoration": "none", + "text-transform": "none", + "text-wrap": "none", + "text-overflow-wrap": "whitespace", + "text-max-width": 9999, + "text-background-color": "#000", + "text-background-opacity": 0, + "text-background-shape": "rectangle", + "text-background-padding": 0, + "text-border-opacity": 0, + "text-border-width": 0, + "text-border-style": "solid", + "text-border-color": "#000", + "font-family": "Helvetica Neue, Helvetica, sans-serif", + "font-style": "normal", + "font-weight": "normal", + "font-size": 16, + "min-zoomed-font-size": 0, + "text-rotation": "none", + "source-text-rotation": "none", + "target-text-rotation": "none", + "visibility": "visible", + "display": "element", + "opacity": 1, + "z-compound-depth": "auto", + "z-index-compare": "auto", + "z-index": 0, + "label": "", + "text-margin-x": 0, + "text-margin-y": 0, + "source-label": "", + "source-text-offset": 0, + "source-text-margin-x": 0, + "source-text-margin-y": 0, + "target-label": "", + "target-text-offset": 0, + "target-text-margin-x": 0, + "target-text-margin-y": 0, + "overlay-opacity": 0, + "overlay-color": "#000", + "overlay-padding": 10, + "overlay-shape": "round-rectangle", + "overlay-corner-radius": "auto", + "underlay-opacity": 0, + "underlay-color": "#000", + "underlay-padding": 10, + "underlay-shape": "round-rectangle", + "underlay-corner-radius": "auto", + "transition-property": "none", + "transition-duration": 0, + "transition-delay": 0, + "transition-timing-function": "linear", + "box-select-labels": "no", + // node props + "background-blacken": 0, + "background-color": "#999", + "background-fill": "solid", + "background-opacity": 1, + "background-image": "none", + "background-image-crossorigin": "anonymous", + "background-image-opacity": 1, + "background-image-containment": "inside", + "background-image-smoothing": "yes", + "background-position-x": "50%", + "background-position-y": "50%", + "background-offset-x": 0, + "background-offset-y": 0, + "background-width-relative-to": "include-padding", + "background-height-relative-to": "include-padding", + "background-repeat": "no-repeat", + "background-fit": "none", + "background-clip": "node", + "background-width": "auto", + "background-height": "auto", + "border-color": "#000", + "border-opacity": 1, + "border-width": 0, + "border-style": "solid", + "border-dash-pattern": [4, 2], + "border-dash-offset": 0, + "border-cap": "butt", + "border-join": "miter", + "border-position": "center", + "outline-color": "#999", + "outline-opacity": 1, + "outline-width": 0, + "outline-offset": 0, + "outline-style": "solid", + "height": 30, + "width": 30, + "shape": "ellipse", + "shape-polygon-points": "-1, -1, 1, -1, 1, 1, -1, 1", + "corner-radius": "auto", + "bounds-expansion": 0, + // node gradient + "background-gradient-direction": "to-bottom", + "background-gradient-stop-colors": "#999", + "background-gradient-stop-positions": "0%", + // ghost props + "ghost": "no", + "ghost-offset-y": 0, + "ghost-offset-x": 0, + "ghost-opacity": 0, + // compound props + "padding": 0, + "padding-relative-to": "width", + "position": "origin", + "compound-sizing-wrt-labels": "include", + "min-width": 0, + "min-width-bias-left": 0, + "min-width-bias-right": 0, + "min-height": 0, + "min-height-bias-top": 0, + "min-height-bias-bottom": 0 + }, { + // node pie bg + "pie-size": "100%", + "pie-hole": 0, + "pie-start-angle": "0deg" + }, [{ + name: "pie-{{i}}-background-color", + value: "black" + }, { + name: "pie-{{i}}-background-size", + value: "0%" + }, { + name: "pie-{{i}}-background-opacity", + value: 1 + }].reduce(function(css, prop2) { + for (var i3 = 1; i3 <= styfn$2.pieBackgroundN; i3++) { + var name2 = prop2.name.replace("{{i}}", i3); + var val2 = prop2.value; + css[name2] = val2; + } + return css; + }, {}), { + // node stripes bg + "stripe-size": "100%", + "stripe-direction": "horizontal" + }, [{ + name: "stripe-{{i}}-background-color", + value: "black" + }, { + name: "stripe-{{i}}-background-size", + value: "0%" + }, { + name: "stripe-{{i}}-background-opacity", + value: 1 + }].reduce(function(css, prop2) { + for (var i3 = 1; i3 <= styfn$2.stripeBackgroundN; i3++) { + var name2 = prop2.name.replace("{{i}}", i3); + var val2 = prop2.value; + css[name2] = val2; + } + return css; + }, {}), { + // edge props + "line-style": "solid", + "line-color": "#999", + "line-fill": "solid", + "line-cap": "butt", + "line-opacity": 1, + "line-outline-width": 0, + "line-outline-color": "#000", + "line-gradient-stop-colors": "#999", + "line-gradient-stop-positions": "0%", + "control-point-step-size": 40, + "control-point-weights": 0.5, + "segment-weights": 0.5, + "segment-distances": 20, + "segment-radii": 15, + "radius-type": "arc-radius", + "taxi-turn": "50%", + "taxi-radius": 15, + "taxi-turn-min-distance": 10, + "taxi-direction": "auto", + "edge-distances": "intersection", + "curve-style": "haystack", + "haystack-radius": 0, + "arrow-scale": 1, + "loop-direction": "-45deg", + "loop-sweep": "-90deg", + "source-distance-from-node": 0, + "target-distance-from-node": 0, + "source-endpoint": "outside-to-node", + "target-endpoint": "outside-to-node", + "line-dash-pattern": [6, 3], + "line-dash-offset": 0 + }, [{ + name: "arrow-shape", + value: "none" + }, { + name: "arrow-color", + value: "#999" + }, { + name: "arrow-fill", + value: "filled" + }, { + name: "arrow-width", + value: 1 + }].reduce(function(css, prop2) { + styfn$2.arrowPrefixes.forEach(function(prefix) { + var name2 = prefix + "-" + prop2.name; + var val2 = prop2.value; + css[name2] = val2; + }); + return css; + }, {})); + var parsedProps = {}; + for (var i2 = 0; i2 < this.properties.length; i2++) { + var prop = this.properties[i2]; + if (prop.pointsTo) { + continue; + } + var name = prop.name; + var val = rawProps[name]; + var parsedProp = this.parse(name, val); + parsedProps[name] = parsedProp; + } + _p.defaultProperties = parsedProps; + return _p.defaultProperties; + }; + styfn$2.addDefaultStylesheet = function() { + this.selector(":parent").css({ + "shape": "rectangle", + "padding": 10, + "background-color": "#eee", + "border-color": "#ccc", + "border-width": 1 + }).selector("edge").css({ + "width": 3 + }).selector(":loop").css({ + "curve-style": "bezier" + }).selector("edge:compound").css({ + "curve-style": "bezier", + "source-endpoint": "outside-to-line", + "target-endpoint": "outside-to-line" + }).selector(":selected").css({ + "background-color": "#0169D9", + "line-color": "#0169D9", + "source-arrow-color": "#0169D9", + "target-arrow-color": "#0169D9", + "mid-source-arrow-color": "#0169D9", + "mid-target-arrow-color": "#0169D9" + }).selector(":parent:selected").css({ + "background-color": "#CCE1F9", + "border-color": "#aec8e5" + }).selector(":active").css({ + "overlay-color": "black", + "overlay-padding": 10, + "overlay-opacity": 0.25 + }); + this.defaultLength = this.length; + }; + styfn$1 = {}; + styfn$1.parse = function(name, value2, propIsBypass, propIsFlat) { + var self2 = this; + if (fn$6(value2)) { + return self2.parseImplWarn(name, value2, propIsBypass, propIsFlat); + } + var flatKey = propIsFlat === "mapping" || propIsFlat === true || propIsFlat === false || propIsFlat == null ? "dontcare" : propIsFlat; + var bypassKey = propIsBypass ? "t" : "f"; + var valueKey = "" + value2; + var argHash = hashStrings(name, valueKey, bypassKey, flatKey); + var propCache = self2.propCache = self2.propCache || []; + var ret; + if (!(ret = propCache[argHash])) { + ret = propCache[argHash] = self2.parseImplWarn(name, value2, propIsBypass, propIsFlat); + } + if (propIsBypass || propIsFlat === "mapping") { + ret = copy3(ret); + if (ret) { + ret.value = copy3(ret.value); + } + } + return ret; + }; + styfn$1.parseImplWarn = function(name, value2, propIsBypass, propIsFlat) { + var prop = this.parseImpl(name, value2, propIsBypass, propIsFlat); + if (!prop && value2 != null) { + warn("The style property `".concat(name, ": ").concat(value2, "` is invalid")); + } + if (prop && (prop.name === "width" || prop.name === "height") && value2 === "label") { + warn("The style value of `label` is deprecated for `" + prop.name + "`"); + } + return prop; + }; + styfn$1.parseImpl = function(name, value2, propIsBypass, propIsFlat) { + var self2 = this; + name = camel2dash(name); + var property3 = self2.properties[name]; + var passedValue = value2; + var types = self2.types; + if (!property3) { + return null; + } + if (value2 === void 0) { + return null; + } + if (property3.alias) { + property3 = property3.pointsTo; + name = property3.name; + } + var valueIsString = string(value2); + if (valueIsString) { + value2 = value2.trim(); + } + var type3 = property3.type; + if (!type3) { + return null; + } + if (propIsBypass && (value2 === "" || value2 === null)) { + return { + name, + value: value2, + bypass: true, + deleteBypass: true + }; + } + if (fn$6(value2)) { + return { + name, + value: value2, + strValue: "fn", + mapped: types.fn, + bypass: propIsBypass + }; + } + var data5, mapData; + if (!valueIsString || propIsFlat || value2.length < 7 || value2[1] !== "a") ; + else if (value2.length >= 7 && value2[0] === "d" && (data5 = new RegExp(types.data.regex).exec(value2))) { + if (propIsBypass) { + return false; + } + var mapped = types.data; + return { + name, + value: data5, + strValue: "" + value2, + mapped, + field: data5[1], + bypass: propIsBypass + }; + } else if (value2.length >= 10 && value2[0] === "m" && (mapData = new RegExp(types.mapData.regex).exec(value2))) { + if (propIsBypass) { + return false; + } + if (type3.multiple) { + return false; + } + var _mapped = types.mapData; + if (!(type3.color || type3.number)) { + return false; + } + var valueMin = this.parse(name, mapData[4]); + if (!valueMin || valueMin.mapped) { + return false; + } + var valueMax = this.parse(name, mapData[5]); + if (!valueMax || valueMax.mapped) { + return false; + } + if (valueMin.pfValue === valueMax.pfValue || valueMin.strValue === valueMax.strValue) { + warn("`" + name + ": " + value2 + "` is not a valid mapper because the output range is zero; converting to `" + name + ": " + valueMin.strValue + "`"); + return this.parse(name, valueMin.strValue); + } else if (type3.color) { + var c1 = valueMin.value; + var c22 = valueMax.value; + var same2 = c1[0] === c22[0] && c1[1] === c22[1] && c1[2] === c22[2] && // optional alpha + (c1[3] === c22[3] || (c1[3] == null || c1[3] === 1) && (c22[3] == null || c22[3] === 1)); + if (same2) { + return false; + } + } + return { + name, + value: mapData, + strValue: "" + value2, + mapped: _mapped, + field: mapData[1], + fieldMin: parseFloat(mapData[2]), + // min & max are numeric + fieldMax: parseFloat(mapData[3]), + valueMin: valueMin.value, + valueMax: valueMax.value, + bypass: propIsBypass + }; + } + if (type3.multiple && propIsFlat !== "multiple") { + var vals; + if (valueIsString) { + vals = value2.split(/\s+/); + } else if (array2(value2)) { + vals = value2; + } else { + vals = [value2]; + } + if (type3.evenMultiple && vals.length % 2 !== 0) { + return null; + } + var valArr = []; + var unitsArr = []; + var pfValArr = []; + var strVal = ""; + var hasEnum = false; + for (var i2 = 0; i2 < vals.length; i2++) { + var p3 = self2.parse(name, vals[i2], propIsBypass, "multiple"); + hasEnum = hasEnum || string(p3.value); + valArr.push(p3.value); + pfValArr.push(p3.pfValue != null ? p3.pfValue : p3.value); + unitsArr.push(p3.units); + strVal += (i2 > 0 ? " " : "") + p3.strValue; + } + if (type3.validate && !type3.validate(valArr, unitsArr)) { + return null; + } + if (type3.singleEnum && hasEnum) { + if (valArr.length === 1 && string(valArr[0])) { + return { + name, + value: valArr[0], + strValue: valArr[0], + bypass: propIsBypass + }; + } else { + return null; + } + } + return { + name, + value: valArr, + pfValue: pfValArr, + strValue: strVal, + bypass: propIsBypass, + units: unitsArr + }; + } + var checkEnums = /* @__PURE__ */ __name(function checkEnums2() { + for (var _i = 0; _i < type3.enums.length; _i++) { + var en = type3.enums[_i]; + if (en === value2) { + return { + name, + value: value2, + strValue: "" + value2, + bypass: propIsBypass + }; + } + } + return null; + }, "checkEnums"); + if (type3.number) { + var units; + var implicitUnits = "px"; + if (type3.units) { + units = type3.units; + } + if (type3.implicitUnits) { + implicitUnits = type3.implicitUnits; + } + if (!type3.unitless) { + if (valueIsString) { + var unitsRegex = "px|em" + (type3.allowPercent ? "|\\%" : ""); + if (units) { + unitsRegex = units; + } + var match3 = value2.match("^(" + number6 + ")(" + unitsRegex + ")?$"); + if (match3) { + value2 = match3[1]; + units = match3[2] || implicitUnits; + } + } else if (!units || type3.implicitUnits) { + units = implicitUnits; + } + } + value2 = parseFloat(value2); + if (isNaN(value2) && type3.enums === void 0) { + return null; + } + if (isNaN(value2) && type3.enums !== void 0) { + value2 = passedValue; + return checkEnums(); + } + if (type3.integer && !integer(value2)) { + return null; + } + if (type3.min !== void 0 && (value2 < type3.min || type3.strictMin && value2 === type3.min) || type3.max !== void 0 && (value2 > type3.max || type3.strictMax && value2 === type3.max)) { + return null; + } + var ret = { + name, + value: value2, + strValue: "" + value2 + (units ? units : ""), + units, + bypass: propIsBypass + }; + if (type3.unitless || units !== "px" && units !== "em") { + ret.pfValue = value2; + } else { + ret.pfValue = units === "px" || !units ? value2 : this.getEmSizeInPixels() * value2; + } + if (units === "ms" || units === "s") { + ret.pfValue = units === "ms" ? value2 : 1e3 * value2; + } + if (units === "deg" || units === "rad") { + ret.pfValue = units === "rad" ? value2 : deg2rad(value2); + } + if (units === "%") { + ret.pfValue = value2 / 100; + } + return ret; + } else if (type3.propList) { + var props = []; + var propsStr = "" + value2; + if (propsStr === "none") ; + else { + var propsSplit = propsStr.split(/\s*,\s*|\s+/); + for (var _i2 = 0; _i2 < propsSplit.length; _i2++) { + var propName = propsSplit[_i2].trim(); + if (self2.properties[propName]) { + props.push(propName); + } else { + warn("`" + propName + "` is not a valid property name"); + } + } + if (props.length === 0) { + return null; + } + } + return { + name, + value: props, + strValue: props.length === 0 ? "none" : props.join(" "), + bypass: propIsBypass + }; + } else if (type3.color) { + var tuple = color2tuple(value2); + if (!tuple) { + return null; + } + return { + name, + value: tuple, + pfValue: tuple, + strValue: "rgb(" + tuple[0] + "," + tuple[1] + "," + tuple[2] + ")", + // n.b. no spaces b/c of multiple support + bypass: propIsBypass + }; + } else if (type3.regex || type3.regexes) { + if (type3.enums) { + var enumProp = checkEnums(); + if (enumProp) { + return enumProp; + } + } + var regexes = type3.regexes ? type3.regexes : [type3.regex]; + for (var _i3 = 0; _i3 < regexes.length; _i3++) { + var regex2 = new RegExp(regexes[_i3]); + var m3 = regex2.exec(value2); + if (m3) { + return { + name, + value: type3.singleRegexMatchValue ? m3[1] : m3, + strValue: "" + value2, + bypass: propIsBypass + }; + } + } + return null; + } else if (type3.string) { + return { + name, + value: "" + value2, + strValue: "" + value2, + bypass: propIsBypass + }; + } else if (type3.enums) { + return checkEnums(); + } else { + return null; + } + }; + _Style = /* @__PURE__ */ __name(function Style2(cy) { + if (!(this instanceof _Style)) { + return new _Style(cy); + } + if (!core2(cy)) { + error("A style must have a core reference"); + return; + } + this._private = { + cy, + coreStyle: {} + }; + this.length = 0; + this.resetToDefault(); + }, "Style"); + styfn = _Style.prototype; + styfn.instanceString = function() { + return "style"; + }; + styfn.clear = function() { + var _p = this._private; + var cy = _p.cy; + var eles = cy.elements(); + for (var i2 = 0; i2 < this.length; i2++) { + this[i2] = void 0; + } + this.length = 0; + _p.contextStyles = {}; + _p.propDiffs = {}; + this.cleanElements(eles, true); + eles.forEach(function(ele) { + var ele_p = ele[0]._private; + ele_p.styleDirty = true; + ele_p.appliedInitStyle = false; + }); + return this; + }; + styfn.resetToDefault = function() { + this.clear(); + this.addDefaultStylesheet(); + return this; + }; + styfn.core = function(propName) { + return this._private.coreStyle[propName] || this.getDefaultProperty(propName); + }; + styfn.selector = function(selectorStr) { + var selector = selectorStr === "core" ? null : new Selector(selectorStr); + var i2 = this.length++; + this[i2] = { + selector, + properties: [], + mappedProperties: [], + index: i2 + }; + return this; + }; + styfn.css = function() { + var self2 = this; + var args = arguments; + if (args.length === 1) { + var map6 = args[0]; + for (var i2 = 0; i2 < self2.properties.length; i2++) { + var prop = self2.properties[i2]; + var mapVal = map6[prop.name]; + if (mapVal === void 0) { + mapVal = map6[dash2camel(prop.name)]; + } + if (mapVal !== void 0) { + this.cssRule(prop.name, mapVal); + } + } + } else if (args.length === 2) { + this.cssRule(args[0], args[1]); + } + return this; + }; + styfn.style = styfn.css; + styfn.cssRule = function(name, value2) { + var property3 = this.parse(name, value2); + if (property3) { + var i2 = this.length - 1; + this[i2].properties.push(property3); + this[i2].properties[property3.name] = property3; + if (property3.name.match(/pie-(\d+)-background-size/) && property3.value) { + this._private.hasPie = true; + } + if (property3.name.match(/stripe-(\d+)-background-size/) && property3.value) { + this._private.hasStripe = true; + } + if (property3.mapped) { + this[i2].mappedProperties.push(property3); + } + var currentSelectorIsCore = !this[i2].selector; + if (currentSelectorIsCore) { + this._private.coreStyle[property3.name] = property3; + } + } + return this; + }; + styfn.append = function(style3) { + if (stylesheet(style3)) { + style3.appendToStyle(this); + } else if (array2(style3)) { + this.appendFromJson(style3); + } else if (string(style3)) { + this.appendFromString(style3); + } + return this; + }; + _Style.fromJson = function(cy, json3) { + var style3 = new _Style(cy); + style3.fromJson(json3); + return style3; + }; + _Style.fromString = function(cy, string3) { + return new _Style(cy).fromString(string3); + }; + [styfn$8, styfn$7, styfn$6, styfn$5, styfn$4, styfn$3, styfn$2, styfn$1].forEach(function(props) { + extend4(styfn, props); + }); + _Style.types = styfn.types; + _Style.properties = styfn.properties; + _Style.propertyGroups = styfn.propertyGroups; + _Style.propertyGroupNames = styfn.propertyGroupNames; + _Style.propertyGroupKeys = styfn.propertyGroupKeys; + corefn$2 = { + style: /* @__PURE__ */ __name(function style2(newStyle) { + if (newStyle) { + var s2 = this.setStyle(newStyle); + s2.update(); + } + return this._private.style; + }, "style"), + setStyle: /* @__PURE__ */ __name(function setStyle(style3) { + var _p = this._private; + if (stylesheet(style3)) { + _p.style = style3.generateStyle(this); + } else if (array2(style3)) { + _p.style = _Style.fromJson(this, style3); + } else if (string(style3)) { + _p.style = _Style.fromString(this, style3); + } else { + _p.style = _Style(this); + } + return _p.style; + }, "setStyle"), + // e.g. cy.data() changed => recalc ele mappers + updateStyle: /* @__PURE__ */ __name(function updateStyle2() { + this.mutableElements().updateStyle(); + }, "updateStyle") + }; + defaultSelectionType = "single"; + corefn$1 = { + autolock: /* @__PURE__ */ __name(function autolock(bool2) { + if (bool2 !== void 0) { + this._private.autolock = bool2 ? true : false; + } else { + return this._private.autolock; + } + return this; + }, "autolock"), + autoungrabify: /* @__PURE__ */ __name(function autoungrabify(bool2) { + if (bool2 !== void 0) { + this._private.autoungrabify = bool2 ? true : false; + } else { + return this._private.autoungrabify; + } + return this; + }, "autoungrabify"), + autounselectify: /* @__PURE__ */ __name(function autounselectify(bool2) { + if (bool2 !== void 0) { + this._private.autounselectify = bool2 ? true : false; + } else { + return this._private.autounselectify; + } + return this; + }, "autounselectify"), + selectionType: /* @__PURE__ */ __name(function selectionType(selType) { + var _p = this._private; + if (_p.selectionType == null) { + _p.selectionType = defaultSelectionType; + } + if (selType !== void 0) { + if (selType === "additive" || selType === "single") { + _p.selectionType = selType; + } + } else { + return _p.selectionType; + } + return this; + }, "selectionType"), + panningEnabled: /* @__PURE__ */ __name(function panningEnabled(bool2) { + if (bool2 !== void 0) { + this._private.panningEnabled = bool2 ? true : false; + } else { + return this._private.panningEnabled; + } + return this; + }, "panningEnabled"), + userPanningEnabled: /* @__PURE__ */ __name(function userPanningEnabled(bool2) { + if (bool2 !== void 0) { + this._private.userPanningEnabled = bool2 ? true : false; + } else { + return this._private.userPanningEnabled; + } + return this; + }, "userPanningEnabled"), + zoomingEnabled: /* @__PURE__ */ __name(function zoomingEnabled(bool2) { + if (bool2 !== void 0) { + this._private.zoomingEnabled = bool2 ? true : false; + } else { + return this._private.zoomingEnabled; + } + return this; + }, "zoomingEnabled"), + userZoomingEnabled: /* @__PURE__ */ __name(function userZoomingEnabled(bool2) { + if (bool2 !== void 0) { + this._private.userZoomingEnabled = bool2 ? true : false; + } else { + return this._private.userZoomingEnabled; + } + return this; + }, "userZoomingEnabled"), + boxSelectionEnabled: /* @__PURE__ */ __name(function boxSelectionEnabled(bool2) { + if (bool2 !== void 0) { + this._private.boxSelectionEnabled = bool2 ? true : false; + } else { + return this._private.boxSelectionEnabled; + } + return this; + }, "boxSelectionEnabled"), + pan: /* @__PURE__ */ __name(function pan() { + var args = arguments; + var pan2 = this._private.pan; + var dim, val, dims, x5, y6; + switch (args.length) { + case 0: + return pan2; + case 1: + if (string(args[0])) { + dim = args[0]; + return pan2[dim]; + } else if (plainObject(args[0])) { + if (!this._private.panningEnabled) { + return this; + } + dims = args[0]; + x5 = dims.x; + y6 = dims.y; + if (number$1(x5)) { + pan2.x = x5; + } + if (number$1(y6)) { + pan2.y = y6; + } + this.emit("pan viewport"); + } + break; + case 2: + if (!this._private.panningEnabled) { + return this; + } + dim = args[0]; + val = args[1]; + if ((dim === "x" || dim === "y") && number$1(val)) { + pan2[dim] = val; + } + this.emit("pan viewport"); + break; + } + this.notify("viewport"); + return this; + }, "pan"), + panBy: /* @__PURE__ */ __name(function panBy(arg0, arg1) { + var args = arguments; + var pan2 = this._private.pan; + var dim, val, dims, x5, y6; + if (!this._private.panningEnabled) { + return this; + } + switch (args.length) { + case 1: + if (plainObject(arg0)) { + dims = args[0]; + x5 = dims.x; + y6 = dims.y; + if (number$1(x5)) { + pan2.x += x5; + } + if (number$1(y6)) { + pan2.y += y6; + } + this.emit("pan viewport"); + } + break; + case 2: + dim = arg0; + val = arg1; + if ((dim === "x" || dim === "y") && number$1(val)) { + pan2[dim] += val; + } + this.emit("pan viewport"); + break; + } + this.notify("viewport"); + return this; + }, "panBy"), + gc: /* @__PURE__ */ __name(function gc() { + this.notify("gc"); + }, "gc"), + fit: /* @__PURE__ */ __name(function fit(elements2, padding2) { + var viewportState = this.getFitViewport(elements2, padding2); + if (viewportState) { + var _p = this._private; + _p.zoom = viewportState.zoom; + _p.pan = viewportState.pan; + this.emit("pan zoom viewport"); + this.notify("viewport"); + } + return this; + }, "fit"), + getFitViewport: /* @__PURE__ */ __name(function getFitViewport(elements2, padding2) { + if (number$1(elements2) && padding2 === void 0) { + padding2 = elements2; + elements2 = void 0; + } + if (!this._private.panningEnabled || !this._private.zoomingEnabled) { + return; + } + var bb; + if (string(elements2)) { + var sel = elements2; + elements2 = this.$(sel); + } else if (boundingBox(elements2)) { + var bbe = elements2; + bb = { + x1: bbe.x1, + y1: bbe.y1, + x2: bbe.x2, + y2: bbe.y2 + }; + bb.w = bb.x2 - bb.x1; + bb.h = bb.y2 - bb.y1; + } else if (!elementOrCollection(elements2)) { + elements2 = this.mutableElements(); + } + if (elementOrCollection(elements2) && elements2.empty()) { + return; + } + bb = bb || elements2.boundingBox(); + var w4 = this.width(); + var h3 = this.height(); + var zoom2; + padding2 = number$1(padding2) ? padding2 : 0; + if (!isNaN(w4) && !isNaN(h3) && w4 > 0 && h3 > 0 && !isNaN(bb.w) && !isNaN(bb.h) && bb.w > 0 && bb.h > 0) { + zoom2 = Math.min((w4 - 2 * padding2) / bb.w, (h3 - 2 * padding2) / bb.h); + zoom2 = zoom2 > this._private.maxZoom ? this._private.maxZoom : zoom2; + zoom2 = zoom2 < this._private.minZoom ? this._private.minZoom : zoom2; + var pan2 = { + // now pan to middle + x: (w4 - zoom2 * (bb.x1 + bb.x2)) / 2, + y: (h3 - zoom2 * (bb.y1 + bb.y2)) / 2 + }; + return { + zoom: zoom2, + pan: pan2 + }; + } + return; + }, "getFitViewport"), + zoomRange: /* @__PURE__ */ __name(function zoomRange(min10, max10) { + var _p = this._private; + if (max10 == null) { + var opts = min10; + min10 = opts.min; + max10 = opts.max; + } + if (number$1(min10) && number$1(max10) && min10 <= max10) { + _p.minZoom = min10; + _p.maxZoom = max10; + } else if (number$1(min10) && max10 === void 0 && min10 <= _p.maxZoom) { + _p.minZoom = min10; + } else if (number$1(max10) && min10 === void 0 && max10 >= _p.minZoom) { + _p.maxZoom = max10; + } + return this; + }, "zoomRange"), + minZoom: /* @__PURE__ */ __name(function minZoom(zoom2) { + if (zoom2 === void 0) { + return this._private.minZoom; + } else { + return this.zoomRange({ + min: zoom2 + }); + } + }, "minZoom"), + maxZoom: /* @__PURE__ */ __name(function maxZoom(zoom2) { + if (zoom2 === void 0) { + return this._private.maxZoom; + } else { + return this.zoomRange({ + max: zoom2 + }); + } + }, "maxZoom"), + getZoomedViewport: /* @__PURE__ */ __name(function getZoomedViewport(params) { + var _p = this._private; + var currentPan = _p.pan; + var currentZoom = _p.zoom; + var pos; + var zoom2; + var bail = false; + if (!_p.zoomingEnabled) { + bail = true; + } + if (number$1(params)) { + zoom2 = params; + } else if (plainObject(params)) { + zoom2 = params.level; + if (params.position != null) { + pos = modelToRenderedPosition$1(params.position, currentZoom, currentPan); + } else if (params.renderedPosition != null) { + pos = params.renderedPosition; + } + if (pos != null && !_p.panningEnabled) { + bail = true; + } + } + zoom2 = zoom2 > _p.maxZoom ? _p.maxZoom : zoom2; + zoom2 = zoom2 < _p.minZoom ? _p.minZoom : zoom2; + if (bail || !number$1(zoom2) || zoom2 === currentZoom || pos != null && (!number$1(pos.x) || !number$1(pos.y))) { + return null; + } + if (pos != null) { + var pan1 = currentPan; + var zoom1 = currentZoom; + var zoom22 = zoom2; + var pan2 = { + x: -zoom22 / zoom1 * (pos.x - pan1.x) + pos.x, + y: -zoom22 / zoom1 * (pos.y - pan1.y) + pos.y + }; + return { + zoomed: true, + panned: true, + zoom: zoom22, + pan: pan2 + }; + } else { + return { + zoomed: true, + panned: false, + zoom: zoom2, + pan: currentPan + }; + } + }, "getZoomedViewport"), + zoom: /* @__PURE__ */ __name(function zoom(params) { + if (params === void 0) { + return this._private.zoom; + } else { + var vp = this.getZoomedViewport(params); + var _p = this._private; + if (vp == null || !vp.zoomed) { + return this; + } + _p.zoom = vp.zoom; + if (vp.panned) { + _p.pan.x = vp.pan.x; + _p.pan.y = vp.pan.y; + } + this.emit("zoom" + (vp.panned ? " pan" : "") + " viewport"); + this.notify("viewport"); + return this; + } + }, "zoom"), + viewport: /* @__PURE__ */ __name(function viewport(opts) { + var _p = this._private; + var zoomDefd = true; + var panDefd = true; + var events = []; + var zoomFailed = false; + var panFailed = false; + if (!opts) { + return this; + } + if (!number$1(opts.zoom)) { + zoomDefd = false; + } + if (!plainObject(opts.pan)) { + panDefd = false; + } + if (!zoomDefd && !panDefd) { + return this; + } + if (zoomDefd) { + var z3 = opts.zoom; + if (z3 < _p.minZoom || z3 > _p.maxZoom || !_p.zoomingEnabled) { + zoomFailed = true; + } else { + _p.zoom = z3; + events.push("zoom"); + } + } + if (panDefd && (!zoomFailed || !opts.cancelOnFailedZoom) && _p.panningEnabled) { + var p3 = opts.pan; + if (number$1(p3.x)) { + _p.pan.x = p3.x; + panFailed = false; + } + if (number$1(p3.y)) { + _p.pan.y = p3.y; + panFailed = false; + } + if (!panFailed) { + events.push("pan"); + } + } + if (events.length > 0) { + events.push("viewport"); + this.emit(events.join(" ")); + this.notify("viewport"); + } + return this; + }, "viewport"), + center: /* @__PURE__ */ __name(function center2(elements2) { + var pan2 = this.getCenterPan(elements2); + if (pan2) { + this._private.pan = pan2; + this.emit("pan viewport"); + this.notify("viewport"); + } + return this; + }, "center"), + getCenterPan: /* @__PURE__ */ __name(function getCenterPan(elements2, zoom2) { + if (!this._private.panningEnabled) { + return; + } + if (string(elements2)) { + var selector = elements2; + elements2 = this.mutableElements().filter(selector); + } else if (!elementOrCollection(elements2)) { + elements2 = this.mutableElements(); + } + if (elements2.length === 0) { + return; + } + var bb = elements2.boundingBox(); + var w4 = this.width(); + var h3 = this.height(); + zoom2 = zoom2 === void 0 ? this._private.zoom : zoom2; + var pan2 = { + // middle + x: (w4 - zoom2 * (bb.x1 + bb.x2)) / 2, + y: (h3 - zoom2 * (bb.y1 + bb.y2)) / 2 + }; + return pan2; + }, "getCenterPan"), + reset: /* @__PURE__ */ __name(function reset2() { + if (!this._private.panningEnabled || !this._private.zoomingEnabled) { + return this; + } + this.viewport({ + pan: { + x: 0, + y: 0 + }, + zoom: 1 + }); + return this; + }, "reset"), + invalidateSize: /* @__PURE__ */ __name(function invalidateSize() { + this._private.sizeCache = null; + }, "invalidateSize"), + size: /* @__PURE__ */ __name(function size3() { + var _p = this._private; + var container2 = _p.container; + var cy = this; + return _p.sizeCache = _p.sizeCache || (container2 ? (function() { + var style3 = cy.window().getComputedStyle(container2); + var val = /* @__PURE__ */ __name(function val2(name) { + return parseFloat(style3.getPropertyValue(name)); + }, "val"); + return { + width: container2.clientWidth - val("padding-left") - val("padding-right"), + height: container2.clientHeight - val("padding-top") - val("padding-bottom") + }; + })() : { + // fallback if no container (not 0 b/c can be used for dividing etc) + width: 1, + height: 1 + }); + }, "size"), + width: /* @__PURE__ */ __name(function width2() { + return this.size().width; + }, "width"), + height: /* @__PURE__ */ __name(function height() { + return this.size().height; + }, "height"), + extent: /* @__PURE__ */ __name(function extent() { + var pan2 = this._private.pan; + var zoom2 = this._private.zoom; + var rb = this.renderedExtent(); + var b3 = { + x1: (rb.x1 - pan2.x) / zoom2, + x2: (rb.x2 - pan2.x) / zoom2, + y1: (rb.y1 - pan2.y) / zoom2, + y2: (rb.y2 - pan2.y) / zoom2 + }; + b3.w = b3.x2 - b3.x1; + b3.h = b3.y2 - b3.y1; + return b3; + }, "extent"), + renderedExtent: /* @__PURE__ */ __name(function renderedExtent() { + var width3 = this.width(); + var height2 = this.height(); + return { + x1: 0, + y1: 0, + x2: width3, + y2: height2, + w: width3, + h: height2 + }; + }, "renderedExtent"), + multiClickDebounceTime: /* @__PURE__ */ __name(function multiClickDebounceTime(_int) { + if (_int) this._private.multiClickDebounceTime = _int; + else return this._private.multiClickDebounceTime; + return this; + }, "multiClickDebounceTime") + }; + corefn$1.centre = corefn$1.center; + corefn$1.autolockNodes = corefn$1.autolock; + corefn$1.autoungrabifyNodes = corefn$1.autoungrabify; + fn2 = { + data: define2.data({ + field: "data", + bindingEvent: "data", + allowBinding: true, + allowSetting: true, + settingEvent: "data", + settingTriggersEvent: true, + triggerFnName: "trigger", + allowGetting: true, + updateStyle: true + }), + removeData: define2.removeData({ + field: "data", + event: "data", + triggerFnName: "trigger", + triggerEvent: true, + updateStyle: true + }), + scratch: define2.data({ + field: "scratch", + bindingEvent: "scratch", + allowBinding: true, + allowSetting: true, + settingEvent: "scratch", + settingTriggersEvent: true, + triggerFnName: "trigger", + allowGetting: true, + updateStyle: true + }), + removeScratch: define2.removeData({ + field: "scratch", + event: "scratch", + triggerFnName: "trigger", + triggerEvent: true, + updateStyle: true + }) + }; + fn2.attr = fn2.data; + fn2.removeAttr = fn2.removeData; + Core = /* @__PURE__ */ __name(function Core2(opts) { + var cy = this; + opts = extend4({}, opts); + var container2 = opts.container; + if (container2 && !htmlElement(container2) && htmlElement(container2[0])) { + container2 = container2[0]; + } + var reg = container2 ? container2._cyreg : null; + reg = reg || {}; + if (reg && reg.cy) { + reg.cy.destroy(); + reg = {}; + } + var readies = reg.readies = reg.readies || []; + if (container2) { + container2._cyreg = reg; + } + reg.cy = cy; + var head2 = _window !== void 0 && container2 !== void 0 && !opts.headless; + var options2 = opts; + options2.layout = extend4({ + name: head2 ? "grid" : "null" + }, options2.layout); + options2.renderer = extend4({ + name: head2 ? "canvas" : "null" + }, options2.renderer); + var defVal = /* @__PURE__ */ __name(function defVal2(def, val, altVal) { + if (val !== void 0) { + return val; + } else if (altVal !== void 0) { + return altVal; + } else { + return def; + } + }, "defVal"); + var _p = this._private = { + container: container2, + // html dom ele container + ready: false, + // whether ready has been triggered + options: options2, + // cached options + elements: new Collection(this), + // elements in the graph + listeners: [], + // list of listeners + aniEles: new Collection(this), + // elements being animated + data: options2.data || {}, + // data for the core + scratch: {}, + // scratch object for core + layout: null, + renderer: null, + destroyed: false, + // whether destroy was called + notificationsEnabled: true, + // whether notifications are sent to the renderer + minZoom: 1e-50, + maxZoom: 1e50, + zoomingEnabled: defVal(true, options2.zoomingEnabled), + userZoomingEnabled: defVal(true, options2.userZoomingEnabled), + panningEnabled: defVal(true, options2.panningEnabled), + userPanningEnabled: defVal(true, options2.userPanningEnabled), + boxSelectionEnabled: defVal(true, options2.boxSelectionEnabled), + autolock: defVal(false, options2.autolock, options2.autolockNodes), + autoungrabify: defVal(false, options2.autoungrabify, options2.autoungrabifyNodes), + autounselectify: defVal(false, options2.autounselectify), + styleEnabled: options2.styleEnabled === void 0 ? head2 : options2.styleEnabled, + zoom: number$1(options2.zoom) ? options2.zoom : 1, + pan: { + x: plainObject(options2.pan) && number$1(options2.pan.x) ? options2.pan.x : 0, + y: plainObject(options2.pan) && number$1(options2.pan.y) ? options2.pan.y : 0 + }, + animation: { + // object for currently-running animations + current: [], + queue: [] + }, + hasCompoundNodes: false, + multiClickDebounceTime: defVal(250, options2.multiClickDebounceTime) + }; + this.createEmitter(); + this.selectionType(options2.selectionType); + this.zoomRange({ + min: options2.minZoom, + max: options2.maxZoom + }); + var loadExtData = /* @__PURE__ */ __name(function loadExtData2(extData, next3) { + var anyIsPromise = extData.some(promise); + if (anyIsPromise) { + return Promise$1.all(extData).then(next3); + } else { + next3(extData); + } + }, "loadExtData"); + if (_p.styleEnabled) { + cy.setStyle([]); + } + var rendererOptions = extend4({}, options2, options2.renderer); + cy.initRenderer(rendererOptions); + var setElesAndLayout = /* @__PURE__ */ __name(function setElesAndLayout2(elements2, onload, ondone) { + cy.notifications(false); + var oldEles = cy.mutableElements(); + if (oldEles.length > 0) { + oldEles.remove(); + } + if (elements2 != null) { + if (plainObject(elements2) || array2(elements2)) { + cy.add(elements2); + } + } + cy.one("layoutready", function(e3) { + cy.notifications(true); + cy.emit(e3); + cy.one("load", onload); + cy.emitAndNotify("load"); + }).one("layoutstop", function() { + cy.one("done", ondone); + cy.emit("done"); + }); + var layoutOpts = extend4({}, cy._private.options.layout); + layoutOpts.eles = cy.elements(); + cy.layout(layoutOpts).run(); + }, "setElesAndLayout"); + loadExtData([options2.style, options2.elements], function(thens) { + var initStyle = thens[0]; + var initEles = thens[1]; + if (_p.styleEnabled) { + cy.style().append(initStyle); + } + setElesAndLayout(initEles, function() { + cy.startAnimationLoop(); + _p.ready = true; + if (fn$6(options2.ready)) { + cy.on("ready", options2.ready); + } + for (var i2 = 0; i2 < readies.length; i2++) { + var fn3 = readies[i2]; + cy.on("ready", fn3); + } + if (reg) { + reg.readies = []; + } + cy.emit("ready"); + }, options2.done); + }); + }, "Core"); + corefn = Core.prototype; + extend4(corefn, { + instanceString: /* @__PURE__ */ __name(function instanceString3() { + return "core"; + }, "instanceString"), + isReady: /* @__PURE__ */ __name(function isReady() { + return this._private.ready; + }, "isReady"), + destroyed: /* @__PURE__ */ __name(function destroyed() { + return this._private.destroyed; + }, "destroyed"), + ready: /* @__PURE__ */ __name(function ready(fn3) { + if (this.isReady()) { + this.emitter().emit("ready", [], fn3); + } else { + this.on("ready", fn3); + } + return this; + }, "ready"), + destroy: /* @__PURE__ */ __name(function destroy() { + var cy = this; + if (cy.destroyed()) return; + cy.stopAnimationLoop(); + cy.destroyRenderer(); + this.emit("destroy"); + cy._private.destroyed = true; + return cy; + }, "destroy"), + hasElementWithId: /* @__PURE__ */ __name(function hasElementWithId(id35) { + return this._private.elements.hasElementWithId(id35); + }, "hasElementWithId"), + getElementById: /* @__PURE__ */ __name(function getElementById(id35) { + return this._private.elements.getElementById(id35); + }, "getElementById"), + hasCompoundNodes: /* @__PURE__ */ __name(function hasCompoundNodes() { + return this._private.hasCompoundNodes; + }, "hasCompoundNodes"), + headless: /* @__PURE__ */ __name(function headless() { + return this._private.renderer.isHeadless(); + }, "headless"), + styleEnabled: /* @__PURE__ */ __name(function styleEnabled() { + return this._private.styleEnabled; + }, "styleEnabled"), + addToPool: /* @__PURE__ */ __name(function addToPool(eles) { + this._private.elements.merge(eles); + return this; + }, "addToPool"), + removeFromPool: /* @__PURE__ */ __name(function removeFromPool(eles) { + this._private.elements.unmerge(eles); + return this; + }, "removeFromPool"), + container: /* @__PURE__ */ __name(function container() { + return this._private.container || null; + }, "container"), + window: /* @__PURE__ */ __name(function window2() { + var container2 = this._private.container; + if (container2 == null) return _window; + var ownerDocument = this._private.container.ownerDocument; + if (ownerDocument === void 0 || ownerDocument == null) { + return _window; + } + return ownerDocument.defaultView || _window; + }, "window"), + mount: /* @__PURE__ */ __name(function mount(container2) { + if (container2 == null) { + return; + } + var cy = this; + var _p = cy._private; + var options2 = _p.options; + if (!htmlElement(container2) && htmlElement(container2[0])) { + container2 = container2[0]; + } + cy.stopAnimationLoop(); + cy.destroyRenderer(); + _p.container = container2; + _p.styleEnabled = true; + cy.invalidateSize(); + cy.initRenderer(extend4({}, options2, options2.renderer, { + // allow custom renderer name to be re-used, otherwise use canvas + name: options2.renderer.name === "null" ? "canvas" : options2.renderer.name + })); + cy.startAnimationLoop(); + cy.style(options2.style); + cy.emit("mount"); + return cy; + }, "mount"), + unmount: /* @__PURE__ */ __name(function unmount() { + var cy = this; + cy.stopAnimationLoop(); + cy.destroyRenderer(); + cy.initRenderer({ + name: "null" + }); + cy.emit("unmount"); + return cy; + }, "unmount"), + options: /* @__PURE__ */ __name(function options() { + return copy3(this._private.options); + }, "options"), + json: /* @__PURE__ */ __name(function json2(obj) { + var cy = this; + var _p = cy._private; + var eles = cy.mutableElements(); + var getFreshRef = /* @__PURE__ */ __name(function getFreshRef2(ele) { + return cy.getElementById(ele.id()); + }, "getFreshRef"); + if (plainObject(obj)) { + cy.startBatch(); + if (obj.elements) { + var idInJson = {}; + var updateEles = /* @__PURE__ */ __name(function updateEles2(jsons, gr2) { + var toAdd = []; + var toMod = []; + for (var i3 = 0; i3 < jsons.length; i3++) { + var json4 = jsons[i3]; + if (!json4.data.id) { + warn("cy.json() cannot handle elements without an ID attribute"); + continue; + } + var id35 = "" + json4.data.id; + var ele = cy.getElementById(id35); + idInJson[id35] = true; + if (ele.length !== 0) { + toMod.push({ + ele, + json: json4 + }); + } else { + if (gr2) { + json4.group = gr2; + toAdd.push(json4); + } else { + toAdd.push(json4); + } + } + } + cy.add(toAdd); + for (var _i = 0; _i < toMod.length; _i++) { + var _toMod$_i = toMod[_i], _ele = _toMod$_i.ele, _json = _toMod$_i.json; + _ele.json(_json); + } + }, "updateEles"); + if (array2(obj.elements)) { + updateEles(obj.elements); + } else { + var grs = ["nodes", "edges"]; + for (var i2 = 0; i2 < grs.length; i2++) { + var gr = grs[i2]; + var elements2 = obj.elements[gr]; + if (array2(elements2)) { + updateEles(elements2, gr); + } + } + } + var parentsToRemove = cy.collection(); + eles.filter(function(ele) { + return !idInJson[ele.id()]; + }).forEach(function(ele) { + if (ele.isParent()) { + parentsToRemove.merge(ele); + } else { + ele.remove(); + } + }); + parentsToRemove.forEach(function(ele) { + return ele.children().move({ + parent: null + }); + }); + parentsToRemove.forEach(function(ele) { + return getFreshRef(ele).remove(); + }); + } + if (obj.style) { + cy.style(obj.style); + } + if (obj.zoom != null && obj.zoom !== _p.zoom) { + cy.zoom(obj.zoom); + } + if (obj.pan) { + if (obj.pan.x !== _p.pan.x || obj.pan.y !== _p.pan.y) { + cy.pan(obj.pan); + } + } + if (obj.data) { + cy.data(obj.data); + } + var fields = ["minZoom", "maxZoom", "zoomingEnabled", "userZoomingEnabled", "panningEnabled", "userPanningEnabled", "boxSelectionEnabled", "autolock", "autoungrabify", "autounselectify", "multiClickDebounceTime"]; + for (var _i2 = 0; _i2 < fields.length; _i2++) { + var f2 = fields[_i2]; + if (obj[f2] != null) { + cy[f2](obj[f2]); + } + } + cy.endBatch(); + return this; + } else { + var flat = !!obj; + var json3 = {}; + if (flat) { + json3.elements = this.elements().map(function(ele) { + return ele.json(); + }); + } else { + json3.elements = {}; + eles.forEach(function(ele) { + var group2 = ele.group(); + if (!json3.elements[group2]) { + json3.elements[group2] = []; + } + json3.elements[group2].push(ele.json()); + }); + } + if (this._private.styleEnabled) { + json3.style = cy.style().json(); + } + json3.data = copy3(cy.data()); + var options2 = _p.options; + json3.zoomingEnabled = _p.zoomingEnabled; + json3.userZoomingEnabled = _p.userZoomingEnabled; + json3.zoom = _p.zoom; + json3.minZoom = _p.minZoom; + json3.maxZoom = _p.maxZoom; + json3.panningEnabled = _p.panningEnabled; + json3.userPanningEnabled = _p.userPanningEnabled; + json3.pan = copy3(_p.pan); + json3.boxSelectionEnabled = _p.boxSelectionEnabled; + json3.renderer = copy3(options2.renderer); + json3.hideEdgesOnViewport = options2.hideEdgesOnViewport; + json3.textureOnViewport = options2.textureOnViewport; + json3.wheelSensitivity = options2.wheelSensitivity; + json3.motionBlur = options2.motionBlur; + json3.multiClickDebounceTime = options2.multiClickDebounceTime; + return json3; + } + }, "json") + }); + corefn.$id = corefn.getElementById; + [corefn$9, corefn$8, elesfn, corefn$7, corefn$6, corefn$5, corefn$4, corefn$3, corefn$2, corefn$1, fn2].forEach(function(props) { + extend4(corefn, props); + }); + defaults$7 = { + fit: true, + // whether to fit the viewport to the graph + directed: false, + // whether the tree is directed downwards (or edges can point in any direction if false) + direction: "downward", + // determines the direction in which the tree structure is drawn. The possible values are 'downward', 'upward', 'rightward', or 'leftward'. + padding: 30, + // padding on fit + circle: false, + // put depths in concentric circles if true, put depths top down if false + grid: false, + // whether to create an even grid into which the DAG is placed (circle:false only) + spacingFactor: 1.75, + // positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap) + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox if not enough space + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + roots: void 0, + // the roots of the trees + depthSort: void 0, + // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled, + animateFilter: /* @__PURE__ */ __name(function animateFilter(node2, i2) { + return true; + }, "animateFilter"), + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: /* @__PURE__ */ __name(function transform2(node2, position5) { + return position5; + }, "transform") + // transform a given node position. Useful for changing flow direction in discrete layouts + }; + deprecatedOptionDefaults = { + maximal: false, + // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only); setting acyclic to true sets maximal to true also + acyclic: false + // whether the tree is acyclic and thus a node could be shifted (due to the maximal option) multiple times without causing an infinite loop; setting to true sets maximal to true also; if you are uncertain whether a tree is acyclic, set to false to avoid potential infinite loops + }; + getInfo = /* @__PURE__ */ __name(function getInfo2(ele) { + return ele.scratch("breadthfirst"); + }, "getInfo"); + setInfo = /* @__PURE__ */ __name(function setInfo2(ele, obj) { + return ele.scratch("breadthfirst", obj); + }, "setInfo"); + __name(BreadthFirstLayout, "BreadthFirstLayout"); + BreadthFirstLayout.prototype.run = function() { + var options2 = this.options; + var cy = options2.cy; + var eles = options2.eles; + var nodes5 = eles.nodes().filter(function(n3) { + return n3.isChildless(); + }); + var graph = eles; + var directed = options2.directed; + var maximal = options2.acyclic || options2.maximal || options2.maximalAdjustments > 0; + var hasBoundingBox = !!options2.boundingBox; + var bb = makeBoundingBox(hasBoundingBox ? options2.boundingBox : structuredClone(cy.extent())); + var roots; + if (elementOrCollection(options2.roots)) { + roots = options2.roots; + } else if (array2(options2.roots)) { + var rootsArray = []; + for (var i2 = 0; i2 < options2.roots.length; i2++) { + var id35 = options2.roots[i2]; + var ele = cy.getElementById(id35); + rootsArray.push(ele); + } + roots = cy.collection(rootsArray); + } else if (string(options2.roots)) { + roots = cy.$(options2.roots); + } else { + if (directed) { + roots = nodes5.roots(); + } else { + var components3 = eles.components(); + roots = cy.collection(); + var _loop = /* @__PURE__ */ __name(function _loop2() { + var comp = components3[_i]; + var maxDegree = comp.maxDegree(false); + var compRoots = comp.filter(function(ele2) { + return ele2.degree(false) === maxDegree; + }); + roots = roots.add(compRoots); + }, "_loop"); + for (var _i = 0; _i < components3.length; _i++) { + _loop(); + } + } + } + var depths = []; + var foundByBfs = {}; + var addToDepth = /* @__PURE__ */ __name(function addToDepth2(ele2, d3) { + if (depths[d3] == null) { + depths[d3] = []; + } + var i3 = depths[d3].length; + depths[d3].push(ele2); + setInfo(ele2, { + index: i3, + depth: d3 + }); + }, "addToDepth"); + var changeDepth = /* @__PURE__ */ __name(function changeDepth2(ele2, newDepth) { + var _getInfo = getInfo(ele2), depth = _getInfo.depth, index = _getInfo.index; + depths[depth][index] = null; + if (ele2.isChildless()) addToDepth(ele2, newDepth); + }, "changeDepth"); + graph.bfs({ + roots, + directed: options2.directed, + visit: /* @__PURE__ */ __name(function visit(node2, edge, pNode, i3, depth) { + var ele2 = node2[0]; + var id36 = ele2.id(); + if (ele2.isChildless()) addToDepth(ele2, depth); + foundByBfs[id36] = true; + }, "visit") + }); + var orphanNodes = []; + for (var _i2 = 0; _i2 < nodes5.length; _i2++) { + var _ele = nodes5[_i2]; + if (foundByBfs[_ele.id()]) { + continue; + } else { + orphanNodes.push(_ele); + } + } + var assignDepthsAt = /* @__PURE__ */ __name(function assignDepthsAt2(i3) { + var eles2 = depths[i3]; + for (var j3 = 0; j3 < eles2.length; j3++) { + var _ele2 = eles2[j3]; + if (_ele2 == null) { + eles2.splice(j3, 1); + j3--; + continue; + } + setInfo(_ele2, { + depth: i3, + index: j3 + }); + } + }, "assignDepthsAt"); + var adjustMaximally = /* @__PURE__ */ __name(function adjustMaximally2(ele2, shifted2) { + var eInfo = getInfo(ele2); + var incomers = ele2.incomers().filter(function(el) { + return el.isNode() && eles.has(el); + }); + var maxDepth = -1; + var id36 = ele2.id(); + for (var k2 = 0; k2 < incomers.length; k2++) { + var incmr = incomers[k2]; + var iInfo = getInfo(incmr); + maxDepth = Math.max(maxDepth, iInfo.depth); + } + if (eInfo.depth <= maxDepth) { + if (!options2.acyclic && shifted2[id36]) { + return null; + } + var newDepth = maxDepth + 1; + changeDepth(ele2, newDepth); + shifted2[id36] = newDepth; + return true; + } + return false; + }, "adjustMaximally"); + if (directed && maximal) { + var Q3 = []; + var shifted = {}; + var enqueue = /* @__PURE__ */ __name(function enqueue2(n3) { + return Q3.push(n3); + }, "enqueue"); + var dequeue = /* @__PURE__ */ __name(function dequeue2() { + return Q3.shift(); + }, "dequeue"); + nodes5.forEach(function(n3) { + return Q3.push(n3); + }); + while (Q3.length > 0) { + var _ele3 = dequeue(); + var didShift = adjustMaximally(_ele3, shifted); + if (didShift) { + _ele3.outgoers().filter(function(el) { + return el.isNode() && eles.has(el); + }).forEach(enqueue); + } else if (didShift === null) { + warn("Detected double maximal shift for node `" + _ele3.id() + "`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs."); + break; + } + } + } + var minDistance = 0; + if (options2.avoidOverlap) { + for (var _i3 = 0; _i3 < nodes5.length; _i3++) { + var n2 = nodes5[_i3]; + var nbb = n2.layoutDimensions(options2); + var w4 = nbb.w; + var h3 = nbb.h; + minDistance = Math.max(minDistance, w4, h3); + } + } + var cachedWeightedPercent = {}; + var getWeightedPercent = /* @__PURE__ */ __name(function getWeightedPercent2(ele2) { + if (cachedWeightedPercent[ele2.id()]) { + return cachedWeightedPercent[ele2.id()]; + } + var eleDepth = getInfo(ele2).depth; + var neighbors = ele2.neighborhood(); + var percent = 0; + var samples = 0; + for (var _i4 = 0; _i4 < neighbors.length; _i4++) { + var neighbor = neighbors[_i4]; + if (neighbor.isEdge() || neighbor.isParent() || !nodes5.has(neighbor)) { + continue; + } + var bf = getInfo(neighbor); + if (bf == null) { + continue; + } + var index = bf.index; + var depth = bf.depth; + if (index == null || depth == null) { + continue; + } + var nDepth = depths[depth].length; + if (depth < eleDepth) { + percent += index / nDepth; + samples++; + } + } + samples = Math.max(1, samples); + percent = percent / samples; + if (samples === 0) { + percent = 0; + } + cachedWeightedPercent[ele2.id()] = percent; + return percent; + }, "getWeightedPercent"); + var sortFn = /* @__PURE__ */ __name(function sortFn2(a2, b3) { + var apct = getWeightedPercent(a2); + var bpct = getWeightedPercent(b3); + var diff2 = apct - bpct; + if (diff2 === 0) { + return ascending3(a2.id(), b3.id()); + } else { + return diff2; + } + }, "sortFn"); + if (options2.depthSort !== void 0) { + sortFn = options2.depthSort; + } + var depthsLen = depths.length; + for (var _i5 = 0; _i5 < depthsLen; _i5++) { + depths[_i5].sort(sortFn); + assignDepthsAt(_i5); + } + var orphanDepth = []; + for (var _i6 = 0; _i6 < orphanNodes.length; _i6++) { + orphanDepth.push(orphanNodes[_i6]); + } + var assignDepths = /* @__PURE__ */ __name(function assignDepths2() { + for (var _i7 = 0; _i7 < depthsLen; _i7++) { + assignDepthsAt(_i7); + } + }, "assignDepths"); + if (orphanDepth.length) { + depths.unshift(orphanDepth); + depthsLen = depths.length; + assignDepths(); + } + var biggestDepthSize = 0; + for (var _i8 = 0; _i8 < depthsLen; _i8++) { + biggestDepthSize = Math.max(depths[_i8].length, biggestDepthSize); + } + var center4 = { + x: bb.x1 + bb.w / 2, + y: bb.y1 + bb.h / 2 + }; + var aveNodeSize = nodes5.reduce(function(acc, node2) { + return (function(box) { + return { + w: acc.w === -1 ? box.w : (acc.w + box.w) / 2, + h: acc.h === -1 ? box.h : (acc.h + box.h) / 2 + }; + })(node2.boundingBox({ + includeLabels: options2.nodeDimensionsIncludeLabels + })); + }, { + w: -1, + h: -1 + }); + var distanceY = Math.max( + // only one depth + depthsLen === 1 ? 0 : ( + // inside a bounding box, no need for top & bottom padding + hasBoundingBox ? (bb.h - options2.padding * 2 - aveNodeSize.h) / (depthsLen - 1) : (bb.h - options2.padding * 2 - aveNodeSize.h) / (depthsLen + 1) + ), + minDistance + ); + var maxDepthSize = depths.reduce(function(max10, eles2) { + return Math.max(max10, eles2.length); + }, 0); + var getPositionTopBottom = /* @__PURE__ */ __name(function getPositionTopBottom2(ele2) { + var _getInfo2 = getInfo(ele2), depth = _getInfo2.depth, index = _getInfo2.index; + if (options2.circle) { + var radiusStepSize = Math.min(bb.w / 2 / depthsLen, bb.h / 2 / depthsLen); + radiusStepSize = Math.max(radiusStepSize, minDistance); + var radius2 = radiusStepSize * depth + radiusStepSize - (depthsLen > 0 && depths[0].length <= 3 ? radiusStepSize / 2 : 0); + var theta = 2 * Math.PI / depths[depth].length * index; + if (depth === 0 && depths[0].length === 1) { + radius2 = 1; + } + return { + x: center4.x + radius2 * Math.cos(theta), + y: center4.y + radius2 * Math.sin(theta) + }; + } else { + var depthSize = depths[depth].length; + var distanceX = Math.max( + // only one depth + depthSize === 1 ? 0 : ( + // inside a bounding box, no need for left & right padding + hasBoundingBox ? (bb.w - options2.padding * 2 - aveNodeSize.w) / ((options2.grid ? maxDepthSize : depthSize) - 1) : (bb.w - options2.padding * 2 - aveNodeSize.w) / ((options2.grid ? maxDepthSize : depthSize) + 1) + ), + minDistance + ); + var epos = { + x: center4.x + (index + 1 - (depthSize + 1) / 2) * distanceX, + y: center4.y + (depth + 1 - (depthsLen + 1) / 2) * distanceY + }; + return epos; + } + }, "getPositionTopBottom"); + var rotateDegrees = { + "downward": 0, + "leftward": 90, + "upward": 180, + "rightward": -90 + }; + if (Object.keys(rotateDegrees).indexOf(options2.direction) === -1) { + error("Invalid direction '".concat(options2.direction, "' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(rotateDegrees).join(", "))); + } + var getPosition = /* @__PURE__ */ __name(function getPosition2(ele2) { + return rotatePosAndSkewByBox(getPositionTopBottom(ele2), bb, rotateDegrees[options2.direction]); + }, "getPosition"); + eles.nodes().layoutPositions(this, options2, getPosition); + return this; + }; + defaults$6 = { + fit: true, + // whether to fit the viewport to the graph + padding: 30, + // the padding on fit + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox and radius if not enough space + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + spacingFactor: void 0, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + radius: void 0, + // the radius of the circle + startAngle: 3 / 2 * Math.PI, + // where nodes start in radians + sweep: void 0, + // how many radians should be between the first and last node (defaults to full circle) + clockwise: true, + // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) + sort: void 0, + // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: /* @__PURE__ */ __name(function animateFilter2(node2, i2) { + return true; + }, "animateFilter"), + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: /* @__PURE__ */ __name(function transform3(node2, position5) { + return position5; + }, "transform") + // transform a given node position. Useful for changing flow direction in discrete layouts + }; + __name(CircleLayout, "CircleLayout"); + CircleLayout.prototype.run = function() { + var params = this.options; + var options2 = params; + var cy = params.cy; + var eles = options2.eles; + var clockwise = options2.counterclockwise !== void 0 ? !options2.counterclockwise : options2.clockwise; + var nodes5 = eles.nodes().not(":parent"); + if (options2.sort) { + nodes5 = nodes5.sort(options2.sort); + } + var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var center4 = { + x: bb.x1 + bb.w / 2, + y: bb.y1 + bb.h / 2 + }; + var sweep = options2.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / nodes5.length : options2.sweep; + var dTheta = sweep / Math.max(1, nodes5.length - 1); + var r2; + var minDistance = 0; + for (var i2 = 0; i2 < nodes5.length; i2++) { + var n2 = nodes5[i2]; + var nbb = n2.layoutDimensions(options2); + var w4 = nbb.w; + var h3 = nbb.h; + minDistance = Math.max(minDistance, w4, h3); + } + if (number$1(options2.radius)) { + r2 = options2.radius; + } else if (nodes5.length <= 1) { + r2 = 0; + } else { + r2 = Math.min(bb.h, bb.w) / 2 - minDistance; + } + if (nodes5.length > 1 && options2.avoidOverlap) { + minDistance *= 1.75; + var dcos = Math.cos(dTheta) - Math.cos(0); + var dsin = Math.sin(dTheta) - Math.sin(0); + var rMin = Math.sqrt(minDistance * minDistance / (dcos * dcos + dsin * dsin)); + r2 = Math.max(rMin, r2); + } + var getPos = /* @__PURE__ */ __name(function getPos2(ele, i3) { + var theta = options2.startAngle + i3 * dTheta * (clockwise ? 1 : -1); + var rx = r2 * Math.cos(theta); + var ry = r2 * Math.sin(theta); + var pos = { + x: center4.x + rx, + y: center4.y + ry + }; + return pos; + }, "getPos"); + eles.nodes().layoutPositions(this, options2, getPos); + return this; + }; + defaults$5 = { + fit: true, + // whether to fit the viewport to the graph + padding: 30, + // the padding on fit + startAngle: 3 / 2 * Math.PI, + // where nodes start in radians + sweep: void 0, + // how many radians should be between the first and last node (defaults to full circle) + clockwise: true, + // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) + equidistant: false, + // whether levels have an equal radial distance betwen them, may cause bounding box overflow + minNodeSpacing: 10, + // min spacing between outside of nodes (used for radius adjustment) + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox if not enough space + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + height: void 0, + // height of layout area (overrides container height) + width: void 0, + // width of layout area (overrides container width) + spacingFactor: void 0, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + concentric: /* @__PURE__ */ __name(function concentric(node2) { + return node2.degree(); + }, "concentric"), + levelWidth: /* @__PURE__ */ __name(function levelWidth(nodes5) { + return nodes5.maxDegree() / 4; + }, "levelWidth"), + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: /* @__PURE__ */ __name(function animateFilter3(node2, i2) { + return true; + }, "animateFilter"), + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: /* @__PURE__ */ __name(function transform4(node2, position5) { + return position5; + }, "transform") + // transform a given node position. Useful for changing flow direction in discrete layouts + }; + __name(ConcentricLayout, "ConcentricLayout"); + ConcentricLayout.prototype.run = function() { + var params = this.options; + var options2 = params; + var clockwise = options2.counterclockwise !== void 0 ? !options2.counterclockwise : options2.clockwise; + var cy = params.cy; + var eles = options2.eles; + var nodes5 = eles.nodes().not(":parent"); + var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var center4 = { + x: bb.x1 + bb.w / 2, + y: bb.y1 + bb.h / 2 + }; + var nodeValues = []; + var maxNodeSize = 0; + for (var i2 = 0; i2 < nodes5.length; i2++) { + var node2 = nodes5[i2]; + var value2 = void 0; + value2 = options2.concentric(node2); + nodeValues.push({ + value: value2, + node: node2 + }); + node2._private.scratch.concentric = value2; + } + nodes5.updateStyle(); + for (var _i = 0; _i < nodes5.length; _i++) { + var _node = nodes5[_i]; + var nbb = _node.layoutDimensions(options2); + maxNodeSize = Math.max(maxNodeSize, nbb.w, nbb.h); + } + nodeValues.sort(function(a2, b3) { + return b3.value - a2.value; + }); + var levelWidth2 = options2.levelWidth(nodes5); + var levels = [[]]; + var currentLevel = levels[0]; + for (var _i2 = 0; _i2 < nodeValues.length; _i2++) { + var val = nodeValues[_i2]; + if (currentLevel.length > 0) { + var diff2 = Math.abs(currentLevel[0].value - val.value); + if (diff2 >= levelWidth2) { + currentLevel = []; + levels.push(currentLevel); + } + } + currentLevel.push(val); + } + var minDist = maxNodeSize + options2.minNodeSpacing; + if (!options2.avoidOverlap) { + var firstLvlHasMulti = levels.length > 0 && levels[0].length > 1; + var maxR = Math.min(bb.w, bb.h) / 2 - minDist; + var rStep = maxR / (levels.length + firstLvlHasMulti ? 1 : 0); + minDist = Math.min(minDist, rStep); + } + var r2 = 0; + for (var _i3 = 0; _i3 < levels.length; _i3++) { + var level = levels[_i3]; + var sweep = options2.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / level.length : options2.sweep; + var dTheta = level.dTheta = sweep / Math.max(1, level.length - 1); + if (level.length > 1 && options2.avoidOverlap) { + var dcos = Math.cos(dTheta) - Math.cos(0); + var dsin = Math.sin(dTheta) - Math.sin(0); + var rMin = Math.sqrt(minDist * minDist / (dcos * dcos + dsin * dsin)); + r2 = Math.max(rMin, r2); + } + level.r = r2; + r2 += minDist; + } + if (options2.equidistant) { + var rDeltaMax = 0; + var _r = 0; + for (var _i4 = 0; _i4 < levels.length; _i4++) { + var _level = levels[_i4]; + var rDelta = _level.r - _r; + rDeltaMax = Math.max(rDeltaMax, rDelta); + } + _r = 0; + for (var _i5 = 0; _i5 < levels.length; _i5++) { + var _level2 = levels[_i5]; + if (_i5 === 0) { + _r = _level2.r; + } + _level2.r = _r; + _r += rDeltaMax; + } + } + var pos = {}; + for (var _i6 = 0; _i6 < levels.length; _i6++) { + var _level3 = levels[_i6]; + var _dTheta = _level3.dTheta; + var _r2 = _level3.r; + for (var j3 = 0; j3 < _level3.length; j3++) { + var _val = _level3[j3]; + var theta = options2.startAngle + (clockwise ? 1 : -1) * _dTheta * j3; + var p3 = { + x: center4.x + _r2 * Math.cos(theta), + y: center4.y + _r2 * Math.sin(theta) + }; + pos[_val.node.id()] = p3; + } + } + eles.nodes().layoutPositions(this, options2, function(ele) { + var id35 = ele.id(); + return pos[id35]; + }); + return this; + }; + defaults$4 = { + // Called on `layoutready` + ready: /* @__PURE__ */ __name(function ready2() { + }, "ready"), + // Called on `layoutstop` + stop: /* @__PURE__ */ __name(function stop3() { + }, "stop"), + // Whether to animate while running the layout + // true : Animate continuously as the layout is running + // false : Just show the end result + // 'end' : Animate with the end result, from the initial positions to the end positions + animate: true, + // Easing of the animation for animate:'end' + animationEasing: void 0, + // The duration of the animation for animate:'end' + animationDuration: void 0, + // A function that determines whether the node should be animated + // All nodes animated by default on animate enabled + // Non-animated nodes are positioned immediately when the layout starts + animateFilter: /* @__PURE__ */ __name(function animateFilter4(node2, i2) { + return true; + }, "animateFilter"), + // The layout animates only after this many milliseconds for animate:true + // (prevents flashing on fast runs) + animationThreshold: 250, + // Number of iterations between consecutive screen positions update + refresh: 20, + // Whether to fit the network view after when done + fit: true, + // Padding on fit + padding: 30, + // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + boundingBox: void 0, + // Excludes the label when calculating node bounding boxes for the layout algorithm + nodeDimensionsIncludeLabels: false, + // Randomize the initial positions of the nodes (true) or use existing positions (false) + randomize: false, + // Extra spacing between components in non-compound graphs + componentSpacing: 40, + // Node repulsion (non overlapping) multiplier + nodeRepulsion: /* @__PURE__ */ __name(function nodeRepulsion(node2) { + return 2048; + }, "nodeRepulsion"), + // Node repulsion (overlapping) multiplier + nodeOverlap: 4, + // Ideal edge (non nested) length + idealEdgeLength: /* @__PURE__ */ __name(function idealEdgeLength(edge) { + return 32; + }, "idealEdgeLength"), + // Divisor to compute edge forces + edgeElasticity: /* @__PURE__ */ __name(function edgeElasticity(edge) { + return 32; + }, "edgeElasticity"), + // Nesting factor (multiplier) to compute ideal edge length for nested edges + nestingFactor: 1.2, + // Gravity force (constant) + gravity: 1, + // Maximum number of iterations to perform + numIter: 1e3, + // Initial temperature (maximum node displacement) + initialTemp: 1e3, + // Cooling factor (how the temperature is reduced between consecutive iterations + coolingFactor: 0.99, + // Lower temperature threshold (below this point the layout will end) + minTemp: 1 + }; + __name(CoseLayout, "CoseLayout"); + CoseLayout.prototype.run = function() { + var options2 = this.options; + var cy = options2.cy; + var layout7 = this; + layout7.stopped = false; + if (options2.animate === true || options2.animate === false) { + layout7.emit({ + type: "layoutstart", + layout: layout7 + }); + } + if (true === options2.debug) { + DEBUG = true; + } else { + DEBUG = false; + } + var layoutInfo = createLayoutInfo(cy, layout7, options2); + if (DEBUG) { + printLayoutInfo(layoutInfo); + } + if (options2.randomize) { + randomizePositions(layoutInfo); + } + var startTime = performanceNow(); + var refresh = /* @__PURE__ */ __name(function refresh2() { + refreshPositions(layoutInfo, cy, options2); + if (true === options2.fit) { + cy.fit(options2.padding); + } + }, "refresh"); + var mainLoop = /* @__PURE__ */ __name(function mainLoop2(i3) { + if (layout7.stopped || i3 >= options2.numIter) { + return false; + } + step(layoutInfo, options2); + layoutInfo.temperature = layoutInfo.temperature * options2.coolingFactor; + if (layoutInfo.temperature < options2.minTemp) { + return false; + } + return true; + }, "mainLoop"); + var done = /* @__PURE__ */ __name(function done2() { + if (options2.animate === true || options2.animate === false) { + refresh(); + layout7.one("layoutstop", options2.stop); + layout7.emit({ + type: "layoutstop", + layout: layout7 + }); + } else { + var nodes5 = options2.eles.nodes(); + var getScaledPos = getScaleInBoundsFn(layoutInfo, options2, nodes5); + nodes5.layoutPositions(layout7, options2, getScaledPos); + } + }, "done"); + var i2 = 0; + var loopRet = true; + if (options2.animate === true) { + var _frame = /* @__PURE__ */ __name(function frame2() { + var f2 = 0; + while (loopRet && f2 < options2.refresh) { + loopRet = mainLoop(i2); + i2++; + f2++; + } + if (!loopRet) { + separateComponents(layoutInfo, options2); + done(); + } else { + var now3 = performanceNow(); + if (now3 - startTime >= options2.animationThreshold) { + refresh(); + } + requestAnimationFrame2(_frame); + } + }, "frame"); + _frame(); + } else { + while (loopRet) { + loopRet = mainLoop(i2); + i2++; + } + separateComponents(layoutInfo, options2); + done(); + } + return this; + }; + CoseLayout.prototype.stop = function() { + this.stopped = true; + if (this.thread) { + this.thread.stop(); + } + this.emit("layoutstop"); + return this; + }; + CoseLayout.prototype.destroy = function() { + if (this.thread) { + this.thread.stop(); + } + return this; + }; + createLayoutInfo = /* @__PURE__ */ __name(function createLayoutInfo2(cy, layout7, options2) { + var edges3 = options2.eles.edges(); + var nodes5 = options2.eles.nodes(); + var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var layoutInfo = { + isCompound: cy.hasCompoundNodes(), + layoutNodes: [], + idToIndex: {}, + nodeSize: nodes5.size(), + graphSet: [], + indexToGraph: [], + layoutEdges: [], + edgeSize: edges3.size(), + temperature: options2.initialTemp, + clientWidth: bb.w, + clientHeight: bb.h, + boundingBox: bb + }; + var components3 = options2.eles.components(); + var id2cmptId = {}; + for (var i2 = 0; i2 < components3.length; i2++) { + var component2 = components3[i2]; + for (var j3 = 0; j3 < component2.length; j3++) { + var node2 = component2[j3]; + id2cmptId[node2.id()] = i2; + } + } + for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) { + var n2 = nodes5[i2]; + var nbb = n2.layoutDimensions(options2); + var tempNode = {}; + tempNode.isLocked = n2.locked(); + tempNode.id = n2.data("id"); + tempNode.parentId = n2.data("parent"); + tempNode.cmptId = id2cmptId[n2.id()]; + tempNode.children = []; + tempNode.positionX = n2.position("x"); + tempNode.positionY = n2.position("y"); + tempNode.offsetX = 0; + tempNode.offsetY = 0; + tempNode.height = nbb.w; + tempNode.width = nbb.h; + tempNode.maxX = tempNode.positionX + tempNode.width / 2; + tempNode.minX = tempNode.positionX - tempNode.width / 2; + tempNode.maxY = tempNode.positionY + tempNode.height / 2; + tempNode.minY = tempNode.positionY - tempNode.height / 2; + tempNode.padLeft = parseFloat(n2.style("padding")); + tempNode.padRight = parseFloat(n2.style("padding")); + tempNode.padTop = parseFloat(n2.style("padding")); + tempNode.padBottom = parseFloat(n2.style("padding")); + tempNode.nodeRepulsion = fn$6(options2.nodeRepulsion) ? options2.nodeRepulsion(n2) : options2.nodeRepulsion; + layoutInfo.layoutNodes.push(tempNode); + layoutInfo.idToIndex[tempNode.id] = i2; + } + var queue = []; + var start3 = 0; + var end2 = -1; + var tempGraph = []; + for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) { + var n2 = layoutInfo.layoutNodes[i2]; + var p_id = n2.parentId; + if (null != p_id) { + layoutInfo.layoutNodes[layoutInfo.idToIndex[p_id]].children.push(n2.id); + } else { + queue[++end2] = n2.id; + tempGraph.push(n2.id); + } + } + layoutInfo.graphSet.push(tempGraph); + while (start3 <= end2) { + var node_id = queue[start3++]; + var node_ix = layoutInfo.idToIndex[node_id]; + var node2 = layoutInfo.layoutNodes[node_ix]; + var children2 = node2.children; + if (children2.length > 0) { + layoutInfo.graphSet.push(children2); + for (var i2 = 0; i2 < children2.length; i2++) { + queue[++end2] = children2[i2]; + } + } + } + for (var i2 = 0; i2 < layoutInfo.graphSet.length; i2++) { + var graph = layoutInfo.graphSet[i2]; + for (var j3 = 0; j3 < graph.length; j3++) { + var index = layoutInfo.idToIndex[graph[j3]]; + layoutInfo.indexToGraph[index] = i2; + } + } + for (var i2 = 0; i2 < layoutInfo.edgeSize; i2++) { + var e3 = edges3[i2]; + var tempEdge = {}; + tempEdge.id = e3.data("id"); + tempEdge.sourceId = e3.data("source"); + tempEdge.targetId = e3.data("target"); + var idealLength = fn$6(options2.idealEdgeLength) ? options2.idealEdgeLength(e3) : options2.idealEdgeLength; + var elasticity = fn$6(options2.edgeElasticity) ? options2.edgeElasticity(e3) : options2.edgeElasticity; + var sourceIx = layoutInfo.idToIndex[tempEdge.sourceId]; + var targetIx = layoutInfo.idToIndex[tempEdge.targetId]; + var sourceGraph = layoutInfo.indexToGraph[sourceIx]; + var targetGraph = layoutInfo.indexToGraph[targetIx]; + if (sourceGraph != targetGraph) { + var lca = findLCA(tempEdge.sourceId, tempEdge.targetId, layoutInfo); + var lcaGraph = layoutInfo.graphSet[lca]; + var depth = 0; + var tempNode = layoutInfo.layoutNodes[sourceIx]; + while (-1 === lcaGraph.indexOf(tempNode.id)) { + tempNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]]; + depth++; + } + tempNode = layoutInfo.layoutNodes[targetIx]; + while (-1 === lcaGraph.indexOf(tempNode.id)) { + tempNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[tempNode.parentId]]; + depth++; + } + idealLength *= depth * options2.nestingFactor; + } + tempEdge.idealLength = idealLength; + tempEdge.elasticity = elasticity; + layoutInfo.layoutEdges.push(tempEdge); + } + return layoutInfo; + }, "createLayoutInfo"); + findLCA = /* @__PURE__ */ __name(function findLCA2(node1, node2, layoutInfo) { + var res = _findLCA_aux(node1, node2, 0, layoutInfo); + if (2 > res.count) { + return 0; + } else { + return res.graph; + } + }, "findLCA"); + _findLCA_aux = /* @__PURE__ */ __name(function findLCA_aux(node1, node2, graphIx, layoutInfo) { + var graph = layoutInfo.graphSet[graphIx]; + if (-1 < graph.indexOf(node1) && -1 < graph.indexOf(node2)) { + return { + count: 2, + graph: graphIx + }; + } + var c3 = 0; + for (var i2 = 0; i2 < graph.length; i2++) { + var nodeId = graph[i2]; + var nodeIx = layoutInfo.idToIndex[nodeId]; + var children2 = layoutInfo.layoutNodes[nodeIx].children; + if (0 === children2.length) { + continue; + } + var childGraphIx = layoutInfo.indexToGraph[layoutInfo.idToIndex[children2[0]]]; + var result = _findLCA_aux(node1, node2, childGraphIx, layoutInfo); + if (0 === result.count) { + continue; + } else if (1 === result.count) { + c3++; + if (2 === c3) { + break; + } + } else { + return result; + } + } + return { + count: c3, + graph: graphIx + }; + }, "findLCA_aux"); + randomizePositions = /* @__PURE__ */ __name(function randomizePositions2(layoutInfo, cy) { + var width3 = layoutInfo.clientWidth; + var height2 = layoutInfo.clientHeight; + for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) { + var n2 = layoutInfo.layoutNodes[i2]; + if (0 === n2.children.length && !n2.isLocked) { + n2.positionX = Math.random() * width3; + n2.positionY = Math.random() * height2; + } + } + }, "randomizePositions"); + getScaleInBoundsFn = /* @__PURE__ */ __name(function getScaleInBoundsFn2(layoutInfo, options2, nodes5) { + var bb = layoutInfo.boundingBox; + var coseBB = { + x1: Infinity, + x2: -Infinity, + y1: Infinity, + y2: -Infinity + }; + if (options2.boundingBox) { + nodes5.forEach(function(node2) { + var lnode = layoutInfo.layoutNodes[layoutInfo.idToIndex[node2.data("id")]]; + coseBB.x1 = Math.min(coseBB.x1, lnode.positionX); + coseBB.x2 = Math.max(coseBB.x2, lnode.positionX); + coseBB.y1 = Math.min(coseBB.y1, lnode.positionY); + coseBB.y2 = Math.max(coseBB.y2, lnode.positionY); + }); + coseBB.w = coseBB.x2 - coseBB.x1; + coseBB.h = coseBB.y2 - coseBB.y1; + } + return function(ele, i2) { + var lnode = layoutInfo.layoutNodes[layoutInfo.idToIndex[ele.data("id")]]; + if (options2.boundingBox) { + var pctX = coseBB.w === 0 ? 0.5 : (lnode.positionX - coseBB.x1) / coseBB.w; + var pctY = coseBB.h === 0 ? 0.5 : (lnode.positionY - coseBB.y1) / coseBB.h; + return { + x: bb.x1 + pctX * bb.w, + y: bb.y1 + pctY * bb.h + }; + } else { + return { + x: lnode.positionX, + y: lnode.positionY + }; + } + }; + }, "getScaleInBoundsFn"); + refreshPositions = /* @__PURE__ */ __name(function refreshPositions2(layoutInfo, cy, options2) { + var layout7 = options2.layout; + var nodes5 = options2.eles.nodes(); + var getScaledPos = getScaleInBoundsFn(layoutInfo, options2, nodes5); + nodes5.positions(getScaledPos); + if (true !== layoutInfo.ready) { + layoutInfo.ready = true; + layout7.one("layoutready", options2.ready); + layout7.emit({ + type: "layoutready", + layout: this + }); + } + }, "refreshPositions"); + step = /* @__PURE__ */ __name(function step2(layoutInfo, options2, _step) { + calculateNodeForces(layoutInfo, options2); + calculateEdgeForces(layoutInfo); + calculateGravityForces(layoutInfo, options2); + propagateForces(layoutInfo); + updatePositions(layoutInfo); + }, "step"); + calculateNodeForces = /* @__PURE__ */ __name(function calculateNodeForces2(layoutInfo, options2) { + for (var i2 = 0; i2 < layoutInfo.graphSet.length; i2++) { + var graph = layoutInfo.graphSet[i2]; + var numNodes = graph.length; + for (var j3 = 0; j3 < numNodes; j3++) { + var node1 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j3]]]; + for (var k2 = j3 + 1; k2 < numNodes; k2++) { + var node2 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[k2]]]; + nodeRepulsion2(node1, node2, layoutInfo, options2); + } + } + } + }, "calculateNodeForces"); + randomDistance = /* @__PURE__ */ __name(function randomDistance2(max10) { + return -1 + 2 * max10 * Math.random(); + }, "randomDistance"); + nodeRepulsion2 = /* @__PURE__ */ __name(function nodeRepulsion3(node1, node2, layoutInfo, options2) { + var cmptId1 = node1.cmptId; + var cmptId2 = node2.cmptId; + if (cmptId1 !== cmptId2 && !layoutInfo.isCompound) { + return; + } + var directionX = node2.positionX - node1.positionX; + var directionY = node2.positionY - node1.positionY; + var maxRandDist = 1; + if (0 === directionX && 0 === directionY) { + directionX = randomDistance(maxRandDist); + directionY = randomDistance(maxRandDist); + } + var overlap = nodesOverlap(node1, node2, directionX, directionY); + if (overlap > 0) { + var force = options2.nodeOverlap * overlap; + var distance3 = Math.sqrt(directionX * directionX + directionY * directionY); + var forceX = force * directionX / distance3; + var forceY = force * directionY / distance3; + } else { + var point1 = findClippingPoint(node1, directionX, directionY); + var point22 = findClippingPoint(node2, -1 * directionX, -1 * directionY); + var distanceX = point22.x - point1.x; + var distanceY = point22.y - point1.y; + var distanceSqr = distanceX * distanceX + distanceY * distanceY; + var distance3 = Math.sqrt(distanceSqr); + var force = (node1.nodeRepulsion + node2.nodeRepulsion) / distanceSqr; + var forceX = force * distanceX / distance3; + var forceY = force * distanceY / distance3; + } + if (!node1.isLocked) { + node1.offsetX -= forceX; + node1.offsetY -= forceY; + } + if (!node2.isLocked) { + node2.offsetX += forceX; + node2.offsetY += forceY; + } + return; + }, "nodeRepulsion"); + nodesOverlap = /* @__PURE__ */ __name(function nodesOverlap2(node1, node2, dX, dY) { + if (dX > 0) { + var overlapX = node1.maxX - node2.minX; + } else { + var overlapX = node2.maxX - node1.minX; + } + if (dY > 0) { + var overlapY = node1.maxY - node2.minY; + } else { + var overlapY = node2.maxY - node1.minY; + } + if (overlapX >= 0 && overlapY >= 0) { + return Math.sqrt(overlapX * overlapX + overlapY * overlapY); + } else { + return 0; + } + }, "nodesOverlap"); + findClippingPoint = /* @__PURE__ */ __name(function findClippingPoint2(node2, dX, dY) { + var X4 = node2.positionX; + var Y3 = node2.positionY; + var H2 = node2.height || 1; + var W3 = node2.width || 1; + var dirSlope = dY / dX; + var nodeSlope = H2 / W3; + var res = {}; + if (0 === dX && 0 < dY) { + res.x = X4; + res.y = Y3 + H2 / 2; + return res; + } + if (0 === dX && 0 > dY) { + res.x = X4; + res.y = Y3 + H2 / 2; + return res; + } + if (0 < dX && -1 * nodeSlope <= dirSlope && dirSlope <= nodeSlope) { + res.x = X4 + W3 / 2; + res.y = Y3 + W3 * dY / 2 / dX; + return res; + } + if (0 > dX && -1 * nodeSlope <= dirSlope && dirSlope <= nodeSlope) { + res.x = X4 - W3 / 2; + res.y = Y3 - W3 * dY / 2 / dX; + return res; + } + if (0 < dY && (dirSlope <= -1 * nodeSlope || dirSlope >= nodeSlope)) { + res.x = X4 + H2 * dX / 2 / dY; + res.y = Y3 + H2 / 2; + return res; + } + if (0 > dY && (dirSlope <= -1 * nodeSlope || dirSlope >= nodeSlope)) { + res.x = X4 - H2 * dX / 2 / dY; + res.y = Y3 - H2 / 2; + return res; + } + return res; + }, "findClippingPoint"); + calculateEdgeForces = /* @__PURE__ */ __name(function calculateEdgeForces2(layoutInfo, options2) { + for (var i2 = 0; i2 < layoutInfo.edgeSize; i2++) { + var edge = layoutInfo.layoutEdges[i2]; + var sourceIx = layoutInfo.idToIndex[edge.sourceId]; + var source = layoutInfo.layoutNodes[sourceIx]; + var targetIx = layoutInfo.idToIndex[edge.targetId]; + var target = layoutInfo.layoutNodes[targetIx]; + var directionX = target.positionX - source.positionX; + var directionY = target.positionY - source.positionY; + if (0 === directionX && 0 === directionY) { + continue; + } + var point1 = findClippingPoint(source, directionX, directionY); + var point22 = findClippingPoint(target, -1 * directionX, -1 * directionY); + var lx = point22.x - point1.x; + var ly = point22.y - point1.y; + var l4 = Math.sqrt(lx * lx + ly * ly); + var force = Math.pow(edge.idealLength - l4, 2) / edge.elasticity; + if (0 !== l4) { + var forceX = force * lx / l4; + var forceY = force * ly / l4; + } else { + var forceX = 0; + var forceY = 0; + } + if (!source.isLocked) { + source.offsetX += forceX; + source.offsetY += forceY; + } + if (!target.isLocked) { + target.offsetX -= forceX; + target.offsetY -= forceY; + } + } + }, "calculateEdgeForces"); + calculateGravityForces = /* @__PURE__ */ __name(function calculateGravityForces2(layoutInfo, options2) { + if (options2.gravity === 0) { + return; + } + var distThreshold = 1; + for (var i2 = 0; i2 < layoutInfo.graphSet.length; i2++) { + var graph = layoutInfo.graphSet[i2]; + var numNodes = graph.length; + if (0 === i2) { + var centerX = layoutInfo.clientHeight / 2; + var centerY = layoutInfo.clientWidth / 2; + } else { + var temp = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[0]]]; + var parent4 = layoutInfo.layoutNodes[layoutInfo.idToIndex[temp.parentId]]; + var centerX = parent4.positionX; + var centerY = parent4.positionY; + } + for (var j3 = 0; j3 < numNodes; j3++) { + var node2 = layoutInfo.layoutNodes[layoutInfo.idToIndex[graph[j3]]]; + if (node2.isLocked) { + continue; + } + var dx = centerX - node2.positionX; + var dy = centerY - node2.positionY; + var d3 = Math.sqrt(dx * dx + dy * dy); + if (d3 > distThreshold) { + var fx = options2.gravity * dx / d3; + var fy = options2.gravity * dy / d3; + node2.offsetX += fx; + node2.offsetY += fy; + } + } + } + }, "calculateGravityForces"); + propagateForces = /* @__PURE__ */ __name(function propagateForces2(layoutInfo, options2) { + var queue = []; + var start3 = 0; + var end2 = -1; + queue.push.apply(queue, layoutInfo.graphSet[0]); + end2 += layoutInfo.graphSet[0].length; + while (start3 <= end2) { + var nodeId = queue[start3++]; + var nodeIndex = layoutInfo.idToIndex[nodeId]; + var node2 = layoutInfo.layoutNodes[nodeIndex]; + var children2 = node2.children; + if (0 < children2.length && !node2.isLocked) { + var offX = node2.offsetX; + var offY = node2.offsetY; + for (var i2 = 0; i2 < children2.length; i2++) { + var childNode = layoutInfo.layoutNodes[layoutInfo.idToIndex[children2[i2]]]; + childNode.offsetX += offX; + childNode.offsetY += offY; + queue[++end2] = children2[i2]; + } + node2.offsetX = 0; + node2.offsetY = 0; + } + } + }, "propagateForces"); + updatePositions = /* @__PURE__ */ __name(function updatePositions2(layoutInfo, options2) { + for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) { + var n2 = layoutInfo.layoutNodes[i2]; + if (0 < n2.children.length) { + n2.maxX = void 0; + n2.minX = void 0; + n2.maxY = void 0; + n2.minY = void 0; + } + } + for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) { + var n2 = layoutInfo.layoutNodes[i2]; + if (0 < n2.children.length || n2.isLocked) { + continue; + } + var tempForce = limitForce(n2.offsetX, n2.offsetY, layoutInfo.temperature); + n2.positionX += tempForce.x; + n2.positionY += tempForce.y; + n2.offsetX = 0; + n2.offsetY = 0; + n2.minX = n2.positionX - n2.width; + n2.maxX = n2.positionX + n2.width; + n2.minY = n2.positionY - n2.height; + n2.maxY = n2.positionY + n2.height; + _updateAncestryBoundaries(n2, layoutInfo); + } + for (var i2 = 0; i2 < layoutInfo.nodeSize; i2++) { + var n2 = layoutInfo.layoutNodes[i2]; + if (0 < n2.children.length && !n2.isLocked) { + n2.positionX = (n2.maxX + n2.minX) / 2; + n2.positionY = (n2.maxY + n2.minY) / 2; + n2.width = n2.maxX - n2.minX; + n2.height = n2.maxY - n2.minY; + } + } + }, "updatePositions"); + limitForce = /* @__PURE__ */ __name(function limitForce2(forceX, forceY, max10) { + var force = Math.sqrt(forceX * forceX + forceY * forceY); + if (force > max10) { + var res = { + x: max10 * forceX / force, + y: max10 * forceY / force + }; + } else { + var res = { + x: forceX, + y: forceY + }; + } + return res; + }, "limitForce"); + _updateAncestryBoundaries = /* @__PURE__ */ __name(function updateAncestryBoundaries(node2, layoutInfo) { + var parentId = node2.parentId; + if (null == parentId) { + return; + } + var p3 = layoutInfo.layoutNodes[layoutInfo.idToIndex[parentId]]; + var flag = false; + if (null == p3.maxX || node2.maxX + p3.padRight > p3.maxX) { + p3.maxX = node2.maxX + p3.padRight; + flag = true; + } + if (null == p3.minX || node2.minX - p3.padLeft < p3.minX) { + p3.minX = node2.minX - p3.padLeft; + flag = true; + } + if (null == p3.maxY || node2.maxY + p3.padBottom > p3.maxY) { + p3.maxY = node2.maxY + p3.padBottom; + flag = true; + } + if (null == p3.minY || node2.minY - p3.padTop < p3.minY) { + p3.minY = node2.minY - p3.padTop; + flag = true; + } + if (flag) { + return _updateAncestryBoundaries(p3, layoutInfo); + } + return; + }, "updateAncestryBoundaries"); + separateComponents = /* @__PURE__ */ __name(function separateComponents2(layoutInfo, options2) { + var nodes5 = layoutInfo.layoutNodes; + var components3 = []; + for (var i2 = 0; i2 < nodes5.length; i2++) { + var node2 = nodes5[i2]; + var cid = node2.cmptId; + var component2 = components3[cid] = components3[cid] || []; + component2.push(node2); + } + var totalA = 0; + for (var i2 = 0; i2 < components3.length; i2++) { + var c3 = components3[i2]; + if (!c3) { + continue; + } + c3.x1 = Infinity; + c3.x2 = -Infinity; + c3.y1 = Infinity; + c3.y2 = -Infinity; + for (var j3 = 0; j3 < c3.length; j3++) { + var n2 = c3[j3]; + c3.x1 = Math.min(c3.x1, n2.positionX - n2.width / 2); + c3.x2 = Math.max(c3.x2, n2.positionX + n2.width / 2); + c3.y1 = Math.min(c3.y1, n2.positionY - n2.height / 2); + c3.y2 = Math.max(c3.y2, n2.positionY + n2.height / 2); + } + c3.w = c3.x2 - c3.x1; + c3.h = c3.y2 - c3.y1; + totalA += c3.w * c3.h; + } + components3.sort(function(c1, c22) { + return c22.w * c22.h - c1.w * c1.h; + }); + var x5 = 0; + var y6 = 0; + var usedW = 0; + var rowH = 0; + var maxRowW = Math.sqrt(totalA) * layoutInfo.clientWidth / layoutInfo.clientHeight; + for (var i2 = 0; i2 < components3.length; i2++) { + var c3 = components3[i2]; + if (!c3) { + continue; + } + for (var j3 = 0; j3 < c3.length; j3++) { + var n2 = c3[j3]; + if (!n2.isLocked) { + n2.positionX += x5 - c3.x1; + n2.positionY += y6 - c3.y1; + } + } + x5 += c3.w + options2.componentSpacing; + usedW += c3.w + options2.componentSpacing; + rowH = Math.max(rowH, c3.h); + if (usedW > maxRowW) { + y6 += rowH + options2.componentSpacing; + x5 = 0; + usedW = 0; + rowH = 0; + } + } + }, "separateComponents"); + defaults$3 = { + fit: true, + // whether to fit the viewport to the graph + padding: 30, + // padding used on fit + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: true, + // prevents node overlap, may overflow boundingBox if not enough space + avoidOverlapPadding: 10, + // extra spacing around nodes when avoidOverlap: true + nodeDimensionsIncludeLabels: false, + // Excludes the label when calculating node bounding boxes for the layout algorithm + spacingFactor: void 0, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + condense: false, + // uses all available space on false, uses minimal space on true + rows: void 0, + // force num of rows in the grid + cols: void 0, + // force num of columns in the grid + position: /* @__PURE__ */ __name(function position3(node2) { + }, "position"), + // returns { row, col } for element + sort: void 0, + // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: /* @__PURE__ */ __name(function animateFilter5(node2, i2) { + return true; + }, "animateFilter"), + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: /* @__PURE__ */ __name(function transform5(node2, position5) { + return position5; + }, "transform") + // transform a given node position. Useful for changing flow direction in discrete layouts + }; + __name(GridLayout, "GridLayout"); + GridLayout.prototype.run = function() { + var params = this.options; + var options2 = params; + var cy = params.cy; + var eles = options2.eles; + var nodes5 = eles.nodes().not(":parent"); + if (options2.sort) { + nodes5 = nodes5.sort(options2.sort); + } + var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + if (bb.h === 0 || bb.w === 0) { + eles.nodes().layoutPositions(this, options2, function(ele) { + return { + x: bb.x1, + y: bb.y1 + }; + }); + } else { + var cells = nodes5.size(); + var splits = Math.sqrt(cells * bb.h / bb.w); + var rows = Math.round(splits); + var cols = Math.round(bb.w / bb.h * splits); + var small = /* @__PURE__ */ __name(function small2(val) { + if (val == null) { + return Math.min(rows, cols); + } else { + var min10 = Math.min(rows, cols); + if (min10 == rows) { + rows = val; + } else { + cols = val; + } + } + }, "small"); + var large = /* @__PURE__ */ __name(function large2(val) { + if (val == null) { + return Math.max(rows, cols); + } else { + var max10 = Math.max(rows, cols); + if (max10 == rows) { + rows = val; + } else { + cols = val; + } + } + }, "large"); + var oRows = options2.rows; + var oCols = options2.cols != null ? options2.cols : options2.columns; + if (oRows != null && oCols != null) { + rows = oRows; + cols = oCols; + } else if (oRows != null && oCols == null) { + rows = oRows; + cols = Math.ceil(cells / rows); + } else if (oRows == null && oCols != null) { + cols = oCols; + rows = Math.ceil(cells / cols); + } else if (cols * rows > cells) { + var sm = small(); + var lg = large(); + if ((sm - 1) * lg >= cells) { + small(sm - 1); + } else if ((lg - 1) * sm >= cells) { + large(lg - 1); + } + } else { + while (cols * rows < cells) { + var _sm = small(); + var _lg = large(); + if ((_lg + 1) * _sm >= cells) { + large(_lg + 1); + } else { + small(_sm + 1); + } + } + } + var cellWidth = bb.w / cols; + var cellHeight = bb.h / rows; + if (options2.condense) { + cellWidth = 0; + cellHeight = 0; + } + if (options2.avoidOverlap) { + for (var i2 = 0; i2 < nodes5.length; i2++) { + var node2 = nodes5[i2]; + var pos = node2._private.position; + if (pos.x == null || pos.y == null) { + pos.x = 0; + pos.y = 0; + } + var nbb = node2.layoutDimensions(options2); + var p3 = options2.avoidOverlapPadding; + var w4 = nbb.w + p3; + var h3 = nbb.h + p3; + cellWidth = Math.max(cellWidth, w4); + cellHeight = Math.max(cellHeight, h3); + } + } + var cellUsed = {}; + var used = /* @__PURE__ */ __name(function used2(row2, col2) { + return cellUsed["c-" + row2 + "-" + col2] ? true : false; + }, "used"); + var use = /* @__PURE__ */ __name(function use2(row2, col2) { + cellUsed["c-" + row2 + "-" + col2] = true; + }, "use"); + var row = 0; + var col = 0; + var moveToNextCell = /* @__PURE__ */ __name(function moveToNextCell2() { + col++; + if (col >= cols) { + col = 0; + row++; + } + }, "moveToNextCell"); + var id2manPos = {}; + for (var _i = 0; _i < nodes5.length; _i++) { + var _node = nodes5[_i]; + var rcPos = options2.position(_node); + if (rcPos && (rcPos.row !== void 0 || rcPos.col !== void 0)) { + var _pos = { + row: rcPos.row, + col: rcPos.col + }; + if (_pos.col === void 0) { + _pos.col = 0; + while (used(_pos.row, _pos.col)) { + _pos.col++; + } + } else if (_pos.row === void 0) { + _pos.row = 0; + while (used(_pos.row, _pos.col)) { + _pos.row++; + } + } + id2manPos[_node.id()] = _pos; + use(_pos.row, _pos.col); + } + } + var getPos = /* @__PURE__ */ __name(function getPos2(element3, i3) { + var x5, y6; + if (element3.locked() || element3.isParent()) { + return false; + } + var rcPos2 = id2manPos[element3.id()]; + if (rcPos2) { + x5 = rcPos2.col * cellWidth + cellWidth / 2 + bb.x1; + y6 = rcPos2.row * cellHeight + cellHeight / 2 + bb.y1; + } else { + while (used(row, col)) { + moveToNextCell(); + } + x5 = col * cellWidth + cellWidth / 2 + bb.x1; + y6 = row * cellHeight + cellHeight / 2 + bb.y1; + use(row, col); + moveToNextCell(); + } + return { + x: x5, + y: y6 + }; + }, "getPos"); + nodes5.layoutPositions(this, options2, getPos); + } + return this; + }; + defaults$2 = { + ready: /* @__PURE__ */ __name(function ready3() { + }, "ready"), + // on layoutready + stop: /* @__PURE__ */ __name(function stop4() { + }, "stop") + // on layoutstop + }; + __name(NullLayout, "NullLayout"); + NullLayout.prototype.run = function() { + var options2 = this.options; + var eles = options2.eles; + var layout7 = this; + options2.cy; + layout7.emit("layoutstart"); + eles.nodes().positions(function() { + return { + x: 0, + y: 0 + }; + }); + layout7.one("layoutready", options2.ready); + layout7.emit("layoutready"); + layout7.one("layoutstop", options2.stop); + layout7.emit("layoutstop"); + return this; + }; + NullLayout.prototype.stop = function() { + return this; + }; + defaults$1 = { + positions: void 0, + // map of (node id) => (position obj); or function(node){ return somPos; } + zoom: void 0, + // the zoom level to set (prob want fit = false if set) + pan: void 0, + // the pan level to set (prob want fit = false if set) + fit: true, + // whether to fit to viewport + padding: 30, + // padding on fit + spacingFactor: void 0, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: /* @__PURE__ */ __name(function animateFilter6(node2, i2) { + return true; + }, "animateFilter"), + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: /* @__PURE__ */ __name(function transform6(node2, position5) { + return position5; + }, "transform") + // transform a given node position. Useful for changing flow direction in discrete layouts + }; + __name(PresetLayout, "PresetLayout"); + PresetLayout.prototype.run = function() { + var options2 = this.options; + var eles = options2.eles; + var nodes5 = eles.nodes(); + var posIsFn = fn$6(options2.positions); + function getPosition(node2) { + if (options2.positions == null) { + return copyPosition(node2.position()); + } + if (posIsFn) { + return options2.positions(node2); + } + var pos = options2.positions[node2._private.data.id]; + if (pos == null) { + return null; + } + return pos; + } + __name(getPosition, "getPosition"); + nodes5.layoutPositions(this, options2, function(node2, i2) { + var position5 = getPosition(node2); + if (node2.locked() || position5 == null) { + return false; + } + return position5; + }); + return this; + }; + defaults3 = { + fit: true, + // whether to fit to viewport + padding: 30, + // fit padding + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + animate: false, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: /* @__PURE__ */ __name(function animateFilter7(node2, i2) { + return true; + }, "animateFilter"), + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: /* @__PURE__ */ __name(function transform7(node2, position5) { + return position5; + }, "transform") + // transform a given node position. Useful for changing flow direction in discrete layouts + }; + __name(RandomLayout, "RandomLayout"); + RandomLayout.prototype.run = function() { + var options2 = this.options; + var cy = options2.cy; + var eles = options2.eles; + var bb = makeBoundingBox(options2.boundingBox ? options2.boundingBox : { + x1: 0, + y1: 0, + w: cy.width(), + h: cy.height() + }); + var getPos = /* @__PURE__ */ __name(function getPos2(node2, i2) { + return { + x: bb.x1 + Math.round(Math.random() * bb.w), + y: bb.y1 + Math.round(Math.random() * bb.h) + }; + }, "getPos"); + eles.nodes().layoutPositions(this, options2, getPos); + return this; + }; + layout4 = [{ + name: "breadthfirst", + impl: BreadthFirstLayout + }, { + name: "circle", + impl: CircleLayout + }, { + name: "concentric", + impl: ConcentricLayout + }, { + name: "cose", + impl: CoseLayout + }, { + name: "grid", + impl: GridLayout + }, { + name: "null", + impl: NullLayout + }, { + name: "preset", + impl: PresetLayout + }, { + name: "random", + impl: RandomLayout + }]; + __name(NullRenderer, "NullRenderer"); + noop5 = /* @__PURE__ */ __name(function noop6() { + }, "noop"); + throwImgErr = /* @__PURE__ */ __name(function throwImgErr2() { + throw new Error("A headless instance can not render images"); + }, "throwImgErr"); + NullRenderer.prototype = { + recalculateRenderedStyle: noop5, + notify: /* @__PURE__ */ __name(function notify2() { + this.notifications++; + }, "notify"), + init: noop5, + isHeadless: /* @__PURE__ */ __name(function isHeadless() { + return true; + }, "isHeadless"), + png: throwImgErr, + jpg: throwImgErr + }; + BRp$f = {}; + BRp$f.arrowShapeWidth = 0.3; + BRp$f.registerArrowShapes = function() { + var arrowShapes = this.arrowShapes = {}; + var renderer13 = this; + var bbCollide = /* @__PURE__ */ __name(function bbCollide2(x5, y6, size4, angle2, translation, edgeWidth, padding2) { + var x1 = translation.x - size4 / 2 - padding2; + var x22 = translation.x + size4 / 2 + padding2; + var y1 = translation.y - size4 / 2 - padding2; + var y22 = translation.y + size4 / 2 + padding2; + var inside = x1 <= x5 && x5 <= x22 && y1 <= y6 && y6 <= y22; + return inside; + }, "bbCollide"); + var transform8 = /* @__PURE__ */ __name(function transform9(x5, y6, size4, angle2, translation) { + var xRotated = x5 * Math.cos(angle2) - y6 * Math.sin(angle2); + var yRotated = x5 * Math.sin(angle2) + y6 * Math.cos(angle2); + var xScaled = xRotated * size4; + var yScaled = yRotated * size4; + var xTranslated = xScaled + translation.x; + var yTranslated = yScaled + translation.y; + return { + x: xTranslated, + y: yTranslated + }; + }, "transform"); + var transformPoints3 = /* @__PURE__ */ __name(function transformPoints4(pts2, size4, angle2, translation) { + var retPts = []; + for (var i2 = 0; i2 < pts2.length; i2 += 2) { + var x5 = pts2[i2]; + var y6 = pts2[i2 + 1]; + retPts.push(transform8(x5, y6, size4, angle2, translation)); + } + return retPts; + }, "transformPoints"); + var pointsToArr = /* @__PURE__ */ __name(function pointsToArr2(pts2) { + var ret = []; + for (var i2 = 0; i2 < pts2.length; i2++) { + var p3 = pts2[i2]; + ret.push(p3.x, p3.y); + } + return ret; + }, "pointsToArr"); + var standardGap = /* @__PURE__ */ __name(function standardGap2(edge) { + return edge.pstyle("width").pfValue * edge.pstyle("arrow-scale").pfValue * 2; + }, "standardGap"); + var defineArrowShape = /* @__PURE__ */ __name(function defineArrowShape2(name, defn) { + if (string(defn)) { + defn = arrowShapes[defn]; + } + arrowShapes[name] = extend4({ + name, + points: [-0.15, -0.3, 0.15, -0.3, 0.15, 0.3, -0.15, 0.3], + collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, padding2) { + var points = pointsToArr(transformPoints3(this.points, size4 + 2 * padding2, angle2, translation)); + var inside = pointInsidePolygonPoints(x5, y6, points); + return inside; + }, "collide"), + roughCollide: bbCollide, + draw: /* @__PURE__ */ __name(function draw32(context, size4, angle2, translation) { + var points = transformPoints3(this.points, size4, angle2, translation); + renderer13.arrowShapeImpl("polygon")(context, points); + }, "draw"), + spacing: /* @__PURE__ */ __name(function spacing2(edge) { + return 0; + }, "spacing"), + gap: standardGap + }, defn); + }, "defineArrowShape"); + defineArrowShape("none", { + collide: falsify, + roughCollide: falsify, + draw: noop$1, + spacing: zeroify, + gap: zeroify + }); + defineArrowShape("triangle", { + points: [-0.15, -0.3, 0, 0, 0.15, -0.3] + }); + defineArrowShape("arrow", "triangle"); + defineArrowShape("triangle-backcurve", { + points: arrowShapes["triangle"].points, + controlPoint: [0, -0.15], + roughCollide: bbCollide, + draw: /* @__PURE__ */ __name(function draw32(context, size4, angle2, translation, edgeWidth) { + var ptsTrans = transformPoints3(this.points, size4, angle2, translation); + var ctrlPt = this.controlPoint; + var ctrlPtTrans = transform8(ctrlPt[0], ctrlPt[1], size4, angle2, translation); + renderer13.arrowShapeImpl(this.name)(context, ptsTrans, ctrlPtTrans); + }, "draw"), + gap: /* @__PURE__ */ __name(function gap(edge) { + return standardGap(edge) * 0.8; + }, "gap") + }); + defineArrowShape("triangle-tee", { + points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0], + pointsTee: [-0.15, -0.4, -0.15, -0.5, 0.15, -0.5, 0.15, -0.4], + collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, edgeWidth, padding2) { + var triPts = pointsToArr(transformPoints3(this.points, size4 + 2 * padding2, angle2, translation)); + var teePts = pointsToArr(transformPoints3(this.pointsTee, size4 + 2 * padding2, angle2, translation)); + var inside = pointInsidePolygonPoints(x5, y6, triPts) || pointInsidePolygonPoints(x5, y6, teePts); + return inside; + }, "collide"), + draw: /* @__PURE__ */ __name(function draw32(context, size4, angle2, translation, edgeWidth) { + var triPts = transformPoints3(this.points, size4, angle2, translation); + var teePts = transformPoints3(this.pointsTee, size4, angle2, translation); + renderer13.arrowShapeImpl(this.name)(context, triPts, teePts); + }, "draw") + }); + defineArrowShape("circle-triangle", { + radius: 0.15, + pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15], + collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, edgeWidth, padding2) { + var t4 = translation; + var circleInside = Math.pow(t4.x - x5, 2) + Math.pow(t4.y - y6, 2) <= Math.pow((size4 + 2 * padding2) * this.radius, 2); + var triPts = pointsToArr(transformPoints3(this.points, size4 + 2 * padding2, angle2, translation)); + return pointInsidePolygonPoints(x5, y6, triPts) || circleInside; + }, "collide"), + draw: /* @__PURE__ */ __name(function draw32(context, size4, angle2, translation, edgeWidth) { + var triPts = transformPoints3(this.pointsTr, size4, angle2, translation); + renderer13.arrowShapeImpl(this.name)(context, triPts, translation.x, translation.y, this.radius * size4); + }, "draw"), + spacing: /* @__PURE__ */ __name(function spacing2(edge) { + return renderer13.getArrowWidth(edge.pstyle("width").pfValue, edge.pstyle("arrow-scale").value) * this.radius; + }, "spacing") + }); + defineArrowShape("triangle-cross", { + points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0], + baseCrossLinePts: [ + -0.15, + -0.4, + // first half of the rectangle + -0.15, + -0.4, + 0.15, + -0.4, + // second half of the rectangle + 0.15, + -0.4 + ], + crossLinePts: /* @__PURE__ */ __name(function crossLinePts(size4, edgeWidth) { + var p3 = this.baseCrossLinePts.slice(); + var shiftFactor = edgeWidth / size4; + var y0 = 3; + var y1 = 5; + p3[y0] = p3[y0] - shiftFactor; + p3[y1] = p3[y1] - shiftFactor; + return p3; + }, "crossLinePts"), + collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, edgeWidth, padding2) { + var triPts = pointsToArr(transformPoints3(this.points, size4 + 2 * padding2, angle2, translation)); + var teePts = pointsToArr(transformPoints3(this.crossLinePts(size4, edgeWidth), size4 + 2 * padding2, angle2, translation)); + var inside = pointInsidePolygonPoints(x5, y6, triPts) || pointInsidePolygonPoints(x5, y6, teePts); + return inside; + }, "collide"), + draw: /* @__PURE__ */ __name(function draw32(context, size4, angle2, translation, edgeWidth) { + var triPts = transformPoints3(this.points, size4, angle2, translation); + var crossLinePts = transformPoints3(this.crossLinePts(size4, edgeWidth), size4, angle2, translation); + renderer13.arrowShapeImpl(this.name)(context, triPts, crossLinePts); + }, "draw") + }); + defineArrowShape("vee", { + points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15], + gap: /* @__PURE__ */ __name(function gap(edge) { + return standardGap(edge) * 0.525; + }, "gap") + }); + defineArrowShape("circle", { + radius: 0.15, + collide: /* @__PURE__ */ __name(function collide(x5, y6, size4, angle2, translation, edgeWidth, padding2) { + var t4 = translation; + var inside = Math.pow(t4.x - x5, 2) + Math.pow(t4.y - y6, 2) <= Math.pow((size4 + 2 * padding2) * this.radius, 2); + return inside; + }, "collide"), + draw: /* @__PURE__ */ __name(function draw32(context, size4, angle2, translation, edgeWidth) { + renderer13.arrowShapeImpl(this.name)(context, translation.x, translation.y, this.radius * size4); + }, "draw"), + spacing: /* @__PURE__ */ __name(function spacing2(edge) { + return renderer13.getArrowWidth(edge.pstyle("width").pfValue, edge.pstyle("arrow-scale").value) * this.radius; + }, "spacing") + }); + defineArrowShape("tee", { + points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0], + spacing: /* @__PURE__ */ __name(function spacing2(edge) { + return 1; + }, "spacing"), + gap: /* @__PURE__ */ __name(function gap(edge) { + return 1; + }, "gap") + }); + defineArrowShape("square", { + points: [-0.15, 0, 0.15, 0, 0.15, -0.3, -0.15, -0.3] + }); + defineArrowShape("diamond", { + points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0], + gap: /* @__PURE__ */ __name(function gap(edge) { + return edge.pstyle("width").pfValue * edge.pstyle("arrow-scale").value; + }, "gap") + }); + defineArrowShape("chevron", { + points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15], + gap: /* @__PURE__ */ __name(function gap(edge) { + return 0.95 * edge.pstyle("width").pfValue * edge.pstyle("arrow-scale").value; + }, "gap") + }); + }; + BRp$e = {}; + BRp$e.projectIntoViewport = function(clientX, clientY) { + var cy = this.cy; + var offsets = this.findContainerClientCoords(); + var offsetLeft = offsets[0]; + var offsetTop = offsets[1]; + var scale3 = offsets[4]; + var pan2 = cy.pan(); + var zoom2 = cy.zoom(); + var x5 = ((clientX - offsetLeft) / scale3 - pan2.x) / zoom2; + var y6 = ((clientY - offsetTop) / scale3 - pan2.y) / zoom2; + return [x5, y6]; + }; + BRp$e.findContainerClientCoords = function() { + if (this.containerBB) { + return this.containerBB; + } + var container2 = this.container; + var rect3 = container2.getBoundingClientRect(); + var style3 = this.cy.window().getComputedStyle(container2); + var styleValue2 = /* @__PURE__ */ __name(function styleValue3(name) { + return parseFloat(style3.getPropertyValue(name)); + }, "styleValue"); + var padding2 = { + left: styleValue2("padding-left"), + right: styleValue2("padding-right"), + top: styleValue2("padding-top"), + bottom: styleValue2("padding-bottom") + }; + var border = { + left: styleValue2("border-left-width"), + right: styleValue2("border-right-width"), + top: styleValue2("border-top-width"), + bottom: styleValue2("border-bottom-width") + }; + var clientWidth = container2.clientWidth; + var clientHeight = container2.clientHeight; + var paddingHor = padding2.left + padding2.right; + var paddingVer = padding2.top + padding2.bottom; + var borderHor = border.left + border.right; + var scale3 = rect3.width / (clientWidth + borderHor); + var unscaledW = clientWidth - paddingHor; + var unscaledH = clientHeight - paddingVer; + var left3 = rect3.left + padding2.left + border.left; + var top2 = rect3.top + padding2.top + border.top; + return this.containerBB = [left3, top2, unscaledW, unscaledH, scale3]; + }; + BRp$e.invalidateContainerClientCoordsCache = function() { + this.containerBB = null; + }; + BRp$e.findNearestElement = function(x5, y6, interactiveElementsOnly, isTouch) { + return this.findNearestElements(x5, y6, interactiveElementsOnly, isTouch)[0]; + }; + BRp$e.findNearestElements = function(x5, y6, interactiveElementsOnly, isTouch) { + var self2 = this; + var r2 = this; + var eles = r2.getCachedZSortedEles(); + var near = []; + var zoom2 = r2.cy.zoom(); + var hasCompounds = r2.cy.hasCompoundNodes(); + var edgeThreshold = (isTouch ? 24 : 8) / zoom2; + var nodeThreshold = (isTouch ? 8 : 2) / zoom2; + var labelThreshold = (isTouch ? 8 : 2) / zoom2; + var minSqDist = Infinity; + var nearEdge; + var nearNode; + if (interactiveElementsOnly) { + eles = eles.interactive; + } + function addEle(ele2, sqDist) { + if (ele2.isNode()) { + if (nearNode) { + return; + } else { + nearNode = ele2; + near.push(ele2); + } + } + if (ele2.isEdge() && (sqDist == null || sqDist < minSqDist)) { + if (nearEdge) { + if (nearEdge.pstyle("z-compound-depth").value === ele2.pstyle("z-compound-depth").value && nearEdge.pstyle("z-compound-depth").value === ele2.pstyle("z-compound-depth").value) { + for (var i3 = 0; i3 < near.length; i3++) { + if (near[i3].isEdge()) { + near[i3] = ele2; + nearEdge = ele2; + minSqDist = sqDist != null ? sqDist : minSqDist; + break; + } + } + } + } else { + near.push(ele2); + nearEdge = ele2; + minSqDist = sqDist != null ? sqDist : minSqDist; + } + } + } + __name(addEle, "addEle"); + function checkNode(node2) { + var width3 = node2.outerWidth() + 2 * nodeThreshold; + var height2 = node2.outerHeight() + 2 * nodeThreshold; + var hw = width3 / 2; + var hh = height2 / 2; + var pos = node2.position(); + var cornerRadius = node2.pstyle("corner-radius").value === "auto" ? "auto" : node2.pstyle("corner-radius").pfValue; + var rs = node2._private.rscratch; + if (pos.x - hw <= x5 && x5 <= pos.x + hw && pos.y - hh <= y6 && y6 <= pos.y + hh) { + var shape = r2.nodeShapes[self2.getNodeShape(node2)]; + if (shape.checkPoint(x5, y6, 0, width3, height2, pos.x, pos.y, cornerRadius, rs)) { + addEle(node2, 0); + return true; + } + } + } + __name(checkNode, "checkNode"); + function checkEdge(edge) { + var _p = edge._private; + var rs = _p.rscratch; + var styleWidth = edge.pstyle("width").pfValue; + var scale3 = edge.pstyle("arrow-scale").value; + var width3 = styleWidth / 2 + edgeThreshold; + var widthSq = width3 * width3; + var width22 = width3 * 2; + var src = _p.source; + var tgt = _p.target; + var sqDist; + if (rs.edgeType === "segments" || rs.edgeType === "straight" || rs.edgeType === "haystack") { + var pts2 = rs.allpts; + for (var i3 = 0; i3 + 3 < pts2.length; i3 += 2) { + if (inLineVicinity(x5, y6, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3], width22) && widthSq > (sqDist = sqdistToFiniteLine(x5, y6, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3]))) { + addEle(edge, sqDist); + return true; + } + } + } else if (rs.edgeType === "bezier" || rs.edgeType === "multibezier" || rs.edgeType === "self" || rs.edgeType === "compound") { + var pts2 = rs.allpts; + for (var i3 = 0; i3 + 5 < rs.allpts.length; i3 += 4) { + if (inBezierVicinity(x5, y6, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3], pts2[i3 + 4], pts2[i3 + 5], width22) && widthSq > (sqDist = sqdistToQuadraticBezier(x5, y6, pts2[i3], pts2[i3 + 1], pts2[i3 + 2], pts2[i3 + 3], pts2[i3 + 4], pts2[i3 + 5]))) { + addEle(edge, sqDist); + return true; + } + } + } + var src = src || _p.source; + var tgt = tgt || _p.target; + var arSize = self2.getArrowWidth(styleWidth, scale3); + var arrows = [{ + name: "source", + x: rs.arrowStartX, + y: rs.arrowStartY, + angle: rs.srcArrowAngle + }, { + name: "target", + x: rs.arrowEndX, + y: rs.arrowEndY, + angle: rs.tgtArrowAngle + }, { + name: "mid-source", + x: rs.midX, + y: rs.midY, + angle: rs.midsrcArrowAngle + }, { + name: "mid-target", + x: rs.midX, + y: rs.midY, + angle: rs.midtgtArrowAngle + }]; + for (var i3 = 0; i3 < arrows.length; i3++) { + var ar = arrows[i3]; + var shape = r2.arrowShapes[edge.pstyle(ar.name + "-arrow-shape").value]; + var edgeWidth = edge.pstyle("width").pfValue; + if (shape.roughCollide(x5, y6, arSize, ar.angle, { + x: ar.x, + y: ar.y + }, edgeWidth, edgeThreshold) && shape.collide(x5, y6, arSize, ar.angle, { + x: ar.x, + y: ar.y + }, edgeWidth, edgeThreshold)) { + addEle(edge); + return true; + } + } + if (hasCompounds && near.length > 0) { + checkNode(src); + checkNode(tgt); + } + } + __name(checkEdge, "checkEdge"); + function preprop(obj, name, pre) { + return getPrefixedProperty(obj, name, pre); + } + __name(preprop, "preprop"); + function checkLabel(ele2, prefix) { + var _p = ele2._private; + var th = labelThreshold; + var prefixDash; + if (prefix) { + prefixDash = prefix + "-"; + } else { + prefixDash = ""; + } + ele2.boundingBox(); + var bb = _p.labelBounds[prefix || "main"]; + var text4 = ele2.pstyle(prefixDash + "label").value; + var eventsEnabled = ele2.pstyle("text-events").strValue === "yes"; + if (!eventsEnabled || !text4) { + return; + } + var lx = preprop(_p.rscratch, "labelX", prefix); + var ly = preprop(_p.rscratch, "labelY", prefix); + var theta = preprop(_p.rscratch, "labelAngle", prefix); + var ox = ele2.pstyle(prefixDash + "text-margin-x").pfValue; + var oy = ele2.pstyle(prefixDash + "text-margin-y").pfValue; + var lx1 = bb.x1 - th - ox; + var lx2 = bb.x2 + th - ox; + var ly1 = bb.y1 - th - oy; + var ly2 = bb.y2 + th - oy; + if (theta) { + var cos3 = Math.cos(theta); + var sin3 = Math.sin(theta); + var rotate2 = /* @__PURE__ */ __name(function rotate3(x6, y7) { + x6 = x6 - lx; + y7 = y7 - ly; + return { + x: x6 * cos3 - y7 * sin3 + lx, + y: x6 * sin3 + y7 * cos3 + ly + }; + }, "rotate"); + var px1y1 = rotate2(lx1, ly1); + var px1y2 = rotate2(lx1, ly2); + var px2y1 = rotate2(lx2, ly1); + var px2y2 = rotate2(lx2, ly2); + var points = [ + // with the margin added after the rotation is applied + px1y1.x + ox, + px1y1.y + oy, + px2y1.x + ox, + px2y1.y + oy, + px2y2.x + ox, + px2y2.y + oy, + px1y2.x + ox, + px1y2.y + oy + ]; + if (pointInsidePolygonPoints(x5, y6, points)) { + addEle(ele2); + return true; + } + } else { + if (inBoundingBox(bb, x5, y6)) { + addEle(ele2); + return true; + } + } + } + __name(checkLabel, "checkLabel"); + for (var i2 = eles.length - 1; i2 >= 0; i2--) { + var ele = eles[i2]; + if (ele.isNode()) { + checkNode(ele) || checkLabel(ele); + } else { + checkEdge(ele) || checkLabel(ele) || checkLabel(ele, "source") || checkLabel(ele, "target"); + } + } + return near; + }; + BRp$e.getAllInBox = function(x1, y1, x22, y22) { + var eles = this.getCachedZSortedEles().interactive; + var zoom2 = this.cy.zoom(); + var labelThreshold = 2 / zoom2; + var box = []; + var x1c = Math.min(x1, x22); + var x2c = Math.max(x1, x22); + var y1c = Math.min(y1, y22); + var y2c = Math.max(y1, y22); + x1 = x1c; + x22 = x2c; + y1 = y1c; + y22 = y2c; + var boxBb = makeBoundingBox({ + x1, + y1, + x2: x22, + y2: y22 + }); + var selectionBox = [{ + x: boxBb.x1, + y: boxBb.y1 + }, { + x: boxBb.x2, + y: boxBb.y1 + }, { + x: boxBb.x2, + y: boxBb.y2 + }, { + x: boxBb.x1, + y: boxBb.y2 + }]; + var boxEdges = [[selectionBox[0], selectionBox[1]], [selectionBox[1], selectionBox[2]], [selectionBox[2], selectionBox[3]], [selectionBox[3], selectionBox[0]]]; + function preprop(obj, name, pre) { + return getPrefixedProperty(obj, name, pre); + } + __name(preprop, "preprop"); + function getRotatedLabelBox(ele2, prefix) { + var _p2 = ele2._private; + var th = labelThreshold; + var prefixDash = ""; + ele2.boundingBox(); + var bb = _p2.labelBounds["main"]; + if (!bb) { + return null; + } + var lx = preprop(_p2.rscratch, "labelX", prefix); + var ly = preprop(_p2.rscratch, "labelY", prefix); + var theta = preprop(_p2.rscratch, "labelAngle", prefix); + var ox = ele2.pstyle(prefixDash + "text-margin-x").pfValue; + var oy = ele2.pstyle(prefixDash + "text-margin-y").pfValue; + var lx1 = bb.x1 - th - ox; + var lx2 = bb.x2 + th - ox; + var ly1 = bb.y1 - th - oy; + var ly2 = bb.y2 + th - oy; + if (theta) { + var cos3 = Math.cos(theta); + var sin3 = Math.sin(theta); + var rotate2 = /* @__PURE__ */ __name(function rotate3(x5, y6) { + x5 = x5 - lx; + y6 = y6 - ly; + return { + x: x5 * cos3 - y6 * sin3 + lx, + y: x5 * sin3 + y6 * cos3 + ly + }; + }, "rotate"); + return [rotate2(lx1, ly1), rotate2(lx2, ly1), rotate2(lx2, ly2), rotate2(lx1, ly2)]; + } else { + return [{ + x: lx1, + y: ly1 + }, { + x: lx2, + y: ly1 + }, { + x: lx2, + y: ly2 + }, { + x: lx1, + y: ly2 + }]; + } + } + __name(getRotatedLabelBox, "getRotatedLabelBox"); + function doLinesIntersect(p1, p22, q1, q22) { + function ccw(a2, b4, c3) { + return (c3.y - a2.y) * (b4.x - a2.x) > (b4.y - a2.y) * (c3.x - a2.x); + } + __name(ccw, "ccw"); + return ccw(p1, q1, q22) !== ccw(p22, q1, q22) && ccw(p1, p22, q1) !== ccw(p1, p22, q22); + } + __name(doLinesIntersect, "doLinesIntersect"); + for (var e3 = 0; e3 < eles.length; e3++) { + var ele = eles[e3]; + if (ele.isNode()) { + var node2 = ele; + var textEvents = node2.pstyle("text-events").strValue === "yes"; + var nodeBoxSelectMode = node2.pstyle("box-selection").strValue; + var labelBoxSelectEnabled = node2.pstyle("box-select-labels").strValue === "yes"; + if (nodeBoxSelectMode === "none") { + continue; + } + var includeLabels = (nodeBoxSelectMode === "overlap" || labelBoxSelectEnabled) && textEvents; + var nodeBb = node2.boundingBox({ + includeNodes: true, + includeEdges: false, + includeLabels + }); + if (nodeBoxSelectMode === "contain") { + var selected = false; + if (labelBoxSelectEnabled && textEvents) { + var rotatedLabelBox = getRotatedLabelBox(node2); + if (rotatedLabelBox && satPolygonIntersection(rotatedLabelBox, selectionBox)) { + box.push(node2); + selected = true; + } + } + if (!selected && boundingBoxInBoundingBox(boxBb, nodeBb)) { + box.push(node2); + } + } else if (nodeBoxSelectMode === "overlap") { + if (boundingBoxesIntersect(boxBb, nodeBb)) { + var nodeBodyBb = node2.boundingBox({ + includeNodes: true, + includeEdges: true, + includeLabels: false, + includeMainLabels: false, + includeSourceLabels: false, + includeTargetLabels: false + }); + var nodeBodyCorners = [{ + x: nodeBodyBb.x1, + y: nodeBodyBb.y1 + }, { + x: nodeBodyBb.x2, + y: nodeBodyBb.y1 + }, { + x: nodeBodyBb.x2, + y: nodeBodyBb.y2 + }, { + x: nodeBodyBb.x1, + y: nodeBodyBb.y2 + }]; + if (satPolygonIntersection(nodeBodyCorners, selectionBox)) { + box.push(node2); + } else { + var _rotatedLabelBox = getRotatedLabelBox(node2); + if (_rotatedLabelBox && satPolygonIntersection(_rotatedLabelBox, selectionBox)) { + box.push(node2); + } + } + } + } + } else { + var edge = ele; + var _p = edge._private; + var rs = _p.rscratch; + var edgeBoxSelectMode = edge.pstyle("box-selection").strValue; + if (edgeBoxSelectMode === "none") { + continue; + } + if (edgeBoxSelectMode === "contain") { + if (rs.startX != null && rs.startY != null && !inBoundingBox(boxBb, rs.startX, rs.startY)) { + continue; + } + if (rs.endX != null && rs.endY != null && !inBoundingBox(boxBb, rs.endX, rs.endY)) { + continue; + } + if (rs.edgeType === "bezier" || rs.edgeType === "multibezier" || rs.edgeType === "self" || rs.edgeType === "compound" || rs.edgeType === "segments" || rs.edgeType === "haystack") { + var pts2 = _p.rstyle.bezierPts || _p.rstyle.linePts || _p.rstyle.haystackPts; + var allInside = true; + for (var i2 = 0; i2 < pts2.length; i2++) { + if (!pointInBoundingBox(boxBb, pts2[i2])) { + allInside = false; + break; + } + } + if (allInside) { + box.push(edge); + } + } else if (rs.edgeType === "straight") { + box.push(edge); + } + } else if (edgeBoxSelectMode === "overlap") { + var _selected = false; + if (rs.startX != null && rs.startY != null && rs.endX != null && rs.endY != null && (inBoundingBox(boxBb, rs.startX, rs.startY) || inBoundingBox(boxBb, rs.endX, rs.endY))) { + box.push(edge); + _selected = true; + } else if (!_selected && rs.edgeType === "haystack") { + var haystackPts = _p.rstyle.haystackPts; + for (var _i = 0; _i < haystackPts.length; _i++) { + if (pointInBoundingBox(boxBb, haystackPts[_i])) { + box.push(edge); + _selected = true; + break; + } + } + } + if (!_selected) { + var _pts = _p.rstyle.bezierPts || _p.rstyle.linePts || _p.rstyle.haystackPts; + if ((!_pts || _pts.length < 2) && rs.edgeType === "straight") { + if (rs.startX != null && rs.startY != null && rs.endX != null && rs.endY != null) { + _pts = [{ + x: rs.startX, + y: rs.startY + }, { + x: rs.endX, + y: rs.endY + }]; + } + } + if (!_pts || _pts.length < 2) continue; + for (var _i2 = 0; _i2 < _pts.length - 1; _i2++) { + var segStart = _pts[_i2]; + var segEnd = _pts[_i2 + 1]; + for (var b3 = 0; b3 < boxEdges.length; b3++) { + var _boxEdges$b = _slicedToArray(boxEdges[b3], 2), boxStart = _boxEdges$b[0], boxEnd = _boxEdges$b[1]; + if (doLinesIntersect(segStart, segEnd, boxStart, boxEnd)) { + box.push(edge); + _selected = true; + break; + } + } + if (_selected) break; + } + } + } + } + } + return box; + }; + BRp$d = {}; + BRp$d.calculateArrowAngles = function(edge) { + var rs = edge._private.rscratch; + var isHaystack = rs.edgeType === "haystack"; + var isBezier = rs.edgeType === "bezier"; + var isMultibezier = rs.edgeType === "multibezier"; + var isSegments = rs.edgeType === "segments"; + var isCompound = rs.edgeType === "compound"; + var isSelf = rs.edgeType === "self"; + var dispX, dispY; + var startX2, startY2, endX, endY, midX, midY; + if (isHaystack) { + startX2 = rs.haystackPts[0]; + startY2 = rs.haystackPts[1]; + endX = rs.haystackPts[2]; + endY = rs.haystackPts[3]; + } else { + startX2 = rs.arrowStartX; + startY2 = rs.arrowStartY; + endX = rs.arrowEndX; + endY = rs.arrowEndY; + } + midX = rs.midX; + midY = rs.midY; + if (isSegments) { + dispX = startX2 - rs.segpts[0]; + dispY = startY2 - rs.segpts[1]; + } else if (isMultibezier || isCompound || isSelf || isBezier) { + var pts2 = rs.allpts; + var bX = qbezierAt(pts2[0], pts2[2], pts2[4], 0.1); + var bY = qbezierAt(pts2[1], pts2[3], pts2[5], 0.1); + dispX = startX2 - bX; + dispY = startY2 - bY; + } else { + dispX = startX2 - midX; + dispY = startY2 - midY; + } + rs.srcArrowAngle = getAngleFromDisp(dispX, dispY); + var midX = rs.midX; + var midY = rs.midY; + if (isHaystack) { + midX = (startX2 + endX) / 2; + midY = (startY2 + endY) / 2; + } + dispX = endX - startX2; + dispY = endY - startY2; + if (isSegments) { + var pts2 = rs.allpts; + if (pts2.length / 2 % 2 === 0) { + var i2 = pts2.length / 2; + var i1 = i2 - 2; + dispX = pts2[i2] - pts2[i1]; + dispY = pts2[i2 + 1] - pts2[i1 + 1]; + } else if (rs.isRound) { + dispX = rs.midVector[1]; + dispY = -rs.midVector[0]; + } else { + var i2 = pts2.length / 2 - 1; + var i1 = i2 - 2; + dispX = pts2[i2] - pts2[i1]; + dispY = pts2[i2 + 1] - pts2[i1 + 1]; + } + } else if (isMultibezier || isCompound || isSelf) { + var pts2 = rs.allpts; + var cpts = rs.ctrlpts; + var bp0x, bp0y; + var bp1x, bp1y; + if (cpts.length / 2 % 2 === 0) { + var p0 = pts2.length / 2 - 1; + var ic = p0 + 2; + var p1 = ic + 2; + bp0x = qbezierAt(pts2[p0], pts2[ic], pts2[p1], 0); + bp0y = qbezierAt(pts2[p0 + 1], pts2[ic + 1], pts2[p1 + 1], 0); + bp1x = qbezierAt(pts2[p0], pts2[ic], pts2[p1], 1e-4); + bp1y = qbezierAt(pts2[p0 + 1], pts2[ic + 1], pts2[p1 + 1], 1e-4); + } else { + var ic = pts2.length / 2 - 1; + var p0 = ic - 2; + var p1 = ic + 2; + bp0x = qbezierAt(pts2[p0], pts2[ic], pts2[p1], 0.4999); + bp0y = qbezierAt(pts2[p0 + 1], pts2[ic + 1], pts2[p1 + 1], 0.4999); + bp1x = qbezierAt(pts2[p0], pts2[ic], pts2[p1], 0.5); + bp1y = qbezierAt(pts2[p0 + 1], pts2[ic + 1], pts2[p1 + 1], 0.5); + } + dispX = bp1x - bp0x; + dispY = bp1y - bp0y; + } + rs.midtgtArrowAngle = getAngleFromDisp(dispX, dispY); + rs.midDispX = dispX; + rs.midDispY = dispY; + dispX *= -1; + dispY *= -1; + if (isSegments) { + var pts2 = rs.allpts; + if (pts2.length / 2 % 2 === 0) ; + else if (!rs.isRound) { + var i2 = pts2.length / 2 - 1; + var i3 = i2 + 2; + dispX = -(pts2[i3] - pts2[i2]); + dispY = -(pts2[i3 + 1] - pts2[i2 + 1]); + } + } + rs.midsrcArrowAngle = getAngleFromDisp(dispX, dispY); + if (isSegments) { + dispX = endX - rs.segpts[rs.segpts.length - 2]; + dispY = endY - rs.segpts[rs.segpts.length - 1]; + } else if (isMultibezier || isCompound || isSelf || isBezier) { + var pts2 = rs.allpts; + var l4 = pts2.length; + var bX = qbezierAt(pts2[l4 - 6], pts2[l4 - 4], pts2[l4 - 2], 0.9); + var bY = qbezierAt(pts2[l4 - 5], pts2[l4 - 3], pts2[l4 - 1], 0.9); + dispX = endX - bX; + dispY = endY - bY; + } else { + dispX = endX - midX; + dispY = endY - midY; + } + rs.tgtArrowAngle = getAngleFromDisp(dispX, dispY); + }; + BRp$d.getArrowWidth = BRp$d.getArrowHeight = function(edgeWidth, scale3) { + var cache3 = this.arrowWidthCache = this.arrowWidthCache || {}; + var cachedVal = cache3[edgeWidth + ", " + scale3]; + if (cachedVal) { + return cachedVal; + } + cachedVal = Math.max(Math.pow(edgeWidth * 13.37, 0.9), 29) * scale3; + cache3[edgeWidth + ", " + scale3] = cachedVal; + return cachedVal; + }; + v1 = {}; + v22 = {}; + asVec = /* @__PURE__ */ __name(function asVec2(p3, pp, v3) { + v3.x = pp.x - p3.x; + v3.y = pp.y - p3.y; + v3.len = Math.sqrt(v3.x * v3.x + v3.y * v3.y); + v3.nx = v3.x / v3.len; + v3.ny = v3.y / v3.len; + v3.ang = Math.atan2(v3.ny, v3.nx); + }, "asVec"); + invertVec = /* @__PURE__ */ __name(function invertVec2(originalV, invertedV) { + invertedV.x = originalV.x * -1; + invertedV.y = originalV.y * -1; + invertedV.nx = originalV.nx * -1; + invertedV.ny = originalV.ny * -1; + invertedV.ang = originalV.ang > 0 ? -(Math.PI - originalV.ang) : Math.PI + originalV.ang; + }, "invertVec"); + calcCornerArc = /* @__PURE__ */ __name(function calcCornerArc2(previousPoint, currentPoint, nextPoint, radiusMax, isArcRadius) { + previousPoint !== lastPoint ? asVec(currentPoint, previousPoint, v1) : invertVec(v22, v1); + asVec(currentPoint, nextPoint, v22); + sinA = v1.nx * v22.ny - v1.ny * v22.nx; + sinA90 = v1.nx * v22.nx - v1.ny * -v22.ny; + angle = Math.asin(Math.max(-1, Math.min(1, sinA))); + if (Math.abs(angle) < 1e-6) { + x3 = currentPoint.x; + y4 = currentPoint.y; + cRadius = radius = 0; + return; + } + radDirection = 1; + drawDirection = false; + if (sinA90 < 0) { + if (angle < 0) { + angle = Math.PI + angle; + } else { + angle = Math.PI - angle; + radDirection = -1; + drawDirection = true; + } + } else { + if (angle > 0) { + radDirection = -1; + drawDirection = true; + } + } + if (currentPoint.radius !== void 0) { + radius = currentPoint.radius; + } else { + radius = radiusMax; + } + halfAngle = angle / 2; + limit = Math.min(v1.len / 2, v22.len / 2); + if (isArcRadius) { + lenOut = Math.abs(Math.cos(halfAngle) * radius / Math.sin(halfAngle)); + if (lenOut > limit) { + lenOut = limit; + cRadius = Math.abs(lenOut * Math.sin(halfAngle) / Math.cos(halfAngle)); + } else { + cRadius = radius; + } + } else { + lenOut = Math.min(limit, radius); + cRadius = Math.abs(lenOut * Math.sin(halfAngle) / Math.cos(halfAngle)); + } + stopX = currentPoint.x + v22.nx * lenOut; + stopY = currentPoint.y + v22.ny * lenOut; + x3 = stopX - v22.ny * cRadius * radDirection; + y4 = stopY + v22.nx * cRadius * radDirection; + startX = currentPoint.x + v1.nx * lenOut; + startY = currentPoint.y + v1.ny * lenOut; + lastPoint = currentPoint; + }, "calcCornerArc"); + __name(drawPreparedRoundCorner, "drawPreparedRoundCorner"); + __name(getRoundCorner, "getRoundCorner"); + AVOID_IMPOSSIBLE_BEZIER_CONSTANT = 0.01; + AVOID_IMPOSSIBLE_BEZIER_CONSTANT_L = Math.sqrt(2 * AVOID_IMPOSSIBLE_BEZIER_CONSTANT); + BRp$c = {}; + BRp$c.findMidptPtsEtc = function(edge, pairInfo) { + var posPts = pairInfo.posPts, intersectionPts = pairInfo.intersectionPts, vectorNormInverse = pairInfo.vectorNormInverse; + var midptPts; + var srcManEndpt = edge.pstyle("source-endpoint"); + var tgtManEndpt = edge.pstyle("target-endpoint"); + var haveManualEndPts = srcManEndpt.units != null && tgtManEndpt.units != null; + var recalcVectorNormInverse = /* @__PURE__ */ __name(function recalcVectorNormInverse2(x12, y12, x23, y23) { + var dy = y23 - y12; + var dx = x23 - x12; + var l4 = Math.sqrt(dx * dx + dy * dy); + return { + x: -dy / l4, + y: dx / l4 + }; + }, "recalcVectorNormInverse"); + var edgeDistances = edge.pstyle("edge-distances").value; + switch (edgeDistances) { + case "node-position": + midptPts = posPts; + break; + case "intersection": + midptPts = intersectionPts; + break; + case "endpoints": { + if (haveManualEndPts) { + var _this$manualEndptToPx = this.manualEndptToPx(edge.source()[0], srcManEndpt), _this$manualEndptToPx2 = _slicedToArray(_this$manualEndptToPx, 2), x1 = _this$manualEndptToPx2[0], y1 = _this$manualEndptToPx2[1]; + var _this$manualEndptToPx3 = this.manualEndptToPx(edge.target()[0], tgtManEndpt), _this$manualEndptToPx4 = _slicedToArray(_this$manualEndptToPx3, 2), x22 = _this$manualEndptToPx4[0], y22 = _this$manualEndptToPx4[1]; + var endPts = { + x1, + y1, + x2: x22, + y2: y22 + }; + vectorNormInverse = recalcVectorNormInverse(x1, y1, x22, y22); + midptPts = endPts; + } else { + warn("Edge ".concat(edge.id(), " has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")); + midptPts = intersectionPts; + } + break; + } + } + return { + midptPts, + vectorNormInverse + }; + }; + BRp$c.findHaystackPoints = function(edges3) { + for (var i2 = 0; i2 < edges3.length; i2++) { + var edge = edges3[i2]; + var _p = edge._private; + var rs = _p.rscratch; + if (!rs.haystack) { + var angle2 = Math.random() * 2 * Math.PI; + rs.source = { + x: Math.cos(angle2), + y: Math.sin(angle2) + }; + angle2 = Math.random() * 2 * Math.PI; + rs.target = { + x: Math.cos(angle2), + y: Math.sin(angle2) + }; + } + var src = _p.source; + var tgt = _p.target; + var srcPos = src.position(); + var tgtPos = tgt.position(); + var srcW = src.width(); + var tgtW = tgt.width(); + var srcH = src.height(); + var tgtH = tgt.height(); + var radius2 = edge.pstyle("haystack-radius").value; + var halfRadius = radius2 / 2; + rs.haystackPts = rs.allpts = [rs.source.x * srcW * halfRadius + srcPos.x, rs.source.y * srcH * halfRadius + srcPos.y, rs.target.x * tgtW * halfRadius + tgtPos.x, rs.target.y * tgtH * halfRadius + tgtPos.y]; + rs.midX = (rs.allpts[0] + rs.allpts[2]) / 2; + rs.midY = (rs.allpts[1] + rs.allpts[3]) / 2; + rs.edgeType = "haystack"; + rs.haystack = true; + this.storeEdgeProjections(edge); + this.calculateArrowAngles(edge); + this.recalculateEdgeLabelProjections(edge); + this.calculateLabelAngles(edge); + } + }; + BRp$c.findSegmentsPoints = function(edge, pairInfo) { + var rs = edge._private.rscratch; + var segmentWs = edge.pstyle("segment-weights"); + var segmentDs = edge.pstyle("segment-distances"); + var segmentRs = edge.pstyle("segment-radii"); + var segmentTs = edge.pstyle("radius-type"); + var segmentsN = Math.min(segmentWs.pfValue.length, segmentDs.pfValue.length); + var lastRadius = segmentRs.pfValue[segmentRs.pfValue.length - 1]; + var lastRadiusType = segmentTs.pfValue[segmentTs.pfValue.length - 1]; + rs.edgeType = "segments"; + rs.segpts = []; + rs.radii = []; + rs.isArcRadius = []; + for (var s2 = 0; s2 < segmentsN; s2++) { + var w4 = segmentWs.pfValue[s2]; + var d3 = segmentDs.pfValue[s2]; + var w1 = 1 - w4; + var w22 = w4; + var _this$findMidptPtsEtc = this.findMidptPtsEtc(edge, pairInfo), midptPts = _this$findMidptPtsEtc.midptPts, vectorNormInverse = _this$findMidptPtsEtc.vectorNormInverse; + var adjustedMidpt = { + x: midptPts.x1 * w1 + midptPts.x2 * w22, + y: midptPts.y1 * w1 + midptPts.y2 * w22 + }; + rs.segpts.push(adjustedMidpt.x + vectorNormInverse.x * d3, adjustedMidpt.y + vectorNormInverse.y * d3); + rs.radii.push(segmentRs.pfValue[s2] !== void 0 ? segmentRs.pfValue[s2] : lastRadius); + rs.isArcRadius.push((segmentTs.pfValue[s2] !== void 0 ? segmentTs.pfValue[s2] : lastRadiusType) === "arc-radius"); + } + }; + BRp$c.findLoopPoints = function(edge, pairInfo, i2, edgeIsUnbundled) { + var rs = edge._private.rscratch; + var dirCounts = pairInfo.dirCounts, srcPos = pairInfo.srcPos; + var ctrlptDists = edge.pstyle("control-point-distances"); + var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : void 0; + var loopDir = edge.pstyle("loop-direction").pfValue; + var loopSwp = edge.pstyle("loop-sweep").pfValue; + var stepSize = edge.pstyle("control-point-step-size").pfValue; + rs.edgeType = "self"; + var j3 = i2; + var loopDist = stepSize; + if (edgeIsUnbundled) { + j3 = 0; + loopDist = ctrlptDist; + } + var loopAngle = loopDir - Math.PI / 2; + var outAngle = loopAngle - loopSwp / 2; + var inAngle = loopAngle + loopSwp / 2; + var dc = String(loopDir + "_" + loopSwp); + j3 = dirCounts[dc] === void 0 ? dirCounts[dc] = 0 : ++dirCounts[dc]; + rs.ctrlpts = [srcPos.x + Math.cos(outAngle) * 1.4 * loopDist * (j3 / 3 + 1), srcPos.y + Math.sin(outAngle) * 1.4 * loopDist * (j3 / 3 + 1), srcPos.x + Math.cos(inAngle) * 1.4 * loopDist * (j3 / 3 + 1), srcPos.y + Math.sin(inAngle) * 1.4 * loopDist * (j3 / 3 + 1)]; + }; + BRp$c.findCompoundLoopPoints = function(edge, pairInfo, i2, edgeIsUnbundled) { + var rs = edge._private.rscratch; + rs.edgeType = "compound"; + var srcPos = pairInfo.srcPos, tgtPos = pairInfo.tgtPos, srcW = pairInfo.srcW, srcH = pairInfo.srcH, tgtW = pairInfo.tgtW, tgtH = pairInfo.tgtH; + var stepSize = edge.pstyle("control-point-step-size").pfValue; + var ctrlptDists = edge.pstyle("control-point-distances"); + var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : void 0; + var j3 = i2; + var loopDist = stepSize; + if (edgeIsUnbundled) { + j3 = 0; + loopDist = ctrlptDist; + } + var loopW = 50; + var loopaPos = { + x: srcPos.x - srcW / 2, + y: srcPos.y - srcH / 2 + }; + var loopbPos = { + x: tgtPos.x - tgtW / 2, + y: tgtPos.y - tgtH / 2 + }; + var loopPos = { + x: Math.min(loopaPos.x, loopbPos.x), + y: Math.min(loopaPos.y, loopbPos.y) + }; + var minCompoundStretch = 0.5; + var compoundStretchA = Math.max(minCompoundStretch, Math.log(srcW * AVOID_IMPOSSIBLE_BEZIER_CONSTANT)); + var compoundStretchB = Math.max(minCompoundStretch, Math.log(tgtW * AVOID_IMPOSSIBLE_BEZIER_CONSTANT)); + rs.ctrlpts = [loopPos.x, loopPos.y - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j3 / 3 + 1) * compoundStretchA, loopPos.x - (1 + Math.pow(loopW, 1.12) / 100) * loopDist * (j3 / 3 + 1) * compoundStretchB, loopPos.y]; + }; + BRp$c.findStraightEdgePoints = function(edge) { + edge._private.rscratch.edgeType = "straight"; + }; + BRp$c.findBezierPoints = function(edge, pairInfo, i2, edgeIsUnbundled, edgeIsSwapped) { + var rs = edge._private.rscratch; + var stepSize = edge.pstyle("control-point-step-size").pfValue; + var ctrlptDists = edge.pstyle("control-point-distances"); + var ctrlptWs = edge.pstyle("control-point-weights"); + var bezierN = ctrlptDists && ctrlptWs ? Math.min(ctrlptDists.value.length, ctrlptWs.value.length) : 1; + var ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[0] : void 0; + var ctrlptWeight = ctrlptWs.value[0]; + var multi = edgeIsUnbundled; + rs.edgeType = multi ? "multibezier" : "bezier"; + rs.ctrlpts = []; + for (var b3 = 0; b3 < bezierN; b3++) { + var normctrlptDist = (0.5 - pairInfo.eles.length / 2 + i2) * stepSize * (edgeIsSwapped ? -1 : 1); + var manctrlptDist = void 0; + var sign2 = signum(normctrlptDist); + if (multi) { + ctrlptDist = ctrlptDists ? ctrlptDists.pfValue[b3] : stepSize; + ctrlptWeight = ctrlptWs.value[b3]; + } + if (edgeIsUnbundled) { + manctrlptDist = ctrlptDist; + } else { + manctrlptDist = ctrlptDist !== void 0 ? sign2 * ctrlptDist : void 0; + } + var distanceFromMidpoint = manctrlptDist !== void 0 ? manctrlptDist : normctrlptDist; + var w1 = 1 - ctrlptWeight; + var w22 = ctrlptWeight; + var _this$findMidptPtsEtc2 = this.findMidptPtsEtc(edge, pairInfo), midptPts = _this$findMidptPtsEtc2.midptPts, vectorNormInverse = _this$findMidptPtsEtc2.vectorNormInverse; + var adjustedMidpt = { + x: midptPts.x1 * w1 + midptPts.x2 * w22, + y: midptPts.y1 * w1 + midptPts.y2 * w22 + }; + rs.ctrlpts.push(adjustedMidpt.x + vectorNormInverse.x * distanceFromMidpoint, adjustedMidpt.y + vectorNormInverse.y * distanceFromMidpoint); + } + }; + BRp$c.findTaxiPoints = function(edge, pairInfo) { + var rs = edge._private.rscratch; + rs.edgeType = "segments"; + var VERTICAL = "vertical"; + var HORIZONTAL = "horizontal"; + var LEFTWARD = "leftward"; + var RIGHTWARD = "rightward"; + var DOWNWARD = "downward"; + var UPWARD = "upward"; + var AUTO = "auto"; + var posPts = pairInfo.posPts, srcW = pairInfo.srcW, srcH = pairInfo.srcH, tgtW = pairInfo.tgtW, tgtH = pairInfo.tgtH; + var edgeDistances = edge.pstyle("edge-distances").value; + var dIncludesNodeBody = edgeDistances !== "node-position"; + var taxiDir = edge.pstyle("taxi-direction").value; + var rawTaxiDir = taxiDir; + var taxiTurn = edge.pstyle("taxi-turn"); + var turnIsPercent = taxiTurn.units === "%"; + var taxiTurnPfVal = taxiTurn.pfValue; + var turnIsNegative = taxiTurnPfVal < 0; + var minD = edge.pstyle("taxi-turn-min-distance").pfValue; + var dw = dIncludesNodeBody ? (srcW + tgtW) / 2 : 0; + var dh = dIncludesNodeBody ? (srcH + tgtH) / 2 : 0; + var pdx = posPts.x2 - posPts.x1; + var pdy = posPts.y2 - posPts.y1; + var subDWH = /* @__PURE__ */ __name(function subDWH2(dxy, dwh) { + if (dxy > 0) { + return Math.max(dxy - dwh, 0); + } else { + return Math.min(dxy + dwh, 0); + } + }, "subDWH"); + var dx = subDWH(pdx, dw); + var dy = subDWH(pdy, dh); + var isExplicitDir = false; + if (rawTaxiDir === AUTO) { + taxiDir = Math.abs(dx) > Math.abs(dy) ? HORIZONTAL : VERTICAL; + } else if (rawTaxiDir === UPWARD || rawTaxiDir === DOWNWARD) { + taxiDir = VERTICAL; + isExplicitDir = true; + } else if (rawTaxiDir === LEFTWARD || rawTaxiDir === RIGHTWARD) { + taxiDir = HORIZONTAL; + isExplicitDir = true; + } + var isVert = taxiDir === VERTICAL; + var l4 = isVert ? dy : dx; + var pl = isVert ? pdy : pdx; + var sgnL = signum(pl); + var forcedDir = false; + if (!(isExplicitDir && (turnIsPercent || turnIsNegative)) && (rawTaxiDir === DOWNWARD && pl < 0 || rawTaxiDir === UPWARD && pl > 0 || rawTaxiDir === LEFTWARD && pl > 0 || rawTaxiDir === RIGHTWARD && pl < 0)) { + sgnL *= -1; + l4 = sgnL * Math.abs(l4); + forcedDir = true; + } + var d3; + if (turnIsPercent) { + var p3 = taxiTurnPfVal < 0 ? 1 + taxiTurnPfVal : taxiTurnPfVal; + d3 = p3 * l4; + } else { + var k2 = taxiTurnPfVal < 0 ? l4 : 0; + d3 = k2 + taxiTurnPfVal * sgnL; + } + var getIsTooClose = /* @__PURE__ */ __name(function getIsTooClose2(d4) { + return Math.abs(d4) < minD || Math.abs(d4) >= Math.abs(l4); + }, "getIsTooClose"); + var isTooCloseSrc = getIsTooClose(d3); + var isTooCloseTgt = getIsTooClose(Math.abs(l4) - Math.abs(d3)); + var isTooClose = isTooCloseSrc || isTooCloseTgt; + if (isTooClose && !forcedDir) { + if (isVert) { + var lShapeInsideSrc = Math.abs(pl) <= srcH / 2; + var lShapeInsideTgt = Math.abs(pdx) <= tgtW / 2; + if (lShapeInsideSrc) { + var x5 = (posPts.x1 + posPts.x2) / 2; + var y1 = posPts.y1, y22 = posPts.y2; + rs.segpts = [x5, y1, x5, y22]; + } else if (lShapeInsideTgt) { + var y6 = (posPts.y1 + posPts.y2) / 2; + var x1 = posPts.x1, x22 = posPts.x2; + rs.segpts = [x1, y6, x22, y6]; + } else { + rs.segpts = [posPts.x1, posPts.y2]; + } + } else { + var _lShapeInsideSrc = Math.abs(pl) <= srcW / 2; + var _lShapeInsideTgt = Math.abs(pdy) <= tgtH / 2; + if (_lShapeInsideSrc) { + var _y = (posPts.y1 + posPts.y2) / 2; + var _x = posPts.x1, _x2 = posPts.x2; + rs.segpts = [_x, _y, _x2, _y]; + } else if (_lShapeInsideTgt) { + var _x3 = (posPts.x1 + posPts.x2) / 2; + var _y2 = posPts.y1, _y3 = posPts.y2; + rs.segpts = [_x3, _y2, _x3, _y3]; + } else { + rs.segpts = [posPts.x2, posPts.y1]; + } + } + } else { + if (isVert) { + var _y4 = posPts.y1 + d3 + (dIncludesNodeBody ? srcH / 2 * sgnL : 0); + var _x4 = posPts.x1, _x5 = posPts.x2; + rs.segpts = [_x4, _y4, _x5, _y4]; + } else { + var _x6 = posPts.x1 + d3 + (dIncludesNodeBody ? srcW / 2 * sgnL : 0); + var _y5 = posPts.y1, _y6 = posPts.y2; + rs.segpts = [_x6, _y5, _x6, _y6]; + } + } + if (rs.isRound) { + var radius2 = edge.pstyle("taxi-radius").value; + var isArcRadius = edge.pstyle("radius-type").value[0] === "arc-radius"; + rs.radii = new Array(rs.segpts.length / 2).fill(radius2); + rs.isArcRadius = new Array(rs.segpts.length / 2).fill(isArcRadius); + } + }; + BRp$c.tryToCorrectInvalidPoints = function(edge, pairInfo) { + var rs = edge._private.rscratch; + if (rs.edgeType === "bezier") { + var srcPos = pairInfo.srcPos, tgtPos = pairInfo.tgtPos, srcW = pairInfo.srcW, srcH = pairInfo.srcH, tgtW = pairInfo.tgtW, tgtH = pairInfo.tgtH, srcShape = pairInfo.srcShape, tgtShape = pairInfo.tgtShape, srcCornerRadius = pairInfo.srcCornerRadius, tgtCornerRadius = pairInfo.tgtCornerRadius, srcRs = pairInfo.srcRs, tgtRs = pairInfo.tgtRs; + var badStart = !number$1(rs.startX) || !number$1(rs.startY); + var badAStart = !number$1(rs.arrowStartX) || !number$1(rs.arrowStartY); + var badEnd = !number$1(rs.endX) || !number$1(rs.endY); + var badAEnd = !number$1(rs.arrowEndX) || !number$1(rs.arrowEndY); + var minCpADistFactor = 3; + var arrowW = this.getArrowWidth(edge.pstyle("width").pfValue, edge.pstyle("arrow-scale").value) * this.arrowShapeWidth; + var minCpADist = minCpADistFactor * arrowW; + var startACpDist = dist({ + x: rs.ctrlpts[0], + y: rs.ctrlpts[1] + }, { + x: rs.startX, + y: rs.startY + }); + var closeStartACp = startACpDist < minCpADist; + var endACpDist = dist({ + x: rs.ctrlpts[0], + y: rs.ctrlpts[1] + }, { + x: rs.endX, + y: rs.endY + }); + var closeEndACp = endACpDist < minCpADist; + var overlapping = false; + if (badStart || badAStart || closeStartACp) { + overlapping = true; + var cpD = { + // delta + x: rs.ctrlpts[0] - srcPos.x, + y: rs.ctrlpts[1] - srcPos.y + }; + var cpL = Math.sqrt(cpD.x * cpD.x + cpD.y * cpD.y); + var cpM = { + // normalised delta + x: cpD.x / cpL, + y: cpD.y / cpL + }; + var radius2 = Math.max(srcW, srcH); + var cpProj = { + // *2 radius guarantees outside shape + x: rs.ctrlpts[0] + cpM.x * 2 * radius2, + y: rs.ctrlpts[1] + cpM.y * 2 * radius2 + }; + var srcCtrlPtIntn = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, cpProj.x, cpProj.y, 0, srcCornerRadius, srcRs); + if (closeStartACp) { + rs.ctrlpts[0] = rs.ctrlpts[0] + cpM.x * (minCpADist - startACpDist); + rs.ctrlpts[1] = rs.ctrlpts[1] + cpM.y * (minCpADist - startACpDist); + } else { + rs.ctrlpts[0] = srcCtrlPtIntn[0] + cpM.x * minCpADist; + rs.ctrlpts[1] = srcCtrlPtIntn[1] + cpM.y * minCpADist; + } + } + if (badEnd || badAEnd || closeEndACp) { + overlapping = true; + var _cpD = { + // delta + x: rs.ctrlpts[0] - tgtPos.x, + y: rs.ctrlpts[1] - tgtPos.y + }; + var _cpL = Math.sqrt(_cpD.x * _cpD.x + _cpD.y * _cpD.y); + var _cpM = { + // normalised delta + x: _cpD.x / _cpL, + y: _cpD.y / _cpL + }; + var _radius = Math.max(srcW, srcH); + var _cpProj = { + // *2 radius guarantees outside shape + x: rs.ctrlpts[0] + _cpM.x * 2 * _radius, + y: rs.ctrlpts[1] + _cpM.y * 2 * _radius + }; + var tgtCtrlPtIntn = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, _cpProj.x, _cpProj.y, 0, tgtCornerRadius, tgtRs); + if (closeEndACp) { + rs.ctrlpts[0] = rs.ctrlpts[0] + _cpM.x * (minCpADist - endACpDist); + rs.ctrlpts[1] = rs.ctrlpts[1] + _cpM.y * (minCpADist - endACpDist); + } else { + rs.ctrlpts[0] = tgtCtrlPtIntn[0] + _cpM.x * minCpADist; + rs.ctrlpts[1] = tgtCtrlPtIntn[1] + _cpM.y * minCpADist; + } + } + if (overlapping) { + this.findEndpoints(edge); + } + } + }; + BRp$c.storeAllpts = function(edge) { + var rs = edge._private.rscratch; + if (rs.edgeType === "multibezier" || rs.edgeType === "bezier" || rs.edgeType === "self" || rs.edgeType === "compound") { + rs.allpts = []; + rs.allpts.push(rs.startX, rs.startY); + for (var b3 = 0; b3 + 1 < rs.ctrlpts.length; b3 += 2) { + rs.allpts.push(rs.ctrlpts[b3], rs.ctrlpts[b3 + 1]); + if (b3 + 3 < rs.ctrlpts.length) { + rs.allpts.push((rs.ctrlpts[b3] + rs.ctrlpts[b3 + 2]) / 2, (rs.ctrlpts[b3 + 1] + rs.ctrlpts[b3 + 3]) / 2); + } + } + rs.allpts.push(rs.endX, rs.endY); + var m3, mt; + if (rs.ctrlpts.length / 2 % 2 === 0) { + m3 = rs.allpts.length / 2 - 1; + rs.midX = rs.allpts[m3]; + rs.midY = rs.allpts[m3 + 1]; + } else { + m3 = rs.allpts.length / 2 - 3; + mt = 0.5; + rs.midX = qbezierAt(rs.allpts[m3], rs.allpts[m3 + 2], rs.allpts[m3 + 4], mt); + rs.midY = qbezierAt(rs.allpts[m3 + 1], rs.allpts[m3 + 3], rs.allpts[m3 + 5], mt); + } + } else if (rs.edgeType === "straight") { + rs.allpts = [rs.startX, rs.startY, rs.endX, rs.endY]; + rs.midX = (rs.startX + rs.endX + rs.arrowStartX + rs.arrowEndX) / 4; + rs.midY = (rs.startY + rs.endY + rs.arrowStartY + rs.arrowEndY) / 4; + } else if (rs.edgeType === "segments") { + rs.allpts = []; + rs.allpts.push(rs.startX, rs.startY); + rs.allpts.push.apply(rs.allpts, rs.segpts); + rs.allpts.push(rs.endX, rs.endY); + if (rs.isRound) { + rs.roundCorners = []; + for (var i2 = 2; i2 + 3 < rs.allpts.length; i2 += 2) { + var radius2 = rs.radii[i2 / 2 - 1]; + var isArcRadius = rs.isArcRadius[i2 / 2 - 1]; + rs.roundCorners.push(getRoundCorner({ + x: rs.allpts[i2 - 2], + y: rs.allpts[i2 - 1] + }, { + x: rs.allpts[i2], + y: rs.allpts[i2 + 1], + radius: radius2 + }, { + x: rs.allpts[i2 + 2], + y: rs.allpts[i2 + 3] + }, radius2, isArcRadius)); + } + } + if (rs.segpts.length % 4 === 0) { + var i22 = rs.segpts.length / 2; + var i1 = i22 - 2; + rs.midX = (rs.segpts[i1] + rs.segpts[i22]) / 2; + rs.midY = (rs.segpts[i1 + 1] + rs.segpts[i22 + 1]) / 2; + } else { + var _i = rs.segpts.length / 2 - 1; + if (!rs.isRound) { + rs.midX = rs.segpts[_i]; + rs.midY = rs.segpts[_i + 1]; + } else { + var point8 = { + x: rs.segpts[_i], + y: rs.segpts[_i + 1] + }; + var corner = rs.roundCorners[_i / 2]; + if (corner.radius === 0) { + var nextPoint = { + x: rs.segpts[_i + 2], + y: rs.segpts[_i + 3] + }; + rs.midX = point8.x; + rs.midY = point8.y; + rs.midVector = [point8.y - nextPoint.y, nextPoint.x - point8.x]; + } else { + var v3 = [point8.x - corner.cx, point8.y - corner.cy]; + var factor = corner.radius / Math.sqrt(Math.pow(v3[0], 2) + Math.pow(v3[1], 2)); + v3 = v3.map(function(c3) { + return c3 * factor; + }); + rs.midX = corner.cx + v3[0]; + rs.midY = corner.cy + v3[1]; + rs.midVector = v3; + } + } + } + } + }; + BRp$c.checkForInvalidEdgeWarning = function(edge) { + var rs = edge[0]._private.rscratch; + if (rs.nodesOverlap || number$1(rs.startX) && number$1(rs.startY) && number$1(rs.endX) && number$1(rs.endY)) { + rs.loggedErr = false; + } else { + if (!rs.loggedErr) { + rs.loggedErr = true; + warn("Edge `" + edge.id() + "` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."); + } + } + }; + BRp$c.findEdgeControlPoints = function(edges3) { + var _this = this; + if (!edges3 || edges3.length === 0) { + return; + } + var r2 = this; + var cy = r2.cy; + var hasCompounds = cy.hasCompoundNodes(); + var hashTable = new Map$1(); + var getKey3 = /* @__PURE__ */ __name(function getKey4(pairId2, edgeIsUnbundled2) { + return [].concat(_toConsumableArray(pairId2), [edgeIsUnbundled2 ? 1 : 0]).join("-"); + }, "getKey"); + var pairIds = []; + var haystackEdges = []; + for (var i2 = 0; i2 < edges3.length; i2++) { + var edge = edges3[i2]; + var _p = edge._private; + var curveStyle = edge.pstyle("curve-style").value; + if (edge.removed() || !edge.takesUpSpace()) { + continue; + } + if (curveStyle === "haystack") { + haystackEdges.push(edge); + continue; + } + var edgeIsUnbundled = curveStyle === "unbundled-bezier" || endsWith(curveStyle, "segments") || curveStyle === "straight" || curveStyle === "straight-triangle" || endsWith(curveStyle, "taxi"); + var edgeIsBezier = curveStyle === "unbundled-bezier" || curveStyle === "bezier"; + var src = _p.source; + var tgt = _p.target; + var srcIndex = src.poolIndex(); + var tgtIndex = tgt.poolIndex(); + var pairId = [srcIndex, tgtIndex].sort(); + var key = getKey3(pairId, edgeIsUnbundled); + var tableEntry = hashTable.get(key); + if (tableEntry == null) { + tableEntry = { + eles: [] + }; + pairIds.push({ + pairId, + edgeIsUnbundled + }); + hashTable.set(key, tableEntry); + } + tableEntry.eles.push(edge); + if (edgeIsUnbundled) { + tableEntry.hasUnbundled = true; + } + if (edgeIsBezier) { + tableEntry.hasBezier = true; + } + } + var _loop = /* @__PURE__ */ __name(function _loop2() { + var _pairIds$p = pairIds[p3], pairId2 = _pairIds$p.pairId, edgeIsUnbundled2 = _pairIds$p.edgeIsUnbundled; + var key2 = getKey3(pairId2, edgeIsUnbundled2); + var pairInfo = hashTable.get(key2); + var swappedpairInfo; + if (!pairInfo.hasUnbundled) { + var pllEdges = pairInfo.eles[0].parallelEdges().filter(function(e3) { + return e3.isBundledBezier(); + }); + clearArray(pairInfo.eles); + pllEdges.forEach(function(edge2) { + return pairInfo.eles.push(edge2); + }); + pairInfo.eles.sort(function(edge1, edge2) { + return edge1.poolIndex() - edge2.poolIndex(); + }); + } + var firstEdge = pairInfo.eles[0]; + var src2 = firstEdge.source(); + var tgt2 = firstEdge.target(); + if (src2.poolIndex() > tgt2.poolIndex()) { + var temp = src2; + src2 = tgt2; + tgt2 = temp; + } + var srcPos = pairInfo.srcPos = src2.position(); + var tgtPos = pairInfo.tgtPos = tgt2.position(); + var srcW = pairInfo.srcW = src2.outerWidth(); + var srcH = pairInfo.srcH = src2.outerHeight(); + var tgtW = pairInfo.tgtW = tgt2.outerWidth(); + var tgtH = pairInfo.tgtH = tgt2.outerHeight(); + var srcShape = pairInfo.srcShape = r2.nodeShapes[_this.getNodeShape(src2)]; + var tgtShape = pairInfo.tgtShape = r2.nodeShapes[_this.getNodeShape(tgt2)]; + var srcCornerRadius = pairInfo.srcCornerRadius = src2.pstyle("corner-radius").value === "auto" ? "auto" : src2.pstyle("corner-radius").pfValue; + var tgtCornerRadius = pairInfo.tgtCornerRadius = tgt2.pstyle("corner-radius").value === "auto" ? "auto" : tgt2.pstyle("corner-radius").pfValue; + var tgtRs = pairInfo.tgtRs = tgt2._private.rscratch; + var srcRs = pairInfo.srcRs = src2._private.rscratch; + pairInfo.dirCounts = { + "north": 0, + "west": 0, + "south": 0, + "east": 0, + "northwest": 0, + "southwest": 0, + "northeast": 0, + "southeast": 0 + }; + for (var _i2 = 0; _i2 < pairInfo.eles.length; _i2++) { + var _edge = pairInfo.eles[_i2]; + var rs = _edge[0]._private.rscratch; + var _curveStyle = _edge.pstyle("curve-style").value; + var _edgeIsUnbundled = _curveStyle === "unbundled-bezier" || endsWith(_curveStyle, "segments") || endsWith(_curveStyle, "taxi"); + var edgeIsSwapped = !src2.same(_edge.source()); + if (!pairInfo.calculatedIntersection && src2 !== tgt2 && (pairInfo.hasBezier || pairInfo.hasUnbundled)) { + pairInfo.calculatedIntersection = true; + var srcOutside = srcShape.intersectLine(srcPos.x, srcPos.y, srcW, srcH, tgtPos.x, tgtPos.y, 0, srcCornerRadius, srcRs); + var srcIntn = pairInfo.srcIntn = srcOutside; + var tgtOutside = tgtShape.intersectLine(tgtPos.x, tgtPos.y, tgtW, tgtH, srcPos.x, srcPos.y, 0, tgtCornerRadius, tgtRs); + var tgtIntn = pairInfo.tgtIntn = tgtOutside; + var intersectionPts = pairInfo.intersectionPts = { + x1: srcOutside[0], + x2: tgtOutside[0], + y1: srcOutside[1], + y2: tgtOutside[1] + }; + var posPts = pairInfo.posPts = { + x1: srcPos.x, + x2: tgtPos.x, + y1: srcPos.y, + y2: tgtPos.y + }; + var dy = tgtOutside[1] - srcOutside[1]; + var dx = tgtOutside[0] - srcOutside[0]; + var l4 = Math.sqrt(dx * dx + dy * dy); + if (number$1(l4) && l4 >= AVOID_IMPOSSIBLE_BEZIER_CONSTANT_L) ; + else { + l4 = Math.sqrt(Math.max(dx * dx, AVOID_IMPOSSIBLE_BEZIER_CONSTANT) + Math.max(dy * dy, AVOID_IMPOSSIBLE_BEZIER_CONSTANT)); + } + var vector = pairInfo.vector = { + x: dx, + y: dy + }; + var vectorNorm = pairInfo.vectorNorm = { + x: vector.x / l4, + y: vector.y / l4 + }; + var vectorNormInverse = { + x: -vectorNorm.y, + y: vectorNorm.x + }; + pairInfo.nodesOverlap = !number$1(l4) || tgtShape.checkPoint(srcOutside[0], srcOutside[1], 0, tgtW, tgtH, tgtPos.x, tgtPos.y, tgtCornerRadius, tgtRs) || srcShape.checkPoint(tgtOutside[0], tgtOutside[1], 0, srcW, srcH, srcPos.x, srcPos.y, srcCornerRadius, srcRs); + pairInfo.vectorNormInverse = vectorNormInverse; + swappedpairInfo = { + nodesOverlap: pairInfo.nodesOverlap, + dirCounts: pairInfo.dirCounts, + calculatedIntersection: true, + hasBezier: pairInfo.hasBezier, + hasUnbundled: pairInfo.hasUnbundled, + eles: pairInfo.eles, + srcPos: tgtPos, + srcRs: tgtRs, + tgtPos: srcPos, + tgtRs: srcRs, + srcW: tgtW, + srcH: tgtH, + tgtW: srcW, + tgtH: srcH, + srcIntn: tgtIntn, + tgtIntn: srcIntn, + srcShape: tgtShape, + tgtShape: srcShape, + posPts: { + x1: posPts.x2, + y1: posPts.y2, + x2: posPts.x1, + y2: posPts.y1 + }, + intersectionPts: { + x1: intersectionPts.x2, + y1: intersectionPts.y2, + x2: intersectionPts.x1, + y2: intersectionPts.y1 + }, + vector: { + x: -vector.x, + y: -vector.y + }, + vectorNorm: { + x: -vectorNorm.x, + y: -vectorNorm.y + }, + vectorNormInverse: { + x: -vectorNormInverse.x, + y: -vectorNormInverse.y + } + }; + } + var passedPairInfo = edgeIsSwapped ? swappedpairInfo : pairInfo; + rs.nodesOverlap = passedPairInfo.nodesOverlap; + rs.srcIntn = passedPairInfo.srcIntn; + rs.tgtIntn = passedPairInfo.tgtIntn; + rs.isRound = _curveStyle.startsWith("round"); + if (hasCompounds && (src2.isParent() || src2.isChild() || tgt2.isParent() || tgt2.isChild()) && (src2.parents().anySame(tgt2) || tgt2.parents().anySame(src2) || src2.same(tgt2) && src2.isParent())) { + _this.findCompoundLoopPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled); + } else if (src2 === tgt2) { + _this.findLoopPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled); + } else if (_curveStyle.endsWith("segments")) { + _this.findSegmentsPoints(_edge, passedPairInfo); + } else if (_curveStyle.endsWith("taxi")) { + _this.findTaxiPoints(_edge, passedPairInfo); + } else if (_curveStyle === "straight" || !_edgeIsUnbundled && pairInfo.eles.length % 2 === 1 && _i2 === Math.floor(pairInfo.eles.length / 2)) { + _this.findStraightEdgePoints(_edge); + } else { + _this.findBezierPoints(_edge, passedPairInfo, _i2, _edgeIsUnbundled, edgeIsSwapped); + } + _this.findEndpoints(_edge); + _this.tryToCorrectInvalidPoints(_edge, passedPairInfo); + _this.checkForInvalidEdgeWarning(_edge); + _this.storeAllpts(_edge); + _this.storeEdgeProjections(_edge); + _this.calculateArrowAngles(_edge); + _this.recalculateEdgeLabelProjections(_edge); + _this.calculateLabelAngles(_edge); + } + }, "_loop"); + for (var p3 = 0; p3 < pairIds.length; p3++) { + _loop(); + } + this.findHaystackPoints(haystackEdges); + }; + __name(getPts, "getPts"); + BRp$c.getSegmentPoints = function(edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + var type3 = rs.edgeType; + if (type3 === "segments") { + return getPts(rs.segpts); + } + }; + BRp$c.getControlPoints = function(edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + var type3 = rs.edgeType; + if (type3 === "bezier" || type3 === "multibezier" || type3 === "self" || type3 === "compound") { + return getPts(rs.ctrlpts); + } + }; + BRp$c.getEdgeMidpoint = function(edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + return { + x: rs.midX, + y: rs.midY + }; + }; + BRp$b = {}; + BRp$b.manualEndptToPx = function(node2, prop) { + var r2 = this; + var npos = node2.position(); + var w4 = node2.outerWidth(); + var h3 = node2.outerHeight(); + var rs = node2._private.rscratch; + if (prop.value.length === 2) { + var p3 = [prop.pfValue[0], prop.pfValue[1]]; + if (prop.units[0] === "%") { + p3[0] = p3[0] * w4; + } + if (prop.units[1] === "%") { + p3[1] = p3[1] * h3; + } + p3[0] += npos.x; + p3[1] += npos.y; + return p3; + } else { + var angle2 = prop.pfValue[0]; + angle2 = -Math.PI / 2 + angle2; + var l4 = 2 * Math.max(w4, h3); + var _p = [npos.x + Math.cos(angle2) * l4, npos.y + Math.sin(angle2) * l4]; + return r2.nodeShapes[this.getNodeShape(node2)].intersectLine(npos.x, npos.y, w4, h3, _p[0], _p[1], 0, node2.pstyle("corner-radius").value === "auto" ? "auto" : node2.pstyle("corner-radius").pfValue, rs); + } + }; + BRp$b.findEndpoints = function(edge) { + var _ref, _tgtManEndpt$pfValue, _ref2, _srcManEndpt$pfValue; + var r2 = this; + var intersect3; + var source = edge.source()[0]; + var target = edge.target()[0]; + var srcPos = source.position(); + var tgtPos = target.position(); + var tgtArShape = edge.pstyle("target-arrow-shape").value; + var srcArShape = edge.pstyle("source-arrow-shape").value; + var tgtDist = edge.pstyle("target-distance-from-node").pfValue; + var srcDist = edge.pstyle("source-distance-from-node").pfValue; + var srcRs = source._private.rscratch; + var tgtRs = target._private.rscratch; + var curveStyle = edge.pstyle("curve-style").value; + var rs = edge._private.rscratch; + var et2 = rs.edgeType; + var taxi = endsWith(curveStyle, "taxi"); + var self2 = et2 === "self" || et2 === "compound"; + var bezier = et2 === "bezier" || et2 === "multibezier" || self2; + var multi = et2 !== "bezier"; + var lines = et2 === "straight" || et2 === "segments"; + var segments = et2 === "segments"; + var hasEndpts = bezier || multi || lines; + var overrideEndpts = self2 || taxi; + var srcManEndpt = edge.pstyle("source-endpoint"); + var srcManEndptVal = overrideEndpts ? "outside-to-node" : srcManEndpt.value; + var srcCornerRadius = source.pstyle("corner-radius").value === "auto" ? "auto" : source.pstyle("corner-radius").pfValue; + var tgtManEndpt = edge.pstyle("target-endpoint"); + var tgtManEndptVal = overrideEndpts ? "outside-to-node" : tgtManEndpt.value; + var tgtCornerRadius = target.pstyle("corner-radius").value === "auto" ? "auto" : target.pstyle("corner-radius").pfValue; + rs.srcManEndpt = srcManEndpt; + rs.tgtManEndpt = tgtManEndpt; + var p1; + var p22; + var p1_i; + var p2_i; + var tgtManEndptPt = (_ref = (tgtManEndpt === null || tgtManEndpt === void 0 || (_tgtManEndpt$pfValue = tgtManEndpt.pfValue) === null || _tgtManEndpt$pfValue === void 0 ? void 0 : _tgtManEndpt$pfValue.length) === 2 ? tgtManEndpt.pfValue : null) !== null && _ref !== void 0 ? _ref : [0, 0]; + var srcManEndptPt = (_ref2 = (srcManEndpt === null || srcManEndpt === void 0 || (_srcManEndpt$pfValue = srcManEndpt.pfValue) === null || _srcManEndpt$pfValue === void 0 ? void 0 : _srcManEndpt$pfValue.length) === 2 ? srcManEndpt.pfValue : null) !== null && _ref2 !== void 0 ? _ref2 : [0, 0]; + if (bezier) { + var cpStart = [rs.ctrlpts[0], rs.ctrlpts[1]]; + var cpEnd = multi ? [rs.ctrlpts[rs.ctrlpts.length - 2], rs.ctrlpts[rs.ctrlpts.length - 1]] : cpStart; + p1 = cpEnd; + p22 = cpStart; + } else if (lines) { + var srcArrowFromPt = !segments ? [tgtPos.x + tgtManEndptPt[0], tgtPos.y + tgtManEndptPt[1]] : rs.segpts.slice(0, 2); + var tgtArrowFromPt = !segments ? [srcPos.x + srcManEndptPt[0], srcPos.y + srcManEndptPt[1]] : rs.segpts.slice(rs.segpts.length - 2); + p1 = tgtArrowFromPt; + p22 = srcArrowFromPt; + } + if (tgtManEndptVal === "inside-to-node") { + intersect3 = [tgtPos.x, tgtPos.y]; + } else if (tgtManEndpt.units) { + intersect3 = this.manualEndptToPx(target, tgtManEndpt); + } else if (tgtManEndptVal === "outside-to-line") { + intersect3 = rs.tgtIntn; + } else { + if (tgtManEndptVal === "outside-to-node" || tgtManEndptVal === "outside-to-node-or-label") { + p1_i = p1; + } else if (tgtManEndptVal === "outside-to-line" || tgtManEndptVal === "outside-to-line-or-label") { + p1_i = [srcPos.x, srcPos.y]; + } + intersect3 = r2.nodeShapes[this.getNodeShape(target)].intersectLine(tgtPos.x, tgtPos.y, target.outerWidth(), target.outerHeight(), p1_i[0], p1_i[1], 0, tgtCornerRadius, tgtRs); + if (tgtManEndptVal === "outside-to-node-or-label" || tgtManEndptVal === "outside-to-line-or-label") { + var trs = target._private.rscratch; + var lw = trs.labelWidth; + var lh = trs.labelHeight; + var lx = trs.labelX; + var ly = trs.labelY; + var lw2 = lw / 2; + var lh2 = lh / 2; + var va = target.pstyle("text-valign").value; + if (va === "top") { + ly -= lh2; + } else if (va === "bottom") { + ly += lh2; + } + var ha = target.pstyle("text-halign").value; + if (ha === "left") { + lx -= lw2; + } else if (ha === "right") { + lx += lw2; + } + var labelIntersect = polygonIntersectLine(p1_i[0], p1_i[1], [lx - lw2, ly - lh2, lx + lw2, ly - lh2, lx + lw2, ly + lh2, lx - lw2, ly + lh2], tgtPos.x, tgtPos.y); + if (labelIntersect.length > 0) { + var refPt = srcPos; + var intSqdist = sqdist(refPt, array2point(intersect3)); + var labIntSqdist = sqdist(refPt, array2point(labelIntersect)); + var minSqDist = intSqdist; + if (labIntSqdist < intSqdist) { + intersect3 = labelIntersect; + minSqDist = labIntSqdist; + } + if (labelIntersect.length > 2) { + var labInt2SqDist = sqdist(refPt, { + x: labelIntersect[2], + y: labelIntersect[3] + }); + if (labInt2SqDist < minSqDist) { + intersect3 = [labelIntersect[2], labelIntersect[3]]; + } + } + } + } + } + var arrowEnd = shortenIntersection(intersect3, p1, r2.arrowShapes[tgtArShape].spacing(edge) + tgtDist); + var edgeEnd = shortenIntersection(intersect3, p1, r2.arrowShapes[tgtArShape].gap(edge) + tgtDist); + rs.endX = edgeEnd[0]; + rs.endY = edgeEnd[1]; + rs.arrowEndX = arrowEnd[0]; + rs.arrowEndY = arrowEnd[1]; + if (srcManEndptVal === "inside-to-node") { + intersect3 = [srcPos.x, srcPos.y]; + } else if (srcManEndpt.units) { + intersect3 = this.manualEndptToPx(source, srcManEndpt); + } else if (srcManEndptVal === "outside-to-line") { + intersect3 = rs.srcIntn; + } else { + if (srcManEndptVal === "outside-to-node" || srcManEndptVal === "outside-to-node-or-label") { + p2_i = p22; + } else if (srcManEndptVal === "outside-to-line" || srcManEndptVal === "outside-to-line-or-label") { + p2_i = [tgtPos.x, tgtPos.y]; + } + intersect3 = r2.nodeShapes[this.getNodeShape(source)].intersectLine(srcPos.x, srcPos.y, source.outerWidth(), source.outerHeight(), p2_i[0], p2_i[1], 0, srcCornerRadius, srcRs); + if (srcManEndptVal === "outside-to-node-or-label" || srcManEndptVal === "outside-to-line-or-label") { + var srs = source._private.rscratch; + var _lw = srs.labelWidth; + var _lh = srs.labelHeight; + var _lx = srs.labelX; + var _ly = srs.labelY; + var _lw2 = _lw / 2; + var _lh2 = _lh / 2; + var _va = source.pstyle("text-valign").value; + if (_va === "top") { + _ly -= _lh2; + } else if (_va === "bottom") { + _ly += _lh2; + } + var _ha = source.pstyle("text-halign").value; + if (_ha === "left") { + _lx -= _lw2; + } else if (_ha === "right") { + _lx += _lw2; + } + var _labelIntersect = polygonIntersectLine(p2_i[0], p2_i[1], [_lx - _lw2, _ly - _lh2, _lx + _lw2, _ly - _lh2, _lx + _lw2, _ly + _lh2, _lx - _lw2, _ly + _lh2], srcPos.x, srcPos.y); + if (_labelIntersect.length > 0) { + var _refPt = tgtPos; + var _intSqdist = sqdist(_refPt, array2point(intersect3)); + var _labIntSqdist = sqdist(_refPt, array2point(_labelIntersect)); + var _minSqDist = _intSqdist; + if (_labIntSqdist < _intSqdist) { + intersect3 = [_labelIntersect[0], _labelIntersect[1]]; + _minSqDist = _labIntSqdist; + } + if (_labelIntersect.length > 2) { + var _labInt2SqDist = sqdist(_refPt, { + x: _labelIntersect[2], + y: _labelIntersect[3] + }); + if (_labInt2SqDist < _minSqDist) { + intersect3 = [_labelIntersect[2], _labelIntersect[3]]; + } + } + } + } + } + var arrowStart = shortenIntersection(intersect3, p22, r2.arrowShapes[srcArShape].spacing(edge) + srcDist); + var edgeStart = shortenIntersection(intersect3, p22, r2.arrowShapes[srcArShape].gap(edge) + srcDist); + rs.startX = edgeStart[0]; + rs.startY = edgeStart[1]; + rs.arrowStartX = arrowStart[0]; + rs.arrowStartY = arrowStart[1]; + if (hasEndpts) { + if (!number$1(rs.startX) || !number$1(rs.startY) || !number$1(rs.endX) || !number$1(rs.endY)) { + rs.badLine = true; + } else { + rs.badLine = false; + } + } + }; + BRp$b.getSourceEndpoint = function(edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + switch (rs.edgeType) { + case "haystack": + return { + x: rs.haystackPts[0], + y: rs.haystackPts[1] + }; + default: + return { + x: rs.arrowStartX, + y: rs.arrowStartY + }; + } + }; + BRp$b.getTargetEndpoint = function(edge) { + var rs = edge[0]._private.rscratch; + this.recalculateRenderedStyle(edge); + switch (rs.edgeType) { + case "haystack": + return { + x: rs.haystackPts[2], + y: rs.haystackPts[3] + }; + default: + return { + x: rs.arrowEndX, + y: rs.arrowEndY + }; + } + }; + BRp$a = {}; + __name(pushBezierPts, "pushBezierPts"); + BRp$a.storeEdgeProjections = function(edge) { + var _p = edge._private; + var rs = _p.rscratch; + var et2 = rs.edgeType; + _p.rstyle.bezierPts = null; + _p.rstyle.linePts = null; + _p.rstyle.haystackPts = null; + if (et2 === "multibezier" || et2 === "bezier" || et2 === "self" || et2 === "compound") { + _p.rstyle.bezierPts = []; + for (var i2 = 0; i2 + 5 < rs.allpts.length; i2 += 4) { + pushBezierPts(this, edge, rs.allpts.slice(i2, i2 + 6)); + } + } else if (et2 === "segments") { + var lpts = _p.rstyle.linePts = []; + for (var i2 = 0; i2 + 1 < rs.allpts.length; i2 += 2) { + lpts.push({ + x: rs.allpts[i2], + y: rs.allpts[i2 + 1] + }); + } + } else if (et2 === "haystack") { + var hpts = rs.haystackPts; + _p.rstyle.haystackPts = [{ + x: hpts[0], + y: hpts[1] + }, { + x: hpts[2], + y: hpts[3] + }]; + } + _p.rstyle.arrowWidth = this.getArrowWidth(edge.pstyle("width").pfValue, edge.pstyle("arrow-scale").value) * this.arrowShapeWidth; + }; + BRp$a.recalculateEdgeProjections = function(edges3) { + this.findEdgeControlPoints(edges3); + }; + BRp$9 = {}; + BRp$9.recalculateNodeLabelProjection = function(node2) { + var content = node2.pstyle("label").strValue; + if (emptyString(content)) { + return; + } + var textX, textY; + var _p = node2._private; + var nodeWidth = node2.width(); + var nodeHeight = node2.height(); + var padding2 = node2.padding(); + var nodePos = node2.position(); + var textHalign = node2.pstyle("text-halign").strValue; + var textValign = node2.pstyle("text-valign").strValue; + var rs = _p.rscratch; + var rstyle = _p.rstyle; + switch (textHalign) { + case "left": + textX = nodePos.x - nodeWidth / 2 - padding2; + break; + case "right": + textX = nodePos.x + nodeWidth / 2 + padding2; + break; + default: + textX = nodePos.x; + } + switch (textValign) { + case "top": + textY = nodePos.y - nodeHeight / 2 - padding2; + break; + case "bottom": + textY = nodePos.y + nodeHeight / 2 + padding2; + break; + default: + textY = nodePos.y; + } + rs.labelX = textX; + rs.labelY = textY; + rstyle.labelX = textX; + rstyle.labelY = textY; + this.calculateLabelAngles(node2); + this.applyLabelDimensions(node2); + }; + lineAngleFromDelta = /* @__PURE__ */ __name(function lineAngleFromDelta2(dx, dy) { + var angle2 = Math.atan(dy / dx); + if (dx === 0 && angle2 < 0) { + angle2 = angle2 * -1; + } + return angle2; + }, "lineAngleFromDelta"); + lineAngle = /* @__PURE__ */ __name(function lineAngle2(p0, p1) { + var dx = p1.x - p0.x; + var dy = p1.y - p0.y; + return lineAngleFromDelta(dx, dy); + }, "lineAngle"); + bezierAngle = /* @__PURE__ */ __name(function bezierAngle2(p0, p1, p22, t4) { + var t03 = bound(0, t4 - 1e-3, 1); + var t13 = bound(0, t4 + 1e-3, 1); + var lp0 = qbezierPtAt(p0, p1, p22, t03); + var lp1 = qbezierPtAt(p0, p1, p22, t13); + return lineAngle(lp0, lp1); + }, "bezierAngle"); + BRp$9.recalculateEdgeLabelProjections = function(edge) { + var p3; + var _p = edge._private; + var rs = _p.rscratch; + var r2 = this; + var content = { + mid: edge.pstyle("label").strValue, + source: edge.pstyle("source-label").strValue, + target: edge.pstyle("target-label").strValue + }; + if (content.mid || content.source || content.target) ; + else { + return; + } + p3 = { + x: rs.midX, + y: rs.midY + }; + var setRs = /* @__PURE__ */ __name(function setRs2(propName, prefix, value2) { + setPrefixedProperty(_p.rscratch, propName, prefix, value2); + setPrefixedProperty(_p.rstyle, propName, prefix, value2); + }, "setRs"); + setRs("labelX", null, p3.x); + setRs("labelY", null, p3.y); + var midAngle = lineAngleFromDelta(rs.midDispX, rs.midDispY); + setRs("labelAutoAngle", null, midAngle); + var _createControlPointInfo = /* @__PURE__ */ __name(function createControlPointInfo() { + if (_createControlPointInfo.cache) { + return _createControlPointInfo.cache; + } + var ctrlpts = []; + for (var i2 = 0; i2 + 5 < rs.allpts.length; i2 += 4) { + var p0 = { + x: rs.allpts[i2], + y: rs.allpts[i2 + 1] + }; + var p1 = { + x: rs.allpts[i2 + 2], + y: rs.allpts[i2 + 3] + }; + var p22 = { + x: rs.allpts[i2 + 4], + y: rs.allpts[i2 + 5] + }; + ctrlpts.push({ + p0, + p1, + p2: p22, + startDist: 0, + length: 0, + segments: [] + }); + } + var bpts = _p.rstyle.bezierPts; + var nProjs = r2.bezierProjPcts.length; + function addSegment(cp2, p02, p12, t03, t13) { + var length2 = dist(p02, p12); + var prevSegment = cp2.segments[cp2.segments.length - 1]; + var segment = { + p0: p02, + p1: p12, + t0: t03, + t1: t13, + startDist: prevSegment ? prevSegment.startDist + prevSegment.length : 0, + length: length2 + }; + cp2.segments.push(segment); + cp2.length += length2; + } + __name(addSegment, "addSegment"); + for (var _i = 0; _i < ctrlpts.length; _i++) { + var cp = ctrlpts[_i]; + var prevCp = ctrlpts[_i - 1]; + if (prevCp) { + cp.startDist = prevCp.startDist + prevCp.length; + } + addSegment(cp, cp.p0, bpts[_i * nProjs], 0, r2.bezierProjPcts[0]); + for (var j3 = 0; j3 < nProjs - 1; j3++) { + addSegment(cp, bpts[_i * nProjs + j3], bpts[_i * nProjs + j3 + 1], r2.bezierProjPcts[j3], r2.bezierProjPcts[j3 + 1]); + } + addSegment(cp, bpts[_i * nProjs + nProjs - 1], cp.p2, r2.bezierProjPcts[nProjs - 1], 1); + } + return _createControlPointInfo.cache = ctrlpts; + }, "createControlPointInfo"); + var calculateEndProjection = /* @__PURE__ */ __name(function calculateEndProjection2(prefix) { + var angle2; + var isSrc = prefix === "source"; + if (!content[prefix]) { + return; + } + var offset = edge.pstyle(prefix + "-text-offset").pfValue; + switch (rs.edgeType) { + case "self": + case "compound": + case "bezier": + case "multibezier": { + var cps = _createControlPointInfo(); + var selected; + var startDist = 0; + var totalDist = 0; + for (var i2 = 0; i2 < cps.length; i2++) { + var _cp = cps[isSrc ? i2 : cps.length - 1 - i2]; + for (var j3 = 0; j3 < _cp.segments.length; j3++) { + var _seg = _cp.segments[isSrc ? j3 : _cp.segments.length - 1 - j3]; + var lastSeg = i2 === cps.length - 1 && j3 === _cp.segments.length - 1; + startDist = totalDist; + totalDist += _seg.length; + if (totalDist >= offset || lastSeg) { + selected = { + cp: _cp, + segment: _seg + }; + break; + } + } + if (selected) { + break; + } + } + var cp = selected.cp; + var seg = selected.segment; + var tSegment = (offset - startDist) / seg.length; + var segDt = seg.t1 - seg.t0; + var t4 = isSrc ? seg.t0 + segDt * tSegment : seg.t1 - segDt * tSegment; + t4 = bound(0, t4, 1); + p3 = qbezierPtAt(cp.p0, cp.p1, cp.p2, t4); + angle2 = bezierAngle(cp.p0, cp.p1, cp.p2, t4); + break; + } + case "straight": + case "segments": + case "haystack": { + var d3 = 0, di, d0; + var p0, p1; + var l4 = rs.allpts.length; + for (var _i2 = 0; _i2 + 3 < l4; _i2 += 2) { + if (isSrc) { + p0 = { + x: rs.allpts[_i2], + y: rs.allpts[_i2 + 1] + }; + p1 = { + x: rs.allpts[_i2 + 2], + y: rs.allpts[_i2 + 3] + }; + } else { + p0 = { + x: rs.allpts[l4 - 2 - _i2], + y: rs.allpts[l4 - 1 - _i2] + }; + p1 = { + x: rs.allpts[l4 - 4 - _i2], + y: rs.allpts[l4 - 3 - _i2] + }; + } + di = dist(p0, p1); + d0 = d3; + d3 += di; + if (d3 >= offset) { + break; + } + } + var pD = offset - d0; + var _t = pD / di; + _t = bound(0, _t, 1); + p3 = lineAt(p0, p1, _t); + angle2 = lineAngle(p0, p1); + break; + } + } + setRs("labelX", prefix, p3.x); + setRs("labelY", prefix, p3.y); + setRs("labelAutoAngle", prefix, angle2); + }, "calculateEndProjection"); + calculateEndProjection("source"); + calculateEndProjection("target"); + this.applyLabelDimensions(edge); + }; + BRp$9.applyLabelDimensions = function(ele) { + this.applyPrefixedLabelDimensions(ele); + if (ele.isEdge()) { + this.applyPrefixedLabelDimensions(ele, "source"); + this.applyPrefixedLabelDimensions(ele, "target"); + } + }; + BRp$9.applyPrefixedLabelDimensions = function(ele, prefix) { + var _p = ele._private; + var text4 = this.getLabelText(ele, prefix); + var cacheKey = hashString(text4, ele._private.labelDimsKey); + if (getPrefixedProperty(_p.rscratch, "prefixedLabelDimsKey", prefix) === cacheKey) { + return; + } + setPrefixedProperty(_p.rscratch, "prefixedLabelDimsKey", prefix, cacheKey); + var labelDims = this.calculateLabelDimensions(ele, text4); + var lineHeight = ele.pstyle("line-height").pfValue; + var textWrap = ele.pstyle("text-wrap").strValue; + var lines = getPrefixedProperty(_p.rscratch, "labelWrapCachedLines", prefix) || []; + var numLines = textWrap !== "wrap" ? 1 : Math.max(lines.length, 1); + var normPerLineHeight = labelDims.height / numLines; + var labelLineHeight = normPerLineHeight * lineHeight; + var width3 = labelDims.width; + var height2 = labelDims.height + (numLines - 1) * (lineHeight - 1) * normPerLineHeight; + setPrefixedProperty(_p.rstyle, "labelWidth", prefix, width3); + setPrefixedProperty(_p.rscratch, "labelWidth", prefix, width3); + setPrefixedProperty(_p.rstyle, "labelHeight", prefix, height2); + setPrefixedProperty(_p.rscratch, "labelHeight", prefix, height2); + setPrefixedProperty(_p.rscratch, "labelLineHeight", prefix, labelLineHeight); + }; + BRp$9.getLabelText = function(ele, prefix) { + var _p = ele._private; + var pfd = prefix ? prefix + "-" : ""; + var text4 = ele.pstyle(pfd + "label").strValue; + var textTransform = ele.pstyle("text-transform").value; + var rscratch = /* @__PURE__ */ __name(function rscratch2(propName, value2) { + if (value2) { + setPrefixedProperty(_p.rscratch, propName, prefix, value2); + return value2; + } else { + return getPrefixedProperty(_p.rscratch, propName, prefix); + } + }, "rscratch"); + if (!text4) { + return ""; + } + if (textTransform == "none") ; + else if (textTransform == "uppercase") { + text4 = text4.toUpperCase(); + } else if (textTransform == "lowercase") { + text4 = text4.toLowerCase(); + } + var wrapStyle = ele.pstyle("text-wrap").value; + if (wrapStyle === "wrap") { + var labelKey = rscratch("labelKey"); + if (labelKey != null && rscratch("labelWrapKey") === labelKey) { + return rscratch("labelWrapCachedText"); + } + var zwsp = "\u200B"; + var lines = text4.split("\n"); + var maxW = ele.pstyle("text-max-width").pfValue; + var overflow = ele.pstyle("text-overflow-wrap").value; + var overflowAny = overflow === "anywhere"; + var wrappedLines = []; + var separatorRegex = /[\s\u200b]+|$/g; + for (var l4 = 0; l4 < lines.length; l4++) { + var line2 = lines[l4]; + var lineDims = this.calculateLabelDimensions(ele, line2); + var lineW = lineDims.width; + if (overflowAny) { + var processedLine = line2.split("").join(zwsp); + line2 = processedLine; + } + if (lineW > maxW) { + var separatorMatches = line2.matchAll(separatorRegex); + var subline = ""; + var previousIndex = 0; + var _iterator = _createForOfIteratorHelper(separatorMatches), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var separatorMatch = _step.value; + var wordSeparator = separatorMatch[0]; + var word = line2.substring(previousIndex, separatorMatch.index); + previousIndex = separatorMatch.index + wordSeparator.length; + var testLine = subline.length === 0 ? word : subline + word + wordSeparator; + var testDims = this.calculateLabelDimensions(ele, testLine); + var testW = testDims.width; + if (testW <= maxW) { + subline += word + wordSeparator; + } else { + if (subline) { + wrappedLines.push(subline); + } + subline = word + wordSeparator; + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + if (!subline.match(/^[\s\u200b]+$/)) { + wrappedLines.push(subline); + } + } else { + wrappedLines.push(line2); + } + } + rscratch("labelWrapCachedLines", wrappedLines); + text4 = rscratch("labelWrapCachedText", wrappedLines.join("\n")); + rscratch("labelWrapKey", labelKey); + } else if (wrapStyle === "ellipsis") { + var _maxW = ele.pstyle("text-max-width").pfValue; + var ellipsized = ""; + var ellipsis = "\u2026"; + var incLastCh = false; + if (this.calculateLabelDimensions(ele, text4).width < _maxW) { + return text4; + } + for (var i2 = 0; i2 < text4.length; i2++) { + var widthWithNextCh = this.calculateLabelDimensions(ele, ellipsized + text4[i2] + ellipsis).width; + if (widthWithNextCh > _maxW) { + break; + } + ellipsized += text4[i2]; + if (i2 === text4.length - 1) { + incLastCh = true; + } + } + if (!incLastCh) { + ellipsized += ellipsis; + } + return ellipsized; + } + return text4; + }; + BRp$9.getLabelJustification = function(ele) { + var justification = ele.pstyle("text-justification").strValue; + var textHalign = ele.pstyle("text-halign").strValue; + if (justification === "auto") { + if (ele.isNode()) { + switch (textHalign) { + case "left": + return "right"; + case "right": + return "left"; + default: + return "center"; + } + } else { + return "center"; + } + } else { + return justification; + } + }; + BRp$9.calculateLabelDimensions = function(ele, text4) { + var r2 = this; + var containerWindow = r2.cy.window(); + var document2 = containerWindow.document; + var padding2 = 0; + var fStyle = ele.pstyle("font-style").strValue; + var size4 = ele.pstyle("font-size").pfValue; + var family = ele.pstyle("font-family").strValue; + var weight8 = ele.pstyle("font-weight").strValue; + var canvas = this.labelCalcCanvas; + var c2d = this.labelCalcCanvasContext; + if (!canvas) { + canvas = this.labelCalcCanvas = document2.createElement("canvas"); + c2d = this.labelCalcCanvasContext = canvas.getContext("2d"); + var ds = canvas.style; + ds.position = "absolute"; + ds.left = "-9999px"; + ds.top = "-9999px"; + ds.zIndex = "-1"; + ds.visibility = "hidden"; + ds.pointerEvents = "none"; + } + c2d.font = "".concat(fStyle, " ").concat(weight8, " ").concat(size4, "px ").concat(family); + var width3 = 0; + var height2 = 0; + var lines = text4.split("\n"); + for (var i2 = 0; i2 < lines.length; i2++) { + var line2 = lines[i2]; + var metrics = c2d.measureText(line2); + var w4 = Math.ceil(metrics.width); + var h3 = size4; + width3 = Math.max(w4, width3); + height2 += h3; + } + width3 += padding2; + height2 += padding2; + return { + width: width3, + height: height2 + }; + }; + BRp$9.calculateLabelAngle = function(ele, prefix) { + var _p = ele._private; + var rs = _p.rscratch; + var isEdge2 = ele.isEdge(); + var prefixDash = prefix ? prefix + "-" : ""; + var rot = ele.pstyle(prefixDash + "text-rotation"); + var rotStr = rot.strValue; + if (rotStr === "none") { + return 0; + } else if (isEdge2 && rotStr === "autorotate") { + return rs.labelAutoAngle; + } else if (rotStr === "autorotate") { + return 0; + } else { + return rot.pfValue; + } + }; + BRp$9.calculateLabelAngles = function(ele) { + var r2 = this; + var isEdge2 = ele.isEdge(); + var _p = ele._private; + var rs = _p.rscratch; + rs.labelAngle = r2.calculateLabelAngle(ele); + if (isEdge2) { + rs.sourceLabelAngle = r2.calculateLabelAngle(ele, "source"); + rs.targetLabelAngle = r2.calculateLabelAngle(ele, "target"); + } + }; + BRp$8 = {}; + TOO_SMALL_CUT_RECT = 28; + warnedCutRect = false; + BRp$8.getNodeShape = function(node2) { + var r2 = this; + var shape = node2.pstyle("shape").value; + if (shape === "cutrectangle" && (node2.width() < TOO_SMALL_CUT_RECT || node2.height() < TOO_SMALL_CUT_RECT)) { + if (!warnedCutRect) { + warn("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"); + warnedCutRect = true; + } + return "rectangle"; + } + if (node2.isParent()) { + if (shape === "rectangle" || shape === "roundrectangle" || shape === "round-rectangle" || shape === "cutrectangle" || shape === "cut-rectangle" || shape === "barrel") { + return shape; + } else { + return "rectangle"; + } + } + if (shape === "polygon") { + var points = node2.pstyle("shape-polygon-points").value; + return r2.nodeShapes.makePolygon(points).name; + } + return shape; + }; + BRp$7 = {}; + BRp$7.registerCalculationListeners = function() { + var cy = this.cy; + var elesToUpdate = cy.collection(); + var r2 = this; + var enqueue = /* @__PURE__ */ __name(function enqueue2(eles) { + var dirtyStyleCaches = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; + elesToUpdate.merge(eles); + if (dirtyStyleCaches) { + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var _p = ele._private; + var rstyle = _p.rstyle; + rstyle.clean = false; + rstyle.cleanConnected = false; + } + } + }, "enqueue"); + r2.binder(cy).on("bounds.* dirty.*", /* @__PURE__ */ __name(function onDirtyBounds(e3) { + var ele = e3.target; + enqueue(ele); + }, "onDirtyBounds")).on("style.* background.*", /* @__PURE__ */ __name(function onDirtyStyle(e3) { + var ele = e3.target; + enqueue(ele, false); + }, "onDirtyStyle")); + var updateEleCalcs = /* @__PURE__ */ __name(function updateEleCalcs2(willDraw) { + if (willDraw) { + var fns = r2.onUpdateEleCalcsFns; + elesToUpdate.cleanStyle(); + for (var i2 = 0; i2 < elesToUpdate.length; i2++) { + var ele = elesToUpdate[i2]; + var rstyle = ele._private.rstyle; + if (ele.isNode() && !rstyle.cleanConnected) { + enqueue(ele.connectedEdges()); + rstyle.cleanConnected = true; + } + } + if (fns) { + for (var _i = 0; _i < fns.length; _i++) { + var fn3 = fns[_i]; + fn3(willDraw, elesToUpdate); + } + } + r2.recalculateRenderedStyle(elesToUpdate); + elesToUpdate = cy.collection(); + } + }, "updateEleCalcs"); + r2.flushRenderedStyleQueue = function() { + updateEleCalcs(true); + }; + r2.beforeRender(updateEleCalcs, r2.beforeRenderPriorities.eleCalcs); + }; + BRp$7.onUpdateEleCalcs = function(fn3) { + var fns = this.onUpdateEleCalcsFns = this.onUpdateEleCalcsFns || []; + fns.push(fn3); + }; + BRp$7.recalculateRenderedStyle = function(eles, useCache) { + var isCleanConnected = /* @__PURE__ */ __name(function isCleanConnected2(ele2) { + return ele2._private.rstyle.cleanConnected; + }, "isCleanConnected"); + if (eles.length === 0) { + return; + } + var edges3 = []; + var nodes5 = []; + if (this.destroyed) { + return; + } + if (useCache === void 0) { + useCache = true; + } + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var _p = ele._private; + var rstyle = _p.rstyle; + if (ele.isEdge() && (!isCleanConnected(ele.source()) || !isCleanConnected(ele.target()))) { + rstyle.clean = false; + } + if (ele.isEdge() && ele.isBundledBezier()) { + if (ele.parallelEdges().some(function(ele2) { + return !ele2._private.rstyle.clean && ele2.isBundledBezier(); + })) { + rstyle.clean = false; + } + } + if (useCache && rstyle.clean || ele.removed()) { + continue; + } + if (ele.pstyle("display").value === "none") { + continue; + } + if (_p.group === "nodes") { + nodes5.push(ele); + } else { + edges3.push(ele); + } + rstyle.clean = true; + } + for (var _i2 = 0; _i2 < nodes5.length; _i2++) { + var _ele = nodes5[_i2]; + var _p2 = _ele._private; + var _rstyle = _p2.rstyle; + var pos = _ele.position(); + this.recalculateNodeLabelProjection(_ele); + _rstyle.nodeX = pos.x; + _rstyle.nodeY = pos.y; + _rstyle.nodeW = _ele.pstyle("width").pfValue; + _rstyle.nodeH = _ele.pstyle("height").pfValue; + } + this.recalculateEdgeProjections(edges3); + for (var _i3 = 0; _i3 < edges3.length; _i3++) { + var _ele2 = edges3[_i3]; + var _p3 = _ele2._private; + var _rstyle2 = _p3.rstyle; + var rs = _p3.rscratch; + _rstyle2.srcX = rs.arrowStartX; + _rstyle2.srcY = rs.arrowStartY; + _rstyle2.tgtX = rs.arrowEndX; + _rstyle2.tgtY = rs.arrowEndY; + _rstyle2.midX = rs.midX; + _rstyle2.midY = rs.midY; + _rstyle2.labelAngle = rs.labelAngle; + _rstyle2.sourceLabelAngle = rs.sourceLabelAngle; + _rstyle2.targetLabelAngle = rs.targetLabelAngle; + } + }; + BRp$6 = {}; + BRp$6.updateCachedGrabbedEles = function() { + var eles = this.cachedZSortedEles; + if (!eles) { + return; + } + eles.drag = []; + eles.nondrag = []; + var grabTargets = []; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var rs = ele._private.rscratch; + if (ele.grabbed() && !ele.isParent()) { + grabTargets.push(ele); + } else if (rs.inDragLayer) { + eles.drag.push(ele); + } else { + eles.nondrag.push(ele); + } + } + for (var i2 = 0; i2 < grabTargets.length; i2++) { + var ele = grabTargets[i2]; + eles.drag.push(ele); + } + }; + BRp$6.invalidateCachedZSortedEles = function() { + this.cachedZSortedEles = null; + }; + BRp$6.getCachedZSortedEles = function(forceRecalc) { + if (forceRecalc || !this.cachedZSortedEles) { + var eles = this.cy.mutableElements().toArray(); + eles.sort(zIndexSort); + eles.interactive = eles.filter(function(ele) { + return ele.interactive(); + }); + this.cachedZSortedEles = eles; + this.updateCachedGrabbedEles(); + } else { + eles = this.cachedZSortedEles; + } + return eles; + }; + BRp$5 = {}; + [BRp$e, BRp$d, BRp$c, BRp$b, BRp$a, BRp$9, BRp$8, BRp$7, BRp$6].forEach(function(props) { + extend4(BRp$5, props); + }); + BRp$4 = {}; + BRp$4.getCachedImage = function(url, crossOrigin, onLoad) { + var r2 = this; + var imageCache = r2.imageCache = r2.imageCache || {}; + var cache3 = imageCache[url]; + if (cache3) { + if (!cache3.image.complete) { + cache3.image.addEventListener("load", onLoad); + } + return cache3.image; + } else { + cache3 = imageCache[url] = imageCache[url] || {}; + var image = cache3.image = new Image(); + image.addEventListener("load", onLoad); + image.addEventListener("error", function() { + image.error = true; + }); + var dataUriPrefix = "data:"; + var isDataUri = url.substring(0, dataUriPrefix.length).toLowerCase() === dataUriPrefix; + if (!isDataUri) { + crossOrigin = crossOrigin === "null" ? null : crossOrigin; + image.crossOrigin = crossOrigin; + } + image.src = url; + return image; + } + }; + BRp$3 = {}; + BRp$3.registerBinding = function(target, event3, handler, useCapture) { + var args = Array.prototype.slice.apply(arguments, [1]); + if (Array.isArray(target)) { + var res = []; + for (var i2 = 0; i2 < target.length; i2++) { + var t4 = target[i2]; + if (t4 !== void 0) { + var b3 = this.binder(t4); + res.push(b3.on.apply(b3, args)); + } + } + return res; + } + var b3 = this.binder(target); + return b3.on.apply(b3, args); + }; + BRp$3.binder = function(tgt) { + var r2 = this; + var containerWindow = r2.cy.window(); + var tgtIsDom = tgt === containerWindow || tgt === containerWindow.document || tgt === containerWindow.document.body || domElement(tgt); + if (r2.supportsPassiveEvents == null) { + var supportsPassive = false; + try { + var opts = Object.defineProperty({}, "passive", { + get: /* @__PURE__ */ __name(function get6() { + supportsPassive = true; + return true; + }, "get") + }); + containerWindow.addEventListener("test", null, opts); + } catch (err) { + } + r2.supportsPassiveEvents = supportsPassive; + } + var on3 = /* @__PURE__ */ __name(function on4(event3, handler, useCapture) { + var args = Array.prototype.slice.call(arguments); + if (tgtIsDom && r2.supportsPassiveEvents) { + args[2] = { + capture: useCapture != null ? useCapture : false, + passive: false, + once: false + }; + } + r2.bindings.push({ + target: tgt, + args + }); + (tgt.addEventListener || tgt.on).apply(tgt, args); + return this; + }, "on"); + return { + on: on3, + addEventListener: on3, + addListener: on3, + bind: on3 + }; + }; + BRp$3.nodeIsDraggable = function(node2) { + return node2 && node2.isNode() && !node2.locked() && node2.grabbable(); + }; + BRp$3.nodeIsGrabbable = function(node2) { + return this.nodeIsDraggable(node2) && node2.interactive(); + }; + BRp$3.load = function() { + var r2 = this; + var containerWindow = r2.cy.window(); + var isSelected = /* @__PURE__ */ __name(function isSelected2(ele) { + return ele.selected(); + }, "isSelected"); + var getShadowRoot = /* @__PURE__ */ __name(function getShadowRoot2(element3) { + var rootNode = element3.getRootNode(); + if (rootNode && rootNode.nodeType === 11 && rootNode.host !== void 0) { + return rootNode; + } + }, "getShadowRoot"); + var triggerEvents = /* @__PURE__ */ __name(function triggerEvents2(target, names, e3, position5) { + if (target == null) { + target = r2.cy; + } + for (var i2 = 0; i2 < names.length; i2++) { + var name = names[i2]; + target.emit({ + originalEvent: e3, + type: name, + position: position5 + }); + } + }, "triggerEvents"); + var isMultSelKeyDown = /* @__PURE__ */ __name(function isMultSelKeyDown2(e3) { + return e3.shiftKey || e3.metaKey || e3.ctrlKey; + }, "isMultSelKeyDown"); + var allowPanningPassthrough = /* @__PURE__ */ __name(function allowPanningPassthrough2(down, downs) { + var allowPassthrough = true; + if (r2.cy.hasCompoundNodes() && down && down.pannable()) { + for (var i2 = 0; downs && i2 < downs.length; i2++) { + var down = downs[i2]; + if (down.isNode() && down.isParent() && !down.pannable()) { + allowPassthrough = false; + break; + } + } + } else { + allowPassthrough = true; + } + return allowPassthrough; + }, "allowPanningPassthrough"); + var setGrabbed = /* @__PURE__ */ __name(function setGrabbed2(ele) { + ele[0]._private.grabbed = true; + }, "setGrabbed"); + var setFreed = /* @__PURE__ */ __name(function setFreed2(ele) { + ele[0]._private.grabbed = false; + }, "setFreed"); + var setInDragLayer = /* @__PURE__ */ __name(function setInDragLayer2(ele) { + ele[0]._private.rscratch.inDragLayer = true; + }, "setInDragLayer"); + var setOutDragLayer = /* @__PURE__ */ __name(function setOutDragLayer2(ele) { + ele[0]._private.rscratch.inDragLayer = false; + }, "setOutDragLayer"); + var setGrabTarget = /* @__PURE__ */ __name(function setGrabTarget2(ele) { + ele[0]._private.rscratch.isGrabTarget = true; + }, "setGrabTarget"); + var removeGrabTarget = /* @__PURE__ */ __name(function removeGrabTarget2(ele) { + ele[0]._private.rscratch.isGrabTarget = false; + }, "removeGrabTarget"); + var addToDragList = /* @__PURE__ */ __name(function addToDragList2(ele, opts) { + var list = opts.addToList; + var listHasEle = list.has(ele); + if (!listHasEle && ele.grabbable() && !ele.locked()) { + list.merge(ele); + setGrabbed(ele); + } + }, "addToDragList"); + var addDescendantsToDrag = /* @__PURE__ */ __name(function addDescendantsToDrag2(node2, opts) { + if (!node2.cy().hasCompoundNodes()) { + return; + } + if (opts.inDragLayer == null && opts.addToList == null) { + return; + } + var innerNodes = node2.descendants(); + if (opts.inDragLayer) { + innerNodes.forEach(setInDragLayer); + innerNodes.connectedEdges().forEach(setInDragLayer); + } + if (opts.addToList) { + addToDragList(innerNodes, opts); + } + }, "addDescendantsToDrag"); + var addNodesToDrag = /* @__PURE__ */ __name(function addNodesToDrag2(nodes5, opts) { + opts = opts || {}; + var hasCompoundNodes2 = nodes5.cy().hasCompoundNodes(); + if (opts.inDragLayer) { + nodes5.forEach(setInDragLayer); + nodes5.neighborhood().stdFilter(function(ele) { + return !hasCompoundNodes2 || ele.isEdge(); + }).forEach(setInDragLayer); + } + if (opts.addToList) { + nodes5.forEach(function(ele) { + addToDragList(ele, opts); + }); + } + addDescendantsToDrag(nodes5, opts); + updateAncestorsInDragLayer(nodes5, { + inDragLayer: opts.inDragLayer + }); + r2.updateCachedGrabbedEles(); + }, "addNodesToDrag"); + var addNodeToDrag = addNodesToDrag; + var freeDraggedElements = /* @__PURE__ */ __name(function freeDraggedElements2(grabbedEles) { + if (!grabbedEles) { + return; + } + r2.getCachedZSortedEles().forEach(function(ele) { + setFreed(ele); + setOutDragLayer(ele); + removeGrabTarget(ele); + }); + r2.updateCachedGrabbedEles(); + }, "freeDraggedElements"); + var updateAncestorsInDragLayer = /* @__PURE__ */ __name(function updateAncestorsInDragLayer2(node2, opts) { + if (opts.inDragLayer == null && opts.addToList == null) { + return; + } + if (!node2.cy().hasCompoundNodes()) { + return; + } + var parent4 = node2.ancestors().orphans(); + if (parent4.same(node2)) { + return; + } + var nodes5 = parent4.descendants().spawnSelf().merge(parent4).unmerge(node2).unmerge(node2.descendants()); + var edges3 = nodes5.connectedEdges(); + if (opts.inDragLayer) { + edges3.forEach(setInDragLayer); + nodes5.forEach(setInDragLayer); + } + if (opts.addToList) { + nodes5.forEach(function(ele) { + addToDragList(ele, opts); + }); + } + }, "updateAncestorsInDragLayer"); + var blurActiveDomElement = /* @__PURE__ */ __name(function blurActiveDomElement2() { + if (document.activeElement != null && document.activeElement.blur != null) { + document.activeElement.blur(); + } + }, "blurActiveDomElement"); + var haveMutationsApi = typeof MutationObserver !== "undefined"; + var haveResizeObserverApi = typeof ResizeObserver !== "undefined"; + if (haveMutationsApi) { + r2.removeObserver = new MutationObserver(function(mutns) { + for (var i2 = 0; i2 < mutns.length; i2++) { + var mutn = mutns[i2]; + var rNodes = mutn.removedNodes; + if (rNodes) { + for (var j3 = 0; j3 < rNodes.length; j3++) { + var rNode = rNodes[j3]; + if (rNode === r2.container) { + r2.destroy(); + break; + } + } + } + } + }); + if (r2.container.parentNode) { + r2.removeObserver.observe(r2.container.parentNode, { + childList: true + }); + } + } else { + r2.registerBinding(r2.container, "DOMNodeRemoved", function(e3) { + r2.destroy(); + }); + } + var onResize = debounce(function() { + r2.cy.resize(); + }, 100); + if (haveMutationsApi) { + r2.styleObserver = new MutationObserver(onResize); + r2.styleObserver.observe(r2.container, { + attributes: true + }); + } + r2.registerBinding(containerWindow, "resize", onResize); + if (haveResizeObserverApi) { + r2.resizeObserver = new ResizeObserver(onResize); + r2.resizeObserver.observe(r2.container); + } + var forEachUp = /* @__PURE__ */ __name(function forEachUp2(domEle, fn3) { + while (domEle != null) { + fn3(domEle); + domEle = domEle.parentNode; + } + }, "forEachUp"); + var invalidateCoords = /* @__PURE__ */ __name(function invalidateCoords2() { + r2.invalidateContainerClientCoordsCache(); + }, "invalidateCoords"); + forEachUp(r2.container, function(domEle) { + r2.registerBinding(domEle, "transitionend", invalidateCoords); + r2.registerBinding(domEle, "animationend", invalidateCoords); + r2.registerBinding(domEle, "scroll", invalidateCoords); + }); + r2.registerBinding(r2.container, "contextmenu", function(e3) { + e3.preventDefault(); + }); + var inBoxSelection = /* @__PURE__ */ __name(function inBoxSelection2() { + return r2.selection[4] !== 0; + }, "inBoxSelection"); + var eventInContainer = /* @__PURE__ */ __name(function eventInContainer2(e3) { + var containerPageCoords = r2.findContainerClientCoords(); + var x5 = containerPageCoords[0]; + var y6 = containerPageCoords[1]; + var width3 = containerPageCoords[2]; + var height2 = containerPageCoords[3]; + var positions2 = e3.touches ? e3.touches : [e3]; + var atLeastOnePosInside = false; + for (var i2 = 0; i2 < positions2.length; i2++) { + var p3 = positions2[i2]; + if (x5 <= p3.clientX && p3.clientX <= x5 + width3 && y6 <= p3.clientY && p3.clientY <= y6 + height2) { + atLeastOnePosInside = true; + break; + } + } + if (!atLeastOnePosInside) { + return false; + } + var container2 = r2.container; + var target = e3.target; + var tParent = target.parentNode; + var containerIsTarget = false; + while (tParent) { + if (tParent === container2) { + containerIsTarget = true; + break; + } + tParent = tParent.parentNode; + } + if (!containerIsTarget) { + return false; + } + return true; + }, "eventInContainer"); + r2.registerBinding(r2.container, "mousedown", /* @__PURE__ */ __name(function mousedownHandler(e3) { + if (!eventInContainer(e3)) { + return; + } + if (r2.hoverData.which === 1 && e3.which !== 1) { + return; + } + e3.preventDefault(); + blurActiveDomElement(); + r2.hoverData.capture = true; + r2.hoverData.which = e3.which; + var cy = r2.cy; + var gpos = [e3.clientX, e3.clientY]; + var pos = r2.projectIntoViewport(gpos[0], gpos[1]); + var select = r2.selection; + var nears = r2.findNearestElements(pos[0], pos[1], true, false); + var near = nears[0]; + var draggedElements = r2.dragData.possibleDragElements; + r2.hoverData.mdownPos = pos; + r2.hoverData.mdownGPos = gpos; + var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) { + return { + originalEvent: e3, + type: type3, + position: { + x: pos[0], + y: pos[1] + } + }; + }, "makeEvent"); + var checkForTaphold = /* @__PURE__ */ __name(function checkForTaphold2() { + r2.hoverData.tapholdCancelled = false; + clearTimeout(r2.hoverData.tapholdTimeout); + r2.hoverData.tapholdTimeout = setTimeout(function() { + if (r2.hoverData.tapholdCancelled) { + return; + } else { + var ele = r2.hoverData.down; + if (ele) { + ele.emit(makeEvent("taphold")); + } else { + cy.emit(makeEvent("taphold")); + } + } + }, r2.tapholdDuration); + }, "checkForTaphold"); + if (e3.which == 3) { + r2.hoverData.cxtStarted = true; + var cxtEvt = { + originalEvent: e3, + type: "cxttapstart", + position: { + x: pos[0], + y: pos[1] + } + }; + if (near) { + near.activate(); + near.emit(cxtEvt); + r2.hoverData.down = near; + } else { + cy.emit(cxtEvt); + } + r2.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime(); + r2.hoverData.cxtDragged = false; + } else if (e3.which == 1) { + if (near) { + near.activate(); + } + { + if (near != null) { + if (r2.nodeIsGrabbable(near)) { + var triggerGrab = /* @__PURE__ */ __name(function triggerGrab2(ele) { + ele.emit(makeEvent("grab")); + }, "triggerGrab"); + setGrabTarget(near); + if (!near.selected()) { + draggedElements = r2.dragData.possibleDragElements = cy.collection(); + addNodeToDrag(near, { + addToList: draggedElements + }); + near.emit(makeEvent("grabon")).emit(makeEvent("grab")); + } else { + draggedElements = r2.dragData.possibleDragElements = cy.collection(); + var selectedNodes = cy.$(function(ele) { + return ele.isNode() && ele.selected() && r2.nodeIsGrabbable(ele); + }); + addNodesToDrag(selectedNodes, { + addToList: draggedElements + }); + near.emit(makeEvent("grabon")); + selectedNodes.forEach(triggerGrab); + } + r2.redrawHint("eles", true); + r2.redrawHint("drag", true); + } + } + r2.hoverData.down = near; + r2.hoverData.downs = nears; + r2.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime(); + } + triggerEvents(near, ["mousedown", "tapstart", "vmousedown"], e3, { + x: pos[0], + y: pos[1] + }); + if (near == null) { + select[4] = 1; + r2.data.bgActivePosistion = { + x: pos[0], + y: pos[1] + }; + r2.redrawHint("select", true); + r2.redraw(); + } else if (near.pannable()) { + select[4] = 1; + } + checkForTaphold(); + } + select[0] = select[2] = pos[0]; + select[1] = select[3] = pos[1]; + }, "mousedownHandler"), false); + var shadowRoot = getShadowRoot(r2.container); + r2.registerBinding([containerWindow, shadowRoot], "mousemove", /* @__PURE__ */ __name(function mousemoveHandler(e3) { + var capture = r2.hoverData.capture; + if (!capture && !eventInContainer(e3)) { + return; + } + var preventDefault2 = false; + var cy = r2.cy; + var zoom2 = cy.zoom(); + var gpos = [e3.clientX, e3.clientY]; + var pos = r2.projectIntoViewport(gpos[0], gpos[1]); + var mdownPos = r2.hoverData.mdownPos; + var mdownGPos = r2.hoverData.mdownGPos; + var select = r2.selection; + var near = null; + if (!r2.hoverData.draggingEles && !r2.hoverData.dragging && !r2.hoverData.selecting) { + near = r2.findNearestElement(pos[0], pos[1], true, false); + } + var last4 = r2.hoverData.last; + var down = r2.hoverData.down; + var disp = [pos[0] - select[2], pos[1] - select[3]]; + var draggedElements = r2.dragData.possibleDragElements; + var isOverThresholdDrag; + if (mdownGPos) { + var dx = gpos[0] - mdownGPos[0]; + var dx2 = dx * dx; + var dy = gpos[1] - mdownGPos[1]; + var dy2 = dy * dy; + var dist22 = dx2 + dy2; + r2.hoverData.isOverThresholdDrag = isOverThresholdDrag = dist22 >= r2.desktopTapThreshold2; + } + var multSelKeyDown = isMultSelKeyDown(e3); + if (isOverThresholdDrag) { + r2.hoverData.tapholdCancelled = true; + } + var updateDragDelta = /* @__PURE__ */ __name(function updateDragDelta2() { + var dragDelta2 = r2.hoverData.dragDelta = r2.hoverData.dragDelta || []; + if (dragDelta2.length === 0) { + dragDelta2.push(disp[0]); + dragDelta2.push(disp[1]); + } else { + dragDelta2[0] += disp[0]; + dragDelta2[1] += disp[1]; + } + }, "updateDragDelta"); + preventDefault2 = true; + triggerEvents(near, ["mousemove", "vmousemove", "tapdrag"], e3, { + x: pos[0], + y: pos[1] + }); + var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) { + return { + originalEvent: e3, + type: type3, + position: { + x: pos[0], + y: pos[1] + } + }; + }, "makeEvent"); + var goIntoBoxMode = /* @__PURE__ */ __name(function goIntoBoxMode2() { + r2.data.bgActivePosistion = void 0; + if (!r2.hoverData.selecting) { + cy.emit(makeEvent("boxstart")); + } + select[4] = 1; + r2.hoverData.selecting = true; + r2.redrawHint("select", true); + r2.redraw(); + }, "goIntoBoxMode"); + if (r2.hoverData.which === 3) { + if (isOverThresholdDrag) { + var cxtEvt = makeEvent("cxtdrag"); + if (down) { + down.emit(cxtEvt); + } else { + cy.emit(cxtEvt); + } + r2.hoverData.cxtDragged = true; + if (!r2.hoverData.cxtOver || near !== r2.hoverData.cxtOver) { + if (r2.hoverData.cxtOver) { + r2.hoverData.cxtOver.emit(makeEvent("cxtdragout")); + } + r2.hoverData.cxtOver = near; + if (near) { + near.emit(makeEvent("cxtdragover")); + } + } + } + } else if (r2.hoverData.dragging) { + preventDefault2 = true; + if (cy.panningEnabled() && cy.userPanningEnabled()) { + var deltaP; + if (r2.hoverData.justStartedPan) { + var mdPos = r2.hoverData.mdownPos; + deltaP = { + x: (pos[0] - mdPos[0]) * zoom2, + y: (pos[1] - mdPos[1]) * zoom2 + }; + r2.hoverData.justStartedPan = false; + } else { + deltaP = { + x: disp[0] * zoom2, + y: disp[1] * zoom2 + }; + } + cy.panBy(deltaP); + cy.emit(makeEvent("dragpan")); + r2.hoverData.dragged = true; + } + pos = r2.projectIntoViewport(e3.clientX, e3.clientY); + } else if (select[4] == 1 && (down == null || down.pannable())) { + if (isOverThresholdDrag) { + if (!r2.hoverData.dragging && cy.boxSelectionEnabled() && (multSelKeyDown || !cy.panningEnabled() || !cy.userPanningEnabled())) { + goIntoBoxMode(); + } else if (!r2.hoverData.selecting && cy.panningEnabled() && cy.userPanningEnabled()) { + var allowPassthrough = allowPanningPassthrough(down, r2.hoverData.downs); + if (allowPassthrough) { + r2.hoverData.dragging = true; + r2.hoverData.justStartedPan = true; + select[4] = 0; + r2.data.bgActivePosistion = array2point(mdownPos); + r2.redrawHint("select", true); + r2.redraw(); + } + } + if (down && down.pannable() && down.active()) { + down.unactivate(); + } + } + } else { + if (down && down.pannable() && down.active()) { + down.unactivate(); + } + if ((!down || !down.grabbed()) && near != last4) { + if (last4) { + triggerEvents(last4, ["mouseout", "tapdragout"], e3, { + x: pos[0], + y: pos[1] + }); + } + if (near) { + triggerEvents(near, ["mouseover", "tapdragover"], e3, { + x: pos[0], + y: pos[1] + }); + } + r2.hoverData.last = near; + } + if (down) { + if (isOverThresholdDrag) { + if (cy.boxSelectionEnabled() && multSelKeyDown) { + if (down && down.grabbed()) { + freeDraggedElements(draggedElements); + down.emit(makeEvent("freeon")); + draggedElements.emit(makeEvent("free")); + if (r2.dragData.didDrag) { + down.emit(makeEvent("dragfreeon")); + draggedElements.emit(makeEvent("dragfree")); + } + } + goIntoBoxMode(); + } else if (down && down.grabbed() && r2.nodeIsDraggable(down)) { + var justStartedDrag = !r2.dragData.didDrag; + if (justStartedDrag) { + r2.redrawHint("eles", true); + } + r2.dragData.didDrag = true; + if (!r2.hoverData.draggingEles) { + addNodesToDrag(draggedElements, { + inDragLayer: true + }); + } + var totalShift = { + x: 0, + y: 0 + }; + if (number$1(disp[0]) && number$1(disp[1])) { + totalShift.x += disp[0]; + totalShift.y += disp[1]; + if (justStartedDrag) { + var dragDelta = r2.hoverData.dragDelta; + if (dragDelta && number$1(dragDelta[0]) && number$1(dragDelta[1])) { + totalShift.x += dragDelta[0]; + totalShift.y += dragDelta[1]; + } + } + } + r2.hoverData.draggingEles = true; + draggedElements.silentShift(totalShift).emit(makeEvent("position")).emit(makeEvent("drag")); + r2.redrawHint("drag", true); + r2.redraw(); + } + } else { + updateDragDelta(); + } + } + preventDefault2 = true; + } + select[2] = pos[0]; + select[3] = pos[1]; + if (preventDefault2) { + if (e3.stopPropagation) e3.stopPropagation(); + if (e3.preventDefault) e3.preventDefault(); + return false; + } + }, "mousemoveHandler"), false); + var clickTimeout, didDoubleClick, prevClickTimeStamp; + r2.registerBinding(containerWindow, "mouseup", /* @__PURE__ */ __name(function mouseupHandler(e3) { + if (r2.hoverData.which === 1 && e3.which !== 1 && r2.hoverData.capture) { + return; + } + var capture = r2.hoverData.capture; + if (!capture) { + return; + } + r2.hoverData.capture = false; + var cy = r2.cy; + var pos = r2.projectIntoViewport(e3.clientX, e3.clientY); + var select = r2.selection; + var near = r2.findNearestElement(pos[0], pos[1], true, false); + var draggedElements = r2.dragData.possibleDragElements; + var down = r2.hoverData.down; + var multSelKeyDown = isMultSelKeyDown(e3); + if (r2.data.bgActivePosistion) { + r2.redrawHint("select", true); + r2.redraw(); + } + r2.hoverData.tapholdCancelled = true; + r2.data.bgActivePosistion = void 0; + if (down) { + down.unactivate(); + } + var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) { + return { + originalEvent: e3, + type: type3, + position: { + x: pos[0], + y: pos[1] + } + }; + }, "makeEvent"); + if (r2.hoverData.which === 3) { + var cxtEvt = makeEvent("cxttapend"); + if (down) { + down.emit(cxtEvt); + } else { + cy.emit(cxtEvt); + } + if (!r2.hoverData.cxtDragged) { + var cxtTap = makeEvent("cxttap"); + if (down) { + down.emit(cxtTap); + } else { + cy.emit(cxtTap); + } + } + r2.hoverData.cxtDragged = false; + r2.hoverData.which = null; + } else if (r2.hoverData.which === 1) { + triggerEvents(near, ["mouseup", "tapend", "vmouseup"], e3, { + x: pos[0], + y: pos[1] + }); + if (!r2.dragData.didDrag && // didn't move a node around + !r2.hoverData.dragged && // didn't pan + !r2.hoverData.selecting && // not box selection + !r2.hoverData.isOverThresholdDrag) { + triggerEvents(down, ["click", "tap", "vclick"], e3, { + x: pos[0], + y: pos[1] + }); + didDoubleClick = false; + if (e3.timeStamp - prevClickTimeStamp <= cy.multiClickDebounceTime()) { + clickTimeout && clearTimeout(clickTimeout); + didDoubleClick = true; + prevClickTimeStamp = null; + triggerEvents(down, ["dblclick", "dbltap", "vdblclick"], e3, { + x: pos[0], + y: pos[1] + }); + } else { + clickTimeout = setTimeout(function() { + if (didDoubleClick) return; + triggerEvents(down, ["oneclick", "onetap", "voneclick"], e3, { + x: pos[0], + y: pos[1] + }); + }, cy.multiClickDebounceTime()); + prevClickTimeStamp = e3.timeStamp; + } + } + if (down == null && !r2.dragData.didDrag && !r2.hoverData.selecting && !r2.hoverData.dragged && !isMultSelKeyDown(e3)) { + cy.$(isSelected).unselect(["tapunselect"]); + if (draggedElements.length > 0) { + r2.redrawHint("eles", true); + } + r2.dragData.possibleDragElements = draggedElements = cy.collection(); + } + if (near == down && !r2.dragData.didDrag && !r2.hoverData.selecting) { + if (near != null && near._private.selectable) { + if (r2.hoverData.dragging) ; + else if (cy.selectionType() === "additive" || multSelKeyDown) { + if (near.selected()) { + near.unselect(["tapunselect"]); + } else { + near.select(["tapselect"]); + } + } else { + if (!multSelKeyDown) { + cy.$(isSelected).unmerge(near).unselect(["tapunselect"]); + near.select(["tapselect"]); + } + } + r2.redrawHint("eles", true); + } + } + if (r2.hoverData.selecting) { + var box = cy.collection(r2.getAllInBox(select[0], select[1], select[2], select[3])); + r2.redrawHint("select", true); + if (box.length > 0) { + r2.redrawHint("eles", true); + } + cy.emit(makeEvent("boxend")); + var eleWouldBeSelected = /* @__PURE__ */ __name(function eleWouldBeSelected2(ele) { + return ele.selectable() && !ele.selected(); + }, "eleWouldBeSelected"); + if (cy.selectionType() === "additive") { + box.emit(makeEvent("box")).stdFilter(eleWouldBeSelected).select().emit(makeEvent("boxselect")); + } else { + if (!multSelKeyDown) { + cy.$(isSelected).unmerge(box).unselect(); + } + box.emit(makeEvent("box")).stdFilter(eleWouldBeSelected).select().emit(makeEvent("boxselect")); + } + r2.redraw(); + } + if (r2.hoverData.dragging) { + r2.hoverData.dragging = false; + r2.redrawHint("select", true); + r2.redrawHint("eles", true); + r2.redraw(); + } + if (!select[4]) { + r2.redrawHint("drag", true); + r2.redrawHint("eles", true); + var downWasGrabbed = down && down.grabbed(); + freeDraggedElements(draggedElements); + if (downWasGrabbed) { + down.emit(makeEvent("freeon")); + draggedElements.emit(makeEvent("free")); + if (r2.dragData.didDrag) { + down.emit(makeEvent("dragfreeon")); + draggedElements.emit(makeEvent("dragfree")); + } + } + } + } + select[4] = 0; + r2.hoverData.down = null; + r2.hoverData.cxtStarted = false; + r2.hoverData.draggingEles = false; + r2.hoverData.selecting = false; + r2.hoverData.isOverThresholdDrag = false; + r2.dragData.didDrag = false; + r2.hoverData.dragged = false; + r2.hoverData.dragDelta = []; + r2.hoverData.mdownPos = null; + r2.hoverData.mdownGPos = null; + r2.hoverData.which = null; + }, "mouseupHandler"), false); + var wheelDeltas = []; + var wheelDeltaN = 4; + var inaccurateScrollDevice; + var inaccurateScrollFactor = 1e5; + var allAreDivisibleBy = /* @__PURE__ */ __name(function allAreDivisibleBy2(list, factor) { + for (var i2 = 0; i2 < list.length; i2++) { + if (list[i2] % factor !== 0) { + return false; + } + } + return true; + }, "allAreDivisibleBy"); + var allAreSameMagnitude = /* @__PURE__ */ __name(function allAreSameMagnitude2(list) { + var firstMag = Math.abs(list[0]); + for (var i2 = 1; i2 < list.length; i2++) { + if (Math.abs(list[i2]) !== firstMag) { + return false; + } + } + return true; + }, "allAreSameMagnitude"); + var wheelHandler = /* @__PURE__ */ __name(function wheelHandler2(e3) { + var clamp = false; + var delta = e3.deltaY; + if (delta == null) { + if (e3.wheelDeltaY != null) { + delta = e3.wheelDeltaY / 4; + } else if (e3.wheelDelta != null) { + delta = e3.wheelDelta / 4; + } + } + if (delta === 0) { + return; + } + if (inaccurateScrollDevice == null) { + if (wheelDeltas.length >= wheelDeltaN) { + var wds = wheelDeltas; + inaccurateScrollDevice = allAreDivisibleBy(wds, 5); + if (!inaccurateScrollDevice) { + var firstMag = Math.abs(wds[0]); + inaccurateScrollDevice = allAreSameMagnitude(wds) && firstMag > 5; + } + if (inaccurateScrollDevice) { + for (var i2 = 0; i2 < wds.length; i2++) { + inaccurateScrollFactor = Math.min(Math.abs(wds[i2]), inaccurateScrollFactor); + } + } + } else { + wheelDeltas.push(delta); + clamp = true; + } + } else if (inaccurateScrollDevice) { + inaccurateScrollFactor = Math.min(Math.abs(delta), inaccurateScrollFactor); + } + if (r2.scrollingPage) { + return; + } + var cy = r2.cy; + var zoom2 = cy.zoom(); + var pan2 = cy.pan(); + var pos = r2.projectIntoViewport(e3.clientX, e3.clientY); + var rpos = [pos[0] * zoom2 + pan2.x, pos[1] * zoom2 + pan2.y]; + if (r2.hoverData.draggingEles || r2.hoverData.dragging || r2.hoverData.cxtStarted || inBoxSelection()) { + e3.preventDefault(); + return; + } + if (cy.panningEnabled() && cy.userPanningEnabled() && cy.zoomingEnabled() && cy.userZoomingEnabled()) { + e3.preventDefault(); + r2.data.wheelZooming = true; + clearTimeout(r2.data.wheelTimeout); + r2.data.wheelTimeout = setTimeout(function() { + r2.data.wheelZooming = false; + r2.redrawHint("eles", true); + r2.redraw(); + }, 150); + var diff2; + if (clamp && Math.abs(delta) > 5) { + delta = signum(delta) * 5; + } + diff2 = delta / -250; + if (inaccurateScrollDevice) { + diff2 /= inaccurateScrollFactor; + diff2 *= 3; + } + diff2 = diff2 * r2.wheelSensitivity; + var needsWheelFix = e3.deltaMode === 1; + if (needsWheelFix) { + diff2 *= 33; + } + var newZoom = cy.zoom() * Math.pow(10, diff2); + if (e3.type === "gesturechange") { + newZoom = r2.gestureStartZoom * e3.scale; + } + cy.zoom({ + level: newZoom, + renderedPosition: { + x: rpos[0], + y: rpos[1] + } + }); + cy.emit({ + type: e3.type === "gesturechange" ? "pinchzoom" : "scrollzoom", + originalEvent: e3, + position: { + x: pos[0], + y: pos[1] + } + }); + } + }, "wheelHandler"); + r2.registerBinding(r2.container, "wheel", wheelHandler, true); + r2.registerBinding(containerWindow, "scroll", /* @__PURE__ */ __name(function scrollHandler(e3) { + r2.scrollingPage = true; + clearTimeout(r2.scrollingPageTimeout); + r2.scrollingPageTimeout = setTimeout(function() { + r2.scrollingPage = false; + }, 250); + }, "scrollHandler"), true); + r2.registerBinding(r2.container, "gesturestart", /* @__PURE__ */ __name(function gestureStartHandler(e3) { + r2.gestureStartZoom = r2.cy.zoom(); + if (!r2.hasTouchStarted) { + e3.preventDefault(); + } + }, "gestureStartHandler"), true); + r2.registerBinding(r2.container, "gesturechange", function(e3) { + if (!r2.hasTouchStarted) { + wheelHandler(e3); + } + }, true); + r2.registerBinding(r2.container, "mouseout", /* @__PURE__ */ __name(function mouseOutHandler(e3) { + var pos = r2.projectIntoViewport(e3.clientX, e3.clientY); + r2.cy.emit({ + originalEvent: e3, + type: "mouseout", + position: { + x: pos[0], + y: pos[1] + } + }); + }, "mouseOutHandler"), false); + r2.registerBinding(r2.container, "mouseover", /* @__PURE__ */ __name(function mouseOverHandler(e3) { + var pos = r2.projectIntoViewport(e3.clientX, e3.clientY); + r2.cy.emit({ + originalEvent: e3, + type: "mouseover", + position: { + x: pos[0], + y: pos[1] + } + }); + }, "mouseOverHandler"), false); + var f1x1, f1y1, f2x1, f2y1; + var distance1, distance1Sq; + var center1, modelCenter1; + var offsetLeft, offsetTop; + var containerWidth, containerHeight; + var twoFingersStartInside; + var distance3 = /* @__PURE__ */ __name(function distance4(x1, y1, x22, y22) { + return Math.sqrt((x22 - x1) * (x22 - x1) + (y22 - y1) * (y22 - y1)); + }, "distance"); + var distanceSq = /* @__PURE__ */ __name(function distanceSq2(x1, y1, x22, y22) { + return (x22 - x1) * (x22 - x1) + (y22 - y1) * (y22 - y1); + }, "distanceSq"); + var touchstartHandler; + r2.registerBinding(r2.container, "touchstart", touchstartHandler = /* @__PURE__ */ __name(function touchstartHandler2(e3) { + r2.hasTouchStarted = true; + if (!eventInContainer(e3)) { + return; + } + blurActiveDomElement(); + r2.touchData.capture = true; + r2.data.bgActivePosistion = void 0; + var cy = r2.cy; + var now3 = r2.touchData.now; + var earlier = r2.touchData.earlier; + if (e3.touches[0]) { + var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY); + now3[0] = pos[0]; + now3[1] = pos[1]; + } + if (e3.touches[1]) { + var pos = r2.projectIntoViewport(e3.touches[1].clientX, e3.touches[1].clientY); + now3[2] = pos[0]; + now3[3] = pos[1]; + } + if (e3.touches[2]) { + var pos = r2.projectIntoViewport(e3.touches[2].clientX, e3.touches[2].clientY); + now3[4] = pos[0]; + now3[5] = pos[1]; + } + var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) { + return { + originalEvent: e3, + type: type3, + position: { + x: now3[0], + y: now3[1] + } + }; + }, "makeEvent"); + if (e3.touches[1]) { + r2.touchData.singleTouchMoved = true; + freeDraggedElements(r2.dragData.touchDragEles); + var offsets = r2.findContainerClientCoords(); + offsetLeft = offsets[0]; + offsetTop = offsets[1]; + containerWidth = offsets[2]; + containerHeight = offsets[3]; + f1x1 = e3.touches[0].clientX - offsetLeft; + f1y1 = e3.touches[0].clientY - offsetTop; + f2x1 = e3.touches[1].clientX - offsetLeft; + f2y1 = e3.touches[1].clientY - offsetTop; + twoFingersStartInside = 0 <= f1x1 && f1x1 <= containerWidth && 0 <= f2x1 && f2x1 <= containerWidth && 0 <= f1y1 && f1y1 <= containerHeight && 0 <= f2y1 && f2y1 <= containerHeight; + var pan2 = cy.pan(); + var zoom2 = cy.zoom(); + distance1 = distance3(f1x1, f1y1, f2x1, f2y1); + distance1Sq = distanceSq(f1x1, f1y1, f2x1, f2y1); + center1 = [(f1x1 + f2x1) / 2, (f1y1 + f2y1) / 2]; + modelCenter1 = [(center1[0] - pan2.x) / zoom2, (center1[1] - pan2.y) / zoom2]; + var cxtDistThreshold = 200; + var cxtDistThresholdSq = cxtDistThreshold * cxtDistThreshold; + if (distance1Sq < cxtDistThresholdSq && !e3.touches[2]) { + var near1 = r2.findNearestElement(now3[0], now3[1], true, true); + var near2 = r2.findNearestElement(now3[2], now3[3], true, true); + if (near1 && near1.isNode()) { + near1.activate().emit(makeEvent("cxttapstart")); + r2.touchData.start = near1; + } else if (near2 && near2.isNode()) { + near2.activate().emit(makeEvent("cxttapstart")); + r2.touchData.start = near2; + } else { + cy.emit(makeEvent("cxttapstart")); + } + if (r2.touchData.start) { + r2.touchData.start._private.grabbed = false; + } + r2.touchData.cxt = true; + r2.touchData.cxtDragged = false; + r2.data.bgActivePosistion = void 0; + r2.redraw(); + return; + } + } + if (e3.touches[2]) { + if (cy.boxSelectionEnabled()) { + e3.preventDefault(); + } + } else if (e3.touches[1]) ; + else if (e3.touches[0]) { + var nears = r2.findNearestElements(now3[0], now3[1], true, true); + var near = nears[0]; + if (near != null) { + near.activate(); + r2.touchData.start = near; + r2.touchData.starts = nears; + if (r2.nodeIsGrabbable(near)) { + var draggedEles = r2.dragData.touchDragEles = cy.collection(); + var selectedNodes = null; + r2.redrawHint("eles", true); + r2.redrawHint("drag", true); + if (near.selected()) { + selectedNodes = cy.$(function(ele) { + return ele.selected() && r2.nodeIsGrabbable(ele); + }); + addNodesToDrag(selectedNodes, { + addToList: draggedEles + }); + } else { + addNodeToDrag(near, { + addToList: draggedEles + }); + } + setGrabTarget(near); + near.emit(makeEvent("grabon")); + if (selectedNodes) { + selectedNodes.forEach(function(n2) { + n2.emit(makeEvent("grab")); + }); + } else { + near.emit(makeEvent("grab")); + } + } + } + triggerEvents(near, ["touchstart", "tapstart", "vmousedown"], e3, { + x: now3[0], + y: now3[1] + }); + if (near == null) { + r2.data.bgActivePosistion = { + x: pos[0], + y: pos[1] + }; + r2.redrawHint("select", true); + r2.redraw(); + } + r2.touchData.singleTouchMoved = false; + r2.touchData.singleTouchStartTime = +/* @__PURE__ */ new Date(); + clearTimeout(r2.touchData.tapholdTimeout); + r2.touchData.tapholdTimeout = setTimeout(function() { + if (r2.touchData.singleTouchMoved === false && !r2.pinching && !r2.touchData.selecting) { + triggerEvents(r2.touchData.start, ["taphold"], e3, { + x: now3[0], + y: now3[1] + }); + } + }, r2.tapholdDuration); + } + if (e3.touches.length >= 1) { + var sPos = r2.touchData.startPosition = [null, null, null, null, null, null]; + for (var i2 = 0; i2 < now3.length; i2++) { + sPos[i2] = earlier[i2] = now3[i2]; + } + var touch0 = e3.touches[0]; + r2.touchData.startGPosition = [touch0.clientX, touch0.clientY]; + } + }, "touchstartHandler"), false); + var touchmoveHandler; + r2.registerBinding(containerWindow, "touchmove", touchmoveHandler = /* @__PURE__ */ __name(function touchmoveHandler2(e3) { + var capture = r2.touchData.capture; + if (!capture && !eventInContainer(e3)) { + return; + } + var select = r2.selection; + var cy = r2.cy; + var now3 = r2.touchData.now; + var earlier = r2.touchData.earlier; + var zoom2 = cy.zoom(); + if (e3.touches[0]) { + var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY); + now3[0] = pos[0]; + now3[1] = pos[1]; + } + if (e3.touches[1]) { + var pos = r2.projectIntoViewport(e3.touches[1].clientX, e3.touches[1].clientY); + now3[2] = pos[0]; + now3[3] = pos[1]; + } + if (e3.touches[2]) { + var pos = r2.projectIntoViewport(e3.touches[2].clientX, e3.touches[2].clientY); + now3[4] = pos[0]; + now3[5] = pos[1]; + } + var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) { + return { + originalEvent: e3, + type: type3, + position: { + x: now3[0], + y: now3[1] + } + }; + }, "makeEvent"); + var startGPos = r2.touchData.startGPosition; + var isOverThresholdDrag; + if (capture && e3.touches[0] && startGPos) { + var disp = []; + for (var j3 = 0; j3 < now3.length; j3++) { + disp[j3] = now3[j3] - earlier[j3]; + } + var dx = e3.touches[0].clientX - startGPos[0]; + var dx2 = dx * dx; + var dy = e3.touches[0].clientY - startGPos[1]; + var dy2 = dy * dy; + var dist22 = dx2 + dy2; + isOverThresholdDrag = dist22 >= r2.touchTapThreshold2; + } + if (capture && r2.touchData.cxt) { + e3.preventDefault(); + var f1x2 = e3.touches[0].clientX - offsetLeft, f1y2 = e3.touches[0].clientY - offsetTop; + var f2x2 = e3.touches[1].clientX - offsetLeft, f2y2 = e3.touches[1].clientY - offsetTop; + var distance2Sq = distanceSq(f1x2, f1y2, f2x2, f2y2); + var factorSq = distance2Sq / distance1Sq; + var distThreshold = 150; + var distThresholdSq = distThreshold * distThreshold; + var factorThreshold = 1.5; + var factorThresholdSq = factorThreshold * factorThreshold; + if (factorSq >= factorThresholdSq || distance2Sq >= distThresholdSq) { + r2.touchData.cxt = false; + r2.data.bgActivePosistion = void 0; + r2.redrawHint("select", true); + var cxtEvt = makeEvent("cxttapend"); + if (r2.touchData.start) { + r2.touchData.start.unactivate().emit(cxtEvt); + r2.touchData.start = null; + } else { + cy.emit(cxtEvt); + } + } + } + if (capture && r2.touchData.cxt) { + var cxtEvt = makeEvent("cxtdrag"); + r2.data.bgActivePosistion = void 0; + r2.redrawHint("select", true); + if (r2.touchData.start) { + r2.touchData.start.emit(cxtEvt); + } else { + cy.emit(cxtEvt); + } + if (r2.touchData.start) { + r2.touchData.start._private.grabbed = false; + } + r2.touchData.cxtDragged = true; + var near = r2.findNearestElement(now3[0], now3[1], true, true); + if (!r2.touchData.cxtOver || near !== r2.touchData.cxtOver) { + if (r2.touchData.cxtOver) { + r2.touchData.cxtOver.emit(makeEvent("cxtdragout")); + } + r2.touchData.cxtOver = near; + if (near) { + near.emit(makeEvent("cxtdragover")); + } + } + } else if (capture && e3.touches[2] && cy.boxSelectionEnabled()) { + e3.preventDefault(); + r2.data.bgActivePosistion = void 0; + this.lastThreeTouch = +/* @__PURE__ */ new Date(); + if (!r2.touchData.selecting) { + cy.emit(makeEvent("boxstart")); + } + r2.touchData.selecting = true; + r2.touchData.didSelect = true; + select[4] = 1; + if (!select || select.length === 0 || select[0] === void 0) { + select[0] = (now3[0] + now3[2] + now3[4]) / 3; + select[1] = (now3[1] + now3[3] + now3[5]) / 3; + select[2] = (now3[0] + now3[2] + now3[4]) / 3 + 1; + select[3] = (now3[1] + now3[3] + now3[5]) / 3 + 1; + } else { + select[2] = (now3[0] + now3[2] + now3[4]) / 3; + select[3] = (now3[1] + now3[3] + now3[5]) / 3; + } + r2.redrawHint("select", true); + r2.redraw(); + } else if (capture && e3.touches[1] && !r2.touchData.didSelect && cy.zoomingEnabled() && cy.panningEnabled() && cy.userZoomingEnabled() && cy.userPanningEnabled()) { + e3.preventDefault(); + r2.data.bgActivePosistion = void 0; + r2.redrawHint("select", true); + var draggedEles = r2.dragData.touchDragEles; + if (draggedEles) { + r2.redrawHint("drag", true); + for (var i2 = 0; i2 < draggedEles.length; i2++) { + var de_p = draggedEles[i2]._private; + de_p.grabbed = false; + de_p.rscratch.inDragLayer = false; + } + } + var _start = r2.touchData.start; + var f1x2 = e3.touches[0].clientX - offsetLeft, f1y2 = e3.touches[0].clientY - offsetTop; + var f2x2 = e3.touches[1].clientX - offsetLeft, f2y2 = e3.touches[1].clientY - offsetTop; + var distance22 = distance3(f1x2, f1y2, f2x2, f2y2); + var factor = distance22 / distance1; + if (twoFingersStartInside) { + var df1x = f1x2 - f1x1; + var df1y = f1y2 - f1y1; + var df2x = f2x2 - f2x1; + var df2y = f2y2 - f2y1; + var tx = (df1x + df2x) / 2; + var ty = (df1y + df2y) / 2; + var zoom1 = cy.zoom(); + var zoom22 = zoom1 * factor; + var pan1 = cy.pan(); + var ctrx = modelCenter1[0] * zoom1 + pan1.x; + var ctry = modelCenter1[1] * zoom1 + pan1.y; + var pan2 = { + x: -zoom22 / zoom1 * (ctrx - pan1.x - tx) + ctrx, + y: -zoom22 / zoom1 * (ctry - pan1.y - ty) + ctry + }; + if (_start && _start.active()) { + var draggedEles = r2.dragData.touchDragEles; + freeDraggedElements(draggedEles); + r2.redrawHint("drag", true); + r2.redrawHint("eles", true); + _start.unactivate().emit(makeEvent("freeon")); + draggedEles.emit(makeEvent("free")); + if (r2.dragData.didDrag) { + _start.emit(makeEvent("dragfreeon")); + draggedEles.emit(makeEvent("dragfree")); + } + } + cy.viewport({ + zoom: zoom22, + pan: pan2, + cancelOnFailedZoom: true + }); + cy.emit(makeEvent("pinchzoom")); + distance1 = distance22; + f1x1 = f1x2; + f1y1 = f1y2; + f2x1 = f2x2; + f2y1 = f2y2; + r2.pinching = true; + } + if (e3.touches[0]) { + var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY); + now3[0] = pos[0]; + now3[1] = pos[1]; + } + if (e3.touches[1]) { + var pos = r2.projectIntoViewport(e3.touches[1].clientX, e3.touches[1].clientY); + now3[2] = pos[0]; + now3[3] = pos[1]; + } + if (e3.touches[2]) { + var pos = r2.projectIntoViewport(e3.touches[2].clientX, e3.touches[2].clientY); + now3[4] = pos[0]; + now3[5] = pos[1]; + } + } else if (e3.touches[0] && !r2.touchData.didSelect) { + var start3 = r2.touchData.start; + var last4 = r2.touchData.last; + var near; + if (!r2.hoverData.draggingEles && !r2.swipePanning) { + near = r2.findNearestElement(now3[0], now3[1], true, true); + } + if (capture && start3 != null) { + e3.preventDefault(); + } + if (capture && start3 != null && r2.nodeIsDraggable(start3)) { + if (isOverThresholdDrag) { + var draggedEles = r2.dragData.touchDragEles; + var justStartedDrag = !r2.dragData.didDrag; + if (justStartedDrag) { + addNodesToDrag(draggedEles, { + inDragLayer: true + }); + } + r2.dragData.didDrag = true; + var totalShift = { + x: 0, + y: 0 + }; + if (number$1(disp[0]) && number$1(disp[1])) { + totalShift.x += disp[0]; + totalShift.y += disp[1]; + if (justStartedDrag) { + r2.redrawHint("eles", true); + var dragDelta = r2.touchData.dragDelta; + if (dragDelta && number$1(dragDelta[0]) && number$1(dragDelta[1])) { + totalShift.x += dragDelta[0]; + totalShift.y += dragDelta[1]; + } + } + } + r2.hoverData.draggingEles = true; + draggedEles.silentShift(totalShift).emit(makeEvent("position")).emit(makeEvent("drag")); + r2.redrawHint("drag", true); + if (r2.touchData.startPosition[0] == earlier[0] && r2.touchData.startPosition[1] == earlier[1]) { + r2.redrawHint("eles", true); + } + r2.redraw(); + } else { + var dragDelta = r2.touchData.dragDelta = r2.touchData.dragDelta || []; + if (dragDelta.length === 0) { + dragDelta.push(disp[0]); + dragDelta.push(disp[1]); + } else { + dragDelta[0] += disp[0]; + dragDelta[1] += disp[1]; + } + } + } + { + triggerEvents(start3 || near, ["touchmove", "tapdrag", "vmousemove"], e3, { + x: now3[0], + y: now3[1] + }); + if ((!start3 || !start3.grabbed()) && near != last4) { + if (last4) { + last4.emit(makeEvent("tapdragout")); + } + if (near) { + near.emit(makeEvent("tapdragover")); + } + } + r2.touchData.last = near; + } + if (capture) { + for (var i2 = 0; i2 < now3.length; i2++) { + if (now3[i2] && r2.touchData.startPosition[i2] && isOverThresholdDrag) { + r2.touchData.singleTouchMoved = true; + } + } + } + if (capture && (start3 == null || start3.pannable()) && cy.panningEnabled() && cy.userPanningEnabled()) { + var allowPassthrough = allowPanningPassthrough(start3, r2.touchData.starts); + if (allowPassthrough) { + e3.preventDefault(); + if (!r2.data.bgActivePosistion) { + r2.data.bgActivePosistion = array2point(r2.touchData.startPosition); + } + if (r2.swipePanning) { + cy.panBy({ + x: disp[0] * zoom2, + y: disp[1] * zoom2 + }); + cy.emit(makeEvent("dragpan")); + } else if (isOverThresholdDrag) { + r2.swipePanning = true; + cy.panBy({ + x: dx * zoom2, + y: dy * zoom2 + }); + cy.emit(makeEvent("dragpan")); + if (start3) { + start3.unactivate(); + r2.redrawHint("select", true); + r2.touchData.start = null; + } + } + } + var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY); + now3[0] = pos[0]; + now3[1] = pos[1]; + } + } + for (var j3 = 0; j3 < now3.length; j3++) { + earlier[j3] = now3[j3]; + } + if (capture && e3.touches.length > 0 && !r2.hoverData.draggingEles && !r2.swipePanning && r2.data.bgActivePosistion != null) { + r2.data.bgActivePosistion = void 0; + r2.redrawHint("select", true); + r2.redraw(); + } + }, "touchmoveHandler"), false); + var touchcancelHandler; + r2.registerBinding(containerWindow, "touchcancel", touchcancelHandler = /* @__PURE__ */ __name(function touchcancelHandler2(e3) { + var start3 = r2.touchData.start; + r2.touchData.capture = false; + if (start3) { + start3.unactivate(); + } + }, "touchcancelHandler")); + var touchendHandler, didDoubleTouch, touchTimeout, prevTouchTimeStamp; + r2.registerBinding(containerWindow, "touchend", touchendHandler = /* @__PURE__ */ __name(function touchendHandler2(e3) { + var start3 = r2.touchData.start; + var capture = r2.touchData.capture; + if (capture) { + if (e3.touches.length === 0) { + r2.touchData.capture = false; + } + e3.preventDefault(); + } else { + return; + } + var select = r2.selection; + r2.swipePanning = false; + r2.hoverData.draggingEles = false; + var cy = r2.cy; + var zoom2 = cy.zoom(); + var now3 = r2.touchData.now; + var earlier = r2.touchData.earlier; + if (e3.touches[0]) { + var pos = r2.projectIntoViewport(e3.touches[0].clientX, e3.touches[0].clientY); + now3[0] = pos[0]; + now3[1] = pos[1]; + } + if (e3.touches[1]) { + var pos = r2.projectIntoViewport(e3.touches[1].clientX, e3.touches[1].clientY); + now3[2] = pos[0]; + now3[3] = pos[1]; + } + if (e3.touches[2]) { + var pos = r2.projectIntoViewport(e3.touches[2].clientX, e3.touches[2].clientY); + now3[4] = pos[0]; + now3[5] = pos[1]; + } + var makeEvent = /* @__PURE__ */ __name(function makeEvent2(type3) { + return { + originalEvent: e3, + type: type3, + position: { + x: now3[0], + y: now3[1] + } + }; + }, "makeEvent"); + if (start3) { + start3.unactivate(); + } + var ctxTapend; + if (r2.touchData.cxt) { + ctxTapend = makeEvent("cxttapend"); + if (start3) { + start3.emit(ctxTapend); + } else { + cy.emit(ctxTapend); + } + if (!r2.touchData.cxtDragged) { + var ctxTap = makeEvent("cxttap"); + if (start3) { + start3.emit(ctxTap); + } else { + cy.emit(ctxTap); + } + } + if (r2.touchData.start) { + r2.touchData.start._private.grabbed = false; + } + r2.touchData.cxt = false; + r2.touchData.start = null; + r2.redraw(); + return; + } + if (!e3.touches[2] && cy.boxSelectionEnabled() && r2.touchData.selecting) { + r2.touchData.selecting = false; + var box = cy.collection(r2.getAllInBox(select[0], select[1], select[2], select[3])); + select[0] = void 0; + select[1] = void 0; + select[2] = void 0; + select[3] = void 0; + select[4] = 0; + r2.redrawHint("select", true); + cy.emit(makeEvent("boxend")); + var eleWouldBeSelected = /* @__PURE__ */ __name(function eleWouldBeSelected2(ele) { + return ele.selectable() && !ele.selected(); + }, "eleWouldBeSelected"); + box.emit(makeEvent("box")).stdFilter(eleWouldBeSelected).select().emit(makeEvent("boxselect")); + if (box.nonempty()) { + r2.redrawHint("eles", true); + } + r2.redraw(); + } + if (start3 != null) { + start3.unactivate(); + } + if (e3.touches[2]) { + r2.data.bgActivePosistion = void 0; + r2.redrawHint("select", true); + } else if (e3.touches[1]) ; + else if (e3.touches[0]) ; + else if (!e3.touches[0]) { + r2.data.bgActivePosistion = void 0; + r2.redrawHint("select", true); + var draggedEles = r2.dragData.touchDragEles; + if (start3 != null) { + var startWasGrabbed = start3._private.grabbed; + freeDraggedElements(draggedEles); + r2.redrawHint("drag", true); + r2.redrawHint("eles", true); + if (startWasGrabbed) { + start3.emit(makeEvent("freeon")); + draggedEles.emit(makeEvent("free")); + if (r2.dragData.didDrag) { + start3.emit(makeEvent("dragfreeon")); + draggedEles.emit(makeEvent("dragfree")); + } + } + triggerEvents(start3, ["touchend", "tapend", "vmouseup", "tapdragout"], e3, { + x: now3[0], + y: now3[1] + }); + start3.unactivate(); + r2.touchData.start = null; + } else { + var near = r2.findNearestElement(now3[0], now3[1], true, true); + triggerEvents(near, ["touchend", "tapend", "vmouseup", "tapdragout"], e3, { + x: now3[0], + y: now3[1] + }); + } + var dx = r2.touchData.startPosition[0] - now3[0]; + var dx2 = dx * dx; + var dy = r2.touchData.startPosition[1] - now3[1]; + var dy2 = dy * dy; + var dist22 = dx2 + dy2; + var rdist2 = dist22 * zoom2 * zoom2; + if (!r2.touchData.singleTouchMoved) { + if (!start3) { + cy.$(":selected").unselect(["tapunselect"]); + } + triggerEvents(start3, ["tap", "vclick"], e3, { + x: now3[0], + y: now3[1] + }); + didDoubleTouch = false; + if (e3.timeStamp - prevTouchTimeStamp <= cy.multiClickDebounceTime()) { + touchTimeout && clearTimeout(touchTimeout); + didDoubleTouch = true; + prevTouchTimeStamp = null; + triggerEvents(start3, ["dbltap", "vdblclick"], e3, { + x: now3[0], + y: now3[1] + }); + } else { + touchTimeout = setTimeout(function() { + if (didDoubleTouch) return; + triggerEvents(start3, ["onetap", "voneclick"], e3, { + x: now3[0], + y: now3[1] + }); + }, cy.multiClickDebounceTime()); + prevTouchTimeStamp = e3.timeStamp; + } + } + if (start3 != null && !r2.dragData.didDrag && start3._private.selectable && rdist2 < r2.touchTapThreshold2 && !r2.pinching) { + if (cy.selectionType() === "single") { + cy.$(isSelected).unmerge(start3).unselect(["tapunselect"]); + start3.select(["tapselect"]); + } else { + if (start3.selected()) { + start3.unselect(["tapunselect"]); + } else { + start3.select(["tapselect"]); + } + } + r2.redrawHint("eles", true); + } + r2.touchData.singleTouchMoved = true; + } + for (var j3 = 0; j3 < now3.length; j3++) { + earlier[j3] = now3[j3]; + } + r2.dragData.didDrag = false; + if (e3.touches.length === 0) { + r2.touchData.dragDelta = []; + r2.touchData.startPosition = [null, null, null, null, null, null]; + r2.touchData.startGPosition = null; + r2.touchData.didSelect = false; + } + if (e3.touches.length < 2) { + if (e3.touches.length === 1) { + r2.touchData.startGPosition = [e3.touches[0].clientX, e3.touches[0].clientY]; + } + r2.pinching = false; + r2.redrawHint("eles", true); + r2.redraw(); + } + }, "touchendHandler"), false); + if (typeof TouchEvent === "undefined") { + var pointers = []; + var makeTouch = /* @__PURE__ */ __name(function makeTouch2(e3) { + return { + clientX: e3.clientX, + clientY: e3.clientY, + force: 1, + identifier: e3.pointerId, + pageX: e3.pageX, + pageY: e3.pageY, + radiusX: e3.width / 2, + radiusY: e3.height / 2, + screenX: e3.screenX, + screenY: e3.screenY, + target: e3.target + }; + }, "makeTouch"); + var makePointer = /* @__PURE__ */ __name(function makePointer2(e3) { + return { + event: e3, + touch: makeTouch(e3) + }; + }, "makePointer"); + var addPointer = /* @__PURE__ */ __name(function addPointer2(e3) { + pointers.push(makePointer(e3)); + }, "addPointer"); + var removePointer = /* @__PURE__ */ __name(function removePointer2(e3) { + for (var i2 = 0; i2 < pointers.length; i2++) { + var p3 = pointers[i2]; + if (p3.event.pointerId === e3.pointerId) { + pointers.splice(i2, 1); + return; + } + } + }, "removePointer"); + var updatePointer = /* @__PURE__ */ __name(function updatePointer2(e3) { + var p3 = pointers.filter(function(p4) { + return p4.event.pointerId === e3.pointerId; + })[0]; + p3.event = e3; + p3.touch = makeTouch(e3); + }, "updatePointer"); + var addTouchesToEvent = /* @__PURE__ */ __name(function addTouchesToEvent2(e3) { + e3.touches = pointers.map(function(p3) { + return p3.touch; + }); + }, "addTouchesToEvent"); + var pointerIsMouse = /* @__PURE__ */ __name(function pointerIsMouse2(e3) { + return e3.pointerType === "mouse" || e3.pointerType === 4; + }, "pointerIsMouse"); + r2.registerBinding(r2.container, "pointerdown", function(e3) { + if (pointerIsMouse(e3)) { + return; + } + e3.preventDefault(); + addPointer(e3); + addTouchesToEvent(e3); + touchstartHandler(e3); + }); + r2.registerBinding(r2.container, "pointerup", function(e3) { + if (pointerIsMouse(e3)) { + return; + } + removePointer(e3); + addTouchesToEvent(e3); + touchendHandler(e3); + }); + r2.registerBinding(r2.container, "pointercancel", function(e3) { + if (pointerIsMouse(e3)) { + return; + } + removePointer(e3); + addTouchesToEvent(e3); + touchcancelHandler(e3); + }); + r2.registerBinding(r2.container, "pointermove", function(e3) { + if (pointerIsMouse(e3)) { + return; + } + e3.preventDefault(); + updatePointer(e3); + addTouchesToEvent(e3); + touchmoveHandler(e3); + }); + } + }; + BRp$2 = {}; + BRp$2.generatePolygon = function(name, points) { + return this.nodeShapes[name] = { + renderer: this, + name, + points, + draw: /* @__PURE__ */ __name(function draw32(context, centerX, centerY, width3, height2, cornerRadius) { + this.renderer.nodeShapeImpl("polygon", context, centerX, centerY, width3, height2, this.points); + }, "draw"), + intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) { + return polygonIntersectLine(x5, y6, this.points, nodeX, nodeY, width3 / 2, height2 / 2, padding2); + }, "intersectLine"), + checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) { + return pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2, [0, -1], padding2); + }, "checkPoint"), + hasMiterBounds: name !== "rectangle", + miterBounds: /* @__PURE__ */ __name(function miterBounds(centerX, centerY, width3, height2, strokeWidth, strokePosition) { + return miterBox(this.points, centerX, centerY, width3, height2, strokeWidth); + }, "miterBounds") + }; + }; + BRp$2.generateEllipse = function() { + return this.nodeShapes["ellipse"] = { + renderer: this, + name: "ellipse", + draw: /* @__PURE__ */ __name(function draw32(context, centerX, centerY, width3, height2, cornerRadius) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2); + }, "draw"), + intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) { + return intersectLineEllipse(x5, y6, nodeX, nodeY, width3 / 2 + padding2, height2 / 2 + padding2); + }, "intersectLine"), + checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) { + return checkInEllipse(x5, y6, width3, height2, centerX, centerY, padding2); + }, "checkPoint") + }; + }; + BRp$2.generateRoundPolygon = function(name, points) { + return this.nodeShapes[name] = { + renderer: this, + name, + points, + getOrCreateCorners: /* @__PURE__ */ __name(function getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs, field) { + if (rs[field] !== void 0 && rs[field + "-cx"] === centerX && rs[field + "-cy"] === centerY) { + return rs[field]; + } + rs[field] = new Array(points.length / 2); + rs[field + "-cx"] = centerX; + rs[field + "-cy"] = centerY; + var halfW = width3 / 2; + var halfH = height2 / 2; + cornerRadius = cornerRadius === "auto" ? getRoundPolygonRadius(width3, height2) : cornerRadius; + var p3 = new Array(points.length / 2); + for (var _i = 0; _i < points.length / 2; _i++) { + p3[_i] = { + x: centerX + halfW * points[_i * 2], + y: centerY + halfH * points[_i * 2 + 1] + }; + } + var i2, p1, p22, p32, len = p3.length; + p1 = p3[len - 1]; + for (i2 = 0; i2 < len; i2++) { + p22 = p3[i2 % len]; + p32 = p3[(i2 + 1) % len]; + rs[field][i2] = getRoundCorner(p1, p22, p32, cornerRadius); + p1 = p22; + p22 = p32; + } + return rs[field]; + }, "getOrCreateCorners"), + draw: /* @__PURE__ */ __name(function draw32(context, centerX, centerY, width3, height2, cornerRadius, rs) { + this.renderer.nodeShapeImpl("round-polygon", context, centerX, centerY, width3, height2, this.points, this.getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs, "drawCorners")); + }, "draw"), + intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius, rs) { + return roundPolygonIntersectLine(x5, y6, this.points, nodeX, nodeY, width3, height2, padding2, this.getOrCreateCorners(nodeX, nodeY, width3, height2, cornerRadius, rs, "corners")); + }, "intersectLine"), + checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius, rs) { + return pointInsideRoundPolygon(x5, y6, this.points, centerX, centerY, width3, height2, this.getOrCreateCorners(centerX, centerY, width3, height2, cornerRadius, rs, "corners")); + }, "checkPoint") + }; + }; + BRp$2.generateRoundRectangle = function() { + return this.nodeShapes["round-rectangle"] = this.nodeShapes["roundrectangle"] = { + renderer: this, + name: "round-rectangle", + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: /* @__PURE__ */ __name(function draw32(context, centerX, centerY, width3, height2, cornerRadius) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2, this.points, cornerRadius); + }, "draw"), + intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) { + return roundRectangleIntersectLine(x5, y6, nodeX, nodeY, width3, height2, padding2, cornerRadius); + }, "intersectLine"), + checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) { + var halfWidth = width3 / 2; + var halfHeight = height2 / 2; + cornerRadius = cornerRadius === "auto" ? getRoundRectangleRadius(width3, height2) : cornerRadius; + cornerRadius = Math.min(halfWidth, halfHeight, cornerRadius); + var diam = cornerRadius * 2; + if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2 - diam, [0, -1], padding2)) { + return true; + } + if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3 - diam, height2, [0, -1], padding2)) { + return true; + } + if (checkInEllipse(x5, y6, diam, diam, centerX - halfWidth + cornerRadius, centerY - halfHeight + cornerRadius, padding2)) { + return true; + } + if (checkInEllipse(x5, y6, diam, diam, centerX + halfWidth - cornerRadius, centerY - halfHeight + cornerRadius, padding2)) { + return true; + } + if (checkInEllipse(x5, y6, diam, diam, centerX + halfWidth - cornerRadius, centerY + halfHeight - cornerRadius, padding2)) { + return true; + } + if (checkInEllipse(x5, y6, diam, diam, centerX - halfWidth + cornerRadius, centerY + halfHeight - cornerRadius, padding2)) { + return true; + } + return false; + }, "checkPoint") + }; + }; + BRp$2.generateCutRectangle = function() { + return this.nodeShapes["cut-rectangle"] = this.nodeShapes["cutrectangle"] = { + renderer: this, + name: "cut-rectangle", + cornerLength: getCutRectangleCornerLength(), + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: /* @__PURE__ */ __name(function draw32(context, centerX, centerY, width3, height2, cornerRadius) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2, null, cornerRadius); + }, "draw"), + generateCutTrianglePts: /* @__PURE__ */ __name(function generateCutTrianglePts(width3, height2, centerX, centerY, cornerRadius) { + var cl = cornerRadius === "auto" ? this.cornerLength : cornerRadius; + var hh = height2 / 2; + var hw = width3 / 2; + var xBegin = centerX - hw; + var xEnd = centerX + hw; + var yBegin = centerY - hh; + var yEnd = centerY + hh; + return { + topLeft: [xBegin, yBegin + cl, xBegin + cl, yBegin, xBegin + cl, yBegin + cl], + topRight: [xEnd - cl, yBegin, xEnd, yBegin + cl, xEnd - cl, yBegin + cl], + bottomRight: [xEnd, yEnd - cl, xEnd - cl, yEnd, xEnd - cl, yEnd - cl], + bottomLeft: [xBegin + cl, yEnd, xBegin, yEnd - cl, xBegin + cl, yEnd - cl] + }; + }, "generateCutTrianglePts"), + intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) { + var cPts = this.generateCutTrianglePts(width3 + 2 * padding2, height2 + 2 * padding2, nodeX, nodeY, cornerRadius); + var pts2 = [].concat.apply([], [cPts.topLeft.splice(0, 4), cPts.topRight.splice(0, 4), cPts.bottomRight.splice(0, 4), cPts.bottomLeft.splice(0, 4)]); + return polygonIntersectLine(x5, y6, pts2, nodeX, nodeY); + }, "intersectLine"), + checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) { + var cl = cornerRadius === "auto" ? this.cornerLength : cornerRadius; + if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2 - 2 * cl, [0, -1], padding2)) { + return true; + } + if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3 - 2 * cl, height2, [0, -1], padding2)) { + return true; + } + var cutTrianglePts = this.generateCutTrianglePts(width3, height2, centerX, centerY); + return pointInsidePolygonPoints(x5, y6, cutTrianglePts.topLeft) || pointInsidePolygonPoints(x5, y6, cutTrianglePts.topRight) || pointInsidePolygonPoints(x5, y6, cutTrianglePts.bottomRight) || pointInsidePolygonPoints(x5, y6, cutTrianglePts.bottomLeft); + }, "checkPoint") + }; + }; + BRp$2.generateBarrel = function() { + return this.nodeShapes["barrel"] = { + renderer: this, + name: "barrel", + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: /* @__PURE__ */ __name(function draw32(context, centerX, centerY, width3, height2, cornerRadius) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2); + }, "draw"), + intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) { + var t03 = 0.15; + var t13 = 0.5; + var t22 = 0.85; + var bPts = this.generateBarrelBezierPts(width3 + 2 * padding2, height2 + 2 * padding2, nodeX, nodeY); + var approximateBarrelCurvePts = /* @__PURE__ */ __name(function approximateBarrelCurvePts2(pts3) { + var m0 = qbezierPtAt({ + x: pts3[0], + y: pts3[1] + }, { + x: pts3[2], + y: pts3[3] + }, { + x: pts3[4], + y: pts3[5] + }, t03); + var m1 = qbezierPtAt({ + x: pts3[0], + y: pts3[1] + }, { + x: pts3[2], + y: pts3[3] + }, { + x: pts3[4], + y: pts3[5] + }, t13); + var m22 = qbezierPtAt({ + x: pts3[0], + y: pts3[1] + }, { + x: pts3[2], + y: pts3[3] + }, { + x: pts3[4], + y: pts3[5] + }, t22); + return [pts3[0], pts3[1], m0.x, m0.y, m1.x, m1.y, m22.x, m22.y, pts3[4], pts3[5]]; + }, "approximateBarrelCurvePts"); + var pts2 = [].concat(approximateBarrelCurvePts(bPts.topLeft), approximateBarrelCurvePts(bPts.topRight), approximateBarrelCurvePts(bPts.bottomRight), approximateBarrelCurvePts(bPts.bottomLeft)); + return polygonIntersectLine(x5, y6, pts2, nodeX, nodeY); + }, "intersectLine"), + generateBarrelBezierPts: /* @__PURE__ */ __name(function generateBarrelBezierPts(width3, height2, centerX, centerY) { + var hh = height2 / 2; + var hw = width3 / 2; + var xBegin = centerX - hw; + var xEnd = centerX + hw; + var yBegin = centerY - hh; + var yEnd = centerY + hh; + var curveConstants = getBarrelCurveConstants(width3, height2); + var hOffset = curveConstants.heightOffset; + var wOffset = curveConstants.widthOffset; + var ctrlPtXOffset = curveConstants.ctrlPtOffsetPct * width3; + var pts2 = { + topLeft: [xBegin, yBegin + hOffset, xBegin + ctrlPtXOffset, yBegin, xBegin + wOffset, yBegin], + topRight: [xEnd - wOffset, yBegin, xEnd - ctrlPtXOffset, yBegin, xEnd, yBegin + hOffset], + bottomRight: [xEnd, yEnd - hOffset, xEnd - ctrlPtXOffset, yEnd, xEnd - wOffset, yEnd], + bottomLeft: [xBegin + wOffset, yEnd, xBegin + ctrlPtXOffset, yEnd, xBegin, yEnd - hOffset] + }; + pts2.topLeft.isTop = true; + pts2.topRight.isTop = true; + pts2.bottomLeft.isBottom = true; + pts2.bottomRight.isBottom = true; + return pts2; + }, "generateBarrelBezierPts"), + checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) { + var curveConstants = getBarrelCurveConstants(width3, height2); + var hOffset = curveConstants.heightOffset; + var wOffset = curveConstants.widthOffset; + if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2 - 2 * hOffset, [0, -1], padding2)) { + return true; + } + if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3 - 2 * wOffset, height2, [0, -1], padding2)) { + return true; + } + var barrelCurvePts = this.generateBarrelBezierPts(width3, height2, centerX, centerY); + var getCurveT = /* @__PURE__ */ __name(function getCurveT2(x6, y7, curvePts) { + var x0 = curvePts[4]; + var x1 = curvePts[2]; + var x22 = curvePts[0]; + var y02 = curvePts[5]; + var y23 = curvePts[1]; + var xMin = Math.min(x0, x22); + var xMax = Math.max(x0, x22); + var yMin = Math.min(y02, y23); + var yMax = Math.max(y02, y23); + if (xMin <= x6 && x6 <= xMax && yMin <= y7 && y7 <= yMax) { + var coeff = bezierPtsToQuadCoeff(x0, x1, x22); + var roots = solveQuadratic(coeff[0], coeff[1], coeff[2], x6); + var validRoots = roots.filter(function(r2) { + return 0 <= r2 && r2 <= 1; + }); + if (validRoots.length > 0) { + return validRoots[0]; + } + } + return null; + }, "getCurveT"); + var curveRegions = Object.keys(barrelCurvePts); + for (var i2 = 0; i2 < curveRegions.length; i2++) { + var corner = curveRegions[i2]; + var cornerPts = barrelCurvePts[corner]; + var t4 = getCurveT(x5, y6, cornerPts); + if (t4 == null) { + continue; + } + var y0 = cornerPts[5]; + var y1 = cornerPts[3]; + var y22 = cornerPts[1]; + var bezY = qbezierAt(y0, y1, y22, t4); + if (cornerPts.isTop && bezY <= y6) { + return true; + } + if (cornerPts.isBottom && y6 <= bezY) { + return true; + } + } + return false; + }, "checkPoint") + }; + }; + BRp$2.generateBottomRoundrectangle = function() { + return this.nodeShapes["bottom-round-rectangle"] = this.nodeShapes["bottomroundrectangle"] = { + renderer: this, + name: "bottom-round-rectangle", + points: generateUnitNgonPointsFitToSquare(4, 0), + draw: /* @__PURE__ */ __name(function draw32(context, centerX, centerY, width3, height2, cornerRadius) { + this.renderer.nodeShapeImpl(this.name, context, centerX, centerY, width3, height2, this.points, cornerRadius); + }, "draw"), + intersectLine: /* @__PURE__ */ __name(function intersectLine3(nodeX, nodeY, width3, height2, x5, y6, padding2, cornerRadius) { + var topStartX = nodeX - (width3 / 2 + padding2); + var topStartY = nodeY - (height2 / 2 + padding2); + var topEndY = topStartY; + var topEndX = nodeX + (width3 / 2 + padding2); + var topIntersections = finiteLinesIntersect(x5, y6, nodeX, nodeY, topStartX, topStartY, topEndX, topEndY, false); + if (topIntersections.length > 0) { + return topIntersections; + } + return roundRectangleIntersectLine(x5, y6, nodeX, nodeY, width3, height2, padding2, cornerRadius); + }, "intersectLine"), + checkPoint: /* @__PURE__ */ __name(function checkPoint(x5, y6, padding2, width3, height2, centerX, centerY, cornerRadius) { + cornerRadius = cornerRadius === "auto" ? getRoundRectangleRadius(width3, height2) : cornerRadius; + var diam = 2 * cornerRadius; + if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3, height2 - diam, [0, -1], padding2)) { + return true; + } + if (pointInsidePolygon(x5, y6, this.points, centerX, centerY, width3 - diam, height2, [0, -1], padding2)) { + return true; + } + var outerWidth = width3 / 2 + 2 * padding2; + var outerHeight = height2 / 2 + 2 * padding2; + var points = [centerX - outerWidth, centerY - outerHeight, centerX - outerWidth, centerY, centerX + outerWidth, centerY, centerX + outerWidth, centerY - outerHeight]; + if (pointInsidePolygonPoints(x5, y6, points)) { + return true; + } + if (checkInEllipse(x5, y6, diam, diam, centerX + width3 / 2 - cornerRadius, centerY + height2 / 2 - cornerRadius, padding2)) { + return true; + } + if (checkInEllipse(x5, y6, diam, diam, centerX - width3 / 2 + cornerRadius, centerY + height2 / 2 - cornerRadius, padding2)) { + return true; + } + return false; + }, "checkPoint") + }; + }; + BRp$2.registerNodeShapes = function() { + var nodeShapes = this.nodeShapes = {}; + var renderer13 = this; + this.generateEllipse(); + this.generatePolygon("triangle", generateUnitNgonPointsFitToSquare(3, 0)); + this.generateRoundPolygon("round-triangle", generateUnitNgonPointsFitToSquare(3, 0)); + this.generatePolygon("rectangle", generateUnitNgonPointsFitToSquare(4, 0)); + nodeShapes["square"] = nodeShapes["rectangle"]; + this.generateRoundRectangle(); + this.generateCutRectangle(); + this.generateBarrel(); + this.generateBottomRoundrectangle(); + { + var diamondPoints = [0, 1, 1, 0, 0, -1, -1, 0]; + this.generatePolygon("diamond", diamondPoints); + this.generateRoundPolygon("round-diamond", diamondPoints); + } + this.generatePolygon("pentagon", generateUnitNgonPointsFitToSquare(5, 0)); + this.generateRoundPolygon("round-pentagon", generateUnitNgonPointsFitToSquare(5, 0)); + this.generatePolygon("hexagon", generateUnitNgonPointsFitToSquare(6, 0)); + this.generateRoundPolygon("round-hexagon", generateUnitNgonPointsFitToSquare(6, 0)); + this.generatePolygon("heptagon", generateUnitNgonPointsFitToSquare(7, 0)); + this.generateRoundPolygon("round-heptagon", generateUnitNgonPointsFitToSquare(7, 0)); + this.generatePolygon("octagon", generateUnitNgonPointsFitToSquare(8, 0)); + this.generateRoundPolygon("round-octagon", generateUnitNgonPointsFitToSquare(8, 0)); + var star5Points = new Array(20); + { + var outerPoints = generateUnitNgonPoints(5, 0); + var innerPoints = generateUnitNgonPoints(5, Math.PI / 5); + var innerRadius = 0.5 * (3 - Math.sqrt(5)); + innerRadius *= 1.57; + for (var i2 = 0; i2 < innerPoints.length / 2; i2++) { + innerPoints[i2 * 2] *= innerRadius; + innerPoints[i2 * 2 + 1] *= innerRadius; + } + for (var i2 = 0; i2 < 20 / 4; i2++) { + star5Points[i2 * 4] = outerPoints[i2 * 2]; + star5Points[i2 * 4 + 1] = outerPoints[i2 * 2 + 1]; + star5Points[i2 * 4 + 2] = innerPoints[i2 * 2]; + star5Points[i2 * 4 + 3] = innerPoints[i2 * 2 + 1]; + } + } + star5Points = fitPolygonToSquare(star5Points); + this.generatePolygon("star", star5Points); + this.generatePolygon("vee", [-1, -1, 0, -0.333, 1, -1, 0, 1]); + this.generatePolygon("rhomboid", [-1, -1, 0.333, -1, 1, 1, -0.333, 1]); + this.generatePolygon("right-rhomboid", [-0.333, -1, 1, -1, 0.333, 1, -1, 1]); + this.nodeShapes["concavehexagon"] = this.generatePolygon("concave-hexagon", [-1, -0.95, -0.75, 0, -1, 0.95, 1, 0.95, 0.75, 0, 1, -0.95]); + { + var tagPoints = [-1, -1, 0.25, -1, 1, 0, 0.25, 1, -1, 1]; + this.generatePolygon("tag", tagPoints); + this.generateRoundPolygon("round-tag", tagPoints); + } + nodeShapes.makePolygon = function(points) { + var key = points.join("$"); + var name = "polygon-" + key; + var shape; + if (shape = this[name]) { + return shape; + } + return renderer13.generatePolygon(name, points); + }; + }; + BRp$1 = {}; + BRp$1.timeToRender = function() { + return this.redrawTotalTime / this.redrawCount; + }; + BRp$1.redraw = function(options2) { + options2 = options2 || staticEmptyObject(); + var r2 = this; + if (r2.averageRedrawTime === void 0) { + r2.averageRedrawTime = 0; + } + if (r2.lastRedrawTime === void 0) { + r2.lastRedrawTime = 0; + } + if (r2.lastDrawTime === void 0) { + r2.lastDrawTime = 0; + } + r2.requestedFrame = true; + r2.renderOptions = options2; + }; + BRp$1.beforeRender = function(fn3, priority3) { + if (this.destroyed) { + return; + } + if (priority3 == null) { + error("Priority is not optional for beforeRender"); + } + var cbs = this.beforeRenderCallbacks; + cbs.push({ + fn: fn3, + priority: priority3 + }); + cbs.sort(function(a2, b3) { + return b3.priority - a2.priority; + }); + }; + beforeRenderCallbacks = /* @__PURE__ */ __name(function beforeRenderCallbacks2(r2, willDraw, startTime) { + var cbs = r2.beforeRenderCallbacks; + for (var i2 = 0; i2 < cbs.length; i2++) { + cbs[i2].fn(willDraw, startTime); + } + }, "beforeRenderCallbacks"); + BRp$1.startRenderLoop = function() { + var r2 = this; + var cy = r2.cy; + if (r2.renderLoopStarted) { + return; + } else { + r2.renderLoopStarted = true; + } + var _renderFn = /* @__PURE__ */ __name(function renderFn(requestTime) { + if (r2.destroyed) { + return; + } + if (cy.batching()) ; + else if (r2.requestedFrame && !r2.skipFrame) { + beforeRenderCallbacks(r2, true, requestTime); + var startTime = performanceNow(); + r2.render(r2.renderOptions); + var endTime = r2.lastDrawTime = performanceNow(); + if (r2.averageRedrawTime === void 0) { + r2.averageRedrawTime = endTime - startTime; + } + if (r2.redrawCount === void 0) { + r2.redrawCount = 0; + } + r2.redrawCount++; + if (r2.redrawTotalTime === void 0) { + r2.redrawTotalTime = 0; + } + var duration = endTime - startTime; + r2.redrawTotalTime += duration; + r2.lastRedrawTime = duration; + r2.averageRedrawTime = r2.averageRedrawTime / 2 + duration / 2; + r2.requestedFrame = false; + } else { + beforeRenderCallbacks(r2, false, requestTime); + } + r2.skipFrame = false; + requestAnimationFrame2(_renderFn); + }, "renderFn"); + requestAnimationFrame2(_renderFn); + }; + BaseRenderer = /* @__PURE__ */ __name(function BaseRenderer2(options2) { + this.init(options2); + }, "BaseRenderer"); + BR = BaseRenderer; + BRp = BR.prototype; + BRp.clientFunctions = ["redrawHint", "render", "renderTo", "matchCanvasSize", "nodeShapeImpl", "arrowShapeImpl"]; + BRp.init = function(options2) { + var r2 = this; + r2.options = options2; + r2.cy = options2.cy; + var ctr = r2.container = options2.cy.container(); + var containerWindow = r2.cy.window(); + if (containerWindow) { + var document2 = containerWindow.document; + var head2 = document2.head; + var stylesheetId = "__________cytoscape_stylesheet"; + var className = "__________cytoscape_container"; + var stylesheetAlreadyExists = document2.getElementById(stylesheetId) != null; + if (ctr.className.indexOf(className) < 0) { + ctr.className = (ctr.className || "") + " " + className; + } + if (!stylesheetAlreadyExists) { + var stylesheet3 = document2.createElement("style"); + stylesheet3.id = stylesheetId; + stylesheet3.textContent = "." + className + " { position: relative; }"; + head2.insertBefore(stylesheet3, head2.children[0]); + } + var computedStyle = containerWindow.getComputedStyle(ctr); + var position5 = computedStyle.getPropertyValue("position"); + if (position5 === "static") { + warn("A Cytoscape container has style position:static and so can not use UI extensions properly"); + } + } + r2.selection = [void 0, void 0, void 0, void 0, 0]; + r2.bezierProjPcts = [0.05, 0.225, 0.4, 0.5, 0.6, 0.775, 0.95]; + r2.hoverData = { + down: null, + last: null, + downTime: null, + triggerMode: null, + dragging: false, + initialPan: [null, null], + capture: false + }; + r2.dragData = { + possibleDragElements: [] + }; + r2.touchData = { + start: null, + capture: false, + // These 3 fields related to tap, taphold events + startPosition: [null, null, null, null, null, null], + singleTouchStartTime: null, + singleTouchMoved: true, + now: [null, null, null, null, null, null], + earlier: [null, null, null, null, null, null] + }; + r2.redraws = 0; + r2.showFps = options2.showFps; + r2.debug = options2.debug; + r2.webgl = options2.webgl; + r2.hideEdgesOnViewport = options2.hideEdgesOnViewport; + r2.textureOnViewport = options2.textureOnViewport; + r2.wheelSensitivity = options2.wheelSensitivity; + r2.motionBlurEnabled = options2.motionBlur; + r2.forcedPixelRatio = number$1(options2.pixelRatio) ? options2.pixelRatio : null; + r2.motionBlur = options2.motionBlur; + r2.motionBlurOpacity = options2.motionBlurOpacity; + r2.motionBlurTransparency = 1 - r2.motionBlurOpacity; + r2.motionBlurPxRatio = 1; + r2.mbPxRBlurry = 1; + r2.minMbLowQualFrames = 4; + r2.fullQualityMb = false; + r2.clearedForMotionBlur = []; + r2.desktopTapThreshold = options2.desktopTapThreshold; + r2.desktopTapThreshold2 = options2.desktopTapThreshold * options2.desktopTapThreshold; + r2.touchTapThreshold = options2.touchTapThreshold; + r2.touchTapThreshold2 = options2.touchTapThreshold * options2.touchTapThreshold; + r2.tapholdDuration = 500; + r2.bindings = []; + r2.beforeRenderCallbacks = []; + r2.beforeRenderPriorities = { + // higher priority execs before lower one + animations: 400, + eleCalcs: 300, + eleTxrDeq: 200, + lyrTxrDeq: 150, + lyrTxrSkip: 100 + }; + r2.registerNodeShapes(); + r2.registerArrowShapes(); + r2.registerCalculationListeners(); + }; + BRp.notify = function(eventName, eles) { + var r2 = this; + var cy = r2.cy; + if (this.destroyed) { + return; + } + if (eventName === "init") { + r2.load(); + return; + } + if (eventName === "destroy") { + r2.destroy(); + return; + } + if (eventName === "add" || eventName === "remove" || eventName === "move" && cy.hasCompoundNodes() || eventName === "load" || eventName === "zorder" || eventName === "mount") { + r2.invalidateCachedZSortedEles(); + } + if (eventName === "viewport") { + r2.redrawHint("select", true); + } + if (eventName === "gc") { + r2.redrawHint("gc", true); + } + if (eventName === "load" || eventName === "resize" || eventName === "mount") { + r2.invalidateContainerClientCoordsCache(); + r2.matchCanvasSize(r2.container); + } + r2.redrawHint("eles", true); + r2.redrawHint("drag", true); + this.startRenderLoop(); + this.redraw(); + }; + BRp.destroy = function() { + var r2 = this; + r2.destroyed = true; + r2.cy.stopAnimationLoop(); + for (var i2 = 0; i2 < r2.bindings.length; i2++) { + var binding = r2.bindings[i2]; + var b3 = binding; + var tgt = b3.target; + (tgt.off || tgt.removeEventListener).apply(tgt, b3.args); + } + r2.bindings = []; + r2.beforeRenderCallbacks = []; + r2.onUpdateEleCalcsFns = []; + if (r2.removeObserver) { + r2.removeObserver.disconnect(); + } + if (r2.styleObserver) { + r2.styleObserver.disconnect(); + } + if (r2.resizeObserver) { + r2.resizeObserver.disconnect(); + } + if (r2.labelCalcDiv) { + try { + document.body.removeChild(r2.labelCalcDiv); + } catch (e3) { + } + } + }; + BRp.isHeadless = function() { + return false; + }; + [BRp$f, BRp$5, BRp$4, BRp$3, BRp$2, BRp$1].forEach(function(props) { + extend4(BRp, props); + }); + fullFpsTime = 1e3 / 60; + defs = { + setupDequeueing: /* @__PURE__ */ __name(function setupDequeueing(opts) { + return /* @__PURE__ */ __name(function setupDequeueingImpl() { + var self2 = this; + var r2 = this.renderer; + if (self2.dequeueingSetup) { + return; + } else { + self2.dequeueingSetup = true; + } + var queueRedraw = debounce(function() { + r2.redrawHint("eles", true); + r2.redrawHint("drag", true); + r2.redraw(); + }, opts.deqRedrawThreshold); + var dequeue = /* @__PURE__ */ __name(function dequeue2(willDraw, frameStartTime) { + var startTime = performanceNow(); + var avgRenderTime = r2.averageRedrawTime; + var renderTime = r2.lastRedrawTime; + var deqd = []; + var extent2 = r2.cy.extent(); + var pixelRatio = r2.getPixelRatio(); + if (!willDraw) { + r2.flushRenderedStyleQueue(); + } + while (true) { + var now3 = performanceNow(); + var duration = now3 - startTime; + var frameDuration = now3 - frameStartTime; + if (renderTime < fullFpsTime) { + var timeAvailable = fullFpsTime - (willDraw ? avgRenderTime : 0); + if (frameDuration >= opts.deqFastCost * timeAvailable) { + break; + } + } else { + if (willDraw) { + if (duration >= opts.deqCost * renderTime || duration >= opts.deqAvgCost * avgRenderTime) { + break; + } + } else if (frameDuration >= opts.deqNoDrawCost * fullFpsTime) { + break; + } + } + var thisDeqd = opts.deq(self2, pixelRatio, extent2); + if (thisDeqd.length > 0) { + for (var i2 = 0; i2 < thisDeqd.length; i2++) { + deqd.push(thisDeqd[i2]); + } + } else { + break; + } + } + if (deqd.length > 0) { + opts.onDeqd(self2, deqd); + if (!willDraw && opts.shouldRedraw(self2, deqd, pixelRatio, extent2)) { + queueRedraw(); + } + } + }, "dequeue"); + var priority3 = opts.priority || noop$1; + r2.beforeRender(dequeue, priority3(self2)); + }, "setupDequeueingImpl"); + }, "setupDequeueing") + }; + ElementTextureCacheLookup = /* @__PURE__ */ (function() { + function ElementTextureCacheLookup2(getKey3) { + var doesEleInvalidateKey = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : falsify; + _classCallCheck(this, ElementTextureCacheLookup2); + this.idsByKey = new Map$1(); + this.keyForId = new Map$1(); + this.cachesByLvl = new Map$1(); + this.lvls = []; + this.getKey = getKey3; + this.doesEleInvalidateKey = doesEleInvalidateKey; + } + __name(ElementTextureCacheLookup2, "ElementTextureCacheLookup"); + return _createClass(ElementTextureCacheLookup2, [{ + key: "getIdsFor", + value: /* @__PURE__ */ __name(function getIdsFor(key) { + if (key == null) { + error("Can not get id list for null key"); + } + var idsByKey = this.idsByKey; + var ids = this.idsByKey.get(key); + if (!ids) { + ids = new Set$1(); + idsByKey.set(key, ids); + } + return ids; + }, "getIdsFor") + }, { + key: "addIdForKey", + value: /* @__PURE__ */ __name(function addIdForKey(key, id35) { + if (key != null) { + this.getIdsFor(key).add(id35); + } + }, "addIdForKey") + }, { + key: "deleteIdForKey", + value: /* @__PURE__ */ __name(function deleteIdForKey(key, id35) { + if (key != null) { + this.getIdsFor(key)["delete"](id35); + } + }, "deleteIdForKey") + }, { + key: "getNumberOfIdsForKey", + value: /* @__PURE__ */ __name(function getNumberOfIdsForKey(key) { + if (key == null) { + return 0; + } else { + return this.getIdsFor(key).size; + } + }, "getNumberOfIdsForKey") + }, { + key: "updateKeyMappingFor", + value: /* @__PURE__ */ __name(function updateKeyMappingFor(ele) { + var id35 = ele.id(); + var prevKey = this.keyForId.get(id35); + var currKey = this.getKey(ele); + this.deleteIdForKey(prevKey, id35); + this.addIdForKey(currKey, id35); + this.keyForId.set(id35, currKey); + }, "updateKeyMappingFor") + }, { + key: "deleteKeyMappingFor", + value: /* @__PURE__ */ __name(function deleteKeyMappingFor(ele) { + var id35 = ele.id(); + var prevKey = this.keyForId.get(id35); + this.deleteIdForKey(prevKey, id35); + this.keyForId["delete"](id35); + }, "deleteKeyMappingFor") + }, { + key: "keyHasChangedFor", + value: /* @__PURE__ */ __name(function keyHasChangedFor(ele) { + var id35 = ele.id(); + var prevKey = this.keyForId.get(id35); + var newKey = this.getKey(ele); + return prevKey !== newKey; + }, "keyHasChangedFor") + }, { + key: "isInvalid", + value: /* @__PURE__ */ __name(function isInvalid(ele) { + return this.keyHasChangedFor(ele) || this.doesEleInvalidateKey(ele); + }, "isInvalid") + }, { + key: "getCachesAt", + value: /* @__PURE__ */ __name(function getCachesAt(lvl) { + var cachesByLvl = this.cachesByLvl, lvls = this.lvls; + var caches = cachesByLvl.get(lvl); + if (!caches) { + caches = new Map$1(); + cachesByLvl.set(lvl, caches); + lvls.push(lvl); + } + return caches; + }, "getCachesAt") + }, { + key: "getCache", + value: /* @__PURE__ */ __name(function getCache(key, lvl) { + return this.getCachesAt(lvl).get(key); + }, "getCache") + }, { + key: "get", + value: /* @__PURE__ */ __name(function get6(ele, lvl) { + var key = this.getKey(ele); + var cache3 = this.getCache(key, lvl); + if (cache3 != null) { + this.updateKeyMappingFor(ele); + } + return cache3; + }, "get") + }, { + key: "getForCachedKey", + value: /* @__PURE__ */ __name(function getForCachedKey(ele, lvl) { + var key = this.keyForId.get(ele.id()); + var cache3 = this.getCache(key, lvl); + return cache3; + }, "getForCachedKey") + }, { + key: "hasCache", + value: /* @__PURE__ */ __name(function hasCache(key, lvl) { + return this.getCachesAt(lvl).has(key); + }, "hasCache") + }, { + key: "has", + value: /* @__PURE__ */ __name(function has3(ele, lvl) { + var key = this.getKey(ele); + return this.hasCache(key, lvl); + }, "has") + }, { + key: "setCache", + value: /* @__PURE__ */ __name(function setCache(key, lvl, cache3) { + cache3.key = key; + this.getCachesAt(lvl).set(key, cache3); + }, "setCache") + }, { + key: "set", + value: /* @__PURE__ */ __name(function set5(ele, lvl, cache3) { + var key = this.getKey(ele); + this.setCache(key, lvl, cache3); + this.updateKeyMappingFor(ele); + }, "set") + }, { + key: "deleteCache", + value: /* @__PURE__ */ __name(function deleteCache(key, lvl) { + this.getCachesAt(lvl)["delete"](key); + }, "deleteCache") + }, { + key: "delete", + value: /* @__PURE__ */ __name(function _delete(ele, lvl) { + var key = this.getKey(ele); + this.deleteCache(key, lvl); + }, "_delete") + }, { + key: "invalidateKey", + value: /* @__PURE__ */ __name(function invalidateKey(key) { + var _this = this; + this.lvls.forEach(function(lvl) { + return _this.deleteCache(key, lvl); + }); + }, "invalidateKey") + // returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key) + }, { + key: "invalidate", + value: /* @__PURE__ */ __name(function invalidate(ele) { + var id35 = ele.id(); + var key = this.keyForId.get(id35); + this.deleteKeyMappingFor(ele); + var entireKeyInvalidated = this.doesEleInvalidateKey(ele); + if (entireKeyInvalidated) { + this.invalidateKey(key); + } + return entireKeyInvalidated || this.getNumberOfIdsForKey(key) === 0; + }, "invalidate") + }]); + })(); + minTxrH = 25; + txrStepH = 50; + minLvl$1 = -4; + maxLvl$1 = 3; + maxZoom$1 = 7.99; + eleTxrSpacing = 8; + defTxrWidth = 1024; + maxTxrW = 1024; + maxTxrH = 1024; + minUtility = 0.2; + maxFullness = 0.8; + maxFullnessChecks = 10; + deqCost$1 = 0.15; + deqAvgCost$1 = 0.1; + deqNoDrawCost$1 = 0.9; + deqFastCost$1 = 0.9; + deqRedrawThreshold$1 = 100; + maxDeqSize$1 = 1; + getTxrReasons = { + dequeue: "dequeue", + downscale: "downscale", + highQuality: "highQuality" + }; + initDefaults = defaults$g({ + getKey: null, + doesEleInvalidateKey: falsify, + drawElement: null, + getBoundingBox: null, + getRotationPoint: null, + getRotationOffset: null, + isVisible: trueify, + allowEdgeTxrCaching: true, + allowParentTxrCaching: true + }); + ElementTextureCache = /* @__PURE__ */ __name(function ElementTextureCache2(renderer13, initOptions) { + var self2 = this; + self2.renderer = renderer13; + self2.onDequeues = []; + var opts = initDefaults(initOptions); + extend4(self2, opts); + self2.lookup = new ElementTextureCacheLookup(opts.getKey, opts.doesEleInvalidateKey); + self2.setupDequeueing(); + }, "ElementTextureCache"); + ETCp = ElementTextureCache.prototype; + ETCp.reasons = getTxrReasons; + ETCp.getTextureQueue = function(txrH) { + var self2 = this; + self2.eleImgCaches = self2.eleImgCaches || {}; + return self2.eleImgCaches[txrH] = self2.eleImgCaches[txrH] || []; + }; + ETCp.getRetiredTextureQueue = function(txrH) { + var self2 = this; + var rtxtrQs = self2.eleImgCaches.retired = self2.eleImgCaches.retired || {}; + var rtxtrQ = rtxtrQs[txrH] = rtxtrQs[txrH] || []; + return rtxtrQ; + }; + ETCp.getElementQueue = function() { + var self2 = this; + var q3 = self2.eleCacheQueue = self2.eleCacheQueue || new Heap(function(a2, b3) { + return b3.reqs - a2.reqs; + }); + return q3; + }; + ETCp.getElementKeyToQueue = function() { + var self2 = this; + var k2q = self2.eleKeyToCacheQueue = self2.eleKeyToCacheQueue || {}; + return k2q; + }; + ETCp.getElement = function(ele, bb, pxRatio, lvl, reason) { + var self2 = this; + var r2 = this.renderer; + var zoom2 = r2.cy.zoom(); + var lookup2 = this.lookup; + if (!bb || bb.w === 0 || bb.h === 0 || isNaN(bb.w) || isNaN(bb.h) || !ele.visible() || ele.removed()) { + return null; + } + if (!self2.allowEdgeTxrCaching && ele.isEdge() || !self2.allowParentTxrCaching && ele.isParent()) { + return null; + } + if (lvl == null) { + lvl = Math.ceil(log22(zoom2 * pxRatio)); + } + if (lvl < minLvl$1) { + lvl = minLvl$1; + } else if (zoom2 >= maxZoom$1 || lvl > maxLvl$1) { + return null; + } + var scale3 = Math.pow(2, lvl); + var eleScaledH = bb.h * scale3; + var eleScaledW = bb.w * scale3; + var scaledLabelShown = r2.eleTextBiggerThanMin(ele, scale3); + if (!this.isVisible(ele, scaledLabelShown)) { + return null; + } + var eleCache = lookup2.get(ele, lvl); + if (eleCache && eleCache.invalidated) { + eleCache.invalidated = false; + eleCache.texture.invalidatedWidth -= eleCache.width; + } + if (eleCache) { + return eleCache; + } + var txrH; + if (eleScaledH <= minTxrH) { + txrH = minTxrH; + } else if (eleScaledH <= txrStepH) { + txrH = txrStepH; + } else { + txrH = Math.ceil(eleScaledH / txrStepH) * txrStepH; + } + if (eleScaledH > maxTxrH || eleScaledW > maxTxrW) { + return null; + } + var txrQ = self2.getTextureQueue(txrH); + var txr = txrQ[txrQ.length - 2]; + var addNewTxr = /* @__PURE__ */ __name(function addNewTxr2() { + return self2.recycleTexture(txrH, eleScaledW) || self2.addTexture(txrH, eleScaledW); + }, "addNewTxr"); + if (!txr) { + txr = txrQ[txrQ.length - 1]; + } + if (!txr) { + txr = addNewTxr(); + } + if (txr.width - txr.usedWidth < eleScaledW) { + txr = addNewTxr(); + } + var scalableFrom = /* @__PURE__ */ __name(function scalableFrom2(otherCache) { + return otherCache && otherCache.scaledLabelShown === scaledLabelShown; + }, "scalableFrom"); + var deqing = reason && reason === getTxrReasons.dequeue; + var highQualityReq = reason && reason === getTxrReasons.highQuality; + var downscaleReq = reason && reason === getTxrReasons.downscale; + var higherCache; + for (var l4 = lvl + 1; l4 <= maxLvl$1; l4++) { + var c3 = lookup2.get(ele, l4); + if (c3) { + higherCache = c3; + break; + } + } + var oneUpCache = higherCache && higherCache.level === lvl + 1 ? higherCache : null; + var downscale = /* @__PURE__ */ __name(function downscale2() { + txr.context.drawImage(oneUpCache.texture.canvas, oneUpCache.x, 0, oneUpCache.width, oneUpCache.height, txr.usedWidth, 0, eleScaledW, eleScaledH); + }, "downscale"); + txr.context.setTransform(1, 0, 0, 1, 0, 0); + txr.context.clearRect(txr.usedWidth, 0, eleScaledW, txrH); + if (scalableFrom(oneUpCache)) { + downscale(); + } else if (scalableFrom(higherCache)) { + if (highQualityReq) { + for (var _l = higherCache.level; _l > lvl; _l--) { + oneUpCache = self2.getElement(ele, bb, pxRatio, _l, getTxrReasons.downscale); + } + downscale(); + } else { + self2.queueElement(ele, higherCache.level - 1); + return higherCache; + } + } else { + var lowerCache; + if (!deqing && !highQualityReq && !downscaleReq) { + for (var _l2 = lvl - 1; _l2 >= minLvl$1; _l2--) { + var _c = lookup2.get(ele, _l2); + if (_c) { + lowerCache = _c; + break; + } + } + } + if (scalableFrom(lowerCache)) { + self2.queueElement(ele, lvl); + return lowerCache; + } + txr.context.translate(txr.usedWidth, 0); + txr.context.scale(scale3, scale3); + this.drawElement(txr.context, ele, bb, scaledLabelShown, false); + txr.context.scale(1 / scale3, 1 / scale3); + txr.context.translate(-txr.usedWidth, 0); + } + eleCache = { + x: txr.usedWidth, + texture: txr, + level: lvl, + scale: scale3, + width: eleScaledW, + height: eleScaledH, + scaledLabelShown + }; + txr.usedWidth += Math.ceil(eleScaledW + eleTxrSpacing); + txr.eleCaches.push(eleCache); + lookup2.set(ele, lvl, eleCache); + self2.checkTextureFullness(txr); + return eleCache; + }; + ETCp.invalidateElements = function(eles) { + for (var i2 = 0; i2 < eles.length; i2++) { + this.invalidateElement(eles[i2]); + } + }; + ETCp.invalidateElement = function(ele) { + var self2 = this; + var lookup2 = self2.lookup; + var caches = []; + var invalid = lookup2.isInvalid(ele); + if (!invalid) { + return; + } + for (var lvl = minLvl$1; lvl <= maxLvl$1; lvl++) { + var cache3 = lookup2.getForCachedKey(ele, lvl); + if (cache3) { + caches.push(cache3); + } + } + var noOtherElesUseCache = lookup2.invalidate(ele); + if (noOtherElesUseCache) { + for (var i2 = 0; i2 < caches.length; i2++) { + var _cache = caches[i2]; + var txr = _cache.texture; + txr.invalidatedWidth += _cache.width; + _cache.invalidated = true; + self2.checkTextureUtility(txr); + } + } + self2.removeFromQueue(ele); + }; + ETCp.checkTextureUtility = function(txr) { + if (txr.invalidatedWidth >= minUtility * txr.width) { + this.retireTexture(txr); + } + }; + ETCp.checkTextureFullness = function(txr) { + var self2 = this; + var txrQ = self2.getTextureQueue(txr.height); + if (txr.usedWidth / txr.width > maxFullness && txr.fullnessChecks >= maxFullnessChecks) { + removeFromArray(txrQ, txr); + } else { + txr.fullnessChecks++; + } + }; + ETCp.retireTexture = function(txr) { + var self2 = this; + var txrH = txr.height; + var txrQ = self2.getTextureQueue(txrH); + var lookup2 = this.lookup; + removeFromArray(txrQ, txr); + txr.retired = true; + var eleCaches = txr.eleCaches; + for (var i2 = 0; i2 < eleCaches.length; i2++) { + var eleCache = eleCaches[i2]; + lookup2.deleteCache(eleCache.key, eleCache.level); + } + clearArray(eleCaches); + var rtxtrQ = self2.getRetiredTextureQueue(txrH); + rtxtrQ.push(txr); + }; + ETCp.addTexture = function(txrH, minW) { + var self2 = this; + var txrQ = self2.getTextureQueue(txrH); + var txr = {}; + txrQ.push(txr); + txr.eleCaches = []; + txr.height = txrH; + txr.width = Math.max(defTxrWidth, minW); + txr.usedWidth = 0; + txr.invalidatedWidth = 0; + txr.fullnessChecks = 0; + txr.canvas = self2.renderer.makeOffscreenCanvas(txr.width, txr.height); + txr.context = txr.canvas.getContext("2d"); + return txr; + }; + ETCp.recycleTexture = function(txrH, minW) { + var self2 = this; + var txrQ = self2.getTextureQueue(txrH); + var rtxtrQ = self2.getRetiredTextureQueue(txrH); + for (var i2 = 0; i2 < rtxtrQ.length; i2++) { + var txr = rtxtrQ[i2]; + if (txr.width >= minW) { + txr.retired = false; + txr.usedWidth = 0; + txr.invalidatedWidth = 0; + txr.fullnessChecks = 0; + clearArray(txr.eleCaches); + txr.context.setTransform(1, 0, 0, 1, 0, 0); + txr.context.clearRect(0, 0, txr.width, txr.height); + removeFromArray(rtxtrQ, txr); + txrQ.push(txr); + return txr; + } + } + }; + ETCp.queueElement = function(ele, lvl) { + var self2 = this; + var q3 = self2.getElementQueue(); + var k2q = self2.getElementKeyToQueue(); + var key = this.getKey(ele); + var existingReq = k2q[key]; + if (existingReq) { + existingReq.level = Math.max(existingReq.level, lvl); + existingReq.eles.merge(ele); + existingReq.reqs++; + q3.updateItem(existingReq); + } else { + var req = { + eles: ele.spawn().merge(ele), + level: lvl, + reqs: 1, + key + }; + q3.push(req); + k2q[key] = req; + } + }; + ETCp.dequeue = function(pxRatio) { + var self2 = this; + var q3 = self2.getElementQueue(); + var k2q = self2.getElementKeyToQueue(); + var dequeued = []; + var lookup2 = self2.lookup; + for (var i2 = 0; i2 < maxDeqSize$1; i2++) { + if (q3.size() > 0) { + var req = q3.pop(); + var key = req.key; + var ele = req.eles[0]; + var cacheExists = lookup2.hasCache(ele, req.level); + k2q[key] = null; + if (cacheExists) { + continue; + } + dequeued.push(req); + var bb = self2.getBoundingBox(ele); + self2.getElement(ele, bb, pxRatio, req.level, getTxrReasons.dequeue); + } else { + break; + } + } + return dequeued; + }; + ETCp.removeFromQueue = function(ele) { + var self2 = this; + var q3 = self2.getElementQueue(); + var k2q = self2.getElementKeyToQueue(); + var key = this.getKey(ele); + var req = k2q[key]; + if (req != null) { + if (req.eles.length === 1) { + req.reqs = MAX_INT$1; + q3.updateItem(req); + q3.pop(); + k2q[key] = null; + } else { + req.eles.unmerge(ele); + } + } + }; + ETCp.onDequeue = function(fn3) { + this.onDequeues.push(fn3); + }; + ETCp.offDequeue = function(fn3) { + removeFromArray(this.onDequeues, fn3); + }; + ETCp.setupDequeueing = defs.setupDequeueing({ + deqRedrawThreshold: deqRedrawThreshold$1, + deqCost: deqCost$1, + deqAvgCost: deqAvgCost$1, + deqNoDrawCost: deqNoDrawCost$1, + deqFastCost: deqFastCost$1, + deq: /* @__PURE__ */ __name(function deq(self2, pxRatio, extent2) { + return self2.dequeue(pxRatio, extent2); + }, "deq"), + onDeqd: /* @__PURE__ */ __name(function onDeqd(self2, deqd) { + for (var i2 = 0; i2 < self2.onDequeues.length; i2++) { + var fn3 = self2.onDequeues[i2]; + fn3(deqd); + } + }, "onDeqd"), + shouldRedraw: /* @__PURE__ */ __name(function shouldRedraw(self2, deqd, pxRatio, extent2) { + for (var i2 = 0; i2 < deqd.length; i2++) { + var eles = deqd[i2].eles; + for (var j3 = 0; j3 < eles.length; j3++) { + var bb = eles[j3].boundingBox(); + if (boundingBoxesIntersect(bb, extent2)) { + return true; + } + } + } + return false; + }, "shouldRedraw"), + priority: /* @__PURE__ */ __name(function priority(self2) { + return self2.renderer.beforeRenderPriorities.eleTxrDeq; + }, "priority") + }); + defNumLayers = 1; + minLvl = -4; + maxLvl = 2; + maxZoom2 = 3.99; + deqRedrawThreshold = 50; + refineEleDebounceTime = 50; + deqCost = 0.15; + deqAvgCost = 0.1; + deqNoDrawCost = 0.9; + deqFastCost = 0.9; + maxDeqSize = 1; + invalidThreshold = 250; + maxLayerArea = 4e3 * 4e3; + maxLayerDim = 32767; + useHighQualityEleTxrReqs = true; + LayeredTextureCache = /* @__PURE__ */ __name(function LayeredTextureCache2(renderer13) { + var self2 = this; + var r2 = self2.renderer = renderer13; + var cy = r2.cy; + self2.layersByLevel = {}; + self2.firstGet = true; + self2.lastInvalidationTime = performanceNow() - 2 * invalidThreshold; + self2.skipping = false; + self2.eleTxrDeqs = cy.collection(); + self2.scheduleElementRefinement = debounce(function() { + self2.refineElementTextures(self2.eleTxrDeqs); + self2.eleTxrDeqs.unmerge(self2.eleTxrDeqs); + }, refineEleDebounceTime); + r2.beforeRender(function(willDraw, now3) { + if (now3 - self2.lastInvalidationTime <= invalidThreshold) { + self2.skipping = true; + } else { + self2.skipping = false; + } + }, r2.beforeRenderPriorities.lyrTxrSkip); + var qSort = /* @__PURE__ */ __name(function qSort2(a2, b3) { + return b3.reqs - a2.reqs; + }, "qSort"); + self2.layersQueue = new Heap(qSort); + self2.setupDequeueing(); + }, "LayeredTextureCache"); + LTCp = LayeredTextureCache.prototype; + layerIdPool = 0; + MAX_INT = Math.pow(2, 53) - 1; + LTCp.makeLayer = function(bb, lvl) { + var scale3 = Math.pow(2, lvl); + var w4 = Math.ceil(bb.w * scale3); + var h3 = Math.ceil(bb.h * scale3); + var canvas = this.renderer.makeOffscreenCanvas(w4, h3); + var layer = { + id: layerIdPool = ++layerIdPool % MAX_INT, + bb, + level: lvl, + width: w4, + height: h3, + canvas, + context: canvas.getContext("2d"), + eles: [], + elesQueue: [], + reqs: 0 + }; + var cxt = layer.context; + var dx = -layer.bb.x1; + var dy = -layer.bb.y1; + cxt.scale(scale3, scale3); + cxt.translate(dx, dy); + return layer; + }; + LTCp.getLayers = function(eles, pxRatio, lvl) { + var self2 = this; + var r2 = self2.renderer; + var cy = r2.cy; + var zoom2 = cy.zoom(); + var firstGet = self2.firstGet; + self2.firstGet = false; + if (lvl == null) { + lvl = Math.ceil(log22(zoom2 * pxRatio)); + if (lvl < minLvl) { + lvl = minLvl; + } else if (zoom2 >= maxZoom2 || lvl > maxLvl) { + return null; + } + } + self2.validateLayersElesOrdering(lvl, eles); + var layersByLvl = self2.layersByLevel; + var scale3 = Math.pow(2, lvl); + var layers = layersByLvl[lvl] = layersByLvl[lvl] || []; + var bb; + var lvlComplete = self2.levelIsComplete(lvl, eles); + var tmpLayers; + var checkTempLevels = /* @__PURE__ */ __name(function checkTempLevels2() { + var canUseAsTmpLvl = /* @__PURE__ */ __name(function canUseAsTmpLvl2(l4) { + self2.validateLayersElesOrdering(l4, eles); + if (self2.levelIsComplete(l4, eles)) { + tmpLayers = layersByLvl[l4]; + return true; + } + }, "canUseAsTmpLvl"); + var checkLvls = /* @__PURE__ */ __name(function checkLvls2(dir2) { + if (tmpLayers) { + return; + } + for (var l4 = lvl + dir2; minLvl <= l4 && l4 <= maxLvl; l4 += dir2) { + if (canUseAsTmpLvl(l4)) { + break; + } + } + }, "checkLvls"); + checkLvls(1); + checkLvls(-1); + for (var i3 = layers.length - 1; i3 >= 0; i3--) { + var layer2 = layers[i3]; + if (layer2.invalid) { + removeFromArray(layers, layer2); + } + } + }, "checkTempLevels"); + if (!lvlComplete) { + checkTempLevels(); + } else { + return layers; + } + var getBb = /* @__PURE__ */ __name(function getBb2() { + if (!bb) { + bb = makeBoundingBox(); + for (var i3 = 0; i3 < eles.length; i3++) { + updateBoundingBox(bb, eles[i3].boundingBox()); + } + } + return bb; + }, "getBb"); + var makeLayer = /* @__PURE__ */ __name(function makeLayer2(opts) { + opts = opts || {}; + var after = opts.after; + getBb(); + var w4 = Math.ceil(bb.w * scale3); + var h3 = Math.ceil(bb.h * scale3); + if (w4 > maxLayerDim || h3 > maxLayerDim) { + return null; + } + var area = w4 * h3; + if (area > maxLayerArea) { + return null; + } + var layer2 = self2.makeLayer(bb, lvl); + if (after != null) { + var index = layers.indexOf(after) + 1; + layers.splice(index, 0, layer2); + } else if (opts.insert === void 0 || opts.insert) { + layers.unshift(layer2); + } + return layer2; + }, "makeLayer"); + if (self2.skipping && !firstGet) { + return null; + } + var layer = null; + var maxElesPerLayer = eles.length / defNumLayers; + var allowLazyQueueing = !firstGet; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + var rs = ele._private.rscratch; + var caches = rs.imgLayerCaches = rs.imgLayerCaches || {}; + var existingLayer = caches[lvl]; + if (existingLayer) { + layer = existingLayer; + continue; + } + if (!layer || layer.eles.length >= maxElesPerLayer || !boundingBoxInBoundingBox(layer.bb, ele.boundingBox())) { + layer = makeLayer({ + insert: true, + after: layer + }); + if (!layer) { + return null; + } + } + if (tmpLayers || allowLazyQueueing) { + self2.queueLayer(layer, ele); + } else { + self2.drawEleInLayer(layer, ele, lvl, pxRatio); + } + layer.eles.push(ele); + caches[lvl] = layer; + } + if (tmpLayers) { + return tmpLayers; + } + if (allowLazyQueueing) { + return null; + } + return layers; + }; + LTCp.getEleLevelForLayerLevel = function(lvl, pxRatio) { + return lvl; + }; + LTCp.drawEleInLayer = function(layer, ele, lvl, pxRatio) { + var self2 = this; + var r2 = this.renderer; + var context = layer.context; + var bb = ele.boundingBox(); + if (bb.w === 0 || bb.h === 0 || !ele.visible()) { + return; + } + lvl = self2.getEleLevelForLayerLevel(lvl, pxRatio); + { + r2.setImgSmoothing(context, false); + } + { + r2.drawCachedElement(context, ele, null, null, lvl, useHighQualityEleTxrReqs); + } + { + r2.setImgSmoothing(context, true); + } + }; + LTCp.levelIsComplete = function(lvl, eles) { + var self2 = this; + var layers = self2.layersByLevel[lvl]; + if (!layers || layers.length === 0) { + return false; + } + var numElesInLayers = 0; + for (var i2 = 0; i2 < layers.length; i2++) { + var layer = layers[i2]; + if (layer.reqs > 0) { + return false; + } + if (layer.invalid) { + return false; + } + numElesInLayers += layer.eles.length; + } + if (numElesInLayers !== eles.length) { + return false; + } + return true; + }; + LTCp.validateLayersElesOrdering = function(lvl, eles) { + var layers = this.layersByLevel[lvl]; + if (!layers) { + return; + } + for (var i2 = 0; i2 < layers.length; i2++) { + var layer = layers[i2]; + var offset = -1; + for (var j3 = 0; j3 < eles.length; j3++) { + if (layer.eles[0] === eles[j3]) { + offset = j3; + break; + } + } + if (offset < 0) { + this.invalidateLayer(layer); + continue; + } + var o2 = offset; + for (var j3 = 0; j3 < layer.eles.length; j3++) { + if (layer.eles[j3] !== eles[o2 + j3]) { + this.invalidateLayer(layer); + break; + } + } + } + }; + LTCp.updateElementsInLayers = function(eles, update2) { + var self2 = this; + var isEles = element(eles[0]); + for (var i2 = 0; i2 < eles.length; i2++) { + var req = isEles ? null : eles[i2]; + var ele = isEles ? eles[i2] : eles[i2].ele; + var rs = ele._private.rscratch; + var caches = rs.imgLayerCaches = rs.imgLayerCaches || {}; + for (var l4 = minLvl; l4 <= maxLvl; l4++) { + var layer = caches[l4]; + if (!layer) { + continue; + } + if (req && self2.getEleLevelForLayerLevel(layer.level) !== req.level) { + continue; + } + update2(layer, ele, req); + } + } + }; + LTCp.haveLayers = function() { + var self2 = this; + var haveLayers = false; + for (var l4 = minLvl; l4 <= maxLvl; l4++) { + var layers = self2.layersByLevel[l4]; + if (layers && layers.length > 0) { + haveLayers = true; + break; + } + } + return haveLayers; + }; + LTCp.invalidateElements = function(eles) { + var self2 = this; + if (eles.length === 0) { + return; + } + self2.lastInvalidationTime = performanceNow(); + if (eles.length === 0 || !self2.haveLayers()) { + return; + } + self2.updateElementsInLayers(eles, /* @__PURE__ */ __name(function invalAssocLayers(layer, ele, req) { + self2.invalidateLayer(layer); + }, "invalAssocLayers")); + }; + LTCp.invalidateLayer = function(layer) { + this.lastInvalidationTime = performanceNow(); + if (layer.invalid) { + return; + } + var lvl = layer.level; + var eles = layer.eles; + var layers = this.layersByLevel[lvl]; + removeFromArray(layers, layer); + layer.elesQueue = []; + layer.invalid = true; + if (layer.replacement) { + layer.replacement.invalid = true; + } + for (var i2 = 0; i2 < eles.length; i2++) { + var caches = eles[i2]._private.rscratch.imgLayerCaches; + if (caches) { + caches[lvl] = null; + } + } + }; + LTCp.refineElementTextures = function(eles) { + var self2 = this; + self2.updateElementsInLayers(eles, /* @__PURE__ */ __name(function refineEachEle(layer, ele, req) { + var rLyr = layer.replacement; + if (!rLyr) { + rLyr = layer.replacement = self2.makeLayer(layer.bb, layer.level); + rLyr.replaces = layer; + rLyr.eles = layer.eles; + } + if (!rLyr.reqs) { + for (var i2 = 0; i2 < rLyr.eles.length; i2++) { + self2.queueLayer(rLyr, rLyr.eles[i2]); + } + } + }, "refineEachEle")); + }; + LTCp.enqueueElementRefinement = function(ele) { + this.eleTxrDeqs.merge(ele); + this.scheduleElementRefinement(); + }; + LTCp.queueLayer = function(layer, ele) { + var self2 = this; + var q3 = self2.layersQueue; + var elesQ = layer.elesQueue; + var hasId = elesQ.hasId = elesQ.hasId || {}; + if (layer.replacement) { + return; + } + if (ele) { + if (hasId[ele.id()]) { + return; + } + elesQ.push(ele); + hasId[ele.id()] = true; + } + if (layer.reqs) { + layer.reqs++; + q3.updateItem(layer); + } else { + layer.reqs = 1; + q3.push(layer); + } + }; + LTCp.dequeue = function(pxRatio) { + var self2 = this; + var q3 = self2.layersQueue; + var deqd = []; + var eleDeqs = 0; + while (eleDeqs < maxDeqSize) { + if (q3.size() === 0) { + break; + } + var layer = q3.peek(); + if (layer.replacement) { + q3.pop(); + continue; + } + if (layer.replaces && layer !== layer.replaces.replacement) { + q3.pop(); + continue; + } + if (layer.invalid) { + q3.pop(); + continue; + } + var ele = layer.elesQueue.shift(); + if (ele) { + self2.drawEleInLayer(layer, ele, layer.level, pxRatio); + eleDeqs++; + } + if (deqd.length === 0) { + deqd.push(true); + } + if (layer.elesQueue.length === 0) { + q3.pop(); + layer.reqs = 0; + if (layer.replaces) { + self2.applyLayerReplacement(layer); + } + self2.requestRedraw(); + } + } + return deqd; + }; + LTCp.applyLayerReplacement = function(layer) { + var self2 = this; + var layersInLevel = self2.layersByLevel[layer.level]; + var replaced = layer.replaces; + var index = layersInLevel.indexOf(replaced); + if (index < 0 || replaced.invalid) { + return; + } + layersInLevel[index] = layer; + for (var i2 = 0; i2 < layer.eles.length; i2++) { + var _p = layer.eles[i2]._private; + var cache3 = _p.imgLayerCaches = _p.imgLayerCaches || {}; + if (cache3) { + cache3[layer.level] = layer; + } + } + self2.requestRedraw(); + }; + LTCp.requestRedraw = debounce(function() { + var r2 = this.renderer; + r2.redrawHint("eles", true); + r2.redrawHint("drag", true); + r2.redraw(); + }, 100); + LTCp.setupDequeueing = defs.setupDequeueing({ + deqRedrawThreshold, + deqCost, + deqAvgCost, + deqNoDrawCost, + deqFastCost, + deq: /* @__PURE__ */ __name(function deq2(self2, pxRatio) { + return self2.dequeue(pxRatio); + }, "deq"), + onDeqd: noop$1, + shouldRedraw: trueify, + priority: /* @__PURE__ */ __name(function priority2(self2) { + return self2.renderer.beforeRenderPriorities.lyrTxrDeq; + }, "priority") + }); + CRp$b = {}; + __name(polygon, "polygon"); + __name(triangleBackcurve, "triangleBackcurve"); + __name(triangleTee, "triangleTee"); + __name(circleTriangle, "circleTriangle"); + __name(circle$1, "circle$1"); + CRp$b.arrowShapeImpl = function(name) { + return (impl || (impl = { + "polygon": polygon, + "triangle-backcurve": triangleBackcurve, + "triangle-tee": triangleTee, + "circle-triangle": circleTriangle, + "triangle-cross": triangleTee, + "circle": circle$1 + }))[name]; + }; + CRp$a = {}; + CRp$a.drawElement = function(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity) { + var r2 = this; + if (ele.isNode()) { + r2.drawNode(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity); + } else { + r2.drawEdge(context, ele, shiftToOriginWithBb, showLabel, showOverlay, showOpacity); + } + }; + CRp$a.drawElementOverlay = function(context, ele) { + var r2 = this; + if (ele.isNode()) { + r2.drawNodeOverlay(context, ele); + } else { + r2.drawEdgeOverlay(context, ele); + } + }; + CRp$a.drawElementUnderlay = function(context, ele) { + var r2 = this; + if (ele.isNode()) { + r2.drawNodeUnderlay(context, ele); + } else { + r2.drawEdgeUnderlay(context, ele); + } + }; + CRp$a.drawCachedElementPortion = function(context, ele, eleTxrCache, pxRatio, lvl, reason, getRotation, getOpacity3) { + var r2 = this; + var bb = eleTxrCache.getBoundingBox(ele); + if (bb.w === 0 || bb.h === 0) { + return; + } + var eleCache = eleTxrCache.getElement(ele, bb, pxRatio, lvl, reason); + if (eleCache != null) { + var opacity = getOpacity3(r2, ele); + if (opacity === 0) { + return; + } + var theta = getRotation(r2, ele); + var x1 = bb.x1, y1 = bb.y1, w4 = bb.w, h3 = bb.h; + var x5, y6, sx, sy, smooth; + if (theta !== 0) { + var rotPt = eleTxrCache.getRotationPoint(ele); + sx = rotPt.x; + sy = rotPt.y; + context.translate(sx, sy); + context.rotate(theta); + smooth = r2.getImgSmoothing(context); + if (!smooth) { + r2.setImgSmoothing(context, true); + } + var off = eleTxrCache.getRotationOffset(ele); + x5 = off.x; + y6 = off.y; + } else { + x5 = x1; + y6 = y1; + } + var oldGlobalAlpha; + if (opacity !== 1) { + oldGlobalAlpha = context.globalAlpha; + context.globalAlpha = oldGlobalAlpha * opacity; + } + context.drawImage(eleCache.texture.canvas, eleCache.x, 0, eleCache.width, eleCache.height, x5, y6, w4, h3); + if (opacity !== 1) { + context.globalAlpha = oldGlobalAlpha; + } + if (theta !== 0) { + context.rotate(-theta); + context.translate(-sx, -sy); + if (!smooth) { + r2.setImgSmoothing(context, false); + } + } + } else { + eleTxrCache.drawElement(context, ele); + } + }; + getZeroRotation = /* @__PURE__ */ __name(function getZeroRotation2() { + return 0; + }, "getZeroRotation"); + getLabelRotation = /* @__PURE__ */ __name(function getLabelRotation2(r2, ele) { + return r2.getTextAngle(ele, null); + }, "getLabelRotation"); + getSourceLabelRotation = /* @__PURE__ */ __name(function getSourceLabelRotation2(r2, ele) { + return r2.getTextAngle(ele, "source"); + }, "getSourceLabelRotation"); + getTargetLabelRotation = /* @__PURE__ */ __name(function getTargetLabelRotation2(r2, ele) { + return r2.getTextAngle(ele, "target"); + }, "getTargetLabelRotation"); + getOpacity = /* @__PURE__ */ __name(function getOpacity2(r2, ele) { + return ele.effectiveOpacity(); + }, "getOpacity"); + getTextOpacity = /* @__PURE__ */ __name(function getTextOpacity2(e3, ele) { + return ele.pstyle("text-opacity").pfValue * ele.effectiveOpacity(); + }, "getTextOpacity"); + CRp$a.drawCachedElement = function(context, ele, pxRatio, extent2, lvl, requestHighQuality) { + var r2 = this; + var _r$data = r2.data, eleTxrCache = _r$data.eleTxrCache, lblTxrCache = _r$data.lblTxrCache, slbTxrCache = _r$data.slbTxrCache, tlbTxrCache = _r$data.tlbTxrCache; + var bb = ele.boundingBox(); + var reason = requestHighQuality === true ? eleTxrCache.reasons.highQuality : null; + if (bb.w === 0 || bb.h === 0 || !ele.visible()) { + return; + } + if (!extent2 || boundingBoxesIntersect(bb, extent2)) { + var isEdge2 = ele.isEdge(); + var badLine = ele.element()._private.rscratch.badLine; + r2.drawElementUnderlay(context, ele); + r2.drawCachedElementPortion(context, ele, eleTxrCache, pxRatio, lvl, reason, getZeroRotation, getOpacity); + if (!isEdge2 || !badLine) { + r2.drawCachedElementPortion(context, ele, lblTxrCache, pxRatio, lvl, reason, getLabelRotation, getTextOpacity); + } + if (isEdge2 && !badLine) { + r2.drawCachedElementPortion(context, ele, slbTxrCache, pxRatio, lvl, reason, getSourceLabelRotation, getTextOpacity); + r2.drawCachedElementPortion(context, ele, tlbTxrCache, pxRatio, lvl, reason, getTargetLabelRotation, getTextOpacity); + } + r2.drawElementOverlay(context, ele); + } + }; + CRp$a.drawElements = function(context, eles) { + var r2 = this; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + r2.drawElement(context, ele); + } + }; + CRp$a.drawCachedElements = function(context, eles, pxRatio, extent2) { + var r2 = this; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + r2.drawCachedElement(context, ele, pxRatio, extent2); + } + }; + CRp$a.drawCachedNodes = function(context, eles, pxRatio, extent2) { + var r2 = this; + for (var i2 = 0; i2 < eles.length; i2++) { + var ele = eles[i2]; + if (!ele.isNode()) { + continue; + } + r2.drawCachedElement(context, ele, pxRatio, extent2); + } + }; + CRp$a.drawLayeredElements = function(context, eles, pxRatio, extent2) { + var r2 = this; + var layers = r2.data.lyrTxrCache.getLayers(eles, pxRatio); + if (layers) { + for (var i2 = 0; i2 < layers.length; i2++) { + var layer = layers[i2]; + var bb = layer.bb; + if (bb.w === 0 || bb.h === 0) { + continue; + } + context.drawImage(layer.canvas, bb.x1, bb.y1, bb.w, bb.h); + } + } else { + r2.drawCachedElements(context, eles, pxRatio, extent2); + } + }; + CRp$9 = {}; + CRp$9.drawEdge = function(context, edge, shiftToOriginWithBb) { + var drawLabel4 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true; + var shouldDrawOverlay = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true; + var shouldDrawOpacity = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true; + var r2 = this; + var rs = edge._private.rscratch; + if (shouldDrawOpacity && !edge.visible()) { + return; + } + if (rs.badLine || rs.allpts == null || isNaN(rs.allpts[0])) { + return; + } + var bb; + if (shiftToOriginWithBb) { + bb = shiftToOriginWithBb; + context.translate(-bb.x1, -bb.y1); + } + var opacity = shouldDrawOpacity ? edge.pstyle("opacity").value : 1; + var lineOpacity = shouldDrawOpacity ? edge.pstyle("line-opacity").value : 1; + var curveStyle = edge.pstyle("curve-style").value; + var lineStyle = edge.pstyle("line-style").value; + var edgeWidth = edge.pstyle("width").pfValue; + var lineCap = edge.pstyle("line-cap").value; + var lineOutlineWidth = edge.pstyle("line-outline-width").value; + var lineOutlineColor = edge.pstyle("line-outline-color").value; + var effectiveLineOpacity = opacity * lineOpacity; + var effectiveArrowOpacity = opacity * lineOpacity; + var drawLine2 = /* @__PURE__ */ __name(function drawLine3() { + var strokeOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : effectiveLineOpacity; + if (curveStyle === "straight-triangle") { + r2.eleStrokeStyle(context, edge, strokeOpacity); + r2.drawEdgeTrianglePath(edge, context, rs.allpts); + } else { + context.lineWidth = edgeWidth; + context.lineCap = lineCap; + r2.eleStrokeStyle(context, edge, strokeOpacity); + r2.drawEdgePath(edge, context, rs.allpts, lineStyle); + context.lineCap = "butt"; + } + }, "drawLine"); + var drawLineOutline = /* @__PURE__ */ __name(function drawLineOutline2() { + var strokeOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : effectiveLineOpacity; + context.lineWidth = edgeWidth + lineOutlineWidth; + context.lineCap = lineCap; + if (lineOutlineWidth > 0) { + r2.colorStrokeStyle(context, lineOutlineColor[0], lineOutlineColor[1], lineOutlineColor[2], strokeOpacity); + } else { + context.lineCap = "butt"; + return; + } + if (curveStyle === "straight-triangle") { + r2.drawEdgeTrianglePath(edge, context, rs.allpts); + } else { + r2.drawEdgePath(edge, context, rs.allpts, lineStyle); + context.lineCap = "butt"; + } + }, "drawLineOutline"); + var drawOverlay = /* @__PURE__ */ __name(function drawOverlay2() { + if (!shouldDrawOverlay) { + return; + } + r2.drawEdgeOverlay(context, edge); + }, "drawOverlay"); + var drawUnderlay = /* @__PURE__ */ __name(function drawUnderlay2() { + if (!shouldDrawOverlay) { + return; + } + r2.drawEdgeUnderlay(context, edge); + }, "drawUnderlay"); + var drawArrows2 = /* @__PURE__ */ __name(function drawArrows3() { + var arrowOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : effectiveArrowOpacity; + r2.drawArrowheads(context, edge, arrowOpacity); + }, "drawArrows"); + var drawText6 = /* @__PURE__ */ __name(function drawText7() { + r2.drawElementText(context, edge, null, drawLabel4); + }, "drawText"); + context.lineJoin = "round"; + var ghost = edge.pstyle("ghost").value === "yes"; + if (ghost) { + var gx = edge.pstyle("ghost-offset-x").pfValue; + var gy = edge.pstyle("ghost-offset-y").pfValue; + var ghostOpacity = edge.pstyle("ghost-opacity").value; + var effectiveGhostOpacity = effectiveLineOpacity * ghostOpacity; + context.translate(gx, gy); + drawLine2(effectiveGhostOpacity); + drawArrows2(effectiveGhostOpacity); + context.translate(-gx, -gy); + } else { + drawLineOutline(); + } + drawUnderlay(); + drawLine2(); + drawArrows2(); + drawOverlay(); + drawText6(); + if (shiftToOriginWithBb) { + context.translate(bb.x1, bb.y1); + } + }; + drawEdgeOverlayUnderlay = /* @__PURE__ */ __name(function drawEdgeOverlayUnderlay2(overlayOrUnderlay) { + if (!["overlay", "underlay"].includes(overlayOrUnderlay)) { + throw new Error("Invalid state"); + } + return function(context, edge) { + if (!edge.visible()) { + return; + } + var opacity = edge.pstyle("".concat(overlayOrUnderlay, "-opacity")).value; + if (opacity === 0) { + return; + } + var r2 = this; + var usePaths = r2.usePaths(); + var rs = edge._private.rscratch; + var padding2 = edge.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue; + var width3 = 2 * padding2; + var color2 = edge.pstyle("".concat(overlayOrUnderlay, "-color")).value; + context.lineWidth = width3; + if (rs.edgeType === "self" && !usePaths) { + context.lineCap = "butt"; + } else { + context.lineCap = "round"; + } + r2.colorStrokeStyle(context, color2[0], color2[1], color2[2], opacity); + r2.drawEdgePath(edge, context, rs.allpts, "solid"); + }; + }, "drawEdgeOverlayUnderlay"); + CRp$9.drawEdgeOverlay = drawEdgeOverlayUnderlay("overlay"); + CRp$9.drawEdgeUnderlay = drawEdgeOverlayUnderlay("underlay"); + CRp$9.drawEdgePath = function(edge, context, pts2, type3) { + var rs = edge._private.rscratch; + var canvasCxt = context; + var path4; + var pathCacheHit = false; + var usePaths = this.usePaths(); + var lineDashPattern = edge.pstyle("line-dash-pattern").pfValue; + var lineDashOffset = edge.pstyle("line-dash-offset").pfValue; + if (usePaths) { + var pathCacheKey = pts2.join("$"); + var keyMatches = rs.pathCacheKey && rs.pathCacheKey === pathCacheKey; + if (keyMatches) { + path4 = context = rs.pathCache; + pathCacheHit = true; + } else { + path4 = context = new Path2D(); + rs.pathCacheKey = pathCacheKey; + rs.pathCache = path4; + } + } + if (canvasCxt.setLineDash) { + switch (type3) { + case "dotted": + canvasCxt.setLineDash([1, 1]); + break; + case "dashed": + canvasCxt.setLineDash(lineDashPattern); + canvasCxt.lineDashOffset = lineDashOffset; + break; + case "solid": + canvasCxt.setLineDash([]); + break; + } + } + if (!pathCacheHit && !rs.badLine) { + if (context.beginPath) { + context.beginPath(); + } + context.moveTo(pts2[0], pts2[1]); + switch (rs.edgeType) { + case "bezier": + case "self": + case "compound": + case "multibezier": + for (var i2 = 2; i2 + 3 < pts2.length; i2 += 4) { + context.quadraticCurveTo(pts2[i2], pts2[i2 + 1], pts2[i2 + 2], pts2[i2 + 3]); + } + break; + case "straight": + case "haystack": + for (var _i = 2; _i + 1 < pts2.length; _i += 2) { + context.lineTo(pts2[_i], pts2[_i + 1]); + } + break; + case "segments": + if (rs.isRound) { + var _iterator = _createForOfIteratorHelper(rs.roundCorners), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var corner = _step.value; + drawPreparedRoundCorner(context, corner); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + context.lineTo(pts2[pts2.length - 2], pts2[pts2.length - 1]); + } else { + for (var _i2 = 2; _i2 + 1 < pts2.length; _i2 += 2) { + context.lineTo(pts2[_i2], pts2[_i2 + 1]); + } + } + break; + } + } + context = canvasCxt; + if (usePaths) { + context.stroke(path4); + } else { + context.stroke(); + } + if (context.setLineDash) { + context.setLineDash([]); + } + }; + CRp$9.drawEdgeTrianglePath = function(edge, context, pts2) { + context.fillStyle = context.strokeStyle; + var edgeWidth = edge.pstyle("width").pfValue; + for (var i2 = 0; i2 + 1 < pts2.length; i2 += 2) { + var vector = [pts2[i2 + 2] - pts2[i2], pts2[i2 + 3] - pts2[i2 + 1]]; + var length2 = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]); + var normal = [vector[1] / length2, -vector[0] / length2]; + var triangleHead = [normal[0] * edgeWidth / 2, normal[1] * edgeWidth / 2]; + context.beginPath(); + context.moveTo(pts2[i2] - triangleHead[0], pts2[i2 + 1] - triangleHead[1]); + context.lineTo(pts2[i2] + triangleHead[0], pts2[i2 + 1] + triangleHead[1]); + context.lineTo(pts2[i2 + 2], pts2[i2 + 3]); + context.closePath(); + context.fill(); + } + }; + CRp$9.drawArrowheads = function(context, edge, opacity) { + var rs = edge._private.rscratch; + var isHaystack = rs.edgeType === "haystack"; + if (!isHaystack) { + this.drawArrowhead(context, edge, "source", rs.arrowStartX, rs.arrowStartY, rs.srcArrowAngle, opacity); + } + this.drawArrowhead(context, edge, "mid-target", rs.midX, rs.midY, rs.midtgtArrowAngle, opacity); + this.drawArrowhead(context, edge, "mid-source", rs.midX, rs.midY, rs.midsrcArrowAngle, opacity); + if (!isHaystack) { + this.drawArrowhead(context, edge, "target", rs.arrowEndX, rs.arrowEndY, rs.tgtArrowAngle, opacity); + } + }; + CRp$9.drawArrowhead = function(context, edge, prefix, x5, y6, angle2, opacity) { + if (isNaN(x5) || x5 == null || isNaN(y6) || y6 == null || isNaN(angle2) || angle2 == null) { + return; + } + var self2 = this; + var arrowShape = edge.pstyle(prefix + "-arrow-shape").value; + if (arrowShape === "none") { + return; + } + var arrowClearFill = edge.pstyle(prefix + "-arrow-fill").value === "hollow" ? "both" : "filled"; + var arrowFill = edge.pstyle(prefix + "-arrow-fill").value; + var edgeWidth = edge.pstyle("width").pfValue; + var pArrowWidth = edge.pstyle(prefix + "-arrow-width"); + var arrowWidth = pArrowWidth.value === "match-line" ? edgeWidth : pArrowWidth.pfValue; + if (pArrowWidth.units === "%") arrowWidth *= edgeWidth; + var edgeOpacity = edge.pstyle("opacity").value; + if (opacity === void 0) { + opacity = edgeOpacity; + } + var gco = context.globalCompositeOperation; + if (opacity !== 1 || arrowFill === "hollow") { + context.globalCompositeOperation = "destination-out"; + self2.colorFillStyle(context, 255, 255, 255, 1); + self2.colorStrokeStyle(context, 255, 255, 255, 1); + self2.drawArrowShape(edge, context, arrowClearFill, edgeWidth, arrowShape, arrowWidth, x5, y6, angle2); + context.globalCompositeOperation = gco; + } + var color2 = edge.pstyle(prefix + "-arrow-color").value; + self2.colorFillStyle(context, color2[0], color2[1], color2[2], opacity); + self2.colorStrokeStyle(context, color2[0], color2[1], color2[2], opacity); + self2.drawArrowShape(edge, context, arrowFill, edgeWidth, arrowShape, arrowWidth, x5, y6, angle2); + }; + CRp$9.drawArrowShape = function(edge, context, fill, edgeWidth, shape, shapeWidth, x5, y6, angle2) { + var r2 = this; + var usePaths = this.usePaths() && shape !== "triangle-cross"; + var pathCacheHit = false; + var path4; + var canvasContext = context; + var translation = { + x: x5, + y: y6 + }; + var scale3 = edge.pstyle("arrow-scale").value; + var size4 = this.getArrowWidth(edgeWidth, scale3); + var shapeImpl = r2.arrowShapes[shape]; + if (usePaths) { + var cache3 = r2.arrowPathCache = r2.arrowPathCache || []; + var key = hashString(shape); + var cachedPath = cache3[key]; + if (cachedPath != null) { + path4 = context = cachedPath; + pathCacheHit = true; + } else { + path4 = context = new Path2D(); + cache3[key] = path4; + } + } + if (!pathCacheHit) { + if (context.beginPath) { + context.beginPath(); + } + if (usePaths) { + shapeImpl.draw(context, 1, 0, { + x: 0, + y: 0 + }, 1); + } else { + shapeImpl.draw(context, size4, angle2, translation, edgeWidth); + } + if (context.closePath) { + context.closePath(); + } + } + context = canvasContext; + if (usePaths) { + context.translate(x5, y6); + context.rotate(angle2); + context.scale(size4, size4); + } + if (fill === "filled" || fill === "both") { + if (usePaths) { + context.fill(path4); + } else { + context.fill(); + } + } + if (fill === "hollow" || fill === "both") { + context.lineWidth = shapeWidth / (usePaths ? size4 : 1); + context.lineJoin = "miter"; + if (usePaths) { + context.stroke(path4); + } else { + context.stroke(); + } + } + if (usePaths) { + context.scale(1 / size4, 1 / size4); + context.rotate(-angle2); + context.translate(-x5, -y6); + } + }; + CRp$8 = {}; + CRp$8.safeDrawImage = function(context, img, ix, iy, iw, ih, x5, y6, w4, h3) { + if (iw <= 0 || ih <= 0 || w4 <= 0 || h3 <= 0) { + return; + } + try { + context.drawImage(img, ix, iy, iw, ih, x5, y6, w4, h3); + } catch (e3) { + warn(e3); + } + }; + CRp$8.drawInscribedImage = function(context, img, node2, index, nodeOpacity) { + var r2 = this; + var pos = node2.position(); + var nodeX = pos.x; + var nodeY = pos.y; + var styleObj = node2.cy().style(); + var getIndexedStyle = styleObj.getIndexedStyle.bind(styleObj); + var fit2 = getIndexedStyle(node2, "background-fit", "value", index); + var repeat2 = getIndexedStyle(node2, "background-repeat", "value", index); + var nodeW = node2.width(); + var nodeH = node2.height(); + var paddingX2 = node2.padding() * 2; + var nodeTW = nodeW + (getIndexedStyle(node2, "background-width-relative-to", "value", index) === "inner" ? 0 : paddingX2); + var nodeTH = nodeH + (getIndexedStyle(node2, "background-height-relative-to", "value", index) === "inner" ? 0 : paddingX2); + var rs = node2._private.rscratch; + var clip = getIndexedStyle(node2, "background-clip", "value", index); + var shouldClip = clip === "node"; + var imgOpacity = getIndexedStyle(node2, "background-image-opacity", "value", index) * nodeOpacity; + var smooth = getIndexedStyle(node2, "background-image-smoothing", "value", index); + var cornerRadius = node2.pstyle("corner-radius").value; + if (cornerRadius !== "auto") cornerRadius = node2.pstyle("corner-radius").pfValue; + var imgW = img.width || img.cachedW; + var imgH = img.height || img.cachedH; + if (null == imgW || null == imgH) { + document.body.appendChild(img); + imgW = img.cachedW = img.width || img.offsetWidth; + imgH = img.cachedH = img.height || img.offsetHeight; + document.body.removeChild(img); + } + var w4 = imgW; + var h3 = imgH; + if (getIndexedStyle(node2, "background-width", "value", index) !== "auto") { + if (getIndexedStyle(node2, "background-width", "units", index) === "%") { + w4 = getIndexedStyle(node2, "background-width", "pfValue", index) * nodeTW; + } else { + w4 = getIndexedStyle(node2, "background-width", "pfValue", index); + } + } + if (getIndexedStyle(node2, "background-height", "value", index) !== "auto") { + if (getIndexedStyle(node2, "background-height", "units", index) === "%") { + h3 = getIndexedStyle(node2, "background-height", "pfValue", index) * nodeTH; + } else { + h3 = getIndexedStyle(node2, "background-height", "pfValue", index); + } + } + if (w4 === 0 || h3 === 0) { + return; + } + if (fit2 === "contain") { + var scale3 = Math.min(nodeTW / w4, nodeTH / h3); + w4 *= scale3; + h3 *= scale3; + } else if (fit2 === "cover") { + var scale3 = Math.max(nodeTW / w4, nodeTH / h3); + w4 *= scale3; + h3 *= scale3; + } + var x5 = nodeX - nodeTW / 2; + var posXUnits = getIndexedStyle(node2, "background-position-x", "units", index); + var posXPfVal = getIndexedStyle(node2, "background-position-x", "pfValue", index); + if (posXUnits === "%") { + x5 += (nodeTW - w4) * posXPfVal; + } else { + x5 += posXPfVal; + } + var offXUnits = getIndexedStyle(node2, "background-offset-x", "units", index); + var offXPfVal = getIndexedStyle(node2, "background-offset-x", "pfValue", index); + if (offXUnits === "%") { + x5 += (nodeTW - w4) * offXPfVal; + } else { + x5 += offXPfVal; + } + var y6 = nodeY - nodeTH / 2; + var posYUnits = getIndexedStyle(node2, "background-position-y", "units", index); + var posYPfVal = getIndexedStyle(node2, "background-position-y", "pfValue", index); + if (posYUnits === "%") { + y6 += (nodeTH - h3) * posYPfVal; + } else { + y6 += posYPfVal; + } + var offYUnits = getIndexedStyle(node2, "background-offset-y", "units", index); + var offYPfVal = getIndexedStyle(node2, "background-offset-y", "pfValue", index); + if (offYUnits === "%") { + y6 += (nodeTH - h3) * offYPfVal; + } else { + y6 += offYPfVal; + } + if (rs.pathCache) { + x5 -= nodeX; + y6 -= nodeY; + nodeX = 0; + nodeY = 0; + } + var gAlpha = context.globalAlpha; + context.globalAlpha = imgOpacity; + var smoothingEnabled = r2.getImgSmoothing(context); + var isSmoothingSwitched = false; + if (smooth === "no" && smoothingEnabled) { + r2.setImgSmoothing(context, false); + isSmoothingSwitched = true; + } else if (smooth === "yes" && !smoothingEnabled) { + r2.setImgSmoothing(context, true); + isSmoothingSwitched = true; + } + if (repeat2 === "no-repeat") { + if (shouldClip) { + context.save(); + if (rs.pathCache) { + context.clip(rs.pathCache); + } else { + r2.nodeShapes[r2.getNodeShape(node2)].draw(context, nodeX, nodeY, nodeTW, nodeTH, cornerRadius, rs); + context.clip(); + } + } + r2.safeDrawImage(context, img, 0, 0, imgW, imgH, x5, y6, w4, h3); + if (shouldClip) { + context.restore(); + } + } else { + var pattern = context.createPattern(img, repeat2); + context.fillStyle = pattern; + r2.nodeShapes[r2.getNodeShape(node2)].draw(context, nodeX, nodeY, nodeTW, nodeTH, cornerRadius, rs); + context.translate(x5, y6); + context.fill(); + context.translate(-x5, -y6); + } + context.globalAlpha = gAlpha; + if (isSmoothingSwitched) { + r2.setImgSmoothing(context, smoothingEnabled); + } + }; + CRp$7 = {}; + CRp$7.eleTextBiggerThanMin = function(ele, scale3) { + if (!scale3) { + var zoom2 = ele.cy().zoom(); + var pxRatio = this.getPixelRatio(); + var lvl = Math.ceil(log22(zoom2 * pxRatio)); + scale3 = Math.pow(2, lvl); + } + var computedSize = ele.pstyle("font-size").pfValue * scale3; + var minSize = ele.pstyle("min-zoomed-font-size").pfValue; + if (computedSize < minSize) { + return false; + } + return true; + }; + CRp$7.drawElementText = function(context, ele, shiftToOriginWithBb, force, prefix) { + var useEleOpacity = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true; + var r2 = this; + if (force == null) { + if (useEleOpacity && !r2.eleTextBiggerThanMin(ele)) { + return; + } + } else if (force === false) { + return; + } + if (ele.isNode()) { + var label = ele.pstyle("label"); + if (!label || !label.value) { + return; + } + var justification = r2.getLabelJustification(ele); + context.textAlign = justification; + context.textBaseline = "bottom"; + } else { + var badLine = ele.element()._private.rscratch.badLine; + var _label = ele.pstyle("label"); + var srcLabel = ele.pstyle("source-label"); + var tgtLabel = ele.pstyle("target-label"); + if (badLine || (!_label || !_label.value) && (!srcLabel || !srcLabel.value) && (!tgtLabel || !tgtLabel.value)) { + return; + } + context.textAlign = "center"; + context.textBaseline = "bottom"; + } + var applyRotation = !shiftToOriginWithBb; + var bb; + if (shiftToOriginWithBb) { + bb = shiftToOriginWithBb; + context.translate(-bb.x1, -bb.y1); + } + if (prefix == null) { + r2.drawText(context, ele, null, applyRotation, useEleOpacity); + if (ele.isEdge()) { + r2.drawText(context, ele, "source", applyRotation, useEleOpacity); + r2.drawText(context, ele, "target", applyRotation, useEleOpacity); + } + } else { + r2.drawText(context, ele, prefix, applyRotation, useEleOpacity); + } + if (shiftToOriginWithBb) { + context.translate(bb.x1, bb.y1); + } + }; + CRp$7.getFontCache = function(context) { + var cache3; + this.fontCaches = this.fontCaches || []; + for (var i2 = 0; i2 < this.fontCaches.length; i2++) { + cache3 = this.fontCaches[i2]; + if (cache3.context === context) { + return cache3; + } + } + cache3 = { + context + }; + this.fontCaches.push(cache3); + return cache3; + }; + CRp$7.setupTextStyle = function(context, ele) { + var useEleOpacity = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true; + var labelStyle = ele.pstyle("font-style").strValue; + var labelSize = ele.pstyle("font-size").pfValue + "px"; + var labelFamily = ele.pstyle("font-family").strValue; + var labelWeight = ele.pstyle("font-weight").strValue; + var opacity = useEleOpacity ? ele.effectiveOpacity() * ele.pstyle("text-opacity").value : 1; + var outlineOpacity = ele.pstyle("text-outline-opacity").value * opacity; + var color2 = ele.pstyle("color").value; + var outlineColor = ele.pstyle("text-outline-color").value; + context.font = labelStyle + " " + labelWeight + " " + labelSize + " " + labelFamily; + context.lineJoin = "round"; + this.colorFillStyle(context, color2[0], color2[1], color2[2], opacity); + this.colorStrokeStyle(context, outlineColor[0], outlineColor[1], outlineColor[2], outlineOpacity); + }; + __name(circle3, "circle"); + __name(roundRect, "roundRect"); + CRp$7.getTextAngle = function(ele, prefix) { + var theta; + var _p = ele._private; + var rscratch = _p.rscratch; + var pdash = prefix ? prefix + "-" : ""; + var rotation = ele.pstyle(pdash + "text-rotation"); + if (rotation.strValue === "autorotate") { + var textAngle = getPrefixedProperty(rscratch, "labelAngle", prefix); + theta = ele.isEdge() ? textAngle : 0; + } else if (rotation.strValue === "none") { + theta = 0; + } else { + theta = rotation.pfValue; + } + return theta; + }; + CRp$7.drawText = function(context, ele, prefix) { + var applyRotation = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true; + var useEleOpacity = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true; + var _p = ele._private; + var rscratch = _p.rscratch; + var parentOpacity = useEleOpacity ? ele.effectiveOpacity() : 1; + if (useEleOpacity && (parentOpacity === 0 || ele.pstyle("text-opacity").value === 0)) { + return; + } + if (prefix === "main") { + prefix = null; + } + var textX = getPrefixedProperty(rscratch, "labelX", prefix); + var textY = getPrefixedProperty(rscratch, "labelY", prefix); + var orgTextX, orgTextY; + var text4 = this.getLabelText(ele, prefix); + if (text4 != null && text4 !== "" && !isNaN(textX) && !isNaN(textY)) { + this.setupTextStyle(context, ele, useEleOpacity); + var pdash = prefix ? prefix + "-" : ""; + var textW = getPrefixedProperty(rscratch, "labelWidth", prefix); + var textH = getPrefixedProperty(rscratch, "labelHeight", prefix); + var marginX = ele.pstyle(pdash + "text-margin-x").pfValue; + var marginY = ele.pstyle(pdash + "text-margin-y").pfValue; + var isEdge2 = ele.isEdge(); + var halign = ele.pstyle("text-halign").value; + var valign = ele.pstyle("text-valign").value; + if (isEdge2) { + halign = "center"; + valign = "center"; + } + textX += marginX; + textY += marginY; + var theta; + if (!applyRotation) { + theta = 0; + } else { + theta = this.getTextAngle(ele, prefix); + } + if (theta !== 0) { + orgTextX = textX; + orgTextY = textY; + context.translate(orgTextX, orgTextY); + context.rotate(theta); + textX = 0; + textY = 0; + } + switch (valign) { + case "top": + break; + case "center": + textY += textH / 2; + break; + case "bottom": + textY += textH; + break; + } + var backgroundOpacity = ele.pstyle("text-background-opacity").value; + var borderOpacity = ele.pstyle("text-border-opacity").value; + var textBorderWidth = ele.pstyle("text-border-width").pfValue; + var backgroundPadding = ele.pstyle("text-background-padding").pfValue; + var styleShape = ele.pstyle("text-background-shape").strValue; + var rounded = styleShape === "round-rectangle" || styleShape === "roundrectangle"; + var circled = styleShape === "circle"; + var roundRadius = 2; + if (backgroundOpacity > 0 || textBorderWidth > 0 && borderOpacity > 0) { + var textFill = context.fillStyle; + var textStroke = context.strokeStyle; + var textLineWidth = context.lineWidth; + var textBackgroundColor = ele.pstyle("text-background-color").value; + var textBorderColor = ele.pstyle("text-border-color").value; + var textBorderStyle = ele.pstyle("text-border-style").value; + var doFill = backgroundOpacity > 0; + var doStroke = textBorderWidth > 0 && borderOpacity > 0; + var bgX = textX - backgroundPadding; + switch (halign) { + case "left": + bgX -= textW; + break; + case "center": + bgX -= textW / 2; + break; + } + var bgY = textY - textH - backgroundPadding; + var bgW = textW + 2 * backgroundPadding; + var bgH = textH + 2 * backgroundPadding; + if (doFill) { + context.fillStyle = "rgba(".concat(textBackgroundColor[0], ",").concat(textBackgroundColor[1], ",").concat(textBackgroundColor[2], ",").concat(backgroundOpacity * parentOpacity, ")"); + } + if (doStroke) { + context.strokeStyle = "rgba(".concat(textBorderColor[0], ",").concat(textBorderColor[1], ",").concat(textBorderColor[2], ",").concat(borderOpacity * parentOpacity, ")"); + context.lineWidth = textBorderWidth; + if (context.setLineDash) { + switch (textBorderStyle) { + case "dotted": + context.setLineDash([1, 1]); + break; + case "dashed": + context.setLineDash([4, 2]); + break; + case "double": + context.lineWidth = textBorderWidth / 4; + context.setLineDash([]); + break; + case "solid": + default: + context.setLineDash([]); + break; + } + } + } + if (rounded) { + context.beginPath(); + roundRect(context, bgX, bgY, bgW, bgH, roundRadius); + } else if (circled) { + context.beginPath(); + circle3(context, bgX, bgY, bgW, bgH); + } else { + context.beginPath(); + context.rect(bgX, bgY, bgW, bgH); + } + if (doFill) context.fill(); + if (doStroke) context.stroke(); + if (doStroke && textBorderStyle === "double") { + var whiteWidth = textBorderWidth / 2; + context.beginPath(); + if (rounded) { + roundRect(context, bgX + whiteWidth, bgY + whiteWidth, bgW - 2 * whiteWidth, bgH - 2 * whiteWidth, roundRadius); + } else { + context.rect(bgX + whiteWidth, bgY + whiteWidth, bgW - 2 * whiteWidth, bgH - 2 * whiteWidth); + } + context.stroke(); + } + context.fillStyle = textFill; + context.strokeStyle = textStroke; + context.lineWidth = textLineWidth; + if (context.setLineDash) context.setLineDash([]); + } + var lineWidth = 2 * ele.pstyle("text-outline-width").pfValue; + if (lineWidth > 0) { + context.lineWidth = lineWidth; + } + if (ele.pstyle("text-wrap").value === "wrap") { + var lines = getPrefixedProperty(rscratch, "labelWrapCachedLines", prefix); + var lineHeight = getPrefixedProperty(rscratch, "labelLineHeight", prefix); + var halfTextW = textW / 2; + var justification = this.getLabelJustification(ele); + if (justification === "auto") ; + else if (halign === "left") { + if (justification === "left") { + textX += -textW; + } else if (justification === "center") { + textX += -halfTextW; + } + } else if (halign === "center") { + if (justification === "left") { + textX += -halfTextW; + } else if (justification === "right") { + textX += halfTextW; + } + } else if (halign === "right") { + if (justification === "center") { + textX += halfTextW; + } else if (justification === "right") { + textX += textW; + } + } + switch (valign) { + case "top": + textY -= (lines.length - 1) * lineHeight; + break; + case "center": + case "bottom": + textY -= (lines.length - 1) * lineHeight; + break; + } + for (var l4 = 0; l4 < lines.length; l4++) { + if (lineWidth > 0) { + context.strokeText(lines[l4], textX, textY); + } + context.fillText(lines[l4], textX, textY); + textY += lineHeight; + } + } else { + if (lineWidth > 0) { + context.strokeText(text4, textX, textY); + } + context.fillText(text4, textX, textY); + } + if (theta !== 0) { + context.rotate(-theta); + context.translate(-orgTextX, -orgTextY); + } + } + }; + CRp$6 = {}; + CRp$6.drawNode = function(context, node2, shiftToOriginWithBb) { + var drawLabel4 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true; + var shouldDrawOverlay = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true; + var shouldDrawOpacity = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true; + var r2 = this; + var nodeWidth, nodeHeight; + var _p = node2._private; + var rs = _p.rscratch; + var pos = node2.position(); + if (!number$1(pos.x) || !number$1(pos.y)) { + return; + } + if (shouldDrawOpacity && !node2.visible()) { + return; + } + var eleOpacity = shouldDrawOpacity ? node2.effectiveOpacity() : 1; + var usePaths = r2.usePaths(); + var path4; + var pathCacheHit = false; + var padding2 = node2.padding(); + nodeWidth = node2.width() + 2 * padding2; + nodeHeight = node2.height() + 2 * padding2; + var bb; + if (shiftToOriginWithBb) { + bb = shiftToOriginWithBb; + context.translate(-bb.x1, -bb.y1); + } + var bgImgProp = node2.pstyle("background-image"); + var urls = bgImgProp.value; + var urlDefined = new Array(urls.length); + var image = new Array(urls.length); + var numImages = 0; + for (var i2 = 0; i2 < urls.length; i2++) { + var url = urls[i2]; + var defd = urlDefined[i2] = url != null && url !== "none"; + if (defd) { + var bgImgCrossOrigin = node2.cy().style().getIndexedStyle(node2, "background-image-crossorigin", "value", i2); + numImages++; + image[i2] = r2.getCachedImage(url, bgImgCrossOrigin, function() { + _p.backgroundTimestamp = Date.now(); + node2.emitAndNotify("background"); + }); + } + } + var darkness = node2.pstyle("background-blacken").value; + var borderWidth = node2.pstyle("border-width").pfValue; + var bgOpacity = node2.pstyle("background-opacity").value * eleOpacity; + var borderColor = node2.pstyle("border-color").value; + var borderStyle = node2.pstyle("border-style").value; + var borderJoin = node2.pstyle("border-join").value; + var borderCap = node2.pstyle("border-cap").value; + var borderPosition = node2.pstyle("border-position").value; + var borderPattern = node2.pstyle("border-dash-pattern").pfValue; + var borderOffset = node2.pstyle("border-dash-offset").pfValue; + var borderOpacity = node2.pstyle("border-opacity").value * eleOpacity; + var outlineWidth = node2.pstyle("outline-width").pfValue; + var outlineColor = node2.pstyle("outline-color").value; + var outlineStyle = node2.pstyle("outline-style").value; + var outlineOpacity = node2.pstyle("outline-opacity").value * eleOpacity; + var outlineOffset = node2.pstyle("outline-offset").value; + var cornerRadius = node2.pstyle("corner-radius").value; + if (cornerRadius !== "auto") cornerRadius = node2.pstyle("corner-radius").pfValue; + var setupShapeColor = /* @__PURE__ */ __name(function setupShapeColor2() { + var bgOpy = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : bgOpacity; + r2.eleFillStyle(context, node2, bgOpy); + }, "setupShapeColor"); + var setupBorderColor = /* @__PURE__ */ __name(function setupBorderColor2() { + var bdrOpy = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : borderOpacity; + r2.colorStrokeStyle(context, borderColor[0], borderColor[1], borderColor[2], bdrOpy); + }, "setupBorderColor"); + var setupOutlineColor = /* @__PURE__ */ __name(function setupOutlineColor2() { + var otlnOpy = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : outlineOpacity; + r2.colorStrokeStyle(context, outlineColor[0], outlineColor[1], outlineColor[2], otlnOpy); + }, "setupOutlineColor"); + var getPath = /* @__PURE__ */ __name(function getPath2(width3, height2, shape, points) { + var pathCache = r2.nodePathCache = r2.nodePathCache || []; + var key = hashStrings(shape === "polygon" ? shape + "," + points.join(",") : shape, "" + height2, "" + width3, "" + cornerRadius); + var cachedPath = pathCache[key]; + var path5; + var cacheHit = false; + if (cachedPath != null) { + path5 = cachedPath; + cacheHit = true; + rs.pathCache = path5; + } else { + path5 = new Path2D(); + pathCache[key] = rs.pathCache = path5; + } + return { + path: path5, + cacheHit + }; + }, "getPath"); + var styleShape = node2.pstyle("shape").strValue; + var shapePts = node2.pstyle("shape-polygon-points").pfValue; + if (usePaths) { + context.translate(pos.x, pos.y); + var shapePath = getPath(nodeWidth, nodeHeight, styleShape, shapePts); + path4 = shapePath.path; + pathCacheHit = shapePath.cacheHit; + } + var drawShape = /* @__PURE__ */ __name(function drawShape2() { + if (!pathCacheHit) { + var npos = pos; + if (usePaths) { + npos = { + x: 0, + y: 0 + }; + } + r2.nodeShapes[r2.getNodeShape(node2)].draw(path4 || context, npos.x, npos.y, nodeWidth, nodeHeight, cornerRadius, rs); + } + if (usePaths) { + context.fill(path4); + } else { + context.fill(); + } + }, "drawShape"); + var drawImages = /* @__PURE__ */ __name(function drawImages2() { + var nodeOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : eleOpacity; + var inside = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; + var prevBging = _p.backgrounding; + var totalCompleted = 0; + for (var _i = 0; _i < image.length; _i++) { + var bgContainment = node2.cy().style().getIndexedStyle(node2, "background-image-containment", "value", _i); + if (inside && bgContainment === "over" || !inside && bgContainment === "inside") { + totalCompleted++; + continue; + } + if (urlDefined[_i] && image[_i].complete && !image[_i].error) { + totalCompleted++; + r2.drawInscribedImage(context, image[_i], node2, _i, nodeOpacity); + } + } + _p.backgrounding = !(totalCompleted === numImages); + if (prevBging !== _p.backgrounding) { + node2.updateStyle(false); + } + }, "drawImages"); + var drawPie = /* @__PURE__ */ __name(function drawPie2() { + var redrawShape = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; + var pieOpacity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : eleOpacity; + if (r2.hasPie(node2)) { + r2.drawPie(context, node2, pieOpacity); + if (redrawShape) { + if (!usePaths) { + r2.nodeShapes[r2.getNodeShape(node2)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight, cornerRadius, rs); + } + } + } + }, "drawPie"); + var drawStripe = /* @__PURE__ */ __name(function drawStripe2() { + var redrawShape = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false; + var stripeOpacity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : eleOpacity; + if (r2.hasStripe(node2)) { + context.save(); + if (usePaths) { + context.clip(rs.pathCache); + } else { + r2.nodeShapes[r2.getNodeShape(node2)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight, cornerRadius, rs); + context.clip(); + } + r2.drawStripe(context, node2, stripeOpacity); + context.restore(); + if (redrawShape) { + if (!usePaths) { + r2.nodeShapes[r2.getNodeShape(node2)].draw(context, pos.x, pos.y, nodeWidth, nodeHeight, cornerRadius, rs); + } + } + } + }, "drawStripe"); + var darken2 = /* @__PURE__ */ __name(function darken3() { + var darkenOpacity = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : eleOpacity; + var opacity = (darkness > 0 ? darkness : -darkness) * darkenOpacity; + var c3 = darkness > 0 ? 0 : 255; + if (darkness !== 0) { + r2.colorFillStyle(context, c3, c3, c3, opacity); + if (usePaths) { + context.fill(path4); + } else { + context.fill(); + } + } + }, "darken"); + var drawBorder = /* @__PURE__ */ __name(function drawBorder2() { + if (borderWidth > 0) { + context.lineWidth = borderWidth; + context.lineCap = borderCap; + context.lineJoin = borderJoin; + if (context.setLineDash) { + switch (borderStyle) { + case "dotted": + context.setLineDash([1, 1]); + break; + case "dashed": + context.setLineDash(borderPattern); + context.lineDashOffset = borderOffset; + break; + case "solid": + case "double": + context.setLineDash([]); + break; + } + } + if (borderPosition !== "center") { + context.save(); + context.lineWidth *= 2; + if (borderPosition === "inside") { + usePaths ? context.clip(path4) : context.clip(); + } else { + var region = new Path2D(); + region.rect(-nodeWidth / 2 - borderWidth, -nodeHeight / 2 - borderWidth, nodeWidth + 2 * borderWidth, nodeHeight + 2 * borderWidth); + region.addPath(path4); + context.clip(region, "evenodd"); + } + usePaths ? context.stroke(path4) : context.stroke(); + context.restore(); + } else { + usePaths ? context.stroke(path4) : context.stroke(); + } + if (borderStyle === "double") { + context.lineWidth = borderWidth / 3; + var gco = context.globalCompositeOperation; + context.globalCompositeOperation = "destination-out"; + if (usePaths) { + context.stroke(path4); + } else { + context.stroke(); + } + context.globalCompositeOperation = gco; + } + if (context.setLineDash) { + context.setLineDash([]); + } + } + }, "drawBorder"); + var drawOutline = /* @__PURE__ */ __name(function drawOutline2() { + if (outlineWidth > 0) { + context.lineWidth = outlineWidth; + context.lineCap = "butt"; + if (context.setLineDash) { + switch (outlineStyle) { + case "dotted": + context.setLineDash([1, 1]); + break; + case "dashed": + context.setLineDash([4, 2]); + break; + case "solid": + case "double": + context.setLineDash([]); + break; + } + } + var npos = pos; + if (usePaths) { + npos = { + x: 0, + y: 0 + }; + } + var shape = r2.getNodeShape(node2); + var bWidth = borderWidth; + if (borderPosition === "inside") bWidth = 0; + if (borderPosition === "outside") bWidth *= 2; + var scaleX = (nodeWidth + bWidth + (outlineWidth + outlineOffset)) / nodeWidth; + var scaleY = (nodeHeight + bWidth + (outlineWidth + outlineOffset)) / nodeHeight; + var sWidth = nodeWidth * scaleX; + var sHeight = nodeHeight * scaleY; + var points = r2.nodeShapes[shape].points; + var _path; + if (usePaths) { + var outlinePath = getPath(sWidth, sHeight, shape, points); + _path = outlinePath.path; + } + if (shape === "ellipse") { + r2.drawEllipsePath(_path || context, npos.x, npos.y, sWidth, sHeight); + } else if (["round-diamond", "round-heptagon", "round-hexagon", "round-octagon", "round-pentagon", "round-polygon", "round-triangle", "round-tag"].includes(shape)) { + var sMult = 0; + var offsetX = 0; + var offsetY = 0; + if (shape === "round-diamond") { + sMult = (bWidth + outlineOffset + outlineWidth) * 1.4; + } else if (shape === "round-heptagon") { + sMult = (bWidth + outlineOffset + outlineWidth) * 1.075; + offsetY = -(bWidth / 2 + outlineOffset + outlineWidth) / 35; + } else if (shape === "round-hexagon") { + sMult = (bWidth + outlineOffset + outlineWidth) * 1.12; + } else if (shape === "round-pentagon") { + sMult = (bWidth + outlineOffset + outlineWidth) * 1.13; + offsetY = -(bWidth / 2 + outlineOffset + outlineWidth) / 15; + } else if (shape === "round-tag") { + sMult = (bWidth + outlineOffset + outlineWidth) * 1.12; + offsetX = (bWidth / 2 + outlineWidth + outlineOffset) * 0.07; + } else if (shape === "round-triangle") { + sMult = (bWidth + outlineOffset + outlineWidth) * (Math.PI / 2); + offsetY = -(bWidth + outlineOffset / 2 + outlineWidth) / Math.PI; + } + if (sMult !== 0) { + scaleX = (nodeWidth + sMult) / nodeWidth; + sWidth = nodeWidth * scaleX; + if (!["round-hexagon", "round-tag"].includes(shape)) { + scaleY = (nodeHeight + sMult) / nodeHeight; + sHeight = nodeHeight * scaleY; + } + } + cornerRadius = cornerRadius === "auto" ? getRoundPolygonRadius(sWidth, sHeight) : cornerRadius; + var halfW = sWidth / 2; + var halfH = sHeight / 2; + var radius2 = cornerRadius + (bWidth + outlineWidth + outlineOffset) / 2; + var p3 = new Array(points.length / 2); + var corners = new Array(points.length / 2); + for (var _i2 = 0; _i2 < points.length / 2; _i2++) { + p3[_i2] = { + x: npos.x + offsetX + halfW * points[_i2 * 2], + y: npos.y + offsetY + halfH * points[_i2 * 2 + 1] + }; + } + var _i3, p1, p22, p32, len = p3.length; + p1 = p3[len - 1]; + for (_i3 = 0; _i3 < len; _i3++) { + p22 = p3[_i3 % len]; + p32 = p3[(_i3 + 1) % len]; + corners[_i3] = getRoundCorner(p1, p22, p32, radius2); + p1 = p22; + p22 = p32; + } + r2.drawRoundPolygonPath(_path || context, npos.x + offsetX, npos.y + offsetY, nodeWidth * scaleX, nodeHeight * scaleY, points, corners); + } else if (["roundrectangle", "round-rectangle"].includes(shape)) { + cornerRadius = cornerRadius === "auto" ? getRoundRectangleRadius(sWidth, sHeight) : cornerRadius; + r2.drawRoundRectanglePath(_path || context, npos.x, npos.y, sWidth, sHeight, cornerRadius + (bWidth + outlineWidth + outlineOffset) / 2); + } else if (["cutrectangle", "cut-rectangle"].includes(shape)) { + cornerRadius = cornerRadius === "auto" ? getCutRectangleCornerLength() : cornerRadius; + r2.drawCutRectanglePath(_path || context, npos.x, npos.y, sWidth, sHeight, null, cornerRadius + (bWidth + outlineWidth + outlineOffset) / 4); + } else if (["bottomroundrectangle", "bottom-round-rectangle"].includes(shape)) { + cornerRadius = cornerRadius === "auto" ? getRoundRectangleRadius(sWidth, sHeight) : cornerRadius; + r2.drawBottomRoundRectanglePath(_path || context, npos.x, npos.y, sWidth, sHeight, cornerRadius + (bWidth + outlineWidth + outlineOffset) / 2); + } else if (shape === "barrel") { + r2.drawBarrelPath(_path || context, npos.x, npos.y, sWidth, sHeight); + } else if (shape.startsWith("polygon") || ["rhomboid", "right-rhomboid", "round-tag", "tag", "vee"].includes(shape)) { + var pad3 = (bWidth + outlineWidth + outlineOffset) / nodeWidth; + points = joinLines(expandPolygon(points, pad3)); + r2.drawPolygonPath(_path || context, npos.x, npos.y, nodeWidth, nodeHeight, points); + } else { + var _pad = (bWidth + outlineWidth + outlineOffset) / nodeWidth; + points = joinLines(expandPolygon(points, -_pad)); + r2.drawPolygonPath(_path || context, npos.x, npos.y, nodeWidth, nodeHeight, points); + } + if (usePaths) { + context.stroke(_path); + } else { + context.stroke(); + } + if (outlineStyle === "double") { + context.lineWidth = bWidth / 3; + var gco = context.globalCompositeOperation; + context.globalCompositeOperation = "destination-out"; + if (usePaths) { + context.stroke(_path); + } else { + context.stroke(); + } + context.globalCompositeOperation = gco; + } + if (context.setLineDash) { + context.setLineDash([]); + } + } + }, "drawOutline"); + var drawOverlay = /* @__PURE__ */ __name(function drawOverlay2() { + if (shouldDrawOverlay) { + r2.drawNodeOverlay(context, node2, pos, nodeWidth, nodeHeight); + } + }, "drawOverlay"); + var drawUnderlay = /* @__PURE__ */ __name(function drawUnderlay2() { + if (shouldDrawOverlay) { + r2.drawNodeUnderlay(context, node2, pos, nodeWidth, nodeHeight); + } + }, "drawUnderlay"); + var drawText6 = /* @__PURE__ */ __name(function drawText7() { + r2.drawElementText(context, node2, null, drawLabel4); + }, "drawText"); + var ghost = node2.pstyle("ghost").value === "yes"; + if (ghost) { + var gx = node2.pstyle("ghost-offset-x").pfValue; + var gy = node2.pstyle("ghost-offset-y").pfValue; + var ghostOpacity = node2.pstyle("ghost-opacity").value; + var effGhostOpacity = ghostOpacity * eleOpacity; + context.translate(gx, gy); + setupOutlineColor(); + drawOutline(); + setupShapeColor(ghostOpacity * bgOpacity); + drawShape(); + drawImages(effGhostOpacity, true); + setupBorderColor(ghostOpacity * borderOpacity); + drawBorder(); + drawPie(darkness !== 0 || borderWidth !== 0); + drawStripe(darkness !== 0 || borderWidth !== 0); + drawImages(effGhostOpacity, false); + darken2(effGhostOpacity); + context.translate(-gx, -gy); + } + if (usePaths) { + context.translate(-pos.x, -pos.y); + } + drawUnderlay(); + if (usePaths) { + context.translate(pos.x, pos.y); + } + setupOutlineColor(); + drawOutline(); + setupShapeColor(); + drawShape(); + drawImages(eleOpacity, true); + setupBorderColor(); + drawBorder(); + drawPie(darkness !== 0 || borderWidth !== 0); + drawStripe(darkness !== 0 || borderWidth !== 0); + drawImages(eleOpacity, false); + darken2(); + if (usePaths) { + context.translate(-pos.x, -pos.y); + } + drawText6(); + drawOverlay(); + if (shiftToOriginWithBb) { + context.translate(bb.x1, bb.y1); + } + }; + drawNodeOverlayUnderlay = /* @__PURE__ */ __name(function drawNodeOverlayUnderlay2(overlayOrUnderlay) { + if (!["overlay", "underlay"].includes(overlayOrUnderlay)) { + throw new Error("Invalid state"); + } + return function(context, node2, pos, nodeWidth, nodeHeight) { + var r2 = this; + if (!node2.visible()) { + return; + } + var padding2 = node2.pstyle("".concat(overlayOrUnderlay, "-padding")).pfValue; + var opacity = node2.pstyle("".concat(overlayOrUnderlay, "-opacity")).value; + var color2 = node2.pstyle("".concat(overlayOrUnderlay, "-color")).value; + var shape = node2.pstyle("".concat(overlayOrUnderlay, "-shape")).value; + var radius2 = node2.pstyle("".concat(overlayOrUnderlay, "-corner-radius")).value; + if (opacity > 0) { + pos = pos || node2.position(); + if (nodeWidth == null || nodeHeight == null) { + var _padding = node2.padding(); + nodeWidth = node2.width() + 2 * _padding; + nodeHeight = node2.height() + 2 * _padding; + } + r2.colorFillStyle(context, color2[0], color2[1], color2[2], opacity); + r2.nodeShapes[shape].draw(context, pos.x, pos.y, nodeWidth + padding2 * 2, nodeHeight + padding2 * 2, radius2); + context.fill(); + } + }; + }, "drawNodeOverlayUnderlay"); + CRp$6.drawNodeOverlay = drawNodeOverlayUnderlay("overlay"); + CRp$6.drawNodeUnderlay = drawNodeOverlayUnderlay("underlay"); + CRp$6.hasPie = function(node2) { + node2 = node2[0]; + return node2._private.hasPie; + }; + CRp$6.hasStripe = function(node2) { + node2 = node2[0]; + return node2._private.hasStripe; + }; + CRp$6.drawPie = function(context, node2, nodeOpacity, pos) { + node2 = node2[0]; + pos = pos || node2.position(); + var cyStyle = node2.cy().style(); + var pieSize = node2.pstyle("pie-size"); + var hole = node2.pstyle("pie-hole"); + var overallStartAngle = node2.pstyle("pie-start-angle").pfValue; + var x5 = pos.x; + var y6 = pos.y; + var nodeW = node2.width(); + var nodeH = node2.height(); + var radius2 = Math.min(nodeW, nodeH) / 2; + var holeRadius; + var lastPercent = 0; + var usePaths = this.usePaths(); + if (usePaths) { + x5 = 0; + y6 = 0; + } + if (pieSize.units === "%") { + radius2 = radius2 * pieSize.pfValue; + } else if (pieSize.pfValue !== void 0) { + radius2 = pieSize.pfValue / 2; + } + if (hole.units === "%") { + holeRadius = radius2 * hole.pfValue; + } else if (hole.pfValue !== void 0) { + holeRadius = hole.pfValue / 2; + } + if (holeRadius >= radius2) { + return; + } + for (var i2 = 1; i2 <= cyStyle.pieBackgroundN; i2++) { + var size4 = node2.pstyle("pie-" + i2 + "-background-size").value; + var color2 = node2.pstyle("pie-" + i2 + "-background-color").value; + var opacity = node2.pstyle("pie-" + i2 + "-background-opacity").value * nodeOpacity; + var percent = size4 / 100; + if (percent + lastPercent > 1) { + percent = 1 - lastPercent; + } + var angleStart = 1.5 * Math.PI + 2 * Math.PI * lastPercent; + angleStart += overallStartAngle; + var angleDelta = 2 * Math.PI * percent; + var angleEnd = angleStart + angleDelta; + if (size4 === 0 || lastPercent >= 1 || lastPercent + percent > 1) { + continue; + } + if (holeRadius === 0) { + context.beginPath(); + context.moveTo(x5, y6); + context.arc(x5, y6, radius2, angleStart, angleEnd); + context.closePath(); + } else { + context.beginPath(); + context.arc(x5, y6, radius2, angleStart, angleEnd); + context.arc(x5, y6, holeRadius, angleEnd, angleStart, true); + context.closePath(); + } + this.colorFillStyle(context, color2[0], color2[1], color2[2], opacity); + context.fill(); + lastPercent += percent; + } + }; + CRp$6.drawStripe = function(context, node2, nodeOpacity, pos) { + node2 = node2[0]; + pos = pos || node2.position(); + var cyStyle = node2.cy().style(); + var x5 = pos.x; + var y6 = pos.y; + var nodeW = node2.width(); + var nodeH = node2.height(); + var lastPercent = 0; + var usePaths = this.usePaths(); + context.save(); + var direction2 = node2.pstyle("stripe-direction").value; + var stripeSize = node2.pstyle("stripe-size"); + switch (direction2) { + case "vertical": + break; + // default + case "righward": + context.rotate(-Math.PI / 2); + break; + } + var stripeW = nodeW; + var stripeH = nodeH; + if (stripeSize.units === "%") { + stripeW = stripeW * stripeSize.pfValue; + stripeH = stripeH * stripeSize.pfValue; + } else if (stripeSize.pfValue !== void 0) { + stripeW = stripeSize.pfValue; + stripeH = stripeSize.pfValue; + } + if (usePaths) { + x5 = 0; + y6 = 0; + } + y6 -= stripeW / 2; + x5 -= stripeH / 2; + for (var i2 = 1; i2 <= cyStyle.stripeBackgroundN; i2++) { + var size4 = node2.pstyle("stripe-" + i2 + "-background-size").value; + var color2 = node2.pstyle("stripe-" + i2 + "-background-color").value; + var opacity = node2.pstyle("stripe-" + i2 + "-background-opacity").value * nodeOpacity; + var percent = size4 / 100; + if (percent + lastPercent > 1) { + percent = 1 - lastPercent; + } + if (size4 === 0 || lastPercent >= 1 || lastPercent + percent > 1) { + continue; + } + context.beginPath(); + context.rect(x5, y6 + stripeH * lastPercent, stripeW, stripeH * percent); + context.closePath(); + this.colorFillStyle(context, color2[0], color2[1], color2[2], opacity); + context.fill(); + lastPercent += percent; + } + context.restore(); + }; + CRp$5 = {}; + motionBlurDelay = 100; + CRp$5.getPixelRatio = function() { + var context = this.data.contexts[0]; + if (this.forcedPixelRatio != null) { + return this.forcedPixelRatio; + } + var containerWindow = this.cy.window(); + var backingStore = context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1; + return (containerWindow.devicePixelRatio || 1) / backingStore; + }; + CRp$5.paintCache = function(context) { + var caches = this.paintCaches = this.paintCaches || []; + var needToCreateCache = true; + var cache3; + for (var i2 = 0; i2 < caches.length; i2++) { + cache3 = caches[i2]; + if (cache3.context === context) { + needToCreateCache = false; + break; + } + } + if (needToCreateCache) { + cache3 = { + context + }; + caches.push(cache3); + } + return cache3; + }; + CRp$5.createGradientStyleFor = function(context, shapeStyleName, ele, fill, opacity) { + var gradientStyle; + var usePaths = this.usePaths(); + var colors2 = ele.pstyle(shapeStyleName + "-gradient-stop-colors").value, positions2 = ele.pstyle(shapeStyleName + "-gradient-stop-positions").pfValue; + if (fill === "radial-gradient") { + if (ele.isEdge()) { + var start3 = ele.sourceEndpoint(), end2 = ele.targetEndpoint(), mid = ele.midpoint(); + var d1 = dist(start3, mid); + var d22 = dist(end2, mid); + gradientStyle = context.createRadialGradient(mid.x, mid.y, 0, mid.x, mid.y, Math.max(d1, d22)); + } else { + var pos = usePaths ? { + x: 0, + y: 0 + } : ele.position(), width3 = ele.paddedWidth(), height2 = ele.paddedHeight(); + gradientStyle = context.createRadialGradient(pos.x, pos.y, 0, pos.x, pos.y, Math.max(width3, height2)); + } + } else { + if (ele.isEdge()) { + var _start = ele.sourceEndpoint(), _end = ele.targetEndpoint(); + gradientStyle = context.createLinearGradient(_start.x, _start.y, _end.x, _end.y); + } else { + var _pos = usePaths ? { + x: 0, + y: 0 + } : ele.position(), _width = ele.paddedWidth(), _height = ele.paddedHeight(), halfWidth = _width / 2, halfHeight = _height / 2; + var direction2 = ele.pstyle("background-gradient-direction").value; + switch (direction2) { + case "to-bottom": + gradientStyle = context.createLinearGradient(_pos.x, _pos.y - halfHeight, _pos.x, _pos.y + halfHeight); + break; + case "to-top": + gradientStyle = context.createLinearGradient(_pos.x, _pos.y + halfHeight, _pos.x, _pos.y - halfHeight); + break; + case "to-left": + gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y, _pos.x - halfWidth, _pos.y); + break; + case "to-right": + gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y, _pos.x + halfWidth, _pos.y); + break; + case "to-bottom-right": + case "to-right-bottom": + gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y - halfHeight, _pos.x + halfWidth, _pos.y + halfHeight); + break; + case "to-top-right": + case "to-right-top": + gradientStyle = context.createLinearGradient(_pos.x - halfWidth, _pos.y + halfHeight, _pos.x + halfWidth, _pos.y - halfHeight); + break; + case "to-bottom-left": + case "to-left-bottom": + gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y - halfHeight, _pos.x - halfWidth, _pos.y + halfHeight); + break; + case "to-top-left": + case "to-left-top": + gradientStyle = context.createLinearGradient(_pos.x + halfWidth, _pos.y + halfHeight, _pos.x - halfWidth, _pos.y - halfHeight); + break; + } + } + } + if (!gradientStyle) return null; + var hasPositions = positions2.length === colors2.length; + var length2 = colors2.length; + for (var i2 = 0; i2 < length2; i2++) { + gradientStyle.addColorStop(hasPositions ? positions2[i2] : i2 / (length2 - 1), "rgba(" + colors2[i2][0] + "," + colors2[i2][1] + "," + colors2[i2][2] + "," + opacity + ")"); + } + return gradientStyle; + }; + CRp$5.gradientFillStyle = function(context, ele, fill, opacity) { + var gradientStyle = this.createGradientStyleFor(context, "background", ele, fill, opacity); + if (!gradientStyle) return null; + context.fillStyle = gradientStyle; + }; + CRp$5.colorFillStyle = function(context, r2, g2, b3, a2) { + context.fillStyle = "rgba(" + r2 + "," + g2 + "," + b3 + "," + a2 + ")"; + }; + CRp$5.eleFillStyle = function(context, ele, opacity) { + var backgroundFill = ele.pstyle("background-fill").value; + if (backgroundFill === "linear-gradient" || backgroundFill === "radial-gradient") { + this.gradientFillStyle(context, ele, backgroundFill, opacity); + } else { + var backgroundColor = ele.pstyle("background-color").value; + this.colorFillStyle(context, backgroundColor[0], backgroundColor[1], backgroundColor[2], opacity); + } + }; + CRp$5.gradientStrokeStyle = function(context, ele, fill, opacity) { + var gradientStyle = this.createGradientStyleFor(context, "line", ele, fill, opacity); + if (!gradientStyle) return null; + context.strokeStyle = gradientStyle; + }; + CRp$5.colorStrokeStyle = function(context, r2, g2, b3, a2) { + context.strokeStyle = "rgba(" + r2 + "," + g2 + "," + b3 + "," + a2 + ")"; + }; + CRp$5.eleStrokeStyle = function(context, ele, opacity) { + var lineFill = ele.pstyle("line-fill").value; + if (lineFill === "linear-gradient" || lineFill === "radial-gradient") { + this.gradientStrokeStyle(context, ele, lineFill, opacity); + } else { + var lineColor = ele.pstyle("line-color").value; + this.colorStrokeStyle(context, lineColor[0], lineColor[1], lineColor[2], opacity); + } + }; + CRp$5.matchCanvasSize = function(container2) { + var r2 = this; + var data5 = r2.data; + var bb = r2.findContainerClientCoords(); + var width3 = bb[2]; + var height2 = bb[3]; + var pixelRatio = r2.getPixelRatio(); + var mbPxRatio = r2.motionBlurPxRatio; + if (container2 === r2.data.bufferCanvases[r2.MOTIONBLUR_BUFFER_NODE] || container2 === r2.data.bufferCanvases[r2.MOTIONBLUR_BUFFER_DRAG]) { + pixelRatio = mbPxRatio; + } + var canvasWidth = width3 * pixelRatio; + var canvasHeight = height2 * pixelRatio; + var canvas; + if (canvasWidth === r2.canvasWidth && canvasHeight === r2.canvasHeight) { + return; + } + r2.fontCaches = null; + var canvasContainer = data5.canvasContainer; + canvasContainer.style.width = width3 + "px"; + canvasContainer.style.height = height2 + "px"; + for (var i2 = 0; i2 < r2.CANVAS_LAYERS; i2++) { + canvas = data5.canvases[i2]; + canvas.width = canvasWidth; + canvas.height = canvasHeight; + canvas.style.width = width3 + "px"; + canvas.style.height = height2 + "px"; + } + for (var i2 = 0; i2 < r2.BUFFER_COUNT; i2++) { + canvas = data5.bufferCanvases[i2]; + canvas.width = canvasWidth; + canvas.height = canvasHeight; + canvas.style.width = width3 + "px"; + canvas.style.height = height2 + "px"; + } + r2.textureMult = 1; + if (pixelRatio <= 1) { + canvas = data5.bufferCanvases[r2.TEXTURE_BUFFER]; + r2.textureMult = 2; + canvas.width = canvasWidth * r2.textureMult; + canvas.height = canvasHeight * r2.textureMult; + } + r2.canvasWidth = canvasWidth; + r2.canvasHeight = canvasHeight; + r2.pixelRatio = pixelRatio; + }; + CRp$5.renderTo = function(cxt, zoom2, pan2, pxRatio) { + this.render({ + forcedContext: cxt, + forcedZoom: zoom2, + forcedPan: pan2, + drawAllLayers: true, + forcedPxRatio: pxRatio + }); + }; + CRp$5.clearCanvas = function() { + var r2 = this; + var data5 = r2.data; + function clear22(context) { + context.clearRect(0, 0, r2.canvasWidth, r2.canvasHeight); + } + __name(clear22, "clear"); + clear22(data5.contexts[r2.NODE]); + clear22(data5.contexts[r2.DRAG]); + }; + CRp$5.render = function(options2) { + var r2 = this; + options2 = options2 || staticEmptyObject(); + var cy = r2.cy; + var forcedContext = options2.forcedContext; + var drawAllLayers = options2.drawAllLayers; + var drawOnlyNodeLayer = options2.drawOnlyNodeLayer; + var forcedZoom = options2.forcedZoom; + var forcedPan = options2.forcedPan; + var pixelRatio = options2.forcedPxRatio === void 0 ? this.getPixelRatio() : options2.forcedPxRatio; + var data5 = r2.data; + var needDraw = data5.canvasNeedsRedraw; + var textureDraw = r2.textureOnViewport && !forcedContext && (r2.pinching || r2.hoverData.dragging || r2.swipePanning || r2.data.wheelZooming); + var motionBlur = options2.motionBlur !== void 0 ? options2.motionBlur : r2.motionBlur; + var mbPxRatio = r2.motionBlurPxRatio; + var hasCompoundNodes2 = cy.hasCompoundNodes(); + var inNodeDragGesture = r2.hoverData.draggingEles; + var inBoxSelection = r2.hoverData.selecting || r2.touchData.selecting ? true : false; + motionBlur = motionBlur && !forcedContext && r2.motionBlurEnabled && !inBoxSelection; + var motionBlurFadeEffect = motionBlur; + if (!forcedContext) { + if (r2.prevPxRatio !== pixelRatio) { + r2.invalidateContainerClientCoordsCache(); + r2.matchCanvasSize(r2.container); + r2.redrawHint("eles", true); + r2.redrawHint("drag", true); + } + r2.prevPxRatio = pixelRatio; + } + if (!forcedContext && r2.motionBlurTimeout) { + clearTimeout(r2.motionBlurTimeout); + } + if (motionBlur) { + if (r2.mbFrames == null) { + r2.mbFrames = 0; + } + r2.mbFrames++; + if (r2.mbFrames < 3) { + motionBlurFadeEffect = false; + } + if (r2.mbFrames > r2.minMbLowQualFrames) { + r2.motionBlurPxRatio = r2.mbPxRBlurry; + } + } + if (r2.clearingMotionBlur) { + r2.motionBlurPxRatio = 1; + } + if (r2.textureDrawLastFrame && !textureDraw) { + needDraw[r2.NODE] = true; + needDraw[r2.SELECT_BOX] = true; + } + var style3 = cy.style(); + var zoom2 = cy.zoom(); + var effectiveZoom = forcedZoom !== void 0 ? forcedZoom : zoom2; + var pan2 = cy.pan(); + var effectivePan = { + x: pan2.x, + y: pan2.y + }; + var vp = { + zoom: zoom2, + pan: { + x: pan2.x, + y: pan2.y + } + }; + var prevVp = r2.prevViewport; + var viewportIsDiff = prevVp === void 0 || vp.zoom !== prevVp.zoom || vp.pan.x !== prevVp.pan.x || vp.pan.y !== prevVp.pan.y; + if (!viewportIsDiff && !(inNodeDragGesture && !hasCompoundNodes2)) { + r2.motionBlurPxRatio = 1; + } + if (forcedPan) { + effectivePan = forcedPan; + } + effectiveZoom *= pixelRatio; + effectivePan.x *= pixelRatio; + effectivePan.y *= pixelRatio; + var eles = r2.getCachedZSortedEles(); + function mbclear(context2, x5, y6, w4, h3) { + var gco = context2.globalCompositeOperation; + context2.globalCompositeOperation = "destination-out"; + r2.colorFillStyle(context2, 255, 255, 255, r2.motionBlurTransparency); + context2.fillRect(x5, y6, w4, h3); + context2.globalCompositeOperation = gco; + } + __name(mbclear, "mbclear"); + function setContextTransform2(context2, clear23) { + var ePan, eZoom, w4, h3; + if (!r2.clearingMotionBlur && (context2 === data5.bufferContexts[r2.MOTIONBLUR_BUFFER_NODE] || context2 === data5.bufferContexts[r2.MOTIONBLUR_BUFFER_DRAG])) { + ePan = { + x: pan2.x * mbPxRatio, + y: pan2.y * mbPxRatio + }; + eZoom = zoom2 * mbPxRatio; + w4 = r2.canvasWidth * mbPxRatio; + h3 = r2.canvasHeight * mbPxRatio; + } else { + ePan = effectivePan; + eZoom = effectiveZoom; + w4 = r2.canvasWidth; + h3 = r2.canvasHeight; + } + context2.setTransform(1, 0, 0, 1, 0, 0); + if (clear23 === "motionBlur") { + mbclear(context2, 0, 0, w4, h3); + } else if (!forcedContext && (clear23 === void 0 || clear23)) { + context2.clearRect(0, 0, w4, h3); + } + if (!drawAllLayers) { + context2.translate(ePan.x, ePan.y); + context2.scale(eZoom, eZoom); + } + if (forcedPan) { + context2.translate(forcedPan.x, forcedPan.y); + } + if (forcedZoom) { + context2.scale(forcedZoom, forcedZoom); + } + } + __name(setContextTransform2, "setContextTransform"); + if (!textureDraw) { + r2.textureDrawLastFrame = false; + } + if (textureDraw) { + r2.textureDrawLastFrame = true; + if (!r2.textureCache) { + r2.textureCache = {}; + r2.textureCache.bb = cy.mutableElements().boundingBox(); + r2.textureCache.texture = r2.data.bufferCanvases[r2.TEXTURE_BUFFER]; + var cxt = r2.data.bufferContexts[r2.TEXTURE_BUFFER]; + cxt.setTransform(1, 0, 0, 1, 0, 0); + cxt.clearRect(0, 0, r2.canvasWidth * r2.textureMult, r2.canvasHeight * r2.textureMult); + r2.render({ + forcedContext: cxt, + drawOnlyNodeLayer: true, + forcedPxRatio: pixelRatio * r2.textureMult + }); + var vp = r2.textureCache.viewport = { + zoom: cy.zoom(), + pan: cy.pan(), + width: r2.canvasWidth, + height: r2.canvasHeight + }; + vp.mpan = { + x: (0 - vp.pan.x) / vp.zoom, + y: (0 - vp.pan.y) / vp.zoom + }; + } + needDraw[r2.DRAG] = false; + needDraw[r2.NODE] = false; + var context = data5.contexts[r2.NODE]; + var texture = r2.textureCache.texture; + var vp = r2.textureCache.viewport; + context.setTransform(1, 0, 0, 1, 0, 0); + if (motionBlur) { + mbclear(context, 0, 0, vp.width, vp.height); + } else { + context.clearRect(0, 0, vp.width, vp.height); + } + var outsideBgColor = style3.core("outside-texture-bg-color").value; + var outsideBgOpacity = style3.core("outside-texture-bg-opacity").value; + r2.colorFillStyle(context, outsideBgColor[0], outsideBgColor[1], outsideBgColor[2], outsideBgOpacity); + context.fillRect(0, 0, vp.width, vp.height); + var zoom2 = cy.zoom(); + setContextTransform2(context, false); + context.clearRect(vp.mpan.x, vp.mpan.y, vp.width / vp.zoom / pixelRatio, vp.height / vp.zoom / pixelRatio); + context.drawImage(texture, vp.mpan.x, vp.mpan.y, vp.width / vp.zoom / pixelRatio, vp.height / vp.zoom / pixelRatio); + } else if (r2.textureOnViewport && !forcedContext) { + r2.textureCache = null; + } + var extent2 = cy.extent(); + var vpManip = r2.pinching || r2.hoverData.dragging || r2.swipePanning || r2.data.wheelZooming || r2.hoverData.draggingEles || r2.cy.animated(); + var hideEdges = r2.hideEdgesOnViewport && vpManip; + var needMbClear = []; + needMbClear[r2.NODE] = !needDraw[r2.NODE] && motionBlur && !r2.clearedForMotionBlur[r2.NODE] || r2.clearingMotionBlur; + if (needMbClear[r2.NODE]) { + r2.clearedForMotionBlur[r2.NODE] = true; + } + needMbClear[r2.DRAG] = !needDraw[r2.DRAG] && motionBlur && !r2.clearedForMotionBlur[r2.DRAG] || r2.clearingMotionBlur; + if (needMbClear[r2.DRAG]) { + r2.clearedForMotionBlur[r2.DRAG] = true; + } + if (needDraw[r2.NODE] || drawAllLayers || drawOnlyNodeLayer || needMbClear[r2.NODE]) { + var useBuffer = motionBlur && !needMbClear[r2.NODE] && mbPxRatio !== 1; + var context = forcedContext || (useBuffer ? r2.data.bufferContexts[r2.MOTIONBLUR_BUFFER_NODE] : data5.contexts[r2.NODE]); + var clear22 = motionBlur && !useBuffer ? "motionBlur" : void 0; + setContextTransform2(context, clear22); + if (hideEdges) { + r2.drawCachedNodes(context, eles.nondrag, pixelRatio, extent2); + } else { + r2.drawLayeredElements(context, eles.nondrag, pixelRatio, extent2); + } + if (r2.debug) { + r2.drawDebugPoints(context, eles.nondrag); + } + if (!drawAllLayers && !motionBlur) { + needDraw[r2.NODE] = false; + } + } + if (!drawOnlyNodeLayer && (needDraw[r2.DRAG] || drawAllLayers || needMbClear[r2.DRAG])) { + var useBuffer = motionBlur && !needMbClear[r2.DRAG] && mbPxRatio !== 1; + var context = forcedContext || (useBuffer ? r2.data.bufferContexts[r2.MOTIONBLUR_BUFFER_DRAG] : data5.contexts[r2.DRAG]); + setContextTransform2(context, motionBlur && !useBuffer ? "motionBlur" : void 0); + if (hideEdges) { + r2.drawCachedNodes(context, eles.drag, pixelRatio, extent2); + } else { + r2.drawCachedElements(context, eles.drag, pixelRatio, extent2); + } + if (r2.debug) { + r2.drawDebugPoints(context, eles.drag); + } + if (!drawAllLayers && !motionBlur) { + needDraw[r2.DRAG] = false; + } + } + this.drawSelectionRectangle(options2, setContextTransform2); + if (motionBlur && mbPxRatio !== 1) { + var cxtNode = data5.contexts[r2.NODE]; + var txtNode = r2.data.bufferCanvases[r2.MOTIONBLUR_BUFFER_NODE]; + var cxtDrag = data5.contexts[r2.DRAG]; + var txtDrag = r2.data.bufferCanvases[r2.MOTIONBLUR_BUFFER_DRAG]; + var drawMotionBlur = /* @__PURE__ */ __name(function drawMotionBlur2(cxt2, txt, needClear) { + cxt2.setTransform(1, 0, 0, 1, 0, 0); + if (needClear || !motionBlurFadeEffect) { + cxt2.clearRect(0, 0, r2.canvasWidth, r2.canvasHeight); + } else { + mbclear(cxt2, 0, 0, r2.canvasWidth, r2.canvasHeight); + } + var pxr = mbPxRatio; + cxt2.drawImage( + txt, + // img + 0, + 0, + // sx, sy + r2.canvasWidth * pxr, + r2.canvasHeight * pxr, + // sw, sh + 0, + 0, + // x, y + r2.canvasWidth, + r2.canvasHeight + // w, h + ); + }, "drawMotionBlur"); + if (needDraw[r2.NODE] || needMbClear[r2.NODE]) { + drawMotionBlur(cxtNode, txtNode, needMbClear[r2.NODE]); + needDraw[r2.NODE] = false; + } + if (needDraw[r2.DRAG] || needMbClear[r2.DRAG]) { + drawMotionBlur(cxtDrag, txtDrag, needMbClear[r2.DRAG]); + needDraw[r2.DRAG] = false; + } + } + r2.prevViewport = vp; + if (r2.clearingMotionBlur) { + r2.clearingMotionBlur = false; + r2.motionBlurCleared = true; + r2.motionBlur = true; + } + if (motionBlur) { + r2.motionBlurTimeout = setTimeout(function() { + r2.motionBlurTimeout = null; + r2.clearedForMotionBlur[r2.NODE] = false; + r2.clearedForMotionBlur[r2.DRAG] = false; + r2.motionBlur = false; + r2.clearingMotionBlur = !textureDraw; + r2.mbFrames = 0; + needDraw[r2.NODE] = true; + needDraw[r2.DRAG] = true; + r2.redraw(); + }, motionBlurDelay); + } + if (!forcedContext) { + cy.emit("render"); + } + }; + CRp$5.drawSelectionRectangle = function(options2, setContextTransform2) { + var r2 = this; + var cy = r2.cy; + var data5 = r2.data; + var style3 = cy.style(); + var drawOnlyNodeLayer = options2.drawOnlyNodeLayer; + var drawAllLayers = options2.drawAllLayers; + var needDraw = data5.canvasNeedsRedraw; + var forcedContext = options2.forcedContext; + if (r2.showFps || !drawOnlyNodeLayer && needDraw[r2.SELECT_BOX] && !drawAllLayers) { + var context = forcedContext || data5.contexts[r2.SELECT_BOX]; + setContextTransform2(context); + if (r2.selection[4] == 1 && (r2.hoverData.selecting || r2.touchData.selecting)) { + var zoom2 = r2.cy.zoom(); + var borderWidth = style3.core("selection-box-border-width").value / zoom2; + context.lineWidth = borderWidth; + context.fillStyle = "rgba(" + style3.core("selection-box-color").value[0] + "," + style3.core("selection-box-color").value[1] + "," + style3.core("selection-box-color").value[2] + "," + style3.core("selection-box-opacity").value + ")"; + context.fillRect(r2.selection[0], r2.selection[1], r2.selection[2] - r2.selection[0], r2.selection[3] - r2.selection[1]); + if (borderWidth > 0) { + context.strokeStyle = "rgba(" + style3.core("selection-box-border-color").value[0] + "," + style3.core("selection-box-border-color").value[1] + "," + style3.core("selection-box-border-color").value[2] + "," + style3.core("selection-box-opacity").value + ")"; + context.strokeRect(r2.selection[0], r2.selection[1], r2.selection[2] - r2.selection[0], r2.selection[3] - r2.selection[1]); + } + } + if (data5.bgActivePosistion && !r2.hoverData.selecting) { + var zoom2 = r2.cy.zoom(); + var pos = data5.bgActivePosistion; + context.fillStyle = "rgba(" + style3.core("active-bg-color").value[0] + "," + style3.core("active-bg-color").value[1] + "," + style3.core("active-bg-color").value[2] + "," + style3.core("active-bg-opacity").value + ")"; + context.beginPath(); + context.arc(pos.x, pos.y, style3.core("active-bg-size").pfValue / zoom2, 0, 2 * Math.PI); + context.fill(); + } + var timeToRender = r2.lastRedrawTime; + if (r2.showFps && timeToRender) { + timeToRender = Math.round(timeToRender); + var fps = Math.round(1e3 / timeToRender); + var text4 = "1 frame = " + timeToRender + " ms = " + fps + " fps"; + context.setTransform(1, 0, 0, 1, 0, 0); + context.fillStyle = "rgba(255, 0, 0, 0.75)"; + context.strokeStyle = "rgba(255, 0, 0, 0.75)"; + context.font = "30px Arial"; + if (!fpsHeight) { + var dims = context.measureText(text4); + fpsHeight = dims.actualBoundingBoxAscent; + } + context.fillText(text4, 0, fpsHeight); + var maxFps = 60; + context.strokeRect(0, fpsHeight + 10, 250, 20); + context.fillRect(0, fpsHeight + 10, 250 * Math.min(fps / maxFps, 1), 20); + } + if (!drawAllLayers) { + needDraw[r2.SELECT_BOX] = false; + } + } + }; + __name(compileShader, "compileShader"); + __name(createProgram, "createProgram"); + __name(createTextureCanvas, "createTextureCanvas"); + __name(getEffectivePanZoom, "getEffectivePanZoom"); + __name(getEffectiveZoom, "getEffectiveZoom"); + __name(modelToRenderedPosition2, "modelToRenderedPosition"); + __name(isSimpleShape, "isSimpleShape"); + __name(arrayEqual, "arrayEqual"); + __name(toWebGLColor, "toWebGLColor"); + __name(indexToVec4, "indexToVec4"); + __name(vec4ToIndex, "vec4ToIndex"); + __name(createTexture, "createTexture"); + __name(getTypeInfo, "getTypeInfo"); + __name(createTypedArray, "createTypedArray"); + __name(createTypedArrayView, "createTypedArrayView"); + __name(createBufferStaticDraw, "createBufferStaticDraw"); + __name(createBufferDynamicDraw, "createBufferDynamicDraw"); + __name(create3x3MatrixBufferDynamicDraw, "create3x3MatrixBufferDynamicDraw"); + __name(createPickingFrameBuffer, "createPickingFrameBuffer"); + ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; + if (!Math.hypot) Math.hypot = function() { + var y6 = 0, i2 = arguments.length; + while (i2--) { + y6 += arguments[i2] * arguments[i2]; + } + return Math.sqrt(y6); + }; + __name(create3, "create"); + __name(identity6, "identity"); + __name(multiply, "multiply"); + __name(translate, "translate"); + __name(rotate, "rotate"); + __name(scale, "scale"); + __name(projection, "projection"); + Atlas = /* @__PURE__ */ (function() { + function Atlas2(r2, texSize, texRows, createTextureCanvas2) { + _classCallCheck(this, Atlas2); + this.debugID = Math.floor(Math.random() * 1e4); + this.r = r2; + this.texSize = texSize; + this.texRows = texRows; + this.texHeight = Math.floor(texSize / texRows); + this.enableWrapping = true; + this.locked = false; + this.texture = null; + this.needsBuffer = true; + this.freePointer = { + x: 0, + row: 0 + }; + this.keyToLocation = /* @__PURE__ */ new Map(); + this.canvas = createTextureCanvas2(r2, texSize, texSize); + this.scratch = createTextureCanvas2(r2, texSize, this.texHeight, "scratch"); + } + __name(Atlas2, "Atlas"); + return _createClass(Atlas2, [{ + key: "lock", + value: /* @__PURE__ */ __name(function lock() { + this.locked = true; + }, "lock") + }, { + key: "getKeys", + value: /* @__PURE__ */ __name(function getKeys() { + return new Set(this.keyToLocation.keys()); + }, "getKeys") + }, { + key: "getScale", + value: /* @__PURE__ */ __name(function getScale(_ref) { + var w4 = _ref.w, h3 = _ref.h; + var texHeight = this.texHeight, maxTexWidth = this.texSize; + var scale3 = texHeight / h3; + var texW = w4 * scale3; + var texH = h3 * scale3; + if (texW > maxTexWidth) { + scale3 = maxTexWidth / w4; + texW = w4 * scale3; + texH = h3 * scale3; + } + return { + scale: scale3, + texW, + texH + }; + }, "getScale") + }, { + key: "draw", + value: /* @__PURE__ */ __name(function draw32(key, bb, doDrawing) { + var _this = this; + if (this.locked) throw new Error("can't draw, atlas is locked"); + var texSize = this.texSize, texRows = this.texRows, texHeight = this.texHeight; + var _this$getScale = this.getScale(bb), scale3 = _this$getScale.scale, texW = _this$getScale.texW, texH = _this$getScale.texH; + var drawAt = /* @__PURE__ */ __name(function drawAt2(location, canvas) { + if (doDrawing && canvas) { + var context = canvas.context; + var x5 = location.x, row = location.row; + var xOffset = x5; + var yOffset = texHeight * row; + context.save(); + context.translate(xOffset, yOffset); + context.scale(scale3, scale3); + doDrawing(context, bb); + context.restore(); + } + }, "drawAt"); + var locations = [null, null]; + var drawNormal = /* @__PURE__ */ __name(function drawNormal2() { + drawAt(_this.freePointer, _this.canvas); + locations[0] = { + x: _this.freePointer.x, + y: _this.freePointer.row * texHeight, + w: texW, + h: texH + }; + locations[1] = { + // create a second location with a width of 0, for convenience + x: _this.freePointer.x + texW, + y: _this.freePointer.row * texHeight, + w: 0, + h: texH + }; + _this.freePointer.x += texW; + if (_this.freePointer.x == texSize) { + _this.freePointer.x = 0; + _this.freePointer.row++; + } + }, "drawNormal"); + var drawWrapped = /* @__PURE__ */ __name(function drawWrapped2() { + var scratch = _this.scratch, canvas = _this.canvas; + scratch.clear(); + drawAt({ + x: 0, + row: 0 + }, scratch); + var firstTexW = texSize - _this.freePointer.x; + var secondTexW = texW - firstTexW; + var h3 = texHeight; + { + var dx = _this.freePointer.x; + var dy = _this.freePointer.row * texHeight; + var w4 = firstTexW; + canvas.context.drawImage(scratch, 0, 0, w4, h3, dx, dy, w4, h3); + locations[0] = { + x: dx, + y: dy, + w: w4, + h: texH + }; + } + { + var sx = firstTexW; + var _dy = (_this.freePointer.row + 1) * texHeight; + var _w = secondTexW; + if (canvas) { + canvas.context.drawImage(scratch, sx, 0, _w, h3, 0, _dy, _w, h3); + } + locations[1] = { + x: 0, + y: _dy, + w: _w, + h: texH + }; + } + _this.freePointer.x = secondTexW; + _this.freePointer.row++; + }, "drawWrapped"); + var moveToStartOfNextRow = /* @__PURE__ */ __name(function moveToStartOfNextRow2() { + _this.freePointer.x = 0; + _this.freePointer.row++; + }, "moveToStartOfNextRow"); + if (this.freePointer.x + texW <= texSize) { + drawNormal(); + } else if (this.freePointer.row >= texRows - 1) { + return false; + } else if (this.freePointer.x === texSize) { + moveToStartOfNextRow(); + drawNormal(); + } else if (this.enableWrapping) { + drawWrapped(); + } else { + moveToStartOfNextRow(); + drawNormal(); + } + this.keyToLocation.set(key, locations); + this.needsBuffer = true; + return locations; + }, "draw") + }, { + key: "getOffsets", + value: /* @__PURE__ */ __name(function getOffsets(key) { + return this.keyToLocation.get(key); + }, "getOffsets") + }, { + key: "isEmpty", + value: /* @__PURE__ */ __name(function isEmpty4() { + return this.freePointer.x === 0 && this.freePointer.row === 0; + }, "isEmpty") + }, { + key: "canFit", + value: /* @__PURE__ */ __name(function canFit(bb) { + if (this.locked) return false; + var texSize = this.texSize, texRows = this.texRows; + var _this$getScale2 = this.getScale(bb), texW = _this$getScale2.texW; + if (this.freePointer.x + texW > texSize) { + return this.freePointer.row < texRows - 1; + } + return true; + }, "canFit") + // called on every frame + }, { + key: "bufferIfNeeded", + value: /* @__PURE__ */ __name(function bufferIfNeeded(gl) { + if (!this.texture) { + this.texture = createTexture(gl, this.debugID); + } + if (this.needsBuffer) { + this.texture.buffer(this.canvas); + this.needsBuffer = false; + if (this.locked) { + this.canvas = null; + this.scratch = null; + } + } + }, "bufferIfNeeded") + }, { + key: "dispose", + value: /* @__PURE__ */ __name(function dispose() { + if (this.texture) { + this.texture.deleteTexture(); + this.texture = null; + } + this.canvas = null; + this.scratch = null; + this.locked = true; + }, "dispose") + }]); + })(); + AtlasCollection = /* @__PURE__ */ (function() { + function AtlasCollection2(r2, texSize, texRows, createTextureCanvas2) { + _classCallCheck(this, AtlasCollection2); + this.r = r2; + this.texSize = texSize; + this.texRows = texRows; + this.createTextureCanvas = createTextureCanvas2; + this.atlases = []; + this.styleKeyToAtlas = /* @__PURE__ */ new Map(); + this.markedKeys = /* @__PURE__ */ new Set(); + } + __name(AtlasCollection2, "AtlasCollection"); + return _createClass(AtlasCollection2, [{ + key: "getKeys", + value: /* @__PURE__ */ __name(function getKeys() { + return new Set(this.styleKeyToAtlas.keys()); + }, "getKeys") + }, { + key: "_createAtlas", + value: /* @__PURE__ */ __name(function _createAtlas() { + var r2 = this.r, texSize = this.texSize, texRows = this.texRows, createTextureCanvas2 = this.createTextureCanvas; + return new Atlas(r2, texSize, texRows, createTextureCanvas2); + }, "_createAtlas") + }, { + key: "_getScratchCanvas", + value: /* @__PURE__ */ __name(function _getScratchCanvas() { + if (!this.scratch) { + var r2 = this.r, texSize = this.texSize, texRows = this.texRows, createTextureCanvas2 = this.createTextureCanvas; + var texHeight = Math.floor(texSize / texRows); + this.scratch = createTextureCanvas2(r2, texSize, texHeight, "scratch"); + } + return this.scratch; + }, "_getScratchCanvas") + }, { + key: "draw", + value: /* @__PURE__ */ __name(function draw32(key, bb, doDrawing) { + var atlas = this.styleKeyToAtlas.get(key); + if (!atlas) { + atlas = this.atlases[this.atlases.length - 1]; + if (!atlas || !atlas.canFit(bb)) { + if (atlas) atlas.lock(); + atlas = this._createAtlas(); + this.atlases.push(atlas); + } + atlas.draw(key, bb, doDrawing); + this.styleKeyToAtlas.set(key, atlas); + } + return atlas; + }, "draw") + }, { + key: "getAtlas", + value: /* @__PURE__ */ __name(function getAtlas(key) { + return this.styleKeyToAtlas.get(key); + }, "getAtlas") + }, { + key: "hasAtlas", + value: /* @__PURE__ */ __name(function hasAtlas(key) { + return this.styleKeyToAtlas.has(key); + }, "hasAtlas") + }, { + key: "markKeyForGC", + value: /* @__PURE__ */ __name(function markKeyForGC(key) { + this.markedKeys.add(key); + }, "markKeyForGC") + }, { + key: "gc", + value: /* @__PURE__ */ __name(function gc2() { + var _this2 = this; + var markedKeys = this.markedKeys; + if (markedKeys.size === 0) { + console.log("nothing to garbage collect"); + return; + } + var newAtlases = []; + var newStyleKeyToAtlas = /* @__PURE__ */ new Map(); + var newAtlas = null; + var _iterator = _createForOfIteratorHelper(this.atlases), _step; + try { + var _loop = /* @__PURE__ */ __name(function _loop2() { + var atlas = _step.value; + var keys3 = atlas.getKeys(); + var keysToCollect = intersection2(markedKeys, keys3); + if (keysToCollect.size === 0) { + newAtlases.push(atlas); + keys3.forEach(function(k2) { + return newStyleKeyToAtlas.set(k2, atlas); + }); + return 1; + } + if (!newAtlas) { + newAtlas = _this2._createAtlas(); + newAtlases.push(newAtlas); + } + var _iterator2 = _createForOfIteratorHelper(keys3), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var key = _step2.value; + if (!keysToCollect.has(key)) { + var _atlas$getOffsets = atlas.getOffsets(key), _atlas$getOffsets2 = _slicedToArray(_atlas$getOffsets, 2), s1 = _atlas$getOffsets2[0], s2 = _atlas$getOffsets2[1]; + if (!newAtlas.canFit({ + w: s1.w + s2.w, + h: s1.h + })) { + newAtlas.lock(); + newAtlas = _this2._createAtlas(); + newAtlases.push(newAtlas); + } + if (atlas.canvas) { + _this2._copyTextureToNewAtlas(key, atlas, newAtlas); + newStyleKeyToAtlas.set(key, newAtlas); + } + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + atlas.dispose(); + }, "_loop"); + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + if (_loop()) continue; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + this.atlases = newAtlases; + this.styleKeyToAtlas = newStyleKeyToAtlas; + this.markedKeys = /* @__PURE__ */ new Set(); + }, "gc") + }, { + key: "_copyTextureToNewAtlas", + value: /* @__PURE__ */ __name(function _copyTextureToNewAtlas(key, oldAtlas, newAtlas) { + var _oldAtlas$getOffsets = oldAtlas.getOffsets(key), _oldAtlas$getOffsets2 = _slicedToArray(_oldAtlas$getOffsets, 2), s1 = _oldAtlas$getOffsets2[0], s2 = _oldAtlas$getOffsets2[1]; + if (s2.w === 0) { + newAtlas.draw(key, s1, function(context) { + context.drawImage(oldAtlas.canvas, s1.x, s1.y, s1.w, s1.h, 0, 0, s1.w, s1.h); + }); + } else { + var scratch = this._getScratchCanvas(); + scratch.clear(); + scratch.context.drawImage(oldAtlas.canvas, s1.x, s1.y, s1.w, s1.h, 0, 0, s1.w, s1.h); + scratch.context.drawImage(oldAtlas.canvas, s2.x, s2.y, s2.w, s2.h, s1.w, 0, s2.w, s2.h); + var w4 = s1.w + s2.w; + var h3 = s1.h; + newAtlas.draw(key, { + w: w4, + h: h3 + }, function(context) { + context.drawImage( + scratch, + 0, + 0, + w4, + h3, + 0, + 0, + w4, + h3 + // the destination context has already been translated to the correct position + ); + }); + } + }, "_copyTextureToNewAtlas") + }, { + key: "getCounts", + value: /* @__PURE__ */ __name(function getCounts() { + return { + keyCount: this.styleKeyToAtlas.size, + atlasCount: new Set(this.styleKeyToAtlas.values()).size + }; + }, "getCounts") + }]); + })(); + __name(intersection2, "intersection"); + AtlasManager = /* @__PURE__ */ (function() { + function AtlasManager2(r2, globalOptions) { + _classCallCheck(this, AtlasManager2); + this.r = r2; + this.globalOptions = globalOptions; + this.atlasSize = globalOptions.webglTexSize; + this.maxAtlasesPerBatch = globalOptions.webglTexPerBatch; + this.renderTypes = /* @__PURE__ */ new Map(); + this.collections = /* @__PURE__ */ new Map(); + this.typeAndIdToKey = /* @__PURE__ */ new Map(); + } + __name(AtlasManager2, "AtlasManager"); + return _createClass(AtlasManager2, [{ + key: "getAtlasSize", + value: /* @__PURE__ */ __name(function getAtlasSize() { + return this.atlasSize; + }, "getAtlasSize") + }, { + key: "addAtlasCollection", + value: /* @__PURE__ */ __name(function addAtlasCollection(collectionName, atlasCollectionOptions) { + var _this$globalOptions = this.globalOptions, webglTexSize = _this$globalOptions.webglTexSize, createTextureCanvas2 = _this$globalOptions.createTextureCanvas; + var texRows = atlasCollectionOptions.texRows; + var cachedCreateTextureCanvas = this._cacheScratchCanvas(createTextureCanvas2); + var atlasCollection = new AtlasCollection(this.r, webglTexSize, texRows, cachedCreateTextureCanvas); + this.collections.set(collectionName, atlasCollection); + }, "addAtlasCollection") + }, { + key: "addRenderType", + value: /* @__PURE__ */ __name(function addRenderType(type3, renderTypeOptions) { + var collection4 = renderTypeOptions.collection; + if (!this.collections.has(collection4)) throw new Error("invalid atlas collection name '".concat(collection4, "'")); + var atlasCollection = this.collections.get(collection4); + var opts = extend4({ + type: type3, + atlasCollection + }, renderTypeOptions); + this.renderTypes.set(type3, opts); + }, "addRenderType") + }, { + key: "getRenderTypeOpts", + value: /* @__PURE__ */ __name(function getRenderTypeOpts(type3) { + return this.renderTypes.get(type3); + }, "getRenderTypeOpts") + }, { + key: "getAtlasCollection", + value: /* @__PURE__ */ __name(function getAtlasCollection(name) { + return this.collections.get(name); + }, "getAtlasCollection") + }, { + key: "_cacheScratchCanvas", + value: /* @__PURE__ */ __name(function _cacheScratchCanvas(createTextureCanvas2) { + var prevW = -1; + var prevH = -1; + var scratchCanvas = null; + return function(r2, w4, h3, scratch) { + if (scratch) { + if (!scratchCanvas || w4 != prevW || h3 != prevH) { + prevW = w4; + prevH = h3; + scratchCanvas = createTextureCanvas2(r2, w4, h3); + } + return scratchCanvas; + } else { + return createTextureCanvas2(r2, w4, h3); + } + }; + }, "_cacheScratchCanvas") + }, { + key: "_key", + value: /* @__PURE__ */ __name(function _key(renderType, id35) { + return "".concat(renderType, "-").concat(id35); + }, "_key") + /** Marks textues associated with the element for garbage collection. */ + }, { + key: "invalidate", + value: /* @__PURE__ */ __name(function invalidate(eles) { + var _this3 = this; + var _ref2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref2$forceRedraw = _ref2.forceRedraw, forceRedraw = _ref2$forceRedraw === void 0 ? false : _ref2$forceRedraw, _ref2$filterEle = _ref2.filterEle, filterEle = _ref2$filterEle === void 0 ? function() { + return true; + } : _ref2$filterEle, _ref2$filterType = _ref2.filterType, filterType = _ref2$filterType === void 0 ? function() { + return true; + } : _ref2$filterType; + var needGC = false; + var runGCNow = false; + var _iterator3 = _createForOfIteratorHelper(eles), _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { + var ele = _step3.value; + if (filterEle(ele)) { + var _iterator4 = _createForOfIteratorHelper(this.renderTypes.values()), _step4; + try { + var _loop2 = /* @__PURE__ */ __name(function _loop22() { + var opts = _step4.value; + var renderType = opts.type; + if (filterType(renderType)) { + var atlasCollection = _this3.collections.get(opts.collection); + var key = opts.getKey(ele); + var keyArray = Array.isArray(key) ? key : [key]; + if (forceRedraw) { + keyArray.forEach(function(key2) { + return atlasCollection.markKeyForGC(key2); + }); + runGCNow = true; + } else { + var id35 = opts.getID ? opts.getID(ele) : ele.id(); + var mapKey = _this3._key(renderType, id35); + var oldKeyArray = _this3.typeAndIdToKey.get(mapKey); + if (oldKeyArray !== void 0 && !arrayEqual(keyArray, oldKeyArray)) { + needGC = true; + _this3.typeAndIdToKey["delete"](mapKey); + oldKeyArray.forEach(function(oldKey) { + return atlasCollection.markKeyForGC(oldKey); + }); + } + } + } + }, "_loop2"); + for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) { + _loop2(); + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + if (runGCNow) { + this.gc(); + needGC = false; + } + return needGC; + }, "invalidate") + /** Garbage collect */ + }, { + key: "gc", + value: /* @__PURE__ */ __name(function gc2() { + var _iterator5 = _createForOfIteratorHelper(this.collections.values()), _step5; + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) { + var collection4 = _step5.value; + collection4.gc(); + } + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); + } + }, "gc") + }, { + key: "getOrCreateAtlas", + value: /* @__PURE__ */ __name(function getOrCreateAtlas(ele, type3, bb, styleKey) { + var opts = this.renderTypes.get(type3); + var atlasCollection = this.collections.get(opts.collection); + var drawn = false; + var atlas = atlasCollection.draw(styleKey, bb, function(context) { + if (opts.drawClipped) { + context.save(); + context.beginPath(); + context.rect(0, 0, bb.w, bb.h); + context.clip(); + opts.drawElement(context, ele, bb, true, true); + context.restore(); + } else { + opts.drawElement(context, ele, bb, true, true); + } + drawn = true; + }); + if (drawn) { + var id35 = opts.getID ? opts.getID(ele) : ele.id(); + var mapKey = this._key(type3, id35); + if (this.typeAndIdToKey.has(mapKey)) { + this.typeAndIdToKey.get(mapKey).push(styleKey); + } else { + this.typeAndIdToKey.set(mapKey, [styleKey]); + } + } + return atlas; + }, "getOrCreateAtlas") + }, { + key: "getAtlasInfo", + value: /* @__PURE__ */ __name(function getAtlasInfo(ele, type3) { + var _this4 = this; + var opts = this.renderTypes.get(type3); + var key = opts.getKey(ele); + var keyArray = Array.isArray(key) ? key : [key]; + return keyArray.map(function(styleKey) { + var bb = opts.getBoundingBox(ele, styleKey); + var atlas = _this4.getOrCreateAtlas(ele, type3, bb, styleKey); + var _atlas$getOffsets3 = atlas.getOffsets(styleKey), _atlas$getOffsets4 = _slicedToArray(_atlas$getOffsets3, 2), tex1 = _atlas$getOffsets4[0], tex2 = _atlas$getOffsets4[1]; + return { + atlas, + tex: tex1, + tex1, + tex2, + bb + }; + }); + }, "getAtlasInfo") + }, { + key: "getDebugInfo", + value: /* @__PURE__ */ __name(function getDebugInfo() { + var debugInfo = []; + var _iterator6 = _createForOfIteratorHelper(this.collections), _step6; + try { + for (_iterator6.s(); !(_step6 = _iterator6.n()).done; ) { + var _step6$value = _slicedToArray(_step6.value, 2), name = _step6$value[0], collection4 = _step6$value[1]; + var _collection$getCounts = collection4.getCounts(), keyCount = _collection$getCounts.keyCount, atlasCount = _collection$getCounts.atlasCount; + debugInfo.push({ + type: name, + keyCount, + atlasCount + }); + } + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); + } + return debugInfo; + }, "getDebugInfo") + }]); + })(); + AtlasBatchManager = /* @__PURE__ */ (function() { + function AtlasBatchManager2(globalOptions) { + _classCallCheck(this, AtlasBatchManager2); + this.globalOptions = globalOptions; + this.atlasSize = globalOptions.webglTexSize; + this.maxAtlasesPerBatch = globalOptions.webglTexPerBatch; + this.batchAtlases = []; + } + __name(AtlasBatchManager2, "AtlasBatchManager"); + return _createClass(AtlasBatchManager2, [{ + key: "getMaxAtlasesPerBatch", + value: /* @__PURE__ */ __name(function getMaxAtlasesPerBatch() { + return this.maxAtlasesPerBatch; + }, "getMaxAtlasesPerBatch") + }, { + key: "getAtlasSize", + value: /* @__PURE__ */ __name(function getAtlasSize() { + return this.atlasSize; + }, "getAtlasSize") + }, { + key: "getIndexArray", + value: /* @__PURE__ */ __name(function getIndexArray() { + return Array.from({ + length: this.maxAtlasesPerBatch + }, function(v3, i2) { + return i2; + }); + }, "getIndexArray") + }, { + key: "startBatch", + value: /* @__PURE__ */ __name(function startBatch2() { + this.batchAtlases = []; + }, "startBatch") + }, { + key: "getAtlasCount", + value: /* @__PURE__ */ __name(function getAtlasCount() { + return this.batchAtlases.length; + }, "getAtlasCount") + }, { + key: "getAtlases", + value: /* @__PURE__ */ __name(function getAtlases() { + return this.batchAtlases; + }, "getAtlases") + }, { + key: "canAddToCurrentBatch", + value: /* @__PURE__ */ __name(function canAddToCurrentBatch(atlas) { + if (this.batchAtlases.length === this.maxAtlasesPerBatch) { + return this.batchAtlases.includes(atlas); + } + return true; + }, "canAddToCurrentBatch") + }, { + key: "getAtlasIndexForBatch", + value: /* @__PURE__ */ __name(function getAtlasIndexForBatch(atlas) { + var atlasID = this.batchAtlases.indexOf(atlas); + if (atlasID < 0) { + if (this.batchAtlases.length === this.maxAtlasesPerBatch) { + throw new Error("cannot add more atlases to batch"); + } + this.batchAtlases.push(atlas); + atlasID = this.batchAtlases.length - 1; + } + return atlasID; + }, "getAtlasIndexForBatch") + }]); + })(); + circleSD = "\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n"; + rectangleSD = "\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n"; + roundRectangleSD = "\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n"; + ellipseSD = "\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x1.0) ? d : -d;\n }\n"; + RENDER_TARGET = { + SCREEN: { + name: "screen", + screen: true + }, + PICKING: { + name: "picking", + picking: true + } + }; + TEX_PICKING_MODE = { + // render the texture just like in RENDER_TARGET.SCREEN mode + IGNORE: 1, + // don't render the texture at all + USE_BB: 2 + // render the bounding box as an opaque rectangle + }; + TEXTURE = 0; + EDGE_STRAIGHT = 1; + EDGE_CURVE_SEGMENT = 2; + EDGE_ARROW = 3; + RECTANGLE = 4; + ROUND_RECTANGLE = 5; + BOTTOM_ROUND_RECTANGLE = 6; + ELLIPSE = 7; + ElementDrawingWebGL = /* @__PURE__ */ (function() { + function ElementDrawingWebGL2(r2, gl, opts) { + _classCallCheck(this, ElementDrawingWebGL2); + this.r = r2; + this.gl = gl; + this.maxInstances = opts.webglBatchSize; + this.atlasSize = opts.webglTexSize; + this.bgColor = opts.bgColor; + this.debug = opts.webglDebug; + this.batchDebugInfo = []; + opts.enableWrapping = true; + opts.createTextureCanvas = createTextureCanvas; + this.atlasManager = new AtlasManager(r2, opts); + this.batchManager = new AtlasBatchManager(opts); + this.simpleShapeOptions = /* @__PURE__ */ new Map(); + this.program = this._createShaderProgram(RENDER_TARGET.SCREEN); + this.pickingProgram = this._createShaderProgram(RENDER_TARGET.PICKING); + this.vao = this._createVAO(); + } + __name(ElementDrawingWebGL2, "ElementDrawingWebGL"); + return _createClass(ElementDrawingWebGL2, [{ + key: "addAtlasCollection", + value: /* @__PURE__ */ __name(function addAtlasCollection(collectionName, opts) { + this.atlasManager.addAtlasCollection(collectionName, opts); + }, "addAtlasCollection") + /** + * @typedef { Object } TextureRenderTypeOpts + * @property { string } collection - name of atlas collection to render textures to + * @property { function } getKey - returns the "style key" for an element, may be a single value or an array for multi-line lables + * @property { function } drawElement - uses a canvas renderer to draw the element to the texture atlas + * @property { boolean } drawClipped - if true the context will be clipped to the bounding box before drawElement() is called, may affect performance + * @property { function } getBoundingBox - returns the bounding box for an element + * @property { function } getRotation + * @property { function } getRotationPoint + * @property { function } getRotationOffset + * @property { function } isVisible - an extra check for visibility in addition to ele.visible() + * @property { function } getTexPickingMode - returns a value from the TEX_PICKING_MODE enum + */ + /** + * @param { string } typeName + * @param { TextureRenderTypeOpts } opts + */ + }, { + key: "addTextureAtlasRenderType", + value: /* @__PURE__ */ __name(function addTextureAtlasRenderType(typeName, opts) { + this.atlasManager.addRenderType(typeName, opts); + }, "addTextureAtlasRenderType") + /** + * @typedef { Object } SimpleShapeRenderTypeOpts + * @property { function } getBoundingBox - returns the bounding box for an element + * @property { function } isVisible - this is an extra check for visibility in addition to ele.visible() + * @property { function } isSimple - check if element is a simple shape, or if it needs to fall back to texture rendering + * @property { ShapeVisualProperties } shapeProps + */ + /** + * @typedef { Object } ShapeVisualProperties + * @property { string } shape + * @property { string } color + * @property { string } opacity + * @property { string } padding + * @property { string } radius + * @property { boolean } border + */ + /** + * @param { string } typeName + * @param { SimpleShapeRenderTypeOpts } opts + */ + }, { + key: "addSimpleShapeRenderType", + value: /* @__PURE__ */ __name(function addSimpleShapeRenderType(typeName, opts) { + this.simpleShapeOptions.set(typeName, opts); + }, "addSimpleShapeRenderType") + /** + * Inform the atlasManager when element style keys may have changed. + * The atlasManager can then mark unused textures for "garbage collection". + */ + }, { + key: "invalidate", + value: /* @__PURE__ */ __name(function invalidate(eles) { + var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, type3 = _ref.type; + var atlasManager = this.atlasManager; + if (type3) { + return atlasManager.invalidate(eles, { + filterType: /* @__PURE__ */ __name(function filterType(t4) { + return t4 === type3; + }, "filterType"), + forceRedraw: true + }); + } else { + return atlasManager.invalidate(eles); + } + }, "invalidate") + /** + * Run texture garbage collection. + */ + }, { + key: "gc", + value: /* @__PURE__ */ __name(function gc2() { + this.atlasManager.gc(); + }, "gc") + }, { + key: "_createShaderProgram", + value: /* @__PURE__ */ __name(function _createShaderProgram(renderTarget) { + var gl = this.gl; + var vertexShaderSource = "#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(TEXTURE, ") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(RECTANGLE, " || aVertType == ").concat(ELLIPSE, " \n || aVertType == ").concat(ROUND_RECTANGLE, " || aVertType == ").concat(BOTTOM_ROUND_RECTANGLE, ") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(EDGE_STRAIGHT, ") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(EDGE_CURVE_SEGMENT, ") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(EDGE_ARROW, " && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "); + var idxs = this.batchManager.getIndexArray(); + var fragmentShaderSource = "#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(idxs.map(function(i3) { + return "uniform sampler2D uTexture".concat(i3, ";"); + }).join("\n "), "\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat(circleSD, "\n ").concat(rectangleSD, "\n ").concat(roundRectangleSD, "\n ").concat(ellipseSD, "\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(TEXTURE, ") {\n // look up the texel from the texture unit\n ").concat(idxs.map(function(i3) { + return "if(vAtlasId == ".concat(i3, ") outColor = texture(uTexture").concat(i3, ", vTexCoord);"); + }).join("\n else "), "\n } \n else if(vVertType == ").concat(EDGE_ARROW, ") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(RECTANGLE, " && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(RECTANGLE, " || vVertType == ").concat(ELLIPSE, " \n || vVertType == ").concat(ROUND_RECTANGLE, " || vVertType == ").concat(BOTTOM_ROUND_RECTANGLE, ") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(RECTANGLE, ") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(ELLIPSE, " && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(ELLIPSE, ") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(renderTarget.picking ? "if(outColor.a == 0.0) discard;\n else outColor = vIndex;" : "", "\n }\n "); + var program = createProgram(gl, vertexShaderSource, fragmentShaderSource); + program.aPosition = gl.getAttribLocation(program, "aPosition"); + program.aIndex = gl.getAttribLocation(program, "aIndex"); + program.aVertType = gl.getAttribLocation(program, "aVertType"); + program.aTransform = gl.getAttribLocation(program, "aTransform"); + program.aAtlasId = gl.getAttribLocation(program, "aAtlasId"); + program.aTex = gl.getAttribLocation(program, "aTex"); + program.aPointAPointB = gl.getAttribLocation(program, "aPointAPointB"); + program.aPointCPointD = gl.getAttribLocation(program, "aPointCPointD"); + program.aLineWidth = gl.getAttribLocation(program, "aLineWidth"); + program.aColor = gl.getAttribLocation(program, "aColor"); + program.aCornerRadius = gl.getAttribLocation(program, "aCornerRadius"); + program.aBorderColor = gl.getAttribLocation(program, "aBorderColor"); + program.uPanZoomMatrix = gl.getUniformLocation(program, "uPanZoomMatrix"); + program.uAtlasSize = gl.getUniformLocation(program, "uAtlasSize"); + program.uBGColor = gl.getUniformLocation(program, "uBGColor"); + program.uZoom = gl.getUniformLocation(program, "uZoom"); + program.uTextures = []; + for (var i2 = 0; i2 < this.batchManager.getMaxAtlasesPerBatch(); i2++) { + program.uTextures.push(gl.getUniformLocation(program, "uTexture".concat(i2))); + } + return program; + }, "_createShaderProgram") + }, { + key: "_createVAO", + value: /* @__PURE__ */ __name(function _createVAO() { + var unitSquare = [0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1]; + this.vertexCount = unitSquare.length / 2; + var n2 = this.maxInstances; + var gl = this.gl, program = this.program; + var vao = gl.createVertexArray(); + gl.bindVertexArray(vao); + createBufferStaticDraw(gl, "vec2", program.aPosition, unitSquare); + this.transformBuffer = create3x3MatrixBufferDynamicDraw(gl, n2, program.aTransform); + this.indexBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aIndex); + this.vertTypeBuffer = createBufferDynamicDraw(gl, n2, "int", program.aVertType); + this.atlasIdBuffer = createBufferDynamicDraw(gl, n2, "int", program.aAtlasId); + this.texBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aTex); + this.pointAPointBBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aPointAPointB); + this.pointCPointDBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aPointCPointD); + this.lineWidthBuffer = createBufferDynamicDraw(gl, n2, "vec2", program.aLineWidth); + this.colorBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aColor); + this.cornerRadiusBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aCornerRadius); + this.borderColorBuffer = createBufferDynamicDraw(gl, n2, "vec4", program.aBorderColor); + gl.bindVertexArray(null); + return vao; + }, "_createVAO") + }, { + key: "buffers", + get: /* @__PURE__ */ __name(function get6() { + var _this = this; + if (!this._buffers) { + this._buffers = Object.keys(this).filter(function(k2) { + return endsWith(k2, "Buffer"); + }).map(function(k2) { + return _this[k2]; + }); + } + return this._buffers; + }, "get") + }, { + key: "startFrame", + value: /* @__PURE__ */ __name(function startFrame(panZoomMatrix) { + var renderTarget = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : RENDER_TARGET.SCREEN; + this.panZoomMatrix = panZoomMatrix; + this.renderTarget = renderTarget; + this.batchDebugInfo = []; + this.wrappedCount = 0; + this.simpleCount = 0; + this.startBatch(); + }, "startFrame") + }, { + key: "startBatch", + value: /* @__PURE__ */ __name(function startBatch2() { + this.instanceCount = 0; + this.batchManager.startBatch(); + }, "startBatch") + }, { + key: "endFrame", + value: /* @__PURE__ */ __name(function endFrame() { + this.endBatch(); + }, "endFrame") + }, { + key: "_isVisible", + value: /* @__PURE__ */ __name(function _isVisible(ele, opts) { + if (ele.visible()) { + if (opts && opts.isVisible) { + return opts.isVisible(ele); + } + return true; + } + return false; + }, "_isVisible") + /** + * Draws a texture using the texture atlas. + */ + }, { + key: "drawTexture", + value: /* @__PURE__ */ __name(function drawTexture(ele, eleIndex, type3) { + var atlasManager = this.atlasManager, batchManager = this.batchManager; + var opts = atlasManager.getRenderTypeOpts(type3); + if (!this._isVisible(ele, opts)) { + return; + } + if (ele.isEdge() && !this._isValidEdge(ele)) { + return; + } + if (this.renderTarget.picking && opts.getTexPickingMode) { + var mode = opts.getTexPickingMode(ele); + if (mode === TEX_PICKING_MODE.IGNORE) { + return; + } else if (mode == TEX_PICKING_MODE.USE_BB) { + this.drawPickingRectangle(ele, eleIndex, type3); + return; + } + } + var atlasInfoArray = atlasManager.getAtlasInfo(ele, type3); + var _iterator = _createForOfIteratorHelper(atlasInfoArray), _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done; ) { + var atlasInfo = _step.value; + var atlas = atlasInfo.atlas, tex1 = atlasInfo.tex1, tex2 = atlasInfo.tex2; + if (!batchManager.canAddToCurrentBatch(atlas)) { + this.endBatch(); + } + var atlasIndex = batchManager.getAtlasIndexForBatch(atlas); + for (var _i = 0, _arr = [[tex1, true], [tex2, false]]; _i < _arr.length; _i++) { + var _arr$_i = _slicedToArray(_arr[_i], 2), tex = _arr$_i[0], first3 = _arr$_i[1]; + if (tex.w != 0) { + var instance2 = this.instanceCount; + this.vertTypeBuffer.getView(instance2)[0] = TEXTURE; + var indexView = this.indexBuffer.getView(instance2); + indexToVec4(eleIndex, indexView); + var atlasIdView = this.atlasIdBuffer.getView(instance2); + atlasIdView[0] = atlasIndex; + var texView = this.texBuffer.getView(instance2); + texView[0] = tex.x; + texView[1] = tex.y; + texView[2] = tex.w; + texView[3] = tex.h; + var matrixView = this.transformBuffer.getMatrixView(instance2); + this.setTransformMatrix(ele, matrixView, opts, atlasInfo, first3); + this.instanceCount++; + if (!first3) this.wrappedCount++; + if (this.instanceCount >= this.maxInstances) { + this.endBatch(); + } + } + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + }, "drawTexture") + /** + * matrix is expected to be a 9 element array + * this function follows same pattern as CRp.drawCachedElementPortion(...) + */ + }, { + key: "setTransformMatrix", + value: /* @__PURE__ */ __name(function setTransformMatrix(ele, matrix, opts, atlasInfo) { + var first3 = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true; + var padding2 = 0; + if (opts.shapeProps && opts.shapeProps.padding) { + padding2 = ele.pstyle(opts.shapeProps.padding).pfValue; + } + if (atlasInfo) { + var bb = atlasInfo.bb, tex1 = atlasInfo.tex1, tex2 = atlasInfo.tex2; + var ratio = tex1.w / (tex1.w + tex2.w); + if (!first3) { + ratio = 1 - ratio; + } + var adjBB = this._getAdjustedBB(bb, padding2, first3, ratio); + this._applyTransformMatrix(matrix, adjBB, opts, ele); + } else { + var _bb = opts.getBoundingBox(ele); + var _adjBB = this._getAdjustedBB(_bb, padding2, true, 1); + this._applyTransformMatrix(matrix, _adjBB, opts, ele); + } + }, "setTransformMatrix") + }, { + key: "_applyTransformMatrix", + value: /* @__PURE__ */ __name(function _applyTransformMatrix(matrix, adjBB, opts, ele) { + var x5, y6; + identity6(matrix); + var theta = opts.getRotation ? opts.getRotation(ele) : 0; + if (theta !== 0) { + var _opts$getRotationPoin = opts.getRotationPoint(ele), sx = _opts$getRotationPoin.x, sy = _opts$getRotationPoin.y; + translate(matrix, matrix, [sx, sy]); + rotate(matrix, matrix, theta); + var offset = opts.getRotationOffset(ele); + x5 = offset.x + (adjBB.xOffset || 0); + y6 = offset.y + (adjBB.yOffset || 0); + } else { + x5 = adjBB.x1; + y6 = adjBB.y1; + } + translate(matrix, matrix, [x5, y6]); + scale(matrix, matrix, [adjBB.w, adjBB.h]); + }, "_applyTransformMatrix") + /** + * Adjusts a node or label BB to accomodate padding and split for wrapped textures. + * @param bb - the original bounding box + * @param padding - the padding to add to the bounding box + * @param first - whether this is the first part of a wrapped texture + * @param ratio - the ratio of the texture width of part of the text to the entire texture + */ + }, { + key: "_getAdjustedBB", + value: /* @__PURE__ */ __name(function _getAdjustedBB(bb, padding2, first3, ratio) { + var x1 = bb.x1, y1 = bb.y1, w4 = bb.w, h3 = bb.h, yOffset = bb.yOffset; + if (padding2) { + x1 -= padding2; + y1 -= padding2; + w4 += 2 * padding2; + h3 += 2 * padding2; + } + var xOffset = 0; + var adjW = w4 * ratio; + if (first3 && ratio < 1) { + w4 = adjW; + } else if (!first3 && ratio < 1) { + xOffset = w4 - adjW; + x1 += xOffset; + w4 = adjW; + } + return { + x1, + y1, + w: w4, + h: h3, + xOffset, + yOffset + }; + }, "_getAdjustedBB") + /** + * Draw a solid opaque rectangle matching the element's Bounding Box. + * Used by the PICKING mode to make the entire BB of a label clickable. + */ + }, { + key: "drawPickingRectangle", + value: /* @__PURE__ */ __name(function drawPickingRectangle(ele, eleIndex, type3) { + var opts = this.atlasManager.getRenderTypeOpts(type3); + var instance2 = this.instanceCount; + this.vertTypeBuffer.getView(instance2)[0] = RECTANGLE; + var indexView = this.indexBuffer.getView(instance2); + indexToVec4(eleIndex, indexView); + var colorView = this.colorBuffer.getView(instance2); + toWebGLColor([0, 0, 0], 1, colorView); + var matrixView = this.transformBuffer.getMatrixView(instance2); + this.setTransformMatrix(ele, matrixView, opts); + this.simpleCount++; + this.instanceCount++; + if (this.instanceCount >= this.maxInstances) { + this.endBatch(); + } + }, "drawPickingRectangle") + /** + * Draw a node using either a texture or a "simple shape". + */ + }, { + key: "drawNode", + value: /* @__PURE__ */ __name(function drawNode2(node2, eleIndex, type3) { + var opts = this.simpleShapeOptions.get(type3); + if (!this._isVisible(node2, opts)) { + return; + } + var props = opts.shapeProps; + var vertType = this._getVertTypeForShape(node2, props.shape); + if (vertType === void 0 || opts.isSimple && !opts.isSimple(node2)) { + this.drawTexture(node2, eleIndex, type3); + return; + } + var instance2 = this.instanceCount; + this.vertTypeBuffer.getView(instance2)[0] = vertType; + if (vertType === ROUND_RECTANGLE || vertType === BOTTOM_ROUND_RECTANGLE) { + var bb = opts.getBoundingBox(node2); + var radius2 = this._getCornerRadius(node2, props.radius, bb); + var radiusView = this.cornerRadiusBuffer.getView(instance2); + radiusView[0] = radius2; + radiusView[1] = radius2; + radiusView[2] = radius2; + radiusView[3] = radius2; + if (vertType === BOTTOM_ROUND_RECTANGLE) { + radiusView[0] = 0; + radiusView[2] = 0; + } + } + var indexView = this.indexBuffer.getView(instance2); + indexToVec4(eleIndex, indexView); + var color2 = node2.pstyle(props.color).value; + var opacity = node2.pstyle(props.opacity).value; + var colorView = this.colorBuffer.getView(instance2); + toWebGLColor(color2, opacity, colorView); + var lineWidthView = this.lineWidthBuffer.getView(instance2); + lineWidthView[0] = 0; + lineWidthView[1] = 0; + if (props.border) { + var borderWidth = node2.pstyle("border-width").value; + if (borderWidth > 0) { + var borderColor = node2.pstyle("border-color").value; + var borderOpacity = node2.pstyle("border-opacity").value; + var borderColorView = this.borderColorBuffer.getView(instance2); + toWebGLColor(borderColor, borderOpacity, borderColorView); + var borderPos = node2.pstyle("border-position").value; + if (borderPos === "inside") { + lineWidthView[0] = 0; + lineWidthView[1] = -borderWidth; + } else if (borderPos === "outside") { + lineWidthView[0] = borderWidth; + lineWidthView[1] = 0; + } else { + var halfWidth = borderWidth / 2; + lineWidthView[0] = halfWidth; + lineWidthView[1] = -halfWidth; + } + } + } + var matrixView = this.transformBuffer.getMatrixView(instance2); + this.setTransformMatrix(node2, matrixView, opts); + this.simpleCount++; + this.instanceCount++; + if (this.instanceCount >= this.maxInstances) { + this.endBatch(); + } + }, "drawNode") + }, { + key: "_getVertTypeForShape", + value: /* @__PURE__ */ __name(function _getVertTypeForShape(node2, shapeProp) { + var shape = node2.pstyle(shapeProp).value; + switch (shape) { + case "rectangle": + return RECTANGLE; + case "ellipse": + return ELLIPSE; + case "roundrectangle": + case "round-rectangle": + return ROUND_RECTANGLE; + case "bottom-round-rectangle": + return BOTTOM_ROUND_RECTANGLE; + default: + return void 0; + } + }, "_getVertTypeForShape") + }, { + key: "_getCornerRadius", + value: /* @__PURE__ */ __name(function _getCornerRadius(node2, radiusProp, _ref2) { + var w4 = _ref2.w, h3 = _ref2.h; + if (node2.pstyle(radiusProp).value === "auto") { + return getRoundRectangleRadius(w4, h3); + } else { + var radius2 = node2.pstyle(radiusProp).pfValue; + var halfWidth = w4 / 2; + var halfHeight = h3 / 2; + return Math.min(radius2, halfHeight, halfWidth); + } + }, "_getCornerRadius") + /** + * Only supports drawing triangles at the moment. + */ + }, { + key: "drawEdgeArrow", + value: /* @__PURE__ */ __name(function drawEdgeArrow(edge, eleIndex, prefix) { + if (!edge.visible()) { + return; + } + var rs = edge._private.rscratch; + var x5, y6, angle2; + if (prefix === "source") { + x5 = rs.arrowStartX; + y6 = rs.arrowStartY; + angle2 = rs.srcArrowAngle; + } else { + x5 = rs.arrowEndX; + y6 = rs.arrowEndY; + angle2 = rs.tgtArrowAngle; + } + if (isNaN(x5) || x5 == null || isNaN(y6) || y6 == null || isNaN(angle2) || angle2 == null) { + return; + } + var arrowShape = edge.pstyle(prefix + "-arrow-shape").value; + if (arrowShape === "none") { + return; + } + var color2 = edge.pstyle(prefix + "-arrow-color").value; + var baseOpacity = edge.pstyle("opacity").value; + var lineOpacity = edge.pstyle("line-opacity").value; + var opacity = baseOpacity * lineOpacity; + var lineWidth = edge.pstyle("width").pfValue; + var scale$1 = edge.pstyle("arrow-scale").value; + var size4 = this.r.getArrowWidth(lineWidth, scale$1); + var instance2 = this.instanceCount; + var transform8 = this.transformBuffer.getMatrixView(instance2); + identity6(transform8); + translate(transform8, transform8, [x5, y6]); + scale(transform8, transform8, [size4, size4]); + rotate(transform8, transform8, angle2); + this.vertTypeBuffer.getView(instance2)[0] = EDGE_ARROW; + var indexView = this.indexBuffer.getView(instance2); + indexToVec4(eleIndex, indexView); + var colorView = this.colorBuffer.getView(instance2); + toWebGLColor(color2, opacity, colorView); + this.instanceCount++; + if (this.instanceCount >= this.maxInstances) { + this.endBatch(); + } + }, "drawEdgeArrow") + /** + * Draw straight-line or bezier curve edges. + */ + }, { + key: "drawEdgeLine", + value: /* @__PURE__ */ __name(function drawEdgeLine(edge, eleIndex) { + if (!edge.visible()) { + return; + } + var points = this._getEdgePoints(edge); + if (!points) { + return; + } + var baseOpacity = edge.pstyle("opacity").value; + var lineOpacity = edge.pstyle("line-opacity").value; + var width3 = edge.pstyle("width").pfValue; + var color2 = edge.pstyle("line-color").value; + var opacity = baseOpacity * lineOpacity; + if (points.length / 2 + this.instanceCount > this.maxInstances) { + this.endBatch(); + } + if (points.length == 4) { + var instance2 = this.instanceCount; + this.vertTypeBuffer.getView(instance2)[0] = EDGE_STRAIGHT; + var indexView = this.indexBuffer.getView(instance2); + indexToVec4(eleIndex, indexView); + var colorView = this.colorBuffer.getView(instance2); + toWebGLColor(color2, opacity, colorView); + var lineWidthBuffer = this.lineWidthBuffer.getView(instance2); + lineWidthBuffer[0] = width3; + var sourceTargetView = this.pointAPointBBuffer.getView(instance2); + sourceTargetView[0] = points[0]; + sourceTargetView[1] = points[1]; + sourceTargetView[2] = points[2]; + sourceTargetView[3] = points[3]; + this.instanceCount++; + if (this.instanceCount >= this.maxInstances) { + this.endBatch(); + } + } else { + for (var i2 = 0; i2 < points.length - 2; i2 += 2) { + var _instance = this.instanceCount; + this.vertTypeBuffer.getView(_instance)[0] = EDGE_CURVE_SEGMENT; + var _indexView = this.indexBuffer.getView(_instance); + indexToVec4(eleIndex, _indexView); + var _colorView = this.colorBuffer.getView(_instance); + toWebGLColor(color2, opacity, _colorView); + var _lineWidthBuffer = this.lineWidthBuffer.getView(_instance); + _lineWidthBuffer[0] = width3; + var pAx = points[i2 - 2], pAy = points[i2 - 1]; + var pBx = points[i2], pBy = points[i2 + 1]; + var pCx = points[i2 + 2], pCy = points[i2 + 3]; + var pDx = points[i2 + 4], pDy = points[i2 + 5]; + if (i2 == 0) { + pAx = 2 * pBx - pCx + 1e-3; + pAy = 2 * pBy - pCy + 1e-3; + } + if (i2 == points.length - 4) { + pDx = 2 * pCx - pBx + 1e-3; + pDy = 2 * pCy - pBy + 1e-3; + } + var pointABView = this.pointAPointBBuffer.getView(_instance); + pointABView[0] = pAx; + pointABView[1] = pAy; + pointABView[2] = pBx; + pointABView[3] = pBy; + var pointCDView = this.pointCPointDBuffer.getView(_instance); + pointCDView[0] = pCx; + pointCDView[1] = pCy; + pointCDView[2] = pDx; + pointCDView[3] = pDy; + this.instanceCount++; + if (this.instanceCount >= this.maxInstances) { + this.endBatch(); + } + } + } + }, "drawEdgeLine") + }, { + key: "_isValidEdge", + value: /* @__PURE__ */ __name(function _isValidEdge(edge) { + var rs = edge._private.rscratch; + if (rs.badLine || rs.allpts == null || isNaN(rs.allpts[0])) { + return false; + } + return true; + }, "_isValidEdge") + }, { + key: "_getEdgePoints", + value: /* @__PURE__ */ __name(function _getEdgePoints(edge) { + var rs = edge._private.rscratch; + if (!this._isValidEdge(edge)) { + return; + } + var controlPoints4 = rs.allpts; + if (controlPoints4.length == 4) { + return controlPoints4; + } + var numSegments = this._getNumSegments(edge); + return this._getCurveSegmentPoints(controlPoints4, numSegments); + }, "_getEdgePoints") + }, { + key: "_getNumSegments", + value: /* @__PURE__ */ __name(function _getNumSegments(edge) { + var numSegments = 15; + return Math.min(Math.max(numSegments, 5), this.maxInstances); + }, "_getNumSegments") + }, { + key: "_getCurveSegmentPoints", + value: /* @__PURE__ */ __name(function _getCurveSegmentPoints(controlPoints4, segments) { + if (controlPoints4.length == 4) { + return controlPoints4; + } + var curvePoints = Array((segments + 1) * 2); + for (var i2 = 0; i2 <= segments; i2++) { + if (i2 == 0) { + curvePoints[0] = controlPoints4[0]; + curvePoints[1] = controlPoints4[1]; + } else if (i2 == segments) { + curvePoints[i2 * 2] = controlPoints4[controlPoints4.length - 2]; + curvePoints[i2 * 2 + 1] = controlPoints4[controlPoints4.length - 1]; + } else { + var t4 = i2 / segments; + this._setCurvePoint(controlPoints4, t4, curvePoints, i2 * 2); + } + } + return curvePoints; + }, "_getCurveSegmentPoints") + }, { + key: "_setCurvePoint", + value: /* @__PURE__ */ __name(function _setCurvePoint(points, t4, curvePoints, cpi) { + if (points.length <= 2) { + curvePoints[cpi] = points[0]; + curvePoints[cpi + 1] = points[1]; + } else { + var newpoints = Array(points.length - 2); + for (var i2 = 0; i2 < newpoints.length; i2 += 2) { + var x5 = (1 - t4) * points[i2] + t4 * points[i2 + 2]; + var y6 = (1 - t4) * points[i2 + 1] + t4 * points[i2 + 3]; + newpoints[i2] = x5; + newpoints[i2 + 1] = y6; + } + return this._setCurvePoint(newpoints, t4, curvePoints, cpi); + } + }, "_setCurvePoint") + }, { + key: "endBatch", + value: /* @__PURE__ */ __name(function endBatch2() { + var gl = this.gl, vao = this.vao, vertexCount = this.vertexCount, count2 = this.instanceCount; + if (count2 === 0) return; + var program = this.renderTarget.picking ? this.pickingProgram : this.program; + gl.useProgram(program); + gl.bindVertexArray(vao); + var _iterator2 = _createForOfIteratorHelper(this.buffers), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var buffer = _step2.value; + buffer.bufferSubData(count2); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + var atlases = this.batchManager.getAtlases(); + for (var i2 = 0; i2 < atlases.length; i2++) { + atlases[i2].bufferIfNeeded(gl); + } + for (var _i2 = 0; _i2 < atlases.length; _i2++) { + gl.activeTexture(gl.TEXTURE0 + _i2); + gl.bindTexture(gl.TEXTURE_2D, atlases[_i2].texture); + gl.uniform1i(program.uTextures[_i2], _i2); + } + gl.uniform1f(program.uZoom, getEffectiveZoom(this.r)); + gl.uniformMatrix3fv(program.uPanZoomMatrix, false, this.panZoomMatrix); + gl.uniform1i(program.uAtlasSize, this.batchManager.getAtlasSize()); + var webglBgColor = toWebGLColor(this.bgColor, 1); + gl.uniform4fv(program.uBGColor, webglBgColor); + gl.drawArraysInstanced(gl.TRIANGLES, 0, vertexCount, count2); + gl.bindVertexArray(null); + gl.bindTexture(gl.TEXTURE_2D, null); + if (this.debug) { + this.batchDebugInfo.push({ + count: count2, + // instance count + atlasCount: atlases.length + }); + } + this.startBatch(); + }, "endBatch") + }, { + key: "getDebugInfo", + value: /* @__PURE__ */ __name(function getDebugInfo() { + var atlasInfo = this.atlasManager.getDebugInfo(); + var totalAtlases = atlasInfo.reduce(function(count2, info2) { + return count2 + info2.atlasCount; + }, 0); + var batchInfo = this.batchDebugInfo; + var totalInstances = batchInfo.reduce(function(count2, info2) { + return count2 + info2.count; + }, 0); + return { + atlasInfo, + totalAtlases, + wrappedCount: this.wrappedCount, + simpleCount: this.simpleCount, + batchCount: batchInfo.length, + batchInfo, + totalInstances + }; + }, "getDebugInfo") + }]); + })(); + CRp$4 = {}; + CRp$4.initWebgl = function(opts, fns) { + var r2 = this; + var gl = r2.data.contexts[r2.WEBGL]; + opts.bgColor = getBGColor(r2); + opts.webglTexSize = Math.min(opts.webglTexSize, gl.getParameter(gl.MAX_TEXTURE_SIZE)); + opts.webglTexRows = Math.min(opts.webglTexRows, 54); + opts.webglTexRowsNodes = Math.min(opts.webglTexRowsNodes, 54); + opts.webglBatchSize = Math.min(opts.webglBatchSize, 16384); + opts.webglTexPerBatch = Math.min(opts.webglTexPerBatch, gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)); + r2.webglDebug = opts.webglDebug; + r2.webglDebugShowAtlases = opts.webglDebugShowAtlases; + r2.pickingFrameBuffer = createPickingFrameBuffer(gl); + r2.pickingFrameBuffer.needsDraw = true; + r2.drawing = new ElementDrawingWebGL(r2, gl, opts); + var getLabelRotation3 = /* @__PURE__ */ __name(function getLabelRotation4(prop) { + return function(ele) { + return r2.getTextAngle(ele, prop); + }; + }, "getLabelRotation"); + var isLabelVisible = /* @__PURE__ */ __name(function isLabelVisible2(prop) { + return function(ele) { + var label = ele.pstyle(prop); + return label && label.value; + }; + }, "isLabelVisible"); + var isLayerVisible = /* @__PURE__ */ __name(function isLayerVisible2(prefix) { + return function(node2) { + return node2.pstyle("".concat(prefix, "-opacity")).value > 0; + }; + }, "isLayerVisible"); + var getTexPickingMode = /* @__PURE__ */ __name(function getTexPickingMode2(ele) { + var enabled = ele.pstyle("text-events").strValue === "yes"; + return enabled ? TEX_PICKING_MODE.USE_BB : TEX_PICKING_MODE.IGNORE; + }, "getTexPickingMode"); + var getBBForSimpleShape = /* @__PURE__ */ __name(function getBBForSimpleShape2(node2) { + var _node$position = node2.position(), x5 = _node$position.x, y6 = _node$position.y; + var w4 = node2.outerWidth(); + var h3 = node2.outerHeight(); + return { + w: w4, + h: h3, + x1: x5 - w4 / 2, + y1: y6 - h3 / 2 + }; + }, "getBBForSimpleShape"); + r2.drawing.addAtlasCollection("node", { + texRows: opts.webglTexRowsNodes + }); + r2.drawing.addAtlasCollection("label", { + texRows: opts.webglTexRows + }); + r2.drawing.addTextureAtlasRenderType("node-body", { + collection: "node", + getKey: fns.getStyleKey, + getBoundingBox: fns.getElementBox, + drawElement: fns.drawElement + }); + r2.drawing.addSimpleShapeRenderType("node-body", { + getBoundingBox: getBBForSimpleShape, + isSimple: isSimpleShape, + shapeProps: { + shape: "shape", + color: "background-color", + opacity: "background-opacity", + radius: "corner-radius", + border: true + } + }); + r2.drawing.addSimpleShapeRenderType("node-overlay", { + getBoundingBox: getBBForSimpleShape, + isVisible: isLayerVisible("overlay"), + shapeProps: { + shape: "overlay-shape", + color: "overlay-color", + opacity: "overlay-opacity", + padding: "overlay-padding", + radius: "overlay-corner-radius" + } + }); + r2.drawing.addSimpleShapeRenderType("node-underlay", { + getBoundingBox: getBBForSimpleShape, + isVisible: isLayerVisible("underlay"), + shapeProps: { + shape: "underlay-shape", + color: "underlay-color", + opacity: "underlay-opacity", + padding: "underlay-padding", + radius: "underlay-corner-radius" + } + }); + r2.drawing.addTextureAtlasRenderType("label", { + // node label or edge mid label + collection: "label", + getTexPickingMode, + getKey: getStyleKeysForLabel(fns.getLabelKey, null), + getBoundingBox: getBoundingBoxForLabel(fns.getLabelBox, null), + drawClipped: true, + drawElement: fns.drawLabel, + getRotation: getLabelRotation3(null), + getRotationPoint: fns.getLabelRotationPoint, + getRotationOffset: fns.getLabelRotationOffset, + isVisible: isLabelVisible("label") + }); + r2.drawing.addTextureAtlasRenderType("edge-source-label", { + collection: "label", + getTexPickingMode, + getKey: getStyleKeysForLabel(fns.getSourceLabelKey, "source"), + getBoundingBox: getBoundingBoxForLabel(fns.getSourceLabelBox, "source"), + drawClipped: true, + drawElement: fns.drawSourceLabel, + getRotation: getLabelRotation3("source"), + getRotationPoint: fns.getSourceLabelRotationPoint, + getRotationOffset: fns.getSourceLabelRotationOffset, + isVisible: isLabelVisible("source-label") + }); + r2.drawing.addTextureAtlasRenderType("edge-target-label", { + collection: "label", + getTexPickingMode, + getKey: getStyleKeysForLabel(fns.getTargetLabelKey, "target"), + getBoundingBox: getBoundingBoxForLabel(fns.getTargetLabelBox, "target"), + drawClipped: true, + drawElement: fns.drawTargetLabel, + getRotation: getLabelRotation3("target"), + getRotationPoint: fns.getTargetLabelRotationPoint, + getRotationOffset: fns.getTargetLabelRotationOffset, + isVisible: isLabelVisible("target-label") + }); + var setGCFlag = debounce(function() { + console.log("garbage collect flag set"); + r2.data.gc = true; + }, 1e4); + r2.onUpdateEleCalcs(function(willDraw, eles) { + var gcNeeded = false; + if (eles && eles.length > 0) { + gcNeeded |= r2.drawing.invalidate(eles); + } + if (gcNeeded) { + setGCFlag(); + } + }); + overrideCanvasRendererFunctions(r2); + }; + __name(getBGColor, "getBGColor"); + __name(getLabelLines, "getLabelLines"); + getStyleKeysForLabel = /* @__PURE__ */ __name(function getStyleKeysForLabel2(getKey3, prefix) { + return function(ele) { + var key = getKey3(ele); + var lines = getLabelLines(ele, prefix); + if (lines.length > 1) { + return lines.map(function(line2, index) { + return "".concat(key, "_").concat(index); + }); + } + return key; + }; + }, "getStyleKeysForLabel"); + getBoundingBoxForLabel = /* @__PURE__ */ __name(function getBoundingBoxForLabel2(getBoundingBox2, prefix) { + return function(ele, styleKey) { + var bb = getBoundingBox2(ele); + if (typeof styleKey === "string") { + var ui = styleKey.indexOf("_"); + if (ui > 0) { + var lineIndex = Number(styleKey.substring(ui + 1)); + var lines = getLabelLines(ele, prefix); + var h3 = bb.h / lines.length; + var yOffset = h3 * lineIndex; + var y1 = bb.y1 + yOffset; + return { + x1: bb.x1, + w: bb.w, + y1, + h: h3, + yOffset + }; + } + } + return bb; + }; + }, "getBoundingBoxForLabel"); + __name(overrideCanvasRendererFunctions, "overrideCanvasRendererFunctions"); + __name(clearWebgl, "clearWebgl"); + __name(clearCanvas, "clearCanvas"); + __name(createPanZoomMatrix, "createPanZoomMatrix"); + __name(setContextTransform, "setContextTransform"); + __name(drawSelectionRectangle, "drawSelectionRectangle"); + __name(drawAxes, "drawAxes"); + __name(drawAtlases, "drawAtlases"); + __name(getPickingIndexes, "getPickingIndexes"); + __name(findNearestElementsWebgl, "findNearestElementsWebgl"); + __name(drawEle, "drawEle"); + __name(renderWebgl, "renderWebgl"); + CRp$3 = {}; + CRp$3.drawPolygonPath = function(context, x5, y6, width3, height2, points) { + var halfW = width3 / 2; + var halfH = height2 / 2; + if (context.beginPath) { + context.beginPath(); + } + context.moveTo(x5 + halfW * points[0], y6 + halfH * points[1]); + for (var i2 = 1; i2 < points.length / 2; i2++) { + context.lineTo(x5 + halfW * points[i2 * 2], y6 + halfH * points[i2 * 2 + 1]); + } + context.closePath(); + }; + CRp$3.drawRoundPolygonPath = function(context, x5, y6, width3, height2, points, corners) { + corners.forEach(function(corner) { + return drawPreparedRoundCorner(context, corner); + }); + context.closePath(); + }; + CRp$3.drawRoundRectanglePath = function(context, x5, y6, width3, height2, radius2) { + var halfWidth = width3 / 2; + var halfHeight = height2 / 2; + var cornerRadius = radius2 === "auto" ? getRoundRectangleRadius(width3, height2) : Math.min(radius2, halfHeight, halfWidth); + if (context.beginPath) { + context.beginPath(); + } + context.moveTo(x5, y6 - halfHeight); + context.arcTo(x5 + halfWidth, y6 - halfHeight, x5 + halfWidth, y6, cornerRadius); + context.arcTo(x5 + halfWidth, y6 + halfHeight, x5, y6 + halfHeight, cornerRadius); + context.arcTo(x5 - halfWidth, y6 + halfHeight, x5 - halfWidth, y6, cornerRadius); + context.arcTo(x5 - halfWidth, y6 - halfHeight, x5, y6 - halfHeight, cornerRadius); + context.lineTo(x5, y6 - halfHeight); + context.closePath(); + }; + CRp$3.drawBottomRoundRectanglePath = function(context, x5, y6, width3, height2, radius2) { + var halfWidth = width3 / 2; + var halfHeight = height2 / 2; + var cornerRadius = radius2 === "auto" ? getRoundRectangleRadius(width3, height2) : radius2; + if (context.beginPath) { + context.beginPath(); + } + context.moveTo(x5, y6 - halfHeight); + context.lineTo(x5 + halfWidth, y6 - halfHeight); + context.lineTo(x5 + halfWidth, y6); + context.arcTo(x5 + halfWidth, y6 + halfHeight, x5, y6 + halfHeight, cornerRadius); + context.arcTo(x5 - halfWidth, y6 + halfHeight, x5 - halfWidth, y6, cornerRadius); + context.lineTo(x5 - halfWidth, y6 - halfHeight); + context.lineTo(x5, y6 - halfHeight); + context.closePath(); + }; + CRp$3.drawCutRectanglePath = function(context, x5, y6, width3, height2, points, corners) { + var halfWidth = width3 / 2; + var halfHeight = height2 / 2; + var cornerLength = corners === "auto" ? getCutRectangleCornerLength() : corners; + if (context.beginPath) { + context.beginPath(); + } + context.moveTo(x5 - halfWidth + cornerLength, y6 - halfHeight); + context.lineTo(x5 + halfWidth - cornerLength, y6 - halfHeight); + context.lineTo(x5 + halfWidth, y6 - halfHeight + cornerLength); + context.lineTo(x5 + halfWidth, y6 + halfHeight - cornerLength); + context.lineTo(x5 + halfWidth - cornerLength, y6 + halfHeight); + context.lineTo(x5 - halfWidth + cornerLength, y6 + halfHeight); + context.lineTo(x5 - halfWidth, y6 + halfHeight - cornerLength); + context.lineTo(x5 - halfWidth, y6 - halfHeight + cornerLength); + context.closePath(); + }; + CRp$3.drawBarrelPath = function(context, x5, y6, width3, height2) { + var halfWidth = width3 / 2; + var halfHeight = height2 / 2; + var xBegin = x5 - halfWidth; + var xEnd = x5 + halfWidth; + var yBegin = y6 - halfHeight; + var yEnd = y6 + halfHeight; + var barrelCurveConstants = getBarrelCurveConstants(width3, height2); + var wOffset = barrelCurveConstants.widthOffset; + var hOffset = barrelCurveConstants.heightOffset; + var ctrlPtXOffset = barrelCurveConstants.ctrlPtOffsetPct * wOffset; + if (context.beginPath) { + context.beginPath(); + } + context.moveTo(xBegin, yBegin + hOffset); + context.lineTo(xBegin, yEnd - hOffset); + context.quadraticCurveTo(xBegin + ctrlPtXOffset, yEnd, xBegin + wOffset, yEnd); + context.lineTo(xEnd - wOffset, yEnd); + context.quadraticCurveTo(xEnd - ctrlPtXOffset, yEnd, xEnd, yEnd - hOffset); + context.lineTo(xEnd, yBegin + hOffset); + context.quadraticCurveTo(xEnd - ctrlPtXOffset, yBegin, xEnd - wOffset, yBegin); + context.lineTo(xBegin + wOffset, yBegin); + context.quadraticCurveTo(xBegin + ctrlPtXOffset, yBegin, xBegin, yBegin + hOffset); + context.closePath(); + }; + sin0 = Math.sin(0); + cos0 = Math.cos(0); + sin2 = {}; + cos2 = {}; + ellipseStepSize = Math.PI / 40; + for (i2 = 0 * Math.PI; i2 < 2 * Math.PI; i2 += ellipseStepSize) { + sin2[i2] = Math.sin(i2); + cos2[i2] = Math.cos(i2); + } + CRp$3.drawEllipsePath = function(context, centerX, centerY, width3, height2) { + if (context.beginPath) { + context.beginPath(); + } + if (context.ellipse) { + context.ellipse(centerX, centerY, width3 / 2, height2 / 2, 0, 0, 2 * Math.PI); + } else { + var xPos, yPos; + var rw = width3 / 2; + var rh = height2 / 2; + for (var i2 = 0 * Math.PI; i2 < 2 * Math.PI; i2 += ellipseStepSize) { + xPos = centerX - rw * sin2[i2] * sin0 + rw * cos2[i2] * cos0; + yPos = centerY + rh * cos2[i2] * sin0 + rh * sin2[i2] * cos0; + if (i2 === 0) { + context.moveTo(xPos, yPos); + } else { + context.lineTo(xPos, yPos); + } + } + } + context.closePath(); + }; + CRp$2 = {}; + CRp$2.createBuffer = function(w4, h3) { + var buffer = document.createElement("canvas"); + buffer.width = w4; + buffer.height = h3; + return [buffer, buffer.getContext("2d")]; + }; + CRp$2.bufferCanvasImage = function(options2) { + var cy = this.cy; + var eles = cy.mutableElements(); + var bb = eles.boundingBox(); + var ctrRect = this.findContainerClientCoords(); + var width3 = options2.full ? Math.ceil(bb.w) : ctrRect[2]; + var height2 = options2.full ? Math.ceil(bb.h) : ctrRect[3]; + var specdMaxDims = number$1(options2.maxWidth) || number$1(options2.maxHeight); + var pxRatio = this.getPixelRatio(); + var scale3 = 1; + if (options2.scale !== void 0) { + width3 *= options2.scale; + height2 *= options2.scale; + scale3 = options2.scale; + } else if (specdMaxDims) { + var maxScaleW = Infinity; + var maxScaleH = Infinity; + if (number$1(options2.maxWidth)) { + maxScaleW = scale3 * options2.maxWidth / width3; + } + if (number$1(options2.maxHeight)) { + maxScaleH = scale3 * options2.maxHeight / height2; + } + scale3 = Math.min(maxScaleW, maxScaleH); + width3 *= scale3; + height2 *= scale3; + } + if (!specdMaxDims) { + width3 *= pxRatio; + height2 *= pxRatio; + scale3 *= pxRatio; + } + var buffCanvas = document.createElement("canvas"); + buffCanvas.width = width3; + buffCanvas.height = height2; + buffCanvas.style.width = width3 + "px"; + buffCanvas.style.height = height2 + "px"; + var buffCxt = buffCanvas.getContext("2d"); + if (width3 > 0 && height2 > 0) { + buffCxt.clearRect(0, 0, width3, height2); + buffCxt.globalCompositeOperation = "source-over"; + var zsortedEles = this.getCachedZSortedEles(); + if (options2.full) { + buffCxt.translate(-bb.x1 * scale3, -bb.y1 * scale3); + buffCxt.scale(scale3, scale3); + this.drawElements(buffCxt, zsortedEles); + buffCxt.scale(1 / scale3, 1 / scale3); + buffCxt.translate(bb.x1 * scale3, bb.y1 * scale3); + } else { + var pan2 = cy.pan(); + var translation = { + x: pan2.x * scale3, + y: pan2.y * scale3 + }; + scale3 *= cy.zoom(); + buffCxt.translate(translation.x, translation.y); + buffCxt.scale(scale3, scale3); + this.drawElements(buffCxt, zsortedEles); + buffCxt.scale(1 / scale3, 1 / scale3); + buffCxt.translate(-translation.x, -translation.y); + } + if (options2.bg) { + buffCxt.globalCompositeOperation = "destination-over"; + buffCxt.fillStyle = options2.bg; + buffCxt.rect(0, 0, width3, height2); + buffCxt.fill(); + } + } + return buffCanvas; + }; + __name(b64ToBlob, "b64ToBlob"); + __name(b64UriToB64, "b64UriToB64"); + __name(output, "output"); + CRp$2.png = function(options2) { + return output(options2, this.bufferCanvasImage(options2), "image/png"); + }; + CRp$2.jpg = function(options2) { + return output(options2, this.bufferCanvasImage(options2), "image/jpeg"); + }; + CRp$1 = {}; + CRp$1.nodeShapeImpl = function(name, context, centerX, centerY, width3, height2, points, corners) { + switch (name) { + case "ellipse": + return this.drawEllipsePath(context, centerX, centerY, width3, height2); + case "polygon": + return this.drawPolygonPath(context, centerX, centerY, width3, height2, points); + case "round-polygon": + return this.drawRoundPolygonPath(context, centerX, centerY, width3, height2, points, corners); + case "roundrectangle": + case "round-rectangle": + return this.drawRoundRectanglePath(context, centerX, centerY, width3, height2, corners); + case "cutrectangle": + case "cut-rectangle": + return this.drawCutRectanglePath(context, centerX, centerY, width3, height2, points, corners); + case "bottomroundrectangle": + case "bottom-round-rectangle": + return this.drawBottomRoundRectanglePath(context, centerX, centerY, width3, height2, corners); + case "barrel": + return this.drawBarrelPath(context, centerX, centerY, width3, height2); + } + }; + CR = CanvasRenderer; + CRp = CanvasRenderer.prototype; + CRp.CANVAS_LAYERS = 3; + CRp.SELECT_BOX = 0; + CRp.DRAG = 1; + CRp.NODE = 2; + CRp.WEBGL = 3; + CRp.CANVAS_TYPES = ["2d", "2d", "2d", "webgl2"]; + CRp.BUFFER_COUNT = 3; + CRp.TEXTURE_BUFFER = 0; + CRp.MOTIONBLUR_BUFFER_NODE = 1; + CRp.MOTIONBLUR_BUFFER_DRAG = 2; + __name(CanvasRenderer, "CanvasRenderer"); + CRp.redrawHint = function(group2, bool2) { + var r2 = this; + switch (group2) { + case "eles": + r2.data.canvasNeedsRedraw[CRp.NODE] = bool2; + break; + case "drag": + r2.data.canvasNeedsRedraw[CRp.DRAG] = bool2; + break; + case "select": + r2.data.canvasNeedsRedraw[CRp.SELECT_BOX] = bool2; + break; + case "gc": + r2.data.gc = true; + break; + } + }; + pathsImpld = typeof Path2D !== "undefined"; + CRp.path2dEnabled = function(on3) { + if (on3 === void 0) { + return this.pathsEnabled; + } + this.pathsEnabled = on3 ? true : false; + }; + CRp.usePaths = function() { + return pathsImpld && this.pathsEnabled; + }; + CRp.setImgSmoothing = function(context, bool2) { + if (context.imageSmoothingEnabled != null) { + context.imageSmoothingEnabled = bool2; + } else { + context.webkitImageSmoothingEnabled = bool2; + context.mozImageSmoothingEnabled = bool2; + context.msImageSmoothingEnabled = bool2; + } + }; + CRp.getImgSmoothing = function(context) { + if (context.imageSmoothingEnabled != null) { + return context.imageSmoothingEnabled; + } else { + return context.webkitImageSmoothingEnabled || context.mozImageSmoothingEnabled || context.msImageSmoothingEnabled; + } + }; + CRp.makeOffscreenCanvas = function(width3, height2) { + var canvas; + if ((typeof OffscreenCanvas === "undefined" ? "undefined" : _typeof(OffscreenCanvas)) !== "undefined") { + canvas = new OffscreenCanvas(width3, height2); + } else { + var containerWindow = this.cy.window(); + var document2 = containerWindow.document; + canvas = document2.createElement("canvas"); + canvas.width = width3; + canvas.height = height2; + } + return canvas; + }; + [CRp$b, CRp$a, CRp$9, CRp$8, CRp$7, CRp$6, CRp$5, CRp$4, CRp$3, CRp$2, CRp$1].forEach(function(props) { + extend4(CRp, props); + }); + renderer2 = [{ + name: "null", + impl: NullRenderer + }, { + name: "base", + impl: BR + }, { + name: "canvas", + impl: CR + }]; + incExts = [{ + type: "layout", + extensions: layout4 + }, { + type: "renderer", + extensions: renderer2 + }]; + extensions = {}; + modules = {}; + __name(setExtension, "setExtension"); + __name(getExtension, "getExtension"); + __name(setModule, "setModule"); + __name(getModule, "getModule"); + extension2 = /* @__PURE__ */ __name(function extension3() { + if (arguments.length === 2) { + return getExtension.apply(null, arguments); + } else if (arguments.length === 3) { + return setExtension.apply(null, arguments); + } else if (arguments.length === 4) { + return getModule.apply(null, arguments); + } else if (arguments.length === 5) { + return setModule.apply(null, arguments); + } else { + error("Invalid extension access syntax"); + } + }, "extension"); + Core.prototype.extension = extension2; + incExts.forEach(function(group2) { + group2.extensions.forEach(function(ext) { + setExtension(group2.type, ext.name, ext.impl); + }); + }); + _Stylesheet = /* @__PURE__ */ __name(function Stylesheet() { + if (!(this instanceof _Stylesheet)) { + return new _Stylesheet(); + } + this.length = 0; + }, "Stylesheet"); + sheetfn = _Stylesheet.prototype; + sheetfn.instanceString = function() { + return "stylesheet"; + }; + sheetfn.selector = function(selector) { + var i2 = this.length++; + this[i2] = { + selector, + properties: [] + }; + return this; + }; + sheetfn.css = function(name, value2) { + var i2 = this.length - 1; + if (string(name)) { + this[i2].properties.push({ + name, + value: value2 + }); + } else if (plainObject(name)) { + var map6 = name; + var propNames = Object.keys(map6); + for (var j3 = 0; j3 < propNames.length; j3++) { + var key = propNames[j3]; + var mapVal = map6[key]; + if (mapVal == null) { + continue; + } + var prop = _Style.properties[key] || _Style.properties[dash2camel(key)]; + if (prop == null) { + continue; + } + var _name = prop.name; + var _value = mapVal; + this[i2].properties.push({ + name: _name, + value: _value + }); + } + } + return this; + }; + sheetfn.style = sheetfn.css; + sheetfn.generateStyle = function(cy) { + var style3 = new _Style(cy); + return this.appendToStyle(style3); + }; + sheetfn.appendToStyle = function(style3) { + for (var i2 = 0; i2 < this.length; i2++) { + var context = this[i2]; + var selector = context.selector; + var props = context.properties; + style3.selector(selector); + for (var j3 = 0; j3 < props.length; j3++) { + var prop = props[j3]; + style3.css(prop.name, prop.value); + } + } + return style3; + }; + version2 = "3.33.1"; + cytoscape2 = /* @__PURE__ */ __name(function cytoscape3(options2) { + if (options2 === void 0) { + options2 = {}; + } + if (plainObject(options2)) { + return new Core(options2); + } else if (string(options2)) { + return extension2.apply(extension2, arguments); + } + }, "cytoscape"); + cytoscape2.use = function(ext) { + var args = Array.prototype.slice.call(arguments, 1); + args.unshift(cytoscape2); + ext.apply(null, args); + return this; + }; + cytoscape2.warnings = function(bool2) { + return warnings(bool2); + }; + cytoscape2.version = version2; + cytoscape2.stylesheet = cytoscape2.Stylesheet = _Stylesheet; + } + }); + + // ../../node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js + var require_layout_base = __commonJS({ + "../../node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js"(exports2, module2) { + "use strict"; + (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root4, factory) { + if (typeof exports2 === "object" && typeof module2 === "object") + module2.exports = factory(); + else if (typeof define === "function" && define.amd) + define([], factory); + else if (typeof exports2 === "object") + exports2["layoutBase"] = factory(); + else + root4["layoutBase"] = factory(); + }), "webpackUniversalModuleDefinition"))(exports2, function() { + return ( + /******/ + (function(modules2) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if (installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + var module3 = installedModules[moduleId] = { + /******/ + i: moduleId, + /******/ + l: false, + /******/ + exports: {} + /******/ + }; + modules2[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__); + module3.l = true; + return module3.exports; + } + __name(__webpack_require__, "__webpack_require__"); + __webpack_require__.m = modules2; + __webpack_require__.c = installedModules; + __webpack_require__.i = function(value2) { + return value2; + }; + __webpack_require__.d = function(exports3, name, getter) { + if (!__webpack_require__.o(exports3, name)) { + Object.defineProperty(exports3, name, { + /******/ + configurable: false, + /******/ + enumerable: true, + /******/ + get: getter + /******/ + }); + } + }; + __webpack_require__.n = function(module3) { + var getter = module3 && module3.__esModule ? ( + /******/ + /* @__PURE__ */ __name(function getDefault() { + return module3["default"]; + }, "getDefault") + ) : ( + /******/ + /* @__PURE__ */ __name(function getModuleExports() { + return module3; + }, "getModuleExports") + ); + __webpack_require__.d(getter, "a", getter); + return getter; + }; + __webpack_require__.o = function(object3, property3) { + return Object.prototype.hasOwnProperty.call(object3, property3); + }; + __webpack_require__.p = ""; + return __webpack_require__(__webpack_require__.s = 26); + })([ + /* 0 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function LayoutConstants() { + } + __name(LayoutConstants, "LayoutConstants"); + LayoutConstants.QUALITY = 1; + LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED = false; + LayoutConstants.DEFAULT_INCREMENTAL = false; + LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT = true; + LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT = false; + LayoutConstants.DEFAULT_ANIMATION_PERIOD = 50; + LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = false; + LayoutConstants.DEFAULT_GRAPH_MARGIN = 15; + LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = false; + LayoutConstants.SIMPLE_NODE_SIZE = 40; + LayoutConstants.SIMPLE_NODE_HALF_SIZE = LayoutConstants.SIMPLE_NODE_SIZE / 2; + LayoutConstants.EMPTY_COMPOUND_NODE_SIZE = 40; + LayoutConstants.MIN_EDGE_LENGTH = 1; + LayoutConstants.WORLD_BOUNDARY = 1e6; + LayoutConstants.INITIAL_WORLD_BOUNDARY = LayoutConstants.WORLD_BOUNDARY / 1e3; + LayoutConstants.WORLD_CENTER_X = 1200; + LayoutConstants.WORLD_CENTER_Y = 900; + module3.exports = LayoutConstants; + }), + /* 1 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraphObject = __webpack_require__(2); + var IGeometry = __webpack_require__(8); + var IMath = __webpack_require__(9); + function LEdge(source, target, vEdge) { + LGraphObject.call(this, vEdge); + this.isOverlapingSourceAndTarget = false; + this.vGraphObject = vEdge; + this.bendpoints = []; + this.source = source; + this.target = target; + } + __name(LEdge, "LEdge"); + LEdge.prototype = Object.create(LGraphObject.prototype); + for (var prop in LGraphObject) { + LEdge[prop] = LGraphObject[prop]; + } + LEdge.prototype.getSource = function() { + return this.source; + }; + LEdge.prototype.getTarget = function() { + return this.target; + }; + LEdge.prototype.isInterGraph = function() { + return this.isInterGraph; + }; + LEdge.prototype.getLength = function() { + return this.length; + }; + LEdge.prototype.isOverlapingSourceAndTarget = function() { + return this.isOverlapingSourceAndTarget; + }; + LEdge.prototype.getBendpoints = function() { + return this.bendpoints; + }; + LEdge.prototype.getLca = function() { + return this.lca; + }; + LEdge.prototype.getSourceInLca = function() { + return this.sourceInLca; + }; + LEdge.prototype.getTargetInLca = function() { + return this.targetInLca; + }; + LEdge.prototype.getOtherEnd = function(node2) { + if (this.source === node2) { + return this.target; + } else if (this.target === node2) { + return this.source; + } else { + throw "Node is not incident with this edge"; + } + }; + LEdge.prototype.getOtherEndInGraph = function(node2, graph) { + var otherEnd = this.getOtherEnd(node2); + var root4 = graph.getGraphManager().getRoot(); + while (true) { + if (otherEnd.getOwner() == graph) { + return otherEnd; + } + if (otherEnd.getOwner() == root4) { + break; + } + otherEnd = otherEnd.getOwner().getParent(); + } + return null; + }; + LEdge.prototype.updateLength = function() { + var clipPointCoordinates = new Array(4); + this.isOverlapingSourceAndTarget = IGeometry.getIntersection(this.target.getRect(), this.source.getRect(), clipPointCoordinates); + if (!this.isOverlapingSourceAndTarget) { + this.lengthX = clipPointCoordinates[0] - clipPointCoordinates[2]; + this.lengthY = clipPointCoordinates[1] - clipPointCoordinates[3]; + if (Math.abs(this.lengthX) < 1) { + this.lengthX = IMath.sign(this.lengthX); + } + if (Math.abs(this.lengthY) < 1) { + this.lengthY = IMath.sign(this.lengthY); + } + this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY); + } + }; + LEdge.prototype.updateLengthSimple = function() { + this.lengthX = this.target.getCenterX() - this.source.getCenterX(); + this.lengthY = this.target.getCenterY() - this.source.getCenterY(); + if (Math.abs(this.lengthX) < 1) { + this.lengthX = IMath.sign(this.lengthX); + } + if (Math.abs(this.lengthY) < 1) { + this.lengthY = IMath.sign(this.lengthY); + } + this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY); + }; + module3.exports = LEdge; + }), + /* 2 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function LGraphObject(vGraphObject) { + this.vGraphObject = vGraphObject; + } + __name(LGraphObject, "LGraphObject"); + module3.exports = LGraphObject; + }), + /* 3 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraphObject = __webpack_require__(2); + var Integer = __webpack_require__(10); + var RectangleD = __webpack_require__(13); + var LayoutConstants = __webpack_require__(0); + var RandomSeed = __webpack_require__(16); + var PointD = __webpack_require__(4); + function LNode(gm, loc, size4, vNode) { + if (size4 == null && vNode == null) { + vNode = loc; + } + LGraphObject.call(this, vNode); + if (gm.graphManager != null) gm = gm.graphManager; + this.estimatedSize = Integer.MIN_VALUE; + this.inclusionTreeDepth = Integer.MAX_VALUE; + this.vGraphObject = vNode; + this.edges = []; + this.graphManager = gm; + if (size4 != null && loc != null) this.rect = new RectangleD(loc.x, loc.y, size4.width, size4.height); + else this.rect = new RectangleD(); + } + __name(LNode, "LNode"); + LNode.prototype = Object.create(LGraphObject.prototype); + for (var prop in LGraphObject) { + LNode[prop] = LGraphObject[prop]; + } + LNode.prototype.getEdges = function() { + return this.edges; + }; + LNode.prototype.getChild = function() { + return this.child; + }; + LNode.prototype.getOwner = function() { + return this.owner; + }; + LNode.prototype.getWidth = function() { + return this.rect.width; + }; + LNode.prototype.setWidth = function(width3) { + this.rect.width = width3; + }; + LNode.prototype.getHeight = function() { + return this.rect.height; + }; + LNode.prototype.setHeight = function(height2) { + this.rect.height = height2; + }; + LNode.prototype.getCenterX = function() { + return this.rect.x + this.rect.width / 2; + }; + LNode.prototype.getCenterY = function() { + return this.rect.y + this.rect.height / 2; + }; + LNode.prototype.getCenter = function() { + return new PointD(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2); + }; + LNode.prototype.getLocation = function() { + return new PointD(this.rect.x, this.rect.y); + }; + LNode.prototype.getRect = function() { + return this.rect; + }; + LNode.prototype.getDiagonal = function() { + return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height); + }; + LNode.prototype.getHalfTheDiagonal = function() { + return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2; + }; + LNode.prototype.setRect = function(upperLeft, dimension) { + this.rect.x = upperLeft.x; + this.rect.y = upperLeft.y; + this.rect.width = dimension.width; + this.rect.height = dimension.height; + }; + LNode.prototype.setCenter = function(cx, cy) { + this.rect.x = cx - this.rect.width / 2; + this.rect.y = cy - this.rect.height / 2; + }; + LNode.prototype.setLocation = function(x5, y6) { + this.rect.x = x5; + this.rect.y = y6; + }; + LNode.prototype.moveBy = function(dx, dy) { + this.rect.x += dx; + this.rect.y += dy; + }; + LNode.prototype.getEdgeListToNode = function(to) { + var edgeList2 = []; + var edge; + var self2 = this; + self2.edges.forEach(function(edge2) { + if (edge2.target == to) { + if (edge2.source != self2) throw "Incorrect edge source!"; + edgeList2.push(edge2); + } + }); + return edgeList2; + }; + LNode.prototype.getEdgesBetween = function(other) { + var edgeList2 = []; + var edge; + var self2 = this; + self2.edges.forEach(function(edge2) { + if (!(edge2.source == self2 || edge2.target == self2)) throw "Incorrect edge source and/or target"; + if (edge2.target == other || edge2.source == other) { + edgeList2.push(edge2); + } + }); + return edgeList2; + }; + LNode.prototype.getNeighborsList = function() { + var neighbors = /* @__PURE__ */ new Set(); + var self2 = this; + self2.edges.forEach(function(edge) { + if (edge.source == self2) { + neighbors.add(edge.target); + } else { + if (edge.target != self2) { + throw "Incorrect incidency!"; + } + neighbors.add(edge.source); + } + }); + return neighbors; + }; + LNode.prototype.withChildren = function() { + var withNeighborsList = /* @__PURE__ */ new Set(); + var childNode; + var children2; + withNeighborsList.add(this); + if (this.child != null) { + var nodes5 = this.child.getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + childNode = nodes5[i2]; + children2 = childNode.withChildren(); + children2.forEach(function(node2) { + withNeighborsList.add(node2); + }); + } + } + return withNeighborsList; + }; + LNode.prototype.getNoOfChildren = function() { + var noOfChildren = 0; + var childNode; + if (this.child == null) { + noOfChildren = 1; + } else { + var nodes5 = this.child.getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + childNode = nodes5[i2]; + noOfChildren += childNode.getNoOfChildren(); + } + } + if (noOfChildren == 0) { + noOfChildren = 1; + } + return noOfChildren; + }; + LNode.prototype.getEstimatedSize = function() { + if (this.estimatedSize == Integer.MIN_VALUE) { + throw "assert failed"; + } + return this.estimatedSize; + }; + LNode.prototype.calcEstimatedSize = function() { + if (this.child == null) { + return this.estimatedSize = (this.rect.width + this.rect.height) / 2; + } else { + this.estimatedSize = this.child.calcEstimatedSize(); + this.rect.width = this.estimatedSize; + this.rect.height = this.estimatedSize; + return this.estimatedSize; + } + }; + LNode.prototype.scatter = function() { + var randomCenterX; + var randomCenterY; + var minX = -LayoutConstants.INITIAL_WORLD_BOUNDARY; + var maxX = LayoutConstants.INITIAL_WORLD_BOUNDARY; + randomCenterX = LayoutConstants.WORLD_CENTER_X + RandomSeed.nextDouble() * (maxX - minX) + minX; + var minY = -LayoutConstants.INITIAL_WORLD_BOUNDARY; + var maxY = LayoutConstants.INITIAL_WORLD_BOUNDARY; + randomCenterY = LayoutConstants.WORLD_CENTER_Y + RandomSeed.nextDouble() * (maxY - minY) + minY; + this.rect.x = randomCenterX; + this.rect.y = randomCenterY; + }; + LNode.prototype.updateBounds = function() { + if (this.getChild() == null) { + throw "assert failed"; + } + if (this.getChild().getNodes().length != 0) { + var childGraph = this.getChild(); + childGraph.updateBounds(true); + this.rect.x = childGraph.getLeft(); + this.rect.y = childGraph.getTop(); + this.setWidth(childGraph.getRight() - childGraph.getLeft()); + this.setHeight(childGraph.getBottom() - childGraph.getTop()); + if (LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS) { + var width3 = childGraph.getRight() - childGraph.getLeft(); + var height2 = childGraph.getBottom() - childGraph.getTop(); + if (this.labelWidth > width3) { + this.rect.x -= (this.labelWidth - width3) / 2; + this.setWidth(this.labelWidth); + } + if (this.labelHeight > height2) { + if (this.labelPos == "center") { + this.rect.y -= (this.labelHeight - height2) / 2; + } else if (this.labelPos == "top") { + this.rect.y -= this.labelHeight - height2; + } + this.setHeight(this.labelHeight); + } + } + } + }; + LNode.prototype.getInclusionTreeDepth = function() { + if (this.inclusionTreeDepth == Integer.MAX_VALUE) { + throw "assert failed"; + } + return this.inclusionTreeDepth; + }; + LNode.prototype.transform = function(trans) { + var left3 = this.rect.x; + if (left3 > LayoutConstants.WORLD_BOUNDARY) { + left3 = LayoutConstants.WORLD_BOUNDARY; + } else if (left3 < -LayoutConstants.WORLD_BOUNDARY) { + left3 = -LayoutConstants.WORLD_BOUNDARY; + } + var top2 = this.rect.y; + if (top2 > LayoutConstants.WORLD_BOUNDARY) { + top2 = LayoutConstants.WORLD_BOUNDARY; + } else if (top2 < -LayoutConstants.WORLD_BOUNDARY) { + top2 = -LayoutConstants.WORLD_BOUNDARY; + } + var leftTop = new PointD(left3, top2); + var vLeftTop = trans.inverseTransformPoint(leftTop); + this.setLocation(vLeftTop.x, vLeftTop.y); + }; + LNode.prototype.getLeft = function() { + return this.rect.x; + }; + LNode.prototype.getRight = function() { + return this.rect.x + this.rect.width; + }; + LNode.prototype.getTop = function() { + return this.rect.y; + }; + LNode.prototype.getBottom = function() { + return this.rect.y + this.rect.height; + }; + LNode.prototype.getParent = function() { + if (this.owner == null) { + return null; + } + return this.owner.getParent(); + }; + module3.exports = LNode; + }), + /* 4 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function PointD(x5, y6) { + if (x5 == null && y6 == null) { + this.x = 0; + this.y = 0; + } else { + this.x = x5; + this.y = y6; + } + } + __name(PointD, "PointD"); + PointD.prototype.getX = function() { + return this.x; + }; + PointD.prototype.getY = function() { + return this.y; + }; + PointD.prototype.setX = function(x5) { + this.x = x5; + }; + PointD.prototype.setY = function(y6) { + this.y = y6; + }; + PointD.prototype.getDifference = function(pt) { + return new DimensionD(this.x - pt.x, this.y - pt.y); + }; + PointD.prototype.getCopy = function() { + return new PointD(this.x, this.y); + }; + PointD.prototype.translate = function(dim) { + this.x += dim.width; + this.y += dim.height; + return this; + }; + module3.exports = PointD; + }), + /* 5 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraphObject = __webpack_require__(2); + var Integer = __webpack_require__(10); + var LayoutConstants = __webpack_require__(0); + var LGraphManager = __webpack_require__(6); + var LNode = __webpack_require__(3); + var LEdge = __webpack_require__(1); + var RectangleD = __webpack_require__(13); + var Point3 = __webpack_require__(12); + var LinkedList = __webpack_require__(11); + function LGraph(parent4, obj2, vGraph) { + LGraphObject.call(this, vGraph); + this.estimatedSize = Integer.MIN_VALUE; + this.margin = LayoutConstants.DEFAULT_GRAPH_MARGIN; + this.edges = []; + this.nodes = []; + this.isConnected = false; + this.parent = parent4; + if (obj2 != null && obj2 instanceof LGraphManager) { + this.graphManager = obj2; + } else if (obj2 != null && obj2 instanceof Layout) { + this.graphManager = obj2.graphManager; + } + } + __name(LGraph, "LGraph"); + LGraph.prototype = Object.create(LGraphObject.prototype); + for (var prop in LGraphObject) { + LGraph[prop] = LGraphObject[prop]; + } + LGraph.prototype.getNodes = function() { + return this.nodes; + }; + LGraph.prototype.getEdges = function() { + return this.edges; + }; + LGraph.prototype.getGraphManager = function() { + return this.graphManager; + }; + LGraph.prototype.getParent = function() { + return this.parent; + }; + LGraph.prototype.getLeft = function() { + return this.left; + }; + LGraph.prototype.getRight = function() { + return this.right; + }; + LGraph.prototype.getTop = function() { + return this.top; + }; + LGraph.prototype.getBottom = function() { + return this.bottom; + }; + LGraph.prototype.isConnected = function() { + return this.isConnected; + }; + LGraph.prototype.add = function(obj1, sourceNode, targetNode) { + if (sourceNode == null && targetNode == null) { + var newNode = obj1; + if (this.graphManager == null) { + throw "Graph has no graph mgr!"; + } + if (this.getNodes().indexOf(newNode) > -1) { + throw "Node already in graph!"; + } + newNode.owner = this; + this.getNodes().push(newNode); + return newNode; + } else { + var newEdge = obj1; + if (!(this.getNodes().indexOf(sourceNode) > -1 && this.getNodes().indexOf(targetNode) > -1)) { + throw "Source or target not in graph!"; + } + if (!(sourceNode.owner == targetNode.owner && sourceNode.owner == this)) { + throw "Both owners must be this graph!"; + } + if (sourceNode.owner != targetNode.owner) { + return null; + } + newEdge.source = sourceNode; + newEdge.target = targetNode; + newEdge.isInterGraph = false; + this.getEdges().push(newEdge); + sourceNode.edges.push(newEdge); + if (targetNode != sourceNode) { + targetNode.edges.push(newEdge); + } + return newEdge; + } + }; + LGraph.prototype.remove = function(obj) { + var node2 = obj; + if (obj instanceof LNode) { + if (node2 == null) { + throw "Node is null!"; + } + if (!(node2.owner != null && node2.owner == this)) { + throw "Owner graph is invalid!"; + } + if (this.graphManager == null) { + throw "Owner graph manager is invalid!"; + } + var edgesToBeRemoved = node2.edges.slice(); + var edge; + var s2 = edgesToBeRemoved.length; + for (var i2 = 0; i2 < s2; i2++) { + edge = edgesToBeRemoved[i2]; + if (edge.isInterGraph) { + this.graphManager.remove(edge); + } else { + edge.source.owner.remove(edge); + } + } + var index = this.nodes.indexOf(node2); + if (index == -1) { + throw "Node not in owner node list!"; + } + this.nodes.splice(index, 1); + } else if (obj instanceof LEdge) { + var edge = obj; + if (edge == null) { + throw "Edge is null!"; + } + if (!(edge.source != null && edge.target != null)) { + throw "Source and/or target is null!"; + } + if (!(edge.source.owner != null && edge.target.owner != null && edge.source.owner == this && edge.target.owner == this)) { + throw "Source and/or target owner is invalid!"; + } + var sourceIndex = edge.source.edges.indexOf(edge); + var targetIndex = edge.target.edges.indexOf(edge); + if (!(sourceIndex > -1 && targetIndex > -1)) { + throw "Source and/or target doesn't know this edge!"; + } + edge.source.edges.splice(sourceIndex, 1); + if (edge.target != edge.source) { + edge.target.edges.splice(targetIndex, 1); + } + var index = edge.source.owner.getEdges().indexOf(edge); + if (index == -1) { + throw "Not in owner's edge list!"; + } + edge.source.owner.getEdges().splice(index, 1); + } + }; + LGraph.prototype.updateLeftTop = function() { + var top2 = Integer.MAX_VALUE; + var left3 = Integer.MAX_VALUE; + var nodeTop; + var nodeLeft; + var margin; + var nodes5 = this.getNodes(); + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + var lNode = nodes5[i2]; + nodeTop = lNode.getTop(); + nodeLeft = lNode.getLeft(); + if (top2 > nodeTop) { + top2 = nodeTop; + } + if (left3 > nodeLeft) { + left3 = nodeLeft; + } + } + if (top2 == Integer.MAX_VALUE) { + return null; + } + if (nodes5[0].getParent().paddingLeft != void 0) { + margin = nodes5[0].getParent().paddingLeft; + } else { + margin = this.margin; + } + this.left = left3 - margin; + this.top = top2 - margin; + return new Point3(this.left, this.top); + }; + LGraph.prototype.updateBounds = function(recursive) { + var left3 = Integer.MAX_VALUE; + var right3 = -Integer.MAX_VALUE; + var top2 = Integer.MAX_VALUE; + var bottom2 = -Integer.MAX_VALUE; + var nodeLeft; + var nodeRight; + var nodeTop; + var nodeBottom; + var margin; + var nodes5 = this.nodes; + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + var lNode = nodes5[i2]; + if (recursive && lNode.child != null) { + lNode.updateBounds(); + } + nodeLeft = lNode.getLeft(); + nodeRight = lNode.getRight(); + nodeTop = lNode.getTop(); + nodeBottom = lNode.getBottom(); + if (left3 > nodeLeft) { + left3 = nodeLeft; + } + if (right3 < nodeRight) { + right3 = nodeRight; + } + if (top2 > nodeTop) { + top2 = nodeTop; + } + if (bottom2 < nodeBottom) { + bottom2 = nodeBottom; + } + } + var boundingRect = new RectangleD(left3, top2, right3 - left3, bottom2 - top2); + if (left3 == Integer.MAX_VALUE) { + this.left = this.parent.getLeft(); + this.right = this.parent.getRight(); + this.top = this.parent.getTop(); + this.bottom = this.parent.getBottom(); + } + if (nodes5[0].getParent().paddingLeft != void 0) { + margin = nodes5[0].getParent().paddingLeft; + } else { + margin = this.margin; + } + this.left = boundingRect.x - margin; + this.right = boundingRect.x + boundingRect.width + margin; + this.top = boundingRect.y - margin; + this.bottom = boundingRect.y + boundingRect.height + margin; + }; + LGraph.calculateBounds = function(nodes5) { + var left3 = Integer.MAX_VALUE; + var right3 = -Integer.MAX_VALUE; + var top2 = Integer.MAX_VALUE; + var bottom2 = -Integer.MAX_VALUE; + var nodeLeft; + var nodeRight; + var nodeTop; + var nodeBottom; + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + var lNode = nodes5[i2]; + nodeLeft = lNode.getLeft(); + nodeRight = lNode.getRight(); + nodeTop = lNode.getTop(); + nodeBottom = lNode.getBottom(); + if (left3 > nodeLeft) { + left3 = nodeLeft; + } + if (right3 < nodeRight) { + right3 = nodeRight; + } + if (top2 > nodeTop) { + top2 = nodeTop; + } + if (bottom2 < nodeBottom) { + bottom2 = nodeBottom; + } + } + var boundingRect = new RectangleD(left3, top2, right3 - left3, bottom2 - top2); + return boundingRect; + }; + LGraph.prototype.getInclusionTreeDepth = function() { + if (this == this.graphManager.getRoot()) { + return 1; + } else { + return this.parent.getInclusionTreeDepth(); + } + }; + LGraph.prototype.getEstimatedSize = function() { + if (this.estimatedSize == Integer.MIN_VALUE) { + throw "assert failed"; + } + return this.estimatedSize; + }; + LGraph.prototype.calcEstimatedSize = function() { + var size4 = 0; + var nodes5 = this.nodes; + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + var lNode = nodes5[i2]; + size4 += lNode.calcEstimatedSize(); + } + if (size4 == 0) { + this.estimatedSize = LayoutConstants.EMPTY_COMPOUND_NODE_SIZE; + } else { + this.estimatedSize = size4 / Math.sqrt(this.nodes.length); + } + return this.estimatedSize; + }; + LGraph.prototype.updateConnected = function() { + var self2 = this; + if (this.nodes.length == 0) { + this.isConnected = true; + return; + } + var queue = new LinkedList(); + var visited = /* @__PURE__ */ new Set(); + var currentNode = this.nodes[0]; + var neighborEdges; + var currentNeighbor; + var childrenOfNode = currentNode.withChildren(); + childrenOfNode.forEach(function(node2) { + queue.push(node2); + visited.add(node2); + }); + while (queue.length !== 0) { + currentNode = queue.shift(); + neighborEdges = currentNode.getEdges(); + var size4 = neighborEdges.length; + for (var i2 = 0; i2 < size4; i2++) { + var neighborEdge = neighborEdges[i2]; + currentNeighbor = neighborEdge.getOtherEndInGraph(currentNode, this); + if (currentNeighbor != null && !visited.has(currentNeighbor)) { + var childrenOfNeighbor = currentNeighbor.withChildren(); + childrenOfNeighbor.forEach(function(node2) { + queue.push(node2); + visited.add(node2); + }); + } + } + } + this.isConnected = false; + if (visited.size >= this.nodes.length) { + var noOfVisitedInThisGraph = 0; + visited.forEach(function(visitedNode) { + if (visitedNode.owner == self2) { + noOfVisitedInThisGraph++; + } + }); + if (noOfVisitedInThisGraph == this.nodes.length) { + this.isConnected = true; + } + } + }; + module3.exports = LGraph; + }), + /* 6 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraph; + var LEdge = __webpack_require__(1); + function LGraphManager(layout7) { + LGraph = __webpack_require__(5); + this.layout = layout7; + this.graphs = []; + this.edges = []; + } + __name(LGraphManager, "LGraphManager"); + LGraphManager.prototype.addRoot = function() { + var ngraph = this.layout.newGraph(); + var nnode = this.layout.newNode(null); + var root4 = this.add(ngraph, nnode); + this.setRootGraph(root4); + return this.rootGraph; + }; + LGraphManager.prototype.add = function(newGraph, parentNode, newEdge, sourceNode, targetNode) { + if (newEdge == null && sourceNode == null && targetNode == null) { + if (newGraph == null) { + throw "Graph is null!"; + } + if (parentNode == null) { + throw "Parent node is null!"; + } + if (this.graphs.indexOf(newGraph) > -1) { + throw "Graph already in this graph mgr!"; + } + this.graphs.push(newGraph); + if (newGraph.parent != null) { + throw "Already has a parent!"; + } + if (parentNode.child != null) { + throw "Already has a child!"; + } + newGraph.parent = parentNode; + parentNode.child = newGraph; + return newGraph; + } else { + targetNode = newEdge; + sourceNode = parentNode; + newEdge = newGraph; + var sourceGraph = sourceNode.getOwner(); + var targetGraph = targetNode.getOwner(); + if (!(sourceGraph != null && sourceGraph.getGraphManager() == this)) { + throw "Source not in this graph mgr!"; + } + if (!(targetGraph != null && targetGraph.getGraphManager() == this)) { + throw "Target not in this graph mgr!"; + } + if (sourceGraph == targetGraph) { + newEdge.isInterGraph = false; + return sourceGraph.add(newEdge, sourceNode, targetNode); + } else { + newEdge.isInterGraph = true; + newEdge.source = sourceNode; + newEdge.target = targetNode; + if (this.edges.indexOf(newEdge) > -1) { + throw "Edge already in inter-graph edge list!"; + } + this.edges.push(newEdge); + if (!(newEdge.source != null && newEdge.target != null)) { + throw "Edge source and/or target is null!"; + } + if (!(newEdge.source.edges.indexOf(newEdge) == -1 && newEdge.target.edges.indexOf(newEdge) == -1)) { + throw "Edge already in source and/or target incidency list!"; + } + newEdge.source.edges.push(newEdge); + newEdge.target.edges.push(newEdge); + return newEdge; + } + } + }; + LGraphManager.prototype.remove = function(lObj) { + if (lObj instanceof LGraph) { + var graph = lObj; + if (graph.getGraphManager() != this) { + throw "Graph not in this graph mgr"; + } + if (!(graph == this.rootGraph || graph.parent != null && graph.parent.graphManager == this)) { + throw "Invalid parent node!"; + } + var edgesToBeRemoved = []; + edgesToBeRemoved = edgesToBeRemoved.concat(graph.getEdges()); + var edge; + var s2 = edgesToBeRemoved.length; + for (var i2 = 0; i2 < s2; i2++) { + edge = edgesToBeRemoved[i2]; + graph.remove(edge); + } + var nodesToBeRemoved = []; + nodesToBeRemoved = nodesToBeRemoved.concat(graph.getNodes()); + var node2; + s2 = nodesToBeRemoved.length; + for (var i2 = 0; i2 < s2; i2++) { + node2 = nodesToBeRemoved[i2]; + graph.remove(node2); + } + if (graph == this.rootGraph) { + this.setRootGraph(null); + } + var index = this.graphs.indexOf(graph); + this.graphs.splice(index, 1); + graph.parent = null; + } else if (lObj instanceof LEdge) { + edge = lObj; + if (edge == null) { + throw "Edge is null!"; + } + if (!edge.isInterGraph) { + throw "Not an inter-graph edge!"; + } + if (!(edge.source != null && edge.target != null)) { + throw "Source and/or target is null!"; + } + if (!(edge.source.edges.indexOf(edge) != -1 && edge.target.edges.indexOf(edge) != -1)) { + throw "Source and/or target doesn't know this edge!"; + } + var index = edge.source.edges.indexOf(edge); + edge.source.edges.splice(index, 1); + index = edge.target.edges.indexOf(edge); + edge.target.edges.splice(index, 1); + if (!(edge.source.owner != null && edge.source.owner.getGraphManager() != null)) { + throw "Edge owner graph or owner graph manager is null!"; + } + if (edge.source.owner.getGraphManager().edges.indexOf(edge) == -1) { + throw "Not in owner graph manager's edge list!"; + } + var index = edge.source.owner.getGraphManager().edges.indexOf(edge); + edge.source.owner.getGraphManager().edges.splice(index, 1); + } + }; + LGraphManager.prototype.updateBounds = function() { + this.rootGraph.updateBounds(true); + }; + LGraphManager.prototype.getGraphs = function() { + return this.graphs; + }; + LGraphManager.prototype.getAllNodes = function() { + if (this.allNodes == null) { + var nodeList = []; + var graphs = this.getGraphs(); + var s2 = graphs.length; + for (var i2 = 0; i2 < s2; i2++) { + nodeList = nodeList.concat(graphs[i2].getNodes()); + } + this.allNodes = nodeList; + } + return this.allNodes; + }; + LGraphManager.prototype.resetAllNodes = function() { + this.allNodes = null; + }; + LGraphManager.prototype.resetAllEdges = function() { + this.allEdges = null; + }; + LGraphManager.prototype.resetAllNodesToApplyGravitation = function() { + this.allNodesToApplyGravitation = null; + }; + LGraphManager.prototype.getAllEdges = function() { + if (this.allEdges == null) { + var edgeList2 = []; + var graphs = this.getGraphs(); + var s2 = graphs.length; + for (var i2 = 0; i2 < graphs.length; i2++) { + edgeList2 = edgeList2.concat(graphs[i2].getEdges()); + } + edgeList2 = edgeList2.concat(this.edges); + this.allEdges = edgeList2; + } + return this.allEdges; + }; + LGraphManager.prototype.getAllNodesToApplyGravitation = function() { + return this.allNodesToApplyGravitation; + }; + LGraphManager.prototype.setAllNodesToApplyGravitation = function(nodeList) { + if (this.allNodesToApplyGravitation != null) { + throw "assert failed"; + } + this.allNodesToApplyGravitation = nodeList; + }; + LGraphManager.prototype.getRoot = function() { + return this.rootGraph; + }; + LGraphManager.prototype.setRootGraph = function(graph) { + if (graph.getGraphManager() != this) { + throw "Root not in this graph mgr!"; + } + this.rootGraph = graph; + if (graph.parent == null) { + graph.parent = this.layout.newNode("Root node"); + } + }; + LGraphManager.prototype.getLayout = function() { + return this.layout; + }; + LGraphManager.prototype.isOneAncestorOfOther = function(firstNode, secondNode) { + if (!(firstNode != null && secondNode != null)) { + throw "assert failed"; + } + if (firstNode == secondNode) { + return true; + } + var ownerGraph = firstNode.getOwner(); + var parentNode; + do { + parentNode = ownerGraph.getParent(); + if (parentNode == null) { + break; + } + if (parentNode == secondNode) { + return true; + } + ownerGraph = parentNode.getOwner(); + if (ownerGraph == null) { + break; + } + } while (true); + ownerGraph = secondNode.getOwner(); + do { + parentNode = ownerGraph.getParent(); + if (parentNode == null) { + break; + } + if (parentNode == firstNode) { + return true; + } + ownerGraph = parentNode.getOwner(); + if (ownerGraph == null) { + break; + } + } while (true); + return false; + }; + LGraphManager.prototype.calcLowestCommonAncestors = function() { + var edge; + var sourceNode; + var targetNode; + var sourceAncestorGraph; + var targetAncestorGraph; + var edges3 = this.getAllEdges(); + var s2 = edges3.length; + for (var i2 = 0; i2 < s2; i2++) { + edge = edges3[i2]; + sourceNode = edge.source; + targetNode = edge.target; + edge.lca = null; + edge.sourceInLca = sourceNode; + edge.targetInLca = targetNode; + if (sourceNode == targetNode) { + edge.lca = sourceNode.getOwner(); + continue; + } + sourceAncestorGraph = sourceNode.getOwner(); + while (edge.lca == null) { + edge.targetInLca = targetNode; + targetAncestorGraph = targetNode.getOwner(); + while (edge.lca == null) { + if (targetAncestorGraph == sourceAncestorGraph) { + edge.lca = targetAncestorGraph; + break; + } + if (targetAncestorGraph == this.rootGraph) { + break; + } + if (edge.lca != null) { + throw "assert failed"; + } + edge.targetInLca = targetAncestorGraph.getParent(); + targetAncestorGraph = edge.targetInLca.getOwner(); + } + if (sourceAncestorGraph == this.rootGraph) { + break; + } + if (edge.lca == null) { + edge.sourceInLca = sourceAncestorGraph.getParent(); + sourceAncestorGraph = edge.sourceInLca.getOwner(); + } + } + if (edge.lca == null) { + throw "assert failed"; + } + } + }; + LGraphManager.prototype.calcLowestCommonAncestor = function(firstNode, secondNode) { + if (firstNode == secondNode) { + return firstNode.getOwner(); + } + var firstOwnerGraph = firstNode.getOwner(); + do { + if (firstOwnerGraph == null) { + break; + } + var secondOwnerGraph = secondNode.getOwner(); + do { + if (secondOwnerGraph == null) { + break; + } + if (secondOwnerGraph == firstOwnerGraph) { + return secondOwnerGraph; + } + secondOwnerGraph = secondOwnerGraph.getParent().getOwner(); + } while (true); + firstOwnerGraph = firstOwnerGraph.getParent().getOwner(); + } while (true); + return firstOwnerGraph; + }; + LGraphManager.prototype.calcInclusionTreeDepths = function(graph, depth) { + if (graph == null && depth == null) { + graph = this.rootGraph; + depth = 1; + } + var node2; + var nodes5 = graph.getNodes(); + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + node2 = nodes5[i2]; + node2.inclusionTreeDepth = depth; + if (node2.child != null) { + this.calcInclusionTreeDepths(node2.child, depth + 1); + } + } + }; + LGraphManager.prototype.includesInvalidEdge = function() { + var edge; + var s2 = this.edges.length; + for (var i2 = 0; i2 < s2; i2++) { + edge = this.edges[i2]; + if (this.isOneAncestorOfOther(edge.source, edge.target)) { + return true; + } + } + return false; + }; + module3.exports = LGraphManager; + }), + /* 7 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LayoutConstants = __webpack_require__(0); + function FDLayoutConstants() { + } + __name(FDLayoutConstants, "FDLayoutConstants"); + for (var prop in LayoutConstants) { + FDLayoutConstants[prop] = LayoutConstants[prop]; + } + FDLayoutConstants.MAX_ITERATIONS = 2500; + FDLayoutConstants.DEFAULT_EDGE_LENGTH = 50; + FDLayoutConstants.DEFAULT_SPRING_STRENGTH = 0.45; + FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = 4500; + FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = 0.4; + FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1; + FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8; + FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5; + FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = true; + FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = true; + FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3; + FDLayoutConstants.COOLING_ADAPTATION_FACTOR = 0.33; + FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT = 1e3; + FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT = 5e3; + FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100; + FDLayoutConstants.MAX_NODE_DISPLACEMENT = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3; + FDLayoutConstants.MIN_REPULSION_DIST = FDLayoutConstants.DEFAULT_EDGE_LENGTH / 10; + FDLayoutConstants.CONVERGENCE_CHECK_PERIOD = 100; + FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1; + FDLayoutConstants.MIN_EDGE_LENGTH = 1; + FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD = 10; + module3.exports = FDLayoutConstants; + }), + /* 8 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var Point3 = __webpack_require__(12); + function IGeometry() { + } + __name(IGeometry, "IGeometry"); + IGeometry.calcSeparationAmount = function(rectA, rectB, overlapAmount, separationBuffer) { + if (!rectA.intersects(rectB)) { + throw "assert failed"; + } + var directions = new Array(2); + this.decideDirectionsForOverlappingNodes(rectA, rectB, directions); + overlapAmount[0] = Math.min(rectA.getRight(), rectB.getRight()) - Math.max(rectA.x, rectB.x); + overlapAmount[1] = Math.min(rectA.getBottom(), rectB.getBottom()) - Math.max(rectA.y, rectB.y); + if (rectA.getX() <= rectB.getX() && rectA.getRight() >= rectB.getRight()) { + overlapAmount[0] += Math.min(rectB.getX() - rectA.getX(), rectA.getRight() - rectB.getRight()); + } else if (rectB.getX() <= rectA.getX() && rectB.getRight() >= rectA.getRight()) { + overlapAmount[0] += Math.min(rectA.getX() - rectB.getX(), rectB.getRight() - rectA.getRight()); + } + if (rectA.getY() <= rectB.getY() && rectA.getBottom() >= rectB.getBottom()) { + overlapAmount[1] += Math.min(rectB.getY() - rectA.getY(), rectA.getBottom() - rectB.getBottom()); + } else if (rectB.getY() <= rectA.getY() && rectB.getBottom() >= rectA.getBottom()) { + overlapAmount[1] += Math.min(rectA.getY() - rectB.getY(), rectB.getBottom() - rectA.getBottom()); + } + var slope = Math.abs((rectB.getCenterY() - rectA.getCenterY()) / (rectB.getCenterX() - rectA.getCenterX())); + if (rectB.getCenterY() === rectA.getCenterY() && rectB.getCenterX() === rectA.getCenterX()) { + slope = 1; + } + var moveByY = slope * overlapAmount[0]; + var moveByX = overlapAmount[1] / slope; + if (overlapAmount[0] < moveByX) { + moveByX = overlapAmount[0]; + } else { + moveByY = overlapAmount[1]; + } + overlapAmount[0] = -1 * directions[0] * (moveByX / 2 + separationBuffer); + overlapAmount[1] = -1 * directions[1] * (moveByY / 2 + separationBuffer); + }; + IGeometry.decideDirectionsForOverlappingNodes = function(rectA, rectB, directions) { + if (rectA.getCenterX() < rectB.getCenterX()) { + directions[0] = -1; + } else { + directions[0] = 1; + } + if (rectA.getCenterY() < rectB.getCenterY()) { + directions[1] = -1; + } else { + directions[1] = 1; + } + }; + IGeometry.getIntersection2 = function(rectA, rectB, result) { + var p1x = rectA.getCenterX(); + var p1y = rectA.getCenterY(); + var p2x = rectB.getCenterX(); + var p2y = rectB.getCenterY(); + if (rectA.intersects(rectB)) { + result[0] = p1x; + result[1] = p1y; + result[2] = p2x; + result[3] = p2y; + return true; + } + var topLeftAx = rectA.getX(); + var topLeftAy = rectA.getY(); + var topRightAx = rectA.getRight(); + var bottomLeftAx = rectA.getX(); + var bottomLeftAy = rectA.getBottom(); + var bottomRightAx = rectA.getRight(); + var halfWidthA = rectA.getWidthHalf(); + var halfHeightA = rectA.getHeightHalf(); + var topLeftBx = rectB.getX(); + var topLeftBy = rectB.getY(); + var topRightBx = rectB.getRight(); + var bottomLeftBx = rectB.getX(); + var bottomLeftBy = rectB.getBottom(); + var bottomRightBx = rectB.getRight(); + var halfWidthB = rectB.getWidthHalf(); + var halfHeightB = rectB.getHeightHalf(); + var clipPointAFound = false; + var clipPointBFound = false; + if (p1x === p2x) { + if (p1y > p2y) { + result[0] = p1x; + result[1] = topLeftAy; + result[2] = p2x; + result[3] = bottomLeftBy; + return false; + } else if (p1y < p2y) { + result[0] = p1x; + result[1] = bottomLeftAy; + result[2] = p2x; + result[3] = topLeftBy; + return false; + } else { + } + } else if (p1y === p2y) { + if (p1x > p2x) { + result[0] = topLeftAx; + result[1] = p1y; + result[2] = topRightBx; + result[3] = p2y; + return false; + } else if (p1x < p2x) { + result[0] = topRightAx; + result[1] = p1y; + result[2] = topLeftBx; + result[3] = p2y; + return false; + } else { + } + } else { + var slopeA = rectA.height / rectA.width; + var slopeB = rectB.height / rectB.width; + var slopePrime = (p2y - p1y) / (p2x - p1x); + var cardinalDirectionA = void 0; + var cardinalDirectionB = void 0; + var tempPointAx = void 0; + var tempPointAy = void 0; + var tempPointBx = void 0; + var tempPointBy = void 0; + if (-slopeA === slopePrime) { + if (p1x > p2x) { + result[0] = bottomLeftAx; + result[1] = bottomLeftAy; + clipPointAFound = true; + } else { + result[0] = topRightAx; + result[1] = topLeftAy; + clipPointAFound = true; + } + } else if (slopeA === slopePrime) { + if (p1x > p2x) { + result[0] = topLeftAx; + result[1] = topLeftAy; + clipPointAFound = true; + } else { + result[0] = bottomRightAx; + result[1] = bottomLeftAy; + clipPointAFound = true; + } + } + if (-slopeB === slopePrime) { + if (p2x > p1x) { + result[2] = bottomLeftBx; + result[3] = bottomLeftBy; + clipPointBFound = true; + } else { + result[2] = topRightBx; + result[3] = topLeftBy; + clipPointBFound = true; + } + } else if (slopeB === slopePrime) { + if (p2x > p1x) { + result[2] = topLeftBx; + result[3] = topLeftBy; + clipPointBFound = true; + } else { + result[2] = bottomRightBx; + result[3] = bottomLeftBy; + clipPointBFound = true; + } + } + if (clipPointAFound && clipPointBFound) { + return false; + } + if (p1x > p2x) { + if (p1y > p2y) { + cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 4); + cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 2); + } else { + cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 3); + cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 1); + } + } else { + if (p1y > p2y) { + cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 1); + cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 3); + } else { + cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 2); + cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 4); + } + } + if (!clipPointAFound) { + switch (cardinalDirectionA) { + case 1: + tempPointAy = topLeftAy; + tempPointAx = p1x + -halfHeightA / slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 2: + tempPointAx = bottomRightAx; + tempPointAy = p1y + halfWidthA * slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 3: + tempPointAy = bottomLeftAy; + tempPointAx = p1x + halfHeightA / slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 4: + tempPointAx = bottomLeftAx; + tempPointAy = p1y + -halfWidthA * slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + } + } + if (!clipPointBFound) { + switch (cardinalDirectionB) { + case 1: + tempPointBy = topLeftBy; + tempPointBx = p2x + -halfHeightB / slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 2: + tempPointBx = bottomRightBx; + tempPointBy = p2y + halfWidthB * slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 3: + tempPointBy = bottomLeftBy; + tempPointBx = p2x + halfHeightB / slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 4: + tempPointBx = bottomLeftBx; + tempPointBy = p2y + -halfWidthB * slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + } + } + } + return false; + }; + IGeometry.getCardinalDirection = function(slope, slopePrime, line2) { + if (slope > slopePrime) { + return line2; + } else { + return 1 + line2 % 4; + } + }; + IGeometry.getIntersection = function(s1, s2, f1, f2) { + if (f2 == null) { + return this.getIntersection2(s1, s2, f1); + } + var x1 = s1.x; + var y1 = s1.y; + var x22 = s2.x; + var y22 = s2.y; + var x32 = f1.x; + var y32 = f1.y; + var x42 = f2.x; + var y42 = f2.y; + var x5 = void 0, y6 = void 0; + var a1 = void 0, a2 = void 0, b1 = void 0, b22 = void 0, c1 = void 0, c22 = void 0; + var denom = void 0; + a1 = y22 - y1; + b1 = x1 - x22; + c1 = x22 * y1 - x1 * y22; + a2 = y42 - y32; + b22 = x32 - x42; + c22 = x42 * y32 - x32 * y42; + denom = a1 * b22 - a2 * b1; + if (denom === 0) { + return null; + } + x5 = (b1 * c22 - b22 * c1) / denom; + y6 = (a2 * c1 - a1 * c22) / denom; + return new Point3(x5, y6); + }; + IGeometry.angleOfVector = function(Cx, Cy, Nx, Ny) { + var C_angle = void 0; + if (Cx !== Nx) { + C_angle = Math.atan((Ny - Cy) / (Nx - Cx)); + if (Nx < Cx) { + C_angle += Math.PI; + } else if (Ny < Cy) { + C_angle += this.TWO_PI; + } + } else if (Ny < Cy) { + C_angle = this.ONE_AND_HALF_PI; + } else { + C_angle = this.HALF_PI; + } + return C_angle; + }; + IGeometry.doIntersect = function(p1, p22, p3, p4) { + var a2 = p1.x; + var b3 = p1.y; + var c3 = p22.x; + var d3 = p22.y; + var p5 = p3.x; + var q3 = p3.y; + var r2 = p4.x; + var s2 = p4.y; + var det = (c3 - a2) * (s2 - q3) - (r2 - p5) * (d3 - b3); + if (det === 0) { + return false; + } else { + var lambda = ((s2 - q3) * (r2 - a2) + (p5 - r2) * (s2 - b3)) / det; + var gamma2 = ((b3 - d3) * (r2 - a2) + (c3 - a2) * (s2 - b3)) / det; + return 0 < lambda && lambda < 1 && 0 < gamma2 && gamma2 < 1; + } + }; + IGeometry.HALF_PI = 0.5 * Math.PI; + IGeometry.ONE_AND_HALF_PI = 1.5 * Math.PI; + IGeometry.TWO_PI = 2 * Math.PI; + IGeometry.THREE_PI = 3 * Math.PI; + module3.exports = IGeometry; + }), + /* 9 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function IMath() { + } + __name(IMath, "IMath"); + IMath.sign = function(value2) { + if (value2 > 0) { + return 1; + } else if (value2 < 0) { + return -1; + } else { + return 0; + } + }; + IMath.floor = function(value2) { + return value2 < 0 ? Math.ceil(value2) : Math.floor(value2); + }; + IMath.ceil = function(value2) { + return value2 < 0 ? Math.floor(value2) : Math.ceil(value2); + }; + module3.exports = IMath; + }), + /* 10 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function Integer() { + } + __name(Integer, "Integer"); + Integer.MAX_VALUE = 2147483647; + Integer.MIN_VALUE = -2147483648; + module3.exports = Integer; + }), + /* 11 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var _createClass2 = /* @__PURE__ */ (function() { + function defineProperties(target, props) { + for (var i2 = 0; i2 < props.length; i2++) { + var descriptor = props[i2]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + __name(defineProperties, "defineProperties"); + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _classCallCheck2(instance2, Constructor) { + if (!(instance2 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + __name(_classCallCheck2, "_classCallCheck"); + var nodeFrom = /* @__PURE__ */ __name(function nodeFrom2(value2) { + return { value: value2, next: null, prev: null }; + }, "nodeFrom"); + var add3 = /* @__PURE__ */ __name(function add4(prev2, node2, next3, list) { + if (prev2 !== null) { + prev2.next = node2; + } else { + list.head = node2; + } + if (next3 !== null) { + next3.prev = node2; + } else { + list.tail = node2; + } + node2.prev = prev2; + node2.next = next3; + list.length++; + return node2; + }, "add"); + var _remove = /* @__PURE__ */ __name(function _remove2(node2, list) { + var prev2 = node2.prev, next3 = node2.next; + if (prev2 !== null) { + prev2.next = next3; + } else { + list.head = next3; + } + if (next3 !== null) { + next3.prev = prev2; + } else { + list.tail = prev2; + } + node2.prev = node2.next = null; + list.length--; + return node2; + }, "_remove"); + var LinkedList = (function() { + function LinkedList2(vals) { + var _this = this; + _classCallCheck2(this, LinkedList2); + this.length = 0; + this.head = null; + this.tail = null; + if (vals != null) { + vals.forEach(function(v3) { + return _this.push(v3); + }); + } + } + __name(LinkedList2, "LinkedList"); + _createClass2(LinkedList2, [{ + key: "size", + value: /* @__PURE__ */ __name(function size4() { + return this.length; + }, "size") + }, { + key: "insertBefore", + value: /* @__PURE__ */ __name(function insertBefore(val, otherNode) { + return add3(otherNode.prev, nodeFrom(val), otherNode, this); + }, "insertBefore") + }, { + key: "insertAfter", + value: /* @__PURE__ */ __name(function insertAfter(val, otherNode) { + return add3(otherNode, nodeFrom(val), otherNode.next, this); + }, "insertAfter") + }, { + key: "insertNodeBefore", + value: /* @__PURE__ */ __name(function insertNodeBefore(newNode, otherNode) { + return add3(otherNode.prev, newNode, otherNode, this); + }, "insertNodeBefore") + }, { + key: "insertNodeAfter", + value: /* @__PURE__ */ __name(function insertNodeAfter(newNode, otherNode) { + return add3(otherNode, newNode, otherNode.next, this); + }, "insertNodeAfter") + }, { + key: "push", + value: /* @__PURE__ */ __name(function push3(val) { + return add3(this.tail, nodeFrom(val), null, this); + }, "push") + }, { + key: "unshift", + value: /* @__PURE__ */ __name(function unshift(val) { + return add3(null, nodeFrom(val), this.head, this); + }, "unshift") + }, { + key: "remove", + value: /* @__PURE__ */ __name(function remove3(node2) { + return _remove(node2, this); + }, "remove") + }, { + key: "pop", + value: /* @__PURE__ */ __name(function pop() { + return _remove(this.tail, this).value; + }, "pop") + }, { + key: "popNode", + value: /* @__PURE__ */ __name(function popNode() { + return _remove(this.tail, this); + }, "popNode") + }, { + key: "shift", + value: /* @__PURE__ */ __name(function shift2() { + return _remove(this.head, this).value; + }, "shift") + }, { + key: "shiftNode", + value: /* @__PURE__ */ __name(function shiftNode() { + return _remove(this.head, this); + }, "shiftNode") + }, { + key: "get_object_at", + value: /* @__PURE__ */ __name(function get_object_at(index) { + if (index <= this.length()) { + var i2 = 1; + var current = this.head; + while (i2 < index) { + current = current.next; + i2++; + } + return current.value; + } + }, "get_object_at") + }, { + key: "set_object_at", + value: /* @__PURE__ */ __name(function set_object_at(index, value2) { + if (index <= this.length()) { + var i2 = 1; + var current = this.head; + while (i2 < index) { + current = current.next; + i2++; + } + current.value = value2; + } + }, "set_object_at") + }]); + return LinkedList2; + })(); + module3.exports = LinkedList; + }), + /* 12 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function Point3(x5, y6, p3) { + this.x = null; + this.y = null; + if (x5 == null && y6 == null && p3 == null) { + this.x = 0; + this.y = 0; + } else if (typeof x5 == "number" && typeof y6 == "number" && p3 == null) { + this.x = x5; + this.y = y6; + } else if (x5.constructor.name == "Point" && y6 == null && p3 == null) { + p3 = x5; + this.x = p3.x; + this.y = p3.y; + } + } + __name(Point3, "Point"); + Point3.prototype.getX = function() { + return this.x; + }; + Point3.prototype.getY = function() { + return this.y; + }; + Point3.prototype.getLocation = function() { + return new Point3(this.x, this.y); + }; + Point3.prototype.setLocation = function(x5, y6, p3) { + if (x5.constructor.name == "Point" && y6 == null && p3 == null) { + p3 = x5; + this.setLocation(p3.x, p3.y); + } else if (typeof x5 == "number" && typeof y6 == "number" && p3 == null) { + if (parseInt(x5) == x5 && parseInt(y6) == y6) { + this.move(x5, y6); + } else { + this.x = Math.floor(x5 + 0.5); + this.y = Math.floor(y6 + 0.5); + } + } + }; + Point3.prototype.move = function(x5, y6) { + this.x = x5; + this.y = y6; + }; + Point3.prototype.translate = function(dx, dy) { + this.x += dx; + this.y += dy; + }; + Point3.prototype.equals = function(obj) { + if (obj.constructor.name == "Point") { + var pt = obj; + return this.x == pt.x && this.y == pt.y; + } + return this == obj; + }; + Point3.prototype.toString = function() { + return new Point3().constructor.name + "[x=" + this.x + ",y=" + this.y + "]"; + }; + module3.exports = Point3; + }), + /* 13 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function RectangleD(x5, y6, width3, height2) { + this.x = 0; + this.y = 0; + this.width = 0; + this.height = 0; + if (x5 != null && y6 != null && width3 != null && height2 != null) { + this.x = x5; + this.y = y6; + this.width = width3; + this.height = height2; + } + } + __name(RectangleD, "RectangleD"); + RectangleD.prototype.getX = function() { + return this.x; + }; + RectangleD.prototype.setX = function(x5) { + this.x = x5; + }; + RectangleD.prototype.getY = function() { + return this.y; + }; + RectangleD.prototype.setY = function(y6) { + this.y = y6; + }; + RectangleD.prototype.getWidth = function() { + return this.width; + }; + RectangleD.prototype.setWidth = function(width3) { + this.width = width3; + }; + RectangleD.prototype.getHeight = function() { + return this.height; + }; + RectangleD.prototype.setHeight = function(height2) { + this.height = height2; + }; + RectangleD.prototype.getRight = function() { + return this.x + this.width; + }; + RectangleD.prototype.getBottom = function() { + return this.y + this.height; + }; + RectangleD.prototype.intersects = function(a2) { + if (this.getRight() < a2.x) { + return false; + } + if (this.getBottom() < a2.y) { + return false; + } + if (a2.getRight() < this.x) { + return false; + } + if (a2.getBottom() < this.y) { + return false; + } + return true; + }; + RectangleD.prototype.getCenterX = function() { + return this.x + this.width / 2; + }; + RectangleD.prototype.getMinX = function() { + return this.getX(); + }; + RectangleD.prototype.getMaxX = function() { + return this.getX() + this.width; + }; + RectangleD.prototype.getCenterY = function() { + return this.y + this.height / 2; + }; + RectangleD.prototype.getMinY = function() { + return this.getY(); + }; + RectangleD.prototype.getMaxY = function() { + return this.getY() + this.height; + }; + RectangleD.prototype.getWidthHalf = function() { + return this.width / 2; + }; + RectangleD.prototype.getHeightHalf = function() { + return this.height / 2; + }; + module3.exports = RectangleD; + }), + /* 14 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) { + return typeof obj; + } : function(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + function UniqueIDGeneretor() { + } + __name(UniqueIDGeneretor, "UniqueIDGeneretor"); + UniqueIDGeneretor.lastID = 0; + UniqueIDGeneretor.createID = function(obj) { + if (UniqueIDGeneretor.isPrimitive(obj)) { + return obj; + } + if (obj.uniqueID != null) { + return obj.uniqueID; + } + obj.uniqueID = UniqueIDGeneretor.getString(); + UniqueIDGeneretor.lastID++; + return obj.uniqueID; + }; + UniqueIDGeneretor.getString = function(id35) { + if (id35 == null) id35 = UniqueIDGeneretor.lastID; + return "Object#" + id35; + }; + UniqueIDGeneretor.isPrimitive = function(arg) { + var type3 = typeof arg === "undefined" ? "undefined" : _typeof2(arg); + return arg == null || type3 != "object" && type3 != "function"; + }; + module3.exports = UniqueIDGeneretor; + }), + /* 15 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function _toConsumableArray2(arr) { + if (Array.isArray(arr)) { + for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) { + arr2[i2] = arr[i2]; + } + return arr2; + } else { + return Array.from(arr); + } + } + __name(_toConsumableArray2, "_toConsumableArray"); + var LayoutConstants = __webpack_require__(0); + var LGraphManager = __webpack_require__(6); + var LNode = __webpack_require__(3); + var LEdge = __webpack_require__(1); + var LGraph = __webpack_require__(5); + var PointD = __webpack_require__(4); + var Transform2 = __webpack_require__(17); + var Emitter2 = __webpack_require__(27); + function Layout2(isRemoteUse) { + Emitter2.call(this); + this.layoutQuality = LayoutConstants.QUALITY; + this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + this.incremental = LayoutConstants.DEFAULT_INCREMENTAL; + this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT; + this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT; + this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD; + this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES; + this.edgeToDummyNodes = /* @__PURE__ */ new Map(); + this.graphManager = new LGraphManager(this); + this.isLayoutFinished = false; + this.isSubLayout = false; + this.isRemoteUse = false; + if (isRemoteUse != null) { + this.isRemoteUse = isRemoteUse; + } + } + __name(Layout2, "Layout"); + Layout2.RANDOM_SEED = 1; + Layout2.prototype = Object.create(Emitter2.prototype); + Layout2.prototype.getGraphManager = function() { + return this.graphManager; + }; + Layout2.prototype.getAllNodes = function() { + return this.graphManager.getAllNodes(); + }; + Layout2.prototype.getAllEdges = function() { + return this.graphManager.getAllEdges(); + }; + Layout2.prototype.getAllNodesToApplyGravitation = function() { + return this.graphManager.getAllNodesToApplyGravitation(); + }; + Layout2.prototype.newGraphManager = function() { + var gm = new LGraphManager(this); + this.graphManager = gm; + return gm; + }; + Layout2.prototype.newGraph = function(vGraph) { + return new LGraph(null, this.graphManager, vGraph); + }; + Layout2.prototype.newNode = function(vNode) { + return new LNode(this.graphManager, vNode); + }; + Layout2.prototype.newEdge = function(vEdge) { + return new LEdge(null, null, vEdge); + }; + Layout2.prototype.checkLayoutSuccess = function() { + return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge(); + }; + Layout2.prototype.runLayout = function() { + this.isLayoutFinished = false; + if (this.tilingPreLayout) { + this.tilingPreLayout(); + } + this.initParameters(); + var isLayoutSuccessfull; + if (this.checkLayoutSuccess()) { + isLayoutSuccessfull = false; + } else { + isLayoutSuccessfull = this.layout(); + } + if (LayoutConstants.ANIMATE === "during") { + return false; + } + if (isLayoutSuccessfull) { + if (!this.isSubLayout) { + this.doPostLayout(); + } + } + if (this.tilingPostLayout) { + this.tilingPostLayout(); + } + this.isLayoutFinished = true; + return isLayoutSuccessfull; + }; + Layout2.prototype.doPostLayout = function() { + if (!this.incremental) { + this.transform(); + } + this.update(); + }; + Layout2.prototype.update2 = function() { + if (this.createBendsAsNeeded) { + this.createBendpointsFromDummyNodes(); + this.graphManager.resetAllEdges(); + } + if (!this.isRemoteUse) { + var edge; + var allEdges = this.graphManager.getAllEdges(); + for (var i2 = 0; i2 < allEdges.length; i2++) { + edge = allEdges[i2]; + } + var node2; + var nodes5 = this.graphManager.getRoot().getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + node2 = nodes5[i2]; + } + this.update(this.graphManager.getRoot()); + } + }; + Layout2.prototype.update = function(obj) { + if (obj == null) { + this.update2(); + } else if (obj instanceof LNode) { + var node2 = obj; + if (node2.getChild() != null) { + var nodes5 = node2.getChild().getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + update(nodes5[i2]); + } + } + if (node2.vGraphObject != null) { + var vNode = node2.vGraphObject; + vNode.update(node2); + } + } else if (obj instanceof LEdge) { + var edge = obj; + if (edge.vGraphObject != null) { + var vEdge = edge.vGraphObject; + vEdge.update(edge); + } + } else if (obj instanceof LGraph) { + var graph = obj; + if (graph.vGraphObject != null) { + var vGraph = graph.vGraphObject; + vGraph.update(graph); + } + } + }; + Layout2.prototype.initParameters = function() { + if (!this.isSubLayout) { + this.layoutQuality = LayoutConstants.QUALITY; + this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT; + this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD; + this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT; + this.incremental = LayoutConstants.DEFAULT_INCREMENTAL; + this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES; + } + if (this.animationDuringLayout) { + this.animationOnLayout = false; + } + }; + Layout2.prototype.transform = function(newLeftTop) { + if (newLeftTop == void 0) { + this.transform(new PointD(0, 0)); + } else { + var trans = new Transform2(); + var leftTop = this.graphManager.getRoot().updateLeftTop(); + if (leftTop != null) { + trans.setWorldOrgX(newLeftTop.x); + trans.setWorldOrgY(newLeftTop.y); + trans.setDeviceOrgX(leftTop.x); + trans.setDeviceOrgY(leftTop.y); + var nodes5 = this.getAllNodes(); + var node2; + for (var i2 = 0; i2 < nodes5.length; i2++) { + node2 = nodes5[i2]; + node2.transform(trans); + } + } + } + }; + Layout2.prototype.positionNodesRandomly = function(graph) { + if (graph == void 0) { + this.positionNodesRandomly(this.getGraphManager().getRoot()); + this.getGraphManager().getRoot().updateBounds(true); + } else { + var lNode; + var childGraph; + var nodes5 = graph.getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + lNode = nodes5[i2]; + childGraph = lNode.getChild(); + if (childGraph == null) { + lNode.scatter(); + } else if (childGraph.getNodes().length == 0) { + lNode.scatter(); + } else { + this.positionNodesRandomly(childGraph); + lNode.updateBounds(); + } + } + } + }; + Layout2.prototype.getFlatForest = function() { + var flatForest = []; + var isForest = true; + var allNodes = this.graphManager.getRoot().getNodes(); + var isFlat = true; + for (var i2 = 0; i2 < allNodes.length; i2++) { + if (allNodes[i2].getChild() != null) { + isFlat = false; + } + } + if (!isFlat) { + return flatForest; + } + var visited = /* @__PURE__ */ new Set(); + var toBeVisited = []; + var parents3 = /* @__PURE__ */ new Map(); + var unProcessedNodes = []; + unProcessedNodes = unProcessedNodes.concat(allNodes); + while (unProcessedNodes.length > 0 && isForest) { + toBeVisited.push(unProcessedNodes[0]); + while (toBeVisited.length > 0 && isForest) { + var currentNode = toBeVisited[0]; + toBeVisited.splice(0, 1); + visited.add(currentNode); + var neighborEdges = currentNode.getEdges(); + for (var i2 = 0; i2 < neighborEdges.length; i2++) { + var currentNeighbor = neighborEdges[i2].getOtherEnd(currentNode); + if (parents3.get(currentNode) != currentNeighbor) { + if (!visited.has(currentNeighbor)) { + toBeVisited.push(currentNeighbor); + parents3.set(currentNeighbor, currentNode); + } else { + isForest = false; + break; + } + } + } + } + if (!isForest) { + flatForest = []; + } else { + var temp = [].concat(_toConsumableArray2(visited)); + flatForest.push(temp); + for (var i2 = 0; i2 < temp.length; i2++) { + var value2 = temp[i2]; + var index = unProcessedNodes.indexOf(value2); + if (index > -1) { + unProcessedNodes.splice(index, 1); + } + } + visited = /* @__PURE__ */ new Set(); + parents3 = /* @__PURE__ */ new Map(); + } + } + return flatForest; + }; + Layout2.prototype.createDummyNodesForBendpoints = function(edge) { + var dummyNodes = []; + var prev2 = edge.source; + var graph = this.graphManager.calcLowestCommonAncestor(edge.source, edge.target); + for (var i2 = 0; i2 < edge.bendpoints.length; i2++) { + var dummyNode = this.newNode(null); + dummyNode.setRect(new Point(0, 0), new Dimension(1, 1)); + graph.add(dummyNode); + var dummyEdge = this.newEdge(null); + this.graphManager.add(dummyEdge, prev2, dummyNode); + dummyNodes.add(dummyNode); + prev2 = dummyNode; + } + var dummyEdge = this.newEdge(null); + this.graphManager.add(dummyEdge, prev2, edge.target); + this.edgeToDummyNodes.set(edge, dummyNodes); + if (edge.isInterGraph()) { + this.graphManager.remove(edge); + } else { + graph.remove(edge); + } + return dummyNodes; + }; + Layout2.prototype.createBendpointsFromDummyNodes = function() { + var edges3 = []; + edges3 = edges3.concat(this.graphManager.getAllEdges()); + edges3 = [].concat(_toConsumableArray2(this.edgeToDummyNodes.keys())).concat(edges3); + for (var k2 = 0; k2 < edges3.length; k2++) { + var lEdge = edges3[k2]; + if (lEdge.bendpoints.length > 0) { + var path4 = this.edgeToDummyNodes.get(lEdge); + for (var i2 = 0; i2 < path4.length; i2++) { + var dummyNode = path4[i2]; + var p3 = new PointD(dummyNode.getCenterX(), dummyNode.getCenterY()); + var ebp = lEdge.bendpoints.get(i2); + ebp.x = p3.x; + ebp.y = p3.y; + dummyNode.getOwner().remove(dummyNode); + } + this.graphManager.add(lEdge, lEdge.source, lEdge.target); + } + } + }; + Layout2.transform = function(sliderValue, defaultValue, minDiv, maxMul) { + if (minDiv != void 0 && maxMul != void 0) { + var value2 = defaultValue; + if (sliderValue <= 50) { + var minValue = defaultValue / minDiv; + value2 -= (defaultValue - minValue) / 50 * (50 - sliderValue); + } else { + var maxValue = defaultValue * maxMul; + value2 += (maxValue - defaultValue) / 50 * (sliderValue - 50); + } + return value2; + } else { + var a2, b3; + if (sliderValue <= 50) { + a2 = 9 * defaultValue / 500; + b3 = defaultValue / 10; + } else { + a2 = 9 * defaultValue / 50; + b3 = -8 * defaultValue; + } + return a2 * sliderValue + b3; + } + }; + Layout2.findCenterOfTree = function(nodes5) { + var list = []; + list = list.concat(nodes5); + var removedNodes = []; + var remainingDegrees = /* @__PURE__ */ new Map(); + var foundCenter = false; + var centerNode = null; + if (list.length == 1 || list.length == 2) { + foundCenter = true; + centerNode = list[0]; + } + for (var i2 = 0; i2 < list.length; i2++) { + var node2 = list[i2]; + var degree = node2.getNeighborsList().size; + remainingDegrees.set(node2, node2.getNeighborsList().size); + if (degree == 1) { + removedNodes.push(node2); + } + } + var tempList = []; + tempList = tempList.concat(removedNodes); + while (!foundCenter) { + var tempList2 = []; + tempList2 = tempList2.concat(tempList); + tempList = []; + for (var i2 = 0; i2 < list.length; i2++) { + var node2 = list[i2]; + var index = list.indexOf(node2); + if (index >= 0) { + list.splice(index, 1); + } + var neighbours = node2.getNeighborsList(); + neighbours.forEach(function(neighbour) { + if (removedNodes.indexOf(neighbour) < 0) { + var otherDegree = remainingDegrees.get(neighbour); + var newDegree = otherDegree - 1; + if (newDegree == 1) { + tempList.push(neighbour); + } + remainingDegrees.set(neighbour, newDegree); + } + }); + } + removedNodes = removedNodes.concat(tempList); + if (list.length == 1 || list.length == 2) { + foundCenter = true; + centerNode = list[0]; + } + } + return centerNode; + }; + Layout2.prototype.setGraphManager = function(gm) { + this.graphManager = gm; + }; + module3.exports = Layout2; + }), + /* 16 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function RandomSeed() { + } + __name(RandomSeed, "RandomSeed"); + RandomSeed.seed = 1; + RandomSeed.x = 0; + RandomSeed.nextDouble = function() { + RandomSeed.x = Math.sin(RandomSeed.seed++) * 1e4; + return RandomSeed.x - Math.floor(RandomSeed.x); + }; + module3.exports = RandomSeed; + }), + /* 17 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var PointD = __webpack_require__(4); + function Transform2(x5, y6) { + this.lworldOrgX = 0; + this.lworldOrgY = 0; + this.ldeviceOrgX = 0; + this.ldeviceOrgY = 0; + this.lworldExtX = 1; + this.lworldExtY = 1; + this.ldeviceExtX = 1; + this.ldeviceExtY = 1; + } + __name(Transform2, "Transform"); + Transform2.prototype.getWorldOrgX = function() { + return this.lworldOrgX; + }; + Transform2.prototype.setWorldOrgX = function(wox) { + this.lworldOrgX = wox; + }; + Transform2.prototype.getWorldOrgY = function() { + return this.lworldOrgY; + }; + Transform2.prototype.setWorldOrgY = function(woy) { + this.lworldOrgY = woy; + }; + Transform2.prototype.getWorldExtX = function() { + return this.lworldExtX; + }; + Transform2.prototype.setWorldExtX = function(wex) { + this.lworldExtX = wex; + }; + Transform2.prototype.getWorldExtY = function() { + return this.lworldExtY; + }; + Transform2.prototype.setWorldExtY = function(wey) { + this.lworldExtY = wey; + }; + Transform2.prototype.getDeviceOrgX = function() { + return this.ldeviceOrgX; + }; + Transform2.prototype.setDeviceOrgX = function(dox) { + this.ldeviceOrgX = dox; + }; + Transform2.prototype.getDeviceOrgY = function() { + return this.ldeviceOrgY; + }; + Transform2.prototype.setDeviceOrgY = function(doy) { + this.ldeviceOrgY = doy; + }; + Transform2.prototype.getDeviceExtX = function() { + return this.ldeviceExtX; + }; + Transform2.prototype.setDeviceExtX = function(dex) { + this.ldeviceExtX = dex; + }; + Transform2.prototype.getDeviceExtY = function() { + return this.ldeviceExtY; + }; + Transform2.prototype.setDeviceExtY = function(dey) { + this.ldeviceExtY = dey; + }; + Transform2.prototype.transformX = function(x5) { + var xDevice = 0; + var worldExtX = this.lworldExtX; + if (worldExtX != 0) { + xDevice = this.ldeviceOrgX + (x5 - this.lworldOrgX) * this.ldeviceExtX / worldExtX; + } + return xDevice; + }; + Transform2.prototype.transformY = function(y6) { + var yDevice = 0; + var worldExtY = this.lworldExtY; + if (worldExtY != 0) { + yDevice = this.ldeviceOrgY + (y6 - this.lworldOrgY) * this.ldeviceExtY / worldExtY; + } + return yDevice; + }; + Transform2.prototype.inverseTransformX = function(x5) { + var xWorld = 0; + var deviceExtX = this.ldeviceExtX; + if (deviceExtX != 0) { + xWorld = this.lworldOrgX + (x5 - this.ldeviceOrgX) * this.lworldExtX / deviceExtX; + } + return xWorld; + }; + Transform2.prototype.inverseTransformY = function(y6) { + var yWorld = 0; + var deviceExtY = this.ldeviceExtY; + if (deviceExtY != 0) { + yWorld = this.lworldOrgY + (y6 - this.ldeviceOrgY) * this.lworldExtY / deviceExtY; + } + return yWorld; + }; + Transform2.prototype.inverseTransformPoint = function(inPoint) { + var outPoint = new PointD(this.inverseTransformX(inPoint.x), this.inverseTransformY(inPoint.y)); + return outPoint; + }; + module3.exports = Transform2; + }), + /* 18 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function _toConsumableArray2(arr) { + if (Array.isArray(arr)) { + for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) { + arr2[i2] = arr[i2]; + } + return arr2; + } else { + return Array.from(arr); + } + } + __name(_toConsumableArray2, "_toConsumableArray"); + var Layout2 = __webpack_require__(15); + var FDLayoutConstants = __webpack_require__(7); + var LayoutConstants = __webpack_require__(0); + var IGeometry = __webpack_require__(8); + var IMath = __webpack_require__(9); + function FDLayout() { + Layout2.call(this); + this.useSmartIdealEdgeLengthCalculation = FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION; + this.idealEdgeLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH; + this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH; + this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH; + this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH; + this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH; + this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR; + this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR; + this.displacementThresholdPerNode = 3 * FDLayoutConstants.DEFAULT_EDGE_LENGTH / 100; + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + this.initialCoolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + this.totalDisplacement = 0; + this.oldTotalDisplacement = 0; + this.maxIterations = FDLayoutConstants.MAX_ITERATIONS; + } + __name(FDLayout, "FDLayout"); + FDLayout.prototype = Object.create(Layout2.prototype); + for (var prop in Layout2) { + FDLayout[prop] = Layout2[prop]; + } + FDLayout.prototype.initParameters = function() { + Layout2.prototype.initParameters.call(this, arguments); + this.totalIterations = 0; + this.notAnimatedIterations = 0; + this.useFRGridVariant = FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION; + this.grid = []; + }; + FDLayout.prototype.calcIdealEdgeLengths = function() { + var edge; + var lcaDepth; + var source; + var target; + var sizeOfSourceInLca; + var sizeOfTargetInLca; + var allEdges = this.getGraphManager().getAllEdges(); + for (var i2 = 0; i2 < allEdges.length; i2++) { + edge = allEdges[i2]; + edge.idealLength = this.idealEdgeLength; + if (edge.isInterGraph) { + source = edge.getSource(); + target = edge.getTarget(); + sizeOfSourceInLca = edge.getSourceInLca().getEstimatedSize(); + sizeOfTargetInLca = edge.getTargetInLca().getEstimatedSize(); + if (this.useSmartIdealEdgeLengthCalculation) { + edge.idealLength += sizeOfSourceInLca + sizeOfTargetInLca - 2 * LayoutConstants.SIMPLE_NODE_SIZE; + } + lcaDepth = edge.getLca().getInclusionTreeDepth(); + edge.idealLength += FDLayoutConstants.DEFAULT_EDGE_LENGTH * FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (source.getInclusionTreeDepth() + target.getInclusionTreeDepth() - 2 * lcaDepth); + } + } + }; + FDLayout.prototype.initSpringEmbedder = function() { + var s2 = this.getAllNodes().length; + if (this.incremental) { + if (s2 > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) { + this.coolingFactor = Math.max(this.coolingFactor * FDLayoutConstants.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (s2 - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR)); + } + this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL; + } else { + if (s2 > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) { + this.coolingFactor = Math.max(FDLayoutConstants.COOLING_ADAPTATION_FACTOR, 1 - (s2 - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR)); + } else { + this.coolingFactor = 1; + } + this.initialCoolingFactor = this.coolingFactor; + this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT; + } + this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations); + this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length; + this.repulsionRange = this.calcRepulsionRange(); + }; + FDLayout.prototype.calcSpringForces = function() { + var lEdges = this.getAllEdges(); + var edge; + for (var i2 = 0; i2 < lEdges.length; i2++) { + edge = lEdges[i2]; + this.calcSpringForce(edge, edge.idealLength); + } + }; + FDLayout.prototype.calcRepulsionForces = function() { + var gridUpdateAllowed = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; + var forceToNodeSurroundingUpdate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + var i2, j3; + var nodeA, nodeB; + var lNodes = this.getAllNodes(); + var processedNodeSet; + if (this.useFRGridVariant) { + if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed) { + this.updateGrid(); + } + processedNodeSet = /* @__PURE__ */ new Set(); + for (i2 = 0; i2 < lNodes.length; i2++) { + nodeA = lNodes[i2]; + this.calculateRepulsionForceOfANode(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate); + processedNodeSet.add(nodeA); + } + } else { + for (i2 = 0; i2 < lNodes.length; i2++) { + nodeA = lNodes[i2]; + for (j3 = i2 + 1; j3 < lNodes.length; j3++) { + nodeB = lNodes[j3]; + if (nodeA.getOwner() != nodeB.getOwner()) { + continue; + } + this.calcRepulsionForce(nodeA, nodeB); + } + } + } + }; + FDLayout.prototype.calcGravitationalForces = function() { + var node2; + var lNodes = this.getAllNodesToApplyGravitation(); + for (var i2 = 0; i2 < lNodes.length; i2++) { + node2 = lNodes[i2]; + this.calcGravitationalForce(node2); + } + }; + FDLayout.prototype.moveNodes = function() { + var lNodes = this.getAllNodes(); + var node2; + for (var i2 = 0; i2 < lNodes.length; i2++) { + node2 = lNodes[i2]; + node2.move(); + } + }; + FDLayout.prototype.calcSpringForce = function(edge, idealLength) { + var sourceNode = edge.getSource(); + var targetNode = edge.getTarget(); + var length2; + var springForce; + var springForceX; + var springForceY; + if (this.uniformLeafNodeSizes && sourceNode.getChild() == null && targetNode.getChild() == null) { + edge.updateLengthSimple(); + } else { + edge.updateLength(); + if (edge.isOverlapingSourceAndTarget) { + return; + } + } + length2 = edge.getLength(); + if (length2 == 0) return; + springForce = this.springConstant * (length2 - idealLength); + springForceX = springForce * (edge.lengthX / length2); + springForceY = springForce * (edge.lengthY / length2); + sourceNode.springForceX += springForceX; + sourceNode.springForceY += springForceY; + targetNode.springForceX -= springForceX; + targetNode.springForceY -= springForceY; + }; + FDLayout.prototype.calcRepulsionForce = function(nodeA, nodeB) { + var rectA = nodeA.getRect(); + var rectB = nodeB.getRect(); + var overlapAmount = new Array(2); + var clipPoints = new Array(4); + var distanceX; + var distanceY; + var distanceSquared; + var distance3; + var repulsionForce; + var repulsionForceX; + var repulsionForceY; + if (rectA.intersects(rectB)) { + IGeometry.calcSeparationAmount(rectA, rectB, overlapAmount, FDLayoutConstants.DEFAULT_EDGE_LENGTH / 2); + repulsionForceX = 2 * overlapAmount[0]; + repulsionForceY = 2 * overlapAmount[1]; + var childrenConstant = nodeA.noOfChildren * nodeB.noOfChildren / (nodeA.noOfChildren + nodeB.noOfChildren); + nodeA.repulsionForceX -= childrenConstant * repulsionForceX; + nodeA.repulsionForceY -= childrenConstant * repulsionForceY; + nodeB.repulsionForceX += childrenConstant * repulsionForceX; + nodeB.repulsionForceY += childrenConstant * repulsionForceY; + } else { + if (this.uniformLeafNodeSizes && nodeA.getChild() == null && nodeB.getChild() == null) { + distanceX = rectB.getCenterX() - rectA.getCenterX(); + distanceY = rectB.getCenterY() - rectA.getCenterY(); + } else { + IGeometry.getIntersection(rectA, rectB, clipPoints); + distanceX = clipPoints[2] - clipPoints[0]; + distanceY = clipPoints[3] - clipPoints[1]; + } + if (Math.abs(distanceX) < FDLayoutConstants.MIN_REPULSION_DIST) { + distanceX = IMath.sign(distanceX) * FDLayoutConstants.MIN_REPULSION_DIST; + } + if (Math.abs(distanceY) < FDLayoutConstants.MIN_REPULSION_DIST) { + distanceY = IMath.sign(distanceY) * FDLayoutConstants.MIN_REPULSION_DIST; + } + distanceSquared = distanceX * distanceX + distanceY * distanceY; + distance3 = Math.sqrt(distanceSquared); + repulsionForce = this.repulsionConstant * nodeA.noOfChildren * nodeB.noOfChildren / distanceSquared; + repulsionForceX = repulsionForce * distanceX / distance3; + repulsionForceY = repulsionForce * distanceY / distance3; + nodeA.repulsionForceX -= repulsionForceX; + nodeA.repulsionForceY -= repulsionForceY; + nodeB.repulsionForceX += repulsionForceX; + nodeB.repulsionForceY += repulsionForceY; + } + }; + FDLayout.prototype.calcGravitationalForce = function(node2) { + var ownerGraph; + var ownerCenterX; + var ownerCenterY; + var distanceX; + var distanceY; + var absDistanceX; + var absDistanceY; + var estimatedSize; + ownerGraph = node2.getOwner(); + ownerCenterX = (ownerGraph.getRight() + ownerGraph.getLeft()) / 2; + ownerCenterY = (ownerGraph.getTop() + ownerGraph.getBottom()) / 2; + distanceX = node2.getCenterX() - ownerCenterX; + distanceY = node2.getCenterY() - ownerCenterY; + absDistanceX = Math.abs(distanceX) + node2.getWidth() / 2; + absDistanceY = Math.abs(distanceY) + node2.getHeight() / 2; + if (node2.getOwner() == this.graphManager.getRoot()) { + estimatedSize = ownerGraph.getEstimatedSize() * this.gravityRangeFactor; + if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) { + node2.gravitationForceX = -this.gravityConstant * distanceX; + node2.gravitationForceY = -this.gravityConstant * distanceY; + } + } else { + estimatedSize = ownerGraph.getEstimatedSize() * this.compoundGravityRangeFactor; + if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) { + node2.gravitationForceX = -this.gravityConstant * distanceX * this.compoundGravityConstant; + node2.gravitationForceY = -this.gravityConstant * distanceY * this.compoundGravityConstant; + } + } + }; + FDLayout.prototype.isConverged = function() { + var converged; + var oscilating = false; + if (this.totalIterations > this.maxIterations / 3) { + oscilating = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2; + } + converged = this.totalDisplacement < this.totalDisplacementThreshold; + this.oldTotalDisplacement = this.totalDisplacement; + return converged || oscilating; + }; + FDLayout.prototype.animate = function() { + if (this.animationDuringLayout && !this.isSubLayout) { + if (this.notAnimatedIterations == this.animationPeriod) { + this.update(); + this.notAnimatedIterations = 0; + } else { + this.notAnimatedIterations++; + } + } + }; + FDLayout.prototype.calcNoOfChildrenForAllNodes = function() { + var node2; + var allNodes = this.graphManager.getAllNodes(); + for (var i2 = 0; i2 < allNodes.length; i2++) { + node2 = allNodes[i2]; + node2.noOfChildren = node2.getNoOfChildren(); + } + }; + FDLayout.prototype.calcGrid = function(graph) { + var sizeX = 0; + var sizeY = 0; + sizeX = parseInt(Math.ceil((graph.getRight() - graph.getLeft()) / this.repulsionRange)); + sizeY = parseInt(Math.ceil((graph.getBottom() - graph.getTop()) / this.repulsionRange)); + var grid = new Array(sizeX); + for (var i2 = 0; i2 < sizeX; i2++) { + grid[i2] = new Array(sizeY); + } + for (var i2 = 0; i2 < sizeX; i2++) { + for (var j3 = 0; j3 < sizeY; j3++) { + grid[i2][j3] = new Array(); + } + } + return grid; + }; + FDLayout.prototype.addNodeToGrid = function(v3, left3, top2) { + var startX2 = 0; + var finishX = 0; + var startY2 = 0; + var finishY = 0; + startX2 = parseInt(Math.floor((v3.getRect().x - left3) / this.repulsionRange)); + finishX = parseInt(Math.floor((v3.getRect().width + v3.getRect().x - left3) / this.repulsionRange)); + startY2 = parseInt(Math.floor((v3.getRect().y - top2) / this.repulsionRange)); + finishY = parseInt(Math.floor((v3.getRect().height + v3.getRect().y - top2) / this.repulsionRange)); + for (var i2 = startX2; i2 <= finishX; i2++) { + for (var j3 = startY2; j3 <= finishY; j3++) { + this.grid[i2][j3].push(v3); + v3.setGridCoordinates(startX2, finishX, startY2, finishY); + } + } + }; + FDLayout.prototype.updateGrid = function() { + var i2; + var nodeA; + var lNodes = this.getAllNodes(); + this.grid = this.calcGrid(this.graphManager.getRoot()); + for (i2 = 0; i2 < lNodes.length; i2++) { + nodeA = lNodes[i2]; + this.addNodeToGrid(nodeA, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop()); + } + }; + FDLayout.prototype.calculateRepulsionForceOfANode = function(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate) { + if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed || forceToNodeSurroundingUpdate) { + var surrounding = /* @__PURE__ */ new Set(); + nodeA.surrounding = new Array(); + var nodeB; + var grid = this.grid; + for (var i2 = nodeA.startX - 1; i2 < nodeA.finishX + 2; i2++) { + for (var j3 = nodeA.startY - 1; j3 < nodeA.finishY + 2; j3++) { + if (!(i2 < 0 || j3 < 0 || i2 >= grid.length || j3 >= grid[0].length)) { + for (var k2 = 0; k2 < grid[i2][j3].length; k2++) { + nodeB = grid[i2][j3][k2]; + if (nodeA.getOwner() != nodeB.getOwner() || nodeA == nodeB) { + continue; + } + if (!processedNodeSet.has(nodeB) && !surrounding.has(nodeB)) { + var distanceX = Math.abs(nodeA.getCenterX() - nodeB.getCenterX()) - (nodeA.getWidth() / 2 + nodeB.getWidth() / 2); + var distanceY = Math.abs(nodeA.getCenterY() - nodeB.getCenterY()) - (nodeA.getHeight() / 2 + nodeB.getHeight() / 2); + if (distanceX <= this.repulsionRange && distanceY <= this.repulsionRange) { + surrounding.add(nodeB); + } + } + } + } + } + } + nodeA.surrounding = [].concat(_toConsumableArray2(surrounding)); + } + for (i2 = 0; i2 < nodeA.surrounding.length; i2++) { + this.calcRepulsionForce(nodeA, nodeA.surrounding[i2]); + } + }; + FDLayout.prototype.calcRepulsionRange = function() { + return 0; + }; + module3.exports = FDLayout; + }), + /* 19 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LEdge = __webpack_require__(1); + var FDLayoutConstants = __webpack_require__(7); + function FDLayoutEdge(source, target, vEdge) { + LEdge.call(this, source, target, vEdge); + this.idealLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH; + } + __name(FDLayoutEdge, "FDLayoutEdge"); + FDLayoutEdge.prototype = Object.create(LEdge.prototype); + for (var prop in LEdge) { + FDLayoutEdge[prop] = LEdge[prop]; + } + module3.exports = FDLayoutEdge; + }), + /* 20 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LNode = __webpack_require__(3); + function FDLayoutNode(gm, loc, size4, vNode) { + LNode.call(this, gm, loc, size4, vNode); + this.springForceX = 0; + this.springForceY = 0; + this.repulsionForceX = 0; + this.repulsionForceY = 0; + this.gravitationForceX = 0; + this.gravitationForceY = 0; + this.displacementX = 0; + this.displacementY = 0; + this.startX = 0; + this.finishX = 0; + this.startY = 0; + this.finishY = 0; + this.surrounding = []; + } + __name(FDLayoutNode, "FDLayoutNode"); + FDLayoutNode.prototype = Object.create(LNode.prototype); + for (var prop in LNode) { + FDLayoutNode[prop] = LNode[prop]; + } + FDLayoutNode.prototype.setGridCoordinates = function(_startX, _finishX, _startY, _finishY) { + this.startX = _startX; + this.finishX = _finishX; + this.startY = _startY; + this.finishY = _finishY; + }; + module3.exports = FDLayoutNode; + }), + /* 21 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function DimensionD2(width3, height2) { + this.width = 0; + this.height = 0; + if (width3 !== null && height2 !== null) { + this.height = height2; + this.width = width3; + } + } + __name(DimensionD2, "DimensionD"); + DimensionD2.prototype.getWidth = function() { + return this.width; + }; + DimensionD2.prototype.setWidth = function(width3) { + this.width = width3; + }; + DimensionD2.prototype.getHeight = function() { + return this.height; + }; + DimensionD2.prototype.setHeight = function(height2) { + this.height = height2; + }; + module3.exports = DimensionD2; + }), + /* 22 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var UniqueIDGeneretor = __webpack_require__(14); + function HashMap() { + this.map = {}; + this.keys = []; + } + __name(HashMap, "HashMap"); + HashMap.prototype.put = function(key, value2) { + var theId = UniqueIDGeneretor.createID(key); + if (!this.contains(theId)) { + this.map[theId] = value2; + this.keys.push(key); + } + }; + HashMap.prototype.contains = function(key) { + var theId = UniqueIDGeneretor.createID(key); + return this.map[key] != null; + }; + HashMap.prototype.get = function(key) { + var theId = UniqueIDGeneretor.createID(key); + return this.map[theId]; + }; + HashMap.prototype.keySet = function() { + return this.keys; + }; + module3.exports = HashMap; + }), + /* 23 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var UniqueIDGeneretor = __webpack_require__(14); + function HashSet() { + this.set = {}; + } + __name(HashSet, "HashSet"); + ; + HashSet.prototype.add = function(obj) { + var theId = UniqueIDGeneretor.createID(obj); + if (!this.contains(theId)) this.set[theId] = obj; + }; + HashSet.prototype.remove = function(obj) { + delete this.set[UniqueIDGeneretor.createID(obj)]; + }; + HashSet.prototype.clear = function() { + this.set = {}; + }; + HashSet.prototype.contains = function(obj) { + return this.set[UniqueIDGeneretor.createID(obj)] == obj; + }; + HashSet.prototype.isEmpty = function() { + return this.size() === 0; + }; + HashSet.prototype.size = function() { + return Object.keys(this.set).length; + }; + HashSet.prototype.addAllTo = function(list) { + var keys3 = Object.keys(this.set); + var length2 = keys3.length; + for (var i2 = 0; i2 < length2; i2++) { + list.push(this.set[keys3[i2]]); + } + }; + HashSet.prototype.size = function() { + return Object.keys(this.set).length; + }; + HashSet.prototype.addAll = function(list) { + var s2 = list.length; + for (var i2 = 0; i2 < s2; i2++) { + var v3 = list[i2]; + this.add(v3); + } + }; + module3.exports = HashSet; + }), + /* 24 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var _createClass2 = /* @__PURE__ */ (function() { + function defineProperties(target, props) { + for (var i2 = 0; i2 < props.length; i2++) { + var descriptor = props[i2]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + __name(defineProperties, "defineProperties"); + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _classCallCheck2(instance2, Constructor) { + if (!(instance2 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + __name(_classCallCheck2, "_classCallCheck"); + var LinkedList = __webpack_require__(11); + var Quicksort = (function() { + function Quicksort2(A2, compareFunction) { + _classCallCheck2(this, Quicksort2); + if (compareFunction !== null || compareFunction !== void 0) this.compareFunction = this._defaultCompareFunction; + var length2 = void 0; + if (A2 instanceof LinkedList) length2 = A2.size(); + else length2 = A2.length; + this._quicksort(A2, 0, length2 - 1); + } + __name(Quicksort2, "Quicksort"); + _createClass2(Quicksort2, [{ + key: "_quicksort", + value: /* @__PURE__ */ __name(function _quicksort(A2, p3, r2) { + if (p3 < r2) { + var q3 = this._partition(A2, p3, r2); + this._quicksort(A2, p3, q3); + this._quicksort(A2, q3 + 1, r2); + } + }, "_quicksort") + }, { + key: "_partition", + value: /* @__PURE__ */ __name(function _partition(A2, p3, r2) { + var x5 = this._get(A2, p3); + var i2 = p3; + var j3 = r2; + while (true) { + while (this.compareFunction(x5, this._get(A2, j3))) { + j3--; + } + while (this.compareFunction(this._get(A2, i2), x5)) { + i2++; + } + if (i2 < j3) { + this._swap(A2, i2, j3); + i2++; + j3--; + } else return j3; + } + }, "_partition") + }, { + key: "_get", + value: /* @__PURE__ */ __name(function _get(object3, index) { + if (object3 instanceof LinkedList) return object3.get_object_at(index); + else return object3[index]; + }, "_get") + }, { + key: "_set", + value: /* @__PURE__ */ __name(function _set(object3, index, value2) { + if (object3 instanceof LinkedList) object3.set_object_at(index, value2); + else object3[index] = value2; + }, "_set") + }, { + key: "_swap", + value: /* @__PURE__ */ __name(function _swap(A2, i2, j3) { + var temp = this._get(A2, i2); + this._set(A2, i2, this._get(A2, j3)); + this._set(A2, j3, temp); + }, "_swap") + }, { + key: "_defaultCompareFunction", + value: /* @__PURE__ */ __name(function _defaultCompareFunction(a2, b3) { + return b3 > a2; + }, "_defaultCompareFunction") + }]); + return Quicksort2; + })(); + module3.exports = Quicksort; + }), + /* 25 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var _createClass2 = /* @__PURE__ */ (function() { + function defineProperties(target, props) { + for (var i2 = 0; i2 < props.length; i2++) { + var descriptor = props[i2]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + __name(defineProperties, "defineProperties"); + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _classCallCheck2(instance2, Constructor) { + if (!(instance2 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + __name(_classCallCheck2, "_classCallCheck"); + var NeedlemanWunsch = (function() { + function NeedlemanWunsch2(sequence1, sequence2) { + var match_score = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; + var mismatch_penalty = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1; + var gap_penalty = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1; + _classCallCheck2(this, NeedlemanWunsch2); + this.sequence1 = sequence1; + this.sequence2 = sequence2; + this.match_score = match_score; + this.mismatch_penalty = mismatch_penalty; + this.gap_penalty = gap_penalty; + this.iMax = sequence1.length + 1; + this.jMax = sequence2.length + 1; + this.grid = new Array(this.iMax); + for (var i2 = 0; i2 < this.iMax; i2++) { + this.grid[i2] = new Array(this.jMax); + for (var j3 = 0; j3 < this.jMax; j3++) { + this.grid[i2][j3] = 0; + } + } + this.tracebackGrid = new Array(this.iMax); + for (var _i = 0; _i < this.iMax; _i++) { + this.tracebackGrid[_i] = new Array(this.jMax); + for (var _j = 0; _j < this.jMax; _j++) { + this.tracebackGrid[_i][_j] = [null, null, null]; + } + } + this.alignments = []; + this.score = -1; + this.computeGrids(); + } + __name(NeedlemanWunsch2, "NeedlemanWunsch"); + _createClass2(NeedlemanWunsch2, [{ + key: "getScore", + value: /* @__PURE__ */ __name(function getScore() { + return this.score; + }, "getScore") + }, { + key: "getAlignments", + value: /* @__PURE__ */ __name(function getAlignments2() { + return this.alignments; + }, "getAlignments") + // Main dynamic programming procedure + }, { + key: "computeGrids", + value: /* @__PURE__ */ __name(function computeGrids() { + for (var j3 = 1; j3 < this.jMax; j3++) { + this.grid[0][j3] = this.grid[0][j3 - 1] + this.gap_penalty; + this.tracebackGrid[0][j3] = [false, false, true]; + } + for (var i2 = 1; i2 < this.iMax; i2++) { + this.grid[i2][0] = this.grid[i2 - 1][0] + this.gap_penalty; + this.tracebackGrid[i2][0] = [false, true, false]; + } + for (var _i2 = 1; _i2 < this.iMax; _i2++) { + for (var _j2 = 1; _j2 < this.jMax; _j2++) { + var diag = void 0; + if (this.sequence1[_i2 - 1] === this.sequence2[_j2 - 1]) diag = this.grid[_i2 - 1][_j2 - 1] + this.match_score; + else diag = this.grid[_i2 - 1][_j2 - 1] + this.mismatch_penalty; + var up = this.grid[_i2 - 1][_j2] + this.gap_penalty; + var left3 = this.grid[_i2][_j2 - 1] + this.gap_penalty; + var maxOf = [diag, up, left3]; + var indices = this.arrayAllMaxIndexes(maxOf); + this.grid[_i2][_j2] = maxOf[indices[0]]; + this.tracebackGrid[_i2][_j2] = [indices.includes(0), indices.includes(1), indices.includes(2)]; + } + } + this.score = this.grid[this.iMax - 1][this.jMax - 1]; + }, "computeGrids") + // Gets all possible valid sequence combinations + }, { + key: "alignmentTraceback", + value: /* @__PURE__ */ __name(function alignmentTraceback() { + var inProcessAlignments = []; + inProcessAlignments.push({ + pos: [this.sequence1.length, this.sequence2.length], + seq1: "", + seq2: "" + }); + while (inProcessAlignments[0]) { + var current = inProcessAlignments[0]; + var directions = this.tracebackGrid[current.pos[0]][current.pos[1]]; + if (directions[0]) { + inProcessAlignments.push({ + pos: [current.pos[0] - 1, current.pos[1] - 1], + seq1: this.sequence1[current.pos[0] - 1] + current.seq1, + seq2: this.sequence2[current.pos[1] - 1] + current.seq2 + }); + } + if (directions[1]) { + inProcessAlignments.push({ + pos: [current.pos[0] - 1, current.pos[1]], + seq1: this.sequence1[current.pos[0] - 1] + current.seq1, + seq2: "-" + current.seq2 + }); + } + if (directions[2]) { + inProcessAlignments.push({ + pos: [current.pos[0], current.pos[1] - 1], + seq1: "-" + current.seq1, + seq2: this.sequence2[current.pos[1] - 1] + current.seq2 + }); + } + if (current.pos[0] === 0 && current.pos[1] === 0) this.alignments.push({ + sequence1: current.seq1, + sequence2: current.seq2 + }); + inProcessAlignments.shift(); + } + return this.alignments; + }, "alignmentTraceback") + // Helper Functions + }, { + key: "getAllIndexes", + value: /* @__PURE__ */ __name(function getAllIndexes(arr, val) { + var indexes = [], i2 = -1; + while ((i2 = arr.indexOf(val, i2 + 1)) !== -1) { + indexes.push(i2); + } + return indexes; + }, "getAllIndexes") + }, { + key: "arrayAllMaxIndexes", + value: /* @__PURE__ */ __name(function arrayAllMaxIndexes(array4) { + return this.getAllIndexes(array4, Math.max.apply(null, array4)); + }, "arrayAllMaxIndexes") + }]); + return NeedlemanWunsch2; + })(); + module3.exports = NeedlemanWunsch; + }), + /* 26 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var layoutBase = /* @__PURE__ */ __name(function layoutBase2() { + return; + }, "layoutBase"); + layoutBase.FDLayout = __webpack_require__(18); + layoutBase.FDLayoutConstants = __webpack_require__(7); + layoutBase.FDLayoutEdge = __webpack_require__(19); + layoutBase.FDLayoutNode = __webpack_require__(20); + layoutBase.DimensionD = __webpack_require__(21); + layoutBase.HashMap = __webpack_require__(22); + layoutBase.HashSet = __webpack_require__(23); + layoutBase.IGeometry = __webpack_require__(8); + layoutBase.IMath = __webpack_require__(9); + layoutBase.Integer = __webpack_require__(10); + layoutBase.Point = __webpack_require__(12); + layoutBase.PointD = __webpack_require__(4); + layoutBase.RandomSeed = __webpack_require__(16); + layoutBase.RectangleD = __webpack_require__(13); + layoutBase.Transform = __webpack_require__(17); + layoutBase.UniqueIDGeneretor = __webpack_require__(14); + layoutBase.Quicksort = __webpack_require__(24); + layoutBase.LinkedList = __webpack_require__(11); + layoutBase.LGraphObject = __webpack_require__(2); + layoutBase.LGraph = __webpack_require__(5); + layoutBase.LEdge = __webpack_require__(1); + layoutBase.LGraphManager = __webpack_require__(6); + layoutBase.LNode = __webpack_require__(3); + layoutBase.Layout = __webpack_require__(15); + layoutBase.LayoutConstants = __webpack_require__(0); + layoutBase.NeedlemanWunsch = __webpack_require__(25); + module3.exports = layoutBase; + }), + /* 27 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function Emitter2() { + this.listeners = []; + } + __name(Emitter2, "Emitter"); + var p3 = Emitter2.prototype; + p3.addListener = function(event3, callback) { + this.listeners.push({ + event: event3, + callback + }); + }; + p3.removeListener = function(event3, callback) { + for (var i2 = this.listeners.length; i2 >= 0; i2--) { + var l4 = this.listeners[i2]; + if (l4.event === event3 && l4.callback === callback) { + this.listeners.splice(i2, 1); + } + } + }; + p3.emit = function(event3, data5) { + for (var i2 = 0; i2 < this.listeners.length; i2++) { + var l4 = this.listeners[i2]; + if (event3 === l4.event) { + l4.callback(data5); + } + } + }; + module3.exports = Emitter2; + }) + /******/ + ]) + ); + }); + } + }); + + // ../../node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js + var require_cose_base = __commonJS({ + "../../node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js"(exports2, module2) { + "use strict"; + (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root4, factory) { + if (typeof exports2 === "object" && typeof module2 === "object") + module2.exports = factory(require_layout_base()); + else if (typeof define === "function" && define.amd) + define(["layout-base"], factory); + else if (typeof exports2 === "object") + exports2["coseBase"] = factory(require_layout_base()); + else + root4["coseBase"] = factory(root4["layoutBase"]); + }), "webpackUniversalModuleDefinition"))(exports2, function(__WEBPACK_EXTERNAL_MODULE_0__) { + return ( + /******/ + (function(modules2) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if (installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + var module3 = installedModules[moduleId] = { + /******/ + i: moduleId, + /******/ + l: false, + /******/ + exports: {} + /******/ + }; + modules2[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__); + module3.l = true; + return module3.exports; + } + __name(__webpack_require__, "__webpack_require__"); + __webpack_require__.m = modules2; + __webpack_require__.c = installedModules; + __webpack_require__.i = function(value2) { + return value2; + }; + __webpack_require__.d = function(exports3, name, getter) { + if (!__webpack_require__.o(exports3, name)) { + Object.defineProperty(exports3, name, { + /******/ + configurable: false, + /******/ + enumerable: true, + /******/ + get: getter + /******/ + }); + } + }; + __webpack_require__.n = function(module3) { + var getter = module3 && module3.__esModule ? ( + /******/ + /* @__PURE__ */ __name(function getDefault() { + return module3["default"]; + }, "getDefault") + ) : ( + /******/ + /* @__PURE__ */ __name(function getModuleExports() { + return module3; + }, "getModuleExports") + ); + __webpack_require__.d(getter, "a", getter); + return getter; + }; + __webpack_require__.o = function(object3, property3) { + return Object.prototype.hasOwnProperty.call(object3, property3); + }; + __webpack_require__.p = ""; + return __webpack_require__(__webpack_require__.s = 7); + })([ + /* 0 */ + /***/ + (function(module3, exports3) { + module3.exports = __WEBPACK_EXTERNAL_MODULE_0__; + }), + /* 1 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var FDLayoutConstants = __webpack_require__(0).FDLayoutConstants; + function CoSEConstants() { + } + __name(CoSEConstants, "CoSEConstants"); + for (var prop in FDLayoutConstants) { + CoSEConstants[prop] = FDLayoutConstants[prop]; + } + CoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false; + CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH; + CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60; + CoSEConstants.TILE = true; + CoSEConstants.TILING_PADDING_VERTICAL = 10; + CoSEConstants.TILING_PADDING_HORIZONTAL = 10; + CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false; + module3.exports = CoSEConstants; + }), + /* 2 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var FDLayoutEdge = __webpack_require__(0).FDLayoutEdge; + function CoSEEdge(source, target, vEdge) { + FDLayoutEdge.call(this, source, target, vEdge); + } + __name(CoSEEdge, "CoSEEdge"); + CoSEEdge.prototype = Object.create(FDLayoutEdge.prototype); + for (var prop in FDLayoutEdge) { + CoSEEdge[prop] = FDLayoutEdge[prop]; + } + module3.exports = CoSEEdge; + }), + /* 3 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraph = __webpack_require__(0).LGraph; + function CoSEGraph(parent4, graphMgr, vGraph) { + LGraph.call(this, parent4, graphMgr, vGraph); + } + __name(CoSEGraph, "CoSEGraph"); + CoSEGraph.prototype = Object.create(LGraph.prototype); + for (var prop in LGraph) { + CoSEGraph[prop] = LGraph[prop]; + } + module3.exports = CoSEGraph; + }), + /* 4 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraphManager = __webpack_require__(0).LGraphManager; + function CoSEGraphManager(layout7) { + LGraphManager.call(this, layout7); + } + __name(CoSEGraphManager, "CoSEGraphManager"); + CoSEGraphManager.prototype = Object.create(LGraphManager.prototype); + for (var prop in LGraphManager) { + CoSEGraphManager[prop] = LGraphManager[prop]; + } + module3.exports = CoSEGraphManager; + }), + /* 5 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var FDLayoutNode = __webpack_require__(0).FDLayoutNode; + var IMath = __webpack_require__(0).IMath; + function CoSENode(gm, loc, size4, vNode) { + FDLayoutNode.call(this, gm, loc, size4, vNode); + } + __name(CoSENode, "CoSENode"); + CoSENode.prototype = Object.create(FDLayoutNode.prototype); + for (var prop in FDLayoutNode) { + CoSENode[prop] = FDLayoutNode[prop]; + } + CoSENode.prototype.move = function() { + var layout7 = this.graphManager.getLayout(); + this.displacementX = layout7.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren; + this.displacementY = layout7.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren; + if (Math.abs(this.displacementX) > layout7.coolingFactor * layout7.maxNodeDisplacement) { + this.displacementX = layout7.coolingFactor * layout7.maxNodeDisplacement * IMath.sign(this.displacementX); + } + if (Math.abs(this.displacementY) > layout7.coolingFactor * layout7.maxNodeDisplacement) { + this.displacementY = layout7.coolingFactor * layout7.maxNodeDisplacement * IMath.sign(this.displacementY); + } + if (this.child == null) { + this.moveBy(this.displacementX, this.displacementY); + } else if (this.child.getNodes().length == 0) { + this.moveBy(this.displacementX, this.displacementY); + } else { + this.propogateDisplacementToChildren(this.displacementX, this.displacementY); + } + layout7.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY); + this.springForceX = 0; + this.springForceY = 0; + this.repulsionForceX = 0; + this.repulsionForceY = 0; + this.gravitationForceX = 0; + this.gravitationForceY = 0; + this.displacementX = 0; + this.displacementY = 0; + }; + CoSENode.prototype.propogateDisplacementToChildren = function(dX, dY) { + var nodes5 = this.getChild().getNodes(); + var node2; + for (var i2 = 0; i2 < nodes5.length; i2++) { + node2 = nodes5[i2]; + if (node2.getChild() == null) { + node2.moveBy(dX, dY); + node2.displacementX += dX; + node2.displacementY += dY; + } else { + node2.propogateDisplacementToChildren(dX, dY); + } + } + }; + CoSENode.prototype.setPred1 = function(pred12) { + this.pred1 = pred12; + }; + CoSENode.prototype.getPred1 = function() { + return pred1; + }; + CoSENode.prototype.getPred2 = function() { + return pred2; + }; + CoSENode.prototype.setNext = function(next3) { + this.next = next3; + }; + CoSENode.prototype.getNext = function() { + return next; + }; + CoSENode.prototype.setProcessed = function(processed2) { + this.processed = processed2; + }; + CoSENode.prototype.isProcessed = function() { + return processed; + }; + module3.exports = CoSENode; + }), + /* 6 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var FDLayout = __webpack_require__(0).FDLayout; + var CoSEGraphManager = __webpack_require__(4); + var CoSEGraph = __webpack_require__(3); + var CoSENode = __webpack_require__(5); + var CoSEEdge = __webpack_require__(2); + var CoSEConstants = __webpack_require__(1); + var FDLayoutConstants = __webpack_require__(0).FDLayoutConstants; + var LayoutConstants = __webpack_require__(0).LayoutConstants; + var Point3 = __webpack_require__(0).Point; + var PointD = __webpack_require__(0).PointD; + var Layout2 = __webpack_require__(0).Layout; + var Integer = __webpack_require__(0).Integer; + var IGeometry = __webpack_require__(0).IGeometry; + var LGraph = __webpack_require__(0).LGraph; + var Transform2 = __webpack_require__(0).Transform; + function CoSELayout() { + FDLayout.call(this); + this.toBeTiled = {}; + } + __name(CoSELayout, "CoSELayout"); + CoSELayout.prototype = Object.create(FDLayout.prototype); + for (var prop in FDLayout) { + CoSELayout[prop] = FDLayout[prop]; + } + CoSELayout.prototype.newGraphManager = function() { + var gm = new CoSEGraphManager(this); + this.graphManager = gm; + return gm; + }; + CoSELayout.prototype.newGraph = function(vGraph) { + return new CoSEGraph(null, this.graphManager, vGraph); + }; + CoSELayout.prototype.newNode = function(vNode) { + return new CoSENode(this.graphManager, vNode); + }; + CoSELayout.prototype.newEdge = function(vEdge) { + return new CoSEEdge(null, null, vEdge); + }; + CoSELayout.prototype.initParameters = function() { + FDLayout.prototype.initParameters.call(this, arguments); + if (!this.isSubLayout) { + if (CoSEConstants.DEFAULT_EDGE_LENGTH < 10) { + this.idealEdgeLength = 10; + } else { + this.idealEdgeLength = CoSEConstants.DEFAULT_EDGE_LENGTH; + } + this.useSmartIdealEdgeLengthCalculation = CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION; + this.springConstant = FDLayoutConstants.DEFAULT_SPRING_STRENGTH; + this.repulsionConstant = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH; + this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH; + this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH; + this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR; + this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR; + this.prunedNodesAll = []; + this.growTreeIterations = 0; + this.afterGrowthIterations = 0; + this.isTreeGrowing = false; + this.isGrowthFinished = false; + this.coolingCycle = 0; + this.maxCoolingCycle = this.maxIterations / FDLayoutConstants.CONVERGENCE_CHECK_PERIOD; + this.finalTemperature = FDLayoutConstants.CONVERGENCE_CHECK_PERIOD / this.maxIterations; + this.coolingAdjuster = 1; + } + }; + CoSELayout.prototype.layout = function() { + var createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + if (createBendsAsNeeded) { + this.createBendpoints(); + this.graphManager.resetAllEdges(); + } + this.level = 0; + return this.classicLayout(); + }; + CoSELayout.prototype.classicLayout = function() { + this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(); + this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity); + this.calcNoOfChildrenForAllNodes(); + this.graphManager.calcLowestCommonAncestors(); + this.graphManager.calcInclusionTreeDepths(); + this.graphManager.getRoot().calcEstimatedSize(); + this.calcIdealEdgeLengths(); + if (!this.incremental) { + var forest = this.getFlatForest(); + if (forest.length > 0) { + this.positionNodesRadially(forest); + } else { + this.reduceTrees(); + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection4 = this.nodesWithGravity.filter(function(x5) { + return allNodes.has(x5); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection4); + this.positionNodesRandomly(); + } + } else { + if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) { + this.reduceTrees(); + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection4 = this.nodesWithGravity.filter(function(x5) { + return allNodes.has(x5); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection4); + } + } + this.initSpringEmbedder(); + this.runSpringEmbedder(); + return true; + }; + CoSELayout.prototype.tick = function() { + this.totalIterations++; + if (this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) { + if (this.prunedNodesAll.length > 0) { + this.isTreeGrowing = true; + } else { + return true; + } + } + if (this.totalIterations % FDLayoutConstants.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) { + if (this.isConverged()) { + if (this.prunedNodesAll.length > 0) { + this.isTreeGrowing = true; + } else { + return true; + } + } + this.coolingCycle++; + if (this.layoutQuality == 0) { + this.coolingAdjuster = this.coolingCycle; + } else if (this.layoutQuality == 1) { + this.coolingAdjuster = this.coolingCycle / 3; + } + this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature); + this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor)); + } + if (this.isTreeGrowing) { + if (this.growTreeIterations % 10 == 0) { + if (this.prunedNodesAll.length > 0) { + this.graphManager.updateBounds(); + this.updateGrid(); + this.growTree(this.prunedNodesAll); + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection4 = this.nodesWithGravity.filter(function(x5) { + return allNodes.has(x5); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection4); + this.graphManager.updateBounds(); + this.updateGrid(); + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + } else { + this.isTreeGrowing = false; + this.isGrowthFinished = true; + } + } + this.growTreeIterations++; + } + if (this.isGrowthFinished) { + if (this.isConverged()) { + return true; + } + if (this.afterGrowthIterations % 10 == 0) { + this.graphManager.updateBounds(); + this.updateGrid(); + } + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100); + this.afterGrowthIterations++; + } + var gridUpdateAllowed = !this.isTreeGrowing && !this.isGrowthFinished; + var forceToNodeSurroundingUpdate = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished; + this.totalDisplacement = 0; + this.graphManager.updateBounds(); + this.calcSpringForces(); + this.calcRepulsionForces(gridUpdateAllowed, forceToNodeSurroundingUpdate); + this.calcGravitationalForces(); + this.moveNodes(); + this.animate(); + return false; + }; + CoSELayout.prototype.getPositionsData = function() { + var allNodes = this.graphManager.getAllNodes(); + var pData = {}; + for (var i2 = 0; i2 < allNodes.length; i2++) { + var rect3 = allNodes[i2].rect; + var id35 = allNodes[i2].id; + pData[id35] = { + id: id35, + x: rect3.getCenterX(), + y: rect3.getCenterY(), + w: rect3.width, + h: rect3.height + }; + } + return pData; + }; + CoSELayout.prototype.runSpringEmbedder = function() { + this.initialAnimationPeriod = 25; + this.animationPeriod = this.initialAnimationPeriod; + var layoutEnded = false; + if (FDLayoutConstants.ANIMATE === "during") { + this.emit("layoutstarted"); + } else { + while (!layoutEnded) { + layoutEnded = this.tick(); + } + this.graphManager.updateBounds(); + } + }; + CoSELayout.prototype.calculateNodesToApplyGravitationTo = function() { + var nodeList = []; + var graph; + var graphs = this.graphManager.getGraphs(); + var size4 = graphs.length; + var i2; + for (i2 = 0; i2 < size4; i2++) { + graph = graphs[i2]; + graph.updateConnected(); + if (!graph.isConnected) { + nodeList = nodeList.concat(graph.getNodes()); + } + } + return nodeList; + }; + CoSELayout.prototype.createBendpoints = function() { + var edges3 = []; + edges3 = edges3.concat(this.graphManager.getAllEdges()); + var visited = /* @__PURE__ */ new Set(); + var i2; + for (i2 = 0; i2 < edges3.length; i2++) { + var edge = edges3[i2]; + if (!visited.has(edge)) { + var source = edge.getSource(); + var target = edge.getTarget(); + if (source == target) { + edge.getBendpoints().push(new PointD()); + edge.getBendpoints().push(new PointD()); + this.createDummyNodesForBendpoints(edge); + visited.add(edge); + } else { + var edgeList2 = []; + edgeList2 = edgeList2.concat(source.getEdgeListToNode(target)); + edgeList2 = edgeList2.concat(target.getEdgeListToNode(source)); + if (!visited.has(edgeList2[0])) { + if (edgeList2.length > 1) { + var k2; + for (k2 = 0; k2 < edgeList2.length; k2++) { + var multiEdge = edgeList2[k2]; + multiEdge.getBendpoints().push(new PointD()); + this.createDummyNodesForBendpoints(multiEdge); + } + } + edgeList2.forEach(function(edge2) { + visited.add(edge2); + }); + } + } + } + if (visited.size == edges3.length) { + break; + } + } + }; + CoSELayout.prototype.positionNodesRadially = function(forest) { + var currentStartingPoint = new Point3(0, 0); + var numberOfColumns = Math.ceil(Math.sqrt(forest.length)); + var height2 = 0; + var currentY = 0; + var currentX = 0; + var point8 = new PointD(0, 0); + for (var i2 = 0; i2 < forest.length; i2++) { + if (i2 % numberOfColumns == 0) { + currentX = 0; + currentY = height2; + if (i2 != 0) { + currentY += CoSEConstants.DEFAULT_COMPONENT_SEPERATION; + } + height2 = 0; + } + var tree = forest[i2]; + var centerNode = Layout2.findCenterOfTree(tree); + currentStartingPoint.x = currentX; + currentStartingPoint.y = currentY; + point8 = CoSELayout.radialLayout(tree, centerNode, currentStartingPoint); + if (point8.y > height2) { + height2 = Math.floor(point8.y); + } + currentX = Math.floor(point8.x + CoSEConstants.DEFAULT_COMPONENT_SEPERATION); + } + this.transform(new PointD(LayoutConstants.WORLD_CENTER_X - point8.x / 2, LayoutConstants.WORLD_CENTER_Y - point8.y / 2)); + }; + CoSELayout.radialLayout = function(tree, centerNode, startingPoint) { + var radialSep = Math.max(this.maxDiagonalInTree(tree), CoSEConstants.DEFAULT_RADIAL_SEPARATION); + CoSELayout.branchRadialLayout(centerNode, null, 0, 359, 0, radialSep); + var bounds4 = LGraph.calculateBounds(tree); + var transform8 = new Transform2(); + transform8.setDeviceOrgX(bounds4.getMinX()); + transform8.setDeviceOrgY(bounds4.getMinY()); + transform8.setWorldOrgX(startingPoint.x); + transform8.setWorldOrgY(startingPoint.y); + for (var i2 = 0; i2 < tree.length; i2++) { + var node2 = tree[i2]; + node2.transform(transform8); + } + var bottomRight = new PointD(bounds4.getMaxX(), bounds4.getMaxY()); + return transform8.inverseTransformPoint(bottomRight); + }; + CoSELayout.branchRadialLayout = function(node2, parentOfNode, startAngle, endAngle, distance3, radialSeparation) { + var halfInterval = (endAngle - startAngle + 1) / 2; + if (halfInterval < 0) { + halfInterval += 180; + } + var nodeAngle = (halfInterval + startAngle) % 360; + var teta = nodeAngle * IGeometry.TWO_PI / 360; + var cos_teta = Math.cos(teta); + var x_ = distance3 * Math.cos(teta); + var y_ = distance3 * Math.sin(teta); + node2.setCenter(x_, y_); + var neighborEdges = []; + neighborEdges = neighborEdges.concat(node2.getEdges()); + var childCount = neighborEdges.length; + if (parentOfNode != null) { + childCount--; + } + var branchCount = 0; + var incEdgesCount = neighborEdges.length; + var startIndex; + var edges3 = node2.getEdgesBetween(parentOfNode); + while (edges3.length > 1) { + var temp = edges3[0]; + edges3.splice(0, 1); + var index = neighborEdges.indexOf(temp); + if (index >= 0) { + neighborEdges.splice(index, 1); + } + incEdgesCount--; + childCount--; + } + if (parentOfNode != null) { + startIndex = (neighborEdges.indexOf(edges3[0]) + 1) % incEdgesCount; + } else { + startIndex = 0; + } + var stepAngle = Math.abs(endAngle - startAngle) / childCount; + for (var i2 = startIndex; branchCount != childCount; i2 = ++i2 % incEdgesCount) { + var currentNeighbor = neighborEdges[i2].getOtherEnd(node2); + if (currentNeighbor == parentOfNode) { + continue; + } + var childStartAngle = (startAngle + branchCount * stepAngle) % 360; + var childEndAngle = (childStartAngle + stepAngle) % 360; + CoSELayout.branchRadialLayout(currentNeighbor, node2, childStartAngle, childEndAngle, distance3 + radialSeparation, radialSeparation); + branchCount++; + } + }; + CoSELayout.maxDiagonalInTree = function(tree) { + var maxDiagonal = Integer.MIN_VALUE; + for (var i2 = 0; i2 < tree.length; i2++) { + var node2 = tree[i2]; + var diagonal = node2.getDiagonal(); + if (diagonal > maxDiagonal) { + maxDiagonal = diagonal; + } + } + return maxDiagonal; + }; + CoSELayout.prototype.calcRepulsionRange = function() { + return 2 * (this.level + 1) * this.idealEdgeLength; + }; + CoSELayout.prototype.groupZeroDegreeMembers = function() { + var self2 = this; + var tempMemberGroups = {}; + this.memberGroups = {}; + this.idToDummyNode = {}; + var zeroDegree = []; + var allNodes = this.graphManager.getAllNodes(); + for (var i2 = 0; i2 < allNodes.length; i2++) { + var node2 = allNodes[i2]; + var parent4 = node2.getParent(); + if (this.getNodeDegreeWithChildren(node2) === 0 && (parent4.id == void 0 || !this.getToBeTiled(parent4))) { + zeroDegree.push(node2); + } + } + for (var i2 = 0; i2 < zeroDegree.length; i2++) { + var node2 = zeroDegree[i2]; + var p_id = node2.getParent().id; + if (typeof tempMemberGroups[p_id] === "undefined") tempMemberGroups[p_id] = []; + tempMemberGroups[p_id] = tempMemberGroups[p_id].concat(node2); + } + Object.keys(tempMemberGroups).forEach(function(p_id2) { + if (tempMemberGroups[p_id2].length > 1) { + var dummyCompoundId = "DummyCompound_" + p_id2; + self2.memberGroups[dummyCompoundId] = tempMemberGroups[p_id2]; + var parent5 = tempMemberGroups[p_id2][0].getParent(); + var dummyCompound = new CoSENode(self2.graphManager); + dummyCompound.id = dummyCompoundId; + dummyCompound.paddingLeft = parent5.paddingLeft || 0; + dummyCompound.paddingRight = parent5.paddingRight || 0; + dummyCompound.paddingBottom = parent5.paddingBottom || 0; + dummyCompound.paddingTop = parent5.paddingTop || 0; + self2.idToDummyNode[dummyCompoundId] = dummyCompound; + var dummyParentGraph = self2.getGraphManager().add(self2.newGraph(), dummyCompound); + var parentGraph = parent5.getChild(); + parentGraph.add(dummyCompound); + for (var i3 = 0; i3 < tempMemberGroups[p_id2].length; i3++) { + var node3 = tempMemberGroups[p_id2][i3]; + parentGraph.remove(node3); + dummyParentGraph.add(node3); + } + } + }); + }; + CoSELayout.prototype.clearCompounds = function() { + var childGraphMap = {}; + var idToNode = {}; + this.performDFSOnCompounds(); + for (var i2 = 0; i2 < this.compoundOrder.length; i2++) { + idToNode[this.compoundOrder[i2].id] = this.compoundOrder[i2]; + childGraphMap[this.compoundOrder[i2].id] = [].concat(this.compoundOrder[i2].getChild().getNodes()); + this.graphManager.remove(this.compoundOrder[i2].getChild()); + this.compoundOrder[i2].child = null; + } + this.graphManager.resetAllNodes(); + this.tileCompoundMembers(childGraphMap, idToNode); + }; + CoSELayout.prototype.clearZeroDegreeMembers = function() { + var self2 = this; + var tiledZeroDegreePack = this.tiledZeroDegreePack = []; + Object.keys(this.memberGroups).forEach(function(id35) { + var compoundNode = self2.idToDummyNode[id35]; + tiledZeroDegreePack[id35] = self2.tileNodes(self2.memberGroups[id35], compoundNode.paddingLeft + compoundNode.paddingRight); + compoundNode.rect.width = tiledZeroDegreePack[id35].width; + compoundNode.rect.height = tiledZeroDegreePack[id35].height; + }); + }; + CoSELayout.prototype.repopulateCompounds = function() { + for (var i2 = this.compoundOrder.length - 1; i2 >= 0; i2--) { + var lCompoundNode = this.compoundOrder[i2]; + var id35 = lCompoundNode.id; + var horizontalMargin = lCompoundNode.paddingLeft; + var verticalMargin = lCompoundNode.paddingTop; + this.adjustLocations(this.tiledMemberPack[id35], lCompoundNode.rect.x, lCompoundNode.rect.y, horizontalMargin, verticalMargin); + } + }; + CoSELayout.prototype.repopulateZeroDegreeMembers = function() { + var self2 = this; + var tiledPack = this.tiledZeroDegreePack; + Object.keys(tiledPack).forEach(function(id35) { + var compoundNode = self2.idToDummyNode[id35]; + var horizontalMargin = compoundNode.paddingLeft; + var verticalMargin = compoundNode.paddingTop; + self2.adjustLocations(tiledPack[id35], compoundNode.rect.x, compoundNode.rect.y, horizontalMargin, verticalMargin); + }); + }; + CoSELayout.prototype.getToBeTiled = function(node2) { + var id35 = node2.id; + if (this.toBeTiled[id35] != null) { + return this.toBeTiled[id35]; + } + var childGraph = node2.getChild(); + if (childGraph == null) { + this.toBeTiled[id35] = false; + return false; + } + var children2 = childGraph.getNodes(); + for (var i2 = 0; i2 < children2.length; i2++) { + var theChild = children2[i2]; + if (this.getNodeDegree(theChild) > 0) { + this.toBeTiled[id35] = false; + return false; + } + if (theChild.getChild() == null) { + this.toBeTiled[theChild.id] = false; + continue; + } + if (!this.getToBeTiled(theChild)) { + this.toBeTiled[id35] = false; + return false; + } + } + this.toBeTiled[id35] = true; + return true; + }; + CoSELayout.prototype.getNodeDegree = function(node2) { + var id35 = node2.id; + var edges3 = node2.getEdges(); + var degree = 0; + for (var i2 = 0; i2 < edges3.length; i2++) { + var edge = edges3[i2]; + if (edge.getSource().id !== edge.getTarget().id) { + degree = degree + 1; + } + } + return degree; + }; + CoSELayout.prototype.getNodeDegreeWithChildren = function(node2) { + var degree = this.getNodeDegree(node2); + if (node2.getChild() == null) { + return degree; + } + var children2 = node2.getChild().getNodes(); + for (var i2 = 0; i2 < children2.length; i2++) { + var child = children2[i2]; + degree += this.getNodeDegreeWithChildren(child); + } + return degree; + }; + CoSELayout.prototype.performDFSOnCompounds = function() { + this.compoundOrder = []; + this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes()); + }; + CoSELayout.prototype.fillCompexOrderByDFS = function(children2) { + for (var i2 = 0; i2 < children2.length; i2++) { + var child = children2[i2]; + if (child.getChild() != null) { + this.fillCompexOrderByDFS(child.getChild().getNodes()); + } + if (this.getToBeTiled(child)) { + this.compoundOrder.push(child); + } + } + }; + CoSELayout.prototype.adjustLocations = function(organization, x5, y6, compoundHorizontalMargin, compoundVerticalMargin) { + x5 += compoundHorizontalMargin; + y6 += compoundVerticalMargin; + var left3 = x5; + for (var i2 = 0; i2 < organization.rows.length; i2++) { + var row = organization.rows[i2]; + x5 = left3; + var maxHeight = 0; + for (var j3 = 0; j3 < row.length; j3++) { + var lnode = row[j3]; + lnode.rect.x = x5; + lnode.rect.y = y6; + x5 += lnode.rect.width + organization.horizontalPadding; + if (lnode.rect.height > maxHeight) maxHeight = lnode.rect.height; + } + y6 += maxHeight + organization.verticalPadding; + } + }; + CoSELayout.prototype.tileCompoundMembers = function(childGraphMap, idToNode) { + var self2 = this; + this.tiledMemberPack = []; + Object.keys(childGraphMap).forEach(function(id35) { + var compoundNode = idToNode[id35]; + self2.tiledMemberPack[id35] = self2.tileNodes(childGraphMap[id35], compoundNode.paddingLeft + compoundNode.paddingRight); + compoundNode.rect.width = self2.tiledMemberPack[id35].width; + compoundNode.rect.height = self2.tiledMemberPack[id35].height; + }); + }; + CoSELayout.prototype.tileNodes = function(nodes5, minWidth) { + var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL; + var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL; + var organization = { + rows: [], + rowWidth: [], + rowHeight: [], + width: 0, + height: minWidth, + // assume minHeight equals to minWidth + verticalPadding, + horizontalPadding + }; + nodes5.sort(function(n1, n2) { + if (n1.rect.width * n1.rect.height > n2.rect.width * n2.rect.height) return -1; + if (n1.rect.width * n1.rect.height < n2.rect.width * n2.rect.height) return 1; + return 0; + }); + for (var i2 = 0; i2 < nodes5.length; i2++) { + var lNode = nodes5[i2]; + if (organization.rows.length == 0) { + this.insertNodeToRow(organization, lNode, 0, minWidth); + } else if (this.canAddHorizontal(organization, lNode.rect.width, lNode.rect.height)) { + this.insertNodeToRow(organization, lNode, this.getShortestRowIndex(organization), minWidth); + } else { + this.insertNodeToRow(organization, lNode, organization.rows.length, minWidth); + } + this.shiftToLastRow(organization); + } + return organization; + }; + CoSELayout.prototype.insertNodeToRow = function(organization, node2, rowIndex, minWidth) { + var minCompoundSize = minWidth; + if (rowIndex == organization.rows.length) { + var secondDimension = []; + organization.rows.push(secondDimension); + organization.rowWidth.push(minCompoundSize); + organization.rowHeight.push(0); + } + var w4 = organization.rowWidth[rowIndex] + node2.rect.width; + if (organization.rows[rowIndex].length > 0) { + w4 += organization.horizontalPadding; + } + organization.rowWidth[rowIndex] = w4; + if (organization.width < w4) { + organization.width = w4; + } + var h3 = node2.rect.height; + if (rowIndex > 0) h3 += organization.verticalPadding; + var extraHeight = 0; + if (h3 > organization.rowHeight[rowIndex]) { + extraHeight = organization.rowHeight[rowIndex]; + organization.rowHeight[rowIndex] = h3; + extraHeight = organization.rowHeight[rowIndex] - extraHeight; + } + organization.height += extraHeight; + organization.rows[rowIndex].push(node2); + }; + CoSELayout.prototype.getShortestRowIndex = function(organization) { + var r2 = -1; + var min10 = Number.MAX_VALUE; + for (var i2 = 0; i2 < organization.rows.length; i2++) { + if (organization.rowWidth[i2] < min10) { + r2 = i2; + min10 = organization.rowWidth[i2]; + } + } + return r2; + }; + CoSELayout.prototype.getLongestRowIndex = function(organization) { + var r2 = -1; + var max10 = Number.MIN_VALUE; + for (var i2 = 0; i2 < organization.rows.length; i2++) { + if (organization.rowWidth[i2] > max10) { + r2 = i2; + max10 = organization.rowWidth[i2]; + } + } + return r2; + }; + CoSELayout.prototype.canAddHorizontal = function(organization, extraWidth, extraHeight) { + var sri = this.getShortestRowIndex(organization); + if (sri < 0) { + return true; + } + var min10 = organization.rowWidth[sri]; + if (min10 + organization.horizontalPadding + extraWidth <= organization.width) return true; + var hDiff = 0; + if (organization.rowHeight[sri] < extraHeight) { + if (sri > 0) hDiff = extraHeight + organization.verticalPadding - organization.rowHeight[sri]; + } + var add_to_row_ratio; + if (organization.width - min10 >= extraWidth + organization.horizontalPadding) { + add_to_row_ratio = (organization.height + hDiff) / (min10 + extraWidth + organization.horizontalPadding); + } else { + add_to_row_ratio = (organization.height + hDiff) / organization.width; + } + hDiff = extraHeight + organization.verticalPadding; + var add_new_row_ratio; + if (organization.width < extraWidth) { + add_new_row_ratio = (organization.height + hDiff) / extraWidth; + } else { + add_new_row_ratio = (organization.height + hDiff) / organization.width; + } + if (add_new_row_ratio < 1) add_new_row_ratio = 1 / add_new_row_ratio; + if (add_to_row_ratio < 1) add_to_row_ratio = 1 / add_to_row_ratio; + return add_to_row_ratio < add_new_row_ratio; + }; + CoSELayout.prototype.shiftToLastRow = function(organization) { + var longest = this.getLongestRowIndex(organization); + var last4 = organization.rowWidth.length - 1; + var row = organization.rows[longest]; + var node2 = row[row.length - 1]; + var diff2 = node2.width + organization.horizontalPadding; + if (organization.width - organization.rowWidth[last4] > diff2 && longest != last4) { + row.splice(-1, 1); + organization.rows[last4].push(node2); + organization.rowWidth[longest] = organization.rowWidth[longest] - diff2; + organization.rowWidth[last4] = organization.rowWidth[last4] + diff2; + organization.width = organization.rowWidth[instance.getLongestRowIndex(organization)]; + var maxHeight = Number.MIN_VALUE; + for (var i2 = 0; i2 < row.length; i2++) { + if (row[i2].height > maxHeight) maxHeight = row[i2].height; + } + if (longest > 0) maxHeight += organization.verticalPadding; + var prevTotal = organization.rowHeight[longest] + organization.rowHeight[last4]; + organization.rowHeight[longest] = maxHeight; + if (organization.rowHeight[last4] < node2.height + organization.verticalPadding) organization.rowHeight[last4] = node2.height + organization.verticalPadding; + var finalTotal = organization.rowHeight[longest] + organization.rowHeight[last4]; + organization.height += finalTotal - prevTotal; + this.shiftToLastRow(organization); + } + }; + CoSELayout.prototype.tilingPreLayout = function() { + if (CoSEConstants.TILE) { + this.groupZeroDegreeMembers(); + this.clearCompounds(); + this.clearZeroDegreeMembers(); + } + }; + CoSELayout.prototype.tilingPostLayout = function() { + if (CoSEConstants.TILE) { + this.repopulateZeroDegreeMembers(); + this.repopulateCompounds(); + } + }; + CoSELayout.prototype.reduceTrees = function() { + var prunedNodesAll = []; + var containsLeaf = true; + var node2; + while (containsLeaf) { + var allNodes = this.graphManager.getAllNodes(); + var prunedNodesInStepTemp = []; + containsLeaf = false; + for (var i2 = 0; i2 < allNodes.length; i2++) { + node2 = allNodes[i2]; + if (node2.getEdges().length == 1 && !node2.getEdges()[0].isInterGraph && node2.getChild() == null) { + prunedNodesInStepTemp.push([node2, node2.getEdges()[0], node2.getOwner()]); + containsLeaf = true; + } + } + if (containsLeaf == true) { + var prunedNodesInStep = []; + for (var j3 = 0; j3 < prunedNodesInStepTemp.length; j3++) { + if (prunedNodesInStepTemp[j3][0].getEdges().length == 1) { + prunedNodesInStep.push(prunedNodesInStepTemp[j3]); + prunedNodesInStepTemp[j3][0].getOwner().remove(prunedNodesInStepTemp[j3][0]); + } + } + prunedNodesAll.push(prunedNodesInStep); + this.graphManager.resetAllNodes(); + this.graphManager.resetAllEdges(); + } + } + this.prunedNodesAll = prunedNodesAll; + }; + CoSELayout.prototype.growTree = function(prunedNodesAll) { + var lengthOfPrunedNodesInStep = prunedNodesAll.length; + var prunedNodesInStep = prunedNodesAll[lengthOfPrunedNodesInStep - 1]; + var nodeData2; + for (var i2 = 0; i2 < prunedNodesInStep.length; i2++) { + nodeData2 = prunedNodesInStep[i2]; + this.findPlaceforPrunedNode(nodeData2); + nodeData2[2].add(nodeData2[0]); + nodeData2[2].add(nodeData2[1], nodeData2[1].source, nodeData2[1].target); + } + prunedNodesAll.splice(prunedNodesAll.length - 1, 1); + this.graphManager.resetAllNodes(); + this.graphManager.resetAllEdges(); + }; + CoSELayout.prototype.findPlaceforPrunedNode = function(nodeData2) { + var gridForPrunedNode; + var nodeToConnect; + var prunedNode = nodeData2[0]; + if (prunedNode == nodeData2[1].source) { + nodeToConnect = nodeData2[1].target; + } else { + nodeToConnect = nodeData2[1].source; + } + var startGridX = nodeToConnect.startX; + var finishGridX = nodeToConnect.finishX; + var startGridY = nodeToConnect.startY; + var finishGridY = nodeToConnect.finishY; + var upNodeCount = 0; + var downNodeCount = 0; + var rightNodeCount = 0; + var leftNodeCount = 0; + var controlRegions = [upNodeCount, rightNodeCount, downNodeCount, leftNodeCount]; + if (startGridY > 0) { + for (var i2 = startGridX; i2 <= finishGridX; i2++) { + controlRegions[0] += this.grid[i2][startGridY - 1].length + this.grid[i2][startGridY].length - 1; + } + } + if (finishGridX < this.grid.length - 1) { + for (var i2 = startGridY; i2 <= finishGridY; i2++) { + controlRegions[1] += this.grid[finishGridX + 1][i2].length + this.grid[finishGridX][i2].length - 1; + } + } + if (finishGridY < this.grid[0].length - 1) { + for (var i2 = startGridX; i2 <= finishGridX; i2++) { + controlRegions[2] += this.grid[i2][finishGridY + 1].length + this.grid[i2][finishGridY].length - 1; + } + } + if (startGridX > 0) { + for (var i2 = startGridY; i2 <= finishGridY; i2++) { + controlRegions[3] += this.grid[startGridX - 1][i2].length + this.grid[startGridX][i2].length - 1; + } + } + var min10 = Integer.MAX_VALUE; + var minCount; + var minIndex; + for (var j3 = 0; j3 < controlRegions.length; j3++) { + if (controlRegions[j3] < min10) { + min10 = controlRegions[j3]; + minCount = 1; + minIndex = j3; + } else if (controlRegions[j3] == min10) { + minCount++; + } + } + if (minCount == 3 && min10 == 0) { + if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[2] == 0) { + gridForPrunedNode = 1; + } else if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 0; + } else if (controlRegions[0] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 3; + } else if (controlRegions[1] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 2; + } + } else if (minCount == 2 && min10 == 0) { + var random2 = Math.floor(Math.random() * 2); + if (controlRegions[0] == 0 && controlRegions[1] == 0) { + ; + if (random2 == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 1; + } + } else if (controlRegions[0] == 0 && controlRegions[2] == 0) { + if (random2 == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 2; + } + } else if (controlRegions[0] == 0 && controlRegions[3] == 0) { + if (random2 == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 3; + } + } else if (controlRegions[1] == 0 && controlRegions[2] == 0) { + if (random2 == 0) { + gridForPrunedNode = 1; + } else { + gridForPrunedNode = 2; + } + } else if (controlRegions[1] == 0 && controlRegions[3] == 0) { + if (random2 == 0) { + gridForPrunedNode = 1; + } else { + gridForPrunedNode = 3; + } + } else { + if (random2 == 0) { + gridForPrunedNode = 2; + } else { + gridForPrunedNode = 3; + } + } + } else if (minCount == 4 && min10 == 0) { + var random2 = Math.floor(Math.random() * 4); + gridForPrunedNode = random2; + } else { + gridForPrunedNode = minIndex; + } + if (gridForPrunedNode == 0) { + prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() - nodeToConnect.getHeight() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getHeight() / 2); + } else if (gridForPrunedNode == 1) { + prunedNode.setCenter(nodeToConnect.getCenterX() + nodeToConnect.getWidth() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getWidth() / 2, nodeToConnect.getCenterY()); + } else if (gridForPrunedNode == 2) { + prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() + nodeToConnect.getHeight() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getHeight() / 2); + } else { + prunedNode.setCenter(nodeToConnect.getCenterX() - nodeToConnect.getWidth() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getWidth() / 2, nodeToConnect.getCenterY()); + } + }; + module3.exports = CoSELayout; + }), + /* 7 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var coseBase = {}; + coseBase.layoutBase = __webpack_require__(0); + coseBase.CoSEConstants = __webpack_require__(1); + coseBase.CoSEEdge = __webpack_require__(2); + coseBase.CoSEGraph = __webpack_require__(3); + coseBase.CoSEGraphManager = __webpack_require__(4); + coseBase.CoSELayout = __webpack_require__(6); + coseBase.CoSENode = __webpack_require__(5); + module3.exports = coseBase; + }) + /******/ + ]) + ); + }); + } + }); + + // ../../node_modules/.pnpm/cytoscape-cose-bilkent@4.1.0_cytoscape@3.33.1/node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.js + var require_cytoscape_cose_bilkent = __commonJS({ + "../../node_modules/.pnpm/cytoscape-cose-bilkent@4.1.0_cytoscape@3.33.1/node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.js"(exports2, module2) { + "use strict"; + (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root4, factory) { + if (typeof exports2 === "object" && typeof module2 === "object") + module2.exports = factory(require_cose_base()); + else if (typeof define === "function" && define.amd) + define(["cose-base"], factory); + else if (typeof exports2 === "object") + exports2["cytoscapeCoseBilkent"] = factory(require_cose_base()); + else + root4["cytoscapeCoseBilkent"] = factory(root4["coseBase"]); + }), "webpackUniversalModuleDefinition"))(exports2, function(__WEBPACK_EXTERNAL_MODULE_0__) { + return ( + /******/ + (function(modules2) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if (installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + var module3 = installedModules[moduleId] = { + /******/ + i: moduleId, + /******/ + l: false, + /******/ + exports: {} + /******/ + }; + modules2[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__); + module3.l = true; + return module3.exports; + } + __name(__webpack_require__, "__webpack_require__"); + __webpack_require__.m = modules2; + __webpack_require__.c = installedModules; + __webpack_require__.i = function(value2) { + return value2; + }; + __webpack_require__.d = function(exports3, name, getter) { + if (!__webpack_require__.o(exports3, name)) { + Object.defineProperty(exports3, name, { + /******/ + configurable: false, + /******/ + enumerable: true, + /******/ + get: getter + /******/ + }); + } + }; + __webpack_require__.n = function(module3) { + var getter = module3 && module3.__esModule ? ( + /******/ + /* @__PURE__ */ __name(function getDefault() { + return module3["default"]; + }, "getDefault") + ) : ( + /******/ + /* @__PURE__ */ __name(function getModuleExports() { + return module3; + }, "getModuleExports") + ); + __webpack_require__.d(getter, "a", getter); + return getter; + }; + __webpack_require__.o = function(object3, property3) { + return Object.prototype.hasOwnProperty.call(object3, property3); + }; + __webpack_require__.p = ""; + return __webpack_require__(__webpack_require__.s = 1); + })([ + /* 0 */ + /***/ + (function(module3, exports3) { + module3.exports = __WEBPACK_EXTERNAL_MODULE_0__; + }), + /* 1 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LayoutConstants = __webpack_require__(0).layoutBase.LayoutConstants; + var FDLayoutConstants = __webpack_require__(0).layoutBase.FDLayoutConstants; + var CoSEConstants = __webpack_require__(0).CoSEConstants; + var CoSELayout = __webpack_require__(0).CoSELayout; + var CoSENode = __webpack_require__(0).CoSENode; + var PointD = __webpack_require__(0).layoutBase.PointD; + var DimensionD2 = __webpack_require__(0).layoutBase.DimensionD; + var defaults5 = { + // Called on `layoutready` + ready: /* @__PURE__ */ __name(function ready4() { + }, "ready"), + // Called on `layoutstop` + stop: /* @__PURE__ */ __name(function stop5() { + }, "stop"), + // 'draft', 'default' or 'proof" + // - 'draft' fast cooling rate + // - 'default' moderate cooling rate + // - "proof" slow cooling rate + quality: "default", + // include labels in node dimensions + nodeDimensionsIncludeLabels: false, + // number of ticks per frame; higher is faster but more jerky + refresh: 30, + // Whether to fit the network view after when done + fit: true, + // Padding on fit + padding: 10, + // Whether to enable incremental mode + randomize: true, + // Node repulsion (non overlapping) multiplier + nodeRepulsion: 4500, + // Ideal edge (non nested) length + idealEdgeLength: 50, + // Divisor to compute edge forces + edgeElasticity: 0.45, + // Nesting factor (multiplier) to compute ideal edge length for nested edges + nestingFactor: 0.1, + // Gravity force (constant) + gravity: 0.25, + // Maximum number of iterations to perform + numIter: 2500, + // For enabling tiling + tile: true, + // Type of layout animation. The option set is {'during', 'end', false} + animate: "end", + // Duration for animate:end + animationDuration: 500, + // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingVertical: 10, + // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingHorizontal: 10, + // Gravity range (constant) for compounds + gravityRangeCompound: 1.5, + // Gravity force (constant) for compounds + gravityCompound: 1, + // Gravity range (constant) + gravityRange: 3.8, + // Initial cooling factor for incremental layout + initialEnergyOnIncremental: 0.5 + }; + function extend5(defaults6, options2) { + var obj = {}; + for (var i2 in defaults6) { + obj[i2] = defaults6[i2]; + } + for (var i2 in options2) { + obj[i2] = options2[i2]; + } + return obj; + } + __name(extend5, "extend"); + ; + function _CoSELayout(_options) { + this.options = extend5(defaults5, _options); + getUserOptions(this.options); + } + __name(_CoSELayout, "_CoSELayout"); + var getUserOptions = /* @__PURE__ */ __name(function getUserOptions2(options2) { + if (options2.nodeRepulsion != null) CoSEConstants.DEFAULT_REPULSION_STRENGTH = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = options2.nodeRepulsion; + if (options2.idealEdgeLength != null) CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = options2.idealEdgeLength; + if (options2.edgeElasticity != null) CoSEConstants.DEFAULT_SPRING_STRENGTH = FDLayoutConstants.DEFAULT_SPRING_STRENGTH = options2.edgeElasticity; + if (options2.nestingFactor != null) CoSEConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = options2.nestingFactor; + if (options2.gravity != null) CoSEConstants.DEFAULT_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = options2.gravity; + if (options2.numIter != null) CoSEConstants.MAX_ITERATIONS = FDLayoutConstants.MAX_ITERATIONS = options2.numIter; + if (options2.gravityRange != null) CoSEConstants.DEFAULT_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = options2.gravityRange; + if (options2.gravityCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = options2.gravityCompound; + if (options2.gravityRangeCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = options2.gravityRangeCompound; + if (options2.initialEnergyOnIncremental != null) CoSEConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = options2.initialEnergyOnIncremental; + if (options2.quality == "draft") LayoutConstants.QUALITY = 0; + else if (options2.quality == "proof") LayoutConstants.QUALITY = 2; + else LayoutConstants.QUALITY = 1; + CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS = FDLayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = options2.nodeDimensionsIncludeLabels; + CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = !options2.randomize; + CoSEConstants.ANIMATE = FDLayoutConstants.ANIMATE = LayoutConstants.ANIMATE = options2.animate; + CoSEConstants.TILE = options2.tile; + CoSEConstants.TILING_PADDING_VERTICAL = typeof options2.tilingPaddingVertical === "function" ? options2.tilingPaddingVertical.call() : options2.tilingPaddingVertical; + CoSEConstants.TILING_PADDING_HORIZONTAL = typeof options2.tilingPaddingHorizontal === "function" ? options2.tilingPaddingHorizontal.call() : options2.tilingPaddingHorizontal; + }, "getUserOptions"); + _CoSELayout.prototype.run = function() { + var ready4; + var frameId; + var options2 = this.options; + var idToLNode = this.idToLNode = {}; + var layout7 = this.layout = new CoSELayout(); + var self2 = this; + self2.stopped = false; + this.cy = this.options.cy; + this.cy.trigger({ type: "layoutstart", layout: this }); + var gm = layout7.newGraphManager(); + this.gm = gm; + var nodes5 = this.options.eles.nodes(); + var edges3 = this.options.eles.edges(); + this.root = gm.addRoot(); + this.processChildrenList(this.root, this.getTopMostNodes(nodes5), layout7); + for (var i2 = 0; i2 < edges3.length; i2++) { + var edge = edges3[i2]; + var sourceNode = this.idToLNode[edge.data("source")]; + var targetNode = this.idToLNode[edge.data("target")]; + if (sourceNode !== targetNode && sourceNode.getEdgesBetween(targetNode).length == 0) { + var e1 = gm.add(layout7.newEdge(), sourceNode, targetNode); + e1.id = edge.id(); + } + } + var getPositions = /* @__PURE__ */ __name(function getPositions2(ele, i3) { + if (typeof ele === "number") { + ele = i3; + } + var theId = ele.data("id"); + var lNode = self2.idToLNode[theId]; + return { + x: lNode.getRect().getCenterX(), + y: lNode.getRect().getCenterY() + }; + }, "getPositions"); + var iterateAnimated = /* @__PURE__ */ __name(function iterateAnimated2() { + var afterReposition = /* @__PURE__ */ __name(function afterReposition2() { + if (options2.fit) { + options2.cy.fit(options2.eles, options2.padding); + } + if (!ready4) { + ready4 = true; + self2.cy.one("layoutready", options2.ready); + self2.cy.trigger({ type: "layoutready", layout: self2 }); + } + }, "afterReposition"); + var ticksPerFrame = self2.options.refresh; + var isDone; + for (var i3 = 0; i3 < ticksPerFrame && !isDone; i3++) { + isDone = self2.stopped || self2.layout.tick(); + } + if (isDone) { + if (layout7.checkLayoutSuccess() && !layout7.isSubLayout) { + layout7.doPostLayout(); + } + if (layout7.tilingPostLayout) { + layout7.tilingPostLayout(); + } + layout7.isLayoutFinished = true; + self2.options.eles.nodes().positions(getPositions); + afterReposition(); + self2.cy.one("layoutstop", self2.options.stop); + self2.cy.trigger({ type: "layoutstop", layout: self2 }); + if (frameId) { + cancelAnimationFrame(frameId); + } + ready4 = false; + return; + } + var animationData = self2.layout.getPositionsData(); + options2.eles.nodes().positions(function(ele, i4) { + if (typeof ele === "number") { + ele = i4; + } + if (!ele.isParent()) { + var theId = ele.id(); + var pNode = animationData[theId]; + var temp = ele; + while (pNode == null) { + pNode = animationData[temp.data("parent")] || animationData["DummyCompound_" + temp.data("parent")]; + animationData[theId] = pNode; + temp = temp.parent()[0]; + if (temp == void 0) { + break; + } + } + if (pNode != null) { + return { + x: pNode.x, + y: pNode.y + }; + } else { + return { + x: ele.position("x"), + y: ele.position("y") + }; + } + } + }); + afterReposition(); + frameId = requestAnimationFrame(iterateAnimated2); + }, "iterateAnimated"); + layout7.addListener("layoutstarted", function() { + if (self2.options.animate === "during") { + frameId = requestAnimationFrame(iterateAnimated); + } + }); + layout7.runLayout(); + if (this.options.animate !== "during") { + self2.options.eles.nodes().not(":parent").layoutPositions(self2, self2.options, getPositions); + ready4 = false; + } + return this; + }; + _CoSELayout.prototype.getTopMostNodes = function(nodes5) { + var nodesMap2 = {}; + for (var i2 = 0; i2 < nodes5.length; i2++) { + nodesMap2[nodes5[i2].id()] = true; + } + var roots = nodes5.filter(function(ele, i3) { + if (typeof ele === "number") { + ele = i3; + } + var parent4 = ele.parent()[0]; + while (parent4 != null) { + if (nodesMap2[parent4.id()]) { + return false; + } + parent4 = parent4.parent()[0]; + } + return true; + }); + return roots; + }; + _CoSELayout.prototype.processChildrenList = function(parent4, children2, layout7) { + var size4 = children2.length; + for (var i2 = 0; i2 < size4; i2++) { + var theChild = children2[i2]; + var children_of_children = theChild.children(); + var theNode; + var dimensions2 = theChild.layoutDimensions({ + nodeDimensionsIncludeLabels: this.options.nodeDimensionsIncludeLabels + }); + if (theChild.outerWidth() != null && theChild.outerHeight() != null) { + theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(theChild.position("x") - dimensions2.w / 2, theChild.position("y") - dimensions2.h / 2), new DimensionD2(parseFloat(dimensions2.w), parseFloat(dimensions2.h)))); + } else { + theNode = parent4.add(new CoSENode(this.graphManager)); + } + theNode.id = theChild.data("id"); + theNode.paddingLeft = parseInt(theChild.css("padding")); + theNode.paddingTop = parseInt(theChild.css("padding")); + theNode.paddingRight = parseInt(theChild.css("padding")); + theNode.paddingBottom = parseInt(theChild.css("padding")); + if (this.options.nodeDimensionsIncludeLabels) { + if (theChild.isParent()) { + var labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false }).w; + var labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false }).h; + var labelPos = theChild.css("text-halign"); + theNode.labelWidth = labelWidth; + theNode.labelHeight = labelHeight; + theNode.labelPos = labelPos; + } + } + this.idToLNode[theChild.data("id")] = theNode; + if (isNaN(theNode.rect.x)) { + theNode.rect.x = 0; + } + if (isNaN(theNode.rect.y)) { + theNode.rect.y = 0; + } + if (children_of_children != null && children_of_children.length > 0) { + var theNewGraph; + theNewGraph = layout7.getGraphManager().add(layout7.newGraph(), theNode); + this.processChildrenList(theNewGraph, children_of_children, layout7); + } + } + }; + _CoSELayout.prototype.stop = function() { + this.stopped = true; + return this; + }; + var register = /* @__PURE__ */ __name(function register2(cytoscape4) { + cytoscape4("layout", "cose-bilkent", _CoSELayout); + }, "register"); + if (typeof cytoscape !== "undefined") { + register(cytoscape); + } + module3.exports = register; + }) + /******/ + ]) + ); + }); + } + }); + + // src/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.ts + function addNodes(nodes5, cy) { + nodes5.forEach((node2) => { + const nodeData2 = { + id: node2.id, + labelText: node2.label, + height: node2.height, + width: node2.width, + padding: node2.padding ?? 0 + }; + Object.keys(node2).forEach((key) => { + if (!["id", "label", "height", "width", "padding", "x", "y"].includes(key)) { + nodeData2[key] = node2[key]; + } + }); + cy.add({ + group: "nodes", + data: nodeData2, + position: { + x: node2.x ?? 0, + y: node2.y ?? 0 + } + }); + }); + } + function addEdges(edges3, cy) { + edges3.forEach((edge) => { + const edgeData2 = { + id: edge.id, + source: edge.start, + target: edge.end + }; + Object.keys(edge).forEach((key) => { + if (!["id", "start", "end"].includes(key)) { + edgeData2[key] = edge[key]; + } + }); + cy.add({ + group: "edges", + data: edgeData2 + }); + }); + } + function createCytoscapeInstance(data5) { + return new Promise((resolve2) => { + const renderEl = select_default2("body").append("div").attr("id", "cy").attr("style", "display:none"); + const cy = cytoscape2({ + container: document.getElementById("cy"), + // container to render in + style: [ + { + selector: "edge", + style: { + "curve-style": "bezier" + } + } + ] + }); + renderEl.remove(); + addNodes(data5.nodes, cy); + addEdges(data5.edges, cy); + cy.nodes().forEach(function(n2) { + n2.layoutDimensions = () => { + const nodeData2 = n2.data(); + return { w: nodeData2.width, h: nodeData2.height }; + }; + }); + const layoutConfig = { + name: "cose-bilkent", + // @ts-ignore Types for cose-bilkent are not correct? + quality: "proof", + styleEnabled: false, + animate: false + }; + cy.layout(layoutConfig).run(); + cy.ready((e3) => { + log.info("Cytoscape ready", e3); + resolve2(cy); + }); + }); + } + function extractPositionedNodes(cy) { + return cy.nodes().map((node2) => { + const data5 = node2.data(); + const position5 = node2.position(); + const positionedNode = { + id: data5.id, + x: position5.x, + y: position5.y + }; + Object.keys(data5).forEach((key) => { + if (key !== "id") { + positionedNode[key] = data5[key]; + } + }); + return positionedNode; + }); + } + function extractPositionedEdges(cy) { + return cy.edges().map((edge) => { + const data5 = edge.data(); + const rscratch = edge._private.rscratch; + const positionedEdge = { + id: data5.id, + source: data5.source, + target: data5.target, + startX: rscratch.startX, + startY: rscratch.startY, + midX: rscratch.midX, + midY: rscratch.midY, + endX: rscratch.endX, + endY: rscratch.endY + }; + Object.keys(data5).forEach((key) => { + if (!["id", "source", "target"].includes(key)) { + positionedEdge[key] = data5[key]; + } + }); + return positionedEdge; + }); + } + var import_cytoscape_cose_bilkent; + var init_cytoscape_setup = __esm({ + "src/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.ts"() { + "use strict"; + init_cytoscape_esm(); + import_cytoscape_cose_bilkent = __toESM(require_cytoscape_cose_bilkent(), 1); + init_src32(); + init_logger(); + cytoscape2.use(import_cytoscape_cose_bilkent.default); + __name(addNodes, "addNodes"); + __name(addEdges, "addEdges"); + __name(createCytoscapeInstance, "createCytoscapeInstance"); + __name(extractPositionedNodes, "extractPositionedNodes"); + __name(extractPositionedEdges, "extractPositionedEdges"); + } + }); + + // src/rendering-util/layout-algorithms/cose-bilkent/layout.ts + async function executeCoseBilkentLayout(data5, _config) { + log.debug("Starting cose-bilkent layout algorithm"); + try { + validateLayoutData(data5); + const cy = await createCytoscapeInstance(data5); + const positionedNodes = extractPositionedNodes(cy); + const positionedEdges = extractPositionedEdges(cy); + log.debug(`Layout completed: ${positionedNodes.length} nodes, ${positionedEdges.length} edges`); + return { + nodes: positionedNodes, + edges: positionedEdges + }; + } catch (error3) { + log.error("Error in cose-bilkent layout algorithm:", error3); + throw error3; + } + } + function validateLayoutData(data5) { + if (!data5) { + throw new Error("Layout data is required"); + } + if (!data5.config) { + throw new Error("Configuration is required in layout data"); + } + if (!data5.rootNode) { + throw new Error("Root node is required"); + } + if (!data5.nodes || !Array.isArray(data5.nodes)) { + throw new Error("No nodes found in layout data"); + } + if (!Array.isArray(data5.edges)) { + throw new Error("Edges array is required in layout data"); + } + return true; + } + var init_layout2 = __esm({ + "src/rendering-util/layout-algorithms/cose-bilkent/layout.ts"() { + "use strict"; + init_logger(); + init_cytoscape_setup(); + __name(executeCoseBilkentLayout, "executeCoseBilkentLayout"); + __name(validateLayoutData, "validateLayoutData"); + } + }); + + // src/rendering-util/layout-algorithms/cose-bilkent/render.ts + var render4; + var init_render = __esm({ + "src/rendering-util/layout-algorithms/cose-bilkent/render.ts"() { + "use strict"; + init_layout2(); + render4 = /* @__PURE__ */ __name(async (data4Layout, svg2, { + insertCluster: insertCluster2, + insertEdge: insertEdge3, + insertEdgeLabel: insertEdgeLabel3, + insertMarkers: insertMarkers4, + insertNode: insertNode3, + log: log3, + positionEdgeLabel: positionEdgeLabel3 + }, { algorithm: _algorithm }) => { + const nodeDb2 = {}; + const clusterDb2 = {}; + const element3 = svg2.select("g"); + insertMarkers4(element3, data4Layout.markers, data4Layout.type, data4Layout.diagramId); + const subGraphsEl = element3.insert("g").attr("class", "subgraphs"); + const edgePaths = element3.insert("g").attr("class", "edgePaths"); + const edgeLabels3 = element3.insert("g").attr("class", "edgeLabels"); + const nodes5 = element3.insert("g").attr("class", "nodes"); + log3.debug("Inserting nodes into DOM for dimension calculation"); + await Promise.all( + data4Layout.nodes.map(async (node2) => { + if (node2.isGroup) { + const clusterNode = { ...node2 }; + clusterDb2[node2.id] = clusterNode; + nodeDb2[node2.id] = clusterNode; + await insertCluster2(subGraphsEl, node2); + } else { + const nodeWithPosition = { ...node2 }; + nodeDb2[node2.id] = nodeWithPosition; + const nodeEl = await insertNode3(nodes5, node2, { + config: data4Layout.config, + dir: data4Layout.direction || "TB" + }); + const boundingBox3 = nodeEl.node().getBBox(); + nodeWithPosition.width = boundingBox3.width; + nodeWithPosition.height = boundingBox3.height; + nodeWithPosition.domId = nodeEl; + log3.debug(`Node ${node2.id} dimensions: ${boundingBox3.width}x${boundingBox3.height}`); + } + }) + ); + log3.debug("Running cose-bilkent layout algorithm"); + const updatedLayoutData = { + ...data4Layout, + nodes: data4Layout.nodes.map((node2) => { + const nodeWithDimensions = nodeDb2[node2.id]; + return { + ...node2, + width: nodeWithDimensions.width, + height: nodeWithDimensions.height + }; + }) + }; + const layoutResult = await executeCoseBilkentLayout(updatedLayoutData, data4Layout.config); + log3.debug("Positioning nodes based on layout results"); + layoutResult.nodes.forEach((positionedNode) => { + const node2 = nodeDb2[positionedNode.id]; + if (node2?.domId) { + node2.domId.attr( + "transform", + `translate(${positionedNode.x}, ${positionedNode.y})` + ); + node2.x = positionedNode.x; + node2.y = positionedNode.y; + log3.debug(`Positioned node ${node2.id} at center (${positionedNode.x}, ${positionedNode.y})`); + } + }); + layoutResult.edges.forEach((positionedEdge) => { + const edge = data4Layout.edges.find((e3) => e3.id === positionedEdge.id); + if (edge) { + edge.points = [ + { x: positionedEdge.startX, y: positionedEdge.startY }, + { x: positionedEdge.midX, y: positionedEdge.midY }, + { x: positionedEdge.endX, y: positionedEdge.endY } + ]; + } + }); + log3.debug("Inserting and positioning edges"); + await Promise.all( + data4Layout.edges.map(async (edge) => { + const _edgeLabel = await insertEdgeLabel3(edgeLabels3, edge); + const startNode = nodeDb2[edge.start ?? ""]; + const endNode = nodeDb2[edge.end ?? ""]; + if (startNode && endNode) { + const positionedEdge = layoutResult.edges.find((e3) => e3.id === edge.id); + if (positionedEdge) { + log3.debug("APA01 positionedEdge", positionedEdge); + const edgeWithPath = { ...edge }; + const paths = insertEdge3( + edgePaths, + edgeWithPath, + clusterDb2, + data4Layout.type, + startNode, + endNode, + data4Layout.diagramId + ); + positionEdgeLabel3(edgeWithPath, paths); + } else { + const edgeWithPath = { + ...edge, + points: [ + { x: startNode.x || 0, y: startNode.y || 0 }, + { x: endNode.x || 0, y: endNode.y || 0 } + ] + }; + const paths = insertEdge3( + edgePaths, + edgeWithPath, + clusterDb2, + data4Layout.type, + startNode, + endNode, + data4Layout.diagramId + ); + positionEdgeLabel3(edgeWithPath, paths); + } + } + }) + ); + log3.debug("Cose-bilkent rendering completed"); + }, "render"); + } + }); + + // src/rendering-util/layout-algorithms/cose-bilkent/index.ts + var cose_bilkent_exports = {}; + __export(cose_bilkent_exports, { + render: () => render5 + }); + var render5; + var init_cose_bilkent = __esm({ + "src/rendering-util/layout-algorithms/cose-bilkent/index.ts"() { + "use strict"; + init_render(); + render5 = render4; + } + }); + + // src/rendering-util/render.ts + var layoutAlgorithms, registerLayoutLoaders, registerDefaultLayoutLoaders, render6, getRegisteredLayoutAlgorithm; + var init_render2 = __esm({ + "src/rendering-util/render.ts"() { + "use strict"; + init_internals(); + init_logger(); + layoutAlgorithms = {}; + registerLayoutLoaders = /* @__PURE__ */ __name((loaders) => { + for (const loader34 of loaders) { + layoutAlgorithms[loader34.name] = loader34; + } + }, "registerLayoutLoaders"); + registerDefaultLayoutLoaders = /* @__PURE__ */ __name(() => { + registerLayoutLoaders([ + { + name: "dagre", + loader: /* @__PURE__ */ __name(async () => await Promise.resolve().then(() => (init_dagre2(), dagre_exports)), "loader") + }, + ...true ? [ + { + name: "cose-bilkent", + loader: /* @__PURE__ */ __name(async () => await Promise.resolve().then(() => (init_cose_bilkent(), cose_bilkent_exports)), "loader") + } + ] : [] + ]); + }, "registerDefaultLayoutLoaders"); + registerDefaultLayoutLoaders(); + render6 = /* @__PURE__ */ __name(async (data4Layout, svg2) => { + if (!(data4Layout.layoutAlgorithm in layoutAlgorithms)) { + throw new Error(`Unknown layout algorithm: ${data4Layout.layoutAlgorithm}`); + } + if (data4Layout.diagramId) { + for (const node2 of data4Layout.nodes) { + const originalDomId = node2.domId || node2.id; + node2.domId = `${data4Layout.diagramId}-${originalDomId}`; + } + } + const layoutDefinition = layoutAlgorithms[data4Layout.layoutAlgorithm]; + const layoutRenderer = await layoutDefinition.loader(); + const { theme, themeVariables } = data4Layout.config; + const { useGradient, gradientStart, gradientStop } = themeVariables; + const svgId = svg2.attr("id"); + svg2.append("defs").append("filter").attr("id", `${svgId}-drop-shadow`).attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme?.includes("dark") ? "#FFFFFF" : "#000000"}`); + svg2.append("defs").append("filter").attr("id", `${svgId}-drop-shadow-small`).attr("height", "150%").attr("width", "150%").append("feDropShadow").attr("dx", "2").attr("dy", "2").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme?.includes("dark") ? "#FFFFFF" : "#000000"}`); + if (useGradient) { + const gradient = svg2.append("linearGradient").attr("id", svg2.attr("id") + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%"); + gradient.append("svg:stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1); + gradient.append("svg:stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1); + } + return layoutRenderer.render(data4Layout, svg2, internalHelpers, { + algorithm: layoutDefinition.algorithm + }); + }, "render"); + getRegisteredLayoutAlgorithm = /* @__PURE__ */ __name((algorithm = "", { fallback = "dagre" } = {}) => { + if (algorithm in layoutAlgorithms) { + return algorithm; + } + if (fallback in layoutAlgorithms) { + log.warn(`Layout algorithm ${algorithm} is not registered. Using ${fallback} as fallback.`); + return fallback; + } + throw new Error(`Both layout algorithms ${algorithm} and ${fallback} are not registered.`); + }, "getRegisteredLayoutAlgorithm"); + } + }); + + // src/rendering-util/setupViewPortForSVG.ts + var setupViewPortForSVG, calculateDimensionsWithPadding, createViewBox; + var init_setupViewPortForSVG = __esm({ + "src/rendering-util/setupViewPortForSVG.ts"() { + "use strict"; + init_setupGraphViewbox(); + init_logger(); + setupViewPortForSVG = /* @__PURE__ */ __name((svg2, padding2, cssDiagram, useMaxWidth) => { + svg2.attr("class", cssDiagram); + const { width: width3, height: height2, x: x5, y: y6 } = calculateDimensionsWithPadding(svg2, padding2); + configureSvgSize(svg2, height2, width3, useMaxWidth); + const viewBox = createViewBox(x5, y6, width3, height2, padding2); + svg2.attr("viewBox", viewBox); + log.debug(`viewBox configured: ${viewBox} with padding: ${padding2}`); + }, "setupViewPortForSVG"); + calculateDimensionsWithPadding = /* @__PURE__ */ __name((svg2, padding2) => { + const bounds4 = svg2.node()?.getBBox() || { width: 0, height: 0, x: 0, y: 0 }; + return { + width: bounds4.width + padding2 * 2, + height: bounds4.height + padding2 * 2, + x: bounds4.x, + y: bounds4.y + }; + }, "calculateDimensionsWithPadding"); + createViewBox = /* @__PURE__ */ __name((x5, y6, width3, height2, padding2) => { + return `${x5 - padding2} ${y6 - padding2} ${width3} ${height2}`; + }, "createViewBox"); + } + }); + + // src/diagrams/flowchart/flowRenderer-v3-unified.ts + var getClasses, draw2, flowRenderer_v3_unified_default; + var init_flowRenderer_v3_unified = __esm({ + "src/diagrams/flowchart/flowRenderer-v3-unified.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_insertElementsForSize(); + init_render2(); + init_setupViewPortForSVG(); + init_utils2(); + getClasses = /* @__PURE__ */ __name(function(text4, diagramObj) { + return diagramObj.db.getClasses(); + }, "getClasses"); + draw2 = /* @__PURE__ */ __name(async function(text4, id35, _version, diag) { + log.info("REF0:"); + log.info("Drawing state diagram (v2)", id35); + const { securityLevel, flowchart: conf5, layout: layout7 } = getConfig2(); + diag.db.setDiagramId(id35); + log.debug("Before getData: "); + const data4Layout = diag.db.getData(); + log.debug("Data: ", data4Layout); + const svg2 = getDiagramElement(id35, securityLevel); + const direction2 = diag.db.getDirection(); + data4Layout.type = diag.type; + data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout7); + if (data4Layout.layoutAlgorithm === "dagre" && layout7 === "elk") { + log.warn( + "flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback." + ); + } + data4Layout.direction = direction2; + data4Layout.nodeSpacing = conf5?.nodeSpacing || 50; + data4Layout.rankSpacing = conf5?.rankSpacing || 50; + data4Layout.markers = ["point", "circle", "cross"]; + data4Layout.diagramId = id35; + log.debug("REF1:", data4Layout); + await render6(data4Layout, svg2); + const padding2 = data4Layout.config.flowchart?.diagramPadding ?? 8; + utils_default2.insertTitle( + svg2, + "flowchartTitleText", + conf5?.titleTopMargin || 0, + diag.db.getDiagramTitle() + ); + setupViewPortForSVG(svg2, padding2, "flowchart", conf5?.useMaxWidth || false); + }, "draw"); + flowRenderer_v3_unified_default = { + getClasses, + draw: draw2 + }; + } + }); + + // src/diagrams/flowchart/parser/flow.jison + var parser2, flow_default; + var init_flow = __esm({ + "src/diagrams/flowchart/parser/flow.jison"() { + "use strict"; + parser2 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 4], $V1 = [1, 3], $V2 = [1, 5], $V3 = [1, 8, 9, 10, 11, 27, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124, 125], $V4 = [2, 2], $V5 = [1, 13], $V6 = [1, 14], $V7 = [1, 15], $V8 = [1, 16], $V9 = [1, 23], $Va = [1, 25], $Vb = [1, 26], $Vc = [1, 27], $Vd = [1, 50], $Ve = [1, 49], $Vf = [1, 29], $Vg = [1, 30], $Vh = [1, 31], $Vi = [1, 32], $Vj = [1, 33], $Vk = [1, 45], $Vl = [1, 47], $Vm = [1, 43], $Vn = [1, 48], $Vo = [1, 44], $Vp = [1, 51], $Vq = [1, 46], $Vr = [1, 52], $Vs = [1, 53], $Vt = [1, 34], $Vu = [1, 35], $Vv = [1, 36], $Vw = [1, 37], $Vx = [1, 38], $Vy = [1, 58], $Vz = [1, 8, 9, 10, 11, 27, 32, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124, 125], $VA = [1, 62], $VB = [1, 61], $VC = [1, 63], $VD = [8, 9, 11, 75, 77, 78], $VE = [1, 79], $VF = [1, 92], $VG = [1, 97], $VH = [1, 96], $VI = [1, 93], $VJ = [1, 89], $VK = [1, 95], $VL = [1, 91], $VM = [1, 98], $VN = [1, 94], $VO = [1, 99], $VP = [1, 90], $VQ = [8, 9, 10, 11, 40, 75, 77, 78], $VR = [8, 9, 10, 11, 40, 46, 75, 77, 78], $VS = [8, 9, 10, 11, 29, 40, 44, 46, 48, 50, 52, 54, 56, 58, 60, 63, 65, 67, 68, 70, 75, 77, 78, 89, 102, 105, 106, 109, 111, 114, 115, 116], $VT = [8, 9, 11, 44, 60, 75, 77, 78, 89, 102, 105, 106, 109, 111, 114, 115, 116], $VU = [44, 60, 89, 102, 105, 106, 109, 111, 114, 115, 116], $VV = [1, 122], $VW = [1, 123], $VX = [1, 125], $VY = [1, 124], $VZ = [44, 60, 62, 74, 89, 102, 105, 106, 109, 111, 114, 115, 116], $V_ = [1, 134], $V$ = [1, 148], $V01 = [1, 149], $V11 = [1, 150], $V21 = [1, 151], $V31 = [1, 136], $V41 = [1, 138], $V51 = [1, 142], $V61 = [1, 143], $V71 = [1, 144], $V81 = [1, 145], $V91 = [1, 146], $Va1 = [1, 147], $Vb1 = [1, 152], $Vc1 = [1, 153], $Vd1 = [1, 132], $Ve1 = [1, 133], $Vf1 = [1, 140], $Vg1 = [1, 135], $Vh1 = [1, 139], $Vi1 = [1, 137], $Vj1 = [8, 9, 10, 11, 27, 32, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124, 125], $Vk1 = [1, 155], $Vl1 = [1, 157], $Vm1 = [8, 9, 11], $Vn1 = [8, 9, 10, 11, 14, 44, 60, 89, 105, 106, 109, 111, 114, 115, 116], $Vo1 = [1, 177], $Vp1 = [1, 173], $Vq1 = [1, 174], $Vr1 = [1, 178], $Vs1 = [1, 175], $Vt1 = [1, 176], $Vu1 = [77, 116, 119], $Vv1 = [8, 9, 10, 11, 12, 14, 27, 29, 32, 44, 60, 75, 84, 85, 86, 87, 88, 89, 90, 105, 109, 111, 114, 115, 116], $Vw1 = [10, 106], $Vx1 = [31, 49, 51, 53, 55, 57, 62, 64, 66, 67, 69, 71, 116, 117, 118], $Vy1 = [1, 248], $Vz1 = [1, 246], $VA1 = [1, 250], $VB1 = [1, 244], $VC1 = [1, 245], $VD1 = [1, 247], $VE1 = [1, 249], $VF1 = [1, 251], $VG1 = [1, 269], $VH1 = [8, 9, 11, 106], $VI1 = [8, 9, 10, 11, 60, 84, 105, 106, 109, 110, 111, 112]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "graphConfig": 4, "document": 5, "line": 6, "statement": 7, "SEMI": 8, "NEWLINE": 9, "SPACE": 10, "EOF": 11, "GRAPH": 12, "NODIR": 13, "DIR": 14, "FirstStmtSeparator": 15, "ending": 16, "endToken": 17, "spaceList": 18, "spaceListNewline": 19, "vertexStatement": 20, "separator": 21, "styleStatement": 22, "linkStyleStatement": 23, "classDefStatement": 24, "classStatement": 25, "clickStatement": 26, "subgraph": 27, "textNoTags": 28, "SQS": 29, "text": 30, "SQE": 31, "end": 32, "direction": 33, "acc_title": 34, "acc_title_value": 35, "acc_descr": 36, "acc_descr_value": 37, "acc_descr_multiline_value": 38, "shapeData": 39, "SHAPE_DATA": 40, "link": 41, "node": 42, "styledVertex": 43, "AMP": 44, "vertex": 45, "STYLE_SEPARATOR": 46, "idString": 47, "DOUBLECIRCLESTART": 48, "DOUBLECIRCLEEND": 49, "PS": 50, "PE": 51, "(-": 52, "-)": 53, "STADIUMSTART": 54, "STADIUMEND": 55, "SUBROUTINESTART": 56, "SUBROUTINEEND": 57, "VERTEX_WITH_PROPS_START": 58, "NODE_STRING[field]": 59, "COLON": 60, "NODE_STRING[value]": 61, "PIPE": 62, "CYLINDERSTART": 63, "CYLINDEREND": 64, "DIAMOND_START": 65, "DIAMOND_STOP": 66, "TAGEND": 67, "TRAPSTART": 68, "TRAPEND": 69, "INVTRAPSTART": 70, "INVTRAPEND": 71, "linkStatement": 72, "arrowText": 73, "TESTSTR": 74, "START_LINK": 75, "edgeText": 76, "LINK": 77, "LINK_ID": 78, "edgeTextToken": 79, "STR": 80, "MD_STR": 81, "textToken": 82, "keywords": 83, "STYLE": 84, "LINKSTYLE": 85, "CLASSDEF": 86, "CLASS": 87, "CLICK": 88, "DOWN": 89, "UP": 90, "textNoTagsToken": 91, "stylesOpt": 92, "idString[vertex]": 93, "idString[class]": 94, "CALLBACKNAME": 95, "CALLBACKARGS": 96, "HREF": 97, "LINK_TARGET": 98, "STR[link]": 99, "STR[tooltip]": 100, "alphaNum": 101, "DEFAULT": 102, "numList": 103, "INTERPOLATE": 104, "NUM": 105, "COMMA": 106, "style": 107, "styleComponent": 108, "NODE_STRING": 109, "UNIT": 110, "BRKT": 111, "PCT": 112, "idStringToken": 113, "MINUS": 114, "MULT": 115, "UNICODE_TEXT": 116, "TEXT": 117, "TAGSTART": 118, "EDGE_TEXT": 119, "alphaNumToken": 120, "direction_tb": 121, "direction_bt": 122, "direction_rl": 123, "direction_lr": 124, "direction_td": 125, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 8: "SEMI", 9: "NEWLINE", 10: "SPACE", 11: "EOF", 12: "GRAPH", 13: "NODIR", 14: "DIR", 27: "subgraph", 29: "SQS", 31: "SQE", 32: "end", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 40: "SHAPE_DATA", 44: "AMP", 46: "STYLE_SEPARATOR", 48: "DOUBLECIRCLESTART", 49: "DOUBLECIRCLEEND", 50: "PS", 51: "PE", 52: "(-", 53: "-)", 54: "STADIUMSTART", 55: "STADIUMEND", 56: "SUBROUTINESTART", 57: "SUBROUTINEEND", 58: "VERTEX_WITH_PROPS_START", 59: "NODE_STRING[field]", 60: "COLON", 61: "NODE_STRING[value]", 62: "PIPE", 63: "CYLINDERSTART", 64: "CYLINDEREND", 65: "DIAMOND_START", 66: "DIAMOND_STOP", 67: "TAGEND", 68: "TRAPSTART", 69: "TRAPEND", 70: "INVTRAPSTART", 71: "INVTRAPEND", 74: "TESTSTR", 75: "START_LINK", 77: "LINK", 78: "LINK_ID", 80: "STR", 81: "MD_STR", 84: "STYLE", 85: "LINKSTYLE", 86: "CLASSDEF", 87: "CLASS", 88: "CLICK", 89: "DOWN", 90: "UP", 93: "idString[vertex]", 94: "idString[class]", 95: "CALLBACKNAME", 96: "CALLBACKARGS", 97: "HREF", 98: "LINK_TARGET", 99: "STR[link]", 100: "STR[tooltip]", 102: "DEFAULT", 104: "INTERPOLATE", 105: "NUM", 106: "COMMA", 109: "NODE_STRING", 110: "UNIT", 111: "BRKT", 112: "PCT", 114: "MINUS", 115: "MULT", 116: "UNICODE_TEXT", 117: "TEXT", 118: "TAGSTART", 119: "EDGE_TEXT", 121: "direction_tb", 122: "direction_bt", 123: "direction_rl", 124: "direction_lr", 125: "direction_td" }, + productions_: [0, [3, 2], [5, 0], [5, 2], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [4, 2], [4, 2], [4, 2], [4, 3], [16, 2], [16, 1], [17, 1], [17, 1], [17, 1], [15, 1], [15, 1], [15, 2], [19, 2], [19, 2], [19, 1], [19, 1], [18, 2], [18, 1], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 9], [7, 6], [7, 4], [7, 1], [7, 2], [7, 2], [7, 1], [21, 1], [21, 1], [21, 1], [39, 2], [39, 1], [20, 4], [20, 3], [20, 4], [20, 2], [20, 2], [20, 1], [42, 1], [42, 6], [42, 5], [43, 1], [43, 3], [45, 4], [45, 4], [45, 6], [45, 4], [45, 4], [45, 4], [45, 8], [45, 4], [45, 4], [45, 4], [45, 6], [45, 4], [45, 4], [45, 4], [45, 4], [45, 4], [45, 1], [41, 2], [41, 3], [41, 3], [41, 1], [41, 3], [41, 4], [76, 1], [76, 2], [76, 1], [76, 1], [72, 1], [72, 2], [73, 3], [30, 1], [30, 2], [30, 1], [30, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [28, 1], [28, 2], [28, 1], [28, 1], [24, 5], [25, 5], [26, 2], [26, 4], [26, 3], [26, 5], [26, 3], [26, 5], [26, 5], [26, 7], [26, 2], [26, 4], [26, 2], [26, 4], [26, 4], [26, 6], [22, 5], [23, 5], [23, 5], [23, 9], [23, 9], [23, 7], [23, 7], [103, 1], [103, 3], [92, 1], [92, 3], [107, 1], [107, 2], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [82, 1], [82, 1], [82, 1], [82, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [79, 1], [79, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [47, 1], [47, 2], [101, 1], [101, 2], [33, 1], [33, 1], [33, 1], [33, 1], [33, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 2: + this.$ = []; + break; + case 3: + if (!Array.isArray($$[$0]) || $$[$0].length > 0) { + $$[$0 - 1].push($$[$0]); + } + this.$ = $$[$0 - 1]; + break; + case 4: + case 183: + this.$ = $$[$0]; + break; + case 11: + yy.setDirection("TB"); + this.$ = "TB"; + break; + case 12: + yy.setDirection($$[$0 - 1]); + this.$ = $$[$0 - 1]; + break; + case 27: + this.$ = $$[$0 - 1].nodes; + break; + case 28: + case 29: + case 30: + case 31: + case 32: + this.$ = []; + break; + case 33: + this.$ = yy.addSubGraph($$[$0 - 6], $$[$0 - 1], $$[$0 - 4]); + break; + case 34: + this.$ = yy.addSubGraph($$[$0 - 3], $$[$0 - 1], $$[$0 - 3]); + break; + case 35: + this.$ = yy.addSubGraph(void 0, $$[$0 - 1], void 0); + break; + case 37: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 38: + case 39: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 43: + this.$ = $$[$0 - 1] + $$[$0]; + break; + case 44: + this.$ = $$[$0]; + break; + case 45: + yy.addVertex($$[$0 - 1][$$[$0 - 1].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, $$[$0]); + yy.addLink($$[$0 - 3].stmt, $$[$0 - 1], $$[$0 - 2]); + this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1].concat($$[$0 - 3].nodes) }; + break; + case 46: + yy.addLink($$[$0 - 2].stmt, $$[$0], $$[$0 - 1]); + this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0 - 2].nodes) }; + break; + case 47: + yy.addLink($$[$0 - 3].stmt, $$[$0 - 1], $$[$0 - 2]); + this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1].concat($$[$0 - 3].nodes) }; + break; + case 48: + this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1] }; + break; + case 49: + yy.addVertex($$[$0 - 1][$$[$0 - 1].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, $$[$0]); + this.$ = { stmt: $$[$0 - 1], nodes: $$[$0 - 1], shapeData: $$[$0] }; + break; + case 50: + this.$ = { stmt: $$[$0], nodes: $$[$0] }; + break; + case 51: + this.$ = [$$[$0]]; + break; + case 52: + yy.addVertex($$[$0 - 5][$$[$0 - 5].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, $$[$0 - 4]); + this.$ = $$[$0 - 5].concat($$[$0]); + break; + case 53: + this.$ = $$[$0 - 4].concat($$[$0]); + break; + case 54: + this.$ = $$[$0]; + break; + case 55: + this.$ = $$[$0 - 2]; + yy.setClass($$[$0 - 2], $$[$0]); + break; + case 56: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "square"); + break; + case 57: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "doublecircle"); + break; + case 58: + this.$ = $$[$0 - 5]; + yy.addVertex($$[$0 - 5], $$[$0 - 2], "circle"); + break; + case 59: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "ellipse"); + break; + case 60: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "stadium"); + break; + case 61: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "subroutine"); + break; + case 62: + this.$ = $$[$0 - 7]; + yy.addVertex($$[$0 - 7], $$[$0 - 1], "rect", void 0, void 0, void 0, Object.fromEntries([[$$[$0 - 5], $$[$0 - 3]]])); + break; + case 63: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "cylinder"); + break; + case 64: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "round"); + break; + case 65: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "diamond"); + break; + case 66: + this.$ = $$[$0 - 5]; + yy.addVertex($$[$0 - 5], $$[$0 - 2], "hexagon"); + break; + case 67: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "odd"); + break; + case 68: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "trapezoid"); + break; + case 69: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "inv_trapezoid"); + break; + case 70: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "lean_right"); + break; + case 71: + this.$ = $$[$0 - 3]; + yy.addVertex($$[$0 - 3], $$[$0 - 1], "lean_left"); + break; + case 72: + this.$ = $$[$0]; + yy.addVertex($$[$0]); + break; + case 73: + $$[$0 - 1].text = $$[$0]; + this.$ = $$[$0 - 1]; + break; + case 74: + case 75: + $$[$0 - 2].text = $$[$0 - 1]; + this.$ = $$[$0 - 2]; + break; + case 76: + this.$ = $$[$0]; + break; + case 77: + var inf = yy.destructLink($$[$0], $$[$0 - 2]); + this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length, "text": $$[$0 - 1] }; + break; + case 78: + var inf = yy.destructLink($$[$0], $$[$0 - 2]); + this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length, "text": $$[$0 - 1], "id": $$[$0 - 3] }; + break; + case 79: + this.$ = { text: $$[$0], type: "text" }; + break; + case 80: + this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type }; + break; + case 81: + this.$ = { text: $$[$0], type: "string" }; + break; + case 82: + this.$ = { text: $$[$0], type: "markdown" }; + break; + case 83: + var inf = yy.destructLink($$[$0]); + this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length }; + break; + case 84: + var inf = yy.destructLink($$[$0]); + this.$ = { "type": inf.type, "stroke": inf.stroke, "length": inf.length, "id": $$[$0 - 1] }; + break; + case 85: + this.$ = $$[$0 - 1]; + break; + case 86: + this.$ = { text: $$[$0], type: "text" }; + break; + case 87: + this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type }; + break; + case 88: + this.$ = { text: $$[$0], type: "string" }; + break; + case 89: + case 104: + this.$ = { text: $$[$0], type: "markdown" }; + break; + case 101: + this.$ = { text: $$[$0], type: "text" }; + break; + case 102: + this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type }; + break; + case 103: + this.$ = { text: $$[$0], type: "text" }; + break; + case 105: + this.$ = $$[$0 - 4]; + yy.addClass($$[$0 - 2], $$[$0]); + break; + case 106: + this.$ = $$[$0 - 4]; + yy.setClass($$[$0 - 2], $$[$0]); + break; + case 107: + case 115: + this.$ = $$[$0 - 1]; + yy.setClickEvent($$[$0 - 1], $$[$0]); + break; + case 108: + case 116: + this.$ = $$[$0 - 3]; + yy.setClickEvent($$[$0 - 3], $$[$0 - 2]); + yy.setTooltip($$[$0 - 3], $$[$0]); + break; + case 109: + this.$ = $$[$0 - 2]; + yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 110: + this.$ = $$[$0 - 4]; + yy.setClickEvent($$[$0 - 4], $$[$0 - 3], $$[$0 - 2]); + yy.setTooltip($$[$0 - 4], $$[$0]); + break; + case 111: + this.$ = $$[$0 - 2]; + yy.setLink($$[$0 - 2], $$[$0]); + break; + case 112: + this.$ = $$[$0 - 4]; + yy.setLink($$[$0 - 4], $$[$0 - 2]); + yy.setTooltip($$[$0 - 4], $$[$0]); + break; + case 113: + this.$ = $$[$0 - 4]; + yy.setLink($$[$0 - 4], $$[$0 - 2], $$[$0]); + break; + case 114: + this.$ = $$[$0 - 6]; + yy.setLink($$[$0 - 6], $$[$0 - 4], $$[$0]); + yy.setTooltip($$[$0 - 6], $$[$0 - 2]); + break; + case 117: + this.$ = $$[$0 - 1]; + yy.setLink($$[$0 - 1], $$[$0]); + break; + case 118: + this.$ = $$[$0 - 3]; + yy.setLink($$[$0 - 3], $$[$0 - 2]); + yy.setTooltip($$[$0 - 3], $$[$0]); + break; + case 119: + this.$ = $$[$0 - 3]; + yy.setLink($$[$0 - 3], $$[$0 - 2], $$[$0]); + break; + case 120: + this.$ = $$[$0 - 5]; + yy.setLink($$[$0 - 5], $$[$0 - 4], $$[$0]); + yy.setTooltip($$[$0 - 5], $$[$0 - 2]); + break; + case 121: + this.$ = $$[$0 - 4]; + yy.addVertex($$[$0 - 2], void 0, void 0, $$[$0]); + break; + case 122: + this.$ = $$[$0 - 4]; + yy.updateLink([$$[$0 - 2]], $$[$0]); + break; + case 123: + this.$ = $$[$0 - 4]; + yy.updateLink($$[$0 - 2], $$[$0]); + break; + case 124: + this.$ = $$[$0 - 8]; + yy.updateLinkInterpolate([$$[$0 - 6]], $$[$0 - 2]); + yy.updateLink([$$[$0 - 6]], $$[$0]); + break; + case 125: + this.$ = $$[$0 - 8]; + yy.updateLinkInterpolate($$[$0 - 6], $$[$0 - 2]); + yy.updateLink($$[$0 - 6], $$[$0]); + break; + case 126: + this.$ = $$[$0 - 6]; + yy.updateLinkInterpolate([$$[$0 - 4]], $$[$0]); + break; + case 127: + this.$ = $$[$0 - 6]; + yy.updateLinkInterpolate($$[$0 - 4], $$[$0]); + break; + case 128: + case 130: + this.$ = [$$[$0]]; + break; + case 129: + case 131: + $$[$0 - 2].push($$[$0]); + this.$ = $$[$0 - 2]; + break; + case 133: + this.$ = $$[$0 - 1] + $$[$0]; + break; + case 181: + this.$ = $$[$0]; + break; + case 182: + this.$ = $$[$0 - 1] + "" + $$[$0]; + break; + case 184: + this.$ = $$[$0 - 1] + "" + $$[$0]; + break; + case 185: + this.$ = { stmt: "dir", value: "TB" }; + break; + case 186: + this.$ = { stmt: "dir", value: "BT" }; + break; + case 187: + this.$ = { stmt: "dir", value: "RL" }; + break; + case 188: + this.$ = { stmt: "dir", value: "LR" }; + break; + case 189: + this.$ = { stmt: "dir", value: "TD" }; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 9: $V0, 10: $V1, 12: $V2 }, { 1: [3] }, o2($V3, $V4, { 5: 6 }), { 4: 7, 9: $V0, 10: $V1, 12: $V2 }, { 4: 8, 9: $V0, 10: $V1, 12: $V2 }, { 13: [1, 9], 14: [1, 10] }, { 1: [2, 1], 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 42: 28, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 84: $Vf, 85: $Vg, 86: $Vh, 87: $Vi, 88: $Vj, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs, 121: $Vt, 122: $Vu, 123: $Vv, 124: $Vw, 125: $Vx }, o2($V3, [2, 9]), o2($V3, [2, 10]), o2($V3, [2, 11]), { 8: [1, 55], 9: [1, 56], 10: $Vy, 15: 54, 18: 57 }, o2($Vz, [2, 3]), o2($Vz, [2, 4]), o2($Vz, [2, 5]), o2($Vz, [2, 6]), o2($Vz, [2, 7]), o2($Vz, [2, 8]), { 8: $VA, 9: $VB, 11: $VC, 21: 59, 41: 60, 72: 64, 75: [1, 65], 77: [1, 67], 78: [1, 66] }, { 8: $VA, 9: $VB, 11: $VC, 21: 68 }, { 8: $VA, 9: $VB, 11: $VC, 21: 69 }, { 8: $VA, 9: $VB, 11: $VC, 21: 70 }, { 8: $VA, 9: $VB, 11: $VC, 21: 71 }, { 8: $VA, 9: $VB, 11: $VC, 21: 72 }, { 8: $VA, 9: $VB, 10: [1, 73], 11: $VC, 21: 74 }, o2($Vz, [2, 36]), { 35: [1, 75] }, { 37: [1, 76] }, o2($Vz, [2, 39]), o2($VD, [2, 50], { 18: 77, 39: 78, 10: $Vy, 40: $VE }), { 10: [1, 80] }, { 10: [1, 81] }, { 10: [1, 82] }, { 10: [1, 83] }, { 14: $VF, 44: $VG, 60: $VH, 80: [1, 87], 89: $VI, 95: [1, 84], 97: [1, 85], 101: 86, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP, 120: 88 }, o2($Vz, [2, 185]), o2($Vz, [2, 186]), o2($Vz, [2, 187]), o2($Vz, [2, 188]), o2($Vz, [2, 189]), o2($VQ, [2, 51]), o2($VQ, [2, 54], { 46: [1, 100] }), o2($VR, [2, 72], { 113: 113, 29: [1, 101], 44: $Vd, 48: [1, 102], 50: [1, 103], 52: [1, 104], 54: [1, 105], 56: [1, 106], 58: [1, 107], 60: $Ve, 63: [1, 108], 65: [1, 109], 67: [1, 110], 68: [1, 111], 70: [1, 112], 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 114: $Vq, 115: $Vr, 116: $Vs }), o2($VS, [2, 181]), o2($VS, [2, 142]), o2($VS, [2, 143]), o2($VS, [2, 144]), o2($VS, [2, 145]), o2($VS, [2, 146]), o2($VS, [2, 147]), o2($VS, [2, 148]), o2($VS, [2, 149]), o2($VS, [2, 150]), o2($VS, [2, 151]), o2($VS, [2, 152]), o2($V3, [2, 12]), o2($V3, [2, 18]), o2($V3, [2, 19]), { 9: [1, 114] }, o2($VT, [2, 26], { 18: 115, 10: $Vy }), o2($Vz, [2, 27]), { 42: 116, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, o2($Vz, [2, 40]), o2($Vz, [2, 41]), o2($Vz, [2, 42]), o2($VU, [2, 76], { 73: 117, 62: [1, 119], 74: [1, 118] }), { 76: 120, 79: 121, 80: $VV, 81: $VW, 116: $VX, 119: $VY }, { 75: [1, 126], 77: [1, 127] }, o2($VZ, [2, 83]), o2($Vz, [2, 28]), o2($Vz, [2, 29]), o2($Vz, [2, 30]), o2($Vz, [2, 31]), o2($Vz, [2, 32]), { 10: $V_, 12: $V$, 14: $V01, 27: $V11, 28: 128, 32: $V21, 44: $V31, 60: $V41, 75: $V51, 80: [1, 130], 81: [1, 131], 83: 141, 84: $V61, 85: $V71, 86: $V81, 87: $V91, 88: $Va1, 89: $Vb1, 90: $Vc1, 91: 129, 105: $Vd1, 109: $Ve1, 111: $Vf1, 114: $Vg1, 115: $Vh1, 116: $Vi1 }, o2($Vj1, $V4, { 5: 154 }), o2($Vz, [2, 37]), o2($Vz, [2, 38]), o2($VD, [2, 48], { 44: $Vk1 }), o2($VD, [2, 49], { 18: 156, 10: $Vy, 40: $Vl1 }), o2($VQ, [2, 44]), { 44: $Vd, 47: 158, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, { 102: [1, 159], 103: 160, 105: [1, 161] }, { 44: $Vd, 47: 162, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, { 44: $Vd, 47: 163, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, o2($Vm1, [2, 107], { 10: [1, 164], 96: [1, 165] }), { 80: [1, 166] }, o2($Vm1, [2, 115], { 120: 168, 10: [1, 167], 14: $VF, 44: $VG, 60: $VH, 89: $VI, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP }), o2($Vm1, [2, 117], { 10: [1, 169] }), o2($Vn1, [2, 183]), o2($Vn1, [2, 170]), o2($Vn1, [2, 171]), o2($Vn1, [2, 172]), o2($Vn1, [2, 173]), o2($Vn1, [2, 174]), o2($Vn1, [2, 175]), o2($Vn1, [2, 176]), o2($Vn1, [2, 177]), o2($Vn1, [2, 178]), o2($Vn1, [2, 179]), o2($Vn1, [2, 180]), { 44: $Vd, 47: 170, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, { 30: 171, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 179, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 181, 50: [1, 180], 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 182, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 183, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 184, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 109: [1, 185] }, { 30: 186, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 187, 65: [1, 188], 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 189, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 190, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 191, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VS, [2, 182]), o2($V3, [2, 20]), o2($VT, [2, 25]), o2($VD, [2, 46], { 39: 192, 18: 193, 10: $Vy, 40: $VE }), o2($VU, [2, 73], { 10: [1, 194] }), { 10: [1, 195] }, { 30: 196, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 77: [1, 197], 79: 198, 116: $VX, 119: $VY }, o2($Vu1, [2, 79]), o2($Vu1, [2, 81]), o2($Vu1, [2, 82]), o2($Vu1, [2, 168]), o2($Vu1, [2, 169]), { 76: 199, 79: 121, 80: $VV, 81: $VW, 116: $VX, 119: $VY }, o2($VZ, [2, 84]), { 8: $VA, 9: $VB, 10: $V_, 11: $VC, 12: $V$, 14: $V01, 21: 201, 27: $V11, 29: [1, 200], 32: $V21, 44: $V31, 60: $V41, 75: $V51, 83: 141, 84: $V61, 85: $V71, 86: $V81, 87: $V91, 88: $Va1, 89: $Vb1, 90: $Vc1, 91: 202, 105: $Vd1, 109: $Ve1, 111: $Vf1, 114: $Vg1, 115: $Vh1, 116: $Vi1 }, o2($Vv1, [2, 101]), o2($Vv1, [2, 103]), o2($Vv1, [2, 104]), o2($Vv1, [2, 157]), o2($Vv1, [2, 158]), o2($Vv1, [2, 159]), o2($Vv1, [2, 160]), o2($Vv1, [2, 161]), o2($Vv1, [2, 162]), o2($Vv1, [2, 163]), o2($Vv1, [2, 164]), o2($Vv1, [2, 165]), o2($Vv1, [2, 166]), o2($Vv1, [2, 167]), o2($Vv1, [2, 90]), o2($Vv1, [2, 91]), o2($Vv1, [2, 92]), o2($Vv1, [2, 93]), o2($Vv1, [2, 94]), o2($Vv1, [2, 95]), o2($Vv1, [2, 96]), o2($Vv1, [2, 97]), o2($Vv1, [2, 98]), o2($Vv1, [2, 99]), o2($Vv1, [2, 100]), { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 203], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 42: 28, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 84: $Vf, 85: $Vg, 86: $Vh, 87: $Vi, 88: $Vj, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs, 121: $Vt, 122: $Vu, 123: $Vv, 124: $Vw, 125: $Vx }, { 10: $Vy, 18: 204 }, { 44: [1, 205] }, o2($VQ, [2, 43]), { 10: [1, 206], 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 113, 114: $Vq, 115: $Vr, 116: $Vs }, { 10: [1, 207] }, { 10: [1, 208], 106: [1, 209] }, o2($Vw1, [2, 128]), { 10: [1, 210], 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 113, 114: $Vq, 115: $Vr, 116: $Vs }, { 10: [1, 211], 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 113, 114: $Vq, 115: $Vr, 116: $Vs }, { 80: [1, 212] }, o2($Vm1, [2, 109], { 10: [1, 213] }), o2($Vm1, [2, 111], { 10: [1, 214] }), { 80: [1, 215] }, o2($Vn1, [2, 184]), { 80: [1, 216], 98: [1, 217] }, o2($VQ, [2, 55], { 113: 113, 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 114: $Vq, 115: $Vr, 116: $Vs }), { 31: [1, 218], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($Vx1, [2, 86]), o2($Vx1, [2, 88]), o2($Vx1, [2, 89]), o2($Vx1, [2, 153]), o2($Vx1, [2, 154]), o2($Vx1, [2, 155]), o2($Vx1, [2, 156]), { 49: [1, 220], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 221, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 51: [1, 222], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 53: [1, 223], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 55: [1, 224], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 57: [1, 225], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 60: [1, 226] }, { 64: [1, 227], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 66: [1, 228], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 30: 229, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 31: [1, 230], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 67: $Vo1, 69: [1, 231], 71: [1, 232], 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 67: $Vo1, 69: [1, 234], 71: [1, 233], 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VD, [2, 45], { 18: 156, 10: $Vy, 40: $Vl1 }), o2($VD, [2, 47], { 44: $Vk1 }), o2($VU, [2, 75]), o2($VU, [2, 74]), { 62: [1, 235], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VU, [2, 77]), o2($Vu1, [2, 80]), { 77: [1, 236], 79: 198, 116: $VX, 119: $VY }, { 30: 237, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($Vj1, $V4, { 5: 238 }), o2($Vv1, [2, 102]), o2($Vz, [2, 35]), { 43: 239, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, { 10: $Vy, 18: 240 }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 241, 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 252, 104: [1, 253], 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 254, 104: [1, 255], 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 105: [1, 256] }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 257, 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 44: $Vd, 47: 258, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, o2($Vm1, [2, 108]), { 80: [1, 259] }, { 80: [1, 260], 98: [1, 261] }, o2($Vm1, [2, 116]), o2($Vm1, [2, 118], { 10: [1, 262] }), o2($Vm1, [2, 119]), o2($VR, [2, 56]), o2($Vx1, [2, 87]), o2($VR, [2, 57]), { 51: [1, 263], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VR, [2, 64]), o2($VR, [2, 59]), o2($VR, [2, 60]), o2($VR, [2, 61]), { 109: [1, 264] }, o2($VR, [2, 63]), o2($VR, [2, 65]), { 66: [1, 265], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VR, [2, 67]), o2($VR, [2, 68]), o2($VR, [2, 70]), o2($VR, [2, 69]), o2($VR, [2, 71]), o2([10, 44, 60, 89, 102, 105, 106, 109, 111, 114, 115, 116], [2, 85]), o2($VU, [2, 78]), { 31: [1, 266], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 267], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 42: 28, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 84: $Vf, 85: $Vg, 86: $Vh, 87: $Vi, 88: $Vj, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs, 121: $Vt, 122: $Vu, 123: $Vv, 124: $Vw, 125: $Vx }, o2($VQ, [2, 53]), { 43: 268, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs }, o2($Vm1, [2, 121], { 106: $VG1 }), o2($VH1, [2, 130], { 108: 270, 10: $Vy1, 60: $Vz1, 84: $VA1, 105: $VB1, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }), o2($VI1, [2, 132]), o2($VI1, [2, 134]), o2($VI1, [2, 135]), o2($VI1, [2, 136]), o2($VI1, [2, 137]), o2($VI1, [2, 138]), o2($VI1, [2, 139]), o2($VI1, [2, 140]), o2($VI1, [2, 141]), o2($Vm1, [2, 122], { 106: $VG1 }), { 10: [1, 271] }, o2($Vm1, [2, 123], { 106: $VG1 }), { 10: [1, 272] }, o2($Vw1, [2, 129]), o2($Vm1, [2, 105], { 106: $VG1 }), o2($Vm1, [2, 106], { 113: 113, 44: $Vd, 60: $Ve, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 114: $Vq, 115: $Vr, 116: $Vs }), o2($Vm1, [2, 110]), o2($Vm1, [2, 112], { 10: [1, 273] }), o2($Vm1, [2, 113]), { 98: [1, 274] }, { 51: [1, 275] }, { 62: [1, 276] }, { 66: [1, 277] }, { 8: $VA, 9: $VB, 11: $VC, 21: 278 }, o2($Vz, [2, 34]), o2($VQ, [2, 52]), { 10: $Vy1, 60: $Vz1, 84: $VA1, 105: $VB1, 107: 279, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, o2($VI1, [2, 133]), { 14: $VF, 44: $VG, 60: $VH, 89: $VI, 101: 280, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP, 120: 88 }, { 14: $VF, 44: $VG, 60: $VH, 89: $VI, 101: 281, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP, 120: 88 }, { 98: [1, 282] }, o2($Vm1, [2, 120]), o2($VR, [2, 58]), { 30: 283, 67: $Vo1, 80: $Vp1, 81: $Vq1, 82: 172, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, o2($VR, [2, 66]), o2($Vj1, $V4, { 5: 284 }), o2($VH1, [2, 131], { 108: 270, 10: $Vy1, 60: $Vz1, 84: $VA1, 105: $VB1, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }), o2($Vm1, [2, 126], { 120: 168, 10: [1, 285], 14: $VF, 44: $VG, 60: $VH, 89: $VI, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP }), o2($Vm1, [2, 127], { 120: 168, 10: [1, 286], 14: $VF, 44: $VG, 60: $VH, 89: $VI, 105: $VJ, 106: $VK, 109: $VL, 111: $VM, 114: $VN, 115: $VO, 116: $VP }), o2($Vm1, [2, 114]), { 31: [1, 287], 67: $Vo1, 82: 219, 116: $Vr1, 117: $Vs1, 118: $Vt1 }, { 6: 11, 7: 12, 8: $V5, 9: $V6, 10: $V7, 11: $V8, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: $V9, 32: [1, 288], 33: 24, 34: $Va, 36: $Vb, 38: $Vc, 42: 28, 43: 39, 44: $Vd, 45: 40, 47: 41, 60: $Ve, 84: $Vf, 85: $Vg, 86: $Vh, 87: $Vi, 88: $Vj, 89: $Vk, 102: $Vl, 105: $Vm, 106: $Vn, 109: $Vo, 111: $Vp, 113: 42, 114: $Vq, 115: $Vr, 116: $Vs, 121: $Vt, 122: $Vu, 123: $Vv, 124: $Vw, 125: $Vx }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 289, 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, { 10: $Vy1, 60: $Vz1, 84: $VA1, 92: 290, 105: $VB1, 107: 242, 108: 243, 109: $VC1, 110: $VD1, 111: $VE1, 112: $VF1 }, o2($VR, [2, 62]), o2($Vz, [2, 33]), o2($Vm1, [2, 124], { 106: $VG1 }), o2($Vm1, [2, 125], { 106: $VG1 })], + defaultActions: {}, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: {}, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + this.begin("acc_title"); + return 34; + break; + case 1: + this.popState(); + return "acc_title_value"; + break; + case 2: + this.begin("acc_descr"); + return 36; + break; + case 3: + this.popState(); + return "acc_descr_value"; + break; + case 4: + this.begin("acc_descr_multiline"); + break; + case 5: + this.popState(); + break; + case 6: + return "acc_descr_multiline_value"; + break; + case 7: + this.pushState("shapeData"); + yy_.yytext = ""; + return 40; + break; + case 8: + this.pushState("shapeDataStr"); + return 40; + break; + case 9: + this.popState(); + return 40; + break; + case 10: + const re3 = /\n\s*/g; + yy_.yytext = yy_.yytext.replace(re3, "
    "); + return 40; + break; + case 11: + return 40; + break; + case 12: + this.popState(); + break; + case 13: + this.begin("callbackname"); + break; + case 14: + this.popState(); + break; + case 15: + this.popState(); + this.begin("callbackargs"); + break; + case 16: + return 95; + break; + case 17: + this.popState(); + break; + case 18: + return 96; + break; + case 19: + return "MD_STR"; + break; + case 20: + this.popState(); + break; + case 21: + this.begin("md_string"); + break; + case 22: + return "STR"; + break; + case 23: + this.popState(); + break; + case 24: + this.pushState("string"); + break; + case 25: + return 84; + break; + case 26: + return 102; + break; + case 27: + return 85; + break; + case 28: + return 104; + break; + case 29: + return 86; + break; + case 30: + return 87; + break; + case 31: + return 97; + break; + case 32: + this.begin("click"); + break; + case 33: + this.popState(); + break; + case 34: + return 88; + break; + case 35: + if (yy.lex.firstGraph()) { + this.begin("dir"); + } + return 12; + break; + case 36: + if (yy.lex.firstGraph()) { + this.begin("dir"); + } + return 12; + break; + case 37: + if (yy.lex.firstGraph()) { + this.begin("dir"); + } + return 12; + break; + case 38: + return 27; + break; + case 39: + return 32; + break; + case 40: + return 98; + break; + case 41: + return 98; + break; + case 42: + return 98; + break; + case 43: + return 98; + break; + case 44: + this.popState(); + return 13; + break; + case 45: + this.popState(); + return 14; + break; + case 46: + this.popState(); + return 14; + break; + case 47: + this.popState(); + return 14; + break; + case 48: + this.popState(); + return 14; + break; + case 49: + this.popState(); + return 14; + break; + case 50: + this.popState(); + return 14; + break; + case 51: + this.popState(); + return 14; + break; + case 52: + this.popState(); + return 14; + break; + case 53: + this.popState(); + return 14; + break; + case 54: + this.popState(); + return 14; + break; + case 55: + return 121; + break; + case 56: + return 122; + break; + case 57: + return 123; + break; + case 58: + return 124; + break; + case 59: + return 125; + break; + case 60: + return 78; + break; + case 61: + return 105; + break; + case 62: + return 111; + break; + case 63: + return 46; + break; + case 64: + return 60; + break; + case 65: + return 44; + break; + case 66: + return 8; + break; + case 67: + return 106; + break; + case 68: + return 115; + break; + case 69: + this.popState(); + return 77; + break; + case 70: + this.pushState("edgeText"); + return 75; + break; + case 71: + return 119; + break; + case 72: + this.popState(); + return 77; + break; + case 73: + this.pushState("thickEdgeText"); + return 75; + break; + case 74: + return 119; + break; + case 75: + this.popState(); + return 77; + break; + case 76: + this.pushState("dottedEdgeText"); + return 75; + break; + case 77: + return 119; + break; + case 78: + return 77; + break; + case 79: + this.popState(); + return 53; + break; + case 80: + return "TEXT"; + break; + case 81: + this.pushState("ellipseText"); + return 52; + break; + case 82: + this.popState(); + return 55; + break; + case 83: + this.pushState("text"); + return 54; + break; + case 84: + this.popState(); + return 57; + break; + case 85: + this.pushState("text"); + return 56; + break; + case 86: + return 58; + break; + case 87: + this.pushState("text"); + return 67; + break; + case 88: + this.popState(); + return 64; + break; + case 89: + this.pushState("text"); + return 63; + break; + case 90: + this.popState(); + return 49; + break; + case 91: + this.pushState("text"); + return 48; + break; + case 92: + this.popState(); + return 69; + break; + case 93: + this.popState(); + return 71; + break; + case 94: + return 117; + break; + case 95: + this.pushState("trapText"); + return 68; + break; + case 96: + this.pushState("trapText"); + return 70; + break; + case 97: + return 118; + break; + case 98: + return 67; + break; + case 99: + return 90; + break; + case 100: + return "SEP"; + break; + case 101: + return 89; + break; + case 102: + return 115; + break; + case 103: + return 111; + break; + case 104: + return 44; + break; + case 105: + return 109; + break; + case 106: + return 114; + break; + case 107: + return 116; + break; + case 108: + this.popState(); + return 62; + break; + case 109: + this.pushState("text"); + return 62; + break; + case 110: + this.popState(); + return 51; + break; + case 111: + this.pushState("text"); + return 50; + break; + case 112: + this.popState(); + return 31; + break; + case 113: + this.pushState("text"); + return 29; + break; + case 114: + this.popState(); + return 66; + break; + case 115: + this.pushState("text"); + return 65; + break; + case 116: + return "TEXT"; + break; + case 117: + return "QUOTE"; + break; + case 118: + return 9; + break; + case 119: + return 10; + break; + case 120: + return 11; + break; + } + }, "anonymous"), + rules: [/^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:@\{)/, /^(?:["])/, /^(?:["])/, /^(?:[^\"]+)/, /^(?:[^}^"]+)/, /^(?:\})/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["][`])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:["])/, /^(?:style\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\b)/, /^(?:class\b)/, /^(?:href[\s])/, /^(?:click[\s]+)/, /^(?:[\s\n])/, /^(?:[^\s\n]*)/, /^(?:flowchart-elk\b)/, /^(?:graph\b)/, /^(?:flowchart\b)/, /^(?:subgraph\b)/, /^(?:end\b\s*)/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:(\r?\n)*\s*\n)/, /^(?:\s*LR\b)/, /^(?:\s*RL\b)/, /^(?:\s*TB\b)/, /^(?:\s*BT\b)/, /^(?:\s*TD\b)/, /^(?:\s*BR\b)/, /^(?:\s*<)/, /^(?:\s*>)/, /^(?:\s*\^)/, /^(?:\s*v\b)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:.*direction\s+TD[^\n]*)/, /^(?:[^\s\"]+@(?=[^\{\"]))/, /^(?:[0-9]+)/, /^(?:#)/, /^(?::::)/, /^(?::)/, /^(?:&)/, /^(?:;)/, /^(?:,)/, /^(?:\*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:[^-]|-(?!-)+)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:[^=]|=(?!))/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:[^\.]|\.(?!))/, /^(?:\s*~~[\~]+\s*)/, /^(?:[-/\)][\)])/, /^(?:[^\(\)\[\]\{\}]|!\)+)/, /^(?:\(-)/, /^(?:\]\))/, /^(?:\(\[)/, /^(?:\]\])/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:>)/, /^(?:\)\])/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\(\(\()/, /^(?:[\\(?=\])][\]])/, /^(?:\/(?=\])\])/, /^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:<)/, /^(?:>)/, /^(?:\^)/, /^(?:\\\|)/, /^(?:v\b)/, /^(?:\*)/, /^(?:#)/, /^(?:&)/, /^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/, /^(?:-)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\|)/, /^(?:\|)/, /^(?:\))/, /^(?:\()/, /^(?:\])/, /^(?:\[)/, /^(?:(\}))/, /^(?:\{)/, /^(?:[^\[\]\(\)\{\}\|\"]+)/, /^(?:")/, /^(?:(\r?\n)+)/, /^(?:\s)/, /^(?:$)/], + conditions: { "shapeDataEndBracket": { "rules": [21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "shapeDataStr": { "rules": [9, 10, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "shapeData": { "rules": [8, 11, 12, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "callbackargs": { "rules": [17, 18, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "callbackname": { "rules": [14, 15, 16, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "href": { "rules": [21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "click": { "rules": [21, 24, 33, 34, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "dottedEdgeText": { "rules": [21, 24, 75, 77, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "thickEdgeText": { "rules": [21, 24, 72, 74, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "edgeText": { "rules": [21, 24, 69, 71, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "trapText": { "rules": [21, 24, 78, 81, 83, 85, 89, 91, 92, 93, 94, 95, 96, 109, 111, 113, 115], "inclusive": false }, "ellipseText": { "rules": [21, 24, 78, 79, 80, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "text": { "rules": [21, 24, 78, 81, 82, 83, 84, 85, 88, 89, 90, 91, 95, 96, 108, 109, 110, 111, 112, 113, 114, 115, 116], "inclusive": false }, "vertex": { "rules": [21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "dir": { "rules": [21, 24, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "acc_descr_multiline": { "rules": [5, 6, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "acc_descr": { "rules": [3, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "acc_title": { "rules": [1, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "md_string": { "rules": [19, 20, 21, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "string": { "rules": [21, 22, 23, 24, 78, 81, 83, 85, 89, 91, 95, 96, 109, 111, 113, 115], "inclusive": false }, "INITIAL": { "rules": [0, 2, 4, 7, 13, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 75, 76, 78, 81, 83, 85, 86, 87, 89, 91, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 109, 111, 113, 115, 117, 118, 119, 120], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser2.parser = parser2; + flow_default = parser2; + } + }); + + // src/diagrams/flowchart/parser/flowParser.ts + var newParser, flowParser_default; + var init_flowParser = __esm({ + "src/diagrams/flowchart/parser/flowParser.ts"() { + "use strict"; + init_flow(); + newParser = Object.assign({}, flow_default); + newParser.parse = (src) => { + const newSrc = src.replace(/}\s*\n/g, "}\n"); + return flow_default.parse(newSrc); + }; + flowParser_default = newParser; + } + }); + + // src/diagrams/globalStyles.ts + var getIconStyles; + var init_globalStyles = __esm({ + "src/diagrams/globalStyles.ts"() { + "use strict"; + getIconStyles = /* @__PURE__ */ __name(() => ` + /* Font Awesome icon styling - consolidated */ + .label-icon { + display: inline-block; + height: 1em; + overflow: visible; + vertical-align: -0.125em; + } + + .node .label-icon path { + fill: currentColor; + stroke: revert; + stroke-width: revert; + } +`, "getIconStyles"); + } + }); + + // src/diagrams/flowchart/styles.ts + var fade, getStyles3, styles_default3; + var init_styles3 = __esm({ + "src/diagrams/flowchart/styles.ts"() { + "use strict"; + init_dist(); + init_globalStyles(); + fade = /* @__PURE__ */ __name((color2, opacity) => { + const channel2 = channel_default2; + const r2 = channel2(color2, "r"); + const g2 = channel2(color2, "g"); + const b3 = channel2(color2, "b"); + return rgba_default(r2, g2, b3, opacity); + }, "fade"); + getStyles3 = /* @__PURE__ */ __name((options2) => `.label { + font-family: ${options2.fontFamily}; + color: ${options2.nodeTextColor || options2.textColor}; + } + .cluster-label text { + fill: ${options2.titleColor}; + } + .cluster-label span { + color: ${options2.titleColor}; + } + .cluster-label span p { + background-color: transparent; + } + + .label text,span { + fill: ${options2.nodeTextColor || options2.textColor}; + color: ${options2.nodeTextColor || options2.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${options2.mainBkg}; + stroke: ${options2.nodeBorder}; + stroke-width: ${options2.strokeWidth ?? 1}px; + } + .rough-node .label text , .node .label text, .image-shape .label, .icon-shape .label { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .katex path { + fill: #000; + stroke: #000; + stroke-width: 1px; + } + + .rough-node .label,.node .label, .image-shape .label, .icon-shape .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + + .root .anchor path { + fill: ${options2.lineColor} !important; + stroke-width: 0; + stroke: ${options2.lineColor}; + } + + .arrowheadPath { + fill: ${options2.arrowheadColor}; + } + + .edgePath .path { + stroke: ${options2.lineColor}; + stroke-width: ${options2.strokeWidth ?? 2}px; + } + + .flowchart-link { + stroke: ${options2.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${options2.edgeLabelBackground}; + p { + background-color: ${options2.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${options2.edgeLabelBackground}; + fill: ${options2.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${fade(options2.edgeLabelBackground, 0.5)}; + // background-color: + } + + .cluster rect { + fill: ${options2.clusterBkg}; + stroke: ${options2.clusterBorder}; + stroke-width: 1px; + } + + .cluster text { + fill: ${options2.titleColor}; + } + + .cluster span { + color: ${options2.titleColor}; + } + /* .cluster div { + color: ${options2.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${options2.fontFamily}; + font-size: 12px; + background: ${options2.tertiaryColor}; + border: 1px solid ${options2.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${options2.textColor}; + } + + rect.text { + fill: none; + stroke-width: 0; + } + + .icon-shape, .image-shape { + background-color: ${options2.edgeLabelBackground}; + p { + background-color: ${options2.edgeLabelBackground}; + padding: 2px; + } + .label rect { + opacity: 0.5; + background-color: ${options2.edgeLabelBackground}; + fill: ${options2.edgeLabelBackground}; + } + text-align: center; + } + ${getIconStyles()} +`, "getStyles"); + styles_default3 = getStyles3; + } + }); + + // src/diagrams/flowchart/flowDiagram.ts + var flowDiagram_exports = {}; + __export(flowDiagram_exports, { + diagram: () => diagram2 + }); + var diagram2; + var init_flowDiagram = __esm({ + "src/diagrams/flowchart/flowDiagram.ts"() { + "use strict"; + init_diagramAPI(); + init_flowDb(); + init_flowRenderer_v3_unified(); + init_flowParser(); + init_styles3(); + diagram2 = { + parser: flowParser_default, + get db() { + return new FlowDB(); + }, + renderer: flowRenderer_v3_unified_default, + styles: styles_default3, + init: /* @__PURE__ */ __name((cnf) => { + if (!cnf.flowchart) { + cnf.flowchart = {}; + } + if (cnf.layout) { + setConfig2({ layout: cnf.layout }); + } + cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + setConfig2({ flowchart: { arrowMarkerAbsolute: cnf.arrowMarkerAbsolute } }); + }, "init") + }; + } + }); + + // src/diagrams/er/parser/erDiagram.jison + var parser3, erDiagram_default; + var init_erDiagram = __esm({ + "src/diagrams/er/parser/erDiagram.jison"() { + "use strict"; + parser3 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [6, 8, 10, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 43, 44, 48, 50, 51, 52], $V1 = [1, 10], $V2 = [1, 11], $V3 = [1, 12], $V4 = [1, 13], $V5 = [1, 23], $V6 = [1, 24], $V7 = [1, 25], $V8 = [1, 26], $V9 = [1, 27], $Va = [1, 19], $Vb = [1, 28], $Vc = [1, 29], $Vd = [1, 20], $Ve = [1, 18], $Vf = [1, 21], $Vg = [1, 22], $Vh = [1, 36], $Vi = [1, 37], $Vj = [1, 38], $Vk = [1, 39], $Vl = [1, 40], $Vm = [6, 8, 10, 13, 15, 17, 20, 21, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 43, 44, 48, 50, 51, 52, 65, 66, 67, 68, 69], $Vn = [1, 45], $Vo = [1, 46], $Vp = [1, 55], $Vq = [40, 48, 50, 51, 52, 70, 71], $Vr = [1, 66], $Vs = [1, 64], $Vt = [1, 61], $Vu = [1, 65], $Vv = [1, 67], $Vw = [6, 8, 10, 13, 17, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 41, 42, 43, 44, 48, 49, 50, 51, 52, 65, 66, 67, 68, 69], $Vx = [65, 66, 67, 68, 69], $Vy = [1, 84], $Vz = [1, 83], $VA = [1, 81], $VB = [1, 82], $VC = [6, 10, 42, 47], $VD = [6, 10, 13, 41, 42, 47, 48, 49], $VE = [1, 92], $VF = [1, 91], $VG = [1, 90], $VH = [19, 58], $VI = [1, 101], $VJ = [1, 100], $VK = [19, 58, 60, 62]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "ER_DIAGRAM": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "entityName": 11, "relSpec": 12, "COLON": 13, "role": 14, "STYLE_SEPARATOR": 15, "idList": 16, "BLOCK_START": 17, "attributes": 18, "BLOCK_STOP": 19, "SQS": 20, "SQE": 21, "title": 22, "title_value": 23, "acc_title": 24, "acc_title_value": 25, "acc_descr": 26, "acc_descr_value": 27, "acc_descr_multiline_value": 28, "direction": 29, "classDefStatement": 30, "classStatement": 31, "styleStatement": 32, "direction_tb": 33, "direction_bt": 34, "direction_rl": 35, "direction_lr": 36, "CLASSDEF": 37, "stylesOpt": 38, "separator": 39, "UNICODE_TEXT": 40, "STYLE_TEXT": 41, "COMMA": 42, "CLASS": 43, "STYLE": 44, "style": 45, "styleComponent": 46, "SEMI": 47, "NUM": 48, "BRKT": 49, "ENTITY_NAME": 50, "DECIMAL_NUM": 51, "ENTITY_ONE": 52, "attribute": 53, "attributeType": 54, "attributeName": 55, "attributeKeyTypeList": 56, "attributeComment": 57, "ATTRIBUTE_WORD": 58, "attributeKeyType": 59, ",": 60, "ATTRIBUTE_KEY": 61, "COMMENT": 62, "cardinality": 63, "relType": 64, "ZERO_OR_ONE": 65, "ZERO_OR_MORE": 66, "ONE_OR_MORE": 67, "ONLY_ONE": 68, "MD_PARENT": 69, "NON_IDENTIFYING": 70, "IDENTIFYING": 71, "WORD": 72, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: "COLON", 15: "STYLE_SEPARATOR", 17: "BLOCK_START", 19: "BLOCK_STOP", 20: "SQS", 21: "SQE", 22: "title", 23: "title_value", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "direction_tb", 34: "direction_bt", 35: "direction_rl", 36: "direction_lr", 37: "CLASSDEF", 40: "UNICODE_TEXT", 41: "STYLE_TEXT", 42: "COMMA", 43: "CLASS", 44: "STYLE", 47: "SEMI", 48: "NUM", 49: "BRKT", 50: "ENTITY_NAME", 51: "DECIMAL_NUM", 52: "ENTITY_ONE", 58: "ATTRIBUTE_WORD", 60: ",", 61: "ATTRIBUTE_KEY", 62: "COMMENT", 65: "ZERO_OR_ONE", 66: "ZERO_OR_MORE", 67: "ONE_OR_MORE", 68: "ONLY_ONE", 69: "MD_PARENT", 70: "NON_IDENTIFYING", 71: "IDENTIFYING", 72: "WORD" }, + productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 9], [9, 7], [9, 7], [9, 4], [9, 6], [9, 3], [9, 5], [9, 1], [9, 3], [9, 7], [9, 9], [9, 6], [9, 8], [9, 4], [9, 6], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [29, 1], [29, 1], [29, 1], [29, 1], [30, 4], [16, 1], [16, 1], [16, 3], [16, 3], [31, 3], [32, 4], [38, 1], [38, 3], [45, 1], [45, 2], [39, 1], [39, 1], [39, 1], [46, 1], [46, 1], [46, 1], [46, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [18, 1], [18, 2], [53, 2], [53, 3], [53, 3], [53, 4], [54, 1], [55, 1], [56, 1], [56, 3], [59, 1], [57, 1], [12, 3], [63, 1], [63, 1], [63, 1], [63, 1], [63, 1], [64, 1], [64, 1], [14, 1], [14, 1], [14, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 1: + break; + case 2: + this.$ = []; + break; + case 3: + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + break; + case 4: + case 5: + this.$ = $$[$0]; + break; + case 6: + case 7: + this.$ = []; + break; + case 8: + yy.addEntity($$[$0 - 4]); + yy.addEntity($$[$0 - 2]); + yy.addRelationship($$[$0 - 4], $$[$0], $$[$0 - 2], $$[$0 - 3]); + break; + case 9: + yy.addEntity($$[$0 - 8]); + yy.addEntity($$[$0 - 4]); + yy.addRelationship($$[$0 - 8], $$[$0], $$[$0 - 4], $$[$0 - 5]); + yy.setClass([$$[$0 - 8]], $$[$0 - 6]); + yy.setClass([$$[$0 - 4]], $$[$0 - 2]); + break; + case 10: + yy.addEntity($$[$0 - 6]); + yy.addEntity($$[$0 - 2]); + yy.addRelationship($$[$0 - 6], $$[$0], $$[$0 - 2], $$[$0 - 3]); + yy.setClass([$$[$0 - 6]], $$[$0 - 4]); + break; + case 11: + yy.addEntity($$[$0 - 6]); + yy.addEntity($$[$0 - 4]); + yy.addRelationship($$[$0 - 6], $$[$0], $$[$0 - 4], $$[$0 - 5]); + yy.setClass([$$[$0 - 4]], $$[$0 - 2]); + break; + case 12: + yy.addEntity($$[$0 - 3]); + yy.addAttributes($$[$0 - 3], $$[$0 - 1]); + break; + case 13: + yy.addEntity($$[$0 - 5]); + yy.addAttributes($$[$0 - 5], $$[$0 - 1]); + yy.setClass([$$[$0 - 5]], $$[$0 - 3]); + break; + case 14: + yy.addEntity($$[$0 - 2]); + break; + case 15: + yy.addEntity($$[$0 - 4]); + yy.setClass([$$[$0 - 4]], $$[$0 - 2]); + break; + case 16: + yy.addEntity($$[$0]); + break; + case 17: + yy.addEntity($$[$0 - 2]); + yy.setClass([$$[$0 - 2]], $$[$0]); + break; + case 18: + yy.addEntity($$[$0 - 6], $$[$0 - 4]); + yy.addAttributes($$[$0 - 6], $$[$0 - 1]); + break; + case 19: + yy.addEntity($$[$0 - 8], $$[$0 - 6]); + yy.addAttributes($$[$0 - 8], $$[$0 - 1]); + yy.setClass([$$[$0 - 8]], $$[$0 - 3]); + break; + case 20: + yy.addEntity($$[$0 - 5], $$[$0 - 3]); + break; + case 21: + yy.addEntity($$[$0 - 7], $$[$0 - 5]); + yy.setClass([$$[$0 - 7]], $$[$0 - 2]); + break; + case 22: + yy.addEntity($$[$0 - 3], $$[$0 - 1]); + break; + case 23: + yy.addEntity($$[$0 - 5], $$[$0 - 3]); + yy.setClass([$$[$0 - 5]], $$[$0]); + break; + case 24: + case 25: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 26: + case 27: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 32: + yy.setDirection("TB"); + break; + case 33: + yy.setDirection("BT"); + break; + case 34: + yy.setDirection("RL"); + break; + case 35: + yy.setDirection("LR"); + break; + case 36: + this.$ = $$[$0 - 3]; + yy.addClass($$[$0 - 2], $$[$0 - 1]); + break; + case 37: + case 38: + case 59: + case 67: + this.$ = [$$[$0]]; + break; + case 39: + case 40: + this.$ = $$[$0 - 2].concat([$$[$0]]); + break; + case 41: + this.$ = $$[$0 - 2]; + yy.setClass($$[$0 - 1], $$[$0]); + break; + case 42: + ; + this.$ = $$[$0 - 3]; + yy.addCssStyles($$[$0 - 2], $$[$0 - 1]); + break; + case 43: + this.$ = [$$[$0]]; + break; + case 44: + $$[$0 - 2].push($$[$0]); + this.$ = $$[$0 - 2]; + break; + case 46: + this.$ = $$[$0 - 1] + $$[$0]; + break; + case 54: + case 79: + case 80: + this.$ = $$[$0].replace(/"/g, ""); + break; + case 55: + case 56: + case 57: + case 58: + case 81: + this.$ = $$[$0]; + break; + case 60: + $$[$0].push($$[$0 - 1]); + this.$ = $$[$0]; + break; + case 61: + this.$ = { type: $$[$0 - 1], name: $$[$0] }; + break; + case 62: + this.$ = { type: $$[$0 - 2], name: $$[$0 - 1], keys: $$[$0] }; + break; + case 63: + this.$ = { type: $$[$0 - 2], name: $$[$0 - 1], comment: $$[$0] }; + break; + case 64: + this.$ = { type: $$[$0 - 3], name: $$[$0 - 2], keys: $$[$0 - 1], comment: $$[$0] }; + break; + case 65: + case 66: + case 69: + this.$ = $$[$0]; + break; + case 68: + $$[$0 - 2].push($$[$0]); + this.$ = $$[$0 - 2]; + break; + case 70: + this.$ = $$[$0].replace(/"/g, ""); + break; + case 71: + this.$ = { cardA: $$[$0], relType: $$[$0 - 1], cardB: $$[$0 - 2] }; + break; + case 72: + this.$ = yy.Cardinality.ZERO_OR_ONE; + break; + case 73: + this.$ = yy.Cardinality.ZERO_OR_MORE; + break; + case 74: + this.$ = yy.Cardinality.ONE_OR_MORE; + break; + case 75: + this.$ = yy.Cardinality.ONLY_ONE; + break; + case 76: + this.$ = yy.Cardinality.MD_PARENT; + break; + case 77: + this.$ = yy.Identification.NON_IDENTIFYING; + break; + case 78: + this.$ = yy.Identification.IDENTIFYING; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o2($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 22: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 14, 30: 15, 31: 16, 32: 17, 33: $V5, 34: $V6, 35: $V7, 36: $V8, 37: $V9, 40: $Va, 43: $Vb, 44: $Vc, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, o2($V0, [2, 7], { 1: [2, 1] }), o2($V0, [2, 3]), { 9: 30, 11: 9, 22: $V1, 24: $V2, 26: $V3, 28: $V4, 29: 14, 30: 15, 31: 16, 32: 17, 33: $V5, 34: $V6, 35: $V7, 36: $V8, 37: $V9, 40: $Va, 43: $Vb, 44: $Vc, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, o2($V0, [2, 5]), o2($V0, [2, 6]), o2($V0, [2, 16], { 12: 31, 63: 35, 15: [1, 32], 17: [1, 33], 20: [1, 34], 65: $Vh, 66: $Vi, 67: $Vj, 68: $Vk, 69: $Vl }), { 23: [1, 41] }, { 25: [1, 42] }, { 27: [1, 43] }, o2($V0, [2, 27]), o2($V0, [2, 28]), o2($V0, [2, 29]), o2($V0, [2, 30]), o2($V0, [2, 31]), o2($Vm, [2, 54]), o2($Vm, [2, 55]), o2($Vm, [2, 56]), o2($Vm, [2, 57]), o2($Vm, [2, 58]), o2($V0, [2, 32]), o2($V0, [2, 33]), o2($V0, [2, 34]), o2($V0, [2, 35]), { 16: 44, 40: $Vn, 41: $Vo }, { 16: 47, 40: $Vn, 41: $Vo }, { 16: 48, 40: $Vn, 41: $Vo }, o2($V0, [2, 4]), { 11: 49, 40: $Va, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, { 16: 50, 40: $Vn, 41: $Vo }, { 18: 51, 19: [1, 52], 53: 53, 54: 54, 58: $Vp }, { 11: 56, 40: $Va, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, { 64: 57, 70: [1, 58], 71: [1, 59] }, o2($Vq, [2, 72]), o2($Vq, [2, 73]), o2($Vq, [2, 74]), o2($Vq, [2, 75]), o2($Vq, [2, 76]), o2($V0, [2, 24]), o2($V0, [2, 25]), o2($V0, [2, 26]), { 13: $Vr, 38: 60, 41: $Vs, 42: $Vt, 45: 62, 46: 63, 48: $Vu, 49: $Vv }, o2($Vw, [2, 37]), o2($Vw, [2, 38]), { 16: 68, 40: $Vn, 41: $Vo, 42: $Vt }, { 13: $Vr, 38: 69, 41: $Vs, 42: $Vt, 45: 62, 46: 63, 48: $Vu, 49: $Vv }, { 13: [1, 70], 15: [1, 71] }, o2($V0, [2, 17], { 63: 35, 12: 72, 17: [1, 73], 42: $Vt, 65: $Vh, 66: $Vi, 67: $Vj, 68: $Vk, 69: $Vl }), { 19: [1, 74] }, o2($V0, [2, 14]), { 18: 75, 19: [2, 59], 53: 53, 54: 54, 58: $Vp }, { 55: 76, 58: [1, 77] }, { 58: [2, 65] }, { 21: [1, 78] }, { 63: 79, 65: $Vh, 66: $Vi, 67: $Vj, 68: $Vk, 69: $Vl }, o2($Vx, [2, 77]), o2($Vx, [2, 78]), { 6: $Vy, 10: $Vz, 39: 80, 42: $VA, 47: $VB }, { 40: [1, 85], 41: [1, 86] }, o2($VC, [2, 43], { 46: 87, 13: $Vr, 41: $Vs, 48: $Vu, 49: $Vv }), o2($VD, [2, 45]), o2($VD, [2, 50]), o2($VD, [2, 51]), o2($VD, [2, 52]), o2($VD, [2, 53]), o2($V0, [2, 41], { 42: $Vt }), { 6: $Vy, 10: $Vz, 39: 88, 42: $VA, 47: $VB }, { 14: 89, 40: $VE, 50: $VF, 72: $VG }, { 16: 93, 40: $Vn, 41: $Vo }, { 11: 94, 40: $Va, 48: $Vd, 50: $Ve, 51: $Vf, 52: $Vg }, { 18: 95, 19: [1, 96], 53: 53, 54: 54, 58: $Vp }, o2($V0, [2, 12]), { 19: [2, 60] }, o2($VH, [2, 61], { 56: 97, 57: 98, 59: 99, 61: $VI, 62: $VJ }), o2([19, 58, 61, 62], [2, 66]), o2($V0, [2, 22], { 15: [1, 103], 17: [1, 102] }), o2([40, 48, 50, 51, 52], [2, 71]), o2($V0, [2, 36]), { 13: $Vr, 41: $Vs, 45: 104, 46: 63, 48: $Vu, 49: $Vv }, o2($V0, [2, 47]), o2($V0, [2, 48]), o2($V0, [2, 49]), o2($Vw, [2, 39]), o2($Vw, [2, 40]), o2($VD, [2, 46]), o2($V0, [2, 42]), o2($V0, [2, 8]), o2($V0, [2, 79]), o2($V0, [2, 80]), o2($V0, [2, 81]), { 13: [1, 105], 42: $Vt }, { 13: [1, 107], 15: [1, 106] }, { 19: [1, 108] }, o2($V0, [2, 15]), o2($VH, [2, 62], { 57: 109, 60: [1, 110], 62: $VJ }), o2($VH, [2, 63]), o2($VK, [2, 67]), o2($VH, [2, 70]), o2($VK, [2, 69]), { 18: 111, 19: [1, 112], 53: 53, 54: 54, 58: $Vp }, { 16: 113, 40: $Vn, 41: $Vo }, o2($VC, [2, 44], { 46: 87, 13: $Vr, 41: $Vs, 48: $Vu, 49: $Vv }), { 14: 114, 40: $VE, 50: $VF, 72: $VG }, { 16: 115, 40: $Vn, 41: $Vo }, { 14: 116, 40: $VE, 50: $VF, 72: $VG }, o2($V0, [2, 13]), o2($VH, [2, 64]), { 59: 117, 61: $VI }, { 19: [1, 118] }, o2($V0, [2, 20]), o2($V0, [2, 23], { 17: [1, 119], 42: $Vt }), o2($V0, [2, 11]), { 13: [1, 120], 42: $Vt }, o2($V0, [2, 10]), o2($VK, [2, 68]), o2($V0, [2, 18]), { 18: 121, 19: [1, 122], 53: 53, 54: 54, 58: $Vp }, { 14: 123, 40: $VE, 50: $VF, 72: $VG }, { 19: [1, 124] }, o2($V0, [2, 21]), o2($V0, [2, 9]), o2($V0, [2, 19])], + defaultActions: { 55: [2, 65], 75: [2, 60] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + this.begin("acc_title"); + return 24; + break; + case 1: + this.popState(); + return "acc_title_value"; + break; + case 2: + this.begin("acc_descr"); + return 26; + break; + case 3: + this.popState(); + return "acc_descr_value"; + break; + case 4: + this.begin("acc_descr_multiline"); + break; + case 5: + this.popState(); + break; + case 6: + return "acc_descr_multiline_value"; + break; + case 7: + return 33; + break; + case 8: + return 34; + break; + case 9: + return 35; + break; + case 10: + return 36; + break; + case 11: + return 10; + break; + case 12: + break; + case 13: + return 8; + break; + case 14: + return 50; + break; + case 15: + return 72; + break; + case 16: + return 4; + break; + case 17: + this.begin("block"); + return 17; + break; + case 18: + return 49; + break; + case 19: + return 49; + break; + case 20: + return 42; + break; + case 21: + return 15; + break; + case 22: + return 13; + break; + case 23: + break; + case 24: + return 61; + break; + case 25: + return 58; + break; + case 26: + return 58; + break; + case 27: + return 62; + break; + case 28: + break; + case 29: + this.popState(); + return 19; + break; + case 30: + return yy_.yytext[0]; + break; + case 31: + return 20; + break; + case 32: + return 21; + break; + case 33: + this.begin("style"); + return 44; + break; + case 34: + this.popState(); + return 10; + break; + case 35: + break; + case 36: + return 13; + break; + case 37: + return 42; + break; + case 38: + return 49; + break; + case 39: + this.begin("style"); + return 37; + break; + case 40: + return 43; + break; + case 41: + return 65; + break; + case 42: + return 67; + break; + case 43: + return 67; + break; + case 44: + return 67; + break; + case 45: + return 65; + break; + case 46: + return 65; + break; + case 47: + return 66; + break; + case 48: + return 66; + break; + case 49: + return 66; + break; + case 50: + return 66; + break; + case 51: + return 66; + break; + case 52: + return 67; + break; + case 53: + return 66; + break; + case 54: + return 67; + break; + case 55: + return 68; + break; + case 56: + return 68; + break; + case 57: + return 51; + break; + case 58: + return 68; + break; + case 59: + return 68; + break; + case 60: + return 68; + break; + case 61: + return 52; + break; + case 62: + return 48; + break; + case 63: + return 68; + break; + case 64: + return 65; + break; + case 65: + return 66; + break; + case 66: + return 67; + break; + case 67: + return 69; + break; + case 68: + return 70; + break; + case 69: + return 71; + break; + case 70: + return 71; + break; + case 71: + return 70; + break; + case 72: + return 70; + break; + case 73: + return 70; + break; + case 74: + return 41; + break; + case 75: + return 47; + break; + case 76: + return 40; + break; + case 77: + return yy_.yytext[0]; + break; + case 78: + return 6; + break; + } + }, "anonymous"), + rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:#)/i, /^(?:#)/i, /^(?:,)/i, /^(?::::)/i, /^(?::)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:([^\s]*)[~].*[~]([^\s]*))/i, /^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:style\b)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?::)/i, /^(?:,)/i, /^(?:#)/i, /^(?:classDef\b)/i, /^(?:class\b)/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:[0-9]+\.[0-9]+)/i, /^(?:1(?=\s+[A-Za-z_"']))/i, /^(?:1(?=\s+[0-9]))/i, /^(?:1(?=(--|\.\.|\.-|-\.)))/i, /^(?:1\b)/i, /^(?:[0-9]+)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:u(?=[\.\-\|]))/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:([^\x00-\x7F]|\w|-|\*)+)/i, /^(?:;)/i, /^(?:([^\x00-\x7F]|\w|-|\*|\.)+)/i, /^(?:.)/i, /^(?:$)/i], + conditions: { "style": { "rules": [34, 35, 36, 37, 38, 74, 75], "inclusive": false }, "acc_descr_multiline": { "rules": [5, 6], "inclusive": false }, "acc_descr": { "rules": [3], "inclusive": false }, "acc_title": { "rules": [1], "inclusive": false }, "block": { "rules": [23, 24, 25, 26, 27, 28, 29, 30], "inclusive": false }, "INITIAL": { "rules": [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 31, 32, 33, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 76, 77, 78], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser3.parser = parser3; + erDiagram_default = parser3; + } + }); + + // src/diagrams/er/erDb.ts + var ErDB; + var init_erDb = __esm({ + "src/diagrams/er/erDb.ts"() { + "use strict"; + init_logger(); + init_diagramAPI(); + init_commonDb(); + init_utils2(); + ErDB = class { + constructor() { + this.entities = /* @__PURE__ */ new Map(); + this.relationships = []; + this.classes = /* @__PURE__ */ new Map(); + this.direction = "TB"; + this.Cardinality = { + ZERO_OR_ONE: "ZERO_OR_ONE", + ZERO_OR_MORE: "ZERO_OR_MORE", + ONE_OR_MORE: "ONE_OR_MORE", + ONLY_ONE: "ONLY_ONE", + MD_PARENT: "MD_PARENT" + }; + this.Identification = { + NON_IDENTIFYING: "NON_IDENTIFYING", + IDENTIFYING: "IDENTIFYING" + }; + this.setAccTitle = setAccTitle; + this.getAccTitle = getAccTitle; + this.setAccDescription = setAccDescription; + this.getAccDescription = getAccDescription; + this.setDiagramTitle = setDiagramTitle; + this.getDiagramTitle = getDiagramTitle; + this.getConfig = /* @__PURE__ */ __name(() => getConfig2().er, "getConfig"); + this.clear(); + this.addEntity = this.addEntity.bind(this); + this.addAttributes = this.addAttributes.bind(this); + this.addRelationship = this.addRelationship.bind(this); + this.setDirection = this.setDirection.bind(this); + this.addCssStyles = this.addCssStyles.bind(this); + this.addClass = this.addClass.bind(this); + this.setClass = this.setClass.bind(this); + this.setAccTitle = this.setAccTitle.bind(this); + this.setAccDescription = this.setAccDescription.bind(this); + } + static { + __name(this, "ErDB"); + } + /** + * Add entity + * @param name - The name of the entity + * @param alias - The alias of the entity + */ + addEntity(name, alias = "") { + if (!this.entities.has(name)) { + this.entities.set(name, { + id: `entity-${name}-${this.entities.size}`, + label: name, + attributes: [], + alias, + shape: "erBox", + look: getConfig2().look ?? "default", + cssClasses: "default", + cssStyles: [], + labelType: "markdown" + }); + log.info("Added new entity :", name); + } else if (!this.entities.get(name)?.alias && alias) { + this.entities.get(name).alias = alias; + log.info(`Add alias '${alias}' to entity '${name}'`); + } + return this.entities.get(name); + } + getEntity(name) { + return this.entities.get(name); + } + getEntities() { + return this.entities; + } + getClasses() { + return this.classes; + } + addAttributes(entityName, attribs) { + const entity = this.addEntity(entityName); + let i2; + for (i2 = attribs.length - 1; i2 >= 0; i2--) { + if (!attribs[i2].keys) { + attribs[i2].keys = []; + } + if (!attribs[i2].comment) { + attribs[i2].comment = ""; + } + entity.attributes.push(attribs[i2]); + log.debug("Added attribute ", attribs[i2].name); + } + } + /** + * Add a relationship + * + * @param entA - The first entity in the relationship + * @param rolA - The role played by the first entity in relation to the second + * @param entB - The second entity in the relationship + * @param rSpec - The details of the relationship between the two entities + */ + addRelationship(entA, rolA, entB, rSpec) { + const entityA = this.entities.get(entA); + const entityB = this.entities.get(entB); + if (!entityA || !entityB) { + return; + } + const rel2 = { + entityA: entityA.id, + roleA: rolA, + entityB: entityB.id, + relSpec: rSpec + }; + this.relationships.push(rel2); + log.debug("Added new relationship :", rel2); + } + getRelationships() { + return this.relationships; + } + getDirection() { + return this.direction; + } + setDirection(dir2) { + this.direction = dir2; + } + getCompiledStyles(classDefs) { + let compiledStyles = []; + for (const customClass of classDefs) { + const cssClass = this.classes.get(customClass); + if (cssClass?.styles) { + compiledStyles = [...compiledStyles, ...cssClass.styles ?? []].map((s2) => s2.trim()); + } + if (cssClass?.textStyles) { + compiledStyles = [...compiledStyles, ...cssClass.textStyles ?? []].map((s2) => s2.trim()); + } + } + return compiledStyles; + } + addCssStyles(ids, styles6) { + for (const id35 of ids) { + const entity = this.entities.get(id35); + if (!styles6 || !entity) { + return; + } + for (const style3 of styles6) { + entity.cssStyles.push(style3); + } + } + } + addClass(ids, style3) { + ids.forEach((id35) => { + let classNode = this.classes.get(id35); + if (classNode === void 0) { + classNode = { id: id35, styles: [], textStyles: [] }; + this.classes.set(id35, classNode); + } + if (style3) { + style3.forEach(function(s2) { + if (/color/.exec(s2)) { + const newStyle = s2.replace("fill", "bgFill"); + classNode.textStyles.push(newStyle); + } + classNode.styles.push(s2); + }); + } + }); + } + setClass(ids, classNames) { + for (const id35 of ids) { + const entity = this.entities.get(id35); + if (entity) { + for (const className of classNames) { + entity.cssClasses += " " + className; + } + } + } + } + clear() { + this.entities = /* @__PURE__ */ new Map(); + this.classes = /* @__PURE__ */ new Map(); + this.relationships = []; + clear(); + } + getData() { + const nodes5 = []; + const edges3 = []; + const config5 = getConfig2(); + let colorIndex = 0; + for (const entityKey of this.entities.keys()) { + const entityNode = this.entities.get(entityKey); + if (entityNode) { + entityNode.cssCompiledStyles = this.getCompiledStyles(entityNode.cssClasses.split(" ")); + entityNode.colorIndex = colorIndex++; + nodes5.push(entityNode); + } + } + let count2 = 0; + for (const relationship of this.relationships) { + const edge = { + id: getEdgeId(relationship.entityA, relationship.entityB, { + prefix: "id", + counter: count2++ + }), + type: "normal", + curve: "basis", + start: relationship.entityA, + end: relationship.entityB, + label: relationship.roleA, + labelpos: "c", + thickness: "normal", + classes: "relationshipLine", + arrowTypeStart: relationship.relSpec.cardB.toLowerCase(), + arrowTypeEnd: relationship.relSpec.cardA.toLowerCase(), + pattern: relationship.relSpec.relType == "IDENTIFYING" ? "solid" : "dashed", + look: config5.look, + labelType: "markdown" + }; + edges3.push(edge); + } + return { nodes: nodes5, edges: edges3, other: {}, config: config5, direction: "TB" }; + } + }; + } + }); + + // src/diagrams/er/erRenderer-unified.ts + var erRenderer_unified_exports = {}; + __export(erRenderer_unified_exports, { + draw: () => draw3 + }); + var draw3; + var init_erRenderer_unified = __esm({ + "src/diagrams/er/erRenderer-unified.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_insertElementsForSize(); + init_render2(); + init_setupViewPortForSVG(); + init_utils2(); + init_src32(); + draw3 = /* @__PURE__ */ __name(async function(text4, id35, _version, diag) { + log.info("REF0:"); + log.info("Drawing er diagram (unified)", id35); + const { securityLevel, er: conf5, layout: layout7 } = getConfig2(); + const data4Layout = diag.db.getData(); + const svg2 = getDiagramElement(id35, securityLevel); + data4Layout.type = diag.type; + data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout7); + data4Layout.config.flowchart.nodeSpacing = conf5?.nodeSpacing || 140; + data4Layout.config.flowchart.rankSpacing = conf5?.rankSpacing || 80; + data4Layout.direction = diag.db.getDirection(); + const { config: config5 } = data4Layout; + const { look } = config5; + if (look === "neo") { + data4Layout.markers = [ + "only_one_neo", + "zero_or_one_neo", + "one_or_more_neo", + "zero_or_more_neo" + ]; + } else { + data4Layout.markers = ["only_one", "zero_or_one", "one_or_more", "zero_or_more"]; + } + data4Layout.diagramId = id35; + await render6(data4Layout, svg2); + if (data4Layout.layoutAlgorithm === "elk") { + svg2.select(".edges").lower(); + } + const backgroundNodes = svg2.selectAll('[id*="-background"]'); + if (Array.from(backgroundNodes).length > 0) { + backgroundNodes.each(function() { + const backgroundNode = select_default2(this); + const backgroundId = backgroundNode.attr("id"); + const nonBackgroundId = backgroundId.replace("-background", ""); + const nonBackgroundNode = svg2.select(`#${CSS.escape(nonBackgroundId)}`); + if (!nonBackgroundNode.empty()) { + const transform8 = nonBackgroundNode.attr("transform"); + backgroundNode.attr("transform", transform8); + } + }); + } + const padding2 = 8; + utils_default2.insertTitle( + svg2, + "erDiagramTitleText", + conf5?.titleTopMargin ?? 25, + diag.db.getDiagramTitle() + ); + setupViewPortForSVG(svg2, padding2, "erDiagram", conf5?.useMaxWidth ?? true); + }, "draw"); + } + }); + + // src/diagrams/er/styles.ts + var fade2, COLOR_THEMES2, genColor, getStyles4, styles_default4; + var init_styles4 = __esm({ + "src/diagrams/er/styles.ts"() { + "use strict"; + init_dist(); + fade2 = /* @__PURE__ */ __name((color2, opacity) => { + const channel2 = channel_default2; + const r2 = channel2(color2, "r"); + const g2 = channel2(color2, "g"); + const b3 = channel2(color2, "b"); + return rgba_default(r2, g2, b3, opacity); + }, "fade"); + COLOR_THEMES2 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]); + genColor = /* @__PURE__ */ __name((options2) => { + const { theme, look, bkgColorArray, borderColorArray } = options2; + if (!COLOR_THEMES2.has(theme)) { + return ""; + } + const hasBkgColors = bkgColorArray?.length > 0; + let sections6 = ""; + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + sections6 += ` + + [data-look="${look}"][data-color-id="color-${i2}"].node path { + stroke: ${borderColorArray[i2]}; + ${hasBkgColors ? `fill: ${bkgColorArray[i2]};` : ""} + } + + [data-look="${look}"][data-color-id="color-${i2}"].node rect { + stroke: ${borderColorArray[i2]}; + ${hasBkgColors ? `fill: ${bkgColorArray[i2]};` : ""} + } + `; + } + return sections6; + }, "genColor"); + getStyles4 = /* @__PURE__ */ __name((options2) => { + const { look, theme, erEdgeLabelBackground, strokeWidth } = options2; + return ` + ${genColor(options2)} + .entityBox { + fill: ${options2.mainBkg}; + stroke: ${options2.nodeBorder}; + } + + .relationshipLabelBox { + fill: ${options2.tertiaryColor}; + opacity: 0.7; + background-color: ${options2.tertiaryColor}; + rect { + opacity: 0.5; + } + } + + .labelBkg { + background-color: ${COLOR_THEMES2.has(theme) && erEdgeLabelBackground ? erEdgeLabelBackground : fade2(options2.tertiaryColor, 0.5)}; + } + + .edgeLabel { + background-color: ${COLOR_THEMES2.has(theme) && erEdgeLabelBackground ? erEdgeLabelBackground : options2.edgeLabelBackground}; + } + .edgeLabel .label rect { + fill: ${COLOR_THEMES2.has(theme) && erEdgeLabelBackground ? erEdgeLabelBackground : options2.edgeLabelBackground}; + } + .edgeLabel .label text { + fill: ${options2.textColor}; + } + + .edgeLabel .label { + fill: ${options2.nodeBorder}; + font-size: 14px; + } + + .label { + font-family: ${options2.fontFamily}; + color: ${options2.nodeTextColor || options2.textColor}; + } + + .edge-pattern-dashed { + stroke-dasharray: 8,8; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon + { + fill: ${options2.mainBkg}; + stroke: ${options2.nodeBorder}; + stroke-width: ${look === "neo" ? strokeWidth : "1px"}; + } + + .relationshipLine { + stroke: ${options2.lineColor}; + stroke-width: ${look === "neo" ? strokeWidth : "1px"}; + fill: none; + } + + .marker { + fill: none !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; + } + [data-look=neo].labelBkg { + background-color: ${fade2(options2.tertiaryColor, 0.5)}; + } +`; + }, "getStyles"); + styles_default4 = getStyles4; + } + }); + + // src/diagrams/er/erDiagram.ts + var erDiagram_exports = {}; + __export(erDiagram_exports, { + diagram: () => diagram3 + }); + var diagram3; + var init_erDiagram2 = __esm({ + "src/diagrams/er/erDiagram.ts"() { + "use strict"; + init_erDiagram(); + init_erDb(); + init_erRenderer_unified(); + init_styles4(); + diagram3 = { + parser: erDiagram_default, + get db() { + return new ErDB(); + }, + renderer: erRenderer_unified_exports, + styles: styles_default4 + }; + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-NNHCCRGN.mjs + function isAstNode(obj) { + return typeof obj === "object" && obj !== null && typeof obj.$type === "string"; + } + function isReference(obj) { + return typeof obj === "object" && obj !== null && typeof obj.$refText === "string" && "ref" in obj; + } + function isMultiReference(obj) { + return typeof obj === "object" && obj !== null && typeof obj.$refText === "string" && "items" in obj; + } + function isAstNodeDescription(obj) { + return typeof obj === "object" && obj !== null && typeof obj.name === "string" && typeof obj.type === "string" && typeof obj.path === "string"; + } + function isLinkingError(obj) { + return typeof obj === "object" && obj !== null && typeof obj.info === "object" && typeof obj.message === "string"; + } + function isCompositeCstNode(node2) { + return typeof node2 === "object" && node2 !== null && Array.isArray(node2.content); + } + function isLeafCstNode(node2) { + return typeof node2 === "object" && node2 !== null && typeof node2.tokenType === "object"; + } + function isRootCstNode(node2) { + return isCompositeCstNode(node2) && typeof node2.fullText === "string"; + } + function toString5(item) { + if (typeof item === "string") { + return item; + } + if (typeof item === "undefined") { + return "undefined"; + } + if (typeof item.toString === "function") { + return item.toString(); + } + return Object.prototype.toString.call(item); + } + function isIterable(obj) { + return !!obj && typeof obj[Symbol.iterator] === "function"; + } + function stream(...collections) { + if (collections.length === 1) { + const collection4 = collections[0]; + if (collection4 instanceof StreamImpl) { + return collection4; + } + if (isIterable(collection4)) { + return new StreamImpl(() => collection4[Symbol.iterator](), (iterator) => iterator.next()); + } + if (typeof collection4.length === "number") { + return new StreamImpl(() => ({ index: 0 }), (state4) => { + if (state4.index < collection4.length) { + return { done: false, value: collection4[state4.index++] }; + } else { + return DONE_RESULT; + } + }); + } + } + if (collections.length > 1) { + return new StreamImpl(() => ({ collIndex: 0, arrIndex: 0 }), (state4) => { + do { + if (state4.iterator) { + const next3 = state4.iterator.next(); + if (!next3.done) { + return next3; + } + state4.iterator = void 0; + } + if (state4.array) { + if (state4.arrIndex < state4.array.length) { + return { done: false, value: state4.array[state4.arrIndex++] }; + } + state4.array = void 0; + state4.arrIndex = 0; + } + if (state4.collIndex < collections.length) { + const collection4 = collections[state4.collIndex++]; + if (isIterable(collection4)) { + state4.iterator = collection4[Symbol.iterator](); + } else if (collection4 && typeof collection4.length === "number") { + state4.array = collection4; + } + } + } while (state4.iterator || state4.array || state4.collIndex < collections.length); + return DONE_RESULT; + }); + } + return EMPTY_STREAM; + } + function linkContentToContainer(node2, options2 = {}) { + for (const [name, value2] of Object.entries(node2)) { + if (!name.startsWith("$")) { + if (Array.isArray(value2)) { + value2.forEach((item, index) => { + if (isAstNode(item)) { + item.$container = node2; + item.$containerProperty = name; + item.$containerIndex = index; + if (options2.deep) { + linkContentToContainer(item, options2); + } + } + }); + } else if (isAstNode(value2)) { + value2.$container = node2; + value2.$containerProperty = name; + if (options2.deep) { + linkContentToContainer(value2, options2); + } + } + } + } + } + function getContainerOfType(node2, typePredicate) { + let item = node2; + while (item) { + if (typePredicate(item)) { + return item; + } + item = item.$container; + } + return void 0; + } + function hasContainerOfType(node2, predicate) { + let item = node2; + while (item) { + if (predicate(item)) { + return true; + } + item = item.$container; + } + return false; + } + function getDocument(node2) { + const rootNode = findRootNode(node2); + const result = rootNode.$document; + if (!result) { + throw new Error("AST node has no document."); + } + return result; + } + function findRootNode(node2) { + while (node2.$container) { + node2 = node2.$container; + } + return node2; + } + function getReferenceNodes(reference) { + if (isReference(reference)) { + return reference.ref ? [reference.ref] : []; + } else if (isMultiReference(reference)) { + return reference.items.map((item) => item.ref); + } + return []; + } + function streamContents(node2, options2) { + if (!node2) { + throw new Error("Node must be an AstNode."); + } + const range3 = options2?.range; + return new StreamImpl(() => ({ + keys: Object.keys(node2), + keyIndex: 0, + arrayIndex: 0 + }), (state4) => { + while (state4.keyIndex < state4.keys.length) { + const property3 = state4.keys[state4.keyIndex]; + if (!property3.startsWith("$")) { + const value2 = node2[property3]; + if (isAstNode(value2)) { + state4.keyIndex++; + if (isAstNodeInRange(value2, range3)) { + return { done: false, value: value2 }; + } + } else if (Array.isArray(value2)) { + while (state4.arrayIndex < value2.length) { + const index = state4.arrayIndex++; + const element3 = value2[index]; + if (isAstNode(element3) && isAstNodeInRange(element3, range3)) { + return { done: false, value: element3 }; + } + } + state4.arrayIndex = 0; + } + } + state4.keyIndex++; + } + return DONE_RESULT; + }); + } + function streamAllContents(root32, options2) { + if (!root32) { + throw new Error("Root node must be an AstNode."); + } + return new TreeStreamImpl(root32, (node2) => streamContents(node2, options2)); + } + function streamAst(root32, options2) { + if (!root32) { + throw new Error("Root node must be an AstNode."); + } else if (options2?.range && !isAstNodeInRange(root32, options2.range)) { + return new TreeStreamImpl(root32, () => []); + } + return new TreeStreamImpl(root32, (node2) => streamContents(node2, options2), { includeRoot: true }); + } + function isAstNodeInRange(astNode, range3) { + if (!range3) { + return true; + } + const nodeRange = astNode.$cstNode?.range; + if (!nodeRange) { + return false; + } + return inRange(nodeRange, range3); + } + function streamReferences(node2) { + return new StreamImpl(() => ({ + keys: Object.keys(node2), + keyIndex: 0, + arrayIndex: 0 + }), (state4) => { + while (state4.keyIndex < state4.keys.length) { + const property3 = state4.keys[state4.keyIndex]; + if (!property3.startsWith("$")) { + const value2 = node2[property3]; + if (isReference(value2) || isMultiReference(value2)) { + state4.keyIndex++; + return { done: false, value: { reference: value2, container: node2, property: property3 } }; + } else if (Array.isArray(value2)) { + while (state4.arrayIndex < value2.length) { + const index = state4.arrayIndex++; + const element3 = value2[index]; + if (isReference(element3) || isMultiReference(value2)) { + return { done: false, value: { reference: element3, container: node2, property: property3, index } }; + } + } + state4.arrayIndex = 0; + } + } + state4.keyIndex++; + } + return DONE_RESULT; + }); + } + function assignMandatoryProperties(reflection3, node2) { + const typeMetaData = reflection3.getTypeMetaData(node2.$type); + const genericNode = node2; + for (const property3 of Object.values(typeMetaData.properties)) { + if (property3.defaultValue !== void 0 && genericNode[property3.name] === void 0) { + genericNode[property3.name] = copyDefaultValue(property3.defaultValue); + } + } + } + function copyDefaultValue(propertyType) { + if (Array.isArray(propertyType)) { + return [...propertyType.map(copyDefaultValue)]; + } else { + return propertyType; + } + } + function copyAstNode(node2, buildReference, trace) { + const copy5 = { $type: node2.$type }; + if (trace) { + trace.set(node2, copy5); + trace.set(copy5, node2); + } + for (const [name, value2] of Object.entries(node2)) { + if (!name.startsWith("$")) { + if (isAstNode(value2)) { + copy5[name] = copyAstNode(value2, buildReference, trace); + } else if (isReference(value2)) { + copy5[name] = buildReference(copy5, name, value2.$refNode, value2.$refText, value2); + } else if (Array.isArray(value2)) { + const copiedArray = []; + for (const element3 of value2) { + if (isAstNode(element3)) { + copiedArray.push(copyAstNode(element3, buildReference, trace)); + } else if (isReference(element3)) { + copiedArray.push(buildReference(copy5, name, element3.$refNode, element3.$refText, element3)); + } else { + copiedArray.push(element3); + } + } + copy5[name] = copiedArray; + } else { + copy5[name] = value2; + } + } + } + linkContentToContainer(copy5, { deep: true }); + return copy5; + } + function isAbstractElement(item) { + return reflection.isInstance(item, AbstractElement.$type); + } + function isAbstractParserRule(item) { + return reflection.isInstance(item, AbstractParserRule.$type); + } + function isAbstractRule(item) { + return reflection.isInstance(item, AbstractRule.$type); + } + function isAbstractType(item) { + return reflection.isInstance(item, AbstractType.$type); + } + function isAction(item) { + return reflection.isInstance(item, Action.$type); + } + function isAlternatives(item) { + return reflection.isInstance(item, Alternatives.$type); + } + function isArrayLiteral(item) { + return reflection.isInstance(item, ArrayLiteral.$type); + } + function isArrayType(item) { + return reflection.isInstance(item, ArrayType.$type); + } + function isAssignment(item) { + return reflection.isInstance(item, Assignment.$type); + } + function isBooleanLiteral(item) { + return reflection.isInstance(item, BooleanLiteral.$type); + } + function isCharacterRange(item) { + return reflection.isInstance(item, CharacterRange.$type); + } + function isCondition(item) { + return reflection.isInstance(item, Condition.$type); + } + function isConjunction(item) { + return reflection.isInstance(item, Conjunction.$type); + } + function isCrossReference(item) { + return reflection.isInstance(item, CrossReference.$type); + } + function isDisjunction(item) { + return reflection.isInstance(item, Disjunction.$type); + } + function isEndOfFile(item) { + return reflection.isInstance(item, EndOfFile.$type); + } + function isGrammar(item) { + return reflection.isInstance(item, Grammar.$type); + } + function isGrammarImport(item) { + return reflection.isInstance(item, GrammarImport.$type); + } + function isGroup(item) { + return reflection.isInstance(item, Group.$type); + } + function isInferredType(item) { + return reflection.isInstance(item, InferredType.$type); + } + function isInfixRule(item) { + return reflection.isInstance(item, InfixRule.$type); + } + function isInfixRuleOperatorList(item) { + return reflection.isInstance(item, InfixRuleOperatorList.$type); + } + function isInfixRuleOperators(item) { + return reflection.isInstance(item, InfixRuleOperators.$type); + } + function isInterface(item) { + return reflection.isInstance(item, Interface.$type); + } + function isKeyword(item) { + return reflection.isInstance(item, Keyword2.$type); + } + function isNamedArgument(item) { + return reflection.isInstance(item, NamedArgument.$type); + } + function isNegatedToken(item) { + return reflection.isInstance(item, NegatedToken.$type); + } + function isNegation(item) { + return reflection.isInstance(item, Negation.$type); + } + function isNumberLiteral(item) { + return reflection.isInstance(item, NumberLiteral.$type); + } + function isParameter(item) { + return reflection.isInstance(item, Parameter.$type); + } + function isParameterReference(item) { + return reflection.isInstance(item, ParameterReference.$type); + } + function isParserRule(item) { + return reflection.isInstance(item, ParserRule.$type); + } + function isReferenceType(item) { + return reflection.isInstance(item, ReferenceType.$type); + } + function isRegexToken(item) { + return reflection.isInstance(item, RegexToken.$type); + } + function isReturnType(item) { + return reflection.isInstance(item, ReturnType.$type); + } + function isRuleCall(item) { + return reflection.isInstance(item, RuleCall.$type); + } + function isSimpleType(item) { + return reflection.isInstance(item, SimpleType.$type); + } + function isStringLiteral(item) { + return reflection.isInstance(item, StringLiteral.$type); + } + function isTerminalAlternatives(item) { + return reflection.isInstance(item, TerminalAlternatives.$type); + } + function isTerminalElement(item) { + return reflection.isInstance(item, TerminalElement.$type); + } + function isTerminalGroup(item) { + return reflection.isInstance(item, TerminalGroup.$type); + } + function isTerminalRule(item) { + return reflection.isInstance(item, TerminalRule.$type); + } + function isTerminalRuleCall(item) { + return reflection.isInstance(item, TerminalRuleCall.$type); + } + function isType(item) { + return reflection.isInstance(item, Type3.$type); + } + function isTypeAttribute(item) { + return reflection.isInstance(item, TypeAttribute.$type); + } + function isTypeDefinition(item) { + return reflection.isInstance(item, TypeDefinition.$type); + } + function isUnionType(item) { + return reflection.isInstance(item, UnionType.$type); + } + function isUnorderedGroup(item) { + return reflection.isInstance(item, UnorderedGroup.$type); + } + function isUntilToken(item) { + return reflection.isInstance(item, UntilToken.$type); + } + function isValueLiteral(item) { + return reflection.isInstance(item, ValueLiteral.$type); + } + function isWildcard(item) { + return reflection.isInstance(item, Wildcard.$type); + } + function getDatatypeNode(cstNode) { + let current = cstNode; + let found = false; + while (current) { + const definingRule = getContainerOfType(current.grammarSource, isParserRule); + if (definingRule && definingRule.dataType) { + current = current.container; + found = true; + } else if (found) { + return current; + } else { + return void 0; + } + } + return void 0; + } + function streamCst(node2) { + return new TreeStreamImpl(node2, (element3) => { + if (isCompositeCstNode(element3)) { + return element3.content; + } else { + return []; + } + }, { includeRoot: true }); + } + function flattenCst(node2) { + return streamCst(node2).filter(isLeafCstNode); + } + function isChildNode(child, parent4) { + while (child.container) { + child = child.container; + if (child === parent4) { + return true; + } + } + return false; + } + function tokenToRange(token2) { + return { + start: { + character: token2.startColumn - 1, + line: token2.startLine - 1 + }, + end: { + character: token2.endColumn, + // endColumn uses the correct index + line: token2.endLine - 1 + } + }; + } + function toDocumentSegment(node2) { + if (!node2) { + return void 0; + } + const { offset, end: end2, range: range3 } = node2; + return { + range: range3, + offset, + end: end2, + length: end2 - offset + }; + } + function compareRange(range3, to) { + if (range3.end.line < to.start.line || range3.end.line === to.start.line && range3.end.character <= to.start.character) { + return RangeComparison.Before; + } else if (range3.start.line > to.end.line || range3.start.line === to.end.line && range3.start.character >= to.end.character) { + return RangeComparison.After; + } + const startInside = range3.start.line > to.start.line || range3.start.line === to.start.line && range3.start.character >= to.start.character; + const endInside = range3.end.line < to.end.line || range3.end.line === to.end.line && range3.end.character <= to.end.character; + if (startInside && endInside) { + return RangeComparison.Inside; + } else if (startInside) { + return RangeComparison.OverlapBack; + } else if (endInside) { + return RangeComparison.OverlapFront; + } else { + return RangeComparison.Outside; + } + } + function inRange(range3, to) { + const comparison = compareRange(range3, to); + return comparison > RangeComparison.After; + } + function findDeclarationNodeAtOffset(cstNode, offset, nameRegexp = DefaultNameRegexp) { + if (cstNode) { + if (offset > 0) { + const localOffset = offset - cstNode.offset; + const textAtOffset = cstNode.text.charAt(localOffset); + if (!nameRegexp.test(textAtOffset)) { + offset--; + } + } + return findLeafNodeAtOffset(cstNode, offset); + } + return void 0; + } + function findCommentNode(cstNode, commentNames) { + if (cstNode) { + const previous = getPreviousNode(cstNode, true); + if (previous && isCommentNode(previous, commentNames)) { + return previous; + } + if (isRootCstNode(cstNode)) { + const endIndex = cstNode.content.findIndex((e3) => !e3.hidden); + for (let i2 = endIndex - 1; i2 >= 0; i2--) { + const child = cstNode.content[i2]; + if (isCommentNode(child, commentNames)) { + return child; + } + } + } + } + return void 0; + } + function isCommentNode(cstNode, commentNames) { + return isLeafCstNode(cstNode) && commentNames.includes(cstNode.tokenType.name); + } + function findLeafNodeAtOffset(node2, offset) { + if (isLeafCstNode(node2)) { + return node2; + } else if (isCompositeCstNode(node2)) { + const searchResult = binarySearch(node2, offset, false); + if (searchResult) { + return findLeafNodeAtOffset(searchResult, offset); + } + } + return void 0; + } + function findLeafNodeBeforeOffset(node2, offset) { + if (isLeafCstNode(node2)) { + return node2; + } else if (isCompositeCstNode(node2)) { + const searchResult = binarySearch(node2, offset, true); + if (searchResult) { + return findLeafNodeBeforeOffset(searchResult, offset); + } + } + return void 0; + } + function binarySearch(node2, offset, closest) { + let left3 = 0; + let right3 = node2.content.length - 1; + let closestNode = void 0; + while (left3 <= right3) { + const middle = Math.floor((left3 + right3) / 2); + const middleNode = node2.content[middle]; + if (middleNode.offset <= offset && middleNode.end > offset) { + return middleNode; + } + if (middleNode.end <= offset) { + closestNode = closest ? middleNode : void 0; + left3 = middle + 1; + } else { + right3 = middle - 1; + } + } + return closestNode; + } + function getPreviousNode(node2, hidden = true) { + while (node2.container) { + const parent4 = node2.container; + let index = parent4.content.indexOf(node2); + while (index > 0) { + index--; + const previous = parent4.content[index]; + if (hidden || !previous.hidden) { + return previous; + } + } + node2 = parent4; + } + return void 0; + } + function getNextNode(node2, hidden = true) { + while (node2.container) { + const parent4 = node2.container; + let index = parent4.content.indexOf(node2); + const last22 = parent4.content.length - 1; + while (index < last22) { + index++; + const next3 = parent4.content[index]; + if (hidden || !next3.hidden) { + return next3; + } + } + node2 = parent4; + } + return void 0; + } + function getStartlineNode(node2) { + if (node2.range.start.character === 0) { + return node2; + } + const line2 = node2.range.start.line; + let last22 = node2; + let index; + while (node2.container) { + const parent4 = node2.container; + const selfIndex = index ?? parent4.content.indexOf(node2); + if (selfIndex === 0) { + node2 = parent4; + index = void 0; + } else { + index = selfIndex - 1; + node2 = parent4.content[index]; + } + if (node2.range.start.line !== line2) { + break; + } + last22 = node2; + } + return last22; + } + function getInteriorNodes(start3, end2) { + const commonParent = getCommonParent(start3, end2); + if (!commonParent) { + return []; + } + return commonParent.parent.content.slice(commonParent.a + 1, commonParent.b); + } + function getCommonParent(a2, b3) { + const aParents = getParentChain(a2); + const bParents = getParentChain(b3); + let current; + for (let i2 = 0; i2 < aParents.length && i2 < bParents.length; i2++) { + const aParent = aParents[i2]; + const bParent = bParents[i2]; + if (aParent.parent === bParent.parent) { + current = { + parent: aParent.parent, + a: aParent.index, + b: bParent.index + }; + } else { + break; + } + } + return current; + } + function getParentChain(node2) { + const chain = []; + while (node2.container) { + const parent4 = node2.container; + const index = parent4.content.indexOf(node2); + chain.push({ + parent: parent4, + index + }); + node2 = parent4; + } + return chain.reverse(); + } + function assertUnreachable(_3, message = "Error: Got unexpected value.") { + throw new Error(message); + } + function assertCondition(condition, message = "Error: Condition is violated.") { + if (!condition) { + throw new Error(message); + } + } + function cc(char2) { + return char2.charCodeAt(0); + } + function insertToSet(item, set5) { + if (Array.isArray(item)) { + item.forEach(function(subItem) { + set5.push(subItem); + }); + } else { + set5.push(item); + } + } + function addFlag(flagObj, flagKey) { + if (flagObj[flagKey] === true) { + throw "duplicate flag " + flagKey; + } + const x5 = flagObj[flagKey]; + flagObj[flagKey] = true; + } + function ASSERT_EXISTS(obj) { + if (obj === void 0) { + throw Error("Internal Error - Should never get here!"); + } + return true; + } + function ASSERT_NEVER_REACH_HERE() { + throw Error("Internal Error - Should never get here!"); + } + function isCharacter(obj) { + return obj["type"] === "Character"; + } + function getTerminalParts(regexp) { + try { + if (typeof regexp !== "string") { + regexp = regexp.source; + } + regexp = `/${regexp}/`; + const pattern = regexpParser.pattern(regexp); + const parts = []; + for (const alternative of pattern.value.value) { + visitor.reset(regexp); + visitor.visit(alternative); + parts.push({ + start: visitor.startRegexp, + end: visitor.endRegex + }); + } + return parts; + } catch { + return []; + } + } + function isMultilineComment(regexp) { + try { + if (typeof regexp === "string") { + regexp = new RegExp(regexp); + } + regexp = regexp.toString(); + visitor.reset(regexp); + visitor.visit(regexpParser.pattern(regexp)); + return visitor.multiline; + } catch { + return false; + } + } + function isWhitespace2(value2) { + const regexp = typeof value2 === "string" ? new RegExp(value2) : value2; + return whitespaceCharacters.some((ws) => regexp.test(ws)); + } + function escapeRegExp(value2) { + return value2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + } + function partialMatches(regex2, input) { + const partial = partialRegExp(regex2); + const match3 = input.match(partial); + return !!match3 && match3[0].length > 0; + } + function partialRegExp(regex2) { + if (typeof regex2 === "string") { + regex2 = new RegExp(regex2); + } + const re3 = regex2, source = regex2.source; + let i2 = 0; + function process2() { + let result = "", tmp; + function appendRaw(nbChars) { + result += source.substr(i2, nbChars); + i2 += nbChars; + } + __name(appendRaw, "appendRaw"); + __name2(appendRaw, "appendRaw"); + function appendOptional(nbChars) { + result += "(?:" + source.substr(i2, nbChars) + "|$)"; + i2 += nbChars; + } + __name(appendOptional, "appendOptional"); + __name2(appendOptional, "appendOptional"); + while (i2 < source.length) { + switch (source[i2]) { + case "\\": + switch (source[i2 + 1]) { + case "c": + appendOptional(3); + break; + case "x": + appendOptional(4); + break; + case "u": + if (re3.unicode) { + if (source[i2 + 2] === "{") { + appendOptional(source.indexOf("}", i2) - i2 + 1); + } else { + appendOptional(6); + } + } else { + appendOptional(2); + } + break; + case "p": + case "P": + if (re3.unicode) { + appendOptional(source.indexOf("}", i2) - i2 + 1); + } else { + appendOptional(2); + } + break; + case "k": + appendOptional(source.indexOf(">", i2) - i2 + 1); + break; + default: + appendOptional(2); + break; + } + break; + case "[": + tmp = /\[(?:\\.|.)*?\]/g; + tmp.lastIndex = i2; + tmp = tmp.exec(source) || []; + appendOptional(tmp[0].length); + break; + case "|": + case "^": + case "$": + case "*": + case "+": + case "?": + appendRaw(1); + break; + case "{": + tmp = /\{\d+,?\d*\}/g; + tmp.lastIndex = i2; + tmp = tmp.exec(source); + if (tmp) { + appendRaw(tmp[0].length); + } else { + appendOptional(1); + } + break; + case "(": + if (source[i2 + 1] === "?") { + switch (source[i2 + 2]) { + case ":": + result += "(?:"; + i2 += 3; + result += process2() + "|$)"; + break; + case "=": + result += "(?="; + i2 += 3; + result += process2() + ")"; + break; + case "!": + tmp = i2; + i2 += 3; + process2(); + result += source.substr(tmp, i2 - tmp); + break; + case "<": + switch (source[i2 + 3]) { + case "=": + case "!": + tmp = i2; + i2 += 4; + process2(); + result += source.substr(tmp, i2 - tmp); + break; + default: + appendRaw(source.indexOf(">", i2) - i2 + 1); + result += process2() + "|$)"; + break; + } + break; + } + } else { + appendRaw(1); + result += process2() + "|$)"; + } + break; + case ")": + ++i2; + return result; + default: + appendOptional(1); + break; + } + } + return result; + } + __name(process2, "process2"); + __name2(process2, "process"); + return new RegExp(process2(), regex2.flags); + } + function getEntryRule(grammar) { + return grammar.rules.find((e3) => isParserRule(e3) && e3.entry); + } + function getHiddenRules(grammar) { + return grammar.rules.filter((e3) => isTerminalRule(e3) && e3.hidden); + } + function getAllReachableRules(grammar, allTerminals) { + const ruleNames = /* @__PURE__ */ new Set(); + const entryRule = getEntryRule(grammar); + if (!entryRule) { + return new Set(grammar.rules); + } + const topMostRules = [entryRule].concat(getHiddenRules(grammar)); + for (const rule of topMostRules) { + ruleDfs(rule, ruleNames, allTerminals); + } + const rules = /* @__PURE__ */ new Set(); + for (const rule of grammar.rules) { + if (ruleNames.has(rule.name) || isTerminalRule(rule) && rule.hidden) { + rules.add(rule); + } + } + return rules; + } + function ruleDfs(rule, visitedSet, allTerminals) { + visitedSet.add(rule.name); + streamAllContents(rule).forEach((node2) => { + if (isRuleCall(node2) || allTerminals && isTerminalRuleCall(node2)) { + const refRule = node2.rule.ref; + if (refRule && !visitedSet.has(refRule.name)) { + ruleDfs(refRule, visitedSet, allTerminals); + } + } + }); + } + function getAllRulesUsedForCrossReferences(grammar) { + const result = /* @__PURE__ */ new Set(); + streamAllContents(grammar).forEach((node2) => { + if (isCrossReference(node2)) { + if (isParserRule(node2.type.ref)) { + result.add(node2.type.ref); + } + if (isInferredType(node2.type.ref) && isParserRule(node2.type.ref.$container)) { + result.add(node2.type.ref.$container); + } + } + }); + return result; + } + function getCrossReferenceTerminal(crossRef) { + if (crossRef.terminal) { + return crossRef.terminal; + } else if (crossRef.type.ref) { + const nameAssigment = findNameAssignment(crossRef.type.ref); + return nameAssigment?.terminal; + } + return void 0; + } + function isCommentTerminal(terminalRule) { + return terminalRule.hidden && !isWhitespace2(terminalRegex(terminalRule)); + } + function findNodesForProperty(node2, property3) { + if (!node2 || !property3) { + return []; + } + return findNodesForPropertyInternal(node2, property3, node2.astNode, true); + } + function findNodeForProperty(node2, property3, index) { + if (!node2 || !property3) { + return void 0; + } + const nodes5 = findNodesForPropertyInternal(node2, property3, node2.astNode, true); + if (nodes5.length === 0) { + return void 0; + } + if (index !== void 0) { + index = Math.max(0, Math.min(index, nodes5.length - 1)); + } else { + index = 0; + } + return nodes5[index]; + } + function findNodesForPropertyInternal(node2, property3, element3, first22) { + if (!first22) { + const nodeFeature = getContainerOfType(node2.grammarSource, isAssignment); + if (nodeFeature && nodeFeature.feature === property3) { + return [node2]; + } + } + if (isCompositeCstNode(node2) && node2.astNode === element3) { + return node2.content.flatMap((e3) => findNodesForPropertyInternal(e3, property3, element3, false)); + } + return []; + } + function findNodesForKeyword(node2, keyword) { + if (!node2) { + return []; + } + return findNodesForKeywordInternal(node2, keyword, node2?.astNode); + } + function findNodeForKeyword(node2, keyword, index) { + if (!node2) { + return void 0; + } + const nodes5 = findNodesForKeywordInternal(node2, keyword, node2?.astNode); + if (nodes5.length === 0) { + return void 0; + } + if (index !== void 0) { + index = Math.max(0, Math.min(index, nodes5.length - 1)); + } else { + index = 0; + } + return nodes5[index]; + } + function findNodesForKeywordInternal(node2, keyword, element3) { + if (node2.astNode !== element3) { + return []; + } + if (isKeyword(node2.grammarSource) && node2.grammarSource.value === keyword) { + return [node2]; + } + const treeIterator = streamCst(node2).iterator(); + let result; + const keywordNodes = []; + do { + result = treeIterator.next(); + if (!result.done) { + const childNode = result.value; + if (childNode.astNode === element3) { + if (isKeyword(childNode.grammarSource) && childNode.grammarSource.value === keyword) { + keywordNodes.push(childNode); + } + } else { + treeIterator.prune(); + } + } + } while (!result.done); + return keywordNodes; + } + function findAssignment(cstNode) { + const astNode = cstNode.astNode; + while (astNode === cstNode.container?.astNode) { + const assignment = getContainerOfType(cstNode.grammarSource, isAssignment); + if (assignment) { + return assignment; + } + cstNode = cstNode.container; + } + return void 0; + } + function findNameAssignment(type3) { + let startNode = type3; + if (isInferredType(startNode)) { + if (isAction(startNode.$container)) { + startNode = startNode.$container.$container; + } else if (isAbstractParserRule(startNode.$container)) { + startNode = startNode.$container; + } else { + assertUnreachable(startNode.$container); + } + } + return findNameAssignmentInternal(type3, startNode, /* @__PURE__ */ new Map()); + } + function findNameAssignmentInternal(type3, startNode, cache3) { + function go(node2, refType) { + let childAssignment = void 0; + const parentAssignment = getContainerOfType(node2, isAssignment); + if (!parentAssignment) { + childAssignment = findNameAssignmentInternal(refType, refType, cache3); + } + cache3.set(type3, childAssignment); + return childAssignment; + } + __name(go, "go"); + __name2(go, "go"); + if (cache3.has(type3)) { + return cache3.get(type3); + } + cache3.set(type3, void 0); + for (const node2 of streamAllContents(startNode)) { + if (isAssignment(node2) && node2.feature.toLowerCase() === "name") { + cache3.set(type3, node2); + return node2; + } else if (isRuleCall(node2) && isParserRule(node2.rule.ref)) { + return go(node2, node2.rule.ref); + } else if (isSimpleType(node2) && node2.typeRef?.ref) { + return go(node2, node2.typeRef.ref); + } + } + return void 0; + } + function getActionAtElement(element3) { + const parent4 = element3.$container; + if (isGroup(parent4)) { + const elements2 = parent4.elements; + const index = elements2.indexOf(element3); + for (let i2 = index - 1; i2 >= 0; i2--) { + const item = elements2[i2]; + if (isAction(item)) { + return item; + } else { + const action = streamAllContents(elements2[i2]).find(isAction); + if (action) { + return action; + } + } + } + } + if (isAbstractElement(parent4)) { + return getActionAtElement(parent4); + } else { + return void 0; + } + } + function isOptionalCardinality(cardinality, element3) { + return cardinality === "?" || cardinality === "*" || isGroup(element3) && Boolean(element3.guardCondition); + } + function isArrayCardinality(cardinality) { + return cardinality === "*" || cardinality === "+"; + } + function isArrayOperator(operator) { + return operator === "+="; + } + function isDataTypeRule(rule) { + return isDataTypeRuleInternal(rule, /* @__PURE__ */ new Set()); + } + function isDataTypeRuleInternal(rule, visited) { + if (visited.has(rule)) { + return true; + } else { + visited.add(rule); + } + for (const node2 of streamAllContents(rule)) { + if (isRuleCall(node2)) { + if (!node2.rule.ref) { + return false; + } + if (isParserRule(node2.rule.ref) && !isDataTypeRuleInternal(node2.rule.ref, visited)) { + return false; + } + if (isInfixRule(node2.rule.ref)) { + return false; + } + } else if (isAssignment(node2)) { + return false; + } else if (isAction(node2)) { + return false; + } + } + return Boolean(rule.definition); + } + function isDataType(type3) { + return isDataTypeInternal(type3.type, /* @__PURE__ */ new Set()); + } + function isDataTypeInternal(type3, visited) { + if (visited.has(type3)) { + return true; + } else { + visited.add(type3); + } + if (isArrayType(type3)) { + return false; + } else if (isReferenceType(type3)) { + return false; + } else if (isUnionType(type3)) { + return type3.types.every((e3) => isDataTypeInternal(e3, visited)); + } else if (isSimpleType(type3)) { + if (type3.primitiveType !== void 0) { + return true; + } else if (type3.stringType !== void 0) { + return true; + } else if (type3.typeRef !== void 0) { + const ref = type3.typeRef.ref; + if (isType(ref)) { + return isDataTypeInternal(ref.type, visited); + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + function getExplicitRuleType(rule) { + if (isTerminalRule(rule)) { + return void 0; + } + if (rule.inferredType) { + return rule.inferredType.name; + } else if (rule.dataType) { + return rule.dataType; + } else if (rule.returnType) { + const refType = rule.returnType.ref; + if (refType) { + return refType.name; + } + } + return void 0; + } + function getTypeName(type3) { + if (isAbstractParserRule(type3)) { + return isParserRule(type3) && isDataTypeRule(type3) ? type3.name : getExplicitRuleType(type3) ?? type3.name; + } else if (isInterface(type3) || isType(type3) || isReturnType(type3)) { + return type3.name; + } else if (isAction(type3)) { + const actionType = getActionType(type3); + if (actionType) { + return actionType; + } + } else if (isInferredType(type3)) { + return type3.name; + } + throw new Error("Cannot get name of Unknown Type"); + } + function getActionType(action) { + if (action.inferredType) { + return action.inferredType.name; + } else if (action.type?.ref) { + return getTypeName(action.type.ref); + } + return void 0; + } + function getRuleTypeName(rule) { + if (isTerminalRule(rule)) { + return rule.type?.name ?? "string"; + } else { + return isParserRule(rule) && isDataTypeRule(rule) ? rule.name : getExplicitRuleType(rule) ?? rule.name; + } + } + function getRuleType(rule) { + if (isTerminalRule(rule)) { + return rule.type?.name ?? "string"; + } else { + return getExplicitRuleType(rule) ?? rule.name; + } + } + function terminalRegex(terminalRule) { + const flags = { + s: false, + i: false, + u: false + }; + const source = abstractElementToRegex(terminalRule.definition, flags); + const flagText = Object.entries(flags).filter(([, value2]) => value2).map(([name]) => name).join(""); + return new RegExp(source, flagText); + } + function abstractElementToRegex(element3, flags) { + if (isTerminalAlternatives(element3)) { + return terminalAlternativesToRegex(element3); + } else if (isTerminalGroup(element3)) { + return terminalGroupToRegex(element3); + } else if (isCharacterRange(element3)) { + return characterRangeToRegex(element3); + } else if (isTerminalRuleCall(element3)) { + const rule = element3.rule.ref; + if (!rule) { + throw new Error("Missing rule reference."); + } + return withCardinality(abstractElementToRegex(rule.definition), { + cardinality: element3.cardinality, + lookahead: element3.lookahead, + parenthesized: element3.parenthesized + }); + } else if (isNegatedToken(element3)) { + return negateTokenToRegex(element3); + } else if (isUntilToken(element3)) { + return untilTokenToRegex(element3); + } else if (isRegexToken(element3)) { + const lastSlash = element3.regex.lastIndexOf("/"); + const source = element3.regex.substring(1, lastSlash); + const regexFlags = element3.regex.substring(lastSlash + 1); + if (flags) { + flags.i = regexFlags.includes("i"); + flags.s = regexFlags.includes("s"); + flags.u = regexFlags.includes("u"); + } + return withCardinality(source, { + cardinality: element3.cardinality, + lookahead: element3.lookahead, + parenthesized: element3.parenthesized, + wrap: false + }); + } else if (isWildcard(element3)) { + return withCardinality(WILDCARD, { + cardinality: element3.cardinality, + lookahead: element3.lookahead, + parenthesized: element3.parenthesized + }); + } else { + throw new Error(`Invalid terminal element: ${element3?.$type}, ${element3?.$cstNode?.text}`); + } + } + function terminalAlternativesToRegex(alternatives) { + return withCardinality(alternatives.elements.map((e3) => abstractElementToRegex(e3)).join("|"), { + cardinality: alternatives.cardinality, + lookahead: alternatives.lookahead, + parenthesized: alternatives.parenthesized, + wrap: false + // wrapping is not required for top level alternatives, and nested alternatives are already parenthesized according to the grammar + }); + } + function terminalGroupToRegex(group2) { + return withCardinality(group2.elements.map((e3) => abstractElementToRegex(e3)).join(""), { + cardinality: group2.cardinality, + lookahead: group2.lookahead, + parenthesized: group2.parenthesized, + wrap: false + // wrapping is not required for top level group, and nested group are already parenthesized according to the grammar + }); + } + function untilTokenToRegex(until) { + return withCardinality(`${WILDCARD}*?${abstractElementToRegex(until.terminal)}`, { + cardinality: until.cardinality, + lookahead: until.lookahead, + parenthesized: until.parenthesized + }); + } + function negateTokenToRegex(negate2) { + return withCardinality(`(?!${abstractElementToRegex(negate2.terminal)})${WILDCARD}*?`, { + cardinality: negate2.cardinality, + lookahead: negate2.lookahead, + parenthesized: negate2.parenthesized + }); + } + function characterRangeToRegex(range3) { + if (range3.right) { + return withCardinality(`[${keywordToRegex(range3.left)}-${keywordToRegex(range3.right)}]`, { + cardinality: range3.cardinality, + lookahead: range3.lookahead, + parenthesized: range3.parenthesized, + wrap: false + }); + } + return withCardinality(keywordToRegex(range3.left), { + cardinality: range3.cardinality, + lookahead: range3.lookahead, + parenthesized: range3.parenthesized, + wrap: false + }); + } + function keywordToRegex(keyword) { + return escapeRegExp(keyword.value); + } + function withCardinality(regex2, options2) { + if (options2.parenthesized || options2.lookahead || options2.wrap !== false) { + const groupConfig = options2.lookahead ?? (options2.parenthesized ? "" : "?:"); + regex2 = `(${groupConfig}${regex2})`; + } + if (options2.cardinality) { + return `${regex2}${options2.cardinality}`; + } + return regex2; + } + function createGrammarConfig(services) { + const rules = []; + const grammar = services.Grammar; + for (const rule of grammar.rules) { + if (isTerminalRule(rule) && isCommentTerminal(rule) && isMultilineComment(terminalRegex(rule))) { + rules.push(rule.name); + } + } + return { + multilineCommentRules: rules, + nameRegexp: DefaultNameRegexp + }; + } + function getRawTag2(value2) { + var isOwn = hasOwnProperty17.call(value2, symToStringTag3), tag = value2[symToStringTag3]; + try { + value2[symToStringTag3] = void 0; + var unmasked = true; + } catch (e3) { + } + var result = nativeObjectToString3.call(value2); + if (unmasked) { + if (isOwn) { + value2[symToStringTag3] = tag; + } else { + delete value2[symToStringTag3]; + } + } + return result; + } + function objectToString2(value2) { + return nativeObjectToString22.call(value2); + } + function baseGetTag2(value2) { + if (value2 == null) { + return value2 === void 0 ? undefinedTag2 : nullTag2; + } + return symToStringTag22 && symToStringTag22 in Object(value2) ? getRawTag_default2(value2) : objectToString_default2(value2); + } + function isObjectLike3(value2) { + return value2 != null && typeof value2 == "object"; + } + function isSymbol2(value2) { + return typeof value2 == "symbol" || isObjectLike_default2(value2) && baseGetTag_default2(value2) == symbolTag6; + } + function arrayMap2(array4, iteratee) { + var index = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2); + while (++index < length2) { + result[index] = iteratee(array4[index], index, array4); + } + return result; + } + function baseToString2(value2) { + if (typeof value2 == "string") { + return value2; + } + if (isArray_default2(value2)) { + return arrayMap_default2(value2, baseToString2) + ""; + } + if (isSymbol_default2(value2)) { + return symbolToString2 ? symbolToString2.call(value2) : ""; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -INFINITY5 ? "-0" : result; + } + function trimmedEndIndex2(string3) { + var index = string3.length; + while (index-- && reWhitespace2.test(string3.charAt(index))) { + } + return index; + } + function baseTrim2(string3) { + return string3 ? string3.slice(0, trimmedEndIndex_default2(string3) + 1).replace(reTrimStart2, "") : string3; + } + function isObject3(value2) { + var type3 = typeof value2; + return value2 != null && (type3 == "object" || type3 == "function"); + } + function toNumber2(value2) { + if (typeof value2 == "number") { + return value2; + } + if (isSymbol_default2(value2)) { + return NAN2; + } + if (isObject_default2(value2)) { + var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2; + value2 = isObject_default2(other) ? other + "" : other; + } + if (typeof value2 != "string") { + return value2 === 0 ? value2 : +value2; + } + value2 = baseTrim_default2(value2); + var isBinary2 = reIsBinary2.test(value2); + return isBinary2 || reIsOctal2.test(value2) ? freeParseInt2(value2.slice(2), isBinary2 ? 2 : 8) : reIsBadHex2.test(value2) ? NAN2 : +value2; + } + function toFinite2(value2) { + if (!value2) { + return value2 === 0 ? value2 : 0; + } + value2 = toNumber_default2(value2); + if (value2 === INFINITY22 || value2 === -INFINITY22) { + var sign2 = value2 < 0 ? -1 : 1; + return sign2 * MAX_INTEGER2; + } + return value2 === value2 ? value2 : 0; + } + function toInteger2(value2) { + var result = toFinite_default2(value2), remainder = result % 1; + return result === result ? remainder ? result - remainder : result : 0; + } + function identity7(value2) { + return value2; + } + function isFunction2(value2) { + if (!isObject_default2(value2)) { + return false; + } + var tag = baseGetTag_default2(value2); + return tag == funcTag4 || tag == genTag3 || tag == asyncTag2 || tag == proxyTag2; + } + function isMasked2(func) { + return !!maskSrcKey2 && maskSrcKey2 in func; + } + function toSource2(func) { + if (func != null) { + try { + return funcToString4.call(func); + } catch (e3) { + } + try { + return func + ""; + } catch (e3) { + } + } + return ""; + } + function baseIsNative2(value2) { + if (!isObject_default2(value2) || isMasked_default2(value2)) { + return false; + } + var pattern = isFunction_default2(value2) ? reIsNative2 : reIsHostCtor2; + return pattern.test(toSource_default2(value2)); + } + function getValue3(object3, key) { + return object3 == null ? void 0 : object3[key]; + } + function getNative2(object3, key) { + var value2 = getValue_default2(object3, key); + return baseIsNative_default2(value2) ? value2 : void 0; + } + function apply4(func, thisArg, args) { + switch (args.length) { + case 0: + return func.call(thisArg); + case 1: + return func.call(thisArg, args[0]); + case 2: + return func.call(thisArg, args[0], args[1]); + case 3: + return func.call(thisArg, args[0], args[1], args[2]); + } + return func.apply(thisArg, args); + } + function noop7() { + } + function copyArray4(source, array4) { + var index = -1, length2 = source.length; + array4 || (array4 = Array(length2)); + while (++index < length2) { + array4[index] = source[index]; + } + return array4; + } + function shortOut2(func) { + var count2 = 0, lastCalled = 0; + return function() { + var stamp = nativeNow2(), remaining = HOT_SPAN2 - (stamp - lastCalled); + lastCalled = stamp; + if (remaining > 0) { + if (++count2 >= HOT_COUNT2) { + return arguments[0]; + } + } else { + count2 = 0; + } + return func.apply(void 0, arguments); + }; + } + function constant2(value2) { + return function() { + return value2; + }; + } + function arrayEach2(array4, iteratee) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (iteratee(array4[index], index, array4) === false) { + break; + } + } + return array4; + } + function baseFindIndex2(array4, predicate, fromIndex, fromRight) { + var length2 = array4.length, index = fromIndex + (fromRight ? 1 : -1); + while (fromRight ? index-- : ++index < length2) { + if (predicate(array4[index], index, array4)) { + return index; + } + } + return -1; + } + function baseIsNaN2(value2) { + return value2 !== value2; + } + function strictIndexOf2(array4, value2, fromIndex) { + var index = fromIndex - 1, length2 = array4.length; + while (++index < length2) { + if (array4[index] === value2) { + return index; + } + } + return -1; + } + function baseIndexOf2(array4, value2, fromIndex) { + return value2 === value2 ? strictIndexOf_default2(array4, value2, fromIndex) : baseFindIndex_default2(array4, baseIsNaN_default2, fromIndex); + } + function arrayIncludes2(array4, value2) { + var length2 = array4 == null ? 0 : array4.length; + return !!length2 && baseIndexOf_default2(array4, value2, 0) > -1; + } + function isIndex2(value2, length2) { + var type3 = typeof value2; + length2 = length2 == null ? MAX_SAFE_INTEGER3 : length2; + return !!length2 && (type3 == "number" || type3 != "symbol" && reIsUint2.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2); + } + function baseAssignValue2(object3, key, value2) { + if (key == "__proto__" && defineProperty_default2) { + defineProperty_default2(object3, key, { + "configurable": true, + "enumerable": true, + "value": value2, + "writable": true + }); + } else { + object3[key] = value2; + } + } + function eq3(value2, other) { + return value2 === other || value2 !== value2 && other !== other; + } + function assignValue2(object3, key, value2) { + var objValue = object3[key]; + if (!(hasOwnProperty32.call(object3, key) && eq_default2(objValue, value2)) || value2 === void 0 && !(key in object3)) { + baseAssignValue_default2(object3, key, value2); + } + } + function copyObject2(source, props, object3, customizer) { + var isNew = !object3; + object3 || (object3 = {}); + var index = -1, length2 = props.length; + while (++index < length2) { + var key = props[index]; + var newValue = customizer ? customizer(object3[key], source[key], key, object3, source) : void 0; + if (newValue === void 0) { + newValue = source[key]; + } + if (isNew) { + baseAssignValue_default2(object3, key, newValue); + } else { + assignValue_default2(object3, key, newValue); + } + } + return object3; + } + function overRest2(func, start3, transform8) { + start3 = nativeMax4(start3 === void 0 ? func.length - 1 : start3, 0); + return function() { + var args = arguments, index = -1, length2 = nativeMax4(args.length - start3, 0), array4 = Array(length2); + while (++index < length2) { + array4[index] = args[start3 + index]; + } + index = -1; + var otherArgs = Array(start3 + 1); + while (++index < start3) { + otherArgs[index] = args[index]; + } + otherArgs[start3] = transform8(array4); + return apply_default2(func, this, otherArgs); + }; + } + function baseRest2(func, start3) { + return setToString_default2(overRest_default2(func, start3, identity_default5), func + ""); + } + function isLength3(value2) { + return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER22; + } + function isArrayLike3(value2) { + return value2 != null && isLength_default2(value2.length) && !isFunction_default2(value2); + } + function isIterateeCall2(value2, index, object3) { + if (!isObject_default2(object3)) { + return false; + } + var type3 = typeof index; + if (type3 == "number" ? isArrayLike_default2(object3) && isIndex_default2(index, object3.length) : type3 == "string" && index in object3) { + return eq_default2(object3[index], value2); + } + return false; + } + function createAssigner2(assigner) { + return baseRest_default2(function(object3, sources) { + var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0; + customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0; + if (guard && isIterateeCall_default2(sources[0], sources[1], guard)) { + customizer = length2 < 3 ? void 0 : customizer; + length2 = 1; + } + object3 = Object(object3); + while (++index < length2) { + var source = sources[index]; + if (source) { + assigner(object3, source, index, customizer); + } + } + return object3; + }); + } + function isPrototype3(value2) { + var Ctor = value2 && value2.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto52; + return value2 === proto; + } + function baseTimes2(n2, iteratee) { + var index = -1, result = Array(n2); + while (++index < n2) { + result[index] = iteratee(index); + } + return result; + } + function baseIsArguments2(value2) { + return isObjectLike_default2(value2) && baseGetTag_default2(value2) == argsTag5; + } + function stubFalse2() { + return false; + } + function baseIsTypedArray2(value2) { + return isObjectLike_default2(value2) && isLength_default2(value2.length) && !!typedArrayTags2[baseGetTag_default2(value2)]; + } + function baseUnary2(func) { + return function(value2) { + return func(value2); + }; + } + function arrayLikeKeys2(value2, inherited) { + var isArr = isArray_default2(value2), isArg = !isArr && isArguments_default2(value2), isBuff = !isArr && !isArg && isBuffer_default2(value2), isType2 = !isArr && !isArg && !isBuff && isTypedArray_default2(value2), skipIndexes = isArr || isArg || isBuff || isType2, result = skipIndexes ? baseTimes_default2(value2.length, String) : [], length2 = result.length; + for (var key in value2) { + if ((inherited || hasOwnProperty52.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. + (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType2 && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. + isIndex_default2(key, length2)))) { + result.push(key); + } + } + return result; + } + function overArg2(func, transform8) { + return function(arg) { + return func(transform8(arg)); + }; + } + function baseKeys2(object3) { + if (!isPrototype_default2(object3)) { + return nativeKeys_default2(object3); + } + var result = []; + for (var key in Object(object3)) { + if (hasOwnProperty62.call(object3, key) && key != "constructor") { + result.push(key); + } + } + return result; + } + function keys2(object3) { + return isArrayLike_default2(object3) ? arrayLikeKeys_default2(object3) : baseKeys_default2(object3); + } + function nativeKeysIn2(object3) { + var result = []; + if (object3 != null) { + for (var key in Object(object3)) { + result.push(key); + } + } + return result; + } + function baseKeysIn2(object3) { + if (!isObject_default2(object3)) { + return nativeKeysIn_default2(object3); + } + var isProto = isPrototype_default2(object3), result = []; + for (var key in object3) { + if (!(key == "constructor" && (isProto || !hasOwnProperty82.call(object3, key)))) { + result.push(key); + } + } + return result; + } + function keysIn2(object3) { + return isArrayLike_default2(object3) ? arrayLikeKeys_default2(object3, true) : baseKeysIn_default2(object3); + } + function isKey2(value2, object3) { + if (isArray_default2(value2)) { + return false; + } + var type3 = typeof value2; + if (type3 == "number" || type3 == "symbol" || type3 == "boolean" || value2 == null || isSymbol_default2(value2)) { + return true; + } + return reIsPlainProp2.test(value2) || !reIsDeepProp2.test(value2) || object3 != null && value2 in Object(object3); + } + function hashClear2() { + this.__data__ = nativeCreate_default2 ? nativeCreate_default2(null) : {}; + this.size = 0; + } + function hashDelete2(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + function hashGet2(key) { + var data5 = this.__data__; + if (nativeCreate_default2) { + var result = data5[key]; + return result === HASH_UNDEFINED4 ? void 0 : result; + } + return hasOwnProperty92.call(data5, key) ? data5[key] : void 0; + } + function hashHas2(key) { + var data5 = this.__data__; + return nativeCreate_default2 ? data5[key] !== void 0 : hasOwnProperty102.call(data5, key); + } + function hashSet2(key, value2) { + var data5 = this.__data__; + this.size += this.has(key) ? 0 : 1; + data5[key] = nativeCreate_default2 && value2 === void 0 ? HASH_UNDEFINED22 : value2; + return this; + } + function Hash2(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + function listCacheClear2() { + this.__data__ = []; + this.size = 0; + } + function assocIndexOf2(array4, key) { + var length2 = array4.length; + while (length2--) { + if (eq_default2(array4[length2][0], key)) { + return length2; + } + } + return -1; + } + function listCacheDelete2(key) { + var data5 = this.__data__, index = assocIndexOf_default2(data5, key); + if (index < 0) { + return false; + } + var lastIndex = data5.length - 1; + if (index == lastIndex) { + data5.pop(); + } else { + splice2.call(data5, index, 1); + } + --this.size; + return true; + } + function listCacheGet2(key) { + var data5 = this.__data__, index = assocIndexOf_default2(data5, key); + return index < 0 ? void 0 : data5[index][1]; + } + function listCacheHas2(key) { + return assocIndexOf_default2(this.__data__, key) > -1; + } + function listCacheSet2(key, value2) { + var data5 = this.__data__, index = assocIndexOf_default2(data5, key); + if (index < 0) { + ++this.size; + data5.push([key, value2]); + } else { + data5[index][1] = value2; + } + return this; + } + function ListCache2(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + function mapCacheClear2() { + this.size = 0; + this.__data__ = { + "hash": new Hash_default2(), + "map": new (Map_default2 || ListCache_default2)(), + "string": new Hash_default2() + }; + } + function isKeyable2(value2) { + var type3 = typeof value2; + return type3 == "string" || type3 == "number" || type3 == "symbol" || type3 == "boolean" ? value2 !== "__proto__" : value2 === null; + } + function getMapData2(map32, key) { + var data5 = map32.__data__; + return isKeyable_default2(key) ? data5[typeof key == "string" ? "string" : "hash"] : data5.map; + } + function mapCacheDelete2(key) { + var result = getMapData_default2(this, key)["delete"](key); + this.size -= result ? 1 : 0; + return result; + } + function mapCacheGet2(key) { + return getMapData_default2(this, key).get(key); + } + function mapCacheHas2(key) { + return getMapData_default2(this, key).has(key); + } + function mapCacheSet2(key, value2) { + var data5 = getMapData_default2(this, key), size4 = data5.size; + data5.set(key, value2); + this.size += data5.size == size4 ? 0 : 1; + return this; + } + function MapCache2(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + function memoize5(func, resolver3) { + if (typeof func != "function" || resolver3 != null && typeof resolver3 != "function") { + throw new TypeError(FUNC_ERROR_TEXT2); + } + var memoized = /* @__PURE__ */ __name2(function() { + var args = arguments, key = resolver3 ? resolver3.apply(this, args) : args[0], cache3 = memoized.cache; + if (cache3.has(key)) { + return cache3.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache3.set(key, result) || cache3; + return result; + }, "memoized"); + memoized.cache = new (memoize5.Cache || MapCache_default2)(); + return memoized; + } + function memoizeCapped2(func) { + var result = memoize_default2(func, function(key) { + if (cache3.size === MAX_MEMOIZE_SIZE2) { + cache3.clear(); + } + return key; + }); + var cache3 = result.cache; + return result; + } + function toString22(value2) { + return value2 == null ? "" : baseToString_default2(value2); + } + function castPath2(value2, object3) { + if (isArray_default2(value2)) { + return value2; + } + return isKey_default2(value2, object3) ? [value2] : stringToPath_default2(toString_default2(value2)); + } + function toKey2(value2) { + if (typeof value2 == "string" || isSymbol_default2(value2)) { + return value2; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -INFINITY32 ? "-0" : result; + } + function baseGet2(object3, path4) { + path4 = castPath_default2(path4, object3); + var index = 0, length2 = path4.length; + while (object3 != null && index < length2) { + object3 = object3[toKey_default2(path4[index++])]; + } + return index && index == length2 ? object3 : void 0; + } + function get5(object3, path4, defaultValue) { + var result = object3 == null ? void 0 : baseGet_default2(object3, path4); + return result === void 0 ? defaultValue : result; + } + function arrayPush3(array4, values22) { + var index = -1, length2 = values22.length, offset = array4.length; + while (++index < length2) { + array4[offset + index] = values22[index]; + } + return array4; + } + function isFlattenable2(value2) { + return isArray_default2(value2) || isArguments_default2(value2) || !!(spreadableSymbol2 && value2 && value2[spreadableSymbol2]); + } + function baseFlatten2(array4, depth, predicate, isStrict, result) { + var index = -1, length2 = array4.length; + predicate || (predicate = isFlattenable_default2); + result || (result = []); + while (++index < length2) { + var value2 = array4[index]; + if (depth > 0 && predicate(value2)) { + if (depth > 1) { + baseFlatten2(value2, depth - 1, predicate, isStrict, result); + } else { + arrayPush_default2(result, value2); + } + } else if (!isStrict) { + result[result.length] = value2; + } + } + return result; + } + function flatten2(array4) { + var length2 = array4 == null ? 0 : array4.length; + return length2 ? baseFlatten_default2(array4, 1) : []; + } + function baseSlice(array4, start3, end2) { + var index = -1, length2 = array4.length; + if (start3 < 0) { + start3 = -start3 > length2 ? 0 : length2 + start3; + } + end2 = end2 > length2 ? length2 : end2; + if (end2 < 0) { + end2 += length2; + } + length2 = start3 > end2 ? 0 : end2 - start3 >>> 0; + start3 >>>= 0; + var result = Array(length2); + while (++index < length2) { + result[index] = array4[index + start3]; + } + return result; + } + function arrayReduce2(array4, iteratee, accumulator, initAccum) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + if (initAccum && length2) { + accumulator = array4[++index]; + } + while (++index < length2) { + accumulator = iteratee(accumulator, array4[index], index, array4); + } + return accumulator; + } + function stackClear2() { + this.__data__ = new ListCache_default2(); + this.size = 0; + } + function stackDelete2(key) { + var data5 = this.__data__, result = data5["delete"](key); + this.size = data5.size; + return result; + } + function stackGet2(key) { + return this.__data__.get(key); + } + function stackHas2(key) { + return this.__data__.has(key); + } + function stackSet2(key, value2) { + var data5 = this.__data__; + if (data5 instanceof ListCache_default2) { + var pairs2 = data5.__data__; + if (!Map_default2 || pairs2.length < LARGE_ARRAY_SIZE3 - 1) { + pairs2.push([key, value2]); + this.size = ++data5.size; + return this; + } + data5 = this.__data__ = new MapCache_default2(pairs2); + } + data5.set(key, value2); + this.size = data5.size; + return this; + } + function Stack2(entries2) { + var data5 = this.__data__ = new ListCache_default2(entries2); + this.size = data5.size; + } + function baseAssign2(object3, source) { + return object3 && copyObject_default2(source, keys_default2(source), object3); + } + function baseAssignIn2(object3, source) { + return object3 && copyObject_default2(source, keysIn_default2(source), object3); + } + function cloneBuffer2(buffer, isDeep) { + if (isDeep) { + return buffer.slice(); + } + var length2 = buffer.length, result = allocUnsafe2 ? allocUnsafe2(length2) : new buffer.constructor(length2); + buffer.copy(result); + return result; + } + function arrayFilter2(array4, predicate) { + var index = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = []; + while (++index < length2) { + var value2 = array4[index]; + if (predicate(value2, index, array4)) { + result[resIndex++] = value2; + } + } + return result; + } + function stubArray2() { + return []; + } + function copySymbols2(source, object3) { + return copyObject_default2(source, getSymbols_default2(source), object3); + } + function copySymbolsIn2(source, object3) { + return copyObject_default2(source, getSymbolsIn_default2(source), object3); + } + function baseGetAllKeys2(object3, keysFunc, symbolsFunc) { + var result = keysFunc(object3); + return isArray_default2(object3) ? result : arrayPush_default2(result, symbolsFunc(object3)); + } + function getAllKeys2(object3) { + return baseGetAllKeys_default2(object3, keys_default2, getSymbols_default2); + } + function getAllKeysIn2(object3) { + return baseGetAllKeys_default2(object3, keysIn_default2, getSymbolsIn_default2); + } + function initCloneArray2(array4) { + var length2 = array4.length, result = new array4.constructor(length2); + if (length2 && typeof array4[0] == "string" && hasOwnProperty112.call(array4, "index")) { + result.index = array4.index; + result.input = array4.input; + } + return result; + } + function cloneArrayBuffer2(arrayBuffer) { + var result = new arrayBuffer.constructor(arrayBuffer.byteLength); + new Uint8Array_default2(result).set(new Uint8Array_default2(arrayBuffer)); + return result; + } + function cloneDataView2(dataView, isDeep) { + var buffer = isDeep ? cloneArrayBuffer_default2(dataView.buffer) : dataView.buffer; + return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); + } + function cloneRegExp2(regexp) { + var result = new regexp.constructor(regexp.source, reFlags2.exec(regexp)); + result.lastIndex = regexp.lastIndex; + return result; + } + function cloneSymbol2(symbol) { + return symbolValueOf3 ? Object(symbolValueOf3.call(symbol)) : {}; + } + function cloneTypedArray2(typedArray, isDeep) { + var buffer = isDeep ? cloneArrayBuffer_default2(typedArray.buffer) : typedArray.buffer; + return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); + } + function initCloneByTag2(object3, tag, isDeep) { + var Ctor = object3.constructor; + switch (tag) { + case arrayBufferTag22: + return cloneArrayBuffer_default2(object3); + case boolTag22: + case dateTag22: + return new Ctor(+object3); + case dataViewTag32: + return cloneDataView_default2(object3, isDeep); + case float32Tag22: + case float64Tag22: + case int8Tag22: + case int16Tag22: + case int32Tag22: + case uint8Tag22: + case uint8ClampedTag22: + case uint16Tag22: + case uint32Tag22: + return cloneTypedArray_default2(object3, isDeep); + case mapTag32: + return new Ctor(); + case numberTag22: + case stringTag22: + return new Ctor(object3); + case regexpTag22: + return cloneRegExp_default2(object3); + case setTag32: + return new Ctor(); + case symbolTag22: + return cloneSymbol_default2(object3); + } + } + function initCloneObject2(object3) { + return typeof object3.constructor == "function" && !isPrototype_default2(object3) ? baseCreate_default2(getPrototype_default2(object3)) : {}; + } + function baseIsMap2(value2) { + return isObjectLike_default2(value2) && getTag_default2(value2) == mapTag42; + } + function baseIsSet2(value2) { + return isObjectLike_default2(value2) && getTag_default2(value2) == setTag42; + } + function baseClone2(value2, bitmask, customizer, key, object3, stack) { + var result, isDeep = bitmask & CLONE_DEEP_FLAG3, isFlat = bitmask & CLONE_FLAT_FLAG2, isFull = bitmask & CLONE_SYMBOLS_FLAG4; + if (customizer) { + result = object3 ? customizer(value2, key, object3, stack) : customizer(value2); + } + if (result !== void 0) { + return result; + } + if (!isObject_default2(value2)) { + return value2; + } + var isArr = isArray_default2(value2); + if (isArr) { + result = initCloneArray_default2(value2); + if (!isDeep) { + return copyArray_default2(value2, result); + } + } else { + var tag = getTag_default2(value2), isFunc = tag == funcTag32 || tag == genTag22; + if (isBuffer_default2(value2)) { + return cloneBuffer_default2(value2, isDeep); + } + if (tag == objectTag32 || tag == argsTag32 || isFunc && !object3) { + result = isFlat || isFunc ? {} : initCloneObject_default2(value2); + if (!isDeep) { + return isFlat ? copySymbolsIn_default2(value2, baseAssignIn_default2(result, value2)) : copySymbols_default2(value2, baseAssign_default2(result, value2)); + } + } else { + if (!cloneableTags2[tag]) { + return object3 ? value2 : {}; + } + result = initCloneByTag_default2(value2, tag, isDeep); + } + } + stack || (stack = new Stack_default2()); + var stacked = stack.get(value2); + if (stacked) { + return stacked; + } + stack.set(value2, result); + if (isSet_default2(value2)) { + value2.forEach(function(subValue) { + result.add(baseClone2(subValue, bitmask, customizer, subValue, value2, stack)); + }); + } else if (isMap_default2(value2)) { + value2.forEach(function(subValue, key2) { + result.set(key2, baseClone2(subValue, bitmask, customizer, key2, value2, stack)); + }); + } + var keysFunc = isFull ? isFlat ? getAllKeysIn_default2 : getAllKeys_default2 : isFlat ? keysIn_default2 : keys_default2; + var props = isArr ? void 0 : keysFunc(value2); + arrayEach_default2(props || value2, function(subValue, key2) { + if (props) { + key2 = subValue; + subValue = value2[key2]; + } + assignValue_default2(result, key2, baseClone2(subValue, bitmask, customizer, key2, value2, stack)); + }); + return result; + } + function clone7(value2) { + return baseClone_default2(value2, CLONE_SYMBOLS_FLAG22); + } + function compact(array4) { + var index = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = []; + while (++index < length2) { + var value2 = array4[index]; + if (value2) { + result[resIndex++] = value2; + } + } + return result; + } + function setCacheAdd2(value2) { + this.__data__.set(value2, HASH_UNDEFINED32); + return this; + } + function setCacheHas2(value2) { + return this.__data__.has(value2); + } + function SetCache2(values22) { + var index = -1, length2 = values22 == null ? 0 : values22.length; + this.__data__ = new MapCache_default2(); + while (++index < length2) { + this.add(values22[index]); + } + } + function arraySome2(array4, predicate) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (predicate(array4[index], index, array4)) { + return true; + } + } + return false; + } + function cacheHas2(cache3, key) { + return cache3.has(key); + } + function equalArrays2(array4, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG7, arrLength = array4.length, othLength = other.length; + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + var arrStacked = stack.get(array4); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array4; + } + var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG5 ? new SetCache_default2() : void 0; + stack.set(array4, other); + stack.set(other, array4); + while (++index < arrLength) { + var arrValue = array4[index], othValue = other[index]; + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack) : customizer(arrValue, othValue, index, array4, other, stack); + } + if (compared !== void 0) { + if (compared) { + continue; + } + result = false; + break; + } + if (seen) { + if (!arraySome_default2(other, function(othValue2, othIndex) { + if (!cacheHas_default2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + result = false; + break; + } + } + stack["delete"](array4); + stack["delete"](other); + return result; + } + function mapToArray2(map32) { + var index = -1, result = Array(map32.size); + map32.forEach(function(value2, key) { + result[++index] = [key, value2]; + }); + return result; + } + function setToArray2(set5) { + var index = -1, result = Array(set5.size); + set5.forEach(function(value2) { + result[++index] = value2; + }); + return result; + } + function equalByTag2(object3, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag52: + if (object3.byteLength != other.byteLength || object3.byteOffset != other.byteOffset) { + return false; + } + object3 = object3.buffer; + other = other.buffer; + case arrayBufferTag42: + if (object3.byteLength != other.byteLength || !equalFunc(new Uint8Array_default2(object3), new Uint8Array_default2(other))) { + return false; + } + return true; + case boolTag42: + case dateTag42: + case numberTag42: + return eq_default2(+object3, +other); + case errorTag32: + return object3.name == other.name && object3.message == other.message; + case regexpTag42: + case stringTag42: + return object3 == other + ""; + case mapTag62: + var convert = mapToArray_default2; + case setTag62: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG22; + convert || (convert = setToArray_default2); + if (object3.size != other.size && !isPartial) { + return false; + } + var stacked = stack.get(object3); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG22; + stack.set(object3, other); + var result = equalArrays_default2(convert(object3), convert(other), bitmask, customizer, equalFunc, stack); + stack["delete"](object3); + return result; + case symbolTag42: + if (symbolValueOf22) { + return symbolValueOf22.call(object3) == symbolValueOf22.call(other); + } + } + return false; + } + function equalObjects2(object3, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG32, objProps = getAllKeys_default2(object3), objLength = objProps.length, othProps = getAllKeys_default2(other), othLength = othProps.length; + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty122.call(other, key))) { + return false; + } + } + var objStacked = stack.get(object3); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object3; + } + var result = true; + stack.set(object3, other); + stack.set(other, object3); + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object3[key], othValue = other[key]; + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object3, stack) : customizer(objValue, othValue, key, object3, other, stack); + } + if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result && !skipCtor) { + var objCtor = object3.constructor, othCtor = other.constructor; + if (objCtor != othCtor && ("constructor" in object3 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { + result = false; + } + } + stack["delete"](object3); + stack["delete"](other); + return result; + } + function baseIsEqualDeep2(object3, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray_default2(object3), othIsArr = isArray_default2(other), objTag = objIsArr ? arrayTag32 : getTag_default2(object3), othTag = othIsArr ? arrayTag32 : getTag_default2(other); + objTag = objTag == argsTag42 ? objectTag42 : objTag; + othTag = othTag == argsTag42 ? objectTag42 : othTag; + var objIsObj = objTag == objectTag42, othIsObj = othTag == objectTag42, isSameTag = objTag == othTag; + if (isSameTag && isBuffer_default2(object3)) { + if (!isBuffer_default2(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack_default2()); + return objIsArr || isTypedArray_default2(object3) ? equalArrays_default2(object3, other, bitmask, customizer, equalFunc, stack) : equalByTag_default2(object3, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG42)) { + var objIsWrapped = objIsObj && hasOwnProperty132.call(object3, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty132.call(other, "__wrapped__"); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object3.value() : object3, othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new Stack_default2()); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack_default2()); + return equalObjects_default2(object3, other, bitmask, customizer, equalFunc, stack); + } + function baseIsEqual2(value2, other, bitmask, customizer, stack) { + if (value2 === other) { + return true; + } + if (value2 == null || other == null || !isObjectLike_default2(value2) && !isObjectLike_default2(other)) { + return value2 !== value2 && other !== other; + } + return baseIsEqualDeep_default2(value2, other, bitmask, customizer, baseIsEqual2, stack); + } + function baseIsMatch2(object3, source, matchData, customizer) { + var index = matchData.length, length2 = index, noCustomizer = !customizer; + if (object3 == null) { + return !length2; + } + object3 = Object(object3); + while (index--) { + var data5 = matchData[index]; + if (noCustomizer && data5[2] ? data5[1] !== object3[data5[0]] : !(data5[0] in object3)) { + return false; + } + } + while (++index < length2) { + data5 = matchData[index]; + var key = data5[0], objValue = object3[key], srcValue = data5[1]; + if (noCustomizer && data5[2]) { + if (objValue === void 0 && !(key in object3)) { + return false; + } + } else { + var stack = new Stack_default2(); + if (customizer) { + var result = customizer(objValue, srcValue, key, object3, source, stack); + } + if (!(result === void 0 ? baseIsEqual_default2(srcValue, objValue, COMPARE_PARTIAL_FLAG52 | COMPARE_UNORDERED_FLAG32, customizer, stack) : result)) { + return false; + } + } + } + return true; + } + function isStrictComparable2(value2) { + return value2 === value2 && !isObject_default2(value2); + } + function getMatchData2(object3) { + var result = keys_default2(object3), length2 = result.length; + while (length2--) { + var key = result[length2], value2 = object3[key]; + result[length2] = [key, value2, isStrictComparable_default2(value2)]; + } + return result; + } + function matchesStrictComparable2(key, srcValue) { + return function(object3) { + if (object3 == null) { + return false; + } + return object3[key] === srcValue && (srcValue !== void 0 || key in Object(object3)); + }; + } + function baseMatches2(source) { + var matchData = getMatchData_default2(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable_default2(matchData[0][0], matchData[0][1]); + } + return function(object3) { + return object3 === source || baseIsMatch_default2(object3, source, matchData); + }; + } + function baseHasIn2(object3, key) { + return object3 != null && key in Object(object3); + } + function hasPath2(object3, path4, hasFunc) { + path4 = castPath_default2(path4, object3); + var index = -1, length2 = path4.length, result = false; + while (++index < length2) { + var key = toKey_default2(path4[index]); + if (!(result = object3 != null && hasFunc(object3, key))) { + break; + } + object3 = object3[key]; + } + if (result || ++index != length2) { + return result; + } + length2 = object3 == null ? 0 : object3.length; + return !!length2 && isLength_default2(length2) && isIndex_default2(key, length2) && (isArray_default2(object3) || isArguments_default2(object3)); + } + function hasIn2(object3, path4) { + return object3 != null && hasPath_default2(object3, path4, baseHasIn_default2); + } + function baseMatchesProperty2(path4, srcValue) { + if (isKey_default2(path4) && isStrictComparable_default2(srcValue)) { + return matchesStrictComparable_default2(toKey_default2(path4), srcValue); + } + return function(object3) { + var objValue = get_default2(object3, path4); + return objValue === void 0 && objValue === srcValue ? hasIn_default2(object3, path4) : baseIsEqual_default2(srcValue, objValue, COMPARE_PARTIAL_FLAG62 | COMPARE_UNORDERED_FLAG42); + }; + } + function baseProperty2(key) { + return function(object3) { + return object3 == null ? void 0 : object3[key]; + }; + } + function basePropertyDeep2(path4) { + return function(object3) { + return baseGet_default2(object3, path4); + }; + } + function property2(path4) { + return isKey_default2(path4) ? baseProperty_default2(toKey_default2(path4)) : basePropertyDeep_default2(path4); + } + function baseIteratee2(value2) { + if (typeof value2 == "function") { + return value2; + } + if (value2 == null) { + return identity_default5; + } + if (typeof value2 == "object") { + return isArray_default2(value2) ? baseMatchesProperty_default2(value2[0], value2[1]) : baseMatches_default2(value2); + } + return property_default3(value2); + } + function arrayAggregator(array4, setter, iteratee, accumulator) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + var value2 = array4[index]; + setter(accumulator, value2, iteratee(value2), array4); + } + return accumulator; + } + function createBaseFor2(fromRight) { + return function(object3, iteratee, keysFunc) { + var index = -1, iterable = Object(object3), props = keysFunc(object3), length2 = props.length; + while (length2--) { + var key = props[fromRight ? length2 : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object3; + }; + } + function baseForOwn2(object3, iteratee) { + return object3 && baseFor_default2(object3, iteratee, keys_default2); + } + function createBaseEach2(eachFunc, fromRight) { + return function(collection4, iteratee) { + if (collection4 == null) { + return collection4; + } + if (!isArrayLike_default2(collection4)) { + return eachFunc(collection4, iteratee); + } + var length2 = collection4.length, index = fromRight ? length2 : -1, iterable = Object(collection4); + while (fromRight ? index-- : ++index < length2) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection4; + }; + } + function baseAggregator(collection4, setter, iteratee, accumulator) { + baseEach_default2(collection4, function(value2, key, collection22) { + setter(accumulator, value2, iteratee(value2), collection22); + }); + return accumulator; + } + function createAggregator(setter, initializer) { + return function(collection4, iteratee) { + var func = isArray_default2(collection4) ? arrayAggregator_default : baseAggregator_default, accumulator = initializer ? initializer() : {}; + return func(collection4, setter, baseIteratee_default2(iteratee, 2), accumulator); + }; + } + function isArrayLikeObject3(value2) { + return isObjectLike_default2(value2) && isArrayLike_default2(value2); + } + function arrayIncludesWith2(array4, value2, comparator) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (comparator(value2, array4[index])) { + return true; + } + } + return false; + } + function baseDifference(array4, values22, iteratee, comparator) { + var index = -1, includes22 = arrayIncludes_default2, isCommon = true, length2 = array4.length, result = [], valuesLength = values22.length; + if (!length2) { + return result; + } + if (iteratee) { + values22 = arrayMap_default2(values22, baseUnary_default2(iteratee)); + } + if (comparator) { + includes22 = arrayIncludesWith_default2; + isCommon = false; + } else if (values22.length >= LARGE_ARRAY_SIZE22) { + includes22 = cacheHas_default2; + isCommon = false; + values22 = new SetCache_default2(values22); + } + outer: + while (++index < length2) { + var value2 = array4[index], computed = iteratee == null ? value2 : iteratee(value2); + value2 = comparator || value2 !== 0 ? value2 : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values22[valuesIndex] === computed) { + continue outer; + } + } + result.push(value2); + } else if (!includes22(values22, computed, comparator)) { + result.push(value2); + } + } + return result; + } + function last3(array4) { + var length2 = array4 == null ? 0 : array4.length; + return length2 ? array4[length2 - 1] : void 0; + } + function drop(array4, n2, guard) { + var length2 = array4 == null ? 0 : array4.length; + if (!length2) { + return []; + } + n2 = guard || n2 === void 0 ? 1 : toInteger_default2(n2); + return baseSlice_default(array4, n2 < 0 ? 0 : n2, length2); + } + function dropRight(array4, n2, guard) { + var length2 = array4 == null ? 0 : array4.length; + if (!length2) { + return []; + } + n2 = guard || n2 === void 0 ? 1 : toInteger_default2(n2); + n2 = length2 - n2; + return baseSlice_default(array4, 0, n2 < 0 ? 0 : n2); + } + function castFunction2(value2) { + return typeof value2 == "function" ? value2 : identity_default5; + } + function forEach3(collection4, iteratee) { + var func = isArray_default2(collection4) ? arrayEach_default2 : baseEach_default2; + return func(collection4, castFunction_default2(iteratee)); + } + function arrayEvery(array4, predicate) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (!predicate(array4[index], index, array4)) { + return false; + } + } + return true; + } + function baseEvery(collection4, predicate) { + var result = true; + baseEach_default2(collection4, function(value2, index, collection22) { + result = !!predicate(value2, index, collection22); + return result; + }); + return result; + } + function every2(collection4, predicate, guard) { + var func = isArray_default2(collection4) ? arrayEvery_default : baseEvery_default; + if (guard && isIterateeCall_default2(collection4, predicate, guard)) { + predicate = void 0; + } + return func(collection4, baseIteratee_default2(predicate, 3)); + } + function baseFilter2(collection4, predicate) { + var result = []; + baseEach_default2(collection4, function(value2, index, collection22) { + if (predicate(value2, index, collection22)) { + result.push(value2); + } + }); + return result; + } + function filter6(collection4, predicate) { + var func = isArray_default2(collection4) ? arrayFilter_default2 : baseFilter_default2; + return func(collection4, baseIteratee_default2(predicate, 3)); + } + function createFind2(findIndexFunc) { + return function(collection4, predicate, fromIndex) { + var iterable = Object(collection4); + if (!isArrayLike_default2(collection4)) { + var iteratee = baseIteratee_default2(predicate, 3); + collection4 = keys_default2(collection4); + predicate = /* @__PURE__ */ __name2(function(key) { + return iteratee(iterable[key], key, iterable); + }, "predicate"); + } + var index = findIndexFunc(collection4, predicate, fromIndex); + return index > -1 ? iterable[iteratee ? collection4[index] : index] : void 0; + }; + } + function findIndex2(array4, predicate, fromIndex) { + var length2 = array4 == null ? 0 : array4.length; + if (!length2) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger_default2(fromIndex); + if (index < 0) { + index = nativeMax22(length2 + index, 0); + } + return baseFindIndex_default2(array4, baseIteratee_default2(predicate, 3), index); + } + function head(array4) { + return array4 && array4.length ? array4[0] : void 0; + } + function baseMap2(collection4, iteratee) { + var index = -1, result = isArrayLike_default2(collection4) ? Array(collection4.length) : []; + baseEach_default2(collection4, function(value2, key, collection22) { + result[++index] = iteratee(value2, key, collection22); + }); + return result; + } + function map5(collection4, iteratee) { + var func = isArray_default2(collection4) ? arrayMap_default2 : baseMap_default2; + return func(collection4, baseIteratee_default2(iteratee, 3)); + } + function flatMap(collection4, iteratee) { + return baseFlatten_default2(map_default2(collection4, iteratee), 1); + } + function baseHas2(object3, key) { + return object3 != null && hasOwnProperty162.call(object3, key); + } + function has2(object3, path4) { + return object3 != null && hasPath_default2(object3, path4, baseHas_default2); + } + function isString2(value2) { + return typeof value2 == "string" || !isArray_default2(value2) && isObjectLike_default2(value2) && baseGetTag_default2(value2) == stringTag52; + } + function baseValues2(object3, props) { + return arrayMap_default2(props, function(key) { + return object3[key]; + }); + } + function values2(object3) { + return object3 == null ? [] : baseValues_default2(object3, keys_default2(object3)); + } + function includes(collection4, value2, fromIndex, guard) { + collection4 = isArrayLike_default2(collection4) ? collection4 : values_default2(collection4); + fromIndex = fromIndex && !guard ? toInteger_default2(fromIndex) : 0; + var length2 = collection4.length; + if (fromIndex < 0) { + fromIndex = nativeMax32(length2 + fromIndex, 0); + } + return isString_default2(collection4) ? fromIndex <= length2 && collection4.indexOf(value2, fromIndex) > -1 : !!length2 && baseIndexOf_default2(collection4, value2, fromIndex) > -1; + } + function indexOf(array4, value2, fromIndex) { + var length2 = array4 == null ? 0 : array4.length; + if (!length2) { + return -1; + } + var index = fromIndex == null ? 0 : toInteger_default2(fromIndex); + if (index < 0) { + index = nativeMax42(length2 + index, 0); + } + return baseIndexOf_default2(array4, value2, index); + } + function isEmpty3(value2) { + if (value2 == null) { + return true; + } + if (isArrayLike_default2(value2) && (isArray_default2(value2) || typeof value2 == "string" || typeof value2.splice == "function" || isBuffer_default2(value2) || isTypedArray_default2(value2) || isArguments_default2(value2))) { + return !value2.length; + } + var tag = getTag_default2(value2); + if (tag == mapTag72 || tag == setTag72) { + return !value2.size; + } + if (isPrototype_default2(value2)) { + return !baseKeys_default2(value2).length; + } + for (var key in value2) { + if (hasOwnProperty172.call(value2, key)) { + return false; + } + } + return true; + } + function baseIsRegExp(value2) { + return isObjectLike_default2(value2) && baseGetTag_default2(value2) == regexpTag52; + } + function isUndefined2(value2) { + return value2 === void 0; + } + function negate(predicate) { + if (typeof predicate != "function") { + throw new TypeError(FUNC_ERROR_TEXT22); + } + return function() { + var args = arguments; + switch (args.length) { + case 0: + return !predicate.call(this); + case 1: + return !predicate.call(this, args[0]); + case 2: + return !predicate.call(this, args[0], args[1]); + case 3: + return !predicate.call(this, args[0], args[1], args[2]); + } + return !predicate.apply(this, args); + }; + } + function baseSet2(object3, path4, value2, customizer) { + if (!isObject_default2(object3)) { + return object3; + } + path4 = castPath_default2(path4, object3); + var index = -1, length2 = path4.length, lastIndex = length2 - 1, nested = object3; + while (nested != null && ++index < length2) { + var key = toKey_default2(path4[index]), newValue = value2; + if (key === "__proto__" || key === "constructor" || key === "prototype") { + return object3; + } + if (index != lastIndex) { + var objValue = nested[key]; + newValue = customizer ? customizer(objValue, key, nested) : void 0; + if (newValue === void 0) { + newValue = isObject_default2(objValue) ? objValue : isIndex_default2(path4[index + 1]) ? [] : {}; + } + } + assignValue_default2(nested, key, newValue); + nested = nested[key]; + } + return object3; + } + function basePickBy2(object3, paths, predicate) { + var index = -1, length2 = paths.length, result = {}; + while (++index < length2) { + var path4 = paths[index], value2 = baseGet_default2(object3, path4); + if (predicate(value2, path4)) { + baseSet_default2(result, castPath_default2(path4, object3), value2); + } + } + return result; + } + function pickBy(object3, predicate) { + if (object3 == null) { + return {}; + } + var props = arrayMap_default2(getAllKeysIn_default2(object3), function(prop) { + return [prop]; + }); + predicate = baseIteratee_default2(predicate); + return basePickBy_default2(object3, props, function(value2, path4) { + return predicate(value2, path4[0]); + }); + } + function baseReduce2(collection4, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection4, function(value2, index, collection22) { + accumulator = initAccum ? (initAccum = false, value2) : iteratee(accumulator, value2, index, collection22); + }); + return accumulator; + } + function reduce3(collection4, iteratee, accumulator) { + var func = isArray_default2(collection4) ? arrayReduce_default2 : baseReduce_default2, initAccum = arguments.length < 3; + return func(collection4, baseIteratee_default2(iteratee, 4), accumulator, initAccum, baseEach_default2); + } + function reject2(collection4, predicate) { + var func = isArray_default2(collection4) ? arrayFilter_default2 : baseFilter_default2; + return func(collection4, negate_default(baseIteratee_default2(predicate, 3))); + } + function baseSome(collection4, predicate) { + var result; + baseEach_default2(collection4, function(value2, index, collection22) { + result = predicate(value2, index, collection22); + return !result; + }); + return !!result; + } + function some2(collection4, predicate, guard) { + var func = isArray_default2(collection4) ? arraySome_default2 : baseSome_default; + if (guard && isIterateeCall_default2(collection4, predicate, guard)) { + predicate = void 0; + } + return func(collection4, baseIteratee_default2(predicate, 3)); + } + function baseUniq2(array4, iteratee, comparator) { + var index = -1, includes22 = arrayIncludes_default2, length2 = array4.length, isCommon = true, result = [], seen = result; + if (comparator) { + isCommon = false; + includes22 = arrayIncludesWith_default2; + } else if (length2 >= LARGE_ARRAY_SIZE32) { + var set5 = iteratee ? null : createSet_default2(array4); + if (set5) { + return setToArray_default2(set5); + } + isCommon = false; + includes22 = cacheHas_default2; + seen = new SetCache_default2(); + } else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length2) { + var value2 = array4[index], computed = iteratee ? iteratee(value2) : value2; + value2 = comparator || value2 !== 0 ? value2 : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value2); + } else if (!includes22(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value2); + } + } + return result; + } + function uniq(array4) { + return array4 && array4.length ? baseUniq_default2(array4) : []; + } + function PRINT_ERROR(msg) { + if (console && console.error) { + console.error(`Error: ${msg}`); + } + } + function PRINT_WARNING(msg) { + if (console && console.warn) { + console.warn(`Warning: ${msg}`); + } + } + function timer2(func) { + const start3 = (/* @__PURE__ */ new Date()).getTime(); + const val = func(); + const end2 = (/* @__PURE__ */ new Date()).getTime(); + const total = end2 - start3; + return { time: total, value: val }; + } + function toFastProperties(toBecomeFast) { + function FakeConstructor() { + } + __name(FakeConstructor, "FakeConstructor"); + __name2(FakeConstructor, "FakeConstructor"); + FakeConstructor.prototype = toBecomeFast; + const fakeInstance = new FakeConstructor(); + function fakeAccess() { + return typeof fakeInstance.bar; + } + __name(fakeAccess, "fakeAccess"); + __name2(fakeAccess, "fakeAccess"); + fakeAccess(); + fakeAccess(); + if (1) + return toBecomeFast; + (0, eval)(toBecomeFast); + } + function tokenLabel(tokType) { + if (hasTokenLabel(tokType)) { + return tokType.LABEL; + } else { + return tokType.name; + } + } + function hasTokenLabel(obj) { + return isString_default2(obj.LABEL) && obj.LABEL !== ""; + } + function serializeGrammar(topRules) { + return map_default2(topRules, serializeProduction); + } + function serializeProduction(node2) { + function convertDefinition(definition) { + return map_default2(definition, serializeProduction); + } + __name(convertDefinition, "convertDefinition"); + __name2(convertDefinition, "convertDefinition"); + if (node2 instanceof NonTerminal) { + const serializedNonTerminal = { + type: "NonTerminal", + name: node2.nonTerminalName, + idx: node2.idx + }; + if (isString_default2(node2.label)) { + serializedNonTerminal.label = node2.label; + } + return serializedNonTerminal; + } else if (node2 instanceof Alternative) { + return { + type: "Alternative", + definition: convertDefinition(node2.definition) + }; + } else if (node2 instanceof Option2) { + return { + type: "Option", + idx: node2.idx, + definition: convertDefinition(node2.definition) + }; + } else if (node2 instanceof RepetitionMandatory) { + return { + type: "RepetitionMandatory", + idx: node2.idx, + definition: convertDefinition(node2.definition) + }; + } else if (node2 instanceof RepetitionMandatoryWithSeparator) { + return { + type: "RepetitionMandatoryWithSeparator", + idx: node2.idx, + separator: serializeProduction(new Terminal({ terminalType: node2.separator })), + definition: convertDefinition(node2.definition) + }; + } else if (node2 instanceof RepetitionWithSeparator) { + return { + type: "RepetitionWithSeparator", + idx: node2.idx, + separator: serializeProduction(new Terminal({ terminalType: node2.separator })), + definition: convertDefinition(node2.definition) + }; + } else if (node2 instanceof Repetition) { + return { + type: "Repetition", + idx: node2.idx, + definition: convertDefinition(node2.definition) + }; + } else if (node2 instanceof Alternation) { + return { + type: "Alternation", + idx: node2.idx, + definition: convertDefinition(node2.definition) + }; + } else if (node2 instanceof Terminal) { + const serializedTerminal = { + type: "Terminal", + name: node2.terminalType.name, + label: tokenLabel(node2.terminalType), + idx: node2.idx + }; + if (isString_default2(node2.label)) { + serializedTerminal.terminalLabel = node2.label; + } + const pattern = node2.terminalType.PATTERN; + if (node2.terminalType.PATTERN) { + serializedTerminal.pattern = isRegExp_default(pattern) ? pattern.source : pattern; + } + return serializedTerminal; + } else if (node2 instanceof Rule) { + return { + type: "Rule", + name: node2.name, + orgText: node2.orgText, + definition: convertDefinition(node2.definition) + }; + } else { + throw Error("non exhaustive match"); + } + } + function isSequenceProd(prod) { + return prod instanceof Alternative || prod instanceof Option2 || prod instanceof Repetition || prod instanceof RepetitionMandatory || prod instanceof RepetitionMandatoryWithSeparator || prod instanceof RepetitionWithSeparator || prod instanceof Terminal || prod instanceof Rule; + } + function isOptionalProd(prod, alreadyVisited = []) { + const isDirectlyOptional = prod instanceof Option2 || prod instanceof Repetition || prod instanceof RepetitionWithSeparator; + if (isDirectlyOptional) { + return true; + } + if (prod instanceof Alternation) { + return some_default(prod.definition, (subProd) => { + return isOptionalProd(subProd, alreadyVisited); + }); + } else if (prod instanceof NonTerminal && includes_default(alreadyVisited, prod)) { + return false; + } else if (prod instanceof AbstractProduction) { + if (prod instanceof NonTerminal) { + alreadyVisited.push(prod); + } + return every_default(prod.definition, (subProd) => { + return isOptionalProd(subProd, alreadyVisited); + }); + } else { + return false; + } + } + function isBranchingProd(prod) { + return prod instanceof Alternation; + } + function getProductionDslName(prod) { + if (prod instanceof NonTerminal) { + return "SUBRULE"; + } else if (prod instanceof Option2) { + return "OPTION"; + } else if (prod instanceof Alternation) { + return "OR"; + } else if (prod instanceof RepetitionMandatory) { + return "AT_LEAST_ONE"; + } else if (prod instanceof RepetitionMandatoryWithSeparator) { + return "AT_LEAST_ONE_SEP"; + } else if (prod instanceof RepetitionWithSeparator) { + return "MANY_SEP"; + } else if (prod instanceof Repetition) { + return "MANY"; + } else if (prod instanceof Terminal) { + return "CONSUME"; + } else { + throw Error("non exhaustive match"); + } + } + function restForRepetitionWithSeparator(repSepProd, currRest, prevRest) { + const repSepRest = [ + new Option2({ + definition: [ + new Terminal({ terminalType: repSepProd.separator }) + ].concat(repSepProd.definition) + }) + ]; + const fullRepSepRest = repSepRest.concat(currRest, prevRest); + return fullRepSepRest; + } + function first2(prod) { + if (prod instanceof NonTerminal) { + return first2(prod.referencedRule); + } else if (prod instanceof Terminal) { + return firstForTerminal(prod); + } else if (isSequenceProd(prod)) { + return firstForSequence(prod); + } else if (isBranchingProd(prod)) { + return firstForBranching(prod); + } else { + throw Error("non exhaustive match"); + } + } + function firstForSequence(prod) { + let firstSet = []; + const seq2 = prod.definition; + let nextSubProdIdx = 0; + let hasInnerProdsRemaining = seq2.length > nextSubProdIdx; + let currSubProd; + let isLastInnerProdOptional = true; + while (hasInnerProdsRemaining && isLastInnerProdOptional) { + currSubProd = seq2[nextSubProdIdx]; + isLastInnerProdOptional = isOptionalProd(currSubProd); + firstSet = firstSet.concat(first2(currSubProd)); + nextSubProdIdx = nextSubProdIdx + 1; + hasInnerProdsRemaining = seq2.length > nextSubProdIdx; + } + return uniq_default(firstSet); + } + function firstForBranching(prod) { + const allAlternativesFirsts = map_default2(prod.definition, (innerProd) => { + return first2(innerProd); + }); + return uniq_default(flatten_default2(allAlternativesFirsts)); + } + function firstForTerminal(terminal) { + return [terminal.terminalType]; + } + function computeAllProdsFollows(topProductions) { + const reSyncFollows = {}; + forEach_default2(topProductions, (topProd) => { + const currRefsFollow = new ResyncFollowsWalker(topProd).startWalking(); + assign_default(reSyncFollows, currRefsFollow); + }); + return reSyncFollows; + } + function buildBetweenProdsFollowPrefix(inner2, occurenceInParent) { + return inner2.name + occurenceInParent + IN; + } + function getRegExpAst(regExp) { + const regExpStr = regExp.toString(); + if (regExpAstCache.hasOwnProperty(regExpStr)) { + return regExpAstCache[regExpStr]; + } else { + const regExpAst = regExpParser.pattern(regExpStr); + regExpAstCache[regExpStr] = regExpAst; + return regExpAst; + } + } + function clearRegExpParserCache() { + regExpAstCache = {}; + } + function getOptimizedStartCodesIndices(regExp, ensureOptimizations = false) { + try { + const ast = getRegExpAst(regExp); + const firstChars = firstCharOptimizedIndices(ast.value, {}, ast.flags.ignoreCase); + return firstChars; + } catch (e3) { + if (e3.message === complementErrorMessage) { + if (ensureOptimizations) { + PRINT_WARNING(`${failedOptimizationPrefixMsg} Unable to optimize: < ${regExp.toString()} > + Complement Sets cannot be automatically optimized. + This will disable the lexer's first char optimizations. + See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`); + } + } else { + let msgSuffix = ""; + if (ensureOptimizations) { + msgSuffix = "\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."; + } + PRINT_ERROR(`${failedOptimizationPrefixMsg} + Failed parsing: < ${regExp.toString()} > + Using the @chevrotain/regexp-to-ast library + Please open an issue at: https://github.com/chevrotain/chevrotain/issues` + msgSuffix); + } + } + return []; + } + function firstCharOptimizedIndices(ast, result, ignoreCase) { + switch (ast.type) { + case "Disjunction": + for (let i2 = 0; i2 < ast.value.length; i2++) { + firstCharOptimizedIndices(ast.value[i2], result, ignoreCase); + } + break; + case "Alternative": + const terms = ast.value; + for (let i2 = 0; i2 < terms.length; i2++) { + const term = terms[i2]; + switch (term.type) { + case "EndAnchor": + // A group back reference cannot affect potential starting char. + // because if a back reference is the first production than automatically + // the group being referenced has had to come BEFORE so its codes have already been added + case "GroupBackReference": + // assertions do not affect potential starting codes + case "Lookahead": + case "NegativeLookahead": + case "Lookbehind": + case "NegativeLookbehind": + case "StartAnchor": + case "WordBoundary": + case "NonWordBoundary": + continue; + } + const atom2 = term; + switch (atom2.type) { + case "Character": + addOptimizedIdxToResult(atom2.value, result, ignoreCase); + break; + case "Set": + if (atom2.complement === true) { + throw Error(complementErrorMessage); + } + forEach_default2(atom2.value, (code) => { + if (typeof code === "number") { + addOptimizedIdxToResult(code, result, ignoreCase); + } else { + const range3 = code; + if (ignoreCase === true) { + for (let rangeCode = range3.from; rangeCode <= range3.to; rangeCode++) { + addOptimizedIdxToResult(rangeCode, result, ignoreCase); + } + } else { + for (let rangeCode = range3.from; rangeCode <= range3.to && rangeCode < minOptimizationVal; rangeCode++) { + addOptimizedIdxToResult(rangeCode, result, ignoreCase); + } + if (range3.to >= minOptimizationVal) { + const minUnOptVal = range3.from >= minOptimizationVal ? range3.from : minOptimizationVal; + const maxUnOptVal = range3.to; + const minOptIdx = charCodeToOptimizedIndex(minUnOptVal); + const maxOptIdx = charCodeToOptimizedIndex(maxUnOptVal); + for (let currOptIdx = minOptIdx; currOptIdx <= maxOptIdx; currOptIdx++) { + result[currOptIdx] = currOptIdx; + } + } + } + } + }); + break; + case "Group": + firstCharOptimizedIndices(atom2.value, result, ignoreCase); + break; + /* istanbul ignore next */ + default: + throw Error("Non Exhaustive Match"); + } + const isOptionalQuantifier = atom2.quantifier !== void 0 && atom2.quantifier.atLeast === 0; + if ( + // A group may be optional due to empty contents /(?:)/ + // or if everything inside it is optional /((a)?)/ + atom2.type === "Group" && isWholeOptional(atom2) === false || // If this term is not a group it may only be optional if it has an optional quantifier + atom2.type !== "Group" && isOptionalQuantifier === false + ) { + break; + } + } + break; + /* istanbul ignore next */ + default: + throw Error("non exhaustive match!"); + } + return values_default2(result); + } + function addOptimizedIdxToResult(code, result, ignoreCase) { + const optimizedCharIdx = charCodeToOptimizedIndex(code); + result[optimizedCharIdx] = optimizedCharIdx; + if (ignoreCase === true) { + handleIgnoreCase(code, result); + } + } + function handleIgnoreCase(code, result) { + const char2 = String.fromCharCode(code); + const upperChar = char2.toUpperCase(); + if (upperChar !== char2) { + const optimizedCharIdx = charCodeToOptimizedIndex(upperChar.charCodeAt(0)); + result[optimizedCharIdx] = optimizedCharIdx; + } else { + const lowerChar = char2.toLowerCase(); + if (lowerChar !== char2) { + const optimizedCharIdx = charCodeToOptimizedIndex(lowerChar.charCodeAt(0)); + result[optimizedCharIdx] = optimizedCharIdx; + } + } + } + function findCode(setNode, targetCharCodes) { + return find_default3(setNode.value, (codeOrRange) => { + if (typeof codeOrRange === "number") { + return includes_default(targetCharCodes, codeOrRange); + } else { + const range3 = codeOrRange; + return find_default3(targetCharCodes, (targetCode) => range3.from <= targetCode && targetCode <= range3.to) !== void 0; + } + }); + } + function isWholeOptional(ast) { + const quantifier = ast.quantifier; + if (quantifier && quantifier.atLeast === 0) { + return true; + } + if (!ast.value) { + return false; + } + return isArray_default2(ast.value) ? every_default(ast.value, isWholeOptional) : isWholeOptional(ast.value); + } + function canMatchCharCode(charCodes, pattern) { + if (pattern instanceof RegExp) { + const ast = getRegExpAst(pattern); + const charCodeFinder = new CharCodeFinder(charCodes); + charCodeFinder.visit(ast); + return charCodeFinder.found; + } else { + return find_default3(pattern, (char2) => { + return includes_default(charCodes, char2.charCodeAt(0)); + }) !== void 0; + } + } + function analyzeTokenTypes(tokenTypes, options2) { + options2 = defaults_default2(options2, { + useSticky: SUPPORT_STICKY, + debug: false, + safeMode: false, + positionTracking: "full", + lineTerminatorCharacters: ["\r", "\n"], + tracer: /* @__PURE__ */ __name2((msg, action) => action(), "tracer") + }); + const tracer = options2.tracer; + tracer("initCharCodeToOptimizedIndexMap", () => { + initCharCodeToOptimizedIndexMap(); + }); + let onlyRelevantTypes; + tracer("Reject Lexer.NA", () => { + onlyRelevantTypes = reject_default(tokenTypes, (currType) => { + return currType[PATTERN] === Lexer2.NA; + }); + }); + let hasCustom = false; + let allTransformedPatterns; + tracer("Transform Patterns", () => { + hasCustom = false; + allTransformedPatterns = map_default2(onlyRelevantTypes, (currType) => { + const currPattern = currType[PATTERN]; + if (isRegExp_default(currPattern)) { + const regExpSource = currPattern.source; + if (regExpSource.length === 1 && // only these regExp meta characters which can appear in a length one regExp + regExpSource !== "^" && regExpSource !== "$" && regExpSource !== "." && !currPattern.ignoreCase) { + return regExpSource; + } else if (regExpSource.length === 2 && regExpSource[0] === "\\" && // not a meta character + !includes_default([ + "d", + "D", + "s", + "S", + "t", + "r", + "n", + "t", + "0", + "c", + "b", + "B", + "f", + "v", + "w", + "W" + ], regExpSource[1])) { + return regExpSource[1]; + } else { + return options2.useSticky ? addStickyFlag(currPattern) : addStartOfInput(currPattern); + } + } else if (isFunction_default2(currPattern)) { + hasCustom = true; + return { exec: currPattern }; + } else if (typeof currPattern === "object") { + hasCustom = true; + return currPattern; + } else if (typeof currPattern === "string") { + if (currPattern.length === 1) { + return currPattern; + } else { + const escapedRegExpString = currPattern.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&"); + const wrappedRegExp = new RegExp(escapedRegExpString); + return options2.useSticky ? addStickyFlag(wrappedRegExp) : addStartOfInput(wrappedRegExp); + } + } else { + throw Error("non exhaustive match"); + } + }); + }); + let patternIdxToType; + let patternIdxToGroup; + let patternIdxToLongerAltIdxArr; + let patternIdxToPushMode; + let patternIdxToPopMode; + tracer("misc mapping", () => { + patternIdxToType = map_default2(onlyRelevantTypes, (currType) => currType.tokenTypeIdx); + patternIdxToGroup = map_default2(onlyRelevantTypes, (clazz) => { + const groupName = clazz.GROUP; + if (groupName === Lexer2.SKIPPED) { + return void 0; + } else if (isString_default2(groupName)) { + return groupName; + } else if (isUndefined_default2(groupName)) { + return false; + } else { + throw Error("non exhaustive match"); + } + }); + patternIdxToLongerAltIdxArr = map_default2(onlyRelevantTypes, (clazz) => { + const longerAltType = clazz.LONGER_ALT; + if (longerAltType) { + const longerAltIdxArr = isArray_default2(longerAltType) ? map_default2(longerAltType, (type3) => indexOf_default(onlyRelevantTypes, type3)) : [indexOf_default(onlyRelevantTypes, longerAltType)]; + return longerAltIdxArr; + } + }); + patternIdxToPushMode = map_default2(onlyRelevantTypes, (clazz) => clazz.PUSH_MODE); + patternIdxToPopMode = map_default2(onlyRelevantTypes, (clazz) => has_default2(clazz, "POP_MODE")); + }); + let patternIdxToCanLineTerminator; + tracer("Line Terminator Handling", () => { + const lineTerminatorCharCodes = getCharCodes(options2.lineTerminatorCharacters); + patternIdxToCanLineTerminator = map_default2(onlyRelevantTypes, (tokType) => false); + if (options2.positionTracking !== "onlyOffset") { + patternIdxToCanLineTerminator = map_default2(onlyRelevantTypes, (tokType) => { + if (has_default2(tokType, "LINE_BREAKS")) { + return !!tokType.LINE_BREAKS; + } else { + return checkLineBreaksIssues(tokType, lineTerminatorCharCodes) === false && canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN); + } + }); + } + }); + let patternIdxToIsCustom; + let patternIdxToShort; + let emptyGroups; + let patternIdxToConfig; + tracer("Misc Mapping #2", () => { + patternIdxToIsCustom = map_default2(onlyRelevantTypes, isCustomPattern); + patternIdxToShort = map_default2(allTransformedPatterns, isShortPattern); + emptyGroups = reduce_default2(onlyRelevantTypes, (acc, clazz) => { + const groupName = clazz.GROUP; + if (isString_default2(groupName) && !(groupName === Lexer2.SKIPPED)) { + acc[groupName] = []; + } + return acc; + }, {}); + patternIdxToConfig = map_default2(allTransformedPatterns, (x5, idx) => { + return { + pattern: allTransformedPatterns[idx], + longerAlt: patternIdxToLongerAltIdxArr[idx], + canLineTerminator: patternIdxToCanLineTerminator[idx], + isCustom: patternIdxToIsCustom[idx], + short: patternIdxToShort[idx], + group: patternIdxToGroup[idx], + push: patternIdxToPushMode[idx], + pop: patternIdxToPopMode[idx], + tokenTypeIdx: patternIdxToType[idx], + tokenType: onlyRelevantTypes[idx] + }; + }); + }); + let canBeOptimized = true; + let charCodeToPatternIdxToConfig = []; + if (!options2.safeMode) { + tracer("First Char Optimization", () => { + charCodeToPatternIdxToConfig = reduce_default2(onlyRelevantTypes, (result, currTokType, idx) => { + if (typeof currTokType.PATTERN === "string") { + const charCode = currTokType.PATTERN.charCodeAt(0); + const optimizedIdx = charCodeToOptimizedIndex(charCode); + addToMapOfArrays(result, optimizedIdx, patternIdxToConfig[idx]); + } else if (isArray_default2(currTokType.START_CHARS_HINT)) { + let lastOptimizedIdx; + forEach_default2(currTokType.START_CHARS_HINT, (charOrInt) => { + const charCode = typeof charOrInt === "string" ? charOrInt.charCodeAt(0) : charOrInt; + const currOptimizedIdx = charCodeToOptimizedIndex(charCode); + if (lastOptimizedIdx !== currOptimizedIdx) { + lastOptimizedIdx = currOptimizedIdx; + addToMapOfArrays(result, currOptimizedIdx, patternIdxToConfig[idx]); + } + }); + } else if (isRegExp_default(currTokType.PATTERN)) { + if (currTokType.PATTERN.unicode) { + canBeOptimized = false; + if (options2.ensureOptimizations) { + PRINT_ERROR(`${failedOptimizationPrefixMsg} Unable to analyze < ${currTokType.PATTERN.toString()} > pattern. + The regexp unicode flag is not currently supported by the regexp-to-ast library. + This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`); + } + } else { + const optimizedCodes = getOptimizedStartCodesIndices(currTokType.PATTERN, options2.ensureOptimizations); + if (isEmpty_default2(optimizedCodes)) { + canBeOptimized = false; + } + forEach_default2(optimizedCodes, (code) => { + addToMapOfArrays(result, code, patternIdxToConfig[idx]); + }); + } + } else { + if (options2.ensureOptimizations) { + PRINT_ERROR(`${failedOptimizationPrefixMsg} TokenType: <${currTokType.name}> is using a custom token pattern without providing parameter. + This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`); + } + canBeOptimized = false; + } + return result; + }, []); + }); + } + return { + emptyGroups, + patternIdxToConfig, + charCodeToPatternIdxToConfig, + hasCustom, + canBeOptimized + }; + } + function validatePatterns(tokenTypes, validModesNames) { + let errors = []; + const missingResult = findMissingPatterns(tokenTypes); + errors = errors.concat(missingResult.errors); + const invalidResult = findInvalidPatterns(missingResult.valid); + const validTokenTypes = invalidResult.valid; + errors = errors.concat(invalidResult.errors); + errors = errors.concat(validateRegExpPattern(validTokenTypes)); + errors = errors.concat(findInvalidGroupType(validTokenTypes)); + errors = errors.concat(findModesThatDoNotExist(validTokenTypes, validModesNames)); + errors = errors.concat(findUnreachablePatterns(validTokenTypes)); + return errors; + } + function validateRegExpPattern(tokenTypes) { + let errors = []; + const withRegExpPatterns = filter_default4(tokenTypes, (currTokType) => isRegExp_default(currTokType[PATTERN])); + errors = errors.concat(findEndOfInputAnchor(withRegExpPatterns)); + errors = errors.concat(findStartOfInputAnchor(withRegExpPatterns)); + errors = errors.concat(findUnsupportedFlags(withRegExpPatterns)); + errors = errors.concat(findDuplicatePatterns(withRegExpPatterns)); + errors = errors.concat(findEmptyMatchRegExps(withRegExpPatterns)); + return errors; + } + function findMissingPatterns(tokenTypes) { + const tokenTypesWithMissingPattern = filter_default4(tokenTypes, (currType) => { + return !has_default2(currType, PATTERN); + }); + const errors = map_default2(tokenTypesWithMissingPattern, (currType) => { + return { + message: "Token Type: ->" + currType.name + "<- missing static 'PATTERN' property", + type: LexerDefinitionErrorType.MISSING_PATTERN, + tokenTypes: [currType] + }; + }); + const valid2 = difference_default(tokenTypes, tokenTypesWithMissingPattern); + return { errors, valid: valid2 }; + } + function findInvalidPatterns(tokenTypes) { + const tokenTypesWithInvalidPattern = filter_default4(tokenTypes, (currType) => { + const pattern = currType[PATTERN]; + return !isRegExp_default(pattern) && !isFunction_default2(pattern) && !has_default2(pattern, "exec") && !isString_default2(pattern); + }); + const errors = map_default2(tokenTypesWithInvalidPattern, (currType) => { + return { + message: "Token Type: ->" + currType.name + "<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.", + type: LexerDefinitionErrorType.INVALID_PATTERN, + tokenTypes: [currType] + }; + }); + const valid2 = difference_default(tokenTypes, tokenTypesWithInvalidPattern); + return { errors, valid: valid2 }; + } + function findEndOfInputAnchor(tokenTypes) { + class EndAnchorFinder extends BaseRegExpVisitor { + static { + __name(this, "EndAnchorFinder"); + } + static { + __name2(this, "EndAnchorFinder"); + } + constructor() { + super(...arguments); + this.found = false; + } + visitEndAnchor(node2) { + this.found = true; + } + } + const invalidRegex = filter_default4(tokenTypes, (currType) => { + const pattern = currType.PATTERN; + try { + const regexpAst = getRegExpAst(pattern); + const endAnchorVisitor = new EndAnchorFinder(); + endAnchorVisitor.visit(regexpAst); + return endAnchorVisitor.found; + } catch (e3) { + return end_of_input.test(pattern.source); + } + }); + const errors = map_default2(invalidRegex, (currType) => { + return { + message: "Unexpected RegExp Anchor Error:\n Token Type: ->" + currType.name + "<- static 'PATTERN' cannot contain end of input anchor '$'\n See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.", + type: LexerDefinitionErrorType.EOI_ANCHOR_FOUND, + tokenTypes: [currType] + }; + }); + return errors; + } + function findEmptyMatchRegExps(tokenTypes) { + const matchesEmptyString = filter_default4(tokenTypes, (currType) => { + const pattern = currType.PATTERN; + return pattern.test(""); + }); + const errors = map_default2(matchesEmptyString, (currType) => { + return { + message: "Token Type: ->" + currType.name + "<- static 'PATTERN' must not match an empty string", + type: LexerDefinitionErrorType.EMPTY_MATCH_PATTERN, + tokenTypes: [currType] + }; + }); + return errors; + } + function findStartOfInputAnchor(tokenTypes) { + class StartAnchorFinder extends BaseRegExpVisitor { + static { + __name(this, "StartAnchorFinder"); + } + static { + __name2(this, "StartAnchorFinder"); + } + constructor() { + super(...arguments); + this.found = false; + } + visitStartAnchor(node2) { + this.found = true; + } + } + const invalidRegex = filter_default4(tokenTypes, (currType) => { + const pattern = currType.PATTERN; + try { + const regexpAst = getRegExpAst(pattern); + const startAnchorVisitor = new StartAnchorFinder(); + startAnchorVisitor.visit(regexpAst); + return startAnchorVisitor.found; + } catch (e3) { + return start_of_input.test(pattern.source); + } + }); + const errors = map_default2(invalidRegex, (currType) => { + return { + message: "Unexpected RegExp Anchor Error:\n Token Type: ->" + currType.name + "<- static 'PATTERN' cannot contain start of input anchor '^'\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.", + type: LexerDefinitionErrorType.SOI_ANCHOR_FOUND, + tokenTypes: [currType] + }; + }); + return errors; + } + function findUnsupportedFlags(tokenTypes) { + const invalidFlags = filter_default4(tokenTypes, (currType) => { + const pattern = currType[PATTERN]; + return pattern instanceof RegExp && (pattern.multiline || pattern.global); + }); + const errors = map_default2(invalidFlags, (currType) => { + return { + message: "Token Type: ->" + currType.name + "<- static 'PATTERN' may NOT contain global('g') or multiline('m')", + type: LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND, + tokenTypes: [currType] + }; + }); + return errors; + } + function findDuplicatePatterns(tokenTypes) { + const found = []; + let identicalPatterns = map_default2(tokenTypes, (outerType) => { + return reduce_default2(tokenTypes, (result, innerType) => { + if (outerType.PATTERN.source === innerType.PATTERN.source && !includes_default(found, innerType) && innerType.PATTERN !== Lexer2.NA) { + found.push(innerType); + result.push(innerType); + return result; + } + return result; + }, []); + }); + identicalPatterns = compact_default(identicalPatterns); + const duplicatePatterns = filter_default4(identicalPatterns, (currIdenticalSet) => { + return currIdenticalSet.length > 1; + }); + const errors = map_default2(duplicatePatterns, (setOfIdentical) => { + const tokenTypeNames = map_default2(setOfIdentical, (currType) => { + return currType.name; + }); + const dupPatternSrc = head_default(setOfIdentical).PATTERN; + return { + message: `The same RegExp pattern ->${dupPatternSrc}<-has been used in all of the following Token Types: ${tokenTypeNames.join(", ")} <-`, + type: LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND, + tokenTypes: setOfIdentical + }; + }); + return errors; + } + function findInvalidGroupType(tokenTypes) { + const invalidTypes = filter_default4(tokenTypes, (clazz) => { + if (!has_default2(clazz, "GROUP")) { + return false; + } + const group2 = clazz.GROUP; + return group2 !== Lexer2.SKIPPED && group2 !== Lexer2.NA && !isString_default2(group2); + }); + const errors = map_default2(invalidTypes, (currType) => { + return { + message: "Token Type: ->" + currType.name + "<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String", + type: LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND, + tokenTypes: [currType] + }; + }); + return errors; + } + function findModesThatDoNotExist(tokenTypes, validModes) { + const invalidModes = filter_default4(tokenTypes, (clazz) => { + return clazz.PUSH_MODE !== void 0 && !includes_default(validModes, clazz.PUSH_MODE); + }); + const errors = map_default2(invalidModes, (tokType) => { + const msg = `Token Type: ->${tokType.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${tokType.PUSH_MODE}<-which does not exist`; + return { + message: msg, + type: LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST, + tokenTypes: [tokType] + }; + }); + return errors; + } + function findUnreachablePatterns(tokenTypes) { + const errors = []; + const canBeTested = reduce_default2(tokenTypes, (result, tokType, idx) => { + const pattern = tokType.PATTERN; + if (pattern === Lexer2.NA) { + return result; + } + if (isString_default2(pattern)) { + result.push({ str: pattern, idx, tokenType: tokType }); + } else if (isRegExp_default(pattern) && noMetaChar(pattern)) { + result.push({ str: pattern.source, idx, tokenType: tokType }); + } + return result; + }, []); + forEach_default2(tokenTypes, (aTokType, aIdx) => { + forEach_default2(canBeTested, ({ str: bStr, idx: bIdx, tokenType: bTokType }) => { + if (aIdx < bIdx && tryToMatchStrToPattern(bStr, aTokType.PATTERN)) { + const msg = `Token: ->${bTokType.name}<- can never be matched. +Because it appears AFTER the Token Type ->${aTokType.name}<-in the lexer's definition. +See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`; + errors.push({ + message: msg, + type: LexerDefinitionErrorType.UNREACHABLE_PATTERN, + tokenTypes: [aTokType, bTokType] + }); + } + }); + }); + return errors; + } + function tryToMatchStrToPattern(str2, pattern) { + if (isRegExp_default(pattern)) { + if (usesLookAheadOrBehind(pattern)) { + return false; + } + const regExpArray = pattern.exec(str2); + return regExpArray !== null && regExpArray.index === 0; + } else if (isFunction_default2(pattern)) { + return pattern(str2, 0, [], {}); + } else if (has_default2(pattern, "exec")) { + return pattern.exec(str2, 0, [], {}); + } else if (typeof pattern === "string") { + return pattern === str2; + } else { + throw Error("non exhaustive match"); + } + } + function noMetaChar(regExp) { + const metaChars = [ + ".", + "\\", + "[", + "]", + "|", + "^", + "$", + "(", + ")", + "?", + "*", + "+", + "{" + ]; + return find_default3(metaChars, (char2) => regExp.source.indexOf(char2) !== -1) === void 0; + } + function usesLookAheadOrBehind(regExp) { + return /(\(\?=)|(\(\?!)|(\(\?<=)|(\(\? property in its definition\n", + type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE + }); + } + if (!has_default2(lexerDefinition, MODES)) { + errors.push({ + message: "A MultiMode Lexer cannot be initialized without a <" + MODES + "> property in its definition\n", + type: LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY + }); + } + if (has_default2(lexerDefinition, MODES) && has_default2(lexerDefinition, DEFAULT_MODE) && !has_default2(lexerDefinition.modes, lexerDefinition.defaultMode)) { + errors.push({ + message: `A MultiMode Lexer cannot be initialized with a ${DEFAULT_MODE}: <${lexerDefinition.defaultMode}>which does not exist +`, + type: LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST + }); + } + if (has_default2(lexerDefinition, MODES)) { + forEach_default2(lexerDefinition.modes, (currModeValue, currModeName) => { + forEach_default2(currModeValue, (currTokType, currIdx) => { + if (isUndefined_default2(currTokType)) { + errors.push({ + message: `A Lexer cannot be initialized using an undefined Token Type. Mode:<${currModeName}> at index: <${currIdx}> +`, + type: LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED + }); + } else if (has_default2(currTokType, "LONGER_ALT")) { + const longerAlt = isArray_default2(currTokType.LONGER_ALT) ? currTokType.LONGER_ALT : [currTokType.LONGER_ALT]; + forEach_default2(longerAlt, (currLongerAlt) => { + if (!isUndefined_default2(currLongerAlt) && !includes_default(currModeValue, currLongerAlt)) { + errors.push({ + message: `A MultiMode Lexer cannot be initialized with a longer_alt <${currLongerAlt.name}> on token <${currTokType.name}> outside of mode <${currModeName}> +`, + type: LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE + }); + } + }); + } + }); + }); + } + return errors; + } + function performWarningRuntimeChecks(lexerDefinition, trackLines, lineTerminatorCharacters) { + const warnings3 = []; + let hasAnyLineBreak = false; + const allTokenTypes = compact_default(flatten_default2(values_default2(lexerDefinition.modes))); + const concreteTokenTypes = reject_default(allTokenTypes, (currType) => currType[PATTERN] === Lexer2.NA); + const terminatorCharCodes = getCharCodes(lineTerminatorCharacters); + if (trackLines) { + forEach_default2(concreteTokenTypes, (tokType) => { + const currIssue = checkLineBreaksIssues(tokType, terminatorCharCodes); + if (currIssue !== false) { + const message = buildLineBreakIssueMessage(tokType, currIssue); + const warningDescriptor = { + message, + type: currIssue.issue, + tokenType: tokType + }; + warnings3.push(warningDescriptor); + } else { + if (has_default2(tokType, "LINE_BREAKS")) { + if (tokType.LINE_BREAKS === true) { + hasAnyLineBreak = true; + } + } else { + if (canMatchCharCode(terminatorCharCodes, tokType.PATTERN)) { + hasAnyLineBreak = true; + } + } + } + }); + } + if (trackLines && !hasAnyLineBreak) { + warnings3.push({ + message: "Warning: No LINE_BREAKS Found.\n This Lexer has been defined to track line and column information,\n But none of the Token Types can be identified as matching a line terminator.\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n for details.", + type: LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS + }); + } + return warnings3; + } + function cloneEmptyGroups(emptyGroups) { + const clonedResult = {}; + const groupKeys = keys_default2(emptyGroups); + forEach_default2(groupKeys, (currKey) => { + const currGroupValue = emptyGroups[currKey]; + if (isArray_default2(currGroupValue)) { + clonedResult[currKey] = []; + } else { + throw Error("non exhaustive match"); + } + }); + return clonedResult; + } + function isCustomPattern(tokenType) { + const pattern = tokenType.PATTERN; + if (isRegExp_default(pattern)) { + return false; + } else if (isFunction_default2(pattern)) { + return true; + } else if (has_default2(pattern, "exec")) { + return true; + } else if (isString_default2(pattern)) { + return false; + } else { + throw Error("non exhaustive match"); + } + } + function isShortPattern(pattern) { + if (isString_default2(pattern) && pattern.length === 1) { + return pattern.charCodeAt(0); + } else { + return false; + } + } + function checkLineBreaksIssues(tokType, lineTerminatorCharCodes) { + if (has_default2(tokType, "LINE_BREAKS")) { + return false; + } else { + if (isRegExp_default(tokType.PATTERN)) { + try { + canMatchCharCode(lineTerminatorCharCodes, tokType.PATTERN); + } catch (e3) { + return { + issue: LexerDefinitionErrorType.IDENTIFY_TERMINATOR, + errMsg: e3.message + }; + } + return false; + } else if (isString_default2(tokType.PATTERN)) { + return false; + } else if (isCustomPattern(tokType)) { + return { issue: LexerDefinitionErrorType.CUSTOM_LINE_BREAK }; + } else { + throw Error("non exhaustive match"); + } + } + } + function buildLineBreakIssueMessage(tokType, details) { + if (details.issue === LexerDefinitionErrorType.IDENTIFY_TERMINATOR) { + return `Warning: unable to identify line terminator usage in pattern. + The problem is in the <${tokType.name}> Token Type + Root cause: ${details.errMsg}. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`; + } else if (details.issue === LexerDefinitionErrorType.CUSTOM_LINE_BREAK) { + return `Warning: A Custom Token Pattern should specify the option. + The problem is in the <${tokType.name}> Token Type + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`; + } else { + throw Error("non exhaustive match"); + } + } + function getCharCodes(charsOrCodes) { + const charCodes = map_default2(charsOrCodes, (numOrString) => { + if (isString_default2(numOrString)) { + return numOrString.charCodeAt(0); + } else { + return numOrString; + } + }); + return charCodes; + } + function addToMapOfArrays(map32, key, value2) { + if (map32[key] === void 0) { + map32[key] = [value2]; + } else { + map32[key].push(value2); + } + } + function charCodeToOptimizedIndex(charCode) { + return charCode < minOptimizationVal ? charCode : charCodeToOptimizedIdxMap[charCode]; + } + function initCharCodeToOptimizedIndexMap() { + if (isEmpty_default2(charCodeToOptimizedIdxMap)) { + charCodeToOptimizedIdxMap = new Array(65536); + for (let i2 = 0; i2 < 65536; i2++) { + charCodeToOptimizedIdxMap[i2] = i2 > 255 ? 255 + ~~(i2 / 255) : i2; + } + } + } + function tokenStructuredMatcher(tokInstance, tokConstructor) { + const instanceType = tokInstance.tokenTypeIdx; + if (instanceType === tokConstructor.tokenTypeIdx) { + return true; + } else { + return tokConstructor.isParent === true && tokConstructor.categoryMatchesMap[instanceType] === true; + } + } + function tokenStructuredMatcherNoCategories(token2, tokType) { + return token2.tokenTypeIdx === tokType.tokenTypeIdx; + } + function augmentTokenTypes(tokenTypes) { + const tokenTypesAndParents = expandCategories(tokenTypes); + assignTokenDefaultProps(tokenTypesAndParents); + assignCategoriesMapProp(tokenTypesAndParents); + assignCategoriesTokensProp(tokenTypesAndParents); + forEach_default2(tokenTypesAndParents, (tokType) => { + tokType.isParent = tokType.categoryMatches.length > 0; + }); + } + function expandCategories(tokenTypes) { + let result = clone_default3(tokenTypes); + let categories = tokenTypes; + let searching = true; + while (searching) { + categories = compact_default(flatten_default2(map_default2(categories, (currTokType) => currTokType.CATEGORIES))); + const newCategories = difference_default(categories, result); + result = result.concat(newCategories); + if (isEmpty_default2(newCategories)) { + searching = false; + } else { + categories = newCategories; + } + } + return result; + } + function assignTokenDefaultProps(tokenTypes) { + forEach_default2(tokenTypes, (currTokType) => { + if (!hasShortKeyProperty(currTokType)) { + tokenIdxToClass[tokenShortNameIdx] = currTokType; + currTokType.tokenTypeIdx = tokenShortNameIdx++; + } + if (hasCategoriesProperty(currTokType) && !isArray_default2(currTokType.CATEGORIES)) { + currTokType.CATEGORIES = [currTokType.CATEGORIES]; + } + if (!hasCategoriesProperty(currTokType)) { + currTokType.CATEGORIES = []; + } + if (!hasExtendingTokensTypesProperty(currTokType)) { + currTokType.categoryMatches = []; + } + if (!hasExtendingTokensTypesMapProperty(currTokType)) { + currTokType.categoryMatchesMap = {}; + } + }); + } + function assignCategoriesTokensProp(tokenTypes) { + forEach_default2(tokenTypes, (currTokType) => { + currTokType.categoryMatches = []; + forEach_default2(currTokType.categoryMatchesMap, (val, key) => { + currTokType.categoryMatches.push(tokenIdxToClass[key].tokenTypeIdx); + }); + }); + } + function assignCategoriesMapProp(tokenTypes) { + forEach_default2(tokenTypes, (currTokType) => { + singleAssignCategoriesToksMap([], currTokType); + }); + } + function singleAssignCategoriesToksMap(path4, nextNode) { + forEach_default2(path4, (pathNode) => { + nextNode.categoryMatchesMap[pathNode.tokenTypeIdx] = true; + }); + forEach_default2(nextNode.CATEGORIES, (nextCategory) => { + const newPath = path4.concat(nextNode); + if (!includes_default(newPath, nextCategory)) { + singleAssignCategoriesToksMap(newPath, nextCategory); + } + }); + } + function hasShortKeyProperty(tokType) { + return has_default2(tokType, "tokenTypeIdx"); + } + function hasCategoriesProperty(tokType) { + return has_default2(tokType, "CATEGORIES"); + } + function hasExtendingTokensTypesProperty(tokType) { + return has_default2(tokType, "categoryMatches"); + } + function hasExtendingTokensTypesMapProperty(tokType) { + return has_default2(tokType, "categoryMatchesMap"); + } + function isTokenType(tokType) { + return has_default2(tokType, "tokenTypeIdx"); + } + function tokenLabel2(tokType) { + if (hasTokenLabel2(tokType)) { + return tokType.LABEL; + } else { + return tokType.name; + } + } + function hasTokenLabel2(obj) { + return isString_default2(obj.LABEL) && obj.LABEL !== ""; + } + function createToken(config5) { + return createTokenInternal(config5); + } + function createTokenInternal(config5) { + const pattern = config5.pattern; + const tokenType = {}; + tokenType.name = config5.name; + if (!isUndefined_default2(pattern)) { + tokenType.PATTERN = pattern; + } + if (has_default2(config5, PARENT)) { + throw "The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details."; + } + if (has_default2(config5, CATEGORIES)) { + tokenType.CATEGORIES = config5[CATEGORIES]; + } + augmentTokenTypes([tokenType]); + if (has_default2(config5, LABEL)) { + tokenType.LABEL = config5[LABEL]; + } + if (has_default2(config5, GROUP)) { + tokenType.GROUP = config5[GROUP]; + } + if (has_default2(config5, POP_MODE)) { + tokenType.POP_MODE = config5[POP_MODE]; + } + if (has_default2(config5, PUSH_MODE)) { + tokenType.PUSH_MODE = config5[PUSH_MODE]; + } + if (has_default2(config5, LONGER_ALT)) { + tokenType.LONGER_ALT = config5[LONGER_ALT]; + } + if (has_default2(config5, LINE_BREAKS)) { + tokenType.LINE_BREAKS = config5[LINE_BREAKS]; + } + if (has_default2(config5, START_CHARS_HINT)) { + tokenType.START_CHARS_HINT = config5[START_CHARS_HINT]; + } + return tokenType; + } + function createTokenInstance(tokType, image, startOffset, endOffset, startLine, endLine, startColumn, endColumn) { + return { + image, + startOffset, + endOffset, + startLine, + endLine, + startColumn, + endColumn, + tokenTypeIdx: tokType.tokenTypeIdx, + tokenType: tokType + }; + } + function tokenMatcher(token2, tokType) { + return tokenStructuredMatcher(token2, tokType); + } + function resolveGrammar(topLevels, errMsgProvider) { + const refResolver = new GastRefResolverVisitor(topLevels, errMsgProvider); + refResolver.resolveRefs(); + return refResolver.errors; + } + function possiblePathsFrom(targetDef, maxLength, currPath = []) { + currPath = clone_default3(currPath); + let result = []; + let i2 = 0; + function remainingPathWith(nextDef) { + return nextDef.concat(drop_default(targetDef, i2 + 1)); + } + __name(remainingPathWith, "remainingPathWith"); + __name2(remainingPathWith, "remainingPathWith"); + function getAlternativesForProd(definition) { + const alternatives = possiblePathsFrom(remainingPathWith(definition), maxLength, currPath); + return result.concat(alternatives); + } + __name(getAlternativesForProd, "getAlternativesForProd"); + __name2(getAlternativesForProd, "getAlternativesForProd"); + while (currPath.length < maxLength && i2 < targetDef.length) { + const prod = targetDef[i2]; + if (prod instanceof Alternative) { + return getAlternativesForProd(prod.definition); + } else if (prod instanceof NonTerminal) { + return getAlternativesForProd(prod.definition); + } else if (prod instanceof Option2) { + result = getAlternativesForProd(prod.definition); + } else if (prod instanceof RepetitionMandatory) { + const newDef = prod.definition.concat([ + new Repetition({ + definition: prod.definition + }) + ]); + return getAlternativesForProd(newDef); + } else if (prod instanceof RepetitionMandatoryWithSeparator) { + const newDef = [ + new Alternative({ definition: prod.definition }), + new Repetition({ + definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition) + }) + ]; + return getAlternativesForProd(newDef); + } else if (prod instanceof RepetitionWithSeparator) { + const newDef = prod.definition.concat([ + new Repetition({ + definition: [new Terminal({ terminalType: prod.separator })].concat(prod.definition) + }) + ]); + result = getAlternativesForProd(newDef); + } else if (prod instanceof Repetition) { + const newDef = prod.definition.concat([ + new Repetition({ + definition: prod.definition + }) + ]); + result = getAlternativesForProd(newDef); + } else if (prod instanceof Alternation) { + forEach_default2(prod.definition, (currAlt) => { + if (isEmpty_default2(currAlt.definition) === false) { + result = getAlternativesForProd(currAlt.definition); + } + }); + return result; + } else if (prod instanceof Terminal) { + currPath.push(prod.terminalType); + } else { + throw Error("non exhaustive match"); + } + i2++; + } + result.push({ + partialPath: currPath, + suffixDef: drop_default(targetDef, i2) + }); + return result; + } + function nextPossibleTokensAfter(initialDef, tokenVector, tokMatcher, maxLookAhead) { + const EXIT_NON_TERMINAL = "EXIT_NONE_TERMINAL"; + const EXIT_NON_TERMINAL_ARR = [EXIT_NON_TERMINAL]; + const EXIT_ALTERNATIVE = "EXIT_ALTERNATIVE"; + let foundCompletePath = false; + const tokenVectorLength = tokenVector.length; + const minimalAlternativesIndex = tokenVectorLength - maxLookAhead - 1; + const result = []; + const possiblePaths = []; + possiblePaths.push({ + idx: -1, + def: initialDef, + ruleStack: [], + occurrenceStack: [] + }); + while (!isEmpty_default2(possiblePaths)) { + const currPath = possiblePaths.pop(); + if (currPath === EXIT_ALTERNATIVE) { + if (foundCompletePath && last_default2(possiblePaths).idx <= minimalAlternativesIndex) { + possiblePaths.pop(); + } + continue; + } + const currDef = currPath.def; + const currIdx = currPath.idx; + const currRuleStack = currPath.ruleStack; + const currOccurrenceStack = currPath.occurrenceStack; + if (isEmpty_default2(currDef)) { + continue; + } + const prod = currDef[0]; + if (prod === EXIT_NON_TERMINAL) { + const nextPath = { + idx: currIdx, + def: drop_default(currDef), + ruleStack: dropRight_default(currRuleStack), + occurrenceStack: dropRight_default(currOccurrenceStack) + }; + possiblePaths.push(nextPath); + } else if (prod instanceof Terminal) { + if (currIdx < tokenVectorLength - 1) { + const nextIdx = currIdx + 1; + const actualToken = tokenVector[nextIdx]; + if (tokMatcher(actualToken, prod.terminalType)) { + const nextPath = { + idx: nextIdx, + def: drop_default(currDef), + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(nextPath); + } + } else if (currIdx === tokenVectorLength - 1) { + result.push({ + nextTokenType: prod.terminalType, + nextTokenOccurrence: prod.idx, + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }); + foundCompletePath = true; + } else { + throw Error("non exhaustive match"); + } + } else if (prod instanceof NonTerminal) { + const newRuleStack = clone_default3(currRuleStack); + newRuleStack.push(prod.nonTerminalName); + const newOccurrenceStack = clone_default3(currOccurrenceStack); + newOccurrenceStack.push(prod.idx); + const nextPath = { + idx: currIdx, + def: prod.definition.concat(EXIT_NON_TERMINAL_ARR, drop_default(currDef)), + ruleStack: newRuleStack, + occurrenceStack: newOccurrenceStack + }; + possiblePaths.push(nextPath); + } else if (prod instanceof Option2) { + const nextPathWithout = { + idx: currIdx, + def: drop_default(currDef), + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(nextPathWithout); + possiblePaths.push(EXIT_ALTERNATIVE); + const nextPathWith = { + idx: currIdx, + def: prod.definition.concat(drop_default(currDef)), + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(nextPathWith); + } else if (prod instanceof RepetitionMandatory) { + const secondIteration = new Repetition({ + definition: prod.definition, + idx: prod.idx + }); + const nextDef = prod.definition.concat([secondIteration], drop_default(currDef)); + const nextPath = { + idx: currIdx, + def: nextDef, + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(nextPath); + } else if (prod instanceof RepetitionMandatoryWithSeparator) { + const separatorGast = new Terminal({ + terminalType: prod.separator + }); + const secondIteration = new Repetition({ + definition: [separatorGast].concat(prod.definition), + idx: prod.idx + }); + const nextDef = prod.definition.concat([secondIteration], drop_default(currDef)); + const nextPath = { + idx: currIdx, + def: nextDef, + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(nextPath); + } else if (prod instanceof RepetitionWithSeparator) { + const nextPathWithout = { + idx: currIdx, + def: drop_default(currDef), + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(nextPathWithout); + possiblePaths.push(EXIT_ALTERNATIVE); + const separatorGast = new Terminal({ + terminalType: prod.separator + }); + const nthRepetition = new Repetition({ + definition: [separatorGast].concat(prod.definition), + idx: prod.idx + }); + const nextDef = prod.definition.concat([nthRepetition], drop_default(currDef)); + const nextPathWith = { + idx: currIdx, + def: nextDef, + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(nextPathWith); + } else if (prod instanceof Repetition) { + const nextPathWithout = { + idx: currIdx, + def: drop_default(currDef), + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(nextPathWithout); + possiblePaths.push(EXIT_ALTERNATIVE); + const nthRepetition = new Repetition({ + definition: prod.definition, + idx: prod.idx + }); + const nextDef = prod.definition.concat([nthRepetition], drop_default(currDef)); + const nextPathWith = { + idx: currIdx, + def: nextDef, + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(nextPathWith); + } else if (prod instanceof Alternation) { + for (let i2 = prod.definition.length - 1; i2 >= 0; i2--) { + const currAlt = prod.definition[i2]; + const currAltPath = { + idx: currIdx, + def: currAlt.definition.concat(drop_default(currDef)), + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }; + possiblePaths.push(currAltPath); + possiblePaths.push(EXIT_ALTERNATIVE); + } + } else if (prod instanceof Alternative) { + possiblePaths.push({ + idx: currIdx, + def: prod.definition.concat(drop_default(currDef)), + ruleStack: currRuleStack, + occurrenceStack: currOccurrenceStack + }); + } else if (prod instanceof Rule) { + possiblePaths.push(expandTopLevelRule(prod, currIdx, currRuleStack, currOccurrenceStack)); + } else { + throw Error("non exhaustive match"); + } + } + return result; + } + function expandTopLevelRule(topRule, currIdx, currRuleStack, currOccurrenceStack) { + const newRuleStack = clone_default3(currRuleStack); + newRuleStack.push(topRule.name); + const newCurrOccurrenceStack = clone_default3(currOccurrenceStack); + newCurrOccurrenceStack.push(1); + return { + idx: currIdx, + def: topRule.definition, + ruleStack: newRuleStack, + occurrenceStack: newCurrOccurrenceStack + }; + } + function getProdType(prod) { + if (prod instanceof Option2 || prod === "Option") { + return PROD_TYPE.OPTION; + } else if (prod instanceof Repetition || prod === "Repetition") { + return PROD_TYPE.REPETITION; + } else if (prod instanceof RepetitionMandatory || prod === "RepetitionMandatory") { + return PROD_TYPE.REPETITION_MANDATORY; + } else if (prod instanceof RepetitionMandatoryWithSeparator || prod === "RepetitionMandatoryWithSeparator") { + return PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR; + } else if (prod instanceof RepetitionWithSeparator || prod === "RepetitionWithSeparator") { + return PROD_TYPE.REPETITION_WITH_SEPARATOR; + } else if (prod instanceof Alternation || prod === "Alternation") { + return PROD_TYPE.ALTERNATION; + } else { + throw Error("non exhaustive match"); + } + } + function getLookaheadPaths(options2) { + const { occurrence, rule, prodType, maxLookahead } = options2; + const type3 = getProdType(prodType); + if (type3 === PROD_TYPE.ALTERNATION) { + return getLookaheadPathsForOr(occurrence, rule, maxLookahead); + } else { + return getLookaheadPathsForOptionalProd(occurrence, rule, type3, maxLookahead); + } + } + function buildLookaheadFuncForOr(occurrence, ruleGrammar, maxLookahead, hasPredicates, dynamicTokensEnabled, laFuncBuilder) { + const lookAheadPaths = getLookaheadPathsForOr(occurrence, ruleGrammar, maxLookahead); + const tokenMatcher2 = areTokenCategoriesNotUsed(lookAheadPaths) ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher; + return laFuncBuilder(lookAheadPaths, hasPredicates, tokenMatcher2, dynamicTokensEnabled); + } + function buildLookaheadFuncForOptionalProd(occurrence, ruleGrammar, k2, dynamicTokensEnabled, prodType, lookaheadBuilder) { + const lookAheadPaths = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k2); + const tokenMatcher2 = areTokenCategoriesNotUsed(lookAheadPaths) ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher; + return lookaheadBuilder(lookAheadPaths[0], tokenMatcher2, dynamicTokensEnabled); + } + function buildAlternativesLookAheadFunc(alts, hasPredicates, tokenMatcher2, dynamicTokensEnabled) { + const numOfAlts = alts.length; + const areAllOneTokenLookahead = every_default(alts, (currAlt) => { + return every_default(currAlt, (currPath) => { + return currPath.length === 1; + }); + }); + if (hasPredicates) { + return function(orAlts) { + const predicates = map_default2(orAlts, (currAlt) => currAlt.GATE); + for (let t4 = 0; t4 < numOfAlts; t4++) { + const currAlt = alts[t4]; + const currNumOfPaths = currAlt.length; + const currPredicate = predicates[t4]; + if (currPredicate !== void 0 && currPredicate.call(this) === false) { + continue; + } + nextPath: for (let j3 = 0; j3 < currNumOfPaths; j3++) { + const currPath = currAlt[j3]; + const currPathLength = currPath.length; + for (let i2 = 0; i2 < currPathLength; i2++) { + const nextToken = this.LA(i2 + 1); + if (tokenMatcher2(nextToken, currPath[i2]) === false) { + continue nextPath; + } + } + return t4; + } + } + return void 0; + }; + } else if (areAllOneTokenLookahead && !dynamicTokensEnabled) { + const singleTokenAlts = map_default2(alts, (currAlt) => { + return flatten_default2(currAlt); + }); + const choiceToAlt = reduce_default2(singleTokenAlts, (result, currAlt, idx) => { + forEach_default2(currAlt, (currTokType) => { + if (!has_default2(result, currTokType.tokenTypeIdx)) { + result[currTokType.tokenTypeIdx] = idx; + } + forEach_default2(currTokType.categoryMatches, (currExtendingType) => { + if (!has_default2(result, currExtendingType)) { + result[currExtendingType] = idx; + } + }); + }); + return result; + }, {}); + return function() { + const nextToken = this.LA(1); + return choiceToAlt[nextToken.tokenTypeIdx]; + }; + } else { + return function() { + for (let t4 = 0; t4 < numOfAlts; t4++) { + const currAlt = alts[t4]; + const currNumOfPaths = currAlt.length; + nextPath: for (let j3 = 0; j3 < currNumOfPaths; j3++) { + const currPath = currAlt[j3]; + const currPathLength = currPath.length; + for (let i2 = 0; i2 < currPathLength; i2++) { + const nextToken = this.LA(i2 + 1); + if (tokenMatcher2(nextToken, currPath[i2]) === false) { + continue nextPath; + } + } + return t4; + } + } + return void 0; + }; + } + } + function buildSingleAlternativeLookaheadFunction(alt, tokenMatcher2, dynamicTokensEnabled) { + const areAllOneTokenLookahead = every_default(alt, (currPath) => { + return currPath.length === 1; + }); + const numOfPaths = alt.length; + if (areAllOneTokenLookahead && !dynamicTokensEnabled) { + const singleTokensTypes = flatten_default2(alt); + if (singleTokensTypes.length === 1 && isEmpty_default2(singleTokensTypes[0].categoryMatches)) { + const expectedTokenType = singleTokensTypes[0]; + const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx; + return function() { + return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey; + }; + } else { + const choiceToAlt = reduce_default2(singleTokensTypes, (result, currTokType, idx) => { + result[currTokType.tokenTypeIdx] = true; + forEach_default2(currTokType.categoryMatches, (currExtendingType) => { + result[currExtendingType] = true; + }); + return result; + }, []); + return function() { + const nextToken = this.LA(1); + return choiceToAlt[nextToken.tokenTypeIdx] === true; + }; + } + } else { + return function() { + nextPath: for (let j3 = 0; j3 < numOfPaths; j3++) { + const currPath = alt[j3]; + const currPathLength = currPath.length; + for (let i2 = 0; i2 < currPathLength; i2++) { + const nextToken = this.LA(i2 + 1); + if (tokenMatcher2(nextToken, currPath[i2]) === false) { + continue nextPath; + } + } + return true; + } + return false; + }; + } + } + function initializeArrayOfArrays(size4) { + const result = new Array(size4); + for (let i2 = 0; i2 < size4; i2++) { + result[i2] = []; + } + return result; + } + function pathToHashKeys(path4) { + let keys3 = [""]; + for (let i2 = 0; i2 < path4.length; i2++) { + const tokType = path4[i2]; + const longerKeys = []; + for (let j3 = 0; j3 < keys3.length; j3++) { + const currShorterKey = keys3[j3]; + longerKeys.push(currShorterKey + "_" + tokType.tokenTypeIdx); + for (let t4 = 0; t4 < tokType.categoryMatches.length; t4++) { + const categoriesKeySuffix = "_" + tokType.categoryMatches[t4]; + longerKeys.push(currShorterKey + categoriesKeySuffix); + } + } + keys3 = longerKeys; + } + return keys3; + } + function isUniquePrefixHash(altKnownPathsKeys, searchPathKeys, idx) { + for (let currAltIdx = 0; currAltIdx < altKnownPathsKeys.length; currAltIdx++) { + if (currAltIdx === idx) { + continue; + } + const otherAltKnownPathsKeys = altKnownPathsKeys[currAltIdx]; + for (let searchIdx = 0; searchIdx < searchPathKeys.length; searchIdx++) { + const searchKey = searchPathKeys[searchIdx]; + if (otherAltKnownPathsKeys[searchKey] === true) { + return false; + } + } + } + return true; + } + function lookAheadSequenceFromAlternatives(altsDefs, k2) { + const partialAlts = map_default2(altsDefs, (currAlt) => possiblePathsFrom([currAlt], 1)); + const finalResult = initializeArrayOfArrays(partialAlts.length); + const altsHashes = map_default2(partialAlts, (currAltPaths) => { + const dict = {}; + forEach_default2(currAltPaths, (item) => { + const keys3 = pathToHashKeys(item.partialPath); + forEach_default2(keys3, (currKey) => { + dict[currKey] = true; + }); + }); + return dict; + }); + let newData = partialAlts; + for (let pathLength = 1; pathLength <= k2; pathLength++) { + const currDataset = newData; + newData = initializeArrayOfArrays(currDataset.length); + for (let altIdx = 0; altIdx < currDataset.length; altIdx++) { + const currAltPathsAndSuffixes = currDataset[altIdx]; + for (let currPathIdx = 0; currPathIdx < currAltPathsAndSuffixes.length; currPathIdx++) { + const currPathPrefix = currAltPathsAndSuffixes[currPathIdx].partialPath; + const suffixDef = currAltPathsAndSuffixes[currPathIdx].suffixDef; + const prefixKeys = pathToHashKeys(currPathPrefix); + const isUnique = isUniquePrefixHash(altsHashes, prefixKeys, altIdx); + if (isUnique || isEmpty_default2(suffixDef) || currPathPrefix.length === k2) { + const currAltResult = finalResult[altIdx]; + if (containsPath(currAltResult, currPathPrefix) === false) { + currAltResult.push(currPathPrefix); + for (let j3 = 0; j3 < prefixKeys.length; j3++) { + const currKey = prefixKeys[j3]; + altsHashes[altIdx][currKey] = true; + } + } + } else { + const newPartialPathsAndSuffixes = possiblePathsFrom(suffixDef, pathLength + 1, currPathPrefix); + newData[altIdx] = newData[altIdx].concat(newPartialPathsAndSuffixes); + forEach_default2(newPartialPathsAndSuffixes, (item) => { + const prefixKeys2 = pathToHashKeys(item.partialPath); + forEach_default2(prefixKeys2, (key) => { + altsHashes[altIdx][key] = true; + }); + }); + } + } + } + } + return finalResult; + } + function getLookaheadPathsForOr(occurrence, ruleGrammar, k2, orProd) { + const visitor2 = new InsideDefinitionFinderVisitor(occurrence, PROD_TYPE.ALTERNATION, orProd); + ruleGrammar.accept(visitor2); + return lookAheadSequenceFromAlternatives(visitor2.result, k2); + } + function getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, k2) { + const insideDefVisitor = new InsideDefinitionFinderVisitor(occurrence, prodType); + ruleGrammar.accept(insideDefVisitor); + const insideDef = insideDefVisitor.result; + const afterDefWalker = new RestDefinitionFinderWalker(ruleGrammar, occurrence, prodType); + const afterDef = afterDefWalker.startWalking(); + const insideFlat = new Alternative({ definition: insideDef }); + const afterFlat = new Alternative({ definition: afterDef }); + return lookAheadSequenceFromAlternatives([insideFlat, afterFlat], k2); + } + function containsPath(alternative, searchPath) { + compareOtherPath: for (let i2 = 0; i2 < alternative.length; i2++) { + const otherPath = alternative[i2]; + if (otherPath.length !== searchPath.length) { + continue; + } + for (let j3 = 0; j3 < otherPath.length; j3++) { + const searchTok = searchPath[j3]; + const otherTok = otherPath[j3]; + const matchingTokens = searchTok === otherTok || otherTok.categoryMatchesMap[searchTok.tokenTypeIdx] !== void 0; + if (matchingTokens === false) { + continue compareOtherPath; + } + } + return true; + } + return false; + } + function isStrictPrefixOfPath(prefix, other) { + return prefix.length < other.length && every_default(prefix, (tokType, idx) => { + const otherTokType = other[idx]; + return tokType === otherTokType || otherTokType.categoryMatchesMap[tokType.tokenTypeIdx]; + }); + } + function areTokenCategoriesNotUsed(lookAheadPaths) { + return every_default(lookAheadPaths, (singleAltPaths) => every_default(singleAltPaths, (singlePath) => every_default(singlePath, (token2) => isEmpty_default2(token2.categoryMatches)))); + } + function validateLookahead(options2) { + const lookaheadValidationErrorMessages = options2.lookaheadStrategy.validate({ + rules: options2.rules, + tokenTypes: options2.tokenTypes, + grammarName: options2.grammarName + }); + return map_default2(lookaheadValidationErrorMessages, (errorMessage) => Object.assign({ type: ParserDefinitionErrorType.CUSTOM_LOOKAHEAD_VALIDATION }, errorMessage)); + } + function validateGrammar(topLevels, tokenTypes, errMsgProvider, grammarName) { + const duplicateErrors = flatMap_default(topLevels, (currTopLevel) => validateDuplicateProductions(currTopLevel, errMsgProvider)); + const termsNamespaceConflictErrors = checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider); + const tooManyAltsErrors = flatMap_default(topLevels, (curRule) => validateTooManyAlts(curRule, errMsgProvider)); + const duplicateRulesError = flatMap_default(topLevels, (curRule) => validateRuleDoesNotAlreadyExist(curRule, topLevels, grammarName, errMsgProvider)); + return duplicateErrors.concat(termsNamespaceConflictErrors, tooManyAltsErrors, duplicateRulesError); + } + function validateDuplicateProductions(topLevelRule, errMsgProvider) { + const collectorVisitor2 = new OccurrenceValidationCollector(); + topLevelRule.accept(collectorVisitor2); + const allRuleProductions = collectorVisitor2.allProductions; + const productionGroups = groupBy_default(allRuleProductions, identifyProductionForDuplicates); + const duplicates = pickBy_default(productionGroups, (currGroup) => { + return currGroup.length > 1; + }); + const errors = map_default2(values_default2(duplicates), (currDuplicates) => { + const firstProd = head_default(currDuplicates); + const msg = errMsgProvider.buildDuplicateFoundError(topLevelRule, currDuplicates); + const dslName = getProductionDslName(firstProd); + const defError = { + message: msg, + type: ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS, + ruleName: topLevelRule.name, + dslName, + occurrence: firstProd.idx + }; + const param = getExtraProductionArgument(firstProd); + if (param) { + defError.parameter = param; + } + return defError; + }); + return errors; + } + function identifyProductionForDuplicates(prod) { + return `${getProductionDslName(prod)}_#_${prod.idx}_#_${getExtraProductionArgument(prod)}`; + } + function getExtraProductionArgument(prod) { + if (prod instanceof Terminal) { + return prod.terminalType.name; + } else if (prod instanceof NonTerminal) { + return prod.nonTerminalName; + } else { + return ""; + } + } + function validateRuleDoesNotAlreadyExist(rule, allRules, className, errMsgProvider) { + const errors = []; + const occurrences = reduce_default2(allRules, (result, curRule) => { + if (curRule.name === rule.name) { + return result + 1; + } + return result; + }, 0); + if (occurrences > 1) { + const errMsg = errMsgProvider.buildDuplicateRuleNameError({ + topLevelRule: rule, + grammarName: className + }); + errors.push({ + message: errMsg, + type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME, + ruleName: rule.name + }); + } + return errors; + } + function validateRuleIsOverridden(ruleName, definedRulesNames, className) { + const errors = []; + let errMsg; + if (!includes_default(definedRulesNames, ruleName)) { + errMsg = `Invalid rule override, rule: ->${ruleName}<- cannot be overridden in the grammar: ->${className}<-as it is not defined in any of the super grammars `; + errors.push({ + message: errMsg, + type: ParserDefinitionErrorType.INVALID_RULE_OVERRIDE, + ruleName + }); + } + return errors; + } + function validateNoLeftRecursion(topRule, currRule, errMsgProvider, path4 = []) { + const errors = []; + const nextNonTerminals = getFirstNoneTerminal(currRule.definition); + if (isEmpty_default2(nextNonTerminals)) { + return []; + } else { + const ruleName = topRule.name; + const foundLeftRecursion = includes_default(nextNonTerminals, topRule); + if (foundLeftRecursion) { + errors.push({ + message: errMsgProvider.buildLeftRecursionError({ + topLevelRule: topRule, + leftRecursionPath: path4 + }), + type: ParserDefinitionErrorType.LEFT_RECURSION, + ruleName + }); + } + const validNextSteps = difference_default(nextNonTerminals, path4.concat([topRule])); + const errorsFromNextSteps = flatMap_default(validNextSteps, (currRefRule) => { + const newPath = clone_default3(path4); + newPath.push(currRefRule); + return validateNoLeftRecursion(topRule, currRefRule, errMsgProvider, newPath); + }); + return errors.concat(errorsFromNextSteps); + } + } + function getFirstNoneTerminal(definition) { + let result = []; + if (isEmpty_default2(definition)) { + return result; + } + const firstProd = head_default(definition); + if (firstProd instanceof NonTerminal) { + result.push(firstProd.referencedRule); + } else if (firstProd instanceof Alternative || firstProd instanceof Option2 || firstProd instanceof RepetitionMandatory || firstProd instanceof RepetitionMandatoryWithSeparator || firstProd instanceof RepetitionWithSeparator || firstProd instanceof Repetition) { + result = result.concat(getFirstNoneTerminal(firstProd.definition)); + } else if (firstProd instanceof Alternation) { + result = flatten_default2(map_default2(firstProd.definition, (currSubDef) => getFirstNoneTerminal(currSubDef.definition))); + } else if (firstProd instanceof Terminal) { + } else { + throw Error("non exhaustive match"); + } + const isFirstOptional = isOptionalProd(firstProd); + const hasMore = definition.length > 1; + if (isFirstOptional && hasMore) { + const rest = drop_default(definition); + return result.concat(getFirstNoneTerminal(rest)); + } else { + return result; + } + } + function validateEmptyOrAlternative(topLevelRule, errMsgProvider) { + const orCollector = new OrCollector(); + topLevelRule.accept(orCollector); + const ors = orCollector.alternations; + const errors = flatMap_default(ors, (currOr) => { + const exceptLast = dropRight_default(currOr.definition); + return flatMap_default(exceptLast, (currAlternative, currAltIdx) => { + const possibleFirstInAlt = nextPossibleTokensAfter([currAlternative], [], tokenStructuredMatcher, 1); + if (isEmpty_default2(possibleFirstInAlt)) { + return [ + { + message: errMsgProvider.buildEmptyAlternationError({ + topLevelRule, + alternation: currOr, + emptyChoiceIdx: currAltIdx + }), + type: ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT, + ruleName: topLevelRule.name, + occurrence: currOr.idx, + alternative: currAltIdx + 1 + } + ]; + } else { + return []; + } + }); + }); + return errors; + } + function validateAmbiguousAlternationAlternatives(topLevelRule, globalMaxLookahead, errMsgProvider) { + const orCollector = new OrCollector(); + topLevelRule.accept(orCollector); + let ors = orCollector.alternations; + ors = reject_default(ors, (currOr) => currOr.ignoreAmbiguities === true); + const errors = flatMap_default(ors, (currOr) => { + const currOccurrence = currOr.idx; + const actualMaxLookahead = currOr.maxLookahead || globalMaxLookahead; + const alternatives = getLookaheadPathsForOr(currOccurrence, topLevelRule, actualMaxLookahead, currOr); + const altsAmbiguityErrors = checkAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider); + const altsPrefixAmbiguityErrors = checkPrefixAlternativesAmbiguities(alternatives, currOr, topLevelRule, errMsgProvider); + return altsAmbiguityErrors.concat(altsPrefixAmbiguityErrors); + }); + return errors; + } + function validateTooManyAlts(topLevelRule, errMsgProvider) { + const orCollector = new OrCollector(); + topLevelRule.accept(orCollector); + const ors = orCollector.alternations; + const errors = flatMap_default(ors, (currOr) => { + if (currOr.definition.length > 255) { + return [ + { + message: errMsgProvider.buildTooManyAlternativesError({ + topLevelRule, + alternation: currOr + }), + type: ParserDefinitionErrorType.TOO_MANY_ALTS, + ruleName: topLevelRule.name, + occurrence: currOr.idx + } + ]; + } else { + return []; + } + }); + return errors; + } + function validateSomeNonEmptyLookaheadPath(topLevelRules, maxLookahead, errMsgProvider) { + const errors = []; + forEach_default2(topLevelRules, (currTopRule) => { + const collectorVisitor2 = new RepetitionCollector(); + currTopRule.accept(collectorVisitor2); + const allRuleProductions = collectorVisitor2.allProductions; + forEach_default2(allRuleProductions, (currProd) => { + const prodType = getProdType(currProd); + const actualMaxLookahead = currProd.maxLookahead || maxLookahead; + const currOccurrence = currProd.idx; + const paths = getLookaheadPathsForOptionalProd(currOccurrence, currTopRule, prodType, actualMaxLookahead); + const pathsInsideProduction = paths[0]; + if (isEmpty_default2(flatten_default2(pathsInsideProduction))) { + const errMsg = errMsgProvider.buildEmptyRepetitionError({ + topLevelRule: currTopRule, + repetition: currProd + }); + errors.push({ + message: errMsg, + type: ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD, + ruleName: currTopRule.name + }); + } + }); + }); + return errors; + } + function checkAlternativesAmbiguities(alternatives, alternation2, rule, errMsgProvider) { + const foundAmbiguousPaths = []; + const identicalAmbiguities = reduce_default2(alternatives, (result, currAlt, currAltIdx) => { + if (alternation2.definition[currAltIdx].ignoreAmbiguities === true) { + return result; + } + forEach_default2(currAlt, (currPath) => { + const altsCurrPathAppearsIn = [currAltIdx]; + forEach_default2(alternatives, (currOtherAlt, currOtherAltIdx) => { + if (currAltIdx !== currOtherAltIdx && containsPath(currOtherAlt, currPath) && // ignore (skip) ambiguities with this "other" alternative + alternation2.definition[currOtherAltIdx].ignoreAmbiguities !== true) { + altsCurrPathAppearsIn.push(currOtherAltIdx); + } + }); + if (altsCurrPathAppearsIn.length > 1 && !containsPath(foundAmbiguousPaths, currPath)) { + foundAmbiguousPaths.push(currPath); + result.push({ + alts: altsCurrPathAppearsIn, + path: currPath + }); + } + }); + return result; + }, []); + const currErrors = map_default2(identicalAmbiguities, (currAmbDescriptor) => { + const ambgIndices = map_default2(currAmbDescriptor.alts, (currAltIdx) => currAltIdx + 1); + const currMessage = errMsgProvider.buildAlternationAmbiguityError({ + topLevelRule: rule, + alternation: alternation2, + ambiguityIndices: ambgIndices, + prefixPath: currAmbDescriptor.path + }); + return { + message: currMessage, + type: ParserDefinitionErrorType.AMBIGUOUS_ALTS, + ruleName: rule.name, + occurrence: alternation2.idx, + alternatives: currAmbDescriptor.alts + }; + }); + return currErrors; + } + function checkPrefixAlternativesAmbiguities(alternatives, alternation2, rule, errMsgProvider) { + const pathsAndIndices = reduce_default2(alternatives, (result, currAlt, idx) => { + const currPathsAndIdx = map_default2(currAlt, (currPath) => { + return { idx, path: currPath }; + }); + return result.concat(currPathsAndIdx); + }, []); + const errors = compact_default(flatMap_default(pathsAndIndices, (currPathAndIdx) => { + const alternativeGast = alternation2.definition[currPathAndIdx.idx]; + if (alternativeGast.ignoreAmbiguities === true) { + return []; + } + const targetIdx = currPathAndIdx.idx; + const targetPath = currPathAndIdx.path; + const prefixAmbiguitiesPathsAndIndices = filter_default4(pathsAndIndices, (searchPathAndIdx) => { + return ( + // ignore (skip) ambiguities with this "other" alternative + alternation2.definition[searchPathAndIdx.idx].ignoreAmbiguities !== true && searchPathAndIdx.idx < targetIdx && // checking for strict prefix because identical lookaheads + // will be be detected using a different validation. + isStrictPrefixOfPath(searchPathAndIdx.path, targetPath) + ); + }); + const currPathPrefixErrors = map_default2(prefixAmbiguitiesPathsAndIndices, (currAmbPathAndIdx) => { + const ambgIndices = [currAmbPathAndIdx.idx + 1, targetIdx + 1]; + const occurrence = alternation2.idx === 0 ? "" : alternation2.idx; + const message = errMsgProvider.buildAlternationPrefixAmbiguityError({ + topLevelRule: rule, + alternation: alternation2, + ambiguityIndices: ambgIndices, + prefixPath: currAmbPathAndIdx.path + }); + return { + message, + type: ParserDefinitionErrorType.AMBIGUOUS_PREFIX_ALTS, + ruleName: rule.name, + occurrence, + alternatives: ambgIndices + }; + }); + return currPathPrefixErrors; + })); + return errors; + } + function checkTerminalAndNoneTerminalsNameSpace(topLevels, tokenTypes, errMsgProvider) { + const errors = []; + const tokenNames = map_default2(tokenTypes, (currToken) => currToken.name); + forEach_default2(topLevels, (currRule) => { + const currRuleName = currRule.name; + if (includes_default(tokenNames, currRuleName)) { + const errMsg = errMsgProvider.buildNamespaceConflictError(currRule); + errors.push({ + message: errMsg, + type: ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE, + ruleName: currRuleName + }); + } + }); + return errors; + } + function resolveGrammar2(options2) { + const actualOptions = defaults_default2(options2, { + errMsgProvider: defaultGrammarResolverErrorProvider + }); + const topRulesTable = {}; + forEach_default2(options2.rules, (rule) => { + topRulesTable[rule.name] = rule; + }); + return resolveGrammar(topRulesTable, actualOptions.errMsgProvider); + } + function validateGrammar2(options2) { + options2 = defaults_default2(options2, { + errMsgProvider: defaultGrammarValidatorErrorProvider + }); + return validateGrammar(options2.rules, options2.tokenTypes, options2.errMsgProvider, options2.grammarName); + } + function isRecognitionException(error3) { + return includes_default(RECOGNITION_EXCEPTION_NAMES, error3.name); + } + function attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) { + const key = this.getKeyForAutomaticLookahead(dslMethodIdx, prodOccurrence); + let firstAfterRepInfo = this.firstAfterRepMap[key]; + if (firstAfterRepInfo === void 0) { + const currRuleName = this.getCurrRuleFullName(); + const ruleGrammar = this.getGAstProductions()[currRuleName]; + const walker = new nextToksWalker(ruleGrammar, prodOccurrence); + firstAfterRepInfo = walker.startWalking(); + this.firstAfterRepMap[key] = firstAfterRepInfo; + } + let expectTokAfterLastMatch = firstAfterRepInfo.token; + let nextTokIdx = firstAfterRepInfo.occurrence; + const isEndOfRule = firstAfterRepInfo.isEndOfRule; + if (this.RULE_STACK.length === 1 && isEndOfRule && expectTokAfterLastMatch === void 0) { + expectTokAfterLastMatch = EOF; + nextTokIdx = 1; + } + if (expectTokAfterLastMatch === void 0 || nextTokIdx === void 0) { + return; + } + if (this.shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck)) { + this.tryInRepetitionRecovery(prodFunc, args, lookaheadFunc, expectTokAfterLastMatch); + } + } + function getKeyForAutomaticLookahead(ruleIdx, dslMethodIdx, occurrence) { + return occurrence | dslMethodIdx | ruleIdx; + } + function collectMethods(rule) { + collectorVisitor.reset(); + rule.accept(collectorVisitor); + const dslMethods = collectorVisitor.dslMethods; + collectorVisitor.reset(); + return dslMethods; + } + function setNodeLocationOnlyOffset(currNodeLocation, newLocationInfo) { + if (isNaN(currNodeLocation.startOffset) === true) { + currNodeLocation.startOffset = newLocationInfo.startOffset; + currNodeLocation.endOffset = newLocationInfo.endOffset; + } else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) { + currNodeLocation.endOffset = newLocationInfo.endOffset; + } + } + function setNodeLocationFull(currNodeLocation, newLocationInfo) { + if (isNaN(currNodeLocation.startOffset) === true) { + currNodeLocation.startOffset = newLocationInfo.startOffset; + currNodeLocation.startColumn = newLocationInfo.startColumn; + currNodeLocation.startLine = newLocationInfo.startLine; + currNodeLocation.endOffset = newLocationInfo.endOffset; + currNodeLocation.endColumn = newLocationInfo.endColumn; + currNodeLocation.endLine = newLocationInfo.endLine; + } else if (currNodeLocation.endOffset < newLocationInfo.endOffset === true) { + currNodeLocation.endOffset = newLocationInfo.endOffset; + currNodeLocation.endColumn = newLocationInfo.endColumn; + currNodeLocation.endLine = newLocationInfo.endLine; + } + } + function addTerminalToCst(node2, token2, tokenTypeName) { + if (node2.children[tokenTypeName] === void 0) { + node2.children[tokenTypeName] = [token2]; + } else { + node2.children[tokenTypeName].push(token2); + } + } + function addNoneTerminalToCst(node2, ruleName, ruleResult) { + if (node2.children[ruleName] === void 0) { + node2.children[ruleName] = [ruleResult]; + } else { + node2.children[ruleName].push(ruleResult); + } + } + function defineNameProp(obj, nameValue) { + Object.defineProperty(obj, NAME, { + enumerable: false, + configurable: true, + writable: false, + value: nameValue + }); + } + function defaultVisit(ctx, param) { + const childrenNames = keys_default2(ctx); + const childrenNamesLength = childrenNames.length; + for (let i2 = 0; i2 < childrenNamesLength; i2++) { + const currChildName = childrenNames[i2]; + const currChildArray = ctx[currChildName]; + const currChildArrayLength = currChildArray.length; + for (let j3 = 0; j3 < currChildArrayLength; j3++) { + const currChild = currChildArray[j3]; + if (currChild.tokenTypeIdx === void 0) { + this[currChild.name](currChild.children, param); + } + } + } + } + function createBaseSemanticVisitorConstructor(grammarName, ruleNames) { + const derivedConstructor = /* @__PURE__ */ __name2(function() { + }, "derivedConstructor"); + defineNameProp(derivedConstructor, grammarName + "BaseSemantics"); + const semanticProto = { + visit: /* @__PURE__ */ __name2(function(cstNode, param) { + if (isArray_default2(cstNode)) { + cstNode = cstNode[0]; + } + if (isUndefined_default2(cstNode)) { + return void 0; + } + return this[cstNode.name](cstNode.children, param); + }, "visit"), + validateVisitor: /* @__PURE__ */ __name2(function() { + const semanticDefinitionErrors = validateVisitor(this, ruleNames); + if (!isEmpty_default2(semanticDefinitionErrors)) { + const errorMessages = map_default2(semanticDefinitionErrors, (currDefError) => currDefError.msg); + throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: + ${errorMessages.join("\n\n").replace(/\n/g, "\n ")}`); + } + }, "validateVisitor") + }; + derivedConstructor.prototype = semanticProto; + derivedConstructor.prototype.constructor = derivedConstructor; + derivedConstructor._RULE_NAMES = ruleNames; + return derivedConstructor; + } + function createBaseVisitorConstructorWithDefaults(grammarName, ruleNames, baseConstructor) { + const derivedConstructor = /* @__PURE__ */ __name2(function() { + }, "derivedConstructor"); + defineNameProp(derivedConstructor, grammarName + "BaseSemanticsWithDefaults"); + const withDefaultsProto = Object.create(baseConstructor.prototype); + forEach_default2(ruleNames, (ruleName) => { + withDefaultsProto[ruleName] = defaultVisit; + }); + derivedConstructor.prototype = withDefaultsProto; + derivedConstructor.prototype.constructor = derivedConstructor; + return derivedConstructor; + } + function validateVisitor(visitorInstance, ruleNames) { + const missingErrors = validateMissingCstMethods(visitorInstance, ruleNames); + return missingErrors; + } + function validateMissingCstMethods(visitorInstance, ruleNames) { + const missingRuleNames = filter_default4(ruleNames, (currRuleName) => { + return isFunction_default2(visitorInstance[currRuleName]) === false; + }); + const errors = map_default2(missingRuleNames, (currRuleName) => { + return { + msg: `Missing visitor method: <${currRuleName}> on ${visitorInstance.constructor.name} CST Visitor.`, + type: CstVisitorDefinitionError.MISSING_METHOD, + methodName: currRuleName + }; + }); + return compact_default(errors); + } + function recordProd(prodConstructor, mainProdArg, occurrence, handleSep = false) { + assertMethodIdxIsValid(occurrence); + const prevProd = last_default2(this.recordingProdStack); + const grammarAction = isFunction_default2(mainProdArg) ? mainProdArg : mainProdArg.DEF; + const newProd = new prodConstructor({ definition: [], idx: occurrence }); + if (handleSep) { + newProd.separator = mainProdArg.SEP; + } + if (has_default2(mainProdArg, "MAX_LOOKAHEAD")) { + newProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD; + } + this.recordingProdStack.push(newProd); + grammarAction.call(this); + prevProd.definition.push(newProd); + this.recordingProdStack.pop(); + return RECORDING_NULL_OBJECT; + } + function recordOrProd(mainProdArg, occurrence) { + assertMethodIdxIsValid(occurrence); + const prevProd = last_default2(this.recordingProdStack); + const hasOptions = isArray_default2(mainProdArg) === false; + const alts = hasOptions === false ? mainProdArg : mainProdArg.DEF; + const newOrProd = new Alternation({ + definition: [], + idx: occurrence, + ignoreAmbiguities: hasOptions && mainProdArg.IGNORE_AMBIGUITIES === true + }); + if (has_default2(mainProdArg, "MAX_LOOKAHEAD")) { + newOrProd.maxLookahead = mainProdArg.MAX_LOOKAHEAD; + } + const hasPredicates = some_default(alts, (currAlt) => isFunction_default2(currAlt.GATE)); + newOrProd.hasPredicates = hasPredicates; + prevProd.definition.push(newOrProd); + forEach_default2(alts, (currAlt) => { + const currAltFlat = new Alternative({ definition: [] }); + newOrProd.definition.push(currAltFlat); + if (has_default2(currAlt, "IGNORE_AMBIGUITIES")) { + currAltFlat.ignoreAmbiguities = currAlt.IGNORE_AMBIGUITIES; + } else if (has_default2(currAlt, "GATE")) { + currAltFlat.ignoreAmbiguities = true; + } + this.recordingProdStack.push(currAltFlat); + currAlt.ALT.call(this); + this.recordingProdStack.pop(); + }); + return RECORDING_NULL_OBJECT; + } + function getIdxSuffix(idx) { + return idx === 0 ? "" : `${idx}`; + } + function assertMethodIdxIsValid(idx) { + if (idx < 0 || idx > MAX_METHOD_IDX) { + const error3 = new Error( + // The stack trace will contain all the needed details + `Invalid DSL Method idx value: <${idx}> + Idx value must be a none negative value smaller than ${MAX_METHOD_IDX + 1}` + ); + error3.KNOWN_RECORDER_ERROR = true; + throw error3; + } + } + function applyMixins(derivedCtor, baseCtors) { + baseCtors.forEach((baseCtor) => { + const baseProto = baseCtor.prototype; + Object.getOwnPropertyNames(baseProto).forEach((propName) => { + if (propName === "constructor") { + return; + } + const basePropDescriptor = Object.getOwnPropertyDescriptor(baseProto, propName); + if (basePropDescriptor && (basePropDescriptor.get || basePropDescriptor.set)) { + Object.defineProperty(derivedCtor.prototype, propName, basePropDescriptor); + } else { + derivedCtor.prototype[propName] = baseCtor.prototype[propName]; + } + }); + }); + } + function EMPTY_ALT(value2 = void 0) { + return function() { + return value2; + }; + } + function arrayMap22(array4, iteratee) { + var index = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2); + while (++index < length2) { + result[index] = iteratee(array4[index], index, array4); + } + return result; + } + function listCacheClear22() { + this.__data__ = []; + this.size = 0; + } + function eq22(value2, other) { + return value2 === other || value2 !== value2 && other !== other; + } + function assocIndexOf22(array4, key) { + var length2 = array4.length; + while (length2--) { + if (eq_default22(array4[length2][0], key)) { + return length2; + } + } + return -1; + } + function listCacheDelete22(key) { + var data5 = this.__data__, index = assocIndexOf_default22(data5, key); + if (index < 0) { + return false; + } + var lastIndex = data5.length - 1; + if (index == lastIndex) { + data5.pop(); + } else { + splice22.call(data5, index, 1); + } + --this.size; + return true; + } + function listCacheGet22(key) { + var data5 = this.__data__, index = assocIndexOf_default22(data5, key); + return index < 0 ? void 0 : data5[index][1]; + } + function listCacheHas22(key) { + return assocIndexOf_default22(this.__data__, key) > -1; + } + function listCacheSet22(key, value2) { + var data5 = this.__data__, index = assocIndexOf_default22(data5, key); + if (index < 0) { + ++this.size; + data5.push([key, value2]); + } else { + data5[index][1] = value2; + } + return this; + } + function ListCache22(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + function stackClear22() { + this.__data__ = new ListCache_default22(); + this.size = 0; + } + function stackDelete22(key) { + var data5 = this.__data__, result = data5["delete"](key); + this.size = data5.size; + return result; + } + function stackGet22(key) { + return this.__data__.get(key); + } + function stackHas22(key) { + return this.__data__.has(key); + } + function getRawTag22(value2) { + var isOwn = hasOwnProperty18.call(value2, symToStringTag32), tag = value2[symToStringTag32]; + try { + value2[symToStringTag32] = void 0; + var unmasked = true; + } catch (e3) { + } + var result = nativeObjectToString32.call(value2); + if (unmasked) { + if (isOwn) { + value2[symToStringTag32] = tag; + } else { + delete value2[symToStringTag32]; + } + } + return result; + } + function objectToString22(value2) { + return nativeObjectToString4.call(value2); + } + function baseGetTag22(value2) { + if (value2 == null) { + return value2 === void 0 ? undefinedTag22 : nullTag22; + } + return symToStringTag4 && symToStringTag4 in Object(value2) ? getRawTag_default22(value2) : objectToString_default22(value2); + } + function isObject22(value2) { + var type3 = typeof value2; + return value2 != null && (type3 == "object" || type3 == "function"); + } + function isFunction22(value2) { + if (!isObject_default22(value2)) { + return false; + } + var tag = baseGetTag_default22(value2); + return tag == funcTag42 || tag == genTag32 || tag == asyncTag22 || tag == proxyTag22; + } + function isMasked22(func) { + return !!maskSrcKey22 && maskSrcKey22 in func; + } + function toSource22(func) { + if (func != null) { + try { + return funcToString32.call(func); + } catch (e3) { + } + try { + return func + ""; + } catch (e3) { + } + } + return ""; + } + function baseIsNative22(value2) { + if (!isObject_default22(value2) || isMasked_default22(value2)) { + return false; + } + var pattern = isFunction_default22(value2) ? reIsNative22 : reIsHostCtor22; + return pattern.test(toSource_default22(value2)); + } + function getValue22(object3, key) { + return object3 == null ? void 0 : object3[key]; + } + function getNative22(object3, key) { + var value2 = getValue_default22(object3, key); + return baseIsNative_default22(value2) ? value2 : void 0; + } + function hashClear22() { + this.__data__ = nativeCreate_default22 ? nativeCreate_default22(null) : {}; + this.size = 0; + } + function hashDelete22(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; + } + function hashGet22(key) { + var data5 = this.__data__; + if (nativeCreate_default22) { + var result = data5[key]; + return result === HASH_UNDEFINED42 ? void 0 : result; + } + return hasOwnProperty20.call(data5, key) ? data5[key] : void 0; + } + function hashHas22(key) { + var data5 = this.__data__; + return nativeCreate_default22 ? data5[key] !== void 0 : hasOwnProperty21.call(data5, key); + } + function hashSet22(key, value2) { + var data5 = this.__data__; + this.size += this.has(key) ? 0 : 1; + data5[key] = nativeCreate_default22 && value2 === void 0 ? HASH_UNDEFINED5 : value2; + return this; + } + function Hash22(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + function mapCacheClear22() { + this.size = 0; + this.__data__ = { + "hash": new Hash_default22(), + "map": new (Map_default22 || ListCache_default22)(), + "string": new Hash_default22() + }; + } + function isKeyable22(value2) { + var type3 = typeof value2; + return type3 == "string" || type3 == "number" || type3 == "symbol" || type3 == "boolean" ? value2 !== "__proto__" : value2 === null; + } + function getMapData22(map32, key) { + var data5 = map32.__data__; + return isKeyable_default22(key) ? data5[typeof key == "string" ? "string" : "hash"] : data5.map; + } + function mapCacheDelete22(key) { + var result = getMapData_default22(this, key)["delete"](key); + this.size -= result ? 1 : 0; + return result; + } + function mapCacheGet22(key) { + return getMapData_default22(this, key).get(key); + } + function mapCacheHas22(key) { + return getMapData_default22(this, key).has(key); + } + function mapCacheSet22(key, value2) { + var data5 = getMapData_default22(this, key), size4 = data5.size; + data5.set(key, value2); + this.size += data5.size == size4 ? 0 : 1; + return this; + } + function MapCache22(entries2) { + var index = -1, length2 = entries2 == null ? 0 : entries2.length; + this.clear(); + while (++index < length2) { + var entry = entries2[index]; + this.set(entry[0], entry[1]); + } + } + function stackSet22(key, value2) { + var data5 = this.__data__; + if (data5 instanceof ListCache_default22) { + var pairs2 = data5.__data__; + if (!Map_default22 || pairs2.length < LARGE_ARRAY_SIZE4 - 1) { + pairs2.push([key, value2]); + this.size = ++data5.size; + return this; + } + data5 = this.__data__ = new MapCache_default22(pairs2); + } + data5.set(key, value2); + this.size = data5.size; + return this; + } + function Stack22(entries2) { + var data5 = this.__data__ = new ListCache_default22(entries2); + this.size = data5.size; + } + function setCacheAdd22(value2) { + this.__data__.set(value2, HASH_UNDEFINED6); + return this; + } + function setCacheHas22(value2) { + return this.__data__.has(value2); + } + function SetCache22(values22) { + var index = -1, length2 = values22 == null ? 0 : values22.length; + this.__data__ = new MapCache_default22(); + while (++index < length2) { + this.add(values22[index]); + } + } + function arraySome22(array4, predicate) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (predicate(array4[index], index, array4)) { + return true; + } + } + return false; + } + function cacheHas22(cache3, key) { + return cache3.has(key); + } + function equalArrays22(array4, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG72, arrLength = array4.length, othLength = other.length; + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + var arrStacked = stack.get(array4); + var othStacked = stack.get(other); + if (arrStacked && othStacked) { + return arrStacked == other && othStacked == array4; + } + var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG52 ? new SetCache_default22() : void 0; + stack.set(array4, other); + stack.set(other, array4); + while (++index < arrLength) { + var arrValue = array4[index], othValue = other[index]; + if (customizer) { + var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack) : customizer(arrValue, othValue, index, array4, other, stack); + } + if (compared !== void 0) { + if (compared) { + continue; + } + result = false; + break; + } + if (seen) { + if (!arraySome_default22(other, function(othValue2, othIndex) { + if (!cacheHas_default22(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + result = false; + break; + } + } + stack["delete"](array4); + stack["delete"](other); + return result; + } + function mapToArray22(map32) { + var index = -1, result = Array(map32.size); + map32.forEach(function(value2, key) { + result[++index] = [key, value2]; + }); + return result; + } + function setToArray22(set5) { + var index = -1, result = Array(set5.size); + set5.forEach(function(value2) { + result[++index] = value2; + }); + return result; + } + function equalByTag22(object3, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag62: + if (object3.byteLength != other.byteLength || object3.byteOffset != other.byteOffset) { + return false; + } + object3 = object3.buffer; + other = other.buffer; + case arrayBufferTag52: + if (object3.byteLength != other.byteLength || !equalFunc(new Uint8Array_default22(object3), new Uint8Array_default22(other))) { + return false; + } + return true; + case boolTag52: + case dateTag52: + case numberTag52: + return eq_default22(+object3, +other); + case errorTag42: + return object3.name == other.name && object3.message == other.message; + case regexpTag62: + case stringTag62: + return object3 == other + ""; + case mapTag82: + var convert = mapToArray_default22; + case setTag82: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG8; + convert || (convert = setToArray_default22); + if (object3.size != other.size && !isPartial) { + return false; + } + var stacked = stack.get(object3); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG6; + stack.set(object3, other); + var result = equalArrays_default22(convert(object3), convert(other), bitmask, customizer, equalFunc, stack); + stack["delete"](object3); + return result; + case symbolTag52: + if (symbolValueOf32) { + return symbolValueOf32.call(object3) == symbolValueOf32.call(other); + } + } + return false; + } + function arrayPush22(array4, values22) { + var index = -1, length2 = values22.length, offset = array4.length; + while (++index < length2) { + array4[offset + index] = values22[index]; + } + return array4; + } + function baseGetAllKeys22(object3, keysFunc, symbolsFunc) { + var result = keysFunc(object3); + return isArray_default22(object3) ? result : arrayPush_default22(result, symbolsFunc(object3)); + } + function arrayFilter22(array4, predicate) { + var index = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = []; + while (++index < length2) { + var value2 = array4[index]; + if (predicate(value2, index, array4)) { + result[resIndex++] = value2; + } + } + return result; + } + function stubArray22() { + return []; + } + function baseTimes22(n2, iteratee) { + var index = -1, result = Array(n2); + while (++index < n2) { + result[index] = iteratee(index); + } + return result; + } + function isObjectLike22(value2) { + return value2 != null && typeof value2 == "object"; + } + function baseIsArguments22(value2) { + return isObjectLike_default22(value2) && baseGetTag_default22(value2) == argsTag52; + } + function stubFalse22() { + return false; + } + function isIndex22(value2, length2) { + var type3 = typeof value2; + length2 = length2 == null ? MAX_SAFE_INTEGER32 : length2; + return !!length2 && (type3 == "number" || type3 != "symbol" && reIsUint22.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2); + } + function isLength22(value2) { + return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER4; + } + function baseIsTypedArray22(value2) { + return isObjectLike_default22(value2) && isLength_default22(value2.length) && !!typedArrayTags22[baseGetTag_default22(value2)]; + } + function baseUnary22(func) { + return function(value2) { + return func(value2); + }; + } + function arrayLikeKeys22(value2, inherited) { + var isArr = isArray_default22(value2), isArg = !isArr && isArguments_default22(value2), isBuff = !isArr && !isArg && isBuffer_default22(value2), isType2 = !isArr && !isArg && !isBuff && isTypedArray_default22(value2), skipIndexes = isArr || isArg || isBuff || isType2, result = skipIndexes ? baseTimes_default22(value2.length, String) : [], length2 = result.length; + for (var key in value2) { + if ((inherited || hasOwnProperty23.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. + (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType2 && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. + isIndex_default22(key, length2)))) { + result.push(key); + } + } + return result; + } + function isPrototype22(value2) { + var Ctor = value2 && value2.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto29; + return value2 === proto; + } + function overArg22(func, transform8) { + return function(arg) { + return func(transform8(arg)); + }; + } + function baseKeys22(object3) { + if (!isPrototype_default22(object3)) { + return nativeKeys_default22(object3); + } + var result = []; + for (var key in Object(object3)) { + if (hasOwnProperty24.call(object3, key) && key != "constructor") { + result.push(key); + } + } + return result; + } + function isArrayLike22(value2) { + return value2 != null && isLength_default22(value2.length) && !isFunction_default22(value2); + } + function keys22(object3) { + return isArrayLike_default22(object3) ? arrayLikeKeys_default22(object3) : baseKeys_default22(object3); + } + function getAllKeys22(object3) { + return baseGetAllKeys_default22(object3, keys_default22, getSymbols_default22); + } + function equalObjects22(object3, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG9, objProps = getAllKeys_default22(object3), objLength = objProps.length, othProps = getAllKeys_default22(other), othLength = othProps.length; + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty25.call(other, key))) { + return false; + } + } + var objStacked = stack.get(object3); + var othStacked = stack.get(other); + if (objStacked && othStacked) { + return objStacked == other && othStacked == object3; + } + var result = true; + stack.set(object3, other); + stack.set(other, object3); + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object3[key], othValue = other[key]; + if (customizer) { + var compared = isPartial ? customizer(othValue, objValue, key, other, object3, stack) : customizer(objValue, othValue, key, object3, other, stack); + } + if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result && !skipCtor) { + var objCtor = object3.constructor, othCtor = other.constructor; + if (objCtor != othCtor && ("constructor" in object3 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { + result = false; + } + } + stack["delete"](object3); + stack["delete"](other); + return result; + } + function baseIsEqualDeep22(object3, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray_default22(object3), othIsArr = isArray_default22(other), objTag = objIsArr ? arrayTag52 : getTag_default22(object3), othTag = othIsArr ? arrayTag52 : getTag_default22(other); + objTag = objTag == argsTag7 ? objectTag72 : objTag; + othTag = othTag == argsTag7 ? objectTag72 : othTag; + var objIsObj = objTag == objectTag72, othIsObj = othTag == objectTag72, isSameTag = objTag == othTag; + if (isSameTag && isBuffer_default22(object3)) { + if (!isBuffer_default22(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack_default22()); + return objIsArr || isTypedArray_default22(object3) ? equalArrays_default22(object3, other, bitmask, customizer, equalFunc, stack) : equalByTag_default22(object3, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG10)) { + var objIsWrapped = objIsObj && hasOwnProperty26.call(object3, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty26.call(other, "__wrapped__"); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object3.value() : object3, othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new Stack_default22()); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack_default22()); + return equalObjects_default22(object3, other, bitmask, customizer, equalFunc, stack); + } + function baseIsEqual22(value2, other, bitmask, customizer, stack) { + if (value2 === other) { + return true; + } + if (value2 == null || other == null || !isObjectLike_default22(value2) && !isObjectLike_default22(other)) { + return value2 !== value2 && other !== other; + } + return baseIsEqualDeep_default22(value2, other, bitmask, customizer, baseIsEqual22, stack); + } + function baseIsMatch22(object3, source, matchData, customizer) { + var index = matchData.length, length2 = index, noCustomizer = !customizer; + if (object3 == null) { + return !length2; + } + object3 = Object(object3); + while (index--) { + var data5 = matchData[index]; + if (noCustomizer && data5[2] ? data5[1] !== object3[data5[0]] : !(data5[0] in object3)) { + return false; + } + } + while (++index < length2) { + data5 = matchData[index]; + var key = data5[0], objValue = object3[key], srcValue = data5[1]; + if (noCustomizer && data5[2]) { + if (objValue === void 0 && !(key in object3)) { + return false; + } + } else { + var stack = new Stack_default22(); + if (customizer) { + var result = customizer(objValue, srcValue, key, object3, source, stack); + } + if (!(result === void 0 ? baseIsEqual_default22(srcValue, objValue, COMPARE_PARTIAL_FLAG11 | COMPARE_UNORDERED_FLAG7, customizer, stack) : result)) { + return false; + } + } + } + return true; + } + function isStrictComparable22(value2) { + return value2 === value2 && !isObject_default22(value2); + } + function getMatchData22(object3) { + var result = keys_default22(object3), length2 = result.length; + while (length2--) { + var key = result[length2], value2 = object3[key]; + result[length2] = [key, value2, isStrictComparable_default22(value2)]; + } + return result; + } + function matchesStrictComparable22(key, srcValue) { + return function(object3) { + if (object3 == null) { + return false; + } + return object3[key] === srcValue && (srcValue !== void 0 || key in Object(object3)); + }; + } + function baseMatches22(source) { + var matchData = getMatchData_default22(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable_default22(matchData[0][0], matchData[0][1]); + } + return function(object3) { + return object3 === source || baseIsMatch_default22(object3, source, matchData); + }; + } + function isSymbol22(value2) { + return typeof value2 == "symbol" || isObjectLike_default22(value2) && baseGetTag_default22(value2) == symbolTag62; + } + function isKey22(value2, object3) { + if (isArray_default22(value2)) { + return false; + } + var type3 = typeof value2; + if (type3 == "number" || type3 == "symbol" || type3 == "boolean" || value2 == null || isSymbol_default22(value2)) { + return true; + } + return reIsPlainProp22.test(value2) || !reIsDeepProp22.test(value2) || object3 != null && value2 in Object(object3); + } + function memoize22(func, resolver3) { + if (typeof func != "function" || resolver3 != null && typeof resolver3 != "function") { + throw new TypeError(FUNC_ERROR_TEXT3); + } + var memoized = /* @__PURE__ */ __name2(function() { + var args = arguments, key = resolver3 ? resolver3.apply(this, args) : args[0], cache3 = memoized.cache; + if (cache3.has(key)) { + return cache3.get(key); + } + var result = func.apply(this, args); + memoized.cache = cache3.set(key, result) || cache3; + return result; + }, "memoized"); + memoized.cache = new (memoize22.Cache || MapCache_default22)(); + return memoized; + } + function memoizeCapped22(func) { + var result = memoize_default22(func, function(key) { + if (cache3.size === MAX_MEMOIZE_SIZE22) { + cache3.clear(); + } + return key; + }); + var cache3 = result.cache; + return result; + } + function baseToString22(value2) { + if (typeof value2 == "string") { + return value2; + } + if (isArray_default22(value2)) { + return arrayMap_default22(value2, baseToString22) + ""; + } + if (isSymbol_default22(value2)) { + return symbolToString22 ? symbolToString22.call(value2) : ""; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -INFINITY52 ? "-0" : result; + } + function toString32(value2) { + return value2 == null ? "" : baseToString_default22(value2); + } + function castPath22(value2, object3) { + if (isArray_default22(value2)) { + return value2; + } + return isKey_default22(value2, object3) ? [value2] : stringToPath_default22(toString_default22(value2)); + } + function toKey22(value2) { + if (typeof value2 == "string" || isSymbol_default22(value2)) { + return value2; + } + var result = value2 + ""; + return result == "0" && 1 / value2 == -INFINITY6 ? "-0" : result; + } + function baseGet22(object3, path4) { + path4 = castPath_default22(path4, object3); + var index = 0, length2 = path4.length; + while (object3 != null && index < length2) { + object3 = object3[toKey_default22(path4[index++])]; + } + return index && index == length2 ? object3 : void 0; + } + function get22(object3, path4, defaultValue) { + var result = object3 == null ? void 0 : baseGet_default22(object3, path4); + return result === void 0 ? defaultValue : result; + } + function baseHasIn22(object3, key) { + return object3 != null && key in Object(object3); + } + function hasPath22(object3, path4, hasFunc) { + path4 = castPath_default22(path4, object3); + var index = -1, length2 = path4.length, result = false; + while (++index < length2) { + var key = toKey_default22(path4[index]); + if (!(result = object3 != null && hasFunc(object3, key))) { + break; + } + object3 = object3[key]; + } + if (result || ++index != length2) { + return result; + } + length2 = object3 == null ? 0 : object3.length; + return !!length2 && isLength_default22(length2) && isIndex_default22(key, length2) && (isArray_default22(object3) || isArguments_default22(object3)); + } + function hasIn22(object3, path4) { + return object3 != null && hasPath_default22(object3, path4, baseHasIn_default22); + } + function baseMatchesProperty22(path4, srcValue) { + if (isKey_default22(path4) && isStrictComparable_default22(srcValue)) { + return matchesStrictComparable_default22(toKey_default22(path4), srcValue); + } + return function(object3) { + var objValue = get_default22(object3, path4); + return objValue === void 0 && objValue === srcValue ? hasIn_default22(object3, path4) : baseIsEqual_default22(srcValue, objValue, COMPARE_PARTIAL_FLAG12 | COMPARE_UNORDERED_FLAG8); + }; + } + function identity22(value2) { + return value2; + } + function baseProperty22(key) { + return function(object3) { + return object3 == null ? void 0 : object3[key]; + }; + } + function basePropertyDeep22(path4) { + return function(object3) { + return baseGet_default22(object3, path4); + }; + } + function property22(path4) { + return isKey_default22(path4) ? baseProperty_default22(toKey_default22(path4)) : basePropertyDeep_default22(path4); + } + function baseIteratee22(value2) { + if (typeof value2 == "function") { + return value2; + } + if (value2 == null) { + return identity_default22; + } + if (typeof value2 == "object") { + return isArray_default22(value2) ? baseMatchesProperty_default22(value2[0], value2[1]) : baseMatches_default22(value2); + } + return property_default22(value2); + } + function createBaseFor22(fromRight) { + return function(object3, iteratee, keysFunc) { + var index = -1, iterable = Object(object3), props = keysFunc(object3), length2 = props.length; + while (length2--) { + var key = props[fromRight ? length2 : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object3; + }; + } + function baseForOwn22(object3, iteratee) { + return object3 && baseFor_default22(object3, iteratee, keys_default22); + } + function createBaseEach22(eachFunc, fromRight) { + return function(collection4, iteratee) { + if (collection4 == null) { + return collection4; + } + if (!isArrayLike_default22(collection4)) { + return eachFunc(collection4, iteratee); + } + var length2 = collection4.length, index = fromRight ? length2 : -1, iterable = Object(collection4); + while (fromRight ? index-- : ++index < length2) { + if (iteratee(iterable[index], index, iterable) === false) { + break; + } + } + return collection4; + }; + } + function baseMap22(collection4, iteratee) { + var index = -1, result = isArrayLike_default22(collection4) ? Array(collection4.length) : []; + baseEach_default22(collection4, function(value2, key, collection22) { + result[++index] = iteratee(value2, key, collection22); + }); + return result; + } + function map22(collection4, iteratee) { + var func = isArray_default22(collection4) ? arrayMap_default22 : baseMap_default22; + return func(collection4, baseIteratee_default22(iteratee, 3)); + } + function baseFilter22(collection4, predicate) { + var result = []; + baseEach_default22(collection4, function(value2, index, collection22) { + if (predicate(value2, index, collection22)) { + result.push(value2); + } + }); + return result; + } + function filter22(collection4, predicate) { + var func = isArray_default22(collection4) ? arrayFilter_default22 : baseFilter_default22; + return func(collection4, baseIteratee_default22(predicate, 3)); + } + function buildATNKey(rule, type3, occurrence) { + return `${rule.name}_${type3}_${occurrence}`; + } + function createATN(rules) { + const atn = { + decisionMap: {}, + decisionStates: [], + ruleToStartState: /* @__PURE__ */ new Map(), + ruleToStopState: /* @__PURE__ */ new Map(), + states: [] + }; + createRuleStartAndStopATNStates(atn, rules); + const ruleLength = rules.length; + for (let i2 = 0; i2 < ruleLength; i2++) { + const rule = rules[i2]; + const ruleBlock = block(atn, rule, rule); + if (ruleBlock === void 0) { + continue; + } + buildRuleHandle(atn, rule, ruleBlock); + } + return atn; + } + function createRuleStartAndStopATNStates(atn, rules) { + const ruleLength = rules.length; + for (let i2 = 0; i2 < ruleLength; i2++) { + const rule = rules[i2]; + const start3 = newState(atn, rule, void 0, { + type: ATN_RULE_START + }); + const stop5 = newState(atn, rule, void 0, { + type: ATN_RULE_STOP + }); + start3.stop = stop5; + atn.ruleToStartState.set(rule, start3); + atn.ruleToStopState.set(rule, stop5); + } + } + function atom(atn, rule, production) { + if (production instanceof Terminal) { + return tokenRef(atn, rule, production.terminalType, production); + } else if (production instanceof NonTerminal) { + return ruleRef(atn, rule, production); + } else if (production instanceof Alternation) { + return alternation(atn, rule, production); + } else if (production instanceof Option2) { + return option(atn, rule, production); + } else if (production instanceof Repetition) { + return repetition(atn, rule, production); + } else if (production instanceof RepetitionWithSeparator) { + return repetitionSep(atn, rule, production); + } else if (production instanceof RepetitionMandatory) { + return repetitionMandatory(atn, rule, production); + } else if (production instanceof RepetitionMandatoryWithSeparator) { + return repetitionMandatorySep(atn, rule, production); + } else { + return block(atn, rule, production); + } + } + function repetition(atn, rule, repetition2) { + const starState = newState(atn, rule, repetition2, { + type: ATN_STAR_BLOCK_START + }); + defineDecisionState(atn, starState); + const handle = makeAlts(atn, rule, starState, repetition2, block(atn, rule, repetition2)); + return star(atn, rule, repetition2, handle); + } + function repetitionSep(atn, rule, repetition2) { + const starState = newState(atn, rule, repetition2, { + type: ATN_STAR_BLOCK_START + }); + defineDecisionState(atn, starState); + const handle = makeAlts(atn, rule, starState, repetition2, block(atn, rule, repetition2)); + const sep2 = tokenRef(atn, rule, repetition2.separator, repetition2); + return star(atn, rule, repetition2, handle, sep2); + } + function repetitionMandatory(atn, rule, repetition2) { + const plusState = newState(atn, rule, repetition2, { + type: ATN_PLUS_BLOCK_START + }); + defineDecisionState(atn, plusState); + const handle = makeAlts(atn, rule, plusState, repetition2, block(atn, rule, repetition2)); + return plus(atn, rule, repetition2, handle); + } + function repetitionMandatorySep(atn, rule, repetition2) { + const plusState = newState(atn, rule, repetition2, { + type: ATN_PLUS_BLOCK_START + }); + defineDecisionState(atn, plusState); + const handle = makeAlts(atn, rule, plusState, repetition2, block(atn, rule, repetition2)); + const sep2 = tokenRef(atn, rule, repetition2.separator, repetition2); + return plus(atn, rule, repetition2, handle, sep2); + } + function alternation(atn, rule, alternation2) { + const start3 = newState(atn, rule, alternation2, { + type: ATN_BASIC + }); + defineDecisionState(atn, start3); + const alts = map_default22(alternation2.definition, (e3) => atom(atn, rule, e3)); + const handle = makeAlts(atn, rule, start3, alternation2, ...alts); + return handle; + } + function option(atn, rule, option2) { + const start3 = newState(atn, rule, option2, { + type: ATN_BASIC + }); + defineDecisionState(atn, start3); + const handle = makeAlts(atn, rule, start3, option2, block(atn, rule, option2)); + return optional(atn, rule, option2, handle); + } + function block(atn, rule, block2) { + const handles = filter_default22(map_default22(block2.definition, (e3) => atom(atn, rule, e3)), (e3) => e3 !== void 0); + if (handles.length === 1) { + return handles[0]; + } else if (handles.length === 0) { + return void 0; + } else { + return makeBlock(atn, handles); + } + } + function plus(atn, rule, plus2, handle, sep2) { + const blkStart = handle.left; + const blkEnd = handle.right; + const loop = newState(atn, rule, plus2, { + type: ATN_PLUS_LOOP_BACK + }); + defineDecisionState(atn, loop); + const end2 = newState(atn, rule, plus2, { + type: ATN_LOOP_END + }); + blkStart.loopback = loop; + end2.loopback = loop; + atn.decisionMap[buildATNKey(rule, sep2 ? "RepetitionMandatoryWithSeparator" : "RepetitionMandatory", plus2.idx)] = loop; + epsilon4(blkEnd, loop); + if (sep2 === void 0) { + epsilon4(loop, blkStart); + epsilon4(loop, end2); + } else { + epsilon4(loop, end2); + epsilon4(loop, sep2.left); + epsilon4(sep2.right, blkStart); + } + return { + left: blkStart, + right: end2 + }; + } + function star(atn, rule, star2, handle, sep2) { + const start3 = handle.left; + const end2 = handle.right; + const entry = newState(atn, rule, star2, { + type: ATN_STAR_LOOP_ENTRY + }); + defineDecisionState(atn, entry); + const loopEnd = newState(atn, rule, star2, { + type: ATN_LOOP_END + }); + const loop = newState(atn, rule, star2, { + type: ATN_STAR_LOOP_BACK + }); + entry.loopback = loop; + loopEnd.loopback = loop; + epsilon4(entry, start3); + epsilon4(entry, loopEnd); + epsilon4(end2, loop); + if (sep2 !== void 0) { + epsilon4(loop, loopEnd); + epsilon4(loop, sep2.left); + epsilon4(sep2.right, start3); + } else { + epsilon4(loop, entry); + } + atn.decisionMap[buildATNKey(rule, sep2 ? "RepetitionWithSeparator" : "Repetition", star2.idx)] = entry; + return { + left: entry, + right: loopEnd + }; + } + function optional(atn, rule, optional2, handle) { + const start3 = handle.left; + const end2 = handle.right; + epsilon4(start3, end2); + atn.decisionMap[buildATNKey(rule, "Option", optional2.idx)] = start3; + return handle; + } + function defineDecisionState(atn, state4) { + atn.decisionStates.push(state4); + state4.decision = atn.decisionStates.length - 1; + return state4.decision; + } + function makeAlts(atn, rule, start3, production, ...alts) { + const end2 = newState(atn, rule, production, { + type: ATN_BLOCK_END, + start: start3 + }); + start3.end = end2; + for (const alt of alts) { + if (alt !== void 0) { + epsilon4(start3, alt.left); + epsilon4(alt.right, end2); + } else { + epsilon4(start3, end2); + } + } + const handle = { + left: start3, + right: end2 + }; + atn.decisionMap[buildATNKey(rule, getProdType2(production), production.idx)] = start3; + return handle; + } + function getProdType2(production) { + if (production instanceof Alternation) { + return "Alternation"; + } else if (production instanceof Option2) { + return "Option"; + } else if (production instanceof Repetition) { + return "Repetition"; + } else if (production instanceof RepetitionWithSeparator) { + return "RepetitionWithSeparator"; + } else if (production instanceof RepetitionMandatory) { + return "RepetitionMandatory"; + } else if (production instanceof RepetitionMandatoryWithSeparator) { + return "RepetitionMandatoryWithSeparator"; + } else { + throw new Error("Invalid production type encountered"); + } + } + function makeBlock(atn, alts) { + const altsLength = alts.length; + for (let i2 = 0; i2 < altsLength - 1; i2++) { + const handle = alts[i2]; + let transition2; + if (handle.left.transitions.length === 1) { + transition2 = handle.left.transitions[0]; + } + const isRuleTransition = transition2 instanceof RuleTransition; + const ruleTransition = transition2; + const next3 = alts[i2 + 1].left; + if (handle.left.type === ATN_BASIC && handle.right.type === ATN_BASIC && transition2 !== void 0 && (isRuleTransition && ruleTransition.followState === handle.right || transition2.target === handle.right)) { + if (isRuleTransition) { + ruleTransition.followState = next3; + } else { + transition2.target = next3; + } + removeState(atn, handle.right); + } else { + epsilon4(handle.right, next3); + } + } + const first22 = alts[0]; + const last22 = alts[altsLength - 1]; + return { + left: first22.left, + right: last22.right + }; + } + function tokenRef(atn, rule, tokenType, production) { + const left3 = newState(atn, rule, production, { + type: ATN_BASIC + }); + const right3 = newState(atn, rule, production, { + type: ATN_BASIC + }); + addTransition(left3, new AtomTransition(right3, tokenType)); + return { + left: left3, + right: right3 + }; + } + function ruleRef(atn, currentRule, nonTerminal) { + const rule = nonTerminal.referencedRule; + const start3 = atn.ruleToStartState.get(rule); + const left3 = newState(atn, currentRule, nonTerminal, { + type: ATN_BASIC + }); + const right3 = newState(atn, currentRule, nonTerminal, { + type: ATN_BASIC + }); + const call = new RuleTransition(start3, rule, right3); + addTransition(left3, call); + return { + left: left3, + right: right3 + }; + } + function buildRuleHandle(atn, rule, block2) { + const start3 = atn.ruleToStartState.get(rule); + epsilon4(start3, block2.left); + const stop5 = atn.ruleToStopState.get(rule); + epsilon4(block2.right, stop5); + const handle = { + left: start3, + right: stop5 + }; + return handle; + } + function epsilon4(a2, b3) { + const transition2 = new EpsilonTransition(b3); + addTransition(a2, transition2); + } + function newState(atn, rule, production, partial) { + const t4 = Object.assign({ + atn, + production, + epsilonOnlyTransitions: false, + rule, + transitions: [], + nextTokenWithinRule: [], + stateNumber: atn.states.length + }, partial); + atn.states.push(t4); + return t4; + } + function addTransition(state4, transition2) { + if (state4.transitions.length === 0) { + state4.epsilonOnlyTransitions = transition2.isEpsilon(); + } + state4.transitions.push(transition2); + } + function removeState(atn, state4) { + atn.states.splice(atn.states.indexOf(state4), 1); + } + function getATNConfigKey(config5, alt = true) { + return `${alt ? `a${config5.alt}` : ""}s${config5.state.stateNumber}:${config5.stack.map((e3) => e3.stateNumber.toString()).join("_")}`; + } + function baseExtremum2(array4, iteratee, comparator) { + var index = -1, length2 = array4.length; + while (++index < length2) { + var value2 = array4[index], current = iteratee(value2); + if (current != null && (computed === void 0 ? current === current && !isSymbol_default22(current) : comparator(current, computed))) { + var computed = current, result = value2; + } + } + return result; + } + function baseLt2(value2, other) { + return value2 < other; + } + function min8(array4) { + return array4 && array4.length ? baseExtremum_default2(array4, identity_default22, baseLt_default2) : void 0; + } + function isFlattenable22(value2) { + return isArray_default22(value2) || isArguments_default22(value2) || !!(spreadableSymbol22 && value2 && value2[spreadableSymbol22]); + } + function baseFlatten22(array4, depth, predicate, isStrict, result) { + var index = -1, length2 = array4.length; + predicate || (predicate = isFlattenable_default22); + result || (result = []); + while (++index < length2) { + var value2 = array4[index]; + if (depth > 0 && predicate(value2)) { + if (depth > 1) { + baseFlatten22(value2, depth - 1, predicate, isStrict, result); + } else { + arrayPush_default22(result, value2); + } + } else if (!isStrict) { + result[result.length] = value2; + } + } + return result; + } + function flatMap2(collection4, iteratee) { + return baseFlatten_default22(map_default22(collection4, iteratee), 1); + } + function baseFindIndex22(array4, predicate, fromIndex, fromRight) { + var length2 = array4.length, index = fromIndex + (fromRight ? 1 : -1); + while (fromRight ? index-- : ++index < length2) { + if (predicate(array4[index], index, array4)) { + return index; + } + } + return -1; + } + function baseIsNaN22(value2) { + return value2 !== value2; + } + function strictIndexOf22(array4, value2, fromIndex) { + var index = fromIndex - 1, length2 = array4.length; + while (++index < length2) { + if (array4[index] === value2) { + return index; + } + } + return -1; + } + function baseIndexOf22(array4, value2, fromIndex) { + return value2 === value2 ? strictIndexOf_default22(array4, value2, fromIndex) : baseFindIndex_default22(array4, baseIsNaN_default22, fromIndex); + } + function arrayIncludes22(array4, value2) { + var length2 = array4 == null ? 0 : array4.length; + return !!length2 && baseIndexOf_default22(array4, value2, 0) > -1; + } + function arrayIncludesWith22(array4, value2, comparator) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (comparator(value2, array4[index])) { + return true; + } + } + return false; + } + function noop22() { + } + function baseUniq22(array4, iteratee, comparator) { + var index = -1, includes22 = arrayIncludes_default22, length2 = array4.length, isCommon = true, result = [], seen = result; + if (comparator) { + isCommon = false; + includes22 = arrayIncludesWith_default22; + } else if (length2 >= LARGE_ARRAY_SIZE5) { + var set5 = iteratee ? null : createSet_default22(array4); + if (set5) { + return setToArray_default22(set5); + } + isCommon = false; + includes22 = cacheHas_default22; + seen = new SetCache_default22(); + } else { + seen = iteratee ? [] : result; + } + outer: + while (++index < length2) { + var value2 = array4[index], computed = iteratee ? iteratee(value2) : value2; + value2 = comparator || value2 !== 0 ? value2 : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; + } + } + if (iteratee) { + seen.push(computed); + } + result.push(value2); + } else if (!includes22(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value2); + } + } + return result; + } + function uniqBy(array4, iteratee) { + return array4 && array4.length ? baseUniq_default22(array4, baseIteratee_default22(iteratee, 2)) : []; + } + function flatten22(array4) { + var length2 = array4 == null ? 0 : array4.length; + return length2 ? baseFlatten_default22(array4, 1) : []; + } + function arrayEach22(array4, iteratee) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + while (++index < length2) { + if (iteratee(array4[index], index, array4) === false) { + break; + } + } + return array4; + } + function castFunction22(value2) { + return typeof value2 == "function" ? value2 : identity_default22; + } + function forEach22(collection4, iteratee) { + var func = isArray_default22(collection4) ? arrayEach_default22 : baseEach_default22; + return func(collection4, castFunction_default22(iteratee)); + } + function isEmpty22(value2) { + if (value2 == null) { + return true; + } + if (isArrayLike_default22(value2) && (isArray_default22(value2) || typeof value2 == "string" || typeof value2.splice == "function" || isBuffer_default22(value2) || isTypedArray_default22(value2) || isArguments_default22(value2))) { + return !value2.length; + } + var tag = getTag_default22(value2); + if (tag == mapTag11 || tag == setTag11) { + return !value2.size; + } + if (isPrototype_default22(value2)) { + return !baseKeys_default22(value2).length; + } + for (var key in value2) { + if (hasOwnProperty27.call(value2, key)) { + return false; + } + } + return true; + } + function arrayReduce22(array4, iteratee, accumulator, initAccum) { + var index = -1, length2 = array4 == null ? 0 : array4.length; + if (initAccum && length2) { + accumulator = array4[++index]; + } + while (++index < length2) { + accumulator = iteratee(accumulator, array4[index], index, array4); + } + return accumulator; + } + function baseReduce22(collection4, iteratee, accumulator, initAccum, eachFunc) { + eachFunc(collection4, function(value2, index, collection22) { + accumulator = initAccum ? (initAccum = false, value2) : iteratee(accumulator, value2, index, collection22); + }); + return accumulator; + } + function reduce22(collection4, iteratee, accumulator) { + var func = isArray_default22(collection4) ? arrayReduce_default22 : baseReduce_default22, initAccum = arguments.length < 3; + return func(collection4, baseIteratee_default22(iteratee, 4), accumulator, initAccum, baseEach_default22); + } + function createDFACache(startState, decision) { + const map32 = {}; + return (predicateSet) => { + const key = predicateSet.toString(); + let existing = map32[key]; + if (existing !== void 0) { + return existing; + } else { + existing = { + atnStartState: startState, + decision, + states: {} + }; + map32[key] = existing; + return existing; + } + }; + } + function isLL1Sequence(sequences, allowEmpty = true) { + const fullSet = /* @__PURE__ */ new Set(); + for (const alt of sequences) { + const altSet = /* @__PURE__ */ new Set(); + for (const tokType of alt) { + if (tokType === void 0) { + if (allowEmpty) { + break; + } else { + return false; + } + } + const indices = [tokType.tokenTypeIdx].concat(tokType.categoryMatches); + for (const index of indices) { + if (fullSet.has(index)) { + if (!altSet.has(index)) { + return false; + } + } else { + fullSet.add(index); + altSet.add(index); + } + } + } + } + return true; + } + function initATNSimulator(atn) { + const decisionLength = atn.decisionStates.length; + const decisionToDFA = Array(decisionLength); + for (let i2 = 0; i2 < decisionLength; i2++) { + decisionToDFA[i2] = createDFACache(atn.decisionStates[i2], i2); + } + return decisionToDFA; + } + function adaptivePredict(dfaCaches, decision, predicateSet, logging) { + const dfa = dfaCaches[decision](predicateSet); + let start3 = dfa.start; + if (start3 === void 0) { + const closure2 = computeStartState(dfa.atnStartState); + start3 = addDFAState(dfa, newDFAState(closure2)); + dfa.start = start3; + } + const alt = performLookahead.apply(this, [dfa, start3, predicateSet, logging]); + return alt; + } + function performLookahead(dfa, s0, predicateSet, logging) { + let previousD = s0; + let i2 = 1; + const path4 = []; + let t4 = this.LA(i2++); + while (true) { + let d3 = getExistingTargetState(previousD, t4); + if (d3 === void 0) { + d3 = computeLookaheadTarget.apply(this, [dfa, previousD, t4, i2, predicateSet, logging]); + } + if (d3 === DFA_ERROR) { + return buildAdaptivePredictError(path4, previousD, t4); + } + if (d3.isAcceptState === true) { + return d3.prediction; + } + previousD = d3; + path4.push(t4); + t4 = this.LA(i2++); + } + } + function computeLookaheadTarget(dfa, previousD, token2, lookahead, predicateSet, logging) { + const reach = computeReachSet(previousD.configs, token2, predicateSet); + if (reach.size === 0) { + addDFAEdge(dfa, previousD, token2, DFA_ERROR); + return DFA_ERROR; + } + let newState2 = newDFAState(reach); + const predictedAlt = getUniqueAlt(reach, predicateSet); + if (predictedAlt !== void 0) { + newState2.isAcceptState = true; + newState2.prediction = predictedAlt; + newState2.configs.uniqueAlt = predictedAlt; + } else if (hasConflictTerminatingPrediction(reach)) { + const prediction = min_default2(reach.alts); + newState2.isAcceptState = true; + newState2.prediction = prediction; + newState2.configs.uniqueAlt = prediction; + reportLookaheadAmbiguity.apply(this, [dfa, lookahead, reach.alts, logging]); + } + newState2 = addDFAEdge(dfa, previousD, token2, newState2); + return newState2; + } + function reportLookaheadAmbiguity(dfa, lookahead, ambiguityIndices, logging) { + const prefixPath = []; + for (let i2 = 1; i2 <= lookahead; i2++) { + prefixPath.push(this.LA(i2).tokenType); + } + const atnState = dfa.atnStartState; + const topLevelRule = atnState.rule; + const production = atnState.production; + const message = buildAmbiguityError({ + topLevelRule, + ambiguityIndices, + production, + prefixPath + }); + logging(message); + } + function buildAmbiguityError(options2) { + const pathMsg = map_default22(options2.prefixPath, (currtok) => tokenLabel2(currtok)).join(", "); + const occurrence = options2.production.idx === 0 ? "" : options2.production.idx; + let currMessage = `Ambiguous Alternatives Detected: <${options2.ambiguityIndices.join(", ")}> in <${getProductionDslName2(options2.production)}${occurrence}> inside <${options2.topLevelRule.name}> Rule, +<${pathMsg}> may appears as a prefix path in all these alternatives. +`; + currMessage = currMessage + `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES +For Further details.`; + return currMessage; + } + function getProductionDslName2(prod) { + if (prod instanceof NonTerminal) { + return "SUBRULE"; + } else if (prod instanceof Option2) { + return "OPTION"; + } else if (prod instanceof Alternation) { + return "OR"; + } else if (prod instanceof RepetitionMandatory) { + return "AT_LEAST_ONE"; + } else if (prod instanceof RepetitionMandatoryWithSeparator) { + return "AT_LEAST_ONE_SEP"; + } else if (prod instanceof RepetitionWithSeparator) { + return "MANY_SEP"; + } else if (prod instanceof Repetition) { + return "MANY"; + } else if (prod instanceof Terminal) { + return "CONSUME"; + } else { + throw Error("non exhaustive match"); + } + } + function buildAdaptivePredictError(path4, previous, current) { + const nextTransitions = flatMap_default2(previous.configs.elements, (e3) => e3.state.transitions); + const nextTokenTypes = uniqBy_default(nextTransitions.filter((e3) => e3 instanceof AtomTransition).map((e3) => e3.tokenType), (e3) => e3.tokenTypeIdx); + return { + actualToken: current, + possibleTokenTypes: nextTokenTypes, + tokenPath: path4 + }; + } + function getExistingTargetState(state4, token2) { + return state4.edges[token2.tokenTypeIdx]; + } + function computeReachSet(configs, token2, predicateSet) { + const intermediate = new ATNConfigSet(); + const skippedStopStates = []; + for (const c3 of configs.elements) { + if (predicateSet.is(c3.alt) === false) { + continue; + } + if (c3.state.type === ATN_RULE_STOP) { + skippedStopStates.push(c3); + continue; + } + const transitionLength = c3.state.transitions.length; + for (let i2 = 0; i2 < transitionLength; i2++) { + const transition2 = c3.state.transitions[i2]; + const target = getReachableTarget(transition2, token2); + if (target !== void 0) { + intermediate.add({ + state: target, + alt: c3.alt, + stack: c3.stack + }); + } + } + } + let reach; + if (skippedStopStates.length === 0 && intermediate.size === 1) { + reach = intermediate; + } + if (reach === void 0) { + reach = new ATNConfigSet(); + for (const c3 of intermediate.elements) { + closure(c3, reach); + } + } + if (skippedStopStates.length > 0 && !hasConfigInRuleStopState(reach)) { + for (const c3 of skippedStopStates) { + reach.add(c3); + } + } + return reach; + } + function getReachableTarget(transition2, token2) { + if (transition2 instanceof AtomTransition && tokenMatcher(token2, transition2.tokenType)) { + return transition2.target; + } + return void 0; + } + function getUniqueAlt(configs, predicateSet) { + let alt; + for (const c3 of configs.elements) { + if (predicateSet.is(c3.alt) === true) { + if (alt === void 0) { + alt = c3.alt; + } else if (alt !== c3.alt) { + return void 0; + } + } + } + return alt; + } + function newDFAState(closure2) { + return { + configs: closure2, + edges: {}, + isAcceptState: false, + prediction: -1 + }; + } + function addDFAEdge(dfa, from2, token2, to) { + to = addDFAState(dfa, to); + from2.edges[token2.tokenTypeIdx] = to; + return to; + } + function addDFAState(dfa, state4) { + if (state4 === DFA_ERROR) { + return state4; + } + const mapKey = state4.configs.key; + const existing = dfa.states[mapKey]; + if (existing !== void 0) { + return existing; + } + state4.configs.finalize(); + dfa.states[mapKey] = state4; + return state4; + } + function computeStartState(atnState) { + const configs = new ATNConfigSet(); + const numberOfTransitions = atnState.transitions.length; + for (let i2 = 0; i2 < numberOfTransitions; i2++) { + const target = atnState.transitions[i2].target; + const config5 = { + state: target, + alt: i2, + stack: [] + }; + closure(config5, configs); + } + return configs; + } + function closure(config5, configs) { + const p3 = config5.state; + if (p3.type === ATN_RULE_STOP) { + if (config5.stack.length > 0) { + const atnStack = [...config5.stack]; + const followState = atnStack.pop(); + const followConfig = { + state: followState, + alt: config5.alt, + stack: atnStack + }; + closure(followConfig, configs); + } else { + configs.add(config5); + } + return; + } + if (!p3.epsilonOnlyTransitions) { + configs.add(config5); + } + const transitionLength = p3.transitions.length; + for (let i2 = 0; i2 < transitionLength; i2++) { + const transition2 = p3.transitions[i2]; + const c3 = getEpsilonTarget(config5, transition2); + if (c3 !== void 0) { + closure(c3, configs); + } + } + } + function getEpsilonTarget(config5, transition2) { + if (transition2 instanceof EpsilonTransition) { + return { + state: transition2.target, + alt: config5.alt, + stack: config5.stack + }; + } else if (transition2 instanceof RuleTransition) { + const stack = [...config5.stack, transition2.followState]; + return { + state: transition2.target, + alt: config5.alt, + stack + }; + } + return void 0; + } + function hasConfigInRuleStopState(configs) { + for (const c3 of configs.elements) { + if (c3.state.type === ATN_RULE_STOP) { + return true; + } + } + return false; + } + function allConfigsInRuleStopStates(configs) { + for (const c3 of configs.elements) { + if (c3.state.type !== ATN_RULE_STOP) { + return false; + } + } + return true; + } + function hasConflictTerminatingPrediction(configs) { + if (allConfigsInRuleStopStates(configs)) { + return true; + } + const altSets = getConflictingAltSets(configs.elements); + const heuristic2 = hasConflictingAltSet(altSets) && !hasStateAssociatedWithOneAlt(altSets); + return heuristic2; + } + function getConflictingAltSets(configs) { + const configToAlts = /* @__PURE__ */ new Map(); + for (const c3 of configs) { + const key = getATNConfigKey(c3, false); + let alts = configToAlts.get(key); + if (alts === void 0) { + alts = {}; + configToAlts.set(key, alts); + } + alts[c3.alt] = true; + } + return configToAlts; + } + function hasConflictingAltSet(altSets) { + for (const value2 of Array.from(altSets.values())) { + if (Object.keys(value2).length > 1) { + return true; + } + } + return false; + } + function hasStateAssociatedWithOneAlt(altSets) { + for (const value2 of Array.from(altSets.values())) { + if (Object.keys(value2).length === 1) { + return true; + } + } + return false; + } + function isDataTypeNode(node2) { + return node2.$type === DatatypeSymbol; + } + function createParser(grammar, parser29, tokens2) { + const parserContext = { + parser: parser29, + tokens: tokens2, + ruleNames: /* @__PURE__ */ new Map() + }; + buildRules(parserContext, grammar); + return parser29; + } + function buildRules(parserContext, grammar) { + const reachable = getAllReachableRules(grammar, false); + const parserRules = stream(grammar.rules).filter(isParserRule).filter((rule) => reachable.has(rule)); + for (const rule of parserRules) { + const ctx = { + ...parserContext, + consume: 1, + optional: 1, + subrule: 1, + many: 1, + or: 1 + }; + parserContext.parser.rule(rule, buildElement(ctx, rule.definition)); + } + const infixRules = stream(grammar.rules).filter(isInfixRule).filter((rule) => reachable.has(rule)); + for (const rule of infixRules) { + parserContext.parser.rule(rule, buildInfixRule(parserContext, rule)); + } + } + function buildInfixRule(ctx, rule) { + const expressionRule = rule.call.rule.ref; + if (!expressionRule) { + throw new Error("Could not resolve reference to infix operator rule: " + rule.call.rule.$refText); + } + if (isTerminalRule(expressionRule)) { + throw new Error("Cannot use terminal rule in infix expression"); + } + const allKeywords = rule.operators.precedences.flatMap((e3) => e3.operators); + const outerGroup = { + $type: "Group", + elements: [] + }; + const part1Assignment = { + $container: outerGroup, + $type: "Assignment", + feature: "parts", + operator: "+=", + terminal: rule.call + }; + const innerGroup = { + $container: outerGroup, + $type: "Group", + elements: [], + cardinality: "*" + }; + outerGroup.elements.push(part1Assignment, innerGroup); + const alternatives = { + $type: "Alternatives", + elements: allKeywords + }; + const operatorAssignment = { + $container: innerGroup, + $type: "Assignment", + feature: "operators", + operator: "+=", + terminal: alternatives + }; + const part2Assignment = { + ...part1Assignment, + $container: innerGroup + }; + innerGroup.elements.push(operatorAssignment, part2Assignment); + const tokens2 = allKeywords.map((e3) => ctx.tokens[e3.value]); + const orAlts = tokens2.map((token2, index) => ({ + ALT: /* @__PURE__ */ __name2(() => ctx.parser.consume(index, token2, operatorAssignment), "ALT") + })); + let subrule; + return (args) => { + subrule ?? (subrule = getRule(ctx, expressionRule)); + ctx.parser.subrule(0, subrule, false, part1Assignment, args); + ctx.parser.many(0, { + DEF: /* @__PURE__ */ __name2(() => { + ctx.parser.alternatives(0, orAlts); + ctx.parser.subrule(1, subrule, false, part2Assignment, args); + }, "DEF") + }); + }; + } + function buildElement(ctx, element3, ignoreGuard = false) { + let method; + if (isKeyword(element3)) { + method = buildKeyword(ctx, element3); + } else if (isAction(element3)) { + method = buildAction(ctx, element3); + } else if (isAssignment(element3)) { + method = buildElement(ctx, element3.terminal); + } else if (isCrossReference(element3)) { + method = buildCrossReference(ctx, element3); + } else if (isRuleCall(element3)) { + method = buildRuleCall(ctx, element3); + } else if (isAlternatives(element3)) { + method = buildAlternatives(ctx, element3); + } else if (isUnorderedGroup(element3)) { + method = buildUnorderedGroup(ctx, element3); + } else if (isGroup(element3)) { + method = buildGroup4(ctx, element3); + } else if (isEndOfFile(element3)) { + const idx = ctx.consume++; + method = /* @__PURE__ */ __name2(() => ctx.parser.consume(idx, EOF, element3), "method"); + } else { + throw new ErrorWithLocation(element3.$cstNode, `Unexpected element type: ${element3.$type}`); + } + return wrap(ctx, ignoreGuard ? void 0 : getGuardCondition(element3), method, element3.cardinality); + } + function buildAction(ctx, action) { + const actionType = getTypeName(action); + return () => ctx.parser.action(actionType, action); + } + function buildRuleCall(ctx, ruleCall) { + const rule = ruleCall.rule.ref; + if (isAbstractParserRule(rule)) { + const idx = ctx.subrule++; + const fragment = isParserRule(rule) && rule.fragment; + const predicate = ruleCall.arguments.length > 0 ? buildRuleCallPredicate(rule, ruleCall.arguments) : () => ({}); + let subrule; + return (args) => { + subrule ?? (subrule = getRule(ctx, rule)); + ctx.parser.subrule(idx, subrule, fragment, ruleCall, predicate(args)); + }; + } else if (isTerminalRule(rule)) { + const idx = ctx.consume++; + const method = getToken(ctx, rule.name); + return () => ctx.parser.consume(idx, method, ruleCall); + } else if (!rule) { + throw new ErrorWithLocation(ruleCall.$cstNode, `Undefined rule: ${ruleCall.rule.$refText}`); + } else { + assertUnreachable(rule); + } + } + function buildRuleCallPredicate(rule, namedArgs) { + const hasNamedArguments = namedArgs.some((arg) => arg.calledByName); + if (hasNamedArguments) { + const namedPredicates = namedArgs.map((arg) => ({ + parameterName: arg.parameter?.ref?.name, + predicate: buildPredicate(arg.value) + })); + return (args) => { + const ruleArgs = {}; + for (const { parameterName, predicate } of namedPredicates) { + if (parameterName) { + ruleArgs[parameterName] = predicate(args); + } + } + return ruleArgs; + }; + } else { + const predicates = namedArgs.map((arg) => buildPredicate(arg.value)); + return (args) => { + const ruleArgs = {}; + for (let i2 = 0; i2 < predicates.length; i2++) { + if (i2 < rule.parameters.length) { + const parameterName = rule.parameters[i2].name; + const predicate = predicates[i2]; + ruleArgs[parameterName] = predicate(args); + } + } + return ruleArgs; + }; + } + } + function buildPredicate(condition) { + if (isDisjunction(condition)) { + const left3 = buildPredicate(condition.left); + const right3 = buildPredicate(condition.right); + return (args) => left3(args) || right3(args); + } else if (isConjunction(condition)) { + const left3 = buildPredicate(condition.left); + const right3 = buildPredicate(condition.right); + return (args) => left3(args) && right3(args); + } else if (isNegation(condition)) { + const value2 = buildPredicate(condition.value); + return (args) => !value2(args); + } else if (isParameterReference(condition)) { + const name = condition.parameter.ref.name; + return (args) => args !== void 0 && args[name] === true; + } else if (isBooleanLiteral(condition)) { + const value2 = Boolean(condition.true); + return () => value2; + } + assertUnreachable(condition); + } + function buildAlternatives(ctx, alternatives) { + if (alternatives.elements.length === 1) { + return buildElement(ctx, alternatives.elements[0]); + } else { + const methods = []; + for (const element3 of alternatives.elements) { + const predicatedMethod = { + // Since we handle the guard condition in the alternative already + // We can ignore the group guard condition inside + ALT: buildElement(ctx, element3, true) + }; + const guard = getGuardCondition(element3); + if (guard) { + predicatedMethod.GATE = buildPredicate(guard); + } + methods.push(predicatedMethod); + } + const idx = ctx.or++; + return (args) => ctx.parser.alternatives(idx, methods.map((method) => { + const alt = { + ALT: /* @__PURE__ */ __name2(() => method.ALT(args), "ALT") + }; + const gate = method.GATE; + if (gate) { + alt.GATE = () => gate(args); + } + return alt; + })); + } + } + function buildUnorderedGroup(ctx, group2) { + if (group2.elements.length === 1) { + return buildElement(ctx, group2.elements[0]); + } + const methods = []; + for (const element3 of group2.elements) { + const predicatedMethod = { + // Since we handle the guard condition in the alternative already + // We can ignore the group guard condition inside + ALT: buildElement(ctx, element3, true) + }; + const guard = getGuardCondition(element3); + if (guard) { + predicatedMethod.GATE = buildPredicate(guard); + } + methods.push(predicatedMethod); + } + const orIdx = ctx.or++; + const idFunc = /* @__PURE__ */ __name2((groupIdx, lParser) => { + const stackId = lParser.getRuleStack().join("-"); + return `uGroup_${groupIdx}_${stackId}`; + }, "idFunc"); + const alternatives = /* @__PURE__ */ __name2((args) => ctx.parser.alternatives(orIdx, methods.map((method, idx) => { + const alt = { ALT: /* @__PURE__ */ __name2(() => true, "ALT") }; + const parser29 = ctx.parser; + alt.ALT = () => { + method.ALT(args); + if (!parser29.isRecording()) { + const key = idFunc(orIdx, parser29); + if (!parser29.unorderedGroups.get(key)) { + parser29.unorderedGroups.set(key, []); + } + const groupState = parser29.unorderedGroups.get(key); + if (typeof groupState?.[idx] === "undefined") { + groupState[idx] = true; + } + } + }; + const gate = method.GATE; + if (gate) { + alt.GATE = () => gate(args); + } else { + alt.GATE = () => { + const trackedAlternatives = parser29.unorderedGroups.get(idFunc(orIdx, parser29)); + const allow = !trackedAlternatives?.[idx]; + return allow; + }; + } + return alt; + })), "alternatives"); + const wrapped = wrap(ctx, getGuardCondition(group2), alternatives, "*"); + return (args) => { + wrapped(args); + if (!ctx.parser.isRecording()) { + ctx.parser.unorderedGroups.delete(idFunc(orIdx, ctx.parser)); + } + }; + } + function buildGroup4(ctx, group2) { + const methods = group2.elements.map((e3) => buildElement(ctx, e3)); + return (args) => methods.forEach((method) => method(args)); + } + function getGuardCondition(element3) { + if (isGroup(element3)) { + return element3.guardCondition; + } + return void 0; + } + function buildCrossReference(ctx, crossRef, terminal = crossRef.terminal) { + if (!terminal) { + if (!crossRef.type.ref) { + throw new Error("Could not resolve reference to type: " + crossRef.type.$refText); + } + const assignment = findNameAssignment(crossRef.type.ref); + const assignTerminal = assignment?.terminal; + if (!assignTerminal) { + throw new Error("Could not find name assignment for type: " + getTypeName(crossRef.type.ref)); + } + return buildCrossReference(ctx, crossRef, assignTerminal); + } else if (isRuleCall(terminal) && isParserRule(terminal.rule.ref)) { + const rule = terminal.rule.ref; + const idx = ctx.subrule++; + let subrule; + return (args) => { + subrule ?? (subrule = getRule(ctx, rule)); + ctx.parser.subrule(idx, subrule, false, crossRef, args); + }; + } else if (isRuleCall(terminal) && isTerminalRule(terminal.rule.ref)) { + const idx = ctx.consume++; + const terminalRule = getToken(ctx, terminal.rule.ref.name); + return () => ctx.parser.consume(idx, terminalRule, crossRef); + } else if (isKeyword(terminal)) { + const idx = ctx.consume++; + const keyword = getToken(ctx, terminal.value); + return () => ctx.parser.consume(idx, keyword, crossRef); + } else { + throw new Error("Could not build cross reference parser"); + } + } + function buildKeyword(ctx, keyword) { + const idx = ctx.consume++; + const token2 = ctx.tokens[keyword.value]; + if (!token2) { + throw new Error("Could not find token for keyword: " + keyword.value); + } + return () => ctx.parser.consume(idx, token2, keyword); + } + function wrap(ctx, guard, method, cardinality) { + const gate = guard && buildPredicate(guard); + if (!cardinality) { + if (gate) { + const idx = ctx.or++; + return (args) => ctx.parser.alternatives(idx, [ + { + ALT: /* @__PURE__ */ __name2(() => method(args), "ALT"), + GATE: /* @__PURE__ */ __name2(() => gate(args), "GATE") + }, + { + ALT: EMPTY_ALT(), + GATE: /* @__PURE__ */ __name2(() => !gate(args), "GATE") + } + ]); + } else { + return method; + } + } + if (cardinality === "*") { + const idx = ctx.many++; + return (args) => ctx.parser.many(idx, { + DEF: /* @__PURE__ */ __name2(() => method(args), "DEF"), + GATE: gate ? () => gate(args) : void 0 + }); + } else if (cardinality === "+") { + const idx = ctx.many++; + if (gate) { + const orIdx = ctx.or++; + return (args) => ctx.parser.alternatives(orIdx, [ + { + ALT: /* @__PURE__ */ __name2(() => ctx.parser.atLeastOne(idx, { + DEF: /* @__PURE__ */ __name2(() => method(args), "DEF") + }), "ALT"), + GATE: /* @__PURE__ */ __name2(() => gate(args), "GATE") + }, + { + ALT: EMPTY_ALT(), + GATE: /* @__PURE__ */ __name2(() => !gate(args), "GATE") + } + ]); + } else { + return (args) => ctx.parser.atLeastOne(idx, { + DEF: /* @__PURE__ */ __name2(() => method(args), "DEF") + }); + } + } else if (cardinality === "?") { + const idx = ctx.optional++; + return (args) => ctx.parser.optional(idx, { + DEF: /* @__PURE__ */ __name2(() => method(args), "DEF"), + GATE: gate ? () => gate(args) : void 0 + }); + } else { + assertUnreachable(cardinality); + } + } + function getRule(ctx, element3) { + const name = getRuleName(ctx, element3); + const rule = ctx.parser.getRule(name); + if (!rule) + throw new Error(`Rule "${name}" not found."`); + return rule; + } + function getRuleName(ctx, element3) { + if (isAbstractParserRule(element3)) { + return element3.name; + } else if (ctx.ruleNames.has(element3)) { + return ctx.ruleNames.get(element3); + } else { + let item = element3; + let parent4 = item.$container; + let ruleName = element3.$type; + while (!isParserRule(parent4)) { + if (isGroup(parent4) || isAlternatives(parent4) || isUnorderedGroup(parent4)) { + const index = parent4.elements.indexOf(item); + ruleName = index.toString() + ":" + ruleName; + } + item = parent4; + parent4 = parent4.$container; + } + const rule = parent4; + ruleName = rule.name + ":" + ruleName; + ctx.ruleNames.set(element3, ruleName); + return ruleName; + } + } + function getToken(ctx, name) { + const token2 = ctx.tokens[name]; + if (!token2) + throw new Error(`Token "${name}" not found."`); + return token2; + } + function createCompletionParser(services) { + const grammar = services.Grammar; + const lexer = services.parser.Lexer; + const parser29 = new LangiumCompletionParser(services); + createParser(grammar, parser29, lexer.definition); + parser29.finalize(); + return parser29; + } + function createLangiumParser(services) { + const parser29 = prepareLangiumParser(services); + parser29.finalize(); + return parser29; + } + function prepareLangiumParser(services) { + const grammar = services.Grammar; + const lexer = services.parser.Lexer; + const parser29 = new LangiumParser(services); + return createParser(grammar, parser29, lexer.definition); + } + function delayNextTick() { + return new Promise((resolve2) => { + if (typeof setImmediate === "undefined") { + setTimeout(resolve2, 0); + } else { + setImmediate(resolve2); + } + }); + } + function startCancelableOperation() { + lastTick = performance.now(); + return new cancellation_exports.CancellationTokenSource(); + } + function setInterruptionPeriod(period) { + globalInterruptionPeriod = period; + } + function isOperationCancelled(err) { + return err === OperationCancelled; + } + async function interruptAndCheck(token2) { + if (token2 === cancellation_exports.CancellationToken.None) { + return; + } + const current = performance.now(); + if (current - lastTick >= globalInterruptionPeriod) { + lastTick = current; + await delayNextTick(); + lastTick = performance.now(); + } + if (token2.isCancellationRequested) { + throw OperationCancelled; + } + } + function mergeSort(data5, compare) { + if (data5.length <= 1) { + return data5; + } + const p3 = data5.length / 2 | 0; + const left3 = data5.slice(0, p3); + const right3 = data5.slice(p3); + mergeSort(left3, compare); + mergeSort(right3, compare); + let leftIdx = 0; + let rightIdx = 0; + let i2 = 0; + while (leftIdx < left3.length && rightIdx < right3.length) { + const ret = compare(left3[leftIdx], right3[rightIdx]); + if (ret <= 0) { + data5[i2++] = left3[leftIdx++]; + } else { + data5[i2++] = right3[rightIdx++]; + } + } + while (leftIdx < left3.length) { + data5[i2++] = left3[leftIdx++]; + } + while (rightIdx < right3.length) { + data5[i2++] = right3[rightIdx++]; + } + return data5; + } + function computeLineOffsets(text4, isAtLineStart, textOffset = 0) { + const result = isAtLineStart ? [textOffset] : []; + for (let i2 = 0; i2 < text4.length; i2++) { + const ch = text4.charCodeAt(i2); + if (isEOL(ch)) { + if (ch === 13 && i2 + 1 < text4.length && text4.charCodeAt(i2 + 1) === 10) { + i2++; + } + result.push(textOffset + i2 + 1); + } + } + return result; + } + function isEOL(char2) { + return char2 === 13 || char2 === 10; + } + function getWellformedRange(range3) { + const start3 = range3.start; + const end2 = range3.end; + if (start3.line > end2.line || start3.line === end2.line && start3.character > end2.character) { + return { start: end2, end: start3 }; + } + return range3; + } + function getWellformedEdit(textEdit) { + const range3 = getWellformedRange(textEdit.range); + if (range3 !== textEdit.range) { + return { newText: textEdit.newText, range: range3 }; + } + return textEdit; + } + function isNamed(node2) { + return typeof node2.name === "string"; + } + function isAstNodeWithComment(node2) { + return typeof node2.$comment === "string"; + } + function isIntermediateReference(obj) { + return typeof obj === "object" && !!obj && ("$ref" in obj || "$error" in obj); + } + function diagnosticData(code) { + return { code }; + } + function getDiagnosticRange(info2) { + if (info2.range) { + return info2.range; + } + let cstNode; + if (typeof info2.property === "string") { + cstNode = findNodeForProperty(info2.node.$cstNode, info2.property, info2.index); + } else if (typeof info2.keyword === "string") { + cstNode = findNodeForKeyword(info2.node.$cstNode, info2.keyword, info2.index); + } + cstNode ?? (cstNode = info2.node.$cstNode); + if (!cstNode) { + return { + start: { line: 0, character: 0 }, + end: { line: 0, character: 0 } + }; + } + return cstNode.range; + } + function toDiagnosticSeverity(severity) { + switch (severity) { + case "error": + return 1; + case "warning": + return 2; + case "info": + return 3; + case "hint": + return 4; + default: + throw new Error("Invalid diagnostic severity: " + severity); + } + } + function toDiagnosticData(severity) { + switch (severity) { + case "error": + return diagnosticData(DocumentValidator.LexingError); + case "warning": + return diagnosticData(DocumentValidator.LexingWarning); + case "info": + return diagnosticData(DocumentValidator.LexingInfo); + case "hint": + return diagnosticData(DocumentValidator.LexingHint); + default: + throw new Error("Invalid diagnostic severity: " + severity); + } + } + function isTokenTypeArray(tokenVocabulary) { + return Array.isArray(tokenVocabulary) && (tokenVocabulary.length === 0 || "name" in tokenVocabulary[0]); + } + function isIMultiModeLexerDefinition(tokenVocabulary) { + return tokenVocabulary && "modes" in tokenVocabulary && "defaultMode" in tokenVocabulary; + } + function isTokenTypeDictionary(tokenVocabulary) { + return !isTokenTypeArray(tokenVocabulary) && !isIMultiModeLexerDefinition(tokenVocabulary); + } + function parseJSDoc(node2, start3, options2) { + let opts; + let position5; + if (typeof node2 === "string") { + position5 = start3; + opts = options2; + } else { + position5 = node2.range.start; + opts = start3; + } + if (!position5) { + position5 = Position.create(0, 0); + } + const lines = getLines(node2); + const normalizedOptions = normalizeOptions(opts); + const tokens2 = tokenize({ + lines, + position: position5, + options: normalizedOptions + }); + return parseJSDocComment({ + index: 0, + tokens: tokens2, + position: position5 + }); + } + function isJSDoc(node2, options2) { + const normalizedOptions = normalizeOptions(options2); + const lines = getLines(node2); + if (lines.length === 0) { + return false; + } + const first22 = lines[0]; + const last22 = lines[lines.length - 1]; + const firstRegex = normalizedOptions.start; + const lastRegex = normalizedOptions.end; + return Boolean(firstRegex?.exec(first22)) && Boolean(lastRegex?.exec(last22)); + } + function getLines(node2) { + let content = ""; + if (typeof node2 === "string") { + content = node2; + } else { + content = node2.text; + } + const lines = content.split(NEWLINE_REGEXP); + return lines; + } + function tokenize(context) { + const tokens2 = []; + let currentLine = context.position.line; + let currentCharacter = context.position.character; + for (let i2 = 0; i2 < context.lines.length; i2++) { + const first22 = i2 === 0; + const last22 = i2 === context.lines.length - 1; + let line2 = context.lines[i2]; + let index = 0; + if (first22 && context.options.start) { + const match3 = context.options.start?.exec(line2); + if (match3) { + index = match3.index + match3[0].length; + } + } else { + const match3 = context.options.line?.exec(line2); + if (match3) { + index = match3.index + match3[0].length; + } + } + if (last22) { + const match3 = context.options.end?.exec(line2); + if (match3) { + line2 = line2.substring(0, match3.index); + } + } + line2 = line2.substring(0, lastCharacter(line2)); + const whitespaceEnd = skipWhitespace(line2, index); + if (whitespaceEnd >= line2.length) { + if (tokens2.length > 0) { + const position5 = Position.create(currentLine, currentCharacter); + tokens2.push({ + type: "break", + content: "", + range: Range.create(position5, position5) + }); + } + } else { + tagRegex.lastIndex = index; + const tagMatch = tagRegex.exec(line2); + if (tagMatch) { + const fullMatch = tagMatch[0]; + const value2 = tagMatch[1]; + const start3 = Position.create(currentLine, currentCharacter + index); + const end2 = Position.create(currentLine, currentCharacter + index + fullMatch.length); + tokens2.push({ + type: "tag", + content: value2, + range: Range.create(start3, end2) + }); + index += fullMatch.length; + index = skipWhitespace(line2, index); + } + if (index < line2.length) { + const rest = line2.substring(index); + const inlineTagMatches = Array.from(rest.matchAll(inlineTagRegex)); + tokens2.push(...buildInlineTokens(inlineTagMatches, rest, currentLine, currentCharacter + index)); + } + } + currentLine++; + currentCharacter = 0; + } + if (tokens2.length > 0 && tokens2[tokens2.length - 1].type === "break") { + return tokens2.slice(0, -1); + } + return tokens2; + } + function buildInlineTokens(tags2, line2, lineIndex, characterIndex) { + const tokens2 = []; + if (tags2.length === 0) { + const start3 = Position.create(lineIndex, characterIndex); + const end2 = Position.create(lineIndex, characterIndex + line2.length); + tokens2.push({ + type: "text", + content: line2, + range: Range.create(start3, end2) + }); + } else { + let lastIndex = 0; + for (const match3 of tags2) { + const matchIndex = match3.index; + const startContent = line2.substring(lastIndex, matchIndex); + if (startContent.length > 0) { + tokens2.push({ + type: "text", + content: line2.substring(lastIndex, matchIndex), + range: Range.create(Position.create(lineIndex, lastIndex + characterIndex), Position.create(lineIndex, matchIndex + characterIndex)) + }); + } + let offset = startContent.length + 1; + const tagName = match3[1]; + tokens2.push({ + type: "inline-tag", + content: tagName, + range: Range.create(Position.create(lineIndex, lastIndex + offset + characterIndex), Position.create(lineIndex, lastIndex + offset + tagName.length + characterIndex)) + }); + offset += tagName.length; + if (match3.length === 4) { + offset += match3[2].length; + const value2 = match3[3]; + tokens2.push({ + type: "text", + content: value2, + range: Range.create(Position.create(lineIndex, lastIndex + offset + characterIndex), Position.create(lineIndex, lastIndex + offset + value2.length + characterIndex)) + }); + } else { + tokens2.push({ + type: "text", + content: "", + range: Range.create(Position.create(lineIndex, lastIndex + offset + characterIndex), Position.create(lineIndex, lastIndex + offset + characterIndex)) + }); + } + lastIndex = matchIndex + match3[0].length; + } + const endContent = line2.substring(lastIndex); + if (endContent.length > 0) { + tokens2.push({ + type: "text", + content: endContent, + range: Range.create(Position.create(lineIndex, lastIndex + characterIndex), Position.create(lineIndex, lastIndex + characterIndex + endContent.length)) + }); + } + } + return tokens2; + } + function skipWhitespace(line2, index) { + const match3 = line2.substring(index).match(nonWhitespaceRegex); + if (match3) { + return index + match3.index; + } else { + return line2.length; + } + } + function lastCharacter(line2) { + const match3 = line2.match(whitespaceEndRegex); + if (match3 && typeof match3.index === "number") { + return match3.index; + } + return void 0; + } + function parseJSDocComment(context) { + const startPosition = Position.create(context.position.line, context.position.character); + if (context.tokens.length === 0) { + return new JSDocCommentImpl([], Range.create(startPosition, startPosition)); + } + const elements2 = []; + while (context.index < context.tokens.length) { + const element3 = parseJSDocElement(context, elements2[elements2.length - 1]); + if (element3) { + elements2.push(element3); + } + } + const start3 = elements2[0]?.range.start ?? startPosition; + const end2 = elements2[elements2.length - 1]?.range.end ?? startPosition; + return new JSDocCommentImpl(elements2, Range.create(start3, end2)); + } + function parseJSDocElement(context, last22) { + const next3 = context.tokens[context.index]; + if (next3.type === "tag") { + return parseJSDocTag(context, false); + } else if (next3.type === "text" || next3.type === "inline-tag") { + return parseJSDocText(context); + } else { + appendEmptyLine(next3, last22); + context.index++; + return void 0; + } + } + function appendEmptyLine(token2, element3) { + if (element3) { + const line2 = new JSDocLineImpl("", token2.range); + if ("inlines" in element3) { + element3.inlines.push(line2); + } else { + element3.content.inlines.push(line2); + } + } + } + function parseJSDocText(context) { + let token2 = context.tokens[context.index]; + const firstToken = token2; + let lastToken = token2; + const lines = []; + while (token2 && token2.type !== "break" && token2.type !== "tag") { + lines.push(parseJSDocInline(context)); + lastToken = token2; + token2 = context.tokens[context.index]; + } + return new JSDocTextImpl(lines, Range.create(firstToken.range.start, lastToken.range.end)); + } + function parseJSDocInline(context) { + const token2 = context.tokens[context.index]; + if (token2.type === "inline-tag") { + return parseJSDocTag(context, true); + } else { + return parseJSDocLine(context); + } + } + function parseJSDocTag(context, inline) { + const tagToken = context.tokens[context.index++]; + const name = tagToken.content.substring(1); + const nextToken = context.tokens[context.index]; + if (nextToken?.type === "text") { + if (inline) { + const docLine = parseJSDocLine(context); + return new JSDocTagImpl(name, new JSDocTextImpl([docLine], docLine.range), inline, Range.create(tagToken.range.start, docLine.range.end)); + } else { + const textDoc = parseJSDocText(context); + return new JSDocTagImpl(name, textDoc, inline, Range.create(tagToken.range.start, textDoc.range.end)); + } + } else { + const range3 = tagToken.range; + return new JSDocTagImpl(name, new JSDocTextImpl([], range3), inline, range3); + } + } + function parseJSDocLine(context) { + const token2 = context.tokens[context.index++]; + return new JSDocLineImpl(token2.content, token2.range); + } + function normalizeOptions(options2) { + if (!options2) { + return normalizeOptions({ + start: "/**", + end: "*/", + line: "*" + }); + } + const { start: start3, end: end2, line: line2 } = options2; + return { + start: normalizeOption(start3, true), + end: normalizeOption(end2, false), + line: normalizeOption(line2, true) + }; + } + function normalizeOption(option2, start3) { + if (typeof option2 === "string" || typeof option2 === "object") { + const escaped = typeof option2 === "string" ? escapeRegExp(option2) : option2.source; + if (start3) { + return new RegExp(`^\\s*${escaped}`); + } else { + return new RegExp(`\\s*${escaped}\\s*$`); + } + } else { + return option2; + } + } + function renderInlineTag(tag, content, options2) { + if (tag === "linkplain" || tag === "linkcode" || tag === "link") { + const index = content.indexOf(" "); + let display = content; + if (index > 0) { + const displayStart = skipWhitespace(content, index); + display = content.substring(displayStart); + content = content.substring(0, index); + } + if (tag === "linkcode" || tag === "link" && options2.link === "code") { + display = `\`${display}\``; + } + const renderedLink = options2.renderLink?.(content, display) ?? renderLinkDefault(content, display); + return renderedLink; + } + return void 0; + } + function renderLinkDefault(content, display) { + try { + URI2.parse(content, true); + return `[${display}](${content})`; + } catch { + return content; + } + } + function fillNewlines(text4) { + if (text4.endsWith("\n")) { + return "\n"; + } else { + return "\n\n"; + } + } + function createDefaultCoreModule(context) { + return { + documentation: { + CommentProvider: /* @__PURE__ */ __name2((services) => new DefaultCommentProvider(services), "CommentProvider"), + DocumentationProvider: /* @__PURE__ */ __name2((services) => new JSDocDocumentationProvider(services), "DocumentationProvider") + }, + parser: { + AsyncParser: /* @__PURE__ */ __name2((services) => new DefaultAsyncParser(services), "AsyncParser"), + GrammarConfig: /* @__PURE__ */ __name2((services) => createGrammarConfig(services), "GrammarConfig"), + LangiumParser: /* @__PURE__ */ __name2((services) => createLangiumParser(services), "LangiumParser"), + CompletionParser: /* @__PURE__ */ __name2((services) => createCompletionParser(services), "CompletionParser"), + ValueConverter: /* @__PURE__ */ __name2(() => new DefaultValueConverter(), "ValueConverter"), + TokenBuilder: /* @__PURE__ */ __name2(() => new DefaultTokenBuilder(), "TokenBuilder"), + Lexer: /* @__PURE__ */ __name2((services) => new DefaultLexer(services), "Lexer"), + ParserErrorMessageProvider: /* @__PURE__ */ __name2(() => new LangiumParserErrorMessageProvider(), "ParserErrorMessageProvider"), + LexerErrorMessageProvider: /* @__PURE__ */ __name2(() => new DefaultLexerErrorMessageProvider(), "LexerErrorMessageProvider") + }, + workspace: { + AstNodeLocator: /* @__PURE__ */ __name2(() => new DefaultAstNodeLocator(), "AstNodeLocator"), + AstNodeDescriptionProvider: /* @__PURE__ */ __name2((services) => new DefaultAstNodeDescriptionProvider(services), "AstNodeDescriptionProvider"), + ReferenceDescriptionProvider: /* @__PURE__ */ __name2((services) => new DefaultReferenceDescriptionProvider(services), "ReferenceDescriptionProvider") + }, + references: { + Linker: /* @__PURE__ */ __name2((services) => new DefaultLinker(services), "Linker"), + NameProvider: /* @__PURE__ */ __name2(() => new DefaultNameProvider(), "NameProvider"), + ScopeProvider: /* @__PURE__ */ __name2((services) => new DefaultScopeProvider(services), "ScopeProvider"), + ScopeComputation: /* @__PURE__ */ __name2((services) => new DefaultScopeComputation(services), "ScopeComputation"), + References: /* @__PURE__ */ __name2((services) => new DefaultReferences(services), "References") + }, + serializer: { + Hydrator: /* @__PURE__ */ __name2((services) => new DefaultHydrator(services), "Hydrator"), + JsonSerializer: /* @__PURE__ */ __name2((services) => new DefaultJsonSerializer(services), "JsonSerializer") + }, + validation: { + DocumentValidator: /* @__PURE__ */ __name2((services) => new DefaultDocumentValidator(services), "DocumentValidator"), + ValidationRegistry: /* @__PURE__ */ __name2((services) => new ValidationRegistry(services), "ValidationRegistry") + }, + shared: /* @__PURE__ */ __name2(() => context.shared, "shared") + }; + } + function createDefaultSharedCoreModule(context) { + return { + ServiceRegistry: /* @__PURE__ */ __name2((services) => new DefaultServiceRegistry(services), "ServiceRegistry"), + workspace: { + LangiumDocuments: /* @__PURE__ */ __name2((services) => new DefaultLangiumDocuments(services), "LangiumDocuments"), + LangiumDocumentFactory: /* @__PURE__ */ __name2((services) => new DefaultLangiumDocumentFactory(services), "LangiumDocumentFactory"), + DocumentBuilder: /* @__PURE__ */ __name2((services) => new DefaultDocumentBuilder(services), "DocumentBuilder"), + IndexManager: /* @__PURE__ */ __name2((services) => new DefaultIndexManager(services), "IndexManager"), + WorkspaceManager: /* @__PURE__ */ __name2((services) => new DefaultWorkspaceManager(services), "WorkspaceManager"), + FileSystemProvider: /* @__PURE__ */ __name2((services) => context.fileSystemProvider(services), "FileSystemProvider"), + WorkspaceLock: /* @__PURE__ */ __name2(() => new DefaultWorkspaceLock(), "WorkspaceLock"), + ConfigurationProvider: /* @__PURE__ */ __name2((services) => new DefaultConfigurationProvider(services), "ConfigurationProvider") + }, + profilers: {} + }; + } + function inject(module1, module2, module3, module4, module5, module6, module7, module8, module9) { + const module10 = [module1, module2, module3, module4, module5, module6, module7, module8, module9].reduce(_merge, {}); + return _inject(module10); + } + function eagerLoad(item) { + if (item && item[isProxy]) { + for (const value2 of Object.values(item)) { + eagerLoad(value2); + } + } + return item; + } + function _inject(module2, injector) { + const proxy = new Proxy({}, { + deleteProperty: /* @__PURE__ */ __name2(() => false, "deleteProperty"), + set: /* @__PURE__ */ __name2(() => { + throw new Error("Cannot set property on injected service container"); + }, "set"), + get: /* @__PURE__ */ __name2((obj, prop) => { + if (prop === isProxy) { + return true; + } else { + return _resolve2(obj, prop, module2, injector || proxy); + } + }, "get"), + getOwnPropertyDescriptor: /* @__PURE__ */ __name2((obj, prop) => (_resolve2(obj, prop, module2, injector || proxy), Object.getOwnPropertyDescriptor(obj, prop)), "getOwnPropertyDescriptor"), + // used by for..in + has: /* @__PURE__ */ __name2((_3, prop) => prop in module2, "has"), + // used by ..in.. + ownKeys: /* @__PURE__ */ __name2(() => [...Object.getOwnPropertyNames(module2)], "ownKeys") + // used by for..in + }); + return proxy; + } + function _resolve2(obj, prop, module2, injector) { + if (prop in obj) { + if (obj[prop] instanceof Error) { + throw new Error("Construction failure. Please make sure that your dependencies are constructable. Cause: " + obj[prop]); + } + if (obj[prop] === __requested__) { + throw new Error('Cycle detected. Please make "' + String(prop) + '" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies'); + } + return obj[prop]; + } else if (prop in module2) { + const value2 = module2[prop]; + obj[prop] = __requested__; + try { + obj[prop] = typeof value2 === "function" ? value2(injector) : _inject(value2, injector); + } catch (error3) { + obj[prop] = error3 instanceof Error ? error3 : void 0; + throw error3; + } + return obj[prop]; + } else { + return void 0; + } + } + function _merge(target, source) { + if (source) { + for (const [key, sourceValue] of Object.entries(source)) { + if (sourceValue !== void 0 && sourceValue !== null) { + if (typeof sourceValue === "object") { + const targetValue = target[key]; + if (typeof targetValue === "object" && targetValue !== null) { + target[key] = _merge(targetValue, sourceValue); + } else { + target[key] = _merge({}, sourceValue); + } + } else { + target[key] = sourceValue; + } + } + } + } + return target; + } + function createMinimalGrammarServices() { + const shared = inject(createDefaultSharedCoreModule(EmptyFileSystem), minimalSharedGrammarModule); + const grammar = inject(createDefaultCoreModule({ shared }), minimalGrammarModule); + shared.ServiceRegistry.register(grammar); + return grammar; + } + function loadGrammarFromJson(json3) { + const services = createMinimalGrammarServices(); + const astNode = services.serializer.JsonSerializer.deserialize(json3); + services.shared.workspace.LangiumDocumentFactory.fromModel(astNode, URI2.parse(`memory:/${astNode.name ?? "grammar"}.langium`)); + return astNode; + } + function isArchitecture(item) { + return reflection2.isInstance(item, Architecture.$type); + } + function isBranch(item) { + return reflection2.isInstance(item, Branch.$type); + } + function isCommit(item) { + return reflection2.isInstance(item, Commit.$type); + } + function isEmModelEntityType(item) { + return item === "rmo" || item === "readmodel" || item === "ui" || item === "cmd" || item === "command" || item === "evt" || item === "event" || item === "pcr" || item === "processor"; + } + function isEmResetFrame(item) { + return reflection2.isInstance(item, EmResetFrame.$type); + } + function isGitGraph(item) { + return reflection2.isInstance(item, GitGraph.$type); + } + function isInfo(item) { + return reflection2.isInstance(item, Info.$type); + } + function isMerge(item) { + return reflection2.isInstance(item, Merge.$type); + } + function isPacket(item) { + return reflection2.isInstance(item, Packet.$type); + } + function isPacketBlock(item) { + return reflection2.isInstance(item, PacketBlock.$type); + } + function isPie(item) { + return reflection2.isInstance(item, Pie.$type); + } + function isPieSection(item) { + return reflection2.isInstance(item, PieSection.$type); + } + function isTreemap(item) { + return reflection2.isInstance(item, Treemap.$type); + } + function isWardley(item) { + return reflection2.isInstance(item, Wardley.$type); + } + var __create2, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __getProtoOf2, __hasOwnProp2, __name2, __esm2, __commonJS2, __export2, __copyProps2, __reExport, __toESM2, __toCommonJS2, main_exports, DocumentUri, URI, integer3, uinteger, Position, Range, Location, LocationLink, Color3, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextEditChangeImpl, ChangeAnnotations, WorkspaceChange, TextDocumentIdentifier, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItemLabelDetails, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, WorkspaceSymbol, DocumentSymbol, CodeActionKind, CodeActionTriggerKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange, SemanticTokenTypes, SemanticTokenModifiers, SemanticTokens, InlineValueText, InlineValueVariableLookup, InlineValueEvaluatableExpression, InlineValueContext, InlayHintKind, InlayHintLabelPart, InlayHint, StringValue, InlineCompletionItem, InlineCompletionList, InlineCompletionTriggerKind, SelectedCompletionInfo, InlineCompletionContext, WorkspaceFolder, EOL, TextDocument, FullTextDocument, Is, init_main, require_ral, require_is, require_events, require_cancellation, require_messages, require_linkedMap, require_disposable, require_sharedArrayCancellation, require_semaphore, require_messageReader, require_messageWriter, require_messageBuffer, require_connection, require_api, require_ril, require_main, require_browser, require_messages2, require_is2, require_protocol_implementation, require_protocol_typeDefinition, require_protocol_workspaceFolder, require_protocol_configuration, require_protocol_colorProvider, require_protocol_foldingRange, require_protocol_declaration, require_protocol_selectionRange, require_protocol_progress, require_protocol_callHierarchy, require_protocol_semanticTokens, require_protocol_showDocument, require_protocol_linkedEditingRange, require_protocol_fileOperations, require_protocol_moniker, require_protocol_typeHierarchy, require_protocol_inlineValue, require_protocol_inlayHint, require_protocol_diagnostic, require_protocol_notebook, require_protocol_inlineCompletion, require_protocol, require_connection2, require_api2, require_main2, lib_exports, cst_utils_exports, AbstractAstReflection, StreamImpl, EMPTY_STREAM, DONE_RESULT, TreeStreamImpl, Reduction, ast_utils_exports, ast_exports, LangiumGrammarTerminals, AbstractElement, AbstractParserRule, AbstractRule, AbstractType, Action, Alternatives, ArrayLiteral, ArrayType, Assignment, BooleanLiteral, CharacterRange, Condition, Conjunction, CrossReference, Disjunction, EndOfFile, Grammar, GrammarImport, Group, InferredType, InfixRule, InfixRuleOperatorList, InfixRuleOperators, Interface, Keyword2, NamedArgument, NegatedToken, Negation, NumberLiteral, Parameter, ParameterReference, ParserRule, ReferenceType, RegexToken, ReturnType, RuleCall, SimpleType, StringLiteral, TerminalAlternatives, TerminalElement, TerminalGroup, TerminalRule, TerminalRuleCall, Type3, TypeAttribute, TypeDefinition, UnionType, UnorderedGroup, UntilToken, ValueLiteral, Wildcard, LangiumGrammarAstReflection, reflection, RangeComparison, DefaultNameRegexp, grammar_utils_exports, ErrorWithLocation, regexp_utils_exports, digitsCharCodes, wordCharCodes, whitespaceCodes, hexDigitPattern, decimalPattern, decimalPatternNoZero, RegExpParser, BaseRegExpVisitor, NEWLINE_REGEXP, regexpParser, TerminalRegExpVisitor, visitor, whitespaceCharacters, WILDCARD, freeGlobal2, freeGlobal_default2, freeSelf2, root3, root_default2, Symbol22, Symbol_default2, objectProto20, hasOwnProperty17, nativeObjectToString3, symToStringTag3, getRawTag_default2, objectProto22, nativeObjectToString22, objectToString_default2, nullTag2, undefinedTag2, symToStringTag22, baseGetTag_default2, isObjectLike_default2, symbolTag6, isSymbol_default2, arrayMap_default2, isArray3, isArray_default2, INFINITY5, symbolProto4, symbolToString2, baseToString_default2, reWhitespace2, trimmedEndIndex_default2, reTrimStart2, baseTrim_default2, isObject_default2, NAN2, reIsBadHex2, reIsBinary2, reIsOctal2, freeParseInt2, toNumber_default2, INFINITY22, MAX_INTEGER2, toFinite_default2, toInteger_default2, identity_default5, asyncTag2, funcTag4, genTag3, proxyTag2, isFunction_default2, coreJsData2, coreJsData_default2, maskSrcKey2, isMasked_default2, funcProto4, funcToString4, toSource_default2, reRegExpChar2, reIsHostCtor2, funcProto22, objectProto32, funcToString22, hasOwnProperty22, reIsNative2, baseIsNative_default2, getValue_default2, getNative_default2, WeakMap2, WeakMap_default2, objectCreate2, baseCreate2, baseCreate_default2, apply_default2, noop_default3, copyArray_default2, HOT_COUNT2, HOT_SPAN2, nativeNow2, shortOut_default2, constant_default8, defineProperty2, defineProperty_default2, baseSetToString2, baseSetToString_default2, setToString2, setToString_default2, arrayEach_default2, baseFindIndex_default2, baseIsNaN_default2, strictIndexOf_default2, baseIndexOf_default2, arrayIncludes_default2, MAX_SAFE_INTEGER3, reIsUint2, isIndex_default2, baseAssignValue_default2, eq_default2, objectProto42, hasOwnProperty32, assignValue_default2, copyObject_default2, nativeMax4, overRest_default2, baseRest_default2, MAX_SAFE_INTEGER22, isLength_default2, isArrayLike_default2, isIterateeCall_default2, createAssigner_default2, objectProto52, isPrototype_default2, baseTimes_default2, argsTag5, baseIsArguments_default2, objectProto62, hasOwnProperty42, propertyIsEnumerable3, isArguments3, isArguments_default2, stubFalse_default2, freeExports4, freeModule4, moduleExports4, Buffer22, nativeIsBuffer2, isBuffer2, isBuffer_default2, argsTag22, arrayTag5, boolTag5, dateTag6, errorTag4, funcTag22, mapTag10, numberTag6, objectTag7, regexpTag6, setTag10, stringTag7, weakMapTag4, arrayBufferTag6, dataViewTag7, float32Tag4, float64Tag4, int8Tag4, int16Tag4, int32Tag4, uint8Tag4, uint8ClampedTag4, uint16Tag4, uint32Tag4, typedArrayTags2, baseIsTypedArray_default2, baseUnary_default2, freeExports22, freeModule22, moduleExports22, freeProcess2, nodeUtil2, nodeUtil_default2, nodeIsTypedArray2, isTypedArray4, isTypedArray_default2, objectProto72, hasOwnProperty52, arrayLikeKeys_default2, overArg_default2, nativeKeys2, nativeKeys_default2, objectProto82, hasOwnProperty62, baseKeys_default2, keys_default2, objectProto92, hasOwnProperty72, assign5, assign_default, nativeKeysIn_default2, objectProto102, hasOwnProperty82, baseKeysIn_default2, keysIn_default2, reIsDeepProp2, reIsPlainProp2, isKey_default2, nativeCreate2, nativeCreate_default2, hashClear_default2, hashDelete_default2, HASH_UNDEFINED4, objectProto112, hasOwnProperty92, hashGet_default2, objectProto122, hasOwnProperty102, hashHas_default2, HASH_UNDEFINED22, hashSet_default2, Hash_default2, listCacheClear_default2, assocIndexOf_default2, arrayProto2, splice2, listCacheDelete_default2, listCacheGet_default2, listCacheHas_default2, listCacheSet_default2, ListCache_default2, Map22, Map_default2, mapCacheClear_default2, isKeyable_default2, getMapData_default2, mapCacheDelete_default2, mapCacheGet_default2, mapCacheHas_default2, mapCacheSet_default2, MapCache_default2, FUNC_ERROR_TEXT2, memoize_default2, MAX_MEMOIZE_SIZE2, memoizeCapped_default2, rePropName2, reEscapeChar2, stringToPath2, stringToPath_default2, toString_default2, castPath_default2, INFINITY32, toKey_default2, baseGet_default2, get_default2, arrayPush_default2, spreadableSymbol2, isFlattenable_default2, baseFlatten_default2, flatten_default2, getPrototype2, getPrototype_default2, baseSlice_default, arrayReduce_default2, stackClear_default2, stackDelete_default2, stackGet_default2, stackHas_default2, LARGE_ARRAY_SIZE3, stackSet_default2, Stack_default2, baseAssign_default2, baseAssignIn_default2, freeExports32, freeModule32, moduleExports32, Buffer32, allocUnsafe2, cloneBuffer_default2, arrayFilter_default2, stubArray_default2, objectProto132, propertyIsEnumerable22, nativeGetSymbols3, getSymbols3, getSymbols_default2, copySymbols_default2, nativeGetSymbols22, getSymbolsIn2, getSymbolsIn_default2, copySymbolsIn_default2, baseGetAllKeys_default2, getAllKeys_default2, getAllKeysIn_default2, DataView3, DataView_default2, Promise22, Promise_default2, Set22, Set_default2, mapTag22, objectTag22, promiseTag2, setTag22, weakMapTag22, dataViewTag22, dataViewCtorString2, mapCtorString2, promiseCtorString2, setCtorString2, weakMapCtorString2, getTag3, getTag_default2, objectProto142, hasOwnProperty112, initCloneArray_default2, Uint8Array22, Uint8Array_default2, cloneArrayBuffer_default2, cloneDataView_default2, reFlags2, cloneRegExp_default2, symbolProto22, symbolValueOf3, cloneSymbol_default2, cloneTypedArray_default2, boolTag22, dateTag22, mapTag32, numberTag22, regexpTag22, setTag32, stringTag22, symbolTag22, arrayBufferTag22, dataViewTag32, float32Tag22, float64Tag22, int8Tag22, int16Tag22, int32Tag22, uint8Tag22, uint8ClampedTag22, uint16Tag22, uint32Tag22, initCloneByTag_default2, initCloneObject_default2, mapTag42, baseIsMap_default2, nodeIsMap2, isMap2, isMap_default2, setTag42, baseIsSet_default2, nodeIsSet2, isSet2, isSet_default2, CLONE_DEEP_FLAG3, CLONE_FLAT_FLAG2, CLONE_SYMBOLS_FLAG4, argsTag32, arrayTag22, boolTag32, dateTag32, errorTag22, funcTag32, genTag22, mapTag52, numberTag32, objectTag32, regexpTag32, setTag52, stringTag32, symbolTag32, weakMapTag32, arrayBufferTag32, dataViewTag42, float32Tag32, float64Tag32, int8Tag32, int16Tag32, int32Tag32, uint8Tag32, uint8ClampedTag32, uint16Tag32, uint32Tag32, cloneableTags2, baseClone_default2, CLONE_SYMBOLS_FLAG22, clone_default3, compact_default, HASH_UNDEFINED32, setCacheAdd_default2, setCacheHas_default2, SetCache_default2, arraySome_default2, cacheHas_default2, COMPARE_PARTIAL_FLAG7, COMPARE_UNORDERED_FLAG5, equalArrays_default2, mapToArray_default2, setToArray_default2, COMPARE_PARTIAL_FLAG22, COMPARE_UNORDERED_FLAG22, boolTag42, dateTag42, errorTag32, mapTag62, numberTag42, regexpTag42, setTag62, stringTag42, symbolTag42, arrayBufferTag42, dataViewTag52, symbolProto32, symbolValueOf22, equalByTag_default2, COMPARE_PARTIAL_FLAG32, objectProto152, hasOwnProperty122, equalObjects_default2, COMPARE_PARTIAL_FLAG42, argsTag42, arrayTag32, objectTag42, objectProto162, hasOwnProperty132, baseIsEqualDeep_default2, baseIsEqual_default2, COMPARE_PARTIAL_FLAG52, COMPARE_UNORDERED_FLAG32, baseIsMatch_default2, isStrictComparable_default2, getMatchData_default2, matchesStrictComparable_default2, baseMatches_default2, baseHasIn_default2, hasPath_default2, hasIn_default2, COMPARE_PARTIAL_FLAG62, COMPARE_UNORDERED_FLAG42, baseMatchesProperty_default2, baseProperty_default2, basePropertyDeep_default2, property_default3, baseIteratee_default2, arrayAggregator_default, createBaseFor_default2, baseFor2, baseFor_default2, baseForOwn_default2, createBaseEach_default2, baseEach2, baseEach_default2, baseAggregator_default, createAggregator_default, objectProto172, hasOwnProperty142, defaults4, defaults_default2, isArrayLikeObject_default2, arrayIncludesWith_default2, LARGE_ARRAY_SIZE22, baseDifference_default, difference, difference_default, last_default2, drop_default, dropRight_default, castFunction_default2, forEach_default2, arrayEvery_default, baseEvery_default, every_default, baseFilter_default2, filter_default4, createFind_default2, nativeMax22, findIndex_default2, find3, find_default3, head_default, baseMap_default2, map_default2, flatMap_default, objectProto182, hasOwnProperty152, groupBy, groupBy_default, objectProto192, hasOwnProperty162, baseHas_default2, has_default2, stringTag52, isString_default2, baseValues_default2, values_default2, nativeMax32, includes_default, nativeMax42, indexOf_default, mapTag72, setTag72, objectProto202, hasOwnProperty172, isEmpty_default2, regexpTag52, baseIsRegExp_default, nodeIsRegExp, isRegExp, isRegExp_default, isUndefined_default2, FUNC_ERROR_TEXT22, negate_default, baseSet_default2, basePickBy_default2, pickBy_default, baseReduce_default2, reduce_default2, reject_default, baseSome_default, some_default, INFINITY42, createSet2, createSet_default2, LARGE_ARRAY_SIZE32, baseUniq_default2, uniq_default, AbstractProduction, NonTerminal, Rule, Alternative, Option2, RepetitionMandatory, RepetitionMandatoryWithSeparator, Repetition, RepetitionWithSeparator, Alternation, Terminal, GAstVisitor, RestWalker, IN, ResyncFollowsWalker, regExpAstCache, regExpParser, complementErrorMessage, failedOptimizationPrefixMsg, CharCodeFinder, PATTERN, DEFAULT_MODE, MODES, SUPPORT_STICKY, end_of_input, start_of_input, LineTerminatorOptimizedTester, minOptimizationVal, charCodeToOptimizedIdxMap, tokenShortNameIdx, tokenIdxToClass, defaultLexerErrorProvider, LexerDefinitionErrorType, DEFAULT_LEXER_CONFIG, Lexer2, PARENT, CATEGORIES, LABEL, GROUP, PUSH_MODE, POP_MODE, LONGER_ALT, LINE_BREAKS, START_CHARS_HINT, EOF, defaultParserErrorProvider, defaultGrammarResolverErrorProvider, defaultGrammarValidatorErrorProvider, GastRefResolverVisitor, AbstractNextPossibleTokensWalker, NextAfterTokenWalker, AbstractNextTerminalAfterProductionWalker, NextTerminalAfterManyWalker, NextTerminalAfterManySepWalker, NextTerminalAfterAtLeastOneWalker, NextTerminalAfterAtLeastOneSepWalker, PROD_TYPE, RestDefinitionFinderWalker, InsideDefinitionFinderVisitor, OccurrenceValidationCollector, OrCollector, RepetitionCollector, MISMATCHED_TOKEN_EXCEPTION, NO_VIABLE_ALT_EXCEPTION, EARLY_EXIT_EXCEPTION, NOT_ALL_INPUT_PARSED_EXCEPTION, RECOGNITION_EXCEPTION_NAMES, RecognitionException, MismatchedTokenException, NoViableAltException, NotAllInputParsedException, EarlyExitException, EOF_FOLLOW_KEY, IN_RULE_RECOVERY_EXCEPTION, InRuleRecoveryException, Recoverable, BITS_FOR_METHOD_TYPE, BITS_FOR_OCCURRENCE_IDX, BITS_FOR_ALT_IDX, OR_IDX, OPTION_IDX, MANY_IDX, AT_LEAST_ONE_IDX, MANY_SEP_IDX, AT_LEAST_ONE_SEP_IDX, BITS_START_FOR_ALT_IDX, LLkLookaheadStrategy, LooksAhead, DslMethodsCollectorVisitor, collectorVisitor, NAME, CstVisitorDefinitionError, TreeBuilder, LexerAdapter, RecognizerApi, RecognizerEngine, ErrorHandler, ContentAssist, RECORDING_NULL_OBJECT, HANDLE_SEPARATOR, MAX_METHOD_IDX, RFT, RECORDING_PHASE_TOKEN, RECORDING_PHASE_CSTNODE, GastRecorder, PerformanceTracer, END_OF_FILE, DEFAULT_PARSER_CONFIG, DEFAULT_RULE_CONFIG, ParserDefinitionErrorType, Parser2, EmbeddedActionsParser, arrayMap_default22, listCacheClear_default22, eq_default22, assocIndexOf_default22, arrayProto22, splice22, listCacheDelete_default22, listCacheGet_default22, listCacheHas_default22, listCacheSet_default22, ListCache_default22, stackClear_default22, stackDelete_default22, stackGet_default22, stackHas_default22, freeGlobal22, freeGlobal_default22, freeSelf22, root22, root_default22, Symbol3, Symbol_default22, objectProto21, hasOwnProperty18, nativeObjectToString32, symToStringTag32, getRawTag_default22, objectProto222, nativeObjectToString4, objectToString_default22, nullTag22, undefinedTag22, symToStringTag4, baseGetTag_default22, isObject_default22, asyncTag22, funcTag42, genTag32, proxyTag22, isFunction_default22, coreJsData22, coreJsData_default22, maskSrcKey22, isMasked_default22, funcProto32, funcToString32, toSource_default22, reRegExpChar22, reIsHostCtor22, funcProto42, objectProto23, funcToString42, hasOwnProperty19, reIsNative22, baseIsNative_default22, getValue_default22, getNative_default22, Map3, Map_default22, nativeCreate22, nativeCreate_default22, hashClear_default22, hashDelete_default22, HASH_UNDEFINED42, objectProto24, hasOwnProperty20, hashGet_default22, objectProto25, hasOwnProperty21, hashHas_default22, HASH_UNDEFINED5, hashSet_default22, Hash_default22, mapCacheClear_default22, isKeyable_default22, getMapData_default22, mapCacheDelete_default22, mapCacheGet_default22, mapCacheHas_default22, mapCacheSet_default22, MapCache_default22, LARGE_ARRAY_SIZE4, stackSet_default22, Stack_default22, HASH_UNDEFINED6, setCacheAdd_default22, setCacheHas_default22, SetCache_default22, arraySome_default22, cacheHas_default22, COMPARE_PARTIAL_FLAG72, COMPARE_UNORDERED_FLAG52, equalArrays_default22, Uint8Array3, Uint8Array_default22, mapToArray_default22, setToArray_default22, COMPARE_PARTIAL_FLAG8, COMPARE_UNORDERED_FLAG6, boolTag52, dateTag52, errorTag42, mapTag82, numberTag52, regexpTag62, setTag82, stringTag62, symbolTag52, arrayBufferTag52, dataViewTag62, symbolProto42, symbolValueOf32, equalByTag_default22, arrayPush_default22, isArray22, isArray_default22, baseGetAllKeys_default22, arrayFilter_default22, stubArray_default22, objectProto26, propertyIsEnumerable32, nativeGetSymbols32, getSymbols22, getSymbols_default22, baseTimes_default22, isObjectLike_default22, argsTag52, baseIsArguments_default22, objectProto27, hasOwnProperty222, propertyIsEnumerable4, isArguments22, isArguments_default22, stubFalse_default22, freeExports42, freeModule42, moduleExports42, Buffer4, nativeIsBuffer22, isBuffer22, isBuffer_default22, MAX_SAFE_INTEGER32, reIsUint22, isIndex_default22, MAX_SAFE_INTEGER4, isLength_default22, argsTag6, arrayTag42, boolTag6, dateTag62, errorTag5, funcTag5, mapTag92, numberTag62, objectTag52, regexpTag7, setTag92, stringTag72, weakMapTag42, arrayBufferTag62, dataViewTag72, float32Tag42, float64Tag42, int8Tag42, int16Tag42, int32Tag42, uint8Tag42, uint8ClampedTag42, uint16Tag42, uint32Tag42, typedArrayTags22, baseIsTypedArray_default22, baseUnary_default22, freeExports5, freeModule5, moduleExports5, freeProcess22, nodeUtil22, nodeUtil_default22, nodeIsTypedArray22, isTypedArray22, isTypedArray_default22, objectProto28, hasOwnProperty23, arrayLikeKeys_default22, objectProto29, isPrototype_default22, overArg_default22, nativeKeys22, nativeKeys_default22, objectProto30, hasOwnProperty24, baseKeys_default22, isArrayLike_default22, keys_default22, getAllKeys_default22, COMPARE_PARTIAL_FLAG9, objectProto31, hasOwnProperty25, equalObjects_default22, DataView22, DataView_default22, Promise3, Promise_default22, Set3, Set_default22, WeakMap22, WeakMap_default22, mapTag102, objectTag62, promiseTag22, setTag102, weakMapTag5, dataViewTag8, dataViewCtorString22, mapCtorString22, promiseCtorString22, setCtorString22, weakMapCtorString22, getTag22, getTag_default22, COMPARE_PARTIAL_FLAG10, argsTag7, arrayTag52, objectTag72, objectProto322, hasOwnProperty26, baseIsEqualDeep_default22, baseIsEqual_default22, COMPARE_PARTIAL_FLAG11, COMPARE_UNORDERED_FLAG7, baseIsMatch_default22, isStrictComparable_default22, getMatchData_default22, matchesStrictComparable_default22, baseMatches_default22, symbolTag62, isSymbol_default22, reIsDeepProp22, reIsPlainProp22, isKey_default22, FUNC_ERROR_TEXT3, memoize_default22, MAX_MEMOIZE_SIZE22, memoizeCapped_default22, rePropName22, reEscapeChar22, stringToPath22, stringToPath_default22, INFINITY52, symbolProto5, symbolToString22, baseToString_default22, toString_default22, castPath_default22, INFINITY6, toKey_default22, baseGet_default22, get_default22, baseHasIn_default22, hasPath_default22, hasIn_default22, COMPARE_PARTIAL_FLAG12, COMPARE_UNORDERED_FLAG8, baseMatchesProperty_default22, identity_default22, baseProperty_default22, basePropertyDeep_default22, property_default22, baseIteratee_default22, createBaseFor_default22, baseFor22, baseFor_default22, baseForOwn_default22, createBaseEach_default22, baseEach22, baseEach_default22, baseMap_default22, map_default22, baseFilter_default22, filter_default22, ATN_BASIC, ATN_RULE_START, ATN_PLUS_BLOCK_START, ATN_STAR_BLOCK_START, ATN_RULE_STOP, ATN_BLOCK_END, ATN_STAR_LOOP_BACK, ATN_STAR_LOOP_ENTRY, ATN_PLUS_LOOP_BACK, ATN_LOOP_END, AbstractTransition, AtomTransition, EpsilonTransition, RuleTransition, DFA_ERROR, ATNConfigSet, baseExtremum_default2, baseLt_default2, min_default2, spreadableSymbol22, isFlattenable_default22, baseFlatten_default22, flatMap_default2, baseFindIndex_default22, baseIsNaN_default22, strictIndexOf_default22, baseIndexOf_default22, arrayIncludes_default22, arrayIncludesWith_default22, noop_default22, INFINITY7, createSet22, createSet_default22, LARGE_ARRAY_SIZE5, baseUniq_default22, uniqBy_default, flatten_default22, arrayEach_default22, castFunction_default22, forEach_default22, mapTag11, setTag11, objectProto33, hasOwnProperty27, isEmpty_default22, arrayReduce_default22, baseReduce_default22, reduce_default22, PredicateSet, EMPTY_PREDICATES, LLStarLookaheadStrategy, CstNodeBuilder, AbstractCstNode, LeafCstNodeImpl, CompositeCstNodeImpl, CstNodeContainer, RootCstNodeImpl, DatatypeSymbol, ruleSuffix, withRuleSuffix, AbstractLangiumParser, LangiumParser, AbstractParserErrorMessageProvider, LangiumParserErrorMessageProvider, LangiumCompletionParser, defaultConfig3, ChevrotainWrapper, ProfilerWrapper, DefaultTokenBuilder, DefaultValueConverter, ValueConverter, cancellation_exports, lastTick, globalInterruptionPeriod, OperationCancelled, Deferred, FullTextDocument2, TextDocument2, LIB, URI2, Utils2, UriUtils, UriTrie, DocumentState, DefaultLangiumDocumentFactory, DefaultLangiumDocuments, RefResolving, DefaultLinker, DefaultNameProvider, DefaultReferences, MultiMap, BiMap, DefaultScopeComputation, StreamScope, MapScope, MultiMapScope, EMPTY_SCOPE, DisposableCache, SimpleCache, ContextCache, DocumentCache, WorkspaceCache, DefaultScopeProvider, DefaultJsonSerializer, DefaultServiceRegistry, ValidationCategory, ValidationRegistry, VALIDATE_EACH_NODE, DefaultDocumentValidator, DocumentValidator, DefaultAstNodeDescriptionProvider, DefaultReferenceDescriptionProvider, DefaultAstNodeLocator, event_exports, DefaultConfigurationProvider, import_vscode_languageserver_protocol, Disposable, DefaultDocumentBuilder, DefaultIndexManager, DefaultWorkspaceManager, DefaultLexerErrorMessageProvider, DEFAULT_TOKENIZE_OPTIONS, DefaultLexer, tagRegex, inlineTagRegex, nonWhitespaceRegex, whitespaceEndRegex, JSDocCommentImpl, JSDocTagImpl, JSDocTextImpl, JSDocLineImpl, JSDocDocumentationProvider, DefaultCommentProvider, DefaultAsyncParser, AbstractThreadedAsyncParser, ParserWorker, DefaultWorkspaceLock, DefaultHydrator, Module, isProxy, __requested__, indentationBuilderDefaultOptions, LexingMode, IndentationAwareTokenBuilder, IndentationAwareLexer, utils_exports, EmptyFileSystemProvider, EmptyFileSystem, minimalGrammarModule, minimalSharedGrammarModule, DefaultLangiumProfiler, ProfilingTask, ArchitectureGrammar, EventModeling, GitGraphGrammar, InfoGrammar, PacketGrammar, PieGrammar, RadarGrammar, TreemapGrammar, TreeViewGrammar, WardleyGrammar, MermaidTerminals, Accelerator, Anchor2, Annotation, Annotations, Architecture, Axis, Branch, Checkout, CherryPicking, ClassDefStatement, Commit, Common, Component, Curve, Deaccelerator, Decorator, Direction, Edge, EmDataEntity, EmFrame, EmGwt, EmGwtStatement, EmModelEntity, EmNoteEntity, EmResetFrame, EmTimeFrame, Entry, EventModel, Evolution, EvolutionStage, Evolve, GitGraph, Group2, Info, Item, Junction, Label, Leaf, Link, Merge, Note, Option22, Packet, PacketBlock, Pie, PieSection, Pipeline, PipelineComponent, Radar, Section, Service, Size, Statement, Treemap, TreemapRow, TreeNode, TreeView, Wardley, MermaidAstReflection, reflection2, loadedArchitectureGrammarGrammar, ArchitectureGrammarGrammar, loadedEventModelingGrammar, EventModelingGrammar, loadedGitGraphGrammarGrammar, GitGraphGrammarGrammar, loadedInfoGrammarGrammar, InfoGrammarGrammar, loadedPacketGrammarGrammar, PacketGrammarGrammar, loadedPieGrammarGrammar, PieGrammarGrammar, loadedRadarGrammarGrammar, RadarGrammarGrammar, loadedTreemapGrammarGrammar, TreemapGrammarGrammar, loadedTreeViewGrammarGrammar, TreeViewGrammarGrammar, loadedWardleyGrammarGrammar, WardleyGrammarGrammar, ArchitectureGrammarLanguageMetaData, EventModelingLanguageMetaData, GitGraphGrammarLanguageMetaData, InfoGrammarLanguageMetaData, PacketGrammarLanguageMetaData, PieGrammarLanguageMetaData, RadarGrammarLanguageMetaData, TreemapGrammarLanguageMetaData, TreeViewGrammarLanguageMetaData, WardleyGrammarLanguageMetaData, MermaidGeneratedSharedModule, ArchitectureGrammarGeneratedModule, EventModelingGeneratedModule, GitGraphGrammarGeneratedModule, InfoGrammarGeneratedModule, PacketGrammarGeneratedModule, PieGrammarGeneratedModule, RadarGrammarGeneratedModule, TreemapGrammarGeneratedModule, TreeViewGrammarGeneratedModule, WardleyGrammarGeneratedModule, accessibilityDescrRegex, accessibilityTitleRegex, titleRegex, rulesRegexes, AbstractMermaidValueConverter, CommonValueConverter, AbstractMermaidTokenBuilder, CommonTokenBuilder; + var init_chunk_NNHCCRGN = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-NNHCCRGN.mjs"() { + "use strict"; + __create2 = Object.create; + __defProp2 = Object.defineProperty; + __getOwnPropDesc2 = Object.getOwnPropertyDescriptor; + __getOwnPropNames2 = Object.getOwnPropertyNames; + __getProtoOf2 = Object.getPrototypeOf; + __hasOwnProp2 = Object.prototype.hasOwnProperty; + __name2 = /* @__PURE__ */ __name((target, value2) => __defProp2(target, "name", { value: value2, configurable: true }), "__name"); + __esm2 = /* @__PURE__ */ __name((fn3, res) => /* @__PURE__ */ __name(function __init() { + return fn3 && (res = (0, fn3[__getOwnPropNames2(fn3)[0]])(fn3 = 0)), res; + }, "__init"), "__esm"); + __commonJS2 = /* @__PURE__ */ __name((cb, mod) => /* @__PURE__ */ __name(function __require() { + return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + }, "__require"), "__commonJS"); + __export2 = /* @__PURE__ */ __name((target, all) => { + for (var name in all) + __defProp2(target, name, { get: all[name], enumerable: true }); + }, "__export"); + __copyProps2 = /* @__PURE__ */ __name((to, from2, except, desc) => { + if (from2 && typeof from2 === "object" || typeof from2 === "function") { + for (let key of __getOwnPropNames2(from2)) + if (!__hasOwnProp2.call(to, key) && key !== except) + __defProp2(to, key, { get: /* @__PURE__ */ __name(() => from2[key], "get"), enumerable: !(desc = __getOwnPropDesc2(from2, key)) || desc.enumerable }); + } + return to; + }, "__copyProps"); + __reExport = /* @__PURE__ */ __name((target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default")), "__reExport"); + __toESM2 = /* @__PURE__ */ __name((mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, + mod + )), "__toESM"); + __toCommonJS2 = /* @__PURE__ */ __name((mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod), "__toCommonJS"); + main_exports = {}; + __export2(main_exports, { + AnnotatedTextEdit: /* @__PURE__ */ __name(() => AnnotatedTextEdit, "AnnotatedTextEdit"), + ChangeAnnotation: /* @__PURE__ */ __name(() => ChangeAnnotation, "ChangeAnnotation"), + ChangeAnnotationIdentifier: /* @__PURE__ */ __name(() => ChangeAnnotationIdentifier, "ChangeAnnotationIdentifier"), + CodeAction: /* @__PURE__ */ __name(() => CodeAction, "CodeAction"), + CodeActionContext: /* @__PURE__ */ __name(() => CodeActionContext, "CodeActionContext"), + CodeActionKind: /* @__PURE__ */ __name(() => CodeActionKind, "CodeActionKind"), + CodeActionTriggerKind: /* @__PURE__ */ __name(() => CodeActionTriggerKind, "CodeActionTriggerKind"), + CodeDescription: /* @__PURE__ */ __name(() => CodeDescription, "CodeDescription"), + CodeLens: /* @__PURE__ */ __name(() => CodeLens, "CodeLens"), + Color: /* @__PURE__ */ __name(() => Color3, "Color"), + ColorInformation: /* @__PURE__ */ __name(() => ColorInformation, "ColorInformation"), + ColorPresentation: /* @__PURE__ */ __name(() => ColorPresentation, "ColorPresentation"), + Command: /* @__PURE__ */ __name(() => Command, "Command"), + CompletionItem: /* @__PURE__ */ __name(() => CompletionItem, "CompletionItem"), + CompletionItemKind: /* @__PURE__ */ __name(() => CompletionItemKind, "CompletionItemKind"), + CompletionItemLabelDetails: /* @__PURE__ */ __name(() => CompletionItemLabelDetails, "CompletionItemLabelDetails"), + CompletionItemTag: /* @__PURE__ */ __name(() => CompletionItemTag, "CompletionItemTag"), + CompletionList: /* @__PURE__ */ __name(() => CompletionList, "CompletionList"), + CreateFile: /* @__PURE__ */ __name(() => CreateFile, "CreateFile"), + DeleteFile: /* @__PURE__ */ __name(() => DeleteFile, "DeleteFile"), + Diagnostic: /* @__PURE__ */ __name(() => Diagnostic, "Diagnostic"), + DiagnosticRelatedInformation: /* @__PURE__ */ __name(() => DiagnosticRelatedInformation, "DiagnosticRelatedInformation"), + DiagnosticSeverity: /* @__PURE__ */ __name(() => DiagnosticSeverity, "DiagnosticSeverity"), + DiagnosticTag: /* @__PURE__ */ __name(() => DiagnosticTag, "DiagnosticTag"), + DocumentHighlight: /* @__PURE__ */ __name(() => DocumentHighlight, "DocumentHighlight"), + DocumentHighlightKind: /* @__PURE__ */ __name(() => DocumentHighlightKind, "DocumentHighlightKind"), + DocumentLink: /* @__PURE__ */ __name(() => DocumentLink, "DocumentLink"), + DocumentSymbol: /* @__PURE__ */ __name(() => DocumentSymbol, "DocumentSymbol"), + DocumentUri: /* @__PURE__ */ __name(() => DocumentUri, "DocumentUri"), + EOL: /* @__PURE__ */ __name(() => EOL, "EOL"), + FoldingRange: /* @__PURE__ */ __name(() => FoldingRange, "FoldingRange"), + FoldingRangeKind: /* @__PURE__ */ __name(() => FoldingRangeKind, "FoldingRangeKind"), + FormattingOptions: /* @__PURE__ */ __name(() => FormattingOptions, "FormattingOptions"), + Hover: /* @__PURE__ */ __name(() => Hover, "Hover"), + InlayHint: /* @__PURE__ */ __name(() => InlayHint, "InlayHint"), + InlayHintKind: /* @__PURE__ */ __name(() => InlayHintKind, "InlayHintKind"), + InlayHintLabelPart: /* @__PURE__ */ __name(() => InlayHintLabelPart, "InlayHintLabelPart"), + InlineCompletionContext: /* @__PURE__ */ __name(() => InlineCompletionContext, "InlineCompletionContext"), + InlineCompletionItem: /* @__PURE__ */ __name(() => InlineCompletionItem, "InlineCompletionItem"), + InlineCompletionList: /* @__PURE__ */ __name(() => InlineCompletionList, "InlineCompletionList"), + InlineCompletionTriggerKind: /* @__PURE__ */ __name(() => InlineCompletionTriggerKind, "InlineCompletionTriggerKind"), + InlineValueContext: /* @__PURE__ */ __name(() => InlineValueContext, "InlineValueContext"), + InlineValueEvaluatableExpression: /* @__PURE__ */ __name(() => InlineValueEvaluatableExpression, "InlineValueEvaluatableExpression"), + InlineValueText: /* @__PURE__ */ __name(() => InlineValueText, "InlineValueText"), + InlineValueVariableLookup: /* @__PURE__ */ __name(() => InlineValueVariableLookup, "InlineValueVariableLookup"), + InsertReplaceEdit: /* @__PURE__ */ __name(() => InsertReplaceEdit, "InsertReplaceEdit"), + InsertTextFormat: /* @__PURE__ */ __name(() => InsertTextFormat, "InsertTextFormat"), + InsertTextMode: /* @__PURE__ */ __name(() => InsertTextMode, "InsertTextMode"), + Location: /* @__PURE__ */ __name(() => Location, "Location"), + LocationLink: /* @__PURE__ */ __name(() => LocationLink, "LocationLink"), + MarkedString: /* @__PURE__ */ __name(() => MarkedString, "MarkedString"), + MarkupContent: /* @__PURE__ */ __name(() => MarkupContent, "MarkupContent"), + MarkupKind: /* @__PURE__ */ __name(() => MarkupKind, "MarkupKind"), + OptionalVersionedTextDocumentIdentifier: /* @__PURE__ */ __name(() => OptionalVersionedTextDocumentIdentifier, "OptionalVersionedTextDocumentIdentifier"), + ParameterInformation: /* @__PURE__ */ __name(() => ParameterInformation, "ParameterInformation"), + Position: /* @__PURE__ */ __name(() => Position, "Position"), + Range: /* @__PURE__ */ __name(() => Range, "Range"), + RenameFile: /* @__PURE__ */ __name(() => RenameFile, "RenameFile"), + SelectedCompletionInfo: /* @__PURE__ */ __name(() => SelectedCompletionInfo, "SelectedCompletionInfo"), + SelectionRange: /* @__PURE__ */ __name(() => SelectionRange, "SelectionRange"), + SemanticTokenModifiers: /* @__PURE__ */ __name(() => SemanticTokenModifiers, "SemanticTokenModifiers"), + SemanticTokenTypes: /* @__PURE__ */ __name(() => SemanticTokenTypes, "SemanticTokenTypes"), + SemanticTokens: /* @__PURE__ */ __name(() => SemanticTokens, "SemanticTokens"), + SignatureInformation: /* @__PURE__ */ __name(() => SignatureInformation, "SignatureInformation"), + StringValue: /* @__PURE__ */ __name(() => StringValue, "StringValue"), + SymbolInformation: /* @__PURE__ */ __name(() => SymbolInformation, "SymbolInformation"), + SymbolKind: /* @__PURE__ */ __name(() => SymbolKind, "SymbolKind"), + SymbolTag: /* @__PURE__ */ __name(() => SymbolTag, "SymbolTag"), + TextDocument: /* @__PURE__ */ __name(() => TextDocument, "TextDocument"), + TextDocumentEdit: /* @__PURE__ */ __name(() => TextDocumentEdit, "TextDocumentEdit"), + TextDocumentIdentifier: /* @__PURE__ */ __name(() => TextDocumentIdentifier, "TextDocumentIdentifier"), + TextDocumentItem: /* @__PURE__ */ __name(() => TextDocumentItem, "TextDocumentItem"), + TextEdit: /* @__PURE__ */ __name(() => TextEdit, "TextEdit"), + URI: /* @__PURE__ */ __name(() => URI, "URI"), + VersionedTextDocumentIdentifier: /* @__PURE__ */ __name(() => VersionedTextDocumentIdentifier, "VersionedTextDocumentIdentifier"), + WorkspaceChange: /* @__PURE__ */ __name(() => WorkspaceChange, "WorkspaceChange"), + WorkspaceEdit: /* @__PURE__ */ __name(() => WorkspaceEdit, "WorkspaceEdit"), + WorkspaceFolder: /* @__PURE__ */ __name(() => WorkspaceFolder, "WorkspaceFolder"), + WorkspaceSymbol: /* @__PURE__ */ __name(() => WorkspaceSymbol, "WorkspaceSymbol"), + integer: /* @__PURE__ */ __name(() => integer3, "integer"), + uinteger: /* @__PURE__ */ __name(() => uinteger, "uinteger") + }); + init_main = __esm2({ + "../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"() { + "use strict"; + (function(DocumentUri2) { + function is2(value2) { + return typeof value2 === "string"; + } + __name(is2, "is"); + __name2(is2, "is"); + DocumentUri2.is = is2; + })(DocumentUri || (DocumentUri = {})); + (function(URI3) { + function is2(value2) { + return typeof value2 === "string"; + } + __name(is2, "is"); + __name2(is2, "is"); + URI3.is = is2; + })(URI || (URI = {})); + (function(integer22) { + integer22.MIN_VALUE = -2147483648; + integer22.MAX_VALUE = 2147483647; + function is2(value2) { + return typeof value2 === "number" && integer22.MIN_VALUE <= value2 && value2 <= integer22.MAX_VALUE; + } + __name(is2, "is"); + __name2(is2, "is"); + integer22.is = is2; + })(integer3 || (integer3 = {})); + (function(uinteger2) { + uinteger2.MIN_VALUE = 0; + uinteger2.MAX_VALUE = 2147483647; + function is2(value2) { + return typeof value2 === "number" && uinteger2.MIN_VALUE <= value2 && value2 <= uinteger2.MAX_VALUE; + } + __name(is2, "is"); + __name2(is2, "is"); + uinteger2.is = is2; + })(uinteger || (uinteger = {})); + (function(Position2) { + function create4(line2, character2) { + if (line2 === Number.MAX_VALUE) { + line2 = uinteger.MAX_VALUE; + } + if (character2 === Number.MAX_VALUE) { + character2 = uinteger.MAX_VALUE; + } + return { line: line2, character: character2 }; + } + __name(create4, "create"); + __name2(create4, "create"); + Position2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); + } + __name(is2, "is"); + __name2(is2, "is"); + Position2.is = is2; + })(Position || (Position = {})); + (function(Range2) { + function create4(one4, two, three, four) { + if (Is.uinteger(one4) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { + return { start: Position.create(one4, two), end: Position.create(three, four) }; + } else if (Position.is(one4) && Position.is(two)) { + return { start: one4, end: two }; + } else { + throw new Error(`Range#create called with invalid arguments[${one4}, ${two}, ${three}, ${four}]`); + } + } + __name(create4, "create"); + __name2(create4, "create"); + Range2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); + } + __name(is2, "is"); + __name2(is2, "is"); + Range2.is = is2; + })(Range || (Range = {})); + (function(Location2) { + function create4(uri, range3) { + return { uri, range: range3 }; + } + __name(create4, "create"); + __name2(create4, "create"); + Location2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); + } + __name(is2, "is"); + __name2(is2, "is"); + Location2.is = is2; + })(Location || (Location = {})); + (function(LocationLink2) { + function create4(targetUri, targetRange, targetSelectionRange, originSelectionRange) { + return { targetUri, targetRange, targetSelectionRange, originSelectionRange }; + } + __name(create4, "create"); + __name2(create4, "create"); + LocationLink2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && Range.is(candidate.targetSelectionRange) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); + } + __name(is2, "is"); + __name2(is2, "is"); + LocationLink2.is = is2; + })(LocationLink || (LocationLink = {})); + (function(Color22) { + function create4(red, green, blue, alpha) { + return { + red, + green, + blue, + alpha + }; + } + __name(create4, "create"); + __name2(create4, "create"); + Color22.create = create4; + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1); + } + __name(is2, "is"); + __name2(is2, "is"); + Color22.is = is2; + })(Color3 || (Color3 = {})); + (function(ColorInformation2) { + function create4(range3, color2) { + return { + range: range3, + color: color2 + }; + } + __name(create4, "create"); + __name2(create4, "create"); + ColorInformation2.create = create4; + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color3.is(candidate.color); + } + __name(is2, "is"); + __name2(is2, "is"); + ColorInformation2.is = is2; + })(ColorInformation || (ColorInformation = {})); + (function(ColorPresentation2) { + function create4(label, textEdit, additionalTextEdits) { + return { + label, + textEdit, + additionalTextEdits + }; + } + __name(create4, "create"); + __name2(create4, "create"); + ColorPresentation2.create = create4; + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); + } + __name(is2, "is"); + __name2(is2, "is"); + ColorPresentation2.is = is2; + })(ColorPresentation || (ColorPresentation = {})); + (function(FoldingRangeKind2) { + FoldingRangeKind2.Comment = "comment"; + FoldingRangeKind2.Imports = "imports"; + FoldingRangeKind2.Region = "region"; + })(FoldingRangeKind || (FoldingRangeKind = {})); + (function(FoldingRange2) { + function create4(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) { + const result = { + startLine, + endLine + }; + if (Is.defined(startCharacter)) { + result.startCharacter = startCharacter; + } + if (Is.defined(endCharacter)) { + result.endCharacter = endCharacter; + } + if (Is.defined(kind)) { + result.kind = kind; + } + if (Is.defined(collapsedText)) { + result.collapsedText = collapsedText; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + FoldingRange2.create = create4; + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); + } + __name(is2, "is"); + __name2(is2, "is"); + FoldingRange2.is = is2; + })(FoldingRange || (FoldingRange = {})); + (function(DiagnosticRelatedInformation2) { + function create4(location, message) { + return { + location, + message + }; + } + __name(create4, "create"); + __name2(create4, "create"); + DiagnosticRelatedInformation2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); + } + __name(is2, "is"); + __name2(is2, "is"); + DiagnosticRelatedInformation2.is = is2; + })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); + (function(DiagnosticSeverity2) { + DiagnosticSeverity2.Error = 1; + DiagnosticSeverity2.Warning = 2; + DiagnosticSeverity2.Information = 3; + DiagnosticSeverity2.Hint = 4; + })(DiagnosticSeverity || (DiagnosticSeverity = {})); + (function(DiagnosticTag2) { + DiagnosticTag2.Unnecessary = 1; + DiagnosticTag2.Deprecated = 2; + })(DiagnosticTag || (DiagnosticTag = {})); + (function(CodeDescription2) { + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && Is.string(candidate.href); + } + __name(is2, "is"); + __name2(is2, "is"); + CodeDescription2.is = is2; + })(CodeDescription || (CodeDescription = {})); + (function(Diagnostic2) { + function create4(range3, message, severity, code, source, relatedInformation) { + let result = { range: range3, message }; + if (Is.defined(severity)) { + result.severity = severity; + } + if (Is.defined(code)) { + result.code = code; + } + if (Is.defined(source)) { + result.source = source; + } + if (Is.defined(relatedInformation)) { + result.relatedInformation = relatedInformation; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + Diagnostic2.create = create4; + function is2(value2) { + var _a; + let candidate = value2; + return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); + } + __name(is2, "is"); + __name2(is2, "is"); + Diagnostic2.is = is2; + })(Diagnostic || (Diagnostic = {})); + (function(Command2) { + function create4(title2, command, ...args) { + let result = { title: title2, command }; + if (Is.defined(args) && args.length > 0) { + result.arguments = args; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + Command2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); + } + __name(is2, "is"); + __name2(is2, "is"); + Command2.is = is2; + })(Command || (Command = {})); + (function(TextEdit2) { + function replace2(range3, newText) { + return { range: range3, newText }; + } + __name(replace2, "replace"); + __name2(replace2, "replace"); + TextEdit2.replace = replace2; + function insert(position5, newText) { + return { range: { start: position5, end: position5 }, newText }; + } + __name(insert, "insert"); + __name2(insert, "insert"); + TextEdit2.insert = insert; + function del(range3) { + return { range: range3, newText: "" }; + } + __name(del, "del"); + __name2(del, "del"); + TextEdit2.del = del; + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range); + } + __name(is2, "is"); + __name2(is2, "is"); + TextEdit2.is = is2; + })(TextEdit || (TextEdit = {})); + (function(ChangeAnnotation2) { + function create4(label, needsConfirmation, description) { + const result = { label }; + if (needsConfirmation !== void 0) { + result.needsConfirmation = needsConfirmation; + } + if (description !== void 0) { + result.description = description; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + ChangeAnnotation2.create = create4; + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0); + } + __name(is2, "is"); + __name2(is2, "is"); + ChangeAnnotation2.is = is2; + })(ChangeAnnotation || (ChangeAnnotation = {})); + (function(ChangeAnnotationIdentifier2) { + function is2(value2) { + const candidate = value2; + return Is.string(candidate); + } + __name(is2, "is"); + __name2(is2, "is"); + ChangeAnnotationIdentifier2.is = is2; + })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); + (function(AnnotatedTextEdit2) { + function replace2(range3, newText, annotation) { + return { range: range3, newText, annotationId: annotation }; + } + __name(replace2, "replace"); + __name2(replace2, "replace"); + AnnotatedTextEdit2.replace = replace2; + function insert(position5, newText, annotation) { + return { range: { start: position5, end: position5 }, newText, annotationId: annotation }; + } + __name(insert, "insert"); + __name2(insert, "insert"); + AnnotatedTextEdit2.insert = insert; + function del(range3, annotation) { + return { range: range3, newText: "", annotationId: annotation }; + } + __name(del, "del"); + __name2(del, "del"); + AnnotatedTextEdit2.del = del; + function is2(value2) { + const candidate = value2; + return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + __name(is2, "is"); + __name2(is2, "is"); + AnnotatedTextEdit2.is = is2; + })(AnnotatedTextEdit || (AnnotatedTextEdit = {})); + (function(TextDocumentEdit2) { + function create4(textDocument, edits) { + return { textDocument, edits }; + } + __name(create4, "create"); + __name2(create4, "create"); + TextDocumentEdit2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits); + } + __name(is2, "is"); + __name2(is2, "is"); + TextDocumentEdit2.is = is2; + })(TextDocumentEdit || (TextDocumentEdit = {})); + (function(CreateFile2) { + function create4(uri, options2, annotation) { + let result = { + kind: "create", + uri + }; + if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) { + result.options = options2; + } + if (annotation !== void 0) { + result.annotationId = annotation; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + CreateFile2.create = create4; + function is2(value2) { + let candidate = value2; + return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + __name(is2, "is"); + __name2(is2, "is"); + CreateFile2.is = is2; + })(CreateFile || (CreateFile = {})); + (function(RenameFile2) { + function create4(oldUri, newUri, options2, annotation) { + let result = { + kind: "rename", + oldUri, + newUri + }; + if (options2 !== void 0 && (options2.overwrite !== void 0 || options2.ignoreIfExists !== void 0)) { + result.options = options2; + } + if (annotation !== void 0) { + result.annotationId = annotation; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + RenameFile2.create = create4; + function is2(value2) { + let candidate = value2; + return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + __name(is2, "is"); + __name2(is2, "is"); + RenameFile2.is = is2; + })(RenameFile || (RenameFile = {})); + (function(DeleteFile2) { + function create4(uri, options2, annotation) { + let result = { + kind: "delete", + uri + }; + if (options2 !== void 0 && (options2.recursive !== void 0 || options2.ignoreIfNotExists !== void 0)) { + result.options = options2; + } + if (annotation !== void 0) { + result.annotationId = annotation; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + DeleteFile2.create = create4; + function is2(value2) { + let candidate = value2; + return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId)); + } + __name(is2, "is"); + __name2(is2, "is"); + DeleteFile2.is = is2; + })(DeleteFile || (DeleteFile = {})); + (function(WorkspaceEdit2) { + function is2(value2) { + let candidate = value2; + return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every((change2) => { + if (Is.string(change2.kind)) { + return CreateFile.is(change2) || RenameFile.is(change2) || DeleteFile.is(change2); + } else { + return TextDocumentEdit.is(change2); + } + })); + } + __name(is2, "is"); + __name2(is2, "is"); + WorkspaceEdit2.is = is2; + })(WorkspaceEdit || (WorkspaceEdit = {})); + TextEditChangeImpl = class { + static { + __name(this, "TextEditChangeImpl"); + } + static { + __name2(this, "TextEditChangeImpl"); + } + constructor(edits, changeAnnotations) { + this.edits = edits; + this.changeAnnotations = changeAnnotations; + } + insert(position5, newText, annotation) { + let edit; + let id35; + if (annotation === void 0) { + edit = TextEdit.insert(position5, newText); + } else if (ChangeAnnotationIdentifier.is(annotation)) { + id35 = annotation; + edit = AnnotatedTextEdit.insert(position5, newText, annotation); + } else { + this.assertChangeAnnotations(this.changeAnnotations); + id35 = this.changeAnnotations.manage(annotation); + edit = AnnotatedTextEdit.insert(position5, newText, id35); + } + this.edits.push(edit); + if (id35 !== void 0) { + return id35; + } + } + replace(range3, newText, annotation) { + let edit; + let id35; + if (annotation === void 0) { + edit = TextEdit.replace(range3, newText); + } else if (ChangeAnnotationIdentifier.is(annotation)) { + id35 = annotation; + edit = AnnotatedTextEdit.replace(range3, newText, annotation); + } else { + this.assertChangeAnnotations(this.changeAnnotations); + id35 = this.changeAnnotations.manage(annotation); + edit = AnnotatedTextEdit.replace(range3, newText, id35); + } + this.edits.push(edit); + if (id35 !== void 0) { + return id35; + } + } + delete(range3, annotation) { + let edit; + let id35; + if (annotation === void 0) { + edit = TextEdit.del(range3); + } else if (ChangeAnnotationIdentifier.is(annotation)) { + id35 = annotation; + edit = AnnotatedTextEdit.del(range3, annotation); + } else { + this.assertChangeAnnotations(this.changeAnnotations); + id35 = this.changeAnnotations.manage(annotation); + edit = AnnotatedTextEdit.del(range3, id35); + } + this.edits.push(edit); + if (id35 !== void 0) { + return id35; + } + } + add(edit) { + this.edits.push(edit); + } + all() { + return this.edits; + } + clear() { + this.edits.splice(0, this.edits.length); + } + assertChangeAnnotations(value2) { + if (value2 === void 0) { + throw new Error(`Text edit change is not configured to manage change annotations.`); + } + } + }; + ChangeAnnotations = class { + static { + __name(this, "ChangeAnnotations"); + } + static { + __name2(this, "ChangeAnnotations"); + } + constructor(annotations) { + this._annotations = annotations === void 0 ? /* @__PURE__ */ Object.create(null) : annotations; + this._counter = 0; + this._size = 0; + } + all() { + return this._annotations; + } + get size() { + return this._size; + } + manage(idOrAnnotation, annotation) { + let id35; + if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { + id35 = idOrAnnotation; + } else { + id35 = this.nextId(); + annotation = idOrAnnotation; + } + if (this._annotations[id35] !== void 0) { + throw new Error(`Id ${id35} is already in use.`); + } + if (annotation === void 0) { + throw new Error(`No annotation provided for id ${id35}`); + } + this._annotations[id35] = annotation; + this._size++; + return id35; + } + nextId() { + this._counter++; + return this._counter.toString(); + } + }; + WorkspaceChange = class { + static { + __name(this, "WorkspaceChange"); + } + static { + __name2(this, "WorkspaceChange"); + } + constructor(workspaceEdit) { + this._textEditChanges = /* @__PURE__ */ Object.create(null); + if (workspaceEdit !== void 0) { + this._workspaceEdit = workspaceEdit; + if (workspaceEdit.documentChanges) { + this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); + workspaceEdit.changeAnnotations = this._changeAnnotations.all(); + workspaceEdit.documentChanges.forEach((change2) => { + if (TextDocumentEdit.is(change2)) { + const textEditChange = new TextEditChangeImpl(change2.edits, this._changeAnnotations); + this._textEditChanges[change2.textDocument.uri] = textEditChange; + } + }); + } else if (workspaceEdit.changes) { + Object.keys(workspaceEdit.changes).forEach((key) => { + const textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); + this._textEditChanges[key] = textEditChange; + }); + } + } else { + this._workspaceEdit = {}; + } + } + /** + * Returns the underlying {@link WorkspaceEdit} literal + * use to be returned from a workspace edit operation like rename. + */ + get edit() { + this.initDocumentChanges(); + if (this._changeAnnotations !== void 0) { + if (this._changeAnnotations.size === 0) { + this._workspaceEdit.changeAnnotations = void 0; + } else { + this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); + } + } + return this._workspaceEdit; + } + getTextEditChange(key) { + if (OptionalVersionedTextDocumentIdentifier.is(key)) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + const textDocument = { uri: key.uri, version: key.version }; + let result = this._textEditChanges[textDocument.uri]; + if (!result) { + const edits = []; + const textDocumentEdit = { + textDocument, + edits + }; + this._workspaceEdit.documentChanges.push(textDocumentEdit); + result = new TextEditChangeImpl(edits, this._changeAnnotations); + this._textEditChanges[textDocument.uri] = result; + } + return result; + } else { + this.initChanges(); + if (this._workspaceEdit.changes === void 0) { + throw new Error("Workspace edit is not configured for normal text edit changes."); + } + let result = this._textEditChanges[key]; + if (!result) { + let edits = []; + this._workspaceEdit.changes[key] = edits; + result = new TextEditChangeImpl(edits); + this._textEditChanges[key] = result; + } + return result; + } + } + initDocumentChanges() { + if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { + this._changeAnnotations = new ChangeAnnotations(); + this._workspaceEdit.documentChanges = []; + this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); + } + } + initChanges() { + if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) { + this._workspaceEdit.changes = /* @__PURE__ */ Object.create(null); + } + } + createFile(uri, optionsOrAnnotation, options2) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + let annotation; + if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { + annotation = optionsOrAnnotation; + } else { + options2 = optionsOrAnnotation; + } + let operation; + let id35; + if (annotation === void 0) { + operation = CreateFile.create(uri, options2); + } else { + id35 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); + operation = CreateFile.create(uri, options2, id35); + } + this._workspaceEdit.documentChanges.push(operation); + if (id35 !== void 0) { + return id35; + } + } + renameFile(oldUri, newUri, optionsOrAnnotation, options2) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + let annotation; + if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { + annotation = optionsOrAnnotation; + } else { + options2 = optionsOrAnnotation; + } + let operation; + let id35; + if (annotation === void 0) { + operation = RenameFile.create(oldUri, newUri, options2); + } else { + id35 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); + operation = RenameFile.create(oldUri, newUri, options2, id35); + } + this._workspaceEdit.documentChanges.push(operation); + if (id35 !== void 0) { + return id35; + } + } + deleteFile(uri, optionsOrAnnotation, options2) { + this.initDocumentChanges(); + if (this._workspaceEdit.documentChanges === void 0) { + throw new Error("Workspace edit is not configured for document changes."); + } + let annotation; + if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { + annotation = optionsOrAnnotation; + } else { + options2 = optionsOrAnnotation; + } + let operation; + let id35; + if (annotation === void 0) { + operation = DeleteFile.create(uri, options2); + } else { + id35 = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); + operation = DeleteFile.create(uri, options2, id35); + } + this._workspaceEdit.documentChanges.push(operation); + if (id35 !== void 0) { + return id35; + } + } + }; + (function(TextDocumentIdentifier2) { + function create4(uri) { + return { uri }; + } + __name(create4, "create"); + __name2(create4, "create"); + TextDocumentIdentifier2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Is.string(candidate.uri); + } + __name(is2, "is"); + __name2(is2, "is"); + TextDocumentIdentifier2.is = is2; + })(TextDocumentIdentifier || (TextDocumentIdentifier = {})); + (function(VersionedTextDocumentIdentifier2) { + function create4(uri, version3) { + return { uri, version: version3 }; + } + __name(create4, "create"); + __name2(create4, "create"); + VersionedTextDocumentIdentifier2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); + } + __name(is2, "is"); + __name2(is2, "is"); + VersionedTextDocumentIdentifier2.is = is2; + })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); + (function(OptionalVersionedTextDocumentIdentifier2) { + function create4(uri, version3) { + return { uri, version: version3 }; + } + __name(create4, "create"); + __name2(create4, "create"); + OptionalVersionedTextDocumentIdentifier2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); + } + __name(is2, "is"); + __name2(is2, "is"); + OptionalVersionedTextDocumentIdentifier2.is = is2; + })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); + (function(TextDocumentItem2) { + function create4(uri, languageId, version3, text4) { + return { uri, languageId, version: version3, text: text4 }; + } + __name(create4, "create"); + __name2(create4, "create"); + TextDocumentItem2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); + } + __name(is2, "is"); + __name2(is2, "is"); + TextDocumentItem2.is = is2; + })(TextDocumentItem || (TextDocumentItem = {})); + (function(MarkupKind2) { + MarkupKind2.PlainText = "plaintext"; + MarkupKind2.Markdown = "markdown"; + function is2(value2) { + const candidate = value2; + return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown; + } + __name(is2, "is"); + __name2(is2, "is"); + MarkupKind2.is = is2; + })(MarkupKind || (MarkupKind = {})); + (function(MarkupContent2) { + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(value2) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); + } + __name(is2, "is"); + __name2(is2, "is"); + MarkupContent2.is = is2; + })(MarkupContent || (MarkupContent = {})); + (function(CompletionItemKind2) { + CompletionItemKind2.Text = 1; + CompletionItemKind2.Method = 2; + CompletionItemKind2.Function = 3; + CompletionItemKind2.Constructor = 4; + CompletionItemKind2.Field = 5; + CompletionItemKind2.Variable = 6; + CompletionItemKind2.Class = 7; + CompletionItemKind2.Interface = 8; + CompletionItemKind2.Module = 9; + CompletionItemKind2.Property = 10; + CompletionItemKind2.Unit = 11; + CompletionItemKind2.Value = 12; + CompletionItemKind2.Enum = 13; + CompletionItemKind2.Keyword = 14; + CompletionItemKind2.Snippet = 15; + CompletionItemKind2.Color = 16; + CompletionItemKind2.File = 17; + CompletionItemKind2.Reference = 18; + CompletionItemKind2.Folder = 19; + CompletionItemKind2.EnumMember = 20; + CompletionItemKind2.Constant = 21; + CompletionItemKind2.Struct = 22; + CompletionItemKind2.Event = 23; + CompletionItemKind2.Operator = 24; + CompletionItemKind2.TypeParameter = 25; + })(CompletionItemKind || (CompletionItemKind = {})); + (function(InsertTextFormat2) { + InsertTextFormat2.PlainText = 1; + InsertTextFormat2.Snippet = 2; + })(InsertTextFormat || (InsertTextFormat = {})); + (function(CompletionItemTag2) { + CompletionItemTag2.Deprecated = 1; + })(CompletionItemTag || (CompletionItemTag = {})); + (function(InsertReplaceEdit2) { + function create4(newText, insert, replace2) { + return { newText, insert, replace: replace2 }; + } + __name(create4, "create"); + __name2(create4, "create"); + InsertReplaceEdit2.create = create4; + function is2(value2) { + const candidate = value2; + return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace); + } + __name(is2, "is"); + __name2(is2, "is"); + InsertReplaceEdit2.is = is2; + })(InsertReplaceEdit || (InsertReplaceEdit = {})); + (function(InsertTextMode2) { + InsertTextMode2.asIs = 1; + InsertTextMode2.adjustIndentation = 2; + })(InsertTextMode || (InsertTextMode = {})); + (function(CompletionItemLabelDetails2) { + function is2(value2) { + const candidate = value2; + return candidate && (Is.string(candidate.detail) || candidate.detail === void 0) && (Is.string(candidate.description) || candidate.description === void 0); + } + __name(is2, "is"); + __name2(is2, "is"); + CompletionItemLabelDetails2.is = is2; + })(CompletionItemLabelDetails || (CompletionItemLabelDetails = {})); + (function(CompletionItem2) { + function create4(label) { + return { label }; + } + __name(create4, "create"); + __name2(create4, "create"); + CompletionItem2.create = create4; + })(CompletionItem || (CompletionItem = {})); + (function(CompletionList2) { + function create4(items, isIncomplete) { + return { items: items ? items : [], isIncomplete: !!isIncomplete }; + } + __name(create4, "create"); + __name2(create4, "create"); + CompletionList2.create = create4; + })(CompletionList || (CompletionList = {})); + (function(MarkedString2) { + function fromPlainText(plainText) { + return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); + } + __name(fromPlainText, "fromPlainText"); + __name2(fromPlainText, "fromPlainText"); + MarkedString2.fromPlainText = fromPlainText; + function is2(value2) { + const candidate = value2; + return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value); + } + __name(is2, "is"); + __name2(is2, "is"); + MarkedString2.is = is2; + })(MarkedString || (MarkedString = {})); + (function(Hover2) { + function is2(value2) { + let candidate = value2; + return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value2.range === void 0 || Range.is(value2.range)); + } + __name(is2, "is"); + __name2(is2, "is"); + Hover2.is = is2; + })(Hover || (Hover = {})); + (function(ParameterInformation2) { + function create4(label, documentation) { + return documentation ? { label, documentation } : { label }; + } + __name(create4, "create"); + __name2(create4, "create"); + ParameterInformation2.create = create4; + })(ParameterInformation || (ParameterInformation = {})); + (function(SignatureInformation2) { + function create4(label, documentation, ...parameters) { + let result = { label }; + if (Is.defined(documentation)) { + result.documentation = documentation; + } + if (Is.defined(parameters)) { + result.parameters = parameters; + } else { + result.parameters = []; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + SignatureInformation2.create = create4; + })(SignatureInformation || (SignatureInformation = {})); + (function(DocumentHighlightKind2) { + DocumentHighlightKind2.Text = 1; + DocumentHighlightKind2.Read = 2; + DocumentHighlightKind2.Write = 3; + })(DocumentHighlightKind || (DocumentHighlightKind = {})); + (function(DocumentHighlight2) { + function create4(range3, kind) { + let result = { range: range3 }; + if (Is.number(kind)) { + result.kind = kind; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + DocumentHighlight2.create = create4; + })(DocumentHighlight || (DocumentHighlight = {})); + (function(SymbolKind2) { + SymbolKind2.File = 1; + SymbolKind2.Module = 2; + SymbolKind2.Namespace = 3; + SymbolKind2.Package = 4; + SymbolKind2.Class = 5; + SymbolKind2.Method = 6; + SymbolKind2.Property = 7; + SymbolKind2.Field = 8; + SymbolKind2.Constructor = 9; + SymbolKind2.Enum = 10; + SymbolKind2.Interface = 11; + SymbolKind2.Function = 12; + SymbolKind2.Variable = 13; + SymbolKind2.Constant = 14; + SymbolKind2.String = 15; + SymbolKind2.Number = 16; + SymbolKind2.Boolean = 17; + SymbolKind2.Array = 18; + SymbolKind2.Object = 19; + SymbolKind2.Key = 20; + SymbolKind2.Null = 21; + SymbolKind2.EnumMember = 22; + SymbolKind2.Struct = 23; + SymbolKind2.Event = 24; + SymbolKind2.Operator = 25; + SymbolKind2.TypeParameter = 26; + })(SymbolKind || (SymbolKind = {})); + (function(SymbolTag2) { + SymbolTag2.Deprecated = 1; + })(SymbolTag || (SymbolTag = {})); + (function(SymbolInformation2) { + function create4(name, kind, range3, uri, containerName) { + let result = { + name, + kind, + location: { uri, range: range3 } + }; + if (containerName) { + result.containerName = containerName; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + SymbolInformation2.create = create4; + })(SymbolInformation || (SymbolInformation = {})); + (function(WorkspaceSymbol2) { + function create4(name, kind, uri, range3) { + return range3 !== void 0 ? { name, kind, location: { uri, range: range3 } } : { name, kind, location: { uri } }; + } + __name(create4, "create"); + __name2(create4, "create"); + WorkspaceSymbol2.create = create4; + })(WorkspaceSymbol || (WorkspaceSymbol = {})); + (function(DocumentSymbol2) { + function create4(name, detail, kind, range3, selectionRange, children2) { + let result = { + name, + detail, + kind, + range: range3, + selectionRange + }; + if (children2 !== void 0) { + result.children = children2; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + DocumentSymbol2.create = create4; + function is2(value2) { + let candidate = value2; + return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags)); + } + __name(is2, "is"); + __name2(is2, "is"); + DocumentSymbol2.is = is2; + })(DocumentSymbol || (DocumentSymbol = {})); + (function(CodeActionKind2) { + CodeActionKind2.Empty = ""; + CodeActionKind2.QuickFix = "quickfix"; + CodeActionKind2.Refactor = "refactor"; + CodeActionKind2.RefactorExtract = "refactor.extract"; + CodeActionKind2.RefactorInline = "refactor.inline"; + CodeActionKind2.RefactorRewrite = "refactor.rewrite"; + CodeActionKind2.Source = "source"; + CodeActionKind2.SourceOrganizeImports = "source.organizeImports"; + CodeActionKind2.SourceFixAll = "source.fixAll"; + })(CodeActionKind || (CodeActionKind = {})); + (function(CodeActionTriggerKind2) { + CodeActionTriggerKind2.Invoked = 1; + CodeActionTriggerKind2.Automatic = 2; + })(CodeActionTriggerKind || (CodeActionTriggerKind = {})); + (function(CodeActionContext2) { + function create4(diagnostics, only, triggerKind) { + let result = { diagnostics }; + if (only !== void 0 && only !== null) { + result.only = only; + } + if (triggerKind !== void 0 && triggerKind !== null) { + result.triggerKind = triggerKind; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + CodeActionContext2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string)) && (candidate.triggerKind === void 0 || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic); + } + __name(is2, "is"); + __name2(is2, "is"); + CodeActionContext2.is = is2; + })(CodeActionContext || (CodeActionContext = {})); + (function(CodeAction2) { + function create4(title2, kindOrCommandOrEdit, kind) { + let result = { title: title2 }; + let checkKind = true; + if (typeof kindOrCommandOrEdit === "string") { + checkKind = false; + result.kind = kindOrCommandOrEdit; + } else if (Command.is(kindOrCommandOrEdit)) { + result.command = kindOrCommandOrEdit; + } else { + result.edit = kindOrCommandOrEdit; + } + if (checkKind && kind !== void 0) { + result.kind = kind; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + CodeAction2.create = create4; + function is2(value2) { + let candidate = value2; + return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit)); + } + __name(is2, "is"); + __name2(is2, "is"); + CodeAction2.is = is2; + })(CodeAction || (CodeAction = {})); + (function(CodeLens2) { + function create4(range3, data5) { + let result = { range: range3 }; + if (Is.defined(data5)) { + result.data = data5; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + CodeLens2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); + } + __name(is2, "is"); + __name2(is2, "is"); + CodeLens2.is = is2; + })(CodeLens || (CodeLens = {})); + (function(FormattingOptions2) { + function create4(tabSize, insertSpaces) { + return { tabSize, insertSpaces }; + } + __name(create4, "create"); + __name2(create4, "create"); + FormattingOptions2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); + } + __name(is2, "is"); + __name2(is2, "is"); + FormattingOptions2.is = is2; + })(FormattingOptions || (FormattingOptions = {})); + (function(DocumentLink2) { + function create4(range3, target, data5) { + return { range: range3, target, data: data5 }; + } + __name(create4, "create"); + __name2(create4, "create"); + DocumentLink2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); + } + __name(is2, "is"); + __name2(is2, "is"); + DocumentLink2.is = is2; + })(DocumentLink || (DocumentLink = {})); + (function(SelectionRange2) { + function create4(range3, parent4) { + return { range: range3, parent: parent4 }; + } + __name(create4, "create"); + __name2(create4, "create"); + SelectionRange2.create = create4; + function is2(value2) { + let candidate = value2; + return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent)); + } + __name(is2, "is"); + __name2(is2, "is"); + SelectionRange2.is = is2; + })(SelectionRange || (SelectionRange = {})); + (function(SemanticTokenTypes2) { + SemanticTokenTypes2["namespace"] = "namespace"; + SemanticTokenTypes2["type"] = "type"; + SemanticTokenTypes2["class"] = "class"; + SemanticTokenTypes2["enum"] = "enum"; + SemanticTokenTypes2["interface"] = "interface"; + SemanticTokenTypes2["struct"] = "struct"; + SemanticTokenTypes2["typeParameter"] = "typeParameter"; + SemanticTokenTypes2["parameter"] = "parameter"; + SemanticTokenTypes2["variable"] = "variable"; + SemanticTokenTypes2["property"] = "property"; + SemanticTokenTypes2["enumMember"] = "enumMember"; + SemanticTokenTypes2["event"] = "event"; + SemanticTokenTypes2["function"] = "function"; + SemanticTokenTypes2["method"] = "method"; + SemanticTokenTypes2["macro"] = "macro"; + SemanticTokenTypes2["keyword"] = "keyword"; + SemanticTokenTypes2["modifier"] = "modifier"; + SemanticTokenTypes2["comment"] = "comment"; + SemanticTokenTypes2["string"] = "string"; + SemanticTokenTypes2["number"] = "number"; + SemanticTokenTypes2["regexp"] = "regexp"; + SemanticTokenTypes2["operator"] = "operator"; + SemanticTokenTypes2["decorator"] = "decorator"; + })(SemanticTokenTypes || (SemanticTokenTypes = {})); + (function(SemanticTokenModifiers2) { + SemanticTokenModifiers2["declaration"] = "declaration"; + SemanticTokenModifiers2["definition"] = "definition"; + SemanticTokenModifiers2["readonly"] = "readonly"; + SemanticTokenModifiers2["static"] = "static"; + SemanticTokenModifiers2["deprecated"] = "deprecated"; + SemanticTokenModifiers2["abstract"] = "abstract"; + SemanticTokenModifiers2["async"] = "async"; + SemanticTokenModifiers2["modification"] = "modification"; + SemanticTokenModifiers2["documentation"] = "documentation"; + SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary"; + })(SemanticTokenModifiers || (SemanticTokenModifiers = {})); + (function(SemanticTokens2) { + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number"); + } + __name(is2, "is"); + __name2(is2, "is"); + SemanticTokens2.is = is2; + })(SemanticTokens || (SemanticTokens = {})); + (function(InlineValueText2) { + function create4(range3, text4) { + return { range: range3, text: text4 }; + } + __name(create4, "create"); + __name2(create4, "create"); + InlineValueText2.create = create4; + function is2(value2) { + const candidate = value2; + return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text); + } + __name(is2, "is"); + __name2(is2, "is"); + InlineValueText2.is = is2; + })(InlineValueText || (InlineValueText = {})); + (function(InlineValueVariableLookup2) { + function create4(range3, variableName, caseSensitiveLookup) { + return { range: range3, variableName, caseSensitiveLookup }; + } + __name(create4, "create"); + __name2(create4, "create"); + InlineValueVariableLookup2.create = create4; + function is2(value2) { + const candidate = value2; + return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup) && (Is.string(candidate.variableName) || candidate.variableName === void 0); + } + __name(is2, "is"); + __name2(is2, "is"); + InlineValueVariableLookup2.is = is2; + })(InlineValueVariableLookup || (InlineValueVariableLookup = {})); + (function(InlineValueEvaluatableExpression2) { + function create4(range3, expression) { + return { range: range3, expression }; + } + __name(create4, "create"); + __name2(create4, "create"); + InlineValueEvaluatableExpression2.create = create4; + function is2(value2) { + const candidate = value2; + return candidate !== void 0 && candidate !== null && Range.is(candidate.range) && (Is.string(candidate.expression) || candidate.expression === void 0); + } + __name(is2, "is"); + __name2(is2, "is"); + InlineValueEvaluatableExpression2.is = is2; + })(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {})); + (function(InlineValueContext2) { + function create4(frameId, stoppedLocation) { + return { frameId, stoppedLocation }; + } + __name(create4, "create"); + __name2(create4, "create"); + InlineValueContext2.create = create4; + function is2(value2) { + const candidate = value2; + return Is.defined(candidate) && Range.is(value2.stoppedLocation); + } + __name(is2, "is"); + __name2(is2, "is"); + InlineValueContext2.is = is2; + })(InlineValueContext || (InlineValueContext = {})); + (function(InlayHintKind2) { + InlayHintKind2.Type = 1; + InlayHintKind2.Parameter = 2; + function is2(value2) { + return value2 === 1 || value2 === 2; + } + __name(is2, "is"); + __name2(is2, "is"); + InlayHintKind2.is = is2; + })(InlayHintKind || (InlayHintKind = {})); + (function(InlayHintLabelPart2) { + function create4(value2) { + return { value: value2 }; + } + __name(create4, "create"); + __name2(create4, "create"); + InlayHintLabelPart2.create = create4; + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.location === void 0 || Location.is(candidate.location)) && (candidate.command === void 0 || Command.is(candidate.command)); + } + __name(is2, "is"); + __name2(is2, "is"); + InlayHintLabelPart2.is = is2; + })(InlayHintLabelPart || (InlayHintLabelPart = {})); + (function(InlayHint2) { + function create4(position5, label, kind) { + const result = { position: position5, label }; + if (kind !== void 0) { + result.kind = kind; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + InlayHint2.create = create4; + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && Position.is(candidate.position) && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is)) && (candidate.kind === void 0 || InlayHintKind.is(candidate.kind)) && candidate.textEdits === void 0 || Is.typedArray(candidate.textEdits, TextEdit.is) && (candidate.tooltip === void 0 || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip)) && (candidate.paddingLeft === void 0 || Is.boolean(candidate.paddingLeft)) && (candidate.paddingRight === void 0 || Is.boolean(candidate.paddingRight)); + } + __name(is2, "is"); + __name2(is2, "is"); + InlayHint2.is = is2; + })(InlayHint || (InlayHint = {})); + (function(StringValue2) { + function createSnippet(value2) { + return { kind: "snippet", value: value2 }; + } + __name(createSnippet, "createSnippet"); + __name2(createSnippet, "createSnippet"); + StringValue2.createSnippet = createSnippet; + })(StringValue || (StringValue = {})); + (function(InlineCompletionItem2) { + function create4(insertText, filterText, range3, command) { + return { insertText, filterText, range: range3, command }; + } + __name(create4, "create"); + __name2(create4, "create"); + InlineCompletionItem2.create = create4; + })(InlineCompletionItem || (InlineCompletionItem = {})); + (function(InlineCompletionList2) { + function create4(items) { + return { items }; + } + __name(create4, "create"); + __name2(create4, "create"); + InlineCompletionList2.create = create4; + })(InlineCompletionList || (InlineCompletionList = {})); + (function(InlineCompletionTriggerKind2) { + InlineCompletionTriggerKind2.Invoked = 0; + InlineCompletionTriggerKind2.Automatic = 1; + })(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {})); + (function(SelectedCompletionInfo2) { + function create4(range3, text4) { + return { range: range3, text: text4 }; + } + __name(create4, "create"); + __name2(create4, "create"); + SelectedCompletionInfo2.create = create4; + })(SelectedCompletionInfo || (SelectedCompletionInfo = {})); + (function(InlineCompletionContext2) { + function create4(triggerKind, selectedCompletionInfo) { + return { triggerKind, selectedCompletionInfo }; + } + __name(create4, "create"); + __name2(create4, "create"); + InlineCompletionContext2.create = create4; + })(InlineCompletionContext || (InlineCompletionContext = {})); + (function(WorkspaceFolder2) { + function is2(value2) { + const candidate = value2; + return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name); + } + __name(is2, "is"); + __name2(is2, "is"); + WorkspaceFolder2.is = is2; + })(WorkspaceFolder || (WorkspaceFolder = {})); + EOL = ["\n", "\r\n", "\r"]; + (function(TextDocument3) { + function create4(uri, languageId, version3, content) { + return new FullTextDocument(uri, languageId, version3, content); + } + __name(create4, "create"); + __name2(create4, "create"); + TextDocument3.create = create4; + function is2(value2) { + let candidate = value2; + return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; + } + __name(is2, "is"); + __name2(is2, "is"); + TextDocument3.is = is2; + function applyEdits(document2, edits) { + let text4 = document2.getText(); + let sortedEdits = mergeSort2(edits, (a2, b3) => { + let diff2 = a2.range.start.line - b3.range.start.line; + if (diff2 === 0) { + return a2.range.start.character - b3.range.start.character; + } + return diff2; + }); + let lastModifiedOffset = text4.length; + for (let i2 = sortedEdits.length - 1; i2 >= 0; i2--) { + let e3 = sortedEdits[i2]; + let startOffset = document2.offsetAt(e3.range.start); + let endOffset = document2.offsetAt(e3.range.end); + if (endOffset <= lastModifiedOffset) { + text4 = text4.substring(0, startOffset) + e3.newText + text4.substring(endOffset, text4.length); + } else { + throw new Error("Overlapping edit"); + } + lastModifiedOffset = startOffset; + } + return text4; + } + __name(applyEdits, "applyEdits"); + __name2(applyEdits, "applyEdits"); + TextDocument3.applyEdits = applyEdits; + function mergeSort2(data5, compare) { + if (data5.length <= 1) { + return data5; + } + const p3 = data5.length / 2 | 0; + const left3 = data5.slice(0, p3); + const right3 = data5.slice(p3); + mergeSort2(left3, compare); + mergeSort2(right3, compare); + let leftIdx = 0; + let rightIdx = 0; + let i2 = 0; + while (leftIdx < left3.length && rightIdx < right3.length) { + let ret = compare(left3[leftIdx], right3[rightIdx]); + if (ret <= 0) { + data5[i2++] = left3[leftIdx++]; + } else { + data5[i2++] = right3[rightIdx++]; + } + } + while (leftIdx < left3.length) { + data5[i2++] = left3[leftIdx++]; + } + while (rightIdx < right3.length) { + data5[i2++] = right3[rightIdx++]; + } + return data5; + } + __name(mergeSort2, "mergeSort2"); + __name2(mergeSort2, "mergeSort"); + })(TextDocument || (TextDocument = {})); + FullTextDocument = class { + static { + __name(this, "FullTextDocument"); + } + static { + __name2(this, "FullTextDocument"); + } + constructor(uri, languageId, version3, content) { + this._uri = uri; + this._languageId = languageId; + this._version = version3; + this._content = content; + this._lineOffsets = void 0; + } + get uri() { + return this._uri; + } + get languageId() { + return this._languageId; + } + get version() { + return this._version; + } + getText(range3) { + if (range3) { + let start3 = this.offsetAt(range3.start); + let end2 = this.offsetAt(range3.end); + return this._content.substring(start3, end2); + } + return this._content; + } + update(event3, version3) { + this._content = event3.text; + this._version = version3; + this._lineOffsets = void 0; + } + getLineOffsets() { + if (this._lineOffsets === void 0) { + let lineOffsets = []; + let text4 = this._content; + let isLineStart = true; + for (let i2 = 0; i2 < text4.length; i2++) { + if (isLineStart) { + lineOffsets.push(i2); + isLineStart = false; + } + let ch = text4.charAt(i2); + isLineStart = ch === "\r" || ch === "\n"; + if (ch === "\r" && i2 + 1 < text4.length && text4.charAt(i2 + 1) === "\n") { + i2++; + } + } + if (isLineStart && text4.length > 0) { + lineOffsets.push(text4.length); + } + this._lineOffsets = lineOffsets; + } + return this._lineOffsets; + } + positionAt(offset) { + offset = Math.max(Math.min(offset, this._content.length), 0); + let lineOffsets = this.getLineOffsets(); + let low = 0, high = lineOffsets.length; + if (high === 0) { + return Position.create(0, offset); + } + while (low < high) { + let mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } else { + low = mid + 1; + } + } + let line2 = low - 1; + return Position.create(line2, offset - lineOffsets[line2]); + } + offsetAt(position5) { + let lineOffsets = this.getLineOffsets(); + if (position5.line >= lineOffsets.length) { + return this._content.length; + } else if (position5.line < 0) { + return 0; + } + let lineOffset = lineOffsets[position5.line]; + let nextLineOffset = position5.line + 1 < lineOffsets.length ? lineOffsets[position5.line + 1] : this._content.length; + return Math.max(Math.min(lineOffset + position5.character, nextLineOffset), lineOffset); + } + get lineCount() { + return this.getLineOffsets().length; + } + }; + (function(Is2) { + const toString42 = Object.prototype.toString; + function defined(value2) { + return typeof value2 !== "undefined"; + } + __name(defined, "defined"); + __name2(defined, "defined"); + Is2.defined = defined; + function undefined2(value2) { + return typeof value2 === "undefined"; + } + __name(undefined2, "undefined2"); + __name2(undefined2, "undefined"); + Is2.undefined = undefined2; + function boolean(value2) { + return value2 === true || value2 === false; + } + __name(boolean, "boolean"); + __name2(boolean, "boolean"); + Is2.boolean = boolean; + function string3(value2) { + return toString42.call(value2) === "[object String]"; + } + __name(string3, "string"); + __name2(string3, "string"); + Is2.string = string3; + function number7(value2) { + return toString42.call(value2) === "[object Number]"; + } + __name(number7, "number"); + __name2(number7, "number"); + Is2.number = number7; + function numberRange(value2, min22, max10) { + return toString42.call(value2) === "[object Number]" && min22 <= value2 && value2 <= max10; + } + __name(numberRange, "numberRange"); + __name2(numberRange, "numberRange"); + Is2.numberRange = numberRange; + function integer22(value2) { + return toString42.call(value2) === "[object Number]" && -2147483648 <= value2 && value2 <= 2147483647; + } + __name(integer22, "integer2"); + __name2(integer22, "integer"); + Is2.integer = integer22; + function uinteger2(value2) { + return toString42.call(value2) === "[object Number]" && 0 <= value2 && value2 <= 2147483647; + } + __name(uinteger2, "uinteger2"); + __name2(uinteger2, "uinteger"); + Is2.uinteger = uinteger2; + function func(value2) { + return toString42.call(value2) === "[object Function]"; + } + __name(func, "func"); + __name2(func, "func"); + Is2.func = func; + function objectLiteral(value2) { + return value2 !== null && typeof value2 === "object"; + } + __name(objectLiteral, "objectLiteral"); + __name2(objectLiteral, "objectLiteral"); + Is2.objectLiteral = objectLiteral; + function typedArray(value2, check) { + return Array.isArray(value2) && value2.every(check); + } + __name(typedArray, "typedArray"); + __name2(typedArray, "typedArray"); + Is2.typedArray = typedArray; + })(Is || (Is = {})); + } + }); + require_ral = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var _ral; + function RAL() { + if (_ral === void 0) { + throw new Error(`No runtime abstraction layer installed`); + } + return _ral; + } + __name(RAL, "RAL"); + __name2(RAL, "RAL"); + (function(RAL2) { + function install(ral) { + if (ral === void 0) { + throw new Error(`No runtime abstraction layer provided`); + } + _ral = ral; + } + __name(install, "install"); + __name2(install, "install"); + RAL2.install = install; + })(RAL || (RAL = {})); + exports2.default = RAL; + } + }); + require_is = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0; + function boolean(value2) { + return value2 === true || value2 === false; + } + __name(boolean, "boolean"); + __name2(boolean, "boolean"); + exports2.boolean = boolean; + function string3(value2) { + return typeof value2 === "string" || value2 instanceof String; + } + __name(string3, "string"); + __name2(string3, "string"); + exports2.string = string3; + function number7(value2) { + return typeof value2 === "number" || value2 instanceof Number; + } + __name(number7, "number"); + __name2(number7, "number"); + exports2.number = number7; + function error3(value2) { + return value2 instanceof Error; + } + __name(error3, "error"); + __name2(error3, "error"); + exports2.error = error3; + function func(value2) { + return typeof value2 === "function"; + } + __name(func, "func"); + __name2(func, "func"); + exports2.func = func; + function array4(value2) { + return Array.isArray(value2); + } + __name(array4, "array"); + __name2(array4, "array"); + exports2.array = array4; + function stringArray(value2) { + return array4(value2) && value2.every((elem) => string3(elem)); + } + __name(stringArray, "stringArray"); + __name2(stringArray, "stringArray"); + exports2.stringArray = stringArray; + } + }); + require_events = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Emitter = exports2.Event = void 0; + var ral_1 = require_ral(); + var Event3; + (function(Event22) { + const _disposable = { dispose() { + } }; + Event22.None = function() { + return _disposable; + }; + })(Event3 || (exports2.Event = Event3 = {})); + var CallbackList = class { + static { + __name(this, "CallbackList"); + } + static { + __name2(this, "CallbackList"); + } + add(callback, context = null, bucket) { + if (!this._callbacks) { + this._callbacks = []; + this._contexts = []; + } + this._callbacks.push(callback); + this._contexts.push(context); + if (Array.isArray(bucket)) { + bucket.push({ dispose: /* @__PURE__ */ __name2(() => this.remove(callback, context), "dispose") }); + } + } + remove(callback, context = null) { + if (!this._callbacks) { + return; + } + let foundCallbackWithDifferentContext = false; + for (let i2 = 0, len = this._callbacks.length; i2 < len; i2++) { + if (this._callbacks[i2] === callback) { + if (this._contexts[i2] === context) { + this._callbacks.splice(i2, 1); + this._contexts.splice(i2, 1); + return; + } else { + foundCallbackWithDifferentContext = true; + } + } + } + if (foundCallbackWithDifferentContext) { + throw new Error("When adding a listener with a context, you should remove it with the same context"); + } + } + invoke(...args) { + if (!this._callbacks) { + return []; + } + const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); + for (let i2 = 0, len = callbacks.length; i2 < len; i2++) { + try { + ret.push(callbacks[i2].apply(contexts[i2], args)); + } catch (e3) { + (0, ral_1.default)().console.error(e3); + } + } + return ret; + } + isEmpty() { + return !this._callbacks || this._callbacks.length === 0; + } + dispose() { + this._callbacks = void 0; + this._contexts = void 0; + } + }; + var Emitter3 = class _Emitter { + static { + __name(this, "_Emitter"); + } + static { + __name2(this, "Emitter"); + } + constructor(_options) { + this._options = _options; + } + /** + * For the public to allow to subscribe + * to events from this Emitter + */ + get event() { + if (!this._event) { + this._event = (listener, thisArgs, disposables) => { + if (!this._callbacks) { + this._callbacks = new CallbackList(); + } + if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { + this._options.onFirstListenerAdd(this); + } + this._callbacks.add(listener, thisArgs); + const result = { + dispose: /* @__PURE__ */ __name2(() => { + if (!this._callbacks) { + return; + } + this._callbacks.remove(listener, thisArgs); + result.dispose = _Emitter._noop; + if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { + this._options.onLastListenerRemove(this); + } + }, "dispose") + }; + if (Array.isArray(disposables)) { + disposables.push(result); + } + return result; + }; + } + return this._event; + } + /** + * To be kept private to fire an event to + * subscribers + */ + fire(event3) { + if (this._callbacks) { + this._callbacks.invoke.call(this._callbacks, event3); + } + } + dispose() { + if (this._callbacks) { + this._callbacks.dispose(); + this._callbacks = void 0; + } + } + }; + exports2.Emitter = Emitter3; + Emitter3._noop = function() { + }; + } + }); + require_cancellation = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/cancellation.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CancellationTokenSource = exports2.CancellationToken = void 0; + var ral_1 = require_ral(); + var Is2 = require_is(); + var events_1 = require_events(); + var CancellationToken11; + (function(CancellationToken12) { + CancellationToken12.None = Object.freeze({ + isCancellationRequested: false, + onCancellationRequested: events_1.Event.None + }); + CancellationToken12.Cancelled = Object.freeze({ + isCancellationRequested: true, + onCancellationRequested: events_1.Event.None + }); + function is2(value2) { + const candidate = value2; + return candidate && (candidate === CancellationToken12.None || candidate === CancellationToken12.Cancelled || Is2.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested); + } + __name(is2, "is"); + __name2(is2, "is"); + CancellationToken12.is = is2; + })(CancellationToken11 || (exports2.CancellationToken = CancellationToken11 = {})); + var shortcutEvent = Object.freeze(function(callback, context) { + const handle = (0, ral_1.default)().timer.setTimeout(callback.bind(context), 0); + return { dispose() { + handle.dispose(); + } }; + }); + var MutableToken = class { + static { + __name(this, "MutableToken"); + } + static { + __name2(this, "MutableToken"); + } + constructor() { + this._isCancelled = false; + } + cancel() { + if (!this._isCancelled) { + this._isCancelled = true; + if (this._emitter) { + this._emitter.fire(void 0); + this.dispose(); + } + } + } + get isCancellationRequested() { + return this._isCancelled; + } + get onCancellationRequested() { + if (this._isCancelled) { + return shortcutEvent; + } + if (!this._emitter) { + this._emitter = new events_1.Emitter(); + } + return this._emitter.event; + } + dispose() { + if (this._emitter) { + this._emitter.dispose(); + this._emitter = void 0; + } + } + }; + var CancellationTokenSource3 = class { + static { + __name(this, "CancellationTokenSource3"); + } + static { + __name2(this, "CancellationTokenSource"); + } + get token() { + if (!this._token) { + this._token = new MutableToken(); + } + return this._token; + } + cancel() { + if (!this._token) { + this._token = CancellationToken11.Cancelled; + } else { + this._token.cancel(); + } + } + dispose() { + if (!this._token) { + this._token = CancellationToken11.None; + } else if (this._token instanceof MutableToken) { + this._token.dispose(); + } + } + }; + exports2.CancellationTokenSource = CancellationTokenSource3; + } + }); + require_messages = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messages.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Message = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType = exports2.RequestType0 = exports2.AbstractMessageSignature = exports2.ParameterStructures = exports2.ResponseError = exports2.ErrorCodes = void 0; + var is2 = require_is(); + var ErrorCodes; + (function(ErrorCodes2) { + ErrorCodes2.ParseError = -32700; + ErrorCodes2.InvalidRequest = -32600; + ErrorCodes2.MethodNotFound = -32601; + ErrorCodes2.InvalidParams = -32602; + ErrorCodes2.InternalError = -32603; + ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099; + ErrorCodes2.serverErrorStart = -32099; + ErrorCodes2.MessageWriteError = -32099; + ErrorCodes2.MessageReadError = -32098; + ErrorCodes2.PendingResponseRejected = -32097; + ErrorCodes2.ConnectionInactive = -32096; + ErrorCodes2.ServerNotInitialized = -32002; + ErrorCodes2.UnknownErrorCode = -32001; + ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3; + ErrorCodes2.serverErrorEnd = -32e3; + })(ErrorCodes || (exports2.ErrorCodes = ErrorCodes = {})); + var ResponseError2 = class _ResponseError extends Error { + static { + __name(this, "_ResponseError"); + } + static { + __name2(this, "ResponseError"); + } + constructor(code, message, data5) { + super(message); + this.code = is2.number(code) ? code : ErrorCodes.UnknownErrorCode; + this.data = data5; + Object.setPrototypeOf(this, _ResponseError.prototype); + } + toJson() { + const result = { + code: this.code, + message: this.message + }; + if (this.data !== void 0) { + result.data = this.data; + } + return result; + } + }; + exports2.ResponseError = ResponseError2; + var ParameterStructures = class _ParameterStructures { + static { + __name(this, "_ParameterStructures"); + } + static { + __name2(this, "ParameterStructures"); + } + constructor(kind) { + this.kind = kind; + } + static is(value2) { + return value2 === _ParameterStructures.auto || value2 === _ParameterStructures.byName || value2 === _ParameterStructures.byPosition; + } + toString() { + return this.kind; + } + }; + exports2.ParameterStructures = ParameterStructures; + ParameterStructures.auto = new ParameterStructures("auto"); + ParameterStructures.byPosition = new ParameterStructures("byPosition"); + ParameterStructures.byName = new ParameterStructures("byName"); + var AbstractMessageSignature = class { + static { + __name(this, "AbstractMessageSignature"); + } + static { + __name2(this, "AbstractMessageSignature"); + } + constructor(method, numberOfParams) { + this.method = method; + this.numberOfParams = numberOfParams; + } + get parameterStructures() { + return ParameterStructures.auto; + } + }; + exports2.AbstractMessageSignature = AbstractMessageSignature; + var RequestType0 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType0"); + } + static { + __name2(this, "RequestType0"); + } + constructor(method) { + super(method, 0); + } + }; + exports2.RequestType0 = RequestType0; + var RequestType = class extends AbstractMessageSignature { + static { + __name(this, "RequestType"); + } + static { + __name2(this, "RequestType"); + } + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports2.RequestType = RequestType; + var RequestType1 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType1"); + } + static { + __name2(this, "RequestType1"); + } + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports2.RequestType1 = RequestType1; + var RequestType2 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType2"); + } + static { + __name2(this, "RequestType2"); + } + constructor(method) { + super(method, 2); + } + }; + exports2.RequestType2 = RequestType2; + var RequestType3 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType3"); + } + static { + __name2(this, "RequestType3"); + } + constructor(method) { + super(method, 3); + } + }; + exports2.RequestType3 = RequestType3; + var RequestType4 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType4"); + } + static { + __name2(this, "RequestType4"); + } + constructor(method) { + super(method, 4); + } + }; + exports2.RequestType4 = RequestType4; + var RequestType5 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType5"); + } + static { + __name2(this, "RequestType5"); + } + constructor(method) { + super(method, 5); + } + }; + exports2.RequestType5 = RequestType5; + var RequestType6 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType6"); + } + static { + __name2(this, "RequestType6"); + } + constructor(method) { + super(method, 6); + } + }; + exports2.RequestType6 = RequestType6; + var RequestType7 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType7"); + } + static { + __name2(this, "RequestType7"); + } + constructor(method) { + super(method, 7); + } + }; + exports2.RequestType7 = RequestType7; + var RequestType8 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType8"); + } + static { + __name2(this, "RequestType8"); + } + constructor(method) { + super(method, 8); + } + }; + exports2.RequestType8 = RequestType8; + var RequestType9 = class extends AbstractMessageSignature { + static { + __name(this, "RequestType9"); + } + static { + __name2(this, "RequestType9"); + } + constructor(method) { + super(method, 9); + } + }; + exports2.RequestType9 = RequestType9; + var NotificationType = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType"); + } + static { + __name2(this, "NotificationType"); + } + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports2.NotificationType = NotificationType; + var NotificationType0 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType0"); + } + static { + __name2(this, "NotificationType0"); + } + constructor(method) { + super(method, 0); + } + }; + exports2.NotificationType0 = NotificationType0; + var NotificationType1 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType1"); + } + static { + __name2(this, "NotificationType1"); + } + constructor(method, _parameterStructures = ParameterStructures.auto) { + super(method, 1); + this._parameterStructures = _parameterStructures; + } + get parameterStructures() { + return this._parameterStructures; + } + }; + exports2.NotificationType1 = NotificationType1; + var NotificationType2 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType2"); + } + static { + __name2(this, "NotificationType2"); + } + constructor(method) { + super(method, 2); + } + }; + exports2.NotificationType2 = NotificationType2; + var NotificationType3 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType3"); + } + static { + __name2(this, "NotificationType3"); + } + constructor(method) { + super(method, 3); + } + }; + exports2.NotificationType3 = NotificationType3; + var NotificationType4 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType4"); + } + static { + __name2(this, "NotificationType4"); + } + constructor(method) { + super(method, 4); + } + }; + exports2.NotificationType4 = NotificationType4; + var NotificationType5 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType5"); + } + static { + __name2(this, "NotificationType5"); + } + constructor(method) { + super(method, 5); + } + }; + exports2.NotificationType5 = NotificationType5; + var NotificationType6 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType6"); + } + static { + __name2(this, "NotificationType6"); + } + constructor(method) { + super(method, 6); + } + }; + exports2.NotificationType6 = NotificationType6; + var NotificationType7 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType7"); + } + static { + __name2(this, "NotificationType7"); + } + constructor(method) { + super(method, 7); + } + }; + exports2.NotificationType7 = NotificationType7; + var NotificationType8 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType8"); + } + static { + __name2(this, "NotificationType8"); + } + constructor(method) { + super(method, 8); + } + }; + exports2.NotificationType8 = NotificationType8; + var NotificationType9 = class extends AbstractMessageSignature { + static { + __name(this, "NotificationType9"); + } + static { + __name2(this, "NotificationType9"); + } + constructor(method) { + super(method, 9); + } + }; + exports2.NotificationType9 = NotificationType9; + var Message; + (function(Message2) { + function isRequest(message) { + const candidate = message; + return candidate && is2.string(candidate.method) && (is2.string(candidate.id) || is2.number(candidate.id)); + } + __name(isRequest, "isRequest"); + __name2(isRequest, "isRequest"); + Message2.isRequest = isRequest; + function isNotification(message) { + const candidate = message; + return candidate && is2.string(candidate.method) && message.id === void 0; + } + __name(isNotification, "isNotification"); + __name2(isNotification, "isNotification"); + Message2.isNotification = isNotification; + function isResponse(message) { + const candidate = message; + return candidate && (candidate.result !== void 0 || !!candidate.error) && (is2.string(candidate.id) || is2.number(candidate.id) || candidate.id === null); + } + __name(isResponse, "isResponse"); + __name2(isResponse, "isResponse"); + Message2.isResponse = isResponse; + })(Message || (exports2.Message = Message = {})); + } + }); + require_linkedMap = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports2) { + "use strict"; + var _a; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.LRUCache = exports2.LinkedMap = exports2.Touch = void 0; + var Touch; + (function(Touch2) { + Touch2.None = 0; + Touch2.First = 1; + Touch2.AsOld = Touch2.First; + Touch2.Last = 2; + Touch2.AsNew = Touch2.Last; + })(Touch || (exports2.Touch = Touch = {})); + var LinkedMap = class { + static { + __name(this, "LinkedMap"); + } + static { + __name2(this, "LinkedMap"); + } + constructor() { + this[_a] = "LinkedMap"; + this._map = /* @__PURE__ */ new Map(); + this._head = void 0; + this._tail = void 0; + this._size = 0; + this._state = 0; + } + clear() { + this._map.clear(); + this._head = void 0; + this._tail = void 0; + this._size = 0; + this._state++; + } + isEmpty() { + return !this._head && !this._tail; + } + get size() { + return this._size; + } + get first() { + return this._head?.value; + } + get last() { + return this._tail?.value; + } + has(key) { + return this._map.has(key); + } + get(key, touch = Touch.None) { + const item = this._map.get(key); + if (!item) { + return void 0; + } + if (touch !== Touch.None) { + this.touch(item, touch); + } + return item.value; + } + set(key, value2, touch = Touch.None) { + let item = this._map.get(key); + if (item) { + item.value = value2; + if (touch !== Touch.None) { + this.touch(item, touch); + } + } else { + item = { key, value: value2, next: void 0, previous: void 0 }; + switch (touch) { + case Touch.None: + this.addItemLast(item); + break; + case Touch.First: + this.addItemFirst(item); + break; + case Touch.Last: + this.addItemLast(item); + break; + default: + this.addItemLast(item); + break; + } + this._map.set(key, item); + this._size++; + } + return this; + } + delete(key) { + return !!this.remove(key); + } + remove(key) { + const item = this._map.get(key); + if (!item) { + return void 0; + } + this._map.delete(key); + this.removeItem(item); + this._size--; + return item.value; + } + shift() { + if (!this._head && !this._tail) { + return void 0; + } + if (!this._head || !this._tail) { + throw new Error("Invalid list"); + } + const item = this._head; + this._map.delete(item.key); + this.removeItem(item); + this._size--; + return item.value; + } + forEach(callbackfn, thisArg) { + const state4 = this._state; + let current = this._head; + while (current) { + if (thisArg) { + callbackfn.bind(thisArg)(current.value, current.key, this); + } else { + callbackfn(current.value, current.key, this); + } + if (this._state !== state4) { + throw new Error(`LinkedMap got modified during iteration.`); + } + current = current.next; + } + } + keys() { + const state4 = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]: () => { + return iterator; + }, + next: /* @__PURE__ */ __name2(() => { + if (this._state !== state4) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: current.key, done: false }; + current = current.next; + return result; + } else { + return { value: void 0, done: true }; + } + }, "next") + }; + return iterator; + } + values() { + const state4 = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]: () => { + return iterator; + }, + next: /* @__PURE__ */ __name2(() => { + if (this._state !== state4) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: current.value, done: false }; + current = current.next; + return result; + } else { + return { value: void 0, done: true }; + } + }, "next") + }; + return iterator; + } + entries() { + const state4 = this._state; + let current = this._head; + const iterator = { + [Symbol.iterator]: () => { + return iterator; + }, + next: /* @__PURE__ */ __name2(() => { + if (this._state !== state4) { + throw new Error(`LinkedMap got modified during iteration.`); + } + if (current) { + const result = { value: [current.key, current.value], done: false }; + current = current.next; + return result; + } else { + return { value: void 0, done: true }; + } + }, "next") + }; + return iterator; + } + [(_a = Symbol.toStringTag, Symbol.iterator)]() { + return this.entries(); + } + trimOld(newSize) { + if (newSize >= this.size) { + return; + } + if (newSize === 0) { + this.clear(); + return; + } + let current = this._head; + let currentSize = this.size; + while (current && currentSize > newSize) { + this._map.delete(current.key); + current = current.next; + currentSize--; + } + this._head = current; + this._size = currentSize; + if (current) { + current.previous = void 0; + } + this._state++; + } + addItemFirst(item) { + if (!this._head && !this._tail) { + this._tail = item; + } else if (!this._head) { + throw new Error("Invalid list"); + } else { + item.next = this._head; + this._head.previous = item; + } + this._head = item; + this._state++; + } + addItemLast(item) { + if (!this._head && !this._tail) { + this._head = item; + } else if (!this._tail) { + throw new Error("Invalid list"); + } else { + item.previous = this._tail; + this._tail.next = item; + } + this._tail = item; + this._state++; + } + removeItem(item) { + if (item === this._head && item === this._tail) { + this._head = void 0; + this._tail = void 0; + } else if (item === this._head) { + if (!item.next) { + throw new Error("Invalid list"); + } + item.next.previous = void 0; + this._head = item.next; + } else if (item === this._tail) { + if (!item.previous) { + throw new Error("Invalid list"); + } + item.previous.next = void 0; + this._tail = item.previous; + } else { + const next3 = item.next; + const previous = item.previous; + if (!next3 || !previous) { + throw new Error("Invalid list"); + } + next3.previous = previous; + previous.next = next3; + } + item.next = void 0; + item.previous = void 0; + this._state++; + } + touch(item, touch) { + if (!this._head || !this._tail) { + throw new Error("Invalid list"); + } + if (touch !== Touch.First && touch !== Touch.Last) { + return; + } + if (touch === Touch.First) { + if (item === this._head) { + return; + } + const next3 = item.next; + const previous = item.previous; + if (item === this._tail) { + previous.next = void 0; + this._tail = previous; + } else { + next3.previous = previous; + previous.next = next3; + } + item.previous = void 0; + item.next = this._head; + this._head.previous = item; + this._head = item; + this._state++; + } else if (touch === Touch.Last) { + if (item === this._tail) { + return; + } + const next3 = item.next; + const previous = item.previous; + if (item === this._head) { + next3.previous = void 0; + this._head = next3; + } else { + next3.previous = previous; + previous.next = next3; + } + item.next = void 0; + item.previous = this._tail; + this._tail.next = item; + this._tail = item; + this._state++; + } + } + toJSON() { + const data5 = []; + this.forEach((value2, key) => { + data5.push([key, value2]); + }); + return data5; + } + fromJSON(data5) { + this.clear(); + for (const [key, value2] of data5) { + this.set(key, value2); + } + } + }; + exports2.LinkedMap = LinkedMap; + var LRUCache = class extends LinkedMap { + static { + __name(this, "LRUCache"); + } + static { + __name2(this, "LRUCache"); + } + constructor(limit2, ratio = 1) { + super(); + this._limit = limit2; + this._ratio = Math.min(Math.max(0, ratio), 1); + } + get limit() { + return this._limit; + } + set limit(limit2) { + this._limit = limit2; + this.checkTrim(); + } + get ratio() { + return this._ratio; + } + set ratio(ratio) { + this._ratio = Math.min(Math.max(0, ratio), 1); + this.checkTrim(); + } + get(key, touch = Touch.AsNew) { + return super.get(key, touch); + } + peek(key) { + return super.get(key, Touch.None); + } + set(key, value2) { + super.set(key, value2, Touch.Last); + this.checkTrim(); + return this; + } + checkTrim() { + if (this.size > this._limit) { + this.trimOld(Math.round(this._limit * this._ratio)); + } + } + }; + exports2.LRUCache = LRUCache; + } + }); + require_disposable = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/disposable.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Disposable = void 0; + var Disposable2; + (function(Disposable3) { + function create4(func) { + return { + dispose: func + }; + } + __name(create4, "create"); + __name2(create4, "create"); + Disposable3.create = create4; + })(Disposable2 || (exports2.Disposable = Disposable2 = {})); + } + }); + require_sharedArrayCancellation = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SharedArrayReceiverStrategy = exports2.SharedArraySenderStrategy = void 0; + var cancellation_1 = require_cancellation(); + var CancellationState; + (function(CancellationState2) { + CancellationState2.Continue = 0; + CancellationState2.Cancelled = 1; + })(CancellationState || (CancellationState = {})); + var SharedArraySenderStrategy = class { + static { + __name(this, "SharedArraySenderStrategy"); + } + static { + __name2(this, "SharedArraySenderStrategy"); + } + constructor() { + this.buffers = /* @__PURE__ */ new Map(); + } + enableCancellation(request) { + if (request.id === null) { + return; + } + const buffer = new SharedArrayBuffer(4); + const data5 = new Int32Array(buffer, 0, 1); + data5[0] = CancellationState.Continue; + this.buffers.set(request.id, buffer); + request.$cancellationData = buffer; + } + async sendCancellation(_conn, id35) { + const buffer = this.buffers.get(id35); + if (buffer === void 0) { + return; + } + const data5 = new Int32Array(buffer, 0, 1); + Atomics.store(data5, 0, CancellationState.Cancelled); + } + cleanup(id35) { + this.buffers.delete(id35); + } + dispose() { + this.buffers.clear(); + } + }; + exports2.SharedArraySenderStrategy = SharedArraySenderStrategy; + var SharedArrayBufferCancellationToken = class { + static { + __name(this, "SharedArrayBufferCancellationToken"); + } + static { + __name2(this, "SharedArrayBufferCancellationToken"); + } + constructor(buffer) { + this.data = new Int32Array(buffer, 0, 1); + } + get isCancellationRequested() { + return Atomics.load(this.data, 0) === CancellationState.Cancelled; + } + get onCancellationRequested() { + throw new Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`); + } + }; + var SharedArrayBufferCancellationTokenSource = class { + static { + __name(this, "SharedArrayBufferCancellationTokenSource"); + } + static { + __name2(this, "SharedArrayBufferCancellationTokenSource"); + } + constructor(buffer) { + this.token = new SharedArrayBufferCancellationToken(buffer); + } + cancel() { + } + dispose() { + } + }; + var SharedArrayReceiverStrategy = class { + static { + __name(this, "SharedArrayReceiverStrategy"); + } + static { + __name2(this, "SharedArrayReceiverStrategy"); + } + constructor() { + this.kind = "request"; + } + createCancellationTokenSource(request) { + const buffer = request.$cancellationData; + if (buffer === void 0) { + return new cancellation_1.CancellationTokenSource(); + } + return new SharedArrayBufferCancellationTokenSource(buffer); + } + }; + exports2.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy; + } + }); + require_semaphore = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/semaphore.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Semaphore = void 0; + var ral_1 = require_ral(); + var Semaphore = class { + static { + __name(this, "Semaphore"); + } + static { + __name2(this, "Semaphore"); + } + constructor(capacity = 1) { + if (capacity <= 0) { + throw new Error("Capacity must be greater than 0"); + } + this._capacity = capacity; + this._active = 0; + this._waiting = []; + } + lock(thunk) { + return new Promise((resolve2, reject22) => { + this._waiting.push({ thunk, resolve: resolve2, reject: reject22 }); + this.runNext(); + }); + } + get active() { + return this._active; + } + runNext() { + if (this._waiting.length === 0 || this._active === this._capacity) { + return; + } + (0, ral_1.default)().timer.setImmediate(() => this.doRunNext()); + } + doRunNext() { + if (this._waiting.length === 0 || this._active === this._capacity) { + return; + } + const next3 = this._waiting.shift(); + this._active++; + if (this._active > this._capacity) { + throw new Error(`To many thunks active`); + } + try { + const result = next3.thunk(); + if (result instanceof Promise) { + result.then((value2) => { + this._active--; + next3.resolve(value2); + this.runNext(); + }, (err) => { + this._active--; + next3.reject(err); + this.runNext(); + }); + } else { + this._active--; + next3.resolve(result); + this.runNext(); + } + } catch (err) { + this._active--; + next3.reject(err); + this.runNext(); + } + } + }; + exports2.Semaphore = Semaphore; + } + }); + require_messageReader = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageReader.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = void 0; + var ral_1 = require_ral(); + var Is2 = require_is(); + var events_1 = require_events(); + var semaphore_1 = require_semaphore(); + var MessageReader; + (function(MessageReader2) { + function is2(value2) { + let candidate = value2; + return candidate && Is2.func(candidate.listen) && Is2.func(candidate.dispose) && Is2.func(candidate.onError) && Is2.func(candidate.onClose) && Is2.func(candidate.onPartialMessage); + } + __name(is2, "is"); + __name2(is2, "is"); + MessageReader2.is = is2; + })(MessageReader || (exports2.MessageReader = MessageReader = {})); + var AbstractMessageReader = class { + static { + __name(this, "AbstractMessageReader"); + } + static { + __name2(this, "AbstractMessageReader"); + } + constructor() { + this.errorEmitter = new events_1.Emitter(); + this.closeEmitter = new events_1.Emitter(); + this.partialMessageEmitter = new events_1.Emitter(); + } + dispose() { + this.errorEmitter.dispose(); + this.closeEmitter.dispose(); + } + get onError() { + return this.errorEmitter.event; + } + fireError(error3) { + this.errorEmitter.fire(this.asError(error3)); + } + get onClose() { + return this.closeEmitter.event; + } + fireClose() { + this.closeEmitter.fire(void 0); + } + get onPartialMessage() { + return this.partialMessageEmitter.event; + } + firePartialMessage(info2) { + this.partialMessageEmitter.fire(info2); + } + asError(error3) { + if (error3 instanceof Error) { + return error3; + } else { + return new Error(`Reader received error. Reason: ${Is2.string(error3.message) ? error3.message : "unknown"}`); + } + } + }; + exports2.AbstractMessageReader = AbstractMessageReader; + var ResolvedMessageReaderOptions; + (function(ResolvedMessageReaderOptions2) { + function fromOptions(options2) { + let charset; + let result; + let contentDecoder; + const contentDecoders = /* @__PURE__ */ new Map(); + let contentTypeDecoder; + const contentTypeDecoders = /* @__PURE__ */ new Map(); + if (options2 === void 0 || typeof options2 === "string") { + charset = options2 ?? "utf-8"; + } else { + charset = options2.charset ?? "utf-8"; + if (options2.contentDecoder !== void 0) { + contentDecoder = options2.contentDecoder; + contentDecoders.set(contentDecoder.name, contentDecoder); + } + if (options2.contentDecoders !== void 0) { + for (const decoder2 of options2.contentDecoders) { + contentDecoders.set(decoder2.name, decoder2); + } + } + if (options2.contentTypeDecoder !== void 0) { + contentTypeDecoder = options2.contentTypeDecoder; + contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); + } + if (options2.contentTypeDecoders !== void 0) { + for (const decoder2 of options2.contentTypeDecoders) { + contentTypeDecoders.set(decoder2.name, decoder2); + } + } + } + if (contentTypeDecoder === void 0) { + contentTypeDecoder = (0, ral_1.default)().applicationJson.decoder; + contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); + } + return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders }; + } + __name(fromOptions, "fromOptions"); + __name2(fromOptions, "fromOptions"); + ResolvedMessageReaderOptions2.fromOptions = fromOptions; + })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); + var ReadableStreamMessageReader = class extends AbstractMessageReader { + static { + __name(this, "ReadableStreamMessageReader"); + } + static { + __name2(this, "ReadableStreamMessageReader"); + } + constructor(readable, options2) { + super(); + this.readable = readable; + this.options = ResolvedMessageReaderOptions.fromOptions(options2); + this.buffer = (0, ral_1.default)().messageBuffer.create(this.options.charset); + this._partialMessageTimeout = 1e4; + this.nextMessageLength = -1; + this.messageToken = 0; + this.readSemaphore = new semaphore_1.Semaphore(1); + } + set partialMessageTimeout(timeout2) { + this._partialMessageTimeout = timeout2; + } + get partialMessageTimeout() { + return this._partialMessageTimeout; + } + listen(callback) { + this.nextMessageLength = -1; + this.messageToken = 0; + this.partialMessageTimer = void 0; + this.callback = callback; + const result = this.readable.onData((data5) => { + this.onData(data5); + }); + this.readable.onError((error3) => this.fireError(error3)); + this.readable.onClose(() => this.fireClose()); + return result; + } + onData(data5) { + try { + this.buffer.append(data5); + while (true) { + if (this.nextMessageLength === -1) { + const headers = this.buffer.tryReadHeaders(true); + if (!headers) { + return; + } + const contentLength = headers.get("content-length"); + if (!contentLength) { + this.fireError(new Error(`Header must provide a Content-Length property. +${JSON.stringify(Object.fromEntries(headers))}`)); + return; + } + const length2 = parseInt(contentLength); + if (isNaN(length2)) { + this.fireError(new Error(`Content-Length value must be a number. Got ${contentLength}`)); + return; + } + this.nextMessageLength = length2; + } + const body = this.buffer.tryReadBody(this.nextMessageLength); + if (body === void 0) { + this.setPartialMessageTimer(); + return; + } + this.clearPartialMessageTimer(); + this.nextMessageLength = -1; + this.readSemaphore.lock(async () => { + const bytes = this.options.contentDecoder !== void 0 ? await this.options.contentDecoder.decode(body) : body; + const message = await this.options.contentTypeDecoder.decode(bytes, this.options); + this.callback(message); + }).catch((error3) => { + this.fireError(error3); + }); + } + } catch (error3) { + this.fireError(error3); + } + } + clearPartialMessageTimer() { + if (this.partialMessageTimer) { + this.partialMessageTimer.dispose(); + this.partialMessageTimer = void 0; + } + } + setPartialMessageTimer() { + this.clearPartialMessageTimer(); + if (this._partialMessageTimeout <= 0) { + return; + } + this.partialMessageTimer = (0, ral_1.default)().timer.setTimeout((token2, timeout2) => { + this.partialMessageTimer = void 0; + if (token2 === this.messageToken) { + this.firePartialMessage({ messageToken: token2, waitingTime: timeout2 }); + this.setPartialMessageTimer(); + } + }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); + } + }; + exports2.ReadableStreamMessageReader = ReadableStreamMessageReader; + } + }); + require_messageWriter = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = void 0; + var ral_1 = require_ral(); + var Is2 = require_is(); + var semaphore_1 = require_semaphore(); + var events_1 = require_events(); + var ContentLength = "Content-Length: "; + var CRLF = "\r\n"; + var MessageWriter; + (function(MessageWriter2) { + function is2(value2) { + let candidate = value2; + return candidate && Is2.func(candidate.dispose) && Is2.func(candidate.onClose) && Is2.func(candidate.onError) && Is2.func(candidate.write); + } + __name(is2, "is"); + __name2(is2, "is"); + MessageWriter2.is = is2; + })(MessageWriter || (exports2.MessageWriter = MessageWriter = {})); + var AbstractMessageWriter = class { + static { + __name(this, "AbstractMessageWriter"); + } + static { + __name2(this, "AbstractMessageWriter"); + } + constructor() { + this.errorEmitter = new events_1.Emitter(); + this.closeEmitter = new events_1.Emitter(); + } + dispose() { + this.errorEmitter.dispose(); + this.closeEmitter.dispose(); + } + get onError() { + return this.errorEmitter.event; + } + fireError(error3, message, count2) { + this.errorEmitter.fire([this.asError(error3), message, count2]); + } + get onClose() { + return this.closeEmitter.event; + } + fireClose() { + this.closeEmitter.fire(void 0); + } + asError(error3) { + if (error3 instanceof Error) { + return error3; + } else { + return new Error(`Writer received error. Reason: ${Is2.string(error3.message) ? error3.message : "unknown"}`); + } + } + }; + exports2.AbstractMessageWriter = AbstractMessageWriter; + var ResolvedMessageWriterOptions; + (function(ResolvedMessageWriterOptions2) { + function fromOptions(options2) { + if (options2 === void 0 || typeof options2 === "string") { + return { charset: options2 ?? "utf-8", contentTypeEncoder: (0, ral_1.default)().applicationJson.encoder }; + } else { + return { charset: options2.charset ?? "utf-8", contentEncoder: options2.contentEncoder, contentTypeEncoder: options2.contentTypeEncoder ?? (0, ral_1.default)().applicationJson.encoder }; + } + } + __name(fromOptions, "fromOptions"); + __name2(fromOptions, "fromOptions"); + ResolvedMessageWriterOptions2.fromOptions = fromOptions; + })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); + var WriteableStreamMessageWriter = class extends AbstractMessageWriter { + static { + __name(this, "WriteableStreamMessageWriter"); + } + static { + __name2(this, "WriteableStreamMessageWriter"); + } + constructor(writable, options2) { + super(); + this.writable = writable; + this.options = ResolvedMessageWriterOptions.fromOptions(options2); + this.errorCount = 0; + this.writeSemaphore = new semaphore_1.Semaphore(1); + this.writable.onError((error3) => this.fireError(error3)); + this.writable.onClose(() => this.fireClose()); + } + async write(msg) { + return this.writeSemaphore.lock(async () => { + const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => { + if (this.options.contentEncoder !== void 0) { + return this.options.contentEncoder.encode(buffer); + } else { + return buffer; + } + }); + return payload.then((buffer) => { + const headers = []; + headers.push(ContentLength, buffer.byteLength.toString(), CRLF); + headers.push(CRLF); + return this.doWrite(msg, headers, buffer); + }, (error3) => { + this.fireError(error3); + throw error3; + }); + }); + } + async doWrite(msg, headers, data5) { + try { + await this.writable.write(headers.join(""), "ascii"); + return this.writable.write(data5); + } catch (error3) { + this.handleError(error3, msg); + return Promise.reject(error3); + } + } + handleError(error3, msg) { + this.errorCount++; + this.fireError(error3, msg, this.errorCount); + } + end() { + this.writable.end(); + } + }; + exports2.WriteableStreamMessageWriter = WriteableStreamMessageWriter; + } + }); + require_messageBuffer = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AbstractMessageBuffer = void 0; + var CR2 = 13; + var LF = 10; + var CRLF = "\r\n"; + var AbstractMessageBuffer = class { + static { + __name(this, "AbstractMessageBuffer"); + } + static { + __name2(this, "AbstractMessageBuffer"); + } + constructor(encoding = "utf-8") { + this._encoding = encoding; + this._chunks = []; + this._totalLength = 0; + } + get encoding() { + return this._encoding; + } + append(chunk) { + const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk; + this._chunks.push(toAppend); + this._totalLength += toAppend.byteLength; + } + tryReadHeaders(lowerCaseKeys = false) { + if (this._chunks.length === 0) { + return void 0; + } + let state4 = 0; + let chunkIndex = 0; + let offset = 0; + let chunkBytesRead = 0; + row: while (chunkIndex < this._chunks.length) { + const chunk = this._chunks[chunkIndex]; + offset = 0; + column: while (offset < chunk.length) { + const value2 = chunk[offset]; + switch (value2) { + case CR2: + switch (state4) { + case 0: + state4 = 1; + break; + case 2: + state4 = 3; + break; + default: + state4 = 0; + } + break; + case LF: + switch (state4) { + case 1: + state4 = 2; + break; + case 3: + state4 = 4; + offset++; + break row; + default: + state4 = 0; + } + break; + default: + state4 = 0; + } + offset++; + } + chunkBytesRead += chunk.byteLength; + chunkIndex++; + } + if (state4 !== 4) { + return void 0; + } + const buffer = this._read(chunkBytesRead + offset); + const result = /* @__PURE__ */ new Map(); + const headers = this.toString(buffer, "ascii").split(CRLF); + if (headers.length < 2) { + return result; + } + for (let i2 = 0; i2 < headers.length - 2; i2++) { + const header = headers[i2]; + const index = header.indexOf(":"); + if (index === -1) { + throw new Error(`Message header must separate key and value using ':' +${header}`); + } + const key = header.substr(0, index); + const value2 = header.substr(index + 1).trim(); + result.set(lowerCaseKeys ? key.toLowerCase() : key, value2); + } + return result; + } + tryReadBody(length2) { + if (this._totalLength < length2) { + return void 0; + } + return this._read(length2); + } + get numberOfBytes() { + return this._totalLength; + } + _read(byteCount) { + if (byteCount === 0) { + return this.emptyBuffer(); + } + if (byteCount > this._totalLength) { + throw new Error(`Cannot read so many bytes!`); + } + if (this._chunks[0].byteLength === byteCount) { + const chunk = this._chunks[0]; + this._chunks.shift(); + this._totalLength -= byteCount; + return this.asNative(chunk); + } + if (this._chunks[0].byteLength > byteCount) { + const chunk = this._chunks[0]; + const result2 = this.asNative(chunk, byteCount); + this._chunks[0] = chunk.slice(byteCount); + this._totalLength -= byteCount; + return result2; + } + const result = this.allocNative(byteCount); + let resultOffset = 0; + let chunkIndex = 0; + while (byteCount > 0) { + const chunk = this._chunks[chunkIndex]; + if (chunk.byteLength > byteCount) { + const chunkPart = chunk.slice(0, byteCount); + result.set(chunkPart, resultOffset); + resultOffset += byteCount; + this._chunks[chunkIndex] = chunk.slice(byteCount); + this._totalLength -= byteCount; + byteCount -= byteCount; + } else { + result.set(chunk, resultOffset); + resultOffset += chunk.byteLength; + this._chunks.shift(); + this._totalLength -= chunk.byteLength; + byteCount -= chunk.byteLength; + } + } + return result; + } + }; + exports2.AbstractMessageBuffer = AbstractMessageBuffer; + } + }); + require_connection = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/connection.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.createMessageConnection = exports2.ConnectionOptions = exports2.MessageStrategy = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.RequestCancellationReceiverStrategy = exports2.IdCancellationReceiverStrategy = exports2.ConnectionStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.TraceValues = exports2.Trace = exports2.NullLogger = exports2.ProgressType = exports2.ProgressToken = void 0; + var ral_1 = require_ral(); + var Is2 = require_is(); + var messages_1 = require_messages(); + var linkedMap_1 = require_linkedMap(); + var events_1 = require_events(); + var cancellation_1 = require_cancellation(); + var CancelNotification; + (function(CancelNotification2) { + CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest"); + })(CancelNotification || (CancelNotification = {})); + var ProgressToken; + (function(ProgressToken2) { + function is2(value2) { + return typeof value2 === "string" || typeof value2 === "number"; + } + __name(is2, "is"); + __name2(is2, "is"); + ProgressToken2.is = is2; + })(ProgressToken || (exports2.ProgressToken = ProgressToken = {})); + var ProgressNotification; + (function(ProgressNotification2) { + ProgressNotification2.type = new messages_1.NotificationType("$/progress"); + })(ProgressNotification || (ProgressNotification = {})); + var ProgressType = class { + static { + __name(this, "ProgressType"); + } + static { + __name2(this, "ProgressType"); + } + constructor() { + } + }; + exports2.ProgressType = ProgressType; + var StarRequestHandler; + (function(StarRequestHandler2) { + function is2(value2) { + return Is2.func(value2); + } + __name(is2, "is"); + __name2(is2, "is"); + StarRequestHandler2.is = is2; + })(StarRequestHandler || (StarRequestHandler = {})); + exports2.NullLogger = Object.freeze({ + error: /* @__PURE__ */ __name2(() => { + }, "error"), + warn: /* @__PURE__ */ __name2(() => { + }, "warn"), + info: /* @__PURE__ */ __name2(() => { + }, "info"), + log: /* @__PURE__ */ __name2(() => { + }, "log") + }); + var Trace; + (function(Trace2) { + Trace2[Trace2["Off"] = 0] = "Off"; + Trace2[Trace2["Messages"] = 1] = "Messages"; + Trace2[Trace2["Compact"] = 2] = "Compact"; + Trace2[Trace2["Verbose"] = 3] = "Verbose"; + })(Trace || (exports2.Trace = Trace = {})); + var TraceValues; + (function(TraceValues2) { + TraceValues2.Off = "off"; + TraceValues2.Messages = "messages"; + TraceValues2.Compact = "compact"; + TraceValues2.Verbose = "verbose"; + })(TraceValues || (exports2.TraceValues = TraceValues = {})); + (function(Trace2) { + function fromString(value2) { + if (!Is2.string(value2)) { + return Trace2.Off; + } + value2 = value2.toLowerCase(); + switch (value2) { + case "off": + return Trace2.Off; + case "messages": + return Trace2.Messages; + case "compact": + return Trace2.Compact; + case "verbose": + return Trace2.Verbose; + default: + return Trace2.Off; + } + } + __name(fromString, "fromString"); + __name2(fromString, "fromString"); + Trace2.fromString = fromString; + function toString42(value2) { + switch (value2) { + case Trace2.Off: + return "off"; + case Trace2.Messages: + return "messages"; + case Trace2.Compact: + return "compact"; + case Trace2.Verbose: + return "verbose"; + default: + return "off"; + } + } + __name(toString42, "toString4"); + __name2(toString42, "toString"); + Trace2.toString = toString42; + })(Trace || (exports2.Trace = Trace = {})); + var TraceFormat; + (function(TraceFormat2) { + TraceFormat2["Text"] = "text"; + TraceFormat2["JSON"] = "json"; + })(TraceFormat || (exports2.TraceFormat = TraceFormat = {})); + (function(TraceFormat2) { + function fromString(value2) { + if (!Is2.string(value2)) { + return TraceFormat2.Text; + } + value2 = value2.toLowerCase(); + if (value2 === "json") { + return TraceFormat2.JSON; + } else { + return TraceFormat2.Text; + } + } + __name(fromString, "fromString"); + __name2(fromString, "fromString"); + TraceFormat2.fromString = fromString; + })(TraceFormat || (exports2.TraceFormat = TraceFormat = {})); + var SetTraceNotification; + (function(SetTraceNotification2) { + SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace"); + })(SetTraceNotification || (exports2.SetTraceNotification = SetTraceNotification = {})); + var LogTraceNotification; + (function(LogTraceNotification2) { + LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace"); + })(LogTraceNotification || (exports2.LogTraceNotification = LogTraceNotification = {})); + var ConnectionErrors; + (function(ConnectionErrors2) { + ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed"; + ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed"; + ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening"; + })(ConnectionErrors || (exports2.ConnectionErrors = ConnectionErrors = {})); + var ConnectionError = class _ConnectionError extends Error { + static { + __name(this, "_ConnectionError"); + } + static { + __name2(this, "ConnectionError"); + } + constructor(code, message) { + super(message); + this.code = code; + Object.setPrototypeOf(this, _ConnectionError.prototype); + } + }; + exports2.ConnectionError = ConnectionError; + var ConnectionStrategy; + (function(ConnectionStrategy2) { + function is2(value2) { + const candidate = value2; + return candidate && Is2.func(candidate.cancelUndispatched); + } + __name(is2, "is"); + __name2(is2, "is"); + ConnectionStrategy2.is = is2; + })(ConnectionStrategy || (exports2.ConnectionStrategy = ConnectionStrategy = {})); + var IdCancellationReceiverStrategy; + (function(IdCancellationReceiverStrategy2) { + function is2(value2) { + const candidate = value2; + return candidate && (candidate.kind === void 0 || candidate.kind === "id") && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose)); + } + __name(is2, "is"); + __name2(is2, "is"); + IdCancellationReceiverStrategy2.is = is2; + })(IdCancellationReceiverStrategy || (exports2.IdCancellationReceiverStrategy = IdCancellationReceiverStrategy = {})); + var RequestCancellationReceiverStrategy; + (function(RequestCancellationReceiverStrategy2) { + function is2(value2) { + const candidate = value2; + return candidate && candidate.kind === "request" && Is2.func(candidate.createCancellationTokenSource) && (candidate.dispose === void 0 || Is2.func(candidate.dispose)); + } + __name(is2, "is"); + __name2(is2, "is"); + RequestCancellationReceiverStrategy2.is = is2; + })(RequestCancellationReceiverStrategy || (exports2.RequestCancellationReceiverStrategy = RequestCancellationReceiverStrategy = {})); + var CancellationReceiverStrategy; + (function(CancellationReceiverStrategy2) { + CancellationReceiverStrategy2.Message = Object.freeze({ + createCancellationTokenSource(_3) { + return new cancellation_1.CancellationTokenSource(); + } + }); + function is2(value2) { + return IdCancellationReceiverStrategy.is(value2) || RequestCancellationReceiverStrategy.is(value2); + } + __name(is2, "is"); + __name2(is2, "is"); + CancellationReceiverStrategy2.is = is2; + })(CancellationReceiverStrategy || (exports2.CancellationReceiverStrategy = CancellationReceiverStrategy = {})); + var CancellationSenderStrategy; + (function(CancellationSenderStrategy2) { + CancellationSenderStrategy2.Message = Object.freeze({ + sendCancellation(conn, id35) { + return conn.sendNotification(CancelNotification.type, { id: id35 }); + }, + cleanup(_3) { + } + }); + function is2(value2) { + const candidate = value2; + return candidate && Is2.func(candidate.sendCancellation) && Is2.func(candidate.cleanup); + } + __name(is2, "is"); + __name2(is2, "is"); + CancellationSenderStrategy2.is = is2; + })(CancellationSenderStrategy || (exports2.CancellationSenderStrategy = CancellationSenderStrategy = {})); + var CancellationStrategy; + (function(CancellationStrategy2) { + CancellationStrategy2.Message = Object.freeze({ + receiver: CancellationReceiverStrategy.Message, + sender: CancellationSenderStrategy.Message + }); + function is2(value2) { + const candidate = value2; + return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); + } + __name(is2, "is"); + __name2(is2, "is"); + CancellationStrategy2.is = is2; + })(CancellationStrategy || (exports2.CancellationStrategy = CancellationStrategy = {})); + var MessageStrategy; + (function(MessageStrategy2) { + function is2(value2) { + const candidate = value2; + return candidate && Is2.func(candidate.handleMessage); + } + __name(is2, "is"); + __name2(is2, "is"); + MessageStrategy2.is = is2; + })(MessageStrategy || (exports2.MessageStrategy = MessageStrategy = {})); + var ConnectionOptions; + (function(ConnectionOptions2) { + function is2(value2) { + const candidate = value2; + return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy) || MessageStrategy.is(candidate.messageStrategy)); + } + __name(is2, "is"); + __name2(is2, "is"); + ConnectionOptions2.is = is2; + })(ConnectionOptions || (exports2.ConnectionOptions = ConnectionOptions = {})); + var ConnectionState; + (function(ConnectionState2) { + ConnectionState2[ConnectionState2["New"] = 1] = "New"; + ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening"; + ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed"; + ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed"; + })(ConnectionState || (ConnectionState = {})); + function createMessageConnection(messageReader, messageWriter, _logger, options2) { + const logger = _logger !== void 0 ? _logger : exports2.NullLogger; + let sequenceNumber = 0; + let notificationSequenceNumber = 0; + let unknownResponseSequenceNumber = 0; + const version3 = "2.0"; + let starRequestHandler = void 0; + const requestHandlers = /* @__PURE__ */ new Map(); + let starNotificationHandler = void 0; + const notificationHandlers = /* @__PURE__ */ new Map(); + const progressHandlers = /* @__PURE__ */ new Map(); + let timer22; + let messageQueue = new linkedMap_1.LinkedMap(); + let responsePromises = /* @__PURE__ */ new Map(); + let knownCanceledRequests = /* @__PURE__ */ new Set(); + let requestTokens = /* @__PURE__ */ new Map(); + let trace = Trace.Off; + let traceFormat = TraceFormat.Text; + let tracer; + let state4 = ConnectionState.New; + const errorEmitter = new events_1.Emitter(); + const closeEmitter = new events_1.Emitter(); + const unhandledNotificationEmitter = new events_1.Emitter(); + const unhandledProgressEmitter = new events_1.Emitter(); + const disposeEmitter = new events_1.Emitter(); + const cancellationStrategy = options2 && options2.cancellationStrategy ? options2.cancellationStrategy : CancellationStrategy.Message; + function createRequestQueueKey(id35) { + if (id35 === null) { + throw new Error(`Can't send requests with id null since the response can't be correlated.`); + } + return "req-" + id35.toString(); + } + __name(createRequestQueueKey, "createRequestQueueKey"); + __name2(createRequestQueueKey, "createRequestQueueKey"); + function createResponseQueueKey(id35) { + if (id35 === null) { + return "res-unknown-" + (++unknownResponseSequenceNumber).toString(); + } else { + return "res-" + id35.toString(); + } + } + __name(createResponseQueueKey, "createResponseQueueKey"); + __name2(createResponseQueueKey, "createResponseQueueKey"); + function createNotificationQueueKey() { + return "not-" + (++notificationSequenceNumber).toString(); + } + __name(createNotificationQueueKey, "createNotificationQueueKey"); + __name2(createNotificationQueueKey, "createNotificationQueueKey"); + function addMessageToQueue(queue, message) { + if (messages_1.Message.isRequest(message)) { + queue.set(createRequestQueueKey(message.id), message); + } else if (messages_1.Message.isResponse(message)) { + queue.set(createResponseQueueKey(message.id), message); + } else { + queue.set(createNotificationQueueKey(), message); + } + } + __name(addMessageToQueue, "addMessageToQueue"); + __name2(addMessageToQueue, "addMessageToQueue"); + function cancelUndispatched(_message) { + return void 0; + } + __name(cancelUndispatched, "cancelUndispatched"); + __name2(cancelUndispatched, "cancelUndispatched"); + function isListening() { + return state4 === ConnectionState.Listening; + } + __name(isListening, "isListening"); + __name2(isListening, "isListening"); + function isClosed() { + return state4 === ConnectionState.Closed; + } + __name(isClosed, "isClosed"); + __name2(isClosed, "isClosed"); + function isDisposed() { + return state4 === ConnectionState.Disposed; + } + __name(isDisposed, "isDisposed"); + __name2(isDisposed, "isDisposed"); + function closeHandler() { + if (state4 === ConnectionState.New || state4 === ConnectionState.Listening) { + state4 = ConnectionState.Closed; + closeEmitter.fire(void 0); + } + } + __name(closeHandler, "closeHandler"); + __name2(closeHandler, "closeHandler"); + function readErrorHandler(error3) { + errorEmitter.fire([error3, void 0, void 0]); + } + __name(readErrorHandler, "readErrorHandler"); + __name2(readErrorHandler, "readErrorHandler"); + function writeErrorHandler(data5) { + errorEmitter.fire(data5); + } + __name(writeErrorHandler, "writeErrorHandler"); + __name2(writeErrorHandler, "writeErrorHandler"); + messageReader.onClose(closeHandler); + messageReader.onError(readErrorHandler); + messageWriter.onClose(closeHandler); + messageWriter.onError(writeErrorHandler); + function triggerMessageQueue() { + if (timer22 || messageQueue.size === 0) { + return; + } + timer22 = (0, ral_1.default)().timer.setImmediate(() => { + timer22 = void 0; + processMessageQueue(); + }); + } + __name(triggerMessageQueue, "triggerMessageQueue"); + __name2(triggerMessageQueue, "triggerMessageQueue"); + function handleMessage(message) { + if (messages_1.Message.isRequest(message)) { + handleRequest(message); + } else if (messages_1.Message.isNotification(message)) { + handleNotification(message); + } else if (messages_1.Message.isResponse(message)) { + handleResponse(message); + } else { + handleInvalidMessage(message); + } + } + __name(handleMessage, "handleMessage"); + __name2(handleMessage, "handleMessage"); + function processMessageQueue() { + if (messageQueue.size === 0) { + return; + } + const message = messageQueue.shift(); + try { + const messageStrategy = options2?.messageStrategy; + if (MessageStrategy.is(messageStrategy)) { + messageStrategy.handleMessage(message, handleMessage); + } else { + handleMessage(message); + } + } finally { + triggerMessageQueue(); + } + } + __name(processMessageQueue, "processMessageQueue"); + __name2(processMessageQueue, "processMessageQueue"); + const callback = /* @__PURE__ */ __name2((message) => { + try { + if (messages_1.Message.isNotification(message) && message.method === CancelNotification.type.method) { + const cancelId = message.params.id; + const key = createRequestQueueKey(cancelId); + const toCancel = messageQueue.get(key); + if (messages_1.Message.isRequest(toCancel)) { + const strategy = options2?.connectionStrategy; + const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); + if (response && (response.error !== void 0 || response.result !== void 0)) { + messageQueue.delete(key); + requestTokens.delete(cancelId); + response.id = toCancel.id; + traceSendingResponse(response, message.method, Date.now()); + messageWriter.write(response).catch(() => logger.error(`Sending response for canceled message failed.`)); + return; + } + } + const cancellationToken = requestTokens.get(cancelId); + if (cancellationToken !== void 0) { + cancellationToken.cancel(); + traceReceivedNotification(message); + return; + } else { + knownCanceledRequests.add(cancelId); + } + } + addMessageToQueue(messageQueue, message); + } finally { + triggerMessageQueue(); + } + }, "callback"); + function handleRequest(requestMessage) { + if (isDisposed()) { + return; + } + function reply(resultOrError, method, startTime2) { + const message = { + jsonrpc: version3, + id: requestMessage.id + }; + if (resultOrError instanceof messages_1.ResponseError) { + message.error = resultOrError.toJson(); + } else { + message.result = resultOrError === void 0 ? null : resultOrError; + } + traceSendingResponse(message, method, startTime2); + messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); + } + __name(reply, "reply"); + __name2(reply, "reply"); + function replyError(error3, method, startTime2) { + const message = { + jsonrpc: version3, + id: requestMessage.id, + error: error3.toJson() + }; + traceSendingResponse(message, method, startTime2); + messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); + } + __name(replyError, "replyError"); + __name2(replyError, "replyError"); + function replySuccess(result, method, startTime2) { + if (result === void 0) { + result = null; + } + const message = { + jsonrpc: version3, + id: requestMessage.id, + result + }; + traceSendingResponse(message, method, startTime2); + messageWriter.write(message).catch(() => logger.error(`Sending response failed.`)); + } + __name(replySuccess, "replySuccess"); + __name2(replySuccess, "replySuccess"); + traceReceivedRequest(requestMessage); + const element3 = requestHandlers.get(requestMessage.method); + let type3; + let requestHandler; + if (element3) { + type3 = element3.type; + requestHandler = element3.handler; + } + const startTime = Date.now(); + if (requestHandler || starRequestHandler) { + const tokenKey = requestMessage.id ?? String(Date.now()); + const cancellationSource = IdCancellationReceiverStrategy.is(cancellationStrategy.receiver) ? cancellationStrategy.receiver.createCancellationTokenSource(tokenKey) : cancellationStrategy.receiver.createCancellationTokenSource(requestMessage); + if (requestMessage.id !== null && knownCanceledRequests.has(requestMessage.id)) { + cancellationSource.cancel(); + } + if (requestMessage.id !== null) { + requestTokens.set(tokenKey, cancellationSource); + } + try { + let handlerResult; + if (requestHandler) { + if (requestMessage.params === void 0) { + if (type3 !== void 0 && type3.numberOfParams !== 0) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type3.numberOfParams} params but received none.`), requestMessage.method, startTime); + return; + } + handlerResult = requestHandler(cancellationSource.token); + } else if (Array.isArray(requestMessage.params)) { + if (type3 !== void 0 && type3.parameterStructures === messages_1.ParameterStructures.byName) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime); + return; + } + handlerResult = requestHandler(...requestMessage.params, cancellationSource.token); + } else { + if (type3 !== void 0 && type3.parameterStructures === messages_1.ParameterStructures.byPosition) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime); + return; + } + handlerResult = requestHandler(requestMessage.params, cancellationSource.token); + } + } else if (starRequestHandler) { + handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); + } + const promise4 = handlerResult; + if (!handlerResult) { + requestTokens.delete(tokenKey); + replySuccess(handlerResult, requestMessage.method, startTime); + } else if (promise4.then) { + promise4.then((resultOrError) => { + requestTokens.delete(tokenKey); + reply(resultOrError, requestMessage.method, startTime); + }, (error3) => { + requestTokens.delete(tokenKey); + if (error3 instanceof messages_1.ResponseError) { + replyError(error3, requestMessage.method, startTime); + } else if (error3 && Is2.string(error3.message)) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error3.message}`), requestMessage.method, startTime); + } else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); + } + }); + } else { + requestTokens.delete(tokenKey); + reply(handlerResult, requestMessage.method, startTime); + } + } catch (error3) { + requestTokens.delete(tokenKey); + if (error3 instanceof messages_1.ResponseError) { + reply(error3, requestMessage.method, startTime); + } else if (error3 && Is2.string(error3.message)) { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error3.message}`), requestMessage.method, startTime); + } else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); + } + } + } else { + replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); + } + } + __name(handleRequest, "handleRequest"); + __name2(handleRequest, "handleRequest"); + function handleResponse(responseMessage) { + if (isDisposed()) { + return; + } + if (responseMessage.id === null) { + if (responseMessage.error) { + logger.error(`Received response message without id: Error is: +${JSON.stringify(responseMessage.error, void 0, 4)}`); + } else { + logger.error(`Received response message without id. No further error information provided.`); + } + } else { + const key = responseMessage.id; + const responsePromise = responsePromises.get(key); + traceReceivedResponse(responseMessage, responsePromise); + if (responsePromise !== void 0) { + responsePromises.delete(key); + try { + if (responseMessage.error) { + const error3 = responseMessage.error; + responsePromise.reject(new messages_1.ResponseError(error3.code, error3.message, error3.data)); + } else if (responseMessage.result !== void 0) { + responsePromise.resolve(responseMessage.result); + } else { + throw new Error("Should never happen."); + } + } catch (error3) { + if (error3.message) { + logger.error(`Response handler '${responsePromise.method}' failed with message: ${error3.message}`); + } else { + logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); + } + } + } + } + } + __name(handleResponse, "handleResponse"); + __name2(handleResponse, "handleResponse"); + function handleNotification(message) { + if (isDisposed()) { + return; + } + let type3 = void 0; + let notificationHandler; + if (message.method === CancelNotification.type.method) { + const cancelId = message.params.id; + knownCanceledRequests.delete(cancelId); + traceReceivedNotification(message); + return; + } else { + const element3 = notificationHandlers.get(message.method); + if (element3) { + notificationHandler = element3.handler; + type3 = element3.type; + } + } + if (notificationHandler || starNotificationHandler) { + try { + traceReceivedNotification(message); + if (notificationHandler) { + if (message.params === void 0) { + if (type3 !== void 0) { + if (type3.numberOfParams !== 0 && type3.parameterStructures !== messages_1.ParameterStructures.byName) { + logger.error(`Notification ${message.method} defines ${type3.numberOfParams} params but received none.`); + } + } + notificationHandler(); + } else if (Array.isArray(message.params)) { + const params = message.params; + if (message.method === ProgressNotification.type.method && params.length === 2 && ProgressToken.is(params[0])) { + notificationHandler({ token: params[0], value: params[1] }); + } else { + if (type3 !== void 0) { + if (type3.parameterStructures === messages_1.ParameterStructures.byName) { + logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`); + } + if (type3.numberOfParams !== message.params.length) { + logger.error(`Notification ${message.method} defines ${type3.numberOfParams} params but received ${params.length} arguments`); + } + } + notificationHandler(...params); + } + } else { + if (type3 !== void 0 && type3.parameterStructures === messages_1.ParameterStructures.byPosition) { + logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`); + } + notificationHandler(message.params); + } + } else if (starNotificationHandler) { + starNotificationHandler(message.method, message.params); + } + } catch (error3) { + if (error3.message) { + logger.error(`Notification handler '${message.method}' failed with message: ${error3.message}`); + } else { + logger.error(`Notification handler '${message.method}' failed unexpectedly.`); + } + } + } else { + unhandledNotificationEmitter.fire(message); + } + } + __name(handleNotification, "handleNotification"); + __name2(handleNotification, "handleNotification"); + function handleInvalidMessage(message) { + if (!message) { + logger.error("Received empty message."); + return; + } + logger.error(`Received message which is neither a response nor a notification message: +${JSON.stringify(message, null, 4)}`); + const responseMessage = message; + if (Is2.string(responseMessage.id) || Is2.number(responseMessage.id)) { + const key = responseMessage.id; + const responseHandler = responsePromises.get(key); + if (responseHandler) { + responseHandler.reject(new Error("The received response has neither a result nor an error property.")); + } + } + } + __name(handleInvalidMessage, "handleInvalidMessage"); + __name2(handleInvalidMessage, "handleInvalidMessage"); + function stringifyTrace(params) { + if (params === void 0 || params === null) { + return void 0; + } + switch (trace) { + case Trace.Verbose: + return JSON.stringify(params, null, 4); + case Trace.Compact: + return JSON.stringify(params); + default: + return void 0; + } + } + __name(stringifyTrace, "stringifyTrace"); + __name2(stringifyTrace, "stringifyTrace"); + function traceSendingRequest(message) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data5 = void 0; + if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { + data5 = `Params: ${stringifyTrace(message.params)} + +`; + } + tracer.log(`Sending request '${message.method} - (${message.id})'.`, data5); + } else { + logLSPMessage("send-request", message); + } + } + __name(traceSendingRequest, "traceSendingRequest"); + __name2(traceSendingRequest, "traceSendingRequest"); + function traceSendingNotification(message) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data5 = void 0; + if (trace === Trace.Verbose || trace === Trace.Compact) { + if (message.params) { + data5 = `Params: ${stringifyTrace(message.params)} + +`; + } else { + data5 = "No parameters provided.\n\n"; + } + } + tracer.log(`Sending notification '${message.method}'.`, data5); + } else { + logLSPMessage("send-notification", message); + } + } + __name(traceSendingNotification, "traceSendingNotification"); + __name2(traceSendingNotification, "traceSendingNotification"); + function traceSendingResponse(message, method, startTime) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data5 = void 0; + if (trace === Trace.Verbose || trace === Trace.Compact) { + if (message.error && message.error.data) { + data5 = `Error data: ${stringifyTrace(message.error.data)} + +`; + } else { + if (message.result) { + data5 = `Result: ${stringifyTrace(message.result)} + +`; + } else if (message.error === void 0) { + data5 = "No result returned.\n\n"; + } + } + } + tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data5); + } else { + logLSPMessage("send-response", message); + } + } + __name(traceSendingResponse, "traceSendingResponse"); + __name2(traceSendingResponse, "traceSendingResponse"); + function traceReceivedRequest(message) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data5 = void 0; + if ((trace === Trace.Verbose || trace === Trace.Compact) && message.params) { + data5 = `Params: ${stringifyTrace(message.params)} + +`; + } + tracer.log(`Received request '${message.method} - (${message.id})'.`, data5); + } else { + logLSPMessage("receive-request", message); + } + } + __name(traceReceivedRequest, "traceReceivedRequest"); + __name2(traceReceivedRequest, "traceReceivedRequest"); + function traceReceivedNotification(message) { + if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data5 = void 0; + if (trace === Trace.Verbose || trace === Trace.Compact) { + if (message.params) { + data5 = `Params: ${stringifyTrace(message.params)} + +`; + } else { + data5 = "No parameters provided.\n\n"; + } + } + tracer.log(`Received notification '${message.method}'.`, data5); + } else { + logLSPMessage("receive-notification", message); + } + } + __name(traceReceivedNotification, "traceReceivedNotification"); + __name2(traceReceivedNotification, "traceReceivedNotification"); + function traceReceivedResponse(message, responsePromise) { + if (trace === Trace.Off || !tracer) { + return; + } + if (traceFormat === TraceFormat.Text) { + let data5 = void 0; + if (trace === Trace.Verbose || trace === Trace.Compact) { + if (message.error && message.error.data) { + data5 = `Error data: ${stringifyTrace(message.error.data)} + +`; + } else { + if (message.result) { + data5 = `Result: ${stringifyTrace(message.result)} + +`; + } else if (message.error === void 0) { + data5 = "No result returned.\n\n"; + } + } + } + if (responsePromise) { + const error3 = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ""; + tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error3}`, data5); + } else { + tracer.log(`Received response ${message.id} without active response promise.`, data5); + } + } else { + logLSPMessage("receive-response", message); + } + } + __name(traceReceivedResponse, "traceReceivedResponse"); + __name2(traceReceivedResponse, "traceReceivedResponse"); + function logLSPMessage(type3, message) { + if (!tracer || trace === Trace.Off) { + return; + } + const lspMessage = { + isLSPMessage: true, + type: type3, + message, + timestamp: Date.now() + }; + tracer.log(lspMessage); + } + __name(logLSPMessage, "logLSPMessage"); + __name2(logLSPMessage, "logLSPMessage"); + function throwIfClosedOrDisposed() { + if (isClosed()) { + throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed."); + } + if (isDisposed()) { + throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed."); + } + } + __name(throwIfClosedOrDisposed, "throwIfClosedOrDisposed"); + __name2(throwIfClosedOrDisposed, "throwIfClosedOrDisposed"); + function throwIfListening() { + if (isListening()) { + throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening"); + } + } + __name(throwIfListening, "throwIfListening"); + __name2(throwIfListening, "throwIfListening"); + function throwIfNotListening() { + if (!isListening()) { + throw new Error("Call listen() first."); + } + } + __name(throwIfNotListening, "throwIfNotListening"); + __name2(throwIfNotListening, "throwIfNotListening"); + function undefinedToNull(param) { + if (param === void 0) { + return null; + } else { + return param; + } + } + __name(undefinedToNull, "undefinedToNull"); + __name2(undefinedToNull, "undefinedToNull"); + function nullToUndefined(param) { + if (param === null) { + return void 0; + } else { + return param; + } + } + __name(nullToUndefined, "nullToUndefined"); + __name2(nullToUndefined, "nullToUndefined"); + function isNamedParam(param) { + return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object"; + } + __name(isNamedParam, "isNamedParam"); + __name2(isNamedParam, "isNamedParam"); + function computeSingleParam(parameterStructures, param) { + switch (parameterStructures) { + case messages_1.ParameterStructures.auto: + if (isNamedParam(param)) { + return nullToUndefined(param); + } else { + return [undefinedToNull(param)]; + } + case messages_1.ParameterStructures.byName: + if (!isNamedParam(param)) { + throw new Error(`Received parameters by name but param is not an object literal.`); + } + return nullToUndefined(param); + case messages_1.ParameterStructures.byPosition: + return [undefinedToNull(param)]; + default: + throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`); + } + } + __name(computeSingleParam, "computeSingleParam"); + __name2(computeSingleParam, "computeSingleParam"); + function computeMessageParams(type3, params) { + let result; + const numberOfParams = type3.numberOfParams; + switch (numberOfParams) { + case 0: + result = void 0; + break; + case 1: + result = computeSingleParam(type3.parameterStructures, params[0]); + break; + default: + result = []; + for (let i2 = 0; i2 < params.length && i2 < numberOfParams; i2++) { + result.push(undefinedToNull(params[i2])); + } + if (params.length < numberOfParams) { + for (let i2 = params.length; i2 < numberOfParams; i2++) { + result.push(null); + } + } + break; + } + return result; + } + __name(computeMessageParams, "computeMessageParams"); + __name2(computeMessageParams, "computeMessageParams"); + const connection = { + sendNotification: /* @__PURE__ */ __name2((type3, ...args) => { + throwIfClosedOrDisposed(); + let method; + let messageParams; + if (Is2.string(type3)) { + method = type3; + const first22 = args[0]; + let paramStart = 0; + let parameterStructures = messages_1.ParameterStructures.auto; + if (messages_1.ParameterStructures.is(first22)) { + paramStart = 1; + parameterStructures = first22; + } + let paramEnd = args.length; + const numberOfParams = paramEnd - paramStart; + switch (numberOfParams) { + case 0: + messageParams = void 0; + break; + case 1: + messageParams = computeSingleParam(parameterStructures, args[paramStart]); + break; + default: + if (parameterStructures === messages_1.ParameterStructures.byName) { + throw new Error(`Received ${numberOfParams} parameters for 'by Name' notification parameter structure.`); + } + messageParams = args.slice(paramStart, paramEnd).map((value2) => undefinedToNull(value2)); + break; + } + } else { + const params = args; + method = type3.method; + messageParams = computeMessageParams(type3, params); + } + const notificationMessage = { + jsonrpc: version3, + method, + params: messageParams + }; + traceSendingNotification(notificationMessage); + return messageWriter.write(notificationMessage).catch((error3) => { + logger.error(`Sending notification failed.`); + throw error3; + }); + }, "sendNotification"), + onNotification: /* @__PURE__ */ __name2((type3, handler) => { + throwIfClosedOrDisposed(); + let method; + if (Is2.func(type3)) { + starNotificationHandler = type3; + } else if (handler) { + if (Is2.string(type3)) { + method = type3; + notificationHandlers.set(type3, { type: void 0, handler }); + } else { + method = type3.method; + notificationHandlers.set(type3.method, { type: type3, handler }); + } + } + return { + dispose: /* @__PURE__ */ __name2(() => { + if (method !== void 0) { + notificationHandlers.delete(method); + } else { + starNotificationHandler = void 0; + } + }, "dispose") + }; + }, "onNotification"), + onProgress: /* @__PURE__ */ __name2((_type, token2, handler) => { + if (progressHandlers.has(token2)) { + throw new Error(`Progress handler for token ${token2} already registered`); + } + progressHandlers.set(token2, handler); + return { + dispose: /* @__PURE__ */ __name2(() => { + progressHandlers.delete(token2); + }, "dispose") + }; + }, "onProgress"), + sendProgress: /* @__PURE__ */ __name2((_type, token2, value2) => { + return connection.sendNotification(ProgressNotification.type, { token: token2, value: value2 }); + }, "sendProgress"), + onUnhandledProgress: unhandledProgressEmitter.event, + sendRequest: /* @__PURE__ */ __name2((type3, ...args) => { + throwIfClosedOrDisposed(); + throwIfNotListening(); + let method; + let messageParams; + let token2 = void 0; + if (Is2.string(type3)) { + method = type3; + const first22 = args[0]; + const last22 = args[args.length - 1]; + let paramStart = 0; + let parameterStructures = messages_1.ParameterStructures.auto; + if (messages_1.ParameterStructures.is(first22)) { + paramStart = 1; + parameterStructures = first22; + } + let paramEnd = args.length; + if (cancellation_1.CancellationToken.is(last22)) { + paramEnd = paramEnd - 1; + token2 = last22; + } + const numberOfParams = paramEnd - paramStart; + switch (numberOfParams) { + case 0: + messageParams = void 0; + break; + case 1: + messageParams = computeSingleParam(parameterStructures, args[paramStart]); + break; + default: + if (parameterStructures === messages_1.ParameterStructures.byName) { + throw new Error(`Received ${numberOfParams} parameters for 'by Name' request parameter structure.`); + } + messageParams = args.slice(paramStart, paramEnd).map((value2) => undefinedToNull(value2)); + break; + } + } else { + const params = args; + method = type3.method; + messageParams = computeMessageParams(type3, params); + const numberOfParams = type3.numberOfParams; + token2 = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0; + } + const id35 = sequenceNumber++; + let disposable; + if (token2) { + disposable = token2.onCancellationRequested(() => { + const p3 = cancellationStrategy.sender.sendCancellation(connection, id35); + if (p3 === void 0) { + logger.log(`Received no promise from cancellation strategy when cancelling id ${id35}`); + return Promise.resolve(); + } else { + return p3.catch(() => { + logger.log(`Sending cancellation messages for id ${id35} failed`); + }); + } + }); + } + const requestMessage = { + jsonrpc: version3, + id: id35, + method, + params: messageParams + }; + traceSendingRequest(requestMessage); + if (typeof cancellationStrategy.sender.enableCancellation === "function") { + cancellationStrategy.sender.enableCancellation(requestMessage); + } + return new Promise(async (resolve2, reject22) => { + const resolveWithCleanup = /* @__PURE__ */ __name2((r2) => { + resolve2(r2); + cancellationStrategy.sender.cleanup(id35); + disposable?.dispose(); + }, "resolveWithCleanup"); + const rejectWithCleanup = /* @__PURE__ */ __name2((r2) => { + reject22(r2); + cancellationStrategy.sender.cleanup(id35); + disposable?.dispose(); + }, "rejectWithCleanup"); + const responsePromise = { method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup }; + try { + await messageWriter.write(requestMessage); + responsePromises.set(id35, responsePromise); + } catch (error3) { + logger.error(`Sending request failed.`); + responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, error3.message ? error3.message : "Unknown reason")); + throw error3; + } + }); + }, "sendRequest"), + onRequest: /* @__PURE__ */ __name2((type3, handler) => { + throwIfClosedOrDisposed(); + let method = null; + if (StarRequestHandler.is(type3)) { + method = void 0; + starRequestHandler = type3; + } else if (Is2.string(type3)) { + method = null; + if (handler !== void 0) { + method = type3; + requestHandlers.set(type3, { handler, type: void 0 }); + } + } else { + if (handler !== void 0) { + method = type3.method; + requestHandlers.set(type3.method, { type: type3, handler }); + } + } + return { + dispose: /* @__PURE__ */ __name2(() => { + if (method === null) { + return; + } + if (method !== void 0) { + requestHandlers.delete(method); + } else { + starRequestHandler = void 0; + } + }, "dispose") + }; + }, "onRequest"), + hasPendingResponse: /* @__PURE__ */ __name2(() => { + return responsePromises.size > 0; + }, "hasPendingResponse"), + trace: /* @__PURE__ */ __name2(async (_value, _tracer, sendNotificationOrTraceOptions) => { + let _sendNotification = false; + let _traceFormat = TraceFormat.Text; + if (sendNotificationOrTraceOptions !== void 0) { + if (Is2.boolean(sendNotificationOrTraceOptions)) { + _sendNotification = sendNotificationOrTraceOptions; + } else { + _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; + _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; + } + } + trace = _value; + traceFormat = _traceFormat; + if (trace === Trace.Off) { + tracer = void 0; + } else { + tracer = _tracer; + } + if (_sendNotification && !isClosed() && !isDisposed()) { + await connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); + } + }, "trace"), + onError: errorEmitter.event, + onClose: closeEmitter.event, + onUnhandledNotification: unhandledNotificationEmitter.event, + onDispose: disposeEmitter.event, + end: /* @__PURE__ */ __name2(() => { + messageWriter.end(); + }, "end"), + dispose: /* @__PURE__ */ __name2(() => { + if (isDisposed()) { + return; + } + state4 = ConnectionState.Disposed; + disposeEmitter.fire(void 0); + const error3 = new messages_1.ResponseError(messages_1.ErrorCodes.PendingResponseRejected, "Pending response rejected since connection got disposed"); + for (const promise4 of responsePromises.values()) { + promise4.reject(error3); + } + responsePromises = /* @__PURE__ */ new Map(); + requestTokens = /* @__PURE__ */ new Map(); + knownCanceledRequests = /* @__PURE__ */ new Set(); + messageQueue = new linkedMap_1.LinkedMap(); + if (Is2.func(messageWriter.dispose)) { + messageWriter.dispose(); + } + if (Is2.func(messageReader.dispose)) { + messageReader.dispose(); + } + }, "dispose"), + listen: /* @__PURE__ */ __name2(() => { + throwIfClosedOrDisposed(); + throwIfListening(); + state4 = ConnectionState.Listening; + messageReader.listen(callback); + }, "listen"), + inspect: /* @__PURE__ */ __name2(() => { + (0, ral_1.default)().console.log("inspect"); + }, "inspect") + }; + connection.onNotification(LogTraceNotification.type, (params) => { + if (trace === Trace.Off || !tracer) { + return; + } + const verbose = trace === Trace.Verbose || trace === Trace.Compact; + tracer.log(params.message, verbose ? params.verbose : void 0); + }); + connection.onNotification(ProgressNotification.type, (params) => { + const handler = progressHandlers.get(params.token); + if (handler) { + handler(params.value); + } else { + unhandledProgressEmitter.fire(params); + } + }); + return connection; + } + __name(createMessageConnection, "createMessageConnection"); + __name2(createMessageConnection, "createMessageConnection"); + exports2.createMessageConnection = createMessageConnection; + } + }); + require_api = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/api.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ProgressType = exports2.ProgressToken = exports2.createMessageConnection = exports2.NullLogger = exports2.ConnectionOptions = exports2.ConnectionStrategy = exports2.AbstractMessageBuffer = exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = exports2.SharedArrayReceiverStrategy = exports2.SharedArraySenderStrategy = exports2.CancellationToken = exports2.CancellationTokenSource = exports2.Emitter = exports2.Event = exports2.Disposable = exports2.LRUCache = exports2.Touch = exports2.LinkedMap = exports2.ParameterStructures = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.ErrorCodes = exports2.ResponseError = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType0 = exports2.RequestType = exports2.Message = exports2.RAL = void 0; + exports2.MessageStrategy = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.TraceValues = exports2.Trace = void 0; + var messages_1 = require_messages(); + Object.defineProperty(exports2, "Message", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.Message; + }, "get") }); + Object.defineProperty(exports2, "RequestType", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType; + }, "get") }); + Object.defineProperty(exports2, "RequestType0", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType0; + }, "get") }); + Object.defineProperty(exports2, "RequestType1", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType1; + }, "get") }); + Object.defineProperty(exports2, "RequestType2", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType2; + }, "get") }); + Object.defineProperty(exports2, "RequestType3", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType3; + }, "get") }); + Object.defineProperty(exports2, "RequestType4", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType4; + }, "get") }); + Object.defineProperty(exports2, "RequestType5", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType5; + }, "get") }); + Object.defineProperty(exports2, "RequestType6", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType6; + }, "get") }); + Object.defineProperty(exports2, "RequestType7", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType7; + }, "get") }); + Object.defineProperty(exports2, "RequestType8", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType8; + }, "get") }); + Object.defineProperty(exports2, "RequestType9", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.RequestType9; + }, "get") }); + Object.defineProperty(exports2, "ResponseError", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.ResponseError; + }, "get") }); + Object.defineProperty(exports2, "ErrorCodes", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.ErrorCodes; + }, "get") }); + Object.defineProperty(exports2, "NotificationType", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType; + }, "get") }); + Object.defineProperty(exports2, "NotificationType0", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType0; + }, "get") }); + Object.defineProperty(exports2, "NotificationType1", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType1; + }, "get") }); + Object.defineProperty(exports2, "NotificationType2", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType2; + }, "get") }); + Object.defineProperty(exports2, "NotificationType3", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType3; + }, "get") }); + Object.defineProperty(exports2, "NotificationType4", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType4; + }, "get") }); + Object.defineProperty(exports2, "NotificationType5", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType5; + }, "get") }); + Object.defineProperty(exports2, "NotificationType6", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType6; + }, "get") }); + Object.defineProperty(exports2, "NotificationType7", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType7; + }, "get") }); + Object.defineProperty(exports2, "NotificationType8", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType8; + }, "get") }); + Object.defineProperty(exports2, "NotificationType9", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.NotificationType9; + }, "get") }); + Object.defineProperty(exports2, "ParameterStructures", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messages_1.ParameterStructures; + }, "get") }); + var linkedMap_1 = require_linkedMap(); + Object.defineProperty(exports2, "LinkedMap", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return linkedMap_1.LinkedMap; + }, "get") }); + Object.defineProperty(exports2, "LRUCache", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return linkedMap_1.LRUCache; + }, "get") }); + Object.defineProperty(exports2, "Touch", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return linkedMap_1.Touch; + }, "get") }); + var disposable_1 = require_disposable(); + Object.defineProperty(exports2, "Disposable", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return disposable_1.Disposable; + }, "get") }); + var events_1 = require_events(); + Object.defineProperty(exports2, "Event", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return events_1.Event; + }, "get") }); + Object.defineProperty(exports2, "Emitter", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return events_1.Emitter; + }, "get") }); + var cancellation_1 = require_cancellation(); + Object.defineProperty(exports2, "CancellationTokenSource", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return cancellation_1.CancellationTokenSource; + }, "get") }); + Object.defineProperty(exports2, "CancellationToken", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return cancellation_1.CancellationToken; + }, "get") }); + var sharedArrayCancellation_1 = require_sharedArrayCancellation(); + Object.defineProperty(exports2, "SharedArraySenderStrategy", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return sharedArrayCancellation_1.SharedArraySenderStrategy; + }, "get") }); + Object.defineProperty(exports2, "SharedArrayReceiverStrategy", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return sharedArrayCancellation_1.SharedArrayReceiverStrategy; + }, "get") }); + var messageReader_1 = require_messageReader(); + Object.defineProperty(exports2, "MessageReader", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messageReader_1.MessageReader; + }, "get") }); + Object.defineProperty(exports2, "AbstractMessageReader", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messageReader_1.AbstractMessageReader; + }, "get") }); + Object.defineProperty(exports2, "ReadableStreamMessageReader", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messageReader_1.ReadableStreamMessageReader; + }, "get") }); + var messageWriter_1 = require_messageWriter(); + Object.defineProperty(exports2, "MessageWriter", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messageWriter_1.MessageWriter; + }, "get") }); + Object.defineProperty(exports2, "AbstractMessageWriter", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messageWriter_1.AbstractMessageWriter; + }, "get") }); + Object.defineProperty(exports2, "WriteableStreamMessageWriter", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messageWriter_1.WriteableStreamMessageWriter; + }, "get") }); + var messageBuffer_1 = require_messageBuffer(); + Object.defineProperty(exports2, "AbstractMessageBuffer", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return messageBuffer_1.AbstractMessageBuffer; + }, "get") }); + var connection_1 = require_connection(); + Object.defineProperty(exports2, "ConnectionStrategy", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.ConnectionStrategy; + }, "get") }); + Object.defineProperty(exports2, "ConnectionOptions", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.ConnectionOptions; + }, "get") }); + Object.defineProperty(exports2, "NullLogger", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.NullLogger; + }, "get") }); + Object.defineProperty(exports2, "createMessageConnection", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.createMessageConnection; + }, "get") }); + Object.defineProperty(exports2, "ProgressToken", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.ProgressToken; + }, "get") }); + Object.defineProperty(exports2, "ProgressType", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.ProgressType; + }, "get") }); + Object.defineProperty(exports2, "Trace", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.Trace; + }, "get") }); + Object.defineProperty(exports2, "TraceValues", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.TraceValues; + }, "get") }); + Object.defineProperty(exports2, "TraceFormat", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.TraceFormat; + }, "get") }); + Object.defineProperty(exports2, "SetTraceNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.SetTraceNotification; + }, "get") }); + Object.defineProperty(exports2, "LogTraceNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.LogTraceNotification; + }, "get") }); + Object.defineProperty(exports2, "ConnectionErrors", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.ConnectionErrors; + }, "get") }); + Object.defineProperty(exports2, "ConnectionError", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.ConnectionError; + }, "get") }); + Object.defineProperty(exports2, "CancellationReceiverStrategy", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.CancellationReceiverStrategy; + }, "get") }); + Object.defineProperty(exports2, "CancellationSenderStrategy", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.CancellationSenderStrategy; + }, "get") }); + Object.defineProperty(exports2, "CancellationStrategy", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.CancellationStrategy; + }, "get") }); + Object.defineProperty(exports2, "MessageStrategy", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.MessageStrategy; + }, "get") }); + var ral_1 = require_ral(); + exports2.RAL = ral_1.default; + } + }); + require_ril = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/ril.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + var api_1 = require_api(); + var MessageBuffer = class _MessageBuffer extends api_1.AbstractMessageBuffer { + static { + __name(this, "_MessageBuffer"); + } + static { + __name2(this, "MessageBuffer"); + } + constructor(encoding = "utf-8") { + super(encoding); + this.asciiDecoder = new TextDecoder("ascii"); + } + emptyBuffer() { + return _MessageBuffer.emptyBuffer; + } + fromString(value2, _encoding) { + return new TextEncoder().encode(value2); + } + toString(value2, encoding) { + if (encoding === "ascii") { + return this.asciiDecoder.decode(value2); + } else { + return new TextDecoder(encoding).decode(value2); + } + } + asNative(buffer, length2) { + if (length2 === void 0) { + return buffer; + } else { + return buffer.slice(0, length2); + } + } + allocNative(length2) { + return new Uint8Array(length2); + } + }; + MessageBuffer.emptyBuffer = new Uint8Array(0); + var ReadableStreamWrapper = class { + static { + __name(this, "ReadableStreamWrapper"); + } + static { + __name2(this, "ReadableStreamWrapper"); + } + constructor(socket) { + this.socket = socket; + this._onData = new api_1.Emitter(); + this._messageListener = (event3) => { + const blob = event3.data; + blob.arrayBuffer().then((buffer) => { + this._onData.fire(new Uint8Array(buffer)); + }, () => { + (0, api_1.RAL)().console.error(`Converting blob to array buffer failed.`); + }); + }; + this.socket.addEventListener("message", this._messageListener); + } + onClose(listener) { + this.socket.addEventListener("close", listener); + return api_1.Disposable.create(() => this.socket.removeEventListener("close", listener)); + } + onError(listener) { + this.socket.addEventListener("error", listener); + return api_1.Disposable.create(() => this.socket.removeEventListener("error", listener)); + } + onEnd(listener) { + this.socket.addEventListener("end", listener); + return api_1.Disposable.create(() => this.socket.removeEventListener("end", listener)); + } + onData(listener) { + return this._onData.event(listener); + } + }; + var WritableStreamWrapper = class { + static { + __name(this, "WritableStreamWrapper"); + } + static { + __name2(this, "WritableStreamWrapper"); + } + constructor(socket) { + this.socket = socket; + } + onClose(listener) { + this.socket.addEventListener("close", listener); + return api_1.Disposable.create(() => this.socket.removeEventListener("close", listener)); + } + onError(listener) { + this.socket.addEventListener("error", listener); + return api_1.Disposable.create(() => this.socket.removeEventListener("error", listener)); + } + onEnd(listener) { + this.socket.addEventListener("end", listener); + return api_1.Disposable.create(() => this.socket.removeEventListener("end", listener)); + } + write(data5, encoding) { + if (typeof data5 === "string") { + if (encoding !== void 0 && encoding !== "utf-8") { + throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${encoding}`); + } + this.socket.send(data5); + } else { + this.socket.send(data5); + } + return Promise.resolve(); + } + end() { + this.socket.close(); + } + }; + var _textEncoder = new TextEncoder(); + var _ril = Object.freeze({ + messageBuffer: Object.freeze({ + create: /* @__PURE__ */ __name2((encoding) => new MessageBuffer(encoding), "create") + }), + applicationJson: Object.freeze({ + encoder: Object.freeze({ + name: "application/json", + encode: /* @__PURE__ */ __name2((msg, options2) => { + if (options2.charset !== "utf-8") { + throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${options2.charset}`); + } + return Promise.resolve(_textEncoder.encode(JSON.stringify(msg, void 0, 0))); + }, "encode") + }), + decoder: Object.freeze({ + name: "application/json", + decode: /* @__PURE__ */ __name2((buffer, options2) => { + if (!(buffer instanceof Uint8Array)) { + throw new Error(`In a Browser environments only Uint8Arrays are supported.`); + } + return Promise.resolve(JSON.parse(new TextDecoder(options2.charset).decode(buffer))); + }, "decode") + }) + }), + stream: Object.freeze({ + asReadableStream: /* @__PURE__ */ __name2((socket) => new ReadableStreamWrapper(socket), "asReadableStream"), + asWritableStream: /* @__PURE__ */ __name2((socket) => new WritableStreamWrapper(socket), "asWritableStream") + }), + console, + timer: Object.freeze({ + setTimeout(callback, ms3, ...args) { + const handle = setTimeout(callback, ms3, ...args); + return { dispose: /* @__PURE__ */ __name2(() => clearTimeout(handle), "dispose") }; + }, + setImmediate(callback, ...args) { + const handle = setTimeout(callback, 0, ...args); + return { dispose: /* @__PURE__ */ __name2(() => clearTimeout(handle), "dispose") }; + }, + setInterval(callback, ms3, ...args) { + const handle = setInterval(callback, ms3, ...args); + return { dispose: /* @__PURE__ */ __name2(() => clearInterval(handle), "dispose") }; + } + }) + }); + function RIL() { + return _ril; + } + __name(RIL, "RIL"); + __name2(RIL, "RIL"); + (function(RIL2) { + function install() { + api_1.RAL.install(_ril); + } + __name(install, "install"); + __name2(install, "install"); + RIL2.install = install; + })(RIL || (RIL = {})); + exports2.default = RIL; + } + }); + require_main = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/main.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o2, m3, k2, k22) { + if (k22 === void 0) k22 = k2; + var desc = Object.getOwnPropertyDescriptor(m3, k2); + if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return m3[k2]; + }, "get") }; + } + Object.defineProperty(o2, k22, desc); + }) : (function(o2, m3, k2, k22) { + if (k22 === void 0) k22 = k2; + o2[k22] = m3[k2]; + })); + var __exportStar = exports2 && exports2.__exportStar || function(m3, exports3) { + for (var p3 in m3) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m3, p3); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.createMessageConnection = exports2.BrowserMessageWriter = exports2.BrowserMessageReader = void 0; + var ril_1 = require_ril(); + ril_1.default.install(); + var api_1 = require_api(); + __exportStar(require_api(), exports2); + var BrowserMessageReader = class extends api_1.AbstractMessageReader { + static { + __name(this, "BrowserMessageReader"); + } + static { + __name2(this, "BrowserMessageReader"); + } + constructor(port) { + super(); + this._onData = new api_1.Emitter(); + this._messageListener = (event3) => { + this._onData.fire(event3.data); + }; + port.addEventListener("error", (event3) => this.fireError(event3)); + port.onmessage = this._messageListener; + } + listen(callback) { + return this._onData.event(callback); + } + }; + exports2.BrowserMessageReader = BrowserMessageReader; + var BrowserMessageWriter = class extends api_1.AbstractMessageWriter { + static { + __name(this, "BrowserMessageWriter"); + } + static { + __name2(this, "BrowserMessageWriter"); + } + constructor(port) { + super(); + this.port = port; + this.errorCount = 0; + port.addEventListener("error", (event3) => this.fireError(event3)); + } + write(msg) { + try { + this.port.postMessage(msg); + return Promise.resolve(); + } catch (error3) { + this.handleError(error3, msg); + return Promise.reject(error3); + } + } + handleError(error3, msg) { + this.errorCount++; + this.fireError(error3, msg, this.errorCount); + } + end() { + } + }; + exports2.BrowserMessageWriter = BrowserMessageWriter; + function createMessageConnection(reader, writer, logger, options2) { + if (logger === void 0) { + logger = api_1.NullLogger; + } + if (api_1.ConnectionStrategy.is(options2)) { + options2 = { connectionStrategy: options2 }; + } + return (0, api_1.createMessageConnection)(reader, writer, logger, options2); + } + __name(createMessageConnection, "createMessageConnection"); + __name2(createMessageConnection, "createMessageConnection"); + exports2.createMessageConnection = createMessageConnection; + } + }); + require_browser = __commonJS2({ + "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/browser.js"(exports2, module2) { + "use strict"; + module2.exports = require_main(); + } + }); + require_messages2 = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/messages.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ProtocolNotificationType = exports2.ProtocolNotificationType0 = exports2.ProtocolRequestType = exports2.ProtocolRequestType0 = exports2.RegistrationType = exports2.MessageDirection = void 0; + var vscode_jsonrpc_1 = require_main(); + var MessageDirection; + (function(MessageDirection2) { + MessageDirection2["clientToServer"] = "clientToServer"; + MessageDirection2["serverToClient"] = "serverToClient"; + MessageDirection2["both"] = "both"; + })(MessageDirection || (exports2.MessageDirection = MessageDirection = {})); + var RegistrationType = class { + static { + __name(this, "RegistrationType"); + } + static { + __name2(this, "RegistrationType"); + } + constructor(method) { + this.method = method; + } + }; + exports2.RegistrationType = RegistrationType; + var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 { + static { + __name(this, "ProtocolRequestType0"); + } + static { + __name2(this, "ProtocolRequestType0"); + } + constructor(method) { + super(method); + } + }; + exports2.ProtocolRequestType0 = ProtocolRequestType0; + var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType { + static { + __name(this, "ProtocolRequestType"); + } + static { + __name2(this, "ProtocolRequestType"); + } + constructor(method) { + super(method, vscode_jsonrpc_1.ParameterStructures.byName); + } + }; + exports2.ProtocolRequestType = ProtocolRequestType; + var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 { + static { + __name(this, "ProtocolNotificationType0"); + } + static { + __name2(this, "ProtocolNotificationType0"); + } + constructor(method) { + super(method); + } + }; + exports2.ProtocolNotificationType0 = ProtocolNotificationType0; + var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType { + static { + __name(this, "ProtocolNotificationType"); + } + static { + __name2(this, "ProtocolNotificationType"); + } + constructor(method) { + super(method, vscode_jsonrpc_1.ParameterStructures.byName); + } + }; + exports2.ProtocolNotificationType = ProtocolNotificationType; + } + }); + require_is2 = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.objectLiteral = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0; + function boolean(value2) { + return value2 === true || value2 === false; + } + __name(boolean, "boolean"); + __name2(boolean, "boolean"); + exports2.boolean = boolean; + function string3(value2) { + return typeof value2 === "string" || value2 instanceof String; + } + __name(string3, "string"); + __name2(string3, "string"); + exports2.string = string3; + function number7(value2) { + return typeof value2 === "number" || value2 instanceof Number; + } + __name(number7, "number"); + __name2(number7, "number"); + exports2.number = number7; + function error3(value2) { + return value2 instanceof Error; + } + __name(error3, "error"); + __name2(error3, "error"); + exports2.error = error3; + function func(value2) { + return typeof value2 === "function"; + } + __name(func, "func"); + __name2(func, "func"); + exports2.func = func; + function array4(value2) { + return Array.isArray(value2); + } + __name(array4, "array"); + __name2(array4, "array"); + exports2.array = array4; + function stringArray(value2) { + return array4(value2) && value2.every((elem) => string3(elem)); + } + __name(stringArray, "stringArray"); + __name2(stringArray, "stringArray"); + exports2.stringArray = stringArray; + function typedArray(value2, check) { + return Array.isArray(value2) && value2.every(check); + } + __name(typedArray, "typedArray"); + __name2(typedArray, "typedArray"); + exports2.typedArray = typedArray; + function objectLiteral(value2) { + return value2 !== null && typeof value2 === "object"; + } + __name(objectLiteral, "objectLiteral"); + __name2(objectLiteral, "objectLiteral"); + exports2.objectLiteral = objectLiteral; + } + }); + require_protocol_implementation = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ImplementationRequest = void 0; + var messages_1 = require_messages2(); + var ImplementationRequest; + (function(ImplementationRequest2) { + ImplementationRequest2.method = "textDocument/implementation"; + ImplementationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method); + })(ImplementationRequest || (exports2.ImplementationRequest = ImplementationRequest = {})); + } + }); + require_protocol_typeDefinition = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeDefinitionRequest = void 0; + var messages_1 = require_messages2(); + var TypeDefinitionRequest; + (function(TypeDefinitionRequest2) { + TypeDefinitionRequest2.method = "textDocument/typeDefinition"; + TypeDefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method); + })(TypeDefinitionRequest || (exports2.TypeDefinitionRequest = TypeDefinitionRequest = {})); + } + }); + require_protocol_workspaceFolder = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = void 0; + var messages_1 = require_messages2(); + var WorkspaceFoldersRequest; + (function(WorkspaceFoldersRequest2) { + WorkspaceFoldersRequest2.method = "workspace/workspaceFolders"; + WorkspaceFoldersRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0(WorkspaceFoldersRequest2.method); + })(WorkspaceFoldersRequest || (exports2.WorkspaceFoldersRequest = WorkspaceFoldersRequest = {})); + var DidChangeWorkspaceFoldersNotification; + (function(DidChangeWorkspaceFoldersNotification2) { + DidChangeWorkspaceFoldersNotification2.method = "workspace/didChangeWorkspaceFolders"; + DidChangeWorkspaceFoldersNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWorkspaceFoldersNotification2.method); + })(DidChangeWorkspaceFoldersNotification || (exports2.DidChangeWorkspaceFoldersNotification = DidChangeWorkspaceFoldersNotification = {})); + } + }); + require_protocol_configuration = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ConfigurationRequest = void 0; + var messages_1 = require_messages2(); + var ConfigurationRequest; + (function(ConfigurationRequest2) { + ConfigurationRequest2.method = "workspace/configuration"; + ConfigurationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + ConfigurationRequest2.type = new messages_1.ProtocolRequestType(ConfigurationRequest2.method); + })(ConfigurationRequest || (exports2.ConfigurationRequest = ConfigurationRequest = {})); + } + }); + require_protocol_colorProvider = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ColorPresentationRequest = exports2.DocumentColorRequest = void 0; + var messages_1 = require_messages2(); + var DocumentColorRequest; + (function(DocumentColorRequest2) { + DocumentColorRequest2.method = "textDocument/documentColor"; + DocumentColorRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method); + })(DocumentColorRequest || (exports2.DocumentColorRequest = DocumentColorRequest = {})); + var ColorPresentationRequest; + (function(ColorPresentationRequest2) { + ColorPresentationRequest2.method = "textDocument/colorPresentation"; + ColorPresentationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + ColorPresentationRequest2.type = new messages_1.ProtocolRequestType(ColorPresentationRequest2.method); + })(ColorPresentationRequest || (exports2.ColorPresentationRequest = ColorPresentationRequest = {})); + } + }); + require_protocol_foldingRange = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FoldingRangeRefreshRequest = exports2.FoldingRangeRequest = void 0; + var messages_1 = require_messages2(); + var FoldingRangeRequest; + (function(FoldingRangeRequest2) { + FoldingRangeRequest2.method = "textDocument/foldingRange"; + FoldingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method); + })(FoldingRangeRequest || (exports2.FoldingRangeRequest = FoldingRangeRequest = {})); + var FoldingRangeRefreshRequest; + (function(FoldingRangeRefreshRequest2) { + FoldingRangeRefreshRequest2.method = `workspace/foldingRange/refresh`; + FoldingRangeRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + FoldingRangeRefreshRequest2.type = new messages_1.ProtocolRequestType0(FoldingRangeRefreshRequest2.method); + })(FoldingRangeRefreshRequest || (exports2.FoldingRangeRefreshRequest = FoldingRangeRefreshRequest = {})); + } + }); + require_protocol_declaration = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DeclarationRequest = void 0; + var messages_1 = require_messages2(); + var DeclarationRequest; + (function(DeclarationRequest2) { + DeclarationRequest2.method = "textDocument/declaration"; + DeclarationRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method); + })(DeclarationRequest || (exports2.DeclarationRequest = DeclarationRequest = {})); + } + }); + require_protocol_selectionRange = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SelectionRangeRequest = void 0; + var messages_1 = require_messages2(); + var SelectionRangeRequest; + (function(SelectionRangeRequest2) { + SelectionRangeRequest2.method = "textDocument/selectionRange"; + SelectionRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method); + })(SelectionRangeRequest || (exports2.SelectionRangeRequest = SelectionRangeRequest = {})); + } + }); + require_protocol_progress = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = void 0; + var vscode_jsonrpc_1 = require_main(); + var messages_1 = require_messages2(); + var WorkDoneProgress; + (function(WorkDoneProgress2) { + WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType(); + function is2(value2) { + return value2 === WorkDoneProgress2.type; + } + __name(is2, "is"); + __name2(is2, "is"); + WorkDoneProgress2.is = is2; + })(WorkDoneProgress || (exports2.WorkDoneProgress = WorkDoneProgress = {})); + var WorkDoneProgressCreateRequest; + (function(WorkDoneProgressCreateRequest2) { + WorkDoneProgressCreateRequest2.method = "window/workDoneProgress/create"; + WorkDoneProgressCreateRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType(WorkDoneProgressCreateRequest2.method); + })(WorkDoneProgressCreateRequest || (exports2.WorkDoneProgressCreateRequest = WorkDoneProgressCreateRequest = {})); + var WorkDoneProgressCancelNotification; + (function(WorkDoneProgressCancelNotification2) { + WorkDoneProgressCancelNotification2.method = "window/workDoneProgress/cancel"; + WorkDoneProgressCancelNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType(WorkDoneProgressCancelNotification2.method); + })(WorkDoneProgressCancelNotification || (exports2.WorkDoneProgressCancelNotification = WorkDoneProgressCancelNotification = {})); + } + }); + require_protocol_callHierarchy = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.CallHierarchyPrepareRequest = void 0; + var messages_1 = require_messages2(); + var CallHierarchyPrepareRequest; + (function(CallHierarchyPrepareRequest2) { + CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy"; + CallHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method); + })(CallHierarchyPrepareRequest || (exports2.CallHierarchyPrepareRequest = CallHierarchyPrepareRequest = {})); + var CallHierarchyIncomingCallsRequest; + (function(CallHierarchyIncomingCallsRequest2) { + CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls"; + CallHierarchyIncomingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method); + })(CallHierarchyIncomingCallsRequest || (exports2.CallHierarchyIncomingCallsRequest = CallHierarchyIncomingCallsRequest = {})); + var CallHierarchyOutgoingCallsRequest; + (function(CallHierarchyOutgoingCallsRequest2) { + CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls"; + CallHierarchyOutgoingCallsRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method); + })(CallHierarchyOutgoingCallsRequest || (exports2.CallHierarchyOutgoingCallsRequest = CallHierarchyOutgoingCallsRequest = {})); + } + }); + require_protocol_semanticTokens = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.SemanticTokensRegistrationType = exports2.TokenFormat = void 0; + var messages_1 = require_messages2(); + var TokenFormat; + (function(TokenFormat2) { + TokenFormat2.Relative = "relative"; + })(TokenFormat || (exports2.TokenFormat = TokenFormat = {})); + var SemanticTokensRegistrationType; + (function(SemanticTokensRegistrationType2) { + SemanticTokensRegistrationType2.method = "textDocument/semanticTokens"; + SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method); + })(SemanticTokensRegistrationType || (exports2.SemanticTokensRegistrationType = SemanticTokensRegistrationType = {})); + var SemanticTokensRequest; + (function(SemanticTokensRequest2) { + SemanticTokensRequest2.method = "textDocument/semanticTokens/full"; + SemanticTokensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method); + SemanticTokensRequest2.registrationMethod = SemanticTokensRegistrationType.method; + })(SemanticTokensRequest || (exports2.SemanticTokensRequest = SemanticTokensRequest = {})); + var SemanticTokensDeltaRequest; + (function(SemanticTokensDeltaRequest2) { + SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta"; + SemanticTokensDeltaRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method); + SemanticTokensDeltaRequest2.registrationMethod = SemanticTokensRegistrationType.method; + })(SemanticTokensDeltaRequest || (exports2.SemanticTokensDeltaRequest = SemanticTokensDeltaRequest = {})); + var SemanticTokensRangeRequest; + (function(SemanticTokensRangeRequest2) { + SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range"; + SemanticTokensRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method); + SemanticTokensRangeRequest2.registrationMethod = SemanticTokensRegistrationType.method; + })(SemanticTokensRangeRequest || (exports2.SemanticTokensRangeRequest = SemanticTokensRangeRequest = {})); + var SemanticTokensRefreshRequest; + (function(SemanticTokensRefreshRequest2) { + SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`; + SemanticTokensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method); + })(SemanticTokensRefreshRequest || (exports2.SemanticTokensRefreshRequest = SemanticTokensRefreshRequest = {})); + } + }); + require_protocol_showDocument = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ShowDocumentRequest = void 0; + var messages_1 = require_messages2(); + var ShowDocumentRequest; + (function(ShowDocumentRequest2) { + ShowDocumentRequest2.method = "window/showDocument"; + ShowDocumentRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method); + })(ShowDocumentRequest || (exports2.ShowDocumentRequest = ShowDocumentRequest = {})); + } + }); + require_protocol_linkedEditingRange = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.LinkedEditingRangeRequest = void 0; + var messages_1 = require_messages2(); + var LinkedEditingRangeRequest; + (function(LinkedEditingRangeRequest2) { + LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange"; + LinkedEditingRangeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method); + })(LinkedEditingRangeRequest || (exports2.LinkedEditingRangeRequest = LinkedEditingRangeRequest = {})); + } + }); + require_protocol_fileOperations = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.DidRenameFilesNotification = exports2.WillRenameFilesRequest = exports2.DidCreateFilesNotification = exports2.WillCreateFilesRequest = exports2.FileOperationPatternKind = void 0; + var messages_1 = require_messages2(); + var FileOperationPatternKind; + (function(FileOperationPatternKind2) { + FileOperationPatternKind2.file = "file"; + FileOperationPatternKind2.folder = "folder"; + })(FileOperationPatternKind || (exports2.FileOperationPatternKind = FileOperationPatternKind = {})); + var WillCreateFilesRequest; + (function(WillCreateFilesRequest2) { + WillCreateFilesRequest2.method = "workspace/willCreateFiles"; + WillCreateFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method); + })(WillCreateFilesRequest || (exports2.WillCreateFilesRequest = WillCreateFilesRequest = {})); + var DidCreateFilesNotification; + (function(DidCreateFilesNotification2) { + DidCreateFilesNotification2.method = "workspace/didCreateFiles"; + DidCreateFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method); + })(DidCreateFilesNotification || (exports2.DidCreateFilesNotification = DidCreateFilesNotification = {})); + var WillRenameFilesRequest; + (function(WillRenameFilesRequest2) { + WillRenameFilesRequest2.method = "workspace/willRenameFiles"; + WillRenameFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method); + })(WillRenameFilesRequest || (exports2.WillRenameFilesRequest = WillRenameFilesRequest = {})); + var DidRenameFilesNotification; + (function(DidRenameFilesNotification2) { + DidRenameFilesNotification2.method = "workspace/didRenameFiles"; + DidRenameFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method); + })(DidRenameFilesNotification || (exports2.DidRenameFilesNotification = DidRenameFilesNotification = {})); + var DidDeleteFilesNotification; + (function(DidDeleteFilesNotification2) { + DidDeleteFilesNotification2.method = "workspace/didDeleteFiles"; + DidDeleteFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method); + })(DidDeleteFilesNotification || (exports2.DidDeleteFilesNotification = DidDeleteFilesNotification = {})); + var WillDeleteFilesRequest; + (function(WillDeleteFilesRequest2) { + WillDeleteFilesRequest2.method = "workspace/willDeleteFiles"; + WillDeleteFilesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method); + })(WillDeleteFilesRequest || (exports2.WillDeleteFilesRequest = WillDeleteFilesRequest = {})); + } + }); + require_protocol_moniker = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = void 0; + var messages_1 = require_messages2(); + var UniquenessLevel; + (function(UniquenessLevel2) { + UniquenessLevel2.document = "document"; + UniquenessLevel2.project = "project"; + UniquenessLevel2.group = "group"; + UniquenessLevel2.scheme = "scheme"; + UniquenessLevel2.global = "global"; + })(UniquenessLevel || (exports2.UniquenessLevel = UniquenessLevel = {})); + var MonikerKind; + (function(MonikerKind2) { + MonikerKind2.$import = "import"; + MonikerKind2.$export = "export"; + MonikerKind2.local = "local"; + })(MonikerKind || (exports2.MonikerKind = MonikerKind = {})); + var MonikerRequest; + (function(MonikerRequest2) { + MonikerRequest2.method = "textDocument/moniker"; + MonikerRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method); + })(MonikerRequest || (exports2.MonikerRequest = MonikerRequest = {})); + } + }); + require_protocol_typeHierarchy = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeHierarchySubtypesRequest = exports2.TypeHierarchySupertypesRequest = exports2.TypeHierarchyPrepareRequest = void 0; + var messages_1 = require_messages2(); + var TypeHierarchyPrepareRequest; + (function(TypeHierarchyPrepareRequest2) { + TypeHierarchyPrepareRequest2.method = "textDocument/prepareTypeHierarchy"; + TypeHierarchyPrepareRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + TypeHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchyPrepareRequest2.method); + })(TypeHierarchyPrepareRequest || (exports2.TypeHierarchyPrepareRequest = TypeHierarchyPrepareRequest = {})); + var TypeHierarchySupertypesRequest; + (function(TypeHierarchySupertypesRequest2) { + TypeHierarchySupertypesRequest2.method = "typeHierarchy/supertypes"; + TypeHierarchySupertypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + TypeHierarchySupertypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySupertypesRequest2.method); + })(TypeHierarchySupertypesRequest || (exports2.TypeHierarchySupertypesRequest = TypeHierarchySupertypesRequest = {})); + var TypeHierarchySubtypesRequest; + (function(TypeHierarchySubtypesRequest2) { + TypeHierarchySubtypesRequest2.method = "typeHierarchy/subtypes"; + TypeHierarchySubtypesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + TypeHierarchySubtypesRequest2.type = new messages_1.ProtocolRequestType(TypeHierarchySubtypesRequest2.method); + })(TypeHierarchySubtypesRequest || (exports2.TypeHierarchySubtypesRequest = TypeHierarchySubtypesRequest = {})); + } + }); + require_protocol_inlineValue = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.InlineValueRefreshRequest = exports2.InlineValueRequest = void 0; + var messages_1 = require_messages2(); + var InlineValueRequest; + (function(InlineValueRequest2) { + InlineValueRequest2.method = "textDocument/inlineValue"; + InlineValueRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + InlineValueRequest2.type = new messages_1.ProtocolRequestType(InlineValueRequest2.method); + })(InlineValueRequest || (exports2.InlineValueRequest = InlineValueRequest = {})); + var InlineValueRefreshRequest; + (function(InlineValueRefreshRequest2) { + InlineValueRefreshRequest2.method = `workspace/inlineValue/refresh`; + InlineValueRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + InlineValueRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlineValueRefreshRequest2.method); + })(InlineValueRefreshRequest || (exports2.InlineValueRefreshRequest = InlineValueRefreshRequest = {})); + } + }); + require_protocol_inlayHint = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.InlayHintRefreshRequest = exports2.InlayHintResolveRequest = exports2.InlayHintRequest = void 0; + var messages_1 = require_messages2(); + var InlayHintRequest; + (function(InlayHintRequest2) { + InlayHintRequest2.method = "textDocument/inlayHint"; + InlayHintRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + InlayHintRequest2.type = new messages_1.ProtocolRequestType(InlayHintRequest2.method); + })(InlayHintRequest || (exports2.InlayHintRequest = InlayHintRequest = {})); + var InlayHintResolveRequest; + (function(InlayHintResolveRequest2) { + InlayHintResolveRequest2.method = "inlayHint/resolve"; + InlayHintResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + InlayHintResolveRequest2.type = new messages_1.ProtocolRequestType(InlayHintResolveRequest2.method); + })(InlayHintResolveRequest || (exports2.InlayHintResolveRequest = InlayHintResolveRequest = {})); + var InlayHintRefreshRequest; + (function(InlayHintRefreshRequest2) { + InlayHintRefreshRequest2.method = `workspace/inlayHint/refresh`; + InlayHintRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + InlayHintRefreshRequest2.type = new messages_1.ProtocolRequestType0(InlayHintRefreshRequest2.method); + })(InlayHintRefreshRequest || (exports2.InlayHintRefreshRequest = InlayHintRefreshRequest = {})); + } + }); + require_protocol_diagnostic = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DiagnosticRefreshRequest = exports2.WorkspaceDiagnosticRequest = exports2.DocumentDiagnosticRequest = exports2.DocumentDiagnosticReportKind = exports2.DiagnosticServerCancellationData = void 0; + var vscode_jsonrpc_1 = require_main(); + var Is2 = require_is2(); + var messages_1 = require_messages2(); + var DiagnosticServerCancellationData; + (function(DiagnosticServerCancellationData2) { + function is2(value2) { + const candidate = value2; + return candidate && Is2.boolean(candidate.retriggerRequest); + } + __name(is2, "is"); + __name2(is2, "is"); + DiagnosticServerCancellationData2.is = is2; + })(DiagnosticServerCancellationData || (exports2.DiagnosticServerCancellationData = DiagnosticServerCancellationData = {})); + var DocumentDiagnosticReportKind; + (function(DocumentDiagnosticReportKind2) { + DocumentDiagnosticReportKind2.Full = "full"; + DocumentDiagnosticReportKind2.Unchanged = "unchanged"; + })(DocumentDiagnosticReportKind || (exports2.DocumentDiagnosticReportKind = DocumentDiagnosticReportKind = {})); + var DocumentDiagnosticRequest; + (function(DocumentDiagnosticRequest2) { + DocumentDiagnosticRequest2.method = "textDocument/diagnostic"; + DocumentDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentDiagnosticRequest2.type = new messages_1.ProtocolRequestType(DocumentDiagnosticRequest2.method); + DocumentDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); + })(DocumentDiagnosticRequest || (exports2.DocumentDiagnosticRequest = DocumentDiagnosticRequest = {})); + var WorkspaceDiagnosticRequest; + (function(WorkspaceDiagnosticRequest2) { + WorkspaceDiagnosticRequest2.method = "workspace/diagnostic"; + WorkspaceDiagnosticRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WorkspaceDiagnosticRequest2.type = new messages_1.ProtocolRequestType(WorkspaceDiagnosticRequest2.method); + WorkspaceDiagnosticRequest2.partialResult = new vscode_jsonrpc_1.ProgressType(); + })(WorkspaceDiagnosticRequest || (exports2.WorkspaceDiagnosticRequest = WorkspaceDiagnosticRequest = {})); + var DiagnosticRefreshRequest; + (function(DiagnosticRefreshRequest2) { + DiagnosticRefreshRequest2.method = `workspace/diagnostic/refresh`; + DiagnosticRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + DiagnosticRefreshRequest2.type = new messages_1.ProtocolRequestType0(DiagnosticRefreshRequest2.method); + })(DiagnosticRefreshRequest || (exports2.DiagnosticRefreshRequest = DiagnosticRefreshRequest = {})); + } + }); + require_protocol_notebook = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DidCloseNotebookDocumentNotification = exports2.DidSaveNotebookDocumentNotification = exports2.DidChangeNotebookDocumentNotification = exports2.NotebookCellArrayChange = exports2.DidOpenNotebookDocumentNotification = exports2.NotebookDocumentSyncRegistrationType = exports2.NotebookDocument = exports2.NotebookCell = exports2.ExecutionSummary = exports2.NotebookCellKind = void 0; + var vscode_languageserver_types_1 = (init_main(), __toCommonJS2(main_exports)); + var Is2 = require_is2(); + var messages_1 = require_messages2(); + var NotebookCellKind; + (function(NotebookCellKind2) { + NotebookCellKind2.Markup = 1; + NotebookCellKind2.Code = 2; + function is2(value2) { + return value2 === 1 || value2 === 2; + } + __name(is2, "is"); + __name2(is2, "is"); + NotebookCellKind2.is = is2; + })(NotebookCellKind || (exports2.NotebookCellKind = NotebookCellKind = {})); + var ExecutionSummary; + (function(ExecutionSummary2) { + function create4(executionOrder, success) { + const result = { executionOrder }; + if (success === true || success === false) { + result.success = success; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + ExecutionSummary2.create = create4; + function is2(value2) { + const candidate = value2; + return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.executionOrder) && (candidate.success === void 0 || Is2.boolean(candidate.success)); + } + __name(is2, "is"); + __name2(is2, "is"); + ExecutionSummary2.is = is2; + function equals(one4, other) { + if (one4 === other) { + return true; + } + if (one4 === null || one4 === void 0 || other === null || other === void 0) { + return false; + } + return one4.executionOrder === other.executionOrder && one4.success === other.success; + } + __name(equals, "equals"); + __name2(equals, "equals"); + ExecutionSummary2.equals = equals; + })(ExecutionSummary || (exports2.ExecutionSummary = ExecutionSummary = {})); + var NotebookCell; + (function(NotebookCell2) { + function create4(kind, document2) { + return { kind, document: document2 }; + } + __name(create4, "create"); + __name2(create4, "create"); + NotebookCell2.create = create4; + function is2(value2) { + const candidate = value2; + return Is2.objectLiteral(candidate) && NotebookCellKind.is(candidate.kind) && vscode_languageserver_types_1.DocumentUri.is(candidate.document) && (candidate.metadata === void 0 || Is2.objectLiteral(candidate.metadata)); + } + __name(is2, "is"); + __name2(is2, "is"); + NotebookCell2.is = is2; + function diff2(one4, two) { + const result = /* @__PURE__ */ new Set(); + if (one4.document !== two.document) { + result.add("document"); + } + if (one4.kind !== two.kind) { + result.add("kind"); + } + if (one4.executionSummary !== two.executionSummary) { + result.add("executionSummary"); + } + if ((one4.metadata !== void 0 || two.metadata !== void 0) && !equalsMetadata(one4.metadata, two.metadata)) { + result.add("metadata"); + } + if ((one4.executionSummary !== void 0 || two.executionSummary !== void 0) && !ExecutionSummary.equals(one4.executionSummary, two.executionSummary)) { + result.add("executionSummary"); + } + return result; + } + __name(diff2, "diff"); + __name2(diff2, "diff"); + NotebookCell2.diff = diff2; + function equalsMetadata(one4, other) { + if (one4 === other) { + return true; + } + if (one4 === null || one4 === void 0 || other === null || other === void 0) { + return false; + } + if (typeof one4 !== typeof other) { + return false; + } + if (typeof one4 !== "object") { + return false; + } + const oneArray = Array.isArray(one4); + const otherArray = Array.isArray(other); + if (oneArray !== otherArray) { + return false; + } + if (oneArray && otherArray) { + if (one4.length !== other.length) { + return false; + } + for (let i2 = 0; i2 < one4.length; i2++) { + if (!equalsMetadata(one4[i2], other[i2])) { + return false; + } + } + } + if (Is2.objectLiteral(one4) && Is2.objectLiteral(other)) { + const oneKeys = Object.keys(one4); + const otherKeys = Object.keys(other); + if (oneKeys.length !== otherKeys.length) { + return false; + } + oneKeys.sort(); + otherKeys.sort(); + if (!equalsMetadata(oneKeys, otherKeys)) { + return false; + } + for (let i2 = 0; i2 < oneKeys.length; i2++) { + const prop = oneKeys[i2]; + if (!equalsMetadata(one4[prop], other[prop])) { + return false; + } + } + } + return true; + } + __name(equalsMetadata, "equalsMetadata"); + __name2(equalsMetadata, "equalsMetadata"); + })(NotebookCell || (exports2.NotebookCell = NotebookCell = {})); + var NotebookDocument; + (function(NotebookDocument2) { + function create4(uri, notebookType, version3, cells) { + return { uri, notebookType, version: version3, cells }; + } + __name(create4, "create"); + __name2(create4, "create"); + NotebookDocument2.create = create4; + function is2(value2) { + const candidate = value2; + return Is2.objectLiteral(candidate) && Is2.string(candidate.uri) && vscode_languageserver_types_1.integer.is(candidate.version) && Is2.typedArray(candidate.cells, NotebookCell.is); + } + __name(is2, "is"); + __name2(is2, "is"); + NotebookDocument2.is = is2; + })(NotebookDocument || (exports2.NotebookDocument = NotebookDocument = {})); + var NotebookDocumentSyncRegistrationType; + (function(NotebookDocumentSyncRegistrationType2) { + NotebookDocumentSyncRegistrationType2.method = "notebookDocument/sync"; + NotebookDocumentSyncRegistrationType2.messageDirection = messages_1.MessageDirection.clientToServer; + NotebookDocumentSyncRegistrationType2.type = new messages_1.RegistrationType(NotebookDocumentSyncRegistrationType2.method); + })(NotebookDocumentSyncRegistrationType || (exports2.NotebookDocumentSyncRegistrationType = NotebookDocumentSyncRegistrationType = {})); + var DidOpenNotebookDocumentNotification; + (function(DidOpenNotebookDocumentNotification2) { + DidOpenNotebookDocumentNotification2.method = "notebookDocument/didOpen"; + DidOpenNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidOpenNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenNotebookDocumentNotification2.method); + DidOpenNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; + })(DidOpenNotebookDocumentNotification || (exports2.DidOpenNotebookDocumentNotification = DidOpenNotebookDocumentNotification = {})); + var NotebookCellArrayChange; + (function(NotebookCellArrayChange2) { + function is2(value2) { + const candidate = value2; + return Is2.objectLiteral(candidate) && vscode_languageserver_types_1.uinteger.is(candidate.start) && vscode_languageserver_types_1.uinteger.is(candidate.deleteCount) && (candidate.cells === void 0 || Is2.typedArray(candidate.cells, NotebookCell.is)); + } + __name(is2, "is"); + __name2(is2, "is"); + NotebookCellArrayChange2.is = is2; + function create4(start3, deleteCount, cells) { + const result = { start: start3, deleteCount }; + if (cells !== void 0) { + result.cells = cells; + } + return result; + } + __name(create4, "create"); + __name2(create4, "create"); + NotebookCellArrayChange2.create = create4; + })(NotebookCellArrayChange || (exports2.NotebookCellArrayChange = NotebookCellArrayChange = {})); + var DidChangeNotebookDocumentNotification; + (function(DidChangeNotebookDocumentNotification2) { + DidChangeNotebookDocumentNotification2.method = "notebookDocument/didChange"; + DidChangeNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeNotebookDocumentNotification2.method); + DidChangeNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; + })(DidChangeNotebookDocumentNotification || (exports2.DidChangeNotebookDocumentNotification = DidChangeNotebookDocumentNotification = {})); + var DidSaveNotebookDocumentNotification; + (function(DidSaveNotebookDocumentNotification2) { + DidSaveNotebookDocumentNotification2.method = "notebookDocument/didSave"; + DidSaveNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidSaveNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveNotebookDocumentNotification2.method); + DidSaveNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; + })(DidSaveNotebookDocumentNotification || (exports2.DidSaveNotebookDocumentNotification = DidSaveNotebookDocumentNotification = {})); + var DidCloseNotebookDocumentNotification; + (function(DidCloseNotebookDocumentNotification2) { + DidCloseNotebookDocumentNotification2.method = "notebookDocument/didClose"; + DidCloseNotebookDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidCloseNotebookDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseNotebookDocumentNotification2.method); + DidCloseNotebookDocumentNotification2.registrationMethod = NotebookDocumentSyncRegistrationType.method; + })(DidCloseNotebookDocumentNotification || (exports2.DidCloseNotebookDocumentNotification = DidCloseNotebookDocumentNotification = {})); + } + }); + require_protocol_inlineCompletion = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.InlineCompletionRequest = void 0; + var messages_1 = require_messages2(); + var InlineCompletionRequest; + (function(InlineCompletionRequest2) { + InlineCompletionRequest2.method = "textDocument/inlineCompletion"; + InlineCompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + InlineCompletionRequest2.type = new messages_1.ProtocolRequestType(InlineCompletionRequest2.method); + })(InlineCompletionRequest || (exports2.InlineCompletionRequest = InlineCompletionRequest = {})); + } + }); + require_protocol = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WorkspaceSymbolRequest = exports2.CodeActionResolveRequest = exports2.CodeActionRequest = exports2.DocumentSymbolRequest = exports2.DocumentHighlightRequest = exports2.ReferencesRequest = exports2.DefinitionRequest = exports2.SignatureHelpRequest = exports2.SignatureHelpTriggerKind = exports2.HoverRequest = exports2.CompletionResolveRequest = exports2.CompletionRequest = exports2.CompletionTriggerKind = exports2.PublishDiagnosticsNotification = exports2.WatchKind = exports2.RelativePattern = exports2.FileChangeType = exports2.DidChangeWatchedFilesNotification = exports2.WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentNotification = exports2.TextDocumentSaveReason = exports2.DidSaveTextDocumentNotification = exports2.DidCloseTextDocumentNotification = exports2.DidChangeTextDocumentNotification = exports2.TextDocumentContentChangeEvent = exports2.DidOpenTextDocumentNotification = exports2.TextDocumentSyncKind = exports2.TelemetryEventNotification = exports2.LogMessageNotification = exports2.ShowMessageRequest = exports2.ShowMessageNotification = exports2.MessageType = exports2.DidChangeConfigurationNotification = exports2.ExitNotification = exports2.ShutdownRequest = exports2.InitializedNotification = exports2.InitializeErrorCodes = exports2.InitializeRequest = exports2.WorkDoneProgressOptions = exports2.TextDocumentRegistrationOptions = exports2.StaticRegistrationOptions = exports2.PositionEncodingKind = exports2.FailureHandlingKind = exports2.ResourceOperationKind = exports2.UnregistrationRequest = exports2.RegistrationRequest = exports2.DocumentSelector = exports2.NotebookCellTextDocumentFilter = exports2.NotebookDocumentFilter = exports2.TextDocumentFilter = void 0; + exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.WillRenameFilesRequest = exports2.DidRenameFilesNotification = exports2.WillCreateFilesRequest = exports2.DidCreateFilesNotification = exports2.FileOperationPatternKind = exports2.LinkedEditingRangeRequest = exports2.ShowDocumentRequest = exports2.SemanticTokensRegistrationType = exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.TokenFormat = exports2.CallHierarchyPrepareRequest = exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = exports2.SelectionRangeRequest = exports2.DeclarationRequest = exports2.FoldingRangeRefreshRequest = exports2.FoldingRangeRequest = exports2.ColorPresentationRequest = exports2.DocumentColorRequest = exports2.ConfigurationRequest = exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = exports2.TypeDefinitionRequest = exports2.ImplementationRequest = exports2.ApplyWorkspaceEditRequest = exports2.ExecuteCommandRequest = exports2.PrepareRenameRequest = exports2.RenameRequest = exports2.PrepareSupportDefaultBehavior = exports2.DocumentOnTypeFormattingRequest = exports2.DocumentRangesFormattingRequest = exports2.DocumentRangeFormattingRequest = exports2.DocumentFormattingRequest = exports2.DocumentLinkResolveRequest = exports2.DocumentLinkRequest = exports2.CodeLensRefreshRequest = exports2.CodeLensResolveRequest = exports2.CodeLensRequest = exports2.WorkspaceSymbolResolveRequest = void 0; + exports2.InlineCompletionRequest = exports2.DidCloseNotebookDocumentNotification = exports2.DidSaveNotebookDocumentNotification = exports2.DidChangeNotebookDocumentNotification = exports2.NotebookCellArrayChange = exports2.DidOpenNotebookDocumentNotification = exports2.NotebookDocumentSyncRegistrationType = exports2.NotebookDocument = exports2.NotebookCell = exports2.ExecutionSummary = exports2.NotebookCellKind = exports2.DiagnosticRefreshRequest = exports2.WorkspaceDiagnosticRequest = exports2.DocumentDiagnosticRequest = exports2.DocumentDiagnosticReportKind = exports2.DiagnosticServerCancellationData = exports2.InlayHintRefreshRequest = exports2.InlayHintResolveRequest = exports2.InlayHintRequest = exports2.InlineValueRefreshRequest = exports2.InlineValueRequest = exports2.TypeHierarchySupertypesRequest = exports2.TypeHierarchySubtypesRequest = exports2.TypeHierarchyPrepareRequest = void 0; + var messages_1 = require_messages2(); + var vscode_languageserver_types_1 = (init_main(), __toCommonJS2(main_exports)); + var Is2 = require_is2(); + var protocol_implementation_1 = require_protocol_implementation(); + Object.defineProperty(exports2, "ImplementationRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_implementation_1.ImplementationRequest; + }, "get") }); + var protocol_typeDefinition_1 = require_protocol_typeDefinition(); + Object.defineProperty(exports2, "TypeDefinitionRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_typeDefinition_1.TypeDefinitionRequest; + }, "get") }); + var protocol_workspaceFolder_1 = require_protocol_workspaceFolder(); + Object.defineProperty(exports2, "WorkspaceFoldersRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_workspaceFolder_1.WorkspaceFoldersRequest; + }, "get") }); + Object.defineProperty(exports2, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_workspaceFolder_1.DidChangeWorkspaceFoldersNotification; + }, "get") }); + var protocol_configuration_1 = require_protocol_configuration(); + Object.defineProperty(exports2, "ConfigurationRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_configuration_1.ConfigurationRequest; + }, "get") }); + var protocol_colorProvider_1 = require_protocol_colorProvider(); + Object.defineProperty(exports2, "DocumentColorRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_colorProvider_1.DocumentColorRequest; + }, "get") }); + Object.defineProperty(exports2, "ColorPresentationRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_colorProvider_1.ColorPresentationRequest; + }, "get") }); + var protocol_foldingRange_1 = require_protocol_foldingRange(); + Object.defineProperty(exports2, "FoldingRangeRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_foldingRange_1.FoldingRangeRequest; + }, "get") }); + Object.defineProperty(exports2, "FoldingRangeRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_foldingRange_1.FoldingRangeRefreshRequest; + }, "get") }); + var protocol_declaration_1 = require_protocol_declaration(); + Object.defineProperty(exports2, "DeclarationRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_declaration_1.DeclarationRequest; + }, "get") }); + var protocol_selectionRange_1 = require_protocol_selectionRange(); + Object.defineProperty(exports2, "SelectionRangeRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_selectionRange_1.SelectionRangeRequest; + }, "get") }); + var protocol_progress_1 = require_protocol_progress(); + Object.defineProperty(exports2, "WorkDoneProgress", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_progress_1.WorkDoneProgress; + }, "get") }); + Object.defineProperty(exports2, "WorkDoneProgressCreateRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_progress_1.WorkDoneProgressCreateRequest; + }, "get") }); + Object.defineProperty(exports2, "WorkDoneProgressCancelNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_progress_1.WorkDoneProgressCancelNotification; + }, "get") }); + var protocol_callHierarchy_1 = require_protocol_callHierarchy(); + Object.defineProperty(exports2, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; + }, "get") }); + Object.defineProperty(exports2, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; + }, "get") }); + Object.defineProperty(exports2, "CallHierarchyPrepareRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_callHierarchy_1.CallHierarchyPrepareRequest; + }, "get") }); + var protocol_semanticTokens_1 = require_protocol_semanticTokens(); + Object.defineProperty(exports2, "TokenFormat", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_semanticTokens_1.TokenFormat; + }, "get") }); + Object.defineProperty(exports2, "SemanticTokensRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_semanticTokens_1.SemanticTokensRequest; + }, "get") }); + Object.defineProperty(exports2, "SemanticTokensDeltaRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_semanticTokens_1.SemanticTokensDeltaRequest; + }, "get") }); + Object.defineProperty(exports2, "SemanticTokensRangeRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_semanticTokens_1.SemanticTokensRangeRequest; + }, "get") }); + Object.defineProperty(exports2, "SemanticTokensRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_semanticTokens_1.SemanticTokensRefreshRequest; + }, "get") }); + Object.defineProperty(exports2, "SemanticTokensRegistrationType", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_semanticTokens_1.SemanticTokensRegistrationType; + }, "get") }); + var protocol_showDocument_1 = require_protocol_showDocument(); + Object.defineProperty(exports2, "ShowDocumentRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_showDocument_1.ShowDocumentRequest; + }, "get") }); + var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange(); + Object.defineProperty(exports2, "LinkedEditingRangeRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; + }, "get") }); + var protocol_fileOperations_1 = require_protocol_fileOperations(); + Object.defineProperty(exports2, "FileOperationPatternKind", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_fileOperations_1.FileOperationPatternKind; + }, "get") }); + Object.defineProperty(exports2, "DidCreateFilesNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_fileOperations_1.DidCreateFilesNotification; + }, "get") }); + Object.defineProperty(exports2, "WillCreateFilesRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_fileOperations_1.WillCreateFilesRequest; + }, "get") }); + Object.defineProperty(exports2, "DidRenameFilesNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_fileOperations_1.DidRenameFilesNotification; + }, "get") }); + Object.defineProperty(exports2, "WillRenameFilesRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_fileOperations_1.WillRenameFilesRequest; + }, "get") }); + Object.defineProperty(exports2, "DidDeleteFilesNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_fileOperations_1.DidDeleteFilesNotification; + }, "get") }); + Object.defineProperty(exports2, "WillDeleteFilesRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_fileOperations_1.WillDeleteFilesRequest; + }, "get") }); + var protocol_moniker_1 = require_protocol_moniker(); + Object.defineProperty(exports2, "UniquenessLevel", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_moniker_1.UniquenessLevel; + }, "get") }); + Object.defineProperty(exports2, "MonikerKind", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_moniker_1.MonikerKind; + }, "get") }); + Object.defineProperty(exports2, "MonikerRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_moniker_1.MonikerRequest; + }, "get") }); + var protocol_typeHierarchy_1 = require_protocol_typeHierarchy(); + Object.defineProperty(exports2, "TypeHierarchyPrepareRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_typeHierarchy_1.TypeHierarchyPrepareRequest; + }, "get") }); + Object.defineProperty(exports2, "TypeHierarchySubtypesRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_typeHierarchy_1.TypeHierarchySubtypesRequest; + }, "get") }); + Object.defineProperty(exports2, "TypeHierarchySupertypesRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_typeHierarchy_1.TypeHierarchySupertypesRequest; + }, "get") }); + var protocol_inlineValue_1 = require_protocol_inlineValue(); + Object.defineProperty(exports2, "InlineValueRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_inlineValue_1.InlineValueRequest; + }, "get") }); + Object.defineProperty(exports2, "InlineValueRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_inlineValue_1.InlineValueRefreshRequest; + }, "get") }); + var protocol_inlayHint_1 = require_protocol_inlayHint(); + Object.defineProperty(exports2, "InlayHintRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_inlayHint_1.InlayHintRequest; + }, "get") }); + Object.defineProperty(exports2, "InlayHintResolveRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_inlayHint_1.InlayHintResolveRequest; + }, "get") }); + Object.defineProperty(exports2, "InlayHintRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_inlayHint_1.InlayHintRefreshRequest; + }, "get") }); + var protocol_diagnostic_1 = require_protocol_diagnostic(); + Object.defineProperty(exports2, "DiagnosticServerCancellationData", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_diagnostic_1.DiagnosticServerCancellationData; + }, "get") }); + Object.defineProperty(exports2, "DocumentDiagnosticReportKind", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_diagnostic_1.DocumentDiagnosticReportKind; + }, "get") }); + Object.defineProperty(exports2, "DocumentDiagnosticRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_diagnostic_1.DocumentDiagnosticRequest; + }, "get") }); + Object.defineProperty(exports2, "WorkspaceDiagnosticRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_diagnostic_1.WorkspaceDiagnosticRequest; + }, "get") }); + Object.defineProperty(exports2, "DiagnosticRefreshRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_diagnostic_1.DiagnosticRefreshRequest; + }, "get") }); + var protocol_notebook_1 = require_protocol_notebook(); + Object.defineProperty(exports2, "NotebookCellKind", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.NotebookCellKind; + }, "get") }); + Object.defineProperty(exports2, "ExecutionSummary", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.ExecutionSummary; + }, "get") }); + Object.defineProperty(exports2, "NotebookCell", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.NotebookCell; + }, "get") }); + Object.defineProperty(exports2, "NotebookDocument", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.NotebookDocument; + }, "get") }); + Object.defineProperty(exports2, "NotebookDocumentSyncRegistrationType", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.NotebookDocumentSyncRegistrationType; + }, "get") }); + Object.defineProperty(exports2, "DidOpenNotebookDocumentNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.DidOpenNotebookDocumentNotification; + }, "get") }); + Object.defineProperty(exports2, "NotebookCellArrayChange", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.NotebookCellArrayChange; + }, "get") }); + Object.defineProperty(exports2, "DidChangeNotebookDocumentNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.DidChangeNotebookDocumentNotification; + }, "get") }); + Object.defineProperty(exports2, "DidSaveNotebookDocumentNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.DidSaveNotebookDocumentNotification; + }, "get") }); + Object.defineProperty(exports2, "DidCloseNotebookDocumentNotification", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_notebook_1.DidCloseNotebookDocumentNotification; + }, "get") }); + var protocol_inlineCompletion_1 = require_protocol_inlineCompletion(); + Object.defineProperty(exports2, "InlineCompletionRequest", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return protocol_inlineCompletion_1.InlineCompletionRequest; + }, "get") }); + var TextDocumentFilter; + (function(TextDocumentFilter2) { + function is2(value2) { + const candidate = value2; + return Is2.string(candidate) || (Is2.string(candidate.language) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern)); + } + __name(is2, "is"); + __name2(is2, "is"); + TextDocumentFilter2.is = is2; + })(TextDocumentFilter || (exports2.TextDocumentFilter = TextDocumentFilter = {})); + var NotebookDocumentFilter; + (function(NotebookDocumentFilter2) { + function is2(value2) { + const candidate = value2; + return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebookType) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern)); + } + __name(is2, "is"); + __name2(is2, "is"); + NotebookDocumentFilter2.is = is2; + })(NotebookDocumentFilter || (exports2.NotebookDocumentFilter = NotebookDocumentFilter = {})); + var NotebookCellTextDocumentFilter; + (function(NotebookCellTextDocumentFilter2) { + function is2(value2) { + const candidate = value2; + return Is2.objectLiteral(candidate) && (Is2.string(candidate.notebook) || NotebookDocumentFilter.is(candidate.notebook)) && (candidate.language === void 0 || Is2.string(candidate.language)); + } + __name(is2, "is"); + __name2(is2, "is"); + NotebookCellTextDocumentFilter2.is = is2; + })(NotebookCellTextDocumentFilter || (exports2.NotebookCellTextDocumentFilter = NotebookCellTextDocumentFilter = {})); + var DocumentSelector; + (function(DocumentSelector2) { + function is2(value2) { + if (!Array.isArray(value2)) { + return false; + } + for (let elem of value2) { + if (!Is2.string(elem) && !TextDocumentFilter.is(elem) && !NotebookCellTextDocumentFilter.is(elem)) { + return false; + } + } + return true; + } + __name(is2, "is"); + __name2(is2, "is"); + DocumentSelector2.is = is2; + })(DocumentSelector || (exports2.DocumentSelector = DocumentSelector = {})); + var RegistrationRequest; + (function(RegistrationRequest2) { + RegistrationRequest2.method = "client/registerCapability"; + RegistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + RegistrationRequest2.type = new messages_1.ProtocolRequestType(RegistrationRequest2.method); + })(RegistrationRequest || (exports2.RegistrationRequest = RegistrationRequest = {})); + var UnregistrationRequest; + (function(UnregistrationRequest2) { + UnregistrationRequest2.method = "client/unregisterCapability"; + UnregistrationRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + UnregistrationRequest2.type = new messages_1.ProtocolRequestType(UnregistrationRequest2.method); + })(UnregistrationRequest || (exports2.UnregistrationRequest = UnregistrationRequest = {})); + var ResourceOperationKind; + (function(ResourceOperationKind2) { + ResourceOperationKind2.Create = "create"; + ResourceOperationKind2.Rename = "rename"; + ResourceOperationKind2.Delete = "delete"; + })(ResourceOperationKind || (exports2.ResourceOperationKind = ResourceOperationKind = {})); + var FailureHandlingKind; + (function(FailureHandlingKind2) { + FailureHandlingKind2.Abort = "abort"; + FailureHandlingKind2.Transactional = "transactional"; + FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional"; + FailureHandlingKind2.Undo = "undo"; + })(FailureHandlingKind || (exports2.FailureHandlingKind = FailureHandlingKind = {})); + var PositionEncodingKind; + (function(PositionEncodingKind2) { + PositionEncodingKind2.UTF8 = "utf-8"; + PositionEncodingKind2.UTF16 = "utf-16"; + PositionEncodingKind2.UTF32 = "utf-32"; + })(PositionEncodingKind || (exports2.PositionEncodingKind = PositionEncodingKind = {})); + var StaticRegistrationOptions; + (function(StaticRegistrationOptions2) { + function hasId(value2) { + const candidate = value2; + return candidate && Is2.string(candidate.id) && candidate.id.length > 0; + } + __name(hasId, "hasId"); + __name2(hasId, "hasId"); + StaticRegistrationOptions2.hasId = hasId; + })(StaticRegistrationOptions || (exports2.StaticRegistrationOptions = StaticRegistrationOptions = {})); + var TextDocumentRegistrationOptions; + (function(TextDocumentRegistrationOptions2) { + function is2(value2) { + const candidate = value2; + return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector)); + } + __name(is2, "is"); + __name2(is2, "is"); + TextDocumentRegistrationOptions2.is = is2; + })(TextDocumentRegistrationOptions || (exports2.TextDocumentRegistrationOptions = TextDocumentRegistrationOptions = {})); + var WorkDoneProgressOptions; + (function(WorkDoneProgressOptions2) { + function is2(value2) { + const candidate = value2; + return Is2.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is2.boolean(candidate.workDoneProgress)); + } + __name(is2, "is"); + __name2(is2, "is"); + WorkDoneProgressOptions2.is = is2; + function hasWorkDoneProgress(value2) { + const candidate = value2; + return candidate && Is2.boolean(candidate.workDoneProgress); + } + __name(hasWorkDoneProgress, "hasWorkDoneProgress"); + __name2(hasWorkDoneProgress, "hasWorkDoneProgress"); + WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress; + })(WorkDoneProgressOptions || (exports2.WorkDoneProgressOptions = WorkDoneProgressOptions = {})); + var InitializeRequest; + (function(InitializeRequest2) { + InitializeRequest2.method = "initialize"; + InitializeRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + InitializeRequest2.type = new messages_1.ProtocolRequestType(InitializeRequest2.method); + })(InitializeRequest || (exports2.InitializeRequest = InitializeRequest = {})); + var InitializeErrorCodes; + (function(InitializeErrorCodes2) { + InitializeErrorCodes2.unknownProtocolVersion = 1; + })(InitializeErrorCodes || (exports2.InitializeErrorCodes = InitializeErrorCodes = {})); + var InitializedNotification; + (function(InitializedNotification2) { + InitializedNotification2.method = "initialized"; + InitializedNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + InitializedNotification2.type = new messages_1.ProtocolNotificationType(InitializedNotification2.method); + })(InitializedNotification || (exports2.InitializedNotification = InitializedNotification = {})); + var ShutdownRequest; + (function(ShutdownRequest2) { + ShutdownRequest2.method = "shutdown"; + ShutdownRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + ShutdownRequest2.type = new messages_1.ProtocolRequestType0(ShutdownRequest2.method); + })(ShutdownRequest || (exports2.ShutdownRequest = ShutdownRequest = {})); + var ExitNotification; + (function(ExitNotification2) { + ExitNotification2.method = "exit"; + ExitNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + ExitNotification2.type = new messages_1.ProtocolNotificationType0(ExitNotification2.method); + })(ExitNotification || (exports2.ExitNotification = ExitNotification = {})); + var DidChangeConfigurationNotification; + (function(DidChangeConfigurationNotification2) { + DidChangeConfigurationNotification2.method = "workspace/didChangeConfiguration"; + DidChangeConfigurationNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeConfigurationNotification2.type = new messages_1.ProtocolNotificationType(DidChangeConfigurationNotification2.method); + })(DidChangeConfigurationNotification || (exports2.DidChangeConfigurationNotification = DidChangeConfigurationNotification = {})); + var MessageType; + (function(MessageType2) { + MessageType2.Error = 1; + MessageType2.Warning = 2; + MessageType2.Info = 3; + MessageType2.Log = 4; + MessageType2.Debug = 5; + })(MessageType || (exports2.MessageType = MessageType = {})); + var ShowMessageNotification; + (function(ShowMessageNotification2) { + ShowMessageNotification2.method = "window/showMessage"; + ShowMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient; + ShowMessageNotification2.type = new messages_1.ProtocolNotificationType(ShowMessageNotification2.method); + })(ShowMessageNotification || (exports2.ShowMessageNotification = ShowMessageNotification = {})); + var ShowMessageRequest; + (function(ShowMessageRequest2) { + ShowMessageRequest2.method = "window/showMessageRequest"; + ShowMessageRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + ShowMessageRequest2.type = new messages_1.ProtocolRequestType(ShowMessageRequest2.method); + })(ShowMessageRequest || (exports2.ShowMessageRequest = ShowMessageRequest = {})); + var LogMessageNotification; + (function(LogMessageNotification2) { + LogMessageNotification2.method = "window/logMessage"; + LogMessageNotification2.messageDirection = messages_1.MessageDirection.serverToClient; + LogMessageNotification2.type = new messages_1.ProtocolNotificationType(LogMessageNotification2.method); + })(LogMessageNotification || (exports2.LogMessageNotification = LogMessageNotification = {})); + var TelemetryEventNotification; + (function(TelemetryEventNotification2) { + TelemetryEventNotification2.method = "telemetry/event"; + TelemetryEventNotification2.messageDirection = messages_1.MessageDirection.serverToClient; + TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType(TelemetryEventNotification2.method); + })(TelemetryEventNotification || (exports2.TelemetryEventNotification = TelemetryEventNotification = {})); + var TextDocumentSyncKind; + (function(TextDocumentSyncKind2) { + TextDocumentSyncKind2.None = 0; + TextDocumentSyncKind2.Full = 1; + TextDocumentSyncKind2.Incremental = 2; + })(TextDocumentSyncKind || (exports2.TextDocumentSyncKind = TextDocumentSyncKind = {})); + var DidOpenTextDocumentNotification; + (function(DidOpenTextDocumentNotification2) { + DidOpenTextDocumentNotification2.method = "textDocument/didOpen"; + DidOpenTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidOpenTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method); + })(DidOpenTextDocumentNotification || (exports2.DidOpenTextDocumentNotification = DidOpenTextDocumentNotification = {})); + var TextDocumentContentChangeEvent; + (function(TextDocumentContentChangeEvent2) { + function isIncremental(event3) { + let candidate = event3; + return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number"); + } + __name(isIncremental, "isIncremental"); + __name2(isIncremental, "isIncremental"); + TextDocumentContentChangeEvent2.isIncremental = isIncremental; + function isFull(event3) { + let candidate = event3; + return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0; + } + __name(isFull, "isFull"); + __name2(isFull, "isFull"); + TextDocumentContentChangeEvent2.isFull = isFull; + })(TextDocumentContentChangeEvent || (exports2.TextDocumentContentChangeEvent = TextDocumentContentChangeEvent = {})); + var DidChangeTextDocumentNotification; + (function(DidChangeTextDocumentNotification2) { + DidChangeTextDocumentNotification2.method = "textDocument/didChange"; + DidChangeTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method); + })(DidChangeTextDocumentNotification || (exports2.DidChangeTextDocumentNotification = DidChangeTextDocumentNotification = {})); + var DidCloseTextDocumentNotification; + (function(DidCloseTextDocumentNotification2) { + DidCloseTextDocumentNotification2.method = "textDocument/didClose"; + DidCloseTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidCloseTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method); + })(DidCloseTextDocumentNotification || (exports2.DidCloseTextDocumentNotification = DidCloseTextDocumentNotification = {})); + var DidSaveTextDocumentNotification; + (function(DidSaveTextDocumentNotification2) { + DidSaveTextDocumentNotification2.method = "textDocument/didSave"; + DidSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method); + })(DidSaveTextDocumentNotification || (exports2.DidSaveTextDocumentNotification = DidSaveTextDocumentNotification = {})); + var TextDocumentSaveReason; + (function(TextDocumentSaveReason2) { + TextDocumentSaveReason2.Manual = 1; + TextDocumentSaveReason2.AfterDelay = 2; + TextDocumentSaveReason2.FocusOut = 3; + })(TextDocumentSaveReason || (exports2.TextDocumentSaveReason = TextDocumentSaveReason = {})); + var WillSaveTextDocumentNotification; + (function(WillSaveTextDocumentNotification2) { + WillSaveTextDocumentNotification2.method = "textDocument/willSave"; + WillSaveTextDocumentNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method); + })(WillSaveTextDocumentNotification || (exports2.WillSaveTextDocumentNotification = WillSaveTextDocumentNotification = {})); + var WillSaveTextDocumentWaitUntilRequest; + (function(WillSaveTextDocumentWaitUntilRequest2) { + WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil"; + WillSaveTextDocumentWaitUntilRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method); + })(WillSaveTextDocumentWaitUntilRequest || (exports2.WillSaveTextDocumentWaitUntilRequest = WillSaveTextDocumentWaitUntilRequest = {})); + var DidChangeWatchedFilesNotification; + (function(DidChangeWatchedFilesNotification2) { + DidChangeWatchedFilesNotification2.method = "workspace/didChangeWatchedFiles"; + DidChangeWatchedFilesNotification2.messageDirection = messages_1.MessageDirection.clientToServer; + DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType(DidChangeWatchedFilesNotification2.method); + })(DidChangeWatchedFilesNotification || (exports2.DidChangeWatchedFilesNotification = DidChangeWatchedFilesNotification = {})); + var FileChangeType; + (function(FileChangeType2) { + FileChangeType2.Created = 1; + FileChangeType2.Changed = 2; + FileChangeType2.Deleted = 3; + })(FileChangeType || (exports2.FileChangeType = FileChangeType = {})); + var RelativePattern; + (function(RelativePattern2) { + function is2(value2) { + const candidate = value2; + return Is2.objectLiteral(candidate) && (vscode_languageserver_types_1.URI.is(candidate.baseUri) || vscode_languageserver_types_1.WorkspaceFolder.is(candidate.baseUri)) && Is2.string(candidate.pattern); + } + __name(is2, "is"); + __name2(is2, "is"); + RelativePattern2.is = is2; + })(RelativePattern || (exports2.RelativePattern = RelativePattern = {})); + var WatchKind; + (function(WatchKind2) { + WatchKind2.Create = 1; + WatchKind2.Change = 2; + WatchKind2.Delete = 4; + })(WatchKind || (exports2.WatchKind = WatchKind = {})); + var PublishDiagnosticsNotification; + (function(PublishDiagnosticsNotification2) { + PublishDiagnosticsNotification2.method = "textDocument/publishDiagnostics"; + PublishDiagnosticsNotification2.messageDirection = messages_1.MessageDirection.serverToClient; + PublishDiagnosticsNotification2.type = new messages_1.ProtocolNotificationType(PublishDiagnosticsNotification2.method); + })(PublishDiagnosticsNotification || (exports2.PublishDiagnosticsNotification = PublishDiagnosticsNotification = {})); + var CompletionTriggerKind; + (function(CompletionTriggerKind2) { + CompletionTriggerKind2.Invoked = 1; + CompletionTriggerKind2.TriggerCharacter = 2; + CompletionTriggerKind2.TriggerForIncompleteCompletions = 3; + })(CompletionTriggerKind || (exports2.CompletionTriggerKind = CompletionTriggerKind = {})); + var CompletionRequest; + (function(CompletionRequest2) { + CompletionRequest2.method = "textDocument/completion"; + CompletionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CompletionRequest2.type = new messages_1.ProtocolRequestType(CompletionRequest2.method); + })(CompletionRequest || (exports2.CompletionRequest = CompletionRequest = {})); + var CompletionResolveRequest; + (function(CompletionResolveRequest2) { + CompletionResolveRequest2.method = "completionItem/resolve"; + CompletionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method); + })(CompletionResolveRequest || (exports2.CompletionResolveRequest = CompletionResolveRequest = {})); + var HoverRequest; + (function(HoverRequest2) { + HoverRequest2.method = "textDocument/hover"; + HoverRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + HoverRequest2.type = new messages_1.ProtocolRequestType(HoverRequest2.method); + })(HoverRequest || (exports2.HoverRequest = HoverRequest = {})); + var SignatureHelpTriggerKind; + (function(SignatureHelpTriggerKind2) { + SignatureHelpTriggerKind2.Invoked = 1; + SignatureHelpTriggerKind2.TriggerCharacter = 2; + SignatureHelpTriggerKind2.ContentChange = 3; + })(SignatureHelpTriggerKind || (exports2.SignatureHelpTriggerKind = SignatureHelpTriggerKind = {})); + var SignatureHelpRequest; + (function(SignatureHelpRequest2) { + SignatureHelpRequest2.method = "textDocument/signatureHelp"; + SignatureHelpRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + SignatureHelpRequest2.type = new messages_1.ProtocolRequestType(SignatureHelpRequest2.method); + })(SignatureHelpRequest || (exports2.SignatureHelpRequest = SignatureHelpRequest = {})); + var DefinitionRequest; + (function(DefinitionRequest2) { + DefinitionRequest2.method = "textDocument/definition"; + DefinitionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DefinitionRequest2.type = new messages_1.ProtocolRequestType(DefinitionRequest2.method); + })(DefinitionRequest || (exports2.DefinitionRequest = DefinitionRequest = {})); + var ReferencesRequest; + (function(ReferencesRequest2) { + ReferencesRequest2.method = "textDocument/references"; + ReferencesRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method); + })(ReferencesRequest || (exports2.ReferencesRequest = ReferencesRequest = {})); + var DocumentHighlightRequest; + (function(DocumentHighlightRequest2) { + DocumentHighlightRequest2.method = "textDocument/documentHighlight"; + DocumentHighlightRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method); + })(DocumentHighlightRequest || (exports2.DocumentHighlightRequest = DocumentHighlightRequest = {})); + var DocumentSymbolRequest; + (function(DocumentSymbolRequest2) { + DocumentSymbolRequest2.method = "textDocument/documentSymbol"; + DocumentSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentSymbolRequest2.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method); + })(DocumentSymbolRequest || (exports2.DocumentSymbolRequest = DocumentSymbolRequest = {})); + var CodeActionRequest; + (function(CodeActionRequest2) { + CodeActionRequest2.method = "textDocument/codeAction"; + CodeActionRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CodeActionRequest2.type = new messages_1.ProtocolRequestType(CodeActionRequest2.method); + })(CodeActionRequest || (exports2.CodeActionRequest = CodeActionRequest = {})); + var CodeActionResolveRequest; + (function(CodeActionResolveRequest2) { + CodeActionResolveRequest2.method = "codeAction/resolve"; + CodeActionResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method); + })(CodeActionResolveRequest || (exports2.CodeActionResolveRequest = CodeActionResolveRequest = {})); + var WorkspaceSymbolRequest; + (function(WorkspaceSymbolRequest2) { + WorkspaceSymbolRequest2.method = "workspace/symbol"; + WorkspaceSymbolRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WorkspaceSymbolRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method); + })(WorkspaceSymbolRequest || (exports2.WorkspaceSymbolRequest = WorkspaceSymbolRequest = {})); + var WorkspaceSymbolResolveRequest; + (function(WorkspaceSymbolResolveRequest2) { + WorkspaceSymbolResolveRequest2.method = "workspaceSymbol/resolve"; + WorkspaceSymbolResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + WorkspaceSymbolResolveRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolResolveRequest2.method); + })(WorkspaceSymbolResolveRequest || (exports2.WorkspaceSymbolResolveRequest = WorkspaceSymbolResolveRequest = {})); + var CodeLensRequest; + (function(CodeLensRequest2) { + CodeLensRequest2.method = "textDocument/codeLens"; + CodeLensRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method); + })(CodeLensRequest || (exports2.CodeLensRequest = CodeLensRequest = {})); + var CodeLensResolveRequest; + (function(CodeLensResolveRequest2) { + CodeLensResolveRequest2.method = "codeLens/resolve"; + CodeLensResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method); + })(CodeLensResolveRequest || (exports2.CodeLensResolveRequest = CodeLensResolveRequest = {})); + var CodeLensRefreshRequest; + (function(CodeLensRefreshRequest2) { + CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`; + CodeLensRefreshRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method); + })(CodeLensRefreshRequest || (exports2.CodeLensRefreshRequest = CodeLensRefreshRequest = {})); + var DocumentLinkRequest; + (function(DocumentLinkRequest2) { + DocumentLinkRequest2.method = "textDocument/documentLink"; + DocumentLinkRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method); + })(DocumentLinkRequest || (exports2.DocumentLinkRequest = DocumentLinkRequest = {})); + var DocumentLinkResolveRequest; + (function(DocumentLinkResolveRequest2) { + DocumentLinkResolveRequest2.method = "documentLink/resolve"; + DocumentLinkResolveRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method); + })(DocumentLinkResolveRequest || (exports2.DocumentLinkResolveRequest = DocumentLinkResolveRequest = {})); + var DocumentFormattingRequest; + (function(DocumentFormattingRequest2) { + DocumentFormattingRequest2.method = "textDocument/formatting"; + DocumentFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method); + })(DocumentFormattingRequest || (exports2.DocumentFormattingRequest = DocumentFormattingRequest = {})); + var DocumentRangeFormattingRequest; + (function(DocumentRangeFormattingRequest2) { + DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting"; + DocumentRangeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method); + })(DocumentRangeFormattingRequest || (exports2.DocumentRangeFormattingRequest = DocumentRangeFormattingRequest = {})); + var DocumentRangesFormattingRequest; + (function(DocumentRangesFormattingRequest2) { + DocumentRangesFormattingRequest2.method = "textDocument/rangesFormatting"; + DocumentRangesFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentRangesFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangesFormattingRequest2.method); + })(DocumentRangesFormattingRequest || (exports2.DocumentRangesFormattingRequest = DocumentRangesFormattingRequest = {})); + var DocumentOnTypeFormattingRequest; + (function(DocumentOnTypeFormattingRequest2) { + DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting"; + DocumentOnTypeFormattingRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method); + })(DocumentOnTypeFormattingRequest || (exports2.DocumentOnTypeFormattingRequest = DocumentOnTypeFormattingRequest = {})); + var PrepareSupportDefaultBehavior; + (function(PrepareSupportDefaultBehavior2) { + PrepareSupportDefaultBehavior2.Identifier = 1; + })(PrepareSupportDefaultBehavior || (exports2.PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior = {})); + var RenameRequest; + (function(RenameRequest2) { + RenameRequest2.method = "textDocument/rename"; + RenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method); + })(RenameRequest || (exports2.RenameRequest = RenameRequest = {})); + var PrepareRenameRequest; + (function(PrepareRenameRequest2) { + PrepareRenameRequest2.method = "textDocument/prepareRename"; + PrepareRenameRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method); + })(PrepareRenameRequest || (exports2.PrepareRenameRequest = PrepareRenameRequest = {})); + var ExecuteCommandRequest; + (function(ExecuteCommandRequest2) { + ExecuteCommandRequest2.method = "workspace/executeCommand"; + ExecuteCommandRequest2.messageDirection = messages_1.MessageDirection.clientToServer; + ExecuteCommandRequest2.type = new messages_1.ProtocolRequestType(ExecuteCommandRequest2.method); + })(ExecuteCommandRequest || (exports2.ExecuteCommandRequest = ExecuteCommandRequest = {})); + var ApplyWorkspaceEditRequest; + (function(ApplyWorkspaceEditRequest2) { + ApplyWorkspaceEditRequest2.method = "workspace/applyEdit"; + ApplyWorkspaceEditRequest2.messageDirection = messages_1.MessageDirection.serverToClient; + ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit"); + })(ApplyWorkspaceEditRequest || (exports2.ApplyWorkspaceEditRequest = ApplyWorkspaceEditRequest = {})); + } + }); + require_connection2 = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/connection.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.createProtocolConnection = void 0; + var vscode_jsonrpc_1 = require_main(); + function createProtocolConnection(input, output2, logger, options2) { + if (vscode_jsonrpc_1.ConnectionStrategy.is(options2)) { + options2 = { connectionStrategy: options2 }; + } + return (0, vscode_jsonrpc_1.createMessageConnection)(input, output2, logger, options2); + } + __name(createProtocolConnection, "createProtocolConnection"); + __name2(createProtocolConnection, "createProtocolConnection"); + exports2.createProtocolConnection = createProtocolConnection; + } + }); + require_api2 = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/api.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o2, m3, k2, k22) { + if (k22 === void 0) k22 = k2; + var desc = Object.getOwnPropertyDescriptor(m3, k2); + if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return m3[k2]; + }, "get") }; + } + Object.defineProperty(o2, k22, desc); + }) : (function(o2, m3, k2, k22) { + if (k22 === void 0) k22 = k2; + o2[k22] = m3[k2]; + })); + var __exportStar = exports2 && exports2.__exportStar || function(m3, exports3) { + for (var p3 in m3) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m3, p3); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.LSPErrorCodes = exports2.createProtocolConnection = void 0; + __exportStar(require_main(), exports2); + __exportStar((init_main(), __toCommonJS2(main_exports)), exports2); + __exportStar(require_messages2(), exports2); + __exportStar(require_protocol(), exports2); + var connection_1 = require_connection2(); + Object.defineProperty(exports2, "createProtocolConnection", { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return connection_1.createProtocolConnection; + }, "get") }); + var LSPErrorCodes2; + (function(LSPErrorCodes3) { + LSPErrorCodes3.lspReservedErrorRangeStart = -32899; + LSPErrorCodes3.RequestFailed = -32803; + LSPErrorCodes3.ServerCancelled = -32802; + LSPErrorCodes3.ContentModified = -32801; + LSPErrorCodes3.RequestCancelled = -32800; + LSPErrorCodes3.lspReservedErrorRangeEnd = -32800; + })(LSPErrorCodes2 || (exports2.LSPErrorCodes = LSPErrorCodes2 = {})); + } + }); + require_main2 = __commonJS2({ + "../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/browser/main.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o2, m3, k2, k22) { + if (k22 === void 0) k22 = k2; + var desc = Object.getOwnPropertyDescriptor(m3, k2); + if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: /* @__PURE__ */ __name2(function() { + return m3[k2]; + }, "get") }; + } + Object.defineProperty(o2, k22, desc); + }) : (function(o2, m3, k2, k22) { + if (k22 === void 0) k22 = k2; + o2[k22] = m3[k2]; + })); + var __exportStar = exports2 && exports2.__exportStar || function(m3, exports3) { + for (var p3 in m3) if (p3 !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p3)) __createBinding(exports3, m3, p3); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.createProtocolConnection = void 0; + var browser_1 = require_browser(); + __exportStar(require_browser(), exports2); + __exportStar(require_api2(), exports2); + function createProtocolConnection(reader, writer, logger, options2) { + return (0, browser_1.createMessageConnection)(reader, writer, logger, options2); + } + __name(createProtocolConnection, "createProtocolConnection"); + __name2(createProtocolConnection, "createProtocolConnection"); + exports2.createProtocolConnection = createProtocolConnection; + } + }); + lib_exports = {}; + __export2(lib_exports, { + AbstractAstReflection: /* @__PURE__ */ __name(() => AbstractAstReflection, "AbstractAstReflection"), + AbstractCstNode: /* @__PURE__ */ __name(() => AbstractCstNode, "AbstractCstNode"), + AbstractLangiumParser: /* @__PURE__ */ __name(() => AbstractLangiumParser, "AbstractLangiumParser"), + AbstractParserErrorMessageProvider: /* @__PURE__ */ __name(() => AbstractParserErrorMessageProvider, "AbstractParserErrorMessageProvider"), + AbstractThreadedAsyncParser: /* @__PURE__ */ __name(() => AbstractThreadedAsyncParser, "AbstractThreadedAsyncParser"), + AstUtils: /* @__PURE__ */ __name(() => ast_utils_exports, "AstUtils"), + BiMap: /* @__PURE__ */ __name(() => BiMap, "BiMap"), + Cancellation: /* @__PURE__ */ __name(() => cancellation_exports, "Cancellation"), + CompositeCstNodeImpl: /* @__PURE__ */ __name(() => CompositeCstNodeImpl, "CompositeCstNodeImpl"), + ContextCache: /* @__PURE__ */ __name(() => ContextCache, "ContextCache"), + CstNodeBuilder: /* @__PURE__ */ __name(() => CstNodeBuilder, "CstNodeBuilder"), + CstUtils: /* @__PURE__ */ __name(() => cst_utils_exports, "CstUtils"), + DEFAULT_TOKENIZE_OPTIONS: /* @__PURE__ */ __name(() => DEFAULT_TOKENIZE_OPTIONS, "DEFAULT_TOKENIZE_OPTIONS"), + DONE_RESULT: /* @__PURE__ */ __name(() => DONE_RESULT, "DONE_RESULT"), + DatatypeSymbol: /* @__PURE__ */ __name(() => DatatypeSymbol, "DatatypeSymbol"), + DefaultAstNodeDescriptionProvider: /* @__PURE__ */ __name(() => DefaultAstNodeDescriptionProvider, "DefaultAstNodeDescriptionProvider"), + DefaultAstNodeLocator: /* @__PURE__ */ __name(() => DefaultAstNodeLocator, "DefaultAstNodeLocator"), + DefaultAsyncParser: /* @__PURE__ */ __name(() => DefaultAsyncParser, "DefaultAsyncParser"), + DefaultCommentProvider: /* @__PURE__ */ __name(() => DefaultCommentProvider, "DefaultCommentProvider"), + DefaultConfigurationProvider: /* @__PURE__ */ __name(() => DefaultConfigurationProvider, "DefaultConfigurationProvider"), + DefaultDocumentBuilder: /* @__PURE__ */ __name(() => DefaultDocumentBuilder, "DefaultDocumentBuilder"), + DefaultDocumentValidator: /* @__PURE__ */ __name(() => DefaultDocumentValidator, "DefaultDocumentValidator"), + DefaultHydrator: /* @__PURE__ */ __name(() => DefaultHydrator, "DefaultHydrator"), + DefaultIndexManager: /* @__PURE__ */ __name(() => DefaultIndexManager, "DefaultIndexManager"), + DefaultJsonSerializer: /* @__PURE__ */ __name(() => DefaultJsonSerializer, "DefaultJsonSerializer"), + DefaultLangiumDocumentFactory: /* @__PURE__ */ __name(() => DefaultLangiumDocumentFactory, "DefaultLangiumDocumentFactory"), + DefaultLangiumDocuments: /* @__PURE__ */ __name(() => DefaultLangiumDocuments, "DefaultLangiumDocuments"), + DefaultLangiumProfiler: /* @__PURE__ */ __name(() => DefaultLangiumProfiler, "DefaultLangiumProfiler"), + DefaultLexer: /* @__PURE__ */ __name(() => DefaultLexer, "DefaultLexer"), + DefaultLexerErrorMessageProvider: /* @__PURE__ */ __name(() => DefaultLexerErrorMessageProvider, "DefaultLexerErrorMessageProvider"), + DefaultLinker: /* @__PURE__ */ __name(() => DefaultLinker, "DefaultLinker"), + DefaultNameProvider: /* @__PURE__ */ __name(() => DefaultNameProvider, "DefaultNameProvider"), + DefaultReferenceDescriptionProvider: /* @__PURE__ */ __name(() => DefaultReferenceDescriptionProvider, "DefaultReferenceDescriptionProvider"), + DefaultReferences: /* @__PURE__ */ __name(() => DefaultReferences, "DefaultReferences"), + DefaultScopeComputation: /* @__PURE__ */ __name(() => DefaultScopeComputation, "DefaultScopeComputation"), + DefaultScopeProvider: /* @__PURE__ */ __name(() => DefaultScopeProvider, "DefaultScopeProvider"), + DefaultServiceRegistry: /* @__PURE__ */ __name(() => DefaultServiceRegistry, "DefaultServiceRegistry"), + DefaultTokenBuilder: /* @__PURE__ */ __name(() => DefaultTokenBuilder, "DefaultTokenBuilder"), + DefaultValueConverter: /* @__PURE__ */ __name(() => DefaultValueConverter, "DefaultValueConverter"), + DefaultWorkspaceLock: /* @__PURE__ */ __name(() => DefaultWorkspaceLock, "DefaultWorkspaceLock"), + DefaultWorkspaceManager: /* @__PURE__ */ __name(() => DefaultWorkspaceManager, "DefaultWorkspaceManager"), + Deferred: /* @__PURE__ */ __name(() => Deferred, "Deferred"), + Disposable: /* @__PURE__ */ __name(() => Disposable, "Disposable"), + DisposableCache: /* @__PURE__ */ __name(() => DisposableCache, "DisposableCache"), + DocumentCache: /* @__PURE__ */ __name(() => DocumentCache, "DocumentCache"), + DocumentState: /* @__PURE__ */ __name(() => DocumentState, "DocumentState"), + DocumentValidator: /* @__PURE__ */ __name(() => DocumentValidator, "DocumentValidator"), + EMPTY_SCOPE: /* @__PURE__ */ __name(() => EMPTY_SCOPE, "EMPTY_SCOPE"), + EMPTY_STREAM: /* @__PURE__ */ __name(() => EMPTY_STREAM, "EMPTY_STREAM"), + EmptyFileSystem: /* @__PURE__ */ __name(() => EmptyFileSystem, "EmptyFileSystem"), + EmptyFileSystemProvider: /* @__PURE__ */ __name(() => EmptyFileSystemProvider, "EmptyFileSystemProvider"), + ErrorWithLocation: /* @__PURE__ */ __name(() => ErrorWithLocation, "ErrorWithLocation"), + GrammarAST: /* @__PURE__ */ __name(() => ast_exports, "GrammarAST"), + GrammarUtils: /* @__PURE__ */ __name(() => grammar_utils_exports, "GrammarUtils"), + IndentationAwareLexer: /* @__PURE__ */ __name(() => IndentationAwareLexer, "IndentationAwareLexer"), + IndentationAwareTokenBuilder: /* @__PURE__ */ __name(() => IndentationAwareTokenBuilder, "IndentationAwareTokenBuilder"), + JSDocDocumentationProvider: /* @__PURE__ */ __name(() => JSDocDocumentationProvider, "JSDocDocumentationProvider"), + LangiumCompletionParser: /* @__PURE__ */ __name(() => LangiumCompletionParser, "LangiumCompletionParser"), + LangiumParser: /* @__PURE__ */ __name(() => LangiumParser, "LangiumParser"), + LangiumParserErrorMessageProvider: /* @__PURE__ */ __name(() => LangiumParserErrorMessageProvider, "LangiumParserErrorMessageProvider"), + LeafCstNodeImpl: /* @__PURE__ */ __name(() => LeafCstNodeImpl, "LeafCstNodeImpl"), + LexingMode: /* @__PURE__ */ __name(() => LexingMode, "LexingMode"), + MapScope: /* @__PURE__ */ __name(() => MapScope, "MapScope"), + Module: /* @__PURE__ */ __name(() => Module, "Module"), + MultiMap: /* @__PURE__ */ __name(() => MultiMap, "MultiMap"), + MultiMapScope: /* @__PURE__ */ __name(() => MultiMapScope, "MultiMapScope"), + OperationCancelled: /* @__PURE__ */ __name(() => OperationCancelled, "OperationCancelled"), + ParserWorker: /* @__PURE__ */ __name(() => ParserWorker, "ParserWorker"), + ProfilingTask: /* @__PURE__ */ __name(() => ProfilingTask, "ProfilingTask"), + Reduction: /* @__PURE__ */ __name(() => Reduction, "Reduction"), + RefResolving: /* @__PURE__ */ __name(() => RefResolving, "RefResolving"), + RegExpUtils: /* @__PURE__ */ __name(() => regexp_utils_exports, "RegExpUtils"), + RootCstNodeImpl: /* @__PURE__ */ __name(() => RootCstNodeImpl, "RootCstNodeImpl"), + SimpleCache: /* @__PURE__ */ __name(() => SimpleCache, "SimpleCache"), + StreamImpl: /* @__PURE__ */ __name(() => StreamImpl, "StreamImpl"), + StreamScope: /* @__PURE__ */ __name(() => StreamScope, "StreamScope"), + TextDocument: /* @__PURE__ */ __name(() => TextDocument2, "TextDocument"), + TreeStreamImpl: /* @__PURE__ */ __name(() => TreeStreamImpl, "TreeStreamImpl"), + URI: /* @__PURE__ */ __name(() => URI2, "URI"), + UriTrie: /* @__PURE__ */ __name(() => UriTrie, "UriTrie"), + UriUtils: /* @__PURE__ */ __name(() => UriUtils, "UriUtils"), + VALIDATE_EACH_NODE: /* @__PURE__ */ __name(() => VALIDATE_EACH_NODE, "VALIDATE_EACH_NODE"), + ValidationCategory: /* @__PURE__ */ __name(() => ValidationCategory, "ValidationCategory"), + ValidationRegistry: /* @__PURE__ */ __name(() => ValidationRegistry, "ValidationRegistry"), + ValueConverter: /* @__PURE__ */ __name(() => ValueConverter, "ValueConverter"), + WorkspaceCache: /* @__PURE__ */ __name(() => WorkspaceCache, "WorkspaceCache"), + assertCondition: /* @__PURE__ */ __name(() => assertCondition, "assertCondition"), + assertUnreachable: /* @__PURE__ */ __name(() => assertUnreachable, "assertUnreachable"), + createCompletionParser: /* @__PURE__ */ __name(() => createCompletionParser, "createCompletionParser"), + createDefaultCoreModule: /* @__PURE__ */ __name(() => createDefaultCoreModule, "createDefaultCoreModule"), + createDefaultSharedCoreModule: /* @__PURE__ */ __name(() => createDefaultSharedCoreModule, "createDefaultSharedCoreModule"), + createGrammarConfig: /* @__PURE__ */ __name(() => createGrammarConfig, "createGrammarConfig"), + createLangiumParser: /* @__PURE__ */ __name(() => createLangiumParser, "createLangiumParser"), + createParser: /* @__PURE__ */ __name(() => createParser, "createParser"), + delayNextTick: /* @__PURE__ */ __name(() => delayNextTick, "delayNextTick"), + diagnosticData: /* @__PURE__ */ __name(() => diagnosticData, "diagnosticData"), + eagerLoad: /* @__PURE__ */ __name(() => eagerLoad, "eagerLoad"), + getDiagnosticRange: /* @__PURE__ */ __name(() => getDiagnosticRange, "getDiagnosticRange"), + indentationBuilderDefaultOptions: /* @__PURE__ */ __name(() => indentationBuilderDefaultOptions, "indentationBuilderDefaultOptions"), + inject: /* @__PURE__ */ __name(() => inject, "inject"), + interruptAndCheck: /* @__PURE__ */ __name(() => interruptAndCheck, "interruptAndCheck"), + isAstNode: /* @__PURE__ */ __name(() => isAstNode, "isAstNode"), + isAstNodeDescription: /* @__PURE__ */ __name(() => isAstNodeDescription, "isAstNodeDescription"), + isAstNodeWithComment: /* @__PURE__ */ __name(() => isAstNodeWithComment, "isAstNodeWithComment"), + isCompositeCstNode: /* @__PURE__ */ __name(() => isCompositeCstNode, "isCompositeCstNode"), + isIMultiModeLexerDefinition: /* @__PURE__ */ __name(() => isIMultiModeLexerDefinition, "isIMultiModeLexerDefinition"), + isJSDoc: /* @__PURE__ */ __name(() => isJSDoc, "isJSDoc"), + isLeafCstNode: /* @__PURE__ */ __name(() => isLeafCstNode, "isLeafCstNode"), + isLinkingError: /* @__PURE__ */ __name(() => isLinkingError, "isLinkingError"), + isMultiReference: /* @__PURE__ */ __name(() => isMultiReference, "isMultiReference"), + isNamed: /* @__PURE__ */ __name(() => isNamed, "isNamed"), + isOperationCancelled: /* @__PURE__ */ __name(() => isOperationCancelled, "isOperationCancelled"), + isReference: /* @__PURE__ */ __name(() => isReference, "isReference"), + isRootCstNode: /* @__PURE__ */ __name(() => isRootCstNode, "isRootCstNode"), + isTokenTypeArray: /* @__PURE__ */ __name(() => isTokenTypeArray, "isTokenTypeArray"), + isTokenTypeDictionary: /* @__PURE__ */ __name(() => isTokenTypeDictionary, "isTokenTypeDictionary"), + loadGrammarFromJson: /* @__PURE__ */ __name(() => loadGrammarFromJson, "loadGrammarFromJson"), + parseJSDoc: /* @__PURE__ */ __name(() => parseJSDoc, "parseJSDoc"), + prepareLangiumParser: /* @__PURE__ */ __name(() => prepareLangiumParser, "prepareLangiumParser"), + setInterruptionPeriod: /* @__PURE__ */ __name(() => setInterruptionPeriod, "setInterruptionPeriod"), + startCancelableOperation: /* @__PURE__ */ __name(() => startCancelableOperation, "startCancelableOperation"), + stream: /* @__PURE__ */ __name(() => stream, "stream"), + toDiagnosticData: /* @__PURE__ */ __name(() => toDiagnosticData, "toDiagnosticData"), + toDiagnosticSeverity: /* @__PURE__ */ __name(() => toDiagnosticSeverity, "toDiagnosticSeverity") + }); + cst_utils_exports = {}; + __export2(cst_utils_exports, { + DefaultNameRegexp: /* @__PURE__ */ __name(() => DefaultNameRegexp, "DefaultNameRegexp"), + RangeComparison: /* @__PURE__ */ __name(() => RangeComparison, "RangeComparison"), + compareRange: /* @__PURE__ */ __name(() => compareRange, "compareRange"), + findCommentNode: /* @__PURE__ */ __name(() => findCommentNode, "findCommentNode"), + findDeclarationNodeAtOffset: /* @__PURE__ */ __name(() => findDeclarationNodeAtOffset, "findDeclarationNodeAtOffset"), + findLeafNodeAtOffset: /* @__PURE__ */ __name(() => findLeafNodeAtOffset, "findLeafNodeAtOffset"), + findLeafNodeBeforeOffset: /* @__PURE__ */ __name(() => findLeafNodeBeforeOffset, "findLeafNodeBeforeOffset"), + flattenCst: /* @__PURE__ */ __name(() => flattenCst, "flattenCst"), + getDatatypeNode: /* @__PURE__ */ __name(() => getDatatypeNode, "getDatatypeNode"), + getInteriorNodes: /* @__PURE__ */ __name(() => getInteriorNodes, "getInteriorNodes"), + getNextNode: /* @__PURE__ */ __name(() => getNextNode, "getNextNode"), + getPreviousNode: /* @__PURE__ */ __name(() => getPreviousNode, "getPreviousNode"), + getStartlineNode: /* @__PURE__ */ __name(() => getStartlineNode, "getStartlineNode"), + inRange: /* @__PURE__ */ __name(() => inRange, "inRange"), + isChildNode: /* @__PURE__ */ __name(() => isChildNode, "isChildNode"), + isCommentNode: /* @__PURE__ */ __name(() => isCommentNode, "isCommentNode"), + streamCst: /* @__PURE__ */ __name(() => streamCst, "streamCst"), + toDocumentSegment: /* @__PURE__ */ __name(() => toDocumentSegment, "toDocumentSegment"), + tokenToRange: /* @__PURE__ */ __name(() => tokenToRange, "tokenToRange") + }); + __name(isAstNode, "isAstNode"); + __name2(isAstNode, "isAstNode"); + __name(isReference, "isReference"); + __name2(isReference, "isReference"); + __name(isMultiReference, "isMultiReference"); + __name2(isMultiReference, "isMultiReference"); + __name(isAstNodeDescription, "isAstNodeDescription"); + __name2(isAstNodeDescription, "isAstNodeDescription"); + __name(isLinkingError, "isLinkingError"); + __name2(isLinkingError, "isLinkingError"); + AbstractAstReflection = class { + static { + __name(this, "AbstractAstReflection"); + } + static { + __name2(this, "AbstractAstReflection"); + } + constructor() { + this.subtypes = {}; + this.allSubtypes = {}; + } + getAllTypes() { + return Object.keys(this.types); + } + getReferenceType(refInfo) { + const metaData = this.types[refInfo.container.$type]; + if (!metaData) { + throw new Error(`Type ${refInfo.container.$type || "undefined"} not found.`); + } + const referenceType = metaData.properties[refInfo.property]?.referenceType; + if (!referenceType) { + throw new Error(`Property ${refInfo.property || "undefined"} of type ${refInfo.container.$type} is not a reference.`); + } + return referenceType; + } + getTypeMetaData(type3) { + const result = this.types[type3]; + if (!result) { + return { + name: type3, + properties: {}, + superTypes: [] + }; + } + return result; + } + isInstance(node2, type3) { + return isAstNode(node2) && this.isSubtype(node2.$type, type3); + } + isSubtype(subtype, supertype) { + if (subtype === supertype) { + return true; + } + let nested = this.subtypes[subtype]; + if (!nested) { + nested = this.subtypes[subtype] = {}; + } + const existing = nested[supertype]; + if (existing !== void 0) { + return existing; + } else { + const metaData = this.types[subtype]; + const result = metaData ? metaData.superTypes.some((s2) => this.isSubtype(s2, supertype)) : false; + nested[supertype] = result; + return result; + } + } + getAllSubTypes(type3) { + const existing = this.allSubtypes[type3]; + if (existing) { + return existing; + } else { + const allTypes = this.getAllTypes(); + const types = []; + for (const possibleSubType of allTypes) { + if (this.isSubtype(possibleSubType, type3)) { + types.push(possibleSubType); + } + } + this.allSubtypes[type3] = types; + return types; + } + } + }; + __name(isCompositeCstNode, "isCompositeCstNode"); + __name2(isCompositeCstNode, "isCompositeCstNode"); + __name(isLeafCstNode, "isLeafCstNode"); + __name2(isLeafCstNode, "isLeafCstNode"); + __name(isRootCstNode, "isRootCstNode"); + __name2(isRootCstNode, "isRootCstNode"); + StreamImpl = class _StreamImpl { + static { + __name(this, "_StreamImpl"); + } + static { + __name2(this, "StreamImpl"); + } + constructor(startFn, nextFn) { + this.startFn = startFn; + this.nextFn = nextFn; + } + iterator() { + const iterator = { + state: this.startFn(), + next: /* @__PURE__ */ __name2(() => this.nextFn(iterator.state), "next"), + [Symbol.iterator]: () => iterator + }; + return iterator; + } + [Symbol.iterator]() { + return this.iterator(); + } + isEmpty() { + const iterator = this.iterator(); + return Boolean(iterator.next().done); + } + count() { + const iterator = this.iterator(); + let count2 = 0; + let next3 = iterator.next(); + while (!next3.done) { + count2++; + next3 = iterator.next(); + } + return count2; + } + toArray() { + const result = []; + const iterator = this.iterator(); + let next3; + do { + next3 = iterator.next(); + if (next3.value !== void 0) { + result.push(next3.value); + } + } while (!next3.done); + return result; + } + toSet() { + return new Set(this); + } + toMap(keyFn, valueFn) { + const entryStream = this.map((element3) => [ + keyFn ? keyFn(element3) : element3, + valueFn ? valueFn(element3) : element3 + ]); + return new Map(entryStream); + } + toString() { + return this.join(); + } + concat(other) { + return new _StreamImpl(() => ({ first: this.startFn(), firstDone: false, iterator: other[Symbol.iterator]() }), (state4) => { + let result; + if (!state4.firstDone) { + do { + result = this.nextFn(state4.first); + if (!result.done) { + return result; + } + } while (!result.done); + state4.firstDone = true; + } + do { + result = state4.iterator.next(); + if (!result.done) { + return result; + } + } while (!result.done); + return DONE_RESULT; + }); + } + join(separator = ",") { + const iterator = this.iterator(); + let value2 = ""; + let result; + let addSeparator = false; + do { + result = iterator.next(); + if (!result.done) { + if (addSeparator) { + value2 += separator; + } + value2 += toString5(result.value); + } + addSeparator = true; + } while (!result.done); + return value2; + } + indexOf(searchElement, fromIndex = 0) { + const iterator = this.iterator(); + let index = 0; + let next3 = iterator.next(); + while (!next3.done) { + if (index >= fromIndex && next3.value === searchElement) { + return index; + } + next3 = iterator.next(); + index++; + } + return -1; + } + every(predicate) { + const iterator = this.iterator(); + let next3 = iterator.next(); + while (!next3.done) { + if (!predicate(next3.value)) { + return false; + } + next3 = iterator.next(); + } + return true; + } + some(predicate) { + const iterator = this.iterator(); + let next3 = iterator.next(); + while (!next3.done) { + if (predicate(next3.value)) { + return true; + } + next3 = iterator.next(); + } + return false; + } + forEach(callbackfn) { + const iterator = this.iterator(); + let index = 0; + let next3 = iterator.next(); + while (!next3.done) { + callbackfn(next3.value, index); + next3 = iterator.next(); + index++; + } + } + map(callbackfn) { + return new _StreamImpl(this.startFn, (state4) => { + const { done, value: value2 } = this.nextFn(state4); + if (done) { + return DONE_RESULT; + } else { + return { done: false, value: callbackfn(value2) }; + } + }); + } + filter(predicate) { + return new _StreamImpl(this.startFn, (state4) => { + let result; + do { + result = this.nextFn(state4); + if (!result.done && predicate(result.value)) { + return result; + } + } while (!result.done); + return DONE_RESULT; + }); + } + nonNullable() { + return this.filter((e3) => e3 !== void 0 && e3 !== null); + } + reduce(callbackfn, initialValue) { + const iterator = this.iterator(); + let previousValue = initialValue; + let next3 = iterator.next(); + while (!next3.done) { + if (previousValue === void 0) { + previousValue = next3.value; + } else { + previousValue = callbackfn(previousValue, next3.value); + } + next3 = iterator.next(); + } + return previousValue; + } + reduceRight(callbackfn, initialValue) { + return this.recursiveReduce(this.iterator(), callbackfn, initialValue); + } + recursiveReduce(iterator, callbackfn, initialValue) { + const next3 = iterator.next(); + if (next3.done) { + return initialValue; + } + const previousValue = this.recursiveReduce(iterator, callbackfn, initialValue); + if (previousValue === void 0) { + return next3.value; + } + return callbackfn(previousValue, next3.value); + } + find(predicate) { + const iterator = this.iterator(); + let next3 = iterator.next(); + while (!next3.done) { + if (predicate(next3.value)) { + return next3.value; + } + next3 = iterator.next(); + } + return void 0; + } + findIndex(predicate) { + const iterator = this.iterator(); + let index = 0; + let next3 = iterator.next(); + while (!next3.done) { + if (predicate(next3.value)) { + return index; + } + next3 = iterator.next(); + index++; + } + return -1; + } + includes(searchElement) { + const iterator = this.iterator(); + let next3 = iterator.next(); + while (!next3.done) { + if (next3.value === searchElement) { + return true; + } + next3 = iterator.next(); + } + return false; + } + flatMap(callbackfn) { + return new _StreamImpl(() => ({ this: this.startFn() }), (state4) => { + do { + if (state4.iterator) { + const next3 = state4.iterator.next(); + if (next3.done) { + state4.iterator = void 0; + } else { + return next3; + } + } + const { done, value: value2 } = this.nextFn(state4.this); + if (!done) { + const mapped = callbackfn(value2); + if (isIterable(mapped)) { + state4.iterator = mapped[Symbol.iterator](); + } else { + return { done: false, value: mapped }; + } + } + } while (state4.iterator); + return DONE_RESULT; + }); + } + flat(depth) { + if (depth === void 0) { + depth = 1; + } + if (depth <= 0) { + return this; + } + const stream2 = depth > 1 ? this.flat(depth - 1) : this; + return new _StreamImpl(() => ({ this: stream2.startFn() }), (state4) => { + do { + if (state4.iterator) { + const next3 = state4.iterator.next(); + if (next3.done) { + state4.iterator = void 0; + } else { + return next3; + } + } + const { done, value: value2 } = stream2.nextFn(state4.this); + if (!done) { + if (isIterable(value2)) { + state4.iterator = value2[Symbol.iterator](); + } else { + return { done: false, value: value2 }; + } + } + } while (state4.iterator); + return DONE_RESULT; + }); + } + head() { + const iterator = this.iterator(); + const result = iterator.next(); + if (result.done) { + return void 0; + } + return result.value; + } + tail(skipCount = 1) { + return new _StreamImpl(() => { + const state4 = this.startFn(); + for (let i2 = 0; i2 < skipCount; i2++) { + const next3 = this.nextFn(state4); + if (next3.done) { + return state4; + } + } + return state4; + }, this.nextFn); + } + limit(maxSize) { + return new _StreamImpl(() => ({ size: 0, state: this.startFn() }), (state4) => { + state4.size++; + if (state4.size > maxSize) { + return DONE_RESULT; + } + return this.nextFn(state4.state); + }); + } + distinct(by) { + return new _StreamImpl(() => ({ set: /* @__PURE__ */ new Set(), internalState: this.startFn() }), (state4) => { + let result; + do { + result = this.nextFn(state4.internalState); + if (!result.done) { + const value2 = by ? by(result.value) : result.value; + if (!state4.set.has(value2)) { + state4.set.add(value2); + return result; + } + } + } while (!result.done); + return DONE_RESULT; + }); + } + exclude(other, key) { + const otherKeySet = /* @__PURE__ */ new Set(); + for (const item of other) { + const value2 = key ? key(item) : item; + otherKeySet.add(value2); + } + return this.filter((e3) => { + const ownKey = key ? key(e3) : e3; + return !otherKeySet.has(ownKey); + }); + } + }; + __name(toString5, "toString"); + __name2(toString5, "toString"); + __name(isIterable, "isIterable"); + __name2(isIterable, "isIterable"); + EMPTY_STREAM = new StreamImpl(() => void 0, () => DONE_RESULT); + DONE_RESULT = Object.freeze({ done: true, value: void 0 }); + __name(stream, "stream"); + __name2(stream, "stream"); + TreeStreamImpl = class extends StreamImpl { + static { + __name(this, "TreeStreamImpl"); + } + static { + __name2(this, "TreeStreamImpl"); + } + constructor(root32, children2, options2) { + super(() => ({ + iterators: options2?.includeRoot ? [[root32][Symbol.iterator]()] : [children2(root32)[Symbol.iterator]()], + pruned: false + }), (state4) => { + if (state4.pruned) { + state4.iterators.pop(); + state4.pruned = false; + } + while (state4.iterators.length > 0) { + const iterator = state4.iterators[state4.iterators.length - 1]; + const next3 = iterator.next(); + if (next3.done) { + state4.iterators.pop(); + } else { + state4.iterators.push(children2(next3.value)[Symbol.iterator]()); + return next3; + } + } + return DONE_RESULT; + }); + } + iterator() { + const iterator = { + state: this.startFn(), + next: /* @__PURE__ */ __name2(() => this.nextFn(iterator.state), "next"), + prune: /* @__PURE__ */ __name2(() => { + iterator.state.pruned = true; + }, "prune"), + [Symbol.iterator]: () => iterator + }; + return iterator; + } + }; + (function(Reduction2) { + function sum2(stream2) { + return stream2.reduce((a2, b3) => a2 + b3, 0); + } + __name(sum2, "sum"); + __name2(sum2, "sum"); + Reduction2.sum = sum2; + function product(stream2) { + return stream2.reduce((a2, b3) => a2 * b3, 0); + } + __name(product, "product"); + __name2(product, "product"); + Reduction2.product = product; + function min22(stream2) { + return stream2.reduce((a2, b3) => Math.min(a2, b3)); + } + __name(min22, "min2"); + __name2(min22, "min"); + Reduction2.min = min22; + function max10(stream2) { + return stream2.reduce((a2, b3) => Math.max(a2, b3)); + } + __name(max10, "max"); + __name2(max10, "max"); + Reduction2.max = max10; + })(Reduction || (Reduction = {})); + ast_utils_exports = {}; + __export2(ast_utils_exports, { + assignMandatoryProperties: /* @__PURE__ */ __name(() => assignMandatoryProperties, "assignMandatoryProperties"), + copyAstNode: /* @__PURE__ */ __name(() => copyAstNode, "copyAstNode"), + findRootNode: /* @__PURE__ */ __name(() => findRootNode, "findRootNode"), + getContainerOfType: /* @__PURE__ */ __name(() => getContainerOfType, "getContainerOfType"), + getDocument: /* @__PURE__ */ __name(() => getDocument, "getDocument"), + getReferenceNodes: /* @__PURE__ */ __name(() => getReferenceNodes, "getReferenceNodes"), + hasContainerOfType: /* @__PURE__ */ __name(() => hasContainerOfType, "hasContainerOfType"), + linkContentToContainer: /* @__PURE__ */ __name(() => linkContentToContainer, "linkContentToContainer"), + streamAllContents: /* @__PURE__ */ __name(() => streamAllContents, "streamAllContents"), + streamAst: /* @__PURE__ */ __name(() => streamAst, "streamAst"), + streamContents: /* @__PURE__ */ __name(() => streamContents, "streamContents"), + streamReferences: /* @__PURE__ */ __name(() => streamReferences, "streamReferences") + }); + __name(linkContentToContainer, "linkContentToContainer"); + __name2(linkContentToContainer, "linkContentToContainer"); + __name(getContainerOfType, "getContainerOfType"); + __name2(getContainerOfType, "getContainerOfType"); + __name(hasContainerOfType, "hasContainerOfType"); + __name2(hasContainerOfType, "hasContainerOfType"); + __name(getDocument, "getDocument"); + __name2(getDocument, "getDocument"); + __name(findRootNode, "findRootNode"); + __name2(findRootNode, "findRootNode"); + __name(getReferenceNodes, "getReferenceNodes"); + __name2(getReferenceNodes, "getReferenceNodes"); + __name(streamContents, "streamContents"); + __name2(streamContents, "streamContents"); + __name(streamAllContents, "streamAllContents"); + __name2(streamAllContents, "streamAllContents"); + __name(streamAst, "streamAst"); + __name2(streamAst, "streamAst"); + __name(isAstNodeInRange, "isAstNodeInRange"); + __name2(isAstNodeInRange, "isAstNodeInRange"); + __name(streamReferences, "streamReferences"); + __name2(streamReferences, "streamReferences"); + __name(assignMandatoryProperties, "assignMandatoryProperties"); + __name2(assignMandatoryProperties, "assignMandatoryProperties"); + __name(copyDefaultValue, "copyDefaultValue"); + __name2(copyDefaultValue, "copyDefaultValue"); + __name(copyAstNode, "copyAstNode"); + __name2(copyAstNode, "copyAstNode"); + ast_exports = {}; + __export2(ast_exports, { + AbstractElement: /* @__PURE__ */ __name(() => AbstractElement, "AbstractElement"), + AbstractParserRule: /* @__PURE__ */ __name(() => AbstractParserRule, "AbstractParserRule"), + AbstractRule: /* @__PURE__ */ __name(() => AbstractRule, "AbstractRule"), + AbstractType: /* @__PURE__ */ __name(() => AbstractType, "AbstractType"), + Action: /* @__PURE__ */ __name(() => Action, "Action"), + Alternatives: /* @__PURE__ */ __name(() => Alternatives, "Alternatives"), + ArrayLiteral: /* @__PURE__ */ __name(() => ArrayLiteral, "ArrayLiteral"), + ArrayType: /* @__PURE__ */ __name(() => ArrayType, "ArrayType"), + Assignment: /* @__PURE__ */ __name(() => Assignment, "Assignment"), + BooleanLiteral: /* @__PURE__ */ __name(() => BooleanLiteral, "BooleanLiteral"), + CharacterRange: /* @__PURE__ */ __name(() => CharacterRange, "CharacterRange"), + Condition: /* @__PURE__ */ __name(() => Condition, "Condition"), + Conjunction: /* @__PURE__ */ __name(() => Conjunction, "Conjunction"), + CrossReference: /* @__PURE__ */ __name(() => CrossReference, "CrossReference"), + Disjunction: /* @__PURE__ */ __name(() => Disjunction, "Disjunction"), + EndOfFile: /* @__PURE__ */ __name(() => EndOfFile, "EndOfFile"), + Grammar: /* @__PURE__ */ __name(() => Grammar, "Grammar"), + GrammarImport: /* @__PURE__ */ __name(() => GrammarImport, "GrammarImport"), + Group: /* @__PURE__ */ __name(() => Group, "Group"), + InferredType: /* @__PURE__ */ __name(() => InferredType, "InferredType"), + InfixRule: /* @__PURE__ */ __name(() => InfixRule, "InfixRule"), + InfixRuleOperatorList: /* @__PURE__ */ __name(() => InfixRuleOperatorList, "InfixRuleOperatorList"), + InfixRuleOperators: /* @__PURE__ */ __name(() => InfixRuleOperators, "InfixRuleOperators"), + Interface: /* @__PURE__ */ __name(() => Interface, "Interface"), + Keyword: /* @__PURE__ */ __name(() => Keyword2, "Keyword"), + LangiumGrammarAstReflection: /* @__PURE__ */ __name(() => LangiumGrammarAstReflection, "LangiumGrammarAstReflection"), + LangiumGrammarTerminals: /* @__PURE__ */ __name(() => LangiumGrammarTerminals, "LangiumGrammarTerminals"), + NamedArgument: /* @__PURE__ */ __name(() => NamedArgument, "NamedArgument"), + NegatedToken: /* @__PURE__ */ __name(() => NegatedToken, "NegatedToken"), + Negation: /* @__PURE__ */ __name(() => Negation, "Negation"), + NumberLiteral: /* @__PURE__ */ __name(() => NumberLiteral, "NumberLiteral"), + Parameter: /* @__PURE__ */ __name(() => Parameter, "Parameter"), + ParameterReference: /* @__PURE__ */ __name(() => ParameterReference, "ParameterReference"), + ParserRule: /* @__PURE__ */ __name(() => ParserRule, "ParserRule"), + ReferenceType: /* @__PURE__ */ __name(() => ReferenceType, "ReferenceType"), + RegexToken: /* @__PURE__ */ __name(() => RegexToken, "RegexToken"), + ReturnType: /* @__PURE__ */ __name(() => ReturnType, "ReturnType"), + RuleCall: /* @__PURE__ */ __name(() => RuleCall, "RuleCall"), + SimpleType: /* @__PURE__ */ __name(() => SimpleType, "SimpleType"), + StringLiteral: /* @__PURE__ */ __name(() => StringLiteral, "StringLiteral"), + TerminalAlternatives: /* @__PURE__ */ __name(() => TerminalAlternatives, "TerminalAlternatives"), + TerminalElement: /* @__PURE__ */ __name(() => TerminalElement, "TerminalElement"), + TerminalGroup: /* @__PURE__ */ __name(() => TerminalGroup, "TerminalGroup"), + TerminalRule: /* @__PURE__ */ __name(() => TerminalRule, "TerminalRule"), + TerminalRuleCall: /* @__PURE__ */ __name(() => TerminalRuleCall, "TerminalRuleCall"), + Type: /* @__PURE__ */ __name(() => Type3, "Type"), + TypeAttribute: /* @__PURE__ */ __name(() => TypeAttribute, "TypeAttribute"), + TypeDefinition: /* @__PURE__ */ __name(() => TypeDefinition, "TypeDefinition"), + UnionType: /* @__PURE__ */ __name(() => UnionType, "UnionType"), + UnorderedGroup: /* @__PURE__ */ __name(() => UnorderedGroup, "UnorderedGroup"), + UntilToken: /* @__PURE__ */ __name(() => UntilToken, "UntilToken"), + ValueLiteral: /* @__PURE__ */ __name(() => ValueLiteral, "ValueLiteral"), + Wildcard: /* @__PURE__ */ __name(() => Wildcard, "Wildcard"), + isAbstractElement: /* @__PURE__ */ __name(() => isAbstractElement, "isAbstractElement"), + isAbstractParserRule: /* @__PURE__ */ __name(() => isAbstractParserRule, "isAbstractParserRule"), + isAbstractRule: /* @__PURE__ */ __name(() => isAbstractRule, "isAbstractRule"), + isAbstractType: /* @__PURE__ */ __name(() => isAbstractType, "isAbstractType"), + isAction: /* @__PURE__ */ __name(() => isAction, "isAction"), + isAlternatives: /* @__PURE__ */ __name(() => isAlternatives, "isAlternatives"), + isArrayLiteral: /* @__PURE__ */ __name(() => isArrayLiteral, "isArrayLiteral"), + isArrayType: /* @__PURE__ */ __name(() => isArrayType, "isArrayType"), + isAssignment: /* @__PURE__ */ __name(() => isAssignment, "isAssignment"), + isBooleanLiteral: /* @__PURE__ */ __name(() => isBooleanLiteral, "isBooleanLiteral"), + isCharacterRange: /* @__PURE__ */ __name(() => isCharacterRange, "isCharacterRange"), + isCondition: /* @__PURE__ */ __name(() => isCondition, "isCondition"), + isConjunction: /* @__PURE__ */ __name(() => isConjunction, "isConjunction"), + isCrossReference: /* @__PURE__ */ __name(() => isCrossReference, "isCrossReference"), + isDisjunction: /* @__PURE__ */ __name(() => isDisjunction, "isDisjunction"), + isEndOfFile: /* @__PURE__ */ __name(() => isEndOfFile, "isEndOfFile"), + isGrammar: /* @__PURE__ */ __name(() => isGrammar, "isGrammar"), + isGrammarImport: /* @__PURE__ */ __name(() => isGrammarImport, "isGrammarImport"), + isGroup: /* @__PURE__ */ __name(() => isGroup, "isGroup"), + isInferredType: /* @__PURE__ */ __name(() => isInferredType, "isInferredType"), + isInfixRule: /* @__PURE__ */ __name(() => isInfixRule, "isInfixRule"), + isInfixRuleOperatorList: /* @__PURE__ */ __name(() => isInfixRuleOperatorList, "isInfixRuleOperatorList"), + isInfixRuleOperators: /* @__PURE__ */ __name(() => isInfixRuleOperators, "isInfixRuleOperators"), + isInterface: /* @__PURE__ */ __name(() => isInterface, "isInterface"), + isKeyword: /* @__PURE__ */ __name(() => isKeyword, "isKeyword"), + isNamedArgument: /* @__PURE__ */ __name(() => isNamedArgument, "isNamedArgument"), + isNegatedToken: /* @__PURE__ */ __name(() => isNegatedToken, "isNegatedToken"), + isNegation: /* @__PURE__ */ __name(() => isNegation, "isNegation"), + isNumberLiteral: /* @__PURE__ */ __name(() => isNumberLiteral, "isNumberLiteral"), + isParameter: /* @__PURE__ */ __name(() => isParameter, "isParameter"), + isParameterReference: /* @__PURE__ */ __name(() => isParameterReference, "isParameterReference"), + isParserRule: /* @__PURE__ */ __name(() => isParserRule, "isParserRule"), + isReferenceType: /* @__PURE__ */ __name(() => isReferenceType, "isReferenceType"), + isRegexToken: /* @__PURE__ */ __name(() => isRegexToken, "isRegexToken"), + isReturnType: /* @__PURE__ */ __name(() => isReturnType, "isReturnType"), + isRuleCall: /* @__PURE__ */ __name(() => isRuleCall, "isRuleCall"), + isSimpleType: /* @__PURE__ */ __name(() => isSimpleType, "isSimpleType"), + isStringLiteral: /* @__PURE__ */ __name(() => isStringLiteral, "isStringLiteral"), + isTerminalAlternatives: /* @__PURE__ */ __name(() => isTerminalAlternatives, "isTerminalAlternatives"), + isTerminalElement: /* @__PURE__ */ __name(() => isTerminalElement, "isTerminalElement"), + isTerminalGroup: /* @__PURE__ */ __name(() => isTerminalGroup, "isTerminalGroup"), + isTerminalRule: /* @__PURE__ */ __name(() => isTerminalRule, "isTerminalRule"), + isTerminalRuleCall: /* @__PURE__ */ __name(() => isTerminalRuleCall, "isTerminalRuleCall"), + isType: /* @__PURE__ */ __name(() => isType, "isType"), + isTypeAttribute: /* @__PURE__ */ __name(() => isTypeAttribute, "isTypeAttribute"), + isTypeDefinition: /* @__PURE__ */ __name(() => isTypeDefinition, "isTypeDefinition"), + isUnionType: /* @__PURE__ */ __name(() => isUnionType, "isUnionType"), + isUnorderedGroup: /* @__PURE__ */ __name(() => isUnorderedGroup, "isUnorderedGroup"), + isUntilToken: /* @__PURE__ */ __name(() => isUntilToken, "isUntilToken"), + isValueLiteral: /* @__PURE__ */ __name(() => isValueLiteral, "isValueLiteral"), + isWildcard: /* @__PURE__ */ __name(() => isWildcard, "isWildcard"), + reflection: /* @__PURE__ */ __name(() => reflection, "reflection") + }); + LangiumGrammarTerminals = { + ID: /\^?[_a-zA-Z][\w_]*/, + STRING: /"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/, + NUMBER: /NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/, + RegexLiteral: /\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/, + WS: /\s+/, + ML_COMMENT: /\/\*[\s\S]*?\*\//, + SL_COMMENT: /\/\/[^\n\r]*/ + }; + AbstractElement = { + $type: "AbstractElement", + cardinality: "cardinality" + }; + __name(isAbstractElement, "isAbstractElement"); + __name2(isAbstractElement, "isAbstractElement"); + AbstractParserRule = { + $type: "AbstractParserRule" + }; + __name(isAbstractParserRule, "isAbstractParserRule"); + __name2(isAbstractParserRule, "isAbstractParserRule"); + AbstractRule = { + $type: "AbstractRule" + }; + __name(isAbstractRule, "isAbstractRule"); + __name2(isAbstractRule, "isAbstractRule"); + AbstractType = { + $type: "AbstractType" + }; + __name(isAbstractType, "isAbstractType"); + __name2(isAbstractType, "isAbstractType"); + Action = { + $type: "Action", + cardinality: "cardinality", + feature: "feature", + inferredType: "inferredType", + operator: "operator", + type: "type" + }; + __name(isAction, "isAction"); + __name2(isAction, "isAction"); + Alternatives = { + $type: "Alternatives", + cardinality: "cardinality", + elements: "elements" + }; + __name(isAlternatives, "isAlternatives"); + __name2(isAlternatives, "isAlternatives"); + ArrayLiteral = { + $type: "ArrayLiteral", + elements: "elements" + }; + __name(isArrayLiteral, "isArrayLiteral"); + __name2(isArrayLiteral, "isArrayLiteral"); + ArrayType = { + $type: "ArrayType", + elementType: "elementType" + }; + __name(isArrayType, "isArrayType"); + __name2(isArrayType, "isArrayType"); + Assignment = { + $type: "Assignment", + cardinality: "cardinality", + feature: "feature", + operator: "operator", + predicate: "predicate", + terminal: "terminal" + }; + __name(isAssignment, "isAssignment"); + __name2(isAssignment, "isAssignment"); + BooleanLiteral = { + $type: "BooleanLiteral", + true: "true" + }; + __name(isBooleanLiteral, "isBooleanLiteral"); + __name2(isBooleanLiteral, "isBooleanLiteral"); + CharacterRange = { + $type: "CharacterRange", + cardinality: "cardinality", + left: "left", + lookahead: "lookahead", + parenthesized: "parenthesized", + right: "right" + }; + __name(isCharacterRange, "isCharacterRange"); + __name2(isCharacterRange, "isCharacterRange"); + Condition = { + $type: "Condition" + }; + __name(isCondition, "isCondition"); + __name2(isCondition, "isCondition"); + Conjunction = { + $type: "Conjunction", + left: "left", + right: "right" + }; + __name(isConjunction, "isConjunction"); + __name2(isConjunction, "isConjunction"); + CrossReference = { + $type: "CrossReference", + cardinality: "cardinality", + deprecatedSyntax: "deprecatedSyntax", + isMulti: "isMulti", + terminal: "terminal", + type: "type" + }; + __name(isCrossReference, "isCrossReference"); + __name2(isCrossReference, "isCrossReference"); + Disjunction = { + $type: "Disjunction", + left: "left", + right: "right" + }; + __name(isDisjunction, "isDisjunction"); + __name2(isDisjunction, "isDisjunction"); + EndOfFile = { + $type: "EndOfFile", + cardinality: "cardinality" + }; + __name(isEndOfFile, "isEndOfFile"); + __name2(isEndOfFile, "isEndOfFile"); + Grammar = { + $type: "Grammar", + imports: "imports", + interfaces: "interfaces", + isDeclared: "isDeclared", + name: "name", + rules: "rules", + types: "types" + }; + __name(isGrammar, "isGrammar"); + __name2(isGrammar, "isGrammar"); + GrammarImport = { + $type: "GrammarImport", + path: "path" + }; + __name(isGrammarImport, "isGrammarImport"); + __name2(isGrammarImport, "isGrammarImport"); + Group = { + $type: "Group", + cardinality: "cardinality", + elements: "elements", + guardCondition: "guardCondition", + predicate: "predicate" + }; + __name(isGroup, "isGroup"); + __name2(isGroup, "isGroup"); + InferredType = { + $type: "InferredType", + name: "name" + }; + __name(isInferredType, "isInferredType"); + __name2(isInferredType, "isInferredType"); + InfixRule = { + $type: "InfixRule", + call: "call", + dataType: "dataType", + inferredType: "inferredType", + name: "name", + operators: "operators", + parameters: "parameters", + returnType: "returnType" + }; + __name(isInfixRule, "isInfixRule"); + __name2(isInfixRule, "isInfixRule"); + InfixRuleOperatorList = { + $type: "InfixRuleOperatorList", + associativity: "associativity", + operators: "operators" + }; + __name(isInfixRuleOperatorList, "isInfixRuleOperatorList"); + __name2(isInfixRuleOperatorList, "isInfixRuleOperatorList"); + InfixRuleOperators = { + $type: "InfixRuleOperators", + precedences: "precedences" + }; + __name(isInfixRuleOperators, "isInfixRuleOperators"); + __name2(isInfixRuleOperators, "isInfixRuleOperators"); + Interface = { + $type: "Interface", + attributes: "attributes", + name: "name", + superTypes: "superTypes" + }; + __name(isInterface, "isInterface"); + __name2(isInterface, "isInterface"); + Keyword2 = { + $type: "Keyword", + cardinality: "cardinality", + predicate: "predicate", + value: "value" + }; + __name(isKeyword, "isKeyword"); + __name2(isKeyword, "isKeyword"); + NamedArgument = { + $type: "NamedArgument", + calledByName: "calledByName", + parameter: "parameter", + value: "value" + }; + __name(isNamedArgument, "isNamedArgument"); + __name2(isNamedArgument, "isNamedArgument"); + NegatedToken = { + $type: "NegatedToken", + cardinality: "cardinality", + lookahead: "lookahead", + parenthesized: "parenthesized", + terminal: "terminal" + }; + __name(isNegatedToken, "isNegatedToken"); + __name2(isNegatedToken, "isNegatedToken"); + Negation = { + $type: "Negation", + value: "value" + }; + __name(isNegation, "isNegation"); + __name2(isNegation, "isNegation"); + NumberLiteral = { + $type: "NumberLiteral", + value: "value" + }; + __name(isNumberLiteral, "isNumberLiteral"); + __name2(isNumberLiteral, "isNumberLiteral"); + Parameter = { + $type: "Parameter", + name: "name" + }; + __name(isParameter, "isParameter"); + __name2(isParameter, "isParameter"); + ParameterReference = { + $type: "ParameterReference", + parameter: "parameter" + }; + __name(isParameterReference, "isParameterReference"); + __name2(isParameterReference, "isParameterReference"); + ParserRule = { + $type: "ParserRule", + dataType: "dataType", + definition: "definition", + entry: "entry", + fragment: "fragment", + inferredType: "inferredType", + name: "name", + parameters: "parameters", + returnType: "returnType" + }; + __name(isParserRule, "isParserRule"); + __name2(isParserRule, "isParserRule"); + ReferenceType = { + $type: "ReferenceType", + isMulti: "isMulti", + referenceType: "referenceType" + }; + __name(isReferenceType, "isReferenceType"); + __name2(isReferenceType, "isReferenceType"); + RegexToken = { + $type: "RegexToken", + cardinality: "cardinality", + lookahead: "lookahead", + parenthesized: "parenthesized", + regex: "regex" + }; + __name(isRegexToken, "isRegexToken"); + __name2(isRegexToken, "isRegexToken"); + ReturnType = { + $type: "ReturnType", + name: "name" + }; + __name(isReturnType, "isReturnType"); + __name2(isReturnType, "isReturnType"); + RuleCall = { + $type: "RuleCall", + arguments: "arguments", + cardinality: "cardinality", + predicate: "predicate", + rule: "rule" + }; + __name(isRuleCall, "isRuleCall"); + __name2(isRuleCall, "isRuleCall"); + SimpleType = { + $type: "SimpleType", + primitiveType: "primitiveType", + stringType: "stringType", + typeRef: "typeRef" + }; + __name(isSimpleType, "isSimpleType"); + __name2(isSimpleType, "isSimpleType"); + StringLiteral = { + $type: "StringLiteral", + value: "value" + }; + __name(isStringLiteral, "isStringLiteral"); + __name2(isStringLiteral, "isStringLiteral"); + TerminalAlternatives = { + $type: "TerminalAlternatives", + cardinality: "cardinality", + elements: "elements", + lookahead: "lookahead", + parenthesized: "parenthesized" + }; + __name(isTerminalAlternatives, "isTerminalAlternatives"); + __name2(isTerminalAlternatives, "isTerminalAlternatives"); + TerminalElement = { + $type: "TerminalElement", + cardinality: "cardinality", + lookahead: "lookahead", + parenthesized: "parenthesized" + }; + __name(isTerminalElement, "isTerminalElement"); + __name2(isTerminalElement, "isTerminalElement"); + TerminalGroup = { + $type: "TerminalGroup", + cardinality: "cardinality", + elements: "elements", + lookahead: "lookahead", + parenthesized: "parenthesized" + }; + __name(isTerminalGroup, "isTerminalGroup"); + __name2(isTerminalGroup, "isTerminalGroup"); + TerminalRule = { + $type: "TerminalRule", + definition: "definition", + fragment: "fragment", + hidden: "hidden", + name: "name", + type: "type" + }; + __name(isTerminalRule, "isTerminalRule"); + __name2(isTerminalRule, "isTerminalRule"); + TerminalRuleCall = { + $type: "TerminalRuleCall", + cardinality: "cardinality", + lookahead: "lookahead", + parenthesized: "parenthesized", + rule: "rule" + }; + __name(isTerminalRuleCall, "isTerminalRuleCall"); + __name2(isTerminalRuleCall, "isTerminalRuleCall"); + Type3 = { + $type: "Type", + name: "name", + type: "type" + }; + __name(isType, "isType"); + __name2(isType, "isType"); + TypeAttribute = { + $type: "TypeAttribute", + defaultValue: "defaultValue", + isOptional: "isOptional", + name: "name", + type: "type" + }; + __name(isTypeAttribute, "isTypeAttribute"); + __name2(isTypeAttribute, "isTypeAttribute"); + TypeDefinition = { + $type: "TypeDefinition" + }; + __name(isTypeDefinition, "isTypeDefinition"); + __name2(isTypeDefinition, "isTypeDefinition"); + UnionType = { + $type: "UnionType", + types: "types" + }; + __name(isUnionType, "isUnionType"); + __name2(isUnionType, "isUnionType"); + UnorderedGroup = { + $type: "UnorderedGroup", + cardinality: "cardinality", + elements: "elements" + }; + __name(isUnorderedGroup, "isUnorderedGroup"); + __name2(isUnorderedGroup, "isUnorderedGroup"); + UntilToken = { + $type: "UntilToken", + cardinality: "cardinality", + lookahead: "lookahead", + parenthesized: "parenthesized", + terminal: "terminal" + }; + __name(isUntilToken, "isUntilToken"); + __name2(isUntilToken, "isUntilToken"); + ValueLiteral = { + $type: "ValueLiteral" + }; + __name(isValueLiteral, "isValueLiteral"); + __name2(isValueLiteral, "isValueLiteral"); + Wildcard = { + $type: "Wildcard", + cardinality: "cardinality", + lookahead: "lookahead", + parenthesized: "parenthesized" + }; + __name(isWildcard, "isWildcard"); + __name2(isWildcard, "isWildcard"); + LangiumGrammarAstReflection = class extends AbstractAstReflection { + static { + __name(this, "LangiumGrammarAstReflection"); + } + static { + __name2(this, "LangiumGrammarAstReflection"); + } + constructor() { + super(...arguments); + this.types = { + AbstractElement: { + name: AbstractElement.$type, + properties: { + cardinality: { + name: AbstractElement.cardinality + } + }, + superTypes: [] + }, + AbstractParserRule: { + name: AbstractParserRule.$type, + properties: {}, + superTypes: [AbstractRule.$type, AbstractType.$type] + }, + AbstractRule: { + name: AbstractRule.$type, + properties: {}, + superTypes: [] + }, + AbstractType: { + name: AbstractType.$type, + properties: {}, + superTypes: [] + }, + Action: { + name: Action.$type, + properties: { + cardinality: { + name: Action.cardinality + }, + feature: { + name: Action.feature + }, + inferredType: { + name: Action.inferredType + }, + operator: { + name: Action.operator + }, + type: { + name: Action.type, + referenceType: AbstractType.$type + } + }, + superTypes: [AbstractElement.$type] + }, + Alternatives: { + name: Alternatives.$type, + properties: { + cardinality: { + name: Alternatives.cardinality + }, + elements: { + name: Alternatives.elements, + defaultValue: [] + } + }, + superTypes: [AbstractElement.$type] + }, + ArrayLiteral: { + name: ArrayLiteral.$type, + properties: { + elements: { + name: ArrayLiteral.elements, + defaultValue: [] + } + }, + superTypes: [ValueLiteral.$type] + }, + ArrayType: { + name: ArrayType.$type, + properties: { + elementType: { + name: ArrayType.elementType + } + }, + superTypes: [TypeDefinition.$type] + }, + Assignment: { + name: Assignment.$type, + properties: { + cardinality: { + name: Assignment.cardinality + }, + feature: { + name: Assignment.feature + }, + operator: { + name: Assignment.operator + }, + predicate: { + name: Assignment.predicate + }, + terminal: { + name: Assignment.terminal + } + }, + superTypes: [AbstractElement.$type] + }, + BooleanLiteral: { + name: BooleanLiteral.$type, + properties: { + true: { + name: BooleanLiteral.true, + defaultValue: false + } + }, + superTypes: [Condition.$type, ValueLiteral.$type] + }, + CharacterRange: { + name: CharacterRange.$type, + properties: { + cardinality: { + name: CharacterRange.cardinality + }, + left: { + name: CharacterRange.left + }, + lookahead: { + name: CharacterRange.lookahead + }, + parenthesized: { + name: CharacterRange.parenthesized, + defaultValue: false + }, + right: { + name: CharacterRange.right + } + }, + superTypes: [TerminalElement.$type] + }, + Condition: { + name: Condition.$type, + properties: {}, + superTypes: [] + }, + Conjunction: { + name: Conjunction.$type, + properties: { + left: { + name: Conjunction.left + }, + right: { + name: Conjunction.right + } + }, + superTypes: [Condition.$type] + }, + CrossReference: { + name: CrossReference.$type, + properties: { + cardinality: { + name: CrossReference.cardinality + }, + deprecatedSyntax: { + name: CrossReference.deprecatedSyntax, + defaultValue: false + }, + isMulti: { + name: CrossReference.isMulti, + defaultValue: false + }, + terminal: { + name: CrossReference.terminal + }, + type: { + name: CrossReference.type, + referenceType: AbstractType.$type + } + }, + superTypes: [AbstractElement.$type] + }, + Disjunction: { + name: Disjunction.$type, + properties: { + left: { + name: Disjunction.left + }, + right: { + name: Disjunction.right + } + }, + superTypes: [Condition.$type] + }, + EndOfFile: { + name: EndOfFile.$type, + properties: { + cardinality: { + name: EndOfFile.cardinality + } + }, + superTypes: [AbstractElement.$type] + }, + Grammar: { + name: Grammar.$type, + properties: { + imports: { + name: Grammar.imports, + defaultValue: [] + }, + interfaces: { + name: Grammar.interfaces, + defaultValue: [] + }, + isDeclared: { + name: Grammar.isDeclared, + defaultValue: false + }, + name: { + name: Grammar.name + }, + rules: { + name: Grammar.rules, + defaultValue: [] + }, + types: { + name: Grammar.types, + defaultValue: [] + } + }, + superTypes: [] + }, + GrammarImport: { + name: GrammarImport.$type, + properties: { + path: { + name: GrammarImport.path + } + }, + superTypes: [] + }, + Group: { + name: Group.$type, + properties: { + cardinality: { + name: Group.cardinality + }, + elements: { + name: Group.elements, + defaultValue: [] + }, + guardCondition: { + name: Group.guardCondition + }, + predicate: { + name: Group.predicate + } + }, + superTypes: [AbstractElement.$type] + }, + InferredType: { + name: InferredType.$type, + properties: { + name: { + name: InferredType.name + } + }, + superTypes: [AbstractType.$type] + }, + InfixRule: { + name: InfixRule.$type, + properties: { + call: { + name: InfixRule.call + }, + dataType: { + name: InfixRule.dataType + }, + inferredType: { + name: InfixRule.inferredType + }, + name: { + name: InfixRule.name + }, + operators: { + name: InfixRule.operators + }, + parameters: { + name: InfixRule.parameters, + defaultValue: [] + }, + returnType: { + name: InfixRule.returnType, + referenceType: AbstractType.$type + } + }, + superTypes: [AbstractParserRule.$type] + }, + InfixRuleOperatorList: { + name: InfixRuleOperatorList.$type, + properties: { + associativity: { + name: InfixRuleOperatorList.associativity + }, + operators: { + name: InfixRuleOperatorList.operators, + defaultValue: [] + } + }, + superTypes: [] + }, + InfixRuleOperators: { + name: InfixRuleOperators.$type, + properties: { + precedences: { + name: InfixRuleOperators.precedences, + defaultValue: [] + } + }, + superTypes: [] + }, + Interface: { + name: Interface.$type, + properties: { + attributes: { + name: Interface.attributes, + defaultValue: [] + }, + name: { + name: Interface.name + }, + superTypes: { + name: Interface.superTypes, + defaultValue: [], + referenceType: AbstractType.$type + } + }, + superTypes: [AbstractType.$type] + }, + Keyword: { + name: Keyword2.$type, + properties: { + cardinality: { + name: Keyword2.cardinality + }, + predicate: { + name: Keyword2.predicate + }, + value: { + name: Keyword2.value + } + }, + superTypes: [AbstractElement.$type] + }, + NamedArgument: { + name: NamedArgument.$type, + properties: { + calledByName: { + name: NamedArgument.calledByName, + defaultValue: false + }, + parameter: { + name: NamedArgument.parameter, + referenceType: Parameter.$type + }, + value: { + name: NamedArgument.value + } + }, + superTypes: [] + }, + NegatedToken: { + name: NegatedToken.$type, + properties: { + cardinality: { + name: NegatedToken.cardinality + }, + lookahead: { + name: NegatedToken.lookahead + }, + parenthesized: { + name: NegatedToken.parenthesized, + defaultValue: false + }, + terminal: { + name: NegatedToken.terminal + } + }, + superTypes: [TerminalElement.$type] + }, + Negation: { + name: Negation.$type, + properties: { + value: { + name: Negation.value + } + }, + superTypes: [Condition.$type] + }, + NumberLiteral: { + name: NumberLiteral.$type, + properties: { + value: { + name: NumberLiteral.value + } + }, + superTypes: [ValueLiteral.$type] + }, + Parameter: { + name: Parameter.$type, + properties: { + name: { + name: Parameter.name + } + }, + superTypes: [] + }, + ParameterReference: { + name: ParameterReference.$type, + properties: { + parameter: { + name: ParameterReference.parameter, + referenceType: Parameter.$type + } + }, + superTypes: [Condition.$type] + }, + ParserRule: { + name: ParserRule.$type, + properties: { + dataType: { + name: ParserRule.dataType + }, + definition: { + name: ParserRule.definition + }, + entry: { + name: ParserRule.entry, + defaultValue: false + }, + fragment: { + name: ParserRule.fragment, + defaultValue: false + }, + inferredType: { + name: ParserRule.inferredType + }, + name: { + name: ParserRule.name + }, + parameters: { + name: ParserRule.parameters, + defaultValue: [] + }, + returnType: { + name: ParserRule.returnType, + referenceType: AbstractType.$type + } + }, + superTypes: [AbstractParserRule.$type] + }, + ReferenceType: { + name: ReferenceType.$type, + properties: { + isMulti: { + name: ReferenceType.isMulti, + defaultValue: false + }, + referenceType: { + name: ReferenceType.referenceType + } + }, + superTypes: [TypeDefinition.$type] + }, + RegexToken: { + name: RegexToken.$type, + properties: { + cardinality: { + name: RegexToken.cardinality + }, + lookahead: { + name: RegexToken.lookahead + }, + parenthesized: { + name: RegexToken.parenthesized, + defaultValue: false + }, + regex: { + name: RegexToken.regex + } + }, + superTypes: [TerminalElement.$type] + }, + ReturnType: { + name: ReturnType.$type, + properties: { + name: { + name: ReturnType.name + } + }, + superTypes: [] + }, + RuleCall: { + name: RuleCall.$type, + properties: { + arguments: { + name: RuleCall.arguments, + defaultValue: [] + }, + cardinality: { + name: RuleCall.cardinality + }, + predicate: { + name: RuleCall.predicate + }, + rule: { + name: RuleCall.rule, + referenceType: AbstractRule.$type + } + }, + superTypes: [AbstractElement.$type] + }, + SimpleType: { + name: SimpleType.$type, + properties: { + primitiveType: { + name: SimpleType.primitiveType + }, + stringType: { + name: SimpleType.stringType + }, + typeRef: { + name: SimpleType.typeRef, + referenceType: AbstractType.$type + } + }, + superTypes: [TypeDefinition.$type] + }, + StringLiteral: { + name: StringLiteral.$type, + properties: { + value: { + name: StringLiteral.value + } + }, + superTypes: [ValueLiteral.$type] + }, + TerminalAlternatives: { + name: TerminalAlternatives.$type, + properties: { + cardinality: { + name: TerminalAlternatives.cardinality + }, + elements: { + name: TerminalAlternatives.elements, + defaultValue: [] + }, + lookahead: { + name: TerminalAlternatives.lookahead + }, + parenthesized: { + name: TerminalAlternatives.parenthesized, + defaultValue: false + } + }, + superTypes: [TerminalElement.$type] + }, + TerminalElement: { + name: TerminalElement.$type, + properties: { + cardinality: { + name: TerminalElement.cardinality + }, + lookahead: { + name: TerminalElement.lookahead + }, + parenthesized: { + name: TerminalElement.parenthesized, + defaultValue: false + } + }, + superTypes: [AbstractElement.$type] + }, + TerminalGroup: { + name: TerminalGroup.$type, + properties: { + cardinality: { + name: TerminalGroup.cardinality + }, + elements: { + name: TerminalGroup.elements, + defaultValue: [] + }, + lookahead: { + name: TerminalGroup.lookahead + }, + parenthesized: { + name: TerminalGroup.parenthesized, + defaultValue: false + } + }, + superTypes: [TerminalElement.$type] + }, + TerminalRule: { + name: TerminalRule.$type, + properties: { + definition: { + name: TerminalRule.definition + }, + fragment: { + name: TerminalRule.fragment, + defaultValue: false + }, + hidden: { + name: TerminalRule.hidden, + defaultValue: false + }, + name: { + name: TerminalRule.name + }, + type: { + name: TerminalRule.type + } + }, + superTypes: [AbstractRule.$type] + }, + TerminalRuleCall: { + name: TerminalRuleCall.$type, + properties: { + cardinality: { + name: TerminalRuleCall.cardinality + }, + lookahead: { + name: TerminalRuleCall.lookahead + }, + parenthesized: { + name: TerminalRuleCall.parenthesized, + defaultValue: false + }, + rule: { + name: TerminalRuleCall.rule, + referenceType: TerminalRule.$type + } + }, + superTypes: [TerminalElement.$type] + }, + Type: { + name: Type3.$type, + properties: { + name: { + name: Type3.name + }, + type: { + name: Type3.type + } + }, + superTypes: [AbstractType.$type] + }, + TypeAttribute: { + name: TypeAttribute.$type, + properties: { + defaultValue: { + name: TypeAttribute.defaultValue + }, + isOptional: { + name: TypeAttribute.isOptional, + defaultValue: false + }, + name: { + name: TypeAttribute.name + }, + type: { + name: TypeAttribute.type + } + }, + superTypes: [] + }, + TypeDefinition: { + name: TypeDefinition.$type, + properties: {}, + superTypes: [] + }, + UnionType: { + name: UnionType.$type, + properties: { + types: { + name: UnionType.types, + defaultValue: [] + } + }, + superTypes: [TypeDefinition.$type] + }, + UnorderedGroup: { + name: UnorderedGroup.$type, + properties: { + cardinality: { + name: UnorderedGroup.cardinality + }, + elements: { + name: UnorderedGroup.elements, + defaultValue: [] + } + }, + superTypes: [AbstractElement.$type] + }, + UntilToken: { + name: UntilToken.$type, + properties: { + cardinality: { + name: UntilToken.cardinality + }, + lookahead: { + name: UntilToken.lookahead + }, + parenthesized: { + name: UntilToken.parenthesized, + defaultValue: false + }, + terminal: { + name: UntilToken.terminal + } + }, + superTypes: [TerminalElement.$type] + }, + ValueLiteral: { + name: ValueLiteral.$type, + properties: {}, + superTypes: [] + }, + Wildcard: { + name: Wildcard.$type, + properties: { + cardinality: { + name: Wildcard.cardinality + }, + lookahead: { + name: Wildcard.lookahead + }, + parenthesized: { + name: Wildcard.parenthesized, + defaultValue: false + } + }, + superTypes: [TerminalElement.$type] + } + }; + } + }; + reflection = new LangiumGrammarAstReflection(); + __name(getDatatypeNode, "getDatatypeNode"); + __name2(getDatatypeNode, "getDatatypeNode"); + __name(streamCst, "streamCst"); + __name2(streamCst, "streamCst"); + __name(flattenCst, "flattenCst"); + __name2(flattenCst, "flattenCst"); + __name(isChildNode, "isChildNode"); + __name2(isChildNode, "isChildNode"); + __name(tokenToRange, "tokenToRange"); + __name2(tokenToRange, "tokenToRange"); + __name(toDocumentSegment, "toDocumentSegment"); + __name2(toDocumentSegment, "toDocumentSegment"); + (function(RangeComparison2) { + RangeComparison2[RangeComparison2["Before"] = 0] = "Before"; + RangeComparison2[RangeComparison2["After"] = 1] = "After"; + RangeComparison2[RangeComparison2["OverlapFront"] = 2] = "OverlapFront"; + RangeComparison2[RangeComparison2["OverlapBack"] = 3] = "OverlapBack"; + RangeComparison2[RangeComparison2["Inside"] = 4] = "Inside"; + RangeComparison2[RangeComparison2["Outside"] = 5] = "Outside"; + })(RangeComparison || (RangeComparison = {})); + __name(compareRange, "compareRange"); + __name2(compareRange, "compareRange"); + __name(inRange, "inRange"); + __name2(inRange, "inRange"); + DefaultNameRegexp = /^[\w\p{L}]$/u; + __name(findDeclarationNodeAtOffset, "findDeclarationNodeAtOffset"); + __name2(findDeclarationNodeAtOffset, "findDeclarationNodeAtOffset"); + __name(findCommentNode, "findCommentNode"); + __name2(findCommentNode, "findCommentNode"); + __name(isCommentNode, "isCommentNode"); + __name2(isCommentNode, "isCommentNode"); + __name(findLeafNodeAtOffset, "findLeafNodeAtOffset"); + __name2(findLeafNodeAtOffset, "findLeafNodeAtOffset"); + __name(findLeafNodeBeforeOffset, "findLeafNodeBeforeOffset"); + __name2(findLeafNodeBeforeOffset, "findLeafNodeBeforeOffset"); + __name(binarySearch, "binarySearch"); + __name2(binarySearch, "binarySearch"); + __name(getPreviousNode, "getPreviousNode"); + __name2(getPreviousNode, "getPreviousNode"); + __name(getNextNode, "getNextNode"); + __name2(getNextNode, "getNextNode"); + __name(getStartlineNode, "getStartlineNode"); + __name2(getStartlineNode, "getStartlineNode"); + __name(getInteriorNodes, "getInteriorNodes"); + __name2(getInteriorNodes, "getInteriorNodes"); + __name(getCommonParent, "getCommonParent"); + __name2(getCommonParent, "getCommonParent"); + __name(getParentChain, "getParentChain"); + __name2(getParentChain, "getParentChain"); + grammar_utils_exports = {}; + __export2(grammar_utils_exports, { + findAssignment: /* @__PURE__ */ __name(() => findAssignment, "findAssignment"), + findNameAssignment: /* @__PURE__ */ __name(() => findNameAssignment, "findNameAssignment"), + findNodeForKeyword: /* @__PURE__ */ __name(() => findNodeForKeyword, "findNodeForKeyword"), + findNodeForProperty: /* @__PURE__ */ __name(() => findNodeForProperty, "findNodeForProperty"), + findNodesForKeyword: /* @__PURE__ */ __name(() => findNodesForKeyword, "findNodesForKeyword"), + findNodesForKeywordInternal: /* @__PURE__ */ __name(() => findNodesForKeywordInternal, "findNodesForKeywordInternal"), + findNodesForProperty: /* @__PURE__ */ __name(() => findNodesForProperty, "findNodesForProperty"), + getActionAtElement: /* @__PURE__ */ __name(() => getActionAtElement, "getActionAtElement"), + getActionType: /* @__PURE__ */ __name(() => getActionType, "getActionType"), + getAllReachableRules: /* @__PURE__ */ __name(() => getAllReachableRules, "getAllReachableRules"), + getAllRulesUsedForCrossReferences: /* @__PURE__ */ __name(() => getAllRulesUsedForCrossReferences, "getAllRulesUsedForCrossReferences"), + getCrossReferenceTerminal: /* @__PURE__ */ __name(() => getCrossReferenceTerminal, "getCrossReferenceTerminal"), + getEntryRule: /* @__PURE__ */ __name(() => getEntryRule, "getEntryRule"), + getExplicitRuleType: /* @__PURE__ */ __name(() => getExplicitRuleType, "getExplicitRuleType"), + getHiddenRules: /* @__PURE__ */ __name(() => getHiddenRules, "getHiddenRules"), + getRuleType: /* @__PURE__ */ __name(() => getRuleType, "getRuleType"), + getRuleTypeName: /* @__PURE__ */ __name(() => getRuleTypeName, "getRuleTypeName"), + getTypeName: /* @__PURE__ */ __name(() => getTypeName, "getTypeName"), + isArrayCardinality: /* @__PURE__ */ __name(() => isArrayCardinality, "isArrayCardinality"), + isArrayOperator: /* @__PURE__ */ __name(() => isArrayOperator, "isArrayOperator"), + isCommentTerminal: /* @__PURE__ */ __name(() => isCommentTerminal, "isCommentTerminal"), + isDataType: /* @__PURE__ */ __name(() => isDataType, "isDataType"), + isDataTypeRule: /* @__PURE__ */ __name(() => isDataTypeRule, "isDataTypeRule"), + isOptionalCardinality: /* @__PURE__ */ __name(() => isOptionalCardinality, "isOptionalCardinality"), + terminalRegex: /* @__PURE__ */ __name(() => terminalRegex, "terminalRegex") + }); + ErrorWithLocation = class extends Error { + static { + __name(this, "ErrorWithLocation"); + } + static { + __name2(this, "ErrorWithLocation"); + } + constructor(node2, message) { + super(node2 ? `${message} at ${node2.range.start.line}:${node2.range.start.character}` : message); + } + }; + __name(assertUnreachable, "assertUnreachable"); + __name2(assertUnreachable, "assertUnreachable"); + __name(assertCondition, "assertCondition"); + __name2(assertCondition, "assertCondition"); + regexp_utils_exports = {}; + __export2(regexp_utils_exports, { + NEWLINE_REGEXP: /* @__PURE__ */ __name(() => NEWLINE_REGEXP, "NEWLINE_REGEXP"), + escapeRegExp: /* @__PURE__ */ __name(() => escapeRegExp, "escapeRegExp"), + getTerminalParts: /* @__PURE__ */ __name(() => getTerminalParts, "getTerminalParts"), + isMultilineComment: /* @__PURE__ */ __name(() => isMultilineComment, "isMultilineComment"), + isWhitespace: /* @__PURE__ */ __name(() => isWhitespace2, "isWhitespace"), + partialMatches: /* @__PURE__ */ __name(() => partialMatches, "partialMatches"), + partialRegExp: /* @__PURE__ */ __name(() => partialRegExp, "partialRegExp"), + whitespaceCharacters: /* @__PURE__ */ __name(() => whitespaceCharacters, "whitespaceCharacters") + }); + __name(cc, "cc"); + __name2(cc, "cc"); + __name(insertToSet, "insertToSet"); + __name2(insertToSet, "insertToSet"); + __name(addFlag, "addFlag"); + __name2(addFlag, "addFlag"); + __name(ASSERT_EXISTS, "ASSERT_EXISTS"); + __name2(ASSERT_EXISTS, "ASSERT_EXISTS"); + __name(ASSERT_NEVER_REACH_HERE, "ASSERT_NEVER_REACH_HERE"); + __name2(ASSERT_NEVER_REACH_HERE, "ASSERT_NEVER_REACH_HERE"); + __name(isCharacter, "isCharacter"); + __name2(isCharacter, "isCharacter"); + digitsCharCodes = []; + for (let i2 = cc("0"); i2 <= cc("9"); i2++) { + digitsCharCodes.push(i2); + } + wordCharCodes = [cc("_")].concat(digitsCharCodes); + for (let i2 = cc("a"); i2 <= cc("z"); i2++) { + wordCharCodes.push(i2); + } + for (let i2 = cc("A"); i2 <= cc("Z"); i2++) { + wordCharCodes.push(i2); + } + whitespaceCodes = [ + cc(" "), + cc("\f"), + cc("\n"), + cc("\r"), + cc(" "), + cc("\v"), + cc(" "), + cc("\xA0"), + cc("\u1680"), + cc("\u2000"), + cc("\u2001"), + cc("\u2002"), + cc("\u2003"), + cc("\u2004"), + cc("\u2005"), + cc("\u2006"), + cc("\u2007"), + cc("\u2008"), + cc("\u2009"), + cc("\u200A"), + cc("\u2028"), + cc("\u2029"), + cc("\u202F"), + cc("\u205F"), + cc("\u3000"), + cc("\uFEFF") + ]; + hexDigitPattern = /[0-9a-fA-F]/; + decimalPattern = /[0-9]/; + decimalPatternNoZero = /[1-9]/; + RegExpParser = class { + static { + __name(this, "RegExpParser"); + } + static { + __name2(this, "RegExpParser"); + } + constructor() { + this.idx = 0; + this.input = ""; + this.groupIdx = 0; + } + saveState() { + return { + idx: this.idx, + input: this.input, + groupIdx: this.groupIdx + }; + } + restoreState(newState2) { + this.idx = newState2.idx; + this.input = newState2.input; + this.groupIdx = newState2.groupIdx; + } + pattern(input) { + this.idx = 0; + this.input = input; + this.groupIdx = 0; + this.consumeChar("/"); + const value2 = this.disjunction(); + this.consumeChar("/"); + const flags = { + type: "Flags", + loc: { begin: this.idx, end: input.length }, + global: false, + ignoreCase: false, + multiLine: false, + unicode: false, + sticky: false + }; + while (this.isRegExpFlag()) { + switch (this.popChar()) { + case "g": + addFlag(flags, "global"); + break; + case "i": + addFlag(flags, "ignoreCase"); + break; + case "m": + addFlag(flags, "multiLine"); + break; + case "u": + addFlag(flags, "unicode"); + break; + case "y": + addFlag(flags, "sticky"); + break; + } + } + if (this.idx !== this.input.length) { + throw Error("Redundant input: " + this.input.substring(this.idx)); + } + return { + type: "Pattern", + flags, + value: value2, + loc: this.loc(0) + }; + } + disjunction() { + const alts = []; + const begin = this.idx; + alts.push(this.alternative()); + while (this.peekChar() === "|") { + this.consumeChar("|"); + alts.push(this.alternative()); + } + return { type: "Disjunction", value: alts, loc: this.loc(begin) }; + } + alternative() { + const terms = []; + const begin = this.idx; + while (this.isTerm()) { + terms.push(this.term()); + } + return { type: "Alternative", value: terms, loc: this.loc(begin) }; + } + term() { + if (this.isAssertion()) { + return this.assertion(); + } else { + return this.atom(); + } + } + assertion() { + const begin = this.idx; + switch (this.popChar()) { + case "^": + return { + type: "StartAnchor", + loc: this.loc(begin) + }; + case "$": + return { type: "EndAnchor", loc: this.loc(begin) }; + // '\b' or '\B' + case "\\": + switch (this.popChar()) { + case "b": + return { + type: "WordBoundary", + loc: this.loc(begin) + }; + case "B": + return { + type: "NonWordBoundary", + loc: this.loc(begin) + }; + } + throw Error("Invalid Assertion Escape"); + // '(?=' or '(?!' + case "(": + this.consumeChar("?"); + let type3; + switch (this.popChar()) { + case "=": + type3 = "Lookahead"; + break; + case "!": + type3 = "NegativeLookahead"; + break; + case "<": { + switch (this.popChar()) { + case "=": + type3 = "Lookbehind"; + break; + case "!": + type3 = "NegativeLookbehind"; + } + break; + } + } + ASSERT_EXISTS(type3); + const disjunction = this.disjunction(); + this.consumeChar(")"); + return { + type: type3, + value: disjunction, + loc: this.loc(begin) + }; + } + return ASSERT_NEVER_REACH_HERE(); + } + quantifier(isBacktracking = false) { + let range3 = void 0; + const begin = this.idx; + switch (this.popChar()) { + case "*": + range3 = { + atLeast: 0, + atMost: Infinity + }; + break; + case "+": + range3 = { + atLeast: 1, + atMost: Infinity + }; + break; + case "?": + range3 = { + atLeast: 0, + atMost: 1 + }; + break; + case "{": + const atLeast = this.integerIncludingZero(); + switch (this.popChar()) { + case "}": + range3 = { + atLeast, + atMost: atLeast + }; + break; + case ",": + let atMost; + if (this.isDigit()) { + atMost = this.integerIncludingZero(); + range3 = { + atLeast, + atMost + }; + } else { + range3 = { + atLeast, + atMost: Infinity + }; + } + this.consumeChar("}"); + break; + } + if (isBacktracking === true && range3 === void 0) { + return void 0; + } + ASSERT_EXISTS(range3); + break; + } + if (isBacktracking === true && range3 === void 0) { + return void 0; + } + if (ASSERT_EXISTS(range3)) { + if (this.peekChar(0) === "?") { + this.consumeChar("?"); + range3.greedy = false; + } else { + range3.greedy = true; + } + range3.type = "Quantifier"; + range3.loc = this.loc(begin); + return range3; + } + } + atom() { + let atom2; + const begin = this.idx; + switch (this.peekChar()) { + case ".": + atom2 = this.dotAll(); + break; + case "\\": + atom2 = this.atomEscape(); + break; + case "[": + atom2 = this.characterClass(); + break; + case "(": + atom2 = this.group(); + break; + } + if (atom2 === void 0 && this.isPatternCharacter()) { + atom2 = this.patternCharacter(); + } + if (ASSERT_EXISTS(atom2)) { + atom2.loc = this.loc(begin); + if (this.isQuantifier()) { + atom2.quantifier = this.quantifier(); + } + return atom2; + } + return ASSERT_NEVER_REACH_HERE(); + } + dotAll() { + this.consumeChar("."); + return { + type: "Set", + complement: true, + value: [cc("\n"), cc("\r"), cc("\u2028"), cc("\u2029")] + }; + } + atomEscape() { + this.consumeChar("\\"); + switch (this.peekChar()) { + case "1": + case "2": + case "3": + case "4": + case "5": + case "6": + case "7": + case "8": + case "9": + return this.decimalEscapeAtom(); + case "d": + case "D": + case "s": + case "S": + case "w": + case "W": + return this.characterClassEscape(); + case "f": + case "n": + case "r": + case "t": + case "v": + return this.controlEscapeAtom(); + case "c": + return this.controlLetterEscapeAtom(); + case "0": + return this.nulCharacterAtom(); + case "x": + return this.hexEscapeSequenceAtom(); + case "u": + return this.regExpUnicodeEscapeSequenceAtom(); + default: + return this.identityEscapeAtom(); + } + } + decimalEscapeAtom() { + const value2 = this.positiveInteger(); + return { type: "GroupBackReference", value: value2 }; + } + characterClassEscape() { + let set5; + let complement = false; + switch (this.popChar()) { + case "d": + set5 = digitsCharCodes; + break; + case "D": + set5 = digitsCharCodes; + complement = true; + break; + case "s": + set5 = whitespaceCodes; + break; + case "S": + set5 = whitespaceCodes; + complement = true; + break; + case "w": + set5 = wordCharCodes; + break; + case "W": + set5 = wordCharCodes; + complement = true; + break; + } + if (ASSERT_EXISTS(set5)) { + return { type: "Set", value: set5, complement }; + } + return ASSERT_NEVER_REACH_HERE(); + } + controlEscapeAtom() { + let escapeCode; + switch (this.popChar()) { + case "f": + escapeCode = cc("\f"); + break; + case "n": + escapeCode = cc("\n"); + break; + case "r": + escapeCode = cc("\r"); + break; + case "t": + escapeCode = cc(" "); + break; + case "v": + escapeCode = cc("\v"); + break; + } + if (ASSERT_EXISTS(escapeCode)) { + return { type: "Character", value: escapeCode }; + } + return ASSERT_NEVER_REACH_HERE(); + } + controlLetterEscapeAtom() { + this.consumeChar("c"); + const letter = this.popChar(); + if (/[a-zA-Z]/.test(letter) === false) { + throw Error("Invalid "); + } + const letterCode = letter.toUpperCase().charCodeAt(0) - 64; + return { type: "Character", value: letterCode }; + } + nulCharacterAtom() { + this.consumeChar("0"); + return { type: "Character", value: cc("\0") }; + } + hexEscapeSequenceAtom() { + this.consumeChar("x"); + return this.parseHexDigits(2); + } + regExpUnicodeEscapeSequenceAtom() { + this.consumeChar("u"); + return this.parseHexDigits(4); + } + identityEscapeAtom() { + const escapedChar = this.popChar(); + return { type: "Character", value: cc(escapedChar) }; + } + classPatternCharacterAtom() { + switch (this.peekChar()) { + // istanbul ignore next + case "\n": + // istanbul ignore next + case "\r": + // istanbul ignore next + case "\u2028": + // istanbul ignore next + case "\u2029": + // istanbul ignore next + case "\\": + // istanbul ignore next + case "]": + throw Error("TBD"); + default: + const nextChar = this.popChar(); + return { type: "Character", value: cc(nextChar) }; + } + } + characterClass() { + const set5 = []; + let complement = false; + this.consumeChar("["); + if (this.peekChar(0) === "^") { + this.consumeChar("^"); + complement = true; + } + while (this.isClassAtom()) { + const from2 = this.classAtom(); + const isFromSingleChar = from2.type === "Character"; + if (isCharacter(from2) && this.isRangeDash()) { + this.consumeChar("-"); + const to = this.classAtom(); + const isToSingleChar = to.type === "Character"; + if (isCharacter(to)) { + if (to.value < from2.value) { + throw Error("Range out of order in character class"); + } + set5.push({ from: from2.value, to: to.value }); + } else { + insertToSet(from2.value, set5); + set5.push(cc("-")); + insertToSet(to.value, set5); + } + } else { + insertToSet(from2.value, set5); + } + } + this.consumeChar("]"); + return { type: "Set", complement, value: set5 }; + } + classAtom() { + switch (this.peekChar()) { + // istanbul ignore next + case "]": + // istanbul ignore next + case "\n": + // istanbul ignore next + case "\r": + // istanbul ignore next + case "\u2028": + // istanbul ignore next + case "\u2029": + throw Error("TBD"); + case "\\": + return this.classEscape(); + default: + return this.classPatternCharacterAtom(); + } + } + classEscape() { + this.consumeChar("\\"); + switch (this.peekChar()) { + // Matches a backspace. + // (Not to be confused with \b word boundary outside characterClass) + case "b": + this.consumeChar("b"); + return { type: "Character", value: cc("\b") }; + case "d": + case "D": + case "s": + case "S": + case "w": + case "W": + return this.characterClassEscape(); + case "f": + case "n": + case "r": + case "t": + case "v": + return this.controlEscapeAtom(); + case "c": + return this.controlLetterEscapeAtom(); + case "0": + return this.nulCharacterAtom(); + case "x": + return this.hexEscapeSequenceAtom(); + case "u": + return this.regExpUnicodeEscapeSequenceAtom(); + default: + return this.identityEscapeAtom(); + } + } + group() { + let capturing = true; + this.consumeChar("("); + switch (this.peekChar(0)) { + case "?": + this.consumeChar("?"); + this.consumeChar(":"); + capturing = false; + break; + default: + this.groupIdx++; + break; + } + const value2 = this.disjunction(); + this.consumeChar(")"); + const groupAst = { + type: "Group", + capturing, + value: value2 + }; + if (capturing) { + groupAst["idx"] = this.groupIdx; + } + return groupAst; + } + positiveInteger() { + let number7 = this.popChar(); + if (decimalPatternNoZero.test(number7) === false) { + throw Error("Expecting a positive integer"); + } + while (decimalPattern.test(this.peekChar(0))) { + number7 += this.popChar(); + } + return parseInt(number7, 10); + } + integerIncludingZero() { + let number7 = this.popChar(); + if (decimalPattern.test(number7) === false) { + throw Error("Expecting an integer"); + } + while (decimalPattern.test(this.peekChar(0))) { + number7 += this.popChar(); + } + return parseInt(number7, 10); + } + patternCharacter() { + const nextChar = this.popChar(); + switch (nextChar) { + // istanbul ignore next + case "\n": + // istanbul ignore next + case "\r": + // istanbul ignore next + case "\u2028": + // istanbul ignore next + case "\u2029": + // istanbul ignore next + case "^": + // istanbul ignore next + case "$": + // istanbul ignore next + case "\\": + // istanbul ignore next + case ".": + // istanbul ignore next + case "*": + // istanbul ignore next + case "+": + // istanbul ignore next + case "?": + // istanbul ignore next + case "(": + // istanbul ignore next + case ")": + // istanbul ignore next + case "[": + // istanbul ignore next + case "|": + throw Error("TBD"); + default: + return { type: "Character", value: cc(nextChar) }; + } + } + isRegExpFlag() { + switch (this.peekChar(0)) { + case "g": + case "i": + case "m": + case "u": + case "y": + return true; + default: + return false; + } + } + isRangeDash() { + return this.peekChar() === "-" && this.isClassAtom(1); + } + isDigit() { + return decimalPattern.test(this.peekChar(0)); + } + isClassAtom(howMuch = 0) { + switch (this.peekChar(howMuch)) { + case "]": + case "\n": + case "\r": + case "\u2028": + case "\u2029": + return false; + default: + return true; + } + } + isTerm() { + return this.isAtom() || this.isAssertion(); + } + isAtom() { + if (this.isPatternCharacter()) { + return true; + } + switch (this.peekChar(0)) { + case ".": + case "\\": + // atomEscape + case "[": + // characterClass + // TODO: isAtom must be called before isAssertion - disambiguate + case "(": + return true; + default: + return false; + } + } + isAssertion() { + switch (this.peekChar(0)) { + case "^": + case "$": + return true; + // '\b' or '\B' + case "\\": + switch (this.peekChar(1)) { + case "b": + case "B": + return true; + default: + return false; + } + // '(?=' or '(?!' or `(?<=` or `(?= this.input.length) { + throw Error("Unexpected end of input"); + } + this.idx++; + } + loc(begin) { + return { begin, end: this.idx }; + } + }; + BaseRegExpVisitor = class { + static { + __name(this, "BaseRegExpVisitor"); + } + static { + __name2(this, "BaseRegExpVisitor"); + } + visitChildren(node2) { + for (const key in node2) { + const child = node2[key]; + if (node2.hasOwnProperty(key)) { + if (child.type !== void 0) { + this.visit(child); + } else if (Array.isArray(child)) { + child.forEach((subChild) => { + this.visit(subChild); + }, this); + } + } + } + } + visit(node2) { + switch (node2.type) { + case "Pattern": + this.visitPattern(node2); + break; + case "Flags": + this.visitFlags(node2); + break; + case "Disjunction": + this.visitDisjunction(node2); + break; + case "Alternative": + this.visitAlternative(node2); + break; + case "StartAnchor": + this.visitStartAnchor(node2); + break; + case "EndAnchor": + this.visitEndAnchor(node2); + break; + case "WordBoundary": + this.visitWordBoundary(node2); + break; + case "NonWordBoundary": + this.visitNonWordBoundary(node2); + break; + case "Lookahead": + this.visitLookahead(node2); + break; + case "NegativeLookahead": + this.visitNegativeLookahead(node2); + break; + case "Lookbehind": + this.visitLookbehind(node2); + break; + case "NegativeLookbehind": + this.visitNegativeLookbehind(node2); + break; + case "Character": + this.visitCharacter(node2); + break; + case "Set": + this.visitSet(node2); + break; + case "Group": + this.visitGroup(node2); + break; + case "GroupBackReference": + this.visitGroupBackReference(node2); + break; + case "Quantifier": + this.visitQuantifier(node2); + break; + } + this.visitChildren(node2); + } + visitPattern(node2) { + } + visitFlags(node2) { + } + visitDisjunction(node2) { + } + visitAlternative(node2) { + } + // Assertion + visitStartAnchor(node2) { + } + visitEndAnchor(node2) { + } + visitWordBoundary(node2) { + } + visitNonWordBoundary(node2) { + } + visitLookahead(node2) { + } + visitNegativeLookahead(node2) { + } + visitLookbehind(node2) { + } + visitNegativeLookbehind(node2) { + } + // atoms + visitCharacter(node2) { + } + visitSet(node2) { + } + visitGroup(node2) { + } + visitGroupBackReference(node2) { + } + visitQuantifier(node2) { + } + }; + NEWLINE_REGEXP = /\r?\n/gm; + regexpParser = new RegExpParser(); + TerminalRegExpVisitor = class extends BaseRegExpVisitor { + static { + __name(this, "TerminalRegExpVisitor"); + } + static { + __name2(this, "TerminalRegExpVisitor"); + } + constructor() { + super(...arguments); + this.isStarting = true; + this.endRegexpStack = []; + this.multiline = false; + } + get endRegex() { + return this.endRegexpStack.join(""); + } + reset(regex2) { + this.multiline = false; + this.regex = regex2; + this.startRegexp = ""; + this.isStarting = true; + this.endRegexpStack = []; + } + visitGroup(node2) { + if (node2.quantifier) { + this.isStarting = false; + this.endRegexpStack = []; + } + } + visitCharacter(node2) { + const char2 = String.fromCharCode(node2.value); + if (!this.multiline && char2 === "\n") { + this.multiline = true; + } + if (node2.quantifier) { + this.isStarting = false; + this.endRegexpStack = []; + } else { + const escapedChar = escapeRegExp(char2); + this.endRegexpStack.push(escapedChar); + if (this.isStarting) { + this.startRegexp += escapedChar; + } + } + } + visitSet(node2) { + if (!this.multiline) { + const set5 = this.regex.substring(node2.loc.begin, node2.loc.end); + const regex2 = new RegExp(set5); + this.multiline = Boolean("\n".match(regex2)); + } + if (node2.quantifier) { + this.isStarting = false; + this.endRegexpStack = []; + } else { + const set5 = this.regex.substring(node2.loc.begin, node2.loc.end); + this.endRegexpStack.push(set5); + if (this.isStarting) { + this.startRegexp += set5; + } + } + } + visitChildren(node2) { + if (node2.type === "Group") { + const group2 = node2; + if (group2.quantifier) { + return; + } + } + super.visitChildren(node2); + } + }; + visitor = new TerminalRegExpVisitor(); + __name(getTerminalParts, "getTerminalParts"); + __name2(getTerminalParts, "getTerminalParts"); + __name(isMultilineComment, "isMultilineComment"); + __name2(isMultilineComment, "isMultilineComment"); + whitespaceCharacters = "\f\n\r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF".split(""); + __name(isWhitespace2, "isWhitespace"); + __name2(isWhitespace2, "isWhitespace"); + __name(escapeRegExp, "escapeRegExp"); + __name2(escapeRegExp, "escapeRegExp"); + __name(partialMatches, "partialMatches"); + __name2(partialMatches, "partialMatches"); + __name(partialRegExp, "partialRegExp"); + __name2(partialRegExp, "partialRegExp"); + __name(getEntryRule, "getEntryRule"); + __name2(getEntryRule, "getEntryRule"); + __name(getHiddenRules, "getHiddenRules"); + __name2(getHiddenRules, "getHiddenRules"); + __name(getAllReachableRules, "getAllReachableRules"); + __name2(getAllReachableRules, "getAllReachableRules"); + __name(ruleDfs, "ruleDfs"); + __name2(ruleDfs, "ruleDfs"); + __name(getAllRulesUsedForCrossReferences, "getAllRulesUsedForCrossReferences"); + __name2(getAllRulesUsedForCrossReferences, "getAllRulesUsedForCrossReferences"); + __name(getCrossReferenceTerminal, "getCrossReferenceTerminal"); + __name2(getCrossReferenceTerminal, "getCrossReferenceTerminal"); + __name(isCommentTerminal, "isCommentTerminal"); + __name2(isCommentTerminal, "isCommentTerminal"); + __name(findNodesForProperty, "findNodesForProperty"); + __name2(findNodesForProperty, "findNodesForProperty"); + __name(findNodeForProperty, "findNodeForProperty"); + __name2(findNodeForProperty, "findNodeForProperty"); + __name(findNodesForPropertyInternal, "findNodesForPropertyInternal"); + __name2(findNodesForPropertyInternal, "findNodesForPropertyInternal"); + __name(findNodesForKeyword, "findNodesForKeyword"); + __name2(findNodesForKeyword, "findNodesForKeyword"); + __name(findNodeForKeyword, "findNodeForKeyword"); + __name2(findNodeForKeyword, "findNodeForKeyword"); + __name(findNodesForKeywordInternal, "findNodesForKeywordInternal"); + __name2(findNodesForKeywordInternal, "findNodesForKeywordInternal"); + __name(findAssignment, "findAssignment"); + __name2(findAssignment, "findAssignment"); + __name(findNameAssignment, "findNameAssignment"); + __name2(findNameAssignment, "findNameAssignment"); + __name(findNameAssignmentInternal, "findNameAssignmentInternal"); + __name2(findNameAssignmentInternal, "findNameAssignmentInternal"); + __name(getActionAtElement, "getActionAtElement"); + __name2(getActionAtElement, "getActionAtElement"); + __name(isOptionalCardinality, "isOptionalCardinality"); + __name2(isOptionalCardinality, "isOptionalCardinality"); + __name(isArrayCardinality, "isArrayCardinality"); + __name2(isArrayCardinality, "isArrayCardinality"); + __name(isArrayOperator, "isArrayOperator"); + __name2(isArrayOperator, "isArrayOperator"); + __name(isDataTypeRule, "isDataTypeRule"); + __name2(isDataTypeRule, "isDataTypeRule"); + __name(isDataTypeRuleInternal, "isDataTypeRuleInternal"); + __name2(isDataTypeRuleInternal, "isDataTypeRuleInternal"); + __name(isDataType, "isDataType"); + __name2(isDataType, "isDataType"); + __name(isDataTypeInternal, "isDataTypeInternal"); + __name2(isDataTypeInternal, "isDataTypeInternal"); + __name(getExplicitRuleType, "getExplicitRuleType"); + __name2(getExplicitRuleType, "getExplicitRuleType"); + __name(getTypeName, "getTypeName"); + __name2(getTypeName, "getTypeName"); + __name(getActionType, "getActionType"); + __name2(getActionType, "getActionType"); + __name(getRuleTypeName, "getRuleTypeName"); + __name2(getRuleTypeName, "getRuleTypeName"); + __name(getRuleType, "getRuleType"); + __name2(getRuleType, "getRuleType"); + __name(terminalRegex, "terminalRegex"); + __name2(terminalRegex, "terminalRegex"); + WILDCARD = /[\s\S]/.source; + __name(abstractElementToRegex, "abstractElementToRegex"); + __name2(abstractElementToRegex, "abstractElementToRegex"); + __name(terminalAlternativesToRegex, "terminalAlternativesToRegex"); + __name2(terminalAlternativesToRegex, "terminalAlternativesToRegex"); + __name(terminalGroupToRegex, "terminalGroupToRegex"); + __name2(terminalGroupToRegex, "terminalGroupToRegex"); + __name(untilTokenToRegex, "untilTokenToRegex"); + __name2(untilTokenToRegex, "untilTokenToRegex"); + __name(negateTokenToRegex, "negateTokenToRegex"); + __name2(negateTokenToRegex, "negateTokenToRegex"); + __name(characterRangeToRegex, "characterRangeToRegex"); + __name2(characterRangeToRegex, "characterRangeToRegex"); + __name(keywordToRegex, "keywordToRegex"); + __name2(keywordToRegex, "keywordToRegex"); + __name(withCardinality, "withCardinality"); + __name2(withCardinality, "withCardinality"); + __name(createGrammarConfig, "createGrammarConfig"); + __name2(createGrammarConfig, "createGrammarConfig"); + freeGlobal2 = typeof global == "object" && global && global.Object === Object && global; + freeGlobal_default2 = freeGlobal2; + freeSelf2 = typeof self == "object" && self && self.Object === Object && self; + root3 = freeGlobal_default2 || freeSelf2 || Function("return this")(); + root_default2 = root3; + Symbol22 = root_default2.Symbol; + Symbol_default2 = Symbol22; + objectProto20 = Object.prototype; + hasOwnProperty17 = objectProto20.hasOwnProperty; + nativeObjectToString3 = objectProto20.toString; + symToStringTag3 = Symbol_default2 ? Symbol_default2.toStringTag : void 0; + __name(getRawTag2, "getRawTag"); + __name2(getRawTag2, "getRawTag"); + getRawTag_default2 = getRawTag2; + objectProto22 = Object.prototype; + nativeObjectToString22 = objectProto22.toString; + __name(objectToString2, "objectToString"); + __name2(objectToString2, "objectToString"); + objectToString_default2 = objectToString2; + nullTag2 = "[object Null]"; + undefinedTag2 = "[object Undefined]"; + symToStringTag22 = Symbol_default2 ? Symbol_default2.toStringTag : void 0; + __name(baseGetTag2, "baseGetTag"); + __name2(baseGetTag2, "baseGetTag"); + baseGetTag_default2 = baseGetTag2; + __name(isObjectLike3, "isObjectLike"); + __name2(isObjectLike3, "isObjectLike"); + isObjectLike_default2 = isObjectLike3; + symbolTag6 = "[object Symbol]"; + __name(isSymbol2, "isSymbol"); + __name2(isSymbol2, "isSymbol"); + isSymbol_default2 = isSymbol2; + __name(arrayMap2, "arrayMap"); + __name2(arrayMap2, "arrayMap"); + arrayMap_default2 = arrayMap2; + isArray3 = Array.isArray; + isArray_default2 = isArray3; + INFINITY5 = 1 / 0; + symbolProto4 = Symbol_default2 ? Symbol_default2.prototype : void 0; + symbolToString2 = symbolProto4 ? symbolProto4.toString : void 0; + __name(baseToString2, "baseToString"); + __name2(baseToString2, "baseToString"); + baseToString_default2 = baseToString2; + reWhitespace2 = /\s/; + __name(trimmedEndIndex2, "trimmedEndIndex"); + __name2(trimmedEndIndex2, "trimmedEndIndex"); + trimmedEndIndex_default2 = trimmedEndIndex2; + reTrimStart2 = /^\s+/; + __name(baseTrim2, "baseTrim"); + __name2(baseTrim2, "baseTrim"); + baseTrim_default2 = baseTrim2; + __name(isObject3, "isObject"); + __name2(isObject3, "isObject"); + isObject_default2 = isObject3; + NAN2 = 0 / 0; + reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i; + reIsBinary2 = /^0b[01]+$/i; + reIsOctal2 = /^0o[0-7]+$/i; + freeParseInt2 = parseInt; + __name(toNumber2, "toNumber"); + __name2(toNumber2, "toNumber"); + toNumber_default2 = toNumber2; + INFINITY22 = 1 / 0; + MAX_INTEGER2 = 17976931348623157e292; + __name(toFinite2, "toFinite"); + __name2(toFinite2, "toFinite"); + toFinite_default2 = toFinite2; + __name(toInteger2, "toInteger"); + __name2(toInteger2, "toInteger"); + toInteger_default2 = toInteger2; + __name(identity7, "identity"); + __name2(identity7, "identity"); + identity_default5 = identity7; + asyncTag2 = "[object AsyncFunction]"; + funcTag4 = "[object Function]"; + genTag3 = "[object GeneratorFunction]"; + proxyTag2 = "[object Proxy]"; + __name(isFunction2, "isFunction"); + __name2(isFunction2, "isFunction"); + isFunction_default2 = isFunction2; + coreJsData2 = root_default2["__core-js_shared__"]; + coreJsData_default2 = coreJsData2; + maskSrcKey2 = (function() { + var uid = /[^.]+$/.exec(coreJsData_default2 && coreJsData_default2.keys && coreJsData_default2.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; + })(); + __name(isMasked2, "isMasked"); + __name2(isMasked2, "isMasked"); + isMasked_default2 = isMasked2; + funcProto4 = Function.prototype; + funcToString4 = funcProto4.toString; + __name(toSource2, "toSource"); + __name2(toSource2, "toSource"); + toSource_default2 = toSource2; + reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g; + reIsHostCtor2 = /^\[object .+?Constructor\]$/; + funcProto22 = Function.prototype; + objectProto32 = Object.prototype; + funcToString22 = funcProto22.toString; + hasOwnProperty22 = objectProto32.hasOwnProperty; + reIsNative2 = RegExp( + "^" + funcToString22.call(hasOwnProperty22).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + __name(baseIsNative2, "baseIsNative"); + __name2(baseIsNative2, "baseIsNative"); + baseIsNative_default2 = baseIsNative2; + __name(getValue3, "getValue"); + __name2(getValue3, "getValue"); + getValue_default2 = getValue3; + __name(getNative2, "getNative"); + __name2(getNative2, "getNative"); + getNative_default2 = getNative2; + WeakMap2 = getNative_default2(root_default2, "WeakMap"); + WeakMap_default2 = WeakMap2; + objectCreate2 = Object.create; + baseCreate2 = /* @__PURE__ */ (function() { + function object3() { + } + __name(object3, "object"); + __name2(object3, "object"); + return function(proto) { + if (!isObject_default2(proto)) { + return {}; + } + if (objectCreate2) { + return objectCreate2(proto); + } + object3.prototype = proto; + var result = new object3(); + object3.prototype = void 0; + return result; + }; + })(); + baseCreate_default2 = baseCreate2; + __name(apply4, "apply"); + __name2(apply4, "apply"); + apply_default2 = apply4; + __name(noop7, "noop"); + __name2(noop7, "noop"); + noop_default3 = noop7; + __name(copyArray4, "copyArray"); + __name2(copyArray4, "copyArray"); + copyArray_default2 = copyArray4; + HOT_COUNT2 = 800; + HOT_SPAN2 = 16; + nativeNow2 = Date.now; + __name(shortOut2, "shortOut"); + __name2(shortOut2, "shortOut"); + shortOut_default2 = shortOut2; + __name(constant2, "constant"); + __name2(constant2, "constant"); + constant_default8 = constant2; + defineProperty2 = (function() { + try { + var func = getNative_default2(Object, "defineProperty"); + func({}, "", {}); + return func; + } catch (e3) { + } + })(); + defineProperty_default2 = defineProperty2; + baseSetToString2 = !defineProperty_default2 ? identity_default5 : function(func, string3) { + return defineProperty_default2(func, "toString", { + "configurable": true, + "enumerable": false, + "value": constant_default8(string3), + "writable": true + }); + }; + baseSetToString_default2 = baseSetToString2; + setToString2 = shortOut_default2(baseSetToString_default2); + setToString_default2 = setToString2; + __name(arrayEach2, "arrayEach"); + __name2(arrayEach2, "arrayEach"); + arrayEach_default2 = arrayEach2; + __name(baseFindIndex2, "baseFindIndex"); + __name2(baseFindIndex2, "baseFindIndex"); + baseFindIndex_default2 = baseFindIndex2; + __name(baseIsNaN2, "baseIsNaN"); + __name2(baseIsNaN2, "baseIsNaN"); + baseIsNaN_default2 = baseIsNaN2; + __name(strictIndexOf2, "strictIndexOf"); + __name2(strictIndexOf2, "strictIndexOf"); + strictIndexOf_default2 = strictIndexOf2; + __name(baseIndexOf2, "baseIndexOf"); + __name2(baseIndexOf2, "baseIndexOf"); + baseIndexOf_default2 = baseIndexOf2; + __name(arrayIncludes2, "arrayIncludes"); + __name2(arrayIncludes2, "arrayIncludes"); + arrayIncludes_default2 = arrayIncludes2; + MAX_SAFE_INTEGER3 = 9007199254740991; + reIsUint2 = /^(?:0|[1-9]\d*)$/; + __name(isIndex2, "isIndex"); + __name2(isIndex2, "isIndex"); + isIndex_default2 = isIndex2; + __name(baseAssignValue2, "baseAssignValue"); + __name2(baseAssignValue2, "baseAssignValue"); + baseAssignValue_default2 = baseAssignValue2; + __name(eq3, "eq"); + __name2(eq3, "eq"); + eq_default2 = eq3; + objectProto42 = Object.prototype; + hasOwnProperty32 = objectProto42.hasOwnProperty; + __name(assignValue2, "assignValue"); + __name2(assignValue2, "assignValue"); + assignValue_default2 = assignValue2; + __name(copyObject2, "copyObject"); + __name2(copyObject2, "copyObject"); + copyObject_default2 = copyObject2; + nativeMax4 = Math.max; + __name(overRest2, "overRest"); + __name2(overRest2, "overRest"); + overRest_default2 = overRest2; + __name(baseRest2, "baseRest"); + __name2(baseRest2, "baseRest"); + baseRest_default2 = baseRest2; + MAX_SAFE_INTEGER22 = 9007199254740991; + __name(isLength3, "isLength"); + __name2(isLength3, "isLength"); + isLength_default2 = isLength3; + __name(isArrayLike3, "isArrayLike"); + __name2(isArrayLike3, "isArrayLike"); + isArrayLike_default2 = isArrayLike3; + __name(isIterateeCall2, "isIterateeCall"); + __name2(isIterateeCall2, "isIterateeCall"); + isIterateeCall_default2 = isIterateeCall2; + __name(createAssigner2, "createAssigner"); + __name2(createAssigner2, "createAssigner"); + createAssigner_default2 = createAssigner2; + objectProto52 = Object.prototype; + __name(isPrototype3, "isPrototype"); + __name2(isPrototype3, "isPrototype"); + isPrototype_default2 = isPrototype3; + __name(baseTimes2, "baseTimes"); + __name2(baseTimes2, "baseTimes"); + baseTimes_default2 = baseTimes2; + argsTag5 = "[object Arguments]"; + __name(baseIsArguments2, "baseIsArguments"); + __name2(baseIsArguments2, "baseIsArguments"); + baseIsArguments_default2 = baseIsArguments2; + objectProto62 = Object.prototype; + hasOwnProperty42 = objectProto62.hasOwnProperty; + propertyIsEnumerable3 = objectProto62.propertyIsEnumerable; + isArguments3 = baseIsArguments_default2(/* @__PURE__ */ (function() { + return arguments; + })()) ? baseIsArguments_default2 : function(value2) { + return isObjectLike_default2(value2) && hasOwnProperty42.call(value2, "callee") && !propertyIsEnumerable3.call(value2, "callee"); + }; + isArguments_default2 = isArguments3; + __name(stubFalse2, "stubFalse"); + __name2(stubFalse2, "stubFalse"); + stubFalse_default2 = stubFalse2; + freeExports4 = typeof exports == "object" && exports && !exports.nodeType && exports; + freeModule4 = freeExports4 && typeof module == "object" && module && !module.nodeType && module; + moduleExports4 = freeModule4 && freeModule4.exports === freeExports4; + Buffer22 = moduleExports4 ? root_default2.Buffer : void 0; + nativeIsBuffer2 = Buffer22 ? Buffer22.isBuffer : void 0; + isBuffer2 = nativeIsBuffer2 || stubFalse_default2; + isBuffer_default2 = isBuffer2; + argsTag22 = "[object Arguments]"; + arrayTag5 = "[object Array]"; + boolTag5 = "[object Boolean]"; + dateTag6 = "[object Date]"; + errorTag4 = "[object Error]"; + funcTag22 = "[object Function]"; + mapTag10 = "[object Map]"; + numberTag6 = "[object Number]"; + objectTag7 = "[object Object]"; + regexpTag6 = "[object RegExp]"; + setTag10 = "[object Set]"; + stringTag7 = "[object String]"; + weakMapTag4 = "[object WeakMap]"; + arrayBufferTag6 = "[object ArrayBuffer]"; + dataViewTag7 = "[object DataView]"; + float32Tag4 = "[object Float32Array]"; + float64Tag4 = "[object Float64Array]"; + int8Tag4 = "[object Int8Array]"; + int16Tag4 = "[object Int16Array]"; + int32Tag4 = "[object Int32Array]"; + uint8Tag4 = "[object Uint8Array]"; + uint8ClampedTag4 = "[object Uint8ClampedArray]"; + uint16Tag4 = "[object Uint16Array]"; + uint32Tag4 = "[object Uint32Array]"; + typedArrayTags2 = {}; + typedArrayTags2[float32Tag4] = typedArrayTags2[float64Tag4] = typedArrayTags2[int8Tag4] = typedArrayTags2[int16Tag4] = typedArrayTags2[int32Tag4] = typedArrayTags2[uint8Tag4] = typedArrayTags2[uint8ClampedTag4] = typedArrayTags2[uint16Tag4] = typedArrayTags2[uint32Tag4] = true; + typedArrayTags2[argsTag22] = typedArrayTags2[arrayTag5] = typedArrayTags2[arrayBufferTag6] = typedArrayTags2[boolTag5] = typedArrayTags2[dataViewTag7] = typedArrayTags2[dateTag6] = typedArrayTags2[errorTag4] = typedArrayTags2[funcTag22] = typedArrayTags2[mapTag10] = typedArrayTags2[numberTag6] = typedArrayTags2[objectTag7] = typedArrayTags2[regexpTag6] = typedArrayTags2[setTag10] = typedArrayTags2[stringTag7] = typedArrayTags2[weakMapTag4] = false; + __name(baseIsTypedArray2, "baseIsTypedArray"); + __name2(baseIsTypedArray2, "baseIsTypedArray"); + baseIsTypedArray_default2 = baseIsTypedArray2; + __name(baseUnary2, "baseUnary"); + __name2(baseUnary2, "baseUnary"); + baseUnary_default2 = baseUnary2; + freeExports22 = typeof exports == "object" && exports && !exports.nodeType && exports; + freeModule22 = freeExports22 && typeof module == "object" && module && !module.nodeType && module; + moduleExports22 = freeModule22 && freeModule22.exports === freeExports22; + freeProcess2 = moduleExports22 && freeGlobal_default2.process; + nodeUtil2 = (function() { + try { + var types = freeModule22 && freeModule22.require && freeModule22.require("util").types; + if (types) { + return types; + } + return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util"); + } catch (e3) { + } + })(); + nodeUtil_default2 = nodeUtil2; + nodeIsTypedArray2 = nodeUtil_default2 && nodeUtil_default2.isTypedArray; + isTypedArray4 = nodeIsTypedArray2 ? baseUnary_default2(nodeIsTypedArray2) : baseIsTypedArray_default2; + isTypedArray_default2 = isTypedArray4; + objectProto72 = Object.prototype; + hasOwnProperty52 = objectProto72.hasOwnProperty; + __name(arrayLikeKeys2, "arrayLikeKeys"); + __name2(arrayLikeKeys2, "arrayLikeKeys"); + arrayLikeKeys_default2 = arrayLikeKeys2; + __name(overArg2, "overArg"); + __name2(overArg2, "overArg"); + overArg_default2 = overArg2; + nativeKeys2 = overArg_default2(Object.keys, Object); + nativeKeys_default2 = nativeKeys2; + objectProto82 = Object.prototype; + hasOwnProperty62 = objectProto82.hasOwnProperty; + __name(baseKeys2, "baseKeys"); + __name2(baseKeys2, "baseKeys"); + baseKeys_default2 = baseKeys2; + __name(keys2, "keys"); + __name2(keys2, "keys"); + keys_default2 = keys2; + objectProto92 = Object.prototype; + hasOwnProperty72 = objectProto92.hasOwnProperty; + assign5 = createAssigner_default2(function(object3, source) { + if (isPrototype_default2(source) || isArrayLike_default2(source)) { + copyObject_default2(source, keys_default2(source), object3); + return; + } + for (var key in source) { + if (hasOwnProperty72.call(source, key)) { + assignValue_default2(object3, key, source[key]); + } + } + }); + assign_default = assign5; + __name(nativeKeysIn2, "nativeKeysIn"); + __name2(nativeKeysIn2, "nativeKeysIn"); + nativeKeysIn_default2 = nativeKeysIn2; + objectProto102 = Object.prototype; + hasOwnProperty82 = objectProto102.hasOwnProperty; + __name(baseKeysIn2, "baseKeysIn"); + __name2(baseKeysIn2, "baseKeysIn"); + baseKeysIn_default2 = baseKeysIn2; + __name(keysIn2, "keysIn"); + __name2(keysIn2, "keysIn"); + keysIn_default2 = keysIn2; + reIsDeepProp2 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; + reIsPlainProp2 = /^\w*$/; + __name(isKey2, "isKey"); + __name2(isKey2, "isKey"); + isKey_default2 = isKey2; + nativeCreate2 = getNative_default2(Object, "create"); + nativeCreate_default2 = nativeCreate2; + __name(hashClear2, "hashClear"); + __name2(hashClear2, "hashClear"); + hashClear_default2 = hashClear2; + __name(hashDelete2, "hashDelete"); + __name2(hashDelete2, "hashDelete"); + hashDelete_default2 = hashDelete2; + HASH_UNDEFINED4 = "__lodash_hash_undefined__"; + objectProto112 = Object.prototype; + hasOwnProperty92 = objectProto112.hasOwnProperty; + __name(hashGet2, "hashGet"); + __name2(hashGet2, "hashGet"); + hashGet_default2 = hashGet2; + objectProto122 = Object.prototype; + hasOwnProperty102 = objectProto122.hasOwnProperty; + __name(hashHas2, "hashHas"); + __name2(hashHas2, "hashHas"); + hashHas_default2 = hashHas2; + HASH_UNDEFINED22 = "__lodash_hash_undefined__"; + __name(hashSet2, "hashSet"); + __name2(hashSet2, "hashSet"); + hashSet_default2 = hashSet2; + __name(Hash2, "Hash"); + __name2(Hash2, "Hash"); + Hash2.prototype.clear = hashClear_default2; + Hash2.prototype["delete"] = hashDelete_default2; + Hash2.prototype.get = hashGet_default2; + Hash2.prototype.has = hashHas_default2; + Hash2.prototype.set = hashSet_default2; + Hash_default2 = Hash2; + __name(listCacheClear2, "listCacheClear"); + __name2(listCacheClear2, "listCacheClear"); + listCacheClear_default2 = listCacheClear2; + __name(assocIndexOf2, "assocIndexOf"); + __name2(assocIndexOf2, "assocIndexOf"); + assocIndexOf_default2 = assocIndexOf2; + arrayProto2 = Array.prototype; + splice2 = arrayProto2.splice; + __name(listCacheDelete2, "listCacheDelete"); + __name2(listCacheDelete2, "listCacheDelete"); + listCacheDelete_default2 = listCacheDelete2; + __name(listCacheGet2, "listCacheGet"); + __name2(listCacheGet2, "listCacheGet"); + listCacheGet_default2 = listCacheGet2; + __name(listCacheHas2, "listCacheHas"); + __name2(listCacheHas2, "listCacheHas"); + listCacheHas_default2 = listCacheHas2; + __name(listCacheSet2, "listCacheSet"); + __name2(listCacheSet2, "listCacheSet"); + listCacheSet_default2 = listCacheSet2; + __name(ListCache2, "ListCache"); + __name2(ListCache2, "ListCache"); + ListCache2.prototype.clear = listCacheClear_default2; + ListCache2.prototype["delete"] = listCacheDelete_default2; + ListCache2.prototype.get = listCacheGet_default2; + ListCache2.prototype.has = listCacheHas_default2; + ListCache2.prototype.set = listCacheSet_default2; + ListCache_default2 = ListCache2; + Map22 = getNative_default2(root_default2, "Map"); + Map_default2 = Map22; + __name(mapCacheClear2, "mapCacheClear"); + __name2(mapCacheClear2, "mapCacheClear"); + mapCacheClear_default2 = mapCacheClear2; + __name(isKeyable2, "isKeyable"); + __name2(isKeyable2, "isKeyable"); + isKeyable_default2 = isKeyable2; + __name(getMapData2, "getMapData"); + __name2(getMapData2, "getMapData"); + getMapData_default2 = getMapData2; + __name(mapCacheDelete2, "mapCacheDelete"); + __name2(mapCacheDelete2, "mapCacheDelete"); + mapCacheDelete_default2 = mapCacheDelete2; + __name(mapCacheGet2, "mapCacheGet"); + __name2(mapCacheGet2, "mapCacheGet"); + mapCacheGet_default2 = mapCacheGet2; + __name(mapCacheHas2, "mapCacheHas"); + __name2(mapCacheHas2, "mapCacheHas"); + mapCacheHas_default2 = mapCacheHas2; + __name(mapCacheSet2, "mapCacheSet"); + __name2(mapCacheSet2, "mapCacheSet"); + mapCacheSet_default2 = mapCacheSet2; + __name(MapCache2, "MapCache"); + __name2(MapCache2, "MapCache"); + MapCache2.prototype.clear = mapCacheClear_default2; + MapCache2.prototype["delete"] = mapCacheDelete_default2; + MapCache2.prototype.get = mapCacheGet_default2; + MapCache2.prototype.has = mapCacheHas_default2; + MapCache2.prototype.set = mapCacheSet_default2; + MapCache_default2 = MapCache2; + FUNC_ERROR_TEXT2 = "Expected a function"; + __name(memoize5, "memoize"); + __name2(memoize5, "memoize"); + memoize5.Cache = MapCache_default2; + memoize_default2 = memoize5; + MAX_MEMOIZE_SIZE2 = 500; + __name(memoizeCapped2, "memoizeCapped"); + __name2(memoizeCapped2, "memoizeCapped"); + memoizeCapped_default2 = memoizeCapped2; + rePropName2 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + reEscapeChar2 = /\\(\\)?/g; + stringToPath2 = memoizeCapped_default2(function(string3) { + var result = []; + if (string3.charCodeAt(0) === 46) { + result.push(""); + } + string3.replace(rePropName2, function(match3, number7, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar2, "$1") : number7 || match3); + }); + return result; + }); + stringToPath_default2 = stringToPath2; + __name(toString22, "toString2"); + __name2(toString22, "toString"); + toString_default2 = toString22; + __name(castPath2, "castPath"); + __name2(castPath2, "castPath"); + castPath_default2 = castPath2; + INFINITY32 = 1 / 0; + __name(toKey2, "toKey"); + __name2(toKey2, "toKey"); + toKey_default2 = toKey2; + __name(baseGet2, "baseGet"); + __name2(baseGet2, "baseGet"); + baseGet_default2 = baseGet2; + __name(get5, "get"); + __name2(get5, "get"); + get_default2 = get5; + __name(arrayPush3, "arrayPush"); + __name2(arrayPush3, "arrayPush"); + arrayPush_default2 = arrayPush3; + spreadableSymbol2 = Symbol_default2 ? Symbol_default2.isConcatSpreadable : void 0; + __name(isFlattenable2, "isFlattenable"); + __name2(isFlattenable2, "isFlattenable"); + isFlattenable_default2 = isFlattenable2; + __name(baseFlatten2, "baseFlatten"); + __name2(baseFlatten2, "baseFlatten"); + baseFlatten_default2 = baseFlatten2; + __name(flatten2, "flatten"); + __name2(flatten2, "flatten"); + flatten_default2 = flatten2; + getPrototype2 = overArg_default2(Object.getPrototypeOf, Object); + getPrototype_default2 = getPrototype2; + __name(baseSlice, "baseSlice"); + __name2(baseSlice, "baseSlice"); + baseSlice_default = baseSlice; + __name(arrayReduce2, "arrayReduce"); + __name2(arrayReduce2, "arrayReduce"); + arrayReduce_default2 = arrayReduce2; + __name(stackClear2, "stackClear"); + __name2(stackClear2, "stackClear"); + stackClear_default2 = stackClear2; + __name(stackDelete2, "stackDelete"); + __name2(stackDelete2, "stackDelete"); + stackDelete_default2 = stackDelete2; + __name(stackGet2, "stackGet"); + __name2(stackGet2, "stackGet"); + stackGet_default2 = stackGet2; + __name(stackHas2, "stackHas"); + __name2(stackHas2, "stackHas"); + stackHas_default2 = stackHas2; + LARGE_ARRAY_SIZE3 = 200; + __name(stackSet2, "stackSet"); + __name2(stackSet2, "stackSet"); + stackSet_default2 = stackSet2; + __name(Stack2, "Stack"); + __name2(Stack2, "Stack"); + Stack2.prototype.clear = stackClear_default2; + Stack2.prototype["delete"] = stackDelete_default2; + Stack2.prototype.get = stackGet_default2; + Stack2.prototype.has = stackHas_default2; + Stack2.prototype.set = stackSet_default2; + Stack_default2 = Stack2; + __name(baseAssign2, "baseAssign"); + __name2(baseAssign2, "baseAssign"); + baseAssign_default2 = baseAssign2; + __name(baseAssignIn2, "baseAssignIn"); + __name2(baseAssignIn2, "baseAssignIn"); + baseAssignIn_default2 = baseAssignIn2; + freeExports32 = typeof exports == "object" && exports && !exports.nodeType && exports; + freeModule32 = freeExports32 && typeof module == "object" && module && !module.nodeType && module; + moduleExports32 = freeModule32 && freeModule32.exports === freeExports32; + Buffer32 = moduleExports32 ? root_default2.Buffer : void 0; + allocUnsafe2 = Buffer32 ? Buffer32.allocUnsafe : void 0; + __name(cloneBuffer2, "cloneBuffer"); + __name2(cloneBuffer2, "cloneBuffer"); + cloneBuffer_default2 = cloneBuffer2; + __name(arrayFilter2, "arrayFilter"); + __name2(arrayFilter2, "arrayFilter"); + arrayFilter_default2 = arrayFilter2; + __name(stubArray2, "stubArray"); + __name2(stubArray2, "stubArray"); + stubArray_default2 = stubArray2; + objectProto132 = Object.prototype; + propertyIsEnumerable22 = objectProto132.propertyIsEnumerable; + nativeGetSymbols3 = Object.getOwnPropertySymbols; + getSymbols3 = !nativeGetSymbols3 ? stubArray_default2 : function(object3) { + if (object3 == null) { + return []; + } + object3 = Object(object3); + return arrayFilter_default2(nativeGetSymbols3(object3), function(symbol) { + return propertyIsEnumerable22.call(object3, symbol); + }); + }; + getSymbols_default2 = getSymbols3; + __name(copySymbols2, "copySymbols"); + __name2(copySymbols2, "copySymbols"); + copySymbols_default2 = copySymbols2; + nativeGetSymbols22 = Object.getOwnPropertySymbols; + getSymbolsIn2 = !nativeGetSymbols22 ? stubArray_default2 : function(object3) { + var result = []; + while (object3) { + arrayPush_default2(result, getSymbols_default2(object3)); + object3 = getPrototype_default2(object3); + } + return result; + }; + getSymbolsIn_default2 = getSymbolsIn2; + __name(copySymbolsIn2, "copySymbolsIn"); + __name2(copySymbolsIn2, "copySymbolsIn"); + copySymbolsIn_default2 = copySymbolsIn2; + __name(baseGetAllKeys2, "baseGetAllKeys"); + __name2(baseGetAllKeys2, "baseGetAllKeys"); + baseGetAllKeys_default2 = baseGetAllKeys2; + __name(getAllKeys2, "getAllKeys"); + __name2(getAllKeys2, "getAllKeys"); + getAllKeys_default2 = getAllKeys2; + __name(getAllKeysIn2, "getAllKeysIn"); + __name2(getAllKeysIn2, "getAllKeysIn"); + getAllKeysIn_default2 = getAllKeysIn2; + DataView3 = getNative_default2(root_default2, "DataView"); + DataView_default2 = DataView3; + Promise22 = getNative_default2(root_default2, "Promise"); + Promise_default2 = Promise22; + Set22 = getNative_default2(root_default2, "Set"); + Set_default2 = Set22; + mapTag22 = "[object Map]"; + objectTag22 = "[object Object]"; + promiseTag2 = "[object Promise]"; + setTag22 = "[object Set]"; + weakMapTag22 = "[object WeakMap]"; + dataViewTag22 = "[object DataView]"; + dataViewCtorString2 = toSource_default2(DataView_default2); + mapCtorString2 = toSource_default2(Map_default2); + promiseCtorString2 = toSource_default2(Promise_default2); + setCtorString2 = toSource_default2(Set_default2); + weakMapCtorString2 = toSource_default2(WeakMap_default2); + getTag3 = baseGetTag_default2; + if (DataView_default2 && getTag3(new DataView_default2(new ArrayBuffer(1))) != dataViewTag22 || Map_default2 && getTag3(new Map_default2()) != mapTag22 || Promise_default2 && getTag3(Promise_default2.resolve()) != promiseTag2 || Set_default2 && getTag3(new Set_default2()) != setTag22 || WeakMap_default2 && getTag3(new WeakMap_default2()) != weakMapTag22) { + getTag3 = /* @__PURE__ */ __name2(function(value2) { + var result = baseGetTag_default2(value2), Ctor = result == objectTag22 ? value2.constructor : void 0, ctorString = Ctor ? toSource_default2(Ctor) : ""; + if (ctorString) { + switch (ctorString) { + case dataViewCtorString2: + return dataViewTag22; + case mapCtorString2: + return mapTag22; + case promiseCtorString2: + return promiseTag2; + case setCtorString2: + return setTag22; + case weakMapCtorString2: + return weakMapTag22; + } + } + return result; + }, "getTag"); + } + getTag_default2 = getTag3; + objectProto142 = Object.prototype; + hasOwnProperty112 = objectProto142.hasOwnProperty; + __name(initCloneArray2, "initCloneArray"); + __name2(initCloneArray2, "initCloneArray"); + initCloneArray_default2 = initCloneArray2; + Uint8Array22 = root_default2.Uint8Array; + Uint8Array_default2 = Uint8Array22; + __name(cloneArrayBuffer2, "cloneArrayBuffer"); + __name2(cloneArrayBuffer2, "cloneArrayBuffer"); + cloneArrayBuffer_default2 = cloneArrayBuffer2; + __name(cloneDataView2, "cloneDataView"); + __name2(cloneDataView2, "cloneDataView"); + cloneDataView_default2 = cloneDataView2; + reFlags2 = /\w*$/; + __name(cloneRegExp2, "cloneRegExp"); + __name2(cloneRegExp2, "cloneRegExp"); + cloneRegExp_default2 = cloneRegExp2; + symbolProto22 = Symbol_default2 ? Symbol_default2.prototype : void 0; + symbolValueOf3 = symbolProto22 ? symbolProto22.valueOf : void 0; + __name(cloneSymbol2, "cloneSymbol"); + __name2(cloneSymbol2, "cloneSymbol"); + cloneSymbol_default2 = cloneSymbol2; + __name(cloneTypedArray2, "cloneTypedArray"); + __name2(cloneTypedArray2, "cloneTypedArray"); + cloneTypedArray_default2 = cloneTypedArray2; + boolTag22 = "[object Boolean]"; + dateTag22 = "[object Date]"; + mapTag32 = "[object Map]"; + numberTag22 = "[object Number]"; + regexpTag22 = "[object RegExp]"; + setTag32 = "[object Set]"; + stringTag22 = "[object String]"; + symbolTag22 = "[object Symbol]"; + arrayBufferTag22 = "[object ArrayBuffer]"; + dataViewTag32 = "[object DataView]"; + float32Tag22 = "[object Float32Array]"; + float64Tag22 = "[object Float64Array]"; + int8Tag22 = "[object Int8Array]"; + int16Tag22 = "[object Int16Array]"; + int32Tag22 = "[object Int32Array]"; + uint8Tag22 = "[object Uint8Array]"; + uint8ClampedTag22 = "[object Uint8ClampedArray]"; + uint16Tag22 = "[object Uint16Array]"; + uint32Tag22 = "[object Uint32Array]"; + __name(initCloneByTag2, "initCloneByTag"); + __name2(initCloneByTag2, "initCloneByTag"); + initCloneByTag_default2 = initCloneByTag2; + __name(initCloneObject2, "initCloneObject"); + __name2(initCloneObject2, "initCloneObject"); + initCloneObject_default2 = initCloneObject2; + mapTag42 = "[object Map]"; + __name(baseIsMap2, "baseIsMap"); + __name2(baseIsMap2, "baseIsMap"); + baseIsMap_default2 = baseIsMap2; + nodeIsMap2 = nodeUtil_default2 && nodeUtil_default2.isMap; + isMap2 = nodeIsMap2 ? baseUnary_default2(nodeIsMap2) : baseIsMap_default2; + isMap_default2 = isMap2; + setTag42 = "[object Set]"; + __name(baseIsSet2, "baseIsSet"); + __name2(baseIsSet2, "baseIsSet"); + baseIsSet_default2 = baseIsSet2; + nodeIsSet2 = nodeUtil_default2 && nodeUtil_default2.isSet; + isSet2 = nodeIsSet2 ? baseUnary_default2(nodeIsSet2) : baseIsSet_default2; + isSet_default2 = isSet2; + CLONE_DEEP_FLAG3 = 1; + CLONE_FLAT_FLAG2 = 2; + CLONE_SYMBOLS_FLAG4 = 4; + argsTag32 = "[object Arguments]"; + arrayTag22 = "[object Array]"; + boolTag32 = "[object Boolean]"; + dateTag32 = "[object Date]"; + errorTag22 = "[object Error]"; + funcTag32 = "[object Function]"; + genTag22 = "[object GeneratorFunction]"; + mapTag52 = "[object Map]"; + numberTag32 = "[object Number]"; + objectTag32 = "[object Object]"; + regexpTag32 = "[object RegExp]"; + setTag52 = "[object Set]"; + stringTag32 = "[object String]"; + symbolTag32 = "[object Symbol]"; + weakMapTag32 = "[object WeakMap]"; + arrayBufferTag32 = "[object ArrayBuffer]"; + dataViewTag42 = "[object DataView]"; + float32Tag32 = "[object Float32Array]"; + float64Tag32 = "[object Float64Array]"; + int8Tag32 = "[object Int8Array]"; + int16Tag32 = "[object Int16Array]"; + int32Tag32 = "[object Int32Array]"; + uint8Tag32 = "[object Uint8Array]"; + uint8ClampedTag32 = "[object Uint8ClampedArray]"; + uint16Tag32 = "[object Uint16Array]"; + uint32Tag32 = "[object Uint32Array]"; + cloneableTags2 = {}; + cloneableTags2[argsTag32] = cloneableTags2[arrayTag22] = cloneableTags2[arrayBufferTag32] = cloneableTags2[dataViewTag42] = cloneableTags2[boolTag32] = cloneableTags2[dateTag32] = cloneableTags2[float32Tag32] = cloneableTags2[float64Tag32] = cloneableTags2[int8Tag32] = cloneableTags2[int16Tag32] = cloneableTags2[int32Tag32] = cloneableTags2[mapTag52] = cloneableTags2[numberTag32] = cloneableTags2[objectTag32] = cloneableTags2[regexpTag32] = cloneableTags2[setTag52] = cloneableTags2[stringTag32] = cloneableTags2[symbolTag32] = cloneableTags2[uint8Tag32] = cloneableTags2[uint8ClampedTag32] = cloneableTags2[uint16Tag32] = cloneableTags2[uint32Tag32] = true; + cloneableTags2[errorTag22] = cloneableTags2[funcTag32] = cloneableTags2[weakMapTag32] = false; + __name(baseClone2, "baseClone"); + __name2(baseClone2, "baseClone"); + baseClone_default2 = baseClone2; + CLONE_SYMBOLS_FLAG22 = 4; + __name(clone7, "clone"); + __name2(clone7, "clone"); + clone_default3 = clone7; + __name(compact, "compact"); + __name2(compact, "compact"); + compact_default = compact; + HASH_UNDEFINED32 = "__lodash_hash_undefined__"; + __name(setCacheAdd2, "setCacheAdd"); + __name2(setCacheAdd2, "setCacheAdd"); + setCacheAdd_default2 = setCacheAdd2; + __name(setCacheHas2, "setCacheHas"); + __name2(setCacheHas2, "setCacheHas"); + setCacheHas_default2 = setCacheHas2; + __name(SetCache2, "SetCache"); + __name2(SetCache2, "SetCache"); + SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd_default2; + SetCache2.prototype.has = setCacheHas_default2; + SetCache_default2 = SetCache2; + __name(arraySome2, "arraySome"); + __name2(arraySome2, "arraySome"); + arraySome_default2 = arraySome2; + __name(cacheHas2, "cacheHas"); + __name2(cacheHas2, "cacheHas"); + cacheHas_default2 = cacheHas2; + COMPARE_PARTIAL_FLAG7 = 1; + COMPARE_UNORDERED_FLAG5 = 2; + __name(equalArrays2, "equalArrays"); + __name2(equalArrays2, "equalArrays"); + equalArrays_default2 = equalArrays2; + __name(mapToArray2, "mapToArray"); + __name2(mapToArray2, "mapToArray"); + mapToArray_default2 = mapToArray2; + __name(setToArray2, "setToArray"); + __name2(setToArray2, "setToArray"); + setToArray_default2 = setToArray2; + COMPARE_PARTIAL_FLAG22 = 1; + COMPARE_UNORDERED_FLAG22 = 2; + boolTag42 = "[object Boolean]"; + dateTag42 = "[object Date]"; + errorTag32 = "[object Error]"; + mapTag62 = "[object Map]"; + numberTag42 = "[object Number]"; + regexpTag42 = "[object RegExp]"; + setTag62 = "[object Set]"; + stringTag42 = "[object String]"; + symbolTag42 = "[object Symbol]"; + arrayBufferTag42 = "[object ArrayBuffer]"; + dataViewTag52 = "[object DataView]"; + symbolProto32 = Symbol_default2 ? Symbol_default2.prototype : void 0; + symbolValueOf22 = symbolProto32 ? symbolProto32.valueOf : void 0; + __name(equalByTag2, "equalByTag"); + __name2(equalByTag2, "equalByTag"); + equalByTag_default2 = equalByTag2; + COMPARE_PARTIAL_FLAG32 = 1; + objectProto152 = Object.prototype; + hasOwnProperty122 = objectProto152.hasOwnProperty; + __name(equalObjects2, "equalObjects"); + __name2(equalObjects2, "equalObjects"); + equalObjects_default2 = equalObjects2; + COMPARE_PARTIAL_FLAG42 = 1; + argsTag42 = "[object Arguments]"; + arrayTag32 = "[object Array]"; + objectTag42 = "[object Object]"; + objectProto162 = Object.prototype; + hasOwnProperty132 = objectProto162.hasOwnProperty; + __name(baseIsEqualDeep2, "baseIsEqualDeep"); + __name2(baseIsEqualDeep2, "baseIsEqualDeep"); + baseIsEqualDeep_default2 = baseIsEqualDeep2; + __name(baseIsEqual2, "baseIsEqual"); + __name2(baseIsEqual2, "baseIsEqual"); + baseIsEqual_default2 = baseIsEqual2; + COMPARE_PARTIAL_FLAG52 = 1; + COMPARE_UNORDERED_FLAG32 = 2; + __name(baseIsMatch2, "baseIsMatch"); + __name2(baseIsMatch2, "baseIsMatch"); + baseIsMatch_default2 = baseIsMatch2; + __name(isStrictComparable2, "isStrictComparable"); + __name2(isStrictComparable2, "isStrictComparable"); + isStrictComparable_default2 = isStrictComparable2; + __name(getMatchData2, "getMatchData"); + __name2(getMatchData2, "getMatchData"); + getMatchData_default2 = getMatchData2; + __name(matchesStrictComparable2, "matchesStrictComparable"); + __name2(matchesStrictComparable2, "matchesStrictComparable"); + matchesStrictComparable_default2 = matchesStrictComparable2; + __name(baseMatches2, "baseMatches"); + __name2(baseMatches2, "baseMatches"); + baseMatches_default2 = baseMatches2; + __name(baseHasIn2, "baseHasIn"); + __name2(baseHasIn2, "baseHasIn"); + baseHasIn_default2 = baseHasIn2; + __name(hasPath2, "hasPath"); + __name2(hasPath2, "hasPath"); + hasPath_default2 = hasPath2; + __name(hasIn2, "hasIn"); + __name2(hasIn2, "hasIn"); + hasIn_default2 = hasIn2; + COMPARE_PARTIAL_FLAG62 = 1; + COMPARE_UNORDERED_FLAG42 = 2; + __name(baseMatchesProperty2, "baseMatchesProperty"); + __name2(baseMatchesProperty2, "baseMatchesProperty"); + baseMatchesProperty_default2 = baseMatchesProperty2; + __name(baseProperty2, "baseProperty"); + __name2(baseProperty2, "baseProperty"); + baseProperty_default2 = baseProperty2; + __name(basePropertyDeep2, "basePropertyDeep"); + __name2(basePropertyDeep2, "basePropertyDeep"); + basePropertyDeep_default2 = basePropertyDeep2; + __name(property2, "property"); + __name2(property2, "property"); + property_default3 = property2; + __name(baseIteratee2, "baseIteratee"); + __name2(baseIteratee2, "baseIteratee"); + baseIteratee_default2 = baseIteratee2; + __name(arrayAggregator, "arrayAggregator"); + __name2(arrayAggregator, "arrayAggregator"); + arrayAggregator_default = arrayAggregator; + __name(createBaseFor2, "createBaseFor"); + __name2(createBaseFor2, "createBaseFor"); + createBaseFor_default2 = createBaseFor2; + baseFor2 = createBaseFor_default2(); + baseFor_default2 = baseFor2; + __name(baseForOwn2, "baseForOwn"); + __name2(baseForOwn2, "baseForOwn"); + baseForOwn_default2 = baseForOwn2; + __name(createBaseEach2, "createBaseEach"); + __name2(createBaseEach2, "createBaseEach"); + createBaseEach_default2 = createBaseEach2; + baseEach2 = createBaseEach_default2(baseForOwn_default2); + baseEach_default2 = baseEach2; + __name(baseAggregator, "baseAggregator"); + __name2(baseAggregator, "baseAggregator"); + baseAggregator_default = baseAggregator; + __name(createAggregator, "createAggregator"); + __name2(createAggregator, "createAggregator"); + createAggregator_default = createAggregator; + objectProto172 = Object.prototype; + hasOwnProperty142 = objectProto172.hasOwnProperty; + defaults4 = baseRest_default2(function(object3, sources) { + object3 = Object(object3); + var index = -1; + var length2 = sources.length; + var guard = length2 > 2 ? sources[2] : void 0; + if (guard && isIterateeCall_default2(sources[0], sources[1], guard)) { + length2 = 1; + } + while (++index < length2) { + var source = sources[index]; + var props = keysIn_default2(source); + var propsIndex = -1; + var propsLength = props.length; + while (++propsIndex < propsLength) { + var key = props[propsIndex]; + var value2 = object3[key]; + if (value2 === void 0 || eq_default2(value2, objectProto172[key]) && !hasOwnProperty142.call(object3, key)) { + object3[key] = source[key]; + } + } + } + return object3; + }); + defaults_default2 = defaults4; + __name(isArrayLikeObject3, "isArrayLikeObject"); + __name2(isArrayLikeObject3, "isArrayLikeObject"); + isArrayLikeObject_default2 = isArrayLikeObject3; + __name(arrayIncludesWith2, "arrayIncludesWith"); + __name2(arrayIncludesWith2, "arrayIncludesWith"); + arrayIncludesWith_default2 = arrayIncludesWith2; + LARGE_ARRAY_SIZE22 = 200; + __name(baseDifference, "baseDifference"); + __name2(baseDifference, "baseDifference"); + baseDifference_default = baseDifference; + difference = baseRest_default2(function(array4, values22) { + return isArrayLikeObject_default2(array4) ? baseDifference_default(array4, baseFlatten_default2(values22, 1, isArrayLikeObject_default2, true)) : []; + }); + difference_default = difference; + __name(last3, "last"); + __name2(last3, "last"); + last_default2 = last3; + __name(drop, "drop"); + __name2(drop, "drop"); + drop_default = drop; + __name(dropRight, "dropRight"); + __name2(dropRight, "dropRight"); + dropRight_default = dropRight; + __name(castFunction2, "castFunction"); + __name2(castFunction2, "castFunction"); + castFunction_default2 = castFunction2; + __name(forEach3, "forEach"); + __name2(forEach3, "forEach"); + forEach_default2 = forEach3; + __name(arrayEvery, "arrayEvery"); + __name2(arrayEvery, "arrayEvery"); + arrayEvery_default = arrayEvery; + __name(baseEvery, "baseEvery"); + __name2(baseEvery, "baseEvery"); + baseEvery_default = baseEvery; + __name(every2, "every"); + __name2(every2, "every"); + every_default = every2; + __name(baseFilter2, "baseFilter"); + __name2(baseFilter2, "baseFilter"); + baseFilter_default2 = baseFilter2; + __name(filter6, "filter"); + __name2(filter6, "filter"); + filter_default4 = filter6; + __name(createFind2, "createFind"); + __name2(createFind2, "createFind"); + createFind_default2 = createFind2; + nativeMax22 = Math.max; + __name(findIndex2, "findIndex"); + __name2(findIndex2, "findIndex"); + findIndex_default2 = findIndex2; + find3 = createFind_default2(findIndex_default2); + find_default3 = find3; + __name(head, "head"); + __name2(head, "head"); + head_default = head; + __name(baseMap2, "baseMap"); + __name2(baseMap2, "baseMap"); + baseMap_default2 = baseMap2; + __name(map5, "map"); + __name2(map5, "map"); + map_default2 = map5; + __name(flatMap, "flatMap"); + __name2(flatMap, "flatMap"); + flatMap_default = flatMap; + objectProto182 = Object.prototype; + hasOwnProperty152 = objectProto182.hasOwnProperty; + groupBy = createAggregator_default(function(result, value2, key) { + if (hasOwnProperty152.call(result, key)) { + result[key].push(value2); + } else { + baseAssignValue_default2(result, key, [value2]); + } + }); + groupBy_default = groupBy; + objectProto192 = Object.prototype; + hasOwnProperty162 = objectProto192.hasOwnProperty; + __name(baseHas2, "baseHas"); + __name2(baseHas2, "baseHas"); + baseHas_default2 = baseHas2; + __name(has2, "has"); + __name2(has2, "has"); + has_default2 = has2; + stringTag52 = "[object String]"; + __name(isString2, "isString"); + __name2(isString2, "isString"); + isString_default2 = isString2; + __name(baseValues2, "baseValues"); + __name2(baseValues2, "baseValues"); + baseValues_default2 = baseValues2; + __name(values2, "values"); + __name2(values2, "values"); + values_default2 = values2; + nativeMax32 = Math.max; + __name(includes, "includes"); + __name2(includes, "includes"); + includes_default = includes; + nativeMax42 = Math.max; + __name(indexOf, "indexOf"); + __name2(indexOf, "indexOf"); + indexOf_default = indexOf; + mapTag72 = "[object Map]"; + setTag72 = "[object Set]"; + objectProto202 = Object.prototype; + hasOwnProperty172 = objectProto202.hasOwnProperty; + __name(isEmpty3, "isEmpty"); + __name2(isEmpty3, "isEmpty"); + isEmpty_default2 = isEmpty3; + regexpTag52 = "[object RegExp]"; + __name(baseIsRegExp, "baseIsRegExp"); + __name2(baseIsRegExp, "baseIsRegExp"); + baseIsRegExp_default = baseIsRegExp; + nodeIsRegExp = nodeUtil_default2 && nodeUtil_default2.isRegExp; + isRegExp = nodeIsRegExp ? baseUnary_default2(nodeIsRegExp) : baseIsRegExp_default; + isRegExp_default = isRegExp; + __name(isUndefined2, "isUndefined"); + __name2(isUndefined2, "isUndefined"); + isUndefined_default2 = isUndefined2; + FUNC_ERROR_TEXT22 = "Expected a function"; + __name(negate, "negate"); + __name2(negate, "negate"); + negate_default = negate; + __name(baseSet2, "baseSet"); + __name2(baseSet2, "baseSet"); + baseSet_default2 = baseSet2; + __name(basePickBy2, "basePickBy"); + __name2(basePickBy2, "basePickBy"); + basePickBy_default2 = basePickBy2; + __name(pickBy, "pickBy"); + __name2(pickBy, "pickBy"); + pickBy_default = pickBy; + __name(baseReduce2, "baseReduce"); + __name2(baseReduce2, "baseReduce"); + baseReduce_default2 = baseReduce2; + __name(reduce3, "reduce"); + __name2(reduce3, "reduce"); + reduce_default2 = reduce3; + __name(reject2, "reject"); + __name2(reject2, "reject"); + reject_default = reject2; + __name(baseSome, "baseSome"); + __name2(baseSome, "baseSome"); + baseSome_default = baseSome; + __name(some2, "some"); + __name2(some2, "some"); + some_default = some2; + INFINITY42 = 1 / 0; + createSet2 = !(Set_default2 && 1 / setToArray_default2(new Set_default2([, -0]))[1] == INFINITY42) ? noop_default3 : function(values22) { + return new Set_default2(values22); + }; + createSet_default2 = createSet2; + LARGE_ARRAY_SIZE32 = 200; + __name(baseUniq2, "baseUniq"); + __name2(baseUniq2, "baseUniq"); + baseUniq_default2 = baseUniq2; + __name(uniq, "uniq"); + __name2(uniq, "uniq"); + uniq_default = uniq; + __name(PRINT_ERROR, "PRINT_ERROR"); + __name2(PRINT_ERROR, "PRINT_ERROR"); + __name(PRINT_WARNING, "PRINT_WARNING"); + __name2(PRINT_WARNING, "PRINT_WARNING"); + __name(timer2, "timer"); + __name2(timer2, "timer"); + __name(toFastProperties, "toFastProperties"); + __name2(toFastProperties, "toFastProperties"); + __name(tokenLabel, "tokenLabel"); + __name2(tokenLabel, "tokenLabel"); + __name(hasTokenLabel, "hasTokenLabel"); + __name2(hasTokenLabel, "hasTokenLabel"); + AbstractProduction = class { + static { + __name(this, "AbstractProduction"); + } + static { + __name2(this, "AbstractProduction"); + } + get definition() { + return this._definition; + } + set definition(value2) { + this._definition = value2; + } + constructor(_definition) { + this._definition = _definition; + } + accept(visitor2) { + visitor2.visit(this); + forEach_default2(this.definition, (prod) => { + prod.accept(visitor2); + }); + } + }; + NonTerminal = class extends AbstractProduction { + static { + __name(this, "NonTerminal"); + } + static { + __name2(this, "NonTerminal"); + } + constructor(options2) { + super([]); + this.idx = 1; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + set definition(definition) { + } + get definition() { + if (this.referencedRule !== void 0) { + return this.referencedRule.definition; + } + return []; + } + accept(visitor2) { + visitor2.visit(this); + } + }; + Rule = class extends AbstractProduction { + static { + __name(this, "Rule"); + } + static { + __name2(this, "Rule"); + } + constructor(options2) { + super(options2.definition); + this.orgText = ""; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + }; + Alternative = class extends AbstractProduction { + static { + __name(this, "Alternative"); + } + static { + __name2(this, "Alternative"); + } + constructor(options2) { + super(options2.definition); + this.ignoreAmbiguities = false; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + }; + Option2 = class extends AbstractProduction { + static { + __name(this, "Option"); + } + static { + __name2(this, "Option"); + } + constructor(options2) { + super(options2.definition); + this.idx = 1; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + }; + RepetitionMandatory = class extends AbstractProduction { + static { + __name(this, "RepetitionMandatory"); + } + static { + __name2(this, "RepetitionMandatory"); + } + constructor(options2) { + super(options2.definition); + this.idx = 1; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + }; + RepetitionMandatoryWithSeparator = class extends AbstractProduction { + static { + __name(this, "RepetitionMandatoryWithSeparator"); + } + static { + __name2(this, "RepetitionMandatoryWithSeparator"); + } + constructor(options2) { + super(options2.definition); + this.idx = 1; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + }; + Repetition = class extends AbstractProduction { + static { + __name(this, "Repetition"); + } + static { + __name2(this, "Repetition"); + } + constructor(options2) { + super(options2.definition); + this.idx = 1; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + }; + RepetitionWithSeparator = class extends AbstractProduction { + static { + __name(this, "RepetitionWithSeparator"); + } + static { + __name2(this, "RepetitionWithSeparator"); + } + constructor(options2) { + super(options2.definition); + this.idx = 1; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + }; + Alternation = class extends AbstractProduction { + static { + __name(this, "Alternation"); + } + static { + __name2(this, "Alternation"); + } + get definition() { + return this._definition; + } + set definition(value2) { + this._definition = value2; + } + constructor(options2) { + super(options2.definition); + this.idx = 1; + this.ignoreAmbiguities = false; + this.hasPredicates = false; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + }; + Terminal = class { + static { + __name(this, "Terminal"); + } + static { + __name2(this, "Terminal"); + } + constructor(options2) { + this.idx = 1; + assign_default(this, pickBy_default(options2, (v3) => v3 !== void 0)); + } + accept(visitor2) { + visitor2.visit(this); + } + }; + __name(serializeGrammar, "serializeGrammar"); + __name2(serializeGrammar, "serializeGrammar"); + __name(serializeProduction, "serializeProduction"); + __name2(serializeProduction, "serializeProduction"); + GAstVisitor = class { + static { + __name(this, "GAstVisitor"); + } + static { + __name2(this, "GAstVisitor"); + } + visit(node2) { + const nodeAny = node2; + switch (nodeAny.constructor) { + case NonTerminal: + return this.visitNonTerminal(nodeAny); + case Alternative: + return this.visitAlternative(nodeAny); + case Option2: + return this.visitOption(nodeAny); + case RepetitionMandatory: + return this.visitRepetitionMandatory(nodeAny); + case RepetitionMandatoryWithSeparator: + return this.visitRepetitionMandatoryWithSeparator(nodeAny); + case RepetitionWithSeparator: + return this.visitRepetitionWithSeparator(nodeAny); + case Repetition: + return this.visitRepetition(nodeAny); + case Alternation: + return this.visitAlternation(nodeAny); + case Terminal: + return this.visitTerminal(nodeAny); + case Rule: + return this.visitRule(nodeAny); + /* c8 ignore next 2 */ + default: + throw Error("non exhaustive match"); + } + } + /* c8 ignore next */ + visitNonTerminal(node2) { + } + /* c8 ignore next */ + visitAlternative(node2) { + } + /* c8 ignore next */ + visitOption(node2) { + } + /* c8 ignore next */ + visitRepetition(node2) { + } + /* c8 ignore next */ + visitRepetitionMandatory(node2) { + } + /* c8 ignore next 3 */ + visitRepetitionMandatoryWithSeparator(node2) { + } + /* c8 ignore next */ + visitRepetitionWithSeparator(node2) { + } + /* c8 ignore next */ + visitAlternation(node2) { + } + /* c8 ignore next */ + visitTerminal(node2) { + } + /* c8 ignore next */ + visitRule(node2) { + } + }; + __name(isSequenceProd, "isSequenceProd"); + __name2(isSequenceProd, "isSequenceProd"); + __name(isOptionalProd, "isOptionalProd"); + __name2(isOptionalProd, "isOptionalProd"); + __name(isBranchingProd, "isBranchingProd"); + __name2(isBranchingProd, "isBranchingProd"); + __name(getProductionDslName, "getProductionDslName"); + __name2(getProductionDslName, "getProductionDslName"); + RestWalker = class { + static { + __name(this, "RestWalker"); + } + static { + __name2(this, "RestWalker"); + } + walk(prod, prevRest = []) { + forEach_default2(prod.definition, (subProd, index) => { + const currRest = drop_default(prod.definition, index + 1); + if (subProd instanceof NonTerminal) { + this.walkProdRef(subProd, currRest, prevRest); + } else if (subProd instanceof Terminal) { + this.walkTerminal(subProd, currRest, prevRest); + } else if (subProd instanceof Alternative) { + this.walkFlat(subProd, currRest, prevRest); + } else if (subProd instanceof Option2) { + this.walkOption(subProd, currRest, prevRest); + } else if (subProd instanceof RepetitionMandatory) { + this.walkAtLeastOne(subProd, currRest, prevRest); + } else if (subProd instanceof RepetitionMandatoryWithSeparator) { + this.walkAtLeastOneSep(subProd, currRest, prevRest); + } else if (subProd instanceof RepetitionWithSeparator) { + this.walkManySep(subProd, currRest, prevRest); + } else if (subProd instanceof Repetition) { + this.walkMany(subProd, currRest, prevRest); + } else if (subProd instanceof Alternation) { + this.walkOr(subProd, currRest, prevRest); + } else { + throw Error("non exhaustive match"); + } + }); + } + walkTerminal(terminal, currRest, prevRest) { + } + walkProdRef(refProd, currRest, prevRest) { + } + walkFlat(flatProd, currRest, prevRest) { + const fullOrRest = currRest.concat(prevRest); + this.walk(flatProd, fullOrRest); + } + walkOption(optionProd, currRest, prevRest) { + const fullOrRest = currRest.concat(prevRest); + this.walk(optionProd, fullOrRest); + } + walkAtLeastOne(atLeastOneProd, currRest, prevRest) { + const fullAtLeastOneRest = [ + new Option2({ definition: atLeastOneProd.definition }) + ].concat(currRest, prevRest); + this.walk(atLeastOneProd, fullAtLeastOneRest); + } + walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) { + const fullAtLeastOneSepRest = restForRepetitionWithSeparator(atLeastOneSepProd, currRest, prevRest); + this.walk(atLeastOneSepProd, fullAtLeastOneSepRest); + } + walkMany(manyProd, currRest, prevRest) { + const fullManyRest = [ + new Option2({ definition: manyProd.definition }) + ].concat(currRest, prevRest); + this.walk(manyProd, fullManyRest); + } + walkManySep(manySepProd, currRest, prevRest) { + const fullManySepRest = restForRepetitionWithSeparator(manySepProd, currRest, prevRest); + this.walk(manySepProd, fullManySepRest); + } + walkOr(orProd, currRest, prevRest) { + const fullOrRest = currRest.concat(prevRest); + forEach_default2(orProd.definition, (alt) => { + const prodWrapper = new Alternative({ definition: [alt] }); + this.walk(prodWrapper, fullOrRest); + }); + } + }; + __name(restForRepetitionWithSeparator, "restForRepetitionWithSeparator"); + __name2(restForRepetitionWithSeparator, "restForRepetitionWithSeparator"); + __name(first2, "first"); + __name2(first2, "first"); + __name(firstForSequence, "firstForSequence"); + __name2(firstForSequence, "firstForSequence"); + __name(firstForBranching, "firstForBranching"); + __name2(firstForBranching, "firstForBranching"); + __name(firstForTerminal, "firstForTerminal"); + __name2(firstForTerminal, "firstForTerminal"); + IN = "_~IN~_"; + ResyncFollowsWalker = class extends RestWalker { + static { + __name(this, "ResyncFollowsWalker"); + } + static { + __name2(this, "ResyncFollowsWalker"); + } + constructor(topProd) { + super(); + this.topProd = topProd; + this.follows = {}; + } + startWalking() { + this.walk(this.topProd); + return this.follows; + } + walkTerminal(terminal, currRest, prevRest) { + } + walkProdRef(refProd, currRest, prevRest) { + const followName = buildBetweenProdsFollowPrefix(refProd.referencedRule, refProd.idx) + this.topProd.name; + const fullRest = currRest.concat(prevRest); + const restProd = new Alternative({ definition: fullRest }); + const t_in_topProd_follows = first2(restProd); + this.follows[followName] = t_in_topProd_follows; + } + }; + __name(computeAllProdsFollows, "computeAllProdsFollows"); + __name2(computeAllProdsFollows, "computeAllProdsFollows"); + __name(buildBetweenProdsFollowPrefix, "buildBetweenProdsFollowPrefix"); + __name2(buildBetweenProdsFollowPrefix, "buildBetweenProdsFollowPrefix"); + regExpAstCache = {}; + regExpParser = new RegExpParser(); + __name(getRegExpAst, "getRegExpAst"); + __name2(getRegExpAst, "getRegExpAst"); + __name(clearRegExpParserCache, "clearRegExpParserCache"); + __name2(clearRegExpParserCache, "clearRegExpParserCache"); + complementErrorMessage = "Complement Sets are not supported for first char optimization"; + failedOptimizationPrefixMsg = 'Unable to use "first char" lexer optimizations:\n'; + __name(getOptimizedStartCodesIndices, "getOptimizedStartCodesIndices"); + __name2(getOptimizedStartCodesIndices, "getOptimizedStartCodesIndices"); + __name(firstCharOptimizedIndices, "firstCharOptimizedIndices"); + __name2(firstCharOptimizedIndices, "firstCharOptimizedIndices"); + __name(addOptimizedIdxToResult, "addOptimizedIdxToResult"); + __name2(addOptimizedIdxToResult, "addOptimizedIdxToResult"); + __name(handleIgnoreCase, "handleIgnoreCase"); + __name2(handleIgnoreCase, "handleIgnoreCase"); + __name(findCode, "findCode"); + __name2(findCode, "findCode"); + __name(isWholeOptional, "isWholeOptional"); + __name2(isWholeOptional, "isWholeOptional"); + CharCodeFinder = class extends BaseRegExpVisitor { + static { + __name(this, "CharCodeFinder"); + } + static { + __name2(this, "CharCodeFinder"); + } + constructor(targetCharCodes) { + super(); + this.targetCharCodes = targetCharCodes; + this.found = false; + } + visitChildren(node2) { + if (this.found === true) { + return; + } + switch (node2.type) { + case "Lookahead": + this.visitLookahead(node2); + return; + case "NegativeLookahead": + this.visitNegativeLookahead(node2); + return; + case "Lookbehind": + this.visitLookbehind(node2); + return; + case "NegativeLookbehind": + this.visitNegativeLookbehind(node2); + return; + } + super.visitChildren(node2); + } + visitCharacter(node2) { + if (includes_default(this.targetCharCodes, node2.value)) { + this.found = true; + } + } + visitSet(node2) { + if (node2.complement) { + if (findCode(node2, this.targetCharCodes) === void 0) { + this.found = true; + } + } else { + if (findCode(node2, this.targetCharCodes) !== void 0) { + this.found = true; + } + } + } + }; + __name(canMatchCharCode, "canMatchCharCode"); + __name2(canMatchCharCode, "canMatchCharCode"); + PATTERN = "PATTERN"; + DEFAULT_MODE = "defaultMode"; + MODES = "modes"; + SUPPORT_STICKY = typeof new RegExp("(?:)").sticky === "boolean"; + __name(analyzeTokenTypes, "analyzeTokenTypes"); + __name2(analyzeTokenTypes, "analyzeTokenTypes"); + __name(validatePatterns, "validatePatterns"); + __name2(validatePatterns, "validatePatterns"); + __name(validateRegExpPattern, "validateRegExpPattern"); + __name2(validateRegExpPattern, "validateRegExpPattern"); + __name(findMissingPatterns, "findMissingPatterns"); + __name2(findMissingPatterns, "findMissingPatterns"); + __name(findInvalidPatterns, "findInvalidPatterns"); + __name2(findInvalidPatterns, "findInvalidPatterns"); + end_of_input = /[^\\][$]/; + __name(findEndOfInputAnchor, "findEndOfInputAnchor"); + __name2(findEndOfInputAnchor, "findEndOfInputAnchor"); + __name(findEmptyMatchRegExps, "findEmptyMatchRegExps"); + __name2(findEmptyMatchRegExps, "findEmptyMatchRegExps"); + start_of_input = /[^\\[][\^]|^\^/; + __name(findStartOfInputAnchor, "findStartOfInputAnchor"); + __name2(findStartOfInputAnchor, "findStartOfInputAnchor"); + __name(findUnsupportedFlags, "findUnsupportedFlags"); + __name2(findUnsupportedFlags, "findUnsupportedFlags"); + __name(findDuplicatePatterns, "findDuplicatePatterns"); + __name2(findDuplicatePatterns, "findDuplicatePatterns"); + __name(findInvalidGroupType, "findInvalidGroupType"); + __name2(findInvalidGroupType, "findInvalidGroupType"); + __name(findModesThatDoNotExist, "findModesThatDoNotExist"); + __name2(findModesThatDoNotExist, "findModesThatDoNotExist"); + __name(findUnreachablePatterns, "findUnreachablePatterns"); + __name2(findUnreachablePatterns, "findUnreachablePatterns"); + __name(tryToMatchStrToPattern, "tryToMatchStrToPattern"); + __name2(tryToMatchStrToPattern, "tryToMatchStrToPattern"); + __name(noMetaChar, "noMetaChar"); + __name2(noMetaChar, "noMetaChar"); + __name(usesLookAheadOrBehind, "usesLookAheadOrBehind"); + __name2(usesLookAheadOrBehind, "usesLookAheadOrBehind"); + __name(addStartOfInput, "addStartOfInput"); + __name2(addStartOfInput, "addStartOfInput"); + __name(addStickyFlag, "addStickyFlag"); + __name2(addStickyFlag, "addStickyFlag"); + __name(performRuntimeChecks, "performRuntimeChecks"); + __name2(performRuntimeChecks, "performRuntimeChecks"); + __name(performWarningRuntimeChecks, "performWarningRuntimeChecks"); + __name2(performWarningRuntimeChecks, "performWarningRuntimeChecks"); + __name(cloneEmptyGroups, "cloneEmptyGroups"); + __name2(cloneEmptyGroups, "cloneEmptyGroups"); + __name(isCustomPattern, "isCustomPattern"); + __name2(isCustomPattern, "isCustomPattern"); + __name(isShortPattern, "isShortPattern"); + __name2(isShortPattern, "isShortPattern"); + LineTerminatorOptimizedTester = { + // implements /\n|\r\n?/g.test + test: /* @__PURE__ */ __name2(function(text4) { + const len = text4.length; + for (let i2 = this.lastIndex; i2 < len; i2++) { + const c3 = text4.charCodeAt(i2); + if (c3 === 10) { + this.lastIndex = i2 + 1; + return true; + } else if (c3 === 13) { + if (text4.charCodeAt(i2 + 1) === 10) { + this.lastIndex = i2 + 2; + } else { + this.lastIndex = i2 + 1; + } + return true; + } + } + return false; + }, "test"), + lastIndex: 0 + }; + __name(checkLineBreaksIssues, "checkLineBreaksIssues"); + __name2(checkLineBreaksIssues, "checkLineBreaksIssues"); + __name(buildLineBreakIssueMessage, "buildLineBreakIssueMessage"); + __name2(buildLineBreakIssueMessage, "buildLineBreakIssueMessage"); + __name(getCharCodes, "getCharCodes"); + __name2(getCharCodes, "getCharCodes"); + __name(addToMapOfArrays, "addToMapOfArrays"); + __name2(addToMapOfArrays, "addToMapOfArrays"); + minOptimizationVal = 256; + charCodeToOptimizedIdxMap = []; + __name(charCodeToOptimizedIndex, "charCodeToOptimizedIndex"); + __name2(charCodeToOptimizedIndex, "charCodeToOptimizedIndex"); + __name(initCharCodeToOptimizedIndexMap, "initCharCodeToOptimizedIndexMap"); + __name2(initCharCodeToOptimizedIndexMap, "initCharCodeToOptimizedIndexMap"); + __name(tokenStructuredMatcher, "tokenStructuredMatcher"); + __name2(tokenStructuredMatcher, "tokenStructuredMatcher"); + __name(tokenStructuredMatcherNoCategories, "tokenStructuredMatcherNoCategories"); + __name2(tokenStructuredMatcherNoCategories, "tokenStructuredMatcherNoCategories"); + tokenShortNameIdx = 1; + tokenIdxToClass = {}; + __name(augmentTokenTypes, "augmentTokenTypes"); + __name2(augmentTokenTypes, "augmentTokenTypes"); + __name(expandCategories, "expandCategories"); + __name2(expandCategories, "expandCategories"); + __name(assignTokenDefaultProps, "assignTokenDefaultProps"); + __name2(assignTokenDefaultProps, "assignTokenDefaultProps"); + __name(assignCategoriesTokensProp, "assignCategoriesTokensProp"); + __name2(assignCategoriesTokensProp, "assignCategoriesTokensProp"); + __name(assignCategoriesMapProp, "assignCategoriesMapProp"); + __name2(assignCategoriesMapProp, "assignCategoriesMapProp"); + __name(singleAssignCategoriesToksMap, "singleAssignCategoriesToksMap"); + __name2(singleAssignCategoriesToksMap, "singleAssignCategoriesToksMap"); + __name(hasShortKeyProperty, "hasShortKeyProperty"); + __name2(hasShortKeyProperty, "hasShortKeyProperty"); + __name(hasCategoriesProperty, "hasCategoriesProperty"); + __name2(hasCategoriesProperty, "hasCategoriesProperty"); + __name(hasExtendingTokensTypesProperty, "hasExtendingTokensTypesProperty"); + __name2(hasExtendingTokensTypesProperty, "hasExtendingTokensTypesProperty"); + __name(hasExtendingTokensTypesMapProperty, "hasExtendingTokensTypesMapProperty"); + __name2(hasExtendingTokensTypesMapProperty, "hasExtendingTokensTypesMapProperty"); + __name(isTokenType, "isTokenType"); + __name2(isTokenType, "isTokenType"); + defaultLexerErrorProvider = { + buildUnableToPopLexerModeMessage(token2) { + return `Unable to pop Lexer Mode after encountering Token ->${token2.image}<- The Mode Stack is empty`; + }, + buildUnexpectedCharactersMessage(fullText, startOffset, length2, line2, column2, mode) { + return `unexpected character: ->${fullText.charAt(startOffset)}<- at offset: ${startOffset}, skipped ${length2} characters.`; + } + }; + (function(LexerDefinitionErrorType2) { + LexerDefinitionErrorType2[LexerDefinitionErrorType2["MISSING_PATTERN"] = 0] = "MISSING_PATTERN"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["INVALID_PATTERN"] = 1] = "INVALID_PATTERN"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["EOI_ANCHOR_FOUND"] = 2] = "EOI_ANCHOR_FOUND"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["UNSUPPORTED_FLAGS_FOUND"] = 3] = "UNSUPPORTED_FLAGS_FOUND"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["DUPLICATE_PATTERNS_FOUND"] = 4] = "DUPLICATE_PATTERNS_FOUND"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["INVALID_GROUP_TYPE_FOUND"] = 5] = "INVALID_GROUP_TYPE_FOUND"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["PUSH_MODE_DOES_NOT_EXIST"] = 6] = "PUSH_MODE_DOES_NOT_EXIST"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE"] = 7] = "MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY"] = 8] = "MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST"] = 9] = "MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED"] = 10] = "LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["SOI_ANCHOR_FOUND"] = 11] = "SOI_ANCHOR_FOUND"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["EMPTY_MATCH_PATTERN"] = 12] = "EMPTY_MATCH_PATTERN"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["NO_LINE_BREAKS_FLAGS"] = 13] = "NO_LINE_BREAKS_FLAGS"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["UNREACHABLE_PATTERN"] = 14] = "UNREACHABLE_PATTERN"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["IDENTIFY_TERMINATOR"] = 15] = "IDENTIFY_TERMINATOR"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["CUSTOM_LINE_BREAK"] = 16] = "CUSTOM_LINE_BREAK"; + LexerDefinitionErrorType2[LexerDefinitionErrorType2["MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"] = 17] = "MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"; + })(LexerDefinitionErrorType || (LexerDefinitionErrorType = {})); + DEFAULT_LEXER_CONFIG = { + deferDefinitionErrorsHandling: false, + positionTracking: "full", + lineTerminatorsPattern: /\n|\r\n?/g, + lineTerminatorCharacters: ["\n", "\r"], + ensureOptimizations: false, + safeMode: false, + errorMessageProvider: defaultLexerErrorProvider, + traceInitPerf: false, + skipValidations: false, + recoveryEnabled: true + }; + Object.freeze(DEFAULT_LEXER_CONFIG); + Lexer2 = class { + static { + __name(this, "Lexer"); + } + static { + __name2(this, "Lexer"); + } + constructor(lexerDefinition, config5 = DEFAULT_LEXER_CONFIG) { + this.lexerDefinition = lexerDefinition; + this.lexerDefinitionErrors = []; + this.lexerDefinitionWarning = []; + this.patternIdxToConfig = {}; + this.charCodeToPatternIdxToConfig = {}; + this.modes = []; + this.emptyGroups = {}; + this.trackStartLines = true; + this.trackEndLines = true; + this.hasCustom = false; + this.canModeBeOptimized = {}; + this.TRACE_INIT = (phaseDesc, phaseImpl) => { + if (this.traceInitPerf === true) { + this.traceInitIndent++; + const indent = new Array(this.traceInitIndent + 1).join(" "); + if (this.traceInitIndent < this.traceInitMaxIdent) { + console.log(`${indent}--> <${phaseDesc}>`); + } + const { time: time4, value: value2 } = timer2(phaseImpl); + const traceMethod = time4 > 10 ? console.warn : console.log; + if (this.traceInitIndent < this.traceInitMaxIdent) { + traceMethod(`${indent}<-- <${phaseDesc}> time: ${time4}ms`); + } + this.traceInitIndent--; + return value2; + } else { + return phaseImpl(); + } + }; + if (typeof config5 === "boolean") { + throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported"); + } + this.config = assign_default({}, DEFAULT_LEXER_CONFIG, config5); + const traceInitVal = this.config.traceInitPerf; + if (traceInitVal === true) { + this.traceInitMaxIdent = Infinity; + this.traceInitPerf = true; + } else if (typeof traceInitVal === "number") { + this.traceInitMaxIdent = traceInitVal; + this.traceInitPerf = true; + } + this.traceInitIndent = -1; + this.TRACE_INIT("Lexer Constructor", () => { + let actualDefinition; + let hasOnlySingleMode = true; + this.TRACE_INIT("Lexer Config handling", () => { + if (this.config.lineTerminatorsPattern === DEFAULT_LEXER_CONFIG.lineTerminatorsPattern) { + this.config.lineTerminatorsPattern = LineTerminatorOptimizedTester; + } else { + if (this.config.lineTerminatorCharacters === DEFAULT_LEXER_CONFIG.lineTerminatorCharacters) { + throw Error("Error: Missing property on the Lexer config.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS"); + } + } + if (config5.safeMode && config5.ensureOptimizations) { + throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.'); + } + this.trackStartLines = /full|onlyStart/i.test(this.config.positionTracking); + this.trackEndLines = /full/i.test(this.config.positionTracking); + if (isArray_default2(lexerDefinition)) { + actualDefinition = { + modes: { defaultMode: clone_default3(lexerDefinition) }, + defaultMode: DEFAULT_MODE + }; + } else { + hasOnlySingleMode = false; + actualDefinition = clone_default3(lexerDefinition); + } + }); + if (this.config.skipValidations === false) { + this.TRACE_INIT("performRuntimeChecks", () => { + this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(performRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters)); + }); + this.TRACE_INIT("performWarningRuntimeChecks", () => { + this.lexerDefinitionWarning = this.lexerDefinitionWarning.concat(performWarningRuntimeChecks(actualDefinition, this.trackStartLines, this.config.lineTerminatorCharacters)); + }); + } + actualDefinition.modes = actualDefinition.modes ? actualDefinition.modes : {}; + forEach_default2(actualDefinition.modes, (currModeValue, currModeName) => { + actualDefinition.modes[currModeName] = reject_default(currModeValue, (currTokType) => isUndefined_default2(currTokType)); + }); + const allModeNames = keys_default2(actualDefinition.modes); + forEach_default2(actualDefinition.modes, (currModDef, currModName) => { + this.TRACE_INIT(`Mode: <${currModName}> processing`, () => { + this.modes.push(currModName); + if (this.config.skipValidations === false) { + this.TRACE_INIT(`validatePatterns`, () => { + this.lexerDefinitionErrors = this.lexerDefinitionErrors.concat(validatePatterns(currModDef, allModeNames)); + }); + } + if (isEmpty_default2(this.lexerDefinitionErrors)) { + augmentTokenTypes(currModDef); + let currAnalyzeResult; + this.TRACE_INIT(`analyzeTokenTypes`, () => { + currAnalyzeResult = analyzeTokenTypes(currModDef, { + lineTerminatorCharacters: this.config.lineTerminatorCharacters, + positionTracking: config5.positionTracking, + ensureOptimizations: config5.ensureOptimizations, + safeMode: config5.safeMode, + tracer: this.TRACE_INIT + }); + }); + this.patternIdxToConfig[currModName] = currAnalyzeResult.patternIdxToConfig; + this.charCodeToPatternIdxToConfig[currModName] = currAnalyzeResult.charCodeToPatternIdxToConfig; + this.emptyGroups = assign_default({}, this.emptyGroups, currAnalyzeResult.emptyGroups); + this.hasCustom = currAnalyzeResult.hasCustom || this.hasCustom; + this.canModeBeOptimized[currModName] = currAnalyzeResult.canBeOptimized; + } + }); + }); + this.defaultMode = actualDefinition.defaultMode; + if (!isEmpty_default2(this.lexerDefinitionErrors) && !this.config.deferDefinitionErrorsHandling) { + const allErrMessages = map_default2(this.lexerDefinitionErrors, (error3) => { + return error3.message; + }); + const allErrMessagesString = allErrMessages.join("-----------------------\n"); + throw new Error("Errors detected in definition of Lexer:\n" + allErrMessagesString); + } + forEach_default2(this.lexerDefinitionWarning, (warningDescriptor) => { + PRINT_WARNING(warningDescriptor.message); + }); + this.TRACE_INIT("Choosing sub-methods implementations", () => { + if (SUPPORT_STICKY) { + this.chopInput = identity_default5; + this.match = this.matchWithTest; + } else { + this.updateLastIndex = noop_default3; + this.match = this.matchWithExec; + } + if (hasOnlySingleMode) { + this.handleModes = noop_default3; + } + if (this.trackStartLines === false) { + this.computeNewColumn = identity_default5; + } + if (this.trackEndLines === false) { + this.updateTokenEndLineColumnLocation = noop_default3; + } + if (/full/i.test(this.config.positionTracking)) { + this.createTokenInstance = this.createFullToken; + } else if (/onlyStart/i.test(this.config.positionTracking)) { + this.createTokenInstance = this.createStartOnlyToken; + } else if (/onlyOffset/i.test(this.config.positionTracking)) { + this.createTokenInstance = this.createOffsetOnlyToken; + } else { + throw Error(`Invalid config option: "${this.config.positionTracking}"`); + } + if (this.hasCustom) { + this.addToken = this.addTokenUsingPush; + this.handlePayload = this.handlePayloadWithCustom; + } else { + this.addToken = this.addTokenUsingMemberAccess; + this.handlePayload = this.handlePayloadNoCustom; + } + }); + this.TRACE_INIT("Failed Optimization Warnings", () => { + const unOptimizedModes = reduce_default2(this.canModeBeOptimized, (cannotBeOptimized, canBeOptimized, modeName) => { + if (canBeOptimized === false) { + cannotBeOptimized.push(modeName); + } + return cannotBeOptimized; + }, []); + if (config5.ensureOptimizations && !isEmpty_default2(unOptimizedModes)) { + throw Error(`Lexer Modes: < ${unOptimizedModes.join(", ")} > cannot be optimized. + Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. + Or inspect the console log for details on how to resolve these issues.`); + } + }); + this.TRACE_INIT("clearRegExpParserCache", () => { + clearRegExpParserCache(); + }); + this.TRACE_INIT("toFastProperties", () => { + toFastProperties(this); + }); + }); + } + tokenize(text4, initialMode = this.defaultMode) { + if (!isEmpty_default2(this.lexerDefinitionErrors)) { + const allErrMessages = map_default2(this.lexerDefinitionErrors, (error3) => { + return error3.message; + }); + const allErrMessagesString = allErrMessages.join("-----------------------\n"); + throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n" + allErrMessagesString); + } + return this.tokenizeInternal(text4, initialMode); + } + // There is quite a bit of duplication between this and "tokenizeInternalLazy" + // This is intentional due to performance considerations. + // this method also used quite a bit of `!` none null assertions because it is too optimized + // for `tsc` to always understand it is "safe" + tokenizeInternal(text4, initialMode) { + let i2, j3, k2, matchAltImage, longerAlt, matchedImage, payload, altPayload, imageLength, group2, tokType, newToken, errLength, droppedChar, msg, match3; + const orgText = text4; + const orgLength = orgText.length; + let offset = 0; + let matchedTokensIndex = 0; + const guessedNumberOfTokens = this.hasCustom ? 0 : Math.floor(text4.length / 10); + const matchedTokens = new Array(guessedNumberOfTokens); + const errors = []; + let line2 = this.trackStartLines ? 1 : void 0; + let column2 = this.trackStartLines ? 1 : void 0; + const groups = cloneEmptyGroups(this.emptyGroups); + const trackLines = this.trackStartLines; + const lineTerminatorPattern = this.config.lineTerminatorsPattern; + let currModePatternsLength = 0; + let patternIdxToConfig = []; + let currCharCodeToPatternIdxToConfig = []; + const modeStack = []; + const emptyArray = []; + Object.freeze(emptyArray); + let getPossiblePatterns; + function getPossiblePatternsSlow() { + return patternIdxToConfig; + } + __name(getPossiblePatternsSlow, "getPossiblePatternsSlow"); + __name2(getPossiblePatternsSlow, "getPossiblePatternsSlow"); + function getPossiblePatternsOptimized(charCode) { + const optimizedCharIdx = charCodeToOptimizedIndex(charCode); + const possiblePatterns = currCharCodeToPatternIdxToConfig[optimizedCharIdx]; + if (possiblePatterns === void 0) { + return emptyArray; + } else { + return possiblePatterns; + } + } + __name(getPossiblePatternsOptimized, "getPossiblePatternsOptimized"); + __name2(getPossiblePatternsOptimized, "getPossiblePatternsOptimized"); + const pop_mode = /* @__PURE__ */ __name2((popToken) => { + if (modeStack.length === 1 && // if we have both a POP_MODE and a PUSH_MODE this is in-fact a "transition" + // So no error should occur. + popToken.tokenType.PUSH_MODE === void 0) { + const msg2 = this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(popToken); + errors.push({ + offset: popToken.startOffset, + line: popToken.startLine, + column: popToken.startColumn, + length: popToken.image.length, + message: msg2 + }); + } else { + modeStack.pop(); + const newMode = last_default2(modeStack); + patternIdxToConfig = this.patternIdxToConfig[newMode]; + currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode]; + currModePatternsLength = patternIdxToConfig.length; + const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false; + if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) { + getPossiblePatterns = getPossiblePatternsOptimized; + } else { + getPossiblePatterns = getPossiblePatternsSlow; + } + } + }, "pop_mode"); + function push_mode(newMode) { + modeStack.push(newMode); + currCharCodeToPatternIdxToConfig = this.charCodeToPatternIdxToConfig[newMode]; + patternIdxToConfig = this.patternIdxToConfig[newMode]; + currModePatternsLength = patternIdxToConfig.length; + currModePatternsLength = patternIdxToConfig.length; + const modeCanBeOptimized = this.canModeBeOptimized[newMode] && this.config.safeMode === false; + if (currCharCodeToPatternIdxToConfig && modeCanBeOptimized) { + getPossiblePatterns = getPossiblePatternsOptimized; + } else { + getPossiblePatterns = getPossiblePatternsSlow; + } + } + __name(push_mode, "push_mode"); + __name2(push_mode, "push_mode"); + push_mode.call(this, initialMode); + let currConfig; + const recoveryEnabled = this.config.recoveryEnabled; + while (offset < orgLength) { + matchedImage = null; + const nextCharCode = orgText.charCodeAt(offset); + const chosenPatternIdxToConfig = getPossiblePatterns(nextCharCode); + const chosenPatternsLength = chosenPatternIdxToConfig.length; + for (i2 = 0; i2 < chosenPatternsLength; i2++) { + currConfig = chosenPatternIdxToConfig[i2]; + const currPattern = currConfig.pattern; + payload = null; + const singleCharCode = currConfig.short; + if (singleCharCode !== false) { + if (nextCharCode === singleCharCode) { + matchedImage = currPattern; + } + } else if (currConfig.isCustom === true) { + match3 = currPattern.exec(orgText, offset, matchedTokens, groups); + if (match3 !== null) { + matchedImage = match3[0]; + if (match3.payload !== void 0) { + payload = match3.payload; + } + } else { + matchedImage = null; + } + } else { + this.updateLastIndex(currPattern, offset); + matchedImage = this.match(currPattern, text4, offset); + } + if (matchedImage !== null) { + longerAlt = currConfig.longerAlt; + if (longerAlt !== void 0) { + const longerAltLength = longerAlt.length; + for (k2 = 0; k2 < longerAltLength; k2++) { + const longerAltConfig = patternIdxToConfig[longerAlt[k2]]; + const longerAltPattern = longerAltConfig.pattern; + altPayload = null; + if (longerAltConfig.isCustom === true) { + match3 = longerAltPattern.exec(orgText, offset, matchedTokens, groups); + if (match3 !== null) { + matchAltImage = match3[0]; + if (match3.payload !== void 0) { + altPayload = match3.payload; + } + } else { + matchAltImage = null; + } + } else { + this.updateLastIndex(longerAltPattern, offset); + matchAltImage = this.match(longerAltPattern, text4, offset); + } + if (matchAltImage && matchAltImage.length > matchedImage.length) { + matchedImage = matchAltImage; + payload = altPayload; + currConfig = longerAltConfig; + break; + } + } + } + break; + } + } + if (matchedImage !== null) { + imageLength = matchedImage.length; + group2 = currConfig.group; + if (group2 !== void 0) { + tokType = currConfig.tokenTypeIdx; + newToken = this.createTokenInstance(matchedImage, offset, tokType, currConfig.tokenType, line2, column2, imageLength); + this.handlePayload(newToken, payload); + if (group2 === false) { + matchedTokensIndex = this.addToken(matchedTokens, matchedTokensIndex, newToken); + } else { + groups[group2].push(newToken); + } + } + text4 = this.chopInput(text4, imageLength); + offset = offset + imageLength; + column2 = this.computeNewColumn(column2, imageLength); + if (trackLines === true && currConfig.canLineTerminator === true) { + let numOfLTsInMatch = 0; + let foundTerminator; + let lastLTEndOffset; + lineTerminatorPattern.lastIndex = 0; + do { + foundTerminator = lineTerminatorPattern.test(matchedImage); + if (foundTerminator === true) { + lastLTEndOffset = lineTerminatorPattern.lastIndex - 1; + numOfLTsInMatch++; + } + } while (foundTerminator === true); + if (numOfLTsInMatch !== 0) { + line2 = line2 + numOfLTsInMatch; + column2 = imageLength - lastLTEndOffset; + this.updateTokenEndLineColumnLocation(newToken, group2, lastLTEndOffset, numOfLTsInMatch, line2, column2, imageLength); + } + } + this.handleModes(currConfig, pop_mode, push_mode, newToken); + } else { + const errorStartOffset = offset; + const errorLine = line2; + const errorColumn = column2; + let foundResyncPoint = recoveryEnabled === false; + while (foundResyncPoint === false && offset < orgLength) { + text4 = this.chopInput(text4, 1); + offset++; + for (j3 = 0; j3 < currModePatternsLength; j3++) { + const currConfig2 = patternIdxToConfig[j3]; + const currPattern = currConfig2.pattern; + const singleCharCode = currConfig2.short; + if (singleCharCode !== false) { + if (orgText.charCodeAt(offset) === singleCharCode) { + foundResyncPoint = true; + } + } else if (currConfig2.isCustom === true) { + foundResyncPoint = currPattern.exec(orgText, offset, matchedTokens, groups) !== null; + } else { + this.updateLastIndex(currPattern, offset); + foundResyncPoint = currPattern.exec(text4) !== null; + } + if (foundResyncPoint === true) { + break; + } + } + } + errLength = offset - errorStartOffset; + column2 = this.computeNewColumn(column2, errLength); + msg = this.config.errorMessageProvider.buildUnexpectedCharactersMessage(orgText, errorStartOffset, errLength, errorLine, errorColumn, last_default2(modeStack)); + errors.push({ + offset: errorStartOffset, + line: errorLine, + column: errorColumn, + length: errLength, + message: msg + }); + if (recoveryEnabled === false) { + break; + } + } + } + if (!this.hasCustom) { + matchedTokens.length = matchedTokensIndex; + } + return { + tokens: matchedTokens, + groups, + errors + }; + } + handleModes(config5, pop_mode, push_mode, newToken) { + if (config5.pop === true) { + const pushMode = config5.push; + pop_mode(newToken); + if (pushMode !== void 0) { + push_mode.call(this, pushMode); + } + } else if (config5.push !== void 0) { + push_mode.call(this, config5.push); + } + } + chopInput(text4, length2) { + return text4.substring(length2); + } + updateLastIndex(regExp, newLastIndex) { + regExp.lastIndex = newLastIndex; + } + // TODO: decrease this under 600 characters? inspect stripping comments option in TSC compiler + updateTokenEndLineColumnLocation(newToken, group2, lastLTIdx, numOfLTsInMatch, line2, column2, imageLength) { + let lastCharIsLT, fixForEndingInLT; + if (group2 !== void 0) { + lastCharIsLT = lastLTIdx === imageLength - 1; + fixForEndingInLT = lastCharIsLT ? -1 : 0; + if (!(numOfLTsInMatch === 1 && lastCharIsLT === true)) { + newToken.endLine = line2 + fixForEndingInLT; + newToken.endColumn = column2 - 1 + -fixForEndingInLT; + } + } + } + computeNewColumn(oldColumn, imageLength) { + return oldColumn + imageLength; + } + createOffsetOnlyToken(image, startOffset, tokenTypeIdx, tokenType) { + return { + image, + startOffset, + tokenTypeIdx, + tokenType + }; + } + createStartOnlyToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn) { + return { + image, + startOffset, + startLine, + startColumn, + tokenTypeIdx, + tokenType + }; + } + createFullToken(image, startOffset, tokenTypeIdx, tokenType, startLine, startColumn, imageLength) { + return { + image, + startOffset, + endOffset: startOffset + imageLength - 1, + startLine, + endLine: startLine, + startColumn, + endColumn: startColumn + imageLength - 1, + tokenTypeIdx, + tokenType + }; + } + addTokenUsingPush(tokenVector, index, tokenToAdd) { + tokenVector.push(tokenToAdd); + return index; + } + addTokenUsingMemberAccess(tokenVector, index, tokenToAdd) { + tokenVector[index] = tokenToAdd; + index++; + return index; + } + handlePayloadNoCustom(token2, payload) { + } + handlePayloadWithCustom(token2, payload) { + if (payload !== null) { + token2.payload = payload; + } + } + matchWithTest(pattern, text4, offset) { + const found = pattern.test(text4); + if (found === true) { + return text4.substring(offset, pattern.lastIndex); + } + return null; + } + matchWithExec(pattern, text4) { + const regExpArray = pattern.exec(text4); + return regExpArray !== null ? regExpArray[0] : null; + } + }; + Lexer2.SKIPPED = "This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace."; + Lexer2.NA = /NOT_APPLICABLE/; + __name(tokenLabel2, "tokenLabel2"); + __name2(tokenLabel2, "tokenLabel"); + __name(hasTokenLabel2, "hasTokenLabel2"); + __name2(hasTokenLabel2, "hasTokenLabel"); + PARENT = "parent"; + CATEGORIES = "categories"; + LABEL = "label"; + GROUP = "group"; + PUSH_MODE = "push_mode"; + POP_MODE = "pop_mode"; + LONGER_ALT = "longer_alt"; + LINE_BREAKS = "line_breaks"; + START_CHARS_HINT = "start_chars_hint"; + __name(createToken, "createToken"); + __name2(createToken, "createToken"); + __name(createTokenInternal, "createTokenInternal"); + __name2(createTokenInternal, "createTokenInternal"); + EOF = createToken({ name: "EOF", pattern: Lexer2.NA }); + augmentTokenTypes([EOF]); + __name(createTokenInstance, "createTokenInstance"); + __name2(createTokenInstance, "createTokenInstance"); + __name(tokenMatcher, "tokenMatcher"); + __name2(tokenMatcher, "tokenMatcher"); + defaultParserErrorProvider = { + buildMismatchTokenMessage({ expected, actual, previous, ruleName }) { + const hasLabel = hasTokenLabel2(expected); + const expectedMsg = hasLabel ? `--> ${tokenLabel2(expected)} <--` : `token of type --> ${expected.name} <--`; + const msg = `Expecting ${expectedMsg} but found --> '${actual.image}' <--`; + return msg; + }, + buildNotAllInputParsedMessage({ firstRedundant, ruleName }) { + return "Redundant input, expecting EOF but found: " + firstRedundant.image; + }, + buildNoViableAltMessage({ expectedPathsPerAlt, actual, previous, customUserDescription, ruleName }) { + const errPrefix = "Expecting: "; + const actualText = head_default(actual).image; + const errSuffix = "\nbut found: '" + actualText + "'"; + if (customUserDescription) { + return errPrefix + customUserDescription + errSuffix; + } else { + const allLookAheadPaths = reduce_default2(expectedPathsPerAlt, (result, currAltPaths) => result.concat(currAltPaths), []); + const nextValidTokenSequences = map_default2(allLookAheadPaths, (currPath) => `[${map_default2(currPath, (currTokenType) => tokenLabel2(currTokenType)).join(", ")}]`); + const nextValidSequenceItems = map_default2(nextValidTokenSequences, (itemMsg, idx) => ` ${idx + 1}. ${itemMsg}`); + const calculatedDescription = `one of these possible Token sequences: +${nextValidSequenceItems.join("\n")}`; + return errPrefix + calculatedDescription + errSuffix; + } + }, + buildEarlyExitMessage({ expectedIterationPaths, actual, customUserDescription, ruleName }) { + const errPrefix = "Expecting: "; + const actualText = head_default(actual).image; + const errSuffix = "\nbut found: '" + actualText + "'"; + if (customUserDescription) { + return errPrefix + customUserDescription + errSuffix; + } else { + const nextValidTokenSequences = map_default2(expectedIterationPaths, (currPath) => `[${map_default2(currPath, (currTokenType) => tokenLabel2(currTokenType)).join(",")}]`); + const calculatedDescription = `expecting at least one iteration which starts with one of these possible Token sequences:: + <${nextValidTokenSequences.join(" ,")}>`; + return errPrefix + calculatedDescription + errSuffix; + } + } + }; + Object.freeze(defaultParserErrorProvider); + defaultGrammarResolverErrorProvider = { + buildRuleNotFoundError(topLevelRule, undefinedRule) { + const msg = "Invalid grammar, reference to a rule which is not defined: ->" + undefinedRule.nonTerminalName + "<-\ninside top level rule: ->" + topLevelRule.name + "<-"; + return msg; + } + }; + defaultGrammarValidatorErrorProvider = { + buildDuplicateFoundError(topLevelRule, duplicateProds) { + function getExtraProductionArgument2(prod) { + if (prod instanceof Terminal) { + return prod.terminalType.name; + } else if (prod instanceof NonTerminal) { + return prod.nonTerminalName; + } else { + return ""; + } + } + __name(getExtraProductionArgument2, "getExtraProductionArgument2"); + __name2(getExtraProductionArgument2, "getExtraProductionArgument"); + const topLevelName = topLevelRule.name; + const duplicateProd = head_default(duplicateProds); + const index = duplicateProd.idx; + const dslName = getProductionDslName(duplicateProd); + const extraArgument = getExtraProductionArgument2(duplicateProd); + const hasExplicitIndex = index > 0; + let msg = `->${dslName}${hasExplicitIndex ? index : ""}<- ${extraArgument ? `with argument: ->${extraArgument}<-` : ""} + appears more than once (${duplicateProds.length} times) in the top level rule: ->${topLevelName}<-. + For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES + `; + msg = msg.replace(/[ \t]+/g, " "); + msg = msg.replace(/\s\s+/g, "\n"); + return msg; + }, + buildNamespaceConflictError(rule) { + const errMsg = `Namespace conflict found in grammar. +The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${rule.name}>. +To resolve this make sure each Terminal and Non-Terminal names are unique +This is easy to accomplish by using the convention that Terminal names start with an uppercase letter +and Non-Terminal names start with a lower case letter.`; + return errMsg; + }, + buildAlternationPrefixAmbiguityError(options2) { + const pathMsg = map_default2(options2.prefixPath, (currTok) => tokenLabel2(currTok)).join(", "); + const occurrence = options2.alternation.idx === 0 ? "" : options2.alternation.idx; + const errMsg = `Ambiguous alternatives: <${options2.ambiguityIndices.join(" ,")}> due to common lookahead prefix +in inside <${options2.topLevelRule.name}> Rule, +<${pathMsg}> may appears as a prefix path in all these alternatives. +See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX +For Further details.`; + return errMsg; + }, + buildAlternationAmbiguityError(options2) { + const pathMsg = map_default2(options2.prefixPath, (currtok) => tokenLabel2(currtok)).join(", "); + const occurrence = options2.alternation.idx === 0 ? "" : options2.alternation.idx; + let currMessage = `Ambiguous Alternatives Detected: <${options2.ambiguityIndices.join(" ,")}> in inside <${options2.topLevelRule.name}> Rule, +<${pathMsg}> may appears as a prefix path in all these alternatives. +`; + currMessage = currMessage + `See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES +For Further details.`; + return currMessage; + }, + buildEmptyRepetitionError(options2) { + let dslName = getProductionDslName(options2.repetition); + if (options2.repetition.idx !== 0) { + dslName += options2.repetition.idx; + } + const errMsg = `The repetition <${dslName}> within Rule <${options2.topLevelRule.name}> can never consume any tokens. +This could lead to an infinite loop.`; + return errMsg; + }, + // TODO: remove - `errors_public` from nyc.config.js exclude + // once this method is fully removed from this file + buildTokenNameError(options2) { + return "deprecated"; + }, + buildEmptyAlternationError(options2) { + const errMsg = `Ambiguous empty alternative: <${options2.emptyChoiceIdx + 1}> in inside <${options2.topLevelRule.name}> Rule. +Only the last alternative may be an empty alternative.`; + return errMsg; + }, + buildTooManyAlternativesError(options2) { + const errMsg = `An Alternation cannot have more than 256 alternatives: + inside <${options2.topLevelRule.name}> Rule. + has ${options2.alternation.definition.length + 1} alternatives.`; + return errMsg; + }, + buildLeftRecursionError(options2) { + const ruleName = options2.topLevelRule.name; + const pathNames = map_default2(options2.leftRecursionPath, (currRule) => currRule.name); + const leftRecursivePath = `${ruleName} --> ${pathNames.concat([ruleName]).join(" --> ")}`; + const errMsg = `Left Recursion found in grammar. +rule: <${ruleName}> can be invoked from itself (directly or indirectly) +without consuming any Tokens. The grammar path that causes this is: + ${leftRecursivePath} + To fix this refactor your grammar to remove the left recursion. +see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`; + return errMsg; + }, + // TODO: remove - `errors_public` from nyc.config.js exclude + // once this method is fully removed from this file + buildInvalidRuleNameError(options2) { + return "deprecated"; + }, + buildDuplicateRuleNameError(options2) { + let ruleName; + if (options2.topLevelRule instanceof Rule) { + ruleName = options2.topLevelRule.name; + } else { + ruleName = options2.topLevelRule; + } + const errMsg = `Duplicate definition, rule: ->${ruleName}<- is already defined in the grammar: ->${options2.grammarName}<-`; + return errMsg; + } + }; + __name(resolveGrammar, "resolveGrammar"); + __name2(resolveGrammar, "resolveGrammar"); + GastRefResolverVisitor = class extends GAstVisitor { + static { + __name(this, "GastRefResolverVisitor"); + } + static { + __name2(this, "GastRefResolverVisitor"); + } + constructor(nameToTopRule, errMsgProvider) { + super(); + this.nameToTopRule = nameToTopRule; + this.errMsgProvider = errMsgProvider; + this.errors = []; + } + resolveRefs() { + forEach_default2(values_default2(this.nameToTopRule), (prod) => { + this.currTopLevel = prod; + prod.accept(this); + }); + } + visitNonTerminal(node2) { + const ref = this.nameToTopRule[node2.nonTerminalName]; + if (!ref) { + const msg = this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel, node2); + this.errors.push({ + message: msg, + type: ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF, + ruleName: this.currTopLevel.name, + unresolvedRefName: node2.nonTerminalName + }); + } else { + node2.referencedRule = ref; + } + } + }; + AbstractNextPossibleTokensWalker = class extends RestWalker { + static { + __name(this, "AbstractNextPossibleTokensWalker"); + } + static { + __name2(this, "AbstractNextPossibleTokensWalker"); + } + constructor(topProd, path4) { + super(); + this.topProd = topProd; + this.path = path4; + this.possibleTokTypes = []; + this.nextProductionName = ""; + this.nextProductionOccurrence = 0; + this.found = false; + this.isAtEndOfPath = false; + } + startWalking() { + this.found = false; + if (this.path.ruleStack[0] !== this.topProd.name) { + throw Error("The path does not start with the walker's top Rule!"); + } + this.ruleStack = clone_default3(this.path.ruleStack).reverse(); + this.occurrenceStack = clone_default3(this.path.occurrenceStack).reverse(); + this.ruleStack.pop(); + this.occurrenceStack.pop(); + this.updateExpectedNext(); + this.walk(this.topProd); + return this.possibleTokTypes; + } + walk(prod, prevRest = []) { + if (!this.found) { + super.walk(prod, prevRest); + } + } + walkProdRef(refProd, currRest, prevRest) { + if (refProd.referencedRule.name === this.nextProductionName && refProd.idx === this.nextProductionOccurrence) { + const fullRest = currRest.concat(prevRest); + this.updateExpectedNext(); + this.walk(refProd.referencedRule, fullRest); + } + } + updateExpectedNext() { + if (isEmpty_default2(this.ruleStack)) { + this.nextProductionName = ""; + this.nextProductionOccurrence = 0; + this.isAtEndOfPath = true; + } else { + this.nextProductionName = this.ruleStack.pop(); + this.nextProductionOccurrence = this.occurrenceStack.pop(); + } + } + }; + NextAfterTokenWalker = class extends AbstractNextPossibleTokensWalker { + static { + __name(this, "NextAfterTokenWalker"); + } + static { + __name2(this, "NextAfterTokenWalker"); + } + constructor(topProd, path4) { + super(topProd, path4); + this.path = path4; + this.nextTerminalName = ""; + this.nextTerminalOccurrence = 0; + this.nextTerminalName = this.path.lastTok.name; + this.nextTerminalOccurrence = this.path.lastTokOccurrence; + } + walkTerminal(terminal, currRest, prevRest) { + if (this.isAtEndOfPath && terminal.terminalType.name === this.nextTerminalName && terminal.idx === this.nextTerminalOccurrence && !this.found) { + const fullRest = currRest.concat(prevRest); + const restProd = new Alternative({ definition: fullRest }); + this.possibleTokTypes = first2(restProd); + this.found = true; + } + } + }; + AbstractNextTerminalAfterProductionWalker = class extends RestWalker { + static { + __name(this, "AbstractNextTerminalAfterProductionWalker"); + } + static { + __name2(this, "AbstractNextTerminalAfterProductionWalker"); + } + constructor(topRule, occurrence) { + super(); + this.topRule = topRule; + this.occurrence = occurrence; + this.result = { + token: void 0, + occurrence: void 0, + isEndOfRule: void 0 + }; + } + startWalking() { + this.walk(this.topRule); + return this.result; + } + }; + NextTerminalAfterManyWalker = class extends AbstractNextTerminalAfterProductionWalker { + static { + __name(this, "NextTerminalAfterManyWalker"); + } + static { + __name2(this, "NextTerminalAfterManyWalker"); + } + walkMany(manyProd, currRest, prevRest) { + if (manyProd.idx === this.occurrence) { + const firstAfterMany = head_default(currRest.concat(prevRest)); + this.result.isEndOfRule = firstAfterMany === void 0; + if (firstAfterMany instanceof Terminal) { + this.result.token = firstAfterMany.terminalType; + this.result.occurrence = firstAfterMany.idx; + } + } else { + super.walkMany(manyProd, currRest, prevRest); + } + } + }; + NextTerminalAfterManySepWalker = class extends AbstractNextTerminalAfterProductionWalker { + static { + __name(this, "NextTerminalAfterManySepWalker"); + } + static { + __name2(this, "NextTerminalAfterManySepWalker"); + } + walkManySep(manySepProd, currRest, prevRest) { + if (manySepProd.idx === this.occurrence) { + const firstAfterManySep = head_default(currRest.concat(prevRest)); + this.result.isEndOfRule = firstAfterManySep === void 0; + if (firstAfterManySep instanceof Terminal) { + this.result.token = firstAfterManySep.terminalType; + this.result.occurrence = firstAfterManySep.idx; + } + } else { + super.walkManySep(manySepProd, currRest, prevRest); + } + } + }; + NextTerminalAfterAtLeastOneWalker = class extends AbstractNextTerminalAfterProductionWalker { + static { + __name(this, "NextTerminalAfterAtLeastOneWalker"); + } + static { + __name2(this, "NextTerminalAfterAtLeastOneWalker"); + } + walkAtLeastOne(atLeastOneProd, currRest, prevRest) { + if (atLeastOneProd.idx === this.occurrence) { + const firstAfterAtLeastOne = head_default(currRest.concat(prevRest)); + this.result.isEndOfRule = firstAfterAtLeastOne === void 0; + if (firstAfterAtLeastOne instanceof Terminal) { + this.result.token = firstAfterAtLeastOne.terminalType; + this.result.occurrence = firstAfterAtLeastOne.idx; + } + } else { + super.walkAtLeastOne(atLeastOneProd, currRest, prevRest); + } + } + }; + NextTerminalAfterAtLeastOneSepWalker = class extends AbstractNextTerminalAfterProductionWalker { + static { + __name(this, "NextTerminalAfterAtLeastOneSepWalker"); + } + static { + __name2(this, "NextTerminalAfterAtLeastOneSepWalker"); + } + walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest) { + if (atleastOneSepProd.idx === this.occurrence) { + const firstAfterfirstAfterAtLeastOneSep = head_default(currRest.concat(prevRest)); + this.result.isEndOfRule = firstAfterfirstAfterAtLeastOneSep === void 0; + if (firstAfterfirstAfterAtLeastOneSep instanceof Terminal) { + this.result.token = firstAfterfirstAfterAtLeastOneSep.terminalType; + this.result.occurrence = firstAfterfirstAfterAtLeastOneSep.idx; + } + } else { + super.walkAtLeastOneSep(atleastOneSepProd, currRest, prevRest); + } + } + }; + __name(possiblePathsFrom, "possiblePathsFrom"); + __name2(possiblePathsFrom, "possiblePathsFrom"); + __name(nextPossibleTokensAfter, "nextPossibleTokensAfter"); + __name2(nextPossibleTokensAfter, "nextPossibleTokensAfter"); + __name(expandTopLevelRule, "expandTopLevelRule"); + __name2(expandTopLevelRule, "expandTopLevelRule"); + (function(PROD_TYPE2) { + PROD_TYPE2[PROD_TYPE2["OPTION"] = 0] = "OPTION"; + PROD_TYPE2[PROD_TYPE2["REPETITION"] = 1] = "REPETITION"; + PROD_TYPE2[PROD_TYPE2["REPETITION_MANDATORY"] = 2] = "REPETITION_MANDATORY"; + PROD_TYPE2[PROD_TYPE2["REPETITION_MANDATORY_WITH_SEPARATOR"] = 3] = "REPETITION_MANDATORY_WITH_SEPARATOR"; + PROD_TYPE2[PROD_TYPE2["REPETITION_WITH_SEPARATOR"] = 4] = "REPETITION_WITH_SEPARATOR"; + PROD_TYPE2[PROD_TYPE2["ALTERNATION"] = 5] = "ALTERNATION"; + })(PROD_TYPE || (PROD_TYPE = {})); + __name(getProdType, "getProdType"); + __name2(getProdType, "getProdType"); + __name(getLookaheadPaths, "getLookaheadPaths"); + __name2(getLookaheadPaths, "getLookaheadPaths"); + __name(buildLookaheadFuncForOr, "buildLookaheadFuncForOr"); + __name2(buildLookaheadFuncForOr, "buildLookaheadFuncForOr"); + __name(buildLookaheadFuncForOptionalProd, "buildLookaheadFuncForOptionalProd"); + __name2(buildLookaheadFuncForOptionalProd, "buildLookaheadFuncForOptionalProd"); + __name(buildAlternativesLookAheadFunc, "buildAlternativesLookAheadFunc"); + __name2(buildAlternativesLookAheadFunc, "buildAlternativesLookAheadFunc"); + __name(buildSingleAlternativeLookaheadFunction, "buildSingleAlternativeLookaheadFunction"); + __name2(buildSingleAlternativeLookaheadFunction, "buildSingleAlternativeLookaheadFunction"); + RestDefinitionFinderWalker = class extends RestWalker { + static { + __name(this, "RestDefinitionFinderWalker"); + } + static { + __name2(this, "RestDefinitionFinderWalker"); + } + constructor(topProd, targetOccurrence, targetProdType) { + super(); + this.topProd = topProd; + this.targetOccurrence = targetOccurrence; + this.targetProdType = targetProdType; + } + startWalking() { + this.walk(this.topProd); + return this.restDef; + } + checkIsTarget(node2, expectedProdType, currRest, prevRest) { + if (node2.idx === this.targetOccurrence && this.targetProdType === expectedProdType) { + this.restDef = currRest.concat(prevRest); + return true; + } + return false; + } + walkOption(optionProd, currRest, prevRest) { + if (!this.checkIsTarget(optionProd, PROD_TYPE.OPTION, currRest, prevRest)) { + super.walkOption(optionProd, currRest, prevRest); + } + } + walkAtLeastOne(atLeastOneProd, currRest, prevRest) { + if (!this.checkIsTarget(atLeastOneProd, PROD_TYPE.REPETITION_MANDATORY, currRest, prevRest)) { + super.walkOption(atLeastOneProd, currRest, prevRest); + } + } + walkAtLeastOneSep(atLeastOneSepProd, currRest, prevRest) { + if (!this.checkIsTarget(atLeastOneSepProd, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, currRest, prevRest)) { + super.walkOption(atLeastOneSepProd, currRest, prevRest); + } + } + walkMany(manyProd, currRest, prevRest) { + if (!this.checkIsTarget(manyProd, PROD_TYPE.REPETITION, currRest, prevRest)) { + super.walkOption(manyProd, currRest, prevRest); + } + } + walkManySep(manySepProd, currRest, prevRest) { + if (!this.checkIsTarget(manySepProd, PROD_TYPE.REPETITION_WITH_SEPARATOR, currRest, prevRest)) { + super.walkOption(manySepProd, currRest, prevRest); + } + } + }; + InsideDefinitionFinderVisitor = class extends GAstVisitor { + static { + __name(this, "InsideDefinitionFinderVisitor"); + } + static { + __name2(this, "InsideDefinitionFinderVisitor"); + } + constructor(targetOccurrence, targetProdType, targetRef) { + super(); + this.targetOccurrence = targetOccurrence; + this.targetProdType = targetProdType; + this.targetRef = targetRef; + this.result = []; + } + checkIsTarget(node2, expectedProdName) { + if (node2.idx === this.targetOccurrence && this.targetProdType === expectedProdName && (this.targetRef === void 0 || node2 === this.targetRef)) { + this.result = node2.definition; + } + } + visitOption(node2) { + this.checkIsTarget(node2, PROD_TYPE.OPTION); + } + visitRepetition(node2) { + this.checkIsTarget(node2, PROD_TYPE.REPETITION); + } + visitRepetitionMandatory(node2) { + this.checkIsTarget(node2, PROD_TYPE.REPETITION_MANDATORY); + } + visitRepetitionMandatoryWithSeparator(node2) { + this.checkIsTarget(node2, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR); + } + visitRepetitionWithSeparator(node2) { + this.checkIsTarget(node2, PROD_TYPE.REPETITION_WITH_SEPARATOR); + } + visitAlternation(node2) { + this.checkIsTarget(node2, PROD_TYPE.ALTERNATION); + } + }; + __name(initializeArrayOfArrays, "initializeArrayOfArrays"); + __name2(initializeArrayOfArrays, "initializeArrayOfArrays"); + __name(pathToHashKeys, "pathToHashKeys"); + __name2(pathToHashKeys, "pathToHashKeys"); + __name(isUniquePrefixHash, "isUniquePrefixHash"); + __name2(isUniquePrefixHash, "isUniquePrefixHash"); + __name(lookAheadSequenceFromAlternatives, "lookAheadSequenceFromAlternatives"); + __name2(lookAheadSequenceFromAlternatives, "lookAheadSequenceFromAlternatives"); + __name(getLookaheadPathsForOr, "getLookaheadPathsForOr"); + __name2(getLookaheadPathsForOr, "getLookaheadPathsForOr"); + __name(getLookaheadPathsForOptionalProd, "getLookaheadPathsForOptionalProd"); + __name2(getLookaheadPathsForOptionalProd, "getLookaheadPathsForOptionalProd"); + __name(containsPath, "containsPath"); + __name2(containsPath, "containsPath"); + __name(isStrictPrefixOfPath, "isStrictPrefixOfPath"); + __name2(isStrictPrefixOfPath, "isStrictPrefixOfPath"); + __name(areTokenCategoriesNotUsed, "areTokenCategoriesNotUsed"); + __name2(areTokenCategoriesNotUsed, "areTokenCategoriesNotUsed"); + __name(validateLookahead, "validateLookahead"); + __name2(validateLookahead, "validateLookahead"); + __name(validateGrammar, "validateGrammar"); + __name2(validateGrammar, "validateGrammar"); + __name(validateDuplicateProductions, "validateDuplicateProductions"); + __name2(validateDuplicateProductions, "validateDuplicateProductions"); + __name(identifyProductionForDuplicates, "identifyProductionForDuplicates"); + __name2(identifyProductionForDuplicates, "identifyProductionForDuplicates"); + __name(getExtraProductionArgument, "getExtraProductionArgument"); + __name2(getExtraProductionArgument, "getExtraProductionArgument"); + OccurrenceValidationCollector = class extends GAstVisitor { + static { + __name(this, "OccurrenceValidationCollector"); + } + static { + __name2(this, "OccurrenceValidationCollector"); + } + constructor() { + super(...arguments); + this.allProductions = []; + } + visitNonTerminal(subrule) { + this.allProductions.push(subrule); + } + visitOption(option2) { + this.allProductions.push(option2); + } + visitRepetitionWithSeparator(manySep) { + this.allProductions.push(manySep); + } + visitRepetitionMandatory(atLeastOne) { + this.allProductions.push(atLeastOne); + } + visitRepetitionMandatoryWithSeparator(atLeastOneSep) { + this.allProductions.push(atLeastOneSep); + } + visitRepetition(many) { + this.allProductions.push(many); + } + visitAlternation(or) { + this.allProductions.push(or); + } + visitTerminal(terminal) { + this.allProductions.push(terminal); + } + }; + __name(validateRuleDoesNotAlreadyExist, "validateRuleDoesNotAlreadyExist"); + __name2(validateRuleDoesNotAlreadyExist, "validateRuleDoesNotAlreadyExist"); + __name(validateRuleIsOverridden, "validateRuleIsOverridden"); + __name2(validateRuleIsOverridden, "validateRuleIsOverridden"); + __name(validateNoLeftRecursion, "validateNoLeftRecursion"); + __name2(validateNoLeftRecursion, "validateNoLeftRecursion"); + __name(getFirstNoneTerminal, "getFirstNoneTerminal"); + __name2(getFirstNoneTerminal, "getFirstNoneTerminal"); + OrCollector = class extends GAstVisitor { + static { + __name(this, "OrCollector"); + } + static { + __name2(this, "OrCollector"); + } + constructor() { + super(...arguments); + this.alternations = []; + } + visitAlternation(node2) { + this.alternations.push(node2); + } + }; + __name(validateEmptyOrAlternative, "validateEmptyOrAlternative"); + __name2(validateEmptyOrAlternative, "validateEmptyOrAlternative"); + __name(validateAmbiguousAlternationAlternatives, "validateAmbiguousAlternationAlternatives"); + __name2(validateAmbiguousAlternationAlternatives, "validateAmbiguousAlternationAlternatives"); + RepetitionCollector = class extends GAstVisitor { + static { + __name(this, "RepetitionCollector"); + } + static { + __name2(this, "RepetitionCollector"); + } + constructor() { + super(...arguments); + this.allProductions = []; + } + visitRepetitionWithSeparator(manySep) { + this.allProductions.push(manySep); + } + visitRepetitionMandatory(atLeastOne) { + this.allProductions.push(atLeastOne); + } + visitRepetitionMandatoryWithSeparator(atLeastOneSep) { + this.allProductions.push(atLeastOneSep); + } + visitRepetition(many) { + this.allProductions.push(many); + } + }; + __name(validateTooManyAlts, "validateTooManyAlts"); + __name2(validateTooManyAlts, "validateTooManyAlts"); + __name(validateSomeNonEmptyLookaheadPath, "validateSomeNonEmptyLookaheadPath"); + __name2(validateSomeNonEmptyLookaheadPath, "validateSomeNonEmptyLookaheadPath"); + __name(checkAlternativesAmbiguities, "checkAlternativesAmbiguities"); + __name2(checkAlternativesAmbiguities, "checkAlternativesAmbiguities"); + __name(checkPrefixAlternativesAmbiguities, "checkPrefixAlternativesAmbiguities"); + __name2(checkPrefixAlternativesAmbiguities, "checkPrefixAlternativesAmbiguities"); + __name(checkTerminalAndNoneTerminalsNameSpace, "checkTerminalAndNoneTerminalsNameSpace"); + __name2(checkTerminalAndNoneTerminalsNameSpace, "checkTerminalAndNoneTerminalsNameSpace"); + __name(resolveGrammar2, "resolveGrammar2"); + __name2(resolveGrammar2, "resolveGrammar"); + __name(validateGrammar2, "validateGrammar2"); + __name2(validateGrammar2, "validateGrammar"); + MISMATCHED_TOKEN_EXCEPTION = "MismatchedTokenException"; + NO_VIABLE_ALT_EXCEPTION = "NoViableAltException"; + EARLY_EXIT_EXCEPTION = "EarlyExitException"; + NOT_ALL_INPUT_PARSED_EXCEPTION = "NotAllInputParsedException"; + RECOGNITION_EXCEPTION_NAMES = [ + MISMATCHED_TOKEN_EXCEPTION, + NO_VIABLE_ALT_EXCEPTION, + EARLY_EXIT_EXCEPTION, + NOT_ALL_INPUT_PARSED_EXCEPTION + ]; + Object.freeze(RECOGNITION_EXCEPTION_NAMES); + __name(isRecognitionException, "isRecognitionException"); + __name2(isRecognitionException, "isRecognitionException"); + RecognitionException = class extends Error { + static { + __name(this, "RecognitionException"); + } + static { + __name2(this, "RecognitionException"); + } + constructor(message, token2) { + super(message); + this.token = token2; + this.resyncedTokens = []; + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + } + }; + MismatchedTokenException = class extends RecognitionException { + static { + __name(this, "MismatchedTokenException"); + } + static { + __name2(this, "MismatchedTokenException"); + } + constructor(message, token2, previousToken) { + super(message, token2); + this.previousToken = previousToken; + this.name = MISMATCHED_TOKEN_EXCEPTION; + } + }; + NoViableAltException = class extends RecognitionException { + static { + __name(this, "NoViableAltException"); + } + static { + __name2(this, "NoViableAltException"); + } + constructor(message, token2, previousToken) { + super(message, token2); + this.previousToken = previousToken; + this.name = NO_VIABLE_ALT_EXCEPTION; + } + }; + NotAllInputParsedException = class extends RecognitionException { + static { + __name(this, "NotAllInputParsedException"); + } + static { + __name2(this, "NotAllInputParsedException"); + } + constructor(message, token2) { + super(message, token2); + this.name = NOT_ALL_INPUT_PARSED_EXCEPTION; + } + }; + EarlyExitException = class extends RecognitionException { + static { + __name(this, "EarlyExitException"); + } + static { + __name2(this, "EarlyExitException"); + } + constructor(message, token2, previousToken) { + super(message, token2); + this.previousToken = previousToken; + this.name = EARLY_EXIT_EXCEPTION; + } + }; + EOF_FOLLOW_KEY = {}; + IN_RULE_RECOVERY_EXCEPTION = "InRuleRecoveryException"; + InRuleRecoveryException = class extends Error { + static { + __name(this, "InRuleRecoveryException"); + } + static { + __name2(this, "InRuleRecoveryException"); + } + constructor(message) { + super(message); + this.name = IN_RULE_RECOVERY_EXCEPTION; + } + }; + Recoverable = class { + static { + __name(this, "Recoverable"); + } + static { + __name2(this, "Recoverable"); + } + initRecoverable(config5) { + this.firstAfterRepMap = {}; + this.resyncFollows = {}; + this.recoveryEnabled = has_default2(config5, "recoveryEnabled") ? config5.recoveryEnabled : DEFAULT_PARSER_CONFIG.recoveryEnabled; + if (this.recoveryEnabled) { + this.attemptInRepetitionRecovery = attemptInRepetitionRecovery; + } + } + getTokenToInsert(tokType) { + const tokToInsert = createTokenInstance(tokType, "", NaN, NaN, NaN, NaN, NaN, NaN); + tokToInsert.isInsertedInRecovery = true; + return tokToInsert; + } + canTokenTypeBeInsertedInRecovery(tokType) { + return true; + } + canTokenTypeBeDeletedInRecovery(tokType) { + return true; + } + tryInRepetitionRecovery(grammarRule, grammarRuleArgs, lookAheadFunc, expectedTokType) { + const reSyncTokType = this.findReSyncTokenType(); + const savedLexerState = this.exportLexerState(); + const resyncedTokens = []; + let passedResyncPoint = false; + const nextTokenWithoutResync = this.LA(1); + let currToken = this.LA(1); + const generateErrorMessage = /* @__PURE__ */ __name2(() => { + const previousToken = this.LA(0); + const msg = this.errorMessageProvider.buildMismatchTokenMessage({ + expected: expectedTokType, + actual: nextTokenWithoutResync, + previous: previousToken, + ruleName: this.getCurrRuleFullName() + }); + const error3 = new MismatchedTokenException(msg, nextTokenWithoutResync, this.LA(0)); + error3.resyncedTokens = dropRight_default(resyncedTokens); + this.SAVE_ERROR(error3); + }, "generateErrorMessage"); + while (!passedResyncPoint) { + if (this.tokenMatcher(currToken, expectedTokType)) { + generateErrorMessage(); + return; + } else if (lookAheadFunc.call(this)) { + generateErrorMessage(); + grammarRule.apply(this, grammarRuleArgs); + return; + } else if (this.tokenMatcher(currToken, reSyncTokType)) { + passedResyncPoint = true; + } else { + currToken = this.SKIP_TOKEN(); + this.addToResyncTokens(currToken, resyncedTokens); + } + } + this.importLexerState(savedLexerState); + } + shouldInRepetitionRecoveryBeTried(expectTokAfterLastMatch, nextTokIdx, notStuck) { + if (notStuck === false) { + return false; + } + if (this.tokenMatcher(this.LA(1), expectTokAfterLastMatch)) { + return false; + } + if (this.isBackTracking()) { + return false; + } + if (this.canPerformInRuleRecovery(expectTokAfterLastMatch, this.getFollowsForInRuleRecovery(expectTokAfterLastMatch, nextTokIdx))) { + return false; + } + return true; + } + // Error Recovery functionality + getFollowsForInRuleRecovery(tokType, tokIdxInRule) { + const grammarPath = this.getCurrentGrammarPath(tokType, tokIdxInRule); + const follows = this.getNextPossibleTokenTypes(grammarPath); + return follows; + } + tryInRuleRecovery(expectedTokType, follows) { + if (this.canRecoverWithSingleTokenInsertion(expectedTokType, follows)) { + const tokToInsert = this.getTokenToInsert(expectedTokType); + return tokToInsert; + } + if (this.canRecoverWithSingleTokenDeletion(expectedTokType)) { + const nextTok = this.SKIP_TOKEN(); + this.consumeToken(); + return nextTok; + } + throw new InRuleRecoveryException("sad sad panda"); + } + canPerformInRuleRecovery(expectedToken, follows) { + return this.canRecoverWithSingleTokenInsertion(expectedToken, follows) || this.canRecoverWithSingleTokenDeletion(expectedToken); + } + canRecoverWithSingleTokenInsertion(expectedTokType, follows) { + if (!this.canTokenTypeBeInsertedInRecovery(expectedTokType)) { + return false; + } + if (isEmpty_default2(follows)) { + return false; + } + const mismatchedTok = this.LA(1); + const isMisMatchedTokInFollows = find_default3(follows, (possibleFollowsTokType) => { + return this.tokenMatcher(mismatchedTok, possibleFollowsTokType); + }) !== void 0; + return isMisMatchedTokInFollows; + } + canRecoverWithSingleTokenDeletion(expectedTokType) { + if (!this.canTokenTypeBeDeletedInRecovery(expectedTokType)) { + return false; + } + const isNextTokenWhatIsExpected = this.tokenMatcher(this.LA(2), expectedTokType); + return isNextTokenWhatIsExpected; + } + isInCurrentRuleReSyncSet(tokenTypeIdx) { + const followKey = this.getCurrFollowKey(); + const currentRuleReSyncSet = this.getFollowSetFromFollowKey(followKey); + return includes_default(currentRuleReSyncSet, tokenTypeIdx); + } + findReSyncTokenType() { + const allPossibleReSyncTokTypes = this.flattenFollowSet(); + let nextToken = this.LA(1); + let k2 = 2; + while (true) { + const foundMatch = find_default3(allPossibleReSyncTokTypes, (resyncTokType) => { + const canMatch = tokenMatcher(nextToken, resyncTokType); + return canMatch; + }); + if (foundMatch !== void 0) { + return foundMatch; + } + nextToken = this.LA(k2); + k2++; + } + } + getCurrFollowKey() { + if (this.RULE_STACK.length === 1) { + return EOF_FOLLOW_KEY; + } + const currRuleShortName = this.getLastExplicitRuleShortName(); + const currRuleIdx = this.getLastExplicitRuleOccurrenceIndex(); + const prevRuleShortName = this.getPreviousExplicitRuleShortName(); + return { + ruleName: this.shortRuleNameToFullName(currRuleShortName), + idxInCallingRule: currRuleIdx, + inRule: this.shortRuleNameToFullName(prevRuleShortName) + }; + } + buildFullFollowKeyStack() { + const explicitRuleStack = this.RULE_STACK; + const explicitOccurrenceStack = this.RULE_OCCURRENCE_STACK; + return map_default2(explicitRuleStack, (ruleName, idx) => { + if (idx === 0) { + return EOF_FOLLOW_KEY; + } + return { + ruleName: this.shortRuleNameToFullName(ruleName), + idxInCallingRule: explicitOccurrenceStack[idx], + inRule: this.shortRuleNameToFullName(explicitRuleStack[idx - 1]) + }; + }); + } + flattenFollowSet() { + const followStack = map_default2(this.buildFullFollowKeyStack(), (currKey) => { + return this.getFollowSetFromFollowKey(currKey); + }); + return flatten_default2(followStack); + } + getFollowSetFromFollowKey(followKey) { + if (followKey === EOF_FOLLOW_KEY) { + return [EOF]; + } + const followName = followKey.ruleName + followKey.idxInCallingRule + IN + followKey.inRule; + return this.resyncFollows[followName]; + } + // It does not make any sense to include a virtual EOF token in the list of resynced tokens + // as EOF does not really exist and thus does not contain any useful information (line/column numbers) + addToResyncTokens(token2, resyncTokens) { + if (!this.tokenMatcher(token2, EOF)) { + resyncTokens.push(token2); + } + return resyncTokens; + } + reSyncTo(tokType) { + const resyncedTokens = []; + let nextTok = this.LA(1); + while (this.tokenMatcher(nextTok, tokType) === false) { + nextTok = this.SKIP_TOKEN(); + this.addToResyncTokens(nextTok, resyncedTokens); + } + return dropRight_default(resyncedTokens); + } + attemptInRepetitionRecovery(prodFunc, args, lookaheadFunc, dslMethodIdx, prodOccurrence, nextToksWalker, notStuck) { + } + getCurrentGrammarPath(tokType, tokIdxInRule) { + const pathRuleStack = this.getHumanReadableRuleStack(); + const pathOccurrenceStack = clone_default3(this.RULE_OCCURRENCE_STACK); + const grammarPath = { + ruleStack: pathRuleStack, + occurrenceStack: pathOccurrenceStack, + lastTok: tokType, + lastTokOccurrence: tokIdxInRule + }; + return grammarPath; + } + getHumanReadableRuleStack() { + return map_default2(this.RULE_STACK, (currShortName) => this.shortRuleNameToFullName(currShortName)); + } + }; + __name(attemptInRepetitionRecovery, "attemptInRepetitionRecovery"); + __name2(attemptInRepetitionRecovery, "attemptInRepetitionRecovery"); + BITS_FOR_METHOD_TYPE = 4; + BITS_FOR_OCCURRENCE_IDX = 8; + BITS_FOR_ALT_IDX = 8; + OR_IDX = 1 << BITS_FOR_OCCURRENCE_IDX; + OPTION_IDX = 2 << BITS_FOR_OCCURRENCE_IDX; + MANY_IDX = 3 << BITS_FOR_OCCURRENCE_IDX; + AT_LEAST_ONE_IDX = 4 << BITS_FOR_OCCURRENCE_IDX; + MANY_SEP_IDX = 5 << BITS_FOR_OCCURRENCE_IDX; + AT_LEAST_ONE_SEP_IDX = 6 << BITS_FOR_OCCURRENCE_IDX; + __name(getKeyForAutomaticLookahead, "getKeyForAutomaticLookahead"); + __name2(getKeyForAutomaticLookahead, "getKeyForAutomaticLookahead"); + BITS_START_FOR_ALT_IDX = 32 - BITS_FOR_ALT_IDX; + LLkLookaheadStrategy = class { + static { + __name(this, "LLkLookaheadStrategy"); + } + static { + __name2(this, "LLkLookaheadStrategy"); + } + constructor(options2) { + var _a; + this.maxLookahead = (_a = options2 === null || options2 === void 0 ? void 0 : options2.maxLookahead) !== null && _a !== void 0 ? _a : DEFAULT_PARSER_CONFIG.maxLookahead; + } + validate(options2) { + const leftRecursionErrors = this.validateNoLeftRecursion(options2.rules); + if (isEmpty_default2(leftRecursionErrors)) { + const emptyAltErrors = this.validateEmptyOrAlternatives(options2.rules); + const ambiguousAltsErrors = this.validateAmbiguousAlternationAlternatives(options2.rules, this.maxLookahead); + const emptyRepetitionErrors = this.validateSomeNonEmptyLookaheadPath(options2.rules, this.maxLookahead); + const allErrors = [ + ...leftRecursionErrors, + ...emptyAltErrors, + ...ambiguousAltsErrors, + ...emptyRepetitionErrors + ]; + return allErrors; + } + return leftRecursionErrors; + } + validateNoLeftRecursion(rules) { + return flatMap_default(rules, (currTopRule) => validateNoLeftRecursion(currTopRule, currTopRule, defaultGrammarValidatorErrorProvider)); + } + validateEmptyOrAlternatives(rules) { + return flatMap_default(rules, (currTopRule) => validateEmptyOrAlternative(currTopRule, defaultGrammarValidatorErrorProvider)); + } + validateAmbiguousAlternationAlternatives(rules, maxLookahead) { + return flatMap_default(rules, (currTopRule) => validateAmbiguousAlternationAlternatives(currTopRule, maxLookahead, defaultGrammarValidatorErrorProvider)); + } + validateSomeNonEmptyLookaheadPath(rules, maxLookahead) { + return validateSomeNonEmptyLookaheadPath(rules, maxLookahead, defaultGrammarValidatorErrorProvider); + } + buildLookaheadForAlternation(options2) { + return buildLookaheadFuncForOr(options2.prodOccurrence, options2.rule, options2.maxLookahead, options2.hasPredicates, options2.dynamicTokensEnabled, buildAlternativesLookAheadFunc); + } + buildLookaheadForOptional(options2) { + return buildLookaheadFuncForOptionalProd(options2.prodOccurrence, options2.rule, options2.maxLookahead, options2.dynamicTokensEnabled, getProdType(options2.prodType), buildSingleAlternativeLookaheadFunction); + } + }; + LooksAhead = class { + static { + __name(this, "LooksAhead"); + } + static { + __name2(this, "LooksAhead"); + } + initLooksAhead(config5) { + this.dynamicTokensEnabled = has_default2(config5, "dynamicTokensEnabled") ? config5.dynamicTokensEnabled : DEFAULT_PARSER_CONFIG.dynamicTokensEnabled; + this.maxLookahead = has_default2(config5, "maxLookahead") ? config5.maxLookahead : DEFAULT_PARSER_CONFIG.maxLookahead; + this.lookaheadStrategy = has_default2(config5, "lookaheadStrategy") ? config5.lookaheadStrategy : new LLkLookaheadStrategy({ maxLookahead: this.maxLookahead }); + this.lookAheadFuncsCache = /* @__PURE__ */ new Map(); + } + preComputeLookaheadFunctions(rules) { + forEach_default2(rules, (currRule) => { + this.TRACE_INIT(`${currRule.name} Rule Lookahead`, () => { + const { alternation: alternation2, repetition: repetition2, option: option2, repetitionMandatory: repetitionMandatory2, repetitionMandatoryWithSeparator, repetitionWithSeparator } = collectMethods(currRule); + forEach_default2(alternation2, (currProd) => { + const prodIdx = currProd.idx === 0 ? "" : currProd.idx; + this.TRACE_INIT(`${getProductionDslName(currProd)}${prodIdx}`, () => { + const laFunc = this.lookaheadStrategy.buildLookaheadForAlternation({ + prodOccurrence: currProd.idx, + rule: currRule, + maxLookahead: currProd.maxLookahead || this.maxLookahead, + hasPredicates: currProd.hasPredicates, + dynamicTokensEnabled: this.dynamicTokensEnabled + }); + const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[currRule.name], OR_IDX, currProd.idx); + this.setLaFuncCache(key, laFunc); + }); + }); + forEach_default2(repetition2, (currProd) => { + this.computeLookaheadFunc(currRule, currProd.idx, MANY_IDX, "Repetition", currProd.maxLookahead, getProductionDslName(currProd)); + }); + forEach_default2(option2, (currProd) => { + this.computeLookaheadFunc(currRule, currProd.idx, OPTION_IDX, "Option", currProd.maxLookahead, getProductionDslName(currProd)); + }); + forEach_default2(repetitionMandatory2, (currProd) => { + this.computeLookaheadFunc(currRule, currProd.idx, AT_LEAST_ONE_IDX, "RepetitionMandatory", currProd.maxLookahead, getProductionDslName(currProd)); + }); + forEach_default2(repetitionMandatoryWithSeparator, (currProd) => { + this.computeLookaheadFunc(currRule, currProd.idx, AT_LEAST_ONE_SEP_IDX, "RepetitionMandatoryWithSeparator", currProd.maxLookahead, getProductionDslName(currProd)); + }); + forEach_default2(repetitionWithSeparator, (currProd) => { + this.computeLookaheadFunc(currRule, currProd.idx, MANY_SEP_IDX, "RepetitionWithSeparator", currProd.maxLookahead, getProductionDslName(currProd)); + }); + }); + }); + } + computeLookaheadFunc(rule, prodOccurrence, prodKey, prodType, prodMaxLookahead, dslMethodName) { + this.TRACE_INIT(`${dslMethodName}${prodOccurrence === 0 ? "" : prodOccurrence}`, () => { + const laFunc = this.lookaheadStrategy.buildLookaheadForOptional({ + prodOccurrence, + rule, + maxLookahead: prodMaxLookahead || this.maxLookahead, + dynamicTokensEnabled: this.dynamicTokensEnabled, + prodType + }); + const key = getKeyForAutomaticLookahead(this.fullRuleNameToShort[rule.name], prodKey, prodOccurrence); + this.setLaFuncCache(key, laFunc); + }); + } + // this actually returns a number, but it is always used as a string (object prop key) + getKeyForAutomaticLookahead(dslMethodIdx, occurrence) { + const currRuleShortName = this.getLastExplicitRuleShortName(); + return getKeyForAutomaticLookahead(currRuleShortName, dslMethodIdx, occurrence); + } + getLaFuncFromCache(key) { + return this.lookAheadFuncsCache.get(key); + } + /* istanbul ignore next */ + setLaFuncCache(key, value2) { + this.lookAheadFuncsCache.set(key, value2); + } + }; + DslMethodsCollectorVisitor = class extends GAstVisitor { + static { + __name(this, "DslMethodsCollectorVisitor"); + } + static { + __name2(this, "DslMethodsCollectorVisitor"); + } + constructor() { + super(...arguments); + this.dslMethods = { + option: [], + alternation: [], + repetition: [], + repetitionWithSeparator: [], + repetitionMandatory: [], + repetitionMandatoryWithSeparator: [] + }; + } + reset() { + this.dslMethods = { + option: [], + alternation: [], + repetition: [], + repetitionWithSeparator: [], + repetitionMandatory: [], + repetitionMandatoryWithSeparator: [] + }; + } + visitOption(option2) { + this.dslMethods.option.push(option2); + } + visitRepetitionWithSeparator(manySep) { + this.dslMethods.repetitionWithSeparator.push(manySep); + } + visitRepetitionMandatory(atLeastOne) { + this.dslMethods.repetitionMandatory.push(atLeastOne); + } + visitRepetitionMandatoryWithSeparator(atLeastOneSep) { + this.dslMethods.repetitionMandatoryWithSeparator.push(atLeastOneSep); + } + visitRepetition(many) { + this.dslMethods.repetition.push(many); + } + visitAlternation(or) { + this.dslMethods.alternation.push(or); + } + }; + collectorVisitor = new DslMethodsCollectorVisitor(); + __name(collectMethods, "collectMethods"); + __name2(collectMethods, "collectMethods"); + __name(setNodeLocationOnlyOffset, "setNodeLocationOnlyOffset"); + __name2(setNodeLocationOnlyOffset, "setNodeLocationOnlyOffset"); + __name(setNodeLocationFull, "setNodeLocationFull"); + __name2(setNodeLocationFull, "setNodeLocationFull"); + __name(addTerminalToCst, "addTerminalToCst"); + __name2(addTerminalToCst, "addTerminalToCst"); + __name(addNoneTerminalToCst, "addNoneTerminalToCst"); + __name2(addNoneTerminalToCst, "addNoneTerminalToCst"); + NAME = "name"; + __name(defineNameProp, "defineNameProp"); + __name2(defineNameProp, "defineNameProp"); + __name(defaultVisit, "defaultVisit"); + __name2(defaultVisit, "defaultVisit"); + __name(createBaseSemanticVisitorConstructor, "createBaseSemanticVisitorConstructor"); + __name2(createBaseSemanticVisitorConstructor, "createBaseSemanticVisitorConstructor"); + __name(createBaseVisitorConstructorWithDefaults, "createBaseVisitorConstructorWithDefaults"); + __name2(createBaseVisitorConstructorWithDefaults, "createBaseVisitorConstructorWithDefaults"); + (function(CstVisitorDefinitionError2) { + CstVisitorDefinitionError2[CstVisitorDefinitionError2["REDUNDANT_METHOD"] = 0] = "REDUNDANT_METHOD"; + CstVisitorDefinitionError2[CstVisitorDefinitionError2["MISSING_METHOD"] = 1] = "MISSING_METHOD"; + })(CstVisitorDefinitionError || (CstVisitorDefinitionError = {})); + __name(validateVisitor, "validateVisitor"); + __name2(validateVisitor, "validateVisitor"); + __name(validateMissingCstMethods, "validateMissingCstMethods"); + __name2(validateMissingCstMethods, "validateMissingCstMethods"); + TreeBuilder = class { + static { + __name(this, "TreeBuilder"); + } + static { + __name2(this, "TreeBuilder"); + } + initTreeBuilder(config5) { + this.CST_STACK = []; + this.outputCst = config5.outputCst; + this.nodeLocationTracking = has_default2(config5, "nodeLocationTracking") ? config5.nodeLocationTracking : DEFAULT_PARSER_CONFIG.nodeLocationTracking; + if (!this.outputCst) { + this.cstInvocationStateUpdate = noop_default3; + this.cstFinallyStateUpdate = noop_default3; + this.cstPostTerminal = noop_default3; + this.cstPostNonTerminal = noop_default3; + this.cstPostRule = noop_default3; + } else { + if (/full/i.test(this.nodeLocationTracking)) { + if (this.recoveryEnabled) { + this.setNodeLocationFromToken = setNodeLocationFull; + this.setNodeLocationFromNode = setNodeLocationFull; + this.cstPostRule = noop_default3; + this.setInitialNodeLocation = this.setInitialNodeLocationFullRecovery; + } else { + this.setNodeLocationFromToken = noop_default3; + this.setNodeLocationFromNode = noop_default3; + this.cstPostRule = this.cstPostRuleFull; + this.setInitialNodeLocation = this.setInitialNodeLocationFullRegular; + } + } else if (/onlyOffset/i.test(this.nodeLocationTracking)) { + if (this.recoveryEnabled) { + this.setNodeLocationFromToken = setNodeLocationOnlyOffset; + this.setNodeLocationFromNode = setNodeLocationOnlyOffset; + this.cstPostRule = noop_default3; + this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRecovery; + } else { + this.setNodeLocationFromToken = noop_default3; + this.setNodeLocationFromNode = noop_default3; + this.cstPostRule = this.cstPostRuleOnlyOffset; + this.setInitialNodeLocation = this.setInitialNodeLocationOnlyOffsetRegular; + } + } else if (/none/i.test(this.nodeLocationTracking)) { + this.setNodeLocationFromToken = noop_default3; + this.setNodeLocationFromNode = noop_default3; + this.cstPostRule = noop_default3; + this.setInitialNodeLocation = noop_default3; + } else { + throw Error(`Invalid config option: "${config5.nodeLocationTracking}"`); + } + } + } + setInitialNodeLocationOnlyOffsetRecovery(cstNode) { + cstNode.location = { + startOffset: NaN, + endOffset: NaN + }; + } + setInitialNodeLocationOnlyOffsetRegular(cstNode) { + cstNode.location = { + // without error recovery the starting Location of a new CstNode is guaranteed + // To be the next Token's startOffset (for valid inputs). + // For invalid inputs there won't be any CSTOutput so this potential + // inaccuracy does not matter + startOffset: this.LA(1).startOffset, + endOffset: NaN + }; + } + setInitialNodeLocationFullRecovery(cstNode) { + cstNode.location = { + startOffset: NaN, + startLine: NaN, + startColumn: NaN, + endOffset: NaN, + endLine: NaN, + endColumn: NaN + }; + } + /** + * @see setInitialNodeLocationOnlyOffsetRegular for explanation why this work + + * @param cstNode + */ + setInitialNodeLocationFullRegular(cstNode) { + const nextToken = this.LA(1); + cstNode.location = { + startOffset: nextToken.startOffset, + startLine: nextToken.startLine, + startColumn: nextToken.startColumn, + endOffset: NaN, + endLine: NaN, + endColumn: NaN + }; + } + cstInvocationStateUpdate(fullRuleName) { + const cstNode = { + name: fullRuleName, + children: /* @__PURE__ */ Object.create(null) + }; + this.setInitialNodeLocation(cstNode); + this.CST_STACK.push(cstNode); + } + cstFinallyStateUpdate() { + this.CST_STACK.pop(); + } + cstPostRuleFull(ruleCstNode) { + const prevToken = this.LA(0); + const loc = ruleCstNode.location; + if (loc.startOffset <= prevToken.startOffset === true) { + loc.endOffset = prevToken.endOffset; + loc.endLine = prevToken.endLine; + loc.endColumn = prevToken.endColumn; + } else { + loc.startOffset = NaN; + loc.startLine = NaN; + loc.startColumn = NaN; + } + } + cstPostRuleOnlyOffset(ruleCstNode) { + const prevToken = this.LA(0); + const loc = ruleCstNode.location; + if (loc.startOffset <= prevToken.startOffset === true) { + loc.endOffset = prevToken.endOffset; + } else { + loc.startOffset = NaN; + } + } + cstPostTerminal(key, consumedToken) { + const rootCst = this.CST_STACK[this.CST_STACK.length - 1]; + addTerminalToCst(rootCst, consumedToken, key); + this.setNodeLocationFromToken(rootCst.location, consumedToken); + } + cstPostNonTerminal(ruleCstResult, ruleName) { + const preCstNode = this.CST_STACK[this.CST_STACK.length - 1]; + addNoneTerminalToCst(preCstNode, ruleName, ruleCstResult); + this.setNodeLocationFromNode(preCstNode.location, ruleCstResult.location); + } + getBaseCstVisitorConstructor() { + if (isUndefined_default2(this.baseCstVisitorConstructor)) { + const newBaseCstVisitorConstructor = createBaseSemanticVisitorConstructor(this.className, keys_default2(this.gastProductionsCache)); + this.baseCstVisitorConstructor = newBaseCstVisitorConstructor; + return newBaseCstVisitorConstructor; + } + return this.baseCstVisitorConstructor; + } + getBaseCstVisitorConstructorWithDefaults() { + if (isUndefined_default2(this.baseCstVisitorWithDefaultsConstructor)) { + const newConstructor = createBaseVisitorConstructorWithDefaults(this.className, keys_default2(this.gastProductionsCache), this.getBaseCstVisitorConstructor()); + this.baseCstVisitorWithDefaultsConstructor = newConstructor; + return newConstructor; + } + return this.baseCstVisitorWithDefaultsConstructor; + } + getLastExplicitRuleShortName() { + const ruleStack = this.RULE_STACK; + return ruleStack[ruleStack.length - 1]; + } + getPreviousExplicitRuleShortName() { + const ruleStack = this.RULE_STACK; + return ruleStack[ruleStack.length - 2]; + } + getLastExplicitRuleOccurrenceIndex() { + const occurrenceStack = this.RULE_OCCURRENCE_STACK; + return occurrenceStack[occurrenceStack.length - 1]; + } + }; + LexerAdapter = class { + static { + __name(this, "LexerAdapter"); + } + static { + __name2(this, "LexerAdapter"); + } + initLexerAdapter() { + this.tokVector = []; + this.tokVectorLength = 0; + this.currIdx = -1; + } + set input(newInput) { + if (this.selfAnalysisDone !== true) { + throw Error(`Missing invocation at the end of the Parser's constructor.`); + } + this.reset(); + this.tokVector = newInput; + this.tokVectorLength = newInput.length; + } + get input() { + return this.tokVector; + } + // skips a token and returns the next token + SKIP_TOKEN() { + if (this.currIdx <= this.tokVector.length - 2) { + this.consumeToken(); + return this.LA(1); + } else { + return END_OF_FILE; + } + } + // Lexer (accessing Token vector) related methods which can be overridden to implement lazy lexers + // or lexers dependent on parser context. + LA(howMuch) { + const soughtIdx = this.currIdx + howMuch; + if (soughtIdx < 0 || this.tokVectorLength <= soughtIdx) { + return END_OF_FILE; + } else { + return this.tokVector[soughtIdx]; + } + } + consumeToken() { + this.currIdx++; + } + exportLexerState() { + return this.currIdx; + } + importLexerState(newState2) { + this.currIdx = newState2; + } + resetLexerState() { + this.currIdx = -1; + } + moveToTerminatedState() { + this.currIdx = this.tokVector.length - 1; + } + getLexerPosition() { + return this.exportLexerState(); + } + }; + RecognizerApi = class { + static { + __name(this, "RecognizerApi"); + } + static { + __name2(this, "RecognizerApi"); + } + ACTION(impl2) { + return impl2.call(this); + } + consume(idx, tokType, options2) { + return this.consumeInternal(tokType, idx, options2); + } + subrule(idx, ruleToCall, options2) { + return this.subruleInternal(ruleToCall, idx, options2); + } + option(idx, actionORMethodDef) { + return this.optionInternal(actionORMethodDef, idx); + } + or(idx, altsOrOpts) { + return this.orInternal(altsOrOpts, idx); + } + many(idx, actionORMethodDef) { + return this.manyInternal(idx, actionORMethodDef); + } + atLeastOne(idx, actionORMethodDef) { + return this.atLeastOneInternal(idx, actionORMethodDef); + } + CONSUME(tokType, options2) { + return this.consumeInternal(tokType, 0, options2); + } + CONSUME1(tokType, options2) { + return this.consumeInternal(tokType, 1, options2); + } + CONSUME2(tokType, options2) { + return this.consumeInternal(tokType, 2, options2); + } + CONSUME3(tokType, options2) { + return this.consumeInternal(tokType, 3, options2); + } + CONSUME4(tokType, options2) { + return this.consumeInternal(tokType, 4, options2); + } + CONSUME5(tokType, options2) { + return this.consumeInternal(tokType, 5, options2); + } + CONSUME6(tokType, options2) { + return this.consumeInternal(tokType, 6, options2); + } + CONSUME7(tokType, options2) { + return this.consumeInternal(tokType, 7, options2); + } + CONSUME8(tokType, options2) { + return this.consumeInternal(tokType, 8, options2); + } + CONSUME9(tokType, options2) { + return this.consumeInternal(tokType, 9, options2); + } + SUBRULE(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 0, options2); + } + SUBRULE1(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 1, options2); + } + SUBRULE2(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 2, options2); + } + SUBRULE3(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 3, options2); + } + SUBRULE4(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 4, options2); + } + SUBRULE5(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 5, options2); + } + SUBRULE6(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 6, options2); + } + SUBRULE7(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 7, options2); + } + SUBRULE8(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 8, options2); + } + SUBRULE9(ruleToCall, options2) { + return this.subruleInternal(ruleToCall, 9, options2); + } + OPTION(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 0); + } + OPTION1(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 1); + } + OPTION2(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 2); + } + OPTION3(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 3); + } + OPTION4(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 4); + } + OPTION5(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 5); + } + OPTION6(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 6); + } + OPTION7(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 7); + } + OPTION8(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 8); + } + OPTION9(actionORMethodDef) { + return this.optionInternal(actionORMethodDef, 9); + } + OR(altsOrOpts) { + return this.orInternal(altsOrOpts, 0); + } + OR1(altsOrOpts) { + return this.orInternal(altsOrOpts, 1); + } + OR2(altsOrOpts) { + return this.orInternal(altsOrOpts, 2); + } + OR3(altsOrOpts) { + return this.orInternal(altsOrOpts, 3); + } + OR4(altsOrOpts) { + return this.orInternal(altsOrOpts, 4); + } + OR5(altsOrOpts) { + return this.orInternal(altsOrOpts, 5); + } + OR6(altsOrOpts) { + return this.orInternal(altsOrOpts, 6); + } + OR7(altsOrOpts) { + return this.orInternal(altsOrOpts, 7); + } + OR8(altsOrOpts) { + return this.orInternal(altsOrOpts, 8); + } + OR9(altsOrOpts) { + return this.orInternal(altsOrOpts, 9); + } + MANY(actionORMethodDef) { + this.manyInternal(0, actionORMethodDef); + } + MANY1(actionORMethodDef) { + this.manyInternal(1, actionORMethodDef); + } + MANY2(actionORMethodDef) { + this.manyInternal(2, actionORMethodDef); + } + MANY3(actionORMethodDef) { + this.manyInternal(3, actionORMethodDef); + } + MANY4(actionORMethodDef) { + this.manyInternal(4, actionORMethodDef); + } + MANY5(actionORMethodDef) { + this.manyInternal(5, actionORMethodDef); + } + MANY6(actionORMethodDef) { + this.manyInternal(6, actionORMethodDef); + } + MANY7(actionORMethodDef) { + this.manyInternal(7, actionORMethodDef); + } + MANY8(actionORMethodDef) { + this.manyInternal(8, actionORMethodDef); + } + MANY9(actionORMethodDef) { + this.manyInternal(9, actionORMethodDef); + } + MANY_SEP(options2) { + this.manySepFirstInternal(0, options2); + } + MANY_SEP1(options2) { + this.manySepFirstInternal(1, options2); + } + MANY_SEP2(options2) { + this.manySepFirstInternal(2, options2); + } + MANY_SEP3(options2) { + this.manySepFirstInternal(3, options2); + } + MANY_SEP4(options2) { + this.manySepFirstInternal(4, options2); + } + MANY_SEP5(options2) { + this.manySepFirstInternal(5, options2); + } + MANY_SEP6(options2) { + this.manySepFirstInternal(6, options2); + } + MANY_SEP7(options2) { + this.manySepFirstInternal(7, options2); + } + MANY_SEP8(options2) { + this.manySepFirstInternal(8, options2); + } + MANY_SEP9(options2) { + this.manySepFirstInternal(9, options2); + } + AT_LEAST_ONE(actionORMethodDef) { + this.atLeastOneInternal(0, actionORMethodDef); + } + AT_LEAST_ONE1(actionORMethodDef) { + return this.atLeastOneInternal(1, actionORMethodDef); + } + AT_LEAST_ONE2(actionORMethodDef) { + this.atLeastOneInternal(2, actionORMethodDef); + } + AT_LEAST_ONE3(actionORMethodDef) { + this.atLeastOneInternal(3, actionORMethodDef); + } + AT_LEAST_ONE4(actionORMethodDef) { + this.atLeastOneInternal(4, actionORMethodDef); + } + AT_LEAST_ONE5(actionORMethodDef) { + this.atLeastOneInternal(5, actionORMethodDef); + } + AT_LEAST_ONE6(actionORMethodDef) { + this.atLeastOneInternal(6, actionORMethodDef); + } + AT_LEAST_ONE7(actionORMethodDef) { + this.atLeastOneInternal(7, actionORMethodDef); + } + AT_LEAST_ONE8(actionORMethodDef) { + this.atLeastOneInternal(8, actionORMethodDef); + } + AT_LEAST_ONE9(actionORMethodDef) { + this.atLeastOneInternal(9, actionORMethodDef); + } + AT_LEAST_ONE_SEP(options2) { + this.atLeastOneSepFirstInternal(0, options2); + } + AT_LEAST_ONE_SEP1(options2) { + this.atLeastOneSepFirstInternal(1, options2); + } + AT_LEAST_ONE_SEP2(options2) { + this.atLeastOneSepFirstInternal(2, options2); + } + AT_LEAST_ONE_SEP3(options2) { + this.atLeastOneSepFirstInternal(3, options2); + } + AT_LEAST_ONE_SEP4(options2) { + this.atLeastOneSepFirstInternal(4, options2); + } + AT_LEAST_ONE_SEP5(options2) { + this.atLeastOneSepFirstInternal(5, options2); + } + AT_LEAST_ONE_SEP6(options2) { + this.atLeastOneSepFirstInternal(6, options2); + } + AT_LEAST_ONE_SEP7(options2) { + this.atLeastOneSepFirstInternal(7, options2); + } + AT_LEAST_ONE_SEP8(options2) { + this.atLeastOneSepFirstInternal(8, options2); + } + AT_LEAST_ONE_SEP9(options2) { + this.atLeastOneSepFirstInternal(9, options2); + } + RULE(name, implementation, config5 = DEFAULT_RULE_CONFIG) { + if (includes_default(this.definedRulesNames, name)) { + const errMsg = defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({ + topLevelRule: name, + grammarName: this.className + }); + const error3 = { + message: errMsg, + type: ParserDefinitionErrorType.DUPLICATE_RULE_NAME, + ruleName: name + }; + this.definitionErrors.push(error3); + } + this.definedRulesNames.push(name); + const ruleImplementation = this.defineRule(name, implementation, config5); + this[name] = ruleImplementation; + return ruleImplementation; + } + OVERRIDE_RULE(name, impl2, config5 = DEFAULT_RULE_CONFIG) { + const ruleErrors = validateRuleIsOverridden(name, this.definedRulesNames, this.className); + this.definitionErrors = this.definitionErrors.concat(ruleErrors); + const ruleImplementation = this.defineRule(name, impl2, config5); + this[name] = ruleImplementation; + return ruleImplementation; + } + BACKTRACK(grammarRule, args) { + return function() { + this.isBackTrackingStack.push(1); + const orgState = this.saveRecogState(); + try { + grammarRule.apply(this, args); + return true; + } catch (e3) { + if (isRecognitionException(e3)) { + return false; + } else { + throw e3; + } + } finally { + this.reloadRecogState(orgState); + this.isBackTrackingStack.pop(); + } + }; + } + // GAST export APIs + getGAstProductions() { + return this.gastProductionsCache; + } + getSerializedGastProductions() { + return serializeGrammar(values_default2(this.gastProductionsCache)); + } + }; + RecognizerEngine = class { + static { + __name(this, "RecognizerEngine"); + } + static { + __name2(this, "RecognizerEngine"); + } + initRecognizerEngine(tokenVocabulary, config5) { + this.className = this.constructor.name; + this.shortRuleNameToFull = {}; + this.fullRuleNameToShort = {}; + this.ruleShortNameIdx = 256; + this.tokenMatcher = tokenStructuredMatcherNoCategories; + this.subruleIdx = 0; + this.definedRulesNames = []; + this.tokensMap = {}; + this.isBackTrackingStack = []; + this.RULE_STACK = []; + this.RULE_OCCURRENCE_STACK = []; + this.gastProductionsCache = {}; + if (has_default2(config5, "serializedGrammar")) { + throw Error("The Parser's configuration can no longer contain a property.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n For Further details."); + } + if (isArray_default2(tokenVocabulary)) { + if (isEmpty_default2(tokenVocabulary)) { + throw Error("A Token Vocabulary cannot be empty.\n Note that the first argument for the parser constructor\n is no longer a Token vector (since v4.0)."); + } + if (typeof tokenVocabulary[0].startOffset === "number") { + throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n For Further details."); + } + } + if (isArray_default2(tokenVocabulary)) { + this.tokensMap = reduce_default2(tokenVocabulary, (acc, tokType) => { + acc[tokType.name] = tokType; + return acc; + }, {}); + } else if (has_default2(tokenVocabulary, "modes") && every_default(flatten_default2(values_default2(tokenVocabulary.modes)), isTokenType)) { + const allTokenTypes2 = flatten_default2(values_default2(tokenVocabulary.modes)); + const uniqueTokens = uniq_default(allTokenTypes2); + this.tokensMap = reduce_default2(uniqueTokens, (acc, tokType) => { + acc[tokType.name] = tokType; + return acc; + }, {}); + } else if (isObject_default2(tokenVocabulary)) { + this.tokensMap = clone_default3(tokenVocabulary); + } else { + throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition"); + } + this.tokensMap["EOF"] = EOF; + const allTokenTypes = has_default2(tokenVocabulary, "modes") ? flatten_default2(values_default2(tokenVocabulary.modes)) : values_default2(tokenVocabulary); + const noTokenCategoriesUsed = every_default(allTokenTypes, (tokenConstructor) => isEmpty_default2(tokenConstructor.categoryMatches)); + this.tokenMatcher = noTokenCategoriesUsed ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher; + augmentTokenTypes(values_default2(this.tokensMap)); + } + defineRule(ruleName, impl2, config5) { + if (this.selfAnalysisDone) { + throw Error(`Grammar rule <${ruleName}> may not be defined after the 'performSelfAnalysis' method has been called' +Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`); + } + const resyncEnabled = has_default2(config5, "resyncEnabled") ? config5.resyncEnabled : DEFAULT_RULE_CONFIG.resyncEnabled; + const recoveryValueFunc = has_default2(config5, "recoveryValueFunc") ? config5.recoveryValueFunc : DEFAULT_RULE_CONFIG.recoveryValueFunc; + const shortName = this.ruleShortNameIdx << BITS_FOR_METHOD_TYPE + BITS_FOR_OCCURRENCE_IDX; + this.ruleShortNameIdx++; + this.shortRuleNameToFull[shortName] = ruleName; + this.fullRuleNameToShort[ruleName] = shortName; + let invokeRuleWithTry; + if (this.outputCst === true) { + invokeRuleWithTry = /* @__PURE__ */ __name2(/* @__PURE__ */ __name(function invokeRuleWithTry2(...args) { + try { + this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx); + impl2.apply(this, args); + const cst = this.CST_STACK[this.CST_STACK.length - 1]; + this.cstPostRule(cst); + return cst; + } catch (e3) { + return this.invokeRuleCatch(e3, resyncEnabled, recoveryValueFunc); + } finally { + this.ruleFinallyStateUpdate(); + } + }, "invokeRuleWithTry2"), "invokeRuleWithTry"); + } else { + invokeRuleWithTry = /* @__PURE__ */ __name2(/* @__PURE__ */ __name(function invokeRuleWithTryCst(...args) { + try { + this.ruleInvocationStateUpdate(shortName, ruleName, this.subruleIdx); + return impl2.apply(this, args); + } catch (e3) { + return this.invokeRuleCatch(e3, resyncEnabled, recoveryValueFunc); + } finally { + this.ruleFinallyStateUpdate(); + } + }, "invokeRuleWithTryCst"), "invokeRuleWithTryCst"); + } + const wrappedGrammarRule = Object.assign(invokeRuleWithTry, { ruleName, originalGrammarAction: impl2 }); + return wrappedGrammarRule; + } + invokeRuleCatch(e3, resyncEnabledConfig, recoveryValueFunc) { + const isFirstInvokedRule = this.RULE_STACK.length === 1; + const reSyncEnabled = resyncEnabledConfig && !this.isBackTracking() && this.recoveryEnabled; + if (isRecognitionException(e3)) { + const recogError = e3; + if (reSyncEnabled) { + const reSyncTokType = this.findReSyncTokenType(); + if (this.isInCurrentRuleReSyncSet(reSyncTokType)) { + recogError.resyncedTokens = this.reSyncTo(reSyncTokType); + if (this.outputCst) { + const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1]; + partialCstResult.recoveredNode = true; + return partialCstResult; + } else { + return recoveryValueFunc(e3); + } + } else { + if (this.outputCst) { + const partialCstResult = this.CST_STACK[this.CST_STACK.length - 1]; + partialCstResult.recoveredNode = true; + recogError.partialCstResult = partialCstResult; + } + throw recogError; + } + } else if (isFirstInvokedRule) { + this.moveToTerminatedState(); + return recoveryValueFunc(e3); + } else { + throw recogError; + } + } else { + throw e3; + } + } + // Implementation of parsing DSL + optionInternal(actionORMethodDef, occurrence) { + const key = this.getKeyForAutomaticLookahead(OPTION_IDX, occurrence); + return this.optionInternalLogic(actionORMethodDef, occurrence, key); + } + optionInternalLogic(actionORMethodDef, occurrence, key) { + let lookAheadFunc = this.getLaFuncFromCache(key); + let action; + if (typeof actionORMethodDef !== "function") { + action = actionORMethodDef.DEF; + const predicate = actionORMethodDef.GATE; + if (predicate !== void 0) { + const orgLookaheadFunction = lookAheadFunc; + lookAheadFunc = /* @__PURE__ */ __name2(() => { + return predicate.call(this) && orgLookaheadFunction.call(this); + }, "lookAheadFunc"); + } + } else { + action = actionORMethodDef; + } + if (lookAheadFunc.call(this) === true) { + return action.call(this); + } + return void 0; + } + atLeastOneInternal(prodOccurrence, actionORMethodDef) { + const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_IDX, prodOccurrence); + return this.atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, laKey); + } + atLeastOneInternalLogic(prodOccurrence, actionORMethodDef, key) { + let lookAheadFunc = this.getLaFuncFromCache(key); + let action; + if (typeof actionORMethodDef !== "function") { + action = actionORMethodDef.DEF; + const predicate = actionORMethodDef.GATE; + if (predicate !== void 0) { + const orgLookaheadFunction = lookAheadFunc; + lookAheadFunc = /* @__PURE__ */ __name2(() => { + return predicate.call(this) && orgLookaheadFunction.call(this); + }, "lookAheadFunc"); + } + } else { + action = actionORMethodDef; + } + if (lookAheadFunc.call(this) === true) { + let notStuck = this.doSingleRepetition(action); + while (lookAheadFunc.call(this) === true && notStuck === true) { + notStuck = this.doSingleRepetition(action); + } + } else { + throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY, actionORMethodDef.ERR_MSG); + } + this.attemptInRepetitionRecovery(this.atLeastOneInternal, [prodOccurrence, actionORMethodDef], lookAheadFunc, AT_LEAST_ONE_IDX, prodOccurrence, NextTerminalAfterAtLeastOneWalker); + } + atLeastOneSepFirstInternal(prodOccurrence, options2) { + const laKey = this.getKeyForAutomaticLookahead(AT_LEAST_ONE_SEP_IDX, prodOccurrence); + this.atLeastOneSepFirstInternalLogic(prodOccurrence, options2, laKey); + } + atLeastOneSepFirstInternalLogic(prodOccurrence, options2, key) { + const action = options2.DEF; + const separator = options2.SEP; + const firstIterationLookaheadFunc = this.getLaFuncFromCache(key); + if (firstIterationLookaheadFunc.call(this) === true) { + action.call(this); + const separatorLookAheadFunc = /* @__PURE__ */ __name2(() => { + return this.tokenMatcher(this.LA(1), separator); + }, "separatorLookAheadFunc"); + while (this.tokenMatcher(this.LA(1), separator) === true) { + this.CONSUME(separator); + action.call(this); + } + this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [ + prodOccurrence, + separator, + separatorLookAheadFunc, + action, + NextTerminalAfterAtLeastOneSepWalker + ], separatorLookAheadFunc, AT_LEAST_ONE_SEP_IDX, prodOccurrence, NextTerminalAfterAtLeastOneSepWalker); + } else { + throw this.raiseEarlyExitException(prodOccurrence, PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR, options2.ERR_MSG); + } + } + manyInternal(prodOccurrence, actionORMethodDef) { + const laKey = this.getKeyForAutomaticLookahead(MANY_IDX, prodOccurrence); + return this.manyInternalLogic(prodOccurrence, actionORMethodDef, laKey); + } + manyInternalLogic(prodOccurrence, actionORMethodDef, key) { + let lookaheadFunction = this.getLaFuncFromCache(key); + let action; + if (typeof actionORMethodDef !== "function") { + action = actionORMethodDef.DEF; + const predicate = actionORMethodDef.GATE; + if (predicate !== void 0) { + const orgLookaheadFunction = lookaheadFunction; + lookaheadFunction = /* @__PURE__ */ __name2(() => { + return predicate.call(this) && orgLookaheadFunction.call(this); + }, "lookaheadFunction"); + } + } else { + action = actionORMethodDef; + } + let notStuck = true; + while (lookaheadFunction.call(this) === true && notStuck === true) { + notStuck = this.doSingleRepetition(action); + } + this.attemptInRepetitionRecovery( + this.manyInternal, + [prodOccurrence, actionORMethodDef], + lookaheadFunction, + MANY_IDX, + prodOccurrence, + NextTerminalAfterManyWalker, + // The notStuck parameter is only relevant when "attemptInRepetitionRecovery" + // is invoked from manyInternal, in the MANY_SEP case and AT_LEAST_ONE[_SEP] + // An infinite loop cannot occur as: + // - Either the lookahead is guaranteed to consume something (Single Token Separator) + // - AT_LEAST_ONE by definition is guaranteed to consume something (or error out). + notStuck + ); + } + manySepFirstInternal(prodOccurrence, options2) { + const laKey = this.getKeyForAutomaticLookahead(MANY_SEP_IDX, prodOccurrence); + this.manySepFirstInternalLogic(prodOccurrence, options2, laKey); + } + manySepFirstInternalLogic(prodOccurrence, options2, key) { + const action = options2.DEF; + const separator = options2.SEP; + const firstIterationLaFunc = this.getLaFuncFromCache(key); + if (firstIterationLaFunc.call(this) === true) { + action.call(this); + const separatorLookAheadFunc = /* @__PURE__ */ __name2(() => { + return this.tokenMatcher(this.LA(1), separator); + }, "separatorLookAheadFunc"); + while (this.tokenMatcher(this.LA(1), separator) === true) { + this.CONSUME(separator); + action.call(this); + } + this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [ + prodOccurrence, + separator, + separatorLookAheadFunc, + action, + NextTerminalAfterManySepWalker + ], separatorLookAheadFunc, MANY_SEP_IDX, prodOccurrence, NextTerminalAfterManySepWalker); + } + } + repetitionSepSecondInternal(prodOccurrence, separator, separatorLookAheadFunc, action, nextTerminalAfterWalker) { + while (separatorLookAheadFunc()) { + this.CONSUME(separator); + action.call(this); + } + this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal, [ + prodOccurrence, + separator, + separatorLookAheadFunc, + action, + nextTerminalAfterWalker + ], separatorLookAheadFunc, AT_LEAST_ONE_SEP_IDX, prodOccurrence, nextTerminalAfterWalker); + } + doSingleRepetition(action) { + const beforeIteration = this.getLexerPosition(); + action.call(this); + const afterIteration = this.getLexerPosition(); + return afterIteration > beforeIteration; + } + orInternal(altsOrOpts, occurrence) { + const laKey = this.getKeyForAutomaticLookahead(OR_IDX, occurrence); + const alts = isArray_default2(altsOrOpts) ? altsOrOpts : altsOrOpts.DEF; + const laFunc = this.getLaFuncFromCache(laKey); + const altIdxToTake = laFunc.call(this, alts); + if (altIdxToTake !== void 0) { + const chosenAlternative = alts[altIdxToTake]; + return chosenAlternative.ALT.call(this); + } + this.raiseNoAltException(occurrence, altsOrOpts.ERR_MSG); + } + ruleFinallyStateUpdate() { + this.RULE_STACK.pop(); + this.RULE_OCCURRENCE_STACK.pop(); + this.cstFinallyStateUpdate(); + if (this.RULE_STACK.length === 0 && this.isAtEndOfInput() === false) { + const firstRedundantTok = this.LA(1); + const errMsg = this.errorMessageProvider.buildNotAllInputParsedMessage({ + firstRedundant: firstRedundantTok, + ruleName: this.getCurrRuleFullName() + }); + this.SAVE_ERROR(new NotAllInputParsedException(errMsg, firstRedundantTok)); + } + } + subruleInternal(ruleToCall, idx, options2) { + let ruleResult; + try { + const args = options2 !== void 0 ? options2.ARGS : void 0; + this.subruleIdx = idx; + ruleResult = ruleToCall.apply(this, args); + this.cstPostNonTerminal(ruleResult, options2 !== void 0 && options2.LABEL !== void 0 ? options2.LABEL : ruleToCall.ruleName); + return ruleResult; + } catch (e3) { + throw this.subruleInternalError(e3, options2, ruleToCall.ruleName); + } + } + subruleInternalError(e3, options2, ruleName) { + if (isRecognitionException(e3) && e3.partialCstResult !== void 0) { + this.cstPostNonTerminal(e3.partialCstResult, options2 !== void 0 && options2.LABEL !== void 0 ? options2.LABEL : ruleName); + delete e3.partialCstResult; + } + throw e3; + } + consumeInternal(tokType, idx, options2) { + let consumedToken; + try { + const nextToken = this.LA(1); + if (this.tokenMatcher(nextToken, tokType) === true) { + this.consumeToken(); + consumedToken = nextToken; + } else { + this.consumeInternalError(tokType, nextToken, options2); + } + } catch (eFromConsumption) { + consumedToken = this.consumeInternalRecovery(tokType, idx, eFromConsumption); + } + this.cstPostTerminal(options2 !== void 0 && options2.LABEL !== void 0 ? options2.LABEL : tokType.name, consumedToken); + return consumedToken; + } + consumeInternalError(tokType, nextToken, options2) { + let msg; + const previousToken = this.LA(0); + if (options2 !== void 0 && options2.ERR_MSG) { + msg = options2.ERR_MSG; + } else { + msg = this.errorMessageProvider.buildMismatchTokenMessage({ + expected: tokType, + actual: nextToken, + previous: previousToken, + ruleName: this.getCurrRuleFullName() + }); + } + throw this.SAVE_ERROR(new MismatchedTokenException(msg, nextToken, previousToken)); + } + consumeInternalRecovery(tokType, idx, eFromConsumption) { + if (this.recoveryEnabled && // TODO: more robust checking of the exception type. Perhaps Typescript extending expressions? + eFromConsumption.name === "MismatchedTokenException" && !this.isBackTracking()) { + const follows = this.getFollowsForInRuleRecovery(tokType, idx); + try { + return this.tryInRuleRecovery(tokType, follows); + } catch (eFromInRuleRecovery) { + if (eFromInRuleRecovery.name === IN_RULE_RECOVERY_EXCEPTION) { + throw eFromConsumption; + } else { + throw eFromInRuleRecovery; + } + } + } else { + throw eFromConsumption; + } + } + saveRecogState() { + const savedErrors = this.errors; + const savedRuleStack = clone_default3(this.RULE_STACK); + return { + errors: savedErrors, + lexerState: this.exportLexerState(), + RULE_STACK: savedRuleStack, + CST_STACK: this.CST_STACK + }; + } + reloadRecogState(newState2) { + this.errors = newState2.errors; + this.importLexerState(newState2.lexerState); + this.RULE_STACK = newState2.RULE_STACK; + } + ruleInvocationStateUpdate(shortName, fullName, idxInCallingRule) { + this.RULE_OCCURRENCE_STACK.push(idxInCallingRule); + this.RULE_STACK.push(shortName); + this.cstInvocationStateUpdate(fullName); + } + isBackTracking() { + return this.isBackTrackingStack.length !== 0; + } + getCurrRuleFullName() { + const shortName = this.getLastExplicitRuleShortName(); + return this.shortRuleNameToFull[shortName]; + } + shortRuleNameToFullName(shortName) { + return this.shortRuleNameToFull[shortName]; + } + isAtEndOfInput() { + return this.tokenMatcher(this.LA(1), EOF); + } + reset() { + this.resetLexerState(); + this.subruleIdx = 0; + this.isBackTrackingStack = []; + this.errors = []; + this.RULE_STACK = []; + this.CST_STACK = []; + this.RULE_OCCURRENCE_STACK = []; + } + }; + ErrorHandler = class { + static { + __name(this, "ErrorHandler"); + } + static { + __name2(this, "ErrorHandler"); + } + initErrorHandler(config5) { + this._errors = []; + this.errorMessageProvider = has_default2(config5, "errorMessageProvider") ? config5.errorMessageProvider : DEFAULT_PARSER_CONFIG.errorMessageProvider; + } + SAVE_ERROR(error3) { + if (isRecognitionException(error3)) { + error3.context = { + ruleStack: this.getHumanReadableRuleStack(), + ruleOccurrenceStack: clone_default3(this.RULE_OCCURRENCE_STACK) + }; + this._errors.push(error3); + return error3; + } else { + throw Error("Trying to save an Error which is not a RecognitionException"); + } + } + get errors() { + return clone_default3(this._errors); + } + set errors(newErrors) { + this._errors = newErrors; + } + // TODO: consider caching the error message computed information + raiseEarlyExitException(occurrence, prodType, userDefinedErrMsg) { + const ruleName = this.getCurrRuleFullName(); + const ruleGrammar = this.getGAstProductions()[ruleName]; + const lookAheadPathsPerAlternative = getLookaheadPathsForOptionalProd(occurrence, ruleGrammar, prodType, this.maxLookahead); + const insideProdPaths = lookAheadPathsPerAlternative[0]; + const actualTokens = []; + for (let i2 = 1; i2 <= this.maxLookahead; i2++) { + actualTokens.push(this.LA(i2)); + } + const msg = this.errorMessageProvider.buildEarlyExitMessage({ + expectedIterationPaths: insideProdPaths, + actual: actualTokens, + previous: this.LA(0), + customUserDescription: userDefinedErrMsg, + ruleName + }); + throw this.SAVE_ERROR(new EarlyExitException(msg, this.LA(1), this.LA(0))); + } + // TODO: consider caching the error message computed information + raiseNoAltException(occurrence, errMsgTypes) { + const ruleName = this.getCurrRuleFullName(); + const ruleGrammar = this.getGAstProductions()[ruleName]; + const lookAheadPathsPerAlternative = getLookaheadPathsForOr(occurrence, ruleGrammar, this.maxLookahead); + const actualTokens = []; + for (let i2 = 1; i2 <= this.maxLookahead; i2++) { + actualTokens.push(this.LA(i2)); + } + const previousToken = this.LA(0); + const errMsg = this.errorMessageProvider.buildNoViableAltMessage({ + expectedPathsPerAlt: lookAheadPathsPerAlternative, + actual: actualTokens, + previous: previousToken, + customUserDescription: errMsgTypes, + ruleName: this.getCurrRuleFullName() + }); + throw this.SAVE_ERROR(new NoViableAltException(errMsg, this.LA(1), previousToken)); + } + }; + ContentAssist = class { + static { + __name(this, "ContentAssist"); + } + static { + __name2(this, "ContentAssist"); + } + initContentAssist() { + } + computeContentAssist(startRuleName, precedingInput) { + const startRuleGast = this.gastProductionsCache[startRuleName]; + if (isUndefined_default2(startRuleGast)) { + throw Error(`Rule ->${startRuleName}<- does not exist in this grammar.`); + } + return nextPossibleTokensAfter([startRuleGast], precedingInput, this.tokenMatcher, this.maxLookahead); + } + // TODO: should this be a member method or a utility? it does not have any state or usage of 'this'... + // TODO: should this be more explicitly part of the public API? + getNextPossibleTokenTypes(grammarPath) { + const topRuleName = head_default(grammarPath.ruleStack); + const gastProductions = this.getGAstProductions(); + const topProduction = gastProductions[topRuleName]; + const nextPossibleTokenTypes = new NextAfterTokenWalker(topProduction, grammarPath).startWalking(); + return nextPossibleTokenTypes; + } + }; + RECORDING_NULL_OBJECT = { + description: "This Object indicates the Parser is during Recording Phase" + }; + Object.freeze(RECORDING_NULL_OBJECT); + HANDLE_SEPARATOR = true; + MAX_METHOD_IDX = Math.pow(2, BITS_FOR_OCCURRENCE_IDX) - 1; + RFT = createToken({ name: "RECORDING_PHASE_TOKEN", pattern: Lexer2.NA }); + augmentTokenTypes([RFT]); + RECORDING_PHASE_TOKEN = createTokenInstance( + RFT, + "This IToken indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details", + // Using "-1" instead of NaN (as in EOF) because an actual number is less likely to + // cause errors if the output of LA or CONSUME would be (incorrectly) used during the recording phase. + -1, + -1, + -1, + -1, + -1, + -1 + ); + Object.freeze(RECORDING_PHASE_TOKEN); + RECORDING_PHASE_CSTNODE = { + name: "This CSTNode indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details", + children: {} + }; + GastRecorder = class { + static { + __name(this, "GastRecorder"); + } + static { + __name2(this, "GastRecorder"); + } + initGastRecorder(config5) { + this.recordingProdStack = []; + this.RECORDING_PHASE = false; + } + enableRecording() { + this.RECORDING_PHASE = true; + this.TRACE_INIT("Enable Recording", () => { + for (let i2 = 0; i2 < 10; i2++) { + const idx = i2 > 0 ? i2 : ""; + this[`CONSUME${idx}`] = function(arg1, arg2) { + return this.consumeInternalRecord(arg1, i2, arg2); + }; + this[`SUBRULE${idx}`] = function(arg1, arg2) { + return this.subruleInternalRecord(arg1, i2, arg2); + }; + this[`OPTION${idx}`] = function(arg1) { + return this.optionInternalRecord(arg1, i2); + }; + this[`OR${idx}`] = function(arg1) { + return this.orInternalRecord(arg1, i2); + }; + this[`MANY${idx}`] = function(arg1) { + this.manyInternalRecord(i2, arg1); + }; + this[`MANY_SEP${idx}`] = function(arg1) { + this.manySepFirstInternalRecord(i2, arg1); + }; + this[`AT_LEAST_ONE${idx}`] = function(arg1) { + this.atLeastOneInternalRecord(i2, arg1); + }; + this[`AT_LEAST_ONE_SEP${idx}`] = function(arg1) { + this.atLeastOneSepFirstInternalRecord(i2, arg1); + }; + } + this[`consume`] = function(idx, arg1, arg2) { + return this.consumeInternalRecord(arg1, idx, arg2); + }; + this[`subrule`] = function(idx, arg1, arg2) { + return this.subruleInternalRecord(arg1, idx, arg2); + }; + this[`option`] = function(idx, arg1) { + return this.optionInternalRecord(arg1, idx); + }; + this[`or`] = function(idx, arg1) { + return this.orInternalRecord(arg1, idx); + }; + this[`many`] = function(idx, arg1) { + this.manyInternalRecord(idx, arg1); + }; + this[`atLeastOne`] = function(idx, arg1) { + this.atLeastOneInternalRecord(idx, arg1); + }; + this.ACTION = this.ACTION_RECORD; + this.BACKTRACK = this.BACKTRACK_RECORD; + this.LA = this.LA_RECORD; + }); + } + disableRecording() { + this.RECORDING_PHASE = false; + this.TRACE_INIT("Deleting Recording methods", () => { + const that = this; + for (let i2 = 0; i2 < 10; i2++) { + const idx = i2 > 0 ? i2 : ""; + delete that[`CONSUME${idx}`]; + delete that[`SUBRULE${idx}`]; + delete that[`OPTION${idx}`]; + delete that[`OR${idx}`]; + delete that[`MANY${idx}`]; + delete that[`MANY_SEP${idx}`]; + delete that[`AT_LEAST_ONE${idx}`]; + delete that[`AT_LEAST_ONE_SEP${idx}`]; + } + delete that[`consume`]; + delete that[`subrule`]; + delete that[`option`]; + delete that[`or`]; + delete that[`many`]; + delete that[`atLeastOne`]; + delete that.ACTION; + delete that.BACKTRACK; + delete that.LA; + }); + } + // Parser methods are called inside an ACTION? + // Maybe try/catch/finally on ACTIONS while disabling the recorders state changes? + // @ts-expect-error -- noop place holder + ACTION_RECORD(impl2) { + } + // Executing backtracking logic will break our recording logic assumptions + BACKTRACK_RECORD(grammarRule, args) { + return () => true; + } + // LA is part of the official API and may be used for custom lookahead logic + // by end users who may forget to wrap it in ACTION or inside a GATE + LA_RECORD(howMuch) { + return END_OF_FILE; + } + topLevelRuleRecord(name, def) { + try { + const newTopLevelRule = new Rule({ definition: [], name }); + newTopLevelRule.name = name; + this.recordingProdStack.push(newTopLevelRule); + def.call(this); + this.recordingProdStack.pop(); + return newTopLevelRule; + } catch (originalError) { + if (originalError.KNOWN_RECORDER_ERROR !== true) { + try { + originalError.message = originalError.message + '\n This error was thrown during the "grammar recording phase" For more info see:\n https://chevrotain.io/docs/guide/internals.html#grammar-recording'; + } catch (mutabilityError) { + throw originalError; + } + } + throw originalError; + } + } + // Implementation of parsing DSL + optionInternalRecord(actionORMethodDef, occurrence) { + return recordProd.call(this, Option2, actionORMethodDef, occurrence); + } + atLeastOneInternalRecord(occurrence, actionORMethodDef) { + recordProd.call(this, RepetitionMandatory, actionORMethodDef, occurrence); + } + atLeastOneSepFirstInternalRecord(occurrence, options2) { + recordProd.call(this, RepetitionMandatoryWithSeparator, options2, occurrence, HANDLE_SEPARATOR); + } + manyInternalRecord(occurrence, actionORMethodDef) { + recordProd.call(this, Repetition, actionORMethodDef, occurrence); + } + manySepFirstInternalRecord(occurrence, options2) { + recordProd.call(this, RepetitionWithSeparator, options2, occurrence, HANDLE_SEPARATOR); + } + orInternalRecord(altsOrOpts, occurrence) { + return recordOrProd.call(this, altsOrOpts, occurrence); + } + subruleInternalRecord(ruleToCall, occurrence, options2) { + assertMethodIdxIsValid(occurrence); + if (!ruleToCall || has_default2(ruleToCall, "ruleName") === false) { + const error3 = new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(ruleToCall)}> + inside top level rule: <${this.recordingProdStack[0].name}>`); + error3.KNOWN_RECORDER_ERROR = true; + throw error3; + } + const prevProd = last_default2(this.recordingProdStack); + const ruleName = ruleToCall.ruleName; + const newNoneTerminal = new NonTerminal({ + idx: occurrence, + nonTerminalName: ruleName, + label: options2 === null || options2 === void 0 ? void 0 : options2.LABEL, + // The resolving of the `referencedRule` property will be done once all the Rule's GASTs have been created + referencedRule: void 0 + }); + prevProd.definition.push(newNoneTerminal); + return this.outputCst ? RECORDING_PHASE_CSTNODE : RECORDING_NULL_OBJECT; + } + consumeInternalRecord(tokType, occurrence, options2) { + assertMethodIdxIsValid(occurrence); + if (!hasShortKeyProperty(tokType)) { + const error3 = new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(tokType)}> + inside top level rule: <${this.recordingProdStack[0].name}>`); + error3.KNOWN_RECORDER_ERROR = true; + throw error3; + } + const prevProd = last_default2(this.recordingProdStack); + const newNoneTerminal = new Terminal({ + idx: occurrence, + terminalType: tokType, + label: options2 === null || options2 === void 0 ? void 0 : options2.LABEL + }); + prevProd.definition.push(newNoneTerminal); + return RECORDING_PHASE_TOKEN; + } + }; + __name(recordProd, "recordProd"); + __name2(recordProd, "recordProd"); + __name(recordOrProd, "recordOrProd"); + __name2(recordOrProd, "recordOrProd"); + __name(getIdxSuffix, "getIdxSuffix"); + __name2(getIdxSuffix, "getIdxSuffix"); + __name(assertMethodIdxIsValid, "assertMethodIdxIsValid"); + __name2(assertMethodIdxIsValid, "assertMethodIdxIsValid"); + PerformanceTracer = class { + static { + __name(this, "PerformanceTracer"); + } + static { + __name2(this, "PerformanceTracer"); + } + initPerformanceTracer(config5) { + if (has_default2(config5, "traceInitPerf")) { + const userTraceInitPerf = config5.traceInitPerf; + const traceIsNumber = typeof userTraceInitPerf === "number"; + this.traceInitMaxIdent = traceIsNumber ? userTraceInitPerf : Infinity; + this.traceInitPerf = traceIsNumber ? userTraceInitPerf > 0 : userTraceInitPerf; + } else { + this.traceInitMaxIdent = 0; + this.traceInitPerf = DEFAULT_PARSER_CONFIG.traceInitPerf; + } + this.traceInitIndent = -1; + } + TRACE_INIT(phaseDesc, phaseImpl) { + if (this.traceInitPerf === true) { + this.traceInitIndent++; + const indent = new Array(this.traceInitIndent + 1).join(" "); + if (this.traceInitIndent < this.traceInitMaxIdent) { + console.log(`${indent}--> <${phaseDesc}>`); + } + const { time: time4, value: value2 } = timer2(phaseImpl); + const traceMethod = time4 > 10 ? console.warn : console.log; + if (this.traceInitIndent < this.traceInitMaxIdent) { + traceMethod(`${indent}<-- <${phaseDesc}> time: ${time4}ms`); + } + this.traceInitIndent--; + return value2; + } else { + return phaseImpl(); + } + } + }; + __name(applyMixins, "applyMixins"); + __name2(applyMixins, "applyMixins"); + END_OF_FILE = createTokenInstance(EOF, "", NaN, NaN, NaN, NaN, NaN, NaN); + Object.freeze(END_OF_FILE); + DEFAULT_PARSER_CONFIG = Object.freeze({ + recoveryEnabled: false, + maxLookahead: 3, + dynamicTokensEnabled: false, + outputCst: true, + errorMessageProvider: defaultParserErrorProvider, + nodeLocationTracking: "none", + traceInitPerf: false, + skipValidations: false + }); + DEFAULT_RULE_CONFIG = Object.freeze({ + recoveryValueFunc: /* @__PURE__ */ __name2(() => void 0, "recoveryValueFunc"), + resyncEnabled: true + }); + (function(ParserDefinitionErrorType2) { + ParserDefinitionErrorType2[ParserDefinitionErrorType2["INVALID_RULE_NAME"] = 0] = "INVALID_RULE_NAME"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["DUPLICATE_RULE_NAME"] = 1] = "DUPLICATE_RULE_NAME"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["INVALID_RULE_OVERRIDE"] = 2] = "INVALID_RULE_OVERRIDE"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["DUPLICATE_PRODUCTIONS"] = 3] = "DUPLICATE_PRODUCTIONS"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["UNRESOLVED_SUBRULE_REF"] = 4] = "UNRESOLVED_SUBRULE_REF"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["LEFT_RECURSION"] = 5] = "LEFT_RECURSION"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["NONE_LAST_EMPTY_ALT"] = 6] = "NONE_LAST_EMPTY_ALT"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["AMBIGUOUS_ALTS"] = 7] = "AMBIGUOUS_ALTS"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["CONFLICT_TOKENS_RULES_NAMESPACE"] = 8] = "CONFLICT_TOKENS_RULES_NAMESPACE"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["INVALID_TOKEN_NAME"] = 9] = "INVALID_TOKEN_NAME"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["NO_NON_EMPTY_LOOKAHEAD"] = 10] = "NO_NON_EMPTY_LOOKAHEAD"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["AMBIGUOUS_PREFIX_ALTS"] = 11] = "AMBIGUOUS_PREFIX_ALTS"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["TOO_MANY_ALTS"] = 12] = "TOO_MANY_ALTS"; + ParserDefinitionErrorType2[ParserDefinitionErrorType2["CUSTOM_LOOKAHEAD_VALIDATION"] = 13] = "CUSTOM_LOOKAHEAD_VALIDATION"; + })(ParserDefinitionErrorType || (ParserDefinitionErrorType = {})); + __name(EMPTY_ALT, "EMPTY_ALT"); + __name2(EMPTY_ALT, "EMPTY_ALT"); + Parser2 = class _Parser { + static { + __name(this, "_Parser"); + } + static { + __name2(this, "Parser"); + } + /** + * @deprecated use the **instance** method with the same name instead + */ + static performSelfAnalysis(parserInstance) { + throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead."); + } + performSelfAnalysis() { + this.TRACE_INIT("performSelfAnalysis", () => { + let defErrorsMsgs; + this.selfAnalysisDone = true; + const className = this.className; + this.TRACE_INIT("toFastProps", () => { + toFastProperties(this); + }); + this.TRACE_INIT("Grammar Recording", () => { + try { + this.enableRecording(); + forEach_default2(this.definedRulesNames, (currRuleName) => { + const wrappedRule = this[currRuleName]; + const originalGrammarAction = wrappedRule["originalGrammarAction"]; + let recordedRuleGast; + this.TRACE_INIT(`${currRuleName} Rule`, () => { + recordedRuleGast = this.topLevelRuleRecord(currRuleName, originalGrammarAction); + }); + this.gastProductionsCache[currRuleName] = recordedRuleGast; + }); + } finally { + this.disableRecording(); + } + }); + let resolverErrors = []; + this.TRACE_INIT("Grammar Resolving", () => { + resolverErrors = resolveGrammar2({ + rules: values_default2(this.gastProductionsCache) + }); + this.definitionErrors = this.definitionErrors.concat(resolverErrors); + }); + this.TRACE_INIT("Grammar Validations", () => { + if (isEmpty_default2(resolverErrors) && this.skipValidations === false) { + const validationErrors = validateGrammar2({ + rules: values_default2(this.gastProductionsCache), + tokenTypes: values_default2(this.tokensMap), + errMsgProvider: defaultGrammarValidatorErrorProvider, + grammarName: className + }); + const lookaheadValidationErrors = validateLookahead({ + lookaheadStrategy: this.lookaheadStrategy, + rules: values_default2(this.gastProductionsCache), + tokenTypes: values_default2(this.tokensMap), + grammarName: className + }); + this.definitionErrors = this.definitionErrors.concat(validationErrors, lookaheadValidationErrors); + } + }); + if (isEmpty_default2(this.definitionErrors)) { + if (this.recoveryEnabled) { + this.TRACE_INIT("computeAllProdsFollows", () => { + const allFollows = computeAllProdsFollows(values_default2(this.gastProductionsCache)); + this.resyncFollows = allFollows; + }); + } + this.TRACE_INIT("ComputeLookaheadFunctions", () => { + var _a, _b; + (_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, { + rules: values_default2(this.gastProductionsCache) + }); + this.preComputeLookaheadFunctions(values_default2(this.gastProductionsCache)); + }); + } + if (!_Parser.DEFER_DEFINITION_ERRORS_HANDLING && !isEmpty_default2(this.definitionErrors)) { + defErrorsMsgs = map_default2(this.definitionErrors, (defError) => defError.message); + throw new Error(`Parser Definition Errors detected: + ${defErrorsMsgs.join("\n-------------------------------\n")}`); + } + }); + } + constructor(tokenVocabulary, config5) { + this.definitionErrors = []; + this.selfAnalysisDone = false; + const that = this; + that.initErrorHandler(config5); + that.initLexerAdapter(); + that.initLooksAhead(config5); + that.initRecognizerEngine(tokenVocabulary, config5); + that.initRecoverable(config5); + that.initTreeBuilder(config5); + that.initContentAssist(); + that.initGastRecorder(config5); + that.initPerformanceTracer(config5); + if (has_default2(config5, "ignoredIssues")) { + throw new Error("The IParserConfig property has been deprecated.\n Please use the flag on the relevant DSL method instead.\n See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n For further details."); + } + this.skipValidations = has_default2(config5, "skipValidations") ? config5.skipValidations : DEFAULT_PARSER_CONFIG.skipValidations; + } + }; + Parser2.DEFER_DEFINITION_ERRORS_HANDLING = false; + applyMixins(Parser2, [ + Recoverable, + LooksAhead, + TreeBuilder, + LexerAdapter, + RecognizerEngine, + RecognizerApi, + ErrorHandler, + ContentAssist, + GastRecorder, + PerformanceTracer + ]); + EmbeddedActionsParser = class extends Parser2 { + static { + __name(this, "EmbeddedActionsParser"); + } + static { + __name2(this, "EmbeddedActionsParser"); + } + constructor(tokenVocabulary, config5 = DEFAULT_PARSER_CONFIG) { + const configClone = clone_default3(config5); + configClone.outputCst = false; + super(tokenVocabulary, configClone); + } + }; + __name(arrayMap22, "arrayMap2"); + __name2(arrayMap22, "arrayMap"); + arrayMap_default22 = arrayMap22; + __name(listCacheClear22, "listCacheClear2"); + __name2(listCacheClear22, "listCacheClear"); + listCacheClear_default22 = listCacheClear22; + __name(eq22, "eq2"); + __name2(eq22, "eq"); + eq_default22 = eq22; + __name(assocIndexOf22, "assocIndexOf2"); + __name2(assocIndexOf22, "assocIndexOf"); + assocIndexOf_default22 = assocIndexOf22; + arrayProto22 = Array.prototype; + splice22 = arrayProto22.splice; + __name(listCacheDelete22, "listCacheDelete2"); + __name2(listCacheDelete22, "listCacheDelete"); + listCacheDelete_default22 = listCacheDelete22; + __name(listCacheGet22, "listCacheGet2"); + __name2(listCacheGet22, "listCacheGet"); + listCacheGet_default22 = listCacheGet22; + __name(listCacheHas22, "listCacheHas2"); + __name2(listCacheHas22, "listCacheHas"); + listCacheHas_default22 = listCacheHas22; + __name(listCacheSet22, "listCacheSet2"); + __name2(listCacheSet22, "listCacheSet"); + listCacheSet_default22 = listCacheSet22; + __name(ListCache22, "ListCache2"); + __name2(ListCache22, "ListCache"); + ListCache22.prototype.clear = listCacheClear_default22; + ListCache22.prototype["delete"] = listCacheDelete_default22; + ListCache22.prototype.get = listCacheGet_default22; + ListCache22.prototype.has = listCacheHas_default22; + ListCache22.prototype.set = listCacheSet_default22; + ListCache_default22 = ListCache22; + __name(stackClear22, "stackClear2"); + __name2(stackClear22, "stackClear"); + stackClear_default22 = stackClear22; + __name(stackDelete22, "stackDelete2"); + __name2(stackDelete22, "stackDelete"); + stackDelete_default22 = stackDelete22; + __name(stackGet22, "stackGet2"); + __name2(stackGet22, "stackGet"); + stackGet_default22 = stackGet22; + __name(stackHas22, "stackHas2"); + __name2(stackHas22, "stackHas"); + stackHas_default22 = stackHas22; + freeGlobal22 = typeof global == "object" && global && global.Object === Object && global; + freeGlobal_default22 = freeGlobal22; + freeSelf22 = typeof self == "object" && self && self.Object === Object && self; + root22 = freeGlobal_default22 || freeSelf22 || Function("return this")(); + root_default22 = root22; + Symbol3 = root_default22.Symbol; + Symbol_default22 = Symbol3; + objectProto21 = Object.prototype; + hasOwnProperty18 = objectProto21.hasOwnProperty; + nativeObjectToString32 = objectProto21.toString; + symToStringTag32 = Symbol_default22 ? Symbol_default22.toStringTag : void 0; + __name(getRawTag22, "getRawTag2"); + __name2(getRawTag22, "getRawTag"); + getRawTag_default22 = getRawTag22; + objectProto222 = Object.prototype; + nativeObjectToString4 = objectProto222.toString; + __name(objectToString22, "objectToString2"); + __name2(objectToString22, "objectToString"); + objectToString_default22 = objectToString22; + nullTag22 = "[object Null]"; + undefinedTag22 = "[object Undefined]"; + symToStringTag4 = Symbol_default22 ? Symbol_default22.toStringTag : void 0; + __name(baseGetTag22, "baseGetTag2"); + __name2(baseGetTag22, "baseGetTag"); + baseGetTag_default22 = baseGetTag22; + __name(isObject22, "isObject2"); + __name2(isObject22, "isObject"); + isObject_default22 = isObject22; + asyncTag22 = "[object AsyncFunction]"; + funcTag42 = "[object Function]"; + genTag32 = "[object GeneratorFunction]"; + proxyTag22 = "[object Proxy]"; + __name(isFunction22, "isFunction2"); + __name2(isFunction22, "isFunction"); + isFunction_default22 = isFunction22; + coreJsData22 = root_default22["__core-js_shared__"]; + coreJsData_default22 = coreJsData22; + maskSrcKey22 = (function() { + var uid = /[^.]+$/.exec(coreJsData_default22 && coreJsData_default22.keys && coreJsData_default22.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; + })(); + __name(isMasked22, "isMasked2"); + __name2(isMasked22, "isMasked"); + isMasked_default22 = isMasked22; + funcProto32 = Function.prototype; + funcToString32 = funcProto32.toString; + __name(toSource22, "toSource2"); + __name2(toSource22, "toSource"); + toSource_default22 = toSource22; + reRegExpChar22 = /[\\^$.*+?()[\]{}|]/g; + reIsHostCtor22 = /^\[object .+?Constructor\]$/; + funcProto42 = Function.prototype; + objectProto23 = Object.prototype; + funcToString42 = funcProto42.toString; + hasOwnProperty19 = objectProto23.hasOwnProperty; + reIsNative22 = RegExp( + "^" + funcToString42.call(hasOwnProperty19).replace(reRegExpChar22, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + __name(baseIsNative22, "baseIsNative2"); + __name2(baseIsNative22, "baseIsNative"); + baseIsNative_default22 = baseIsNative22; + __name(getValue22, "getValue2"); + __name2(getValue22, "getValue"); + getValue_default22 = getValue22; + __name(getNative22, "getNative2"); + __name2(getNative22, "getNative"); + getNative_default22 = getNative22; + Map3 = getNative_default22(root_default22, "Map"); + Map_default22 = Map3; + nativeCreate22 = getNative_default22(Object, "create"); + nativeCreate_default22 = nativeCreate22; + __name(hashClear22, "hashClear2"); + __name2(hashClear22, "hashClear"); + hashClear_default22 = hashClear22; + __name(hashDelete22, "hashDelete2"); + __name2(hashDelete22, "hashDelete"); + hashDelete_default22 = hashDelete22; + HASH_UNDEFINED42 = "__lodash_hash_undefined__"; + objectProto24 = Object.prototype; + hasOwnProperty20 = objectProto24.hasOwnProperty; + __name(hashGet22, "hashGet2"); + __name2(hashGet22, "hashGet"); + hashGet_default22 = hashGet22; + objectProto25 = Object.prototype; + hasOwnProperty21 = objectProto25.hasOwnProperty; + __name(hashHas22, "hashHas2"); + __name2(hashHas22, "hashHas"); + hashHas_default22 = hashHas22; + HASH_UNDEFINED5 = "__lodash_hash_undefined__"; + __name(hashSet22, "hashSet2"); + __name2(hashSet22, "hashSet"); + hashSet_default22 = hashSet22; + __name(Hash22, "Hash2"); + __name2(Hash22, "Hash"); + Hash22.prototype.clear = hashClear_default22; + Hash22.prototype["delete"] = hashDelete_default22; + Hash22.prototype.get = hashGet_default22; + Hash22.prototype.has = hashHas_default22; + Hash22.prototype.set = hashSet_default22; + Hash_default22 = Hash22; + __name(mapCacheClear22, "mapCacheClear2"); + __name2(mapCacheClear22, "mapCacheClear"); + mapCacheClear_default22 = mapCacheClear22; + __name(isKeyable22, "isKeyable2"); + __name2(isKeyable22, "isKeyable"); + isKeyable_default22 = isKeyable22; + __name(getMapData22, "getMapData2"); + __name2(getMapData22, "getMapData"); + getMapData_default22 = getMapData22; + __name(mapCacheDelete22, "mapCacheDelete2"); + __name2(mapCacheDelete22, "mapCacheDelete"); + mapCacheDelete_default22 = mapCacheDelete22; + __name(mapCacheGet22, "mapCacheGet2"); + __name2(mapCacheGet22, "mapCacheGet"); + mapCacheGet_default22 = mapCacheGet22; + __name(mapCacheHas22, "mapCacheHas2"); + __name2(mapCacheHas22, "mapCacheHas"); + mapCacheHas_default22 = mapCacheHas22; + __name(mapCacheSet22, "mapCacheSet2"); + __name2(mapCacheSet22, "mapCacheSet"); + mapCacheSet_default22 = mapCacheSet22; + __name(MapCache22, "MapCache2"); + __name2(MapCache22, "MapCache"); + MapCache22.prototype.clear = mapCacheClear_default22; + MapCache22.prototype["delete"] = mapCacheDelete_default22; + MapCache22.prototype.get = mapCacheGet_default22; + MapCache22.prototype.has = mapCacheHas_default22; + MapCache22.prototype.set = mapCacheSet_default22; + MapCache_default22 = MapCache22; + LARGE_ARRAY_SIZE4 = 200; + __name(stackSet22, "stackSet2"); + __name2(stackSet22, "stackSet"); + stackSet_default22 = stackSet22; + __name(Stack22, "Stack2"); + __name2(Stack22, "Stack"); + Stack22.prototype.clear = stackClear_default22; + Stack22.prototype["delete"] = stackDelete_default22; + Stack22.prototype.get = stackGet_default22; + Stack22.prototype.has = stackHas_default22; + Stack22.prototype.set = stackSet_default22; + Stack_default22 = Stack22; + HASH_UNDEFINED6 = "__lodash_hash_undefined__"; + __name(setCacheAdd22, "setCacheAdd2"); + __name2(setCacheAdd22, "setCacheAdd"); + setCacheAdd_default22 = setCacheAdd22; + __name(setCacheHas22, "setCacheHas2"); + __name2(setCacheHas22, "setCacheHas"); + setCacheHas_default22 = setCacheHas22; + __name(SetCache22, "SetCache2"); + __name2(SetCache22, "SetCache"); + SetCache22.prototype.add = SetCache22.prototype.push = setCacheAdd_default22; + SetCache22.prototype.has = setCacheHas_default22; + SetCache_default22 = SetCache22; + __name(arraySome22, "arraySome2"); + __name2(arraySome22, "arraySome"); + arraySome_default22 = arraySome22; + __name(cacheHas22, "cacheHas2"); + __name2(cacheHas22, "cacheHas"); + cacheHas_default22 = cacheHas22; + COMPARE_PARTIAL_FLAG72 = 1; + COMPARE_UNORDERED_FLAG52 = 2; + __name(equalArrays22, "equalArrays2"); + __name2(equalArrays22, "equalArrays"); + equalArrays_default22 = equalArrays22; + Uint8Array3 = root_default22.Uint8Array; + Uint8Array_default22 = Uint8Array3; + __name(mapToArray22, "mapToArray2"); + __name2(mapToArray22, "mapToArray"); + mapToArray_default22 = mapToArray22; + __name(setToArray22, "setToArray2"); + __name2(setToArray22, "setToArray"); + setToArray_default22 = setToArray22; + COMPARE_PARTIAL_FLAG8 = 1; + COMPARE_UNORDERED_FLAG6 = 2; + boolTag52 = "[object Boolean]"; + dateTag52 = "[object Date]"; + errorTag42 = "[object Error]"; + mapTag82 = "[object Map]"; + numberTag52 = "[object Number]"; + regexpTag62 = "[object RegExp]"; + setTag82 = "[object Set]"; + stringTag62 = "[object String]"; + symbolTag52 = "[object Symbol]"; + arrayBufferTag52 = "[object ArrayBuffer]"; + dataViewTag62 = "[object DataView]"; + symbolProto42 = Symbol_default22 ? Symbol_default22.prototype : void 0; + symbolValueOf32 = symbolProto42 ? symbolProto42.valueOf : void 0; + __name(equalByTag22, "equalByTag2"); + __name2(equalByTag22, "equalByTag"); + equalByTag_default22 = equalByTag22; + __name(arrayPush22, "arrayPush2"); + __name2(arrayPush22, "arrayPush"); + arrayPush_default22 = arrayPush22; + isArray22 = Array.isArray; + isArray_default22 = isArray22; + __name(baseGetAllKeys22, "baseGetAllKeys2"); + __name2(baseGetAllKeys22, "baseGetAllKeys"); + baseGetAllKeys_default22 = baseGetAllKeys22; + __name(arrayFilter22, "arrayFilter2"); + __name2(arrayFilter22, "arrayFilter"); + arrayFilter_default22 = arrayFilter22; + __name(stubArray22, "stubArray2"); + __name2(stubArray22, "stubArray"); + stubArray_default22 = stubArray22; + objectProto26 = Object.prototype; + propertyIsEnumerable32 = objectProto26.propertyIsEnumerable; + nativeGetSymbols32 = Object.getOwnPropertySymbols; + getSymbols22 = !nativeGetSymbols32 ? stubArray_default22 : function(object3) { + if (object3 == null) { + return []; + } + object3 = Object(object3); + return arrayFilter_default22(nativeGetSymbols32(object3), function(symbol) { + return propertyIsEnumerable32.call(object3, symbol); + }); + }; + getSymbols_default22 = getSymbols22; + __name(baseTimes22, "baseTimes2"); + __name2(baseTimes22, "baseTimes"); + baseTimes_default22 = baseTimes22; + __name(isObjectLike22, "isObjectLike2"); + __name2(isObjectLike22, "isObjectLike"); + isObjectLike_default22 = isObjectLike22; + argsTag52 = "[object Arguments]"; + __name(baseIsArguments22, "baseIsArguments2"); + __name2(baseIsArguments22, "baseIsArguments"); + baseIsArguments_default22 = baseIsArguments22; + objectProto27 = Object.prototype; + hasOwnProperty222 = objectProto27.hasOwnProperty; + propertyIsEnumerable4 = objectProto27.propertyIsEnumerable; + isArguments22 = baseIsArguments_default22(/* @__PURE__ */ (function() { + return arguments; + })()) ? baseIsArguments_default22 : function(value2) { + return isObjectLike_default22(value2) && hasOwnProperty222.call(value2, "callee") && !propertyIsEnumerable4.call(value2, "callee"); + }; + isArguments_default22 = isArguments22; + __name(stubFalse22, "stubFalse2"); + __name2(stubFalse22, "stubFalse"); + stubFalse_default22 = stubFalse22; + freeExports42 = typeof exports == "object" && exports && !exports.nodeType && exports; + freeModule42 = freeExports42 && typeof module == "object" && module && !module.nodeType && module; + moduleExports42 = freeModule42 && freeModule42.exports === freeExports42; + Buffer4 = moduleExports42 ? root_default22.Buffer : void 0; + nativeIsBuffer22 = Buffer4 ? Buffer4.isBuffer : void 0; + isBuffer22 = nativeIsBuffer22 || stubFalse_default22; + isBuffer_default22 = isBuffer22; + MAX_SAFE_INTEGER32 = 9007199254740991; + reIsUint22 = /^(?:0|[1-9]\d*)$/; + __name(isIndex22, "isIndex2"); + __name2(isIndex22, "isIndex"); + isIndex_default22 = isIndex22; + MAX_SAFE_INTEGER4 = 9007199254740991; + __name(isLength22, "isLength2"); + __name2(isLength22, "isLength"); + isLength_default22 = isLength22; + argsTag6 = "[object Arguments]"; + arrayTag42 = "[object Array]"; + boolTag6 = "[object Boolean]"; + dateTag62 = "[object Date]"; + errorTag5 = "[object Error]"; + funcTag5 = "[object Function]"; + mapTag92 = "[object Map]"; + numberTag62 = "[object Number]"; + objectTag52 = "[object Object]"; + regexpTag7 = "[object RegExp]"; + setTag92 = "[object Set]"; + stringTag72 = "[object String]"; + weakMapTag42 = "[object WeakMap]"; + arrayBufferTag62 = "[object ArrayBuffer]"; + dataViewTag72 = "[object DataView]"; + float32Tag42 = "[object Float32Array]"; + float64Tag42 = "[object Float64Array]"; + int8Tag42 = "[object Int8Array]"; + int16Tag42 = "[object Int16Array]"; + int32Tag42 = "[object Int32Array]"; + uint8Tag42 = "[object Uint8Array]"; + uint8ClampedTag42 = "[object Uint8ClampedArray]"; + uint16Tag42 = "[object Uint16Array]"; + uint32Tag42 = "[object Uint32Array]"; + typedArrayTags22 = {}; + typedArrayTags22[float32Tag42] = typedArrayTags22[float64Tag42] = typedArrayTags22[int8Tag42] = typedArrayTags22[int16Tag42] = typedArrayTags22[int32Tag42] = typedArrayTags22[uint8Tag42] = typedArrayTags22[uint8ClampedTag42] = typedArrayTags22[uint16Tag42] = typedArrayTags22[uint32Tag42] = true; + typedArrayTags22[argsTag6] = typedArrayTags22[arrayTag42] = typedArrayTags22[arrayBufferTag62] = typedArrayTags22[boolTag6] = typedArrayTags22[dataViewTag72] = typedArrayTags22[dateTag62] = typedArrayTags22[errorTag5] = typedArrayTags22[funcTag5] = typedArrayTags22[mapTag92] = typedArrayTags22[numberTag62] = typedArrayTags22[objectTag52] = typedArrayTags22[regexpTag7] = typedArrayTags22[setTag92] = typedArrayTags22[stringTag72] = typedArrayTags22[weakMapTag42] = false; + __name(baseIsTypedArray22, "baseIsTypedArray2"); + __name2(baseIsTypedArray22, "baseIsTypedArray"); + baseIsTypedArray_default22 = baseIsTypedArray22; + __name(baseUnary22, "baseUnary2"); + __name2(baseUnary22, "baseUnary"); + baseUnary_default22 = baseUnary22; + freeExports5 = typeof exports == "object" && exports && !exports.nodeType && exports; + freeModule5 = freeExports5 && typeof module == "object" && module && !module.nodeType && module; + moduleExports5 = freeModule5 && freeModule5.exports === freeExports5; + freeProcess22 = moduleExports5 && freeGlobal_default22.process; + nodeUtil22 = (function() { + try { + var types = freeModule5 && freeModule5.require && freeModule5.require("util").types; + if (types) { + return types; + } + return freeProcess22 && freeProcess22.binding && freeProcess22.binding("util"); + } catch (e3) { + } + })(); + nodeUtil_default22 = nodeUtil22; + nodeIsTypedArray22 = nodeUtil_default22 && nodeUtil_default22.isTypedArray; + isTypedArray22 = nodeIsTypedArray22 ? baseUnary_default22(nodeIsTypedArray22) : baseIsTypedArray_default22; + isTypedArray_default22 = isTypedArray22; + objectProto28 = Object.prototype; + hasOwnProperty23 = objectProto28.hasOwnProperty; + __name(arrayLikeKeys22, "arrayLikeKeys2"); + __name2(arrayLikeKeys22, "arrayLikeKeys"); + arrayLikeKeys_default22 = arrayLikeKeys22; + objectProto29 = Object.prototype; + __name(isPrototype22, "isPrototype2"); + __name2(isPrototype22, "isPrototype"); + isPrototype_default22 = isPrototype22; + __name(overArg22, "overArg2"); + __name2(overArg22, "overArg"); + overArg_default22 = overArg22; + nativeKeys22 = overArg_default22(Object.keys, Object); + nativeKeys_default22 = nativeKeys22; + objectProto30 = Object.prototype; + hasOwnProperty24 = objectProto30.hasOwnProperty; + __name(baseKeys22, "baseKeys2"); + __name2(baseKeys22, "baseKeys"); + baseKeys_default22 = baseKeys22; + __name(isArrayLike22, "isArrayLike2"); + __name2(isArrayLike22, "isArrayLike"); + isArrayLike_default22 = isArrayLike22; + __name(keys22, "keys2"); + __name2(keys22, "keys"); + keys_default22 = keys22; + __name(getAllKeys22, "getAllKeys2"); + __name2(getAllKeys22, "getAllKeys"); + getAllKeys_default22 = getAllKeys22; + COMPARE_PARTIAL_FLAG9 = 1; + objectProto31 = Object.prototype; + hasOwnProperty25 = objectProto31.hasOwnProperty; + __name(equalObjects22, "equalObjects2"); + __name2(equalObjects22, "equalObjects"); + equalObjects_default22 = equalObjects22; + DataView22 = getNative_default22(root_default22, "DataView"); + DataView_default22 = DataView22; + Promise3 = getNative_default22(root_default22, "Promise"); + Promise_default22 = Promise3; + Set3 = getNative_default22(root_default22, "Set"); + Set_default22 = Set3; + WeakMap22 = getNative_default22(root_default22, "WeakMap"); + WeakMap_default22 = WeakMap22; + mapTag102 = "[object Map]"; + objectTag62 = "[object Object]"; + promiseTag22 = "[object Promise]"; + setTag102 = "[object Set]"; + weakMapTag5 = "[object WeakMap]"; + dataViewTag8 = "[object DataView]"; + dataViewCtorString22 = toSource_default22(DataView_default22); + mapCtorString22 = toSource_default22(Map_default22); + promiseCtorString22 = toSource_default22(Promise_default22); + setCtorString22 = toSource_default22(Set_default22); + weakMapCtorString22 = toSource_default22(WeakMap_default22); + getTag22 = baseGetTag_default22; + if (DataView_default22 && getTag22(new DataView_default22(new ArrayBuffer(1))) != dataViewTag8 || Map_default22 && getTag22(new Map_default22()) != mapTag102 || Promise_default22 && getTag22(Promise_default22.resolve()) != promiseTag22 || Set_default22 && getTag22(new Set_default22()) != setTag102 || WeakMap_default22 && getTag22(new WeakMap_default22()) != weakMapTag5) { + getTag22 = /* @__PURE__ */ __name2(function(value2) { + var result = baseGetTag_default22(value2), Ctor = result == objectTag62 ? value2.constructor : void 0, ctorString = Ctor ? toSource_default22(Ctor) : ""; + if (ctorString) { + switch (ctorString) { + case dataViewCtorString22: + return dataViewTag8; + case mapCtorString22: + return mapTag102; + case promiseCtorString22: + return promiseTag22; + case setCtorString22: + return setTag102; + case weakMapCtorString22: + return weakMapTag5; + } + } + return result; + }, "getTag"); + } + getTag_default22 = getTag22; + COMPARE_PARTIAL_FLAG10 = 1; + argsTag7 = "[object Arguments]"; + arrayTag52 = "[object Array]"; + objectTag72 = "[object Object]"; + objectProto322 = Object.prototype; + hasOwnProperty26 = objectProto322.hasOwnProperty; + __name(baseIsEqualDeep22, "baseIsEqualDeep2"); + __name2(baseIsEqualDeep22, "baseIsEqualDeep"); + baseIsEqualDeep_default22 = baseIsEqualDeep22; + __name(baseIsEqual22, "baseIsEqual2"); + __name2(baseIsEqual22, "baseIsEqual"); + baseIsEqual_default22 = baseIsEqual22; + COMPARE_PARTIAL_FLAG11 = 1; + COMPARE_UNORDERED_FLAG7 = 2; + __name(baseIsMatch22, "baseIsMatch2"); + __name2(baseIsMatch22, "baseIsMatch"); + baseIsMatch_default22 = baseIsMatch22; + __name(isStrictComparable22, "isStrictComparable2"); + __name2(isStrictComparable22, "isStrictComparable"); + isStrictComparable_default22 = isStrictComparable22; + __name(getMatchData22, "getMatchData2"); + __name2(getMatchData22, "getMatchData"); + getMatchData_default22 = getMatchData22; + __name(matchesStrictComparable22, "matchesStrictComparable2"); + __name2(matchesStrictComparable22, "matchesStrictComparable"); + matchesStrictComparable_default22 = matchesStrictComparable22; + __name(baseMatches22, "baseMatches2"); + __name2(baseMatches22, "baseMatches"); + baseMatches_default22 = baseMatches22; + symbolTag62 = "[object Symbol]"; + __name(isSymbol22, "isSymbol2"); + __name2(isSymbol22, "isSymbol"); + isSymbol_default22 = isSymbol22; + reIsDeepProp22 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; + reIsPlainProp22 = /^\w*$/; + __name(isKey22, "isKey2"); + __name2(isKey22, "isKey"); + isKey_default22 = isKey22; + FUNC_ERROR_TEXT3 = "Expected a function"; + __name(memoize22, "memoize2"); + __name2(memoize22, "memoize"); + memoize22.Cache = MapCache_default22; + memoize_default22 = memoize22; + MAX_MEMOIZE_SIZE22 = 500; + __name(memoizeCapped22, "memoizeCapped2"); + __name2(memoizeCapped22, "memoizeCapped"); + memoizeCapped_default22 = memoizeCapped22; + rePropName22 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; + reEscapeChar22 = /\\(\\)?/g; + stringToPath22 = memoizeCapped_default22(function(string3) { + var result = []; + if (string3.charCodeAt(0) === 46) { + result.push(""); + } + string3.replace(rePropName22, function(match3, number7, quote, subString) { + result.push(quote ? subString.replace(reEscapeChar22, "$1") : number7 || match3); + }); + return result; + }); + stringToPath_default22 = stringToPath22; + INFINITY52 = 1 / 0; + symbolProto5 = Symbol_default22 ? Symbol_default22.prototype : void 0; + symbolToString22 = symbolProto5 ? symbolProto5.toString : void 0; + __name(baseToString22, "baseToString2"); + __name2(baseToString22, "baseToString"); + baseToString_default22 = baseToString22; + __name(toString32, "toString3"); + __name2(toString32, "toString"); + toString_default22 = toString32; + __name(castPath22, "castPath2"); + __name2(castPath22, "castPath"); + castPath_default22 = castPath22; + INFINITY6 = 1 / 0; + __name(toKey22, "toKey2"); + __name2(toKey22, "toKey"); + toKey_default22 = toKey22; + __name(baseGet22, "baseGet2"); + __name2(baseGet22, "baseGet"); + baseGet_default22 = baseGet22; + __name(get22, "get2"); + __name2(get22, "get"); + get_default22 = get22; + __name(baseHasIn22, "baseHasIn2"); + __name2(baseHasIn22, "baseHasIn"); + baseHasIn_default22 = baseHasIn22; + __name(hasPath22, "hasPath2"); + __name2(hasPath22, "hasPath"); + hasPath_default22 = hasPath22; + __name(hasIn22, "hasIn2"); + __name2(hasIn22, "hasIn"); + hasIn_default22 = hasIn22; + COMPARE_PARTIAL_FLAG12 = 1; + COMPARE_UNORDERED_FLAG8 = 2; + __name(baseMatchesProperty22, "baseMatchesProperty2"); + __name2(baseMatchesProperty22, "baseMatchesProperty"); + baseMatchesProperty_default22 = baseMatchesProperty22; + __name(identity22, "identity2"); + __name2(identity22, "identity"); + identity_default22 = identity22; + __name(baseProperty22, "baseProperty2"); + __name2(baseProperty22, "baseProperty"); + baseProperty_default22 = baseProperty22; + __name(basePropertyDeep22, "basePropertyDeep2"); + __name2(basePropertyDeep22, "basePropertyDeep"); + basePropertyDeep_default22 = basePropertyDeep22; + __name(property22, "property2"); + __name2(property22, "property"); + property_default22 = property22; + __name(baseIteratee22, "baseIteratee2"); + __name2(baseIteratee22, "baseIteratee"); + baseIteratee_default22 = baseIteratee22; + __name(createBaseFor22, "createBaseFor2"); + __name2(createBaseFor22, "createBaseFor"); + createBaseFor_default22 = createBaseFor22; + baseFor22 = createBaseFor_default22(); + baseFor_default22 = baseFor22; + __name(baseForOwn22, "baseForOwn2"); + __name2(baseForOwn22, "baseForOwn"); + baseForOwn_default22 = baseForOwn22; + __name(createBaseEach22, "createBaseEach2"); + __name2(createBaseEach22, "createBaseEach"); + createBaseEach_default22 = createBaseEach22; + baseEach22 = createBaseEach_default22(baseForOwn_default22); + baseEach_default22 = baseEach22; + __name(baseMap22, "baseMap2"); + __name2(baseMap22, "baseMap"); + baseMap_default22 = baseMap22; + __name(map22, "map2"); + __name2(map22, "map"); + map_default22 = map22; + __name(baseFilter22, "baseFilter2"); + __name2(baseFilter22, "baseFilter"); + baseFilter_default22 = baseFilter22; + __name(filter22, "filter2"); + __name2(filter22, "filter"); + filter_default22 = filter22; + __name(buildATNKey, "buildATNKey"); + __name2(buildATNKey, "buildATNKey"); + ATN_BASIC = 1; + ATN_RULE_START = 2; + ATN_PLUS_BLOCK_START = 4; + ATN_STAR_BLOCK_START = 5; + ATN_RULE_STOP = 7; + ATN_BLOCK_END = 8; + ATN_STAR_LOOP_BACK = 9; + ATN_STAR_LOOP_ENTRY = 10; + ATN_PLUS_LOOP_BACK = 11; + ATN_LOOP_END = 12; + AbstractTransition = class { + static { + __name(this, "AbstractTransition"); + } + static { + __name2(this, "AbstractTransition"); + } + constructor(target) { + this.target = target; + } + isEpsilon() { + return false; + } + }; + AtomTransition = class extends AbstractTransition { + static { + __name(this, "AtomTransition"); + } + static { + __name2(this, "AtomTransition"); + } + constructor(target, tokenType) { + super(target); + this.tokenType = tokenType; + } + }; + EpsilonTransition = class extends AbstractTransition { + static { + __name(this, "EpsilonTransition"); + } + static { + __name2(this, "EpsilonTransition"); + } + constructor(target) { + super(target); + } + isEpsilon() { + return true; + } + }; + RuleTransition = class extends AbstractTransition { + static { + __name(this, "RuleTransition"); + } + static { + __name2(this, "RuleTransition"); + } + constructor(ruleStart, rule, followState) { + super(ruleStart); + this.rule = rule; + this.followState = followState; + } + isEpsilon() { + return true; + } + }; + __name(createATN, "createATN"); + __name2(createATN, "createATN"); + __name(createRuleStartAndStopATNStates, "createRuleStartAndStopATNStates"); + __name2(createRuleStartAndStopATNStates, "createRuleStartAndStopATNStates"); + __name(atom, "atom"); + __name2(atom, "atom"); + __name(repetition, "repetition"); + __name2(repetition, "repetition"); + __name(repetitionSep, "repetitionSep"); + __name2(repetitionSep, "repetitionSep"); + __name(repetitionMandatory, "repetitionMandatory"); + __name2(repetitionMandatory, "repetitionMandatory"); + __name(repetitionMandatorySep, "repetitionMandatorySep"); + __name2(repetitionMandatorySep, "repetitionMandatorySep"); + __name(alternation, "alternation"); + __name2(alternation, "alternation"); + __name(option, "option"); + __name2(option, "option"); + __name(block, "block"); + __name2(block, "block"); + __name(plus, "plus"); + __name2(plus, "plus"); + __name(star, "star"); + __name2(star, "star"); + __name(optional, "optional"); + __name2(optional, "optional"); + __name(defineDecisionState, "defineDecisionState"); + __name2(defineDecisionState, "defineDecisionState"); + __name(makeAlts, "makeAlts"); + __name2(makeAlts, "makeAlts"); + __name(getProdType2, "getProdType2"); + __name2(getProdType2, "getProdType"); + __name(makeBlock, "makeBlock"); + __name2(makeBlock, "makeBlock"); + __name(tokenRef, "tokenRef"); + __name2(tokenRef, "tokenRef"); + __name(ruleRef, "ruleRef"); + __name2(ruleRef, "ruleRef"); + __name(buildRuleHandle, "buildRuleHandle"); + __name2(buildRuleHandle, "buildRuleHandle"); + __name(epsilon4, "epsilon"); + __name2(epsilon4, "epsilon"); + __name(newState, "newState"); + __name2(newState, "newState"); + __name(addTransition, "addTransition"); + __name2(addTransition, "addTransition"); + __name(removeState, "removeState"); + __name2(removeState, "removeState"); + DFA_ERROR = {}; + ATNConfigSet = class { + static { + __name(this, "ATNConfigSet"); + } + static { + __name2(this, "ATNConfigSet"); + } + constructor() { + this.map = {}; + this.configs = []; + } + get size() { + return this.configs.length; + } + finalize() { + this.map = {}; + } + add(config5) { + const key = getATNConfigKey(config5); + if (!(key in this.map)) { + this.map[key] = this.configs.length; + this.configs.push(config5); + } + } + get elements() { + return this.configs; + } + get alts() { + return map_default22(this.configs, (e3) => e3.alt); + } + get key() { + let value2 = ""; + for (const k2 in this.map) { + value2 += k2 + ":"; + } + return value2; + } + }; + __name(getATNConfigKey, "getATNConfigKey"); + __name2(getATNConfigKey, "getATNConfigKey"); + __name(baseExtremum2, "baseExtremum"); + __name2(baseExtremum2, "baseExtremum"); + baseExtremum_default2 = baseExtremum2; + __name(baseLt2, "baseLt"); + __name2(baseLt2, "baseLt"); + baseLt_default2 = baseLt2; + __name(min8, "min"); + __name2(min8, "min"); + min_default2 = min8; + spreadableSymbol22 = Symbol_default22 ? Symbol_default22.isConcatSpreadable : void 0; + __name(isFlattenable22, "isFlattenable2"); + __name2(isFlattenable22, "isFlattenable"); + isFlattenable_default22 = isFlattenable22; + __name(baseFlatten22, "baseFlatten2"); + __name2(baseFlatten22, "baseFlatten"); + baseFlatten_default22 = baseFlatten22; + __name(flatMap2, "flatMap2"); + __name2(flatMap2, "flatMap"); + flatMap_default2 = flatMap2; + __name(baseFindIndex22, "baseFindIndex2"); + __name2(baseFindIndex22, "baseFindIndex"); + baseFindIndex_default22 = baseFindIndex22; + __name(baseIsNaN22, "baseIsNaN2"); + __name2(baseIsNaN22, "baseIsNaN"); + baseIsNaN_default22 = baseIsNaN22; + __name(strictIndexOf22, "strictIndexOf2"); + __name2(strictIndexOf22, "strictIndexOf"); + strictIndexOf_default22 = strictIndexOf22; + __name(baseIndexOf22, "baseIndexOf2"); + __name2(baseIndexOf22, "baseIndexOf"); + baseIndexOf_default22 = baseIndexOf22; + __name(arrayIncludes22, "arrayIncludes2"); + __name2(arrayIncludes22, "arrayIncludes"); + arrayIncludes_default22 = arrayIncludes22; + __name(arrayIncludesWith22, "arrayIncludesWith2"); + __name2(arrayIncludesWith22, "arrayIncludesWith"); + arrayIncludesWith_default22 = arrayIncludesWith22; + __name(noop22, "noop2"); + __name2(noop22, "noop"); + noop_default22 = noop22; + INFINITY7 = 1 / 0; + createSet22 = !(Set_default22 && 1 / setToArray_default22(new Set_default22([, -0]))[1] == INFINITY7) ? noop_default22 : function(values22) { + return new Set_default22(values22); + }; + createSet_default22 = createSet22; + LARGE_ARRAY_SIZE5 = 200; + __name(baseUniq22, "baseUniq2"); + __name2(baseUniq22, "baseUniq"); + baseUniq_default22 = baseUniq22; + __name(uniqBy, "uniqBy"); + __name2(uniqBy, "uniqBy"); + uniqBy_default = uniqBy; + __name(flatten22, "flatten2"); + __name2(flatten22, "flatten"); + flatten_default22 = flatten22; + __name(arrayEach22, "arrayEach2"); + __name2(arrayEach22, "arrayEach"); + arrayEach_default22 = arrayEach22; + __name(castFunction22, "castFunction2"); + __name2(castFunction22, "castFunction"); + castFunction_default22 = castFunction22; + __name(forEach22, "forEach2"); + __name2(forEach22, "forEach"); + forEach_default22 = forEach22; + mapTag11 = "[object Map]"; + setTag11 = "[object Set]"; + objectProto33 = Object.prototype; + hasOwnProperty27 = objectProto33.hasOwnProperty; + __name(isEmpty22, "isEmpty2"); + __name2(isEmpty22, "isEmpty"); + isEmpty_default22 = isEmpty22; + __name(arrayReduce22, "arrayReduce2"); + __name2(arrayReduce22, "arrayReduce"); + arrayReduce_default22 = arrayReduce22; + __name(baseReduce22, "baseReduce2"); + __name2(baseReduce22, "baseReduce"); + baseReduce_default22 = baseReduce22; + __name(reduce22, "reduce2"); + __name2(reduce22, "reduce"); + reduce_default22 = reduce22; + __name(createDFACache, "createDFACache"); + __name2(createDFACache, "createDFACache"); + PredicateSet = class { + static { + __name(this, "PredicateSet"); + } + static { + __name2(this, "PredicateSet"); + } + constructor() { + this.predicates = []; + } + is(index) { + return index >= this.predicates.length || this.predicates[index]; + } + set(index, value2) { + this.predicates[index] = value2; + } + toString() { + let value2 = ""; + const size4 = this.predicates.length; + for (let i2 = 0; i2 < size4; i2++) { + value2 += this.predicates[i2] === true ? "1" : "0"; + } + return value2; + } + }; + EMPTY_PREDICATES = new PredicateSet(); + LLStarLookaheadStrategy = class extends LLkLookaheadStrategy { + static { + __name(this, "LLStarLookaheadStrategy"); + } + static { + __name2(this, "LLStarLookaheadStrategy"); + } + constructor(options2) { + var _a; + super(); + this.logging = (_a = options2 === null || options2 === void 0 ? void 0 : options2.logging) !== null && _a !== void 0 ? _a : ((message) => console.log(message)); + } + initialize(options2) { + this.atn = createATN(options2.rules); + this.dfas = initATNSimulator(this.atn); + } + validateAmbiguousAlternationAlternatives() { + return []; + } + validateEmptyOrAlternatives() { + return []; + } + buildLookaheadForAlternation(options2) { + const { prodOccurrence, rule, hasPredicates, dynamicTokensEnabled } = options2; + const dfas = this.dfas; + const logging = this.logging; + const key = buildATNKey(rule, "Alternation", prodOccurrence); + const decisionState = this.atn.decisionMap[key]; + const decisionIndex = decisionState.decision; + const partialAlts = map_default22(getLookaheadPaths({ + maxLookahead: 1, + occurrence: prodOccurrence, + prodType: "Alternation", + rule + }), (currAlt) => map_default22(currAlt, (path4) => path4[0])); + if (isLL1Sequence(partialAlts, false) && !dynamicTokensEnabled) { + const choiceToAlt = reduce_default22(partialAlts, (result, currAlt, idx) => { + forEach_default22(currAlt, (currTokType) => { + if (currTokType) { + result[currTokType.tokenTypeIdx] = idx; + forEach_default22(currTokType.categoryMatches, (currExtendingType) => { + result[currExtendingType] = idx; + }); + } + }); + return result; + }, {}); + if (hasPredicates) { + return function(orAlts) { + var _a; + const nextToken = this.LA(1); + const prediction = choiceToAlt[nextToken.tokenTypeIdx]; + if (orAlts !== void 0 && prediction !== void 0) { + const gate = (_a = orAlts[prediction]) === null || _a === void 0 ? void 0 : _a.GATE; + if (gate !== void 0 && gate.call(this) === false) { + return void 0; + } + } + return prediction; + }; + } else { + return function() { + const nextToken = this.LA(1); + return choiceToAlt[nextToken.tokenTypeIdx]; + }; + } + } else if (hasPredicates) { + return function(orAlts) { + const predicates = new PredicateSet(); + const length2 = orAlts === void 0 ? 0 : orAlts.length; + for (let i2 = 0; i2 < length2; i2++) { + const gate = orAlts === null || orAlts === void 0 ? void 0 : orAlts[i2].GATE; + predicates.set(i2, gate === void 0 || gate.call(this)); + } + const result = adaptivePredict.call(this, dfas, decisionIndex, predicates, logging); + return typeof result === "number" ? result : void 0; + }; + } else { + return function() { + const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging); + return typeof result === "number" ? result : void 0; + }; + } + } + buildLookaheadForOptional(options2) { + const { prodOccurrence, rule, prodType, dynamicTokensEnabled } = options2; + const dfas = this.dfas; + const logging = this.logging; + const key = buildATNKey(rule, prodType, prodOccurrence); + const decisionState = this.atn.decisionMap[key]; + const decisionIndex = decisionState.decision; + const alts = map_default22(getLookaheadPaths({ + maxLookahead: 1, + occurrence: prodOccurrence, + prodType, + rule + }), (e3) => { + return map_default22(e3, (g2) => g2[0]); + }); + if (isLL1Sequence(alts) && alts[0][0] && !dynamicTokensEnabled) { + const alt = alts[0]; + const singleTokensTypes = flatten_default22(alt); + if (singleTokensTypes.length === 1 && isEmpty_default22(singleTokensTypes[0].categoryMatches)) { + const expectedTokenType = singleTokensTypes[0]; + const expectedTokenUniqueKey = expectedTokenType.tokenTypeIdx; + return function() { + return this.LA(1).tokenTypeIdx === expectedTokenUniqueKey; + }; + } else { + const choiceToAlt = reduce_default22(singleTokensTypes, (result, currTokType) => { + if (currTokType !== void 0) { + result[currTokType.tokenTypeIdx] = true; + forEach_default22(currTokType.categoryMatches, (currExtendingType) => { + result[currExtendingType] = true; + }); + } + return result; + }, {}); + return function() { + const nextToken = this.LA(1); + return choiceToAlt[nextToken.tokenTypeIdx] === true; + }; + } + } + return function() { + const result = adaptivePredict.call(this, dfas, decisionIndex, EMPTY_PREDICATES, logging); + return typeof result === "object" ? false : result === 0; + }; + } + }; + __name(isLL1Sequence, "isLL1Sequence"); + __name2(isLL1Sequence, "isLL1Sequence"); + __name(initATNSimulator, "initATNSimulator"); + __name2(initATNSimulator, "initATNSimulator"); + __name(adaptivePredict, "adaptivePredict"); + __name2(adaptivePredict, "adaptivePredict"); + __name(performLookahead, "performLookahead"); + __name2(performLookahead, "performLookahead"); + __name(computeLookaheadTarget, "computeLookaheadTarget"); + __name2(computeLookaheadTarget, "computeLookaheadTarget"); + __name(reportLookaheadAmbiguity, "reportLookaheadAmbiguity"); + __name2(reportLookaheadAmbiguity, "reportLookaheadAmbiguity"); + __name(buildAmbiguityError, "buildAmbiguityError"); + __name2(buildAmbiguityError, "buildAmbiguityError"); + __name(getProductionDslName2, "getProductionDslName2"); + __name2(getProductionDslName2, "getProductionDslName"); + __name(buildAdaptivePredictError, "buildAdaptivePredictError"); + __name2(buildAdaptivePredictError, "buildAdaptivePredictError"); + __name(getExistingTargetState, "getExistingTargetState"); + __name2(getExistingTargetState, "getExistingTargetState"); + __name(computeReachSet, "computeReachSet"); + __name2(computeReachSet, "computeReachSet"); + __name(getReachableTarget, "getReachableTarget"); + __name2(getReachableTarget, "getReachableTarget"); + __name(getUniqueAlt, "getUniqueAlt"); + __name2(getUniqueAlt, "getUniqueAlt"); + __name(newDFAState, "newDFAState"); + __name2(newDFAState, "newDFAState"); + __name(addDFAEdge, "addDFAEdge"); + __name2(addDFAEdge, "addDFAEdge"); + __name(addDFAState, "addDFAState"); + __name2(addDFAState, "addDFAState"); + __name(computeStartState, "computeStartState"); + __name2(computeStartState, "computeStartState"); + __name(closure, "closure"); + __name2(closure, "closure"); + __name(getEpsilonTarget, "getEpsilonTarget"); + __name2(getEpsilonTarget, "getEpsilonTarget"); + __name(hasConfigInRuleStopState, "hasConfigInRuleStopState"); + __name2(hasConfigInRuleStopState, "hasConfigInRuleStopState"); + __name(allConfigsInRuleStopStates, "allConfigsInRuleStopStates"); + __name2(allConfigsInRuleStopStates, "allConfigsInRuleStopStates"); + __name(hasConflictTerminatingPrediction, "hasConflictTerminatingPrediction"); + __name2(hasConflictTerminatingPrediction, "hasConflictTerminatingPrediction"); + __name(getConflictingAltSets, "getConflictingAltSets"); + __name2(getConflictingAltSets, "getConflictingAltSets"); + __name(hasConflictingAltSet, "hasConflictingAltSet"); + __name2(hasConflictingAltSet, "hasConflictingAltSet"); + __name(hasStateAssociatedWithOneAlt, "hasStateAssociatedWithOneAlt"); + __name2(hasStateAssociatedWithOneAlt, "hasStateAssociatedWithOneAlt"); + init_main(); + CstNodeBuilder = class { + static { + __name(this, "CstNodeBuilder"); + } + static { + __name2(this, "CstNodeBuilder"); + } + constructor() { + this.nodeStack = []; + } + get current() { + return this.nodeStack[this.nodeStack.length - 1] ?? this.rootNode; + } + buildRootNode(input) { + this.rootNode = new RootCstNodeImpl(input); + this.rootNode.root = this.rootNode; + this.nodeStack = [this.rootNode]; + return this.rootNode; + } + buildCompositeNode(feature) { + const compositeNode = new CompositeCstNodeImpl(); + compositeNode.grammarSource = feature; + compositeNode.root = this.rootNode; + this.current.content.push(compositeNode); + this.nodeStack.push(compositeNode); + return compositeNode; + } + buildLeafNode(token2, feature) { + const leafNode = new LeafCstNodeImpl(token2.startOffset, token2.image.length, tokenToRange(token2), token2.tokenType, !feature); + leafNode.grammarSource = feature; + leafNode.root = this.rootNode; + this.current.content.push(leafNode); + return leafNode; + } + removeNode(node2) { + const parent4 = node2.container; + if (parent4) { + const index = parent4.content.indexOf(node2); + if (index >= 0) { + parent4.content.splice(index, 1); + } + } + } + addHiddenNodes(tokens2) { + const nodes5 = []; + for (const token2 of tokens2) { + const leafNode = new LeafCstNodeImpl(token2.startOffset, token2.image.length, tokenToRange(token2), token2.tokenType, true); + leafNode.root = this.rootNode; + nodes5.push(leafNode); + } + let current = this.current; + let added = false; + if (current.content.length > 0) { + current.content.push(...nodes5); + return; + } + while (current.container) { + const index = current.container.content.indexOf(current); + if (index > 0) { + current.container.content.splice(index, 0, ...nodes5); + added = true; + break; + } + current = current.container; + } + if (!added) { + this.rootNode.content.unshift(...nodes5); + } + } + construct(item) { + const current = this.current; + if (typeof item.$type === "string" && !item.$infix) { + this.current.astNode = item; + } + item.$cstNode = current; + const node2 = this.nodeStack.pop(); + if (node2?.content.length === 0) { + this.removeNode(node2); + } + } + }; + AbstractCstNode = class { + static { + __name(this, "AbstractCstNode"); + } + static { + __name2(this, "AbstractCstNode"); + } + get hidden() { + return false; + } + get astNode() { + const node2 = typeof this._astNode?.$type === "string" ? this._astNode : this.container?.astNode; + if (!node2) { + throw new Error("This node has no associated AST element"); + } + return node2; + } + set astNode(value2) { + this._astNode = value2; + } + get text() { + return this.root.fullText.substring(this.offset, this.end); + } + }; + LeafCstNodeImpl = class extends AbstractCstNode { + static { + __name(this, "LeafCstNodeImpl"); + } + static { + __name2(this, "LeafCstNodeImpl"); + } + get offset() { + return this._offset; + } + get length() { + return this._length; + } + get end() { + return this._offset + this._length; + } + get hidden() { + return this._hidden; + } + get tokenType() { + return this._tokenType; + } + get range() { + return this._range; + } + constructor(offset, length2, range3, tokenType, hidden = false) { + super(); + this._hidden = hidden; + this._offset = offset; + this._tokenType = tokenType; + this._length = length2; + this._range = range3; + } + }; + CompositeCstNodeImpl = class extends AbstractCstNode { + static { + __name(this, "CompositeCstNodeImpl"); + } + static { + __name2(this, "CompositeCstNodeImpl"); + } + constructor() { + super(...arguments); + this.content = new CstNodeContainer(this); + } + get offset() { + return this.firstNonHiddenNode?.offset ?? 0; + } + get length() { + return this.end - this.offset; + } + get end() { + return this.lastNonHiddenNode?.end ?? 0; + } + get range() { + const firstNode = this.firstNonHiddenNode; + const lastNode = this.lastNonHiddenNode; + if (firstNode && lastNode) { + if (this._rangeCache === void 0) { + const { range: firstRange } = firstNode; + const { range: lastRange } = lastNode; + this._rangeCache = { start: firstRange.start, end: lastRange.end.line < firstRange.start.line ? firstRange.start : lastRange.end }; + } + return this._rangeCache; + } else { + return { start: Position.create(0, 0), end: Position.create(0, 0) }; + } + } + get firstNonHiddenNode() { + for (const child of this.content) { + if (!child.hidden) { + return child; + } + } + return this.content[0]; + } + get lastNonHiddenNode() { + for (let i2 = this.content.length - 1; i2 >= 0; i2--) { + const child = this.content[i2]; + if (!child.hidden) { + return child; + } + } + return this.content[this.content.length - 1]; + } + }; + CstNodeContainer = class _CstNodeContainer extends Array { + static { + __name(this, "_CstNodeContainer"); + } + static { + __name2(this, "CstNodeContainer"); + } + constructor(parent4) { + super(); + this.parent = parent4; + Object.setPrototypeOf(this, _CstNodeContainer.prototype); + } + push(...items) { + this.addParents(items); + return super.push(...items); + } + unshift(...items) { + this.addParents(items); + return super.unshift(...items); + } + splice(start3, count2, ...items) { + this.addParents(items); + return super.splice(start3, count2, ...items); + } + addParents(items) { + for (const item of items) { + item.container = this.parent; + } + } + }; + RootCstNodeImpl = class extends CompositeCstNodeImpl { + static { + __name(this, "RootCstNodeImpl"); + } + static { + __name2(this, "RootCstNodeImpl"); + } + get text() { + return this._text.substring(this.offset, this.end); + } + get fullText() { + return this._text; + } + constructor(input) { + super(); + this._text = ""; + this._text = input ?? ""; + } + }; + DatatypeSymbol = Symbol("Datatype"); + __name(isDataTypeNode, "isDataTypeNode"); + __name2(isDataTypeNode, "isDataTypeNode"); + ruleSuffix = "\u200B"; + withRuleSuffix = /* @__PURE__ */ __name2((name) => name.endsWith(ruleSuffix) ? name : name + ruleSuffix, "withRuleSuffix"); + AbstractLangiumParser = class { + static { + __name(this, "AbstractLangiumParser"); + } + static { + __name2(this, "AbstractLangiumParser"); + } + constructor(services) { + this._unorderedGroups = /* @__PURE__ */ new Map(); + this.allRules = /* @__PURE__ */ new Map(); + this.lexer = services.parser.Lexer; + const tokens2 = this.lexer.definition; + const production = services.LanguageMetaData.mode === "production"; + if (services.shared.profilers.LangiumProfiler?.isActive("parsing")) { + this.wrapper = new ProfilerWrapper(tokens2, { + ...services.parser.ParserConfig, + skipValidations: production, + errorMessageProvider: services.parser.ParserErrorMessageProvider + }, services.shared.profilers.LangiumProfiler.createTask("parsing", services.LanguageMetaData.languageId)); + } else { + this.wrapper = new ChevrotainWrapper(tokens2, { + ...services.parser.ParserConfig, + skipValidations: production, + errorMessageProvider: services.parser.ParserErrorMessageProvider + }); + } + } + alternatives(idx, choices) { + this.wrapper.wrapOr(idx, choices); + } + optional(idx, callback) { + this.wrapper.wrapOption(idx, callback); + } + many(idx, callback) { + this.wrapper.wrapMany(idx, callback); + } + atLeastOne(idx, callback) { + this.wrapper.wrapAtLeastOne(idx, callback); + } + getRule(name) { + return this.allRules.get(name); + } + isRecording() { + return this.wrapper.IS_RECORDING; + } + get unorderedGroups() { + return this._unorderedGroups; + } + getRuleStack() { + return this.wrapper.RULE_STACK; + } + finalize() { + this.wrapper.wrapSelfAnalysis(); + } + }; + LangiumParser = class extends AbstractLangiumParser { + static { + __name(this, "LangiumParser"); + } + static { + __name2(this, "LangiumParser"); + } + get current() { + return this.stack[this.stack.length - 1]; + } + constructor(services) { + super(services); + this.nodeBuilder = new CstNodeBuilder(); + this.stack = []; + this.assignmentMap = /* @__PURE__ */ new Map(); + this.operatorPrecedence = /* @__PURE__ */ new Map(); + this.linker = services.references.Linker; + this.converter = services.parser.ValueConverter; + this.astReflection = services.shared.AstReflection; + } + rule(rule, impl2) { + const type3 = this.computeRuleType(rule); + let infixName = void 0; + if (isInfixRule(rule)) { + infixName = rule.name; + this.registerPrecedenceMap(rule); + } + const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(type3, infixName, impl2).bind(this)); + this.allRules.set(rule.name, ruleMethod); + if (isParserRule(rule) && rule.entry) { + this.mainRule = ruleMethod; + } + return ruleMethod; + } + registerPrecedenceMap(rule) { + const name = rule.name; + const map32 = /* @__PURE__ */ new Map(); + for (let i2 = 0; i2 < rule.operators.precedences.length; i2++) { + const precedence = rule.operators.precedences[i2]; + for (const keyword of precedence.operators) { + map32.set(keyword.value, { + precedence: i2, + rightAssoc: precedence.associativity === "right" + }); + } + } + this.operatorPrecedence.set(name, map32); + } + computeRuleType(rule) { + if (isInfixRule(rule)) { + return getTypeName(rule); + } else if (rule.fragment) { + return void 0; + } else if (isDataTypeRule(rule)) { + return DatatypeSymbol; + } else { + return getTypeName(rule); + } + } + parse(input, options2 = {}) { + this.nodeBuilder.buildRootNode(input); + const lexerResult = this.lexerResult = this.lexer.tokenize(input); + this.wrapper.input = lexerResult.tokens; + const ruleMethod = options2.rule ? this.allRules.get(options2.rule) : this.mainRule; + if (!ruleMethod) { + throw new Error(options2.rule ? `No rule found with name '${options2.rule}'` : "No main rule available."); + } + const result = this.doParse(ruleMethod); + this.nodeBuilder.addHiddenNodes(lexerResult.hidden); + this.unorderedGroups.clear(); + this.lexerResult = void 0; + linkContentToContainer(result, { deep: true }); + return { + value: result, + lexerErrors: lexerResult.errors, + lexerReport: lexerResult.report, + parserErrors: this.wrapper.errors + }; + } + doParse(rule) { + let result = this.wrapper.rule(rule); + if (this.stack.length > 0) { + result = this.construct(); + } + if (result === void 0) { + throw new Error("No result from parser"); + } else if (this.stack.length > 0) { + throw new Error("Parser stack is not empty after parsing"); + } + return result; + } + startImplementation($type, infixName, implementation) { + return (args) => { + const createNode = !this.isRecording() && $type !== void 0; + if (createNode) { + const node2 = { $type }; + this.stack.push(node2); + if ($type === DatatypeSymbol) { + node2.value = ""; + } else if (infixName !== void 0) { + node2.$infixName = infixName; + } + } + implementation(args); + return createNode ? this.construct() : void 0; + }; + } + extractHiddenTokens(token2) { + const hiddenTokens = this.lexerResult.hidden; + if (!hiddenTokens.length) { + return []; + } + const offset = token2.startOffset; + for (let i2 = 0; i2 < hiddenTokens.length; i2++) { + const token22 = hiddenTokens[i2]; + if (token22.startOffset > offset) { + return hiddenTokens.splice(0, i2); + } + } + return hiddenTokens.splice(0, hiddenTokens.length); + } + consume(idx, tokenType, feature) { + const token2 = this.wrapper.wrapConsume(idx, tokenType); + if (!this.isRecording() && this.isValidToken(token2)) { + const hiddenTokens = this.extractHiddenTokens(token2); + this.nodeBuilder.addHiddenNodes(hiddenTokens); + const leafNode = this.nodeBuilder.buildLeafNode(token2, feature); + const { assignment, crossRef } = this.getAssignment(feature); + const current = this.current; + if (assignment) { + const convertedValue = isKeyword(feature) ? token2.image : this.converter.convert(token2.image, leafNode); + this.assign(assignment.operator, assignment.feature, convertedValue, leafNode, crossRef); + } else if (isDataTypeNode(current)) { + let text4 = token2.image; + if (!isKeyword(feature)) { + text4 = this.converter.convert(text4, leafNode).toString(); + } + current.value += text4; + } + } + } + /** + * Most consumed parser tokens are valid. However there are two cases in which they are not valid: + * + * 1. They were inserted during error recovery by the parser. These tokens don't really exist and should not be further processed + * 2. They contain invalid token ranges. This might include the special EOF token, or other tokens produced by invalid token builders. + */ + isValidToken(token2) { + return !token2.isInsertedInRecovery && !isNaN(token2.startOffset) && typeof token2.endOffset === "number" && !isNaN(token2.endOffset); + } + subrule(idx, rule, fragment, feature, args) { + let cstNode; + if (!this.isRecording() && !fragment) { + cstNode = this.nodeBuilder.buildCompositeNode(feature); + } + let result; + try { + result = this.wrapper.wrapSubrule(idx, rule, args); + } finally { + if (!this.isRecording()) { + if (result === void 0 && !fragment) { + result = this.construct(); + } + if (result !== void 0 && cstNode && cstNode.length > 0) { + this.performSubruleAssignment(result, feature, cstNode); + } + } + } + } + performSubruleAssignment(result, feature, cstNode) { + const { assignment, crossRef } = this.getAssignment(feature); + if (assignment) { + this.assign(assignment.operator, assignment.feature, result, cstNode, crossRef); + } else if (!assignment) { + const current = this.current; + if (isDataTypeNode(current)) { + current.value += result.toString(); + } else if (typeof result === "object" && result) { + const object3 = this.assignWithoutOverride(result, current); + const newItem = object3; + this.stack.pop(); + this.stack.push(newItem); + } + } + } + action($type, action) { + if (!this.isRecording()) { + let last22 = this.current; + if (action.feature && action.operator) { + last22 = this.construct(); + this.nodeBuilder.removeNode(last22.$cstNode); + const node2 = this.nodeBuilder.buildCompositeNode(action); + node2.content.push(last22.$cstNode); + const newItem = { $type }; + this.stack.push(newItem); + this.assign(action.operator, action.feature, last22, last22.$cstNode); + } else { + last22.$type = $type; + } + } + } + construct() { + if (this.isRecording()) { + return void 0; + } + const obj = this.stack.pop(); + this.nodeBuilder.construct(obj); + if ("$infixName" in obj) { + return this.constructInfix(obj, this.operatorPrecedence.get(obj.$infixName)); + } else if (isDataTypeNode(obj)) { + return this.converter.convert(obj.value, obj.$cstNode); + } else { + assignMandatoryProperties(this.astReflection, obj); + } + return obj; + } + constructInfix(obj, precedence) { + const parts = obj.parts; + if (!Array.isArray(parts) || parts.length === 0) { + return void 0; + } + const operators = obj.operators; + if (!Array.isArray(operators) || parts.length < 2) { + return parts[0]; + } + let lowestPrecedenceIdx = 0; + let lowestPrecedenceValue = -1; + for (let i2 = 0; i2 < operators.length; i2++) { + const operator = operators[i2]; + const opPrecedence = precedence.get(operator) ?? { + precedence: Infinity, + rightAssoc: false + }; + if (opPrecedence.precedence > lowestPrecedenceValue) { + lowestPrecedenceValue = opPrecedence.precedence; + lowestPrecedenceIdx = i2; + } else if (opPrecedence.precedence === lowestPrecedenceValue) { + if (!opPrecedence.rightAssoc) { + lowestPrecedenceIdx = i2; + } + } + } + const leftOperators = operators.slice(0, lowestPrecedenceIdx); + const rightOperators = operators.slice(lowestPrecedenceIdx + 1); + const leftParts = parts.slice(0, lowestPrecedenceIdx + 1); + const rightParts = parts.slice(lowestPrecedenceIdx + 1); + const leftInfix = { + $infixName: obj.$infixName, + $type: obj.$type, + $cstNode: obj.$cstNode, + parts: leftParts, + operators: leftOperators + }; + const rightInfix = { + $infixName: obj.$infixName, + $type: obj.$type, + $cstNode: obj.$cstNode, + parts: rightParts, + operators: rightOperators + }; + const leftTree = this.constructInfix(leftInfix, precedence); + const rightTree = this.constructInfix(rightInfix, precedence); + return { + $type: obj.$type, + $cstNode: obj.$cstNode, + left: leftTree, + operator: operators[lowestPrecedenceIdx], + right: rightTree + }; + } + getAssignment(feature) { + if (!this.assignmentMap.has(feature)) { + const assignment = getContainerOfType(feature, isAssignment); + this.assignmentMap.set(feature, { + assignment, + crossRef: assignment && isCrossReference(assignment.terminal) ? assignment.terminal.isMulti ? "multi" : "single" : void 0 + }); + } + return this.assignmentMap.get(feature); + } + assign(operator, feature, value2, cstNode, crossRef) { + const obj = this.current; + let item; + if (crossRef === "single" && typeof value2 === "string") { + item = this.linker.buildReference(obj, feature, cstNode, value2); + } else if (crossRef === "multi" && typeof value2 === "string") { + item = this.linker.buildMultiReference(obj, feature, cstNode, value2); + } else { + item = value2; + } + switch (operator) { + case "=": { + obj[feature] = item; + break; + } + case "?=": { + obj[feature] = true; + break; + } + case "+=": { + if (!Array.isArray(obj[feature])) { + obj[feature] = []; + } + obj[feature].push(item); + } + } + } + assignWithoutOverride(target, source) { + for (const [name, existingValue] of Object.entries(source)) { + const newValue = target[name]; + if (newValue === void 0) { + target[name] = existingValue; + } else if (Array.isArray(newValue) && Array.isArray(existingValue)) { + existingValue.push(...newValue); + target[name] = existingValue; + } + } + const targetCstNode = target.$cstNode; + if (targetCstNode) { + targetCstNode.astNode = void 0; + target.$cstNode = void 0; + } + return target; + } + get definitionErrors() { + return this.wrapper.definitionErrors; + } + }; + AbstractParserErrorMessageProvider = class { + static { + __name(this, "AbstractParserErrorMessageProvider"); + } + static { + __name2(this, "AbstractParserErrorMessageProvider"); + } + buildMismatchTokenMessage(options2) { + return defaultParserErrorProvider.buildMismatchTokenMessage(options2); + } + buildNotAllInputParsedMessage(options2) { + return defaultParserErrorProvider.buildNotAllInputParsedMessage(options2); + } + buildNoViableAltMessage(options2) { + return defaultParserErrorProvider.buildNoViableAltMessage(options2); + } + buildEarlyExitMessage(options2) { + return defaultParserErrorProvider.buildEarlyExitMessage(options2); + } + }; + LangiumParserErrorMessageProvider = class extends AbstractParserErrorMessageProvider { + static { + __name(this, "LangiumParserErrorMessageProvider"); + } + static { + __name2(this, "LangiumParserErrorMessageProvider"); + } + buildMismatchTokenMessage({ expected, actual }) { + const expectedMsg = expected.LABEL ? "`" + expected.LABEL + "`" : expected.name.endsWith(":KW") ? `keyword '${expected.name.substring(0, expected.name.length - 3)}'` : `token of type '${expected.name}'`; + return `Expecting ${expectedMsg} but found \`${actual.image}\`.`; + } + buildNotAllInputParsedMessage({ firstRedundant }) { + return `Expecting end of file but found \`${firstRedundant.image}\`.`; + } + }; + LangiumCompletionParser = class extends AbstractLangiumParser { + static { + __name(this, "LangiumCompletionParser"); + } + static { + __name2(this, "LangiumCompletionParser"); + } + constructor() { + super(...arguments); + this.tokens = []; + this.elementStack = []; + this.lastElementStack = []; + this.nextTokenIndex = 0; + this.stackSize = 0; + } + action() { + } + construct() { + return void 0; + } + parse(input) { + this.resetState(); + const tokens2 = this.lexer.tokenize(input, { mode: "partial" }); + this.tokens = tokens2.tokens; + this.wrapper.input = [...this.tokens]; + this.mainRule.call(this.wrapper, {}); + this.unorderedGroups.clear(); + return { + tokens: this.tokens, + elementStack: [...this.lastElementStack], + tokenIndex: this.nextTokenIndex + }; + } + rule(rule, impl2) { + const ruleMethod = this.wrapper.DEFINE_RULE(withRuleSuffix(rule.name), this.startImplementation(impl2).bind(this)); + this.allRules.set(rule.name, ruleMethod); + if (rule.entry) { + this.mainRule = ruleMethod; + } + return ruleMethod; + } + resetState() { + this.elementStack = []; + this.lastElementStack = []; + this.nextTokenIndex = 0; + this.stackSize = 0; + } + startImplementation(implementation) { + return (args) => { + const size4 = this.keepStackSize(); + try { + implementation(args); + } finally { + this.resetStackSize(size4); + } + }; + } + removeUnexpectedElements() { + this.elementStack.splice(this.stackSize); + } + keepStackSize() { + const size4 = this.elementStack.length; + this.stackSize = size4; + return size4; + } + resetStackSize(size4) { + this.removeUnexpectedElements(); + this.stackSize = size4; + } + consume(idx, tokenType, feature) { + this.wrapper.wrapConsume(idx, tokenType); + if (!this.isRecording()) { + this.lastElementStack = [...this.elementStack, feature]; + this.nextTokenIndex = this.currIdx + 1; + } + } + subrule(idx, rule, fragment, feature, args) { + this.before(feature); + this.wrapper.wrapSubrule(idx, rule, args); + this.after(feature); + } + before(element3) { + if (!this.isRecording()) { + this.elementStack.push(element3); + } + } + after(element3) { + if (!this.isRecording()) { + const index = this.elementStack.lastIndexOf(element3); + if (index >= 0) { + this.elementStack.splice(index); + } + } + } + get currIdx() { + return this.wrapper.currIdx; + } + }; + defaultConfig3 = { + recoveryEnabled: true, + nodeLocationTracking: "full", + skipValidations: true, + errorMessageProvider: new LangiumParserErrorMessageProvider() + }; + ChevrotainWrapper = class extends EmbeddedActionsParser { + static { + __name(this, "ChevrotainWrapper"); + } + static { + __name2(this, "ChevrotainWrapper"); + } + constructor(tokens2, config5) { + const useDefaultLookahead = config5 && "maxLookahead" in config5; + super(tokens2, { + ...defaultConfig3, + lookaheadStrategy: useDefaultLookahead ? new LLkLookaheadStrategy({ maxLookahead: config5.maxLookahead }) : new LLStarLookaheadStrategy({ + // If validations are skipped, don't log the lookahead warnings + logging: config5.skipValidations ? () => { + } : void 0 + }), + ...config5 + }); + } + get IS_RECORDING() { + return this.RECORDING_PHASE; + } + DEFINE_RULE(name, impl2, config5) { + return this.RULE(name, impl2, config5); + } + wrapSelfAnalysis() { + this.performSelfAnalysis(); + } + wrapConsume(idx, tokenType) { + return this.consume(idx, tokenType, void 0); + } + wrapSubrule(idx, rule, args) { + return this.subrule(idx, rule, { + ARGS: [args] + }); + } + wrapOr(idx, choices) { + this.or(idx, choices); + } + wrapOption(idx, callback) { + this.option(idx, callback); + } + wrapMany(idx, callback) { + this.many(idx, callback); + } + wrapAtLeastOne(idx, callback) { + this.atLeastOne(idx, callback); + } + rule(rule) { + return rule.call(this, {}); + } + }; + ProfilerWrapper = class extends ChevrotainWrapper { + static { + __name(this, "ProfilerWrapper"); + } + static { + __name2(this, "ProfilerWrapper"); + } + constructor(tokens2, config5, task) { + super(tokens2, config5); + this.task = task; + } + rule(rule) { + this.task.start(); + this.task.startSubTask(this.ruleName(rule)); + try { + return super.rule(rule); + } finally { + this.task.stopSubTask(this.ruleName(rule)); + this.task.stop(); + } + } + ruleName(rule) { + return rule.ruleName; + } + subrule(idx, ruleToCall, options2) { + this.task.startSubTask(this.ruleName(ruleToCall)); + try { + return super.subrule(idx, ruleToCall, options2); + } finally { + this.task.stopSubTask(this.ruleName(ruleToCall)); + } + } + }; + __name(createParser, "createParser"); + __name2(createParser, "createParser"); + __name(buildRules, "buildRules"); + __name2(buildRules, "buildRules"); + __name(buildInfixRule, "buildInfixRule"); + __name2(buildInfixRule, "buildInfixRule"); + __name(buildElement, "buildElement"); + __name2(buildElement, "buildElement"); + __name(buildAction, "buildAction"); + __name2(buildAction, "buildAction"); + __name(buildRuleCall, "buildRuleCall"); + __name2(buildRuleCall, "buildRuleCall"); + __name(buildRuleCallPredicate, "buildRuleCallPredicate"); + __name2(buildRuleCallPredicate, "buildRuleCallPredicate"); + __name(buildPredicate, "buildPredicate"); + __name2(buildPredicate, "buildPredicate"); + __name(buildAlternatives, "buildAlternatives"); + __name2(buildAlternatives, "buildAlternatives"); + __name(buildUnorderedGroup, "buildUnorderedGroup"); + __name2(buildUnorderedGroup, "buildUnorderedGroup"); + __name(buildGroup4, "buildGroup"); + __name2(buildGroup4, "buildGroup"); + __name(getGuardCondition, "getGuardCondition"); + __name2(getGuardCondition, "getGuardCondition"); + __name(buildCrossReference, "buildCrossReference"); + __name2(buildCrossReference, "buildCrossReference"); + __name(buildKeyword, "buildKeyword"); + __name2(buildKeyword, "buildKeyword"); + __name(wrap, "wrap"); + __name2(wrap, "wrap"); + __name(getRule, "getRule"); + __name2(getRule, "getRule"); + __name(getRuleName, "getRuleName"); + __name2(getRuleName, "getRuleName"); + __name(getToken, "getToken"); + __name2(getToken, "getToken"); + __name(createCompletionParser, "createCompletionParser"); + __name2(createCompletionParser, "createCompletionParser"); + __name(createLangiumParser, "createLangiumParser"); + __name2(createLangiumParser, "createLangiumParser"); + __name(prepareLangiumParser, "prepareLangiumParser"); + __name2(prepareLangiumParser, "prepareLangiumParser"); + DefaultTokenBuilder = class { + static { + __name(this, "DefaultTokenBuilder"); + } + static { + __name2(this, "DefaultTokenBuilder"); + } + constructor() { + this.diagnostics = []; + } + buildTokens(grammar, options2) { + const reachableRules = stream(getAllReachableRules(grammar, false)); + const terminalTokens = this.buildTerminalTokens(reachableRules); + const tokens2 = this.buildKeywordTokens(reachableRules, terminalTokens, options2); + tokens2.push(...terminalTokens); + return tokens2; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + flushLexingReport(text4) { + return { diagnostics: this.popDiagnostics() }; + } + popDiagnostics() { + const diagnostics = [...this.diagnostics]; + this.diagnostics = []; + return diagnostics; + } + buildTerminalTokens(rules) { + return rules.filter(isTerminalRule).filter((e3) => !e3.fragment).map((terminal) => this.buildTerminalToken(terminal)).toArray(); + } + buildTerminalToken(terminal) { + const regex2 = terminalRegex(terminal); + const pattern = this.requiresCustomPattern(regex2) ? this.regexPatternFunction(regex2) : regex2; + const tokenType = { + name: terminal.name, + PATTERN: pattern + }; + if (typeof pattern === "function") { + tokenType.LINE_BREAKS = true; + } + if (terminal.hidden) { + tokenType.GROUP = isWhitespace2(regex2) ? Lexer2.SKIPPED : "hidden"; + } + return tokenType; + } + requiresCustomPattern(regex2) { + if (regex2.flags.includes("u") || regex2.flags.includes("s")) { + return true; + } else { + return false; + } + } + regexPatternFunction(regex2) { + const stickyRegex = new RegExp(regex2, regex2.flags + "y"); + return (text4, offset) => { + stickyRegex.lastIndex = offset; + const execResult = stickyRegex.exec(text4); + return execResult; + }; + } + buildKeywordTokens(rules, terminalTokens, options2) { + return rules.filter(isAbstractParserRule).flatMap((rule) => streamAllContents(rule).filter(isKeyword)).distinct((e3) => e3.value).toArray().sort((a2, b3) => b3.value.length - a2.value.length).map((keyword) => this.buildKeywordToken(keyword, terminalTokens, Boolean(options2?.caseInsensitive))); + } + buildKeywordToken(keyword, terminalTokens, caseInsensitive) { + const keywordPattern = this.buildKeywordPattern(keyword, caseInsensitive); + const tokenType = { + name: keyword.value, + PATTERN: keywordPattern, + LONGER_ALT: this.findLongerAlt(keyword, terminalTokens) + }; + if (typeof keywordPattern === "function") { + tokenType.LINE_BREAKS = true; + } + return tokenType; + } + buildKeywordPattern(keyword, caseInsensitive) { + return caseInsensitive ? new RegExp(escapeRegExp(keyword.value), "i") : keyword.value; + } + findLongerAlt(keyword, terminalTokens) { + return terminalTokens.reduce((longerAlts, token2) => { + const pattern = token2?.PATTERN; + if (pattern?.source && partialMatches("^" + pattern.source + "$", keyword.value)) { + longerAlts.push(token2); + } + return longerAlts; + }, []); + } + }; + DefaultValueConverter = class { + static { + __name(this, "DefaultValueConverter"); + } + static { + __name2(this, "DefaultValueConverter"); + } + convert(input, cstNode) { + let feature = cstNode.grammarSource; + if (isCrossReference(feature)) { + feature = getCrossReferenceTerminal(feature); + } + if (isRuleCall(feature)) { + const rule = feature.rule.ref; + if (!rule) { + throw new Error("This cst node was not parsed by a rule."); + } + return this.runConverter(rule, input, cstNode); + } + return input; + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + runConverter(rule, input, cstNode) { + switch (rule.name.toUpperCase()) { + case "INT": + return ValueConverter.convertInt(input); + case "STRING": + return ValueConverter.convertString(input); + case "ID": + return ValueConverter.convertID(input); + } + switch (getRuleType(rule)?.toLowerCase()) { + case "number": + return ValueConverter.convertNumber(input); + case "boolean": + return ValueConverter.convertBoolean(input); + case "bigint": + return ValueConverter.convertBigint(input); + case "date": + return ValueConverter.convertDate(input); + default: + return input; + } + } + }; + (function(ValueConverter2) { + function convertString(input) { + let result = ""; + for (let i2 = 1; i2 < input.length - 1; i2++) { + const c3 = input.charAt(i2); + if (c3 === "\\") { + const c1 = input.charAt(++i2); + result += convertEscapeCharacter(c1); + } else { + result += c3; + } + } + return result; + } + __name(convertString, "convertString"); + __name2(convertString, "convertString"); + ValueConverter2.convertString = convertString; + function convertEscapeCharacter(char2) { + switch (char2) { + case "b": + return "\b"; + case "f": + return "\f"; + case "n": + return "\n"; + case "r": + return "\r"; + case "t": + return " "; + case "v": + return "\v"; + case "0": + return "\0"; + default: + return char2; + } + } + __name(convertEscapeCharacter, "convertEscapeCharacter"); + __name2(convertEscapeCharacter, "convertEscapeCharacter"); + function convertID(input) { + if (input.charAt(0) === "^") { + return input.substring(1); + } else { + return input; + } + } + __name(convertID, "convertID"); + __name2(convertID, "convertID"); + ValueConverter2.convertID = convertID; + function convertInt(input) { + return parseInt(input); + } + __name(convertInt, "convertInt"); + __name2(convertInt, "convertInt"); + ValueConverter2.convertInt = convertInt; + function convertBigint(input) { + return BigInt(input); + } + __name(convertBigint, "convertBigint"); + __name2(convertBigint, "convertBigint"); + ValueConverter2.convertBigint = convertBigint; + function convertDate(input) { + return new Date(input); + } + __name(convertDate, "convertDate"); + __name2(convertDate, "convertDate"); + ValueConverter2.convertDate = convertDate; + function convertNumber(input) { + return Number(input); + } + __name(convertNumber, "convertNumber"); + __name2(convertNumber, "convertNumber"); + ValueConverter2.convertNumber = convertNumber; + function convertBoolean(input) { + return input.toLowerCase() === "true"; + } + __name(convertBoolean, "convertBoolean"); + __name2(convertBoolean, "convertBoolean"); + ValueConverter2.convertBoolean = convertBoolean; + })(ValueConverter || (ValueConverter = {})); + cancellation_exports = {}; + __reExport(cancellation_exports, __toESM2(require_cancellation(), 1)); + __name(delayNextTick, "delayNextTick"); + __name2(delayNextTick, "delayNextTick"); + lastTick = 0; + globalInterruptionPeriod = 10; + __name(startCancelableOperation, "startCancelableOperation"); + __name2(startCancelableOperation, "startCancelableOperation"); + __name(setInterruptionPeriod, "setInterruptionPeriod"); + __name2(setInterruptionPeriod, "setInterruptionPeriod"); + OperationCancelled = Symbol("OperationCancelled"); + __name(isOperationCancelled, "isOperationCancelled"); + __name2(isOperationCancelled, "isOperationCancelled"); + __name(interruptAndCheck, "interruptAndCheck"); + __name2(interruptAndCheck, "interruptAndCheck"); + Deferred = class { + static { + __name(this, "Deferred"); + } + static { + __name2(this, "Deferred"); + } + constructor() { + this.promise = new Promise((resolve2, reject22) => { + this.resolve = (arg) => { + resolve2(arg); + return this; + }; + this.reject = (err) => { + reject22(err); + return this; + }; + }); + } + }; + FullTextDocument2 = class _FullTextDocument { + static { + __name(this, "_FullTextDocument"); + } + static { + __name2(this, "FullTextDocument"); + } + constructor(uri, languageId, version3, content) { + this._uri = uri; + this._languageId = languageId; + this._version = version3; + this._content = content; + this._lineOffsets = void 0; + } + get uri() { + return this._uri; + } + get languageId() { + return this._languageId; + } + get version() { + return this._version; + } + getText(range3) { + if (range3) { + const start3 = this.offsetAt(range3.start); + const end2 = this.offsetAt(range3.end); + return this._content.substring(start3, end2); + } + return this._content; + } + update(changes, version3) { + for (const change2 of changes) { + if (_FullTextDocument.isIncremental(change2)) { + const range3 = getWellformedRange(change2.range); + const startOffset = this.offsetAt(range3.start); + const endOffset = this.offsetAt(range3.end); + this._content = this._content.substring(0, startOffset) + change2.text + this._content.substring(endOffset, this._content.length); + const startLine = Math.max(range3.start.line, 0); + const endLine = Math.max(range3.end.line, 0); + let lineOffsets = this._lineOffsets; + const addedLineOffsets = computeLineOffsets(change2.text, false, startOffset); + if (endLine - startLine === addedLineOffsets.length) { + for (let i2 = 0, len = addedLineOffsets.length; i2 < len; i2++) { + lineOffsets[i2 + startLine + 1] = addedLineOffsets[i2]; + } + } else { + if (addedLineOffsets.length < 1e4) { + lineOffsets.splice(startLine + 1, endLine - startLine, ...addedLineOffsets); + } else { + this._lineOffsets = lineOffsets = lineOffsets.slice(0, startLine + 1).concat(addedLineOffsets, lineOffsets.slice(endLine + 1)); + } + } + const diff2 = change2.text.length - (endOffset - startOffset); + if (diff2 !== 0) { + for (let i2 = startLine + 1 + addedLineOffsets.length, len = lineOffsets.length; i2 < len; i2++) { + lineOffsets[i2] = lineOffsets[i2] + diff2; + } + } + } else if (_FullTextDocument.isFull(change2)) { + this._content = change2.text; + this._lineOffsets = void 0; + } else { + throw new Error("Unknown change event received"); + } + } + this._version = version3; + } + getLineOffsets() { + if (this._lineOffsets === void 0) { + this._lineOffsets = computeLineOffsets(this._content, true); + } + return this._lineOffsets; + } + positionAt(offset) { + offset = Math.max(Math.min(offset, this._content.length), 0); + const lineOffsets = this.getLineOffsets(); + let low = 0, high = lineOffsets.length; + if (high === 0) { + return { line: 0, character: offset }; + } + while (low < high) { + const mid = Math.floor((low + high) / 2); + if (lineOffsets[mid] > offset) { + high = mid; + } else { + low = mid + 1; + } + } + const line2 = low - 1; + offset = this.ensureBeforeEOL(offset, lineOffsets[line2]); + return { line: line2, character: offset - lineOffsets[line2] }; + } + offsetAt(position5) { + const lineOffsets = this.getLineOffsets(); + if (position5.line >= lineOffsets.length) { + return this._content.length; + } else if (position5.line < 0) { + return 0; + } + const lineOffset = lineOffsets[position5.line]; + if (position5.character <= 0) { + return lineOffset; + } + const nextLineOffset = position5.line + 1 < lineOffsets.length ? lineOffsets[position5.line + 1] : this._content.length; + const offset = Math.min(lineOffset + position5.character, nextLineOffset); + return this.ensureBeforeEOL(offset, lineOffset); + } + ensureBeforeEOL(offset, lineOffset) { + while (offset > lineOffset && isEOL(this._content.charCodeAt(offset - 1))) { + offset--; + } + return offset; + } + get lineCount() { + return this.getLineOffsets().length; + } + static isIncremental(event3) { + const candidate = event3; + return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number"); + } + static isFull(event3) { + const candidate = event3; + return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0; + } + }; + (function(TextDocument3) { + function create4(uri, languageId, version3, content) { + return new FullTextDocument2(uri, languageId, version3, content); + } + __name(create4, "create"); + __name2(create4, "create"); + TextDocument3.create = create4; + function update2(document2, changes, version3) { + if (document2 instanceof FullTextDocument2) { + document2.update(changes, version3); + return document2; + } else { + throw new Error("TextDocument.update: document must be created by TextDocument.create"); + } + } + __name(update2, "update"); + __name2(update2, "update"); + TextDocument3.update = update2; + function applyEdits(document2, edits) { + const text4 = document2.getText(); + const sortedEdits = mergeSort(edits.map(getWellformedEdit), (a2, b3) => { + const diff2 = a2.range.start.line - b3.range.start.line; + if (diff2 === 0) { + return a2.range.start.character - b3.range.start.character; + } + return diff2; + }); + let lastModifiedOffset = 0; + const spans = []; + for (const e3 of sortedEdits) { + const startOffset = document2.offsetAt(e3.range.start); + if (startOffset < lastModifiedOffset) { + throw new Error("Overlapping edit"); + } else if (startOffset > lastModifiedOffset) { + spans.push(text4.substring(lastModifiedOffset, startOffset)); + } + if (e3.newText.length) { + spans.push(e3.newText); + } + lastModifiedOffset = document2.offsetAt(e3.range.end); + } + spans.push(text4.substr(lastModifiedOffset)); + return spans.join(""); + } + __name(applyEdits, "applyEdits"); + __name2(applyEdits, "applyEdits"); + TextDocument3.applyEdits = applyEdits; + })(TextDocument2 || (TextDocument2 = {})); + __name(mergeSort, "mergeSort"); + __name2(mergeSort, "mergeSort"); + __name(computeLineOffsets, "computeLineOffsets"); + __name2(computeLineOffsets, "computeLineOffsets"); + __name(isEOL, "isEOL"); + __name2(isEOL, "isEOL"); + __name(getWellformedRange, "getWellformedRange"); + __name2(getWellformedRange, "getWellformedRange"); + __name(getWellformedEdit, "getWellformedEdit"); + __name2(getWellformedEdit, "getWellformedEdit"); + (() => { + "use strict"; + var t4 = { 975: (t22) => { + function e22(t32) { + if ("string" != typeof t32) throw new TypeError("Path must be a string. Received " + JSON.stringify(t32)); + } + __name(e22, "e2"); + __name2(e22, "e"); + function r22(t32, e32) { + for (var r3, n3 = "", i22 = 0, o22 = -1, s22 = 0, h22 = 0; h22 <= t32.length; ++h22) { + if (h22 < t32.length) r3 = t32.charCodeAt(h22); + else { + if (47 === r3) break; + r3 = 47; + } + if (47 === r3) { + if (o22 === h22 - 1 || 1 === s22) ; + else if (o22 !== h22 - 1 && 2 === s22) { + if (n3.length < 2 || 2 !== i22 || 46 !== n3.charCodeAt(n3.length - 1) || 46 !== n3.charCodeAt(n3.length - 2)) { + if (n3.length > 2) { + var a22 = n3.lastIndexOf("/"); + if (a22 !== n3.length - 1) { + -1 === a22 ? (n3 = "", i22 = 0) : i22 = (n3 = n3.slice(0, a22)).length - 1 - n3.lastIndexOf("/"), o22 = h22, s22 = 0; + continue; + } + } else if (2 === n3.length || 1 === n3.length) { + n3 = "", i22 = 0, o22 = h22, s22 = 0; + continue; + } + } + e32 && (n3.length > 0 ? n3 += "/.." : n3 = "..", i22 = 2); + } else n3.length > 0 ? n3 += "/" + t32.slice(o22 + 1, h22) : n3 = t32.slice(o22 + 1, h22), i22 = h22 - o22 - 1; + o22 = h22, s22 = 0; + } else 46 === r3 && -1 !== s22 ? ++s22 : s22 = -1; + } + return n3; + } + __name(r22, "r2"); + __name2(r22, "r"); + var n22 = { resolve: /* @__PURE__ */ __name2(function() { + for (var t32, n3 = "", i22 = false, o22 = arguments.length - 1; o22 >= -1 && !i22; o22--) { + var s22; + o22 >= 0 ? s22 = arguments[o22] : (void 0 === t32 && (t32 = process.cwd()), s22 = t32), e22(s22), 0 !== s22.length && (n3 = s22 + "/" + n3, i22 = 47 === s22.charCodeAt(0)); + } + return n3 = r22(n3, !i22), i22 ? n3.length > 0 ? "/" + n3 : "/" : n3.length > 0 ? n3 : "."; + }, "resolve"), normalize: /* @__PURE__ */ __name2(function(t32) { + if (e22(t32), 0 === t32.length) return "."; + var n3 = 47 === t32.charCodeAt(0), i22 = 47 === t32.charCodeAt(t32.length - 1); + return 0 !== (t32 = r22(t32, !n3)).length || n3 || (t32 = "."), t32.length > 0 && i22 && (t32 += "/"), n3 ? "/" + t32 : t32; + }, "normalize"), isAbsolute: /* @__PURE__ */ __name2(function(t32) { + return e22(t32), t32.length > 0 && 47 === t32.charCodeAt(0); + }, "isAbsolute"), join: /* @__PURE__ */ __name2(function() { + if (0 === arguments.length) return "."; + for (var t32, r3 = 0; r3 < arguments.length; ++r3) { + var i22 = arguments[r3]; + e22(i22), i22.length > 0 && (void 0 === t32 ? t32 = i22 : t32 += "/" + i22); + } + return void 0 === t32 ? "." : n22.normalize(t32); + }, "join"), relative: /* @__PURE__ */ __name2(function(t32, r3) { + if (e22(t32), e22(r3), t32 === r3) return ""; + if ((t32 = n22.resolve(t32)) === (r3 = n22.resolve(r3))) return ""; + for (var i22 = 1; i22 < t32.length && 47 === t32.charCodeAt(i22); ++i22) ; + for (var o22 = t32.length, s22 = o22 - i22, h22 = 1; h22 < r3.length && 47 === r3.charCodeAt(h22); ++h22) ; + for (var a22 = r3.length - h22, c22 = s22 < a22 ? s22 : a22, f22 = -1, u22 = 0; u22 <= c22; ++u22) { + if (u22 === c22) { + if (a22 > c22) { + if (47 === r3.charCodeAt(h22 + u22)) return r3.slice(h22 + u22 + 1); + if (0 === u22) return r3.slice(h22 + u22); + } else s22 > c22 && (47 === t32.charCodeAt(i22 + u22) ? f22 = u22 : 0 === u22 && (f22 = 0)); + break; + } + var l22 = t32.charCodeAt(i22 + u22); + if (l22 !== r3.charCodeAt(h22 + u22)) break; + 47 === l22 && (f22 = u22); + } + var g22 = ""; + for (u22 = i22 + f22 + 1; u22 <= o22; ++u22) u22 !== o22 && 47 !== t32.charCodeAt(u22) || (0 === g22.length ? g22 += ".." : g22 += "/.."); + return g22.length > 0 ? g22 + r3.slice(h22 + f22) : (h22 += f22, 47 === r3.charCodeAt(h22) && ++h22, r3.slice(h22)); + }, "relative"), _makeLong: /* @__PURE__ */ __name2(function(t32) { + return t32; + }, "_makeLong"), dirname: /* @__PURE__ */ __name2(function(t32) { + if (e22(t32), 0 === t32.length) return "."; + for (var r3 = t32.charCodeAt(0), n3 = 47 === r3, i22 = -1, o22 = true, s22 = t32.length - 1; s22 >= 1; --s22) if (47 === (r3 = t32.charCodeAt(s22))) { + if (!o22) { + i22 = s22; + break; + } + } else o22 = false; + return -1 === i22 ? n3 ? "/" : "." : n3 && 1 === i22 ? "//" : t32.slice(0, i22); + }, "dirname"), basename: /* @__PURE__ */ __name2(function(t32, r3) { + if (void 0 !== r3 && "string" != typeof r3) throw new TypeError('"ext" argument must be a string'); + e22(t32); + var n3, i22 = 0, o22 = -1, s22 = true; + if (void 0 !== r3 && r3.length > 0 && r3.length <= t32.length) { + if (r3.length === t32.length && r3 === t32) return ""; + var h22 = r3.length - 1, a22 = -1; + for (n3 = t32.length - 1; n3 >= 0; --n3) { + var c22 = t32.charCodeAt(n3); + if (47 === c22) { + if (!s22) { + i22 = n3 + 1; + break; + } + } else -1 === a22 && (s22 = false, a22 = n3 + 1), h22 >= 0 && (c22 === r3.charCodeAt(h22) ? -1 == --h22 && (o22 = n3) : (h22 = -1, o22 = a22)); + } + return i22 === o22 ? o22 = a22 : -1 === o22 && (o22 = t32.length), t32.slice(i22, o22); + } + for (n3 = t32.length - 1; n3 >= 0; --n3) if (47 === t32.charCodeAt(n3)) { + if (!s22) { + i22 = n3 + 1; + break; + } + } else -1 === o22 && (s22 = false, o22 = n3 + 1); + return -1 === o22 ? "" : t32.slice(i22, o22); + }, "basename"), extname: /* @__PURE__ */ __name2(function(t32) { + e22(t32); + for (var r3 = -1, n3 = 0, i22 = -1, o22 = true, s22 = 0, h22 = t32.length - 1; h22 >= 0; --h22) { + var a22 = t32.charCodeAt(h22); + if (47 !== a22) -1 === i22 && (o22 = false, i22 = h22 + 1), 46 === a22 ? -1 === r3 ? r3 = h22 : 1 !== s22 && (s22 = 1) : -1 !== r3 && (s22 = -1); + else if (!o22) { + n3 = h22 + 1; + break; + } + } + return -1 === r3 || -1 === i22 || 0 === s22 || 1 === s22 && r3 === i22 - 1 && r3 === n3 + 1 ? "" : t32.slice(r3, i22); + }, "extname"), format: /* @__PURE__ */ __name2(function(t32) { + if (null === t32 || "object" != typeof t32) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof t32); + return (function(t42, e32) { + var r3 = e32.dir || e32.root, n3 = e32.base || (e32.name || "") + (e32.ext || ""); + return r3 ? r3 === e32.root ? r3 + n3 : r3 + "/" + n3 : n3; + })(0, t32); + }, "format"), parse: /* @__PURE__ */ __name2(function(t32) { + e22(t32); + var r3 = { root: "", dir: "", base: "", ext: "", name: "" }; + if (0 === t32.length) return r3; + var n3, i22 = t32.charCodeAt(0), o22 = 47 === i22; + o22 ? (r3.root = "/", n3 = 1) : n3 = 0; + for (var s22 = -1, h22 = 0, a22 = -1, c22 = true, f22 = t32.length - 1, u22 = 0; f22 >= n3; --f22) if (47 !== (i22 = t32.charCodeAt(f22))) -1 === a22 && (c22 = false, a22 = f22 + 1), 46 === i22 ? -1 === s22 ? s22 = f22 : 1 !== u22 && (u22 = 1) : -1 !== s22 && (u22 = -1); + else if (!c22) { + h22 = f22 + 1; + break; + } + return -1 === s22 || -1 === a22 || 0 === u22 || 1 === u22 && s22 === a22 - 1 && s22 === h22 + 1 ? -1 !== a22 && (r3.base = r3.name = 0 === h22 && o22 ? t32.slice(1, a22) : t32.slice(h22, a22)) : (0 === h22 && o22 ? (r3.name = t32.slice(1, s22), r3.base = t32.slice(1, a22)) : (r3.name = t32.slice(h22, s22), r3.base = t32.slice(h22, a22)), r3.ext = t32.slice(s22, a22)), h22 > 0 ? r3.dir = t32.slice(0, h22 - 1) : o22 && (r3.dir = "/"), r3; + }, "parse"), sep: "/", delimiter: ":", win32: null, posix: null }; + n22.posix = n22, t22.exports = n22; + } }, e3 = {}; + function r2(n22) { + var i22 = e3[n22]; + if (void 0 !== i22) return i22.exports; + var o22 = e3[n22] = { exports: {} }; + return t4[n22](o22, o22.exports, r2), o22.exports; + } + __name(r2, "r"); + __name2(r2, "r"); + r2.d = (t22, e22) => { + for (var n22 in e22) r2.o(e22, n22) && !r2.o(t22, n22) && Object.defineProperty(t22, n22, { enumerable: true, get: e22[n22] }); + }, r2.o = (t22, e22) => Object.prototype.hasOwnProperty.call(t22, e22), r2.r = (t22) => { + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t22, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t22, "__esModule", { value: true }); + }; + var n2 = {}; + let i2; + if (r2.r(n2), r2.d(n2, { URI: /* @__PURE__ */ __name2(() => l4, "URI"), Utils: /* @__PURE__ */ __name2(() => I3, "Utils") }), "object" == typeof process) i2 = "win32" === process.platform; + else if ("object" == typeof navigator) { + let t22 = navigator.userAgent; + i2 = t22.indexOf("Windows") >= 0; + } + const o2 = /^\w[\w\d+.-]*$/, s2 = /^\//, h3 = /^\/\//; + function a2(t22, e22) { + if (!t22.scheme && e22) throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t22.authority}", path: "${t22.path}", query: "${t22.query}", fragment: "${t22.fragment}"}`); + if (t22.scheme && !o2.test(t22.scheme)) throw new Error("[UriError]: Scheme contains illegal characters."); + if (t22.path) { + if (t22.authority) { + if (!s2.test(t22.path)) throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character'); + } else if (h3.test(t22.path)) throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")'); + } + } + __name(a2, "a"); + __name2(a2, "a"); + const c3 = "", f2 = "/", u2 = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; + class l4 { + static { + __name(this, "l"); + } + static { + __name2(this, "l"); + } + static isUri(t22) { + return t22 instanceof l4 || !!t22 && "string" == typeof t22.authority && "string" == typeof t22.fragment && "string" == typeof t22.path && "string" == typeof t22.query && "string" == typeof t22.scheme && "string" == typeof t22.fsPath && "function" == typeof t22.with && "function" == typeof t22.toString; + } + scheme; + authority; + path; + query; + fragment; + constructor(t22, e22, r22, n22, i22, o22 = false) { + "object" == typeof t22 ? (this.scheme = t22.scheme || c3, this.authority = t22.authority || c3, this.path = t22.path || c3, this.query = t22.query || c3, this.fragment = t22.fragment || c3) : (this.scheme = /* @__PURE__ */ (function(t32, e32) { + return t32 || e32 ? t32 : "file"; + })(t22, o22), this.authority = e22 || c3, this.path = (function(t32, e32) { + switch (t32) { + case "https": + case "http": + case "file": + e32 ? e32[0] !== f2 && (e32 = f2 + e32) : e32 = f2; + } + return e32; + })(this.scheme, r22 || c3), this.query = n22 || c3, this.fragment = i22 || c3, a2(this, o22)); + } + get fsPath() { + return v3(this, false); + } + with(t22) { + if (!t22) return this; + let { scheme: e22, authority: r22, path: n22, query: i22, fragment: o22 } = t22; + return void 0 === e22 ? e22 = this.scheme : null === e22 && (e22 = c3), void 0 === r22 ? r22 = this.authority : null === r22 && (r22 = c3), void 0 === n22 ? n22 = this.path : null === n22 && (n22 = c3), void 0 === i22 ? i22 = this.query : null === i22 && (i22 = c3), void 0 === o22 ? o22 = this.fragment : null === o22 && (o22 = c3), e22 === this.scheme && r22 === this.authority && n22 === this.path && i22 === this.query && o22 === this.fragment ? this : new d3(e22, r22, n22, i22, o22); + } + static parse(t22, e22 = false) { + const r22 = u2.exec(t22); + return r22 ? new d3(r22[2] || c3, w4(r22[4] || c3), w4(r22[5] || c3), w4(r22[7] || c3), w4(r22[9] || c3), e22) : new d3(c3, c3, c3, c3, c3); + } + static file(t22) { + let e22 = c3; + if (i2 && (t22 = t22.replace(/\\/g, f2)), t22[0] === f2 && t22[1] === f2) { + const r22 = t22.indexOf(f2, 2); + -1 === r22 ? (e22 = t22.substring(2), t22 = f2) : (e22 = t22.substring(2, r22), t22 = t22.substring(r22) || f2); + } + return new d3("file", e22, t22, c3, c3); + } + static from(t22) { + const e22 = new d3(t22.scheme, t22.authority, t22.path, t22.query, t22.fragment); + return a2(e22, true), e22; + } + toString(t22 = false) { + return b3(this, t22); + } + toJSON() { + return this; + } + static revive(t22) { + if (t22) { + if (t22 instanceof l4) return t22; + { + const e22 = new d3(t22); + return e22._formatted = t22.external, e22._fsPath = t22._sep === g2 ? t22.fsPath : null, e22; + } + } + return t22; + } + } + const g2 = i2 ? 1 : void 0; + class d3 extends l4 { + static { + __name(this, "d"); + } + static { + __name2(this, "d"); + } + _formatted = null; + _fsPath = null; + get fsPath() { + return this._fsPath || (this._fsPath = v3(this, false)), this._fsPath; + } + toString(t22 = false) { + return t22 ? b3(this, true) : (this._formatted || (this._formatted = b3(this, false)), this._formatted); + } + toJSON() { + const t22 = { $mid: 1 }; + return this._fsPath && (t22.fsPath = this._fsPath, t22._sep = g2), this._formatted && (t22.external = this._formatted), this.path && (t22.path = this.path), this.scheme && (t22.scheme = this.scheme), this.authority && (t22.authority = this.authority), this.query && (t22.query = this.query), this.fragment && (t22.fragment = this.fragment), t22; + } + } + const p3 = { 58: "%3A", 47: "%2F", 63: "%3F", 35: "%23", 91: "%5B", 93: "%5D", 64: "%40", 33: "%21", 36: "%24", 38: "%26", 39: "%27", 40: "%28", 41: "%29", 42: "%2A", 43: "%2B", 44: "%2C", 59: "%3B", 61: "%3D", 32: "%20" }; + function m3(t22, e22, r22) { + let n22, i22 = -1; + for (let o22 = 0; o22 < t22.length; o22++) { + const s22 = t22.charCodeAt(o22); + if (s22 >= 97 && s22 <= 122 || s22 >= 65 && s22 <= 90 || s22 >= 48 && s22 <= 57 || 45 === s22 || 46 === s22 || 95 === s22 || 126 === s22 || e22 && 47 === s22 || r22 && 91 === s22 || r22 && 93 === s22 || r22 && 58 === s22) -1 !== i22 && (n22 += encodeURIComponent(t22.substring(i22, o22)), i22 = -1), void 0 !== n22 && (n22 += t22.charAt(o22)); + else { + void 0 === n22 && (n22 = t22.substr(0, o22)); + const e32 = p3[s22]; + void 0 !== e32 ? (-1 !== i22 && (n22 += encodeURIComponent(t22.substring(i22, o22)), i22 = -1), n22 += e32) : -1 === i22 && (i22 = o22); + } + } + return -1 !== i22 && (n22 += encodeURIComponent(t22.substring(i22))), void 0 !== n22 ? n22 : t22; + } + __name(m3, "m"); + __name2(m3, "m"); + function y6(t22) { + let e22; + for (let r22 = 0; r22 < t22.length; r22++) { + const n22 = t22.charCodeAt(r22); + 35 === n22 || 63 === n22 ? (void 0 === e22 && (e22 = t22.substr(0, r22)), e22 += p3[n22]) : void 0 !== e22 && (e22 += t22[r22]); + } + return void 0 !== e22 ? e22 : t22; + } + __name(y6, "y"); + __name2(y6, "y"); + function v3(t22, e22) { + let r22; + return r22 = t22.authority && t22.path.length > 1 && "file" === t22.scheme ? `//${t22.authority}${t22.path}` : 47 === t22.path.charCodeAt(0) && (t22.path.charCodeAt(1) >= 65 && t22.path.charCodeAt(1) <= 90 || t22.path.charCodeAt(1) >= 97 && t22.path.charCodeAt(1) <= 122) && 58 === t22.path.charCodeAt(2) ? e22 ? t22.path.substr(1) : t22.path[1].toLowerCase() + t22.path.substr(2) : t22.path, i2 && (r22 = r22.replace(/\//g, "\\")), r22; + } + __name(v3, "v"); + __name2(v3, "v"); + function b3(t22, e22) { + const r22 = e22 ? y6 : m3; + let n22 = "", { scheme: i22, authority: o22, path: s22, query: h22, fragment: a22 } = t22; + if (i22 && (n22 += i22, n22 += ":"), (o22 || "file" === i22) && (n22 += f2, n22 += f2), o22) { + let t32 = o22.indexOf("@"); + if (-1 !== t32) { + const e32 = o22.substr(0, t32); + o22 = o22.substr(t32 + 1), t32 = e32.lastIndexOf(":"), -1 === t32 ? n22 += r22(e32, false, false) : (n22 += r22(e32.substr(0, t32), false, false), n22 += ":", n22 += r22(e32.substr(t32 + 1), false, true)), n22 += "@"; + } + o22 = o22.toLowerCase(), t32 = o22.lastIndexOf(":"), -1 === t32 ? n22 += r22(o22, false, true) : (n22 += r22(o22.substr(0, t32), false, true), n22 += o22.substr(t32)); + } + if (s22) { + if (s22.length >= 3 && 47 === s22.charCodeAt(0) && 58 === s22.charCodeAt(2)) { + const t32 = s22.charCodeAt(1); + t32 >= 65 && t32 <= 90 && (s22 = `/${String.fromCharCode(t32 + 32)}:${s22.substr(3)}`); + } else if (s22.length >= 2 && 58 === s22.charCodeAt(1)) { + const t32 = s22.charCodeAt(0); + t32 >= 65 && t32 <= 90 && (s22 = `${String.fromCharCode(t32 + 32)}:${s22.substr(2)}`); + } + n22 += r22(s22, true, false); + } + return h22 && (n22 += "?", n22 += r22(h22, false, false)), a22 && (n22 += "#", n22 += e22 ? a22 : m3(a22, false, false)), n22; + } + __name(b3, "b"); + __name2(b3, "b"); + function C3(t22) { + try { + return decodeURIComponent(t22); + } catch { + return t22.length > 3 ? t22.substr(0, 3) + C3(t22.substr(3)) : t22; + } + } + __name(C3, "C"); + __name2(C3, "C"); + const A2 = /(%[0-9A-Za-z][0-9A-Za-z])+/g; + function w4(t22) { + return t22.match(A2) ? t22.replace(A2, ((t32) => C3(t32))) : t22; + } + __name(w4, "w"); + __name2(w4, "w"); + var x5 = r2(975); + const P3 = x5.posix || x5, _3 = "/"; + var I3; + !(function(t22) { + t22.joinPath = function(t32, ...e22) { + return t32.with({ path: P3.join(t32.path, ...e22) }); + }, t22.resolvePath = function(t32, ...e22) { + let r22 = t32.path, n22 = false; + r22[0] !== _3 && (r22 = _3 + r22, n22 = true); + let i22 = P3.resolve(r22, ...e22); + return n22 && i22[0] === _3 && !t32.authority && (i22 = i22.substring(1)), t32.with({ path: i22 }); + }, t22.dirname = function(t32) { + if (0 === t32.path.length || t32.path === _3) return t32; + let e22 = P3.dirname(t32.path); + return 1 === e22.length && 46 === e22.charCodeAt(0) && (e22 = ""), t32.with({ path: e22 }); + }, t22.basename = function(t32) { + return P3.basename(t32.path); + }, t22.extname = function(t32) { + return P3.extname(t32.path); + }; + })(I3 || (I3 = {})), LIB = n2; + })(); + ({ URI: URI2, Utils: Utils2 } = LIB); + (function(UriUtils2) { + UriUtils2.basename = Utils2.basename; + UriUtils2.dirname = Utils2.dirname; + UriUtils2.extname = Utils2.extname; + UriUtils2.joinPath = Utils2.joinPath; + UriUtils2.resolvePath = Utils2.resolvePath; + const isWindows = typeof process === "object" && process?.platform === "win32"; + function equals(a2, b3) { + return a2?.toString() === b3?.toString(); + } + __name(equals, "equals"); + __name2(equals, "equals"); + UriUtils2.equals = equals; + function relative(from2, to) { + const fromPath = typeof from2 === "string" ? URI2.parse(from2).path : from2.path; + const toPath2 = typeof to === "string" ? URI2.parse(to).path : to.path; + const fromParts = fromPath.split("/").filter((e3) => e3.length > 0); + const toParts = toPath2.split("/").filter((e3) => e3.length > 0); + if (isWindows) { + const upperCaseDriveLetter = /^[A-Z]:$/; + if (fromParts[0] && upperCaseDriveLetter.test(fromParts[0])) { + fromParts[0] = fromParts[0].toLowerCase(); + } + if (toParts[0] && upperCaseDriveLetter.test(toParts[0])) { + toParts[0] = toParts[0].toLowerCase(); + } + if (fromParts[0] !== toParts[0]) { + return toPath2.substring(1); + } + } + let i2 = 0; + for (; i2 < fromParts.length; i2++) { + if (fromParts[i2] !== toParts[i2]) { + break; + } + } + const backPart = "../".repeat(fromParts.length - i2); + const toPart = toParts.slice(i2).join("/"); + return backPart + toPart; + } + __name(relative, "relative"); + __name2(relative, "relative"); + UriUtils2.relative = relative; + function normalize4(uri) { + return URI2.parse(uri.toString()).toString(); + } + __name(normalize4, "normalize"); + __name2(normalize4, "normalize"); + UriUtils2.normalize = normalize4; + function contains2(parent4, child) { + let parentPath = typeof parent4 === "string" ? parent4 : parent4.path; + let childPath = typeof child === "string" ? child : child.path; + if (childPath.charAt(childPath.length - 1) === "/") { + childPath = childPath.slice(0, -1); + } + if (parentPath.charAt(parentPath.length - 1) === "/") { + parentPath = parentPath.slice(0, -1); + } + if (childPath === parentPath) { + return true; + } + if (childPath.length < parentPath.length) { + return false; + } + if (childPath.charAt(parentPath.length) !== "/") { + return false; + } + return childPath.startsWith(parentPath); + } + __name(contains2, "contains"); + __name2(contains2, "contains"); + UriUtils2.contains = contains2; + })(UriUtils || (UriUtils = {})); + UriTrie = class { + static { + __name(this, "UriTrie"); + } + static { + __name2(this, "UriTrie"); + } + constructor() { + this.root = { name: "", children: /* @__PURE__ */ new Map() }; + } + normalizeUri(uri) { + return UriUtils.normalize(uri); + } + clear() { + this.root.children.clear(); + } + insert(uri, element3) { + const node2 = this.getNode(this.normalizeUri(uri), true); + node2.element = element3; + } + delete(uri) { + const nodeToDelete = this.getNode(this.normalizeUri(uri), false); + if (nodeToDelete?.parent) { + nodeToDelete.parent.children.delete(nodeToDelete.name); + } + } + has(uri) { + return this.getNode(this.normalizeUri(uri), false)?.element !== void 0; + } + hasNode(uri) { + return this.getNode(this.normalizeUri(uri), false) !== void 0; + } + find(uri) { + return this.getNode(this.normalizeUri(uri), false)?.element; + } + findNode(uri) { + const uriString = this.normalizeUri(uri); + const node2 = this.getNode(uriString, false); + if (!node2) { + return void 0; + } + return { + name: node2.name, + uri: UriUtils.joinPath(URI2.parse(uriString), node2.name).toString(), + element: node2.element + }; + } + findChildren(uri) { + const uriString = this.normalizeUri(uri); + const node2 = this.getNode(uriString, false); + if (!node2) { + return []; + } + return Array.from(node2.children.values()).map((child) => ({ + name: child.name, + uri: UriUtils.joinPath(URI2.parse(uriString), child.name).toString(), + element: child.element + })); + } + all() { + return this.collectValues(this.root); + } + findAll(prefix) { + const node2 = this.getNode(UriUtils.normalize(prefix), false); + if (!node2) { + return []; + } + return this.collectValues(node2); + } + getNode(uri, create4) { + const parts = uri.split("/"); + if (uri.charAt(uri.length - 1) === "/") { + parts.pop(); + } + let current = this.root; + for (const part of parts) { + let child = current.children.get(part); + if (!child) { + if (create4) { + child = { + name: part, + children: /* @__PURE__ */ new Map(), + parent: current + }; + current.children.set(part, child); + } else { + return void 0; + } + } + current = child; + } + return current; + } + collectValues(node2) { + const result = []; + if (node2.element) { + result.push(node2.element); + } + for (const child of node2.children.values()) { + result.push(...this.collectValues(child)); + } + return result; + } + }; + (function(DocumentState2) { + DocumentState2[DocumentState2["Changed"] = 0] = "Changed"; + DocumentState2[DocumentState2["Parsed"] = 1] = "Parsed"; + DocumentState2[DocumentState2["IndexedContent"] = 2] = "IndexedContent"; + DocumentState2[DocumentState2["ComputedScopes"] = 3] = "ComputedScopes"; + DocumentState2[DocumentState2["Linked"] = 4] = "Linked"; + DocumentState2[DocumentState2["IndexedReferences"] = 5] = "IndexedReferences"; + DocumentState2[DocumentState2["Validated"] = 6] = "Validated"; + })(DocumentState || (DocumentState = {})); + DefaultLangiumDocumentFactory = class { + static { + __name(this, "DefaultLangiumDocumentFactory"); + } + static { + __name2(this, "DefaultLangiumDocumentFactory"); + } + constructor(services) { + this.serviceRegistry = services.ServiceRegistry; + this.textDocuments = services.workspace.TextDocuments; + this.fileSystemProvider = services.workspace.FileSystemProvider; + } + async fromUri(uri, cancellationToken = cancellation_exports.CancellationToken.None) { + const content = await this.fileSystemProvider.readFile(uri); + return this.createAsync(uri, content, cancellationToken); + } + fromTextDocument(textDocument, uri, token2) { + uri = uri ?? URI2.parse(textDocument.uri); + if (cancellation_exports.CancellationToken.is(token2)) { + return this.createAsync(uri, textDocument, token2); + } else { + return this.create(uri, textDocument, token2); + } + } + fromString(text4, uri, token2) { + if (cancellation_exports.CancellationToken.is(token2)) { + return this.createAsync(uri, text4, token2); + } else { + return this.create(uri, text4, token2); + } + } + fromModel(model, uri) { + return this.create(uri, { $model: model }); + } + create(uri, content, options2) { + if (typeof content === "string") { + const parseResult = this.parse(uri, content, options2); + return this.createLangiumDocument(parseResult, uri, void 0, content); + } else if ("$model" in content) { + const parseResult = { value: content.$model, parserErrors: [], lexerErrors: [] }; + return this.createLangiumDocument(parseResult, uri); + } else { + const parseResult = this.parse(uri, content.getText(), options2); + return this.createLangiumDocument(parseResult, uri, content); + } + } + async createAsync(uri, content, cancelToken) { + if (typeof content === "string") { + const parseResult = await this.parseAsync(uri, content, cancelToken); + return this.createLangiumDocument(parseResult, uri, void 0, content); + } else { + const parseResult = await this.parseAsync(uri, content.getText(), cancelToken); + return this.createLangiumDocument(parseResult, uri, content); + } + } + /** + * Create a LangiumDocument from a given parse result. + * + * A TextDocument is created on demand if it is not provided as argument here. Usually this + * should not be necessary because the main purpose of the TextDocument is to convert between + * text ranges and offsets, which is done solely in LSP request handling. + * + * With the introduction of {@link update} below this method is supposed to be mainly called + * during workspace initialization and on addition/recognition of new files, while changes in + * existing documents are processed via {@link update}. + */ + createLangiumDocument(parseResult, uri, textDocument, text4) { + let document2; + if (textDocument) { + document2 = { + parseResult, + uri, + state: DocumentState.Parsed, + references: [], + textDocument + }; + } else { + const textDocumentGetter = this.createTextDocumentGetter(uri, text4); + document2 = { + parseResult, + uri, + state: DocumentState.Parsed, + references: [], + get textDocument() { + return textDocumentGetter(); + } + }; + } + parseResult.value.$document = document2; + return document2; + } + async update(document2, cancellationToken) { + const oldText = document2.parseResult.value.$cstNode?.root.fullText; + const textDocument = this.textDocuments?.get(document2.uri.toString()); + const text4 = textDocument ? textDocument.getText() : await this.fileSystemProvider.readFile(document2.uri); + if (textDocument) { + Object.defineProperty(document2, "textDocument", { + value: textDocument + }); + } else { + const textDocumentGetter = this.createTextDocumentGetter(document2.uri, text4); + Object.defineProperty(document2, "textDocument", { + get: textDocumentGetter + }); + } + if (oldText !== text4) { + document2.parseResult = await this.parseAsync(document2.uri, text4, cancellationToken); + document2.parseResult.value.$document = document2; + } + document2.state = DocumentState.Parsed; + return document2; + } + parse(uri, text4, options2) { + const services = this.serviceRegistry.getServices(uri); + return services.parser.LangiumParser.parse(text4, options2); + } + parseAsync(uri, text4, cancellationToken) { + const services = this.serviceRegistry.getServices(uri); + return services.parser.AsyncParser.parse(text4, cancellationToken); + } + createTextDocumentGetter(uri, text4) { + const serviceRegistry = this.serviceRegistry; + let textDoc = void 0; + return () => { + return textDoc ?? (textDoc = TextDocument2.create(uri.toString(), serviceRegistry.getServices(uri).LanguageMetaData.languageId, 0, text4 ?? "")); + }; + } + }; + DefaultLangiumDocuments = class { + static { + __name(this, "DefaultLangiumDocuments"); + } + static { + __name2(this, "DefaultLangiumDocuments"); + } + constructor(services) { + this.documentTrie = new UriTrie(); + this.services = services; + this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory; + this.documentBuilder = () => services.workspace.DocumentBuilder; + } + get all() { + return stream(this.documentTrie.all()); + } + addDocument(document2) { + const uriString = document2.uri.toString(); + if (this.documentTrie.has(uriString)) { + throw new Error(`A document with the URI '${uriString}' is already present.`); + } + this.documentTrie.insert(uriString, document2); + } + getDocument(uri) { + const uriString = uri.toString(); + return this.documentTrie.find(uriString); + } + getDocuments(folder) { + const uriString = folder.toString(); + return this.documentTrie.findAll(uriString); + } + async getOrCreateDocument(uri, cancellationToken) { + let document2 = this.getDocument(uri); + if (document2) { + return document2; + } + document2 = await this.langiumDocumentFactory.fromUri(uri, cancellationToken); + this.addDocument(document2); + return document2; + } + createDocument(uri, text4, cancellationToken) { + if (cancellationToken) { + return this.langiumDocumentFactory.fromString(text4, uri, cancellationToken).then((document2) => { + this.addDocument(document2); + return document2; + }); + } else { + const document2 = this.langiumDocumentFactory.fromString(text4, uri); + this.addDocument(document2); + return document2; + } + } + hasDocument(uri) { + return this.documentTrie.has(uri.toString()); + } + /** + * @deprecated Since 4.2 use `DocumentBuilder.resetToState(DocumentState.Changed)` instead + * TODO remove this for the next major release + */ + invalidateDocument(uri) { + const uriString = uri.toString(); + const langiumDoc = this.documentTrie.find(uriString); + if (langiumDoc) { + this.documentBuilder().resetToState(langiumDoc, DocumentState.Changed); + } + return langiumDoc; + } + deleteDocument(uri) { + const uriString = uri.toString(); + const langiumDoc = this.documentTrie.find(uriString); + if (langiumDoc) { + langiumDoc.state = DocumentState.Changed; + this.documentTrie.delete(uriString); + } + return langiumDoc; + } + deleteDocuments(folder) { + const uriString = folder.toString(); + const langiumDocs = this.documentTrie.findAll(uriString); + for (const langiumDoc of langiumDocs) { + langiumDoc.state = DocumentState.Changed; + } + this.documentTrie.delete(uriString); + return langiumDocs; + } + }; + RefResolving = Symbol("RefResolving"); + DefaultLinker = class { + static { + __name(this, "DefaultLinker"); + } + static { + __name2(this, "DefaultLinker"); + } + constructor(services) { + this.reflection = services.shared.AstReflection; + this.langiumDocuments = () => services.shared.workspace.LangiumDocuments; + this.scopeProvider = services.references.ScopeProvider; + this.astNodeLocator = services.workspace.AstNodeLocator; + this.profiler = services.shared.profilers.LangiumProfiler; + this.languageId = services.LanguageMetaData.languageId; + } + async link(document2, cancelToken = cancellation_exports.CancellationToken.None) { + if (this.profiler?.isActive("linking")) { + const task = this.profiler.createTask("linking", this.languageId); + task.start(); + try { + for (const node2 of streamAst(document2.parseResult.value)) { + await interruptAndCheck(cancelToken); + streamReferences(node2).forEach((ref) => { + const name = `${node2.$type}:${ref.property}`; + task.startSubTask(name); + try { + this.doLink(ref, document2); + } finally { + task.stopSubTask(name); + } + }); + } + } finally { + task.stop(); + } + } else { + for (const node2 of streamAst(document2.parseResult.value)) { + await interruptAndCheck(cancelToken); + streamReferences(node2).forEach((ref) => this.doLink(ref, document2)); + } + } + } + doLink(refInfo, document2) { + const ref = refInfo.reference; + if ("_ref" in ref && ref._ref === void 0) { + ref._ref = RefResolving; + try { + const description = this.getCandidate(refInfo); + if (isLinkingError(description)) { + ref._ref = description; + } else { + ref._nodeDescription = description; + const linkedNode = this.loadAstNode(description); + ref._ref = linkedNode ?? this.createLinkingError(refInfo, description); + } + } catch (err) { + console.error(`An error occurred while resolving reference to '${ref.$refText}':`, err); + const errorMessage = err.message ?? String(err); + ref._ref = { + info: refInfo, + message: `An error occurred while resolving reference to '${ref.$refText}': ${errorMessage}` + }; + } + document2.references.push(ref); + } else if ("_items" in ref && ref._items === void 0) { + ref._items = RefResolving; + try { + const descriptions = this.getCandidates(refInfo); + const items = []; + if (isLinkingError(descriptions)) { + ref._linkingError = descriptions; + } else { + for (const description of descriptions) { + const linkedNode = this.loadAstNode(description); + if (linkedNode) { + items.push({ ref: linkedNode, $nodeDescription: description }); + } + } + } + ref._items = items; + } catch (err) { + ref._linkingError = { + info: refInfo, + message: `An error occurred while resolving reference to '${ref.$refText}': ${err}` + }; + ref._items = []; + } + document2.references.push(ref); + } + } + unlink(document2) { + for (const ref of document2.references) { + if ("_ref" in ref) { + ref._ref = void 0; + delete ref._nodeDescription; + } else if ("_items" in ref) { + ref._items = void 0; + delete ref._linkingError; + } + } + document2.references = []; + } + getCandidate(refInfo) { + const scope = this.scopeProvider.getScope(refInfo); + const description = scope.getElement(refInfo.reference.$refText); + return description ?? this.createLinkingError(refInfo); + } + getCandidates(refInfo) { + const scope = this.scopeProvider.getScope(refInfo); + const descriptions = scope.getElements(refInfo.reference.$refText).distinct((desc) => `${desc.documentUri}#${desc.path}`).toArray(); + return descriptions.length > 0 ? descriptions : this.createLinkingError(refInfo); + } + buildReference(node2, property3, refNode, refText) { + const linker = this; + const reference = { + $refNode: refNode, + $refText: refText, + _ref: void 0, + get ref() { + if (isAstNode(this._ref)) { + return this._ref; + } else if (isAstNodeDescription(this._nodeDescription)) { + const linkedNode = linker.loadAstNode(this._nodeDescription); + this._ref = linkedNode ?? linker.createLinkingError({ reference, container: node2, property: property3 }, this._nodeDescription); + } else if (this._ref === void 0) { + this._ref = RefResolving; + const document2 = findRootNode(node2).$document; + const refData = linker.getLinkedNode({ reference, container: node2, property: property3 }); + if (refData.error && document2 && document2.state < DocumentState.ComputedScopes) { + return this._ref = void 0; + } + this._ref = refData.node ?? refData.error; + this._nodeDescription = refData.descr; + document2?.references.push(this); + } else if (this._ref === RefResolving) { + linker.throwCyclicReferenceError(node2, property3, refText); + } + return isAstNode(this._ref) ? this._ref : void 0; + }, + get $nodeDescription() { + return this._nodeDescription; + }, + get error() { + return isLinkingError(this._ref) ? this._ref : void 0; + } + }; + return reference; + } + buildMultiReference(node2, property3, refNode, refText) { + const linker = this; + const reference = { + $refNode: refNode, + $refText: refText, + _items: void 0, + get items() { + if (Array.isArray(this._items)) { + return this._items; + } else if (this._items === void 0) { + this._items = RefResolving; + const document2 = findRootNode(node2).$document; + const descriptions = linker.getCandidates({ + reference, + container: node2, + property: property3 + }); + const items = []; + if (isLinkingError(descriptions)) { + this._linkingError = descriptions; + } else { + for (const description of descriptions) { + const linkedNode = linker.loadAstNode(description); + if (linkedNode) { + items.push({ ref: linkedNode, $nodeDescription: description }); + } + } + } + this._items = items; + document2?.references.push(this); + } else if (this._items === RefResolving) { + linker.throwCyclicReferenceError(node2, property3, refText); + } + return Array.isArray(this._items) ? this._items : []; + }, + get error() { + if (this._linkingError) { + return this._linkingError; + } + const refs = this.items; + if (refs.length > 0) { + return void 0; + } else { + return this._linkingError = linker.createLinkingError({ reference, container: node2, property: property3 }); + } + } + }; + return reference; + } + throwCyclicReferenceError(node2, property3, refText) { + throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(node2)}/${property3} (symbol '${refText}')`); + } + getLinkedNode(refInfo) { + try { + const description = this.getCandidate(refInfo); + if (isLinkingError(description)) { + return { error: description }; + } + const linkedNode = this.loadAstNode(description); + if (linkedNode) { + return { node: linkedNode, descr: description }; + } else { + return { + descr: description, + error: this.createLinkingError(refInfo, description) + }; + } + } catch (err) { + console.error(`An error occurred while resolving reference to '${refInfo.reference.$refText}':`, err); + const errorMessage = err.message ?? String(err); + return { + error: { + info: refInfo, + message: `An error occurred while resolving reference to '${refInfo.reference.$refText}': ${errorMessage}` + } + }; + } + } + loadAstNode(nodeDescription) { + if (nodeDescription.node) { + return nodeDescription.node; + } + const doc = this.langiumDocuments().getDocument(nodeDescription.documentUri); + if (!doc) { + return void 0; + } + return this.astNodeLocator.getAstNode(doc.parseResult.value, nodeDescription.path); + } + createLinkingError(refInfo, targetDescription) { + const document2 = findRootNode(refInfo.container).$document; + if (document2 && document2.state < DocumentState.ComputedScopes) { + console.warn(`Attempted reference resolution before document reached ComputedScopes state (${document2.uri}).`); + } + const referenceType = this.reflection.getReferenceType(refInfo); + return { + info: refInfo, + message: `Could not resolve reference to ${referenceType} named '${refInfo.reference.$refText}'.`, + targetDescription + }; + } + }; + __name(isNamed, "isNamed"); + __name2(isNamed, "isNamed"); + DefaultNameProvider = class { + static { + __name(this, "DefaultNameProvider"); + } + static { + __name2(this, "DefaultNameProvider"); + } + getName(node2) { + if (isNamed(node2)) { + return node2.name; + } + return void 0; + } + getNameNode(node2) { + return findNodeForProperty(node2.$cstNode, "name"); + } + }; + DefaultReferences = class { + static { + __name(this, "DefaultReferences"); + } + static { + __name2(this, "DefaultReferences"); + } + constructor(services) { + this.nameProvider = services.references.NameProvider; + this.index = services.shared.workspace.IndexManager; + this.nodeLocator = services.workspace.AstNodeLocator; + this.documents = services.shared.workspace.LangiumDocuments; + this.hasMultiReference = streamAst(services.Grammar).some((node2) => isCrossReference(node2) && node2.isMulti); + } + findDeclarations(sourceCstNode) { + if (sourceCstNode) { + const assignment = findAssignment(sourceCstNode); + const nodeElem = sourceCstNode.astNode; + if (assignment && nodeElem) { + const reference = nodeElem[assignment.feature]; + if (isReference(reference) || isMultiReference(reference)) { + return getReferenceNodes(reference); + } else if (Array.isArray(reference)) { + for (const ref of reference) { + if ((isReference(ref) || isMultiReference(ref)) && ref.$refNode && ref.$refNode.offset <= sourceCstNode.offset && ref.$refNode.end >= sourceCstNode.end) { + return getReferenceNodes(ref); + } + } + } + } + if (nodeElem) { + const nameNode = this.nameProvider.getNameNode(nodeElem); + if (nameNode && (nameNode === sourceCstNode || isChildNode(sourceCstNode, nameNode))) { + return this.getSelfNodes(nodeElem); + } + } + } + return []; + } + /** + * Returns all self-references for the specified node. + * Since the node can be part of a multi-reference, this method returns all nodes that are part of the same multi-reference. + */ + getSelfNodes(node2) { + if (!this.hasMultiReference) { + return [node2]; + } else { + const references = this.index.findAllReferences(node2, this.nodeLocator.getAstNodePath(node2)); + const headNode = this.getNodeFromReferenceDescription(references.head()); + if (headNode) { + for (const ref of streamReferences(headNode)) { + if (isMultiReference(ref.reference) && ref.reference.items.some((item) => item.ref === node2)) { + return ref.reference.items.map((item) => item.ref); + } + } + } + return [node2]; + } + } + getNodeFromReferenceDescription(ref) { + if (!ref) { + return void 0; + } + const doc = this.documents.getDocument(ref.sourceUri); + if (doc) { + return this.nodeLocator.getAstNode(doc.parseResult.value, ref.sourcePath); + } + return void 0; + } + findDeclarationNodes(sourceCstNode) { + const astNodes = this.findDeclarations(sourceCstNode); + const cstNodes = []; + for (const astNode of astNodes) { + const cstNode = this.nameProvider.getNameNode(astNode) ?? astNode.$cstNode; + if (cstNode) { + cstNodes.push(cstNode); + } + } + return cstNodes; + } + findReferences(targetNode, options2) { + const refs = []; + if (options2.includeDeclaration) { + refs.push(...this.getSelfReferences(targetNode)); + } + let indexReferences = this.index.findAllReferences(targetNode, this.nodeLocator.getAstNodePath(targetNode)); + if (options2.documentUri) { + indexReferences = indexReferences.filter((ref) => UriUtils.equals(ref.sourceUri, options2.documentUri)); + } + refs.push(...indexReferences); + return stream(refs); + } + getSelfReferences(targetNode) { + const selfNodes = this.getSelfNodes(targetNode); + const references = []; + for (const selfNode of selfNodes) { + const nameNode = this.nameProvider.getNameNode(selfNode); + if (nameNode) { + const doc = getDocument(selfNode); + const path4 = this.nodeLocator.getAstNodePath(selfNode); + references.push({ + sourceUri: doc.uri, + sourcePath: path4, + targetUri: doc.uri, + targetPath: path4, + segment: toDocumentSegment(nameNode), + local: true + }); + } + } + return references; + } + }; + MultiMap = class { + static { + __name(this, "MultiMap"); + } + static { + __name2(this, "MultiMap"); + } + constructor(elements2) { + this.map = /* @__PURE__ */ new Map(); + if (elements2) { + for (const [key, value2] of elements2) { + this.add(key, value2); + } + } + } + /** + * The total number of values in the multimap. + */ + get size() { + return Reduction.sum(stream(this.map.values()).map((a2) => a2.length)); + } + /** + * Clear all entries in the multimap. + */ + clear() { + this.map.clear(); + } + /** + * Operates differently depending on whether a `value` is given: + * * With a value, this method deletes the specific key / value pair from the multimap. + * * Without a value, all values associated with the given key are deleted. + * + * @returns `true` if a value existed and has been removed, or `false` if the specified + * key / value does not exist. + */ + delete(key, value2) { + if (value2 === void 0) { + return this.map.delete(key); + } else { + const values22 = this.map.get(key); + if (values22) { + const index = values22.indexOf(value2); + if (index >= 0) { + if (values22.length === 1) { + this.map.delete(key); + } else { + values22.splice(index, 1); + } + return true; + } + } + return false; + } + } + /** + * Returns an array of all values associated with the given key. If no value exists, + * an empty array is returned. + * + * _Note:_ The returned array is assumed not to be modified. Use the `set` method to add a + * value and `delete` to remove a value from the multimap. + */ + get(key) { + return this.map.get(key) ?? []; + } + /** + * Returns a stream of all values associated with the given key. If no value exists, + * {@link EMPTY_STREAM} is returned. + */ + getStream(key) { + const values22 = this.map.get(key); + return values22 ? stream(values22) : EMPTY_STREAM; + } + /** + * Operates differently depending on whether a `value` is given: + * * With a value, this method returns `true` if the specific key / value pair is present in the multimap. + * * Without a value, this method returns `true` if the given key is present in the multimap. + */ + has(key, value2) { + if (value2 === void 0) { + return this.map.has(key); + } else { + const values22 = this.map.get(key); + if (values22) { + return values22.indexOf(value2) >= 0; + } + return false; + } + } + /** + * Add the given key / value pair to the multimap. + */ + add(key, value2) { + if (this.map.has(key)) { + this.map.get(key).push(value2); + } else { + this.map.set(key, [value2]); + } + return this; + } + /** + * Add the given set of key / value pairs to the multimap. + */ + addAll(key, values22) { + if (this.map.has(key)) { + this.map.get(key).push(...values22); + } else { + this.map.set(key, Array.from(values22)); + } + return this; + } + /** + * Invokes the given callback function for every key / value pair in the multimap. + */ + forEach(callbackfn) { + this.map.forEach((array4, key) => array4.forEach((value2) => callbackfn(value2, key, this))); + } + /** + * Returns an iterator of key, value pairs for every entry in the map. + */ + [Symbol.iterator]() { + return this.entries().iterator(); + } + /** + * Returns a stream of key, value pairs for every entry in the map. + */ + entries() { + return stream(this.map.entries()).flatMap(([key, array4]) => array4.map((value2) => [key, value2])); + } + /** + * Returns a stream of keys in the map. + */ + keys() { + return stream(this.map.keys()); + } + /** + * Returns a stream of values in the map. + */ + values() { + return stream(this.map.values()).flat(); + } + /** + * Returns a stream of key, value set pairs for every key in the map. + */ + entriesGroupedByKey() { + return stream(this.map.entries()); + } + }; + BiMap = class { + static { + __name(this, "BiMap"); + } + static { + __name2(this, "BiMap"); + } + get size() { + return this.map.size; + } + constructor(elements2) { + this.map = /* @__PURE__ */ new Map(); + this.inverse = /* @__PURE__ */ new Map(); + if (elements2) { + for (const [key, value2] of elements2) { + this.set(key, value2); + } + } + } + clear() { + this.map.clear(); + this.inverse.clear(); + } + set(key, value2) { + this.map.set(key, value2); + this.inverse.set(value2, key); + return this; + } + get(key) { + return this.map.get(key); + } + getKey(value2) { + return this.inverse.get(value2); + } + delete(key) { + const value2 = this.map.get(key); + if (value2 !== void 0) { + this.map.delete(key); + this.inverse.delete(value2); + return true; + } + return false; + } + }; + DefaultScopeComputation = class { + static { + __name(this, "DefaultScopeComputation"); + } + static { + __name2(this, "DefaultScopeComputation"); + } + constructor(services) { + this.nameProvider = services.references.NameProvider; + this.descriptions = services.workspace.AstNodeDescriptionProvider; + } + async collectExportedSymbols(document2, cancelToken = cancellation_exports.CancellationToken.None) { + return this.collectExportedSymbolsForNode(document2.parseResult.value, document2, void 0, cancelToken); + } + /** + * Creates {@link AstNodeDescription AstNodeDescriptions} for the given {@link AstNode parentNode} and its children. + * The list of children to be considered is determined by the function parameter {@link children}. + * By default only the direct children of {@link parentNode} are visited, nested nodes are not exported. + * + * @param parentNode AST node to be exported, i.e., of which an {@link AstNodeDescription} shall be added to the returned list. + * @param document The document containing the AST node to be exported. + * @param children A function called with {@link parentNode} as single argument and returning an {@link Iterable} supplying the children to be visited, which must be directly or transitively contained in {@link parentNode}. + * @param cancelToken Indicates when to cancel the current operation. + * @throws `OperationCancelled` if a user action occurs during execution. + * @returns A list of {@link AstNodeDescription AstNodeDescriptions} to be published to index. + */ + async collectExportedSymbolsForNode(parentNode, document2, children2 = streamContents, cancelToken = cancellation_exports.CancellationToken.None) { + const exports2 = []; + this.addExportedSymbol(parentNode, exports2, document2); + for (const node2 of children2(parentNode)) { + await interruptAndCheck(cancelToken); + this.addExportedSymbol(node2, exports2, document2); + } + return exports2; + } + /** + * Adds a single node to the list of exports if it has a name. Override this method to change how + * symbols are exported, e.g. by modifying their exported name. + */ + addExportedSymbol(node2, exports2, document2) { + const name = this.nameProvider.getName(node2); + if (name) { + exports2.push(this.descriptions.createDescription(node2, name, document2)); + } + } + // --- local symbols gathering --- + async collectLocalSymbols(document2, cancelToken = cancellation_exports.CancellationToken.None) { + const rootNode = document2.parseResult.value; + const symbols2 = new MultiMap(); + for (const node2 of streamAllContents(rootNode)) { + await interruptAndCheck(cancelToken); + this.addLocalSymbol(node2, document2, symbols2); + } + return symbols2; + } + /** + * Adds a single node to the local symbols of its containing document if it has a name. + * The default implementation makes the node visible in the subtree of its container if it does have a container. + * Override this method to change this, e.g. by increasing the visibility to a higher level in the AST. + */ + addLocalSymbol(node2, document2, symbols2) { + const container2 = node2.$container; + if (container2) { + const name = this.nameProvider.getName(node2); + if (name) { + symbols2.add(container2, this.descriptions.createDescription(node2, name, document2)); + } + } + } + }; + StreamScope = class { + static { + __name(this, "StreamScope"); + } + static { + __name2(this, "StreamScope"); + } + constructor(elements2, outerScope, options2) { + this.elements = elements2; + this.outerScope = outerScope; + this.caseInsensitive = options2?.caseInsensitive ?? false; + this.concatOuterScope = options2?.concatOuterScope ?? true; + } + getAllElements() { + if (this.outerScope) { + return this.elements.concat(this.outerScope.getAllElements()); + } else { + return this.elements; + } + } + getElement(name) { + const lowerCaseName = this.caseInsensitive ? name.toLowerCase() : name; + const local = this.caseInsensitive ? this.elements.find((e3) => e3.name.toLowerCase() === lowerCaseName) : this.elements.find((e3) => e3.name === name); + if (local) { + return local; + } + if (this.outerScope) { + return this.outerScope.getElement(name); + } + return void 0; + } + getElements(name) { + const lowerCaseName = this.caseInsensitive ? name.toLowerCase() : name; + const local = this.caseInsensitive ? this.elements.filter((e3) => e3.name.toLowerCase() === lowerCaseName) : this.elements.filter((e3) => e3.name === name); + if ((this.concatOuterScope || local.isEmpty()) && this.outerScope) { + return local.concat(this.outerScope.getElements(name)); + } else { + return local; + } + } + }; + MapScope = class { + static { + __name(this, "MapScope"); + } + static { + __name2(this, "MapScope"); + } + constructor(elements2, outerScope, options2) { + this.elements = /* @__PURE__ */ new Map(); + this.caseInsensitive = options2?.caseInsensitive ?? false; + this.concatOuterScope = options2?.concatOuterScope ?? true; + for (const element3 of elements2) { + const name = this.caseInsensitive ? element3.name.toLowerCase() : element3.name; + this.elements.set(name, element3); + } + this.outerScope = outerScope; + } + getElement(name) { + const localName = this.caseInsensitive ? name.toLowerCase() : name; + const local = this.elements.get(localName); + if (local) { + return local; + } + if (this.outerScope) { + return this.outerScope.getElement(name); + } + return void 0; + } + getElements(name) { + const localName = this.caseInsensitive ? name.toLowerCase() : name; + const local = this.elements.get(localName); + const arr = local ? [local] : []; + if ((this.concatOuterScope || arr.length > 0) && this.outerScope) { + return stream(arr).concat(this.outerScope.getElements(name)); + } else { + return stream(arr); + } + } + getAllElements() { + let elementStream = stream(this.elements.values()); + if (this.outerScope) { + elementStream = elementStream.concat(this.outerScope.getAllElements()); + } + return elementStream; + } + }; + MultiMapScope = class { + static { + __name(this, "MultiMapScope"); + } + static { + __name2(this, "MultiMapScope"); + } + constructor(elements2, outerScope, options2) { + this.elements = new MultiMap(); + this.caseInsensitive = options2?.caseInsensitive ?? false; + this.concatOuterScope = options2?.concatOuterScope ?? true; + for (const element3 of elements2) { + const name = this.caseInsensitive ? element3.name.toLowerCase() : element3.name; + this.elements.add(name, element3); + } + this.outerScope = outerScope; + } + getElement(name) { + const localName = this.caseInsensitive ? name.toLowerCase() : name; + const local = this.elements.get(localName)[0]; + if (local) { + return local; + } + if (this.outerScope) { + return this.outerScope.getElement(name); + } + return void 0; + } + getElements(name) { + const localName = this.caseInsensitive ? name.toLowerCase() : name; + const local = this.elements.get(localName); + if ((this.concatOuterScope || local.length === 0) && this.outerScope) { + return stream(local).concat(this.outerScope.getElements(name)); + } else { + return stream(local); + } + } + getAllElements() { + let elementStream = stream(this.elements.values()); + if (this.outerScope) { + elementStream = elementStream.concat(this.outerScope.getAllElements()); + } + return elementStream; + } + }; + EMPTY_SCOPE = { + getElement() { + return void 0; + }, + getElements() { + return EMPTY_STREAM; + }, + getAllElements() { + return EMPTY_STREAM; + } + }; + DisposableCache = class { + static { + __name(this, "DisposableCache"); + } + static { + __name2(this, "DisposableCache"); + } + constructor() { + this.toDispose = []; + this.isDisposed = false; + } + onDispose(disposable) { + this.toDispose.push(disposable); + } + dispose() { + this.throwIfDisposed(); + this.clear(); + this.isDisposed = true; + this.toDispose.forEach((disposable) => disposable.dispose()); + } + throwIfDisposed() { + if (this.isDisposed) { + throw new Error("This cache has already been disposed"); + } + } + }; + SimpleCache = class extends DisposableCache { + static { + __name(this, "SimpleCache"); + } + static { + __name2(this, "SimpleCache"); + } + constructor() { + super(...arguments); + this.cache = /* @__PURE__ */ new Map(); + } + has(key) { + this.throwIfDisposed(); + return this.cache.has(key); + } + set(key, value2) { + this.throwIfDisposed(); + this.cache.set(key, value2); + } + get(key, provider) { + this.throwIfDisposed(); + if (this.cache.has(key)) { + return this.cache.get(key); + } else if (provider) { + const value2 = provider(); + this.cache.set(key, value2); + return value2; + } else { + return void 0; + } + } + delete(key) { + this.throwIfDisposed(); + return this.cache.delete(key); + } + clear() { + this.throwIfDisposed(); + this.cache.clear(); + } + }; + ContextCache = class extends DisposableCache { + static { + __name(this, "ContextCache"); + } + static { + __name2(this, "ContextCache"); + } + constructor(converter) { + super(); + this.cache = /* @__PURE__ */ new Map(); + this.converter = converter ?? ((value2) => value2); + } + has(contextKey, key) { + this.throwIfDisposed(); + return this.cacheForContext(contextKey).has(key); + } + set(contextKey, key, value2) { + this.throwIfDisposed(); + this.cacheForContext(contextKey).set(key, value2); + } + get(contextKey, key, provider) { + this.throwIfDisposed(); + const contextCache = this.cacheForContext(contextKey); + if (contextCache.has(key)) { + return contextCache.get(key); + } else if (provider) { + const value2 = provider(); + contextCache.set(key, value2); + return value2; + } else { + return void 0; + } + } + delete(contextKey, key) { + this.throwIfDisposed(); + return this.cacheForContext(contextKey).delete(key); + } + clear(contextKey) { + this.throwIfDisposed(); + if (contextKey) { + const mapKey = this.converter(contextKey); + this.cache.delete(mapKey); + } else { + this.cache.clear(); + } + } + cacheForContext(contextKey) { + const mapKey = this.converter(contextKey); + let documentCache = this.cache.get(mapKey); + if (!documentCache) { + documentCache = /* @__PURE__ */ new Map(); + this.cache.set(mapKey, documentCache); + } + return documentCache; + } + }; + DocumentCache = class extends ContextCache { + static { + __name(this, "DocumentCache"); + } + static { + __name2(this, "DocumentCache"); + } + /** + * Creates a new document cache. + * + * @param sharedServices Service container instance to hook into document lifecycle events. + * @param state Optional document state on which the cache should evict. + * If not provided, the cache will evict on `DocumentBuilder#onUpdate`. + * *Deleted* documents are considered in both cases. + * + * Providing a state here will use `DocumentBuilder#onDocumentPhase` instead, + * which triggers on all documents that have been affected by this change, assuming that the + * state is `DocumentState.Linked` or a later state. + */ + constructor(sharedServices, state4) { + super((uri) => uri.toString()); + if (state4) { + this.toDispose.push(sharedServices.workspace.DocumentBuilder.onDocumentPhase(state4, (document2) => { + this.clear(document2.uri.toString()); + })); + this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((_changed, deleted) => { + for (const uri of deleted) { + this.clear(uri); + } + })); + } else { + this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((changed, deleted) => { + const allUris = changed.concat(deleted); + for (const uri of allUris) { + this.clear(uri); + } + })); + } + } + }; + WorkspaceCache = class extends SimpleCache { + static { + __name(this, "WorkspaceCache"); + } + static { + __name2(this, "WorkspaceCache"); + } + /** + * Creates a new workspace cache. + * + * @param sharedServices Service container instance to hook into document lifecycle events. + * @param state Optional document state on which the cache should evict. + * If not provided, the cache will evict on `DocumentBuilder#onUpdate`. + * *Deleted* documents are considered in both cases. + */ + constructor(sharedServices, state4) { + super(); + if (state4) { + this.toDispose.push(sharedServices.workspace.DocumentBuilder.onBuildPhase(state4, () => { + this.clear(); + })); + this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate((_changed, deleted) => { + if (deleted.length > 0) { + this.clear(); + } + })); + } else { + this.toDispose.push(sharedServices.workspace.DocumentBuilder.onUpdate(() => { + this.clear(); + })); + } + } + }; + DefaultScopeProvider = class { + static { + __name(this, "DefaultScopeProvider"); + } + static { + __name2(this, "DefaultScopeProvider"); + } + constructor(services) { + this.reflection = services.shared.AstReflection; + this.nameProvider = services.references.NameProvider; + this.descriptions = services.workspace.AstNodeDescriptionProvider; + this.indexManager = services.shared.workspace.IndexManager; + this.globalScopeCache = new WorkspaceCache(services.shared); + } + getScope(context) { + const scopes = []; + const referenceType = this.reflection.getReferenceType(context); + const localSymbols = getDocument(context.container).localSymbols; + if (localSymbols) { + let currentNode = context.container; + do { + if (localSymbols.has(currentNode)) { + scopes.push(localSymbols.getStream(currentNode).filter((desc) => this.reflection.isSubtype(desc.type, referenceType))); + } + currentNode = currentNode.$container; + } while (currentNode); + } + let result = this.getGlobalScope(referenceType, context); + for (let i2 = scopes.length - 1; i2 >= 0; i2--) { + result = this.createScope(scopes[i2], result); + } + return result; + } + /** + * Create a scope for the given collection of AST node descriptions. + */ + createScope(elements2, outerScope, options2) { + return new StreamScope(stream(elements2), outerScope, options2); + } + /** + * Create a scope for the given collection of AST nodes, which need to be transformed into respective + * descriptions first. This is done using the `NameProvider` and `AstNodeDescriptionProvider` services. + */ + createScopeForNodes(elements2, outerScope, options2) { + const s2 = stream(elements2).map((e3) => { + const name = this.nameProvider.getName(e3); + if (name) { + return this.descriptions.createDescription(e3, name); + } + return void 0; + }).nonNullable(); + return new StreamScope(s2, outerScope, options2); + } + /** + * Create a global scope filtered for the given reference type. + */ + getGlobalScope(referenceType, _context) { + return this.globalScopeCache.get(referenceType, () => new MultiMapScope(this.indexManager.allElements(referenceType))); + } + }; + __name(isAstNodeWithComment, "isAstNodeWithComment"); + __name2(isAstNodeWithComment, "isAstNodeWithComment"); + __name(isIntermediateReference, "isIntermediateReference"); + __name2(isIntermediateReference, "isIntermediateReference"); + DefaultJsonSerializer = class { + static { + __name(this, "DefaultJsonSerializer"); + } + static { + __name2(this, "DefaultJsonSerializer"); + } + constructor(services) { + this.ignoreProperties = /* @__PURE__ */ new Set(["$container", "$containerProperty", "$containerIndex", "$document", "$cstNode"]); + this.langiumDocuments = services.shared.workspace.LangiumDocuments; + this.astNodeLocator = services.workspace.AstNodeLocator; + this.nameProvider = services.references.NameProvider; + this.commentProvider = services.documentation.CommentProvider; + } + serialize(node2, options2) { + const serializeOptions = options2 ?? {}; + const specificReplacer = options2?.replacer; + const defaultReplacer = /* @__PURE__ */ __name2((key, value2) => this.replacer(key, value2, serializeOptions), "defaultReplacer"); + const replacer = specificReplacer ? (key, value2) => specificReplacer(key, value2, defaultReplacer) : defaultReplacer; + try { + this.currentDocument = getDocument(node2); + return JSON.stringify(node2, replacer, options2?.space); + } finally { + this.currentDocument = void 0; + } + } + deserialize(content, options2) { + const deserializeOptions = options2 ?? {}; + const root32 = JSON.parse(content); + this.linkNode(root32, root32, deserializeOptions); + return root32; + } + replacer(key, value2, { refText, sourceText, textRegions, comments, uriConverter }) { + if (this.ignoreProperties.has(key)) { + return void 0; + } else if (isReference(value2)) { + const refValue = value2.ref; + const $refText = refText ? value2.$refText : void 0; + if (refValue) { + const targetDocument = getDocument(refValue); + let targetUri = ""; + if (this.currentDocument && this.currentDocument !== targetDocument) { + if (uriConverter) { + targetUri = uriConverter(targetDocument.uri, refValue); + } else { + targetUri = targetDocument.uri.toString(); + } + } + const targetPath = this.astNodeLocator.getAstNodePath(refValue); + return { + $ref: `${targetUri}#${targetPath}`, + $refText + }; + } else { + return { + $error: value2.error?.message ?? "Could not resolve reference", + $refText + }; + } + } else if (isMultiReference(value2)) { + const $refText = refText ? value2.$refText : void 0; + const $refs = []; + for (const item of value2.items) { + const refValue = item.ref; + const targetDocument = getDocument(item.ref); + let targetUri = ""; + if (this.currentDocument && this.currentDocument !== targetDocument) { + if (uriConverter) { + targetUri = uriConverter(targetDocument.uri, refValue); + } else { + targetUri = targetDocument.uri.toString(); + } + } + const targetPath = this.astNodeLocator.getAstNodePath(refValue); + $refs.push(`${targetUri}#${targetPath}`); + } + return { + $refs, + $refText + }; + } else if (isAstNode(value2)) { + let astNode = void 0; + if (textRegions) { + astNode = this.addAstNodeRegionWithAssignmentsTo({ ...value2 }); + if ((!key || value2.$document) && astNode?.$textRegion) { + astNode.$textRegion.documentURI = this.currentDocument?.uri.toString(); + } + } + if (sourceText && !key) { + astNode ?? (astNode = { ...value2 }); + astNode.$sourceText = value2.$cstNode?.text; + } + if (comments) { + astNode ?? (astNode = { ...value2 }); + const comment2 = this.commentProvider.getComment(value2); + if (comment2) { + astNode.$comment = comment2.replace(/\r/g, ""); + } + } + return astNode ?? value2; + } else { + return value2; + } + } + addAstNodeRegionWithAssignmentsTo(node2) { + const createDocumentSegment = /* @__PURE__ */ __name2((cstNode) => ({ + offset: cstNode.offset, + end: cstNode.end, + length: cstNode.length, + range: cstNode.range + }), "createDocumentSegment"); + if (node2.$cstNode) { + const textRegion = node2.$textRegion = createDocumentSegment(node2.$cstNode); + const assignments = textRegion.assignments = {}; + Object.keys(node2).filter((key) => !key.startsWith("$")).forEach((key) => { + const propertyAssignments = findNodesForProperty(node2.$cstNode, key).map(createDocumentSegment); + if (propertyAssignments.length !== 0) { + assignments[key] = propertyAssignments; + } + }); + return node2; + } + return void 0; + } + linkNode(node2, root32, options2, container2, containerProperty, containerIndex) { + for (const [propertyName, item] of Object.entries(node2)) { + if (Array.isArray(item)) { + for (let index = 0; index < item.length; index++) { + const element3 = item[index]; + if (isIntermediateReference(element3)) { + item[index] = this.reviveReference(node2, propertyName, root32, element3, options2); + } else if (isAstNode(element3)) { + this.linkNode(element3, root32, options2, node2, propertyName, index); + } + } + } else if (isIntermediateReference(item)) { + node2[propertyName] = this.reviveReference(node2, propertyName, root32, item, options2); + } else if (isAstNode(item)) { + this.linkNode(item, root32, options2, node2, propertyName); + } + } + const mutable = node2; + mutable.$container = container2; + mutable.$containerProperty = containerProperty; + mutable.$containerIndex = containerIndex; + } + reviveReference(container2, property3, root32, reference, options2) { + let refText = reference.$refText; + let error3 = reference.$error; + let ref; + if (reference.$ref) { + const refNode = this.getRefNode(root32, reference.$ref, options2.uriConverter); + if (isAstNode(refNode)) { + if (!refText) { + refText = this.nameProvider.getName(refNode); + } + return { + $refText: refText ?? "", + ref: refNode + }; + } else { + error3 = refNode; + } + } else if (reference.$refs) { + const refs = []; + for (const refUri of reference.$refs) { + const refNode = this.getRefNode(root32, refUri, options2.uriConverter); + if (isAstNode(refNode)) { + refs.push({ ref: refNode }); + } + } + if (refs.length === 0) { + ref = { + $refText: refText ?? "", + items: refs + }; + error3 ?? (error3 = "Could not resolve multi-reference"); + } else { + return { + $refText: refText ?? "", + items: refs + }; + } + } + if (error3) { + ref ?? (ref = { + $refText: refText ?? "", + ref: void 0 + }); + ref.error = { + info: { + container: container2, + property: property3, + reference: ref + }, + message: error3 + }; + return ref; + } else { + return void 0; + } + } + getRefNode(root32, uri, uriConverter) { + try { + const fragmentIndex = uri.indexOf("#"); + if (fragmentIndex === 0) { + const node22 = this.astNodeLocator.getAstNode(root32, uri.substring(1)); + if (!node22) { + return "Could not resolve path: " + uri; + } + return node22; + } + if (fragmentIndex < 0) { + const documentUri2 = uriConverter ? uriConverter(uri) : URI2.parse(uri); + const document22 = this.langiumDocuments.getDocument(documentUri2); + if (!document22) { + return "Could not find document for URI: " + uri; + } + return document22.parseResult.value; + } + const documentUri = uriConverter ? uriConverter(uri.substring(0, fragmentIndex)) : URI2.parse(uri.substring(0, fragmentIndex)); + const document2 = this.langiumDocuments.getDocument(documentUri); + if (!document2) { + return "Could not find document for URI: " + uri; + } + if (fragmentIndex === uri.length - 1) { + return document2.parseResult.value; + } + const node2 = this.astNodeLocator.getAstNode(document2.parseResult.value, uri.substring(fragmentIndex + 1)); + if (!node2) { + return "Could not resolve URI: " + uri; + } + return node2; + } catch (err) { + return String(err); + } + } + }; + DefaultServiceRegistry = class { + static { + __name(this, "DefaultServiceRegistry"); + } + static { + __name2(this, "DefaultServiceRegistry"); + } + /** + * @deprecated Since 3.1.0. Use the new `fileExtensionMap` (or `languageIdMap`) property instead. + */ + get map() { + return this.fileExtensionMap; + } + constructor(services) { + this.languageIdMap = /* @__PURE__ */ new Map(); + this.fileExtensionMap = /* @__PURE__ */ new Map(); + this.fileNameMap = /* @__PURE__ */ new Map(); + this.textDocuments = services?.workspace.TextDocuments; + } + register(language) { + const data5 = language.LanguageMetaData; + for (const ext of data5.fileExtensions) { + if (this.fileExtensionMap.has(ext)) { + console.warn(`The file extension ${ext} is used by multiple languages. It is now assigned to '${data5.languageId}'.`); + } + this.fileExtensionMap.set(ext, language); + } + if (data5.fileNames) { + for (const name of data5.fileNames) { + if (this.fileNameMap.has(name)) { + console.warn(`The file name ${name} is used by multiple languages. It is now assigned to '${data5.languageId}'.`); + } + this.fileNameMap.set(name, language); + } + } + this.languageIdMap.set(data5.languageId, language); + } + getServices(uri) { + if (this.languageIdMap.size === 0) { + throw new Error("The service registry is empty. Use `register` to register the services of a language."); + } + const languageId = this.textDocuments?.get(uri)?.languageId; + if (languageId !== void 0) { + const services2 = this.languageIdMap.get(languageId); + if (services2) { + return services2; + } + } + const ext = UriUtils.extname(uri); + const name = UriUtils.basename(uri); + const services = this.fileNameMap.get(name) ?? this.fileExtensionMap.get(ext); + if (!services) { + if (languageId) { + throw new Error(`The service registry contains no services for the extension '${ext}' for language '${languageId}'.`); + } else { + throw new Error(`The service registry contains no services for the extension '${ext}'.`); + } + } + return services; + } + hasServices(uri) { + try { + this.getServices(uri); + return true; + } catch { + return false; + } + } + get all() { + return Array.from(this.languageIdMap.values()); + } + }; + __name(diagnosticData, "diagnosticData"); + __name2(diagnosticData, "diagnosticData"); + (function(ValidationCategory2) { + ValidationCategory2.defaults = ["fast", "slow", "built-in"]; + ValidationCategory2.all = ValidationCategory2.defaults; + })(ValidationCategory || (ValidationCategory = {})); + ValidationRegistry = class { + static { + __name(this, "ValidationRegistry"); + } + static { + __name2(this, "ValidationRegistry"); + } + constructor(services) { + this.entries = new MultiMap(); + this.knownCategories = new Set(ValidationCategory.defaults); + this.entriesBefore = []; + this.entriesAfter = []; + this.reflection = services.shared.AstReflection; + } + /** + * Register a set of validation checks. Each value in the record can be either a single validation check (i.e. a function) + * or an array of validation checks. + * + * @param checksRecord Set of validation checks to register. + * @param thisObj Optional object to be used as `this` when calling the validation check functions. + * @param category Optional category for the validation checks (defaults to `'fast'`). + */ + register(checksRecord, thisObj = this, category = "fast") { + if (category === "built-in") { + throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors."); + } + this.knownCategories.add(category); + for (const [type3, ch] of Object.entries(checksRecord)) { + const callbacks = ch; + if (Array.isArray(callbacks)) { + for (const check of callbacks) { + const entry = { + check: this.wrapValidationException(check, thisObj), + category + }; + this.addEntry(type3, entry); + } + } else if (typeof callbacks === "function") { + const entry = { + check: this.wrapValidationException(callbacks, thisObj), + category + }; + this.addEntry(type3, entry); + } else { + assertUnreachable(callbacks); + } + } + } + wrapValidationException(check, thisObj) { + return async (node2, accept, cancelToken) => { + await this.handleException(() => check.call(thisObj, node2, accept, cancelToken), "An error occurred during validation", accept, node2); + }; + } + async handleException(functionality, messageContext, accept, node2) { + try { + await functionality(); + } catch (err) { + if (isOperationCancelled(err)) { + throw err; + } + console.error(`${messageContext}:`, err); + if (err instanceof Error && err.stack) { + console.error(err.stack); + } + const messageDetails = err instanceof Error ? err.message : String(err); + accept("error", `${messageContext}: ${messageDetails}`, { node: node2 }); + } + } + addEntry(type3, entry) { + if (type3 === "AstNode") { + this.entries.add("AstNode", entry); + return; + } + for (const subtype of this.reflection.getAllSubTypes(type3)) { + this.entries.add(subtype, entry); + } + } + getChecks(type3, categories) { + let checks = stream(this.entries.get(type3)).concat(this.entries.get("AstNode")); + if (categories) { + checks = checks.filter((entry) => categories.includes(entry.category)); + } + return checks.map((entry) => entry.check); + } + /** + * Register logic which will be executed once before validating all the nodes of an AST/Langium document. + * This helps to prepare or initialize some information which are required or reusable for the following checks on the AstNodes. + * + * As an example, for validating unique fully-qualified names of nodes in the AST, + * here the map for mapping names to nodes could be established. + * During the usual checks on the nodes, they are put into this map with their name. + * + * Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation. + * Therefore it is recommended to clear stored information + * _before_ validating an AST to validate each AST unaffected from other ASTs + * AND _after_ validating the AST to free memory by information which are no longer used. + * + * @param checkBefore a set-up function which will be called once before actually validating an AST + * @param thisObj Optional object to be used as `this` when calling the validation check functions. + */ + registerBeforeDocument(checkBefore, thisObj = this) { + this.entriesBefore.push(this.wrapPreparationException(checkBefore, "An error occurred during set-up of the validation", thisObj)); + } + /** + * Register logic which will be executed once after validating all the nodes of an AST/Langium document. + * This helps to finally evaluate information which are collected during the checks on the AstNodes. + * + * As an example, for validating unique fully-qualified names of nodes in the AST, + * here the map with all the collected nodes and their names is checked + * and validation hints are created for all nodes with the same name. + * + * Note that this approach makes validations stateful, which is relevant e.g. when cancelling the validation. + * Therefore it is recommended to clear stored information + * _before_ validating an AST to validate each AST unaffected from other ASTs + * AND _after_ validating the AST to free memory by information which are no longer used. + * + * @param checkBefore a set-up function which will be called once before actually validating an AST + * @param thisObj Optional object to be used as `this` when calling the validation check functions. + */ + registerAfterDocument(checkAfter, thisObj = this) { + this.entriesAfter.push(this.wrapPreparationException(checkAfter, "An error occurred during tear-down of the validation", thisObj)); + } + wrapPreparationException(check, messageContext, thisObj) { + return async (rootNode, accept, categories, cancelToken) => { + await this.handleException(() => check.call(thisObj, rootNode, accept, categories, cancelToken), messageContext, accept, rootNode); + }; + } + get checksBefore() { + return this.entriesBefore; + } + get checksAfter() { + return this.entriesAfter; + } + getAllValidationCategories(_document) { + return this.knownCategories; + } + }; + VALIDATE_EACH_NODE = Object.freeze({ + validateNode: true, + validateChildren: true + }); + DefaultDocumentValidator = class { + static { + __name(this, "DefaultDocumentValidator"); + } + static { + __name2(this, "DefaultDocumentValidator"); + } + constructor(services) { + this.validationRegistry = services.validation.ValidationRegistry; + this.metadata = services.LanguageMetaData; + this.profiler = services.shared.profilers.LangiumProfiler; + this.languageId = services.LanguageMetaData.languageId; + } + async validateDocument(document2, options2 = {}, cancelToken = cancellation_exports.CancellationToken.None) { + const parseResult = document2.parseResult; + const diagnostics = []; + await interruptAndCheck(cancelToken); + if (!options2.categories || options2.categories.includes("built-in")) { + this.processLexingErrors(parseResult, diagnostics, options2); + if (options2.stopAfterLexingErrors && diagnostics.some((d3) => d3.data?.code === DocumentValidator.LexingError)) { + return diagnostics; + } + this.processParsingErrors(parseResult, diagnostics, options2); + if (options2.stopAfterParsingErrors && diagnostics.some((d3) => d3.data?.code === DocumentValidator.ParsingError)) { + return diagnostics; + } + this.processLinkingErrors(document2, diagnostics, options2); + if (options2.stopAfterLinkingErrors && diagnostics.some((d3) => d3.data?.code === DocumentValidator.LinkingError)) { + return diagnostics; + } + } + try { + diagnostics.push(...await this.validateAst(parseResult.value, options2, cancelToken)); + } catch (err) { + if (isOperationCancelled(err)) { + throw err; + } + console.error("An error occurred during validation:", err); + } + await interruptAndCheck(cancelToken); + return diagnostics; + } + processLexingErrors(parseResult, diagnostics, _options) { + const lexerDiagnostics = [...parseResult.lexerErrors, ...parseResult.lexerReport?.diagnostics ?? []]; + for (const lexerDiagnostic of lexerDiagnostics) { + const severity = lexerDiagnostic.severity ?? "error"; + const diagnostic = { + severity: toDiagnosticSeverity(severity), + range: { + start: { + line: lexerDiagnostic.line - 1, + character: lexerDiagnostic.column - 1 + }, + end: { + line: lexerDiagnostic.line - 1, + character: lexerDiagnostic.column + lexerDiagnostic.length - 1 + } + }, + message: lexerDiagnostic.message, + data: toDiagnosticData(severity), + source: this.getSource() + }; + diagnostics.push(diagnostic); + } + } + processParsingErrors(parseResult, diagnostics, _options) { + for (const parserError of parseResult.parserErrors) { + let range3 = void 0; + if (isNaN(parserError.token.startOffset)) { + if ("previousToken" in parserError) { + const token2 = parserError.previousToken; + if (!isNaN(token2.startOffset)) { + const position5 = { line: token2.endLine - 1, character: token2.endColumn }; + range3 = { start: position5, end: position5 }; + } else { + const position5 = { line: 0, character: 0 }; + range3 = { start: position5, end: position5 }; + } + } + } else { + range3 = tokenToRange(parserError.token); + } + if (range3) { + const diagnostic = { + severity: toDiagnosticSeverity("error"), + range: range3, + message: parserError.message, + data: diagnosticData(DocumentValidator.ParsingError), + source: this.getSource() + }; + diagnostics.push(diagnostic); + } + } + } + processLinkingErrors(document2, diagnostics, _options) { + for (const reference of document2.references) { + const linkingError = reference.error; + if (linkingError) { + const info2 = { + node: linkingError.info.container, + range: reference.$refNode?.range, + property: linkingError.info.property, + index: linkingError.info.index, + data: { + code: DocumentValidator.LinkingError, + containerType: linkingError.info.container.$type, + property: linkingError.info.property, + refText: linkingError.info.reference.$refText + } + }; + diagnostics.push(this.toDiagnostic("error", linkingError.message, info2)); + } + } + } + async validateAst(rootNode, options2, cancelToken = cancellation_exports.CancellationToken.None) { + const validationItems = []; + const acceptor = /* @__PURE__ */ __name2((severity, message, info2) => { + validationItems.push(this.toDiagnostic(severity, message, info2)); + }, "acceptor"); + await this.validateAstBefore(rootNode, options2, acceptor, cancelToken); + await this.validateAstNodes(rootNode, options2, acceptor, cancelToken); + await this.validateAstAfter(rootNode, options2, acceptor, cancelToken); + return validationItems; + } + async validateAstBefore(rootNode, options2, acceptor, cancelToken = cancellation_exports.CancellationToken.None) { + const checksBefore = this.validationRegistry.checksBefore; + for (const checkBefore of checksBefore) { + await interruptAndCheck(cancelToken); + await checkBefore(rootNode, acceptor, options2.categories ?? [], cancelToken); + } + } + async validateAstNodes(rootNode, options2, acceptor, cancelToken = cancellation_exports.CancellationToken.None) { + if (this.profiler?.isActive("validating")) { + const task = this.profiler.createTask("validating", this.languageId); + task.start(); + try { + const nodes5 = streamAst(rootNode).iterator(); + for (const node2 of nodes5) { + task.startSubTask(node2.$type); + const nodeOptions = this.validateSingleNodeOptions(node2, options2); + if (nodeOptions.validateNode) { + try { + const checks = this.validationRegistry.getChecks(node2.$type, options2.categories); + for (const check of checks) { + await check(node2, acceptor, cancelToken); + } + } finally { + task.stopSubTask(node2.$type); + } + } + if (!nodeOptions.validateChildren) { + nodes5.prune(); + } + } + } finally { + task.stop(); + } + } else { + const nodes5 = streamAst(rootNode).iterator(); + for (const node2 of nodes5) { + await interruptAndCheck(cancelToken); + const nodeOptions = this.validateSingleNodeOptions(node2, options2); + if (nodeOptions.validateNode) { + const checks = this.validationRegistry.getChecks(node2.$type, options2.categories); + for (const check of checks) { + await check(node2, acceptor, cancelToken); + } + } + if (!nodeOptions.validateChildren) { + nodes5.prune(); + } + } + } + } + validateSingleNodeOptions(_node, _options) { + return VALIDATE_EACH_NODE; + } + async validateAstAfter(rootNode, options2, acceptor, cancelToken = cancellation_exports.CancellationToken.None) { + const checksAfter = this.validationRegistry.checksAfter; + for (const checkAfter of checksAfter) { + await interruptAndCheck(cancelToken); + await checkAfter(rootNode, acceptor, options2.categories ?? [], cancelToken); + } + } + toDiagnostic(severity, message, info2) { + return { + message, + range: getDiagnosticRange(info2), + severity: toDiagnosticSeverity(severity), + code: info2.code, + codeDescription: info2.codeDescription, + tags: info2.tags, + relatedInformation: info2.relatedInformation, + data: info2.data, + source: this.getSource() + }; + } + getSource() { + return this.metadata.languageId; + } + }; + __name(getDiagnosticRange, "getDiagnosticRange"); + __name2(getDiagnosticRange, "getDiagnosticRange"); + __name(toDiagnosticSeverity, "toDiagnosticSeverity"); + __name2(toDiagnosticSeverity, "toDiagnosticSeverity"); + __name(toDiagnosticData, "toDiagnosticData"); + __name2(toDiagnosticData, "toDiagnosticData"); + (function(DocumentValidator2) { + DocumentValidator2.LexingError = "lexing-error"; + DocumentValidator2.LexingWarning = "lexing-warning"; + DocumentValidator2.LexingInfo = "lexing-info"; + DocumentValidator2.LexingHint = "lexing-hint"; + DocumentValidator2.ParsingError = "parsing-error"; + DocumentValidator2.LinkingError = "linking-error"; + })(DocumentValidator || (DocumentValidator = {})); + DefaultAstNodeDescriptionProvider = class { + static { + __name(this, "DefaultAstNodeDescriptionProvider"); + } + static { + __name2(this, "DefaultAstNodeDescriptionProvider"); + } + constructor(services) { + this.astNodeLocator = services.workspace.AstNodeLocator; + this.nameProvider = services.references.NameProvider; + } + createDescription(node2, name, document2) { + const doc = document2 ?? getDocument(node2); + name ?? (name = this.nameProvider.getName(node2)); + const path4 = this.astNodeLocator.getAstNodePath(node2); + if (!name) { + throw new Error(`Node at path ${path4} has no name.`); + } + let nameNodeSegment; + const nameSegmentGetter = /* @__PURE__ */ __name2(() => nameNodeSegment ?? (nameNodeSegment = toDocumentSegment(this.nameProvider.getNameNode(node2) ?? node2.$cstNode)), "nameSegmentGetter"); + return { + node: node2, + name, + get nameSegment() { + return nameSegmentGetter(); + }, + selectionSegment: toDocumentSegment(node2.$cstNode), + type: node2.$type, + documentUri: doc.uri, + path: path4 + }; + } + }; + DefaultReferenceDescriptionProvider = class { + static { + __name(this, "DefaultReferenceDescriptionProvider"); + } + static { + __name2(this, "DefaultReferenceDescriptionProvider"); + } + constructor(services) { + this.nodeLocator = services.workspace.AstNodeLocator; + } + async createDescriptions(document2, cancelToken = cancellation_exports.CancellationToken.None) { + const descr = []; + const rootNode = document2.parseResult.value; + for (const astNode of streamAst(rootNode)) { + await interruptAndCheck(cancelToken); + streamReferences(astNode).forEach((refInfo) => { + if (!refInfo.reference.error) { + descr.push(...this.createInfoDescriptions(refInfo)); + } + }); + } + return descr; + } + createInfoDescriptions(refInfo) { + const reference = refInfo.reference; + if (reference.error || !reference.$refNode) { + return []; + } + let items = []; + if (isReference(reference) && reference.$nodeDescription) { + items = [reference.$nodeDescription]; + } else if (isMultiReference(reference)) { + items = reference.items.map((e3) => e3.$nodeDescription).filter((e3) => e3 !== void 0); + } + const sourceUri = getDocument(refInfo.container).uri; + const sourcePath = this.nodeLocator.getAstNodePath(refInfo.container); + const descriptions = []; + const segment = toDocumentSegment(reference.$refNode); + for (const item of items) { + descriptions.push({ + sourceUri, + sourcePath, + targetUri: item.documentUri, + targetPath: item.path, + segment, + local: UriUtils.equals(item.documentUri, sourceUri) + }); + } + return descriptions; + } + }; + DefaultAstNodeLocator = class { + static { + __name(this, "DefaultAstNodeLocator"); + } + static { + __name2(this, "DefaultAstNodeLocator"); + } + constructor() { + this.segmentSeparator = "/"; + this.indexSeparator = "@"; + } + getAstNodePath(node2) { + if (node2.$container) { + const containerPath = this.getAstNodePath(node2.$container); + const newSegment = this.getPathSegment(node2); + const nodePath = containerPath + this.segmentSeparator + newSegment; + return nodePath; + } + return ""; + } + getPathSegment({ $containerProperty, $containerIndex }) { + if (!$containerProperty) { + throw new Error("Missing '$containerProperty' in AST node."); + } + if ($containerIndex !== void 0) { + return $containerProperty + this.indexSeparator + $containerIndex; + } + return $containerProperty; + } + getAstNode(node2, path4) { + const segments = path4.split(this.segmentSeparator); + return segments.reduce((previousValue, currentValue) => { + if (!previousValue || currentValue.length === 0) { + return previousValue; + } + const propertyIndex = currentValue.indexOf(this.indexSeparator); + if (propertyIndex > 0) { + const property3 = currentValue.substring(0, propertyIndex); + const arrayIndex = parseInt(currentValue.substring(propertyIndex + 1)); + const array4 = previousValue[property3]; + return array4?.[arrayIndex]; + } + return previousValue[currentValue]; + }, node2); + } + }; + event_exports = {}; + __reExport(event_exports, __toESM2(require_events(), 1)); + DefaultConfigurationProvider = class { + static { + __name(this, "DefaultConfigurationProvider"); + } + static { + __name2(this, "DefaultConfigurationProvider"); + } + constructor(services) { + this._ready = new Deferred(); + this.onConfigurationSectionUpdateEmitter = new event_exports.Emitter(); + this.settings = {}; + this.workspaceConfig = false; + this.serviceRegistry = services.ServiceRegistry; + } + get ready() { + return this._ready.promise; + } + initialize(params) { + this.workspaceConfig = params.capabilities.workspace?.configuration ?? false; + } + async initialized(params) { + if (this.workspaceConfig) { + if (params.register) { + const languages = this.serviceRegistry.all; + params.register({ + // Listen to configuration changes for all languages + section: languages.map((lang) => this.toSectionName(lang.LanguageMetaData.languageId)) + }); + } + if (params.fetchConfiguration) { + const configToUpdate = this.serviceRegistry.all.map((lang) => ({ + // Fetch the configuration changes for all languages + section: this.toSectionName(lang.LanguageMetaData.languageId) + })); + const configs = await params.fetchConfiguration(configToUpdate); + configToUpdate.forEach((conf5, idx) => { + this.updateSectionConfiguration(conf5.section, configs[idx]); + }); + } + } + this._ready.resolve(); + } + /** + * Updates the cached configurations using the `change` notification parameters. + * + * @param change The parameters of a change configuration notification. + * `settings` property of the change object could be expressed as `Record>` + */ + updateConfiguration(change2) { + if (typeof change2.settings !== "object" || change2.settings === null) { + return; + } + Object.entries(change2.settings).forEach(([section, configuration]) => { + this.updateSectionConfiguration(section, configuration); + this.onConfigurationSectionUpdateEmitter.fire({ section, configuration }); + }); + } + updateSectionConfiguration(section, configuration) { + this.settings[section] = configuration; + } + /** + * Returns a configuration value stored for the given language. + * + * @param language The language id + * @param configuration Configuration name + */ + async getConfiguration(language, configuration) { + await this.ready; + const sectionName = this.toSectionName(language); + if (this.settings[sectionName]) { + return this.settings[sectionName][configuration]; + } + } + toSectionName(languageId) { + return `${languageId}`; + } + get onConfigurationSectionUpdate() { + return this.onConfigurationSectionUpdateEmitter.event; + } + }; + import_vscode_languageserver_protocol = __toESM2(require_main2(), 1); + (function(Disposable2) { + function create4(callback) { + return { + dispose: /* @__PURE__ */ __name2(async () => await callback(), "dispose") + }; + } + __name(create4, "create"); + __name2(create4, "create"); + Disposable2.create = create4; + })(Disposable || (Disposable = {})); + DefaultDocumentBuilder = class { + static { + __name(this, "DefaultDocumentBuilder"); + } + static { + __name2(this, "DefaultDocumentBuilder"); + } + constructor(services) { + this.updateBuildOptions = { + // Default: run only the built-in validation checks and those in the _fast_ category (includes those without category) + validation: { + categories: ["built-in", "fast"] + } + }; + this.updateListeners = []; + this.buildPhaseListeners = new MultiMap(); + this.documentPhaseListeners = new MultiMap(); + this.buildState = /* @__PURE__ */ new Map(); + this.documentBuildWaiters = /* @__PURE__ */ new Map(); + this.currentState = DocumentState.Changed; + this.langiumDocuments = services.workspace.LangiumDocuments; + this.langiumDocumentFactory = services.workspace.LangiumDocumentFactory; + this.textDocuments = services.workspace.TextDocuments; + this.indexManager = services.workspace.IndexManager; + this.fileSystemProvider = services.workspace.FileSystemProvider; + this.workspaceManager = () => services.workspace.WorkspaceManager; + this.serviceRegistry = services.ServiceRegistry; + } + async build(documents, options2 = {}, cancelToken = cancellation_exports.CancellationToken.None) { + for (const document2 of documents) { + const key = document2.uri.toString(); + if (document2.state === DocumentState.Validated) { + if (typeof options2.validation === "boolean" && options2.validation) { + this.resetToState(document2, DocumentState.IndexedReferences); + } else if (typeof options2.validation === "object") { + const categories = this.findMissingValidationCategories(document2, options2); + if (categories.length > 0) { + this.buildState.set(key, { + completed: false, + options: { + validation: { + categories + } + }, + result: this.buildState.get(key)?.result + }); + document2.state = DocumentState.IndexedReferences; + } + } + } else { + this.buildState.delete(key); + } + } + this.currentState = DocumentState.Changed; + await this.emitUpdate(documents.map((e3) => e3.uri), []); + await this.buildDocuments(documents, options2, cancelToken); + } + async update(changed, deleted, cancelToken = cancellation_exports.CancellationToken.None) { + this.currentState = DocumentState.Changed; + const deletedUris = []; + for (const deletedUri of deleted) { + const deletedDocs = this.langiumDocuments.deleteDocuments(deletedUri); + for (const doc of deletedDocs) { + deletedUris.push(doc.uri); + this.cleanUpDeleted(doc); + } + } + const changedUris = (await Promise.all(changed.map((uri) => this.findChangedUris(uri)))).flat(); + for (const changedUri of changedUris) { + let changedDocument = this.langiumDocuments.getDocument(changedUri); + if (changedDocument === void 0) { + changedDocument = this.langiumDocumentFactory.fromModel({ $type: "INVALID" }, changedUri); + changedDocument.state = DocumentState.Changed; + this.langiumDocuments.addDocument(changedDocument); + } + this.resetToState(changedDocument, DocumentState.Changed); + } + const allChangedUris = stream(changedUris).concat(deletedUris).map((uri) => uri.toString()).toSet(); + this.langiumDocuments.all.filter((doc) => !allChangedUris.has(doc.uri.toString()) && this.shouldRelink(doc, allChangedUris)).forEach((doc) => this.resetToState(doc, DocumentState.ComputedScopes)); + await this.emitUpdate(changedUris, deletedUris); + await interruptAndCheck(cancelToken); + const rebuildDocuments = this.sortDocuments(this.langiumDocuments.all.filter((doc) => ( + // This includes those that were reported as changed and those that we selected for relinking + doc.state < DocumentState.Validated || !this.buildState.get(doc.uri.toString())?.completed || this.resultsAreIncomplete(doc, this.updateBuildOptions) + )).toArray()); + await this.buildDocuments(rebuildDocuments, this.updateBuildOptions, cancelToken); + } + resultsAreIncomplete(document2, options2) { + return this.findMissingValidationCategories(document2, options2).length >= 1; + } + findMissingValidationCategories(document2, options2) { + const state4 = this.buildState.get(document2.uri.toString()); + const allCategories = this.serviceRegistry.getServices(document2.uri).validation.ValidationRegistry.getAllValidationCategories(document2); + const executedCategories = state4?.result?.validationChecks ? new Set(state4?.result?.validationChecks) : state4?.completed ? allCategories : /* @__PURE__ */ new Set(); + const requestedCategories = options2 === void 0 || options2.validation === true ? allCategories : typeof options2.validation === "object" ? options2.validation.categories ?? allCategories : []; + return stream(requestedCategories).filter((requested) => !executedCategories.has(requested)).toArray(); + } + async findChangedUris(changed) { + const document2 = this.langiumDocuments.getDocument(changed) ?? this.textDocuments?.get(changed); + if (document2) { + return [changed]; + } + try { + const stat = await this.fileSystemProvider.stat(changed); + if (stat.isDirectory) { + const uris = await this.workspaceManager().searchFolder(changed); + return uris; + } else if (this.workspaceManager().shouldIncludeEntry(stat)) { + return [changed]; + } + } catch { + } + return []; + } + async emitUpdate(changed, deleted) { + await Promise.all(this.updateListeners.map((listener) => listener(changed, deleted))); + } + /** + * Sort the given documents by priority. By default, documents with an open text document are prioritized. + * This is useful to ensure that visible documents show their diagnostics before all other documents. + * + * This improves the responsiveness in large workspaces as users usually don't care about diagnostics + * in files that are currently not opened in the editor. + */ + sortDocuments(documents) { + let left3 = 0; + let right3 = documents.length - 1; + while (left3 < right3) { + while (left3 < documents.length && this.hasTextDocument(documents[left3])) { + left3++; + } + while (right3 >= 0 && !this.hasTextDocument(documents[right3])) { + right3--; + } + if (left3 < right3) { + [documents[left3], documents[right3]] = [documents[right3], documents[left3]]; + } + } + return documents; + } + hasTextDocument(doc) { + return Boolean(this.textDocuments?.get(doc.uri)); + } + /** + * Check whether the given document should be relinked after changes were found in the given URIs. + */ + shouldRelink(document2, changedUris) { + if (document2.references.some((ref) => ref.error !== void 0)) { + return true; + } + return this.indexManager.isAffected(document2, changedUris); + } + onUpdate(callback) { + this.updateListeners.push(callback); + return Disposable.create(() => { + const index = this.updateListeners.indexOf(callback); + if (index >= 0) { + this.updateListeners.splice(index, 1); + } + }); + } + resetToState(document2, state4) { + switch (state4) { + case DocumentState.Changed: { + } + case DocumentState.Parsed: + this.indexManager.removeContent(document2.uri); + // Fall through + case DocumentState.IndexedContent: + document2.localSymbols = void 0; + // Fall through + case DocumentState.ComputedScopes: { + const linker = this.serviceRegistry.getServices(document2.uri).references.Linker; + linker.unlink(document2); + } + case DocumentState.Linked: + this.indexManager.removeReferences(document2.uri); + // Fall through + case DocumentState.IndexedReferences: + document2.diagnostics = void 0; + this.buildState.delete(document2.uri.toString()); + // Fall through + case DocumentState.Validated: + } + if (document2.state > state4) { + document2.state = state4; + } + } + cleanUpDeleted(document2) { + this.buildState.delete(document2.uri.toString()); + this.indexManager.remove(document2.uri); + document2.state = DocumentState.Changed; + } + /** + * Build the given documents by stepping through all build phases. If a document's state indicates + * that a certain build phase is already done, the phase is skipped for that document. + * + * @param documents The documents to build. + * @param options the {@link BuildOptions} to use. + * @param cancelToken A cancellation token that can be used to cancel the build. + * @returns A promise that resolves when the build is done. + */ + async buildDocuments(documents, options2, cancelToken) { + this.prepareBuild(documents, options2); + await this.runCancelable(documents, DocumentState.Parsed, cancelToken, (doc) => this.langiumDocumentFactory.update(doc, cancelToken)); + await this.runCancelable(documents, DocumentState.IndexedContent, cancelToken, (doc) => this.indexManager.updateContent(doc, cancelToken)); + await this.runCancelable(documents, DocumentState.ComputedScopes, cancelToken, async (doc) => { + const scopeComputation = this.serviceRegistry.getServices(doc.uri).references.ScopeComputation; + doc.localSymbols = await scopeComputation.collectLocalSymbols(doc, cancelToken); + }); + const toBeLinked = documents.filter((doc) => this.shouldLink(doc)); + await this.runCancelable(toBeLinked, DocumentState.Linked, cancelToken, (doc) => { + const linker = this.serviceRegistry.getServices(doc.uri).references.Linker; + return linker.link(doc, cancelToken); + }); + await this.runCancelable(toBeLinked, DocumentState.IndexedReferences, cancelToken, (doc) => this.indexManager.updateReferences(doc, cancelToken)); + const toBeValidated = documents.filter((doc) => { + if (this.shouldValidate(doc)) { + return true; + } else { + this.markAsCompleted(doc); + return false; + } + }); + await this.runCancelable(toBeValidated, DocumentState.Validated, cancelToken, async (doc) => { + await this.validate(doc, cancelToken); + this.markAsCompleted(doc); + }); + } + markAsCompleted(document2) { + const state4 = this.buildState.get(document2.uri.toString()); + if (state4) { + state4.completed = true; + } + } + /** + * Runs prior to beginning the build process to update the {@link DocumentBuildState} for each document + * + * @param documents collection of documents to be built + * @param options the {@link BuildOptions} to use + */ + prepareBuild(documents, options2) { + for (const doc of documents) { + const key = doc.uri.toString(); + const state4 = this.buildState.get(key); + if (!state4 || state4.completed) { + this.buildState.set(key, { + completed: false, + options: options2, + result: state4?.result + }); + } else { + } + } + } + /** + * Runs a cancelable operation on a set of documents to bring them to a specified {@link DocumentState}. + * + * @param documents The array of documents to process. + * @param targetState The target {@link DocumentState} to bring the documents to. + * @param cancelToken A token that can be used to cancel the operation. + * @param callback A function to be called for each document. + * @returns A promise that resolves when all documents have been processed or the operation is canceled. + * @throws Will throw `OperationCancelled` if the operation is canceled via a `CancellationToken`. + */ + async runCancelable(documents, targetState, cancelToken, callback) { + for (const document2 of documents) { + if (document2.state < targetState) { + await interruptAndCheck(cancelToken); + await callback(document2); + document2.state = targetState; + await this.notifyDocumentPhase(document2, targetState, cancelToken); + } + } + const targetStateDocs = documents.filter((doc) => doc.state === targetState); + await this.notifyBuildPhase(targetStateDocs, targetState, cancelToken); + this.currentState = targetState; + } + onBuildPhase(targetState, callback) { + this.buildPhaseListeners.add(targetState, callback); + return Disposable.create(() => { + this.buildPhaseListeners.delete(targetState, callback); + }); + } + onDocumentPhase(targetState, callback) { + this.documentPhaseListeners.add(targetState, callback); + return Disposable.create(() => { + this.documentPhaseListeners.delete(targetState, callback); + }); + } + waitUntil(state4, uriOrToken, cancelToken) { + let uri = void 0; + if (uriOrToken && "path" in uriOrToken) { + uri = uriOrToken; + } else { + cancelToken = uriOrToken; + } + cancelToken ?? (cancelToken = cancellation_exports.CancellationToken.None); + if (uri) { + return this.awaitDocumentState(state4, uri, cancelToken); + } else { + return this.awaitBuilderState(state4, cancelToken); + } + } + awaitDocumentState(state4, uri, cancelToken) { + const document2 = this.langiumDocuments.getDocument(uri); + if (!document2) { + return Promise.reject(new import_vscode_languageserver_protocol.ResponseError(import_vscode_languageserver_protocol.LSPErrorCodes.ServerCancelled, `No document found for URI: ${uri.toString()}`)); + } else if (document2.state >= state4) { + return Promise.resolve(uri); + } else if (cancelToken.isCancellationRequested) { + return Promise.reject(OperationCancelled); + } else if (this.currentState >= state4 && state4 > document2.state) { + return Promise.reject(new import_vscode_languageserver_protocol.ResponseError(import_vscode_languageserver_protocol.LSPErrorCodes.RequestFailed, `Document state of ${uri.toString()} is ${DocumentState[document2.state]}, requiring ${DocumentState[state4]}, but workspace state is already ${DocumentState[this.currentState]}. Returning undefined.`)); + } + return new Promise((resolve2, reject22) => { + const buildDisposable = this.onDocumentPhase(state4, (doc) => { + if (UriUtils.equals(doc.uri, uri)) { + buildDisposable.dispose(); + cancelDisposable.dispose(); + resolve2(doc.uri); + } + }); + const cancelDisposable = cancelToken.onCancellationRequested(() => { + buildDisposable.dispose(); + cancelDisposable.dispose(); + reject22(OperationCancelled); + }); + }); + } + awaitBuilderState(state4, cancelToken) { + if (this.currentState >= state4) { + return Promise.resolve(); + } else if (cancelToken.isCancellationRequested) { + return Promise.reject(OperationCancelled); + } + return new Promise((resolve2, reject22) => { + const buildDisposable = this.onBuildPhase(state4, () => { + buildDisposable.dispose(); + cancelDisposable.dispose(); + resolve2(); + }); + const cancelDisposable = cancelToken.onCancellationRequested(() => { + buildDisposable.dispose(); + cancelDisposable.dispose(); + reject22(OperationCancelled); + }); + }); + } + async notifyDocumentPhase(document2, state4, cancelToken) { + const listeners = this.documentPhaseListeners.get(state4); + const listenersCopy = listeners.slice(); + for (const listener of listenersCopy) { + try { + await interruptAndCheck(cancelToken); + await listener(document2, cancelToken); + } catch (err) { + if (!isOperationCancelled(err)) { + throw err; + } + } + } + } + async notifyBuildPhase(documents, state4, cancelToken) { + if (documents.length === 0) { + return; + } + const listeners = this.buildPhaseListeners.get(state4); + const listenersCopy = listeners.slice(); + for (const listener of listenersCopy) { + await interruptAndCheck(cancelToken); + await listener(documents, cancelToken); + } + } + /** + * Determine whether the given document should be linked during a build. The default + * implementation checks the `eagerLinking` property of the build options. If it's set to `true` + * or `undefined`, the document is included in the linking phase. This also affects the + * references indexing phase, which depends on eager linking. + */ + shouldLink(document2) { + return this.getBuildOptions(document2).eagerLinking ?? true; + } + /** + * Determine whether the given document should be validated during a build. The default + * implementation checks the `validation` property of the build options. If it's set to `true` + * or a `ValidationOptions` object, the document is included in the validation phase. + */ + shouldValidate(document2) { + return Boolean(this.getBuildOptions(document2).validation); + } + /** + * Run validation checks on the given document and store the resulting diagnostics in the document. + * If the document already contains diagnostics, the new ones are added to the list. + */ + async validate(document2, cancelToken) { + const validator = this.serviceRegistry.getServices(document2.uri).validation.DocumentValidator; + const options2 = this.getBuildOptions(document2); + const validationOptions = typeof options2.validation === "object" ? { ...options2.validation } : {}; + validationOptions.categories = this.findMissingValidationCategories(document2, options2); + const diagnostics = await validator.validateDocument(document2, validationOptions, cancelToken); + if (document2.diagnostics) { + document2.diagnostics.push(...diagnostics); + } else { + document2.diagnostics = diagnostics; + } + const state4 = this.buildState.get(document2.uri.toString()); + if (state4) { + state4.result ?? (state4.result = {}); + if (state4.result.validationChecks) { + state4.result.validationChecks = stream(state4.result.validationChecks).concat(validationOptions.categories).distinct().toArray(); + } else { + state4.result.validationChecks = [...validationOptions.categories]; + } + } + } + getBuildOptions(document2) { + return this.buildState.get(document2.uri.toString())?.options ?? {}; + } + }; + DefaultIndexManager = class { + static { + __name(this, "DefaultIndexManager"); + } + static { + __name2(this, "DefaultIndexManager"); + } + constructor(services) { + this.symbolIndex = /* @__PURE__ */ new Map(); + this.symbolByTypeIndex = new ContextCache(); + this.referenceIndex = /* @__PURE__ */ new Map(); + this.documents = services.workspace.LangiumDocuments; + this.serviceRegistry = services.ServiceRegistry; + this.astReflection = services.AstReflection; + } + findAllReferences(targetNode, astNodePath) { + const targetDocUri = getDocument(targetNode).uri; + const result = []; + this.referenceIndex.forEach((docRefs) => { + docRefs.forEach((refDescr) => { + if (UriUtils.equals(refDescr.targetUri, targetDocUri) && refDescr.targetPath === astNodePath) { + result.push(refDescr); + } + }); + }); + return stream(result); + } + allElements(nodeType3, uris) { + let documentUris = stream(this.symbolIndex.keys()); + if (uris) { + documentUris = documentUris.filter((uri) => !uris || uris.has(uri)); + } + return documentUris.map((uri) => this.getFileDescriptions(uri, nodeType3)).flat(); + } + getFileDescriptions(uri, nodeType3) { + if (!nodeType3) { + return this.symbolIndex.get(uri) ?? []; + } + const descriptions = this.symbolByTypeIndex.get(uri, nodeType3, () => { + const allFileDescriptions = this.symbolIndex.get(uri) ?? []; + return allFileDescriptions.filter((e3) => this.astReflection.isSubtype(e3.type, nodeType3)); + }); + return descriptions; + } + remove(uri) { + this.removeContent(uri); + this.removeReferences(uri); + } + removeContent(uri) { + const uriString = uri.toString(); + this.symbolIndex.delete(uriString); + this.symbolByTypeIndex.clear(uriString); + } + removeReferences(uri) { + const uriString = uri.toString(); + this.referenceIndex.delete(uriString); + } + async updateContent(document2, cancelToken = cancellation_exports.CancellationToken.None) { + const services = this.serviceRegistry.getServices(document2.uri); + const exports2 = await services.references.ScopeComputation.collectExportedSymbols(document2, cancelToken); + const uri = document2.uri.toString(); + this.symbolIndex.set(uri, exports2); + this.symbolByTypeIndex.clear(uri); + } + async updateReferences(document2, cancelToken = cancellation_exports.CancellationToken.None) { + const services = this.serviceRegistry.getServices(document2.uri); + const indexData = await services.workspace.ReferenceDescriptionProvider.createDescriptions(document2, cancelToken); + this.referenceIndex.set(document2.uri.toString(), indexData); + } + isAffected(document2, changedUris) { + const references = this.referenceIndex.get(document2.uri.toString()); + if (!references) { + return false; + } + return references.some((ref) => !ref.local && changedUris.has(ref.targetUri.toString())); + } + }; + DefaultWorkspaceManager = class { + static { + __name(this, "DefaultWorkspaceManager"); + } + static { + __name2(this, "DefaultWorkspaceManager"); + } + constructor(services) { + this.initialBuildOptions = {}; + this._ready = new Deferred(); + this.serviceRegistry = services.ServiceRegistry; + this.langiumDocuments = services.workspace.LangiumDocuments; + this.documentBuilder = services.workspace.DocumentBuilder; + this.fileSystemProvider = services.workspace.FileSystemProvider; + this.mutex = services.workspace.WorkspaceLock; + } + get ready() { + return this._ready.promise; + } + get workspaceFolders() { + return this.folders; + } + initialize(params) { + this.folders = params.workspaceFolders ?? void 0; + } + initialized(_params) { + return this.mutex.write((token2) => this.initializeWorkspace(this.folders ?? [], token2)); + } + async initializeWorkspace(folders, cancelToken = cancellation_exports.CancellationToken.None) { + const documents = await this.performStartup(folders); + await interruptAndCheck(cancelToken); + await this.documentBuilder.build(documents, this.initialBuildOptions, cancelToken); + } + /** + * Performs the uninterruptable startup sequence of the workspace manager. + * This methods loads all documents in the workspace and other documents and returns them. + */ + async performStartup(folders) { + const documents = []; + const collector = /* @__PURE__ */ __name2((document2) => { + documents.push(document2); + if (!this.langiumDocuments.hasDocument(document2.uri)) { + this.langiumDocuments.addDocument(document2); + } + }, "collector"); + await this.loadAdditionalDocuments(folders, collector); + const uris = []; + await Promise.all(folders.map((wf) => this.getRootFolder(wf)).map(async (entry) => this.traverseFolder(entry, uris))); + const uniqueUris = stream(uris).distinct((uri) => uri.toString()).filter((uri) => !this.langiumDocuments.hasDocument(uri)); + await this.loadWorkspaceDocuments(uniqueUris, collector); + this._ready.resolve(); + return documents; + } + async loadWorkspaceDocuments(uris, collector) { + await Promise.all(uris.map(async (uri) => { + const document2 = await this.langiumDocuments.getOrCreateDocument(uri); + collector(document2); + })); + } + /** + * Load all additional documents that shall be visible in the context of the given workspace + * folders and add them to the collector. This can be used to include built-in libraries of + * your language, which can be either loaded from provided files or constructed in memory. + */ + loadAdditionalDocuments(_folders, _collector) { + return Promise.resolve(); + } + /** + * Determine the root folder of the source documents in the given workspace folder. + * The default implementation returns the URI of the workspace folder, but you can override + * this to return a subfolder like `src` instead. + */ + getRootFolder(workspaceFolder) { + return URI2.parse(workspaceFolder.uri); + } + /** + * Traverse the file system folder identified by the given URI and its subfolders. All + * contained files that match the file extensions are added to the `uris` array. + */ + async traverseFolder(folderPath, uris) { + try { + const content = await this.fileSystemProvider.readDirectory(folderPath); + await Promise.all(content.map(async (entry) => { + if (this.shouldIncludeEntry(entry)) { + if (entry.isDirectory) { + await this.traverseFolder(entry.uri, uris); + } else if (entry.isFile) { + uris.push(entry.uri); + } + } + })); + } catch (e3) { + console.error("Failure to read directory content of " + folderPath.toString(true), e3); + } + } + async searchFolder(uri) { + const uris = []; + await this.traverseFolder(uri, uris); + return uris; + } + /** + * Determine whether the given folder entry shall be included while indexing the workspace. + */ + shouldIncludeEntry(entry) { + const name = UriUtils.basename(entry.uri); + if (name.startsWith(".")) { + return false; + } + if (entry.isDirectory) { + return name !== "node_modules" && name !== "out"; + } else if (entry.isFile) { + return this.serviceRegistry.hasServices(entry.uri); + } + return false; + } + }; + DefaultLexerErrorMessageProvider = class { + static { + __name(this, "DefaultLexerErrorMessageProvider"); + } + static { + __name2(this, "DefaultLexerErrorMessageProvider"); + } + buildUnexpectedCharactersMessage(fullText, startOffset, length2, line2, column2) { + return defaultLexerErrorProvider.buildUnexpectedCharactersMessage(fullText, startOffset, length2, line2, column2); + } + buildUnableToPopLexerModeMessage(token2) { + return defaultLexerErrorProvider.buildUnableToPopLexerModeMessage(token2); + } + }; + DEFAULT_TOKENIZE_OPTIONS = { mode: "full" }; + DefaultLexer = class { + static { + __name(this, "DefaultLexer"); + } + static { + __name2(this, "DefaultLexer"); + } + constructor(services) { + this.errorMessageProvider = services.parser.LexerErrorMessageProvider; + this.tokenBuilder = services.parser.TokenBuilder; + const tokens2 = this.tokenBuilder.buildTokens(services.Grammar, { + caseInsensitive: services.LanguageMetaData.caseInsensitive + }); + this.tokenTypes = this.toTokenTypeDictionary(tokens2); + const lexerTokens = isTokenTypeDictionary(tokens2) ? Object.values(tokens2) : tokens2; + const production = services.LanguageMetaData.mode === "production"; + this.chevrotainLexer = new Lexer2(lexerTokens, { + positionTracking: "full", + skipValidations: production, + errorMessageProvider: this.errorMessageProvider + }); + } + get definition() { + return this.tokenTypes; + } + tokenize(text4, _options = DEFAULT_TOKENIZE_OPTIONS) { + const chevrotainResult = this.chevrotainLexer.tokenize(text4); + return { + tokens: chevrotainResult.tokens, + errors: chevrotainResult.errors, + hidden: chevrotainResult.groups.hidden ?? [], + report: this.tokenBuilder.flushLexingReport?.(text4) + }; + } + toTokenTypeDictionary(buildTokens) { + if (isTokenTypeDictionary(buildTokens)) + return buildTokens; + const tokens2 = isIMultiModeLexerDefinition(buildTokens) ? Object.values(buildTokens.modes).flat() : buildTokens; + const res = {}; + tokens2.forEach((token2) => res[token2.name] = token2); + return res; + } + }; + __name(isTokenTypeArray, "isTokenTypeArray"); + __name2(isTokenTypeArray, "isTokenTypeArray"); + __name(isIMultiModeLexerDefinition, "isIMultiModeLexerDefinition"); + __name2(isIMultiModeLexerDefinition, "isIMultiModeLexerDefinition"); + __name(isTokenTypeDictionary, "isTokenTypeDictionary"); + __name2(isTokenTypeDictionary, "isTokenTypeDictionary"); + init_main(); + __name(parseJSDoc, "parseJSDoc"); + __name2(parseJSDoc, "parseJSDoc"); + __name(isJSDoc, "isJSDoc"); + __name2(isJSDoc, "isJSDoc"); + __name(getLines, "getLines"); + __name2(getLines, "getLines"); + tagRegex = /\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy; + inlineTagRegex = /\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu; + __name(tokenize, "tokenize"); + __name2(tokenize, "tokenize"); + __name(buildInlineTokens, "buildInlineTokens"); + __name2(buildInlineTokens, "buildInlineTokens"); + nonWhitespaceRegex = /\S/; + whitespaceEndRegex = /\s*$/; + __name(skipWhitespace, "skipWhitespace"); + __name2(skipWhitespace, "skipWhitespace"); + __name(lastCharacter, "lastCharacter"); + __name2(lastCharacter, "lastCharacter"); + __name(parseJSDocComment, "parseJSDocComment"); + __name2(parseJSDocComment, "parseJSDocComment"); + __name(parseJSDocElement, "parseJSDocElement"); + __name2(parseJSDocElement, "parseJSDocElement"); + __name(appendEmptyLine, "appendEmptyLine"); + __name2(appendEmptyLine, "appendEmptyLine"); + __name(parseJSDocText, "parseJSDocText"); + __name2(parseJSDocText, "parseJSDocText"); + __name(parseJSDocInline, "parseJSDocInline"); + __name2(parseJSDocInline, "parseJSDocInline"); + __name(parseJSDocTag, "parseJSDocTag"); + __name2(parseJSDocTag, "parseJSDocTag"); + __name(parseJSDocLine, "parseJSDocLine"); + __name2(parseJSDocLine, "parseJSDocLine"); + __name(normalizeOptions, "normalizeOptions"); + __name2(normalizeOptions, "normalizeOptions"); + __name(normalizeOption, "normalizeOption"); + __name2(normalizeOption, "normalizeOption"); + JSDocCommentImpl = class { + static { + __name(this, "JSDocCommentImpl"); + } + static { + __name2(this, "JSDocCommentImpl"); + } + constructor(elements2, range3) { + this.elements = elements2; + this.range = range3; + } + getTag(name) { + return this.getAllTags().find((e3) => e3.name === name); + } + getTags(name) { + return this.getAllTags().filter((e3) => e3.name === name); + } + getAllTags() { + return this.elements.filter((e3) => "name" in e3); + } + toString() { + let value2 = ""; + for (const element3 of this.elements) { + if (value2.length === 0) { + value2 = element3.toString(); + } else { + const text4 = element3.toString(); + value2 += fillNewlines(value2) + text4; + } + } + return value2.trim(); + } + toMarkdown(options2) { + let value2 = ""; + for (const element3 of this.elements) { + if (value2.length === 0) { + value2 = element3.toMarkdown(options2); + } else { + const text4 = element3.toMarkdown(options2); + value2 += fillNewlines(value2) + text4; + } + } + return value2.trim(); + } + }; + JSDocTagImpl = class { + static { + __name(this, "JSDocTagImpl"); + } + static { + __name2(this, "JSDocTagImpl"); + } + constructor(name, content, inline, range3) { + this.name = name; + this.content = content; + this.inline = inline; + this.range = range3; + } + toString() { + let text4 = `@${this.name}`; + const content = this.content.toString(); + if (this.content.inlines.length === 1) { + text4 = `${text4} ${content}`; + } else if (this.content.inlines.length > 1) { + text4 = `${text4} +${content}`; + } + if (this.inline) { + return `{${text4}}`; + } else { + return text4; + } + } + toMarkdown(options2) { + return options2?.renderTag?.(this) ?? this.toMarkdownDefault(options2); + } + toMarkdownDefault(options2) { + const content = this.content.toMarkdown(options2); + if (this.inline) { + const rendered = renderInlineTag(this.name, content, options2 ?? {}); + if (typeof rendered === "string") { + return rendered; + } + } + let marker = ""; + if (options2?.tag === "italic" || options2?.tag === void 0) { + marker = "*"; + } else if (options2?.tag === "bold") { + marker = "**"; + } else if (options2?.tag === "bold-italic") { + marker = "***"; + } + let text4 = `${marker}@${this.name}${marker}`; + if (this.content.inlines.length === 1) { + text4 = `${text4} \u2014 ${content}`; + } else if (this.content.inlines.length > 1) { + text4 = `${text4} +${content}`; + } + if (this.inline) { + return `{${text4}}`; + } else { + return text4; + } + } + }; + __name(renderInlineTag, "renderInlineTag"); + __name2(renderInlineTag, "renderInlineTag"); + __name(renderLinkDefault, "renderLinkDefault"); + __name2(renderLinkDefault, "renderLinkDefault"); + JSDocTextImpl = class { + static { + __name(this, "JSDocTextImpl"); + } + static { + __name2(this, "JSDocTextImpl"); + } + constructor(lines, range3) { + this.inlines = lines; + this.range = range3; + } + toString() { + let text4 = ""; + for (let i2 = 0; i2 < this.inlines.length; i2++) { + const inline = this.inlines[i2]; + const next3 = this.inlines[i2 + 1]; + text4 += inline.toString(); + if (next3 && next3.range.start.line > inline.range.start.line) { + text4 += "\n"; + } + } + return text4; + } + toMarkdown(options2) { + let text4 = ""; + for (let i2 = 0; i2 < this.inlines.length; i2++) { + const inline = this.inlines[i2]; + const next3 = this.inlines[i2 + 1]; + text4 += inline.toMarkdown(options2); + if (next3 && next3.range.start.line > inline.range.start.line) { + text4 += "\n"; + } + } + return text4; + } + }; + JSDocLineImpl = class { + static { + __name(this, "JSDocLineImpl"); + } + static { + __name2(this, "JSDocLineImpl"); + } + constructor(text4, range3) { + this.text = text4; + this.range = range3; + } + toString() { + return this.text; + } + toMarkdown() { + return this.text; + } + }; + __name(fillNewlines, "fillNewlines"); + __name2(fillNewlines, "fillNewlines"); + JSDocDocumentationProvider = class { + static { + __name(this, "JSDocDocumentationProvider"); + } + static { + __name2(this, "JSDocDocumentationProvider"); + } + constructor(services) { + this.indexManager = services.shared.workspace.IndexManager; + this.commentProvider = services.documentation.CommentProvider; + } + getDocumentation(node2) { + const comment2 = this.commentProvider.getComment(node2); + if (comment2 && isJSDoc(comment2)) { + const parsedJSDoc = parseJSDoc(comment2); + return parsedJSDoc.toMarkdown({ + renderLink: /* @__PURE__ */ __name2((link2, display) => { + return this.documentationLinkRenderer(node2, link2, display); + }, "renderLink"), + renderTag: /* @__PURE__ */ __name2((tag) => { + return this.documentationTagRenderer(node2, tag); + }, "renderTag") + }); + } + return void 0; + } + documentationLinkRenderer(node2, name, display) { + const description = this.findNameInLocalSymbols(node2, name) ?? this.findNameInGlobalScope(node2, name); + if (description && description.nameSegment) { + const line2 = description.nameSegment.range.start.line + 1; + const character2 = description.nameSegment.range.start.character + 1; + const uri = description.documentUri.with({ fragment: `L${line2},${character2}` }); + return `[${display}](${uri.toString()})`; + } else { + return void 0; + } + } + documentationTagRenderer(_node, _tag) { + return void 0; + } + findNameInLocalSymbols(node2, name) { + const document2 = getDocument(node2); + const precomputed = document2.localSymbols; + if (!precomputed) { + return void 0; + } + let currentNode = node2; + do { + const allDescriptions = precomputed.getStream(currentNode); + const description = allDescriptions.find((e3) => e3.name === name); + if (description) { + return description; + } + currentNode = currentNode.$container; + } while (currentNode); + return void 0; + } + findNameInGlobalScope(node2, name) { + const description = this.indexManager.allElements().find((e3) => e3.name === name); + return description; + } + }; + DefaultCommentProvider = class { + static { + __name(this, "DefaultCommentProvider"); + } + static { + __name2(this, "DefaultCommentProvider"); + } + constructor(services) { + this.grammarConfig = () => services.parser.GrammarConfig; + } + getComment(node2) { + if (isAstNodeWithComment(node2)) { + return node2.$comment; + } + return findCommentNode(node2.$cstNode, this.grammarConfig().multilineCommentRules)?.text; + } + }; + DefaultAsyncParser = class { + static { + __name(this, "DefaultAsyncParser"); + } + static { + __name2(this, "DefaultAsyncParser"); + } + constructor(services) { + this.syncParser = services.parser.LangiumParser; + } + parse(text4, _cancelToken) { + return Promise.resolve(this.syncParser.parse(text4)); + } + }; + AbstractThreadedAsyncParser = class { + static { + __name(this, "AbstractThreadedAsyncParser"); + } + static { + __name2(this, "AbstractThreadedAsyncParser"); + } + constructor(services) { + this.threadCount = 8; + this.terminationDelay = 200; + this.workerPool = []; + this.queue = []; + this.hydrator = services.serializer.Hydrator; + } + initializeWorkers() { + while (this.workerPool.length < this.threadCount) { + const worker = this.createWorker(); + worker.onReady(() => { + if (this.queue.length > 0) { + const deferred = this.queue.shift(); + if (deferred) { + worker.lock(); + deferred.resolve(worker); + } + } + }); + this.workerPool.push(worker); + } + } + async parse(text4, cancelToken) { + const worker = await this.acquireParserWorker(cancelToken); + const deferred = new Deferred(); + let timeout2; + const cancellation = cancelToken.onCancellationRequested(() => { + timeout2 = setTimeout(() => { + this.terminateWorker(worker); + }, this.terminationDelay); + }); + worker.parse(text4).then((result) => { + const hydrated = this.hydrator.hydrate(result); + deferred.resolve(hydrated); + }).catch((err) => { + deferred.reject(err); + }).finally(() => { + cancellation.dispose(); + clearTimeout(timeout2); + }); + return deferred.promise; + } + terminateWorker(worker) { + worker.terminate(); + const index = this.workerPool.indexOf(worker); + if (index >= 0) { + this.workerPool.splice(index, 1); + } + } + async acquireParserWorker(cancelToken) { + this.initializeWorkers(); + for (const worker of this.workerPool) { + if (worker.ready) { + worker.lock(); + return worker; + } + } + const deferred = new Deferred(); + cancelToken.onCancellationRequested(() => { + const index = this.queue.indexOf(deferred); + if (index >= 0) { + this.queue.splice(index, 1); + } + deferred.reject(OperationCancelled); + }); + this.queue.push(deferred); + return deferred.promise; + } + }; + ParserWorker = class { + static { + __name(this, "ParserWorker"); + } + static { + __name2(this, "ParserWorker"); + } + get ready() { + return this._ready; + } + get onReady() { + return this.onReadyEmitter.event; + } + constructor(sendMessage, onMessage, onError, terminate) { + this.onReadyEmitter = new event_exports.Emitter(); + this.deferred = new Deferred(); + this._ready = true; + this._parsing = false; + this.sendMessage = sendMessage; + this._terminate = terminate; + onMessage((result) => { + const parseResult = result; + this.deferred.resolve(parseResult); + this.unlock(); + }); + onError((error3) => { + this.deferred.reject(error3); + this.unlock(); + }); + } + terminate() { + this.deferred.reject(OperationCancelled); + this._terminate(); + } + lock() { + this._ready = false; + } + unlock() { + this._parsing = false; + this._ready = true; + this.onReadyEmitter.fire(); + } + parse(text4) { + if (this._parsing) { + throw new Error("Parser worker is busy"); + } + this._parsing = true; + this.deferred = new Deferred(); + this.sendMessage(text4); + return this.deferred.promise; + } + }; + DefaultWorkspaceLock = class { + static { + __name(this, "DefaultWorkspaceLock"); + } + static { + __name2(this, "DefaultWorkspaceLock"); + } + constructor() { + this.previousTokenSource = new cancellation_exports.CancellationTokenSource(); + this.writeQueue = []; + this.readQueue = []; + this.done = true; + } + write(action) { + this.cancelWrite(); + const tokenSource = startCancelableOperation(); + this.previousTokenSource = tokenSource; + return this.enqueue(this.writeQueue, action, tokenSource.token); + } + read(action) { + return this.enqueue(this.readQueue, action); + } + enqueue(queue, action, cancellationToken = cancellation_exports.CancellationToken.None) { + const deferred = new Deferred(); + const entry = { + action, + deferred, + cancellationToken + }; + queue.push(entry); + this.performNextOperation(); + return deferred.promise; + } + async performNextOperation() { + if (!this.done) { + return; + } + const entries2 = []; + if (this.writeQueue.length > 0) { + entries2.push(this.writeQueue.shift()); + } else if (this.readQueue.length > 0) { + entries2.push(...this.readQueue.splice(0, this.readQueue.length)); + } else { + return; + } + this.done = false; + await Promise.all(entries2.map(async ({ action, deferred, cancellationToken }) => { + try { + const result = await Promise.resolve().then(() => action(cancellationToken)); + deferred.resolve(result); + } catch (err) { + if (isOperationCancelled(err)) { + deferred.resolve(void 0); + } else { + deferred.reject(err); + } + } + })); + this.done = true; + this.performNextOperation(); + } + cancelWrite() { + this.previousTokenSource.cancel(); + } + }; + DefaultHydrator = class { + static { + __name(this, "DefaultHydrator"); + } + static { + __name2(this, "DefaultHydrator"); + } + constructor(services) { + this.grammarElementIdMap = new BiMap(); + this.tokenTypeIdMap = new BiMap(); + this.grammar = services.Grammar; + this.lexer = services.parser.Lexer; + this.linker = services.references.Linker; + } + dehydrate(result) { + return { + lexerErrors: result.lexerErrors, + lexerReport: result.lexerReport ? this.dehydrateLexerReport(result.lexerReport) : void 0, + // We need to create shallow copies of the errors + // The original errors inherit from the `Error` class, which is not transferable across worker threads + parserErrors: result.parserErrors.map((e3) => ({ ...e3, message: e3.message })), + value: this.dehydrateAstNode(result.value, this.createDehyrationContext(result.value)) + }; + } + dehydrateLexerReport(lexerReport) { + return lexerReport; + } + createDehyrationContext(node2) { + const astNodes = /* @__PURE__ */ new Map(); + const cstNodes = /* @__PURE__ */ new Map(); + for (const astNode of streamAst(node2)) { + astNodes.set(astNode, {}); + } + if (node2.$cstNode) { + for (const cstNode of streamCst(node2.$cstNode)) { + cstNodes.set(cstNode, {}); + } + } + return { + astNodes, + cstNodes + }; + } + dehydrateAstNode(node2, context) { + const obj = context.astNodes.get(node2); + obj.$type = node2.$type; + obj.$containerIndex = node2.$containerIndex; + obj.$containerProperty = node2.$containerProperty; + if (node2.$cstNode !== void 0) { + obj.$cstNode = this.dehydrateCstNode(node2.$cstNode, context); + } + for (const [name, value2] of Object.entries(node2)) { + if (name.startsWith("$")) { + continue; + } + if (Array.isArray(value2)) { + const arr = []; + obj[name] = arr; + for (const item of value2) { + if (isAstNode(item)) { + arr.push(this.dehydrateAstNode(item, context)); + } else if (isReference(item)) { + arr.push(this.dehydrateReference(item, context)); + } else { + arr.push(item); + } + } + } else if (isAstNode(value2)) { + obj[name] = this.dehydrateAstNode(value2, context); + } else if (isReference(value2)) { + obj[name] = this.dehydrateReference(value2, context); + } else if (value2 !== void 0) { + obj[name] = value2; + } + } + return obj; + } + dehydrateReference(reference, context) { + const obj = {}; + obj.$refText = reference.$refText; + if (reference.$refNode) { + obj.$refNode = context.cstNodes.get(reference.$refNode); + } + return obj; + } + dehydrateCstNode(node2, context) { + const cstNode = context.cstNodes.get(node2); + if (isRootCstNode(node2)) { + cstNode.fullText = node2.fullText; + } else { + cstNode.grammarSource = this.getGrammarElementId(node2.grammarSource); + } + cstNode.hidden = node2.hidden; + cstNode.astNode = context.astNodes.get(node2.astNode); + if (isCompositeCstNode(node2)) { + cstNode.content = node2.content.map((child) => this.dehydrateCstNode(child, context)); + } else if (isLeafCstNode(node2)) { + cstNode.tokenType = node2.tokenType.name; + cstNode.offset = node2.offset; + cstNode.length = node2.length; + cstNode.startLine = node2.range.start.line; + cstNode.startColumn = node2.range.start.character; + cstNode.endLine = node2.range.end.line; + cstNode.endColumn = node2.range.end.character; + } + return cstNode; + } + hydrate(result) { + const node2 = result.value; + const context = this.createHydrationContext(node2); + if ("$cstNode" in node2) { + this.hydrateCstNode(node2.$cstNode, context); + } + return { + lexerErrors: result.lexerErrors, + lexerReport: result.lexerReport, + parserErrors: result.parserErrors, + value: this.hydrateAstNode(node2, context) + }; + } + createHydrationContext(node2) { + const astNodes = /* @__PURE__ */ new Map(); + const cstNodes = /* @__PURE__ */ new Map(); + for (const astNode of streamAst(node2)) { + astNodes.set(astNode, {}); + } + let root32; + if (node2.$cstNode) { + for (const cstNode of streamCst(node2.$cstNode)) { + let cst; + if ("fullText" in cstNode) { + cst = new RootCstNodeImpl(cstNode.fullText); + root32 = cst; + } else if ("content" in cstNode) { + cst = new CompositeCstNodeImpl(); + } else if ("tokenType" in cstNode) { + cst = this.hydrateCstLeafNode(cstNode); + } + if (cst) { + cstNodes.set(cstNode, cst); + cst.root = root32; + } + } + } + return { + astNodes, + cstNodes + }; + } + hydrateAstNode(node2, context) { + const astNode = context.astNodes.get(node2); + astNode.$type = node2.$type; + astNode.$containerIndex = node2.$containerIndex; + astNode.$containerProperty = node2.$containerProperty; + if (node2.$cstNode) { + astNode.$cstNode = context.cstNodes.get(node2.$cstNode); + } + for (const [name, value2] of Object.entries(node2)) { + if (name.startsWith("$")) { + continue; + } + if (Array.isArray(value2)) { + const arr = []; + astNode[name] = arr; + for (const item of value2) { + if (isAstNode(item)) { + arr.push(this.setParent(this.hydrateAstNode(item, context), astNode)); + } else if (isReference(item)) { + arr.push(this.hydrateReference(item, astNode, name, context)); + } else { + arr.push(item); + } + } + } else if (isAstNode(value2)) { + astNode[name] = this.setParent(this.hydrateAstNode(value2, context), astNode); + } else if (isReference(value2)) { + astNode[name] = this.hydrateReference(value2, astNode, name, context); + } else if (value2 !== void 0) { + astNode[name] = value2; + } + } + return astNode; + } + setParent(node2, parent4) { + node2.$container = parent4; + return node2; + } + hydrateReference(reference, node2, name, context) { + return this.linker.buildReference(node2, name, context.cstNodes.get(reference.$refNode), reference.$refText); + } + hydrateCstNode(cstNode, context, num = 0) { + const cstNodeObj = context.cstNodes.get(cstNode); + if (typeof cstNode.grammarSource === "number") { + cstNodeObj.grammarSource = this.getGrammarElement(cstNode.grammarSource); + } + cstNodeObj.astNode = context.astNodes.get(cstNode.astNode); + if (isCompositeCstNode(cstNodeObj)) { + for (const child of cstNode.content) { + const hydrated = this.hydrateCstNode(child, context, num++); + cstNodeObj.content.push(hydrated); + } + } + return cstNodeObj; + } + hydrateCstLeafNode(cstNode) { + const tokenType = this.getTokenType(cstNode.tokenType); + const offset = cstNode.offset; + const length2 = cstNode.length; + const startLine = cstNode.startLine; + const startColumn = cstNode.startColumn; + const endLine = cstNode.endLine; + const endColumn = cstNode.endColumn; + const hidden = cstNode.hidden; + const node2 = new LeafCstNodeImpl(offset, length2, { + start: { + line: startLine, + character: startColumn + }, + end: { + line: endLine, + character: endColumn + } + }, tokenType, hidden); + return node2; + } + getTokenType(name) { + return this.lexer.definition[name]; + } + getGrammarElementId(node2) { + if (!node2) { + return void 0; + } + if (this.grammarElementIdMap.size === 0) { + this.createGrammarElementIdMap(); + } + return this.grammarElementIdMap.get(node2); + } + getGrammarElement(id35) { + if (this.grammarElementIdMap.size === 0) { + this.createGrammarElementIdMap(); + } + const element3 = this.grammarElementIdMap.getKey(id35); + return element3; + } + createGrammarElementIdMap() { + let id35 = 0; + for (const element3 of streamAst(this.grammar)) { + if (isAbstractElement(element3)) { + this.grammarElementIdMap.set(element3, id35++); + } + } + } + }; + __name(createDefaultCoreModule, "createDefaultCoreModule"); + __name2(createDefaultCoreModule, "createDefaultCoreModule"); + __name(createDefaultSharedCoreModule, "createDefaultSharedCoreModule"); + __name2(createDefaultSharedCoreModule, "createDefaultSharedCoreModule"); + (function(Module2) { + Module2.merge = (m1, m22) => _merge(_merge({}, m1), m22); + })(Module || (Module = {})); + __name(inject, "inject"); + __name2(inject, "inject"); + isProxy = Symbol("isProxy"); + __name(eagerLoad, "eagerLoad"); + __name2(eagerLoad, "eagerLoad"); + __name(_inject, "_inject"); + __name2(_inject, "_inject"); + __requested__ = Symbol(); + __name(_resolve2, "_resolve"); + __name2(_resolve2, "_resolve"); + __name(_merge, "_merge"); + __name2(_merge, "_merge"); + indentationBuilderDefaultOptions = { + indentTokenName: "INDENT", + dedentTokenName: "DEDENT", + whitespaceTokenName: "WS", + ignoreIndentationDelimiters: [] + }; + (function(LexingMode2) { + LexingMode2["REGULAR"] = "indentation-sensitive"; + LexingMode2["IGNORE_INDENTATION"] = "ignore-indentation"; + })(LexingMode || (LexingMode = {})); + IndentationAwareTokenBuilder = class extends DefaultTokenBuilder { + static { + __name(this, "IndentationAwareTokenBuilder"); + } + static { + __name2(this, "IndentationAwareTokenBuilder"); + } + constructor(options2 = indentationBuilderDefaultOptions) { + super(); + this.indentationStack = [0]; + this.whitespaceRegExp = /[ \t]+/y; + this.options = { + ...indentationBuilderDefaultOptions, + ...options2 + }; + this.indentTokenType = createToken({ + name: this.options.indentTokenName, + pattern: this.indentMatcher.bind(this), + line_breaks: false + }); + this.dedentTokenType = createToken({ + name: this.options.dedentTokenName, + pattern: this.dedentMatcher.bind(this), + line_breaks: false + }); + } + buildTokens(grammar, options2) { + const tokenTypes = super.buildTokens(grammar, options2); + if (!isTokenTypeArray(tokenTypes)) { + throw new Error("Invalid tokens built by default builder"); + } + const { indentTokenName, dedentTokenName, whitespaceTokenName, ignoreIndentationDelimiters } = this.options; + let dedent2; + let indent; + let ws; + const otherTokens = []; + for (const tokenType of tokenTypes) { + for (const [begin, end2] of ignoreIndentationDelimiters) { + if (tokenType.name === begin) { + tokenType.PUSH_MODE = LexingMode.IGNORE_INDENTATION; + } else if (tokenType.name === end2) { + tokenType.POP_MODE = true; + } + } + if (tokenType.name === dedentTokenName) { + dedent2 = tokenType; + } else if (tokenType.name === indentTokenName) { + indent = tokenType; + } else if (tokenType.name === whitespaceTokenName) { + ws = tokenType; + } else { + otherTokens.push(tokenType); + } + } + if (!dedent2 || !indent || !ws) { + throw new Error("Some indentation/whitespace tokens not found!"); + } + if (ignoreIndentationDelimiters.length > 0) { + const multiModeLexerDef = { + modes: { + [LexingMode.REGULAR]: [dedent2, indent, ...otherTokens, ws], + [LexingMode.IGNORE_INDENTATION]: [...otherTokens, ws] + }, + defaultMode: LexingMode.REGULAR + }; + return multiModeLexerDef; + } else { + return [dedent2, indent, ws, ...otherTokens]; + } + } + flushLexingReport(text4) { + const result = super.flushLexingReport(text4); + return { + ...result, + remainingDedents: this.flushRemainingDedents(text4) + }; + } + /** + * Helper function to check if the current position is the start of a new line. + * + * @param text The full input string. + * @param offset The current position at which to check + * @returns Whether the current position is the start of a new line + */ + isStartOfLine(text4, offset) { + return offset === 0 || "\r\n".includes(text4[offset - 1]); + } + /** + * A helper function used in matching both indents and dedents. + * + * @param text The full input string. + * @param offset The current position at which to attempt a match + * @param tokens Previously scanned tokens + * @param groups Token Groups + * @returns The current and previous indentation levels and the matched whitespace + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + matchWhitespace(text4, offset, tokens2, groups) { + this.whitespaceRegExp.lastIndex = offset; + const match3 = this.whitespaceRegExp.exec(text4); + return { + currIndentLevel: match3?.[0].length ?? 0, + prevIndentLevel: this.indentationStack.at(-1), + match: match3 + }; + } + /** + * Helper function to create an instance of an indentation token. + * + * @param tokenType Indent or dedent token type + * @param text Full input string, used to calculate the line number + * @param image The original image of the token (tabs or spaces) + * @param offset Current position in the input string + * @returns The indentation token instance + */ + createIndentationTokenInstance(tokenType, text4, image, offset) { + const lineNumber = this.getLineNumber(text4, offset); + return createTokenInstance(tokenType, image, offset, offset + image.length, lineNumber, lineNumber, 1, image.length); + } + /** + * Helper function to get the line number at a given offset. + * + * @param text Full input string, used to calculate the line number + * @param offset Current position in the input string + * @returns The line number at the given offset + */ + getLineNumber(text4, offset) { + return text4.substring(0, offset).split(/\r\n|\r|\n/).length; + } + /** + * A custom pattern for matching indents + * + * @param text The full input string. + * @param offset The offset at which to attempt a match + * @param tokens Previously scanned tokens + * @param groups Token Groups + */ + indentMatcher(text4, offset, tokens2, groups) { + if (!this.isStartOfLine(text4, offset)) { + return null; + } + const { currIndentLevel, prevIndentLevel, match: match3 } = this.matchWhitespace(text4, offset, tokens2, groups); + if (currIndentLevel <= prevIndentLevel) { + return null; + } + this.indentationStack.push(currIndentLevel); + return match3; + } + /** + * A custom pattern for matching dedents + * + * @param text The full input string. + * @param offset The offset at which to attempt a match + * @param tokens Previously scanned tokens + * @param groups Token Groups + */ + dedentMatcher(text4, offset, tokens2, groups) { + if (!this.isStartOfLine(text4, offset)) { + return null; + } + const { currIndentLevel, prevIndentLevel, match: match3 } = this.matchWhitespace(text4, offset, tokens2, groups); + if (currIndentLevel >= prevIndentLevel) { + return null; + } + const matchIndentIndex = this.indentationStack.lastIndexOf(currIndentLevel); + if (matchIndentIndex === -1) { + this.diagnostics.push({ + severity: "error", + message: `Invalid dedent level ${currIndentLevel} at offset: ${offset}. Current indentation stack: ${this.indentationStack}`, + offset, + length: match3?.[0]?.length ?? 0, + line: this.getLineNumber(text4, offset), + column: 1 + }); + return null; + } + const numberOfDedents = this.indentationStack.length - matchIndentIndex - 1; + const newlinesBeforeDedent = text4.substring(0, offset).match(/[\r\n]+$/)?.[0].length ?? 1; + for (let i2 = 0; i2 < numberOfDedents; i2++) { + const token2 = this.createIndentationTokenInstance( + this.dedentTokenType, + text4, + "", + // Dedents are 0-width tokens + offset - (newlinesBeforeDedent - 1) + ); + tokens2.push(token2); + this.indentationStack.pop(); + } + return null; + } + buildTerminalToken(terminal) { + const tokenType = super.buildTerminalToken(terminal); + const { indentTokenName, dedentTokenName, whitespaceTokenName } = this.options; + if (tokenType.name === indentTokenName) { + return this.indentTokenType; + } else if (tokenType.name === dedentTokenName) { + return this.dedentTokenType; + } else if (tokenType.name === whitespaceTokenName) { + return createToken({ + name: whitespaceTokenName, + pattern: this.whitespaceRegExp, + group: Lexer2.SKIPPED + }); + } + return tokenType; + } + /** + * Resets the indentation stack between different runs of the lexer + * + * @param text Full text that was tokenized + * @returns Remaining dedent tokens to match all previous indents at the end of the file + */ + flushRemainingDedents(text4) { + const remainingDedents = []; + while (this.indentationStack.length > 1) { + remainingDedents.push(this.createIndentationTokenInstance(this.dedentTokenType, text4, "", text4.length)); + this.indentationStack.pop(); + } + this.indentationStack = [0]; + return remainingDedents; + } + }; + IndentationAwareLexer = class extends DefaultLexer { + static { + __name(this, "IndentationAwareLexer"); + } + static { + __name2(this, "IndentationAwareLexer"); + } + constructor(services) { + super(services); + if (services.parser.TokenBuilder instanceof IndentationAwareTokenBuilder) { + this.indentationTokenBuilder = services.parser.TokenBuilder; + } else { + throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder"); + } + } + tokenize(text4, options2 = DEFAULT_TOKENIZE_OPTIONS) { + const result = super.tokenize(text4); + const report = result.report; + if (options2?.mode === "full") { + result.tokens.push(...report.remainingDedents); + } + report.remainingDedents = []; + const { indentTokenType, dedentTokenType } = this.indentationTokenBuilder; + const indentTokenIdx = indentTokenType.tokenTypeIdx; + const dedentTokenIdx = dedentTokenType.tokenTypeIdx; + const cleanTokens = []; + const length2 = result.tokens.length - 1; + for (let i2 = 0; i2 < length2; i2++) { + const token2 = result.tokens[i2]; + const nextToken = result.tokens[i2 + 1]; + if (token2.tokenTypeIdx === indentTokenIdx && nextToken.tokenTypeIdx === dedentTokenIdx) { + i2++; + continue; + } + cleanTokens.push(token2); + } + if (length2 >= 0) { + cleanTokens.push(result.tokens[length2]); + } + result.tokens = cleanTokens; + return result; + } + }; + utils_exports = {}; + __export2(utils_exports, { + AstUtils: /* @__PURE__ */ __name(() => ast_utils_exports, "AstUtils"), + BiMap: /* @__PURE__ */ __name(() => BiMap, "BiMap"), + Cancellation: /* @__PURE__ */ __name(() => cancellation_exports, "Cancellation"), + ContextCache: /* @__PURE__ */ __name(() => ContextCache, "ContextCache"), + CstUtils: /* @__PURE__ */ __name(() => cst_utils_exports, "CstUtils"), + DONE_RESULT: /* @__PURE__ */ __name(() => DONE_RESULT, "DONE_RESULT"), + Deferred: /* @__PURE__ */ __name(() => Deferred, "Deferred"), + Disposable: /* @__PURE__ */ __name(() => Disposable, "Disposable"), + DisposableCache: /* @__PURE__ */ __name(() => DisposableCache, "DisposableCache"), + DocumentCache: /* @__PURE__ */ __name(() => DocumentCache, "DocumentCache"), + EMPTY_STREAM: /* @__PURE__ */ __name(() => EMPTY_STREAM, "EMPTY_STREAM"), + ErrorWithLocation: /* @__PURE__ */ __name(() => ErrorWithLocation, "ErrorWithLocation"), + GrammarUtils: /* @__PURE__ */ __name(() => grammar_utils_exports, "GrammarUtils"), + MultiMap: /* @__PURE__ */ __name(() => MultiMap, "MultiMap"), + OperationCancelled: /* @__PURE__ */ __name(() => OperationCancelled, "OperationCancelled"), + Reduction: /* @__PURE__ */ __name(() => Reduction, "Reduction"), + RegExpUtils: /* @__PURE__ */ __name(() => regexp_utils_exports, "RegExpUtils"), + SimpleCache: /* @__PURE__ */ __name(() => SimpleCache, "SimpleCache"), + StreamImpl: /* @__PURE__ */ __name(() => StreamImpl, "StreamImpl"), + TreeStreamImpl: /* @__PURE__ */ __name(() => TreeStreamImpl, "TreeStreamImpl"), + URI: /* @__PURE__ */ __name(() => URI2, "URI"), + UriTrie: /* @__PURE__ */ __name(() => UriTrie, "UriTrie"), + UriUtils: /* @__PURE__ */ __name(() => UriUtils, "UriUtils"), + WorkspaceCache: /* @__PURE__ */ __name(() => WorkspaceCache, "WorkspaceCache"), + assertCondition: /* @__PURE__ */ __name(() => assertCondition, "assertCondition"), + assertUnreachable: /* @__PURE__ */ __name(() => assertUnreachable, "assertUnreachable"), + delayNextTick: /* @__PURE__ */ __name(() => delayNextTick, "delayNextTick"), + interruptAndCheck: /* @__PURE__ */ __name(() => interruptAndCheck, "interruptAndCheck"), + isOperationCancelled: /* @__PURE__ */ __name(() => isOperationCancelled, "isOperationCancelled"), + loadGrammarFromJson: /* @__PURE__ */ __name(() => loadGrammarFromJson, "loadGrammarFromJson"), + setInterruptionPeriod: /* @__PURE__ */ __name(() => setInterruptionPeriod, "setInterruptionPeriod"), + startCancelableOperation: /* @__PURE__ */ __name(() => startCancelableOperation, "startCancelableOperation"), + stream: /* @__PURE__ */ __name(() => stream, "stream") + }); + __reExport(utils_exports, event_exports); + EmptyFileSystemProvider = class { + static { + __name(this, "EmptyFileSystemProvider"); + } + static { + __name2(this, "EmptyFileSystemProvider"); + } + stat(_uri) { + throw new Error("No file system is available."); + } + statSync(_uri) { + throw new Error("No file system is available."); + } + async exists() { + return false; + } + existsSync() { + return false; + } + readBinary() { + throw new Error("No file system is available."); + } + readBinarySync() { + throw new Error("No file system is available."); + } + readFile() { + throw new Error("No file system is available."); + } + readFileSync() { + throw new Error("No file system is available."); + } + async readDirectory() { + return []; + } + readDirectorySync() { + return []; + } + }; + EmptyFileSystem = { + fileSystemProvider: /* @__PURE__ */ __name2(() => new EmptyFileSystemProvider(), "fileSystemProvider") + }; + minimalGrammarModule = { + Grammar: /* @__PURE__ */ __name2(() => void 0, "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => ({ + caseInsensitive: false, + fileExtensions: [".langium"], + languageId: "langium" + }), "LanguageMetaData") + }; + minimalSharedGrammarModule = { + AstReflection: /* @__PURE__ */ __name2(() => new LangiumGrammarAstReflection(), "AstReflection") + }; + __name(createMinimalGrammarServices, "createMinimalGrammarServices"); + __name2(createMinimalGrammarServices, "createMinimalGrammarServices"); + __name(loadGrammarFromJson, "loadGrammarFromJson"); + __name2(loadGrammarFromJson, "loadGrammarFromJson"); + __reExport(lib_exports, utils_exports); + DefaultLangiumProfiler = class { + static { + __name(this, "DefaultLangiumProfiler"); + } + static { + __name2(this, "DefaultLangiumProfiler"); + } + constructor(activeCategories) { + this.activeCategories = /* @__PURE__ */ new Set(); + this.allCategories = /* @__PURE__ */ new Set(["validating", "parsing", "linking"]); + this.activeCategories = activeCategories ?? new Set(this.allCategories); + this.records = new MultiMap(); + } + isActive(category) { + return this.activeCategories.has(category); + } + start(...categories) { + if (!categories) { + this.activeCategories = new Set(this.allCategories); + } else { + categories.forEach((category) => this.activeCategories.add(category)); + } + } + stop(...categories) { + if (!categories) { + this.activeCategories.clear(); + } else { + categories.forEach((category) => this.activeCategories.delete(category)); + } + } + createTask(category, taskId) { + if (!this.isActive(category)) { + throw new Error(`Category "${category}" is not active.`); + } + console.log(`Creating profiling task for '${category}.${taskId}'.`); + return new ProfilingTask((record) => this.records.add(category, this.dumpRecord(category, record)), taskId); + } + dumpRecord(category, record) { + console.info(`Task ${category}.${record.identifier} executed in ${record.duration.toFixed(2)}ms and ended at ${record.date.toISOString()}`); + const result = []; + for (const key of record.entries.keys()) { + const values22 = record.entries.get(key); + const duration = values22.reduce((p3, c3) => p3 + c3); + result.push({ name: `${record.identifier}.${key}`, count: values22.length, duration }); + } + const taskInternalDuration = record.duration - result.map((r2) => r2.duration).reduce((a2, b3) => a2 + b3, 0); + result.push({ name: record.identifier, count: 1, duration: taskInternalDuration }); + result.sort((a2, b3) => b3.duration - a2.duration); + function Round(value2) { + return Math.round(100 * value2) / 100; + } + __name(Round, "Round"); + __name2(Round, "Round"); + console.table(result.map((e3) => { + return { Element: e3.name, Count: e3.count, "Self %": Round(100 * e3.duration / record.duration), "Time (ms)": Round(e3.duration) }; + })); + return record; + } + getRecords(...categories) { + if (categories.length === 0) { + return this.records.values(); + } else { + return this.records.entries().filter((e3) => categories.some((c3) => c3 === e3[0])).flatMap((e3) => e3[1]); + } + } + }; + ProfilingTask = class { + static { + __name(this, "ProfilingTask"); + } + static { + __name2(this, "ProfilingTask"); + } + constructor(addRecord, identifier2) { + this.stack = []; + this.entries = new MultiMap(); + this.addRecord = addRecord; + this.identifier = identifier2; + } + start() { + if (this.startTime !== void 0) { + throw new Error(`Task "${this.identifier}" is already started.`); + } + this.startTime = performance.now(); + } + stop() { + if (this.startTime === void 0) { + throw new Error(`Task "${this.identifier}" was not started.`); + } + if (this.stack.length !== 0) { + throw new Error(`Task "${this.identifier}" cannot be stopped before sub-task(s): ${this.stack.map((s2) => s2.id).join(", ")}.`); + } + const record = { + identifier: this.identifier, + date: /* @__PURE__ */ new Date(), + duration: performance.now() - this.startTime, + entries: this.entries + }; + this.addRecord(record); + this.startTime = void 0; + this.entries.clear(); + } + startSubTask(subTaskId) { + this.stack.push({ id: subTaskId, start: performance.now(), content: 0 }); + } + stopSubTask(subTaskId) { + const subStack = this.stack.pop(); + if (!subStack) { + throw new Error(`Task "${this.identifier}.${subTaskId}" was not started.`); + } + if (subStack.id !== subTaskId) { + throw new Error(`Sub-Task "${subStack.id}" is not already stopped.`); + } + const duration = performance.now() - subStack.start; + if (this.stack.at(-1) !== void 0) { + this.stack[this.stack.length - 1].content += duration; + } + const selfDuration = duration - subStack.content; + this.entries.add(subTaskId, selfDuration); + } + }; + ((ArchitectureGrammar2) => { + ArchitectureGrammar2.Terminals = { + ARROW_DIRECTION: /L|R|T|B/, + ARROW_GROUP: /\{group\}/, + ARROW_INTO: /<|>/, + ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/, + ID: /[\w]([-\w]*\w)?/, + NEWLINE: /\r?\n/, + WHITESPACE: /[\t ]+/, + YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/, + DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/, + SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/, + ARCH_ICON: /\([\w-:]+\)/, + ARCH_TITLE: /\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[\w ]+)\]/ + }; + })(ArchitectureGrammar || (ArchitectureGrammar = {})); + ((EventModeling2) => { + EventModeling2.Terminals = { + EM_ID: /[_a-zA-Z][\w_]*/, + EM_FID: /\d{1,3}/, + EM_DATA_INLINE: /\{(.*)\}|"(.*)"|'(.*)'/, + EM_DATA_BLOCK: /\{[\t ]*\r?\n(?:[\S\s]*?\r?\n)?\}(?:\r?\n|(?!\S))/, + EM_ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + EM_ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + EM_TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + EM_WS: /\s+/, + EM_YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/, + EM_DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/, + EM_SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/, + EM_ML_COMMENT: /\/\*[\s\S]*?\*\//, + EM_SL_COMMENT: /\/\/[^\n\r]*/ + }; + })(EventModeling || (EventModeling = {})); + ((GitGraphGrammar2) => { + GitGraphGrammar2.Terminals = { + ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + INT: /0|[1-9][0-9]*(?!\.)/, + STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/, + NEWLINE: /\r?\n/, + WHITESPACE: /[\t ]+/, + YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/, + DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/, + SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/, + REFERENCE: /\w([-\./\w]*[-\w])?/ + }; + })(GitGraphGrammar || (GitGraphGrammar = {})); + ((InfoGrammar2) => { + InfoGrammar2.Terminals = { + ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + NEWLINE: /\r?\n/, + WHITESPACE: /[\t ]+/, + YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/, + DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/, + SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/ + }; + })(InfoGrammar || (InfoGrammar = {})); + ((PacketGrammar2) => { + PacketGrammar2.Terminals = { + ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + INT: /0|[1-9][0-9]*(?!\.)/, + STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/, + NEWLINE: /\r?\n/, + WHITESPACE: /[\t ]+/, + YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/, + DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/, + SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/ + }; + })(PacketGrammar || (PacketGrammar = {})); + ((PieGrammar2) => { + PieGrammar2.Terminals = { + NUMBER_PIE: /(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/, + ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/, + NEWLINE: /\r?\n/, + WHITESPACE: /[\t ]+/, + YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/, + DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/, + SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/ + }; + })(PieGrammar || (PieGrammar = {})); + ((RadarGrammar2) => { + RadarGrammar2.Terminals = { + GRATICULE: /circle|polygon/, + BOOLEAN: /true|false/, + ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + NUMBER: /(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/, + STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/, + ID: /[\w]([-\w]*\w)?/, + NEWLINE: /\r?\n/, + WHITESPACE: /[\t ]+/, + YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/, + DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/, + SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/ + }; + })(RadarGrammar || (RadarGrammar = {})); + ((TreemapGrammar2) => { + TreemapGrammar2.Terminals = { + ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + TREEMAP_KEYWORD: /treemap-beta|treemap/, + CLASS_DEF: /classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/, + STYLE_SEPARATOR: /:::/, + SEPARATOR: /:/, + COMMA: /,/, + INDENTATION: /[ \t]{1,}/, + WS: /[ \t]+/, + ML_COMMENT: /\%\%[^\n]*/, + NL: /\r?\n/, + ID2: /[a-zA-Z_][a-zA-Z0-9_]*/, + NUMBER2: /[0-9_\.\,]+/, + STRING2: /"[^"]*"|'[^']*'/ + }; + })(TreemapGrammar || (TreemapGrammar = {})); + ((TreeViewGrammar2) => { + TreeViewGrammar2.Terminals = { + ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + INDENTATION: /[ \t]{1,}/, + WS: /[ \t]+/, + ML_COMMENT: /\%\%[^\n]*/, + NL: /\r?\n/, + STRING2: /"[^"]*"|'[^']*'/ + }; + })(TreeViewGrammar || (TreeViewGrammar = {})); + ((WardleyGrammar2) => { + WardleyGrammar2.Terminals = { + WARDLEY_NUMBER: /[0-9]+\.[0-9]+/, + ARROW: /->/, + LINK_PORT: /\+<>|\+>|\+|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/, + LINK_LABEL: /;[^\n\r]+/, + STRATEGY: /build|buy|outsource|market/, + KW_WARDLEY: /wardley-beta/, + KW_SIZE: /size/, + KW_EVOLUTION: /evolution/, + KW_ANCHOR: /anchor/, + KW_COMPONENT: /component/, + KW_LABEL: /label/, + KW_INERTIA: /inertia/, + KW_EVOLVE: /evolve/, + KW_PIPELINE: /pipeline/, + KW_NOTE: /note/, + KW_ANNOTATIONS: /annotations/, + KW_ANNOTATION: /annotation/, + KW_ACCELERATOR: /accelerator/, + KW_DEACCELERATOR: /deaccelerator/, + NAME_WITH_SPACES: /(?!title\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/, + WS: /[ \t]+/, + ACC_DESCR: /[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/, + ACC_TITLE: /[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/, + TITLE: /[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/, + INT: /0|[1-9][0-9]*(?!\.)/, + STRING: /"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/, + ID: /[\w]([-\w]*\w)?/, + NEWLINE: /\r?\n/, + WHITESPACE: /[\t ]+/, + YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/, + DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/, + SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/ + }; + })(WardleyGrammar || (WardleyGrammar = {})); + MermaidTerminals = { + ...ArchitectureGrammar.Terminals, + ...EventModeling.Terminals, + ...GitGraphGrammar.Terminals, + ...InfoGrammar.Terminals, + ...PacketGrammar.Terminals, + ...PieGrammar.Terminals, + ...RadarGrammar.Terminals, + ...TreeViewGrammar.Terminals, + ...TreemapGrammar.Terminals, + ...WardleyGrammar.Terminals + }; + Accelerator = { + $type: "Accelerator", + name: "name", + x: "x", + y: "y" + }; + Anchor2 = { + $type: "Anchor", + evolution: "evolution", + name: "name", + visibility: "visibility" + }; + Annotation = { + $type: "Annotation", + number: "number", + text: "text", + x: "x", + y: "y" + }; + Annotations = { + $type: "Annotations", + x: "x", + y: "y" + }; + Architecture = { + $type: "Architecture", + accDescr: "accDescr", + accTitle: "accTitle", + edges: "edges", + groups: "groups", + junctions: "junctions", + services: "services", + title: "title" + }; + __name(isArchitecture, "isArchitecture"); + __name2(isArchitecture, "isArchitecture"); + Axis = { + $type: "Axis", + label: "label", + name: "name" + }; + Branch = { + $type: "Branch", + name: "name", + order: "order" + }; + __name(isBranch, "isBranch"); + __name2(isBranch, "isBranch"); + Checkout = { + $type: "Checkout", + branch: "branch" + }; + CherryPicking = { + $type: "CherryPicking", + id: "id", + parent: "parent", + tags: "tags" + }; + ClassDefStatement = { + $type: "ClassDefStatement", + className: "className", + styleText: "styleText" + }; + Commit = { + $type: "Commit", + id: "id", + message: "message", + tags: "tags", + type: "type" + }; + __name(isCommit, "isCommit"); + __name2(isCommit, "isCommit"); + Common = { + $type: "Common", + accDescr: "accDescr", + accTitle: "accTitle", + title: "title" + }; + Component = { + $type: "Component", + decorator: "decorator", + evolution: "evolution", + inertia: "inertia", + label: "label", + name: "name", + visibility: "visibility" + }; + Curve = { + $type: "Curve", + entries: "entries", + label: "label", + name: "name" + }; + Deaccelerator = { + $type: "Deaccelerator", + name: "name", + x: "x", + y: "y" + }; + Decorator = { + $type: "Decorator", + strategy: "strategy" + }; + Direction = { + $type: "Direction", + accDescr: "accDescr", + accTitle: "accTitle", + dir: "dir", + statements: "statements", + title: "title" + }; + Edge = { + $type: "Edge", + lhsDir: "lhsDir", + lhsGroup: "lhsGroup", + lhsId: "lhsId", + lhsInto: "lhsInto", + rhsDir: "rhsDir", + rhsGroup: "rhsGroup", + rhsId: "rhsId", + rhsInto: "rhsInto", + title: "title" + }; + EmDataEntity = { + $type: "EmDataEntity", + dataBlockValue: "dataBlockValue", + dataType: "dataType", + name: "name" + }; + EmFrame = { + $type: "EmFrame" + }; + EmGwt = { + $type: "EmGwt", + givenStatements: "givenStatements", + sourceFrame: "sourceFrame", + thenStatements: "thenStatements", + whenStatements: "whenStatements" + }; + EmGwtStatement = { + $type: "EmGwtStatement", + entityIdentifier: "entityIdentifier" + }; + EmModelEntity = { + $type: "EmModelEntity", + name: "name" + }; + __name(isEmModelEntityType, "isEmModelEntityType"); + __name2(isEmModelEntityType, "isEmModelEntityType"); + EmNoteEntity = { + $type: "EmNoteEntity", + dataBlockValue: "dataBlockValue", + dataType: "dataType", + sourceFrame: "sourceFrame" + }; + EmResetFrame = { + $type: "EmResetFrame", + dataInlineValue: "dataInlineValue", + dataReference: "dataReference", + dataType: "dataType", + entityIdentifier: "entityIdentifier", + modelEntityType: "modelEntityType", + name: "name", + sourceFrames: "sourceFrames" + }; + __name(isEmResetFrame, "isEmResetFrame"); + __name2(isEmResetFrame, "isEmResetFrame"); + EmTimeFrame = { + $type: "EmTimeFrame", + dataInlineValue: "dataInlineValue", + dataReference: "dataReference", + dataType: "dataType", + entityIdentifier: "entityIdentifier", + modelEntityType: "modelEntityType", + name: "name", + sourceFrames: "sourceFrames" + }; + Entry = { + $type: "Entry", + axis: "axis", + value: "value" + }; + EventModel = { + $type: "EventModel", + accDescr: "accDescr", + accTitle: "accTitle", + dataEntities: "dataEntities", + frames: "frames", + gwtEntities: "gwtEntities", + modelEntities: "modelEntities", + noteEntities: "noteEntities", + title: "title" + }; + Evolution = { + $type: "Evolution", + stages: "stages" + }; + EvolutionStage = { + $type: "EvolutionStage", + boundary: "boundary", + name: "name", + secondName: "secondName" + }; + Evolve = { + $type: "Evolve", + component: "component", + target: "target" + }; + GitGraph = { + $type: "GitGraph", + accDescr: "accDescr", + accTitle: "accTitle", + statements: "statements", + title: "title" + }; + __name(isGitGraph, "isGitGraph"); + __name2(isGitGraph, "isGitGraph"); + Group2 = { + $type: "Group", + icon: "icon", + id: "id", + in: "in", + title: "title" + }; + Info = { + $type: "Info", + accDescr: "accDescr", + accTitle: "accTitle", + title: "title" + }; + __name(isInfo, "isInfo"); + __name2(isInfo, "isInfo"); + Item = { + $type: "Item", + classSelector: "classSelector", + name: "name" + }; + Junction = { + $type: "Junction", + id: "id", + in: "in" + }; + Label = { + $type: "Label", + negX: "negX", + negY: "negY", + offsetX: "offsetX", + offsetY: "offsetY" + }; + Leaf = { + $type: "Leaf", + classSelector: "classSelector", + name: "name", + value: "value" + }; + Link = { + $type: "Link", + arrow: "arrow", + from: "from", + fromPort: "fromPort", + linkLabel: "linkLabel", + to: "to", + toPort: "toPort" + }; + Merge = { + $type: "Merge", + branch: "branch", + id: "id", + tags: "tags", + type: "type" + }; + __name(isMerge, "isMerge"); + __name2(isMerge, "isMerge"); + Note = { + $type: "Note", + evolution: "evolution", + text: "text", + visibility: "visibility" + }; + Option22 = { + $type: "Option", + name: "name", + value: "value" + }; + Packet = { + $type: "Packet", + accDescr: "accDescr", + accTitle: "accTitle", + blocks: "blocks", + title: "title" + }; + __name(isPacket, "isPacket"); + __name2(isPacket, "isPacket"); + PacketBlock = { + $type: "PacketBlock", + bits: "bits", + end: "end", + label: "label", + start: "start" + }; + __name(isPacketBlock, "isPacketBlock"); + __name2(isPacketBlock, "isPacketBlock"); + Pie = { + $type: "Pie", + accDescr: "accDescr", + accTitle: "accTitle", + sections: "sections", + showData: "showData", + title: "title" + }; + __name(isPie, "isPie"); + __name2(isPie, "isPie"); + PieSection = { + $type: "PieSection", + label: "label", + value: "value" + }; + __name(isPieSection, "isPieSection"); + __name2(isPieSection, "isPieSection"); + Pipeline = { + $type: "Pipeline", + components: "components", + parent: "parent" + }; + PipelineComponent = { + $type: "PipelineComponent", + evolution: "evolution", + label: "label", + name: "name" + }; + Radar = { + $type: "Radar", + accDescr: "accDescr", + accTitle: "accTitle", + axes: "axes", + curves: "curves", + options: "options", + title: "title" + }; + Section = { + $type: "Section", + classSelector: "classSelector", + name: "name" + }; + Service = { + $type: "Service", + icon: "icon", + iconText: "iconText", + id: "id", + in: "in", + title: "title" + }; + Size = { + $type: "Size", + height: "height", + width: "width" + }; + Statement = { + $type: "Statement" + }; + Treemap = { + $type: "Treemap", + accDescr: "accDescr", + accTitle: "accTitle", + title: "title", + TreemapRows: "TreemapRows" + }; + __name(isTreemap, "isTreemap"); + __name2(isTreemap, "isTreemap"); + TreemapRow = { + $type: "TreemapRow", + indent: "indent", + item: "item" + }; + TreeNode = { + $type: "TreeNode", + indent: "indent", + name: "name" + }; + TreeView = { + $type: "TreeView", + accDescr: "accDescr", + accTitle: "accTitle", + nodes: "nodes", + title: "title" + }; + Wardley = { + $type: "Wardley", + accDescr: "accDescr", + accelerators: "accelerators", + accTitle: "accTitle", + anchors: "anchors", + annotation: "annotation", + annotations: "annotations", + components: "components", + deaccelerators: "deaccelerators", + evolution: "evolution", + evolves: "evolves", + links: "links", + notes: "notes", + pipelines: "pipelines", + size: "size", + title: "title" + }; + __name(isWardley, "isWardley"); + __name2(isWardley, "isWardley"); + MermaidAstReflection = class extends AbstractAstReflection { + static { + __name(this, "MermaidAstReflection"); + } + constructor() { + super(...arguments); + this.types = { + Accelerator: { + name: Accelerator.$type, + properties: { + name: { + name: Accelerator.name + }, + x: { + name: Accelerator.x + }, + y: { + name: Accelerator.y + } + }, + superTypes: [] + }, + Anchor: { + name: Anchor2.$type, + properties: { + evolution: { + name: Anchor2.evolution + }, + name: { + name: Anchor2.name + }, + visibility: { + name: Anchor2.visibility + } + }, + superTypes: [] + }, + Annotation: { + name: Annotation.$type, + properties: { + number: { + name: Annotation.number + }, + text: { + name: Annotation.text + }, + x: { + name: Annotation.x + }, + y: { + name: Annotation.y + } + }, + superTypes: [] + }, + Annotations: { + name: Annotations.$type, + properties: { + x: { + name: Annotations.x + }, + y: { + name: Annotations.y + } + }, + superTypes: [] + }, + Architecture: { + name: Architecture.$type, + properties: { + accDescr: { + name: Architecture.accDescr + }, + accTitle: { + name: Architecture.accTitle + }, + edges: { + name: Architecture.edges, + defaultValue: [] + }, + groups: { + name: Architecture.groups, + defaultValue: [] + }, + junctions: { + name: Architecture.junctions, + defaultValue: [] + }, + services: { + name: Architecture.services, + defaultValue: [] + }, + title: { + name: Architecture.title + } + }, + superTypes: [] + }, + Axis: { + name: Axis.$type, + properties: { + label: { + name: Axis.label + }, + name: { + name: Axis.name + } + }, + superTypes: [] + }, + Branch: { + name: Branch.$type, + properties: { + name: { + name: Branch.name + }, + order: { + name: Branch.order + } + }, + superTypes: [Statement.$type] + }, + Checkout: { + name: Checkout.$type, + properties: { + branch: { + name: Checkout.branch + } + }, + superTypes: [Statement.$type] + }, + CherryPicking: { + name: CherryPicking.$type, + properties: { + id: { + name: CherryPicking.id + }, + parent: { + name: CherryPicking.parent + }, + tags: { + name: CherryPicking.tags, + defaultValue: [] + } + }, + superTypes: [Statement.$type] + }, + ClassDefStatement: { + name: ClassDefStatement.$type, + properties: { + className: { + name: ClassDefStatement.className + }, + styleText: { + name: ClassDefStatement.styleText + } + }, + superTypes: [] + }, + Commit: { + name: Commit.$type, + properties: { + id: { + name: Commit.id + }, + message: { + name: Commit.message + }, + tags: { + name: Commit.tags, + defaultValue: [] + }, + type: { + name: Commit.type + } + }, + superTypes: [Statement.$type] + }, + Common: { + name: Common.$type, + properties: { + accDescr: { + name: Common.accDescr + }, + accTitle: { + name: Common.accTitle + }, + title: { + name: Common.title + } + }, + superTypes: [] + }, + Component: { + name: Component.$type, + properties: { + decorator: { + name: Component.decorator + }, + evolution: { + name: Component.evolution + }, + inertia: { + name: Component.inertia, + defaultValue: false + }, + label: { + name: Component.label + }, + name: { + name: Component.name + }, + visibility: { + name: Component.visibility + } + }, + superTypes: [] + }, + Curve: { + name: Curve.$type, + properties: { + entries: { + name: Curve.entries, + defaultValue: [] + }, + label: { + name: Curve.label + }, + name: { + name: Curve.name + } + }, + superTypes: [] + }, + Deaccelerator: { + name: Deaccelerator.$type, + properties: { + name: { + name: Deaccelerator.name + }, + x: { + name: Deaccelerator.x + }, + y: { + name: Deaccelerator.y + } + }, + superTypes: [] + }, + Decorator: { + name: Decorator.$type, + properties: { + strategy: { + name: Decorator.strategy + } + }, + superTypes: [] + }, + Direction: { + name: Direction.$type, + properties: { + accDescr: { + name: Direction.accDescr + }, + accTitle: { + name: Direction.accTitle + }, + dir: { + name: Direction.dir + }, + statements: { + name: Direction.statements, + defaultValue: [] + }, + title: { + name: Direction.title + } + }, + superTypes: [GitGraph.$type] + }, + Edge: { + name: Edge.$type, + properties: { + lhsDir: { + name: Edge.lhsDir + }, + lhsGroup: { + name: Edge.lhsGroup, + defaultValue: false + }, + lhsId: { + name: Edge.lhsId + }, + lhsInto: { + name: Edge.lhsInto, + defaultValue: false + }, + rhsDir: { + name: Edge.rhsDir + }, + rhsGroup: { + name: Edge.rhsGroup, + defaultValue: false + }, + rhsId: { + name: Edge.rhsId + }, + rhsInto: { + name: Edge.rhsInto, + defaultValue: false + }, + title: { + name: Edge.title + } + }, + superTypes: [] + }, + EmDataEntity: { + name: EmDataEntity.$type, + properties: { + dataBlockValue: { + name: EmDataEntity.dataBlockValue + }, + dataType: { + name: EmDataEntity.dataType + }, + name: { + name: EmDataEntity.name + } + }, + superTypes: [] + }, + EmFrame: { + name: EmFrame.$type, + properties: {}, + superTypes: [] + }, + EmGwt: { + name: EmGwt.$type, + properties: { + givenStatements: { + name: EmGwt.givenStatements, + defaultValue: [] + }, + sourceFrame: { + name: EmGwt.sourceFrame, + referenceType: EmFrame.$type + }, + thenStatements: { + name: EmGwt.thenStatements, + defaultValue: [] + }, + whenStatements: { + name: EmGwt.whenStatements, + defaultValue: [] + } + }, + superTypes: [] + }, + EmGwtStatement: { + name: EmGwtStatement.$type, + properties: { + entityIdentifier: { + name: EmGwtStatement.entityIdentifier, + referenceType: EmModelEntity.$type + } + }, + superTypes: [] + }, + EmModelEntity: { + name: EmModelEntity.$type, + properties: { + name: { + name: EmModelEntity.name + } + }, + superTypes: [] + }, + EmNoteEntity: { + name: EmNoteEntity.$type, + properties: { + dataBlockValue: { + name: EmNoteEntity.dataBlockValue + }, + dataType: { + name: EmNoteEntity.dataType + }, + sourceFrame: { + name: EmNoteEntity.sourceFrame, + referenceType: EmFrame.$type + } + }, + superTypes: [] + }, + EmResetFrame: { + name: EmResetFrame.$type, + properties: { + dataInlineValue: { + name: EmResetFrame.dataInlineValue + }, + dataReference: { + name: EmResetFrame.dataReference, + referenceType: EmDataEntity.$type + }, + dataType: { + name: EmResetFrame.dataType + }, + entityIdentifier: { + name: EmResetFrame.entityIdentifier + }, + modelEntityType: { + name: EmResetFrame.modelEntityType + }, + name: { + name: EmResetFrame.name + }, + sourceFrames: { + name: EmResetFrame.sourceFrames, + defaultValue: [], + referenceType: EmFrame.$type + } + }, + superTypes: [EmFrame.$type] + }, + EmTimeFrame: { + name: EmTimeFrame.$type, + properties: { + dataInlineValue: { + name: EmTimeFrame.dataInlineValue + }, + dataReference: { + name: EmTimeFrame.dataReference, + referenceType: EmDataEntity.$type + }, + dataType: { + name: EmTimeFrame.dataType + }, + entityIdentifier: { + name: EmTimeFrame.entityIdentifier + }, + modelEntityType: { + name: EmTimeFrame.modelEntityType + }, + name: { + name: EmTimeFrame.name + }, + sourceFrames: { + name: EmTimeFrame.sourceFrames, + defaultValue: [], + referenceType: EmFrame.$type + } + }, + superTypes: [EmFrame.$type] + }, + Entry: { + name: Entry.$type, + properties: { + axis: { + name: Entry.axis, + referenceType: Axis.$type + }, + value: { + name: Entry.value + } + }, + superTypes: [] + }, + EventModel: { + name: EventModel.$type, + properties: { + accDescr: { + name: EventModel.accDescr + }, + accTitle: { + name: EventModel.accTitle + }, + dataEntities: { + name: EventModel.dataEntities, + defaultValue: [] + }, + frames: { + name: EventModel.frames, + defaultValue: [] + }, + gwtEntities: { + name: EventModel.gwtEntities, + defaultValue: [] + }, + modelEntities: { + name: EventModel.modelEntities, + defaultValue: [] + }, + noteEntities: { + name: EventModel.noteEntities, + defaultValue: [] + }, + title: { + name: EventModel.title + } + }, + superTypes: [] + }, + Evolution: { + name: Evolution.$type, + properties: { + stages: { + name: Evolution.stages, + defaultValue: [] + } + }, + superTypes: [] + }, + EvolutionStage: { + name: EvolutionStage.$type, + properties: { + boundary: { + name: EvolutionStage.boundary + }, + name: { + name: EvolutionStage.name + }, + secondName: { + name: EvolutionStage.secondName + } + }, + superTypes: [] + }, + Evolve: { + name: Evolve.$type, + properties: { + component: { + name: Evolve.component + }, + target: { + name: Evolve.target + } + }, + superTypes: [] + }, + GitGraph: { + name: GitGraph.$type, + properties: { + accDescr: { + name: GitGraph.accDescr + }, + accTitle: { + name: GitGraph.accTitle + }, + statements: { + name: GitGraph.statements, + defaultValue: [] + }, + title: { + name: GitGraph.title + } + }, + superTypes: [] + }, + Group: { + name: Group2.$type, + properties: { + icon: { + name: Group2.icon + }, + id: { + name: Group2.id + }, + in: { + name: Group2.in + }, + title: { + name: Group2.title + } + }, + superTypes: [] + }, + Info: { + name: Info.$type, + properties: { + accDescr: { + name: Info.accDescr + }, + accTitle: { + name: Info.accTitle + }, + title: { + name: Info.title + } + }, + superTypes: [] + }, + Item: { + name: Item.$type, + properties: { + classSelector: { + name: Item.classSelector + }, + name: { + name: Item.name + } + }, + superTypes: [] + }, + Junction: { + name: Junction.$type, + properties: { + id: { + name: Junction.id + }, + in: { + name: Junction.in + } + }, + superTypes: [] + }, + Label: { + name: Label.$type, + properties: { + negX: { + name: Label.negX, + defaultValue: false + }, + negY: { + name: Label.negY, + defaultValue: false + }, + offsetX: { + name: Label.offsetX + }, + offsetY: { + name: Label.offsetY + } + }, + superTypes: [] + }, + Leaf: { + name: Leaf.$type, + properties: { + classSelector: { + name: Leaf.classSelector + }, + name: { + name: Leaf.name + }, + value: { + name: Leaf.value + } + }, + superTypes: [Item.$type] + }, + Link: { + name: Link.$type, + properties: { + arrow: { + name: Link.arrow + }, + from: { + name: Link.from + }, + fromPort: { + name: Link.fromPort + }, + linkLabel: { + name: Link.linkLabel + }, + to: { + name: Link.to + }, + toPort: { + name: Link.toPort + } + }, + superTypes: [] + }, + Merge: { + name: Merge.$type, + properties: { + branch: { + name: Merge.branch + }, + id: { + name: Merge.id + }, + tags: { + name: Merge.tags, + defaultValue: [] + }, + type: { + name: Merge.type + } + }, + superTypes: [Statement.$type] + }, + Note: { + name: Note.$type, + properties: { + evolution: { + name: Note.evolution + }, + text: { + name: Note.text + }, + visibility: { + name: Note.visibility + } + }, + superTypes: [] + }, + Option: { + name: Option22.$type, + properties: { + name: { + name: Option22.name + }, + value: { + name: Option22.value, + defaultValue: false + } + }, + superTypes: [] + }, + Packet: { + name: Packet.$type, + properties: { + accDescr: { + name: Packet.accDescr + }, + accTitle: { + name: Packet.accTitle + }, + blocks: { + name: Packet.blocks, + defaultValue: [] + }, + title: { + name: Packet.title + } + }, + superTypes: [] + }, + PacketBlock: { + name: PacketBlock.$type, + properties: { + bits: { + name: PacketBlock.bits + }, + end: { + name: PacketBlock.end + }, + label: { + name: PacketBlock.label + }, + start: { + name: PacketBlock.start + } + }, + superTypes: [] + }, + Pie: { + name: Pie.$type, + properties: { + accDescr: { + name: Pie.accDescr + }, + accTitle: { + name: Pie.accTitle + }, + sections: { + name: Pie.sections, + defaultValue: [] + }, + showData: { + name: Pie.showData, + defaultValue: false + }, + title: { + name: Pie.title + } + }, + superTypes: [] + }, + PieSection: { + name: PieSection.$type, + properties: { + label: { + name: PieSection.label + }, + value: { + name: PieSection.value + } + }, + superTypes: [] + }, + Pipeline: { + name: Pipeline.$type, + properties: { + components: { + name: Pipeline.components, + defaultValue: [] + }, + parent: { + name: Pipeline.parent + } + }, + superTypes: [] + }, + PipelineComponent: { + name: PipelineComponent.$type, + properties: { + evolution: { + name: PipelineComponent.evolution + }, + label: { + name: PipelineComponent.label + }, + name: { + name: PipelineComponent.name + } + }, + superTypes: [] + }, + Radar: { + name: Radar.$type, + properties: { + accDescr: { + name: Radar.accDescr + }, + accTitle: { + name: Radar.accTitle + }, + axes: { + name: Radar.axes, + defaultValue: [] + }, + curves: { + name: Radar.curves, + defaultValue: [] + }, + options: { + name: Radar.options, + defaultValue: [] + }, + title: { + name: Radar.title + } + }, + superTypes: [] + }, + Section: { + name: Section.$type, + properties: { + classSelector: { + name: Section.classSelector + }, + name: { + name: Section.name + } + }, + superTypes: [Item.$type] + }, + Service: { + name: Service.$type, + properties: { + icon: { + name: Service.icon + }, + iconText: { + name: Service.iconText + }, + id: { + name: Service.id + }, + in: { + name: Service.in + }, + title: { + name: Service.title + } + }, + superTypes: [] + }, + Size: { + name: Size.$type, + properties: { + height: { + name: Size.height + }, + width: { + name: Size.width + } + }, + superTypes: [] + }, + Statement: { + name: Statement.$type, + properties: {}, + superTypes: [] + }, + TreeNode: { + name: TreeNode.$type, + properties: { + indent: { + name: TreeNode.indent + }, + name: { + name: TreeNode.name + } + }, + superTypes: [] + }, + TreeView: { + name: TreeView.$type, + properties: { + accDescr: { + name: TreeView.accDescr + }, + accTitle: { + name: TreeView.accTitle + }, + nodes: { + name: TreeView.nodes, + defaultValue: [] + }, + title: { + name: TreeView.title + } + }, + superTypes: [] + }, + Treemap: { + name: Treemap.$type, + properties: { + accDescr: { + name: Treemap.accDescr + }, + accTitle: { + name: Treemap.accTitle + }, + title: { + name: Treemap.title + }, + TreemapRows: { + name: Treemap.TreemapRows, + defaultValue: [] + } + }, + superTypes: [] + }, + TreemapRow: { + name: TreemapRow.$type, + properties: { + indent: { + name: TreemapRow.indent + }, + item: { + name: TreemapRow.item + } + }, + superTypes: [] + }, + Wardley: { + name: Wardley.$type, + properties: { + accDescr: { + name: Wardley.accDescr + }, + accelerators: { + name: Wardley.accelerators, + defaultValue: [] + }, + accTitle: { + name: Wardley.accTitle + }, + anchors: { + name: Wardley.anchors, + defaultValue: [] + }, + annotation: { + name: Wardley.annotation, + defaultValue: [] + }, + annotations: { + name: Wardley.annotations, + defaultValue: [] + }, + components: { + name: Wardley.components, + defaultValue: [] + }, + deaccelerators: { + name: Wardley.deaccelerators, + defaultValue: [] + }, + evolution: { + name: Wardley.evolution + }, + evolves: { + name: Wardley.evolves, + defaultValue: [] + }, + links: { + name: Wardley.links, + defaultValue: [] + }, + notes: { + name: Wardley.notes, + defaultValue: [] + }, + pipelines: { + name: Wardley.pipelines, + defaultValue: [] + }, + size: { + name: Wardley.size + }, + title: { + name: Wardley.title + } + }, + superTypes: [] + } + }; + } + static { + __name2(this, "MermaidAstReflection"); + } + }; + reflection2 = new MermaidAstReflection(); + ArchitectureGrammarGrammar = /* @__PURE__ */ __name2(() => loadedArchitectureGrammarGrammar ?? (loadedArchitectureGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"ArchitectureGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[(?:\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'|[\\\\w ]+)\\\\]/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)), "ArchitectureGrammarGrammar"); + EventModelingGrammar = /* @__PURE__ */ __name2(() => loadedEventModelingGrammar ?? (loadedEventModelingGrammar = loadGrammarFromJson('{"$type":"Grammar","isDeclared":true,"name":"EventModeling","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","entry":true,"name":"EventModel","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"eventmodeling"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"frames","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"dataEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"noteEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"gwtEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmModelEntityType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rmo"},{"$type":"Keyword","value":"readmodel"},{"$type":"Keyword","value":"ui"},{"$type":"Keyword","value":"cmd"},{"$type":"Keyword","value":"command"},{"$type":"Keyword","value":"evt"},{"$type":"Keyword","value":"event"},{"$type":"Keyword","value":"pcr"},{"$type":"Keyword","value":"processor"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmDataType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"json"},{"$type":"Keyword","value":"jsobj"},{"$type":"Keyword","value":"figma"},{"$type":"Keyword","value":"salt"},{"$type":"Keyword","value":"uri"},{"$type":"Keyword","value":"md"},{"$type":"Keyword","value":"html"},{"$type":"Keyword","value":"text"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"EmDataInline","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"`"},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":"`"}],"cardinality":"?"},{"$type":"Assignment","feature":"dataInlineValue","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"EmDataBlock","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"`"},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":"`"}],"cardinality":"?"},{"$type":"Assignment","feature":"dataBlockValue","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"QualifiedName","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"."},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmTimeFrame","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"tf"},{"$type":"Keyword","value":"timeframe"}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntityType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"->>"},{"$type":"Assignment","feature":"sourceFrames","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"[["},{"$type":"Assignment","feature":"dataReference","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@10"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"]]"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmResetFrame","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rf"},{"$type":"Keyword","value":"resetframe"}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntityType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"->>"},{"$type":"Assignment","feature":"sourceFrames","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"[["},{"$type":"Assignment","feature":"dataReference","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@10"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"]]"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmFrame","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmModelEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"entity"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmDataEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"data"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmNoteEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"note"},{"$type":"Assignment","feature":"sourceFrame","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmGwt","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"gwt"},{"$type":"Assignment","feature":"sourceFrame","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"given"},{"$type":"Assignment","feature":"givenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"},{"$type":"Group","elements":[{"$type":"Keyword","value":"when"},{"$type":"Assignment","feature":"whenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"}],"cardinality":"?"},{"$type":"Keyword","value":"then"},{"$type":"Assignment","feature":"thenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmGwtStatement","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@9"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EM_EID","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EM_FI","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"EM_ID","definition":{"$type":"RegexToken","regex":"/[_a-zA-Z][\\\\w_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_FID","definition":{"$type":"RegexToken","regex":"/\\\\d{1,3}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_DATA_INLINE","definition":{"$type":"RegexToken","regex":"/\\\\{(.*)\\\\}|\\"(.*)\\"|\'(.*)\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_DATA_BLOCK","definition":{"$type":"RegexToken","regex":"/\\\\{[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?\\\\}(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"EM_WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_SL_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"imports":[],"types":[]}')), "EventModelingGrammar"); + GitGraphGrammarGrammar = /* @__PURE__ */ __name2(() => loadedGitGraphGrammarGrammar ?? (loadedGitGraphGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"GitGraphGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)), "GitGraphGrammarGrammar"); + InfoGrammarGrammar = /* @__PURE__ */ __name2(() => loadedInfoGrammarGrammar ?? (loadedInfoGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"InfoGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)), "InfoGrammarGrammar"); + PacketGrammarGrammar = /* @__PURE__ */ __name2(() => loadedPacketGrammarGrammar ?? (loadedPacketGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"PacketGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)), "PacketGrammarGrammar"); + PieGrammarGrammar = /* @__PURE__ */ __name2(() => loadedPieGrammarGrammar ?? (loadedPieGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"PieGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)), "PieGrammarGrammar"); + RadarGrammarGrammar = /* @__PURE__ */ __name2(() => loadedRadarGrammarGrammar ?? (loadedRadarGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"RadarGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}},"isMulti":false}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"types":[]}`)), "RadarGrammarGrammar"); + TreemapGrammarGrammar = /* @__PURE__ */ __name2(() => loadedTreemapGrammarGrammar ?? (loadedTreemapGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"TreemapGrammar","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}`)), "TreemapGrammarGrammar"); + TreeViewGrammarGrammar = /* @__PURE__ */ __name2(() => loadedTreeViewGrammarGrammar ?? (loadedTreeViewGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"TreeViewGrammar","rules":[{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"TreeView","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"treeView-beta"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"nodes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreeNode","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"TreeView","attributes":[{"$type":"TypeAttribute","name":"nodes","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@9"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * TreeView grammar for Langium\\n * Converted from treemap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treeView declaration.\\n */"}`)), "TreeViewGrammarGrammar"); + WardleyGrammarGrammar = /* @__PURE__ */ __name2(() => loadedWardleyGrammarGrammar ?? (loadedWardleyGrammarGrammar = loadGrammarFromJson(`{"$type":"Grammar","isDeclared":true,"name":"WardleyGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Wardley","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"size","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"anchors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"links","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"evolves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"pipelines","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"notes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"annotations","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"annotation","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"deaccelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Size","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"width","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"height","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolution","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EvolutionStage","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"@"},{"$type":"Assignment","feature":"boundary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"secondName","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Anchor","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Component","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"decorator","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Keyword","value":")"}]}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Label","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"negX","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetX","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"negY","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetY","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Decorator","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"strategy","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Link","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"fromPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"arrow","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"cardinality":"?"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"toPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"linkLabel","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolve","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]},{"$type":"Assignment","feature":"component","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Pipeline","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PipelineComponent","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Note","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotations","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotation","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"Assignment","feature":"number","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CoordinateValue","dataType":"number","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Accelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Deaccelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"WARDLEY_NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"->"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_PORT","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<>"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+>"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_ARROW","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-->"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-.->"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":">"},"parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'<>/","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'/","parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_LABEL","definition":{"$type":"RegexToken","regex":"/;[^\\\\n\\\\r]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRATEGY","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"build"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"buy"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"outsource"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"market"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_WARDLEY","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"wardley-beta"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_SIZE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"size"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLUTION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolution"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANCHOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"anchor"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_COMPONENT","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"component"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_LABEL","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"label"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_INERTIA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"inertia"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLVE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolve"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_PIPELINE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"pipeline"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_NOTE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"note"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATIONS","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotations"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotation"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"accelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_DEACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"deaccelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NAME_WITH_SPACES","definition":{"$type":"RegexToken","regex":"/(?!title\\\\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \\\\t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@47"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@48"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)), "WardleyGrammarGrammar"); + ArchitectureGrammarLanguageMetaData = { + languageId: "architecture", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + EventModelingLanguageMetaData = { + languageId: "eventmodeling", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + GitGraphGrammarLanguageMetaData = { + languageId: "gitGraph", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + InfoGrammarLanguageMetaData = { + languageId: "info", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + PacketGrammarLanguageMetaData = { + languageId: "packet", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + PieGrammarLanguageMetaData = { + languageId: "pie", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + RadarGrammarLanguageMetaData = { + languageId: "radar", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + TreemapGrammarLanguageMetaData = { + languageId: "treemap", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + TreeViewGrammarLanguageMetaData = { + languageId: "treeView", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + WardleyGrammarLanguageMetaData = { + languageId: "wardley", + fileExtensions: [".mmd", ".mermaid"], + caseInsensitive: false, + mode: "production" + }; + MermaidGeneratedSharedModule = { + AstReflection: /* @__PURE__ */ __name2(() => new MermaidAstReflection(), "AstReflection") + }; + ArchitectureGrammarGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => ArchitectureGrammarGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => ArchitectureGrammarLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + EventModelingGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => EventModelingGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => EventModelingLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + GitGraphGrammarGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => GitGraphGrammarGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => GitGraphGrammarLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + InfoGrammarGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => InfoGrammarGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => InfoGrammarLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + PacketGrammarGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => PacketGrammarGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => PacketGrammarLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + PieGrammarGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => PieGrammarGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => PieGrammarLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + RadarGrammarGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => RadarGrammarGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => RadarGrammarLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + TreemapGrammarGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => TreemapGrammarGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => TreemapGrammarLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + TreeViewGrammarGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => TreeViewGrammarGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => TreeViewGrammarLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + WardleyGrammarGeneratedModule = { + Grammar: /* @__PURE__ */ __name2(() => WardleyGrammarGrammar(), "Grammar"), + LanguageMetaData: /* @__PURE__ */ __name2(() => WardleyGrammarLanguageMetaData, "LanguageMetaData"), + parser: {} + }; + accessibilityDescrRegex = /accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/; + accessibilityTitleRegex = /accTitle[\t ]*:([^\n\r]*)/; + titleRegex = /title([\t ][^\n\r]*|)/; + rulesRegexes = { + ACC_DESCR: accessibilityDescrRegex, + ACC_TITLE: accessibilityTitleRegex, + TITLE: titleRegex + }; + AbstractMermaidValueConverter = class extends DefaultValueConverter { + static { + __name(this, "AbstractMermaidValueConverter"); + } + static { + __name2(this, "AbstractMermaidValueConverter"); + } + runConverter(rule, input, cstNode) { + let value2 = this.runCommonConverter(rule, input, cstNode); + if (value2 === void 0) { + value2 = this.runCustomConverter(rule, input, cstNode); + } + if (value2 === void 0) { + return super.runConverter(rule, input, cstNode); + } + return value2; + } + runCommonConverter(rule, input, _cstNode) { + const regex2 = rulesRegexes[rule.name]; + if (regex2 === void 0) { + return void 0; + } + const match3 = regex2.exec(input); + if (match3 === null) { + return void 0; + } + if (match3[1] !== void 0) { + return match3[1].trim().replace(/[\t ]{2,}/gm, " "); + } + if (match3[2] !== void 0) { + return match3[2].replace(/^\s*/gm, "").replace(/\s+$/gm, "").replace(/[\t ]{2,}/gm, " ").replace(/[\n\r]{2,}/gm, "\n"); + } + return void 0; + } + }; + CommonValueConverter = class extends AbstractMermaidValueConverter { + static { + __name(this, "CommonValueConverter"); + } + static { + __name2(this, "CommonValueConverter"); + } + runCustomConverter(_rule, _input, _cstNode) { + return void 0; + } + }; + AbstractMermaidTokenBuilder = class extends DefaultTokenBuilder { + static { + __name(this, "AbstractMermaidTokenBuilder"); + } + static { + __name2(this, "AbstractMermaidTokenBuilder"); + } + constructor(keywords) { + super(); + this.keywords = new Set(keywords); + } + buildKeywordTokens(rules, terminalTokens, options2) { + const tokenTypes = super.buildKeywordTokens(rules, terminalTokens, options2); + tokenTypes.forEach((tokenType) => { + if (this.keywords.has(tokenType.name) && tokenType.PATTERN !== void 0) { + tokenType.PATTERN = new RegExp(tokenType.PATTERN.toString() + "(?:(?=%%)|(?!\\S))"); + } + }); + return tokenTypes; + } + }; + CommonTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "CommonTokenBuilder"); + } + static { + __name2(this, "CommonTokenBuilder"); + } + }; + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-FHYWG6QK.mjs + function createRadarServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const Radar2 = inject( + createDefaultCoreModule({ shared }), + RadarGrammarGeneratedModule, + RadarModule + ); + shared.ServiceRegistry.register(Radar2); + return { shared, Radar: Radar2 }; + } + var RadarTokenBuilder, RadarModule; + var init_chunk_FHYWG6QK = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-FHYWG6QK.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + RadarTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "RadarTokenBuilder"); + } + static { + __name2(this, "RadarTokenBuilder"); + } + constructor() { + super(["radar-beta"]); + } + }; + RadarModule = { + parser: { + TokenBuilder: /* @__PURE__ */ __name2(() => new RadarTokenBuilder(), "TokenBuilder"), + ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter") + } + }; + __name(createRadarServices, "createRadarServices"); + __name2(createRadarServices, "createRadarServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-BR22UD5L.mjs + function registerValidationChecks(services) { + const validator = services.validation.TreemapValidator; + const registry = services.validation.ValidationRegistry; + if (registry) { + const checks = { + Treemap: validator.checkSingleRoot.bind(validator) + // Remove unused validation for TreemapRow + }; + registry.register(checks, validator); + } + } + function createTreemapServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const Treemap2 = inject( + createDefaultCoreModule({ shared }), + TreemapGrammarGeneratedModule, + TreemapModule + ); + shared.ServiceRegistry.register(Treemap2); + registerValidationChecks(Treemap2); + return { shared, Treemap: Treemap2 }; + } + var TreemapTokenBuilder, classDefRegex, TreemapValueConverter, TreemapValidator, TreemapModule; + var init_chunk_BR22UD5L = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-BR22UD5L.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + TreemapTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "TreemapTokenBuilder"); + } + static { + __name2(this, "TreemapTokenBuilder"); + } + constructor() { + super(["treemap"]); + } + }; + classDefRegex = /classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/; + TreemapValueConverter = class extends AbstractMermaidValueConverter { + static { + __name(this, "TreemapValueConverter"); + } + static { + __name2(this, "TreemapValueConverter"); + } + runCustomConverter(rule, input, _cstNode) { + if (rule.name === "NUMBER2") { + return parseFloat(input.replace(/,/g, "")); + } else if (rule.name === "SEPARATOR") { + return input.substring(1, input.length - 1); + } else if (rule.name === "STRING2") { + return input.substring(1, input.length - 1); + } else if (rule.name === "INDENTATION") { + return input.length; + } else if (rule.name === "ClassDef") { + if (typeof input !== "string") { + return input; + } + const match3 = classDefRegex.exec(input); + if (match3) { + return { + $type: "ClassDefStatement", + className: match3[1], + styleText: match3[2] || void 0 + }; + } + } + return void 0; + } + }; + __name(registerValidationChecks, "registerValidationChecks"); + __name2(registerValidationChecks, "registerValidationChecks"); + TreemapValidator = class { + static { + __name(this, "TreemapValidator"); + } + static { + __name2(this, "TreemapValidator"); + } + /** + * Validates that a treemap has only one root node. + * A root node is defined as a node that has no indentation. + */ + checkSingleRoot(doc, accept) { + let rootNodeIndentation; + for (const row of doc.TreemapRows) { + if (!row.item) { + continue; + } + if (rootNodeIndentation === void 0 && // Check if this is a root node (no indentation) + row.indent === void 0) { + rootNodeIndentation = 0; + } else if (row.indent === void 0) { + accept("error", "Multiple root nodes are not allowed in a treemap.", { + node: row, + property: "item" + }); + } else if (rootNodeIndentation !== void 0 && rootNodeIndentation >= parseInt(row.indent, 10)) { + accept("error", "Multiple root nodes are not allowed in a treemap.", { + node: row, + property: "item" + }); + } + } + } + }; + TreemapModule = { + parser: { + TokenBuilder: /* @__PURE__ */ __name2(() => new TreemapTokenBuilder(), "TokenBuilder"), + ValueConverter: /* @__PURE__ */ __name2(() => new TreemapValueConverter(), "ValueConverter") + }, + validation: { + TreemapValidator: /* @__PURE__ */ __name2(() => new TreemapValidator(), "TreemapValidator") + } + }; + __name(createTreemapServices, "createTreemapServices"); + __name2(createTreemapServices, "createTreemapServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-PUPMXCY4.mjs + function createWardleyServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const Wardley2 = inject( + createDefaultCoreModule({ shared }), + WardleyGrammarGeneratedModule, + WardleyModule + ); + shared.ServiceRegistry.register(Wardley2); + return { shared, Wardley: Wardley2 }; + } + var WardleyValueConverter, WardleyModule; + var init_chunk_PUPMXCY4 = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-PUPMXCY4.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + WardleyValueConverter = class extends AbstractMermaidValueConverter { + static { + __name(this, "WardleyValueConverter"); + } + static { + __name2(this, "WardleyValueConverter"); + } + runCustomConverter(rule, input, _cstNode) { + switch (rule.name.toUpperCase()) { + case "LINK_LABEL": + return input.substring(1).trim(); + default: + return void 0; + } + } + }; + WardleyModule = { + parser: { + ValueConverter: /* @__PURE__ */ __name2(() => new WardleyValueConverter(), "ValueConverter") + } + }; + __name(createWardleyServices, "createWardleyServices"); + __name2(createWardleyServices, "createWardleyServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-UIBZB4QT.mjs + function createGitGraphServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const GitGraph2 = inject( + createDefaultCoreModule({ shared }), + GitGraphGrammarGeneratedModule, + GitGraphModule + ); + shared.ServiceRegistry.register(GitGraph2); + return { shared, GitGraph: GitGraph2 }; + } + var GitGraphTokenBuilder, GitGraphModule; + var init_chunk_UIBZB4QT = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-UIBZB4QT.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + GitGraphTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "GitGraphTokenBuilder"); + } + static { + __name2(this, "GitGraphTokenBuilder"); + } + constructor() { + super(["gitGraph"]); + } + }; + GitGraphModule = { + parser: { + TokenBuilder: /* @__PURE__ */ __name2(() => new GitGraphTokenBuilder(), "TokenBuilder"), + ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter") + } + }; + __name(createGitGraphServices, "createGitGraphServices"); + __name2(createGitGraphServices, "createGitGraphServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-5DO6E6H7.mjs + function createInfoServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const Info2 = inject( + createDefaultCoreModule({ shared }), + InfoGrammarGeneratedModule, + InfoModule + ); + shared.ServiceRegistry.register(Info2); + return { shared, Info: Info2 }; + } + var InfoTokenBuilder, InfoModule; + var init_chunk_5DO6E6H7 = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-5DO6E6H7.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + InfoTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "InfoTokenBuilder"); + } + static { + __name2(this, "InfoTokenBuilder"); + } + constructor() { + super(["info", "showInfo"]); + } + }; + InfoModule = { + parser: { + TokenBuilder: /* @__PURE__ */ __name2(() => new InfoTokenBuilder(), "TokenBuilder"), + ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter") + } + }; + __name(createInfoServices, "createInfoServices"); + __name2(createInfoServices, "createInfoServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-MPE355IW.mjs + function createPacketServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const Packet2 = inject( + createDefaultCoreModule({ shared }), + PacketGrammarGeneratedModule, + PacketModule + ); + shared.ServiceRegistry.register(Packet2); + return { shared, Packet: Packet2 }; + } + var PacketTokenBuilder, PacketModule; + var init_chunk_MPE355IW = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-MPE355IW.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + PacketTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "PacketTokenBuilder"); + } + static { + __name2(this, "PacketTokenBuilder"); + } + constructor() { + super(["packet"]); + } + }; + PacketModule = { + parser: { + TokenBuilder: /* @__PURE__ */ __name2(() => new PacketTokenBuilder(), "TokenBuilder"), + ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter") + } + }; + __name(createPacketServices, "createPacketServices"); + __name2(createPacketServices, "createPacketServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-MZUSXYTE.mjs + function createPieServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const Pie2 = inject( + createDefaultCoreModule({ shared }), + PieGrammarGeneratedModule, + PieModule + ); + shared.ServiceRegistry.register(Pie2); + return { shared, Pie: Pie2 }; + } + var PieTokenBuilder, PieValueConverter, PieModule; + var init_chunk_MZUSXYTE = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-MZUSXYTE.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + PieTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "PieTokenBuilder"); + } + static { + __name2(this, "PieTokenBuilder"); + } + constructor() { + super(["pie", "showData"]); + } + }; + PieValueConverter = class extends AbstractMermaidValueConverter { + static { + __name(this, "PieValueConverter"); + } + static { + __name2(this, "PieValueConverter"); + } + runCustomConverter(rule, input, _cstNode) { + if (rule.name !== "PIE_SECTION_LABEL") { + return void 0; + } + return input.replace(/"/g, "").trim(); + } + }; + PieModule = { + parser: { + TokenBuilder: /* @__PURE__ */ __name2(() => new PieTokenBuilder(), "TokenBuilder"), + ValueConverter: /* @__PURE__ */ __name2(() => new PieValueConverter(), "ValueConverter") + } + }; + __name(createPieServices, "createPieServices"); + __name2(createPieServices, "createPieServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-WCWK7LTN.mjs + function createTreeViewServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const TreeView2 = inject( + createDefaultCoreModule({ shared }), + TreeViewGrammarGeneratedModule, + TreeViewModule + ); + shared.ServiceRegistry.register(TreeView2); + return { shared, TreeView: TreeView2 }; + } + var TreeViewValueConverter, TreeViewTokenBuilder, TreeViewModule; + var init_chunk_WCWK7LTN = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-WCWK7LTN.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + TreeViewValueConverter = class extends AbstractMermaidValueConverter { + static { + __name(this, "TreeViewValueConverter"); + } + static { + __name2(this, "TreeViewValueConverter"); + } + runCustomConverter(rule, input, _cstNode) { + if (rule.name === "INDENTATION") { + return input?.length || 0; + } else if (rule.name === "STRING2") { + return input.substring(1, input.length - 1); + } + return void 0; + } + }; + TreeViewTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "TreeViewTokenBuilder"); + } + static { + __name2(this, "TreeViewTokenBuilder"); + } + constructor() { + super(["treeView-beta"]); + } + }; + TreeViewModule = { + parser: { + TokenBuilder: /* @__PURE__ */ __name2(() => new TreeViewTokenBuilder(), "TokenBuilder"), + ValueConverter: /* @__PURE__ */ __name2(() => new TreeViewValueConverter(), "ValueConverter") + } + }; + __name(createTreeViewServices, "createTreeViewServices"); + __name2(createTreeViewServices, "createTreeViewServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-4EGX6M5U.mjs + function createArchitectureServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const Architecture2 = inject( + createDefaultCoreModule({ shared }), + ArchitectureGrammarGeneratedModule, + ArchitectureModule + ); + shared.ServiceRegistry.register(Architecture2); + return { shared, Architecture: Architecture2 }; + } + var ArchitectureTokenBuilder, ArchitectureValueConverter, ArchitectureModule; + var init_chunk_4EGX6M5U = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-4EGX6M5U.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + ArchitectureTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "ArchitectureTokenBuilder"); + } + static { + __name2(this, "ArchitectureTokenBuilder"); + } + constructor() { + super(["architecture"]); + } + }; + ArchitectureValueConverter = class extends AbstractMermaidValueConverter { + static { + __name(this, "ArchitectureValueConverter"); + } + static { + __name2(this, "ArchitectureValueConverter"); + } + runCustomConverter(rule, input, _cstNode) { + if (rule.name === "ARCH_ICON") { + return input.replace(/[()]/g, "").trim(); + } else if (rule.name === "ARCH_TEXT_ICON") { + return input.replace(/["()]/g, ""); + } else if (rule.name === "ARCH_TITLE") { + let result = input.replace(/^\[|]$/g, "").trim(); + if (result.startsWith('"') && result.endsWith('"') || result.startsWith("'") && result.endsWith("'")) { + result = result.slice(1, -1); + result = result.replace(/\\"/g, '"').replace(/\\'/g, "'"); + } + return result.trim(); + } + return void 0; + } + }; + ArchitectureModule = { + parser: { + TokenBuilder: /* @__PURE__ */ __name2(() => new ArchitectureTokenBuilder(), "TokenBuilder"), + ValueConverter: /* @__PURE__ */ __name2(() => new ArchitectureValueConverter(), "ValueConverter") + } + }; + __name(createArchitectureServices, "createArchitectureServices"); + __name2(createArchitectureServices, "createArchitectureServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/chunk-N66VUXT2.mjs + function registerValidationChecks2(services) { + const validator = services.validation.EventModelingValidator; + const registry = services.validation.ValidationRegistry; + if (registry) { + const checks = { + EmTimeFrame: validator.checkSourceFrameTypes.bind(validator), + EmResetFrame: validator.checkSourceFrameTypes.bind(validator) + }; + registry.register(checks, validator); + } + } + function createEventModelingServices(context = EmptyFileSystem) { + const shared = inject( + createDefaultSharedCoreModule(context), + MermaidGeneratedSharedModule + ); + const EventModel2 = inject( + createDefaultCoreModule({ shared }), + EventModelingGeneratedModule, + EventModelingModule + ); + shared.ServiceRegistry.register(EventModel2); + registerValidationChecks2(EventModel2); + return { shared, EventModel: EventModel2 }; + } + var EventModelingTokenBuilder, COMMAND_TYPES, EVENT_TYPES, READMODEL_TYPES, PROCESSOR_TYPES, UI_TYPES, EventModelingValidator, EventModelingModule; + var init_chunk_N66VUXT2 = __esm({ + "../parser/dist/chunks/mermaid-parser.core/chunk-N66VUXT2.mjs"() { + "use strict"; + init_chunk_NNHCCRGN(); + EventModelingTokenBuilder = class extends AbstractMermaidTokenBuilder { + static { + __name(this, "EventModelingTokenBuilder"); + } + static { + __name2(this, "EventModelingTokenBuilder"); + } + constructor() { + super(["eventmodeling"]); + } + }; + COMMAND_TYPES = /* @__PURE__ */ new Set(["cmd", "command"]); + EVENT_TYPES = /* @__PURE__ */ new Set(["evt", "event"]); + READMODEL_TYPES = /* @__PURE__ */ new Set(["rmo", "readmodel"]); + PROCESSOR_TYPES = /* @__PURE__ */ new Set(["pcr", "processor"]); + UI_TYPES = /* @__PURE__ */ new Set(["ui"]); + __name(registerValidationChecks2, "registerValidationChecks"); + __name2(registerValidationChecks2, "registerValidationChecks"); + EventModelingValidator = class { + static { + __name(this, "EventModelingValidator"); + } + static { + __name2(this, "EventModelingValidator"); + } + checkSourceFrameTypes(frame2, accept) { + if (frame2.sourceFrames.length === 0) { + return; + } + if (COMMAND_TYPES.has(frame2.modelEntityType)) { + this.validateSources( + frame2, + /* @__PURE__ */ new Set([...UI_TYPES, ...PROCESSOR_TYPES]), + "command", + "ui or processor", + accept + ); + } else if (EVENT_TYPES.has(frame2.modelEntityType)) { + this.validateSources(frame2, COMMAND_TYPES, "event", "command", accept); + } else if (READMODEL_TYPES.has(frame2.modelEntityType)) { + this.validateSources(frame2, EVENT_TYPES, "read model", "event", accept); + } else if (PROCESSOR_TYPES.has(frame2.modelEntityType)) { + this.validateSources(frame2, READMODEL_TYPES, "processor", "read model", accept); + } else if (UI_TYPES.has(frame2.modelEntityType)) { + this.validateSources(frame2, READMODEL_TYPES, "ui", "read model", accept); + } + } + validateSources(frame2, allowedSourceTypes, targetLabel, expectedSourceLabel, accept) { + for (const sourceRef of frame2.sourceFrames) { + const source = sourceRef.ref; + if (source !== void 0 && !allowedSourceTypes.has(source.modelEntityType)) { + accept( + "error", + `A ${targetLabel} can only receive input from a ${expectedSourceLabel}, not from '${source.modelEntityType}'.`, + { node: frame2, property: "sourceFrames" } + ); + } + } + } + }; + EventModelingModule = { + parser: { + TokenBuilder: /* @__PURE__ */ __name2(() => new EventModelingTokenBuilder(), "TokenBuilder"), + ValueConverter: /* @__PURE__ */ __name2(() => new CommonValueConverter(), "ValueConverter") + }, + validation: { + EventModelingValidator: /* @__PURE__ */ __name2(() => new EventModelingValidator(), "EventModelingValidator") + } + }; + __name(createEventModelingServices, "createEventModelingServices"); + __name2(createEventModelingServices, "createEventModelingServices"); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/info-J43DQDTF.mjs + var info_J43DQDTF_exports = {}; + __export(info_J43DQDTF_exports, { + InfoModule: () => InfoModule, + createInfoServices: () => createInfoServices + }); + var init_info_J43DQDTF = __esm({ + "../parser/dist/chunks/mermaid-parser.core/info-J43DQDTF.mjs"() { + "use strict"; + init_chunk_5DO6E6H7(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/packet-YPE3B663.mjs + var packet_YPE3B663_exports = {}; + __export(packet_YPE3B663_exports, { + PacketModule: () => PacketModule, + createPacketServices: () => createPacketServices + }); + var init_packet_YPE3B663 = __esm({ + "../parser/dist/chunks/mermaid-parser.core/packet-YPE3B663.mjs"() { + "use strict"; + init_chunk_MPE355IW(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/pie-LRSECV5Y.mjs + var pie_LRSECV5Y_exports = {}; + __export(pie_LRSECV5Y_exports, { + PieModule: () => PieModule, + createPieServices: () => createPieServices + }); + var init_pie_LRSECV5Y = __esm({ + "../parser/dist/chunks/mermaid-parser.core/pie-LRSECV5Y.mjs"() { + "use strict"; + init_chunk_MZUSXYTE(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/treeView-BLDUP644.mjs + var treeView_BLDUP644_exports = {}; + __export(treeView_BLDUP644_exports, { + TreeViewModule: () => TreeViewModule, + createTreeViewServices: () => createTreeViewServices + }); + var init_treeView_BLDUP644 = __esm({ + "../parser/dist/chunks/mermaid-parser.core/treeView-BLDUP644.mjs"() { + "use strict"; + init_chunk_WCWK7LTN(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/architecture-7EHR7CIX.mjs + var architecture_7EHR7CIX_exports = {}; + __export(architecture_7EHR7CIX_exports, { + ArchitectureModule: () => ArchitectureModule, + createArchitectureServices: () => createArchitectureServices + }); + var init_architecture_7EHR7CIX = __esm({ + "../parser/dist/chunks/mermaid-parser.core/architecture-7EHR7CIX.mjs"() { + "use strict"; + init_chunk_4EGX6M5U(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/gitGraph-WXDBUCRP.mjs + var gitGraph_WXDBUCRP_exports = {}; + __export(gitGraph_WXDBUCRP_exports, { + GitGraphModule: () => GitGraphModule, + createGitGraphServices: () => createGitGraphServices + }); + var init_gitGraph_WXDBUCRP = __esm({ + "../parser/dist/chunks/mermaid-parser.core/gitGraph-WXDBUCRP.mjs"() { + "use strict"; + init_chunk_UIBZB4QT(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/eventmodeling-FCH6USID.mjs + var eventmodeling_FCH6USID_exports = {}; + __export(eventmodeling_FCH6USID_exports, { + EventModelingModule: () => EventModelingModule, + createEventModelingServices: () => createEventModelingServices + }); + var init_eventmodeling_FCH6USID = __esm({ + "../parser/dist/chunks/mermaid-parser.core/eventmodeling-FCH6USID.mjs"() { + "use strict"; + init_chunk_N66VUXT2(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/radar-GUYGQ44K.mjs + var radar_GUYGQ44K_exports = {}; + __export(radar_GUYGQ44K_exports, { + RadarModule: () => RadarModule, + createRadarServices: () => createRadarServices + }); + var init_radar_GUYGQ44K = __esm({ + "../parser/dist/chunks/mermaid-parser.core/radar-GUYGQ44K.mjs"() { + "use strict"; + init_chunk_FHYWG6QK(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/treemap-LRROVOQU.mjs + var treemap_LRROVOQU_exports = {}; + __export(treemap_LRROVOQU_exports, { + TreemapModule: () => TreemapModule, + createTreemapServices: () => createTreemapServices + }); + var init_treemap_LRROVOQU = __esm({ + "../parser/dist/chunks/mermaid-parser.core/treemap-LRROVOQU.mjs"() { + "use strict"; + init_chunk_BR22UD5L(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/chunks/mermaid-parser.core/wardley-L42UT6IY.mjs + var wardley_L42UT6IY_exports = {}; + __export(wardley_L42UT6IY_exports, { + WardleyModule: () => WardleyModule, + createWardleyServices: () => createWardleyServices + }); + var init_wardley_L42UT6IY = __esm({ + "../parser/dist/chunks/mermaid-parser.core/wardley-L42UT6IY.mjs"() { + "use strict"; + init_chunk_PUPMXCY4(); + init_chunk_NNHCCRGN(); + } + }); + + // ../parser/dist/mermaid-parser.core.mjs + async function parse3(diagramType, text4) { + const initializer = initializers[diagramType]; + if (!initializer) { + throw new Error(`Unknown diagram type: ${diagramType}`); + } + if (!parsers[diagramType]) { + await initializer(); + } + const parser29 = parsers[diagramType]; + const result = parser29.parse(text4); + if (result.lexerErrors.length > 0 || result.parserErrors.length > 0) { + throw new MermaidParseError(result); + } + return result.value; + } + var parsers, initializers, MermaidParseError; + var init_mermaid_parser_core = __esm({ + "../parser/dist/mermaid-parser.core.mjs"() { + "use strict"; + init_chunk_FHYWG6QK(); + init_chunk_BR22UD5L(); + init_chunk_PUPMXCY4(); + init_chunk_UIBZB4QT(); + init_chunk_5DO6E6H7(); + init_chunk_MPE355IW(); + init_chunk_MZUSXYTE(); + init_chunk_WCWK7LTN(); + init_chunk_4EGX6M5U(); + init_chunk_N66VUXT2(); + init_chunk_NNHCCRGN(); + parsers = {}; + initializers = { + info: /* @__PURE__ */ __name2(async () => { + const { createInfoServices: createInfoServices2 } = await Promise.resolve().then(() => (init_info_J43DQDTF(), info_J43DQDTF_exports)); + const parser29 = createInfoServices2().Info.parser.LangiumParser; + parsers.info = parser29; + }, "info"), + packet: /* @__PURE__ */ __name2(async () => { + const { createPacketServices: createPacketServices2 } = await Promise.resolve().then(() => (init_packet_YPE3B663(), packet_YPE3B663_exports)); + const parser29 = createPacketServices2().Packet.parser.LangiumParser; + parsers.packet = parser29; + }, "packet"), + pie: /* @__PURE__ */ __name2(async () => { + const { createPieServices: createPieServices2 } = await Promise.resolve().then(() => (init_pie_LRSECV5Y(), pie_LRSECV5Y_exports)); + const parser29 = createPieServices2().Pie.parser.LangiumParser; + parsers.pie = parser29; + }, "pie"), + treeView: /* @__PURE__ */ __name2(async () => { + const { createTreeViewServices: createTreeViewServices2 } = await Promise.resolve().then(() => (init_treeView_BLDUP644(), treeView_BLDUP644_exports)); + const parser29 = createTreeViewServices2().TreeView.parser.LangiumParser; + parsers.treeView = parser29; + }, "treeView"), + architecture: /* @__PURE__ */ __name2(async () => { + const { createArchitectureServices: createArchitectureServices2 } = await Promise.resolve().then(() => (init_architecture_7EHR7CIX(), architecture_7EHR7CIX_exports)); + const parser29 = createArchitectureServices2().Architecture.parser.LangiumParser; + parsers.architecture = parser29; + }, "architecture"), + gitGraph: /* @__PURE__ */ __name2(async () => { + const { createGitGraphServices: createGitGraphServices2 } = await Promise.resolve().then(() => (init_gitGraph_WXDBUCRP(), gitGraph_WXDBUCRP_exports)); + const parser29 = createGitGraphServices2().GitGraph.parser.LangiumParser; + parsers.gitGraph = parser29; + }, "gitGraph"), + eventmodeling: /* @__PURE__ */ __name2(async () => { + const { createEventModelingServices: createEventModelingServices2 } = await Promise.resolve().then(() => (init_eventmodeling_FCH6USID(), eventmodeling_FCH6USID_exports)); + const parser29 = createEventModelingServices2().EventModel.parser.LangiumParser; + parsers.eventmodeling = parser29; + }, "eventmodeling"), + radar: /* @__PURE__ */ __name2(async () => { + const { createRadarServices: createRadarServices2 } = await Promise.resolve().then(() => (init_radar_GUYGQ44K(), radar_GUYGQ44K_exports)); + const parser29 = createRadarServices2().Radar.parser.LangiumParser; + parsers.radar = parser29; + }, "radar"), + treemap: /* @__PURE__ */ __name2(async () => { + const { createTreemapServices: createTreemapServices2 } = await Promise.resolve().then(() => (init_treemap_LRROVOQU(), treemap_LRROVOQU_exports)); + const parser29 = createTreemapServices2().Treemap.parser.LangiumParser; + parsers.treemap = parser29; + }, "treemap"), + wardley: /* @__PURE__ */ __name2(async () => { + const { createWardleyServices: createWardleyServices2 } = await Promise.resolve().then(() => (init_wardley_L42UT6IY(), wardley_L42UT6IY_exports)); + const parser29 = createWardleyServices2().Wardley.parser.LangiumParser; + parsers.wardley = parser29; + }, "wardley") + }; + __name(parse3, "parse"); + __name2(parse3, "parse"); + MermaidParseError = class extends Error { + static { + __name(this, "MermaidParseError"); + } + constructor(result) { + const lexerErrors = result.lexerErrors.map((err) => { + const line2 = err.line !== void 0 && !isNaN(err.line) ? err.line : "?"; + const column2 = err.column !== void 0 && !isNaN(err.column) ? err.column : "?"; + return `Lexer error on line ${line2}, column ${column2}: ${err.message}`; + }).join("\n"); + const parserErrors = result.parserErrors.map((err) => { + const line2 = err.token.startLine !== void 0 && !isNaN(err.token.startLine) ? err.token.startLine : "?"; + const column2 = err.token.startColumn !== void 0 && !isNaN(err.token.startColumn) ? err.token.startColumn : "?"; + return `Parse error on line ${line2}, column ${column2}: ${err.message}`; + }).join("\n"); + super(`Parsing failed: ${lexerErrors} ${parserErrors}`); + this.result = result; + } + static { + __name2(this, "MermaidParseError"); + } + }; + } + }); + + // src/diagrams/common/populateCommonDb.ts + function populateCommonDb(ast, db10) { + if (ast.accDescr) { + db10.setAccDescription?.(ast.accDescr); + } + if (ast.accTitle) { + db10.setAccTitle?.(ast.accTitle); + } + if (ast.title) { + db10.setDiagramTitle?.(ast.title); + } + } + var init_populateCommonDb = __esm({ + "src/diagrams/common/populateCommonDb.ts"() { + "use strict"; + __name(populateCommonDb, "populateCommonDb"); + } + }); + + // src/diagrams/git/gitGraphTypes.ts + var commitType; + var init_gitGraphTypes = __esm({ + "src/diagrams/git/gitGraphTypes.ts"() { + "use strict"; + commitType = { + NORMAL: 0, + REVERSE: 1, + HIGHLIGHT: 2, + MERGE: 3, + CHERRY_PICK: 4 + }; + } + }); + + // src/utils/imperativeState.ts + var ImperativeState; + var init_imperativeState = __esm({ + "src/utils/imperativeState.ts"() { + "use strict"; + ImperativeState = class { + /** + * @param init - Function that creates the default state. + */ + constructor(init3) { + this.init = init3; + this.records = this.init(); + } + static { + __name(this, "ImperativeState"); + } + reset() { + this.records = this.init(); + } + }; + } + }); + + // src/diagrams/git/gitGraphAst.ts + function getID() { + return random({ length: 7 }); + } + function uniqBy2(list, fn3) { + const recordMap = /* @__PURE__ */ Object.create(null); + return list.reduce((out, item) => { + const key = fn3(item); + if (!recordMap[key]) { + recordMap[key] = true; + out.push(item); + } + return out; + }, []); + } + function upsert(arr, key, newVal) { + const index = arr.indexOf(key); + if (index === -1) { + arr.push(newVal); + } else { + arr.splice(index, 1, newVal); + } + } + function prettyPrintCommitHistory(commitArr) { + const commit2 = commitArr.reduce((out, commit3) => { + if (out.seq > commit3.seq) { + return out; + } + return commit3; + }, commitArr[0]); + let line2 = ""; + commitArr.forEach(function(c3) { + if (c3 === commit2) { + line2 += " *"; + } else { + line2 += " |"; + } + }); + const label = [line2, commit2.id, commit2.seq]; + for (const branch2 in state2.records.branches) { + if (state2.records.branches.get(branch2) === commit2.id) { + label.push(branch2); + } + } + log.debug(label.join(" ")); + if (commit2.parents && commit2.parents.length == 2 && commit2.parents[0] && commit2.parents[1]) { + const newCommit = state2.records.commits.get(commit2.parents[0]); + upsert(commitArr, commit2, newCommit); + if (commit2.parents[1]) { + commitArr.push(state2.records.commits.get(commit2.parents[1])); + } + } else if (commit2.parents.length == 0) { + return; + } else { + if (commit2.parents[0]) { + const newCommit = state2.records.commits.get(commit2.parents[0]); + upsert(commitArr, commit2, newCommit); + } + } + commitArr = uniqBy2(commitArr, (c3) => c3.id); + prettyPrintCommitHistory(commitArr); + } + var DEFAULT_GITGRAPH_CONFIG, getConfig3, state2, setDirection, setOptions6, getOptions, commit, branch, merge5, cherryPick, checkout, prettyPrint, clear7, getBranchesAsObjArray, getBranches, getCommits, getCommitsArray, getCurrentBranch, getDirection, getHead, db; + var init_gitGraphAst = __esm({ + "src/diagrams/git/gitGraphAst.ts"() { + "use strict"; + init_logger(); + init_utils2(); + init_config(); + init_common(); + init_commonDb(); + init_gitGraphTypes(); + init_imperativeState(); + init_defaultConfig(); + DEFAULT_GITGRAPH_CONFIG = defaultConfig_default.gitGraph; + getConfig3 = /* @__PURE__ */ __name(() => { + const config5 = cleanAndMerge({ + ...DEFAULT_GITGRAPH_CONFIG, + ...getConfig().gitGraph + }); + return config5; + }, "getConfig"); + state2 = new ImperativeState(() => { + const config5 = getConfig3(); + const mainBranchName = config5.mainBranchName; + const mainBranchOrder = config5.mainBranchOrder; + return { + mainBranchName, + commits: /* @__PURE__ */ new Map(), + head: null, + branchConfig: /* @__PURE__ */ new Map([[mainBranchName, { name: mainBranchName, order: mainBranchOrder }]]), + branches: /* @__PURE__ */ new Map([[mainBranchName, null]]), + currBranch: mainBranchName, + direction: "LR", + seq: 0, + options: {} + }; + }); + __name(getID, "getID"); + __name(uniqBy2, "uniqBy"); + setDirection = /* @__PURE__ */ __name(function(dir2) { + state2.records.direction = dir2; + }, "setDirection"); + setOptions6 = /* @__PURE__ */ __name(function(rawOptString) { + log.debug("options str", rawOptString); + rawOptString = rawOptString?.trim(); + rawOptString = rawOptString || "{}"; + try { + state2.records.options = JSON.parse(rawOptString); + } catch (e3) { + log.error("error while parsing gitGraph options", e3.message); + } + }, "setOptions"); + getOptions = /* @__PURE__ */ __name(function() { + return state2.records.options; + }, "getOptions"); + commit = /* @__PURE__ */ __name(function(commitDB) { + let msg = commitDB.msg; + let id35 = commitDB.id; + const type3 = commitDB.type; + let tags2 = commitDB.tags; + log.info("commit", msg, id35, type3, tags2); + log.debug("Entering commit:", msg, id35, type3, tags2); + const config5 = getConfig3(); + id35 = common_default.sanitizeText(id35, config5); + msg = common_default.sanitizeText(msg, config5); + tags2 = tags2?.map((tag) => common_default.sanitizeText(tag, config5)); + const newCommit = { + id: id35 ? id35 : state2.records.seq + "-" + getID(), + message: msg, + seq: state2.records.seq++, + type: type3 ?? commitType.NORMAL, + tags: tags2 ?? [], + parents: state2.records.head == null ? [] : [state2.records.head.id], + branch: state2.records.currBranch + }; + state2.records.head = newCommit; + log.info("main branch", config5.mainBranchName); + if (state2.records.commits.has(newCommit.id)) { + log.warn(`Commit ID ${newCommit.id} already exists`); + } + state2.records.commits.set(newCommit.id, newCommit); + state2.records.branches.set(state2.records.currBranch, newCommit.id); + log.debug("in pushCommit " + newCommit.id); + }, "commit"); + branch = /* @__PURE__ */ __name(function(branchDB) { + let name = branchDB.name; + const order2 = branchDB.order; + name = common_default.sanitizeText(name, getConfig3()); + if (state2.records.branches.has(name)) { + throw new Error( + `Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${name}")` + ); + } + state2.records.branches.set(name, state2.records.head != null ? state2.records.head.id : null); + state2.records.branchConfig.set(name, { name, order: order2 }); + checkout(name); + log.debug("in createBranch"); + }, "branch"); + merge5 = /* @__PURE__ */ __name((mergeDB) => { + let otherBranch = mergeDB.branch; + let customId = mergeDB.id; + const overrideType = mergeDB.type; + const customTags = mergeDB.tags; + const config5 = getConfig3(); + otherBranch = common_default.sanitizeText(otherBranch, config5); + if (customId) { + customId = common_default.sanitizeText(customId, config5); + } + const currentBranchCheck = state2.records.branches.get(state2.records.currBranch); + const otherBranchCheck = state2.records.branches.get(otherBranch); + const currentCommit = currentBranchCheck ? state2.records.commits.get(currentBranchCheck) : void 0; + const otherCommit = otherBranchCheck ? state2.records.commits.get(otherBranchCheck) : void 0; + if (currentCommit && otherCommit && currentCommit.branch === otherBranch) { + throw new Error(`Cannot merge branch '${otherBranch}' into itself.`); + } + if (state2.records.currBranch === otherBranch) { + const error3 = new Error('Incorrect usage of "merge". Cannot merge a branch to itself'); + error3.hash = { + text: `merge ${otherBranch}`, + token: `merge ${otherBranch}`, + expected: ["branch abc"] + }; + throw error3; + } + if (currentCommit === void 0 || !currentCommit) { + const error3 = new Error( + `Incorrect usage of "merge". Current branch (${state2.records.currBranch})has no commits` + ); + error3.hash = { + text: `merge ${otherBranch}`, + token: `merge ${otherBranch}`, + expected: ["commit"] + }; + throw error3; + } + if (!state2.records.branches.has(otherBranch)) { + const error3 = new Error( + 'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") does not exist" + ); + error3.hash = { + text: `merge ${otherBranch}`, + token: `merge ${otherBranch}`, + expected: [`branch ${otherBranch}`] + }; + throw error3; + } + if (otherCommit === void 0 || !otherCommit) { + const error3 = new Error( + 'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ") has no commits" + ); + error3.hash = { + text: `merge ${otherBranch}`, + token: `merge ${otherBranch}`, + expected: ['"commit"'] + }; + throw error3; + } + if (currentCommit === otherCommit) { + const error3 = new Error('Incorrect usage of "merge". Both branches have same head'); + error3.hash = { + text: `merge ${otherBranch}`, + token: `merge ${otherBranch}`, + expected: ["branch abc"] + }; + throw error3; + } + if (customId && state2.records.commits.has(customId)) { + const error3 = new Error( + 'Incorrect usage of "merge". Commit with id:' + customId + " already exists, use different custom id" + ); + error3.hash = { + text: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`, + token: `merge ${otherBranch} ${customId} ${overrideType} ${customTags?.join(" ")}`, + expected: [ + `merge ${otherBranch} ${customId}_UNIQUE ${overrideType} ${customTags?.join(" ")}` + ] + }; + throw error3; + } + const verifiedBranch = otherBranchCheck ? otherBranchCheck : ""; + const commit2 = { + id: customId || `${state2.records.seq}-${getID()}`, + message: `merged branch ${otherBranch} into ${state2.records.currBranch}`, + seq: state2.records.seq++, + parents: state2.records.head == null ? [] : [state2.records.head.id, verifiedBranch], + branch: state2.records.currBranch, + type: commitType.MERGE, + customType: overrideType, + customId: customId ? true : false, + tags: customTags ?? [] + }; + state2.records.head = commit2; + state2.records.commits.set(commit2.id, commit2); + state2.records.branches.set(state2.records.currBranch, commit2.id); + log.debug(state2.records.branches); + log.debug("in mergeBranch"); + }, "merge"); + cherryPick = /* @__PURE__ */ __name(function(cherryPickDB) { + let sourceId = cherryPickDB.id; + let targetId = cherryPickDB.targetId; + let tags2 = cherryPickDB.tags; + let parentCommitId = cherryPickDB.parent; + log.debug("Entering cherryPick:", sourceId, targetId, tags2); + const config5 = getConfig3(); + sourceId = common_default.sanitizeText(sourceId, config5); + targetId = common_default.sanitizeText(targetId, config5); + tags2 = tags2?.map((tag) => common_default.sanitizeText(tag, config5)); + parentCommitId = common_default.sanitizeText(parentCommitId, config5); + if (!sourceId || !state2.records.commits.has(sourceId)) { + const error3 = new Error( + 'Incorrect usage of "cherryPick". Source commit id should exist and provided' + ); + error3.hash = { + text: `cherryPick ${sourceId} ${targetId}`, + token: `cherryPick ${sourceId} ${targetId}`, + expected: ["cherry-pick abc"] + }; + throw error3; + } + const sourceCommit = state2.records.commits.get(sourceId); + if (sourceCommit === void 0 || !sourceCommit) { + throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided'); + } + if (parentCommitId && !(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))) { + const error3 = new Error( + "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit." + ); + throw error3; + } + const sourceCommitBranch = sourceCommit.branch; + if (sourceCommit.type === commitType.MERGE && !parentCommitId) { + const error3 = new Error( + "Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified." + ); + throw error3; + } + if (!targetId || !state2.records.commits.has(targetId)) { + if (sourceCommitBranch === state2.records.currBranch) { + const error3 = new Error( + 'Incorrect usage of "cherryPick". Source commit is already on current branch' + ); + error3.hash = { + text: `cherryPick ${sourceId} ${targetId}`, + token: `cherryPick ${sourceId} ${targetId}`, + expected: ["cherry-pick abc"] + }; + throw error3; + } + const currentCommitId = state2.records.branches.get(state2.records.currBranch); + if (currentCommitId === void 0 || !currentCommitId) { + const error3 = new Error( + `Incorrect usage of "cherry-pick". Current branch (${state2.records.currBranch})has no commits` + ); + error3.hash = { + text: `cherryPick ${sourceId} ${targetId}`, + token: `cherryPick ${sourceId} ${targetId}`, + expected: ["cherry-pick abc"] + }; + throw error3; + } + const currentCommit = state2.records.commits.get(currentCommitId); + if (currentCommit === void 0 || !currentCommit) { + const error3 = new Error( + `Incorrect usage of "cherry-pick". Current branch (${state2.records.currBranch})has no commits` + ); + error3.hash = { + text: `cherryPick ${sourceId} ${targetId}`, + token: `cherryPick ${sourceId} ${targetId}`, + expected: ["cherry-pick abc"] + }; + throw error3; + } + const commit2 = { + id: state2.records.seq + "-" + getID(), + message: `cherry-picked ${sourceCommit?.message} into ${state2.records.currBranch}`, + seq: state2.records.seq++, + parents: state2.records.head == null ? [] : [state2.records.head.id, sourceCommit.id], + branch: state2.records.currBranch, + type: commitType.CHERRY_PICK, + tags: tags2 ? tags2.filter(Boolean) : [ + `cherry-pick:${sourceCommit.id}${sourceCommit.type === commitType.MERGE ? `|parent:${parentCommitId}` : ""}` + ] + }; + state2.records.head = commit2; + state2.records.commits.set(commit2.id, commit2); + state2.records.branches.set(state2.records.currBranch, commit2.id); + log.debug(state2.records.branches); + log.debug("in cherryPick"); + } + }, "cherryPick"); + checkout = /* @__PURE__ */ __name(function(branch2) { + branch2 = common_default.sanitizeText(branch2, getConfig3()); + if (!state2.records.branches.has(branch2)) { + const error3 = new Error( + `Trying to checkout branch which is not yet created. (Help try using "branch ${branch2}")` + ); + error3.hash = { + text: `checkout ${branch2}`, + token: `checkout ${branch2}`, + expected: [`branch ${branch2}`] + }; + throw error3; + } else { + state2.records.currBranch = branch2; + const id35 = state2.records.branches.get(state2.records.currBranch); + if (id35 === void 0 || !id35) { + state2.records.head = null; + } else { + state2.records.head = state2.records.commits.get(id35) ?? null; + } + } + }, "checkout"); + __name(upsert, "upsert"); + __name(prettyPrintCommitHistory, "prettyPrintCommitHistory"); + prettyPrint = /* @__PURE__ */ __name(function() { + log.debug(state2.records.commits); + const node2 = getCommitsArray()[0]; + prettyPrintCommitHistory([node2]); + }, "prettyPrint"); + clear7 = /* @__PURE__ */ __name(function() { + state2.reset(); + clear(); + }, "clear"); + getBranchesAsObjArray = /* @__PURE__ */ __name(function() { + const branchesArray = [...state2.records.branchConfig.values()].map((branchConfig, i2) => { + if (branchConfig.order !== null && branchConfig.order !== void 0) { + return branchConfig; + } + return { + ...branchConfig, + order: parseFloat(`0.${i2}`) + }; + }).sort((a2, b3) => (a2.order ?? 0) - (b3.order ?? 0)).map(({ name }) => ({ name })); + return branchesArray; + }, "getBranchesAsObjArray"); + getBranches = /* @__PURE__ */ __name(function() { + return state2.records.branches; + }, "getBranches"); + getCommits = /* @__PURE__ */ __name(function() { + return state2.records.commits; + }, "getCommits"); + getCommitsArray = /* @__PURE__ */ __name(function() { + const commitArr = [...state2.records.commits.values()]; + commitArr.forEach(function(o2) { + log.debug(o2.id); + }); + commitArr.sort((a2, b3) => a2.seq - b3.seq); + return commitArr; + }, "getCommitsArray"); + getCurrentBranch = /* @__PURE__ */ __name(function() { + return state2.records.currBranch; + }, "getCurrentBranch"); + getDirection = /* @__PURE__ */ __name(function() { + return state2.records.direction; + }, "getDirection"); + getHead = /* @__PURE__ */ __name(function() { + return state2.records.head; + }, "getHead"); + db = { + commitType, + getConfig: getConfig3, + setDirection, + setOptions: setOptions6, + getOptions, + commit, + branch, + merge: merge5, + cherryPick, + checkout, + //reset, + prettyPrint, + clear: clear7, + getBranchesAsObjArray, + getBranches, + getCommits, + getCommitsArray, + getCurrentBranch, + getDirection, + getHead, + setAccTitle, + getAccTitle, + getAccDescription, + setAccDescription, + setDiagramTitle, + getDiagramTitle + }; + } + }); + + // src/diagrams/git/gitGraphParser.ts + var populate15, parseStatement, parseCommit, parseBranch, parseMerge, parseCheckout, parseCherryPicking, parser4; + var init_gitGraphParser = __esm({ + "src/diagrams/git/gitGraphParser.ts"() { + "use strict"; + init_mermaid_parser_core(); + init_logger(); + init_populateCommonDb(); + init_gitGraphAst(); + init_gitGraphTypes(); + populate15 = /* @__PURE__ */ __name((ast, db10) => { + populateCommonDb(ast, db10); + if (ast.dir) { + db10.setDirection(ast.dir); + } + for (const statement of ast.statements) { + parseStatement(statement, db10); + } + }, "populate"); + parseStatement = /* @__PURE__ */ __name((statement, db10) => { + const parsers2 = { + Commit: /* @__PURE__ */ __name((stmt) => db10.commit(parseCommit(stmt)), "Commit"), + Branch: /* @__PURE__ */ __name((stmt) => db10.branch(parseBranch(stmt)), "Branch"), + Merge: /* @__PURE__ */ __name((stmt) => db10.merge(parseMerge(stmt)), "Merge"), + Checkout: /* @__PURE__ */ __name((stmt) => db10.checkout(parseCheckout(stmt)), "Checkout"), + CherryPicking: /* @__PURE__ */ __name((stmt) => db10.cherryPick(parseCherryPicking(stmt)), "CherryPicking") + }; + const parser29 = parsers2[statement.$type]; + if (parser29) { + parser29(statement); + } else { + log.error(`Unknown statement type: ${statement.$type}`); + } + }, "parseStatement"); + parseCommit = /* @__PURE__ */ __name((commit2) => { + const commitDB = { + id: commit2.id, + msg: commit2.message ?? "", + type: commit2.type !== void 0 ? commitType[commit2.type] : commitType.NORMAL, + tags: commit2.tags ?? void 0 + }; + return commitDB; + }, "parseCommit"); + parseBranch = /* @__PURE__ */ __name((branch2) => { + const branchDB = { + name: branch2.name, + order: branch2.order ?? 0 + }; + return branchDB; + }, "parseBranch"); + parseMerge = /* @__PURE__ */ __name((merge6) => { + const mergeDB = { + branch: merge6.branch, + id: merge6.id ?? "", + type: merge6.type !== void 0 ? commitType[merge6.type] : void 0, + tags: merge6.tags ?? void 0 + }; + return mergeDB; + }, "parseMerge"); + parseCheckout = /* @__PURE__ */ __name((checkout2) => { + const branch2 = checkout2.branch; + return branch2; + }, "parseCheckout"); + parseCherryPicking = /* @__PURE__ */ __name((cherryPicking) => { + const cherryPickDB = { + id: cherryPicking.id, + targetId: "", + tags: cherryPicking.tags?.length === 0 ? void 0 : cherryPicking.tags, + parent: cherryPicking.parent + }; + return cherryPickDB; + }, "parseCherryPicking"); + parser4 = { + parse: /* @__PURE__ */ __name(async (input) => { + const ast = await parse3("gitGraph", input); + log.debug(ast); + populate15(ast, db); + }, "parse") + }; + if (void 0) { + const { it, expect, describe } = void 0; + const mockDB = { + commitType, + setDirection: vi.fn(), + commit: vi.fn(), + branch: vi.fn(), + merge: vi.fn(), + cherryPick: vi.fn(), + checkout: vi.fn() + }; + describe("GitGraph Parser", () => { + it("should parse a commit statement", () => { + const commit2 = { + $type: "Commit", + id: "1", + message: "test", + tags: ["tag1", "tag2"], + type: "NORMAL" + }; + parseStatement(commit2, mockDB); + expect(mockDB.commit).toHaveBeenCalledWith({ + id: "1", + msg: "test", + tags: ["tag1", "tag2"], + type: 0 + }); + }); + it("should parse a branch statement", () => { + const branch2 = { + $type: "Branch", + name: "newBranch", + order: 1 + }; + parseStatement(branch2, mockDB); + expect(mockDB.branch).toHaveBeenCalledWith({ name: "newBranch", order: 1 }); + }); + it("should parse a checkout statement", () => { + const checkout2 = { + $type: "Checkout", + branch: "newBranch" + }; + parseStatement(checkout2, mockDB); + expect(mockDB.checkout).toHaveBeenCalledWith("newBranch"); + }); + it("should parse a merge statement", () => { + const merge6 = { + $type: "Merge", + branch: "newBranch", + id: "1", + tags: ["tag1", "tag2"], + type: "NORMAL" + }; + parseStatement(merge6, mockDB); + expect(mockDB.merge).toHaveBeenCalledWith({ + branch: "newBranch", + id: "1", + tags: ["tag1", "tag2"], + type: 0 + }); + }); + it("should parse a cherry picking statement", () => { + const cherryPick2 = { + $type: "CherryPicking", + id: "1", + tags: ["tag1", "tag2"], + parent: "2" + }; + parseStatement(cherryPick2, mockDB); + expect(mockDB.cherryPick).toHaveBeenCalledWith({ + id: "1", + targetId: "", + parent: "2", + tags: ["tag1", "tag2"] + }); + }); + it("should parse a langium generated gitGraph ast", () => { + const dummy = { + $type: "GitGraph", + statements: [], + accDescr: "", + accTitle: "", + title: "" + }; + const gitGraphAst = { + $type: "GitGraph", + statements: [ + { + $container: dummy, + $type: "Commit", + id: "1", + message: "test", + tags: ["tag1", "tag2"], + type: "NORMAL" + }, + { + $container: dummy, + $type: "Branch", + name: "newBranch", + order: 1 + }, + { + $container: dummy, + $type: "Merge", + branch: "newBranch", + id: "1", + tags: ["tag1", "tag2"], + type: "NORMAL" + }, + { + $container: dummy, + $type: "Checkout", + branch: "newBranch" + }, + { + $container: dummy, + $type: "CherryPicking", + id: "1", + tags: ["tag1", "tag2"], + parent: "2" + } + ], + accDescr: "", + accTitle: "", + title: "" + }; + populate15(gitGraphAst, mockDB); + expect(mockDB.commit).toHaveBeenCalledWith({ + id: "1", + msg: "test", + tags: ["tag1", "tag2"], + type: 0 + }); + expect(mockDB.branch).toHaveBeenCalledWith({ name: "newBranch", order: 1 }); + expect(mockDB.merge).toHaveBeenCalledWith({ + branch: "newBranch", + id: "1", + tags: ["tag1", "tag2"], + type: 0 + }); + expect(mockDB.checkout).toHaveBeenCalledWith("newBranch"); + }); + }); + } + } + }); + + // src/diagrams/git/gitGraphRenderer.ts + var LAYOUT_OFFSET, COMMIT_STEP, PX, PY, THEME_COLOR_LIMIT, REDUX_GEOMETRY_THEMES, REDUX_BRANCH_LABEL_PADDING_Y, COLOR_THEMES3, DARK_THEMES, calcColorIndex, branchPos, commitPos, defaultPos, allCommitsDict, lanes, maxPos, dir, clear8, drawText2, findClosestParent, findClosestParentBT, setParallelBTPos, findClosestParentPos, calculateCommitPosition, setCommitPosition, setRootPosition, drawCommitBullet, drawCommitLabel, drawCommitTags, getCommitClassType, calculatePosition, getCommitPosition, drawCommits, shouldRerouteArrow, findLane, drawArrow, drawArrows, drawBranches, setBranchPosition, draw4, gitGraphRenderer_default; + var init_gitGraphRenderer = __esm({ + "src/diagrams/git/gitGraphRenderer.ts"() { + "use strict"; + init_src32(); + init_diagramAPI(); + init_logger(); + init_utils2(); + init_gitGraphTypes(); + LAYOUT_OFFSET = 10; + COMMIT_STEP = 40; + PX = 4; + PY = 2; + THEME_COLOR_LIMIT = 8; + REDUX_GEOMETRY_THEMES = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]); + REDUX_BRANCH_LABEL_PADDING_Y = 12; + COLOR_THEMES3 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]); + DARK_THEMES = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]); + calcColorIndex = /* @__PURE__ */ __name((rawIndex, limit2, avoidDefaultColor = false) => { + if (avoidDefaultColor && rawIndex > 0) { + return (rawIndex - 1) % (limit2 - 1) + 1; + } + return rawIndex % limit2; + }, "calcColorIndex"); + branchPos = /* @__PURE__ */ new Map(); + commitPos = /* @__PURE__ */ new Map(); + defaultPos = 30; + allCommitsDict = /* @__PURE__ */ new Map(); + lanes = []; + maxPos = 0; + dir = "LR"; + clear8 = /* @__PURE__ */ __name(() => { + branchPos.clear(); + commitPos.clear(); + allCommitsDict.clear(); + maxPos = 0; + lanes = []; + dir = "LR"; + }, "clear"); + drawText2 = /* @__PURE__ */ __name((txt) => { + const svgLabel = document.createElementNS("http://www.w3.org/2000/svg", "text"); + const rows = typeof txt === "string" ? txt.split(/\\n|\n|/gi) : txt; + rows.forEach((row) => { + const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"); + tspan.setAttribute("dy", "1em"); + tspan.setAttribute("x", "0"); + tspan.setAttribute("class", "row"); + tspan.textContent = row.trim(); + svgLabel.appendChild(tspan); + }); + return svgLabel; + }, "drawText"); + findClosestParent = /* @__PURE__ */ __name((parents3) => { + let closestParent; + let comparisonFunc; + let targetPosition; + if (dir === "BT") { + comparisonFunc = /* @__PURE__ */ __name((a2, b3) => a2 <= b3, "comparisonFunc"); + targetPosition = Infinity; + } else { + comparisonFunc = /* @__PURE__ */ __name((a2, b3) => a2 >= b3, "comparisonFunc"); + targetPosition = 0; + } + parents3.forEach((parent4) => { + const parentPosition = dir === "TB" || dir == "BT" ? commitPos.get(parent4)?.y : commitPos.get(parent4)?.x; + if (parentPosition !== void 0 && comparisonFunc(parentPosition, targetPosition)) { + closestParent = parent4; + targetPosition = parentPosition; + } + }); + return closestParent; + }, "findClosestParent"); + findClosestParentBT = /* @__PURE__ */ __name((parents3) => { + let closestParent = ""; + let maxPosition = Infinity; + parents3.forEach((parent4) => { + const parentPosition = commitPos.get(parent4).y; + if (parentPosition <= maxPosition) { + closestParent = parent4; + maxPosition = parentPosition; + } + }); + return closestParent || void 0; + }, "findClosestParentBT"); + setParallelBTPos = /* @__PURE__ */ __name((sortedKeys, commits, defaultPos2) => { + let curPos = defaultPos2; + let maxPosition = defaultPos2; + const roots = []; + sortedKeys.forEach((key) => { + const commit2 = commits.get(key); + if (!commit2) { + throw new Error(`Commit not found for key ${key}`); + } + if (commit2.parents.length) { + curPos = calculateCommitPosition(commit2); + maxPosition = Math.max(curPos, maxPosition); + } else { + roots.push(commit2); + } + setCommitPosition(commit2, curPos); + }); + curPos = maxPosition; + roots.forEach((commit2) => { + setRootPosition(commit2, curPos, defaultPos2); + }); + sortedKeys.forEach((key) => { + const commit2 = commits.get(key); + if (commit2?.parents.length) { + const closestParent = findClosestParentBT(commit2.parents); + curPos = commitPos.get(closestParent).y - COMMIT_STEP; + if (curPos <= maxPosition) { + maxPosition = curPos; + } + const x5 = branchPos.get(commit2.branch).pos; + const y6 = curPos - LAYOUT_OFFSET; + commitPos.set(commit2.id, { x: x5, y: y6 }); + } + }); + }, "setParallelBTPos"); + findClosestParentPos = /* @__PURE__ */ __name((commit2) => { + const closestParent = findClosestParent(commit2.parents.filter((p3) => p3 !== null)); + if (!closestParent) { + throw new Error(`Closest parent not found for commit ${commit2.id}`); + } + const closestParentPos = commitPos.get(closestParent)?.y; + if (closestParentPos === void 0) { + throw new Error(`Closest parent position not found for commit ${commit2.id}`); + } + return closestParentPos; + }, "findClosestParentPos"); + calculateCommitPosition = /* @__PURE__ */ __name((commit2) => { + const closestParentPos = findClosestParentPos(commit2); + return closestParentPos + COMMIT_STEP; + }, "calculateCommitPosition"); + setCommitPosition = /* @__PURE__ */ __name((commit2, curPos) => { + const branch2 = branchPos.get(commit2.branch); + if (!branch2) { + throw new Error(`Branch not found for commit ${commit2.id}`); + } + const x5 = branch2.pos; + const y6 = curPos + LAYOUT_OFFSET; + commitPos.set(commit2.id, { x: x5, y: y6 }); + return { x: x5, y: y6 }; + }, "setCommitPosition"); + setRootPosition = /* @__PURE__ */ __name((commit2, curPos, defaultPos2) => { + const branch2 = branchPos.get(commit2.branch); + if (!branch2) { + throw new Error(`Branch not found for commit ${commit2.id}`); + } + const y6 = curPos + defaultPos2; + const x5 = branch2.pos; + commitPos.set(commit2.id, { x: x5, y: y6 }); + }, "setRootPosition"); + drawCommitBullet = /* @__PURE__ */ __name((gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType) => { + const { theme } = getConfig2(); + const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(theme ?? ""); + const useColorTheme = COLOR_THEMES3.has(theme ?? ""); + const isDark2 = DARK_THEMES.has(theme ?? ""); + if (commitSymbolType === commitType.HIGHLIGHT) { + gBullets.append("rect").attr("x", commitPosition.x - 10 + (useReduxGeometry ? 3 : 0)).attr("y", commitPosition.y - 10 + (useReduxGeometry ? 3 : 0)).attr("width", useReduxGeometry ? 14 : 20).attr("height", useReduxGeometry ? 14 : 20).attr( + "class", + `commit ${commit2.id} commit-highlight${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)} ${typeClass}-outer` + ); + gBullets.append("rect").attr("x", commitPosition.x - 6 + (useReduxGeometry ? 2 : 0)).attr("y", commitPosition.y - 6 + (useReduxGeometry ? 2 : 0)).attr("width", useReduxGeometry ? 8 : 12).attr("height", useReduxGeometry ? 8 : 12).attr( + "class", + `commit ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)} ${typeClass}-inner` + ); + } else if (commitSymbolType === commitType.CHERRY_PICK) { + gBullets.append("circle").attr("cx", commitPosition.x).attr("cy", commitPosition.y).attr("r", useReduxGeometry ? 7 : 10).attr("class", `commit ${commit2.id} ${typeClass}`); + gBullets.append("circle").attr("cx", commitPosition.x - 3).attr("cy", commitPosition.y + 2).attr("r", useReduxGeometry ? 2.5 : 2.75).attr("fill", isDark2 ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`); + gBullets.append("circle").attr("cx", commitPosition.x + 3).attr("cy", commitPosition.y + 2).attr("r", useReduxGeometry ? 2.5 : 2.75).attr("fill", isDark2 ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`); + gBullets.append("line").attr("x1", commitPosition.x + 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", isDark2 ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`); + gBullets.append("line").attr("x1", commitPosition.x - 3).attr("y1", commitPosition.y + 1).attr("x2", commitPosition.x).attr("y2", commitPosition.y - 5).attr("stroke", isDark2 ? "#000000" : "#fff").attr("class", `commit ${commit2.id} ${typeClass}`); + } else { + const circle6 = gBullets.append("circle"); + circle6.attr("cx", commitPosition.x); + circle6.attr("cy", commitPosition.y); + circle6.attr("r", useReduxGeometry ? 7 : 10); + circle6.attr( + "class", + `commit ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}` + ); + if (commitSymbolType === commitType.MERGE) { + const circle22 = gBullets.append("circle"); + circle22.attr("cx", commitPosition.x); + circle22.attr("cy", commitPosition.y); + circle22.attr("r", useReduxGeometry ? 5 : 6); + circle22.attr( + "class", + `commit ${typeClass} ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}` + ); + } + if (commitSymbolType === commitType.REVERSE) { + const cross3 = gBullets.append("path"); + const constValue = useReduxGeometry ? 4 : 5; + cross3.attr( + "d", + `M ${commitPosition.x - constValue},${commitPosition.y - constValue}L${commitPosition.x + constValue},${commitPosition.y + constValue}M${commitPosition.x - constValue},${commitPosition.y + constValue}L${commitPosition.x + constValue},${commitPosition.y - constValue}` + ).attr( + "class", + `commit ${typeClass} ${commit2.id} commit${calcColorIndex(branchIndex, THEME_COLOR_LIMIT, useColorTheme)}` + ); + } + } + }, "drawCommitBullet"); + drawCommitLabel = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos, gitGraphConfig) => { + if (commit2.type !== commitType.CHERRY_PICK && (commit2.customId && commit2.type === commitType.MERGE || commit2.type !== commitType.MERGE) && gitGraphConfig.showCommitLabel) { + const wrapper = gLabels.append("g"); + const labelBkg = wrapper.insert("rect").attr("class", "commit-label-bkg"); + const text4 = wrapper.append("text").attr("x", pos).attr("y", commitPosition.y + 25).attr("class", "commit-label").text(commit2.id); + const bbox = text4.node()?.getBBox(); + if (bbox) { + labelBkg.attr("x", commitPosition.posWithOffset - bbox.width / 2 - PY).attr("y", commitPosition.y + 13.5).attr("width", bbox.width + 2 * PY).attr("height", bbox.height + 2 * PY); + if (dir === "TB" || dir === "BT") { + labelBkg.attr("x", commitPosition.x - (bbox.width + 4 * PX + 5)).attr("y", commitPosition.y - 12); + text4.attr("x", commitPosition.x - (bbox.width + 4 * PX)).attr("y", commitPosition.y + bbox.height - 12); + } else { + text4.attr("x", commitPosition.posWithOffset - bbox.width / 2); + } + if (gitGraphConfig.rotateCommitLabel) { + if (dir === "TB" || dir === "BT") { + text4.attr( + "transform", + "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")" + ); + labelBkg.attr( + "transform", + "rotate(-45, " + commitPosition.x + ", " + commitPosition.y + ")" + ); + } else { + const r_x = -7.5 - (bbox.width + 10) / 25 * 9.5; + const r_y = 10 + bbox.width / 25 * 8.5; + wrapper.attr( + "transform", + "translate(" + r_x + ", " + r_y + ") rotate(-45, " + pos + ", " + commitPosition.y + ")" + ); + } + } + } + } + }, "drawCommitLabel"); + drawCommitTags = /* @__PURE__ */ __name((gLabels, commit2, commitPosition, pos) => { + if (commit2.tags.length > 0) { + let yOffset = 0; + let maxTagBboxWidth = 0; + let maxTagBboxHeight = 0; + const tagElements = []; + for (const tagValue of commit2.tags.reverse()) { + const rect3 = gLabels.insert("polygon"); + const hole = gLabels.append("circle"); + const tag = gLabels.append("text").attr("y", commitPosition.y - 16 - yOffset).attr("class", "tag-label").text(tagValue); + const tagBbox = tag.node()?.getBBox(); + if (!tagBbox) { + throw new Error("Tag bbox not found"); + } + maxTagBboxWidth = Math.max(maxTagBboxWidth, tagBbox.width); + maxTagBboxHeight = Math.max(maxTagBboxHeight, tagBbox.height); + tag.attr("x", commitPosition.posWithOffset - tagBbox.width / 2); + tagElements.push({ + tag, + hole, + rect: rect3, + yOffset + }); + yOffset += 20; + } + for (const { tag, hole, rect: rect3, yOffset: yOffset2 } of tagElements) { + const h22 = maxTagBboxHeight / 2; + const ly = commitPosition.y - 19.2 - yOffset2; + rect3.attr("class", "tag-label-bkg").attr( + "points", + ` + ${pos - maxTagBboxWidth / 2 - PX / 2},${ly + PY} + ${pos - maxTagBboxWidth / 2 - PX / 2},${ly - PY} + ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly - h22 - PY} + ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly - h22 - PY} + ${commitPosition.posWithOffset + maxTagBboxWidth / 2 + PX},${ly + h22 + PY} + ${commitPosition.posWithOffset - maxTagBboxWidth / 2 - PX},${ly + h22 + PY}` + ); + hole.attr("cy", ly).attr("cx", pos - maxTagBboxWidth / 2 + PX / 2).attr("r", 1.5).attr("class", "tag-hole"); + if (dir === "TB" || dir === "BT") { + const yOrigin = pos + yOffset2; + rect3.attr("class", "tag-label-bkg").attr( + "points", + ` + ${commitPosition.x},${yOrigin + 2} + ${commitPosition.x},${yOrigin - 2} + ${commitPosition.x + LAYOUT_OFFSET},${yOrigin - h22 - 2} + ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin - h22 - 2} + ${commitPosition.x + LAYOUT_OFFSET + maxTagBboxWidth + 4},${yOrigin + h22 + 2} + ${commitPosition.x + LAYOUT_OFFSET},${yOrigin + h22 + 2}` + ).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")"); + hole.attr("cx", commitPosition.x + PX / 2).attr("cy", yOrigin).attr("transform", "translate(12,12) rotate(45, " + commitPosition.x + "," + pos + ")"); + tag.attr("x", commitPosition.x + 5).attr("y", yOrigin + 3).attr("transform", "translate(14,14) rotate(45, " + commitPosition.x + "," + pos + ")"); + } + } + } + }, "drawCommitTags"); + getCommitClassType = /* @__PURE__ */ __name((commit2) => { + const commitSymbolType = commit2.customType ?? commit2.type; + switch (commitSymbolType) { + case commitType.NORMAL: + return "commit-normal"; + case commitType.REVERSE: + return "commit-reverse"; + case commitType.HIGHLIGHT: + return "commit-highlight"; + case commitType.MERGE: + return "commit-merge"; + case commitType.CHERRY_PICK: + return "commit-cherry-pick"; + default: + return "commit-normal"; + } + }, "getCommitClassType"); + calculatePosition = /* @__PURE__ */ __name((commit2, dir2, pos, commitPos2) => { + const defaultCommitPosition = { x: 0, y: 0 }; + if (commit2.parents.length > 0) { + const closestParent = findClosestParent(commit2.parents); + if (closestParent) { + const parentPosition = commitPos2.get(closestParent) ?? defaultCommitPosition; + if (dir2 === "TB") { + return parentPosition.y + COMMIT_STEP; + } else if (dir2 === "BT") { + const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition; + return currentPosition.y - COMMIT_STEP; + } else { + return parentPosition.x + COMMIT_STEP; + } + } + } else { + if (dir2 === "TB") { + return defaultPos; + } else if (dir2 === "BT") { + const currentPosition = commitPos2.get(commit2.id) ?? defaultCommitPosition; + return currentPosition.y - COMMIT_STEP; + } else { + return 0; + } + } + return 0; + }, "calculatePosition"); + getCommitPosition = /* @__PURE__ */ __name((commit2, pos, isParallelCommits) => { + const posWithOffset = dir === "BT" && isParallelCommits ? pos : pos + LAYOUT_OFFSET; + const branchY = branchPos.get(commit2.branch)?.pos; + const x5 = dir === "TB" || dir === "BT" ? branchPos.get(commit2.branch)?.pos : posWithOffset; + if (x5 === void 0 || branchY === void 0) { + throw new Error(`Position were undefined for commit ${commit2.id}`); + } + const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(getConfig2().theme ?? ""); + const y6 = dir === "TB" || dir === "BT" ? posWithOffset : branchY + (useReduxGeometry ? REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : -2); + return { x: x5, y: y6, posWithOffset }; + }, "getCommitPosition"); + drawCommits = /* @__PURE__ */ __name((svg2, commits, modifyGraph, gitGraphConfig) => { + const gBullets = svg2.append("g").attr("class", "commit-bullets"); + const gLabels = svg2.append("g").attr("class", "commit-labels"); + let pos = dir === "TB" || dir === "BT" ? defaultPos : 0; + const keys3 = [...commits.keys()]; + const isParallelCommits = gitGraphConfig.parallelCommits ?? false; + const sortKeys = /* @__PURE__ */ __name((a2, b3) => { + const seqA = commits.get(a2)?.seq; + const seqB = commits.get(b3)?.seq; + return seqA !== void 0 && seqB !== void 0 ? seqA - seqB : 0; + }, "sortKeys"); + let sortedKeys = keys3.sort(sortKeys); + if (dir === "BT") { + if (isParallelCommits) { + setParallelBTPos(sortedKeys, commits, pos); + } + sortedKeys = sortedKeys.reverse(); + } + sortedKeys.forEach((key) => { + const commit2 = commits.get(key); + if (!commit2) { + throw new Error(`Commit not found for key ${key}`); + } + if (isParallelCommits) { + pos = calculatePosition(commit2, dir, pos, commitPos); + } + const commitPosition = getCommitPosition(commit2, pos, isParallelCommits); + if (modifyGraph) { + const typeClass = getCommitClassType(commit2); + const commitSymbolType = commit2.customType ?? commit2.type; + const branchIndex = branchPos.get(commit2.branch)?.index ?? 0; + drawCommitBullet(gBullets, commit2, commitPosition, typeClass, branchIndex, commitSymbolType); + drawCommitLabel(gLabels, commit2, commitPosition, pos, gitGraphConfig); + drawCommitTags(gLabels, commit2, commitPosition, pos); + } + if (dir === "TB" || dir === "BT") { + commitPos.set(commit2.id, { x: commitPosition.x, y: commitPosition.posWithOffset }); + } else { + commitPos.set(commit2.id, { x: commitPosition.posWithOffset, y: commitPosition.y }); + } + pos = dir === "BT" && isParallelCommits ? pos + COMMIT_STEP : pos + COMMIT_STEP + LAYOUT_OFFSET; + if (pos > maxPos) { + maxPos = pos; + } + }); + }, "drawCommits"); + shouldRerouteArrow = /* @__PURE__ */ __name((commitA, commitB, p1, p22, allCommits) => { + const commitBIsFurthest = dir === "TB" || dir === "BT" ? p1.x < p22.x : p1.y < p22.y; + const branchToGetCurve = commitBIsFurthest ? commitB.branch : commitA.branch; + const isOnBranchToGetCurve = /* @__PURE__ */ __name((x5) => x5.branch === branchToGetCurve, "isOnBranchToGetCurve"); + const isBetweenCommits = /* @__PURE__ */ __name((x5) => x5.seq > commitA.seq && x5.seq < commitB.seq, "isBetweenCommits"); + return [...allCommits.values()].some((commitX) => { + return isBetweenCommits(commitX) && isOnBranchToGetCurve(commitX); + }); + }, "shouldRerouteArrow"); + findLane = /* @__PURE__ */ __name((y1, y22, depth = 0) => { + const candidate = y1 + Math.abs(y1 - y22) / 2; + if (depth > 5) { + return candidate; + } + const ok = lanes.every((lane) => Math.abs(lane - candidate) >= 10); + if (ok) { + lanes.push(candidate); + return candidate; + } + const diff2 = Math.abs(y1 - y22); + return findLane(y1, y22 - diff2 / 5, depth + 1); + }, "findLane"); + drawArrow = /* @__PURE__ */ __name((svg2, commitA, commitB, allCommits) => { + const { theme: arrowTheme } = getConfig2(); + const useColorTheme = COLOR_THEMES3.has(arrowTheme ?? ""); + const p1 = commitPos.get(commitA.id); + const p22 = commitPos.get(commitB.id); + if (p1 === void 0 || p22 === void 0) { + throw new Error(`Commit positions not found for commits ${commitA.id} and ${commitB.id}`); + } + const arrowNeedsRerouting = shouldRerouteArrow(commitA, commitB, p1, p22, allCommits); + let arc = ""; + let arc2 = ""; + let radius2 = 0; + let offset = 0; + let colorClassNum = branchPos.get(commitB.branch)?.index; + if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) { + colorClassNum = branchPos.get(commitA.branch)?.index; + } + let lineDef; + if (arrowNeedsRerouting) { + arc = "A 10 10, 0, 0, 0,"; + arc2 = "A 10 10, 0, 0, 1,"; + radius2 = 10; + offset = 10; + const lineY = p1.y < p22.y ? findLane(p1.y, p22.y) : findLane(p22.y, p1.y); + const lineX = p1.x < p22.x ? findLane(p1.x, p22.x) : findLane(p22.x, p1.x); + if (dir === "TB") { + if (p1.x < p22.x) { + lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius2} ${p1.y} ${arc2} ${lineX} ${p1.y + offset} L ${lineX} ${p22.y - radius2} ${arc} ${lineX + offset} ${p22.y} L ${p22.x} ${p22.y}`; + } else { + colorClassNum = branchPos.get(commitA.branch)?.index; + lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius2} ${p1.y} ${arc} ${lineX} ${p1.y + offset} L ${lineX} ${p22.y - radius2} ${arc2} ${lineX - offset} ${p22.y} L ${p22.x} ${p22.y}`; + } + } else if (dir === "BT") { + if (p1.x < p22.x) { + lineDef = `M ${p1.x} ${p1.y} L ${lineX - radius2} ${p1.y} ${arc} ${lineX} ${p1.y - offset} L ${lineX} ${p22.y + radius2} ${arc2} ${lineX + offset} ${p22.y} L ${p22.x} ${p22.y}`; + } else { + colorClassNum = branchPos.get(commitA.branch)?.index; + lineDef = `M ${p1.x} ${p1.y} L ${lineX + radius2} ${p1.y} ${arc2} ${lineX} ${p1.y - offset} L ${lineX} ${p22.y + radius2} ${arc} ${lineX - offset} ${p22.y} L ${p22.x} ${p22.y}`; + } + } else { + if (p1.y < p22.y) { + lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY - radius2} ${arc} ${p1.x + offset} ${lineY} L ${p22.x - radius2} ${lineY} ${arc2} ${p22.x} ${lineY + offset} L ${p22.x} ${p22.y}`; + } else { + colorClassNum = branchPos.get(commitA.branch)?.index; + lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${lineY + radius2} ${arc2} ${p1.x + offset} ${lineY} L ${p22.x - radius2} ${lineY} ${arc} ${p22.x} ${lineY - offset} L ${p22.x} ${p22.y}`; + } + } + } else { + arc = "A 20 20, 0, 0, 0,"; + arc2 = "A 20 20, 0, 0, 1,"; + radius2 = 20; + offset = 20; + if (dir === "TB") { + if (p1.x < p22.x) { + if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) { + lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y - radius2} ${arc} ${p1.x + offset} ${p22.y} L ${p22.x} ${p22.y}`; + } else { + lineDef = `M ${p1.x} ${p1.y} L ${p22.x - radius2} ${p1.y} ${arc2} ${p22.x} ${p1.y + offset} L ${p22.x} ${p22.y}`; + } + } + if (p1.x > p22.x) { + arc = "A 20 20, 0, 0, 0,"; + arc2 = "A 20 20, 0, 0, 1,"; + radius2 = 20; + offset = 20; + if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) { + lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y - radius2} ${arc2} ${p1.x - offset} ${p22.y} L ${p22.x} ${p22.y}`; + } else { + lineDef = `M ${p1.x} ${p1.y} L ${p22.x + radius2} ${p1.y} ${arc} ${p22.x} ${p1.y + offset} L ${p22.x} ${p22.y}`; + } + } + if (p1.x === p22.x) { + lineDef = `M ${p1.x} ${p1.y} L ${p22.x} ${p22.y}`; + } + } else if (dir === "BT") { + if (p1.x < p22.x) { + if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) { + lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y + radius2} ${arc2} ${p1.x + offset} ${p22.y} L ${p22.x} ${p22.y}`; + } else { + lineDef = `M ${p1.x} ${p1.y} L ${p22.x - radius2} ${p1.y} ${arc} ${p22.x} ${p1.y - offset} L ${p22.x} ${p22.y}`; + } + } + if (p1.x > p22.x) { + arc = "A 20 20, 0, 0, 0,"; + arc2 = "A 20 20, 0, 0, 1,"; + radius2 = 20; + offset = 20; + if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) { + lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y + radius2} ${arc} ${p1.x - offset} ${p22.y} L ${p22.x} ${p22.y}`; + } else { + lineDef = `M ${p1.x} ${p1.y} L ${p22.x + radius2} ${p1.y} ${arc2} ${p22.x} ${p1.y - offset} L ${p22.x} ${p22.y}`; + } + } + if (p1.x === p22.x) { + lineDef = `M ${p1.x} ${p1.y} L ${p22.x} ${p22.y}`; + } + } else { + if (p1.y < p22.y) { + if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) { + lineDef = `M ${p1.x} ${p1.y} L ${p22.x - radius2} ${p1.y} ${arc2} ${p22.x} ${p1.y + offset} L ${p22.x} ${p22.y}`; + } else { + lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y - radius2} ${arc} ${p1.x + offset} ${p22.y} L ${p22.x} ${p22.y}`; + } + } + if (p1.y > p22.y) { + if (commitB.type === commitType.MERGE && commitA.id !== commitB.parents[0]) { + lineDef = `M ${p1.x} ${p1.y} L ${p22.x - radius2} ${p1.y} ${arc} ${p22.x} ${p1.y - offset} L ${p22.x} ${p22.y}`; + } else { + lineDef = `M ${p1.x} ${p1.y} L ${p1.x} ${p22.y + radius2} ${arc2} ${p1.x + offset} ${p22.y} L ${p22.x} ${p22.y}`; + } + } + if (p1.y === p22.y) { + lineDef = `M ${p1.x} ${p1.y} L ${p22.x} ${p22.y}`; + } + } + } + if (lineDef === void 0) { + throw new Error("Line definition not found"); + } + svg2.append("path").attr("d", lineDef).attr( + "class", + "arrow arrow" + calcColorIndex(colorClassNum, THEME_COLOR_LIMIT, useColorTheme) + ); + }, "drawArrow"); + drawArrows = /* @__PURE__ */ __name((svg2, commits) => { + const gArrows = svg2.append("g").attr("class", "commit-arrows"); + [...commits.keys()].forEach((key) => { + const commit2 = commits.get(key); + if (commit2.parents && commit2.parents.length > 0) { + commit2.parents.forEach((parent4) => { + drawArrow(gArrows, commits.get(parent4), commit2, commits); + }); + } + }); + }, "drawArrows"); + drawBranches = /* @__PURE__ */ __name((svg2, branches, gitGraphConfig, id35) => { + const { look, theme, themeVariables } = getConfig2(); + const { dropShadow, THEME_COLOR_LIMIT: themeColorLimit } = themeVariables; + const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(theme ?? ""); + const useColorTheme = COLOR_THEMES3.has(theme ?? ""); + const g2 = svg2.append("g"); + branches.forEach((branch2, index) => { + const adjustIndexForTheme = calcColorIndex( + index, + useReduxGeometry ? themeColorLimit : THEME_COLOR_LIMIT, + useColorTheme + ); + const pos = branchPos.get(branch2.name)?.pos; + if (pos === void 0) { + throw new Error(`Position not found for branch ${branch2.name}`); + } + const spineY = dir === "TB" || dir === "BT" ? pos : useReduxGeometry ? pos + REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : pos - 2; + const line2 = g2.append("line"); + line2.attr("x1", 0); + line2.attr("y1", spineY); + line2.attr("x2", maxPos); + line2.attr("y2", spineY); + line2.attr("class", "branch branch" + adjustIndexForTheme); + if (dir === "TB") { + line2.attr("y1", defaultPos); + line2.attr("x1", pos); + line2.attr("y2", maxPos); + line2.attr("x2", pos); + } else if (dir === "BT") { + line2.attr("y1", maxPos); + line2.attr("x1", pos); + line2.attr("y2", defaultPos); + line2.attr("x2", pos); + } + lanes.push(spineY); + const name = branch2.name; + const labelElement = drawText2(name); + const bkg = g2.insert("rect"); + const branchLabel = g2.insert("g").attr("class", "branchLabel"); + const label = branchLabel.insert("g").attr("class", "label branch-label" + adjustIndexForTheme); + label.node().appendChild(labelElement); + const bbox = labelElement.getBBox(); + const borderRadius = useReduxGeometry ? 0 : 4; + const labelPaddingX = useReduxGeometry ? 16 : 0; + const labelPaddingY = useReduxGeometry ? REDUX_BRANCH_LABEL_PADDING_Y : 0; + if (look === "neo") { + bkg.attr("data-look", `neo`); + } + bkg.attr("class", "branchLabelBkg label" + adjustIndexForTheme).attr( + "style", + look === "neo" ? `filter:${useReduxGeometry ? `url(#${id35}-drop-shadow)` : dropShadow}` : "" + ).attr("rx", borderRadius).attr("ry", borderRadius).attr("x", -bbox.width - 4 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0)).attr("y", -bbox.height / 2 + 10).attr("width", bbox.width + 18 + labelPaddingX).attr("height", bbox.height + 4 + labelPaddingY); + label.attr( + "transform", + "translate(" + (-bbox.width - 14 - (gitGraphConfig.rotateCommitLabel === true ? 30 : 0) + labelPaddingX / 2) + ", " + (spineY - bbox.height / 2 - 2) + ")" + ); + if (dir === "TB") { + bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", 0); + label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", 0)"); + if (useReduxGeometry) { + bkg.attr("transform", `translate(${-labelPaddingX / 2 - 3}, ${-labelPaddingY - 10})`); + label.attr( + "transform", + "translate(" + (pos - bbox.width / 2 - 5) + ", " + (-labelPaddingY * 2 + 7) + ")" + ); + } + } else if (dir === "BT") { + bkg.attr("x", pos - bbox.width / 2 - 10).attr("y", maxPos); + label.attr("transform", "translate(" + (pos - bbox.width / 2 - 5) + ", " + maxPos + ")"); + if (useReduxGeometry) { + bkg.attr("transform", `translate(${-labelPaddingX / 2 - 3}, ${labelPaddingY + 10})`); + label.attr( + "transform", + "translate(" + (pos - bbox.width / 2 - 5) + ", " + (maxPos + labelPaddingY * 2 + 4) + ")" + ); + } + } else { + bkg.attr("transform", "translate(-19, " + (spineY - 12 - labelPaddingY / 2) + ")"); + } + }); + }, "drawBranches"); + setBranchPosition = /* @__PURE__ */ __name(function(name, pos, index, bbox, rotateCommitLabel) { + branchPos.set(name, { pos, index }); + pos += 50 + (rotateCommitLabel ? 40 : 0) + (dir === "TB" || dir === "BT" ? bbox.width / 2 : 0); + return pos; + }, "setBranchPosition"); + draw4 = /* @__PURE__ */ __name(function(txt, id35, ver, diagObj) { + clear8(); + log.debug("in gitgraph renderer", txt + "\n", "id:", id35, ver); + const db10 = diagObj.db; + if (!db10.getConfig) { + log.error("getConfig method is not available on db"); + return; + } + const gitGraphConfig = db10.getConfig(); + const rotateCommitLabel = gitGraphConfig.rotateCommitLabel ?? false; + allCommitsDict = db10.getCommits(); + const branches = db10.getBranchesAsObjArray(); + dir = db10.getDirection(); + const diagram32 = select_default2(`[id="${id35}"]`); + const { look, theme, themeVariables } = getConfig2(); + const { useGradient, gradientStart, gradientStop, filterColor } = themeVariables; + if (useGradient) { + const gradient = diagram32.append("defs").append("linearGradient").attr("id", id35 + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%"); + gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1); + gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1); + } + if (look === "neo" && REDUX_GEOMETRY_THEMES.has(theme ?? "")) { + diagram32.append("defs").append("filter").attr("id", id35 + "-drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", filterColor); + } + let pos = 0; + branches.forEach((branch2, index) => { + const labelElement = drawText2(branch2.name); + const g2 = diagram32.append("g"); + const branchLabel = g2.insert("g").attr("class", "branchLabel"); + const label = branchLabel.insert("g").attr("class", "label branch-label"); + label.node()?.appendChild(labelElement); + const bbox = labelElement.getBBox(); + pos = setBranchPosition(branch2.name, pos, index, bbox, rotateCommitLabel); + label.remove(); + branchLabel.remove(); + g2.remove(); + }); + drawCommits(diagram32, allCommitsDict, false, gitGraphConfig); + if (gitGraphConfig.showBranches) { + drawBranches(diagram32, branches, gitGraphConfig, id35); + } + drawArrows(diagram32, allCommitsDict); + drawCommits(diagram32, allCommitsDict, true, gitGraphConfig); + utils_default2.insertTitle( + diagram32, + "gitTitleText", + gitGraphConfig.titleTopMargin ?? 0, + db10.getDiagramTitle() + ); + setupGraphViewbox2(void 0, diagram32, gitGraphConfig.diagramPadding, gitGraphConfig.useMaxWidth); + }, "draw"); + gitGraphRenderer_default = { + draw: draw4 + }; + if (void 0) { + const { it, expect, describe } = void 0; + describe("drawText", () => { + it("should drawText", () => { + const svgLabel = drawText2("main"); + expect(svgLabel).toBeDefined(); + expect(svgLabel.children[0].innerHTML).toBe("main"); + }); + }); + describe("branchPosition", () => { + const bbox = { + x: 0, + y: 0, + width: 10, + height: 10, + top: 0, + right: 0, + bottom: 0, + left: 0, + toJSON: /* @__PURE__ */ __name(() => "", "toJSON") + }; + it("should setBranchPositions LR with two branches", () => { + dir = "LR"; + const pos = setBranchPosition("main", 0, 0, bbox, true); + expect(pos).toBe(90); + expect(branchPos.get("main")).toEqual({ pos: 0, index: 0 }); + const posNext = setBranchPosition("develop", pos, 1, bbox, true); + expect(posNext).toBe(180); + expect(branchPos.get("develop")).toEqual({ pos, index: 1 }); + }); + it("should setBranchPositions TB with two branches", () => { + dir = "TB"; + bbox.width = 34.9921875; + const pos = setBranchPosition("main", 0, 0, bbox, true); + expect(pos).toBe(107.49609375); + expect(branchPos.get("main")).toEqual({ pos: 0, index: 0 }); + bbox.width = 56.421875; + const posNext = setBranchPosition("develop", pos, 1, bbox, true); + expect(posNext).toBe(225.70703125); + expect(branchPos.get("develop")).toEqual({ pos, index: 1 }); + }); + }); + describe("commitPosition", () => { + const commits = /* @__PURE__ */ new Map([ + [ + "commitZero", + { + id: "ZERO", + message: "", + seq: 0, + type: commitType.NORMAL, + tags: [], + parents: [], + branch: "main" + } + ], + [ + "commitA", + { + id: "A", + message: "", + seq: 1, + type: commitType.NORMAL, + tags: [], + parents: ["ZERO"], + branch: "feature" + } + ], + [ + "commitB", + { + id: "B", + message: "", + seq: 2, + type: commitType.NORMAL, + tags: [], + parents: ["A"], + branch: "feature" + } + ], + [ + "commitM", + { + id: "M", + message: "merged branch feature into main", + seq: 3, + type: commitType.MERGE, + tags: [], + parents: ["ZERO", "B"], + branch: "main", + customId: true + } + ], + [ + "commitC", + { + id: "C", + message: "", + seq: 4, + type: commitType.NORMAL, + tags: [], + parents: ["ZERO"], + branch: "release" + } + ], + [ + "commit5_8928ea0", + { + id: "5-8928ea0", + message: "cherry-picked [object Object] into release", + seq: 5, + type: commitType.CHERRY_PICK, + tags: [], + parents: ["C", "M"], + branch: "release" + } + ], + [ + "commitD", + { + id: "D", + message: "", + seq: 6, + type: commitType.NORMAL, + tags: [], + parents: ["5-8928ea0"], + branch: "release" + } + ], + [ + "commit7_ed848ba", + { + id: "7-ed848ba", + message: "cherry-picked [object Object] into release", + seq: 7, + type: commitType.CHERRY_PICK, + tags: [], + parents: ["D", "M"], + branch: "release" + } + ] + ]); + let pos = 0; + branchPos.set("main", { pos: 0, index: 0 }); + branchPos.set("feature", { pos: 107.49609375, index: 1 }); + branchPos.set("release", { pos: 224.03515625, index: 2 }); + describe("TB", () => { + pos = 30; + dir = "TB"; + const expectedCommitPositionTB = /* @__PURE__ */ new Map([ + ["commitZero", { x: 0, y: 40, posWithOffset: 40 }], + ["commitA", { x: 107.49609375, y: 90, posWithOffset: 90 }], + ["commitB", { x: 107.49609375, y: 140, posWithOffset: 140 }], + ["commitM", { x: 0, y: 190, posWithOffset: 190 }], + ["commitC", { x: 224.03515625, y: 240, posWithOffset: 240 }], + ["commit5_8928ea0", { x: 224.03515625, y: 290, posWithOffset: 290 }], + ["commitD", { x: 224.03515625, y: 340, posWithOffset: 340 }], + ["commit7_ed848ba", { x: 224.03515625, y: 390, posWithOffset: 390 }] + ]); + commits.forEach((commit2, key) => { + it(`should give the correct position for commit ${key}`, () => { + const position5 = getCommitPosition(commit2, pos, false); + expect(position5).toEqual(expectedCommitPositionTB.get(key)); + pos += 50; + }); + }); + }); + describe("LR", () => { + let pos2 = 30; + dir = "LR"; + const expectedCommitPositionLR = /* @__PURE__ */ new Map([ + ["commitZero", { x: 0, y: 40, posWithOffset: 40 }], + ["commitA", { x: 107.49609375, y: 90, posWithOffset: 90 }], + ["commitB", { x: 107.49609375, y: 140, posWithOffset: 140 }], + ["commitM", { x: 0, y: 190, posWithOffset: 190 }], + ["commitC", { x: 224.03515625, y: 240, posWithOffset: 240 }], + ["commit5_8928ea0", { x: 224.03515625, y: 290, posWithOffset: 290 }], + ["commitD", { x: 224.03515625, y: 340, posWithOffset: 340 }], + ["commit7_ed848ba", { x: 224.03515625, y: 390, posWithOffset: 390 }] + ]); + commits.forEach((commit2, key) => { + it(`should give the correct position for commit ${key}`, () => { + const position5 = getCommitPosition(commit2, pos2, false); + expect(position5).toEqual(expectedCommitPositionLR.get(key)); + pos2 += 50; + }); + }); + }); + describe("getCommitClassType", () => { + const expectedCommitClassType = /* @__PURE__ */ new Map([ + ["commitZero", "commit-normal"], + ["commitA", "commit-normal"], + ["commitB", "commit-normal"], + ["commitM", "commit-merge"], + ["commitC", "commit-normal"], + ["commit5_8928ea0", "commit-cherry-pick"], + ["commitD", "commit-normal"], + ["commit7_ed848ba", "commit-cherry-pick"] + ]); + commits.forEach((commit2, key) => { + it(`should give the correct class type for commit ${key}`, () => { + const classType = getCommitClassType(commit2); + expect(classType).toBe(expectedCommitClassType.get(key)); + }); + }); + }); + }); + describe("building BT parallel commit diagram", () => { + const commits = /* @__PURE__ */ new Map([ + [ + "1-abcdefg", + { + id: "1-abcdefg", + message: "", + seq: 0, + type: 0, + tags: [], + parents: [], + branch: "main" + } + ], + [ + "2-abcdefg", + { + id: "2-abcdefg", + message: "", + seq: 1, + type: 0, + tags: [], + parents: ["1-abcdefg"], + branch: "main" + } + ], + [ + "3-abcdefg", + { + id: "3-abcdefg", + message: "", + seq: 2, + type: 0, + tags: [], + parents: ["2-abcdefg"], + branch: "develop" + } + ], + [ + "4-abcdefg", + { + id: "4-abcdefg", + message: "", + seq: 3, + type: 0, + tags: [], + parents: ["3-abcdefg"], + branch: "develop" + } + ], + [ + "5-abcdefg", + { + id: "5-abcdefg", + message: "", + seq: 4, + type: 0, + tags: [], + parents: ["2-abcdefg"], + branch: "feature" + } + ], + [ + "6-abcdefg", + { + id: "6-abcdefg", + message: "", + seq: 5, + type: 0, + tags: [], + parents: ["5-abcdefg"], + branch: "feature" + } + ], + [ + "7-abcdefg", + { + id: "7-abcdefg", + message: "", + seq: 6, + type: 0, + tags: [], + parents: ["2-abcdefg"], + branch: "main" + } + ], + [ + "8-abcdefg", + { + id: "8-abcdefg", + message: "", + seq: 7, + type: 0, + tags: [], + parents: ["7-abcdefg"], + branch: "main" + } + ] + ]); + const expectedCommitPosition = /* @__PURE__ */ new Map([ + ["1-abcdefg", { x: 0, y: 40 }], + ["2-abcdefg", { x: 0, y: 90 }], + ["3-abcdefg", { x: 107.49609375, y: 140 }], + ["4-abcdefg", { x: 107.49609375, y: 190 }], + ["5-abcdefg", { x: 225.70703125, y: 140 }], + ["6-abcdefg", { x: 225.70703125, y: 190 }], + ["7-abcdefg", { x: 0, y: 140 }], + ["8-abcdefg", { x: 0, y: 190 }] + ]); + const expectedCommitPositionAfterParallel = /* @__PURE__ */ new Map([ + ["1-abcdefg", { x: 0, y: 210 }], + ["2-abcdefg", { x: 0, y: 160 }], + ["3-abcdefg", { x: 107.49609375, y: 110 }], + ["4-abcdefg", { x: 107.49609375, y: 60 }], + ["5-abcdefg", { x: 225.70703125, y: 110 }], + ["6-abcdefg", { x: 225.70703125, y: 60 }], + ["7-abcdefg", { x: 0, y: 110 }], + ["8-abcdefg", { x: 0, y: 60 }] + ]); + const expectedCommitCurrentPosition = /* @__PURE__ */ new Map([ + ["1-abcdefg", 30], + ["2-abcdefg", 80], + ["3-abcdefg", 130], + ["4-abcdefg", 180], + ["5-abcdefg", 130], + ["6-abcdefg", 180], + ["7-abcdefg", 130], + ["8-abcdefg", 180] + ]); + const sortedKeys = [...expectedCommitPosition.keys()]; + it("should get the correct commit position and current position", () => { + dir = "BT"; + let curPos = 30; + commitPos.clear(); + branchPos.clear(); + branchPos.set("main", { pos: 0, index: 0 }); + branchPos.set("develop", { pos: 107.49609375, index: 1 }); + branchPos.set("feature", { pos: 225.70703125, index: 2 }); + commits.forEach((commit2, key) => { + if (commit2.parents.length > 0) { + curPos = calculateCommitPosition(commit2); + } + const position5 = setCommitPosition(commit2, curPos); + expect(position5).toEqual(expectedCommitPosition.get(key)); + expect(curPos).toEqual(expectedCommitCurrentPosition.get(key)); + }); + }); + it("should get the correct commit position after parallel commits", () => { + commitPos.clear(); + branchPos.clear(); + dir = "BT"; + const curPos = 30; + commitPos.clear(); + branchPos.clear(); + branchPos.set("main", { pos: 0, index: 0 }); + branchPos.set("develop", { pos: 107.49609375, index: 1 }); + branchPos.set("feature", { pos: 225.70703125, index: 2 }); + setParallelBTPos(sortedKeys, commits, curPos); + sortedKeys.forEach((commit2) => { + const position5 = commitPos.get(commit2); + expect(position5).toEqual(expectedCommitPositionAfterParallel.get(commit2)); + }); + }); + }); + it("add", () => { + commitPos.set("parent1", { x: 1, y: 1 }); + commitPos.set("parent2", { x: 2, y: 2 }); + commitPos.set("parent3", { x: 3, y: 3 }); + dir = "LR"; + const parents3 = ["parent1", "parent2", "parent3"]; + const closestParent = findClosestParent(parents3); + expect(closestParent).toBe("parent3"); + commitPos.clear(); + }); + } + } + }); + + // src/diagrams/git/styles.js + var GIT_NAMED_COLOR_COUNT, REDUX_GEOMETRY_THEMES2, COLOR_THEMES4, NEO_THEMES, DARK_THEMES2, NEO_COLOR_GEN_THEMES, genGitGraphGradient, genColor2, normalTheme, getStyles5, styles_default5; + var init_styles5 = __esm({ + "src/diagrams/git/styles.js"() { + "use strict"; + init_config(); + GIT_NAMED_COLOR_COUNT = 8; + REDUX_GEOMETRY_THEMES2 = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]); + COLOR_THEMES4 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]); + NEO_THEMES = /* @__PURE__ */ new Set(["neo", "neo-dark"]); + DARK_THEMES2 = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]); + NEO_COLOR_GEN_THEMES = /* @__PURE__ */ new Set([ + "redux", + "redux-dark", + "redux-color", + "redux-dark-color", + "neo", + "neo-dark" + ]); + genGitGraphGradient = /* @__PURE__ */ __name((options2) => { + const { svgId } = options2; + let sections6 = ""; + if (options2.useGradient && svgId) { + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + sections6 += ` + .label${i2} { fill: ${options2.mainBkg}; stroke: url(${svgId}-gradient); stroke-width: ${options2.strokeWidth};} + `; + } + } + return sections6; + }, "genGitGraphGradient"); + genColor2 = /* @__PURE__ */ __name((options2) => { + const config5 = getConfig(); + const { theme, themeVariables } = config5; + const { borderColorArray } = themeVariables; + const useReduxGeometry = REDUX_GEOMETRY_THEMES2.has(theme); + if (NEO_THEMES.has(theme)) { + let sections6 = ""; + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + if (i2 === 0) { + sections6 += ` + .branch-label${i2} { fill: ${options2.nodeBorder};} + .commit${i2} { stroke: ${options2.nodeBorder}; } + .commit-highlight${i2} { stroke: ${options2.nodeBorder}; fill: ${options2.nodeBorder}; } + .arrow${i2} { stroke: ${options2.nodeBorder}; } + .commit-bullets { fill: ${options2.nodeBorder}; } + .commit-cherry-pick${i2} { stroke: ${options2.nodeBorder}; } + ${genGitGraphGradient(options2)}`; + } else { + const ci = i2 % GIT_NAMED_COLOR_COUNT; + sections6 += ` + .branch-label${i2} { fill: ${options2["gitBranchLabel" + ci]}; } + .commit${i2} { stroke: ${options2["git" + ci]}; fill: ${options2["git" + ci]}; } + .commit-highlight${i2} { stroke: ${options2["gitInv" + ci]}; fill: ${options2["gitInv" + ci]}; } + .arrow${i2} { stroke: ${options2["git" + ci]}; } + `; + } + } + return sections6; + } else if (!COLOR_THEMES4.has(theme)) { + let sections6 = ""; + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + sections6 += ` + .branch-label${i2} { fill: ${options2.nodeBorder}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""} } + .commit${i2} { stroke: ${options2.nodeBorder}; } + .commit-highlight${i2} { stroke: ${options2.nodeBorder}; fill: ${options2.nodeBorder}; } + .label${i2} { fill: ${options2.mainBkg}; stroke: ${options2.nodeBorder}; stroke-width: ${options2.strokeWidth}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""}} + .arrow${i2} { stroke: ${options2.nodeBorder}; } + .commit-bullets { fill: ${options2.nodeBorder}; } + .commit-cherry-pick${i2} { stroke: ${options2.nodeBorder}; } + `; + } + return sections6; + } else { + let sections6 = ""; + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + if (i2 === 0) { + sections6 += ` + .branch-label${i2} { fill: ${options2.nodeBorder}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""} } + .commit${i2} { stroke: ${options2.nodeBorder}; } + .commit-highlight${i2} { stroke: ${options2.nodeBorder}; fill: ${options2.mainBkg}; } + .label${i2} { fill: ${options2.mainBkg}; stroke: ${options2.nodeBorder}; stroke-width: ${options2.strokeWidth}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""} } + .arrow${i2} { stroke: ${options2.nodeBorder}; } + .commit-bullets { fill: ${options2.nodeBorder}; } + `; + } else { + const colorIndex = i2 % borderColorArray.length; + sections6 += ` + .branch-label${i2} { fill: ${options2.nodeBorder}; ${useReduxGeometry ? `font-weight:${options2.noteFontWeight}` : ""} } + .commit${i2} { stroke: ${borderColorArray[colorIndex]}; fill: ${borderColorArray[colorIndex]}; } + .commit-highlight${i2} { stroke: ${borderColorArray[colorIndex]}; fill: ${borderColorArray[colorIndex]}; } + .label${i2} { fill: ${DARK_THEMES2.has(theme) ? options2.mainBkg : borderColorArray[colorIndex]}; stroke: ${borderColorArray[colorIndex]}; stroke-width: ${options2.strokeWidth}; } + .arrow${i2} { stroke: ${borderColorArray[colorIndex]}; } + `; + } + } + return sections6; + } + }, "genColor"); + normalTheme = /* @__PURE__ */ __name((options2) => { + return `${Array.from({ length: options2.THEME_COLOR_LIMIT }, (_3, i2) => i2).map((i2) => { + const ci = i2 % GIT_NAMED_COLOR_COUNT; + return ` + .branch-label${i2} { fill: ${options2["gitBranchLabel" + ci]}; } + .commit${i2} { stroke: ${options2["git" + ci]}; fill: ${options2["git" + ci]}; } + .commit-highlight${i2} { stroke: ${options2["gitInv" + ci]}; fill: ${options2["gitInv" + ci]}; } + .label${i2} { fill: ${options2["git" + ci]}; } + .arrow${i2} { stroke: ${options2["git" + ci]}; } + `; + }).join("\n")}`; + }, "normalTheme"); + getStyles5 = /* @__PURE__ */ __name((options2) => { + const config5 = getConfig(); + const { theme } = config5; + const useNeoColorGen = NEO_COLOR_GEN_THEMES.has(theme); + return ` + .commit-id, + .commit-msg, + .branch-label { + fill: lightgrey; + color: lightgrey; + font-family: 'trebuchet ms', verdana, arial, sans-serif; + font-family: var(--mermaid-font-family); + } + + ${useNeoColorGen ? genColor2(options2) : normalTheme(options2)} + + .branch { + stroke-width: ${options2.strokeWidth}; + stroke: ${options2.commitLineColor ?? options2.lineColor}; + stroke-dasharray: ${useNeoColorGen ? "4 2" : "2"}; + } + .commit-label { font-size: ${options2.commitLabelFontSize}; fill: ${useNeoColorGen ? options2.nodeBorder : options2.commitLabelColor}; ${useNeoColorGen ? `font-weight:${options2.noteFontWeight};` : ""}} + .commit-label-bkg { font-size: ${options2.commitLabelFontSize}; fill: ${useNeoColorGen ? "transparent" : options2.commitLabelBackground}; opacity: ${useNeoColorGen ? "" : 0.5}; } + .tag-label { font-size: ${options2.tagLabelFontSize}; fill: ${options2.tagLabelColor};} + .tag-label-bkg { fill: ${useNeoColorGen ? options2.mainBkg : options2.tagLabelBackground}; stroke: ${useNeoColorGen ? options2.nodeBorder : options2.tagLabelBorder}; ${useNeoColorGen ? `filter:${options2.dropShadow}` : ""} } + .tag-hole { fill: ${options2.textColor}; } + + .commit-merge { + stroke: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor}; + fill: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor}; + } + .commit-reverse { + stroke: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor}; + fill: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor}; + stroke-width: ${useNeoColorGen ? options2.strokeWidth : 3}; + } + .commit-highlight-outer { + } + .commit-highlight-inner { + stroke: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor}; + fill: ${useNeoColorGen ? options2.mainBkg : options2.primaryColor}; + } + + .arrow { + /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */ + stroke-width: ${REDUX_GEOMETRY_THEMES2.has(theme) ? options2.strokeWidth : 8}; + stroke-linecap: round; + fill: none + } + .gitTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${options2.textColor}; + } +`; + }, "getStyles"); + styles_default5 = getStyles5; + } + }); + + // src/diagrams/git/gitGraphDiagram.ts + var gitGraphDiagram_exports = {}; + __export(gitGraphDiagram_exports, { + diagram: () => diagram4 + }); + var diagram4; + var init_gitGraphDiagram = __esm({ + "src/diagrams/git/gitGraphDiagram.ts"() { + "use strict"; + init_gitGraphParser(); + init_gitGraphAst(); + init_gitGraphRenderer(); + init_styles5(); + diagram4 = { + parser: parser4, + db, + renderer: gitGraphRenderer_default, + styles: styles_default5 + }; + } + }); + + // src/diagrams/gantt/parser/gantt.jison + var parser5, gantt_default; + var init_gantt = __esm({ + "src/diagrams/gantt/parser/gantt.jison"() { + "use strict"; + parser5 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 36, 38, 40], $V1 = [1, 26], $V2 = [1, 27], $V3 = [1, 28], $V4 = [1, 29], $V5 = [1, 30], $V6 = [1, 31], $V7 = [1, 32], $V8 = [1, 33], $V9 = [1, 34], $Va = [1, 9], $Vb = [1, 10], $Vc = [1, 11], $Vd = [1, 12], $Ve = [1, 13], $Vf = [1, 14], $Vg = [1, 15], $Vh = [1, 16], $Vi = [1, 19], $Vj = [1, 20], $Vk = [1, 21], $Vl = [1, 22], $Vm = [1, 23], $Vn = [1, 25], $Vo = [1, 35]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "gantt": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NL": 10, "weekday": 11, "weekday_monday": 12, "weekday_tuesday": 13, "weekday_wednesday": 14, "weekday_thursday": 15, "weekday_friday": 16, "weekday_saturday": 17, "weekday_sunday": 18, "weekend": 19, "weekend_friday": 20, "weekend_saturday": 21, "dateFormat": 22, "inclusiveEndDates": 23, "topAxis": 24, "axisFormat": 25, "tickInterval": 26, "excludes": 27, "includes": 28, "todayMarker": 29, "title": 30, "acc_title": 31, "acc_title_value": 32, "acc_descr": 33, "acc_descr_value": 34, "acc_descr_multiline_value": 35, "section": 36, "clickStatement": 37, "taskTxt": 38, "taskData": 39, "click": 40, "callbackname": 41, "callbackargs": 42, "href": 43, "clickStatementDebug": 44, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "gantt", 6: "EOF", 8: "SPACE", 10: "NL", 12: "weekday_monday", 13: "weekday_tuesday", 14: "weekday_wednesday", 15: "weekday_thursday", 16: "weekday_friday", 17: "weekday_saturday", 18: "weekday_sunday", 20: "weekend_friday", 21: "weekend_saturday", 22: "dateFormat", 23: "inclusiveEndDates", 24: "topAxis", 25: "axisFormat", 26: "tickInterval", 27: "excludes", 28: "includes", 29: "todayMarker", 30: "title", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 36: "section", 38: "taskTxt", 39: "taskData", 40: "click", 41: "callbackname", 42: "callbackargs", 43: "href" }, + productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [19, 1], [19, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 2], [37, 2], [37, 3], [37, 3], [37, 4], [37, 3], [37, 4], [37, 2], [44, 2], [44, 3], [44, 3], [44, 4], [44, 3], [44, 4], [44, 2]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 2: + this.$ = []; + break; + case 3: + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + break; + case 4: + case 5: + this.$ = $$[$0]; + break; + case 6: + case 7: + this.$ = []; + break; + case 8: + yy.setWeekday("monday"); + break; + case 9: + yy.setWeekday("tuesday"); + break; + case 10: + yy.setWeekday("wednesday"); + break; + case 11: + yy.setWeekday("thursday"); + break; + case 12: + yy.setWeekday("friday"); + break; + case 13: + yy.setWeekday("saturday"); + break; + case 14: + yy.setWeekday("sunday"); + break; + case 15: + yy.setWeekend("friday"); + break; + case 16: + yy.setWeekend("saturday"); + break; + case 17: + yy.setDateFormat($$[$0].substr(11)); + this.$ = $$[$0].substr(11); + break; + case 18: + yy.enableInclusiveEndDates(); + this.$ = $$[$0].substr(18); + break; + case 19: + yy.TopAxis(); + this.$ = $$[$0].substr(8); + break; + case 20: + yy.setAxisFormat($$[$0].substr(11)); + this.$ = $$[$0].substr(11); + break; + case 21: + yy.setTickInterval($$[$0].substr(13)); + this.$ = $$[$0].substr(13); + break; + case 22: + yy.setExcludes($$[$0].substr(9)); + this.$ = $$[$0].substr(9); + break; + case 23: + yy.setIncludes($$[$0].substr(9)); + this.$ = $$[$0].substr(9); + break; + case 24: + yy.setTodayMarker($$[$0].substr(12)); + this.$ = $$[$0].substr(12); + break; + case 27: + yy.setDiagramTitle($$[$0].substr(6)); + this.$ = $$[$0].substr(6); + break; + case 28: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 29: + case 30: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 31: + yy.addSection($$[$0].substr(8)); + this.$ = $$[$0].substr(8); + break; + case 33: + yy.addTask($$[$0 - 1], $$[$0]); + this.$ = "task"; + break; + case 34: + this.$ = $$[$0 - 1]; + yy.setClickEvent($$[$0 - 1], $$[$0], null); + break; + case 35: + this.$ = $$[$0 - 2]; + yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 36: + this.$ = $$[$0 - 2]; + yy.setClickEvent($$[$0 - 2], $$[$0 - 1], null); + yy.setLink($$[$0 - 2], $$[$0]); + break; + case 37: + this.$ = $$[$0 - 3]; + yy.setClickEvent($$[$0 - 3], $$[$0 - 2], $$[$0 - 1]); + yy.setLink($$[$0 - 3], $$[$0]); + break; + case 38: + this.$ = $$[$0 - 2]; + yy.setClickEvent($$[$0 - 2], $$[$0], null); + yy.setLink($$[$0 - 2], $$[$0 - 1]); + break; + case 39: + this.$ = $$[$0 - 3]; + yy.setClickEvent($$[$0 - 3], $$[$0 - 1], $$[$0]); + yy.setLink($$[$0 - 3], $$[$0 - 2]); + break; + case 40: + this.$ = $$[$0 - 1]; + yy.setLink($$[$0 - 1], $$[$0]); + break; + case 41: + case 47: + this.$ = $$[$0 - 1] + " " + $$[$0]; + break; + case 42: + case 43: + case 45: + this.$ = $$[$0 - 2] + " " + $$[$0 - 1] + " " + $$[$0]; + break; + case 44: + case 46: + this.$ = $$[$0 - 3] + " " + $$[$0 - 2] + " " + $$[$0 - 1] + " " + $$[$0]; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o2($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 17, 12: $V1, 13: $V2, 14: $V3, 15: $V4, 16: $V5, 17: $V6, 18: $V7, 19: 18, 20: $V8, 21: $V9, 22: $Va, 23: $Vb, 24: $Vc, 25: $Vd, 26: $Ve, 27: $Vf, 28: $Vg, 29: $Vh, 30: $Vi, 31: $Vj, 33: $Vk, 35: $Vl, 36: $Vm, 37: 24, 38: $Vn, 40: $Vo }, o2($V0, [2, 7], { 1: [2, 1] }), o2($V0, [2, 3]), { 9: 36, 11: 17, 12: $V1, 13: $V2, 14: $V3, 15: $V4, 16: $V5, 17: $V6, 18: $V7, 19: 18, 20: $V8, 21: $V9, 22: $Va, 23: $Vb, 24: $Vc, 25: $Vd, 26: $Ve, 27: $Vf, 28: $Vg, 29: $Vh, 30: $Vi, 31: $Vj, 33: $Vk, 35: $Vl, 36: $Vm, 37: 24, 38: $Vn, 40: $Vo }, o2($V0, [2, 5]), o2($V0, [2, 6]), o2($V0, [2, 17]), o2($V0, [2, 18]), o2($V0, [2, 19]), o2($V0, [2, 20]), o2($V0, [2, 21]), o2($V0, [2, 22]), o2($V0, [2, 23]), o2($V0, [2, 24]), o2($V0, [2, 25]), o2($V0, [2, 26]), o2($V0, [2, 27]), { 32: [1, 37] }, { 34: [1, 38] }, o2($V0, [2, 30]), o2($V0, [2, 31]), o2($V0, [2, 32]), { 39: [1, 39] }, o2($V0, [2, 8]), o2($V0, [2, 9]), o2($V0, [2, 10]), o2($V0, [2, 11]), o2($V0, [2, 12]), o2($V0, [2, 13]), o2($V0, [2, 14]), o2($V0, [2, 15]), o2($V0, [2, 16]), { 41: [1, 40], 43: [1, 41] }, o2($V0, [2, 4]), o2($V0, [2, 28]), o2($V0, [2, 29]), o2($V0, [2, 33]), o2($V0, [2, 34], { 42: [1, 42], 43: [1, 43] }), o2($V0, [2, 40], { 41: [1, 44] }), o2($V0, [2, 35], { 43: [1, 45] }), o2($V0, [2, 36]), o2($V0, [2, 38], { 42: [1, 46] }), o2($V0, [2, 37]), o2($V0, [2, 39])], + defaultActions: {}, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + this.begin("open_directive"); + return "open_directive"; + break; + case 1: + this.begin("acc_title"); + return 31; + break; + case 2: + this.popState(); + return "acc_title_value"; + break; + case 3: + this.begin("acc_descr"); + return 33; + break; + case 4: + this.popState(); + return "acc_descr_value"; + break; + case 5: + this.begin("acc_descr_multiline"); + break; + case 6: + this.popState(); + break; + case 7: + return "acc_descr_multiline_value"; + break; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + return 10; + break; + case 12: + break; + case 13: + break; + case 14: + this.begin("href"); + break; + case 15: + this.popState(); + break; + case 16: + return 43; + break; + case 17: + this.begin("callbackname"); + break; + case 18: + this.popState(); + break; + case 19: + this.popState(); + this.begin("callbackargs"); + break; + case 20: + return 41; + break; + case 21: + this.popState(); + break; + case 22: + return 42; + break; + case 23: + this.begin("click"); + break; + case 24: + this.popState(); + break; + case 25: + return 40; + break; + case 26: + return 4; + break; + case 27: + return 22; + break; + case 28: + return 23; + break; + case 29: + return 24; + break; + case 30: + return 25; + break; + case 31: + return 26; + break; + case 32: + return 28; + break; + case 33: + return 27; + break; + case 34: + return 29; + break; + case 35: + return 12; + break; + case 36: + return 13; + break; + case 37: + return 14; + break; + case 38: + return 15; + break; + case 39: + return 16; + break; + case 40: + return 17; + break; + case 41: + return 18; + break; + case 42: + return 20; + break; + case 43: + return 21; + break; + case 44: + return "date"; + break; + case 45: + return 30; + break; + case 46: + return "accDescription"; + break; + case 47: + return 36; + break; + case 48: + return 38; + break; + case 49: + return 39; + break; + case 50: + return ":"; + break; + case 51: + return 6; + break; + case 52: + return "INVALID"; + break; + } + }, "anonymous"), + rules: [/^(?:%%\{)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:%%(?!\{)*[^\n]*)/i, /^(?:[^\}]%%*[^\n]*)/i, /^(?:%%*[^\n]*[\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:%[^\n]*)/i, /^(?:href[\s]+["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:call[\s]+)/i, /^(?:\([\s]*\))/i, /^(?:\()/i, /^(?:[^(]*)/i, /^(?:\))/i, /^(?:[^)]*)/i, /^(?:click[\s]+)/i, /^(?:[\s\n])/i, /^(?:[^\s\n]*)/i, /^(?:gantt\b)/i, /^(?:dateFormat\s[^#\n;]+)/i, /^(?:inclusiveEndDates\b)/i, /^(?:topAxis\b)/i, /^(?:axisFormat\s[^#\n;]+)/i, /^(?:tickInterval\s[^#\n;]+)/i, /^(?:includes\s[^#\n;]+)/i, /^(?:excludes\s[^#\n;]+)/i, /^(?:todayMarker\s[^\n;]+)/i, /^(?:weekday\s+monday\b)/i, /^(?:weekday\s+tuesday\b)/i, /^(?:weekday\s+wednesday\b)/i, /^(?:weekday\s+thursday\b)/i, /^(?:weekday\s+friday\b)/i, /^(?:weekday\s+saturday\b)/i, /^(?:weekday\s+sunday\b)/i, /^(?:weekend\s+friday\b)/i, /^(?:weekend\s+saturday\b)/i, /^(?:\d\d\d\d-\d\d-\d\d\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accDescription\s[^#\n;]+)/i, /^(?:section\s[^\n]+)/i, /^(?:[^:\n]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i], + conditions: { "acc_descr_multiline": { "rules": [6, 7], "inclusive": false }, "acc_descr": { "rules": [4], "inclusive": false }, "acc_title": { "rules": [2], "inclusive": false }, "callbackargs": { "rules": [21, 22], "inclusive": false }, "callbackname": { "rules": [18, 19, 20], "inclusive": false }, "href": { "rules": [15, 16], "inclusive": false }, "click": { "rules": [24, 25], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 17, 23, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser5.parser = parser5; + gantt_default = parser5; + } + }); + + // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isoWeek.js + var require_isoWeek = __commonJS({ + "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isoWeek.js"(exports2, module2) { + "use strict"; + !(function(e3, t4) { + "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = t4() : "function" == typeof define && define.amd ? define(t4) : (e3 = "undefined" != typeof globalThis ? globalThis : e3 || self).dayjs_plugin_isoWeek = t4(); + })(exports2, (function() { + "use strict"; + var e3 = "day"; + return function(t4, i2, s2) { + var a2 = /* @__PURE__ */ __name(function(t5) { + return t5.add(4 - t5.isoWeekday(), e3); + }, "a"), d3 = i2.prototype; + d3.isoWeekYear = function() { + return a2(this).year(); + }, d3.isoWeek = function(t5) { + if (!this.$utils().u(t5)) return this.add(7 * (t5 - this.isoWeek()), e3); + var i3, d4, n3, o2, r2 = a2(this), u2 = (i3 = this.isoWeekYear(), d4 = this.$u, n3 = (d4 ? s2.utc : s2)().year(i3).startOf("year"), o2 = 4 - n3.isoWeekday(), n3.isoWeekday() > 4 && (o2 += 7), n3.add(o2, e3)); + return r2.diff(u2, "week") + 1; + }, d3.isoWeekday = function(e4) { + return this.$utils().u(e4) ? this.day() || 7 : this.day(this.day() % 7 ? e4 : e4 - 7); + }; + var n2 = d3.startOf; + d3.startOf = function(e4, t5) { + var i3 = this.$utils(), s3 = !!i3.u(t5) || t5; + return "isoweek" === i3.p(e4) ? s3 ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : n2.bind(this)(e4, t5); + }; + }; + })); + } + }); + + // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/customParseFormat.js + var require_customParseFormat = __commonJS({ + "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/customParseFormat.js"(exports2, module2) { + "use strict"; + !(function(e3, t4) { + "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = t4() : "function" == typeof define && define.amd ? define(t4) : (e3 = "undefined" != typeof globalThis ? globalThis : e3 || self).dayjs_plugin_customParseFormat = t4(); + })(exports2, (function() { + "use strict"; + var e3 = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t4 = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n2 = /\d/, r2 = /\d\d/, i2 = /\d\d?/, o2 = /\d*[^-_:/,()\s\d]+/, s2 = {}, a2 = /* @__PURE__ */ __name(function(e4) { + return (e4 = +e4) + (e4 > 68 ? 1900 : 2e3); + }, "a"); + var f2 = /* @__PURE__ */ __name(function(e4) { + return function(t5) { + this[e4] = +t5; + }; + }, "f"), h3 = [/[+-]\d\d:?(\d\d)?|Z/, function(e4) { + (this.zone || (this.zone = {})).offset = (function(e6) { + if (!e6) return 0; + if ("Z" === e6) return 0; + var t5 = e6.match(/([+-]|\d\d)/g), n3 = 60 * t5[1] + (+t5[2] || 0); + return 0 === n3 ? 0 : "+" === t5[0] ? -n3 : n3; + })(e4); + }], u2 = /* @__PURE__ */ __name(function(e4) { + var t5 = s2[e4]; + return t5 && (t5.indexOf ? t5 : t5.s.concat(t5.f)); + }, "u"), d3 = /* @__PURE__ */ __name(function(e4, t5) { + var n3, r3 = s2.meridiem; + if (r3) { + for (var i3 = 1; i3 <= 24; i3 += 1) if (e4.indexOf(r3(i3, 0, t5)) > -1) { + n3 = i3 > 12; + break; + } + } else n3 = e4 === (t5 ? "pm" : "PM"); + return n3; + }, "d"), c3 = { A: [o2, function(e4) { + this.afternoon = d3(e4, false); + }], a: [o2, function(e4) { + this.afternoon = d3(e4, true); + }], Q: [n2, function(e4) { + this.month = 3 * (e4 - 1) + 1; + }], S: [n2, function(e4) { + this.milliseconds = 100 * +e4; + }], SS: [r2, function(e4) { + this.milliseconds = 10 * +e4; + }], SSS: [/\d{3}/, function(e4) { + this.milliseconds = +e4; + }], s: [i2, f2("seconds")], ss: [i2, f2("seconds")], m: [i2, f2("minutes")], mm: [i2, f2("minutes")], H: [i2, f2("hours")], h: [i2, f2("hours")], HH: [i2, f2("hours")], hh: [i2, f2("hours")], D: [i2, f2("day")], DD: [r2, f2("day")], Do: [o2, function(e4) { + var t5 = s2.ordinal, n3 = e4.match(/\d+/); + if (this.day = n3[0], t5) for (var r3 = 1; r3 <= 31; r3 += 1) t5(r3).replace(/\[|\]/g, "") === e4 && (this.day = r3); + }], w: [i2, f2("week")], ww: [r2, f2("week")], M: [i2, f2("month")], MM: [r2, f2("month")], MMM: [o2, function(e4) { + var t5 = u2("months"), n3 = (u2("monthsShort") || t5.map((function(e6) { + return e6.slice(0, 3); + }))).indexOf(e4) + 1; + if (n3 < 1) throw new Error(); + this.month = n3 % 12 || n3; + }], MMMM: [o2, function(e4) { + var t5 = u2("months").indexOf(e4) + 1; + if (t5 < 1) throw new Error(); + this.month = t5 % 12 || t5; + }], Y: [/[+-]?\d+/, f2("year")], YY: [r2, function(e4) { + this.year = a2(e4); + }], YYYY: [/\d{4}/, f2("year")], Z: h3, ZZ: h3 }; + function l4(n3) { + var r3, i3; + r3 = n3, i3 = s2 && s2.formats; + for (var o3 = (n3 = r3.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t5, n4, r4) { + var o4 = r4 && r4.toUpperCase(); + return n4 || i3[r4] || e3[r4] || i3[o4].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e4, t6, n5) { + return t6 || n5.slice(1); + })); + }))).match(t4), a3 = o3.length, f3 = 0; f3 < a3; f3 += 1) { + var h4 = o3[f3], u3 = c3[h4], d4 = u3 && u3[0], l5 = u3 && u3[1]; + o3[f3] = l5 ? { regex: d4, parser: l5 } : h4.replace(/^\[|\]$/g, ""); + } + return function(e4) { + for (var t5 = {}, n4 = 0, r4 = 0; n4 < a3; n4 += 1) { + var i4 = o3[n4]; + if ("string" == typeof i4) r4 += i4.length; + else { + var s3 = i4.regex, f4 = i4.parser, h5 = e4.slice(r4), u4 = s3.exec(h5)[0]; + f4.call(t5, u4), e4 = e4.replace(u4, ""); + } + } + return (function(e6) { + var t6 = e6.afternoon; + if (void 0 !== t6) { + var n5 = e6.hours; + t6 ? n5 < 12 && (e6.hours += 12) : 12 === n5 && (e6.hours = 0), delete e6.afternoon; + } + })(t5), t5; + }; + } + __name(l4, "l"); + return function(e4, t5, n3) { + n3.p.customParseFormat = true, e4 && e4.parseTwoDigitYear && (a2 = e4.parseTwoDigitYear); + var r3 = t5.prototype, i3 = r3.parse; + r3.parse = function(e6) { + var t6 = e6.date, r4 = e6.utc, o3 = e6.args; + this.$u = r4; + var a3 = o3[1]; + if ("string" == typeof a3) { + var f3 = true === o3[2], h4 = true === o3[3], u3 = f3 || h4, d4 = o3[2]; + h4 && (d4 = o3[2]), s2 = this.$locale(), !f3 && d4 && (s2 = n3.Ls[d4]), this.$d = (function(e7, t7, n4, r5) { + try { + if (["x", "X"].indexOf(t7) > -1) return new Date(("X" === t7 ? 1e3 : 1) * e7); + var i4 = l4(t7)(e7), o4 = i4.year, s3 = i4.month, a4 = i4.day, f4 = i4.hours, h5 = i4.minutes, u4 = i4.seconds, d5 = i4.milliseconds, c5 = i4.zone, m4 = i4.week, M4 = /* @__PURE__ */ new Date(), Y3 = a4 || (o4 || s3 ? 1 : M4.getDate()), p3 = o4 || M4.getFullYear(), v3 = 0; + o4 && !s3 || (v3 = s3 > 0 ? s3 - 1 : M4.getMonth()); + var D4, w4 = f4 || 0, g2 = h5 || 0, y6 = u4 || 0, L3 = d5 || 0; + return c5 ? new Date(Date.UTC(p3, v3, Y3, w4, g2, y6, L3 + 60 * c5.offset * 1e3)) : n4 ? new Date(Date.UTC(p3, v3, Y3, w4, g2, y6, L3)) : (D4 = new Date(p3, v3, Y3, w4, g2, y6, L3), m4 && (D4 = r5(D4).week(m4).toDate()), D4); + } catch (e8) { + return /* @__PURE__ */ new Date(""); + } + })(t6, a3, r4, n3), this.init(), d4 && true !== d4 && (this.$L = this.locale(d4).$L), u3 && t6 != this.format(a3) && (this.$d = /* @__PURE__ */ new Date("")), s2 = {}; + } else if (a3 instanceof Array) for (var c4 = a3.length, m3 = 1; m3 <= c4; m3 += 1) { + o3[1] = a3[m3 - 1]; + var M3 = n3.apply(this, o3); + if (M3.isValid()) { + this.$d = M3.$d, this.$L = M3.$L, this.init(); + break; + } + m3 === c4 && (this.$d = /* @__PURE__ */ new Date("")); + } + else i3.call(this, e6); + }; + }; + })); + } + }); + + // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/advancedFormat.js + var require_advancedFormat = __commonJS({ + "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/advancedFormat.js"(exports2, module2) { + "use strict"; + !(function(e3, t4) { + "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = t4() : "function" == typeof define && define.amd ? define(t4) : (e3 = "undefined" != typeof globalThis ? globalThis : e3 || self).dayjs_plugin_advancedFormat = t4(); + })(exports2, (function() { + "use strict"; + return function(e3, t4) { + var r2 = t4.prototype, n2 = r2.format; + r2.format = function(e4) { + var t5 = this, r3 = this.$locale(); + if (!this.isValid()) return n2.bind(this)(e4); + var s2 = this.$utils(), a2 = (e4 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, (function(e6) { + switch (e6) { + case "Q": + return Math.ceil((t5.$M + 1) / 3); + case "Do": + return r3.ordinal(t5.$D); + case "gggg": + return t5.weekYear(); + case "GGGG": + return t5.isoWeekYear(); + case "wo": + return r3.ordinal(t5.week(), "W"); + case "w": + case "ww": + return s2.s(t5.week(), "w" === e6 ? 1 : 2, "0"); + case "W": + case "WW": + return s2.s(t5.isoWeek(), "W" === e6 ? 1 : 2, "0"); + case "k": + case "kk": + return s2.s(String(0 === t5.$H ? 24 : t5.$H), "k" === e6 ? 1 : 2, "0"); + case "X": + return Math.floor(t5.$d.getTime() / 1e3); + case "x": + return t5.$d.getTime(); + case "z": + return "[" + t5.offsetName() + "]"; + case "zzz": + return "[" + t5.offsetName("long") + "]"; + default: + return e6; + } + })); + return n2.bind(this)(a2); + }; + }; + })); + } + }); + + // src/diagrams/gantt/ganttDb.js + function getTaskTags(data5, task, tags2) { + let matchFound = true; + while (matchFound) { + matchFound = false; + tags2.forEach(function(t4) { + const pattern = "^\\s*" + t4 + "\\s*$"; + const regex2 = new RegExp(pattern); + if (data5[0].match(regex2)) { + task[t4] = true; + data5.shift(1); + matchFound = true; + } + }); + } + } + var import_sanitize_url4, import_dayjs2, import_isoWeek, import_customParseFormat, import_advancedFormat, WEEKEND_START_DAY, dateFormat, axisFormat, tickInterval, todayMarker, includes2, excludes, links, sections, tasks, currentSection, displayMode, tags, funs, diagramId, inclusiveEndDates, topAxis, weekday, weekend, lastOrder, clear9, setDiagramId, setAxisFormat, getAxisFormat, setTickInterval, getTickInterval, setTodayMarker, getTodayMarker, setDateFormat, enableInclusiveEndDates, endDatesAreInclusive, enableTopAxis, topAxisEnabled, setDisplayMode, getDisplayMode, getDateFormat, setIncludes, getIncludes, setExcludes, getExcludes, getLinks, addSection, getSections, getTasks, isInvalidDate, setWeekday, getWeekday, setWeekend, checkTaskDates, fixTaskDates, getStartDate, parseDuration, getEndDate, taskCnt, parseId, compileData, parseData, lastTask, lastTaskID, rawTasks, taskDb, addTask, findTaskById, addTaskOrg, compileTasks, setLink, setClass, setClickFun, pushFun, setClickEvent, bindFunctions, ganttDb_default; + var init_ganttDb = __esm({ + "src/diagrams/gantt/ganttDb.js"() { + "use strict"; + import_sanitize_url4 = __toESM(require_dist(), 1); + import_dayjs2 = __toESM(require_dayjs_min(), 1); + import_isoWeek = __toESM(require_isoWeek(), 1); + import_customParseFormat = __toESM(require_customParseFormat(), 1); + import_advancedFormat = __toESM(require_advancedFormat(), 1); + init_logger(); + init_diagramAPI(); + init_utils2(); + init_commonDb(); + import_dayjs2.default.extend(import_isoWeek.default); + import_dayjs2.default.extend(import_customParseFormat.default); + import_dayjs2.default.extend(import_advancedFormat.default); + WEEKEND_START_DAY = { friday: 5, saturday: 6 }; + dateFormat = ""; + axisFormat = ""; + tickInterval = void 0; + todayMarker = ""; + includes2 = []; + excludes = []; + links = /* @__PURE__ */ new Map(); + sections = []; + tasks = []; + currentSection = ""; + displayMode = ""; + tags = ["active", "done", "crit", "milestone", "vert"]; + funs = []; + diagramId = ""; + inclusiveEndDates = false; + topAxis = false; + weekday = "sunday"; + weekend = "saturday"; + lastOrder = 0; + clear9 = /* @__PURE__ */ __name(function() { + sections = []; + tasks = []; + currentSection = ""; + funs = []; + taskCnt = 0; + lastTask = void 0; + lastTaskID = void 0; + rawTasks = []; + dateFormat = ""; + axisFormat = ""; + displayMode = ""; + tickInterval = void 0; + todayMarker = ""; + includes2 = []; + excludes = []; + inclusiveEndDates = false; + topAxis = false; + lastOrder = 0; + links = /* @__PURE__ */ new Map(); + diagramId = ""; + clear(); + weekday = "sunday"; + weekend = "saturday"; + }, "clear"); + setDiagramId = /* @__PURE__ */ __name(function(id35) { + diagramId = id35; + }, "setDiagramId"); + setAxisFormat = /* @__PURE__ */ __name(function(txt) { + axisFormat = txt; + }, "setAxisFormat"); + getAxisFormat = /* @__PURE__ */ __name(function() { + return axisFormat; + }, "getAxisFormat"); + setTickInterval = /* @__PURE__ */ __name(function(txt) { + tickInterval = txt; + }, "setTickInterval"); + getTickInterval = /* @__PURE__ */ __name(function() { + return tickInterval; + }, "getTickInterval"); + setTodayMarker = /* @__PURE__ */ __name(function(txt) { + todayMarker = txt; + }, "setTodayMarker"); + getTodayMarker = /* @__PURE__ */ __name(function() { + return todayMarker; + }, "getTodayMarker"); + setDateFormat = /* @__PURE__ */ __name(function(txt) { + dateFormat = txt; + }, "setDateFormat"); + enableInclusiveEndDates = /* @__PURE__ */ __name(function() { + inclusiveEndDates = true; + }, "enableInclusiveEndDates"); + endDatesAreInclusive = /* @__PURE__ */ __name(function() { + return inclusiveEndDates; + }, "endDatesAreInclusive"); + enableTopAxis = /* @__PURE__ */ __name(function() { + topAxis = true; + }, "enableTopAxis"); + topAxisEnabled = /* @__PURE__ */ __name(function() { + return topAxis; + }, "topAxisEnabled"); + setDisplayMode = /* @__PURE__ */ __name(function(txt) { + displayMode = txt; + }, "setDisplayMode"); + getDisplayMode = /* @__PURE__ */ __name(function() { + return displayMode; + }, "getDisplayMode"); + getDateFormat = /* @__PURE__ */ __name(function() { + return dateFormat; + }, "getDateFormat"); + setIncludes = /* @__PURE__ */ __name(function(txt) { + includes2 = txt.toLowerCase().split(/[\s,]+/); + }, "setIncludes"); + getIncludes = /* @__PURE__ */ __name(function() { + return includes2; + }, "getIncludes"); + setExcludes = /* @__PURE__ */ __name(function(txt) { + excludes = txt.toLowerCase().split(/[\s,]+/); + }, "setExcludes"); + getExcludes = /* @__PURE__ */ __name(function() { + return excludes; + }, "getExcludes"); + getLinks = /* @__PURE__ */ __name(function() { + return links; + }, "getLinks"); + addSection = /* @__PURE__ */ __name(function(txt) { + currentSection = txt; + sections.push(txt); + }, "addSection"); + getSections = /* @__PURE__ */ __name(function() { + return sections; + }, "getSections"); + getTasks = /* @__PURE__ */ __name(function() { + let allItemsProcessed = compileTasks(); + const maxDepth = 10; + let iterationCount = 0; + while (!allItemsProcessed && iterationCount < maxDepth) { + allItemsProcessed = compileTasks(); + iterationCount++; + } + tasks = rawTasks; + return tasks; + }, "getTasks"); + isInvalidDate = /* @__PURE__ */ __name(function(date2, dateFormat2, excludes2, includes3) { + const formattedDate = date2.format(dateFormat2.trim()); + const dateOnly = date2.format("YYYY-MM-DD"); + if (includes3.includes(formattedDate) || includes3.includes(dateOnly)) { + return false; + } + if (excludes2.includes("weekends") && (date2.isoWeekday() === WEEKEND_START_DAY[weekend] || date2.isoWeekday() === WEEKEND_START_DAY[weekend] + 1)) { + return true; + } + if (excludes2.includes(date2.format("dddd").toLowerCase())) { + return true; + } + return excludes2.includes(formattedDate) || excludes2.includes(dateOnly); + }, "isInvalidDate"); + setWeekday = /* @__PURE__ */ __name(function(txt) { + weekday = txt; + }, "setWeekday"); + getWeekday = /* @__PURE__ */ __name(function() { + return weekday; + }, "getWeekday"); + setWeekend = /* @__PURE__ */ __name(function(startDay) { + weekend = startDay; + }, "setWeekend"); + checkTaskDates = /* @__PURE__ */ __name(function(task, dateFormat2, excludes2, includes3) { + if (!excludes2.length || task.manualEndTime) { + return; + } + let startTime; + if (task.startTime instanceof Date) { + startTime = (0, import_dayjs2.default)(task.startTime); + } else { + startTime = (0, import_dayjs2.default)(task.startTime, dateFormat2, true); + } + startTime = startTime.add(1, "d"); + let originalEndTime; + if (task.endTime instanceof Date) { + originalEndTime = (0, import_dayjs2.default)(task.endTime); + } else { + originalEndTime = (0, import_dayjs2.default)(task.endTime, dateFormat2, true); + } + const [fixedEndTime, renderEndTime] = fixTaskDates( + startTime, + originalEndTime, + dateFormat2, + excludes2, + includes3 + ); + task.endTime = fixedEndTime.toDate(); + task.renderEndTime = renderEndTime; + }, "checkTaskDates"); + fixTaskDates = /* @__PURE__ */ __name(function(startTime, endTime, dateFormat2, excludes2, includes3) { + let invalid = false; + let renderEndTime = null; + const maxEndTime = endTime.add(1e4, "d"); + while (startTime <= endTime) { + if (!invalid) { + renderEndTime = endTime.toDate(); + } + invalid = isInvalidDate(startTime, dateFormat2, excludes2, includes3); + if (invalid) { + endTime = endTime.add(1, "d"); + if (endTime > maxEndTime) { + throw new Error( + "Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations." + ); + } + } + startTime = startTime.add(1, "d"); + } + return [endTime, renderEndTime]; + }, "fixTaskDates"); + getStartDate = /* @__PURE__ */ __name(function(prevTime, dateFormat2, str2) { + str2 = str2.trim(); + const isTimestampFormat = /* @__PURE__ */ __name((format3) => { + const trimmedFormat = format3.trim(); + return trimmedFormat === "x" || trimmedFormat === "X"; + }, "isTimestampFormat"); + if (isTimestampFormat(dateFormat2) && /^\d+$/.test(str2)) { + return new Date(Number(str2)); + } + const afterRePattern = /^after\s+(?[\d\w- ]+)/; + const afterStatement = afterRePattern.exec(str2); + if (afterStatement !== null) { + let latestTask = null; + for (const id35 of afterStatement.groups.ids.split(" ")) { + let task = findTaskById(id35); + if (task !== void 0 && (!latestTask || task.endTime > latestTask.endTime)) { + latestTask = task; + } + } + if (latestTask) { + return latestTask.endTime; + } + const today = /* @__PURE__ */ new Date(); + today.setHours(0, 0, 0, 0); + return today; + } + let mDate = (0, import_dayjs2.default)(str2, dateFormat2.trim(), true); + if (mDate.isValid()) { + return mDate.toDate(); + } else { + log.debug("Invalid date:" + str2); + log.debug("With date format:" + dateFormat2.trim()); + const d3 = new Date(str2); + if (d3 === void 0 || isNaN(d3.getTime()) || // WebKit browsers can mis-parse invalid dates to be ridiculously + // huge numbers, e.g. new Date('202304') gets parsed as January 1, 202304. + // This can cause virtually infinite loops while rendering, so for the + // purposes of Gantt charts we'll just treat any date beyond 10,000 AD/BC as + // invalid. + d3.getFullYear() < -1e4 || d3.getFullYear() > 1e4) { + throw new Error("Invalid date:" + str2); + } + return d3; + } + }, "getStartDate"); + parseDuration = /* @__PURE__ */ __name(function(str2) { + const statement = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(str2.trim()); + if (statement !== null) { + return [Number.parseFloat(statement[1]), statement[2]]; + } + return [NaN, "ms"]; + }, "parseDuration"); + getEndDate = /* @__PURE__ */ __name(function(prevTime, dateFormat2, str2, inclusive = false) { + str2 = str2.trim(); + const untilRePattern = /^until\s+(?[\d\w- ]+)/; + const untilStatement = untilRePattern.exec(str2); + if (untilStatement !== null) { + let earliestTask = null; + for (const id35 of untilStatement.groups.ids.split(" ")) { + let task = findTaskById(id35); + if (task !== void 0 && (!earliestTask || task.startTime < earliestTask.startTime)) { + earliestTask = task; + } + } + if (earliestTask) { + return earliestTask.startTime; + } + const today = /* @__PURE__ */ new Date(); + today.setHours(0, 0, 0, 0); + return today; + } + let parsedDate = (0, import_dayjs2.default)(str2, dateFormat2.trim(), true); + if (parsedDate.isValid()) { + if (inclusive) { + parsedDate = parsedDate.add(1, "d"); + } + return parsedDate.toDate(); + } + let endTime = (0, import_dayjs2.default)(prevTime); + const [durationValue, durationUnit] = parseDuration(str2); + if (!Number.isNaN(durationValue)) { + const newEndTime = endTime.add(durationValue, durationUnit); + if (newEndTime.isValid()) { + endTime = newEndTime; + } + } + return endTime.toDate(); + }, "getEndDate"); + taskCnt = 0; + parseId = /* @__PURE__ */ __name(function(idStr) { + if (idStr === void 0) { + taskCnt = taskCnt + 1; + return "task" + taskCnt; + } + return idStr; + }, "parseId"); + compileData = /* @__PURE__ */ __name(function(prevTask, dataStr) { + let ds; + if (dataStr.substr(0, 1) === ":") { + ds = dataStr.substr(1, dataStr.length); + } else { + ds = dataStr; + } + const data5 = ds.split(","); + const task = {}; + getTaskTags(data5, task, tags); + for (let i2 = 0; i2 < data5.length; i2++) { + data5[i2] = data5[i2].trim(); + } + let endTimeData = ""; + switch (data5.length) { + case 1: + task.id = parseId(); + task.startTime = prevTask.endTime; + endTimeData = data5[0]; + break; + case 2: + task.id = parseId(); + task.startTime = getStartDate(void 0, dateFormat, data5[0]); + endTimeData = data5[1]; + break; + case 3: + task.id = parseId(data5[0]); + task.startTime = getStartDate(void 0, dateFormat, data5[1]); + endTimeData = data5[2]; + break; + default: + } + if (endTimeData) { + task.endTime = getEndDate(task.startTime, dateFormat, endTimeData, inclusiveEndDates); + task.manualEndTime = (0, import_dayjs2.default)(endTimeData, "YYYY-MM-DD", true).isValid(); + checkTaskDates(task, dateFormat, excludes, includes2); + } + return task; + }, "compileData"); + parseData = /* @__PURE__ */ __name(function(prevTaskId, dataStr) { + let ds; + if (dataStr.substr(0, 1) === ":") { + ds = dataStr.substr(1, dataStr.length); + } else { + ds = dataStr; + } + const data5 = ds.split(","); + const task = {}; + getTaskTags(data5, task, tags); + for (let i2 = 0; i2 < data5.length; i2++) { + data5[i2] = data5[i2].trim(); + } + switch (data5.length) { + case 1: + task.id = parseId(); + task.startTime = { + type: "prevTaskEnd", + id: prevTaskId + }; + task.endTime = { + data: data5[0] + }; + break; + case 2: + task.id = parseId(); + task.startTime = { + type: "getStartDate", + startData: data5[0] + }; + task.endTime = { + data: data5[1] + }; + break; + case 3: + task.id = parseId(data5[0]); + task.startTime = { + type: "getStartDate", + startData: data5[1] + }; + task.endTime = { + data: data5[2] + }; + break; + default: + } + return task; + }, "parseData"); + rawTasks = []; + taskDb = {}; + addTask = /* @__PURE__ */ __name(function(descr, data5) { + const rawTask = { + section: currentSection, + type: currentSection, + processed: false, + manualEndTime: false, + renderEndTime: null, + raw: { data: data5 }, + task: descr, + classes: [] + }; + const taskInfo = parseData(lastTaskID, data5); + rawTask.raw.startTime = taskInfo.startTime; + rawTask.raw.endTime = taskInfo.endTime; + rawTask.id = taskInfo.id; + rawTask.prevTaskId = lastTaskID; + rawTask.active = taskInfo.active; + rawTask.done = taskInfo.done; + rawTask.crit = taskInfo.crit; + rawTask.milestone = taskInfo.milestone; + rawTask.vert = taskInfo.vert; + rawTask.order = lastOrder; + lastOrder++; + const pos = rawTasks.push(rawTask); + lastTaskID = rawTask.id; + taskDb[rawTask.id] = pos - 1; + }, "addTask"); + findTaskById = /* @__PURE__ */ __name(function(id35) { + const pos = taskDb[id35]; + return rawTasks[pos]; + }, "findTaskById"); + addTaskOrg = /* @__PURE__ */ __name(function(descr, data5) { + const newTask = { + section: currentSection, + type: currentSection, + description: descr, + task: descr, + classes: [] + }; + const taskInfo = compileData(lastTask, data5); + newTask.startTime = taskInfo.startTime; + newTask.endTime = taskInfo.endTime; + newTask.id = taskInfo.id; + newTask.active = taskInfo.active; + newTask.done = taskInfo.done; + newTask.crit = taskInfo.crit; + newTask.milestone = taskInfo.milestone; + newTask.vert = taskInfo.vert; + lastTask = newTask; + tasks.push(newTask); + }, "addTaskOrg"); + compileTasks = /* @__PURE__ */ __name(function() { + const compileTask = /* @__PURE__ */ __name(function(pos) { + const task = rawTasks[pos]; + let startTime = ""; + switch (rawTasks[pos].raw.startTime.type) { + case "prevTaskEnd": { + const prevTask = findTaskById(task.prevTaskId); + task.startTime = prevTask.endTime; + break; + } + case "getStartDate": + startTime = getStartDate(void 0, dateFormat, rawTasks[pos].raw.startTime.startData); + if (startTime) { + rawTasks[pos].startTime = startTime; + } + break; + } + if (rawTasks[pos].startTime) { + rawTasks[pos].endTime = getEndDate( + rawTasks[pos].startTime, + dateFormat, + rawTasks[pos].raw.endTime.data, + inclusiveEndDates + ); + if (rawTasks[pos].endTime) { + rawTasks[pos].processed = true; + rawTasks[pos].manualEndTime = (0, import_dayjs2.default)( + rawTasks[pos].raw.endTime.data, + "YYYY-MM-DD", + true + ).isValid(); + checkTaskDates(rawTasks[pos], dateFormat, excludes, includes2); + } + } + return rawTasks[pos].processed; + }, "compileTask"); + let allProcessed = true; + for (const [i2, rawTask] of rawTasks.entries()) { + compileTask(i2); + allProcessed = allProcessed && rawTask.processed; + } + return allProcessed; + }, "compileTasks"); + setLink = /* @__PURE__ */ __name(function(ids, _linkStr) { + let linkStr = _linkStr; + if (getConfig2().securityLevel !== "loose") { + linkStr = (0, import_sanitize_url4.sanitizeUrl)(_linkStr); + } + ids.split(",").forEach(function(id35) { + let rawTask = findTaskById(id35); + if (rawTask !== void 0) { + pushFun(id35, () => { + window.open(linkStr, "_self"); + }); + links.set(id35, linkStr); + } + }); + setClass(ids, "clickable"); + }, "setLink"); + setClass = /* @__PURE__ */ __name(function(ids, className) { + ids.split(",").forEach(function(id35) { + let rawTask = findTaskById(id35); + if (rawTask !== void 0) { + rawTask.classes.push(className); + } + }); + }, "setClass"); + setClickFun = /* @__PURE__ */ __name(function(id35, functionName, functionArgs) { + if (getConfig2().securityLevel !== "loose") { + return; + } + if (functionName === void 0) { + return; + } + let argList = []; + if (typeof functionArgs === "string") { + argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); + for (let i2 = 0; i2 < argList.length; i2++) { + let item = argList[i2].trim(); + if (item.startsWith('"') && item.endsWith('"')) { + item = item.substr(1, item.length - 2); + } + argList[i2] = item; + } + } + if (argList.length === 0) { + argList.push(id35); + } + let rawTask = findTaskById(id35); + if (rawTask !== void 0) { + pushFun(id35, () => { + utils_default2.runFunc(functionName, ...argList); + }); + } + }, "setClickFun"); + pushFun = /* @__PURE__ */ __name(function(id35, callbackFunction) { + funs.push( + function() { + const prefixedId = diagramId ? `${diagramId}-${id35}` : id35; + const elem = document.querySelector(`[id="${prefixedId}"]`); + if (elem !== null) { + elem.addEventListener("click", function() { + callbackFunction(); + }); + } + }, + function() { + const prefixedId = diagramId ? `${diagramId}-${id35}` : id35; + const elem = document.querySelector(`[id="${prefixedId}-text"]`); + if (elem !== null) { + elem.addEventListener("click", function() { + callbackFunction(); + }); + } + } + ); + }, "pushFun"); + setClickEvent = /* @__PURE__ */ __name(function(ids, functionName, functionArgs) { + ids.split(",").forEach(function(id35) { + setClickFun(id35, functionName, functionArgs); + }); + setClass(ids, "clickable"); + }, "setClickEvent"); + bindFunctions = /* @__PURE__ */ __name(function(element3) { + funs.forEach(function(fun) { + fun(element3); + }); + }, "bindFunctions"); + ganttDb_default = { + getConfig: /* @__PURE__ */ __name(() => getConfig2().gantt, "getConfig"), + clear: clear9, + setDateFormat, + getDateFormat, + enableInclusiveEndDates, + endDatesAreInclusive, + enableTopAxis, + topAxisEnabled, + setAxisFormat, + getAxisFormat, + setTickInterval, + getTickInterval, + setTodayMarker, + getTodayMarker, + setAccTitle, + getAccTitle, + setDiagramTitle, + getDiagramTitle, + setDiagramId, + setDisplayMode, + getDisplayMode, + setAccDescription, + getAccDescription, + addSection, + getSections, + getTasks, + addTask, + findTaskById, + addTaskOrg, + setIncludes, + getIncludes, + setExcludes, + getExcludes, + setClickEvent, + setLink, + getLinks, + bindFunctions, + parseDuration, + isInvalidDate, + setWeekday, + getWeekday, + setWeekend + }; + __name(getTaskTags, "getTaskTags"); + } + }); + + // ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/duration.js + var require_duration = __commonJS({ + "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/duration.js"(exports2, module2) { + "use strict"; + !(function(t4, s2) { + "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = s2() : "function" == typeof define && define.amd ? define(s2) : (t4 = "undefined" != typeof globalThis ? globalThis : t4 || self).dayjs_plugin_duration = s2(); + })(exports2, (function() { + "use strict"; + var t4, s2, n2 = 1e3, i2 = 6e4, e3 = 36e5, r2 = 864e5, o2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, u2 = 31536e6, d3 = 2628e6, a2 = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, h3 = { years: u2, months: d3, days: r2, hours: e3, minutes: i2, seconds: n2, milliseconds: 1, weeks: 6048e5 }, c3 = /* @__PURE__ */ __name(function(t5) { + return t5 instanceof g2; + }, "c"), f2 = /* @__PURE__ */ __name(function(t5, s3, n3) { + return new g2(t5, n3, s3.$l); + }, "f"), m3 = /* @__PURE__ */ __name(function(t5) { + return s2.p(t5) + "s"; + }, "m"), l4 = /* @__PURE__ */ __name(function(t5) { + return t5 < 0; + }, "l"), $4 = /* @__PURE__ */ __name(function(t5) { + return l4(t5) ? Math.ceil(t5) : Math.floor(t5); + }, "$"), y6 = /* @__PURE__ */ __name(function(t5) { + return Math.abs(t5); + }, "y"), v3 = /* @__PURE__ */ __name(function(t5, s3) { + return t5 ? l4(t5) ? { negative: true, format: "" + y6(t5) + s3 } : { negative: false, format: "" + t5 + s3 } : { negative: false, format: "" }; + }, "v"), g2 = (function() { + function l5(t5, s3, n3) { + var i3 = this; + if (this.$d = {}, this.$l = n3, void 0 === t5 && (this.$ms = 0, this.parseFromMilliseconds()), s3) return f2(t5 * h3[m3(s3)], this); + if ("number" == typeof t5) return this.$ms = t5, this.parseFromMilliseconds(), this; + if ("object" == typeof t5) return Object.keys(t5).forEach((function(s4) { + i3.$d[m3(s4)] = t5[s4]; + })), this.calMilliseconds(), this; + if ("string" == typeof t5) { + var e4 = t5.match(a2); + if (e4) { + var r3 = e4.slice(2).map((function(t6) { + return null != t6 ? Number(t6) : 0; + })); + return this.$d.years = r3[0], this.$d.months = r3[1], this.$d.weeks = r3[2], this.$d.days = r3[3], this.$d.hours = r3[4], this.$d.minutes = r3[5], this.$d.seconds = r3[6], this.calMilliseconds(), this; + } + } + return this; + } + __name(l5, "l"); + var y7 = l5.prototype; + return y7.calMilliseconds = function() { + var t5 = this; + this.$ms = Object.keys(this.$d).reduce((function(s3, n3) { + return s3 + (t5.$d[n3] || 0) * h3[n3]; + }), 0); + }, y7.parseFromMilliseconds = function() { + var t5 = this.$ms; + this.$d.years = $4(t5 / u2), t5 %= u2, this.$d.months = $4(t5 / d3), t5 %= d3, this.$d.days = $4(t5 / r2), t5 %= r2, this.$d.hours = $4(t5 / e3), t5 %= e3, this.$d.minutes = $4(t5 / i2), t5 %= i2, this.$d.seconds = $4(t5 / n2), t5 %= n2, this.$d.milliseconds = t5; + }, y7.toISOString = function() { + var t5 = v3(this.$d.years, "Y"), s3 = v3(this.$d.months, "M"), n3 = +this.$d.days || 0; + this.$d.weeks && (n3 += 7 * this.$d.weeks); + var i3 = v3(n3, "D"), e4 = v3(this.$d.hours, "H"), r3 = v3(this.$d.minutes, "M"), o3 = this.$d.seconds || 0; + this.$d.milliseconds && (o3 += this.$d.milliseconds / 1e3, o3 = Math.round(1e3 * o3) / 1e3); + var u3 = v3(o3, "S"), d4 = t5.negative || s3.negative || i3.negative || e4.negative || r3.negative || u3.negative, a3 = e4.format || r3.format || u3.format ? "T" : "", h4 = (d4 ? "-" : "") + "P" + t5.format + s3.format + i3.format + a3 + e4.format + r3.format + u3.format; + return "P" === h4 || "-P" === h4 ? "P0D" : h4; + }, y7.toJSON = function() { + return this.toISOString(); + }, y7.format = function(t5) { + var n3 = t5 || "YYYY-MM-DDTHH:mm:ss", i3 = { Y: this.$d.years, YY: s2.s(this.$d.years, 2, "0"), YYYY: s2.s(this.$d.years, 4, "0"), M: this.$d.months, MM: s2.s(this.$d.months, 2, "0"), D: this.$d.days, DD: s2.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: s2.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: s2.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: s2.s(this.$d.seconds, 2, "0"), SSS: s2.s(this.$d.milliseconds, 3, "0") }; + return n3.replace(o2, (function(t6, s3) { + return s3 || String(i3[t6]); + })); + }, y7.as = function(t5) { + return this.$ms / h3[m3(t5)]; + }, y7.get = function(t5) { + var s3 = this.$ms, n3 = m3(t5); + return "milliseconds" === n3 ? s3 %= 1e3 : s3 = "weeks" === n3 ? $4(s3 / h3[n3]) : this.$d[n3], s3 || 0; + }, y7.add = function(t5, s3, n3) { + var i3; + return i3 = s3 ? t5 * h3[m3(s3)] : c3(t5) ? t5.$ms : f2(t5, this).$ms, f2(this.$ms + i3 * (n3 ? -1 : 1), this); + }, y7.subtract = function(t5, s3) { + return this.add(t5, s3, true); + }, y7.locale = function(t5) { + var s3 = this.clone(); + return s3.$l = t5, s3; + }, y7.clone = function() { + return f2(this.$ms, this); + }, y7.humanize = function(s3) { + return t4().add(this.$ms, "ms").locale(this.$l).fromNow(!s3); + }, y7.valueOf = function() { + return this.asMilliseconds(); + }, y7.milliseconds = function() { + return this.get("milliseconds"); + }, y7.asMilliseconds = function() { + return this.as("milliseconds"); + }, y7.seconds = function() { + return this.get("seconds"); + }, y7.asSeconds = function() { + return this.as("seconds"); + }, y7.minutes = function() { + return this.get("minutes"); + }, y7.asMinutes = function() { + return this.as("minutes"); + }, y7.hours = function() { + return this.get("hours"); + }, y7.asHours = function() { + return this.as("hours"); + }, y7.days = function() { + return this.get("days"); + }, y7.asDays = function() { + return this.as("days"); + }, y7.weeks = function() { + return this.get("weeks"); + }, y7.asWeeks = function() { + return this.as("weeks"); + }, y7.months = function() { + return this.get("months"); + }, y7.asMonths = function() { + return this.as("months"); + }, y7.years = function() { + return this.get("years"); + }, y7.asYears = function() { + return this.as("years"); + }, l5; + })(), p3 = /* @__PURE__ */ __name(function(t5, s3, n3) { + return t5.add(s3.years() * n3, "y").add(s3.months() * n3, "M").add(s3.days() * n3, "d").add(s3.hours() * n3, "h").add(s3.minutes() * n3, "m").add(s3.seconds() * n3, "s").add(s3.milliseconds() * n3, "ms"); + }, "p"); + return function(n3, i3, e4) { + t4 = e4, s2 = e4().$utils(), e4.duration = function(t5, s3) { + var n4 = e4.locale(); + return f2(t5, { $l: n4 }, s3); + }, e4.isDuration = c3; + var r3 = i3.prototype.add, o3 = i3.prototype.subtract; + i3.prototype.add = function(t5, s3) { + return c3(t5) ? p3(this, t5, 1) : r3.bind(this)(t5, s3); + }, i3.prototype.subtract = function(t5, s3) { + return c3(t5) ? p3(this, t5, -1) : o3.bind(this)(t5, s3); + }; + }; + })); + } + }); + + // src/diagrams/gantt/ganttRenderer.js + var import_dayjs3, import_duration8, setConf2, mapWeekdayToTimeFunction, getMaxIntersections, w3, MAX_TICK_COUNT, draw5, ganttRenderer_default; + var init_ganttRenderer = __esm({ + "src/diagrams/gantt/ganttRenderer.js"() { + "use strict"; + import_dayjs3 = __toESM(require_dayjs_min(), 1); + import_duration8 = __toESM(require_duration(), 1); + init_logger(); + init_src32(); + init_common(); + init_diagramAPI(); + init_setupGraphViewbox(); + import_dayjs3.default.extend(import_duration8.default); + setConf2 = /* @__PURE__ */ __name(function() { + log.debug("Something is calling, setConf, remove the call"); + }, "setConf"); + mapWeekdayToTimeFunction = { + monday: timeMonday, + tuesday: timeTuesday, + wednesday: timeWednesday, + thursday: timeThursday, + friday: timeFriday, + saturday: timeSaturday, + sunday: timeSunday + }; + getMaxIntersections = /* @__PURE__ */ __name((tasks4, orderOffset) => { + let timeline = [...tasks4].map(() => -Infinity); + let sorted = [...tasks4].sort((a2, b3) => a2.startTime - b3.startTime || a2.order - b3.order); + let maxIntersections = 0; + for (const element3 of sorted) { + for (let j3 = 0; j3 < timeline.length; j3++) { + if (element3.startTime >= timeline[j3]) { + timeline[j3] = element3.endTime; + element3.order = j3 + orderOffset; + if (j3 > maxIntersections) { + maxIntersections = j3; + } + break; + } + } + } + return maxIntersections; + }, "getMaxIntersections"); + MAX_TICK_COUNT = 1e4; + draw5 = /* @__PURE__ */ __name(function(text4, id35, version3, diagObj) { + const conf5 = getConfig2().gantt; + diagObj.db.setDiagramId(id35); + const securityLevel = getConfig2().securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document; + const elem = doc.getElementById(id35); + w3 = elem.parentElement.offsetWidth; + if (w3 === void 0) { + w3 = 1200; + } + if (conf5.useWidth !== void 0) { + w3 = conf5.useWidth; + } + const taskArray = diagObj.db.getTasks(); + let categories = []; + for (const element3 of taskArray) { + categories.push(element3.type); + } + categories = checkUnique(categories); + const categoryHeights = {}; + let h3 = 2 * conf5.topPadding; + if (diagObj.db.getDisplayMode() === "compact" || conf5.displayMode === "compact") { + const categoryElements = {}; + for (const element3 of taskArray) { + if (categoryElements[element3.section] === void 0) { + categoryElements[element3.section] = [element3]; + } else { + categoryElements[element3.section].push(element3); + } + } + let intersections = 0; + for (const category of Object.keys(categoryElements)) { + const categoryHeight = getMaxIntersections(categoryElements[category], intersections) + 1; + intersections += categoryHeight; + h3 += categoryHeight * (conf5.barHeight + conf5.barGap); + categoryHeights[category] = categoryHeight; + } + } else { + h3 += taskArray.length * (conf5.barHeight + conf5.barGap); + for (const category of categories) { + categoryHeights[category] = taskArray.filter((task) => task.type === category).length; + } + } + elem.setAttribute("viewBox", "0 0 " + w3 + " " + h3); + const svg2 = root4.select(`[id="${id35}"]`); + const timeScale = time().domain([ + min(taskArray, function(d3) { + return d3.startTime; + }), + max(taskArray, function(d3) { + return d3.endTime; + }) + ]).rangeRound([0, w3 - conf5.leftPadding - conf5.rightPadding]); + function taskCompare(a2, b3) { + const taskA = a2.startTime; + const taskB = b3.startTime; + let result = 0; + if (taskA > taskB) { + result = 1; + } else if (taskA < taskB) { + result = -1; + } + return result; + } + __name(taskCompare, "taskCompare"); + taskArray.sort(taskCompare); + makeGantt(taskArray, w3, h3); + configureSvgSize(svg2, h3, w3, conf5.useMaxWidth); + svg2.append("text").text(diagObj.db.getDiagramTitle()).attr("x", w3 / 2).attr("y", conf5.titleTopMargin).attr("class", "titleText"); + function makeGantt(tasks4, pageWidth, pageHeight) { + const barHeight = conf5.barHeight; + const gap = barHeight + conf5.barGap; + const topPadding = conf5.topPadding; + const leftPadding = conf5.leftPadding; + const colorScale = linear2().domain([0, categories.length]).range(["#00B9FA", "#F95002"]).interpolate(hcl_default); + drawExcludeDays( + gap, + topPadding, + leftPadding, + pageWidth, + pageHeight, + tasks4, + diagObj.db.getExcludes(), + diagObj.db.getIncludes() + ); + makeGrid(leftPadding, topPadding, pageWidth, pageHeight); + drawRects(tasks4, gap, topPadding, leftPadding, barHeight, colorScale, pageWidth, pageHeight); + vertLabels(gap, topPadding, leftPadding, barHeight, colorScale); + drawToday(leftPadding, topPadding, pageWidth, pageHeight); + } + __name(makeGantt, "makeGantt"); + function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w4) { + theArray.sort((a2, b3) => a2.vert === b3.vert ? 0 : a2.vert ? 1 : -1); + const uniqueTaskOrderIds = [...new Set(theArray.map((item) => item.order))]; + const uniqueTasks = uniqueTaskOrderIds.map((id36) => theArray.find((item) => item.order === id36)); + svg2.append("g").selectAll("rect").data(uniqueTasks).enter().append("rect").attr("x", 0).attr("y", function(d3, i2) { + i2 = d3.order; + return i2 * theGap + theTopPad - 2; + }).attr("width", function() { + return w4 - conf5.rightPadding / 2; + }).attr("height", theGap).attr("class", function(d3) { + for (const [i2, category] of categories.entries()) { + if (d3.type === category) { + return "section section" + i2 % conf5.numberSectionStyles; + } + } + return "section section0"; + }).enter(); + const rectangles = svg2.append("g").selectAll("rect").data(theArray).enter(); + const links3 = diagObj.db.getLinks(); + rectangles.append("rect").attr("id", function(d3) { + return id35 + "-" + d3.id; + }).attr("rx", 3).attr("ry", 3).attr("x", function(d3) { + if (d3.milestone) { + return timeScale(d3.startTime) + theSidePad + 0.5 * (timeScale(d3.endTime) - timeScale(d3.startTime)) - 0.5 * theBarHeight; + } + return timeScale(d3.startTime) + theSidePad; + }).attr("y", function(d3, i2) { + i2 = d3.order; + if (d3.vert) { + return conf5.gridLineStartPadding; + } + return i2 * theGap + theTopPad; + }).attr("width", function(d3) { + if (d3.milestone) { + return theBarHeight; + } + if (d3.vert) { + return 0.08 * theBarHeight; + } + return timeScale(d3.renderEndTime || d3.endTime) - timeScale(d3.startTime); + }).attr("height", function(d3) { + if (d3.vert) { + return taskArray.length * (conf5.barHeight + conf5.barGap) + conf5.barHeight * 2; + } + return theBarHeight; + }).attr("transform-origin", function(d3, i2) { + i2 = d3.order; + return (timeScale(d3.startTime) + theSidePad + 0.5 * (timeScale(d3.endTime) - timeScale(d3.startTime))).toString() + "px " + (i2 * theGap + theTopPad + 0.5 * theBarHeight).toString() + "px"; + }).attr("class", function(d3) { + const res = "task"; + let classStr = ""; + if (d3.classes.length > 0) { + classStr = d3.classes.join(" "); + } + let secNum = 0; + for (const [i2, category] of categories.entries()) { + if (d3.type === category) { + secNum = i2 % conf5.numberSectionStyles; + } + } + let taskClass = ""; + if (d3.active) { + if (d3.crit) { + taskClass += " activeCrit"; + } else { + taskClass = " active"; + } + } else if (d3.done) { + if (d3.crit) { + taskClass = " doneCrit"; + } else { + taskClass = " done"; + } + } else { + if (d3.crit) { + taskClass += " crit"; + } + } + if (taskClass.length === 0) { + taskClass = " task"; + } + if (d3.milestone) { + taskClass = " milestone " + taskClass; + } + if (d3.vert) { + taskClass = " vert " + taskClass; + } + taskClass += secNum; + taskClass += " " + classStr; + return res + taskClass; + }); + rectangles.append("text").attr("id", function(d3) { + return id35 + "-" + d3.id + "-text"; + }).text(function(d3) { + return d3.task; + }).attr("font-size", conf5.fontSize).attr("x", function(d3) { + let startX2 = timeScale(d3.startTime); + let endX = timeScale(d3.renderEndTime || d3.endTime); + if (d3.milestone) { + startX2 += 0.5 * (timeScale(d3.endTime) - timeScale(d3.startTime)) - 0.5 * theBarHeight; + endX = startX2 + theBarHeight; + } + if (d3.vert) { + return timeScale(d3.startTime) + theSidePad; + } + const textWidth = this.getBBox().width; + if (textWidth > endX - startX2) { + if (endX + textWidth + 1.5 * conf5.leftPadding > w4) { + return startX2 + theSidePad - 5; + } else { + return endX + theSidePad + 5; + } + } else { + return (endX - startX2) / 2 + startX2 + theSidePad; + } + }).attr("y", function(d3, i2) { + if (d3.vert) { + return conf5.gridLineStartPadding + taskArray.length * (conf5.barHeight + conf5.barGap) + 60; + } + i2 = d3.order; + return i2 * theGap + conf5.barHeight / 2 + (conf5.fontSize / 2 - 2) + theTopPad; + }).attr("text-height", theBarHeight).attr("class", function(d3) { + const startX2 = timeScale(d3.startTime); + let endX = timeScale(d3.endTime); + if (d3.milestone) { + endX = startX2 + theBarHeight; + } + const textWidth = this.getBBox().width; + let classStr = ""; + if (d3.classes.length > 0) { + classStr = d3.classes.join(" "); + } + let secNum = 0; + for (const [i2, category] of categories.entries()) { + if (d3.type === category) { + secNum = i2 % conf5.numberSectionStyles; + } + } + let taskType = ""; + if (d3.active) { + if (d3.crit) { + taskType = "activeCritText" + secNum; + } else { + taskType = "activeText" + secNum; + } + } + if (d3.done) { + if (d3.crit) { + taskType = taskType + " doneCritText" + secNum; + } else { + taskType = taskType + " doneText" + secNum; + } + } else { + if (d3.crit) { + taskType = taskType + " critText" + secNum; + } + } + if (d3.milestone) { + taskType += " milestoneText"; + } + if (d3.vert) { + taskType += " vertText"; + } + if (textWidth > endX - startX2) { + if (endX + textWidth + 1.5 * conf5.leftPadding > w4) { + return classStr + " taskTextOutsideLeft taskTextOutside" + secNum + " " + taskType; + } else { + return classStr + " taskTextOutsideRight taskTextOutside" + secNum + " " + taskType + " width-" + textWidth; + } + } else { + return classStr + " taskText taskText" + secNum + " " + taskType + " width-" + textWidth; + } + }); + const securityLevel2 = getConfig2().securityLevel; + if (securityLevel2 === "sandbox") { + let sandboxElement2; + sandboxElement2 = select_default2("#i" + id35); + const doc2 = sandboxElement2.nodes()[0].contentDocument; + rectangles.filter(function(d3) { + return links3.has(d3.id); + }).each(function(o2) { + var taskRect = doc2.querySelector("#" + CSS.escape(id35 + "-" + o2.id)); + var taskText = doc2.querySelector("#" + CSS.escape(id35 + "-" + o2.id + "-text")); + const oldParent = taskRect.parentNode; + var Link2 = doc2.createElement("a"); + Link2.setAttribute("xlink:href", links3.get(o2.id)); + Link2.setAttribute("target", "_top"); + oldParent.appendChild(Link2); + Link2.appendChild(taskRect); + Link2.appendChild(taskText); + }); + } + } + __name(drawRects, "drawRects"); + function drawExcludeDays(theGap, theTopPad, theSidePad, w4, h4, tasks4, excludes2, includes3) { + if (excludes2.length === 0 && includes3.length === 0) { + return; + } + let minTime; + let maxTime; + for (const { startTime, endTime } of tasks4) { + if (minTime === void 0 || startTime < minTime) { + minTime = startTime; + } + if (maxTime === void 0 || endTime > maxTime) { + maxTime = endTime; + } + } + if (!minTime || !maxTime) { + return; + } + if ((0, import_dayjs3.default)(maxTime).diff((0, import_dayjs3.default)(minTime), "year") > 5) { + log.warn( + "The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days." + ); + return; + } + const dateFormat2 = diagObj.db.getDateFormat(); + const excludeRanges = []; + let range3 = null; + let d3 = (0, import_dayjs3.default)(minTime); + while (d3.valueOf() <= maxTime) { + if (diagObj.db.isInvalidDate(d3, dateFormat2, excludes2, includes3)) { + if (!range3) { + range3 = { + start: d3, + end: d3 + }; + } else { + range3.end = d3; + } + } else { + if (range3) { + excludeRanges.push(range3); + range3 = null; + } + } + d3 = d3.add(1, "d"); + } + const rectangles = svg2.append("g").selectAll("rect").data(excludeRanges).enter(); + rectangles.append("rect").attr("id", (d4) => id35 + "-exclude-" + d4.start.format("YYYY-MM-DD")).attr("x", (d4) => timeScale(d4.start.startOf("day")) + theSidePad).attr("y", conf5.gridLineStartPadding).attr("width", (d4) => timeScale(d4.end.endOf("day")) - timeScale(d4.start.startOf("day"))).attr("height", h4 - theTopPad - conf5.gridLineStartPadding).attr("transform-origin", function(d4, i2) { + return (timeScale(d4.start) + theSidePad + 0.5 * (timeScale(d4.end) - timeScale(d4.start))).toString() + "px " + (i2 * theGap + 0.5 * h4).toString() + "px"; + }).attr("class", "exclude-range"); + } + __name(drawExcludeDays, "drawExcludeDays"); + function getEstimatedTickCount(minTime, maxTime, every3, interval2) { + if (every3 <= 0 || minTime > maxTime) { + return Infinity; + } + const timeDiffMs = maxTime - minTime; + const intervalMs = import_dayjs3.default.duration({ [interval2 ?? "day"]: every3 }).asMilliseconds(); + if (intervalMs <= 0) { + return Infinity; + } + return Math.ceil(timeDiffMs / intervalMs); + } + __name(getEstimatedTickCount, "getEstimatedTickCount"); + function makeGrid(theSidePad, theTopPad, w4, h4) { + const dateFormat2 = diagObj.db.getDateFormat(); + const userAxisFormat = diagObj.db.getAxisFormat(); + let axisFormat2; + if (userAxisFormat) { + axisFormat2 = userAxisFormat; + } else if (dateFormat2 === "D") { + axisFormat2 = "%d"; + } else { + axisFormat2 = conf5.axisFormat ?? "%Y-%m-%d"; + } + let bottomXAxis = axisBottom(timeScale).tickSize(-h4 + theTopPad + conf5.gridLineStartPadding).tickFormat(timeFormat(axisFormat2)); + const reTickInterval = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/; + const resultTickInterval = reTickInterval.exec( + diagObj.db.getTickInterval() || conf5.tickInterval + ); + if (resultTickInterval !== null) { + const every3 = parseInt(resultTickInterval[1], 10); + if (isNaN(every3) || every3 <= 0) { + log.warn( + `Invalid tick interval value: "${resultTickInterval[1]}". Skipping custom tick interval.` + ); + } else { + const interval2 = resultTickInterval[2]; + const weekday2 = diagObj.db.getWeekday() || conf5.weekday; + const domain = timeScale.domain(); + const minTime = domain[0]; + const maxTime = domain[1]; + const estimatedTicks = getEstimatedTickCount(minTime, maxTime, every3, interval2); + if (estimatedTicks > MAX_TICK_COUNT) { + log.warn( + `The tick interval "${every3}${interval2}" would generate ${estimatedTicks} ticks, which exceeds the maximum allowed (${MAX_TICK_COUNT}). This may indicate an invalid date or time range. Skipping custom tick interval.` + ); + } else { + switch (interval2) { + case "millisecond": + bottomXAxis.ticks(millisecond.every(every3)); + break; + case "second": + bottomXAxis.ticks(second.every(every3)); + break; + case "minute": + bottomXAxis.ticks(timeMinute.every(every3)); + break; + case "hour": + bottomXAxis.ticks(timeHour.every(every3)); + break; + case "day": + bottomXAxis.ticks(timeDay.every(every3)); + break; + case "week": + bottomXAxis.ticks(mapWeekdayToTimeFunction[weekday2].every(every3)); + break; + case "month": + bottomXAxis.ticks(timeMonth.every(every3)); + break; + } + } + } + } + svg2.append("g").attr("class", "grid").attr("transform", "translate(" + theSidePad + ", " + (h4 - 50) + ")").call(bottomXAxis).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10).attr("dy", "1em"); + if (diagObj.db.topAxisEnabled() || conf5.topAxis) { + let topXAxis = axisTop(timeScale).tickSize(-h4 + theTopPad + conf5.gridLineStartPadding).tickFormat(timeFormat(axisFormat2)); + if (resultTickInterval !== null) { + const every3 = parseInt(resultTickInterval[1], 10); + if (isNaN(every3) || every3 <= 0) { + log.warn( + `Invalid tick interval value: "${resultTickInterval[1]}". Skipping custom tick interval.` + ); + } else { + const interval2 = resultTickInterval[2]; + const weekday2 = diagObj.db.getWeekday() || conf5.weekday; + const domain = timeScale.domain(); + const minTime = domain[0]; + const maxTime = domain[1]; + const estimatedTicks = getEstimatedTickCount(minTime, maxTime, every3, interval2); + if (estimatedTicks <= MAX_TICK_COUNT) { + switch (interval2) { + case "millisecond": + topXAxis.ticks(millisecond.every(every3)); + break; + case "second": + topXAxis.ticks(second.every(every3)); + break; + case "minute": + topXAxis.ticks(timeMinute.every(every3)); + break; + case "hour": + topXAxis.ticks(timeHour.every(every3)); + break; + case "day": + topXAxis.ticks(timeDay.every(every3)); + break; + case "week": + topXAxis.ticks(mapWeekdayToTimeFunction[weekday2].every(every3)); + break; + case "month": + topXAxis.ticks(timeMonth.every(every3)); + break; + } + } + } + } + svg2.append("g").attr("class", "grid").attr("transform", "translate(" + theSidePad + ", " + theTopPad + ")").call(topXAxis).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10); + } + } + __name(makeGrid, "makeGrid"); + function vertLabels(theGap, theTopPad) { + let prevGap = 0; + const numOccurrences = Object.keys(categoryHeights).map((d3) => [d3, categoryHeights[d3]]); + svg2.append("g").selectAll("text").data(numOccurrences).enter().append(function(d3) { + const rows = d3[0].split(common_default.lineBreakRegex); + const dy = -(rows.length - 1) / 2; + const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text"); + svgLabel.setAttribute("dy", dy + "em"); + for (const [j3, row] of rows.entries()) { + const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan"); + tspan.setAttribute("alignment-baseline", "central"); + tspan.setAttribute("x", "10"); + if (j3 > 0) { + tspan.setAttribute("dy", "1em"); + } + tspan.textContent = row; + svgLabel.appendChild(tspan); + } + return svgLabel; + }).attr("x", 10).attr("y", function(d3, i2) { + if (i2 > 0) { + for (let j3 = 0; j3 < i2; j3++) { + prevGap += numOccurrences[i2 - 1][1]; + return d3[1] * theGap / 2 + prevGap * theGap + theTopPad; + } + } else { + return d3[1] * theGap / 2 + theTopPad; + } + }).attr("font-size", conf5.sectionFontSize).attr("class", function(d3) { + for (const [i2, category] of categories.entries()) { + if (d3[0] === category) { + return "sectionTitle sectionTitle" + i2 % conf5.numberSectionStyles; + } + } + return "sectionTitle"; + }); + } + __name(vertLabels, "vertLabels"); + function drawToday(theSidePad, theTopPad, w4, h4) { + const todayMarker2 = diagObj.db.getTodayMarker(); + if (todayMarker2 === "off") { + return; + } + const todayG = svg2.append("g").attr("class", "today"); + const today = /* @__PURE__ */ new Date(); + const todayLine = todayG.append("line"); + todayLine.attr("x1", timeScale(today) + theSidePad).attr("x2", timeScale(today) + theSidePad).attr("y1", conf5.titleTopMargin).attr("y2", h4 - conf5.titleTopMargin).attr("class", "today"); + if (todayMarker2 !== "") { + todayLine.attr("style", todayMarker2.replace(/,/g, ";")); + } + } + __name(drawToday, "drawToday"); + function checkUnique(arr) { + const hash = {}; + const result = []; + for (let i2 = 0, l4 = arr.length; i2 < l4; ++i2) { + if (!Object.prototype.hasOwnProperty.call(hash, arr[i2])) { + hash[arr[i2]] = true; + result.push(arr[i2]); + } + } + return result; + } + __name(checkUnique, "checkUnique"); + }, "draw"); + ganttRenderer_default = { + setConf: setConf2, + draw: draw5 + }; + } + }); + + // src/diagrams/gantt/styles.js + var getStyles6, styles_default6; + var init_styles6 = __esm({ + "src/diagrams/gantt/styles.js"() { + "use strict"; + getStyles6 = /* @__PURE__ */ __name((options2) => ` + .mermaid-main-font { + font-family: ${options2.fontFamily}; + } + + .exclude-range { + fill: ${options2.excludeBkgColor}; + } + + .section { + stroke: none; + opacity: 0.2; + } + + .section0 { + fill: ${options2.sectionBkgColor}; + } + + .section2 { + fill: ${options2.sectionBkgColor2}; + } + + .section1, + .section3 { + fill: ${options2.altSectionBkgColor}; + opacity: 0.2; + } + + .sectionTitle0 { + fill: ${options2.titleColor}; + } + + .sectionTitle1 { + fill: ${options2.titleColor}; + } + + .sectionTitle2 { + fill: ${options2.titleColor}; + } + + .sectionTitle3 { + fill: ${options2.titleColor}; + } + + .sectionTitle { + text-anchor: start; + font-family: ${options2.fontFamily}; + } + + + /* Grid and axis */ + + .grid .tick { + stroke: ${options2.gridColor}; + opacity: 0.8; + shape-rendering: crispEdges; + } + + .grid .tick text { + font-family: ${options2.fontFamily}; + fill: ${options2.textColor}; + } + + .grid path { + stroke-width: 0; + } + + + /* Today line */ + + .today { + fill: none; + stroke: ${options2.todayLineColor}; + stroke-width: 2px; + } + + + /* Task styling */ + + /* Default task */ + + .task { + stroke-width: 2; + } + + .taskText { + text-anchor: middle; + font-family: ${options2.fontFamily}; + } + + .taskTextOutsideRight { + fill: ${options2.taskTextDarkColor}; + text-anchor: start; + font-family: ${options2.fontFamily}; + } + + .taskTextOutsideLeft { + fill: ${options2.taskTextDarkColor}; + text-anchor: end; + } + + + /* Special case clickable */ + + .task.clickable { + cursor: pointer; + } + + .taskText.clickable { + cursor: pointer; + fill: ${options2.taskTextClickableColor} !important; + font-weight: bold; + } + + .taskTextOutsideLeft.clickable { + cursor: pointer; + fill: ${options2.taskTextClickableColor} !important; + font-weight: bold; + } + + .taskTextOutsideRight.clickable { + cursor: pointer; + fill: ${options2.taskTextClickableColor} !important; + font-weight: bold; + } + + + /* Specific task settings for the sections*/ + + .taskText0, + .taskText1, + .taskText2, + .taskText3 { + fill: ${options2.taskTextColor}; + } + + .task0, + .task1, + .task2, + .task3 { + fill: ${options2.taskBkgColor}; + stroke: ${options2.taskBorderColor}; + } + + .taskTextOutside0, + .taskTextOutside2 + { + fill: ${options2.taskTextOutsideColor}; + } + + .taskTextOutside1, + .taskTextOutside3 { + fill: ${options2.taskTextOutsideColor}; + } + + + /* Active task */ + + .active0, + .active1, + .active2, + .active3 { + fill: ${options2.activeTaskBkgColor}; + stroke: ${options2.activeTaskBorderColor}; + } + + .activeText0, + .activeText1, + .activeText2, + .activeText3 { + fill: ${options2.taskTextDarkColor} !important; + } + + + /* Completed task */ + + .done0, + .done1, + .done2, + .done3 { + stroke: ${options2.doneTaskBorderColor}; + fill: ${options2.doneTaskBkgColor}; + stroke-width: 2; + } + + .doneText0, + .doneText1, + .doneText2, + .doneText3 { + fill: ${options2.taskTextDarkColor} !important; + } + + /* Done task text displayed outside the bar sits against the diagram background, + not against the done-task bar, so it must use the outside/contrast color. */ + .doneText0.taskTextOutsideLeft, + .doneText0.taskTextOutsideRight, + .doneText1.taskTextOutsideLeft, + .doneText1.taskTextOutsideRight, + .doneText2.taskTextOutsideLeft, + .doneText2.taskTextOutsideRight, + .doneText3.taskTextOutsideLeft, + .doneText3.taskTextOutsideRight { + fill: ${options2.taskTextOutsideColor} !important; + } + + + /* Tasks on the critical line */ + + .crit0, + .crit1, + .crit2, + .crit3 { + stroke: ${options2.critBorderColor}; + fill: ${options2.critBkgColor}; + stroke-width: 2; + } + + .activeCrit0, + .activeCrit1, + .activeCrit2, + .activeCrit3 { + stroke: ${options2.critBorderColor}; + fill: ${options2.activeTaskBkgColor}; + stroke-width: 2; + } + + .doneCrit0, + .doneCrit1, + .doneCrit2, + .doneCrit3 { + stroke: ${options2.critBorderColor}; + fill: ${options2.doneTaskBkgColor}; + stroke-width: 2; + cursor: pointer; + shape-rendering: crispEdges; + } + + .milestone { + transform: rotate(45deg) scale(0.8,0.8); + } + + .milestoneText { + font-style: italic; + } + .doneCritText0, + .doneCritText1, + .doneCritText2, + .doneCritText3 { + fill: ${options2.taskTextDarkColor} !important; + } + + /* Done-crit task text outside the bar \u2014 same reasoning as doneText above. */ + .doneCritText0.taskTextOutsideLeft, + .doneCritText0.taskTextOutsideRight, + .doneCritText1.taskTextOutsideLeft, + .doneCritText1.taskTextOutsideRight, + .doneCritText2.taskTextOutsideLeft, + .doneCritText2.taskTextOutsideRight, + .doneCritText3.taskTextOutsideLeft, + .doneCritText3.taskTextOutsideRight { + fill: ${options2.taskTextOutsideColor} !important; + } + + .vert { + stroke: ${options2.vertLineColor}; + } + + .vertText { + font-size: 15px; + text-anchor: middle; + fill: ${options2.vertLineColor} !important; + } + + .activeCritText0, + .activeCritText1, + .activeCritText2, + .activeCritText3 { + fill: ${options2.taskTextDarkColor} !important; + } + + .titleText { + text-anchor: middle; + font-size: 18px; + fill: ${options2.titleColor || options2.textColor}; + font-family: ${options2.fontFamily}; + } +`, "getStyles"); + styles_default6 = getStyles6; + } + }); + + // src/diagrams/gantt/ganttDiagram.ts + var ganttDiagram_exports = {}; + __export(ganttDiagram_exports, { + diagram: () => diagram5 + }); + var diagram5; + var init_ganttDiagram = __esm({ + "src/diagrams/gantt/ganttDiagram.ts"() { + "use strict"; + init_gantt(); + init_ganttDb(); + init_ganttRenderer(); + init_styles6(); + diagram5 = { + parser: gantt_default, + db: ganttDb_default, + renderer: ganttRenderer_default, + styles: styles_default6 + }; + } + }); + + // src/diagrams/info/infoParser.ts + var parser6; + var init_infoParser = __esm({ + "src/diagrams/info/infoParser.ts"() { + "use strict"; + init_mermaid_parser_core(); + init_logger(); + parser6 = { + parse: /* @__PURE__ */ __name(async (input) => { + const ast = await parse3("info", input); + log.debug(ast); + }, "parse") + }; + } + }); + + // src/diagrams/info/infoDb.ts + var DEFAULT_INFO_DB, getVersion, db2; + var init_infoDb = __esm({ + "src/diagrams/info/infoDb.ts"() { + "use strict"; + DEFAULT_INFO_DB = { + version: "11.15.0" + (true ? "" : "-tiny") + }; + getVersion = /* @__PURE__ */ __name(() => DEFAULT_INFO_DB.version, "getVersion"); + db2 = { + getVersion + }; + } + }); + + // src/rendering-util/selectSvgElement.ts + var selectSvgElement; + var init_selectSvgElement = __esm({ + "src/rendering-util/selectSvgElement.ts"() { + "use strict"; + init_src32(); + init_diagramAPI(); + selectSvgElement = /* @__PURE__ */ __name((id35) => { + const { securityLevel } = getConfig2(); + let root4 = select_default2("body"); + if (securityLevel === "sandbox") { + const sandboxElement = select_default2(`#i${id35}`); + const doc = sandboxElement.node()?.contentDocument ?? document; + root4 = select_default2(doc.body); + } + const svg2 = root4.select(`#${id35}`); + return svg2; + }, "selectSvgElement"); + } + }); + + // src/diagrams/info/infoRenderer.ts + var draw6, renderer3; + var init_infoRenderer = __esm({ + "src/diagrams/info/infoRenderer.ts"() { + "use strict"; + init_logger(); + init_selectSvgElement(); + init_setupGraphViewbox(); + draw6 = /* @__PURE__ */ __name((text4, id35, version3) => { + log.debug("rendering info diagram\n" + text4); + const svg2 = selectSvgElement(id35); + configureSvgSize(svg2, 100, 400, true); + const group2 = svg2.append("g"); + group2.append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${version3}`); + }, "draw"); + renderer3 = { draw: draw6 }; + } + }); + + // src/diagrams/info/infoDiagram.ts + var infoDiagram_exports = {}; + __export(infoDiagram_exports, { + diagram: () => diagram6 + }); + var diagram6; + var init_infoDiagram = __esm({ + "src/diagrams/info/infoDiagram.ts"() { + "use strict"; + init_infoParser(); + init_infoDb(); + init_infoRenderer(); + diagram6 = { + parser: parser6, + db: db2, + renderer: renderer3 + }; + } + }); + + // src/diagrams/pie/pieDb.ts + var DEFAULT_PIE_CONFIG, DEFAULT_PIE_DB, sections2, showData, config2, getConfig4, clear10, addSection2, getSections2, setShowData, getShowData, db3; + var init_pieDb = __esm({ + "src/diagrams/pie/pieDb.ts"() { + "use strict"; + init_logger(); + init_commonDb(); + init_defaultConfig(); + DEFAULT_PIE_CONFIG = defaultConfig_default.pie; + DEFAULT_PIE_DB = { + sections: /* @__PURE__ */ new Map(), + showData: false, + config: DEFAULT_PIE_CONFIG + }; + sections2 = DEFAULT_PIE_DB.sections; + showData = DEFAULT_PIE_DB.showData; + config2 = structuredClone(DEFAULT_PIE_CONFIG); + getConfig4 = /* @__PURE__ */ __name(() => structuredClone(config2), "getConfig"); + clear10 = /* @__PURE__ */ __name(() => { + sections2 = /* @__PURE__ */ new Map(); + showData = DEFAULT_PIE_DB.showData; + clear(); + }, "clear"); + addSection2 = /* @__PURE__ */ __name(({ label, value: value2 }) => { + if (value2 < 0) { + throw new Error( + `"${label}" has invalid value: ${value2}. Negative values are not allowed in pie charts. All slice values must be >= 0.` + ); + } + if (!sections2.has(label)) { + sections2.set(label, value2); + log.debug(`added new section: ${label}, with value: ${value2}`); + } + }, "addSection"); + getSections2 = /* @__PURE__ */ __name(() => sections2, "getSections"); + setShowData = /* @__PURE__ */ __name((toggle) => { + showData = toggle; + }, "setShowData"); + getShowData = /* @__PURE__ */ __name(() => showData, "getShowData"); + db3 = { + getConfig: getConfig4, + clear: clear10, + setDiagramTitle, + getDiagramTitle, + setAccTitle, + getAccTitle, + setAccDescription, + getAccDescription, + addSection: addSection2, + getSections: getSections2, + setShowData, + getShowData + }; + } + }); + + // src/diagrams/pie/pieParser.ts + var populateDb, parser7; + var init_pieParser = __esm({ + "src/diagrams/pie/pieParser.ts"() { + "use strict"; + init_mermaid_parser_core(); + init_logger(); + init_populateCommonDb(); + init_pieDb(); + populateDb = /* @__PURE__ */ __name((ast, db10) => { + populateCommonDb(ast, db10); + db10.setShowData(ast.showData); + ast.sections.map(db10.addSection); + }, "populateDb"); + parser7 = { + parse: /* @__PURE__ */ __name(async (input) => { + const ast = await parse3("pie", input); + log.debug(ast); + populateDb(ast, db3); + }, "parse") + }; + } + }); + + // src/diagrams/pie/pieStyles.ts + var getStyles7, pieStyles_default; + var init_pieStyles = __esm({ + "src/diagrams/pie/pieStyles.ts"() { + "use strict"; + getStyles7 = /* @__PURE__ */ __name((options2) => ` + .pieCircle{ + stroke: ${options2.pieStrokeColor}; + stroke-width : ${options2.pieStrokeWidth}; + opacity : ${options2.pieOpacity}; + } + .pieOuterCircle{ + stroke: ${options2.pieOuterStrokeColor}; + stroke-width: ${options2.pieOuterStrokeWidth}; + fill: none; + } + .pieTitleText { + text-anchor: middle; + font-size: ${options2.pieTitleTextSize}; + fill: ${options2.pieTitleTextColor}; + font-family: ${options2.fontFamily}; + } + .slice { + font-family: ${options2.fontFamily}; + fill: ${options2.pieSectionTextColor}; + font-size:${options2.pieSectionTextSize}; + // fill: white; + } + .legend text { + fill: ${options2.pieLegendTextColor}; + font-family: ${options2.fontFamily}; + font-size: ${options2.pieLegendTextSize}; + } +`, "getStyles"); + pieStyles_default = getStyles7; + } + }); + + // src/diagrams/pie/pieRenderer.ts + var createPieArcs, draw7, renderer4; + var init_pieRenderer = __esm({ + "src/diagrams/pie/pieRenderer.ts"() { + "use strict"; + init_src32(); + init_diagramAPI(); + init_logger(); + init_selectSvgElement(); + init_setupGraphViewbox(); + init_utils2(); + createPieArcs = /* @__PURE__ */ __name((sections6) => { + const sum2 = [...sections6.values()].reduce((acc, val) => acc + val, 0); + const pieData = [...sections6.entries()].map(([label, value2]) => ({ label, value: value2 })).filter((d3) => d3.value / sum2 * 100 >= 1); + const pie2 = pie_default().value((d3) => d3.value).sort(null); + return pie2(pieData); + }, "createPieArcs"); + draw7 = /* @__PURE__ */ __name((text4, id35, _version, diagObj) => { + log.debug("rendering pie chart\n" + text4); + const db10 = diagObj.db; + const globalConfig = getConfig2(); + const pieConfig = cleanAndMerge(db10.getConfig(), globalConfig.pie); + const MARGIN = 40; + const LEGEND_RECT_SIZE = 18; + const LEGEND_SPACING = 4; + const height2 = 450; + const pieWidth = height2; + const svg2 = selectSvgElement(id35); + const group2 = svg2.append("g"); + group2.attr("transform", "translate(" + pieWidth / 2 + "," + height2 / 2 + ")"); + const { themeVariables } = globalConfig; + let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth); + outerStrokeWidth ??= 2; + const textPosition = pieConfig.textPosition; + const radius2 = Math.min(pieWidth, height2) / 2 - MARGIN; + const arcGenerator = arc_default().innerRadius(0).outerRadius(radius2); + const labelArcGenerator = arc_default().innerRadius(radius2 * textPosition).outerRadius(radius2 * textPosition); + group2.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius2 + outerStrokeWidth / 2).attr("class", "pieOuterCircle"); + const sections6 = db10.getSections(); + const arcs = createPieArcs(sections6); + const myGeneratedColors = [ + themeVariables.pie1, + themeVariables.pie2, + themeVariables.pie3, + themeVariables.pie4, + themeVariables.pie5, + themeVariables.pie6, + themeVariables.pie7, + themeVariables.pie8, + themeVariables.pie9, + themeVariables.pie10, + themeVariables.pie11, + themeVariables.pie12 + ]; + let sum2 = 0; + sections6.forEach((section) => { + sum2 += section; + }); + const filteredArcs = arcs.filter((datum2) => (datum2.data.value / sum2 * 100).toFixed(0) !== "0"); + const color2 = ordinal(myGeneratedColors).domain([ + ...sections6.keys() + ]); + group2.selectAll("mySlices").data(filteredArcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum2) => { + return color2(datum2.data.label); + }).attr("class", "pieCircle"); + group2.selectAll("mySlices").data(filteredArcs).enter().append("text").text((datum2) => { + return (datum2.data.value / sum2 * 100).toFixed(0) + "%"; + }).attr("transform", (datum2) => { + return "translate(" + labelArcGenerator.centroid(datum2) + ")"; + }).style("text-anchor", "middle").attr("class", "slice"); + const titleText = group2.append("text").text(db10.getDiagramTitle()).attr("x", 0).attr("y", -(height2 - 50) / 2).attr("class", "pieTitleText"); + const allSectionData = [...sections6.entries()].map(([label, value2]) => ({ + label, + value: value2 + })); + const legend = group2.selectAll(".legend").data(allSectionData).enter().append("g").attr("class", "legend").attr("transform", (_datum, index) => { + const height3 = LEGEND_RECT_SIZE + LEGEND_SPACING; + const offset = height3 * allSectionData.length / 2; + const horizontal = 12 * LEGEND_RECT_SIZE; + const vertical = index * height3 - offset; + return "translate(" + horizontal + "," + vertical + ")"; + }); + legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", (d3) => color2(d3.label)).style("stroke", (d3) => color2(d3.label)); + legend.append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((d3) => { + if (db10.getShowData()) { + return `${d3.label} [${d3.value}]`; + } + return d3.label; + }); + const longestTextWidth = Math.max( + ...legend.selectAll("text").nodes().map((node2) => node2?.getBoundingClientRect().width ?? 0) + ); + const chartAndLegendWidth = pieWidth + MARGIN + LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth; + const titleWidth = titleText.node()?.getBoundingClientRect().width ?? 0; + const titleLeft = pieWidth / 2 - titleWidth / 2; + const titleRight = pieWidth / 2 + titleWidth / 2; + const viewBoxX = Math.min(0, titleLeft); + const viewBoxRight = Math.max(chartAndLegendWidth, titleRight); + const totalWidth = viewBoxRight - viewBoxX; + svg2.attr("viewBox", `${viewBoxX} 0 ${totalWidth} ${height2}`); + configureSvgSize(svg2, height2, totalWidth, pieConfig.useMaxWidth); + }, "draw"); + renderer4 = { draw: draw7 }; + } + }); + + // src/diagrams/pie/pieDiagram.ts + var pieDiagram_exports = {}; + __export(pieDiagram_exports, { + diagram: () => diagram7 + }); + var diagram7; + var init_pieDiagram = __esm({ + "src/diagrams/pie/pieDiagram.ts"() { + "use strict"; + init_pieParser(); + init_pieDb(); + init_pieStyles(); + init_pieRenderer(); + diagram7 = { + parser: parser7, + db: db3, + renderer: renderer4, + styles: pieStyles_default + }; + } + }); + + // src/diagrams/quadrant-chart/parser/quadrant.jison + var parser8, quadrant_default; + var init_quadrant = __esm({ + "src/diagrams/quadrant-chart/parser/quadrant.jison"() { + "use strict"; + parser8 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 3], $V1 = [1, 4], $V2 = [1, 5], $V3 = [1, 6], $V4 = [1, 7], $V5 = [1, 4, 5, 10, 12, 13, 14, 15, 18, 25, 35, 37, 39, 41, 42, 48, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 63, 64, 65, 66, 67], $V6 = [1, 4, 5, 10, 12, 13, 14, 15, 18, 25, 28, 35, 37, 39, 41, 42, 48, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 63, 64, 65, 66, 67], $V7 = [55, 56, 57], $V8 = [2, 36], $V9 = [1, 37], $Va = [1, 36], $Vb = [1, 38], $Vc = [1, 35], $Vd = [1, 43], $Ve = [1, 41], $Vf = [1, 45], $Vg = [1, 14], $Vh = [1, 23], $Vi = [1, 18], $Vj = [1, 19], $Vk = [1, 20], $Vl = [1, 21], $Vm = [1, 22], $Vn = [1, 24], $Vo = [1, 25], $Vp = [1, 26], $Vq = [1, 27], $Vr = [1, 28], $Vs = [1, 29], $Vt = [1, 32], $Vu = [1, 33], $Vv = [1, 34], $Vw = [1, 39], $Vx = [1, 40], $Vy = [1, 42], $Vz = [1, 44], $VA = [1, 63], $VB = [1, 62], $VC = [4, 5, 8, 10, 12, 13, 14, 15, 18, 44, 47, 49, 55, 56, 57, 63, 64, 65, 66, 67], $VD = [1, 66], $VE = [1, 67], $VF = [1, 68], $VG = [1, 69], $VH = [1, 70], $VI = [1, 71], $VJ = [1, 72], $VK = [1, 73], $VL = [1, 74], $VM = [1, 75], $VN = [1, 76], $VO = [1, 77], $VP = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18], $VQ = [1, 91], $VR = [1, 92], $VS = [1, 93], $VT = [1, 100], $VU = [1, 94], $VV = [1, 97], $VW = [1, 95], $VX = [1, 96], $VY = [1, 98], $VZ = [1, 99], $V_ = [1, 103], $V$ = [10, 55, 56, 57], $V01 = [4, 5, 6, 8, 10, 11, 13, 17, 18, 19, 20, 55, 56, 57]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "idStringToken": 3, "ALPHA": 4, "NUM": 5, "NODE_STRING": 6, "DOWN": 7, "MINUS": 8, "DEFAULT": 9, "COMMA": 10, "COLON": 11, "AMP": 12, "BRKT": 13, "MULT": 14, "UNICODE_TEXT": 15, "styleComponent": 16, "UNIT": 17, "SPACE": 18, "STYLE": 19, "PCT": 20, "idString": 21, "style": 22, "stylesOpt": 23, "classDefStatement": 24, "CLASSDEF": 25, "start": 26, "eol": 27, "QUADRANT": 28, "document": 29, "line": 30, "statement": 31, "axisDetails": 32, "quadrantDetails": 33, "points": 34, "title": 35, "title_value": 36, "acc_title": 37, "acc_title_value": 38, "acc_descr": 39, "acc_descr_value": 40, "acc_descr_multiline_value": 41, "section": 42, "text": 43, "point_start": 44, "point_x": 45, "point_y": 46, "class_name": 47, "X-AXIS": 48, "AXIS-TEXT-DELIMITER": 49, "Y-AXIS": 50, "QUADRANT_1": 51, "QUADRANT_2": 52, "QUADRANT_3": 53, "QUADRANT_4": 54, "NEWLINE": 55, "SEMI": 56, "EOF": 57, "alphaNumToken": 58, "textNoTagsToken": 59, "STR": 60, "MD_STR": 61, "alphaNum": 62, "PUNCTUATION": 63, "PLUS": 64, "EQUALS": 65, "DOT": 66, "UNDERSCORE": 67, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "ALPHA", 5: "NUM", 6: "NODE_STRING", 7: "DOWN", 8: "MINUS", 9: "DEFAULT", 10: "COMMA", 11: "COLON", 12: "AMP", 13: "BRKT", 14: "MULT", 15: "UNICODE_TEXT", 17: "UNIT", 18: "SPACE", 19: "STYLE", 20: "PCT", 25: "CLASSDEF", 28: "QUADRANT", 35: "title", 36: "title_value", 37: "acc_title", 38: "acc_title_value", 39: "acc_descr", 40: "acc_descr_value", 41: "acc_descr_multiline_value", 42: "section", 44: "point_start", 45: "point_x", 46: "point_y", 47: "class_name", 48: "X-AXIS", 49: "AXIS-TEXT-DELIMITER", 50: "Y-AXIS", 51: "QUADRANT_1", 52: "QUADRANT_2", 53: "QUADRANT_3", 54: "QUADRANT_4", 55: "NEWLINE", 56: "SEMI", 57: "EOF", 60: "STR", 61: "MD_STR", 63: "PUNCTUATION", 64: "PLUS", 65: "EQUALS", 66: "DOT", 67: "UNDERSCORE" }, + productions_: [0, [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [16, 1], [21, 1], [21, 2], [22, 1], [22, 2], [23, 1], [23, 3], [24, 5], [26, 2], [26, 2], [26, 2], [29, 0], [29, 2], [30, 2], [31, 0], [31, 1], [31, 2], [31, 1], [31, 1], [31, 1], [31, 2], [31, 2], [31, 2], [31, 1], [31, 1], [34, 4], [34, 5], [34, 5], [34, 6], [32, 4], [32, 3], [32, 2], [32, 4], [32, 3], [32, 2], [33, 2], [33, 2], [33, 2], [33, 2], [27, 1], [27, 1], [27, 1], [43, 1], [43, 2], [43, 1], [43, 1], [62, 1], [62, 2], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [58, 1], [59, 1], [59, 1], [59, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 23: + this.$ = $$[$0]; + break; + case 24: + this.$ = $$[$0 - 1] + "" + $$[$0]; + break; + case 26: + this.$ = $$[$0 - 1] + $$[$0]; + break; + case 27: + this.$ = [$$[$0].trim()]; + break; + case 28: + $$[$0 - 2].push($$[$0].trim()); + this.$ = $$[$0 - 2]; + break; + case 29: + this.$ = $$[$0 - 4]; + yy.addClass($$[$0 - 2], $$[$0]); + break; + case 37: + this.$ = []; + break; + case 42: + this.$ = $$[$0].trim(); + yy.setDiagramTitle(this.$); + break; + case 43: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 44: + case 45: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 46: + yy.addSection($$[$0].substr(8)); + this.$ = $$[$0].substr(8); + break; + case 47: + yy.addPoint($$[$0 - 3], "", $$[$0 - 1], $$[$0], []); + break; + case 48: + yy.addPoint($$[$0 - 4], $$[$0 - 3], $$[$0 - 1], $$[$0], []); + break; + case 49: + yy.addPoint($$[$0 - 4], "", $$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 50: + yy.addPoint($$[$0 - 5], $$[$0 - 4], $$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 51: + yy.setXAxisLeftText($$[$0 - 2]); + yy.setXAxisRightText($$[$0]); + break; + case 52: + $$[$0 - 1].text += " \u27F6 "; + yy.setXAxisLeftText($$[$0 - 1]); + break; + case 53: + yy.setXAxisLeftText($$[$0]); + break; + case 54: + yy.setYAxisBottomText($$[$0 - 2]); + yy.setYAxisTopText($$[$0]); + break; + case 55: + $$[$0 - 1].text += " \u27F6 "; + yy.setYAxisBottomText($$[$0 - 1]); + break; + case 56: + yy.setYAxisBottomText($$[$0]); + break; + case 57: + yy.setQuadrant1Text($$[$0]); + break; + case 58: + yy.setQuadrant2Text($$[$0]); + break; + case 59: + yy.setQuadrant3Text($$[$0]); + break; + case 60: + yy.setQuadrant4Text($$[$0]); + break; + case 64: + this.$ = { text: $$[$0], type: "text" }; + break; + case 65: + this.$ = { text: $$[$0 - 1].text + "" + $$[$0], type: $$[$0 - 1].type }; + break; + case 66: + this.$ = { text: $$[$0], type: "text" }; + break; + case 67: + this.$ = { text: $$[$0], type: "markdown" }; + break; + case 68: + this.$ = $$[$0]; + break; + case 69: + this.$ = $$[$0 - 1] + "" + $$[$0]; + break; + } + }, "anonymous"), + table: [{ 18: $V0, 26: 1, 27: 2, 28: $V1, 55: $V2, 56: $V3, 57: $V4 }, { 1: [3] }, { 18: $V0, 26: 8, 27: 2, 28: $V1, 55: $V2, 56: $V3, 57: $V4 }, { 18: $V0, 26: 9, 27: 2, 28: $V1, 55: $V2, 56: $V3, 57: $V4 }, o2($V5, [2, 33], { 29: 10 }), o2($V6, [2, 61]), o2($V6, [2, 62]), o2($V6, [2, 63]), { 1: [2, 30] }, { 1: [2, 31] }, o2($V7, $V8, { 30: 11, 31: 12, 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 1: [2, 32], 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $Vg, 25: $Vh, 35: $Vi, 37: $Vj, 39: $Vk, 41: $Vl, 42: $Vm, 48: $Vn, 50: $Vo, 51: $Vp, 52: $Vq, 53: $Vr, 54: $Vs, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V5, [2, 34]), { 27: 46, 55: $V2, 56: $V3, 57: $V4 }, o2($V7, [2, 37]), o2($V7, $V8, { 24: 13, 32: 15, 33: 16, 34: 17, 43: 30, 58: 31, 31: 47, 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $Vg, 25: $Vh, 35: $Vi, 37: $Vj, 39: $Vk, 41: $Vl, 42: $Vm, 48: $Vn, 50: $Vo, 51: $Vp, 52: $Vq, 53: $Vr, 54: $Vs, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V7, [2, 39]), o2($V7, [2, 40]), o2($V7, [2, 41]), { 36: [1, 48] }, { 38: [1, 49] }, { 40: [1, 50] }, o2($V7, [2, 45]), o2($V7, [2, 46]), { 18: [1, 51] }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 43: 52, 58: 31, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 43: 53, 58: 31, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 43: 54, 58: 31, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 43: 55, 58: 31, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 43: 56, 58: 31, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }, { 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 43: 57, 58: 31, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }, { 4: $V9, 5: $Va, 8: $VA, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $VB, 44: [1, 58], 47: [1, 59], 58: 61, 59: 60, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }, o2($VC, [2, 64]), o2($VC, [2, 66]), o2($VC, [2, 67]), o2($VC, [2, 70]), o2($VC, [2, 71]), o2($VC, [2, 72]), o2($VC, [2, 73]), o2($VC, [2, 74]), o2($VC, [2, 75]), o2($VC, [2, 76]), o2($VC, [2, 77]), o2($VC, [2, 78]), o2($VC, [2, 79]), o2($VC, [2, 80]), o2($VC, [2, 81]), o2($V5, [2, 35]), o2($V7, [2, 38]), o2($V7, [2, 42]), o2($V7, [2, 43]), o2($V7, [2, 44]), { 3: 65, 4: $VD, 5: $VE, 6: $VF, 7: $VG, 8: $VH, 9: $VI, 10: $VJ, 11: $VK, 12: $VL, 13: $VM, 14: $VN, 15: $VO, 21: 64 }, o2($V7, [2, 53], { 59: 60, 58: 61, 4: $V9, 5: $Va, 8: $VA, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $VB, 49: [1, 78], 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V7, [2, 56], { 59: 60, 58: 61, 4: $V9, 5: $Va, 8: $VA, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $VB, 49: [1, 79], 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V7, [2, 57], { 59: 60, 58: 61, 4: $V9, 5: $Va, 8: $VA, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $VB, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V7, [2, 58], { 59: 60, 58: 61, 4: $V9, 5: $Va, 8: $VA, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $VB, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V7, [2, 59], { 59: 60, 58: 61, 4: $V9, 5: $Va, 8: $VA, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $VB, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V7, [2, 60], { 59: 60, 58: 61, 4: $V9, 5: $Va, 8: $VA, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $VB, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), { 45: [1, 80] }, { 44: [1, 81] }, o2($VC, [2, 65]), o2($VC, [2, 82]), o2($VC, [2, 83]), o2($VC, [2, 84]), { 3: 83, 4: $VD, 5: $VE, 6: $VF, 7: $VG, 8: $VH, 9: $VI, 10: $VJ, 11: $VK, 12: $VL, 13: $VM, 14: $VN, 15: $VO, 18: [1, 82] }, o2($VP, [2, 23]), o2($VP, [2, 1]), o2($VP, [2, 2]), o2($VP, [2, 3]), o2($VP, [2, 4]), o2($VP, [2, 5]), o2($VP, [2, 6]), o2($VP, [2, 7]), o2($VP, [2, 8]), o2($VP, [2, 9]), o2($VP, [2, 10]), o2($VP, [2, 11]), o2($VP, [2, 12]), o2($V7, [2, 52], { 58: 31, 43: 84, 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V7, [2, 55], { 58: 31, 43: 85, 4: $V9, 5: $Va, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 60: $Vt, 61: $Vu, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), { 46: [1, 86] }, { 45: [1, 87] }, { 4: $VQ, 5: $VR, 6: $VS, 8: $VT, 11: $VU, 13: $VV, 16: 90, 17: $VW, 18: $VX, 19: $VY, 20: $VZ, 22: 89, 23: 88 }, o2($VP, [2, 24]), o2($V7, [2, 51], { 59: 60, 58: 61, 4: $V9, 5: $Va, 8: $VA, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $VB, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V7, [2, 54], { 59: 60, 58: 61, 4: $V9, 5: $Va, 8: $VA, 10: $Vb, 12: $Vc, 13: $Vd, 14: $Ve, 15: $Vf, 18: $VB, 63: $Vv, 64: $Vw, 65: $Vx, 66: $Vy, 67: $Vz }), o2($V7, [2, 47], { 22: 89, 16: 90, 23: 101, 4: $VQ, 5: $VR, 6: $VS, 8: $VT, 11: $VU, 13: $VV, 17: $VW, 18: $VX, 19: $VY, 20: $VZ }), { 46: [1, 102] }, o2($V7, [2, 29], { 10: $V_ }), o2($V$, [2, 27], { 16: 104, 4: $VQ, 5: $VR, 6: $VS, 8: $VT, 11: $VU, 13: $VV, 17: $VW, 18: $VX, 19: $VY, 20: $VZ }), o2($V01, [2, 25]), o2($V01, [2, 13]), o2($V01, [2, 14]), o2($V01, [2, 15]), o2($V01, [2, 16]), o2($V01, [2, 17]), o2($V01, [2, 18]), o2($V01, [2, 19]), o2($V01, [2, 20]), o2($V01, [2, 21]), o2($V01, [2, 22]), o2($V7, [2, 49], { 10: $V_ }), o2($V7, [2, 48], { 22: 89, 16: 90, 23: 105, 4: $VQ, 5: $VR, 6: $VS, 8: $VT, 11: $VU, 13: $VV, 17: $VW, 18: $VX, 19: $VY, 20: $VZ }), { 4: $VQ, 5: $VR, 6: $VS, 8: $VT, 11: $VU, 13: $VV, 16: 90, 17: $VW, 18: $VX, 19: $VY, 20: $VZ, 22: 106 }, o2($V01, [2, 26]), o2($V7, [2, 50], { 10: $V_ }), o2($V$, [2, 28], { 16: 104, 4: $VQ, 5: $VR, 6: $VS, 8: $VT, 11: $VU, 13: $VV, 17: $VW, 18: $VX, 19: $VY, 20: $VZ })], + defaultActions: { 8: [2, 30], 9: [2, 31] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + break; + case 1: + break; + case 2: + return 55; + break; + case 3: + break; + case 4: + this.begin("title"); + return 35; + break; + case 5: + this.popState(); + return "title_value"; + break; + case 6: + this.begin("acc_title"); + return 37; + break; + case 7: + this.popState(); + return "acc_title_value"; + break; + case 8: + this.begin("acc_descr"); + return 39; + break; + case 9: + this.popState(); + return "acc_descr_value"; + break; + case 10: + this.begin("acc_descr_multiline"); + break; + case 11: + this.popState(); + break; + case 12: + return "acc_descr_multiline_value"; + break; + case 13: + return 48; + break; + case 14: + return 50; + break; + case 15: + return 49; + break; + case 16: + return 51; + break; + case 17: + return 52; + break; + case 18: + return 53; + break; + case 19: + return 54; + break; + case 20: + return 25; + break; + case 21: + this.begin("md_string"); + break; + case 22: + return "MD_STR"; + break; + case 23: + this.popState(); + break; + case 24: + this.begin("string"); + break; + case 25: + this.popState(); + break; + case 26: + return "STR"; + break; + case 27: + this.begin("class_name"); + break; + case 28: + this.popState(); + return 47; + break; + case 29: + this.begin("point_start"); + return 44; + break; + case 30: + this.begin("point_x"); + return 45; + break; + case 31: + this.popState(); + break; + case 32: + this.popState(); + this.begin("point_y"); + break; + case 33: + this.popState(); + return 46; + break; + case 34: + return 28; + break; + case 35: + return 4; + break; + case 36: + return 15; + break; + case 37: + return 11; + break; + case 38: + return 64; + break; + case 39: + return 10; + break; + case 40: + return 65; + break; + case 41: + return 65; + break; + case 42: + return 14; + break; + case 43: + return 13; + break; + case 44: + return 67; + break; + case 45: + return 66; + break; + case 46: + return 12; + break; + case 47: + return 8; + break; + case 48: + return 5; + break; + case 49: + return 18; + break; + case 50: + return 56; + break; + case 51: + return 63; + break; + case 52: + return 57; + break; + } + }, "anonymous"), + rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?: *x-axis *)/i, /^(?: *y-axis *)/i, /^(?: *--+> *)/i, /^(?: *quadrant-1 *)/i, /^(?: *quadrant-2 *)/i, /^(?: *quadrant-3 *)/i, /^(?: *quadrant-4 *)/i, /^(?:classDef\b)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?::::)/i, /^(?:^\w+)/i, /^(?:\s*:\s*\[\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?:\s*\] *)/i, /^(?:\s*,\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?: *quadrantChart *)/i, /^(?:[A-Za-z]+)/i, /^(?:[^\x00-\x7F]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s)/i, /^(?:;)/i, /^(?:[!"#$%&'*+,-.`?\\_/])/i, /^(?:$)/i], + conditions: { "class_name": { "rules": [28], "inclusive": false }, "point_y": { "rules": [33], "inclusive": false }, "point_x": { "rules": [32], "inclusive": false }, "point_start": { "rules": [30, 31], "inclusive": false }, "acc_descr_multiline": { "rules": [11, 12], "inclusive": false }, "acc_descr": { "rules": [9], "inclusive": false }, "acc_title": { "rules": [7], "inclusive": false }, "title": { "rules": [5], "inclusive": false }, "md_string": { "rules": [22, 23], "inclusive": false }, "string": { "rules": [25, 26], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 27, 29, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser8.parser = parser8; + quadrant_default = parser8; + } + }); + + // src/diagrams/quadrant-chart/quadrantBuilder.ts + var defaultThemeVariables, QuadrantBuilder; + var init_quadrantBuilder = __esm({ + "src/diagrams/quadrant-chart/quadrantBuilder.ts"() { + "use strict"; + init_src32(); + init_defaultConfig(); + init_logger(); + init_theme_default(); + defaultThemeVariables = getThemeVariables3(); + QuadrantBuilder = class { + constructor() { + this.classes = /* @__PURE__ */ new Map(); + this.config = this.getDefaultConfig(); + this.themeConfig = this.getDefaultThemeConfig(); + this.data = this.getDefaultData(); + } + static { + __name(this, "QuadrantBuilder"); + } + getDefaultData() { + return { + titleText: "", + quadrant1Text: "", + quadrant2Text: "", + quadrant3Text: "", + quadrant4Text: "", + xAxisLeftText: "", + xAxisRightText: "", + yAxisBottomText: "", + yAxisTopText: "", + points: [] + }; + } + getDefaultConfig() { + return { + showXAxis: true, + showYAxis: true, + showTitle: true, + chartHeight: defaultConfig_default.quadrantChart?.chartWidth || 500, + chartWidth: defaultConfig_default.quadrantChart?.chartHeight || 500, + titlePadding: defaultConfig_default.quadrantChart?.titlePadding || 10, + titleFontSize: defaultConfig_default.quadrantChart?.titleFontSize || 20, + quadrantPadding: defaultConfig_default.quadrantChart?.quadrantPadding || 5, + xAxisLabelPadding: defaultConfig_default.quadrantChart?.xAxisLabelPadding || 5, + yAxisLabelPadding: defaultConfig_default.quadrantChart?.yAxisLabelPadding || 5, + xAxisLabelFontSize: defaultConfig_default.quadrantChart?.xAxisLabelFontSize || 16, + yAxisLabelFontSize: defaultConfig_default.quadrantChart?.yAxisLabelFontSize || 16, + quadrantLabelFontSize: defaultConfig_default.quadrantChart?.quadrantLabelFontSize || 16, + quadrantTextTopPadding: defaultConfig_default.quadrantChart?.quadrantTextTopPadding || 5, + pointTextPadding: defaultConfig_default.quadrantChart?.pointTextPadding || 5, + pointLabelFontSize: defaultConfig_default.quadrantChart?.pointLabelFontSize || 12, + pointRadius: defaultConfig_default.quadrantChart?.pointRadius || 5, + xAxisPosition: defaultConfig_default.quadrantChart?.xAxisPosition || "top", + yAxisPosition: defaultConfig_default.quadrantChart?.yAxisPosition || "left", + quadrantInternalBorderStrokeWidth: defaultConfig_default.quadrantChart?.quadrantInternalBorderStrokeWidth || 1, + quadrantExternalBorderStrokeWidth: defaultConfig_default.quadrantChart?.quadrantExternalBorderStrokeWidth || 2 + }; + } + getDefaultThemeConfig() { + return { + quadrant1Fill: defaultThemeVariables.quadrant1Fill, + quadrant2Fill: defaultThemeVariables.quadrant2Fill, + quadrant3Fill: defaultThemeVariables.quadrant3Fill, + quadrant4Fill: defaultThemeVariables.quadrant4Fill, + quadrant1TextFill: defaultThemeVariables.quadrant1TextFill, + quadrant2TextFill: defaultThemeVariables.quadrant2TextFill, + quadrant3TextFill: defaultThemeVariables.quadrant3TextFill, + quadrant4TextFill: defaultThemeVariables.quadrant4TextFill, + quadrantPointFill: defaultThemeVariables.quadrantPointFill, + quadrantPointTextFill: defaultThemeVariables.quadrantPointTextFill, + quadrantXAxisTextFill: defaultThemeVariables.quadrantXAxisTextFill, + quadrantYAxisTextFill: defaultThemeVariables.quadrantYAxisTextFill, + quadrantTitleFill: defaultThemeVariables.quadrantTitleFill, + quadrantInternalBorderStrokeFill: defaultThemeVariables.quadrantInternalBorderStrokeFill, + quadrantExternalBorderStrokeFill: defaultThemeVariables.quadrantExternalBorderStrokeFill + }; + } + clear() { + this.config = this.getDefaultConfig(); + this.themeConfig = this.getDefaultThemeConfig(); + this.data = this.getDefaultData(); + this.classes = /* @__PURE__ */ new Map(); + log.info("clear called"); + } + setData(data5) { + this.data = { ...this.data, ...data5 }; + } + addPoints(points) { + this.data.points = [...points, ...this.data.points]; + } + addClass(className, styles6) { + this.classes.set(className, styles6); + } + setConfig(config5) { + log.trace("setConfig called with: ", config5); + this.config = { ...this.config, ...config5 }; + } + setThemeConfig(themeConfig) { + log.trace("setThemeConfig called with: ", themeConfig); + this.themeConfig = { ...this.themeConfig, ...themeConfig }; + } + calculateSpace(xAxisPosition, showXAxis, showYAxis, showTitle) { + const xAxisSpaceCalculation = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize; + const xAxisSpace = { + top: xAxisPosition === "top" && showXAxis ? xAxisSpaceCalculation : 0, + bottom: xAxisPosition === "bottom" && showXAxis ? xAxisSpaceCalculation : 0 + }; + const yAxisSpaceCalculation = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize; + const yAxisSpace = { + left: this.config.yAxisPosition === "left" && showYAxis ? yAxisSpaceCalculation : 0, + right: this.config.yAxisPosition === "right" && showYAxis ? yAxisSpaceCalculation : 0 + }; + const titleSpaceCalculation = this.config.titleFontSize + this.config.titlePadding * 2; + const titleSpace = { + top: showTitle ? titleSpaceCalculation : 0 + }; + const quadrantLeft = this.config.quadrantPadding + yAxisSpace.left; + const quadrantTop = this.config.quadrantPadding + xAxisSpace.top + titleSpace.top; + const quadrantWidth = this.config.chartWidth - this.config.quadrantPadding * 2 - yAxisSpace.left - yAxisSpace.right; + const quadrantHeight = this.config.chartHeight - this.config.quadrantPadding * 2 - xAxisSpace.top - xAxisSpace.bottom - titleSpace.top; + const quadrantHalfWidth = quadrantWidth / 2; + const quadrantHalfHeight = quadrantHeight / 2; + const quadrantSpace = { + quadrantLeft, + quadrantTop, + quadrantWidth, + quadrantHalfWidth, + quadrantHeight, + quadrantHalfHeight + }; + return { + xAxisSpace, + yAxisSpace, + titleSpace, + quadrantSpace + }; + } + getAxisLabels(xAxisPosition, showXAxis, showYAxis, spaceData) { + const { quadrantSpace, titleSpace } = spaceData; + const { + quadrantHalfHeight, + quadrantHeight, + quadrantLeft, + quadrantHalfWidth, + quadrantTop, + quadrantWidth + } = quadrantSpace; + const drawXAxisLabelsInMiddle = Boolean(this.data.xAxisRightText); + const drawYAxisLabelsInMiddle = Boolean(this.data.yAxisTopText); + const axisLabels = []; + if (this.data.xAxisLeftText && showXAxis) { + axisLabels.push({ + text: this.data.xAxisLeftText, + fill: this.themeConfig.quadrantXAxisTextFill, + x: quadrantLeft + (drawXAxisLabelsInMiddle ? quadrantHalfWidth / 2 : 0), + y: xAxisPosition === "top" ? this.config.xAxisLabelPadding + titleSpace.top : this.config.xAxisLabelPadding + quadrantTop + quadrantHeight + this.config.quadrantPadding, + fontSize: this.config.xAxisLabelFontSize, + verticalPos: drawXAxisLabelsInMiddle ? "center" : "left", + horizontalPos: "top", + rotation: 0 + }); + } + if (this.data.xAxisRightText && showXAxis) { + axisLabels.push({ + text: this.data.xAxisRightText, + fill: this.themeConfig.quadrantXAxisTextFill, + x: quadrantLeft + quadrantHalfWidth + (drawXAxisLabelsInMiddle ? quadrantHalfWidth / 2 : 0), + y: xAxisPosition === "top" ? this.config.xAxisLabelPadding + titleSpace.top : this.config.xAxisLabelPadding + quadrantTop + quadrantHeight + this.config.quadrantPadding, + fontSize: this.config.xAxisLabelFontSize, + verticalPos: drawXAxisLabelsInMiddle ? "center" : "left", + horizontalPos: "top", + rotation: 0 + }); + } + if (this.data.yAxisBottomText && showYAxis) { + axisLabels.push({ + text: this.data.yAxisBottomText, + fill: this.themeConfig.quadrantYAxisTextFill, + x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + quadrantLeft + quadrantWidth + this.config.quadrantPadding, + y: quadrantTop + quadrantHeight - (drawYAxisLabelsInMiddle ? quadrantHalfHeight / 2 : 0), + fontSize: this.config.yAxisLabelFontSize, + verticalPos: drawYAxisLabelsInMiddle ? "center" : "left", + horizontalPos: "top", + rotation: -90 + }); + } + if (this.data.yAxisTopText && showYAxis) { + axisLabels.push({ + text: this.data.yAxisTopText, + fill: this.themeConfig.quadrantYAxisTextFill, + x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + quadrantLeft + quadrantWidth + this.config.quadrantPadding, + y: quadrantTop + quadrantHalfHeight - (drawYAxisLabelsInMiddle ? quadrantHalfHeight / 2 : 0), + fontSize: this.config.yAxisLabelFontSize, + verticalPos: drawYAxisLabelsInMiddle ? "center" : "left", + horizontalPos: "top", + rotation: -90 + }); + } + return axisLabels; + } + getQuadrants(spaceData) { + const { quadrantSpace } = spaceData; + const { quadrantHalfHeight, quadrantLeft, quadrantHalfWidth, quadrantTop } = quadrantSpace; + const quadrants = [ + { + text: { + text: this.data.quadrant1Text, + fill: this.themeConfig.quadrant1TextFill, + x: 0, + y: 0, + fontSize: this.config.quadrantLabelFontSize, + verticalPos: "center", + horizontalPos: "middle", + rotation: 0 + }, + x: quadrantLeft + quadrantHalfWidth, + y: quadrantTop, + width: quadrantHalfWidth, + height: quadrantHalfHeight, + fill: this.themeConfig.quadrant1Fill + }, + { + text: { + text: this.data.quadrant2Text, + fill: this.themeConfig.quadrant2TextFill, + x: 0, + y: 0, + fontSize: this.config.quadrantLabelFontSize, + verticalPos: "center", + horizontalPos: "middle", + rotation: 0 + }, + x: quadrantLeft, + y: quadrantTop, + width: quadrantHalfWidth, + height: quadrantHalfHeight, + fill: this.themeConfig.quadrant2Fill + }, + { + text: { + text: this.data.quadrant3Text, + fill: this.themeConfig.quadrant3TextFill, + x: 0, + y: 0, + fontSize: this.config.quadrantLabelFontSize, + verticalPos: "center", + horizontalPos: "middle", + rotation: 0 + }, + x: quadrantLeft, + y: quadrantTop + quadrantHalfHeight, + width: quadrantHalfWidth, + height: quadrantHalfHeight, + fill: this.themeConfig.quadrant3Fill + }, + { + text: { + text: this.data.quadrant4Text, + fill: this.themeConfig.quadrant4TextFill, + x: 0, + y: 0, + fontSize: this.config.quadrantLabelFontSize, + verticalPos: "center", + horizontalPos: "middle", + rotation: 0 + }, + x: quadrantLeft + quadrantHalfWidth, + y: quadrantTop + quadrantHalfHeight, + width: quadrantHalfWidth, + height: quadrantHalfHeight, + fill: this.themeConfig.quadrant4Fill + } + ]; + for (const quadrant of quadrants) { + quadrant.text.x = quadrant.x + quadrant.width / 2; + if (this.data.points.length === 0) { + quadrant.text.y = quadrant.y + quadrant.height / 2; + quadrant.text.horizontalPos = "middle"; + } else { + quadrant.text.y = quadrant.y + this.config.quadrantTextTopPadding; + quadrant.text.horizontalPos = "top"; + } + } + return quadrants; + } + getQuadrantPoints(spaceData) { + const { quadrantSpace } = spaceData; + const { quadrantHeight, quadrantLeft, quadrantTop, quadrantWidth } = quadrantSpace; + const xAxis = linear2().domain([0, 1]).range([quadrantLeft, quadrantWidth + quadrantLeft]); + const yAxis = linear2().domain([0, 1]).range([quadrantHeight + quadrantTop, quadrantTop]); + const points = this.data.points.map((point8) => { + const classStyles = this.classes.get(point8.className); + if (classStyles) { + point8 = { ...classStyles, ...point8 }; + } + const props = { + x: xAxis(point8.x), + y: yAxis(point8.y), + fill: point8.color ?? this.themeConfig.quadrantPointFill, + radius: point8.radius ?? this.config.pointRadius, + text: { + text: point8.text, + fill: this.themeConfig.quadrantPointTextFill, + x: xAxis(point8.x), + y: yAxis(point8.y) + this.config.pointTextPadding, + verticalPos: "center", + horizontalPos: "top", + fontSize: this.config.pointLabelFontSize, + rotation: 0 + }, + strokeColor: point8.strokeColor ?? this.themeConfig.quadrantPointFill, + strokeWidth: point8.strokeWidth ?? "0px" + }; + return props; + }); + return points; + } + getBorders(spaceData) { + const halfExternalBorderWidth = this.config.quadrantExternalBorderStrokeWidth / 2; + const { quadrantSpace } = spaceData; + const { + quadrantHalfHeight, + quadrantHeight, + quadrantLeft, + quadrantHalfWidth, + quadrantTop, + quadrantWidth + } = quadrantSpace; + const borderLines = [ + // top border + { + strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill, + strokeWidth: this.config.quadrantExternalBorderStrokeWidth, + x1: quadrantLeft - halfExternalBorderWidth, + y1: quadrantTop, + x2: quadrantLeft + quadrantWidth + halfExternalBorderWidth, + y2: quadrantTop + }, + // right border + { + strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill, + strokeWidth: this.config.quadrantExternalBorderStrokeWidth, + x1: quadrantLeft + quadrantWidth, + y1: quadrantTop + halfExternalBorderWidth, + x2: quadrantLeft + quadrantWidth, + y2: quadrantTop + quadrantHeight - halfExternalBorderWidth + }, + // bottom border + { + strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill, + strokeWidth: this.config.quadrantExternalBorderStrokeWidth, + x1: quadrantLeft - halfExternalBorderWidth, + y1: quadrantTop + quadrantHeight, + x2: quadrantLeft + quadrantWidth + halfExternalBorderWidth, + y2: quadrantTop + quadrantHeight + }, + // left border + { + strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill, + strokeWidth: this.config.quadrantExternalBorderStrokeWidth, + x1: quadrantLeft, + y1: quadrantTop + halfExternalBorderWidth, + x2: quadrantLeft, + y2: quadrantTop + quadrantHeight - halfExternalBorderWidth + }, + // vertical inner border + { + strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill, + strokeWidth: this.config.quadrantInternalBorderStrokeWidth, + x1: quadrantLeft + quadrantHalfWidth, + y1: quadrantTop + halfExternalBorderWidth, + x2: quadrantLeft + quadrantHalfWidth, + y2: quadrantTop + quadrantHeight - halfExternalBorderWidth + }, + // horizontal inner border + { + strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill, + strokeWidth: this.config.quadrantInternalBorderStrokeWidth, + x1: quadrantLeft + halfExternalBorderWidth, + y1: quadrantTop + quadrantHalfHeight, + x2: quadrantLeft + quadrantWidth - halfExternalBorderWidth, + y2: quadrantTop + quadrantHalfHeight + } + ]; + return borderLines; + } + getTitle(showTitle) { + if (showTitle) { + return { + text: this.data.titleText, + fill: this.themeConfig.quadrantTitleFill, + fontSize: this.config.titleFontSize, + horizontalPos: "top", + verticalPos: "center", + rotation: 0, + y: this.config.titlePadding, + x: this.config.chartWidth / 2 + }; + } + return; + } + build() { + const showXAxis = this.config.showXAxis && !!(this.data.xAxisLeftText || this.data.xAxisRightText); + const showYAxis = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText); + const showTitle = this.config.showTitle && !!this.data.titleText; + const xAxisPosition = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition; + const calculatedSpace = this.calculateSpace(xAxisPosition, showXAxis, showYAxis, showTitle); + return { + points: this.getQuadrantPoints(calculatedSpace), + quadrants: this.getQuadrants(calculatedSpace), + axisLabels: this.getAxisLabels(xAxisPosition, showXAxis, showYAxis, calculatedSpace), + borderLines: this.getBorders(calculatedSpace), + title: this.getTitle(showTitle) + }; + } + }; + } + }); + + // src/diagrams/quadrant-chart/utils.ts + function validateHexCode(value2) { + return !/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(value2); + } + function validateNumber(value2) { + return !/^\d+$/.test(value2); + } + function validateSizeInPixels(value2) { + return !/^\d+px$/.test(value2); + } + var InvalidStyleError; + var init_utils3 = __esm({ + "src/diagrams/quadrant-chart/utils.ts"() { + "use strict"; + InvalidStyleError = class extends Error { + static { + __name(this, "InvalidStyleError"); + } + constructor(style3, value2, type3) { + super(`value for ${style3} ${value2} is invalid, please use a valid ${type3}`); + this.name = "InvalidStyleError"; + } + }; + __name(validateHexCode, "validateHexCode"); + __name(validateNumber, "validateNumber"); + __name(validateSizeInPixels, "validateSizeInPixels"); + } + }); + + // src/diagrams/quadrant-chart/quadrantDb.ts + function textSanitizer(text4) { + return sanitizeText(text4.trim(), config3); + } + function setQuadrant1Text(textObj) { + quadrantBuilder.setData({ quadrant1Text: textSanitizer(textObj.text) }); + } + function setQuadrant2Text(textObj) { + quadrantBuilder.setData({ quadrant2Text: textSanitizer(textObj.text) }); + } + function setQuadrant3Text(textObj) { + quadrantBuilder.setData({ quadrant3Text: textSanitizer(textObj.text) }); + } + function setQuadrant4Text(textObj) { + quadrantBuilder.setData({ quadrant4Text: textSanitizer(textObj.text) }); + } + function setXAxisLeftText(textObj) { + quadrantBuilder.setData({ xAxisLeftText: textSanitizer(textObj.text) }); + } + function setXAxisRightText(textObj) { + quadrantBuilder.setData({ xAxisRightText: textSanitizer(textObj.text) }); + } + function setYAxisTopText(textObj) { + quadrantBuilder.setData({ yAxisTopText: textSanitizer(textObj.text) }); + } + function setYAxisBottomText(textObj) { + quadrantBuilder.setData({ yAxisBottomText: textSanitizer(textObj.text) }); + } + function parseStyles(styles6) { + const stylesObject = {}; + for (const style3 of styles6) { + const [key, value2] = style3.trim().split(/\s*:\s*/); + if (key === "radius") { + if (validateNumber(value2)) { + throw new InvalidStyleError(key, value2, "number"); + } + stylesObject.radius = parseInt(value2); + } else if (key === "color") { + if (validateHexCode(value2)) { + throw new InvalidStyleError(key, value2, "hex code"); + } + stylesObject.color = value2; + } else if (key === "stroke-color") { + if (validateHexCode(value2)) { + throw new InvalidStyleError(key, value2, "hex code"); + } + stylesObject.strokeColor = value2; + } else if (key === "stroke-width") { + if (validateSizeInPixels(value2)) { + throw new InvalidStyleError(key, value2, "number of pixels (eg. 10px)"); + } + stylesObject.strokeWidth = value2; + } else { + throw new Error(`style named ${key} is not supported.`); + } + } + return stylesObject; + } + function addPoint(textObj, className, x5, y6, styles6) { + const stylesObject = parseStyles(styles6); + quadrantBuilder.addPoints([ + { + x: x5, + y: y6, + text: textSanitizer(textObj.text), + className, + ...stylesObject + } + ]); + } + function addClass2(className, styles6) { + quadrantBuilder.addClass(className, parseStyles(styles6)); + } + function setWidth(width3) { + quadrantBuilder.setConfig({ chartWidth: width3 }); + } + function setHeight(height2) { + quadrantBuilder.setConfig({ chartHeight: height2 }); + } + function getQuadrantData() { + const config5 = getConfig2(); + const { themeVariables, quadrantChart: quadrantChartConfig } = config5; + if (quadrantChartConfig) { + quadrantBuilder.setConfig(quadrantChartConfig); + } + quadrantBuilder.setThemeConfig({ + quadrant1Fill: themeVariables.quadrant1Fill, + quadrant2Fill: themeVariables.quadrant2Fill, + quadrant3Fill: themeVariables.quadrant3Fill, + quadrant4Fill: themeVariables.quadrant4Fill, + quadrant1TextFill: themeVariables.quadrant1TextFill, + quadrant2TextFill: themeVariables.quadrant2TextFill, + quadrant3TextFill: themeVariables.quadrant3TextFill, + quadrant4TextFill: themeVariables.quadrant4TextFill, + quadrantPointFill: themeVariables.quadrantPointFill, + quadrantPointTextFill: themeVariables.quadrantPointTextFill, + quadrantXAxisTextFill: themeVariables.quadrantXAxisTextFill, + quadrantYAxisTextFill: themeVariables.quadrantYAxisTextFill, + quadrantExternalBorderStrokeFill: themeVariables.quadrantExternalBorderStrokeFill, + quadrantInternalBorderStrokeFill: themeVariables.quadrantInternalBorderStrokeFill, + quadrantTitleFill: themeVariables.quadrantTitleFill + }); + quadrantBuilder.setData({ titleText: getDiagramTitle() }); + return quadrantBuilder.build(); + } + var config3, quadrantBuilder, clear11, quadrantDb_default; + var init_quadrantDb = __esm({ + "src/diagrams/quadrant-chart/quadrantDb.ts"() { + "use strict"; + init_diagramAPI(); + init_common(); + init_commonDb(); + init_quadrantBuilder(); + init_utils3(); + config3 = getConfig2(); + __name(textSanitizer, "textSanitizer"); + quadrantBuilder = new QuadrantBuilder(); + __name(setQuadrant1Text, "setQuadrant1Text"); + __name(setQuadrant2Text, "setQuadrant2Text"); + __name(setQuadrant3Text, "setQuadrant3Text"); + __name(setQuadrant4Text, "setQuadrant4Text"); + __name(setXAxisLeftText, "setXAxisLeftText"); + __name(setXAxisRightText, "setXAxisRightText"); + __name(setYAxisTopText, "setYAxisTopText"); + __name(setYAxisBottomText, "setYAxisBottomText"); + __name(parseStyles, "parseStyles"); + __name(addPoint, "addPoint"); + __name(addClass2, "addClass"); + __name(setWidth, "setWidth"); + __name(setHeight, "setHeight"); + __name(getQuadrantData, "getQuadrantData"); + clear11 = /* @__PURE__ */ __name(function() { + quadrantBuilder.clear(); + clear(); + }, "clear"); + quadrantDb_default = { + setWidth, + setHeight, + setQuadrant1Text, + setQuadrant2Text, + setQuadrant3Text, + setQuadrant4Text, + setXAxisLeftText, + setXAxisRightText, + setYAxisTopText, + setYAxisBottomText, + parseStyles, + addPoint, + addClass: addClass2, + getQuadrantData, + clear: clear11, + setAccTitle, + getAccTitle, + setDiagramTitle, + getDiagramTitle, + getAccDescription, + setAccDescription + }; + } + }); + + // src/diagrams/quadrant-chart/quadrantRenderer.ts + var draw8, quadrantRenderer_default; + var init_quadrantRenderer = __esm({ + "src/diagrams/quadrant-chart/quadrantRenderer.ts"() { + "use strict"; + init_src32(); + init_diagramAPI(); + init_logger(); + init_setupGraphViewbox(); + draw8 = /* @__PURE__ */ __name((txt, id35, _version, diagObj) => { + function getDominantBaseLine(horizontalPos) { + return horizontalPos === "top" ? "hanging" : "middle"; + } + __name(getDominantBaseLine, "getDominantBaseLine"); + function getTextAnchor(verticalPos) { + return verticalPos === "left" ? "start" : "middle"; + } + __name(getTextAnchor, "getTextAnchor"); + function getTransformation(data5) { + return `translate(${data5.x}, ${data5.y}) rotate(${data5.rotation || 0})`; + } + __name(getTransformation, "getTransformation"); + const conf5 = getConfig2(); + log.debug("Rendering quadrant chart\n" + txt); + const securityLevel = conf5.securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + const svg2 = root4.select(`[id="${id35}"]`); + const group2 = svg2.append("g").attr("class", "main"); + const width3 = conf5.quadrantChart?.chartWidth ?? 500; + const height2 = conf5.quadrantChart?.chartHeight ?? 500; + configureSvgSize(svg2, height2, width3, conf5.quadrantChart?.useMaxWidth ?? true); + svg2.attr("viewBox", "0 0 " + width3 + " " + height2); + diagObj.db.setHeight(height2); + diagObj.db.setWidth(width3); + const quadrantData = diagObj.db.getQuadrantData(); + const quadrantsGroup = group2.append("g").attr("class", "quadrants"); + const borderGroup = group2.append("g").attr("class", "border"); + const dataPointGroup = group2.append("g").attr("class", "data-points"); + const labelGroup = group2.append("g").attr("class", "labels"); + const titleGroup = group2.append("g").attr("class", "title"); + if (quadrantData.title) { + titleGroup.append("text").attr("x", 0).attr("y", 0).attr("fill", quadrantData.title.fill).attr("font-size", quadrantData.title.fontSize).attr("dominant-baseline", getDominantBaseLine(quadrantData.title.horizontalPos)).attr("text-anchor", getTextAnchor(quadrantData.title.verticalPos)).attr("transform", getTransformation(quadrantData.title)).text(quadrantData.title.text); + } + if (quadrantData.borderLines) { + borderGroup.selectAll("line").data(quadrantData.borderLines).enter().append("line").attr("x1", (data5) => data5.x1).attr("y1", (data5) => data5.y1).attr("x2", (data5) => data5.x2).attr("y2", (data5) => data5.y2).style("stroke", (data5) => data5.strokeFill).style("stroke-width", (data5) => data5.strokeWidth); + } + const quadrants = quadrantsGroup.selectAll("g.quadrant").data(quadrantData.quadrants).enter().append("g").attr("class", "quadrant"); + quadrants.append("rect").attr("x", (data5) => data5.x).attr("y", (data5) => data5.y).attr("width", (data5) => data5.width).attr("height", (data5) => data5.height).attr("fill", (data5) => data5.fill); + quadrants.append("text").attr("x", 0).attr("y", 0).attr("fill", (data5) => data5.text.fill).attr("font-size", (data5) => data5.text.fontSize).attr( + "dominant-baseline", + (data5) => getDominantBaseLine(data5.text.horizontalPos) + ).attr("text-anchor", (data5) => getTextAnchor(data5.text.verticalPos)).attr("transform", (data5) => getTransformation(data5.text)).text((data5) => data5.text.text); + const labels = labelGroup.selectAll("g.label").data(quadrantData.axisLabels).enter().append("g").attr("class", "label"); + labels.append("text").attr("x", 0).attr("y", 0).text((data5) => data5.text).attr("fill", (data5) => data5.fill).attr("font-size", (data5) => data5.fontSize).attr("dominant-baseline", (data5) => getDominantBaseLine(data5.horizontalPos)).attr("text-anchor", (data5) => getTextAnchor(data5.verticalPos)).attr("transform", (data5) => getTransformation(data5)); + const dataPoints = dataPointGroup.selectAll("g.data-point").data(quadrantData.points).enter().append("g").attr("class", "data-point"); + dataPoints.append("circle").attr("cx", (data5) => data5.x).attr("cy", (data5) => data5.y).attr("r", (data5) => data5.radius).attr("fill", (data5) => data5.fill).attr("stroke", (data5) => data5.strokeColor).attr("stroke-width", (data5) => data5.strokeWidth); + dataPoints.append("text").attr("x", 0).attr("y", 0).text((data5) => data5.text.text).attr("fill", (data5) => data5.text.fill).attr("font-size", (data5) => data5.text.fontSize).attr( + "dominant-baseline", + (data5) => getDominantBaseLine(data5.text.horizontalPos) + ).attr("text-anchor", (data5) => getTextAnchor(data5.text.verticalPos)).attr("transform", (data5) => getTransformation(data5.text)); + }, "draw"); + quadrantRenderer_default = { + draw: draw8 + }; + } + }); + + // src/diagrams/quadrant-chart/quadrantDiagram.ts + var quadrantDiagram_exports = {}; + __export(quadrantDiagram_exports, { + diagram: () => diagram8 + }); + var diagram8; + var init_quadrantDiagram = __esm({ + "src/diagrams/quadrant-chart/quadrantDiagram.ts"() { + "use strict"; + init_quadrant(); + init_quadrantDb(); + init_quadrantRenderer(); + diagram8 = { + parser: quadrant_default, + db: quadrantDb_default, + renderer: quadrantRenderer_default, + styles: /* @__PURE__ */ __name(() => "", "styles") + }; + } + }); + + // src/diagrams/xychart/parser/xychart.jison + var parser9, xychart_default; + var init_xychart = __esm({ + "src/diagrams/xychart/parser/xychart.jison"() { + "use strict"; + parser9 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 10, 12, 14, 16, 18, 19, 21, 23], $V1 = [2, 6], $V2 = [1, 3], $V3 = [1, 5], $V4 = [1, 6], $V5 = [1, 7], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $V7 = [1, 25], $V8 = [1, 26], $V9 = [1, 28], $Va = [1, 29], $Vb = [1, 30], $Vc = [1, 31], $Vd = [1, 32], $Ve = [1, 33], $Vf = [1, 34], $Vg = [1, 35], $Vh = [1, 36], $Vi = [1, 37], $Vj = [1, 43], $Vk = [1, 42], $Vl = [1, 47], $Vm = [1, 50], $Vn = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $Vo = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], $Vp = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], $Vq = [1, 64]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "eol": 4, "XYCHART": 5, "chartConfig": 6, "document": 7, "CHART_ORIENTATION": 8, "statement": 9, "title": 10, "text": 11, "X_AXIS": 12, "parseXAxis": 13, "Y_AXIS": 14, "parseYAxis": 15, "LINE": 16, "plotData": 17, "BAR": 18, "acc_title": 19, "acc_title_value": 20, "acc_descr": 21, "acc_descr_value": 22, "acc_descr_multiline_value": 23, "SQUARE_BRACES_START": 24, "commaSeparatedNumbers": 25, "SQUARE_BRACES_END": 26, "NUMBER_WITH_DECIMAL": 27, "COMMA": 28, "xAxisData": 29, "bandData": 30, "ARROW_DELIMITER": 31, "commaSeparatedTexts": 32, "yAxisData": 33, "NEWLINE": 34, "SEMI": 35, "EOF": 36, "alphaNum": 37, "STR": 38, "MD_STR": 39, "alphaNumToken": 40, "AMP": 41, "NUM": 42, "ALPHA": 43, "PLUS": 44, "EQUALS": 45, "MULT": 46, "DOT": 47, "BRKT": 48, "MINUS": 49, "UNDERSCORE": 50, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" }, + productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 5: + yy.setOrientation($$[$0]); + break; + case 9: + yy.setDiagramTitle($$[$0].text.trim()); + break; + case 12: + yy.setLineData({ text: "", type: "text" }, $$[$0]); + break; + case 13: + yy.setLineData($$[$0 - 1], $$[$0]); + break; + case 14: + yy.setBarData({ text: "", type: "text" }, $$[$0]); + break; + case 15: + yy.setBarData($$[$0 - 1], $$[$0]); + break; + case 16: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 17: + case 18: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 19: + this.$ = $$[$0 - 1]; + break; + case 20: + this.$ = [Number($$[$0 - 2]), ...$$[$0]]; + break; + case 21: + this.$ = [Number($$[$0])]; + break; + case 22: + yy.setXAxisTitle($$[$0]); + break; + case 23: + yy.setXAxisTitle($$[$0 - 1]); + break; + case 24: + yy.setXAxisTitle({ type: "text", text: "" }); + break; + case 25: + yy.setXAxisBand($$[$0]); + break; + case 26: + yy.setXAxisRangeData(Number($$[$0 - 2]), Number($$[$0])); + break; + case 27: + this.$ = $$[$0 - 1]; + break; + case 28: + this.$ = [$$[$0 - 2], ...$$[$0]]; + break; + case 29: + this.$ = [$$[$0]]; + break; + case 30: + yy.setYAxisTitle($$[$0]); + break; + case 31: + yy.setYAxisTitle($$[$0 - 1]); + break; + case 32: + yy.setYAxisTitle({ type: "text", text: "" }); + break; + case 33: + yy.setYAxisRangeData(Number($$[$0 - 2]), Number($$[$0])); + break; + case 37: + this.$ = { text: $$[$0], type: "text" }; + break; + case 38: + this.$ = { text: $$[$0], type: "text" }; + break; + case 39: + this.$ = { text: $$[$0], type: "markdown" }; + break; + case 40: + this.$ = $$[$0]; + break; + case 41: + this.$ = $$[$0 - 1] + "" + $$[$0]; + break; + } + }, "anonymous"), + table: [o2($V0, $V1, { 3: 1, 4: 2, 7: 4, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [3] }, o2($V0, $V1, { 4: 2, 7: 4, 3: 8, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), o2($V0, $V1, { 4: 2, 7: 4, 6: 9, 3: 10, 5: $V2, 8: [1, 11], 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, o2($V6, [2, 34]), o2($V6, [2, 35]), o2($V6, [2, 36]), { 1: [2, 1] }, o2($V0, $V1, { 4: 2, 7: 4, 3: 21, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 3] }, o2($V6, [2, 5]), o2($V0, [2, 7], { 4: 22, 34: $V3, 35: $V4, 36: $V5 }), { 11: 23, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 39, 13: 38, 24: $Vj, 27: $Vk, 29: 40, 30: 41, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 45, 15: 44, 27: $Vl, 33: 46, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 49, 17: 48, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 52, 17: 51, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 20: [1, 53] }, { 22: [1, 54] }, o2($Vn, [2, 18]), { 1: [2, 2] }, o2($Vn, [2, 8]), o2($Vn, [2, 9]), o2($Vo, [2, 37], { 40: 55, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }), o2($Vo, [2, 38]), o2($Vo, [2, 39]), o2($Vp, [2, 40]), o2($Vp, [2, 42]), o2($Vp, [2, 43]), o2($Vp, [2, 44]), o2($Vp, [2, 45]), o2($Vp, [2, 46]), o2($Vp, [2, 47]), o2($Vp, [2, 48]), o2($Vp, [2, 49]), o2($Vp, [2, 50]), o2($Vp, [2, 51]), o2($Vn, [2, 10]), o2($Vn, [2, 22], { 30: 41, 29: 56, 24: $Vj, 27: $Vk }), o2($Vn, [2, 24]), o2($Vn, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o2($Vn, [2, 11]), o2($Vn, [2, 30], { 33: 60, 27: $Vl }), o2($Vn, [2, 32]), { 31: [1, 61] }, o2($Vn, [2, 12]), { 17: 62, 24: $Vm }, { 25: 63, 27: $Vq }, o2($Vn, [2, 14]), { 17: 65, 24: $Vm }, o2($Vn, [2, 16]), o2($Vn, [2, 17]), o2($Vp, [2, 41]), o2($Vn, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, o2($Vn, [2, 31]), { 27: [1, 69] }, o2($Vn, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, o2($Vn, [2, 15]), o2($Vn, [2, 26]), o2($Vn, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o2($Vn, [2, 33]), o2($Vn, [2, 19]), { 25: 73, 27: $Vq }, { 26: [2, 28] }, { 26: [2, 20] }], + defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + break; + case 1: + break; + case 2: + this.popState(); + return 34; + break; + case 3: + this.popState(); + return 34; + break; + case 4: + return 34; + break; + case 5: + break; + case 6: + return 10; + break; + case 7: + this.pushState("acc_title"); + return 19; + break; + case 8: + this.popState(); + return "acc_title_value"; + break; + case 9: + this.pushState("acc_descr"); + return 21; + break; + case 10: + this.popState(); + return "acc_descr_value"; + break; + case 11: + this.pushState("acc_descr_multiline"); + break; + case 12: + this.popState(); + break; + case 13: + return "acc_descr_multiline_value"; + break; + case 14: + return 5; + break; + case 15: + return 5; + break; + case 16: + return 8; + break; + case 17: + this.pushState("axis_data"); + return "X_AXIS"; + break; + case 18: + this.pushState("axis_data"); + return "Y_AXIS"; + break; + case 19: + this.pushState("axis_band_data"); + return 24; + break; + case 20: + return 31; + break; + case 21: + this.pushState("data"); + return 16; + break; + case 22: + this.pushState("data"); + return 18; + break; + case 23: + this.pushState("data_inner"); + return 24; + break; + case 24: + return 27; + break; + case 25: + this.popState(); + return 26; + break; + case 26: + this.popState(); + break; + case 27: + this.pushState("string"); + break; + case 28: + this.popState(); + break; + case 29: + return "STR"; + break; + case 30: + return 24; + break; + case 31: + return 26; + break; + case 32: + return 43; + break; + case 33: + return "COLON"; + break; + case 34: + return 44; + break; + case 35: + return 28; + break; + case 36: + return 45; + break; + case 37: + return 46; + break; + case 38: + return 48; + break; + case 39: + return 50; + break; + case 40: + return 47; + break; + case 41: + return 41; + break; + case 42: + return 49; + break; + case 43: + return 42; + break; + case 44: + break; + case 45: + return 35; + break; + case 46: + return 36; + break; + } + }, "anonymous"), + rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\})/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:xychart\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i], + conditions: { "data_inner": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true }, "data": { "rules": [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 23, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true }, "axis_band_data": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true }, "axis_data": { "rules": [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true }, "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [], "inclusive": false }, "md_string": { "rules": [], "inclusive": false }, "string": { "rules": [28, 29], "inclusive": false }, "INITIAL": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 21, 22, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser9.parser = parser9; + xychart_default = parser9; + } + }); + + // src/diagrams/xychart/chartBuilder/interfaces.ts + function isBarPlot(data5) { + return data5.type === "bar"; + } + function isBandAxisData(data5) { + return data5.type === "band"; + } + function isLinearAxisData(data5) { + return data5.type === "linear"; + } + var init_interfaces = __esm({ + "src/diagrams/xychart/chartBuilder/interfaces.ts"() { + "use strict"; + __name(isBarPlot, "isBarPlot"); + __name(isBandAxisData, "isBandAxisData"); + __name(isLinearAxisData, "isLinearAxisData"); + } + }); + + // src/diagrams/xychart/chartBuilder/textDimensionCalculator.ts + var TextDimensionCalculatorWithFont; + var init_textDimensionCalculator = __esm({ + "src/diagrams/xychart/chartBuilder/textDimensionCalculator.ts"() { + "use strict"; + init_createText(); + TextDimensionCalculatorWithFont = class { + constructor(parentGroup) { + this.parentGroup = parentGroup; + } + static { + __name(this, "TextDimensionCalculatorWithFont"); + } + getMaxDimension(texts, fontSize) { + if (!this.parentGroup) { + return { + width: texts.reduce((acc, cur) => Math.max(cur.length, acc), 0) * fontSize, + height: fontSize + }; + } + const dimension = { + width: 0, + height: 0 + }; + const elem = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", fontSize); + for (const t4 of texts) { + const bbox = computeDimensionOfText(elem, 1, t4); + const width3 = bbox ? bbox.width : t4.length * fontSize; + const height2 = bbox ? bbox.height : fontSize; + dimension.width = Math.max(dimension.width, width3); + dimension.height = Math.max(dimension.height, height2); + } + elem.remove(); + return dimension; + } + }; + } + }); + + // src/diagrams/xychart/chartBuilder/components/axis/baseAxis.ts + var BAR_WIDTH_TO_TICK_WIDTH_RATIO, MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL, BaseAxis; + var init_baseAxis = __esm({ + "src/diagrams/xychart/chartBuilder/components/axis/baseAxis.ts"() { + "use strict"; + BAR_WIDTH_TO_TICK_WIDTH_RATIO = 0.7; + MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL = 0.2; + BaseAxis = class { + constructor(axisConfig, title2, textDimensionCalculator, axisThemeConfig) { + this.axisConfig = axisConfig; + this.title = title2; + this.textDimensionCalculator = textDimensionCalculator; + this.axisThemeConfig = axisThemeConfig; + this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }; + this.axisPosition = "left"; + this.showTitle = false; + this.showLabel = false; + this.showTick = false; + this.showAxisLine = false; + this.outerPadding = 0; + this.titleTextHeight = 0; + this.labelTextHeight = 0; + this.range = [0, 10]; + this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }; + this.axisPosition = "left"; + } + static { + __name(this, "BaseAxis"); + } + setRange(range3) { + this.range = range3; + if (this.axisPosition === "left" || this.axisPosition === "right") { + this.boundingRect.height = range3[1] - range3[0]; + } else { + this.boundingRect.width = range3[1] - range3[0]; + } + this.recalculateScale(); + } + getRange() { + return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding]; + } + setAxisPosition(axisPosition) { + this.axisPosition = axisPosition; + this.setRange(this.range); + } + getTickDistance() { + const range3 = this.getRange(); + return Math.abs(range3[0] - range3[1]) / this.getTickValues().length; + } + getAxisOuterPadding() { + return this.outerPadding; + } + getLabelDimension() { + return this.textDimensionCalculator.getMaxDimension( + this.getTickValues().map((tick) => tick.toString()), + this.axisConfig.labelFontSize + ); + } + recalculateOuterPaddingToDrawBar() { + if (BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() > this.outerPadding * 2) { + this.outerPadding = Math.floor(BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() / 2); + } + this.recalculateScale(); + } + calculateSpaceIfDrawnHorizontally(availableSpace) { + let availableHeight = availableSpace.height; + if (this.axisConfig.showAxisLine && availableHeight > this.axisConfig.axisLineWidth) { + availableHeight -= this.axisConfig.axisLineWidth; + this.showAxisLine = true; + } + if (this.axisConfig.showLabel) { + const spaceRequired = this.getLabelDimension(); + const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.width; + this.outerPadding = Math.min(spaceRequired.width / 2, maxPadding); + const heightRequired = spaceRequired.height + this.axisConfig.labelPadding * 2; + this.labelTextHeight = spaceRequired.height; + if (heightRequired <= availableHeight) { + availableHeight -= heightRequired; + this.showLabel = true; + } + } + if (this.axisConfig.showTick && availableHeight >= this.axisConfig.tickLength) { + this.showTick = true; + availableHeight -= this.axisConfig.tickLength; + } + if (this.axisConfig.showTitle && this.title) { + const spaceRequired = this.textDimensionCalculator.getMaxDimension( + [this.title], + this.axisConfig.titleFontSize + ); + const heightRequired = spaceRequired.height + this.axisConfig.titlePadding * 2; + this.titleTextHeight = spaceRequired.height; + if (heightRequired <= availableHeight) { + availableHeight -= heightRequired; + this.showTitle = true; + } + } + this.boundingRect.width = availableSpace.width; + this.boundingRect.height = availableSpace.height - availableHeight; + } + calculateSpaceIfDrawnVertical(availableSpace) { + let availableWidth = availableSpace.width; + if (this.axisConfig.showAxisLine && availableWidth > this.axisConfig.axisLineWidth) { + availableWidth -= this.axisConfig.axisLineWidth; + this.showAxisLine = true; + } + if (this.axisConfig.showLabel) { + const spaceRequired = this.getLabelDimension(); + const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.height; + this.outerPadding = Math.min(spaceRequired.height / 2, maxPadding); + const widthRequired = spaceRequired.width + this.axisConfig.labelPadding * 2; + if (widthRequired <= availableWidth) { + availableWidth -= widthRequired; + this.showLabel = true; + } + } + if (this.axisConfig.showTick && availableWidth >= this.axisConfig.tickLength) { + this.showTick = true; + availableWidth -= this.axisConfig.tickLength; + } + if (this.axisConfig.showTitle && this.title) { + const spaceRequired = this.textDimensionCalculator.getMaxDimension( + [this.title], + this.axisConfig.titleFontSize + ); + const widthRequired = spaceRequired.height + this.axisConfig.titlePadding * 2; + this.titleTextHeight = spaceRequired.height; + if (widthRequired <= availableWidth) { + availableWidth -= widthRequired; + this.showTitle = true; + } + } + this.boundingRect.width = availableSpace.width - availableWidth; + this.boundingRect.height = availableSpace.height; + } + calculateSpace(availableSpace) { + if (this.axisPosition === "left" || this.axisPosition === "right") { + this.calculateSpaceIfDrawnVertical(availableSpace); + } else { + this.calculateSpaceIfDrawnHorizontally(availableSpace); + } + this.recalculateScale(); + return { + width: this.boundingRect.width, + height: this.boundingRect.height + }; + } + setBoundingBoxXY(point8) { + this.boundingRect.x = point8.x; + this.boundingRect.y = point8.y; + } + getDrawableElementsForLeftAxis() { + const drawableElement = []; + if (this.showAxisLine) { + const x5 = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2; + drawableElement.push({ + type: "path", + groupTexts: ["left-axis", "axisl-line"], + data: [ + { + path: `M ${x5},${this.boundingRect.y} L ${x5},${this.boundingRect.y + this.boundingRect.height} `, + strokeFill: this.axisThemeConfig.axisLineColor, + strokeWidth: this.axisConfig.axisLineWidth + } + ] + }); + } + if (this.showLabel) { + drawableElement.push({ + type: "text", + groupTexts: ["left-axis", "label"], + data: this.getTickValues().map((tick) => ({ + text: tick.toString(), + x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0), + y: this.getScaleValue(tick), + fill: this.axisThemeConfig.labelColor, + fontSize: this.axisConfig.labelFontSize, + rotation: 0, + verticalPos: "middle", + horizontalPos: "right" + })) + }); + } + if (this.showTick) { + const x5 = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0); + drawableElement.push({ + type: "path", + groupTexts: ["left-axis", "ticks"], + data: this.getTickValues().map((tick) => ({ + path: `M ${x5},${this.getScaleValue(tick)} L ${x5 - this.axisConfig.tickLength},${this.getScaleValue(tick)}`, + strokeFill: this.axisThemeConfig.tickColor, + strokeWidth: this.axisConfig.tickWidth + })) + }); + } + if (this.showTitle) { + drawableElement.push({ + type: "text", + groupTexts: ["left-axis", "title"], + data: [ + { + text: this.title, + x: this.boundingRect.x + this.axisConfig.titlePadding, + y: this.boundingRect.y + this.boundingRect.height / 2, + fill: this.axisThemeConfig.titleColor, + fontSize: this.axisConfig.titleFontSize, + rotation: 270, + verticalPos: "top", + horizontalPos: "center" + } + ] + }); + } + return drawableElement; + } + getDrawableElementsForBottomAxis() { + const drawableElement = []; + if (this.showAxisLine) { + const y6 = this.boundingRect.y + this.axisConfig.axisLineWidth / 2; + drawableElement.push({ + type: "path", + groupTexts: ["bottom-axis", "axis-line"], + data: [ + { + path: `M ${this.boundingRect.x},${y6} L ${this.boundingRect.x + this.boundingRect.width},${y6}`, + strokeFill: this.axisThemeConfig.axisLineColor, + strokeWidth: this.axisConfig.axisLineWidth + } + ] + }); + } + if (this.showLabel) { + drawableElement.push({ + type: "text", + groupTexts: ["bottom-axis", "label"], + data: this.getTickValues().map((tick) => ({ + text: tick.toString(), + x: this.getScaleValue(tick), + y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0), + fill: this.axisThemeConfig.labelColor, + fontSize: this.axisConfig.labelFontSize, + rotation: 0, + verticalPos: "top", + horizontalPos: "center" + })) + }); + } + if (this.showTick) { + const y6 = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0); + drawableElement.push({ + type: "path", + groupTexts: ["bottom-axis", "ticks"], + data: this.getTickValues().map((tick) => ({ + path: `M ${this.getScaleValue(tick)},${y6} L ${this.getScaleValue(tick)},${y6 + this.axisConfig.tickLength}`, + strokeFill: this.axisThemeConfig.tickColor, + strokeWidth: this.axisConfig.tickWidth + })) + }); + } + if (this.showTitle) { + drawableElement.push({ + type: "text", + groupTexts: ["bottom-axis", "title"], + data: [ + { + text: this.title, + x: this.range[0] + (this.range[1] - this.range[0]) / 2, + y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight, + fill: this.axisThemeConfig.titleColor, + fontSize: this.axisConfig.titleFontSize, + rotation: 0, + verticalPos: "top", + horizontalPos: "center" + } + ] + }); + } + return drawableElement; + } + getDrawableElementsForTopAxis() { + const drawableElement = []; + if (this.showAxisLine) { + const y6 = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2; + drawableElement.push({ + type: "path", + groupTexts: ["top-axis", "axis-line"], + data: [ + { + path: `M ${this.boundingRect.x},${y6} L ${this.boundingRect.x + this.boundingRect.width},${y6}`, + strokeFill: this.axisThemeConfig.axisLineColor, + strokeWidth: this.axisConfig.axisLineWidth + } + ] + }); + } + if (this.showLabel) { + drawableElement.push({ + type: "text", + groupTexts: ["top-axis", "label"], + data: this.getTickValues().map((tick) => ({ + text: tick.toString(), + x: this.getScaleValue(tick), + y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding, + fill: this.axisThemeConfig.labelColor, + fontSize: this.axisConfig.labelFontSize, + rotation: 0, + verticalPos: "top", + horizontalPos: "center" + })) + }); + } + if (this.showTick) { + const y6 = this.boundingRect.y; + drawableElement.push({ + type: "path", + groupTexts: ["top-axis", "ticks"], + data: this.getTickValues().map((tick) => ({ + path: `M ${this.getScaleValue(tick)},${y6 + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(tick)},${y6 + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`, + strokeFill: this.axisThemeConfig.tickColor, + strokeWidth: this.axisConfig.tickWidth + })) + }); + } + if (this.showTitle) { + drawableElement.push({ + type: "text", + groupTexts: ["top-axis", "title"], + data: [ + { + text: this.title, + x: this.boundingRect.x + this.boundingRect.width / 2, + y: this.boundingRect.y + this.axisConfig.titlePadding, + fill: this.axisThemeConfig.titleColor, + fontSize: this.axisConfig.titleFontSize, + rotation: 0, + verticalPos: "top", + horizontalPos: "center" + } + ] + }); + } + return drawableElement; + } + getDrawableElements() { + if (this.axisPosition === "left") { + return this.getDrawableElementsForLeftAxis(); + } + if (this.axisPosition === "right") { + throw Error("Drawing of right axis is not implemented"); + } + if (this.axisPosition === "bottom") { + return this.getDrawableElementsForBottomAxis(); + } + if (this.axisPosition === "top") { + return this.getDrawableElementsForTopAxis(); + } + return []; + } + }; + } + }); + + // src/diagrams/xychart/chartBuilder/components/axis/bandAxis.ts + var BandAxis; + var init_bandAxis = __esm({ + "src/diagrams/xychart/chartBuilder/components/axis/bandAxis.ts"() { + "use strict"; + init_src32(); + init_logger(); + init_baseAxis(); + BandAxis = class extends BaseAxis { + static { + __name(this, "BandAxis"); + } + constructor(axisConfig, axisThemeConfig, categories, title2, textDimensionCalculator) { + super(axisConfig, title2, textDimensionCalculator, axisThemeConfig); + this.categories = categories; + this.scale = band().domain(this.categories).range(this.getRange()); + } + setRange(range3) { + super.setRange(range3); + } + recalculateScale() { + this.scale = band().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5); + log.trace("BandAxis axis final categories, range: ", this.categories, this.getRange()); + } + getTickValues() { + return this.categories; + } + getScaleValue(value2) { + return this.scale(value2) ?? this.getRange()[0]; + } + }; + } + }); + + // src/diagrams/xychart/chartBuilder/components/axis/linearAxis.ts + var LinearAxis; + var init_linearAxis = __esm({ + "src/diagrams/xychart/chartBuilder/components/axis/linearAxis.ts"() { + "use strict"; + init_src32(); + init_baseAxis(); + LinearAxis = class extends BaseAxis { + static { + __name(this, "LinearAxis"); + } + constructor(axisConfig, axisThemeConfig, domain, title2, textDimensionCalculator) { + super(axisConfig, title2, textDimensionCalculator, axisThemeConfig); + this.domain = domain; + this.scale = linear2().domain(this.domain).range(this.getRange()); + } + getTickValues() { + return this.scale.ticks(); + } + recalculateScale() { + const domain = [...this.domain]; + if (this.axisPosition === "left") { + domain.reverse(); + } + this.scale = linear2().domain(domain).range(this.getRange()); + } + getScaleValue(value2) { + return this.scale(value2); + } + }; + } + }); + + // src/diagrams/xychart/chartBuilder/components/axis/index.ts + function getAxis(data5, axisConfig, axisThemeConfig, tmpSVGGroup2) { + const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2); + if (isBandAxisData(data5)) { + return new BandAxis( + axisConfig, + axisThemeConfig, + data5.categories, + data5.title, + textDimensionCalculator + ); + } + return new LinearAxis( + axisConfig, + axisThemeConfig, + [data5.min, data5.max], + data5.title, + textDimensionCalculator + ); + } + var init_axis2 = __esm({ + "src/diagrams/xychart/chartBuilder/components/axis/index.ts"() { + "use strict"; + init_interfaces(); + init_textDimensionCalculator(); + init_bandAxis(); + init_linearAxis(); + __name(getAxis, "getAxis"); + } + }); + + // src/diagrams/xychart/chartBuilder/components/chartTitle.ts + function getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) { + const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2); + return new ChartTitle(textDimensionCalculator, chartConfig, chartData, chartThemeConfig); + } + var ChartTitle; + var init_chartTitle = __esm({ + "src/diagrams/xychart/chartBuilder/components/chartTitle.ts"() { + "use strict"; + init_textDimensionCalculator(); + ChartTitle = class { + constructor(textDimensionCalculator, chartConfig, chartData, chartThemeConfig) { + this.textDimensionCalculator = textDimensionCalculator; + this.chartConfig = chartConfig; + this.chartData = chartData; + this.chartThemeConfig = chartThemeConfig; + this.boundingRect = { + x: 0, + y: 0, + width: 0, + height: 0 + }; + this.showChartTitle = false; + } + static { + __name(this, "ChartTitle"); + } + setBoundingBoxXY(point8) { + this.boundingRect.x = point8.x; + this.boundingRect.y = point8.y; + } + calculateSpace(availableSpace) { + const titleDimension = this.textDimensionCalculator.getMaxDimension( + [this.chartData.title], + this.chartConfig.titleFontSize + ); + const widthRequired = Math.max(titleDimension.width, availableSpace.width); + const heightRequired = titleDimension.height + 2 * this.chartConfig.titlePadding; + if (titleDimension.width <= widthRequired && titleDimension.height <= heightRequired && this.chartConfig.showTitle && this.chartData.title) { + this.boundingRect.width = widthRequired; + this.boundingRect.height = heightRequired; + this.showChartTitle = true; + } + return { + width: this.boundingRect.width, + height: this.boundingRect.height + }; + } + getDrawableElements() { + const drawableElem = []; + if (this.showChartTitle) { + drawableElem.push({ + groupTexts: ["chart-title"], + type: "text", + data: [ + { + fontSize: this.chartConfig.titleFontSize, + text: this.chartData.title, + verticalPos: "middle", + horizontalPos: "center", + x: this.boundingRect.x + this.boundingRect.width / 2, + y: this.boundingRect.y + this.boundingRect.height / 2, + fill: this.chartThemeConfig.titleColor, + rotation: 0 + } + ] + }); + } + return drawableElem; + } + }; + __name(getChartTitleComponent, "getChartTitleComponent"); + } + }); + + // src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts + var LinePlot; + var init_linePlot = __esm({ + "src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts"() { + "use strict"; + init_src32(); + LinePlot = class { + constructor(plotData, xAxis, yAxis, orientation, plotIndex2) { + this.plotData = plotData; + this.xAxis = xAxis; + this.yAxis = yAxis; + this.orientation = orientation; + this.plotIndex = plotIndex2; + } + static { + __name(this, "LinePlot"); + } + getDrawableElement() { + const finalData = this.plotData.data.map((d3) => [ + this.xAxis.getScaleValue(d3[0]), + this.yAxis.getScaleValue(d3[1]) + ]); + let path4; + if (this.orientation === "horizontal") { + path4 = line_default().y((d3) => d3[0]).x((d3) => d3[1])(finalData); + } else { + path4 = line_default().x((d3) => d3[0]).y((d3) => d3[1])(finalData); + } + if (!path4) { + return []; + } + return [ + { + groupTexts: ["plot", `line-plot-${this.plotIndex}`], + type: "path", + data: [ + { + path: path4, + strokeFill: this.plotData.strokeFill, + strokeWidth: this.plotData.strokeWidth + } + ] + } + ]; + } + }; + } + }); + + // src/diagrams/xychart/chartBuilder/components/plot/barPlot.ts + var BarPlot; + var init_barPlot = __esm({ + "src/diagrams/xychart/chartBuilder/components/plot/barPlot.ts"() { + "use strict"; + BarPlot = class { + constructor(barData, boundingRect, xAxis, yAxis, orientation, plotIndex2) { + this.barData = barData; + this.boundingRect = boundingRect; + this.xAxis = xAxis; + this.yAxis = yAxis; + this.orientation = orientation; + this.plotIndex = plotIndex2; + } + static { + __name(this, "BarPlot"); + } + getDrawableElement() { + const finalData = this.barData.data.map((d3) => [ + this.xAxis.getScaleValue(d3[0]), + this.yAxis.getScaleValue(d3[1]) + ]); + const barPaddingPercent = 0.05; + const barWidth = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - barPaddingPercent); + const barWidthHalf = barWidth / 2; + if (this.orientation === "horizontal") { + return [ + { + groupTexts: ["plot", `bar-plot-${this.plotIndex}`], + type: "rect", + data: finalData.map((data5) => ({ + x: this.boundingRect.x, + y: data5[0] - barWidthHalf, + height: barWidth, + width: data5[1] - this.boundingRect.x, + fill: this.barData.fill, + strokeWidth: 0, + strokeFill: this.barData.fill + })) + } + ]; + } + return [ + { + groupTexts: ["plot", `bar-plot-${this.plotIndex}`], + type: "rect", + data: finalData.map((data5) => ({ + x: data5[0] - barWidthHalf, + y: data5[1], + width: barWidth, + height: this.boundingRect.y + this.boundingRect.height - data5[1], + fill: this.barData.fill, + strokeWidth: 0, + strokeFill: this.barData.fill + })) + } + ]; + } + }; + } + }); + + // src/diagrams/xychart/chartBuilder/components/plot/index.ts + function getPlotComponent(chartConfig, chartData, chartThemeConfig) { + return new BasePlot(chartConfig, chartData, chartThemeConfig); + } + var BasePlot; + var init_plot = __esm({ + "src/diagrams/xychart/chartBuilder/components/plot/index.ts"() { + "use strict"; + init_linePlot(); + init_barPlot(); + BasePlot = class { + constructor(chartConfig, chartData, chartThemeConfig) { + this.chartConfig = chartConfig; + this.chartData = chartData; + this.chartThemeConfig = chartThemeConfig; + this.boundingRect = { + x: 0, + y: 0, + width: 0, + height: 0 + }; + } + static { + __name(this, "BasePlot"); + } + setAxes(xAxis, yAxis) { + this.xAxis = xAxis; + this.yAxis = yAxis; + } + setBoundingBoxXY(point8) { + this.boundingRect.x = point8.x; + this.boundingRect.y = point8.y; + } + calculateSpace(availableSpace) { + this.boundingRect.width = availableSpace.width; + this.boundingRect.height = availableSpace.height; + return { + width: this.boundingRect.width, + height: this.boundingRect.height + }; + } + getDrawableElements() { + if (!(this.xAxis && this.yAxis)) { + throw Error("Axes must be passed to render Plots"); + } + const drawableElem = []; + for (const [i2, plot] of this.chartData.plots.entries()) { + switch (plot.type) { + case "line": + { + const linePlot = new LinePlot( + plot, + this.xAxis, + this.yAxis, + this.chartConfig.chartOrientation, + i2 + ); + drawableElem.push(...linePlot.getDrawableElement()); + } + break; + case "bar": + { + const barPlot = new BarPlot( + plot, + this.boundingRect, + this.xAxis, + this.yAxis, + this.chartConfig.chartOrientation, + i2 + ); + drawableElem.push(...barPlot.getDrawableElement()); + } + break; + } + } + return drawableElem; + } + }; + __name(getPlotComponent, "getPlotComponent"); + } + }); + + // src/diagrams/xychart/chartBuilder/orchestrator.ts + var Orchestrator; + var init_orchestrator = __esm({ + "src/diagrams/xychart/chartBuilder/orchestrator.ts"() { + "use strict"; + init_axis2(); + init_chartTitle(); + init_plot(); + init_interfaces(); + Orchestrator = class { + constructor(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) { + this.chartConfig = chartConfig; + this.chartData = chartData; + this.componentStore = { + title: getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2), + plot: getPlotComponent(chartConfig, chartData, chartThemeConfig), + xAxis: getAxis( + chartData.xAxis, + chartConfig.xAxis, + { + titleColor: chartThemeConfig.xAxisTitleColor, + labelColor: chartThemeConfig.xAxisLabelColor, + tickColor: chartThemeConfig.xAxisTickColor, + axisLineColor: chartThemeConfig.xAxisLineColor + }, + tmpSVGGroup2 + ), + yAxis: getAxis( + chartData.yAxis, + chartConfig.yAxis, + { + titleColor: chartThemeConfig.yAxisTitleColor, + labelColor: chartThemeConfig.yAxisLabelColor, + tickColor: chartThemeConfig.yAxisTickColor, + axisLineColor: chartThemeConfig.yAxisLineColor + }, + tmpSVGGroup2 + ) + }; + } + static { + __name(this, "Orchestrator"); + } + calculateVerticalSpace() { + let availableWidth = this.chartConfig.width; + let availableHeight = this.chartConfig.height; + let plotX = 0; + let plotY = 0; + let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100); + let chartHeight = Math.floor( + availableHeight * this.chartConfig.plotReservedSpacePercent / 100 + ); + let spaceUsed = this.componentStore.plot.calculateSpace({ + width: chartWidth, + height: chartHeight + }); + availableWidth -= spaceUsed.width; + availableHeight -= spaceUsed.height; + spaceUsed = this.componentStore.title.calculateSpace({ + width: this.chartConfig.width, + height: availableHeight + }); + plotY = spaceUsed.height; + availableHeight -= spaceUsed.height; + this.componentStore.xAxis.setAxisPosition("bottom"); + spaceUsed = this.componentStore.xAxis.calculateSpace({ + width: availableWidth, + height: availableHeight + }); + availableHeight -= spaceUsed.height; + this.componentStore.yAxis.setAxisPosition("left"); + spaceUsed = this.componentStore.yAxis.calculateSpace({ + width: availableWidth, + height: availableHeight + }); + plotX = spaceUsed.width; + availableWidth -= spaceUsed.width; + if (availableWidth > 0) { + chartWidth += availableWidth; + availableWidth = 0; + } + if (availableHeight > 0) { + chartHeight += availableHeight; + availableHeight = 0; + } + this.componentStore.plot.calculateSpace({ + width: chartWidth, + height: chartHeight + }); + this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY }); + this.componentStore.xAxis.setRange([plotX, plotX + chartWidth]); + this.componentStore.xAxis.setBoundingBoxXY({ x: plotX, y: plotY + chartHeight }); + this.componentStore.yAxis.setRange([plotY, plotY + chartHeight]); + this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: plotY }); + if (this.chartData.plots.some((p3) => isBarPlot(p3))) { + this.componentStore.xAxis.recalculateOuterPaddingToDrawBar(); + } + } + calculateHorizontalSpace() { + let availableWidth = this.chartConfig.width; + let availableHeight = this.chartConfig.height; + let titleYEnd = 0; + let plotX = 0; + let plotY = 0; + let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100); + let chartHeight = Math.floor( + availableHeight * this.chartConfig.plotReservedSpacePercent / 100 + ); + let spaceUsed = this.componentStore.plot.calculateSpace({ + width: chartWidth, + height: chartHeight + }); + availableWidth -= spaceUsed.width; + availableHeight -= spaceUsed.height; + spaceUsed = this.componentStore.title.calculateSpace({ + width: this.chartConfig.width, + height: availableHeight + }); + titleYEnd = spaceUsed.height; + availableHeight -= spaceUsed.height; + this.componentStore.xAxis.setAxisPosition("left"); + spaceUsed = this.componentStore.xAxis.calculateSpace({ + width: availableWidth, + height: availableHeight + }); + availableWidth -= spaceUsed.width; + plotX = spaceUsed.width; + this.componentStore.yAxis.setAxisPosition("top"); + spaceUsed = this.componentStore.yAxis.calculateSpace({ + width: availableWidth, + height: availableHeight + }); + availableHeight -= spaceUsed.height; + plotY = titleYEnd + spaceUsed.height; + if (availableWidth > 0) { + chartWidth += availableWidth; + availableWidth = 0; + } + if (availableHeight > 0) { + chartHeight += availableHeight; + availableHeight = 0; + } + this.componentStore.plot.calculateSpace({ + width: chartWidth, + height: chartHeight + }); + this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY }); + this.componentStore.yAxis.setRange([plotX, plotX + chartWidth]); + this.componentStore.yAxis.setBoundingBoxXY({ x: plotX, y: titleYEnd }); + this.componentStore.xAxis.setRange([plotY, plotY + chartHeight]); + this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: plotY }); + if (this.chartData.plots.some((p3) => isBarPlot(p3))) { + this.componentStore.xAxis.recalculateOuterPaddingToDrawBar(); + } + } + calculateSpace() { + if (this.chartConfig.chartOrientation === "horizontal") { + this.calculateHorizontalSpace(); + } else { + this.calculateVerticalSpace(); + } + } + getDrawableElement() { + this.calculateSpace(); + const drawableElem = []; + this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis); + for (const component2 of Object.values(this.componentStore)) { + drawableElem.push(...component2.getDrawableElements()); + } + return drawableElem; + } + }; + } + }); + + // src/diagrams/xychart/chartBuilder/index.ts + var XYChartBuilder; + var init_chartBuilder = __esm({ + "src/diagrams/xychart/chartBuilder/index.ts"() { + "use strict"; + init_orchestrator(); + XYChartBuilder = class { + static { + __name(this, "XYChartBuilder"); + } + static build(config5, chartData, chartThemeConfig, tmpSVGGroup2) { + const orchestrator = new Orchestrator(config5, chartData, chartThemeConfig, tmpSVGGroup2); + return orchestrator.getDrawableElement(); + } + }; + } + }); + + // src/diagrams/xychart/xychartDb.ts + function getChartDefaultThemeConfig() { + const defaultThemeVariables2 = getThemeVariables3(); + const config5 = getConfig(); + return cleanAndMerge(defaultThemeVariables2.xyChart, config5.themeVariables.xyChart); + } + function getChartDefaultConfig() { + const config5 = getConfig(); + return cleanAndMerge( + defaultConfig_default.xyChart, + config5.xyChart + ); + } + function getChartDefaultData() { + return { + yAxis: { + type: "linear", + title: "", + min: Infinity, + max: -Infinity + }, + xAxis: { + type: "band", + title: "", + categories: [] + }, + title: "", + plots: [] + }; + } + function textSanitizer2(text4) { + const config5 = getConfig(); + return sanitizeText(text4.trim(), config5); + } + function setTmpSVGG(SVGG) { + tmpSVGGroup = SVGG; + } + function setOrientation(orientation) { + if (orientation === "horizontal") { + xyChartConfig.chartOrientation = "horizontal"; + } else { + xyChartConfig.chartOrientation = "vertical"; + } + } + function setXAxisTitle(title2) { + xyChartData.xAxis.title = textSanitizer2(title2.text); + } + function setXAxisRangeData(min10, max10) { + xyChartData.xAxis = { type: "linear", title: xyChartData.xAxis.title, min: min10, max: max10 }; + hasSetXAxis = true; + } + function setXAxisBand(categories) { + xyChartData.xAxis = { + type: "band", + title: xyChartData.xAxis.title, + categories: categories.map((c3) => textSanitizer2(c3.text)) + }; + hasSetXAxis = true; + } + function setYAxisTitle(title2) { + xyChartData.yAxis.title = textSanitizer2(title2.text); + } + function setYAxisRangeData(min10, max10) { + xyChartData.yAxis = { type: "linear", title: xyChartData.yAxis.title, min: min10, max: max10 }; + hasSetYAxis = true; + } + function setYAxisRangeFromPlotData(data5) { + const minValue = Math.min(...data5); + const maxValue = Math.max(...data5); + const prevMinValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.min : Infinity; + const prevMaxValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.max : -Infinity; + xyChartData.yAxis = { + type: "linear", + title: xyChartData.yAxis.title, + min: Math.min(prevMinValue, minValue), + max: Math.max(prevMaxValue, maxValue) + }; + } + function transformDataWithoutCategory(data5) { + let retData = []; + if (data5.length === 0) { + return retData; + } + if (!hasSetXAxis) { + const prevMinValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.min : Infinity; + const prevMaxValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.max : -Infinity; + setXAxisRangeData(Math.min(prevMinValue, 1), Math.max(prevMaxValue, data5.length)); + } + if (!hasSetYAxis) { + setYAxisRangeFromPlotData(data5); + } + if (isBandAxisData(xyChartData.xAxis)) { + retData = xyChartData.xAxis.categories.map((c3, i2) => [c3, data5[i2]]); + } + if (isLinearAxisData(xyChartData.xAxis)) { + const min10 = xyChartData.xAxis.min; + const max10 = xyChartData.xAxis.max; + const step3 = (max10 - min10) / (data5.length - 1); + const categories = []; + for (let i2 = min10; i2 <= max10; i2 += step3) { + categories.push(`${i2}`); + } + retData = categories.map((c3, i2) => [c3, data5[i2]]); + } + return retData; + } + function getPlotColorFromPalette(plotIndex2) { + return plotColorPalette[plotIndex2 === 0 ? 0 : plotIndex2 % plotColorPalette.length]; + } + function setLineData(title2, data5) { + const plotData = transformDataWithoutCategory(data5); + xyChartData.plots.push({ + type: "line", + strokeFill: getPlotColorFromPalette(plotIndex), + strokeWidth: 2, + data: plotData + }); + plotIndex++; + } + function setBarData(title2, data5) { + const plotData = transformDataWithoutCategory(data5); + xyChartData.plots.push({ + type: "bar", + fill: getPlotColorFromPalette(plotIndex), + data: plotData + }); + plotIndex++; + } + function getDrawableElem() { + if (xyChartData.plots.length === 0) { + throw Error("No Plot to render, please provide a plot with some data"); + } + xyChartData.title = getDiagramTitle(); + return XYChartBuilder.build(xyChartConfig, xyChartData, xyChartThemeConfig, tmpSVGGroup); + } + function getChartThemeConfig() { + return xyChartThemeConfig; + } + function getChartConfig() { + return xyChartConfig; + } + function getXYChartData() { + return xyChartData; + } + var plotIndex, tmpSVGGroup, xyChartConfig, xyChartThemeConfig, xyChartData, plotColorPalette, hasSetXAxis, hasSetYAxis, clear12, xychartDb_default; + var init_xychartDb = __esm({ + "src/diagrams/xychart/xychartDb.ts"() { + "use strict"; + init_config(); + init_defaultConfig(); + init_theme_default(); + init_utils2(); + init_common(); + init_commonDb(); + init_chartBuilder(); + init_interfaces(); + plotIndex = 0; + xyChartConfig = getChartDefaultConfig(); + xyChartThemeConfig = getChartDefaultThemeConfig(); + xyChartData = getChartDefaultData(); + plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color2) => color2.trim()); + hasSetXAxis = false; + hasSetYAxis = false; + __name(getChartDefaultThemeConfig, "getChartDefaultThemeConfig"); + __name(getChartDefaultConfig, "getChartDefaultConfig"); + __name(getChartDefaultData, "getChartDefaultData"); + __name(textSanitizer2, "textSanitizer"); + __name(setTmpSVGG, "setTmpSVGG"); + __name(setOrientation, "setOrientation"); + __name(setXAxisTitle, "setXAxisTitle"); + __name(setXAxisRangeData, "setXAxisRangeData"); + __name(setXAxisBand, "setXAxisBand"); + __name(setYAxisTitle, "setYAxisTitle"); + __name(setYAxisRangeData, "setYAxisRangeData"); + __name(setYAxisRangeFromPlotData, "setYAxisRangeFromPlotData"); + __name(transformDataWithoutCategory, "transformDataWithoutCategory"); + __name(getPlotColorFromPalette, "getPlotColorFromPalette"); + __name(setLineData, "setLineData"); + __name(setBarData, "setBarData"); + __name(getDrawableElem, "getDrawableElem"); + __name(getChartThemeConfig, "getChartThemeConfig"); + __name(getChartConfig, "getChartConfig"); + __name(getXYChartData, "getXYChartData"); + clear12 = /* @__PURE__ */ __name(function() { + clear(); + plotIndex = 0; + xyChartConfig = getChartDefaultConfig(); + xyChartData = getChartDefaultData(); + xyChartThemeConfig = getChartDefaultThemeConfig(); + plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color2) => color2.trim()); + hasSetXAxis = false; + hasSetYAxis = false; + }, "clear"); + xychartDb_default = { + getDrawableElem, + clear: clear12, + setAccTitle, + getAccTitle, + setDiagramTitle, + getDiagramTitle, + getAccDescription, + setAccDescription, + setOrientation, + setXAxisTitle, + setXAxisRangeData, + setXAxisBand, + setYAxisTitle, + setYAxisRangeData, + setLineData, + setBarData, + setTmpSVGG, + getChartThemeConfig, + getChartConfig, + getXYChartData + }; + } + }); + + // src/diagrams/xychart/xychartRenderer.ts + var draw9, xychartRenderer_default; + var init_xychartRenderer = __esm({ + "src/diagrams/xychart/xychartRenderer.ts"() { + "use strict"; + init_logger(); + init_selectSvgElement(); + init_setupGraphViewbox(); + draw9 = /* @__PURE__ */ __name((txt, id35, _version, diagObj) => { + const db10 = diagObj.db; + const themeConfig = db10.getChartThemeConfig(); + const chartConfig = db10.getChartConfig(); + const labelData = db10.getXYChartData().plots[0].data.map((data5) => data5[1]); + function getDominantBaseLine(horizontalPos) { + return horizontalPos === "top" ? "text-before-edge" : "middle"; + } + __name(getDominantBaseLine, "getDominantBaseLine"); + function getTextAnchor(verticalPos) { + return verticalPos === "left" ? "start" : verticalPos === "right" ? "end" : "middle"; + } + __name(getTextAnchor, "getTextAnchor"); + function getTextTransformation(data5) { + return `translate(${data5.x}, ${data5.y}) rotate(${data5.rotation || 0})`; + } + __name(getTextTransformation, "getTextTransformation"); + log.debug("Rendering xychart chart\n" + txt); + const svg2 = selectSvgElement(id35); + const group2 = svg2.append("g").attr("class", "main"); + const background = group2.append("rect").attr("width", chartConfig.width).attr("height", chartConfig.height).attr("class", "background"); + configureSvgSize(svg2, chartConfig.height, chartConfig.width, true); + svg2.attr("viewBox", `0 0 ${chartConfig.width} ${chartConfig.height}`); + background.attr("fill", themeConfig.backgroundColor); + db10.setTmpSVGG(svg2.append("g").attr("class", "mermaid-tmp-group")); + const shapes4 = db10.getDrawableElem(); + const groups = {}; + function getGroup(gList) { + let elem = group2; + let prefix = ""; + for (const [i2] of gList.entries()) { + let parent4 = group2; + if (i2 > 0 && groups[prefix]) { + parent4 = groups[prefix]; + } + prefix += gList[i2]; + elem = groups[prefix]; + if (!elem) { + elem = groups[prefix] = parent4.append("g").attr("class", gList[i2]); + } + } + return elem; + } + __name(getGroup, "getGroup"); + for (const shape of shapes4) { + if (shape.data.length === 0) { + continue; + } + const shapeGroup = getGroup(shape.groupTexts); + switch (shape.type) { + case "rect": + shapeGroup.selectAll("rect").data(shape.data).enter().append("rect").attr("x", (data5) => data5.x).attr("y", (data5) => data5.y).attr("width", (data5) => data5.width).attr("height", (data5) => data5.height).attr("fill", (data5) => data5.fill).attr("stroke", (data5) => data5.strokeFill).attr("stroke-width", (data5) => data5.strokeWidth); + if (chartConfig.showDataLabel) { + const showDataLabelOutsideBar = chartConfig.showDataLabelOutsideBar; + if (chartConfig.chartOrientation === "horizontal") { + let fitsHorizontally2 = function(item, fontSize) { + const { data: data5, label } = item; + const textWidth = fontSize * label.length * charWidthFactor; + return textWidth <= data5.width - rightMargin; + }; + var fitsHorizontally = fitsHorizontally2; + __name(fitsHorizontally2, "fitsHorizontally"); + const charWidthFactor = 0.7; + const rightMargin = 10; + const validItems = shape.data.map((d3, i2) => ({ data: d3, label: labelData[i2].toString() })).filter((item) => item.data.width > 0 && item.data.height > 0); + const candidateFontSizes = validItems.map((item) => { + const { data: data5 } = item; + let fontSize = data5.height * 0.7; + while (!fitsHorizontally2(item, fontSize) && fontSize > 0) { + fontSize -= 1; + } + return fontSize; + }); + const uniformFontSize = Math.floor(Math.min(...candidateFontSizes)); + const determineLabelXPosition = /* @__PURE__ */ __name((item) => { + if (showDataLabelOutsideBar) { + return item.data.x + item.data.width + rightMargin; + } else { + return item.data.x + item.data.width - rightMargin; + } + }, "determineLabelXPosition"); + shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x", determineLabelXPosition).attr("y", (item) => item.data.y + item.data.height / 2).attr("text-anchor", showDataLabelOutsideBar ? "start" : "end").attr("dominant-baseline", "middle").attr("fill", themeConfig.dataLabelColor).attr("font-size", `${uniformFontSize}px`).text((item) => item.label); + } else { + let fitsInBar2 = function(item, fontSize, yOffset2) { + const { data: data5, label } = item; + const charWidthFactor = 0.7; + const textWidth = fontSize * label.length * charWidthFactor; + const centerX = data5.x + data5.width / 2; + const leftEdge = centerX - textWidth / 2; + const rightEdge = centerX + textWidth / 2; + const horizontalFits = leftEdge >= data5.x && rightEdge <= data5.x + data5.width; + const verticalFits = data5.y + yOffset2 + fontSize <= data5.y + data5.height; + return horizontalFits && verticalFits; + }; + var fitsInBar = fitsInBar2; + __name(fitsInBar2, "fitsInBar"); + const yOffset = 10; + const validItems = shape.data.map((d3, i2) => ({ data: d3, label: labelData[i2].toString() })).filter((item) => item.data.width > 0 && item.data.height > 0); + const candidateFontSizes = validItems.map((item) => { + const { data: data5, label } = item; + let fontSize = data5.width / (label.length * 0.7); + while (!fitsInBar2(item, fontSize, yOffset) && fontSize > 0) { + fontSize -= 1; + } + return fontSize; + }); + const uniformFontSize = Math.floor(Math.min(...candidateFontSizes)); + const determineLabelYPosition = /* @__PURE__ */ __name((item) => { + if (showDataLabelOutsideBar) { + return item.data.y - yOffset; + } else { + return item.data.y + yOffset; + } + }, "determineLabelYPosition"); + shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x", (item) => item.data.x + item.data.width / 2).attr("y", determineLabelYPosition).attr("text-anchor", "middle").attr("dominant-baseline", showDataLabelOutsideBar ? "auto" : "hanging").attr("fill", themeConfig.dataLabelColor).attr("font-size", `${uniformFontSize}px`).text((item) => item.label); + } + } + break; + case "text": + shapeGroup.selectAll("text").data(shape.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (data5) => data5.fill).attr("font-size", (data5) => data5.fontSize).attr("dominant-baseline", (data5) => getDominantBaseLine(data5.verticalPos)).attr("text-anchor", (data5) => getTextAnchor(data5.horizontalPos)).attr("transform", (data5) => getTextTransformation(data5)).text((data5) => data5.text); + break; + case "path": + shapeGroup.selectAll("path").data(shape.data).enter().append("path").attr("d", (data5) => data5.path).attr("fill", (data5) => data5.fill ? data5.fill : "none").attr("stroke", (data5) => data5.strokeFill).attr("stroke-width", (data5) => data5.strokeWidth); + break; + } + } + }, "draw"); + xychartRenderer_default = { + draw: draw9 + }; + } + }); + + // src/diagrams/xychart/xychartDiagram.ts + var xychartDiagram_exports = {}; + __export(xychartDiagram_exports, { + diagram: () => diagram9 + }); + var diagram9; + var init_xychartDiagram = __esm({ + "src/diagrams/xychart/xychartDiagram.ts"() { + "use strict"; + init_xychart(); + init_xychartDb(); + init_xychartRenderer(); + diagram9 = { + parser: xychart_default, + db: xychartDb_default, + renderer: xychartRenderer_default + }; + } + }); + + // src/diagrams/requirement/parser/requirementDiagram.jison + var parser10, requirementDiagram_default; + var init_requirementDiagram = __esm({ + "src/diagrams/requirement/parser/requirementDiagram.jison"() { + "use strict"; + parser10 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 3], $V1 = [1, 4], $V2 = [1, 5], $V3 = [1, 6], $V4 = [5, 6, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 77, 89, 90], $V5 = [1, 22], $V6 = [2, 7], $V7 = [1, 26], $V8 = [1, 27], $V9 = [1, 28], $Va = [1, 29], $Vb = [1, 33], $Vc = [1, 34], $Vd = [1, 35], $Ve = [1, 36], $Vf = [1, 37], $Vg = [1, 38], $Vh = [1, 24], $Vi = [1, 31], $Vj = [1, 32], $Vk = [1, 30], $Vl = [1, 39], $Vm = [1, 40], $Vn = [5, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 77, 89, 90], $Vo = [1, 61], $Vp = [89, 90], $Vq = [5, 8, 9, 11, 13, 21, 22, 23, 24, 27, 29, 41, 42, 43, 44, 45, 46, 54, 61, 63, 72, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], $Vr = [27, 29], $Vs = [1, 70], $Vt = [1, 71], $Vu = [1, 72], $Vv = [1, 73], $Vw = [1, 74], $Vx = [1, 75], $Vy = [1, 76], $Vz = [1, 83], $VA = [1, 80], $VB = [1, 84], $VC = [1, 85], $VD = [1, 86], $VE = [1, 87], $VF = [1, 88], $VG = [1, 89], $VH = [1, 90], $VI = [1, 91], $VJ = [1, 92], $VK = [5, 8, 9, 11, 13, 21, 22, 23, 24, 27, 41, 42, 43, 44, 45, 46, 54, 72, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], $VL = [63, 64], $VM = [1, 101], $VN = [5, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 76, 77, 89, 90], $VO = [5, 8, 9, 11, 13, 21, 22, 23, 24, 41, 42, 43, 44, 45, 46, 54, 72, 74, 75, 76, 77, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90], $VP = [1, 110], $VQ = [1, 106], $VR = [1, 107], $VS = [1, 108], $VT = [1, 109], $VU = [1, 111], $VV = [1, 116], $VW = [1, 117], $VX = [1, 114], $VY = [1, 115]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "directive": 4, "NEWLINE": 5, "RD": 6, "diagram": 7, "EOF": 8, "acc_title": 9, "acc_title_value": 10, "acc_descr": 11, "acc_descr_value": 12, "acc_descr_multiline_value": 13, "requirementDef": 14, "elementDef": 15, "relationshipDef": 16, "direction": 17, "styleStatement": 18, "classDefStatement": 19, "classStatement": 20, "direction_tb": 21, "direction_bt": 22, "direction_rl": 23, "direction_lr": 24, "requirementType": 25, "requirementName": 26, "STRUCT_START": 27, "requirementBody": 28, "STYLE_SEPARATOR": 29, "idList": 30, "ID": 31, "COLONSEP": 32, "id": 33, "TEXT": 34, "text": 35, "RISK": 36, "riskLevel": 37, "VERIFYMTHD": 38, "verifyType": 39, "STRUCT_STOP": 40, "REQUIREMENT": 41, "FUNCTIONAL_REQUIREMENT": 42, "INTERFACE_REQUIREMENT": 43, "PERFORMANCE_REQUIREMENT": 44, "PHYSICAL_REQUIREMENT": 45, "DESIGN_CONSTRAINT": 46, "LOW_RISK": 47, "MED_RISK": 48, "HIGH_RISK": 49, "VERIFY_ANALYSIS": 50, "VERIFY_DEMONSTRATION": 51, "VERIFY_INSPECTION": 52, "VERIFY_TEST": 53, "ELEMENT": 54, "elementName": 55, "elementBody": 56, "TYPE": 57, "type": 58, "DOCREF": 59, "ref": 60, "END_ARROW_L": 61, "relationship": 62, "LINE": 63, "END_ARROW_R": 64, "CONTAINS": 65, "COPIES": 66, "DERIVES": 67, "SATISFIES": 68, "VERIFIES": 69, "REFINES": 70, "TRACES": 71, "CLASSDEF": 72, "stylesOpt": 73, "CLASS": 74, "ALPHA": 75, "COMMA": 76, "STYLE": 77, "style": 78, "styleComponent": 79, "NUM": 80, "COLON": 81, "UNIT": 82, "SPACE": 83, "BRKT": 84, "PCT": 85, "MINUS": 86, "LABEL": 87, "SEMICOLON": 88, "unqString": 89, "qString": 90, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 5: "NEWLINE", 6: "RD", 8: "EOF", 9: "acc_title", 10: "acc_title_value", 11: "acc_descr", 12: "acc_descr_value", 13: "acc_descr_multiline_value", 21: "direction_tb", 22: "direction_bt", 23: "direction_rl", 24: "direction_lr", 27: "STRUCT_START", 29: "STYLE_SEPARATOR", 31: "ID", 32: "COLONSEP", 34: "TEXT", 36: "RISK", 38: "VERIFYMTHD", 40: "STRUCT_STOP", 41: "REQUIREMENT", 42: "FUNCTIONAL_REQUIREMENT", 43: "INTERFACE_REQUIREMENT", 44: "PERFORMANCE_REQUIREMENT", 45: "PHYSICAL_REQUIREMENT", 46: "DESIGN_CONSTRAINT", 47: "LOW_RISK", 48: "MED_RISK", 49: "HIGH_RISK", 50: "VERIFY_ANALYSIS", 51: "VERIFY_DEMONSTRATION", 52: "VERIFY_INSPECTION", 53: "VERIFY_TEST", 54: "ELEMENT", 57: "TYPE", 59: "DOCREF", 61: "END_ARROW_L", 63: "LINE", 64: "END_ARROW_R", 65: "CONTAINS", 66: "COPIES", 67: "DERIVES", 68: "SATISFIES", 69: "VERIFIES", 70: "REFINES", 71: "TRACES", 72: "CLASSDEF", 74: "CLASS", 75: "ALPHA", 76: "COMMA", 77: "STYLE", 80: "NUM", 81: "COLON", 82: "UNIT", 83: "SPACE", 84: "BRKT", 85: "PCT", 86: "MINUS", 87: "LABEL", 88: "SEMICOLON", 89: "unqString", 90: "qString" }, + productions_: [0, [3, 3], [3, 2], [3, 4], [4, 2], [4, 2], [4, 1], [7, 0], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [17, 1], [17, 1], [17, 1], [17, 1], [14, 5], [14, 7], [28, 5], [28, 5], [28, 5], [28, 5], [28, 2], [28, 1], [25, 1], [25, 1], [25, 1], [25, 1], [25, 1], [25, 1], [37, 1], [37, 1], [37, 1], [39, 1], [39, 1], [39, 1], [39, 1], [15, 5], [15, 7], [56, 5], [56, 5], [56, 2], [56, 1], [16, 5], [16, 5], [62, 1], [62, 1], [62, 1], [62, 1], [62, 1], [62, 1], [62, 1], [19, 3], [20, 3], [20, 3], [30, 1], [30, 3], [30, 1], [30, 3], [18, 3], [73, 1], [73, 3], [78, 1], [78, 2], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [26, 1], [26, 1], [33, 1], [33, 1], [35, 1], [35, 1], [55, 1], [55, 1], [58, 1], [58, 1], [60, 1], [60, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 4: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 5: + case 6: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 7: + this.$ = []; + break; + case 17: + yy.setDirection("TB"); + break; + case 18: + yy.setDirection("BT"); + break; + case 19: + yy.setDirection("RL"); + break; + case 20: + yy.setDirection("LR"); + break; + case 21: + yy.addRequirement($$[$0 - 3], $$[$0 - 4]); + break; + case 22: + yy.addRequirement($$[$0 - 5], $$[$0 - 6]); + yy.setClass([$$[$0 - 5]], $$[$0 - 3]); + break; + case 23: + yy.setNewReqId($$[$0 - 2]); + break; + case 24: + yy.setNewReqText($$[$0 - 2]); + break; + case 25: + yy.setNewReqRisk($$[$0 - 2]); + break; + case 26: + yy.setNewReqVerifyMethod($$[$0 - 2]); + break; + case 29: + this.$ = yy.RequirementType.REQUIREMENT; + break; + case 30: + this.$ = yy.RequirementType.FUNCTIONAL_REQUIREMENT; + break; + case 31: + this.$ = yy.RequirementType.INTERFACE_REQUIREMENT; + break; + case 32: + this.$ = yy.RequirementType.PERFORMANCE_REQUIREMENT; + break; + case 33: + this.$ = yy.RequirementType.PHYSICAL_REQUIREMENT; + break; + case 34: + this.$ = yy.RequirementType.DESIGN_CONSTRAINT; + break; + case 35: + this.$ = yy.RiskLevel.LOW_RISK; + break; + case 36: + this.$ = yy.RiskLevel.MED_RISK; + break; + case 37: + this.$ = yy.RiskLevel.HIGH_RISK; + break; + case 38: + this.$ = yy.VerifyType.VERIFY_ANALYSIS; + break; + case 39: + this.$ = yy.VerifyType.VERIFY_DEMONSTRATION; + break; + case 40: + this.$ = yy.VerifyType.VERIFY_INSPECTION; + break; + case 41: + this.$ = yy.VerifyType.VERIFY_TEST; + break; + case 42: + yy.addElement($$[$0 - 3]); + break; + case 43: + yy.addElement($$[$0 - 5]); + yy.setClass([$$[$0 - 5]], $$[$0 - 3]); + break; + case 44: + yy.setNewElementType($$[$0 - 2]); + break; + case 45: + yy.setNewElementDocRef($$[$0 - 2]); + break; + case 48: + yy.addRelationship($$[$0 - 2], $$[$0], $$[$0 - 4]); + break; + case 49: + yy.addRelationship($$[$0 - 2], $$[$0 - 4], $$[$0]); + break; + case 50: + this.$ = yy.Relationships.CONTAINS; + break; + case 51: + this.$ = yy.Relationships.COPIES; + break; + case 52: + this.$ = yy.Relationships.DERIVES; + break; + case 53: + this.$ = yy.Relationships.SATISFIES; + break; + case 54: + this.$ = yy.Relationships.VERIFIES; + break; + case 55: + this.$ = yy.Relationships.REFINES; + break; + case 56: + this.$ = yy.Relationships.TRACES; + break; + case 57: + this.$ = $$[$0 - 2]; + yy.defineClass($$[$0 - 1], $$[$0]); + break; + case 58: + yy.setClass($$[$0 - 1], $$[$0]); + break; + case 59: + yy.setClass([$$[$0 - 2]], $$[$0]); + break; + case 60: + case 62: + this.$ = [$$[$0]]; + break; + case 61: + case 63: + this.$ = $$[$0 - 2].concat([$$[$0]]); + break; + case 64: + this.$ = $$[$0 - 2]; + yy.setCssStyle($$[$0 - 1], $$[$0]); + break; + case 65: + this.$ = [$$[$0]]; + break; + case 66: + $$[$0 - 2].push($$[$0]); + this.$ = $$[$0 - 2]; + break; + case 68: + this.$ = $$[$0 - 1] + $$[$0]; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 6: $V0, 9: $V1, 11: $V2, 13: $V3 }, { 1: [3] }, { 3: 8, 4: 2, 5: [1, 7], 6: $V0, 9: $V1, 11: $V2, 13: $V3 }, { 5: [1, 9] }, { 10: [1, 10] }, { 12: [1, 11] }, o2($V4, [2, 6]), { 3: 12, 4: 2, 6: $V0, 9: $V1, 11: $V2, 13: $V3 }, { 1: [2, 2] }, { 4: 17, 5: $V5, 7: 13, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, o2($V4, [2, 4]), o2($V4, [2, 5]), { 1: [2, 1] }, { 8: [1, 41] }, { 4: 17, 5: $V5, 7: 42, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 43, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 44, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 45, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 46, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 47, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 48, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 49, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 4: 17, 5: $V5, 7: 50, 8: $V6, 9: $V1, 11: $V2, 13: $V3, 14: 14, 15: 15, 16: 16, 17: 18, 18: 19, 19: 20, 20: 21, 21: $V7, 22: $V8, 23: $V9, 24: $Va, 25: 23, 33: 25, 41: $Vb, 42: $Vc, 43: $Vd, 44: $Ve, 45: $Vf, 46: $Vg, 54: $Vh, 72: $Vi, 74: $Vj, 77: $Vk, 89: $Vl, 90: $Vm }, { 26: 51, 89: [1, 52], 90: [1, 53] }, { 55: 54, 89: [1, 55], 90: [1, 56] }, { 29: [1, 59], 61: [1, 57], 63: [1, 58] }, o2($Vn, [2, 17]), o2($Vn, [2, 18]), o2($Vn, [2, 19]), o2($Vn, [2, 20]), { 30: 60, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 30: 63, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 30: 64, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, o2($Vp, [2, 29]), o2($Vp, [2, 30]), o2($Vp, [2, 31]), o2($Vp, [2, 32]), o2($Vp, [2, 33]), o2($Vp, [2, 34]), o2($Vq, [2, 81]), o2($Vq, [2, 82]), { 1: [2, 3] }, { 8: [2, 8] }, { 8: [2, 9] }, { 8: [2, 10] }, { 8: [2, 11] }, { 8: [2, 12] }, { 8: [2, 13] }, { 8: [2, 14] }, { 8: [2, 15] }, { 8: [2, 16] }, { 27: [1, 65], 29: [1, 66] }, o2($Vr, [2, 79]), o2($Vr, [2, 80]), { 27: [1, 67], 29: [1, 68] }, o2($Vr, [2, 85]), o2($Vr, [2, 86]), { 62: 69, 65: $Vs, 66: $Vt, 67: $Vu, 68: $Vv, 69: $Vw, 70: $Vx, 71: $Vy }, { 62: 77, 65: $Vs, 66: $Vt, 67: $Vu, 68: $Vv, 69: $Vw, 70: $Vx, 71: $Vy }, { 30: 78, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 73: 79, 75: $Vz, 76: $VA, 78: 81, 79: 82, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }, o2($VK, [2, 60]), o2($VK, [2, 62]), { 73: 93, 75: $Vz, 76: $VA, 78: 81, 79: 82, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }, { 30: 94, 33: 62, 75: $Vo, 76: $VA, 89: $Vl, 90: $Vm }, { 5: [1, 95] }, { 30: 96, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 5: [1, 97] }, { 30: 98, 33: 62, 75: $Vo, 89: $Vl, 90: $Vm }, { 63: [1, 99] }, o2($VL, [2, 50]), o2($VL, [2, 51]), o2($VL, [2, 52]), o2($VL, [2, 53]), o2($VL, [2, 54]), o2($VL, [2, 55]), o2($VL, [2, 56]), { 64: [1, 100] }, o2($Vn, [2, 59], { 76: $VA }), o2($Vn, [2, 64], { 76: $VM }), { 33: 103, 75: [1, 102], 89: $Vl, 90: $Vm }, o2($VN, [2, 65], { 79: 104, 75: $Vz, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }), o2($VO, [2, 67]), o2($VO, [2, 69]), o2($VO, [2, 70]), o2($VO, [2, 71]), o2($VO, [2, 72]), o2($VO, [2, 73]), o2($VO, [2, 74]), o2($VO, [2, 75]), o2($VO, [2, 76]), o2($VO, [2, 77]), o2($VO, [2, 78]), o2($Vn, [2, 57], { 76: $VM }), o2($Vn, [2, 58], { 76: $VA }), { 5: $VP, 28: 105, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 27: [1, 112], 76: $VA }, { 5: $VV, 40: $VW, 56: 113, 57: $VX, 59: $VY }, { 27: [1, 118], 76: $VA }, { 33: 119, 89: $Vl, 90: $Vm }, { 33: 120, 89: $Vl, 90: $Vm }, { 75: $Vz, 78: 121, 79: 82, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }, o2($VK, [2, 61]), o2($VK, [2, 63]), o2($VO, [2, 68]), o2($Vn, [2, 21]), { 32: [1, 122] }, { 32: [1, 123] }, { 32: [1, 124] }, { 32: [1, 125] }, { 5: $VP, 28: 126, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, o2($Vn, [2, 28]), { 5: [1, 127] }, o2($Vn, [2, 42]), { 32: [1, 128] }, { 32: [1, 129] }, { 5: $VV, 40: $VW, 56: 130, 57: $VX, 59: $VY }, o2($Vn, [2, 47]), { 5: [1, 131] }, o2($Vn, [2, 48]), o2($Vn, [2, 49]), o2($VN, [2, 66], { 79: 104, 75: $Vz, 80: $VB, 81: $VC, 82: $VD, 83: $VE, 84: $VF, 85: $VG, 86: $VH, 87: $VI, 88: $VJ }), { 33: 132, 89: $Vl, 90: $Vm }, { 35: 133, 89: [1, 134], 90: [1, 135] }, { 37: 136, 47: [1, 137], 48: [1, 138], 49: [1, 139] }, { 39: 140, 50: [1, 141], 51: [1, 142], 52: [1, 143], 53: [1, 144] }, o2($Vn, [2, 27]), { 5: $VP, 28: 145, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 58: 146, 89: [1, 147], 90: [1, 148] }, { 60: 149, 89: [1, 150], 90: [1, 151] }, o2($Vn, [2, 46]), { 5: $VV, 40: $VW, 56: 152, 57: $VX, 59: $VY }, { 5: [1, 153] }, { 5: [1, 154] }, { 5: [2, 83] }, { 5: [2, 84] }, { 5: [1, 155] }, { 5: [2, 35] }, { 5: [2, 36] }, { 5: [2, 37] }, { 5: [1, 156] }, { 5: [2, 38] }, { 5: [2, 39] }, { 5: [2, 40] }, { 5: [2, 41] }, o2($Vn, [2, 22]), { 5: [1, 157] }, { 5: [2, 87] }, { 5: [2, 88] }, { 5: [1, 158] }, { 5: [2, 89] }, { 5: [2, 90] }, o2($Vn, [2, 43]), { 5: $VP, 28: 159, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 5: $VP, 28: 160, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 5: $VP, 28: 161, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 5: $VP, 28: 162, 31: $VQ, 34: $VR, 36: $VS, 38: $VT, 40: $VU }, { 5: $VV, 40: $VW, 56: 163, 57: $VX, 59: $VY }, { 5: $VV, 40: $VW, 56: 164, 57: $VX, 59: $VY }, o2($Vn, [2, 23]), o2($Vn, [2, 24]), o2($Vn, [2, 25]), o2($Vn, [2, 26]), o2($Vn, [2, 44]), o2($Vn, [2, 45])], + defaultActions: { 8: [2, 2], 12: [2, 1], 41: [2, 3], 42: [2, 8], 43: [2, 9], 44: [2, 10], 45: [2, 11], 46: [2, 12], 47: [2, 13], 48: [2, 14], 49: [2, 15], 50: [2, 16], 134: [2, 83], 135: [2, 84], 137: [2, 35], 138: [2, 36], 139: [2, 37], 141: [2, 38], 142: [2, 39], 143: [2, 40], 144: [2, 41], 147: [2, 87], 148: [2, 88], 150: [2, 89], 151: [2, 90] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + return "title"; + break; + case 1: + this.begin("acc_title"); + return 9; + break; + case 2: + this.popState(); + return "acc_title_value"; + break; + case 3: + this.begin("acc_descr"); + return 11; + break; + case 4: + this.popState(); + return "acc_descr_value"; + break; + case 5: + this.begin("acc_descr_multiline"); + break; + case 6: + this.popState(); + break; + case 7: + return "acc_descr_multiline_value"; + break; + case 8: + return 21; + break; + case 9: + return 22; + break; + case 10: + return 23; + break; + case 11: + return 24; + break; + case 12: + return 5; + break; + case 13: + break; + case 14: + break; + case 15: + break; + case 16: + return 8; + break; + case 17: + return 6; + break; + case 18: + return 27; + break; + case 19: + return 40; + break; + case 20: + return 29; + break; + case 21: + return 32; + break; + case 22: + return 31; + break; + case 23: + return 34; + break; + case 24: + return 36; + break; + case 25: + return 38; + break; + case 26: + return 41; + break; + case 27: + return 42; + break; + case 28: + return 43; + break; + case 29: + return 44; + break; + case 30: + return 45; + break; + case 31: + return 46; + break; + case 32: + return 47; + break; + case 33: + return 48; + break; + case 34: + return 49; + break; + case 35: + return 50; + break; + case 36: + return 51; + break; + case 37: + return 52; + break; + case 38: + return 53; + break; + case 39: + return 54; + break; + case 40: + return 65; + break; + case 41: + return 66; + break; + case 42: + return 67; + break; + case 43: + return 68; + break; + case 44: + return 69; + break; + case 45: + return 70; + break; + case 46: + return 71; + break; + case 47: + return 57; + break; + case 48: + return 59; + break; + case 49: + this.begin("style"); + return 77; + break; + case 50: + return 75; + break; + case 51: + return 81; + break; + case 52: + return 88; + break; + case 53: + return "PERCENT"; + break; + case 54: + return 86; + break; + case 55: + return 84; + break; + case 56: + break; + case 57: + this.begin("string"); + break; + case 58: + this.popState(); + break; + case 59: + this.begin("style"); + return 72; + break; + case 60: + this.begin("style"); + return 74; + break; + case 61: + return 61; + break; + case 62: + return 64; + break; + case 63: + return 63; + break; + case 64: + this.begin("string"); + break; + case 65: + this.popState(); + break; + case 66: + return "qString"; + break; + case 67: + yy_.yytext = yy_.yytext.trim(); + return 89; + break; + case 68: + return 75; + break; + case 69: + return 80; + break; + case 70: + return 76; + break; + } + }, "anonymous"), + rules: [/^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:(\r?\n)+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:$)/i, /^(?:requirementDiagram\b)/i, /^(?:\{)/i, /^(?:\})/i, /^(?::{3})/i, /^(?::)/i, /^(?:id\b)/i, /^(?:text\b)/i, /^(?:risk\b)/i, /^(?:verifyMethod\b)/i, /^(?:requirement\b)/i, /^(?:functionalRequirement\b)/i, /^(?:interfaceRequirement\b)/i, /^(?:performanceRequirement\b)/i, /^(?:physicalRequirement\b)/i, /^(?:designConstraint\b)/i, /^(?:low\b)/i, /^(?:medium\b)/i, /^(?:high\b)/i, /^(?:analysis\b)/i, /^(?:demonstration\b)/i, /^(?:inspection\b)/i, /^(?:test\b)/i, /^(?:element\b)/i, /^(?:contains\b)/i, /^(?:copies\b)/i, /^(?:derives\b)/i, /^(?:satisfies\b)/i, /^(?:verifies\b)/i, /^(?:refines\b)/i, /^(?:traces\b)/i, /^(?:type\b)/i, /^(?:docref\b)/i, /^(?:style\b)/i, /^(?:\w+)/i, /^(?::)/i, /^(?:;)/i, /^(?:%)/i, /^(?:-)/i, /^(?:#)/i, /^(?: )/i, /^(?:["])/i, /^(?:\n)/i, /^(?:classDef\b)/i, /^(?:class\b)/i, /^(?:<-)/i, /^(?:->)/i, /^(?:-)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[\w][^:,\r\n\{\<\>\-\=]*)/i, /^(?:\w+)/i, /^(?:[0-9]+)/i, /^(?:,)/i], + conditions: { "acc_descr_multiline": { "rules": [6, 7, 68, 69, 70], "inclusive": false }, "acc_descr": { "rules": [4, 68, 69, 70], "inclusive": false }, "acc_title": { "rules": [2, 68, 69, 70], "inclusive": false }, "style": { "rules": [50, 51, 52, 53, 54, 55, 56, 57, 58, 68, 69, 70], "inclusive": false }, "unqString": { "rules": [68, 69, 70], "inclusive": false }, "token": { "rules": [68, 69, 70], "inclusive": false }, "string": { "rules": [65, 66, 68, 69, 70], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 59, 60, 61, 62, 63, 64, 67, 68, 69, 70], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser10.parser = parser10; + requirementDiagram_default = parser10; + } + }); + + // src/diagrams/requirement/requirementDb.ts + var RequirementDB; + var init_requirementDb = __esm({ + "src/diagrams/requirement/requirementDb.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_commonDb(); + RequirementDB = class { + constructor() { + this.relations = []; + this.latestRequirement = this.getInitialRequirement(); + this.requirements = /* @__PURE__ */ new Map(); + this.latestElement = this.getInitialElement(); + this.elements = /* @__PURE__ */ new Map(); + this.classes = /* @__PURE__ */ new Map(); + this.direction = "TB"; + this.RequirementType = { + REQUIREMENT: "Requirement", + FUNCTIONAL_REQUIREMENT: "Functional Requirement", + INTERFACE_REQUIREMENT: "Interface Requirement", + PERFORMANCE_REQUIREMENT: "Performance Requirement", + PHYSICAL_REQUIREMENT: "Physical Requirement", + DESIGN_CONSTRAINT: "Design Constraint" + }; + this.RiskLevel = { + LOW_RISK: "Low", + MED_RISK: "Medium", + HIGH_RISK: "High" + }; + this.VerifyType = { + VERIFY_ANALYSIS: "Analysis", + VERIFY_DEMONSTRATION: "Demonstration", + VERIFY_INSPECTION: "Inspection", + VERIFY_TEST: "Test" + }; + this.Relationships = { + CONTAINS: "contains", + COPIES: "copies", + DERIVES: "derives", + SATISFIES: "satisfies", + VERIFIES: "verifies", + REFINES: "refines", + TRACES: "traces" + }; + this.setAccTitle = setAccTitle; + this.getAccTitle = getAccTitle; + this.setAccDescription = setAccDescription; + this.getAccDescription = getAccDescription; + this.setDiagramTitle = setDiagramTitle; + this.getDiagramTitle = getDiagramTitle; + this.getConfig = /* @__PURE__ */ __name(() => getConfig2().requirement, "getConfig"); + this.clear(); + this.setDirection = this.setDirection.bind(this); + this.addRequirement = this.addRequirement.bind(this); + this.setNewReqId = this.setNewReqId.bind(this); + this.setNewReqRisk = this.setNewReqRisk.bind(this); + this.setNewReqText = this.setNewReqText.bind(this); + this.setNewReqVerifyMethod = this.setNewReqVerifyMethod.bind(this); + this.addElement = this.addElement.bind(this); + this.setNewElementType = this.setNewElementType.bind(this); + this.setNewElementDocRef = this.setNewElementDocRef.bind(this); + this.addRelationship = this.addRelationship.bind(this); + this.setCssStyle = this.setCssStyle.bind(this); + this.setClass = this.setClass.bind(this); + this.defineClass = this.defineClass.bind(this); + this.setAccTitle = this.setAccTitle.bind(this); + this.setAccDescription = this.setAccDescription.bind(this); + } + static { + __name(this, "RequirementDB"); + } + getDirection() { + return this.direction; + } + setDirection(dir2) { + this.direction = dir2; + } + resetLatestRequirement() { + this.latestRequirement = this.getInitialRequirement(); + } + resetLatestElement() { + this.latestElement = this.getInitialElement(); + } + getInitialRequirement() { + return { + requirementId: "", + text: "", + risk: "", + verifyMethod: "", + name: "", + type: "", + cssStyles: [], + classes: ["default"] + }; + } + getInitialElement() { + return { + name: "", + type: "", + docRef: "", + cssStyles: [], + classes: ["default"] + }; + } + addRequirement(name, type3) { + if (!this.requirements.has(name)) { + this.requirements.set(name, { + name, + type: type3, + requirementId: this.latestRequirement.requirementId, + text: this.latestRequirement.text, + risk: this.latestRequirement.risk, + verifyMethod: this.latestRequirement.verifyMethod, + cssStyles: [], + classes: ["default"] + }); + } + this.resetLatestRequirement(); + return this.requirements.get(name); + } + getRequirements() { + return this.requirements; + } + setNewReqId(id35) { + if (this.latestRequirement !== void 0) { + this.latestRequirement.requirementId = id35; + } + } + setNewReqText(text4) { + if (this.latestRequirement !== void 0) { + this.latestRequirement.text = text4; + } + } + setNewReqRisk(risk) { + if (this.latestRequirement !== void 0) { + this.latestRequirement.risk = risk; + } + } + setNewReqVerifyMethod(verifyMethod) { + if (this.latestRequirement !== void 0) { + this.latestRequirement.verifyMethod = verifyMethod; + } + } + addElement(name) { + if (!this.elements.has(name)) { + this.elements.set(name, { + name, + type: this.latestElement.type, + docRef: this.latestElement.docRef, + cssStyles: [], + classes: ["default"] + }); + log.info("Added new element: ", name); + } + this.resetLatestElement(); + return this.elements.get(name); + } + getElements() { + return this.elements; + } + setNewElementType(type3) { + if (this.latestElement !== void 0) { + this.latestElement.type = type3; + } + } + setNewElementDocRef(docRef) { + if (this.latestElement !== void 0) { + this.latestElement.docRef = docRef; + } + } + addRelationship(type3, src, dst) { + this.relations.push({ + type: type3, + src, + dst + }); + } + getRelationships() { + return this.relations; + } + clear() { + this.relations = []; + this.resetLatestRequirement(); + this.requirements = /* @__PURE__ */ new Map(); + this.resetLatestElement(); + this.elements = /* @__PURE__ */ new Map(); + this.classes = /* @__PURE__ */ new Map(); + clear(); + } + setCssStyle(ids, styles6) { + for (const id35 of ids) { + const node2 = this.requirements.get(id35) ?? this.elements.get(id35); + if (!styles6 || !node2) { + return; + } + for (const s2 of styles6) { + if (s2.includes(",")) { + node2.cssStyles.push(...s2.split(",")); + } else { + node2.cssStyles.push(s2); + } + } + } + } + setClass(ids, classNames) { + for (const id35 of ids) { + const node2 = this.requirements.get(id35) ?? this.elements.get(id35); + if (node2) { + for (const _class2 of classNames) { + node2.classes.push(_class2); + const styles6 = this.classes.get(_class2)?.styles; + if (styles6) { + node2.cssStyles.push(...styles6); + } + } + } + } + } + defineClass(ids, style3) { + for (const id35 of ids) { + let styleClass = this.classes.get(id35); + if (styleClass === void 0) { + styleClass = { id: id35, styles: [], textStyles: [] }; + this.classes.set(id35, styleClass); + } + if (style3) { + style3.forEach(function(s2) { + if (/color/.exec(s2)) { + const newStyle = s2.replace("fill", "bgFill"); + styleClass.textStyles.push(newStyle); + } + styleClass.styles.push(s2); + }); + } + this.requirements.forEach((value2) => { + if (value2.classes.includes(id35)) { + value2.cssStyles.push(...style3.flatMap((s2) => s2.split(","))); + } + }); + this.elements.forEach((value2) => { + if (value2.classes.includes(id35)) { + value2.cssStyles.push(...style3.flatMap((s2) => s2.split(","))); + } + }); + } + } + getClasses() { + return this.classes; + } + getData() { + const config5 = getConfig2(); + const nodes5 = []; + const edges3 = []; + for (const requirement of this.requirements.values()) { + const node2 = requirement; + node2.id = requirement.name; + node2.cssStyles = requirement.cssStyles; + node2.cssClasses = requirement.classes.join(" "); + node2.shape = "requirementBox"; + node2.look = config5.look; + node2.colorIndex = nodes5.length; + nodes5.push(node2); + } + for (const element3 of this.elements.values()) { + const node2 = element3; + node2.shape = "requirementBox"; + node2.look = config5.look; + node2.id = element3.name; + node2.cssStyles = element3.cssStyles; + node2.cssClasses = element3.classes.join(" "); + node2.colorIndex = nodes5.length; + nodes5.push(node2); + } + for (const relation of this.relations) { + let counter2 = 0; + const isContains = relation.type === this.Relationships.CONTAINS; + const edge = { + id: `${relation.src}-${relation.dst}-${counter2}`, + start: this.requirements.get(relation.src)?.name ?? this.elements.get(relation.src)?.name, + end: this.requirements.get(relation.dst)?.name ?? this.elements.get(relation.dst)?.name, + label: `<<${relation.type}>>`, + classes: "relationshipLine", + style: ["fill:none", isContains ? "" : "stroke-dasharray: 10,7"], + labelpos: "c", + thickness: "normal", + type: "normal", + pattern: isContains ? "normal" : "dashed", + arrowTypeStart: isContains ? "requirement_contains" : "", + arrowTypeEnd: isContains ? "" : "requirement_arrow", + look: config5.look, + labelType: "markdown" + }; + edges3.push(edge); + counter2++; + } + return { nodes: nodes5, edges: edges3, other: {}, config: config5, direction: this.getDirection() }; + } + }; + } + }); + + // src/diagrams/requirement/styles.js + var genColor3, getStyles8, styles_default7; + var init_styles7 = __esm({ + "src/diagrams/requirement/styles.js"() { + "use strict"; + init_config(); + genColor3 = /* @__PURE__ */ __name((options2) => { + const config5 = getConfig(); + const { themeVariables, look } = config5; + const { bkgColorArray, borderColorArray } = themeVariables; + if (!borderColorArray?.length) { + return ""; + } + let sections6 = ""; + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + sections6 += ` + + [data-look="${look}"][data-color-id="color-${i2}"].node path { + stroke: ${borderColorArray[i2]}; + fill: ${bkgColorArray?.length ? bkgColorArray[i2] : ""}; + } + + [data-look="${look}"][data-color-id="color-${i2}"].node rect { + stroke: ${borderColorArray[i2]}; + fill: ${bkgColorArray?.length ? bkgColorArray[i2] : ""}; + } + `; + } + return sections6; + }, "genColor"); + getStyles8 = /* @__PURE__ */ __name((options2) => { + const config5 = getConfig(); + const { look, themeVariables } = config5; + const { requirementEdgeLabelBackground } = themeVariables; + return ` + ${genColor3(options2)} + marker { + fill: ${options2.relationColor}; + stroke: ${options2.relationColor}; + } + + marker.cross { + stroke: ${options2.lineColor}; + } + + svg { + font-family: ${options2.fontFamily}; + font-size: ${options2.fontSize}; + } + + .reqBox { + fill: ${options2.requirementBackground}; + fill-opacity: 1.0; + stroke: ${options2.requirementBorderColor}; + stroke-width: ${options2.requirementBorderSize}; + } + + .reqTitle, .reqLabel{ + fill: ${options2.requirementTextColor}; + } + .reqLabelBox { + fill: ${options2.relationLabelBackground}; + fill-opacity: 1.0; + } + + .req-title-line { + stroke: ${options2.requirementBorderColor}; + stroke-width: ${options2.requirementBorderSize}; + } + .relationshipLine { + stroke: ${options2.relationColor}; + stroke-width: ${look === "neo" ? options2.strokeWidth : "1px"}; + } + .relationshipLabel { + fill: ${options2.relationLabelColor}; + } + .edgeLabel { + background-color: ${options2.edgeLabelBackground}; + } + .edgeLabel .label rect { + fill: ${options2.edgeLabelBackground}; + } + .edgeLabel .label text { + fill: ${options2.relationLabelColor}; + } + .divider { + stroke: ${options2.nodeBorder}; + stroke-width: 1; + } + .label { + font-family: ${options2.fontFamily}; + color: ${options2.nodeTextColor || options2.textColor}; + } + .label text,span { + fill: ${options2.nodeTextColor || options2.textColor}; + color: ${options2.nodeTextColor || options2.textColor}; + } + .labelBkg { + background-color: ${requirementEdgeLabelBackground ?? options2.edgeLabelBackground}; + } + +`; + }, "getStyles"); + styles_default7 = getStyles8; + } + }); + + // src/diagrams/requirement/requirementRenderer.ts + var requirementRenderer_exports = {}; + __export(requirementRenderer_exports, { + draw: () => draw10 + }); + var draw10; + var init_requirementRenderer = __esm({ + "src/diagrams/requirement/requirementRenderer.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_insertElementsForSize(); + init_render2(); + init_setupViewPortForSVG(); + init_utils2(); + draw10 = /* @__PURE__ */ __name(async function(text4, id35, _version, diag) { + log.info("REF0:"); + log.info("Drawing requirement diagram (unified)", id35); + const { securityLevel, state: conf5, layout: layout7, look } = getConfig2(); + const data4Layout = diag.db.getData(); + const svg2 = getDiagramElement(id35, securityLevel); + data4Layout.type = diag.type; + data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout7); + data4Layout.nodeSpacing = conf5?.nodeSpacing ?? 50; + data4Layout.rankSpacing = conf5?.rankSpacing ?? 50; + data4Layout.markers = look === "neo" ? ["requirement_contains_neo", "requirement_arrow_neo"] : ["requirement_contains", "requirement_arrow"]; + data4Layout.diagramId = id35; + await render6(data4Layout, svg2); + const padding2 = 8; + utils_default2.insertTitle( + svg2, + "requirementDiagramTitleText", + conf5?.titleTopMargin ?? 25, + diag.db.getDiagramTitle() + ); + setupViewPortForSVG(svg2, padding2, "requirementDiagram", conf5?.useMaxWidth ?? true); + }, "draw"); + } + }); + + // src/diagrams/requirement/requirementDiagram.ts + var requirementDiagram_exports = {}; + __export(requirementDiagram_exports, { + diagram: () => diagram10 + }); + var diagram10; + var init_requirementDiagram2 = __esm({ + "src/diagrams/requirement/requirementDiagram.ts"() { + "use strict"; + init_requirementDiagram(); + init_requirementDb(); + init_styles7(); + init_requirementRenderer(); + diagram10 = { + parser: requirementDiagram_default, + get db() { + return new RequirementDB(); + }, + renderer: requirementRenderer_exports, + styles: styles_default7 + }; + } + }); + + // src/diagrams/sequence/parser/sequenceDiagram.jison + var parser11, sequenceDiagram_default; + var init_sequenceDiagram = __esm({ + "src/diagrams/sequence/parser/sequenceDiagram.jison"() { + "use strict"; + parser11 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 12], $V7 = [1, 14], $V8 = [1, 15], $V9 = [1, 17], $Va = [1, 18], $Vb = [1, 19], $Vc = [1, 25], $Vd = [1, 26], $Ve = [1, 27], $Vf = [1, 28], $Vg = [1, 29], $Vh = [1, 30], $Vi = [1, 31], $Vj = [1, 32], $Vk = [1, 33], $Vl = [1, 34], $Vm = [1, 35], $Vn = [1, 36], $Vo = [1, 37], $Vp = [1, 38], $Vq = [1, 39], $Vr = [1, 40], $Vs = [1, 42], $Vt = [1, 43], $Vu = [1, 44], $Vv = [1, 45], $Vw = [1, 46], $Vx = [1, 47], $Vy = [1, 4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 49, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $Vz = [1, 74], $VA = [1, 80], $VB = [1, 81], $VC = [1, 82], $VD = [1, 83], $VE = [1, 84], $VF = [1, 85], $VG = [1, 86], $VH = [1, 87], $VI = [1, 88], $VJ = [1, 89], $VK = [1, 90], $VL = [1, 91], $VM = [1, 92], $VN = [1, 93], $VO = [1, 94], $VP = [1, 95], $VQ = [1, 96], $VR = [1, 97], $VS = [1, 98], $VT = [1, 99], $VU = [1, 100], $VV = [1, 101], $VW = [1, 102], $VX = [1, 103], $VY = [1, 104], $VZ = [1, 105], $V_ = [2, 78], $V$ = [4, 5, 17, 51, 53, 54], $V01 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V11 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 50, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V21 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 49, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V31 = [4, 5, 10, 14, 15, 17, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 48, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V41 = [5, 52], $V51 = [70, 71, 72, 73], $V61 = [1, 151]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "SPACE": 4, "NEWLINE": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "INVALID": 10, "box_section": 11, "box_line": 12, "participant_statement": 13, "create": 14, "box": 15, "restOfLine": 16, "end": 17, "signal": 18, "autonumber": 19, "NUM": 20, "off": 21, "activate": 22, "actor": 23, "deactivate": 24, "note_statement": 25, "links_statement": 26, "link_statement": 27, "properties_statement": 28, "details_statement": 29, "title": 30, "legacy_title": 31, "acc_title": 32, "acc_title_value": 33, "acc_descr": 34, "acc_descr_value": 35, "acc_descr_multiline_value": 36, "loop": 37, "rect": 38, "opt": 39, "alt": 40, "else_sections": 41, "par": 42, "par_sections": 43, "par_over": 44, "critical": 45, "option_sections": 46, "break": 47, "option": 48, "and": 49, "else": 50, "participant": 51, "AS": 52, "participant_actor": 53, "destroy": 54, "actor_with_config": 55, "note": 56, "placement": 57, "text2": 58, "over": 59, "actor_pair": 60, "links": 61, "link": 62, "properties": 63, "details": 64, "spaceList": 65, ",": 66, "left_of": 67, "right_of": 68, "signaltype": 69, "+": 70, "-": 71, "()": 72, "ACTOR": 73, "config_object": 74, "CONFIG_START": 75, "CONFIG_CONTENT": 76, "CONFIG_END": 77, "SOLID_OPEN_ARROW": 78, "DOTTED_OPEN_ARROW": 79, "SOLID_ARROW": 80, "SOLID_ARROW_TOP": 81, "SOLID_ARROW_BOTTOM": 82, "STICK_ARROW_TOP": 83, "STICK_ARROW_BOTTOM": 84, "SOLID_ARROW_TOP_DOTTED": 85, "SOLID_ARROW_BOTTOM_DOTTED": 86, "STICK_ARROW_TOP_DOTTED": 87, "STICK_ARROW_BOTTOM_DOTTED": 88, "SOLID_ARROW_TOP_REVERSE": 89, "SOLID_ARROW_BOTTOM_REVERSE": 90, "STICK_ARROW_TOP_REVERSE": 91, "STICK_ARROW_BOTTOM_REVERSE": 92, "SOLID_ARROW_TOP_REVERSE_DOTTED": 93, "SOLID_ARROW_BOTTOM_REVERSE_DOTTED": 94, "STICK_ARROW_TOP_REVERSE_DOTTED": 95, "STICK_ARROW_BOTTOM_REVERSE_DOTTED": 96, "BIDIRECTIONAL_SOLID_ARROW": 97, "DOTTED_ARROW": 98, "BIDIRECTIONAL_DOTTED_ARROW": 99, "SOLID_CROSS": 100, "DOTTED_CROSS": 101, "SOLID_POINT": 102, "DOTTED_POINT": 103, "TXT": 104, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 10: "INVALID", 14: "create", 15: "box", 16: "restOfLine", 17: "end", 19: "autonumber", 20: "NUM", 21: "off", 22: "activate", 24: "deactivate", 30: "title", 31: "legacy_title", 32: "acc_title", 33: "acc_title_value", 34: "acc_descr", 35: "acc_descr_value", 36: "acc_descr_multiline_value", 37: "loop", 38: "rect", 39: "opt", 40: "alt", 42: "par", 44: "par_over", 45: "critical", 47: "break", 48: "option", 49: "and", 50: "else", 51: "participant", 52: "AS", 53: "participant_actor", 54: "destroy", 56: "note", 59: "over", 61: "links", 62: "link", 63: "properties", 64: "details", 66: ",", 67: "left_of", 68: "right_of", 70: "+", 71: "-", 72: "()", 73: "ACTOR", 75: "CONFIG_START", 76: "CONFIG_CONTENT", 77: "CONFIG_END", 78: "SOLID_OPEN_ARROW", 79: "DOTTED_OPEN_ARROW", 80: "SOLID_ARROW", 81: "SOLID_ARROW_TOP", 82: "SOLID_ARROW_BOTTOM", 83: "STICK_ARROW_TOP", 84: "STICK_ARROW_BOTTOM", 85: "SOLID_ARROW_TOP_DOTTED", 86: "SOLID_ARROW_BOTTOM_DOTTED", 87: "STICK_ARROW_TOP_DOTTED", 88: "STICK_ARROW_BOTTOM_DOTTED", 89: "SOLID_ARROW_TOP_REVERSE", 90: "SOLID_ARROW_BOTTOM_REVERSE", 91: "STICK_ARROW_TOP_REVERSE", 92: "STICK_ARROW_BOTTOM_REVERSE", 93: "SOLID_ARROW_TOP_REVERSE_DOTTED", 94: "SOLID_ARROW_BOTTOM_REVERSE_DOTTED", 95: "STICK_ARROW_TOP_REVERSE_DOTTED", 96: "STICK_ARROW_BOTTOM_REVERSE_DOTTED", 97: "BIDIRECTIONAL_SOLID_ARROW", 98: "DOTTED_ARROW", 99: "BIDIRECTIONAL_DOTTED_ARROW", 100: "SOLID_CROSS", 101: "DOTTED_CROSS", 102: "SOLID_POINT", 103: "DOTTED_POINT", 104: "TXT" }, + productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [8, 1], [11, 0], [11, 2], [12, 2], [12, 1], [12, 1], [9, 1], [9, 2], [9, 4], [9, 2], [9, 4], [9, 3], [9, 3], [9, 2], [9, 3], [9, 3], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [46, 1], [46, 4], [43, 1], [43, 4], [41, 1], [41, 4], [13, 5], [13, 3], [13, 5], [13, 3], [13, 3], [13, 5], [13, 3], [13, 5], [13, 3], [25, 4], [25, 4], [26, 3], [27, 3], [28, 3], [29, 3], [65, 2], [65, 1], [60, 3], [60, 1], [57, 1], [57, 1], [18, 5], [18, 5], [18, 5], [18, 5], [18, 6], [18, 4], [55, 2], [74, 3], [23, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [69, 1], [58, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 3: + yy.apply($$[$0]); + return $$[$0]; + break; + case 4: + case 10: + this.$ = []; + break; + case 5: + case 11: + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + break; + case 6: + case 7: + case 12: + case 13: + this.$ = $$[$0]; + break; + case 8: + case 9: + case 14: + this.$ = []; + break; + case 16: + $$[$0].type = "createParticipant"; + this.$ = $$[$0]; + break; + case 17: + $$[$0 - 1].unshift({ type: "boxStart", boxData: yy.parseBoxData($$[$0 - 2]) }); + $$[$0 - 1].push({ type: "boxEnd", boxText: $$[$0 - 2] }); + this.$ = $$[$0 - 1]; + break; + case 19: + this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 2]), sequenceIndexStep: Number($$[$0 - 1]), sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER }; + break; + case 20: + this.$ = { type: "sequenceIndex", sequenceIndex: Number($$[$0 - 1]), sequenceIndexStep: 1, sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER }; + break; + case 21: + this.$ = { type: "sequenceIndex", sequenceVisible: false, signalType: yy.LINETYPE.AUTONUMBER }; + break; + case 22: + this.$ = { type: "sequenceIndex", sequenceVisible: true, signalType: yy.LINETYPE.AUTONUMBER }; + break; + case 23: + this.$ = { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor }; + break; + case 24: + this.$ = { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 1].actor }; + break; + case 30: + yy.setDiagramTitle($$[$0].substring(6)); + this.$ = $$[$0].substring(6); + break; + case 31: + yy.setDiagramTitle($$[$0].substring(7)); + this.$ = $$[$0].substring(7); + break; + case 32: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 33: + case 34: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 35: + $$[$0 - 1].unshift({ type: "loopStart", loopText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.LOOP_START }); + $$[$0 - 1].push({ type: "loopEnd", loopText: $$[$0 - 2], signalType: yy.LINETYPE.LOOP_END }); + this.$ = $$[$0 - 1]; + break; + case 36: + $$[$0 - 1].unshift({ type: "rectStart", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_START }); + $$[$0 - 1].push({ type: "rectEnd", color: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.RECT_END }); + this.$ = $$[$0 - 1]; + break; + case 37: + $$[$0 - 1].unshift({ type: "optStart", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_START }); + $$[$0 - 1].push({ type: "optEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.OPT_END }); + this.$ = $$[$0 - 1]; + break; + case 38: + $$[$0 - 1].unshift({ type: "altStart", altText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.ALT_START }); + $$[$0 - 1].push({ type: "altEnd", signalType: yy.LINETYPE.ALT_END }); + this.$ = $$[$0 - 1]; + break; + case 39: + $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_START }); + $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END }); + this.$ = $$[$0 - 1]; + break; + case 40: + $$[$0 - 1].unshift({ type: "parStart", parText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.PAR_OVER_START }); + $$[$0 - 1].push({ type: "parEnd", signalType: yy.LINETYPE.PAR_END }); + this.$ = $$[$0 - 1]; + break; + case 41: + $$[$0 - 1].unshift({ type: "criticalStart", criticalText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.CRITICAL_START }); + $$[$0 - 1].push({ type: "criticalEnd", signalType: yy.LINETYPE.CRITICAL_END }); + this.$ = $$[$0 - 1]; + break; + case 42: + $$[$0 - 1].unshift({ type: "breakStart", breakText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_START }); + $$[$0 - 1].push({ type: "breakEnd", optText: yy.parseMessage($$[$0 - 2]), signalType: yy.LINETYPE.BREAK_END }); + this.$ = $$[$0 - 1]; + break; + case 44: + this.$ = $$[$0 - 3].concat([{ type: "option", optionText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.CRITICAL_OPTION }, $$[$0]]); + break; + case 46: + this.$ = $$[$0 - 3].concat([{ type: "and", parText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.PAR_AND }, $$[$0]]); + break; + case 48: + this.$ = $$[$0 - 3].concat([{ type: "else", altText: yy.parseMessage($$[$0 - 1]), signalType: yy.LINETYPE.ALT_ELSE }, $$[$0]]); + break; + case 49: + $$[$0 - 3].draw = "participant"; + $$[$0 - 3].type = "addParticipant"; + $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]); + this.$ = $$[$0 - 3]; + break; + case 50: + $$[$0 - 1].draw = "participant"; + $$[$0 - 1].type = "addParticipant"; + this.$ = $$[$0 - 1]; + break; + case 51: + $$[$0 - 3].draw = "actor"; + $$[$0 - 3].type = "addParticipant"; + $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]); + this.$ = $$[$0 - 3]; + break; + case 52: + case 57: + $$[$0 - 1].draw = "actor"; + $$[$0 - 1].type = "addParticipant"; + this.$ = $$[$0 - 1]; + break; + case 53: + $$[$0 - 1].type = "destroyParticipant"; + this.$ = $$[$0 - 1]; + break; + case 54: + $$[$0 - 3].draw = "participant"; + $$[$0 - 3].type = "addParticipant"; + $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]); + this.$ = $$[$0 - 3]; + break; + case 55: + $$[$0 - 1].draw = "participant"; + $$[$0 - 1].type = "addParticipant"; + this.$ = $$[$0 - 1]; + break; + case 56: + $$[$0 - 3].draw = "actor"; + $$[$0 - 3].type = "addParticipant"; + $$[$0 - 3].description = yy.parseMessage($$[$0 - 1]); + this.$ = $$[$0 - 3]; + break; + case 58: + this.$ = [$$[$0 - 1], { type: "addNote", placement: $$[$0 - 2], actor: $$[$0 - 1].actor, text: $$[$0] }]; + break; + case 59: + $$[$0 - 2] = [].concat($$[$0 - 1], $$[$0 - 1]).slice(0, 2); + $$[$0 - 2][0] = $$[$0 - 2][0].actor; + $$[$0 - 2][1] = $$[$0 - 2][1].actor; + this.$ = [$$[$0 - 1], { type: "addNote", placement: yy.PLACEMENT.OVER, actor: $$[$0 - 2].slice(0, 2), text: $$[$0] }]; + break; + case 60: + this.$ = [$$[$0 - 1], { type: "addLinks", actor: $$[$0 - 1].actor, text: $$[$0] }]; + break; + case 61: + this.$ = [$$[$0 - 1], { type: "addALink", actor: $$[$0 - 1].actor, text: $$[$0] }]; + break; + case 62: + this.$ = [$$[$0 - 1], { type: "addProperties", actor: $$[$0 - 1].actor, text: $$[$0] }]; + break; + case 63: + this.$ = [$$[$0 - 1], { type: "addDetails", actor: $$[$0 - 1].actor, text: $$[$0] }]; + break; + case 66: + this.$ = [$$[$0 - 2], $$[$0]]; + break; + case 67: + this.$ = $$[$0]; + break; + case 68: + this.$ = yy.PLACEMENT.LEFTOF; + break; + case 69: + this.$ = yy.PLACEMENT.RIGHTOF; + break; + case 70: + this.$ = [ + $$[$0 - 4], + $$[$0 - 1], + { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true }, + { type: "activeStart", signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0 - 1].actor } + ]; + break; + case 71: + this.$ = [ + $$[$0 - 4], + $$[$0 - 1], + { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0] }, + { type: "activeEnd", signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0 - 4].actor } + ]; + break; + case 72: + this.$ = [ + $$[$0 - 4], + $$[$0 - 1], + { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION }, + { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor } + ]; + break; + case 73: + this.$ = [ + $$[$0 - 4], + $$[$0 - 1], + { type: "addMessage", from: $$[$0 - 4].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0], activate: false, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE }, + { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 4].actor } + ]; + break; + case 74: + this.$ = [ + $$[$0 - 5], + $$[$0 - 1], + { type: "addMessage", from: $$[$0 - 5].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 3], msg: $$[$0], activate: true, centralConnection: yy.LINETYPE.CENTRAL_CONNECTION_DUAL }, + { type: "centralConnection", signalType: yy.LINETYPE.CENTRAL_CONNECTION, actor: $$[$0 - 1].actor }, + { type: "centralConnectionReverse", signalType: yy.LINETYPE.CENTRAL_CONNECTION_REVERSE, actor: $$[$0 - 5].actor } + ]; + break; + case 75: + this.$ = [$$[$0 - 3], $$[$0 - 1], { type: "addMessage", from: $$[$0 - 3].actor, to: $$[$0 - 1].actor, signalType: $$[$0 - 2], msg: $$[$0] }]; + break; + case 76: + this.$ = { + type: "addParticipant", + actor: $$[$0 - 1], + config: $$[$0] + }; + break; + case 77: + this.$ = $$[$0 - 1].trim(); + break; + case 78: + this.$ = { type: "addParticipant", actor: $$[$0] }; + break; + case 79: + this.$ = yy.LINETYPE.SOLID_OPEN; + break; + case 80: + this.$ = yy.LINETYPE.DOTTED_OPEN; + break; + case 81: + this.$ = yy.LINETYPE.SOLID; + break; + case 82: + this.$ = yy.LINETYPE.SOLID_TOP; + break; + case 83: + this.$ = yy.LINETYPE.SOLID_BOTTOM; + break; + case 84: + this.$ = yy.LINETYPE.STICK_TOP; + break; + case 85: + this.$ = yy.LINETYPE.STICK_BOTTOM; + break; + case 86: + this.$ = yy.LINETYPE.SOLID_TOP_DOTTED; + break; + case 87: + this.$ = yy.LINETYPE.SOLID_BOTTOM_DOTTED; + break; + case 88: + this.$ = yy.LINETYPE.STICK_TOP_DOTTED; + break; + case 89: + this.$ = yy.LINETYPE.STICK_BOTTOM_DOTTED; + break; + case 90: + this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE; + break; + case 91: + this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE; + break; + case 92: + this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE; + break; + case 93: + this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE; + break; + case 94: + this.$ = yy.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED; + break; + case 95: + this.$ = yy.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED; + break; + case 96: + this.$ = yy.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED; + break; + case 97: + this.$ = yy.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED; + break; + case 98: + this.$ = yy.LINETYPE.BIDIRECTIONAL_SOLID; + break; + case 99: + this.$ = yy.LINETYPE.DOTTED; + break; + case 100: + this.$ = yy.LINETYPE.BIDIRECTIONAL_DOTTED; + break; + case 101: + this.$ = yy.LINETYPE.SOLID_CROSS; + break; + case 102: + this.$ = yy.LINETYPE.DOTTED_CROSS; + break; + case 103: + this.$ = yy.LINETYPE.SOLID_POINT; + break; + case 104: + this.$ = yy.LINETYPE.DOTTED_POINT; + break; + case 105: + this.$ = yy.parseMessage($$[$0].trim().substring(1)); + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o2([1, 4, 5, 10, 14, 15, 19, 22, 24, 30, 31, 32, 34, 36, 37, 38, 39, 40, 42, 44, 45, 47, 51, 53, 54, 56, 61, 62, 63, 64, 73], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o2($Vy, [2, 5]), { 9: 48, 13: 13, 14: $V7, 15: $V8, 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, o2($Vy, [2, 7]), o2($Vy, [2, 8]), o2($Vy, [2, 9]), o2($Vy, [2, 15]), { 13: 49, 51: $Vp, 53: $Vq, 54: $Vr }, { 16: [1, 50] }, { 5: [1, 51] }, { 5: [1, 54], 20: [1, 52], 21: [1, 53] }, { 23: 55, 73: $Vx }, { 23: 56, 73: $Vx }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, { 5: [1, 61] }, o2($Vy, [2, 30]), o2($Vy, [2, 31]), { 33: [1, 62] }, { 35: [1, 63] }, o2($Vy, [2, 34]), { 16: [1, 64] }, { 16: [1, 65] }, { 16: [1, 66] }, { 16: [1, 67] }, { 16: [1, 68] }, { 16: [1, 69] }, { 16: [1, 70] }, { 16: [1, 71] }, { 23: 72, 55: 73, 73: $Vz }, { 23: 75, 55: 76, 73: $Vz }, { 23: 77, 73: $Vx }, { 69: 78, 72: [1, 79], 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, { 57: 106, 59: [1, 107], 67: [1, 108], 68: [1, 109] }, { 23: 110, 73: $Vx }, { 23: 111, 73: $Vx }, { 23: 112, 73: $Vx }, { 23: 113, 73: $Vx }, o2([5, 66, 72, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104], $V_), o2($Vy, [2, 6]), o2($Vy, [2, 16]), o2($V$, [2, 10], { 11: 114 }), o2($Vy, [2, 18]), { 5: [1, 116], 20: [1, 115] }, { 5: [1, 117] }, o2($Vy, [2, 22]), { 5: [1, 118] }, { 5: [1, 119] }, o2($Vy, [2, 25]), o2($Vy, [2, 26]), o2($Vy, [2, 27]), o2($Vy, [2, 28]), o2($Vy, [2, 29]), o2($Vy, [2, 32]), o2($Vy, [2, 33]), o2($V01, $V3, { 7: 120 }), o2($V01, $V3, { 7: 121 }), o2($V01, $V3, { 7: 122 }), o2($V11, $V3, { 41: 123, 7: 124 }), o2($V21, $V3, { 43: 125, 7: 126 }), o2($V21, $V3, { 7: 126, 43: 127 }), o2($V31, $V3, { 46: 128, 7: 129 }), o2($V01, $V3, { 7: 130 }), { 5: [1, 132], 52: [1, 131] }, { 5: [1, 134], 52: [1, 133] }, o2($V41, $V_, { 74: 135, 75: [1, 136] }), { 5: [1, 138], 52: [1, 137] }, { 5: [1, 140], 52: [1, 139] }, { 5: [1, 141] }, { 23: 145, 70: [1, 142], 71: [1, 143], 72: [1, 144], 73: $Vx }, { 69: 146, 78: $VA, 79: $VB, 80: $VC, 81: $VD, 82: $VE, 83: $VF, 84: $VG, 85: $VH, 86: $VI, 87: $VJ, 88: $VK, 89: $VL, 90: $VM, 91: $VN, 92: $VO, 93: $VP, 94: $VQ, 95: $VR, 96: $VS, 97: $VT, 98: $VU, 99: $VV, 100: $VW, 101: $VX, 102: $VY, 103: $VZ }, o2($V51, [2, 79]), o2($V51, [2, 80]), o2($V51, [2, 81]), o2($V51, [2, 82]), o2($V51, [2, 83]), o2($V51, [2, 84]), o2($V51, [2, 85]), o2($V51, [2, 86]), o2($V51, [2, 87]), o2($V51, [2, 88]), o2($V51, [2, 89]), o2($V51, [2, 90]), o2($V51, [2, 91]), o2($V51, [2, 92]), o2($V51, [2, 93]), o2($V51, [2, 94]), o2($V51, [2, 95]), o2($V51, [2, 96]), o2($V51, [2, 97]), o2($V51, [2, 98]), o2($V51, [2, 99]), o2($V51, [2, 100]), o2($V51, [2, 101]), o2($V51, [2, 102]), o2($V51, [2, 103]), o2($V51, [2, 104]), { 23: 147, 73: $Vx }, { 23: 149, 60: 148, 73: $Vx }, { 73: [2, 68] }, { 73: [2, 69] }, { 58: 150, 104: $V61 }, { 58: 152, 104: $V61 }, { 58: 153, 104: $V61 }, { 58: 154, 104: $V61 }, { 4: [1, 157], 5: [1, 159], 12: 156, 13: 158, 17: [1, 155], 51: $Vp, 53: $Vq, 54: $Vr }, { 5: [1, 160] }, o2($Vy, [2, 20]), o2($Vy, [2, 21]), o2($Vy, [2, 23]), o2($Vy, [2, 24]), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 161], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 162], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 163], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 164] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 47], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 50: [1, 165], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 166] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 45], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 49: [1, 167], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 17: [1, 168] }, { 17: [1, 169] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [2, 43], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 48: [1, 170], 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: $V6, 13: 13, 14: $V7, 15: $V8, 17: [1, 171], 18: 16, 19: $V9, 22: $Va, 23: 41, 24: $Vb, 25: 20, 26: 21, 27: 22, 28: 23, 29: 24, 30: $Vc, 31: $Vd, 32: $Ve, 34: $Vf, 36: $Vg, 37: $Vh, 38: $Vi, 39: $Vj, 40: $Vk, 42: $Vl, 44: $Vm, 45: $Vn, 47: $Vo, 51: $Vp, 53: $Vq, 54: $Vr, 56: $Vs, 61: $Vt, 62: $Vu, 63: $Vv, 64: $Vw, 73: $Vx }, { 16: [1, 172] }, o2($Vy, [2, 50]), { 16: [1, 173] }, o2($Vy, [2, 55]), o2($V41, [2, 76]), { 76: [1, 174] }, { 16: [1, 175] }, o2($Vy, [2, 52]), { 16: [1, 176] }, o2($Vy, [2, 57]), o2($Vy, [2, 53]), { 23: 177, 73: $Vx }, { 23: 178, 73: $Vx }, { 23: 179, 73: $Vx }, { 58: 180, 104: $V61 }, { 23: 181, 72: [1, 182], 73: $Vx }, { 58: 183, 104: $V61 }, { 58: 184, 104: $V61 }, { 66: [1, 185], 104: [2, 67] }, { 5: [2, 60] }, { 5: [2, 105] }, { 5: [2, 61] }, { 5: [2, 62] }, { 5: [2, 63] }, o2($Vy, [2, 17]), o2($V$, [2, 11]), { 13: 186, 51: $Vp, 53: $Vq, 54: $Vr }, o2($V$, [2, 13]), o2($V$, [2, 14]), o2($Vy, [2, 19]), o2($Vy, [2, 35]), o2($Vy, [2, 36]), o2($Vy, [2, 37]), o2($Vy, [2, 38]), { 16: [1, 187] }, o2($Vy, [2, 39]), { 16: [1, 188] }, o2($Vy, [2, 40]), o2($Vy, [2, 41]), { 16: [1, 189] }, o2($Vy, [2, 42]), { 5: [1, 190] }, { 5: [1, 191] }, { 77: [1, 192] }, { 5: [1, 193] }, { 5: [1, 194] }, { 58: 195, 104: $V61 }, { 58: 196, 104: $V61 }, { 58: 197, 104: $V61 }, { 5: [2, 75] }, { 58: 198, 104: $V61 }, { 23: 199, 73: $Vx }, { 5: [2, 58] }, { 5: [2, 59] }, { 23: 200, 73: $Vx }, o2($V$, [2, 12]), o2($V11, $V3, { 7: 124, 41: 201 }), o2($V21, $V3, { 7: 126, 43: 202 }), o2($V31, $V3, { 7: 129, 46: 203 }), o2($Vy, [2, 49]), o2($Vy, [2, 54]), o2($V41, [2, 77]), o2($Vy, [2, 51]), o2($Vy, [2, 56]), { 5: [2, 70] }, { 5: [2, 71] }, { 5: [2, 72] }, { 5: [2, 73] }, { 58: 204, 104: $V61 }, { 104: [2, 66] }, { 17: [2, 48] }, { 17: [2, 46] }, { 17: [2, 44] }, { 5: [2, 74] }], + defaultActions: { 5: [2, 1], 6: [2, 2], 108: [2, 68], 109: [2, 69], 150: [2, 60], 151: [2, 105], 152: [2, 61], 153: [2, 62], 154: [2, 63], 180: [2, 75], 183: [2, 58], 184: [2, 59], 195: [2, 70], 196: [2, 71], 197: [2, 72], 198: [2, 73], 200: [2, 66], 201: [2, 48], 202: [2, 46], 203: [2, 44], 204: [2, 74] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + return 5; + break; + case 1: + break; + case 2: + break; + case 3: + break; + case 4: + break; + case 5: + break; + case 6: + return 20; + break; + case 7: + this.begin("CONFIG"); + return 75; + break; + case 8: + return 76; + break; + case 9: + this.popState(); + this.begin("ALIAS"); + return 77; + break; + case 10: + this.popState(); + this.popState(); + return 77; + break; + case 11: + yy_.yytext = yy_.yytext.trim(); + return 73; + break; + case 12: + yy_.yytext = yy_.yytext.trim(); + this.begin("ALIAS"); + return 73; + break; + case 13: + yy_.yytext = yy_.yytext.trim(); + this.popState(); + return 73; + break; + case 14: + this.popState(); + return 10; + break; + case 15: + yy_.yytext = yy_.yytext.trim(); + this.popState(); + return 10; + break; + case 16: + this.begin("LINE"); + return 15; + break; + case 17: + this.begin("ID"); + return 51; + break; + case 18: + this.begin("ID"); + return 53; + break; + case 19: + return 14; + break; + case 20: + this.begin("ID"); + return 54; + break; + case 21: + this.popState(); + this.popState(); + this.begin("LINE"); + return 52; + break; + case 22: + this.popState(); + this.popState(); + return 5; + break; + case 23: + this.begin("LINE"); + return 37; + break; + case 24: + this.begin("LINE"); + return 38; + break; + case 25: + this.begin("LINE"); + return 39; + break; + case 26: + this.begin("LINE"); + return 40; + break; + case 27: + this.begin("LINE"); + return 50; + break; + case 28: + this.begin("LINE"); + return 42; + break; + case 29: + this.begin("LINE"); + return 44; + break; + case 30: + this.begin("LINE"); + return 49; + break; + case 31: + this.begin("LINE"); + return 45; + break; + case 32: + this.begin("LINE"); + return 48; + break; + case 33: + this.begin("LINE"); + return 47; + break; + case 34: + this.popState(); + return 16; + break; + case 35: + return 17; + break; + case 36: + return 67; + break; + case 37: + return 68; + break; + case 38: + return 61; + break; + case 39: + return 62; + break; + case 40: + return 63; + break; + case 41: + return 64; + break; + case 42: + return 59; + break; + case 43: + return 56; + break; + case 44: + this.begin("ID"); + return 22; + break; + case 45: + this.begin("ID"); + return 24; + break; + case 46: + return 30; + break; + case 47: + return 31; + break; + case 48: + this.begin("acc_title"); + return 32; + break; + case 49: + this.popState(); + return "acc_title_value"; + break; + case 50: + this.begin("acc_descr"); + return 34; + break; + case 51: + this.popState(); + return "acc_descr_value"; + break; + case 52: + this.begin("acc_descr_multiline"); + break; + case 53: + this.popState(); + break; + case 54: + return "acc_descr_multiline_value"; + break; + case 55: + return 6; + break; + case 56: + return 19; + break; + case 57: + return 21; + break; + case 58: + return 66; + break; + case 59: + return 5; + break; + case 60: + yy_.yytext = yy_.yytext.trim(); + return 73; + break; + case 61: + return 80; + break; + case 62: + return 97; + break; + case 63: + return 98; + break; + case 64: + return 99; + break; + case 65: + return 78; + break; + case 66: + return 79; + break; + case 67: + return 100; + break; + case 68: + return 101; + break; + case 69: + return 102; + break; + case 70: + return 103; + break; + case 71: + return 85; + break; + case 72: + return 86; + break; + case 73: + return 87; + break; + case 74: + return 88; + break; + case 75: + return 93; + break; + case 76: + return 94; + break; + case 77: + return 95; + break; + case 78: + return 96; + break; + case 79: + return 81; + break; + case 80: + return 82; + break; + case 81: + return 83; + break; + case 82: + return 84; + break; + case 83: + return 89; + break; + case 84: + return 90; + break; + case 85: + return 91; + break; + case 86: + return 92; + break; + case 87: + return 104; + break; + case 88: + return 104; + break; + case 89: + return 70; + break; + case 90: + return 71; + break; + case 91: + return 72; + break; + case 92: + return 5; + break; + case 93: + return 10; + break; + } + }, "anonymous"), + rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:([0-9]+(\.[0-9]{1,2})?|\.[0-9]{1,2})(?=[ \n]+))/i, /^(?:@\{)/i, /^(?:[^\}]+)/i, /^(?:\}(?=\s+as\s))/i, /^(?:\})/i, /^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i, /^(?:[^<>:\n,;@\s]+(?=\s+as\s))/i, /^(?:[^<>:\n,;@]+(?=\s*[\n;#]|$))/i, /^(?:[^<>:\n,;@]*<[^\n]*)/i, /^(?:[^\n]+)/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/i, /^(?:as\b)/i, /^(?:(?:))/i, /^(?:loop\b)/i, /^(?:rect\b)/i, /^(?:opt\b)/i, /^(?:alt\b)/i, /^(?:else\b)/i, /^(?:par\b)/i, /^(?:par_over\b)/i, /^(?:and\b)/i, /^(?:critical\b)/i, /^(?:option\b)/i, /^(?:break\b)/i, /^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i, /^(?:end\b)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:links\b)/i, /^(?:link\b)/i, /^(?:properties\b)/i, /^(?:details\b)/i, /^(?:over\b)/i, /^(?:note\b)/i, /^(?:activate\b)/i, /^(?:deactivate\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:title:\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:sequenceDiagram\b)/i, /^(?:autonumber\b)/i, /^(?:off\b)/i, /^(?:,)/i, /^(?:;)/i, /^(?:[^\/\\\+\()\+<\->\->:\n,;]+((?!(-x|--x|-\)|--\)|-\|\\|-\\|-\/|-\/\/|-\|\/|\/\|-|\\\|-|\/\/-|\\\\-|\/\|-|--\|\\|--|\(\)))[\-]*[^\+<\->\->:\n,;]+)*)/i, /^(?:->>)/i, /^(?:<<->>)/i, /^(?:-->>)/i, /^(?:<<-->>)/i, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?:--\|\\)/i, /^(?:--\|\/)/i, /^(?:--\\\\)/i, /^(?:--\/\/)/i, /^(?:\/\|--)/i, /^(?:\\\|--)/i, /^(?:\/\/--)/i, /^(?:\\\\--)/i, /^(?:-\|\\)/i, /^(?:-\|\/)/i, /^(?:-\\\\)/i, /^(?:-\/\/)/i, /^(?:\/\|-)/i, /^(?:\\\|-)/i, /^(?:\/\/-)/i, /^(?:\\\\-)/i, /^(?::(?:(?:no)?wrap)?[^#\n;]*)/i, /^(?::)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:\(\))/i, /^(?:$)/i, /^(?:.)/i], + conditions: { "acc_descr_multiline": { "rules": [53, 54], "inclusive": false }, "acc_descr": { "rules": [51], "inclusive": false }, "acc_title": { "rules": [49], "inclusive": false }, "ID": { "rules": [2, 3, 7, 11, 12, 13, 14, 15], "inclusive": false }, "ALIAS": { "rules": [2, 3, 21, 22], "inclusive": false }, "LINE": { "rules": [2, 3, 34], "inclusive": false }, "CONFIG": { "rules": [8, 9, 10], "inclusive": false }, "CONFIG_DATA": { "rules": [], "inclusive": false }, "INITIAL": { "rules": [0, 1, 3, 4, 5, 6, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser11.parser = parser11; + sequenceDiagram_default = parser11; + } + }); + + // src/diagrams/sequence/sequenceDb.ts + var LINETYPE2, ARROWTYPE2, PLACEMENT2, PARTICIPANT_TYPE, SequenceDB; + var init_sequenceDb = __esm({ + "src/diagrams/sequence/sequenceDb.ts"() { + "use strict"; + init_diagramAPI(); + init_js_yaml(); + init_logger(); + init_imperativeState(); + init_common(); + init_commonDb(); + LINETYPE2 = { + SOLID: 0, + DOTTED: 1, + NOTE: 2, + SOLID_CROSS: 3, + DOTTED_CROSS: 4, + SOLID_OPEN: 5, + DOTTED_OPEN: 6, + LOOP_START: 10, + LOOP_END: 11, + ALT_START: 12, + ALT_ELSE: 13, + ALT_END: 14, + OPT_START: 15, + OPT_END: 16, + ACTIVE_START: 17, + ACTIVE_END: 18, + PAR_START: 19, + PAR_AND: 20, + PAR_END: 21, + RECT_START: 22, + RECT_END: 23, + SOLID_POINT: 24, + DOTTED_POINT: 25, + AUTONUMBER: 26, + CRITICAL_START: 27, + CRITICAL_OPTION: 28, + CRITICAL_END: 29, + BREAK_START: 30, + BREAK_END: 31, + PAR_OVER_START: 32, + BIDIRECTIONAL_SOLID: 33, + BIDIRECTIONAL_DOTTED: 34, + SOLID_TOP: 41, + SOLID_BOTTOM: 42, + STICK_TOP: 43, + STICK_BOTTOM: 44, + SOLID_ARROW_TOP_REVERSE: 45, + SOLID_ARROW_BOTTOM_REVERSE: 46, + STICK_ARROW_TOP_REVERSE: 47, + STICK_ARROW_BOTTOM_REVERSE: 48, + SOLID_TOP_DOTTED: 51, + SOLID_BOTTOM_DOTTED: 52, + STICK_TOP_DOTTED: 53, + STICK_BOTTOM_DOTTED: 54, + SOLID_ARROW_TOP_REVERSE_DOTTED: 55, + SOLID_ARROW_BOTTOM_REVERSE_DOTTED: 56, + STICK_ARROW_TOP_REVERSE_DOTTED: 57, + STICK_ARROW_BOTTOM_REVERSE_DOTTED: 58, + CENTRAL_CONNECTION: 59, + CENTRAL_CONNECTION_REVERSE: 60, + CENTRAL_CONNECTION_DUAL: 61 + }; + ARROWTYPE2 = { + FILLED: 0, + OPEN: 1 + }; + PLACEMENT2 = { + LEFTOF: 0, + RIGHTOF: 1, + OVER: 2 + }; + PARTICIPANT_TYPE = { + ACTOR: "actor", + BOUNDARY: "boundary", + COLLECTIONS: "collections", + CONTROL: "control", + DATABASE: "database", + ENTITY: "entity", + PARTICIPANT: "participant", + QUEUE: "queue" + }; + SequenceDB = class { + constructor() { + this.state = new ImperativeState(() => ({ + prevActor: void 0, + actors: /* @__PURE__ */ new Map(), + createdActors: /* @__PURE__ */ new Map(), + destroyedActors: /* @__PURE__ */ new Map(), + boxes: [], + messages: [], + notes: [], + sequenceNumbersEnabled: false, + wrapEnabled: void 0, + currentBox: void 0, + lastCreated: void 0, + lastDestroyed: void 0 + })); + this.setAccTitle = setAccTitle; + this.setAccDescription = setAccDescription; + this.setDiagramTitle = setDiagramTitle; + this.getAccTitle = getAccTitle; + this.getAccDescription = getAccDescription; + this.getDiagramTitle = getDiagramTitle; + this.apply = this.apply.bind(this); + this.parseBoxData = this.parseBoxData.bind(this); + this.parseMessage = this.parseMessage.bind(this); + this.clear(); + this.setWrap(getConfig2().wrap); + this.LINETYPE = LINETYPE2; + this.ARROWTYPE = ARROWTYPE2; + this.PLACEMENT = PLACEMENT2; + } + static { + __name(this, "SequenceDB"); + } + addBox(data5) { + this.state.records.boxes.push({ + name: data5.text, + wrap: data5.wrap ?? this.autoWrap(), + fill: data5.color, + actorKeys: [] + }); + this.state.records.currentBox = this.state.records.boxes.slice(-1)[0]; + } + addActor(id35, name, description, type3, metadata) { + let assignedBox = this.state.records.currentBox; + let doc; + if (metadata !== void 0) { + let yamlData; + if (!metadata.includes("\n")) { + yamlData = "{\n" + metadata + "\n}"; + } else { + yamlData = metadata + "\n"; + } + doc = load(yamlData, { schema: JSON_SCHEMA }); + } + type3 = doc?.type ?? type3; + if (doc?.alias && (!description || description.text === name)) { + description = { text: doc.alias, wrap: description?.wrap, type: type3 }; + } + const old = this.state.records.actors.get(id35); + if (old) { + if (this.state.records.currentBox && old.box && this.state.records.currentBox !== old.box) { + throw new Error( + `A same participant should only be defined in one Box: ${old.name} can't be in '${old.box.name}' and in '${this.state.records.currentBox.name}' at the same time.` + ); + } + assignedBox = old.box ? old.box : this.state.records.currentBox; + old.box = assignedBox; + if (old && name === old.name && description == null) { + return; + } + } + if (description?.text == null) { + description = { text: name, type: type3 }; + } + if (type3 == null || description.text == null) { + description = { text: name, type: type3 }; + } + this.state.records.actors.set(id35, { + box: assignedBox, + name, + description: description.text, + wrap: description.wrap ?? this.autoWrap(), + prevActor: this.state.records.prevActor, + links: {}, + properties: {}, + actorCnt: null, + rectData: null, + type: type3 ?? "participant" + }); + if (this.state.records.prevActor) { + const prevActorInRecords = this.state.records.actors.get(this.state.records.prevActor); + if (prevActorInRecords) { + prevActorInRecords.nextActor = id35; + } + } + if (this.state.records.currentBox) { + this.state.records.currentBox.actorKeys.push(id35); + } + this.state.records.prevActor = id35; + } + activationCount(part) { + let i2; + let count2 = 0; + if (!part) { + return 0; + } + for (i2 = 0; i2 < this.state.records.messages.length; i2++) { + if (this.state.records.messages[i2].type === this.LINETYPE.ACTIVE_START && this.state.records.messages[i2].from === part) { + count2++; + } + if (this.state.records.messages[i2].type === this.LINETYPE.ACTIVE_END && this.state.records.messages[i2].from === part) { + count2--; + } + } + return count2; + } + addMessage(idFrom, idTo, message, answer) { + this.state.records.messages.push({ + id: this.state.records.messages.length.toString(), + from: idFrom, + to: idTo, + message: message.text, + wrap: message.wrap ?? this.autoWrap(), + answer + }); + } + addSignal(idFrom, idTo, message, messageType, activate = false, centralConnection) { + if (messageType === this.LINETYPE.ACTIVE_END) { + const cnt4 = this.activationCount(idFrom ?? ""); + if (cnt4 < 1) { + const error3 = new Error("Trying to inactivate an inactive participant (" + idFrom + ")"); + error3.hash = { + text: "->>-", + token: "->>-", + line: "1", + loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 }, + expected: ["'ACTIVE_PARTICIPANT'"] + }; + throw error3; + } + } + this.state.records.messages.push({ + id: this.state.records.messages.length.toString(), + from: idFrom, + to: idTo, + message: message?.text ?? "", + wrap: message?.wrap ?? this.autoWrap(), + type: messageType, + activate, + centralConnection: centralConnection ?? 0 + }); + return true; + } + hasAtLeastOneBox() { + return this.state.records.boxes.length > 0; + } + hasAtLeastOneBoxWithTitle() { + return this.state.records.boxes.some((b3) => b3.name); + } + getMessages() { + return this.state.records.messages; + } + getBoxes() { + return this.state.records.boxes; + } + getActors() { + return this.state.records.actors; + } + getCreatedActors() { + return this.state.records.createdActors; + } + getDestroyedActors() { + return this.state.records.destroyedActors; + } + getActor(id35) { + return this.state.records.actors.get(id35); + } + getActorKeys() { + return [...this.state.records.actors.keys()]; + } + enableSequenceNumbers() { + this.state.records.sequenceNumbersEnabled = true; + } + disableSequenceNumbers() { + this.state.records.sequenceNumbersEnabled = false; + } + showSequenceNumbers() { + return this.state.records.sequenceNumbersEnabled; + } + setWrap(wrapSetting) { + this.state.records.wrapEnabled = wrapSetting; + } + extractWrap(text4) { + if (text4 === void 0) { + return {}; + } + text4 = text4.trim(); + const wrap3 = /^:?wrap:/.exec(text4) !== null ? true : /^:?nowrap:/.exec(text4) !== null ? false : void 0; + const cleanedText = (wrap3 === void 0 ? text4 : text4.replace(/^:?(?:no)?wrap:/, "")).trim(); + return { cleanedText, wrap: wrap3 }; + } + autoWrap() { + if (this.state.records.wrapEnabled !== void 0) { + return this.state.records.wrapEnabled; + } + return getConfig2().sequence?.wrap ?? false; + } + clear() { + this.state.reset(); + clear(); + } + parseMessage(str2) { + const trimmedStr = str2.trim(); + const { wrap: wrap3, cleanedText } = this.extractWrap(trimmedStr); + const message = { + text: cleanedText, + wrap: wrap3 + }; + log.debug(`parseMessage: ${JSON.stringify(message)}`); + return message; + } + // We expect the box statement to be color first then description + // The color can be rgb,rgba,hsl,hsla, or css code names #hex codes are not supported for now because of the way the char # is handled + // We extract first segment as color, the rest of the line is considered as text + parseBoxData(str2) { + const match3 = /^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(str2); + let color2 = match3?.[1] ? match3[1].trim() : "transparent"; + let title2 = match3?.[2] ? match3[2].trim() : void 0; + if (window?.CSS) { + if (!window.CSS.supports("color", color2)) { + color2 = "transparent"; + title2 = str2.trim(); + } + } else { + const style3 = new Option().style; + style3.color = color2; + if (style3.color !== color2) { + color2 = "transparent"; + title2 = str2.trim(); + } + } + const { wrap: wrap3, cleanedText } = this.extractWrap(title2); + return { + text: cleanedText ? sanitizeText(cleanedText, getConfig2()) : void 0, + color: color2, + wrap: wrap3 + }; + } + addNote(actor, placement, message) { + const note3 = { + actor, + placement, + message: message.text, + wrap: message.wrap ?? this.autoWrap() + }; + const actors2 = [].concat(actor, actor); + this.state.records.notes.push(note3); + this.state.records.messages.push({ + id: this.state.records.messages.length.toString(), + from: actors2[0], + to: actors2[1], + message: message.text, + wrap: message.wrap ?? this.autoWrap(), + type: this.LINETYPE.NOTE, + placement + }); + } + addLinks(actorId, text4) { + const actor = this.getActor(actorId); + try { + let sanitizedText = sanitizeText(text4.text, getConfig2()); + sanitizedText = sanitizedText.replace(/=/g, "="); + sanitizedText = sanitizedText.replace(/&/g, "&"); + const links3 = JSON.parse(sanitizedText); + this.insertLinks(actor, links3); + } catch (e3) { + log.error("error while parsing actor link text", e3); + } + } + addALink(actorId, text4) { + const actor = this.getActor(actorId); + try { + const links3 = {}; + let sanitizedText = sanitizeText(text4.text, getConfig2()); + const sep2 = sanitizedText.indexOf("@"); + sanitizedText = sanitizedText.replace(/=/g, "="); + sanitizedText = sanitizedText.replace(/&/g, "&"); + const label = sanitizedText.slice(0, sep2 - 1).trim(); + const link2 = sanitizedText.slice(sep2 + 1).trim(); + links3[label] = link2; + this.insertLinks(actor, links3); + } catch (e3) { + log.error("error while parsing actor link text", e3); + } + } + insertLinks(actor, links3) { + if (actor.links == null) { + actor.links = links3; + } else { + for (const key in links3) { + actor.links[key] = links3[key]; + } + } + } + addProperties(actorId, text4) { + const actor = this.getActor(actorId); + try { + const sanitizedText = sanitizeText(text4.text, getConfig2()); + const properties = JSON.parse(sanitizedText); + this.insertProperties(actor, properties); + } catch (e3) { + log.error("error while parsing actor properties text", e3); + } + } + insertProperties(actor, properties) { + if (actor.properties == null) { + actor.properties = properties; + } else { + for (const key in properties) { + actor.properties[key] = properties[key]; + } + } + } + boxEnd() { + this.state.records.currentBox = void 0; + } + addDetails(actorId, text4) { + const actor = this.getActor(actorId); + const elem = document.getElementById(text4.text); + try { + const text5 = elem.innerHTML; + const details = JSON.parse(text5); + if (details.properties) { + this.insertProperties(actor, details.properties); + } + if (details.links) { + this.insertLinks(actor, details.links); + } + } catch (e3) { + log.error("error while parsing actor details text", e3); + } + } + getActorProperty(actor, key) { + if (actor?.properties !== void 0) { + return actor.properties[key]; + } + return void 0; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-redundant-type-constituents + apply(param) { + if (Array.isArray(param)) { + param.forEach((item) => { + this.apply(item); + }); + } else { + switch (param.type) { + case "sequenceIndex": + this.state.records.messages.push({ + id: this.state.records.messages.length.toString(), + from: void 0, + to: void 0, + message: { + start: param.sequenceIndex, + step: param.sequenceIndexStep, + visible: param.sequenceVisible + }, + wrap: false, + type: param.signalType + }); + break; + case "addParticipant": + this.addActor(param.actor, param.actor, param.description, param.draw, param.config); + break; + case "createParticipant": + if (this.state.records.actors.has(param.actor)) { + throw new Error( + "It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior" + ); + } + this.state.records.lastCreated = param.actor; + this.addActor(param.actor, param.actor, param.description, param.draw, param.config); + this.state.records.createdActors.set(param.actor, this.state.records.messages.length); + break; + case "destroyParticipant": + this.state.records.lastDestroyed = param.actor; + this.state.records.destroyedActors.set(param.actor, this.state.records.messages.length); + break; + case "activeStart": + this.addSignal(param.actor, void 0, void 0, param.signalType); + break; + case "centralConnection": + this.addSignal(param.actor, void 0, void 0, param.signalType); + break; + case "centralConnectionReverse": + this.addSignal(param.actor, void 0, void 0, param.signalType); + break; + case "activeEnd": + this.addSignal(param.actor, void 0, void 0, param.signalType); + break; + case "addNote": + this.addNote(param.actor, param.placement, param.text); + break; + case "addLinks": + this.addLinks(param.actor, param.text); + break; + case "addALink": + this.addALink(param.actor, param.text); + break; + case "addProperties": + this.addProperties(param.actor, param.text); + break; + case "addDetails": + this.addDetails(param.actor, param.text); + break; + case "addMessage": + if (this.state.records.lastCreated) { + if (param.to !== this.state.records.lastCreated) { + throw new Error( + "The created participant " + this.state.records.lastCreated.name + " does not have an associated creating message after its declaration. Please check the sequence diagram." + ); + } else { + this.state.records.lastCreated = void 0; + } + } else if (this.state.records.lastDestroyed) { + if (param.to !== this.state.records.lastDestroyed && param.from !== this.state.records.lastDestroyed) { + throw new Error( + "The destroyed participant " + this.state.records.lastDestroyed.name + " does not have an associated destroying message after its declaration. Please check the sequence diagram." + ); + } else { + this.state.records.lastDestroyed = void 0; + } + } + this.addSignal( + param.from, + param.to, + param.msg, + param.signalType, + param.activate, + param.centralConnection + ); + break; + case "boxStart": + this.addBox(param.boxData); + break; + case "boxEnd": + this.boxEnd(); + break; + case "loopStart": + this.addSignal(void 0, void 0, param.loopText, param.signalType); + break; + case "loopEnd": + this.addSignal(void 0, void 0, void 0, param.signalType); + break; + case "rectStart": + this.addSignal(void 0, void 0, param.color, param.signalType); + break; + case "rectEnd": + this.addSignal(void 0, void 0, void 0, param.signalType); + break; + case "optStart": + this.addSignal(void 0, void 0, param.optText, param.signalType); + break; + case "optEnd": + this.addSignal(void 0, void 0, void 0, param.signalType); + break; + case "altStart": + this.addSignal(void 0, void 0, param.altText, param.signalType); + break; + case "else": + this.addSignal(void 0, void 0, param.altText, param.signalType); + break; + case "altEnd": + this.addSignal(void 0, void 0, void 0, param.signalType); + break; + case "setAccTitle": + setAccTitle(param.text); + break; + case "parStart": + this.addSignal(void 0, void 0, param.parText, param.signalType); + break; + case "and": + this.addSignal(void 0, void 0, param.parText, param.signalType); + break; + case "parEnd": + this.addSignal(void 0, void 0, void 0, param.signalType); + break; + case "criticalStart": + this.addSignal(void 0, void 0, param.criticalText, param.signalType); + break; + case "option": + this.addSignal(void 0, void 0, param.optionText, param.signalType); + break; + case "criticalEnd": + this.addSignal(void 0, void 0, void 0, param.signalType); + break; + case "breakStart": + this.addSignal(void 0, void 0, param.breakText, param.signalType); + break; + case "breakEnd": + this.addSignal(void 0, void 0, void 0, param.signalType); + break; + } + } + } + getConfig() { + return getConfig2().sequence; + } + }; + } + }); + + // src/diagrams/sequence/styles.js + var getStyles9, styles_default8; + var init_styles8 = __esm({ + "src/diagrams/sequence/styles.js"() { + "use strict"; + init_diagramAPI(); + getStyles9 = /* @__PURE__ */ __name((options2) => { + const dropShadow = options2.dropShadow ?? "none"; + const { look } = getConfig2(); + return `.actor { + stroke: ${options2.actorBorder}; + fill: ${options2.actorBkg}; + stroke-width: ${options2.strokeWidth ?? 1}; + } + + rect.actor.outer-path[data-look="neo"] { + filter: ${dropShadow}; + } + + rect.note[data-look="neo"] { + stroke:${options2.noteBorderColor}; + fill:${options2.noteBkgColor}; + filter: ${dropShadow}; + } + + text.actor > tspan { + fill: ${options2.actorTextColor}; + stroke: none; + } + + .actor-line { + stroke: ${options2.actorLineColor}; + } + + .innerArc { + stroke-width: 1.5; + stroke-dasharray: none; + } + + .messageLine0 { + stroke-width: 1.5; + stroke-dasharray: none; + stroke: ${options2.signalColor}; + } + + .messageLine1 { + stroke-width: 1.5; + stroke-dasharray: 2, 2; + stroke: ${options2.signalColor}; + } + + [id$="-arrowhead"] path { + fill: ${options2.signalColor}; + stroke: ${options2.signalColor}; + } + + .sequenceNumber { + fill: ${options2.sequenceNumberColor}; + } + + [id$="-sequencenumber"] { + fill: ${options2.signalColor}; + } + + [id$="-crosshead"] path { + fill: ${options2.signalColor}; + stroke: ${options2.signalColor}; + } + + .messageText { + fill: ${options2.signalTextColor}; + stroke: none; + } + + .labelBox { + stroke: ${options2.labelBoxBorderColor}; + fill: ${options2.labelBoxBkgColor}; + filter: ${look === "neo" ? dropShadow : "none"}; + } + + .labelText, .labelText > tspan { + fill: ${options2.labelTextColor}; + stroke: none; + } + + .loopText, .loopText > tspan { + fill: ${options2.loopTextColor}; + stroke: none; + } + + .sectionTitle, .sectionTitle > tspan { + fill: ${options2.loopTextColor}; + stroke: none; + } + + .loopLine { + stroke-width: 2px; + stroke-dasharray: 2, 2; + stroke: ${options2.labelBoxBorderColor}; + fill: ${options2.labelBoxBorderColor}; + } + + .note { + //stroke: #decc93; + stroke: ${options2.noteBorderColor}; + fill: ${options2.noteBkgColor}; + } + + .noteText, .noteText > tspan { + fill: ${options2.noteTextColor}; + stroke: none; + ${options2.noteFontWeight ? `font-weight: ${options2.noteFontWeight};` : ""} + } + + .activation0 { + fill: ${options2.activationBkgColor}; + stroke: ${options2.activationBorderColor}; + } + + .activation1 { + fill: ${options2.activationBkgColor}; + stroke: ${options2.activationBorderColor}; + } + + .activation2 { + fill: ${options2.activationBkgColor}; + stroke: ${options2.activationBorderColor}; + } + + .actorPopupMenu { + position: absolute; + } + + .actorPopupMenuPanel { + position: absolute; + fill: ${options2.actorBkg}; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4)); +} + .actor-man circle, line { + fill: ${options2.actorBkg}; + stroke-width: 2px; + } + + g rect.rect { + filter: ${dropShadow}; + stroke: ${options2.nodeBorder}; + } +`; + }, "getStyles"); + styles_default8 = getStyles9; + } + }); + + // src/diagrams/sequence/svgDraw.js + var import_sanitize_url5, ACTOR_TYPE_WIDTH, TOP_ACTOR_CLASS, BOTTOM_ACTOR_CLASS, ACTOR_BOX_CLASS, ACTOR_MAN_FIGURE_CLASS, COLOR_THEMES5, drawRect4, drawPopup, popupMenuToggle, drawKatex, drawText3, drawLabel, actorCnt, fixLifeLineHeights, drawActorTypeParticipant, drawActorTypeCollections, drawActorTypeQueue, drawActorTypeControl, drawActorTypeEntity, drawActorTypeDatabase, drawActorTypeBoundary, drawActorTypeActor, drawActor, drawBox, anchorElement, drawActivation, drawLoop, drawBackgroundRect2, insertDatabaseIcon2, insertComputerIcon2, insertClockIcon2, insertArrowHead2, insertArrowFilledHead2, insertSequenceNumber, insertArrowCrossHead2, insertDropShadow, getTextObj3, getNoteRect2, _drawTextCandidateFunc2, _drawMenuItemTextCandidateFunc, insertSolidTopArrowHead, insertSolidBottomArrowHead, insertStickTopArrowHead, insertStickBottomArrowHead, svgDraw_default2; + var init_svgDraw2 = __esm({ + "src/diagrams/sequence/svgDraw.js"() { + "use strict"; + import_sanitize_url5 = __toESM(require_dist(), 1); + init_config(); + init_utils2(); + init_common(); + init_svgDrawCommon(); + ACTOR_TYPE_WIDTH = 18 * 2; + TOP_ACTOR_CLASS = "actor-top"; + BOTTOM_ACTOR_CLASS = "actor-bottom"; + ACTOR_BOX_CLASS = "actor-box"; + ACTOR_MAN_FIGURE_CLASS = "actor-man"; + COLOR_THEMES5 = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]); + drawRect4 = /* @__PURE__ */ __name(function(elem, rectData) { + const rectElement = drawRect(elem, rectData); + if (getConfig().look === "neo") { + rectElement.attr("data-look", "neo"); + } + return rectElement; + }, "drawRect"); + drawPopup = /* @__PURE__ */ __name(function(elem, actor, minMenuWidth, textAttrs, forceMenus) { + if (actor.links === void 0 || actor.links === null || Object.keys(actor.links).length === 0) { + return { height: 0, width: 0 }; + } + const links3 = actor.links; + const actorCnt2 = actor.actorCnt; + const rectData = actor.rectData; + var displayValue = "none"; + if (forceMenus) { + displayValue = "block !important"; + } + const g2 = elem.append("g"); + g2.attr("id", "actor" + actorCnt2 + "_popup"); + g2.attr("class", "actorPopupMenu"); + g2.attr("display", displayValue); + var actorClass = ""; + if (rectData.class !== void 0) { + actorClass = " " + rectData.class; + } + let menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth; + const rectElem = g2.append("rect"); + rectElem.attr("class", "actorPopupMenuPanel" + actorClass); + rectElem.attr("x", rectData.x); + rectElem.attr("y", rectData.height); + rectElem.attr("fill", rectData.fill); + rectElem.attr("stroke", rectData.stroke); + rectElem.attr("width", menuWidth); + rectElem.attr("height", rectData.height); + rectElem.attr("rx", rectData.rx); + rectElem.attr("ry", rectData.ry); + if (links3 != null) { + var linkY = 20; + for (let key in links3) { + var linkElem = g2.append("a"); + var sanitizedLink = (0, import_sanitize_url5.sanitizeUrl)(links3[key]); + linkElem.attr("xlink:href", sanitizedLink); + linkElem.attr("target", "_blank"); + _drawMenuItemTextCandidateFunc(textAttrs)( + key, + linkElem, + rectData.x + 10, + rectData.height + linkY, + menuWidth, + 20, + { class: "actor" }, + textAttrs + ); + linkY += 30; + } + } + rectElem.attr("height", linkY); + return { height: rectData.height + linkY, width: menuWidth }; + }, "drawPopup"); + popupMenuToggle = /* @__PURE__ */ __name(function(popId) { + return "var pu = document.getElementById('" + popId + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }"; + }, "popupMenuToggle"); + drawKatex = /* @__PURE__ */ __name(async function(elem, textData, msgModel = null) { + let textElem = elem.append("foreignObject"); + const linesSanitized = await renderKatexSanitized(textData.text, getConfig()); + const divElem = textElem.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(linesSanitized); + const dim = divElem.node().getBoundingClientRect(); + textElem.attr("height", Math.round(dim.height)).attr("width", Math.round(dim.width)); + if (textData.class === "noteText") { + const rectElem = elem.node().firstChild; + rectElem.setAttribute("height", dim.height + 2 * textData.textMargin); + const rectDim = rectElem.getBBox(); + textElem.attr("x", Math.round(rectDim.x + rectDim.width / 2 - dim.width / 2)).attr("y", Math.round(rectDim.y + rectDim.height / 2 - dim.height / 2)); + } else if (msgModel) { + let { startx, stopx, starty } = msgModel; + if (startx > stopx) { + const temp = startx; + startx = stopx; + stopx = temp; + } + textElem.attr("x", Math.round(startx + Math.abs(startx - stopx) / 2 - dim.width / 2)); + if (textData.class === "loopText") { + textElem.attr("y", Math.round(starty)); + } else { + textElem.attr("y", Math.round(starty - dim.height)); + } + } + return [textElem]; + }, "drawKatex"); + drawText3 = /* @__PURE__ */ __name(function(elem, textData) { + let prevTextHeight = 0; + let textHeight = 0; + const lines = textData.text.split(common_default.lineBreakRegex); + const [_textFontSize, _textFontSizePx] = parseFontSize(textData.fontSize); + let textElems = []; + let dy = 0; + let yfunc = /* @__PURE__ */ __name(() => textData.y, "yfunc"); + if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) { + switch (textData.valign) { + case "top": + case "start": + yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + textData.textMargin), "yfunc"); + break; + case "middle": + case "center": + yfunc = /* @__PURE__ */ __name(() => Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2), "yfunc"); + break; + case "bottom": + case "end": + yfunc = /* @__PURE__ */ __name(() => Math.round( + textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin + ), "yfunc"); + break; + } + } + if (textData.anchor !== void 0 && textData.textMargin !== void 0 && textData.width !== void 0) { + switch (textData.anchor) { + case "left": + case "start": + textData.x = Math.round(textData.x + textData.textMargin); + textData.anchor = "start"; + textData.dominantBaseline = "middle"; + textData.alignmentBaseline = "middle"; + break; + case "middle": + case "center": + textData.x = Math.round(textData.x + textData.width / 2); + textData.anchor = "middle"; + textData.dominantBaseline = "middle"; + textData.alignmentBaseline = "middle"; + break; + case "right": + case "end": + textData.x = Math.round(textData.x + textData.width - textData.textMargin); + textData.anchor = "end"; + textData.dominantBaseline = "middle"; + textData.alignmentBaseline = "middle"; + break; + } + } + for (let [i2, line2] of lines.entries()) { + if (textData.textMargin !== void 0 && textData.textMargin === 0 && _textFontSize !== void 0) { + dy = i2 * _textFontSize; + } + const textElem = elem.append("text"); + textElem.attr("x", textData.x); + textElem.attr("y", yfunc()); + if (textData.anchor !== void 0) { + textElem.attr("text-anchor", textData.anchor).attr("dominant-baseline", textData.dominantBaseline).attr("alignment-baseline", textData.alignmentBaseline); + } + if (textData.fontFamily !== void 0) { + textElem.style("font-family", textData.fontFamily); + } + if (_textFontSizePx !== void 0) { + textElem.style("font-size", _textFontSizePx); + } + if (textData.fontWeight !== void 0) { + textElem.style("font-weight", textData.fontWeight); + } + if (textData.fill !== void 0) { + textElem.attr("fill", textData.fill); + } + if (textData.class !== void 0) { + textElem.attr("class", textData.class); + } + if (textData.dy !== void 0) { + textElem.attr("dy", textData.dy); + } else if (dy !== 0) { + textElem.attr("dy", dy); + } + const text4 = line2 || ZERO_WIDTH_SPACE; + if (textData.tspan) { + const span = textElem.append("tspan"); + span.attr("x", textData.x); + if (textData.fill !== void 0) { + span.attr("fill", textData.fill); + } + span.text(text4); + } else { + textElem.text(text4); + } + if (textData.valign !== void 0 && textData.textMargin !== void 0 && textData.textMargin > 0) { + textHeight += (textElem._groups || textElem)[0][0].getBBox().height; + prevTextHeight = textHeight; + } + textElems.push(textElem); + } + return textElems; + }, "drawText"); + drawLabel = /* @__PURE__ */ __name(function(elem, txtObject) { + function genPoints(x5, y6, width3, height2, cut) { + return x5 + "," + y6 + " " + (x5 + width3) + "," + y6 + " " + (x5 + width3) + "," + (y6 + height2 - cut) + " " + (x5 + width3 - cut * 1.2) + "," + (y6 + height2) + " " + x5 + "," + (y6 + height2); + } + __name(genPoints, "genPoints"); + const polygon2 = elem.append("polygon"); + polygon2.attr("points", genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7)); + polygon2.attr("class", "labelBox"); + txtObject.y = txtObject.y + txtObject.height / 2; + drawText3(elem, txtObject); + return polygon2; + }, "drawLabel"); + actorCnt = -1; + fixLifeLineHeights = /* @__PURE__ */ __name((diagram32, actors2, actorKeys, conf5) => { + if (!diagram32.select) { + return; + } + actorKeys.forEach((actorKey) => { + const actor = actors2.get(actorKey); + const actorDOM = diagram32.select("#actor" + actor.actorCnt); + if (!conf5.mirrorActors && actor.stopy) { + actorDOM.attr("y2", actor.stopy + actor.height / 2); + } else if (conf5.mirrorActors) { + actorDOM.attr("y2", actor.stopy); + } + }); + }, "fixLifeLineHeights"); + drawActorTypeParticipant = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) { + const actorY = isFooter ? actor.stopy : actor.starty; + const center4 = actor.x + actor.width / 2; + const centerY = actorY + actor.height; + const { look, theme, themeVariables } = conf5; + const { bkgColorArray, borderColorArray } = themeVariables; + const boxplusLineGroup = elem.append("g").lower(); + var g2 = boxplusLineGroup; + if (!isFooter) { + actorCnt++; + if (Object.keys(actor.links || {}).length && !conf5.forceMenus) { + g2.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer"); + } + g2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name); + g2 = boxplusLineGroup.append("g"); + actor.actorCnt = actorCnt; + if (actor.links != null) { + g2.attr("id", "root-" + actorCnt); + } + if (look === "neo") { + g2.attr("data-look", "neo"); + } + } + const rect3 = getNoteRect(); + var cssclass = "actor"; + if (actor.properties?.class) { + cssclass = actor.properties.class; + } else { + rect3.fill = "#eaeaea"; + } + if (isFooter) { + cssclass += ` ${BOTTOM_ACTOR_CLASS}`; + } else { + cssclass += ` ${TOP_ACTOR_CLASS}`; + } + rect3.x = actor.x; + rect3.y = actorY; + rect3.width = actor.width; + rect3.height = actor.height; + rect3.class = cssclass; + rect3.rx = 3; + rect3.ry = 3; + rect3.name = actor.name; + if (look === "neo") { + rect3.rx = 6; + rect3.ry = 6; + } + const rectElem = drawRect4(g2, rect3); + const actorCount = actorIndexMap.get(actor.name) ?? 0; + if (COLOR_THEMES5.has(theme)) { + rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + } + if (look === "neo") { + rectElem.attr("filter", "url(#drop-shadow)"); + } + actor.rectData = rect3; + if (actor.properties?.icon) { + const iconSrc = actor.properties.icon.trim(); + if (iconSrc.charAt(0) === "@") { + drawEmbeddedImage(g2, rect3.x + rect3.width - 20, rect3.y + 10, iconSrc.substr(1)); + } else { + drawImage(g2, rect3.x + rect3.width - 20, rect3.y + 10, iconSrc); + } + } + if (!isFooter) { + g2.attr("data-et", "participant"); + g2.attr("data-type", "participant"); + g2.attr("data-id", actor.name); + } + _drawTextCandidateFunc2(conf5, hasKatex(actor.description))( + actor.description, + g2, + rect3.x, + rect3.y, + rect3.width, + rect3.height, + { class: `actor ${ACTOR_BOX_CLASS}` }, + conf5 + ); + let height2 = actor.height; + if (rectElem.node) { + const bounds4 = rectElem.node().getBBox(); + actor.height = bounds4.height; + height2 = bounds4.height; + } + return height2; + }, "drawActorTypeParticipant"); + drawActorTypeCollections = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) { + const actorY = isFooter ? actor.stopy : actor.starty; + const center4 = actor.x + actor.width / 2; + const centerY = actorY + actor.height; + const { look, theme, themeVariables } = conf5; + const { bkgColorArray, borderColorArray } = themeVariables; + const boxplusLineGroup = elem.append("g").lower(); + var g2 = boxplusLineGroup; + if (!isFooter) { + actorCnt++; + if (Object.keys(actor.links || {}).length && !conf5.forceMenus) { + g2.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer"); + } + g2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name); + g2 = boxplusLineGroup.append("g"); + actor.actorCnt = actorCnt; + if (actor.links != null) { + g2.attr("id", "root-" + actorCnt); + } + if (look === "neo") { + g2.attr("data-look", "neo"); + } + } + const rect3 = getNoteRect(); + var cssclass = "actor"; + if (actor.properties?.class) { + cssclass = actor.properties.class; + } else { + rect3.fill = "#eaeaea"; + } + if (isFooter) { + cssclass += ` ${BOTTOM_ACTOR_CLASS}`; + } else { + cssclass += ` ${TOP_ACTOR_CLASS}`; + } + rect3.x = actor.x; + rect3.y = actorY; + rect3.width = actor.width; + rect3.height = actor.height; + rect3.class = cssclass; + rect3.name = actor.name; + const offset = 6; + const shadowRect = { + ...rect3, + x: rect3.x + (isFooter ? -offset : -offset), + y: rect3.y + (isFooter ? +offset : +offset), + class: "actor" + }; + const rectElem = drawRect4(g2, rect3); + const stackedRect = drawRect4(g2, shadowRect); + actor.rectData = rect3; + if (look === "neo") { + g2.attr("filter", "url(#drop-shadow)"); + } + const actorCount = actorIndexMap.get(actor.name) ?? 0; + if (COLOR_THEMES5.has(theme)) { + rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + stackedRect.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + stackedRect.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + } + if (actor.properties?.icon) { + const iconSrc = actor.properties.icon.trim(); + if (iconSrc.charAt(0) === "@") { + drawEmbeddedImage(g2, rect3.x + rect3.width - 20, rect3.y + 10, iconSrc.substr(1)); + } else { + drawImage(g2, rect3.x + rect3.width - 20, rect3.y + 10, iconSrc); + } + } + _drawTextCandidateFunc2(conf5, hasKatex(actor.description))( + actor.description, + g2, + rect3.x - offset, + rect3.y + offset, + rect3.width, + rect3.height, + { class: `actor ${ACTOR_BOX_CLASS}` }, + conf5 + ); + let height2 = actor.height; + if (rectElem.node) { + const bounds4 = rectElem.node().getBBox(); + actor.height = bounds4.height; + height2 = bounds4.height; + } + if (!isFooter) { + g2.attr("data-et", "participant"); + g2.attr("data-type", "collections"); + g2.attr("data-id", actor.name); + } + return height2; + }, "drawActorTypeCollections"); + drawActorTypeQueue = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) { + const actorY = isFooter ? actor.stopy : actor.starty; + const center4 = actor.x + actor.width / 2; + const centerY = actorY + actor.height; + const { look, theme, themeVariables } = conf5; + const { bkgColorArray, borderColorArray } = themeVariables; + const boxplusLineGroup = elem.append("g").lower(); + let g2 = boxplusLineGroup; + if (!isFooter) { + actorCnt++; + if (Object.keys(actor.links || {}).length && !conf5.forceMenus) { + g2.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer"); + } + g2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name); + g2 = boxplusLineGroup.append("g"); + actor.actorCnt = actorCnt; + if (actor.links != null) { + g2.attr("id", "root-" + actorCnt); + } + if (look === "neo") { + g2.attr("data-look", "neo"); + } + } + const rect3 = getNoteRect(); + let cssclass = "actor"; + if (actor.properties?.class) { + cssclass = actor.properties.class; + } else { + rect3.fill = "#eaeaea"; + } + if (isFooter) { + cssclass += ` ${BOTTOM_ACTOR_CLASS}`; + } else { + cssclass += ` ${TOP_ACTOR_CLASS}`; + } + g2.attr("class", cssclass); + rect3.x = actor.x; + rect3.y = actorY; + rect3.width = actor.width; + rect3.height = actor.height; + rect3.name = actor.name; + const ry = rect3.height / 2; + const rx = ry / (2.5 + rect3.height / 50); + const cylinderGroup = g2.append("g"); + const cylinderArc = g2.append("g"); + const cylinderPath = `M ${rect3.x},${rect3.y + ry} + a ${rx},${ry} 0 0 0 0,${rect3.height} + h ${rect3.width - 2 * rx} + a ${rx},${ry} 0 0 0 0,-${rect3.height} + Z + `; + cylinderGroup.append("path").attr("d", cylinderPath); + cylinderArc.append("path").attr( + "d", + `M ${rect3.x},${rect3.y + ry} + a ${rx},${ry} 0 0 0 0,${rect3.height}` + ); + cylinderGroup.attr("transform", `translate(${rx}, ${-(rect3.height / 2)})`); + cylinderArc.attr("transform", `translate(${rect3.width - rx}, ${-rect3.height / 2})`); + actor.rectData = rect3; + if (look === "neo") { + cylinderGroup.attr("filter", "url(#drop-shadow)"); + } + const actorCount = actorIndexMap.get(actor.name) ?? 0; + if (COLOR_THEMES5.has(theme)) { + cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + cylinderArc.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + cylinderArc.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + } + if (actor.properties?.icon) { + const iconSrc = actor.properties.icon.trim(); + const iconX = rect3.x + rect3.width - 20; + const iconY = rect3.y + 10; + if (iconSrc.charAt(0) === "@") { + drawEmbeddedImage(g2, iconX, iconY, iconSrc.substr(1)); + } else { + drawImage(g2, iconX, iconY, iconSrc); + } + } + _drawTextCandidateFunc2(conf5, hasKatex(actor.description))( + actor.description, + g2, + rect3.x, + rect3.y, + rect3.width, + rect3.height, + { class: `actor ${ACTOR_BOX_CLASS}` }, + conf5 + ); + let height2 = actor.height; + const lastPath = cylinderGroup.select("path:last-child"); + if (lastPath.node()) { + const bounds4 = lastPath.node().getBBox(); + actor.height = bounds4.height; + height2 = bounds4.height; + } + if (!isFooter) { + g2.attr("data-et", "participant"); + g2.attr("data-type", "queue"); + g2.attr("data-id", actor.name); + } + return height2; + }, "drawActorTypeQueue"); + drawActorTypeControl = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, diagramId3, actorIndexMap) { + const actorY = isFooter ? actor.stopy : actor.starty; + const center4 = actor.x + actor.width / 2; + const centerY = actorY + 75; + const { look, theme, themeVariables } = conf5; + const { bkgColorArray, borderColorArray, actorBorder, actorBkg } = themeVariables; + const line2 = elem.append("g").lower(); + if (!isFooter) { + actorCnt++; + line2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name); + actor.actorCnt = actorCnt; + } + const actElem = elem.append("g"); + let cssClass = ACTOR_MAN_FIGURE_CLASS; + if (isFooter) { + cssClass += ` ${BOTTOM_ACTOR_CLASS}`; + } else { + cssClass += ` ${TOP_ACTOR_CLASS}`; + } + actElem.attr("class", cssClass); + actElem.attr("name", actor.name); + const rect3 = getNoteRect(); + rect3.x = actor.x; + rect3.y = actorY; + rect3.fill = "#eaeaea"; + rect3.width = actor.width; + rect3.height = actor.height; + rect3.class = "actor"; + const cx = actor.x + actor.width / 2; + const cy = actorY + 32; + const r2 = 22; + actElem.append("defs").append("marker").attr("id", diagramId3 + "-filled-head-control").attr("refX", 11).attr("refY", 5.8).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "172.5").attr("stroke-width", 1.2).append("path").attr("d", "M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z"); + actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r2).attr("filter", `${look === "neo" ? "url(#drop-shadow)" : ""}`); + actElem.append("line").attr("marker-end", "url(#" + diagramId3 + "-filled-head-control)").attr("transform", `translate(${cx}, ${cy - r2})`); + const actorCount = actorIndexMap.get(actor.name) ?? 0; + if (COLOR_THEMES5.has(theme)) { + actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + } else { + actElem.style("stroke", actorBorder); + actElem.style("fill", actorBkg); + } + const bounds4 = actElem.node().getBBox(); + actor.height = bounds4.height + 2 * (conf5?.sequence?.labelBoxHeight ?? 0); + _drawTextCandidateFunc2(conf5, hasKatex(actor.description))( + actor.description, + actElem, + rect3.x, + rect3.y + r2 + (!isFooter ? 12 : 5), + rect3.width, + rect3.height, + { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` }, + conf5 + ); + if (!isFooter) { + actElem.attr("data-et", "participant"); + actElem.attr("data-type", "control"); + actElem.attr("data-id", actor.name); + } + return actor.height; + }, "drawActorTypeControl"); + drawActorTypeEntity = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) { + const actorY = isFooter ? actor.stopy : actor.starty; + const center4 = actor.x + actor.width / 2; + const centerY = actorY + 75; + const { look, theme, themeVariables } = conf5; + const { bkgColorArray, borderColorArray } = themeVariables; + const line2 = elem.append("g").lower(); + const actElem = elem.append("g"); + let cssClass = "actor"; + if (isFooter) { + cssClass += ` ${BOTTOM_ACTOR_CLASS}`; + } else { + cssClass += ` ${TOP_ACTOR_CLASS}`; + } + actElem.attr("class", cssClass); + actElem.attr("name", actor.name); + const rect3 = getNoteRect(); + rect3.x = actor.x; + rect3.y = actorY; + rect3.fill = "#eaeaea"; + rect3.width = actor.width; + rect3.height = actor.height; + rect3.class = "actor"; + const cx = actor.x + actor.width / 2; + const cy = actorY + (!isFooter ? 25 : 10); + const r2 = 22; + actElem.append("circle").attr("cx", cx).attr("cy", cy).attr("r", r2).attr("width", actor.width).attr("height", actor.height); + actElem.append("line").attr("x1", cx - r2).attr("x2", cx + r2).attr("y1", cy + r2).attr("y2", cy + r2).attr("stroke-width", 2); + if (look === "neo") { + actElem.attr("filter", "url(#drop-shadow)"); + } + const actorCount = actorIndexMap.get(actor.name) ?? 0; + if (COLOR_THEMES5.has(theme)) { + actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + } + const bounds4 = actElem.node().getBBox(); + actor.height = bounds4.height + (conf5?.sequence?.labelBoxHeight ?? 0); + if (!isFooter) { + actorCnt++; + line2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name); + actor.actorCnt = actorCnt; + } + _drawTextCandidateFunc2(conf5, hasKatex(actor.description))( + actor.description, + actElem, + rect3.x, + rect3.y + (!isFooter ? 30 : 15), + rect3.width, + rect3.height, + { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` }, + conf5 + ); + if (!isFooter) { + actElem.attr("transform", `translate(${0}, ${r2 / 2 - 5})`); + actElem.attr("data-et", "participant"); + actElem.attr("data-type", "entity"); + actElem.attr("data-id", actor.name); + } else { + actElem.attr("transform", `translate(${0}, ${r2})`); + } + return actor.height; + }, "drawActorTypeEntity"); + drawActorTypeDatabase = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) { + const actorY = isFooter ? actor.stopy : actor.starty; + const center4 = actor.x + actor.width / 2; + const centerY = actorY + actor.height + 2 * conf5.boxTextMargin; + const { theme, themeVariables, look } = conf5; + const { bkgColorArray, borderColorArray, actorBorder } = themeVariables; + const boxplusLineGroup = elem.append("g").lower(); + let g2 = boxplusLineGroup; + if (!isFooter) { + actorCnt++; + if (Object.keys(actor.links || {}).length && !conf5.forceMenus) { + g2.attr("onclick", popupMenuToggle(`actor${actorCnt}_popup`)).attr("cursor", "pointer"); + } + g2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name); + g2 = boxplusLineGroup.append("g"); + actor.actorCnt = actorCnt; + if (actor.links != null) { + g2.attr("id", "root-" + actorCnt); + } + if (look === "neo") { + g2.attr("data-look", "neo"); + } + } + const rect3 = getNoteRect(); + let cssclass = "actor"; + if (actor.properties?.class) { + cssclass = actor.properties.class; + } else { + rect3.fill = "#eaeaea"; + } + if (isFooter) { + cssclass += ` ${BOTTOM_ACTOR_CLASS}`; + } else { + cssclass += ` ${TOP_ACTOR_CLASS}`; + } + rect3.x = actor.x; + rect3.y = actorY; + rect3.width = actor.width; + rect3.height = actor.height; + rect3.class = cssclass; + rect3.name = actor.name; + rect3.x = actor.x; + rect3.y = actorY; + const w4 = rect3.width / 3; + const h3 = rect3.width / 3; + const rx = w4 / 2; + const ry = rx / (2.5 + w4 / 50); + const cylinderGroup = g2.append("g"); + cylinderGroup.attr("class", cssclass); + const d3 = ` + M ${rect3.x},${rect3.y + ry} + a ${rx},${ry} 0 0 0 ${w4},0 + a ${rx},${ry} 0 0 0 -${w4},0 + l 0,${h3 - 2 * ry} + a ${rx},${ry} 0 0 0 ${w4},0 + l 0,-${h3 - 2 * ry} +`; + cylinderGroup.append("path").attr("d", d3); + if (look === "neo") { + cylinderGroup.attr("filter", "url(#drop-shadow)"); + } + const actorCount = actorIndexMap.get(actor.name) ?? 0; + if (COLOR_THEMES5.has(theme)) { + cylinderGroup.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + cylinderGroup.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + } else { + cylinderGroup.style("stroke", actorBorder); + } + cylinderGroup.attr("transform", `translate(${w4}, ${ry})`); + actor.rectData = rect3; + _drawTextCandidateFunc2(conf5, hasKatex(actor.description))( + actor.description, + g2, + rect3.x, + rect3.y + 35, + rect3.width, + rect3.height, + { class: `actor ${ACTOR_BOX_CLASS}` }, + conf5 + ); + const lastPath = cylinderGroup.select("path:last-child"); + if (lastPath.node()) { + const bounds4 = lastPath.node().getBBox(); + actor.height = bounds4.height + (conf5.sequence.labelBoxHeight ?? 0); + } + if (!isFooter) { + g2.attr("data-et", "participant"); + g2.attr("data-type", "database"); + g2.attr("data-id", actor.name); + } + return actor.height; + }, "drawActorTypeDatabase"); + drawActorTypeBoundary = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) { + const actorY = isFooter ? actor.stopy : actor.starty; + const center4 = actor.x + actor.width / 2; + const centerY = actorY + 80; + const radius2 = 22; + const line2 = elem.append("g").lower(); + const { look, theme, themeVariables } = conf5; + const { bkgColorArray, borderColorArray, actorBorder } = themeVariables; + if (!isFooter) { + actorCnt++; + line2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name); + actor.actorCnt = actorCnt; + } + const actElem = elem.append("g"); + let cssClass = ACTOR_MAN_FIGURE_CLASS; + if (isFooter) { + cssClass += ` ${BOTTOM_ACTOR_CLASS}`; + } else { + cssClass += ` ${TOP_ACTOR_CLASS}`; + } + actElem.attr("class", cssClass); + actElem.attr("name", actor.name); + const rect3 = getNoteRect(); + rect3.x = actor.x; + rect3.y = actorY; + rect3.fill = "#eaeaea"; + rect3.width = actor.width; + rect3.height = actor.height; + rect3.class = "actor"; + actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius2 * 2.5).attr("y1", actorY + 12).attr("x2", actor.x + actor.width / 2 - 15).attr("y2", actorY + 12); + actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", actor.x + actor.width / 2 - radius2 * 2.5).attr("y1", actorY + 2).attr("x2", actor.x + actor.width / 2 - radius2 * 2.5).attr("y2", actorY + 22); + actElem.append("circle").attr("cx", actor.x + actor.width / 2).attr("cy", actorY + 12).attr("r", radius2); + if (look === "neo") { + actElem.attr("filter", "url(#drop-shadow)"); + } + const actorCount = actorIndexMap.get(actor.name) ?? 0; + if (COLOR_THEMES5.has(theme)) { + actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + } else { + actElem.style("stroke", actorBorder); + } + const bounds4 = actElem.node().getBBox(); + actor.height = bounds4.height + (conf5.sequence.labelBoxHeight ?? 0); + _drawTextCandidateFunc2(conf5, hasKatex(actor.description))( + actor.description, + actElem, + rect3.x, + rect3.y + 15, + rect3.width, + rect3.height, + { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` }, + conf5 + ); + actElem.attr("transform", `translate(0,${radius2 / 2 + 10})`); + if (!isFooter) { + actElem.attr("data-et", "participant"); + actElem.attr("data-type", "boundary"); + actElem.attr("data-id", actor.name); + } + return actor.height; + }, "drawActorTypeBoundary"); + drawActorTypeActor = /* @__PURE__ */ __name(function(elem, actor, conf5, isFooter, actorIndexMap) { + const actorY = isFooter ? actor.stopy : actor.starty; + const center4 = actor.x + actor.width / 2; + const centerY = actorY + 80; + const { look, theme, themeVariables } = conf5; + const { bkgColorArray, borderColorArray, actorBorder } = themeVariables; + const line2 = elem.append("g").lower(); + if (!isFooter) { + actorCnt++; + line2.append("line").attr("id", "actor" + actorCnt).attr("x1", center4).attr("y1", centerY).attr("x2", center4).attr("y2", 2e3).attr("class", "actor-line 200").attr("stroke-width", "0.5px").attr("stroke", "#999").attr("name", actor.name).attr("data-et", "life-line").attr("data-id", actor.name); + actor.actorCnt = actorCnt; + } + const actElem = elem.append("g"); + let cssClass = ACTOR_MAN_FIGURE_CLASS; + if (isFooter) { + cssClass += ` ${BOTTOM_ACTOR_CLASS}`; + } else { + cssClass += ` ${TOP_ACTOR_CLASS}`; + } + actElem.attr("class", cssClass); + actElem.attr("name", actor.name); + if (!isFooter) { + actElem.attr("data-et", "participant").attr("data-type", "actor").attr("data-id", actor.name); + } + const scale3 = look === "neo" ? 0.5 : 1; + const adjustedActorY = look === "neo" ? actorY + (1 - scale3) * 30 : actorY; + actElem.append("line").attr("id", "actor-man-torso" + actorCnt).attr("x1", center4).attr("y1", adjustedActorY + 25 * scale3).attr("x2", center4).attr("y2", adjustedActorY + 45 * scale3); + actElem.append("line").attr("id", "actor-man-arms" + actorCnt).attr("x1", center4 - ACTOR_TYPE_WIDTH / 2 * scale3).attr("y1", adjustedActorY + 33 * scale3).attr("x2", center4 + ACTOR_TYPE_WIDTH / 2 * scale3).attr("y2", adjustedActorY + 33 * scale3); + actElem.append("line").attr("x1", center4 - ACTOR_TYPE_WIDTH / 2 * scale3).attr("y1", adjustedActorY + 60 * scale3).attr("x2", center4).attr("y2", adjustedActorY + 45 * scale3); + actElem.append("line").attr("x1", center4).attr("y1", adjustedActorY + 45 * scale3).attr("x2", center4 + (ACTOR_TYPE_WIDTH / 2 - 2) * scale3).attr("y2", adjustedActorY + 60 * scale3); + const circle6 = actElem.append("circle"); + circle6.attr("cx", actor.x + actor.width / 2); + circle6.attr("cy", adjustedActorY + 10 * scale3); + circle6.attr("r", 15 * scale3); + circle6.attr("width", actor.width * scale3); + circle6.attr("height", actor.height * scale3); + const bounds4 = actElem.node().getBBox(); + actor.height = bounds4.height; + const rect3 = getNoteRect(); + rect3.x = actor.x; + rect3.y = adjustedActorY; + rect3.fill = "#eaeaea"; + rect3.width = actor.width; + rect3.height = actor.height / scale3; + rect3.class = "actor"; + rect3.rx = 3; + rect3.ry = 3; + const actorCount = actorIndexMap.get(actor.name) ?? 0; + if (COLOR_THEMES5.has(theme)) { + actElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + actElem.style("fill", bkgColorArray[actorCount % borderColorArray.length]); + } else { + actElem.style("stroke", actorBorder); + } + _drawTextCandidateFunc2(conf5, hasKatex(actor.description))( + actor.description, + actElem, + rect3.x, + adjustedActorY + 35 * scale3 - (look === "neo" ? 10 : 0), + rect3.width, + rect3.height, + { class: `actor ${ACTOR_MAN_FIGURE_CLASS}` }, + conf5 + ); + return actor.height; + }, "drawActorTypeActor"); + drawActor = /* @__PURE__ */ __name(async function(elem, actor, conf5, isFooter, diagramId3, diagObj, actorIndexMap) { + const resolvedActorIndexMap = actorIndexMap ?? new Map( + [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index]) + ); + switch (actor.type) { + case "actor": + return await drawActorTypeActor(elem, actor, conf5, isFooter, resolvedActorIndexMap); + case "participant": + return await drawActorTypeParticipant(elem, actor, conf5, isFooter, resolvedActorIndexMap); + case "boundary": + return await drawActorTypeBoundary(elem, actor, conf5, isFooter, resolvedActorIndexMap); + case "control": + return await drawActorTypeControl( + elem, + actor, + conf5, + isFooter, + diagramId3, + resolvedActorIndexMap + ); + case "entity": + return await drawActorTypeEntity(elem, actor, conf5, isFooter, resolvedActorIndexMap); + case "database": + return await drawActorTypeDatabase(elem, actor, conf5, isFooter, resolvedActorIndexMap); + case "collections": + return await drawActorTypeCollections(elem, actor, conf5, isFooter, resolvedActorIndexMap); + case "queue": + return await drawActorTypeQueue(elem, actor, conf5, isFooter, resolvedActorIndexMap); + } + }, "drawActor"); + drawBox = /* @__PURE__ */ __name(function(elem, box, conf5) { + const boxplusTextGroup = elem.append("g"); + const g2 = boxplusTextGroup; + drawBackgroundRect2(g2, box); + if (box.name) { + _drawTextCandidateFunc2(conf5)( + box.name, + g2, + box.x, + box.y + conf5.boxTextMargin + (box.textMaxHeight || 0) / 2, + box.width, + 0, + { class: "text" }, + conf5 + ); + } + g2.lower(); + }, "drawBox"); + anchorElement = /* @__PURE__ */ __name(function(elem) { + return elem.append("g"); + }, "anchorElement"); + drawActivation = /* @__PURE__ */ __name(function(_elem, bounds4, verticalPos, conf5, actorActivations2, diagObj, actorIndexMap) { + const { theme, themeVariables } = conf5; + const { bkgColorArray, borderColorArray, mainBkg } = themeVariables; + const rect3 = getNoteRect(); + const g2 = bounds4.anchored; + const actor = bounds4.actor; + rect3.x = bounds4.startx; + rect3.y = bounds4.starty; + rect3.class = "activation" + actorActivations2 % 3; + rect3.width = bounds4.stopx - bounds4.startx; + rect3.height = verticalPos - bounds4.starty; + const rectElem = drawRect4(g2, rect3); + const resolvedActorIndexMap = actorIndexMap ?? new Map( + [...diagObj.db.getActors().values()].map((participant, index) => [participant.name, index]) + ); + const actorCount = resolvedActorIndexMap.get(actor) ?? 0; + if (COLOR_THEMES5.has(theme)) { + rectElem.style("stroke", borderColorArray[actorCount % borderColorArray.length]); + rectElem.style("fill", bkgColorArray[actorCount % borderColorArray.length] ?? mainBkg); + } + }, "drawActivation"); + drawLoop = /* @__PURE__ */ __name(async function(elem, loopModel, labelText, conf5, msg) { + const { + boxMargin, + boxTextMargin, + labelBoxHeight, + labelBoxWidth, + messageFontFamily: fontFamily, + messageFontSize: fontSize, + messageFontWeight: fontWeight + } = conf5; + const g2 = elem.append("g").attr("data-et", "control-structure").attr("data-id", "i" + msg.id); + const drawLoopLine = /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) { + return g2.append("line").attr("x1", startx).attr("y1", starty).attr("x2", stopx).attr("y2", stopy).attr("class", "loopLine"); + }, "drawLoopLine"); + drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty); + drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy); + drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy); + drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy); + if (loopModel.sections !== void 0) { + loopModel.sections.forEach(function(item) { + drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style( + "stroke-dasharray", + "3, 3" + ); + }); + } + let txt = getTextObj(); + txt.text = labelText; + txt.x = loopModel.startx; + txt.y = loopModel.starty; + txt.fontFamily = fontFamily; + txt.fontSize = fontSize; + txt.fontWeight = fontWeight; + txt.anchor = "middle"; + txt.valign = "middle"; + txt.tspan = false; + txt.width = Math.max(labelBoxWidth ?? 0, 50); + txt.height = labelBoxHeight + (conf5.look === "neo" ? 15 : 0) || 20; + txt.textMargin = boxTextMargin; + txt.class = "labelText"; + drawLabel(g2, txt); + txt = getTextObj3(); + txt.text = loopModel.title; + txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2; + txt.y = loopModel.starty + boxMargin + boxTextMargin; + txt.anchor = "middle"; + txt.valign = "middle"; + txt.textMargin = boxTextMargin; + txt.class = "loopText"; + txt.fontFamily = fontFamily; + txt.fontSize = fontSize; + txt.fontWeight = fontWeight; + txt.wrap = true; + let textElem = hasKatex(txt.text) ? await drawKatex(g2, txt, loopModel) : drawText3(g2, txt); + if (loopModel.sectionTitles !== void 0) { + for (const [idx, item] of Object.entries(loopModel.sectionTitles)) { + if (item.message) { + txt.text = item.message; + txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2; + txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin; + txt.class = "sectionTitle"; + txt.anchor = "middle"; + txt.valign = "middle"; + txt.tspan = false; + txt.fontFamily = fontFamily; + txt.fontSize = fontSize; + txt.fontWeight = fontWeight; + txt.wrap = loopModel.wrap; + if (hasKatex(txt.text)) { + loopModel.starty = loopModel.sections[idx].y; + await drawKatex(g2, txt, loopModel); + } else { + drawText3(g2, txt); + } + let sectionHeight = Math.round( + textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr) + ); + loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin); + } + } + } + loopModel.height = Math.round(loopModel.stopy - loopModel.starty); + return g2; + }, "drawLoop"); + drawBackgroundRect2 = /* @__PURE__ */ __name(function(elem, bounds4) { + drawBackgroundRect(elem, bounds4); + }, "drawBackgroundRect"); + insertDatabaseIcon2 = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("symbol").attr("id", id35 + "-database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr( + "d", + "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z" + ); + }, "insertDatabaseIcon"); + insertComputerIcon2 = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("symbol").attr("id", id35 + "-computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr( + "d", + "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z" + ); + }, "insertComputerIcon"); + insertClockIcon2 = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("symbol").attr("id", id35 + "-clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr( + "d", + "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z" + ); + }, "insertClockIcon"); + insertArrowHead2 = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-arrowhead").attr("refX", 7.9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M -1 0 L 10 5 L 0 10 z"); + }, "insertArrowHead"); + insertArrowFilledHead2 = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-filled-head").attr("refX", 15.5).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z"); + }, "insertArrowFilledHead"); + insertSequenceNumber = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6); + }, "insertSequenceNumber"); + insertArrowCrossHead2 = /* @__PURE__ */ __name(function(elem, id35) { + const defs2 = elem.append("defs"); + const marker = defs2.append("marker").attr("id", id35 + "-crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5); + marker.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1pt").attr("d", "M 1,2 L 6,7 M 6,2 L 1,7"); + }, "insertArrowCrossHead"); + insertDropShadow = /* @__PURE__ */ __name(function(elem, conf5) { + const { theme } = conf5; + elem.append("defs").append("filter").attr("id", "drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", `${theme === "redux" || theme === "redux-color" ? "#000000" : "#FFFFFF"}`); + }, "insertDropShadow"); + getTextObj3 = /* @__PURE__ */ __name(function() { + return { + x: 0, + y: 0, + fill: void 0, + anchor: void 0, + style: "#666", + width: void 0, + height: void 0, + textMargin: 0, + rx: 0, + ry: 0, + tspan: true, + valign: void 0 + }; + }, "getTextObj"); + getNoteRect2 = /* @__PURE__ */ __name(function() { + return { + x: 0, + y: 0, + fill: "#EDF2AE", + stroke: "#666", + width: 100, + anchor: "start", + height: 100, + rx: 0, + ry: 0 + }; + }, "getNoteRect"); + _drawTextCandidateFunc2 = /* @__PURE__ */ (function() { + function byText(content, g2, x5, y6, width3, height2, textAttrs) { + const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6 + height2 / 2 + 5).style("text-anchor", "middle").text(content); + _setTextAttrs(text4, textAttrs); + } + __name(byText, "byText"); + function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5) { + const { actorFontSize, actorFontFamily, actorFontWeight } = conf5; + const [_actorFontSize, _actorFontSizePx] = parseFontSize(actorFontSize); + const lines = content.split(common_default.lineBreakRegex); + for (let i2 = 0; i2 < lines.length; i2++) { + const dy = i2 * _actorFontSize - _actorFontSize * (lines.length - 1) / 2; + const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6).style("text-anchor", "middle").style("font-size", _actorFontSizePx).style("font-weight", actorFontWeight).style("font-family", actorFontFamily); + text4.append("tspan").attr("x", x5 + width3 / 2).attr("dy", dy).text(lines[i2]); + text4.attr("y", y6 + height2 / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"); + _setTextAttrs(text4, textAttrs); + } + } + __name(byTspan, "byTspan"); + function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) { + const s2 = g2.append("switch"); + const f2 = s2.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2); + const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text4.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content); + byTspan(content, s2, x5, y6, width3, height2, textAttrs, conf5); + _setTextAttrs(text4, textAttrs); + } + __name(byFo, "byFo"); + async function byKatex(content, g2, x5, y6, width3, height2, textAttrs, conf5) { + const dim = await calculateMathMLDimensions(content, getConfig()); + const s2 = g2.append("switch"); + const f2 = s2.append("foreignObject").attr("x", x5 + width3 / 2 - dim.width / 2).attr("y", y6 + height2 / 2 - dim.height / 2).attr("width", dim.width).attr("height", dim.height); + const text4 = f2.append("xhtml:div").style("height", "100%").style("width", "100%"); + text4.append("div").style("text-align", "center").style("vertical-align", "middle").html(await renderKatexSanitized(content, getConfig())); + byTspan(content, s2, x5, y6, width3, height2, textAttrs, conf5); + _setTextAttrs(text4, textAttrs); + } + __name(byKatex, "byKatex"); + function _setTextAttrs(toText, fromTextAttrsDict) { + for (const key in fromTextAttrsDict) { + if (fromTextAttrsDict.hasOwnProperty(key)) { + toText.attr(key, fromTextAttrsDict[key]); + } + } + } + __name(_setTextAttrs, "_setTextAttrs"); + return function(conf5, hasKatex2 = false) { + if (hasKatex2) { + return byKatex; + } + return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan; + }; + })(); + _drawMenuItemTextCandidateFunc = /* @__PURE__ */ (function() { + function byText(content, g2, x5, y6, width3, height2, textAttrs) { + const text4 = g2.append("text").attr("x", x5).attr("y", y6).style("text-anchor", "start").text(content); + _setTextAttrs(text4, textAttrs); + } + __name(byText, "byText"); + function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5) { + const { actorFontSize, actorFontFamily, actorFontWeight } = conf5; + const lines = content.split(common_default.lineBreakRegex); + for (let i2 = 0; i2 < lines.length; i2++) { + const dy = i2 * actorFontSize - actorFontSize * (lines.length - 1) / 2; + const text4 = g2.append("text").attr("x", x5).attr("y", y6).style("text-anchor", "start").style("font-size", actorFontSize).style("font-weight", actorFontWeight).style("font-family", actorFontFamily); + text4.append("tspan").attr("x", x5).attr("dy", dy).text(lines[i2]); + text4.attr("y", y6 + height2 / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"); + _setTextAttrs(text4, textAttrs); + } + } + __name(byTspan, "byTspan"); + function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) { + const s2 = g2.append("switch"); + const f2 = s2.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2); + const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text4.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content); + byTspan(content, s2, x5, y6, width3, height2, textAttrs, conf5); + _setTextAttrs(text4, textAttrs); + } + __name(byFo, "byFo"); + function _setTextAttrs(toText, fromTextAttrsDict) { + for (const key in fromTextAttrsDict) { + if (fromTextAttrsDict.hasOwnProperty(key)) { + toText.attr(key, fromTextAttrsDict[key]); + } + } + } + __name(_setTextAttrs, "_setTextAttrs"); + return function(conf5) { + return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan; + }; + })(); + insertSolidTopArrowHead = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-solidTopArrowHead").attr("refX", 7.9).attr("refY", 7.25).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 8 L 0 8 z"); + }, "insertSolidTopArrowHead"); + insertSolidBottomArrowHead = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-solidBottomArrowHead").attr("refX", 7.9).attr("refY", 0.75).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 0 L 0 8 z"); + }, "insertSolidBottomArrowHead"); + insertStickTopArrowHead = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-stickTopArrowHead").attr("refX", 7.5).attr("refY", 7).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 7 7").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none"); + }, "insertStickTopArrowHead"); + insertStickBottomArrowHead = /* @__PURE__ */ __name(function(elem, id35) { + elem.append("defs").append("marker").attr("id", id35 + "-stickBottomArrowHead").attr("refX", 7.5).attr("refY", 0).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 7 L 7 0").attr("stroke", "black").attr("stroke-width", 1.5).attr("fill", "none"); + }, "insertStickBottomArrowHead"); + svgDraw_default2 = { + drawRect: drawRect4, + drawText: drawText3, + drawLabel, + drawActor, + drawBox, + drawPopup, + anchorElement, + drawActivation, + drawLoop, + drawBackgroundRect: drawBackgroundRect2, + insertArrowHead: insertArrowHead2, + insertArrowFilledHead: insertArrowFilledHead2, + insertSequenceNumber, + insertArrowCrossHead: insertArrowCrossHead2, + insertDatabaseIcon: insertDatabaseIcon2, + insertComputerIcon: insertComputerIcon2, + insertClockIcon: insertClockIcon2, + getTextObj: getTextObj3, + getNoteRect: getNoteRect2, + fixLifeLineHeights, + sanitizeUrl: import_sanitize_url5.sanitizeUrl, + insertDropShadow, + insertSolidTopArrowHead, + insertSolidBottomArrowHead, + insertStickTopArrowHead, + insertStickBottomArrowHead + }; + } + }); + + // src/diagrams/sequence/sequenceRenderer.ts + async function boundMessage(_diagram, msgModel) { + bounds2.bumpVerticalPos(10); + const { startx, stopx, message } = msgModel; + const lines = common_default.splitBreaks(message).length; + const isKatexMsg = hasKatex(message); + const textDims = isKatexMsg ? await calculateMathMLDimensions(message, getConfig2()) : utils_default2.calculateTextDimensions(message, messageFont2(conf2)); + if (!isKatexMsg) { + const lineHeight = textDims.height / lines; + msgModel.height += lineHeight; + bounds2.bumpVerticalPos(lineHeight); + } + let lineStartY; + let totalOffset = textDims.height - 10; + const textWidth = textDims.width; + if (startx === stopx) { + lineStartY = bounds2.getVerticalPos() + totalOffset; + if (!conf2.rightAngles) { + totalOffset += conf2.boxMargin; + lineStartY = bounds2.getVerticalPos() + totalOffset; + } + totalOffset += 30; + const dx = common_default.getMax(textWidth / 2, conf2.width / 2); + bounds2.insert( + startx - dx, + bounds2.getVerticalPos() - 10 + totalOffset, + stopx + dx, + bounds2.getVerticalPos() + 30 + totalOffset + ); + } else { + totalOffset += conf2.boxMargin; + lineStartY = bounds2.getVerticalPos() + totalOffset; + bounds2.insert(startx, lineStartY - 10, stopx, lineStartY); + } + bounds2.bumpVerticalPos(totalOffset); + msgModel.height += totalOffset; + msgModel.stopy = msgModel.starty + msgModel.height; + bounds2.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy); + return lineStartY; + } + function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) { + bounds2.bumpVerticalPos(preMargin); + let heightAdjust = postMargin; + if (msg.id && msg.message && loopWidths[msg.id]) { + const loopWidth = loopWidths[msg.id].width; + const textConf = messageFont2(conf2); + msg.message = utils_default2.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf2.wrapPadding, textConf); + msg.width = loopWidth; + msg.wrap = true; + const textDims = utils_default2.calculateTextDimensions(msg.message, textConf); + const totalOffset = common_default.getMax(textDims.height, conf2.labelBoxHeight); + heightAdjust = postMargin + totalOffset; + log.debug(`${totalOffset} - ${msg.message}`); + } + addLoopFn(msg); + bounds2.bumpVerticalPos(heightAdjust); + } + function adjustCreatedDestroyedData(msg, msgModel, lineStartY, index, actors2, createdActors, destroyedActors) { + function receiverAdjustment(actor, adjustment) { + if (actor.x < actors2.get(msg.from).x) { + bounds2.insert( + msgModel.stopx - adjustment, + msgModel.starty, + msgModel.startx, + msgModel.stopy + actor.height / 2 + conf2.noteMargin + ); + msgModel.stopx = msgModel.stopx + adjustment; + } else { + bounds2.insert( + msgModel.startx, + msgModel.starty, + msgModel.stopx + adjustment, + msgModel.stopy + actor.height / 2 + conf2.noteMargin + ); + msgModel.stopx = msgModel.stopx - adjustment; + } + } + __name(receiverAdjustment, "receiverAdjustment"); + function senderAdjustment(actor, adjustment) { + if (actor.x < actors2.get(msg.to).x) { + bounds2.insert( + msgModel.startx - adjustment, + msgModel.starty, + msgModel.stopx, + msgModel.stopy + actor.height / 2 + conf2.noteMargin + ); + msgModel.startx = msgModel.startx + adjustment; + } else { + bounds2.insert( + msgModel.stopx, + msgModel.starty, + msgModel.startx + adjustment, + msgModel.stopy + actor.height / 2 + conf2.noteMargin + ); + msgModel.startx = msgModel.startx - adjustment; + } + } + __name(senderAdjustment, "senderAdjustment"); + const actorArray = [ + PARTICIPANT_TYPE.ACTOR, + PARTICIPANT_TYPE.CONTROL, + PARTICIPANT_TYPE.ENTITY, + PARTICIPANT_TYPE.DATABASE + ]; + if (createdActors.get(msg.to) == index) { + const actor = actors2.get(msg.to); + const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3; + receiverAdjustment(actor, adjustment); + actor.starty = lineStartY - actor.height / 2; + bounds2.bumpVerticalPos(actor.height / 2); + } else if (destroyedActors.get(msg.from) == index) { + const actor = actors2.get(msg.from); + if (conf2.mirrorActors) { + const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 : actor.width / 2; + senderAdjustment(actor, adjustment); + } + actor.stopy = lineStartY - actor.height / 2; + bounds2.bumpVerticalPos(actor.height / 2); + } else if (destroyedActors.get(msg.to) == index) { + const actor = actors2.get(msg.to); + if (conf2.mirrorActors) { + const adjustment = actorArray.includes(actor.type) ? ACTOR_TYPE_WIDTH / 2 + 3 : actor.width / 2 + 3; + receiverAdjustment(actor, adjustment); + } + actor.stopy = lineStartY - actor.height / 2; + bounds2.bumpVerticalPos(actor.height / 2); + } + } + async function getMaxMessageWidthPerActor(actors2, messages, diagObj) { + const maxMessageWidthPerActor = {}; + for (const msg of messages) { + if (actors2.get(msg.to) && actors2.get(msg.from)) { + const actor = actors2.get(msg.to); + if (msg.placement === diagObj.db.PLACEMENT.LEFTOF && !actor.prevActor) { + continue; + } + if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF && !actor.nextActor) { + continue; + } + const isNote = msg.placement !== void 0; + const isMessage = !isNote; + const textFont = isNote ? noteFont(conf2) : messageFont2(conf2); + const wrappedMessage = msg.wrap ? utils_default2.wrapLabel(msg.message, conf2.width - 2 * conf2.wrapPadding, textFont) : msg.message; + const messageDimensions = hasKatex(wrappedMessage) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default2.calculateTextDimensions(wrappedMessage, textFont); + const messageWidth = messageDimensions.width + 2 * conf2.wrapPadding; + if (isMessage && msg.from === actor.nextActor) { + maxMessageWidthPerActor[msg.to] = common_default.getMax( + maxMessageWidthPerActor[msg.to] || 0, + messageWidth + ); + } else if (isMessage && msg.from === actor.prevActor) { + maxMessageWidthPerActor[msg.from] = common_default.getMax( + maxMessageWidthPerActor[msg.from] || 0, + messageWidth + ); + } else if (isMessage && msg.from === msg.to) { + maxMessageWidthPerActor[msg.from] = common_default.getMax( + maxMessageWidthPerActor[msg.from] || 0, + messageWidth / 2 + ); + maxMessageWidthPerActor[msg.to] = common_default.getMax( + maxMessageWidthPerActor[msg.to] || 0, + messageWidth / 2 + ); + } else if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) { + maxMessageWidthPerActor[msg.from] = common_default.getMax( + maxMessageWidthPerActor[msg.from] || 0, + messageWidth + ); + } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) { + maxMessageWidthPerActor[actor.prevActor] = common_default.getMax( + maxMessageWidthPerActor[actor.prevActor] || 0, + messageWidth + ); + } else if (msg.placement === diagObj.db.PLACEMENT.OVER) { + if (actor.prevActor) { + maxMessageWidthPerActor[actor.prevActor] = common_default.getMax( + maxMessageWidthPerActor[actor.prevActor] || 0, + messageWidth / 2 + ); + } + if (actor.nextActor) { + maxMessageWidthPerActor[msg.from] = common_default.getMax( + maxMessageWidthPerActor[msg.from] || 0, + messageWidth / 2 + ); + } + } + } + } + log.debug("maxMessageWidthPerActor:", maxMessageWidthPerActor); + return maxMessageWidthPerActor; + } + async function calculateActorMargins(actors2, actorToMessageWidth, boxes) { + let maxHeight = 0; + for (const prop of actors2.keys()) { + const actor = actors2.get(prop); + if (actor.wrap) { + actor.description = utils_default2.wrapLabel( + actor.description, + conf2.width - 2 * conf2.wrapPadding, + actorFont(conf2) + ); + } + const actDims = hasKatex(actor.description) ? await calculateMathMLDimensions(actor.description, getConfig2()) : utils_default2.calculateTextDimensions(actor.description, actorFont(conf2)); + actor.width = actor.wrap ? conf2.width : common_default.getMax(conf2.width, actDims.width + 2 * conf2.wrapPadding); + actor.height = actor.wrap ? common_default.getMax(actDims.height, conf2.height) : conf2.height; + maxHeight = common_default.getMax(maxHeight, actor.height); + } + for (const actorKey in actorToMessageWidth) { + const actor = actors2.get(actorKey); + if (!actor) { + continue; + } + const nextActor = actors2.get(actor.nextActor); + if (!nextActor) { + const messageWidth2 = actorToMessageWidth[actorKey]; + const actorWidth2 = messageWidth2 + conf2.actorMargin - actor.width / 2; + actor.margin = common_default.getMax(actorWidth2, conf2.actorMargin); + continue; + } + const messageWidth = actorToMessageWidth[actorKey]; + const actorWidth = messageWidth + conf2.actorMargin - actor.width / 2 - nextActor.width / 2; + actor.margin = common_default.getMax(actorWidth, conf2.actorMargin); + } + let maxBoxHeight = 0; + boxes.forEach((box) => { + const textFont = messageFont2(conf2); + let totalWidth = box.actorKeys.reduce((total, aKey) => { + return total += actors2.get(aKey).width + (actors2.get(aKey).margin || 0); + }, 0); + const standardBoxPadding = conf2.boxMargin * 8; + totalWidth += standardBoxPadding; + totalWidth -= 2 * conf2.boxTextMargin; + if (box.wrap) { + box.name = utils_default2.wrapLabel(box.name, totalWidth - 2 * conf2.wrapPadding, textFont); + } + const boxMsgDimensions = utils_default2.calculateTextDimensions(box.name, textFont); + maxBoxHeight = common_default.getMax(boxMsgDimensions.height, maxBoxHeight); + const minWidth = common_default.getMax(totalWidth, boxMsgDimensions.width + 2 * conf2.wrapPadding); + box.margin = conf2.boxTextMargin; + if (totalWidth < minWidth) { + const missing = (minWidth - totalWidth) / 2; + box.margin += missing; + } + }); + boxes.forEach((box) => box.textMaxHeight = maxBoxHeight); + return common_default.getMax(maxHeight, conf2.height); + } + var conf2, bounds2, drawNote, drawCentralConnection, messageFont2, noteFont, actorFont, drawMessage, addActorRenderingData, drawActors, drawActorsPopup, setConf3, actorActivations, activationBounds, draw11, getRequiredPopupWidth, buildNoteModel, CENTRAL_CONNECTION_BASE_OFFSET, CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET, hasCentralConnection, calculateCentralConnectionOffset, isReverseArrowType, isBidirectionalArrowType, buildMessageModel, calculateLoopBounds, sequenceRenderer_default; + var init_sequenceRenderer = __esm({ + "src/diagrams/sequence/sequenceRenderer.ts"() { + "use strict"; + init_src32(); + init_svgDraw2(); + init_logger(); + init_common(); + init_common(); + init_svgDrawCommon(); + init_diagramAPI(); + init_assignWithDepth(); + init_utils2(); + init_setupGraphViewbox(); + init_sequenceDb(); + conf2 = {}; + bounds2 = { + data: { + startx: void 0, + stopx: void 0, + starty: void 0, + stopy: void 0 + }, + verticalPos: 0, + sequenceItems: [], + activations: [], + models: { + getHeight: /* @__PURE__ */ __name(function() { + return Math.max.apply( + null, + this.actors.length === 0 ? [0] : this.actors.map((actor) => actor.height || 0) + ) + (this.loops.length === 0 ? 0 : this.loops.map((it) => it.height || 0).reduce((acc, h3) => acc + h3)) + (this.messages.length === 0 ? 0 : this.messages.map((it) => it.height || 0).reduce((acc, h3) => acc + h3)) + (this.notes.length === 0 ? 0 : this.notes.map((it) => it.height || 0).reduce((acc, h3) => acc + h3)); + }, "getHeight"), + clear: /* @__PURE__ */ __name(function() { + this.actors = []; + this.boxes = []; + this.loops = []; + this.messages = []; + this.notes = []; + }, "clear"), + addBox: /* @__PURE__ */ __name(function(boxModel) { + this.boxes.push(boxModel); + }, "addBox"), + addActor: /* @__PURE__ */ __name(function(actorModel) { + this.actors.push(actorModel); + }, "addActor"), + addLoop: /* @__PURE__ */ __name(function(loopModel) { + this.loops.push(loopModel); + }, "addLoop"), + addMessage: /* @__PURE__ */ __name(function(msgModel) { + this.messages.push(msgModel); + }, "addMessage"), + addNote: /* @__PURE__ */ __name(function(noteModel) { + this.notes.push(noteModel); + }, "addNote"), + lastActor: /* @__PURE__ */ __name(function() { + return this.actors[this.actors.length - 1]; + }, "lastActor"), + lastLoop: /* @__PURE__ */ __name(function() { + return this.loops[this.loops.length - 1]; + }, "lastLoop"), + lastMessage: /* @__PURE__ */ __name(function() { + return this.messages[this.messages.length - 1]; + }, "lastMessage"), + lastNote: /* @__PURE__ */ __name(function() { + return this.notes[this.notes.length - 1]; + }, "lastNote"), + actors: [], + boxes: [], + loops: [], + messages: [], + notes: [] + }, + init: /* @__PURE__ */ __name(function() { + this.sequenceItems = []; + this.activations = []; + this.models.clear(); + this.data = { + startx: void 0, + stopx: void 0, + starty: void 0, + stopy: void 0 + }; + this.verticalPos = 0; + setConf3(getConfig2()); + }, "init"), + updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) { + if (obj[key] === void 0) { + obj[key] = val; + } else { + obj[key] = fun(val, obj[key]); + } + }, "updateVal"), + updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) { + const _self = this; + let cnt4 = 0; + function updateFn(type3) { + return /* @__PURE__ */ __name(function updateItemBounds(item) { + cnt4++; + const n2 = _self.sequenceItems.length - cnt4 + 1; + _self.updateVal(item, "starty", starty - n2 * conf2.boxMargin, Math.min); + _self.updateVal(item, "stopy", stopy + n2 * conf2.boxMargin, Math.max); + _self.updateVal(bounds2.data, "startx", startx - n2 * conf2.boxMargin, Math.min); + _self.updateVal(bounds2.data, "stopx", stopx + n2 * conf2.boxMargin, Math.max); + if (!(type3 === "activation")) { + _self.updateVal(item, "startx", startx - n2 * conf2.boxMargin, Math.min); + _self.updateVal(item, "stopx", stopx + n2 * conf2.boxMargin, Math.max); + _self.updateVal(bounds2.data, "starty", starty - n2 * conf2.boxMargin, Math.min); + _self.updateVal(bounds2.data, "stopy", stopy + n2 * conf2.boxMargin, Math.max); + } + }, "updateItemBounds"); + } + __name(updateFn, "updateFn"); + this.sequenceItems.forEach(updateFn()); + this.activations.forEach(updateFn("activation")); + }, "updateBounds"), + insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) { + const _startx = common_default.getMin(startx, stopx); + const _stopx = common_default.getMax(startx, stopx); + const _starty = common_default.getMin(starty, stopy); + const _stopy = common_default.getMax(starty, stopy); + this.updateVal(bounds2.data, "startx", _startx, Math.min); + this.updateVal(bounds2.data, "starty", _starty, Math.min); + this.updateVal(bounds2.data, "stopx", _stopx, Math.max); + this.updateVal(bounds2.data, "stopy", _stopy, Math.max); + this.updateBounds(_startx, _starty, _stopx, _stopy); + }, "insert"), + newActivation: /* @__PURE__ */ __name(function(message, diagram32, actors2) { + const actorRect = actors2.get(message.from); + const stackedSize = actorActivations(message.from).length || 0; + const x5 = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf2.activationWidth / 2; + this.activations.push({ + startx: x5, + starty: this.verticalPos + 2, + stopx: x5 + conf2.activationWidth, + stopy: void 0, + actor: message.from, + anchored: svgDraw_default2.anchorElement(diagram32) + }); + }, "newActivation"), + endActivation: /* @__PURE__ */ __name(function(message) { + const lastActorActivationIdx = this.activations.map(function(activation) { + return activation.actor; + }).lastIndexOf(message.from); + return this.activations.splice(lastActorActivationIdx, 1)[0]; + }, "endActivation"), + createLoop: /* @__PURE__ */ __name(function(title2 = { message: void 0, wrap: false, width: void 0 }, fill) { + return { + startx: void 0, + starty: this.verticalPos, + stopx: void 0, + stopy: void 0, + title: title2.message, + wrap: title2.wrap, + width: title2.width, + height: 0, + fill + }; + }, "createLoop"), + newLoop: /* @__PURE__ */ __name(function(title2 = { message: void 0, wrap: false, width: void 0 }, fill) { + this.sequenceItems.push(this.createLoop(title2, fill)); + }, "newLoop"), + endLoop: /* @__PURE__ */ __name(function() { + return this.sequenceItems.pop(); + }, "endLoop"), + isLoopOverlap: /* @__PURE__ */ __name(function() { + return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : false; + }, "isLoopOverlap"), + addSectionToLoop: /* @__PURE__ */ __name(function(message) { + const loop = this.sequenceItems.pop(); + loop.sections = loop.sections || []; + loop.sectionTitles = loop.sectionTitles || []; + loop.sections.push({ y: bounds2.getVerticalPos(), height: 0 }); + loop.sectionTitles.push(message); + this.sequenceItems.push(loop); + }, "addSectionToLoop"), + saveVerticalPos: /* @__PURE__ */ __name(function() { + if (this.isLoopOverlap()) { + this.savedVerticalPos = this.verticalPos; + } + }, "saveVerticalPos"), + resetVerticalPos: /* @__PURE__ */ __name(function() { + if (this.isLoopOverlap()) { + this.verticalPos = this.savedVerticalPos; + } + }, "resetVerticalPos"), + bumpVerticalPos: /* @__PURE__ */ __name(function(bump) { + this.verticalPos = this.verticalPos + bump; + this.data.stopy = common_default.getMax(this.data.stopy, this.verticalPos); + }, "bumpVerticalPos"), + getVerticalPos: /* @__PURE__ */ __name(function() { + return this.verticalPos; + }, "getVerticalPos"), + getBounds: /* @__PURE__ */ __name(function() { + return { bounds: this.data, models: this.models }; + }, "getBounds") + }; + drawNote = /* @__PURE__ */ __name(async function(elem, noteModel, id35) { + bounds2.bumpVerticalPos(conf2.boxMargin); + noteModel.height = conf2.boxMargin; + noteModel.starty = bounds2.getVerticalPos(); + const rect3 = getNoteRect(); + rect3.x = noteModel.startx; + rect3.y = noteModel.starty; + rect3.width = noteModel.width || conf2.width; + rect3.class = "note"; + const g2 = elem.append("g"); + g2.attr("data-et", "note"); + g2.attr("data-id", "i" + id35); + const rectElem = svgDraw_default2.drawRect(g2, rect3); + const textObj = getTextObj(); + textObj.x = noteModel.startx; + textObj.y = noteModel.starty; + textObj.width = rect3.width; + textObj.dy = "1em"; + textObj.text = noteModel.message; + textObj.class = "noteText"; + textObj.fontFamily = conf2.noteFontFamily; + textObj.fontSize = conf2.noteFontSize; + textObj.fontWeight = conf2.noteFontWeight; + textObj.anchor = conf2.noteAlign; + textObj.textMargin = conf2.noteMargin; + textObj.valign = "center"; + const textElem = hasKatex(textObj.text) ? await drawKatex(g2, textObj) : drawText3(g2, textObj); + const textHeight = Math.round( + textElem.map((te) => (te._groups || te)[0][0].getBBox().height).reduce((acc, curr) => acc + curr) + ); + rectElem.attr("height", textHeight + 2 * conf2.noteMargin); + noteModel.height += textHeight + 2 * conf2.noteMargin; + bounds2.bumpVerticalPos(textHeight + 2 * conf2.noteMargin); + noteModel.stopy = noteModel.starty + textHeight + 2 * conf2.noteMargin; + noteModel.stopx = noteModel.startx + rect3.width; + bounds2.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy); + bounds2.models.addNote(noteModel); + }, "drawNote"); + drawCentralConnection = /* @__PURE__ */ __name(function(elem, msg, msgModel, diagObj, startx, stopx, lineStartY) { + const actors2 = diagObj.db.getActors(); + const fromActor = actors2.get(msg.from); + const toActor = actors2.get(msg.to); + const isAutoNumberOn = msgModel.sequenceVisible; + let fromCenter = fromActor.x + fromActor.width / 2; + let toCenter = toActor.x + toActor.width / 2; + const isLeftToRight = fromCenter <= toCenter; + const isReverse = isReverseArrowType(msg, diagObj); + const g2 = elem.append("g"); + const CENTRAL_CONNECTION_CIRCLE_OFFSET = 16.5; + const getCircleOffset = /* @__PURE__ */ __name((isLeftToRight2, isReverse2) => { + const baseOffset = isLeftToRight2 ? CENTRAL_CONNECTION_CIRCLE_OFFSET : -CENTRAL_CONNECTION_CIRCLE_OFFSET; + return isReverse2 ? -baseOffset : baseOffset; + }, "getCircleOffset"); + const drawCircle3 = /* @__PURE__ */ __name((cx) => { + g2.append("circle").attr("cx", cx).attr("cy", lineStartY).attr("r", 5).attr("width", 10).attr("height", 10); + }, "drawCircle"); + const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE; + if (isAutoNumberOn) { + switch (msg.centralConnection) { + case CENTRAL_CONNECTION: + if (isReverse) { + toCenter += getCircleOffset(isLeftToRight, true); + } + break; + case CENTRAL_CONNECTION_REVERSE: + if (!isReverse) { + fromCenter += getCircleOffset(isLeftToRight, false); + } + break; + case CENTRAL_CONNECTION_DUAL: + if (isReverse) { + toCenter += getCircleOffset(isLeftToRight, true); + } else { + fromCenter += getCircleOffset(isLeftToRight, false); + } + break; + } + } + switch (msg.centralConnection) { + case CENTRAL_CONNECTION: + drawCircle3(toCenter); + break; + case CENTRAL_CONNECTION_REVERSE: + drawCircle3(fromCenter); + break; + case CENTRAL_CONNECTION_DUAL: + drawCircle3(fromCenter); + drawCircle3(toCenter); + break; + } + }, "drawCentralConnection"); + messageFont2 = /* @__PURE__ */ __name((cnf) => { + return { + fontFamily: cnf.messageFontFamily, + fontSize: cnf.messageFontSize, + fontWeight: cnf.messageFontWeight + }; + }, "messageFont"); + noteFont = /* @__PURE__ */ __name((cnf) => { + return { + fontFamily: cnf.noteFontFamily, + fontSize: cnf.noteFontSize, + fontWeight: cnf.noteFontWeight + }; + }, "noteFont"); + actorFont = /* @__PURE__ */ __name((cnf) => { + return { + fontFamily: cnf.actorFontFamily, + fontSize: cnf.actorFontSize, + fontWeight: cnf.actorFontWeight + }; + }, "actorFont"); + __name(boundMessage, "boundMessage"); + drawMessage = /* @__PURE__ */ __name(async function(diagram32, msgModel, lineStartY, diagObj, msg, diagramId3) { + const { startx, stopx, starty, message, type: type3, sequenceIndex, sequenceVisible } = msgModel; + const textDims = utils_default2.calculateTextDimensions(message, messageFont2(conf2)); + const textObj = getTextObj(); + textObj.x = Math.min(startx, stopx); + textObj.y = starty + 10; + textObj.width = Math.abs(stopx - startx); + textObj.class = "messageText"; + textObj.dy = "1em"; + textObj.text = message; + textObj.fontFamily = conf2.messageFontFamily; + textObj.fontSize = conf2.messageFontSize; + textObj.fontWeight = conf2.messageFontWeight; + textObj.anchor = conf2.messageAlign; + textObj.valign = "center"; + textObj.textMargin = conf2.wrapPadding; + textObj.tspan = false; + if (hasKatex(textObj.text)) { + await drawKatex(diagram32, textObj, { startx, stopx, starty: lineStartY }); + } else { + drawText3(diagram32, textObj); + } + const textWidth = textDims.width; + let line2; + if (startx === stopx) { + const isAutoNumberOn = sequenceVisible || conf2.showSequenceNumbers; + const isReverse = isReverseArrowType(msg, diagObj); + const isBidirectional = isBidirectionalArrowType(msg, diagObj); + const lineStartX = startx + (isAutoNumberOn && (isReverse || isBidirectional) ? 10 : 0); + if (conf2.rightAngles) { + line2 = diagram32.append("path").attr( + "d", + `M ${lineStartX},${lineStartY} H ${startx + common_default.getMax(conf2.width / 2, textWidth / 2)} V ${lineStartY + 25} H ${startx}` + ); + } else { + line2 = diagram32.append("path").attr( + "d", + "M " + lineStartX + "," + lineStartY + " C " + (lineStartX + 60) + "," + (lineStartY - 10) + " " + (startx + 60) + "," + (lineStartY + 30) + " " + startx + "," + (lineStartY + 20) + ); + } + if (hasCentralConnection(msg, diagObj)) { + drawCentralConnection(diagram32, msg, msgModel, diagObj, startx, stopx, lineStartY); + } + } else { + line2 = diagram32.append("line"); + line2.attr("x1", startx); + line2.attr("y1", lineStartY); + line2.attr("x2", stopx); + line2.attr("y2", lineStartY); + if (hasCentralConnection(msg, diagObj)) { + drawCentralConnection(diagram32, msg, msgModel, diagObj, startx, stopx, lineStartY); + } + } + if (type3 === diagObj.db.LINETYPE.DOTTED || type3 === diagObj.db.LINETYPE.DOTTED_CROSS || type3 === diagObj.db.LINETYPE.DOTTED_POINT || type3 === diagObj.db.LINETYPE.DOTTED_OPEN || type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_TOP_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED || type3 === diagObj.db.LINETYPE.STICK_TOP_DOTTED || type3 === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) { + line2.style("stroke-dasharray", "3, 3"); + line2.attr("class", "messageLine1"); + } else { + line2.attr("class", "messageLine0"); + } + line2.attr("data-et", "message"); + line2.attr("data-id", "i" + msgModel.id); + line2.attr("data-from", msgModel.from); + line2.attr("data-to", msgModel.to); + let url = ""; + if (conf2.arrowMarkerAbsolute) { + url = getUrl(true); + } + line2.attr("stroke-width", 2); + line2.attr("stroke", "none"); + line2.style("fill", "none"); + if (type3 === diagObj.db.LINETYPE.SOLID_TOP || type3 === diagObj.db.LINETYPE.SOLID_TOP_DOTTED) { + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-solidTopArrowHead)"); + } + if (type3 === diagObj.db.LINETYPE.SOLID_BOTTOM || type3 === diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED) { + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-solidBottomArrowHead)"); + } + if (type3 === diagObj.db.LINETYPE.STICK_TOP || type3 === diagObj.db.LINETYPE.STICK_TOP_DOTTED) { + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-stickTopArrowHead)"); + } + if (type3 === diagObj.db.LINETYPE.STICK_BOTTOM || type3 === diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED) { + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-stickBottomArrowHead)"); + } + if (type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED) { + line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-solidBottomArrowHead)"); + } + if (type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED) { + line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-solidTopArrowHead)"); + } + if (type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED) { + line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-stickBottomArrowHead)"); + } + if (type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED) { + line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-stickTopArrowHead)"); + } + if (type3 === diagObj.db.LINETYPE.SOLID || type3 === diagObj.db.LINETYPE.DOTTED) { + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-arrowhead)"); + } + if (type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) { + line2.attr("marker-start", "url(" + url + "#" + diagramId3 + "-arrowhead)"); + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-arrowhead)"); + } + if (type3 === diagObj.db.LINETYPE.SOLID_POINT || type3 === diagObj.db.LINETYPE.DOTTED_POINT) { + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-filled-head)"); + } + if (type3 === diagObj.db.LINETYPE.SOLID_CROSS || type3 === diagObj.db.LINETYPE.DOTTED_CROSS) { + line2.attr("marker-end", "url(" + url + "#" + diagramId3 + "-crosshead)"); + } + if (sequenceVisible || conf2.showSequenceNumbers) { + const isBidirectional = type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || type3 === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED; + const isReverseArrowType2 = type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE || type3 === diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE || type3 === diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE || type3 === diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED || type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE || type3 === diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED; + const SEQUENCE_NUMBER_RADIUS = 6; + const hasCentralConn = hasCentralConnection(msg, diagObj); + let lineStartX = startx; + let lineStopX = stopx; + if (isBidirectional) { + if (startx < stopx) { + lineStartX = startx + SEQUENCE_NUMBER_RADIUS * 2; + } else { + lineStartX = startx - SEQUENCE_NUMBER_RADIUS + (hasCentralConn ? -5 : 0); + lineStartX += msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0; + } + line2.attr("x1", lineStartX); + } else if (isReverseArrowType2) { + if (stopx > startx) { + lineStopX = stopx - 2 * SEQUENCE_NUMBER_RADIUS; + } else { + lineStopX = stopx - SEQUENCE_NUMBER_RADIUS; + lineStartX += msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_DUAL || msg?.centralConnection === diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE ? -7.5 : 0; + } + lineStopX += hasCentralConn ? 15 : 0; + line2.attr("x2", lineStopX); + line2.attr("x1", lineStartX); + } else { + line2.attr("x1", startx + SEQUENCE_NUMBER_RADIUS); + } + let autonumberX = 0; + const isSelfMessage = startx === stopx; + const isLeftToRight = startx <= stopx; + if (isSelfMessage) { + autonumberX = msgModel.fromBounds + 1; + } else if (isReverseArrowType2) { + autonumberX = isLeftToRight ? msgModel.toBounds - 1 : msgModel.fromBounds + 1; + } else { + autonumberX = isLeftToRight ? msgModel.fromBounds + 1 : msgModel.toBounds - 1; + } + let fontSize = "12px"; + const sequenceIndexLength = sequenceIndex.toString().length; + if (sequenceIndexLength > 5) { + fontSize = "7px"; + } else if (sequenceIndexLength > 3) { + fontSize = "9px"; + } + diagram32.append("line").attr("x1", autonumberX).attr("y1", lineStartY).attr("x2", autonumberX).attr("y2", lineStartY).attr("stroke-width", 0).attr("marker-start", "url(" + url + "#" + diagramId3 + "-sequencenumber)"); + diagram32.append("text").attr("x", autonumberX).attr("y", lineStartY + 4).attr("font-family", "sans-serif").attr("font-size", fontSize).attr("text-anchor", "middle").attr("class", "sequenceNumber").text(sequenceIndex); + } + }, "drawMessage"); + addActorRenderingData = /* @__PURE__ */ __name(function(diagram32, actors2, createdActors, actorKeys, verticalPos, messages, isFooter) { + let prevWidth = 0; + let prevMargin = 0; + let prevBox = void 0; + let maxHeight = 0; + for (const actorKey of actorKeys) { + const actor = actors2.get(actorKey); + const box = actor.box; + if (prevBox && prevBox != box) { + if (!isFooter) { + bounds2.models.addBox(prevBox); + } + prevMargin += conf2.boxMargin + prevBox.margin; + } + if (box && box != prevBox) { + if (!isFooter) { + box.x = prevWidth + prevMargin; + box.y = verticalPos; + } + prevMargin += box.margin; + } + actor.width = common_default.getMax(actor.width || conf2.width, conf2.width); + actor.height = common_default.getMax(actor.height || conf2.height, conf2.height); + actor.margin = actor.margin || conf2.actorMargin; + maxHeight = common_default.getMax(maxHeight, actor.height); + if (createdActors.get(actor.name)) { + prevMargin += actor.width / 2; + } + actor.x = prevWidth + prevMargin; + actor.starty = bounds2.getVerticalPos(); + bounds2.insert(actor.x, verticalPos, actor.x + actor.width, actor.height); + prevWidth += actor.width + prevMargin; + if (actor.box) { + actor.box.width = prevWidth + box.margin - actor.box.x; + } + prevMargin = actor.margin; + prevBox = actor.box; + bounds2.models.addActor(actor); + } + if (prevBox && !isFooter) { + bounds2.models.addBox(prevBox); + } + bounds2.bumpVerticalPos(maxHeight); + }, "addActorRenderingData"); + drawActors = /* @__PURE__ */ __name(async function(diagram32, actors2, actorKeys, isFooter, diagramId3, diagObj, actorIndexMap) { + if (!isFooter) { + for (const actorKey of actorKeys) { + const actor = actors2.get(actorKey); + await svgDraw_default2.drawActor(diagram32, actor, conf2, false, diagramId3, diagObj, actorIndexMap); + } + } else { + let maxHeight = 0; + bounds2.bumpVerticalPos(conf2.boxMargin * 2); + for (const actorKey of actorKeys) { + const actor = actors2.get(actorKey); + if (!actor.stopy) { + actor.stopy = bounds2.getVerticalPos(); + } + const height2 = await svgDraw_default2.drawActor( + diagram32, + actor, + conf2, + true, + diagramId3, + diagObj, + actorIndexMap + ); + maxHeight = common_default.getMax(maxHeight, height2); + } + bounds2.bumpVerticalPos(maxHeight + conf2.boxMargin); + } + }, "drawActors"); + drawActorsPopup = /* @__PURE__ */ __name(function(diagram32, actors2, actorKeys, doc) { + let maxHeight = 0; + let maxWidth2 = 0; + for (const actorKey of actorKeys) { + const actor = actors2.get(actorKey); + const minMenuWidth = getRequiredPopupWidth(actor); + const menuDimensions = svgDraw_default2.drawPopup( + diagram32, + actor, + minMenuWidth, + conf2, + conf2.forceMenus, + doc + ); + if (menuDimensions.height > maxHeight) { + maxHeight = menuDimensions.height; + } + if (menuDimensions.width + actor.x > maxWidth2) { + maxWidth2 = menuDimensions.width + actor.x; + } + } + return { maxHeight, maxWidth: maxWidth2 }; + }, "drawActorsPopup"); + setConf3 = /* @__PURE__ */ __name(function(cnf) { + assignWithDepth_default(conf2, cnf); + if (cnf.fontFamily) { + conf2.actorFontFamily = conf2.noteFontFamily = conf2.messageFontFamily = cnf.fontFamily; + } + if (cnf.fontSize) { + conf2.actorFontSize = conf2.noteFontSize = conf2.messageFontSize = cnf.fontSize; + } + if (cnf.fontWeight) { + conf2.actorFontWeight = conf2.noteFontWeight = conf2.messageFontWeight = cnf.fontWeight; + } + }, "setConf"); + actorActivations = /* @__PURE__ */ __name(function(actor) { + return bounds2.activations.filter(function(activation) { + return activation.actor === actor; + }); + }, "actorActivations"); + activationBounds = /* @__PURE__ */ __name(function(actor, actors2) { + const actorObj = actors2.get(actor); + const activations = actorActivations(actor); + const left3 = activations.reduce( + function(acc, activation) { + return common_default.getMin(acc, activation.startx); + }, + actorObj.x + actorObj.width / 2 - 1 + ); + const right3 = activations.reduce( + function(acc, activation) { + return common_default.getMax(acc, activation.stopx); + }, + actorObj.x + actorObj.width / 2 + 1 + ); + return [left3, right3]; + }, "activationBounds"); + __name(adjustLoopHeightForWrap, "adjustLoopHeightForWrap"); + __name(adjustCreatedDestroyedData, "adjustCreatedDestroyedData"); + draw11 = /* @__PURE__ */ __name(async function(_text, id35, _version, diagObj) { + const { securityLevel, sequence, look } = getConfig2(); + conf2 = sequence; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document; + bounds2.init(); + log.debug(diagObj.db); + const diagram32 = securityLevel === "sandbox" ? root4.select(`[id="${id35}"]`) : select_default2(`[id="${id35}"]`); + const actors2 = diagObj.db.getActors(); + const createdActors = diagObj.db.getCreatedActors(); + const destroyedActors = diagObj.db.getDestroyedActors(); + const boxes = diagObj.db.getBoxes(); + let actorKeys = diagObj.db.getActorKeys(); + const messages = diagObj.db.getMessages(); + const title2 = diagObj.db.getDiagramTitle(); + const hasBoxes = diagObj.db.hasAtLeastOneBox(); + const hasBoxTitles = diagObj.db.hasAtLeastOneBoxWithTitle(); + const maxMessageWidthPerActor = await getMaxMessageWidthPerActor(actors2, messages, diagObj); + conf2.height = await calculateActorMargins(actors2, maxMessageWidthPerActor, boxes); + svgDraw_default2.insertComputerIcon(diagram32, id35); + svgDraw_default2.insertDatabaseIcon(diagram32, id35); + svgDraw_default2.insertClockIcon(diagram32, id35); + if (hasBoxes) { + bounds2.bumpVerticalPos(conf2.boxMargin); + if (hasBoxTitles) { + bounds2.bumpVerticalPos(boxes[0].textMaxHeight); + } + } + if (conf2.hideUnusedParticipants === true) { + const newActors = /* @__PURE__ */ new Set(); + messages.forEach((message) => { + newActors.add(message.from); + newActors.add(message.to); + }); + actorKeys = actorKeys.filter((actorKey) => newActors.has(actorKey)); + } + const actorIndexMap = new Map( + actorKeys.map((actorKey, index2) => [actors2.get(actorKey)?.name ?? actorKey, index2]) + ); + addActorRenderingData(diagram32, actors2, createdActors, actorKeys, 0, messages, false); + const loopWidths = await calculateLoopBounds(messages, actors2, maxMessageWidthPerActor, diagObj); + svgDraw_default2.insertArrowHead(diagram32, id35); + svgDraw_default2.insertArrowCrossHead(diagram32, id35); + svgDraw_default2.insertArrowFilledHead(diagram32, id35); + svgDraw_default2.insertSequenceNumber(diagram32, id35); + svgDraw_default2.insertSolidTopArrowHead(diagram32, id35); + svgDraw_default2.insertSolidBottomArrowHead(diagram32, id35); + svgDraw_default2.insertStickTopArrowHead(diagram32, id35); + svgDraw_default2.insertStickBottomArrowHead(diagram32, id35); + if (look === "neo") { + svgDraw_default2.insertDropShadow(diagram32, conf2); + } + function activeEnd(msg, verticalPos) { + const activationData = bounds2.endActivation(msg); + if (activationData.starty + 18 > verticalPos) { + activationData.starty = verticalPos - 6; + verticalPos += 12; + } + svgDraw_default2.drawActivation( + diagram32, + activationData, + verticalPos, + conf2, + actorActivations(msg.from).length, + diagObj, + actorIndexMap + ); + bounds2.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos); + } + __name(activeEnd, "activeEnd"); + let sequenceIndex = 1; + let sequenceIndexStep = 1; + const messagesToDraw = []; + const backgrounds = []; + let index = 0; + for (const msg of messages) { + let loopModel, noteModel, msgModel; + switch (msg.type) { + case diagObj.db.LINETYPE.NOTE: + bounds2.resetVerticalPos(); + noteModel = msg.noteModel; + await drawNote(diagram32, noteModel, msg.id); + break; + case diagObj.db.LINETYPE.ACTIVE_START: + bounds2.newActivation(msg, diagram32, actors2); + break; + case diagObj.db.LINETYPE.CENTRAL_CONNECTION: + bounds2.newActivation(msg, diagram32, actors2); + break; + case diagObj.db.LINETYPE.CENTRAL_CONNECTION_REVERSE: + bounds2.newActivation(msg, diagram32, actors2); + break; + case diagObj.db.LINETYPE.ACTIVE_END: + activeEnd(msg, bounds2.getVerticalPos()); + break; + case diagObj.db.LINETYPE.LOOP_START: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin, + conf2.boxMargin + conf2.boxTextMargin, + (message) => bounds2.newLoop(message) + ); + break; + case diagObj.db.LINETYPE.LOOP_END: + loopModel = bounds2.endLoop(); + await svgDraw_default2.drawLoop(diagram32, loopModel, "loop", conf2, msg); + bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos()); + bounds2.models.addLoop(loopModel); + break; + case diagObj.db.LINETYPE.RECT_START: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin, + conf2.boxMargin, + (message) => bounds2.newLoop(void 0, message.message) + ); + break; + case diagObj.db.LINETYPE.RECT_END: + loopModel = bounds2.endLoop(); + backgrounds.push(loopModel); + bounds2.models.addLoop(loopModel); + bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos()); + break; + case diagObj.db.LINETYPE.OPT_START: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin, + conf2.boxMargin + conf2.boxTextMargin, + (message) => bounds2.newLoop(message) + ); + break; + case diagObj.db.LINETYPE.OPT_END: + loopModel = bounds2.endLoop(); + await svgDraw_default2.drawLoop(diagram32, loopModel, "opt", conf2, msg); + bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos()); + bounds2.models.addLoop(loopModel); + break; + case diagObj.db.LINETYPE.ALT_START: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin, + conf2.boxMargin + conf2.boxTextMargin, + (message) => bounds2.newLoop(message) + ); + break; + case diagObj.db.LINETYPE.ALT_ELSE: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin + conf2.boxTextMargin, + conf2.boxMargin, + (message) => bounds2.addSectionToLoop(message) + ); + break; + case diagObj.db.LINETYPE.ALT_END: + loopModel = bounds2.endLoop(); + await svgDraw_default2.drawLoop(diagram32, loopModel, "alt", conf2, msg); + bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos()); + bounds2.models.addLoop(loopModel); + break; + case diagObj.db.LINETYPE.PAR_START: + case diagObj.db.LINETYPE.PAR_OVER_START: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin, + conf2.boxMargin + conf2.boxTextMargin, + (message) => bounds2.newLoop(message) + ); + bounds2.saveVerticalPos(); + break; + case diagObj.db.LINETYPE.PAR_AND: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin + conf2.boxTextMargin, + conf2.boxMargin, + (message) => bounds2.addSectionToLoop(message) + ); + break; + case diagObj.db.LINETYPE.PAR_END: + loopModel = bounds2.endLoop(); + await svgDraw_default2.drawLoop(diagram32, loopModel, "par", conf2, msg); + bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos()); + bounds2.models.addLoop(loopModel); + break; + case diagObj.db.LINETYPE.AUTONUMBER: + sequenceIndex = msg.message.start || sequenceIndex; + sequenceIndexStep = msg.message.step || sequenceIndexStep; + if (msg.message.visible) { + diagObj.db.enableSequenceNumbers(); + } else { + diagObj.db.disableSequenceNumbers(); + } + break; + case diagObj.db.LINETYPE.CRITICAL_START: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin, + conf2.boxMargin + conf2.boxTextMargin, + (message) => bounds2.newLoop(message) + ); + break; + case diagObj.db.LINETYPE.CRITICAL_OPTION: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin + conf2.boxTextMargin, + conf2.boxMargin, + (message) => bounds2.addSectionToLoop(message) + ); + break; + case diagObj.db.LINETYPE.CRITICAL_END: + loopModel = bounds2.endLoop(); + await svgDraw_default2.drawLoop(diagram32, loopModel, "critical", conf2, msg); + bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos()); + bounds2.models.addLoop(loopModel); + break; + case diagObj.db.LINETYPE.BREAK_START: + adjustLoopHeightForWrap( + loopWidths, + msg, + conf2.boxMargin, + conf2.boxMargin + conf2.boxTextMargin, + (message) => bounds2.newLoop(message) + ); + break; + case diagObj.db.LINETYPE.BREAK_END: + loopModel = bounds2.endLoop(); + await svgDraw_default2.drawLoop(diagram32, loopModel, "break", conf2, msg); + bounds2.bumpVerticalPos(loopModel.stopy - bounds2.getVerticalPos()); + bounds2.models.addLoop(loopModel); + break; + default: + try { + msgModel = msg.msgModel; + msgModel.starty = bounds2.getVerticalPos(); + msgModel.sequenceIndex = sequenceIndex; + msgModel.sequenceVisible = diagObj.db.showSequenceNumbers(); + msgModel.id = msg.id; + msgModel.from = msg.from; + msgModel.to = msg.to; + const lineStartY = await boundMessage(diagram32, msgModel); + adjustCreatedDestroyedData( + msg, + msgModel, + lineStartY, + index, + actors2, + createdActors, + destroyedActors + ); + messagesToDraw.push({ messageModel: msgModel, lineStartY, msg }); + bounds2.models.addMessage(msgModel); + } catch (e3) { + log.error("error while drawing message", e3); + } + } + if ([ + diagObj.db.LINETYPE.SOLID_OPEN, + diagObj.db.LINETYPE.DOTTED_OPEN, + diagObj.db.LINETYPE.SOLID, + diagObj.db.LINETYPE.SOLID_TOP, + diagObj.db.LINETYPE.SOLID_BOTTOM, + diagObj.db.LINETYPE.STICK_TOP, + diagObj.db.LINETYPE.STICK_BOTTOM, + diagObj.db.LINETYPE.SOLID_TOP_DOTTED, + diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED, + diagObj.db.LINETYPE.STICK_TOP_DOTTED, + diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE, + diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE, + diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE, + diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE, + diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED, + diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED, + diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED, + diagObj.db.LINETYPE.DOTTED, + diagObj.db.LINETYPE.SOLID_CROSS, + diagObj.db.LINETYPE.DOTTED_CROSS, + diagObj.db.LINETYPE.SOLID_POINT, + diagObj.db.LINETYPE.DOTTED_POINT, + diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID, + diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED + ].includes(msg.type)) { + sequenceIndex = Math.round((sequenceIndex + sequenceIndexStep) * 100) / 100; + } + index++; + } + log.debug("createdActors", createdActors); + log.debug("destroyedActors", destroyedActors); + await drawActors(diagram32, actors2, actorKeys, false, id35, diagObj, actorIndexMap); + for (const e3 of messagesToDraw) { + await drawMessage(diagram32, e3.messageModel, e3.lineStartY, diagObj, e3.msg, id35); + } + if (conf2.mirrorActors) { + await drawActors(diagram32, actors2, actorKeys, true, id35, diagObj, actorIndexMap); + } + backgrounds.forEach((e3) => svgDraw_default2.drawBackgroundRect(diagram32, e3)); + fixLifeLineHeights(diagram32, actors2, actorKeys, conf2); + for (const box2 of bounds2.models.boxes) { + box2.height = bounds2.getVerticalPos() - box2.y; + bounds2.insert(box2.x, box2.y, box2.x + box2.width, box2.height); + const boxPadding = conf2.boxMargin * 2; + box2.startx = box2.x - boxPadding; + box2.starty = box2.y - boxPadding * 0.25; + box2.stopx = box2.startx + box2.width + 2 * boxPadding; + box2.stopy = box2.starty + box2.height + boxPadding * 0.75; + box2.stroke = "rgb(0,0,0, 0.5)"; + svgDraw_default2.drawBox(diagram32, box2, conf2); + } + if (hasBoxes) { + bounds2.bumpVerticalPos(conf2.boxMargin); + } + const requiredBoxSize = drawActorsPopup(diagram32, actors2, actorKeys, doc); + const { bounds: box } = bounds2.getBounds(); + if (box.startx === void 0) { + box.startx = 0; + } + if (box.starty === void 0) { + box.starty = 0; + } + if (box.stopx === void 0) { + box.stopx = 0; + } + if (box.stopy === void 0) { + box.stopy = 0; + } + let boxHeight = box.stopy - box.starty; + if (boxHeight < requiredBoxSize.maxHeight) { + boxHeight = requiredBoxSize.maxHeight; + } + let height2 = boxHeight + 2 * conf2.diagramMarginY; + if (conf2.mirrorActors) { + height2 = height2 - conf2.boxMargin + conf2.bottomMarginAdj; + } + let boxWidth = box.stopx - box.startx; + if (boxWidth < requiredBoxSize.maxWidth) { + boxWidth = requiredBoxSize.maxWidth; + } + const width3 = boxWidth + 2 * conf2.diagramMarginX; + if (title2) { + diagram32.append("text").text(title2).attr("x", (box.stopx - box.startx) / 2 - 2 * conf2.diagramMarginX).attr("y", -25); + } + configureSvgSize(diagram32, height2, width3, conf2.useMaxWidth); + const extraVertForTitle = title2 ? 40 : 0; + const extraHeightForNeoActors = actors2.size && look === "neo" ? 30 : 0; + diagram32.attr( + "viewBox", + box.startx - conf2.diagramMarginX + " -" + (conf2.diagramMarginY + extraVertForTitle) + " " + width3 + " " + (height2 + extraVertForTitle + extraHeightForNeoActors) + ); + log.debug(`models:`, bounds2.models); + }, "draw"); + __name(getMaxMessageWidthPerActor, "getMaxMessageWidthPerActor"); + getRequiredPopupWidth = /* @__PURE__ */ __name(function(actor) { + let requiredPopupWidth = 0; + const textFont = actorFont(conf2); + for (const key in actor.links) { + const labelDimensions = utils_default2.calculateTextDimensions(key, textFont); + const labelWidth = labelDimensions.width + 2 * conf2.wrapPadding + 2 * conf2.boxMargin; + if (requiredPopupWidth < labelWidth) { + requiredPopupWidth = labelWidth; + } + } + return requiredPopupWidth; + }, "getRequiredPopupWidth"); + __name(calculateActorMargins, "calculateActorMargins"); + buildNoteModel = /* @__PURE__ */ __name(async function(msg, actors2, diagObj) { + const fromActor = actors2.get(msg.from); + const toActor = actors2.get(msg.to); + const startx = fromActor.x; + const stopx = toActor.x; + const shouldWrap = msg.wrap && msg.message; + let textDimensions = hasKatex(msg.message) ? await calculateMathMLDimensions(msg.message, getConfig2()) : utils_default2.calculateTextDimensions( + shouldWrap ? utils_default2.wrapLabel(msg.message, conf2.width, noteFont(conf2)) : msg.message, + noteFont(conf2) + ); + const noteModel = { + width: shouldWrap ? conf2.width : common_default.getMax(conf2.width, textDimensions.width + 2 * conf2.noteMargin), + height: 0, + startx: fromActor.x, + stopx: 0, + starty: 0, + stopy: 0, + message: msg.message + }; + if (msg.placement === diagObj.db.PLACEMENT.RIGHTOF) { + noteModel.width = shouldWrap ? common_default.getMax(conf2.width, textDimensions.width) : common_default.getMax( + fromActor.width / 2 + toActor.width / 2, + textDimensions.width + 2 * conf2.noteMargin + ); + noteModel.startx = startx + (fromActor.width + conf2.actorMargin) / 2; + } else if (msg.placement === diagObj.db.PLACEMENT.LEFTOF) { + noteModel.width = shouldWrap ? common_default.getMax(conf2.width, textDimensions.width + 2 * conf2.noteMargin) : common_default.getMax( + fromActor.width / 2 + toActor.width / 2, + textDimensions.width + 2 * conf2.noteMargin + ); + noteModel.startx = startx - noteModel.width + (fromActor.width - conf2.actorMargin) / 2; + } else if (msg.to === msg.from) { + textDimensions = utils_default2.calculateTextDimensions( + shouldWrap ? utils_default2.wrapLabel(msg.message, common_default.getMax(conf2.width, fromActor.width), noteFont(conf2)) : msg.message, + noteFont(conf2) + ); + noteModel.width = shouldWrap ? common_default.getMax(conf2.width, fromActor.width) : common_default.getMax(fromActor.width, conf2.width, textDimensions.width + 2 * conf2.noteMargin); + noteModel.startx = startx + (fromActor.width - noteModel.width) / 2; + } else { + noteModel.width = Math.abs(startx + fromActor.width / 2 - (stopx + toActor.width / 2)) + conf2.actorMargin; + noteModel.startx = startx < stopx ? startx + fromActor.width / 2 - conf2.actorMargin / 2 : stopx + toActor.width / 2 - conf2.actorMargin / 2; + } + if (shouldWrap) { + noteModel.message = utils_default2.wrapLabel( + msg.message, + noteModel.width - 2 * conf2.wrapPadding, + noteFont(conf2) + ); + } + log.debug( + `NM:[${noteModel.startx},${noteModel.stopx},${noteModel.starty},${noteModel.stopy}:${noteModel.width},${noteModel.height}=${msg.message}]` + ); + return noteModel; + }, "buildNoteModel"); + CENTRAL_CONNECTION_BASE_OFFSET = 4; + CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET = 6; + hasCentralConnection = /* @__PURE__ */ __name(function(msg, diagObj) { + const { CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL } = diagObj.db.LINETYPE; + return [CENTRAL_CONNECTION, CENTRAL_CONNECTION_REVERSE, CENTRAL_CONNECTION_DUAL].includes( + msg.centralConnection + ); + }, "hasCentralConnection"); + calculateCentralConnectionOffset = /* @__PURE__ */ __name(function(msg, diagObj, isArrowToRight) { + const { + CENTRAL_CONNECTION_REVERSE, + CENTRAL_CONNECTION_DUAL, + BIDIRECTIONAL_SOLID, + BIDIRECTIONAL_DOTTED + } = diagObj.db.LINETYPE; + let offset = 0; + if (msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) { + offset += CENTRAL_CONNECTION_BASE_OFFSET; + } + if ((msg.centralConnection === CENTRAL_CONNECTION_REVERSE || msg.centralConnection === CENTRAL_CONNECTION_DUAL) && (msg.type === BIDIRECTIONAL_SOLID || msg.type === BIDIRECTIONAL_DOTTED)) { + offset += isArrowToRight ? 0 : -CENTRAL_CONNECTION_BIDIRECTIONAL_OFFSET; + } + return offset; + }, "calculateCentralConnectionOffset"); + isReverseArrowType = /* @__PURE__ */ __name(function(msg, diagObj) { + const { + SOLID_ARROW_TOP_REVERSE, + SOLID_ARROW_TOP_REVERSE_DOTTED, + SOLID_ARROW_BOTTOM_REVERSE, + SOLID_ARROW_BOTTOM_REVERSE_DOTTED, + STICK_ARROW_TOP_REVERSE, + STICK_ARROW_TOP_REVERSE_DOTTED, + STICK_ARROW_BOTTOM_REVERSE, + STICK_ARROW_BOTTOM_REVERSE_DOTTED + } = diagObj.db.LINETYPE; + return [ + SOLID_ARROW_TOP_REVERSE, + SOLID_ARROW_TOP_REVERSE_DOTTED, + SOLID_ARROW_BOTTOM_REVERSE, + SOLID_ARROW_BOTTOM_REVERSE_DOTTED, + STICK_ARROW_TOP_REVERSE, + STICK_ARROW_TOP_REVERSE_DOTTED, + STICK_ARROW_BOTTOM_REVERSE, + STICK_ARROW_BOTTOM_REVERSE_DOTTED + ].includes(msg.type); + }, "isReverseArrowType"); + isBidirectionalArrowType = /* @__PURE__ */ __name(function(msg, diagObj) { + const { BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED } = diagObj.db.LINETYPE; + return [BIDIRECTIONAL_SOLID, BIDIRECTIONAL_DOTTED].includes(msg.type); + }, "isBidirectionalArrowType"); + buildMessageModel = /* @__PURE__ */ __name(function(msg, actors2, diagObj) { + const { look } = getConfig2(); + if (![ + diagObj.db.LINETYPE.SOLID_OPEN, + diagObj.db.LINETYPE.DOTTED_OPEN, + diagObj.db.LINETYPE.SOLID, + diagObj.db.LINETYPE.SOLID_TOP, + diagObj.db.LINETYPE.SOLID_BOTTOM, + diagObj.db.LINETYPE.STICK_TOP, + diagObj.db.LINETYPE.STICK_BOTTOM, + diagObj.db.LINETYPE.SOLID_TOP_DOTTED, + diagObj.db.LINETYPE.SOLID_BOTTOM_DOTTED, + diagObj.db.LINETYPE.STICK_TOP_DOTTED, + diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE, + diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE, + diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE, + diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE, + diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED, + diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED, + diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED, + diagObj.db.LINETYPE.DOTTED, + diagObj.db.LINETYPE.SOLID_CROSS, + diagObj.db.LINETYPE.DOTTED_CROSS, + diagObj.db.LINETYPE.SOLID_POINT, + diagObj.db.LINETYPE.DOTTED_POINT, + diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID, + diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED + ].includes(msg.type)) { + return {}; + } + const [fromLeft, fromRight] = activationBounds(msg.from, actors2); + const [toLeft, toRight] = activationBounds(msg.to, actors2); + const isArrowToRight = fromLeft <= toLeft; + let startx = isArrowToRight ? fromRight : fromLeft; + let stopx = isArrowToRight ? toLeft : toRight; + if (look === "neo") { + const offset = 3; + if (msg.type !== diagObj.db.LINETYPE.SOLID_OPEN) { + stopx += isArrowToRight ? -offset : offset; + } + if (msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID || msg.type === diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED) { + startx += isArrowToRight ? offset : -offset; + } + } + startx += calculateCentralConnectionOffset(msg, diagObj, isArrowToRight); + const isArrowToActivation = Math.abs(toLeft - toRight) > 2; + const adjustValue = /* @__PURE__ */ __name((value2) => { + return isArrowToRight ? -value2 : value2; + }, "adjustValue"); + if (msg.from === msg.to) { + stopx = startx; + } else { + if (msg.activate && !isArrowToActivation) { + stopx += adjustValue(conf2.activationWidth / 2 - 1); + } + if (![ + diagObj.db.LINETYPE.SOLID_OPEN, + diagObj.db.LINETYPE.DOTTED_OPEN, + diagObj.db.LINETYPE.STICK_TOP, + diagObj.db.LINETYPE.STICK_BOTTOM, + diagObj.db.LINETYPE.STICK_TOP_DOTTED, + diagObj.db.LINETYPE.STICK_BOTTOM_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED, + diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE, + diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE, + diagObj.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED, + diagObj.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE, + diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE + ].includes(msg.type)) { + stopx += adjustValue(3); + } + if ([ + diagObj.db.LINETYPE.BIDIRECTIONAL_SOLID, + diagObj.db.LINETYPE.BIDIRECTIONAL_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED, + diagObj.db.LINETYPE.SOLID_ARROW_TOP_REVERSE, + diagObj.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE + ].includes(msg.type)) { + startx -= adjustValue(3); + } + } + const allBounds = [fromLeft, fromRight, toLeft, toRight]; + const boundedWidth = Math.abs(startx - stopx); + if (msg.wrap && msg.message) { + msg.message = utils_default2.wrapLabel( + msg.message, + common_default.getMax(boundedWidth + 2 * conf2.wrapPadding, conf2.width), + messageFont2(conf2) + ); + } + const msgDims = utils_default2.calculateTextDimensions(msg.message, messageFont2(conf2)); + return { + width: common_default.getMax( + msg.wrap ? 0 : msgDims.width + 2 * conf2.wrapPadding, + boundedWidth + 2 * conf2.wrapPadding, + conf2.width + ), + height: 0, + startx, + stopx, + starty: 0, + stopy: 0, + message: msg.message, + type: msg.type, + wrap: msg.wrap, + fromBounds: Math.min.apply(null, allBounds), + toBounds: Math.max.apply(null, allBounds) + }; + }, "buildMessageModel"); + calculateLoopBounds = /* @__PURE__ */ __name(async function(messages, actors2, _maxWidthPerActor, diagObj) { + const loops = {}; + const stack = []; + let current, noteModel, msgModel; + for (const msg of messages) { + switch (msg.type) { + case diagObj.db.LINETYPE.LOOP_START: + case diagObj.db.LINETYPE.ALT_START: + case diagObj.db.LINETYPE.OPT_START: + case diagObj.db.LINETYPE.PAR_START: + case diagObj.db.LINETYPE.PAR_OVER_START: + case diagObj.db.LINETYPE.CRITICAL_START: + case diagObj.db.LINETYPE.BREAK_START: + stack.push({ + id: msg.id, + msg: msg.message, + from: Number.MAX_SAFE_INTEGER, + to: Number.MIN_SAFE_INTEGER, + width: 0 + }); + break; + case diagObj.db.LINETYPE.ALT_ELSE: + case diagObj.db.LINETYPE.PAR_AND: + case diagObj.db.LINETYPE.CRITICAL_OPTION: + if (msg.message) { + current = stack.pop(); + loops[current.id] = current; + loops[msg.id] = current; + stack.push(current); + } + break; + case diagObj.db.LINETYPE.LOOP_END: + case diagObj.db.LINETYPE.ALT_END: + case diagObj.db.LINETYPE.OPT_END: + case diagObj.db.LINETYPE.PAR_END: + case diagObj.db.LINETYPE.CRITICAL_END: + case diagObj.db.LINETYPE.BREAK_END: + current = stack.pop(); + loops[current.id] = current; + break; + case diagObj.db.LINETYPE.ACTIVE_START: + { + const actorRect = actors2.get(msg.from ? msg.from : msg.to.actor); + const stackedSize = actorActivations(msg.from ? msg.from : msg.to.actor).length; + const x5 = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf2.activationWidth / 2; + const toAdd = { + startx: x5, + stopx: x5 + conf2.activationWidth, + actor: msg.from, + enabled: true + }; + bounds2.activations.push(toAdd); + } + break; + case diagObj.db.LINETYPE.ACTIVE_END: + { + const lastActorActivationIdx = bounds2.activations.map((a2) => a2.actor).lastIndexOf(msg.from); + bounds2.activations.splice(lastActorActivationIdx, 1).splice(0, 1); + } + break; + } + const isNote = msg.placement !== void 0; + if (isNote) { + noteModel = await buildNoteModel(msg, actors2, diagObj); + msg.noteModel = noteModel; + stack.forEach((stk) => { + current = stk; + current.from = common_default.getMin(current.from, noteModel.startx); + current.to = common_default.getMax(current.to, noteModel.startx + noteModel.width); + current.width = common_default.getMax(current.width, Math.abs(current.from - current.to)) - conf2.labelBoxWidth; + }); + } else { + msgModel = buildMessageModel(msg, actors2, diagObj); + msg.msgModel = msgModel; + if (msgModel.startx && msgModel.stopx && stack.length > 0) { + stack.forEach((stk) => { + current = stk; + if (msgModel.startx === msgModel.stopx) { + const from2 = actors2.get(msg.from); + const to = actors2.get(msg.to); + current.from = common_default.getMin( + from2.x - msgModel.width / 2, + from2.x - from2.width / 2, + current.from + ); + current.to = common_default.getMax( + to.x + msgModel.width / 2, + to.x + from2.width / 2, + current.to + ); + current.width = common_default.getMax(current.width, Math.abs(current.to - current.from)) - conf2.labelBoxWidth; + } else { + current.from = common_default.getMin(msgModel.startx, current.from); + current.to = common_default.getMax(msgModel.stopx, current.to); + current.width = common_default.getMax(current.width, msgModel.width) - conf2.labelBoxWidth; + } + }); + } + } + } + bounds2.activations = []; + log.debug("Loop type widths:", loops); + return loops; + }, "calculateLoopBounds"); + sequenceRenderer_default = { + bounds: bounds2, + drawActors, + drawActorsPopup, + setConf: setConf3, + draw: draw11 + }; + } + }); + + // src/diagrams/sequence/sequenceDiagram.ts + var sequenceDiagram_exports = {}; + __export(sequenceDiagram_exports, { + diagram: () => diagram11 + }); + var diagram11; + var init_sequenceDiagram2 = __esm({ + "src/diagrams/sequence/sequenceDiagram.ts"() { + "use strict"; + init_sequenceDiagram(); + init_sequenceDb(); + init_styles8(); + init_diagramAPI(); + init_sequenceRenderer(); + diagram11 = { + parser: sequenceDiagram_default, + get db() { + return new SequenceDB(); + }, + renderer: sequenceRenderer_default, + styles: styles_default8, + init: /* @__PURE__ */ __name((cnf) => { + if (!cnf.sequence) { + cnf.sequence = {}; + } + if (cnf.wrap) { + cnf.sequence.wrap = cnf.wrap; + setConfig2({ sequence: { wrap: cnf.wrap } }); + } + }, "init") + }; + } + }); + + // src/diagrams/class/parser/classDiagram.jison + var parser12, classDiagram_default; + var init_classDiagram = __esm({ + "src/diagrams/class/parser/classDiagram.jison"() { + "use strict"; + parser12 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 18], $V1 = [1, 19], $V2 = [1, 20], $V3 = [1, 41], $V4 = [1, 26], $V5 = [1, 42], $V6 = [1, 24], $V7 = [1, 25], $V8 = [1, 32], $V9 = [1, 33], $Va = [1, 34], $Vb = [1, 45], $Vc = [1, 35], $Vd = [1, 36], $Ve = [1, 37], $Vf = [1, 38], $Vg = [1, 27], $Vh = [1, 28], $Vi = [1, 29], $Vj = [1, 30], $Vk = [1, 31], $Vl = [1, 44], $Vm = [1, 46], $Vn = [1, 43], $Vo = [1, 47], $Vp = [1, 9], $Vq = [1, 8, 9], $Vr = [1, 58], $Vs = [1, 59], $Vt = [1, 60], $Vu = [1, 61], $Vv = [1, 62], $Vw = [1, 63], $Vx = [1, 64], $Vy = [1, 8, 9, 41], $Vz = [1, 77], $VA = [1, 8, 9, 12, 13, 22, 39, 41, 44, 46, 68, 69, 70, 71, 72, 73, 74, 79, 81], $VB = [1, 8, 9, 12, 13, 18, 20, 22, 39, 41, 44, 46, 47, 60, 68, 69, 70, 71, 72, 73, 74, 79, 81, 86, 100, 102, 103], $VC = [13, 60, 86, 100, 102, 103], $VD = [13, 60, 73, 74, 86, 100, 102, 103], $VE = [13, 60, 68, 69, 70, 71, 72, 86, 100, 102, 103], $VF = [1, 103], $VG = [1, 121], $VH = [1, 117], $VI = [1, 113], $VJ = [1, 119], $VK = [1, 114], $VL = [1, 115], $VM = [1, 116], $VN = [1, 118], $VO = [1, 120], $VP = [22, 50, 60, 61, 82, 86, 87, 88, 89, 90], $VQ = [1, 128], $VR = [12, 39], $VS = [1, 8, 9, 39, 41, 44, 46], $VT = [1, 8, 9, 22], $VU = [1, 153], $VV = [1, 8, 9, 61], $VW = [1, 8, 9, 22, 50, 60, 61, 82, 86, 87, 88, 89, 90]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "mermaidDoc": 4, "statements": 5, "graphConfig": 6, "CLASS_DIAGRAM": 7, "NEWLINE": 8, "EOF": 9, "statement": 10, "classLabel": 11, "SQS": 12, "STR": 13, "SQE": 14, "namespaceName": 15, "alphaNumToken": 16, "classLiteralName": 17, "DOT": 18, "className": 19, "GENERICTYPE": 20, "relationStatement": 21, "LABEL": 22, "namespaceStatement": 23, "classStatement": 24, "memberStatement": 25, "annotationStatement": 26, "clickStatement": 27, "styleStatement": 28, "cssClassStatement": 29, "noteStatement": 30, "classDefStatement": 31, "direction": 32, "acc_title": 33, "acc_title_value": 34, "acc_descr": 35, "acc_descr_value": 36, "acc_descr_multiline_value": 37, "namespaceIdentifier": 38, "STRUCT_START": 39, "classStatements": 40, "STRUCT_STOP": 41, "NAMESPACE": 42, "classIdentifier": 43, "STYLE_SEPARATOR": 44, "members": 45, "ANNOTATION_START": 46, "ANNOTATION_END": 47, "CLASS": 48, "emptyBody": 49, "SPACE": 50, "MEMBER": 51, "SEPARATOR": 52, "relation": 53, "NOTE_FOR": 54, "noteText": 55, "NOTE": 56, "CLASSDEF": 57, "classList": 58, "stylesOpt": 59, "ALPHA": 60, "COMMA": 61, "direction_tb": 62, "direction_bt": 63, "direction_rl": 64, "direction_lr": 65, "relationType": 66, "lineType": 67, "AGGREGATION": 68, "EXTENSION": 69, "COMPOSITION": 70, "DEPENDENCY": 71, "LOLLIPOP": 72, "LINE": 73, "DOTTED_LINE": 74, "CALLBACK": 75, "LINK": 76, "LINK_TARGET": 77, "CLICK": 78, "CALLBACK_NAME": 79, "CALLBACK_ARGS": 80, "HREF": 81, "STYLE": 82, "CSSCLASS": 83, "style": 84, "styleComponent": 85, "NUM": 86, "COLON": 87, "UNIT": 88, "BRKT": 89, "PCT": 90, "commentToken": 91, "textToken": 92, "graphCodeTokens": 93, "textNoTagsToken": 94, "TAGSTART": 95, "TAGEND": 96, "==": 97, "--": 98, "DEFAULT": 99, "MINUS": 100, "keywords": 101, "UNICODE_TEXT": 102, "BQUOTE_STR": 103, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 7: "CLASS_DIAGRAM", 8: "NEWLINE", 9: "EOF", 12: "SQS", 13: "STR", 14: "SQE", 18: "DOT", 20: "GENERICTYPE", 22: "LABEL", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 39: "STRUCT_START", 41: "STRUCT_STOP", 42: "NAMESPACE", 44: "STYLE_SEPARATOR", 46: "ANNOTATION_START", 47: "ANNOTATION_END", 48: "CLASS", 50: "SPACE", 51: "MEMBER", 52: "SEPARATOR", 54: "NOTE_FOR", 56: "NOTE", 57: "CLASSDEF", 60: "ALPHA", 61: "COMMA", 62: "direction_tb", 63: "direction_bt", 64: "direction_rl", 65: "direction_lr", 68: "AGGREGATION", 69: "EXTENSION", 70: "COMPOSITION", 71: "DEPENDENCY", 72: "LOLLIPOP", 73: "LINE", 74: "DOTTED_LINE", 75: "CALLBACK", 76: "LINK", 77: "LINK_TARGET", 78: "CLICK", 79: "CALLBACK_NAME", 80: "CALLBACK_ARGS", 81: "HREF", 82: "STYLE", 83: "CSSCLASS", 86: "NUM", 87: "COLON", 88: "UNIT", 89: "BRKT", 90: "PCT", 93: "graphCodeTokens", 95: "TAGSTART", 96: "TAGEND", 97: "==", 98: "--", 99: "DEFAULT", 100: "MINUS", 101: "keywords", 102: "UNICODE_TEXT", 103: "BQUOTE_STR" }, + productions_: [0, [3, 1], [3, 1], [4, 1], [6, 4], [5, 1], [5, 2], [5, 3], [11, 3], [15, 1], [15, 1], [15, 3], [15, 2], [19, 1], [19, 3], [19, 1], [19, 2], [19, 2], [19, 2], [10, 1], [10, 2], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [10, 1], [23, 4], [23, 5], [38, 2], [38, 3], [40, 1], [40, 2], [40, 3], [40, 1], [40, 2], [40, 3], [40, 1], [40, 2], [40, 3], [24, 1], [24, 3], [24, 4], [24, 3], [24, 6], [24, 4], [24, 7], [24, 6], [43, 2], [43, 3], [49, 0], [49, 2], [49, 2], [26, 4], [45, 1], [45, 2], [25, 1], [25, 2], [25, 1], [25, 1], [21, 3], [21, 4], [21, 4], [21, 5], [30, 3], [30, 2], [31, 3], [58, 1], [58, 3], [32, 1], [32, 1], [32, 1], [32, 1], [53, 3], [53, 2], [53, 2], [53, 1], [66, 1], [66, 1], [66, 1], [66, 1], [66, 1], [67, 1], [67, 1], [27, 3], [27, 4], [27, 3], [27, 4], [27, 4], [27, 5], [27, 3], [27, 4], [27, 4], [27, 5], [27, 4], [27, 5], [27, 5], [27, 6], [28, 3], [29, 3], [59, 1], [59, 3], [84, 1], [84, 2], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [85, 1], [91, 1], [91, 1], [92, 1], [92, 1], [92, 1], [92, 1], [92, 1], [92, 1], [92, 1], [94, 1], [94, 1], [94, 1], [94, 1], [16, 1], [16, 1], [16, 1], [16, 1], [17, 1], [55, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 8: + this.$ = $$[$0 - 1]; + break; + case 9: + case 10: + case 13: + case 15: + this.$ = $$[$0]; + break; + case 11: + case 14: + this.$ = $$[$0 - 2] + "." + $$[$0]; + break; + case 12: + case 16: + this.$ = $$[$0 - 1] + $$[$0]; + break; + case 17: + case 18: + this.$ = $$[$0 - 1] + "~" + $$[$0] + "~"; + break; + case 19: + yy.addRelation($$[$0]); + break; + case 20: + $$[$0 - 1].title = yy.cleanupLabel($$[$0]); + yy.addRelation($$[$0 - 1]); + break; + case 31: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 32: + case 33: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 34: + yy.addClassesToNamespace($$[$0 - 3], $$[$0 - 1][0], $$[$0 - 1][1]); + yy.popNamespace(); + break; + case 35: + yy.addClassesToNamespace($$[$0 - 4], $$[$0 - 1][0], $$[$0 - 1][1]); + yy.popNamespace(); + break; + case 36: + this.$ = yy.addNamespace($$[$0]); + break; + case 37: + this.$ = yy.addNamespace($$[$0 - 1], $$[$0]); + break; + case 38: + this.$ = [[$$[$0]], []]; + break; + case 39: + this.$ = [[$$[$0 - 1]], []]; + break; + case 40: + $$[$0][0].unshift($$[$0 - 2]); + this.$ = $$[$0]; + break; + case 41: + this.$ = [[], [$$[$0]]]; + break; + case 42: + this.$ = [[], [$$[$0 - 1]]]; + break; + case 43: + $$[$0][1].unshift($$[$0 - 2]); + this.$ = $$[$0]; + break; + case 44: + case 45: + this.$ = [[], []]; + break; + case 46: + this.$ = $$[$0]; + break; + case 48: + yy.setCssClass($$[$0 - 2], $$[$0]); + break; + case 49: + yy.addMembers($$[$0 - 3], $$[$0 - 1]); + break; + case 51: + yy.setCssClass($$[$0 - 5], $$[$0 - 3]); + yy.addMembers($$[$0 - 5], $$[$0 - 1]); + break; + case 52: + yy.addAnnotation($$[$0 - 3], $$[$0 - 1]); + break; + case 53: + yy.addAnnotation($$[$0 - 6], $$[$0 - 4]); + yy.addMembers($$[$0 - 6], $$[$0 - 1]); + break; + case 54: + yy.addAnnotation($$[$0 - 5], $$[$0 - 3]); + break; + case 55: + this.$ = $$[$0]; + yy.addClass($$[$0]); + break; + case 56: + this.$ = $$[$0 - 1]; + yy.addClass($$[$0 - 1]); + yy.setClassLabel($$[$0 - 1], $$[$0]); + break; + case 60: + yy.addAnnotation($$[$0], $$[$0 - 2]); + break; + case 61: + case 74: + this.$ = [$$[$0]]; + break; + case 62: + $$[$0].push($$[$0 - 1]); + this.$ = $$[$0]; + break; + case 63: + break; + case 64: + yy.addMember($$[$0 - 1], yy.cleanupLabel($$[$0])); + break; + case 65: + break; + case 66: + break; + case 67: + this.$ = { "id1": $$[$0 - 2], "id2": $$[$0], relation: $$[$0 - 1], relationTitle1: "none", relationTitle2: "none" }; + break; + case 68: + this.$ = { id1: $$[$0 - 3], id2: $$[$0], relation: $$[$0 - 1], relationTitle1: $$[$0 - 2], relationTitle2: "none" }; + break; + case 69: + this.$ = { id1: $$[$0 - 3], id2: $$[$0], relation: $$[$0 - 2], relationTitle1: "none", relationTitle2: $$[$0 - 1] }; + break; + case 70: + this.$ = { id1: $$[$0 - 4], id2: $$[$0], relation: $$[$0 - 2], relationTitle1: $$[$0 - 3], relationTitle2: $$[$0 - 1] }; + break; + case 71: + this.$ = yy.addNote($$[$0], $$[$0 - 1]); + break; + case 72: + this.$ = yy.addNote($$[$0]); + break; + case 73: + this.$ = $$[$0 - 2]; + yy.defineClass($$[$0 - 1], $$[$0]); + break; + case 75: + this.$ = $$[$0 - 2].concat([$$[$0]]); + break; + case 76: + yy.setDirection("TB"); + break; + case 77: + yy.setDirection("BT"); + break; + case 78: + yy.setDirection("RL"); + break; + case 79: + yy.setDirection("LR"); + break; + case 80: + this.$ = { type1: $$[$0 - 2], type2: $$[$0], lineType: $$[$0 - 1] }; + break; + case 81: + this.$ = { type1: "none", type2: $$[$0], lineType: $$[$0 - 1] }; + break; + case 82: + this.$ = { type1: $$[$0 - 1], type2: "none", lineType: $$[$0] }; + break; + case 83: + this.$ = { type1: "none", type2: "none", lineType: $$[$0] }; + break; + case 84: + this.$ = yy.relationType.AGGREGATION; + break; + case 85: + this.$ = yy.relationType.EXTENSION; + break; + case 86: + this.$ = yy.relationType.COMPOSITION; + break; + case 87: + this.$ = yy.relationType.DEPENDENCY; + break; + case 88: + this.$ = yy.relationType.LOLLIPOP; + break; + case 89: + this.$ = yy.lineType.LINE; + break; + case 90: + this.$ = yy.lineType.DOTTED_LINE; + break; + case 91: + case 97: + this.$ = $$[$0 - 2]; + yy.setClickEvent($$[$0 - 1], $$[$0]); + break; + case 92: + case 98: + this.$ = $$[$0 - 3]; + yy.setClickEvent($$[$0 - 2], $$[$0 - 1]); + yy.setTooltip($$[$0 - 2], $$[$0]); + break; + case 93: + this.$ = $$[$0 - 2]; + yy.setLink($$[$0 - 1], $$[$0]); + break; + case 94: + this.$ = $$[$0 - 3]; + yy.setLink($$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 95: + this.$ = $$[$0 - 3]; + yy.setLink($$[$0 - 2], $$[$0 - 1]); + yy.setTooltip($$[$0 - 2], $$[$0]); + break; + case 96: + this.$ = $$[$0 - 4]; + yy.setLink($$[$0 - 3], $$[$0 - 2], $$[$0]); + yy.setTooltip($$[$0 - 3], $$[$0 - 1]); + break; + case 99: + this.$ = $$[$0 - 3]; + yy.setClickEvent($$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 100: + this.$ = $$[$0 - 4]; + yy.setClickEvent($$[$0 - 3], $$[$0 - 2], $$[$0 - 1]); + yy.setTooltip($$[$0 - 3], $$[$0]); + break; + case 101: + this.$ = $$[$0 - 3]; + yy.setLink($$[$0 - 2], $$[$0]); + break; + case 102: + this.$ = $$[$0 - 4]; + yy.setLink($$[$0 - 3], $$[$0 - 1], $$[$0]); + break; + case 103: + this.$ = $$[$0 - 4]; + yy.setLink($$[$0 - 3], $$[$0 - 1]); + yy.setTooltip($$[$0 - 3], $$[$0]); + break; + case 104: + this.$ = $$[$0 - 5]; + yy.setLink($$[$0 - 4], $$[$0 - 2], $$[$0]); + yy.setTooltip($$[$0 - 4], $$[$0 - 1]); + break; + case 105: + this.$ = $$[$0 - 2]; + yy.setCssStyle($$[$0 - 1], $$[$0]); + break; + case 106: + yy.setCssClass($$[$0 - 1], $$[$0]); + break; + case 107: + this.$ = [$$[$0]]; + break; + case 108: + $$[$0 - 2].push($$[$0]); + this.$ = $$[$0 - 2]; + break; + case 110: + this.$ = $$[$0 - 1] + $$[$0]; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 5: 3, 6: 4, 7: [1, 6], 10: 5, 16: 39, 17: 40, 19: 21, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 33: $V0, 35: $V1, 37: $V2, 38: 22, 42: $V3, 43: 23, 46: $V4, 48: $V5, 51: $V6, 52: $V7, 54: $V8, 56: $V9, 57: $Va, 60: $Vb, 62: $Vc, 63: $Vd, 64: $Ve, 65: $Vf, 75: $Vg, 76: $Vh, 78: $Vi, 82: $Vj, 83: $Vk, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3] }, o2($Vp, [2, 5], { 8: [1, 48] }), { 8: [1, 49] }, o2($Vq, [2, 19], { 22: [1, 50] }), o2($Vq, [2, 21]), o2($Vq, [2, 22]), o2($Vq, [2, 23]), o2($Vq, [2, 24]), o2($Vq, [2, 25]), o2($Vq, [2, 26]), o2($Vq, [2, 27]), o2($Vq, [2, 28]), o2($Vq, [2, 29]), o2($Vq, [2, 30]), { 34: [1, 51] }, { 36: [1, 52] }, o2($Vq, [2, 33]), o2($Vq, [2, 63], { 53: 53, 66: 56, 67: 57, 13: [1, 54], 22: [1, 55], 68: $Vr, 69: $Vs, 70: $Vt, 71: $Vu, 72: $Vv, 73: $Vw, 74: $Vx }), { 39: [1, 65] }, o2($Vy, [2, 47], { 39: [1, 67], 44: [1, 66], 46: [1, 68] }), o2($Vq, [2, 65]), o2($Vq, [2, 66]), { 16: 69, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn }, { 16: 39, 17: 40, 19: 70, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 16: 39, 17: 40, 19: 71, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 16: 39, 17: 40, 19: 72, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 60: [1, 73] }, { 13: [1, 74] }, { 16: 39, 17: 40, 19: 75, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 13: $Vz, 55: 76 }, { 58: 78, 60: [1, 79] }, o2($Vq, [2, 76]), o2($Vq, [2, 77]), o2($Vq, [2, 78]), o2($Vq, [2, 79]), o2($VA, [2, 13], { 16: 39, 17: 40, 19: 81, 18: [1, 80], 20: [1, 82], 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }), o2($VA, [2, 15], { 20: [1, 83] }), { 15: 84, 16: 85, 17: 86, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 16: 39, 17: 40, 19: 87, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($VB, [2, 133]), o2($VB, [2, 134]), o2($VB, [2, 135]), o2($VB, [2, 136]), o2([1, 8, 9, 12, 13, 20, 22, 39, 41, 44, 46, 68, 69, 70, 71, 72, 73, 74, 79, 81], [2, 137]), o2($Vp, [2, 6], { 10: 5, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 19: 21, 38: 22, 43: 23, 16: 39, 17: 40, 5: 88, 33: $V0, 35: $V1, 37: $V2, 42: $V3, 46: $V4, 48: $V5, 51: $V6, 52: $V7, 54: $V8, 56: $V9, 57: $Va, 60: $Vb, 62: $Vc, 63: $Vd, 64: $Ve, 65: $Vf, 75: $Vg, 76: $Vh, 78: $Vi, 82: $Vj, 83: $Vk, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }), { 5: 89, 10: 5, 16: 39, 17: 40, 19: 21, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 33: $V0, 35: $V1, 37: $V2, 38: 22, 42: $V3, 43: 23, 46: $V4, 48: $V5, 51: $V6, 52: $V7, 54: $V8, 56: $V9, 57: $Va, 60: $Vb, 62: $Vc, 63: $Vd, 64: $Ve, 65: $Vf, 75: $Vg, 76: $Vh, 78: $Vi, 82: $Vj, 83: $Vk, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($Vq, [2, 20]), o2($Vq, [2, 31]), o2($Vq, [2, 32]), { 13: [1, 91], 16: 39, 17: 40, 19: 90, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 53: 92, 66: 56, 67: 57, 68: $Vr, 69: $Vs, 70: $Vt, 71: $Vu, 72: $Vv, 73: $Vw, 74: $Vx }, o2($Vq, [2, 64]), { 67: 93, 73: $Vw, 74: $Vx }, o2($VC, [2, 83], { 66: 94, 68: $Vr, 69: $Vs, 70: $Vt, 71: $Vu, 72: $Vv }), o2($VD, [2, 84]), o2($VD, [2, 85]), o2($VD, [2, 86]), o2($VD, [2, 87]), o2($VD, [2, 88]), o2($VE, [2, 89]), o2($VE, [2, 90]), { 8: [1, 96], 23: 99, 24: 97, 30: 98, 38: 22, 40: 95, 42: $V3, 43: 23, 48: $V5, 54: $V8, 56: $V9 }, { 16: 100, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn }, { 41: [1, 102], 45: 101, 51: $VF }, { 16: 104, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn }, { 47: [1, 105] }, { 13: [1, 106] }, { 13: [1, 107] }, { 79: [1, 108], 81: [1, 109] }, { 22: $VG, 50: $VH, 59: 110, 60: $VI, 82: $VJ, 84: 111, 85: 112, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }, { 60: [1, 122] }, { 13: $Vz, 55: 123 }, o2($Vy, [2, 72]), o2($Vy, [2, 138]), { 22: $VG, 50: $VH, 59: 124, 60: $VI, 61: [1, 125], 82: $VJ, 84: 111, 85: 112, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }, o2($VP, [2, 74]), { 16: 39, 17: 40, 19: 126, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($VA, [2, 16]), o2($VA, [2, 17]), o2($VA, [2, 18]), { 11: 127, 12: $VQ, 39: [2, 36] }, o2($VR, [2, 9], { 16: 85, 17: 86, 15: 130, 18: [1, 129], 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }), o2($VR, [2, 10]), o2($VS, [2, 55], { 11: 131, 12: $VQ }), o2($Vp, [2, 7]), { 9: [1, 132] }, o2($VT, [2, 67]), { 16: 39, 17: 40, 19: 133, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, { 13: [1, 135], 16: 39, 17: 40, 19: 134, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($VC, [2, 82], { 66: 136, 68: $Vr, 69: $Vs, 70: $Vt, 71: $Vu, 72: $Vv }), o2($VC, [2, 81]), { 41: [1, 137] }, { 23: 99, 24: 97, 30: 98, 38: 22, 40: 138, 42: $V3, 43: 23, 48: $V5, 54: $V8, 56: $V9 }, { 8: [1, 139], 41: [2, 38] }, { 8: [1, 140], 41: [2, 41] }, { 8: [1, 141], 41: [2, 44] }, o2($Vy, [2, 48], { 39: [1, 142] }), { 41: [1, 143] }, o2($Vy, [2, 50]), { 41: [2, 61], 45: 144, 51: $VF }, { 47: [1, 145] }, { 16: 39, 17: 40, 19: 146, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($Vq, [2, 91], { 13: [1, 147] }), o2($Vq, [2, 93], { 13: [1, 149], 77: [1, 148] }), o2($Vq, [2, 97], { 13: [1, 150], 80: [1, 151] }), { 13: [1, 152] }, o2($Vq, [2, 105], { 61: $VU }), o2($VV, [2, 107], { 85: 154, 22: $VG, 50: $VH, 60: $VI, 82: $VJ, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }), o2($VW, [2, 109]), o2($VW, [2, 111]), o2($VW, [2, 112]), o2($VW, [2, 113]), o2($VW, [2, 114]), o2($VW, [2, 115]), o2($VW, [2, 116]), o2($VW, [2, 117]), o2($VW, [2, 118]), o2($VW, [2, 119]), o2($Vq, [2, 106]), o2($Vy, [2, 71]), o2($Vq, [2, 73], { 61: $VU }), { 60: [1, 155] }, o2($VA, [2, 14]), { 39: [2, 37] }, { 13: [1, 156] }, { 15: 157, 16: 85, 17: 86, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($VR, [2, 12]), o2($VS, [2, 56]), { 1: [2, 4] }, o2($VT, [2, 69]), o2($VT, [2, 68]), { 16: 39, 17: 40, 19: 158, 60: $Vb, 86: $Vl, 100: $Vm, 102: $Vn, 103: $Vo }, o2($VC, [2, 80]), o2($Vy, [2, 34]), { 41: [1, 159] }, { 23: 99, 24: 97, 30: 98, 38: 22, 40: 160, 41: [2, 39], 42: $V3, 43: 23, 48: $V5, 54: $V8, 56: $V9 }, { 23: 99, 24: 97, 30: 98, 38: 22, 40: 161, 41: [2, 42], 42: $V3, 43: 23, 48: $V5, 54: $V8, 56: $V9 }, { 23: 99, 24: 97, 30: 98, 38: 22, 40: 162, 41: [2, 45], 42: $V3, 43: 23, 48: $V5, 54: $V8, 56: $V9 }, { 45: 163, 51: $VF }, o2($Vy, [2, 49]), { 41: [2, 62] }, o2($Vy, [2, 52], { 39: [1, 164] }), o2($Vq, [2, 60]), o2($Vq, [2, 92]), o2($Vq, [2, 94]), o2($Vq, [2, 95], { 77: [1, 165] }), o2($Vq, [2, 98]), o2($Vq, [2, 99], { 13: [1, 166] }), o2($Vq, [2, 101], { 13: [1, 168], 77: [1, 167] }), { 22: $VG, 50: $VH, 60: $VI, 82: $VJ, 84: 169, 85: 112, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }, o2($VW, [2, 110]), o2($VP, [2, 75]), { 14: [1, 170] }, o2($VR, [2, 11]), o2($VT, [2, 70]), o2($Vy, [2, 35]), { 41: [2, 40] }, { 41: [2, 43] }, { 41: [2, 46] }, { 41: [1, 171] }, { 41: [1, 173], 45: 172, 51: $VF }, o2($Vq, [2, 96]), o2($Vq, [2, 100]), o2($Vq, [2, 102]), o2($Vq, [2, 103], { 77: [1, 174] }), o2($VV, [2, 108], { 85: 154, 22: $VG, 50: $VH, 60: $VI, 82: $VJ, 86: $VK, 87: $VL, 88: $VM, 89: $VN, 90: $VO }), o2($VS, [2, 8]), o2($Vy, [2, 51]), { 41: [1, 175] }, o2($Vy, [2, 54]), o2($Vq, [2, 104]), o2($Vy, [2, 53])], + defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 3], 127: [2, 37], 132: [2, 4], 144: [2, 62], 160: [2, 40], 161: [2, 43], 162: [2, 46] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: {}, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + return 62; + break; + case 1: + return 63; + break; + case 2: + return 64; + break; + case 3: + return 65; + break; + case 4: + break; + case 5: + break; + case 6: + this.begin("acc_title"); + return 33; + break; + case 7: + this.popState(); + return "acc_title_value"; + break; + case 8: + this.begin("acc_descr"); + return 35; + break; + case 9: + this.popState(); + return "acc_descr_value"; + break; + case 10: + this.begin("acc_descr_multiline"); + break; + case 11: + this.popState(); + break; + case 12: + return "acc_descr_multiline_value"; + break; + case 13: + return 8; + break; + case 14: + break; + case 15: + return 7; + break; + case 16: + return 7; + break; + case 17: + return "EDGE_STATE"; + break; + case 18: + this.begin("callback_name"); + break; + case 19: + this.popState(); + break; + case 20: + this.popState(); + this.begin("callback_args"); + break; + case 21: + return 79; + break; + case 22: + this.popState(); + break; + case 23: + return 80; + break; + case 24: + this.popState(); + break; + case 25: + return "STR"; + break; + case 26: + this.begin("string"); + break; + case 27: + return 82; + break; + case 28: + return 57; + break; + case 29: + this.begin("namespace"); + return 42; + break; + case 30: + this.popState(); + return 8; + break; + case 31: + break; + case 32: + this.begin("namespace-body"); + return 39; + break; + case 33: + this.popState(); + this.less(0); + break; + case 34: + this.popState(); + return 41; + break; + case 35: + return "EOF_IN_STRUCT"; + break; + case 36: + return 8; + break; + case 37: + break; + case 38: + return "EDGE_STATE"; + break; + case 39: + this.begin("class"); + return 48; + break; + case 40: + this.popState(); + return 8; + break; + case 41: + break; + case 42: + this.popState(); + this.popState(); + return 41; + break; + case 43: + this.begin("class-body"); + return 39; + break; + case 44: + this.popState(); + return 41; + break; + case 45: + return "EOF_IN_STRUCT"; + break; + case 46: + return "EDGE_STATE"; + break; + case 47: + return "OPEN_IN_STRUCT"; + break; + case 48: + break; + case 49: + return "MEMBER"; + break; + case 50: + return 83; + break; + case 51: + return 75; + break; + case 52: + return 76; + break; + case 53: + return 78; + break; + case 54: + return 54; + break; + case 55: + return 56; + break; + case 56: + return 46; + break; + case 57: + return 47; + break; + case 58: + return 81; + break; + case 59: + this.popState(); + break; + case 60: + return "GENERICTYPE"; + break; + case 61: + this.begin("generic"); + break; + case 62: + this.popState(); + break; + case 63: + return "BQUOTE_STR"; + break; + case 64: + this.begin("bqstring"); + break; + case 65: + return 77; + break; + case 66: + return 77; + break; + case 67: + return 77; + break; + case 68: + return 77; + break; + case 69: + return 69; + break; + case 70: + return 69; + break; + case 71: + return 71; + break; + case 72: + return 71; + break; + case 73: + return 70; + break; + case 74: + return 68; + break; + case 75: + return 72; + break; + case 76: + return 73; + break; + case 77: + return 74; + break; + case 78: + return 22; + break; + case 79: + return 44; + break; + case 80: + return 100; + break; + case 81: + return 18; + break; + case 82: + return "PLUS"; + break; + case 83: + return 87; + break; + case 84: + return 61; + break; + case 85: + return 89; + break; + case 86: + return 89; + break; + case 87: + return 90; + break; + case 88: + return "EQUALS"; + break; + case 89: + return "EQUALS"; + break; + case 90: + return 60; + break; + case 91: + return 12; + break; + case 92: + return 14; + break; + case 93: + return "PUNCTUATION"; + break; + case 94: + return 86; + break; + case 95: + return 102; + break; + case 96: + return 50; + break; + case 97: + return 50; + break; + case 98: + return 9; + break; + } + }, "anonymous"), + rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:classDiagram-v2\b)/, /^(?:classDiagram\b)/, /^(?:\[\*\])/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:["])/, /^(?:[^"]*)/, /^(?:["])/, /^(?:style\b)/, /^(?:classDef\b)/, /^(?:namespace\b)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:[{])/, /^(?:[}])/, /^(?:[}])/, /^(?:$)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:\[\*\])/, /^(?:class\b)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:[}])/, /^(?:[{])/, /^(?:[}])/, /^(?:$)/, /^(?:\[\*\])/, /^(?:[{])/, /^(?:[\n])/, /^(?:[^{}\n]*)/, /^(?:cssClass\b)/, /^(?:callback\b)/, /^(?:link\b)/, /^(?:click\b)/, /^(?:note for\b)/, /^(?:note\b)/, /^(?:<<)/, /^(?:>>)/, /^(?:href\b)/, /^(?:[~])/, /^(?:[^~]*)/, /^(?:~)/, /^(?:[`])/, /^(?:[^`]+)/, /^(?:[`])/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:\s*<\|)/, /^(?:\s*\|>)/, /^(?:\s*>)/, /^(?:\s*<)/, /^(?:\s*\*)/, /^(?:\s*o\b)/, /^(?:\s*\(\))/, /^(?:--)/, /^(?:\.\.)/, /^(?::{1}[^:\n;]+)/, /^(?::{3})/, /^(?:-)/, /^(?:\.)/, /^(?:\+)/, /^(?::)/, /^(?:,)/, /^(?:#)/, /^(?:#)/, /^(?:%)/, /^(?:=)/, /^(?:=)/, /^(?:\w+)/, /^(?:\[)/, /^(?:\])/, /^(?:[!"#$%&'*+,-.`?\\/])/, /^(?:[0-9]+)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\s)/, /^(?:\s)/, /^(?:$)/], + conditions: { "namespace-body": { "rules": [26, 29, 34, 35, 36, 37, 38, 39, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "namespace": { "rules": [26, 29, 30, 31, 32, 33, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "class-body": { "rules": [26, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "class": { "rules": [26, 40, 41, 42, 43, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "acc_descr_multiline": { "rules": [11, 12, 26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "acc_descr": { "rules": [9, 26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "acc_title": { "rules": [7, 26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "callback_args": { "rules": [22, 23, 26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "callback_name": { "rules": [19, 20, 21, 26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "href": { "rules": [26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "struct": { "rules": [26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "generic": { "rules": [26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "bqstring": { "rules": [26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "string": { "rules": [24, 25, 26, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 26, 27, 28, 29, 39, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser12.parser = parser12; + classDiagram_default = parser12; + } + }); + + // src/diagrams/class/classTypes.ts + var visibilityValues, ClassMember; + var init_classTypes = __esm({ + "src/diagrams/class/classTypes.ts"() { + "use strict"; + init_diagramAPI(); + init_common(); + visibilityValues = ["#", "+", "~", "-", ""]; + ClassMember = class { + static { + __name(this, "ClassMember"); + } + constructor(input, memberType) { + this.memberType = memberType; + this.visibility = ""; + this.classifier = ""; + this.text = ""; + const sanitizedInput = sanitizeText(input, getConfig2()); + this.parseMember(sanitizedInput); + } + getDisplayDetails() { + let displayText = this.visibility + parseGenericTypes(this.id); + if (this.memberType === "method") { + displayText += `(${parseGenericTypes(this.parameters.trim())})`; + if (this.returnType) { + displayText += " : " + parseGenericTypes(this.returnType); + } + } + displayText = displayText.trim(); + const cssStyle = this.parseClassifier(); + return { + displayText, + cssStyle + }; + } + parseMember(input) { + let potentialClassifier = ""; + if (this.memberType === "method") { + const methodRegEx = /([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/; + const match3 = methodRegEx.exec(input); + if (match3) { + const detectedVisibility = match3[1] ? match3[1].trim() : ""; + if (visibilityValues.includes(detectedVisibility)) { + this.visibility = detectedVisibility; + } + this.id = match3[2]; + this.parameters = match3[3] ? match3[3].trim() : ""; + potentialClassifier = match3[4] ? match3[4].trim() : ""; + this.returnType = match3[5] ? match3[5].trim() : ""; + if (potentialClassifier === "") { + const lastChar = this.returnType.substring(this.returnType.length - 1); + if (/[$*]/.exec(lastChar)) { + potentialClassifier = lastChar; + this.returnType = this.returnType.substring(0, this.returnType.length - 1); + } + } + } + } else { + const length2 = input.length; + const firstChar = input.substring(0, 1); + const lastChar = input.substring(length2 - 1); + if (visibilityValues.includes(firstChar)) { + this.visibility = firstChar; + } + if (/[$*]/.exec(lastChar)) { + potentialClassifier = lastChar; + } + this.id = input.substring( + this.visibility === "" ? 0 : 1, + potentialClassifier === "" ? length2 : length2 - 1 + ); + } + this.classifier = potentialClassifier; + this.id = this.id.startsWith(" ") ? " " + this.id.trim() : this.id.trim(); + const combinedText = `${this.visibility ? "\\" + this.visibility : ""}${parseGenericTypes(this.id)}${this.memberType === "method" ? `(${parseGenericTypes(this.parameters)})${this.returnType ? " : " + parseGenericTypes(this.returnType) : ""}` : ""}`; + this.text = combinedText.replaceAll("<", "<").replaceAll(">", ">"); + if (this.text.startsWith("\\<")) { + this.text = this.text.replace("\\<", "~"); + } + } + parseClassifier() { + switch (this.classifier) { + case "*": + return "font-style:italic;"; + case "$": + return "text-decoration:underline;"; + default: + return ""; + } + } + }; + } + }); + + // src/diagrams/class/classDb.ts + var MERMAID_DOM_ID_PREFIX2, classCounter, sanitizeText4, ClassDB; + var init_classDb = __esm({ + "src/diagrams/class/classDb.ts"() { + "use strict"; + init_src32(); + init_logger(); + init_diagramAPI(); + init_common(); + init_utils2(); + init_commonDb(); + init_svgDrawCommon(); + init_classTypes(); + init_purify_es(); + MERMAID_DOM_ID_PREFIX2 = "classId-"; + classCounter = 0; + sanitizeText4 = /* @__PURE__ */ __name((txt) => common_default.sanitizeText(txt, getConfig2()), "sanitizeText"); + ClassDB = class _ClassDB { + constructor() { + this.relations = []; + this.classes = /* @__PURE__ */ new Map(); + this.styleClasses = /* @__PURE__ */ new Map(); + this.notes = /* @__PURE__ */ new Map(); + this.interfaces = []; + // private static classCounter = 0; + this.namespaces = /* @__PURE__ */ new Map(); + this.namespaceCounter = 0; + this.namespaceStack = []; + this.diagramId = ""; + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + this.functions = []; + this.lineType = { + LINE: 0, + DOTTED_LINE: 1 + }; + this.relationType = { + AGGREGATION: 0, + EXTENSION: 1, + COMPOSITION: 2, + DEPENDENCY: 3, + LOLLIPOP: 4 + }; + this.setupToolTips = /* @__PURE__ */ __name((element3) => { + const tooltipElem = createTooltip(); + const svg2 = select_default2(element3).select("svg"); + const nodes5 = svg2.selectAll("g").filter(function() { + return select_default2(this).attr("title") !== null; + }); + nodes5.on("mouseover", (event3) => { + const el = select_default2(event3.currentTarget); + const title2 = el.attr("title"); + if (!title2) { + return; + } + const rect3 = event3.currentTarget.getBoundingClientRect(); + tooltipElem.transition().duration(200).style("opacity", ".9"); + tooltipElem.html(purify.sanitize(title2)).style("left", `${window.scrollX + rect3.left + rect3.width / 2}px`).style("top", `${window.scrollY + rect3.bottom + 4}px`); + el.classed("hover", true); + }).on("mouseout", (event3) => { + tooltipElem.transition().duration(500).style("opacity", 0); + select_default2(event3.currentTarget).classed("hover", false); + }); + }, "setupToolTips"); + this.direction = "TB"; + this.setAccTitle = setAccTitle; + this.getAccTitle = getAccTitle; + this.setAccDescription = setAccDescription; + this.getAccDescription = getAccDescription; + this.setDiagramTitle = setDiagramTitle; + this.getDiagramTitle = getDiagramTitle; + this.getConfig = /* @__PURE__ */ __name(() => getConfig2().class, "getConfig"); + this.functions.push(this.setupToolTips.bind(this)); + this.clear(); + this.addRelation = this.addRelation.bind(this); + this.addClassesToNamespace = this.addClassesToNamespace.bind(this); + this.addNamespace = this.addNamespace.bind(this); + this.popNamespace = this.popNamespace.bind(this); + this.setCssClass = this.setCssClass.bind(this); + this.addMembers = this.addMembers.bind(this); + this.addClass = this.addClass.bind(this); + this.setClassLabel = this.setClassLabel.bind(this); + this.addAnnotation = this.addAnnotation.bind(this); + this.addMember = this.addMember.bind(this); + this.cleanupLabel = this.cleanupLabel.bind(this); + this.addNote = this.addNote.bind(this); + this.defineClass = this.defineClass.bind(this); + this.setDirection = this.setDirection.bind(this); + this.setLink = this.setLink.bind(this); + this.bindFunctions = this.bindFunctions.bind(this); + this.clear = this.clear.bind(this); + this.setTooltip = this.setTooltip.bind(this); + this.setClickEvent = this.setClickEvent.bind(this); + this.setCssStyle = this.setCssStyle.bind(this); + } + static { + __name(this, "ClassDB"); + } + splitClassNameAndType(_id) { + const id35 = common_default.sanitizeText(_id, getConfig2()); + let genericType = ""; + let className = id35; + if (id35.indexOf("~") > 0) { + const split = id35.split("~"); + className = sanitizeText4(split[0]); + genericType = sanitizeText4(split[1]); + } + return { className, type: genericType }; + } + setClassLabel(_id, label) { + const id35 = common_default.sanitizeText(_id, getConfig2()); + if (label) { + label = sanitizeText4(label); + } + const { className } = this.splitClassNameAndType(id35); + this.classes.get(className).label = label; + this.classes.get(className).text = `${label}${this.classes.get(className).type ? `<${this.classes.get(className).type}>` : ""}`; + } + /** + * Function called by parser when a node definition has been found. + * + * @param id - ID of the class to add + * @public + */ + addClass(_id) { + const id35 = common_default.sanitizeText(_id, getConfig2()); + const { className, type: type3 } = this.splitClassNameAndType(id35); + if (this.classes.has(className)) { + return; + } + const name = common_default.sanitizeText(className, getConfig2()); + this.classes.set(name, { + id: name, + type: type3, + label: name, + text: `${name}${type3 ? `<${type3}>` : ""}`, + shape: "classBox", + cssClasses: "default", + methods: [], + members: [], + annotations: [], + styles: [], + domId: MERMAID_DOM_ID_PREFIX2 + name + "-" + classCounter + }); + classCounter++; + } + addInterface(label, classId) { + const classInterface = { + id: `interface${this.interfaces.length}`, + label, + classId + }; + this.interfaces.push(classInterface); + } + /** + * Sets the diagram's SVG element ID, used to prefix domIds for uniqueness + * across multiple diagrams on the same page. + */ + setDiagramId(svgElementId) { + this.diagramId = svgElementId; + } + /** + * Function to lookup domId from id in the graph definition. + * When diagramId is set, returns the prefixed version for DOM uniqueness. + * + * @param id - class ID to lookup + * @public + */ + lookUpDomId(_id) { + const id35 = common_default.sanitizeText(_id, getConfig2()); + if (this.classes.has(id35)) { + const domId = this.classes.get(id35).domId; + return this.diagramId ? `${this.diagramId}-${domId}` : domId; + } + throw new Error("Class not found: " + id35); + } + clear() { + this.relations = []; + this.classes = /* @__PURE__ */ new Map(); + this.notes = /* @__PURE__ */ new Map(); + this.interfaces = []; + this.functions = []; + this.functions.push(this.setupToolTips.bind(this)); + this.namespaces = /* @__PURE__ */ new Map(); + this.namespaceCounter = 0; + this.namespaceStack = []; + this.diagramId = ""; + this.direction = "TB"; + clear(); + } + getClass(id35) { + return this.classes.get(id35); + } + getClasses() { + return this.classes; + } + getRelations() { + return this.relations; + } + getNote(id35) { + const key = typeof id35 === "number" ? `note${id35}` : id35; + return this.notes.get(key); + } + getNotes() { + return this.notes; + } + addRelation(classRelation) { + log.debug("Adding relation: " + JSON.stringify(classRelation)); + const invalidTypes = [ + this.relationType.LOLLIPOP, + this.relationType.AGGREGATION, + this.relationType.COMPOSITION, + this.relationType.DEPENDENCY, + this.relationType.EXTENSION + ]; + if (classRelation.relation.type1 === this.relationType.LOLLIPOP && !invalidTypes.includes(classRelation.relation.type2)) { + this.addClass(classRelation.id2); + this.addInterface(classRelation.id1, classRelation.id2); + classRelation.id1 = `interface${this.interfaces.length - 1}`; + } else if (classRelation.relation.type2 === this.relationType.LOLLIPOP && !invalidTypes.includes(classRelation.relation.type1)) { + this.addClass(classRelation.id1); + this.addInterface(classRelation.id2, classRelation.id1); + classRelation.id2 = `interface${this.interfaces.length - 1}`; + } else { + this.addClass(classRelation.id1); + this.addClass(classRelation.id2); + } + classRelation.id1 = this.splitClassNameAndType(classRelation.id1).className; + classRelation.id2 = this.splitClassNameAndType(classRelation.id2).className; + classRelation.relationTitle1 = common_default.sanitizeText( + classRelation.relationTitle1.trim(), + getConfig2() + ); + classRelation.relationTitle2 = common_default.sanitizeText( + classRelation.relationTitle2.trim(), + getConfig2() + ); + this.relations.push(classRelation); + } + /** + * Adds an annotation to the specified class Annotations mark special properties of the given type + * (like 'interface' or 'service') + * + * @param className - The class name + * @param annotation - The name of the annotation without any brackets + * @public + */ + addAnnotation(className, annotation) { + const validatedClassName = this.splitClassNameAndType(className).className; + this.classes.get(validatedClassName).annotations.push(annotation); + } + /** + * Adds a member to the specified class + * + * @param className - The class name + * @param member - The full name of the member. If the member is enclosed in `<>` it is + * treated as an annotation If the member is ending with a closing bracket ) it is treated as a + * method Otherwise the member will be treated as a normal property + * @public + */ + addMember(className, member) { + this.addClass(className); + const validatedClassName = this.splitClassNameAndType(className).className; + const theClass = this.classes.get(validatedClassName); + if (typeof member === "string") { + const memberString = member.trim(); + if (memberString.startsWith("<<") && memberString.endsWith(">>")) { + theClass.annotations.push(sanitizeText4(memberString.substring(2, memberString.length - 2))); + } else if (memberString.indexOf(")") > 0) { + theClass.methods.push(new ClassMember(memberString, "method")); + } else if (memberString) { + theClass.members.push(new ClassMember(memberString, "attribute")); + } + } + } + addMembers(className, members) { + if (Array.isArray(members)) { + members.reverse(); + members.forEach((member) => this.addMember(className, member)); + } + } + addNote(text4, className) { + const index = this.notes.size; + const note3 = { + id: `note${index}`, + class: className, + text: text4, + index + }; + this.notes.set(note3.id, note3); + return note3.id; + } + cleanupLabel(label) { + if (label.startsWith(":")) { + label = label.substring(1); + } + return sanitizeText4(label.trim()); + } + /** + * Called by parser when assigning cssClass to a class + * + * @param ids - Comma separated list of ids + * @param className - Class to add + */ + setCssClass(ids, className) { + ids.split(",").forEach((_id) => { + let id35 = _id; + if (/\d/.exec(_id[0])) { + id35 = MERMAID_DOM_ID_PREFIX2 + id35; + } + const classNode = this.classes.get(id35); + if (classNode) { + classNode.cssClasses += " " + className; + } + }); + } + defineClass(ids, style3) { + for (const id35 of ids) { + let styleClass = this.styleClasses.get(id35); + if (styleClass === void 0) { + styleClass = { id: id35, styles: [], textStyles: [] }; + this.styleClasses.set(id35, styleClass); + } + if (style3) { + style3.forEach((s2) => { + if (/color/.exec(s2)) { + const newStyle = s2.replace("fill", "bgFill"); + styleClass.textStyles.push(newStyle); + } + styleClass.styles.push(s2); + }); + } + this.classes.forEach((value2) => { + if (value2.cssClasses.includes(id35)) { + value2.styles.push(...style3.flatMap((s2) => s2.split(","))); + } + }); + } + } + /** + * Called by parser when a tooltip is found, e.g. a clickable element. + * + * @param ids - Comma separated list of ids + * @param tooltip - Tooltip to add + */ + setTooltip(ids, tooltip) { + ids.split(",").forEach((id35) => { + if (tooltip !== void 0) { + this.classes.get(id35).tooltip = sanitizeText4(tooltip); + } + }); + } + getTooltip(id35, namespace) { + if (namespace && this.namespaces.has(namespace)) { + return this.namespaces.get(namespace).classes.get(id35).tooltip; + } + return this.classes.get(id35).tooltip; + } + /** + * Called by parser when a link is found. Adds the URL to the vertex data. + * + * @param ids - Comma separated list of ids + * @param linkStr - URL to create a link for + * @param target - Target of the link, _blank by default as originally defined in the svgDraw.js file + */ + setLink(ids, linkStr, target) { + const config5 = getConfig2(); + ids.split(",").forEach((_id) => { + let id35 = _id; + if (/\d/.exec(_id[0])) { + id35 = MERMAID_DOM_ID_PREFIX2 + id35; + } + const theClass = this.classes.get(id35); + if (theClass) { + theClass.link = utils_default2.formatUrl(linkStr, config5); + if (config5.securityLevel === "sandbox") { + theClass.linkTarget = "_top"; + } else if (typeof target === "string") { + theClass.linkTarget = sanitizeText4(target); + } else { + theClass.linkTarget = "_blank"; + } + } + }); + this.setCssClass(ids, "clickable"); + } + /** + * Called by parser when a click definition is found. Registers an event handler. + * + * @param ids - Comma separated list of ids + * @param functionName - Function to be called on click + * @param functionArgs - Function args the function should be called with + */ + setClickEvent(ids, functionName, functionArgs) { + ids.split(",").forEach((id35) => { + this.setClickFunc(id35, functionName, functionArgs); + this.classes.get(id35).haveCallback = true; + }); + this.setCssClass(ids, "clickable"); + } + setClickFunc(_domId, functionName, functionArgs) { + const domId = common_default.sanitizeText(_domId, getConfig2()); + const config5 = getConfig2(); + if (config5.securityLevel !== "loose") { + return; + } + if (functionName === void 0) { + return; + } + const id35 = domId; + if (this.classes.has(id35)) { + let argList = []; + if (typeof functionArgs === "string") { + argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); + for (let i2 = 0; i2 < argList.length; i2++) { + let item = argList[i2].trim(); + if (item.startsWith('"') && item.endsWith('"')) { + item = item.substr(1, item.length - 2); + } + argList[i2] = item; + } + } + if (argList.length === 0) { + argList.push(id35); + } + this.functions.push(() => { + const elemId = this.lookUpDomId(id35); + const elem = document.querySelector(`[id="${elemId}"]`); + if (elem !== null) { + elem.addEventListener( + "click", + () => { + utils_default2.runFunc(functionName, ...argList); + }, + false + ); + } + }); + } + } + bindFunctions(element3) { + this.functions.forEach((fun) => { + fun(element3); + }); + } + // Utility function to escape HTML meta-characters + escapeHtml(str2) { + return str2.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); + } + getDirection() { + return this.direction; + } + setDirection(dir2) { + this.direction = dir2; + } + static resolveQualifiedId(id35, stack) { + const prefix = stack.at(-1); + return prefix ? `${prefix}.${id35}` : id35; + } + static getAncestorIds(qualifiedId) { + const parts = qualifiedId.split("."); + const ids = new Array(parts.length); + ids[0] = parts[0]; + for (let i2 = 1; i2 < parts.length; i2++) { + ids[i2] = `${ids[i2 - 1]}.${parts[i2]}`; + } + return ids; + } + createNamespaceNode(id35, label, parentId, explicit = false) { + return { + id: id35, + label, + classes: /* @__PURE__ */ new Map(), + notes: /* @__PURE__ */ new Map(), + children: /* @__PURE__ */ new Map(), + domId: MERMAID_DOM_ID_PREFIX2 + id35 + "-" + this.namespaceCounter++, + parent: parentId, + explicit + }; + } + linkParentChild(parentId, childId) { + const parent4 = this.namespaces.get(parentId); + const child = this.namespaces.get(childId); + if (!parent4 || !child) { + return; + } + if (!parent4.children.has(childId)) { + parent4.children.set(childId, child); + } + child.parent ??= parentId; + } + addNamespace(id35, label) { + const qualifiedId = _ClassDB.resolveQualifiedId(id35, this.namespaceStack); + this.namespaceStack.push(qualifiedId); + if (this.namespaces.has(qualifiedId)) { + const existing = this.namespaces.get(qualifiedId); + existing.explicit = true; + if (label) { + existing.label = label; + } + return qualifiedId; + } + const parts = qualifiedId.split("."); + const ancestorIds = _ClassDB.getAncestorIds(qualifiedId); + for (let i2 = 0; i2 < ancestorIds.length; i2++) { + const currentId = ancestorIds[i2]; + const parentId = i2 > 0 ? ancestorIds[i2 - 1] : void 0; + const isLeaf = i2 === ancestorIds.length - 1; + const nodeLabel = isLeaf && label ? label : parts[i2]; + if (!this.namespaces.has(currentId)) { + this.namespaces.set( + currentId, + this.createNamespaceNode(currentId, nodeLabel, parentId, isLeaf) + ); + } else if (isLeaf) { + this.namespaces.get(currentId).explicit = true; + } + if (parentId) { + this.linkParentChild(parentId, currentId); + } + } + return qualifiedId; + } + popNamespace() { + this.namespaceStack.pop(); + } + getNamespace(name) { + return this.namespaces.get(name); + } + getNamespaces() { + return this.namespaces; + } + /** + * Function called by parser when a namespace definition has been found. + * + * @param id - ID of the namespace to add + * @param classNames - IDs of the class to add + * @param noteNames - IDs of the notes to add + * @public + */ + addClassesToNamespace(id35, classNames, noteNames) { + if (!this.namespaces.has(id35)) { + return; + } + for (const name of classNames) { + const { className } = this.splitClassNameAndType(name); + const classNode = this.getClass(className); + classNode.parent = id35; + this.namespaces.get(id35).classes.set(className, classNode); + } + for (const noteName of noteNames) { + const noteNode = this.getNote(noteName); + noteNode.parent = id35; + this.namespaces.get(id35).notes.set(noteName, noteNode); + } + } + setCssStyle(id35, styles6) { + const thisClass = this.classes.get(id35); + if (!styles6 || !thisClass) { + return; + } + for (const s2 of styles6) { + if (s2.includes(",")) { + thisClass.styles.push(...s2.split(",")); + } else { + thisClass.styles.push(s2); + } + } + } + /** + * Gets the arrow marker for a type index + * + * @param type - The type to look for + * @returns The arrow marker + */ + getArrowMarker(type3) { + let marker; + switch (type3) { + case 0: + marker = "aggregation"; + break; + case 1: + marker = "extension"; + break; + case 2: + marker = "composition"; + break; + case 3: + marker = "dependency"; + break; + case 4: + marker = "lollipop"; + break; + default: + marker = "none"; + } + return marker; + } + /** + * Walks up the namespace tree from the given id and returns the nearest ancestor + * (or the id itself) that is marked as explicit. Used by compact rendering mode + * to reassign children to the nearest user-declared namespace. + */ + resolveExplicitAncestor(id35) { + let current = id35; + while (current) { + const ns = this.namespaces.get(current); + if (!ns) { + return void 0; + } + if (ns.explicit) { + return current; + } + current = ns.parent; + } + return void 0; + } + getData() { + const nodes5 = []; + const edges3 = []; + const config5 = getConfig2(); + const hierarchical = config5.class?.hierarchicalNamespaces ?? true; + for (const namespace of this.namespaces.values()) { + if (!hierarchical && !namespace.explicit) { + continue; + } + const node2 = { + id: namespace.id, + label: hierarchical ? namespace.label : namespace.id, + isGroup: true, + padding: config5.class.padding ?? 16, + // parent node must be one of [rect, roundedWithTitle, noteGroup, divider] + shape: "rect", + cssStyles: [], + look: config5.look, + parentId: hierarchical ? namespace.parent : void 0 + }; + nodes5.push(node2); + } + for (const classNode of this.classes.values()) { + const parentId = hierarchical ? classNode.parent : this.resolveExplicitAncestor(classNode.parent); + const node2 = { + ...classNode, + type: void 0, + isGroup: false, + parentId, + look: config5.look + }; + nodes5.push(node2); + } + for (const note3 of this.notes.values()) { + const noteParentId = hierarchical ? note3.parent : this.resolveExplicitAncestor(note3.parent); + const noteNode = { + id: note3.id, + label: note3.text, + isGroup: false, + shape: "note", + padding: config5.class.padding ?? 6, + cssStyles: [ + "text-align: left", + "white-space: nowrap", + `fill: ${config5.themeVariables.noteBkgColor}`, + `stroke: ${config5.themeVariables.noteBorderColor}` + ], + look: config5.look, + parentId: noteParentId, + labelType: "markdown" + }; + nodes5.push(noteNode); + const noteClassId = this.classes.get(note3.class)?.id; + if (noteClassId) { + const edge = { + id: `edgeNote${note3.index}`, + start: note3.id, + end: noteClassId, + type: "normal", + thickness: "normal", + classes: "relation", + arrowTypeStart: "none", + arrowTypeEnd: "none", + arrowheadStyle: "", + labelStyle: [""], + style: ["fill: none"], + pattern: "dotted", + look: config5.look + }; + edges3.push(edge); + } + } + for (const _interface of this.interfaces) { + const interfaceNode = { + id: _interface.id, + label: _interface.label, + isGroup: false, + shape: "rect", + cssStyles: ["opacity: 0;"], + look: config5.look + }; + nodes5.push(interfaceNode); + } + let cnt4 = 0; + for (const classRelation of this.relations) { + cnt4++; + const edge = { + id: getEdgeId(classRelation.id1, classRelation.id2, { + prefix: "id", + counter: cnt4 + }), + start: classRelation.id1, + end: classRelation.id2, + type: "normal", + label: classRelation.title, + labelpos: "c", + thickness: "normal", + classes: "relation", + arrowTypeStart: this.getArrowMarker(classRelation.relation.type1), + arrowTypeEnd: this.getArrowMarker(classRelation.relation.type2), + startLabelRight: classRelation.relationTitle1 === "none" ? "" : classRelation.relationTitle1, + endLabelLeft: classRelation.relationTitle2 === "none" ? "" : classRelation.relationTitle2, + arrowheadStyle: "", + labelStyle: ["display: inline-block"], + style: classRelation.style || "", + pattern: classRelation.relation.lineType == 1 ? "dashed" : "solid", + look: config5.look, + labelType: "markdown" + }; + edges3.push(edge); + } + return { nodes: nodes5, edges: edges3, other: {}, config: config5, direction: this.getDirection() }; + } + }; + } + }); + + // src/diagrams/class/styles.js + var getStyles10, styles_default9; + var init_styles9 = __esm({ + "src/diagrams/class/styles.js"() { + "use strict"; + init_globalStyles(); + getStyles10 = /* @__PURE__ */ __name((options2) => `g.classGroup text { + fill: ${options2.nodeBorder || options2.classText}; + stroke: none; + font-family: ${options2.fontFamily}; + font-size: 10px; + + .title { + font-weight: bolder; + } + +} + + .cluster-label text { + fill: ${options2.titleColor}; + } + .cluster-label span { + color: ${options2.titleColor}; + } + .cluster-label span p { + background-color: transparent; + } + + .cluster rect { + fill: ${options2.clusterBkg}; + stroke: ${options2.clusterBorder}; + stroke-width: 1px; + } + + .cluster text { + fill: ${options2.titleColor}; + } + + .cluster span { + color: ${options2.titleColor}; + } + +.nodeLabel, .edgeLabel { + color: ${options2.classText}; +} + +.noteLabel .nodeLabel, .noteLabel .edgeLabel { + color: ${options2.noteTextColor}; +} +.edgeLabel .label rect { + fill: ${options2.mainBkg}; +} +.label text { + fill: ${options2.classText}; +} + +.labelBkg { + background: ${options2.mainBkg}; +} +.edgeLabel .label span { + background: ${options2.mainBkg}; +} + +.classTitle { + font-weight: bolder; +} +.node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${options2.mainBkg}; + stroke: ${options2.nodeBorder}; + stroke-width: ${options2.strokeWidth}; + } + + +.divider { + stroke: ${options2.nodeBorder}; + stroke-width: 1; +} + +g.clickable { + cursor: pointer; +} + +g.classGroup rect { + fill: ${options2.mainBkg}; + stroke: ${options2.nodeBorder}; +} + +g.classGroup line { + stroke: ${options2.nodeBorder}; + stroke-width: 1; +} + +.classLabel .box { + stroke: none; + stroke-width: 0; + fill: ${options2.mainBkg}; + opacity: 0.5; +} + +.classLabel .label { + fill: ${options2.nodeBorder}; + font-size: 10px; +} + +.relation { + stroke: ${options2.lineColor}; + stroke-width: ${options2.strokeWidth}; + fill: none; +} + +.dashed-line{ + stroke-dasharray: 3; +} + +.dotted-line{ + stroke-dasharray: 1 2; +} + +[id$="-compositionStart"], .composition { + fill: ${options2.lineColor} !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +[id$="-compositionEnd"], .composition { + fill: ${options2.lineColor} !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +[id$="-dependencyStart"], .dependency { + fill: ${options2.lineColor} !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +[id$="-dependencyEnd"], .dependency { + fill: ${options2.lineColor} !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +[id$="-extensionStart"], .extension { + fill: transparent !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +[id$="-extensionEnd"], .extension { + fill: transparent !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +[id$="-aggregationStart"], .aggregation { + fill: transparent !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +[id$="-aggregationEnd"], .aggregation { + fill: transparent !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +[id$="-lollipopStart"], .lollipop { + fill: ${options2.mainBkg} !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +[id$="-lollipopEnd"], .lollipop { + fill: ${options2.mainBkg} !important; + stroke: ${options2.lineColor} !important; + stroke-width: 1; +} + +.edgeTerminals { + font-size: 11px; + line-height: initial; +} + +.classTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${options2.textColor}; +} + +.edgeLabel[data-look="neo"] { + background-color: ${options2.edgeLabelBackground}; + p { + background-color: ${options2.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${options2.edgeLabelBackground}; + fill: ${options2.edgeLabelBackground}; + } + text-align: center; +} + ${getIconStyles()} +`, "getStyles"); + styles_default9 = getStyles10; + } + }); + + // src/diagrams/class/classRenderer-v3-unified.ts + var getDir, getClasses2, draw12, classRenderer_v3_unified_default; + var init_classRenderer_v3_unified = __esm({ + "src/diagrams/class/classRenderer-v3-unified.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_insertElementsForSize(); + init_render2(); + init_setupViewPortForSVG(); + init_utils2(); + getDir = /* @__PURE__ */ __name((parsedItem, defaultDir = "TB") => { + if (!parsedItem.doc) { + return defaultDir; + } + let dir2 = defaultDir; + for (const parsedItemDoc of parsedItem.doc) { + if (parsedItemDoc.stmt === "dir") { + dir2 = parsedItemDoc.value; + } + } + return dir2; + }, "getDir"); + getClasses2 = /* @__PURE__ */ __name(function(text4, diagramObj) { + return diagramObj.db.getClasses(); + }, "getClasses"); + draw12 = /* @__PURE__ */ __name(async function(text4, id35, _version, diag) { + log.info("REF0:"); + log.info("Drawing class diagram (v3)", id35); + const { securityLevel, state: conf5, layout: layout7 } = getConfig2(); + diag.db.setDiagramId(id35); + const data4Layout = diag.db.getData(); + const svg2 = getDiagramElement(id35, securityLevel); + data4Layout.type = diag.type; + data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(layout7); + data4Layout.nodeSpacing = conf5?.nodeSpacing || 50; + data4Layout.rankSpacing = conf5?.rankSpacing || 50; + data4Layout.markers = ["aggregation", "extension", "composition", "dependency", "lollipop"]; + data4Layout.diagramId = id35; + await render6(data4Layout, svg2); + const padding2 = 8; + utils_default2.insertTitle( + svg2, + "classDiagramTitleText", + conf5?.titleTopMargin ?? 25, + diag.db.getDiagramTitle() + ); + setupViewPortForSVG(svg2, padding2, "classDiagram", conf5?.useMaxWidth ?? true); + }, "draw"); + classRenderer_v3_unified_default = { + getClasses: getClasses2, + draw: draw12, + getDir + }; + } + }); + + // src/diagrams/class/classDiagram.ts + var classDiagram_exports = {}; + __export(classDiagram_exports, { + diagram: () => diagram12 + }); + var diagram12; + var init_classDiagram2 = __esm({ + "src/diagrams/class/classDiagram.ts"() { + "use strict"; + init_classDiagram(); + init_classDb(); + init_styles9(); + init_classRenderer_v3_unified(); + diagram12 = { + parser: classDiagram_default, + get db() { + return new ClassDB(); + }, + renderer: classRenderer_v3_unified_default, + styles: styles_default9, + init: /* @__PURE__ */ __name((cnf) => { + if (!cnf.class) { + cnf.class = {}; + } + cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + }, "init") + }; + } + }); + + // src/diagrams/class/classDiagram-v2.ts + var classDiagram_v2_exports = {}; + __export(classDiagram_v2_exports, { + diagram: () => diagram13 + }); + var diagram13; + var init_classDiagram_v2 = __esm({ + "src/diagrams/class/classDiagram-v2.ts"() { + "use strict"; + init_classDiagram(); + init_classDb(); + init_styles9(); + init_classRenderer_v3_unified(); + diagram13 = { + parser: classDiagram_default, + get db() { + return new ClassDB(); + }, + renderer: classRenderer_v3_unified_default, + styles: styles_default9, + init: /* @__PURE__ */ __name((cnf) => { + if (!cnf.class) { + cnf.class = {}; + } + cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + }, "init") + }; + } + }); + + // src/diagrams/state/parser/stateDiagram.jison + var parser13, stateDiagram_default; + var init_stateDiagram = __esm({ + "src/diagrams/state/parser/stateDiagram.jison"() { + "use strict"; + parser13 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 2], $V1 = [1, 3], $V2 = [1, 4], $V3 = [2, 4], $V4 = [1, 9], $V5 = [1, 11], $V6 = [1, 16], $V7 = [1, 17], $V8 = [1, 18], $V9 = [1, 19], $Va = [1, 33], $Vb = [1, 20], $Vc = [1, 21], $Vd = [1, 22], $Ve = [1, 23], $Vf = [1, 24], $Vg = [1, 26], $Vh = [1, 27], $Vi = [1, 28], $Vj = [1, 29], $Vk = [1, 30], $Vl = [1, 31], $Vm = [1, 32], $Vn = [1, 35], $Vo = [1, 36], $Vp = [1, 37], $Vq = [1, 38], $Vr = [1, 34], $Vs = [1, 4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], $Vt = [1, 4, 5, 14, 15, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 39, 40, 41, 45, 48, 51, 52, 53, 54, 57], $Vu = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "SPACE": 4, "NL": 5, "SD": 6, "document": 7, "line": 8, "statement": 9, "classDefStatement": 10, "styleStatement": 11, "cssClassStatement": 12, "idStatement": 13, "DESCR": 14, "-->": 15, "HIDE_EMPTY": 16, "scale": 17, "WIDTH": 18, "COMPOSIT_STATE": 19, "STRUCT_START": 20, "STRUCT_STOP": 21, "STATE_DESCR": 22, "AS": 23, "ID": 24, "FORK": 25, "JOIN": 26, "CHOICE": 27, "CONCURRENT": 28, "note": 29, "notePosition": 30, "NOTE_TEXT": 31, "direction": 32, "acc_title": 33, "acc_title_value": 34, "acc_descr": 35, "acc_descr_value": 36, "acc_descr_multiline_value": 37, "CLICK": 38, "STRING": 39, "HREF": 40, "classDef": 41, "CLASSDEF_ID": 42, "CLASSDEF_STYLEOPTS": 43, "DEFAULT": 44, "style": 45, "STYLE_IDS": 46, "STYLEDEF_STYLEOPTS": 47, "class": 48, "CLASSENTITY_IDS": 49, "STYLECLASS": 50, "direction_tb": 51, "direction_bt": 52, "direction_rl": 53, "direction_lr": 54, "eol": 55, ";": 56, "EDGE_STATE": 57, "STYLE_SEPARATOR": 58, "left_of": 59, "right_of": 60, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 14: "DESCR", 15: "-->", 16: "HIDE_EMPTY", 17: "scale", 18: "WIDTH", 19: "COMPOSIT_STATE", 20: "STRUCT_START", 21: "STRUCT_STOP", 22: "STATE_DESCR", 23: "AS", 24: "ID", 25: "FORK", 26: "JOIN", 27: "CHOICE", 28: "CONCURRENT", 29: "note", 31: "NOTE_TEXT", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 38: "CLICK", 39: "STRING", 40: "HREF", 41: "classDef", 42: "CLASSDEF_ID", 43: "CLASSDEF_STYLEOPTS", 44: "DEFAULT", 45: "style", 46: "STYLE_IDS", 47: "STYLEDEF_STYLEOPTS", 48: "class", 49: "CLASSENTITY_IDS", 50: "STYLECLASS", 51: "direction_tb", 52: "direction_bt", 53: "direction_rl", 54: "direction_lr", 56: ";", 57: "EDGE_STATE", 58: "STYLE_SEPARATOR", 59: "left_of", 60: "right_of" }, + productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 3], [9, 4], [9, 1], [9, 2], [9, 1], [9, 4], [9, 3], [9, 6], [9, 1], [9, 1], [9, 1], [9, 1], [9, 4], [9, 4], [9, 1], [9, 2], [9, 2], [9, 1], [9, 5], [9, 5], [10, 3], [10, 3], [11, 3], [12, 3], [32, 1], [32, 1], [32, 1], [32, 1], [55, 1], [55, 1], [13, 1], [13, 1], [13, 3], [13, 3], [30, 1], [30, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 3: + yy.setRootDoc($$[$0]); + return $$[$0]; + break; + case 4: + this.$ = []; + break; + case 5: + if ($$[$0] != "nl") { + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + } + break; + case 6: + case 7: + this.$ = $$[$0]; + break; + case 8: + this.$ = "nl"; + break; + case 12: + this.$ = $$[$0]; + break; + case 13: + const stateStmt = $$[$0 - 1]; + stateStmt.description = yy.trimColon($$[$0]); + this.$ = stateStmt; + break; + case 14: + this.$ = { stmt: "relation", state1: $$[$0 - 2], state2: $$[$0] }; + break; + case 15: + const relDescription = yy.trimColon($$[$0]); + this.$ = { stmt: "relation", state1: $$[$0 - 3], state2: $$[$0 - 1], description: relDescription }; + break; + case 19: + this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: "", doc: $$[$0 - 1] }; + break; + case 20: + var id35 = $$[$0]; + var description = $$[$0 - 2].trim(); + if ($$[$0].match(":")) { + var parts = $$[$0].split(":"); + id35 = parts[0]; + description = [description, parts[1]]; + } + this.$ = { stmt: "state", id: id35, type: "default", description }; + break; + case 21: + this.$ = { stmt: "state", id: $$[$0 - 3], type: "default", description: $$[$0 - 5], doc: $$[$0 - 1] }; + break; + case 22: + this.$ = { stmt: "state", id: $$[$0], type: "fork" }; + break; + case 23: + this.$ = { stmt: "state", id: $$[$0], type: "join" }; + break; + case 24: + this.$ = { stmt: "state", id: $$[$0], type: "choice" }; + break; + case 25: + this.$ = { stmt: "state", id: yy.getDividerId(), type: "divider" }; + break; + case 26: + this.$ = { stmt: "state", id: $$[$0 - 1].trim(), note: { position: $$[$0 - 2].trim(), text: $$[$0].trim() } }; + break; + case 29: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 30: + case 31: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 32: + this.$ = { + stmt: "click", + id: $$[$0 - 3], + url: $$[$0 - 2], + tooltip: $$[$0 - 1] + }; + break; + case 33: + this.$ = { + stmt: "click", + id: $$[$0 - 3], + url: $$[$0 - 1], + tooltip: "" + }; + break; + case 34: + case 35: + this.$ = { stmt: "classDef", id: $$[$0 - 1].trim(), classes: $$[$0].trim() }; + break; + case 36: + this.$ = { stmt: "style", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() }; + break; + case 37: + this.$ = { stmt: "applyClass", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() }; + break; + case 38: + yy.setDirection("TB"); + this.$ = { stmt: "dir", value: "TB" }; + break; + case 39: + yy.setDirection("BT"); + this.$ = { stmt: "dir", value: "BT" }; + break; + case 40: + yy.setDirection("RL"); + this.$ = { stmt: "dir", value: "RL" }; + break; + case 41: + yy.setDirection("LR"); + this.$ = { stmt: "dir", value: "LR" }; + break; + case 44: + case 45: + this.$ = { stmt: "state", id: $$[$0].trim(), type: "default", description: "" }; + break; + case 46: + this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" }; + break; + case 47: + this.$ = { stmt: "state", id: $$[$0 - 2].trim(), classes: [$$[$0].trim()], type: "default", description: "" }; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: $V0, 5: $V1, 6: $V2 }, { 1: [3] }, { 3: 5, 4: $V0, 5: $V1, 6: $V2 }, { 3: 6, 4: $V0, 5: $V1, 6: $V2 }, o2([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 41, 45, 48, 51, 52, 53, 54, 57], $V3, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o2($Vs, [2, 5]), { 9: 39, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o2($Vs, [2, 7]), o2($Vs, [2, 8]), o2($Vs, [2, 9]), o2($Vs, [2, 10]), o2($Vs, [2, 11]), o2($Vs, [2, 12], { 14: [1, 40], 15: [1, 41] }), o2($Vs, [2, 16]), { 18: [1, 42] }, o2($Vs, [2, 18], { 20: [1, 43] }), { 23: [1, 44] }, o2($Vs, [2, 22]), o2($Vs, [2, 23]), o2($Vs, [2, 24]), o2($Vs, [2, 25]), { 30: 45, 31: [1, 46], 59: [1, 47], 60: [1, 48] }, o2($Vs, [2, 28]), { 34: [1, 49] }, { 36: [1, 50] }, o2($Vs, [2, 31]), { 13: 51, 24: $Va, 57: $Vr }, { 42: [1, 52], 44: [1, 53] }, { 46: [1, 54] }, { 49: [1, 55] }, o2($Vt, [2, 44], { 58: [1, 56] }), o2($Vt, [2, 45], { 58: [1, 57] }), o2($Vs, [2, 38]), o2($Vs, [2, 39]), o2($Vs, [2, 40]), o2($Vs, [2, 41]), o2($Vs, [2, 6]), o2($Vs, [2, 13]), { 13: 58, 24: $Va, 57: $Vr }, o2($Vs, [2, 17]), o2($Vu, $V3, { 7: 59 }), { 24: [1, 60] }, { 24: [1, 61] }, { 23: [1, 62] }, { 24: [2, 48] }, { 24: [2, 49] }, o2($Vs, [2, 29]), o2($Vs, [2, 30]), { 39: [1, 63], 40: [1, 64] }, { 43: [1, 65] }, { 43: [1, 66] }, { 47: [1, 67] }, { 50: [1, 68] }, { 24: [1, 69] }, { 24: [1, 70] }, o2($Vs, [2, 14], { 14: [1, 71] }), { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 72], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o2($Vs, [2, 20], { 20: [1, 73] }), { 31: [1, 74] }, { 24: [1, 75] }, { 39: [1, 76] }, { 39: [1, 77] }, o2($Vs, [2, 34]), o2($Vs, [2, 35]), o2($Vs, [2, 36]), o2($Vs, [2, 37]), o2($Vt, [2, 46]), o2($Vt, [2, 47]), o2($Vs, [2, 15]), o2($Vs, [2, 19]), o2($Vu, $V3, { 7: 78 }), o2($Vs, [2, 26]), o2($Vs, [2, 27]), { 5: [1, 79] }, { 5: [1, 80] }, { 4: $V4, 5: $V5, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: $V6, 17: $V7, 19: $V8, 21: [1, 81], 22: $V9, 24: $Va, 25: $Vb, 26: $Vc, 27: $Vd, 28: $Ve, 29: $Vf, 32: 25, 33: $Vg, 35: $Vh, 37: $Vi, 38: $Vj, 41: $Vk, 45: $Vl, 48: $Vm, 51: $Vn, 52: $Vo, 53: $Vp, 54: $Vq, 57: $Vr }, o2($Vs, [2, 32]), o2($Vs, [2, 33]), o2($Vs, [2, 21])], + defaultActions: { 5: [2, 1], 6: [2, 2], 47: [2, 48], 48: [2, 49] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + function processId() { + const idx = yy_.yytext.indexOf("%%"); + if (idx === 0) { + return false; + } + if (idx > 0) { + const before = yy_.yytext.slice(0, idx); + const after = yy_.yytext.slice(idx); + if (after) { + yy.lexer.unput(after); + } + yy_.yytext = before; + } + return true; + } + __name(processId, "processId"); + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + return 38; + break; + case 1: + return 40; + break; + case 2: + return 39; + break; + case 3: + return 44; + break; + case 4: + return 51; + break; + case 5: + return 52; + break; + case 6: + return 53; + break; + case 7: + return 54; + break; + case 8: + return 5; + break; + case 9: + break; + case 10: + break; + case 11: + break; + case 12: + break; + case 13: + this.pushState("SCALE"); + return 17; + break; + case 14: + return 18; + break; + case 15: + this.popState(); + break; + case 16: + this.begin("acc_title"); + return 33; + break; + case 17: + this.popState(); + return "acc_title_value"; + break; + case 18: + this.begin("acc_descr"); + return 35; + break; + case 19: + this.popState(); + return "acc_descr_value"; + break; + case 20: + this.begin("acc_descr_multiline"); + break; + case 21: + this.popState(); + break; + case 22: + return "acc_descr_multiline_value"; + break; + case 23: + this.pushState("CLASSDEF"); + return 41; + break; + case 24: + this.popState(); + this.pushState("CLASSDEFID"); + return "DEFAULT_CLASSDEF_ID"; + break; + case 25: + this.popState(); + this.pushState("CLASSDEFID"); + return 42; + break; + case 26: + this.popState(); + return 43; + break; + case 27: + this.pushState("CLASS"); + return 48; + break; + case 28: + this.popState(); + this.pushState("CLASS_STYLE"); + return 49; + break; + case 29: + this.popState(); + return 50; + break; + case 30: + this.pushState("STYLE"); + return 45; + break; + case 31: + this.popState(); + this.pushState("STYLEDEF_STYLES"); + return 46; + break; + case 32: + this.popState(); + return 47; + break; + case 33: + this.pushState("SCALE"); + return 17; + break; + case 34: + return 18; + break; + case 35: + this.popState(); + break; + case 36: + this.pushState("STATE"); + break; + case 37: + this.popState(); + yy_.yytext = yy_.yytext.slice(0, -8).trim(); + return 25; + break; + case 38: + this.popState(); + yy_.yytext = yy_.yytext.slice(0, -8).trim(); + return 26; + break; + case 39: + this.popState(); + yy_.yytext = yy_.yytext.slice(0, -10).trim(); + return 27; + break; + case 40: + this.popState(); + yy_.yytext = yy_.yytext.slice(0, -8).trim(); + return 25; + break; + case 41: + this.popState(); + yy_.yytext = yy_.yytext.slice(0, -8).trim(); + return 26; + break; + case 42: + this.popState(); + yy_.yytext = yy_.yytext.slice(0, -10).trim(); + return 27; + break; + case 43: + return 51; + break; + case 44: + return 52; + break; + case 45: + return 53; + break; + case 46: + return 54; + break; + case 47: + this.pushState("STATE_STRING"); + break; + case 48: + this.pushState("STATE_ID"); + return "AS"; + break; + case 49: + if (!processId()) return; + this.popState(); + return "ID"; + break; + case 50: + this.popState(); + break; + case 51: + return "STATE_DESCR"; + break; + case 52: + return 19; + break; + case 53: + this.popState(); + break; + case 54: + this.popState(); + this.pushState("struct"); + return 20; + break; + case 55: + this.popState(); + return 21; + break; + case 56: + break; + case 57: + this.begin("NOTE"); + return 29; + break; + case 58: + this.popState(); + this.pushState("NOTE_ID"); + return 59; + break; + case 59: + this.popState(); + this.pushState("NOTE_ID"); + return 60; + break; + case 60: + this.popState(); + this.pushState("FLOATING_NOTE"); + break; + case 61: + this.popState(); + this.pushState("FLOATING_NOTE_ID"); + return "AS"; + break; + case 62: + break; + case 63: + return "NOTE_TEXT"; + break; + case 64: + if (!processId()) return; + this.popState(); + return "ID"; + break; + case 65: + if (!processId()) return; + this.popState(); + this.pushState("NOTE_TEXT"); + return 24; + break; + case 66: + this.popState(); + yy_.yytext = yy_.yytext.substr(2).trim(); + return 31; + break; + case 67: + this.popState(); + yy_.yytext = yy_.yytext.slice(0, -8).trim(); + return 31; + break; + case 68: + return 6; + break; + case 69: + return 6; + break; + case 70: + return 16; + break; + case 71: + return 57; + break; + case 72: + if (!processId()) return; + return 24; + break; + case 73: + yy_.yytext = yy_.yytext.trim(); + return 14; + break; + case 74: + return 15; + break; + case 75: + return 28; + break; + case 76: + return 58; + break; + case 77: + return 5; + break; + case 78: + return "INVALID"; + break; + } + }, "anonymous"), + rules: [/^(?:click\b)/i, /^(?:href\b)/i, /^(?:"[^"]*")/i, /^(?:default\b)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:classDef\s+)/i, /^(?:DEFAULT\s+)/i, /^(?:\w+\s+)/i, /^(?:[^\n]*)/i, /^(?:class\s+)/i, /^(?:(\w+)+((,\s*\w+)*))/i, /^(?:[^\n]*)/i, /^(?:style\s+)/i, /^(?:[\w,]+\s+)/i, /^(?:[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:state\s+)/i, /^(?:.*<>)/i, /^(?:.*<>)/i, /^(?:.*<>)/i, /^(?:.*\[\[fork\]\])/i, /^(?:.*\[\[join\]\])/i, /^(?:.*\[\[choice\]\])/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:["])/i, /^(?:\s*as\s+)/i, /^(?:[^\n\{]*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n\s\{]+)/i, /^(?:\n)/i, /^(?:\{)/i, /^(?:\})/i, /^(?:[\n])/i, /^(?:note\s+)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:")/i, /^(?:\s*as\s*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n]*)/i, /^(?:\s*[^:\n\s\-]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:[\s\S]*?\n\s*end note\b)/i, /^(?:stateDiagram\s+)/i, /^(?:stateDiagram-v2\s+)/i, /^(?:hide empty description\b)/i, /^(?:\[\*\])/i, /^(?:[^:\n\s\-\{]+)/i, /^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i, /^(?:-->)/i, /^(?:--)/i, /^(?::::)/i, /^(?:$)/i, /^(?:.)/i], + conditions: { "LINE": { "rules": [10, 11, 12], "inclusive": false }, "struct": { "rules": [10, 11, 12, 23, 27, 30, 36, 43, 44, 45, 46, 55, 56, 57, 71, 72, 73, 74, 75, 76], "inclusive": false }, "FLOATING_NOTE_ID": { "rules": [64], "inclusive": false }, "FLOATING_NOTE": { "rules": [61, 62, 63], "inclusive": false }, "NOTE_TEXT": { "rules": [66, 67], "inclusive": false }, "NOTE_ID": { "rules": [65], "inclusive": false }, "NOTE": { "rules": [58, 59, 60], "inclusive": false }, "STYLEDEF_STYLEOPTS": { "rules": [], "inclusive": false }, "STYLEDEF_STYLES": { "rules": [32], "inclusive": false }, "STYLE_IDS": { "rules": [], "inclusive": false }, "STYLE": { "rules": [31], "inclusive": false }, "CLASS_STYLE": { "rules": [29], "inclusive": false }, "CLASS": { "rules": [28], "inclusive": false }, "CLASSDEFID": { "rules": [26], "inclusive": false }, "CLASSDEF": { "rules": [24, 25], "inclusive": false }, "acc_descr_multiline": { "rules": [21, 22], "inclusive": false }, "acc_descr": { "rules": [19], "inclusive": false }, "acc_title": { "rules": [17], "inclusive": false }, "SCALE": { "rules": [14, 15, 34, 35], "inclusive": false }, "ALIAS": { "rules": [], "inclusive": false }, "STATE_ID": { "rules": [49], "inclusive": false }, "STATE_STRING": { "rules": [50, 51], "inclusive": false }, "FORK_STATE": { "rules": [], "inclusive": false }, "STATE": { "rules": [10, 11, 12, 37, 38, 39, 40, 41, 42, 47, 48, 52, 53, 54], "inclusive": false }, "ID": { "rules": [10, 11, 12], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 16, 18, 20, 23, 27, 30, 33, 36, 54, 57, 68, 69, 70, 71, 72, 73, 74, 76, 77, 78], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser13.parser = parser13; + stateDiagram_default = parser13; + } + }); + + // src/diagrams/state/stateCommon.ts + var DEFAULT_DIAGRAM_DIRECTION, DEFAULT_NESTED_DOC_DIR, STMT_DIRECTION, STMT_STATE, STMT_ROOT, STMT_RELATION, STMT_CLASSDEF, STMT_STYLEDEF, STMT_APPLYCLASS, DEFAULT_STATE_TYPE, DIVIDER_TYPE, G_EDGE_STYLE, G_EDGE_ARROWHEADSTYLE, G_EDGE_LABELPOS, G_EDGE_LABELTYPE, G_EDGE_THICKNESS, SHAPE_STATE, SHAPE_STATE_WITH_DESC, SHAPE_START, SHAPE_END, SHAPE_DIVIDER, SHAPE_GROUP, SHAPE_NOTE, SHAPE_NOTEGROUP, CSS_DIAGRAM, CSS_STATE, CSS_DIAGRAM_STATE, CSS_EDGE, CSS_NOTE, CSS_NOTE_EDGE, CSS_EDGE_NOTE_EDGE, CSS_DIAGRAM_NOTE, CSS_CLUSTER, CSS_DIAGRAM_CLUSTER, CSS_CLUSTER_ALT, CSS_DIAGRAM_CLUSTER_ALT, PARENT2, NOTE, DOMID_STATE, DOMID_TYPE_SPACER, NOTE_ID, PARENT_ID; + var init_stateCommon = __esm({ + "src/diagrams/state/stateCommon.ts"() { + "use strict"; + DEFAULT_DIAGRAM_DIRECTION = "TB"; + DEFAULT_NESTED_DOC_DIR = "TB"; + STMT_DIRECTION = "dir"; + STMT_STATE = "state"; + STMT_ROOT = "root"; + STMT_RELATION = "relation"; + STMT_CLASSDEF = "classDef"; + STMT_STYLEDEF = "style"; + STMT_APPLYCLASS = "applyClass"; + DEFAULT_STATE_TYPE = "default"; + DIVIDER_TYPE = "divider"; + G_EDGE_STYLE = "fill:none"; + G_EDGE_ARROWHEADSTYLE = "fill: #333"; + G_EDGE_LABELPOS = "c"; + G_EDGE_LABELTYPE = "markdown"; + G_EDGE_THICKNESS = "normal"; + SHAPE_STATE = "rect"; + SHAPE_STATE_WITH_DESC = "rectWithTitle"; + SHAPE_START = "stateStart"; + SHAPE_END = "stateEnd"; + SHAPE_DIVIDER = "divider"; + SHAPE_GROUP = "roundedWithTitle"; + SHAPE_NOTE = "note"; + SHAPE_NOTEGROUP = "noteGroup"; + CSS_DIAGRAM = "statediagram"; + CSS_STATE = "state"; + CSS_DIAGRAM_STATE = `${CSS_DIAGRAM}-${CSS_STATE}`; + CSS_EDGE = "transition"; + CSS_NOTE = "note"; + CSS_NOTE_EDGE = "note-edge"; + CSS_EDGE_NOTE_EDGE = `${CSS_EDGE} ${CSS_NOTE_EDGE}`; + CSS_DIAGRAM_NOTE = `${CSS_DIAGRAM}-${CSS_NOTE}`; + CSS_CLUSTER = "cluster"; + CSS_DIAGRAM_CLUSTER = `${CSS_DIAGRAM}-${CSS_CLUSTER}`; + CSS_CLUSTER_ALT = "cluster-alt"; + CSS_DIAGRAM_CLUSTER_ALT = `${CSS_DIAGRAM}-${CSS_CLUSTER_ALT}`; + PARENT2 = "parent"; + NOTE = "note"; + DOMID_STATE = "state"; + DOMID_TYPE_SPACER = "----"; + NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`; + PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT2}`; + } + }); + + // src/diagrams/state/dataFetcher.ts + function stateDomId(itemId = "", counter2 = 0, type3 = "", typeSpacer = DOMID_TYPE_SPACER) { + const typeStr = type3 !== null && type3.length > 0 ? `${typeSpacer}${type3}` : ""; + return `${DOMID_STATE}-${itemId}${typeStr}-${counter2}`; + } + function insertOrUpdateNode(nodes5, nodeData2, classes3) { + if (!nodeData2.id || nodeData2.id === "" || nodeData2.id === "") { + return; + } + if (nodeData2.cssClasses) { + if (!Array.isArray(nodeData2.cssCompiledStyles)) { + nodeData2.cssCompiledStyles = []; + } + nodeData2.cssClasses.split(" ").forEach((cssClass) => { + const classDef = classes3.get(cssClass); + if (classDef) { + nodeData2.cssCompiledStyles = [...nodeData2.cssCompiledStyles ?? [], ...classDef.styles]; + } + }); + } + const existingNodeData = nodes5.find((node2) => node2.id === nodeData2.id); + if (existingNodeData) { + Object.assign(existingNodeData, nodeData2); + } else { + nodes5.push(nodeData2); + } + } + function getClassesFromDbInfo(dbInfoItem) { + return dbInfoItem?.classes?.join(" ") ?? ""; + } + function getStylesFromDbInfo(dbInfoItem) { + return dbInfoItem?.styles ?? []; + } + var nodeDb, graphItemCount, setupDoc, getDir2, dataFetcher, reset3; + var init_dataFetcher = __esm({ + "src/diagrams/state/dataFetcher.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_common(); + init_stateCommon(); + nodeDb = /* @__PURE__ */ new Map(); + graphItemCount = 0; + __name(stateDomId, "stateDomId"); + setupDoc = /* @__PURE__ */ __name((parentParsedItem, doc, diagramStates, nodes5, edges3, altFlag, look, classes3) => { + log.trace("items", doc); + doc.forEach((item) => { + switch (item.stmt) { + case STMT_STATE: + dataFetcher(parentParsedItem, item, diagramStates, nodes5, edges3, altFlag, look, classes3); + break; + case DEFAULT_STATE_TYPE: + dataFetcher(parentParsedItem, item, diagramStates, nodes5, edges3, altFlag, look, classes3); + break; + case STMT_RELATION: + { + dataFetcher( + parentParsedItem, + item.state1, + diagramStates, + nodes5, + edges3, + altFlag, + look, + classes3 + ); + dataFetcher( + parentParsedItem, + item.state2, + diagramStates, + nodes5, + edges3, + altFlag, + look, + classes3 + ); + const isNeo = look === "neo"; + const edgeData2 = { + id: "edge" + graphItemCount, + start: item.state1.id, + end: item.state2.id, + arrowhead: "normal", + arrowTypeEnd: isNeo ? "arrow_barb_neo" : "arrow_barb", + style: G_EDGE_STYLE, + labelStyle: "", + label: common_default.sanitizeText(item.description ?? "", getConfig2()), + arrowheadStyle: G_EDGE_ARROWHEADSTYLE, + labelpos: G_EDGE_LABELPOS, + labelType: G_EDGE_LABELTYPE, + thickness: G_EDGE_THICKNESS, + classes: CSS_EDGE, + look + }; + edges3.push(edgeData2); + graphItemCount++; + } + break; + } + }); + }, "setupDoc"); + getDir2 = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => { + let dir2 = defaultDir; + if (parsedItem.doc) { + for (const parsedItemDoc of parsedItem.doc) { + if (parsedItemDoc.stmt === "dir") { + dir2 = parsedItemDoc.value; + } + } + } + return dir2; + }, "getDir"); + __name(insertOrUpdateNode, "insertOrUpdateNode"); + __name(getClassesFromDbInfo, "getClassesFromDbInfo"); + __name(getStylesFromDbInfo, "getStylesFromDbInfo"); + dataFetcher = /* @__PURE__ */ __name((parent4, parsedItem, diagramStates, nodes5, edges3, altFlag, look, classes3) => { + const itemId = parsedItem.id; + const dbState = diagramStates.get(itemId); + const classStr = getClassesFromDbInfo(dbState); + const style3 = getStylesFromDbInfo(dbState); + const config5 = getConfig2(); + log.info("dataFetcher parsedItem", parsedItem, dbState, style3); + if (itemId !== "root") { + let shape = SHAPE_STATE; + if (parsedItem.start === true) { + shape = SHAPE_START; + } else if (parsedItem.start === false) { + shape = SHAPE_END; + } + if (parsedItem.type !== DEFAULT_STATE_TYPE) { + shape = parsedItem.type; + } + if (!nodeDb.get(itemId)) { + nodeDb.set(itemId, { + id: itemId, + shape, + description: common_default.sanitizeText(itemId, config5), + cssClasses: `${classStr} ${CSS_DIAGRAM_STATE}`, + cssStyles: style3 + }); + } + const newNode = nodeDb.get(itemId); + if (parsedItem.description) { + if (Array.isArray(newNode.description)) { + newNode.shape = SHAPE_STATE_WITH_DESC; + newNode.description.push(parsedItem.description); + } else { + if (newNode.description?.length && newNode.description.length > 0) { + newNode.shape = SHAPE_STATE_WITH_DESC; + if (newNode.description === itemId) { + newNode.description = [parsedItem.description]; + } else { + newNode.description = [newNode.description, parsedItem.description]; + } + } else { + newNode.shape = SHAPE_STATE; + newNode.description = parsedItem.description; + } + } + newNode.description = common_default.sanitizeTextOrArray(newNode.description, config5); + } + if (newNode.description?.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) { + if (newNode.type === "group") { + newNode.shape = SHAPE_GROUP; + } else { + newNode.shape = SHAPE_STATE; + } + } + if (!newNode.type && parsedItem.doc) { + log.info("Setting cluster for XCX", itemId, getDir2(parsedItem)); + newNode.type = "group"; + newNode.isGroup = true; + newNode.dir = getDir2(parsedItem); + newNode.shape = parsedItem.type === DIVIDER_TYPE ? SHAPE_DIVIDER : SHAPE_GROUP; + newNode.cssClasses = `${newNode.cssClasses} ${CSS_DIAGRAM_CLUSTER} ${altFlag ? CSS_DIAGRAM_CLUSTER_ALT : ""}`; + } + const nodeData2 = { + labelStyle: "", + shape: newNode.shape, + label: newNode.description, + cssClasses: newNode.cssClasses, + cssCompiledStyles: [], + cssStyles: newNode.cssStyles, + id: itemId, + dir: newNode.dir, + domId: stateDomId(itemId, graphItemCount), + type: newNode.type, + isGroup: newNode.type === "group", + padding: 8, + rx: 10, + ry: 10, + look, + labelType: "markdown" + }; + if (nodeData2.shape === SHAPE_DIVIDER) { + nodeData2.label = ""; + } + if (parent4 && parent4.id !== "root") { + log.trace("Setting node ", itemId, " to be child of its parent ", parent4.id); + nodeData2.parentId = parent4.id; + } + nodeData2.centerLabel = true; + if (parsedItem.note) { + const noteData = { + labelStyle: "", + shape: SHAPE_NOTE, + label: parsedItem.note.text, + labelType: "markdown", + cssClasses: CSS_DIAGRAM_NOTE, + // useHtmlLabels: false, + cssStyles: [], + cssCompiledStyles: [], + id: itemId + NOTE_ID + "-" + graphItemCount, + domId: stateDomId(itemId, graphItemCount, NOTE), + type: newNode.type, + isGroup: newNode.type === "group", + padding: config5.flowchart?.padding, + look, + position: parsedItem.note.position + }; + const parentNodeId = itemId + PARENT_ID; + const groupData = { + labelStyle: "", + shape: SHAPE_NOTEGROUP, + label: parsedItem.note.text, + cssClasses: newNode.cssClasses, + cssStyles: [], + id: itemId + PARENT_ID, + domId: stateDomId(itemId, graphItemCount, PARENT2), + type: "group", + isGroup: true, + padding: 16, + //getConfig().flowchart.padding + look, + position: parsedItem.note.position + }; + graphItemCount++; + groupData.id = parentNodeId; + noteData.parentId = parentNodeId; + insertOrUpdateNode(nodes5, groupData, classes3); + insertOrUpdateNode(nodes5, noteData, classes3); + insertOrUpdateNode(nodes5, nodeData2, classes3); + let from2 = itemId; + let to = noteData.id; + if (parsedItem.note.position === "left of") { + from2 = noteData.id; + to = itemId; + } + edges3.push({ + id: from2 + "-" + to, + start: from2, + end: to, + arrowhead: "none", + arrowTypeEnd: "", + style: G_EDGE_STYLE, + labelStyle: "", + classes: CSS_EDGE_NOTE_EDGE, + arrowheadStyle: G_EDGE_ARROWHEADSTYLE, + labelpos: G_EDGE_LABELPOS, + labelType: G_EDGE_LABELTYPE, + thickness: G_EDGE_THICKNESS, + look + }); + } else { + insertOrUpdateNode(nodes5, nodeData2, classes3); + } + } + if (parsedItem.doc) { + log.trace("Adding nodes children "); + setupDoc(parsedItem, parsedItem.doc, diagramStates, nodes5, edges3, !altFlag, look, classes3); + } + }, "dataFetcher"); + reset3 = /* @__PURE__ */ __name(() => { + nodeDb.clear(); + graphItemCount = 0; + }, "reset"); + } + }); + + // src/diagrams/state/stateRenderer-v3-unified.ts + var getDir3, getClasses3, draw13, stateRenderer_v3_unified_default; + var init_stateRenderer_v3_unified = __esm({ + "src/diagrams/state/stateRenderer-v3-unified.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_insertElementsForSize(); + init_render2(); + init_setupViewPortForSVG(); + init_utils2(); + init_stateCommon(); + getDir3 = /* @__PURE__ */ __name((parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => { + if (!parsedItem.doc) { + return defaultDir; + } + let dir2 = defaultDir; + for (const parsedItemDoc of parsedItem.doc) { + if (parsedItemDoc.stmt === "dir") { + dir2 = parsedItemDoc.value; + } + } + return dir2; + }, "getDir"); + getClasses3 = /* @__PURE__ */ __name(function(text4, diagramObj) { + return diagramObj.db.getClasses(); + }, "getClasses"); + draw13 = /* @__PURE__ */ __name(async function(text4, id35, _version, diag) { + log.info("REF0:"); + log.info("Drawing state diagram (v2)", id35); + const { securityLevel, state: conf5, layout: layout7 } = getConfig2(); + diag.db.extract(diag.db.getRootDocV2()); + const data4Layout = diag.db.getData(); + const svg2 = getDiagramElement(id35, securityLevel); + data4Layout.type = diag.type; + data4Layout.layoutAlgorithm = layout7; + data4Layout.nodeSpacing = conf5?.nodeSpacing || 50; + data4Layout.rankSpacing = conf5?.rankSpacing || 50; + const config5 = getConfig2(); + if (config5.look === "neo") { + data4Layout.markers = ["barbNeo"]; + } else { + data4Layout.markers = ["barb"]; + } + data4Layout.diagramId = id35; + await render6(data4Layout, svg2); + const padding2 = 8; + try { + const links3 = typeof diag.db.getLinks === "function" ? diag.db.getLinks() : /* @__PURE__ */ new Map(); + links3.forEach((linkInfo, key) => { + const stateId = typeof key === "string" ? key : typeof key?.id === "string" ? key.id : ""; + if (!stateId) { + log.warn("\u26A0\uFE0F Invalid or missing stateId from key:", JSON.stringify(key)); + return; + } + const allNodes = svg2.node()?.querySelectorAll("g"); + let matchedElem; + allNodes?.forEach((g2) => { + const text5 = g2.textContent?.trim(); + if (text5 === stateId) { + matchedElem = g2; + } + }); + if (!matchedElem) { + log.warn("\u26A0\uFE0F Could not find node matching text:", stateId); + return; + } + const parent4 = matchedElem.parentNode; + if (!parent4) { + log.warn("\u26A0\uFE0F Node has no parent, cannot wrap:", stateId); + return; + } + const a2 = document.createElementNS("http://www.w3.org/2000/svg", "a"); + const cleanedUrl = linkInfo.url.replace(/^"+|"+$/g, ""); + a2.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", cleanedUrl); + a2.setAttribute("target", "_blank"); + if (linkInfo.tooltip) { + const tooltip = linkInfo.tooltip.replace(/^"+|"+$/g, ""); + a2.setAttribute("title", tooltip); + } + parent4.replaceChild(a2, matchedElem); + a2.appendChild(matchedElem); + log.info("\u{1F517} Wrapped node in
    tag for:", stateId, linkInfo.url); + }); + } catch (err) { + log.error("\u274C Error injecting clickable links:", err); + } + utils_default2.insertTitle( + svg2, + "statediagramTitleText", + conf5?.titleTopMargin ?? 25, + diag.db.getDiagramTitle() + ); + setupViewPortForSVG(svg2, padding2, CSS_DIAGRAM, conf5?.useMaxWidth ?? true); + }, "draw"); + stateRenderer_v3_unified_default = { + getClasses: getClasses3, + draw: draw13, + getDir: getDir3 + }; + } + }); + + // src/diagrams/state/stateDb.ts + var CONSTANTS, newClassesList, newDoc, clone8, StateDB; + var init_stateDb = __esm({ + "src/diagrams/state/stateDb.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_utils2(); + init_common(); + init_commonDb(); + init_dataFetcher(); + init_stateRenderer_v3_unified(); + init_stateCommon(); + CONSTANTS = { + START_NODE: "[*]", + START_TYPE: "start", + END_NODE: "[*]", + END_TYPE: "end", + COLOR_KEYWORD: "color", + FILL_KEYWORD: "fill", + BG_FILL: "bgFill", + STYLECLASS_SEP: "," + }; + newClassesList = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Map(), "newClassesList"); + newDoc = /* @__PURE__ */ __name(() => ({ + relations: [], + states: /* @__PURE__ */ new Map(), + documents: {} + }), "newDoc"); + clone8 = /* @__PURE__ */ __name((o2) => JSON.parse(JSON.stringify(o2)), "clone"); + StateDB = class { + constructor(version3) { + this.version = version3; + this.nodes = []; + this.edges = []; + this.rootDoc = []; + this.classes = newClassesList(); + this.documents = { root: newDoc() }; + this.currentDocument = this.documents.root; + this.startEndCount = 0; + this.dividerCnt = 0; + this.links = /* @__PURE__ */ new Map(); + this.getAccTitle = getAccTitle; + this.setAccTitle = setAccTitle; + this.getAccDescription = getAccDescription; + this.setAccDescription = setAccDescription; + this.setDiagramTitle = setDiagramTitle; + this.getDiagramTitle = getDiagramTitle; + this.clear(); + this.setRootDoc = this.setRootDoc.bind(this); + this.getDividerId = this.getDividerId.bind(this); + this.setDirection = this.setDirection.bind(this); + this.trimColon = this.trimColon.bind(this); + } + static { + __name(this, "StateDB"); + } + static { + this.relationType = { + AGGREGATION: 0, + EXTENSION: 1, + COMPOSITION: 2, + DEPENDENCY: 3 + }; + } + /** + * Convert all of the statements (stmts) that were parsed into states and relationships. + * This is done because a state diagram may have nested sections, + * where each section is a 'document' and has its own set of statements. + * Ex: the section within a fork has its own statements, and incoming and outgoing statements + * refer to the fork as a whole (document). + * See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement. + * This will push the statement into the list of statements for the current document. + */ + extract(statements) { + this.clear(true); + for (const item of Array.isArray(statements) ? statements : statements.doc) { + switch (item.stmt) { + case STMT_STATE: + this.addState(item.id.trim(), item.type, item.doc, item.description, item.note); + break; + case STMT_RELATION: + this.addRelation(item.state1, item.state2, item.description); + break; + case STMT_CLASSDEF: + this.addStyleClass(item.id.trim(), item.classes); + break; + case STMT_STYLEDEF: + this.handleStyleDef(item); + break; + case STMT_APPLYCLASS: + this.setCssClass(item.id.trim(), item.styleClass); + break; + case "click": + this.addLink(item.id, item.url, item.tooltip); + break; + } + } + const diagramStates = this.getStates(); + const config5 = getConfig2(); + reset3(); + dataFetcher( + void 0, + this.getRootDocV2(), + diagramStates, + this.nodes, + this.edges, + true, + config5.look, + this.classes + ); + for (const node2 of this.nodes) { + if (!Array.isArray(node2.label)) { + continue; + } + node2.description = node2.label.slice(1); + if (node2.isGroup && node2.description.length > 0) { + throw new Error( + `Group nodes can only have label. Remove the additional description for node [${node2.id}]` + ); + } + node2.label = node2.label[0]; + } + } + handleStyleDef(item) { + const ids = item.id.trim().split(","); + const styles6 = item.styleClass.split(","); + for (const id35 of ids) { + let state4 = this.getState(id35); + if (!state4) { + const trimmedId = id35.trim(); + this.addState(trimmedId); + state4 = this.getState(trimmedId); + } + if (state4) { + state4.styles = styles6.map((s2) => s2.replace(/;/g, "")?.trim()); + } + } + } + setRootDoc(o2) { + log.info("Setting root doc", o2); + this.rootDoc = o2; + if (this.version === 1) { + this.extract(o2); + } else { + this.extract(this.getRootDocV2()); + } + } + docTranslator(parent4, node2, first3) { + if (node2.stmt === STMT_RELATION) { + this.docTranslator(parent4, node2.state1, true); + this.docTranslator(parent4, node2.state2, false); + return; + } + if (node2.stmt === STMT_STATE) { + if (node2.id === CONSTANTS.START_NODE) { + node2.id = parent4.id + (first3 ? "_start" : "_end"); + node2.start = first3; + } else { + node2.id = node2.id.trim(); + } + } + if (node2.stmt !== STMT_ROOT && node2.stmt !== STMT_STATE || !node2.doc) { + return; + } + const doc = []; + let currentDoc = []; + for (const stmt of node2.doc) { + if (stmt.type === DIVIDER_TYPE) { + const newNode = clone8(stmt); + newNode.doc = clone8(currentDoc); + doc.push(newNode); + currentDoc = []; + } else { + currentDoc.push(stmt); + } + } + if (doc.length > 0 && currentDoc.length > 0) { + const newNode = { + stmt: STMT_STATE, + id: generateId(), + type: "divider", + doc: clone8(currentDoc) + }; + doc.push(clone8(newNode)); + node2.doc = doc; + } + node2.doc.forEach((docNode) => this.docTranslator(node2, docNode, true)); + } + getRootDocV2() { + this.docTranslator( + { id: STMT_ROOT, stmt: STMT_ROOT }, + { id: STMT_ROOT, stmt: STMT_ROOT, doc: this.rootDoc }, + true + ); + return { id: STMT_ROOT, doc: this.rootDoc }; + } + /** + * Function called by parser when a node definition has been found. + * + * @param descr - description for the state. Can be a string or a list or strings + * @param classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class. + * @param styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style. + * @param textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style. + */ + addState(id35, type3 = DEFAULT_STATE_TYPE, doc = void 0, descr = void 0, note3 = void 0, classes3 = void 0, styles6 = void 0, textStyles = void 0) { + const trimmedId = id35?.trim(); + if (!this.currentDocument.states.has(trimmedId)) { + log.info("Adding state ", trimmedId, descr); + this.currentDocument.states.set(trimmedId, { + stmt: STMT_STATE, + id: trimmedId, + descriptions: [], + type: type3, + doc, + note: note3, + classes: [], + styles: [], + textStyles: [] + }); + } else { + const state4 = this.currentDocument.states.get(trimmedId); + if (!state4) { + throw new Error(`State not found: ${trimmedId}`); + } + if (!state4.doc) { + state4.doc = doc; + } + if (!state4.type) { + state4.type = type3; + } + } + if (descr) { + log.info("Setting state description", trimmedId, descr); + const descriptions = Array.isArray(descr) ? descr : [descr]; + descriptions.forEach((des) => this.addDescription(trimmedId, des.trim())); + } + if (note3) { + const doc2 = this.currentDocument.states.get(trimmedId); + if (!doc2) { + throw new Error(`State not found: ${trimmedId}`); + } + doc2.note = note3; + doc2.note.text = common_default.sanitizeText(doc2.note.text, getConfig2()); + } + if (classes3) { + log.info("Setting state classes", trimmedId, classes3); + const classesList = Array.isArray(classes3) ? classes3 : [classes3]; + classesList.forEach((cssClass) => this.setCssClass(trimmedId, cssClass.trim())); + } + if (styles6) { + log.info("Setting state styles", trimmedId, styles6); + const stylesList = Array.isArray(styles6) ? styles6 : [styles6]; + stylesList.forEach((style3) => this.setStyle(trimmedId, style3.trim())); + } + if (textStyles) { + log.info("Setting state styles", trimmedId, styles6); + const textStylesList = Array.isArray(textStyles) ? textStyles : [textStyles]; + textStylesList.forEach((textStyle) => this.setTextStyle(trimmedId, textStyle.trim())); + } + } + clear(saveCommon) { + this.nodes = []; + this.edges = []; + this.documents = { root: newDoc() }; + this.currentDocument = this.documents.root; + this.startEndCount = 0; + this.classes = newClassesList(); + if (!saveCommon) { + this.links = /* @__PURE__ */ new Map(); + clear(); + } + } + getState(id35) { + return this.currentDocument.states.get(id35); + } + getStates() { + return this.currentDocument.states; + } + logDocuments() { + log.info("Documents = ", this.documents); + } + getRelations() { + return this.currentDocument.relations; + } + /** + * Adds a clickable link to a state. + */ + addLink(stateId, url, tooltip) { + this.links.set(stateId, { url, tooltip }); + log.warn("Adding link", stateId, url, tooltip); + } + /** + * Get all registered links. + */ + getLinks() { + return this.links; + } + /** + * If the id is a start node ( [*] ), then return a new id constructed from + * the start node name and the current start node count. + * else return the given id + */ + startIdIfNeeded(id35 = "") { + if (id35 === CONSTANTS.START_NODE) { + this.startEndCount++; + return `${CONSTANTS.START_TYPE}${this.startEndCount}`; + } + return id35; + } + /** + * If the id is a start node ( [*] ), then return the start type ('start') + * else return the given type + */ + startTypeIfNeeded(id35 = "", type3 = DEFAULT_STATE_TYPE) { + return id35 === CONSTANTS.START_NODE ? CONSTANTS.START_TYPE : type3; + } + /** + * If the id is an end node ( [*] ), then return a new id constructed from + * the end node name and the current start_end node count. + * else return the given id + */ + endIdIfNeeded(id35 = "") { + if (id35 === CONSTANTS.END_NODE) { + this.startEndCount++; + return `${CONSTANTS.END_TYPE}${this.startEndCount}`; + } + return id35; + } + /** + * If the id is an end node ( [*] ), then return the end type + * else return the given type + * + */ + endTypeIfNeeded(id35 = "", type3 = DEFAULT_STATE_TYPE) { + return id35 === CONSTANTS.END_NODE ? CONSTANTS.END_TYPE : type3; + } + addRelationObjs(item1, item2, relationTitle = "") { + const id1 = this.startIdIfNeeded(item1.id.trim()); + const type1 = this.startTypeIfNeeded(item1.id.trim(), item1.type); + const id210 = this.startIdIfNeeded(item2.id.trim()); + const type22 = this.startTypeIfNeeded(item2.id.trim(), item2.type); + this.addState( + id1, + type1, + item1.doc, + item1.description, + item1.note, + item1.classes, + item1.styles, + item1.textStyles + ); + this.addState( + id210, + type22, + item2.doc, + item2.description, + item2.note, + item2.classes, + item2.styles, + item2.textStyles + ); + this.currentDocument.relations.push({ + id1, + id2: id210, + relationTitle: common_default.sanitizeText(relationTitle, getConfig2()) + }); + } + /** + * Add a relation between two items. The items may be full objects or just the string id of a state. + */ + addRelation(item1, item2, title2) { + if (typeof item1 === "object" && typeof item2 === "object") { + this.addRelationObjs(item1, item2, title2); + } else if (typeof item1 === "string" && typeof item2 === "string") { + const id1 = this.startIdIfNeeded(item1.trim()); + const type1 = this.startTypeIfNeeded(item1); + const id210 = this.endIdIfNeeded(item2.trim()); + const type22 = this.endTypeIfNeeded(item2); + this.addState(id1, type1); + this.addState(id210, type22); + this.currentDocument.relations.push({ + id1, + id2: id210, + relationTitle: title2 ? common_default.sanitizeText(title2, getConfig2()) : void 0 + }); + } + } + addDescription(id35, descr) { + const theState = this.currentDocument.states.get(id35); + const _descr = descr.startsWith(":") ? descr.replace(":", "").trim() : descr; + theState?.descriptions?.push(common_default.sanitizeText(_descr, getConfig2())); + } + cleanupLabel(label) { + return label.startsWith(":") ? label.slice(2).trim() : label.trim(); + } + getDividerId() { + this.dividerCnt++; + return `divider-id-${this.dividerCnt}`; + } + /** + * Called when the parser comes across a (style) class definition + * @example classDef my-style fill:#f96; + * + * @param id - the id of this (style) class + * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma) + */ + addStyleClass(id35, styleAttributes = "") { + if (!this.classes.has(id35)) { + this.classes.set(id35, { id: id35, styles: [], textStyles: [] }); + } + const foundClass = this.classes.get(id35); + if (styleAttributes && foundClass) { + styleAttributes.split(CONSTANTS.STYLECLASS_SEP).forEach((attrib) => { + const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim(); + if (RegExp(CONSTANTS.COLOR_KEYWORD).exec(attrib)) { + const newStyle1 = fixedAttrib.replace(CONSTANTS.FILL_KEYWORD, CONSTANTS.BG_FILL); + const newStyle2 = newStyle1.replace(CONSTANTS.COLOR_KEYWORD, CONSTANTS.FILL_KEYWORD); + foundClass.textStyles.push(newStyle2); + } + foundClass.styles.push(fixedAttrib); + }); + } + } + getClasses() { + return this.classes; + } + /** + * Add a (style) class or css class to a state with the given id. + * If the state isn't already in the list of known states, add it. + * Might be called by parser when a style class or CSS class should be applied to a state + * + * @param itemIds - The id or a list of ids of the item(s) to apply the css class to + * @param cssClassName - CSS class name + */ + setCssClass(itemIds, cssClassName) { + itemIds.split(",").forEach((id35) => { + let foundState = this.getState(id35); + if (!foundState) { + const trimmedId = id35.trim(); + this.addState(trimmedId); + foundState = this.getState(trimmedId); + } + foundState?.classes?.push(cssClassName); + }); + } + /** + * Add a style to a state with the given id. + * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px + * where 'style' is the keyword + * stateId is the id of a state + * the rest of the string is the styleText (all of the attributes to be applied to the state) + * + * @param itemId - The id of item to apply the style to + * @param styleText - the text of the attributes for the style + */ + setStyle(itemId, styleText) { + this.getState(itemId)?.styles?.push(styleText); + } + /** + * Add a text style to a state with the given id + * + * @param itemId - The id of item to apply the css class to + * @param cssClassName - CSS class name + */ + setTextStyle(itemId, cssClassName) { + this.getState(itemId)?.textStyles?.push(cssClassName); + } + /** + * Finds the direction statement in the root document. + * @returns the direction statement if present + */ + getDirectionStatement() { + return this.rootDoc.find((doc) => doc.stmt === STMT_DIRECTION); + } + getDirection() { + return this.getDirectionStatement()?.value ?? DEFAULT_DIAGRAM_DIRECTION; + } + setDirection(dir2) { + const doc = this.getDirectionStatement(); + if (doc) { + doc.value = dir2; + } else { + this.rootDoc.unshift({ stmt: STMT_DIRECTION, value: dir2 }); + } + } + trimColon(str2) { + return str2.startsWith(":") ? str2.slice(1).trim() : str2.trim(); + } + getData() { + const config5 = getConfig2(); + return { + nodes: this.nodes, + edges: this.edges, + other: {}, + config: config5, + direction: getDir3(this.getRootDocV2()) + }; + } + getConfig() { + return getConfig2().state; + } + }; + } + }); + + // src/diagrams/state/styles.js + var getStyles11, styles_default10; + var init_styles10 = __esm({ + "src/diagrams/state/styles.js"() { + "use strict"; + getStyles11 = /* @__PURE__ */ __name((options2) => ` +defs [id$="-barbEnd"] { + fill: ${options2.transitionColor}; + stroke: ${options2.transitionColor}; + } +g.stateGroup text { + fill: ${options2.nodeBorder}; + stroke: none; + font-size: 10px; +} +g.stateGroup text { + fill: ${options2.textColor}; + stroke: none; + font-size: 10px; + +} +g.stateGroup .state-title { + font-weight: bolder; + fill: ${options2.stateLabelColor}; +} + +g.stateGroup rect { + fill: ${options2.mainBkg}; + stroke: ${options2.nodeBorder}; +} + +g.stateGroup line { + stroke: ${options2.lineColor}; + stroke-width: ${options2.strokeWidth || 1}; +} + +.transition { + stroke: ${options2.transitionColor}; + stroke-width: ${options2.strokeWidth || 1}; + fill: none; +} + +.stateGroup .composit { + fill: ${options2.background}; + border-bottom: 1px +} + +.stateGroup .alt-composit { + fill: #e0e0e0; + border-bottom: 1px +} + +.state-note { + stroke: ${options2.noteBorderColor}; + fill: ${options2.noteBkgColor}; + + text { + fill: ${options2.noteTextColor}; + stroke: none; + font-size: 10px; + } +} + +.stateLabel .box { + stroke: none; + stroke-width: 0; + fill: ${options2.mainBkg}; + opacity: 0.5; +} + +.edgeLabel .label rect { + fill: ${options2.labelBackgroundColor}; + opacity: 0.5; +} +.edgeLabel { + background-color: ${options2.edgeLabelBackground}; + p { + background-color: ${options2.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${options2.edgeLabelBackground}; + fill: ${options2.edgeLabelBackground}; + } + text-align: center; +} +.edgeLabel .label text { + fill: ${options2.transitionLabelColor || options2.tertiaryTextColor}; +} +.label div .edgeLabel { + color: ${options2.transitionLabelColor || options2.tertiaryTextColor}; +} + +.stateLabel text { + fill: ${options2.stateLabelColor}; + font-size: 10px; + font-weight: bold; +} + +.node circle.state-start { + fill: ${options2.specialStateColor}; + stroke: ${options2.specialStateColor}; +} + +.node .fork-join { + fill: ${options2.specialStateColor}; + stroke: ${options2.specialStateColor}; +} + +.node circle.state-end { + fill: ${options2.innerEndBackground}; + stroke: ${options2.background}; + stroke-width: 1.5 +} +.end-state-inner { + fill: ${options2.compositeBackground || options2.background}; + // stroke: ${options2.background}; + stroke-width: 1.5 +} + +.node rect { + fill: ${options2.stateBkg || options2.mainBkg}; + stroke: ${options2.stateBorder || options2.nodeBorder}; + stroke-width: ${options2.strokeWidth || 1}px; +} +.node polygon { + fill: ${options2.mainBkg}; + stroke: ${options2.stateBorder || options2.nodeBorder};; + stroke-width: ${options2.strokeWidth || 1}px; +} +[id$="-barbEnd"] { + fill: ${options2.lineColor}; +} + +.statediagram-cluster rect { + fill: ${options2.compositeTitleBackground}; + stroke: ${options2.stateBorder || options2.nodeBorder}; + stroke-width: ${options2.strokeWidth || 1}px; +} + +.cluster-label, .nodeLabel { + color: ${options2.stateLabelColor}; + // line-height: 1; +} + +.statediagram-cluster rect.outer { + rx: 5px; + ry: 5px; +} +.statediagram-state .divider { + stroke: ${options2.stateBorder || options2.nodeBorder}; +} + +.statediagram-state .title-state { + rx: 5px; + ry: 5px; +} +.statediagram-cluster.statediagram-cluster .inner { + fill: ${options2.compositeBackground || options2.background}; +} +.statediagram-cluster.statediagram-cluster-alt .inner { + fill: ${options2.altBackground ? options2.altBackground : "#efefef"}; +} + +.statediagram-cluster .inner { + rx:0; + ry:0; +} + +.statediagram-state rect.basic { + rx: 5px; + ry: 5px; +} +.statediagram-state rect.divider { + stroke-dasharray: 10,10; + fill: ${options2.altBackground ? options2.altBackground : "#efefef"}; +} + +.note-edge { + stroke-dasharray: 5; +} + +.statediagram-note rect { + fill: ${options2.noteBkgColor}; + stroke: ${options2.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} +.statediagram-note rect { + fill: ${options2.noteBkgColor}; + stroke: ${options2.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} + +.statediagram-note text { + fill: ${options2.noteTextColor}; +} + +.statediagram-note .nodeLabel { + color: ${options2.noteTextColor}; +} +.statediagram .edgeLabel { + color: red; // ${options2.noteTextColor}; +} + +[id$="-dependencyStart"], [id$="-dependencyEnd"] { + fill: ${options2.lineColor}; + stroke: ${options2.lineColor}; + stroke-width: ${options2.strokeWidth || 1}; +} + +.statediagramTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${options2.textColor}; +} + +[data-look="neo"].statediagram-cluster rect { + fill: ${options2.mainBkg}; + stroke: ${options2.useGradient ? "url(" + options2.svgId + "-gradient)" : options2.stateBorder || options2.nodeBorder}; + stroke-width: ${options2.strokeWidth ?? 1}; +} +[data-look="neo"].statediagram-cluster rect.outer { + rx: ${options2.radius}px; + ry: ${options2.radius}px; + filter: ${options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${options2.svgId}-drop-shadow)`) : "none"} +} +`, "getStyles"); + styles_default10 = getStyles11; + } + }); + + // src/diagrams/state/shapes.js + var drawStartState, drawDivider, drawSimpleState, drawDescrState, addTitleAndBox, drawEndState, drawForkJoinState, _drawLongText, drawNote2, drawState, edgeCount, drawEdge; + var init_shapes2 = __esm({ + "src/diagrams/state/shapes.js"() { + "use strict"; + init_src32(); + init_stateDb(); + init_utils2(); + init_common(); + init_diagramAPI(); + init_logger(); + drawStartState = /* @__PURE__ */ __name((g2) => g2.append("circle").attr("class", "start-state").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit), "drawStartState"); + drawDivider = /* @__PURE__ */ __name((g2) => g2.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig2().state.textHeight).attr("class", "divider").attr("x2", getConfig2().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider"); + drawSimpleState = /* @__PURE__ */ __name((g2, stateDef) => { + const state4 = g2.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 2 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id); + const classBox2 = state4.node().getBBox(); + g2.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", classBox2.width + 2 * getConfig2().state.padding).attr("height", classBox2.height + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius); + return state4; + }, "drawSimpleState"); + drawDescrState = /* @__PURE__ */ __name((g2, stateDef) => { + const addTspan = /* @__PURE__ */ __name(function(textEl, txt, isFirst2) { + const tSpan = textEl.append("tspan").attr("x", 2 * getConfig2().state.padding).text(txt); + if (!isFirst2) { + tSpan.attr("dy", getConfig2().state.textHeight); + } + }, "addTspan"); + const title2 = g2.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 1.3 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]); + const titleBox = title2.node().getBBox(); + const titleHeight = titleBox.height; + const description = g2.append("text").attr("x", getConfig2().state.padding).attr( + "y", + titleHeight + getConfig2().state.padding * 0.4 + getConfig2().state.dividerMargin + getConfig2().state.textHeight + ).attr("class", "state-description"); + let isFirst = true; + let isSecond = true; + stateDef.descriptions.forEach(function(descr) { + if (!isFirst) { + addTspan(description, descr, isSecond); + isSecond = false; + } + isFirst = false; + }); + const descrLine = g2.append("line").attr("x1", getConfig2().state.padding).attr("y1", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("y2", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("class", "descr-divider"); + const descrBox = description.node().getBBox(); + const width3 = Math.max(descrBox.width, titleBox.width); + descrLine.attr("x2", width3 + 3 * getConfig2().state.padding); + g2.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", width3 + 2 * getConfig2().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius); + return g2; + }, "drawDescrState"); + addTitleAndBox = /* @__PURE__ */ __name((g2, stateDef, altBkg) => { + const pad3 = getConfig2().state.padding; + const dblPad = 2 * getConfig2().state.padding; + const orgBox = g2.node().getBBox(); + const orgWidth = orgBox.width; + const orgX = orgBox.x; + const title2 = g2.append("text").attr("x", 0).attr("y", getConfig2().state.titleShift).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id); + const titleBox = title2.node().getBBox(); + const titleWidth = titleBox.width + dblPad; + let width3 = Math.max(titleWidth, orgWidth); + if (width3 === orgWidth) { + width3 = width3 + dblPad; + } + let startX2; + const graphBox = g2.node().getBBox(); + if (stateDef.doc) { + } + startX2 = orgX - pad3; + if (titleWidth > orgWidth) { + startX2 = (orgWidth - width3) / 2 + pad3; + } + if (Math.abs(orgX - graphBox.x) < pad3 && titleWidth > orgWidth) { + startX2 = orgX - (titleWidth - orgWidth) / 2; + } + const lineY = 1 - getConfig2().state.textHeight; + g2.insert("rect", ":first-child").attr("x", startX2).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width3).attr( + "height", + graphBox.height + getConfig2().state.textHeight + getConfig2().state.titleShift + 1 + ).attr("rx", "0"); + title2.attr("x", startX2 + pad3); + if (titleWidth <= orgWidth) { + title2.attr("x", orgX + (width3 - dblPad) / 2 - titleWidth / 2 + pad3); + } + g2.insert("rect", ":first-child").attr("x", startX2).attr( + "y", + getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding + ).attr("width", width3).attr("height", getConfig2().state.textHeight * 3).attr("rx", getConfig2().state.radius); + g2.insert("rect", ":first-child").attr("x", startX2).attr( + "y", + getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding + ).attr("width", width3).attr("height", graphBox.height + 3 + 2 * getConfig2().state.textHeight).attr("rx", getConfig2().state.radius); + return g2; + }, "addTitleAndBox"); + drawEndState = /* @__PURE__ */ __name((g2) => { + g2.append("circle").attr("class", "end-state-outer").attr("r", getConfig2().state.sizeUnit + getConfig2().state.miniPadding).attr( + "cx", + getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding + ).attr( + "cy", + getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding + ); + return g2.append("circle").attr("class", "end-state-inner").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit + 2).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit + 2); + }, "drawEndState"); + drawForkJoinState = /* @__PURE__ */ __name((g2, stateDef) => { + let width3 = getConfig2().state.forkWidth; + let height2 = getConfig2().state.forkHeight; + if (stateDef.parentId) { + let tmp = width3; + width3 = height2; + height2 = tmp; + } + return g2.append("rect").style("stroke", "black").style("fill", "black").attr("width", width3).attr("height", height2).attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding); + }, "drawForkJoinState"); + _drawLongText = /* @__PURE__ */ __name((_text, x5, y6, g2) => { + let textHeight = 0; + const textElem = g2.append("text"); + textElem.style("text-anchor", "start"); + textElem.attr("class", "noteText"); + let text4 = _text.replace(/\r\n/g, "
    "); + text4 = text4.replace(/\n/g, "
    "); + const lines = text4.split(common_default.lineBreakRegex); + let tHeight = 1.25 * getConfig2().state.noteMargin; + for (const line2 of lines) { + const txt = line2.trim(); + if (txt.length > 0) { + const span = textElem.append("tspan"); + span.text(txt); + if (tHeight === 0) { + const textBounds = span.node().getBBox(); + tHeight += textBounds.height; + } + textHeight += tHeight; + span.attr("x", x5 + getConfig2().state.noteMargin); + span.attr("y", y6 + textHeight + 1.25 * getConfig2().state.noteMargin); + } + } + return { textWidth: textElem.node().getBBox().width, textHeight }; + }, "_drawLongText"); + drawNote2 = /* @__PURE__ */ __name((text4, g2) => { + g2.attr("class", "state-note"); + const note3 = g2.append("rect").attr("x", 0).attr("y", getConfig2().state.padding); + const rectElem = g2.append("g"); + const { textWidth, textHeight } = _drawLongText(text4, 0, 0, rectElem); + note3.attr("height", textHeight + 2 * getConfig2().state.noteMargin); + note3.attr("width", textWidth + getConfig2().state.noteMargin * 2); + return note3; + }, "drawNote"); + drawState = /* @__PURE__ */ __name(function(elem, stateDef) { + const id35 = stateDef.id; + const stateInfo = { + id: id35, + label: stateDef.id, + width: 0, + height: 0 + }; + const g2 = elem.append("g").attr("id", id35).attr("class", "stateGroup"); + if (stateDef.type === "start") { + drawStartState(g2); + } + if (stateDef.type === "end") { + drawEndState(g2); + } + if (stateDef.type === "fork" || stateDef.type === "join") { + drawForkJoinState(g2, stateDef); + } + if (stateDef.type === "note") { + drawNote2(stateDef.note.text, g2); + } + if (stateDef.type === "divider") { + drawDivider(g2); + } + if (stateDef.type === "default" && stateDef.descriptions.length === 0) { + drawSimpleState(g2, stateDef); + } + if (stateDef.type === "default" && stateDef.descriptions.length > 0) { + drawDescrState(g2, stateDef); + } + const stateBox = g2.node().getBBox(); + stateInfo.width = stateBox.width + 2 * getConfig2().state.padding; + stateInfo.height = stateBox.height + 2 * getConfig2().state.padding; + return stateInfo; + }, "drawState"); + edgeCount = 0; + drawEdge = /* @__PURE__ */ __name(function(elem, path4, relation) { + const getRelationType = /* @__PURE__ */ __name(function(type3) { + switch (type3) { + case StateDB.relationType.AGGREGATION: + return "aggregation"; + case StateDB.relationType.EXTENSION: + return "extension"; + case StateDB.relationType.COMPOSITION: + return "composition"; + case StateDB.relationType.DEPENDENCY: + return "dependency"; + } + }, "getRelationType"); + path4.points = path4.points.filter((p3) => !Number.isNaN(p3.y)); + const lineData = path4.points; + const lineFunction = line_default().x(function(d3) { + return d3.x; + }).y(function(d3) { + return d3.y; + }).curve(basis_default2); + const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition"); + let url = ""; + if (getConfig2().state.arrowMarkerAbsolute) { + url = getUrl(true); + } + svgPath.attr( + "marker-end", + "url(" + url + "#" + getRelationType(StateDB.relationType.DEPENDENCY) + "End)" + ); + if (relation.title !== void 0) { + const label = elem.append("g").attr("class", "stateLabel"); + const { x: x5, y: y6 } = utils_default2.calcLabelPosition(path4.points); + const rows = common_default.getRows(relation.title); + let titleHeight = 0; + const titleRows = []; + let maxWidth2 = 0; + let minX = 0; + for (let i2 = 0; i2 <= rows.length; i2++) { + const title2 = label.append("text").attr("text-anchor", "middle").text(rows[i2]).attr("x", x5).attr("y", y6 + titleHeight); + const boundsTmp = title2.node().getBBox(); + maxWidth2 = Math.max(maxWidth2, boundsTmp.width); + minX = Math.min(minX, boundsTmp.x); + log.info(boundsTmp.x, x5, y6 + titleHeight); + if (titleHeight === 0) { + const titleBox = title2.node().getBBox(); + titleHeight = titleBox.height; + log.info("Title height", titleHeight, y6); + } + titleRows.push(title2); + } + let boxHeight = titleHeight * rows.length; + if (rows.length > 1) { + const heightAdj = (rows.length - 1) * titleHeight * 0.5; + titleRows.forEach((title2, i2) => title2.attr("y", y6 + i2 * titleHeight - heightAdj)); + boxHeight = titleHeight * rows.length; + } + const bounds4 = label.node().getBBox(); + label.insert("rect", ":first-child").attr("class", "box").attr("x", x5 - maxWidth2 / 2 - getConfig2().state.padding / 2).attr("y", y6 - boxHeight / 2 - getConfig2().state.padding / 2 - 3.5).attr("width", maxWidth2 + getConfig2().state.padding).attr("height", boxHeight + getConfig2().state.padding); + log.info(bounds4); + } + edgeCount++; + }, "drawEdge"); + } + }); + + // src/diagrams/state/stateRenderer.js + var conf3, transformationLog, setConf4, insertMarkers2, draw14, getLabelWidth, renderDoc, stateRenderer_default; + var init_stateRenderer = __esm({ + "src/diagrams/state/stateRenderer.js"() { + "use strict"; + init_src32(); + init_dagre(); + init_graphlib(); + init_logger(); + init_common(); + init_shapes2(); + init_diagramAPI(); + init_setupGraphViewbox(); + transformationLog = {}; + setConf4 = /* @__PURE__ */ __name(function() { + }, "setConf"); + insertMarkers2 = /* @__PURE__ */ __name(function(elem) { + elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z"); + }, "insertMarkers"); + draw14 = /* @__PURE__ */ __name(function(text4, id35, _version, diagObj) { + conf3 = getConfig2().state; + const securityLevel = getConfig2().securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document; + log.debug("Rendering diagram " + text4); + const diagram32 = root4.select(`[id='${id35}']`); + insertMarkers2(diagram32); + const rootDoc = diagObj.db.getRootDoc(); + const rootG = diagram32.append("g").attr("id", id35 + "-root"); + renderDoc(rootDoc, rootG, void 0, false, root4, doc, diagObj); + const padding2 = conf3.padding; + const bounds4 = diagram32.node().getBBox(); + const width3 = bounds4.width + padding2 * 2; + const height2 = bounds4.height + padding2 * 2; + const svgWidth = width3 * 1.75; + configureSvgSize(diagram32, height2, svgWidth, conf3.useMaxWidth); + diagram32.attr( + "viewBox", + `${bounds4.x - conf3.padding} ${bounds4.y - conf3.padding} ` + width3 + " " + height2 + ); + }, "draw"); + getLabelWidth = /* @__PURE__ */ __name((text4) => { + return text4 ? text4.length * conf3.fontSizeFactor : 1; + }, "getLabelWidth"); + renderDoc = /* @__PURE__ */ __name((doc, diagram32, parentId, altBkg, root4, domDocument, diagObj) => { + const graph = new Graph({ + compound: true, + multigraph: true + }); + let i2; + let edgeFreeDoc = true; + for (i2 = 0; i2 < doc.length; i2++) { + if (doc[i2].stmt === "relation") { + edgeFreeDoc = false; + break; + } + } + if (parentId) { + graph.setGraph({ + rankdir: "LR", + multigraph: true, + compound: true, + // acyclicer: 'greedy', + ranker: "tight-tree", + ranksep: edgeFreeDoc ? 1 : conf3.edgeLengthFactor, + nodeSep: edgeFreeDoc ? 1 : 50, + isMultiGraph: true + // ranksep: 5, + // nodesep: 1 + }); + } else { + graph.setGraph({ + rankdir: "TB", + multigraph: true, + compound: true, + // isCompound: true, + // acyclicer: 'greedy', + // ranker: 'longest-path' + ranksep: edgeFreeDoc ? 1 : conf3.edgeLengthFactor, + nodeSep: edgeFreeDoc ? 1 : 50, + ranker: "tight-tree", + // ranker: 'network-simplex' + isMultiGraph: true + }); + } + graph.setDefaultEdgeLabel(function() { + return {}; + }); + const states = diagObj.db.getStates(); + const relations = diagObj.db.getRelations(); + const keys3 = Object.keys(states); + let first3 = true; + for (const key of keys3) { + const stateDef = states[key]; + if (parentId) { + stateDef.parentId = parentId; + } + let node2; + if (stateDef.doc) { + let sub2 = diagram32.append("g").attr("id", stateDef.id).attr("class", "stateGroup"); + node2 = renderDoc(stateDef.doc, sub2, stateDef.id, !altBkg, root4, domDocument, diagObj); + if (first3) { + sub2 = addTitleAndBox(sub2, stateDef, altBkg); + let boxBounds = sub2.node().getBBox(); + node2.width = boxBounds.width; + node2.height = boxBounds.height + conf3.padding / 2; + transformationLog[stateDef.id] = { y: conf3.compositTitleSize }; + } else { + let boxBounds = sub2.node().getBBox(); + node2.width = boxBounds.width; + node2.height = boxBounds.height; + } + } else { + node2 = drawState(diagram32, stateDef, graph); + } + if (stateDef.note) { + const noteDef = { + descriptions: [], + id: stateDef.id + "-note", + note: stateDef.note, + type: "note" + }; + const note3 = drawState(diagram32, noteDef, graph); + if (stateDef.note.position === "left of") { + graph.setNode(node2.id + "-note", note3); + graph.setNode(node2.id, node2); + } else { + graph.setNode(node2.id, node2); + graph.setNode(node2.id + "-note", note3); + } + graph.setParent(node2.id, node2.id + "-group"); + graph.setParent(node2.id + "-note", node2.id + "-group"); + } else { + graph.setNode(node2.id, node2); + } + } + log.debug("Count=", graph.nodeCount(), graph); + let cnt4 = 0; + relations.forEach(function(relation) { + cnt4++; + log.debug("Setting edge", relation); + graph.setEdge( + relation.id1, + relation.id2, + { + relation, + width: getLabelWidth(relation.title), + height: conf3.labelHeight * common_default.getRows(relation.title).length, + labelpos: "c" + }, + "id" + cnt4 + ); + }); + layout(graph); + log.debug("Graph after layout", graph.nodes()); + const svgElem = diagram32.node(); + graph.nodes().forEach(function(v3) { + if (v3 !== void 0 && graph.node(v3) !== void 0) { + log.warn("Node " + v3 + ": " + JSON.stringify(graph.node(v3))); + root4.select("#" + svgElem.id + " #" + v3).attr( + "transform", + "translate(" + (graph.node(v3).x - graph.node(v3).width / 2) + "," + (graph.node(v3).y + (transformationLog[v3] ? transformationLog[v3].y : 0) - graph.node(v3).height / 2) + " )" + ); + root4.select("#" + svgElem.id + " #" + v3).attr("data-x-shift", graph.node(v3).x - graph.node(v3).width / 2); + const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v3 + " .divider"); + dividers.forEach((divider2) => { + const parent4 = divider2.parentElement; + let pWidth = 0; + let pShift = 0; + if (parent4) { + if (parent4.parentElement) { + pWidth = parent4.parentElement.getBBox().width; + } + pShift = parseInt(parent4.getAttribute("data-x-shift"), 10); + if (Number.isNaN(pShift)) { + pShift = 0; + } + } + divider2.setAttribute("x1", 0 - pShift + 8); + divider2.setAttribute("x2", pWidth - pShift - 8); + }); + } else { + log.debug("No Node " + v3 + ": " + JSON.stringify(graph.node(v3))); + } + }); + let stateBox = svgElem.getBBox(); + graph.edges().forEach(function(e3) { + if (e3 !== void 0 && graph.edge(e3) !== void 0) { + log.debug("Edge " + e3.v + " -> " + e3.w + ": " + JSON.stringify(graph.edge(e3))); + drawEdge(diagram32, graph.edge(e3), graph.edge(e3).relation); + } + }); + stateBox = svgElem.getBBox(); + const stateInfo = { + id: parentId ? parentId : "root", + label: parentId ? parentId : "root", + width: 0, + height: 0 + }; + stateInfo.width = stateBox.width + 2 * conf3.padding; + stateInfo.height = stateBox.height + 2 * conf3.padding; + log.debug("Doc rendered", stateInfo, graph); + return stateInfo; + }, "renderDoc"); + stateRenderer_default = { + setConf: setConf4, + draw: draw14 + }; + } + }); + + // src/diagrams/state/stateDiagram.ts + var stateDiagram_exports = {}; + __export(stateDiagram_exports, { + diagram: () => diagram14 + }); + var diagram14; + var init_stateDiagram2 = __esm({ + "src/diagrams/state/stateDiagram.ts"() { + "use strict"; + init_stateDiagram(); + init_stateDb(); + init_styles10(); + init_stateRenderer(); + diagram14 = { + parser: stateDiagram_default, + get db() { + return new StateDB(1); + }, + renderer: stateRenderer_default, + styles: styles_default10, + init: /* @__PURE__ */ __name((cnf) => { + if (!cnf.state) { + cnf.state = {}; + } + cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + }, "init") + }; + } + }); + + // src/diagrams/state/stateDiagram-v2.ts + var stateDiagram_v2_exports = {}; + __export(stateDiagram_v2_exports, { + diagram: () => diagram15 + }); + var diagram15; + var init_stateDiagram_v2 = __esm({ + "src/diagrams/state/stateDiagram-v2.ts"() { + "use strict"; + init_stateDiagram(); + init_stateDb(); + init_styles10(); + init_stateRenderer_v3_unified(); + diagram15 = { + parser: stateDiagram_default, + get db() { + return new StateDB(2); + }, + renderer: stateRenderer_v3_unified_default, + styles: styles_default10, + init: /* @__PURE__ */ __name((cnf) => { + if (!cnf.state) { + cnf.state = {}; + } + cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute; + }, "init") + }; + } + }); + + // src/diagrams/user-journey/parser/journey.jison + var parser14, journey_default; + var init_journey = __esm({ + "src/diagrams/user-journey/parser/journey.jison"() { + "use strict"; + parser14 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 18], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 14]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "journey": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "title": 11, "acc_title": 12, "acc_title_value": 13, "acc_descr": 14, "acc_descr_value": 15, "acc_descr_multiline_value": 16, "section": 17, "taskName": 18, "taskData": 19, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "journey", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 18: "taskName", 19: "taskData" }, + productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 2: + this.$ = []; + break; + case 3: + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + break; + case 4: + case 5: + this.$ = $$[$0]; + break; + case 6: + case 7: + this.$ = []; + break; + case 8: + yy.setDiagramTitle($$[$0].substr(6)); + this.$ = $$[$0].substr(6); + break; + case 9: + this.$ = $$[$0].trim(); + yy.setAccTitle(this.$); + break; + case 10: + case 11: + this.$ = $$[$0].trim(); + yy.setAccDescription(this.$); + break; + case 12: + yy.addSection($$[$0].substr(8)); + this.$ = $$[$0].substr(8); + break; + case 13: + yy.addTask($$[$0 - 1], $$[$0]); + this.$ = "task"; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o2($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o2($V0, [2, 7], { 1: [2, 1] }), o2($V0, [2, 3]), { 9: 15, 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o2($V0, [2, 5]), o2($V0, [2, 6]), o2($V0, [2, 8]), { 13: [1, 16] }, { 15: [1, 17] }, o2($V0, [2, 11]), o2($V0, [2, 12]), { 19: [1, 18] }, o2($V0, [2, 4]), o2($V0, [2, 9]), o2($V0, [2, 10]), o2($V0, [2, 13])], + defaultActions: {}, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + break; + case 1: + break; + case 2: + return 10; + break; + case 3: + break; + case 4: + break; + case 5: + return 4; + break; + case 6: + return 11; + break; + case 7: + this.begin("acc_title"); + return 12; + break; + case 8: + this.popState(); + return "acc_title_value"; + break; + case 9: + this.begin("acc_descr"); + return 14; + break; + case 10: + this.popState(); + return "acc_descr_value"; + break; + case 11: + this.begin("acc_descr_multiline"); + break; + case 12: + this.popState(); + break; + case 13: + return "acc_descr_multiline_value"; + break; + case 14: + return 17; + break; + case 15: + return 18; + break; + case 16: + return 19; + break; + case 17: + return ":"; + break; + case 18: + return 6; + break; + case 19: + return "INVALID"; + break; + } + }, "anonymous"), + rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:journey\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i], + conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser14.parser = parser14; + journey_default = parser14; + } + }); + + // src/diagrams/user-journey/journeyDb.js + var currentSection2, sections3, tasks2, rawTasks2, clear13, addSection3, getSections3, getTasks2, updateActors, addTask2, addTaskOrg2, compileTasks2, getActors, journeyDb_default; + var init_journeyDb = __esm({ + "src/diagrams/user-journey/journeyDb.js"() { + "use strict"; + init_diagramAPI(); + init_commonDb(); + currentSection2 = ""; + sections3 = []; + tasks2 = []; + rawTasks2 = []; + clear13 = /* @__PURE__ */ __name(function() { + sections3.length = 0; + tasks2.length = 0; + currentSection2 = ""; + rawTasks2.length = 0; + clear(); + }, "clear"); + addSection3 = /* @__PURE__ */ __name(function(txt) { + currentSection2 = txt; + sections3.push(txt); + }, "addSection"); + getSections3 = /* @__PURE__ */ __name(function() { + return sections3; + }, "getSections"); + getTasks2 = /* @__PURE__ */ __name(function() { + let allItemsProcessed = compileTasks2(); + const maxDepth = 100; + let iterationCount = 0; + while (!allItemsProcessed && iterationCount < maxDepth) { + allItemsProcessed = compileTasks2(); + iterationCount++; + } + tasks2.push(...rawTasks2); + return tasks2; + }, "getTasks"); + updateActors = /* @__PURE__ */ __name(function() { + const tempActors = []; + tasks2.forEach((task) => { + if (task.people) { + tempActors.push(...task.people); + } + }); + const unique = new Set(tempActors); + return [...unique].sort(); + }, "updateActors"); + addTask2 = /* @__PURE__ */ __name(function(descr, taskData) { + const pieces = taskData.substr(1).split(":"); + let score = 0; + let peeps = []; + if (pieces.length === 1) { + score = Number(pieces[0]); + peeps = []; + } else { + score = Number(pieces[0]); + peeps = pieces[1].split(","); + } + const peopleList = peeps.map((s2) => s2.trim()); + const rawTask = { + section: currentSection2, + type: currentSection2, + people: peopleList, + task: descr, + score + }; + rawTasks2.push(rawTask); + }, "addTask"); + addTaskOrg2 = /* @__PURE__ */ __name(function(descr) { + const newTask = { + section: currentSection2, + type: currentSection2, + description: descr, + task: descr, + classes: [] + }; + tasks2.push(newTask); + }, "addTaskOrg"); + compileTasks2 = /* @__PURE__ */ __name(function() { + const compileTask = /* @__PURE__ */ __name(function(pos) { + return rawTasks2[pos].processed; + }, "compileTask"); + let allProcessed = true; + for (const [i2, rawTask] of rawTasks2.entries()) { + compileTask(i2); + allProcessed = allProcessed && rawTask.processed; + } + return allProcessed; + }, "compileTasks"); + getActors = /* @__PURE__ */ __name(function() { + return updateActors(); + }, "getActors"); + journeyDb_default = { + getConfig: /* @__PURE__ */ __name(() => getConfig2().journey, "getConfig"), + clear: clear13, + setDiagramTitle, + getDiagramTitle, + setAccTitle, + getAccTitle, + setAccDescription, + getAccDescription, + addSection: addSection3, + getSections: getSections3, + getTasks: getTasks2, + addTask: addTask2, + addTaskOrg: addTaskOrg2, + getActors + }; + } + }); + + // src/diagrams/user-journey/styles.js + var getStyles12, styles_default11; + var init_styles11 = __esm({ + "src/diagrams/user-journey/styles.js"() { + "use strict"; + init_globalStyles(); + getStyles12 = /* @__PURE__ */ __name((options2) => `.label { + font-family: ${options2.fontFamily}; + color: ${options2.textColor}; + } + .mouth { + stroke: #666; + } + + line { + stroke: ${options2.textColor} + } + + .legend { + fill: ${options2.textColor}; + font-family: ${options2.fontFamily}; + } + + .label text { + fill: #333; + } + .label { + color: ${options2.textColor} + } + + .face { + ${options2.faceColor ? `fill: ${options2.faceColor}` : "fill: #FFF8DC"}; + stroke: #999; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${options2.mainBkg}; + stroke: ${options2.nodeBorder}; + stroke-width: 1px; + } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${options2.arrowheadColor}; + } + + .edgePath .path { + stroke: ${options2.lineColor}; + stroke-width: 1.5px; + } + + .flowchart-link { + stroke: ${options2.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${options2.edgeLabelBackground}; + rect { + opacity: 0.5; + } + text-align: center; + } + + .cluster rect { + } + + .cluster text { + fill: ${options2.titleColor}; + } + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${options2.fontFamily}; + font-size: 12px; + background: ${options2.tertiaryColor}; + border: 1px solid ${options2.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .task-type-0, .section-type-0 { + ${options2.fillType0 ? `fill: ${options2.fillType0}` : ""}; + } + .task-type-1, .section-type-1 { + ${options2.fillType0 ? `fill: ${options2.fillType1}` : ""}; + } + .task-type-2, .section-type-2 { + ${options2.fillType0 ? `fill: ${options2.fillType2}` : ""}; + } + .task-type-3, .section-type-3 { + ${options2.fillType0 ? `fill: ${options2.fillType3}` : ""}; + } + .task-type-4, .section-type-4 { + ${options2.fillType0 ? `fill: ${options2.fillType4}` : ""}; + } + .task-type-5, .section-type-5 { + ${options2.fillType0 ? `fill: ${options2.fillType5}` : ""}; + } + .task-type-6, .section-type-6 { + ${options2.fillType0 ? `fill: ${options2.fillType6}` : ""}; + } + .task-type-7, .section-type-7 { + ${options2.fillType0 ? `fill: ${options2.fillType7}` : ""}; + } + + .actor-0 { + ${options2.actor0 ? `fill: ${options2.actor0}` : ""}; + } + .actor-1 { + ${options2.actor1 ? `fill: ${options2.actor1}` : ""}; + } + .actor-2 { + ${options2.actor2 ? `fill: ${options2.actor2}` : ""}; + } + .actor-3 { + ${options2.actor3 ? `fill: ${options2.actor3}` : ""}; + } + .actor-4 { + ${options2.actor4 ? `fill: ${options2.actor4}` : ""}; + } + .actor-5 { + ${options2.actor5 ? `fill: ${options2.actor5}` : ""}; + } + ${getIconStyles()} +`, "getStyles"); + styles_default11 = getStyles12; + } + }); + + // src/diagrams/user-journey/svgDraw.js + var drawRect5, drawFace, drawCircle, drawText4, drawLabel2, drawSection, taskCount, drawTask, drawBackgroundRect3, _drawTextCandidateFunc3, initGraphics, svgDraw_default3; + var init_svgDraw3 = __esm({ + "src/diagrams/user-journey/svgDraw.js"() { + "use strict"; + init_src32(); + init_svgDrawCommon(); + drawRect5 = /* @__PURE__ */ __name(function(elem, rectData) { + return drawRect(elem, rectData); + }, "drawRect"); + drawFace = /* @__PURE__ */ __name(function(element3, faceData) { + const radius2 = 15; + const circleElement = element3.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius2).attr("stroke-width", 2).attr("overflow", "visible"); + const face = element3.append("g"); + face.append("circle").attr("cx", faceData.cx - radius2 / 3).attr("cy", faceData.cy - radius2 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"); + face.append("circle").attr("cx", faceData.cx + radius2 / 3).attr("cy", faceData.cy - radius2 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"); + function smile(face2) { + const arc = arc_default().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius2 / 2).outerRadius(radius2 / 2.2); + face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")"); + } + __name(smile, "smile"); + function sad(face2) { + const arc = arc_default().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius2 / 2).outerRadius(radius2 / 2.2); + face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")"); + } + __name(sad, "sad"); + function ambivalent(face2) { + face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666"); + } + __name(ambivalent, "ambivalent"); + if (faceData.score > 3) { + smile(face); + } else if (faceData.score < 3) { + sad(face); + } else { + ambivalent(face); + } + return circleElement; + }, "drawFace"); + drawCircle = /* @__PURE__ */ __name(function(element3, circleData) { + const circleElement = element3.append("circle"); + circleElement.attr("cx", circleData.cx); + circleElement.attr("cy", circleData.cy); + circleElement.attr("class", "actor-" + circleData.pos); + circleElement.attr("fill", circleData.fill); + circleElement.attr("stroke", circleData.stroke); + circleElement.attr("r", circleData.r); + if (circleElement.class !== void 0) { + circleElement.attr("class", circleElement.class); + } + if (circleData.title !== void 0) { + circleElement.append("title").text(circleData.title); + } + return circleElement; + }, "drawCircle"); + drawText4 = /* @__PURE__ */ __name(function(elem, textData) { + return drawText(elem, textData); + }, "drawText"); + drawLabel2 = /* @__PURE__ */ __name(function(elem, txtObject) { + function genPoints(x5, y6, width3, height2, cut) { + return x5 + "," + y6 + " " + (x5 + width3) + "," + y6 + " " + (x5 + width3) + "," + (y6 + height2 - cut) + " " + (x5 + width3 - cut * 1.2) + "," + (y6 + height2) + " " + x5 + "," + (y6 + height2); + } + __name(genPoints, "genPoints"); + const polygon2 = elem.append("polygon"); + polygon2.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7)); + polygon2.attr("class", "labelBox"); + txtObject.y = txtObject.y + txtObject.labelMargin; + txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin; + drawText4(elem, txtObject); + }, "drawLabel"); + drawSection = /* @__PURE__ */ __name(function(elem, section, conf5) { + const g2 = elem.append("g"); + const rect3 = getNoteRect(); + rect3.x = section.x; + rect3.y = section.y; + rect3.fill = section.fill; + rect3.width = conf5.width * section.taskCount + // width of the tasks + conf5.diagramMarginX * (section.taskCount - 1); + rect3.height = conf5.height; + rect3.class = "journey-section section-type-" + section.num; + rect3.rx = 3; + rect3.ry = 3; + drawRect5(g2, rect3); + _drawTextCandidateFunc3(conf5)( + section.text, + g2, + rect3.x, + rect3.y, + rect3.width, + rect3.height, + { class: "journey-section section-type-" + section.num }, + conf5, + section.colour + ); + }, "drawSection"); + taskCount = -1; + drawTask = /* @__PURE__ */ __name(function(elem, task, conf5, diagramId3) { + const center4 = task.x + conf5.width / 2; + const g2 = elem.append("g"); + taskCount++; + const maxHeight = 300 + 5 * 30; + g2.append("line").attr("id", diagramId3 + "-task" + taskCount).attr("x1", center4).attr("y1", task.y).attr("x2", center4).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"); + drawFace(g2, { + cx: center4, + cy: 300 + (5 - task.score) * 30, + score: task.score + }); + const rect3 = getNoteRect(); + rect3.x = task.x; + rect3.y = task.y; + rect3.fill = task.fill; + rect3.width = conf5.width; + rect3.height = conf5.height; + rect3.class = "task task-type-" + task.num; + rect3.rx = 3; + rect3.ry = 3; + drawRect5(g2, rect3); + let xPos = task.x + 14; + task.people.forEach((person) => { + const colour = task.actors[person].color; + const circle6 = { + cx: xPos, + cy: task.y, + r: 7, + fill: colour, + stroke: "#000", + title: person, + pos: task.actors[person].position + }; + drawCircle(g2, circle6); + xPos += 10; + }); + _drawTextCandidateFunc3(conf5)( + task.task, + g2, + rect3.x, + rect3.y, + rect3.width, + rect3.height, + { class: "task" }, + conf5, + task.colour + ); + }, "drawTask"); + drawBackgroundRect3 = /* @__PURE__ */ __name(function(elem, bounds4) { + drawBackgroundRect(elem, bounds4); + }, "drawBackgroundRect"); + _drawTextCandidateFunc3 = /* @__PURE__ */ (function() { + function byText(content, g2, x5, y6, width3, height2, textAttrs, colour) { + const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6 + height2 / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content); + _setTextAttrs(text4, textAttrs); + } + __name(byText, "byText"); + function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5, colour) { + const { taskFontSize, taskFontFamily } = conf5; + const lines = content.split(//gi); + for (let i2 = 0; i2 < lines.length; i2++) { + const dy = i2 * taskFontSize - taskFontSize * (lines.length - 1) / 2; + const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily); + text4.append("tspan").attr("x", x5 + width3 / 2).attr("dy", dy).text(lines[i2]); + text4.attr("y", y6 + height2 / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"); + _setTextAttrs(text4, textAttrs); + } + } + __name(byTspan, "byTspan"); + function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) { + const body = g2.append("switch"); + const f2 = body.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2).attr("position", "fixed"); + const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text4.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content); + byTspan(content, body, x5, y6, width3, height2, textAttrs, conf5); + _setTextAttrs(text4, textAttrs); + } + __name(byFo, "byFo"); + function _setTextAttrs(toText, fromTextAttrsDict) { + for (const key in fromTextAttrsDict) { + if (key in fromTextAttrsDict) { + toText.attr(key, fromTextAttrsDict[key]); + } + } + } + __name(_setTextAttrs, "_setTextAttrs"); + return function(conf5) { + return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan; + }; + })(); + initGraphics = /* @__PURE__ */ __name(function(graphics, id35) { + taskCount = -1; + graphics.append("defs").append("marker").attr("id", id35 + "-arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z"); + }, "initGraphics"); + svgDraw_default3 = { + drawRect: drawRect5, + drawCircle, + drawSection, + drawText: drawText4, + drawLabel: drawLabel2, + drawTask, + drawBackgroundRect: drawBackgroundRect3, + initGraphics + }; + } + }); + + // src/diagrams/user-journey/journeyRenderer.ts + function drawActorLegend(diagram32) { + const conf5 = getConfig2().journey; + const maxLabelWidth = conf5.maxLabelWidth; + maxWidth = 0; + let yPos = 60; + Object.keys(actors).forEach((person) => { + const colour = actors[person].color; + const circleData = { + cx: 20, + cy: yPos, + r: 7, + fill: colour, + stroke: "#000", + pos: actors[person].position + }; + svgDraw_default3.drawCircle(diagram32, circleData); + let measureText = diagram32.append("text").attr("visibility", "hidden").text(person); + const fullTextWidth = measureText.node().getBoundingClientRect().width; + measureText.remove(); + let lines = []; + if (fullTextWidth <= maxLabelWidth) { + lines = [person]; + } else { + const words = person.split(" "); + let currentLine = ""; + measureText = diagram32.append("text").attr("visibility", "hidden"); + words.forEach((word) => { + const testLine = currentLine ? `${currentLine} ${word}` : word; + measureText.text(testLine); + const textWidth = measureText.node().getBoundingClientRect().width; + if (textWidth > maxLabelWidth) { + if (currentLine) { + lines.push(currentLine); + } + currentLine = word; + measureText.text(word); + if (measureText.node().getBoundingClientRect().width > maxLabelWidth) { + let brokenWord = ""; + for (const char2 of word) { + brokenWord += char2; + measureText.text(brokenWord + "-"); + if (measureText.node().getBoundingClientRect().width > maxLabelWidth) { + lines.push(brokenWord.slice(0, -1) + "-"); + brokenWord = char2; + } + } + currentLine = brokenWord; + } + } else { + currentLine = testLine; + } + }); + if (currentLine) { + lines.push(currentLine); + } + measureText.remove(); + } + lines.forEach((line2, index) => { + const labelData = { + x: 40, + y: yPos + 7 + index * 20, + fill: "#666", + text: line2, + textMargin: conf5.boxTextMargin ?? 5 + }; + const textElement = svgDraw_default3.drawText(diagram32, labelData); + const lineWidth = textElement.node().getBoundingClientRect().width; + if (lineWidth > maxWidth && lineWidth > conf5.leftMargin - lineWidth) { + maxWidth = lineWidth; + } + }); + yPos += Math.max(20, lines.length * 20); + }); + } + var setConf5, actors, maxWidth, conf4, leftMargin, draw15, bounds3, fills, textColours, drawTasks, journeyRenderer_default; + var init_journeyRenderer = __esm({ + "src/diagrams/user-journey/journeyRenderer.ts"() { + "use strict"; + init_src32(); + init_svgDraw3(); + init_diagramAPI(); + init_setupGraphViewbox(); + setConf5 = /* @__PURE__ */ __name(function(cnf) { + const keys3 = Object.keys(cnf); + keys3.forEach(function(key) { + conf4[key] = cnf[key]; + }); + }, "setConf"); + actors = {}; + maxWidth = 0; + __name(drawActorLegend, "drawActorLegend"); + conf4 = getConfig2().journey; + leftMargin = 0; + draw15 = /* @__PURE__ */ __name(function(text4, id35, version3, diagObj) { + const configObject = getConfig2(); + const titleColor = configObject.journey.titleColor; + const titleFontSize = configObject.journey.titleFontSize; + const titleFontFamily = configObject.journey.titleFontFamily; + const securityLevel = configObject.securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + bounds3.init(); + const diagram32 = root4.select("#" + id35); + svgDraw_default3.initGraphics(diagram32, id35); + const tasks4 = diagObj.db.getTasks(); + const title2 = diagObj.db.getDiagramTitle(); + const actorNames = diagObj.db.getActors(); + for (const member in actors) { + delete actors[member]; + } + let actorPos = 0; + actorNames.forEach((actorName) => { + actors[actorName] = { + color: conf4.actorColours[actorPos % conf4.actorColours.length], + position: actorPos + }; + actorPos++; + }); + drawActorLegend(diagram32); + leftMargin = conf4.leftMargin + maxWidth; + bounds3.insert(0, 0, leftMargin, Object.keys(actors).length * 50); + drawTasks(diagram32, tasks4, 0, id35); + const box = bounds3.getBounds(); + if (title2) { + diagram32.append("text").text(title2).attr("x", leftMargin).attr("font-size", titleFontSize).attr("font-weight", "bold").attr("y", 25).attr("fill", titleColor).attr("font-family", titleFontFamily); + } + const height2 = box.stopy - box.starty + 2 * conf4.diagramMarginY; + const width3 = leftMargin + box.stopx + 2 * conf4.diagramMarginX; + configureSvgSize(diagram32, height2, width3, conf4.useMaxWidth); + diagram32.append("line").attr("x1", leftMargin).attr("y1", conf4.height * 4).attr("x2", width3 - leftMargin - 4).attr("y2", conf4.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#" + id35 + "-arrowhead)"); + const extraVertForTitle = title2 ? 70 : 0; + diagram32.attr("viewBox", `${box.startx} -25 ${width3} ${height2 + extraVertForTitle}`); + diagram32.attr("preserveAspectRatio", "xMinYMin meet"); + diagram32.attr("height", height2 + extraVertForTitle + 25); + }, "draw"); + bounds3 = { + data: { + startx: void 0, + stopx: void 0, + starty: void 0, + stopy: void 0 + }, + verticalPos: 0, + sequenceItems: [], + init: /* @__PURE__ */ __name(function() { + this.sequenceItems = []; + this.data = { + startx: void 0, + stopx: void 0, + starty: void 0, + stopy: void 0 + }; + this.verticalPos = 0; + }, "init"), + updateVal: /* @__PURE__ */ __name(function(obj, key, val, fun) { + if (obj[key] === void 0) { + obj[key] = val; + } else { + obj[key] = fun(val, obj[key]); + } + }, "updateVal"), + updateBounds: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) { + const conf5 = getConfig2().journey; + const _self = this; + let cnt4 = 0; + function updateFn(type3) { + return /* @__PURE__ */ __name(function updateItemBounds(item) { + cnt4++; + const n2 = _self.sequenceItems.length - cnt4 + 1; + _self.updateVal(item, "starty", starty - n2 * conf5.boxMargin, Math.min); + _self.updateVal(item, "stopy", stopy + n2 * conf5.boxMargin, Math.max); + _self.updateVal(bounds3.data, "startx", startx - n2 * conf5.boxMargin, Math.min); + _self.updateVal(bounds3.data, "stopx", stopx + n2 * conf5.boxMargin, Math.max); + if (!(type3 === "activation")) { + _self.updateVal(item, "startx", startx - n2 * conf5.boxMargin, Math.min); + _self.updateVal(item, "stopx", stopx + n2 * conf5.boxMargin, Math.max); + _self.updateVal(bounds3.data, "starty", starty - n2 * conf5.boxMargin, Math.min); + _self.updateVal(bounds3.data, "stopy", stopy + n2 * conf5.boxMargin, Math.max); + } + }, "updateItemBounds"); + } + __name(updateFn, "updateFn"); + this.sequenceItems.forEach(updateFn()); + }, "updateBounds"), + insert: /* @__PURE__ */ __name(function(startx, starty, stopx, stopy) { + const _startx = Math.min(startx, stopx); + const _stopx = Math.max(startx, stopx); + const _starty = Math.min(starty, stopy); + const _stopy = Math.max(starty, stopy); + this.updateVal(bounds3.data, "startx", _startx, Math.min); + this.updateVal(bounds3.data, "starty", _starty, Math.min); + this.updateVal(bounds3.data, "stopx", _stopx, Math.max); + this.updateVal(bounds3.data, "stopy", _stopy, Math.max); + this.updateBounds(_startx, _starty, _stopx, _stopy); + }, "insert"), + bumpVerticalPos: /* @__PURE__ */ __name(function(bump) { + this.verticalPos = this.verticalPos + bump; + this.data.stopy = this.verticalPos; + }, "bumpVerticalPos"), + getVerticalPos: /* @__PURE__ */ __name(function() { + return this.verticalPos; + }, "getVerticalPos"), + getBounds: /* @__PURE__ */ __name(function() { + return this.data; + }, "getBounds") + }; + fills = conf4.sectionFills; + textColours = conf4.sectionColours; + drawTasks = /* @__PURE__ */ __name(function(diagram32, tasks4, verticalPos, diagramId3) { + const conf5 = getConfig2().journey; + let lastSection = ""; + const sectionVHeight = conf5.height * 2 + conf5.diagramMarginY; + const taskPos = verticalPos + sectionVHeight; + let sectionNumber = 0; + let fill = "#CCC"; + let colour = "black"; + let num = 0; + for (const [i2, task] of tasks4.entries()) { + if (lastSection !== task.section) { + fill = fills[sectionNumber % fills.length]; + num = sectionNumber % fills.length; + colour = textColours[sectionNumber % textColours.length]; + let taskInSectionCount = 0; + const currentSection4 = task.section; + for (let taskIndex = i2; taskIndex < tasks4.length; taskIndex++) { + if (tasks4[taskIndex].section == currentSection4) { + taskInSectionCount = taskInSectionCount + 1; + } else { + break; + } + } + const section = { + x: i2 * conf5.taskMargin + i2 * conf5.width + leftMargin, + y: 50, + text: task.section, + fill, + num, + colour, + taskCount: taskInSectionCount + }; + svgDraw_default3.drawSection(diagram32, section, conf5); + lastSection = task.section; + sectionNumber++; + } + const taskActors = task.people.reduce((acc, actorName) => { + if (actors[actorName]) { + acc[actorName] = actors[actorName]; + } + return acc; + }, {}); + task.x = i2 * conf5.taskMargin + i2 * conf5.width + leftMargin; + task.y = taskPos; + task.width = conf5.diagramMarginX; + task.height = conf5.diagramMarginY; + task.colour = colour; + task.fill = fill; + task.num = num; + task.actors = taskActors; + svgDraw_default3.drawTask(diagram32, task, conf5, diagramId3); + bounds3.insert(task.x, task.y, task.x + task.width + conf5.taskMargin, 300 + 5 * 30); + } + }, "drawTasks"); + journeyRenderer_default = { + setConf: setConf5, + draw: draw15 + }; + } + }); + + // src/diagrams/user-journey/journeyDiagram.ts + var journeyDiagram_exports = {}; + __export(journeyDiagram_exports, { + diagram: () => diagram16 + }); + var diagram16; + var init_journeyDiagram = __esm({ + "src/diagrams/user-journey/journeyDiagram.ts"() { + "use strict"; + init_journey(); + init_journeyDb(); + init_styles11(); + init_journeyRenderer(); + diagram16 = { + parser: journey_default, + db: journeyDb_default, + renderer: journeyRenderer_default, + styles: styles_default11, + init: /* @__PURE__ */ __name((cnf) => { + journeyRenderer_default.setConf(cnf.journey); + journeyDb_default.clear(); + }, "init") + }; + } + }); + + // src/diagrams/timeline/parser/timeline.jison + var parser15, timeline_default; + var init_timeline = __esm({ + "src/diagrams/timeline/parser/timeline.jison"() { + "use strict"; + parser15 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [6, 11, 13, 14, 15, 17, 19, 20, 23, 24], $V1 = [1, 12], $V2 = [1, 13], $V3 = [1, 14], $V4 = [1, 15], $V5 = [1, 16], $V6 = [1, 19], $V7 = [1, 20]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "timeline_header": 4, "document": 5, "EOF": 6, "timeline": 7, "timeline_lr": 8, "timeline_td": 9, "line": 10, "SPACE": 11, "statement": 12, "NEWLINE": 13, "title": 14, "acc_title": 15, "acc_title_value": 16, "acc_descr": 17, "acc_descr_value": 18, "acc_descr_multiline_value": 19, "section": 20, "period_statement": 21, "event_statement": 22, "period": 23, "event": 24, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 6: "EOF", 7: "timeline", 8: "timeline_lr", 9: "timeline_td", 11: "SPACE", 13: "NEWLINE", 14: "title", 15: "acc_title", 16: "acc_title_value", 17: "acc_descr", 18: "acc_descr_value", 19: "acc_descr_multiline_value", 20: "section", 23: "period", 24: "event" }, + productions_: [0, [3, 3], [4, 1], [4, 1], [4, 1], [5, 0], [5, 2], [10, 2], [10, 1], [10, 1], [10, 1], [12, 1], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [21, 1], [22, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 3: + yy.setDirection("LR"); + break; + case 4: + yy.setDirection("TD"); + break; + case 5: + this.$ = []; + break; + case 6: + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + break; + case 7: + case 8: + this.$ = $$[$0]; + break; + case 9: + case 10: + this.$ = []; + break; + case 11: + yy.getCommonDb().setDiagramTitle($$[$0].substr(6)); + this.$ = $$[$0].substr(6); + break; + case 12: + this.$ = $$[$0].trim(); + yy.getCommonDb().setAccTitle(this.$); + break; + case 13: + case 14: + this.$ = $$[$0].trim(); + yy.getCommonDb().setAccDescription(this.$); + break; + case 15: + yy.addSection($$[$0].substr(8)); + this.$ = $$[$0].substr(8); + break; + case 18: + yy.addTask($$[$0], 0, ""); + this.$ = $$[$0]; + break; + case 19: + yy.addEvent($$[$0].substr(2)); + this.$ = $$[$0]; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 7: [1, 3], 8: [1, 4], 9: [1, 5] }, { 1: [3] }, o2($V0, [2, 5], { 5: 6 }), o2($V0, [2, 2]), o2($V0, [2, 3]), o2($V0, [2, 4]), { 6: [1, 7], 10: 8, 11: [1, 9], 12: 10, 13: [1, 11], 14: $V1, 15: $V2, 17: $V3, 19: $V4, 20: $V5, 21: 17, 22: 18, 23: $V6, 24: $V7 }, o2($V0, [2, 10], { 1: [2, 1] }), o2($V0, [2, 6]), { 12: 21, 14: $V1, 15: $V2, 17: $V3, 19: $V4, 20: $V5, 21: 17, 22: 18, 23: $V6, 24: $V7 }, o2($V0, [2, 8]), o2($V0, [2, 9]), o2($V0, [2, 11]), { 16: [1, 22] }, { 18: [1, 23] }, o2($V0, [2, 14]), o2($V0, [2, 15]), o2($V0, [2, 16]), o2($V0, [2, 17]), o2($V0, [2, 18]), o2($V0, [2, 19]), o2($V0, [2, 7]), o2($V0, [2, 12]), o2($V0, [2, 13])], + defaultActions: {}, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + break; + case 1: + break; + case 2: + return 13; + break; + case 3: + break; + case 4: + break; + case 5: + return 8; + break; + case 6: + return 9; + break; + case 7: + return 7; + break; + case 8: + return 14; + break; + case 9: + this.begin("acc_title"); + return 15; + break; + case 10: + this.popState(); + return "acc_title_value"; + break; + case 11: + this.begin("acc_descr"); + return 17; + break; + case 12: + this.popState(); + return "acc_descr_value"; + break; + case 13: + this.begin("acc_descr_multiline"); + break; + case 14: + this.popState(); + break; + case 15: + return "acc_descr_multiline_value"; + break; + case 16: + return 20; + break; + case 17: + return 24; + break; + case 18: + return 23; + break; + case 19: + return 6; + break; + case 20: + return "INVALID"; + break; + } + }, "anonymous"), + rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline[ \t]+LR\b)/i, /^(?:timeline[ \t]+TD\b)/i, /^(?:timeline\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^:\n]+)/i, /^(?::\s(?:[^:\n]|:(?!\s))+)/i, /^(?:[^#:\n]+)/i, /^(?:$)/i, /^(?:.)/i], + conditions: { "acc_descr_multiline": { "rules": [14, 15], "inclusive": false }, "acc_descr": { "rules": [12], "inclusive": false }, "acc_title": { "rules": [10], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16, 17, 18, 19, 20], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser15.parser = parser15; + timeline_default = parser15; + } + }); + + // src/diagrams/timeline/timelineDb.js + var timelineDb_exports = {}; + __export(timelineDb_exports, { + addEvent: () => addEvent, + addSection: () => addSection4, + addTask: () => addTask3, + addTaskOrg: () => addTaskOrg3, + clear: () => clear14, + default: () => timelineDb_default, + getCommonDb: () => getCommonDb2, + getDirection: () => getDirection2, + getSections: () => getSections4, + getTasks: () => getTasks3, + setDirection: () => setDirection2 + }); + var currentSection3, currentTaskId, direction, sections4, tasks3, rawTasks3, getCommonDb2, clear14, setDirection2, getDirection2, addSection4, getSections4, getTasks3, addTask3, addEvent, addTaskOrg3, compileTasks3, timelineDb_default; + var init_timelineDb = __esm({ + "src/diagrams/timeline/timelineDb.js"() { + "use strict"; + init_commonDb(); + currentSection3 = ""; + currentTaskId = 0; + direction = "LR"; + sections4 = []; + tasks3 = []; + rawTasks3 = []; + getCommonDb2 = /* @__PURE__ */ __name(() => commonDb_exports, "getCommonDb"); + clear14 = /* @__PURE__ */ __name(function() { + sections4.length = 0; + tasks3.length = 0; + currentSection3 = ""; + rawTasks3.length = 0; + direction = "LR"; + clear(); + }, "clear"); + setDirection2 = /* @__PURE__ */ __name(function(dir2) { + direction = dir2; + }, "setDirection"); + getDirection2 = /* @__PURE__ */ __name(function() { + return direction; + }, "getDirection"); + addSection4 = /* @__PURE__ */ __name(function(txt) { + currentSection3 = txt; + sections4.push(txt); + }, "addSection"); + getSections4 = /* @__PURE__ */ __name(function() { + return sections4; + }, "getSections"); + getTasks3 = /* @__PURE__ */ __name(function() { + let allItemsProcessed = compileTasks3(); + const maxDepth = 100; + let iterationCount = 0; + while (!allItemsProcessed && iterationCount < maxDepth) { + allItemsProcessed = compileTasks3(); + iterationCount++; + } + tasks3.push(...rawTasks3); + return tasks3; + }, "getTasks"); + addTask3 = /* @__PURE__ */ __name(function(period, length2, event3) { + const rawTask = { + id: currentTaskId++, + section: currentSection3, + type: currentSection3, + task: period, + score: length2 ? length2 : 0, + //if event is defined, then add it the events array + events: event3 ? [event3] : [] + }; + rawTasks3.push(rawTask); + }, "addTask"); + addEvent = /* @__PURE__ */ __name(function(event3) { + const currentTask = rawTasks3.find((task) => task.id === currentTaskId - 1); + currentTask.events.push(event3); + }, "addEvent"); + addTaskOrg3 = /* @__PURE__ */ __name(function(descr) { + const newTask = { + section: currentSection3, + type: currentSection3, + description: descr, + task: descr, + classes: [] + }; + tasks3.push(newTask); + }, "addTaskOrg"); + compileTasks3 = /* @__PURE__ */ __name(function() { + const compileTask = /* @__PURE__ */ __name(function(pos) { + return rawTasks3[pos].processed; + }, "compileTask"); + let allProcessed = true; + for (const [i2, rawTask] of rawTasks3.entries()) { + compileTask(i2); + allProcessed = allProcessed && rawTask.processed; + } + return allProcessed; + }, "compileTasks"); + timelineDb_default = { + clear: clear14, + getCommonDb: getCommonDb2, + getDirection: getDirection2, + setDirection: setDirection2, + addSection: addSection4, + getSections: getSections4, + getTasks: getTasks3, + addTask: addTask3, + addTaskOrg: addTaskOrg3, + addEvent + }; + } + }); + + // src/diagrams/timeline/svgDraw.js + function wrap2(text4, width3) { + text4.each(function() { + var text5 = select_default2(this), words = text5.text().split(/(\s+|
    )/).reverse(), word, line2 = [], lineHeight = 1.1, y6 = text5.attr("y"), dy = parseFloat(text5.attr("dy")), tspan = text5.text(null).append("tspan").attr("x", 0).attr("y", y6).attr("dy", dy + "em"); + for (let j3 = 0; j3 < words.length; j3++) { + word = words[words.length - 1 - j3]; + line2.push(word); + tspan.text(line2.join(" ").trim()); + if (tspan.node().getComputedTextLength() > width3 || word === "
    ") { + line2.pop(); + tspan.text(line2.join(" ").trim()); + if (word === "
    ") { + line2 = [""]; + } else { + line2 = [word]; + } + tspan = text5.append("tspan").attr("x", 0).attr("y", y6).attr("dy", lineHeight + "em").text(word); + } + } + }); + } + var nodeCount, drawRect6, drawFace2, drawCircle2, drawText5, drawLabel3, drawSection2, taskCount2, drawTask2, drawBackgroundRect4, getTextObj4, getNoteRect3, _drawTextCandidateFunc4, initGraphics2, drawNode, getVirtualNodeHeight, defaultBkg, svgDraw_default4; + var init_svgDraw4 = __esm({ + "src/diagrams/timeline/svgDraw.js"() { + "use strict"; + init_src32(); + nodeCount = 0; + drawRect6 = /* @__PURE__ */ __name(function(elem, rectData) { + const rectElem = elem.append("rect"); + rectElem.attr("x", rectData.x); + rectElem.attr("y", rectData.y); + rectElem.attr("fill", rectData.fill); + rectElem.attr("stroke", rectData.stroke); + rectElem.attr("width", rectData.width); + rectElem.attr("height", rectData.height); + rectElem.attr("rx", rectData.rx); + rectElem.attr("ry", rectData.ry); + if (rectData.class !== void 0) { + rectElem.attr("class", rectData.class); + } + return rectElem; + }, "drawRect"); + drawFace2 = /* @__PURE__ */ __name(function(element3, faceData) { + const radius2 = 15; + const circleElement = element3.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius2).attr("stroke-width", 2).attr("overflow", "visible"); + const face = element3.append("g"); + face.append("circle").attr("cx", faceData.cx - radius2 / 3).attr("cy", faceData.cy - radius2 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"); + face.append("circle").attr("cx", faceData.cx + radius2 / 3).attr("cy", faceData.cy - radius2 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"); + function smile(face2) { + const arc = arc_default().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius2 / 2).outerRadius(radius2 / 2.2); + face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")"); + } + __name(smile, "smile"); + function sad(face2) { + const arc = arc_default().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius2 / 2).outerRadius(radius2 / 2.2); + face2.append("path").attr("class", "mouth").attr("d", arc).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")"); + } + __name(sad, "sad"); + function ambivalent(face2) { + face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666"); + } + __name(ambivalent, "ambivalent"); + if (faceData.score > 3) { + smile(face); + } else if (faceData.score < 3) { + sad(face); + } else { + ambivalent(face); + } + return circleElement; + }, "drawFace"); + drawCircle2 = /* @__PURE__ */ __name(function(element3, circleData) { + const circleElement = element3.append("circle"); + circleElement.attr("cx", circleData.cx); + circleElement.attr("cy", circleData.cy); + circleElement.attr("class", "actor-" + circleData.pos); + circleElement.attr("fill", circleData.fill); + circleElement.attr("stroke", circleData.stroke); + circleElement.attr("r", circleData.r); + if (circleElement.class !== void 0) { + circleElement.attr("class", circleElement.class); + } + if (circleData.title !== void 0) { + circleElement.append("title").text(circleData.title); + } + return circleElement; + }, "drawCircle"); + drawText5 = /* @__PURE__ */ __name(function(elem, textData) { + const nText = textData.text.replace(//gi, " "); + const textElem = elem.append("text"); + textElem.attr("x", textData.x); + textElem.attr("y", textData.y); + textElem.attr("class", "legend"); + textElem.style("text-anchor", textData.anchor); + if (textData.class !== void 0) { + textElem.attr("class", textData.class); + } + const span = textElem.append("tspan"); + span.attr("x", textData.x + textData.textMargin * 2); + span.text(nText); + return textElem; + }, "drawText"); + drawLabel3 = /* @__PURE__ */ __name(function(elem, txtObject) { + function genPoints(x5, y6, width3, height2, cut) { + return x5 + "," + y6 + " " + (x5 + width3) + "," + y6 + " " + (x5 + width3) + "," + (y6 + height2 - cut) + " " + (x5 + width3 - cut * 1.2) + "," + (y6 + height2) + " " + x5 + "," + (y6 + height2); + } + __name(genPoints, "genPoints"); + const polygon2 = elem.append("polygon"); + polygon2.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7)); + polygon2.attr("class", "labelBox"); + txtObject.y = txtObject.y + txtObject.labelMargin; + txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin; + drawText5(elem, txtObject); + }, "drawLabel"); + drawSection2 = /* @__PURE__ */ __name(function(elem, section, conf5) { + const g2 = elem.append("g"); + const rect3 = getNoteRect3(); + rect3.x = section.x; + rect3.y = section.y; + rect3.fill = section.fill; + rect3.width = conf5.width; + rect3.height = conf5.height; + rect3.class = "journey-section section-type-" + section.num; + rect3.rx = 3; + rect3.ry = 3; + drawRect6(g2, rect3); + _drawTextCandidateFunc4(conf5)( + section.text, + g2, + rect3.x, + rect3.y, + rect3.width, + rect3.height, + { class: "journey-section section-type-" + section.num }, + conf5, + section.colour + ); + }, "drawSection"); + taskCount2 = -1; + drawTask2 = /* @__PURE__ */ __name(function(elem, task, conf5, diagramId3) { + const center4 = task.x + conf5.width / 2; + const g2 = elem.append("g"); + taskCount2++; + const maxHeight = 300 + 5 * 30; + g2.append("line").attr("id", diagramId3 + "-task" + taskCount2).attr("x1", center4).attr("y1", task.y).attr("x2", center4).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"); + drawFace2(g2, { + cx: center4, + cy: 300 + (5 - task.score) * 30, + score: task.score + }); + const rect3 = getNoteRect3(); + rect3.x = task.x; + rect3.y = task.y; + rect3.fill = task.fill; + rect3.width = conf5.width; + rect3.height = conf5.height; + rect3.class = "task task-type-" + task.num; + rect3.rx = 3; + rect3.ry = 3; + drawRect6(g2, rect3); + _drawTextCandidateFunc4(conf5)( + task.task, + g2, + rect3.x, + rect3.y, + rect3.width, + rect3.height, + { class: "task" }, + conf5, + task.colour + ); + }, "drawTask"); + drawBackgroundRect4 = /* @__PURE__ */ __name(function(elem, bounds4) { + const rectElem = drawRect6(elem, { + x: bounds4.startx, + y: bounds4.starty, + width: bounds4.stopx - bounds4.startx, + height: bounds4.stopy - bounds4.starty, + fill: bounds4.fill, + class: "rect" + }); + rectElem.lower(); + }, "drawBackgroundRect"); + getTextObj4 = /* @__PURE__ */ __name(function() { + return { + x: 0, + y: 0, + fill: void 0, + "text-anchor": "start", + width: 100, + height: 100, + textMargin: 0, + rx: 0, + ry: 0 + }; + }, "getTextObj"); + getNoteRect3 = /* @__PURE__ */ __name(function() { + return { + x: 0, + y: 0, + width: 100, + anchor: "start", + height: 100, + rx: 0, + ry: 0 + }; + }, "getNoteRect"); + _drawTextCandidateFunc4 = /* @__PURE__ */ (function() { + function byText(content, g2, x5, y6, width3, height2, textAttrs, colour) { + const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6 + height2 / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content); + _setTextAttrs(text4, textAttrs); + } + __name(byText, "byText"); + function byTspan(content, g2, x5, y6, width3, height2, textAttrs, conf5, colour) { + const { taskFontSize, taskFontFamily } = conf5; + const lines = content.split(//gi); + for (let i2 = 0; i2 < lines.length; i2++) { + const dy = i2 * taskFontSize - taskFontSize * (lines.length - 1) / 2; + const text4 = g2.append("text").attr("x", x5 + width3 / 2).attr("y", y6).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily); + text4.append("tspan").attr("x", x5 + width3 / 2).attr("dy", dy).text(lines[i2]); + text4.attr("y", y6 + height2 / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"); + _setTextAttrs(text4, textAttrs); + } + } + __name(byTspan, "byTspan"); + function byFo(content, g2, x5, y6, width3, height2, textAttrs, conf5) { + const body = g2.append("switch"); + const f2 = body.append("foreignObject").attr("x", x5).attr("y", y6).attr("width", width3).attr("height", height2).attr("position", "fixed"); + const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text4.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content); + byTspan(content, body, x5, y6, width3, height2, textAttrs, conf5); + _setTextAttrs(text4, textAttrs); + } + __name(byFo, "byFo"); + function _setTextAttrs(toText, fromTextAttrsDict) { + for (const key in fromTextAttrsDict) { + if (key in fromTextAttrsDict) { + toText.attr(key, fromTextAttrsDict[key]); + } + } + } + __name(_setTextAttrs, "_setTextAttrs"); + return function(conf5) { + return conf5.textPlacement === "fo" ? byFo : conf5.textPlacement === "old" ? byText : byTspan; + }; + })(); + initGraphics2 = /* @__PURE__ */ __name(function(graphics, id35) { + nodeCount = 0; + taskCount2 = -1; + graphics.append("defs").append("marker").attr("id", id35 + "-arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z"); + }, "initGraphics"); + __name(wrap2, "wrap"); + drawNode = /* @__PURE__ */ __name(function(elem, node2, fullSection, conf5, diagramId3, isEvent = false) { + const { theme, look } = conf5; + const isReduxTheme = theme?.includes("redux"); + const maxSections = conf5?.themeVariables?.THEME_COLOR_LIMIT ?? 12; + const section = fullSection % maxSections - 1; + const nodeElem = elem.append("g"); + node2.section = section; + nodeElem.attr( + "class", + (node2.class ? node2.class + " " : "") + "timeline-node " + ("section-" + section) + ); + const bkgElem = nodeElem.append("g"); + const textElem = nodeElem.append("g"); + const txt = textElem.append("text").text(node2.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap2, node2.width); + const bbox = txt.node().getBBox(); + const fontSize = conf5.fontSize?.replace ? conf5.fontSize.replace("px", "") : conf5.fontSize; + node2.height = bbox.height + fontSize * 1.1 * 0.5 + node2.padding; + node2.height = Math.max(node2.height, node2.maxHeight); + node2.width = node2.width + 2 * node2.padding; + textElem.attr("transform", "translate(" + node2.width / 2 + ", " + node2.padding / 2 + ")"); + if (isReduxTheme) { + textElem.attr( + "transform", + `translate(${node2.width / 2}, ${isEvent ? node2.padding / 2 + 3 : node2.padding})` + ); + } + defaultBkg(bkgElem, node2, section, diagramId3, conf5); + if (look === "neo") { + nodeElem.attr("data-look", `neo`); + if (isReduxTheme) { + const isDark2 = theme.includes("dark"); + const rootSvgNode = elem.node()?.ownerSVGElement ?? elem.node(); + const rootSvg = select_default2(rootSvgNode); + const svgId = rootSvg.attr("id") ?? ""; + const dropShadowId = svgId ? `${svgId}-drop-shadow` : "drop-shadow"; + if (rootSvg.select(`#${dropShadowId}`).empty()) { + const existingDefs = rootSvg.select("defs"); + const defsEl = existingDefs.empty() ? rootSvg.append("defs") : existingDefs; + defsEl.append("filter").attr("id", dropShadowId).attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", isDark2 ? "0.2" : "0.06").attr("flood-color", isDark2 ? "#FFFFFF" : "#000000"); + } + } + } + return node2; + }, "drawNode"); + getVirtualNodeHeight = /* @__PURE__ */ __name(function(elem, node2, conf5) { + const textElem = elem.append("g"); + const txt = textElem.append("text").text(node2.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(wrap2, node2.width); + const bbox = txt.node().getBBox(); + const fontSize = conf5.fontSize?.replace ? conf5.fontSize.replace("px", "") : conf5.fontSize; + textElem.remove(); + return bbox.height + fontSize * 1.1 * 0.5 + node2.padding; + }, "getVirtualNodeHeight"); + defaultBkg = /* @__PURE__ */ __name(function(elem, node2, section, diagramId3, config5) { + const { theme } = config5; + const r2 = theme?.includes("redux") ? 0 : 5; + const rd = 5; + const d3 = r2 > 0 ? `M0 ${node2.height - rd} v${-node2.height + 2 * rd} q0,-${r2},${r2},-${r2} h${node2.width - 2 * rd} q${r2},0,${r2},${r2} v${node2.height - rd} H0 Z` : `M0 ${node2.height - rd} v${-(node2.height - rd)} h${node2.width} v${node2.height} H0 Z`; + elem.append("path").attr("id", diagramId3 + "-node-" + nodeCount++).attr("class", "node-bkg node-" + node2.type).attr("d", d3); + if (!theme?.includes("redux")) { + elem.append("line").attr("class", "node-line-" + section).attr("x1", 0).attr("y1", node2.height).attr("x2", node2.width).attr("y2", node2.height); + } + }, "defaultBkg"); + svgDraw_default4 = { + drawRect: drawRect6, + drawCircle: drawCircle2, + drawSection: drawSection2, + drawText: drawText5, + drawLabel: drawLabel3, + drawTask: drawTask2, + drawBackgroundRect: drawBackgroundRect4, + getTextObj: getTextObj4, + getNoteRect: getNoteRect3, + initGraphics: initGraphics2, + drawNode, + getVirtualNodeHeight + }; + } + }); + + // src/diagrams/timeline/timelineRenderer.ts + var draw17, drawTasks2, drawEvents, timelineRenderer_default; + var init_timelineRenderer = __esm({ + "src/diagrams/timeline/timelineRenderer.ts"() { + "use strict"; + init_src32(); + init_svgDraw4(); + init_logger(); + init_diagramAPI(); + init_setupGraphViewbox(); + draw17 = /* @__PURE__ */ __name(function(text4, id35, version3, diagObj) { + const conf5 = getConfig2(); + const { look, theme, themeVariables } = conf5; + const { useGradient, gradientStart, gradientStop } = themeVariables; + const LEFT_MARGIN = conf5.timeline?.leftMargin ?? 50; + log.debug("timeline", diagObj.db); + const securityLevel = conf5.securityLevel; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + const svg2 = root4.select("#" + id35); + svg2.append("g"); + const tasks4 = diagObj.db.getTasks(); + const title2 = diagObj.db.getCommonDb().getDiagramTitle(); + log.debug("task", tasks4); + svgDraw_default4.initGraphics(svg2, id35); + const sections6 = diagObj.db.getSections(); + log.debug("sections", sections6); + let maxSectionHeight = 0; + let maxTaskHeight = 0; + let depthY = 0; + let sectionBeginY = 0; + let masterX = 50 + LEFT_MARGIN; + let masterY = 50; + sectionBeginY = 50; + let sectionNumber = 0; + let hasSections = true; + sections6.forEach(function(section) { + const sectionNode = { + number: sectionNumber, + descr: section, + section: sectionNumber, + width: 150, + padding: 20, + maxHeight: maxSectionHeight + }; + const sectionHeight = svgDraw_default4.getVirtualNodeHeight(svg2, sectionNode, conf5); + log.debug("sectionHeight before draw", sectionHeight); + maxSectionHeight = Math.max(maxSectionHeight, sectionHeight + 20); + }); + let maxEventCount = 0; + let maxEventLineLength = 0; + log.debug("tasks.length", tasks4.length); + for (const [i2, task] of tasks4.entries()) { + const taskNode = { + number: i2, + descr: task, + section: task.section, + width: 150, + padding: 20, + maxHeight: maxTaskHeight + }; + const taskHeight = svgDraw_default4.getVirtualNodeHeight(svg2, taskNode, conf5); + log.debug("taskHeight before draw", taskHeight); + maxTaskHeight = Math.max(maxTaskHeight, taskHeight + 20); + maxEventCount = Math.max(maxEventCount, task.events.length); + let maxEventLineLengthTemp = 0; + for (const event3 of task.events) { + const eventNode = { + descr: event3, + section: task.section, + number: task.section, + width: 150, + padding: 20, + maxHeight: 50 + }; + maxEventLineLengthTemp += svgDraw_default4.getVirtualNodeHeight(svg2, eventNode, conf5); + } + if (task.events.length > 0) { + maxEventLineLengthTemp += (task.events.length - 1) * 10; + } + maxEventLineLength = Math.max(maxEventLineLength, maxEventLineLengthTemp); + } + log.debug("maxSectionHeight before draw", maxSectionHeight); + log.debug("maxTaskHeight before draw", maxTaskHeight); + if (sections6 && sections6.length > 0) { + sections6.forEach((section) => { + const tasksForSection = tasks4.filter((task) => task.section === section); + const sectionNode = { + number: sectionNumber, + descr: section, + section: sectionNumber, + width: 200 * Math.max(tasksForSection.length, 1) - 50, + padding: 20, + maxHeight: maxSectionHeight + }; + log.debug("sectionNode", sectionNode); + const sectionNodeWrapper = svg2.append("g"); + const node2 = svgDraw_default4.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf5, id35); + log.debug("sectionNode output", node2); + sectionNodeWrapper.attr("transform", `translate(${masterX}, ${sectionBeginY})`); + masterY += maxSectionHeight + 50; + if (tasksForSection.length > 0) { + drawTasks2( + svg2, + tasksForSection, + sectionNumber, + masterX, + masterY, + maxTaskHeight, + conf5, + maxEventCount, + maxEventLineLength, + maxSectionHeight, + false, + id35 + ); + } + masterX += 200 * Math.max(tasksForSection.length, 1); + masterY = sectionBeginY; + sectionNumber++; + }); + } else { + hasSections = false; + drawTasks2( + svg2, + tasks4, + sectionNumber, + masterX, + masterY, + maxTaskHeight, + conf5, + maxEventCount, + maxEventLineLength, + maxSectionHeight, + true, + id35 + ); + } + const box = svg2.node().getBBox(); + log.debug("bounds", box); + if (title2) { + svg2.append("text").text(title2).attr("x", look === "neo" ? box.x * 2 + LEFT_MARGIN : box.width / 2 - LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20); + } + depthY = hasSections ? maxSectionHeight + maxTaskHeight + 150 : maxTaskHeight + 100; + const lineWrapper = svg2.append("g").attr("class", "lineWrapper"); + lineWrapper.append("line").attr("x1", LEFT_MARGIN).attr("y1", depthY).attr("x2", box.width + 3 * LEFT_MARGIN).attr("y2", depthY).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", `url(#${id35}-arrowhead)`); + if (look === "neo" && useGradient && theme !== "neutral") { + const existingDefs = svg2.select("defs"); + const defsEl = existingDefs.empty() ? svg2.append("defs") : existingDefs; + const gradient = defsEl.append("linearGradient").attr("id", svg2.attr("id") + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%"); + gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1); + gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1); + } + setupGraphViewbox( + void 0, + svg2, + conf5.timeline?.padding ?? 50, + conf5.timeline?.useMaxWidth ?? false + ); + }, "draw"); + drawTasks2 = /* @__PURE__ */ __name(function(diagram32, tasks4, sectionColor, masterX, masterY, maxTaskHeight, conf5, maxEventCount, maxEventLineLength, maxSectionHeight, isWithoutSections, diagramId3) { + for (const task of tasks4) { + const taskNode = { + descr: task.task, + section: sectionColor, + number: sectionColor, + width: 150, + padding: 20, + maxHeight: maxTaskHeight + }; + log.debug("taskNode", taskNode); + const taskWrapper = diagram32.append("g").attr("class", "taskWrapper"); + const node2 = svgDraw_default4.drawNode(taskWrapper, taskNode, sectionColor, conf5, diagramId3); + const taskHeight = node2.height; + log.debug("taskHeight after draw", taskHeight); + taskWrapper.attr("transform", `translate(${masterX}, ${masterY})`); + maxTaskHeight = Math.max(maxTaskHeight, taskHeight); + if (task.events) { + const lineWrapper = diagram32.append("g").attr("class", "lineWrapper"); + let lineLength = maxTaskHeight; + masterY += 100; + lineLength = lineLength + drawEvents(diagram32, task.events, sectionColor, masterX, masterY, conf5, diagramId3); + masterY -= 100; + lineWrapper.append("line").attr("x1", masterX + 190 / 2).attr("y1", masterY + maxTaskHeight).attr("x2", masterX + 190 / 2).attr("y2", masterY + maxTaskHeight + 100 + maxEventLineLength + 100).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", `url(#${diagramId3}-arrowhead)`).attr("stroke-dasharray", "5,5"); + } + masterX = masterX + 200; + if (isWithoutSections && !conf5.timeline?.disableMulticolor) { + sectionColor++; + } + } + masterY = masterY - 10; + }, "drawTasks"); + drawEvents = /* @__PURE__ */ __name(function(diagram32, events, sectionColor, masterX, masterY, conf5, diagramId3) { + let maxEventHeight = 0; + const eventBeginY = masterY; + masterY = masterY + 100; + for (const event3 of events) { + const eventNode = { + descr: event3, + section: sectionColor, + number: sectionColor, + width: 150, + padding: 20, + maxHeight: 50 + }; + log.debug("eventNode", eventNode); + const eventWrapper = diagram32.append("g").attr("class", "eventWrapper"); + const node2 = svgDraw_default4.drawNode(eventWrapper, eventNode, sectionColor, conf5, diagramId3, true); + const eventHeight = node2.height; + maxEventHeight = maxEventHeight + eventHeight; + eventWrapper.attr("transform", `translate(${masterX}, ${masterY})`); + masterY = masterY + 10 + eventHeight; + } + masterY = eventBeginY; + return maxEventHeight; + }, "drawEvents"); + timelineRenderer_default = { + setConf: /* @__PURE__ */ __name(() => { + }, "setConf"), + draw: draw17 + }; + } + }); + + // src/diagrams/timeline/timelineRendererVertical.ts + var NODE_WIDTH, NODE_PADDING, NODE_TOTAL_WIDTH, EVENT_WIDTH, EVENT_TOTAL_WIDTH, EVENT_SPACING, EVENT_VERTICAL_GAP, SECTION_TASK_GAP, TASK_AXIS_GAP, TASK_VERTICAL_GAP, EVENT_AXIS_GAP, draw18, drawTasks3, drawEvents2, timelineRendererVertical_default; + var init_timelineRendererVertical = __esm({ + "src/diagrams/timeline/timelineRendererVertical.ts"() { + "use strict"; + init_svgDraw4(); + init_logger(); + init_diagramAPI(); + init_setupGraphViewbox(); + init_selectSvgElement(); + init_utils2(); + NODE_WIDTH = 200; + NODE_PADDING = 5; + NODE_TOTAL_WIDTH = NODE_WIDTH + NODE_PADDING * 2; + EVENT_WIDTH = NODE_WIDTH + 100; + EVENT_TOTAL_WIDTH = EVENT_WIDTH + NODE_PADDING * 2; + EVENT_SPACING = 10; + EVENT_VERTICAL_GAP = 0; + SECTION_TASK_GAP = 20; + TASK_AXIS_GAP = 20; + TASK_VERTICAL_GAP = 30; + EVENT_AXIS_GAP = 50; + draw18 = /* @__PURE__ */ __name(function(text4, id35, version3, diagObj) { + const conf5 = getConfig2(); + const LEFT_MARGIN = conf5.timeline?.leftMargin ?? 50; + log.debug("timeline", diagObj.db); + const svg2 = selectSvgElement(id35); + svg2.append("g"); + const tasks4 = diagObj.db.getTasks(); + const title2 = diagObj.db.getCommonDb().getDiagramTitle(); + log.debug("task", tasks4); + svgDraw_default4.initGraphics(svg2); + const sections6 = diagObj.db.getSections(); + log.debug("sections", sections6); + let maxSectionHeight = 0; + let maxTaskHeight = 0; + const masterX = 50 + LEFT_MARGIN; + let masterY = 50; + const contentTopY = masterY; + const sectionBeginX = masterX; + const leftWidth = NODE_TOTAL_WIDTH + TASK_AXIS_GAP; + const rightWidth = EVENT_TOTAL_WIDTH + EVENT_AXIS_GAP; + const axisX = sectionBeginX + leftWidth; + let sectionNumber = 0; + const hasSections = sections6 && sections6.length > 0; + const timelineX = hasSections ? axisX : masterX + leftWidth; + const sectionWidth = Math.max(50, leftWidth + rightWidth - NODE_PADDING * 2); + sections6.forEach(function(section) { + const sectionNode = { + number: sectionNumber, + descr: section, + section: sectionNumber, + width: sectionWidth, + padding: NODE_PADDING, + maxHeight: maxSectionHeight + }; + const sectionHeight = svgDraw_default4.getVirtualNodeHeight(svg2, sectionNode, conf5); + log.debug("sectionHeight before draw", sectionHeight); + maxSectionHeight = Math.max(maxSectionHeight, sectionHeight); + }); + let maxEventStackHeight = 0; + log.debug("tasks.length", tasks4.length); + for (const [i2, task] of tasks4.entries()) { + const taskNode = { + number: i2, + descr: task, + section: task.section, + width: NODE_WIDTH, + padding: NODE_PADDING, + maxHeight: maxTaskHeight + }; + const taskHeight = svgDraw_default4.getVirtualNodeHeight(svg2, taskNode, conf5); + log.debug("taskHeight before draw", taskHeight); + maxTaskHeight = Math.max(maxTaskHeight, taskHeight); + let maxEventStackHeightTemp = 0; + for (const event3 of task.events) { + const eventNode = { + descr: event3, + section: task.section, + number: task.section, + width: EVENT_WIDTH, + padding: NODE_PADDING, + maxHeight: 50 + }; + maxEventStackHeightTemp += svgDraw_default4.getVirtualNodeHeight(svg2, eventNode, conf5); + } + if (task.events.length > 0) { + maxEventStackHeightTemp += (task.events.length - 1) * EVENT_SPACING; + } + maxEventStackHeight = Math.max(maxEventStackHeight, maxEventStackHeightTemp) + EVENT_VERTICAL_GAP; + } + log.debug("maxSectionHeight before draw", maxSectionHeight); + log.debug("maxTaskHeight before draw", maxTaskHeight); + const taskBlockHeight = Math.max(maxTaskHeight, maxEventStackHeight); + const taskSpacing = taskBlockHeight + TASK_VERTICAL_GAP; + if (hasSections) { + sections6.forEach((section) => { + const tasksForSection = tasks4.filter((task) => task.section === section); + const sectionNode = { + number: sectionNumber, + descr: section, + section: sectionNumber, + width: sectionWidth, + padding: NODE_PADDING, + maxHeight: maxSectionHeight + }; + log.debug("sectionNode", sectionNode); + const sectionNodeWrapper = svg2.append("g"); + const node2 = svgDraw_default4.drawNode(sectionNodeWrapper, sectionNode, sectionNumber, conf5); + log.debug("sectionNode output", node2); + const sectionX = timelineX - leftWidth; + sectionNodeWrapper.attr("transform", `translate(${sectionX}, ${masterY})`); + const taskStartY = masterY + node2.height + SECTION_TASK_GAP; + if (tasksForSection.length > 0) { + drawTasks3( + svg2, + tasksForSection, + sectionNumber, + timelineX, + taskStartY, + maxTaskHeight, + conf5, + taskSpacing, + false + ); + } + const taskCount3 = tasksForSection.length; + const sectionHeight = node2.height + SECTION_TASK_GAP + taskSpacing * Math.max(taskCount3, 1) - (taskCount3 > 0 ? TASK_VERTICAL_GAP * 2 : 0); + masterY += sectionHeight; + sectionNumber++; + }); + } else { + drawTasks3( + svg2, + tasks4, + sectionNumber, + timelineX, + masterY, + maxTaskHeight, + conf5, + taskSpacing, + true + ); + } + let box = svg2.node()?.getBBox(); + if (!box) { + throw new Error("bbox not found"); + } + log.debug("bounds", box); + if (title2) { + svg2.append("text").text(title2).attr("x", box.width / 2 - LEFT_MARGIN).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20); + box = svg2.node()?.getBBox(); + if (!box) { + throw new Error("bbox not found"); + } + log.debug("bounds after title", box); + } + const [fontSize] = parseFontSize(conf5.fontSize); + const arrowTopOffset = (fontSize ?? 16) * 2; + const arrowBottomPadding = (fontSize ?? 16) * 0.5 + 20; + const lineWrapper = svg2.append("g").attr("class", "lineWrapper"); + lineWrapper.append("line").attr("x1", timelineX).attr("y1", contentTopY - arrowTopOffset).attr("x2", timelineX).attr("y2", box.y + box.height + arrowBottomPadding).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)"); + lineWrapper.lower(); + setupGraphViewbox( + void 0, + svg2, + conf5.timeline?.padding ?? 50, + conf5.timeline?.useMaxWidth ?? false + ); + }, "draw"); + drawTasks3 = /* @__PURE__ */ __name(function(diagram32, tasks4, sectionColor, timelineX, masterY, maxTaskHeight, conf5, taskSpacing, isWithoutSections) { + for (const task of tasks4) { + const taskNode = { + descr: task.task, + section: sectionColor, + number: sectionColor, + width: NODE_WIDTH, + padding: NODE_PADDING, + maxHeight: maxTaskHeight + }; + log.debug("taskNode", taskNode); + const taskWrapper = diagram32.append("g").attr("class", "taskWrapper"); + const node2 = svgDraw_default4.drawNode(taskWrapper, taskNode, sectionColor, conf5); + const taskHeight = node2.height; + log.debug("taskHeight after draw", taskHeight); + const taskX = timelineX - TASK_AXIS_GAP - node2.width; + taskWrapper.attr("transform", `translate(${taskX}, ${masterY})`); + maxTaskHeight = Math.max(maxTaskHeight, taskHeight); + if (task.events && task.events.length > 0) { + const eventsStartY = masterY; + const eventsX = timelineX + EVENT_AXIS_GAP; + drawEvents2(diagram32, task.events, sectionColor, timelineX, eventsX, eventsStartY, conf5); + } + masterY = masterY + taskSpacing; + if (isWithoutSections && !conf5.timeline?.disableMulticolor) { + sectionColor++; + } + } + }, "drawTasks"); + drawEvents2 = /* @__PURE__ */ __name(function(diagram32, events, sectionColor, axisX, eventsX, startY2, conf5) { + let currentY = startY2; + for (const event3 of events) { + const eventNode = { + descr: event3, + section: sectionColor, + number: sectionColor, + width: EVENT_WIDTH, + padding: NODE_PADDING, + maxHeight: 0 + }; + log.debug("eventNode", eventNode); + const eventWrapper = diagram32.append("g").attr("class", "eventWrapper"); + const node2 = svgDraw_default4.drawNode(eventWrapper, eventNode, sectionColor, conf5); + const eventHeight = node2.height; + eventWrapper.attr("transform", `translate(${eventsX}, ${currentY})`); + const lineWrapper = diagram32.append("g").attr("class", "lineWrapper"); + const lineY = currentY + eventHeight / 2; + lineWrapper.append("line").attr("x1", axisX).attr("y1", lineY).attr("x2", eventsX).attr("y2", lineY).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5"); + currentY = currentY + eventHeight + EVENT_SPACING; + } + return currentY - startY2; + }, "drawEvents"); + timelineRendererVertical_default = { + setConf: /* @__PURE__ */ __name(() => { + }, "setConf"), + draw: draw18 + }; + } + }); + + // src/diagrams/timeline/styles.js + var genReduxSections, genSections, getStyles13, styles_default12; + var init_styles12 = __esm({ + "src/diagrams/timeline/styles.js"() { + "use strict"; + init_dist(); + init_config(); + genReduxSections = /* @__PURE__ */ __name((options2) => { + const { theme } = getConfig(); + const isDarkTheme = theme?.includes("dark"); + const isColorTheme = theme?.includes("color"); + const rawSvgId = options2.svgId?.replace(/^#/, "") ?? ""; + const scopedDropShadow = rawSvgId ? `url(#${rawSvgId}-drop-shadow)` : options2.dropShadow ?? "none"; + let sections6 = ""; + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + const sw = `${17 - 3 * i2}`; + const color2 = isColorTheme ? options2.borderColorArray[i2] : options2.mainBkg; + const stroke = isColorTheme ? options2.borderColorArray[i2] : options2.nodeBorder; + sections6 += ` + .section-${i2 - 1} rect, + .section-${i2 - 1} path, + .section-${i2 - 1} circle { + fill: ${isDarkTheme && isColorTheme ? options2.mainBkg : color2}; + stroke: ${stroke}; + stroke-width: ${options2.strokeWidth}; + filter: ${scopedDropShadow}; + } + + .section-${i2 - 1} text { + fill: ${options2.nodeBorder}; + font-weight: ${options2.fontWeight} + } + + .node-icon-${i2 - 1} { + font-size: 40px; + color: ${options2["cScaleLabel" + i2]}; + } + + .section-edge-${i2 - 1} { + stroke: ${options2["cScale" + i2]}; + } + + .edge-depth-${i2 - 1} { + stroke-width: ${sw}; + } + + .section-${i2 - 1} line { + stroke: ${options2["cScaleInv" + i2]}; + stroke-width: 3; + } + + .lineWrapper line { + stroke: ${options2.nodeBorder}; + stroke-width:${options2.strokeWidth} + } + + .disabled, + .disabled circle, + .disabled text { + fill: ${options2.tertiaryColor ?? "lightgray"}; + } + + .disabled text { + fill: ${options2.clusterBorder ?? "#efefef"}; + } + `; + } + return sections6; + }, "genReduxSections"); + genSections = /* @__PURE__ */ __name((options2) => { + let sections6 = ""; + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + options2["lineColor" + i2] = options2["lineColor" + i2] || options2["cScaleInv" + i2]; + if (is_dark_default(options2["lineColor" + i2])) { + options2["lineColor" + i2] = lighten_default(options2["lineColor" + i2], 20); + } else { + options2["lineColor" + i2] = darken_default(options2["lineColor" + i2], 20); + } + } + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + const sw = "" + (17 - 3 * i2); + sections6 += ` + .section-${i2 - 1} rect, .section-${i2 - 1} path, .section-${i2 - 1} circle, .section-${i2 - 1} path { + fill: ${options2["cScale" + i2]}; + } + .section-${i2 - 1} text { + fill: ${options2["cScaleLabel" + i2]}; + } + .node-icon-${i2 - 1} { + font-size: 40px; + color: ${options2["cScaleLabel" + i2]}; + } + .section-edge-${i2 - 1}{ + stroke: ${options2["cScale" + i2]}; + } + .edge-depth-${i2 - 1}{ + stroke-width: ${sw}; + } + .section-${i2 - 1} line { + stroke: ${options2["cScaleInv" + i2]} ; + stroke-width: 3; + } + + .lineWrapper line{ + stroke: ${options2["cScaleLabel" + i2]} ; + } + + .disabled, .disabled circle, .disabled text { + fill: ${options2.tertiaryColor ?? "lightgray"}; + } + .disabled text { + fill: ${options2.clusterBorder ?? "#efefef"}; + } + `; + } + return sections6; + }, "genSections"); + getStyles13 = /* @__PURE__ */ __name((options2) => { + const { theme } = getConfig(); + const isReduxTheme = theme?.includes("redux"); + const isNeutralTheme = theme === "neutral"; + const rawSvgId = options2.svgId?.replace(/^#/, "") ?? ""; + let gradientSections = ""; + if (options2.useGradient && rawSvgId && options2.THEME_COLOR_LIMIT && !isNeutralTheme) { + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + gradientSections += ` + .section-${i2 - 1}[data-look="neo"] rect, + .section-${i2 - 1}[data-look="neo"] path, + .section-${i2 - 1}[data-look="neo"] circle { + fill: ${options2.mainBkg}; + stroke: url(#${rawSvgId}-gradient); + stroke-width: 2; + } + .section-${i2 - 1}[data-look="neo"] line { + stroke: url(#${rawSvgId}-gradient); + stroke-width: 2; + }`; + } + } + return ` + .edge { + stroke-width: 3; + } + ${isReduxTheme ? genReduxSections(options2) : genSections(options2)} + ${gradientSections} + .section-root rect, .section-root path, .section-root circle { + fill: ${options2.git0}; + } + .section-root text { + fill: ${options2.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .eventWrapper { + filter: brightness(120%); + } +`; + }, "getStyles"); + styles_default12 = getStyles13; + } + }); + + // src/diagrams/timeline/timeline-definition.ts + var timeline_definition_exports = {}; + __export(timeline_definition_exports, { + diagram: () => diagram18 + }); + var rendererSelector, diagram18; + var init_timeline_definition = __esm({ + "src/diagrams/timeline/timeline-definition.ts"() { + "use strict"; + init_timeline(); + init_timelineDb(); + init_timelineRenderer(); + init_timelineRendererVertical(); + init_styles12(); + rendererSelector = { + setConf: /* @__PURE__ */ __name(() => { + }, "setConf"), + draw: /* @__PURE__ */ __name((text4, id35, version3, diagObj) => { + const direction2 = diagObj?.db?.getDirection?.() ?? "LR"; + if (direction2 === "TD") { + return timelineRendererVertical_default.draw(text4, id35, version3, diagObj); + } + return timelineRenderer_default.draw(text4, id35, version3, diagObj); + }, "draw") + }; + diagram18 = { + db: timelineDb_exports, + renderer: rendererSelector, + parser: timeline_default, + styles: styles_default12 + }; + } + }); + + // src/diagrams/mindmap/parser/mindmap.jison + var parser16, mindmap_default; + var init_mindmap = __esm({ + "src/diagrams/mindmap/parser/mindmap.jison"() { + "use strict"; + parser16 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 4], $V1 = [1, 13], $V2 = [1, 12], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 20], $V6 = [1, 19], $V7 = [6, 7, 8], $V8 = [1, 26], $V9 = [1, 24], $Va = [1, 25], $Vb = [6, 7, 11], $Vc = [1, 6, 13, 15, 16, 19, 22], $Vd = [1, 33], $Ve = [1, 34], $Vf = [1, 6, 7, 11, 13, 15, 16, 19, 22]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "mindMap": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "MINDMAP": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "node": 14, "ICON": 15, "CLASS": 16, "nodeWithId": 17, "nodeWithoutId": 18, "NODE_DSTART": 19, "NODE_DESCR": 20, "NODE_DEND": 21, "NODE_ID": 22, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "MINDMAP", 11: "EOF", 13: "SPACELIST", 15: "ICON", 16: "CLASS", 19: "NODE_DSTART", 20: "NODE_DESCR", 21: "NODE_DEND", 22: "NODE_ID" }, + productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [18, 3], [17, 1], [17, 4]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 6: + case 7: + return yy; + break; + case 8: + yy.getLogger().trace("Stop NL "); + break; + case 9: + yy.getLogger().trace("Stop EOF "); + break; + case 11: + yy.getLogger().trace("Stop NL2 "); + break; + case 12: + yy.getLogger().trace("Stop EOF2 "); + break; + case 15: + yy.getLogger().info("Node: ", $$[$0].id); + yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type); + break; + case 16: + yy.getLogger().trace("Icon: ", $$[$0]); + yy.decorateNode({ icon: $$[$0] }); + break; + case 17: + case 21: + yy.decorateNode({ class: $$[$0] }); + break; + case 18: + yy.getLogger().trace("SPACELIST"); + break; + case 19: + yy.getLogger().trace("Node: ", $$[$0].id); + yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type); + break; + case 20: + yy.decorateNode({ icon: $$[$0] }); + break; + case 25: + yy.getLogger().trace("node found ..", $$[$0 - 2]); + this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; + break; + case 26: + this.$ = { id: $$[$0], descr: $$[$0], type: yy.nodeType.DEFAULT }; + break; + case 27: + yy.getLogger().trace("node found ..", $$[$0 - 3]); + this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o2($V7, [2, 3]), { 1: [2, 2] }, o2($V7, [2, 4]), o2($V7, [2, 5]), { 1: [2, 6], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V1, 9: 22, 12: 11, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, { 6: $V8, 7: $V9, 10: 23, 11: $Va }, o2($Vb, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: $V5, 22: $V6 }), o2($Vb, [2, 18]), o2($Vb, [2, 19]), o2($Vb, [2, 20]), o2($Vb, [2, 21]), o2($Vb, [2, 23]), o2($Vb, [2, 24]), o2($Vb, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: $V8, 7: $V9, 10: 32, 11: $Va }, { 1: [2, 7], 6: $V1, 12: 21, 13: $V2, 14: 14, 15: $V3, 16: $V4, 17: 17, 18: 18, 19: $V5, 22: $V6 }, o2($Vc, [2, 14], { 7: $Vd, 11: $Ve }), o2($Vf, [2, 8]), o2($Vf, [2, 9]), o2($Vf, [2, 10]), o2($Vb, [2, 15]), o2($Vb, [2, 16]), o2($Vb, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, o2($Vc, [2, 13], { 7: $Vd, 11: $Ve }), o2($Vf, [2, 11]), o2($Vf, [2, 12]), { 21: [1, 37] }, o2($Vb, [2, 25]), o2($Vb, [2, 27])], + defaultActions: { 2: [2, 1], 6: [2, 2] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + yy.getLogger().trace("Found comment", yy_.yytext); + return 6; + break; + case 1: + return 8; + break; + case 2: + this.begin("CLASS"); + break; + case 3: + this.popState(); + return 16; + break; + case 4: + this.popState(); + break; + case 5: + yy.getLogger().trace("Begin icon"); + this.begin("ICON"); + break; + case 6: + yy.getLogger().trace("SPACELINE"); + return 6; + break; + case 7: + return 7; + break; + case 8: + return 15; + break; + case 9: + yy.getLogger().trace("end icon"); + this.popState(); + break; + case 10: + yy.getLogger().trace("Exploding node"); + this.begin("NODE"); + return 19; + break; + case 11: + yy.getLogger().trace("Cloud"); + this.begin("NODE"); + return 19; + break; + case 12: + yy.getLogger().trace("Explosion Bang"); + this.begin("NODE"); + return 19; + break; + case 13: + yy.getLogger().trace("Cloud Bang"); + this.begin("NODE"); + return 19; + break; + case 14: + this.begin("NODE"); + return 19; + break; + case 15: + this.begin("NODE"); + return 19; + break; + case 16: + this.begin("NODE"); + return 19; + break; + case 17: + this.begin("NODE"); + return 19; + break; + case 18: + return 13; + break; + case 19: + return 22; + break; + case 20: + return 11; + break; + case 21: + this.begin("NSTR2"); + break; + case 22: + return "NODE_DESCR"; + break; + case 23: + this.popState(); + break; + case 24: + yy.getLogger().trace("Starting NSTR"); + this.begin("NSTR"); + break; + case 25: + yy.getLogger().trace("description:", yy_.yytext); + return "NODE_DESCR"; + break; + case 26: + this.popState(); + break; + case 27: + this.popState(); + yy.getLogger().trace("node end ))"); + return "NODE_DEND"; + break; + case 28: + this.popState(); + yy.getLogger().trace("node end )"); + return "NODE_DEND"; + break; + case 29: + this.popState(); + yy.getLogger().trace("node end ...", yy_.yytext); + return "NODE_DEND"; + break; + case 30: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + break; + case 31: + this.popState(); + yy.getLogger().trace("node end (-"); + return "NODE_DEND"; + break; + case 32: + this.popState(); + yy.getLogger().trace("node end (-"); + return "NODE_DEND"; + break; + case 33: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + break; + case 34: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + break; + case 35: + yy.getLogger().trace("Long description:", yy_.yytext); + return 20; + break; + case 36: + yy.getLogger().trace("Long description:", yy_.yytext); + return 20; + break; + } + }, "anonymous"), + rules: [/^(?:\s*%%.*)/i, /^(?:mindmap\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\)\{\}]+)/i, /^(?:$)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i], + conditions: { "CLASS": { "rules": [3, 4], "inclusive": false }, "ICON": { "rules": [8, 9], "inclusive": false }, "NSTR2": { "rules": [22, 23], "inclusive": false }, "NSTR": { "rules": [25, 26], "inclusive": false }, "NODE": { "rules": [21, 24, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser16.parser = parser16; + mindmap_default = parser16; + } + }); + + // ../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/stringify.js + function unsafeStringify(arr, offset = 0) { + return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); + } + var byteToHex; + var init_stringify = __esm({ + "../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/stringify.js"() { + "use strict"; + byteToHex = []; + for (let i2 = 0; i2 < 256; ++i2) { + byteToHex.push((i2 + 256).toString(16).slice(1)); + } + __name(unsafeStringify, "unsafeStringify"); + } + }); + + // ../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/rng.js + function rng() { + return crypto.getRandomValues(rnds8); + } + var rnds8; + var init_rng = __esm({ + "../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/rng.js"() { + "use strict"; + rnds8 = new Uint8Array(16); + __name(rng, "rng"); + } + }); + + // ../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/v4.js + function v4(options2, buf, offset) { + if (!buf && !options2 && crypto.randomUUID) { + return crypto.randomUUID(); + } + return _v4(options2, buf, offset); + } + function _v4(options2, buf, offset) { + options2 = options2 || {}; + const rnds = options2.random ?? options2.rng?.() ?? rng(); + if (rnds.length < 16) { + throw new Error("Random bytes length must be >= 16"); + } + rnds[6] = rnds[6] & 15 | 64; + rnds[8] = rnds[8] & 63 | 128; + if (buf) { + offset = offset || 0; + if (offset < 0 || offset + 16 > buf.length) { + throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`); + } + for (let i2 = 0; i2 < 16; ++i2) { + buf[offset + i2] = rnds[i2]; + } + return buf; + } + return unsafeStringify(rnds); + } + var v4_default; + var init_v4 = __esm({ + "../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/v4.js"() { + "use strict"; + init_rng(); + init_stringify(); + __name(v4, "v4"); + __name(_v4, "_v4"); + v4_default = v4; + } + }); + + // ../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/index.js + var init_dist2 = __esm({ + "../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/index.js"() { + "use strict"; + init_v4(); + } + }); + + // src/diagrams/mindmap/svgDraw.ts + var MAX_SECTIONS; + var init_svgDraw5 = __esm({ + "src/diagrams/mindmap/svgDraw.ts"() { + "use strict"; + init_createText(); + init_utils2(); + MAX_SECTIONS = 12; + } + }); + + // src/diagrams/mindmap/mindmapDb.ts + var nodeType, MindmapDB; + var init_mindmapDb = __esm({ + "src/diagrams/mindmap/mindmapDb.ts"() { + "use strict"; + init_diagramAPI(); + init_dist2(); + init_common(); + init_logger(); + init_defaultConfig(); + init_config(); + init_svgDraw5(); + nodeType = { + DEFAULT: 0, + NO_BORDER: 0, + ROUNDED_RECT: 1, + RECT: 2, + CIRCLE: 3, + CLOUD: 4, + BANG: 5, + HEXAGON: 6 + }; + MindmapDB = class { + constructor() { + this.nodes = []; + this.count = 0; + this.elements = {}; + this.getLogger = this.getLogger.bind(this); + this.nodeType = nodeType; + this.clear(); + this.getType = this.getType.bind(this); + this.getElementById = this.getElementById.bind(this); + this.getParent = this.getParent.bind(this); + this.getMindmap = this.getMindmap.bind(this); + this.addNode = this.addNode.bind(this); + this.decorateNode = this.decorateNode.bind(this); + } + static { + __name(this, "MindmapDB"); + } + clear() { + this.nodes = []; + this.count = 0; + this.elements = {}; + this.baseLevel = void 0; + } + getParent(level) { + for (let i2 = this.nodes.length - 1; i2 >= 0; i2--) { + if (this.nodes[i2].level < level) { + return this.nodes[i2]; + } + } + return null; + } + getMindmap() { + return this.nodes.length > 0 ? this.nodes[0] : null; + } + addNode(level, id35, descr, type3) { + log.info("addNode", level, id35, descr, type3); + let isRoot = false; + if (this.nodes.length === 0) { + this.baseLevel = level; + level = 0; + isRoot = true; + } else if (this.baseLevel !== void 0) { + level = level - this.baseLevel; + isRoot = false; + } + const conf5 = getConfig2(); + let padding2 = conf5.mindmap?.padding ?? defaultConfig_default.mindmap.padding; + switch (type3) { + case this.nodeType.ROUNDED_RECT: + case this.nodeType.RECT: + case this.nodeType.HEXAGON: + padding2 *= 2; + break; + } + const node2 = { + id: this.count++, + nodeId: sanitizeText(id35, conf5), + level, + descr: sanitizeText(descr, conf5), + type: type3, + children: [], + width: conf5.mindmap?.maxNodeWidth ?? defaultConfig_default.mindmap.maxNodeWidth, + padding: padding2, + isRoot + }; + const parent4 = this.getParent(level); + if (parent4) { + parent4.children.push(node2); + this.nodes.push(node2); + } else { + if (isRoot) { + this.nodes.push(node2); + } else { + throw new Error( + `There can be only one root. No parent could be found for ("${node2.descr}")` + ); + } + } + } + getType(startStr, endStr) { + log.debug("In get type", startStr, endStr); + switch (startStr) { + case "[": + return this.nodeType.RECT; + case "(": + return endStr === ")" ? this.nodeType.ROUNDED_RECT : this.nodeType.CLOUD; + case "((": + return this.nodeType.CIRCLE; + case ")": + return this.nodeType.CLOUD; + case "))": + return this.nodeType.BANG; + case "{{": + return this.nodeType.HEXAGON; + default: + return this.nodeType.DEFAULT; + } + } + setElementForId(id35, element3) { + this.elements[id35] = element3; + } + getElementById(id35) { + return this.elements[id35]; + } + decorateNode(decoration) { + if (!decoration) { + return; + } + const config5 = getConfig2(); + const node2 = this.nodes[this.nodes.length - 1]; + if (decoration.icon) { + node2.icon = sanitizeText(decoration.icon, config5); + } + if (decoration.class) { + node2.class = sanitizeText(decoration.class, config5); + } + } + type2Str(type3) { + switch (type3) { + case this.nodeType.DEFAULT: + return "no-border"; + case this.nodeType.RECT: + return "rect"; + case this.nodeType.ROUNDED_RECT: + return "rounded-rect"; + case this.nodeType.CIRCLE: + return "circle"; + case this.nodeType.CLOUD: + return "cloud"; + case this.nodeType.BANG: + return "bang"; + case this.nodeType.HEXAGON: + return "hexgon"; + // cspell: disable-line + default: + return "no-border"; + } + } + /** + * Assign section numbers to nodes based on their position relative to root + * @param node - The mindmap node to process + * @param sectionNumber - The section number to assign (undefined for root) + */ + assignSections(node2, sectionNumber) { + if (node2.level === 0) { + node2.section = void 0; + } else { + node2.section = sectionNumber; + } + if (node2.children) { + for (const [index, child] of node2.children.entries()) { + const childSectionNumber = node2.level === 0 ? index % (MAX_SECTIONS - 1) : sectionNumber; + this.assignSections(child, childSectionNumber); + } + } + } + /** + * Convert mindmap tree structure to flat array of nodes + * @param node - The mindmap node to process + * @param processedNodes - Array to collect processed nodes + */ + flattenNodes(node2, processedNodes) { + const conf5 = getConfig2(); + const cssClasses = ["mindmap-node"]; + if (node2.isRoot === true) { + cssClasses.push("section-root", "section--1"); + } else if (node2.section !== void 0) { + cssClasses.push(`section-${node2.section}`); + } + if (node2.class) { + cssClasses.push(node2.class); + } + const classes3 = cssClasses.join(" "); + const getShapeFromType = /* @__PURE__ */ __name((type3) => { + const theme = conf5.theme?.toLowerCase() ?? ""; + const isReduxTheme = theme.includes("redux"); + switch (type3) { + case nodeType.CIRCLE: + return "mindmapCircle"; + case nodeType.RECT: + return "rect"; + case nodeType.ROUNDED_RECT: + return "rounded"; + case nodeType.CLOUD: + return "cloud"; + case nodeType.BANG: + return "bang"; + case nodeType.HEXAGON: + return "hexagon"; + case nodeType.DEFAULT: + return isReduxTheme ? "rounded" : "defaultMindmapNode"; + case nodeType.NO_BORDER: + default: + return "rect"; + } + }, "getShapeFromType"); + const processedNode = { + id: node2.id.toString(), + domId: "node_" + node2.id.toString(), + label: node2.descr, + labelType: "markdown", + isGroup: false, + shape: getShapeFromType(node2.type), + width: node2.width, + height: node2.height ?? 0, + padding: node2.padding, + cssClasses: classes3, + cssStyles: [], + look: conf5.look, + icon: node2.icon, + x: node2.x, + y: node2.y, + // Mindmap-specific properties + level: node2.level, + nodeId: node2.nodeId, + type: node2.type, + section: node2.section + }; + processedNodes.push(processedNode); + if (node2.children) { + for (const child of node2.children) { + this.flattenNodes(child, processedNodes); + } + } + } + /** + * Generate edges from parent-child relationships in mindmap tree + * @param node - The mindmap node to process + * @param edges - Array to collect edges + */ + generateEdges(node2, edges3) { + if (!node2.children) { + return; + } + const conf5 = getConfig2(); + for (const child of node2.children) { + let edgeClasses = "edge"; + if (child.section !== void 0) { + edgeClasses += ` section-edge-${child.section}`; + } + const edgeDepth = node2.level + 1; + edgeClasses += ` edge-depth-${edgeDepth}`; + const edge = { + id: `edge_${node2.id}_${child.id}`, + start: node2.id.toString(), + end: child.id.toString(), + type: "normal", + curve: "basis", + thickness: "normal", + look: conf5.look, + classes: edgeClasses, + // Store mindmap-specific data + depth: node2.level, + section: child.section + }; + edges3.push(edge); + this.generateEdges(child, edges3); + } + } + /** + * Get structured data for layout algorithms + * Following the pattern established by ER diagrams + * @returns Structured data containing nodes, edges, and config + */ + getData() { + const mindmapRoot = this.getMindmap(); + const config5 = getConfig2(); + const userDefinedConfig = getUserDefinedConfig(); + const hasUserDefinedLayout = userDefinedConfig.layout !== void 0; + const finalConfig = config5; + if (!hasUserDefinedLayout) { + finalConfig.layout = "cose-bilkent"; + } + if (!mindmapRoot) { + return { + nodes: [], + edges: [], + config: finalConfig + }; + } + log.debug("getData: mindmapRoot", mindmapRoot, config5); + this.assignSections(mindmapRoot); + const processedNodes = []; + const processedEdges = []; + this.flattenNodes(mindmapRoot, processedNodes); + this.generateEdges(mindmapRoot, processedEdges); + log.debug( + `getData: processed ${processedNodes.length} nodes and ${processedEdges.length} edges` + ); + const shapes4 = /* @__PURE__ */ new Map(); + for (const node2 of processedNodes) { + shapes4.set(node2.id, { + shape: node2.shape, + width: node2.width, + height: node2.height, + padding: node2.padding + }); + } + return { + nodes: processedNodes, + edges: processedEdges, + config: finalConfig, + // Store the root node for mindmap-specific layout algorithms + rootNode: mindmapRoot, + // Properties required by dagre layout algorithm + markers: ["point"], + // Mindmaps don't use markers + direction: "TB", + // Top-to-bottom direction for mindmaps + nodeSpacing: 50, + // Default spacing between nodes + rankSpacing: 50, + // Default spacing between ranks + // Add shapes for ELK compatibility + shapes: Object.fromEntries(shapes4), + // Additional properties that layout algorithms might expect + type: "mindmap", + diagramId: "mindmap-" + v4_default() + }; + } + // Expose logger to grammar + getLogger() { + return log; + } + }; + } + }); + + // src/diagrams/mindmap/mindmapRenderer.ts + var draw19, mindmapRenderer_default; + var init_mindmapRenderer = __esm({ + "src/diagrams/mindmap/mindmapRenderer.ts"() { + "use strict"; + init_logger(); + init_insertElementsForSize(); + init_render2(); + init_setupViewPortForSVG(); + init_defaultConfig(); + init_config(); + draw19 = /* @__PURE__ */ __name(async (text4, id35, _version, diagObj) => { + log.debug("Rendering mindmap diagram\n" + text4); + const db10 = diagObj.db; + const data4Layout = db10.getData(); + const svg2 = getDiagramElement(id35, data4Layout.config.securityLevel); + data4Layout.type = diagObj.type; + data4Layout.layoutAlgorithm = getRegisteredLayoutAlgorithm(data4Layout.config.layout, { + fallback: "cose-bilkent" + }); + data4Layout.diagramId = id35; + const mm = db10.getMindmap(); + if (!mm) { + return; + } + data4Layout.nodes.forEach((node2) => { + if (node2.shape === "rounded") { + node2.radius = 15; + node2.taper = 15; + node2.stroke = "none"; + node2.width = 0; + node2.padding = 15; + } else if (node2.shape === "circle") { + node2.padding = 10; + } else if (node2.shape === "rect") { + node2.width = 0; + node2.padding = 10; + } else if (node2.shape === "hexagon") { + node2.width = 0; + node2.height = 0; + } + }); + await render6(data4Layout, svg2); + const { themeVariables } = getConfig(); + const { useGradient, gradientStart, gradientStop } = themeVariables; + if (useGradient && gradientStart && gradientStop) { + const svgId = svg2.attr("id"); + const gradient = svg2.append("defs").append("linearGradient").attr("id", `${svgId}-gradient`).attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%"); + gradient.append("stop").attr("offset", "0%").attr("stop-color", gradientStart).attr("stop-opacity", 1); + gradient.append("stop").attr("offset", "100%").attr("stop-color", gradientStop).attr("stop-opacity", 1); + } + setupViewPortForSVG( + svg2, + data4Layout.config.mindmap?.padding ?? defaultConfig_default.mindmap.padding, + "mindmapDiagram", + data4Layout.config.mindmap?.useMaxWidth ?? defaultConfig_default.mindmap.useMaxWidth + ); + }, "draw"); + mindmapRenderer_default = { + draw: draw19 + }; + } + }); + + // src/diagrams/mindmap/styles.ts + var genSections2, genGradient, getStyles14, styles_default13; + var init_styles13 = __esm({ + "src/diagrams/mindmap/styles.ts"() { + "use strict"; + init_dist(); + genSections2 = /* @__PURE__ */ __name((options2) => { + const { theme, look } = options2; + let sections6 = ""; + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + options2["lineColor" + i2] = options2["lineColor" + i2] || options2["cScaleInv" + i2]; + if (is_dark_default(options2["lineColor" + i2])) { + options2["lineColor" + i2] = lighten_default(options2["lineColor" + i2], 20); + } else { + options2["lineColor" + i2] = darken_default(options2["lineColor" + i2], 20); + } + } + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + const sw = "" + (look === "neo" ? Math.max(10 - (i2 - 1) * 2, 2) : 17 - 3 * i2); + sections6 += ` + .section-${i2 - 1} rect, .section-${i2 - 1} path, .section-${i2 - 1} circle, .section-${i2 - 1} polygon, .section-${i2 - 1} path { + fill: ${options2["cScale" + i2]}; + } + .section-${i2 - 1} text { + fill: ${options2["cScaleLabel" + i2]}; + } + .section-${i2 - 1} span { + color: ${options2["cScaleLabel" + i2]}; + } + .node-icon-${i2 - 1} { + font-size: 40px; + color: ${options2["cScaleLabel" + i2]}; + } + .section-edge-${i2 - 1}{ + stroke: ${options2["cScale" + i2]}; + } + .edge-depth-${i2 - 1}{ + stroke-width: ${sw}; + } + .section-${i2 - 1} line { + stroke: ${options2["cScaleInv" + i2]} ; + stroke-width: 3; + } + + .disabled, .disabled circle, .disabled text { + fill: lightgray; + } + .disabled text { + fill: #efefef; + } + [data-look="neo"].mindmap-node.section-${i2 - 1} rect, [data-look="neo"].mindmap-node.section-${i2 - 1} path, [data-look="neo"].mindmap-node.section-${i2 - 1} circle, [data-look="neo"].mindmap-node.section-${i2 - 1} polygon { + fill: ${theme === "redux" || theme === "redux-dark" || theme === "neutral" ? options2.mainBkg : options2["cScale" + i2]}; + stroke: ${theme === "redux" || theme === "redux-dark" ? options2.nodeBorder : options2["cScale" + i2]}; + stroke-width: ${options2.strokeWidth ?? 2}px; + } + [data-look="neo"].section-edge-${i2 - 1}{ + stroke: ${theme?.includes("redux") || theme === "neo-dark" ? options2.nodeBorder : options2["cScale" + i2]}; + } + [data-look="neo"].mindmap-node.section-${i2 - 1} text { + fill: ${theme === "redux" || theme === "redux-dark" ? options2.nodeBorder : options2["cScaleLabel" + (theme === "neutral" ? 1 : i2)]}; + } + `; + } + return sections6; + }, "genSections"); + genGradient = /* @__PURE__ */ __name((THEME_COLOR_LIMIT2, svgId, mainBkg) => { + let sections6 = ""; + for (let i2 = 0; i2 < THEME_COLOR_LIMIT2; i2++) { + sections6 += ` + [data-look="neo"].mindmap-node.section-${i2 - 1} rect, [data-look="neo"].mindmap-node.section-${i2 - 1} path, [data-look="neo"].mindmap-node.section-${i2 - 1} circle, [data-look="neo"].mindmap-node.section-${i2 - 1} polygon { + stroke: url(${svgId}-gradient); + fill: ${mainBkg}; + } + .section-${i2 - 1} line { + stroke-width: 0; + }`; + } + return sections6; + }, "genGradient"); + getStyles14 = /* @__PURE__ */ __name((options2) => { + const { theme } = options2; + const svgId = options2.svgId; + const scopedDropShadow = options2.dropShadow ? options2.dropShadow.replace("url(#drop-shadow)", `url(${svgId}-drop-shadow)`) : "none"; + return ` + .edge { + stroke-width: 3; + } + ${genSections2(options2)} + .section-root rect, .section-root path, .section-root circle, .section-root polygon { + fill: ${options2.git0}; + } + .section-root text { + fill: ${options2.gitBranchLabel0}; + } + .section-root span { + color: ${theme?.includes("redux") ? options2.nodeBorder : options2.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .mindmap-node-label { + dy: 1em; + alignment-baseline: middle; + text-anchor: middle; + dominant-baseline: middle; + text-align: center; + } + [data-look="neo"].mindmap-node { + filter: ${scopedDropShadow}; + } + [data-look="neo"].mindmap-node.section-root rect, [data-look="neo"].mindmap-node.section-root path, [data-look="neo"].mindmap-node.section-root circle, [data-look="neo"].mindmap-node.section-root polygon { + fill: ${theme?.includes("redux") ? options2.mainBkg : options2.git0}; + } + [data-look="neo"].mindmap-node.section-root .text-inner-tspan { + fill: ${theme?.includes("redux") ? options2.nodeBorder : options2["cScaleLabel" + (theme === "neutral" ? 1 : 0)]}; + } + ${options2.useGradient && svgId && options2.mainBkg ? genGradient(options2.THEME_COLOR_LIMIT, svgId, options2.mainBkg) : ""} +`; + }, "getStyles"); + styles_default13 = getStyles14; + } + }); + + // src/diagrams/mindmap/mindmap-definition.ts + var mindmap_definition_exports = {}; + __export(mindmap_definition_exports, { + diagram: () => diagram19 + }); + var diagram19; + var init_mindmap_definition = __esm({ + "src/diagrams/mindmap/mindmap-definition.ts"() { + "use strict"; + init_mindmap(); + init_mindmapDb(); + init_mindmapRenderer(); + init_styles13(); + diagram19 = { + get db() { + return new MindmapDB(); + }, + renderer: mindmapRenderer_default, + parser: mindmap_default, + styles: styles_default13 + }; + } + }); + + // src/diagrams/kanban/parser/kanban.jison + var parser17, kanban_default; + var init_kanban = __esm({ + "src/diagrams/kanban/parser/kanban.jison"() { + "use strict"; + parser17 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 4], $V1 = [1, 13], $V2 = [1, 12], $V3 = [1, 15], $V4 = [1, 16], $V5 = [1, 20], $V6 = [1, 19], $V7 = [6, 7, 8], $V8 = [1, 26], $V9 = [1, 24], $Va = [1, 25], $Vb = [6, 7, 11], $Vc = [1, 31], $Vd = [6, 7, 11, 24], $Ve = [1, 6, 13, 16, 17, 20, 23], $Vf = [1, 35], $Vg = [1, 36], $Vh = [1, 6, 7, 11, 13, 16, 17, 20, 23], $Vi = [1, 38]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "mindMap": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "KANBAN": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "node": 14, "shapeData": 15, "ICON": 16, "CLASS": 17, "nodeWithId": 18, "nodeWithoutId": 19, "NODE_DSTART": 20, "NODE_DESCR": 21, "NODE_DEND": 22, "NODE_ID": 23, "SHAPE_DATA": 24, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "KANBAN", 11: "EOF", 13: "SPACELIST", 16: "ICON", 17: "CLASS", 20: "NODE_DSTART", 21: "NODE_DESCR", 22: "NODE_DEND", 23: "NODE_ID", 24: "SHAPE_DATA" }, + productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 3], [12, 2], [12, 2], [12, 2], [12, 1], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [19, 3], [18, 1], [18, 4], [15, 2], [15, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 6: + case 7: + return yy; + break; + case 8: + yy.getLogger().trace("Stop NL "); + break; + case 9: + yy.getLogger().trace("Stop EOF "); + break; + case 11: + yy.getLogger().trace("Stop NL2 "); + break; + case 12: + yy.getLogger().trace("Stop EOF2 "); + break; + case 15: + yy.getLogger().info("Node: ", $$[$0 - 1].id); + yy.addNode($$[$0 - 2].length, $$[$0 - 1].id, $$[$0 - 1].descr, $$[$0 - 1].type, $$[$0]); + break; + case 16: + yy.getLogger().info("Node: ", $$[$0].id); + yy.addNode($$[$0 - 1].length, $$[$0].id, $$[$0].descr, $$[$0].type); + break; + case 17: + yy.getLogger().trace("Icon: ", $$[$0]); + yy.decorateNode({ icon: $$[$0] }); + break; + case 18: + case 23: + yy.decorateNode({ class: $$[$0] }); + break; + case 19: + yy.getLogger().trace("SPACELIST"); + break; + case 20: + yy.getLogger().trace("Node: ", $$[$0 - 1].id); + yy.addNode(0, $$[$0 - 1].id, $$[$0 - 1].descr, $$[$0 - 1].type, $$[$0]); + break; + case 21: + yy.getLogger().trace("Node: ", $$[$0].id); + yy.addNode(0, $$[$0].id, $$[$0].descr, $$[$0].type); + break; + case 22: + yy.decorateNode({ icon: $$[$0] }); + break; + case 27: + yy.getLogger().trace("node found ..", $$[$0 - 2]); + this.$ = { id: $$[$0 - 1], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; + break; + case 28: + this.$ = { id: $$[$0], descr: $$[$0], type: 0 }; + break; + case 29: + yy.getLogger().trace("node found ..", $$[$0 - 3]); + this.$ = { id: $$[$0 - 3], descr: $$[$0 - 1], type: yy.getType($$[$0 - 2], $$[$0]) }; + break; + case 30: + this.$ = $$[$0 - 1] + $$[$0]; + break; + case 31: + this.$ = $$[$0]; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: 14, 16: $V3, 17: $V4, 18: 17, 19: 18, 20: $V5, 23: $V6 }, o2($V7, [2, 3]), { 1: [2, 2] }, o2($V7, [2, 4]), o2($V7, [2, 5]), { 1: [2, 6], 6: $V1, 12: 21, 13: $V2, 14: 14, 16: $V3, 17: $V4, 18: 17, 19: 18, 20: $V5, 23: $V6 }, { 6: $V1, 9: 22, 12: 11, 13: $V2, 14: 14, 16: $V3, 17: $V4, 18: 17, 19: 18, 20: $V5, 23: $V6 }, { 6: $V8, 7: $V9, 10: 23, 11: $Va }, o2($Vb, [2, 24], { 18: 17, 19: 18, 14: 27, 16: [1, 28], 17: [1, 29], 20: $V5, 23: $V6 }), o2($Vb, [2, 19]), o2($Vb, [2, 21], { 15: 30, 24: $Vc }), o2($Vb, [2, 22]), o2($Vb, [2, 23]), o2($Vd, [2, 25]), o2($Vd, [2, 26]), o2($Vd, [2, 28], { 20: [1, 32] }), { 21: [1, 33] }, { 6: $V8, 7: $V9, 10: 34, 11: $Va }, { 1: [2, 7], 6: $V1, 12: 21, 13: $V2, 14: 14, 16: $V3, 17: $V4, 18: 17, 19: 18, 20: $V5, 23: $V6 }, o2($Ve, [2, 14], { 7: $Vf, 11: $Vg }), o2($Vh, [2, 8]), o2($Vh, [2, 9]), o2($Vh, [2, 10]), o2($Vb, [2, 16], { 15: 37, 24: $Vc }), o2($Vb, [2, 17]), o2($Vb, [2, 18]), o2($Vb, [2, 20], { 24: $Vi }), o2($Vd, [2, 31]), { 21: [1, 39] }, { 22: [1, 40] }, o2($Ve, [2, 13], { 7: $Vf, 11: $Vg }), o2($Vh, [2, 11]), o2($Vh, [2, 12]), o2($Vb, [2, 15], { 24: $Vi }), o2($Vd, [2, 30]), { 22: [1, 41] }, o2($Vd, [2, 27]), o2($Vd, [2, 29])], + defaultActions: { 2: [2, 1], 6: [2, 2] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + this.pushState("shapeData"); + yy_.yytext = ""; + return 24; + break; + case 1: + this.pushState("shapeDataStr"); + return 24; + break; + case 2: + this.popState(); + return 24; + break; + case 3: + const re3 = /\n\s*/g; + yy_.yytext = yy_.yytext.replace(re3, "
    "); + return 24; + break; + case 4: + return 24; + break; + case 5: + this.popState(); + break; + case 6: + yy.getLogger().trace("Found comment", yy_.yytext); + return 6; + break; + case 7: + return 8; + break; + case 8: + this.begin("CLASS"); + break; + case 9: + this.popState(); + return 17; + break; + case 10: + this.popState(); + break; + case 11: + yy.getLogger().trace("Begin icon"); + this.begin("ICON"); + break; + case 12: + yy.getLogger().trace("SPACELINE"); + return 6; + break; + case 13: + return 7; + break; + case 14: + return 16; + break; + case 15: + yy.getLogger().trace("end icon"); + this.popState(); + break; + case 16: + yy.getLogger().trace("Exploding node"); + this.begin("NODE"); + return 20; + break; + case 17: + yy.getLogger().trace("Cloud"); + this.begin("NODE"); + return 20; + break; + case 18: + yy.getLogger().trace("Explosion Bang"); + this.begin("NODE"); + return 20; + break; + case 19: + yy.getLogger().trace("Cloud Bang"); + this.begin("NODE"); + return 20; + break; + case 20: + this.begin("NODE"); + return 20; + break; + case 21: + this.begin("NODE"); + return 20; + break; + case 22: + this.begin("NODE"); + return 20; + break; + case 23: + this.begin("NODE"); + return 20; + break; + case 24: + return 13; + break; + case 25: + return 23; + break; + case 26: + return 11; + break; + case 27: + this.begin("NSTR2"); + break; + case 28: + return "NODE_DESCR"; + break; + case 29: + this.popState(); + break; + case 30: + yy.getLogger().trace("Starting NSTR"); + this.begin("NSTR"); + break; + case 31: + yy.getLogger().trace("description:", yy_.yytext); + return "NODE_DESCR"; + break; + case 32: + this.popState(); + break; + case 33: + this.popState(); + yy.getLogger().trace("node end ))"); + return "NODE_DEND"; + break; + case 34: + this.popState(); + yy.getLogger().trace("node end )"); + return "NODE_DEND"; + break; + case 35: + this.popState(); + yy.getLogger().trace("node end ...", yy_.yytext); + return "NODE_DEND"; + break; + case 36: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + break; + case 37: + this.popState(); + yy.getLogger().trace("node end (-"); + return "NODE_DEND"; + break; + case 38: + this.popState(); + yy.getLogger().trace("node end (-"); + return "NODE_DEND"; + break; + case 39: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + break; + case 40: + this.popState(); + yy.getLogger().trace("node end (("); + return "NODE_DEND"; + break; + case 41: + yy.getLogger().trace("Long description:", yy_.yytext); + return 21; + break; + case 42: + yy.getLogger().trace("Long description:", yy_.yytext); + return 21; + break; + } + }, "anonymous"), + rules: [/^(?:@\{)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^\"]+)/i, /^(?:[^}^"]+)/i, /^(?:\})/i, /^(?:\s*%%.*)/i, /^(?:kanban\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\)\{\}@]+)/i, /^(?:$)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i], + conditions: { "shapeDataEndBracket": { "rules": [], "inclusive": false }, "shapeDataStr": { "rules": [2, 3], "inclusive": false }, "shapeData": { "rules": [1, 4, 5], "inclusive": false }, "CLASS": { "rules": [9, 10], "inclusive": false }, "ICON": { "rules": [14, 15], "inclusive": false }, "NSTR2": { "rules": [28, 29], "inclusive": false }, "NSTR": { "rules": [31, 32], "inclusive": false }, "NODE": { "rules": [27, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42], "inclusive": false }, "INITIAL": { "rules": [0, 6, 7, 8, 11, 12, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser17.parser = parser17; + kanban_default = parser17; + } + }); + + // src/diagrams/kanban/kanbanDb.ts + var nodes3, sections5, cnt2, elements, clear15, getSection, getSections5, getData, addNode, nodeType2, getType, setElementForId, decorateNode, type2Str, getLogger, getElementById2, db4, kanbanDb_default; + var init_kanbanDb = __esm({ + "src/diagrams/kanban/kanbanDb.ts"() { + "use strict"; + init_diagramAPI(); + init_common(); + init_logger(); + init_defaultConfig(); + init_js_yaml(); + nodes3 = []; + sections5 = []; + cnt2 = 0; + elements = {}; + clear15 = /* @__PURE__ */ __name(() => { + nodes3 = []; + sections5 = []; + cnt2 = 0; + elements = {}; + }, "clear"); + getSection = /* @__PURE__ */ __name((level) => { + if (nodes3.length === 0) { + return null; + } + const sectionLevel = nodes3[0].level; + let lastSection = null; + for (let i2 = nodes3.length - 1; i2 >= 0; i2--) { + if (nodes3[i2].level === sectionLevel && !lastSection) { + lastSection = nodes3[i2]; + } + if (nodes3[i2].level < sectionLevel) { + throw new Error('Items without section detected, found section ("' + nodes3[i2].label + '")'); + } + } + if (level === lastSection?.level) { + return null; + } + return lastSection; + }, "getSection"); + getSections5 = /* @__PURE__ */ __name(function() { + return sections5; + }, "getSections"); + getData = /* @__PURE__ */ __name(function() { + const edges3 = []; + const _nodes = []; + const sections6 = getSections5(); + const conf5 = getConfig2(); + for (const section of sections6) { + const node2 = { + id: section.id, + label: sanitizeText(section.label ?? "", conf5), + labelType: "markdown", + isGroup: true, + ticket: section.ticket, + shape: "kanbanSection", + level: section.level, + look: conf5.look + }; + _nodes.push(node2); + const children2 = nodes3.filter((n2) => n2.parentId === section.id); + for (const item of children2) { + const childNode = { + id: item.id, + parentId: section.id, + label: sanitizeText(item.label ?? "", conf5), + labelType: "markdown", + isGroup: false, + ticket: item?.ticket, + priority: item?.priority, + assigned: item?.assigned, + icon: item?.icon, + shape: "kanbanItem", + level: item.level, + rx: 5, + ry: 5, + cssStyles: ["text-align: left"] + }; + _nodes.push(childNode); + } + } + return { nodes: _nodes, edges: edges3, other: {}, config: getConfig2() }; + }, "getData"); + addNode = /* @__PURE__ */ __name((level, id35, descr, type3, shapeData) => { + const conf5 = getConfig2(); + let padding2 = conf5.mindmap?.padding ?? defaultConfig_default.mindmap.padding; + switch (type3) { + case nodeType2.ROUNDED_RECT: + case nodeType2.RECT: + case nodeType2.HEXAGON: + padding2 *= 2; + } + const node2 = { + id: sanitizeText(id35, conf5) || "kbn" + cnt2++, + level, + label: sanitizeText(descr, conf5), + width: conf5.mindmap?.maxNodeWidth ?? defaultConfig_default.mindmap.maxNodeWidth, + padding: padding2, + isGroup: false + }; + if (shapeData !== void 0) { + let yamlData; + if (!shapeData.includes("\n")) { + yamlData = "{\n" + shapeData + "\n}"; + } else { + yamlData = shapeData + "\n"; + } + const doc = load(yamlData, { schema: JSON_SCHEMA }); + if (doc.shape && (doc.shape !== doc.shape.toLowerCase() || doc.shape.includes("_"))) { + throw new Error(`No such shape: ${doc.shape}. Shape names should be lowercase.`); + } + if (doc?.shape && doc.shape === "kanbanItem") { + node2.shape = doc?.shape; + } + if (doc?.label) { + node2.label = doc?.label; + } + if (doc?.icon) { + node2.icon = doc?.icon.toString(); + } + if (doc?.assigned) { + node2.assigned = doc?.assigned.toString(); + } + if (doc?.ticket) { + node2.ticket = doc?.ticket.toString(); + } + if (doc?.priority) { + node2.priority = doc?.priority; + } + } + const section = getSection(level); + if (section) { + node2.parentId = section.id || "kbn" + cnt2++; + } else { + sections5.push(node2); + } + nodes3.push(node2); + }, "addNode"); + nodeType2 = { + DEFAULT: 0, + NO_BORDER: 0, + ROUNDED_RECT: 1, + RECT: 2, + CIRCLE: 3, + CLOUD: 4, + BANG: 5, + HEXAGON: 6 + }; + getType = /* @__PURE__ */ __name((startStr, endStr) => { + log.debug("In get type", startStr, endStr); + switch (startStr) { + case "[": + return nodeType2.RECT; + case "(": + return endStr === ")" ? nodeType2.ROUNDED_RECT : nodeType2.CLOUD; + case "((": + return nodeType2.CIRCLE; + case ")": + return nodeType2.CLOUD; + case "))": + return nodeType2.BANG; + case "{{": + return nodeType2.HEXAGON; + default: + return nodeType2.DEFAULT; + } + }, "getType"); + setElementForId = /* @__PURE__ */ __name((id35, element3) => { + elements[id35] = element3; + }, "setElementForId"); + decorateNode = /* @__PURE__ */ __name((decoration) => { + if (!decoration) { + return; + } + const config5 = getConfig2(); + const node2 = nodes3[nodes3.length - 1]; + if (decoration.icon) { + node2.icon = sanitizeText(decoration.icon, config5); + } + if (decoration.class) { + node2.cssClasses = sanitizeText(decoration.class, config5); + } + }, "decorateNode"); + type2Str = /* @__PURE__ */ __name((type3) => { + switch (type3) { + case nodeType2.DEFAULT: + return "no-border"; + case nodeType2.RECT: + return "rect"; + case nodeType2.ROUNDED_RECT: + return "rounded-rect"; + case nodeType2.CIRCLE: + return "circle"; + case nodeType2.CLOUD: + return "cloud"; + case nodeType2.BANG: + return "bang"; + case nodeType2.HEXAGON: + return "hexgon"; + // cspell: disable-line + default: + return "no-border"; + } + }, "type2Str"); + getLogger = /* @__PURE__ */ __name(() => log, "getLogger"); + getElementById2 = /* @__PURE__ */ __name((id35) => elements[id35], "getElementById"); + db4 = { + clear: clear15, + addNode, + getSections: getSections5, + getData, + nodeType: nodeType2, + getType, + setElementForId, + decorateNode, + type2Str, + getLogger, + getElementById: getElementById2 + }; + kanbanDb_default = db4; + } + }); + + // src/diagrams/kanban/kanbanRenderer.ts + var draw20, kanbanRenderer_default; + var init_kanbanRenderer = __esm({ + "src/diagrams/kanban/kanbanRenderer.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_selectSvgElement(); + init_setupGraphViewbox(); + init_defaultConfig(); + init_clusters(); + init_nodes2(); + draw20 = /* @__PURE__ */ __name(async (text4, id35, _version, diagObj) => { + log.debug("Rendering kanban diagram\n" + text4); + const db10 = diagObj.db; + const data4Layout = db10.getData(); + const conf5 = getConfig2(); + conf5.htmlLabels = false; + const svg2 = selectSvgElement(id35); + for (const node2 of data4Layout.nodes) { + node2.domId = `${id35}-${node2.id}`; + } + const sectionsElem = svg2.append("g"); + sectionsElem.attr("class", "sections"); + const nodesElem = svg2.append("g"); + nodesElem.attr("class", "items"); + const sections6 = data4Layout.nodes.filter( + // TODO: TypeScript 5.5 will infer this predicate automatically + (node2) => node2.isGroup + ); + let cnt4 = 0; + const padding2 = 10; + const sectionObjects = []; + let maxLabelHeight = 25; + for (const section of sections6) { + const WIDTH = conf5?.kanban?.sectionWidth || 200; + cnt4 = cnt4 + 1; + section.x = WIDTH * cnt4 + (cnt4 - 1) * padding2 / 2; + section.width = WIDTH; + section.y = 0; + section.height = WIDTH * 3; + section.rx = 5; + section.ry = 5; + section.cssClasses = section.cssClasses + " section-" + cnt4; + const sectionObj = await insertCluster(sectionsElem, section); + maxLabelHeight = Math.max(maxLabelHeight, sectionObj?.labelBBox?.height); + sectionObjects.push(sectionObj); + } + let i2 = 0; + for (const section of sections6) { + const sectionObj = sectionObjects[i2]; + i2 = i2 + 1; + const WIDTH = conf5?.kanban?.sectionWidth || 200; + const top2 = -WIDTH * 3 / 2 + maxLabelHeight; + let y6 = top2; + const sectionItems = data4Layout.nodes.filter((node2) => node2.parentId === section.id); + for (const item of sectionItems) { + if (item.isGroup) { + throw new Error("Groups within groups are not allowed in Kanban diagrams"); + } + item.x = section.x; + item.width = WIDTH - 1.5 * padding2; + const nodeEl = await insertNode(nodesElem, item, { config: conf5 }); + const bbox = nodeEl.node().getBBox(); + item.y = y6 + bbox.height / 2; + await positionNode(item); + y6 = item.y + bbox.height / 2 + padding2 / 2; + } + const rect3 = sectionObj.cluster.select("rect"); + const height2 = Math.max(y6 - top2 + 3 * padding2, 50) + (maxLabelHeight - 25); + rect3.attr("height", height2); + } + setupGraphViewbox( + void 0, + svg2, + conf5.mindmap?.padding ?? defaultConfig_default.kanban.padding, + conf5.mindmap?.useMaxWidth ?? defaultConfig_default.kanban.useMaxWidth + ); + }, "draw"); + kanbanRenderer_default = { + draw: draw20 + }; + } + }); + + // src/diagrams/kanban/styles.ts + var genSections3, getStyles15, styles_default14; + var init_styles14 = __esm({ + "src/diagrams/kanban/styles.ts"() { + "use strict"; + init_dist(); + init_globalStyles(); + genSections3 = /* @__PURE__ */ __name((options2) => { + let sections6 = ""; + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + options2["lineColor" + i2] = options2["lineColor" + i2] || options2["cScaleInv" + i2]; + if (is_dark_default(options2["lineColor" + i2])) { + options2["lineColor" + i2] = lighten_default(options2["lineColor" + i2], 20); + } else { + options2["lineColor" + i2] = darken_default(options2["lineColor" + i2], 20); + } + } + const adjuster = /* @__PURE__ */ __name((color2, level) => options2.darkMode ? darken_default(color2, level) : lighten_default(color2, level), "adjuster"); + for (let i2 = 0; i2 < options2.THEME_COLOR_LIMIT; i2++) { + const sw = "" + (17 - 3 * i2); + sections6 += ` + .section-${i2 - 1} rect, .section-${i2 - 1} path, .section-${i2 - 1} circle, .section-${i2 - 1} polygon, .section-${i2 - 1} path { + fill: ${adjuster(options2["cScale" + i2], 10)}; + stroke: ${adjuster(options2["cScale" + i2], 10)}; + + } + .section-${i2 - 1} text { + fill: ${options2["cScaleLabel" + i2]}; + } + .node-icon-${i2 - 1} { + font-size: 40px; + color: ${options2["cScaleLabel" + i2]}; + } + .section-edge-${i2 - 1}{ + stroke: ${options2["cScale" + i2]}; + } + .edge-depth-${i2 - 1}{ + stroke-width: ${sw}; + } + .section-${i2 - 1} line { + stroke: ${options2["cScaleInv" + i2]} ; + stroke-width: 3; + } + + .disabled, .disabled circle, .disabled text { + fill: lightgray; + } + .disabled text { + fill: #efefef; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${options2.background}; + stroke: ${options2.nodeBorder}; + stroke-width: 1px; + } + + .kanban-ticket-link { + fill: ${options2.background}; + stroke: ${options2.nodeBorder}; + text-decoration: underline; + } + `; + } + return sections6; + }, "genSections"); + getStyles15 = /* @__PURE__ */ __name((options2) => ` + .edge { + stroke-width: 3; + } + ${genSections3(options2)} + .section-root rect, .section-root path, .section-root circle, .section-root polygon { + fill: ${options2.git0}; + } + .section-root text { + fill: ${options2.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .cluster-label, .label { + color: ${options2.textColor}; + fill: ${options2.textColor}; + } + .kanban-label { + dy: 1em; + alignment-baseline: middle; + text-anchor: middle; + dominant-baseline: middle; + text-align: center; + } + ${getIconStyles()} +`, "getStyles"); + styles_default14 = getStyles15; + } + }); + + // src/diagrams/kanban/kanban-definition.ts + var kanban_definition_exports = {}; + __export(kanban_definition_exports, { + diagram: () => diagram20 + }); + var diagram20; + var init_kanban_definition = __esm({ + "src/diagrams/kanban/kanban-definition.ts"() { + "use strict"; + init_kanban(); + init_kanbanDb(); + init_kanbanRenderer(); + init_styles14(); + diagram20 = { + db: kanbanDb_default, + renderer: kanbanRenderer_default, + parser: kanban_default, + styles: styles_default14 + }; + } + }); + + // src/diagrams/sankey/parser/sankey.jison + var parser18, sankey_default; + var init_sankey = __esm({ + "src/diagrams/sankey/parser/sankey.jison"() { + "use strict"; + parser18 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 9], $V1 = [1, 10], $V2 = [1, 5, 10, 12]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "SANKEY": 4, "NEWLINE": 5, "csv": 6, "opt_eof": 7, "record": 8, "csv_tail": 9, "EOF": 10, "field[source]": 11, "COMMA": 12, "field[target]": 13, "field[value]": 14, "field": 15, "escaped": 16, "non_escaped": 17, "DQUOTE": 18, "ESCAPED_TEXT": 19, "NON_ESCAPED_TEXT": 20, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" }, + productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 7: + const source = yy.findOrCreateNode($$[$0 - 4].trim().replaceAll('""', '"')); + const target = yy.findOrCreateNode($$[$0 - 2].trim().replaceAll('""', '"')); + const value2 = parseFloat($$[$0].trim()); + yy.addLink(source, target, value2); + break; + case 8: + case 9: + case 11: + this.$ = $$[$0]; + break; + case 10: + this.$ = $$[$0 - 1]; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 1: [2, 6], 7: 11, 10: [1, 12] }, o2($V1, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, o2($V2, [2, 8]), o2($V2, [2, 9]), { 19: [1, 16] }, o2($V2, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, o2($V1, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 15: 18, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 18: [1, 19] }, o2($V1, [2, 3]), { 12: [1, 20] }, o2($V2, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: $V0, 20: $V1 }, o2([1, 5, 10], [2, 7])], + defaultActions: { 11: [2, 1], 12: [2, 5] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + this.pushState("csv"); + return 4; + break; + case 1: + this.pushState("csv"); + return 4; + break; + case 2: + return 10; + break; + case 3: + return 5; + break; + case 4: + return 12; + break; + case 5: + this.pushState("escaped_text"); + return 18; + break; + case 6: + return 20; + break; + case 7: + this.popState("escaped_text"); + return 18; + break; + case 8: + return 19; + break; + } + }, "anonymous"), + rules: [/^(?:sankey-beta\b)/i, /^(?:sankey\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i], + conditions: { "csv": { "rules": [2, 3, 4, 5, 6, 7, 8], "inclusive": false }, "escaped_text": { "rules": [7, 8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser18.parser = parser18; + sankey_default = parser18; + } + }); + + // src/diagrams/sankey/sankeyDB.ts + var links2, nodes4, nodesMap, clear16, SankeyLink, addLink, SankeyNode, findOrCreateNode, getNodes, getLinks2, getGraph, sankeyDB_default; + var init_sankeyDB = __esm({ + "src/diagrams/sankey/sankeyDB.ts"() { + "use strict"; + init_diagramAPI(); + init_common(); + init_commonDb(); + links2 = []; + nodes4 = []; + nodesMap = /* @__PURE__ */ new Map(); + clear16 = /* @__PURE__ */ __name(() => { + links2 = []; + nodes4 = []; + nodesMap = /* @__PURE__ */ new Map(); + clear(); + }, "clear"); + SankeyLink = class { + constructor(source, target, value2 = 0) { + this.source = source; + this.target = target; + this.value = value2; + } + static { + __name(this, "SankeyLink"); + } + }; + addLink = /* @__PURE__ */ __name((source, target, value2) => { + links2.push(new SankeyLink(source, target, value2)); + }, "addLink"); + SankeyNode = class { + constructor(ID) { + this.ID = ID; + } + static { + __name(this, "SankeyNode"); + } + }; + findOrCreateNode = /* @__PURE__ */ __name((ID) => { + ID = common_default.sanitizeText(ID, getConfig2()); + let node2 = nodesMap.get(ID); + if (node2 === void 0) { + node2 = new SankeyNode(ID); + nodesMap.set(ID, node2); + nodes4.push(node2); + } + return node2; + }, "findOrCreateNode"); + getNodes = /* @__PURE__ */ __name(() => nodes4, "getNodes"); + getLinks2 = /* @__PURE__ */ __name(() => links2, "getLinks"); + getGraph = /* @__PURE__ */ __name(() => ({ + nodes: nodes4.map((node2) => ({ id: node2.ID })), + links: links2.map((link2) => ({ + source: link2.source.ID, + target: link2.target.ID, + value: link2.value + })) + }), "getGraph"); + sankeyDB_default = { + nodesMap, + getConfig: /* @__PURE__ */ __name(() => getConfig2().sankey, "getConfig"), + getNodes, + getLinks: getLinks2, + getGraph, + addLink, + findOrCreateNode, + getAccTitle, + setAccTitle, + getAccDescription, + setAccDescription, + getDiagramTitle, + setDiagramTitle, + clear: clear16 + }; + } + }); + + // ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/max.js + function max9(values3, valueof) { + let max10; + if (valueof === void 0) { + for (const value2 of values3) { + if (value2 != null && (max10 < value2 || max10 === void 0 && value2 >= value2)) { + max10 = value2; + } + } + } else { + let index = -1; + for (let value2 of values3) { + if ((value2 = valueof(value2, ++index, values3)) != null && (max10 < value2 || max10 === void 0 && value2 >= value2)) { + max10 = value2; + } + } + } + return max10; + } + var init_max3 = __esm({ + "../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/max.js"() { + "use strict"; + __name(max9, "max"); + } + }); + + // ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/min.js + function min9(values3, valueof) { + let min10; + if (valueof === void 0) { + for (const value2 of values3) { + if (value2 != null && (min10 > value2 || min10 === void 0 && value2 >= value2)) { + min10 = value2; + } + } + } else { + let index = -1; + for (let value2 of values3) { + if ((value2 = valueof(value2, ++index, values3)) != null && (min10 > value2 || min10 === void 0 && value2 >= value2)) { + min10 = value2; + } + } + } + return min10; + } + var init_min3 = __esm({ + "../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/min.js"() { + "use strict"; + __name(min9, "min"); + } + }); + + // ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/sum.js + function sum(values3, valueof) { + let sum2 = 0; + if (valueof === void 0) { + for (let value2 of values3) { + if (value2 = +value2) { + sum2 += value2; + } + } + } else { + let index = -1; + for (let value2 of values3) { + if (value2 = +valueof(value2, ++index, values3)) { + sum2 += value2; + } + } + } + return sum2; + } + var init_sum2 = __esm({ + "../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/sum.js"() { + "use strict"; + __name(sum, "sum"); + } + }); + + // ../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/index.js + var init_src33 = __esm({ + "../../node_modules/.pnpm/d3-array@2.12.1/node_modules/d3-array/src/index.js"() { + "use strict"; + init_max3(); + init_min3(); + init_sum2(); + } + }); + + // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/align.js + function targetDepth(d3) { + return d3.target.depth; + } + function left2(node2) { + return node2.depth; + } + function right2(node2, n2) { + return n2 - 1 - node2.height; + } + function justify(node2, n2) { + return node2.sourceLinks.length ? node2.depth : n2 - 1; + } + function center3(node2) { + return node2.targetLinks.length ? node2.depth : node2.sourceLinks.length ? min9(node2.sourceLinks, targetDepth) - 1 : 0; + } + var init_align = __esm({ + "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/align.js"() { + "use strict"; + init_src33(); + __name(targetDepth, "targetDepth"); + __name(left2, "left"); + __name(right2, "right"); + __name(justify, "justify"); + __name(center3, "center"); + } + }); + + // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/constant.js + function constant3(x5) { + return function() { + return x5; + }; + } + var init_constant9 = __esm({ + "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/constant.js"() { + "use strict"; + __name(constant3, "constant"); + } + }); + + // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankey.js + function ascendingSourceBreadth(a2, b3) { + return ascendingBreadth(a2.source, b3.source) || a2.index - b3.index; + } + function ascendingTargetBreadth(a2, b3) { + return ascendingBreadth(a2.target, b3.target) || a2.index - b3.index; + } + function ascendingBreadth(a2, b3) { + return a2.y0 - b3.y0; + } + function value(d3) { + return d3.value; + } + function defaultId(d3) { + return d3.index; + } + function defaultNodes(graph) { + return graph.nodes; + } + function defaultLinks(graph) { + return graph.links; + } + function find4(nodeById, id35) { + const node2 = nodeById.get(id35); + if (!node2) throw new Error("missing: " + id35); + return node2; + } + function computeLinkBreadths({ nodes: nodes5 }) { + for (const node2 of nodes5) { + let y0 = node2.y0; + let y1 = y0; + for (const link2 of node2.sourceLinks) { + link2.y0 = y0 + link2.width / 2; + y0 += link2.width; + } + for (const link2 of node2.targetLinks) { + link2.y1 = y1 + link2.width / 2; + y1 += link2.width; + } + } + } + function Sankey() { + let x0 = 0, y0 = 0, x1 = 1, y1 = 1; + let dx = 24; + let dy = 8, py; + let id35 = defaultId; + let align = justify; + let sort3; + let linkSort; + let nodes5 = defaultNodes; + let links3 = defaultLinks; + let iterations = 6; + function sankey() { + const graph = { nodes: nodes5.apply(null, arguments), links: links3.apply(null, arguments) }; + computeNodeLinks(graph); + computeNodeValues(graph); + computeNodeDepths(graph); + computeNodeHeights(graph); + computeNodeBreadths(graph); + computeLinkBreadths(graph); + return graph; + } + __name(sankey, "sankey"); + sankey.update = function(graph) { + computeLinkBreadths(graph); + return graph; + }; + sankey.nodeId = function(_3) { + return arguments.length ? (id35 = typeof _3 === "function" ? _3 : constant3(_3), sankey) : id35; + }; + sankey.nodeAlign = function(_3) { + return arguments.length ? (align = typeof _3 === "function" ? _3 : constant3(_3), sankey) : align; + }; + sankey.nodeSort = function(_3) { + return arguments.length ? (sort3 = _3, sankey) : sort3; + }; + sankey.nodeWidth = function(_3) { + return arguments.length ? (dx = +_3, sankey) : dx; + }; + sankey.nodePadding = function(_3) { + return arguments.length ? (dy = py = +_3, sankey) : dy; + }; + sankey.nodes = function(_3) { + return arguments.length ? (nodes5 = typeof _3 === "function" ? _3 : constant3(_3), sankey) : nodes5; + }; + sankey.links = function(_3) { + return arguments.length ? (links3 = typeof _3 === "function" ? _3 : constant3(_3), sankey) : links3; + }; + sankey.linkSort = function(_3) { + return arguments.length ? (linkSort = _3, sankey) : linkSort; + }; + sankey.size = function(_3) { + return arguments.length ? (x0 = y0 = 0, x1 = +_3[0], y1 = +_3[1], sankey) : [x1 - x0, y1 - y0]; + }; + sankey.extent = function(_3) { + return arguments.length ? (x0 = +_3[0][0], x1 = +_3[1][0], y0 = +_3[0][1], y1 = +_3[1][1], sankey) : [[x0, y0], [x1, y1]]; + }; + sankey.iterations = function(_3) { + return arguments.length ? (iterations = +_3, sankey) : iterations; + }; + function computeNodeLinks({ nodes: nodes6, links: links4 }) { + for (const [i2, node2] of nodes6.entries()) { + node2.index = i2; + node2.sourceLinks = []; + node2.targetLinks = []; + } + const nodeById = new Map(nodes6.map((d3, i2) => [id35(d3, i2, nodes6), d3])); + for (const [i2, link2] of links4.entries()) { + link2.index = i2; + let { source, target } = link2; + if (typeof source !== "object") source = link2.source = find4(nodeById, source); + if (typeof target !== "object") target = link2.target = find4(nodeById, target); + source.sourceLinks.push(link2); + target.targetLinks.push(link2); + } + if (linkSort != null) { + for (const { sourceLinks, targetLinks } of nodes6) { + sourceLinks.sort(linkSort); + targetLinks.sort(linkSort); + } + } + } + __name(computeNodeLinks, "computeNodeLinks"); + function computeNodeValues({ nodes: nodes6 }) { + for (const node2 of nodes6) { + node2.value = node2.fixedValue === void 0 ? Math.max(sum(node2.sourceLinks, value), sum(node2.targetLinks, value)) : node2.fixedValue; + } + } + __name(computeNodeValues, "computeNodeValues"); + function computeNodeDepths({ nodes: nodes6 }) { + const n2 = nodes6.length; + let current = new Set(nodes6); + let next3 = /* @__PURE__ */ new Set(); + let x5 = 0; + while (current.size) { + for (const node2 of current) { + node2.depth = x5; + for (const { target } of node2.sourceLinks) { + next3.add(target); + } + } + if (++x5 > n2) throw new Error("circular link"); + current = next3; + next3 = /* @__PURE__ */ new Set(); + } + } + __name(computeNodeDepths, "computeNodeDepths"); + function computeNodeHeights({ nodes: nodes6 }) { + const n2 = nodes6.length; + let current = new Set(nodes6); + let next3 = /* @__PURE__ */ new Set(); + let x5 = 0; + while (current.size) { + for (const node2 of current) { + node2.height = x5; + for (const { source } of node2.targetLinks) { + next3.add(source); + } + } + if (++x5 > n2) throw new Error("circular link"); + current = next3; + next3 = /* @__PURE__ */ new Set(); + } + } + __name(computeNodeHeights, "computeNodeHeights"); + function computeNodeLayers({ nodes: nodes6 }) { + const x5 = max9(nodes6, (d3) => d3.depth) + 1; + const kx = (x1 - x0 - dx) / (x5 - 1); + const columns = new Array(x5); + for (const node2 of nodes6) { + const i2 = Math.max(0, Math.min(x5 - 1, Math.floor(align.call(null, node2, x5)))); + node2.layer = i2; + node2.x0 = x0 + i2 * kx; + node2.x1 = node2.x0 + dx; + if (columns[i2]) columns[i2].push(node2); + else columns[i2] = [node2]; + } + if (sort3) for (const column2 of columns) { + column2.sort(sort3); + } + return columns; + } + __name(computeNodeLayers, "computeNodeLayers"); + function initializeNodeBreadths(columns) { + const ky = min9(columns, (c3) => (y1 - y0 - (c3.length - 1) * py) / sum(c3, value)); + for (const nodes6 of columns) { + let y6 = y0; + for (const node2 of nodes6) { + node2.y0 = y6; + node2.y1 = y6 + node2.value * ky; + y6 = node2.y1 + py; + for (const link2 of node2.sourceLinks) { + link2.width = link2.value * ky; + } + } + y6 = (y1 - y6 + py) / (nodes6.length + 1); + for (let i2 = 0; i2 < nodes6.length; ++i2) { + const node2 = nodes6[i2]; + node2.y0 += y6 * (i2 + 1); + node2.y1 += y6 * (i2 + 1); + } + reorderLinks(nodes6); + } + } + __name(initializeNodeBreadths, "initializeNodeBreadths"); + function computeNodeBreadths(graph) { + const columns = computeNodeLayers(graph); + py = Math.min(dy, (y1 - y0) / (max9(columns, (c3) => c3.length) - 1)); + initializeNodeBreadths(columns); + for (let i2 = 0; i2 < iterations; ++i2) { + const alpha = Math.pow(0.99, i2); + const beta = Math.max(1 - alpha, (i2 + 1) / iterations); + relaxRightToLeft(columns, alpha, beta); + relaxLeftToRight(columns, alpha, beta); + } + } + __name(computeNodeBreadths, "computeNodeBreadths"); + function relaxLeftToRight(columns, alpha, beta) { + for (let i2 = 1, n2 = columns.length; i2 < n2; ++i2) { + const column2 = columns[i2]; + for (const target of column2) { + let y6 = 0; + let w4 = 0; + for (const { source, value: value2 } of target.targetLinks) { + let v3 = value2 * (target.layer - source.layer); + y6 += targetTop(source, target) * v3; + w4 += v3; + } + if (!(w4 > 0)) continue; + let dy2 = (y6 / w4 - target.y0) * alpha; + target.y0 += dy2; + target.y1 += dy2; + reorderNodeLinks(target); + } + if (sort3 === void 0) column2.sort(ascendingBreadth); + resolveCollisions(column2, beta); + } + } + __name(relaxLeftToRight, "relaxLeftToRight"); + function relaxRightToLeft(columns, alpha, beta) { + for (let n2 = columns.length, i2 = n2 - 2; i2 >= 0; --i2) { + const column2 = columns[i2]; + for (const source of column2) { + let y6 = 0; + let w4 = 0; + for (const { target, value: value2 } of source.sourceLinks) { + let v3 = value2 * (target.layer - source.layer); + y6 += sourceTop(source, target) * v3; + w4 += v3; + } + if (!(w4 > 0)) continue; + let dy2 = (y6 / w4 - source.y0) * alpha; + source.y0 += dy2; + source.y1 += dy2; + reorderNodeLinks(source); + } + if (sort3 === void 0) column2.sort(ascendingBreadth); + resolveCollisions(column2, beta); + } + } + __name(relaxRightToLeft, "relaxRightToLeft"); + function resolveCollisions(nodes6, alpha) { + const i2 = nodes6.length >> 1; + const subject = nodes6[i2]; + resolveCollisionsBottomToTop(nodes6, subject.y0 - py, i2 - 1, alpha); + resolveCollisionsTopToBottom(nodes6, subject.y1 + py, i2 + 1, alpha); + resolveCollisionsBottomToTop(nodes6, y1, nodes6.length - 1, alpha); + resolveCollisionsTopToBottom(nodes6, y0, 0, alpha); + } + __name(resolveCollisions, "resolveCollisions"); + function resolveCollisionsTopToBottom(nodes6, y6, i2, alpha) { + for (; i2 < nodes6.length; ++i2) { + const node2 = nodes6[i2]; + const dy2 = (y6 - node2.y0) * alpha; + if (dy2 > 1e-6) node2.y0 += dy2, node2.y1 += dy2; + y6 = node2.y1 + py; + } + } + __name(resolveCollisionsTopToBottom, "resolveCollisionsTopToBottom"); + function resolveCollisionsBottomToTop(nodes6, y6, i2, alpha) { + for (; i2 >= 0; --i2) { + const node2 = nodes6[i2]; + const dy2 = (node2.y1 - y6) * alpha; + if (dy2 > 1e-6) node2.y0 -= dy2, node2.y1 -= dy2; + y6 = node2.y0 - py; + } + } + __name(resolveCollisionsBottomToTop, "resolveCollisionsBottomToTop"); + function reorderNodeLinks({ sourceLinks, targetLinks }) { + if (linkSort === void 0) { + for (const { source: { sourceLinks: sourceLinks2 } } of targetLinks) { + sourceLinks2.sort(ascendingTargetBreadth); + } + for (const { target: { targetLinks: targetLinks2 } } of sourceLinks) { + targetLinks2.sort(ascendingSourceBreadth); + } + } + } + __name(reorderNodeLinks, "reorderNodeLinks"); + function reorderLinks(nodes6) { + if (linkSort === void 0) { + for (const { sourceLinks, targetLinks } of nodes6) { + sourceLinks.sort(ascendingTargetBreadth); + targetLinks.sort(ascendingSourceBreadth); + } + } + } + __name(reorderLinks, "reorderLinks"); + function targetTop(source, target) { + let y6 = source.y0 - (source.sourceLinks.length - 1) * py / 2; + for (const { target: node2, width: width3 } of source.sourceLinks) { + if (node2 === target) break; + y6 += width3 + py; + } + for (const { source: node2, width: width3 } of target.targetLinks) { + if (node2 === source) break; + y6 -= width3; + } + return y6; + } + __name(targetTop, "targetTop"); + function sourceTop(source, target) { + let y6 = target.y0 - (target.targetLinks.length - 1) * py / 2; + for (const { source: node2, width: width3 } of target.targetLinks) { + if (node2 === source) break; + y6 += width3 + py; + } + for (const { target: node2, width: width3 } of source.sourceLinks) { + if (node2 === target) break; + y6 -= width3; + } + return y6; + } + __name(sourceTop, "sourceTop"); + return sankey; + } + var init_sankey2 = __esm({ + "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankey.js"() { + "use strict"; + init_src33(); + init_align(); + init_constant9(); + __name(ascendingSourceBreadth, "ascendingSourceBreadth"); + __name(ascendingTargetBreadth, "ascendingTargetBreadth"); + __name(ascendingBreadth, "ascendingBreadth"); + __name(value, "value"); + __name(defaultId, "defaultId"); + __name(defaultNodes, "defaultNodes"); + __name(defaultLinks, "defaultLinks"); + __name(find4, "find"); + __name(computeLinkBreadths, "computeLinkBreadths"); + __name(Sankey, "Sankey"); + } + }); + + // ../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/src/path.js + function Path2() { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; + } + function path3() { + return new Path2(); + } + var pi3, tau3, epsilon5, tauEpsilon2, path_default2; + var init_path4 = __esm({ + "../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/src/path.js"() { + "use strict"; + pi3 = Math.PI; + tau3 = 2 * pi3; + epsilon5 = 1e-6; + tauEpsilon2 = tau3 - epsilon5; + __name(Path2, "Path"); + __name(path3, "path"); + Path2.prototype = path3.prototype = { + constructor: Path2, + moveTo: /* @__PURE__ */ __name(function(x5, y6) { + this._ += "M" + (this._x0 = this._x1 = +x5) + "," + (this._y0 = this._y1 = +y6); + }, "moveTo"), + closePath: /* @__PURE__ */ __name(function() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._ += "Z"; + } + }, "closePath"), + lineTo: /* @__PURE__ */ __name(function(x5, y6) { + this._ += "L" + (this._x1 = +x5) + "," + (this._y1 = +y6); + }, "lineTo"), + quadraticCurveTo: /* @__PURE__ */ __name(function(x1, y1, x5, y6) { + this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x5) + "," + (this._y1 = +y6); + }, "quadraticCurveTo"), + bezierCurveTo: /* @__PURE__ */ __name(function(x1, y1, x22, y22, x5, y6) { + this._ += "C" + +x1 + "," + +y1 + "," + +x22 + "," + +y22 + "," + (this._x1 = +x5) + "," + (this._y1 = +y6); + }, "bezierCurveTo"), + arcTo: /* @__PURE__ */ __name(function(x1, y1, x22, y22, r2) { + x1 = +x1, y1 = +y1, x22 = +x22, y22 = +y22, r2 = +r2; + var x0 = this._x1, y0 = this._y1, x21 = x22 - x1, y21 = y22 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01; + if (r2 < 0) throw new Error("negative radius: " + r2); + if (this._x1 === null) { + this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1); + } else if (!(l01_2 > epsilon5)) ; + else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon5) || !r2) { + this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); + } else { + var x20 = x22 - x0, y20 = y22 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l4 = r2 * Math.tan((pi3 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l4 / l01, t21 = l4 / l21; + if (Math.abs(t01 - 1) > epsilon5) { + this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); + } + this._ += "A" + r2 + "," + r2 + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21); + } + }, "arcTo"), + arc: /* @__PURE__ */ __name(function(x5, y6, r2, a0, a1, ccw) { + x5 = +x5, y6 = +y6, r2 = +r2, ccw = !!ccw; + var dx = r2 * Math.cos(a0), dy = r2 * Math.sin(a0), x0 = x5 + dx, y0 = y6 + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; + if (r2 < 0) throw new Error("negative radius: " + r2); + if (this._x1 === null) { + this._ += "M" + x0 + "," + y0; + } else if (Math.abs(this._x1 - x0) > epsilon5 || Math.abs(this._y1 - y0) > epsilon5) { + this._ += "L" + x0 + "," + y0; + } + if (!r2) return; + if (da < 0) da = da % tau3 + tau3; + if (da > tauEpsilon2) { + this._ += "A" + r2 + "," + r2 + ",0,1," + cw + "," + (x5 - dx) + "," + (y6 - dy) + "A" + r2 + "," + r2 + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0); + } else if (da > epsilon5) { + this._ += "A" + r2 + "," + r2 + ",0," + +(da >= pi3) + "," + cw + "," + (this._x1 = x5 + r2 * Math.cos(a1)) + "," + (this._y1 = y6 + r2 * Math.sin(a1)); + } + }, "arc"), + rect: /* @__PURE__ */ __name(function(x5, y6, w4, h3) { + this._ += "M" + (this._x0 = this._x1 = +x5) + "," + (this._y0 = this._y1 = +y6) + "h" + +w4 + "v" + +h3 + "h" + -w4 + "Z"; + }, "rect"), + toString: /* @__PURE__ */ __name(function() { + return this._; + }, "toString") + }; + path_default2 = path3; + } + }); + + // ../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/src/index.js + var init_src34 = __esm({ + "../../node_modules/.pnpm/d3-path@1.0.9/node_modules/d3-path/src/index.js"() { + "use strict"; + init_path4(); + } + }); + + // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/constant.js + function constant_default9(x5) { + return /* @__PURE__ */ __name(function constant4() { + return x5; + }, "constant"); + } + var init_constant10 = __esm({ + "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/constant.js"() { + "use strict"; + __name(constant_default9, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/point.js + function x4(p3) { + return p3[0]; + } + function y5(p3) { + return p3[1]; + } + var init_point2 = __esm({ + "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/point.js"() { + "use strict"; + __name(x4, "x"); + __name(y5, "y"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/array.js + var slice3; + var init_array4 = __esm({ + "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/array.js"() { + "use strict"; + slice3 = Array.prototype.slice; + } + }); + + // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/link/index.js + function linkSource(d3) { + return d3.source; + } + function linkTarget(d3) { + return d3.target; + } + function link(curve) { + var source = linkSource, target = linkTarget, x5 = x4, y6 = y5, context = null; + function link2() { + var buffer, argv = slice3.call(arguments), s2 = source.apply(this, argv), t4 = target.apply(this, argv); + if (!context) context = buffer = path_default2(); + curve(context, +x5.apply(this, (argv[0] = s2, argv)), +y6.apply(this, argv), +x5.apply(this, (argv[0] = t4, argv)), +y6.apply(this, argv)); + if (buffer) return context = null, buffer + "" || null; + } + __name(link2, "link"); + link2.source = function(_3) { + return arguments.length ? (source = _3, link2) : source; + }; + link2.target = function(_3) { + return arguments.length ? (target = _3, link2) : target; + }; + link2.x = function(_3) { + return arguments.length ? (x5 = typeof _3 === "function" ? _3 : constant_default9(+_3), link2) : x5; + }; + link2.y = function(_3) { + return arguments.length ? (y6 = typeof _3 === "function" ? _3 : constant_default9(+_3), link2) : y6; + }; + link2.context = function(_3) { + return arguments.length ? (context = _3 == null ? null : _3, link2) : context; + }; + return link2; + } + function curveHorizontal(context, x0, y0, x1, y1) { + context.moveTo(x0, y0); + context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1); + } + function linkHorizontal() { + return link(curveHorizontal); + } + var init_link = __esm({ + "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/link/index.js"() { + "use strict"; + init_src34(); + init_array4(); + init_constant10(); + init_point2(); + __name(linkSource, "linkSource"); + __name(linkTarget, "linkTarget"); + __name(link, "link"); + __name(curveHorizontal, "curveHorizontal"); + __name(linkHorizontal, "linkHorizontal"); + } + }); + + // ../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/index.js + var init_src35 = __esm({ + "../../node_modules/.pnpm/d3-shape@1.3.7/node_modules/d3-shape/src/index.js"() { + "use strict"; + init_link(); + } + }); + + // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankeyLinkHorizontal.js + function horizontalSource(d3) { + return [d3.source.x1, d3.y0]; + } + function horizontalTarget(d3) { + return [d3.target.x0, d3.y1]; + } + function sankeyLinkHorizontal_default() { + return linkHorizontal().source(horizontalSource).target(horizontalTarget); + } + var init_sankeyLinkHorizontal = __esm({ + "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/sankeyLinkHorizontal.js"() { + "use strict"; + init_src35(); + __name(horizontalSource, "horizontalSource"); + __name(horizontalTarget, "horizontalTarget"); + __name(sankeyLinkHorizontal_default, "default"); + } + }); + + // ../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/index.js + var init_src36 = __esm({ + "../../node_modules/.pnpm/d3-sankey@0.12.3/node_modules/d3-sankey/src/index.js"() { + "use strict"; + init_sankey2(); + init_align(); + init_sankeyLinkHorizontal(); + } + }); + + // src/rendering-util/uid.ts + var Uid; + var init_uid = __esm({ + "src/rendering-util/uid.ts"() { + "use strict"; + Uid = class _Uid { + static { + __name(this, "Uid"); + } + static { + this.count = 0; + } + static next(name) { + return new _Uid(name + ++_Uid.count); + } + constructor(id35) { + this.id = id35; + this.href = `#${id35}`; + } + toString() { + return "url(" + this.href + ")"; + } + }; + } + }); + + // src/diagrams/sankey/sankeyRenderer.ts + var alignmentsMap, findCentralNodeLayer, draw21, sankeyRenderer_default; + var init_sankeyRenderer = __esm({ + "src/diagrams/sankey/sankeyRenderer.ts"() { + "use strict"; + init_diagramAPI(); + init_src32(); + init_src36(); + init_setupGraphViewbox(); + init_uid(); + alignmentsMap = { + left: left2, + right: right2, + center: center3, + justify + }; + findCentralNodeLayer = /* @__PURE__ */ __name((nodes5) => { + let maxValue = 0; + let centralLayer = 0; + for (const node2 of nodes5) { + const value2 = node2.value ?? 0; + if (value2 > maxValue) { + maxValue = value2; + centralLayer = node2.layer ?? 0; + } + } + return centralLayer; + }, "findCentralNodeLayer"); + draw21 = /* @__PURE__ */ __name(function(text4, id35, _version, diagObj) { + const { securityLevel, sankey: conf5 } = getConfig2(); + const defaultSankeyConfig = defaultConfig2.sankey; + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + const svg2 = securityLevel === "sandbox" ? root4.select(`[id="${id35}"]`) : select_default2(`[id="${id35}"]`); + const width3 = conf5?.width ?? defaultSankeyConfig.width; + const height2 = conf5?.height ?? defaultSankeyConfig.width; + const useMaxWidth = conf5?.useMaxWidth ?? defaultSankeyConfig.useMaxWidth; + const nodeAlignment = conf5?.nodeAlignment ?? defaultSankeyConfig.nodeAlignment; + const prefix = conf5?.prefix ?? defaultSankeyConfig.prefix; + const suffix = conf5?.suffix ?? defaultSankeyConfig.suffix; + const showValues = conf5?.showValues ?? defaultSankeyConfig.showValues; + const nodeWidth = conf5?.nodeWidth ?? defaultSankeyConfig.nodeWidth ?? 10; + const nodePadding = conf5?.nodePadding ?? defaultSankeyConfig.nodePadding ?? 12; + const labelStyle = conf5?.labelStyle ?? defaultSankeyConfig.labelStyle ?? "legacy"; + const nodeColors = conf5?.nodeColors ?? {}; + const graph = diagObj.db.getGraph(); + const nodeAlign = alignmentsMap[nodeAlignment]; + const sankey = Sankey().nodeId((d3) => d3.id).nodeWidth(nodeWidth).nodePadding(nodePadding + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([ + [0, 0], + [width3, height2] + ]); + sankey(graph); + const centralNodeLayer = findCentralNodeLayer(graph.nodes); + const colorScheme = ordinal(Tableau10_default); + const getNodeColor = /* @__PURE__ */ __name((nodeId) => { + return nodeColors[nodeId] ?? colorScheme(nodeId); + }, "getNodeColor"); + svg2.append("g").attr("class", "nodes").selectAll(".node").data(graph.nodes).join("g").attr("class", "node").attr("id", (d3) => (d3.uid = Uid.next("node-")).id).attr("transform", function(d3) { + return "translate(" + d3.x0 + "," + d3.y0 + ")"; + }).attr("x", (d3) => d3.x0).attr("y", (d3) => d3.y0).append("rect").attr("height", (d3) => { + return d3.y1 - d3.y0; + }).attr("width", (d3) => d3.x1 - d3.x0).attr("fill", (d3) => getNodeColor(d3.id)); + const getText = /* @__PURE__ */ __name(({ id: id36, value: value2 }) => { + if (!showValues) { + return id36; + } + return `${id36} +${prefix}${Math.round(value2 * 100) / 100}${suffix}`; + }, "getText"); + const getLabelPosition = /* @__PURE__ */ __name((d3) => { + if (labelStyle === "outlined") { + const nodeLayer = d3.layer ?? 0; + if (nodeLayer < centralNodeLayer) { + return { x: d3.x0 - 6, anchor: "end" }; + } + return { x: d3.x1 + 6, anchor: "start" }; + } + if (d3.x0 < width3 / 2) { + return { x: d3.x1 + 6, anchor: "start" }; + } + return { x: d3.x0 - 6, anchor: "end" }; + }, "getLabelPosition"); + const labelsGroup = svg2.append("g").attr("class", "node-labels").attr("font-size", 14); + const appendLabel = /* @__PURE__ */ __name((className) => labelsGroup.selectAll(className ? `.${className}` : "text").data(graph.nodes).join("text").attr("class", className ?? null).attr("x", (d3) => getLabelPosition(d3).x).attr("y", (d3) => (d3.y1 + d3.y0) / 2).attr("dy", `${showValues ? "0" : "0.35"}em`).attr("text-anchor", (d3) => getLabelPosition(d3).anchor).text(getText), "appendLabel"); + if (labelStyle === "outlined") { + appendLabel("sankey-label-bg"); + appendLabel("sankey-label-fg"); + } else { + appendLabel(); + } + const link2 = svg2.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(graph.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply"); + const linkColor = conf5?.linkColor ?? "gradient"; + if (linkColor === "gradient") { + const gradient = link2.append("linearGradient").attr("id", (d3) => (d3.uid = Uid.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (d3) => d3.source.x1).attr("x2", (d3) => d3.target.x0); + gradient.append("stop").attr("offset", "0%").attr("stop-color", (d3) => getNodeColor(d3.source.id)); + gradient.append("stop").attr("offset", "100%").attr("stop-color", (d3) => getNodeColor(d3.target.id)); + } + let coloring; + switch (linkColor) { + case "gradient": + coloring = /* @__PURE__ */ __name((d3) => d3.uid, "coloring"); + break; + case "source": + coloring = /* @__PURE__ */ __name((d3) => getNodeColor(d3.source.id), "coloring"); + break; + case "target": + coloring = /* @__PURE__ */ __name((d3) => getNodeColor(d3.target.id), "coloring"); + break; + default: + coloring = linkColor; + } + link2.append("path").attr("d", sankeyLinkHorizontal_default()).attr("stroke", coloring).attr("stroke-width", (d3) => Math.max(1, d3.width)); + setupGraphViewbox(void 0, svg2, 0, useMaxWidth); + }, "draw"); + sankeyRenderer_default = { + draw: draw21 + }; + } + }); + + // src/diagrams/sankey/sankeyUtils.ts + var prepareTextForParsing; + var init_sankeyUtils = __esm({ + "src/diagrams/sankey/sankeyUtils.ts"() { + "use strict"; + prepareTextForParsing = /* @__PURE__ */ __name((text4) => { + const textToParse = text4.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, "\n").trim(); + return textToParse; + }, "prepareTextForParsing"); + } + }); + + // src/diagrams/sankey/styles.js + var getStyles16, styles_default15; + var init_styles15 = __esm({ + "src/diagrams/sankey/styles.js"() { + "use strict"; + getStyles16 = /* @__PURE__ */ __name((options2) => `.label { + font-family: ${options2.fontFamily}; + } + + .node-labels { + font-family: ${options2.fontFamily}; + } + + /* Outlined label style - background stroke for better readability */ + .sankey-label-bg { + stroke: ${options2.mainBkg || options2.background || "#fff"}; + stroke-width: 4px; + stroke-linejoin: round; + paint-order: stroke; + } + + /* Foreground label text */ + .sankey-label-fg { + fill: ${options2.textColor}; + } + + /* Node styling */ + .node rect { + shape-rendering: crispEdges; + } + + /* Link styling */ + .link { + fill: none; + stroke-opacity: 0.5; + mix-blend-mode: multiply; + } +`, "getStyles"); + styles_default15 = getStyles16; + } + }); + + // src/diagrams/sankey/sankeyDiagram.ts + var sankeyDiagram_exports = {}; + __export(sankeyDiagram_exports, { + diagram: () => diagram21 + }); + var originalParse, diagram21; + var init_sankeyDiagram = __esm({ + "src/diagrams/sankey/sankeyDiagram.ts"() { + "use strict"; + init_sankey(); + init_sankeyDB(); + init_sankeyRenderer(); + init_sankeyUtils(); + init_styles15(); + originalParse = sankey_default.parse.bind(sankey_default); + sankey_default.parse = (text4) => originalParse(prepareTextForParsing(text4)); + diagram21 = { + styles: styles_default15, + parser: sankey_default, + db: sankeyDB_default, + renderer: sankeyRenderer_default + }; + } + }); + + // src/diagrams/packet/db.ts + var DEFAULT_PACKET_CONFIG, PacketDB; + var init_db = __esm({ + "src/diagrams/packet/db.ts"() { + "use strict"; + init_config(); + init_defaultConfig(); + init_utils2(); + init_commonDb(); + DEFAULT_PACKET_CONFIG = defaultConfig_default.packet; + PacketDB = class { + constructor() { + this.packet = []; + this.setAccTitle = setAccTitle; + this.getAccTitle = getAccTitle; + this.setDiagramTitle = setDiagramTitle; + this.getDiagramTitle = getDiagramTitle; + this.getAccDescription = getAccDescription; + this.setAccDescription = setAccDescription; + } + static { + __name(this, "PacketDB"); + } + getConfig() { + const config5 = cleanAndMerge({ + ...DEFAULT_PACKET_CONFIG, + ...getConfig().packet + }); + if (config5.showBits) { + config5.paddingY += 10; + } + return config5; + } + getPacket() { + return this.packet; + } + pushWord(word) { + if (word.length > 0) { + this.packet.push(word); + } + } + clear() { + clear(); + this.packet = []; + } + }; + } + }); + + // src/diagrams/packet/parser.ts + var maxPacketSize, populate16, getNextFittingBlock, parser19; + var init_parser = __esm({ + "src/diagrams/packet/parser.ts"() { + "use strict"; + init_mermaid_parser_core(); + init_logger(); + init_populateCommonDb(); + init_db(); + maxPacketSize = 1e4; + populate16 = /* @__PURE__ */ __name((ast, db10) => { + populateCommonDb(ast, db10); + let lastBit = -1; + let word = []; + let row = 1; + const { bitsPerRow } = db10.getConfig(); + for (let { start: start3, end: end2, bits, label } of ast.blocks) { + if (start3 !== void 0 && end2 !== void 0 && end2 < start3) { + throw new Error(`Packet block ${start3} - ${end2} is invalid. End must be greater than start.`); + } + start3 ??= lastBit + 1; + if (start3 !== lastBit + 1) { + throw new Error( + `Packet block ${start3} - ${end2 ?? start3} is not contiguous. It should start from ${lastBit + 1}.` + ); + } + if (bits === 0) { + throw new Error(`Packet block ${start3} is invalid. Cannot have a zero bit field.`); + } + end2 ??= start3 + (bits ?? 1) - 1; + bits ??= end2 - start3 + 1; + lastBit = end2; + log.debug(`Packet block ${start3} - ${lastBit} with label ${label}`); + while (word.length <= bitsPerRow + 1 && db10.getPacket().length < maxPacketSize) { + const [block2, nextBlock] = getNextFittingBlock({ start: start3, end: end2, bits, label }, row, bitsPerRow); + word.push(block2); + if (block2.end + 1 === row * bitsPerRow) { + db10.pushWord(word); + word = []; + row++; + } + if (!nextBlock) { + break; + } + ({ start: start3, end: end2, bits, label } = nextBlock); + } + } + db10.pushWord(word); + }, "populate"); + getNextFittingBlock = /* @__PURE__ */ __name((block2, row, bitsPerRow) => { + if (block2.start === void 0) { + throw new Error("start should have been set during first phase"); + } + if (block2.end === void 0) { + throw new Error("end should have been set during first phase"); + } + if (block2.start > block2.end) { + throw new Error(`Block start ${block2.start} is greater than block end ${block2.end}.`); + } + if (block2.end + 1 <= row * bitsPerRow) { + return [block2, void 0]; + } + const rowEnd = row * bitsPerRow - 1; + const rowStart = row * bitsPerRow; + return [ + { + start: block2.start, + end: rowEnd, + label: block2.label, + bits: rowEnd - block2.start + }, + { + start: rowStart, + end: block2.end, + label: block2.label, + bits: block2.end - rowStart + } + ]; + }, "getNextFittingBlock"); + parser19 = { + // @ts-expect-error - PacketDB is not assignable to DiagramDB + parser: { yy: void 0 }, + parse: /* @__PURE__ */ __name(async (input) => { + const ast = await parse3("packet", input); + const db10 = parser19.parser?.yy; + if (!(db10 instanceof PacketDB)) { + throw new Error( + "parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues." + ); + } + log.debug(ast); + populate16(ast, db10); + }, "parse") + }; + } + }); + + // src/diagrams/packet/renderer.ts + var draw22, drawWord, renderer6; + var init_renderer = __esm({ + "src/diagrams/packet/renderer.ts"() { + "use strict"; + init_selectSvgElement(); + init_setupGraphViewbox(); + draw22 = /* @__PURE__ */ __name((_text, id35, _version, diagram32) => { + const db10 = diagram32.db; + const config5 = db10.getConfig(); + const { rowHeight, paddingY, bitWidth, bitsPerRow } = config5; + const words = db10.getPacket(); + const title2 = db10.getDiagramTitle(); + const totalRowHeight = rowHeight + paddingY; + const svgHeight = totalRowHeight * (words.length + 1) - (title2 ? 0 : rowHeight); + const svgWidth = bitWidth * bitsPerRow + 2; + const svg2 = selectSvgElement(id35); + svg2.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`); + configureSvgSize(svg2, svgHeight, svgWidth, config5.useMaxWidth); + for (const [word, packet2] of words.entries()) { + drawWord(svg2, packet2, word, config5); + } + svg2.append("text").text(title2).attr("x", svgWidth / 2).attr("y", svgHeight - totalRowHeight / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle"); + }, "draw"); + drawWord = /* @__PURE__ */ __name((svg2, word, rowNumber, { rowHeight, paddingX, paddingY, bitWidth, bitsPerRow, showBits }) => { + const group2 = svg2.append("g"); + const wordY = rowNumber * (rowHeight + paddingY) + paddingY; + for (const block2 of word) { + const blockX = block2.start % bitsPerRow * bitWidth + 1; + const width3 = (block2.end - block2.start + 1) * bitWidth - paddingX; + group2.append("rect").attr("x", blockX).attr("y", wordY).attr("width", width3).attr("height", rowHeight).attr("class", "packetBlock"); + group2.append("text").attr("x", blockX + width3 / 2).attr("y", wordY + rowHeight / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(block2.label); + if (!showBits) { + continue; + } + const isSingleBlock = block2.end === block2.start; + const bitNumberY = wordY - 2; + group2.append("text").attr("x", blockX + (isSingleBlock ? width3 / 2 : 0)).attr("y", bitNumberY).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", isSingleBlock ? "middle" : "start").text(block2.start); + if (!isSingleBlock) { + group2.append("text").attr("x", blockX + width3).attr("y", bitNumberY).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(block2.end); + } + } + }, "drawWord"); + renderer6 = { draw: draw22 }; + } + }); + + // src/diagrams/packet/styles.ts + var defaultPacketStyleOptions, styles2; + var init_styles16 = __esm({ + "src/diagrams/packet/styles.ts"() { + "use strict"; + init_utils2(); + defaultPacketStyleOptions = { + byteFontSize: "10px", + startByteColor: "black", + endByteColor: "black", + labelColor: "black", + labelFontSize: "12px", + titleColor: "black", + titleFontSize: "14px", + blockStrokeColor: "black", + blockStrokeWidth: "1", + blockFillColor: "#efefef" + }; + styles2 = /* @__PURE__ */ __name(({ packet: packet2 } = {}) => { + const options2 = cleanAndMerge(defaultPacketStyleOptions, packet2); + return ` + .packetByte { + font-size: ${options2.byteFontSize}; + } + .packetByte.start { + fill: ${options2.startByteColor}; + } + .packetByte.end { + fill: ${options2.endByteColor}; + } + .packetLabel { + fill: ${options2.labelColor}; + font-size: ${options2.labelFontSize}; + } + .packetTitle { + fill: ${options2.titleColor}; + font-size: ${options2.titleFontSize}; + } + .packetBlock { + stroke: ${options2.blockStrokeColor}; + stroke-width: ${options2.blockStrokeWidth}; + fill: ${options2.blockFillColor}; + } + `; + }, "styles"); + } + }); + + // src/diagrams/packet/diagram.ts + var diagram_exports = {}; + __export(diagram_exports, { + diagram: () => diagram22 + }); + var diagram22; + var init_diagram = __esm({ + "src/diagrams/packet/diagram.ts"() { + "use strict"; + init_db(); + init_parser(); + init_renderer(); + init_styles16(); + diagram22 = { + parser: parser19, + get db() { + return new PacketDB(); + }, + renderer: renderer6, + styles: styles2 + }; + } + }); + + // src/diagrams/radar/db.ts + var defaultOptions, defaultRadarData, data4, DEFAULT_RADAR_CONFIG, getConfig5, getAxes, getCurves, getOptions2, setAxes, setCurves, computeCurveEntries, setOptions7, clear17, db5; + var init_db2 = __esm({ + "src/diagrams/radar/db.ts"() { + "use strict"; + init_config(); + init_defaultConfig(); + init_utils2(); + init_commonDb(); + defaultOptions = { + showLegend: true, + ticks: 5, + max: null, + min: 0, + graticule: "circle" + }; + defaultRadarData = { + axes: [], + curves: [], + options: defaultOptions + }; + data4 = structuredClone(defaultRadarData); + DEFAULT_RADAR_CONFIG = defaultConfig_default.radar; + getConfig5 = /* @__PURE__ */ __name(() => { + const config5 = cleanAndMerge({ + ...DEFAULT_RADAR_CONFIG, + ...getConfig().radar + }); + return config5; + }, "getConfig"); + getAxes = /* @__PURE__ */ __name(() => data4.axes, "getAxes"); + getCurves = /* @__PURE__ */ __name(() => data4.curves, "getCurves"); + getOptions2 = /* @__PURE__ */ __name(() => data4.options, "getOptions"); + setAxes = /* @__PURE__ */ __name((axes) => { + data4.axes = axes.map((axis2) => { + return { + name: axis2.name, + label: axis2.label ?? axis2.name + }; + }); + }, "setAxes"); + setCurves = /* @__PURE__ */ __name((curves) => { + data4.curves = curves.map((curve) => { + return { + name: curve.name, + label: curve.label ?? curve.name, + entries: computeCurveEntries(curve.entries) + }; + }); + }, "setCurves"); + computeCurveEntries = /* @__PURE__ */ __name((entries2) => { + if (entries2[0].axis == void 0) { + return entries2.map((entry) => entry.value); + } + const axes = getAxes(); + if (axes.length === 0) { + throw new Error("Axes must be populated before curves for reference entries"); + } + return axes.map((axis2) => { + const entry = entries2.find((entry2) => entry2.axis?.$refText === axis2.name); + if (entry === void 0) { + throw new Error("Missing entry for axis " + axis2.label); + } + return entry.value; + }); + }, "computeCurveEntries"); + setOptions7 = /* @__PURE__ */ __name((options2) => { + const optionMap = options2.reduce( + (acc, option2) => { + acc[option2.name] = option2; + return acc; + }, + {} + ); + data4.options = { + showLegend: optionMap.showLegend?.value ?? defaultOptions.showLegend, + ticks: optionMap.ticks?.value ?? defaultOptions.ticks, + max: optionMap.max?.value ?? defaultOptions.max, + min: optionMap.min?.value ?? defaultOptions.min, + graticule: optionMap.graticule?.value ?? defaultOptions.graticule + }; + }, "setOptions"); + clear17 = /* @__PURE__ */ __name(() => { + clear(); + data4 = structuredClone(defaultRadarData); + }, "clear"); + db5 = { + getAxes, + getCurves, + getOptions: getOptions2, + setAxes, + setCurves, + setOptions: setOptions7, + getConfig: getConfig5, + clear: clear17, + setAccTitle, + getAccTitle, + setDiagramTitle, + getDiagramTitle, + getAccDescription, + setAccDescription + }; + } + }); + + // src/diagrams/radar/parser.ts + var populate17, parser20; + var init_parser2 = __esm({ + "src/diagrams/radar/parser.ts"() { + "use strict"; + init_mermaid_parser_core(); + init_logger(); + init_populateCommonDb(); + init_db2(); + populate17 = /* @__PURE__ */ __name((ast) => { + populateCommonDb(ast, db5); + const { axes, curves, options: options2 } = ast; + db5.setAxes(axes); + db5.setCurves(curves); + db5.setOptions(options2); + }, "populate"); + parser20 = { + parse: /* @__PURE__ */ __name(async (input) => { + const ast = await parse3("radar", input); + log.debug(ast); + populate17(ast); + }, "parse") + }; + } + }); + + // src/diagrams/radar/renderer.ts + function drawCurves(g2, axes, curves, minValue, maxValue, graticule, config5) { + const numAxes = axes.length; + const radius2 = Math.min(config5.width, config5.height) / 2; + curves.forEach((curve, index) => { + if (curve.entries.length !== numAxes) { + return; + } + const points = curve.entries.map((entry, i2) => { + const angle2 = 2 * Math.PI * i2 / numAxes - Math.PI / 2; + const r2 = relativeRadius(entry, minValue, maxValue, radius2); + const x5 = r2 * Math.cos(angle2); + const y6 = r2 * Math.sin(angle2); + return { x: x5, y: y6 }; + }); + if (graticule === "circle") { + g2.append("path").attr("d", closedRoundCurve(points, config5.curveTension)).attr("class", `radarCurve-${index}`); + } else if (graticule === "polygon") { + g2.append("polygon").attr("points", points.map((p3) => `${p3.x},${p3.y}`).join(" ")).attr("class", `radarCurve-${index}`); + } + }); + } + function relativeRadius(value2, minValue, maxValue, radius2) { + const clippedValue = Math.min(Math.max(value2, minValue), maxValue); + return radius2 * (clippedValue - minValue) / (maxValue - minValue); + } + function closedRoundCurve(points, tension) { + const numPoints = points.length; + let d3 = `M${points[0].x},${points[0].y}`; + for (let i2 = 0; i2 < numPoints; i2++) { + const p0 = points[(i2 - 1 + numPoints) % numPoints]; + const p1 = points[i2]; + const p22 = points[(i2 + 1) % numPoints]; + const p3 = points[(i2 + 2) % numPoints]; + const cp1 = { + x: p1.x + (p22.x - p0.x) * tension, + y: p1.y + (p22.y - p0.y) * tension + }; + const cp2 = { + x: p22.x - (p3.x - p1.x) * tension, + y: p22.y - (p3.y - p1.y) * tension + }; + d3 += ` C${cp1.x},${cp1.y} ${cp2.x},${cp2.y} ${p22.x},${p22.y}`; + } + return `${d3} Z`; + } + function drawLegend(g2, curves, showLegend, config5) { + if (!showLegend) { + return; + } + const legendX = (config5.width / 2 + config5.marginRight) * 3 / 4; + const legendY = -(config5.height / 2 + config5.marginTop) * 3 / 4; + const lineHeight = 20; + curves.forEach((curve, index) => { + const itemGroup = g2.append("g").attr("transform", `translate(${legendX}, ${legendY + index * lineHeight})`); + itemGroup.append("rect").attr("width", 12).attr("height", 12).attr("class", `radarLegendBox-${index}`); + itemGroup.append("text").attr("x", 16).attr("y", 0).attr("class", "radarLegendText").text(curve.label); + }); + } + var draw23, drawFrame, drawGraticule, drawAxes2, renderer7; + var init_renderer2 = __esm({ + "src/diagrams/radar/renderer.ts"() { + "use strict"; + init_selectSvgElement(); + init_setupGraphViewbox(); + draw23 = /* @__PURE__ */ __name((_text, id35, _version, diagram32) => { + const db10 = diagram32.db; + const axes = db10.getAxes(); + const curves = db10.getCurves(); + const options2 = db10.getOptions(); + const config5 = db10.getConfig(); + const title2 = db10.getDiagramTitle(); + const svg2 = selectSvgElement(id35); + const g2 = drawFrame(svg2, config5); + const maxValue = options2.max ?? Math.max(...curves.map((curve) => Math.max(...curve.entries))); + const minValue = options2.min; + const radius2 = Math.min(config5.width, config5.height) / 2; + drawGraticule(g2, axes, radius2, options2.ticks, options2.graticule); + drawAxes2(g2, axes, radius2, config5); + drawCurves(g2, axes, curves, minValue, maxValue, options2.graticule, config5); + drawLegend(g2, curves, options2.showLegend, config5); + g2.append("text").attr("class", "radarTitle").text(title2).attr("x", 0).attr("y", -config5.height / 2 - config5.marginTop); + }, "draw"); + drawFrame = /* @__PURE__ */ __name((svg2, config5) => { + const totalWidth = config5.width + config5.marginLeft + config5.marginRight; + const totalHeight = config5.height + config5.marginTop + config5.marginBottom; + const center4 = { + x: config5.marginLeft + config5.width / 2, + y: config5.marginTop + config5.height / 2 + }; + configureSvgSize(svg2, totalHeight, totalWidth, config5.useMaxWidth ?? true); + svg2.attr("viewBox", `0 0 ${totalWidth} ${totalHeight}`); + return svg2.append("g").attr("transform", `translate(${center4.x}, ${center4.y})`); + }, "drawFrame"); + drawGraticule = /* @__PURE__ */ __name((g2, axes, radius2, ticks2, graticule) => { + if (graticule === "circle") { + for (let i2 = 0; i2 < ticks2; i2++) { + const r2 = radius2 * (i2 + 1) / ticks2; + g2.append("circle").attr("r", r2).attr("class", "radarGraticule"); + } + } else if (graticule === "polygon") { + const numAxes = axes.length; + for (let i2 = 0; i2 < ticks2; i2++) { + const r2 = radius2 * (i2 + 1) / ticks2; + const points = axes.map((_3, j3) => { + const angle2 = 2 * j3 * Math.PI / numAxes - Math.PI / 2; + const x5 = r2 * Math.cos(angle2); + const y6 = r2 * Math.sin(angle2); + return `${x5},${y6}`; + }).join(" "); + g2.append("polygon").attr("points", points).attr("class", "radarGraticule"); + } + } + }, "drawGraticule"); + drawAxes2 = /* @__PURE__ */ __name((g2, axes, radius2, config5) => { + const numAxes = axes.length; + for (let i2 = 0; i2 < numAxes; i2++) { + const label = axes[i2].label; + const angle2 = 2 * i2 * Math.PI / numAxes - Math.PI / 2; + g2.append("line").attr("x1", 0).attr("y1", 0).attr("x2", radius2 * config5.axisScaleFactor * Math.cos(angle2)).attr("y2", radius2 * config5.axisScaleFactor * Math.sin(angle2)).attr("class", "radarAxisLine"); + g2.append("text").text(label).attr("x", radius2 * config5.axisLabelFactor * Math.cos(angle2)).attr("y", radius2 * config5.axisLabelFactor * Math.sin(angle2)).attr("class", "radarAxisLabel"); + } + }, "drawAxes"); + __name(drawCurves, "drawCurves"); + __name(relativeRadius, "relativeRadius"); + __name(closedRoundCurve, "closedRoundCurve"); + __name(drawLegend, "drawLegend"); + renderer7 = { draw: draw23 }; + } + }); + + // src/diagrams/radar/styles.ts + var genIndexStyles, buildRadarStyleOptions, styles3; + var init_styles17 = __esm({ + "src/diagrams/radar/styles.ts"() { + "use strict"; + init_utils2(); + init_theme_default(); + init_config(); + genIndexStyles = /* @__PURE__ */ __name((themeVariables, radarOptions) => { + let sections6 = ""; + for (let i2 = 0; i2 < themeVariables.THEME_COLOR_LIMIT; i2++) { + const indexColor = themeVariables[`cScale${i2}`]; + sections6 += ` + .radarCurve-${i2} { + color: ${indexColor}; + fill: ${indexColor}; + fill-opacity: ${radarOptions.curveOpacity}; + stroke: ${indexColor}; + stroke-width: ${radarOptions.curveStrokeWidth}; + } + .radarLegendBox-${i2} { + fill: ${indexColor}; + fill-opacity: ${radarOptions.curveOpacity}; + stroke: ${indexColor}; + } + `; + } + return sections6; + }, "genIndexStyles"); + buildRadarStyleOptions = /* @__PURE__ */ __name((radar2) => { + const defaultThemeVariables2 = getThemeVariables3(); + const currentConfig2 = getConfig(); + const themeVariables = cleanAndMerge(defaultThemeVariables2, currentConfig2.themeVariables); + const radarOptions = cleanAndMerge(themeVariables.radar, radar2); + return { themeVariables, radarOptions }; + }, "buildRadarStyleOptions"); + styles3 = /* @__PURE__ */ __name(({ radar: radar2 } = {}) => { + const { themeVariables, radarOptions } = buildRadarStyleOptions(radar2); + return ` + .radarTitle { + font-size: ${themeVariables.fontSize}; + color: ${themeVariables.titleColor}; + dominant-baseline: hanging; + text-anchor: middle; + } + .radarAxisLine { + stroke: ${radarOptions.axisColor}; + stroke-width: ${radarOptions.axisStrokeWidth}; + } + .radarAxisLabel { + dominant-baseline: middle; + text-anchor: middle; + font-size: ${radarOptions.axisLabelFontSize}px; + color: ${radarOptions.axisColor}; + } + .radarGraticule { + fill: ${radarOptions.graticuleColor}; + fill-opacity: ${radarOptions.graticuleOpacity}; + stroke: ${radarOptions.graticuleColor}; + stroke-width: ${radarOptions.graticuleStrokeWidth}; + } + .radarLegendText { + text-anchor: start; + font-size: ${radarOptions.legendFontSize}px; + dominant-baseline: hanging; + } + ${genIndexStyles(themeVariables, radarOptions)} + `; + }, "styles"); + } + }); + + // src/diagrams/radar/diagram.ts + var diagram_exports2 = {}; + __export(diagram_exports2, { + diagram: () => diagram23 + }); + var diagram23; + var init_diagram2 = __esm({ + "src/diagrams/radar/diagram.ts"() { + "use strict"; + init_db2(); + init_parser2(); + init_renderer2(); + init_styles17(); + diagram23 = { + parser: parser20, + db: db5, + renderer: renderer7, + styles: styles3 + }; + } + }); + + // src/diagrams/block/parser/block.jison + var parser21, block_default; + var init_block = __esm({ + "src/diagrams/block/parser/block.jison"() { + "use strict"; + parser21 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 15], $V1 = [1, 7], $V2 = [1, 13], $V3 = [1, 14], $V4 = [1, 19], $V5 = [1, 16], $V6 = [1, 17], $V7 = [1, 18], $V8 = [8, 30], $V9 = [8, 10, 21, 28, 29, 30, 31, 39, 43, 46], $Va = [1, 23], $Vb = [1, 24], $Vc = [8, 10, 15, 16, 21, 28, 29, 30, 31, 39, 43, 46], $Vd = [8, 10, 15, 16, 21, 27, 28, 29, 30, 31, 39, 43, 46], $Ve = [1, 49]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "spaceLines": 3, "SPACELINE": 4, "NL": 5, "separator": 6, "SPACE": 7, "EOF": 8, "start": 9, "BLOCK_DIAGRAM_KEY": 10, "document": 11, "stop": 12, "statement": 13, "link": 14, "LINK": 15, "START_LINK": 16, "LINK_LABEL": 17, "STR": 18, "nodeStatement": 19, "columnsStatement": 20, "SPACE_BLOCK": 21, "blockStatement": 22, "classDefStatement": 23, "cssClassStatement": 24, "styleStatement": 25, "node": 26, "SIZE": 27, "COLUMNS": 28, "id-block": 29, "end": 30, "NODE_ID": 31, "nodeShapeNLabel": 32, "dirList": 33, "DIR": 34, "NODE_DSTART": 35, "NODE_DEND": 36, "BLOCK_ARROW_START": 37, "BLOCK_ARROW_END": 38, "classDef": 39, "CLASSDEF_ID": 40, "CLASSDEF_STYLEOPTS": 41, "DEFAULT": 42, "class": 43, "CLASSENTITY_IDS": 44, "STYLECLASS": 45, "style": 46, "STYLE_ENTITY_IDS": 47, "STYLE_DEFINITION_DATA": 48, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "NODE_ID", 34: "DIR", 35: "NODE_DSTART", 36: "NODE_DEND", 37: "BLOCK_ARROW_START", 38: "BLOCK_ARROW_END", 39: "classDef", 40: "CLASSDEF_ID", 41: "CLASSDEF_STYLEOPTS", 42: "DEFAULT", 43: "class", 44: "CLASSENTITY_IDS", 45: "STYLECLASS", 46: "style", 47: "STYLE_ENTITY_IDS", 48: "STYLE_DEFINITION_DATA" }, + productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [33, 1], [33, 2], [32, 3], [32, 4], [23, 3], [23, 3], [24, 3], [25, 3]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 4: + yy.getLogger().debug("Rule: separator (NL) "); + break; + case 5: + yy.getLogger().debug("Rule: separator (Space) "); + break; + case 6: + yy.getLogger().debug("Rule: separator (EOF) "); + break; + case 7: + yy.getLogger().debug("Rule: hierarchy: ", $$[$0 - 1]); + yy.setHierarchy($$[$0 - 1]); + break; + case 8: + yy.getLogger().debug("Stop NL "); + break; + case 9: + yy.getLogger().debug("Stop EOF "); + break; + case 10: + yy.getLogger().debug("Stop NL2 "); + break; + case 11: + yy.getLogger().debug("Stop EOF2 "); + break; + case 12: + yy.getLogger().debug("Rule: statement: ", $$[$0]); + typeof $$[$0].length === "number" ? this.$ = $$[$0] : this.$ = [$$[$0]]; + break; + case 13: + yy.getLogger().debug("Rule: statement #2: ", $$[$0 - 1]); + this.$ = [$$[$0 - 1]].concat($$[$0]); + break; + case 14: + yy.getLogger().debug("Rule: link: ", $$[$0], yytext); + this.$ = { edgeTypeStr: $$[$0], label: "" }; + break; + case 15: + yy.getLogger().debug("Rule: LABEL link: ", $$[$0 - 3], $$[$0 - 1], $$[$0]); + this.$ = { edgeTypeStr: $$[$0], label: $$[$0 - 1] }; + break; + case 18: + const num = parseInt($$[$0]); + const spaceId = yy.generateId(); + this.$ = { id: spaceId, type: "space", label: "", width: num, children: [] }; + break; + case 23: + yy.getLogger().debug("Rule: (nodeStatement link node) ", $$[$0 - 2], $$[$0 - 1], $$[$0], " typestr: ", $$[$0 - 1].edgeTypeStr); + const edgeData2 = yy.edgeStrToEdgeData($$[$0 - 1].edgeTypeStr); + const startEdgeData = yy.edgeStrToEdgeStartData($$[$0 - 1].edgeTypeStr); + const lineThickness = yy.edgeStrToThickness($$[$0 - 1].edgeTypeStr); + const linePattern = yy.edgeStrToPattern($$[$0 - 1].edgeTypeStr); + this.$ = [ + { id: $$[$0 - 2].id, label: $$[$0 - 2].label, type: $$[$0 - 2].type, directions: $$[$0 - 2].directions }, + { id: $$[$0 - 2].id + "-" + $$[$0].id, start: $$[$0 - 2].id, end: $$[$0].id, label: $$[$0 - 1].label, type: "edge", thickness: lineThickness, pattern: linePattern, directions: $$[$0].directions, arrowTypeEnd: edgeData2, arrowTypeStart: startEdgeData }, + { id: $$[$0].id, label: $$[$0].label, type: yy.typeStr2Type($$[$0].typeStr), directions: $$[$0].directions } + ]; + break; + case 24: + yy.getLogger().debug("Rule: nodeStatement (abc88 node size) ", $$[$0 - 1], $$[$0]); + this.$ = { id: $$[$0 - 1].id, label: $$[$0 - 1].label, type: yy.typeStr2Type($$[$0 - 1].typeStr), directions: $$[$0 - 1].directions, widthInColumns: parseInt($$[$0], 10) }; + break; + case 25: + yy.getLogger().debug("Rule: nodeStatement (node) ", $$[$0]); + this.$ = { id: $$[$0].id, label: $$[$0].label, type: yy.typeStr2Type($$[$0].typeStr), directions: $$[$0].directions, widthInColumns: 1 }; + break; + case 26: + yy.getLogger().debug("APA123", this ? this : "na"); + yy.getLogger().debug("COLUMNS: ", $$[$0]); + this.$ = { type: "column-setting", columns: $$[$0] === "auto" ? -1 : parseInt($$[$0]) }; + break; + case 27: + yy.getLogger().debug("Rule: id-block statement : ", $$[$0 - 2], $$[$0 - 1]); + const id210 = yy.generateId(); + this.$ = { ...$$[$0 - 2], type: "composite", children: $$[$0 - 1] }; + break; + case 28: + yy.getLogger().debug("Rule: blockStatement : ", $$[$0 - 2], $$[$0 - 1], $$[$0]); + const id35 = yy.generateId(); + this.$ = { id: id35, type: "composite", label: "", children: $$[$0 - 1] }; + break; + case 29: + yy.getLogger().debug("Rule: node (NODE_ID separator): ", $$[$0]); + this.$ = { id: $$[$0] }; + break; + case 30: + yy.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", $$[$0 - 1], $$[$0]); + this.$ = { id: $$[$0 - 1], label: $$[$0].label, typeStr: $$[$0].typeStr, directions: $$[$0].directions }; + break; + case 31: + yy.getLogger().debug("Rule: dirList: ", $$[$0]); + this.$ = [$$[$0]]; + break; + case 32: + yy.getLogger().debug("Rule: dirList: ", $$[$0 - 1], $$[$0]); + this.$ = [$$[$0 - 1]].concat($$[$0]); + break; + case 33: + yy.getLogger().debug("Rule: nodeShapeNLabel: ", $$[$0 - 2], $$[$0 - 1], $$[$0]); + this.$ = { typeStr: $$[$0 - 2] + $$[$0], label: $$[$0 - 1] }; + break; + case 34: + yy.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", $$[$0 - 3], $$[$0 - 2], " #3:", $$[$0 - 1], $$[$0]); + this.$ = { typeStr: $$[$0 - 3] + $$[$0], label: $$[$0 - 2], directions: $$[$0 - 1] }; + break; + case 35: + case 36: + this.$ = { type: "classDef", id: $$[$0 - 1].trim(), css: $$[$0].trim() }; + break; + case 37: + this.$ = { type: "applyClass", id: $$[$0 - 1].trim(), styleClass: $$[$0].trim() }; + break; + case 38: + this.$ = { type: "applyStyles", id: $$[$0 - 1].trim(), stylesStr: $$[$0].trim() }; + break; + } + }, "anonymous"), + table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 10: $V0, 11: 3, 13: 4, 19: 5, 20: 6, 21: $V1, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V2, 29: $V3, 31: $V4, 39: $V5, 43: $V6, 46: $V7 }, { 8: [1, 20] }, o2($V8, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 10: $V0, 21: $V1, 28: $V2, 29: $V3, 31: $V4, 39: $V5, 43: $V6, 46: $V7 }), o2($V9, [2, 16], { 14: 22, 15: $Va, 16: $Vb }), o2($V9, [2, 17]), o2($V9, [2, 18]), o2($V9, [2, 19]), o2($V9, [2, 20]), o2($V9, [2, 21]), o2($V9, [2, 22]), o2($Vc, [2, 25], { 27: [1, 25] }), o2($V9, [2, 26]), { 19: 26, 26: 12, 31: $V4 }, { 10: $V0, 11: 27, 13: 4, 19: 5, 20: 6, 21: $V1, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V2, 29: $V3, 31: $V4, 39: $V5, 43: $V6, 46: $V7 }, { 40: [1, 28], 42: [1, 29] }, { 44: [1, 30] }, { 47: [1, 31] }, o2($Vd, [2, 29], { 32: 32, 35: [1, 33], 37: [1, 34] }), { 1: [2, 7] }, o2($V8, [2, 13]), { 26: 35, 31: $V4 }, { 31: [2, 14] }, { 17: [1, 36] }, o2($Vc, [2, 24]), { 10: $V0, 11: 37, 13: 4, 14: 22, 15: $Va, 16: $Vb, 19: 5, 20: 6, 21: $V1, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: $V2, 29: $V3, 31: $V4, 39: $V5, 43: $V6, 46: $V7 }, { 30: [1, 38] }, { 41: [1, 39] }, { 41: [1, 40] }, { 45: [1, 41] }, { 48: [1, 42] }, o2($Vd, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, o2($Vc, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, o2($V9, [2, 28]), o2($V9, [2, 35]), o2($V9, [2, 36]), o2($V9, [2, 37]), o2($V9, [2, 38]), { 36: [1, 47] }, { 33: 48, 34: $Ve }, { 15: [1, 50] }, o2($V9, [2, 27]), o2($Vd, [2, 33]), { 38: [1, 51] }, { 33: 52, 34: $Ve, 38: [2, 31] }, { 31: [2, 15] }, o2($Vd, [2, 34]), { 38: [2, 32] }], + defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: {}, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + yy.getLogger().debug("Found block-beta"); + return 10; + break; + case 1: + yy.getLogger().debug("Found id-block"); + return 29; + break; + case 2: + yy.getLogger().debug("Found block"); + return 10; + break; + case 3: + yy.getLogger().debug(".", yy_.yytext); + break; + case 4: + yy.getLogger().debug("_", yy_.yytext); + break; + case 5: + return 5; + break; + case 6: + yy_.yytext = -1; + return 28; + break; + case 7: + yy_.yytext = yy_.yytext.replace(/columns\s+/, ""); + yy.getLogger().debug("COLUMNS (LEX)", yy_.yytext); + return 28; + break; + case 8: + this.pushState("md_string"); + break; + case 9: + return "MD_STR"; + break; + case 10: + this.popState(); + break; + case 11: + this.pushState("string"); + break; + case 12: + yy.getLogger().debug("LEX: POPPING STR:", yy_.yytext); + this.popState(); + break; + case 13: + yy.getLogger().debug("LEX: STR end:", yy_.yytext); + return "STR"; + break; + case 14: + yy_.yytext = yy_.yytext.replace(/space\:/, ""); + yy.getLogger().debug("SPACE NUM (LEX)", yy_.yytext); + return 21; + break; + case 15: + yy_.yytext = "1"; + yy.getLogger().debug("COLUMNS (LEX)", yy_.yytext); + return 21; + break; + case 16: + return 42; + break; + case 17: + return "LINKSTYLE"; + break; + case 18: + return "INTERPOLATE"; + break; + case 19: + this.pushState("CLASSDEF"); + return 39; + break; + case 20: + this.popState(); + this.pushState("CLASSDEFID"); + return "DEFAULT_CLASSDEF_ID"; + break; + case 21: + this.popState(); + this.pushState("CLASSDEFID"); + return 40; + break; + case 22: + this.popState(); + return 41; + break; + case 23: + this.pushState("CLASS"); + return 43; + break; + case 24: + this.popState(); + this.pushState("CLASS_STYLE"); + return 44; + break; + case 25: + this.popState(); + return 45; + break; + case 26: + this.pushState("STYLE_STMNT"); + return 46; + break; + case 27: + this.popState(); + this.pushState("STYLE_DEFINITION"); + return 47; + break; + case 28: + this.popState(); + return 48; + break; + case 29: + this.pushState("acc_title"); + return "acc_title"; + break; + case 30: + this.popState(); + return "acc_title_value"; + break; + case 31: + this.pushState("acc_descr"); + return "acc_descr"; + break; + case 32: + this.popState(); + return "acc_descr_value"; + break; + case 33: + this.pushState("acc_descr_multiline"); + break; + case 34: + this.popState(); + break; + case 35: + return "acc_descr_multiline_value"; + break; + case 36: + return 30; + break; + case 37: + this.popState(); + yy.getLogger().debug("Lex: (("); + return "NODE_DEND"; + break; + case 38: + this.popState(); + yy.getLogger().debug("Lex: (("); + return "NODE_DEND"; + break; + case 39: + this.popState(); + yy.getLogger().debug("Lex: ))"); + return "NODE_DEND"; + break; + case 40: + this.popState(); + yy.getLogger().debug("Lex: (("); + return "NODE_DEND"; + break; + case 41: + this.popState(); + yy.getLogger().debug("Lex: (("); + return "NODE_DEND"; + break; + case 42: + this.popState(); + yy.getLogger().debug("Lex: (-"); + return "NODE_DEND"; + break; + case 43: + this.popState(); + yy.getLogger().debug("Lex: -)"); + return "NODE_DEND"; + break; + case 44: + this.popState(); + yy.getLogger().debug("Lex: (("); + return "NODE_DEND"; + break; + case 45: + this.popState(); + yy.getLogger().debug("Lex: ]]"); + return "NODE_DEND"; + break; + case 46: + this.popState(); + yy.getLogger().debug("Lex: ("); + return "NODE_DEND"; + break; + case 47: + this.popState(); + yy.getLogger().debug("Lex: ])"); + return "NODE_DEND"; + break; + case 48: + this.popState(); + yy.getLogger().debug("Lex: /]"); + return "NODE_DEND"; + break; + case 49: + this.popState(); + yy.getLogger().debug("Lex: /]"); + return "NODE_DEND"; + break; + case 50: + this.popState(); + yy.getLogger().debug("Lex: )]"); + return "NODE_DEND"; + break; + case 51: + this.popState(); + yy.getLogger().debug("Lex: )"); + return "NODE_DEND"; + break; + case 52: + this.popState(); + yy.getLogger().debug("Lex: ]>"); + return "NODE_DEND"; + break; + case 53: + this.popState(); + yy.getLogger().debug("Lex: ]"); + return "NODE_DEND"; + break; + case 54: + yy.getLogger().debug("Lexa: -)"); + this.pushState("NODE"); + return 35; + break; + case 55: + yy.getLogger().debug("Lexa: (-"); + this.pushState("NODE"); + return 35; + break; + case 56: + yy.getLogger().debug("Lexa: ))"); + this.pushState("NODE"); + return 35; + break; + case 57: + yy.getLogger().debug("Lexa: )"); + this.pushState("NODE"); + return 35; + break; + case 58: + yy.getLogger().debug("Lex: ((("); + this.pushState("NODE"); + return 35; + break; + case 59: + yy.getLogger().debug("Lexa: )"); + this.pushState("NODE"); + return 35; + break; + case 60: + yy.getLogger().debug("Lexa: )"); + this.pushState("NODE"); + return 35; + break; + case 61: + yy.getLogger().debug("Lexa: )"); + this.pushState("NODE"); + return 35; + break; + case 62: + yy.getLogger().debug("Lexc: >"); + this.pushState("NODE"); + return 35; + break; + case 63: + yy.getLogger().debug("Lexa: (["); + this.pushState("NODE"); + return 35; + break; + case 64: + yy.getLogger().debug("Lexa: )"); + this.pushState("NODE"); + return 35; + break; + case 65: + this.pushState("NODE"); + return 35; + break; + case 66: + this.pushState("NODE"); + return 35; + break; + case 67: + this.pushState("NODE"); + return 35; + break; + case 68: + this.pushState("NODE"); + return 35; + break; + case 69: + this.pushState("NODE"); + return 35; + break; + case 70: + this.pushState("NODE"); + return 35; + break; + case 71: + this.pushState("NODE"); + return 35; + break; + case 72: + yy.getLogger().debug("Lexa: ["); + this.pushState("NODE"); + return 35; + break; + case 73: + this.pushState("BLOCK_ARROW"); + yy.getLogger().debug("LEX ARR START"); + return 37; + break; + case 74: + yy.getLogger().debug("Lex: NODE_ID", yy_.yytext); + return 31; + break; + case 75: + yy.getLogger().debug("Lex: EOF", yy_.yytext); + return 8; + break; + case 76: + this.pushState("md_string"); + break; + case 77: + this.pushState("md_string"); + break; + case 78: + return "NODE_DESCR"; + break; + case 79: + this.popState(); + break; + case 80: + yy.getLogger().debug("Lex: Starting string"); + this.pushState("string"); + break; + case 81: + yy.getLogger().debug("LEX ARR: Starting string"); + this.pushState("string"); + break; + case 82: + yy.getLogger().debug("LEX: NODE_DESCR:", yy_.yytext); + return "NODE_DESCR"; + break; + case 83: + yy.getLogger().debug("LEX POPPING"); + this.popState(); + break; + case 84: + yy.getLogger().debug("Lex: =>BAE"); + this.pushState("ARROW_DIR"); + break; + case 85: + yy_.yytext = yy_.yytext.replace(/^,\s*/, ""); + yy.getLogger().debug("Lex (right): dir:", yy_.yytext); + return "DIR"; + break; + case 86: + yy_.yytext = yy_.yytext.replace(/^,\s*/, ""); + yy.getLogger().debug("Lex (left):", yy_.yytext); + return "DIR"; + break; + case 87: + yy_.yytext = yy_.yytext.replace(/^,\s*/, ""); + yy.getLogger().debug("Lex (x):", yy_.yytext); + return "DIR"; + break; + case 88: + yy_.yytext = yy_.yytext.replace(/^,\s*/, ""); + yy.getLogger().debug("Lex (y):", yy_.yytext); + return "DIR"; + break; + case 89: + yy_.yytext = yy_.yytext.replace(/^,\s*/, ""); + yy.getLogger().debug("Lex (up):", yy_.yytext); + return "DIR"; + break; + case 90: + yy_.yytext = yy_.yytext.replace(/^,\s*/, ""); + yy.getLogger().debug("Lex (down):", yy_.yytext); + return "DIR"; + break; + case 91: + yy_.yytext = "]>"; + yy.getLogger().debug("Lex (ARROW_DIR end):", yy_.yytext); + this.popState(); + this.popState(); + return "BLOCK_ARROW_END"; + break; + case 92: + yy.getLogger().debug("Lex: LINK", "#" + yy_.yytext + "#"); + return 15; + break; + case 93: + yy.getLogger().debug("Lex: LINK", yy_.yytext); + return 15; + break; + case 94: + yy.getLogger().debug("Lex: LINK", yy_.yytext); + return 15; + break; + case 95: + yy.getLogger().debug("Lex: LINK", yy_.yytext); + return 15; + break; + case 96: + yy.getLogger().debug("Lex: START_LINK", yy_.yytext); + this.pushState("LLABEL"); + return 16; + break; + case 97: + yy.getLogger().debug("Lex: START_LINK", yy_.yytext); + this.pushState("LLABEL"); + return 16; + break; + case 98: + yy.getLogger().debug("Lex: START_LINK", yy_.yytext); + this.pushState("LLABEL"); + return 16; + break; + case 99: + this.pushState("md_string"); + break; + case 100: + yy.getLogger().debug("Lex: Starting string"); + this.pushState("string"); + return "LINK_LABEL"; + break; + case 101: + this.popState(); + yy.getLogger().debug("Lex: LINK", "#" + yy_.yytext + "#"); + return 15; + break; + case 102: + this.popState(); + yy.getLogger().debug("Lex: LINK", yy_.yytext); + return 15; + break; + case 103: + this.popState(); + yy.getLogger().debug("Lex: LINK", yy_.yytext); + return 15; + break; + case 104: + yy.getLogger().debug("Lex: COLON", yy_.yytext); + yy_.yytext = yy_.yytext.slice(1); + return 27; + break; + } + }, "anonymous"), + rules: [/^(?:block-beta\b)/, /^(?:block:)/, /^(?:block\b)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/], + conditions: { "STYLE_DEFINITION": { "rules": [28], "inclusive": false }, "STYLE_STMNT": { "rules": [27], "inclusive": false }, "CLASSDEFID": { "rules": [22], "inclusive": false }, "CLASSDEF": { "rules": [20, 21], "inclusive": false }, "CLASS_STYLE": { "rules": [25], "inclusive": false }, "CLASS": { "rules": [24], "inclusive": false }, "LLABEL": { "rules": [99, 100, 101, 102, 103], "inclusive": false }, "ARROW_DIR": { "rules": [85, 86, 87, 88, 89, 90, 91], "inclusive": false }, "BLOCK_ARROW": { "rules": [76, 81, 84], "inclusive": false }, "NODE": { "rules": [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 77, 80], "inclusive": false }, "md_string": { "rules": [9, 10, 78, 79], "inclusive": false }, "space": { "rules": [], "inclusive": false }, "string": { "rules": [12, 13, 82, 83], "inclusive": false }, "acc_descr_multiline": { "rules": [34, 35], "inclusive": false }, "acc_descr": { "rules": [32], "inclusive": false }, "acc_title": { "rules": [30], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 14, 15, 16, 17, 18, 19, 23, 26, 29, 31, 33, 36, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 92, 93, 94, 95, 96, 97, 98, 104], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser21.parser = parser21; + block_default = parser21; + } + }); + + // src/diagrams/block/blockDB.ts + function typeStr2Type(typeStr) { + log.debug("typeStr2Type", typeStr); + switch (typeStr) { + case "[]": + return "square"; + case "()": + log.debug("we have a round"); + return "round"; + case "(())": + return "circle"; + case ">]": + return "rect_left_inv_arrow"; + case "{}": + return "diamond"; + case "{{}}": + return "hexagon"; + case "([])": + return "stadium"; + case "[[]]": + return "subroutine"; + case "[()]": + return "cylinder"; + case "((()))": + return "doublecircle"; + case "[//]": + return "lean_right"; + case "[\\\\]": + return "lean_left"; + case "[/\\]": + return "trapezoid"; + case "[\\/]": + return "inv_trapezoid"; + case "<[]>": + return "block_arrow"; + default: + return "na"; + } + } + function edgeTypeStr2Type(typeStr) { + log.debug("typeStr2Type", typeStr); + switch (typeStr) { + case "==": + return "thick"; + default: + return "normal"; + } + } + function edgeStrToEdgeData(typeStr) { + const lastChar = typeStr.trim().slice(-1); + switch (lastChar) { + case "x": + return "arrow_cross"; + case "o": + return "arrow_circle"; + case ">": + return "arrow_point"; + default: + return ""; + } + } + function edgeStrToEdgeStartData(typeStr) { + const firstChar = typeStr.trim().charAt(0); + switch (firstChar) { + case "x": + return "arrow_cross"; + case "o": + return "arrow_circle"; + case "<": + return "arrow_point"; + default: + return "arrow_open"; + } + } + function edgeStrToThickness(typeStr) { + return typeStr.includes("==") ? "thick" : "normal"; + } + function edgeStrToPattern(typeStr) { + if (typeStr.includes(".-")) { + return "dotted"; + } + return "solid"; + } + var blockDatabase, edgeList, edgeCount2, COLOR_KEYWORD, FILL_KEYWORD, BG_FILL, STYLECLASS_SEP, config4, classes2, diagramId2, sanitizeText5, addStyleClass, addStyle2Node, setCssClass, populateBlockDatabase, blocks, rootBlock, clear18, cnt3, generateId2, setHierarchy, getColumns, getBlocksFlat, getBlocks, getEdges, getBlock, setBlock, setDiagramId2, getDiagramId, getLogger2, getClasses4, db6, blockDB_default; + var init_blockDB = __esm({ + "src/diagrams/block/blockDB.ts"() { + "use strict"; + init_compat(); + init_config(); + init_diagramAPI(); + init_logger(); + init_common(); + init_commonDb(); + blockDatabase = /* @__PURE__ */ new Map(); + edgeList = []; + edgeCount2 = /* @__PURE__ */ new Map(); + COLOR_KEYWORD = "color"; + FILL_KEYWORD = "fill"; + BG_FILL = "bgFill"; + STYLECLASS_SEP = ","; + config4 = getConfig2(); + classes2 = /* @__PURE__ */ new Map(); + diagramId2 = ""; + sanitizeText5 = /* @__PURE__ */ __name((txt) => common_default.sanitizeText(txt, config4), "sanitizeText"); + addStyleClass = /* @__PURE__ */ __name(function(id35, styleAttributes = "") { + let foundClass = classes2.get(id35); + if (!foundClass) { + foundClass = { id: id35, styles: [], textStyles: [] }; + classes2.set(id35, foundClass); + } + if (styleAttributes !== void 0 && styleAttributes !== null) { + styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => { + const fixedAttrib = attrib.replace(/([^;]*);/, "$1").trim(); + if (RegExp(COLOR_KEYWORD).exec(attrib)) { + const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL); + const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD); + foundClass.textStyles.push(newStyle2); + } + foundClass.styles.push(fixedAttrib); + }); + } + }, "addStyleClass"); + addStyle2Node = /* @__PURE__ */ __name(function(id35, styles6 = "") { + const foundBlock = blockDatabase.get(id35); + if (styles6 !== void 0 && styles6 !== null) { + foundBlock.styles = styles6.split(STYLECLASS_SEP); + } + }, "addStyle2Node"); + setCssClass = /* @__PURE__ */ __name(function(itemIds, cssClassName) { + itemIds.split(",").forEach(function(id35) { + let foundBlock = blockDatabase.get(id35); + if (foundBlock === void 0) { + const trimmedId = id35.trim(); + foundBlock = { id: trimmedId, type: "na", children: [] }; + blockDatabase.set(trimmedId, foundBlock); + } + if (!foundBlock.classes) { + foundBlock.classes = []; + } + foundBlock.classes.push(cssClassName); + }); + }, "setCssClass"); + populateBlockDatabase = /* @__PURE__ */ __name((_blockList, parent4) => { + const blockList = _blockList.flat(); + const children2 = []; + const columnSettingBlock = blockList.find((b3) => b3?.type === "column-setting"); + const column2 = columnSettingBlock?.columns ?? -1; + for (const block2 of blockList) { + if (typeof column2 === "number" && column2 > 0 && block2.type !== "column-setting" && typeof block2.widthInColumns === "number" && block2.widthInColumns > column2) { + log.warn( + `Block ${block2.id} width ${block2.widthInColumns} exceeds configured column width ${column2}` + ); + } + if (block2.label) { + block2.label = sanitizeText5(block2.label); + } + if (block2.type === "classDef") { + addStyleClass(block2.id, block2.css); + continue; + } + if (block2.type === "applyClass") { + setCssClass(block2.id, block2?.styleClass ?? ""); + continue; + } + if (block2.type === "applyStyles") { + if (block2?.stylesStr) { + addStyle2Node(block2.id, block2?.stylesStr); + } + continue; + } + if (block2.type === "column-setting") { + parent4.columns = block2.columns ?? -1; + } else if (block2.type === "edge") { + const count2 = (edgeCount2.get(block2.id) ?? 0) + 1; + edgeCount2.set(block2.id, count2); + block2.id = count2 + "-" + block2.id; + edgeList.push(block2); + } else { + if (!block2.label) { + if (block2.type === "composite") { + block2.label = ""; + } else { + block2.label = block2.id; + } + } + const existingBlock = blockDatabase.get(block2.id); + if (existingBlock === void 0) { + blockDatabase.set(block2.id, block2); + } else { + if (block2.type !== "na") { + existingBlock.type = block2.type; + } + if (block2.label !== block2.id) { + existingBlock.label = block2.label; + } + } + if (block2.children) { + populateBlockDatabase(block2.children, block2); + } + if (block2.type === "space") { + const w4 = block2.width ?? 1; + for (let j3 = 0; j3 < w4; j3++) { + const newBlock = clone2(block2); + newBlock.id = newBlock.id + "-" + j3; + blockDatabase.set(newBlock.id, newBlock); + children2.push(newBlock); + } + } else if (existingBlock === void 0) { + children2.push(block2); + } + } + } + parent4.children = children2; + }, "populateBlockDatabase"); + blocks = []; + rootBlock = { id: "root", type: "composite", children: [], columns: -1 }; + clear18 = /* @__PURE__ */ __name(() => { + log.debug("Clear called"); + clear(); + rootBlock = { id: "root", type: "composite", children: [], columns: -1 }; + blockDatabase = /* @__PURE__ */ new Map([["root", rootBlock]]); + blocks = []; + classes2 = /* @__PURE__ */ new Map(); + edgeList = []; + edgeCount2 = /* @__PURE__ */ new Map(); + diagramId2 = ""; + }, "clear"); + __name(typeStr2Type, "typeStr2Type"); + __name(edgeTypeStr2Type, "edgeTypeStr2Type"); + __name(edgeStrToEdgeData, "edgeStrToEdgeData"); + __name(edgeStrToEdgeStartData, "edgeStrToEdgeStartData"); + __name(edgeStrToThickness, "edgeStrToThickness"); + __name(edgeStrToPattern, "edgeStrToPattern"); + cnt3 = 0; + generateId2 = /* @__PURE__ */ __name(() => { + cnt3++; + return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt3; + }, "generateId"); + setHierarchy = /* @__PURE__ */ __name((block2) => { + rootBlock.children = block2; + populateBlockDatabase(block2, rootBlock); + blocks = rootBlock.children; + }, "setHierarchy"); + getColumns = /* @__PURE__ */ __name((blockId) => { + const block2 = blockDatabase.get(blockId); + if (!block2) { + return -1; + } + if (block2.columns) { + return block2.columns; + } + if (!block2.children) { + return -1; + } + return block2.children.length; + }, "getColumns"); + getBlocksFlat = /* @__PURE__ */ __name(() => { + return [...blockDatabase.values()]; + }, "getBlocksFlat"); + getBlocks = /* @__PURE__ */ __name(() => { + return blocks || []; + }, "getBlocks"); + getEdges = /* @__PURE__ */ __name(() => { + return edgeList; + }, "getEdges"); + getBlock = /* @__PURE__ */ __name((id35) => { + return blockDatabase.get(id35); + }, "getBlock"); + setBlock = /* @__PURE__ */ __name((block2) => { + blockDatabase.set(block2.id, block2); + }, "setBlock"); + setDiagramId2 = /* @__PURE__ */ __name((id35) => { + diagramId2 = id35; + }, "setDiagramId"); + getDiagramId = /* @__PURE__ */ __name(() => diagramId2, "getDiagramId"); + getLogger2 = /* @__PURE__ */ __name(() => log, "getLogger"); + getClasses4 = /* @__PURE__ */ __name(function() { + return classes2; + }, "getClasses"); + db6 = { + getConfig: /* @__PURE__ */ __name(() => getConfig().block, "getConfig"), + typeStr2Type, + edgeTypeStr2Type, + edgeStrToEdgeData, + edgeStrToEdgeStartData, + edgeStrToThickness, + edgeStrToPattern, + getLogger: getLogger2, + getBlocksFlat, + getBlocks, + getEdges, + setHierarchy, + getBlock, + setBlock, + getColumns, + getClasses: getClasses4, + clear: clear18, + generateId: generateId2, + setDiagramId: setDiagramId2, + getDiagramId + }; + blockDB_default = db6; + } + }); + + // src/diagrams/block/styles.ts + var fade3, getStyles17, styles_default16; + var init_styles18 = __esm({ + "src/diagrams/block/styles.ts"() { + "use strict"; + init_dist(); + init_globalStyles(); + fade3 = /* @__PURE__ */ __name((color2, opacity) => { + const channel2 = channel_default2; + const r2 = channel2(color2, "r"); + const g2 = channel2(color2, "g"); + const b3 = channel2(color2, "b"); + return rgba_default(r2, g2, b3, opacity); + }, "fade"); + getStyles17 = /* @__PURE__ */ __name((options2) => `.label { + font-family: ${options2.fontFamily}; + color: ${options2.nodeTextColor || options2.textColor}; + } + .cluster-label text { + fill: ${options2.titleColor}; + } + .cluster-label span,p { + color: ${options2.titleColor}; + } + + + + .label text,span,p { + fill: ${options2.nodeTextColor || options2.textColor}; + color: ${options2.nodeTextColor || options2.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${options2.mainBkg}; + stroke: ${options2.nodeBorder}; + stroke-width: 1px; + } + .flowchart-label text { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${options2.arrowheadColor}; + } + + .edgePath .path { + stroke: ${options2.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${options2.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${options2.edgeLabelBackground}; + /* + * This is for backward compatibility with existing code that didn't + * add a \`

    \` around edge labels. + * + * TODO: We should probably remove this in a future release. + */ + p { + margin: 0; + padding: 0; + display: inline; + } + rect { + opacity: 0.5; + background-color: ${options2.edgeLabelBackground}; + fill: ${options2.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${options2.edgeLabelBackground}; + } + + .node .cluster { + // fill: ${fade3(options2.mainBkg, 0.5)}; + fill: ${fade3(options2.clusterBkg, 0.5)}; + stroke: ${fade3(options2.clusterBorder, 0.2)}; + box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; + stroke-width: 1px; + } + + .cluster text { + fill: ${options2.titleColor}; + } + + .cluster span,p { + color: ${options2.titleColor}; + } + /* .cluster div { + color: ${options2.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${options2.fontFamily}; + font-size: 12px; + background: ${options2.tertiaryColor}; + border: 1px solid ${options2.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${options2.textColor}; + } + ${getIconStyles()} +`, "getStyles"); + styles_default16 = getStyles17; + } + }); + + // src/dagre-wrapper/markers.js + var insertMarkers3, extension4, composition2, aggregation2, dependency2, lollipop2, point7, circle4, cross2, barb2, markers2, markers_default2; + var init_markers2 = __esm({ + "src/dagre-wrapper/markers.js"() { + "use strict"; + init_logger(); + insertMarkers3 = /* @__PURE__ */ __name((elem, markerArray, type3, id35) => { + markerArray.forEach((markerName) => { + markers2[markerName](elem, type3, id35); + }); + }, "insertMarkers"); + extension4 = /* @__PURE__ */ __name((elem, type3, id35) => { + log.trace("Making markers for ", id35); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-extensionStart").attr("class", "marker extension " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-extensionEnd").attr("class", "marker extension " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"); + }, "extension"); + composition2 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-compositionStart").attr("class", "marker composition " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-compositionEnd").attr("class", "marker composition " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + }, "composition"); + aggregation2 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-aggregationStart").attr("class", "marker aggregation " + type3).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-aggregationEnd").attr("class", "marker aggregation " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); + }, "aggregation"); + dependency2 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-dependencyStart").attr("class", "marker dependency " + type3).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-dependencyEnd").attr("class", "marker dependency " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z"); + }, "dependency"); + lollipop2 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-lollipopStart").attr("class", "marker lollipop " + type3).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6); + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-lollipopEnd").attr("class", "marker lollipop " + type3).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6); + }, "lollipop"); + point7 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("marker").attr("id", id35 + "_" + type3 + "-pointEnd").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-pointStart").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); + }, "point"); + circle4 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("marker").attr("id", id35 + "_" + type3 + "-circleEnd").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-circleStart").attr("class", "marker " + type3).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); + }, "circle"); + cross2 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("marker").attr("id", id35 + "_" + type3 + "-crossEnd").attr("class", "marker cross " + type3).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"); + elem.append("marker").attr("id", id35 + "_" + type3 + "-crossStart").attr("class", "marker cross " + type3).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"); + }, "cross"); + barb2 = /* @__PURE__ */ __name((elem, type3, id35) => { + elem.append("defs").append("marker").attr("id", id35 + "_" + type3 + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z"); + }, "barb"); + markers2 = { + extension: extension4, + composition: composition2, + aggregation: aggregation2, + dependency: dependency2, + lollipop: lollipop2, + point: point7, + circle: circle4, + cross: cross2, + barb: barb2 + }; + markers_default2 = insertMarkers3; + } + }); + + // src/diagrams/block/layout.ts + function calculateBlockPosition(columns, position5) { + if (columns === 0 || !Number.isInteger(columns)) { + throw new Error("Columns must be an integer !== 0."); + } + if (position5 < 0 || !Number.isInteger(position5)) { + throw new Error("Position must be a non-negative integer." + position5); + } + if (columns < 0) { + return { px: position5, py: 0 }; + } + if (columns === 1) { + return { px: 0, py: position5 }; + } + const px = position5 % columns; + const py = Math.floor(position5 / columns); + return { px, py }; + } + function setBlockSizes(block2, db10, siblingWidth = 0, siblingHeight = 0) { + log.debug( + "setBlockSizes abc95 (start)", + block2.id, + block2?.size?.x, + "block width =", + block2?.size, + "siblingWidth", + siblingWidth + ); + if (!block2?.size?.width) { + block2.size = { + width: siblingWidth, + height: siblingHeight, + x: 0, + y: 0 + }; + } + let maxWidth2 = 0; + let maxHeight = 0; + if (block2.children?.length > 0) { + for (const child of block2.children) { + setBlockSizes(child, db10); + } + const childSize = getMaxChildSize(block2); + maxWidth2 = childSize.width; + maxHeight = childSize.height; + log.debug("setBlockSizes abc95 maxWidth of", block2.id, ":s children is ", maxWidth2, maxHeight); + for (const child of block2.children) { + if (child.size) { + log.debug( + `abc95 Setting size of children of ${block2.id} id=${child.id} ${maxWidth2} ${maxHeight} ${JSON.stringify(child.size)}` + ); + child.size.width = maxWidth2 * (child.widthInColumns ?? 1) + padding * ((child.widthInColumns ?? 1) - 1); + child.size.height = maxHeight; + child.size.x = 0; + child.size.y = 0; + log.debug( + `abc95 updating size of ${block2.id} children child:${child.id} maxWidth:${maxWidth2} maxHeight:${maxHeight}` + ); + } + } + for (const child of block2.children) { + setBlockSizes(child, db10, maxWidth2, maxHeight); + } + const columns = block2.columns ?? -1; + let numItems = 0; + for (const child of block2.children) { + numItems += child.widthInColumns ?? 1; + } + let xSize = block2.children.length; + if (columns > 0 && columns < numItems) { + xSize = columns; + } + const ySize = Math.ceil(numItems / xSize); + let width3 = xSize * (maxWidth2 + padding) + padding; + let height2 = ySize * (maxHeight + padding) + padding; + if (width3 < siblingWidth) { + log.debug( + `Detected to small sibling: abc95 ${block2.id} siblingWidth ${siblingWidth} siblingHeight ${siblingHeight} width ${width3}` + ); + width3 = siblingWidth; + height2 = siblingHeight; + const childWidth = (siblingWidth - xSize * padding - padding) / xSize; + const childHeight = (siblingHeight - ySize * padding - padding) / ySize; + log.debug("Size indata abc88", block2.id, "childWidth", childWidth, "maxWidth", maxWidth2); + log.debug("Size indata abc88", block2.id, "childHeight", childHeight, "maxHeight", maxHeight); + log.debug("Size indata abc88 xSize", xSize, "padding", padding); + for (const child of block2.children) { + if (child.size) { + child.size.width = childWidth; + child.size.height = childHeight; + child.size.x = 0; + child.size.y = 0; + } + } + } + log.debug( + `abc95 (finale calc) ${block2.id} xSize ${xSize} ySize ${ySize} columns ${columns}${block2.children.length} width=${Math.max(width3, block2.size?.width || 0)}` + ); + if (width3 < (block2?.size?.width || 0)) { + width3 = block2?.size?.width || 0; + const num = columns > 0 ? Math.min(block2.children.length, columns) : block2.children.length; + if (num > 0) { + const childWidth = (width3 - num * padding - padding) / num; + log.debug("abc95 (growing to fit) width", block2.id, width3, block2.size?.width, childWidth); + for (const child of block2.children) { + if (child.size) { + child.size.width = childWidth; + } + } + } + } + block2.size = { + width: width3, + height: height2, + x: 0, + y: 0 + }; + } + log.debug( + "setBlockSizes abc94 (done)", + block2.id, + block2?.size?.x, + block2?.size?.width, + block2?.size?.y, + block2?.size?.height + ); + } + function layoutBlocks(block2, db10) { + log.debug( + `abc85 layout blocks (=>layoutBlocks) ${block2.id} x: ${block2?.size?.x} y: ${block2?.size?.y} width: ${block2?.size?.width}` + ); + const columns = block2.columns ?? -1; + log.debug("layoutBlocks columns abc95", block2.id, "=>", columns, block2); + if (block2.children && // find max width of children + block2.children.length > 0) { + const width3 = block2?.children[0]?.size?.width ?? 0; + const widthOfChildren = block2.children.length * width3 + (block2.children.length - 1) * padding; + log.debug("widthOfChildren 88", widthOfChildren, "posX"); + const rowHeights = /* @__PURE__ */ new Map(); + { + let colPos = 0; + for (const child of block2.children) { + if (!child.size) { + continue; + } + const { py } = calculateBlockPosition(columns, colPos); + const currentMax = rowHeights.get(py) ?? 0; + if (child.size.height > currentMax) { + rowHeights.set(py, child.size.height); + } + let filled = child?.widthInColumns ?? 1; + if (columns > 0) { + filled = Math.min(filled, columns - colPos % columns); + } + colPos += filled; + } + } + const rowYOffsets = /* @__PURE__ */ new Map(); + { + let offset = 0; + const rows = [...rowHeights.keys()].sort((a2, b3) => a2 - b3); + for (const row of rows) { + rowYOffsets.set(row, offset); + offset += (rowHeights.get(row) ?? 0) + padding; + } + } + let columnPos = 0; + log.debug("abc91 block?.size?.x", block2.id, block2?.size?.x); + let startingPosX = block2?.size?.x ? block2?.size?.x + (-block2?.size?.width / 2 || 0) : -padding; + let rowPos = 0; + for (const child of block2.children) { + const parent4 = block2; + if (!child.size) { + continue; + } + const { width: width4, height: height2 } = child.size; + const { px, py } = calculateBlockPosition(columns, columnPos); + if (py != rowPos) { + rowPos = py; + startingPosX = block2?.size?.x ? block2?.size?.x + (-block2?.size?.width / 2 || 0) : -padding; + log.debug("New row in layout for block", block2.id, " and child ", child.id, rowPos); + } + log.debug( + `abc89 layout blocks (child) id: ${child.id} Pos: ${columnPos} (px, py) ${px},${py} (${parent4?.size?.x},${parent4?.size?.y}) parent: ${parent4.id} width: ${width4}${padding}` + ); + if (parent4.size) { + const halfWidth = width4 / 2; + child.size.x = startingPosX + padding + halfWidth; + log.debug( + `abc91 layout blocks (calc) px, pyid:${child.id} startingPos=X${startingPosX} new startingPosX${child.size.x} ${halfWidth} padding=${padding} width=${width4} halfWidth=${halfWidth} => x:${child.size.x} y:${child.size.y} ${child.widthInColumns} (width * (child?.w || 1)) / 2 ${width4 * (child?.widthInColumns ?? 1) / 2}` + ); + startingPosX = child.size.x + halfWidth; + const rowYOffset = rowYOffsets.get(py) ?? 0; + const rowHeight = rowHeights.get(py) ?? height2; + child.size.y = parent4.size.y - parent4.size.height / 2 + rowYOffset + rowHeight / 2 + padding; + log.debug( + `abc88 layout blocks (calc) px, pyid:${child.id}startingPosX${startingPosX}${padding}${halfWidth}=>x:${child.size.x}y:${child.size.y}${child.widthInColumns}(width * (child?.w || 1)) / 2${width4 * (child?.widthInColumns ?? 1) / 2}` + ); + } + if (child.children) { + layoutBlocks(child, db10); + } + let columnsFilled = child?.widthInColumns ?? 1; + if (columns > 0) { + columnsFilled = Math.min(columnsFilled, columns - columnPos % columns); + } + columnPos += columnsFilled; + log.debug("abc88 columnsPos", child, columnPos); + } + } + log.debug( + `layout blocks (<==layoutBlocks) ${block2.id} x: ${block2?.size?.x} y: ${block2?.size?.y} width: ${block2?.size?.width}` + ); + } + function findBounds(block2, { minX, minY, maxX, maxY } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) { + if (block2.size && block2.id !== "root") { + const { x: x5, y: y6, width: width3, height: height2 } = block2.size; + if (x5 - width3 / 2 < minX) { + minX = x5 - width3 / 2; + } + if (y6 - height2 / 2 < minY) { + minY = y6 - height2 / 2; + } + if (x5 + width3 / 2 > maxX) { + maxX = x5 + width3 / 2; + } + if (y6 + height2 / 2 > maxY) { + maxY = y6 + height2 / 2; + } + } + if (block2.children) { + for (const child of block2.children) { + ({ minX, minY, maxX, maxY } = findBounds(child, { minX, minY, maxX, maxY })); + } + } + return { minX, minY, maxX, maxY }; + } + function layout5(db10) { + const root4 = db10.getBlock("root"); + if (!root4) { + return; + } + setBlockSizes(root4, db10, 0, 0); + layoutBlocks(root4, db10); + log.debug("getBlocks", JSON.stringify(root4, null, 2)); + const { minX, minY, maxX, maxY } = findBounds(root4); + const height2 = maxY - minY; + const width3 = maxX - minX; + return { x: minX, y: minY, width: width3, height: height2 }; + } + var padding, getMaxChildSize; + var init_layout3 = __esm({ + "src/diagrams/block/layout.ts"() { + "use strict"; + init_logger(); + init_diagramAPI(); + padding = getConfig2()?.block?.padding ?? 8; + __name(calculateBlockPosition, "calculateBlockPosition"); + getMaxChildSize = /* @__PURE__ */ __name((block2) => { + let maxWidth2 = 0; + let maxHeight = 0; + for (const child of block2.children) { + const { width: width3, height: height2, x: x5, y: y6 } = child.size ?? { width: 0, height: 0, x: 0, y: 0 }; + log.debug( + "getMaxChildSize abc95 child:", + child.id, + "width:", + width3, + "height:", + height2, + "x:", + x5, + "y:", + y6, + child.type + ); + if (child.type === "space") { + continue; + } + const normalizedWidth = width3 / (child.widthInColumns ?? 1); + if (normalizedWidth > maxWidth2) { + maxWidth2 = normalizedWidth; + } + if (height2 > maxHeight) { + maxHeight = height2; + } + } + return { width: maxWidth2, height: maxHeight }; + }, "getMaxChildSize"); + __name(setBlockSizes, "setBlockSizes"); + __name(layoutBlocks, "layoutBlocks"); + __name(findBounds, "findBounds"); + __name(layout5, "layout"); + } + }); + + // src/dagre-wrapper/createLabel.js + var createLabel2, createLabel_default2; + var init_createLabel2 = __esm({ + "src/dagre-wrapper/createLabel.js"() { + "use strict"; + init_config(); + init_diagramAPI(); + init_createText(); + createLabel2 = /* @__PURE__ */ __name(async (element3, _vertexText, style3, isTitle = false, isNode2 = false) => { + let vertexText = _vertexText || ""; + if (typeof vertexText === "object") { + vertexText = vertexText[0]; + } + const config5 = getConfig2(); + const useHtmlLabels = getEffectiveHtmlLabels(config5); + return await createText( + element3, + vertexText, + { + style: style3, + isTitle, + useHtmlLabels, + markdown: false, + isNode: isNode2, + width: Number.POSITIVE_INFINITY + }, + config5 + ); + }, "createLabel"); + createLabel_default2 = createLabel2; + } + }); + + // src/dagre-wrapper/edgeMarker.ts + var addEdgeMarkers2, arrowTypesMap2, addEdgeMarker2; + var init_edgeMarker2 = __esm({ + "src/dagre-wrapper/edgeMarker.ts"() { + "use strict"; + init_logger(); + addEdgeMarkers2 = /* @__PURE__ */ __name((svgPath, edge, url, id35, diagramType) => { + if (edge.arrowTypeStart) { + addEdgeMarker2(svgPath, "start", edge.arrowTypeStart, url, id35, diagramType); + } + if (edge.arrowTypeEnd) { + addEdgeMarker2(svgPath, "end", edge.arrowTypeEnd, url, id35, diagramType); + } + }, "addEdgeMarkers"); + arrowTypesMap2 = { + arrow_cross: "cross", + arrow_point: "point", + arrow_barb: "barb", + arrow_circle: "circle", + aggregation: "aggregation", + extension: "extension", + composition: "composition", + dependency: "dependency", + lollipop: "lollipop" + }; + addEdgeMarker2 = /* @__PURE__ */ __name((svgPath, position5, arrowType, url, id35, diagramType) => { + const endMarkerType = arrowTypesMap2[arrowType]; + if (!endMarkerType) { + log.warn(`Unknown arrow type: ${arrowType}`); + return; + } + const suffix = position5 === "start" ? "Start" : "End"; + svgPath.attr(`marker-${position5}`, `url(${url}#${id35}_${diagramType}-${endMarkerType}${suffix})`); + }, "addEdgeMarker"); + } + }); + + // src/dagre-wrapper/edges.js + function setTerminalWidth2(fo, value2) { + if (getEffectiveHtmlLabels(getConfig2()) && fo) { + fo.style.width = value2.length * 9 + "px"; + fo.style.height = "12px"; + } + } + var edgeLabels2, terminalLabels2, insertEdgeLabel2, positionEdgeLabel2, outsideNode2, intersection3, cutPathAtIntersect2, insertEdge2; + var init_edges2 = __esm({ + "src/dagre-wrapper/edges.js"() { + "use strict"; + init_logger(); + init_createLabel2(); + init_createText(); + init_labelTransform(); + init_src32(); + init_diagramAPI(); + init_config(); + init_utils2(); + init_common(); + init_lineWithOffset(); + init_subGraphTitleMargins(); + init_edgeMarker2(); + edgeLabels2 = {}; + terminalLabels2 = {}; + insertEdgeLabel2 = /* @__PURE__ */ __name(async (elem, edge) => { + const config5 = getConfig2(); + const useHtmlLabels = getEffectiveHtmlLabels(config5); + const edgeLabel = elem.insert("g").attr("class", "edgeLabel"); + const label = edgeLabel.insert("g").attr("class", "label"); + const isMarkdown = edge.labelType === "markdown"; + const labelElement = await createText( + elem, + edge.label, + { + style: edge.labelStyle, + useHtmlLabels, + // TODO: The old code only set addSvgBackground when using markdown, but + // this function is only used by block diagrams which never use markdown. + addSvgBackground: isMarkdown, + isNode: false, + markdown: isMarkdown, + // If using markdown, wrap using default width + width: isMarkdown ? void 0 : Number.POSITIVE_INFINITY + }, + config5 + ); + label.node().appendChild(labelElement); + let bbox = labelElement.getBBox(); + let transformBbox = bbox; + if (useHtmlLabels) { + const div = labelElement.children[0]; + const dv = select_default2(labelElement); + bbox = div.getBoundingClientRect(); + transformBbox = bbox; + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } else { + const textEl = select_default2(labelElement).select("text").node(); + if (textEl && typeof textEl.getBBox === "function") { + transformBbox = textEl.getBBox(); + } + } + label.attr("transform", computeLabelTransform(transformBbox, useHtmlLabels)); + edgeLabels2[edge.id] = edgeLabel; + edge.width = bbox.width; + edge.height = bbox.height; + let fo; + if (edge.startLabelLeft) { + const startEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals"); + const inner2 = startEdgeLabelLeft.insert("g").attr("class", "inner"); + const startLabelElement = await createLabel_default2(inner2, edge.startLabelLeft, edge.labelStyle); + fo = startLabelElement; + let slBox = startLabelElement.getBBox(); + if (useHtmlLabels) { + const div = startLabelElement.children[0]; + const dv = select_default2(startLabelElement); + slBox = div.getBoundingClientRect(); + dv.attr("width", slBox.width); + dv.attr("height", slBox.height); + } + inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels)); + if (!terminalLabels2[edge.id]) { + terminalLabels2[edge.id] = {}; + } + terminalLabels2[edge.id].startLeft = startEdgeLabelLeft; + setTerminalWidth2(fo, edge.startLabelLeft); + } + if (edge.startLabelRight) { + const startEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals"); + const inner2 = startEdgeLabelRight.insert("g").attr("class", "inner"); + const startLabelElement = await createLabel_default2(inner2, edge.startLabelRight, edge.labelStyle); + fo = startLabelElement; + let slBox = startLabelElement.getBBox(); + if (useHtmlLabels) { + const div = startLabelElement.children[0]; + const dv = select_default2(startLabelElement); + slBox = div.getBoundingClientRect(); + dv.attr("width", slBox.width); + dv.attr("height", slBox.height); + } + inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels)); + if (!terminalLabels2[edge.id]) { + terminalLabels2[edge.id] = {}; + } + terminalLabels2[edge.id].startRight = startEdgeLabelRight; + setTerminalWidth2(fo, edge.startLabelRight); + } + if (edge.endLabelLeft) { + const endEdgeLabelLeft = elem.insert("g").attr("class", "edgeTerminals"); + const inner2 = endEdgeLabelLeft.insert("g").attr("class", "inner"); + const endLabelElement = await createLabel_default2(endEdgeLabelLeft, edge.endLabelLeft, edge.labelStyle); + fo = endLabelElement; + let slBox = endLabelElement.getBBox(); + if (useHtmlLabels) { + const div = endLabelElement.children[0]; + const dv = select_default2(endLabelElement); + slBox = div.getBoundingClientRect(); + dv.attr("width", slBox.width); + dv.attr("height", slBox.height); + } + inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels)); + if (!terminalLabels2[edge.id]) { + terminalLabels2[edge.id] = {}; + } + terminalLabels2[edge.id].endLeft = endEdgeLabelLeft; + setTerminalWidth2(fo, edge.endLabelLeft); + } + if (edge.endLabelRight) { + const endEdgeLabelRight = elem.insert("g").attr("class", "edgeTerminals"); + const inner2 = endEdgeLabelRight.insert("g").attr("class", "inner"); + const endLabelElement = await createLabel_default2( + endEdgeLabelRight, + edge.endLabelRight, + edge.labelStyle + ); + fo = endLabelElement; + let slBox = endLabelElement.getBBox(); + if (useHtmlLabels) { + const div = endLabelElement.children[0]; + const dv = select_default2(endLabelElement); + slBox = div.getBoundingClientRect(); + dv.attr("width", slBox.width); + dv.attr("height", slBox.height); + } + inner2.attr("transform", computeLabelTransform(slBox, useHtmlLabels)); + if (!terminalLabels2[edge.id]) { + terminalLabels2[edge.id] = {}; + } + terminalLabels2[edge.id].endRight = endEdgeLabelRight; + setTerminalWidth2(fo, edge.endLabelRight); + } + return labelElement; + }, "insertEdgeLabel"); + __name(setTerminalWidth2, "setTerminalWidth"); + positionEdgeLabel2 = /* @__PURE__ */ __name((edge, paths) => { + log.debug("Moving label abc88 ", edge.id, edge.label, edgeLabels2[edge.id], paths); + let path4 = paths.updatedPath ? paths.updatedPath : paths.originalPath; + const siteConfig2 = getConfig2(); + const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig2); + if (edge.label) { + const el = edgeLabels2[edge.id]; + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcLabelPosition(path4); + log.debug( + "Moving label " + edge.label + " from (", + x5, + ",", + y6, + ") to (", + pos.x, + ",", + pos.y, + ") abc88" + ); + if (paths.updatedPath) { + x5 = pos.x; + y6 = pos.y; + } + } + el.attr("transform", `translate(${x5}, ${y6 + subGraphTitleTotalMargin / 2})`); + } + if (edge.startLabelLeft) { + const el = terminalLabels2[edge.id].startLeft; + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, "start_left", path4); + x5 = pos.x; + y6 = pos.y; + } + el.attr("transform", `translate(${x5}, ${y6})`); + } + if (edge.startLabelRight) { + const el = terminalLabels2[edge.id].startRight; + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcTerminalLabelPosition( + edge.arrowTypeStart ? 10 : 0, + "start_right", + path4 + ); + x5 = pos.x; + y6 = pos.y; + } + el.attr("transform", `translate(${x5}, ${y6})`); + } + if (edge.endLabelLeft) { + const el = terminalLabels2[edge.id].endLeft; + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_left", path4); + x5 = pos.x; + y6 = pos.y; + } + el.attr("transform", `translate(${x5}, ${y6})`); + } + if (edge.endLabelRight) { + const el = terminalLabels2[edge.id].endRight; + let x5 = edge.x; + let y6 = edge.y; + if (path4) { + const pos = utils_default2.calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, "end_right", path4); + x5 = pos.x; + y6 = pos.y; + } + el.attr("transform", `translate(${x5}, ${y6})`); + } + }, "positionEdgeLabel"); + outsideNode2 = /* @__PURE__ */ __name((node2, point8) => { + const x5 = node2.x; + const y6 = node2.y; + const dx = Math.abs(point8.x - x5); + const dy = Math.abs(point8.y - y6); + const w4 = node2.width / 2; + const h3 = node2.height / 2; + if (dx >= w4 || dy >= h3) { + return true; + } + return false; + }, "outsideNode"); + intersection3 = /* @__PURE__ */ __name((node2, outsidePoint, insidePoint) => { + log.debug(`intersection calc abc89: + outsidePoint: ${JSON.stringify(outsidePoint)} + insidePoint : ${JSON.stringify(insidePoint)} + node : x:${node2.x} y:${node2.y} w:${node2.width} h:${node2.height}`); + const x5 = node2.x; + const y6 = node2.y; + const dx = Math.abs(x5 - insidePoint.x); + const w4 = node2.width / 2; + let r2 = insidePoint.x < outsidePoint.x ? w4 - dx : w4 + dx; + const h3 = node2.height / 2; + const Q3 = Math.abs(outsidePoint.y - insidePoint.y); + const R3 = Math.abs(outsidePoint.x - insidePoint.x); + if (Math.abs(y6 - outsidePoint.y) * w4 > Math.abs(x5 - outsidePoint.x) * h3) { + let q3 = insidePoint.y < outsidePoint.y ? outsidePoint.y - h3 - y6 : y6 - h3 - outsidePoint.y; + r2 = R3 * q3 / Q3; + const res = { + x: insidePoint.x < outsidePoint.x ? insidePoint.x + r2 : insidePoint.x - R3 + r2, + y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q3 - q3 : insidePoint.y - Q3 + q3 + }; + if (r2 === 0) { + res.x = outsidePoint.x; + res.y = outsidePoint.y; + } + if (R3 === 0) { + res.x = outsidePoint.x; + } + if (Q3 === 0) { + res.y = outsidePoint.y; + } + log.debug(`abc89 topp/bott calc, Q ${Q3}, q ${q3}, R ${R3}, r ${r2}`, res); + return res; + } else { + if (insidePoint.x < outsidePoint.x) { + r2 = outsidePoint.x - w4 - x5; + } else { + r2 = x5 - w4 - outsidePoint.x; + } + let q3 = Q3 * r2 / R3; + let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R3 - r2 : insidePoint.x - R3 + r2; + let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q3 : insidePoint.y - q3; + log.debug(`sides calc abc89, Q ${Q3}, q ${q3}, R ${R3}, r ${r2}`, { _x, _y }); + if (r2 === 0) { + _x = outsidePoint.x; + _y = outsidePoint.y; + } + if (R3 === 0) { + _x = outsidePoint.x; + } + if (Q3 === 0) { + _y = outsidePoint.y; + } + return { x: _x, y: _y }; + } + }, "intersection"); + cutPathAtIntersect2 = /* @__PURE__ */ __name((_points, boundaryNode) => { + log.debug("abc88 cutPathAtIntersect", _points, boundaryNode); + let points = []; + let lastPointOutside = _points[0]; + let isInside = false; + _points.forEach((point8) => { + if (!outsideNode2(boundaryNode, point8) && !isInside) { + const inter = intersection3(boundaryNode, lastPointOutside, point8); + let pointPresent = false; + points.forEach((p3) => { + pointPresent = pointPresent || p3.x === inter.x && p3.y === inter.y; + }); + if (!points.some((e3) => e3.x === inter.x && e3.y === inter.y)) { + points.push(inter); + } + isInside = true; + } else { + lastPointOutside = point8; + if (!isInside) { + points.push(point8); + } + } + }); + return points; + }, "cutPathAtIntersect"); + insertEdge2 = /* @__PURE__ */ __name(function(elem, e3, edge, clusterDb2, diagramType, graph, id35) { + let points = edge.points; + log.debug("abc88 InsertEdge: edge=", edge, "e=", e3); + let pointsHasChanged = false; + const tail = graph.node(e3.v); + var head2 = graph.node(e3.w); + if (head2?.intersect && tail?.intersect) { + points = points.slice(1, edge.points.length - 1); + points.unshift(tail.intersect(points[0])); + points.push(head2.intersect(points[points.length - 1])); + } + if (edge.toCluster) { + log.debug("to cluster abc88", clusterDb2[edge.toCluster]); + points = cutPathAtIntersect2(edge.points, clusterDb2[edge.toCluster].node); + pointsHasChanged = true; + } + if (edge.fromCluster) { + log.debug("from cluster abc88", clusterDb2[edge.fromCluster]); + points = cutPathAtIntersect2(points.reverse(), clusterDb2[edge.fromCluster].node).reverse(); + pointsHasChanged = true; + } + const lineData = points.filter((p3) => !Number.isNaN(p3.y)); + let curve = basis_default2; + if (edge.curve && (diagramType === "graph" || diagramType === "flowchart")) { + curve = edge.curve; + } + const { x: x5, y: y6 } = getLineFunctionsWithOffset(edge); + const lineFunction = line_default().x(x5).y(y6).curve(curve); + let strokeClasses; + switch (edge.thickness) { + case "normal": + strokeClasses = "edge-thickness-normal"; + break; + case "thick": + strokeClasses = "edge-thickness-thick"; + break; + case "invisible": + strokeClasses = "edge-thickness-thick"; + break; + default: + strokeClasses = ""; + } + switch (edge.pattern) { + case "solid": + strokeClasses += " edge-pattern-solid"; + break; + case "dotted": + strokeClasses += " edge-pattern-dotted"; + break; + case "dashed": + strokeClasses += " edge-pattern-dashed"; + break; + } + const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", edge.id).attr("class", " " + strokeClasses + (edge.classes ? " " + edge.classes : "")).attr("style", edge.style); + let url = ""; + if (getConfig2().flowchart.arrowMarkerAbsolute || getConfig2().state.arrowMarkerAbsolute) { + url = getUrl(true); + } + addEdgeMarkers2(svgPath, edge, url, id35, diagramType); + let paths = {}; + if (pointsHasChanged) { + paths.updatedPath = points; + } + paths.originalPath = edge.points; + return paths; + }, "insertEdge"); + } + }); + + // src/dagre-wrapper/blockArrowHelper.ts + var expandAndDeduplicateDirections, getArrowPoints; + var init_blockArrowHelper = __esm({ + "src/dagre-wrapper/blockArrowHelper.ts"() { + "use strict"; + expandAndDeduplicateDirections = /* @__PURE__ */ __name((directions) => { + const uniqueDirections = /* @__PURE__ */ new Set(); + for (const direction2 of directions) { + switch (direction2) { + case "x": + uniqueDirections.add("right"); + uniqueDirections.add("left"); + break; + case "y": + uniqueDirections.add("up"); + uniqueDirections.add("down"); + break; + default: + uniqueDirections.add(direction2); + break; + } + } + return uniqueDirections; + }, "expandAndDeduplicateDirections"); + getArrowPoints = /* @__PURE__ */ __name((duplicatedDirections, bbox, node2, totalWidth) => { + const directions = expandAndDeduplicateDirections(duplicatedDirections); + const f2 = 2; + const height2 = bbox.height + 2 * node2.padding; + const midpoint3 = height2 / f2; + const width3 = totalWidth ?? bbox.width + 2 * midpoint3 + node2.padding; + const padding2 = node2.padding / 2; + if (directions.has("right") && directions.has("left") && directions.has("up") && directions.has("down")) { + return [ + // Bottom + { x: 0, y: 0 }, + { x: midpoint3, y: 0 }, + { x: width3 / 2, y: 2 * padding2 }, + { x: width3 - midpoint3, y: 0 }, + { x: width3, y: 0 }, + // Right + { x: width3, y: -height2 / 3 }, + { x: width3 + 2 * padding2, y: -height2 / 2 }, + { x: width3, y: -2 * height2 / 3 }, + { x: width3, y: -height2 }, + // Top + { x: width3 - midpoint3, y: -height2 }, + { x: width3 / 2, y: -height2 - 2 * padding2 }, + { x: midpoint3, y: -height2 }, + // Left + { x: 0, y: -height2 }, + { x: 0, y: -2 * height2 / 3 }, + { x: -2 * padding2, y: -height2 / 2 }, + { x: 0, y: -height2 / 3 } + ]; + } + if (directions.has("right") && directions.has("left") && directions.has("up")) { + return [ + { x: midpoint3, y: 0 }, + { x: width3 - midpoint3, y: 0 }, + { x: width3, y: -height2 / 2 }, + { x: width3 - midpoint3, y: -height2 }, + { x: midpoint3, y: -height2 }, + { x: 0, y: -height2 / 2 } + ]; + } + if (directions.has("right") && directions.has("left") && directions.has("down")) { + return [ + { x: 0, y: 0 }, + { x: midpoint3, y: -height2 }, + { x: width3 - midpoint3, y: -height2 }, + { x: width3, y: 0 } + ]; + } + if (directions.has("right") && directions.has("up") && directions.has("down")) { + return [ + { x: 0, y: 0 }, + { x: width3, y: -midpoint3 }, + { x: width3, y: -height2 + midpoint3 }, + { x: 0, y: -height2 } + ]; + } + if (directions.has("left") && directions.has("up") && directions.has("down")) { + return [ + { x: width3, y: 0 }, + { x: 0, y: -midpoint3 }, + { x: 0, y: -height2 + midpoint3 }, + { x: width3, y: -height2 } + ]; + } + if (directions.has("right") && directions.has("left")) { + return [ + { x: midpoint3, y: 0 }, + { x: midpoint3, y: -padding2 }, + { x: width3 - midpoint3, y: -padding2 }, + { x: width3 - midpoint3, y: 0 }, + { x: width3, y: -height2 / 2 }, + { x: width3 - midpoint3, y: -height2 }, + { x: width3 - midpoint3, y: -height2 + padding2 }, + { x: midpoint3, y: -height2 + padding2 }, + { x: midpoint3, y: -height2 }, + { x: 0, y: -height2 / 2 } + ]; + } + if (directions.has("up") && directions.has("down")) { + return [ + // Bottom center + { x: width3 / 2, y: 0 }, + // Left pont of bottom arrow + { x: 0, y: -padding2 }, + { x: midpoint3, y: -padding2 }, + // Left top over vertical section + { x: midpoint3, y: -height2 + padding2 }, + { x: 0, y: -height2 + padding2 }, + // Top of arrow + { x: width3 / 2, y: -height2 }, + { x: width3, y: -height2 + padding2 }, + // Top of right vertical bar + { x: width3 - midpoint3, y: -height2 + padding2 }, + { x: width3 - midpoint3, y: -padding2 }, + { x: width3, y: -padding2 } + ]; + } + if (directions.has("right") && directions.has("up")) { + return [ + { x: 0, y: 0 }, + { x: width3, y: -midpoint3 }, + { x: 0, y: -height2 } + ]; + } + if (directions.has("right") && directions.has("down")) { + return [ + { x: 0, y: 0 }, + { x: width3, y: 0 }, + { x: 0, y: -height2 } + ]; + } + if (directions.has("left") && directions.has("up")) { + return [ + { x: width3, y: 0 }, + { x: 0, y: -midpoint3 }, + { x: width3, y: -height2 } + ]; + } + if (directions.has("left") && directions.has("down")) { + return [ + { x: width3, y: 0 }, + { x: 0, y: 0 }, + { x: width3, y: -height2 } + ]; + } + if (directions.has("right")) { + return [ + { x: midpoint3, y: -padding2 }, + { x: midpoint3, y: -padding2 }, + { x: width3 - midpoint3, y: -padding2 }, + { x: width3 - midpoint3, y: 0 }, + { x: width3, y: -height2 / 2 }, + { x: width3 - midpoint3, y: -height2 }, + { x: width3 - midpoint3, y: -height2 + padding2 }, + // top left corner of arrow + { x: midpoint3, y: -height2 + padding2 }, + { x: midpoint3, y: -height2 + padding2 } + ]; + } + if (directions.has("left")) { + return [ + { x: midpoint3, y: 0 }, + { x: midpoint3, y: -padding2 }, + // Two points, the right corners + { x: width3 - midpoint3, y: -padding2 }, + { x: width3 - midpoint3, y: -height2 + padding2 }, + { x: midpoint3, y: -height2 + padding2 }, + { x: midpoint3, y: -height2 }, + { x: 0, y: -height2 / 2 } + ]; + } + if (directions.has("up")) { + return [ + // Bottom center + { x: midpoint3, y: -padding2 }, + // Left top over vertical section + { x: midpoint3, y: -height2 + padding2 }, + { x: 0, y: -height2 + padding2 }, + // Top of arrow + { x: width3 / 2, y: -height2 }, + { x: width3, y: -height2 + padding2 }, + // Top of right vertical bar + { x: width3 - midpoint3, y: -height2 + padding2 }, + { x: width3 - midpoint3, y: -padding2 } + ]; + } + if (directions.has("down")) { + return [ + // Bottom center + { x: width3 / 2, y: 0 }, + // Left pont of bottom arrow + { x: 0, y: -padding2 }, + { x: midpoint3, y: -padding2 }, + // Left top over vertical section + { x: midpoint3, y: -height2 + padding2 }, + { x: width3 - midpoint3, y: -height2 + padding2 }, + { x: width3 - midpoint3, y: -padding2 }, + { x: width3, y: -padding2 } + ]; + } + return [{ x: 0, y: 0 }]; + }, "getArrowPoints"); + } + }); + + // src/dagre-wrapper/intersect/intersect-node.js + function intersectNode2(node2, point8) { + return node2.intersect(point8); + } + var intersect_node_default2; + var init_intersect_node2 = __esm({ + "src/dagre-wrapper/intersect/intersect-node.js"() { + "use strict"; + __name(intersectNode2, "intersectNode"); + intersect_node_default2 = intersectNode2; + } + }); + + // src/dagre-wrapper/intersect/intersect-ellipse.js + function intersectEllipse2(node2, rx, ry, point8) { + var cx = node2.x; + var cy = node2.y; + var px = cx - point8.x; + var py = cy - point8.y; + var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px); + var dx = Math.abs(rx * ry * px / det); + if (point8.x < cx) { + dx = -dx; + } + var dy = Math.abs(rx * ry * py / det); + if (point8.y < cy) { + dy = -dy; + } + return { x: cx + dx, y: cy + dy }; + } + var intersect_ellipse_default2; + var init_intersect_ellipse2 = __esm({ + "src/dagre-wrapper/intersect/intersect-ellipse.js"() { + "use strict"; + __name(intersectEllipse2, "intersectEllipse"); + intersect_ellipse_default2 = intersectEllipse2; + } + }); + + // src/dagre-wrapper/intersect/intersect-circle.js + function intersectCircle2(node2, rx, point8) { + return intersect_ellipse_default2(node2, rx, rx, point8); + } + var intersect_circle_default2; + var init_intersect_circle2 = __esm({ + "src/dagre-wrapper/intersect/intersect-circle.js"() { + "use strict"; + init_intersect_ellipse2(); + __name(intersectCircle2, "intersectCircle"); + intersect_circle_default2 = intersectCircle2; + } + }); + + // src/dagre-wrapper/intersect/intersect-line.js + function intersectLine2(p1, p22, q1, q22) { + var a1, a2, b1, b22, c1, c22; + var r1, r2, r3, r4; + var denom, offset, num; + var x5, y6; + a1 = p22.y - p1.y; + b1 = p1.x - p22.x; + c1 = p22.x * p1.y - p1.x * p22.y; + r3 = a1 * q1.x + b1 * q1.y + c1; + r4 = a1 * q22.x + b1 * q22.y + c1; + if (r3 !== 0 && r4 !== 0 && sameSign2(r3, r4)) { + return; + } + a2 = q22.y - q1.y; + b22 = q1.x - q22.x; + c22 = q22.x * q1.y - q1.x * q22.y; + r1 = a2 * p1.x + b22 * p1.y + c22; + r2 = a2 * p22.x + b22 * p22.y + c22; + if (r1 !== 0 && r2 !== 0 && sameSign2(r1, r2)) { + return; + } + denom = a1 * b22 - a2 * b1; + if (denom === 0) { + return; + } + offset = Math.abs(denom / 2); + num = b1 * c22 - b22 * c1; + x5 = num < 0 ? (num - offset) / denom : (num + offset) / denom; + num = a2 * c1 - a1 * c22; + y6 = num < 0 ? (num - offset) / denom : (num + offset) / denom; + return { x: x5, y: y6 }; + } + function sameSign2(r1, r2) { + return r1 * r2 > 0; + } + var intersect_line_default2; + var init_intersect_line2 = __esm({ + "src/dagre-wrapper/intersect/intersect-line.js"() { + "use strict"; + __name(intersectLine2, "intersectLine"); + __name(sameSign2, "sameSign"); + intersect_line_default2 = intersectLine2; + } + }); + + // src/dagre-wrapper/intersect/intersect-polygon.js + function intersectPolygon2(node2, polyPoints, point8) { + var x1 = node2.x; + var y1 = node2.y; + var intersections = []; + var minX = Number.POSITIVE_INFINITY; + var minY = Number.POSITIVE_INFINITY; + if (typeof polyPoints.forEach === "function") { + polyPoints.forEach(function(entry) { + minX = Math.min(minX, entry.x); + minY = Math.min(minY, entry.y); + }); + } else { + minX = Math.min(minX, polyPoints.x); + minY = Math.min(minY, polyPoints.y); + } + var left3 = x1 - node2.width / 2 - minX; + var top2 = y1 - node2.height / 2 - minY; + for (var i2 = 0; i2 < polyPoints.length; i2++) { + var p1 = polyPoints[i2]; + var p22 = polyPoints[i2 < polyPoints.length - 1 ? i2 + 1 : 0]; + var intersect3 = intersect_line_default2( + node2, + point8, + { x: left3 + p1.x, y: top2 + p1.y }, + { x: left3 + p22.x, y: top2 + p22.y } + ); + if (intersect3) { + intersections.push(intersect3); + } + } + if (!intersections.length) { + return node2; + } + if (intersections.length > 1) { + intersections.sort(function(p3, q3) { + var pdx = p3.x - point8.x; + var pdy = p3.y - point8.y; + var distp = Math.sqrt(pdx * pdx + pdy * pdy); + var qdx = q3.x - point8.x; + var qdy = q3.y - point8.y; + var distq = Math.sqrt(qdx * qdx + qdy * qdy); + return distp < distq ? -1 : distp === distq ? 0 : 1; + }); + } + return intersections[0]; + } + var intersect_polygon_default2; + var init_intersect_polygon2 = __esm({ + "src/dagre-wrapper/intersect/intersect-polygon.js"() { + "use strict"; + init_intersect_line2(); + intersect_polygon_default2 = intersectPolygon2; + __name(intersectPolygon2, "intersectPolygon"); + } + }); + + // src/dagre-wrapper/intersect/intersect-rect.js + var intersectRect3, intersect_rect_default2; + var init_intersect_rect2 = __esm({ + "src/dagre-wrapper/intersect/intersect-rect.js"() { + "use strict"; + intersectRect3 = /* @__PURE__ */ __name((node2, point8) => { + var x5 = node2.x; + var y6 = node2.y; + var dx = point8.x - x5; + var dy = point8.y - y6; + var w4 = node2.width / 2; + var h3 = node2.height / 2; + var sx, sy; + if (Math.abs(dy) * w4 > Math.abs(dx) * h3) { + if (dy < 0) { + h3 = -h3; + } + sx = dy === 0 ? 0 : h3 * dx / dy; + sy = h3; + } else { + if (dx < 0) { + w4 = -w4; + } + sx = w4; + sy = dx === 0 ? 0 : w4 * dy / dx; + } + return { x: x5 + sx, y: y6 + sy }; + }, "intersectRect"); + intersect_rect_default2 = intersectRect3; + } + }); + + // src/dagre-wrapper/intersect/index.js + var intersect_default2; + var init_intersect2 = __esm({ + "src/dagre-wrapper/intersect/index.js"() { + "use strict"; + init_intersect_node2(); + init_intersect_circle2(); + init_intersect_ellipse2(); + init_intersect_polygon2(); + init_intersect_rect2(); + intersect_default2 = { + node: intersect_node_default2, + circle: intersect_circle_default2, + ellipse: intersect_ellipse_default2, + polygon: intersect_polygon_default2, + rect: intersect_rect_default2 + }; + } + }); + + // src/dagre-wrapper/shapes/util.js + function insertPolygonShape2(parent4, w4, h3, points) { + return parent4.insert("polygon", ":first-child").attr( + "points", + points.map(function(d3) { + return d3.x + "," + d3.y; + }).join(" ") + ).attr("class", "label-container").attr("transform", "translate(" + -w4 / 2 + "," + h3 / 2 + ")"); + } + var labelHelper2, updateNodeBounds2; + var init_util4 = __esm({ + "src/dagre-wrapper/shapes/util.js"() { + "use strict"; + init_createLabel2(); + init_createText(); + init_diagramAPI(); + init_config(); + init_src32(); + init_common(); + init_utils2(); + init_labelImageUtils(); + labelHelper2 = /* @__PURE__ */ __name(async (parent4, node2, _classes, isNode2) => { + const config5 = getConfig2(); + let classes3; + const useHtmlLabels = node2.useHtmlLabels || getEffectiveHtmlLabels(config5); + if (!_classes) { + classes3 = "node default"; + } else { + classes3 = _classes; + } + const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId || node2.id); + const label = shapeSvg.insert("g").attr("class", "label").attr("style", node2.labelStyle); + let labelText; + if (node2.labelText === void 0) { + labelText = ""; + } else { + labelText = typeof node2.labelText === "string" ? node2.labelText : node2.labelText[0]; + } + let text4; + if (node2.labelType === "markdown") { + text4 = createText( + label, + sanitizeText(decodeEntities(labelText), config5), + { + useHtmlLabels, + width: node2.width || config5.flowchart.wrappingWidth, + classes: "markdown-node-label" + }, + config5 + ); + } else { + text4 = await createLabel_default2( + label, + sanitizeText(decodeEntities(labelText), config5), + node2.labelStyle, + false, + isNode2 + ); + } + let bbox = text4.getBBox(); + const halfPadding = node2.padding / 2; + if (getEffectiveHtmlLabels(config5)) { + const div = text4.children[0]; + const dv = select_default2(text4); + await configureLabelImages(div, labelText); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + if (useHtmlLabels) { + label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")"); + } else { + label.attr("transform", "translate(0, " + -bbox.height / 2 + ")"); + } + if (node2.centerLabel) { + label.attr("transform", "translate(" + -bbox.width / 2 + ", " + -bbox.height / 2 + ")"); + } + label.insert("rect", ":first-child"); + return { shapeSvg, bbox, halfPadding, label }; + }, "labelHelper"); + updateNodeBounds2 = /* @__PURE__ */ __name((node2, element3) => { + const bbox = element3.node().getBBox(); + node2.width = bbox.width; + node2.height = bbox.height; + }, "updateNodeBounds"); + __name(insertPolygonShape2, "insertPolygonShape"); + } + }); + + // src/dagre-wrapper/shapes/note.js + var note2, note_default; + var init_note2 = __esm({ + "src/dagre-wrapper/shapes/note.js"() { + "use strict"; + init_util4(); + init_logger(); + init_diagramAPI(); + init_config(); + init_intersect2(); + note2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const useHtmlLabels = node2.useHtmlLabels || getEffectiveHtmlLabels(getConfig2()); + if (!useHtmlLabels) { + node2.centerLabel = true; + } + const { shapeSvg, bbox, halfPadding } = await labelHelper2( + parent4, + node2, + "node " + node2.classes, + true + ); + log.info("Classes = ", node2.classes); + const rect3 = shapeSvg.insert("rect", ":first-child"); + rect3.attr("rx", node2.rx).attr("ry", node2.ry).attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node2.padding).attr("height", bbox.height + node2.padding); + updateNodeBounds2(node2, rect3); + node2.intersect = function(point8) { + return intersect_default2.rect(node2, point8); + }; + return shapeSvg; + }, "note"); + note_default = note2; + } + }); + + // src/dagre-wrapper/nodes.js + function applyNodePropertyBorders(rect3, borders, totalWidth, totalHeight) { + const strokeDashArray = []; + const addBorder = /* @__PURE__ */ __name((length2) => { + strokeDashArray.push(length2, 0); + }, "addBorder"); + const skipBorder = /* @__PURE__ */ __name((length2) => { + strokeDashArray.push(0, length2); + }, "skipBorder"); + if (borders.includes("t")) { + log.debug("add top border"); + addBorder(totalWidth); + } else { + skipBorder(totalWidth); + } + if (borders.includes("r")) { + log.debug("add right border"); + addBorder(totalHeight); + } else { + skipBorder(totalHeight); + } + if (borders.includes("b")) { + log.debug("add bottom border"); + addBorder(totalWidth); + } else { + skipBorder(totalWidth); + } + if (borders.includes("l")) { + log.debug("add left border"); + addBorder(totalHeight); + } else { + skipBorder(totalHeight); + } + rect3.attr("stroke-dasharray", strokeDashArray.join(" ")); + } + var formatClass, getClassesFromNode, question2, choice2, hexagon2, block_arrow, rect_left_inv_arrow2, lean_right2, lean_left2, trapezoid2, inv_trapezoid2, rect_right_inv_arrow, cylinder2, rect2, composite, labelRect2, rectWithTitle2, stadium2, circle5, doublecircle2, subroutine2, start2, forkJoin2, end, class_box, shapes3, nodeElems2, insertNode2, positionNode2; + var init_nodes3 = __esm({ + "src/dagre-wrapper/nodes.js"() { + "use strict"; + init_src32(); + init_diagramAPI(); + init_config(); + init_logger(); + init_blockArrowHelper(); + init_createLabel2(); + init_intersect2(); + init_note2(); + init_util4(); + formatClass = /* @__PURE__ */ __name((str2) => { + if (str2) { + return " " + str2; + } + return ""; + }, "formatClass"); + getClassesFromNode = /* @__PURE__ */ __name((node2, otherClasses) => { + return `${otherClasses ? otherClasses : "node default"}${formatClass(node2.classes)} ${formatClass( + node2.class + )}`; + }, "getClassesFromNode"); + question2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const w4 = bbox.width + node2.padding; + const h3 = bbox.height + node2.padding; + const s2 = w4 + h3; + const points = [ + { x: s2 / 2, y: 0 }, + { x: s2, y: -s2 / 2 }, + { x: s2 / 2, y: -s2 }, + { x: 0, y: -s2 / 2 } + ]; + log.info("Question main (Circle)"); + const questionElem = insertPolygonShape2(shapeSvg, s2, s2, points); + questionElem.attr("style", node2.style); + updateNodeBounds2(node2, questionElem); + node2.intersect = function(point8) { + log.warn("Intersect called"); + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "question"); + choice2 = /* @__PURE__ */ __name((parent4, node2) => { + const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id); + const s2 = 28; + const points = [ + { x: 0, y: s2 / 2 }, + { x: s2 / 2, y: 0 }, + { x: 0, y: -s2 / 2 }, + { x: -s2 / 2, y: 0 } + ]; + const choice3 = shapeSvg.insert("polygon", ":first-child").attr( + "points", + points.map(function(d3) { + return d3.x + "," + d3.y; + }).join(" ") + ); + choice3.attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28); + node2.width = 28; + node2.height = 28; + node2.intersect = function(point8) { + return intersect_default2.circle(node2, 14, point8); + }; + return shapeSvg; + }, "choice"); + hexagon2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const f2 = 4; + const h3 = node2.positioned ? node2.height : bbox.height + node2.padding; + const m3 = h3 / f2; + const w4 = node2.positioned ? node2.width : bbox.width + 2 * m3 + node2.padding; + const points = [ + { x: m3, y: 0 }, + { x: w4 - m3, y: 0 }, + { x: w4, y: -h3 / 2 }, + { x: w4 - m3, y: -h3 }, + { x: m3, y: -h3 }, + { x: 0, y: -h3 / 2 } + ]; + const hex2 = insertPolygonShape2(shapeSvg, w4, h3, points); + hex2.attr("style", node2.style); + updateNodeBounds2(node2, hex2); + node2.intersect = function(point8) { + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "hexagon"); + block_arrow = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2(parent4, node2, void 0, true); + const f2 = 2; + const h3 = bbox.height + 2 * node2.padding; + const m3 = h3 / f2; + const naturalW = bbox.width + 2 * m3 + node2.padding; + const isSpanning = node2.positioned && (node2.widthInColumns ?? 1) > 1 && node2.width > naturalW; + const w4 = isSpanning ? node2.width : naturalW; + const points = getArrowPoints(node2.directions, bbox, node2, w4); + const blockArrow = insertPolygonShape2(shapeSvg, w4, h3, points); + blockArrow.attr("style", node2.style); + updateNodeBounds2(node2, blockArrow); + node2.intersect = function(point8) { + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "block_arrow"); + rect_left_inv_arrow2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const w4 = bbox.width + node2.padding; + const h3 = bbox.height + node2.padding; + const points = [ + { x: -h3 / 2, y: 0 }, + { x: w4, y: 0 }, + { x: w4, y: -h3 }, + { x: -h3 / 2, y: -h3 }, + { x: 0, y: -h3 / 2 } + ]; + const el = insertPolygonShape2(shapeSvg, w4, h3, points); + el.attr("style", node2.style); + node2.width = w4 + h3; + node2.height = h3; + node2.intersect = function(point8) { + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "rect_left_inv_arrow"); + lean_right2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2(parent4, node2, getClassesFromNode(node2), true); + const w4 = bbox.width + node2.padding; + const h3 = bbox.height + node2.padding; + const points = [ + { x: -2 * h3 / 6, y: 0 }, + { x: w4 - h3 / 6, y: 0 }, + { x: w4 + 2 * h3 / 6, y: -h3 }, + { x: h3 / 6, y: -h3 } + ]; + const el = insertPolygonShape2(shapeSvg, w4, h3, points); + el.attr("style", node2.style); + updateNodeBounds2(node2, el); + node2.intersect = function(point8) { + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "lean_right"); + lean_left2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const w4 = bbox.width + node2.padding; + const h3 = bbox.height + node2.padding; + const points = [ + { x: 2 * h3 / 6, y: 0 }, + { x: w4 + h3 / 6, y: 0 }, + { x: w4 - 2 * h3 / 6, y: -h3 }, + { x: -h3 / 6, y: -h3 } + ]; + const el = insertPolygonShape2(shapeSvg, w4, h3, points); + el.attr("style", node2.style); + updateNodeBounds2(node2, el); + node2.intersect = function(point8) { + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "lean_left"); + trapezoid2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const w4 = bbox.width + node2.padding; + const h3 = bbox.height + node2.padding; + const points = [ + { x: -2 * h3 / 6, y: 0 }, + { x: w4 + 2 * h3 / 6, y: 0 }, + { x: w4 - h3 / 6, y: -h3 }, + { x: h3 / 6, y: -h3 } + ]; + const el = insertPolygonShape2(shapeSvg, w4, h3, points); + el.attr("style", node2.style); + updateNodeBounds2(node2, el); + node2.intersect = function(point8) { + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "trapezoid"); + inv_trapezoid2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const w4 = bbox.width + node2.padding; + const h3 = bbox.height + node2.padding; + const points = [ + { x: h3 / 6, y: 0 }, + { x: w4 - h3 / 6, y: 0 }, + { x: w4 + 2 * h3 / 6, y: -h3 }, + { x: -2 * h3 / 6, y: -h3 } + ]; + const el = insertPolygonShape2(shapeSvg, w4, h3, points); + el.attr("style", node2.style); + updateNodeBounds2(node2, el); + node2.intersect = function(point8) { + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "inv_trapezoid"); + rect_right_inv_arrow = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const w4 = bbox.width + node2.padding; + const h3 = bbox.height + node2.padding; + const points = [ + { x: 0, y: 0 }, + { x: w4 + h3 / 2, y: 0 }, + { x: w4, y: -h3 / 2 }, + { x: w4 + h3 / 2, y: -h3 }, + { x: 0, y: -h3 } + ]; + const el = insertPolygonShape2(shapeSvg, w4, h3, points); + el.attr("style", node2.style); + updateNodeBounds2(node2, el); + node2.intersect = function(point8) { + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "rect_right_inv_arrow"); + cylinder2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const w4 = bbox.width + node2.padding; + const rx = w4 / 2; + const ry = rx / (2.5 + w4 / 50); + const h3 = bbox.height + ry + node2.padding; + const shape = "M 0," + ry + " a " + rx + "," + ry + " 0,0,0 " + w4 + " 0 a " + rx + "," + ry + " 0,0,0 " + -w4 + " 0 l 0," + h3 + " a " + rx + "," + ry + " 0,0,0 " + w4 + " 0 l 0," + -h3; + const el = shapeSvg.attr("label-offset-y", ry).insert("path", ":first-child").attr("style", node2.style).attr("d", shape).attr("transform", "translate(" + -w4 / 2 + "," + -(h3 / 2 + ry) + ")"); + updateNodeBounds2(node2, el); + node2.intersect = function(point8) { + const pos = intersect_default2.rect(node2, point8); + const x5 = pos.x - node2.x; + if (rx != 0 && (Math.abs(x5) < node2.width / 2 || Math.abs(x5) == node2.width / 2 && Math.abs(pos.y - node2.y) > node2.height / 2 - ry)) { + let y6 = ry * ry * (1 - x5 * x5 / (rx * rx)); + if (y6 != 0) { + y6 = Math.sqrt(y6); + } + y6 = ry - y6; + if (point8.y - node2.y > 0) { + y6 = -y6; + } + pos.y += y6; + } + return pos; + }; + return shapeSvg; + }, "cylinder"); + rect2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox, halfPadding } = await labelHelper2( + parent4, + node2, + "node " + node2.classes + " " + node2.class, + true + ); + const rect3 = shapeSvg.insert("rect", ":first-child"); + const totalWidth = node2.positioned ? node2.width : bbox.width + node2.padding; + const totalHeight = node2.positioned ? node2.height : bbox.height + node2.padding; + const x5 = node2.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding; + const y6 = node2.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding; + rect3.attr("class", "basic label-container").attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight); + if (node2.props) { + const propKeys = new Set(Object.keys(node2.props)); + if (node2.props.borders) { + applyNodePropertyBorders(rect3, node2.props.borders, totalWidth, totalHeight); + propKeys.delete("borders"); + } + propKeys.forEach((propKey) => { + log.warn(`Unknown node property ${propKey}`); + }); + } + updateNodeBounds2(node2, rect3); + node2.intersect = function(point8) { + return intersect_default2.rect(node2, point8); + }; + return shapeSvg; + }, "rect"); + composite = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox, halfPadding } = await labelHelper2( + parent4, + node2, + "node " + node2.classes, + true + ); + const rect3 = shapeSvg.insert("rect", ":first-child"); + const totalWidth = node2.positioned ? node2.width : bbox.width + node2.padding; + const totalHeight = node2.positioned ? node2.height : bbox.height + node2.padding; + const x5 = node2.positioned ? -totalWidth / 2 : -bbox.width / 2 - halfPadding; + const y6 = node2.positioned ? -totalHeight / 2 : -bbox.height / 2 - halfPadding; + rect3.attr("class", "basic cluster composite label-container").attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("x", x5).attr("y", y6).attr("width", totalWidth).attr("height", totalHeight); + if (node2.props) { + const propKeys = new Set(Object.keys(node2.props)); + if (node2.props.borders) { + applyNodePropertyBorders(rect3, node2.props.borders, totalWidth, totalHeight); + propKeys.delete("borders"); + } + propKeys.forEach((propKey) => { + log.warn(`Unknown node property ${propKey}`); + }); + } + updateNodeBounds2(node2, rect3); + node2.intersect = function(point8) { + return intersect_default2.rect(node2, point8); + }; + return shapeSvg; + }, "composite"); + labelRect2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg } = await labelHelper2(parent4, node2, "label", true); + log.trace("Classes = ", node2.class); + const rect3 = shapeSvg.insert("rect", ":first-child"); + const totalWidth = 0; + const totalHeight = 0; + rect3.attr("width", totalWidth).attr("height", totalHeight); + shapeSvg.attr("class", "label edgeLabel"); + if (node2.props) { + const propKeys = new Set(Object.keys(node2.props)); + if (node2.props.borders) { + applyNodePropertyBorders(rect3, node2.props.borders, totalWidth, totalHeight); + propKeys.delete("borders"); + } + propKeys.forEach((propKey) => { + log.warn(`Unknown node property ${propKey}`); + }); + } + updateNodeBounds2(node2, rect3); + node2.intersect = function(point8) { + return intersect_default2.rect(node2, point8); + }; + return shapeSvg; + }, "labelRect"); + __name(applyNodePropertyBorders, "applyNodePropertyBorders"); + rectWithTitle2 = /* @__PURE__ */ __name(async (parent4, node2) => { + let classes3; + if (!node2.classes) { + classes3 = "node default"; + } else { + classes3 = "node " + node2.classes; + } + const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId || node2.id); + const rect3 = shapeSvg.insert("rect", ":first-child"); + const innerLine = shapeSvg.insert("line"); + const label = shapeSvg.insert("g").attr("class", "label"); + const text22 = node2.labelText.flat ? node2.labelText.flat() : node2.labelText; + let title2 = ""; + if (typeof text22 === "object") { + title2 = text22[0]; + } else { + title2 = text22; + } + log.info("Label text abc79", title2, text22, typeof text22 === "object"); + const text4 = await createLabel_default2(label, title2, node2.labelStyle, true, true); + let bbox = { width: 0, height: 0 }; + if (getEffectiveHtmlLabels(getConfig2())) { + const div = text4.children[0]; + const dv = select_default2(text4); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + log.info("Text 2", text22); + const textRows = text22.slice(1, text22.length); + let titleBox = text4.getBBox(); + const descr = await createLabel_default2( + label, + textRows.join ? textRows.join("
    ") : textRows, + node2.labelStyle, + true, + true + ); + if (getEffectiveHtmlLabels(getConfig2())) { + const div = descr.children[0]; + const dv = select_default2(descr); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + const halfPadding = node2.padding / 2; + select_default2(descr).attr( + "transform", + "translate( " + // (titleBox.width - bbox.width) / 2 + + (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ", " + (titleBox.height + halfPadding + 5) + ")" + ); + select_default2(text4).attr( + "transform", + "translate( " + // (titleBox.width - bbox.width) / 2 + + (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ", 0)" + ); + bbox = label.node().getBBox(); + label.attr( + "transform", + "translate(" + -bbox.width / 2 + ", " + (-bbox.height / 2 - halfPadding + 3) + ")" + ); + rect3.attr("class", "outer title-state").attr("x", -bbox.width / 2 - halfPadding).attr("y", -bbox.height / 2 - halfPadding).attr("width", bbox.width + node2.padding).attr("height", bbox.height + node2.padding); + innerLine.attr("class", "divider").attr("x1", -bbox.width / 2 - halfPadding).attr("x2", bbox.width / 2 + halfPadding).attr("y1", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr("y2", -bbox.height / 2 - halfPadding + titleBox.height + halfPadding); + updateNodeBounds2(node2, rect3); + node2.intersect = function(point8) { + return intersect_default2.rect(node2, point8); + }; + return shapeSvg; + }, "rectWithTitle"); + stadium2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const h3 = bbox.height + node2.padding; + const w4 = bbox.width + h3 / 4 + node2.padding; + const rect3 = shapeSvg.insert("rect", ":first-child").attr("style", node2.style).attr("rx", h3 / 2).attr("ry", h3 / 2).attr("x", -w4 / 2).attr("y", -h3 / 2).attr("width", w4).attr("height", h3); + updateNodeBounds2(node2, rect3); + node2.intersect = function(point8) { + return intersect_default2.rect(node2, point8); + }; + return shapeSvg; + }, "stadium"); + circle5 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox, halfPadding } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const circle6 = shapeSvg.insert("circle", ":first-child"); + circle6.attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node2.padding).attr("height", bbox.height + node2.padding); + log.info("Circle main"); + updateNodeBounds2(node2, circle6); + node2.intersect = function(point8) { + log.info("Circle intersect", node2, bbox.width / 2 + halfPadding, point8); + return intersect_default2.circle(node2, bbox.width / 2 + halfPadding, point8); + }; + return shapeSvg; + }, "circle"); + doublecircle2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox, halfPadding } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const gap = 5; + const circleGroup = shapeSvg.insert("g", ":first-child"); + const outerCircle = circleGroup.insert("circle"); + const innerCircle = circleGroup.insert("circle"); + circleGroup.attr("class", node2.class); + outerCircle.attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("r", bbox.width / 2 + halfPadding + gap).attr("width", bbox.width + node2.padding + gap * 2).attr("height", bbox.height + node2.padding + gap * 2); + innerCircle.attr("style", node2.style).attr("rx", node2.rx).attr("ry", node2.ry).attr("r", bbox.width / 2 + halfPadding).attr("width", bbox.width + node2.padding).attr("height", bbox.height + node2.padding); + log.info("DoubleCircle main"); + updateNodeBounds2(node2, outerCircle); + node2.intersect = function(point8) { + log.info("DoubleCircle intersect", node2, bbox.width / 2 + halfPadding + gap, point8); + return intersect_default2.circle(node2, bbox.width / 2 + halfPadding + gap, point8); + }; + return shapeSvg; + }, "doublecircle"); + subroutine2 = /* @__PURE__ */ __name(async (parent4, node2) => { + const { shapeSvg, bbox } = await labelHelper2( + parent4, + node2, + getClassesFromNode(node2, void 0), + true + ); + const w4 = bbox.width + node2.padding; + const h3 = bbox.height + node2.padding; + const points = [ + { x: 0, y: 0 }, + { x: w4, y: 0 }, + { x: w4, y: -h3 }, + { x: 0, y: -h3 }, + { x: 0, y: 0 }, + { x: -8, y: 0 }, + { x: w4 + 8, y: 0 }, + { x: w4 + 8, y: -h3 }, + { x: -8, y: -h3 }, + { x: -8, y: 0 } + ]; + const el = insertPolygonShape2(shapeSvg, w4, h3, points); + el.attr("style", node2.style); + updateNodeBounds2(node2, el); + node2.intersect = function(point8) { + return intersect_default2.polygon(node2, points, point8); + }; + return shapeSvg; + }, "subroutine"); + start2 = /* @__PURE__ */ __name((parent4, node2) => { + const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id); + const circle6 = shapeSvg.insert("circle", ":first-child"); + circle6.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14); + updateNodeBounds2(node2, circle6); + node2.intersect = function(point8) { + return intersect_default2.circle(node2, 7, point8); + }; + return shapeSvg; + }, "start"); + forkJoin2 = /* @__PURE__ */ __name((parent4, node2, dir2) => { + const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id); + let width3 = 70; + let height2 = 10; + if (dir2 === "LR") { + width3 = 10; + height2 = 70; + } + const shape = shapeSvg.append("rect").attr("x", -1 * width3 / 2).attr("y", -1 * height2 / 2).attr("width", width3).attr("height", height2).attr("class", "fork-join"); + updateNodeBounds2(node2, shape); + node2.height = node2.height + node2.padding / 2; + node2.width = node2.width + node2.padding / 2; + node2.intersect = function(point8) { + return intersect_default2.rect(node2, point8); + }; + return shapeSvg; + }, "forkJoin"); + end = /* @__PURE__ */ __name((parent4, node2) => { + const shapeSvg = parent4.insert("g").attr("class", "node default").attr("id", node2.domId || node2.id); + const innerCircle = shapeSvg.insert("circle", ":first-child"); + const circle6 = shapeSvg.insert("circle", ":first-child"); + circle6.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14); + innerCircle.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10); + updateNodeBounds2(node2, circle6); + node2.intersect = function(point8) { + return intersect_default2.circle(node2, 7, point8); + }; + return shapeSvg; + }, "end"); + class_box = /* @__PURE__ */ __name(async (parent4, node2) => { + const halfPadding = node2.padding / 2; + const rowPadding = 4; + const lineHeight = 8; + let classes3; + if (!node2.classes) { + classes3 = "node default"; + } else { + classes3 = "node " + node2.classes; + } + const shapeSvg = parent4.insert("g").attr("class", classes3).attr("id", node2.domId || node2.id); + const rect3 = shapeSvg.insert("rect", ":first-child"); + const topLine = shapeSvg.insert("line"); + const bottomLine = shapeSvg.insert("line"); + let maxWidth2 = 0; + let maxHeight = rowPadding; + const labelContainer = shapeSvg.insert("g").attr("class", "label"); + let verticalPos = 0; + const hasInterface = node2.classData.annotations?.[0]; + const interfaceLabelText = node2.classData.annotations[0] ? "\xAB" + node2.classData.annotations[0] + "\xBB" : ""; + const interfaceLabel = await createLabel_default2( + labelContainer, + interfaceLabelText, + node2.labelStyle, + true, + true + ); + let interfaceBBox = interfaceLabel.getBBox(); + if (getEffectiveHtmlLabels(getConfig2())) { + const div = interfaceLabel.children[0]; + const dv = select_default2(interfaceLabel); + interfaceBBox = div.getBoundingClientRect(); + dv.attr("width", interfaceBBox.width); + dv.attr("height", interfaceBBox.height); + } + if (node2.classData.annotations[0]) { + maxHeight += interfaceBBox.height + rowPadding; + maxWidth2 += interfaceBBox.width; + } + let classTitleString = node2.classData.label; + if (node2.classData.type !== void 0 && node2.classData.type !== "") { + if (getEffectiveHtmlLabels(getConfig2())) { + classTitleString += "<" + node2.classData.type + ">"; + } else { + classTitleString += "<" + node2.classData.type + ">"; + } + } + const classTitleLabel = await createLabel_default2( + labelContainer, + classTitleString, + node2.labelStyle, + true, + true + ); + select_default2(classTitleLabel).attr("class", "classTitle"); + let classTitleBBox = classTitleLabel.getBBox(); + if (getEffectiveHtmlLabels(getConfig2())) { + const div = classTitleLabel.children[0]; + const dv = select_default2(classTitleLabel); + classTitleBBox = div.getBoundingClientRect(); + dv.attr("width", classTitleBBox.width); + dv.attr("height", classTitleBBox.height); + } + maxHeight += classTitleBBox.height + rowPadding; + if (classTitleBBox.width > maxWidth2) { + maxWidth2 = classTitleBBox.width; + } + const classAttributes = []; + node2.classData.members.forEach(async (member) => { + const parsedInfo = member.getDisplayDetails(); + let parsedText = parsedInfo.displayText; + if (getEffectiveHtmlLabels(getConfig2())) { + parsedText = parsedText.replace(//g, ">"); + } + const lbl = await createLabel_default2( + labelContainer, + parsedText, + parsedInfo.cssStyle ? parsedInfo.cssStyle : node2.labelStyle, + true, + true + ); + let bbox = lbl.getBBox(); + if (getEffectiveHtmlLabels(getConfig2())) { + const div = lbl.children[0]; + const dv = select_default2(lbl); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + if (bbox.width > maxWidth2) { + maxWidth2 = bbox.width; + } + maxHeight += bbox.height + rowPadding; + classAttributes.push(lbl); + }); + maxHeight += lineHeight; + const classMethods = []; + node2.classData.methods.forEach(async (member) => { + const parsedInfo = member.getDisplayDetails(); + let displayText = parsedInfo.displayText; + if (getEffectiveHtmlLabels(getConfig2())) { + displayText = displayText.replace(//g, ">"); + } + const lbl = await createLabel_default2( + labelContainer, + displayText, + parsedInfo.cssStyle ? parsedInfo.cssStyle : node2.labelStyle, + true, + true + ); + let bbox = lbl.getBBox(); + if (getEffectiveHtmlLabels(getConfig2())) { + const div = lbl.children[0]; + const dv = select_default2(lbl); + bbox = div.getBoundingClientRect(); + dv.attr("width", bbox.width); + dv.attr("height", bbox.height); + } + if (bbox.width > maxWidth2) { + maxWidth2 = bbox.width; + } + maxHeight += bbox.height + rowPadding; + classMethods.push(lbl); + }); + maxHeight += lineHeight; + if (hasInterface) { + let diffX2 = (maxWidth2 - interfaceBBox.width) / 2; + select_default2(interfaceLabel).attr( + "transform", + "translate( " + (-1 * maxWidth2 / 2 + diffX2) + ", " + -1 * maxHeight / 2 + ")" + ); + verticalPos = interfaceBBox.height + rowPadding; + } + let diffX = (maxWidth2 - classTitleBBox.width) / 2; + select_default2(classTitleLabel).attr( + "transform", + "translate( " + (-1 * maxWidth2 / 2 + diffX) + ", " + (-1 * maxHeight / 2 + verticalPos) + ")" + ); + verticalPos += classTitleBBox.height + rowPadding; + topLine.attr("class", "divider").attr("x1", -maxWidth2 / 2 - halfPadding).attr("x2", maxWidth2 / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos); + verticalPos += lineHeight; + classAttributes.forEach((lbl) => { + select_default2(lbl).attr( + "transform", + "translate( " + -maxWidth2 / 2 + ", " + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ")" + ); + const memberBBox = lbl?.getBBox(); + verticalPos += (memberBBox?.height ?? 0) + rowPadding; + }); + verticalPos += lineHeight; + bottomLine.attr("class", "divider").attr("x1", -maxWidth2 / 2 - halfPadding).attr("x2", maxWidth2 / 2 + halfPadding).attr("y1", -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr("y2", -maxHeight / 2 - halfPadding + lineHeight + verticalPos); + verticalPos += lineHeight; + classMethods.forEach((lbl) => { + select_default2(lbl).attr( + "transform", + "translate( " + -maxWidth2 / 2 + ", " + (-1 * maxHeight / 2 + verticalPos) + ")" + ); + const memberBBox = lbl?.getBBox(); + verticalPos += (memberBBox?.height ?? 0) + rowPadding; + }); + rect3.attr("style", node2.style).attr("class", "outer title-state").attr("x", -maxWidth2 / 2 - halfPadding).attr("y", -(maxHeight / 2) - halfPadding).attr("width", maxWidth2 + node2.padding).attr("height", maxHeight + node2.padding); + updateNodeBounds2(node2, rect3); + node2.intersect = function(point8) { + return intersect_default2.rect(node2, point8); + }; + return shapeSvg; + }, "class_box"); + shapes3 = { + rhombus: question2, + composite, + question: question2, + rect: rect2, + labelRect: labelRect2, + rectWithTitle: rectWithTitle2, + choice: choice2, + circle: circle5, + doublecircle: doublecircle2, + stadium: stadium2, + hexagon: hexagon2, + block_arrow, + rect_left_inv_arrow: rect_left_inv_arrow2, + lean_right: lean_right2, + lean_left: lean_left2, + trapezoid: trapezoid2, + inv_trapezoid: inv_trapezoid2, + rect_right_inv_arrow, + cylinder: cylinder2, + start: start2, + end, + note: note_default, + subroutine: subroutine2, + fork: forkJoin2, + join: forkJoin2, + class_box + }; + nodeElems2 = {}; + insertNode2 = /* @__PURE__ */ __name(async (elem, node2, renderOptions) => { + let newEl; + let el; + if (node2.link) { + let target; + if (getConfig2().securityLevel === "sandbox") { + target = "_top"; + } else if (node2.linkTarget) { + target = node2.linkTarget || "_blank"; + } + newEl = elem.insert("svg:a").attr("xlink:href", node2.link).attr("target", target); + el = await shapes3[node2.shape](newEl, node2, renderOptions); + } else { + el = await shapes3[node2.shape](elem, node2, renderOptions); + newEl = el; + } + if (node2.tooltip) { + el.attr("title", node2.tooltip); + } + if (node2.class) { + el.attr("class", "node default " + node2.class); + } + nodeElems2[node2.id] = newEl; + if (node2.haveCallback) { + nodeElems2[node2.id].attr("class", nodeElems2[node2.id].attr("class") + " clickable"); + } + return newEl; + }, "insertNode"); + positionNode2 = /* @__PURE__ */ __name((node2) => { + const el = nodeElems2[node2.id]; + log.trace( + "Transforming node", + node2.diff, + node2, + "translate(" + (node2.x - node2.width / 2 - 5) + ", " + node2.width / 2 + ")" + ); + const padding2 = 8; + const diff2 = node2.diff || 0; + if (node2.clusterNode) { + el.attr( + "transform", + "translate(" + (node2.x + diff2 - node2.width / 2) + ", " + (node2.y - node2.height / 2 - padding2) + ")" + ); + } else { + el.attr("transform", "translate(" + node2.x + ", " + node2.y + ")"); + } + return diff2; + }, "positionNode"); + } + }); + + // src/diagrams/block/renderHelpers.ts + function getNodeFromBlock(block2, db10, positioned = false) { + const vertex = block2; + let classStr = "default"; + if ((vertex?.classes?.length || 0) > 0) { + classStr = (vertex?.classes ?? []).join(" "); + } + classStr = classStr + " flowchart-label"; + let radius2 = 0; + let shape = ""; + let padding2; + switch (vertex.type) { + case "round": + radius2 = 5; + shape = "rect"; + break; + case "composite": + radius2 = 0; + shape = "composite"; + padding2 = 0; + break; + case "square": + shape = "rect"; + break; + case "diamond": + shape = "question"; + break; + case "hexagon": + shape = "hexagon"; + break; + case "block_arrow": + shape = "block_arrow"; + break; + case "odd": + shape = "rect_left_inv_arrow"; + break; + case "lean_right": + shape = "lean_right"; + break; + case "lean_left": + shape = "lean_left"; + break; + case "trapezoid": + shape = "trapezoid"; + break; + case "inv_trapezoid": + shape = "inv_trapezoid"; + break; + case "rect_left_inv_arrow": + shape = "rect_left_inv_arrow"; + break; + case "circle": + shape = "circle"; + break; + case "ellipse": + shape = "ellipse"; + break; + case "stadium": + shape = "stadium"; + break; + case "subroutine": + shape = "subroutine"; + break; + case "cylinder": + shape = "cylinder"; + break; + case "group": + shape = "rect"; + break; + case "doublecircle": + shape = "doublecircle"; + break; + default: + shape = "rect"; + } + const styles6 = getStylesFromArray(vertex?.styles ?? []); + const vertexText = vertex.label; + const bounds4 = vertex.size ?? { width: 0, height: 0, x: 0, y: 0 }; + const dbDiagramId = db10.getDiagramId(); + const node2 = { + labelStyle: styles6.labelStyle, + shape, + labelText: vertexText, + rx: radius2, + ry: radius2, + class: classStr, + style: styles6.style, + id: vertex.id, + domId: dbDiagramId ? `${dbDiagramId}-${vertex.id}` : vertex.id, + directions: vertex.directions, + width: bounds4.width, + height: bounds4.height, + x: bounds4.x, + y: bounds4.y, + positioned, + intersect: void 0, + type: vertex.type, + padding: padding2 ?? getConfig()?.block?.padding ?? 0, + widthInColumns: vertex.widthInColumns ?? 1 + }; + return node2; + } + async function calculateBlockSize(elem, block2, db10) { + const node2 = getNodeFromBlock(block2, db10, false); + if (node2.type === "group") { + return; + } + const config5 = getConfig(); + const nodeEl = await insertNode2(elem, node2, { config: config5 }); + const boundingBox3 = nodeEl.node().getBBox(); + const obj = db10.getBlock(node2.id); + obj.size = { width: boundingBox3.width, height: boundingBox3.height, x: 0, y: 0, node: nodeEl }; + db10.setBlock(obj); + nodeEl.remove(); + } + async function insertBlockPositioned(elem, block2, db10) { + const node2 = getNodeFromBlock(block2, db10, true); + const obj = db10.getBlock(node2.id); + if (obj.type !== "space") { + const config5 = getConfig(); + await insertNode2(elem, node2, { config: config5 }); + block2.intersect = node2?.intersect; + positionNode2(node2); + } + } + async function performOperations(elem, blocks2, db10, operation) { + for (const block2 of blocks2) { + await operation(elem, block2, db10); + if (block2.children) { + await performOperations(elem, block2.children, db10, operation); + } + } + } + async function calculateBlockSizes(elem, blocks2, db10) { + await performOperations(elem, blocks2, db10, calculateBlockSize); + } + async function insertBlocks(elem, blocks2, db10) { + await performOperations(elem, blocks2, db10, insertBlockPositioned); + } + async function insertEdges(elem, edges3, blocks2, db10, id35) { + const g2 = new Graph({ + multigraph: true, + compound: true + }); + g2.setGraph({ + rankdir: "TB", + nodesep: 10, + ranksep: 10, + marginx: 8, + marginy: 8 + }); + for (const block2 of blocks2) { + if (block2.size) { + g2.setNode(block2.id, { + width: block2.size.width, + height: block2.size.height, + intersect: block2.intersect + }); + } + } + for (const edge of edges3) { + if (edge.start && edge.end) { + const startBlock = db10.getBlock(edge.start); + const endBlock = db10.getBlock(edge.end); + if (startBlock?.size && endBlock?.size) { + const start3 = startBlock.size; + const end2 = endBlock.size; + const points = [ + { x: start3.x, y: start3.y }, + { x: start3.x + (end2.x - start3.x) / 2, y: start3.y + (end2.y - start3.y) / 2 }, + { x: end2.x, y: end2.y } + ]; + const prefixedEdgeId = id35 ? `${id35}-${edge.id}` : edge.id; + const thicknessClass = edge.thickness === "thick" ? "edge-thickness-thick" : "edge-thickness-normal"; + const patternClass = edge.pattern === "dotted" ? "edge-pattern-dotted" : "edge-pattern-solid"; + const dynamicClasses = `${thicknessClass} ${patternClass} flowchart-link LS-a1 LE-b1`; + insertEdge2( + elem, + { v: edge.start, w: edge.end, name: prefixedEdgeId }, + { + ...edge, + id: prefixedEdgeId, + arrowTypeEnd: edge.arrowTypeEnd, + arrowTypeStart: edge.arrowTypeStart, + points, + classes: dynamicClasses + }, + void 0, + "block", + g2, + id35 + ); + if (edge.label) { + await insertEdgeLabel2(elem, { + ...edge, + label: edge.label, + labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;", + arrowTypeEnd: edge.arrowTypeEnd, + arrowTypeStart: edge.arrowTypeStart, + points, + classes: dynamicClasses + }); + positionEdgeLabel2( + { ...edge, x: points[1].x, y: points[1].y }, + { + originalPath: points + } + ); + } + } + } + } + } + var init_renderHelpers = __esm({ + "src/diagrams/block/renderHelpers.ts"() { + "use strict"; + init_graphlib(); + init_config(); + init_edges2(); + init_nodes3(); + init_utils2(); + __name(getNodeFromBlock, "getNodeFromBlock"); + __name(calculateBlockSize, "calculateBlockSize"); + __name(insertBlockPositioned, "insertBlockPositioned"); + __name(performOperations, "performOperations"); + __name(calculateBlockSizes, "calculateBlockSizes"); + __name(insertBlocks, "insertBlocks"); + __name(insertEdges, "insertEdges"); + } + }); + + // src/diagrams/block/blockRenderer.ts + var getClasses5, draw24, blockRenderer_default; + var init_blockRenderer = __esm({ + "src/diagrams/block/blockRenderer.ts"() { + "use strict"; + init_src32(); + init_config(); + init_markers2(); + init_logger(); + init_setupGraphViewbox(); + init_layout3(); + init_renderHelpers(); + getClasses5 = /* @__PURE__ */ __name(function(text4, diagObj) { + return diagObj.db.getClasses(); + }, "getClasses"); + draw24 = /* @__PURE__ */ __name(async function(text4, id35, _version, diagObj) { + const { securityLevel, block: conf5 } = getConfig(); + const db10 = diagObj.db; + db10.setDiagramId(id35); + let sandboxElement; + if (securityLevel === "sandbox") { + sandboxElement = select_default2("#i" + id35); + } + const root4 = securityLevel === "sandbox" ? select_default2(sandboxElement.nodes()[0].contentDocument.body) : select_default2("body"); + const svg2 = securityLevel === "sandbox" ? root4.select(`[id="${id35}"]`) : select_default2(`[id="${id35}"]`); + const markers3 = ["point", "circle", "cross"]; + markers_default2(svg2, markers3, diagObj.type, id35); + const bl = db10.getBlocks(); + const blArr = db10.getBlocksFlat(); + const edges3 = db10.getEdges(); + const nodes5 = svg2.insert("g").attr("class", "block"); + await calculateBlockSizes(nodes5, bl, db10); + const bounds4 = layout5(db10); + await insertBlocks(nodes5, bl, db10); + await insertEdges(nodes5, edges3, blArr, db10, id35); + if (bounds4) { + const bounds22 = bounds4; + const magicFactor = Math.max(1, Math.round(0.125 * (bounds22.width / bounds22.height))); + const height2 = bounds22.height + magicFactor + 10; + const width3 = bounds22.width + 10; + const { useMaxWidth } = conf5; + configureSvgSize(svg2, height2, width3, !!useMaxWidth); + log.debug("Here Bounds", bounds4, bounds22); + svg2.attr( + "viewBox", + `${bounds22.x - 5} ${bounds22.y - 5} ${bounds22.width + 10} ${bounds22.height + 10}` + ); + } + }, "draw"); + blockRenderer_default = { + draw: draw24, + getClasses: getClasses5 + }; + } + }); + + // src/diagrams/block/blockDiagram.ts + var blockDiagram_exports = {}; + __export(blockDiagram_exports, { + diagram: () => diagram24 + }); + var diagram24; + var init_blockDiagram = __esm({ + "src/diagrams/block/blockDiagram.ts"() { + "use strict"; + init_block(); + init_blockDB(); + init_styles18(); + init_blockRenderer(); + diagram24 = { + parser: block_default, + db: blockDB_default, + renderer: blockRenderer_default, + styles: styles_default16 + }; + } + }); + + // src/diagrams/treeView/db.ts + var state3, clear19, getRoot, getCount, defaultConfig4, getConfig6, addNode2, db7, db_default; + var init_db3 = __esm({ + "src/diagrams/treeView/db.ts"() { + "use strict"; + init_config(); + init_defaultConfig(); + init_commonDb(); + init_utils2(); + init_imperativeState(); + state3 = new ImperativeState(() => ({ + cnt: 1, + stack: [ + { + id: 0, + level: -1, + name: "/", + children: [] + } + ] + })); + clear19 = /* @__PURE__ */ __name(() => { + state3.reset(); + clear(); + }, "clear"); + getRoot = /* @__PURE__ */ __name(() => { + return state3.records.stack[0]; + }, "getRoot"); + getCount = /* @__PURE__ */ __name(() => state3.records.cnt, "getCount"); + defaultConfig4 = defaultConfig_default.treeView; + getConfig6 = /* @__PURE__ */ __name(() => { + return cleanAndMerge(defaultConfig4, getConfig().treeView); + }, "getConfig"); + addNode2 = /* @__PURE__ */ __name((level, name) => { + while (level <= state3.records.stack[state3.records.stack.length - 1].level) { + state3.records.stack.pop(); + } + const node2 = { + id: state3.records.cnt++, + level, + name, + children: [] + }; + state3.records.stack[state3.records.stack.length - 1].children.push(node2); + state3.records.stack.push(node2); + }, "addNode"); + db7 = { + clear: clear19, + addNode: addNode2, + getRoot, + getCount, + getConfig: getConfig6, + getAccTitle, + getAccDescription, + getDiagramTitle, + setAccDescription, + setAccTitle, + setDiagramTitle + }; + db_default = db7; + } + }); + + // src/diagrams/treeView/parser.ts + var populate18, parser22; + var init_parser3 = __esm({ + "src/diagrams/treeView/parser.ts"() { + "use strict"; + init_logger(); + init_populateCommonDb(); + init_db3(); + init_mermaid_parser_core(); + populate18 = /* @__PURE__ */ __name((ast) => { + populateCommonDb(ast, db_default); + ast.nodes.map((node2) => db_default.addNode(node2.indent ? parseInt(node2.indent) : 0, node2.name)); + }, "populate"); + parser22 = { + parse: /* @__PURE__ */ __name(async (input) => { + const ast = await parse3("treeView", input); + log.debug(ast); + populate18(ast); + }, "parse") + }; + } + }); + + // src/diagrams/treeView/renderer.ts + var positionLabel, positionLine, drawTree, draw25, renderer8, renderer_default; + var init_renderer3 = __esm({ + "src/diagrams/treeView/renderer.ts"() { + "use strict"; + init_logger(); + init_selectSvgElement(); + init_setupGraphViewbox(); + positionLabel = /* @__PURE__ */ __name((x5, y6, node2, domElem, config5) => { + const label = domElem.append("text").text(node2.name).attr("dominant-baseline", "middle").attr("class", "treeView-node-label"); + const { height: labelHeight, width: labelWidth } = label.node().getBBox(); + const height2 = labelHeight + config5.paddingY * 2; + const width3 = labelWidth + config5.paddingX * 2; + label.attr("x", x5 + config5.paddingX); + label.attr("y", y6 + height2 / 2); + node2.BBox = { + x: x5, + y: y6, + width: width3, + height: height2 + }; + }, "positionLabel"); + positionLine = /* @__PURE__ */ __name((domElem, x1, y1, x22, y22, lineThickness) => { + return domElem.append("line").attr("x1", x1).attr("y1", y1).attr("x2", x22).attr("y2", y22).attr("stroke-width", lineThickness).attr("class", "treeView-node-line"); + }, "positionLine"); + drawTree = /* @__PURE__ */ __name((elem, root4, config5) => { + let totalHeight = 0; + let totalWidth = 0; + const drawNode2 = /* @__PURE__ */ __name((elem2, node2, config6, depth) => { + const indent = depth * (config6.rowIndent + config6.paddingX); + positionLabel(indent, totalHeight, node2, elem2, config6); + const { height: height2, width: width3 } = node2.BBox; + positionLine( + elem2, + indent - config6.rowIndent, + totalHeight + height2 / 2, + indent, + totalHeight + height2 / 2, + config6.lineThickness + ); + totalWidth = Math.max(totalWidth, indent + width3); + totalHeight += height2; + }, "drawNode"); + const processNode = /* @__PURE__ */ __name((node2, depth = 0) => { + drawNode2(elem, node2, config5, depth); + node2.children.forEach((child) => { + processNode(child, depth + 1); + }); + const { x: x5, y: y6, height: height2 } = node2.BBox; + if (node2.children.length) { + const { y: endY, height: endHeight } = node2.children[node2.children.length - 1].BBox; + positionLine( + elem, + x5 + config5.paddingX, + y6 + height2, + x5 + config5.paddingX, + endY + endHeight / 2 + config5.lineThickness / 2, + config5.lineThickness + ); + } + }, "processNode"); + processNode(root4); + return { totalHeight, totalWidth }; + }, "drawTree"); + draw25 = /* @__PURE__ */ __name((text4, id35, _ver, diagObj) => { + log.debug("Rendering treeView diagram\n" + text4); + const db10 = diagObj.db; + const root4 = db10.getRoot(); + const config5 = db10.getConfig(); + const svg2 = selectSvgElement(id35); + const treeElem = svg2.append("g"); + treeElem.attr("class", "tree-view"); + const { totalHeight, totalWidth } = drawTree(treeElem, root4, config5); + svg2.attr("viewBox", `-${config5.lineThickness / 2} 0 ${totalWidth} ${totalHeight}`); + configureSvgSize(svg2, totalHeight, totalWidth, config5.useMaxWidth); + }, "draw"); + renderer8 = { + draw: draw25 + }; + renderer_default = renderer8; + } + }); + + // src/diagrams/treeView/styles.ts + var defaultTreeViewDiagramStyles, styles4, styles_default17; + var init_styles19 = __esm({ + "src/diagrams/treeView/styles.ts"() { + "use strict"; + init_utils2(); + defaultTreeViewDiagramStyles = { + labelFontSize: "16px", + labelColor: "black", + lineColor: "black" + }; + styles4 = /* @__PURE__ */ __name(({ + treeView + }) => { + const { labelFontSize, labelColor, lineColor } = cleanAndMerge( + defaultTreeViewDiagramStyles, + treeView + ); + return ` + .treeView-node-label { + font-size: ${labelFontSize}; + fill: ${labelColor}; + } + .treeView-node-line { + stroke: ${lineColor}; + } + `; + }, "styles"); + styles_default17 = styles4; + } + }); + + // src/diagrams/treeView/diagram.ts + var diagram_exports3 = {}; + __export(diagram_exports3, { + diagram: () => diagram25 + }); + var diagram25; + var init_diagram3 = __esm({ + "src/diagrams/treeView/diagram.ts"() { + "use strict"; + init_parser3(); + init_db3(); + init_renderer3(); + init_styles19(); + diagram25 = { + db: db_default, + renderer: renderer_default, + parser: parser22, + styles: styles_default17 + }; + } + }); + + // src/diagrams/architecture/architectureTypes.ts + var ArchitectureDirectionName, ArchitectureDirectionArrow, ArchitectureDirectionArrowShift, getOppositeArchitectureDirection, isArchitectureDirection, isArchitectureDirectionX, isArchitectureDirectionY, isArchitectureDirectionXY, isArchitecturePairXY, isValidArchitectureDirectionPair, getArchitectureDirectionPair, shiftPositionByArchitectureDirectionPair, getArchitectureDirectionXYFactors, getArchitectureDirectionAlignment, isArchitectureService, isArchitectureJunction, edgeData, nodeData; + var init_architectureTypes = __esm({ + "src/diagrams/architecture/architectureTypes.ts"() { + "use strict"; + ArchitectureDirectionName = { + L: "left", + R: "right", + T: "top", + B: "bottom" + }; + ArchitectureDirectionArrow = { + L: /* @__PURE__ */ __name((scale3) => `${scale3},${scale3 / 2} 0,${scale3} 0,0`, "L"), + R: /* @__PURE__ */ __name((scale3) => `0,${scale3 / 2} ${scale3},0 ${scale3},${scale3}`, "R"), + T: /* @__PURE__ */ __name((scale3) => `0,0 ${scale3},0 ${scale3 / 2},${scale3}`, "T"), + B: /* @__PURE__ */ __name((scale3) => `${scale3 / 2},0 ${scale3},${scale3} 0,${scale3}`, "B") + }; + ArchitectureDirectionArrowShift = { + L: /* @__PURE__ */ __name((orig, arrowSize) => orig - arrowSize + 2, "L"), + R: /* @__PURE__ */ __name((orig, _arrowSize) => orig - 2, "R"), + T: /* @__PURE__ */ __name((orig, arrowSize) => orig - arrowSize + 2, "T"), + B: /* @__PURE__ */ __name((orig, _arrowSize) => orig - 2, "B") + }; + getOppositeArchitectureDirection = /* @__PURE__ */ __name(function(x5) { + if (isArchitectureDirectionX(x5)) { + return x5 === "L" ? "R" : "L"; + } else { + return x5 === "T" ? "B" : "T"; + } + }, "getOppositeArchitectureDirection"); + isArchitectureDirection = /* @__PURE__ */ __name(function(x5) { + const temp = x5; + return temp === "L" || temp === "R" || temp === "T" || temp === "B"; + }, "isArchitectureDirection"); + isArchitectureDirectionX = /* @__PURE__ */ __name(function(x5) { + const temp = x5; + return temp === "L" || temp === "R"; + }, "isArchitectureDirectionX"); + isArchitectureDirectionY = /* @__PURE__ */ __name(function(x5) { + const temp = x5; + return temp === "T" || temp === "B"; + }, "isArchitectureDirectionY"); + isArchitectureDirectionXY = /* @__PURE__ */ __name(function(a2, b3) { + const aX_bY = isArchitectureDirectionX(a2) && isArchitectureDirectionY(b3); + const aY_bX = isArchitectureDirectionY(a2) && isArchitectureDirectionX(b3); + return aX_bY || aY_bX; + }, "isArchitectureDirectionXY"); + isArchitecturePairXY = /* @__PURE__ */ __name(function(pair) { + const lhs = pair[0]; + const rhs = pair[1]; + const aX_bY = isArchitectureDirectionX(lhs) && isArchitectureDirectionY(rhs); + const aY_bX = isArchitectureDirectionY(lhs) && isArchitectureDirectionX(rhs); + return aX_bY || aY_bX; + }, "isArchitecturePairXY"); + isValidArchitectureDirectionPair = /* @__PURE__ */ __name(function(x5) { + return x5 !== "LL" && x5 !== "RR" && x5 !== "TT" && x5 !== "BB"; + }, "isValidArchitectureDirectionPair"); + getArchitectureDirectionPair = /* @__PURE__ */ __name(function(sourceDir, targetDir) { + const pair = `${sourceDir}${targetDir}`; + return isValidArchitectureDirectionPair(pair) ? pair : void 0; + }, "getArchitectureDirectionPair"); + shiftPositionByArchitectureDirectionPair = /* @__PURE__ */ __name(function([x5, y6], pair) { + const lhs = pair[0]; + const rhs = pair[1]; + if (isArchitectureDirectionX(lhs)) { + if (isArchitectureDirectionY(rhs)) { + return [x5 + (lhs === "L" ? -1 : 1), y6 + (rhs === "T" ? 1 : -1)]; + } else { + return [x5 + (lhs === "L" ? -1 : 1), y6]; + } + } else { + if (isArchitectureDirectionX(rhs)) { + return [x5 + (rhs === "L" ? 1 : -1), y6 + (lhs === "T" ? 1 : -1)]; + } else { + return [x5, y6 + (lhs === "T" ? 1 : -1)]; + } + } + }, "shiftPositionByArchitectureDirectionPair"); + getArchitectureDirectionXYFactors = /* @__PURE__ */ __name(function(pair) { + if (pair === "LT" || pair === "TL") { + return [1, 1]; + } else if (pair === "BL" || pair === "LB") { + return [1, -1]; + } else if (pair === "BR" || pair === "RB") { + return [-1, -1]; + } else { + return [-1, 1]; + } + }, "getArchitectureDirectionXYFactors"); + getArchitectureDirectionAlignment = /* @__PURE__ */ __name(function(a2, b3) { + if (isArchitectureDirectionXY(a2, b3)) { + return "bend"; + } else if (isArchitectureDirectionX(a2)) { + return "horizontal"; + } + return "vertical"; + }, "getArchitectureDirectionAlignment"); + isArchitectureService = /* @__PURE__ */ __name(function(x5) { + const temp = x5; + return temp.type === "service"; + }, "isArchitectureService"); + isArchitectureJunction = /* @__PURE__ */ __name(function(x5) { + const temp = x5; + return temp.type === "junction"; + }, "isArchitectureJunction"); + edgeData = /* @__PURE__ */ __name((edge) => { + return edge.data(); + }, "edgeData"); + nodeData = /* @__PURE__ */ __name((node2) => { + return node2.data(); + }, "nodeData"); + } + }); + + // src/diagrams/architecture/architectureDb.ts + var DEFAULT_ARCHITECTURE_CONFIG, ArchitectureDB; + var init_architectureDb = __esm({ + "src/diagrams/architecture/architectureDb.ts"() { + "use strict"; + init_config(); + init_defaultConfig(); + init_utils2(); + init_commonDb(); + init_architectureTypes(); + DEFAULT_ARCHITECTURE_CONFIG = defaultConfig_default.architecture; + ArchitectureDB = class { + constructor() { + this.nodes = {}; + this.groups = {}; + this.edges = []; + this.registeredIds = {}; + this.elements = {}; + this.diagramId = ""; + this.setAccTitle = setAccTitle; + this.getAccTitle = getAccTitle; + this.setDiagramTitle = setDiagramTitle; + this.getDiagramTitle = getDiagramTitle; + this.getAccDescription = getAccDescription; + this.setAccDescription = setAccDescription; + this.clear(); + } + static { + __name(this, "ArchitectureDB"); + } + setDiagramId(id35) { + this.diagramId = id35; + } + getDiagramId() { + return this.diagramId; + } + clear() { + this.nodes = {}; + this.groups = {}; + this.edges = []; + this.registeredIds = {}; + this.dataStructures = void 0; + this.elements = {}; + this.diagramId = ""; + clear(); + } + addService({ + id: id35, + icon: icon2, + in: parent4, + title: title2, + iconText + }) { + if (this.registeredIds[id35] !== void 0) { + throw new Error( + `The service id [${id35}] is already in use by another ${this.registeredIds[id35]}` + ); + } + if (parent4 !== void 0) { + if (id35 === parent4) { + throw new Error(`The service [${id35}] cannot be placed within itself`); + } + if (this.registeredIds[parent4] === void 0) { + throw new Error( + `The service [${id35}]'s parent does not exist. Please make sure the parent is created before this service` + ); + } + if (this.registeredIds[parent4] === "node") { + throw new Error(`The service [${id35}]'s parent is not a group`); + } + } + this.registeredIds[id35] = "node"; + this.nodes[id35] = { + id: id35, + type: "service", + icon: icon2, + iconText, + title: title2, + edges: [], + in: parent4 + }; + } + getServices() { + return Object.values(this.nodes).filter(isArchitectureService); + } + addJunction({ id: id35, in: parent4 }) { + if (this.registeredIds[id35] !== void 0) { + throw new Error( + `The junction id [${id35}] is already in use by another ${this.registeredIds[id35]}` + ); + } + if (parent4 !== void 0) { + if (id35 === parent4) { + throw new Error(`The junction [${id35}] cannot be placed within itself`); + } + if (this.registeredIds[parent4] === void 0) { + throw new Error( + `The junction [${id35}]'s parent does not exist. Please make sure the parent is created before this junction` + ); + } + if (this.registeredIds[parent4] === "node") { + throw new Error(`The junction [${id35}]'s parent is not a group`); + } + } + this.registeredIds[id35] = "node"; + this.nodes[id35] = { + id: id35, + type: "junction", + edges: [], + in: parent4 + }; + } + getJunctions() { + return Object.values(this.nodes).filter(isArchitectureJunction); + } + getNodes() { + return Object.values(this.nodes); + } + getNode(id35) { + return this.nodes[id35] ?? null; + } + addGroup({ id: id35, icon: icon2, in: parent4, title: title2 }) { + if (this.registeredIds?.[id35] !== void 0) { + throw new Error( + `The group id [${id35}] is already in use by another ${this.registeredIds[id35]}` + ); + } + if (parent4 !== void 0) { + if (id35 === parent4) { + throw new Error(`The group [${id35}] cannot be placed within itself`); + } + if (this.registeredIds?.[parent4] === void 0) { + throw new Error( + `The group [${id35}]'s parent does not exist. Please make sure the parent is created before this group` + ); + } + if (this.registeredIds?.[parent4] === "node") { + throw new Error(`The group [${id35}]'s parent is not a group`); + } + } + this.registeredIds[id35] = "group"; + this.groups[id35] = { + id: id35, + icon: icon2, + title: title2, + in: parent4 + }; + } + getGroups() { + return Object.values(this.groups); + } + addEdge({ + lhsId, + rhsId, + lhsDir, + rhsDir, + lhsInto, + rhsInto, + lhsGroup, + rhsGroup, + title: title2 + }) { + if (!isArchitectureDirection(lhsDir)) { + throw new Error( + `Invalid direction given for left hand side of edge ${lhsId}--${rhsId}. Expected (L,R,T,B) got ${String(lhsDir)}` + ); + } + if (!isArchitectureDirection(rhsDir)) { + throw new Error( + `Invalid direction given for right hand side of edge ${lhsId}--${rhsId}. Expected (L,R,T,B) got ${String(rhsDir)}` + ); + } + if (this.nodes[lhsId] === void 0 && this.groups[lhsId] === void 0) { + throw new Error( + `The left-hand id [${lhsId}] does not yet exist. Please create the service/group before declaring an edge to it.` + ); + } + if (this.nodes[rhsId] === void 0 && this.groups[rhsId] === void 0) { + throw new Error( + `The right-hand id [${rhsId}] does not yet exist. Please create the service/group before declaring an edge to it.` + ); + } + const lhsGroupId = this.nodes[lhsId].in; + const rhsGroupId = this.nodes[rhsId].in; + if (lhsGroup && lhsGroupId && rhsGroupId && lhsGroupId == rhsGroupId) { + throw new Error( + `The left-hand id [${lhsId}] is modified to traverse the group boundary, but the edge does not pass through two groups.` + ); + } + if (rhsGroup && lhsGroupId && rhsGroupId && lhsGroupId == rhsGroupId) { + throw new Error( + `The right-hand id [${rhsId}] is modified to traverse the group boundary, but the edge does not pass through two groups.` + ); + } + const edge = { + lhsId, + lhsDir, + lhsInto, + lhsGroup, + rhsId, + rhsDir, + rhsInto, + rhsGroup, + title: title2 + }; + this.edges.push(edge); + if (this.nodes[lhsId] && this.nodes[rhsId]) { + this.nodes[lhsId].edges.push(this.edges[this.edges.length - 1]); + this.nodes[rhsId].edges.push(this.edges[this.edges.length - 1]); + } + } + getEdges() { + return this.edges; + } + /** + * Returns the current diagram's adjacency list, spatial map, & group alignments. + * If they have not been created, run the algorithms to generate them. + * @returns + */ + getDataStructures() { + if (this.dataStructures === void 0) { + const groupAlignments = {}; + const adjList = Object.entries(this.nodes).reduce((prevOuter, [id35, service]) => { + prevOuter[id35] = service.edges.reduce((prevInner, edge) => { + const lhsGroupId = this.getNode(edge.lhsId)?.in; + const rhsGroupId = this.getNode(edge.rhsId)?.in; + if (lhsGroupId && rhsGroupId && lhsGroupId !== rhsGroupId) { + const alignment = getArchitectureDirectionAlignment(edge.lhsDir, edge.rhsDir); + if (alignment !== "bend") { + groupAlignments[lhsGroupId] ??= {}; + groupAlignments[lhsGroupId][rhsGroupId] = alignment; + groupAlignments[rhsGroupId] ??= {}; + groupAlignments[rhsGroupId][lhsGroupId] = alignment; + } + } + if (edge.lhsId === id35) { + const pair = getArchitectureDirectionPair(edge.lhsDir, edge.rhsDir); + if (pair) { + prevInner[pair] = edge.rhsId; + } + } else { + const pair = getArchitectureDirectionPair(edge.rhsDir, edge.lhsDir); + if (pair) { + prevInner[pair] = edge.lhsId; + } + } + return prevInner; + }, {}); + return prevOuter; + }, {}); + const firstId = Object.keys(adjList)[0]; + const visited = { [firstId]: 1 }; + const notVisited = Object.keys(adjList).reduce( + (prev2, id35) => id35 === firstId ? prev2 : { ...prev2, [id35]: 1 }, + {} + ); + const BFS = /* @__PURE__ */ __name((startingId) => { + const spatialMap = { [startingId]: [0, 0] }; + const queue = [startingId]; + while (queue.length > 0) { + const id35 = queue.shift(); + if (id35) { + visited[id35] = 1; + delete notVisited[id35]; + const adj = adjList[id35]; + const [posX, posY] = spatialMap[id35]; + Object.entries(adj).forEach(([dir2, rhsId]) => { + if (!visited[rhsId]) { + spatialMap[rhsId] = shiftPositionByArchitectureDirectionPair( + [posX, posY], + dir2 + ); + queue.push(rhsId); + } + }); + } + } + return spatialMap; + }, "BFS"); + const spatialMaps = [BFS(firstId)]; + while (Object.keys(notVisited).length > 0) { + spatialMaps.push(BFS(Object.keys(notVisited)[0])); + } + this.dataStructures = { + adjList, + spatialMaps, + groupAlignments + }; + } + return this.dataStructures; + } + setElementForId(id35, element3) { + this.elements[id35] = element3; + } + getElementById(id35) { + return this.elements[id35]; + } + getConfig() { + return cleanAndMerge({ + ...DEFAULT_ARCHITECTURE_CONFIG, + ...getConfig().architecture + }); + } + getConfigField(field) { + return this.getConfig()[field]; + } + }; + } + }); + + // src/diagrams/architecture/architectureParser.ts + var populateDb2, parser23; + var init_architectureParser = __esm({ + "src/diagrams/architecture/architectureParser.ts"() { + "use strict"; + init_mermaid_parser_core(); + init_logger(); + init_populateCommonDb(); + init_architectureDb(); + populateDb2 = /* @__PURE__ */ __name((ast, db10) => { + populateCommonDb(ast, db10); + ast.groups.map((group2) => db10.addGroup(group2)); + ast.services.map((service) => db10.addService({ ...service, type: "service" })); + ast.junctions.map((service) => db10.addJunction({ ...service, type: "junction" })); + ast.edges.map((edge) => db10.addEdge(edge)); + }, "populateDb"); + parser23 = { + parser: { + // @ts-expect-error - ArchitectureDB is not assignable to DiagramDB + yy: void 0 + }, + parse: /* @__PURE__ */ __name(async (input) => { + const ast = await parse3("architecture", input); + log.debug(ast); + const db10 = parser23.parser?.yy; + if (!(db10 instanceof ArchitectureDB)) { + throw new Error( + "parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues." + ); + } + populateDb2(ast, db10); + }, "parse") + }; + } + }); + + // src/diagrams/architecture/architectureStyles.ts + var getStyles18, architectureStyles_default; + var init_architectureStyles = __esm({ + "src/diagrams/architecture/architectureStyles.ts"() { + "use strict"; + getStyles18 = /* @__PURE__ */ __name((options2) => ` + .edge { + stroke-width: ${options2.archEdgeWidth}; + stroke: ${options2.archEdgeColor}; + fill: none; + } + + .arrow { + fill: ${options2.archEdgeArrowColor}; + } + + .node-bkg { + fill: none; + stroke: ${options2.archGroupBorderColor}; + stroke-width: ${options2.archGroupBorderWidth}; + stroke-dasharray: 8; + } + .node-icon-text { + display: flex; + align-items: center; + } + + .node-icon-text > div { + color: #fff; + margin: 1px; + height: fit-content; + text-align: center; + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + } +`, "getStyles"); + architectureStyles_default = getStyles18; + } + }); + + // ../../node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js + var require_layout_base2 = __commonJS({ + "../../node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js"(exports2, module2) { + "use strict"; + (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root4, factory) { + if (typeof exports2 === "object" && typeof module2 === "object") + module2.exports = factory(); + else if (typeof define === "function" && define.amd) + define([], factory); + else if (typeof exports2 === "object") + exports2["layoutBase"] = factory(); + else + root4["layoutBase"] = factory(); + }), "webpackUniversalModuleDefinition"))(exports2, function() { + return ( + /******/ + (function(modules2) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if (installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + var module3 = installedModules[moduleId] = { + /******/ + i: moduleId, + /******/ + l: false, + /******/ + exports: {} + /******/ + }; + modules2[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__); + module3.l = true; + return module3.exports; + } + __name(__webpack_require__, "__webpack_require__"); + __webpack_require__.m = modules2; + __webpack_require__.c = installedModules; + __webpack_require__.i = function(value2) { + return value2; + }; + __webpack_require__.d = function(exports3, name, getter) { + if (!__webpack_require__.o(exports3, name)) { + Object.defineProperty(exports3, name, { + /******/ + configurable: false, + /******/ + enumerable: true, + /******/ + get: getter + /******/ + }); + } + }; + __webpack_require__.n = function(module3) { + var getter = module3 && module3.__esModule ? ( + /******/ + /* @__PURE__ */ __name(function getDefault() { + return module3["default"]; + }, "getDefault") + ) : ( + /******/ + /* @__PURE__ */ __name(function getModuleExports() { + return module3; + }, "getModuleExports") + ); + __webpack_require__.d(getter, "a", getter); + return getter; + }; + __webpack_require__.o = function(object3, property3) { + return Object.prototype.hasOwnProperty.call(object3, property3); + }; + __webpack_require__.p = ""; + return __webpack_require__(__webpack_require__.s = 28); + })([ + /* 0 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function LayoutConstants() { + } + __name(LayoutConstants, "LayoutConstants"); + LayoutConstants.QUALITY = 1; + LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED = false; + LayoutConstants.DEFAULT_INCREMENTAL = false; + LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT = true; + LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT = false; + LayoutConstants.DEFAULT_ANIMATION_PERIOD = 50; + LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = false; + LayoutConstants.DEFAULT_GRAPH_MARGIN = 15; + LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = false; + LayoutConstants.SIMPLE_NODE_SIZE = 40; + LayoutConstants.SIMPLE_NODE_HALF_SIZE = LayoutConstants.SIMPLE_NODE_SIZE / 2; + LayoutConstants.EMPTY_COMPOUND_NODE_SIZE = 40; + LayoutConstants.MIN_EDGE_LENGTH = 1; + LayoutConstants.WORLD_BOUNDARY = 1e6; + LayoutConstants.INITIAL_WORLD_BOUNDARY = LayoutConstants.WORLD_BOUNDARY / 1e3; + LayoutConstants.WORLD_CENTER_X = 1200; + LayoutConstants.WORLD_CENTER_Y = 900; + module3.exports = LayoutConstants; + }), + /* 1 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraphObject = __webpack_require__(2); + var IGeometry = __webpack_require__(8); + var IMath = __webpack_require__(9); + function LEdge(source, target, vEdge) { + LGraphObject.call(this, vEdge); + this.isOverlapingSourceAndTarget = false; + this.vGraphObject = vEdge; + this.bendpoints = []; + this.source = source; + this.target = target; + } + __name(LEdge, "LEdge"); + LEdge.prototype = Object.create(LGraphObject.prototype); + for (var prop in LGraphObject) { + LEdge[prop] = LGraphObject[prop]; + } + LEdge.prototype.getSource = function() { + return this.source; + }; + LEdge.prototype.getTarget = function() { + return this.target; + }; + LEdge.prototype.isInterGraph = function() { + return this.isInterGraph; + }; + LEdge.prototype.getLength = function() { + return this.length; + }; + LEdge.prototype.isOverlapingSourceAndTarget = function() { + return this.isOverlapingSourceAndTarget; + }; + LEdge.prototype.getBendpoints = function() { + return this.bendpoints; + }; + LEdge.prototype.getLca = function() { + return this.lca; + }; + LEdge.prototype.getSourceInLca = function() { + return this.sourceInLca; + }; + LEdge.prototype.getTargetInLca = function() { + return this.targetInLca; + }; + LEdge.prototype.getOtherEnd = function(node2) { + if (this.source === node2) { + return this.target; + } else if (this.target === node2) { + return this.source; + } else { + throw "Node is not incident with this edge"; + } + }; + LEdge.prototype.getOtherEndInGraph = function(node2, graph) { + var otherEnd = this.getOtherEnd(node2); + var root4 = graph.getGraphManager().getRoot(); + while (true) { + if (otherEnd.getOwner() == graph) { + return otherEnd; + } + if (otherEnd.getOwner() == root4) { + break; + } + otherEnd = otherEnd.getOwner().getParent(); + } + return null; + }; + LEdge.prototype.updateLength = function() { + var clipPointCoordinates = new Array(4); + this.isOverlapingSourceAndTarget = IGeometry.getIntersection(this.target.getRect(), this.source.getRect(), clipPointCoordinates); + if (!this.isOverlapingSourceAndTarget) { + this.lengthX = clipPointCoordinates[0] - clipPointCoordinates[2]; + this.lengthY = clipPointCoordinates[1] - clipPointCoordinates[3]; + if (Math.abs(this.lengthX) < 1) { + this.lengthX = IMath.sign(this.lengthX); + } + if (Math.abs(this.lengthY) < 1) { + this.lengthY = IMath.sign(this.lengthY); + } + this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY); + } + }; + LEdge.prototype.updateLengthSimple = function() { + this.lengthX = this.target.getCenterX() - this.source.getCenterX(); + this.lengthY = this.target.getCenterY() - this.source.getCenterY(); + if (Math.abs(this.lengthX) < 1) { + this.lengthX = IMath.sign(this.lengthX); + } + if (Math.abs(this.lengthY) < 1) { + this.lengthY = IMath.sign(this.lengthY); + } + this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY); + }; + module3.exports = LEdge; + }), + /* 2 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function LGraphObject(vGraphObject) { + this.vGraphObject = vGraphObject; + } + __name(LGraphObject, "LGraphObject"); + module3.exports = LGraphObject; + }), + /* 3 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraphObject = __webpack_require__(2); + var Integer = __webpack_require__(10); + var RectangleD = __webpack_require__(13); + var LayoutConstants = __webpack_require__(0); + var RandomSeed = __webpack_require__(16); + var PointD = __webpack_require__(5); + function LNode(gm, loc, size4, vNode) { + if (size4 == null && vNode == null) { + vNode = loc; + } + LGraphObject.call(this, vNode); + if (gm.graphManager != null) gm = gm.graphManager; + this.estimatedSize = Integer.MIN_VALUE; + this.inclusionTreeDepth = Integer.MAX_VALUE; + this.vGraphObject = vNode; + this.edges = []; + this.graphManager = gm; + if (size4 != null && loc != null) this.rect = new RectangleD(loc.x, loc.y, size4.width, size4.height); + else this.rect = new RectangleD(); + } + __name(LNode, "LNode"); + LNode.prototype = Object.create(LGraphObject.prototype); + for (var prop in LGraphObject) { + LNode[prop] = LGraphObject[prop]; + } + LNode.prototype.getEdges = function() { + return this.edges; + }; + LNode.prototype.getChild = function() { + return this.child; + }; + LNode.prototype.getOwner = function() { + return this.owner; + }; + LNode.prototype.getWidth = function() { + return this.rect.width; + }; + LNode.prototype.setWidth = function(width3) { + this.rect.width = width3; + }; + LNode.prototype.getHeight = function() { + return this.rect.height; + }; + LNode.prototype.setHeight = function(height2) { + this.rect.height = height2; + }; + LNode.prototype.getCenterX = function() { + return this.rect.x + this.rect.width / 2; + }; + LNode.prototype.getCenterY = function() { + return this.rect.y + this.rect.height / 2; + }; + LNode.prototype.getCenter = function() { + return new PointD(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2); + }; + LNode.prototype.getLocation = function() { + return new PointD(this.rect.x, this.rect.y); + }; + LNode.prototype.getRect = function() { + return this.rect; + }; + LNode.prototype.getDiagonal = function() { + return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height); + }; + LNode.prototype.getHalfTheDiagonal = function() { + return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2; + }; + LNode.prototype.setRect = function(upperLeft, dimension) { + this.rect.x = upperLeft.x; + this.rect.y = upperLeft.y; + this.rect.width = dimension.width; + this.rect.height = dimension.height; + }; + LNode.prototype.setCenter = function(cx, cy) { + this.rect.x = cx - this.rect.width / 2; + this.rect.y = cy - this.rect.height / 2; + }; + LNode.prototype.setLocation = function(x5, y6) { + this.rect.x = x5; + this.rect.y = y6; + }; + LNode.prototype.moveBy = function(dx, dy) { + this.rect.x += dx; + this.rect.y += dy; + }; + LNode.prototype.getEdgeListToNode = function(to) { + var edgeList2 = []; + var edge; + var self2 = this; + self2.edges.forEach(function(edge2) { + if (edge2.target == to) { + if (edge2.source != self2) throw "Incorrect edge source!"; + edgeList2.push(edge2); + } + }); + return edgeList2; + }; + LNode.prototype.getEdgesBetween = function(other) { + var edgeList2 = []; + var edge; + var self2 = this; + self2.edges.forEach(function(edge2) { + if (!(edge2.source == self2 || edge2.target == self2)) throw "Incorrect edge source and/or target"; + if (edge2.target == other || edge2.source == other) { + edgeList2.push(edge2); + } + }); + return edgeList2; + }; + LNode.prototype.getNeighborsList = function() { + var neighbors = /* @__PURE__ */ new Set(); + var self2 = this; + self2.edges.forEach(function(edge) { + if (edge.source == self2) { + neighbors.add(edge.target); + } else { + if (edge.target != self2) { + throw "Incorrect incidency!"; + } + neighbors.add(edge.source); + } + }); + return neighbors; + }; + LNode.prototype.withChildren = function() { + var withNeighborsList = /* @__PURE__ */ new Set(); + var childNode; + var children2; + withNeighborsList.add(this); + if (this.child != null) { + var nodes5 = this.child.getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + childNode = nodes5[i2]; + children2 = childNode.withChildren(); + children2.forEach(function(node2) { + withNeighborsList.add(node2); + }); + } + } + return withNeighborsList; + }; + LNode.prototype.getNoOfChildren = function() { + var noOfChildren = 0; + var childNode; + if (this.child == null) { + noOfChildren = 1; + } else { + var nodes5 = this.child.getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + childNode = nodes5[i2]; + noOfChildren += childNode.getNoOfChildren(); + } + } + if (noOfChildren == 0) { + noOfChildren = 1; + } + return noOfChildren; + }; + LNode.prototype.getEstimatedSize = function() { + if (this.estimatedSize == Integer.MIN_VALUE) { + throw "assert failed"; + } + return this.estimatedSize; + }; + LNode.prototype.calcEstimatedSize = function() { + if (this.child == null) { + return this.estimatedSize = (this.rect.width + this.rect.height) / 2; + } else { + this.estimatedSize = this.child.calcEstimatedSize(); + this.rect.width = this.estimatedSize; + this.rect.height = this.estimatedSize; + return this.estimatedSize; + } + }; + LNode.prototype.scatter = function() { + var randomCenterX; + var randomCenterY; + var minX = -LayoutConstants.INITIAL_WORLD_BOUNDARY; + var maxX = LayoutConstants.INITIAL_WORLD_BOUNDARY; + randomCenterX = LayoutConstants.WORLD_CENTER_X + RandomSeed.nextDouble() * (maxX - minX) + minX; + var minY = -LayoutConstants.INITIAL_WORLD_BOUNDARY; + var maxY = LayoutConstants.INITIAL_WORLD_BOUNDARY; + randomCenterY = LayoutConstants.WORLD_CENTER_Y + RandomSeed.nextDouble() * (maxY - minY) + minY; + this.rect.x = randomCenterX; + this.rect.y = randomCenterY; + }; + LNode.prototype.updateBounds = function() { + if (this.getChild() == null) { + throw "assert failed"; + } + if (this.getChild().getNodes().length != 0) { + var childGraph = this.getChild(); + childGraph.updateBounds(true); + this.rect.x = childGraph.getLeft(); + this.rect.y = childGraph.getTop(); + this.setWidth(childGraph.getRight() - childGraph.getLeft()); + this.setHeight(childGraph.getBottom() - childGraph.getTop()); + if (LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS) { + var width3 = childGraph.getRight() - childGraph.getLeft(); + var height2 = childGraph.getBottom() - childGraph.getTop(); + if (this.labelWidth) { + if (this.labelPosHorizontal == "left") { + this.rect.x -= this.labelWidth; + this.setWidth(width3 + this.labelWidth); + } else if (this.labelPosHorizontal == "center" && this.labelWidth > width3) { + this.rect.x -= (this.labelWidth - width3) / 2; + this.setWidth(this.labelWidth); + } else if (this.labelPosHorizontal == "right") { + this.setWidth(width3 + this.labelWidth); + } + } + if (this.labelHeight) { + if (this.labelPosVertical == "top") { + this.rect.y -= this.labelHeight; + this.setHeight(height2 + this.labelHeight); + } else if (this.labelPosVertical == "center" && this.labelHeight > height2) { + this.rect.y -= (this.labelHeight - height2) / 2; + this.setHeight(this.labelHeight); + } else if (this.labelPosVertical == "bottom") { + this.setHeight(height2 + this.labelHeight); + } + } + } + } + }; + LNode.prototype.getInclusionTreeDepth = function() { + if (this.inclusionTreeDepth == Integer.MAX_VALUE) { + throw "assert failed"; + } + return this.inclusionTreeDepth; + }; + LNode.prototype.transform = function(trans) { + var left3 = this.rect.x; + if (left3 > LayoutConstants.WORLD_BOUNDARY) { + left3 = LayoutConstants.WORLD_BOUNDARY; + } else if (left3 < -LayoutConstants.WORLD_BOUNDARY) { + left3 = -LayoutConstants.WORLD_BOUNDARY; + } + var top2 = this.rect.y; + if (top2 > LayoutConstants.WORLD_BOUNDARY) { + top2 = LayoutConstants.WORLD_BOUNDARY; + } else if (top2 < -LayoutConstants.WORLD_BOUNDARY) { + top2 = -LayoutConstants.WORLD_BOUNDARY; + } + var leftTop = new PointD(left3, top2); + var vLeftTop = trans.inverseTransformPoint(leftTop); + this.setLocation(vLeftTop.x, vLeftTop.y); + }; + LNode.prototype.getLeft = function() { + return this.rect.x; + }; + LNode.prototype.getRight = function() { + return this.rect.x + this.rect.width; + }; + LNode.prototype.getTop = function() { + return this.rect.y; + }; + LNode.prototype.getBottom = function() { + return this.rect.y + this.rect.height; + }; + LNode.prototype.getParent = function() { + if (this.owner == null) { + return null; + } + return this.owner.getParent(); + }; + module3.exports = LNode; + }), + /* 4 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LayoutConstants = __webpack_require__(0); + function FDLayoutConstants() { + } + __name(FDLayoutConstants, "FDLayoutConstants"); + for (var prop in LayoutConstants) { + FDLayoutConstants[prop] = LayoutConstants[prop]; + } + FDLayoutConstants.MAX_ITERATIONS = 2500; + FDLayoutConstants.DEFAULT_EDGE_LENGTH = 50; + FDLayoutConstants.DEFAULT_SPRING_STRENGTH = 0.45; + FDLayoutConstants.DEFAULT_REPULSION_STRENGTH = 4500; + FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = 0.4; + FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1; + FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8; + FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5; + FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = true; + FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = true; + FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3; + FDLayoutConstants.COOLING_ADAPTATION_FACTOR = 0.33; + FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT = 1e3; + FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT = 5e3; + FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100; + FDLayoutConstants.MAX_NODE_DISPLACEMENT = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3; + FDLayoutConstants.MIN_REPULSION_DIST = FDLayoutConstants.DEFAULT_EDGE_LENGTH / 10; + FDLayoutConstants.CONVERGENCE_CHECK_PERIOD = 100; + FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1; + FDLayoutConstants.MIN_EDGE_LENGTH = 1; + FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD = 10; + module3.exports = FDLayoutConstants; + }), + /* 5 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function PointD(x5, y6) { + if (x5 == null && y6 == null) { + this.x = 0; + this.y = 0; + } else { + this.x = x5; + this.y = y6; + } + } + __name(PointD, "PointD"); + PointD.prototype.getX = function() { + return this.x; + }; + PointD.prototype.getY = function() { + return this.y; + }; + PointD.prototype.setX = function(x5) { + this.x = x5; + }; + PointD.prototype.setY = function(y6) { + this.y = y6; + }; + PointD.prototype.getDifference = function(pt) { + return new DimensionD(this.x - pt.x, this.y - pt.y); + }; + PointD.prototype.getCopy = function() { + return new PointD(this.x, this.y); + }; + PointD.prototype.translate = function(dim) { + this.x += dim.width; + this.y += dim.height; + return this; + }; + module3.exports = PointD; + }), + /* 6 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraphObject = __webpack_require__(2); + var Integer = __webpack_require__(10); + var LayoutConstants = __webpack_require__(0); + var LGraphManager = __webpack_require__(7); + var LNode = __webpack_require__(3); + var LEdge = __webpack_require__(1); + var RectangleD = __webpack_require__(13); + var Point3 = __webpack_require__(12); + var LinkedList = __webpack_require__(11); + function LGraph(parent4, obj2, vGraph) { + LGraphObject.call(this, vGraph); + this.estimatedSize = Integer.MIN_VALUE; + this.margin = LayoutConstants.DEFAULT_GRAPH_MARGIN; + this.edges = []; + this.nodes = []; + this.isConnected = false; + this.parent = parent4; + if (obj2 != null && obj2 instanceof LGraphManager) { + this.graphManager = obj2; + } else if (obj2 != null && obj2 instanceof Layout) { + this.graphManager = obj2.graphManager; + } + } + __name(LGraph, "LGraph"); + LGraph.prototype = Object.create(LGraphObject.prototype); + for (var prop in LGraphObject) { + LGraph[prop] = LGraphObject[prop]; + } + LGraph.prototype.getNodes = function() { + return this.nodes; + }; + LGraph.prototype.getEdges = function() { + return this.edges; + }; + LGraph.prototype.getGraphManager = function() { + return this.graphManager; + }; + LGraph.prototype.getParent = function() { + return this.parent; + }; + LGraph.prototype.getLeft = function() { + return this.left; + }; + LGraph.prototype.getRight = function() { + return this.right; + }; + LGraph.prototype.getTop = function() { + return this.top; + }; + LGraph.prototype.getBottom = function() { + return this.bottom; + }; + LGraph.prototype.isConnected = function() { + return this.isConnected; + }; + LGraph.prototype.add = function(obj1, sourceNode, targetNode) { + if (sourceNode == null && targetNode == null) { + var newNode = obj1; + if (this.graphManager == null) { + throw "Graph has no graph mgr!"; + } + if (this.getNodes().indexOf(newNode) > -1) { + throw "Node already in graph!"; + } + newNode.owner = this; + this.getNodes().push(newNode); + return newNode; + } else { + var newEdge = obj1; + if (!(this.getNodes().indexOf(sourceNode) > -1 && this.getNodes().indexOf(targetNode) > -1)) { + throw "Source or target not in graph!"; + } + if (!(sourceNode.owner == targetNode.owner && sourceNode.owner == this)) { + throw "Both owners must be this graph!"; + } + if (sourceNode.owner != targetNode.owner) { + return null; + } + newEdge.source = sourceNode; + newEdge.target = targetNode; + newEdge.isInterGraph = false; + this.getEdges().push(newEdge); + sourceNode.edges.push(newEdge); + if (targetNode != sourceNode) { + targetNode.edges.push(newEdge); + } + return newEdge; + } + }; + LGraph.prototype.remove = function(obj) { + var node2 = obj; + if (obj instanceof LNode) { + if (node2 == null) { + throw "Node is null!"; + } + if (!(node2.owner != null && node2.owner == this)) { + throw "Owner graph is invalid!"; + } + if (this.graphManager == null) { + throw "Owner graph manager is invalid!"; + } + var edgesToBeRemoved = node2.edges.slice(); + var edge; + var s2 = edgesToBeRemoved.length; + for (var i2 = 0; i2 < s2; i2++) { + edge = edgesToBeRemoved[i2]; + if (edge.isInterGraph) { + this.graphManager.remove(edge); + } else { + edge.source.owner.remove(edge); + } + } + var index = this.nodes.indexOf(node2); + if (index == -1) { + throw "Node not in owner node list!"; + } + this.nodes.splice(index, 1); + } else if (obj instanceof LEdge) { + var edge = obj; + if (edge == null) { + throw "Edge is null!"; + } + if (!(edge.source != null && edge.target != null)) { + throw "Source and/or target is null!"; + } + if (!(edge.source.owner != null && edge.target.owner != null && edge.source.owner == this && edge.target.owner == this)) { + throw "Source and/or target owner is invalid!"; + } + var sourceIndex = edge.source.edges.indexOf(edge); + var targetIndex = edge.target.edges.indexOf(edge); + if (!(sourceIndex > -1 && targetIndex > -1)) { + throw "Source and/or target doesn't know this edge!"; + } + edge.source.edges.splice(sourceIndex, 1); + if (edge.target != edge.source) { + edge.target.edges.splice(targetIndex, 1); + } + var index = edge.source.owner.getEdges().indexOf(edge); + if (index == -1) { + throw "Not in owner's edge list!"; + } + edge.source.owner.getEdges().splice(index, 1); + } + }; + LGraph.prototype.updateLeftTop = function() { + var top2 = Integer.MAX_VALUE; + var left3 = Integer.MAX_VALUE; + var nodeTop; + var nodeLeft; + var margin; + var nodes5 = this.getNodes(); + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + var lNode = nodes5[i2]; + nodeTop = lNode.getTop(); + nodeLeft = lNode.getLeft(); + if (top2 > nodeTop) { + top2 = nodeTop; + } + if (left3 > nodeLeft) { + left3 = nodeLeft; + } + } + if (top2 == Integer.MAX_VALUE) { + return null; + } + if (nodes5[0].getParent().paddingLeft != void 0) { + margin = nodes5[0].getParent().paddingLeft; + } else { + margin = this.margin; + } + this.left = left3 - margin; + this.top = top2 - margin; + return new Point3(this.left, this.top); + }; + LGraph.prototype.updateBounds = function(recursive) { + var left3 = Integer.MAX_VALUE; + var right3 = -Integer.MAX_VALUE; + var top2 = Integer.MAX_VALUE; + var bottom2 = -Integer.MAX_VALUE; + var nodeLeft; + var nodeRight; + var nodeTop; + var nodeBottom; + var margin; + var nodes5 = this.nodes; + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + var lNode = nodes5[i2]; + if (recursive && lNode.child != null) { + lNode.updateBounds(); + } + nodeLeft = lNode.getLeft(); + nodeRight = lNode.getRight(); + nodeTop = lNode.getTop(); + nodeBottom = lNode.getBottom(); + if (left3 > nodeLeft) { + left3 = nodeLeft; + } + if (right3 < nodeRight) { + right3 = nodeRight; + } + if (top2 > nodeTop) { + top2 = nodeTop; + } + if (bottom2 < nodeBottom) { + bottom2 = nodeBottom; + } + } + var boundingRect = new RectangleD(left3, top2, right3 - left3, bottom2 - top2); + if (left3 == Integer.MAX_VALUE) { + this.left = this.parent.getLeft(); + this.right = this.parent.getRight(); + this.top = this.parent.getTop(); + this.bottom = this.parent.getBottom(); + } + if (nodes5[0].getParent().paddingLeft != void 0) { + margin = nodes5[0].getParent().paddingLeft; + } else { + margin = this.margin; + } + this.left = boundingRect.x - margin; + this.right = boundingRect.x + boundingRect.width + margin; + this.top = boundingRect.y - margin; + this.bottom = boundingRect.y + boundingRect.height + margin; + }; + LGraph.calculateBounds = function(nodes5) { + var left3 = Integer.MAX_VALUE; + var right3 = -Integer.MAX_VALUE; + var top2 = Integer.MAX_VALUE; + var bottom2 = -Integer.MAX_VALUE; + var nodeLeft; + var nodeRight; + var nodeTop; + var nodeBottom; + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + var lNode = nodes5[i2]; + nodeLeft = lNode.getLeft(); + nodeRight = lNode.getRight(); + nodeTop = lNode.getTop(); + nodeBottom = lNode.getBottom(); + if (left3 > nodeLeft) { + left3 = nodeLeft; + } + if (right3 < nodeRight) { + right3 = nodeRight; + } + if (top2 > nodeTop) { + top2 = nodeTop; + } + if (bottom2 < nodeBottom) { + bottom2 = nodeBottom; + } + } + var boundingRect = new RectangleD(left3, top2, right3 - left3, bottom2 - top2); + return boundingRect; + }; + LGraph.prototype.getInclusionTreeDepth = function() { + if (this == this.graphManager.getRoot()) { + return 1; + } else { + return this.parent.getInclusionTreeDepth(); + } + }; + LGraph.prototype.getEstimatedSize = function() { + if (this.estimatedSize == Integer.MIN_VALUE) { + throw "assert failed"; + } + return this.estimatedSize; + }; + LGraph.prototype.calcEstimatedSize = function() { + var size4 = 0; + var nodes5 = this.nodes; + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + var lNode = nodes5[i2]; + size4 += lNode.calcEstimatedSize(); + } + if (size4 == 0) { + this.estimatedSize = LayoutConstants.EMPTY_COMPOUND_NODE_SIZE; + } else { + this.estimatedSize = size4 / Math.sqrt(this.nodes.length); + } + return this.estimatedSize; + }; + LGraph.prototype.updateConnected = function() { + var self2 = this; + if (this.nodes.length == 0) { + this.isConnected = true; + return; + } + var queue = new LinkedList(); + var visited = /* @__PURE__ */ new Set(); + var currentNode = this.nodes[0]; + var neighborEdges; + var currentNeighbor; + var childrenOfNode = currentNode.withChildren(); + childrenOfNode.forEach(function(node2) { + queue.push(node2); + visited.add(node2); + }); + while (queue.length !== 0) { + currentNode = queue.shift(); + neighborEdges = currentNode.getEdges(); + var size4 = neighborEdges.length; + for (var i2 = 0; i2 < size4; i2++) { + var neighborEdge = neighborEdges[i2]; + currentNeighbor = neighborEdge.getOtherEndInGraph(currentNode, this); + if (currentNeighbor != null && !visited.has(currentNeighbor)) { + var childrenOfNeighbor = currentNeighbor.withChildren(); + childrenOfNeighbor.forEach(function(node2) { + queue.push(node2); + visited.add(node2); + }); + } + } + } + this.isConnected = false; + if (visited.size >= this.nodes.length) { + var noOfVisitedInThisGraph = 0; + visited.forEach(function(visitedNode) { + if (visitedNode.owner == self2) { + noOfVisitedInThisGraph++; + } + }); + if (noOfVisitedInThisGraph == this.nodes.length) { + this.isConnected = true; + } + } + }; + module3.exports = LGraph; + }), + /* 7 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LGraph; + var LEdge = __webpack_require__(1); + function LGraphManager(layout7) { + LGraph = __webpack_require__(6); + this.layout = layout7; + this.graphs = []; + this.edges = []; + } + __name(LGraphManager, "LGraphManager"); + LGraphManager.prototype.addRoot = function() { + var ngraph = this.layout.newGraph(); + var nnode = this.layout.newNode(null); + var root4 = this.add(ngraph, nnode); + this.setRootGraph(root4); + return this.rootGraph; + }; + LGraphManager.prototype.add = function(newGraph, parentNode, newEdge, sourceNode, targetNode) { + if (newEdge == null && sourceNode == null && targetNode == null) { + if (newGraph == null) { + throw "Graph is null!"; + } + if (parentNode == null) { + throw "Parent node is null!"; + } + if (this.graphs.indexOf(newGraph) > -1) { + throw "Graph already in this graph mgr!"; + } + this.graphs.push(newGraph); + if (newGraph.parent != null) { + throw "Already has a parent!"; + } + if (parentNode.child != null) { + throw "Already has a child!"; + } + newGraph.parent = parentNode; + parentNode.child = newGraph; + return newGraph; + } else { + targetNode = newEdge; + sourceNode = parentNode; + newEdge = newGraph; + var sourceGraph = sourceNode.getOwner(); + var targetGraph = targetNode.getOwner(); + if (!(sourceGraph != null && sourceGraph.getGraphManager() == this)) { + throw "Source not in this graph mgr!"; + } + if (!(targetGraph != null && targetGraph.getGraphManager() == this)) { + throw "Target not in this graph mgr!"; + } + if (sourceGraph == targetGraph) { + newEdge.isInterGraph = false; + return sourceGraph.add(newEdge, sourceNode, targetNode); + } else { + newEdge.isInterGraph = true; + newEdge.source = sourceNode; + newEdge.target = targetNode; + if (this.edges.indexOf(newEdge) > -1) { + throw "Edge already in inter-graph edge list!"; + } + this.edges.push(newEdge); + if (!(newEdge.source != null && newEdge.target != null)) { + throw "Edge source and/or target is null!"; + } + if (!(newEdge.source.edges.indexOf(newEdge) == -1 && newEdge.target.edges.indexOf(newEdge) == -1)) { + throw "Edge already in source and/or target incidency list!"; + } + newEdge.source.edges.push(newEdge); + newEdge.target.edges.push(newEdge); + return newEdge; + } + } + }; + LGraphManager.prototype.remove = function(lObj) { + if (lObj instanceof LGraph) { + var graph = lObj; + if (graph.getGraphManager() != this) { + throw "Graph not in this graph mgr"; + } + if (!(graph == this.rootGraph || graph.parent != null && graph.parent.graphManager == this)) { + throw "Invalid parent node!"; + } + var edgesToBeRemoved = []; + edgesToBeRemoved = edgesToBeRemoved.concat(graph.getEdges()); + var edge; + var s2 = edgesToBeRemoved.length; + for (var i2 = 0; i2 < s2; i2++) { + edge = edgesToBeRemoved[i2]; + graph.remove(edge); + } + var nodesToBeRemoved = []; + nodesToBeRemoved = nodesToBeRemoved.concat(graph.getNodes()); + var node2; + s2 = nodesToBeRemoved.length; + for (var i2 = 0; i2 < s2; i2++) { + node2 = nodesToBeRemoved[i2]; + graph.remove(node2); + } + if (graph == this.rootGraph) { + this.setRootGraph(null); + } + var index = this.graphs.indexOf(graph); + this.graphs.splice(index, 1); + graph.parent = null; + } else if (lObj instanceof LEdge) { + edge = lObj; + if (edge == null) { + throw "Edge is null!"; + } + if (!edge.isInterGraph) { + throw "Not an inter-graph edge!"; + } + if (!(edge.source != null && edge.target != null)) { + throw "Source and/or target is null!"; + } + if (!(edge.source.edges.indexOf(edge) != -1 && edge.target.edges.indexOf(edge) != -1)) { + throw "Source and/or target doesn't know this edge!"; + } + var index = edge.source.edges.indexOf(edge); + edge.source.edges.splice(index, 1); + index = edge.target.edges.indexOf(edge); + edge.target.edges.splice(index, 1); + if (!(edge.source.owner != null && edge.source.owner.getGraphManager() != null)) { + throw "Edge owner graph or owner graph manager is null!"; + } + if (edge.source.owner.getGraphManager().edges.indexOf(edge) == -1) { + throw "Not in owner graph manager's edge list!"; + } + var index = edge.source.owner.getGraphManager().edges.indexOf(edge); + edge.source.owner.getGraphManager().edges.splice(index, 1); + } + }; + LGraphManager.prototype.updateBounds = function() { + this.rootGraph.updateBounds(true); + }; + LGraphManager.prototype.getGraphs = function() { + return this.graphs; + }; + LGraphManager.prototype.getAllNodes = function() { + if (this.allNodes == null) { + var nodeList = []; + var graphs = this.getGraphs(); + var s2 = graphs.length; + for (var i2 = 0; i2 < s2; i2++) { + nodeList = nodeList.concat(graphs[i2].getNodes()); + } + this.allNodes = nodeList; + } + return this.allNodes; + }; + LGraphManager.prototype.resetAllNodes = function() { + this.allNodes = null; + }; + LGraphManager.prototype.resetAllEdges = function() { + this.allEdges = null; + }; + LGraphManager.prototype.resetAllNodesToApplyGravitation = function() { + this.allNodesToApplyGravitation = null; + }; + LGraphManager.prototype.getAllEdges = function() { + if (this.allEdges == null) { + var edgeList2 = []; + var graphs = this.getGraphs(); + var s2 = graphs.length; + for (var i2 = 0; i2 < graphs.length; i2++) { + edgeList2 = edgeList2.concat(graphs[i2].getEdges()); + } + edgeList2 = edgeList2.concat(this.edges); + this.allEdges = edgeList2; + } + return this.allEdges; + }; + LGraphManager.prototype.getAllNodesToApplyGravitation = function() { + return this.allNodesToApplyGravitation; + }; + LGraphManager.prototype.setAllNodesToApplyGravitation = function(nodeList) { + if (this.allNodesToApplyGravitation != null) { + throw "assert failed"; + } + this.allNodesToApplyGravitation = nodeList; + }; + LGraphManager.prototype.getRoot = function() { + return this.rootGraph; + }; + LGraphManager.prototype.setRootGraph = function(graph) { + if (graph.getGraphManager() != this) { + throw "Root not in this graph mgr!"; + } + this.rootGraph = graph; + if (graph.parent == null) { + graph.parent = this.layout.newNode("Root node"); + } + }; + LGraphManager.prototype.getLayout = function() { + return this.layout; + }; + LGraphManager.prototype.isOneAncestorOfOther = function(firstNode, secondNode) { + if (!(firstNode != null && secondNode != null)) { + throw "assert failed"; + } + if (firstNode == secondNode) { + return true; + } + var ownerGraph = firstNode.getOwner(); + var parentNode; + do { + parentNode = ownerGraph.getParent(); + if (parentNode == null) { + break; + } + if (parentNode == secondNode) { + return true; + } + ownerGraph = parentNode.getOwner(); + if (ownerGraph == null) { + break; + } + } while (true); + ownerGraph = secondNode.getOwner(); + do { + parentNode = ownerGraph.getParent(); + if (parentNode == null) { + break; + } + if (parentNode == firstNode) { + return true; + } + ownerGraph = parentNode.getOwner(); + if (ownerGraph == null) { + break; + } + } while (true); + return false; + }; + LGraphManager.prototype.calcLowestCommonAncestors = function() { + var edge; + var sourceNode; + var targetNode; + var sourceAncestorGraph; + var targetAncestorGraph; + var edges3 = this.getAllEdges(); + var s2 = edges3.length; + for (var i2 = 0; i2 < s2; i2++) { + edge = edges3[i2]; + sourceNode = edge.source; + targetNode = edge.target; + edge.lca = null; + edge.sourceInLca = sourceNode; + edge.targetInLca = targetNode; + if (sourceNode == targetNode) { + edge.lca = sourceNode.getOwner(); + continue; + } + sourceAncestorGraph = sourceNode.getOwner(); + while (edge.lca == null) { + edge.targetInLca = targetNode; + targetAncestorGraph = targetNode.getOwner(); + while (edge.lca == null) { + if (targetAncestorGraph == sourceAncestorGraph) { + edge.lca = targetAncestorGraph; + break; + } + if (targetAncestorGraph == this.rootGraph) { + break; + } + if (edge.lca != null) { + throw "assert failed"; + } + edge.targetInLca = targetAncestorGraph.getParent(); + targetAncestorGraph = edge.targetInLca.getOwner(); + } + if (sourceAncestorGraph == this.rootGraph) { + break; + } + if (edge.lca == null) { + edge.sourceInLca = sourceAncestorGraph.getParent(); + sourceAncestorGraph = edge.sourceInLca.getOwner(); + } + } + if (edge.lca == null) { + throw "assert failed"; + } + } + }; + LGraphManager.prototype.calcLowestCommonAncestor = function(firstNode, secondNode) { + if (firstNode == secondNode) { + return firstNode.getOwner(); + } + var firstOwnerGraph = firstNode.getOwner(); + do { + if (firstOwnerGraph == null) { + break; + } + var secondOwnerGraph = secondNode.getOwner(); + do { + if (secondOwnerGraph == null) { + break; + } + if (secondOwnerGraph == firstOwnerGraph) { + return secondOwnerGraph; + } + secondOwnerGraph = secondOwnerGraph.getParent().getOwner(); + } while (true); + firstOwnerGraph = firstOwnerGraph.getParent().getOwner(); + } while (true); + return firstOwnerGraph; + }; + LGraphManager.prototype.calcInclusionTreeDepths = function(graph, depth) { + if (graph == null && depth == null) { + graph = this.rootGraph; + depth = 1; + } + var node2; + var nodes5 = graph.getNodes(); + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + node2 = nodes5[i2]; + node2.inclusionTreeDepth = depth; + if (node2.child != null) { + this.calcInclusionTreeDepths(node2.child, depth + 1); + } + } + }; + LGraphManager.prototype.includesInvalidEdge = function() { + var edge; + var edgesToRemove = []; + var s2 = this.edges.length; + for (var i2 = 0; i2 < s2; i2++) { + edge = this.edges[i2]; + if (this.isOneAncestorOfOther(edge.source, edge.target)) { + edgesToRemove.push(edge); + } + } + for (var i2 = 0; i2 < edgesToRemove.length; i2++) { + this.remove(edgesToRemove[i2]); + } + return false; + }; + module3.exports = LGraphManager; + }), + /* 8 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var Point3 = __webpack_require__(12); + function IGeometry() { + } + __name(IGeometry, "IGeometry"); + IGeometry.calcSeparationAmount = function(rectA, rectB, overlapAmount, separationBuffer) { + if (!rectA.intersects(rectB)) { + throw "assert failed"; + } + var directions = new Array(2); + this.decideDirectionsForOverlappingNodes(rectA, rectB, directions); + overlapAmount[0] = Math.min(rectA.getRight(), rectB.getRight()) - Math.max(rectA.x, rectB.x); + overlapAmount[1] = Math.min(rectA.getBottom(), rectB.getBottom()) - Math.max(rectA.y, rectB.y); + if (rectA.getX() <= rectB.getX() && rectA.getRight() >= rectB.getRight()) { + overlapAmount[0] += Math.min(rectB.getX() - rectA.getX(), rectA.getRight() - rectB.getRight()); + } else if (rectB.getX() <= rectA.getX() && rectB.getRight() >= rectA.getRight()) { + overlapAmount[0] += Math.min(rectA.getX() - rectB.getX(), rectB.getRight() - rectA.getRight()); + } + if (rectA.getY() <= rectB.getY() && rectA.getBottom() >= rectB.getBottom()) { + overlapAmount[1] += Math.min(rectB.getY() - rectA.getY(), rectA.getBottom() - rectB.getBottom()); + } else if (rectB.getY() <= rectA.getY() && rectB.getBottom() >= rectA.getBottom()) { + overlapAmount[1] += Math.min(rectA.getY() - rectB.getY(), rectB.getBottom() - rectA.getBottom()); + } + var slope = Math.abs((rectB.getCenterY() - rectA.getCenterY()) / (rectB.getCenterX() - rectA.getCenterX())); + if (rectB.getCenterY() === rectA.getCenterY() && rectB.getCenterX() === rectA.getCenterX()) { + slope = 1; + } + var moveByY = slope * overlapAmount[0]; + var moveByX = overlapAmount[1] / slope; + if (overlapAmount[0] < moveByX) { + moveByX = overlapAmount[0]; + } else { + moveByY = overlapAmount[1]; + } + overlapAmount[0] = -1 * directions[0] * (moveByX / 2 + separationBuffer); + overlapAmount[1] = -1 * directions[1] * (moveByY / 2 + separationBuffer); + }; + IGeometry.decideDirectionsForOverlappingNodes = function(rectA, rectB, directions) { + if (rectA.getCenterX() < rectB.getCenterX()) { + directions[0] = -1; + } else { + directions[0] = 1; + } + if (rectA.getCenterY() < rectB.getCenterY()) { + directions[1] = -1; + } else { + directions[1] = 1; + } + }; + IGeometry.getIntersection2 = function(rectA, rectB, result) { + var p1x = rectA.getCenterX(); + var p1y = rectA.getCenterY(); + var p2x = rectB.getCenterX(); + var p2y = rectB.getCenterY(); + if (rectA.intersects(rectB)) { + result[0] = p1x; + result[1] = p1y; + result[2] = p2x; + result[3] = p2y; + return true; + } + var topLeftAx = rectA.getX(); + var topLeftAy = rectA.getY(); + var topRightAx = rectA.getRight(); + var bottomLeftAx = rectA.getX(); + var bottomLeftAy = rectA.getBottom(); + var bottomRightAx = rectA.getRight(); + var halfWidthA = rectA.getWidthHalf(); + var halfHeightA = rectA.getHeightHalf(); + var topLeftBx = rectB.getX(); + var topLeftBy = rectB.getY(); + var topRightBx = rectB.getRight(); + var bottomLeftBx = rectB.getX(); + var bottomLeftBy = rectB.getBottom(); + var bottomRightBx = rectB.getRight(); + var halfWidthB = rectB.getWidthHalf(); + var halfHeightB = rectB.getHeightHalf(); + var clipPointAFound = false; + var clipPointBFound = false; + if (p1x === p2x) { + if (p1y > p2y) { + result[0] = p1x; + result[1] = topLeftAy; + result[2] = p2x; + result[3] = bottomLeftBy; + return false; + } else if (p1y < p2y) { + result[0] = p1x; + result[1] = bottomLeftAy; + result[2] = p2x; + result[3] = topLeftBy; + return false; + } else { + } + } else if (p1y === p2y) { + if (p1x > p2x) { + result[0] = topLeftAx; + result[1] = p1y; + result[2] = topRightBx; + result[3] = p2y; + return false; + } else if (p1x < p2x) { + result[0] = topRightAx; + result[1] = p1y; + result[2] = topLeftBx; + result[3] = p2y; + return false; + } else { + } + } else { + var slopeA = rectA.height / rectA.width; + var slopeB = rectB.height / rectB.width; + var slopePrime = (p2y - p1y) / (p2x - p1x); + var cardinalDirectionA = void 0; + var cardinalDirectionB = void 0; + var tempPointAx = void 0; + var tempPointAy = void 0; + var tempPointBx = void 0; + var tempPointBy = void 0; + if (-slopeA === slopePrime) { + if (p1x > p2x) { + result[0] = bottomLeftAx; + result[1] = bottomLeftAy; + clipPointAFound = true; + } else { + result[0] = topRightAx; + result[1] = topLeftAy; + clipPointAFound = true; + } + } else if (slopeA === slopePrime) { + if (p1x > p2x) { + result[0] = topLeftAx; + result[1] = topLeftAy; + clipPointAFound = true; + } else { + result[0] = bottomRightAx; + result[1] = bottomLeftAy; + clipPointAFound = true; + } + } + if (-slopeB === slopePrime) { + if (p2x > p1x) { + result[2] = bottomLeftBx; + result[3] = bottomLeftBy; + clipPointBFound = true; + } else { + result[2] = topRightBx; + result[3] = topLeftBy; + clipPointBFound = true; + } + } else if (slopeB === slopePrime) { + if (p2x > p1x) { + result[2] = topLeftBx; + result[3] = topLeftBy; + clipPointBFound = true; + } else { + result[2] = bottomRightBx; + result[3] = bottomLeftBy; + clipPointBFound = true; + } + } + if (clipPointAFound && clipPointBFound) { + return false; + } + if (p1x > p2x) { + if (p1y > p2y) { + cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 4); + cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 2); + } else { + cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 3); + cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 1); + } + } else { + if (p1y > p2y) { + cardinalDirectionA = this.getCardinalDirection(-slopeA, slopePrime, 1); + cardinalDirectionB = this.getCardinalDirection(-slopeB, slopePrime, 3); + } else { + cardinalDirectionA = this.getCardinalDirection(slopeA, slopePrime, 2); + cardinalDirectionB = this.getCardinalDirection(slopeB, slopePrime, 4); + } + } + if (!clipPointAFound) { + switch (cardinalDirectionA) { + case 1: + tempPointAy = topLeftAy; + tempPointAx = p1x + -halfHeightA / slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 2: + tempPointAx = bottomRightAx; + tempPointAy = p1y + halfWidthA * slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 3: + tempPointAy = bottomLeftAy; + tempPointAx = p1x + halfHeightA / slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + case 4: + tempPointAx = bottomLeftAx; + tempPointAy = p1y + -halfWidthA * slopePrime; + result[0] = tempPointAx; + result[1] = tempPointAy; + break; + } + } + if (!clipPointBFound) { + switch (cardinalDirectionB) { + case 1: + tempPointBy = topLeftBy; + tempPointBx = p2x + -halfHeightB / slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 2: + tempPointBx = bottomRightBx; + tempPointBy = p2y + halfWidthB * slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 3: + tempPointBy = bottomLeftBy; + tempPointBx = p2x + halfHeightB / slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + case 4: + tempPointBx = bottomLeftBx; + tempPointBy = p2y + -halfWidthB * slopePrime; + result[2] = tempPointBx; + result[3] = tempPointBy; + break; + } + } + } + return false; + }; + IGeometry.getCardinalDirection = function(slope, slopePrime, line2) { + if (slope > slopePrime) { + return line2; + } else { + return 1 + line2 % 4; + } + }; + IGeometry.getIntersection = function(s1, s2, f1, f2) { + if (f2 == null) { + return this.getIntersection2(s1, s2, f1); + } + var x1 = s1.x; + var y1 = s1.y; + var x22 = s2.x; + var y22 = s2.y; + var x32 = f1.x; + var y32 = f1.y; + var x42 = f2.x; + var y42 = f2.y; + var x5 = void 0, y6 = void 0; + var a1 = void 0, a2 = void 0, b1 = void 0, b22 = void 0, c1 = void 0, c22 = void 0; + var denom = void 0; + a1 = y22 - y1; + b1 = x1 - x22; + c1 = x22 * y1 - x1 * y22; + a2 = y42 - y32; + b22 = x32 - x42; + c22 = x42 * y32 - x32 * y42; + denom = a1 * b22 - a2 * b1; + if (denom === 0) { + return null; + } + x5 = (b1 * c22 - b22 * c1) / denom; + y6 = (a2 * c1 - a1 * c22) / denom; + return new Point3(x5, y6); + }; + IGeometry.angleOfVector = function(Cx, Cy, Nx, Ny) { + var C_angle = void 0; + if (Cx !== Nx) { + C_angle = Math.atan((Ny - Cy) / (Nx - Cx)); + if (Nx < Cx) { + C_angle += Math.PI; + } else if (Ny < Cy) { + C_angle += this.TWO_PI; + } + } else if (Ny < Cy) { + C_angle = this.ONE_AND_HALF_PI; + } else { + C_angle = this.HALF_PI; + } + return C_angle; + }; + IGeometry.doIntersect = function(p1, p22, p3, p4) { + var a2 = p1.x; + var b3 = p1.y; + var c3 = p22.x; + var d3 = p22.y; + var p5 = p3.x; + var q3 = p3.y; + var r2 = p4.x; + var s2 = p4.y; + var det = (c3 - a2) * (s2 - q3) - (r2 - p5) * (d3 - b3); + if (det === 0) { + return false; + } else { + var lambda = ((s2 - q3) * (r2 - a2) + (p5 - r2) * (s2 - b3)) / det; + var gamma2 = ((b3 - d3) * (r2 - a2) + (c3 - a2) * (s2 - b3)) / det; + return 0 < lambda && lambda < 1 && 0 < gamma2 && gamma2 < 1; + } + }; + IGeometry.findCircleLineIntersections = function(Ex, Ey, Lx, Ly, Cx, Cy, r2) { + var a2 = (Lx - Ex) * (Lx - Ex) + (Ly - Ey) * (Ly - Ey); + var b3 = 2 * ((Ex - Cx) * (Lx - Ex) + (Ey - Cy) * (Ly - Ey)); + var c3 = (Ex - Cx) * (Ex - Cx) + (Ey - Cy) * (Ey - Cy) - r2 * r2; + var disc = b3 * b3 - 4 * a2 * c3; + if (disc >= 0) { + var t13 = (-b3 + Math.sqrt(b3 * b3 - 4 * a2 * c3)) / (2 * a2); + var t22 = (-b3 - Math.sqrt(b3 * b3 - 4 * a2 * c3)) / (2 * a2); + var intersections = null; + if (t13 >= 0 && t13 <= 1) { + return [t13]; + } + if (t22 >= 0 && t22 <= 1) { + return [t22]; + } + return intersections; + } else return null; + }; + IGeometry.HALF_PI = 0.5 * Math.PI; + IGeometry.ONE_AND_HALF_PI = 1.5 * Math.PI; + IGeometry.TWO_PI = 2 * Math.PI; + IGeometry.THREE_PI = 3 * Math.PI; + module3.exports = IGeometry; + }), + /* 9 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function IMath() { + } + __name(IMath, "IMath"); + IMath.sign = function(value2) { + if (value2 > 0) { + return 1; + } else if (value2 < 0) { + return -1; + } else { + return 0; + } + }; + IMath.floor = function(value2) { + return value2 < 0 ? Math.ceil(value2) : Math.floor(value2); + }; + IMath.ceil = function(value2) { + return value2 < 0 ? Math.floor(value2) : Math.ceil(value2); + }; + module3.exports = IMath; + }), + /* 10 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function Integer() { + } + __name(Integer, "Integer"); + Integer.MAX_VALUE = 2147483647; + Integer.MIN_VALUE = -2147483648; + module3.exports = Integer; + }), + /* 11 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var _createClass2 = /* @__PURE__ */ (function() { + function defineProperties(target, props) { + for (var i2 = 0; i2 < props.length; i2++) { + var descriptor = props[i2]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + __name(defineProperties, "defineProperties"); + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _classCallCheck2(instance2, Constructor) { + if (!(instance2 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + __name(_classCallCheck2, "_classCallCheck"); + var nodeFrom = /* @__PURE__ */ __name(function nodeFrom2(value2) { + return { value: value2, next: null, prev: null }; + }, "nodeFrom"); + var add3 = /* @__PURE__ */ __name(function add4(prev2, node2, next3, list) { + if (prev2 !== null) { + prev2.next = node2; + } else { + list.head = node2; + } + if (next3 !== null) { + next3.prev = node2; + } else { + list.tail = node2; + } + node2.prev = prev2; + node2.next = next3; + list.length++; + return node2; + }, "add"); + var _remove = /* @__PURE__ */ __name(function _remove2(node2, list) { + var prev2 = node2.prev, next3 = node2.next; + if (prev2 !== null) { + prev2.next = next3; + } else { + list.head = next3; + } + if (next3 !== null) { + next3.prev = prev2; + } else { + list.tail = prev2; + } + node2.prev = node2.next = null; + list.length--; + return node2; + }, "_remove"); + var LinkedList = (function() { + function LinkedList2(vals) { + var _this = this; + _classCallCheck2(this, LinkedList2); + this.length = 0; + this.head = null; + this.tail = null; + if (vals != null) { + vals.forEach(function(v3) { + return _this.push(v3); + }); + } + } + __name(LinkedList2, "LinkedList"); + _createClass2(LinkedList2, [{ + key: "size", + value: /* @__PURE__ */ __name(function size4() { + return this.length; + }, "size") + }, { + key: "insertBefore", + value: /* @__PURE__ */ __name(function insertBefore(val, otherNode) { + return add3(otherNode.prev, nodeFrom(val), otherNode, this); + }, "insertBefore") + }, { + key: "insertAfter", + value: /* @__PURE__ */ __name(function insertAfter(val, otherNode) { + return add3(otherNode, nodeFrom(val), otherNode.next, this); + }, "insertAfter") + }, { + key: "insertNodeBefore", + value: /* @__PURE__ */ __name(function insertNodeBefore(newNode, otherNode) { + return add3(otherNode.prev, newNode, otherNode, this); + }, "insertNodeBefore") + }, { + key: "insertNodeAfter", + value: /* @__PURE__ */ __name(function insertNodeAfter(newNode, otherNode) { + return add3(otherNode, newNode, otherNode.next, this); + }, "insertNodeAfter") + }, { + key: "push", + value: /* @__PURE__ */ __name(function push3(val) { + return add3(this.tail, nodeFrom(val), null, this); + }, "push") + }, { + key: "unshift", + value: /* @__PURE__ */ __name(function unshift(val) { + return add3(null, nodeFrom(val), this.head, this); + }, "unshift") + }, { + key: "remove", + value: /* @__PURE__ */ __name(function remove3(node2) { + return _remove(node2, this); + }, "remove") + }, { + key: "pop", + value: /* @__PURE__ */ __name(function pop() { + return _remove(this.tail, this).value; + }, "pop") + }, { + key: "popNode", + value: /* @__PURE__ */ __name(function popNode() { + return _remove(this.tail, this); + }, "popNode") + }, { + key: "shift", + value: /* @__PURE__ */ __name(function shift2() { + return _remove(this.head, this).value; + }, "shift") + }, { + key: "shiftNode", + value: /* @__PURE__ */ __name(function shiftNode() { + return _remove(this.head, this); + }, "shiftNode") + }, { + key: "get_object_at", + value: /* @__PURE__ */ __name(function get_object_at(index) { + if (index <= this.length()) { + var i2 = 1; + var current = this.head; + while (i2 < index) { + current = current.next; + i2++; + } + return current.value; + } + }, "get_object_at") + }, { + key: "set_object_at", + value: /* @__PURE__ */ __name(function set_object_at(index, value2) { + if (index <= this.length()) { + var i2 = 1; + var current = this.head; + while (i2 < index) { + current = current.next; + i2++; + } + current.value = value2; + } + }, "set_object_at") + }]); + return LinkedList2; + })(); + module3.exports = LinkedList; + }), + /* 12 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function Point3(x5, y6, p3) { + this.x = null; + this.y = null; + if (x5 == null && y6 == null && p3 == null) { + this.x = 0; + this.y = 0; + } else if (typeof x5 == "number" && typeof y6 == "number" && p3 == null) { + this.x = x5; + this.y = y6; + } else if (x5.constructor.name == "Point" && y6 == null && p3 == null) { + p3 = x5; + this.x = p3.x; + this.y = p3.y; + } + } + __name(Point3, "Point"); + Point3.prototype.getX = function() { + return this.x; + }; + Point3.prototype.getY = function() { + return this.y; + }; + Point3.prototype.getLocation = function() { + return new Point3(this.x, this.y); + }; + Point3.prototype.setLocation = function(x5, y6, p3) { + if (x5.constructor.name == "Point" && y6 == null && p3 == null) { + p3 = x5; + this.setLocation(p3.x, p3.y); + } else if (typeof x5 == "number" && typeof y6 == "number" && p3 == null) { + if (parseInt(x5) == x5 && parseInt(y6) == y6) { + this.move(x5, y6); + } else { + this.x = Math.floor(x5 + 0.5); + this.y = Math.floor(y6 + 0.5); + } + } + }; + Point3.prototype.move = function(x5, y6) { + this.x = x5; + this.y = y6; + }; + Point3.prototype.translate = function(dx, dy) { + this.x += dx; + this.y += dy; + }; + Point3.prototype.equals = function(obj) { + if (obj.constructor.name == "Point") { + var pt = obj; + return this.x == pt.x && this.y == pt.y; + } + return this == obj; + }; + Point3.prototype.toString = function() { + return new Point3().constructor.name + "[x=" + this.x + ",y=" + this.y + "]"; + }; + module3.exports = Point3; + }), + /* 13 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function RectangleD(x5, y6, width3, height2) { + this.x = 0; + this.y = 0; + this.width = 0; + this.height = 0; + if (x5 != null && y6 != null && width3 != null && height2 != null) { + this.x = x5; + this.y = y6; + this.width = width3; + this.height = height2; + } + } + __name(RectangleD, "RectangleD"); + RectangleD.prototype.getX = function() { + return this.x; + }; + RectangleD.prototype.setX = function(x5) { + this.x = x5; + }; + RectangleD.prototype.getY = function() { + return this.y; + }; + RectangleD.prototype.setY = function(y6) { + this.y = y6; + }; + RectangleD.prototype.getWidth = function() { + return this.width; + }; + RectangleD.prototype.setWidth = function(width3) { + this.width = width3; + }; + RectangleD.prototype.getHeight = function() { + return this.height; + }; + RectangleD.prototype.setHeight = function(height2) { + this.height = height2; + }; + RectangleD.prototype.getRight = function() { + return this.x + this.width; + }; + RectangleD.prototype.getBottom = function() { + return this.y + this.height; + }; + RectangleD.prototype.intersects = function(a2) { + if (this.getRight() < a2.x) { + return false; + } + if (this.getBottom() < a2.y) { + return false; + } + if (a2.getRight() < this.x) { + return false; + } + if (a2.getBottom() < this.y) { + return false; + } + return true; + }; + RectangleD.prototype.getCenterX = function() { + return this.x + this.width / 2; + }; + RectangleD.prototype.getMinX = function() { + return this.getX(); + }; + RectangleD.prototype.getMaxX = function() { + return this.getX() + this.width; + }; + RectangleD.prototype.getCenterY = function() { + return this.y + this.height / 2; + }; + RectangleD.prototype.getMinY = function() { + return this.getY(); + }; + RectangleD.prototype.getMaxY = function() { + return this.getY() + this.height; + }; + RectangleD.prototype.getWidthHalf = function() { + return this.width / 2; + }; + RectangleD.prototype.getHeightHalf = function() { + return this.height / 2; + }; + module3.exports = RectangleD; + }), + /* 14 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) { + return typeof obj; + } : function(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + function UniqueIDGeneretor() { + } + __name(UniqueIDGeneretor, "UniqueIDGeneretor"); + UniqueIDGeneretor.lastID = 0; + UniqueIDGeneretor.createID = function(obj) { + if (UniqueIDGeneretor.isPrimitive(obj)) { + return obj; + } + if (obj.uniqueID != null) { + return obj.uniqueID; + } + obj.uniqueID = UniqueIDGeneretor.getString(); + UniqueIDGeneretor.lastID++; + return obj.uniqueID; + }; + UniqueIDGeneretor.getString = function(id35) { + if (id35 == null) id35 = UniqueIDGeneretor.lastID; + return "Object#" + id35; + }; + UniqueIDGeneretor.isPrimitive = function(arg) { + var type3 = typeof arg === "undefined" ? "undefined" : _typeof2(arg); + return arg == null || type3 != "object" && type3 != "function"; + }; + module3.exports = UniqueIDGeneretor; + }), + /* 15 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function _toConsumableArray2(arr) { + if (Array.isArray(arr)) { + for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) { + arr2[i2] = arr[i2]; + } + return arr2; + } else { + return Array.from(arr); + } + } + __name(_toConsumableArray2, "_toConsumableArray"); + var LayoutConstants = __webpack_require__(0); + var LGraphManager = __webpack_require__(7); + var LNode = __webpack_require__(3); + var LEdge = __webpack_require__(1); + var LGraph = __webpack_require__(6); + var PointD = __webpack_require__(5); + var Transform2 = __webpack_require__(17); + var Emitter2 = __webpack_require__(29); + function Layout2(isRemoteUse) { + Emitter2.call(this); + this.layoutQuality = LayoutConstants.QUALITY; + this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + this.incremental = LayoutConstants.DEFAULT_INCREMENTAL; + this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT; + this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT; + this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD; + this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES; + this.edgeToDummyNodes = /* @__PURE__ */ new Map(); + this.graphManager = new LGraphManager(this); + this.isLayoutFinished = false; + this.isSubLayout = false; + this.isRemoteUse = false; + if (isRemoteUse != null) { + this.isRemoteUse = isRemoteUse; + } + } + __name(Layout2, "Layout"); + Layout2.RANDOM_SEED = 1; + Layout2.prototype = Object.create(Emitter2.prototype); + Layout2.prototype.getGraphManager = function() { + return this.graphManager; + }; + Layout2.prototype.getAllNodes = function() { + return this.graphManager.getAllNodes(); + }; + Layout2.prototype.getAllEdges = function() { + return this.graphManager.getAllEdges(); + }; + Layout2.prototype.getAllNodesToApplyGravitation = function() { + return this.graphManager.getAllNodesToApplyGravitation(); + }; + Layout2.prototype.newGraphManager = function() { + var gm = new LGraphManager(this); + this.graphManager = gm; + return gm; + }; + Layout2.prototype.newGraph = function(vGraph) { + return new LGraph(null, this.graphManager, vGraph); + }; + Layout2.prototype.newNode = function(vNode) { + return new LNode(this.graphManager, vNode); + }; + Layout2.prototype.newEdge = function(vEdge) { + return new LEdge(null, null, vEdge); + }; + Layout2.prototype.checkLayoutSuccess = function() { + return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge(); + }; + Layout2.prototype.runLayout = function() { + this.isLayoutFinished = false; + if (this.tilingPreLayout) { + this.tilingPreLayout(); + } + this.initParameters(); + var isLayoutSuccessfull; + if (this.checkLayoutSuccess()) { + isLayoutSuccessfull = false; + } else { + isLayoutSuccessfull = this.layout(); + } + if (LayoutConstants.ANIMATE === "during") { + return false; + } + if (isLayoutSuccessfull) { + if (!this.isSubLayout) { + this.doPostLayout(); + } + } + if (this.tilingPostLayout) { + this.tilingPostLayout(); + } + this.isLayoutFinished = true; + return isLayoutSuccessfull; + }; + Layout2.prototype.doPostLayout = function() { + if (!this.incremental) { + this.transform(); + } + this.update(); + }; + Layout2.prototype.update2 = function() { + if (this.createBendsAsNeeded) { + this.createBendpointsFromDummyNodes(); + this.graphManager.resetAllEdges(); + } + if (!this.isRemoteUse) { + var edge; + var allEdges = this.graphManager.getAllEdges(); + for (var i2 = 0; i2 < allEdges.length; i2++) { + edge = allEdges[i2]; + } + var node2; + var nodes5 = this.graphManager.getRoot().getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + node2 = nodes5[i2]; + } + this.update(this.graphManager.getRoot()); + } + }; + Layout2.prototype.update = function(obj) { + if (obj == null) { + this.update2(); + } else if (obj instanceof LNode) { + var node2 = obj; + if (node2.getChild() != null) { + var nodes5 = node2.getChild().getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + update(nodes5[i2]); + } + } + if (node2.vGraphObject != null) { + var vNode = node2.vGraphObject; + vNode.update(node2); + } + } else if (obj instanceof LEdge) { + var edge = obj; + if (edge.vGraphObject != null) { + var vEdge = edge.vGraphObject; + vEdge.update(edge); + } + } else if (obj instanceof LGraph) { + var graph = obj; + if (graph.vGraphObject != null) { + var vGraph = graph.vGraphObject; + vGraph.update(graph); + } + } + }; + Layout2.prototype.initParameters = function() { + if (!this.isSubLayout) { + this.layoutQuality = LayoutConstants.QUALITY; + this.animationDuringLayout = LayoutConstants.DEFAULT_ANIMATION_DURING_LAYOUT; + this.animationPeriod = LayoutConstants.DEFAULT_ANIMATION_PERIOD; + this.animationOnLayout = LayoutConstants.DEFAULT_ANIMATION_ON_LAYOUT; + this.incremental = LayoutConstants.DEFAULT_INCREMENTAL; + this.createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + this.uniformLeafNodeSizes = LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES; + } + if (this.animationDuringLayout) { + this.animationOnLayout = false; + } + }; + Layout2.prototype.transform = function(newLeftTop) { + if (newLeftTop == void 0) { + this.transform(new PointD(0, 0)); + } else { + var trans = new Transform2(); + var leftTop = this.graphManager.getRoot().updateLeftTop(); + if (leftTop != null) { + trans.setWorldOrgX(newLeftTop.x); + trans.setWorldOrgY(newLeftTop.y); + trans.setDeviceOrgX(leftTop.x); + trans.setDeviceOrgY(leftTop.y); + var nodes5 = this.getAllNodes(); + var node2; + for (var i2 = 0; i2 < nodes5.length; i2++) { + node2 = nodes5[i2]; + node2.transform(trans); + } + } + } + }; + Layout2.prototype.positionNodesRandomly = function(graph) { + if (graph == void 0) { + this.positionNodesRandomly(this.getGraphManager().getRoot()); + this.getGraphManager().getRoot().updateBounds(true); + } else { + var lNode; + var childGraph; + var nodes5 = graph.getNodes(); + for (var i2 = 0; i2 < nodes5.length; i2++) { + lNode = nodes5[i2]; + childGraph = lNode.getChild(); + if (childGraph == null) { + lNode.scatter(); + } else if (childGraph.getNodes().length == 0) { + lNode.scatter(); + } else { + this.positionNodesRandomly(childGraph); + lNode.updateBounds(); + } + } + } + }; + Layout2.prototype.getFlatForest = function() { + var flatForest = []; + var isForest = true; + var allNodes = this.graphManager.getRoot().getNodes(); + var isFlat = true; + for (var i2 = 0; i2 < allNodes.length; i2++) { + if (allNodes[i2].getChild() != null) { + isFlat = false; + } + } + if (!isFlat) { + return flatForest; + } + var visited = /* @__PURE__ */ new Set(); + var toBeVisited = []; + var parents3 = /* @__PURE__ */ new Map(); + var unProcessedNodes = []; + unProcessedNodes = unProcessedNodes.concat(allNodes); + while (unProcessedNodes.length > 0 && isForest) { + toBeVisited.push(unProcessedNodes[0]); + while (toBeVisited.length > 0 && isForest) { + var currentNode = toBeVisited[0]; + toBeVisited.splice(0, 1); + visited.add(currentNode); + var neighborEdges = currentNode.getEdges(); + for (var i2 = 0; i2 < neighborEdges.length; i2++) { + var currentNeighbor = neighborEdges[i2].getOtherEnd(currentNode); + if (parents3.get(currentNode) != currentNeighbor) { + if (!visited.has(currentNeighbor)) { + toBeVisited.push(currentNeighbor); + parents3.set(currentNeighbor, currentNode); + } else { + isForest = false; + break; + } + } + } + } + if (!isForest) { + flatForest = []; + } else { + var temp = [].concat(_toConsumableArray2(visited)); + flatForest.push(temp); + for (var i2 = 0; i2 < temp.length; i2++) { + var value2 = temp[i2]; + var index = unProcessedNodes.indexOf(value2); + if (index > -1) { + unProcessedNodes.splice(index, 1); + } + } + visited = /* @__PURE__ */ new Set(); + parents3 = /* @__PURE__ */ new Map(); + } + } + return flatForest; + }; + Layout2.prototype.createDummyNodesForBendpoints = function(edge) { + var dummyNodes = []; + var prev2 = edge.source; + var graph = this.graphManager.calcLowestCommonAncestor(edge.source, edge.target); + for (var i2 = 0; i2 < edge.bendpoints.length; i2++) { + var dummyNode = this.newNode(null); + dummyNode.setRect(new Point(0, 0), new Dimension(1, 1)); + graph.add(dummyNode); + var dummyEdge = this.newEdge(null); + this.graphManager.add(dummyEdge, prev2, dummyNode); + dummyNodes.add(dummyNode); + prev2 = dummyNode; + } + var dummyEdge = this.newEdge(null); + this.graphManager.add(dummyEdge, prev2, edge.target); + this.edgeToDummyNodes.set(edge, dummyNodes); + if (edge.isInterGraph()) { + this.graphManager.remove(edge); + } else { + graph.remove(edge); + } + return dummyNodes; + }; + Layout2.prototype.createBendpointsFromDummyNodes = function() { + var edges3 = []; + edges3 = edges3.concat(this.graphManager.getAllEdges()); + edges3 = [].concat(_toConsumableArray2(this.edgeToDummyNodes.keys())).concat(edges3); + for (var k2 = 0; k2 < edges3.length; k2++) { + var lEdge = edges3[k2]; + if (lEdge.bendpoints.length > 0) { + var path4 = this.edgeToDummyNodes.get(lEdge); + for (var i2 = 0; i2 < path4.length; i2++) { + var dummyNode = path4[i2]; + var p3 = new PointD(dummyNode.getCenterX(), dummyNode.getCenterY()); + var ebp = lEdge.bendpoints.get(i2); + ebp.x = p3.x; + ebp.y = p3.y; + dummyNode.getOwner().remove(dummyNode); + } + this.graphManager.add(lEdge, lEdge.source, lEdge.target); + } + } + }; + Layout2.transform = function(sliderValue, defaultValue, minDiv, maxMul) { + if (minDiv != void 0 && maxMul != void 0) { + var value2 = defaultValue; + if (sliderValue <= 50) { + var minValue = defaultValue / minDiv; + value2 -= (defaultValue - minValue) / 50 * (50 - sliderValue); + } else { + var maxValue = defaultValue * maxMul; + value2 += (maxValue - defaultValue) / 50 * (sliderValue - 50); + } + return value2; + } else { + var a2, b3; + if (sliderValue <= 50) { + a2 = 9 * defaultValue / 500; + b3 = defaultValue / 10; + } else { + a2 = 9 * defaultValue / 50; + b3 = -8 * defaultValue; + } + return a2 * sliderValue + b3; + } + }; + Layout2.findCenterOfTree = function(nodes5) { + var list = []; + list = list.concat(nodes5); + var removedNodes = []; + var remainingDegrees = /* @__PURE__ */ new Map(); + var foundCenter = false; + var centerNode = null; + if (list.length == 1 || list.length == 2) { + foundCenter = true; + centerNode = list[0]; + } + for (var i2 = 0; i2 < list.length; i2++) { + var node2 = list[i2]; + var degree = node2.getNeighborsList().size; + remainingDegrees.set(node2, node2.getNeighborsList().size); + if (degree == 1) { + removedNodes.push(node2); + } + } + var tempList = []; + tempList = tempList.concat(removedNodes); + while (!foundCenter) { + var tempList2 = []; + tempList2 = tempList2.concat(tempList); + tempList = []; + for (var i2 = 0; i2 < list.length; i2++) { + var node2 = list[i2]; + var index = list.indexOf(node2); + if (index >= 0) { + list.splice(index, 1); + } + var neighbours = node2.getNeighborsList(); + neighbours.forEach(function(neighbour) { + if (removedNodes.indexOf(neighbour) < 0) { + var otherDegree = remainingDegrees.get(neighbour); + var newDegree = otherDegree - 1; + if (newDegree == 1) { + tempList.push(neighbour); + } + remainingDegrees.set(neighbour, newDegree); + } + }); + } + removedNodes = removedNodes.concat(tempList); + if (list.length == 1 || list.length == 2) { + foundCenter = true; + centerNode = list[0]; + } + } + return centerNode; + }; + Layout2.prototype.setGraphManager = function(gm) { + this.graphManager = gm; + }; + module3.exports = Layout2; + }), + /* 16 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function RandomSeed() { + } + __name(RandomSeed, "RandomSeed"); + RandomSeed.seed = 1; + RandomSeed.x = 0; + RandomSeed.nextDouble = function() { + RandomSeed.x = Math.sin(RandomSeed.seed++) * 1e4; + return RandomSeed.x - Math.floor(RandomSeed.x); + }; + module3.exports = RandomSeed; + }), + /* 17 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var PointD = __webpack_require__(5); + function Transform2(x5, y6) { + this.lworldOrgX = 0; + this.lworldOrgY = 0; + this.ldeviceOrgX = 0; + this.ldeviceOrgY = 0; + this.lworldExtX = 1; + this.lworldExtY = 1; + this.ldeviceExtX = 1; + this.ldeviceExtY = 1; + } + __name(Transform2, "Transform"); + Transform2.prototype.getWorldOrgX = function() { + return this.lworldOrgX; + }; + Transform2.prototype.setWorldOrgX = function(wox) { + this.lworldOrgX = wox; + }; + Transform2.prototype.getWorldOrgY = function() { + return this.lworldOrgY; + }; + Transform2.prototype.setWorldOrgY = function(woy) { + this.lworldOrgY = woy; + }; + Transform2.prototype.getWorldExtX = function() { + return this.lworldExtX; + }; + Transform2.prototype.setWorldExtX = function(wex) { + this.lworldExtX = wex; + }; + Transform2.prototype.getWorldExtY = function() { + return this.lworldExtY; + }; + Transform2.prototype.setWorldExtY = function(wey) { + this.lworldExtY = wey; + }; + Transform2.prototype.getDeviceOrgX = function() { + return this.ldeviceOrgX; + }; + Transform2.prototype.setDeviceOrgX = function(dox) { + this.ldeviceOrgX = dox; + }; + Transform2.prototype.getDeviceOrgY = function() { + return this.ldeviceOrgY; + }; + Transform2.prototype.setDeviceOrgY = function(doy) { + this.ldeviceOrgY = doy; + }; + Transform2.prototype.getDeviceExtX = function() { + return this.ldeviceExtX; + }; + Transform2.prototype.setDeviceExtX = function(dex) { + this.ldeviceExtX = dex; + }; + Transform2.prototype.getDeviceExtY = function() { + return this.ldeviceExtY; + }; + Transform2.prototype.setDeviceExtY = function(dey) { + this.ldeviceExtY = dey; + }; + Transform2.prototype.transformX = function(x5) { + var xDevice = 0; + var worldExtX = this.lworldExtX; + if (worldExtX != 0) { + xDevice = this.ldeviceOrgX + (x5 - this.lworldOrgX) * this.ldeviceExtX / worldExtX; + } + return xDevice; + }; + Transform2.prototype.transformY = function(y6) { + var yDevice = 0; + var worldExtY = this.lworldExtY; + if (worldExtY != 0) { + yDevice = this.ldeviceOrgY + (y6 - this.lworldOrgY) * this.ldeviceExtY / worldExtY; + } + return yDevice; + }; + Transform2.prototype.inverseTransformX = function(x5) { + var xWorld = 0; + var deviceExtX = this.ldeviceExtX; + if (deviceExtX != 0) { + xWorld = this.lworldOrgX + (x5 - this.ldeviceOrgX) * this.lworldExtX / deviceExtX; + } + return xWorld; + }; + Transform2.prototype.inverseTransformY = function(y6) { + var yWorld = 0; + var deviceExtY = this.ldeviceExtY; + if (deviceExtY != 0) { + yWorld = this.lworldOrgY + (y6 - this.ldeviceOrgY) * this.lworldExtY / deviceExtY; + } + return yWorld; + }; + Transform2.prototype.inverseTransformPoint = function(inPoint) { + var outPoint = new PointD(this.inverseTransformX(inPoint.x), this.inverseTransformY(inPoint.y)); + return outPoint; + }; + module3.exports = Transform2; + }), + /* 18 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function _toConsumableArray2(arr) { + if (Array.isArray(arr)) { + for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) { + arr2[i2] = arr[i2]; + } + return arr2; + } else { + return Array.from(arr); + } + } + __name(_toConsumableArray2, "_toConsumableArray"); + var Layout2 = __webpack_require__(15); + var FDLayoutConstants = __webpack_require__(4); + var LayoutConstants = __webpack_require__(0); + var IGeometry = __webpack_require__(8); + var IMath = __webpack_require__(9); + function FDLayout() { + Layout2.call(this); + this.useSmartIdealEdgeLengthCalculation = FDLayoutConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION; + this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH; + this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH; + this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR; + this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR; + this.displacementThresholdPerNode = 3 * FDLayoutConstants.DEFAULT_EDGE_LENGTH / 100; + this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + this.initialCoolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + this.totalDisplacement = 0; + this.oldTotalDisplacement = 0; + this.maxIterations = FDLayoutConstants.MAX_ITERATIONS; + } + __name(FDLayout, "FDLayout"); + FDLayout.prototype = Object.create(Layout2.prototype); + for (var prop in Layout2) { + FDLayout[prop] = Layout2[prop]; + } + FDLayout.prototype.initParameters = function() { + Layout2.prototype.initParameters.call(this, arguments); + this.totalIterations = 0; + this.notAnimatedIterations = 0; + this.useFRGridVariant = FDLayoutConstants.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION; + this.grid = []; + }; + FDLayout.prototype.calcIdealEdgeLengths = function() { + var edge; + var originalIdealLength; + var lcaDepth; + var source; + var target; + var sizeOfSourceInLca; + var sizeOfTargetInLca; + var allEdges = this.getGraphManager().getAllEdges(); + for (var i2 = 0; i2 < allEdges.length; i2++) { + edge = allEdges[i2]; + originalIdealLength = edge.idealLength; + if (edge.isInterGraph) { + source = edge.getSource(); + target = edge.getTarget(); + sizeOfSourceInLca = edge.getSourceInLca().getEstimatedSize(); + sizeOfTargetInLca = edge.getTargetInLca().getEstimatedSize(); + if (this.useSmartIdealEdgeLengthCalculation) { + edge.idealLength += sizeOfSourceInLca + sizeOfTargetInLca - 2 * LayoutConstants.SIMPLE_NODE_SIZE; + } + lcaDepth = edge.getLca().getInclusionTreeDepth(); + edge.idealLength += originalIdealLength * FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (source.getInclusionTreeDepth() + target.getInclusionTreeDepth() - 2 * lcaDepth); + } + } + }; + FDLayout.prototype.initSpringEmbedder = function() { + var s2 = this.getAllNodes().length; + if (this.incremental) { + if (s2 > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) { + this.coolingFactor = Math.max(this.coolingFactor * FDLayoutConstants.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (s2 - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR)); + } + this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT_INCREMENTAL; + } else { + if (s2 > FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) { + this.coolingFactor = Math.max(FDLayoutConstants.COOLING_ADAPTATION_FACTOR, 1 - (s2 - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) / (FDLayoutConstants.ADAPTATION_UPPER_NODE_LIMIT - FDLayoutConstants.ADAPTATION_LOWER_NODE_LIMIT) * (1 - FDLayoutConstants.COOLING_ADAPTATION_FACTOR)); + } else { + this.coolingFactor = 1; + } + this.initialCoolingFactor = this.coolingFactor; + this.maxNodeDisplacement = FDLayoutConstants.MAX_NODE_DISPLACEMENT; + } + this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations); + this.displacementThresholdPerNode = 3 * FDLayoutConstants.DEFAULT_EDGE_LENGTH / 100; + this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length; + this.repulsionRange = this.calcRepulsionRange(); + }; + FDLayout.prototype.calcSpringForces = function() { + var lEdges = this.getAllEdges(); + var edge; + for (var i2 = 0; i2 < lEdges.length; i2++) { + edge = lEdges[i2]; + this.calcSpringForce(edge, edge.idealLength); + } + }; + FDLayout.prototype.calcRepulsionForces = function() { + var gridUpdateAllowed = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; + var forceToNodeSurroundingUpdate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; + var i2, j3; + var nodeA, nodeB; + var lNodes = this.getAllNodes(); + var processedNodeSet; + if (this.useFRGridVariant) { + if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed) { + this.updateGrid(); + } + processedNodeSet = /* @__PURE__ */ new Set(); + for (i2 = 0; i2 < lNodes.length; i2++) { + nodeA = lNodes[i2]; + this.calculateRepulsionForceOfANode(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate); + processedNodeSet.add(nodeA); + } + } else { + for (i2 = 0; i2 < lNodes.length; i2++) { + nodeA = lNodes[i2]; + for (j3 = i2 + 1; j3 < lNodes.length; j3++) { + nodeB = lNodes[j3]; + if (nodeA.getOwner() != nodeB.getOwner()) { + continue; + } + this.calcRepulsionForce(nodeA, nodeB); + } + } + } + }; + FDLayout.prototype.calcGravitationalForces = function() { + var node2; + var lNodes = this.getAllNodesToApplyGravitation(); + for (var i2 = 0; i2 < lNodes.length; i2++) { + node2 = lNodes[i2]; + this.calcGravitationalForce(node2); + } + }; + FDLayout.prototype.moveNodes = function() { + var lNodes = this.getAllNodes(); + var node2; + for (var i2 = 0; i2 < lNodes.length; i2++) { + node2 = lNodes[i2]; + node2.move(); + } + }; + FDLayout.prototype.calcSpringForce = function(edge, idealLength) { + var sourceNode = edge.getSource(); + var targetNode = edge.getTarget(); + var length2; + var springForce; + var springForceX; + var springForceY; + if (this.uniformLeafNodeSizes && sourceNode.getChild() == null && targetNode.getChild() == null) { + edge.updateLengthSimple(); + } else { + edge.updateLength(); + if (edge.isOverlapingSourceAndTarget) { + return; + } + } + length2 = edge.getLength(); + if (length2 == 0) return; + springForce = edge.edgeElasticity * (length2 - idealLength); + springForceX = springForce * (edge.lengthX / length2); + springForceY = springForce * (edge.lengthY / length2); + sourceNode.springForceX += springForceX; + sourceNode.springForceY += springForceY; + targetNode.springForceX -= springForceX; + targetNode.springForceY -= springForceY; + }; + FDLayout.prototype.calcRepulsionForce = function(nodeA, nodeB) { + var rectA = nodeA.getRect(); + var rectB = nodeB.getRect(); + var overlapAmount = new Array(2); + var clipPoints = new Array(4); + var distanceX; + var distanceY; + var distanceSquared; + var distance3; + var repulsionForce; + var repulsionForceX; + var repulsionForceY; + if (rectA.intersects(rectB)) { + IGeometry.calcSeparationAmount(rectA, rectB, overlapAmount, FDLayoutConstants.DEFAULT_EDGE_LENGTH / 2); + repulsionForceX = 2 * overlapAmount[0]; + repulsionForceY = 2 * overlapAmount[1]; + var childrenConstant = nodeA.noOfChildren * nodeB.noOfChildren / (nodeA.noOfChildren + nodeB.noOfChildren); + nodeA.repulsionForceX -= childrenConstant * repulsionForceX; + nodeA.repulsionForceY -= childrenConstant * repulsionForceY; + nodeB.repulsionForceX += childrenConstant * repulsionForceX; + nodeB.repulsionForceY += childrenConstant * repulsionForceY; + } else { + if (this.uniformLeafNodeSizes && nodeA.getChild() == null && nodeB.getChild() == null) { + distanceX = rectB.getCenterX() - rectA.getCenterX(); + distanceY = rectB.getCenterY() - rectA.getCenterY(); + } else { + IGeometry.getIntersection(rectA, rectB, clipPoints); + distanceX = clipPoints[2] - clipPoints[0]; + distanceY = clipPoints[3] - clipPoints[1]; + } + if (Math.abs(distanceX) < FDLayoutConstants.MIN_REPULSION_DIST) { + distanceX = IMath.sign(distanceX) * FDLayoutConstants.MIN_REPULSION_DIST; + } + if (Math.abs(distanceY) < FDLayoutConstants.MIN_REPULSION_DIST) { + distanceY = IMath.sign(distanceY) * FDLayoutConstants.MIN_REPULSION_DIST; + } + distanceSquared = distanceX * distanceX + distanceY * distanceY; + distance3 = Math.sqrt(distanceSquared); + repulsionForce = (nodeA.nodeRepulsion / 2 + nodeB.nodeRepulsion / 2) * nodeA.noOfChildren * nodeB.noOfChildren / distanceSquared; + repulsionForceX = repulsionForce * distanceX / distance3; + repulsionForceY = repulsionForce * distanceY / distance3; + nodeA.repulsionForceX -= repulsionForceX; + nodeA.repulsionForceY -= repulsionForceY; + nodeB.repulsionForceX += repulsionForceX; + nodeB.repulsionForceY += repulsionForceY; + } + }; + FDLayout.prototype.calcGravitationalForce = function(node2) { + var ownerGraph; + var ownerCenterX; + var ownerCenterY; + var distanceX; + var distanceY; + var absDistanceX; + var absDistanceY; + var estimatedSize; + ownerGraph = node2.getOwner(); + ownerCenterX = (ownerGraph.getRight() + ownerGraph.getLeft()) / 2; + ownerCenterY = (ownerGraph.getTop() + ownerGraph.getBottom()) / 2; + distanceX = node2.getCenterX() - ownerCenterX; + distanceY = node2.getCenterY() - ownerCenterY; + absDistanceX = Math.abs(distanceX) + node2.getWidth() / 2; + absDistanceY = Math.abs(distanceY) + node2.getHeight() / 2; + if (node2.getOwner() == this.graphManager.getRoot()) { + estimatedSize = ownerGraph.getEstimatedSize() * this.gravityRangeFactor; + if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) { + node2.gravitationForceX = -this.gravityConstant * distanceX; + node2.gravitationForceY = -this.gravityConstant * distanceY; + } + } else { + estimatedSize = ownerGraph.getEstimatedSize() * this.compoundGravityRangeFactor; + if (absDistanceX > estimatedSize || absDistanceY > estimatedSize) { + node2.gravitationForceX = -this.gravityConstant * distanceX * this.compoundGravityConstant; + node2.gravitationForceY = -this.gravityConstant * distanceY * this.compoundGravityConstant; + } + } + }; + FDLayout.prototype.isConverged = function() { + var converged; + var oscilating = false; + if (this.totalIterations > this.maxIterations / 3) { + oscilating = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2; + } + converged = this.totalDisplacement < this.totalDisplacementThreshold; + this.oldTotalDisplacement = this.totalDisplacement; + return converged || oscilating; + }; + FDLayout.prototype.animate = function() { + if (this.animationDuringLayout && !this.isSubLayout) { + if (this.notAnimatedIterations == this.animationPeriod) { + this.update(); + this.notAnimatedIterations = 0; + } else { + this.notAnimatedIterations++; + } + } + }; + FDLayout.prototype.calcNoOfChildrenForAllNodes = function() { + var node2; + var allNodes = this.graphManager.getAllNodes(); + for (var i2 = 0; i2 < allNodes.length; i2++) { + node2 = allNodes[i2]; + node2.noOfChildren = node2.getNoOfChildren(); + } + }; + FDLayout.prototype.calcGrid = function(graph) { + var sizeX = 0; + var sizeY = 0; + sizeX = parseInt(Math.ceil((graph.getRight() - graph.getLeft()) / this.repulsionRange)); + sizeY = parseInt(Math.ceil((graph.getBottom() - graph.getTop()) / this.repulsionRange)); + var grid = new Array(sizeX); + for (var i2 = 0; i2 < sizeX; i2++) { + grid[i2] = new Array(sizeY); + } + for (var i2 = 0; i2 < sizeX; i2++) { + for (var j3 = 0; j3 < sizeY; j3++) { + grid[i2][j3] = new Array(); + } + } + return grid; + }; + FDLayout.prototype.addNodeToGrid = function(v3, left3, top2) { + var startX2 = 0; + var finishX = 0; + var startY2 = 0; + var finishY = 0; + startX2 = parseInt(Math.floor((v3.getRect().x - left3) / this.repulsionRange)); + finishX = parseInt(Math.floor((v3.getRect().width + v3.getRect().x - left3) / this.repulsionRange)); + startY2 = parseInt(Math.floor((v3.getRect().y - top2) / this.repulsionRange)); + finishY = parseInt(Math.floor((v3.getRect().height + v3.getRect().y - top2) / this.repulsionRange)); + for (var i2 = startX2; i2 <= finishX; i2++) { + for (var j3 = startY2; j3 <= finishY; j3++) { + this.grid[i2][j3].push(v3); + v3.setGridCoordinates(startX2, finishX, startY2, finishY); + } + } + }; + FDLayout.prototype.updateGrid = function() { + var i2; + var nodeA; + var lNodes = this.getAllNodes(); + this.grid = this.calcGrid(this.graphManager.getRoot()); + for (i2 = 0; i2 < lNodes.length; i2++) { + nodeA = lNodes[i2]; + this.addNodeToGrid(nodeA, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop()); + } + }; + FDLayout.prototype.calculateRepulsionForceOfANode = function(nodeA, processedNodeSet, gridUpdateAllowed, forceToNodeSurroundingUpdate) { + if (this.totalIterations % FDLayoutConstants.GRID_CALCULATION_CHECK_PERIOD == 1 && gridUpdateAllowed || forceToNodeSurroundingUpdate) { + var surrounding = /* @__PURE__ */ new Set(); + nodeA.surrounding = new Array(); + var nodeB; + var grid = this.grid; + for (var i2 = nodeA.startX - 1; i2 < nodeA.finishX + 2; i2++) { + for (var j3 = nodeA.startY - 1; j3 < nodeA.finishY + 2; j3++) { + if (!(i2 < 0 || j3 < 0 || i2 >= grid.length || j3 >= grid[0].length)) { + for (var k2 = 0; k2 < grid[i2][j3].length; k2++) { + nodeB = grid[i2][j3][k2]; + if (nodeA.getOwner() != nodeB.getOwner() || nodeA == nodeB) { + continue; + } + if (!processedNodeSet.has(nodeB) && !surrounding.has(nodeB)) { + var distanceX = Math.abs(nodeA.getCenterX() - nodeB.getCenterX()) - (nodeA.getWidth() / 2 + nodeB.getWidth() / 2); + var distanceY = Math.abs(nodeA.getCenterY() - nodeB.getCenterY()) - (nodeA.getHeight() / 2 + nodeB.getHeight() / 2); + if (distanceX <= this.repulsionRange && distanceY <= this.repulsionRange) { + surrounding.add(nodeB); + } + } + } + } + } + } + nodeA.surrounding = [].concat(_toConsumableArray2(surrounding)); + } + for (i2 = 0; i2 < nodeA.surrounding.length; i2++) { + this.calcRepulsionForce(nodeA, nodeA.surrounding[i2]); + } + }; + FDLayout.prototype.calcRepulsionRange = function() { + return 0; + }; + module3.exports = FDLayout; + }), + /* 19 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LEdge = __webpack_require__(1); + var FDLayoutConstants = __webpack_require__(4); + function FDLayoutEdge(source, target, vEdge) { + LEdge.call(this, source, target, vEdge); + this.idealLength = FDLayoutConstants.DEFAULT_EDGE_LENGTH; + this.edgeElasticity = FDLayoutConstants.DEFAULT_SPRING_STRENGTH; + } + __name(FDLayoutEdge, "FDLayoutEdge"); + FDLayoutEdge.prototype = Object.create(LEdge.prototype); + for (var prop in LEdge) { + FDLayoutEdge[prop] = LEdge[prop]; + } + module3.exports = FDLayoutEdge; + }), + /* 20 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var LNode = __webpack_require__(3); + var FDLayoutConstants = __webpack_require__(4); + function FDLayoutNode(gm, loc, size4, vNode) { + LNode.call(this, gm, loc, size4, vNode); + this.nodeRepulsion = FDLayoutConstants.DEFAULT_REPULSION_STRENGTH; + this.springForceX = 0; + this.springForceY = 0; + this.repulsionForceX = 0; + this.repulsionForceY = 0; + this.gravitationForceX = 0; + this.gravitationForceY = 0; + this.displacementX = 0; + this.displacementY = 0; + this.startX = 0; + this.finishX = 0; + this.startY = 0; + this.finishY = 0; + this.surrounding = []; + } + __name(FDLayoutNode, "FDLayoutNode"); + FDLayoutNode.prototype = Object.create(LNode.prototype); + for (var prop in LNode) { + FDLayoutNode[prop] = LNode[prop]; + } + FDLayoutNode.prototype.setGridCoordinates = function(_startX, _finishX, _startY, _finishY) { + this.startX = _startX; + this.finishX = _finishX; + this.startY = _startY; + this.finishY = _finishY; + }; + module3.exports = FDLayoutNode; + }), + /* 21 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function DimensionD2(width3, height2) { + this.width = 0; + this.height = 0; + if (width3 !== null && height2 !== null) { + this.height = height2; + this.width = width3; + } + } + __name(DimensionD2, "DimensionD"); + DimensionD2.prototype.getWidth = function() { + return this.width; + }; + DimensionD2.prototype.setWidth = function(width3) { + this.width = width3; + }; + DimensionD2.prototype.getHeight = function() { + return this.height; + }; + DimensionD2.prototype.setHeight = function(height2) { + this.height = height2; + }; + module3.exports = DimensionD2; + }), + /* 22 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var UniqueIDGeneretor = __webpack_require__(14); + function HashMap() { + this.map = {}; + this.keys = []; + } + __name(HashMap, "HashMap"); + HashMap.prototype.put = function(key, value2) { + var theId = UniqueIDGeneretor.createID(key); + if (!this.contains(theId)) { + this.map[theId] = value2; + this.keys.push(key); + } + }; + HashMap.prototype.contains = function(key) { + var theId = UniqueIDGeneretor.createID(key); + return this.map[key] != null; + }; + HashMap.prototype.get = function(key) { + var theId = UniqueIDGeneretor.createID(key); + return this.map[theId]; + }; + HashMap.prototype.keySet = function() { + return this.keys; + }; + module3.exports = HashMap; + }), + /* 23 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var UniqueIDGeneretor = __webpack_require__(14); + function HashSet() { + this.set = {}; + } + __name(HashSet, "HashSet"); + ; + HashSet.prototype.add = function(obj) { + var theId = UniqueIDGeneretor.createID(obj); + if (!this.contains(theId)) this.set[theId] = obj; + }; + HashSet.prototype.remove = function(obj) { + delete this.set[UniqueIDGeneretor.createID(obj)]; + }; + HashSet.prototype.clear = function() { + this.set = {}; + }; + HashSet.prototype.contains = function(obj) { + return this.set[UniqueIDGeneretor.createID(obj)] == obj; + }; + HashSet.prototype.isEmpty = function() { + return this.size() === 0; + }; + HashSet.prototype.size = function() { + return Object.keys(this.set).length; + }; + HashSet.prototype.addAllTo = function(list) { + var keys3 = Object.keys(this.set); + var length2 = keys3.length; + for (var i2 = 0; i2 < length2; i2++) { + list.push(this.set[keys3[i2]]); + } + }; + HashSet.prototype.size = function() { + return Object.keys(this.set).length; + }; + HashSet.prototype.addAll = function(list) { + var s2 = list.length; + for (var i2 = 0; i2 < s2; i2++) { + var v3 = list[i2]; + this.add(v3); + } + }; + module3.exports = HashSet; + }), + /* 24 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function Matrix() { + } + __name(Matrix, "Matrix"); + Matrix.multMat = function(array1, array22) { + var result = []; + for (var i2 = 0; i2 < array1.length; i2++) { + result[i2] = []; + for (var j3 = 0; j3 < array22[0].length; j3++) { + result[i2][j3] = 0; + for (var k2 = 0; k2 < array1[0].length; k2++) { + result[i2][j3] += array1[i2][k2] * array22[k2][j3]; + } + } + } + return result; + }; + Matrix.transpose = function(array4) { + var result = []; + for (var i2 = 0; i2 < array4[0].length; i2++) { + result[i2] = []; + for (var j3 = 0; j3 < array4.length; j3++) { + result[i2][j3] = array4[j3][i2]; + } + } + return result; + }; + Matrix.multCons = function(array4, constant4) { + var result = []; + for (var i2 = 0; i2 < array4.length; i2++) { + result[i2] = array4[i2] * constant4; + } + return result; + }; + Matrix.minusOp = function(array1, array22) { + var result = []; + for (var i2 = 0; i2 < array1.length; i2++) { + result[i2] = array1[i2] - array22[i2]; + } + return result; + }; + Matrix.dotProduct = function(array1, array22) { + var product = 0; + for (var i2 = 0; i2 < array1.length; i2++) { + product += array1[i2] * array22[i2]; + } + return product; + }; + Matrix.mag = function(array4) { + return Math.sqrt(this.dotProduct(array4, array4)); + }; + Matrix.normalize = function(array4) { + var result = []; + var magnitude = this.mag(array4); + for (var i2 = 0; i2 < array4.length; i2++) { + result[i2] = array4[i2] / magnitude; + } + return result; + }; + Matrix.multGamma = function(array4) { + var result = []; + var sum2 = 0; + for (var i2 = 0; i2 < array4.length; i2++) { + sum2 += array4[i2]; + } + sum2 *= -1 / array4.length; + for (var _i = 0; _i < array4.length; _i++) { + result[_i] = sum2 + array4[_i]; + } + return result; + }; + Matrix.multL = function(array4, C3, INV) { + var result = []; + var temp1 = []; + var temp2 = []; + for (var i2 = 0; i2 < C3[0].length; i2++) { + var sum2 = 0; + for (var j3 = 0; j3 < C3.length; j3++) { + sum2 += -0.5 * C3[j3][i2] * array4[j3]; + } + temp1[i2] = sum2; + } + for (var _i2 = 0; _i2 < INV.length; _i2++) { + var _sum = 0; + for (var _j = 0; _j < INV.length; _j++) { + _sum += INV[_i2][_j] * temp1[_j]; + } + temp2[_i2] = _sum; + } + for (var _i3 = 0; _i3 < C3.length; _i3++) { + var _sum2 = 0; + for (var _j2 = 0; _j2 < C3[0].length; _j2++) { + _sum2 += C3[_i3][_j2] * temp2[_j2]; + } + result[_i3] = _sum2; + } + return result; + }; + module3.exports = Matrix; + }), + /* 25 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var _createClass2 = /* @__PURE__ */ (function() { + function defineProperties(target, props) { + for (var i2 = 0; i2 < props.length; i2++) { + var descriptor = props[i2]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + __name(defineProperties, "defineProperties"); + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _classCallCheck2(instance2, Constructor) { + if (!(instance2 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + __name(_classCallCheck2, "_classCallCheck"); + var LinkedList = __webpack_require__(11); + var Quicksort = (function() { + function Quicksort2(A2, compareFunction) { + _classCallCheck2(this, Quicksort2); + if (compareFunction !== null || compareFunction !== void 0) this.compareFunction = this._defaultCompareFunction; + var length2 = void 0; + if (A2 instanceof LinkedList) length2 = A2.size(); + else length2 = A2.length; + this._quicksort(A2, 0, length2 - 1); + } + __name(Quicksort2, "Quicksort"); + _createClass2(Quicksort2, [{ + key: "_quicksort", + value: /* @__PURE__ */ __name(function _quicksort(A2, p3, r2) { + if (p3 < r2) { + var q3 = this._partition(A2, p3, r2); + this._quicksort(A2, p3, q3); + this._quicksort(A2, q3 + 1, r2); + } + }, "_quicksort") + }, { + key: "_partition", + value: /* @__PURE__ */ __name(function _partition(A2, p3, r2) { + var x5 = this._get(A2, p3); + var i2 = p3; + var j3 = r2; + while (true) { + while (this.compareFunction(x5, this._get(A2, j3))) { + j3--; + } + while (this.compareFunction(this._get(A2, i2), x5)) { + i2++; + } + if (i2 < j3) { + this._swap(A2, i2, j3); + i2++; + j3--; + } else return j3; + } + }, "_partition") + }, { + key: "_get", + value: /* @__PURE__ */ __name(function _get(object3, index) { + if (object3 instanceof LinkedList) return object3.get_object_at(index); + else return object3[index]; + }, "_get") + }, { + key: "_set", + value: /* @__PURE__ */ __name(function _set(object3, index, value2) { + if (object3 instanceof LinkedList) object3.set_object_at(index, value2); + else object3[index] = value2; + }, "_set") + }, { + key: "_swap", + value: /* @__PURE__ */ __name(function _swap(A2, i2, j3) { + var temp = this._get(A2, i2); + this._set(A2, i2, this._get(A2, j3)); + this._set(A2, j3, temp); + }, "_swap") + }, { + key: "_defaultCompareFunction", + value: /* @__PURE__ */ __name(function _defaultCompareFunction(a2, b3) { + return b3 > a2; + }, "_defaultCompareFunction") + }]); + return Quicksort2; + })(); + module3.exports = Quicksort; + }), + /* 26 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function SVD() { + } + __name(SVD, "SVD"); + ; + SVD.svd = function(A2) { + this.U = null; + this.V = null; + this.s = null; + this.m = 0; + this.n = 0; + this.m = A2.length; + this.n = A2[0].length; + var nu = Math.min(this.m, this.n); + this.s = (function(s2) { + var a2 = []; + while (s2-- > 0) { + a2.push(0); + } + return a2; + })(Math.min(this.m + 1, this.n)); + this.U = (function(dims) { + var allocate = /* @__PURE__ */ __name(function allocate2(dims2) { + if (dims2.length == 0) { + return 0; + } else { + var array4 = []; + for (var i3 = 0; i3 < dims2[0]; i3++) { + array4.push(allocate2(dims2.slice(1))); + } + return array4; + } + }, "allocate"); + return allocate(dims); + })([this.m, nu]); + this.V = (function(dims) { + var allocate = /* @__PURE__ */ __name(function allocate2(dims2) { + if (dims2.length == 0) { + return 0; + } else { + var array4 = []; + for (var i3 = 0; i3 < dims2[0]; i3++) { + array4.push(allocate2(dims2.slice(1))); + } + return array4; + } + }, "allocate"); + return allocate(dims); + })([this.n, this.n]); + var e3 = (function(s2) { + var a2 = []; + while (s2-- > 0) { + a2.push(0); + } + return a2; + })(this.n); + var work = (function(s2) { + var a2 = []; + while (s2-- > 0) { + a2.push(0); + } + return a2; + })(this.m); + var wantu = true; + var wantv = true; + var nct = Math.min(this.m - 1, this.n); + var nrt = Math.max(0, Math.min(this.n - 2, this.m)); + for (var k2 = 0; k2 < Math.max(nct, nrt); k2++) { + if (k2 < nct) { + this.s[k2] = 0; + for (var i2 = k2; i2 < this.m; i2++) { + this.s[k2] = SVD.hypot(this.s[k2], A2[i2][k2]); + } + ; + if (this.s[k2] !== 0) { + if (A2[k2][k2] < 0) { + this.s[k2] = -this.s[k2]; + } + for (var _i = k2; _i < this.m; _i++) { + A2[_i][k2] /= this.s[k2]; + } + ; + A2[k2][k2] += 1; + } + this.s[k2] = -this.s[k2]; + } + for (var j3 = k2 + 1; j3 < this.n; j3++) { + if (/* @__PURE__ */ (function(lhs, rhs) { + return lhs && rhs; + })(k2 < nct, this.s[k2] !== 0)) { + var t4 = 0; + for (var _i2 = k2; _i2 < this.m; _i2++) { + t4 += A2[_i2][k2] * A2[_i2][j3]; + } + ; + t4 = -t4 / A2[k2][k2]; + for (var _i3 = k2; _i3 < this.m; _i3++) { + A2[_i3][j3] += t4 * A2[_i3][k2]; + } + ; + } + e3[j3] = A2[k2][j3]; + } + ; + if (/* @__PURE__ */ (function(lhs, rhs) { + return lhs && rhs; + })(wantu, k2 < nct)) { + for (var _i4 = k2; _i4 < this.m; _i4++) { + this.U[_i4][k2] = A2[_i4][k2]; + } + ; + } + if (k2 < nrt) { + e3[k2] = 0; + for (var _i5 = k2 + 1; _i5 < this.n; _i5++) { + e3[k2] = SVD.hypot(e3[k2], e3[_i5]); + } + ; + if (e3[k2] !== 0) { + if (e3[k2 + 1] < 0) { + e3[k2] = -e3[k2]; + } + for (var _i6 = k2 + 1; _i6 < this.n; _i6++) { + e3[_i6] /= e3[k2]; + } + ; + e3[k2 + 1] += 1; + } + e3[k2] = -e3[k2]; + if (/* @__PURE__ */ (function(lhs, rhs) { + return lhs && rhs; + })(k2 + 1 < this.m, e3[k2] !== 0)) { + for (var _i7 = k2 + 1; _i7 < this.m; _i7++) { + work[_i7] = 0; + } + ; + for (var _j = k2 + 1; _j < this.n; _j++) { + for (var _i8 = k2 + 1; _i8 < this.m; _i8++) { + work[_i8] += e3[_j] * A2[_i8][_j]; + } + ; + } + ; + for (var _j2 = k2 + 1; _j2 < this.n; _j2++) { + var _t = -e3[_j2] / e3[k2 + 1]; + for (var _i9 = k2 + 1; _i9 < this.m; _i9++) { + A2[_i9][_j2] += _t * work[_i9]; + } + ; + } + ; + } + if (wantv) { + for (var _i10 = k2 + 1; _i10 < this.n; _i10++) { + this.V[_i10][k2] = e3[_i10]; + } + ; + } + } + } + ; + var p3 = Math.min(this.n, this.m + 1); + if (nct < this.n) { + this.s[nct] = A2[nct][nct]; + } + if (this.m < p3) { + this.s[p3 - 1] = 0; + } + if (nrt + 1 < p3) { + e3[nrt] = A2[nrt][p3 - 1]; + } + e3[p3 - 1] = 0; + if (wantu) { + for (var _j3 = nct; _j3 < nu; _j3++) { + for (var _i11 = 0; _i11 < this.m; _i11++) { + this.U[_i11][_j3] = 0; + } + ; + this.U[_j3][_j3] = 1; + } + ; + for (var _k = nct - 1; _k >= 0; _k--) { + if (this.s[_k] !== 0) { + for (var _j4 = _k + 1; _j4 < nu; _j4++) { + var _t2 = 0; + for (var _i12 = _k; _i12 < this.m; _i12++) { + _t2 += this.U[_i12][_k] * this.U[_i12][_j4]; + } + ; + _t2 = -_t2 / this.U[_k][_k]; + for (var _i13 = _k; _i13 < this.m; _i13++) { + this.U[_i13][_j4] += _t2 * this.U[_i13][_k]; + } + ; + } + ; + for (var _i14 = _k; _i14 < this.m; _i14++) { + this.U[_i14][_k] = -this.U[_i14][_k]; + } + ; + this.U[_k][_k] = 1 + this.U[_k][_k]; + for (var _i15 = 0; _i15 < _k - 1; _i15++) { + this.U[_i15][_k] = 0; + } + ; + } else { + for (var _i16 = 0; _i16 < this.m; _i16++) { + this.U[_i16][_k] = 0; + } + ; + this.U[_k][_k] = 1; + } + } + ; + } + if (wantv) { + for (var _k2 = this.n - 1; _k2 >= 0; _k2--) { + if (/* @__PURE__ */ (function(lhs, rhs) { + return lhs && rhs; + })(_k2 < nrt, e3[_k2] !== 0)) { + for (var _j5 = _k2 + 1; _j5 < nu; _j5++) { + var _t3 = 0; + for (var _i17 = _k2 + 1; _i17 < this.n; _i17++) { + _t3 += this.V[_i17][_k2] * this.V[_i17][_j5]; + } + ; + _t3 = -_t3 / this.V[_k2 + 1][_k2]; + for (var _i18 = _k2 + 1; _i18 < this.n; _i18++) { + this.V[_i18][_j5] += _t3 * this.V[_i18][_k2]; + } + ; + } + ; + } + for (var _i19 = 0; _i19 < this.n; _i19++) { + this.V[_i19][_k2] = 0; + } + ; + this.V[_k2][_k2] = 1; + } + ; + } + var pp = p3 - 1; + var iter = 0; + var eps = Math.pow(2, -52); + var tiny = Math.pow(2, -966); + while (p3 > 0) { + var _k3 = void 0; + var kase = void 0; + for (_k3 = p3 - 2; _k3 >= -1; _k3--) { + if (_k3 === -1) { + break; + } + if (Math.abs(e3[_k3]) <= tiny + eps * (Math.abs(this.s[_k3]) + Math.abs(this.s[_k3 + 1]))) { + e3[_k3] = 0; + break; + } + } + ; + if (_k3 === p3 - 2) { + kase = 4; + } else { + var ks = void 0; + for (ks = p3 - 1; ks >= _k3; ks--) { + if (ks === _k3) { + break; + } + var _t4 = (ks !== p3 ? Math.abs(e3[ks]) : 0) + (ks !== _k3 + 1 ? Math.abs(e3[ks - 1]) : 0); + if (Math.abs(this.s[ks]) <= tiny + eps * _t4) { + this.s[ks] = 0; + break; + } + } + ; + if (ks === _k3) { + kase = 3; + } else if (ks === p3 - 1) { + kase = 1; + } else { + kase = 2; + _k3 = ks; + } + } + _k3++; + switch (kase) { + case 1: + { + var f2 = e3[p3 - 2]; + e3[p3 - 2] = 0; + for (var _j6 = p3 - 2; _j6 >= _k3; _j6--) { + var _t5 = SVD.hypot(this.s[_j6], f2); + var cs = this.s[_j6] / _t5; + var sn = f2 / _t5; + this.s[_j6] = _t5; + if (_j6 !== _k3) { + f2 = -sn * e3[_j6 - 1]; + e3[_j6 - 1] = cs * e3[_j6 - 1]; + } + if (wantv) { + for (var _i20 = 0; _i20 < this.n; _i20++) { + _t5 = cs * this.V[_i20][_j6] + sn * this.V[_i20][p3 - 1]; + this.V[_i20][p3 - 1] = -sn * this.V[_i20][_j6] + cs * this.V[_i20][p3 - 1]; + this.V[_i20][_j6] = _t5; + } + ; + } + } + ; + } + ; + break; + case 2: + { + var _f = e3[_k3 - 1]; + e3[_k3 - 1] = 0; + for (var _j7 = _k3; _j7 < p3; _j7++) { + var _t6 = SVD.hypot(this.s[_j7], _f); + var _cs = this.s[_j7] / _t6; + var _sn = _f / _t6; + this.s[_j7] = _t6; + _f = -_sn * e3[_j7]; + e3[_j7] = _cs * e3[_j7]; + if (wantu) { + for (var _i21 = 0; _i21 < this.m; _i21++) { + _t6 = _cs * this.U[_i21][_j7] + _sn * this.U[_i21][_k3 - 1]; + this.U[_i21][_k3 - 1] = -_sn * this.U[_i21][_j7] + _cs * this.U[_i21][_k3 - 1]; + this.U[_i21][_j7] = _t6; + } + ; + } + } + ; + } + ; + break; + case 3: + { + var scale3 = Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[p3 - 1]), Math.abs(this.s[p3 - 2])), Math.abs(e3[p3 - 2])), Math.abs(this.s[_k3])), Math.abs(e3[_k3])); + var sp = this.s[p3 - 1] / scale3; + var spm1 = this.s[p3 - 2] / scale3; + var epm1 = e3[p3 - 2] / scale3; + var sk = this.s[_k3] / scale3; + var ek = e3[_k3] / scale3; + var b3 = ((spm1 + sp) * (spm1 - sp) + epm1 * epm1) / 2; + var c3 = sp * epm1 * (sp * epm1); + var shift2 = 0; + if (/* @__PURE__ */ (function(lhs, rhs) { + return lhs || rhs; + })(b3 !== 0, c3 !== 0)) { + shift2 = Math.sqrt(b3 * b3 + c3); + if (b3 < 0) { + shift2 = -shift2; + } + shift2 = c3 / (b3 + shift2); + } + var _f2 = (sk + sp) * (sk - sp) + shift2; + var g2 = sk * ek; + for (var _j8 = _k3; _j8 < p3 - 1; _j8++) { + var _t7 = SVD.hypot(_f2, g2); + var _cs2 = _f2 / _t7; + var _sn2 = g2 / _t7; + if (_j8 !== _k3) { + e3[_j8 - 1] = _t7; + } + _f2 = _cs2 * this.s[_j8] + _sn2 * e3[_j8]; + e3[_j8] = _cs2 * e3[_j8] - _sn2 * this.s[_j8]; + g2 = _sn2 * this.s[_j8 + 1]; + this.s[_j8 + 1] = _cs2 * this.s[_j8 + 1]; + if (wantv) { + for (var _i22 = 0; _i22 < this.n; _i22++) { + _t7 = _cs2 * this.V[_i22][_j8] + _sn2 * this.V[_i22][_j8 + 1]; + this.V[_i22][_j8 + 1] = -_sn2 * this.V[_i22][_j8] + _cs2 * this.V[_i22][_j8 + 1]; + this.V[_i22][_j8] = _t7; + } + ; + } + _t7 = SVD.hypot(_f2, g2); + _cs2 = _f2 / _t7; + _sn2 = g2 / _t7; + this.s[_j8] = _t7; + _f2 = _cs2 * e3[_j8] + _sn2 * this.s[_j8 + 1]; + this.s[_j8 + 1] = -_sn2 * e3[_j8] + _cs2 * this.s[_j8 + 1]; + g2 = _sn2 * e3[_j8 + 1]; + e3[_j8 + 1] = _cs2 * e3[_j8 + 1]; + if (wantu && _j8 < this.m - 1) { + for (var _i23 = 0; _i23 < this.m; _i23++) { + _t7 = _cs2 * this.U[_i23][_j8] + _sn2 * this.U[_i23][_j8 + 1]; + this.U[_i23][_j8 + 1] = -_sn2 * this.U[_i23][_j8] + _cs2 * this.U[_i23][_j8 + 1]; + this.U[_i23][_j8] = _t7; + } + ; + } + } + ; + e3[p3 - 2] = _f2; + iter = iter + 1; + } + ; + break; + case 4: + { + if (this.s[_k3] <= 0) { + this.s[_k3] = this.s[_k3] < 0 ? -this.s[_k3] : 0; + if (wantv) { + for (var _i24 = 0; _i24 <= pp; _i24++) { + this.V[_i24][_k3] = -this.V[_i24][_k3]; + } + ; + } + } + while (_k3 < pp) { + if (this.s[_k3] >= this.s[_k3 + 1]) { + break; + } + var _t8 = this.s[_k3]; + this.s[_k3] = this.s[_k3 + 1]; + this.s[_k3 + 1] = _t8; + if (wantv && _k3 < this.n - 1) { + for (var _i25 = 0; _i25 < this.n; _i25++) { + _t8 = this.V[_i25][_k3 + 1]; + this.V[_i25][_k3 + 1] = this.V[_i25][_k3]; + this.V[_i25][_k3] = _t8; + } + ; + } + if (wantu && _k3 < this.m - 1) { + for (var _i26 = 0; _i26 < this.m; _i26++) { + _t8 = this.U[_i26][_k3 + 1]; + this.U[_i26][_k3 + 1] = this.U[_i26][_k3]; + this.U[_i26][_k3] = _t8; + } + ; + } + _k3++; + } + ; + iter = 0; + p3--; + } + ; + break; + } + } + ; + var result = { U: this.U, V: this.V, S: this.s }; + return result; + }; + SVD.hypot = function(a2, b3) { + var r2 = void 0; + if (Math.abs(a2) > Math.abs(b3)) { + r2 = b3 / a2; + r2 = Math.abs(a2) * Math.sqrt(1 + r2 * r2); + } else if (b3 != 0) { + r2 = a2 / b3; + r2 = Math.abs(b3) * Math.sqrt(1 + r2 * r2); + } else { + r2 = 0; + } + return r2; + }; + module3.exports = SVD; + }), + /* 27 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var _createClass2 = /* @__PURE__ */ (function() { + function defineProperties(target, props) { + for (var i2 = 0; i2 < props.length; i2++) { + var descriptor = props[i2]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + __name(defineProperties, "defineProperties"); + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _classCallCheck2(instance2, Constructor) { + if (!(instance2 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + __name(_classCallCheck2, "_classCallCheck"); + var NeedlemanWunsch = (function() { + function NeedlemanWunsch2(sequence1, sequence2) { + var match_score = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; + var mismatch_penalty = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1; + var gap_penalty = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1; + _classCallCheck2(this, NeedlemanWunsch2); + this.sequence1 = sequence1; + this.sequence2 = sequence2; + this.match_score = match_score; + this.mismatch_penalty = mismatch_penalty; + this.gap_penalty = gap_penalty; + this.iMax = sequence1.length + 1; + this.jMax = sequence2.length + 1; + this.grid = new Array(this.iMax); + for (var i2 = 0; i2 < this.iMax; i2++) { + this.grid[i2] = new Array(this.jMax); + for (var j3 = 0; j3 < this.jMax; j3++) { + this.grid[i2][j3] = 0; + } + } + this.tracebackGrid = new Array(this.iMax); + for (var _i = 0; _i < this.iMax; _i++) { + this.tracebackGrid[_i] = new Array(this.jMax); + for (var _j = 0; _j < this.jMax; _j++) { + this.tracebackGrid[_i][_j] = [null, null, null]; + } + } + this.alignments = []; + this.score = -1; + this.computeGrids(); + } + __name(NeedlemanWunsch2, "NeedlemanWunsch"); + _createClass2(NeedlemanWunsch2, [{ + key: "getScore", + value: /* @__PURE__ */ __name(function getScore() { + return this.score; + }, "getScore") + }, { + key: "getAlignments", + value: /* @__PURE__ */ __name(function getAlignments2() { + return this.alignments; + }, "getAlignments") + // Main dynamic programming procedure + }, { + key: "computeGrids", + value: /* @__PURE__ */ __name(function computeGrids() { + for (var j3 = 1; j3 < this.jMax; j3++) { + this.grid[0][j3] = this.grid[0][j3 - 1] + this.gap_penalty; + this.tracebackGrid[0][j3] = [false, false, true]; + } + for (var i2 = 1; i2 < this.iMax; i2++) { + this.grid[i2][0] = this.grid[i2 - 1][0] + this.gap_penalty; + this.tracebackGrid[i2][0] = [false, true, false]; + } + for (var _i2 = 1; _i2 < this.iMax; _i2++) { + for (var _j2 = 1; _j2 < this.jMax; _j2++) { + var diag = void 0; + if (this.sequence1[_i2 - 1] === this.sequence2[_j2 - 1]) diag = this.grid[_i2 - 1][_j2 - 1] + this.match_score; + else diag = this.grid[_i2 - 1][_j2 - 1] + this.mismatch_penalty; + var up = this.grid[_i2 - 1][_j2] + this.gap_penalty; + var left3 = this.grid[_i2][_j2 - 1] + this.gap_penalty; + var maxOf = [diag, up, left3]; + var indices = this.arrayAllMaxIndexes(maxOf); + this.grid[_i2][_j2] = maxOf[indices[0]]; + this.tracebackGrid[_i2][_j2] = [indices.includes(0), indices.includes(1), indices.includes(2)]; + } + } + this.score = this.grid[this.iMax - 1][this.jMax - 1]; + }, "computeGrids") + // Gets all possible valid sequence combinations + }, { + key: "alignmentTraceback", + value: /* @__PURE__ */ __name(function alignmentTraceback() { + var inProcessAlignments = []; + inProcessAlignments.push({ + pos: [this.sequence1.length, this.sequence2.length], + seq1: "", + seq2: "" + }); + while (inProcessAlignments[0]) { + var current = inProcessAlignments[0]; + var directions = this.tracebackGrid[current.pos[0]][current.pos[1]]; + if (directions[0]) { + inProcessAlignments.push({ + pos: [current.pos[0] - 1, current.pos[1] - 1], + seq1: this.sequence1[current.pos[0] - 1] + current.seq1, + seq2: this.sequence2[current.pos[1] - 1] + current.seq2 + }); + } + if (directions[1]) { + inProcessAlignments.push({ + pos: [current.pos[0] - 1, current.pos[1]], + seq1: this.sequence1[current.pos[0] - 1] + current.seq1, + seq2: "-" + current.seq2 + }); + } + if (directions[2]) { + inProcessAlignments.push({ + pos: [current.pos[0], current.pos[1] - 1], + seq1: "-" + current.seq1, + seq2: this.sequence2[current.pos[1] - 1] + current.seq2 + }); + } + if (current.pos[0] === 0 && current.pos[1] === 0) this.alignments.push({ + sequence1: current.seq1, + sequence2: current.seq2 + }); + inProcessAlignments.shift(); + } + return this.alignments; + }, "alignmentTraceback") + // Helper Functions + }, { + key: "getAllIndexes", + value: /* @__PURE__ */ __name(function getAllIndexes(arr, val) { + var indexes = [], i2 = -1; + while ((i2 = arr.indexOf(val, i2 + 1)) !== -1) { + indexes.push(i2); + } + return indexes; + }, "getAllIndexes") + }, { + key: "arrayAllMaxIndexes", + value: /* @__PURE__ */ __name(function arrayAllMaxIndexes(array4) { + return this.getAllIndexes(array4, Math.max.apply(null, array4)); + }, "arrayAllMaxIndexes") + }]); + return NeedlemanWunsch2; + })(); + module3.exports = NeedlemanWunsch; + }), + /* 28 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + var layoutBase = /* @__PURE__ */ __name(function layoutBase2() { + return; + }, "layoutBase"); + layoutBase.FDLayout = __webpack_require__(18); + layoutBase.FDLayoutConstants = __webpack_require__(4); + layoutBase.FDLayoutEdge = __webpack_require__(19); + layoutBase.FDLayoutNode = __webpack_require__(20); + layoutBase.DimensionD = __webpack_require__(21); + layoutBase.HashMap = __webpack_require__(22); + layoutBase.HashSet = __webpack_require__(23); + layoutBase.IGeometry = __webpack_require__(8); + layoutBase.IMath = __webpack_require__(9); + layoutBase.Integer = __webpack_require__(10); + layoutBase.Point = __webpack_require__(12); + layoutBase.PointD = __webpack_require__(5); + layoutBase.RandomSeed = __webpack_require__(16); + layoutBase.RectangleD = __webpack_require__(13); + layoutBase.Transform = __webpack_require__(17); + layoutBase.UniqueIDGeneretor = __webpack_require__(14); + layoutBase.Quicksort = __webpack_require__(25); + layoutBase.LinkedList = __webpack_require__(11); + layoutBase.LGraphObject = __webpack_require__(2); + layoutBase.LGraph = __webpack_require__(6); + layoutBase.LEdge = __webpack_require__(1); + layoutBase.LGraphManager = __webpack_require__(7); + layoutBase.LNode = __webpack_require__(3); + layoutBase.Layout = __webpack_require__(15); + layoutBase.LayoutConstants = __webpack_require__(0); + layoutBase.NeedlemanWunsch = __webpack_require__(27); + layoutBase.Matrix = __webpack_require__(24); + layoutBase.SVD = __webpack_require__(26); + module3.exports = layoutBase; + }), + /* 29 */ + /***/ + (function(module3, exports3, __webpack_require__) { + "use strict"; + function Emitter2() { + this.listeners = []; + } + __name(Emitter2, "Emitter"); + var p3 = Emitter2.prototype; + p3.addListener = function(event3, callback) { + this.listeners.push({ + event: event3, + callback + }); + }; + p3.removeListener = function(event3, callback) { + for (var i2 = this.listeners.length; i2 >= 0; i2--) { + var l4 = this.listeners[i2]; + if (l4.event === event3 && l4.callback === callback) { + this.listeners.splice(i2, 1); + } + } + }; + p3.emit = function(event3, data5) { + for (var i2 = 0; i2 < this.listeners.length; i2++) { + var l4 = this.listeners[i2]; + if (event3 === l4.event) { + l4.callback(data5); + } + } + }; + module3.exports = Emitter2; + }) + /******/ + ]) + ); + }); + } + }); + + // ../../node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js + var require_cose_base2 = __commonJS({ + "../../node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js"(exports2, module2) { + "use strict"; + (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root4, factory) { + if (typeof exports2 === "object" && typeof module2 === "object") + module2.exports = factory(require_layout_base2()); + else if (typeof define === "function" && define.amd) + define(["layout-base"], factory); + else if (typeof exports2 === "object") + exports2["coseBase"] = factory(require_layout_base2()); + else + root4["coseBase"] = factory(root4["layoutBase"]); + }), "webpackUniversalModuleDefinition"))(exports2, function(__WEBPACK_EXTERNAL_MODULE__551__) { + return ( + /******/ + (() => { + "use strict"; + var __webpack_modules__ = { + /***/ + 45: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var coseBase = {}; + coseBase.layoutBase = __webpack_require__2(551); + coseBase.CoSEConstants = __webpack_require__2(806); + coseBase.CoSEEdge = __webpack_require__2(767); + coseBase.CoSEGraph = __webpack_require__2(880); + coseBase.CoSEGraphManager = __webpack_require__2(578); + coseBase.CoSELayout = __webpack_require__2(765); + coseBase.CoSENode = __webpack_require__2(991); + coseBase.ConstraintHandler = __webpack_require__2(902); + module3.exports = coseBase; + }) + ), + /***/ + 806: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var FDLayoutConstants = __webpack_require__2(551).FDLayoutConstants; + function CoSEConstants() { + } + __name(CoSEConstants, "CoSEConstants"); + for (var prop in FDLayoutConstants) { + CoSEConstants[prop] = FDLayoutConstants[prop]; + } + CoSEConstants.DEFAULT_USE_MULTI_LEVEL_SCALING = false; + CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH; + CoSEConstants.DEFAULT_COMPONENT_SEPERATION = 60; + CoSEConstants.TILE = true; + CoSEConstants.TILING_PADDING_VERTICAL = 10; + CoSEConstants.TILING_PADDING_HORIZONTAL = 10; + CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = true; + CoSEConstants.ENFORCE_CONSTRAINTS = true; + CoSEConstants.APPLY_LAYOUT = true; + CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS = true; + CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true; + CoSEConstants.PURE_INCREMENTAL = CoSEConstants.DEFAULT_INCREMENTAL; + module3.exports = CoSEConstants; + }) + ), + /***/ + 767: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var FDLayoutEdge = __webpack_require__2(551).FDLayoutEdge; + function CoSEEdge(source, target, vEdge) { + FDLayoutEdge.call(this, source, target, vEdge); + } + __name(CoSEEdge, "CoSEEdge"); + CoSEEdge.prototype = Object.create(FDLayoutEdge.prototype); + for (var prop in FDLayoutEdge) { + CoSEEdge[prop] = FDLayoutEdge[prop]; + } + module3.exports = CoSEEdge; + }) + ), + /***/ + 880: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var LGraph = __webpack_require__2(551).LGraph; + function CoSEGraph(parent4, graphMgr, vGraph) { + LGraph.call(this, parent4, graphMgr, vGraph); + } + __name(CoSEGraph, "CoSEGraph"); + CoSEGraph.prototype = Object.create(LGraph.prototype); + for (var prop in LGraph) { + CoSEGraph[prop] = LGraph[prop]; + } + module3.exports = CoSEGraph; + }) + ), + /***/ + 578: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var LGraphManager = __webpack_require__2(551).LGraphManager; + function CoSEGraphManager(layout7) { + LGraphManager.call(this, layout7); + } + __name(CoSEGraphManager, "CoSEGraphManager"); + CoSEGraphManager.prototype = Object.create(LGraphManager.prototype); + for (var prop in LGraphManager) { + CoSEGraphManager[prop] = LGraphManager[prop]; + } + module3.exports = CoSEGraphManager; + }) + ), + /***/ + 765: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var FDLayout = __webpack_require__2(551).FDLayout; + var CoSEGraphManager = __webpack_require__2(578); + var CoSEGraph = __webpack_require__2(880); + var CoSENode = __webpack_require__2(991); + var CoSEEdge = __webpack_require__2(767); + var CoSEConstants = __webpack_require__2(806); + var ConstraintHandler = __webpack_require__2(902); + var FDLayoutConstants = __webpack_require__2(551).FDLayoutConstants; + var LayoutConstants = __webpack_require__2(551).LayoutConstants; + var Point3 = __webpack_require__2(551).Point; + var PointD = __webpack_require__2(551).PointD; + var DimensionD2 = __webpack_require__2(551).DimensionD; + var Layout2 = __webpack_require__2(551).Layout; + var Integer = __webpack_require__2(551).Integer; + var IGeometry = __webpack_require__2(551).IGeometry; + var LGraph = __webpack_require__2(551).LGraph; + var Transform2 = __webpack_require__2(551).Transform; + var LinkedList = __webpack_require__2(551).LinkedList; + function CoSELayout() { + FDLayout.call(this); + this.toBeTiled = {}; + this.constraints = {}; + } + __name(CoSELayout, "CoSELayout"); + CoSELayout.prototype = Object.create(FDLayout.prototype); + for (var prop in FDLayout) { + CoSELayout[prop] = FDLayout[prop]; + } + CoSELayout.prototype.newGraphManager = function() { + var gm = new CoSEGraphManager(this); + this.graphManager = gm; + return gm; + }; + CoSELayout.prototype.newGraph = function(vGraph) { + return new CoSEGraph(null, this.graphManager, vGraph); + }; + CoSELayout.prototype.newNode = function(vNode) { + return new CoSENode(this.graphManager, vNode); + }; + CoSELayout.prototype.newEdge = function(vEdge) { + return new CoSEEdge(null, null, vEdge); + }; + CoSELayout.prototype.initParameters = function() { + FDLayout.prototype.initParameters.call(this, arguments); + if (!this.isSubLayout) { + if (CoSEConstants.DEFAULT_EDGE_LENGTH < 10) { + this.idealEdgeLength = 10; + } else { + this.idealEdgeLength = CoSEConstants.DEFAULT_EDGE_LENGTH; + } + this.useSmartIdealEdgeLengthCalculation = CoSEConstants.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION; + this.gravityConstant = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH; + this.compoundGravityConstant = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH; + this.gravityRangeFactor = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR; + this.compoundGravityRangeFactor = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR; + this.prunedNodesAll = []; + this.growTreeIterations = 0; + this.afterGrowthIterations = 0; + this.isTreeGrowing = false; + this.isGrowthFinished = false; + } + }; + CoSELayout.prototype.initSpringEmbedder = function() { + FDLayout.prototype.initSpringEmbedder.call(this); + this.coolingCycle = 0; + this.maxCoolingCycle = this.maxIterations / FDLayoutConstants.CONVERGENCE_CHECK_PERIOD; + this.finalTemperature = 0.04; + this.coolingAdjuster = 1; + }; + CoSELayout.prototype.layout = function() { + var createBendsAsNeeded = LayoutConstants.DEFAULT_CREATE_BENDS_AS_NEEDED; + if (createBendsAsNeeded) { + this.createBendpoints(); + this.graphManager.resetAllEdges(); + } + this.level = 0; + return this.classicLayout(); + }; + CoSELayout.prototype.classicLayout = function() { + this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(); + this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity); + this.calcNoOfChildrenForAllNodes(); + this.graphManager.calcLowestCommonAncestors(); + this.graphManager.calcInclusionTreeDepths(); + this.graphManager.getRoot().calcEstimatedSize(); + this.calcIdealEdgeLengths(); + if (!this.incremental) { + var forest = this.getFlatForest(); + if (forest.length > 0) { + this.positionNodesRadially(forest); + } else { + this.reduceTrees(); + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection4 = this.nodesWithGravity.filter(function(x5) { + return allNodes.has(x5); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection4); + this.positionNodesRandomly(); + } + } else { + if (CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL) { + this.reduceTrees(); + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection4 = this.nodesWithGravity.filter(function(x5) { + return allNodes.has(x5); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection4); + } + } + if (Object.keys(this.constraints).length > 0) { + ConstraintHandler.handleConstraints(this); + this.initConstraintVariables(); + } + this.initSpringEmbedder(); + if (CoSEConstants.APPLY_LAYOUT) { + this.runSpringEmbedder(); + } + return true; + }; + CoSELayout.prototype.tick = function() { + this.totalIterations++; + if (this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) { + if (this.prunedNodesAll.length > 0) { + this.isTreeGrowing = true; + } else { + return true; + } + } + if (this.totalIterations % FDLayoutConstants.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) { + if (this.isConverged()) { + if (this.prunedNodesAll.length > 0) { + this.isTreeGrowing = true; + } else { + return true; + } + } + this.coolingCycle++; + if (this.layoutQuality == 0) { + this.coolingAdjuster = this.coolingCycle; + } else if (this.layoutQuality == 1) { + this.coolingAdjuster = this.coolingCycle / 3; + } + this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature); + this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor)); + } + if (this.isTreeGrowing) { + if (this.growTreeIterations % 10 == 0) { + if (this.prunedNodesAll.length > 0) { + this.graphManager.updateBounds(); + this.updateGrid(); + this.growTree(this.prunedNodesAll); + this.graphManager.resetAllNodesToApplyGravitation(); + var allNodes = new Set(this.getAllNodes()); + var intersection4 = this.nodesWithGravity.filter(function(x5) { + return allNodes.has(x5); + }); + this.graphManager.setAllNodesToApplyGravitation(intersection4); + this.graphManager.updateBounds(); + this.updateGrid(); + if (CoSEConstants.PURE_INCREMENTAL) this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2; + else this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL; + } else { + this.isTreeGrowing = false; + this.isGrowthFinished = true; + } + } + this.growTreeIterations++; + } + if (this.isGrowthFinished) { + if (this.isConverged()) { + return true; + } + if (this.afterGrowthIterations % 10 == 0) { + this.graphManager.updateBounds(); + this.updateGrid(); + } + if (CoSEConstants.PURE_INCREMENTAL) this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 * ((100 - this.afterGrowthIterations) / 100); + else this.coolingFactor = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100); + this.afterGrowthIterations++; + } + var gridUpdateAllowed = !this.isTreeGrowing && !this.isGrowthFinished; + var forceToNodeSurroundingUpdate = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished; + this.totalDisplacement = 0; + this.graphManager.updateBounds(); + this.calcSpringForces(); + this.calcRepulsionForces(gridUpdateAllowed, forceToNodeSurroundingUpdate); + this.calcGravitationalForces(); + this.moveNodes(); + this.animate(); + return false; + }; + CoSELayout.prototype.getPositionsData = function() { + var allNodes = this.graphManager.getAllNodes(); + var pData = {}; + for (var i2 = 0; i2 < allNodes.length; i2++) { + var rect3 = allNodes[i2].rect; + var id35 = allNodes[i2].id; + pData[id35] = { + id: id35, + x: rect3.getCenterX(), + y: rect3.getCenterY(), + w: rect3.width, + h: rect3.height + }; + } + return pData; + }; + CoSELayout.prototype.runSpringEmbedder = function() { + this.initialAnimationPeriod = 25; + this.animationPeriod = this.initialAnimationPeriod; + var layoutEnded = false; + if (FDLayoutConstants.ANIMATE === "during") { + this.emit("layoutstarted"); + } else { + while (!layoutEnded) { + layoutEnded = this.tick(); + } + this.graphManager.updateBounds(); + } + }; + CoSELayout.prototype.moveNodes = function() { + var lNodes = this.getAllNodes(); + var node2; + for (var i2 = 0; i2 < lNodes.length; i2++) { + node2 = lNodes[i2]; + node2.calculateDisplacement(); + } + if (Object.keys(this.constraints).length > 0) { + this.updateDisplacements(); + } + for (var i2 = 0; i2 < lNodes.length; i2++) { + node2 = lNodes[i2]; + node2.move(); + } + }; + CoSELayout.prototype.initConstraintVariables = function() { + var self2 = this; + this.idToNodeMap = /* @__PURE__ */ new Map(); + this.fixedNodeSet = /* @__PURE__ */ new Set(); + var allNodes = this.graphManager.getAllNodes(); + for (var i2 = 0; i2 < allNodes.length; i2++) { + var node2 = allNodes[i2]; + this.idToNodeMap.set(node2.id, node2); + } + var calculateCompoundWeight = /* @__PURE__ */ __name(function calculateCompoundWeight2(compoundNode) { + var nodes5 = compoundNode.getChild().getNodes(); + var node3; + var fixedNodeWeight2 = 0; + for (var i3 = 0; i3 < nodes5.length; i3++) { + node3 = nodes5[i3]; + if (node3.getChild() == null) { + if (self2.fixedNodeSet.has(node3.id)) { + fixedNodeWeight2 += 100; + } + } else { + fixedNodeWeight2 += calculateCompoundWeight2(node3); + } + } + return fixedNodeWeight2; + }, "calculateCompoundWeight"); + if (this.constraints.fixedNodeConstraint) { + this.constraints.fixedNodeConstraint.forEach(function(nodeData2) { + self2.fixedNodeSet.add(nodeData2.nodeId); + }); + var allNodes = this.graphManager.getAllNodes(); + var node2; + for (var i2 = 0; i2 < allNodes.length; i2++) { + node2 = allNodes[i2]; + if (node2.getChild() != null) { + var fixedNodeWeight = calculateCompoundWeight(node2); + if (fixedNodeWeight > 0) { + node2.fixedNodeWeight = fixedNodeWeight; + } + } + } + } + if (this.constraints.relativePlacementConstraint) { + var nodeToDummyForVerticalAlignment = /* @__PURE__ */ new Map(); + var nodeToDummyForHorizontalAlignment = /* @__PURE__ */ new Map(); + this.dummyToNodeForVerticalAlignment = /* @__PURE__ */ new Map(); + this.dummyToNodeForHorizontalAlignment = /* @__PURE__ */ new Map(); + this.fixedNodesOnHorizontal = /* @__PURE__ */ new Set(); + this.fixedNodesOnVertical = /* @__PURE__ */ new Set(); + this.fixedNodeSet.forEach(function(nodeId) { + self2.fixedNodesOnHorizontal.add(nodeId); + self2.fixedNodesOnVertical.add(nodeId); + }); + if (this.constraints.alignmentConstraint) { + if (this.constraints.alignmentConstraint.vertical) { + var verticalAlignment2 = this.constraints.alignmentConstraint.vertical; + for (var i2 = 0; i2 < verticalAlignment2.length; i2++) { + this.dummyToNodeForVerticalAlignment.set("dummy" + i2, []); + verticalAlignment2[i2].forEach(function(nodeId) { + nodeToDummyForVerticalAlignment.set(nodeId, "dummy" + i2); + self2.dummyToNodeForVerticalAlignment.get("dummy" + i2).push(nodeId); + if (self2.fixedNodeSet.has(nodeId)) { + self2.fixedNodesOnHorizontal.add("dummy" + i2); + } + }); + } + } + if (this.constraints.alignmentConstraint.horizontal) { + var horizontalAlignment = this.constraints.alignmentConstraint.horizontal; + for (var i2 = 0; i2 < horizontalAlignment.length; i2++) { + this.dummyToNodeForHorizontalAlignment.set("dummy" + i2, []); + horizontalAlignment[i2].forEach(function(nodeId) { + nodeToDummyForHorizontalAlignment.set(nodeId, "dummy" + i2); + self2.dummyToNodeForHorizontalAlignment.get("dummy" + i2).push(nodeId); + if (self2.fixedNodeSet.has(nodeId)) { + self2.fixedNodesOnVertical.add("dummy" + i2); + } + }); + } + } + } + if (CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS) { + this.shuffle = function(array4) { + var j3, x5, i3; + for (i3 = array4.length - 1; i3 >= 2 * array4.length / 3; i3--) { + j3 = Math.floor(Math.random() * (i3 + 1)); + x5 = array4[i3]; + array4[i3] = array4[j3]; + array4[j3] = x5; + } + return array4; + }; + this.nodesInRelativeHorizontal = []; + this.nodesInRelativeVertical = []; + this.nodeToRelativeConstraintMapHorizontal = /* @__PURE__ */ new Map(); + this.nodeToRelativeConstraintMapVertical = /* @__PURE__ */ new Map(); + this.nodeToTempPositionMapHorizontal = /* @__PURE__ */ new Map(); + this.nodeToTempPositionMapVertical = /* @__PURE__ */ new Map(); + this.constraints.relativePlacementConstraint.forEach(function(constraint) { + if (constraint.left) { + var nodeIdLeft = nodeToDummyForVerticalAlignment.has(constraint.left) ? nodeToDummyForVerticalAlignment.get(constraint.left) : constraint.left; + var nodeIdRight = nodeToDummyForVerticalAlignment.has(constraint.right) ? nodeToDummyForVerticalAlignment.get(constraint.right) : constraint.right; + if (!self2.nodesInRelativeHorizontal.includes(nodeIdLeft)) { + self2.nodesInRelativeHorizontal.push(nodeIdLeft); + self2.nodeToRelativeConstraintMapHorizontal.set(nodeIdLeft, []); + if (self2.dummyToNodeForVerticalAlignment.has(nodeIdLeft)) { + self2.nodeToTempPositionMapHorizontal.set(nodeIdLeft, self2.idToNodeMap.get(self2.dummyToNodeForVerticalAlignment.get(nodeIdLeft)[0]).getCenterX()); + } else { + self2.nodeToTempPositionMapHorizontal.set(nodeIdLeft, self2.idToNodeMap.get(nodeIdLeft).getCenterX()); + } + } + if (!self2.nodesInRelativeHorizontal.includes(nodeIdRight)) { + self2.nodesInRelativeHorizontal.push(nodeIdRight); + self2.nodeToRelativeConstraintMapHorizontal.set(nodeIdRight, []); + if (self2.dummyToNodeForVerticalAlignment.has(nodeIdRight)) { + self2.nodeToTempPositionMapHorizontal.set(nodeIdRight, self2.idToNodeMap.get(self2.dummyToNodeForVerticalAlignment.get(nodeIdRight)[0]).getCenterX()); + } else { + self2.nodeToTempPositionMapHorizontal.set(nodeIdRight, self2.idToNodeMap.get(nodeIdRight).getCenterX()); + } + } + self2.nodeToRelativeConstraintMapHorizontal.get(nodeIdLeft).push({ right: nodeIdRight, gap: constraint.gap }); + self2.nodeToRelativeConstraintMapHorizontal.get(nodeIdRight).push({ left: nodeIdLeft, gap: constraint.gap }); + } else { + var nodeIdTop = nodeToDummyForHorizontalAlignment.has(constraint.top) ? nodeToDummyForHorizontalAlignment.get(constraint.top) : constraint.top; + var nodeIdBottom = nodeToDummyForHorizontalAlignment.has(constraint.bottom) ? nodeToDummyForHorizontalAlignment.get(constraint.bottom) : constraint.bottom; + if (!self2.nodesInRelativeVertical.includes(nodeIdTop)) { + self2.nodesInRelativeVertical.push(nodeIdTop); + self2.nodeToRelativeConstraintMapVertical.set(nodeIdTop, []); + if (self2.dummyToNodeForHorizontalAlignment.has(nodeIdTop)) { + self2.nodeToTempPositionMapVertical.set(nodeIdTop, self2.idToNodeMap.get(self2.dummyToNodeForHorizontalAlignment.get(nodeIdTop)[0]).getCenterY()); + } else { + self2.nodeToTempPositionMapVertical.set(nodeIdTop, self2.idToNodeMap.get(nodeIdTop).getCenterY()); + } + } + if (!self2.nodesInRelativeVertical.includes(nodeIdBottom)) { + self2.nodesInRelativeVertical.push(nodeIdBottom); + self2.nodeToRelativeConstraintMapVertical.set(nodeIdBottom, []); + if (self2.dummyToNodeForHorizontalAlignment.has(nodeIdBottom)) { + self2.nodeToTempPositionMapVertical.set(nodeIdBottom, self2.idToNodeMap.get(self2.dummyToNodeForHorizontalAlignment.get(nodeIdBottom)[0]).getCenterY()); + } else { + self2.nodeToTempPositionMapVertical.set(nodeIdBottom, self2.idToNodeMap.get(nodeIdBottom).getCenterY()); + } + } + self2.nodeToRelativeConstraintMapVertical.get(nodeIdTop).push({ bottom: nodeIdBottom, gap: constraint.gap }); + self2.nodeToRelativeConstraintMapVertical.get(nodeIdBottom).push({ top: nodeIdTop, gap: constraint.gap }); + } + }); + } else { + var subGraphOnHorizontal = /* @__PURE__ */ new Map(); + var subGraphOnVertical = /* @__PURE__ */ new Map(); + this.constraints.relativePlacementConstraint.forEach(function(constraint) { + if (constraint.left) { + var left3 = nodeToDummyForVerticalAlignment.has(constraint.left) ? nodeToDummyForVerticalAlignment.get(constraint.left) : constraint.left; + var right3 = nodeToDummyForVerticalAlignment.has(constraint.right) ? nodeToDummyForVerticalAlignment.get(constraint.right) : constraint.right; + if (subGraphOnHorizontal.has(left3)) { + subGraphOnHorizontal.get(left3).push(right3); + } else { + subGraphOnHorizontal.set(left3, [right3]); + } + if (subGraphOnHorizontal.has(right3)) { + subGraphOnHorizontal.get(right3).push(left3); + } else { + subGraphOnHorizontal.set(right3, [left3]); + } + } else { + var top2 = nodeToDummyForHorizontalAlignment.has(constraint.top) ? nodeToDummyForHorizontalAlignment.get(constraint.top) : constraint.top; + var bottom2 = nodeToDummyForHorizontalAlignment.has(constraint.bottom) ? nodeToDummyForHorizontalAlignment.get(constraint.bottom) : constraint.bottom; + if (subGraphOnVertical.has(top2)) { + subGraphOnVertical.get(top2).push(bottom2); + } else { + subGraphOnVertical.set(top2, [bottom2]); + } + if (subGraphOnVertical.has(bottom2)) { + subGraphOnVertical.get(bottom2).push(top2); + } else { + subGraphOnVertical.set(bottom2, [top2]); + } + } + }); + var constructComponents = /* @__PURE__ */ __name(function constructComponents2(graph, fixedNodes) { + var components3 = []; + var isFixed = []; + var queue = new LinkedList(); + var visited = /* @__PURE__ */ new Set(); + var count2 = 0; + graph.forEach(function(value2, key) { + if (!visited.has(key)) { + components3[count2] = []; + isFixed[count2] = false; + var currentNode = key; + queue.push(currentNode); + visited.add(currentNode); + components3[count2].push(currentNode); + while (queue.length != 0) { + currentNode = queue.shift(); + if (fixedNodes.has(currentNode)) { + isFixed[count2] = true; + } + var neighbors = graph.get(currentNode); + neighbors.forEach(function(neighbor) { + if (!visited.has(neighbor)) { + queue.push(neighbor); + visited.add(neighbor); + components3[count2].push(neighbor); + } + }); + } + count2++; + } + }); + return { components: components3, isFixed }; + }, "constructComponents"); + var resultOnHorizontal = constructComponents(subGraphOnHorizontal, self2.fixedNodesOnHorizontal); + this.componentsOnHorizontal = resultOnHorizontal.components; + this.fixedComponentsOnHorizontal = resultOnHorizontal.isFixed; + var resultOnVertical = constructComponents(subGraphOnVertical, self2.fixedNodesOnVertical); + this.componentsOnVertical = resultOnVertical.components; + this.fixedComponentsOnVertical = resultOnVertical.isFixed; + } + } + }; + CoSELayout.prototype.updateDisplacements = function() { + var self2 = this; + if (this.constraints.fixedNodeConstraint) { + this.constraints.fixedNodeConstraint.forEach(function(nodeData2) { + var fixedNode = self2.idToNodeMap.get(nodeData2.nodeId); + fixedNode.displacementX = 0; + fixedNode.displacementY = 0; + }); + } + if (this.constraints.alignmentConstraint) { + if (this.constraints.alignmentConstraint.vertical) { + var allVerticalAlignments = this.constraints.alignmentConstraint.vertical; + for (var i2 = 0; i2 < allVerticalAlignments.length; i2++) { + var totalDisplacementX = 0; + for (var j3 = 0; j3 < allVerticalAlignments[i2].length; j3++) { + if (this.fixedNodeSet.has(allVerticalAlignments[i2][j3])) { + totalDisplacementX = 0; + break; + } + totalDisplacementX += this.idToNodeMap.get(allVerticalAlignments[i2][j3]).displacementX; + } + var averageDisplacementX = totalDisplacementX / allVerticalAlignments[i2].length; + for (var j3 = 0; j3 < allVerticalAlignments[i2].length; j3++) { + this.idToNodeMap.get(allVerticalAlignments[i2][j3]).displacementX = averageDisplacementX; + } + } + } + if (this.constraints.alignmentConstraint.horizontal) { + var allHorizontalAlignments = this.constraints.alignmentConstraint.horizontal; + for (var i2 = 0; i2 < allHorizontalAlignments.length; i2++) { + var totalDisplacementY = 0; + for (var j3 = 0; j3 < allHorizontalAlignments[i2].length; j3++) { + if (this.fixedNodeSet.has(allHorizontalAlignments[i2][j3])) { + totalDisplacementY = 0; + break; + } + totalDisplacementY += this.idToNodeMap.get(allHorizontalAlignments[i2][j3]).displacementY; + } + var averageDisplacementY = totalDisplacementY / allHorizontalAlignments[i2].length; + for (var j3 = 0; j3 < allHorizontalAlignments[i2].length; j3++) { + this.idToNodeMap.get(allHorizontalAlignments[i2][j3]).displacementY = averageDisplacementY; + } + } + } + } + if (this.constraints.relativePlacementConstraint) { + if (CoSEConstants.RELAX_MOVEMENT_ON_CONSTRAINTS) { + if (this.totalIterations % 10 == 0) { + this.shuffle(this.nodesInRelativeHorizontal); + this.shuffle(this.nodesInRelativeVertical); + } + this.nodesInRelativeHorizontal.forEach(function(nodeId) { + if (!self2.fixedNodesOnHorizontal.has(nodeId)) { + var displacement = 0; + if (self2.dummyToNodeForVerticalAlignment.has(nodeId)) { + displacement = self2.idToNodeMap.get(self2.dummyToNodeForVerticalAlignment.get(nodeId)[0]).displacementX; + } else { + displacement = self2.idToNodeMap.get(nodeId).displacementX; + } + self2.nodeToRelativeConstraintMapHorizontal.get(nodeId).forEach(function(constraint) { + if (constraint.right) { + var diff2 = self2.nodeToTempPositionMapHorizontal.get(constraint.right) - self2.nodeToTempPositionMapHorizontal.get(nodeId) - displacement; + if (diff2 < constraint.gap) { + displacement -= constraint.gap - diff2; + } + } else { + var diff2 = self2.nodeToTempPositionMapHorizontal.get(nodeId) - self2.nodeToTempPositionMapHorizontal.get(constraint.left) + displacement; + if (diff2 < constraint.gap) { + displacement += constraint.gap - diff2; + } + } + }); + self2.nodeToTempPositionMapHorizontal.set(nodeId, self2.nodeToTempPositionMapHorizontal.get(nodeId) + displacement); + if (self2.dummyToNodeForVerticalAlignment.has(nodeId)) { + self2.dummyToNodeForVerticalAlignment.get(nodeId).forEach(function(nodeId2) { + self2.idToNodeMap.get(nodeId2).displacementX = displacement; + }); + } else { + self2.idToNodeMap.get(nodeId).displacementX = displacement; + } + } + }); + this.nodesInRelativeVertical.forEach(function(nodeId) { + if (!self2.fixedNodesOnHorizontal.has(nodeId)) { + var displacement = 0; + if (self2.dummyToNodeForHorizontalAlignment.has(nodeId)) { + displacement = self2.idToNodeMap.get(self2.dummyToNodeForHorizontalAlignment.get(nodeId)[0]).displacementY; + } else { + displacement = self2.idToNodeMap.get(nodeId).displacementY; + } + self2.nodeToRelativeConstraintMapVertical.get(nodeId).forEach(function(constraint) { + if (constraint.bottom) { + var diff2 = self2.nodeToTempPositionMapVertical.get(constraint.bottom) - self2.nodeToTempPositionMapVertical.get(nodeId) - displacement; + if (diff2 < constraint.gap) { + displacement -= constraint.gap - diff2; + } + } else { + var diff2 = self2.nodeToTempPositionMapVertical.get(nodeId) - self2.nodeToTempPositionMapVertical.get(constraint.top) + displacement; + if (diff2 < constraint.gap) { + displacement += constraint.gap - diff2; + } + } + }); + self2.nodeToTempPositionMapVertical.set(nodeId, self2.nodeToTempPositionMapVertical.get(nodeId) + displacement); + if (self2.dummyToNodeForHorizontalAlignment.has(nodeId)) { + self2.dummyToNodeForHorizontalAlignment.get(nodeId).forEach(function(nodeId2) { + self2.idToNodeMap.get(nodeId2).displacementY = displacement; + }); + } else { + self2.idToNodeMap.get(nodeId).displacementY = displacement; + } + } + }); + } else { + for (var i2 = 0; i2 < this.componentsOnHorizontal.length; i2++) { + var component2 = this.componentsOnHorizontal[i2]; + if (this.fixedComponentsOnHorizontal[i2]) { + for (var j3 = 0; j3 < component2.length; j3++) { + if (this.dummyToNodeForVerticalAlignment.has(component2[j3])) { + this.dummyToNodeForVerticalAlignment.get(component2[j3]).forEach(function(nodeId) { + self2.idToNodeMap.get(nodeId).displacementX = 0; + }); + } else { + this.idToNodeMap.get(component2[j3]).displacementX = 0; + } + } + } else { + var sum2 = 0; + var count2 = 0; + for (var j3 = 0; j3 < component2.length; j3++) { + if (this.dummyToNodeForVerticalAlignment.has(component2[j3])) { + var actualNodes = this.dummyToNodeForVerticalAlignment.get(component2[j3]); + sum2 += actualNodes.length * this.idToNodeMap.get(actualNodes[0]).displacementX; + count2 += actualNodes.length; + } else { + sum2 += this.idToNodeMap.get(component2[j3]).displacementX; + count2++; + } + } + var averageDisplacement = sum2 / count2; + for (var j3 = 0; j3 < component2.length; j3++) { + if (this.dummyToNodeForVerticalAlignment.has(component2[j3])) { + this.dummyToNodeForVerticalAlignment.get(component2[j3]).forEach(function(nodeId) { + self2.idToNodeMap.get(nodeId).displacementX = averageDisplacement; + }); + } else { + this.idToNodeMap.get(component2[j3]).displacementX = averageDisplacement; + } + } + } + } + for (var i2 = 0; i2 < this.componentsOnVertical.length; i2++) { + var component2 = this.componentsOnVertical[i2]; + if (this.fixedComponentsOnVertical[i2]) { + for (var j3 = 0; j3 < component2.length; j3++) { + if (this.dummyToNodeForHorizontalAlignment.has(component2[j3])) { + this.dummyToNodeForHorizontalAlignment.get(component2[j3]).forEach(function(nodeId) { + self2.idToNodeMap.get(nodeId).displacementY = 0; + }); + } else { + this.idToNodeMap.get(component2[j3]).displacementY = 0; + } + } + } else { + var sum2 = 0; + var count2 = 0; + for (var j3 = 0; j3 < component2.length; j3++) { + if (this.dummyToNodeForHorizontalAlignment.has(component2[j3])) { + var actualNodes = this.dummyToNodeForHorizontalAlignment.get(component2[j3]); + sum2 += actualNodes.length * this.idToNodeMap.get(actualNodes[0]).displacementY; + count2 += actualNodes.length; + } else { + sum2 += this.idToNodeMap.get(component2[j3]).displacementY; + count2++; + } + } + var averageDisplacement = sum2 / count2; + for (var j3 = 0; j3 < component2.length; j3++) { + if (this.dummyToNodeForHorizontalAlignment.has(component2[j3])) { + this.dummyToNodeForHorizontalAlignment.get(component2[j3]).forEach(function(nodeId) { + self2.idToNodeMap.get(nodeId).displacementY = averageDisplacement; + }); + } else { + this.idToNodeMap.get(component2[j3]).displacementY = averageDisplacement; + } + } + } + } + } + } + }; + CoSELayout.prototype.calculateNodesToApplyGravitationTo = function() { + var nodeList = []; + var graph; + var graphs = this.graphManager.getGraphs(); + var size4 = graphs.length; + var i2; + for (i2 = 0; i2 < size4; i2++) { + graph = graphs[i2]; + graph.updateConnected(); + if (!graph.isConnected) { + nodeList = nodeList.concat(graph.getNodes()); + } + } + return nodeList; + }; + CoSELayout.prototype.createBendpoints = function() { + var edges3 = []; + edges3 = edges3.concat(this.graphManager.getAllEdges()); + var visited = /* @__PURE__ */ new Set(); + var i2; + for (i2 = 0; i2 < edges3.length; i2++) { + var edge = edges3[i2]; + if (!visited.has(edge)) { + var source = edge.getSource(); + var target = edge.getTarget(); + if (source == target) { + edge.getBendpoints().push(new PointD()); + edge.getBendpoints().push(new PointD()); + this.createDummyNodesForBendpoints(edge); + visited.add(edge); + } else { + var edgeList2 = []; + edgeList2 = edgeList2.concat(source.getEdgeListToNode(target)); + edgeList2 = edgeList2.concat(target.getEdgeListToNode(source)); + if (!visited.has(edgeList2[0])) { + if (edgeList2.length > 1) { + var k2; + for (k2 = 0; k2 < edgeList2.length; k2++) { + var multiEdge = edgeList2[k2]; + multiEdge.getBendpoints().push(new PointD()); + this.createDummyNodesForBendpoints(multiEdge); + } + } + edgeList2.forEach(function(edge2) { + visited.add(edge2); + }); + } + } + } + if (visited.size == edges3.length) { + break; + } + } + }; + CoSELayout.prototype.positionNodesRadially = function(forest) { + var currentStartingPoint = new Point3(0, 0); + var numberOfColumns = Math.ceil(Math.sqrt(forest.length)); + var height2 = 0; + var currentY = 0; + var currentX = 0; + var point8 = new PointD(0, 0); + for (var i2 = 0; i2 < forest.length; i2++) { + if (i2 % numberOfColumns == 0) { + currentX = 0; + currentY = height2; + if (i2 != 0) { + currentY += CoSEConstants.DEFAULT_COMPONENT_SEPERATION; + } + height2 = 0; + } + var tree = forest[i2]; + var centerNode = Layout2.findCenterOfTree(tree); + currentStartingPoint.x = currentX; + currentStartingPoint.y = currentY; + point8 = CoSELayout.radialLayout(tree, centerNode, currentStartingPoint); + if (point8.y > height2) { + height2 = Math.floor(point8.y); + } + currentX = Math.floor(point8.x + CoSEConstants.DEFAULT_COMPONENT_SEPERATION); + } + this.transform(new PointD(LayoutConstants.WORLD_CENTER_X - point8.x / 2, LayoutConstants.WORLD_CENTER_Y - point8.y / 2)); + }; + CoSELayout.radialLayout = function(tree, centerNode, startingPoint) { + var radialSep = Math.max(this.maxDiagonalInTree(tree), CoSEConstants.DEFAULT_RADIAL_SEPARATION); + CoSELayout.branchRadialLayout(centerNode, null, 0, 359, 0, radialSep); + var bounds4 = LGraph.calculateBounds(tree); + var transform8 = new Transform2(); + transform8.setDeviceOrgX(bounds4.getMinX()); + transform8.setDeviceOrgY(bounds4.getMinY()); + transform8.setWorldOrgX(startingPoint.x); + transform8.setWorldOrgY(startingPoint.y); + for (var i2 = 0; i2 < tree.length; i2++) { + var node2 = tree[i2]; + node2.transform(transform8); + } + var bottomRight = new PointD(bounds4.getMaxX(), bounds4.getMaxY()); + return transform8.inverseTransformPoint(bottomRight); + }; + CoSELayout.branchRadialLayout = function(node2, parentOfNode, startAngle, endAngle, distance3, radialSeparation) { + var halfInterval = (endAngle - startAngle + 1) / 2; + if (halfInterval < 0) { + halfInterval += 180; + } + var nodeAngle = (halfInterval + startAngle) % 360; + var teta = nodeAngle * IGeometry.TWO_PI / 360; + var cos_teta = Math.cos(teta); + var x_ = distance3 * Math.cos(teta); + var y_ = distance3 * Math.sin(teta); + node2.setCenter(x_, y_); + var neighborEdges = []; + neighborEdges = neighborEdges.concat(node2.getEdges()); + var childCount = neighborEdges.length; + if (parentOfNode != null) { + childCount--; + } + var branchCount = 0; + var incEdgesCount = neighborEdges.length; + var startIndex; + var edges3 = node2.getEdgesBetween(parentOfNode); + while (edges3.length > 1) { + var temp = edges3[0]; + edges3.splice(0, 1); + var index = neighborEdges.indexOf(temp); + if (index >= 0) { + neighborEdges.splice(index, 1); + } + incEdgesCount--; + childCount--; + } + if (parentOfNode != null) { + startIndex = (neighborEdges.indexOf(edges3[0]) + 1) % incEdgesCount; + } else { + startIndex = 0; + } + var stepAngle = Math.abs(endAngle - startAngle) / childCount; + for (var i2 = startIndex; branchCount != childCount; i2 = ++i2 % incEdgesCount) { + var currentNeighbor = neighborEdges[i2].getOtherEnd(node2); + if (currentNeighbor == parentOfNode) { + continue; + } + var childStartAngle = (startAngle + branchCount * stepAngle) % 360; + var childEndAngle = (childStartAngle + stepAngle) % 360; + CoSELayout.branchRadialLayout(currentNeighbor, node2, childStartAngle, childEndAngle, distance3 + radialSeparation, radialSeparation); + branchCount++; + } + }; + CoSELayout.maxDiagonalInTree = function(tree) { + var maxDiagonal = Integer.MIN_VALUE; + for (var i2 = 0; i2 < tree.length; i2++) { + var node2 = tree[i2]; + var diagonal = node2.getDiagonal(); + if (diagonal > maxDiagonal) { + maxDiagonal = diagonal; + } + } + return maxDiagonal; + }; + CoSELayout.prototype.calcRepulsionRange = function() { + return 2 * (this.level + 1) * this.idealEdgeLength; + }; + CoSELayout.prototype.groupZeroDegreeMembers = function() { + var self2 = this; + var tempMemberGroups = {}; + this.memberGroups = {}; + this.idToDummyNode = {}; + var zeroDegree = []; + var allNodes = this.graphManager.getAllNodes(); + for (var i2 = 0; i2 < allNodes.length; i2++) { + var node2 = allNodes[i2]; + var parent4 = node2.getParent(); + if (this.getNodeDegreeWithChildren(node2) === 0 && (parent4.id == void 0 || !this.getToBeTiled(parent4))) { + zeroDegree.push(node2); + } + } + for (var i2 = 0; i2 < zeroDegree.length; i2++) { + var node2 = zeroDegree[i2]; + var p_id = node2.getParent().id; + if (typeof tempMemberGroups[p_id] === "undefined") tempMemberGroups[p_id] = []; + tempMemberGroups[p_id] = tempMemberGroups[p_id].concat(node2); + } + Object.keys(tempMemberGroups).forEach(function(p_id2) { + if (tempMemberGroups[p_id2].length > 1) { + var dummyCompoundId = "DummyCompound_" + p_id2; + self2.memberGroups[dummyCompoundId] = tempMemberGroups[p_id2]; + var parent5 = tempMemberGroups[p_id2][0].getParent(); + var dummyCompound = new CoSENode(self2.graphManager); + dummyCompound.id = dummyCompoundId; + dummyCompound.paddingLeft = parent5.paddingLeft || 0; + dummyCompound.paddingRight = parent5.paddingRight || 0; + dummyCompound.paddingBottom = parent5.paddingBottom || 0; + dummyCompound.paddingTop = parent5.paddingTop || 0; + self2.idToDummyNode[dummyCompoundId] = dummyCompound; + var dummyParentGraph = self2.getGraphManager().add(self2.newGraph(), dummyCompound); + var parentGraph = parent5.getChild(); + parentGraph.add(dummyCompound); + for (var i3 = 0; i3 < tempMemberGroups[p_id2].length; i3++) { + var node3 = tempMemberGroups[p_id2][i3]; + parentGraph.remove(node3); + dummyParentGraph.add(node3); + } + } + }); + }; + CoSELayout.prototype.clearCompounds = function() { + var childGraphMap = {}; + var idToNode = {}; + this.performDFSOnCompounds(); + for (var i2 = 0; i2 < this.compoundOrder.length; i2++) { + idToNode[this.compoundOrder[i2].id] = this.compoundOrder[i2]; + childGraphMap[this.compoundOrder[i2].id] = [].concat(this.compoundOrder[i2].getChild().getNodes()); + this.graphManager.remove(this.compoundOrder[i2].getChild()); + this.compoundOrder[i2].child = null; + } + this.graphManager.resetAllNodes(); + this.tileCompoundMembers(childGraphMap, idToNode); + }; + CoSELayout.prototype.clearZeroDegreeMembers = function() { + var self2 = this; + var tiledZeroDegreePack = this.tiledZeroDegreePack = []; + Object.keys(this.memberGroups).forEach(function(id35) { + var compoundNode = self2.idToDummyNode[id35]; + tiledZeroDegreePack[id35] = self2.tileNodes(self2.memberGroups[id35], compoundNode.paddingLeft + compoundNode.paddingRight); + compoundNode.rect.width = tiledZeroDegreePack[id35].width; + compoundNode.rect.height = tiledZeroDegreePack[id35].height; + compoundNode.setCenter(tiledZeroDegreePack[id35].centerX, tiledZeroDegreePack[id35].centerY); + compoundNode.labelMarginLeft = 0; + compoundNode.labelMarginTop = 0; + if (CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS) { + var width3 = compoundNode.rect.width; + var height2 = compoundNode.rect.height; + if (compoundNode.labelWidth) { + if (compoundNode.labelPosHorizontal == "left") { + compoundNode.rect.x -= compoundNode.labelWidth; + compoundNode.setWidth(width3 + compoundNode.labelWidth); + compoundNode.labelMarginLeft = compoundNode.labelWidth; + } else if (compoundNode.labelPosHorizontal == "center" && compoundNode.labelWidth > width3) { + compoundNode.rect.x -= (compoundNode.labelWidth - width3) / 2; + compoundNode.setWidth(compoundNode.labelWidth); + compoundNode.labelMarginLeft = (compoundNode.labelWidth - width3) / 2; + } else if (compoundNode.labelPosHorizontal == "right") { + compoundNode.setWidth(width3 + compoundNode.labelWidth); + } + } + if (compoundNode.labelHeight) { + if (compoundNode.labelPosVertical == "top") { + compoundNode.rect.y -= compoundNode.labelHeight; + compoundNode.setHeight(height2 + compoundNode.labelHeight); + compoundNode.labelMarginTop = compoundNode.labelHeight; + } else if (compoundNode.labelPosVertical == "center" && compoundNode.labelHeight > height2) { + compoundNode.rect.y -= (compoundNode.labelHeight - height2) / 2; + compoundNode.setHeight(compoundNode.labelHeight); + compoundNode.labelMarginTop = (compoundNode.labelHeight - height2) / 2; + } else if (compoundNode.labelPosVertical == "bottom") { + compoundNode.setHeight(height2 + compoundNode.labelHeight); + } + } + } + }); + }; + CoSELayout.prototype.repopulateCompounds = function() { + for (var i2 = this.compoundOrder.length - 1; i2 >= 0; i2--) { + var lCompoundNode = this.compoundOrder[i2]; + var id35 = lCompoundNode.id; + var horizontalMargin = lCompoundNode.paddingLeft; + var verticalMargin = lCompoundNode.paddingTop; + var labelMarginLeft = lCompoundNode.labelMarginLeft; + var labelMarginTop = lCompoundNode.labelMarginTop; + this.adjustLocations(this.tiledMemberPack[id35], lCompoundNode.rect.x, lCompoundNode.rect.y, horizontalMargin, verticalMargin, labelMarginLeft, labelMarginTop); + } + }; + CoSELayout.prototype.repopulateZeroDegreeMembers = function() { + var self2 = this; + var tiledPack = this.tiledZeroDegreePack; + Object.keys(tiledPack).forEach(function(id35) { + var compoundNode = self2.idToDummyNode[id35]; + var horizontalMargin = compoundNode.paddingLeft; + var verticalMargin = compoundNode.paddingTop; + var labelMarginLeft = compoundNode.labelMarginLeft; + var labelMarginTop = compoundNode.labelMarginTop; + self2.adjustLocations(tiledPack[id35], compoundNode.rect.x, compoundNode.rect.y, horizontalMargin, verticalMargin, labelMarginLeft, labelMarginTop); + }); + }; + CoSELayout.prototype.getToBeTiled = function(node2) { + var id35 = node2.id; + if (this.toBeTiled[id35] != null) { + return this.toBeTiled[id35]; + } + var childGraph = node2.getChild(); + if (childGraph == null) { + this.toBeTiled[id35] = false; + return false; + } + var children2 = childGraph.getNodes(); + for (var i2 = 0; i2 < children2.length; i2++) { + var theChild = children2[i2]; + if (this.getNodeDegree(theChild) > 0) { + this.toBeTiled[id35] = false; + return false; + } + if (theChild.getChild() == null) { + this.toBeTiled[theChild.id] = false; + continue; + } + if (!this.getToBeTiled(theChild)) { + this.toBeTiled[id35] = false; + return false; + } + } + this.toBeTiled[id35] = true; + return true; + }; + CoSELayout.prototype.getNodeDegree = function(node2) { + var id35 = node2.id; + var edges3 = node2.getEdges(); + var degree = 0; + for (var i2 = 0; i2 < edges3.length; i2++) { + var edge = edges3[i2]; + if (edge.getSource().id !== edge.getTarget().id) { + degree = degree + 1; + } + } + return degree; + }; + CoSELayout.prototype.getNodeDegreeWithChildren = function(node2) { + var degree = this.getNodeDegree(node2); + if (node2.getChild() == null) { + return degree; + } + var children2 = node2.getChild().getNodes(); + for (var i2 = 0; i2 < children2.length; i2++) { + var child = children2[i2]; + degree += this.getNodeDegreeWithChildren(child); + } + return degree; + }; + CoSELayout.prototype.performDFSOnCompounds = function() { + this.compoundOrder = []; + this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes()); + }; + CoSELayout.prototype.fillCompexOrderByDFS = function(children2) { + for (var i2 = 0; i2 < children2.length; i2++) { + var child = children2[i2]; + if (child.getChild() != null) { + this.fillCompexOrderByDFS(child.getChild().getNodes()); + } + if (this.getToBeTiled(child)) { + this.compoundOrder.push(child); + } + } + }; + CoSELayout.prototype.adjustLocations = function(organization, x5, y6, compoundHorizontalMargin, compoundVerticalMargin, compoundLabelMarginLeft, compoundLabelMarginTop) { + x5 += compoundHorizontalMargin + compoundLabelMarginLeft; + y6 += compoundVerticalMargin + compoundLabelMarginTop; + var left3 = x5; + for (var i2 = 0; i2 < organization.rows.length; i2++) { + var row = organization.rows[i2]; + x5 = left3; + var maxHeight = 0; + for (var j3 = 0; j3 < row.length; j3++) { + var lnode = row[j3]; + lnode.rect.x = x5; + lnode.rect.y = y6; + x5 += lnode.rect.width + organization.horizontalPadding; + if (lnode.rect.height > maxHeight) maxHeight = lnode.rect.height; + } + y6 += maxHeight + organization.verticalPadding; + } + }; + CoSELayout.prototype.tileCompoundMembers = function(childGraphMap, idToNode) { + var self2 = this; + this.tiledMemberPack = []; + Object.keys(childGraphMap).forEach(function(id35) { + var compoundNode = idToNode[id35]; + self2.tiledMemberPack[id35] = self2.tileNodes(childGraphMap[id35], compoundNode.paddingLeft + compoundNode.paddingRight); + compoundNode.rect.width = self2.tiledMemberPack[id35].width; + compoundNode.rect.height = self2.tiledMemberPack[id35].height; + compoundNode.setCenter(self2.tiledMemberPack[id35].centerX, self2.tiledMemberPack[id35].centerY); + compoundNode.labelMarginLeft = 0; + compoundNode.labelMarginTop = 0; + if (CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS) { + var width3 = compoundNode.rect.width; + var height2 = compoundNode.rect.height; + if (compoundNode.labelWidth) { + if (compoundNode.labelPosHorizontal == "left") { + compoundNode.rect.x -= compoundNode.labelWidth; + compoundNode.setWidth(width3 + compoundNode.labelWidth); + compoundNode.labelMarginLeft = compoundNode.labelWidth; + } else if (compoundNode.labelPosHorizontal == "center" && compoundNode.labelWidth > width3) { + compoundNode.rect.x -= (compoundNode.labelWidth - width3) / 2; + compoundNode.setWidth(compoundNode.labelWidth); + compoundNode.labelMarginLeft = (compoundNode.labelWidth - width3) / 2; + } else if (compoundNode.labelPosHorizontal == "right") { + compoundNode.setWidth(width3 + compoundNode.labelWidth); + } + } + if (compoundNode.labelHeight) { + if (compoundNode.labelPosVertical == "top") { + compoundNode.rect.y -= compoundNode.labelHeight; + compoundNode.setHeight(height2 + compoundNode.labelHeight); + compoundNode.labelMarginTop = compoundNode.labelHeight; + } else if (compoundNode.labelPosVertical == "center" && compoundNode.labelHeight > height2) { + compoundNode.rect.y -= (compoundNode.labelHeight - height2) / 2; + compoundNode.setHeight(compoundNode.labelHeight); + compoundNode.labelMarginTop = (compoundNode.labelHeight - height2) / 2; + } else if (compoundNode.labelPosVertical == "bottom") { + compoundNode.setHeight(height2 + compoundNode.labelHeight); + } + } + } + }); + }; + CoSELayout.prototype.tileNodes = function(nodes5, minWidth) { + var horizontalOrg = this.tileNodesByFavoringDim(nodes5, minWidth, true); + var verticalOrg = this.tileNodesByFavoringDim(nodes5, minWidth, false); + var horizontalRatio = this.getOrgRatio(horizontalOrg); + var verticalRatio = this.getOrgRatio(verticalOrg); + var bestOrg; + if (verticalRatio < horizontalRatio) { + bestOrg = verticalOrg; + } else { + bestOrg = horizontalOrg; + } + return bestOrg; + }; + CoSELayout.prototype.getOrgRatio = function(organization) { + var width3 = organization.width; + var height2 = organization.height; + var ratio = width3 / height2; + if (ratio < 1) { + ratio = 1 / ratio; + } + return ratio; + }; + CoSELayout.prototype.calcIdealRowWidth = function(members, favorHorizontalDim) { + var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL; + var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL; + var membersSize = members.length; + var totalWidth = 0; + var totalHeight = 0; + var maxWidth2 = 0; + members.forEach(function(node2) { + totalWidth += node2.getWidth(); + totalHeight += node2.getHeight(); + if (node2.getWidth() > maxWidth2) { + maxWidth2 = node2.getWidth(); + } + }); + var averageWidth = totalWidth / membersSize; + var averageHeight = totalHeight / membersSize; + var delta = Math.pow(verticalPadding - horizontalPadding, 2) + 4 * (averageWidth + horizontalPadding) * (averageHeight + verticalPadding) * membersSize; + var horizontalCountDouble = (horizontalPadding - verticalPadding + Math.sqrt(delta)) / (2 * (averageWidth + horizontalPadding)); + var horizontalCount; + if (favorHorizontalDim) { + horizontalCount = Math.ceil(horizontalCountDouble); + if (horizontalCount == horizontalCountDouble) { + horizontalCount++; + } + } else { + horizontalCount = Math.floor(horizontalCountDouble); + } + var idealWidth = horizontalCount * (averageWidth + horizontalPadding) - horizontalPadding; + if (maxWidth2 > idealWidth) { + idealWidth = maxWidth2; + } + idealWidth += horizontalPadding * 2; + return idealWidth; + }; + CoSELayout.prototype.tileNodesByFavoringDim = function(nodes5, minWidth, favorHorizontalDim) { + var verticalPadding = CoSEConstants.TILING_PADDING_VERTICAL; + var horizontalPadding = CoSEConstants.TILING_PADDING_HORIZONTAL; + var tilingCompareBy = CoSEConstants.TILING_COMPARE_BY; + var organization = { + rows: [], + rowWidth: [], + rowHeight: [], + width: 0, + height: minWidth, + // assume minHeight equals to minWidth + verticalPadding, + horizontalPadding, + centerX: 0, + centerY: 0 + }; + if (tilingCompareBy) { + organization.idealRowWidth = this.calcIdealRowWidth(nodes5, favorHorizontalDim); + } + var getNodeArea = /* @__PURE__ */ __name(function getNodeArea2(n2) { + return n2.rect.width * n2.rect.height; + }, "getNodeArea"); + var areaCompareFcn = /* @__PURE__ */ __name(function areaCompareFcn2(n1, n2) { + return getNodeArea(n2) - getNodeArea(n1); + }, "areaCompareFcn"); + nodes5.sort(function(n1, n2) { + var cmpBy = areaCompareFcn; + if (organization.idealRowWidth) { + cmpBy = tilingCompareBy; + return cmpBy(n1.id, n2.id); + } + return cmpBy(n1, n2); + }); + var sumCenterX = 0; + var sumCenterY = 0; + for (var i2 = 0; i2 < nodes5.length; i2++) { + var lNode = nodes5[i2]; + sumCenterX += lNode.getCenterX(); + sumCenterY += lNode.getCenterY(); + } + organization.centerX = sumCenterX / nodes5.length; + organization.centerY = sumCenterY / nodes5.length; + for (var i2 = 0; i2 < nodes5.length; i2++) { + var lNode = nodes5[i2]; + if (organization.rows.length == 0) { + this.insertNodeToRow(organization, lNode, 0, minWidth); + } else if (this.canAddHorizontal(organization, lNode.rect.width, lNode.rect.height)) { + var rowIndex = organization.rows.length - 1; + if (!organization.idealRowWidth) { + rowIndex = this.getShortestRowIndex(organization); + } + this.insertNodeToRow(organization, lNode, rowIndex, minWidth); + } else { + this.insertNodeToRow(organization, lNode, organization.rows.length, minWidth); + } + this.shiftToLastRow(organization); + } + return organization; + }; + CoSELayout.prototype.insertNodeToRow = function(organization, node2, rowIndex, minWidth) { + var minCompoundSize = minWidth; + if (rowIndex == organization.rows.length) { + var secondDimension = []; + organization.rows.push(secondDimension); + organization.rowWidth.push(minCompoundSize); + organization.rowHeight.push(0); + } + var w4 = organization.rowWidth[rowIndex] + node2.rect.width; + if (organization.rows[rowIndex].length > 0) { + w4 += organization.horizontalPadding; + } + organization.rowWidth[rowIndex] = w4; + if (organization.width < w4) { + organization.width = w4; + } + var h3 = node2.rect.height; + if (rowIndex > 0) h3 += organization.verticalPadding; + var extraHeight = 0; + if (h3 > organization.rowHeight[rowIndex]) { + extraHeight = organization.rowHeight[rowIndex]; + organization.rowHeight[rowIndex] = h3; + extraHeight = organization.rowHeight[rowIndex] - extraHeight; + } + organization.height += extraHeight; + organization.rows[rowIndex].push(node2); + }; + CoSELayout.prototype.getShortestRowIndex = function(organization) { + var r2 = -1; + var min10 = Number.MAX_VALUE; + for (var i2 = 0; i2 < organization.rows.length; i2++) { + if (organization.rowWidth[i2] < min10) { + r2 = i2; + min10 = organization.rowWidth[i2]; + } + } + return r2; + }; + CoSELayout.prototype.getLongestRowIndex = function(organization) { + var r2 = -1; + var max10 = Number.MIN_VALUE; + for (var i2 = 0; i2 < organization.rows.length; i2++) { + if (organization.rowWidth[i2] > max10) { + r2 = i2; + max10 = organization.rowWidth[i2]; + } + } + return r2; + }; + CoSELayout.prototype.canAddHorizontal = function(organization, extraWidth, extraHeight) { + if (organization.idealRowWidth) { + var lastRowIndex = organization.rows.length - 1; + var lastRowWidth = organization.rowWidth[lastRowIndex]; + return lastRowWidth + extraWidth + organization.horizontalPadding <= organization.idealRowWidth; + } + var sri = this.getShortestRowIndex(organization); + if (sri < 0) { + return true; + } + var min10 = organization.rowWidth[sri]; + if (min10 + organization.horizontalPadding + extraWidth <= organization.width) return true; + var hDiff = 0; + if (organization.rowHeight[sri] < extraHeight) { + if (sri > 0) hDiff = extraHeight + organization.verticalPadding - organization.rowHeight[sri]; + } + var add_to_row_ratio; + if (organization.width - min10 >= extraWidth + organization.horizontalPadding) { + add_to_row_ratio = (organization.height + hDiff) / (min10 + extraWidth + organization.horizontalPadding); + } else { + add_to_row_ratio = (organization.height + hDiff) / organization.width; + } + hDiff = extraHeight + organization.verticalPadding; + var add_new_row_ratio; + if (organization.width < extraWidth) { + add_new_row_ratio = (organization.height + hDiff) / extraWidth; + } else { + add_new_row_ratio = (organization.height + hDiff) / organization.width; + } + if (add_new_row_ratio < 1) add_new_row_ratio = 1 / add_new_row_ratio; + if (add_to_row_ratio < 1) add_to_row_ratio = 1 / add_to_row_ratio; + return add_to_row_ratio < add_new_row_ratio; + }; + CoSELayout.prototype.shiftToLastRow = function(organization) { + var longest = this.getLongestRowIndex(organization); + var last4 = organization.rowWidth.length - 1; + var row = organization.rows[longest]; + var node2 = row[row.length - 1]; + var diff2 = node2.width + organization.horizontalPadding; + if (organization.width - organization.rowWidth[last4] > diff2 && longest != last4) { + row.splice(-1, 1); + organization.rows[last4].push(node2); + organization.rowWidth[longest] = organization.rowWidth[longest] - diff2; + organization.rowWidth[last4] = organization.rowWidth[last4] + diff2; + organization.width = organization.rowWidth[instance.getLongestRowIndex(organization)]; + var maxHeight = Number.MIN_VALUE; + for (var i2 = 0; i2 < row.length; i2++) { + if (row[i2].height > maxHeight) maxHeight = row[i2].height; + } + if (longest > 0) maxHeight += organization.verticalPadding; + var prevTotal = organization.rowHeight[longest] + organization.rowHeight[last4]; + organization.rowHeight[longest] = maxHeight; + if (organization.rowHeight[last4] < node2.height + organization.verticalPadding) organization.rowHeight[last4] = node2.height + organization.verticalPadding; + var finalTotal = organization.rowHeight[longest] + organization.rowHeight[last4]; + organization.height += finalTotal - prevTotal; + this.shiftToLastRow(organization); + } + }; + CoSELayout.prototype.tilingPreLayout = function() { + if (CoSEConstants.TILE) { + this.groupZeroDegreeMembers(); + this.clearCompounds(); + this.clearZeroDegreeMembers(); + } + }; + CoSELayout.prototype.tilingPostLayout = function() { + if (CoSEConstants.TILE) { + this.repopulateZeroDegreeMembers(); + this.repopulateCompounds(); + } + }; + CoSELayout.prototype.reduceTrees = function() { + var prunedNodesAll = []; + var containsLeaf = true; + var node2; + while (containsLeaf) { + var allNodes = this.graphManager.getAllNodes(); + var prunedNodesInStepTemp = []; + containsLeaf = false; + for (var i2 = 0; i2 < allNodes.length; i2++) { + node2 = allNodes[i2]; + if (node2.getEdges().length == 1 && !node2.getEdges()[0].isInterGraph && node2.getChild() == null) { + if (CoSEConstants.PURE_INCREMENTAL) { + var otherEnd = node2.getEdges()[0].getOtherEnd(node2); + var relativePosition2 = new DimensionD2(node2.getCenterX() - otherEnd.getCenterX(), node2.getCenterY() - otherEnd.getCenterY()); + prunedNodesInStepTemp.push([node2, node2.getEdges()[0], node2.getOwner(), relativePosition2]); + } else { + prunedNodesInStepTemp.push([node2, node2.getEdges()[0], node2.getOwner()]); + } + containsLeaf = true; + } + } + if (containsLeaf == true) { + var prunedNodesInStep = []; + for (var j3 = 0; j3 < prunedNodesInStepTemp.length; j3++) { + if (prunedNodesInStepTemp[j3][0].getEdges().length == 1) { + prunedNodesInStep.push(prunedNodesInStepTemp[j3]); + prunedNodesInStepTemp[j3][0].getOwner().remove(prunedNodesInStepTemp[j3][0]); + } + } + prunedNodesAll.push(prunedNodesInStep); + this.graphManager.resetAllNodes(); + this.graphManager.resetAllEdges(); + } + } + this.prunedNodesAll = prunedNodesAll; + }; + CoSELayout.prototype.growTree = function(prunedNodesAll) { + var lengthOfPrunedNodesInStep = prunedNodesAll.length; + var prunedNodesInStep = prunedNodesAll[lengthOfPrunedNodesInStep - 1]; + var nodeData2; + for (var i2 = 0; i2 < prunedNodesInStep.length; i2++) { + nodeData2 = prunedNodesInStep[i2]; + this.findPlaceforPrunedNode(nodeData2); + nodeData2[2].add(nodeData2[0]); + nodeData2[2].add(nodeData2[1], nodeData2[1].source, nodeData2[1].target); + } + prunedNodesAll.splice(prunedNodesAll.length - 1, 1); + this.graphManager.resetAllNodes(); + this.graphManager.resetAllEdges(); + }; + CoSELayout.prototype.findPlaceforPrunedNode = function(nodeData2) { + var gridForPrunedNode; + var nodeToConnect; + var prunedNode = nodeData2[0]; + if (prunedNode == nodeData2[1].source) { + nodeToConnect = nodeData2[1].target; + } else { + nodeToConnect = nodeData2[1].source; + } + if (CoSEConstants.PURE_INCREMENTAL) { + prunedNode.setCenter(nodeToConnect.getCenterX() + nodeData2[3].getWidth(), nodeToConnect.getCenterY() + nodeData2[3].getHeight()); + } else { + var startGridX = nodeToConnect.startX; + var finishGridX = nodeToConnect.finishX; + var startGridY = nodeToConnect.startY; + var finishGridY = nodeToConnect.finishY; + var upNodeCount = 0; + var downNodeCount = 0; + var rightNodeCount = 0; + var leftNodeCount = 0; + var controlRegions = [upNodeCount, rightNodeCount, downNodeCount, leftNodeCount]; + if (startGridY > 0) { + for (var i2 = startGridX; i2 <= finishGridX; i2++) { + controlRegions[0] += this.grid[i2][startGridY - 1].length + this.grid[i2][startGridY].length - 1; + } + } + if (finishGridX < this.grid.length - 1) { + for (var i2 = startGridY; i2 <= finishGridY; i2++) { + controlRegions[1] += this.grid[finishGridX + 1][i2].length + this.grid[finishGridX][i2].length - 1; + } + } + if (finishGridY < this.grid[0].length - 1) { + for (var i2 = startGridX; i2 <= finishGridX; i2++) { + controlRegions[2] += this.grid[i2][finishGridY + 1].length + this.grid[i2][finishGridY].length - 1; + } + } + if (startGridX > 0) { + for (var i2 = startGridY; i2 <= finishGridY; i2++) { + controlRegions[3] += this.grid[startGridX - 1][i2].length + this.grid[startGridX][i2].length - 1; + } + } + var min10 = Integer.MAX_VALUE; + var minCount; + var minIndex; + for (var j3 = 0; j3 < controlRegions.length; j3++) { + if (controlRegions[j3] < min10) { + min10 = controlRegions[j3]; + minCount = 1; + minIndex = j3; + } else if (controlRegions[j3] == min10) { + minCount++; + } + } + if (minCount == 3 && min10 == 0) { + if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[2] == 0) { + gridForPrunedNode = 1; + } else if (controlRegions[0] == 0 && controlRegions[1] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 0; + } else if (controlRegions[0] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 3; + } else if (controlRegions[1] == 0 && controlRegions[2] == 0 && controlRegions[3] == 0) { + gridForPrunedNode = 2; + } + } else if (minCount == 2 && min10 == 0) { + var random2 = Math.floor(Math.random() * 2); + if (controlRegions[0] == 0 && controlRegions[1] == 0) { + ; + if (random2 == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 1; + } + } else if (controlRegions[0] == 0 && controlRegions[2] == 0) { + if (random2 == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 2; + } + } else if (controlRegions[0] == 0 && controlRegions[3] == 0) { + if (random2 == 0) { + gridForPrunedNode = 0; + } else { + gridForPrunedNode = 3; + } + } else if (controlRegions[1] == 0 && controlRegions[2] == 0) { + if (random2 == 0) { + gridForPrunedNode = 1; + } else { + gridForPrunedNode = 2; + } + } else if (controlRegions[1] == 0 && controlRegions[3] == 0) { + if (random2 == 0) { + gridForPrunedNode = 1; + } else { + gridForPrunedNode = 3; + } + } else { + if (random2 == 0) { + gridForPrunedNode = 2; + } else { + gridForPrunedNode = 3; + } + } + } else if (minCount == 4 && min10 == 0) { + var random2 = Math.floor(Math.random() * 4); + gridForPrunedNode = random2; + } else { + gridForPrunedNode = minIndex; + } + if (gridForPrunedNode == 0) { + prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() - nodeToConnect.getHeight() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getHeight() / 2); + } else if (gridForPrunedNode == 1) { + prunedNode.setCenter(nodeToConnect.getCenterX() + nodeToConnect.getWidth() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getWidth() / 2, nodeToConnect.getCenterY()); + } else if (gridForPrunedNode == 2) { + prunedNode.setCenter(nodeToConnect.getCenterX(), nodeToConnect.getCenterY() + nodeToConnect.getHeight() / 2 + FDLayoutConstants.DEFAULT_EDGE_LENGTH + prunedNode.getHeight() / 2); + } else { + prunedNode.setCenter(nodeToConnect.getCenterX() - nodeToConnect.getWidth() / 2 - FDLayoutConstants.DEFAULT_EDGE_LENGTH - prunedNode.getWidth() / 2, nodeToConnect.getCenterY()); + } + } + }; + module3.exports = CoSELayout; + }) + ), + /***/ + 991: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var FDLayoutNode = __webpack_require__2(551).FDLayoutNode; + var IMath = __webpack_require__2(551).IMath; + function CoSENode(gm, loc, size4, vNode) { + FDLayoutNode.call(this, gm, loc, size4, vNode); + } + __name(CoSENode, "CoSENode"); + CoSENode.prototype = Object.create(FDLayoutNode.prototype); + for (var prop in FDLayoutNode) { + CoSENode[prop] = FDLayoutNode[prop]; + } + CoSENode.prototype.calculateDisplacement = function() { + var layout7 = this.graphManager.getLayout(); + if (this.getChild() != null && this.fixedNodeWeight) { + this.displacementX += layout7.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.fixedNodeWeight; + this.displacementY += layout7.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.fixedNodeWeight; + } else { + this.displacementX += layout7.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren; + this.displacementY += layout7.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren; + } + if (Math.abs(this.displacementX) > layout7.coolingFactor * layout7.maxNodeDisplacement) { + this.displacementX = layout7.coolingFactor * layout7.maxNodeDisplacement * IMath.sign(this.displacementX); + } + if (Math.abs(this.displacementY) > layout7.coolingFactor * layout7.maxNodeDisplacement) { + this.displacementY = layout7.coolingFactor * layout7.maxNodeDisplacement * IMath.sign(this.displacementY); + } + if (this.child && this.child.getNodes().length > 0) { + this.propogateDisplacementToChildren(this.displacementX, this.displacementY); + } + }; + CoSENode.prototype.propogateDisplacementToChildren = function(dX, dY) { + var nodes5 = this.getChild().getNodes(); + var node2; + for (var i2 = 0; i2 < nodes5.length; i2++) { + node2 = nodes5[i2]; + if (node2.getChild() == null) { + node2.displacementX += dX; + node2.displacementY += dY; + } else { + node2.propogateDisplacementToChildren(dX, dY); + } + } + }; + CoSENode.prototype.move = function() { + var layout7 = this.graphManager.getLayout(); + if (this.child == null || this.child.getNodes().length == 0) { + this.moveBy(this.displacementX, this.displacementY); + layout7.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY); + } + this.springForceX = 0; + this.springForceY = 0; + this.repulsionForceX = 0; + this.repulsionForceY = 0; + this.gravitationForceX = 0; + this.gravitationForceY = 0; + this.displacementX = 0; + this.displacementY = 0; + }; + CoSENode.prototype.setPred1 = function(pred12) { + this.pred1 = pred12; + }; + CoSENode.prototype.getPred1 = function() { + return pred1; + }; + CoSENode.prototype.getPred2 = function() { + return pred2; + }; + CoSENode.prototype.setNext = function(next3) { + this.next = next3; + }; + CoSENode.prototype.getNext = function() { + return next; + }; + CoSENode.prototype.setProcessed = function(processed2) { + this.processed = processed2; + }; + CoSENode.prototype.isProcessed = function() { + return processed; + }; + module3.exports = CoSENode; + }) + ), + /***/ + 902: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + function _toConsumableArray2(arr) { + if (Array.isArray(arr)) { + for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) { + arr2[i2] = arr[i2]; + } + return arr2; + } else { + return Array.from(arr); + } + } + __name(_toConsumableArray2, "_toConsumableArray"); + var CoSEConstants = __webpack_require__2(806); + var LinkedList = __webpack_require__2(551).LinkedList; + var Matrix = __webpack_require__2(551).Matrix; + var SVD = __webpack_require__2(551).SVD; + function ConstraintHandler() { + } + __name(ConstraintHandler, "ConstraintHandler"); + ConstraintHandler.handleConstraints = function(layout7) { + var constraints = {}; + constraints.fixedNodeConstraint = layout7.constraints.fixedNodeConstraint; + constraints.alignmentConstraint = layout7.constraints.alignmentConstraint; + constraints.relativePlacementConstraint = layout7.constraints.relativePlacementConstraint; + var idToNodeMap = /* @__PURE__ */ new Map(); + var nodeIndexes = /* @__PURE__ */ new Map(); + var xCoords = []; + var yCoords = []; + var allNodes = layout7.getAllNodes(); + var index = 0; + for (var i2 = 0; i2 < allNodes.length; i2++) { + var node2 = allNodes[i2]; + if (node2.getChild() == null) { + nodeIndexes.set(node2.id, index++); + xCoords.push(node2.getCenterX()); + yCoords.push(node2.getCenterY()); + idToNodeMap.set(node2.id, node2); + } + } + if (constraints.relativePlacementConstraint) { + constraints.relativePlacementConstraint.forEach(function(constraint) { + if (!constraint.gap && constraint.gap != 0) { + if (constraint.left) { + constraint.gap = CoSEConstants.DEFAULT_EDGE_LENGTH + idToNodeMap.get(constraint.left).getWidth() / 2 + idToNodeMap.get(constraint.right).getWidth() / 2; + } else { + constraint.gap = CoSEConstants.DEFAULT_EDGE_LENGTH + idToNodeMap.get(constraint.top).getHeight() / 2 + idToNodeMap.get(constraint.bottom).getHeight() / 2; + } + } + }); + } + var calculatePositionDiff = /* @__PURE__ */ __name(function calculatePositionDiff2(pos1, pos2) { + return { x: pos1.x - pos2.x, y: pos1.y - pos2.y }; + }, "calculatePositionDiff"); + var calculateAvgPosition = /* @__PURE__ */ __name(function calculateAvgPosition2(nodeIdSet) { + var xPosSum = 0; + var yPosSum = 0; + nodeIdSet.forEach(function(nodeId) { + xPosSum += xCoords[nodeIndexes.get(nodeId)]; + yPosSum += yCoords[nodeIndexes.get(nodeId)]; + }); + return { x: xPosSum / nodeIdSet.size, y: yPosSum / nodeIdSet.size }; + }, "calculateAvgPosition"); + var findAppropriatePositionForRelativePlacement = /* @__PURE__ */ __name(function findAppropriatePositionForRelativePlacement2(graph, direction2, fixedNodes2, dummyPositions, componentSources) { + function setUnion(setA, setB) { + var union2 = new Set(setA); + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = void 0; + try { + for (var _iterator = setB[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var elem = _step.value; + union2.add(elem); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + return union2; + } + __name(setUnion, "setUnion"); + var inDegrees = /* @__PURE__ */ new Map(); + graph.forEach(function(value2, key) { + inDegrees.set(key, 0); + }); + graph.forEach(function(value2, key) { + value2.forEach(function(adjacent) { + inDegrees.set(adjacent.id, inDegrees.get(adjacent.id) + 1); + }); + }); + var positionMap = /* @__PURE__ */ new Map(); + var pastMap = /* @__PURE__ */ new Map(); + var queue = new LinkedList(); + inDegrees.forEach(function(value2, key) { + if (value2 == 0) { + queue.push(key); + if (!fixedNodes2) { + if (direction2 == "horizontal") { + positionMap.set(key, nodeIndexes.has(key) ? xCoords[nodeIndexes.get(key)] : dummyPositions.get(key)); + } else { + positionMap.set(key, nodeIndexes.has(key) ? yCoords[nodeIndexes.get(key)] : dummyPositions.get(key)); + } + } + } else { + positionMap.set(key, Number.NEGATIVE_INFINITY); + } + if (fixedNodes2) { + pastMap.set(key, /* @__PURE__ */ new Set([key])); + } + }); + if (fixedNodes2) { + componentSources.forEach(function(component2) { + var fixedIds = []; + component2.forEach(function(nodeId) { + if (fixedNodes2.has(nodeId)) { + fixedIds.push(nodeId); + } + }); + if (fixedIds.length > 0) { + var position5 = 0; + fixedIds.forEach(function(fixedId) { + if (direction2 == "horizontal") { + positionMap.set(fixedId, nodeIndexes.has(fixedId) ? xCoords[nodeIndexes.get(fixedId)] : dummyPositions.get(fixedId)); + position5 += positionMap.get(fixedId); + } else { + positionMap.set(fixedId, nodeIndexes.has(fixedId) ? yCoords[nodeIndexes.get(fixedId)] : dummyPositions.get(fixedId)); + position5 += positionMap.get(fixedId); + } + }); + position5 = position5 / fixedIds.length; + component2.forEach(function(nodeId) { + if (!fixedNodes2.has(nodeId)) { + positionMap.set(nodeId, position5); + } + }); + } else { + var _position = 0; + component2.forEach(function(nodeId) { + if (direction2 == "horizontal") { + _position += nodeIndexes.has(nodeId) ? xCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId); + } else { + _position += nodeIndexes.has(nodeId) ? yCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId); + } + }); + _position = _position / component2.length; + component2.forEach(function(nodeId) { + positionMap.set(nodeId, _position); + }); + } + }); + } + var _loop = /* @__PURE__ */ __name(function _loop2() { + var currentNode = queue.shift(); + var neighbors = graph.get(currentNode); + neighbors.forEach(function(neighbor) { + if (positionMap.get(neighbor.id) < positionMap.get(currentNode) + neighbor.gap) { + if (fixedNodes2 && fixedNodes2.has(neighbor.id)) { + var fixedPosition = void 0; + if (direction2 == "horizontal") { + fixedPosition = nodeIndexes.has(neighbor.id) ? xCoords[nodeIndexes.get(neighbor.id)] : dummyPositions.get(neighbor.id); + } else { + fixedPosition = nodeIndexes.has(neighbor.id) ? yCoords[nodeIndexes.get(neighbor.id)] : dummyPositions.get(neighbor.id); + } + positionMap.set(neighbor.id, fixedPosition); + if (fixedPosition < positionMap.get(currentNode) + neighbor.gap) { + var diff2 = positionMap.get(currentNode) + neighbor.gap - fixedPosition; + pastMap.get(currentNode).forEach(function(nodeId) { + positionMap.set(nodeId, positionMap.get(nodeId) - diff2); + }); + } + } else { + positionMap.set(neighbor.id, positionMap.get(currentNode) + neighbor.gap); + } + } + inDegrees.set(neighbor.id, inDegrees.get(neighbor.id) - 1); + if (inDegrees.get(neighbor.id) == 0) { + queue.push(neighbor.id); + } + if (fixedNodes2) { + pastMap.set(neighbor.id, setUnion(pastMap.get(currentNode), pastMap.get(neighbor.id))); + } + }); + }, "_loop"); + while (queue.length != 0) { + _loop(); + } + if (fixedNodes2) { + var sinkNodes = /* @__PURE__ */ new Set(); + graph.forEach(function(value2, key) { + if (value2.length == 0) { + sinkNodes.add(key); + } + }); + var _components = []; + pastMap.forEach(function(value2, key) { + if (sinkNodes.has(key)) { + var isFixedComponent = false; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = void 0; + try { + for (var _iterator2 = value2[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var nodeId = _step2.value; + if (fixedNodes2.has(nodeId)) { + isFixedComponent = true; + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + if (!isFixedComponent) { + var isExist = false; + var existAt = void 0; + _components.forEach(function(component2, index2) { + if (component2.has([].concat(_toConsumableArray2(value2))[0])) { + isExist = true; + existAt = index2; + } + }); + if (!isExist) { + _components.push(new Set(value2)); + } else { + value2.forEach(function(ele) { + _components[existAt].add(ele); + }); + } + } + } + }); + _components.forEach(function(component2, index2) { + var minBefore = Number.POSITIVE_INFINITY; + var minAfter = Number.POSITIVE_INFINITY; + var maxBefore = Number.NEGATIVE_INFINITY; + var maxAfter = Number.NEGATIVE_INFINITY; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = void 0; + try { + for (var _iterator3 = component2[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { + var nodeId = _step3.value; + var posBefore = void 0; + if (direction2 == "horizontal") { + posBefore = nodeIndexes.has(nodeId) ? xCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId); + } else { + posBefore = nodeIndexes.has(nodeId) ? yCoords[nodeIndexes.get(nodeId)] : dummyPositions.get(nodeId); + } + var posAfter = positionMap.get(nodeId); + if (posBefore < minBefore) { + minBefore = posBefore; + } + if (posBefore > maxBefore) { + maxBefore = posBefore; + } + if (posAfter < minAfter) { + minAfter = posAfter; + } + if (posAfter > maxAfter) { + maxAfter = posAfter; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + var diff2 = (minBefore + maxBefore) / 2 - (minAfter + maxAfter) / 2; + var _iteratorNormalCompletion4 = true; + var _didIteratorError4 = false; + var _iteratorError4 = void 0; + try { + for (var _iterator4 = component2[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { + var _nodeId = _step4.value; + positionMap.set(_nodeId, positionMap.get(_nodeId) + diff2); + } + } catch (err) { + _didIteratorError4 = true; + _iteratorError4 = err; + } finally { + try { + if (!_iteratorNormalCompletion4 && _iterator4.return) { + _iterator4.return(); + } + } finally { + if (_didIteratorError4) { + throw _iteratorError4; + } + } + } + }); + } + return positionMap; + }, "findAppropriatePositionForRelativePlacement"); + var applyReflectionForRelativePlacement = /* @__PURE__ */ __name(function applyReflectionForRelativePlacement2(relativePlacementConstraints) { + var reflectOnY = 0, notReflectOnY = 0; + var reflectOnX = 0, notReflectOnX = 0; + relativePlacementConstraints.forEach(function(constraint) { + if (constraint.left) { + xCoords[nodeIndexes.get(constraint.left)] - xCoords[nodeIndexes.get(constraint.right)] >= 0 ? reflectOnY++ : notReflectOnY++; + } else { + yCoords[nodeIndexes.get(constraint.top)] - yCoords[nodeIndexes.get(constraint.bottom)] >= 0 ? reflectOnX++ : notReflectOnX++; + } + }); + if (reflectOnY > notReflectOnY && reflectOnX > notReflectOnX) { + for (var _i = 0; _i < nodeIndexes.size; _i++) { + xCoords[_i] = -1 * xCoords[_i]; + yCoords[_i] = -1 * yCoords[_i]; + } + } else if (reflectOnY > notReflectOnY) { + for (var _i2 = 0; _i2 < nodeIndexes.size; _i2++) { + xCoords[_i2] = -1 * xCoords[_i2]; + } + } else if (reflectOnX > notReflectOnX) { + for (var _i3 = 0; _i3 < nodeIndexes.size; _i3++) { + yCoords[_i3] = -1 * yCoords[_i3]; + } + } + }, "applyReflectionForRelativePlacement"); + var findComponents = /* @__PURE__ */ __name(function findComponents2(graph) { + var components4 = []; + var queue = new LinkedList(); + var visited = /* @__PURE__ */ new Set(); + var count2 = 0; + graph.forEach(function(value2, key) { + if (!visited.has(key)) { + components4[count2] = []; + var _currentNode = key; + queue.push(_currentNode); + visited.add(_currentNode); + components4[count2].push(_currentNode); + while (queue.length != 0) { + _currentNode = queue.shift(); + var neighbors = graph.get(_currentNode); + neighbors.forEach(function(neighbor) { + if (!visited.has(neighbor.id)) { + queue.push(neighbor.id); + visited.add(neighbor.id); + components4[count2].push(neighbor.id); + } + }); + } + count2++; + } + }); + return components4; + }, "findComponents"); + var dagToUndirected = /* @__PURE__ */ __name(function dagToUndirected2(dag2) { + var undirected = /* @__PURE__ */ new Map(); + dag2.forEach(function(value2, key) { + undirected.set(key, []); + }); + dag2.forEach(function(value2, key) { + value2.forEach(function(adjacent) { + undirected.get(key).push(adjacent); + undirected.get(adjacent.id).push({ id: key, gap: adjacent.gap, direction: adjacent.direction }); + }); + }); + return undirected; + }, "dagToUndirected"); + var dagToReversed = /* @__PURE__ */ __name(function dagToReversed2(dag2) { + var reversed = /* @__PURE__ */ new Map(); + dag2.forEach(function(value2, key) { + reversed.set(key, []); + }); + dag2.forEach(function(value2, key) { + value2.forEach(function(adjacent) { + reversed.get(adjacent.id).push({ id: key, gap: adjacent.gap, direction: adjacent.direction }); + }); + }); + return reversed; + }, "dagToReversed"); + var targetMatrix = []; + var sourceMatrix = []; + var standardTransformation = false; + var reflectionType = false; + var fixedNodes = /* @__PURE__ */ new Set(); + var dag = /* @__PURE__ */ new Map(); + var dagUndirected = /* @__PURE__ */ new Map(); + var components3 = []; + if (constraints.fixedNodeConstraint) { + constraints.fixedNodeConstraint.forEach(function(nodeData2) { + fixedNodes.add(nodeData2.nodeId); + }); + } + if (constraints.relativePlacementConstraint) { + constraints.relativePlacementConstraint.forEach(function(constraint) { + if (constraint.left) { + if (dag.has(constraint.left)) { + dag.get(constraint.left).push({ id: constraint.right, gap: constraint.gap, direction: "horizontal" }); + } else { + dag.set(constraint.left, [{ id: constraint.right, gap: constraint.gap, direction: "horizontal" }]); + } + if (!dag.has(constraint.right)) { + dag.set(constraint.right, []); + } + } else { + if (dag.has(constraint.top)) { + dag.get(constraint.top).push({ id: constraint.bottom, gap: constraint.gap, direction: "vertical" }); + } else { + dag.set(constraint.top, [{ id: constraint.bottom, gap: constraint.gap, direction: "vertical" }]); + } + if (!dag.has(constraint.bottom)) { + dag.set(constraint.bottom, []); + } + } + }); + dagUndirected = dagToUndirected(dag); + components3 = findComponents(dagUndirected); + } + if (CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING) { + if (constraints.fixedNodeConstraint && constraints.fixedNodeConstraint.length > 1) { + constraints.fixedNodeConstraint.forEach(function(nodeData2, i3) { + targetMatrix[i3] = [nodeData2.position.x, nodeData2.position.y]; + sourceMatrix[i3] = [xCoords[nodeIndexes.get(nodeData2.nodeId)], yCoords[nodeIndexes.get(nodeData2.nodeId)]]; + }); + standardTransformation = true; + } else if (constraints.alignmentConstraint) { + (function() { + var count2 = 0; + if (constraints.alignmentConstraint.vertical) { + var verticalAlign = constraints.alignmentConstraint.vertical; + var _loop2 = /* @__PURE__ */ __name(function _loop22(_i42) { + var alignmentSet = /* @__PURE__ */ new Set(); + verticalAlign[_i42].forEach(function(nodeId) { + alignmentSet.add(nodeId); + }); + var intersection4 = new Set([].concat(_toConsumableArray2(alignmentSet)).filter(function(x5) { + return fixedNodes.has(x5); + })); + var xPos = void 0; + if (intersection4.size > 0) xPos = xCoords[nodeIndexes.get(intersection4.values().next().value)]; + else xPos = calculateAvgPosition(alignmentSet).x; + verticalAlign[_i42].forEach(function(nodeId) { + targetMatrix[count2] = [xPos, yCoords[nodeIndexes.get(nodeId)]]; + sourceMatrix[count2] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]]; + count2++; + }); + }, "_loop2"); + for (var _i4 = 0; _i4 < verticalAlign.length; _i4++) { + _loop2(_i4); + } + standardTransformation = true; + } + if (constraints.alignmentConstraint.horizontal) { + var horizontalAlign = constraints.alignmentConstraint.horizontal; + var _loop3 = /* @__PURE__ */ __name(function _loop32(_i52) { + var alignmentSet = /* @__PURE__ */ new Set(); + horizontalAlign[_i52].forEach(function(nodeId) { + alignmentSet.add(nodeId); + }); + var intersection4 = new Set([].concat(_toConsumableArray2(alignmentSet)).filter(function(x5) { + return fixedNodes.has(x5); + })); + var yPos = void 0; + if (intersection4.size > 0) yPos = xCoords[nodeIndexes.get(intersection4.values().next().value)]; + else yPos = calculateAvgPosition(alignmentSet).y; + horizontalAlign[_i52].forEach(function(nodeId) { + targetMatrix[count2] = [xCoords[nodeIndexes.get(nodeId)], yPos]; + sourceMatrix[count2] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]]; + count2++; + }); + }, "_loop3"); + for (var _i5 = 0; _i5 < horizontalAlign.length; _i5++) { + _loop3(_i5); + } + standardTransformation = true; + } + if (constraints.relativePlacementConstraint) { + reflectionType = true; + } + })(); + } else if (constraints.relativePlacementConstraint) { + var largestComponentSize = 0; + var largestComponentIndex = 0; + for (var _i6 = 0; _i6 < components3.length; _i6++) { + if (components3[_i6].length > largestComponentSize) { + largestComponentSize = components3[_i6].length; + largestComponentIndex = _i6; + } + } + if (largestComponentSize < dagUndirected.size / 2) { + applyReflectionForRelativePlacement(constraints.relativePlacementConstraint); + standardTransformation = false; + reflectionType = false; + } else { + var subGraphOnHorizontal = /* @__PURE__ */ new Map(); + var subGraphOnVertical = /* @__PURE__ */ new Map(); + var constraintsInlargestComponent = []; + components3[largestComponentIndex].forEach(function(nodeId) { + dag.get(nodeId).forEach(function(adjacent) { + if (adjacent.direction == "horizontal") { + if (subGraphOnHorizontal.has(nodeId)) { + subGraphOnHorizontal.get(nodeId).push(adjacent); + } else { + subGraphOnHorizontal.set(nodeId, [adjacent]); + } + if (!subGraphOnHorizontal.has(adjacent.id)) { + subGraphOnHorizontal.set(adjacent.id, []); + } + constraintsInlargestComponent.push({ left: nodeId, right: adjacent.id }); + } else { + if (subGraphOnVertical.has(nodeId)) { + subGraphOnVertical.get(nodeId).push(adjacent); + } else { + subGraphOnVertical.set(nodeId, [adjacent]); + } + if (!subGraphOnVertical.has(adjacent.id)) { + subGraphOnVertical.set(adjacent.id, []); + } + constraintsInlargestComponent.push({ top: nodeId, bottom: adjacent.id }); + } + }); + }); + applyReflectionForRelativePlacement(constraintsInlargestComponent); + reflectionType = false; + var positionMapHorizontal = findAppropriatePositionForRelativePlacement(subGraphOnHorizontal, "horizontal"); + var positionMapVertical = findAppropriatePositionForRelativePlacement(subGraphOnVertical, "vertical"); + components3[largestComponentIndex].forEach(function(nodeId, i3) { + sourceMatrix[i3] = [xCoords[nodeIndexes.get(nodeId)], yCoords[nodeIndexes.get(nodeId)]]; + targetMatrix[i3] = []; + if (positionMapHorizontal.has(nodeId)) { + targetMatrix[i3][0] = positionMapHorizontal.get(nodeId); + } else { + targetMatrix[i3][0] = xCoords[nodeIndexes.get(nodeId)]; + } + if (positionMapVertical.has(nodeId)) { + targetMatrix[i3][1] = positionMapVertical.get(nodeId); + } else { + targetMatrix[i3][1] = yCoords[nodeIndexes.get(nodeId)]; + } + }); + standardTransformation = true; + } + } + if (standardTransformation) { + var transformationMatrix = void 0; + var targetMatrixTranspose = Matrix.transpose(targetMatrix); + var sourceMatrixTranspose = Matrix.transpose(sourceMatrix); + for (var _i7 = 0; _i7 < targetMatrixTranspose.length; _i7++) { + targetMatrixTranspose[_i7] = Matrix.multGamma(targetMatrixTranspose[_i7]); + sourceMatrixTranspose[_i7] = Matrix.multGamma(sourceMatrixTranspose[_i7]); + } + var tempMatrix = Matrix.multMat(targetMatrixTranspose, Matrix.transpose(sourceMatrixTranspose)); + var SVDResult = SVD.svd(tempMatrix); + transformationMatrix = Matrix.multMat(SVDResult.V, Matrix.transpose(SVDResult.U)); + for (var _i8 = 0; _i8 < nodeIndexes.size; _i8++) { + var temp1 = [xCoords[_i8], yCoords[_i8]]; + var temp2 = [transformationMatrix[0][0], transformationMatrix[1][0]]; + var temp3 = [transformationMatrix[0][1], transformationMatrix[1][1]]; + xCoords[_i8] = Matrix.dotProduct(temp1, temp2); + yCoords[_i8] = Matrix.dotProduct(temp1, temp3); + } + if (reflectionType) { + applyReflectionForRelativePlacement(constraints.relativePlacementConstraint); + } + } + } + if (CoSEConstants.ENFORCE_CONSTRAINTS) { + if (constraints.fixedNodeConstraint && constraints.fixedNodeConstraint.length > 0) { + var translationAmount = { x: 0, y: 0 }; + constraints.fixedNodeConstraint.forEach(function(nodeData2, i3) { + var posInTheory = { x: xCoords[nodeIndexes.get(nodeData2.nodeId)], y: yCoords[nodeIndexes.get(nodeData2.nodeId)] }; + var posDesired = nodeData2.position; + var posDiff = calculatePositionDiff(posDesired, posInTheory); + translationAmount.x += posDiff.x; + translationAmount.y += posDiff.y; + }); + translationAmount.x /= constraints.fixedNodeConstraint.length; + translationAmount.y /= constraints.fixedNodeConstraint.length; + xCoords.forEach(function(value2, i3) { + xCoords[i3] += translationAmount.x; + }); + yCoords.forEach(function(value2, i3) { + yCoords[i3] += translationAmount.y; + }); + constraints.fixedNodeConstraint.forEach(function(nodeData2) { + xCoords[nodeIndexes.get(nodeData2.nodeId)] = nodeData2.position.x; + yCoords[nodeIndexes.get(nodeData2.nodeId)] = nodeData2.position.y; + }); + } + if (constraints.alignmentConstraint) { + if (constraints.alignmentConstraint.vertical) { + var xAlign = constraints.alignmentConstraint.vertical; + var _loop4 = /* @__PURE__ */ __name(function _loop42(_i92) { + var alignmentSet = /* @__PURE__ */ new Set(); + xAlign[_i92].forEach(function(nodeId) { + alignmentSet.add(nodeId); + }); + var intersection4 = new Set([].concat(_toConsumableArray2(alignmentSet)).filter(function(x5) { + return fixedNodes.has(x5); + })); + var xPos = void 0; + if (intersection4.size > 0) xPos = xCoords[nodeIndexes.get(intersection4.values().next().value)]; + else xPos = calculateAvgPosition(alignmentSet).x; + alignmentSet.forEach(function(nodeId) { + if (!fixedNodes.has(nodeId)) xCoords[nodeIndexes.get(nodeId)] = xPos; + }); + }, "_loop4"); + for (var _i9 = 0; _i9 < xAlign.length; _i9++) { + _loop4(_i9); + } + } + if (constraints.alignmentConstraint.horizontal) { + var yAlign = constraints.alignmentConstraint.horizontal; + var _loop5 = /* @__PURE__ */ __name(function _loop52(_i102) { + var alignmentSet = /* @__PURE__ */ new Set(); + yAlign[_i102].forEach(function(nodeId) { + alignmentSet.add(nodeId); + }); + var intersection4 = new Set([].concat(_toConsumableArray2(alignmentSet)).filter(function(x5) { + return fixedNodes.has(x5); + })); + var yPos = void 0; + if (intersection4.size > 0) yPos = yCoords[nodeIndexes.get(intersection4.values().next().value)]; + else yPos = calculateAvgPosition(alignmentSet).y; + alignmentSet.forEach(function(nodeId) { + if (!fixedNodes.has(nodeId)) yCoords[nodeIndexes.get(nodeId)] = yPos; + }); + }, "_loop5"); + for (var _i10 = 0; _i10 < yAlign.length; _i10++) { + _loop5(_i10); + } + } + } + if (constraints.relativePlacementConstraint) { + (function() { + var nodeToDummyForVerticalAlignment = /* @__PURE__ */ new Map(); + var nodeToDummyForHorizontalAlignment = /* @__PURE__ */ new Map(); + var dummyToNodeForVerticalAlignment = /* @__PURE__ */ new Map(); + var dummyToNodeForHorizontalAlignment = /* @__PURE__ */ new Map(); + var dummyPositionsForVerticalAlignment = /* @__PURE__ */ new Map(); + var dummyPositionsForHorizontalAlignment = /* @__PURE__ */ new Map(); + var fixedNodesOnHorizontal = /* @__PURE__ */ new Set(); + var fixedNodesOnVertical = /* @__PURE__ */ new Set(); + fixedNodes.forEach(function(nodeId2) { + fixedNodesOnHorizontal.add(nodeId2); + fixedNodesOnVertical.add(nodeId2); + }); + if (constraints.alignmentConstraint) { + if (constraints.alignmentConstraint.vertical) { + var verticalAlignment2 = constraints.alignmentConstraint.vertical; + var _loop6 = /* @__PURE__ */ __name(function _loop62(_i112) { + dummyToNodeForVerticalAlignment.set("dummy" + _i112, []); + verticalAlignment2[_i112].forEach(function(nodeId2) { + nodeToDummyForVerticalAlignment.set(nodeId2, "dummy" + _i112); + dummyToNodeForVerticalAlignment.get("dummy" + _i112).push(nodeId2); + if (fixedNodes.has(nodeId2)) { + fixedNodesOnHorizontal.add("dummy" + _i112); + } + }); + dummyPositionsForVerticalAlignment.set("dummy" + _i112, xCoords[nodeIndexes.get(verticalAlignment2[_i112][0])]); + }, "_loop6"); + for (var _i11 = 0; _i11 < verticalAlignment2.length; _i11++) { + _loop6(_i11); + } + } + if (constraints.alignmentConstraint.horizontal) { + var horizontalAlignment = constraints.alignmentConstraint.horizontal; + var _loop7 = /* @__PURE__ */ __name(function _loop72(_i122) { + dummyToNodeForHorizontalAlignment.set("dummy" + _i122, []); + horizontalAlignment[_i122].forEach(function(nodeId2) { + nodeToDummyForHorizontalAlignment.set(nodeId2, "dummy" + _i122); + dummyToNodeForHorizontalAlignment.get("dummy" + _i122).push(nodeId2); + if (fixedNodes.has(nodeId2)) { + fixedNodesOnVertical.add("dummy" + _i122); + } + }); + dummyPositionsForHorizontalAlignment.set("dummy" + _i122, yCoords[nodeIndexes.get(horizontalAlignment[_i122][0])]); + }, "_loop7"); + for (var _i12 = 0; _i12 < horizontalAlignment.length; _i12++) { + _loop7(_i12); + } + } + } + var dagOnHorizontal = /* @__PURE__ */ new Map(); + var dagOnVertical = /* @__PURE__ */ new Map(); + var _loop8 = /* @__PURE__ */ __name(function _loop82(nodeId2) { + dag.get(nodeId2).forEach(function(adjacent) { + var sourceId = void 0; + var targetNode = void 0; + if (adjacent["direction"] == "horizontal") { + sourceId = nodeToDummyForVerticalAlignment.get(nodeId2) ? nodeToDummyForVerticalAlignment.get(nodeId2) : nodeId2; + if (nodeToDummyForVerticalAlignment.get(adjacent.id)) { + targetNode = { id: nodeToDummyForVerticalAlignment.get(adjacent.id), gap: adjacent.gap, direction: adjacent.direction }; + } else { + targetNode = adjacent; + } + if (dagOnHorizontal.has(sourceId)) { + dagOnHorizontal.get(sourceId).push(targetNode); + } else { + dagOnHorizontal.set(sourceId, [targetNode]); + } + if (!dagOnHorizontal.has(targetNode.id)) { + dagOnHorizontal.set(targetNode.id, []); + } + } else { + sourceId = nodeToDummyForHorizontalAlignment.get(nodeId2) ? nodeToDummyForHorizontalAlignment.get(nodeId2) : nodeId2; + if (nodeToDummyForHorizontalAlignment.get(adjacent.id)) { + targetNode = { id: nodeToDummyForHorizontalAlignment.get(adjacent.id), gap: adjacent.gap, direction: adjacent.direction }; + } else { + targetNode = adjacent; + } + if (dagOnVertical.has(sourceId)) { + dagOnVertical.get(sourceId).push(targetNode); + } else { + dagOnVertical.set(sourceId, [targetNode]); + } + if (!dagOnVertical.has(targetNode.id)) { + dagOnVertical.set(targetNode.id, []); + } + } + }); + }, "_loop8"); + var _iteratorNormalCompletion5 = true; + var _didIteratorError5 = false; + var _iteratorError5 = void 0; + try { + for (var _iterator5 = dag.keys()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { + var nodeId = _step5.value; + _loop8(nodeId); + } + } catch (err) { + _didIteratorError5 = true; + _iteratorError5 = err; + } finally { + try { + if (!_iteratorNormalCompletion5 && _iterator5.return) { + _iterator5.return(); + } + } finally { + if (_didIteratorError5) { + throw _iteratorError5; + } + } + } + var undirectedOnHorizontal = dagToUndirected(dagOnHorizontal); + var undirectedOnVertical = dagToUndirected(dagOnVertical); + var componentsOnHorizontal = findComponents(undirectedOnHorizontal); + var componentsOnVertical = findComponents(undirectedOnVertical); + var reversedDagOnHorizontal = dagToReversed(dagOnHorizontal); + var reversedDagOnVertical = dagToReversed(dagOnVertical); + var componentSourcesOnHorizontal = []; + var componentSourcesOnVertical = []; + componentsOnHorizontal.forEach(function(component2, index2) { + componentSourcesOnHorizontal[index2] = []; + component2.forEach(function(nodeId2) { + if (reversedDagOnHorizontal.get(nodeId2).length == 0) { + componentSourcesOnHorizontal[index2].push(nodeId2); + } + }); + }); + componentsOnVertical.forEach(function(component2, index2) { + componentSourcesOnVertical[index2] = []; + component2.forEach(function(nodeId2) { + if (reversedDagOnVertical.get(nodeId2).length == 0) { + componentSourcesOnVertical[index2].push(nodeId2); + } + }); + }); + var positionMapHorizontal2 = findAppropriatePositionForRelativePlacement(dagOnHorizontal, "horizontal", fixedNodesOnHorizontal, dummyPositionsForVerticalAlignment, componentSourcesOnHorizontal); + var positionMapVertical2 = findAppropriatePositionForRelativePlacement(dagOnVertical, "vertical", fixedNodesOnVertical, dummyPositionsForHorizontalAlignment, componentSourcesOnVertical); + var _loop9 = /* @__PURE__ */ __name(function _loop92(key2) { + if (dummyToNodeForVerticalAlignment.get(key2)) { + dummyToNodeForVerticalAlignment.get(key2).forEach(function(nodeId2) { + xCoords[nodeIndexes.get(nodeId2)] = positionMapHorizontal2.get(key2); + }); + } else { + xCoords[nodeIndexes.get(key2)] = positionMapHorizontal2.get(key2); + } + }, "_loop9"); + var _iteratorNormalCompletion6 = true; + var _didIteratorError6 = false; + var _iteratorError6 = void 0; + try { + for (var _iterator6 = positionMapHorizontal2.keys()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { + var key = _step6.value; + _loop9(key); + } + } catch (err) { + _didIteratorError6 = true; + _iteratorError6 = err; + } finally { + try { + if (!_iteratorNormalCompletion6 && _iterator6.return) { + _iterator6.return(); + } + } finally { + if (_didIteratorError6) { + throw _iteratorError6; + } + } + } + var _loop10 = /* @__PURE__ */ __name(function _loop102(key2) { + if (dummyToNodeForHorizontalAlignment.get(key2)) { + dummyToNodeForHorizontalAlignment.get(key2).forEach(function(nodeId2) { + yCoords[nodeIndexes.get(nodeId2)] = positionMapVertical2.get(key2); + }); + } else { + yCoords[nodeIndexes.get(key2)] = positionMapVertical2.get(key2); + } + }, "_loop10"); + var _iteratorNormalCompletion7 = true; + var _didIteratorError7 = false; + var _iteratorError7 = void 0; + try { + for (var _iterator7 = positionMapVertical2.keys()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { + var key = _step7.value; + _loop10(key); + } + } catch (err) { + _didIteratorError7 = true; + _iteratorError7 = err; + } finally { + try { + if (!_iteratorNormalCompletion7 && _iterator7.return) { + _iterator7.return(); + } + } finally { + if (_didIteratorError7) { + throw _iteratorError7; + } + } + } + })(); + } + } + for (var _i13 = 0; _i13 < allNodes.length; _i13++) { + var _node = allNodes[_i13]; + if (_node.getChild() == null) { + _node.setCenter(xCoords[nodeIndexes.get(_node.id)], yCoords[nodeIndexes.get(_node.id)]); + } + } + }; + module3.exports = ConstraintHandler; + }) + ), + /***/ + 551: ( + /***/ + ((module3) => { + module3.exports = __WEBPACK_EXTERNAL_MODULE__551__; + }) + ) + /******/ + }; + var __webpack_module_cache__ = {}; + function __webpack_require__(moduleId) { + var cachedModule = __webpack_module_cache__[moduleId]; + if (cachedModule !== void 0) { + return cachedModule.exports; + } + var module3 = __webpack_module_cache__[moduleId] = { + /******/ + // no module.id needed + /******/ + // no module.loaded needed + /******/ + exports: {} + /******/ + }; + __webpack_modules__[moduleId](module3, module3.exports, __webpack_require__); + return module3.exports; + } + __name(__webpack_require__, "__webpack_require__"); + var __webpack_exports__ = __webpack_require__(45); + return __webpack_exports__; + })() + ); + }); + } + }); + + // ../../node_modules/.pnpm/cytoscape-fcose@2.2.0_cytoscape@3.33.1/node_modules/cytoscape-fcose/cytoscape-fcose.js + var require_cytoscape_fcose = __commonJS({ + "../../node_modules/.pnpm/cytoscape-fcose@2.2.0_cytoscape@3.33.1/node_modules/cytoscape-fcose/cytoscape-fcose.js"(exports2, module2) { + "use strict"; + (/* @__PURE__ */ __name((function webpackUniversalModuleDefinition(root4, factory) { + if (typeof exports2 === "object" && typeof module2 === "object") + module2.exports = factory(require_cose_base2()); + else if (typeof define === "function" && define.amd) + define(["cose-base"], factory); + else if (typeof exports2 === "object") + exports2["cytoscapeFcose"] = factory(require_cose_base2()); + else + root4["cytoscapeFcose"] = factory(root4["coseBase"]); + }), "webpackUniversalModuleDefinition"))(exports2, function(__WEBPACK_EXTERNAL_MODULE__140__) { + return ( + /******/ + (() => { + "use strict"; + var __webpack_modules__ = { + /***/ + 658: ( + /***/ + ((module3) => { + module3.exports = Object.assign != null ? Object.assign.bind(Object) : function(tgt) { + for (var _len = arguments.length, srcs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + srcs[_key - 1] = arguments[_key]; + } + srcs.forEach(function(src) { + Object.keys(src).forEach(function(k2) { + return tgt[k2] = src[k2]; + }); + }); + return tgt; + }; + }) + ), + /***/ + 548: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var _slicedToArray2 = /* @__PURE__ */ (function() { + function sliceIterator(arr, i2) { + var _arr = []; + var _n = true; + var _d = false; + var _e2 = void 0; + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + if (i2 && _arr.length === i2) break; + } + } catch (err) { + _d = true; + _e2 = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e2; + } + } + return _arr; + } + __name(sliceIterator, "sliceIterator"); + return function(arr, i2) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i2); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; + })(); + var LinkedList = __webpack_require__2(140).layoutBase.LinkedList; + var auxiliary = {}; + auxiliary.getTopMostNodes = function(nodes5) { + var nodesMap2 = {}; + for (var i2 = 0; i2 < nodes5.length; i2++) { + nodesMap2[nodes5[i2].id()] = true; + } + var roots = nodes5.filter(function(ele, i3) { + if (typeof ele === "number") { + ele = i3; + } + var parent4 = ele.parent()[0]; + while (parent4 != null) { + if (nodesMap2[parent4.id()]) { + return false; + } + parent4 = parent4.parent()[0]; + } + return true; + }); + return roots; + }; + auxiliary.connectComponents = function(cy, eles, topMostNodes, dummyNodes) { + var queue = new LinkedList(); + var visited = /* @__PURE__ */ new Set(); + var visitedTopMostNodes = []; + var currentNeighbor = void 0; + var minDegreeNode = void 0; + var minDegree = void 0; + var isConnected = false; + var count2 = 1; + var nodesConnectedToDummy = []; + var components3 = []; + var _loop = /* @__PURE__ */ __name(function _loop2() { + var cmpt = cy.collection(); + components3.push(cmpt); + var currentNode = topMostNodes[0]; + var childrenOfCurrentNode = cy.collection(); + childrenOfCurrentNode.merge(currentNode).merge(currentNode.descendants().intersection(eles)); + visitedTopMostNodes.push(currentNode); + childrenOfCurrentNode.forEach(function(node2) { + queue.push(node2); + visited.add(node2); + cmpt.merge(node2); + }); + var _loop22 = /* @__PURE__ */ __name(function _loop23() { + currentNode = queue.shift(); + var neighborNodes = cy.collection(); + currentNode.neighborhood().nodes().forEach(function(node2) { + if (eles.intersection(currentNode.edgesWith(node2)).length > 0) { + neighborNodes.merge(node2); + } + }); + for (var i2 = 0; i2 < neighborNodes.length; i2++) { + var neighborNode = neighborNodes[i2]; + currentNeighbor = topMostNodes.intersection(neighborNode.union(neighborNode.ancestors())); + if (currentNeighbor != null && !visited.has(currentNeighbor[0])) { + var childrenOfNeighbor = currentNeighbor.union(currentNeighbor.descendants()); + childrenOfNeighbor.forEach(function(node2) { + queue.push(node2); + visited.add(node2); + cmpt.merge(node2); + if (topMostNodes.has(node2)) { + visitedTopMostNodes.push(node2); + } + }); + } + } + }, "_loop2"); + while (queue.length != 0) { + _loop22(); + } + cmpt.forEach(function(node2) { + eles.intersection(node2.connectedEdges()).forEach(function(e3) { + if (cmpt.has(e3.source()) && cmpt.has(e3.target())) { + cmpt.merge(e3); + } + }); + }); + if (visitedTopMostNodes.length == topMostNodes.length) { + isConnected = true; + } + if (!isConnected || isConnected && count2 > 1) { + minDegreeNode = visitedTopMostNodes[0]; + minDegree = minDegreeNode.connectedEdges().length; + visitedTopMostNodes.forEach(function(node2) { + if (node2.connectedEdges().length < minDegree) { + minDegree = node2.connectedEdges().length; + minDegreeNode = node2; + } + }); + nodesConnectedToDummy.push(minDegreeNode.id()); + var temp = cy.collection(); + temp.merge(visitedTopMostNodes[0]); + visitedTopMostNodes.forEach(function(node2) { + temp.merge(node2); + }); + visitedTopMostNodes = []; + topMostNodes = topMostNodes.difference(temp); + count2++; + } + }, "_loop"); + do { + _loop(); + } while (!isConnected); + if (dummyNodes) { + if (nodesConnectedToDummy.length > 0) { + dummyNodes.set("dummy" + (dummyNodes.size + 1), nodesConnectedToDummy); + } + } + return components3; + }; + auxiliary.relocateComponent = function(originalCenter, componentResult, options2) { + if (!options2.fixedNodeConstraint) { + var minXCoord = Number.POSITIVE_INFINITY; + var maxXCoord = Number.NEGATIVE_INFINITY; + var minYCoord = Number.POSITIVE_INFINITY; + var maxYCoord = Number.NEGATIVE_INFINITY; + if (options2.quality == "draft") { + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = void 0; + try { + for (var _iterator = componentResult.nodeIndexes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var _ref = _step.value; + var _ref2 = _slicedToArray2(_ref, 2); + var key = _ref2[0]; + var value2 = _ref2[1]; + var cyNode = options2.cy.getElementById(key); + if (cyNode) { + var nodeBB = cyNode.boundingBox(); + var leftX = componentResult.xCoords[value2] - nodeBB.w / 2; + var rightX = componentResult.xCoords[value2] + nodeBB.w / 2; + var topY = componentResult.yCoords[value2] - nodeBB.h / 2; + var bottomY = componentResult.yCoords[value2] + nodeBB.h / 2; + if (leftX < minXCoord) minXCoord = leftX; + if (rightX > maxXCoord) maxXCoord = rightX; + if (topY < minYCoord) minYCoord = topY; + if (bottomY > maxYCoord) maxYCoord = bottomY; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + var diffOnX = originalCenter.x - (maxXCoord + minXCoord) / 2; + var diffOnY = originalCenter.y - (maxYCoord + minYCoord) / 2; + componentResult.xCoords = componentResult.xCoords.map(function(x5) { + return x5 + diffOnX; + }); + componentResult.yCoords = componentResult.yCoords.map(function(y6) { + return y6 + diffOnY; + }); + } else { + Object.keys(componentResult).forEach(function(item) { + var node2 = componentResult[item]; + var leftX2 = node2.getRect().x; + var rightX2 = node2.getRect().x + node2.getRect().width; + var topY2 = node2.getRect().y; + var bottomY2 = node2.getRect().y + node2.getRect().height; + if (leftX2 < minXCoord) minXCoord = leftX2; + if (rightX2 > maxXCoord) maxXCoord = rightX2; + if (topY2 < minYCoord) minYCoord = topY2; + if (bottomY2 > maxYCoord) maxYCoord = bottomY2; + }); + var _diffOnX = originalCenter.x - (maxXCoord + minXCoord) / 2; + var _diffOnY = originalCenter.y - (maxYCoord + minYCoord) / 2; + Object.keys(componentResult).forEach(function(item) { + var node2 = componentResult[item]; + node2.setCenter(node2.getCenterX() + _diffOnX, node2.getCenterY() + _diffOnY); + }); + } + } + }; + auxiliary.calcBoundingBox = function(parentNode, xCoords, yCoords, nodeIndexes) { + var left3 = Number.MAX_SAFE_INTEGER; + var right3 = Number.MIN_SAFE_INTEGER; + var top2 = Number.MAX_SAFE_INTEGER; + var bottom2 = Number.MIN_SAFE_INTEGER; + var nodeLeft = void 0; + var nodeRight = void 0; + var nodeTop = void 0; + var nodeBottom = void 0; + var nodes5 = parentNode.descendants().not(":parent"); + var s2 = nodes5.length; + for (var i2 = 0; i2 < s2; i2++) { + var node2 = nodes5[i2]; + nodeLeft = xCoords[nodeIndexes.get(node2.id())] - node2.width() / 2; + nodeRight = xCoords[nodeIndexes.get(node2.id())] + node2.width() / 2; + nodeTop = yCoords[nodeIndexes.get(node2.id())] - node2.height() / 2; + nodeBottom = yCoords[nodeIndexes.get(node2.id())] + node2.height() / 2; + if (left3 > nodeLeft) { + left3 = nodeLeft; + } + if (right3 < nodeRight) { + right3 = nodeRight; + } + if (top2 > nodeTop) { + top2 = nodeTop; + } + if (bottom2 < nodeBottom) { + bottom2 = nodeBottom; + } + } + var boundingBox3 = {}; + boundingBox3.topLeftX = left3; + boundingBox3.topLeftY = top2; + boundingBox3.width = right3 - left3; + boundingBox3.height = bottom2 - top2; + return boundingBox3; + }; + auxiliary.calcParentsWithoutChildren = function(cy, eles) { + var parentsWithoutChildren = cy.collection(); + eles.nodes(":parent").forEach(function(parent4) { + var check = false; + parent4.children().forEach(function(child) { + if (child.css("display") != "none") { + check = true; + } + }); + if (!check) { + parentsWithoutChildren.merge(parent4); + } + }); + return parentsWithoutChildren; + }; + module3.exports = auxiliary; + }) + ), + /***/ + 816: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var aux = __webpack_require__2(548); + var CoSELayout = __webpack_require__2(140).CoSELayout; + var CoSENode = __webpack_require__2(140).CoSENode; + var PointD = __webpack_require__2(140).layoutBase.PointD; + var DimensionD2 = __webpack_require__2(140).layoutBase.DimensionD; + var LayoutConstants = __webpack_require__2(140).layoutBase.LayoutConstants; + var FDLayoutConstants = __webpack_require__2(140).layoutBase.FDLayoutConstants; + var CoSEConstants = __webpack_require__2(140).CoSEConstants; + var coseLayout = /* @__PURE__ */ __name(function coseLayout2(options2, spectralResult) { + var cy = options2.cy; + var eles = options2.eles; + var nodes5 = eles.nodes(); + var edges3 = eles.edges(); + var nodeIndexes = void 0; + var xCoords = void 0; + var yCoords = void 0; + var idToLNode = {}; + if (options2.randomize) { + nodeIndexes = spectralResult["nodeIndexes"]; + xCoords = spectralResult["xCoords"]; + yCoords = spectralResult["yCoords"]; + } + var isFn = /* @__PURE__ */ __name(function isFn2(fn3) { + return typeof fn3 === "function"; + }, "isFn"); + var optFn = /* @__PURE__ */ __name(function optFn2(opt, ele) { + if (isFn(opt)) { + return opt(ele); + } else { + return opt; + } + }, "optFn"); + var parentsWithoutChildren = aux.calcParentsWithoutChildren(cy, eles); + var processChildrenList = /* @__PURE__ */ __name(function processChildrenList2(parent4, children2, layout7, options3) { + var size4 = children2.length; + for (var i2 = 0; i2 < size4; i2++) { + var theChild = children2[i2]; + var children_of_children = null; + if (theChild.intersection(parentsWithoutChildren).length == 0) { + children_of_children = theChild.children(); + } + var theNode = void 0; + var dimensions2 = theChild.layoutDimensions({ + nodeDimensionsIncludeLabels: options3.nodeDimensionsIncludeLabels + }); + if (theChild.outerWidth() != null && theChild.outerHeight() != null) { + if (options3.randomize) { + if (!theChild.isParent()) { + theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(xCoords[nodeIndexes.get(theChild.id())] - dimensions2.w / 2, yCoords[nodeIndexes.get(theChild.id())] - dimensions2.h / 2), new DimensionD2(parseFloat(dimensions2.w), parseFloat(dimensions2.h)))); + } else { + var parentInfo = aux.calcBoundingBox(theChild, xCoords, yCoords, nodeIndexes); + if (theChild.intersection(parentsWithoutChildren).length == 0) { + theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(parentInfo.topLeftX, parentInfo.topLeftY), new DimensionD2(parentInfo.width, parentInfo.height))); + } else { + theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(parentInfo.topLeftX, parentInfo.topLeftY), new DimensionD2(parseFloat(dimensions2.w), parseFloat(dimensions2.h)))); + } + } + } else { + theNode = parent4.add(new CoSENode(layout7.graphManager, new PointD(theChild.position("x") - dimensions2.w / 2, theChild.position("y") - dimensions2.h / 2), new DimensionD2(parseFloat(dimensions2.w), parseFloat(dimensions2.h)))); + } + } else { + theNode = parent4.add(new CoSENode(this.graphManager)); + } + theNode.id = theChild.data("id"); + theNode.nodeRepulsion = optFn(options3.nodeRepulsion, theChild); + theNode.paddingLeft = parseInt(theChild.css("padding")); + theNode.paddingTop = parseInt(theChild.css("padding")); + theNode.paddingRight = parseInt(theChild.css("padding")); + theNode.paddingBottom = parseInt(theChild.css("padding")); + if (options3.nodeDimensionsIncludeLabels) { + theNode.labelWidth = theChild.boundingBox({ includeLabels: true, includeNodes: false, includeOverlays: false }).w; + theNode.labelHeight = theChild.boundingBox({ includeLabels: true, includeNodes: false, includeOverlays: false }).h; + theNode.labelPosVertical = theChild.css("text-valign"); + theNode.labelPosHorizontal = theChild.css("text-halign"); + } + idToLNode[theChild.data("id")] = theNode; + if (isNaN(theNode.rect.x)) { + theNode.rect.x = 0; + } + if (isNaN(theNode.rect.y)) { + theNode.rect.y = 0; + } + if (children_of_children != null && children_of_children.length > 0) { + var theNewGraph = void 0; + theNewGraph = layout7.getGraphManager().add(layout7.newGraph(), theNode); + processChildrenList2(theNewGraph, children_of_children, layout7, options3); + } + } + }, "processChildrenList"); + var processEdges = /* @__PURE__ */ __name(function processEdges2(layout7, gm2, edges4) { + var idealLengthTotal = 0; + var edgeCount3 = 0; + for (var i2 = 0; i2 < edges4.length; i2++) { + var edge = edges4[i2]; + var sourceNode = idToLNode[edge.data("source")]; + var targetNode = idToLNode[edge.data("target")]; + if (sourceNode && targetNode && sourceNode !== targetNode && sourceNode.getEdgesBetween(targetNode).length == 0) { + var e1 = gm2.add(layout7.newEdge(), sourceNode, targetNode); + e1.id = edge.id(); + e1.idealLength = optFn(options2.idealEdgeLength, edge); + e1.edgeElasticity = optFn(options2.edgeElasticity, edge); + idealLengthTotal += e1.idealLength; + edgeCount3++; + } + } + if (options2.idealEdgeLength != null) { + if (edgeCount3 > 0) CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = idealLengthTotal / edgeCount3; + else if (!isFn(options2.idealEdgeLength)) + CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = options2.idealEdgeLength; + else + CoSEConstants.DEFAULT_EDGE_LENGTH = FDLayoutConstants.DEFAULT_EDGE_LENGTH = 50; + CoSEConstants.MIN_REPULSION_DIST = FDLayoutConstants.MIN_REPULSION_DIST = FDLayoutConstants.DEFAULT_EDGE_LENGTH / 10; + CoSEConstants.DEFAULT_RADIAL_SEPARATION = FDLayoutConstants.DEFAULT_EDGE_LENGTH; + } + }, "processEdges"); + var processConstraints = /* @__PURE__ */ __name(function processConstraints2(layout7, options3) { + if (options3.fixedNodeConstraint) { + layout7.constraints["fixedNodeConstraint"] = options3.fixedNodeConstraint; + } + if (options3.alignmentConstraint) { + layout7.constraints["alignmentConstraint"] = options3.alignmentConstraint; + } + if (options3.relativePlacementConstraint) { + layout7.constraints["relativePlacementConstraint"] = options3.relativePlacementConstraint; + } + }, "processConstraints"); + if (options2.nestingFactor != null) CoSEConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = FDLayoutConstants.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = options2.nestingFactor; + if (options2.gravity != null) CoSEConstants.DEFAULT_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_GRAVITY_STRENGTH = options2.gravity; + if (options2.numIter != null) CoSEConstants.MAX_ITERATIONS = FDLayoutConstants.MAX_ITERATIONS = options2.numIter; + if (options2.gravityRange != null) CoSEConstants.DEFAULT_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_GRAVITY_RANGE_FACTOR = options2.gravityRange; + if (options2.gravityCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_STRENGTH = options2.gravityCompound; + if (options2.gravityRangeCompound != null) CoSEConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = FDLayoutConstants.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = options2.gravityRangeCompound; + if (options2.initialEnergyOnIncremental != null) CoSEConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = FDLayoutConstants.DEFAULT_COOLING_FACTOR_INCREMENTAL = options2.initialEnergyOnIncremental; + if (options2.tilingCompareBy != null) CoSEConstants.TILING_COMPARE_BY = options2.tilingCompareBy; + if (options2.quality == "proof") LayoutConstants.QUALITY = 2; + else LayoutConstants.QUALITY = 0; + CoSEConstants.NODE_DIMENSIONS_INCLUDE_LABELS = FDLayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = LayoutConstants.NODE_DIMENSIONS_INCLUDE_LABELS = options2.nodeDimensionsIncludeLabels; + CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = !options2.randomize; + CoSEConstants.ANIMATE = FDLayoutConstants.ANIMATE = LayoutConstants.ANIMATE = options2.animate; + CoSEConstants.TILE = options2.tile; + CoSEConstants.TILING_PADDING_VERTICAL = typeof options2.tilingPaddingVertical === "function" ? options2.tilingPaddingVertical.call() : options2.tilingPaddingVertical; + CoSEConstants.TILING_PADDING_HORIZONTAL = typeof options2.tilingPaddingHorizontal === "function" ? options2.tilingPaddingHorizontal.call() : options2.tilingPaddingHorizontal; + CoSEConstants.DEFAULT_INCREMENTAL = FDLayoutConstants.DEFAULT_INCREMENTAL = LayoutConstants.DEFAULT_INCREMENTAL = true; + CoSEConstants.PURE_INCREMENTAL = !options2.randomize; + LayoutConstants.DEFAULT_UNIFORM_LEAF_NODE_SIZES = options2.uniformNodeDimensions; + if (options2.step == "transformed") { + CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = true; + CoSEConstants.ENFORCE_CONSTRAINTS = false; + CoSEConstants.APPLY_LAYOUT = false; + } + if (options2.step == "enforced") { + CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = false; + CoSEConstants.ENFORCE_CONSTRAINTS = true; + CoSEConstants.APPLY_LAYOUT = false; + } + if (options2.step == "cose") { + CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = false; + CoSEConstants.ENFORCE_CONSTRAINTS = false; + CoSEConstants.APPLY_LAYOUT = true; + } + if (options2.step == "all") { + if (options2.randomize) CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = true; + else CoSEConstants.TRANSFORM_ON_CONSTRAINT_HANDLING = false; + CoSEConstants.ENFORCE_CONSTRAINTS = true; + CoSEConstants.APPLY_LAYOUT = true; + } + if (options2.fixedNodeConstraint || options2.alignmentConstraint || options2.relativePlacementConstraint) { + CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = false; + } else { + CoSEConstants.TREE_REDUCTION_ON_INCREMENTAL = true; + } + var coseLayout3 = new CoSELayout(); + var gm = coseLayout3.newGraphManager(); + processChildrenList(gm.addRoot(), aux.getTopMostNodes(nodes5), coseLayout3, options2); + processEdges(coseLayout3, gm, edges3); + processConstraints(coseLayout3, options2); + coseLayout3.runLayout(); + return idToLNode; + }, "coseLayout"); + module3.exports = { coseLayout }; + }) + ), + /***/ + 212: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var _createClass2 = /* @__PURE__ */ (function() { + function defineProperties(target, props) { + for (var i2 = 0; i2 < props.length; i2++) { + var descriptor = props[i2]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + __name(defineProperties, "defineProperties"); + return function(Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _classCallCheck2(instance2, Constructor) { + if (!(instance2 instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + __name(_classCallCheck2, "_classCallCheck"); + var assign7 = __webpack_require__2(658); + var aux = __webpack_require__2(548); + var _require = __webpack_require__2(657), spectralLayout = _require.spectralLayout; + var _require2 = __webpack_require__2(816), coseLayout = _require2.coseLayout; + var defaults5 = Object.freeze({ + // 'draft', 'default' or 'proof' + // - 'draft' only applies spectral layout + // - 'default' improves the quality with subsequent CoSE layout (fast cooling rate) + // - 'proof' improves the quality with subsequent CoSE layout (slow cooling rate) + quality: "default", + // Use random node positions at beginning of layout + // if this is set to false, then quality option must be "proof" + randomize: true, + // Whether or not to animate the layout + animate: true, + // Duration of animation in ms, if enabled + animationDuration: 1e3, + // Easing of animation, if enabled + animationEasing: void 0, + // Fit the viewport to the repositioned nodes + fit: true, + // Padding around layout + padding: 30, + // Whether to include labels in node dimensions. Valid in "proof" quality + nodeDimensionsIncludeLabels: false, + // Whether or not simple nodes (non-compound nodes) are of uniform dimensions + uniformNodeDimensions: false, + // Whether to pack disconnected components - valid only if randomize: true + packComponents: true, + // Layout step - all, transformed, enforced, cose - for debug purpose only + step: "all", + /* spectral layout options */ + // False for random, true for greedy + samplingType: true, + // Sample size to construct distance matrix + sampleSize: 25, + // Separation amount between nodes + nodeSeparation: 75, + // Power iteration tolerance + piTol: 1e-7, + /* CoSE layout options */ + // Node repulsion (non overlapping) multiplier + nodeRepulsion: /* @__PURE__ */ __name(function nodeRepulsion4(node2) { + return 4500; + }, "nodeRepulsion"), + // Ideal edge (non nested) length + idealEdgeLength: /* @__PURE__ */ __name(function idealEdgeLength2(edge) { + return 50; + }, "idealEdgeLength"), + // Divisor to compute edge forces + edgeElasticity: /* @__PURE__ */ __name(function edgeElasticity2(edge) { + return 0.45; + }, "edgeElasticity"), + // Nesting factor (multiplier) to compute ideal edge length for nested edges + nestingFactor: 0.1, + // Gravity force (constant) + gravity: 0.25, + // Maximum number of iterations to perform + numIter: 2500, + // For enabling tiling + tile: true, + // The function that specifies the criteria for comparing nodes while sorting them during tiling operation. + // Takes the node id as a parameter and the default tiling operation is perfomed when this option is not set. + tilingCompareBy: void 0, + // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingVertical: 10, + // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingHorizontal: 10, + // Gravity range (constant) for compounds + gravityRangeCompound: 1.5, + // Gravity force (constant) for compounds + gravityCompound: 1, + // Gravity range (constant) + gravityRange: 3.8, + // Initial cooling factor for incremental layout + initialEnergyOnIncremental: 0.3, + /* constraint options */ + // Fix required nodes to predefined positions + // [{nodeId: 'n1', position: {x: 100, y: 200}, {...}] + fixedNodeConstraint: void 0, + // Align required nodes in vertical/horizontal direction + // {vertical: [['n1', 'n2')], ['n3', 'n4']], horizontal: ['n2', 'n4']} + alignmentConstraint: void 0, + // Place two nodes relatively in vertical/horizontal direction + // [{top: 'n1', bottom: 'n2', gap: 100}, {left: 'n3', right: 'n4', gap: 75}] + relativePlacementConstraint: void 0, + /* layout event callbacks */ + ready: /* @__PURE__ */ __name(function ready4() { + }, "ready"), + // on layoutready + stop: /* @__PURE__ */ __name(function stop5() { + }, "stop") + // on layoutstop + }); + var Layout2 = (function() { + function Layout3(options2) { + _classCallCheck2(this, Layout3); + this.options = assign7({}, defaults5, options2); + } + __name(Layout3, "Layout"); + _createClass2(Layout3, [{ + key: "run", + value: /* @__PURE__ */ __name(function run5() { + var layout7 = this; + var options2 = this.options; + var cy = options2.cy; + var eles = options2.eles; + var spectralResult = []; + var xCoords = void 0; + var yCoords = void 0; + var coseResult = []; + var components3 = void 0; + var componentCenters = []; + if (options2.fixedNodeConstraint && (!Array.isArray(options2.fixedNodeConstraint) || options2.fixedNodeConstraint.length == 0)) { + options2.fixedNodeConstraint = void 0; + } + if (options2.alignmentConstraint) { + if (options2.alignmentConstraint.vertical && (!Array.isArray(options2.alignmentConstraint.vertical) || options2.alignmentConstraint.vertical.length == 0)) { + options2.alignmentConstraint.vertical = void 0; + } + if (options2.alignmentConstraint.horizontal && (!Array.isArray(options2.alignmentConstraint.horizontal) || options2.alignmentConstraint.horizontal.length == 0)) { + options2.alignmentConstraint.horizontal = void 0; + } + } + if (options2.relativePlacementConstraint && (!Array.isArray(options2.relativePlacementConstraint) || options2.relativePlacementConstraint.length == 0)) { + options2.relativePlacementConstraint = void 0; + } + var constraintExist = options2.fixedNodeConstraint || options2.alignmentConstraint || options2.relativePlacementConstraint; + if (constraintExist) { + options2.tile = false; + options2.packComponents = false; + } + var layUtil = void 0; + var packingEnabled = false; + if (cy.layoutUtilities && options2.packComponents) { + layUtil = cy.layoutUtilities("get"); + if (!layUtil) layUtil = cy.layoutUtilities(); + packingEnabled = true; + } + if (eles.nodes().length > 0) { + if (!packingEnabled) { + var boundingBox3 = options2.eles.boundingBox(); + componentCenters.push({ x: boundingBox3.x1 + boundingBox3.w / 2, y: boundingBox3.y1 + boundingBox3.h / 2 }); + if (options2.randomize) { + var result = spectralLayout(options2); + spectralResult.push(result); + } + if (options2.quality == "default" || options2.quality == "proof") { + coseResult.push(coseLayout(options2, spectralResult[0])); + aux.relocateComponent(componentCenters[0], coseResult[0], options2); + } else { + aux.relocateComponent(componentCenters[0], spectralResult[0], options2); + } + } else { + var topMostNodes = aux.getTopMostNodes(options2.eles.nodes()); + components3 = aux.connectComponents(cy, options2.eles, topMostNodes); + components3.forEach(function(component2) { + var boundingBox4 = component2.boundingBox(); + componentCenters.push({ x: boundingBox4.x1 + boundingBox4.w / 2, y: boundingBox4.y1 + boundingBox4.h / 2 }); + }); + if (options2.randomize) { + components3.forEach(function(component2) { + options2.eles = component2; + spectralResult.push(spectralLayout(options2)); + }); + } + if (options2.quality == "default" || options2.quality == "proof") { + var toBeTiledNodes = cy.collection(); + if (options2.tile) { + var nodeIndexes = /* @__PURE__ */ new Map(); + var _xCoords = []; + var _yCoords = []; + var count2 = 0; + var tempSpectralResult = { nodeIndexes, xCoords: _xCoords, yCoords: _yCoords }; + var indexesToBeDeleted = []; + components3.forEach(function(component2, index) { + if (component2.edges().length == 0) { + component2.nodes().forEach(function(node2, i3) { + toBeTiledNodes.merge(component2.nodes()[i3]); + if (!node2.isParent()) { + tempSpectralResult.nodeIndexes.set(component2.nodes()[i3].id(), count2++); + tempSpectralResult.xCoords.push(component2.nodes()[0].position().x); + tempSpectralResult.yCoords.push(component2.nodes()[0].position().y); + } + }); + indexesToBeDeleted.push(index); + } + }); + if (toBeTiledNodes.length > 1) { + var _boundingBox = toBeTiledNodes.boundingBox(); + componentCenters.push({ x: _boundingBox.x1 + _boundingBox.w / 2, y: _boundingBox.y1 + _boundingBox.h / 2 }); + components3.push(toBeTiledNodes); + spectralResult.push(tempSpectralResult); + for (var i2 = indexesToBeDeleted.length - 1; i2 >= 0; i2--) { + components3.splice(indexesToBeDeleted[i2], 1); + spectralResult.splice(indexesToBeDeleted[i2], 1); + componentCenters.splice(indexesToBeDeleted[i2], 1); + } + ; + } + } + components3.forEach(function(component2, index) { + options2.eles = component2; + coseResult.push(coseLayout(options2, spectralResult[index])); + aux.relocateComponent(componentCenters[index], coseResult[index], options2); + }); + } else { + components3.forEach(function(component2, index) { + aux.relocateComponent(componentCenters[index], spectralResult[index], options2); + }); + } + var componentsEvaluated = /* @__PURE__ */ new Set(); + if (components3.length > 1) { + var subgraphs = []; + var hiddenEles = eles.filter(function(ele) { + return ele.css("display") == "none"; + }); + components3.forEach(function(component2, index) { + var nodeIndexes2 = void 0; + if (options2.quality == "draft") { + nodeIndexes2 = spectralResult[index].nodeIndexes; + } + if (component2.nodes().not(hiddenEles).length > 0) { + var subgraph = {}; + subgraph.edges = []; + subgraph.nodes = []; + var nodeIndex = void 0; + component2.nodes().not(hiddenEles).forEach(function(node2) { + if (options2.quality == "draft") { + if (!node2.isParent()) { + nodeIndex = nodeIndexes2.get(node2.id()); + subgraph.nodes.push({ x: spectralResult[index].xCoords[nodeIndex] - node2.boundingbox().w / 2, y: spectralResult[index].yCoords[nodeIndex] - node2.boundingbox().h / 2, width: node2.boundingbox().w, height: node2.boundingbox().h }); + } else { + var parentInfo = aux.calcBoundingBox(node2, spectralResult[index].xCoords, spectralResult[index].yCoords, nodeIndexes2); + subgraph.nodes.push({ x: parentInfo.topLeftX, y: parentInfo.topLeftY, width: parentInfo.width, height: parentInfo.height }); + } + } else { + if (coseResult[index][node2.id()]) { + subgraph.nodes.push({ x: coseResult[index][node2.id()].getLeft(), y: coseResult[index][node2.id()].getTop(), width: coseResult[index][node2.id()].getWidth(), height: coseResult[index][node2.id()].getHeight() }); + } + } + }); + component2.edges().forEach(function(edge) { + var source = edge.source(); + var target = edge.target(); + if (source.css("display") != "none" && target.css("display") != "none") { + if (options2.quality == "draft") { + var sourceNodeIndex = nodeIndexes2.get(source.id()); + var targetNodeIndex = nodeIndexes2.get(target.id()); + var sourceCenter = []; + var targetCenter = []; + if (source.isParent()) { + var parentInfo = aux.calcBoundingBox(source, spectralResult[index].xCoords, spectralResult[index].yCoords, nodeIndexes2); + sourceCenter.push(parentInfo.topLeftX + parentInfo.width / 2); + sourceCenter.push(parentInfo.topLeftY + parentInfo.height / 2); + } else { + sourceCenter.push(spectralResult[index].xCoords[sourceNodeIndex]); + sourceCenter.push(spectralResult[index].yCoords[sourceNodeIndex]); + } + if (target.isParent()) { + var _parentInfo = aux.calcBoundingBox(target, spectralResult[index].xCoords, spectralResult[index].yCoords, nodeIndexes2); + targetCenter.push(_parentInfo.topLeftX + _parentInfo.width / 2); + targetCenter.push(_parentInfo.topLeftY + _parentInfo.height / 2); + } else { + targetCenter.push(spectralResult[index].xCoords[targetNodeIndex]); + targetCenter.push(spectralResult[index].yCoords[targetNodeIndex]); + } + subgraph.edges.push({ startX: sourceCenter[0], startY: sourceCenter[1], endX: targetCenter[0], endY: targetCenter[1] }); + } else { + if (coseResult[index][source.id()] && coseResult[index][target.id()]) { + subgraph.edges.push({ startX: coseResult[index][source.id()].getCenterX(), startY: coseResult[index][source.id()].getCenterY(), endX: coseResult[index][target.id()].getCenterX(), endY: coseResult[index][target.id()].getCenterY() }); + } + } + } + }); + if (subgraph.nodes.length > 0) { + subgraphs.push(subgraph); + componentsEvaluated.add(index); + } + } + }); + var shiftResult = layUtil.packComponents(subgraphs, options2.randomize).shifts; + if (options2.quality == "draft") { + spectralResult.forEach(function(result2, index) { + var newXCoords = result2.xCoords.map(function(x5) { + return x5 + shiftResult[index].dx; + }); + var newYCoords = result2.yCoords.map(function(y6) { + return y6 + shiftResult[index].dy; + }); + result2.xCoords = newXCoords; + result2.yCoords = newYCoords; + }); + } else { + var _count = 0; + componentsEvaluated.forEach(function(index) { + Object.keys(coseResult[index]).forEach(function(item) { + var nodeRectangle = coseResult[index][item]; + nodeRectangle.setCenter(nodeRectangle.getCenterX() + shiftResult[_count].dx, nodeRectangle.getCenterY() + shiftResult[_count].dy); + }); + _count++; + }); + } + } + } + } + var getPositions = /* @__PURE__ */ __name(function getPositions2(ele, i3) { + if (options2.quality == "default" || options2.quality == "proof") { + if (typeof ele === "number") { + ele = i3; + } + var pos = void 0; + var node2 = void 0; + var theId = ele.data("id"); + coseResult.forEach(function(result2) { + if (theId in result2) { + pos = { x: result2[theId].getRect().getCenterX(), y: result2[theId].getRect().getCenterY() }; + node2 = result2[theId]; + } + }); + if (options2.nodeDimensionsIncludeLabels) { + if (node2.labelWidth) { + if (node2.labelPosHorizontal == "left") { + pos.x += node2.labelWidth / 2; + } else if (node2.labelPosHorizontal == "right") { + pos.x -= node2.labelWidth / 2; + } + } + if (node2.labelHeight) { + if (node2.labelPosVertical == "top") { + pos.y += node2.labelHeight / 2; + } else if (node2.labelPosVertical == "bottom") { + pos.y -= node2.labelHeight / 2; + } + } + } + if (pos == void 0) pos = { x: ele.position("x"), y: ele.position("y") }; + return { + x: pos.x, + y: pos.y + }; + } else { + var _pos = void 0; + spectralResult.forEach(function(result2) { + var index = result2.nodeIndexes.get(ele.id()); + if (index != void 0) { + _pos = { x: result2.xCoords[index], y: result2.yCoords[index] }; + } + }); + if (_pos == void 0) _pos = { x: ele.position("x"), y: ele.position("y") }; + return { + x: _pos.x, + y: _pos.y + }; + } + }, "getPositions"); + if (options2.quality == "default" || options2.quality == "proof" || options2.randomize) { + var parentsWithoutChildren = aux.calcParentsWithoutChildren(cy, eles); + var _hiddenEles = eles.filter(function(ele) { + return ele.css("display") == "none"; + }); + options2.eles = eles.not(_hiddenEles); + eles.nodes().not(":parent").not(_hiddenEles).layoutPositions(layout7, options2, getPositions); + if (parentsWithoutChildren.length > 0) { + parentsWithoutChildren.forEach(function(ele) { + ele.position(getPositions(ele)); + }); + } + } else { + console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'."); + } + }, "run") + }]); + return Layout3; + })(); + module3.exports = Layout2; + }) + ), + /***/ + 657: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var aux = __webpack_require__2(548); + var Matrix = __webpack_require__2(140).layoutBase.Matrix; + var SVD = __webpack_require__2(140).layoutBase.SVD; + var spectralLayout = /* @__PURE__ */ __name(function spectralLayout2(options2) { + var cy = options2.cy; + var eles = options2.eles; + var nodes5 = eles.nodes(); + var parentNodes = eles.nodes(":parent"); + var dummyNodes = /* @__PURE__ */ new Map(); + var nodeIndexes = /* @__PURE__ */ new Map(); + var parentChildMap = /* @__PURE__ */ new Map(); + var allNodesNeighborhood = []; + var xCoords = []; + var yCoords = []; + var samplesColumn = []; + var minDistancesColumn = []; + var C3 = []; + var PHI = []; + var INV = []; + var firstSample = void 0; + var nodeSize = void 0; + var infinity = 1e8; + var small = 1e-9; + var piTol = options2.piTol; + var samplingType = options2.samplingType; + var nodeSeparation = options2.nodeSeparation; + var sampleSize = void 0; + var randomSampleCR = /* @__PURE__ */ __name(function randomSampleCR2() { + var sample2 = 0; + var count2 = 0; + var flag = false; + while (count2 < sampleSize) { + sample2 = Math.floor(Math.random() * nodeSize); + flag = false; + for (var i3 = 0; i3 < count2; i3++) { + if (samplesColumn[i3] == sample2) { + flag = true; + break; + } + } + if (!flag) { + samplesColumn[count2] = sample2; + count2++; + } else { + continue; + } + } + }, "randomSampleCR"); + var BFS = /* @__PURE__ */ __name(function BFS2(pivot, index2, samplingMethod) { + var path4 = []; + var front = 0; + var back = 0; + var current = 0; + var temp = void 0; + var distance3 = []; + var max_dist = 0; + var max_ind = 1; + for (var i3 = 0; i3 < nodeSize; i3++) { + distance3[i3] = infinity; + } + path4[back] = pivot; + distance3[pivot] = 0; + while (back >= front) { + current = path4[front++]; + var neighbors = allNodesNeighborhood[current]; + for (var _i = 0; _i < neighbors.length; _i++) { + temp = nodeIndexes.get(neighbors[_i]); + if (distance3[temp] == infinity) { + distance3[temp] = distance3[current] + 1; + path4[++back] = temp; + } + } + C3[current][index2] = distance3[current] * nodeSeparation; + } + if (samplingMethod) { + for (var _i2 = 0; _i2 < nodeSize; _i2++) { + if (C3[_i2][index2] < minDistancesColumn[_i2]) minDistancesColumn[_i2] = C3[_i2][index2]; + } + for (var _i3 = 0; _i3 < nodeSize; _i3++) { + if (minDistancesColumn[_i3] > max_dist) { + max_dist = minDistancesColumn[_i3]; + max_ind = _i3; + } + } + } + return max_ind; + }, "BFS"); + var allBFS = /* @__PURE__ */ __name(function allBFS2(samplingMethod) { + var sample2 = void 0; + if (!samplingMethod) { + randomSampleCR(); + for (var i3 = 0; i3 < sampleSize; i3++) { + BFS(samplesColumn[i3], i3, samplingMethod, false); + } + } else { + sample2 = Math.floor(Math.random() * nodeSize); + firstSample = sample2; + for (var _i4 = 0; _i4 < nodeSize; _i4++) { + minDistancesColumn[_i4] = infinity; + } + for (var _i5 = 0; _i5 < sampleSize; _i5++) { + samplesColumn[_i5] = sample2; + sample2 = BFS(sample2, _i5, samplingMethod); + } + } + for (var _i6 = 0; _i6 < nodeSize; _i6++) { + for (var j3 = 0; j3 < sampleSize; j3++) { + C3[_i6][j3] *= C3[_i6][j3]; + } + } + for (var _i7 = 0; _i7 < sampleSize; _i7++) { + PHI[_i7] = []; + } + for (var _i8 = 0; _i8 < sampleSize; _i8++) { + for (var _j = 0; _j < sampleSize; _j++) { + PHI[_i8][_j] = C3[samplesColumn[_j]][_i8]; + } + } + }, "allBFS"); + var sample = /* @__PURE__ */ __name(function sample2() { + var SVDResult = SVD.svd(PHI); + var a_q = SVDResult.S; + var a_u = SVDResult.U; + var a_v = SVDResult.V; + var max_s = a_q[0] * a_q[0] * a_q[0]; + var a_Sig = []; + for (var i3 = 0; i3 < sampleSize; i3++) { + a_Sig[i3] = []; + for (var j3 = 0; j3 < sampleSize; j3++) { + a_Sig[i3][j3] = 0; + if (i3 == j3) { + a_Sig[i3][j3] = a_q[i3] / (a_q[i3] * a_q[i3] + max_s / (a_q[i3] * a_q[i3])); + } + } + } + INV = Matrix.multMat(Matrix.multMat(a_v, a_Sig), Matrix.transpose(a_u)); + }, "sample"); + var powerIteration = /* @__PURE__ */ __name(function powerIteration2() { + var theta1 = void 0; + var theta2 = void 0; + var Y1 = []; + var Y22 = []; + var V1 = []; + var V22 = []; + for (var i3 = 0; i3 < nodeSize; i3++) { + Y1[i3] = Math.random(); + Y22[i3] = Math.random(); + } + Y1 = Matrix.normalize(Y1); + Y22 = Matrix.normalize(Y22); + var count2 = 0; + var current = small; + var previous = small; + var temp = void 0; + while (true) { + count2++; + for (var _i9 = 0; _i9 < nodeSize; _i9++) { + V1[_i9] = Y1[_i9]; + } + Y1 = Matrix.multGamma(Matrix.multL(Matrix.multGamma(V1), C3, INV)); + theta1 = Matrix.dotProduct(V1, Y1); + Y1 = Matrix.normalize(Y1); + current = Matrix.dotProduct(V1, Y1); + temp = Math.abs(current / previous); + if (temp <= 1 + piTol && temp >= 1) { + break; + } + previous = current; + } + for (var _i10 = 0; _i10 < nodeSize; _i10++) { + V1[_i10] = Y1[_i10]; + } + count2 = 0; + previous = small; + while (true) { + count2++; + for (var _i11 = 0; _i11 < nodeSize; _i11++) { + V22[_i11] = Y22[_i11]; + } + V22 = Matrix.minusOp(V22, Matrix.multCons(V1, Matrix.dotProduct(V1, V22))); + Y22 = Matrix.multGamma(Matrix.multL(Matrix.multGamma(V22), C3, INV)); + theta2 = Matrix.dotProduct(V22, Y22); + Y22 = Matrix.normalize(Y22); + current = Matrix.dotProduct(V22, Y22); + temp = Math.abs(current / previous); + if (temp <= 1 + piTol && temp >= 1) { + break; + } + previous = current; + } + for (var _i12 = 0; _i12 < nodeSize; _i12++) { + V22[_i12] = Y22[_i12]; + } + xCoords = Matrix.multCons(V1, Math.sqrt(Math.abs(theta1))); + yCoords = Matrix.multCons(V22, Math.sqrt(Math.abs(theta2))); + }, "powerIteration"); + aux.connectComponents(cy, eles, aux.getTopMostNodes(nodes5), dummyNodes); + parentNodes.forEach(function(ele) { + aux.connectComponents(cy, eles, aux.getTopMostNodes(ele.descendants().intersection(eles)), dummyNodes); + }); + var index = 0; + for (var i2 = 0; i2 < nodes5.length; i2++) { + if (!nodes5[i2].isParent()) { + nodeIndexes.set(nodes5[i2].id(), index++); + } + } + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = void 0; + try { + for (var _iterator = dummyNodes.keys()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var key = _step.value; + nodeIndexes.set(key, index++); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + for (var _i13 = 0; _i13 < nodeIndexes.size; _i13++) { + allNodesNeighborhood[_i13] = []; + } + parentNodes.forEach(function(ele) { + var children2 = ele.children().intersection(eles); + while (children2.nodes(":childless").length == 0) { + children2 = children2.nodes()[0].children().intersection(eles); + } + var index2 = 0; + var min10 = children2.nodes(":childless")[0].connectedEdges().length; + children2.nodes(":childless").forEach(function(ele2, i3) { + if (ele2.connectedEdges().length < min10) { + min10 = ele2.connectedEdges().length; + index2 = i3; + } + }); + parentChildMap.set(ele.id(), children2.nodes(":childless")[index2].id()); + }); + nodes5.forEach(function(ele) { + var eleIndex = void 0; + if (ele.isParent()) eleIndex = nodeIndexes.get(parentChildMap.get(ele.id())); + else eleIndex = nodeIndexes.get(ele.id()); + ele.neighborhood().nodes().forEach(function(node2) { + if (eles.intersection(ele.edgesWith(node2)).length > 0) { + if (node2.isParent()) allNodesNeighborhood[eleIndex].push(parentChildMap.get(node2.id())); + else allNodesNeighborhood[eleIndex].push(node2.id()); + } + }); + }); + var _loop = /* @__PURE__ */ __name(function _loop2(_key2) { + var eleIndex = nodeIndexes.get(_key2); + var disconnectedId = void 0; + dummyNodes.get(_key2).forEach(function(id35) { + if (cy.getElementById(id35).isParent()) disconnectedId = parentChildMap.get(id35); + else disconnectedId = id35; + allNodesNeighborhood[eleIndex].push(disconnectedId); + allNodesNeighborhood[nodeIndexes.get(disconnectedId)].push(_key2); + }); + }, "_loop"); + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = void 0; + try { + for (var _iterator2 = dummyNodes.keys()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + var _key = _step2.value; + _loop(_key); + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + nodeSize = nodeIndexes.size; + var spectralResult = void 0; + if (nodeSize > 2) { + sampleSize = nodeSize < options2.sampleSize ? nodeSize : options2.sampleSize; + for (var _i14 = 0; _i14 < nodeSize; _i14++) { + C3[_i14] = []; + } + for (var _i15 = 0; _i15 < sampleSize; _i15++) { + INV[_i15] = []; + } + if (options2.quality == "draft" || options2.step == "all") { + allBFS(samplingType); + sample(); + powerIteration(); + spectralResult = { nodeIndexes, xCoords, yCoords }; + } else { + nodeIndexes.forEach(function(value2, key2) { + xCoords.push(cy.getElementById(key2).position("x")); + yCoords.push(cy.getElementById(key2).position("y")); + }); + spectralResult = { nodeIndexes, xCoords, yCoords }; + } + return spectralResult; + } else { + var iterator = nodeIndexes.keys(); + var firstNode = cy.getElementById(iterator.next().value); + var firstNodePos = firstNode.position(); + var firstNodeWidth = firstNode.outerWidth(); + xCoords.push(firstNodePos.x); + yCoords.push(firstNodePos.y); + if (nodeSize == 2) { + var secondNode = cy.getElementById(iterator.next().value); + var secondNodeWidth = secondNode.outerWidth(); + xCoords.push(firstNodePos.x + firstNodeWidth / 2 + secondNodeWidth / 2 + options2.idealEdgeLength); + yCoords.push(firstNodePos.y); + } + spectralResult = { nodeIndexes, xCoords, yCoords }; + return spectralResult; + } + }, "spectralLayout"); + module3.exports = { spectralLayout }; + }) + ), + /***/ + 579: ( + /***/ + ((module3, __unused_webpack_exports, __webpack_require__2) => { + var impl2 = __webpack_require__2(212); + var register = /* @__PURE__ */ __name(function register2(cytoscape4) { + if (!cytoscape4) { + return; + } + cytoscape4("layout", "fcose", impl2); + }, "register"); + if (typeof cytoscape !== "undefined") { + register(cytoscape); + } + module3.exports = register; + }) + ), + /***/ + 140: ( + /***/ + ((module3) => { + module3.exports = __WEBPACK_EXTERNAL_MODULE__140__; + }) + ) + /******/ + }; + var __webpack_module_cache__ = {}; + function __webpack_require__(moduleId) { + var cachedModule = __webpack_module_cache__[moduleId]; + if (cachedModule !== void 0) { + return cachedModule.exports; + } + var module3 = __webpack_module_cache__[moduleId] = { + /******/ + // no module.id needed + /******/ + // no module.loaded needed + /******/ + exports: {} + /******/ + }; + __webpack_modules__[moduleId](module3, module3.exports, __webpack_require__); + return module3.exports; + } + __name(__webpack_require__, "__webpack_require__"); + var __webpack_exports__ = __webpack_require__(579); + return __webpack_exports__; + })() + ); + }); + } + }); + + // src/diagrams/architecture/architectureIcons.ts + var wrapIcon, architectureIcons; + var init_architectureIcons = __esm({ + "src/diagrams/architecture/architectureIcons.ts"() { + "use strict"; + init_icons(); + wrapIcon = /* @__PURE__ */ __name((icon2) => { + return `${icon2}`; + }, "wrapIcon"); + architectureIcons = { + prefix: "mermaid-architecture", + height: 80, + width: 80, + icons: { + database: { + body: wrapIcon( + '' + ) + }, + server: { + body: wrapIcon( + '' + ) + }, + disk: { + body: wrapIcon( + '' + ) + }, + internet: { + body: wrapIcon( + '' + ) + }, + cloud: { + body: wrapIcon( + '' + ) + }, + unknown: unknownIcon, + blank: { + body: wrapIcon("") + } + } + }; + } + }); + + // src/diagrams/architecture/svgDraw.ts + var drawEdges, drawGroups, drawServices, drawJunctions; + var init_svgDraw6 = __esm({ + "src/diagrams/architecture/svgDraw.ts"() { + "use strict"; + init_diagramAPI(); + init_createText(); + init_icons(); + init_common(); + init_architectureIcons(); + init_architectureTypes(); + init_utils2(); + drawEdges = /* @__PURE__ */ __name(async function(edgesEl, cy, db10, diagramId3) { + const padding2 = db10.getConfigField("padding"); + const iconSize = db10.getConfigField("iconSize"); + const halfIconSize = iconSize / 2; + const arrowSize = iconSize / 6; + const halfArrowSize = arrowSize / 2; + await Promise.all( + cy.edges().map(async (edge) => { + const { + source, + sourceDir, + sourceArrow, + sourceGroup, + target, + targetDir, + targetArrow, + targetGroup, + label + } = edgeData(edge); + let { x: startX2, y: startY2 } = edge[0].sourceEndpoint(); + const { x: midX, y: midY } = edge[0].midpoint(); + let { x: endX, y: endY } = edge[0].targetEndpoint(); + const groupEdgeShift = padding2 + 4; + if (sourceGroup) { + if (isArchitectureDirectionX(sourceDir)) { + startX2 += sourceDir === "L" ? -groupEdgeShift : groupEdgeShift; + } else { + startY2 += sourceDir === "T" ? -groupEdgeShift : groupEdgeShift + 18; + } + } + if (targetGroup) { + if (isArchitectureDirectionX(targetDir)) { + endX += targetDir === "L" ? -groupEdgeShift : groupEdgeShift; + } else { + endY += targetDir === "T" ? -groupEdgeShift : groupEdgeShift + 18; + } + } + if (!sourceGroup && db10.getNode(source)?.type === "junction") { + if (isArchitectureDirectionX(sourceDir)) { + startX2 += sourceDir === "L" ? halfIconSize : -halfIconSize; + } else { + startY2 += sourceDir === "T" ? halfIconSize : -halfIconSize; + } + } + if (!targetGroup && db10.getNode(target)?.type === "junction") { + if (isArchitectureDirectionX(targetDir)) { + endX += targetDir === "L" ? halfIconSize : -halfIconSize; + } else { + endY += targetDir === "T" ? halfIconSize : -halfIconSize; + } + } + if (edge[0]._private.rscratch) { + const g2 = edgesEl.insert("g"); + g2.insert("path").attr("d", `M ${startX2},${startY2} L ${midX},${midY} L${endX},${endY} `).attr("class", "edge").attr("id", `${diagramId3}-${getEdgeId(source, target, { prefix: "L" })}`); + if (sourceArrow) { + const xShift = isArchitectureDirectionX(sourceDir) ? ArchitectureDirectionArrowShift[sourceDir](startX2, arrowSize) : startX2 - halfArrowSize; + const yShift = isArchitectureDirectionY(sourceDir) ? ArchitectureDirectionArrowShift[sourceDir](startY2, arrowSize) : startY2 - halfArrowSize; + g2.insert("polygon").attr("points", ArchitectureDirectionArrow[sourceDir](arrowSize)).attr("transform", `translate(${xShift},${yShift})`).attr("class", "arrow"); + } + if (targetArrow) { + const xShift = isArchitectureDirectionX(targetDir) ? ArchitectureDirectionArrowShift[targetDir](endX, arrowSize) : endX - halfArrowSize; + const yShift = isArchitectureDirectionY(targetDir) ? ArchitectureDirectionArrowShift[targetDir](endY, arrowSize) : endY - halfArrowSize; + g2.insert("polygon").attr("points", ArchitectureDirectionArrow[targetDir](arrowSize)).attr("transform", `translate(${xShift},${yShift})`).attr("class", "arrow"); + } + if (label) { + const axis2 = !isArchitectureDirectionXY(sourceDir, targetDir) ? isArchitectureDirectionX(sourceDir) ? "X" : "Y" : "XY"; + let width3 = 0; + if (axis2 === "X") { + width3 = Math.abs(startX2 - endX); + } else if (axis2 === "Y") { + width3 = Math.abs(startY2 - endY) / 1.5; + } else { + width3 = Math.abs(startX2 - endX) / 2; + } + const textElem = g2.append("g"); + await createText( + textElem, + label, + { + useHtmlLabels: false, + width: width3, + classes: "architecture-service-label" + }, + getConfig2() + ); + textElem.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"); + if (axis2 === "X") { + textElem.attr("transform", "translate(" + midX + ", " + midY + ")"); + } else if (axis2 === "Y") { + textElem.attr("transform", "translate(" + midX + ", " + midY + ") rotate(-90)"); + } else if (axis2 === "XY") { + const pair = getArchitectureDirectionPair(sourceDir, targetDir); + if (pair && isArchitecturePairXY(pair)) { + const bboxOrig = textElem.node().getBoundingClientRect(); + const [x5, y6] = getArchitectureDirectionXYFactors(pair); + textElem.attr("dominant-baseline", "auto").attr("transform", `rotate(${-1 * x5 * y6 * 45})`); + const bboxNew = textElem.node().getBoundingClientRect(); + textElem.attr( + "transform", + ` + translate(${midX}, ${midY - bboxOrig.height / 2}) + translate(${x5 * bboxNew.width / 2}, ${y6 * bboxNew.height / 2}) + rotate(${-1 * x5 * y6 * 45}, 0, ${bboxOrig.height / 2}) + ` + ); + } + } + } + } + }) + ); + }, "drawEdges"); + drawGroups = /* @__PURE__ */ __name(async function(groupsEl, cy, db10, diagramId3) { + const padding2 = db10.getConfigField("padding"); + const groupIconSize = padding2 * 0.75; + const fontSize = db10.getConfigField("fontSize"); + const iconSize = db10.getConfigField("iconSize"); + const halfIconSize = iconSize / 2; + await Promise.all( + cy.nodes().map(async (node2) => { + const data5 = nodeData(node2); + if (data5.type === "group") { + const { h: h3, w: w4, x1, y1 } = node2.boundingBox(); + const groupsNode = groupsEl.append("rect"); + groupsNode.attr("id", `${diagramId3}-group-${data5.id}`).attr("x", x1 + halfIconSize).attr("y", y1 + halfIconSize).attr("width", w4).attr("height", h3).attr("class", "node-bkg"); + const groupLabelContainer = groupsEl.append("g"); + let shiftedX1 = x1; + let shiftedY1 = y1; + if (data5.icon) { + const bkgElem = groupLabelContainer.append("g"); + bkgElem.html( + `${await getIconSVG(data5.icon, { height: groupIconSize, width: groupIconSize, fallbackPrefix: architectureIcons.prefix })}` + ); + bkgElem.attr( + "transform", + "translate(" + (shiftedX1 + halfIconSize + 1) + ", " + (shiftedY1 + halfIconSize + 1) + ")" + ); + shiftedX1 += groupIconSize; + shiftedY1 += fontSize / 2 - 1 - 2; + } + if (data5.label) { + const textElem = groupLabelContainer.append("g"); + await createText( + textElem, + data5.label, + { + useHtmlLabels: false, + width: w4, + classes: "architecture-service-label" + }, + getConfig2() + ); + textElem.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "start").attr("text-anchor", "start"); + textElem.attr( + "transform", + "translate(" + (shiftedX1 + halfIconSize + 4) + ", " + (shiftedY1 + halfIconSize + 2) + ")" + ); + } + db10.setElementForId(data5.id, groupsNode); + } + }) + ); + }, "drawGroups"); + drawServices = /* @__PURE__ */ __name(async function(db10, elem, services, diagramId3) { + const config5 = getConfig2(); + for (const service of services) { + const serviceElem = elem.append("g"); + const iconSize = db10.getConfigField("iconSize"); + if (service.title) { + const textElem = serviceElem.append("g"); + await createText( + textElem, + service.title, + { + useHtmlLabels: false, + width: iconSize * 1.5, + classes: "architecture-service-label" + }, + config5 + ); + textElem.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"); + textElem.attr("transform", "translate(" + iconSize / 2 + ", " + iconSize + ")"); + } + const bkgElem = serviceElem.append("g"); + if (service.icon) { + bkgElem.html( + `${await getIconSVG(service.icon, { height: iconSize, width: iconSize, fallbackPrefix: architectureIcons.prefix })}` + ); + } else if (service.iconText) { + bkgElem.html( + `${await getIconSVG("blank", { height: iconSize, width: iconSize, fallbackPrefix: architectureIcons.prefix })}` + ); + const textElemContainer = bkgElem.append("g"); + const fo = textElemContainer.append("foreignObject").attr("width", iconSize).attr("height", iconSize); + const divElem = fo.append("div").attr("class", "node-icon-text").attr("style", `height: ${iconSize}px;`).append("div").html(sanitizeText(service.iconText, config5)); + const fontSize = parseInt( + window.getComputedStyle(divElem.node(), null).getPropertyValue("font-size").replace(/\D/g, "") + ) ?? 16; + divElem.attr("style", `-webkit-line-clamp: ${Math.floor((iconSize - 2) / fontSize)};`); + } else { + bkgElem.append("path").attr("class", "node-bkg").attr("id", `${diagramId3}-node-${service.id}`).attr( + "d", + `M0,${iconSize} V5 Q0,0 5,0 H${iconSize - 5} Q${iconSize},0 ${iconSize},5 V${iconSize} Z` + ); + } + serviceElem.attr("id", `${diagramId3}-service-${service.id}`).attr("class", "architecture-service"); + const { width: width3, height: height2 } = serviceElem.node().getBBox(); + service.width = width3; + service.height = height2; + db10.setElementForId(service.id, serviceElem); + } + return 0; + }, "drawServices"); + drawJunctions = /* @__PURE__ */ __name(function(db10, elem, junctions, diagramId3) { + junctions.forEach((junction) => { + const junctionElem = elem.append("g"); + const iconSize = db10.getConfigField("iconSize"); + const bkgElem = junctionElem.append("g"); + bkgElem.append("rect").attr("id", `${diagramId3}-node-${junction.id}`).attr("fill-opacity", "0").attr("width", iconSize).attr("height", iconSize); + junctionElem.attr("class", "architecture-junction"); + const { width: width3, height: height2 } = junctionElem._groups[0][0].getBBox(); + junctionElem.width = width3; + junctionElem.height = height2; + db10.setElementForId(junction.id, junctionElem); + }); + }, "drawJunctions"); + } + }); + + // src/diagrams/architecture/architectureRenderer.ts + function addServices(services, cy, db10) { + services.forEach((service) => { + cy.add({ + group: "nodes", + data: { + type: "service", + id: service.id, + icon: service.icon, + label: service.title, + parent: service.in, + width: db10.getConfigField("iconSize"), + height: db10.getConfigField("iconSize") + }, + classes: "node-service" + }); + }); + } + function addJunctions(junctions, cy, db10) { + junctions.forEach((junction) => { + cy.add({ + group: "nodes", + data: { + type: "junction", + id: junction.id, + parent: junction.in, + width: db10.getConfigField("iconSize"), + height: db10.getConfigField("iconSize") + }, + classes: "node-junction" + }); + }); + } + function positionNodes(db10, cy) { + cy.nodes().map((node2) => { + const data5 = nodeData(node2); + if (data5.type === "group") { + return; + } + data5.x = node2.position().x; + data5.y = node2.position().y; + const nodeElem = db10.getElementById(data5.id); + nodeElem.attr("transform", "translate(" + (data5.x || 0) + "," + (data5.y || 0) + ")"); + }); + } + function addGroups(groups, cy) { + groups.forEach((group2) => { + cy.add({ + group: "nodes", + data: { + type: "group", + id: group2.id, + icon: group2.icon, + label: group2.title, + parent: group2.in + }, + classes: "node-group" + }); + }); + } + function addEdges2(edges3, cy) { + edges3.forEach((parsedEdge) => { + const { lhsId, rhsId, lhsInto, lhsGroup, rhsInto, lhsDir, rhsDir, rhsGroup, title: title2 } = parsedEdge; + const edgeType = isArchitectureDirectionXY(parsedEdge.lhsDir, parsedEdge.rhsDir) ? "segments" : "straight"; + const edge = { + id: `${lhsId}-${rhsId}`, + label: title2, + source: lhsId, + sourceDir: lhsDir, + sourceArrow: lhsInto, + sourceGroup: lhsGroup, + sourceEndpoint: lhsDir === "L" ? "0 50%" : lhsDir === "R" ? "100% 50%" : lhsDir === "T" ? "50% 0" : "50% 100%", + target: rhsId, + targetDir: rhsDir, + targetArrow: rhsInto, + targetGroup: rhsGroup, + targetEndpoint: rhsDir === "L" ? "0 50%" : rhsDir === "R" ? "100% 50%" : rhsDir === "T" ? "50% 0" : "50% 100%" + }; + cy.add({ + group: "edges", + data: edge, + classes: edgeType + }); + }); + } + function getAlignments(db10, spatialMaps, groupAlignments) { + const flattenAlignments = /* @__PURE__ */ __name((alignmentObj, alignmentDir) => { + return Object.entries(alignmentObj).reduce( + (prev2, [dir2, alignments2]) => { + let cnt4 = 0; + const arr = Object.entries(alignments2); + if (arr.length === 1) { + prev2[dir2] = arr[0][1]; + return prev2; + } + for (let i2 = 0; i2 < arr.length - 1; i2++) { + for (let j3 = i2 + 1; j3 < arr.length; j3++) { + const [aGroupId, aNodeIds] = arr[i2]; + const [bGroupId, bNodeIds] = arr[j3]; + const alignment = groupAlignments[aGroupId]?.[bGroupId]; + if (alignment === alignmentDir) { + prev2[dir2] ??= []; + prev2[dir2] = [...prev2[dir2], ...aNodeIds, ...bNodeIds]; + } else if (aGroupId === "default" || bGroupId === "default") { + prev2[dir2] ??= []; + prev2[dir2] = [...prev2[dir2], ...aNodeIds, ...bNodeIds]; + } else { + const keyA = `${dir2}-${cnt4++}`; + prev2[keyA] = aNodeIds; + const keyB = `${dir2}-${cnt4++}`; + prev2[keyB] = bNodeIds; + } + } + } + return prev2; + }, + {} + ); + }, "flattenAlignments"); + const alignments = spatialMaps.map((spatialMap) => { + const horizontalAlignments = {}; + const verticalAlignments = {}; + Object.entries(spatialMap).forEach(([id35, [x5, y6]]) => { + const nodeGroup = db10.getNode(id35)?.in ?? "default"; + horizontalAlignments[y6] ??= {}; + horizontalAlignments[y6][nodeGroup] ??= []; + horizontalAlignments[y6][nodeGroup].push(id35); + verticalAlignments[x5] ??= {}; + verticalAlignments[x5][nodeGroup] ??= []; + verticalAlignments[x5][nodeGroup].push(id35); + }); + return { + horiz: Object.values(flattenAlignments(horizontalAlignments, "horizontal")).filter( + (arr) => arr.length > 1 + ), + vert: Object.values(flattenAlignments(verticalAlignments, "vertical")).filter( + (arr) => arr.length > 1 + ) + }; + }); + const [horizontal, vertical] = alignments.reduce( + ([prevHoriz, prevVert], { horiz, vert }) => { + return [ + [...prevHoriz, ...horiz], + [...prevVert, ...vert] + ]; + }, + [[], []] + ); + return { + horizontal, + vertical + }; + } + function getRelativeConstraints(spatialMaps, db10) { + const relativeConstraints = []; + const posToStr = /* @__PURE__ */ __name((pos) => `${pos[0]},${pos[1]}`, "posToStr"); + const strToPos = /* @__PURE__ */ __name((pos) => pos.split(",").map((p3) => parseInt(p3)), "strToPos"); + spatialMaps.forEach((spatialMap) => { + const invSpatialMap = Object.fromEntries( + Object.entries(spatialMap).map(([id35, pos]) => [posToStr(pos), id35]) + ); + const queue = [posToStr([0, 0])]; + const visited = {}; + const directions = { + L: [-1, 0], + R: [1, 0], + T: [0, 1], + B: [0, -1] + }; + while (queue.length > 0) { + const curr = queue.shift(); + if (curr) { + visited[curr] = 1; + const currId = invSpatialMap[curr]; + if (currId) { + const currPos = strToPos(curr); + Object.entries(directions).forEach(([dir2, shift2]) => { + const newPos = posToStr([currPos[0] + shift2[0], currPos[1] + shift2[1]]); + const newId2 = invSpatialMap[newPos]; + if (newId2 && !visited[newPos]) { + queue.push(newPos); + relativeConstraints.push({ + [ArchitectureDirectionName[dir2]]: newId2, + [ArchitectureDirectionName[getOppositeArchitectureDirection(dir2)]]: currId, + gap: 1.5 * db10.getConfigField("iconSize") + }); + } + }); + } + } + } + }); + return relativeConstraints; + } + function layoutArchitecture(services, junctions, groups, edges3, db10, { spatialMaps, groupAlignments }) { + return new Promise((resolve2) => { + const renderEl = select_default2("body").append("div").attr("id", "cy").attr("style", "display:none"); + const cy = cytoscape2({ + container: document.getElementById("cy"), + style: [ + { + selector: "edge", + style: { + "curve-style": "straight", + "source-endpoint": "data(sourceEndpoint)", + "target-endpoint": "data(targetEndpoint)" + } + }, + { + selector: "edge[label]", + style: { + label: "data(label)" + } + }, + { + selector: "edge.segments", + style: { + "curve-style": "segments", + "segment-weights": "0", + "segment-distances": [0.5], + // @ts-ignore Incorrect library types + "edge-distances": "endpoints", + "source-endpoint": "data(sourceEndpoint)", + "target-endpoint": "data(targetEndpoint)" + } + }, + { + selector: "node", + style: { + // @ts-ignore Incorrect library types + "compound-sizing-wrt-labels": "include" + } + }, + { + selector: "node[label]", + style: { + "text-valign": "bottom", + "text-halign": "center", + "font-size": `${db10.getConfigField("fontSize")}px` + } + }, + { + selector: ".node-service", + style: { + label: "data(label)", + width: "data(width)", + height: "data(height)" + } + }, + { + selector: ".node-junction", + style: { + width: "data(width)", + height: "data(height)" + } + }, + { + selector: ".node-group", + style: { + // @ts-ignore Incorrect library types + padding: `${db10.getConfigField("padding")}px` + } + } + ], + layout: { + name: "grid", + boundingBox: { + x1: 0, + x2: 100, + y1: 0, + y2: 100 + } + } + }); + renderEl.remove(); + addGroups(groups, cy); + addServices(services, cy, db10); + addJunctions(junctions, cy, db10); + addEdges2(edges3, cy); + const alignmentConstraint = getAlignments(db10, spatialMaps, groupAlignments); + const relativePlacementConstraint = getRelativeConstraints(spatialMaps, db10); + const iconSize = db10.getConfigField("iconSize"); + const sameGroupIdealLength = db10.getConfigField("idealEdgeLengthMultiplier") * iconSize; + const crossGroupIdealLength = 0.5 * iconSize; + const sameGroupElasticity = db10.getConfigField("edgeElasticity"); + const layout7 = cy.layout({ + name: "fcose", + quality: "proof", + randomize: db10.getConfigField("randomize"), + nodeSeparation: db10.getConfigField("nodeSeparation"), + numIter: db10.getConfigField("numIter"), + styleEnabled: false, + animate: false, + nodeDimensionsIncludeLabels: false, + // Adjust the edge parameters if it passes through the border of a group + // Hacky fix for: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose/issues/67 + idealEdgeLength(edge) { + const [nodeA, nodeB] = edge.connectedNodes(); + const { parent: parentA } = nodeData(nodeA); + const { parent: parentB } = nodeData(nodeB); + return parentA === parentB ? sameGroupIdealLength : crossGroupIdealLength; + }, + edgeElasticity(edge) { + const [nodeA, nodeB] = edge.connectedNodes(); + const { parent: parentA } = nodeData(nodeA); + const { parent: parentB } = nodeData(nodeB); + return parentA === parentB ? sameGroupElasticity : 1e-3; + }, + alignmentConstraint, + relativePlacementConstraint + }); + layout7.one("layoutstop", () => { + function getSegmentWeights(source, target, pointX, pointY) { + let W3, D4; + const { x: sX, y: sY } = source; + const { x: tX, y: tY } = target; + D4 = (pointY - sY + (sX - pointX) * (sY - tY) / (sX - tX)) / Math.sqrt(1 + Math.pow((sY - tY) / (sX - tX), 2)); + W3 = Math.sqrt(Math.pow(pointY - sY, 2) + Math.pow(pointX - sX, 2) - Math.pow(D4, 2)); + const distAB = Math.sqrt(Math.pow(tX - sX, 2) + Math.pow(tY - sY, 2)); + W3 = W3 / distAB; + let delta1 = (tX - sX) * (pointY - sY) - (tY - sY) * (pointX - sX); + switch (true) { + case delta1 >= 0: + delta1 = 1; + break; + case delta1 < 0: + delta1 = -1; + break; + } + let delta2 = (tX - sX) * (pointX - sX) + (tY - sY) * (pointY - sY); + switch (true) { + case delta2 >= 0: + delta2 = 1; + break; + case delta2 < 0: + delta2 = -1; + break; + } + D4 = Math.abs(D4) * delta1; + W3 = W3 * delta2; + return { + distances: D4, + weights: W3 + }; + } + __name(getSegmentWeights, "getSegmentWeights"); + cy.startBatch(); + for (const edge of Object.values(cy.edges())) { + if (edge.data?.()) { + const { x: sX, y: sY } = edge.source().position(); + const { x: tX, y: tY } = edge.target().position(); + if (sX !== tX && sY !== tY) { + const sEP = edge.sourceEndpoint(); + const tEP = edge.targetEndpoint(); + const { sourceDir } = edgeData(edge); + const [pointX, pointY] = isArchitectureDirectionY(sourceDir) ? [sEP.x, tEP.y] : [tEP.x, sEP.y]; + const { weights, distances: distances2 } = getSegmentWeights(sEP, tEP, pointX, pointY); + edge.style("segment-distances", distances2); + edge.style("segment-weights", weights); + } + } + } + cy.endBatch(); + layout7.run(); + }); + layout7.run(); + cy.ready((e3) => { + log.info("Ready", e3); + resolve2(cy); + }); + }); + } + var import_cytoscape_fcose, draw26, renderer9; + var init_architectureRenderer = __esm({ + "src/diagrams/architecture/architectureRenderer.ts"() { + "use strict"; + init_cytoscape_esm(); + import_cytoscape_fcose = __toESM(require_cytoscape_fcose(), 1); + init_src32(); + init_logger(); + init_icons(); + init_selectSvgElement(); + init_setupGraphViewbox(); + init_architectureIcons(); + init_architectureTypes(); + init_svgDraw6(); + registerIconPacks([ + { + name: architectureIcons.prefix, + icons: architectureIcons + } + ]); + cytoscape2.use(import_cytoscape_fcose.default); + __name(addServices, "addServices"); + __name(addJunctions, "addJunctions"); + __name(positionNodes, "positionNodes"); + __name(addGroups, "addGroups"); + __name(addEdges2, "addEdges"); + __name(getAlignments, "getAlignments"); + __name(getRelativeConstraints, "getRelativeConstraints"); + __name(layoutArchitecture, "layoutArchitecture"); + draw26 = /* @__PURE__ */ __name(async (text4, id35, _version, diagObj) => { + const db10 = diagObj.db; + db10.setDiagramId(id35); + const services = db10.getServices(); + const junctions = db10.getJunctions(); + const groups = db10.getGroups(); + const edges3 = db10.getEdges(); + const ds = db10.getDataStructures(); + const svg2 = selectSvgElement(id35); + const edgesElem = svg2.append("g"); + edgesElem.attr("class", "architecture-edges"); + const servicesElem = svg2.append("g"); + servicesElem.attr("class", "architecture-services"); + const groupElem = svg2.append("g"); + groupElem.attr("class", "architecture-groups"); + await drawServices(db10, servicesElem, services, id35); + drawJunctions(db10, servicesElem, junctions, id35); + const cy = await layoutArchitecture(services, junctions, groups, edges3, db10, ds); + await drawEdges(edgesElem, cy, db10, id35); + await drawGroups(groupElem, cy, db10, id35); + positionNodes(db10, cy); + setupGraphViewbox(void 0, svg2, db10.getConfigField("padding"), db10.getConfigField("useMaxWidth")); + }, "draw"); + renderer9 = { draw: draw26 }; + } + }); + + // src/diagrams/architecture/architectureDiagram.ts + var architectureDiagram_exports = {}; + __export(architectureDiagram_exports, { + diagram: () => diagram26 + }); + var diagram26; + var init_architectureDiagram = __esm({ + "src/diagrams/architecture/architectureDiagram.ts"() { + "use strict"; + init_architectureParser(); + init_architectureDb(); + init_architectureStyles(); + init_architectureRenderer(); + diagram26 = { + parser: parser23, + get db() { + return new ArchitectureDB(); + }, + renderer: renderer9, + styles: architectureStyles_default + }; + } + }); + + // src/diagrams/eventmodeling/types.ts + var PositionFrameKind, FramePositionedKind, PositionRelationKind, RelationPositionedKind; + var init_types = __esm({ + "src/diagrams/eventmodeling/types.ts"() { + "use strict"; + PositionFrameKind = "position frame"; + FramePositionedKind = "frame positioned"; + PositionRelationKind = "position relation"; + RelationPositionedKind = "relation positioned"; + } + }); + + // src/diagrams/eventmodeling/db.ts + function reset4() { + store = {}; + } + function getState() { + let state4 = initial; + const { ast } = store; + const diagramProps2 = getDiagramProps(); + if (!ast) { + throw new Error("No data for EventModel"); + } + ast.frames.forEach((frame2, index) => { + const textProps = calculateTextProps(frame2, ast.dataEntities, diagramProps2); + state4 = dispatch2(state4, { + $kind: PositionFrameKind, + index, + frame: frame2, + textProps + }); + let sourceFrames = void 0; + if (hasSourceFrame(frame2)) { + log.debug(`source frame`, frame2.sourceFrames); + sourceFrames = ast.frames.filter((currentFrame) => { + return frame2.sourceFrames.some((sf) => sf.$refText === currentFrame.name); + }); + sourceFrames.forEach((sourceFrame) => { + state4 = dispatch2(state4, { + $kind: PositionRelationKind, + index, + frame: frame2, + sourceFrame + }); + }); + } else { + state4 = dispatch2(state4, { + $kind: PositionRelationKind, + index, + frame: frame2 + }); + } + }); + state4 = { + ...state4, + sortedSwimlanesArray: sortedSwimlanesArray(state4.swimlanes) + }; + return state4; + } + function setAst(ast) { + store.ast = ast; + } + function getDiagramProps() { + return diagramProps; + } + function extractNamespace(entityIdentifier) { + const spl = entityIdentifier.split("."); + if (spl.length === 2) { + return spl[0]; + } + return void 0; + } + function extractName(entityIdentifier) { + const spl = entityIdentifier.split("."); + if (spl.length === 2) { + return spl[1]; + } + return entityIdentifier; + } + function findSwimlaneByNamespace(swimlanes, namespace) { + if (!namespace || namespace.length === 0) { + return void 0; + } + return Object.values(swimlanes).find((swimlane) => swimlane.namespace === namespace); + } + function findNextAvailableIndex(swimlanes, boundaryMin, boundaryMax) { + return Math.max( + boundaryMin, + ...Object.keys(swimlanes).filter((key) => { + const index = Number.parseInt(key); + return index > boundaryMin && index < boundaryMax; + }).map((key) => Number.parseInt(key)) + ) + 1; + } + function calculateSwimlaneProps(frame2, swimlanes) { + const namespace = extractNamespace(frame2.entityIdentifier); + const sw = findSwimlaneByNamespace(swimlanes, namespace); + switch (frame2.modelEntityType) { + case "ui": + case "pcr": + case "processor": + if (sw) { + return { + index: sw.index, + label: sw.namespace || diagramProps.labelUiAutomation + }; + } else if (namespace) { + return { + index: findNextAvailableIndex(swimlanes, 0, 100), + label: diagramProps.labelUiAutomationPrefix + namespace + }; + } + return { index: 0, label: diagramProps.labelUiAutomation }; + case "rmo": + case "readmodel": + case "cmd": + case "command": + if (sw) { + return { + index: sw.index, + label: sw.namespace || diagramProps.labelCommandReadModel + }; + } else if (namespace) { + return { + index: findNextAvailableIndex(swimlanes, 100, 200), + label: diagramProps.labelCommandReadModelPrefix + namespace + }; + } + return { index: 100, label: diagramProps.labelCommandReadModel }; + case "evt": + case "event": + default: + if (sw) { + return { + index: sw.index, + label: sw.namespace || diagramProps.labelEvents + }; + } else if (namespace) { + return { + index: findNextAvailableIndex(swimlanes, 200, 300), + label: diagramProps.labelEventsPrefix + namespace + }; + } + return { index: 200, label: diagramProps.labelEvents }; + } + } + function calculateEntityVisualProps(frame2) { + const { themeVariables } = getConfig(); + switch (frame2.modelEntityType) { + case "ui": + return { + fill: themeVariables.emUiFill ?? "white", + stroke: themeVariables.emUiStroke ?? "#dbdada" + }; + case "pcr": + case "processor": + return { + fill: themeVariables.emProcessorFill ?? "#edb3f6", + stroke: themeVariables.emProcessorStroke ?? "#b88cbf" + }; + case "rmo": + case "readmodel": + return { + fill: themeVariables.emReadModelFill ?? "#d3f1a2", + stroke: themeVariables.emReadModelStroke ?? "#a3b732" + }; + case "cmd": + case "command": + return { + fill: themeVariables.emCommandFill ?? "#bcd6fe", + stroke: themeVariables.emCommandStroke ?? "#679ac3" + }; + case "evt": + case "event": + return { + fill: themeVariables.emEventFill ?? "#ffb778", + stroke: themeVariables.emEventStroke ?? "#c19a0f" + }; + default: + return { + fill: "red", + stroke: "black" + }; + } + } + function calculateTextProps(frame2, dataEntities, diagramProps2) { + const config5 = getConfig(); + const name = sanitizeText(extractName(frame2.entityIdentifier) ?? "", config5); + let toHtml; + const wrapLabelConfig = { + fontSize: 16, + fontWeight: 700, + fontFamily: '"trebuchet ms", verdana, arial, sans-serif', + joinWith: "
    " + }; + const wrappedName = wrapLabel(name, diagramProps2.textMaxWidth, wrapLabelConfig); + let content = `${wrappedName}`; + if (frame2.dataInlineValue) { + toHtml = frame2.dataInlineValue; + toHtml = toHtml.substring(toHtml.indexOf("{") + 1); + toHtml = toHtml.substring(0, toHtml.lastIndexOf("}") - 1); + toHtml = sanitizeText(toHtml, config5); + toHtml = wrapLabel(toHtml, diagramProps2.textMaxWidth, wrapLabelConfig); + toHtml = toHtml.replaceAll(" ", " "); + } + if (frame2.dataReference) { + const dataEntity = dataEntities.find( + (dataEntity2) => dataEntity2.name === frame2.dataReference?.$refText + ); + if (dataEntity) { + toHtml = dataEntity.dataBlockValue; + toHtml = toHtml.substring(toHtml.indexOf("{\n") + 2); + toHtml = toHtml.substring(0, toHtml.lastIndexOf("}") - 1); + toHtml = sanitizeText(toHtml, config5); + toHtml = wrapLabel(toHtml, diagramProps2.textMaxWidth, wrapLabelConfig); + toHtml = toHtml.replaceAll(" ", " "); + toHtml += `
    `; + } + } + const hasRenderedData = toHtml !== void 0; + if (hasRenderedData) { + content += `

    ${toHtml}`; + } + const textDimensionConfig = { + fontSize: wrapLabelConfig.fontSize, + fontWeight: wrapLabelConfig.fontWeight, + fontFamily: wrapLabelConfig.fontFamily + }; + const dimensions2 = calculateTextDimensions(content, textDimensionConfig); + const calculatedWidthFix = hasRenderedData ? dimensions2.width / 3 : dimensions2.width; + const props = { + content, + width: calculatedWidthFix, + height: dimensions2.height + }; + log.debug(`[${frame2.name}] ${frame2.entityIdentifier} text`, props); + return props; + } + function decidePositionFrame(state4, _command) { + const command = _command; + const visual = calculateEntityVisualProps(command.frame); + const dimension = { + width: command.textProps.width + 2 * diagramProps.boxTextPadding, + height: command.textProps.height + 2 * diagramProps.boxTextPadding + }; + const event3 = { + $kind: FramePositionedKind, + frame: command.frame, + index: command.index, + visual, + dimension, + textProps: command.textProps + }; + return [event3]; + } + function calculateX(swimlane, previousSwimlane, lastBox) { + if (previousSwimlane === void 0) { + return diagramProps.contentStartX; + } + if (previousSwimlane.index === swimlane.index && swimlane.r) { + return swimlane.r + diagramProps.boxPadding; + } + if (lastBox === void 0) { + return diagramProps.contentStartX; + } + return lastBox.r - diagramProps.boxOverlap + diagramProps.boxPadding; + } + function calculateMaxRight(swimlanes, swimlaneR) { + const rs = [...swimlanes.map((s2) => s2.r), swimlaneR]; + return Math.max(...rs); + } + function sortedSwimlanesArray(swimlanes) { + return Object.values(swimlanes).sort((a2, b3) => a2.index - b3.index); + } + function evolveFramePositioned(state4, _event) { + const event3 = _event; + const swimlaneProps = calculateSwimlaneProps(event3.frame, state4.swimlanes); + let swimlane; + if (swimlaneProps.index in state4.swimlanes) { + swimlane = state4.swimlanes[swimlaneProps.index]; + } else { + swimlane = { + index: swimlaneProps.index, + label: swimlaneProps.label, + r: 0, + y: swimlaneProps.index * diagramProps.swimlaneMinHeight + diagramProps.swimlaneGap, + height: diagramProps.swimlaneMinHeight, + maxHeight: diagramProps.swimlaneMinHeight + }; + } + const lastBox = state4.boxes.length > 0 ? state4.boxes[state4.boxes.length - 1] : void 0; + const previousSwimlane = state4.previousSwimlaneNumber !== void 0 ? state4.swimlanes[state4.previousSwimlaneNumber] : void 0; + const dimension = { + width: Math.max( + diagramProps.boxMinWidth, + Math.min(diagramProps.boxMaxWidth, event3.dimension.width) + ) + 2 * diagramProps.boxPadding, + height: Math.max( + diagramProps.boxMinHeight, + Math.min(diagramProps.boxMaxHeight, event3.dimension.height) + ) + 2 * diagramProps.boxPadding + }; + const x5 = calculateX(swimlane, previousSwimlane, lastBox); + const r2 = x5 + dimension.width + diagramProps.boxPadding; + const maxR = calculateMaxRight(Object.values(state4.swimlanes), r2); + swimlane.r = x5 + dimension.width; + swimlane.maxHeight = Math.max(swimlane.maxHeight, dimension.height); + swimlane.height = Math.max(diagramProps.swimlaneMinHeight, swimlane.maxHeight) + 2 * diagramProps.swimlanePadding; + const box = { + x: x5, + y: diagramProps.swimlanePadding + swimlane.y, + // y: diagramProps.swimlanePadding + (swimlane.y || diagramProps.boxDefaultY), + r: r2, + dimension, + leftSibling: false, + swimlane, + visual: event3.visual, + text: event3.textProps.content, + frame: event3.frame, + index: event3.index + }; + const newState2 = { + ...state4, + boxes: [...state4.boxes, box], + swimlanes: { + ...state4.swimlanes, + [`${swimlane.index}`]: swimlane + }, + previousSwimlaneNumber: swimlaneProps.index, + previousFrame: event3.frame, + maxR + }; + const swimlanes = sortedSwimlanesArray(newState2.swimlanes); + if (swimlanes.length > 0) { + swimlanes[0].y = 0; + } + for (let i2 = 1; i2 < swimlanes.length; i2++) { + const sw = swimlanes[i2]; + const prevSw = swimlanes[i2 - 1]; + sw.y = prevSw.y + prevSw.height + diagramProps.swimlaneGap; + } + return newState2; + } + function isFirstFrame(index, frame2) { + if (index === 0 && frame2.sourceFrames.length === 0) { + return true; + } + return false; + } + function hasSourceFrame(frame2) { + return frame2.sourceFrames !== void 0 && frame2.sourceFrames !== null && frame2.sourceFrames.length > 0; + } + function findBoxByFrame(boxes, frame2) { + if (frame2 === void 0 || frame2 === null) { + return void 0; + } + return boxes.find((box) => box.frame.name === frame2.name); + } + function findBoxByLineIndex(boxes, targetSwimlane, lineIndex) { + if (lineIndex < 0) { + return void 0; + } + for (let i2 = lineIndex; i2 >= 0; i2--) { + const box = boxes[i2]; + if (box.swimlane.index !== targetSwimlane) { + return box; + } + } + return void 0; + } + function decidePositionRelation(state4, _command) { + const command = _command; + if (isEmResetFrame(command.frame) || isFirstFrame(command.index, command.frame)) { + return []; + } + const targetBox = findBoxByFrame(state4.boxes, command.frame); + if (targetBox === void 0) { + throw new Error(`Target box not found for frame ${command.frame.name}`); + } + let sourceBox; + if (command.sourceFrame) { + sourceBox = findBoxByFrame(state4.boxes, command.sourceFrame); + } else { + sourceBox = findBoxByLineIndex(state4.boxes, targetBox.swimlane.index, command.index - 1); + } + if (sourceBox === void 0) { + return []; + } + const event3 = { + $kind: RelationPositionedKind, + frame: command.frame, + index: command.index, + sourceBox, + targetBox + }; + return [event3]; + } + function evolveRelationPositioned(state4, _event) { + const event3 = _event; + const relation = { + visual: { + fill: "none", + stroke: "#000" + }, + source: { + x: event3.sourceBox.x, + y: event3.sourceBox.y + }, + target: { + x: event3.targetBox.x, + y: event3.targetBox.y + }, + sourceBox: event3.sourceBox, + targetBox: event3.targetBox + }; + const newState2 = { + ...state4, + relations: [...state4.relations, relation] + }; + return newState2; + } + function decide(state4, command) { + const fn3 = deciders[command.$kind]; + if (fn3 === void 0 || fn3 === null) { + return []; + } + const events = fn3(state4, command); + log.debug(`decided events`, events); + return events; + } + function evolve(state4, events) { + const newState2 = events.reduce((previousState, event3) => { + const fn3 = evolvers[event3.$kind]; + if (fn3 === void 0 || fn3 === null) { + return previousState; + } + return fn3(previousState, event3); + }, state4); + log.debug(`evolve events`, { state: state4, newState: newState2, events }); + return newState2; + } + function dispatch2(state4, command) { + const events = decide(state4, command); + const newState2 = evolve(state4, events); + return newState2; + } + var setOptions8, getOptions3, clear20, DEFAULT_EVENTMODELING_CONFIG, getConfig7, store, diagramProps, initial, deciders, evolvers, db8; + var init_db4 = __esm({ + "src/diagrams/eventmodeling/db.ts"() { + "use strict"; + init_logger(); + init_utils2(); + init_utils2(); + init_config(); + init_commonDb(); + init_common(); + init_defaultConfig(); + init_mermaid_parser_core(); + init_types(); + setOptions8 = /* @__PURE__ */ __name(function(_rawOptString) { + log.debug("options str", _rawOptString); + }, "setOptions"); + getOptions3 = /* @__PURE__ */ __name(function() { + return {}; + }, "getOptions"); + clear20 = /* @__PURE__ */ __name(function() { + reset4(); + clear(); + }, "clear"); + __name(reset4, "reset"); + DEFAULT_EVENTMODELING_CONFIG = defaultConfig_default.eventmodeling; + getConfig7 = /* @__PURE__ */ __name(() => { + const config5 = cleanAndMerge({ + ...DEFAULT_EVENTMODELING_CONFIG, + ...getConfig().eventmodeling + }); + return config5; + }, "getConfig"); + store = {}; + __name(getState, "getState"); + __name(setAst, "setAst"); + diagramProps = { + swimlaneMinHeight: 70, + swimlanePadding: 15, + swimlaneGap: 10, + boxPadding: 10, + boxOverlap: 90, + boxDefaultY: 0, + boxMinWidth: 80, + boxMaxWidth: 450, + boxMinHeight: 80, + boxMaxHeight: 750, + contentStartX: 250, + textMaxWidth: 450 - 2 * 10, + boxTextFontWeight: "bold", + boxTextPadding: 10, + swimlaneTextFontWeight: "bold", + labelUiAutomation: "UI/Automation", + labelUiAutomationPrefix: "UI/A: ", + labelCommandReadModel: "Command/Read Model", + labelCommandReadModelPrefix: "C/RM: ", + labelEvents: "Events", + labelEventsPrefix: "Stream: " + }; + __name(getDiagramProps, "getDiagramProps"); + initial = { + boxes: [], + swimlanes: {}, + relations: [], + maxR: 0, + sortedSwimlanesArray: [] + }; + __name(extractNamespace, "extractNamespace"); + __name(extractName, "extractName"); + __name(findSwimlaneByNamespace, "findSwimlaneByNamespace"); + __name(findNextAvailableIndex, "findNextAvailableIndex"); + __name(calculateSwimlaneProps, "calculateSwimlaneProps"); + __name(calculateEntityVisualProps, "calculateEntityVisualProps"); + __name(calculateTextProps, "calculateTextProps"); + __name(decidePositionFrame, "decidePositionFrame"); + __name(calculateX, "calculateX"); + __name(calculateMaxRight, "calculateMaxRight"); + __name(sortedSwimlanesArray, "sortedSwimlanesArray"); + __name(evolveFramePositioned, "evolveFramePositioned"); + __name(isFirstFrame, "isFirstFrame"); + __name(hasSourceFrame, "hasSourceFrame"); + __name(findBoxByFrame, "findBoxByFrame"); + __name(findBoxByLineIndex, "findBoxByLineIndex"); + __name(decidePositionRelation, "decidePositionRelation"); + __name(evolveRelationPositioned, "evolveRelationPositioned"); + deciders = { + [PositionFrameKind]: decidePositionFrame, + [PositionRelationKind]: decidePositionRelation + }; + evolvers = { + [FramePositionedKind]: evolveFramePositioned, + [RelationPositionedKind]: evolveRelationPositioned + }; + __name(decide, "decide"); + __name(evolve, "evolve"); + __name(dispatch2, "dispatch"); + db8 = { + getConfig: getConfig7, + setOptions: setOptions8, + getOptions: getOptions3, + clear: clear20, + setAccTitle, + getAccTitle, + getAccDescription, + setAccDescription, + setDiagramTitle, + getDiagramTitle, + setAst, + getDiagramProps, + getState + }; + } + }); + + // src/diagrams/eventmodeling/parser.ts + var parser24; + var init_parser4 = __esm({ + "src/diagrams/eventmodeling/parser.ts"() { + "use strict"; + init_mermaid_parser_core(); + init_logger(); + init_populateCommonDb(); + init_db4(); + parser24 = { + parse: /* @__PURE__ */ __name(async (input) => { + const ast = await parse3("eventmodeling", input); + log.debug(ast); + db8.setAst(ast); + populateCommonDb(ast, db8); + }, "parse") + }; + if (void 0) { + const { it, expect, describe } = void 0; + describe("EventModeling Parser", () => { + it("should parse simple model", () => { + const result = parser24.parse(`eventmodeling + tf 01 evt Start + + `); + expect(result !== void 0); + }); + }); + } + } + }); + + // src/diagrams/eventmodeling/renderer.ts + function renderD3Box(diagram32, diagramProps2) { + return (box) => { + const y6 = box.swimlane.y + diagramProps2.swimlanePadding; + const g2 = diagram32.append("g").attr("class", "em-box"); + g2.append("rect").attr("x", box.x).attr("y", y6).attr("rx", "3").attr("width", box.dimension.width).attr("height", box.dimension.height).attr("stroke", box.visual.stroke).attr("fill", box.visual.fill); + const f2 = g2.append("foreignObject").attr("x", box.x + diagramProps2.boxPadding).attr("y", y6 + 10).attr("width", box.dimension.width - 2 * diagramProps2.boxPadding).attr("height", box.dimension.height - 2 * diagramProps2.boxPadding); + const text4 = f2.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + text4.append("span").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").html(box.text); + }; + } + function dirUpwards(sourceY, targetY) { + return sourceY > targetY; + } + function renderD3Relation(diagram32, diagramProps2, arrowheadId, themeVariables) { + return (relation) => { + const sourceBoxY = relation.sourceBox.swimlane.y + diagramProps2.swimlanePadding; + const targetBoxY = relation.targetBox.swimlane.y + diagramProps2.swimlanePadding; + const upwards = dirUpwards(sourceBoxY, targetBoxY); + const sourceX = relation.sourceBox.x + relation.sourceBox.dimension.width * 2 / 3; + const targetX = relation.targetBox.x + relation.targetBox.dimension.width / 3; + let sourceY; + let targetY; + log.debug(`rendering relation up=${upwards} for `, { + sourceBox: relation.sourceBox, + targetBox: relation.targetBox + }); + if (upwards) { + sourceY = sourceBoxY; + targetY = targetBoxY + relation.targetBox.dimension.height; + } else { + sourceY = sourceBoxY + relation.sourceBox.dimension.height; + targetY = targetBoxY; + } + const relationStroke = themeVariables.emRelationStroke ?? relation.visual.stroke; + diagram32.append("path").attr("class", "em-relation").attr("fill", relation.visual.fill).attr("stroke", relationStroke).attr("stroke-width", "1").attr("marker-end", `url(#${arrowheadId})`).attr("d", `M${sourceX} ${sourceY} L${targetX} ${targetY}`); + }; + } + function renderD3Swimlane(diagram32, maxR, diagramProps2, themeVariables) { + return (swimlane) => { + const g2 = diagram32.append("g").attr("class", "em-swimlane"); + const oddBackground = themeVariables.emSwimlaneBackgroundOdd ?? "rgb(250,250,250)"; + const backgroundStroke = themeVariables.emSwimlaneBackgroundStroke ?? "rgb(240,240,240)"; + g2.append("rect").attr("x", 0).attr("y", swimlane.y).attr("rx", "3").attr("width", maxR + diagramProps2.swimlanePadding).attr("height", swimlane.height).attr("fill", oddBackground).attr("stroke", backgroundStroke); + g2.append("text").attr("font-weight", diagramProps2.swimlaneTextFontWeight).attr("x", 30).attr("y", swimlane.y + 30).text(swimlane.label); + }; + } + var DEFAULT_CONFIG, DEFAULT_EVENTMODELING_CONFIG2, draw27, renderer_default2; + var init_renderer4 = __esm({ + "src/diagrams/eventmodeling/renderer.ts"() { + "use strict"; + init_src32(); + init_diagramAPI(); + init_logger(); + DEFAULT_CONFIG = getConfig2(); + DEFAULT_EVENTMODELING_CONFIG2 = DEFAULT_CONFIG?.eventmodeling; + __name(renderD3Box, "renderD3Box"); + __name(dirUpwards, "dirUpwards"); + __name(renderD3Relation, "renderD3Relation"); + __name(renderD3Swimlane, "renderD3Swimlane"); + draw27 = /* @__PURE__ */ __name(function(txt, id35, ver, diagObj) { + log.debug("in eventmodeling renderer", txt + "\n", "id:", id35, ver); + if (!DEFAULT_EVENTMODELING_CONFIG2) { + throw new Error("EventModeling config not found"); + } + const db10 = diagObj.db; + const { themeVariables, eventmodeling: config5 } = getConfig2(); + const diagram32 = select_default2(`[id="${id35}"]`); + const diagramProps2 = db10.getDiagramProps(); + const state4 = db10.getState(); + const arrowheadId = `em-arrowhead-${id35}`; + const arrowheadColor = themeVariables.emArrowhead ?? "#000000"; + state4.sortedSwimlanesArray.forEach( + renderD3Swimlane(diagram32, state4.maxR, diagramProps2, themeVariables) + ); + state4.boxes.forEach(renderD3Box(diagram32, diagramProps2)); + state4.relations.forEach(renderD3Relation(diagram32, diagramProps2, arrowheadId, themeVariables)); + const marker = diagram32.append("defs").append("marker").attr("id", arrowheadId).attr("markerWidth", "10").attr("markerHeight", "7").attr("refX", "10").attr("refY", "3.5").attr("orient", "auto"); + marker.append("polygon").attr("points", "0 0, 10 3.5, 0 7").attr("fill", arrowheadColor); + setupGraphViewbox2(void 0, diagram32, config5?.padding ?? 30, config5?.useMaxWidth); + }, "draw"); + renderer_default2 = { + draw: draw27 + }; + } + }); + + // src/diagrams/eventmodeling/styles.js + var getStyles19, styles_default18; + var init_styles20 = __esm({ + "src/diagrams/eventmodeling/styles.js"() { + "use strict"; + getStyles19 = /* @__PURE__ */ __name((_options) => ``, "getStyles"); + styles_default18 = getStyles19; + } + }); + + // src/diagrams/eventmodeling/diagram.ts + var diagram_exports4 = {}; + __export(diagram_exports4, { + diagram: () => diagram27 + }); + var diagram27; + var init_diagram4 = __esm({ + "src/diagrams/eventmodeling/diagram.ts"() { + "use strict"; + init_parser4(); + init_db4(); + init_renderer4(); + init_styles20(); + diagram27 = { + parser: parser24, + db: db8, + renderer: renderer_default2, + styles: styles_default18 + }; + } + }); + + // src/diagrams/ishikawa/parser/ishikawa.jison + var parser25, ishikawa_default; + var init_ishikawa = __esm({ + "src/diagrams/ishikawa/parser/ishikawa.jison"() { + "use strict"; + parser25 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [1, 4], $V1 = [1, 14], $V2 = [1, 12], $V3 = [1, 13], $V4 = [6, 7, 8], $V5 = [1, 20], $V6 = [1, 18], $V7 = [1, 19], $V8 = [6, 7, 11], $V9 = [1, 6, 13, 14], $Va = [1, 23], $Vb = [1, 24], $Vc = [1, 6, 7, 11, 13, 14]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "ishikawa": 4, "spaceLines": 5, "SPACELINE": 6, "NL": 7, "ISHIKAWA": 8, "document": 9, "stop": 10, "EOF": 11, "statement": 12, "SPACELIST": 13, "TEXT": 14, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "ISHIKAWA", 11: "EOF", 13: "SPACELIST", 14: "TEXT" }, + productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 1], [12, 1], [12, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 6: + case 7: + return yy; + break; + case 15: + yy.addNode($$[$0 - 1].length, $$[$0].trim()); + break; + case 16: + yy.addNode(0, $$[$0].trim()); + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: $V0 }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: $V0 }, { 6: $V1, 7: [1, 10], 9: 9, 12: 11, 13: $V2, 14: $V3 }, o2($V4, [2, 3]), { 1: [2, 2] }, o2($V4, [2, 4]), o2($V4, [2, 5]), { 1: [2, 6], 6: $V1, 12: 15, 13: $V2, 14: $V3 }, { 6: $V1, 9: 16, 12: 11, 13: $V2, 14: $V3 }, { 6: $V5, 7: $V6, 10: 17, 11: $V7 }, o2($V8, [2, 18], { 14: [1, 21] }), o2($V8, [2, 16]), o2($V8, [2, 17]), { 6: $V5, 7: $V6, 10: 22, 11: $V7 }, { 1: [2, 7], 6: $V1, 12: 15, 13: $V2, 14: $V3 }, o2($V9, [2, 14], { 7: $Va, 11: $Vb }), o2($Vc, [2, 8]), o2($Vc, [2, 9]), o2($Vc, [2, 10]), o2($V8, [2, 15]), o2($V9, [2, 13], { 7: $Va, 11: $Vb }), o2($Vc, [2, 11]), o2($Vc, [2, 12])], + defaultActions: { 2: [2, 1], 6: [2, 2] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + return 6; + break; + case 1: + return 8; + break; + case 2: + return 8; + break; + case 3: + return 6; + break; + case 4: + return 7; + break; + case 5: + return 13; + break; + case 6: + return 14; + break; + case 7: + return 11; + break; + } + }, "anonymous"), + rules: [/^(?:\s*%%.*)/i, /^(?:ishikawa-beta\b)/i, /^(?:ishikawa\b)/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:[^\n]+)/i, /^(?:$)/i], + conditions: { "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser25.parser = parser25; + ishikawa_default = parser25; + } + }); + + // src/diagrams/ishikawa/ishikawaDb.ts + var IshikawaDB; + var init_ishikawaDb = __esm({ + "src/diagrams/ishikawa/ishikawaDb.ts"() { + "use strict"; + init_diagramAPI(); + init_common(); + init_commonDb(); + IshikawaDB = class { + constructor() { + this.stack = []; + this.clear = this.clear.bind(this); + this.addNode = this.addNode.bind(this); + this.getRoot = this.getRoot.bind(this); + } + static { + __name(this, "IshikawaDB"); + } + clear() { + this.root = void 0; + this.stack = []; + this.baseLevel = void 0; + clear(); + } + getRoot() { + return this.root; + } + addNode(rawLevel, text4) { + const label = common_default.sanitizeText(text4, getConfig2()); + if (!this.root) { + this.root = { text: label, children: [] }; + this.stack = [{ level: 0, node: this.root }]; + setDiagramTitle(label); + return; + } + this.baseLevel ??= rawLevel; + let level = rawLevel - this.baseLevel + 1; + if (level <= 0) { + level = 1; + } + while (this.stack.length > 1 && this.stack[this.stack.length - 1].level >= level) { + this.stack.pop(); + } + const parent4 = this.stack[this.stack.length - 1].node; + const node2 = { text: label, children: [] }; + parent4.children.push(node2); + this.stack.push({ level, node: node2 }); + } + getAccTitle() { + return getAccTitle(); + } + setAccTitle(title2) { + setAccTitle(title2); + } + getAccDescription() { + return getAccDescription(); + } + setAccDescription(description) { + setAccDescription(description); + } + getDiagramTitle() { + return getDiagramTitle(); + } + setDiagramTitle(title2) { + setDiagramTitle(title2); + } + }; + } + }); + + // src/diagrams/ishikawa/ishikawaRenderer.ts + var FONT_SIZE_DEFAULT, SPINE_BASE_LENGTH, BONE_STUB, BONE_BASE, BONE_PER_CHILD, ANGLE, COS_A, SIN_A, applyPaddedViewBox, draw28, sideStats, drawHead, flattenTree, drawCauseLabel, drawArrowMarker, drawBranch, splitLines, wrapText, drawMultilineText, lerp, drawLine, renderer10; + var init_ishikawaRenderer = __esm({ + "src/diagrams/ishikawa/ishikawaRenderer.ts"() { + "use strict"; + init_diagramAPI(); + init_selectSvgElement(); + init_setupGraphViewbox(); + init_utils2(); + init_rough_esm(); + FONT_SIZE_DEFAULT = 14; + SPINE_BASE_LENGTH = 250; + BONE_STUB = 30; + BONE_BASE = 60; + BONE_PER_CHILD = 5; + ANGLE = 82 * Math.PI / 180; + COS_A = Math.cos(ANGLE); + SIN_A = Math.sin(ANGLE); + applyPaddedViewBox = /* @__PURE__ */ __name((svgEl, pad3, maxW) => { + const bbox = svgEl.node().getBBox(); + const w4 = bbox.width + pad3 * 2; + const h3 = bbox.height + pad3 * 2; + configureSvgSize(svgEl, h3, w4, maxW); + svgEl.attr("viewBox", `${bbox.x - pad3} ${bbox.y - pad3} ${w4} ${h3}`); + }, "applyPaddedViewBox"); + draw28 = /* @__PURE__ */ __name((_text, id35, _version, diagram32) => { + const db10 = diagram32.db; + const root4 = db10.getRoot(); + if (!root4) { + return; + } + const drawConfig = getConfig2(); + const { look, handDrawnSeed, themeVariables } = drawConfig; + const fontSize = parseFontSize(drawConfig.fontSize)[0] ?? FONT_SIZE_DEFAULT; + const isHandDrawn = look === "handDrawn"; + const causes = root4.children ?? []; + const padding2 = drawConfig.ishikawa?.diagramPadding ?? 20; + const useMaxWidth = drawConfig.ishikawa?.useMaxWidth ?? false; + const svg2 = selectSvgElement(id35); + const g2 = svg2.append("g").attr("class", "ishikawa"); + const roughSvg = isHandDrawn ? at.svg(svg2.node()) : void 0; + const roughContext = roughSvg ? { + roughSvg, + seed: handDrawnSeed ?? 0, + lineColor: themeVariables?.lineColor ?? "#333", + fillColor: themeVariables?.mainBkg ?? "#fff" + } : void 0; + const markerId = `ishikawa-arrow-${id35}`; + if (!isHandDrawn) { + g2.append("defs").append("marker").attr("id", markerId).attr("viewBox", "0 0 10 10").attr("refX", 0).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 Z").attr("class", "ishikawa-arrow"); + } + let spineX = 0; + let spineY = SPINE_BASE_LENGTH; + const spineLine = isHandDrawn ? void 0 : drawLine(g2, spineX, spineY, spineX, spineY, "ishikawa-spine"); + drawHead(g2, spineX, spineY, root4.text, fontSize, roughContext); + if (!causes.length) { + if (isHandDrawn) { + drawLine(g2, spineX, spineY, spineX, spineY, "ishikawa-spine", roughContext); + } + applyPaddedViewBox(svg2, padding2, useMaxWidth); + return; + } + spineX -= 20; + const upperCauses = causes.filter((_3, i2) => i2 % 2 === 0); + const lowerCauses = causes.filter((_3, i2) => i2 % 2 === 1); + const upperStats = sideStats(upperCauses); + const lowerStats = sideStats(lowerCauses); + const descendantTotal = upperStats.total + lowerStats.total; + let upperLen = SPINE_BASE_LENGTH; + let lowerLen = SPINE_BASE_LENGTH; + if (descendantTotal > 0) { + const pool = SPINE_BASE_LENGTH * 2; + const minLen = SPINE_BASE_LENGTH * 0.3; + upperLen = Math.max(minLen, pool * (upperStats.total / descendantTotal)); + lowerLen = Math.max(minLen, pool * (lowerStats.total / descendantTotal)); + } + const minSpacing = fontSize * 2; + upperLen = Math.max(upperLen, upperStats.max * minSpacing); + lowerLen = Math.max(lowerLen, lowerStats.max * minSpacing); + spineY = Math.max(upperLen, SPINE_BASE_LENGTH); + if (spineLine) { + spineLine.attr("y1", spineY).attr("y2", spineY); + } + g2.select(".ishikawa-head-group").attr("transform", `translate(0,${spineY})`); + const pairCount = Math.ceil(causes.length / 2); + for (let p3 = 0; p3 < pairCount; p3++) { + const pg = g2.append("g").attr("class", "ishikawa-pair"); + for (const [cause, dir2, len] of [ + [causes[p3 * 2], -1, upperLen], + [causes[p3 * 2 + 1], 1, lowerLen] + ]) { + if (cause) { + drawBranch(pg, cause, spineX, spineY, dir2, len, fontSize, roughContext); + } + } + spineX = pg.selectAll("text").nodes().reduce((left3, n2) => Math.min(left3, n2.getBBox().x), Infinity); + } + if (isHandDrawn) { + drawLine(g2, spineX, spineY, 0, spineY, "ishikawa-spine", roughContext); + } else { + spineLine.attr("x1", spineX); + const markerUrl = `url(#${markerId})`; + g2.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start", markerUrl); + } + applyPaddedViewBox(svg2, padding2, useMaxWidth); + }, "draw"); + sideStats = /* @__PURE__ */ __name((nodes5) => { + const countDescendants = /* @__PURE__ */ __name((node2) => node2.children.reduce((sum2, child) => sum2 + 1 + countDescendants(child), 0), "countDescendants"); + return nodes5.reduce( + (stats, node2) => { + const descendants3 = countDescendants(node2); + stats.total += descendants3; + stats.max = Math.max(stats.max, descendants3); + return stats; + }, + { total: 0, max: 0 } + ); + }, "sideStats"); + drawHead = /* @__PURE__ */ __name((svg2, x5, y6, label, fontSize, roughContext) => { + const maxChars = Math.max(6, Math.floor(110 / (fontSize * 0.6))); + const headGroup = svg2.append("g").attr("class", "ishikawa-head-group").attr("transform", `translate(${x5},${y6})`); + const textEl = drawMultilineText( + headGroup, + wrapText(label, maxChars), + 0, + 0, + "ishikawa-head-label", + "start", + fontSize + ); + const tb = textEl.node().getBBox(); + const w4 = Math.max(60, tb.width + 6); + const h3 = Math.max(40, tb.height * 2 + 40); + const headPath = `M 0 ${-h3 / 2} L 0 ${h3 / 2} Q ${w4 * 2.4} 0 0 ${-h3 / 2} Z`; + if (roughContext) { + const roughNode = roughContext.roughSvg.path(headPath, { + roughness: 1.5, + seed: roughContext.seed, + fill: roughContext.fillColor, + fillStyle: "hachure", + fillWeight: 2.5, + hachureGap: 5, + stroke: roughContext.lineColor, + strokeWidth: 2 + }); + headGroup.insert(() => roughNode, ":first-child").attr("class", "ishikawa-head"); + } else { + headGroup.insert("path", ":first-child").attr("class", "ishikawa-head").attr("d", headPath); + } + textEl.attr("transform", `translate(${(w4 - tb.width) / 2 - tb.x + 3},${-tb.y - tb.height / 2})`); + }, "drawHead"); + flattenTree = /* @__PURE__ */ __name((children2, direction2) => { + const entries2 = []; + const yOrder = []; + const walk = /* @__PURE__ */ __name((nodes5, pid, depth) => { + const ordered = direction2 === -1 ? [...nodes5].reverse() : nodes5; + for (const child of ordered) { + const idx = entries2.length; + const gc2 = child.children ?? []; + entries2.push({ + depth, + text: wrapText(child.text, 15), + parentIndex: pid, + childCount: gc2.length + }); + if (depth % 2 === 0) { + yOrder.push(idx); + if (gc2.length) { + walk(gc2, idx, depth + 1); + } + } else { + if (gc2.length) { + walk(gc2, idx, depth + 1); + } + yOrder.push(idx); + } + } + }, "walk"); + walk(children2, -1, 2); + return { entries: entries2, yOrder }; + }, "flattenTree"); + drawCauseLabel = /* @__PURE__ */ __name((svg2, text4, x5, y6, direction2, fontSize, roughContext) => { + const lg = svg2.append("g").attr("class", "ishikawa-label-group"); + const lt = drawMultilineText( + lg, + text4, + x5, + y6 + 11 * direction2, + "ishikawa-label cause", + "middle", + fontSize + ); + const tb = lt.node().getBBox(); + if (roughContext) { + const roughNode = roughContext.roughSvg.rectangle( + tb.x - 20, + tb.y - 2, + tb.width + 40, + tb.height + 4, + { + roughness: 1.5, + seed: roughContext.seed, + fill: roughContext.fillColor, + fillStyle: "hachure", + fillWeight: 2.5, + hachureGap: 5, + stroke: roughContext.lineColor, + strokeWidth: 2 + } + ); + lg.insert(() => roughNode, ":first-child").attr("class", "ishikawa-label-box"); + } else { + lg.insert("rect", ":first-child").attr("class", "ishikawa-label-box").attr("x", tb.x - 20).attr("y", tb.y - 2).attr("width", tb.width + 40).attr("height", tb.height + 4); + } + }, "drawCauseLabel"); + drawArrowMarker = /* @__PURE__ */ __name((g2, x5, y6, dx, dy, roughContext) => { + const len = Math.sqrt(dx * dx + dy * dy); + if (len === 0) { + return; + } + const ux = dx / len; + const uy = dy / len; + const s2 = 6; + const px = -uy * s2; + const py = ux * s2; + const tipX = x5; + const tipY = y6; + const d3 = `M ${tipX} ${tipY} L ${tipX - ux * s2 * 2 + px} ${tipY - uy * s2 * 2 + py} L ${tipX - ux * s2 * 2 - px} ${tipY - uy * s2 * 2 - py} Z`; + const roughNode = roughContext.roughSvg.path(d3, { + roughness: 1, + seed: roughContext.seed, + fill: roughContext.lineColor, + fillStyle: "solid", + stroke: roughContext.lineColor, + strokeWidth: 1 + }); + g2.append(() => roughNode); + }, "drawArrowMarker"); + drawBranch = /* @__PURE__ */ __name((svg2, node2, startX2, startY2, direction2, length2, fontSize, roughContext) => { + const children2 = node2.children ?? []; + const lineLen = length2 * (children2.length ? 1 : 0.2); + const dx = -COS_A * lineLen; + const dy = SIN_A * lineLen * direction2; + const endX = startX2 + dx; + const endY = startY2 + dy; + drawLine(svg2, startX2, startY2, endX, endY, "ishikawa-branch", roughContext); + if (roughContext) { + drawArrowMarker(svg2, startX2, startY2, startX2 - endX, startY2 - endY, roughContext); + } + drawCauseLabel(svg2, node2.text, endX, endY, direction2, fontSize, roughContext); + if (!children2.length) { + return; + } + const { entries: entries2, yOrder } = flattenTree(children2, direction2); + const entryCount = entries2.length; + const ys = new Array(entryCount); + for (const [slot, entryIdx] of yOrder.entries()) { + ys[entryIdx] = startY2 + dy * ((slot + 1) / (entryCount + 1)); + } + const bones = /* @__PURE__ */ new Map(); + bones.set(-1, { + x0: startX2, + y0: startY2, + x1: endX, + y1: endY, + childCount: children2.length, + childrenDrawn: 0 + }); + const diagonalX = -COS_A; + const diagonalY = SIN_A * direction2; + const oddLabel = direction2 < 0 ? "ishikawa-label up" : "ishikawa-label down"; + for (const [i2, e3] of entries2.entries()) { + const y6 = ys[i2]; + const par = bones.get(e3.parentIndex); + const grp = svg2.append("g").attr("class", "ishikawa-sub-group"); + let bx0 = 0; + let by0 = 0; + let bx1 = 0; + if (e3.depth % 2 === 0) { + const dyP = par.y1 - par.y0; + bx0 = lerp(par.x0, par.x1, dyP ? (y6 - par.y0) / dyP : 0.5); + by0 = y6; + bx1 = bx0 - (e3.childCount > 0 ? BONE_BASE + e3.childCount * BONE_PER_CHILD : BONE_STUB); + drawLine(grp, bx0, y6, bx1, y6, "ishikawa-sub-branch", roughContext); + if (roughContext) { + drawArrowMarker(grp, bx0, y6, 1, 0, roughContext); + } + drawMultilineText(grp, e3.text, bx1, y6, "ishikawa-label align", "end", fontSize); + } else { + const k2 = par.childrenDrawn++; + bx0 = lerp(par.x0, par.x1, (par.childCount - k2) / (par.childCount + 1)); + by0 = par.y0; + bx1 = bx0 + diagonalX * ((y6 - by0) / diagonalY); + drawLine(grp, bx0, by0, bx1, y6, "ishikawa-sub-branch", roughContext); + if (roughContext) { + drawArrowMarker(grp, bx0, by0, bx0 - bx1, by0 - y6, roughContext); + } + drawMultilineText(grp, e3.text, bx1, y6, oddLabel, "end", fontSize); + } + if (e3.childCount > 0) { + bones.set(i2, { + x0: bx0, + y0: by0, + x1: bx1, + y1: y6, + childCount: e3.childCount, + childrenDrawn: 0 + }); + } + } + }, "drawBranch"); + splitLines = /* @__PURE__ */ __name((text4) => text4.split(/|\n/), "splitLines"); + wrapText = /* @__PURE__ */ __name((text4, maxChars) => { + if (text4.length <= maxChars) { + return text4; + } + const lines = []; + for (const word of text4.split(/\s+/)) { + const last4 = lines.length - 1; + if (last4 >= 0 && lines[last4].length + 1 + word.length <= maxChars) { + lines[last4] += " " + word; + } else { + lines.push(word); + } + } + return lines.join("\n"); + }, "wrapText"); + drawMultilineText = /* @__PURE__ */ __name((g2, text4, x5, y6, cls, anchor2, fontSize) => { + const lines = splitLines(text4); + const lh = fontSize * 1.05; + const el = g2.append("text").attr("class", cls).attr("text-anchor", anchor2).attr("x", x5).attr("y", y6 - (lines.length - 1) * lh / 2); + for (const [i2, line2] of lines.entries()) { + el.append("tspan").attr("x", x5).attr("dy", i2 === 0 ? 0 : lh).text(line2); + } + return el; + }, "drawMultilineText"); + lerp = /* @__PURE__ */ __name((a2, b3, t4) => a2 + (b3 - a2) * t4, "lerp"); + drawLine = /* @__PURE__ */ __name((g2, x1, y1, x22, y22, cls, roughContext) => { + if (roughContext) { + const roughNode = roughContext.roughSvg.line(x1, y1, x22, y22, { + roughness: 1.5, + seed: roughContext.seed, + stroke: roughContext.lineColor, + strokeWidth: 2 + }); + g2.append(() => roughNode).attr("class", cls); + return void 0; + } + return g2.append("line").attr("class", cls).attr("x1", x1).attr("y1", y1).attr("x2", x22).attr("y2", y22); + }, "drawLine"); + renderer10 = { draw: draw28 }; + } + }); + + // src/diagrams/ishikawa/ishikawaStyles.ts + var getStyles20, ishikawaStyles_default; + var init_ishikawaStyles = __esm({ + "src/diagrams/ishikawa/ishikawaStyles.ts"() { + "use strict"; + getStyles20 = /* @__PURE__ */ __name((options2) => ` +.ishikawa .ishikawa-spine, +.ishikawa .ishikawa-branch, +.ishikawa .ishikawa-sub-branch { + stroke: ${options2.lineColor}; + stroke-width: 2; + fill: none; +} + +.ishikawa .ishikawa-sub-branch { + stroke-width: 1; +} + +.ishikawa .ishikawa-arrow { + fill: ${options2.lineColor}; +} + +.ishikawa .ishikawa-head { + fill: ${options2.mainBkg}; + stroke: ${options2.lineColor}; + stroke-width: 2; +} + +.ishikawa .ishikawa-label-box { + fill: ${options2.mainBkg}; + stroke: ${options2.lineColor}; + stroke-width: 2; +} + +.ishikawa text { + font-family: ${options2.fontFamily}; + font-size: ${options2.fontSize}; + fill: ${options2.textColor}; +} + +.ishikawa .ishikawa-head-label { + font-weight: 600; + text-anchor: middle; + dominant-baseline: middle; + font-size: 14px; +} + +.ishikawa .ishikawa-label { + text-anchor: end; +} + +.ishikawa .ishikawa-label.cause { + text-anchor: middle; + dominant-baseline: middle; +} + +.ishikawa .ishikawa-label.align { + text-anchor: end; + dominant-baseline: middle; +} + +.ishikawa .ishikawa-label.up { + dominant-baseline: baseline; +} + +.ishikawa .ishikawa-label.down { + dominant-baseline: hanging; +} +`, "getStyles"); + ishikawaStyles_default = getStyles20; + } + }); + + // src/diagrams/ishikawa/ishikawaDiagram.ts + var ishikawaDiagram_exports = {}; + __export(ishikawaDiagram_exports, { + diagram: () => diagram28 + }); + var diagram28; + var init_ishikawaDiagram = __esm({ + "src/diagrams/ishikawa/ishikawaDiagram.ts"() { + "use strict"; + init_ishikawa(); + init_ishikawaDb(); + init_ishikawaRenderer(); + init_ishikawaStyles(); + diagram28 = { + parser: ishikawa_default, + get db() { + return new IshikawaDB(); + }, + renderer: renderer10, + styles: ishikawaStyles_default + }; + } + }); + + // src/diagrams/venn/parser/venn.jison + var parser26, venn_default; + var init_venn = __esm({ + "src/diagrams/venn/parser/venn.jison"() { + "use strict"; + parser26 = (function() { + var o2 = /* @__PURE__ */ __name(function(k2, v3, o3, l4) { + for (o3 = o3 || {}, l4 = k2.length; l4--; o3[k2[l4]] = v3) ; + return o3; + }, "o"), $V0 = [5, 8], $V1 = [7, 8, 11, 12, 17, 19, 22, 24], $V2 = [1, 17], $V3 = [1, 18], $V4 = [7, 8, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 27], $V5 = [1, 31], $V6 = [1, 39], $V7 = [7, 8, 11, 12, 17, 19, 22, 24, 27], $V8 = [1, 57], $V9 = [1, 56], $Va = [1, 58], $Vb = [1, 59], $Vc = [1, 60], $Vd = [7, 8, 11, 12, 16, 17, 19, 20, 22, 24, 27, 31, 32, 33]; + var parser29 = { + trace: /* @__PURE__ */ __name(function trace() { + }, "trace"), + yy: {}, + symbols_: { "error": 2, "start": 3, "optNewlines": 4, "VENN": 5, "document": 6, "EOF": 7, "NEWLINE": 8, "line": 9, "statement": 10, "TITLE": 11, "SET": 12, "identifier": 13, "BRACKET_LABEL": 14, "COLON": 15, "NUMERIC": 16, "UNION": 17, "identifierList": 18, "TEXT": 19, "IDENTIFIER": 20, "STRING": 21, "INDENT_TEXT": 22, "indentedTextTail": 23, "STYLE": 24, "stylesOpt": 25, "styleField": 26, "COMMA": 27, "styleValue": 28, "valueTokens": 29, "valueToken": 30, "HEXCOLOR": 31, "RGBCOLOR": 32, "RGBACOLOR": 33, "$accept": 0, "$end": 1 }, + terminals_: { 2: "error", 5: "VENN", 7: "EOF", 8: "NEWLINE", 11: "TITLE", 12: "SET", 14: "BRACKET_LABEL", 15: "COLON", 16: "NUMERIC", 17: "UNION", 19: "TEXT", 20: "IDENTIFIER", 21: "STRING", 22: "INDENT_TEXT", 24: "STYLE", 27: "COMMA", 31: "HEXCOLOR", 32: "RGBCOLOR", 33: "RGBACOLOR" }, + productions_: [0, [3, 4], [4, 0], [4, 2], [6, 0], [6, 2], [9, 1], [9, 1], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 2], [10, 3], [10, 4], [10, 5], [10, 3], [10, 3], [10, 3], [10, 4], [10, 4], [10, 2], [10, 3], [23, 1], [23, 1], [23, 1], [23, 2], [23, 2], [25, 1], [25, 3], [26, 3], [28, 1], [28, 1], [29, 1], [29, 2], [30, 1], [30, 1], [30, 1], [30, 1], [30, 1], [18, 1], [18, 3], [13, 1], [13, 1]], + performAction: /* @__PURE__ */ __name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 2: + case 3: + case 4: + this.$ = []; + break; + case 5: + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + break; + case 6: + this.$ = []; + break; + case 7: + case 22: + case 32: + case 36: + case 37: + case 38: + case 39: + case 40: + this.$ = $$[$0]; + break; + case 8: + yy.setDiagramTitle($$[$0].substr(6)); + this.$ = $$[$0].substr(6); + break; + case 9: + yy.addSubsetData([$$[$0]], void 0, void 0); + if (yy.setIndentMode) { + yy.setIndentMode(true); + } + break; + case 10: + yy.addSubsetData([$$[$0 - 1]], $$[$0], void 0); + if (yy.setIndentMode) { + yy.setIndentMode(true); + } + break; + case 11: + yy.addSubsetData([$$[$0 - 2]], void 0, parseFloat($$[$0])); + if (yy.setIndentMode) { + yy.setIndentMode(true); + } + break; + case 12: + yy.addSubsetData([$$[$0 - 3]], $$[$0 - 2], parseFloat($$[$0])); + if (yy.setIndentMode) { + yy.setIndentMode(true); + } + break; + case 13: + if ($$[$0].length < 2) { + throw new Error("union requires multiple identifiers"); + } + if (yy.validateUnionIdentifiers) { + yy.validateUnionIdentifiers($$[$0]); + } + yy.addSubsetData($$[$0], void 0, void 0); + if (yy.setIndentMode) { + yy.setIndentMode(true); + } + break; + case 14: + if ($$[$0 - 1].length < 2) { + throw new Error("union requires multiple identifiers"); + } + if (yy.validateUnionIdentifiers) { + yy.validateUnionIdentifiers($$[$0 - 1]); + } + yy.addSubsetData($$[$0 - 1], $$[$0], void 0); + if (yy.setIndentMode) { + yy.setIndentMode(true); + } + break; + case 15: + if ($$[$0 - 2].length < 2) { + throw new Error("union requires multiple identifiers"); + } + if (yy.validateUnionIdentifiers) { + yy.validateUnionIdentifiers($$[$0 - 2]); + } + yy.addSubsetData($$[$0 - 2], void 0, parseFloat($$[$0])); + if (yy.setIndentMode) { + yy.setIndentMode(true); + } + break; + case 16: + if ($$[$0 - 3].length < 2) { + throw new Error("union requires multiple identifiers"); + } + if (yy.validateUnionIdentifiers) { + yy.validateUnionIdentifiers($$[$0 - 3]); + } + yy.addSubsetData($$[$0 - 3], $$[$0 - 2], parseFloat($$[$0])); + if (yy.setIndentMode) { + yy.setIndentMode(true); + } + break; + case 17: + case 18: + case 19: + yy.addTextData($$[$0 - 1], $$[$0], void 0); + break; + case 20: + case 21: + yy.addTextData($$[$0 - 2], $$[$0 - 1], $$[$0]); + break; + case 23: + yy.addStyleData($$[$0 - 1], $$[$0]); + break; + case 24: + case 25: + case 26: + var cs = yy.getCurrentSets(); + if (!cs) throw new Error("text requires set"); + yy.addTextData(cs, $$[$0], void 0); + break; + case 27: + case 28: + var cs = yy.getCurrentSets(); + if (!cs) throw new Error("text requires set"); + yy.addTextData(cs, $$[$0 - 1], $$[$0]); + break; + case 29: + case 41: + this.$ = [$$[$0]]; + break; + case 30: + case 42: + this.$ = [...$$[$0 - 2], $$[$0]]; + break; + case 31: + this.$ = [$$[$0 - 2], $$[$0]]; + break; + case 33: + this.$ = $$[$0].join(" "); + break; + case 34: + this.$ = [$$[$0]]; + break; + case 35: + $$[$0 - 1].push($$[$0]); + this.$ = $$[$0 - 1]; + break; + case 43: + case 44: + this.$ = $$[$0]; + break; + } + }, "anonymous"), + table: [o2($V0, [2, 2], { 3: 1, 4: 2 }), { 1: [3] }, { 5: [1, 3], 8: [1, 4] }, o2($V1, [2, 4], { 6: 5 }), o2($V0, [2, 3]), { 7: [1, 6], 8: [1, 8], 9: 7, 10: 9, 11: [1, 10], 12: [1, 11], 17: [1, 12], 19: [1, 13], 22: [1, 14], 24: [1, 15] }, { 1: [2, 1] }, o2($V1, [2, 5]), o2($V1, [2, 6]), o2($V1, [2, 7]), o2($V1, [2, 8]), { 13: 16, 20: $V2, 21: $V3 }, { 13: 20, 18: 19, 20: $V2, 21: $V3 }, { 13: 20, 18: 21, 20: $V2, 21: $V3 }, { 16: [1, 25], 20: [1, 23], 21: [1, 24], 23: 22 }, { 13: 20, 18: 26, 20: $V2, 21: $V3 }, o2($V1, [2, 9], { 14: [1, 27], 15: [1, 28] }), o2($V4, [2, 43]), o2($V4, [2, 44]), o2($V1, [2, 13], { 14: [1, 29], 15: [1, 30], 27: $V5 }), o2($V4, [2, 41]), { 16: [1, 34], 20: [1, 32], 21: [1, 33], 27: $V5 }, o2($V1, [2, 22]), o2($V1, [2, 24], { 14: [1, 35] }), o2($V1, [2, 25], { 14: [1, 36] }), o2($V1, [2, 26]), { 20: $V6, 25: 37, 26: 38, 27: $V5 }, o2($V1, [2, 10], { 15: [1, 40] }), { 16: [1, 41] }, o2($V1, [2, 14], { 15: [1, 42] }), { 16: [1, 43] }, { 13: 44, 20: $V2, 21: $V3 }, o2($V1, [2, 17], { 14: [1, 45] }), o2($V1, [2, 18], { 14: [1, 46] }), o2($V1, [2, 19]), o2($V1, [2, 27]), o2($V1, [2, 28]), o2($V1, [2, 23], { 27: [1, 47] }), o2($V7, [2, 29]), { 15: [1, 48] }, { 16: [1, 49] }, o2($V1, [2, 11]), { 16: [1, 50] }, o2($V1, [2, 15]), o2($V4, [2, 42]), o2($V1, [2, 20]), o2($V1, [2, 21]), { 20: $V6, 26: 51 }, { 16: $V8, 20: $V9, 21: [1, 53], 28: 52, 29: 54, 30: 55, 31: $Va, 32: $Vb, 33: $Vc }, o2($V1, [2, 12]), o2($V1, [2, 16]), o2($V7, [2, 30]), o2($V7, [2, 31]), o2($V7, [2, 32]), o2($V7, [2, 33], { 30: 61, 16: $V8, 20: $V9, 31: $Va, 32: $Vb, 33: $Vc }), o2($Vd, [2, 34]), o2($Vd, [2, 36]), o2($Vd, [2, 37]), o2($Vd, [2, 38]), o2($Vd, [2, 39]), o2($Vd, [2, 40]), o2($Vd, [2, 35])], + defaultActions: { 6: [2, 1] }, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (hash.recoverable) { + this.trace(str2); + } else { + var error3 = new Error(str2); + error3.hash = hash; + throw error3; + } + }, "parseError"), + parse: /* @__PURE__ */ __name(function parse7(input) { + var self2 = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF2 = 1; + var args = lstack.slice.call(arguments, 1); + var lexer2 = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k2 in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k2)) { + sharedState.yy[k2] = this.yy[k2]; + } + } + lexer2.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer2; + sharedState.yy.parser = this; + if (typeof lexer2.yylloc == "undefined") { + lexer2.yylloc = {}; + } + var yyloc = lexer2.yylloc; + lstack.push(yyloc); + var ranges = lexer2.options && lexer2.options.ranges; + if (typeof sharedState.yy.parseError === "function") { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n2) { + stack.length = stack.length - 2 * n2; + vstack.length = vstack.length - n2; + lstack.length = lstack.length - n2; + } + __name(popStack, "popStack"); + function lex() { + var token2; + token2 = tstack.pop() || lexer2.lex() || EOF2; + if (typeof token2 !== "number") { + if (token2 instanceof Array) { + tstack = token2; + token2 = tstack.pop(); + } + token2 = self2.symbols_[token2] || token2; + } + return token2; + } + __name(lex, "lex"); + var symbol, preErrorSymbol, state4, action, a2, r2, yyval = {}, p3, len, newState2, expected; + while (true) { + state4 = stack[stack.length - 1]; + if (this.defaultActions[state4]) { + action = this.defaultActions[state4]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state4] && table[state4][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p3 in table[state4]) { + if (this.terminals_[p3] && p3 > TERROR) { + expected.push("'" + this.terminals_[p3] + "'"); + } + } + if (lexer2.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF2 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { + text: lexer2.match, + token: this.terminals_[symbol] || symbol, + line: lexer2.yylineno, + loc: yyloc, + expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state4 + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer2.yytext); + lstack.push(lexer2.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer2.yyleng; + yytext = lexer2.yytext; + yylineno = lexer2.yylineno; + yyloc = lexer2.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r2 = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r2 !== "undefined") { + return r2; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState2 = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState2); + break; + case 3: + return true; + } + } + return true; + }, "parse") + }; + var lexer = /* @__PURE__ */ (function() { + var lexer2 = { + EOF: 1, + parseError: /* @__PURE__ */ __name(function parseError(str2, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str2, hash); + } else { + throw new Error(str2); + } + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ __name(function(input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ __name(function() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + this._input = this._input.slice(1); + return ch; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ __name(function(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r2 = this.yylloc.range; + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + if (this.options.ranges) { + this.yylloc.range = [r2[0], r2[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ __name(function() { + this._more = true; + return this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ __name(function() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ __name(function(n2) { + this.unput(this.match.slice(n2)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ __name(function() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ __name(function() { + var next3 = this.match; + if (next3.length < 20) { + next3 += this._input.substr(0, 20 - next3.length); + } + return (next3.substr(0, 20) + (next3.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ __name(function() { + var pre = this.pastInput(); + var c3 = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c3 + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ __name(function(match3, indexed_rule) { + var token2, lines, backup; + if (this.options.backtrack_lexer) { + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + lines = match3[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match3[0].length + }; + this.yytext += match3[0]; + this.match += match3[0]; + this.matches = match3; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match3[0].length); + this.matched += match3[0]; + token2 = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token2) { + return token2; + } else if (this._backtrack) { + for (var k2 in backup) { + this[k2] = backup[k2]; + } + return false; + } + return false; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ __name(function() { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + var token2, match3, tempMatch, index; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i2 = 0; i2 < rules.length; i2++) { + tempMatch = this._input.match(this.rules[rules[i2]]); + if (tempMatch && (!match3 || tempMatch[0].length > match3[0].length)) { + match3 = tempMatch; + index = i2; + if (this.options.backtrack_lexer) { + token2 = this.test_match(tempMatch, rules[i2]); + if (token2 !== false) { + return token2; + } else if (this._backtrack) { + match3 = false; + continue; + } else { + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match3) { + token2 = this.test_match(match3, rules[index]); + if (token2 !== false) { + return token2; + } + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ __name(function lex() { + var r2 = this.next(); + if (r2) { + return r2; + } else { + return this.lex(); + } + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ __name(function begin(condition) { + this.conditionStack.push(condition); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ __name(function popState() { + var n2 = this.conditionStack.length - 1; + if (n2 > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ __name(function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ __name(function topState(n2) { + n2 = this.conditionStack.length - 1 - Math.abs(n2 || 0); + if (n2 >= 0) { + return this.conditionStack[n2]; + } else { + return "INITIAL"; + } + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ __name(function pushState(condition) { + this.begin(condition); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ __name(function stateStackSize() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": true }, + performAction: /* @__PURE__ */ __name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + break; + case 1: + break; + case 2: + break; + case 3: + if (yy.getIndentMode && yy.getIndentMode()) { + yy.consumeIndentText = true; + this.begin("INITIAL"); + return 22; + } + break; + case 4: + break; + case 5: + if (yy.setIndentMode) { + yy.setIndentMode(false); + } + this.begin("INITIAL"); + this.unput(yy_.yytext); + break; + case 6: + this.begin("bol"); + return 8; + break; + case 7: + break; + case 8: + break; + case 9: + return 7; + break; + case 10: + return 11; + break; + case 11: + return 5; + break; + case 12: + return 12; + break; + case 13: + return 17; + break; + case 14: + if (yy.consumeIndentText) { + yy.consumeIndentText = false; + } else { + return 19; + } + break; + case 15: + return 24; + break; + case 16: + yy_.yytext = yy_.yytext.slice(2, -2); + return 14; + break; + case 17: + yy_.yytext = yy_.yytext.slice(1, -1).trim(); + return 14; + break; + case 18: + return 16; + break; + case 19: + return 31; + break; + case 20: + return 33; + break; + case 21: + return 32; + break; + case 22: + return 20; + break; + case 23: + return 21; + break; + case 24: + return 27; + break; + case 25: + return 15; + break; + } + }, "anonymous"), + rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[ \t]+(?=[\n\r]))/i, /^(?:[ \t]+(?=text\b))/i, /^(?:[ \t]+)/i, /^(?:[^ \t\n\r])/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[ \t]+)/i, /^(?:$)/i, /^(?:title\s[^#\n;]+)/i, /^(?:venn-beta\b)/i, /^(?:set\b)/i, /^(?:union\b)/i, /^(?:text\b)/i, /^(?:style\b)/i, /^(?:\["[^\"]*"\])/i, /^(?:\[[^\]\"]+\])/i, /^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i, /^(?:#[0-9a-fA-F]{3,8})/i, /^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i, /^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:"[^\"]*")/i, /^(?:,)/i, /^(?::)/i], + conditions: { "bol": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "inclusive": true }, "INITIAL": { "rules": [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], "inclusive": true } } + }; + return lexer2; + })(); + parser29.lexer = lexer; + function Parser3() { + this.yy = {}; + } + __name(Parser3, "Parser"); + Parser3.prototype = parser29; + parser29.Parser = Parser3; + return new Parser3(); + })(); + parser26.parser = parser26; + venn_default = parser26; + } + }); + + // src/diagrams/venn/vennDB.ts + function getConfig8() { + return cleanAndMerge(DEFAULT_VENN_CONFIG, getConfig().venn); + } + var subsets, textNodes, styleEntries, knownSets, currentSets, indentMode, addSubsetData, getSubsetData, normalizeText, normalizeStyleValue, addTextData, addStyleData, getStyleData, normalizeIdentifierList, validateUnionIdentifiers, getTextData, getCurrentSets, getIndentMode, setIndentMode, DEFAULT_VENN_CONFIG, customClear, db9; + var init_vennDB = __esm({ + "src/diagrams/venn/vennDB.ts"() { + "use strict"; + init_utils2(); + init_config(); + init_commonDb(); + init_defaultConfig(); + subsets = []; + textNodes = []; + styleEntries = []; + knownSets = /* @__PURE__ */ new Set(); + indentMode = false; + addSubsetData = /* @__PURE__ */ __name((identifierList, label, size4) => { + const sets = normalizeIdentifierList(identifierList).sort(); + const resolvedSize = size4 ?? 10 / Math.pow(identifierList.length, 2); + currentSets = sets; + if (sets.length === 1) { + knownSets.add(sets[0]); + } + subsets.push({ + sets, + size: resolvedSize, + label: label ? normalizeText(label) : void 0 + }); + }, "addSubsetData"); + getSubsetData = /* @__PURE__ */ __name(() => { + return subsets; + }, "getSubsetData"); + normalizeText = /* @__PURE__ */ __name((text4) => { + const trimmed = text4.trim(); + if (trimmed.length >= 2 && trimmed.startsWith('"') && trimmed.endsWith('"')) { + return trimmed.slice(1, -1); + } + return trimmed; + }, "normalizeText"); + normalizeStyleValue = /* @__PURE__ */ __name((value2) => { + return value2 ? normalizeText(value2) : value2; + }, "normalizeStyleValue"); + addTextData = /* @__PURE__ */ __name((identifierList, id35, label) => { + const normalizedId = normalizeText(id35); + textNodes.push({ + sets: normalizeIdentifierList(identifierList).sort(), + id: normalizedId, + label: label ? normalizeText(label) : void 0 + }); + }, "addTextData"); + addStyleData = /* @__PURE__ */ __name((identifierList, data5) => { + const targets = normalizeIdentifierList(identifierList).sort(); + const styles6 = {}; + for (const [key, value2] of data5) { + styles6[key] = normalizeStyleValue(value2) ?? value2; + } + styleEntries.push({ targets, styles: styles6 }); + }, "addStyleData"); + getStyleData = /* @__PURE__ */ __name(() => { + return styleEntries; + }, "getStyleData"); + normalizeIdentifierList = /* @__PURE__ */ __name((identifierList) => { + return identifierList.map((identifier2) => normalizeText(identifier2)); + }, "normalizeIdentifierList"); + validateUnionIdentifiers = /* @__PURE__ */ __name((identifierList) => { + const normalized = normalizeIdentifierList(identifierList); + const unknown = normalized.filter((identifier2) => !knownSets.has(identifier2)); + if (unknown.length > 0) { + throw new Error(`unknown set identifier: ${unknown.join(", ")}`); + } + }, "validateUnionIdentifiers"); + getTextData = /* @__PURE__ */ __name(() => { + return textNodes; + }, "getTextData"); + getCurrentSets = /* @__PURE__ */ __name(() => currentSets, "getCurrentSets"); + getIndentMode = /* @__PURE__ */ __name(() => indentMode, "getIndentMode"); + setIndentMode = /* @__PURE__ */ __name((enabled) => { + indentMode = enabled; + }, "setIndentMode"); + DEFAULT_VENN_CONFIG = defaultConfig_default.venn; + __name(getConfig8, "getConfig"); + customClear = /* @__PURE__ */ __name(() => { + clear(); + subsets.length = 0; + textNodes.length = 0; + styleEntries.length = 0; + knownSets.clear(); + currentSets = void 0; + indentMode = false; + }, "customClear"); + db9 = { + getConfig: getConfig8, + clear: customClear, + setAccTitle, + getAccTitle, + setDiagramTitle, + getDiagramTitle, + getAccDescription, + setAccDescription, + addSubsetData, + getSubsetData, + addTextData, + addStyleData, + validateUnionIdentifiers, + getTextData, + getStyleData, + getCurrentSets, + getIndentMode, + setIndentMode + }; + } + }); + + // src/diagrams/venn/styles.ts + var getStyles21, styles_default19; + var init_styles21 = __esm({ + "src/diagrams/venn/styles.ts"() { + "use strict"; + getStyles21 = /* @__PURE__ */ __name((options2) => ` + .venn-title { + font-size: 32px; + fill: ${options2.vennTitleTextColor}; + font-family: ${options2.fontFamily}; + } + + .venn-circle text { + font-size: 48px; + font-family: ${options2.fontFamily}; + } + + .venn-intersection text { + font-size: 48px; + fill: ${options2.vennSetTextColor}; + font-family: ${options2.fontFamily}; + } + + .venn-text-node { + font-family: ${options2.fontFamily}; + color: ${options2.vennSetTextColor}; + } +`, "getStyles"); + styles_default19 = getStyles21; + } + }); + + // ../../node_modules/.pnpm/@upsetjs+venn.js@2.0.0/node_modules/@upsetjs/venn.js/build/venn.esm.js + function intersectionArea(circles, stats) { + const intersectionPoints = getIntersectionPoints(circles); + const innerPoints = intersectionPoints.filter((p3) => containedInCircles(p3, circles)); + let arcArea = 0; + let polygonArea = 0; + const arcs = []; + if (innerPoints.length > 1) { + const center4 = getCenter(innerPoints); + for (let i2 = 0; i2 < innerPoints.length; ++i2) { + const p3 = innerPoints[i2]; + p3.angle = Math.atan2(p3.x - center4.x, p3.y - center4.y); + } + innerPoints.sort((a2, b3) => b3.angle - a2.angle); + let p22 = innerPoints[innerPoints.length - 1]; + for (let i2 = 0; i2 < innerPoints.length; ++i2) { + const p1 = innerPoints[i2]; + polygonArea += (p22.x + p1.x) * (p1.y - p22.y); + const midPoint = { x: (p1.x + p22.x) / 2, y: (p1.y + p22.y) / 2 }; + let arc = null; + for (let j3 = 0; j3 < p1.parentIndex.length; ++j3) { + if (p22.parentIndex.includes(p1.parentIndex[j3])) { + const circle6 = circles[p1.parentIndex[j3]]; + const a1 = Math.atan2(p1.x - circle6.x, p1.y - circle6.y); + const a2 = Math.atan2(p22.x - circle6.x, p22.y - circle6.y); + let angleDiff = a2 - a1; + if (angleDiff < 0) { + angleDiff += 2 * Math.PI; + } + const a3 = a2 - angleDiff / 2; + let width3 = distance2(midPoint, { + x: circle6.x + circle6.radius * Math.sin(a3), + y: circle6.y + circle6.radius * Math.cos(a3) + }); + if (width3 > circle6.radius * 2) { + width3 = circle6.radius * 2; + } + if (arc == null || arc.width > width3) { + arc = { circle: circle6, width: width3, p1, p2: p22, large: width3 > circle6.radius, sweep: true }; + } + } + } + if (arc != null) { + arcs.push(arc); + arcArea += circleArea(arc.circle.radius, arc.width); + p22 = p1; + } + } + } else { + let smallest = circles[0]; + for (let i2 = 1; i2 < circles.length; ++i2) { + if (circles[i2].radius < smallest.radius) { + smallest = circles[i2]; + } + } + let disjoint = false; + for (let i2 = 0; i2 < circles.length; ++i2) { + if (distance2(circles[i2], smallest) > Math.abs(smallest.radius - circles[i2].radius)) { + disjoint = true; + break; + } + } + if (disjoint) { + arcArea = polygonArea = 0; + } else { + arcArea = smallest.radius * smallest.radius * Math.PI; + arcs.push({ + circle: smallest, + p1: { x: smallest.x, y: smallest.y + smallest.radius }, + p2: { x: smallest.x - SMALL$1, y: smallest.y + smallest.radius }, + width: smallest.radius * 2, + large: true, + sweep: true + }); + } + } + polygonArea /= 2; + if (stats) { + stats.area = arcArea + polygonArea; + stats.arcArea = arcArea; + stats.polygonArea = polygonArea; + stats.arcs = arcs; + stats.innerPoints = innerPoints; + stats.intersectionPoints = intersectionPoints; + } + return arcArea + polygonArea; + } + function containedInCircles(point8, circles) { + return circles.every((circle6) => distance2(point8, circle6) < circle6.radius + SMALL$1); + } + function getIntersectionPoints(circles) { + const ret = []; + for (let i2 = 0; i2 < circles.length; ++i2) { + for (let j3 = i2 + 1; j3 < circles.length; ++j3) { + const intersect3 = circleCircleIntersection(circles[i2], circles[j3]); + for (const p3 of intersect3) { + p3.parentIndex = [i2, j3]; + ret.push(p3); + } + } + } + return ret; + } + function circleArea(r2, width3) { + return r2 * r2 * Math.acos(1 - width3 / r2) - (r2 - width3) * Math.sqrt(width3 * (2 * r2 - width3)); + } + function distance2(p1, p22) { + return Math.sqrt((p1.x - p22.x) * (p1.x - p22.x) + (p1.y - p22.y) * (p1.y - p22.y)); + } + function circleOverlap(r1, r2, d3) { + if (d3 >= r1 + r2) { + return 0; + } + if (d3 <= Math.abs(r1 - r2)) { + return Math.PI * Math.min(r1, r2) * Math.min(r1, r2); + } + const w1 = r1 - (d3 * d3 - r2 * r2 + r1 * r1) / (2 * d3); + const w22 = r2 - (d3 * d3 - r1 * r1 + r2 * r2) / (2 * d3); + return circleArea(r1, w1) + circleArea(r2, w22); + } + function circleCircleIntersection(p1, p22) { + const d3 = distance2(p1, p22); + const r1 = p1.radius; + const r2 = p22.radius; + if (d3 >= r1 + r2 || d3 <= Math.abs(r1 - r2)) { + return []; + } + const a2 = (r1 * r1 - r2 * r2 + d3 * d3) / (2 * d3); + const h3 = Math.sqrt(r1 * r1 - a2 * a2); + const x0 = p1.x + a2 * (p22.x - p1.x) / d3; + const y0 = p1.y + a2 * (p22.y - p1.y) / d3; + const rx = -(p22.y - p1.y) * (h3 / d3); + const ry = -(p22.x - p1.x) * (h3 / d3); + return [ + { x: x0 + rx, y: y0 - ry }, + { x: x0 - rx, y: y0 + ry } + ]; + } + function getCenter(points) { + const center4 = { x: 0, y: 0 }; + for (const point8 of points) { + center4.x += point8.x; + center4.y += point8.y; + } + center4.x /= points.length; + center4.y /= points.length; + return center4; + } + function bisect(f2, a2, b3, parameters) { + parameters = parameters || {}; + const maxIterations = parameters.maxIterations || 100; + const tolerance = parameters.tolerance || 1e-10; + const fA = f2(a2); + const fB = f2(b3); + let delta = b3 - a2; + if (fA * fB > 0) { + throw "Initial bisect points must have opposite signs"; + } + if (fA === 0) return a2; + if (fB === 0) return b3; + for (let i2 = 0; i2 < maxIterations; ++i2) { + delta /= 2; + const mid = a2 + delta; + const fMid = f2(mid); + if (fMid * fA >= 0) { + a2 = mid; + } + if (Math.abs(delta) < tolerance || fMid === 0) { + return mid; + } + } + return a2 + delta; + } + function zeros(x5) { + const r2 = new Array(x5); + for (let i2 = 0; i2 < x5; ++i2) { + r2[i2] = 0; + } + return r2; + } + function zerosM(x5, y6) { + return zeros(x5).map(() => zeros(y6)); + } + function dot(a2, b3) { + let ret = 0; + for (let i2 = 0; i2 < a2.length; ++i2) { + ret += a2[i2] * b3[i2]; + } + return ret; + } + function norm2(a2) { + return Math.sqrt(dot(a2, a2)); + } + function scale2(ret, value2, c3) { + for (let i2 = 0; i2 < value2.length; ++i2) { + ret[i2] = value2[i2] * c3; + } + } + function weightedSum(ret, w1, v12, w22, v23) { + for (let j3 = 0; j3 < ret.length; ++j3) { + ret[j3] = w1 * v12[j3] + w22 * v23[j3]; + } + } + function nelderMead(f2, x0, parameters) { + parameters = parameters || {}; + const maxIterations = parameters.maxIterations || x0.length * 200; + const nonZeroDelta = parameters.nonZeroDelta || 1.05; + const zeroDelta = parameters.zeroDelta || 1e-3; + const minErrorDelta = parameters.minErrorDelta || 1e-6; + const minTolerance = parameters.minErrorDelta || 1e-5; + const rho = parameters.rho !== void 0 ? parameters.rho : 1; + const chi = parameters.chi !== void 0 ? parameters.chi : 2; + const psi = parameters.psi !== void 0 ? parameters.psi : -0.5; + const sigma = parameters.sigma !== void 0 ? parameters.sigma : 0.5; + let maxDiff; + const N3 = x0.length; + const simplex = new Array(N3 + 1); + simplex[0] = x0; + simplex[0].fx = f2(x0); + simplex[0].id = 0; + for (let i2 = 0; i2 < N3; ++i2) { + const point8 = x0.slice(); + point8[i2] = point8[i2] ? point8[i2] * nonZeroDelta : zeroDelta; + simplex[i2 + 1] = point8; + simplex[i2 + 1].fx = f2(point8); + simplex[i2 + 1].id = i2 + 1; + } + function updateSimplex(value2) { + for (let i2 = 0; i2 < value2.length; i2++) { + simplex[N3][i2] = value2[i2]; + } + simplex[N3].fx = value2.fx; + } + __name(updateSimplex, "updateSimplex"); + const sortOrder = /* @__PURE__ */ __name((a2, b3) => a2.fx - b3.fx, "sortOrder"); + const centroid = x0.slice(); + const reflected = x0.slice(); + const contracted = x0.slice(); + const expanded = x0.slice(); + for (let iteration = 0; iteration < maxIterations; ++iteration) { + simplex.sort(sortOrder); + if (parameters.history) { + const sortedSimplex = simplex.map((x5) => { + const state4 = x5.slice(); + state4.fx = x5.fx; + state4.id = x5.id; + return state4; + }); + sortedSimplex.sort((a2, b3) => a2.id - b3.id); + parameters.history.push({ + x: simplex[0].slice(), + fx: simplex[0].fx, + simplex: sortedSimplex + }); + } + maxDiff = 0; + for (let i2 = 0; i2 < N3; ++i2) { + maxDiff = Math.max(maxDiff, Math.abs(simplex[0][i2] - simplex[1][i2])); + } + if (Math.abs(simplex[0].fx - simplex[N3].fx) < minErrorDelta && maxDiff < minTolerance) { + break; + } + for (let i2 = 0; i2 < N3; ++i2) { + centroid[i2] = 0; + for (let j3 = 0; j3 < N3; ++j3) { + centroid[i2] += simplex[j3][i2]; + } + centroid[i2] /= N3; + } + const worst = simplex[N3]; + weightedSum(reflected, 1 + rho, centroid, -rho, worst); + reflected.fx = f2(reflected); + if (reflected.fx < simplex[0].fx) { + weightedSum(expanded, 1 + chi, centroid, -chi, worst); + expanded.fx = f2(expanded); + if (expanded.fx < reflected.fx) { + updateSimplex(expanded); + } else { + updateSimplex(reflected); + } + } else if (reflected.fx >= simplex[N3 - 1].fx) { + let shouldReduce = false; + if (reflected.fx > worst.fx) { + weightedSum(contracted, 1 + psi, centroid, -psi, worst); + contracted.fx = f2(contracted); + if (contracted.fx < worst.fx) { + updateSimplex(contracted); + } else { + shouldReduce = true; + } + } else { + weightedSum(contracted, 1 - psi * rho, centroid, psi * rho, worst); + contracted.fx = f2(contracted); + if (contracted.fx < reflected.fx) { + updateSimplex(contracted); + } else { + shouldReduce = true; + } + } + if (shouldReduce) { + if (sigma >= 1) break; + for (let i2 = 1; i2 < simplex.length; ++i2) { + weightedSum(simplex[i2], 1 - sigma, simplex[0], sigma, simplex[i2]); + simplex[i2].fx = f2(simplex[i2]); + } + } + } else { + updateSimplex(reflected); + } + } + simplex.sort(sortOrder); + return { fx: simplex[0].fx, x: simplex[0] }; + } + function wolfeLineSearch(f2, pk, current, next3, a2, c1, c22) { + const phi0 = current.fx; + const phiPrime0 = dot(current.fxprime, pk); + let phi2 = phi0; + let phi_old = phi0; + let phiPrime = phiPrime0; + let a0 = 0; + a2 = a2 || 1; + c1 = c1 || 1e-6; + c22 = c22 || 0.1; + function zoom2(a_lo, a_high, phi_lo) { + for (let iteration = 0; iteration < 16; ++iteration) { + a2 = (a_lo + a_high) / 2; + weightedSum(next3.x, 1, current.x, a2, pk); + phi2 = next3.fx = f2(next3.x, next3.fxprime); + phiPrime = dot(next3.fxprime, pk); + if (phi2 > phi0 + c1 * a2 * phiPrime0 || phi2 >= phi_lo) { + a_high = a2; + } else { + if (Math.abs(phiPrime) <= -c22 * phiPrime0) { + return a2; + } + if (phiPrime * (a_high - a_lo) >= 0) { + a_high = a_lo; + } + a_lo = a2; + phi_lo = phi2; + } + } + return 0; + } + __name(zoom2, "zoom"); + for (let iteration = 0; iteration < 10; ++iteration) { + weightedSum(next3.x, 1, current.x, a2, pk); + phi2 = next3.fx = f2(next3.x, next3.fxprime); + phiPrime = dot(next3.fxprime, pk); + if (phi2 > phi0 + c1 * a2 * phiPrime0 || iteration && phi2 >= phi_old) { + return zoom2(a0, a2, phi_old); + } + if (Math.abs(phiPrime) <= -c22 * phiPrime0) { + return a2; + } + if (phiPrime >= 0) { + return zoom2(a2, a0, phi2); + } + phi_old = phi2; + a0 = a2; + a2 *= 2; + } + return a2; + } + function conjugateGradient(f2, initial2, params) { + let current = { x: initial2.slice(), fx: 0, fxprime: initial2.slice() }; + let next3 = { x: initial2.slice(), fx: 0, fxprime: initial2.slice() }; + const yk = initial2.slice(); + let pk; + let temp; + let a2 = 1; + let maxIterations; + params = params || {}; + maxIterations = params.maxIterations || initial2.length * 20; + current.fx = f2(current.x, current.fxprime); + pk = current.fxprime.slice(); + scale2(pk, current.fxprime, -1); + for (let i2 = 0; i2 < maxIterations; ++i2) { + a2 = wolfeLineSearch(f2, pk, current, next3, a2); + if (params.history) { + params.history.push({ + x: current.x.slice(), + fx: current.fx, + fxprime: current.fxprime.slice(), + alpha: a2 + }); + } + if (!a2) { + scale2(pk, current.fxprime, -1); + } else { + weightedSum(yk, 1, next3.fxprime, -1, current.fxprime); + const delta_k = dot(current.fxprime, current.fxprime); + const beta_k = Math.max(0, dot(yk, next3.fxprime) / delta_k); + weightedSum(pk, beta_k, pk, -1, next3.fxprime); + temp = current; + current = next3; + next3 = temp; + } + if (norm2(current.fxprime) <= 1e-5) { + break; + } + } + if (params.history) { + params.history.push({ + x: current.x.slice(), + fx: current.fx, + fxprime: current.fxprime.slice(), + alpha: a2 + }); + } + return current; + } + function venn(sets, parameters = {}) { + parameters.maxIterations = parameters.maxIterations || 500; + const initialLayout = parameters.initialLayout || bestInitialLayout; + const loss = parameters.lossFunction || lossFunction; + const areas = addMissingAreas(sets, parameters); + const circles = initialLayout(areas, parameters); + const setids = Object.keys(circles); + const initial2 = []; + for (const setid of setids) { + initial2.push(circles[setid].x); + initial2.push(circles[setid].y); + } + const solution = nelderMead( + (values3) => { + const current = {}; + for (let i2 = 0; i2 < setids.length; ++i2) { + const setid = setids[i2]; + current[setid] = { + x: values3[2 * i2], + y: values3[2 * i2 + 1], + radius: circles[setid].radius + // size : circles[setid].size + }; + } + return loss(current, areas); + }, + initial2, + parameters + ); + const positions2 = solution.x; + for (let i2 = 0; i2 < setids.length; ++i2) { + const setid = setids[i2]; + circles[setid].x = positions2[2 * i2]; + circles[setid].y = positions2[2 * i2 + 1]; + } + return circles; + } + function distanceFromIntersectArea(r1, r2, overlap) { + if (Math.min(r1, r2) * Math.min(r1, r2) * Math.PI <= overlap + SMALL) { + return Math.abs(r1 - r2); + } + return bisect((distance3) => circleOverlap(r1, r2, distance3) - overlap, 0, r1 + r2); + } + function addMissingAreas(areas, parameters = {}) { + const distinct = parameters.distinct; + const r2 = areas.map((s2) => Object.assign({}, s2)); + function toKey3(arr) { + return arr.join(";"); + } + __name(toKey3, "toKey"); + if (distinct) { + const count2 = /* @__PURE__ */ new Map(); + for (const area of r2) { + for (let i2 = 0; i2 < area.sets.length; i2++) { + const si = String(area.sets[i2]); + count2.set(si, area.size + (count2.get(si) || 0)); + for (let j3 = i2 + 1; j3 < area.sets.length; j3++) { + const sj = String(area.sets[j3]); + const k1 = `${si};${sj}`; + const k2 = `${sj};${si}`; + count2.set(k1, area.size + (count2.get(k1) || 0)); + count2.set(k2, area.size + (count2.get(k2) || 0)); + } + } + } + for (const area of r2) { + if (area.sets.length < 3) { + area.size = count2.get(toKey3(area.sets)); + } + } + } + const ids = []; + const pairs2 = /* @__PURE__ */ new Set(); + for (const area of r2) { + if (area.sets.length === 1) { + ids.push(area.sets[0]); + } else if (area.sets.length === 2) { + const a2 = area.sets[0]; + const b3 = area.sets[1]; + pairs2.add(toKey3(area.sets)); + pairs2.add(toKey3([b3, a2])); + } + } + ids.sort((a2, b3) => a2 === b3 ? 0 : a2 < b3 ? -1 : 1); + for (let i2 = 0; i2 < ids.length; ++i2) { + const a2 = ids[i2]; + for (let j3 = i2 + 1; j3 < ids.length; ++j3) { + const b3 = ids[j3]; + if (!pairs2.has(toKey3([a2, b3]))) { + r2.push({ sets: [a2, b3], size: 0 }); + } + } + } + return r2; + } + function getDistanceMatrices(areas, sets, setids) { + const distances2 = zerosM(sets.length, sets.length); + const constraints = zerosM(sets.length, sets.length); + areas.filter((x5) => x5.sets.length === 2).forEach((current) => { + const left3 = setids[current.sets[0]]; + const right3 = setids[current.sets[1]]; + const r1 = Math.sqrt(sets[left3].size / Math.PI); + const r2 = Math.sqrt(sets[right3].size / Math.PI); + const distance3 = distanceFromIntersectArea(r1, r2, current.size); + distances2[left3][right3] = distances2[right3][left3] = distance3; + let c3 = 0; + if (current.size + 1e-10 >= Math.min(sets[left3].size, sets[right3].size)) { + c3 = 1; + } else if (current.size <= 1e-10) { + c3 = -1; + } + constraints[left3][right3] = constraints[right3][left3] = c3; + }); + return { distances: distances2, constraints }; + } + function constrainedMDSGradient(x5, fxprime, distances2, constraints) { + for (let i2 = 0; i2 < fxprime.length; ++i2) { + fxprime[i2] = 0; + } + let loss = 0; + for (let i2 = 0; i2 < distances2.length; ++i2) { + const xi = x5[2 * i2]; + const yi = x5[2 * i2 + 1]; + for (let j3 = i2 + 1; j3 < distances2.length; ++j3) { + const xj = x5[2 * j3]; + const yj = x5[2 * j3 + 1]; + const dij = distances2[i2][j3]; + const constraint = constraints[i2][j3]; + const squaredDistance = (xj - xi) * (xj - xi) + (yj - yi) * (yj - yi); + const distance3 = Math.sqrt(squaredDistance); + const delta = squaredDistance - dij * dij; + if (constraint > 0 && distance3 <= dij || constraint < 0 && distance3 >= dij) { + continue; + } + loss += 2 * delta * delta; + fxprime[2 * i2] += 4 * delta * (xi - xj); + fxprime[2 * i2 + 1] += 4 * delta * (yi - yj); + fxprime[2 * j3] += 4 * delta * (xj - xi); + fxprime[2 * j3 + 1] += 4 * delta * (yj - yi); + } + } + return loss; + } + function bestInitialLayout(areas, params = {}) { + let initial2 = greedyLayout(areas, params); + const loss = params.lossFunction || lossFunction; + if (areas.length >= 8) { + const constrained = constrainedMDSLayout(areas, params); + const constrainedLoss = loss(constrained, areas); + const greedyLoss = loss(initial2, areas); + if (constrainedLoss + 1e-8 < greedyLoss) { + initial2 = constrained; + } + } + return initial2; + } + function constrainedMDSLayout(areas, params = {}) { + const restarts = params.restarts || 10; + const sets = []; + const setids = {}; + for (const area of areas) { + if (area.sets.length === 1) { + setids[area.sets[0]] = sets.length; + sets.push(area); + } + } + let { distances: distances2, constraints } = getDistanceMatrices(areas, sets, setids); + const norm = norm2(distances2.map(norm2)) / distances2.length; + distances2 = distances2.map((row) => row.map((value2) => value2 / norm)); + const obj = /* @__PURE__ */ __name((x5, fxprime) => constrainedMDSGradient(x5, fxprime, distances2, constraints), "obj"); + let best = null; + for (let i2 = 0; i2 < restarts; ++i2) { + const initial2 = zeros(distances2.length * 2).map(Math.random); + const current = conjugateGradient(obj, initial2, params); + if (!best || current.fx < best.fx) { + best = current; + } + } + const positions2 = best.x; + const circles = {}; + for (let i2 = 0; i2 < sets.length; ++i2) { + const set5 = sets[i2]; + circles[set5.sets[0]] = { + x: positions2[2 * i2] * norm, + y: positions2[2 * i2 + 1] * norm, + radius: Math.sqrt(set5.size / Math.PI) + }; + } + if (params.history) { + for (const h3 of params.history) { + scale2(h3.x, norm); + } + } + return circles; + } + function greedyLayout(areas, params) { + const loss = params && params.lossFunction ? params.lossFunction : lossFunction; + const circles = {}; + const setOverlaps = {}; + for (const area of areas) { + if (area.sets.length === 1) { + const set5 = area.sets[0]; + circles[set5] = { + x: 1e10, + y: 1e10, + rowid: circles.length, + size: area.size, + radius: Math.sqrt(area.size / Math.PI) + }; + setOverlaps[set5] = []; + } + } + areas = areas.filter((a2) => a2.sets.length === 2); + for (const current of areas) { + let weight8 = current.weight != null ? current.weight : 1; + const left3 = current.sets[0]; + const right3 = current.sets[1]; + if (current.size + SMALL >= Math.min(circles[left3].size, circles[right3].size)) { + weight8 = 0; + } + setOverlaps[left3].push({ set: right3, size: current.size, weight: weight8 }); + setOverlaps[right3].push({ set: left3, size: current.size, weight: weight8 }); + } + const mostOverlapped = []; + Object.keys(setOverlaps).forEach((set5) => { + let size4 = 0; + for (let i2 = 0; i2 < setOverlaps[set5].length; ++i2) { + size4 += setOverlaps[set5][i2].size * setOverlaps[set5][i2].weight; + } + mostOverlapped.push({ set: set5, size: size4 }); + }); + function sortOrder(a2, b3) { + return b3.size - a2.size; + } + __name(sortOrder, "sortOrder"); + mostOverlapped.sort(sortOrder); + const positioned = {}; + function isPositioned(element3) { + return element3.set in positioned; + } + __name(isPositioned, "isPositioned"); + function positionSet(point8, index) { + circles[index].x = point8.x; + circles[index].y = point8.y; + positioned[index] = true; + } + __name(positionSet, "positionSet"); + positionSet({ x: 0, y: 0 }, mostOverlapped[0].set); + for (let i2 = 1; i2 < mostOverlapped.length; ++i2) { + const setIndex = mostOverlapped[i2].set; + const overlap = setOverlaps[setIndex].filter(isPositioned); + const set5 = circles[setIndex]; + overlap.sort(sortOrder); + if (overlap.length === 0) { + throw "ERROR: missing pairwise overlap information"; + } + const points = []; + for (var j3 = 0; j3 < overlap.length; ++j3) { + const p1 = circles[overlap[j3].set]; + const d1 = distanceFromIntersectArea(set5.radius, p1.radius, overlap[j3].size); + points.push({ x: p1.x + d1, y: p1.y }); + points.push({ x: p1.x - d1, y: p1.y }); + points.push({ y: p1.y + d1, x: p1.x }); + points.push({ y: p1.y - d1, x: p1.x }); + for (let k2 = j3 + 1; k2 < overlap.length; ++k2) { + const p22 = circles[overlap[k2].set]; + const d22 = distanceFromIntersectArea(set5.radius, p22.radius, overlap[k2].size); + const extraPoints = circleCircleIntersection( + { x: p1.x, y: p1.y, radius: d1 }, + { x: p22.x, y: p22.y, radius: d22 } + ); + points.push(...extraPoints); + } + } + let bestLoss = 1e50; + let bestPoint = points[0]; + for (const point8 of points) { + circles[setIndex].x = point8.x; + circles[setIndex].y = point8.y; + const localLoss = loss(circles, areas); + if (localLoss < bestLoss) { + bestLoss = localLoss; + bestPoint = point8; + } + } + positionSet(bestPoint, setIndex); + } + return circles; + } + function lossFunction(circles, overlaps) { + let output2 = 0; + for (const area of overlaps) { + if (area.sets.length === 1) { + continue; + } + let overlap; + if (area.sets.length === 2) { + const left3 = circles[area.sets[0]]; + const right3 = circles[area.sets[1]]; + overlap = circleOverlap(left3.radius, right3.radius, distance2(left3, right3)); + } else { + overlap = intersectionArea(area.sets.map((d3) => circles[d3])); + } + const weight8 = area.weight != null ? area.weight : 1; + output2 += weight8 * (overlap - area.size) * (overlap - area.size); + } + return output2; + } + function logRatioLossFunction(circles, overlaps) { + let output2 = 0; + for (const area of overlaps) { + if (area.sets.length === 1) { + continue; + } + let overlap; + if (area.sets.length === 2) { + const left3 = circles[area.sets[0]]; + const right3 = circles[area.sets[1]]; + overlap = circleOverlap(left3.radius, right3.radius, distance2(left3, right3)); + } else { + overlap = intersectionArea(area.sets.map((d3) => circles[d3])); + } + const weight8 = area.weight != null ? area.weight : 1; + const differenceFromIdeal = Math.log((overlap + 1) / (area.size + 1)); + output2 += weight8 * differenceFromIdeal * differenceFromIdeal; + } + return output2; + } + function orientateCircles(circles, orientation, orientationOrder) { + if (orientationOrder == null) { + circles.sort((a2, b3) => b3.radius - a2.radius); + } else { + circles.sort(orientationOrder); + } + if (circles.length > 0) { + const largestX = circles[0].x; + const largestY = circles[0].y; + for (const circle6 of circles) { + circle6.x -= largestX; + circle6.y -= largestY; + } + } + if (circles.length === 2) { + const dist3 = distance2(circles[0], circles[1]); + if (dist3 < Math.abs(circles[1].radius - circles[0].radius)) { + circles[1].x = circles[0].x + circles[0].radius - circles[1].radius - 1e-10; + circles[1].y = circles[0].y; + } + } + if (circles.length > 1) { + const rotation = Math.atan2(circles[1].x, circles[1].y) - orientation; + const c3 = Math.cos(rotation); + const s2 = Math.sin(rotation); + for (const circle6 of circles) { + const x5 = circle6.x; + const y6 = circle6.y; + circle6.x = c3 * x5 - s2 * y6; + circle6.y = s2 * x5 + c3 * y6; + } + } + if (circles.length > 2) { + let angle2 = Math.atan2(circles[2].x, circles[2].y) - orientation; + while (angle2 < 0) { + angle2 += 2 * Math.PI; + } + while (angle2 > 2 * Math.PI) { + angle2 -= 2 * Math.PI; + } + if (angle2 > Math.PI) { + const slope = circles[1].y / (1e-10 + circles[1].x); + for (const circle6 of circles) { + var d3 = (circle6.x + slope * circle6.y) / (1 + slope * slope); + circle6.x = 2 * d3 - circle6.x; + circle6.y = 2 * d3 * slope - circle6.y; + } + } + } + } + function disjointCluster(circles) { + circles.forEach((circle6) => { + circle6.parent = circle6; + }); + function find5(circle6) { + if (circle6.parent !== circle6) { + circle6.parent = find5(circle6.parent); + } + return circle6.parent; + } + __name(find5, "find"); + function union2(x5, y6) { + const xRoot = find5(x5); + const yRoot = find5(y6); + xRoot.parent = yRoot; + } + __name(union2, "union"); + for (let i2 = 0; i2 < circles.length; ++i2) { + for (let j3 = i2 + 1; j3 < circles.length; ++j3) { + const maxDistance = circles[i2].radius + circles[j3].radius; + if (distance2(circles[i2], circles[j3]) + 1e-10 < maxDistance) { + union2(circles[j3], circles[i2]); + } + } + } + const disjointClusters = /* @__PURE__ */ new Map(); + for (let i2 = 0; i2 < circles.length; ++i2) { + const setid = find5(circles[i2]).parent.setid; + if (!disjointClusters.has(setid)) { + disjointClusters.set(setid, []); + } + disjointClusters.get(setid).push(circles[i2]); + } + circles.forEach((circle6) => { + delete circle6.parent; + }); + return Array.from(disjointClusters.values()); + } + function getBoundingBox(circles) { + const minMax = /* @__PURE__ */ __name((d3) => { + const hi = circles.reduce((acc, c3) => Math.max(acc, c3[d3] + c3.radius), Number.NEGATIVE_INFINITY); + const lo = circles.reduce((acc, c3) => Math.min(acc, c3[d3] - c3.radius), Number.POSITIVE_INFINITY); + return { max: hi, min: lo }; + }, "minMax"); + return { xRange: minMax("x"), yRange: minMax("y") }; + } + function normalizeSolution(solution, orientation, orientationOrder) { + if (orientation == null) { + orientation = Math.PI / 2; + } + let circles = fromObjectNotation(solution).map((d3) => Object.assign({}, d3)); + const clusters = disjointCluster(circles); + for (const cluster of clusters) { + orientateCircles(cluster, orientation, orientationOrder); + const bounds4 = getBoundingBox(cluster); + cluster.size = (bounds4.xRange.max - bounds4.xRange.min) * (bounds4.yRange.max - bounds4.yRange.min); + cluster.bounds = bounds4; + } + clusters.sort((a2, b3) => b3.size - a2.size); + circles = clusters[0]; + let returnBounds = circles.bounds; + const spacing2 = (returnBounds.xRange.max - returnBounds.xRange.min) / 50; + function addCluster(cluster, right3, bottom2) { + if (!cluster) { + return; + } + const bounds4 = cluster.bounds; + let xOffset; + let yOffset; + if (right3) { + xOffset = returnBounds.xRange.max - bounds4.xRange.min + spacing2; + } else { + xOffset = returnBounds.xRange.max - bounds4.xRange.max; + const centreing = (bounds4.xRange.max - bounds4.xRange.min) / 2 - (returnBounds.xRange.max - returnBounds.xRange.min) / 2; + if (centreing < 0) { + xOffset += centreing; + } + } + if (bottom2) { + yOffset = returnBounds.yRange.max - bounds4.yRange.min + spacing2; + } else { + yOffset = returnBounds.yRange.max - bounds4.yRange.max; + const centreing = (bounds4.yRange.max - bounds4.yRange.min) / 2 - (returnBounds.yRange.max - returnBounds.yRange.min) / 2; + if (centreing < 0) { + yOffset += centreing; + } + } + for (const c3 of cluster) { + c3.x += xOffset; + c3.y += yOffset; + circles.push(c3); + } + } + __name(addCluster, "addCluster"); + let index = 1; + while (index < clusters.length) { + addCluster(clusters[index], true, false); + addCluster(clusters[index + 1], false, true); + addCluster(clusters[index + 2], true, true); + index += 3; + returnBounds = getBoundingBox(circles); + } + return toObjectNotation(circles); + } + function scaleSolution(solution, width3, height2, padding2, scaleToFit) { + const circles = fromObjectNotation(solution); + width3 -= 2 * padding2; + height2 -= 2 * padding2; + const { xRange, yRange } = getBoundingBox(circles); + if (xRange.max === xRange.min || yRange.max === yRange.min) { + console.log("not scaling solution: zero size detected"); + return solution; + } + let xScaling; + let yScaling; + if (scaleToFit) { + const toScaleDiameter = Math.sqrt(scaleToFit / Math.PI) * 2; + xScaling = width3 / toScaleDiameter; + yScaling = height2 / toScaleDiameter; + } else { + xScaling = width3 / (xRange.max - xRange.min); + yScaling = height2 / (yRange.max - yRange.min); + } + const scaling = Math.min(yScaling, xScaling); + const xOffset = (width3 - (xRange.max - xRange.min) * scaling) / 2; + const yOffset = (height2 - (yRange.max - yRange.min) * scaling) / 2; + return toObjectNotation( + circles.map((circle6) => ({ + radius: scaling * circle6.radius, + x: padding2 + xOffset + (circle6.x - xRange.min) * scaling, + y: padding2 + yOffset + (circle6.y - yRange.min) * scaling, + setid: circle6.setid + })) + ); + } + function toObjectNotation(circles) { + const r2 = {}; + for (const circle6 of circles) { + r2[circle6.setid] = circle6; + } + return r2; + } + function fromObjectNotation(solution) { + const setids = Object.keys(solution); + return setids.map((id35) => Object.assign(solution[id35], { setid: id35 })); + } + function VennDiagram(options2 = {}) { + let useViewBox = false, width3 = 600, height2 = 350, padding2 = 15, duration = 1e3, orientation = Math.PI / 2, normalize4 = true, scaleToFit = null, wrap3 = true, styled = true, fontSize = null, orientationOrder = null, distinct = false, round = null, symmetricalTextCentre = options2 && options2.symmetricalTextCentre ? options2.symmetricalTextCentre : false, colourMap = {}, colourScheme = options2 && options2.colourScheme ? options2.colourScheme : options2 && options2.colorScheme ? options2.colorScheme : [ + "#1f77b4", + "#ff7f0e", + "#2ca02c", + "#d62728", + "#9467bd", + "#8c564b", + "#e377c2", + "#7f7f7f", + "#bcbd22", + "#17becf" + ], colourIndex = 0, colours = /* @__PURE__ */ __name(function(key) { + if (key in colourMap) { + return colourMap[key]; + } + var ret = colourMap[key] = colourScheme[colourIndex]; + colourIndex += 1; + if (colourIndex >= colourScheme.length) { + colourIndex = 0; + } + return ret; + }, "colours"), layoutFunction = venn, loss = lossFunction; + function chart(selection2) { + let data5 = selection2.datum(); + const toRemove = /* @__PURE__ */ new Set(); + data5.forEach((datum2) => { + if (datum2.size == 0 && datum2.sets.length == 1) { + toRemove.add(datum2.sets[0]); + } + }); + data5 = data5.filter((datum2) => !datum2.sets.some((set5) => toRemove.has(set5))); + let circles = {}; + let textCentres = {}; + if (data5.length > 0) { + let solution = layoutFunction(data5, { lossFunction: loss, distinct }); + if (normalize4) { + solution = normalizeSolution(solution, orientation, orientationOrder); + } + circles = scaleSolution(solution, width3, height2, padding2, scaleToFit); + textCentres = computeTextCentres(circles, data5, symmetricalTextCentre); + } + const labels = {}; + data5.forEach((datum2) => { + if (datum2.label) { + labels[datum2.sets] = datum2.label; + } + }); + function label(d3) { + if (d3.sets in labels) { + return labels[d3.sets]; + } + if (d3.sets.length == 1) { + return "" + d3.sets[0]; + } + } + __name(label, "label"); + selection2.selectAll("svg").data([circles]).enter().append("svg"); + const svg2 = selection2.select("svg"); + if (useViewBox) { + svg2.attr("viewBox", `0 0 ${width3} ${height2}`); + } else { + svg2.attr("width", width3).attr("height", height2); + } + const previous = {}; + let hasPrevious = false; + svg2.selectAll(".venn-area path").each(function(d3) { + const path4 = this.getAttribute("d"); + if (d3.sets.length == 1 && path4 && !distinct) { + hasPrevious = true; + previous[d3.sets[0]] = circleFromPath(path4); + } + }); + function pathTween(d3) { + return (t4) => { + const c3 = d3.sets.map((set5) => { + let start3 = previous[set5]; + let end2 = circles[set5]; + if (!start3) { + start3 = { x: width3 / 2, y: height2 / 2, radius: 1 }; + } + if (!end2) { + end2 = { x: width3 / 2, y: height2 / 2, radius: 1 }; + } + return { + x: start3.x * (1 - t4) + end2.x * t4, + y: start3.y * (1 - t4) + end2.y * t4, + radius: start3.radius * (1 - t4) + end2.radius * t4 + }; + }); + return intersectionAreaPath(c3, round); + }; + } + __name(pathTween, "pathTween"); + const nodes5 = svg2.selectAll(".venn-area").data(data5, (d3) => d3.sets); + const enter = nodes5.enter().append("g").attr( + "class", + (d3) => `venn-area venn-${d3.sets.length == 1 ? "circle" : "intersection"}${d3.colour || d3.color ? " venn-coloured" : ""}` + ).attr("data-venn-sets", (d3) => d3.sets.join("_")); + const enterPath = enter.append("path"); + const enterText = enter.append("text").attr("class", "label").text((d3) => label(d3)).attr("text-anchor", "middle").attr("dy", ".35em").attr("x", width3 / 2).attr("y", height2 / 2); + if (styled) { + enterPath.style("fill-opacity", "0").filter((d3) => d3.sets.length == 1).style("fill", (d3) => d3.colour ? d3.colour : d3.color ? d3.color : colours(d3.sets)).style("fill-opacity", ".25"); + enterText.style("fill", (d3) => { + if (d3.colour || d3.color) { + return "#FFF"; + } + if (options2.textFill) { + return options2.textFill; + } + return d3.sets.length == 1 ? colours(d3.sets) : "#444"; + }); + } + function asTransition(s2) { + if (typeof s2.transition === "function") { + return s2.transition("venn").duration(duration); + } + return s2; + } + __name(asTransition, "asTransition"); + let update2 = selection2; + if (hasPrevious && typeof update2.transition === "function") { + update2 = asTransition(selection2); + update2.selectAll("path").attrTween("d", pathTween); + } else { + update2.selectAll("path").attr("d", (d3) => intersectionAreaPath(d3.sets.map((set5) => circles[set5])), round); + } + const updateText = update2.selectAll("text").filter((d3) => d3.sets in textCentres).text((d3) => label(d3)).attr("x", (d3) => Math.floor(textCentres[d3.sets].x)).attr("y", (d3) => Math.floor(textCentres[d3.sets].y)); + if (wrap3) { + if (hasPrevious) { + if ("on" in updateText) { + updateText.on("end", wrapText2(circles, label)); + } else { + updateText.each("end", wrapText2(circles, label)); + } + } else { + updateText.each(wrapText2(circles, label)); + } + } + const exit = asTransition(nodes5.exit()).remove(); + if (typeof nodes5.transition === "function") { + exit.selectAll("path").attrTween("d", pathTween); + } + const exitText = exit.selectAll("text").attr("x", width3 / 2).attr("y", height2 / 2); + if (fontSize !== null) { + enterText.style("font-size", "0px"); + updateText.style("font-size", fontSize); + exitText.style("font-size", "0px"); + } + return { circles, textCentres, nodes: nodes5, enter, update: update2, exit }; + } + __name(chart, "chart"); + chart.wrap = function(_3) { + if (!arguments.length) return wrap3; + wrap3 = _3; + return chart; + }; + chart.useViewBox = function() { + useViewBox = true; + return chart; + }; + chart.width = function(_3) { + if (!arguments.length) return width3; + width3 = _3; + return chart; + }; + chart.height = function(_3) { + if (!arguments.length) return height2; + height2 = _3; + return chart; + }; + chart.padding = function(_3) { + if (!arguments.length) return padding2; + padding2 = _3; + return chart; + }; + chart.distinct = function(_3) { + if (!arguments.length) return distinct; + distinct = _3; + return chart; + }; + chart.colours = function(_3) { + if (!arguments.length) return colours; + colours = _3; + return chart; + }; + chart.colors = function(_3) { + if (!arguments.length) return colours; + colours = _3; + return chart; + }; + chart.fontSize = function(_3) { + if (!arguments.length) return fontSize; + fontSize = _3; + return chart; + }; + chart.round = function(_3) { + if (!arguments.length) return round; + round = _3; + return chart; + }; + chart.duration = function(_3) { + if (!arguments.length) return duration; + duration = _3; + return chart; + }; + chart.layoutFunction = function(_3) { + if (!arguments.length) return layoutFunction; + layoutFunction = _3; + return chart; + }; + chart.normalize = function(_3) { + if (!arguments.length) return normalize4; + normalize4 = _3; + return chart; + }; + chart.scaleToFit = function(_3) { + if (!arguments.length) return scaleToFit; + scaleToFit = _3; + return chart; + }; + chart.styled = function(_3) { + if (!arguments.length) return styled; + styled = _3; + return chart; + }; + chart.orientation = function(_3) { + if (!arguments.length) return orientation; + orientation = _3; + return chart; + }; + chart.orientationOrder = function(_3) { + if (!arguments.length) return orientationOrder; + orientationOrder = _3; + return chart; + }; + chart.lossFunction = function(_3) { + if (!arguments.length) return loss; + loss = _3 === "default" ? lossFunction : _3 === "logRatio" ? logRatioLossFunction : _3; + return chart; + }; + return chart; + } + function wrapText2(circles, labeller) { + return function(data5) { + const text4 = this; + const width3 = circles[data5.sets[0]].radius || 50; + const label = labeller(data5) || ""; + const words = label.split(/\s+/).reverse(); + const maxLines = 3; + const minChars = (label.length + words.length) / maxLines; + let word = words.pop(); + let line2 = [word]; + let lineNumber = 0; + const lineHeight = 1.1; + text4.textContent = null; + const tspans = []; + function append3(word2) { + const tspan2 = text4.ownerDocument.createElementNS(text4.namespaceURI, "tspan"); + tspan2.textContent = word2; + tspans.push(tspan2); + text4.append(tspan2); + return tspan2; + } + __name(append3, "append"); + let tspan = append3(word); + while (true) { + word = words.pop(); + if (!word) { + break; + } + line2.push(word); + const joined = line2.join(" "); + tspan.textContent = joined; + if (joined.length > minChars && tspan.getComputedTextLength() > width3) { + line2.pop(); + tspan.textContent = line2.join(" "); + line2 = [word]; + tspan = append3(word); + lineNumber++; + } + } + const initial2 = 0.35 - lineNumber * lineHeight / 2; + const x5 = text4.getAttribute("x"); + const y6 = text4.getAttribute("y"); + tspans.forEach((t4, i2) => { + t4.setAttribute("x", x5); + t4.setAttribute("y", y6); + t4.setAttribute("dy", `${initial2 + i2 * lineHeight}em`); + }); + }; + } + function circleMargin(current, interior, exterior) { + let margin = interior[0].radius - distance2(interior[0], current); + for (let i2 = 1; i2 < interior.length; ++i2) { + const m3 = interior[i2].radius - distance2(interior[i2], current); + if (m3 <= margin) { + margin = m3; + } + } + for (let i2 = 0; i2 < exterior.length; ++i2) { + const m3 = distance2(exterior[i2], current) - exterior[i2].radius; + if (m3 <= margin) { + margin = m3; + } + } + return margin; + } + function computeTextCentre(interior, exterior, symmetricalTextCentre) { + const points = []; + for (const c3 of interior) { + points.push({ x: c3.x, y: c3.y }); + points.push({ x: c3.x + c3.radius / 2, y: c3.y }); + points.push({ x: c3.x - c3.radius / 2, y: c3.y }); + points.push({ x: c3.x, y: c3.y + c3.radius / 2 }); + points.push({ x: c3.x, y: c3.y - c3.radius / 2 }); + } + let initial2 = points[0]; + let margin = circleMargin(points[0], interior, exterior); + for (let i2 = 1; i2 < points.length; ++i2) { + const m3 = circleMargin(points[i2], interior, exterior); + if (m3 >= margin) { + initial2 = points[i2]; + margin = m3; + } + } + const solution = nelderMead( + (p3) => -1 * circleMargin({ x: p3[0], y: p3[1] }, interior, exterior), + [initial2.x, initial2.y], + { maxIterations: 500, minErrorDelta: 1e-10 } + ).x; + const ret = { x: symmetricalTextCentre ? 0 : solution[0], y: solution[1] }; + let valid2 = true; + for (const i2 of interior) { + if (distance2(ret, i2) > i2.radius) { + valid2 = false; + break; + } + } + for (const e3 of exterior) { + if (distance2(ret, e3) < e3.radius) { + valid2 = false; + break; + } + } + if (valid2) { + return ret; + } + if (interior.length == 1) { + return { x: interior[0].x, y: interior[0].y }; + } + const areaStats = {}; + intersectionArea(interior, areaStats); + if (areaStats.arcs.length === 0) { + return { x: 0, y: -1e3, disjoint: true }; + } + if (areaStats.arcs.length == 1) { + return { x: areaStats.arcs[0].circle.x, y: areaStats.arcs[0].circle.y }; + } + if (exterior.length) { + return computeTextCentre(interior, []); + } + return getCenter(areaStats.arcs.map((a2) => a2.p1)); + } + function getOverlappingCircles(circles) { + const ret = {}; + const circleids = Object.keys(circles); + for (const circleid of circleids) { + ret[circleid] = []; + } + for (let i2 = 0; i2 < circleids.length; i2++) { + const ci = circleids[i2]; + const a2 = circles[ci]; + for (let j3 = i2 + 1; j3 < circleids.length; ++j3) { + const cj = circleids[j3]; + const b3 = circles[cj]; + const d3 = distance2(a2, b3); + if (d3 + b3.radius <= a2.radius + 1e-10) { + ret[cj].push(ci); + } else if (d3 + a2.radius <= b3.radius + 1e-10) { + ret[ci].push(cj); + } + } + } + return ret; + } + function computeTextCentres(circles, areas, symmetricalTextCentre) { + const ret = {}; + const overlapped = getOverlappingCircles(circles); + for (let i2 = 0; i2 < areas.length; ++i2) { + const area = areas[i2].sets; + const areaids = {}; + const exclude = {}; + for (let j3 = 0; j3 < area.length; ++j3) { + areaids[area[j3]] = true; + const overlaps = overlapped[area[j3]]; + for (let k2 = 0; k2 < overlaps.length; ++k2) { + exclude[overlaps[k2]] = true; + } + } + const interior = []; + const exterior = []; + for (let setid in circles) { + if (setid in areaids) { + interior.push(circles[setid]); + } else if (!(setid in exclude)) { + exterior.push(circles[setid]); + } + } + const centre = computeTextCentre(interior, exterior, symmetricalTextCentre); + ret[area] = centre; + if (centre.disjoint && areas[i2].size > 0) { + console.log("WARNING: area " + area + " not represented on screen"); + } + } + return ret; + } + function circlePath(x5, y6, r2) { + const ret = []; + ret.push("\nM", x5, y6); + ret.push("\nm", -r2, 0); + ret.push("\na", r2, r2, 0, 1, 0, r2 * 2, 0); + ret.push("\na", r2, r2, 0, 1, 0, -r2 * 2, 0); + return ret.join(" "); + } + function circleFromPath(path4) { + const tokens2 = path4.split(" "); + return { x: Number.parseFloat(tokens2[1]), y: Number.parseFloat(tokens2[2]), radius: -Number.parseFloat(tokens2[4]) }; + } + function intersectionAreaArcs(circles) { + if (circles.length === 0) { + return []; + } + const stats = {}; + intersectionArea(circles, stats); + return stats.arcs; + } + function arcsToPath(arcs, round) { + if (arcs.length === 0) { + return "M 0 0"; + } + const rFactor = Math.pow(10, round || 0); + const r2 = round != null ? (v3) => Math.round(v3 * rFactor) / rFactor : (v3) => v3; + if (arcs.length == 1) { + const circle6 = arcs[0].circle; + return circlePath(r2(circle6.x), r2(circle6.y), r2(circle6.radius)); + } + const ret = ["\nM", r2(arcs[0].p2.x), r2(arcs[0].p2.y)]; + for (const arc of arcs) { + const radius2 = r2(arc.circle.radius); + ret.push("\nA", radius2, radius2, 0, arc.large ? 1 : 0, arc.sweep ? 1 : 0, r2(arc.p1.x), r2(arc.p1.y)); + } + return ret.join(" "); + } + function intersectionAreaPath(circles, round) { + return arcsToPath(intersectionAreaArcs(circles), round); + } + function layout6(data5, options2 = {}) { + const { + lossFunction: loss, + layoutFunction: layout7 = venn, + normalize: normalize4 = true, + orientation = Math.PI / 2, + orientationOrder, + width: width3 = 600, + height: height2 = 350, + padding: padding2 = 15, + scaleToFit = false, + symmetricalTextCentre = false, + distinct, + round = 2 + } = options2; + let solution = layout7(data5, { + lossFunction: loss === "default" || !loss ? lossFunction : loss === "logRatio" ? logRatioLossFunction : loss, + distinct + }); + if (normalize4) { + solution = normalizeSolution(solution, orientation, orientationOrder); + } + const circles = scaleSolution(solution, width3, height2, padding2, scaleToFit); + const textCentres = computeTextCentres(circles, data5, symmetricalTextCentre); + const circleLookup = new Map( + Object.keys(circles).map((set5) => [ + set5, + { + set: set5, + x: circles[set5].x, + y: circles[set5].y, + radius: circles[set5].radius + } + ]) + ); + const helpers = data5.map((area) => { + const circles2 = area.sets.map((s2) => circleLookup.get(s2)); + const arcs = intersectionAreaArcs(circles2); + const path4 = arcsToPath(arcs, round); + return { circles: circles2, arcs, path: path4, area, has: new Set(area.sets) }; + }); + function genDistinctPath(sets) { + let r2 = ""; + for (const e3 of helpers) { + if (e3.has.size > sets.length && sets.every((s2) => e3.has.has(s2))) { + r2 += " " + e3.path; + } + } + return r2; + } + __name(genDistinctPath, "genDistinctPath"); + return helpers.map(({ circles: circles2, arcs, path: path4, area }) => { + return { + data: area, + text: textCentres[area.sets], + circles: circles2, + arcs, + path: path4, + distinctPath: path4 + genDistinctPath(area.sets) + }; + }); + } + var SMALL$1, SMALL; + var init_venn_esm = __esm({ + "../../node_modules/.pnpm/@upsetjs+venn.js@2.0.0/node_modules/@upsetjs/venn.js/build/venn.esm.js"() { + "use strict"; + SMALL$1 = 1e-10; + __name(intersectionArea, "intersectionArea"); + __name(containedInCircles, "containedInCircles"); + __name(getIntersectionPoints, "getIntersectionPoints"); + __name(circleArea, "circleArea"); + __name(distance2, "distance"); + __name(circleOverlap, "circleOverlap"); + __name(circleCircleIntersection, "circleCircleIntersection"); + __name(getCenter, "getCenter"); + __name(bisect, "bisect"); + __name(zeros, "zeros"); + __name(zerosM, "zerosM"); + __name(dot, "dot"); + __name(norm2, "norm2"); + __name(scale2, "scale"); + __name(weightedSum, "weightedSum"); + __name(nelderMead, "nelderMead"); + __name(wolfeLineSearch, "wolfeLineSearch"); + __name(conjugateGradient, "conjugateGradient"); + __name(venn, "venn"); + SMALL = 1e-10; + __name(distanceFromIntersectArea, "distanceFromIntersectArea"); + __name(addMissingAreas, "addMissingAreas"); + __name(getDistanceMatrices, "getDistanceMatrices"); + __name(constrainedMDSGradient, "constrainedMDSGradient"); + __name(bestInitialLayout, "bestInitialLayout"); + __name(constrainedMDSLayout, "constrainedMDSLayout"); + __name(greedyLayout, "greedyLayout"); + __name(lossFunction, "lossFunction"); + __name(logRatioLossFunction, "logRatioLossFunction"); + __name(orientateCircles, "orientateCircles"); + __name(disjointCluster, "disjointCluster"); + __name(getBoundingBox, "getBoundingBox"); + __name(normalizeSolution, "normalizeSolution"); + __name(scaleSolution, "scaleSolution"); + __name(toObjectNotation, "toObjectNotation"); + __name(fromObjectNotation, "fromObjectNotation"); + __name(VennDiagram, "VennDiagram"); + __name(wrapText2, "wrapText"); + __name(circleMargin, "circleMargin"); + __name(computeTextCentre, "computeTextCentre"); + __name(getOverlappingCircles, "getOverlappingCircles"); + __name(computeTextCentres, "computeTextCentres"); + __name(circlePath, "circlePath"); + __name(circleFromPath, "circleFromPath"); + __name(intersectionAreaArcs, "intersectionAreaArcs"); + __name(arcsToPath, "arcsToPath"); + __name(intersectionAreaPath, "intersectionAreaPath"); + __name(layout6, "layout"); + } + }); + + // src/diagrams/venn/vennRenderer.ts + function buildStyleByKey(styleData) { + const map6 = /* @__PURE__ */ new Map(); + for (const entry of styleData) { + const key = entry.targets.join("|"); + const existing = map6.get(key); + if (existing) { + Object.assign(existing, entry.styles); + } else { + map6.set(key, { ...entry.styles }); + } + } + return map6; + } + function stableSetsKey(setIds) { + return setIds.join("|"); + } + function renderTextNodes(config5, layoutByKey, dummyD3root, textNodes2, scale3, styleByKey) { + const useDebugLayout = config5?.useDebugLayout ?? false; + const vennSvg = dummyD3root.select("svg"); + const textGroup = vennSvg.append("g").attr("class", "venn-text-nodes"); + const nodesByArea = /* @__PURE__ */ new Map(); + for (const node2 of textNodes2) { + const key = stableSetsKey(node2.sets); + const existing = nodesByArea.get(key); + if (existing) { + existing.push(node2); + } else { + nodesByArea.set(key, [node2]); + } + } + for (const [key, nodes5] of nodesByArea.entries()) { + const area = layoutByKey.get(key); + if (!area?.text) { + continue; + } + const centerX = area.text.x; + const centerY = area.text.y; + const minCircleRadius = Math.min(...area.circles.map((c3) => c3.radius)); + const innerRadiusRaw = Math.min( + ...area.circles.map((c3) => c3.radius - Math.hypot(centerX - c3.x, centerY - c3.y)) + ); + let innerRadius = Number.isFinite(innerRadiusRaw) ? Math.max(0, innerRadiusRaw) : 0; + if (innerRadius === 0 && Number.isFinite(minCircleRadius)) { + innerRadius = minCircleRadius * 0.6; + } + const areaGroup = textGroup.append("g").attr("class", "venn-text-area").attr("font-size", `${40 * scale3}px`); + if (useDebugLayout) { + areaGroup.append("circle").attr("class", "venn-text-debug-circle").attr("cx", centerX).attr("cy", centerY).attr("r", innerRadius).attr("fill", "none").attr("stroke", "purple").attr("stroke-width", 1.5 * scale3).attr("stroke-dasharray", `${6 * scale3} ${4 * scale3}`); + } + const innerWidth = Math.max(80 * scale3, innerRadius * 2 * 0.95); + const innerHeight = Math.max(60 * scale3, innerRadius * 2 * 0.95); + const hasLabel = area.data.label && area.data.label.length > 0; + const labelOffsetBase = hasLabel ? Math.min(32 * scale3, innerRadius * 0.25) : 0; + const labelOffset = labelOffsetBase + (nodes5.length <= 2 ? 30 * scale3 : 0); + const startX2 = centerX - innerWidth / 2; + const startY2 = centerY - innerHeight / 2 + labelOffset; + const cols = Math.max(1, Math.ceil(Math.sqrt(nodes5.length))); + const rows = Math.max(1, Math.ceil(nodes5.length / cols)); + const cellWidth = innerWidth / cols; + const cellHeight = innerHeight / rows; + for (const [i2, node2] of nodes5.entries()) { + const col = i2 % cols; + const row = Math.floor(i2 / cols); + const x5 = startX2 + cellWidth * (col + 0.5); + const y6 = startY2 + cellHeight * (row + 0.5); + if (useDebugLayout) { + areaGroup.append("rect").attr("class", "venn-text-debug-cell").attr("x", startX2 + cellWidth * col).attr("y", startY2 + cellHeight * row).attr("width", cellWidth).attr("height", cellHeight).attr("fill", "none").attr("stroke", "teal").attr("stroke-width", 1 * scale3).attr("stroke-dasharray", `${4 * scale3} ${3 * scale3}`); + } + const boxWidth = cellWidth * 0.9; + const boxHeight = cellHeight * 0.9; + const container2 = areaGroup.append("foreignObject").attr("class", "venn-text-node-fo").attr("width", boxWidth).attr("height", boxHeight).attr("x", x5 - boxWidth / 2).attr("y", y6 - boxHeight / 2).attr("overflow", "visible"); + const textColor = styleByKey.get(node2.id)?.color; + const text4 = container2.append("xhtml:span").attr("class", "venn-text-node").style("display", "flex").style("width", "100%").style("height", "100%").style("white-space", "normal").style("align-items", "center").style("justify-content", "center").style("text-align", "center").style("overflow-wrap", "normal").style("word-break", "normal").text(node2.label ?? node2.id); + if (textColor) { + text4.style("color", textColor); + } + } + } + } + var draw29, renderer11; + var init_vennRenderer = __esm({ + "src/diagrams/venn/vennRenderer.ts"() { + "use strict"; + init_src32(); + init_dist(); + init_config(); + init_selectSvgElement(); + init_venn_esm(); + init_setupGraphViewbox(); + init_rough_esm(); + __name(buildStyleByKey, "buildStyleByKey"); + draw29 = /* @__PURE__ */ __name((_text, id35, _version, diagObj) => { + const db10 = diagObj.db; + const config5 = db10.getConfig?.(); + const { themeVariables, look, handDrawnSeed } = getConfig(); + const isHandDrawn = look === "handDrawn"; + const themeColors = [ + themeVariables.venn1, + themeVariables.venn2, + themeVariables.venn3, + themeVariables.venn4, + themeVariables.venn5, + themeVariables.venn6, + themeVariables.venn7, + themeVariables.venn8 + ].filter(Boolean); + const title2 = db10.getDiagramTitle?.(); + const sets = db10.getSubsetData(); + const textNodes2 = db10.getTextData(); + const styleByKey = buildStyleByKey(db10.getStyleData()); + const svgWidth = config5?.width ?? 800; + const svgHeight = config5?.height ?? 450; + const REFERENCE_WIDTH = 1600; + const scale3 = svgWidth / REFERENCE_WIDTH; + const titleHeight = title2 ? 48 * scale3 : 0; + const defaultTextColor = themeVariables.primaryTextColor ?? themeVariables.textColor; + const svg2 = selectSvgElement(id35); + svg2.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`); + if (title2) { + svg2.append("text").text(title2).attr("class", "venn-title").attr("font-size", `${32 * scale3}px`).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("x", "50%").attr("y", 32 * scale3).style("fill", themeVariables.vennTitleTextColor || themeVariables.titleColor); + } + const dummyD3root = select_default2(document.createElement("div")); + const vennDiagram = VennDiagram().width(svgWidth).height(svgHeight - titleHeight); + dummyD3root.datum(sets).call(vennDiagram); + const roughSvg = isHandDrawn ? at.svg(dummyD3root.select("svg").node()) : void 0; + const layoutAreas = layout6(sets, { + width: svgWidth, + height: svgHeight - titleHeight, + padding: config5?.padding ?? 15 + }); + const layoutByKey = /* @__PURE__ */ new Map(); + for (const area of layoutAreas) { + const key = stableSetsKey([...area.data.sets].sort()); + layoutByKey.set(key, area); + } + if (textNodes2.length > 0) { + renderTextNodes(config5, layoutByKey, dummyD3root, textNodes2, scale3, styleByKey); + } + const themeDark = is_dark_default(themeVariables.background || "#f4f4f4"); + dummyD3root.selectAll(".venn-circle").each(function(d3, i2) { + const group2 = select_default2(this); + const data5 = d3; + const setsKey = stableSetsKey([...data5.sets].sort()); + const customStyle = styleByKey.get(setsKey); + const baseColor = customStyle?.fill || themeColors[i2 % themeColors.length] || themeVariables.primaryColor; + group2.classed(`venn-set-${i2 % 8}`, true); + const fillOpacity = customStyle?.["fill-opacity"] ?? 0.1; + const strokeColor = customStyle?.stroke || baseColor; + const strokeWidthVal = customStyle?.["stroke-width"] || `${5 * scale3}`; + if (isHandDrawn && roughSvg) { + const layoutArea = layoutByKey.get(setsKey); + if (layoutArea && layoutArea.circles.length > 0) { + const c3 = layoutArea.circles[0]; + const roughNode = roughSvg.circle(c3.x, c3.y, c3.radius * 2, { + roughness: 0.7, + seed: handDrawnSeed, + fill: transparentize_default(baseColor, 0.7), + fillStyle: "hachure", + fillWeight: 2, + hachureGap: 8, + hachureAngle: -41 + i2 * 60, + stroke: strokeColor, + strokeWidth: parseFloat(String(strokeWidthVal)) + }); + group2.select("path").remove(); + group2.node()?.insertBefore(roughNode, group2.select("text").node()); + } + } else { + group2.select("path").style("fill", baseColor).style("fill-opacity", fillOpacity).style("stroke", strokeColor).style("stroke-width", strokeWidthVal).style("stroke-opacity", 0.95); + } + const textColor = customStyle?.color || (themeDark ? lighten_default(baseColor, 30) : darken_default(baseColor, 30)); + group2.select("text").style("font-size", `${48 * scale3}px`).style("fill", textColor); + }); + if (isHandDrawn && roughSvg) { + dummyD3root.selectAll(".venn-intersection").each(function(d3) { + const group2 = select_default2(this); + const data5 = d3; + const setsKey = stableSetsKey([...data5.sets].sort()); + const customStyle = styleByKey.get(setsKey); + const customFill = customStyle?.fill; + if (customFill) { + const pathEl = group2.select("path"); + const pathD = pathEl.attr("d"); + if (pathD) { + const roughNode = roughSvg.path(pathD, { + roughness: 0.7, + seed: handDrawnSeed, + fill: transparentize_default(customFill, 0.3), + fillStyle: "cross-hatch", + fillWeight: 2, + hachureGap: 6, + hachureAngle: 60, + stroke: "none" + }); + const existingPath = pathEl.node(); + existingPath?.parentNode?.insertBefore(roughNode, existingPath); + pathEl.remove(); + } + } else { + group2.select("path").style("fill-opacity", 0); + } + group2.select("text").style("font-size", `${48 * scale3}px`).style("fill", customStyle?.color ?? themeVariables.vennSetTextColor ?? defaultTextColor); + }); + } else { + dummyD3root.selectAll(".venn-intersection text").style("font-size", `${48 * scale3}px`).style("fill", (e3) => { + const data5 = e3; + const setsKey = stableSetsKey([...data5.sets].sort()); + return styleByKey.get(setsKey)?.color ?? themeVariables.vennSetTextColor ?? defaultTextColor; + }); + dummyD3root.selectAll(".venn-intersection path").style("fill-opacity", (e3) => { + const data5 = e3; + const setsKey = stableSetsKey([...data5.sets].sort()); + return styleByKey.get(setsKey)?.fill ? 1 : 0; + }).style("fill", (e3) => { + const data5 = e3; + const setsKey = stableSetsKey([...data5.sets].sort()); + return styleByKey.get(setsKey)?.fill ?? "transparent"; + }); + } + const vennGroup = svg2.append("g").attr("transform", `translate(0, ${titleHeight})`); + const dummySvg = dummyD3root.select("svg").node(); + if (dummySvg && "childNodes" in dummySvg) { + for (const child of [...dummySvg.childNodes]) { + vennGroup.node()?.appendChild(child); + } + } + configureSvgSize(svg2, svgHeight, svgWidth, config5?.useMaxWidth ?? true); + }, "draw"); + __name(stableSetsKey, "stableSetsKey"); + __name(renderTextNodes, "renderTextNodes"); + renderer11 = { draw: draw29 }; + } + }); + + // src/diagrams/venn/vennDiagram.ts + var vennDiagram_exports = {}; + __export(vennDiagram_exports, { + diagram: () => diagram29 + }); + var diagram29; + var init_vennDiagram = __esm({ + "src/diagrams/venn/vennDiagram.ts"() { + "use strict"; + init_venn(); + init_vennDB(); + init_styles21(); + init_vennRenderer(); + diagram29 = { + parser: venn_default, + db: db9, + renderer: renderer11, + styles: styles_default19 + }; + } + }); + + // src/diagrams/treemap/db.ts + var TreeMapDB; + var init_db5 = __esm({ + "src/diagrams/treemap/db.ts"() { + "use strict"; + init_defaultConfig(); + init_config(); + init_utils2(); + init_handDrawnShapeStyles(); + init_commonDb(); + TreeMapDB = class { + constructor() { + this.nodes = []; + this.levels = /* @__PURE__ */ new Map(); + this.outerNodes = []; + this.classes = /* @__PURE__ */ new Map(); + this.setAccTitle = setAccTitle; + this.getAccTitle = getAccTitle; + this.setDiagramTitle = setDiagramTitle; + this.getDiagramTitle = getDiagramTitle; + this.getAccDescription = getAccDescription; + this.setAccDescription = setAccDescription; + } + static { + __name(this, "TreeMapDB"); + } + getNodes() { + return this.nodes; + } + getConfig() { + const defaultConfig5 = defaultConfig_default; + const userConfig = getConfig(); + return cleanAndMerge({ + ...defaultConfig5.treemap, + ...userConfig.treemap ?? {} + }); + } + addNode(node2, level) { + this.nodes.push(node2); + this.levels.set(node2, level); + if (level === 0) { + this.outerNodes.push(node2); + this.root ??= node2; + } + } + getRoot() { + return { name: "", children: this.outerNodes }; + } + addClass(id35, _style) { + const styleClass = this.classes.get(id35) ?? { id: id35, styles: [], textStyles: [] }; + const styles6 = _style.replace(/\\,/g, "\xA7\xA7\xA7").replace(/,/g, ";").replace(/§§§/g, ",").split(";"); + if (styles6) { + styles6.forEach((s2) => { + if (isLabelStyle(s2)) { + if (styleClass?.textStyles) { + styleClass.textStyles.push(s2); + } else { + styleClass.textStyles = [s2]; + } + } + if (styleClass?.styles) { + styleClass.styles.push(s2); + } else { + styleClass.styles = [s2]; + } + }); + } + this.classes.set(id35, styleClass); + } + getClasses() { + return this.classes; + } + getStylesForClass(classSelector) { + return this.classes.get(classSelector)?.styles ?? []; + } + clear() { + clear(); + this.nodes = []; + this.levels = /* @__PURE__ */ new Map(); + this.outerNodes = []; + this.classes = /* @__PURE__ */ new Map(); + this.root = void 0; + } + }; + } + }); + + // src/diagrams/treemap/utils.ts + function buildHierarchy(items) { + if (!items.length) { + return []; + } + const root4 = []; + const stack = []; + items.forEach((item) => { + const node2 = { + name: item.name, + children: item.type === "Leaf" ? void 0 : [] + }; + node2.classSelector = item?.classSelector; + if (item?.cssCompiledStyles) { + node2.cssCompiledStyles = item.cssCompiledStyles; + } + if (item.type === "Leaf" && item.value !== void 0) { + node2.value = item.value; + } + while (stack.length > 0 && stack[stack.length - 1].level >= item.level) { + stack.pop(); + } + if (stack.length === 0) { + root4.push(node2); + } else { + const parent4 = stack[stack.length - 1].node; + if (parent4.children) { + parent4.children.push(node2); + } else { + parent4.children = [node2]; + } + } + if (item.type !== "Leaf") { + stack.push({ node: node2, level: item.level }); + } + }); + return root4; + } + var init_utils4 = __esm({ + "src/diagrams/treemap/utils.ts"() { + "use strict"; + __name(buildHierarchy, "buildHierarchy"); + } + }); + + // src/diagrams/treemap/parser.ts + var populate19, getItemName, parser27; + var init_parser5 = __esm({ + "src/diagrams/treemap/parser.ts"() { + "use strict"; + init_mermaid_parser_core(); + init_logger(); + init_populateCommonDb(); + init_utils4(); + init_db5(); + populate19 = /* @__PURE__ */ __name((ast, db10) => { + populateCommonDb(ast, db10); + const items = []; + for (const row of ast.TreemapRows ?? []) { + if (row.$type === "ClassDefStatement") { + db10.addClass(row.className ?? "", row.styleText ?? ""); + } + } + for (const row of ast.TreemapRows ?? []) { + const item = row.item; + if (!item) { + continue; + } + const level = row.indent ? parseInt(row.indent) : 0; + const name = getItemName(item); + const styles6 = item.classSelector ? db10.getStylesForClass(item.classSelector) : []; + const cssCompiledStyles = styles6.length > 0 ? styles6 : void 0; + const itemData = { + level, + name, + type: item.$type, + value: item.value, + classSelector: item.classSelector, + cssCompiledStyles + }; + items.push(itemData); + } + const hierarchyNodes = buildHierarchy(items); + const addNodesRecursively = /* @__PURE__ */ __name((nodes5, level) => { + for (const node2 of nodes5) { + db10.addNode(node2, level); + if (node2.children && node2.children.length > 0) { + addNodesRecursively(node2.children, level + 1); + } + } + }, "addNodesRecursively"); + addNodesRecursively(hierarchyNodes, 0); + }, "populate"); + getItemName = /* @__PURE__ */ __name((item) => { + return item.name ? String(item.name) : ""; + }, "getItemName"); + parser27 = { + // @ts-expect-error - TreeMapDB is not assignable to DiagramDB + parser: { yy: void 0 }, + parse: /* @__PURE__ */ __name(async (text4) => { + try { + const parseFunc = parse3; + const ast = await parseFunc("treemap", text4); + log.debug("Treemap AST:", ast); + const db10 = parser27.parser?.yy; + if (!(db10 instanceof TreeMapDB)) { + throw new Error( + "parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues." + ); + } + populate19(ast, db10); + } catch (error3) { + log.error("Error parsing treemap:", error3); + throw error3; + } + }, "parse") + }; + } + }); + + // src/diagrams/treemap/renderer.ts + var DEFAULT_INNER_PADDING, SECTION_INNER_PADDING, SECTION_HEADER_HEIGHT, draw30, getClasses6, renderer12; + var init_renderer5 = __esm({ + "src/diagrams/treemap/renderer.ts"() { + "use strict"; + init_selectSvgElement(); + init_setupViewPortForSVG(); + init_setupGraphViewbox(); + init_src32(); + init_handDrawnShapeStyles(); + init_config(); + init_logger(); + DEFAULT_INNER_PADDING = 10; + SECTION_INNER_PADDING = 10; + SECTION_HEADER_HEIGHT = 25; + draw30 = /* @__PURE__ */ __name((_text, id35, _version, diagram32) => { + const treemapDb = diagram32.db; + const config5 = treemapDb.getConfig(); + const treemapInnerPadding = config5.padding ?? DEFAULT_INNER_PADDING; + const title2 = treemapDb.getDiagramTitle(); + const root4 = treemapDb.getRoot(); + const { themeVariables } = getConfig(); + if (!root4) { + return; + } + const titleHeight = title2 ? 30 : 0; + const svg2 = selectSvgElement(id35); + const width3 = config5.nodeWidth ? config5.nodeWidth * SECTION_INNER_PADDING : 960; + const height2 = config5.nodeHeight ? config5.nodeHeight * SECTION_INNER_PADDING : 500; + const svgWidth = width3; + const svgHeight = height2 + titleHeight; + svg2.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`); + configureSvgSize(svg2, svgHeight, svgWidth, config5.useMaxWidth); + let valueFormat; + try { + const formatStr = config5.valueFormat || ","; + if (formatStr === "$0,0") { + valueFormat = /* @__PURE__ */ __name((value2) => "$" + format2(",")(value2), "valueFormat"); + } else if (formatStr.startsWith("$") && formatStr.includes(",")) { + const precision = /\.\d+/.exec(formatStr); + const precisionStr = precision ? precision[0] : ""; + valueFormat = /* @__PURE__ */ __name((value2) => "$" + format2("," + precisionStr)(value2), "valueFormat"); + } else if (formatStr.startsWith("$")) { + const restOfFormat = formatStr.substring(1); + valueFormat = /* @__PURE__ */ __name((value2) => "$" + format2(restOfFormat || "")(value2), "valueFormat"); + } else { + valueFormat = format2(formatStr); + } + } catch (error3) { + log.error("Error creating format function:", error3); + valueFormat = format2(","); + } + const colorScale = ordinal().range([ + "transparent", + themeVariables.cScale0, + themeVariables.cScale1, + themeVariables.cScale2, + themeVariables.cScale3, + themeVariables.cScale4, + themeVariables.cScale5, + themeVariables.cScale6, + themeVariables.cScale7, + themeVariables.cScale8, + themeVariables.cScale9, + themeVariables.cScale10, + themeVariables.cScale11 + ]); + const colorScalePeer = ordinal().range([ + "transparent", + themeVariables.cScalePeer0, + themeVariables.cScalePeer1, + themeVariables.cScalePeer2, + themeVariables.cScalePeer3, + themeVariables.cScalePeer4, + themeVariables.cScalePeer5, + themeVariables.cScalePeer6, + themeVariables.cScalePeer7, + themeVariables.cScalePeer8, + themeVariables.cScalePeer9, + themeVariables.cScalePeer10, + themeVariables.cScalePeer11 + ]); + const colorScaleLabel = ordinal().range([ + themeVariables.cScaleLabel0, + themeVariables.cScaleLabel1, + themeVariables.cScaleLabel2, + themeVariables.cScaleLabel3, + themeVariables.cScaleLabel4, + themeVariables.cScaleLabel5, + themeVariables.cScaleLabel6, + themeVariables.cScaleLabel7, + themeVariables.cScaleLabel8, + themeVariables.cScaleLabel9, + themeVariables.cScaleLabel10, + themeVariables.cScaleLabel11 + ]); + if (title2) { + svg2.append("text").attr("x", svgWidth / 2).attr("y", titleHeight / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title2); + } + const g2 = svg2.append("g").attr("transform", `translate(0, ${titleHeight})`).attr("class", "treemapContainer"); + const hierarchyRoot = hierarchy(root4).sum((d3) => d3.value ?? 0).sort((a2, b3) => (b3.value ?? 0) - (a2.value ?? 0)); + const treemapLayout = treemap_default().size([width3, height2]).paddingTop( + (d3) => d3.children && d3.children.length > 0 ? SECTION_HEADER_HEIGHT + SECTION_INNER_PADDING : 0 + ).paddingInner(treemapInnerPadding).paddingLeft((d3) => d3.children && d3.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingRight((d3) => d3.children && d3.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingBottom((d3) => d3.children && d3.children.length > 0 ? SECTION_INNER_PADDING : 0).round(true); + const treemapData = treemapLayout(hierarchyRoot); + const branchNodes = treemapData.descendants().filter((d3) => d3.children && d3.children.length > 0); + const sections6 = g2.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class", "treemapSection").attr("transform", (d3) => `translate(${d3.x0},${d3.y0})`); + sections6.append("rect").attr("width", (d3) => d3.x1 - d3.x0).attr("height", SECTION_HEADER_HEIGHT).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (d3) => { + if (d3.depth === 0) { + return "display: none;"; + } + return ""; + }); + sections6.append("clipPath").attr("id", (_d, i2) => `clip-section-${id35}-${i2}`).append("rect").attr("width", (d3) => Math.max(0, d3.x1 - d3.x0 - 12)).attr("height", SECTION_HEADER_HEIGHT); + sections6.append("rect").attr("width", (d3) => d3.x1 - d3.x0).attr("height", (d3) => d3.y1 - d3.y0).attr("class", (_d, i2) => { + return `treemapSection section${i2}`; + }).attr("fill", (d3) => colorScale(d3.data.name)).attr("fill-opacity", 0.6).attr("stroke", (d3) => colorScalePeer(d3.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (d3) => { + if (d3.depth === 0) { + return "display: none;"; + } + const styles6 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles }); + return styles6.nodeStyles + ";" + styles6.borderStyles.join(";"); + }); + sections6.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", SECTION_HEADER_HEIGHT / 2).attr("dominant-baseline", "middle").text((d3) => d3.depth === 0 ? "" : d3.data.name).attr("font-weight", "bold").attr("style", (d3) => { + if (d3.depth === 0) { + return "display: none;"; + } + const labelStyles = "dominant-baseline: middle; font-size: 12px; fill:" + colorScaleLabel(d3.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"; + const styles6 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles }); + return labelStyles + styles6.labelStyles.replace("color:", "fill:"); + }).each(function(d3) { + if (d3.depth === 0) { + return; + } + const self2 = select_default2(this); + const originalText = d3.data.name; + self2.text(originalText); + const totalHeaderWidth = d3.x1 - d3.x0; + const labelXPosition = 6; + let spaceForTextContent; + if (config5.showValues !== false && d3.value) { + const valueEndsAtXRelative = totalHeaderWidth - 10; + const estimatedValueTextActualWidth = 30; + const gapBetweenLabelAndValue = 10; + const labelMustEndBeforeX = valueEndsAtXRelative - estimatedValueTextActualWidth - gapBetweenLabelAndValue; + spaceForTextContent = labelMustEndBeforeX - labelXPosition; + } else { + const labelOwnRightPadding = 6; + spaceForTextContent = totalHeaderWidth - labelXPosition - labelOwnRightPadding; + } + const minimumWidthToDisplay = 15; + const actualAvailableWidth = Math.max(minimumWidthToDisplay, spaceForTextContent); + const textNode = self2.node(); + const currentTextContentLength = textNode.getComputedTextLength(); + if (currentTextContentLength > actualAvailableWidth) { + const ellipsis = "..."; + let currentTruncatedText = originalText; + while (currentTruncatedText.length > 0) { + currentTruncatedText = originalText.substring(0, currentTruncatedText.length - 1); + if (currentTruncatedText.length === 0) { + self2.text(ellipsis); + if (textNode.getComputedTextLength() > actualAvailableWidth) { + self2.text(""); + } + break; + } + self2.text(currentTruncatedText + ellipsis); + if (textNode.getComputedTextLength() <= actualAvailableWidth) { + break; + } + } + } + }); + if (config5.showValues !== false) { + sections6.append("text").attr("class", "treemapSectionValue").attr("x", (d3) => d3.x1 - d3.x0 - 10).attr("y", SECTION_HEADER_HEIGHT / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((d3) => d3.value ? valueFormat(d3.value) : "").attr("font-style", "italic").attr("style", (d3) => { + if (d3.depth === 0) { + return "display: none;"; + } + const labelStyles = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + colorScaleLabel(d3.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"; + const styles6 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles }); + return labelStyles + styles6.labelStyles.replace("color:", "fill:"); + }); + } + const leafNodes = treemapData.leaves(); + const cell = g2.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class", (d3, i2) => { + return `treemapNode treemapLeafGroup leaf${i2}${d3.data.classSelector ? ` ${d3.data.classSelector}` : ""}x`; + }).attr("transform", (d3) => `translate(${d3.x0},${d3.y0})`); + cell.append("rect").attr("width", (d3) => d3.x1 - d3.x0).attr("height", (d3) => d3.y1 - d3.y0).attr("class", "treemapLeaf").attr("fill", (d3) => { + return d3.parent ? colorScale(d3.parent.data.name) : colorScale(d3.data.name); + }).attr("style", (d3) => { + const styles6 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles }); + return styles6.nodeStyles; + }).attr("fill-opacity", 0.3).attr("stroke", (d3) => { + return d3.parent ? colorScale(d3.parent.data.name) : colorScale(d3.data.name); + }).attr("stroke-width", 3); + cell.append("clipPath").attr("id", (_d, i2) => `clip-${id35}-${i2}`).append("rect").attr("width", (d3) => Math.max(0, d3.x1 - d3.x0 - 4)).attr("height", (d3) => Math.max(0, d3.y1 - d3.y0 - 4)); + const leafLabels = cell.append("text").attr("class", "treemapLabel").attr("x", (d3) => (d3.x1 - d3.x0) / 2).attr("y", (d3) => (d3.y1 - d3.y0) / 2).attr("style", (d3) => { + const labelStyles = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + colorScaleLabel(d3.data.name) + ";"; + const styles6 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles }); + return labelStyles + styles6.labelStyles.replace("color:", "fill:"); + }).attr("clip-path", (_d, i2) => `url(#clip-${id35}-${i2})`).text((d3) => d3.data.name); + leafLabels.each(function(d3) { + const self2 = select_default2(this); + const nodeWidth = d3.x1 - d3.x0; + const nodeHeight = d3.y1 - d3.y0; + const textNode = self2.node(); + const padding2 = 4; + const availableWidth = nodeWidth - 2 * padding2; + const availableHeight = nodeHeight - 2 * padding2; + if (availableWidth < 10 || availableHeight < 10) { + self2.style("display", "none"); + return; + } + let currentLabelFontSize = parseInt(self2.style("font-size"), 10); + const minLabelFontSize = 8; + const originalValueRelFontSize = 28; + const valueScaleFactor = 0.6; + const minValueFontSize = 6; + const spacingBetweenLabelAndValue = 2; + while (textNode.getComputedTextLength() > availableWidth && currentLabelFontSize > minLabelFontSize) { + currentLabelFontSize--; + self2.style("font-size", `${currentLabelFontSize}px`); + } + let prospectiveValueFontSize = Math.max( + minValueFontSize, + Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor)) + ); + let combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize; + while (combinedHeight > availableHeight && currentLabelFontSize > minLabelFontSize) { + currentLabelFontSize--; + prospectiveValueFontSize = Math.max( + minValueFontSize, + Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor)) + ); + if (prospectiveValueFontSize < minValueFontSize && currentLabelFontSize === minLabelFontSize) { + break; + } + self2.style("font-size", `${currentLabelFontSize}px`); + combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize; + if (prospectiveValueFontSize <= minValueFontSize && combinedHeight > availableHeight) { + } + } + self2.style("font-size", `${currentLabelFontSize}px`); + if (textNode.getComputedTextLength() > availableWidth || currentLabelFontSize < minLabelFontSize || availableHeight < currentLabelFontSize) { + self2.style("display", "none"); + } + }); + if (config5.showValues !== false) { + const leafValues = cell.append("text").attr("class", "treemapValue").attr("x", (d3) => (d3.x1 - d3.x0) / 2).attr("y", function(d3) { + return (d3.y1 - d3.y0) / 2; + }).attr("style", (d3) => { + const labelStyles = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + colorScaleLabel(d3.data.name) + ";"; + const styles6 = styles2String({ cssCompiledStyles: d3.data.cssCompiledStyles }); + return labelStyles + styles6.labelStyles.replace("color:", "fill:"); + }).attr("clip-path", (_d, i2) => `url(#clip-${id35}-${i2})`).text((d3) => d3.value ? valueFormat(d3.value) : ""); + leafValues.each(function(d3) { + const valueTextElement = select_default2(this); + const parentCellNode = this.parentNode; + if (!parentCellNode) { + valueTextElement.style("display", "none"); + return; + } + const labelElement = select_default2(parentCellNode).select(".treemapLabel"); + if (labelElement.empty() || labelElement.style("display") === "none") { + valueTextElement.style("display", "none"); + return; + } + const finalLabelFontSize = parseFloat(labelElement.style("font-size")); + const originalValueFontSize = 28; + const valueScaleFactor = 0.6; + const minValueFontSize = 6; + const spacingBetweenLabelAndValue = 2; + const actualValueFontSize = Math.max( + minValueFontSize, + Math.min(originalValueFontSize, Math.round(finalLabelFontSize * valueScaleFactor)) + ); + valueTextElement.style("font-size", `${actualValueFontSize}px`); + const labelCenterY = (d3.y1 - d3.y0) / 2; + const valueTopActualY = labelCenterY + finalLabelFontSize / 2 + spacingBetweenLabelAndValue; + valueTextElement.attr("y", valueTopActualY); + const nodeWidth = d3.x1 - d3.x0; + const nodeTotalHeight = d3.y1 - d3.y0; + const cellBottomPadding = 4; + const maxValueBottomY = nodeTotalHeight - cellBottomPadding; + const availableWidthForValue = nodeWidth - 2 * 4; + if (valueTextElement.node().getComputedTextLength() > availableWidthForValue || valueTopActualY + actualValueFontSize > maxValueBottomY || actualValueFontSize < minValueFontSize) { + valueTextElement.style("display", "none"); + } else { + valueTextElement.style("display", null); + } + }); + } + const diagramPadding = config5.diagramPadding ?? 8; + setupViewPortForSVG(svg2, diagramPadding, "flowchart", config5?.useMaxWidth || false); + }, "draw"); + getClasses6 = /* @__PURE__ */ __name(function(_text, diagramObj) { + return diagramObj.db.getClasses(); + }, "getClasses"); + renderer12 = { draw: draw30, getClasses: getClasses6 }; + } + }); + + // src/diagrams/treemap/styles.ts + var defaultTreemapStyleOptions, getStyles22, styles_default20; + var init_styles22 = __esm({ + "src/diagrams/treemap/styles.ts"() { + "use strict"; + init_utils2(); + init_theme_default(); + init_config(); + defaultTreemapStyleOptions = { + sectionStrokeColor: "black", + sectionStrokeWidth: "1", + sectionFillColor: "#efefef", + leafStrokeColor: "black", + leafStrokeWidth: "1", + leafFillColor: "#efefef", + labelFontSize: "12px", + valueFontSize: "10px", + titleFontSize: "14px" + }; + getStyles22 = /* @__PURE__ */ __name(({ + treemap: treemap2 + } = {}) => { + const defaultThemeVariables2 = getThemeVariables3(); + const currentConfig2 = getConfig(); + const themeVariables = cleanAndMerge(defaultThemeVariables2, currentConfig2.themeVariables); + const options2 = cleanAndMerge(defaultTreemapStyleOptions, treemap2); + const titleColor = options2.titleColor ?? themeVariables.titleColor; + const labelColor = options2.labelColor ?? themeVariables.textColor; + const valueColor = options2.valueColor ?? themeVariables.textColor; + return ` + .treemapNode.section { + stroke: ${options2.sectionStrokeColor}; + stroke-width: ${options2.sectionStrokeWidth}; + fill: ${options2.sectionFillColor}; + } + .treemapNode.leaf { + stroke: ${options2.leafStrokeColor}; + stroke-width: ${options2.leafStrokeWidth}; + fill: ${options2.leafFillColor}; + } + .treemapLabel { + fill: ${labelColor}; + font-size: ${options2.labelFontSize}; + } + .treemapValue { + fill: ${valueColor}; + font-size: ${options2.valueFontSize}; + } + .treemapTitle { + fill: ${titleColor}; + font-size: ${options2.titleFontSize}; + } + `; + }, "getStyles"); + styles_default20 = getStyles22; + } + }); + + // src/diagrams/treemap/diagram.ts + var diagram_exports5 = {}; + __export(diagram_exports5, { + diagram: () => diagram30 + }); + var diagram30; + var init_diagram5 = __esm({ + "src/diagrams/treemap/diagram.ts"() { + "use strict"; + init_db5(); + init_parser5(); + init_renderer5(); + init_styles22(); + diagram30 = { + parser: parser27, + get db() { + return new TreeMapDB(); + }, + renderer: renderer12, + styles: styles_default20 + }; + } + }); + + // src/diagrams/wardley/wardleyParser.ts + var toPercent, toCoordinates, getFlowFromPort, extractFlowFromArrow, populateDb3, parser28; + var init_wardleyParser = __esm({ + "src/diagrams/wardley/wardleyParser.ts"() { + "use strict"; + init_mermaid_parser_core(); + init_logger(); + init_populateCommonDb(); + toPercent = /* @__PURE__ */ __name((value2, context) => { + const normalized = value2 <= 1 ? value2 * 100 : value2; + if (normalized < 0 || normalized > 100) { + throw new Error( + `${context} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${value2}` + ); + } + return normalized; + }, "toPercent"); + toCoordinates = /* @__PURE__ */ __name((visibility, evolution, context) => { + return { + x: toPercent(evolution, `${context} evolution`), + y: toPercent(visibility, `${context} visibility`) + }; + }, "toCoordinates"); + getFlowFromPort = /* @__PURE__ */ __name((port) => { + if (!port) { + return void 0; + } + if (port === "+<>") { + return "bidirectional"; + } + if (port === "+<") { + return "backward"; + } + if (port === "+>") { + return "forward"; + } + return void 0; + }, "getFlowFromPort"); + extractFlowFromArrow = /* @__PURE__ */ __name((arrow) => { + if (!arrow?.startsWith("+")) { + return {}; + } + const labelMatch = /^\+'([^']*)'/.exec(arrow); + const flowLabel = labelMatch?.[1]; + if (arrow.includes("<>")) { + return { flow: "bidirectional", label: flowLabel }; + } + if (arrow.includes("<")) { + return { flow: "backward", label: flowLabel }; + } + if (arrow.includes(">")) { + return { flow: "forward", label: flowLabel }; + } + return { label: flowLabel }; + }, "extractFlowFromArrow"); + populateDb3 = /* @__PURE__ */ __name((ast, db10) => { + populateCommonDb(ast, db10); + if (ast.size) { + db10.setSize(ast.size.width, ast.size.height); + } + if (ast.evolution) { + const stages = ast.evolution.stages.map((stage) => { + if (stage.secondName) { + return `${stage.name.trim()} / ${stage.secondName.trim()}`; + } + return stage.name.trim(); + }); + const stageBoundaries = ast.evolution.stages.filter((stage) => stage.boundary !== void 0).map((stage) => stage.boundary); + db10.updateAxes({ stages, stageBoundaries }); + } + ast.anchors.forEach((anchor2) => { + const coords = toCoordinates(anchor2.visibility, anchor2.evolution, `Anchor "${anchor2.name}"`); + db10.addNode(anchor2.name, anchor2.name, coords.x, coords.y, "anchor"); + }); + ast.components.forEach((component2) => { + const coords = toCoordinates( + component2.visibility, + component2.evolution, + `Component "${component2.name}"` + ); + const labelOffsetX = component2.label ? (component2.label.negX ? -1 : 1) * component2.label.offsetX : void 0; + const labelOffsetY = component2.label ? (component2.label.negY ? -1 : 1) * component2.label.offsetY : void 0; + const sourceStrategy = component2.decorator?.strategy; + db10.addNode( + component2.name, + component2.name, + coords.x, + coords.y, + "component", + labelOffsetX, + labelOffsetY, + component2.inertia, + sourceStrategy + ); + }); + ast.notes.forEach((note3) => { + const coords = toCoordinates(note3.visibility, note3.evolution, `Note "${note3.text}"`); + db10.addNote(note3.text, coords.x, coords.y); + }); + ast.pipelines.forEach((pipeline) => { + const parentNode = db10.getNode(pipeline.parent); + if (!parentNode || typeof parentNode.y !== "number") { + throw new Error( + `Pipeline "${pipeline.parent}" must reference an existing component with coordinates.` + ); + } + const parentY = parentNode.y; + db10.startPipeline(pipeline.parent); + pipeline.components.forEach((component2) => { + const componentId = `${pipeline.parent}_${component2.name}`; + const labelOffsetX = component2.label ? (component2.label.negX ? -1 : 1) * component2.label.offsetX : void 0; + const labelOffsetY = component2.label ? (component2.label.negY ? -1 : 1) * component2.label.offsetY : void 0; + const x5 = toPercent(component2.evolution, `Pipeline component "${component2.name}" evolution`); + db10.addNode( + componentId, + component2.name, + x5, + parentY, + "pipeline-component", + labelOffsetX, + labelOffsetY + ); + db10.addPipelineComponent(pipeline.parent, componentId); + }); + }); + ast.links.forEach((link2) => { + const isDashed = !!link2.arrow && (link2.arrow.includes("-.->") || link2.arrow.includes(".-.")); + let flow = getFlowFromPort(link2.fromPort) ?? getFlowFromPort(link2.toPort); + const { flow: arrowFlow, label: flowLabel } = extractFlowFromArrow(link2.arrow); + if (!flow && arrowFlow) { + flow = arrowFlow; + } + const annotation = link2.linkLabel; + const label = flowLabel ?? annotation; + db10.addLink(db10.resolveNodeId(link2.from), db10.resolveNodeId(link2.to), isDashed, label, flow); + }); + ast.evolves.forEach((evolve2) => { + const node2 = db10.getNode(evolve2.component); + if (node2?.y !== void 0) { + const target = toPercent(evolve2.target, `Evolve target for "${evolve2.component}"`); + db10.addTrend(evolve2.component, target, node2.y); + } + }); + if (ast.annotations.length > 0) { + const annotationsBox = ast.annotations[0]; + const coords = toCoordinates(annotationsBox.x, annotationsBox.y, "Annotations box"); + db10.setAnnotationsBox(coords.x, coords.y); + } + ast.annotation.forEach((annotation) => { + const coords = toCoordinates(annotation.x, annotation.y, `Annotation ${annotation.number}`); + db10.addAnnotation(annotation.number, [{ x: coords.x, y: coords.y }], annotation.text); + }); + ast.accelerators.forEach((accelerator) => { + const coords = toCoordinates(accelerator.x, accelerator.y, `Accelerator "${accelerator.name}"`); + db10.addAccelerator(accelerator.name, coords.x, coords.y); + }); + ast.deaccelerators.forEach((deaccelerator) => { + const coords = toCoordinates( + deaccelerator.x, + deaccelerator.y, + `Deaccelerator "${deaccelerator.name}"` + ); + db10.addDeaccelerator(deaccelerator.name, coords.x, coords.y); + }); + }, "populateDb"); + parser28 = { + parser: { + // @ts-expect-error - WardleyDB is not assignable to DiagramDB + yy: void 0 + }, + parse: /* @__PURE__ */ __name(async (input) => { + const ast = await parse3("wardley", input); + log.debug(ast); + const db10 = parser28.parser?.yy; + if (!db10 || typeof db10.addNode !== "function") { + throw new Error( + "parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues." + ); + } + populateDb3(ast, db10); + }, "parse") + }; + } + }); + + // src/diagrams/wardley/wardleyBuilder.ts + var WardleyBuilder; + var init_wardleyBuilder = __esm({ + "src/diagrams/wardley/wardleyBuilder.ts"() { + "use strict"; + WardleyBuilder = class { + constructor() { + this.nodes = /* @__PURE__ */ new Map(); + this.links = []; + this.trends = /* @__PURE__ */ new Map(); + this.pipelines = /* @__PURE__ */ new Map(); + this.annotations = []; + this.notes = []; + this.accelerators = []; + this.deaccelerators = []; + this.axes = {}; + } + static { + __name(this, "WardleyBuilder"); + } + addNode(node2) { + const existing = this.nodes.get(node2.id) ?? { id: node2.id, label: node2.label }; + const merged = { + ...existing, + ...node2, + className: node2.className ?? existing.className, + labelOffsetX: node2.labelOffsetX ?? existing.labelOffsetX, + labelOffsetY: node2.labelOffsetY ?? existing.labelOffsetY + }; + this.nodes.set(node2.id, merged); + } + addLink(link2) { + this.links.push(link2); + } + addTrend(trend) { + this.trends.set(trend.nodeId, trend); + } + startPipeline(nodeId) { + this.pipelines.set(nodeId, { nodeId, componentIds: [] }); + const node2 = this.nodes.get(nodeId); + if (node2) { + node2.isPipelineParent = true; + } + } + addPipelineComponent(pipelineNodeId, componentId) { + const pipeline = this.pipelines.get(pipelineNodeId); + if (pipeline) { + pipeline.componentIds.push(componentId); + } + const node2 = this.nodes.get(componentId); + if (node2) { + node2.inPipeline = true; + } + } + addAnnotation(annotation) { + this.annotations.push(annotation); + } + addNote(note3) { + this.notes.push(note3); + } + addAccelerator(accelerator) { + this.accelerators.push(accelerator); + } + addDeaccelerator(deaccelerator) { + this.deaccelerators.push(deaccelerator); + } + setAnnotationsBox(x5, y6) { + this.annotationsBox = { x: x5, y: y6 }; + } + setAxes(partial) { + this.axes = { + ...this.axes, + ...partial + }; + } + setSize(width3, height2) { + this.size = { width: width3, height: height2 }; + } + getNode(id35) { + return this.nodes.get(id35); + } + /** + * Resolve a name to a node ID. Tries exact ID match first, + * then falls back to finding a node whose label matches the name + * (handles pipeline components which have synthetic IDs like "Parent_Child"). + */ + resolveNodeId(name) { + if (this.nodes.has(name)) { + return name; + } + for (const [id35, node2] of this.nodes) { + if (node2.label === name) { + return id35; + } + } + return name; + } + build() { + const nodes5 = []; + for (const node2 of this.nodes.values()) { + if (typeof node2.x !== "number" || typeof node2.y !== "number") { + throw new Error(`Node "${node2.label}" is missing coordinates`); + } + nodes5.push(node2); + } + return { + nodes: nodes5, + links: [...this.links], + trends: [...this.trends.values()], + pipelines: [...this.pipelines.values()], + annotations: [...this.annotations], + notes: [...this.notes], + accelerators: [...this.accelerators], + deaccelerators: [...this.deaccelerators], + annotationsBox: this.annotationsBox, + axes: { ...this.axes }, + size: this.size + }; + } + clear() { + this.nodes.clear(); + this.links = []; + this.trends.clear(); + this.pipelines.clear(); + this.annotations = []; + this.notes = []; + this.accelerators = []; + this.deaccelerators = []; + this.annotationsBox = void 0; + this.axes = {}; + this.size = void 0; + } + }; + } + }); + + // src/diagrams/wardley/wardleyDb.ts + function getConfig9() { + return getConfig2()["wardley-beta"]; + } + function addNode3(id35, label, x5, y6, className, labelOffsetX, labelOffsetY, inertia, sourceStrategy) { + builder.addNode({ + id: id35, + label, + x: x5, + y: y6, + className, + labelOffsetX, + labelOffsetY, + inertia, + sourceStrategy + }); + } + function addLink2(sourceId, targetId, dashed = false, label, flow) { + builder.addLink({ + source: sourceId, + target: targetId, + dashed, + label, + flow + }); + } + function addTrend(nodeId, targetX, targetY) { + builder.addTrend({ nodeId, targetX, targetY }); + } + function addAnnotation(number7, coordinates, text4) { + builder.addAnnotation({ + number: number7, + coordinates, + text: text4 + }); + } + function addNote(text4, x5, y6) { + builder.addNote({ + text: text4, + x: x5, + y: y6 + }); + } + function addAccelerator(name, x5, y6) { + builder.addAccelerator({ + name, + x: x5, + y: y6 + }); + } + function addDeaccelerator(name, x5, y6) { + builder.addDeaccelerator({ + name, + x: x5, + y: y6 + }); + } + function setAnnotationsBox(x5, y6) { + builder.setAnnotationsBox(x5, y6); + } + function setSize(width3, height2) { + builder.setSize(width3, height2); + } + function startPipeline(nodeId) { + builder.startPipeline(nodeId); + } + function addPipelineComponent(pipelineNodeId, componentId) { + builder.addPipelineComponent(pipelineNodeId, componentId); + } + function updateAxes(partial) { + builder.setAxes(partial); + } + function getNode(id35) { + return builder.getNode(id35); + } + function resolveNodeId(name) { + return builder.resolveNodeId(name); + } + function getWardleyData() { + return builder.build(); + } + function clear21() { + builder.clear(); + clear(); + } + var builder, wardleyDb_default; + var init_wardleyDb = __esm({ + "src/diagrams/wardley/wardleyDb.ts"() { + "use strict"; + init_diagramAPI(); + init_commonDb(); + init_wardleyBuilder(); + builder = new WardleyBuilder(); + __name(getConfig9, "getConfig"); + __name(addNode3, "addNode"); + __name(addLink2, "addLink"); + __name(addTrend, "addTrend"); + __name(addAnnotation, "addAnnotation"); + __name(addNote, "addNote"); + __name(addAccelerator, "addAccelerator"); + __name(addDeaccelerator, "addDeaccelerator"); + __name(setAnnotationsBox, "setAnnotationsBox"); + __name(setSize, "setSize"); + __name(startPipeline, "startPipeline"); + __name(addPipelineComponent, "addPipelineComponent"); + __name(updateAxes, "updateAxes"); + __name(getNode, "getNode"); + __name(resolveNodeId, "resolveNodeId"); + __name(getWardleyData, "getWardleyData"); + __name(clear21, "clear"); + wardleyDb_default = { + getConfig: getConfig9, + addNode: addNode3, + addLink: addLink2, + addTrend, + addAnnotation, + addNote, + addAccelerator, + addDeaccelerator, + setAnnotationsBox, + setSize, + startPipeline, + addPipelineComponent, + updateAxes, + getNode, + resolveNodeId, + getWardleyData, + clear: clear21, + setAccTitle, + getAccTitle, + setDiagramTitle, + getDiagramTitle, + getAccDescription, + setAccDescription + }; + } + }); + + // src/diagrams/wardley/wardleyRenderer.ts + var DEFAULT_STAGES, getTheme, getConfigValues, draw31, wardleyRenderer_default; + var init_wardleyRenderer = __esm({ + "src/diagrams/wardley/wardleyRenderer.ts"() { + "use strict"; + init_diagramAPI(); + init_logger(); + init_selectSvgElement(); + init_setupGraphViewbox(); + DEFAULT_STAGES = ["Genesis", "Custom Built", "Product", "Commodity"]; + getTheme = /* @__PURE__ */ __name(() => { + const { themeVariables } = getConfig2(); + return { + backgroundColor: themeVariables.wardley?.backgroundColor ?? themeVariables.background ?? "#fff", + axisColor: themeVariables.wardley?.axisColor ?? "#000", + axisTextColor: themeVariables.wardley?.axisTextColor ?? themeVariables.primaryTextColor ?? "#222", + gridColor: themeVariables.wardley?.gridColor ?? "rgba(100, 100, 100, 0.2)", + componentFill: themeVariables.wardley?.componentFill ?? "#fff", + componentStroke: themeVariables.wardley?.componentStroke ?? "#000", + componentLabelColor: themeVariables.wardley?.componentLabelColor ?? themeVariables.primaryTextColor ?? "#222", + linkStroke: themeVariables.wardley?.linkStroke ?? "#000", + evolutionStroke: themeVariables.wardley?.evolutionStroke ?? "#dc3545", + annotationStroke: themeVariables.wardley?.annotationStroke ?? "#000", + annotationTextColor: themeVariables.wardley?.annotationTextColor ?? themeVariables.primaryTextColor ?? "#222", + annotationFill: themeVariables.wardley?.annotationFill ?? themeVariables.background ?? "#fff" + }; + }, "getTheme"); + getConfigValues = /* @__PURE__ */ __name(() => { + const wardleyConfig = getConfig2()["wardley-beta"]; + return { + width: wardleyConfig?.width ?? 900, + height: wardleyConfig?.height ?? 600, + padding: wardleyConfig?.padding ?? 48, + nodeRadius: wardleyConfig?.nodeRadius ?? 6, + nodeLabelOffset: wardleyConfig?.nodeLabelOffset ?? 8, + axisFontSize: wardleyConfig?.axisFontSize ?? 12, + labelFontSize: wardleyConfig?.labelFontSize ?? 10, + showGrid: wardleyConfig?.showGrid ?? false, + useMaxWidth: wardleyConfig?.useMaxWidth ?? true + }; + }, "getConfigValues"); + draw31 = /* @__PURE__ */ __name((text4, id35, _version, diagObj) => { + log.debug("Rendering Wardley map\n" + text4); + const configValues = getConfigValues(); + const theme = getTheme(); + const squareSize = configValues.nodeRadius * 1.6; + const db10 = diagObj.db; + const data5 = db10.getWardleyData(); + const title2 = db10.getDiagramTitle(); + const width3 = data5.size?.width ?? configValues.width; + const height2 = data5.size?.height ?? configValues.height; + const svg2 = selectSvgElement(id35); + svg2.selectAll("*").remove(); + configureSvgSize(svg2, height2, width3, configValues.useMaxWidth); + svg2.attr("viewBox", `0 0 ${width3} ${height2}`); + const root4 = svg2.append("g").attr("class", "wardley-map"); + const defs2 = svg2.append("defs"); + defs2.append("marker").attr("id", `arrow-${id35}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", theme.evolutionStroke).attr("stroke", "none"); + defs2.append("marker").attr("id", `link-arrow-end-${id35}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", theme.linkStroke).attr("stroke", "none"); + defs2.append("marker").attr("id", `link-arrow-start-${id35}`).attr("viewBox", "0 0 10 10").attr("refX", 1).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z").attr("fill", theme.linkStroke).attr("stroke", "none"); + root4.append("rect").attr("class", "wardley-background").attr("width", width3).attr("height", height2).attr("fill", theme.backgroundColor); + const chartWidth = width3 - configValues.padding * 2; + const chartHeight = height2 - configValues.padding * 2; + if (title2) { + root4.append("text").attr("class", "wardley-title").attr("x", width3 / 2).attr("y", configValues.padding / 2).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize * 1.05).attr("font-weight", "bold").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title2); + } + const projectX = /* @__PURE__ */ __name((value2) => configValues.padding + value2 / 100 * chartWidth, "projectX"); + const projectY = /* @__PURE__ */ __name((value2) => height2 - configValues.padding - value2 / 100 * chartHeight, "projectY"); + const axisGroup = root4.append("g").attr("class", "wardley-axes"); + axisGroup.append("line").attr("x1", configValues.padding).attr("x2", width3 - configValues.padding).attr("y1", height2 - configValues.padding).attr("y2", height2 - configValues.padding).attr("stroke", theme.axisColor).attr("stroke-width", 1); + axisGroup.append("line").attr("x1", configValues.padding).attr("x2", configValues.padding).attr("y1", configValues.padding).attr("y2", height2 - configValues.padding).attr("stroke", theme.axisColor).attr("stroke-width", 1); + const xLabel = data5.axes.xLabel ?? "Evolution"; + const yLabel = data5.axes.yLabel ?? "Visibility"; + axisGroup.append("text").attr("class", "wardley-axis-label wardley-axis-label-x").attr("x", configValues.padding + chartWidth / 2).attr("y", height2 - configValues.padding / 4).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").text(xLabel); + axisGroup.append("text").attr("class", "wardley-axis-label wardley-axis-label-y").attr("x", configValues.padding / 3).attr("y", configValues.padding + chartHeight / 2).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").attr( + "transform", + `rotate(-90 ${configValues.padding / 3} ${configValues.padding + chartHeight / 2})` + ).text(yLabel); + const stages = data5.axes.stages && data5.axes.stages.length > 0 ? data5.axes.stages : DEFAULT_STAGES; + if (stages.length > 0) { + const stageGroup = root4.append("g").attr("class", "wardley-stages"); + const boundaries2 = data5.axes.stageBoundaries; + const stagePositions = []; + if (boundaries2 && boundaries2.length === stages.length) { + let prevBoundary = 0; + boundaries2.forEach((boundary) => { + stagePositions.push({ start: prevBoundary, end: boundary }); + prevBoundary = boundary; + }); + } else { + const stageWidth = 1 / stages.length; + stages.forEach((_3, index) => { + stagePositions.push({ + start: index * stageWidth, + end: (index + 1) * stageWidth + }); + }); + } + stages.forEach((stage, index) => { + const pos = stagePositions[index]; + const startX2 = configValues.padding + pos.start * chartWidth; + const endX = configValues.padding + pos.end * chartWidth; + const centerX = (startX2 + endX) / 2; + if (index > 0) { + stageGroup.append("line").attr("x1", startX2).attr("x2", startX2).attr("y1", configValues.padding).attr("y2", height2 - configValues.padding).attr("stroke", "#000").attr("stroke-width", 1).attr("stroke-dasharray", "5 5").attr("opacity", 0.8); + } + stageGroup.append("text").attr("class", "wardley-stage-label").attr("x", centerX).attr("y", height2 - configValues.padding / 1.5).attr("fill", theme.axisTextColor).attr("font-size", configValues.axisFontSize - 2).attr("text-anchor", "middle").text(stage); + }); + } + if (configValues.showGrid) { + const gridGroup = root4.append("g").attr("class", "wardley-grid"); + for (let i2 = 1; i2 < 4; i2++) { + const ratio = i2 / 4; + const x5 = configValues.padding + chartWidth * ratio; + gridGroup.append("line").attr("x1", x5).attr("x2", x5).attr("y1", configValues.padding).attr("y2", height2 - configValues.padding).attr("stroke", theme.gridColor).attr("stroke-dasharray", "2 6"); + gridGroup.append("line").attr("x1", configValues.padding).attr("x2", width3 - configValues.padding).attr("y1", height2 - configValues.padding - chartHeight * ratio).attr("y2", height2 - configValues.padding - chartHeight * ratio).attr("stroke", theme.gridColor).attr("stroke-dasharray", "2 6"); + } + } + const positions2 = /* @__PURE__ */ new Map(); + data5.nodes.forEach((node2) => { + positions2.set(node2.id, { + x: projectX(node2.x), + y: projectY(node2.y), + node: node2 + }); + }); + if (data5.pipelines.length > 0) { + const pipelineGroup = root4.append("g").attr("class", "wardley-pipelines"); + const pipelineLinksGroup = root4.append("g").attr("class", "wardley-pipeline-links"); + data5.pipelines.forEach((pipeline) => { + if (pipeline.componentIds.length === 0) { + return; + } + const sortedComponents = pipeline.componentIds.map((id36) => ({ id: id36, pos: positions2.get(id36), node: data5.nodes.find((n2) => n2.id === id36) })).filter((c3) => c3.pos && c3.node).sort((a2, b3) => a2.node.x - b3.node.x); + for (let i2 = 0; i2 < sortedComponents.length - 1; i2++) { + const current = sortedComponents[i2]; + const next3 = sortedComponents[i2 + 1]; + pipelineLinksGroup.append("line").attr("class", "wardley-pipeline-evolution-link").attr("x1", current.pos.x).attr("y1", current.pos.y).attr("x2", next3.pos.x).attr("y2", next3.pos.y).attr("stroke", theme.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4"); + } + let minX = Infinity; + let maxX = -Infinity; + let y6 = 0; + pipeline.componentIds.forEach((componentId) => { + const pos = positions2.get(componentId); + if (pos) { + minX = Math.min(minX, pos.x); + maxX = Math.max(maxX, pos.x); + y6 = pos.y; + } + }); + if (minX !== Infinity && maxX !== -Infinity) { + const padding2 = 15; + const height3 = configValues.nodeRadius * 4; + const boxTop = y6 - height3 / 2; + const parentPos = positions2.get(pipeline.nodeId); + if (parentPos) { + const centerX = (minX + maxX) / 2; + parentPos.x = centerX; + parentPos.y = boxTop - squareSize / 6; + } + pipelineGroup.append("rect").attr("class", "wardley-pipeline-box").attr("x", minX - padding2).attr("y", boxTop).attr("width", maxX - minX + padding2 * 2).attr("height", height3).attr("fill", "none").attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4); + } + }); + } + const linksGroup = root4.append("g").attr("class", "wardley-links"); + const pipelineMap = /* @__PURE__ */ new Map(); + data5.pipelines.forEach((pipeline) => { + pipelineMap.set(pipeline.nodeId, new Set(pipeline.componentIds)); + }); + const validLinks = data5.links.filter((link2) => { + if (!positions2.has(link2.source) || !positions2.has(link2.target)) { + return false; + } + const pipelineComponents = pipelineMap.get(link2.target); + if (pipelineComponents?.has(link2.source)) { + return false; + } + return true; + }); + linksGroup.selectAll("line").data(validLinks).enter().append("line").attr("class", (link2) => `wardley-link${link2.dashed ? " wardley-link--dashed" : ""}`).attr("x1", (link2) => { + const sourcePos = positions2.get(link2.source); + const targetPos = positions2.get(link2.target); + const sourceNode = data5.nodes.find((n2) => n2.id === link2.source); + const radius2 = sourceNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius; + const dx = targetPos.x - sourcePos.x; + const dy = targetPos.y - sourcePos.y; + const distance3 = Math.sqrt(dx * dx + dy * dy); + return sourcePos.x + dx / distance3 * radius2; + }).attr("y1", (link2) => { + const sourcePos = positions2.get(link2.source); + const targetPos = positions2.get(link2.target); + const sourceNode = data5.nodes.find((n2) => n2.id === link2.source); + const radius2 = sourceNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius; + const dx = targetPos.x - sourcePos.x; + const dy = targetPos.y - sourcePos.y; + const distance3 = Math.sqrt(dx * dx + dy * dy); + return sourcePos.y + dy / distance3 * radius2; + }).attr("x2", (link2) => { + const sourcePos = positions2.get(link2.source); + const targetPos = positions2.get(link2.target); + const targetNode = data5.nodes.find((n2) => n2.id === link2.target); + const radius2 = targetNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius; + const dx = sourcePos.x - targetPos.x; + const dy = sourcePos.y - targetPos.y; + const distance3 = Math.sqrt(dx * dx + dy * dy); + return targetPos.x + dx / distance3 * radius2; + }).attr("y2", (link2) => { + const sourcePos = positions2.get(link2.source); + const targetPos = positions2.get(link2.target); + const targetNode = data5.nodes.find((n2) => n2.id === link2.target); + const radius2 = targetNode.isPipelineParent ? squareSize / Math.sqrt(2) : configValues.nodeRadius; + const dx = sourcePos.x - targetPos.x; + const dy = sourcePos.y - targetPos.y; + const distance3 = Math.sqrt(dx * dx + dy * dy); + return targetPos.y + dy / distance3 * radius2; + }).attr("stroke", theme.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", (link2) => link2.dashed ? "6 6" : null).attr("marker-end", (link2) => { + if (link2.flow === "forward" || link2.flow === "bidirectional") { + return `url(#link-arrow-end-${id35})`; + } + return null; + }).attr("marker-start", (link2) => { + if (link2.flow === "backward" || link2.flow === "bidirectional") { + return `url(#link-arrow-start-${id35})`; + } + return null; + }); + linksGroup.selectAll("text").data(validLinks.filter((link2) => link2.label)).enter().append("text").attr("class", "wardley-link-label").attr("x", (link2) => { + const sourcePos = positions2.get(link2.source); + const targetPos = positions2.get(link2.target); + const midX = (sourcePos.x + targetPos.x) / 2; + const dy = targetPos.y - sourcePos.y; + const dx = targetPos.x - sourcePos.x; + const distance3 = Math.sqrt(dx * dx + dy * dy); + const offset = 8; + const perpX = dy / distance3; + return midX + perpX * offset; + }).attr("y", (link2) => { + const sourcePos = positions2.get(link2.source); + const targetPos = positions2.get(link2.target); + const midY = (sourcePos.y + targetPos.y) / 2; + const dx = targetPos.x - sourcePos.x; + const dy = targetPos.y - sourcePos.y; + const distance3 = Math.sqrt(dx * dx + dy * dy); + const offset = 8; + const perpY = -dx / distance3; + return midY + perpY * offset; + }).attr("fill", theme.axisTextColor).attr("font-size", configValues.labelFontSize).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("transform", (link2) => { + const sourcePos = positions2.get(link2.source); + const targetPos = positions2.get(link2.target); + const midX = (sourcePos.x + targetPos.x) / 2; + const midY = (sourcePos.y + targetPos.y) / 2; + const dx = targetPos.x - sourcePos.x; + const dy = targetPos.y - sourcePos.y; + const distance3 = Math.sqrt(dx * dx + dy * dy); + const offset = 8; + const perpX = dy / distance3; + const perpY = -dx / distance3; + const labelX = midX + perpX * offset; + const labelY = midY + perpY * offset; + let angle2 = Math.atan2(dy, dx) * 180 / Math.PI; + if (angle2 > 90 || angle2 < -90) { + angle2 += 180; + } + return `rotate(${angle2} ${labelX} ${labelY})`; + }).text((link2) => link2.label); + const trendGroup = root4.append("g").attr("class", "wardley-trends"); + const trendsWithPositions = data5.trends.map((trend) => { + const origin = positions2.get(trend.nodeId); + if (!origin) { + return null; + } + const targetX = projectX(trend.targetX); + const targetY = projectY(trend.targetY); + const dx = targetX - origin.x; + const dy = targetY - origin.y; + const distance3 = Math.sqrt(dx * dx + dy * dy); + const shortenBy = configValues.nodeRadius + 2; + const adjustedX2 = distance3 > shortenBy ? targetX - dx / distance3 * shortenBy : targetX; + const adjustedY2 = distance3 > shortenBy ? targetY - dy / distance3 * shortenBy : targetY; + return { + origin, + targetX, + targetY, + adjustedX2, + adjustedY2 + }; + }).filter((trend) => trend !== null); + trendGroup.selectAll("line").data(trendsWithPositions).enter().append("line").attr("class", "wardley-trend").attr("x1", (trend) => trend.origin.x).attr("y1", (trend) => trend.origin.y).attr("x2", (trend) => trend.adjustedX2).attr("y2", (trend) => trend.adjustedY2).attr("stroke", theme.evolutionStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4").attr("marker-end", `url(#arrow-${id35})`); + const nodesGroup = root4.append("g").attr("class", "wardley-nodes"); + const nodeEnter = nodesGroup.selectAll("g").data(data5.nodes).enter().append("g").attr( + "class", + (node2) => ["wardley-node", node2.className ? `wardley-node--${node2.className}` : ""].filter(Boolean).join(" ") + ); + nodeEnter.filter((node2) => node2.sourceStrategy === "outsource").append("circle").attr("class", "wardley-outsource-overlay").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#666").attr("stroke", theme.componentStroke).attr("stroke-width", 1); + nodeEnter.filter((node2) => node2.sourceStrategy === "buy").append("circle").attr("class", "wardley-buy-overlay").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#ccc").attr("stroke", theme.componentStroke).attr("stroke-width", 1); + nodeEnter.filter((node2) => node2.sourceStrategy === "build").append("circle").attr("class", "wardley-build-overlay").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "#eee").attr("stroke", "#000").attr("stroke-width", 1); + const marketNodes = nodeEnter.filter((node2) => node2.sourceStrategy === "market"); + marketNodes.append("circle").attr("class", "wardley-market-overlay").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius * 2).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1); + nodeEnter.filter( + (node2) => !node2.isPipelineParent && node2.sourceStrategy !== "market" && node2.className !== "anchor" + ).append("circle").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y).attr("r", configValues.nodeRadius).attr("fill", theme.componentFill).attr("stroke", theme.componentStroke).attr("stroke-width", 1); + const smallCircleRadius = configValues.nodeRadius * 0.7; + const triangleRadius = configValues.nodeRadius * 1.2; + marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node2) => positions2.get(node2.id).x).attr("y1", (node2) => positions2.get(node2.id).y - triangleRadius).attr("x2", (node2) => positions2.get(node2.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("y2", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("stroke", theme.componentStroke).attr("stroke-width", 1); + marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node2) => positions2.get(node2.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("y1", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("x2", (node2) => positions2.get(node2.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("y2", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("stroke", theme.componentStroke).attr("stroke-width", 1); + marketNodes.append("line").attr("class", "wardley-market-line").attr("x1", (node2) => positions2.get(node2.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("y1", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("x2", (node2) => positions2.get(node2.id).x).attr("y2", (node2) => positions2.get(node2.id).y - triangleRadius).attr("stroke", theme.componentStroke).attr("stroke-width", 1); + marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node2) => positions2.get(node2.id).x).attr("cy", (node2) => positions2.get(node2.id).y - triangleRadius).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2); + marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node2) => positions2.get(node2.id).x - triangleRadius * Math.cos(Math.PI / 6)).attr("cy", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2); + marketNodes.append("circle").attr("class", "wardley-market-dot").attr("cx", (node2) => positions2.get(node2.id).x + triangleRadius * Math.cos(Math.PI / 6)).attr("cy", (node2) => positions2.get(node2.id).y + triangleRadius * Math.sin(Math.PI / 6)).attr("r", smallCircleRadius).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 2); + nodeEnter.filter((node2) => node2.isPipelineParent === true).append("rect").attr("x", (node2) => positions2.get(node2.id).x - squareSize / 2).attr("y", (node2) => positions2.get(node2.id).y - squareSize / 2).attr("width", squareSize).attr("height", squareSize).attr("fill", theme.componentFill).attr("stroke", theme.componentStroke).attr("stroke-width", 1); + nodeEnter.filter((node2) => node2.inertia === true).append("line").attr("class", "wardley-inertia").attr("x1", (node2) => { + const pos = positions2.get(node2.id); + let offset = node2.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15; + if (node2.sourceStrategy) { + offset += configValues.nodeRadius + 10; + } + return pos.x + offset; + }).attr("y1", (node2) => { + const pos = positions2.get(node2.id); + const lineHeight = node2.isPipelineParent ? squareSize : configValues.nodeRadius * 2; + return pos.y - lineHeight / 2; + }).attr("x2", (node2) => { + const pos = positions2.get(node2.id); + let offset = node2.isPipelineParent ? squareSize / 2 + 15 : configValues.nodeRadius + 15; + if (node2.sourceStrategy) { + offset += configValues.nodeRadius + 10; + } + return pos.x + offset; + }).attr("y2", (node2) => { + const pos = positions2.get(node2.id); + const lineHeight = node2.isPipelineParent ? squareSize : configValues.nodeRadius * 2; + return pos.y + lineHeight / 2; + }).attr("stroke", theme.componentStroke).attr("stroke-width", 6); + nodeEnter.append("text").attr("x", (node2) => { + const pos = positions2.get(node2.id); + if (node2.className === "anchor") { + return node2.labelOffsetX !== void 0 ? pos.x + node2.labelOffsetX : pos.x; + } + let defaultOffset = configValues.nodeLabelOffset; + if (node2.sourceStrategy && node2.labelOffsetX === void 0) { + defaultOffset += 10; + } + const customOffset = node2.labelOffsetX ?? defaultOffset; + return pos.x + customOffset; + }).attr("y", (node2) => { + const pos = positions2.get(node2.id); + if (node2.className === "anchor") { + return node2.labelOffsetY !== void 0 ? pos.y + node2.labelOffsetY : pos.y - 3; + } + let defaultOffset = -configValues.nodeLabelOffset; + if (node2.sourceStrategy && node2.labelOffsetY === void 0) { + defaultOffset -= 10; + } + const customOffset = node2.labelOffsetY ?? defaultOffset; + return pos.y + customOffset; + }).attr("class", "wardley-node-label").attr("fill", (node2) => { + if (node2.className === "evolved") { + return theme.evolutionStroke; + } + if (node2.className === "anchor") { + return "#000"; + } + return theme.componentLabelColor; + }).attr("font-size", configValues.labelFontSize).attr("font-weight", (node2) => node2.className === "anchor" ? "bold" : "normal").attr("text-anchor", (node2) => node2.className === "anchor" ? "middle" : "start").attr("dominant-baseline", (node2) => node2.className === "anchor" ? "middle" : "auto").text((node2) => node2.label); + if (data5.annotations.length > 0) { + const annotationsGroup = root4.append("g").attr("class", "wardley-annotations"); + data5.annotations.forEach((annotation) => { + const projectedCoords = annotation.coordinates.map((coord) => ({ + x: projectX(coord.x), + y: projectY(coord.y) + })); + if (projectedCoords.length > 1) { + for (let i2 = 0; i2 < projectedCoords.length - 1; i2++) { + annotationsGroup.append("line").attr("class", "wardley-annotation-line").attr("x1", projectedCoords[i2].x).attr("y1", projectedCoords[i2].y).attr("x2", projectedCoords[i2 + 1].x).attr("y2", projectedCoords[i2 + 1].y).attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("stroke-dasharray", "4 4"); + } + } + projectedCoords.forEach((coord) => { + const annotationNode = annotationsGroup.append("g").attr("class", "wardley-annotation"); + annotationNode.append("circle").attr("cx", coord.x).attr("cy", coord.y).attr("r", 10).attr("fill", "white").attr("stroke", theme.axisColor).attr("stroke-width", 1.5); + annotationNode.append("text").attr("x", coord.x).attr("y", coord.y).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(annotation.number); + }); + }); + if (data5.annotationsBox) { + let boxX = projectX(data5.annotationsBox.x); + let boxY = projectY(data5.annotationsBox.y); + const padding2 = 10; + const lineHeight = 16; + const fontSize = 11; + const textBoxGroup = annotationsGroup.append("g").attr("class", "wardley-annotations-box"); + const sortedAnnotations = [...data5.annotations].filter((a2) => a2.text).sort((a2, b3) => a2.number - b3.number); + const textElements = []; + sortedAnnotations.forEach((annotation, idx) => { + const text5 = textBoxGroup.append("text").attr("x", boxX + padding2).attr("y", boxY + padding2 + (idx + 1) * lineHeight).attr("font-size", fontSize).attr("fill", theme.axisTextColor).attr("text-anchor", "start").attr("dominant-baseline", "middle").text(`${annotation.number}. ${annotation.text}`); + textElements.push(text5); + }); + if (textElements.length > 0) { + let maxWidth2 = 0; + let maxHeight = 0; + textElements.forEach((text5) => { + const textNode = text5.node(); + const textWidth = textNode.getComputedTextLength(); + maxWidth2 = Math.max(maxWidth2, textWidth); + const bbox = textNode.getBBox(); + maxHeight = Math.max(maxHeight, bbox.height); + }); + const boxWidth = maxWidth2 + padding2 * 2 + 105; + const boxHeight = sortedAnnotations.length * lineHeight + padding2 * 2 + maxHeight / 2; + const minX = configValues.padding; + const maxX = width3 - configValues.padding - boxWidth; + const minY = configValues.padding; + const maxY = height2 - configValues.padding - boxHeight; + boxX = Math.max(minX, Math.min(boxX, maxX)); + boxY = Math.max(minY, Math.min(boxY, maxY)); + textElements.forEach((text5, idx) => { + text5.attr("x", boxX + padding2).attr("y", boxY + padding2 + (idx + 1) * lineHeight); + }); + textBoxGroup.insert("rect", "text").attr("x", boxX).attr("y", boxY).attr("width", boxWidth).attr("height", boxHeight).attr("fill", "white").attr("stroke", theme.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4); + } + } + } + if (data5.notes.length > 0) { + const notesGroup = root4.append("g").attr("class", "wardley-notes"); + data5.notes.forEach((note3) => { + const noteX = projectX(note3.x); + const noteY = projectY(note3.y); + notesGroup.append("text").attr("x", noteX).attr("y", noteY).attr("text-anchor", "start").attr("font-size", 11).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(note3.text); + }); + } + if (data5.accelerators.length > 0) { + const acceleratorsGroup = root4.append("g").attr("class", "wardley-accelerators"); + data5.accelerators.forEach((accelerator) => { + const accX = projectX(accelerator.x); + const accY = projectY(accelerator.y); + const arrowWidth = 60; + const arrowHeight = 30; + const arrowHeadWidth = 20; + const arrowPath = ` + M ${accX} ${accY - arrowHeight / 2} + L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2} + L ${accX + arrowWidth - arrowHeadWidth} ${accY - arrowHeight / 2 - 8} + L ${accX + arrowWidth} ${accY} + L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2 + 8} + L ${accX + arrowWidth - arrowHeadWidth} ${accY + arrowHeight / 2} + L ${accX} ${accY + arrowHeight / 2} + Z + `; + acceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1); + acceleratorsGroup.append("text").attr("x", accX + arrowWidth / 2).attr("y", accY + arrowHeight / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(accelerator.name); + }); + } + if (data5.deaccelerators.length > 0) { + const deacceleratorsGroup = root4.append("g").attr("class", "wardley-deaccelerators"); + data5.deaccelerators.forEach((deaccelerator) => { + const decX = projectX(deaccelerator.x); + const decY = projectY(deaccelerator.y); + const arrowWidth = 60; + const arrowHeight = 30; + const arrowHeadWidth = 20; + const arrowPath = ` + M ${decX + arrowWidth} ${decY - arrowHeight / 2} + L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2} + L ${decX + arrowHeadWidth} ${decY - arrowHeight / 2 - 8} + L ${decX} ${decY} + L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2 + 8} + L ${decX + arrowHeadWidth} ${decY + arrowHeight / 2} + L ${decX + arrowWidth} ${decY + arrowHeight / 2} + Z + `; + deacceleratorsGroup.append("path").attr("d", arrowPath).attr("fill", "white").attr("stroke", theme.componentStroke).attr("stroke-width", 1); + deacceleratorsGroup.append("text").attr("x", decX + arrowWidth / 2).attr("y", decY + arrowHeight / 2 + 15).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", theme.axisTextColor).attr("font-weight", "bold").text(deaccelerator.name); + }); + } + }, "draw"); + wardleyRenderer_default = { + draw: draw31 + }; + } + }); + + // src/diagrams/wardley/styles.ts + var styles5; + var init_styles23 = __esm({ + "src/diagrams/wardley/styles.ts"() { + "use strict"; + init_utils2(); + init_theme_default(); + init_config(); + styles5 = /* @__PURE__ */ __name(({ + wardley + } = {}) => { + const defaultThemeVariables2 = getThemeVariables3(); + const currentConfig2 = getConfig(); + const themeVariables = cleanAndMerge(defaultThemeVariables2, currentConfig2.themeVariables); + const w4 = cleanAndMerge(themeVariables.wardley, wardley); + return ` + .wardley-background { + fill: ${w4.backgroundColor}; + } + .wardley-axes line, .wardley-axes path { + stroke: ${w4.axisColor}; + } + .wardley-axis-label { + fill: ${w4.axisTextColor}; + } + .wardley-stage-label { + fill: ${w4.axisTextColor}; + } + .wardley-grid line { + stroke: ${w4.gridColor}; + } + .wardley-node circle { + fill: ${w4.componentFill}; + stroke: ${w4.componentStroke}; + } + .wardley-node-label { + fill: ${w4.componentLabelColor}; + } + .wardley-link { + stroke: ${w4.linkStroke}; + } + .wardley-link--dashed { + stroke-dasharray: 4 4; + } + .wardley-link-label { + fill: ${w4.axisTextColor}; + } + .wardley-trend line { + stroke: ${w4.evolutionStroke}; + } + .wardley-annotation-line { + stroke: ${w4.annotationStroke}; + } + .wardley-annotation circle { + fill: ${w4.annotationFill}; + stroke: ${w4.annotationStroke}; + } + .wardley-annotation text { + fill: ${w4.annotationTextColor}; + } + .wardley-annotations-box rect { + fill: ${w4.annotationFill}; + stroke: ${w4.annotationStroke}; + } + .wardley-annotations-box text { + fill: ${w4.annotationTextColor}; + } + .wardley-pipeline-box { + stroke: ${w4.componentStroke}; + } + .wardley-notes text { + fill: ${w4.axisTextColor}; + } + `; + }, "styles"); + } + }); + + // src/diagrams/wardley/wardleyDiagram.ts + var wardleyDiagram_exports = {}; + __export(wardleyDiagram_exports, { + diagram: () => diagram31 + }); + var diagram31; + var init_wardleyDiagram = __esm({ + "src/diagrams/wardley/wardleyDiagram.ts"() { + "use strict"; + init_wardleyParser(); + init_wardleyDb(); + init_wardleyRenderer(); + init_styles23(); + diagram31 = { + parser: parser28, + db: wardleyDb_default, + renderer: wardleyRenderer_default, + styles: styles5 + }; + } + }); + + // src/mermaid.ts + var mermaid_exports = {}; + __export(mermaid_exports, { + default: () => mermaid_default + }); + init_icons(); + init_esm(); + init_detectType(); + + // src/diagrams/c4/c4Detector.ts + var id2 = "c4"; + var detector = /* @__PURE__ */ __name((txt) => { + return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt); + }, "detector"); + var loader = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_c4Diagram2(), c4Diagram_exports)); + return { id: id2, diagram: diagram32 }; + }, "loader"); + var plugin = { + id: id2, + detector, + loader + }; + var c4Detector_default = plugin; + + // src/diagrams/flowchart/flowDetector.ts + var id4 = "flowchart"; + var detector2 = /* @__PURE__ */ __name((txt, config5) => { + if (config5?.flowchart?.defaultRenderer === "dagre-wrapper" || config5?.flowchart?.defaultRenderer === "elk") { + return false; + } + return /^\s*graph/.test(txt); + }, "detector"); + var loader3 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_flowDiagram(), flowDiagram_exports)); + return { id: id4, diagram: diagram32 }; + }, "loader"); + var plugin2 = { + id: id4, + detector: detector2, + loader: loader3 + }; + var flowDetector_default = plugin2; + + // src/diagrams/flowchart/flowDetector-v2.ts + var id5 = "flowchart-v2"; + var detector3 = /* @__PURE__ */ __name((txt, config5) => { + if (config5?.flowchart?.defaultRenderer === "dagre-d3") { + return false; + } + if (config5?.flowchart?.defaultRenderer === "elk") { + config5.layout = "elk"; + } + if (/^\s*graph/.test(txt) && config5?.flowchart?.defaultRenderer === "dagre-wrapper") { + return true; + } + return /^\s*flowchart/.test(txt); + }, "detector"); + var loader4 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_flowDiagram(), flowDiagram_exports)); + return { id: id5, diagram: diagram32 }; + }, "loader"); + var plugin3 = { + id: id5, + detector: detector3, + loader: loader4 + }; + var flowDetector_v2_default = plugin3; + + // src/diagrams/er/erDetector.ts + var id6 = "er"; + var detector4 = /* @__PURE__ */ __name((txt) => { + return /^\s*erDiagram/.test(txt); + }, "detector"); + var loader5 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_erDiagram2(), erDiagram_exports)); + return { id: id6, diagram: diagram32 }; + }, "loader"); + var plugin4 = { + id: id6, + detector: detector4, + loader: loader5 + }; + var erDetector_default = plugin4; + + // src/diagrams/git/gitGraphDetector.ts + var id7 = "gitGraph"; + var detector5 = /* @__PURE__ */ __name((txt) => { + return /^\s*gitGraph/.test(txt); + }, "detector"); + var loader6 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_gitGraphDiagram(), gitGraphDiagram_exports)); + return { id: id7, diagram: diagram32 }; + }, "loader"); + var plugin5 = { + id: id7, + detector: detector5, + loader: loader6 + }; + var gitGraphDetector_default = plugin5; + + // src/diagrams/gantt/ganttDetector.ts + var id8 = "gantt"; + var detector6 = /* @__PURE__ */ __name((txt) => { + return /^\s*gantt/.test(txt); + }, "detector"); + var loader7 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_ganttDiagram(), ganttDiagram_exports)); + return { id: id8, diagram: diagram32 }; + }, "loader"); + var plugin6 = { + id: id8, + detector: detector6, + loader: loader7 + }; + var ganttDetector_default = plugin6; + + // src/diagrams/info/infoDetector.ts + var id9 = "info"; + var detector7 = /* @__PURE__ */ __name((txt) => { + return /^\s*info/.test(txt); + }, "detector"); + var loader8 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_infoDiagram(), infoDiagram_exports)); + return { id: id9, diagram: diagram32 }; + }, "loader"); + var info = { + id: id9, + detector: detector7, + loader: loader8 + }; + + // src/diagrams/pie/pieDetector.ts + var id10 = "pie"; + var detector8 = /* @__PURE__ */ __name((txt) => { + return /^\s*pie/.test(txt); + }, "detector"); + var loader9 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_pieDiagram(), pieDiagram_exports)); + return { id: id10, diagram: diagram32 }; + }, "loader"); + var pie = { + id: id10, + detector: detector8, + loader: loader9 + }; + + // src/diagrams/quadrant-chart/quadrantDetector.ts + var id11 = "quadrantChart"; + var detector9 = /* @__PURE__ */ __name((txt) => { + return /^\s*quadrantChart/.test(txt); + }, "detector"); + var loader10 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_quadrantDiagram(), quadrantDiagram_exports)); + return { id: id11, diagram: diagram32 }; + }, "loader"); + var plugin7 = { + id: id11, + detector: detector9, + loader: loader10 + }; + var quadrantDetector_default = plugin7; + + // src/diagrams/xychart/xychartDetector.ts + var id12 = "xychart"; + var detector10 = /* @__PURE__ */ __name((txt) => { + return /^\s*xychart(-beta)?/.test(txt); + }, "detector"); + var loader11 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_xychartDiagram(), xychartDiagram_exports)); + return { id: id12, diagram: diagram32 }; + }, "loader"); + var plugin8 = { + id: id12, + detector: detector10, + loader: loader11 + }; + var xychartDetector_default = plugin8; + + // src/diagrams/requirement/requirementDetector.ts + var id13 = "requirement"; + var detector11 = /* @__PURE__ */ __name((txt) => { + return /^\s*requirement(Diagram)?/.test(txt); + }, "detector"); + var loader12 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_requirementDiagram2(), requirementDiagram_exports)); + return { id: id13, diagram: diagram32 }; + }, "loader"); + var plugin9 = { + id: id13, + detector: detector11, + loader: loader12 + }; + var requirementDetector_default = plugin9; + + // src/diagrams/sequence/sequenceDetector.ts + var id14 = "sequence"; + var detector12 = /* @__PURE__ */ __name((txt) => { + return /^\s*sequenceDiagram/.test(txt); + }, "detector"); + var loader13 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_sequenceDiagram2(), sequenceDiagram_exports)); + return { id: id14, diagram: diagram32 }; + }, "loader"); + var plugin10 = { + id: id14, + detector: detector12, + loader: loader13 + }; + var sequenceDetector_default = plugin10; + + // src/diagrams/class/classDetector.ts + var id15 = "class"; + var detector13 = /* @__PURE__ */ __name((txt, config5) => { + if (config5?.class?.defaultRenderer === "dagre-wrapper") { + return false; + } + return /^\s*classDiagram/.test(txt); + }, "detector"); + var loader14 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_classDiagram2(), classDiagram_exports)); + return { id: id15, diagram: diagram32 }; + }, "loader"); + var plugin11 = { + id: id15, + detector: detector13, + loader: loader14 + }; + var classDetector_default = plugin11; + + // src/diagrams/class/classDetector-V2.ts + var id16 = "classDiagram"; + var detector14 = /* @__PURE__ */ __name((txt, config5) => { + if (/^\s*classDiagram/.test(txt) && config5?.class?.defaultRenderer === "dagre-wrapper") { + return true; + } + return /^\s*classDiagram-v2/.test(txt); + }, "detector"); + var loader15 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_classDiagram_v2(), classDiagram_v2_exports)); + return { id: id16, diagram: diagram32 }; + }, "loader"); + var plugin12 = { + id: id16, + detector: detector14, + loader: loader15 + }; + var classDetector_V2_default = plugin12; + + // src/diagrams/state/stateDetector.ts + var id17 = "state"; + var detector15 = /* @__PURE__ */ __name((txt, config5) => { + if (config5?.state?.defaultRenderer === "dagre-wrapper") { + return false; + } + return /^\s*stateDiagram/.test(txt); + }, "detector"); + var loader16 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_stateDiagram2(), stateDiagram_exports)); + return { id: id17, diagram: diagram32 }; + }, "loader"); + var plugin13 = { + id: id17, + detector: detector15, + loader: loader16 + }; + var stateDetector_default = plugin13; + + // src/diagrams/state/stateDetector-V2.ts + var id18 = "stateDiagram"; + var detector16 = /* @__PURE__ */ __name((txt, config5) => { + if (/^\s*stateDiagram-v2/.test(txt)) { + return true; + } + if (/^\s*stateDiagram/.test(txt) && config5?.state?.defaultRenderer === "dagre-wrapper") { + return true; + } + return false; + }, "detector"); + var loader17 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_stateDiagram_v2(), stateDiagram_v2_exports)); + return { id: id18, diagram: diagram32 }; + }, "loader"); + var plugin14 = { + id: id18, + detector: detector16, + loader: loader17 + }; + var stateDetector_V2_default = plugin14; + + // src/diagrams/user-journey/journeyDetector.ts + var id19 = "journey"; + var detector17 = /* @__PURE__ */ __name((txt) => { + return /^\s*journey/.test(txt); + }, "detector"); + var loader18 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_journeyDiagram(), journeyDiagram_exports)); + return { id: id19, diagram: diagram32 }; + }, "loader"); + var plugin15 = { + id: id19, + detector: detector17, + loader: loader18 + }; + var journeyDetector_default = plugin15; + + // src/diagrams/error/errorRenderer.ts + init_logger(); + init_selectSvgElement(); + init_setupGraphViewbox(); + var draw16 = /* @__PURE__ */ __name((_text, id35, version3) => { + log.debug("rendering svg for syntax error\n"); + const svg2 = selectSvgElement(id35); + const g2 = svg2.append("g"); + svg2.attr("viewBox", "0 0 2412 512"); + configureSvgSize(svg2, 100, 512, true); + g2.append("path").attr("class", "error-icon").attr( + "d", + "m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z" + ); + g2.append("path").attr("class", "error-icon").attr( + "d", + "m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z" + ); + g2.append("path").attr("class", "error-icon").attr( + "d", + "m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z" + ); + g2.append("path").attr("class", "error-icon").attr( + "d", + "m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z" + ); + g2.append("path").attr("class", "error-icon").attr( + "d", + "m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z" + ); + g2.append("path").attr("class", "error-icon").attr( + "d", + "m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z" + ); + g2.append("text").attr("class", "error-text").attr("x", 1440).attr("y", 250).attr("font-size", "150px").style("text-anchor", "middle").text("Syntax error in text"); + g2.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${version3}`); + }, "draw"); + var renderer5 = { draw: draw16 }; + var errorRenderer_default = renderer5; + + // src/diagrams/error/errorDiagram.ts + var diagram17 = { + db: {}, + renderer: renderer5, + parser: { + parse: /* @__PURE__ */ __name(() => { + return; + }, "parse") + } + }; + var errorDiagram_default = diagram17; + + // src/diagrams/flowchart/elk/detector.ts + var id20 = "flowchart-elk"; + var detector18 = /* @__PURE__ */ __name((txt, config5 = {}) => { + if ( + // If diagram explicitly states flowchart-elk + /^\s*flowchart-elk/.test(txt) || // If a flowchart/graph diagram has their default renderer set to elk + /^\s*(flowchart|graph)/.test(txt) && config5?.flowchart?.defaultRenderer === "elk" + ) { + config5.layout = "elk"; + return true; + } + return false; + }, "detector"); + var loader19 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_flowDiagram(), flowDiagram_exports)); + return { id: id20, diagram: diagram32 }; + }, "loader"); + var plugin16 = { + id: id20, + detector: detector18, + loader: loader19 + }; + var detector_default = plugin16; + + // src/diagrams/timeline/detector.ts + var id21 = "timeline"; + var detector19 = /* @__PURE__ */ __name((txt) => { + return /^\s*timeline/.test(txt); + }, "detector"); + var loader20 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_timeline_definition(), timeline_definition_exports)); + return { id: id21, diagram: diagram32 }; + }, "loader"); + var plugin17 = { + id: id21, + detector: detector19, + loader: loader20 + }; + var detector_default2 = plugin17; + + // src/diagrams/mindmap/detector.ts + var id22 = "mindmap"; + var detector20 = /* @__PURE__ */ __name((txt) => { + return /^\s*mindmap/.test(txt); + }, "detector"); + var loader21 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_mindmap_definition(), mindmap_definition_exports)); + return { id: id22, diagram: diagram32 }; + }, "loader"); + var plugin18 = { + id: id22, + detector: detector20, + loader: loader21 + }; + var detector_default3 = plugin18; + + // src/diagrams/kanban/detector.ts + var id23 = "kanban"; + var detector21 = /* @__PURE__ */ __name((txt) => { + return /^\s*kanban/.test(txt); + }, "detector"); + var loader22 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_kanban_definition(), kanban_definition_exports)); + return { id: id23, diagram: diagram32 }; + }, "loader"); + var plugin19 = { + id: id23, + detector: detector21, + loader: loader22 + }; + var detector_default4 = plugin19; + + // src/diagrams/sankey/sankeyDetector.ts + var id24 = "sankey"; + var detector22 = /* @__PURE__ */ __name((txt) => { + return /^\s*sankey(-beta)?/.test(txt); + }, "detector"); + var loader23 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_sankeyDiagram(), sankeyDiagram_exports)); + return { id: id24, diagram: diagram32 }; + }, "loader"); + var plugin20 = { + id: id24, + detector: detector22, + loader: loader23 + }; + var sankeyDetector_default = plugin20; + + // src/diagrams/packet/detector.ts + var id25 = "packet"; + var detector23 = /* @__PURE__ */ __name((txt) => { + return /^\s*packet(-beta)?/.test(txt); + }, "detector"); + var loader24 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_diagram(), diagram_exports)); + return { id: id25, diagram: diagram32 }; + }, "loader"); + var packet = { + id: id25, + detector: detector23, + loader: loader24 + }; + + // src/diagrams/radar/detector.ts + var id26 = "radar"; + var detector24 = /* @__PURE__ */ __name((txt) => { + return /^\s*radar-beta/.test(txt); + }, "detector"); + var loader25 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_diagram2(), diagram_exports2)); + return { id: id26, diagram: diagram32 }; + }, "loader"); + var radar = { + id: id26, + detector: detector24, + loader: loader25 + }; + + // src/diagrams/block/blockDetector.ts + var id27 = "block"; + var detector25 = /* @__PURE__ */ __name((txt) => { + return /^\s*block(-beta)?/.test(txt); + }, "detector"); + var loader26 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_blockDiagram(), blockDiagram_exports)); + return { id: id27, diagram: diagram32 }; + }, "loader"); + var plugin21 = { + id: id27, + detector: detector25, + loader: loader26 + }; + var blockDetector_default = plugin21; + + // src/diagrams/treeView/detector.ts + var id28 = "treeView"; + var detector26 = /* @__PURE__ */ __name((txt) => { + return /^\s*treeView-beta/.test(txt); + }, "detector"); + var loader27 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_diagram3(), diagram_exports3)); + return { id: id28, diagram: diagram32 }; + }, "loader"); + var plugin22 = { + id: id28, + detector: detector26, + loader: loader27 + }; + var detector_default5 = plugin22; + + // src/diagrams/architecture/architectureDetector.ts + var id29 = "architecture"; + var detector27 = /* @__PURE__ */ __name((txt) => { + return /^\s*architecture/.test(txt); + }, "detector"); + var loader28 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_architectureDiagram(), architectureDiagram_exports)); + return { id: id29, diagram: diagram32 }; + }, "loader"); + var architecture = { + id: id29, + detector: detector27, + loader: loader28 + }; + var architectureDetector_default = architecture; + + // src/diagrams/eventmodeling/detector.ts + var id30 = "eventmodeling"; + var detector28 = /* @__PURE__ */ __name((txt) => { + return /^\s*eventmodeling/.test(txt); + }, "detector"); + var loader29 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_diagram4(), diagram_exports4)); + return { id: id30, diagram: diagram32 }; + }, "loader"); + var plugin23 = { + id: id30, + detector: detector28, + loader: loader29 + }; + var detector_default6 = plugin23; + + // src/diagrams/ishikawa/ishikawaDetector.ts + var id31 = "ishikawa"; + var detector29 = /* @__PURE__ */ __name((txt) => { + return /^\s*ishikawa(-beta)?\b/i.test(txt); + }, "detector"); + var loader30 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_ishikawaDiagram(), ishikawaDiagram_exports)); + return { id: id31, diagram: diagram32 }; + }, "loader"); + var ishikawa = { + id: id31, + detector: detector29, + loader: loader30 + }; + + // src/diagrams/venn/vennDetector.ts + var id32 = "venn"; + var detector30 = /* @__PURE__ */ __name((txt) => { + return /^\s*venn-beta/.test(txt); + }, "detector"); + var loader31 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_vennDiagram(), vennDiagram_exports)); + return { id: id32, diagram: diagram32 }; + }, "loader"); + var plugin24 = { + id: id32, + detector: detector30, + loader: loader31 + }; + var vennDetector_default = plugin24; + + // src/diagram-api/diagram-orchestration.ts + init_detectType(); + init_diagramAPI(); + + // src/diagrams/treemap/detector.ts + var id33 = "treemap"; + var detector31 = /* @__PURE__ */ __name((txt) => { + return /^\s*treemap/.test(txt); + }, "detector"); + var loader32 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_diagram5(), diagram_exports5)); + return { id: id33, diagram: diagram32 }; + }, "loader"); + var treemap = { + id: id33, + detector: detector31, + loader: loader32 + }; + + // src/diagrams/wardley/wardleyDetector.ts + var id34 = "wardley-beta"; + var detector32 = /* @__PURE__ */ __name((text4) => { + return /^\s*wardley-beta/i.test(text4); + }, "detector"); + var loader33 = /* @__PURE__ */ __name(async () => { + const { diagram: diagram32 } = await Promise.resolve().then(() => (init_wardleyDiagram(), wardleyDiagram_exports)); + return { id: id34, diagram: diagram32 }; + }, "loader"); + var plugin25 = { + id: id34, + detector: detector32, + loader: loader33 + }; + var wardleyDetector_default = plugin25; + + // src/diagram-api/diagram-orchestration.ts + var hasLoadedDiagrams = false; + var addDiagrams = /* @__PURE__ */ __name(() => { + if (hasLoadedDiagrams) { + return; + } + hasLoadedDiagrams = true; + registerDiagram("error", errorDiagram_default, (text4) => { + return text4.toLowerCase().trim() === "error"; + }); + registerDiagram( + "---", + // --- diagram type may appear if YAML front-matter is not parsed correctly + { + db: { + clear: /* @__PURE__ */ __name(() => { + }, "clear") + }, + styles: {}, + // should never be used + renderer: { + draw: /* @__PURE__ */ __name(() => { + }, "draw") + }, + parser: { + parse: /* @__PURE__ */ __name(() => { + throw new Error( + "Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks" + ); + }, "parse") + }, + init: /* @__PURE__ */ __name(() => null, "init") + // no op + }, + (text4) => { + return text4.toLowerCase().trimStart().startsWith("---"); + } + ); + if (true) { + registerLazyLoadedDiagrams(detector_default, detector_default3, architectureDetector_default); + } + registerLazyLoadedDiagrams( + c4Detector_default, + detector_default4, + classDetector_V2_default, + classDetector_default, + erDetector_default, + ganttDetector_default, + info, + pie, + requirementDetector_default, + sequenceDetector_default, + flowDetector_v2_default, + flowDetector_default, + detector_default2, + gitGraphDetector_default, + stateDetector_V2_default, + stateDetector_default, + journeyDetector_default, + quadrantDetector_default, + sankeyDetector_default, + packet, + xychartDetector_default, + blockDetector_default, + detector_default6, + detector_default5, + radar, + ishikawa, + treemap, + vennDetector_default, + wardleyDetector_default + ); + }, "addDiagrams"); + + // src/diagram-api/loadDiagram.ts + init_logger(); + init_detectType(); + init_diagramAPI(); + var loadRegisteredDiagrams = /* @__PURE__ */ __name(async () => { + log.debug(`Loading registered diagrams`); + const results = await Promise.allSettled( + Object.entries(detectors).map(async ([key, { detector: detector33, loader: loader34 }]) => { + if (!loader34) { + return; + } + try { + getDiagram(key); + } catch { + try { + const { diagram: diagram32, id: id35 } = await loader34(); + registerDiagram(id35, diagram32, detector33); + } catch (err) { + log.error(`Failed to load external diagram with key ${key}. Removing from detectors.`); + delete detectors[key]; + throw err; + } + } + }) + ); + const failed = results.filter((result) => result.status === "rejected"); + if (failed.length > 0) { + log.error(`Failed to load ${failed.length} external diagrams`); + for (const res of failed) { + log.error(res); + } + throw new Error(`Failed to load ${failed.length} external diagrams`); + } + }, "loadRegisteredDiagrams"); + + // src/mermaid.ts + init_logger(); + + // src/mermaidAPI.ts + init_src32(); + + // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Enum.js + var COMMENT = "comm"; + var RULESET = "rule"; + var DECLARATION = "decl"; + var MEDIA = "@media"; + var IMPORT = "@import"; + var SUPPORTS = "@supports"; + var NAMESPACE = "@namespace"; + var KEYFRAMES = "@keyframes"; + var LAYER = "@layer"; + var SCOPE = "@scope"; + + // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Utility.js + var abs3 = Math.abs; + var from = String.fromCharCode; + function trim(value2) { + return value2.trim(); + } + __name(trim, "trim"); + function replace(value2, pattern, replacement) { + return value2.replace(pattern, replacement); + } + __name(replace, "replace"); + function indexof(value2, search, position5) { + return value2.indexOf(search, position5); + } + __name(indexof, "indexof"); + function charat(value2, index) { + return value2.charCodeAt(index) | 0; + } + __name(charat, "charat"); + function substr(value2, begin, end2) { + return value2.slice(begin, end2); + } + __name(substr, "substr"); + function strlen(value2) { + return value2.length; + } + __name(strlen, "strlen"); + function sizeof(value2) { + return value2.length; + } + __name(sizeof, "sizeof"); + function append2(value2, array4) { + return array4.push(value2), value2; + } + __name(append2, "append"); + + // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Tokenizer.js + var line = 1; + var column = 1; + var length = 0; + var position4 = 0; + var character = 0; + var characters = ""; + function node(value2, root4, parent4, type3, props, children2, length2, siblings2) { + return { value: value2, root: root4, parent: parent4, type: type3, props, children: children2, line, column, length: length2, return: "", siblings: siblings2 }; + } + __name(node, "node"); + function char() { + return character; + } + __name(char, "char"); + function prev() { + character = position4 > 0 ? charat(characters, --position4) : 0; + if (column--, character === 10) + column = 1, line--; + return character; + } + __name(prev, "prev"); + function next2() { + character = position4 < length ? charat(characters, position4++) : 0; + if (column++, character === 10) + column = 1, line++; + return character; + } + __name(next2, "next"); + function peek() { + return charat(characters, position4); + } + __name(peek, "peek"); + function caret() { + return position4; + } + __name(caret, "caret"); + function slice4(begin, end2) { + return substr(characters, begin, end2); + } + __name(slice4, "slice"); + function token(type3) { + switch (type3) { + // \0 \t \n \r \s whitespace token + case 0: + case 9: + case 10: + case 13: + case 32: + return 5; + // ! + , / > @ ~ isolate token + case 33: + case 43: + case 44: + case 47: + case 62: + case 64: + case 126: + // ; { } breakpoint token + case 59: + case 123: + case 125: + return 4; + // : accompanied token + case 58: + return 3; + // " ' ( [ opening delimit token + case 34: + case 39: + case 40: + case 91: + return 2; + // ) ] closing delimit token + case 41: + case 93: + return 1; + } + return 0; + } + __name(token, "token"); + function alloc(value2) { + return line = column = 1, length = strlen(characters = value2), position4 = 0, []; + } + __name(alloc, "alloc"); + function dealloc(value2) { + return characters = "", value2; + } + __name(dealloc, "dealloc"); + function delimit(type3) { + return trim(slice4(position4 - 1, delimiter2(type3 === 91 ? type3 + 2 : type3 === 40 ? type3 + 1 : type3))); + } + __name(delimit, "delimit"); + function whitespace(type3) { + while (character = peek()) + if (character < 33) + next2(); + else + break; + return token(type3) > 2 || token(character) > 3 ? "" : " "; + } + __name(whitespace, "whitespace"); + function escaping(index, count2) { + while (--count2 && next2()) + if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) + break; + return slice4(index, caret() + (count2 < 6 && peek() == 32 && next2() == 32)); + } + __name(escaping, "escaping"); + function delimiter2(type3) { + while (next2()) + switch (character) { + // ] ) " ' + case type3: + return position4; + // " ' + case 34: + case 39: + if (type3 !== 34 && type3 !== 39) + delimiter2(character); + break; + // ( + case 40: + if (type3 === 41) + delimiter2(type3); + break; + // \ + case 92: + next2(); + break; + } + return position4; + } + __name(delimiter2, "delimiter"); + function commenter(type3, index) { + while (next2()) + if (type3 + character === 47 + 10) + break; + else if (type3 + character === 42 + 42 && peek() === 47) + break; + return "/*" + slice4(index, position4 - 1) + "*" + from(type3 === 47 ? type3 : next2()); + } + __name(commenter, "commenter"); + function identifier(index) { + while (!token(peek())) + next2(); + return slice4(index, position4); + } + __name(identifier, "identifier"); + + // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Parser.js + function compile(value2) { + return dealloc(parse4("", null, null, null, [""], value2 = alloc(value2), 0, [0], value2)); + } + __name(compile, "compile"); + function parse4(value2, root4, parent4, rule, rules, rulesets, pseudo, points, declarations) { + var index = 0; + var offset = 0; + var length2 = pseudo; + var atrule = 0; + var property3 = 0; + var previous = 0; + var variable = 1; + var scanning = 1; + var ampersand = 1; + var character2 = 0; + var type3 = ""; + var props = rules; + var children2 = rulesets; + var reference = rule; + var characters2 = type3; + while (scanning) + switch (previous = character2, character2 = next2()) { + // ( + case 40: + if (previous != 108 && charat(characters2, length2 - 1) == 58) { + if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f", abs3(index ? points[index - 1] : 0)) != -1) + ampersand = -1; + break; + } + // " ' [ + case 34: + case 39: + case 91: + characters2 += delimit(character2); + break; + // \t \n \r \s + case 9: + case 10: + case 13: + case 32: + characters2 += whitespace(previous); + break; + // \ + case 92: + characters2 += escaping(caret() - 1, 7); + continue; + // / + case 47: + switch (peek()) { + case 42: + case 47: + append2(comment(commenter(next2(), caret()), root4, parent4, declarations), declarations); + if ((token(previous || 1) == 5 || token(peek() || 1) == 5) && strlen(characters2) && substr(characters2, -1, void 0) !== " ") characters2 += " "; + break; + default: + characters2 += "/"; + } + break; + // { + case 123 * variable: + points[index++] = strlen(characters2) * ampersand; + // } ; \0 + case 125 * variable: + case 59: + case 0: + switch (character2) { + // \0 } + case 0: + case 125: + scanning = 0; + // ; + case 59 + offset: + if (ampersand == -1) characters2 = replace(characters2, /\f/g, ""); + if (property3 > 0 && (strlen(characters2) - length2 || variable === 0 && previous === 47)) + append2(property3 > 32 ? declaration(characters2 + ";", rule, parent4, length2 - 1, declarations) : declaration(replace(characters2, " ", "") + ";", rule, parent4, length2 - 2, declarations), declarations); + break; + // @ ; + case 59: + characters2 += ";"; + // { rule/at-rule + default: + append2(reference = ruleset(characters2, root4, parent4, index, offset, rules, points, type3, props = [], children2 = [], length2, rulesets), rulesets); + if (character2 === 123) + if (offset === 0) + parse4(characters2, root4, reference, reference, props, rulesets, length2, points, children2); + else { + switch (atrule) { + // c(ontainer) + case 99: + if (charat(characters2, 3) === 110) break; + // l(ayer) + case 108: + if (charat(characters2, 2) === 97) break; + default: + offset = 0; + // d(ocument) m(edia) s(upports) + case 100: + case 109: + case 115: + } + if (offset) parse4(value2, reference, reference, rule && append2(ruleset(value2, reference, reference, 0, 0, rules, points, type3, rules, props = [], length2, children2), children2), rules, children2, length2, points, rule ? props : children2); + else parse4(characters2, reference, reference, reference, [""], children2, 0, points, children2); + } + } + index = offset = property3 = 0, variable = ampersand = 1, type3 = characters2 = "", length2 = pseudo; + break; + // : + case 58: + length2 = 1 + strlen(characters2), property3 = previous; + default: + if (variable < 1) { + if (character2 == 123) + --variable; + else if (character2 == 125 && variable++ == 0 && prev() == 125) + continue; + } + switch (characters2 += from(character2), character2 * variable) { + // & + case 38: + ampersand = offset > 0 ? 1 : (characters2 += "\f", -1); + break; + // , + case 44: + points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1; + break; + // @ + case 64: + if (peek() === 45) + characters2 += delimit(next2()); + atrule = peek(), offset = length2 = strlen(type3 = characters2 += identifier(caret())), character2++; + break; + // - + case 45: + if (previous === 45 && strlen(characters2) == 2) + variable = 0; + } + } + return rulesets; + } + __name(parse4, "parse"); + function ruleset(value2, root4, parent4, index, offset, rules, points, type3, props, children2, length2, siblings2) { + var post = offset - 1; + var rule = offset === 0 ? rules : [""]; + var size4 = sizeof(rule); + for (var i2 = 0, j3 = 0, k2 = 0; i2 < index; ++i2) + for (var x5 = 0, y6 = substr(value2, post + 1, post = abs3(j3 = points[i2])), z3 = value2; x5 < size4; ++x5) + if (z3 = trim(j3 > 0 ? rule[x5] + " " + y6 : replace(y6, /&\f/g, rule[x5]))) + props[k2++] = z3; + return node(value2, root4, parent4, offset === 0 ? RULESET : type3, props, children2, length2, siblings2); + } + __name(ruleset, "ruleset"); + function comment(value2, root4, parent4, siblings2) { + return node(value2, root4, parent4, COMMENT, from(char()), substr(value2, 2, -2), 0, siblings2); + } + __name(comment, "comment"); + function declaration(value2, root4, parent4, length2, siblings2) { + return node(value2, root4, parent4, DECLARATION, substr(value2, 0, length2), substr(value2, length2 + 1, -1), length2, siblings2); + } + __name(declaration, "declaration"); + + // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Serializer.js + function serialize(children2, callback) { + var output2 = ""; + for (var i2 = 0; i2 < children2.length; i2++) + output2 += callback(children2[i2], i2, children2, callback) || ""; + return output2; + } + __name(serialize, "serialize"); + function stringify(element3, index, children2, callback) { + switch (element3.type) { + case LAYER: + if (element3.children.length) break; + case IMPORT: + case NAMESPACE: + case DECLARATION: + return element3.return = element3.return || element3.value; + case COMMENT: + return ""; + case KEYFRAMES: + return element3.return = element3.value + "{" + serialize(element3.children, callback) + "}"; + case RULESET: + if (!strlen(element3.value = element3.props.join(","))) return ""; + } + return strlen(children2 = serialize(element3.children, callback)) ? element3.return = element3.value + "{" + children2 + "}" : ""; + } + __name(stringify, "stringify"); + + // ../../node_modules/.pnpm/stylis@4.3.6/node_modules/stylis/src/Middleware.js + function middleware(collection4) { + var length2 = sizeof(collection4); + return function(element3, index, children2, callback) { + var output2 = ""; + for (var i2 = 0; i2 < length2; i2++) + output2 += collection4[i2](element3, index, children2, callback) || ""; + return output2; + }; + } + __name(middleware, "middleware"); + + // src/mermaidAPI.ts + init_purify_es(); + init_compat(); + + // src/accessibility.ts + var SVG_ROLE = "graphics-document document"; + function setA11yDiagramInfo(svg2, diagramType) { + svg2.attr("role", SVG_ROLE); + if (diagramType !== "") { + svg2.attr("aria-roledescription", diagramType); + } + } + __name(setA11yDiagramInfo, "setA11yDiagramInfo"); + function addSVGa11yTitleDescription(svg2, a11yTitle, a11yDesc, baseId) { + if (svg2.insert === void 0) { + return; + } + if (a11yDesc) { + const descId = `chart-desc-${baseId}`; + svg2.attr("aria-describedby", descId); + svg2.insert("desc", ":first-child").attr("id", descId).text(a11yDesc); + } + if (a11yTitle) { + const titleId = `chart-title-${baseId}`; + svg2.attr("aria-labelledby", titleId); + svg2.insert("title", ":first-child").attr("id", titleId).text(a11yTitle); + } + } + __name(addSVGa11yTitleDescription, "addSVGa11yTitleDescription"); + + // src/mermaidAPI.ts + init_assignWithDepth(); + init_config(); + init_config(); + + // src/Diagram.ts + init_config(); + init_diagramAPI(); + init_detectType(); + init_errors(); + init_utils2(); + var Diagram = class _Diagram { + constructor(type3, text4, db10, parser29, renderer13) { + this.type = type3; + this.text = text4; + this.db = db10; + this.parser = parser29; + this.renderer = renderer13; + } + static { + __name(this, "Diagram"); + } + static async fromText(text4, metadata = {}) { + const config5 = getConfig(); + const type3 = detectType(text4, config5); + text4 = encodeEntities(text4) + "\n"; + try { + getDiagram(type3); + } catch { + const loader34 = getDiagramLoader(type3); + if (!loader34) { + throw new UnknownDiagramError(`Diagram ${type3} not found.`); + } + const { id: id35, diagram: diagram32 } = await loader34(); + registerDiagram(id35, diagram32); + } + const { db: db10, parser: parser29, renderer: renderer13, init: init3 } = getDiagram(type3); + if (parser29.parser) { + parser29.parser.yy = db10; + } + db10.clear?.(); + init3?.(config5); + if (metadata.title) { + db10.setDiagramTitle?.(metadata.title); + } + await parser29.parse(text4); + return new _Diagram(type3, text4, db10, parser29, renderer13); + } + async render(id35, version3) { + await this.renderer.draw(this.text, id35, version3, this); + } + getParser() { + return this.parser; + } + getType() { + return this.type; + } + }; + + // src/mermaidAPI.ts + init_common(); + + // src/interactionDb.ts + var interactionFunctions = []; + var attachFunctions = /* @__PURE__ */ __name(() => { + interactionFunctions.forEach((f2) => { + f2(); + }); + interactionFunctions = []; + }, "attachFunctions"); + + // src/mermaidAPI.ts + init_logger(); + + // src/diagram-api/comments.ts + var cleanupComments = /* @__PURE__ */ __name((text4) => { + return text4.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart(); + }, "cleanupComments"); + + // src/diagram-api/frontmatter.ts + init_regexes(); + init_js_yaml(); + function extractFrontMatter(text4) { + const matches33 = text4.match(frontMatterRegex); + if (!matches33) { + return { + text: text4, + metadata: {} + }; + } + let parsed = load(matches33[1], { + // To support config, we need JSON schema. + // https://www.yaml.org/spec/1.2/spec.html#id2803231 + schema: JSON_SCHEMA + }) ?? {}; + parsed = typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {}; + const metadata = {}; + if (parsed.displayMode) { + metadata.displayMode = parsed.displayMode.toString(); + } + if (parsed.title) { + metadata.title = parsed.title.toString(); + } + if (parsed.config) { + metadata.config = parsed.config; + } + return { + text: text4.slice(matches33[0].length), + metadata + }; + } + __name(extractFrontMatter, "extractFrontMatter"); + + // src/preprocess.ts + init_utils2(); + var cleanupText = /* @__PURE__ */ __name((code) => { + return code.replace(/\r\n?/g, "\n").replace( + /<(\w+)([^>]*)>/g, + (match3, tag, attributes) => "<" + tag + attributes.replace(/="([^"]*)"/g, "='$1'") + ">" + ); + }, "cleanupText"); + var processFrontmatter = /* @__PURE__ */ __name((code) => { + const { text: text4, metadata } = extractFrontMatter(code); + const { displayMode: displayMode2, title: title2, config: config5 = {} } = metadata; + if (displayMode2) { + if (!config5.gantt) { + config5.gantt = {}; + } + config5.gantt.displayMode = displayMode2; + } + return { title: title2, config: config5, text: text4 }; + }, "processFrontmatter"); + var processDirectives = /* @__PURE__ */ __name((code) => { + const initDirective = utils_default2.detectInit(code) ?? {}; + const wrapDirectives = utils_default2.detectDirective(code, "wrap"); + if (Array.isArray(wrapDirectives)) { + initDirective.wrap = wrapDirectives.some(({ type: type3 }) => type3 === "wrap"); + } else if (wrapDirectives?.type === "wrap") { + initDirective.wrap = true; + } + return { + text: removeDirectives(code), + directive: initDirective + }; + }, "processDirectives"); + function preprocessDiagram(code) { + const cleanedCode = cleanupText(code); + const frontMatterResult = processFrontmatter(cleanedCode); + const directiveResult = processDirectives(frontMatterResult.text); + const config5 = cleanAndMerge(frontMatterResult.config, directiveResult.directive); + code = cleanupComments(directiveResult.text); + return { + code, + title: frontMatterResult.title, + config: config5 + }; + } + __name(preprocessDiagram, "preprocessDiagram"); + + // src/mermaidAPI.ts + init_styles(); + init_themes(); + init_utils2(); + + // src/utils/base64.ts + function toBase64(str2) { + const utf8Bytes = new TextEncoder().encode(str2); + const utf8Str = Array.from(utf8Bytes, (byte) => String.fromCodePoint(byte)).join(""); + return btoa(utf8Str); + } + __name(toBase64, "toBase64"); + + // src/mermaidAPI.ts + init_sanitizeDirective(); + var MAX_TEXTLENGTH = 5e4; + var MAX_TEXTLENGTH_EXCEEDED_MSG = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa"; + var SECURITY_LVL_SANDBOX = "sandbox"; + var SECURITY_LVL_LOOSE = "loose"; + var XMLNS_SVG_STD = "http://www.w3.org/2000/svg"; + var XMLNS_XLINK_STD = "http://www.w3.org/1999/xlink"; + var XMLNS_XHTML_STD = "http://www.w3.org/1999/xhtml"; + var IFRAME_WIDTH = "100%"; + var IFRAME_HEIGHT = "100%"; + var IFRAME_STYLES = "border:0;margin:0;"; + var IFRAME_BODY_STYLE = "margin:0"; + var IFRAME_SANDBOX_OPTS = "allow-top-navigation-by-user-activation allow-popups"; + var IFRAME_NOT_SUPPORTED_MSG = 'The "iframe" tag is not supported by your browser.'; + var DOMPURIFY_TAGS = ["foreignobject"]; + var DOMPURIFY_ATTR = ["dominant-baseline"]; + function processAndSetConfigs(text4) { + const processed2 = preprocessDiagram(text4); + reset(); + addDirective(processed2.config ?? {}); + return processed2; + } + __name(processAndSetConfigs, "processAndSetConfigs"); + async function parse5(text4, parseOptions) { + addDiagrams(); + try { + const { code, config: config5 } = processAndSetConfigs(text4); + const diagram32 = await getDiagramFromText(code); + return { diagramType: diagram32.type, config: config5 }; + } catch (error3) { + if (parseOptions?.suppressErrors) { + return false; + } + throw error3; + } + } + __name(parse5, "parse"); + var cssImportantStyles = /* @__PURE__ */ __name((cssClass, element3, cssClasses = []) => { + const declarationBlock = sanitizeCss(`{ ${cssClasses.join(" !important; ")} !important; }`); + return `.${cssClass} ${element3} ${declarationBlock}`; + }, "cssImportantStyles"); + var createCssStyles = /* @__PURE__ */ __name((config5, classDefs = /* @__PURE__ */ new Map()) => { + const cssStyles = new CSSStyleSheet(); + if (config5.fontFamily !== void 0) { + cssStyles.insertRule( + `:root { --mermaid-font-family: ${config5.fontFamily}}`, + cssStyles.cssRules.length + ); + } + if (config5.altFontFamily !== void 0) { + cssStyles.insertRule( + `:root { --mermaid-alt-font-family: ${config5.altFontFamily}}`, + cssStyles.cssRules.length + ); + } + if (classDefs instanceof Map) { + const htmlLabels = getEffectiveHtmlLabels(config5); + const cssHtmlElements = ["> *", "span"]; + const cssShapeElements = ["rect", "polygon", "ellipse", "circle", "path"]; + const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements; + classDefs.forEach((styleClassDef) => { + if (!isEmpty(styleClassDef.styles)) { + cssElements.forEach((cssElement) => { + cssStyles.insertRule( + cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles), + cssStyles.cssRules.length + ); + }); + } + if (!isEmpty(styleClassDef.textStyles)) { + cssStyles.insertRule( + cssImportantStyles( + styleClassDef.id, + "tspan", + (styleClassDef?.textStyles || []).map((s2) => s2.replace("color", "fill")) + ), + cssStyles.cssRules.length + ); + } + }); + } + let cssString = ""; + if (config5.themeCSS !== void 0) { + if (typeof cssStyles.replaceSync === "function") { + const themeCssStyleSheet = new CSSStyleSheet(); + themeCssStyleSheet.replaceSync(config5.themeCSS); + cssString = cssStyleSheetToString(themeCssStyleSheet) + "\n"; + } else { + cssString += `${config5.themeCSS} +`; + } + } + return cssString + cssStyleSheetToString(cssStyles); + }, "createCssStyles"); + var compileCSS = /* @__PURE__ */ __name((namespace, css) => { + return serialize( + compile(`${namespace}{${css}}`), + middleware([ + /* @__PURE__ */ __name(function addNamespace(element3, _index, _children, _callback) { + if (element3.type === "rule" && Array.isArray(element3.props)) { + if (element3.parent && element3.parent.type === KEYFRAMES) { + return; + } + element3.props = element3.props.map((prop) => { + if (!prop.startsWith(namespace)) { + return `${namespace} ${prop}`; + } + return prop; + }); + } else if (element3.type.startsWith("@")) { + const nestedAtRules = [ + MEDIA, + SUPPORTS, + LAYER, + SCOPE, + "@container", + "@starting-style" + ]; + const allowedAtRules = [ + ...nestedAtRules, + KEYFRAMES + // needed for Mermaid's animation feature + ]; + if (!allowedAtRules.includes(element3.type)) { + log.warn(`Removing unsupported at-rule ${element3.type} from CSS`); + element3.type = COMMENT; + } + } + }, "addNamespace"), + stringify + ]) + ); + }, "compileCSS"); + var createUserStyles = /* @__PURE__ */ __name((config5, graphType, classDefs, svgId) => { + const userCSSstyles = createCssStyles(config5, classDefs); + const allStyles = styles_default( + graphType, + userCSSstyles, + { ...config5.themeVariables, theme: config5.theme, look: config5.look }, + svgId + ); + return compileCSS(svgId, allStyles); + }, "createUserStyles"); + var cleanUpSvgCode = /* @__PURE__ */ __name((svgCode = "", inSandboxMode, useArrowMarkerUrls) => { + let cleanedUpSvg = svgCode; + if (!useArrowMarkerUrls && !inSandboxMode) { + cleanedUpSvg = cleanedUpSvg.replace( + /marker-end="url\([\d+./:=?A-Za-z-]*?#/g, + 'marker-end="url(#' + ); + } + cleanedUpSvg = decodeEntities(cleanedUpSvg); + cleanedUpSvg = cleanedUpSvg.replace(/
    /g, "
    "); + return cleanedUpSvg; + }, "cleanUpSvgCode"); + var putIntoIFrame = /* @__PURE__ */ __name((svgCode = "", svgElement) => { + const height2 = svgElement?.viewBox?.baseVal?.height ? svgElement.viewBox.baseVal.height + "px" : IFRAME_HEIGHT; + const base64encodedSrc = toBase64(`${svgCode}`); + return ``; + }, "putIntoIFrame"); + var appendDivSvgG = /* @__PURE__ */ __name((parentRoot, id35, enclosingDivId, divStyle, svgXlink) => { + const enclosingDiv = parentRoot.append("div"); + enclosingDiv.attr("id", enclosingDivId); + if (divStyle) { + enclosingDiv.attr("style", divStyle); + } + const svgNode2 = enclosingDiv.append("svg").attr("id", id35).attr("width", "100%").attr("xmlns", XMLNS_SVG_STD); + if (svgXlink) { + svgNode2.attr("xmlns:xlink", svgXlink); + } + svgNode2.append("g"); + return parentRoot; + }, "appendDivSvgG"); + function sandboxedIframe(parentNode, iFrameId) { + return parentNode.append("iframe").attr("id", iFrameId).attr("style", "width: 100%; height: 100%;").attr("sandbox", ""); + } + __name(sandboxedIframe, "sandboxedIframe"); + var removeExistingElements = /* @__PURE__ */ __name((doc, id35, divId, iFrameId) => { + doc.getElementById(id35)?.remove(); + doc.getElementById(divId)?.remove(); + doc.getElementById(iFrameId)?.remove(); + }, "removeExistingElements"); + var render7 = /* @__PURE__ */ __name(async function(id35, text4, svgContainingElement) { + addDiagrams(); + const processed2 = processAndSetConfigs(text4); + text4 = processed2.code; + const config5 = getConfig(); + log.debug(config5); + if (text4.length > (config5?.maxTextSize ?? MAX_TEXTLENGTH)) { + text4 = MAX_TEXTLENGTH_EXCEEDED_MSG; + } + const idSelector = `#${id35}`; + const iFrameID = "i" + id35; + const iFrameID_selector = "#" + iFrameID; + const enclosingDivID = "d" + id35; + const enclosingDivID_selector = "#" + enclosingDivID; + const removeTempElements = /* @__PURE__ */ __name(() => { + const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector; + const node2 = select_default2(tmpElementSelector).node(); + if (node2 && "remove" in node2) { + node2.remove(); + } + }, "removeTempElements"); + let root4 = select_default2(document.body); + const isSandboxed = config5.securityLevel === SECURITY_LVL_SANDBOX; + const isLooseSecurityLevel = config5.securityLevel === SECURITY_LVL_LOOSE; + const fontFamily = config5.fontFamily; + if (svgContainingElement !== void 0) { + if (svgContainingElement) { + svgContainingElement.innerHTML = ""; + } + if (isSandboxed) { + const iframe = sandboxedIframe(select_default2(svgContainingElement), iFrameID); + root4 = select_default2(iframe.nodes()[0].contentDocument.body); + root4.node().style.margin = "0"; + } else { + root4 = select_default2(svgContainingElement); + } + appendDivSvgG(root4, id35, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD); + } else { + removeExistingElements(document, id35, enclosingDivID, iFrameID); + if (isSandboxed) { + const iframe = sandboxedIframe(select_default2(document.body), iFrameID); + root4 = select_default2(iframe.nodes()[0].contentDocument.body); + root4.node().style.margin = "0"; + } else { + root4 = select_default2("body"); + } + appendDivSvgG(root4, id35, enclosingDivID); + } + let diag; + let parseEncounteredException; + try { + diag = await Diagram.fromText(text4, { title: processed2.title }); + } catch (error3) { + if (config5.suppressErrorRendering) { + removeTempElements(); + throw error3; + } + diag = await Diagram.fromText("error"); + parseEncounteredException = error3; + } + const element3 = root4.select(enclosingDivID_selector).node(); + const diagramType = diag.type; + const svg2 = element3.firstChild; + const firstChild = svg2.firstChild; + const diagramClassDefs = diag.renderer.getClasses?.(text4, diag); + const rules = createUserStyles(config5, diagramType, diagramClassDefs, idSelector); + const style1 = document.createElement("style"); + style1.innerHTML = rules; + svg2.insertBefore(style1, firstChild); + try { + await diag.renderer.draw(text4, id35, "11.15.0", diag); + } catch (e3) { + if (config5.suppressErrorRendering) { + removeTempElements(); + } else { + errorRenderer_default.draw(text4, id35, "11.15.0"); + } + throw e3; + } + const svgNode2 = root4.select(`${enclosingDivID_selector} svg`); + const a11yTitle = diag.db.getAccTitle?.(); + const a11yDescr = diag.db.getAccDescription?.(); + addA11yInfo(diagramType, svgNode2, a11yTitle, a11yDescr); + root4.select(`[id="${id35}"]`).selectAll("foreignobject > *").attr("xmlns", XMLNS_XHTML_STD); + let svgCode = root4.select(enclosingDivID_selector).node().innerHTML; + log.debug("config.arrowMarkerAbsolute", config5.arrowMarkerAbsolute); + svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config5.arrowMarkerAbsolute)); + if (isSandboxed) { + const svgEl = root4.select(enclosingDivID_selector + " svg").node(); + svgCode = putIntoIFrame(svgCode, svgEl); + } else if (!isLooseSecurityLevel) { + svgCode = purify.sanitize(svgCode, { + ADD_TAGS: DOMPURIFY_TAGS, + ADD_ATTR: DOMPURIFY_ATTR, + HTML_INTEGRATION_POINTS: { foreignobject: true } + }); + } + attachFunctions(); + if (parseEncounteredException) { + throw parseEncounteredException; + } + removeTempElements(); + return { + diagramType, + svg: svgCode, + bindFunctions: diag.db.bindFunctions + }; + }, "render"); + function initialize(userOptions = {}) { + const options2 = assignWithDepth_default({}, userOptions); + if (options2?.fontFamily && !options2.themeVariables?.fontFamily) { + if (!options2.themeVariables) { + options2.themeVariables = {}; + } + options2.themeVariables.fontFamily = options2.fontFamily; + } + saveConfigFromInitialize(options2); + if (options2?.theme && options2.theme in themes_default) { + options2.themeVariables = themes_default[options2.theme].getThemeVariables( + options2.themeVariables + ); + } else if (options2) { + options2.themeVariables = themes_default.default.getThemeVariables(options2.themeVariables); + } + const config5 = typeof options2 === "object" ? setSiteConfig(options2) : getSiteConfig(); + setLogLevel(config5.logLevel); + addDiagrams(); + } + __name(initialize, "initialize"); + var getDiagramFromText = /* @__PURE__ */ __name((text4, metadata = {}) => { + const { code } = preprocessDiagram(text4); + return Diagram.fromText(code, metadata); + }, "getDiagramFromText"); + function addA11yInfo(diagramType, svgNode2, a11yTitle, a11yDescr) { + setA11yDiagramInfo(svgNode2, diagramType); + addSVGa11yTitleDescription(svgNode2, a11yTitle, a11yDescr, svgNode2.attr("id")); + } + __name(addA11yInfo, "addA11yInfo"); + var mermaidAPI = Object.freeze({ + render: render7, + parse: parse5, + getDiagramFromText, + initialize, + getConfig, + setConfig, + getSiteConfig, + updateSiteConfig, + reset: /* @__PURE__ */ __name(() => { + reset(); + }, "reset"), + globalReset: /* @__PURE__ */ __name(() => { + reset(defaultConfig); + }, "globalReset"), + defaultConfig + }); + setLogLevel(getConfig().logLevel); + reset(getConfig()); + + // src/mermaid.ts + init_render2(); + init_utils2(); + var handleError = /* @__PURE__ */ __name((error3, errors, parseError) => { + log.warn(error3); + if (isDetailedError(error3)) { + if (parseError) { + parseError(error3.str, error3.hash); + } + errors.push({ ...error3, message: error3.str, error: error3 }); + } else { + if (parseError) { + parseError(error3); + } + if (error3 instanceof Error) { + errors.push({ + str: error3.message, + message: error3.message, + hash: error3.name, + error: error3 + }); + } + } + }, "handleError"); + var run4 = /* @__PURE__ */ __name(async function(options2 = { + querySelector: ".mermaid" + }) { + try { + await runThrowsErrors(options2); + } catch (e3) { + if (isDetailedError(e3)) { + log.error(e3.str); + } + if (mermaid.parseError) { + mermaid.parseError(e3); + } + if (!options2.suppressErrors) { + log.error("Use the suppressErrors option to suppress these errors"); + throw e3; + } + } + }, "run"); + var runThrowsErrors = /* @__PURE__ */ __name(async function({ postRenderCallback, querySelector, nodes: nodes5 } = { + querySelector: ".mermaid" + }) { + const conf5 = mermaidAPI.getConfig(); + log.debug(`${!postRenderCallback ? "No " : ""}Callback function found`); + let nodesToProcess; + if (nodes5) { + nodesToProcess = nodes5; + } else if (querySelector) { + nodesToProcess = document.querySelectorAll(querySelector); + } else { + throw new Error("Nodes and querySelector are both undefined"); + } + log.debug(`Found ${nodesToProcess.length} diagrams`); + if (conf5?.startOnLoad !== void 0) { + log.debug("Start On Load: " + conf5?.startOnLoad); + mermaidAPI.updateSiteConfig({ startOnLoad: conf5?.startOnLoad }); + } + const idGenerator = new utils_default2.InitIDGenerator(conf5.deterministicIds, conf5.deterministicIDSeed); + let txt; + const errors = []; + for (const element3 of Array.from(nodesToProcess)) { + log.info("Rendering diagram: " + element3.id); + if (element3.getAttribute("data-processed")) { + continue; + } + element3.setAttribute("data-processed", "true"); + const id35 = `mermaid-${idGenerator.next()}`; + txt = element3.innerHTML; + txt = dedent(utils_default2.entityDecode(txt)).trim().replace(//gi, "
    "); + const init3 = utils_default2.detectInit(txt); + if (init3) { + log.debug("Detected early reinit: ", init3); + } + try { + const { svg: svg2, bindFunctions: bindFunctions2 } = await render8(id35, txt, element3); + element3.innerHTML = svg2; + if (postRenderCallback) { + await postRenderCallback(id35); + } + if (bindFunctions2) { + bindFunctions2(element3); + } + } catch (error3) { + handleError(error3, errors, mermaid.parseError); + } + } + if (errors.length > 0) { + throw errors[0]; + } + }, "runThrowsErrors"); + var initialize2 = /* @__PURE__ */ __name(function(config5) { + mermaidAPI.initialize(config5); + }, "initialize"); + var init2 = /* @__PURE__ */ __name(async function(config5, nodes5, callback) { + log.warn("mermaid.init is deprecated. Please use run instead."); + if (config5) { + initialize2(config5); + } + const runOptions = { postRenderCallback: callback, querySelector: ".mermaid" }; + if (typeof nodes5 === "string") { + runOptions.querySelector = nodes5; + } else if (nodes5) { + if (nodes5 instanceof HTMLElement) { + runOptions.nodes = [nodes5]; + } else { + runOptions.nodes = nodes5; + } + } + await run4(runOptions); + }, "init"); + var registerExternalDiagrams = /* @__PURE__ */ __name(async (diagrams2, { + lazyLoad = true + } = {}) => { + addDiagrams(); + registerLazyLoadedDiagrams(...diagrams2); + if (lazyLoad === false) { + await loadRegisteredDiagrams(); + } + }, "registerExternalDiagrams"); + var contentLoaded = /* @__PURE__ */ __name(function() { + if (mermaid.startOnLoad) { + const { startOnLoad } = mermaidAPI.getConfig(); + if (startOnLoad) { + mermaid.run().catch((err) => log.error("Mermaid failed to initialize", err)); + } + } + }, "contentLoaded"); + if (typeof document !== "undefined") { + window.addEventListener("load", contentLoaded, false); + } + var setParseErrorHandler = /* @__PURE__ */ __name(function(parseErrorHandler) { + mermaid.parseError = parseErrorHandler; + }, "setParseErrorHandler"); + var executionQueue = []; + var executionQueueRunning = false; + var executeQueue = /* @__PURE__ */ __name(async () => { + if (executionQueueRunning) { + return; + } + executionQueueRunning = true; + while (executionQueue.length > 0) { + const f2 = executionQueue.shift(); + if (f2) { + try { + await f2(); + } catch (e3) { + log.error("Error executing queue", e3); + } + } + } + executionQueueRunning = false; + }, "executeQueue"); + var parse6 = /* @__PURE__ */ __name(async (text4, parseOptions) => { + return new Promise((resolve2, reject3) => { + const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => { + mermaidAPI.parse(text4, parseOptions).then( + (r2) => { + res(r2); + resolve2(r2); + }, + (e3) => { + log.error("Error parsing", e3); + mermaid.parseError?.(e3); + rej(e3); + reject3(e3); + } + ); + }), "performCall"); + executionQueue.push(performCall); + executeQueue().catch(reject3); + }); + }, "parse"); + var render8 = /* @__PURE__ */ __name((id35, text4, container2) => { + return new Promise((resolve2, reject3) => { + const performCall = /* @__PURE__ */ __name(() => new Promise((res, rej) => { + mermaidAPI.render(id35, text4, container2).then( + (r2) => { + res(r2); + resolve2(r2); + }, + (e3) => { + log.error("Error parsing", e3); + mermaid.parseError?.(e3); + rej(e3); + reject3(e3); + } + ); + }), "performCall"); + executionQueue.push(performCall); + executeQueue().catch(reject3); + }); + }, "render"); + var getRegisteredDiagramsMetadata = /* @__PURE__ */ __name(() => { + return Object.keys(detectors).map((id35) => ({ + id: id35 + })); + }, "getRegisteredDiagramsMetadata"); + var mermaid = { + startOnLoad: true, + mermaidAPI, + parse: parse6, + render: render8, + init: init2, + run: run4, + registerExternalDiagrams, + registerLayoutLoaders, + initialize: initialize2, + parseError: void 0, + contentLoaded, + setParseErrorHandler, + detectType, + registerIconPacks, + getRegisteredDiagramsMetadata + }; + var mermaid_default = mermaid; + return __toCommonJS(mermaid_exports); +})(); +/*! Bundled license information: + +lodash-es/lodash.js: + (** + * @license + * Lodash (Custom Build) + * Build: `lodash modularize exports="es" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + *) +*/ +/*! Check if previously processed */ +/*! + * Wait for document loaded before starting the execution + */ +/*! Bundled license information: + +dompurify/dist/purify.es.mjs: + (*! @license DOMPurify 3.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.0/LICENSE *) + +js-yaml/dist/js-yaml.mjs: + (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *) + +lodash-es/lodash.js: + (** + * @license + * Lodash (Custom Build) + * Build: `lodash modularize exports="es" --repo lodash/lodash#4.18.1 -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + *) + +cytoscape/dist/cytoscape.esm.mjs: + (*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + *) + (*! + Event object based on jQuery events, MIT license + + https://jquery.org/license/ + https://tldrlegal.com/license/mit-license + https://github.com/jquery/jquery/blob/master/src/event.js + *) + (*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *) + (*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *) +*/ +globalThis["mermaid"] = globalThis.__esbuild_esm_mermaid_nm["mermaid"].default; diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.js.map b/tools/ui/node_modules/mermaid/dist/mermaid.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bc5918141a6409afa5912203f360dfc9fae1e40f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.js.map @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:732c19ccf1f2e9ed3808a2cef8f37729a3f283d98a5095368fe448c334bd0ec4 +size 12236321 diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.min.js b/tools/ui/node_modules/mermaid/dist/mermaid.min.js new file mode 100644 index 0000000000000000000000000000000000000000..dd3209bdb84dfe7bed3a6ecade7c8ac9d12ceac2 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.min.js @@ -0,0 +1,3405 @@ +"use strict";var __esbuild_esm_mermaid_nm;(__esbuild_esm_mermaid_nm||={}).mermaid=(()=>{var sNe=Object.create;var Ky=Object.defineProperty;var oNe=Object.getOwnPropertyDescriptor;var lNe=Object.getOwnPropertyNames;var cNe=Object.getPrototypeOf,uNe=Object.prototype.hasOwnProperty;var o=(e,t)=>Ky(e,"name",{value:t,configurable:!0});var z=(e,t)=>()=>(e&&(t=e(e=0)),t);var Js=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xr=(e,t)=>{for(var r in t)Ky(e,r,{get:t[r],enumerable:!0})},AU=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of lNe(t))!uNe.call(e,n)&&n!==r&&Ky(e,n,{get:()=>t[n],enumerable:!(i=oNe(t,n))||i.enumerable});return e};var ys=(e,t,r)=>(r=e!=null?sNe(cNe(e)):{},AU(t||!e||!e.__esModule?Ky(r,"default",{value:e,enumerable:!0}):r,e)),hNe=e=>AU(Ky({},"__esModule",{value:!0}),e);var dNe,_m,Q_,_U,CC=z(()=>{"use strict";dNe=Object.freeze({left:0,top:0,width:16,height:16}),_m=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Q_=Object.freeze({...dNe,..._m}),_U=Object.freeze({...Q_,body:"",hidden:!1})});var fNe,DU,RU=z(()=>{"use strict";CC();fNe=Object.freeze({width:null,height:null}),DU=Object.freeze({...fNe,..._m})});var J_,kC,LU=z(()=>{"use strict";J_=o((e,t,r,i="")=>{let n=e.split(":");if(e.slice(0,1)==="@"){if(n.length<2||n.length>3)return null;i=n.shift().slice(1)}if(n.length>3||!n.length)return null;if(n.length>1){let l=n.pop(),u=n.pop(),h={provider:n.length>0?n[0]:i,prefix:u,name:l};return t&&!kC(h)?null:h}let a=n[0],s=a.split("-");if(s.length>1){let l={provider:i,prefix:s.shift(),name:s.join("-")};return t&&!kC(l)?null:l}if(r&&i===""){let l={provider:i,prefix:"",name:a};return t&&!kC(l,r)?null:l}return null},"stringToIcon"),kC=o((e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1,"validateIconName")});function MU(e,t){let r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);let i=((e.rotate||0)+(t.rotate||0))%4;return i&&(r.rotate=i),r}var NU=z(()=>{"use strict";o(MU,"mergeIconTransformations")});function e7(e,t){let r=MU(e,t);for(let i in _U)i in _m?i in e&&!(i in r)&&(r[i]=_m[i]):i in t?r[i]=t[i]:i in e&&(r[i]=e[i]);return r}var IU=z(()=>{"use strict";CC();NU();o(e7,"mergeIconData")});function OU(e,t){let r=e.icons,i=e.aliases||Object.create(null),n=Object.create(null);function a(s){if(r[s])return n[s]=[];if(!(s in n)){n[s]=null;let l=i[s]&&i[s].parent,u=l&&a(l);u&&(n[s]=[l].concat(u))}return n[s]}return o(a,"resolve"),(t||Object.keys(r).concat(Object.keys(i))).forEach(a),n}var PU=z(()=>{"use strict";o(OU,"getIconsTree")});function BU(e,t,r){let i=e.icons,n=e.aliases||Object.create(null),a={};function s(l){a=e7(i[l]||n[l],a)}return o(s,"parse"),s(t),r.forEach(s),e7(e,a)}function t7(e,t){if(e.icons[t])return BU(e,t,[]);let r=OU(e,[t])[t];return r?BU(e,t,r):null}var FU=z(()=>{"use strict";IU();PU();o(BU,"internalGetIconData");o(t7,"getIconData")});function r7(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;let i=e.split(pNe);if(i===null||!i.length)return e;let n=[],a=i.shift(),s=mNe.test(a);for(;;){if(s){let l=parseFloat(a);isNaN(l)?n.push(a):n.push(Math.ceil(l*t*r)/r)}else n.push(a);if(a=i.shift(),a===void 0)return n.join("");s=!s}}var pNe,mNe,$U=z(()=>{"use strict";pNe=/(-?[0-9.]*[0-9]+[0-9.]*)/g,mNe=/^-?[0-9.]*[0-9]+[0-9.]*$/g;o(r7,"calculateSize")});function gNe(e,t="defs"){let r="",i=e.indexOf("<"+t);for(;i>=0;){let n=e.indexOf(">",i),a=e.indexOf("",a);if(s===-1)break;r+=e.slice(n+1,a).trim(),e=e.slice(0,i).trim()+e.slice(s+1)}return{defs:r,content:e}}function yNe(e,t){return e?""+e+""+t:t}function zU(e,t,r){let i=gNe(e);return yNe(i.defs,t+i.content+r)}var GU=z(()=>{"use strict";o(gNe,"splitSVGDefs");o(yNe,"mergeDefsAndContent");o(zU,"wrapSVGContent")});function i7(e,t){let r={...Q_,...e},i={...DU,...t},n={left:r.left,top:r.top,width:r.width,height:r.height},a=r.body;[r,i].forEach(y=>{let v=[],x=y.hFlip,b=y.vFlip,T=y.rotate;x?b?T+=2:(v.push("translate("+(n.width+n.left).toString()+" "+(0-n.top).toString()+")"),v.push("scale(-1 1)"),n.top=n.left=0):b&&(v.push("translate("+(0-n.left).toString()+" "+(n.height+n.top).toString()+")"),v.push("scale(1 -1)"),n.top=n.left=0);let w;switch(T<0&&(T-=Math.floor(T/4)*4),T=T%4,T){case 1:w=n.height/2+n.top,v.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:v.unshift("rotate(180 "+(n.width/2+n.left).toString()+" "+(n.height/2+n.top).toString()+")");break;case 3:w=n.width/2+n.left,v.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}T%2===1&&(n.left!==n.top&&(w=n.left,n.left=n.top,n.top=w),n.width!==n.height&&(w=n.width,n.width=n.height,n.height=w)),v.length&&(a=zU(a,'',""))});let s=i.width,l=i.height,u=n.width,h=n.height,d,f;s===null?(f=l===null?"1em":l==="auto"?h:l,d=r7(f,u/h)):(d=s==="auto"?u:s,f=l===null?r7(d,h/u):l==="auto"?h:l);let p={},m=o((y,v)=>{vNe(v)||(p[y]=v.toString())},"setAttr");m("width",d),m("height",f);let g=[n.left,n.top,u,h];return p.viewBox=g.join(" "),{attributes:p,viewBox:g,body:a}}var vNe,VU=z(()=>{"use strict";CC();RU();$U();GU();vNe=o(e=>e==="unset"||e==="undefined"||e==="none","isUnsetKeyword");o(i7,"iconToSVG")});function n7(e,t=bNe){let r=[],i;for(;i=xNe.exec(e);)r.push(i[1]);if(!r.length)return e;let n="suffix"+(Math.random()*16777216|Date.now()).toString(16);return r.forEach(a=>{let s=typeof t=="function"?t(a):t+(TNe++).toString(),l=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+s+n+"$3")}),e=e.replace(new RegExp(n,"g"),""),e}var xNe,bNe,TNe,WU=z(()=>{"use strict";xNe=/\sid="(\S+)"/g,bNe="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),TNe=0;o(n7,"replaceIDs")});function a7(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(let i in t)r+=" "+i+'="'+t[i]+'"';return'"+e+""}var qU=z(()=>{"use strict";o(a7,"iconToHTML")});var UU=z(()=>{"use strict";LU();FU();VU();WU();qU()});var s7,Ai,Dm=z(()=>{"use strict";s7=o((e,t,{depth:r=2,clobber:i=!1}={})=>{let n={depth:r,clobber:i};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(a=>s7(e,a,n)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(a=>{e.includes(a)||e.push(a)}),e):e===void 0||r<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(a=>{typeof t[a]=="object"&&t[a]!==null&&(e[a]===void 0||typeof e[a]=="object")?(e[a]===void 0&&(e[a]=Array.isArray(t[a])?[]:{}),e[a]=s7(e[a],t[a],{depth:r-1,clobber:i})):(i||typeof e[a]!="object"&&typeof t[a]!="object")&&(e[a]=t[a])}),e)},"assignWithDepth"),Ai=s7});var wC=Js((o7,l7)=>{"use strict";(function(e,t){typeof o7=="object"&&typeof l7<"u"?l7.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(o7,(function(){"use strict";var e=1e3,t=6e4,r=36e5,i="millisecond",n="second",a="minute",s="hour",l="day",u="week",h="month",d="quarter",f="year",p="date",m="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(D){var _=["th","st","nd","rd"],R=D%100;return"["+D+(_[(R-20)%10]||_[R]||_[0])+"]"},"ordinal")},x=o(function(D,_,R){var M=String(D);return!M||M.length>=_?D:""+Array(_+1-M.length).join(R)+D},"m"),b={s:x,z:o(function(D){var _=-D.utcOffset(),R=Math.abs(_),M=Math.floor(R/60),L=R%60;return(_<=0?"+":"-")+x(M,2,"0")+":"+x(L,2,"0")},"z"),m:o(function D(_,R){if(_.date()1)return D(O[0])}else{var $=_.name;w[$]=_,L=$}return!M&&L&&(T=L),L||!M&&T},"t"),A=o(function(D,_){if(k(D))return D.clone();var R=typeof _=="object"?_:{};return R.date=D,R.args=arguments,new P(R)},"O"),N=b;N.l=E,N.i=k,N.w=function(D,_){return A(D,{locale:_.$L,utc:_.$u,x:_.$x,$offset:_.$offset})};var P=(function(){function D(R){this.$L=E(R.locale,null,!0),this.parse(R),this.$x=this.$x||R.x||{},this[C]=!0}o(D,"M");var _=D.prototype;return _.parse=function(R){this.$d=(function(M){var L=M.date,B=M.utc;if(L===null)return new Date(NaN);if(N.u(L))return new Date;if(L instanceof Date)return new Date(L);if(typeof L=="string"&&!/Z$/i.test(L)){var O=L.match(g);if(O){var $=O[2]-1||0,G=(O[7]||"0").substring(0,3);return B?new Date(Date.UTC(O[1],$,O[3]||1,O[4]||0,O[5]||0,O[6]||0,G)):new Date(O[1],$,O[3]||1,O[4]||0,O[5]||0,O[6]||0,G)}}return new Date(L)})(R),this.init()},_.init=function(){var R=this.$d;this.$y=R.getFullYear(),this.$M=R.getMonth(),this.$D=R.getDate(),this.$W=R.getDay(),this.$H=R.getHours(),this.$m=R.getMinutes(),this.$s=R.getSeconds(),this.$ms=R.getMilliseconds()},_.$utils=function(){return N},_.isValid=function(){return this.$d.toString()!==m},_.isSame=function(R,M){var L=A(R);return this.startOf(M)<=L&&L<=this.endOf(M)},_.isAfter=function(R,M){return A(R){"use strict";HU=ys(wC(),1),du={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},Z={trace:o((...e)=>{},"trace"),debug:o((...e)=>{},"debug"),info:o((...e)=>{},"info"),warn:o((...e)=>{},"warn"),error:o((...e)=>{},"error"),fatal:o((...e)=>{},"fatal")},Zy=o(function(e="fatal"){let t=du.fatal;typeof e=="string"?e.toLowerCase()in du&&(t=du[e]):typeof e=="number"&&(t=e),Z.trace=()=>{},Z.debug=()=>{},Z.info=()=>{},Z.warn=()=>{},Z.error=()=>{},Z.fatal=()=>{},t<=du.fatal&&(Z.fatal=console.error?console.error.bind(console,So("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",So("FATAL"))),t<=du.error&&(Z.error=console.error?console.error.bind(console,So("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",So("ERROR"))),t<=du.warn&&(Z.warn=console.warn?console.warn.bind(console,So("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",So("WARN"))),t<=du.info&&(Z.info=console.info?console.info.bind(console,So("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",So("INFO"))),t<=du.debug&&(Z.debug=console.debug?console.debug.bind(console,So("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",So("DEBUG"))),t<=du.trace&&(Z.trace=console.debug?console.debug.bind(console,So("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",So("TRACE")))},"setLogLevel"),So=o(e=>`%c${(0,HU.default)().format("ss.SSS")} : ${e} : `,"format")});var SC,YU,jU=z(()=>{"use strict";SC={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:o(e=>e>=255?255:e<0?0:e,"r"),g:o(e=>e>=255?255:e<0?0:e,"g"),b:o(e=>e>=255?255:e<0?0:e,"b"),h:o(e=>e%360,"h"),s:o(e=>e>=100?100:e<0?0:e,"s"),l:o(e=>e>=100?100:e<0?0:e,"l"),a:o(e=>e>=1?1:e<0?0:e,"a")},toLinear:o(e=>{let t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},"toLinear"),hue2rgb:o((e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<.16666666666666666?e+(t-e)*6*r:r<.5?t:r<.6666666666666666?e+(t-e)*(.6666666666666666-r)*6:e),"hue2rgb"),hsl2rgb:o(({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;let n=r<.5?r*(1+t):r+t-r*t,a=2*r-n;switch(i){case"r":return SC.hue2rgb(a,n,e+.3333333333333333)*255;case"g":return SC.hue2rgb(a,n,e)*255;case"b":return SC.hue2rgb(a,n,e-.3333333333333333)*255}},"hsl2rgb"),rgb2hsl:o(({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;let n=Math.max(e,t,r),a=Math.min(e,t,r),s=(n+a)/2;if(i==="l")return s*100;if(n===a)return 0;let l=n-a,u=s>.5?l/(2-n-a):l/(n+a);if(i==="s")return u*100;switch(n){case e:return((t-r)/l+(t{"use strict";CNe={clamp:o((e,t,r)=>t>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),"clamp"),round:o(e=>Math.round(e*1e10)/1e10,"round")},XU=CNe});var kNe,ZU,QU=z(()=>{"use strict";kNe={dec2hex:o(e=>{let t=Math.round(e).toString(16);return t.length>1?t:`0${t}`},"dec2hex")},ZU=kNe});var wNe,ir,ec=z(()=>{"use strict";jU();KU();QU();wNe={channel:YU,lang:XU,unit:ZU},ir=wNe});var fu,On,Qy=z(()=>{"use strict";ec();fu={};for(let e=0;e<=255;e++)fu[e]=ir.unit.dec2hex(e);On={ALL:0,RGB:1,HSL:2}});var c7,JU,eH=z(()=>{"use strict";Qy();c7=class{static{o(this,"Type")}constructor(){this.type=On.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=On.ALL}is(t){return this.type===t}},JU=c7});var u7,tH,rH=z(()=>{"use strict";ec();eH();Qy();u7=class{static{o(this,"Channels")}constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new JU}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=On.ALL,this}_ensureHSL(){let t=this.data,{h:r,s:i,l:n}=t;r===void 0&&(t.h=ir.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=ir.channel.rgb2hsl(t,"s")),n===void 0&&(t.l=ir.channel.rgb2hsl(t,"l"))}_ensureRGB(){let t=this.data,{r,g:i,b:n}=t;r===void 0&&(t.r=ir.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=ir.channel.hsl2rgb(t,"g")),n===void 0&&(t.b=ir.channel.hsl2rgb(t,"b"))}get r(){let t=this.data,r=t.r;return!this.type.is(On.HSL)&&r!==void 0?r:(this._ensureHSL(),ir.channel.hsl2rgb(t,"r"))}get g(){let t=this.data,r=t.g;return!this.type.is(On.HSL)&&r!==void 0?r:(this._ensureHSL(),ir.channel.hsl2rgb(t,"g"))}get b(){let t=this.data,r=t.b;return!this.type.is(On.HSL)&&r!==void 0?r:(this._ensureHSL(),ir.channel.hsl2rgb(t,"b"))}get h(){let t=this.data,r=t.h;return!this.type.is(On.RGB)&&r!==void 0?r:(this._ensureRGB(),ir.channel.rgb2hsl(t,"h"))}get s(){let t=this.data,r=t.s;return!this.type.is(On.RGB)&&r!==void 0?r:(this._ensureRGB(),ir.channel.rgb2hsl(t,"s"))}get l(){let t=this.data,r=t.l;return!this.type.is(On.RGB)&&r!==void 0?r:(this._ensureRGB(),ir.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(On.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(On.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(On.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(On.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(On.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(On.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}},tH=u7});var SNe,Oh,Jy=z(()=>{"use strict";rH();SNe=new tH({r:0,g:0,b:0,a:0},"transparent"),Oh=SNe});var iH,Bf,h7=z(()=>{"use strict";Jy();Qy();iH={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:o(e=>{if(e.charCodeAt(0)!==35)return;let t=e.match(iH.re);if(!t)return;let r=t[1],i=parseInt(r,16),n=r.length,a=n%4===0,s=n>4,l=s?1:17,u=s?8:4,h=a?0:-1,d=s?255:15;return Oh.set({r:(i>>u*(h+3)&d)*l,g:(i>>u*(h+2)&d)*l,b:(i>>u*(h+1)&d)*l,a:a?(i&d)*l/255:1},e)},"parse"),stringify:o(e=>{let{r:t,g:r,b:i,a:n}=e;return n<1?`#${fu[Math.round(t)]}${fu[Math.round(r)]}${fu[Math.round(i)]}${fu[Math.round(n*255)]}`:`#${fu[Math.round(t)]}${fu[Math.round(r)]}${fu[Math.round(i)]}`},"stringify")},Bf=iH});var EC,ev,nH=z(()=>{"use strict";ec();Jy();EC={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:o(e=>{let t=e.match(EC.hueRe);if(t){let[,r,i]=t;switch(i){case"grad":return ir.channel.clamp.h(parseFloat(r)*.9);case"rad":return ir.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return ir.channel.clamp.h(parseFloat(r)*360)}}return ir.channel.clamp.h(parseFloat(e))},"_hue2deg"),parse:o(e=>{let t=e.charCodeAt(0);if(t!==104&&t!==72)return;let r=e.match(EC.re);if(!r)return;let[,i,n,a,s,l]=r;return Oh.set({h:EC._hue2deg(i),s:ir.channel.clamp.s(parseFloat(n)),l:ir.channel.clamp.l(parseFloat(a)),a:s?ir.channel.clamp.a(l?parseFloat(s)/100:parseFloat(s)):1},e)},"parse"),stringify:o(e=>{let{h:t,s:r,l:i,a:n}=e;return n<1?`hsla(${ir.lang.round(t)}, ${ir.lang.round(r)}%, ${ir.lang.round(i)}%, ${n})`:`hsl(${ir.lang.round(t)}, ${ir.lang.round(r)}%, ${ir.lang.round(i)}%)`},"stringify")},ev=EC});var AC,d7,aH=z(()=>{"use strict";h7();AC={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:o(e=>{e=e.toLowerCase();let t=AC.colors[e];if(t)return Bf.parse(t)},"parse"),stringify:o(e=>{let t=Bf.stringify(e);for(let r in AC.colors)if(AC.colors[r]===t)return r},"stringify")},d7=AC});var sH,tv,oH=z(()=>{"use strict";ec();Jy();sH={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:o(e=>{let t=e.charCodeAt(0);if(t!==114&&t!==82)return;let r=e.match(sH.re);if(!r)return;let[,i,n,a,s,l,u,h,d]=r;return Oh.set({r:ir.channel.clamp.r(n?parseFloat(i)*2.55:parseFloat(i)),g:ir.channel.clamp.g(s?parseFloat(a)*2.55:parseFloat(a)),b:ir.channel.clamp.b(u?parseFloat(l)*2.55:parseFloat(l)),a:h?ir.channel.clamp.a(d?parseFloat(h)/100:parseFloat(h)):1},e)},"parse"),stringify:o(e=>{let{r:t,g:r,b:i,a:n}=e;return n<1?`rgba(${ir.lang.round(t)}, ${ir.lang.round(r)}, ${ir.lang.round(i)}, ${ir.lang.round(n)})`:`rgb(${ir.lang.round(t)}, ${ir.lang.round(r)}, ${ir.lang.round(i)})`},"stringify")},tv=sH});var ENe,Pn,pu=z(()=>{"use strict";h7();nH();aH();oH();Qy();ENe={format:{keyword:d7,hex:Bf,rgb:tv,rgba:tv,hsl:ev,hsla:ev},parse:o(e=>{if(typeof e!="string")return e;let t=Bf.parse(e)||tv.parse(e)||ev.parse(e)||d7.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},"parse"),stringify:o(e=>!e.changed&&e.color?e.color:e.type.is(On.HSL)||e.data.r===void 0?ev.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?tv.stringify(e):Bf.stringify(e),"stringify")},Pn=ENe});var ANe,_C,f7=z(()=>{"use strict";ec();pu();ANe=o((e,t)=>{let r=Pn.parse(e);for(let i in t)r[i]=ir.channel.clamp[i](t[i]);return Pn.stringify(r)},"change"),_C=ANe});var _Ne,mn,p7=z(()=>{"use strict";ec();Jy();pu();f7();_Ne=o((e,t,r=0,i=1)=>{if(typeof e!="number")return _C(e,{a:t});let n=Oh.set({r:ir.channel.clamp.r(e),g:ir.channel.clamp.g(t),b:ir.channel.clamp.b(r),a:ir.channel.clamp.a(i)});return Pn.stringify(n)},"rgba"),mn=_Ne});var DNe,Ff,lH=z(()=>{"use strict";ec();pu();DNe=o((e,t)=>ir.lang.round(Pn.parse(e)[t]),"channel"),Ff=DNe});var RNe,cH,uH=z(()=>{"use strict";ec();pu();RNe=o(e=>{let{r:t,g:r,b:i}=Pn.parse(e),n=.2126*ir.channel.toLinear(t)+.7152*ir.channel.toLinear(r)+.0722*ir.channel.toLinear(i);return ir.lang.round(n)},"luminance"),cH=RNe});var LNe,hH,dH=z(()=>{"use strict";uH();LNe=o(e=>cH(e)>=.5,"isLight"),hH=LNe});var MNe,ri,fH=z(()=>{"use strict";dH();MNe=o(e=>!hH(e),"isDark"),ri=MNe});var NNe,Rm,DC=z(()=>{"use strict";ec();pu();NNe=o((e,t,r)=>{let i=Pn.parse(e),n=i[t],a=ir.channel.clamp[t](n+r);return n!==a&&(i[t]=a),Pn.stringify(i)},"adjustChannel"),Rm=NNe});var INe,je,pH=z(()=>{"use strict";DC();INe=o((e,t)=>Rm(e,"l",t),"lighten"),je=INe});var ONe,Xe,mH=z(()=>{"use strict";DC();ONe=o((e,t)=>Rm(e,"l",-t),"darken"),Xe=ONe});var PNe,RC,gH=z(()=>{"use strict";DC();PNe=o((e,t)=>Rm(e,"a",-t),"transparentize"),RC=PNe});var BNe,ne,yH=z(()=>{"use strict";pu();f7();BNe=o((e,t)=>{let r=Pn.parse(e),i={};for(let n in t)t[n]&&(i[n]=r[n]+t[n]);return _C(e,i)},"adjust"),ne=BNe});var FNe,vH,xH=z(()=>{"use strict";pu();p7();FNe=o((e,t,r=50)=>{let{r:i,g:n,b:a,a:s}=Pn.parse(e),{r:l,g:u,b:h,a:d}=Pn.parse(t),f=r/100,p=f*2-1,m=s-d,y=((p*m===-1?p:(p+m)/(1+p*m))+1)/2,v=1-y,x=i*y+l*v,b=n*y+u*v,T=a*y+h*v,w=s*f+d*(1-f);return mn(x,b,T,w)},"mix"),vH=FNe});var $Ne,Ge,bH=z(()=>{"use strict";pu();xH();$Ne=o((e,t=100)=>{let r=Pn.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,vH(r,e,t)},"invert"),Ge=$Ne});var TH=z(()=>{"use strict";p7();lH();fH();pH();mH();gH();yH();bH()});var Cn=z(()=>{"use strict";TH()});var kn,wn,dl=z(()=>{"use strict";kn="#ffffff",wn="#f2f2f2"});var Jt,Eo=z(()=>{"use strict";Cn();Jt=o((e,t)=>t?ne(e,{s:-40,l:10}):ne(e,{s:-40,l:-10}),"mkBorder")});var g7,CH,kH=z(()=>{"use strict";Cn();dl();Eo();g7=class{static{o(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||ne(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||ne(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Jt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Jt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Ge(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Ge(this.tertiaryColor),this.lineColor=this.lineColor||Ge(this.background),this.arrowheadColor=this.arrowheadColor||Ge(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Xe(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Xe(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Ge(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||je(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||Xe(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Xe(this.mainBkg,10)):(this.rowOdd=this.rowOdd||je(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||je(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||ne(this.primaryColor,{h:30}),this.cScale4=this.cScale4||ne(this.primaryColor,{h:60}),this.cScale5=this.cScale5||ne(this.primaryColor,{h:90}),this.cScale6=this.cScale6||ne(this.primaryColor,{h:120}),this.cScale7=this.cScale7||ne(this.primaryColor,{h:150}),this.cScale8=this.cScale8||ne(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||ne(this.primaryColor,{h:270}),this.cScale10=this.cScale10||ne(this.primaryColor,{h:300}),this.cScale11=this.cScale11||ne(this.primaryColor,{h:330}),this.darkMode)for(let r=0;r{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},CH=o(e=>{let t=new g7;return t.calculate(e),t},"getThemeVariables")});var y7,wH,SH=z(()=>{"use strict";Cn();Eo();y7=class{static{o(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=je(this.primaryColor,16),this.tertiaryColor=ne(this.primaryColor,{h:-160}),this.primaryBorderColor=Ge(this.background),this.secondaryBorderColor=Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=Ge(this.primaryColor),this.secondaryTextColor=Ge(this.secondaryColor),this.tertiaryTextColor=Ge(this.tertiaryColor),this.lineColor=Ge(this.background),this.textColor=Ge(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=je(Ge("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=mn(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=Xe("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=Xe(this.sectionBkgColor,10),this.taskBorderColor=mn(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=mn(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||je(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||Xe(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){this.secondBkg=je(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=je(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.altSectionBkgColor=this.background,this.taskBkgColor=je(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=Ge(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=ne(this.primaryColor,{h:64}),this.fillType3=ne(this.secondaryColor,{h:64}),this.fillType4=ne(this.primaryColor,{h:-64}),this.fillType5=ne(this.secondaryColor,{h:-64}),this.fillType6=ne(this.primaryColor,{h:128}),this.fillType7=ne(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||ne(this.primaryColor,{h:30}),this.cScale4=this.cScale4||ne(this.primaryColor,{h:60}),this.cScale5=this.cScale5||ne(this.primaryColor,{h:90}),this.cScale6=this.cScale6||ne(this.primaryColor,{h:120}),this.cScale7=this.cScale7||ne(this.primaryColor,{h:150}),this.cScale8=this.cScale8||ne(this.primaryColor,{h:210}),this.cScale9=this.cScale9||ne(this.primaryColor,{h:270}),this.cScale10=this.cScale10||ne(this.primaryColor,{h:300}),this.cScale11=this.cScale11||ne(this.primaryColor,{h:330});for(let t=0;t{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},wH=o(e=>{let t=new y7;return t.calculate(e),t},"getThemeVariables")});var v7,Ao,$f=z(()=>{"use strict";Cn();Eo();dl();v7=class{static{o(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=ne(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=ne(this.primaryColor,{h:-160}),this.primaryBorderColor=Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=Ge(this.primaryColor),this.secondaryTextColor=Ge(this.secondaryColor),this.tertiaryTextColor=Ge(this.tertiaryColor),this.lineColor=Ge(this.background),this.textColor=Ge(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=Jt(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=mn(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||ne(this.primaryColor,{h:30}),this.cScale4=this.cScale4||ne(this.primaryColor,{h:60}),this.cScale5=this.cScale5||ne(this.primaryColor,{h:90}),this.cScale6=this.cScale6||ne(this.primaryColor,{h:120}),this.cScale7=this.cScale7||ne(this.primaryColor,{h:150}),this.cScale8=this.cScale8||ne(this.primaryColor,{h:210}),this.cScale9=this.cScale9||ne(this.primaryColor,{h:270}),this.cScale10=this.cScale10||ne(this.primaryColor,{h:300}),this.cScale11=this.cScale11||ne(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Xe(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Xe(this.tertiaryColor,40);for(let t=0;t{this[i]==="calculated"&&(this[i]=void 0)}),typeof t!="object"){this.updateColors();return}let r=Object.keys(t);r.forEach(i=>{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},Ao=o(e=>{let t=new v7;return t.calculate(e),t},"getThemeVariables")});var x7,EH,AH=z(()=>{"use strict";Cn();dl();Eo();x7=class{static{o(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=je("#cde498",10),this.primaryBorderColor=Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=Ge(this.primaryColor),this.secondaryTextColor=Ge(this.secondaryColor),this.tertiaryTextColor=Ge(this.primaryColor),this.lineColor=Ge(this.background),this.textColor=Ge(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){this.actorBorder=Xe(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||ne(this.primaryColor,{h:30}),this.cScale4=this.cScale4||ne(this.primaryColor,{h:60}),this.cScale5=this.cScale5||ne(this.primaryColor,{h:90}),this.cScale6=this.cScale6||ne(this.primaryColor,{h:120}),this.cScale7=this.cScale7||ne(this.primaryColor,{h:150}),this.cScale8=this.cScale8||ne(this.primaryColor,{h:210}),this.cScale9=this.cScale9||ne(this.primaryColor,{h:270}),this.cScale10=this.cScale10||ne(this.primaryColor,{h:300}),this.cScale11=this.cScale11||ne(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||Xe(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||Xe(this.tertiaryColor,40);for(let t=0;t{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},EH=o(e=>{let t=new x7;return t.calculate(e),t},"getThemeVariables")});var b7,_H,DH=z(()=>{"use strict";Cn();Eo();dl();b7=class{static{o(this,"Theme")}constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=je(this.contrast,55),this.background="#ffffff",this.tertiaryColor=ne(this.primaryColor,{h:-160}),this.primaryBorderColor=Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=Ge(this.primaryColor),this.secondaryTextColor=Ge(this.secondaryColor),this.tertiaryTextColor=Ge(this.tertiaryColor),this.lineColor=Ge(this.background),this.textColor=Ge(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||je(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){this.secondBkg=je(this.contrast,55),this.border2=this.contrast,this.actorBorder=je(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let t=0;t{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},_H=o(e=>{let t=new b7;return t.calculate(e),t},"getThemeVariables")});var T7,RH,LH=z(()=>{"use strict";Cn();Eo();dl();T7=class{static{o(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=Jt(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||ne(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||ne(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Jt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Jt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Ge(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Ge(this.tertiaryColor),this.lineColor=this.lineColor||Ge(this.background),this.arrowheadColor=this.arrowheadColor||Ge(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Xe(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Xe(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Ge(this.lineColor);let t="#ECECFE",r="#E9E9F1",i=ne(t,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||je(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||t,this.cScale1=this.cScale1||r,this.cScale2=this.cScale2||i,this.cScale3=this.cScale3||ne(t,{h:30}),this.cScale4=this.cScale4||ne(t,{h:60}),this.cScale5=this.cScale5||ne(t,{h:90}),this.cScale6=this.cScale6||ne(t,{h:120}),this.cScale7=this.cScale7||ne(t,{h:150}),this.cScale8=this.cScale8||ne(t,{h:210,l:150}),this.cScale9=this.cScale9||ne(t,{h:270}),this.cScale10=this.cScale10||ne(t,{h:300}),this.cScale11=this.cScale11||ne(t,{h:330}),this.darkMode)for(let a=0;a{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},RH=o(e=>{let t=new T7;return t.calculate(e),t},"getThemeVariables")});var C7,MH,NH=z(()=>{"use strict";Cn();Eo();dl();C7=class{static{o(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=je(this.primaryColor,16),this.tertiaryColor=ne(this.primaryColor,{h:-160}),this.primaryBorderColor=Ge(this.background),this.secondaryBorderColor=Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=Ge(this.primaryColor),this.secondaryTextColor=Ge(this.secondaryColor),this.tertiaryTextColor=Ge(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=je(Ge("#323D47"),10),this.border1="#ccc",this.border2=mn(255,255,255,.25),this.arrowheadColor=Ge(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||ne(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||ne(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Jt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Jt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||Ge(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Ge(this.tertiaryColor),this.lineColor=this.lineColor||Ge(this.background),this.arrowheadColor=this.arrowheadColor||Ge(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Xe(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Xe(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Ge(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||je(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||ne(this.primaryColor,{h:30}),this.cScale4=this.cScale4||ne(this.primaryColor,{h:60}),this.cScale5=this.cScale5||ne(this.primaryColor,{h:90}),this.cScale6=this.cScale6||ne(this.primaryColor,{h:120}),this.cScale7=this.cScale7||ne(this.primaryColor,{h:150}),this.cScale8=this.cScale8||ne(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||ne(this.primaryColor,{h:270}),this.cScale10=this.cScale10||ne(this.primaryColor,{h:300}),this.cScale11=this.cScale11||ne(this.primaryColor,{h:330}),this.darkMode)for(let r=0;r{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},MH=o(e=>{let t=new C7;return t.calculate(e),t},"getThemeVariables")});var k7,IH,OH=z(()=>{"use strict";Cn();Eo();dl();k7=class{static{o(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Jt("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||ne(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||ne(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Jt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Jt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||Ge(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Ge(this.tertiaryColor),this.lineColor=this.lineColor||Ge(this.background),this.arrowheadColor=this.arrowheadColor||Ge(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Xe(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Xe(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Ge(this.lineColor);let t="#ECECFE",r="#E9E9F1",i=ne(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||je(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let a=0;a{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},IH=o(e=>{let t=new k7;return t.calculate(e),t},"getThemeVariables")});var w7,PH,BH=z(()=>{"use strict";Cn();Eo();dl();w7=class{static{o(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=je(this.primaryColor,16),this.tertiaryColor=ne(this.primaryColor,{h:-160}),this.primaryBorderColor=Ge(this.background),this.secondaryBorderColor=Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=Ge(this.primaryColor),this.secondaryTextColor=Ge(this.secondaryColor),this.tertiaryTextColor=Ge(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=je(Ge("#323D47"),10),this.border1="#ccc",this.border2=mn(255,255,255,.25),this.arrowheadColor=Ge(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||ne(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||ne(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Jt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Jt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||Ge(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Ge(this.tertiaryColor),this.lineColor=this.lineColor||Ge(this.background),this.arrowheadColor=this.arrowheadColor||Ge(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Xe(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Xe(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Ge(this.lineColor),this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||je(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||ne(this.primaryColor,{h:30}),this.cScale4=this.cScale4||ne(this.primaryColor,{h:60}),this.cScale5=this.cScale5||ne(this.primaryColor,{h:90}),this.cScale6=this.cScale6||ne(this.primaryColor,{h:120}),this.cScale7=this.cScale7||ne(this.primaryColor,{h:150}),this.cScale8=this.cScale8||ne(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||ne(this.primaryColor,{h:270}),this.cScale10=this.cScale10||ne(this.primaryColor,{h:300}),this.cScale11=this.cScale11||ne(this.primaryColor,{h:330}),this.darkMode)for(let r=0;r{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},PH=o(e=>{let t=new w7;return t.calculate(e),t},"getThemeVariables")});var S7,FH,$H=z(()=>{"use strict";Cn();Eo();dl();S7=class{static{o(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=Jt(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||ne(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||ne(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Jt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Jt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||Ge(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Ge(this.tertiaryColor),this.lineColor=this.lineColor||Ge(this.background),this.arrowheadColor=this.arrowheadColor||Ge(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Xe(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Xe(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Ge(this.lineColor);let t="#ECECFE",r="#E9E9F1",i=ne(t,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||i,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||r,this.sectionBkgColor2=this.sectionBkgColor2||t,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||t,this.activeTaskBorderColor=this.activeTaskBorderColor||t,this.activeTaskBkgColor=this.activeTaskBkgColor||je(t,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let a=0;a{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},FH=o(e=>{let t=new S7;return t.calculate(e),t},"getThemeVariables")});var E7,zH,GH=z(()=>{"use strict";Cn();Eo();dl();E7=class{static{o(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=je(this.primaryColor,16),this.tertiaryColor=ne(this.primaryColor,{h:-160}),this.primaryBorderColor=Ge(this.background),this.secondaryBorderColor=Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=Jt(this.tertiaryColor,this.darkMode),this.primaryTextColor=Ge(this.primaryColor),this.secondaryTextColor=Ge(this.secondaryColor),this.tertiaryTextColor=Ge(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=je(Ge("#323D47"),10),this.border1="#ccc",this.border2=mn(255,255,255,.25),this.arrowheadColor=Ge(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||ne(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||ne(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||Jt(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||Jt(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||Jt(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||Jt(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||Ge(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||Ge(this.tertiaryColor),this.lineColor=this.lineColor||Ge(this.background),this.arrowheadColor=this.arrowheadColor||Ge(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?Xe(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||Xe(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||Ge(this.lineColor),this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||je(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let r=0;r{this[i]=t[i]}),this.updateColors(),r.forEach(i=>{this[i]=t[i]})}},zH=o(e=>{let t=new E7;return t.calculate(e),t},"getThemeVariables")});var _o,LC=z(()=>{"use strict";kH();SH();$f();AH();DH();LH();NH();OH();BH();$H();GH();_o={base:{getThemeVariables:CH},dark:{getThemeVariables:wH},default:{getThemeVariables:Ao},forest:{getThemeVariables:EH},neutral:{getThemeVariables:_H},neo:{getThemeVariables:RH},"neo-dark":{getThemeVariables:MH},redux:{getThemeVariables:IH},"redux-dark":{getThemeVariables:PH},"redux-color":{getThemeVariables:FH},"redux-dark-color":{getThemeVariables:zH}}});var Ea,VH=z(()=>{"use strict";Ea={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1}});var WH,qH,UH,or,Bn=z(()=>{"use strict";LC();VH();WH={...Ea,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:_o.default.getThemeVariables(),sequence:{...Ea.sequence,messageFont:o(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:o(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:o(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Ea.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Ea.c4,useWidth:void 0,personFont:o(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Ea.flowchart,inheritDir:!1},external_personFont:o(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:o(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:o(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:o(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:o(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:o(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:o(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:o(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:o(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:o(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:o(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:o(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:o(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:o(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:o(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:o(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:o(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:o(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:o(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:o(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:o(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Ea.pie,useWidth:984},xyChart:{...Ea.xyChart,useWidth:void 0},requirement:{...Ea.requirement,useWidth:void 0},packet:{...Ea.packet},eventmodeling:{...Ea.eventmodeling},treeView:{...Ea.treeView,useWidth:void 0},radar:{...Ea.radar},ishikawa:{...Ea.ishikawa},sankey:{...Ea.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Ea.venn}},qH=o((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...qH(e[i],"")]:[...r,t+i],[]),"keyify"),UH=new Set(qH(WH,"")),or=WH});var Lm,A7,MC=z(()=>{"use strict";Bn();St();Lm=o(e=>{if(Z.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>Lm(t));return}for(let t of Object.keys(e)){if(Z.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!UH.has(t)||e[t]==null){Z.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){if(t==="nodeColors"){let i=/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i;for(let n of Object.keys(e[t]))(typeof e[t][n]!="string"||!i.test(e[t][n]))&&(Z.debug("sanitize deleting invalid color:",n,e[t][n]),delete e[t][n])}else Z.debug("sanitizing object",t),Lm(e[t]);continue}let r=["themeCSS","fontFamily","altFontFamily"];for(let i of r)t.includes(i)&&(Z.debug("sanitizing css option",t),e[t]=A7(e[t]))}if(e.themeVariables)for(let t of Object.keys(e.themeVariables)){let r=e.themeVariables[t];r?.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}Z.debug("After sanitization",e)}},"sanitizeDirective"),A7=o(e=>{let t=0,r=0;for(let i of e){if(t{"use strict";Dm();St();LC();Bn();MC();Ph=Object.freeze(or),Aa=o(e=>!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),vs=Ai({},Ph),zf=[],rv=Ai({},Ph),IC=o((e,t)=>{let r=Ai({},e),i={};for(let n of t)XH(n),i=Ai(i,n);if(r=Ai(r,i),i.theme&&i.theme in _o){let n=Ai({},NC),a=Ai(n.themeVariables||{},i.themeVariables);r.theme&&r.theme in _o&&(r.themeVariables=_o[r.theme].getThemeVariables(a))}return rv=r,QH(rv),rv},"updateCurrentConfig"),_7=o(e=>(vs=Ai({},Ph),vs=Ai(vs,e),e.theme&&_o[e.theme]&&(vs.themeVariables=_o[e.theme].getThemeVariables(e.themeVariables)),IC(vs,zf),vs),"setSiteConfig"),YH=o(e=>{NC=Ai({},e)},"saveConfigFromInitialize"),jH=o(e=>(vs=Ai(vs,e),IC(vs,zf),vs),"updateSiteConfig"),D7=o(()=>Ai({},vs),"getSiteConfig"),OC=o(e=>(QH(e),Ai(rv,e),Nt()),"setConfig"),Nt=o(()=>Ai({},rv),"getConfig"),XH=o(e=>{e&&(["secure",...vs.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(Z.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&XH(e[t])}))},"sanitize"),KH=o(e=>{Lm(e),e.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),zf.push(e),IC(vs,zf)},"addDirective"),iv=o((e=vs)=>{zf=[],IC(e,zf)},"reset"),zNe={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},HH={},ZH=o(e=>{HH[e]||(Z.warn(zNe[e]),HH[e]=!0)},"issueWarning"),QH=o(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&ZH("LAZY_LOAD_DEPRECATED")},"checkConfig"),JH=o(()=>{let e={};NC&&(e=Ai(e,NC));for(let t of zf)e=Ai(e,t);return e},"getUserDefinedConfig"),Mr=o(e=>(e.flowchart?.htmlLabels!=null&&ZH("FLOWCHART_HTML_LABELS_DEPRECATED"),Aa(e.htmlLabels??e.flowchart?.htmlLabels??!0)),"getEffectiveHtmlLabels")});function Ua(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n2&&arguments[2]!==void 0?arguments[2]:BC;eY&&eY(e,null);let i=t.length;for(;i--;){let n=t[i];if(typeof n=="string"){let a=r(n);a!==n&&(GNe(t)||(t[i]=a),n=a)}e[n]=!0}return e}function XNe(e){for(let t=0;t0&&arguments[0]!==void 0?arguments[0]:sIe(),t=o(pt=>hY(pt),"DOMPurify");if(t.version="3.4.0",t.removed=[],!e||!e.document||e.document.nodeType!==lv.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e,i=r,n=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:u,NodeFilter:h,NamedNodeMap:d=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:m}=e,g=u.prototype,y=ov(g,"cloneNode"),v=ov(g,"remove"),x=ov(g,"nextSibling"),b=ov(g,"childNodes"),T=ov(g,"parentNode");if(typeof s=="function"){let pt=r.createElement("template");pt.content&&pt.content.ownerDocument&&(r=pt.content.ownerDocument)}let w,C="",{implementation:k,createNodeIterator:E,createDocumentFragment:A,getElementsByTagName:N}=r,{importNode:P}=i,I=oY();t.isSupported=typeof lY=="function"&&typeof T=="function"&&k&&k.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:D,ERB_EXPR:_,TMPLIT_EXPR:R,DATA_ATTR:M,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:O,CUSTOM_ELEMENT:$}=sY,{IS_ALLOWED_URI:G}=sY,F=null,V=$r({},[...rY,...M7,...N7,...I7,...iY]),H=null,j=$r({},[...nY,...O7,...aY,...PC]),U=Object.seal(cv(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Q=null,Y=null,ae=Object.seal(cv(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),J=!0,te=!0,re=!1,ee=!0,Te=!1,ue=!0,De=!1,Ie=!1,Ee=!1,we=!1,Me=!1,$e=!1,de=!0,rt=!1,ke="user-content-",Fe=!0,He=!1,at={},qe=null,Ue=$r({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ye=null,ve=$r({},["audio","video","img","source","image","track"]),ie=null,fe=$r({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),W="http://www.w3.org/1998/Math/MathML",ce="http://www.w3.org/2000/svg",K="http://www.w3.org/1999/xhtml",Re=K,xe=!1,Oe=null,be=$r({},[W,ce,K],R7),Be=$r({},["mi","mo","mn","ms","mtext"]),Ae=$r({},["annotation-xml"]),Ve=$r({},["title","style","font","a","script"]),Pe=null,Ye=["application/xhtml+xml","text/html"],le="text/html",st=null,me=null,ot=r.createElement("form"),kt=o(function(Se){return Se instanceof RegExp||Se instanceof Function},"isRegexOrFunction"),Gt=o(function(){let Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(me&&me===Se)){if((!Se||typeof Se!="object")&&(Se={}),Se=tc(Se),Pe=Ye.indexOf(Se.PARSER_MEDIA_TYPE)===-1?le:Se.PARSER_MEDIA_TYPE,st=Pe==="application/xhtml+xml"?R7:BC,F=fl(Se,"ALLOWED_TAGS")?$r({},Se.ALLOWED_TAGS,st):V,H=fl(Se,"ALLOWED_ATTR")?$r({},Se.ALLOWED_ATTR,st):j,Oe=fl(Se,"ALLOWED_NAMESPACES")?$r({},Se.ALLOWED_NAMESPACES,R7):be,ie=fl(Se,"ADD_URI_SAFE_ATTR")?$r(tc(fe),Se.ADD_URI_SAFE_ATTR,st):fe,ye=fl(Se,"ADD_DATA_URI_TAGS")?$r(tc(ve),Se.ADD_DATA_URI_TAGS,st):ve,qe=fl(Se,"FORBID_CONTENTS")?$r({},Se.FORBID_CONTENTS,st):Ue,Q=fl(Se,"FORBID_TAGS")?$r({},Se.FORBID_TAGS,st):tc({}),Y=fl(Se,"FORBID_ATTR")?$r({},Se.FORBID_ATTR,st):tc({}),at=fl(Se,"USE_PROFILES")?Se.USE_PROFILES:!1,J=Se.ALLOW_ARIA_ATTR!==!1,te=Se.ALLOW_DATA_ATTR!==!1,re=Se.ALLOW_UNKNOWN_PROTOCOLS||!1,ee=Se.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Te=Se.SAFE_FOR_TEMPLATES||!1,ue=Se.SAFE_FOR_XML!==!1,De=Se.WHOLE_DOCUMENT||!1,we=Se.RETURN_DOM||!1,Me=Se.RETURN_DOM_FRAGMENT||!1,$e=Se.RETURN_TRUSTED_TYPE||!1,Ee=Se.FORCE_BODY||!1,de=Se.SANITIZE_DOM!==!1,rt=Se.SANITIZE_NAMED_PROPS||!1,Fe=Se.KEEP_CONTENT!==!1,He=Se.IN_PLACE||!1,G=Se.ALLOWED_URI_REGEXP||cY,Re=Se.NAMESPACE||K,Be=Se.MATHML_TEXT_INTEGRATION_POINTS||Be,Ae=Se.HTML_INTEGRATION_POINTS||Ae,U=Se.CUSTOM_ELEMENT_HANDLING||cv(null),Se.CUSTOM_ELEMENT_HANDLING&&kt(Se.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(U.tagNameCheck=Se.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Se.CUSTOM_ELEMENT_HANDLING&&kt(Se.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(U.attributeNameCheck=Se.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Se.CUSTOM_ELEMENT_HANDLING&&typeof Se.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(U.allowCustomizedBuiltInElements=Se.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Te&&(te=!1),Me&&(we=!0),at&&(F=$r({},iY),H=cv(null),at.html===!0&&($r(F,rY),$r(H,nY)),at.svg===!0&&($r(F,M7),$r(H,O7),$r(H,PC)),at.svgFilters===!0&&($r(F,N7),$r(H,O7),$r(H,PC)),at.mathMl===!0&&($r(F,I7),$r(H,aY),$r(H,PC))),ae.tagCheck=null,ae.attributeCheck=null,Se.ADD_TAGS&&(typeof Se.ADD_TAGS=="function"?ae.tagCheck=Se.ADD_TAGS:(F===V&&(F=tc(F)),$r(F,Se.ADD_TAGS,st))),Se.ADD_ATTR&&(typeof Se.ADD_ATTR=="function"?ae.attributeCheck=Se.ADD_ATTR:(H===j&&(H=tc(H)),$r(H,Se.ADD_ATTR,st))),Se.ADD_URI_SAFE_ATTR&&$r(ie,Se.ADD_URI_SAFE_ATTR,st),Se.FORBID_CONTENTS&&(qe===Ue&&(qe=tc(qe)),$r(qe,Se.FORBID_CONTENTS,st)),Se.ADD_FORBID_CONTENTS&&(qe===Ue&&(qe=tc(qe)),$r(qe,Se.ADD_FORBID_CONTENTS,st)),Fe&&(F["#text"]=!0),De&&$r(F,["html","head","body"]),F.table&&($r(F,["tbody"]),delete Q.tbody),Se.TRUSTED_TYPES_POLICY){if(typeof Se.TRUSTED_TYPES_POLICY.createHTML!="function")throw sv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Se.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw sv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=Se.TRUSTED_TYPES_POLICY,C=w.createHTML("")}else w===void 0&&(w=oIe(m,n)),w!==null&&typeof C=="string"&&(C=w.createHTML(""));qa&&qa(Se),me=Se}},"_parseConfig"),Tt=$r({},[...M7,...N7,...KNe]),Et=$r({},[...I7,...ZNe]),yt=o(function(Se){let it=T(Se);(!it||!it.tagName)&&(it={namespaceURI:Re,tagName:"template"});let xt=BC(Se.tagName),rr=BC(it.tagName);return Oe[Se.namespaceURI]?Se.namespaceURI===ce?it.namespaceURI===K?xt==="svg":it.namespaceURI===W?xt==="svg"&&(rr==="annotation-xml"||Be[rr]):!!Tt[xt]:Se.namespaceURI===W?it.namespaceURI===K?xt==="math":it.namespaceURI===ce?xt==="math"&&Ae[rr]:!!Et[xt]:Se.namespaceURI===K?it.namespaceURI===ce&&!Ae[rr]||it.namespaceURI===W&&!Be[rr]?!1:!Et[xt]&&(Ve[xt]||!Tt[xt]):!!(Pe==="application/xhtml+xml"&&Oe[Se.namespaceURI]):!1},"_checkValidNamespace"),oe=o(function(Se){av(t.removed,{element:Se});try{T(Se).removeChild(Se)}catch{v(Se)}},"_forceRemove"),ht=o(function(Se,it){try{av(t.removed,{attribute:it.getAttributeNode(Se),from:it})}catch{av(t.removed,{attribute:null,from:it})}if(it.removeAttribute(Se),Se==="is")if(we||Me)try{oe(it)}catch{}else try{it.setAttribute(Se,"")}catch{}},"_removeAttribute"),gt=o(function(Se){let it=null,xt=null;if(Ee)Se=""+Se;else{let Ur=L7(Se,/^[\r\n\t ]+/);xt=Ur&&Ur[0]}Pe==="application/xhtml+xml"&&Re===K&&(Se=''+Se+"");let rr=w?w.createHTML(Se):Se;if(Re===K)try{it=new p().parseFromString(rr,Pe)}catch{}if(!it||!it.documentElement){it=k.createDocument(Re,"template",null);try{it.documentElement.innerHTML=xe?C:rr}catch{}}let _r=it.body||it.documentElement;return Se&&xt&&_r.insertBefore(r.createTextNode(xt),_r.childNodes[0]||null),Re===K?N.call(it,De?"html":"body")[0]:De?it.documentElement:_r},"_initDocument"),et=o(function(Se){return E.call(Se.ownerDocument||Se,Se,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},"_createNodeIterator"),pe=o(function(Se){return Se instanceof f&&(typeof Se.nodeName!="string"||typeof Se.textContent!="string"||typeof Se.removeChild!="function"||!(Se.attributes instanceof d)||typeof Se.removeAttribute!="function"||typeof Se.setAttribute!="function"||typeof Se.namespaceURI!="string"||typeof Se.insertBefore!="function"||typeof Se.hasChildNodes!="function")},"_isClobbered"),Qe=o(function(Se){return typeof l=="function"&&Se instanceof l},"_isNode");function nt(pt,Se,it){nv(pt,xt=>{xt.call(t,Se,it,me)})}o(nt,"_executeHooks");let dt=o(function(Se){let it=null;if(nt(I.beforeSanitizeElements,Se,null),pe(Se))return oe(Se),!0;let xt=st(Se.nodeName);if(nt(I.uponSanitizeElement,Se,{tagName:xt,allowedTags:F}),ue&&Se.hasChildNodes()&&!Qe(Se.firstElementChild)&&Wa(/<[/\w!]/g,Se.innerHTML)&&Wa(/<[/\w!]/g,Se.textContent)||ue&&Se.namespaceURI===K&&xt==="style"&&Qe(Se.firstElementChild)||Se.nodeType===lv.progressingInstruction||ue&&Se.nodeType===lv.comment&&Wa(/<[/\w]/g,Se.data))return oe(Se),!0;if(Q[xt]||!(ae.tagCheck instanceof Function&&ae.tagCheck(xt))&&!F[xt]){if(!Q[xt]&&Rt(xt)&&(U.tagNameCheck instanceof RegExp&&Wa(U.tagNameCheck,xt)||U.tagNameCheck instanceof Function&&U.tagNameCheck(xt)))return!1;if(Fe&&!qe[xt]){let rr=T(Se)||Se.parentNode,_r=b(Se)||Se.childNodes;if(_r&&rr){let Ur=_r.length;for(let Dr=Ur-1;Dr>=0;--Dr){let Xi=y(_r[Dr],!0);Xi.__removalCount=(Se.__removalCount||0)+1,rr.insertBefore(Xi,x(Se))}}}return oe(Se),!0}return Se instanceof u&&!yt(Se)||(xt==="noscript"||xt==="noembed"||xt==="noframes")&&Wa(/<\/no(script|embed|frames)/i,Se.innerHTML)?(oe(Se),!0):(Te&&Se.nodeType===lv.text&&(it=Se.textContent,nv([D,_,R],rr=>{it=Mm(it,rr," ")}),Se.textContent!==it&&(av(t.removed,{element:Se.cloneNode()}),Se.textContent=it)),nt(I.afterSanitizeElements,Se,null),!1)},"_sanitizeElements"),Ft=o(function(Se,it,xt){if(Y[it]||de&&(it==="id"||it==="name")&&(xt in r||xt in ot))return!1;if(!(te&&!Y[it]&&Wa(M,it))){if(!(J&&Wa(L,it))){if(!(ae.attributeCheck instanceof Function&&ae.attributeCheck(it,Se))){if(!H[it]||Y[it]){if(!(Rt(Se)&&(U.tagNameCheck instanceof RegExp&&Wa(U.tagNameCheck,Se)||U.tagNameCheck instanceof Function&&U.tagNameCheck(Se))&&(U.attributeNameCheck instanceof RegExp&&Wa(U.attributeNameCheck,it)||U.attributeNameCheck instanceof Function&&U.attributeNameCheck(it,Se))||it==="is"&&U.allowCustomizedBuiltInElements&&(U.tagNameCheck instanceof RegExp&&Wa(U.tagNameCheck,xt)||U.tagNameCheck instanceof Function&&U.tagNameCheck(xt))))return!1}else if(!ie[it]){if(!Wa(G,Mm(xt,O,""))){if(!((it==="src"||it==="xlink:href"||it==="href")&&Se!=="script"&&HNe(xt,"data:")===0&&ye[Se])){if(!(re&&!Wa(B,Mm(xt,O,"")))){if(xt)return!1}}}}}}}return!0},"_isValidAttribute"),Rt=o(function(Se){return Se!=="annotation-xml"&&L7(Se,$)},"_isBasicCustomElement"),$t=o(function(Se){nt(I.beforeSanitizeAttributes,Se,null);let{attributes:it}=Se;if(!it||pe(Se))return;let xt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0},rr=it.length;for(;rr--;){let _r=it[rr],{name:Ur,namespaceURI:Dr,value:Xi}=_r,In=st(Ur),pi=Xi,zt=Ur==="value"?pi:YNe(pi);if(xt.attrName=In,xt.attrValue=zt,xt.keepAttr=!0,xt.forceKeepAttr=void 0,nt(I.uponSanitizeAttribute,Se,xt),zt=xt.attrValue,rt&&(In==="id"||In==="name")&&(ht(Ur,Se),zt=ke+zt),ue&&Wa(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,zt)){ht(Ur,Se);continue}if(In==="attributename"&&L7(zt,"href")){ht(Ur,Se);continue}if(xt.forceKeepAttr)continue;if(!xt.keepAttr){ht(Ur,Se);continue}if(!ee&&Wa(/\/>/i,zt)){ht(Ur,Se);continue}Te&&nv([D,_,R],qt=>{zt=Mm(zt,qt," ")});let Mt=st(Se.nodeName);if(!Ft(Mt,In,zt)){ht(Ur,Se);continue}if(w&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Dr)switch(m.getAttributeType(Mt,In)){case"TrustedHTML":{zt=w.createHTML(zt);break}case"TrustedScriptURL":{zt=w.createScriptURL(zt);break}}if(zt!==pi)try{Dr?Se.setAttributeNS(Dr,Ur,zt):Se.setAttribute(Ur,zt),pe(Se)?oe(Se):tY(t.removed)}catch{ht(Ur,Se)}}nt(I.afterSanitizeAttributes,Se,null)},"_sanitizeAttributes"),lr=o(function(Se){let it=null,xt=et(Se);for(nt(I.beforeSanitizeShadowDOM,Se,null);it=xt.nextNode();)nt(I.uponSanitizeShadowNode,it,null),dt(it),$t(it),it.content instanceof a&&lr(it.content);nt(I.afterSanitizeShadowDOM,Se,null)},"_sanitizeShadowDOM");return t.sanitize=function(pt){let Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},it=null,xt=null,rr=null,_r=null;if(xe=!pt,xe&&(pt=""),typeof pt!="string"&&!Qe(pt))if(typeof pt.toString=="function"){if(pt=pt.toString(),typeof pt!="string")throw sv("dirty is not a string, aborting")}else throw sv("toString is not a function");if(!t.isSupported)return pt;if(Ie||Gt(Se),t.removed=[],typeof pt=="string"&&(He=!1),He){if(pt.nodeName){let Xi=st(pt.nodeName);if(!F[Xi]||Q[Xi])throw sv("root node is forbidden and cannot be sanitized in-place")}}else if(pt instanceof l)it=gt(""),xt=it.ownerDocument.importNode(pt,!0),xt.nodeType===lv.element&&xt.nodeName==="BODY"||xt.nodeName==="HTML"?it=xt:it.appendChild(xt);else{if(!we&&!Te&&!De&&pt.indexOf("<")===-1)return w&&$e?w.createHTML(pt):pt;if(it=gt(pt),!it)return we?null:$e?C:""}it&&Ee&&oe(it.firstChild);let Ur=et(He?pt:it);for(;rr=Ur.nextNode();)dt(rr),$t(rr),rr.content instanceof a&&lr(rr.content);if(He)return pt;if(we){if(Te){it.normalize();let Xi=it.innerHTML;nv([D,_,R],In=>{Xi=Mm(Xi,In," ")}),it.innerHTML=Xi}if(Me)for(_r=A.call(it.ownerDocument);it.firstChild;)_r.appendChild(it.firstChild);else _r=it;return(H.shadowroot||H.shadowrootmode)&&(_r=P.call(i,_r,!0)),_r}let Dr=De?it.outerHTML:it.innerHTML;return De&&F["!doctype"]&&it.ownerDocument&&it.ownerDocument.doctype&&it.ownerDocument.doctype.name&&Wa(uY,it.ownerDocument.doctype.name)&&(Dr=" +`+Dr),Te&&nv([D,_,R],Xi=>{Dr=Mm(Dr,Xi," ")}),w&&$e?w.createHTML(Dr):Dr},t.setConfig=function(){let pt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gt(pt),Ie=!0},t.clearConfig=function(){me=null,Ie=!1},t.isValidAttribute=function(pt,Se,it){me||Gt({});let xt=st(pt),rr=st(Se);return Ft(xt,rr,it)},t.addHook=function(pt,Se){typeof Se=="function"&&av(I[pt],Se)},t.removeHook=function(pt,Se){if(Se!==void 0){let it=qNe(I[pt],Se);return it===-1?void 0:UNe(I[pt],it,1)[0]}return tY(I[pt])},t.removeHooks=function(pt){I[pt]=[]},t.removeAllHooks=function(){I=oY()},t}var lY,eY,GNe,VNe,WNe,qa,Do,cv,P7,B7,nv,qNe,tY,av,UNe,BC,R7,L7,Mm,HNe,YNe,fl,Wa,sv,rY,M7,N7,KNe,I7,ZNe,iY,nY,O7,aY,PC,QNe,JNe,eIe,tIe,rIe,cY,iIe,nIe,uY,aIe,sY,lv,sIe,oIe,oY,Ro,uv=z(()=>{"use strict";({entries:lY,setPrototypeOf:eY,isFrozen:GNe,getPrototypeOf:VNe,getOwnPropertyDescriptor:WNe}=Object),{freeze:qa,seal:Do,create:cv}=Object,{apply:P7,construct:B7}=typeof Reflect<"u"&&Reflect;qa||(qa=o(function(t){return t},"freeze"));Do||(Do=o(function(t){return t},"seal"));P7||(P7=o(function(t,r){for(var i=arguments.length,n=new Array(i>2?i-2:0),a=2;a1?r-1:0),n=1;n/gm),eIe=Do(/\$\{[\w\W]*/gm),tIe=Do(/^data-[\-\w.\u00B7-\uFFFF]+$/),rIe=Do(/^aria-[\-\w]+$/),cY=Do(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),iIe=Do(/^(?:\w+script|data):/i),nIe=Do(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),uY=Do(/^html$/i),aIe=Do(/^[a-z][.\w]*(-[.\w]+)+$/i),sY=Object.freeze({__proto__:null,ARIA_ATTR:rIe,ATTR_WHITESPACE:nIe,CUSTOM_ELEMENT:aIe,DATA_ATTR:tIe,DOCTYPE_NAME:uY,ERB_EXPR:JNe,IS_ALLOWED_URI:cY,IS_SCRIPT_OR_DATA:iIe,MUSTACHE_EXPR:QNe,TMPLIT_EXPR:eIe}),lv={element:1,text:3,progressingInstruction:7,comment:8,document:9},sIe=o(function(){return typeof window>"u"?null:window},"getGlobal"),oIe=o(function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null,n="data-tt-policy-suffix";r&&r.hasAttribute(n)&&(i=r.getAttribute(n));let a="dompurify"+(i?"#"+i:"");try{return t.createPolicy(a,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},"_createTrustedTypesPolicy"),oY=o(function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},"_createHooksMap");o(hY,"createDOMPurify");Ro=hY()});var Wj={};xr(Wj,{ParseError:()=>Lt,SETTINGS_SCHEMA:()=>pv,__defineFunction:()=>Bt,__defineMacro:()=>he,__defineSymbol:()=>q,__domTree:()=>Vj,__parse:()=>Fj,__renderToDomTree:()=>uk,__renderToHTMLTree:()=>zj,__setFontMetrics:()=>UY,default:()=>Z9e,render:()=>ED,renderToString:()=>Bj,version:()=>Gj});function fIe(e){return String(e).replace(dIe,t=>hIe[t])}function yIe(e){if(e.default)return e.default;var t=e.type,r=Array.isArray(t)?t[0]:t;if(typeof r!="string")return r.enum[0];switch(r){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}function wIe(e){for(var t=0;t=n[0]&&e<=n[1])return r.name}return null}function qY(e){for(var t=0;t=XC[t]&&e<=XC[t+1])return!0;return!1}function UY(e,t){nc[e]=t}function uD(e,t,r){if(!nc[t])throw new Error("Font metrics not found for font: "+t+".");var i=e.charCodeAt(0),n=nc[t][i];if(!n&&e[0]in fY&&(i=fY[e[0]].charCodeAt(0),n=nc[t][i]),!n&&r==="text"&&qY(i)&&(n=nc[t][77]),n)return{depth:n[0],height:n[1],italic:n[2],skew:n[3],width:n[4]}}function OIe(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!F7[t]){var r=F7[t]={cssEmPerMu:FC.quad[t]/18};for(var i in FC)FC.hasOwnProperty(i)&&(r[i]=FC[i][t])}return F7[t]}function gY(e){if(e instanceof Ts)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function zIe(e){if(e instanceof Wf)return e;throw new Error("Expected span but got "+String(e)+".")}function q(e,t,r,i,n,a){_i[e][n]={font:t,group:r,replace:i},a&&i&&(_i[e][i]=_i[e][n])}function Bt(e){for(var{type:t,names:r,props:i,handler:n,htmlBuilder:a,mathmlBuilder:s}=e,l={type:t,numArgs:i.numArgs,argTypes:i.argTypes,allowedInArgument:!!i.allowedInArgument,allowedInText:!!i.allowedInText,allowedInMath:i.allowedInMath===void 0?!0:i.allowedInMath,numOptionalArgs:i.numOptionalArgs||0,infix:!!i.infix,primitive:!!i.primitive,handler:n},u=0;u0&&(a.push(UC(s,t)),s=[]),a.push(i[l]));s.length>0&&a.push(UC(s,t));var h;r?(h=UC(Fn(r,t,!0)),h.classes=["tag"],a.push(h)):n&&a.push(n);var d=bu(["katex-html"],a);if(d.setAttribute("aria-hidden","true"),h){var f=h.children[0];f.style.height=It(d.height+d.depth),d.depth&&(f.style.verticalAlign=It(-d.depth))}return d}function ij(e){return new Vf(e)}function G7(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Mo&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var r=e.children[0];return r instanceof Mo&&r.text===","}else return!1}function TY(e,t,r,i,n){var a=Cs(e,r),s;a.length===1&&a[0]instanceof Ha&&["mrow","mtable"].includes(a[0].type)?s=a[0]:s=new Dt.MathNode("mrow",a);var l=new Dt.MathNode("annotation",[new Dt.TextNode(t)]);l.setAttribute("encoding","application/x-tex");var u=new Dt.MathNode("semantics",[s,l]),h=new Dt.MathNode("math",[u]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),i&&h.setAttribute("display","block");var d=n?"katex":"katex-mathml";return Ke.makeSpan([d],[h])}function Nr(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function pD(e){var t=sk(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function sk(e){return e&&(e.type==="atom"||VIe.hasOwnProperty(e.type))?e:null}function oj(e,t){var r=Fn(e.body,t,!0);return v9e([e.mclass],r,t)}function lj(e,t){var r,i=Cs(e.body,t);return e.mclass==="minner"?r=new Dt.MathNode("mpadded",i):e.mclass==="mord"?e.isCharacterBox?(r=i[0],r.type="mi"):r=new Dt.MathNode("mi",i):(e.isCharacterBox?(r=i[0],r.type="mo"):r=new Dt.MathNode("mo",i),e.mclass==="mbin"?(r.attributes.lspace="0.22em",r.attributes.rspace="0.22em"):e.mclass==="mpunct"?(r.attributes.lspace="0em",r.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(r.attributes.lspace="0em",r.attributes.rspace="0em"):e.mclass==="minner"&&(r.attributes.lspace="0.0556em",r.attributes.width="+0.1111em")),r}function T9e(e,t,r){var i=x9e[e];switch(i){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return r.callFunction(i,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var n=r.callFunction("\\\\cdleft",[t[0]],[]),a={type:"atom",text:i,mode:"math",family:"rel"},s=r.callFunction("\\Big",[a],[]),l=r.callFunction("\\\\cdright",[t[1]],[]),u={type:"ordgroup",mode:"math",body:[n,s,l]};return r.callFunction("\\\\cdparent",[u],[])}case"\\\\cdlongequal":return r.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return r.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function C9e(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var r=e.fetch().text;if(r==="&"||r==="\\\\")e.consume();else if(r==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new Lt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var i=[],n=[i],a=0;a-1))if("<>AV".indexOf(h)>-1)for(var f=0;f<2;f++){for(var p=!0,m=u+1;mAV=|." after @',s[u]);var g=T9e(h,d,e),y={type:"styling",body:[g],mode:"math",style:"display"};i.push(y),l=CY()}a%2===0?i.push(l):i.shift(),i=[],n.push(i)}e.gullet.endGroup(),e.gullet.endGroup();var v=new Array(n[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:n,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(n.length+1).fill([])}}function lk(e,t){var r=sk(e);if(r&&O9e.includes(r.text))return r;throw r?new Lt("Invalid delimiter '"+r.text+"' after '"+t.funcName+"'",e):new Lt("Invalid delimiter type '"+e.type+"'",e)}function SY(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}function sc(e){for(var{type:t,names:r,props:i,handler:n,htmlBuilder:a,mathmlBuilder:s}=e,l={type:t,numArgs:i.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:n},u=0;u1||!d)&&y.pop(),x.length{"use strict";bs=class e{static{o(this,"SourceLocation")}constructor(t,r,i){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=r,this.end=i}static range(t,r){return r?!t||!t.loc||!r.loc||t.loc.lexer!==r.loc.lexer?null:new e(t.loc.lexer,t.loc.start,r.loc.end):t&&t.loc}},eo=class e{static{o(this,"Token")}constructor(t,r){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=r}range(t,r){return new e(r,bs.range(this,t))}},Lt=class e{static{o(this,"ParseError")}constructor(t,r){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var i="KaTeX parse error: "+t,n,a,s=r&&r.loc;if(s&&s.start<=s.end){var l=s.lexer.input;n=s.start,a=s.end,n===l.length?i+=" at end of input: ":i+=" at position "+(n+1)+": ";var u=l.slice(n,a).replace(/[^]/g,"$&\u0332"),h;n>15?h="\u2026"+l.slice(n-15,n):h=l.slice(0,n);var d;a+15":">","<":"<",'"':""","'":"'"},dIe=/[&><"']/g;o(fIe,"escape");WY=o(function e(t){return t.type==="ordgroup"||t.type==="color"?t.body.length===1?e(t.body[0]):t:t.type==="font"?e(t.body):t},"getBaseElem"),pIe=o(function(t){var r=WY(t);return r.type==="mathord"||r.type==="textord"||r.type==="atom"},"isCharacterBox"),mIe=o(function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t},"assert"),gIe=o(function(t){var r=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(t);return r?r[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(r[1])?null:r[1].toLowerCase():"_relative"},"protocolFromUrl"),Zr={deflt:lIe,escape:fIe,hyphenate:uIe,getBaseElem:WY,isCharacterBox:pIe,protocolFromUrl:gIe},pv={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format "},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color ",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:o(e=>"#"+e,"cliProcessor")},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:o((e,t)=>(t.push(e),t),"cliProcessor")},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:o(e=>Math.max(0,e),"processor"),cli:"--min-rule-thickness ",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:o(e=>Math.max(0,e),"processor"),cli:"-s, --max-size ",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:o(e=>Math.max(0,e),"processor"),cli:"-e, --max-expand ",cliProcessor:o(e=>e==="Infinity"?1/0:parseInt(e),"cliProcessor")},globalGroup:{type:"boolean",cli:!1}};o(yIe,"getDefaultValue");gv=class{static{o(this,"Settings")}constructor(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var r in pv)if(pv.hasOwnProperty(r)){var i=pv[r];this[r]=t[r]!==void 0?i.processor?i.processor(t[r]):t[r]:yIe(i)}}reportNonstrict(t,r,i){var n=this.strict;if(typeof n=="function"&&(n=n(t,r,i)),!(!n||n==="ignore")){if(n===!0||n==="error")throw new Lt("LaTeX-incompatible input and strict mode is set to 'error': "+(r+" ["+t+"]"),i);n==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+n+"': "+r+" ["+t+"]"))}}useStrictBehavior(t,r,i){var n=this.strict;if(typeof n=="function")try{n=n(t,r,i)}catch{n="error"}return!n||n==="ignore"?!1:n===!0||n==="error"?!0:n==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(r+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+n+"': "+r+" ["+t+"]")),!1)}isTrusted(t){if(t.url&&!t.protocol){var r=Zr.protocolFromUrl(t.url);if(r==null)return!1;t.protocol=r}var i=typeof this.trust=="function"?this.trust(t):this.trust;return!!i}},rc=class{static{o(this,"Style")}constructor(t,r,i){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=r,this.cramped=i}sup(){return ic[vIe[this.id]]}sub(){return ic[xIe[this.id]]}fracNum(){return ic[bIe[this.id]]}fracDen(){return ic[TIe[this.id]]}cramp(){return ic[CIe[this.id]]}text(){return ic[kIe[this.id]]}isTight(){return this.size>=2}},cD=0,KC=1,Im=2,vu=3,yv=4,Lo=5,Om=6,Ya=7,ic=[new rc(cD,0,!1),new rc(KC,0,!0),new rc(Im,1,!1),new rc(vu,1,!0),new rc(yv,2,!1),new rc(Lo,2,!0),new rc(Om,3,!1),new rc(Ya,3,!0)],vIe=[yv,Lo,yv,Lo,Om,Ya,Om,Ya],xIe=[Lo,Lo,Lo,Lo,Ya,Ya,Ya,Ya],bIe=[Im,vu,yv,Lo,Om,Ya,Om,Ya],TIe=[vu,vu,Lo,Lo,Ya,Ya,Ya,Ya],CIe=[KC,KC,vu,vu,Lo,Lo,Ya,Ya],kIe=[cD,KC,Im,vu,Im,vu,Im,vu],ur={DISPLAY:ic[cD],TEXT:ic[Im],SCRIPT:ic[yv],SCRIPTSCRIPT:ic[Om]},Z7=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];o(wIe,"scriptFromCodepoint");XC=[];Z7.forEach(e=>e.blocks.forEach(t=>XC.push(...t)));o(qY,"supportedCodepoint");Nm=80,SIe=o(function(t,r){return"M95,"+(622+t+r)+` +c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 +c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 +c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 +s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 +c69,-144,104.5,-217.7,106.5,-221 +l`+t/2.075+" -"+t+` +c5.3,-9.3,12,-14,20,-14 +H400000v`+(40+t)+`H845.2724 +s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 +c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z +M`+(834+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},"sqrtMain"),EIe=o(function(t,r){return"M263,"+(601+t+r)+`c0.7,0,18,39.7,52,119 +c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 +c340,-704.7,510.7,-1060.3,512,-1067 +l`+t/2.084+" -"+t+` +c4.7,-7.3,11,-11,19,-11 +H40000v`+(40+t)+`H1012.3 +s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 +c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 +s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 +c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z +M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},"sqrtSize1"),AIe=o(function(t,r){return"M983 "+(10+t+r)+` +l`+t/3.13+" -"+t+` +c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+` +H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 +s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 +c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 +c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 +c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 +c53.7,-170.3,84.5,-266.8,92.5,-289.5z +M`+(1001+t)+" "+r+"h400000v"+(40+t)+"h-400000z"},"sqrtSize2"),_Ie=o(function(t,r){return"M424,"+(2398+t+r)+` +c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 +c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 +s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 +s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 +l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000 +v`+(40+t)+`H1014.6 +s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 +c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+r+` +h400000v`+(40+t)+"h-400000z"},"sqrtSize3"),DIe=o(function(t,r){return"M473,"+(2713+t+r)+` +c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+` +c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7 +s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 +c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 +s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, +606zM`+(1001+t)+" "+r+"h400000v"+(40+t)+"H1017.7z"},"sqrtSize4"),RIe=o(function(t){var r=t/2;return"M400000 "+t+" H0 L"+r+" 0 l65 45 L145 "+(t-80)+" H400000z"},"phasePath"),LIe=o(function(t,r,i){var n=i-54-r-t;return"M702 "+(t+r)+"H400000"+(40+t)+` +H742v`+n+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 +h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 +c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 +219 661 l218 661zM702 `+r+"H400000v"+(40+t)+"H742z"},"sqrtTall"),MIe=o(function(t,r,i){r=1e3*r;var n="";switch(t){case"sqrtMain":n=SIe(r,Nm);break;case"sqrtSize1":n=EIe(r,Nm);break;case"sqrtSize2":n=AIe(r,Nm);break;case"sqrtSize3":n=_Ie(r,Nm);break;case"sqrtSize4":n=DIe(r,Nm);break;case"sqrtTall":n=LIe(r,Nm,i)}return n},"sqrtPath"),NIe=o(function(t,r){switch(t){case"\u239C":return"M291 0 H417 V"+r+" H291z M291 0 H417 V"+r+" H291z";case"\u2223":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z";case"\u2225":return"M145 0 H188 V"+r+" H145z M145 0 H188 V"+r+" H145z"+("M367 0 H410 V"+r+" H367z M367 0 H410 V"+r+" H367z");case"\u239F":return"M457 0 H583 V"+r+" H457z M457 0 H583 V"+r+" H457z";case"\u23A2":return"M319 0 H403 V"+r+" H319z M319 0 H403 V"+r+" H319z";case"\u23A5":return"M263 0 H347 V"+r+" H263z M263 0 H347 V"+r+" H263z";case"\u23AA":return"M384 0 H504 V"+r+" H384z M384 0 H504 V"+r+" H384z";case"\u23D0":return"M312 0 H355 V"+r+" H312z M312 0 H355 V"+r+" H312z";case"\u2016":return"M257 0 H300 V"+r+" H257z M257 0 H300 V"+r+" H257z"+("M478 0 H521 V"+r+" H478z M478 0 H521 V"+r+" H478z");default:return""}},"innerPath"),dY={doubleleftarrow:`M262 157 +l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 + 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 + 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 +c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 + 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 +-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 +-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z +m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l +-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 + 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 +-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 +-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 +-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 +c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 +-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120 + 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 +-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 +c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 + 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 + 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 + l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 +-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 + 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 + 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 + 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 +-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80 +H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 + 435 0h399565z`,leftgroupunder:`M400000 262 +H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 + 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 +-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 +-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 +-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 + 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 +-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 +-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z +m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 + 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 + 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 +-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 + 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 +-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 +v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 +-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 +-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 + 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z +M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z +M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 +-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 +c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 + 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z +M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334 +c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 +-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 + 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 + 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214 +c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 + 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 + 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 +-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 +-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z +m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 +60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 +-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z +m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 +c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 +-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z +m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 +85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 +-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z +m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 +c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128 +-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 + 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 + 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 +-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 + 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l +-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 +s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 +c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 + 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 +-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 + 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 + 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 +-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 +-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 + 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 +-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 + 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z +m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 + 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 +-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 +-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 + 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 + 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 +-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z +m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 + 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 +-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 + 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z +M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 + 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 +-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 +-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40 + 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 +-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 +-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 +-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 + 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167 +c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 + 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 + 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 +-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 + 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 +-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 + 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 + 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 +-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418 +-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 + 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 +c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 + 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 +-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 + 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 + 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 + -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 +-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 + 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 + 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 + -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 +3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 +10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 +-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 +-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 +H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 +c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 +c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, +-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 +c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 +c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 +s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 +121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 +s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 +c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z +M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 +-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 +13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 +-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 +-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 +151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 +c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 +c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 +c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z +M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, +1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, +-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z +M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},IIe=o(function(t,r){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v1759 h347 v-84 +H403z M403 1759 V0 H319 V1759 v`+r+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v1759 H0 v84 H347z +M347 1759 V0 H263 V1759 v`+r+" v1759 h84z";case"vert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+" v585 h43z";case"doublevert":return"M145 15 v585 v"+r+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+r+` v585 h43z +M367 15 v585 v`+r+` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v`+-r+` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+r+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+r+` v1715 h263 v84 H319z +MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+r+` v1799 H0 v-84 H319z +MM319 602 V0 H403 V602 v`+r+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+r+` v602 h84z +M403 1759 V0 H319 V1759 v`+r+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+r+` v602 h84z +M347 1759 V0 h-84 V1759 v`+r+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 +c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, +-36,557 l0,`+(r+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, +949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 +c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, +-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 +l0,-`+(r+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, +-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, +63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 +c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(r+9)+` +c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 +c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 +c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 +c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 +l0,-`+(r+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}},"tallDelim"),Vf=class{static{o(this,"DocumentFragment")}constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),r=0;rr.toText(),"toText");return this.children.map(t).join("")}},nc={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},FC={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},fY={\u00C5:"A",\u00D0:"D",\u00DE:"o",\u00E5:"a",\u00F0:"d",\u00FE:"o",\u0410:"A",\u0411:"B",\u0412:"B",\u0413:"F",\u0414:"A",\u0415:"E",\u0416:"K",\u0417:"3",\u0418:"N",\u0419:"N",\u041A:"K",\u041B:"N",\u041C:"M",\u041D:"H",\u041E:"O",\u041F:"N",\u0420:"P",\u0421:"C",\u0422:"T",\u0423:"y",\u0424:"O",\u0425:"X",\u0426:"U",\u0427:"h",\u0428:"W",\u0429:"W",\u042A:"B",\u042B:"X",\u042C:"B",\u042D:"3",\u042E:"X",\u042F:"R",\u0430:"a",\u0431:"b",\u0432:"a",\u0433:"r",\u0434:"y",\u0435:"e",\u0436:"m",\u0437:"e",\u0438:"n",\u0439:"n",\u043A:"n",\u043B:"n",\u043C:"m",\u043D:"n",\u043E:"o",\u043F:"n",\u0440:"p",\u0441:"c",\u0442:"o",\u0443:"y",\u0444:"b",\u0445:"x",\u0446:"n",\u0447:"n",\u0448:"w",\u0449:"w",\u044A:"a",\u044B:"m",\u044C:"a",\u044D:"e",\u044E:"m",\u044F:"r"};o(UY,"setFontMetrics");o(uD,"getCharacterMetrics");F7={};o(OIe,"getGlobalMetrics");PIe=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],pY=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],mY=o(function(t,r){return r.size<2?t:PIe[t-1][r.size-1]},"sizeAtStyle"),ZC=class e{static{o(this,"Options")}constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||e.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=pY[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var r={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);return new e(r)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:mY(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:pY[t-1]})}havingBaseStyle(t){t=t||this.style.text();var r=mY(e.BASESIZE,t);return this.size===r&&this.textSize===e.BASESIZE&&this.style===t?this:this.extend({style:t,size:r})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==e.BASESIZE?["sizing","reset-size"+this.size,"size"+e.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=OIe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}};ZC.BASESIZE=6;Q7={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},BIe={ex:!0,em:!0,mu:!0},HY=o(function(t){return typeof t!="string"&&(t=t.unit),t in Q7||t in BIe||t==="ex"},"validUnit"),Qi=o(function(t,r){var i;if(t.unit in Q7)i=Q7[t.unit]/r.fontMetrics().ptPerEm/r.sizeMultiplier;else if(t.unit==="mu")i=r.fontMetrics().cssEmPerMu;else{var n;if(r.style.isTight()?n=r.havingStyle(r.style.text()):n=r,t.unit==="ex")i=n.fontMetrics().xHeight;else if(t.unit==="em")i=n.fontMetrics().quad;else throw new Lt("Invalid unit: '"+t.unit+"'");n!==r&&(i*=n.sizeMultiplier/r.sizeMultiplier)}return Math.min(t.number*i,r.maxSize)},"calculateSize"),It=o(function(t){return+t.toFixed(4)+"em"},"makeEm"),$h=o(function(t){return t.filter(r=>r).join(" ")},"createClass"),YY=o(function(t,r,i){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=i||{},r){r.style.isTight()&&this.classes.push("mtight");var n=r.getColor();n&&(this.style.color=n)}},"initNode"),jY=o(function(t){var r=document.createElement(t);r.className=$h(this.classes);for(var i in this.style)this.style.hasOwnProperty(i)&&(r.style[i]=this.style[i]);for(var n in this.attributes)this.attributes.hasOwnProperty(n)&&r.setAttribute(n,this.attributes[n]);for(var a=0;a/=\x00-\x1f]/,XY=o(function(t){var r="<"+t;this.classes.length&&(r+=' class="'+Zr.escape($h(this.classes))+'"');var i="";for(var n in this.style)this.style.hasOwnProperty(n)&&(i+=Zr.hyphenate(n)+":"+this.style[n]+";");i&&(r+=' style="'+Zr.escape(i)+'"');for(var a in this.attributes)if(this.attributes.hasOwnProperty(a)){if(FIe.test(a))throw new Lt("Invalid attribute name '"+a+"'");r+=" "+a+'="'+Zr.escape(this.attributes[a])+'"'}r+=">";for(var s=0;s",r},"toMarkup"),Wf=class{static{o(this,"Span")}constructor(t,r,i,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,YY.call(this,t,i,n),this.children=r||[]}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return jY.call(this,"span")}toMarkup(){return XY.call(this,"span")}},vv=class{static{o(this,"Anchor")}constructor(t,r,i,n){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,YY.call(this,r,n),this.children=i||[],this.setAttribute("href",t)}setAttribute(t,r){this.attributes[t]=r}hasClass(t){return this.classes.includes(t)}toNode(){return jY.call(this,"a")}toMarkup(){return XY.call(this,"a")}},J7=class{static{o(this,"Img")}constructor(t,r,i){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=r,this.src=t,this.classes=["mord"],this.style=i}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");t.src=this.src,t.alt=this.alt,t.className="mord";for(var r in this.style)this.style.hasOwnProperty(r)&&(t.style[r]=this.style[r]);return t}toMarkup(){var t=''+Zr.escape(this.alt)+'0&&(r=document.createElement("span"),r.style.marginRight=It(this.italic)),this.classes.length>0&&(r=r||document.createElement("span"),r.className=$h(this.classes));for(var i in this.style)this.style.hasOwnProperty(i)&&(r=r||document.createElement("span"),r.style[i]=this.style[i]);return r?(r.appendChild(t),r):t}toMarkup(){var t=!1,r="0&&(i+="margin-right:"+this.italic+"em;");for(var n in this.style)this.style.hasOwnProperty(n)&&(i+=Zr.hyphenate(n)+":"+this.style[n]+";");i&&(t=!0,r+=' style="'+Zr.escape(i)+'"');var a=Zr.escape(this.text);return t?(r+=">",r+=a,r+="",r):a}},ml=class{static{o(this,"SvgNode")}constructor(t,r){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=r||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"svg");for(var i in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,i)&&r.setAttribute(i,this.attributes[i]);for(var n=0;n':''}},xv=class{static{o(this,"LineNode")}constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",r=document.createElementNS(t,"line");for(var i in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,i)&&r.setAttribute(i,this.attributes[i]);return r}toMarkup(){var t="","\\gt",!0);q(X,se,Ne,"\u2208","\\in",!0);q(X,se,Ne,"\uE020","\\@not");q(X,se,Ne,"\u2282","\\subset",!0);q(X,se,Ne,"\u2283","\\supset",!0);q(X,se,Ne,"\u2286","\\subseteq",!0);q(X,se,Ne,"\u2287","\\supseteq",!0);q(X,Le,Ne,"\u2288","\\nsubseteq",!0);q(X,Le,Ne,"\u2289","\\nsupseteq",!0);q(X,se,Ne,"\u22A8","\\models");q(X,se,Ne,"\u2190","\\leftarrow",!0);q(X,se,Ne,"\u2264","\\le");q(X,se,Ne,"\u2264","\\leq",!0);q(X,se,Ne,"<","\\lt",!0);q(X,se,Ne,"\u2192","\\rightarrow",!0);q(X,se,Ne,"\u2192","\\to");q(X,Le,Ne,"\u2271","\\ngeq",!0);q(X,Le,Ne,"\u2270","\\nleq",!0);q(X,se,Cu,"\xA0","\\ ");q(X,se,Cu,"\xA0","\\space");q(X,se,Cu,"\xA0","\\nobreakspace");q(wt,se,Cu,"\xA0","\\ ");q(wt,se,Cu,"\xA0"," ");q(wt,se,Cu,"\xA0","\\space");q(wt,se,Cu,"\xA0","\\nobreakspace");q(X,se,Cu,null,"\\nobreak");q(X,se,Cu,null,"\\allowbreak");q(X,se,nk,",",",");q(X,se,nk,";",";");q(X,Le,Vt,"\u22BC","\\barwedge",!0);q(X,Le,Vt,"\u22BB","\\veebar",!0);q(X,se,Vt,"\u2299","\\odot",!0);q(X,se,Vt,"\u2295","\\oplus",!0);q(X,se,Vt,"\u2297","\\otimes",!0);q(X,se,ze,"\u2202","\\partial",!0);q(X,se,Vt,"\u2298","\\oslash",!0);q(X,Le,Vt,"\u229A","\\circledcirc",!0);q(X,Le,Vt,"\u22A1","\\boxdot",!0);q(X,se,Vt,"\u25B3","\\bigtriangleup");q(X,se,Vt,"\u25BD","\\bigtriangledown");q(X,se,Vt,"\u2020","\\dagger");q(X,se,Vt,"\u22C4","\\diamond");q(X,se,Vt,"\u22C6","\\star");q(X,se,Vt,"\u25C3","\\triangleleft");q(X,se,Vt,"\u25B9","\\triangleright");q(X,se,to,"{","\\{");q(wt,se,ze,"{","\\{");q(wt,se,ze,"{","\\textbraceleft");q(X,se,ja,"}","\\}");q(wt,se,ze,"}","\\}");q(wt,se,ze,"}","\\textbraceright");q(X,se,to,"{","\\lbrace");q(X,se,ja,"}","\\rbrace");q(X,se,to,"[","\\lbrack",!0);q(wt,se,ze,"[","\\lbrack",!0);q(X,se,ja,"]","\\rbrack",!0);q(wt,se,ze,"]","\\rbrack",!0);q(X,se,to,"(","\\lparen",!0);q(X,se,ja,")","\\rparen",!0);q(wt,se,ze,"<","\\textless",!0);q(wt,se,ze,">","\\textgreater",!0);q(X,se,to,"\u230A","\\lfloor",!0);q(X,se,ja,"\u230B","\\rfloor",!0);q(X,se,to,"\u2308","\\lceil",!0);q(X,se,ja,"\u2309","\\rceil",!0);q(X,se,ze,"\\","\\backslash");q(X,se,ze,"\u2223","|");q(X,se,ze,"\u2223","\\vert");q(wt,se,ze,"|","\\textbar",!0);q(X,se,ze,"\u2225","\\|");q(X,se,ze,"\u2225","\\Vert");q(wt,se,ze,"\u2225","\\textbardbl");q(wt,se,ze,"~","\\textasciitilde");q(wt,se,ze,"\\","\\textbackslash");q(wt,se,ze,"^","\\textasciicircum");q(X,se,Ne,"\u2191","\\uparrow",!0);q(X,se,Ne,"\u21D1","\\Uparrow",!0);q(X,se,Ne,"\u2193","\\downarrow",!0);q(X,se,Ne,"\u21D3","\\Downarrow",!0);q(X,se,Ne,"\u2195","\\updownarrow",!0);q(X,se,Ne,"\u21D5","\\Updownarrow",!0);q(X,se,Sn,"\u2210","\\coprod");q(X,se,Sn,"\u22C1","\\bigvee");q(X,se,Sn,"\u22C0","\\bigwedge");q(X,se,Sn,"\u2A04","\\biguplus");q(X,se,Sn,"\u22C2","\\bigcap");q(X,se,Sn,"\u22C3","\\bigcup");q(X,se,Sn,"\u222B","\\int");q(X,se,Sn,"\u222B","\\intop");q(X,se,Sn,"\u222C","\\iint");q(X,se,Sn,"\u222D","\\iiint");q(X,se,Sn,"\u220F","\\prod");q(X,se,Sn,"\u2211","\\sum");q(X,se,Sn,"\u2A02","\\bigotimes");q(X,se,Sn,"\u2A01","\\bigoplus");q(X,se,Sn,"\u2A00","\\bigodot");q(X,se,Sn,"\u222E","\\oint");q(X,se,Sn,"\u222F","\\oiint");q(X,se,Sn,"\u2230","\\oiiint");q(X,se,Sn,"\u2A06","\\bigsqcup");q(X,se,Sn,"\u222B","\\smallint");q(wt,se,Pm,"\u2026","\\textellipsis");q(X,se,Pm,"\u2026","\\mathellipsis");q(wt,se,Pm,"\u2026","\\ldots",!0);q(X,se,Pm,"\u2026","\\ldots",!0);q(X,se,Pm,"\u22EF","\\@cdots",!0);q(X,se,Pm,"\u22F1","\\ddots",!0);q(X,se,ze,"\u22EE","\\varvdots");q(wt,se,ze,"\u22EE","\\varvdots");q(X,se,qi,"\u02CA","\\acute");q(X,se,qi,"\u02CB","\\grave");q(X,se,qi,"\xA8","\\ddot");q(X,se,qi,"~","\\tilde");q(X,se,qi,"\u02C9","\\bar");q(X,se,qi,"\u02D8","\\breve");q(X,se,qi,"\u02C7","\\check");q(X,se,qi,"^","\\hat");q(X,se,qi,"\u20D7","\\vec");q(X,se,qi,"\u02D9","\\dot");q(X,se,qi,"\u02DA","\\mathring");q(X,se,cr,"\uE131","\\@imath");q(X,se,cr,"\uE237","\\@jmath");q(X,se,ze,"\u0131","\u0131");q(X,se,ze,"\u0237","\u0237");q(wt,se,ze,"\u0131","\\i",!0);q(wt,se,ze,"\u0237","\\j",!0);q(wt,se,ze,"\xDF","\\ss",!0);q(wt,se,ze,"\xE6","\\ae",!0);q(wt,se,ze,"\u0153","\\oe",!0);q(wt,se,ze,"\xF8","\\o",!0);q(wt,se,ze,"\xC6","\\AE",!0);q(wt,se,ze,"\u0152","\\OE",!0);q(wt,se,ze,"\xD8","\\O",!0);q(wt,se,qi,"\u02CA","\\'");q(wt,se,qi,"\u02CB","\\`");q(wt,se,qi,"\u02C6","\\^");q(wt,se,qi,"\u02DC","\\~");q(wt,se,qi,"\u02C9","\\=");q(wt,se,qi,"\u02D8","\\u");q(wt,se,qi,"\u02D9","\\.");q(wt,se,qi,"\xB8","\\c");q(wt,se,qi,"\u02DA","\\r");q(wt,se,qi,"\u02C7","\\v");q(wt,se,qi,"\xA8",'\\"');q(wt,se,qi,"\u02DD","\\H");q(wt,se,qi,"\u25EF","\\textcircled");KY={"--":!0,"---":!0,"``":!0,"''":!0};q(wt,se,ze,"\u2013","--",!0);q(wt,se,ze,"\u2013","\\textendash");q(wt,se,ze,"\u2014","---",!0);q(wt,se,ze,"\u2014","\\textemdash");q(wt,se,ze,"\u2018","`",!0);q(wt,se,ze,"\u2018","\\textquoteleft");q(wt,se,ze,"\u2019","'",!0);q(wt,se,ze,"\u2019","\\textquoteright");q(wt,se,ze,"\u201C","``",!0);q(wt,se,ze,"\u201C","\\textquotedblleft");q(wt,se,ze,"\u201D","''",!0);q(wt,se,ze,"\u201D","\\textquotedblright");q(X,se,ze,"\xB0","\\degree",!0);q(wt,se,ze,"\xB0","\\degree");q(wt,se,ze,"\xB0","\\textdegree",!0);q(X,se,ze,"\xA3","\\pounds");q(X,se,ze,"\xA3","\\mathsterling",!0);q(wt,se,ze,"\xA3","\\pounds");q(wt,se,ze,"\xA3","\\textsterling",!0);q(X,Le,ze,"\u2720","\\maltese");q(wt,Le,ze,"\u2720","\\maltese");yY='0123456789/@."';for($C=0;$C0)return pl(a,h,n,r,s.concat(d));if(u){var f,p;if(u==="boldsymbol"){var m=UIe(a,n,r,s,i);f=m.fontName,p=[m.fontClass]}else l?(f=JY[u].fontName,p=[u]):(f=qC(u,r.fontWeight,r.fontShape),p=[u,r.fontWeight,r.fontShape]);if(ak(a,f,n).metrics)return pl(a,f,n,r,s.concat(p));if(KY.hasOwnProperty(a)&&f.slice(0,10)==="Typewriter"){for(var g=[],y=0;y{if($h(e.classes)!==$h(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize)return!1;if(e.classes.length===1){var r=e.classes[0];if(r==="mbin"||r==="mord")return!1}for(var i in e.style)if(e.style.hasOwnProperty(i)&&e.style[i]!==t.style[i])return!1;for(var n in t.style)if(t.style.hasOwnProperty(n)&&e.style[n]!==t.style[n])return!1;return!0},"canCombine"),jIe=o(e=>{for(var t=0;tr&&(r=s.height),s.depth>i&&(i=s.depth),s.maxFontSize>n&&(n=s.maxFontSize)}t.height=r,t.depth=i,t.maxFontSize=n},"sizeElementFromChildren"),xs=o(function(t,r,i,n){var a=new Wf(t,r,i,n);return hD(a),a},"makeSpan"),ZY=o((e,t,r,i)=>new Wf(e,t,r,i),"makeSvgSpan"),XIe=o(function(t,r,i){var n=xs([t],[],r);return n.height=Math.max(i||r.fontMetrics().defaultRuleThickness,r.minRuleThickness),n.style.borderBottomWidth=It(n.height),n.maxFontSize=1,n},"makeLineSpan"),KIe=o(function(t,r,i,n){var a=new vv(t,r,i,n);return hD(a),a},"makeAnchor"),QY=o(function(t){var r=new Vf(t);return hD(r),r},"makeFragment"),ZIe=o(function(t,r){return t instanceof Vf?xs([],[t],r):t},"wrapFragment"),QIe=o(function(t){if(t.positionType==="individualShift"){for(var r=t.children,i=[r[0]],n=-r[0].shift-r[0].elem.depth,a=n,s=1;s{var r=xs(["mspace"],[],t),i=Qi(e,t);return r.style.marginRight=It(i),r},"makeGlue"),qC=o(function(t,r,i){var n="";switch(t){case"amsrm":n="AMS";break;case"textrm":n="Main";break;case"textsf":n="SansSerif";break;case"texttt":n="Typewriter";break;default:n=t}var a;return r==="textbf"&&i==="textit"?a="BoldItalic":r==="textbf"?a="Bold":r==="textit"?a="Italic":a="Regular",n+"-"+a},"retrieveTextFontName"),JY={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},ej={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},t9e=o(function(t,r){var[i,n,a]=ej[t],s=new ac(i),l=new ml([s],{width:It(n),height:It(a),style:"width:"+It(n),viewBox:"0 0 "+1e3*n+" "+1e3*a,preserveAspectRatio:"xMinYMin"}),u=ZY(["overlay"],[l],r);return u.height=a,u.style.height=It(a),u.style.width=It(n),u},"staticSvg"),Ke={fontMap:JY,makeSymbol:pl,mathsym:qIe,makeSpan:xs,makeSvgSpan:ZY,makeLineSpan:XIe,makeAnchor:KIe,makeFragment:QY,wrapFragment:ZIe,makeVList:JIe,makeOrd:HIe,makeGlue:e9e,staticSvg:t9e,svgData:ej,tryCombineChars:jIe},Zi={number:3,unit:"mu"},Gf={number:4,unit:"mu"},yu={number:5,unit:"mu"},r9e={mord:{mop:Zi,mbin:Gf,mrel:yu,minner:Zi},mop:{mord:Zi,mop:Zi,mrel:yu,minner:Zi},mbin:{mord:Gf,mop:Gf,mopen:Gf,minner:Gf},mrel:{mord:yu,mop:yu,mopen:yu,minner:yu},mopen:{},mclose:{mop:Zi,mbin:Gf,mrel:yu,minner:Zi},mpunct:{mord:Zi,mop:Zi,mrel:yu,mopen:Zi,mclose:Zi,mpunct:Zi,minner:Zi},minner:{mord:Zi,mop:Zi,mbin:Gf,mrel:yu,mopen:Zi,mpunct:Zi,minner:Zi}},i9e={mord:{mop:Zi},mop:{mord:Zi,mop:Zi},mbin:{},mrel:{},mopen:{},mclose:{mop:Zi},mpunct:{},minner:{mop:Zi}},tj={},JC={},ek={};o(Bt,"defineFunction");o(qf,"defineFunctionBuilders");tk=o(function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},"normalizeArgument"),gn=o(function(t){return t.type==="ordgroup"?t.body:[t]},"ordargument"),bu=Ke.makeSpan,n9e=["leftmost","mbin","mopen","mrel","mop","mpunct"],a9e=["rightmost","mrel","mclose","mpunct"],s9e={display:ur.DISPLAY,text:ur.TEXT,script:ur.SCRIPT,scriptscript:ur.SCRIPTSCRIPT},o9e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Fn=o(function(t,r,i,n){n===void 0&&(n=[null,null]);for(var a=[],s=0;s{var v=y.classes[0],x=g.classes[0];v==="mbin"&&a9e.includes(x)?y.classes[0]="mord":x==="mbin"&&n9e.includes(v)&&(g.classes[0]="mord")},{node:f},p,m),bY(a,(g,y)=>{var v=tD(y),x=tD(g),b=v&&x?g.hasClass("mtight")?i9e[v][x]:r9e[v][x]:null;if(b)return Ke.makeGlue(b,h)},{node:f},p,m),a},"buildExpression"),bY=o(function e(t,r,i,n,a){n&&t.push(n);for(var s=0;sp=>{t.splice(f+1,0,p),s++})(s)}n&&t.pop()},"traverseNonSpaceNodes"),rj=o(function(t){return t instanceof Vf||t instanceof vv||t instanceof Wf&&t.hasClass("enclosing")?t:null},"checkPartialGroup"),l9e=o(function e(t,r){var i=rj(t);if(i){var n=i.children;if(n.length){if(r==="right")return e(n[n.length-1],"right");if(r==="left")return e(n[0],"left")}}return t},"getOutermostNode"),tD=o(function(t,r){return t?(r&&(t=l9e(t,r)),o9e[t.classes[0]]||null):null},"getTypeOfDomTree"),bv=o(function(t,r){var i=["nulldelimiter"].concat(t.baseSizingClasses());return bu(r.concat(i))},"makeNullDelimiter"),Yr=o(function(t,r,i){if(!t)return bu();if(JC[t.type]){var n=JC[t.type](t,r);if(i&&r.size!==i.size){n=bu(r.sizingClasses(i),[n],r);var a=r.sizeMultiplier/i.sizeMultiplier;n.height*=a,n.depth*=a}return n}else throw new Lt("Got group of unknown type: '"+t.type+"'")},"buildGroup");o(UC,"buildHTMLUnbreakable");o(rD,"buildHTML");o(ij,"newDocumentFragment");Ha=class{static{o(this,"MathNode")}constructor(t,r,i){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=r||[],this.classes=i||[]}setAttribute(t,r){this.attributes[t]=r}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);this.classes.length>0&&(t.className=$h(this.classes));for(var i=0;i0&&(t+=' class ="'+Zr.escape($h(this.classes))+'"'),t+=">";for(var i=0;i",t}toText(){return this.children.map(t=>t.toText()).join("")}},Mo=class{static{o(this,"TextNode")}constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Zr.escape(this.toText())}toText(){return this.text}},iD=class{static{o(this,"SpaceNode")}constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character="\u200A":t>=.1666&&t<=.1667?this.character="\u2009":t>=.2222&&t<=.2223?this.character="\u2005":t>=.2777&&t<=.2778?this.character="\u2005\u200A":t>=-.05556&&t<=-.05555?this.character="\u200A\u2063":t>=-.1667&&t<=-.1666?this.character="\u2009\u2063":t>=-.2223&&t<=-.2222?this.character="\u205F\u2063":t>=-.2778&&t<=-.2777?this.character="\u2005\u2063":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",It(this.width)),t}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}},Dt={MathNode:Ha,TextNode:Mo,SpaceNode:iD,newDocumentFragment:ij},No=o(function(t,r,i){return _i[r][t]&&_i[r][t].replace&&t.charCodeAt(0)!==55349&&!(KY.hasOwnProperty(t)&&i&&(i.fontFamily&&i.fontFamily.slice(4,6)==="tt"||i.font&&i.font.slice(4,6)==="tt"))&&(t=_i[r][t].replace),new Dt.TextNode(t)},"makeText"),dD=o(function(t){return t.length===1?t[0]:new Dt.MathNode("mrow",t)},"makeRow"),fD=o(function(t,r){if(r.fontFamily==="texttt")return"monospace";if(r.fontFamily==="textsf")return r.fontShape==="textit"&&r.fontWeight==="textbf"?"sans-serif-bold-italic":r.fontShape==="textit"?"sans-serif-italic":r.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(r.fontShape==="textit"&&r.fontWeight==="textbf")return"bold-italic";if(r.fontShape==="textit")return"italic";if(r.fontWeight==="textbf")return"bold";var i=r.font;if(!i||i==="mathnormal")return null;var n=t.mode;if(i==="mathit")return"italic";if(i==="boldsymbol")return t.type==="textord"?"bold":"bold-italic";if(i==="mathbf")return"bold";if(i==="mathbb")return"double-struck";if(i==="mathsfit")return"sans-serif-italic";if(i==="mathfrak")return"fraktur";if(i==="mathscr"||i==="mathcal")return"script";if(i==="mathsf")return"sans-serif";if(i==="mathtt")return"monospace";var a=t.text;if(["\\imath","\\jmath"].includes(a))return null;_i[n][a]&&_i[n][a].replace&&(a=_i[n][a].replace);var s=Ke.fontMap[i].fontName;return uD(a,s,n)?Ke.fontMap[i].variant:null},"getVariant");o(G7,"isNumberPunctuation");Cs=o(function(t,r,i){if(t.length===1){var n=Ti(t[0],r);return i&&n instanceof Ha&&n.type==="mo"&&(n.setAttribute("lspace","0em"),n.setAttribute("rspace","0em")),[n]}for(var a=[],s,l=0;l=1&&(s.type==="mn"||G7(s))){var h=u.children[0];h instanceof Ha&&h.type==="mn"&&(h.children=[...s.children,...h.children],a.pop())}else if(s.type==="mi"&&s.children.length===1){var d=s.children[0];if(d instanceof Mo&&d.text==="\u0338"&&(u.type==="mo"||u.type==="mi"||u.type==="mn")){var f=u.children[0];f instanceof Mo&&f.text.length>0&&(f.text=f.text.slice(0,1)+"\u0338"+f.text.slice(1),a.pop())}}}a.push(u),s=u}return a},"buildExpression"),zh=o(function(t,r,i){return dD(Cs(t,r,i))},"buildExpressionRow"),Ti=o(function(t,r){if(!t)return new Dt.MathNode("mrow");if(ek[t.type]){var i=ek[t.type](t,r);return i}else throw new Lt("Got group of unknown type: '"+t.type+"'")},"buildGroup");o(TY,"buildMathML");nj=o(function(t){return new ZC({style:t.displayMode?ur.DISPLAY:ur.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},"optionsFromSettings"),aj=o(function(t,r){if(r.displayMode){var i=["katex-display"];r.leqno&&i.push("leqno"),r.fleqn&&i.push("fleqn"),t=Ke.makeSpan(i,[t])}return t},"displayWrap"),c9e=o(function(t,r,i){var n=nj(i),a;if(i.output==="mathml")return TY(t,r,n,i.displayMode,!0);if(i.output==="html"){var s=rD(t,n);a=Ke.makeSpan(["katex"],[s])}else{var l=TY(t,r,n,i.displayMode,!1),u=rD(t,n);a=Ke.makeSpan(["katex"],[l,u])}return aj(a,i)},"buildTree"),u9e=o(function(t,r,i){var n=nj(i),a=rD(t,n),s=Ke.makeSpan(["katex"],[a]);return aj(s,i)},"buildHTMLTree"),h9e={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overgroup:"\u23E0",undergroup:"\u23E1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21D2",xRightarrow:"\u21D2",overleftharpoon:"\u21BC",xleftharpoonup:"\u21BC",overrightharpoon:"\u21C0",xrightharpoonup:"\u21C0",xLeftarrow:"\u21D0",xLeftrightarrow:"\u21D4",xhookleftarrow:"\u21A9",xhookrightarrow:"\u21AA",xmapsto:"\u21A6",xrightharpoondown:"\u21C1",xleftharpoondown:"\u21BD",xrightleftharpoons:"\u21CC",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xrightleftarrows:"\u21C4",xrightequilibrium:"\u21CC",xleftequilibrium:"\u21CB","\\cdrightarrow":"\u2192","\\cdleftarrow":"\u2190","\\cdlongequal":"="},d9e=o(function(t){var r=new Dt.MathNode("mo",[new Dt.TextNode(h9e[t.replace(/^\\/,"")])]);return r.setAttribute("stretchy","true"),r},"mathMLnode"),f9e={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},p9e=o(function(t){return t.type==="ordgroup"?t.body.length:1},"groupLength"),m9e=o(function(t,r){function i(){var l=4e5,u=t.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(u)){var h=t,d=p9e(h.base),f,p,m;if(d>5)u==="widehat"||u==="widecheck"?(f=420,l=2364,m=.42,p=u+"4"):(f=312,l=2340,m=.34,p="tilde4");else{var g=[1,1,2,2,3,3][d];u==="widehat"||u==="widecheck"?(l=[0,1062,2364,2364,2364][g],f=[0,239,300,360,420][g],m=[0,.24,.3,.3,.36,.42][g],p=u+g):(l=[0,600,1033,2339,2340][g],f=[0,260,286,306,312][g],m=[0,.26,.286,.3,.306,.34][g],p="tilde"+g)}var y=new ac(p),v=new ml([y],{width:"100%",height:It(m),viewBox:"0 0 "+l+" "+f,preserveAspectRatio:"none"});return{span:Ke.makeSvgSpan([],[v],r),minWidth:0,height:m}}else{var x=[],b=f9e[u],[T,w,C]=b,k=C/1e3,E=T.length,A,N;if(E===1){var P=b[3];A=["hide-tail"],N=[P]}else if(E===2)A=["halfarrow-left","halfarrow-right"],N=["xMinYMin","xMaxYMin"];else if(E===3)A=["brace-left","brace-center","brace-right"],N=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+E+" children.");for(var I=0;I0&&(n.style.minWidth=It(a)),n},"svgSpan"),g9e=o(function(t,r,i,n,a){var s,l=t.height+t.depth+i+n;if(/fbox|color|angl/.test(r)){if(s=Ke.makeSpan(["stretchy",r],[],a),r==="fbox"){var u=a.color&&a.getColor();u&&(s.style.borderColor=u)}}else{var h=[];/^[bx]cancel$/.test(r)&&h.push(new xv({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(r)&&h.push(new xv({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new ml(h,{width:"100%",height:It(l)});s=Ke.makeSvgSpan([],[d],a)}return s.height=l,s.style.height=It(l),s},"encloseSpan"),Tu={encloseSpan:g9e,mathMLnode:d9e,svgSpan:m9e};o(Nr,"assertNodeType");o(pD,"assertSymbolNodeType");o(sk,"checkSymbolNodeType");mD=o((e,t)=>{var r,i,n;e&&e.type==="supsub"?(i=Nr(e.base,"accent"),r=i.base,e.base=r,n=zIe(Yr(e,t)),e.base=i):(i=Nr(e,"accent"),r=i.base);var a=Yr(r,t.havingCrampedStyle()),s=i.isShifty&&Zr.isCharacterBox(r),l=0;if(s){var u=Zr.getBaseElem(r),h=Yr(u,t.havingCrampedStyle());l=gY(h).skew}var d=i.label==="\\c",f=d?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),p;if(i.isStretchy)p=Tu.svgSpan(i,t),p=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"elem",elem:p,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+It(2*l)+")",marginLeft:It(2*l)}:void 0}]},t);else{var m,g;i.label==="\\vec"?(m=Ke.staticSvg("vec",t),g=Ke.svgData.vec[1]):(m=Ke.makeOrd({mode:i.mode,text:i.label},t,"textord"),m=gY(m),m.italic=0,g=m.width,d&&(f+=m.depth)),p=Ke.makeSpan(["accent-body"],[m]);var y=i.label==="\\textcircled";y&&(p.classes.push("accent-full"),f=a.height);var v=l;y||(v-=g/2),p.style.left=It(v),i.label==="\\textcircled"&&(p.style.top=".2em"),p=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:-f},{type:"elem",elem:p}]},t)}var x=Ke.makeSpan(["mord","accent"],[p],t);return n?(n.children[0]=x,n.height=Math.max(x.height,n.height),n.classes[0]="mord",n):x},"htmlBuilder$a"),sj=o((e,t)=>{var r=e.isStretchy?Tu.mathMLnode(e.label):new Dt.MathNode("mo",[No(e.label,e.mode)]),i=new Dt.MathNode("mover",[Ti(e.base,t),r]);return i.setAttribute("accent","true"),i},"mathmlBuilder$9"),y9e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));Bt({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:o((e,t)=>{var r=tk(t[0]),i=!y9e.test(e.funcName),n=!i||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:i,isShifty:n,base:r}},"handler"),htmlBuilder:mD,mathmlBuilder:sj});Bt({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:o((e,t)=>{var r=t[0],i=e.parser.mode;return i==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),i="text"),{type:"accent",mode:i,label:e.funcName,isStretchy:!1,isShifty:!0,base:r}},"handler"),htmlBuilder:mD,mathmlBuilder:sj});Bt({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:o((e,t)=>{var{parser:r,funcName:i}=e,n=t[0];return{type:"accentUnder",mode:r.mode,label:i,base:n}},"handler"),htmlBuilder:o((e,t)=>{var r=Yr(e.base,t),i=Tu.svgSpan(e,t),n=e.label==="\\utilde"?.12:0,a=Ke.makeVList({positionType:"top",positionData:r.height,children:[{type:"elem",elem:i,wrapperClasses:["svg-align"]},{type:"kern",size:n},{type:"elem",elem:r}]},t);return Ke.makeSpan(["mord","accentunder"],[a],t)},"htmlBuilder"),mathmlBuilder:o((e,t)=>{var r=Tu.mathMLnode(e.label),i=new Dt.MathNode("munder",[Ti(e.base,t),r]);return i.setAttribute("accentunder","true"),i},"mathmlBuilder")});HC=o(e=>{var t=new Dt.MathNode("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t},"paddedNode");Bt({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:i,funcName:n}=e;return{type:"xArrow",mode:i.mode,label:n,body:t[0],below:r[0]}},htmlBuilder(e,t){var r=t.style,i=t.havingStyle(r.sup()),n=Ke.wrapFragment(Yr(e.body,i,t),t),a=e.label.slice(0,2)==="\\x"?"x":"cd";n.classes.push(a+"-arrow-pad");var s;e.below&&(i=t.havingStyle(r.sub()),s=Ke.wrapFragment(Yr(e.below,i,t),t),s.classes.push(a+"-arrow-pad"));var l=Tu.svgSpan(e,t),u=-t.fontMetrics().axisHeight+.5*l.height,h=-t.fontMetrics().axisHeight-.5*l.height-.111;(n.depth>.25||e.label==="\\xleftequilibrium")&&(h-=n.depth);var d;if(s){var f=-t.fontMetrics().axisHeight+s.height+.5*l.height+.111;d=Ke.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:h},{type:"elem",elem:l,shift:u},{type:"elem",elem:s,shift:f}]},t)}else d=Ke.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:h},{type:"elem",elem:l,shift:u}]},t);return d.children[0].children[0].children[1].classes.push("svg-align"),Ke.makeSpan(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var r=Tu.mathMLnode(e.label);r.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var i;if(e.body){var n=HC(Ti(e.body,t));if(e.below){var a=HC(Ti(e.below,t));i=new Dt.MathNode("munderover",[r,a,n])}else i=new Dt.MathNode("mover",[r,n])}else if(e.below){var s=HC(Ti(e.below,t));i=new Dt.MathNode("munder",[r,s])}else i=HC(),i=new Dt.MathNode("mover",[r,i]);return i}});v9e=Ke.makeSpan;o(oj,"htmlBuilder$9");o(lj,"mathmlBuilder$8");Bt({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:r,funcName:i}=e,n=t[0];return{type:"mclass",mode:r.mode,mclass:"m"+i.slice(5),body:gn(n),isCharacterBox:Zr.isCharacterBox(n)}},htmlBuilder:oj,mathmlBuilder:lj});ok=o(e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"},"binrelClass");Bt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:r}=e;return{type:"mclass",mode:r.mode,mclass:ok(t[0]),body:gn(t[1]),isCharacterBox:Zr.isCharacterBox(t[1])}}});Bt({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:r,funcName:i}=e,n=t[1],a=t[0],s;i!=="\\stackrel"?s=ok(n):s="mrel";var l={type:"op",mode:n.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:i!=="\\stackrel",body:gn(n)},u={type:"supsub",mode:a.mode,base:l,sup:i==="\\underset"?null:a,sub:i==="\\underset"?a:null};return{type:"mclass",mode:r.mode,mclass:s,body:[u],isCharacterBox:Zr.isCharacterBox(u)}},htmlBuilder:oj,mathmlBuilder:lj});Bt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"pmb",mode:r.mode,mclass:ok(t[0]),body:gn(t[0])}},htmlBuilder(e,t){var r=Fn(e.body,t,!0),i=Ke.makeSpan([e.mclass],r,t);return i.style.textShadow="0.02em 0.01em 0.04px",i},mathmlBuilder(e,t){var r=Cs(e.body,t),i=new Dt.MathNode("mstyle",r);return i.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),i}});x9e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},CY=o(()=>({type:"styling",body:[],mode:"math",style:"display"}),"newCell"),kY=o(e=>e.type==="textord"&&e.text==="@","isStartOfArrow"),b9e=o((e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t,"isLabelEnd");o(T9e,"cdArrow");o(C9e,"parseCD");Bt({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:i}=e;return{type:"cdlabel",mode:r.mode,side:i.slice(4),label:t[0]}},htmlBuilder(e,t){var r=t.havingStyle(t.style.sup()),i=Ke.wrapFragment(Yr(e.label,r,t),t);return i.classes.push("cd-label-"+e.side),i.style.bottom=It(.8-i.depth),i.height=0,i.depth=0,i},mathmlBuilder(e,t){var r=new Dt.MathNode("mrow",[Ti(e.label,t)]);return r=new Dt.MathNode("mpadded",[r]),r.setAttribute("width","0"),e.side==="left"&&r.setAttribute("lspace","-1width"),r.setAttribute("voffset","0.7em"),r=new Dt.MathNode("mstyle",[r]),r.setAttribute("displaystyle","false"),r.setAttribute("scriptlevel","1"),r}});Bt({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:r}=e;return{type:"cdlabelparent",mode:r.mode,fragment:t[0]}},htmlBuilder(e,t){var r=Ke.wrapFragment(Yr(e.fragment,t),t);return r.classes.push("cd-vert-arrow"),r},mathmlBuilder(e,t){return new Dt.MathNode("mrow",[Ti(e.fragment,t)])}});Bt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:r}=e,i=Nr(t[0],"ordgroup"),n=i.body,a="",s=0;s=1114111)throw new Lt("\\@char with invalid code point "+a);return u<=65535?h=String.fromCharCode(u):(u-=65536,h=String.fromCharCode((u>>10)+55296,(u&1023)+56320)),{type:"textord",mode:r.mode,text:h}}});cj=o((e,t)=>{var r=Fn(e.body,t.withColor(e.color),!1);return Ke.makeFragment(r)},"htmlBuilder$8"),uj=o((e,t)=>{var r=Cs(e.body,t.withColor(e.color)),i=new Dt.MathNode("mstyle",r);return i.setAttribute("mathcolor",e.color),i},"mathmlBuilder$7");Bt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:r}=e,i=Nr(t[0],"color-token").color,n=t[1];return{type:"color",mode:r.mode,color:i,body:gn(n)}},htmlBuilder:cj,mathmlBuilder:uj});Bt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:r,breakOnTokenText:i}=e,n=Nr(t[0],"color-token").color;r.gullet.macros.set("\\current@color",n);var a=r.parseExpression(!0,i);return{type:"color",mode:r.mode,color:n,body:a}},htmlBuilder:cj,mathmlBuilder:uj});Bt({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,r){var{parser:i}=e,n=i.gullet.future().text==="["?i.parseSizeGroup(!0):null,a=!i.settings.displayMode||!i.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:i.mode,newLine:a,size:n&&Nr(n,"size").value}},htmlBuilder(e,t){var r=Ke.makeSpan(["mspace"],[],t);return e.newLine&&(r.classes.push("newline"),e.size&&(r.style.marginTop=It(Qi(e.size,t)))),r},mathmlBuilder(e,t){var r=new Dt.MathNode("mspace");return e.newLine&&(r.setAttribute("linebreak","newline"),e.size&&r.setAttribute("height",It(Qi(e.size,t)))),r}});nD={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},hj=o(e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Lt("Expected a control sequence",e);return t},"checkControlSequence"),k9e=o(e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},"getRHS"),dj=o((e,t,r,i)=>{var n=e.gullet.macros.get(r.text);n==null&&(r.noexpand=!0,n={tokens:[r],numArgs:0,unexpandable:!e.gullet.isExpandable(r.text)}),e.gullet.macros.set(t,n,i)},"letCommand");Bt({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:r}=e;t.consumeSpaces();var i=t.fetch();if(nD[i.text])return(r==="\\global"||r==="\\\\globallong")&&(i.text=nD[i.text]),Nr(t.parseFunction(),"internal");throw new Lt("Invalid token after macro prefix",i)}});Bt({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,i=t.gullet.popToken(),n=i.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(n))throw new Lt("Expected a control sequence",i);for(var a=0,s,l=[[]];t.gullet.future().text!=="{";)if(i=t.gullet.popToken(),i.text==="#"){if(t.gullet.future().text==="{"){s=t.gullet.future(),l[a].push("{");break}if(i=t.gullet.popToken(),!/^[1-9]$/.test(i.text))throw new Lt('Invalid argument number "'+i.text+'"');if(parseInt(i.text)!==a+1)throw new Lt('Argument number "'+i.text+'" out of order');a++,l.push([])}else{if(i.text==="EOF")throw new Lt("Expected a macro definition");l[a].push(i.text)}var{tokens:u}=t.gullet.consumeArg();return s&&u.unshift(s),(r==="\\edef"||r==="\\xdef")&&(u=t.gullet.expandTokens(u),u.reverse()),t.gullet.macros.set(n,{tokens:u,numArgs:a,delimiters:l},r===nD[r]),{type:"internal",mode:t.mode}}});Bt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,i=hj(t.gullet.popToken());t.gullet.consumeSpaces();var n=k9e(t);return dj(t,i,n,r==="\\\\globallet"),{type:"internal",mode:t.mode}}});Bt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:r}=e,i=hj(t.gullet.popToken()),n=t.gullet.popToken(),a=t.gullet.popToken();return dj(t,i,a,r==="\\\\globalfuture"),t.gullet.pushToken(a),t.gullet.pushToken(n),{type:"internal",mode:t.mode}}});fv=o(function(t,r,i){var n=_i.math[t]&&_i.math[t].replace,a=uD(n||t,r,i);if(!a)throw new Error("Unsupported symbol "+t+" and font size "+r+".");return a},"getMetrics"),gD=o(function(t,r,i,n){var a=i.havingBaseStyle(r),s=Ke.makeSpan(n.concat(a.sizingClasses(i)),[t],i),l=a.sizeMultiplier/i.sizeMultiplier;return s.height*=l,s.depth*=l,s.maxFontSize=a.sizeMultiplier,s},"styleWrap"),fj=o(function(t,r,i){var n=r.havingBaseStyle(i),a=(1-r.sizeMultiplier/n.sizeMultiplier)*r.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=It(a),t.height-=a,t.depth+=a},"centerSpan"),w9e=o(function(t,r,i,n,a,s){var l=Ke.makeSymbol(t,"Main-Regular",a,n),u=gD(l,r,n,s);return i&&fj(u,n,r),u},"makeSmallDelim"),S9e=o(function(t,r,i,n){return Ke.makeSymbol(t,"Size"+r+"-Regular",i,n)},"mathrmSize"),pj=o(function(t,r,i,n,a,s){var l=S9e(t,r,a,n),u=gD(Ke.makeSpan(["delimsizing","size"+r],[l],n),ur.TEXT,n,s);return i&&fj(u,n,ur.TEXT),u},"makeLargeDelim"),V7=o(function(t,r,i){var n;r==="Size1-Regular"?n="delim-size1":n="delim-size4";var a=Ke.makeSpan(["delimsizinginner",n],[Ke.makeSpan([],[Ke.makeSymbol(t,r,i)])]);return{type:"elem",elem:a}},"makeGlyphSpan"),W7=o(function(t,r,i){var n=nc["Size4-Regular"][t.charCodeAt(0)]?nc["Size4-Regular"][t.charCodeAt(0)][4]:nc["Size1-Regular"][t.charCodeAt(0)][4],a=new ac("inner",NIe(t,Math.round(1e3*r))),s=new ml([a],{width:It(n),height:It(r),style:"width:"+It(n),viewBox:"0 0 "+1e3*n+" "+Math.round(1e3*r),preserveAspectRatio:"xMinYMin"}),l=Ke.makeSvgSpan([],[s],i);return l.height=r,l.style.height=It(r),l.style.width=It(n),{type:"elem",elem:l}},"makeInner"),aD=.008,YC={type:"kern",size:-1*aD},E9e=["|","\\lvert","\\rvert","\\vert"],A9e=["\\|","\\lVert","\\rVert","\\Vert"],mj=o(function(t,r,i,n,a,s){var l,u,h,d,f="",p=0;l=h=d=t,u=null;var m="Size1-Regular";t==="\\uparrow"?h=d="\u23D0":t==="\\Uparrow"?h=d="\u2016":t==="\\downarrow"?l=h="\u23D0":t==="\\Downarrow"?l=h="\u2016":t==="\\updownarrow"?(l="\\uparrow",h="\u23D0",d="\\downarrow"):t==="\\Updownarrow"?(l="\\Uparrow",h="\u2016",d="\\Downarrow"):E9e.includes(t)?(h="\u2223",f="vert",p=333):A9e.includes(t)?(h="\u2225",f="doublevert",p=556):t==="["||t==="\\lbrack"?(l="\u23A1",h="\u23A2",d="\u23A3",m="Size4-Regular",f="lbrack",p=667):t==="]"||t==="\\rbrack"?(l="\u23A4",h="\u23A5",d="\u23A6",m="Size4-Regular",f="rbrack",p=667):t==="\\lfloor"||t==="\u230A"?(h=l="\u23A2",d="\u23A3",m="Size4-Regular",f="lfloor",p=667):t==="\\lceil"||t==="\u2308"?(l="\u23A1",h=d="\u23A2",m="Size4-Regular",f="lceil",p=667):t==="\\rfloor"||t==="\u230B"?(h=l="\u23A5",d="\u23A6",m="Size4-Regular",f="rfloor",p=667):t==="\\rceil"||t==="\u2309"?(l="\u23A4",h=d="\u23A5",m="Size4-Regular",f="rceil",p=667):t==="("||t==="\\lparen"?(l="\u239B",h="\u239C",d="\u239D",m="Size4-Regular",f="lparen",p=875):t===")"||t==="\\rparen"?(l="\u239E",h="\u239F",d="\u23A0",m="Size4-Regular",f="rparen",p=875):t==="\\{"||t==="\\lbrace"?(l="\u23A7",u="\u23A8",d="\u23A9",h="\u23AA",m="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(l="\u23AB",u="\u23AC",d="\u23AD",h="\u23AA",m="Size4-Regular"):t==="\\lgroup"||t==="\u27EE"?(l="\u23A7",d="\u23A9",h="\u23AA",m="Size4-Regular"):t==="\\rgroup"||t==="\u27EF"?(l="\u23AB",d="\u23AD",h="\u23AA",m="Size4-Regular"):t==="\\lmoustache"||t==="\u23B0"?(l="\u23A7",d="\u23AD",h="\u23AA",m="Size4-Regular"):(t==="\\rmoustache"||t==="\u23B1")&&(l="\u23AB",d="\u23A9",h="\u23AA",m="Size4-Regular");var g=fv(l,m,a),y=g.height+g.depth,v=fv(h,m,a),x=v.height+v.depth,b=fv(d,m,a),T=b.height+b.depth,w=0,C=1;if(u!==null){var k=fv(u,m,a);w=k.height+k.depth,C=2}var E=y+T+w,A=Math.max(0,Math.ceil((r-E)/(C*x))),N=E+A*C*x,P=n.fontMetrics().axisHeight;i&&(P*=n.sizeMultiplier);var I=N/2-P,D=[];if(f.length>0){var _=N-y-T,R=Math.round(N*1e3),M=IIe(f,Math.round(_*1e3)),L=new ac(f,M),B=(p/1e3).toFixed(3)+"em",O=(R/1e3).toFixed(3)+"em",$=new ml([L],{width:B,height:O,viewBox:"0 0 "+p+" "+R}),G=Ke.makeSvgSpan([],[$],n);G.height=R/1e3,G.style.width=B,G.style.height=O,D.push({type:"elem",elem:G})}else{if(D.push(V7(d,m,a)),D.push(YC),u===null){var F=N-y-T+2*aD;D.push(W7(h,F,n))}else{var V=(N-y-T-w)/2+2*aD;D.push(W7(h,V,n)),D.push(YC),D.push(V7(u,m,a)),D.push(YC),D.push(W7(h,V,n))}D.push(YC),D.push(V7(l,m,a))}var H=n.havingBaseStyle(ur.TEXT),j=Ke.makeVList({positionType:"bottom",positionData:I,children:D},H);return gD(Ke.makeSpan(["delimsizing","mult"],[j],H),ur.TEXT,n,s)},"makeStackedDelim"),q7=80,U7=.08,H7=o(function(t,r,i,n,a){var s=MIe(t,n,i),l=new ac(t,s),u=new ml([l],{width:"400em",height:It(r),viewBox:"0 0 400000 "+i,preserveAspectRatio:"xMinYMin slice"});return Ke.makeSvgSpan(["hide-tail"],[u],a)},"sqrtSvg"),_9e=o(function(t,r){var i=r.havingBaseSizing(),n=xj("\\surd",t*i.sizeMultiplier,vj,i),a=i.sizeMultiplier,s=Math.max(0,r.minRuleThickness-r.fontMetrics().sqrtRuleThickness),l,u=0,h=0,d=0,f;return n.type==="small"?(d=1e3+1e3*s+q7,t<1?a=1:t<1.4&&(a=.7),u=(1+s+U7)/a,h=(1+s)/a,l=H7("sqrtMain",u,d,s,r),l.style.minWidth="0.853em",f=.833/a):n.type==="large"?(d=(1e3+q7)*mv[n.size],h=(mv[n.size]+s)/a,u=(mv[n.size]+s+U7)/a,l=H7("sqrtSize"+n.size,u,d,s,r),l.style.minWidth="1.02em",f=1/a):(u=t+s+U7,h=t+s,d=Math.floor(1e3*t+s)+q7,l=H7("sqrtTall",u,d,s,r),l.style.minWidth="0.742em",f=1.056),l.height=h,l.style.height=It(u),{span:l,advanceWidth:f,ruleWidth:(r.fontMetrics().sqrtRuleThickness+s)*a}},"makeSqrtImage"),gj=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","\\surd"],D9e=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1"],yj=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],mv=[0,1.2,1.8,2.4,3],R9e=o(function(t,r,i,n,a){if(t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle"),gj.includes(t)||yj.includes(t))return pj(t,r,!1,i,n,a);if(D9e.includes(t))return mj(t,mv[r],!1,i,n,a);throw new Lt("Illegal delimiter: '"+t+"'")},"makeSizedDelim"),L9e=[{type:"small",style:ur.SCRIPTSCRIPT},{type:"small",style:ur.SCRIPT},{type:"small",style:ur.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],M9e=[{type:"small",style:ur.SCRIPTSCRIPT},{type:"small",style:ur.SCRIPT},{type:"small",style:ur.TEXT},{type:"stack"}],vj=[{type:"small",style:ur.SCRIPTSCRIPT},{type:"small",style:ur.SCRIPT},{type:"small",style:ur.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],N9e=o(function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},"delimTypeToFont"),xj=o(function(t,r,i,n){for(var a=Math.min(2,3-n.style.size),s=a;sr)return i[s]}return i[i.length-1]},"traverseSequence"),bj=o(function(t,r,i,n,a,s){t==="<"||t==="\\lt"||t==="\u27E8"?t="\\langle":(t===">"||t==="\\gt"||t==="\u27E9")&&(t="\\rangle");var l;yj.includes(t)?l=L9e:gj.includes(t)?l=vj:l=M9e;var u=xj(t,r,l,n);return u.type==="small"?w9e(t,u.style,i,n,a,s):u.type==="large"?pj(t,u.size,i,n,a,s):mj(t,r,i,n,a,s)},"makeCustomSizedDelim"),I9e=o(function(t,r,i,n,a,s){var l=n.fontMetrics().axisHeight*n.sizeMultiplier,u=901,h=5/n.fontMetrics().ptPerEm,d=Math.max(r-l,i+l),f=Math.max(d/500*u,2*d-h);return bj(t,f,!0,n,a,s)},"makeLeftRightDelim"),xu={sqrtImage:_9e,sizedDelim:R9e,sizeToMaxHeight:mv,customSizedDelim:bj,leftRightDelim:I9e},wY={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},O9e=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230A","\u230B","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27E8","\\rangle","\u27E9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27EE","\u27EF","\\lmoustache","\\rmoustache","\u23B0","\u23B1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];o(lk,"checkDelimiter");Bt({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:o((e,t)=>{var r=lk(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:wY[e.funcName].size,mclass:wY[e.funcName].mclass,delim:r.text}},"handler"),htmlBuilder:o((e,t)=>e.delim==="."?Ke.makeSpan([e.mclass]):xu.sizedDelim(e.delim,e.size,t,e.mode,[e.mclass]),"htmlBuilder"),mathmlBuilder:o(e=>{var t=[];e.delim!=="."&&t.push(No(e.delim,e.mode));var r=new Dt.MathNode("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r.setAttribute("stretchy","true");var i=It(xu.sizeToMaxHeight[e.size]);return r.setAttribute("minsize",i),r.setAttribute("maxsize",i),r},"mathmlBuilder")});o(SY,"assertParsed");Bt({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:o((e,t)=>{var r=e.parser.gullet.macros.get("\\current@color");if(r&&typeof r!="string")throw new Lt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:lk(t[0],e).text,color:r}},"handler")});Bt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:o((e,t)=>{var r=lk(t[0],e),i=e.parser;++i.leftrightDepth;var n=i.parseExpression(!1);--i.leftrightDepth,i.expect("\\right",!1);var a=Nr(i.parseFunction(),"leftright-right");return{type:"leftright",mode:i.mode,body:n,left:r.text,right:a.delim,rightColor:a.color}},"handler"),htmlBuilder:o((e,t)=>{SY(e);for(var r=Fn(e.body,t,!0,["mopen","mclose"]),i=0,n=0,a=!1,s=0;s{SY(e);var r=Cs(e.body,t);if(e.left!=="."){var i=new Dt.MathNode("mo",[No(e.left,e.mode)]);i.setAttribute("fence","true"),r.unshift(i)}if(e.right!=="."){var n=new Dt.MathNode("mo",[No(e.right,e.mode)]);n.setAttribute("fence","true"),e.rightColor&&n.setAttribute("mathcolor",e.rightColor),r.push(n)}return dD(r)},"mathmlBuilder")});Bt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:o((e,t)=>{var r=lk(t[0],e);if(!e.parser.leftrightDepth)throw new Lt("\\middle without preceding \\left",r);return{type:"middle",mode:e.parser.mode,delim:r.text}},"handler"),htmlBuilder:o((e,t)=>{var r;if(e.delim===".")r=bv(t,[]);else{r=xu.sizedDelim(e.delim,1,t,e.mode,[]);var i={delim:e.delim,options:t};r.isMiddle=i}return r},"htmlBuilder"),mathmlBuilder:o((e,t)=>{var r=e.delim==="\\vert"||e.delim==="|"?No("|","text"):No(e.delim,e.mode),i=new Dt.MathNode("mo",[r]);return i.setAttribute("fence","true"),i.setAttribute("lspace","0.05em"),i.setAttribute("rspace","0.05em"),i},"mathmlBuilder")});yD=o((e,t)=>{var r=Ke.wrapFragment(Yr(e.body,t),t),i=e.label.slice(1),n=t.sizeMultiplier,a,s=0,l=Zr.isCharacterBox(e.body);if(i==="sout")a=Ke.makeSpan(["stretchy","sout"]),a.height=t.fontMetrics().defaultRuleThickness/n,s=-.5*t.fontMetrics().xHeight;else if(i==="phase"){var u=Qi({number:.6,unit:"pt"},t),h=Qi({number:.35,unit:"ex"},t),d=t.havingBaseSizing();n=n/d.sizeMultiplier;var f=r.height+r.depth+u+h;r.style.paddingLeft=It(f/2+u);var p=Math.floor(1e3*f*n),m=RIe(p),g=new ml([new ac("phase",m)],{width:"400em",height:It(p/1e3),viewBox:"0 0 400000 "+p,preserveAspectRatio:"xMinYMin slice"});a=Ke.makeSvgSpan(["hide-tail"],[g],t),a.style.height=It(f),s=r.depth+u+h}else{/cancel/.test(i)?l||r.classes.push("cancel-pad"):i==="angl"?r.classes.push("anglpad"):r.classes.push("boxpad");var y=0,v=0,x=0;/box/.test(i)?(x=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=t.fontMetrics().fboxsep+(i==="colorbox"?0:x),v=y):i==="angl"?(x=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),y=4*x,v=Math.max(0,.25-r.depth)):(y=l?.2:0,v=y),a=Tu.encloseSpan(r,i,y,v,t),/fbox|boxed|fcolorbox/.test(i)?(a.style.borderStyle="solid",a.style.borderWidth=It(x)):i==="angl"&&x!==.049&&(a.style.borderTopWidth=It(x),a.style.borderRightWidth=It(x)),s=r.depth+v,e.backgroundColor&&(a.style.backgroundColor=e.backgroundColor,e.borderColor&&(a.style.borderColor=e.borderColor))}var b;if(e.backgroundColor)b=Ke.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:s},{type:"elem",elem:r,shift:0}]},t);else{var T=/cancel|phase/.test(i)?["svg-align"]:[];b=Ke.makeVList({positionType:"individualShift",children:[{type:"elem",elem:r,shift:0},{type:"elem",elem:a,shift:s,wrapperClasses:T}]},t)}return/cancel/.test(i)&&(b.height=r.height,b.depth=r.depth),/cancel/.test(i)&&!l?Ke.makeSpan(["mord","cancel-lap"],[b],t):Ke.makeSpan(["mord"],[b],t)},"htmlBuilder$7"),vD=o((e,t)=>{var r=0,i=new Dt.MathNode(e.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Ti(e.body,t)]);switch(e.label){case"\\cancel":i.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":i.setAttribute("notation","downdiagonalstrike");break;case"\\phase":i.setAttribute("notation","phasorangle");break;case"\\sout":i.setAttribute("notation","horizontalstrike");break;case"\\fbox":i.setAttribute("notation","box");break;case"\\angl":i.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(r=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,i.setAttribute("width","+"+2*r+"pt"),i.setAttribute("height","+"+2*r+"pt"),i.setAttribute("lspace",r+"pt"),i.setAttribute("voffset",r+"pt"),e.label==="\\fcolorbox"){var n=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);i.setAttribute("style","border: "+n+"em solid "+String(e.borderColor))}break;case"\\xcancel":i.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&i.setAttribute("mathbackground",e.backgroundColor),i},"mathmlBuilder$6");Bt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(e,t,r){var{parser:i,funcName:n}=e,a=Nr(t[0],"color-token").color,s=t[1];return{type:"enclose",mode:i.mode,label:n,backgroundColor:a,body:s}},htmlBuilder:yD,mathmlBuilder:vD});Bt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(e,t,r){var{parser:i,funcName:n}=e,a=Nr(t[0],"color-token").color,s=Nr(t[1],"color-token").color,l=t[2];return{type:"enclose",mode:i.mode,label:n,backgroundColor:s,borderColor:a,body:l}},htmlBuilder:yD,mathmlBuilder:vD});Bt({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\fbox",body:t[0]}}});Bt({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:i}=e,n=t[0];return{type:"enclose",mode:r.mode,label:i,body:n}},htmlBuilder:yD,mathmlBuilder:vD});Bt({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"enclose",mode:r.mode,label:"\\angl",body:t[0]}}});Tj={};o(sc,"defineEnvironment");Cj={};o(he,"defineMacro");o(EY,"getHLines");ck=o(e=>{var t=e.parser.settings;if(!t.displayMode)throw new Lt("{"+e.envName+"} can be used only in display mode.")},"validateAmsEnvironmentContext");o(xD,"getAutoTag");o(Gh,"parseArray");o(bD,"dCellStyle");oc=o(function(t,r){var i,n,a=t.body.length,s=t.hLinesBeforeRow,l=0,u=new Array(a),h=[],d=Math.max(r.fontMetrics().arrayRuleWidth,r.minRuleThickness),f=1/r.fontMetrics().ptPerEm,p=5*f;if(t.colSeparationType&&t.colSeparationType==="small"){var m=r.havingStyle(ur.SCRIPT).sizeMultiplier;p=.2778*(m/r.sizeMultiplier)}var g=t.colSeparationType==="CD"?Qi({number:3,unit:"ex"},r):12*f,y=3*f,v=t.arraystretch*g,x=.7*v,b=.3*v,T=0;function w(we){for(var Me=0;Me0&&(T+=.25),h.push({pos:T,isDashed:we[Me]})}for(o(w,"setHLinePos"),w(s[0]),i=0;i0&&(I+=b,Ewe))for(i=0;i=l)){var Y=void 0;(n>0||t.hskipBeforeAndAfter)&&(Y=Zr.deflt(V.pregap,p),Y!==0&&(M=Ke.makeSpan(["arraycolsep"],[]),M.style.width=It(Y),R.push(M)));var ae=[];for(i=0;i0){for(var ee=Ke.makeLineSpan("hline",r,d),Te=Ke.makeLineSpan("hdashline",r,d),ue=[{type:"elem",elem:u,shift:0}];h.length>0;){var De=h.pop(),Ie=De.pos-D;De.isDashed?ue.push({type:"elem",elem:Te,shift:Ie}):ue.push({type:"elem",elem:ee,shift:Ie})}u=Ke.makeVList({positionType:"individualShift",children:ue},r)}if(B.length===0)return Ke.makeSpan(["mord"],[u],r);var Ee=Ke.makeVList({positionType:"individualShift",children:B},r);return Ee=Ke.makeSpan(["tag"],[Ee],r),Ke.makeFragment([u,Ee])},"htmlBuilder"),P9e={c:"center ",l:"left ",r:"right "},lc=o(function(t,r){for(var i=[],n=new Dt.MathNode("mtd",[],["mtr-glue"]),a=new Dt.MathNode("mtd",[],["mml-eqn-num"]),s=0;s0){var g=t.cols,y="",v=!1,x=0,b=g.length;g[0].type==="separator"&&(p+="top ",x=1),g[g.length-1].type==="separator"&&(p+="bottom ",b-=1);for(var T=x;T0?"left ":"",p+=A[A.length-1].length>0?"right ":"";for(var N=1;N-1?"alignat":"align",a=t.envName==="split",s=Gh(t.parser,{cols:i,addJot:!0,autoTag:a?void 0:xD(t.envName),emptySingleRow:!0,colSeparationType:n,maxNumCols:a?2:void 0,leqno:t.parser.settings.leqno},"display"),l,u=0,h={type:"ordgroup",mode:t.mode,body:[]};if(r[0]&&r[0].type==="ordgroup"){for(var d="",f=0;f0&&m&&(v=1),i[g]={type:"align",align:y,pregap:v,postgap:0}}return s.colSeparationType=m?"align":"alignat",s},"alignedHandler");sc({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var r=sk(t[0]),i=r?[t[0]]:Nr(t[0],"ordgroup").body,n=i.map(function(s){var l=pD(s),u=l.text;if("lcr".indexOf(u)!==-1)return{type:"align",align:u};if(u==="|")return{type:"separator",separator:"|"};if(u===":")return{type:"separator",separator:":"};throw new Lt("Unknown column alignment: "+u,s)}),a={cols:n,hskipBeforeAndAfter:!0,maxNumCols:n.length};return Gh(e.parser,a,bD(e.envName))},htmlBuilder:oc,mathmlBuilder:lc});sc({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],r="c",i={hskipBeforeAndAfter:!1,cols:[{type:"align",align:r}]};if(e.envName.charAt(e.envName.length-1)==="*"){var n=e.parser;if(n.consumeSpaces(),n.fetch().text==="["){if(n.consume(),n.consumeSpaces(),r=n.fetch().text,"lcr".indexOf(r)===-1)throw new Lt("Expected l or c or r",n.nextToken);n.consume(),n.consumeSpaces(),n.expect("]"),n.consume(),i.cols=[{type:"align",align:r}]}}var a=Gh(e.parser,i,bD(e.envName)),s=Math.max(0,...a.body.map(l=>l.length));return a.cols=new Array(s).fill({type:"align",align:r}),t?{type:"leftright",mode:e.mode,body:[a],left:t[0],right:t[1],rightColor:void 0}:a},htmlBuilder:oc,mathmlBuilder:lc});sc({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},r=Gh(e.parser,t,"script");return r.colSeparationType="small",r},htmlBuilder:oc,mathmlBuilder:lc});sc({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var r=sk(t[0]),i=r?[t[0]]:Nr(t[0],"ordgroup").body,n=i.map(function(s){var l=pD(s),u=l.text;if("lc".indexOf(u)!==-1)return{type:"align",align:u};throw new Lt("Unknown column alignment: "+u,s)});if(n.length>1)throw new Lt("{subarray} can contain only one column");var a={cols:n,hskipBeforeAndAfter:!1,arraystretch:.5};if(a=Gh(e.parser,a,"script"),a.body.length>0&&a.body[0].length>1)throw new Lt("{subarray} can contain only one column");return a},htmlBuilder:oc,mathmlBuilder:lc});sc({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},r=Gh(e.parser,t,bD(e.envName));return{type:"leftright",mode:e.mode,body:[r],left:e.envName.indexOf("r")>-1?".":"\\{",right:e.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:oc,mathmlBuilder:lc});sc({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:kj,htmlBuilder:oc,mathmlBuilder:lc});sc({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){["gather","gather*"].includes(e.envName)&&ck(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:xD(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Gh(e.parser,t,"display")},htmlBuilder:oc,mathmlBuilder:lc});sc({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:kj,htmlBuilder:oc,mathmlBuilder:lc});sc({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){ck(e);var t={autoTag:xD(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Gh(e.parser,t,"display")},htmlBuilder:oc,mathmlBuilder:lc});sc({type:"array",names:["CD"],props:{numArgs:0},handler(e){return ck(e),C9e(e.parser)},htmlBuilder:oc,mathmlBuilder:lc});he("\\nonumber","\\gdef\\@eqnsw{0}");he("\\notag","\\nonumber");Bt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Lt(e.funcName+" valid only within array environment")}});AY=Tj;Bt({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:r,funcName:i}=e,n=t[0];if(n.type!=="ordgroup")throw new Lt("Invalid environment name",n);for(var a="",s=0;s{var r=e.font,i=t.withFont(r);return Yr(e.body,i)},"htmlBuilder$5"),Sj=o((e,t)=>{var r=e.font,i=t.withFont(r);return Ti(e.body,i)},"mathmlBuilder$4"),_Y={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Bt({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:o((e,t)=>{var{parser:r,funcName:i}=e,n=tk(t[0]),a=i;return a in _Y&&(a=_Y[a]),{type:"font",mode:r.mode,font:a.slice(1),body:n}},"handler"),htmlBuilder:wj,mathmlBuilder:Sj});Bt({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:o((e,t)=>{var{parser:r}=e,i=t[0],n=Zr.isCharacterBox(i);return{type:"mclass",mode:r.mode,mclass:ok(i),body:[{type:"font",mode:r.mode,font:"boldsymbol",body:i}],isCharacterBox:n}},"handler")});Bt({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:o((e,t)=>{var{parser:r,funcName:i,breakOnTokenText:n}=e,{mode:a}=r,s=r.parseExpression(!0,n),l="math"+i.slice(1);return{type:"font",mode:a,font:l,body:{type:"ordgroup",mode:r.mode,body:s}}},"handler"),htmlBuilder:wj,mathmlBuilder:Sj});Ej=o((e,t)=>{var r=t;return e==="display"?r=r.id>=ur.SCRIPT.id?r.text():ur.DISPLAY:e==="text"&&r.size===ur.DISPLAY.size?r=ur.TEXT:e==="script"?r=ur.SCRIPT:e==="scriptscript"&&(r=ur.SCRIPTSCRIPT),r},"adjustStyle"),TD=o((e,t)=>{var r=Ej(e.size,t.style),i=r.fracNum(),n=r.fracDen(),a;a=t.havingStyle(i);var s=Yr(e.numer,a,t);if(e.continued){var l=8.5/t.fontMetrics().ptPerEm,u=3.5/t.fontMetrics().ptPerEm;s.height=s.height0?g=3*p:g=7*p,y=t.fontMetrics().denom1):(f>0?(m=t.fontMetrics().num2,g=p):(m=t.fontMetrics().num3,g=3*p),y=t.fontMetrics().denom2);var v;if(d){var b=t.fontMetrics().axisHeight;m-s.depth-(b+.5*f){var r=new Dt.MathNode("mfrac",[Ti(e.numer,t),Ti(e.denom,t)]);if(!e.hasBarLine)r.setAttribute("linethickness","0px");else if(e.barSize){var i=Qi(e.barSize,t);r.setAttribute("linethickness",It(i))}var n=Ej(e.size,t.style);if(n.size!==t.style.size){r=new Dt.MathNode("mstyle",[r]);var a=n.size===ur.DISPLAY.size?"true":"false";r.setAttribute("displaystyle",a),r.setAttribute("scriptlevel","0")}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var l=new Dt.MathNode("mo",[new Dt.TextNode(e.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),s.push(l)}if(s.push(r),e.rightDelim!=null){var u=new Dt.MathNode("mo",[new Dt.TextNode(e.rightDelim.replace("\\",""))]);u.setAttribute("fence","true"),s.push(u)}return dD(s)}return r},"mathmlBuilder$3");Bt({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:o((e,t)=>{var{parser:r,funcName:i}=e,n=t[0],a=t[1],s,l=null,u=null,h="auto";switch(i){case"\\dfrac":case"\\frac":case"\\tfrac":s=!0;break;case"\\\\atopfrac":s=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":s=!1,l="(",u=")";break;case"\\\\bracefrac":s=!1,l="\\{",u="\\}";break;case"\\\\brackfrac":s=!1,l="[",u="]";break;default:throw new Error("Unrecognized genfrac command")}switch(i){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:r.mode,continued:!1,numer:n,denom:a,hasBarLine:s,leftDelim:l,rightDelim:u,size:h,barSize:null}},"handler"),htmlBuilder:TD,mathmlBuilder:CD});Bt({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:o((e,t)=>{var{parser:r,funcName:i}=e,n=t[0],a=t[1];return{type:"genfrac",mode:r.mode,continued:!0,numer:n,denom:a,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}},"handler")});Bt({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:r,token:i}=e,n;switch(r){case"\\over":n="\\frac";break;case"\\choose":n="\\binom";break;case"\\atop":n="\\\\atopfrac";break;case"\\brace":n="\\\\bracefrac";break;case"\\brack":n="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:n,token:i}}});DY=["display","text","script","scriptscript"],RY=o(function(t){var r=null;return t.length>0&&(r=t,r=r==="."?null:r),r},"delimFromValue");Bt({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:r}=e,i=t[4],n=t[5],a=tk(t[0]),s=a.type==="atom"&&a.family==="open"?RY(a.text):null,l=tk(t[1]),u=l.type==="atom"&&l.family==="close"?RY(l.text):null,h=Nr(t[2],"size"),d,f=null;h.isBlank?d=!0:(f=h.value,d=f.number>0);var p="auto",m=t[3];if(m.type==="ordgroup"){if(m.body.length>0){var g=Nr(m.body[0],"textord");p=DY[Number(g.text)]}}else m=Nr(m,"textord"),p=DY[Number(m.text)];return{type:"genfrac",mode:r.mode,numer:i,denom:n,continued:!1,hasBarLine:d,barSize:f,leftDelim:s,rightDelim:u,size:p}},htmlBuilder:TD,mathmlBuilder:CD});Bt({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:r,funcName:i,token:n}=e;return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:Nr(t[0],"size").value,token:n}}});Bt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:o((e,t)=>{var{parser:r,funcName:i}=e,n=t[0],a=mIe(Nr(t[1],"infix").size),s=t[2],l=a.number>0;return{type:"genfrac",mode:r.mode,numer:n,denom:s,continued:!1,hasBarLine:l,barSize:a,leftDelim:null,rightDelim:null,size:"auto"}},"handler"),htmlBuilder:TD,mathmlBuilder:CD});Aj=o((e,t)=>{var r=t.style,i,n;e.type==="supsub"?(i=e.sup?Yr(e.sup,t.havingStyle(r.sup()),t):Yr(e.sub,t.havingStyle(r.sub()),t),n=Nr(e.base,"horizBrace")):n=Nr(e,"horizBrace");var a=Yr(n.base,t.havingBaseStyle(ur.DISPLAY)),s=Tu.svgSpan(n,t),l;if(n.isOver?(l=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]},t),l.children[0].children[0].children[1].classes.push("svg-align")):(l=Ke.makeVList({positionType:"bottom",positionData:a.depth+.1+s.height,children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]},t),l.children[0].children[0].children[0].classes.push("svg-align")),i){var u=Ke.makeSpan(["mord",n.isOver?"mover":"munder"],[l],t);n.isOver?l=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:u},{type:"kern",size:.2},{type:"elem",elem:i}]},t):l=Ke.makeVList({positionType:"bottom",positionData:u.depth+.2+i.height+i.depth,children:[{type:"elem",elem:i},{type:"kern",size:.2},{type:"elem",elem:u}]},t)}return Ke.makeSpan(["mord",n.isOver?"mover":"munder"],[l],t)},"htmlBuilder$3"),B9e=o((e,t)=>{var r=Tu.mathMLnode(e.label);return new Dt.MathNode(e.isOver?"mover":"munder",[Ti(e.base,t),r])},"mathmlBuilder$2");Bt({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(e,t){var{parser:r,funcName:i}=e;return{type:"horizBrace",mode:r.mode,label:i,isOver:/^\\over/.test(i),base:t[0]}},htmlBuilder:Aj,mathmlBuilder:B9e});Bt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:o((e,t)=>{var{parser:r}=e,i=t[1],n=Nr(t[0],"url").url;return r.settings.isTrusted({command:"\\href",url:n})?{type:"href",mode:r.mode,href:n,body:gn(i)}:r.formatUnsupportedCmd("\\href")},"handler"),htmlBuilder:o((e,t)=>{var r=Fn(e.body,t,!1);return Ke.makeAnchor(e.href,[],r,t)},"htmlBuilder"),mathmlBuilder:o((e,t)=>{var r=zh(e.body,t);return r instanceof Ha||(r=new Ha("mrow",[r])),r.setAttribute("href",e.href),r},"mathmlBuilder")});Bt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:o((e,t)=>{var{parser:r}=e,i=Nr(t[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:i}))return r.formatUnsupportedCmd("\\url");for(var n=[],a=0;a{var{parser:r,funcName:i,token:n}=e,a=Nr(t[0],"raw").string,s=t[1];r.settings.strict&&r.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,u={};switch(i){case"\\htmlClass":u.class=a,l={command:"\\htmlClass",class:a};break;case"\\htmlId":u.id=a,l={command:"\\htmlId",id:a};break;case"\\htmlStyle":u.style=a,l={command:"\\htmlStyle",style:a};break;case"\\htmlData":{for(var h=a.split(","),d=0;d{var r=Fn(e.body,t,!1),i=["enclosing"];e.attributes.class&&i.push(...e.attributes.class.trim().split(/\s+/));var n=Ke.makeSpan(i,r,t);for(var a in e.attributes)a!=="class"&&e.attributes.hasOwnProperty(a)&&n.setAttribute(a,e.attributes[a]);return n},"htmlBuilder"),mathmlBuilder:o((e,t)=>zh(e.body,t),"mathmlBuilder")});Bt({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:o((e,t)=>{var{parser:r}=e;return{type:"htmlmathml",mode:r.mode,html:gn(t[0]),mathml:gn(t[1])}},"handler"),htmlBuilder:o((e,t)=>{var r=Fn(e.html,t,!1);return Ke.makeFragment(r)},"htmlBuilder"),mathmlBuilder:o((e,t)=>zh(e.mathml,t),"mathmlBuilder")});Y7=o(function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!r)throw new Lt("Invalid size: '"+t+"' in \\includegraphics");var i={number:+(r[1]+r[2]),unit:r[3]};if(!HY(i))throw new Lt("Invalid unit: '"+i.unit+"' in \\includegraphics.");return i},"sizeData");Bt({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:o((e,t,r)=>{var{parser:i}=e,n={number:0,unit:"em"},a={number:.9,unit:"em"},s={number:0,unit:"em"},l="";if(r[0])for(var u=Nr(r[0],"raw").string,h=u.split(","),d=0;d{var r=Qi(e.height,t),i=0;e.totalheight.number>0&&(i=Qi(e.totalheight,t)-r);var n=0;e.width.number>0&&(n=Qi(e.width,t));var a={height:It(r+i)};n>0&&(a.width=It(n)),i>0&&(a.verticalAlign=It(-i));var s=new J7(e.src,e.alt,a);return s.height=r,s.depth=i,s},"htmlBuilder"),mathmlBuilder:o((e,t)=>{var r=new Dt.MathNode("mglyph",[]);r.setAttribute("alt",e.alt);var i=Qi(e.height,t),n=0;if(e.totalheight.number>0&&(n=Qi(e.totalheight,t)-i,r.setAttribute("valign",It(-n))),r.setAttribute("height",It(i+n)),e.width.number>0){var a=Qi(e.width,t);r.setAttribute("width",It(a))}return r.setAttribute("src",e.src),r},"mathmlBuilder")});Bt({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:i}=e,n=Nr(t[0],"size");if(r.settings.strict){var a=i[1]==="m",s=n.value.unit==="mu";a?(s||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+i+" supports only mu units, "+("not "+n.value.unit+" units")),r.mode!=="math"&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+i+" works only in math mode")):s&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+i+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:n.value}},htmlBuilder(e,t){return Ke.makeGlue(e.dimension,t)},mathmlBuilder(e,t){var r=Qi(e.dimension,t);return new Dt.SpaceNode(r)}});Bt({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:o((e,t)=>{var{parser:r,funcName:i}=e,n=t[0];return{type:"lap",mode:r.mode,alignment:i.slice(5),body:n}},"handler"),htmlBuilder:o((e,t)=>{var r;e.alignment==="clap"?(r=Ke.makeSpan([],[Yr(e.body,t)]),r=Ke.makeSpan(["inner"],[r],t)):r=Ke.makeSpan(["inner"],[Yr(e.body,t)]);var i=Ke.makeSpan(["fix"],[]),n=Ke.makeSpan([e.alignment],[r,i],t),a=Ke.makeSpan(["strut"]);return a.style.height=It(n.height+n.depth),n.depth&&(a.style.verticalAlign=It(-n.depth)),n.children.unshift(a),n=Ke.makeSpan(["thinbox"],[n],t),Ke.makeSpan(["mord","vbox"],[n],t)},"htmlBuilder"),mathmlBuilder:o((e,t)=>{var r=new Dt.MathNode("mpadded",[Ti(e.body,t)]);if(e.alignment!=="rlap"){var i=e.alignment==="llap"?"-1":"-0.5";r.setAttribute("lspace",i+"width")}return r.setAttribute("width","0px"),r},"mathmlBuilder")});Bt({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:r,parser:i}=e,n=i.mode;i.switchMode("math");var a=r==="\\("?"\\)":"$",s=i.parseExpression(!1,a);return i.expect(a),i.switchMode(n),{type:"styling",mode:i.mode,style:"text",body:s}}});Bt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Lt("Mismatched "+e.funcName)}});LY=o((e,t)=>{switch(t.style.size){case ur.DISPLAY.size:return e.display;case ur.TEXT.size:return e.text;case ur.SCRIPT.size:return e.script;case ur.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}},"chooseMathStyle");Bt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:o((e,t)=>{var{parser:r}=e;return{type:"mathchoice",mode:r.mode,display:gn(t[0]),text:gn(t[1]),script:gn(t[2]),scriptscript:gn(t[3])}},"handler"),htmlBuilder:o((e,t)=>{var r=LY(e,t),i=Fn(r,t,!1);return Ke.makeFragment(i)},"htmlBuilder"),mathmlBuilder:o((e,t)=>{var r=LY(e,t);return zh(r,t)},"mathmlBuilder")});_j=o((e,t,r,i,n,a,s)=>{e=Ke.makeSpan([],[e]);var l=r&&Zr.isCharacterBox(r),u,h;if(t){var d=Yr(t,i.havingStyle(n.sup()),i);h={elem:d,kern:Math.max(i.fontMetrics().bigOpSpacing1,i.fontMetrics().bigOpSpacing3-d.depth)}}if(r){var f=Yr(r,i.havingStyle(n.sub()),i);u={elem:f,kern:Math.max(i.fontMetrics().bigOpSpacing2,i.fontMetrics().bigOpSpacing4-f.height)}}var p;if(h&&u){var m=i.fontMetrics().bigOpSpacing5+u.elem.height+u.elem.depth+u.kern+e.depth+s;p=Ke.makeVList({positionType:"bottom",positionData:m,children:[{type:"kern",size:i.fontMetrics().bigOpSpacing5},{type:"elem",elem:u.elem,marginLeft:It(-a)},{type:"kern",size:u.kern},{type:"elem",elem:e},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:It(a)},{type:"kern",size:i.fontMetrics().bigOpSpacing5}]},i)}else if(u){var g=e.height-s;p=Ke.makeVList({positionType:"top",positionData:g,children:[{type:"kern",size:i.fontMetrics().bigOpSpacing5},{type:"elem",elem:u.elem,marginLeft:It(-a)},{type:"kern",size:u.kern},{type:"elem",elem:e}]},i)}else if(h){var y=e.depth+s;p=Ke.makeVList({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:It(a)},{type:"kern",size:i.fontMetrics().bigOpSpacing5}]},i)}else return e;var v=[p];if(u&&a!==0&&!l){var x=Ke.makeSpan(["mspace"],[],i);x.style.marginRight=It(a),v.unshift(x)}return Ke.makeSpan(["mop","op-limits"],v,i)},"assembleSupSub"),Dj=["\\smallint"],Bm=o((e,t)=>{var r,i,n=!1,a;e.type==="supsub"?(r=e.sup,i=e.sub,a=Nr(e.base,"op"),n=!0):a=Nr(e,"op");var s=t.style,l=!1;s.size===ur.DISPLAY.size&&a.symbol&&!Dj.includes(a.name)&&(l=!0);var u;if(a.symbol){var h=l?"Size2-Regular":"Size1-Regular",d="";if((a.name==="\\oiint"||a.name==="\\oiiint")&&(d=a.name.slice(1),a.name=d==="oiint"?"\\iint":"\\iiint"),u=Ke.makeSymbol(a.name,h,"math",t,["mop","op-symbol",l?"large-op":"small-op"]),d.length>0){var f=u.italic,p=Ke.staticSvg(d+"Size"+(l?"2":"1"),t);u=Ke.makeVList({positionType:"individualShift",children:[{type:"elem",elem:u,shift:0},{type:"elem",elem:p,shift:l?.08:0}]},t),a.name="\\"+d,u.classes.unshift("mop"),u.italic=f}}else if(a.body){var m=Fn(a.body,t,!0);m.length===1&&m[0]instanceof Ts?(u=m[0],u.classes[0]="mop"):u=Ke.makeSpan(["mop"],m,t)}else{for(var g=[],y=1;y{var r;if(e.symbol)r=new Ha("mo",[No(e.name,e.mode)]),Dj.includes(e.name)&&r.setAttribute("largeop","false");else if(e.body)r=new Ha("mo",Cs(e.body,t));else{r=new Ha("mi",[new Mo(e.name.slice(1))]);var i=new Ha("mo",[No("\u2061","text")]);e.parentIsSupSub?r=new Ha("mrow",[r,i]):r=ij([r,i])}return r},"mathmlBuilder$1"),F9e={"\u220F":"\\prod","\u2210":"\\coprod","\u2211":"\\sum","\u22C0":"\\bigwedge","\u22C1":"\\bigvee","\u22C2":"\\bigcap","\u22C3":"\\bigcup","\u2A00":"\\bigodot","\u2A01":"\\bigoplus","\u2A02":"\\bigotimes","\u2A04":"\\biguplus","\u2A06":"\\bigsqcup"};Bt({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","\u220F","\u2210","\u2211","\u22C0","\u22C1","\u22C2","\u22C3","\u2A00","\u2A01","\u2A02","\u2A04","\u2A06"],props:{numArgs:0},handler:o((e,t)=>{var{parser:r,funcName:i}=e,n=i;return n.length===1&&(n=F9e[n]),{type:"op",mode:r.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:n}},"handler"),htmlBuilder:Bm,mathmlBuilder:Tv});Bt({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:o((e,t)=>{var{parser:r}=e,i=t[0];return{type:"op",mode:r.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:gn(i)}},"handler"),htmlBuilder:Bm,mathmlBuilder:Tv});$9e={"\u222B":"\\int","\u222C":"\\iint","\u222D":"\\iiint","\u222E":"\\oint","\u222F":"\\oiint","\u2230":"\\oiiint"};Bt({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Bm,mathmlBuilder:Tv});Bt({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:r}},htmlBuilder:Bm,mathmlBuilder:Tv});Bt({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","\u222B","\u222C","\u222D","\u222E","\u222F","\u2230"],props:{numArgs:0},handler(e){var{parser:t,funcName:r}=e,i=r;return i.length===1&&(i=$9e[i]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Bm,mathmlBuilder:Tv});Rj=o((e,t)=>{var r,i,n=!1,a;e.type==="supsub"?(r=e.sup,i=e.sub,a=Nr(e.base,"operatorname"),n=!0):a=Nr(e,"operatorname");var s;if(a.body.length>0){for(var l=a.body.map(f=>{var p=f.text;return typeof p=="string"?{type:"textord",mode:f.mode,text:p}:f}),u=Fn(l,t.withFont("mathrm"),!0),h=0;h{for(var r=Cs(e.body,t.withFont("mathrm")),i=!0,n=0;nd.toText()).join("");r=[new Dt.TextNode(l)]}var u=new Dt.MathNode("mi",r);u.setAttribute("mathvariant","normal");var h=new Dt.MathNode("mo",[No("\u2061","text")]);return e.parentIsSupSub?new Dt.MathNode("mrow",[u,h]):Dt.newDocumentFragment([u,h])},"mathmlBuilder");Bt({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:o((e,t)=>{var{parser:r,funcName:i}=e,n=t[0];return{type:"operatorname",mode:r.mode,body:gn(n),alwaysHandleSupSub:i==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},"handler"),htmlBuilder:Rj,mathmlBuilder:z9e});he("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");qf({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?Ke.makeFragment(Fn(e.body,t,!1)):Ke.makeSpan(["mord"],Fn(e.body,t,!0),t)},mathmlBuilder(e,t){return zh(e.body,t,!0)}});Bt({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:r}=e,i=t[0];return{type:"overline",mode:r.mode,body:i}},htmlBuilder(e,t){var r=Yr(e.body,t.havingCrampedStyle()),i=Ke.makeLineSpan("overline-line",t),n=t.fontMetrics().defaultRuleThickness,a=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r},{type:"kern",size:3*n},{type:"elem",elem:i},{type:"kern",size:n}]},t);return Ke.makeSpan(["mord","overline"],[a],t)},mathmlBuilder(e,t){var r=new Dt.MathNode("mo",[new Dt.TextNode("\u203E")]);r.setAttribute("stretchy","true");var i=new Dt.MathNode("mover",[Ti(e.body,t),r]);return i.setAttribute("accent","true"),i}});Bt({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:o((e,t)=>{var{parser:r}=e,i=t[0];return{type:"phantom",mode:r.mode,body:gn(i)}},"handler"),htmlBuilder:o((e,t)=>{var r=Fn(e.body,t.withPhantom(),!1);return Ke.makeFragment(r)},"htmlBuilder"),mathmlBuilder:o((e,t)=>{var r=Cs(e.body,t);return new Dt.MathNode("mphantom",r)},"mathmlBuilder")});Bt({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:o((e,t)=>{var{parser:r}=e,i=t[0];return{type:"hphantom",mode:r.mode,body:i}},"handler"),htmlBuilder:o((e,t)=>{var r=Ke.makeSpan([],[Yr(e.body,t.withPhantom())]);if(r.height=0,r.depth=0,r.children)for(var i=0;i{var r=Cs(gn(e.body),t),i=new Dt.MathNode("mphantom",r),n=new Dt.MathNode("mpadded",[i]);return n.setAttribute("height","0px"),n.setAttribute("depth","0px"),n},"mathmlBuilder")});Bt({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:o((e,t)=>{var{parser:r}=e,i=t[0];return{type:"vphantom",mode:r.mode,body:i}},"handler"),htmlBuilder:o((e,t)=>{var r=Ke.makeSpan(["inner"],[Yr(e.body,t.withPhantom())]),i=Ke.makeSpan(["fix"],[]);return Ke.makeSpan(["mord","rlap"],[r,i],t)},"htmlBuilder"),mathmlBuilder:o((e,t)=>{var r=Cs(gn(e.body),t),i=new Dt.MathNode("mphantom",r),n=new Dt.MathNode("mpadded",[i]);return n.setAttribute("width","0px"),n},"mathmlBuilder")});Bt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:r}=e,i=Nr(t[0],"size").value,n=t[1];return{type:"raisebox",mode:r.mode,dy:i,body:n}},htmlBuilder(e,t){var r=Yr(e.body,t),i=Qi(e.dy,t);return Ke.makeVList({positionType:"shift",positionData:-i,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){var r=new Dt.MathNode("mpadded",[Ti(e.body,t)]),i=e.dy.number+e.dy.unit;return r.setAttribute("voffset",i),r}});Bt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});Bt({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,r){var{parser:i}=e,n=r[0],a=Nr(t[0],"size"),s=Nr(t[1],"size");return{type:"rule",mode:i.mode,shift:n&&Nr(n,"size").value,width:a.value,height:s.value}},htmlBuilder(e,t){var r=Ke.makeSpan(["mord","rule"],[],t),i=Qi(e.width,t),n=Qi(e.height,t),a=e.shift?Qi(e.shift,t):0;return r.style.borderRightWidth=It(i),r.style.borderTopWidth=It(n),r.style.bottom=It(a),r.width=i,r.height=n+a,r.depth=-a,r.maxFontSize=n*1.125*t.sizeMultiplier,r},mathmlBuilder(e,t){var r=Qi(e.width,t),i=Qi(e.height,t),n=e.shift?Qi(e.shift,t):0,a=t.color&&t.getColor()||"black",s=new Dt.MathNode("mspace");s.setAttribute("mathbackground",a),s.setAttribute("width",It(r)),s.setAttribute("height",It(i));var l=new Dt.MathNode("mpadded",[s]);return n>=0?l.setAttribute("height",It(n)):(l.setAttribute("height",It(n)),l.setAttribute("depth",It(-n))),l.setAttribute("voffset",It(n)),l}});o(Lj,"sizingGroup");MY=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],G9e=o((e,t)=>{var r=t.havingSize(e.size);return Lj(e.body,r,t)},"htmlBuilder");Bt({type:"sizing",names:MY,props:{numArgs:0,allowedInText:!0},handler:o((e,t)=>{var{breakOnTokenText:r,funcName:i,parser:n}=e,a=n.parseExpression(!1,r);return{type:"sizing",mode:n.mode,size:MY.indexOf(i)+1,body:a}},"handler"),htmlBuilder:G9e,mathmlBuilder:o((e,t)=>{var r=t.havingSize(e.size),i=Cs(e.body,r),n=new Dt.MathNode("mstyle",i);return n.setAttribute("mathsize",It(r.sizeMultiplier)),n},"mathmlBuilder")});Bt({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:o((e,t,r)=>{var{parser:i}=e,n=!1,a=!1,s=r[0]&&Nr(r[0],"ordgroup");if(s)for(var l="",u=0;u{var r=Ke.makeSpan([],[Yr(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return r;if(e.smashHeight&&(r.height=0,r.children))for(var i=0;i{var r=new Dt.MathNode("mpadded",[Ti(e.body,t)]);return e.smashHeight&&r.setAttribute("height","0px"),e.smashDepth&&r.setAttribute("depth","0px"),r},"mathmlBuilder")});Bt({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,r){var{parser:i}=e,n=r[0],a=t[0];return{type:"sqrt",mode:i.mode,body:a,index:n}},htmlBuilder(e,t){var r=Yr(e.body,t.havingCrampedStyle());r.height===0&&(r.height=t.fontMetrics().xHeight),r=Ke.wrapFragment(r,t);var i=t.fontMetrics(),n=i.defaultRuleThickness,a=n;t.style.idr.height+r.depth+s&&(s=(s+f-r.height-r.depth)/2);var p=u.height-r.height-s-h;r.style.paddingLeft=It(d);var m=Ke.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+p)},{type:"elem",elem:u},{type:"kern",size:h}]},t);if(e.index){var g=t.havingStyle(ur.SCRIPTSCRIPT),y=Yr(e.index,g,t),v=.6*(m.height-m.depth),x=Ke.makeVList({positionType:"shift",positionData:-v,children:[{type:"elem",elem:y}]},t),b=Ke.makeSpan(["root"],[x]);return Ke.makeSpan(["mord","sqrt"],[b,m],t)}else return Ke.makeSpan(["mord","sqrt"],[m],t)},mathmlBuilder(e,t){var{body:r,index:i}=e;return i?new Dt.MathNode("mroot",[Ti(r,t),Ti(i,t)]):new Dt.MathNode("msqrt",[Ti(r,t)])}});NY={display:ur.DISPLAY,text:ur.TEXT,script:ur.SCRIPT,scriptscript:ur.SCRIPTSCRIPT};Bt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:r,funcName:i,parser:n}=e,a=n.parseExpression(!0,r),s=i.slice(1,i.length-5);return{type:"styling",mode:n.mode,style:s,body:a}},htmlBuilder(e,t){var r=NY[e.style],i=t.havingStyle(r).withFont("");return Lj(e.body,i,t)},mathmlBuilder(e,t){var r=NY[e.style],i=t.havingStyle(r),n=Cs(e.body,i),a=new Dt.MathNode("mstyle",n),s={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=s[e.style];return a.setAttribute("scriptlevel",l[0]),a.setAttribute("displaystyle",l[1]),a}});V9e=o(function(t,r){var i=t.base;if(i)if(i.type==="op"){var n=i.limits&&(r.style.size===ur.DISPLAY.size||i.alwaysHandleSupSub);return n?Bm:null}else if(i.type==="operatorname"){var a=i.alwaysHandleSupSub&&(r.style.size===ur.DISPLAY.size||i.limits);return a?Rj:null}else{if(i.type==="accent")return Zr.isCharacterBox(i.base)?mD:null;if(i.type==="horizBrace"){var s=!t.sub;return s===i.isOver?Aj:null}else return null}else return null},"htmlBuilderDelegate");qf({type:"supsub",htmlBuilder(e,t){var r=V9e(e,t);if(r)return r(e,t);var{base:i,sup:n,sub:a}=e,s=Yr(i,t),l,u,h=t.fontMetrics(),d=0,f=0,p=i&&Zr.isCharacterBox(i);if(n){var m=t.havingStyle(t.style.sup());l=Yr(n,m,t),p||(d=s.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(a){var g=t.havingStyle(t.style.sub());u=Yr(a,g,t),p||(f=s.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var y;t.style===ur.DISPLAY?y=h.sup1:t.style.cramped?y=h.sup3:y=h.sup2;var v=t.sizeMultiplier,x=It(.5/h.ptPerEm/v),b=null;if(u){var T=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");(s instanceof Ts||T)&&(b=It(-s.italic))}var w;if(l&&u){d=Math.max(d,y,l.depth+.25*h.xHeight),f=Math.max(f,h.sub2);var C=h.defaultRuleThickness,k=4*C;if(d-l.depth-(u.height-f)0&&(d+=E,f-=E)}var A=[{type:"elem",elem:u,shift:f,marginRight:x,marginLeft:b},{type:"elem",elem:l,shift:-d,marginRight:x}];w=Ke.makeVList({positionType:"individualShift",children:A},t)}else if(u){f=Math.max(f,h.sub1,u.height-.8*h.xHeight);var N=[{type:"elem",elem:u,marginLeft:b,marginRight:x}];w=Ke.makeVList({positionType:"shift",positionData:f,children:N},t)}else if(l)d=Math.max(d,y,l.depth+.25*h.xHeight),w=Ke.makeVList({positionType:"shift",positionData:-d,children:[{type:"elem",elem:l,marginRight:x}]},t);else throw new Error("supsub must have either sup or sub.");var P=tD(s,"right")||"mord";return Ke.makeSpan([P],[s,Ke.makeSpan(["msupsub"],[w])],t)},mathmlBuilder(e,t){var r=!1,i,n;e.base&&e.base.type==="horizBrace"&&(n=!!e.sup,n===e.base.isOver&&(r=!0,i=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var a=[Ti(e.base,t)];e.sub&&a.push(Ti(e.sub,t)),e.sup&&a.push(Ti(e.sup,t));var s;if(r)s=i?"mover":"munder";else if(e.sub)if(e.sup){var h=e.base;h&&h.type==="op"&&h.limits&&t.style===ur.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(t.style===ur.DISPLAY||h.limits)?s="munderover":s="msubsup"}else{var u=e.base;u&&u.type==="op"&&u.limits&&(t.style===ur.DISPLAY||u.alwaysHandleSupSub)||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(u.limits||t.style===ur.DISPLAY)?s="munder":s="msub"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===ur.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===ur.DISPLAY)?s="mover":s="msup"}return new Dt.MathNode(s,a)}});qf({type:"atom",htmlBuilder(e,t){return Ke.mathsym(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var r=new Dt.MathNode("mo",[No(e.text,e.mode)]);if(e.family==="bin"){var i=fD(e,t);i==="bold-italic"&&r.setAttribute("mathvariant",i)}else e.family==="punct"?r.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&r.setAttribute("stretchy","false");return r}});Mj={mi:"italic",mn:"normal",mtext:"normal"};qf({type:"mathord",htmlBuilder(e,t){return Ke.makeOrd(e,t,"mathord")},mathmlBuilder(e,t){var r=new Dt.MathNode("mi",[No(e.text,e.mode,t)]),i=fD(e,t)||"italic";return i!==Mj[r.type]&&r.setAttribute("mathvariant",i),r}});qf({type:"textord",htmlBuilder(e,t){return Ke.makeOrd(e,t,"textord")},mathmlBuilder(e,t){var r=No(e.text,e.mode,t),i=fD(e,t)||"normal",n;return e.mode==="text"?n=new Dt.MathNode("mtext",[r]):/[0-9]/.test(e.text)?n=new Dt.MathNode("mn",[r]):e.text==="\\prime"?n=new Dt.MathNode("mo",[r]):n=new Dt.MathNode("mi",[r]),i!==Mj[n.type]&&n.setAttribute("mathvariant",i),n}});j7={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},X7={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};qf({type:"spacing",htmlBuilder(e,t){if(X7.hasOwnProperty(e.text)){var r=X7[e.text].className||"";if(e.mode==="text"){var i=Ke.makeOrd(e,t,"textord");return i.classes.push(r),i}else return Ke.makeSpan(["mspace",r],[Ke.mathsym(e.text,e.mode,t)],t)}else{if(j7.hasOwnProperty(e.text))return Ke.makeSpan(["mspace",j7[e.text]],[],t);throw new Lt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var r;if(X7.hasOwnProperty(e.text))r=new Dt.MathNode("mtext",[new Dt.TextNode("\xA0")]);else{if(j7.hasOwnProperty(e.text))return new Dt.MathNode("mspace");throw new Lt('Unknown type of space "'+e.text+'"')}return r}});IY=o(()=>{var e=new Dt.MathNode("mtd",[]);return e.setAttribute("width","50%"),e},"pad");qf({type:"tag",mathmlBuilder(e,t){var r=new Dt.MathNode("mtable",[new Dt.MathNode("mtr",[IY(),new Dt.MathNode("mtd",[zh(e.body,t)]),IY(),new Dt.MathNode("mtd",[zh(e.tag,t)])])]);return r.setAttribute("width","100%"),r}});OY={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},PY={"\\textbf":"textbf","\\textmd":"textmd"},W9e={"\\textit":"textit","\\textup":"textup"},BY=o((e,t)=>{var r=e.font;if(r){if(OY[r])return t.withTextFontFamily(OY[r]);if(PY[r])return t.withTextFontWeight(PY[r]);if(r==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(W9e[r])},"optionsWithFont");Bt({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:r,funcName:i}=e,n=t[0];return{type:"text",mode:r.mode,body:gn(n),font:i}},htmlBuilder(e,t){var r=BY(e,t),i=Fn(e.body,r,!0);return Ke.makeSpan(["mord","text"],i,r)},mathmlBuilder(e,t){var r=BY(e,t);return zh(e.body,r)}});Bt({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:r}=e;return{type:"underline",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=Yr(e.body,t),i=Ke.makeLineSpan("underline-line",t),n=t.fontMetrics().defaultRuleThickness,a=Ke.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:n},{type:"elem",elem:i},{type:"kern",size:3*n},{type:"elem",elem:r}]},t);return Ke.makeSpan(["mord","underline"],[a],t)},mathmlBuilder(e,t){var r=new Dt.MathNode("mo",[new Dt.TextNode("\u203E")]);r.setAttribute("stretchy","true");var i=new Dt.MathNode("munder",[Ti(e.body,t),r]);return i.setAttribute("accentunder","true"),i}});Bt({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:r}=e;return{type:"vcenter",mode:r.mode,body:t[0]}},htmlBuilder(e,t){var r=Yr(e.body,t),i=t.fontMetrics().axisHeight,n=.5*(r.height-i-(r.depth+i));return Ke.makeVList({positionType:"shift",positionData:n,children:[{type:"elem",elem:r}]},t)},mathmlBuilder(e,t){return new Dt.MathNode("mpadded",[Ti(e.body,t)],["vcenter"])}});Bt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,r){throw new Lt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var r=FY(e),i=[],n=t.havingStyle(t.style.text()),a=0;ae.body.replace(/ /g,e.star?"\u2423":"\xA0"),"makeVerb"),Fh=tj,Nj=`[ \r + ]`,q9e="\\\\[a-zA-Z@]+",U9e="\\\\[^\uD800-\uDFFF]",H9e="("+q9e+")"+Nj+"*",Y9e=`\\\\( +|[ \r ]+ +?)[ \r ]*`,sD="[\u0300-\u036F]",j9e=new RegExp(sD+"+$"),X9e="("+Nj+"+)|"+(Y9e+"|")+"([!-\\[\\]-\u2027\u202A-\uD7FF\uF900-\uFFFF]"+(sD+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(sD+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+H9e)+("|"+U9e+")"),rk=class{static{o(this,"Lexer")}constructor(t,r){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=r,this.tokenRegex=new RegExp(X9e,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,r){this.catcodes[t]=r}lex(){var t=this.input,r=this.tokenRegex.lastIndex;if(r===t.length)return new eo("EOF",new bs(this,r,r));var i=this.tokenRegex.exec(t);if(i===null||i.index!==r)throw new Lt("Unexpected character: '"+t[r]+"'",new eo(t[r],new bs(this,r,r+1)));var n=i[6]||i[3]||(i[2]?"\\ ":" ");if(this.catcodes[n]===14){var a=t.indexOf(` +`,this.tokenRegex.lastIndex);return a===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=a+1,this.lex()}return new eo(n,new bs(this,r,this.tokenRegex.lastIndex))}},oD=class{static{o(this,"Namespace")}constructor(t,r){t===void 0&&(t={}),r===void 0&&(r={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=r,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Lt("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var r in t)t.hasOwnProperty(r)&&(t[r]==null?delete this.current[r]:this.current[r]=t[r])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,r,i){if(i===void 0&&(i=!1),i){for(var n=0;n0&&(this.undefStack[this.undefStack.length-1][t]=r)}else{var a=this.undefStack[this.undefStack.length-1];a&&!a.hasOwnProperty(t)&&(a[t]=this.current[t])}r==null?delete this.current[t]:this.current[t]=r}},K9e=Cj;he("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});he("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});he("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});he("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});he("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var r=e.future();return t[0].length===1&&t[0][0].text===r.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});he("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");he("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});$Y={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};he("\\char",function(e){var t=e.popToken(),r,i="";if(t.text==="'")r=8,t=e.popToken();else if(t.text==='"')r=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")i=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new Lt("\\char` missing argument");i=t.text.charCodeAt(0)}else r=10;if(r){if(i=$Y[t.text],i==null||i>=r)throw new Lt("Invalid base-"+r+" digit "+t.text);for(var n;(n=$Y[e.future().text])!=null&&n{var n=e.consumeArg().tokens;if(n.length!==1)throw new Lt("\\newcommand's first argument must be a macro name");var a=n[0].text,s=e.isDefined(a);if(s&&!t)throw new Lt("\\newcommand{"+a+"} attempting to redefine "+(a+"; use \\renewcommand"));if(!s&&!r)throw new Lt("\\renewcommand{"+a+"} when command "+a+" does not yet exist; use \\newcommand");var l=0;if(n=e.consumeArg().tokens,n.length===1&&n[0].text==="["){for(var u="",h=e.expandNextToken();h.text!=="]"&&h.text!=="EOF";)u+=h.text,h=e.expandNextToken();if(!u.match(/^\s*[0-9]+\s*$/))throw new Lt("Invalid number of arguments: "+u);l=parseInt(u),n=e.consumeArg().tokens}return s&&i||e.macros.set(a,{tokens:n,numArgs:l}),""},"newcommand");he("\\newcommand",e=>kD(e,!1,!0,!1));he("\\renewcommand",e=>kD(e,!0,!1,!1));he("\\providecommand",e=>kD(e,!0,!0,!0));he("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(r=>r.text).join("")),""});he("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(r=>r.text).join("")),""});he("\\show",e=>{var t=e.popToken(),r=t.text;return console.log(t,e.macros.get(r),Fh[r],_i.math[r],_i.text[r]),""});he("\\bgroup","{");he("\\egroup","}");he("~","\\nobreakspace");he("\\lq","`");he("\\rq","'");he("\\aa","\\r a");he("\\AA","\\r A");he("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`\xA9}");he("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");he("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`\xAE}");he("\u212C","\\mathscr{B}");he("\u2130","\\mathscr{E}");he("\u2131","\\mathscr{F}");he("\u210B","\\mathscr{H}");he("\u2110","\\mathscr{I}");he("\u2112","\\mathscr{L}");he("\u2133","\\mathscr{M}");he("\u211B","\\mathscr{R}");he("\u212D","\\mathfrak{C}");he("\u210C","\\mathfrak{H}");he("\u2128","\\mathfrak{Z}");he("\\Bbbk","\\Bbb{k}");he("\xB7","\\cdotp");he("\\llap","\\mathllap{\\textrm{#1}}");he("\\rlap","\\mathrlap{\\textrm{#1}}");he("\\clap","\\mathclap{\\textrm{#1}}");he("\\mathstrut","\\vphantom{(}");he("\\underbar","\\underline{\\text{#1}}");he("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');he("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`\u2260}}");he("\\ne","\\neq");he("\u2260","\\neq");he("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`\u2209}}");he("\u2209","\\notin");he("\u2258","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`\u2258}}");he("\u2259","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`\u2258}}");he("\u225A","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`\u225A}}");he("\u225B","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`\u225B}}");he("\u225D","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`\u225D}}");he("\u225E","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`\u225E}}");he("\u225F","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`\u225F}}");he("\u27C2","\\perp");he("\u203C","\\mathclose{!\\mkern-0.8mu!}");he("\u220C","\\notni");he("\u231C","\\ulcorner");he("\u231D","\\urcorner");he("\u231E","\\llcorner");he("\u231F","\\lrcorner");he("\xA9","\\copyright");he("\xAE","\\textregistered");he("\uFE0F","\\textregistered");he("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');he("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');he("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');he("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');he("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");he("\u22EE","\\vdots");he("\\varGamma","\\mathit{\\Gamma}");he("\\varDelta","\\mathit{\\Delta}");he("\\varTheta","\\mathit{\\Theta}");he("\\varLambda","\\mathit{\\Lambda}");he("\\varXi","\\mathit{\\Xi}");he("\\varPi","\\mathit{\\Pi}");he("\\varSigma","\\mathit{\\Sigma}");he("\\varUpsilon","\\mathit{\\Upsilon}");he("\\varPhi","\\mathit{\\Phi}");he("\\varPsi","\\mathit{\\Psi}");he("\\varOmega","\\mathit{\\Omega}");he("\\substack","\\begin{subarray}{c}#1\\end{subarray}");he("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");he("\\boxed","\\fbox{$\\displaystyle{#1}$}");he("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");he("\\implies","\\DOTSB\\;\\Longrightarrow\\;");he("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");he("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");he("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");zY={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};he("\\dots",function(e){var t="\\dotso",r=e.expandAfterFuture().text;return r in zY?t=zY[r]:(r.slice(0,4)==="\\not"||r in _i.math&&["bin","rel"].includes(_i.math[r].group))&&(t="\\dotsb"),t});wD={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};he("\\dotso",function(e){var t=e.future().text;return t in wD?"\\ldots\\,":"\\ldots"});he("\\dotsc",function(e){var t=e.future().text;return t in wD&&t!==","?"\\ldots\\,":"\\ldots"});he("\\cdots",function(e){var t=e.future().text;return t in wD?"\\@cdots\\,":"\\@cdots"});he("\\dotsb","\\cdots");he("\\dotsm","\\cdots");he("\\dotsi","\\!\\cdots");he("\\dotsx","\\ldots\\,");he("\\DOTSI","\\relax");he("\\DOTSB","\\relax");he("\\DOTSX","\\relax");he("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");he("\\,","\\tmspace+{3mu}{.1667em}");he("\\thinspace","\\,");he("\\>","\\mskip{4mu}");he("\\:","\\tmspace+{4mu}{.2222em}");he("\\medspace","\\:");he("\\;","\\tmspace+{5mu}{.2777em}");he("\\thickspace","\\;");he("\\!","\\tmspace-{3mu}{.1667em}");he("\\negthinspace","\\!");he("\\negmedspace","\\tmspace-{4mu}{.2222em}");he("\\negthickspace","\\tmspace-{5mu}{.277em}");he("\\enspace","\\kern.5em ");he("\\enskip","\\hskip.5em\\relax");he("\\quad","\\hskip1em\\relax");he("\\qquad","\\hskip2em\\relax");he("\\tag","\\@ifstar\\tag@literal\\tag@paren");he("\\tag@paren","\\tag@literal{({#1})}");he("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Lt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});he("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");he("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");he("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");he("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");he("\\newline","\\\\\\relax");he("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");Ij=It(nc["Main-Regular"][84][1]-.7*nc["Main-Regular"][65][1]);he("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Ij+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");he("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Ij+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");he("\\hspace","\\@ifstar\\@hspacer\\@hspace");he("\\@hspace","\\hskip #1\\relax");he("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");he("\\ordinarycolon",":");he("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");he("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');he("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');he("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');he("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');he("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');he("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');he("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');he("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');he("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');he("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');he("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');he("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');he("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');he("\u2237","\\dblcolon");he("\u2239","\\eqcolon");he("\u2254","\\coloneqq");he("\u2255","\\eqqcolon");he("\u2A74","\\Coloneqq");he("\\ratio","\\vcentcolon");he("\\coloncolon","\\dblcolon");he("\\colonequals","\\coloneqq");he("\\coloncolonequals","\\Coloneqq");he("\\equalscolon","\\eqqcolon");he("\\equalscoloncolon","\\Eqqcolon");he("\\colonminus","\\coloneq");he("\\coloncolonminus","\\Coloneq");he("\\minuscolon","\\eqcolon");he("\\minuscoloncolon","\\Eqcolon");he("\\coloncolonapprox","\\Colonapprox");he("\\coloncolonsim","\\Colonsim");he("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");he("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");he("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");he("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");he("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220C}}");he("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");he("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");he("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");he("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");he("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");he("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");he("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");he("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");he("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}");he("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}");he("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}");he("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}");he("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}");he("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}");he("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}");he("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}");he("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}");he("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}");he("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228A}");he("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2ACB}");he("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228B}");he("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2ACC}");he("\\imath","\\html@mathml{\\@imath}{\u0131}");he("\\jmath","\\html@mathml{\\@jmath}{\u0237}");he("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27E6}}");he("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27E7}}");he("\u27E6","\\llbracket");he("\u27E7","\\rrbracket");he("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}");he("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}");he("\u2983","\\lBrace");he("\u2984","\\rBrace");he("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`\u29B5}}");he("\u29B5","\\minuso");he("\\darr","\\downarrow");he("\\dArr","\\Downarrow");he("\\Darr","\\Downarrow");he("\\lang","\\langle");he("\\rang","\\rangle");he("\\uarr","\\uparrow");he("\\uArr","\\Uparrow");he("\\Uarr","\\Uparrow");he("\\N","\\mathbb{N}");he("\\R","\\mathbb{R}");he("\\Z","\\mathbb{Z}");he("\\alef","\\aleph");he("\\alefsym","\\aleph");he("\\Alpha","\\mathrm{A}");he("\\Beta","\\mathrm{B}");he("\\bull","\\bullet");he("\\Chi","\\mathrm{X}");he("\\clubs","\\clubsuit");he("\\cnums","\\mathbb{C}");he("\\Complex","\\mathbb{C}");he("\\Dagger","\\ddagger");he("\\diamonds","\\diamondsuit");he("\\empty","\\emptyset");he("\\Epsilon","\\mathrm{E}");he("\\Eta","\\mathrm{H}");he("\\exist","\\exists");he("\\harr","\\leftrightarrow");he("\\hArr","\\Leftrightarrow");he("\\Harr","\\Leftrightarrow");he("\\hearts","\\heartsuit");he("\\image","\\Im");he("\\infin","\\infty");he("\\Iota","\\mathrm{I}");he("\\isin","\\in");he("\\Kappa","\\mathrm{K}");he("\\larr","\\leftarrow");he("\\lArr","\\Leftarrow");he("\\Larr","\\Leftarrow");he("\\lrarr","\\leftrightarrow");he("\\lrArr","\\Leftrightarrow");he("\\Lrarr","\\Leftrightarrow");he("\\Mu","\\mathrm{M}");he("\\natnums","\\mathbb{N}");he("\\Nu","\\mathrm{N}");he("\\Omicron","\\mathrm{O}");he("\\plusmn","\\pm");he("\\rarr","\\rightarrow");he("\\rArr","\\Rightarrow");he("\\Rarr","\\Rightarrow");he("\\real","\\Re");he("\\reals","\\mathbb{R}");he("\\Reals","\\mathbb{R}");he("\\Rho","\\mathrm{P}");he("\\sdot","\\cdot");he("\\sect","\\S");he("\\spades","\\spadesuit");he("\\sub","\\subset");he("\\sube","\\subseteq");he("\\supe","\\supseteq");he("\\Tau","\\mathrm{T}");he("\\thetasym","\\vartheta");he("\\weierp","\\wp");he("\\Zeta","\\mathrm{Z}");he("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");he("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");he("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");he("\\bra","\\mathinner{\\langle{#1}|}");he("\\ket","\\mathinner{|{#1}\\rangle}");he("\\braket","\\mathinner{\\langle{#1}\\rangle}");he("\\Bra","\\left\\langle#1\\right|");he("\\Ket","\\left|#1\\right\\rangle");Oj=o(e=>t=>{var r=t.consumeArg().tokens,i=t.consumeArg().tokens,n=t.consumeArg().tokens,a=t.consumeArg().tokens,s=t.macros.get("|"),l=t.macros.get("\\|");t.macros.beginGroup();var u=o(f=>p=>{e&&(p.macros.set("|",s),n.length&&p.macros.set("\\|",l));var m=f;if(!f&&n.length){var g=p.future();g.text==="|"&&(p.popToken(),m=!0)}return{tokens:m?n:i,numArgs:0}},"midMacro");t.macros.set("|",u(!1)),n.length&&t.macros.set("\\|",u(!0));var h=t.consumeArg().tokens,d=t.expandTokens([...a,...h,...r]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}},"braketHelper");he("\\bra@ket",Oj(!1));he("\\bra@set",Oj(!0));he("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");he("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");he("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");he("\\angln","{\\angl n}");he("\\blue","\\textcolor{##6495ed}{#1}");he("\\orange","\\textcolor{##ffa500}{#1}");he("\\pink","\\textcolor{##ff00af}{#1}");he("\\red","\\textcolor{##df0030}{#1}");he("\\green","\\textcolor{##28ae7b}{#1}");he("\\gray","\\textcolor{gray}{#1}");he("\\purple","\\textcolor{##9d38bd}{#1}");he("\\blueA","\\textcolor{##ccfaff}{#1}");he("\\blueB","\\textcolor{##80f6ff}{#1}");he("\\blueC","\\textcolor{##63d9ea}{#1}");he("\\blueD","\\textcolor{##11accd}{#1}");he("\\blueE","\\textcolor{##0c7f99}{#1}");he("\\tealA","\\textcolor{##94fff5}{#1}");he("\\tealB","\\textcolor{##26edd5}{#1}");he("\\tealC","\\textcolor{##01d1c1}{#1}");he("\\tealD","\\textcolor{##01a995}{#1}");he("\\tealE","\\textcolor{##208170}{#1}");he("\\greenA","\\textcolor{##b6ffb0}{#1}");he("\\greenB","\\textcolor{##8af281}{#1}");he("\\greenC","\\textcolor{##74cf70}{#1}");he("\\greenD","\\textcolor{##1fab54}{#1}");he("\\greenE","\\textcolor{##0d923f}{#1}");he("\\goldA","\\textcolor{##ffd0a9}{#1}");he("\\goldB","\\textcolor{##ffbb71}{#1}");he("\\goldC","\\textcolor{##ff9c39}{#1}");he("\\goldD","\\textcolor{##e07d10}{#1}");he("\\goldE","\\textcolor{##a75a05}{#1}");he("\\redA","\\textcolor{##fca9a9}{#1}");he("\\redB","\\textcolor{##ff8482}{#1}");he("\\redC","\\textcolor{##f9685d}{#1}");he("\\redD","\\textcolor{##e84d39}{#1}");he("\\redE","\\textcolor{##bc2612}{#1}");he("\\maroonA","\\textcolor{##ffbde0}{#1}");he("\\maroonB","\\textcolor{##ff92c6}{#1}");he("\\maroonC","\\textcolor{##ed5fa6}{#1}");he("\\maroonD","\\textcolor{##ca337c}{#1}");he("\\maroonE","\\textcolor{##9e034e}{#1}");he("\\purpleA","\\textcolor{##ddd7ff}{#1}");he("\\purpleB","\\textcolor{##c6b9fc}{#1}");he("\\purpleC","\\textcolor{##aa87ff}{#1}");he("\\purpleD","\\textcolor{##7854ab}{#1}");he("\\purpleE","\\textcolor{##543b78}{#1}");he("\\mintA","\\textcolor{##f5f9e8}{#1}");he("\\mintB","\\textcolor{##edf2df}{#1}");he("\\mintC","\\textcolor{##e0e5cc}{#1}");he("\\grayA","\\textcolor{##f6f7f7}{#1}");he("\\grayB","\\textcolor{##f0f1f2}{#1}");he("\\grayC","\\textcolor{##e3e5e6}{#1}");he("\\grayD","\\textcolor{##d6d8da}{#1}");he("\\grayE","\\textcolor{##babec2}{#1}");he("\\grayF","\\textcolor{##888d93}{#1}");he("\\grayG","\\textcolor{##626569}{#1}");he("\\grayH","\\textcolor{##3b3e40}{#1}");he("\\grayI","\\textcolor{##21242c}{#1}");he("\\kaBlue","\\textcolor{##314453}{#1}");he("\\kaGreen","\\textcolor{##71B307}{#1}");Pj={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},lD=class{static{o(this,"MacroExpander")}constructor(t,r,i){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=r,this.expansionCount=0,this.feed(t),this.macros=new oD(K9e,r.macros),this.mode=i,this.stack=[]}feed(t){this.lexer=new rk(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var r,i,n;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;r=this.popToken(),{tokens:n,end:i}=this.consumeArg(["]"])}else({tokens:n,start:r,end:i}=this.consumeArg());return this.pushToken(new eo("EOF",i.loc)),this.pushTokens(n),new eo("",bs.range(r,i))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var r=[],i=t&&t.length>0;i||this.consumeSpaces();var n=this.future(),a,s=0,l=0;do{if(a=this.popToken(),r.push(a),a.text==="{")++s;else if(a.text==="}"){if(--s,s===-1)throw new Lt("Extra }",a)}else if(a.text==="EOF")throw new Lt("Unexpected end of input in a macro argument, expected '"+(t&&i?t[l]:"}")+"'",a);if(t&&i)if((s===0||s===1&&t[l]==="{")&&a.text===t[l]){if(++l,l===t.length){r.splice(-l,l);break}}else l=0}while(s!==0||i);return n.text==="{"&&r[r.length-1].text==="}"&&(r.pop(),r.shift()),r.reverse(),{tokens:r,start:n,end:a}}consumeArgs(t,r){if(r){if(r.length!==t+1)throw new Lt("The length of delimiters doesn't match the number of args!");for(var i=r[0],n=0;nthis.settings.maxExpand)throw new Lt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var r=this.popToken(),i=r.text,n=r.noexpand?null:this._getExpansion(i);if(n==null||t&&n.unexpandable){if(t&&n==null&&i[0]==="\\"&&!this.isDefined(i))throw new Lt("Undefined control sequence: "+i);return this.pushToken(r),!1}this.countExpansion(1);var a=n.tokens,s=this.consumeArgs(n.numArgs,n.delimiters);if(n.numArgs){a=a.slice();for(var l=a.length-1;l>=0;--l){var u=a[l];if(u.text==="#"){if(l===0)throw new Lt("Incomplete placeholder at end of macro body",u);if(u=a[--l],u.text==="#")a.splice(l+1,1);else if(/^[1-9]$/.test(u.text))a.splice(l,2,...s[+u.text-1]);else throw new Lt("Not a valid argument number",u)}}}return this.pushTokens(a),a.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}throw new Error}expandMacro(t){return this.macros.has(t)?this.expandTokens([new eo(t)]):void 0}expandTokens(t){var r=[],i=this.stack.length;for(this.pushTokens(t);this.stack.length>i;)if(this.expandOnce(!0)===!1){var n=this.stack.pop();n.treatAsRelax&&(n.noexpand=!1,n.treatAsRelax=!1),r.push(n)}return this.countExpansion(r.length),r}expandMacroAsText(t){var r=this.expandMacro(t);return r&&r.map(i=>i.text).join("")}_getExpansion(t){var r=this.macros.get(t);if(r==null)return r;if(t.length===1){var i=this.lexer.catcodes[t];if(i!=null&&i!==13)return}var n=typeof r=="function"?r(this):r;if(typeof n=="string"){var a=0;if(n.indexOf("#")!==-1)for(var s=n.replace(/##/g,"");s.indexOf("#"+(a+1))!==-1;)++a;for(var l=new rk(n,this.settings),u=[],h=l.lex();h.text!=="EOF";)u.push(h),h=l.lex();u.reverse();var d={tokens:u,numArgs:a};return d}return n}isDefined(t){return this.macros.has(t)||Fh.hasOwnProperty(t)||_i.math.hasOwnProperty(t)||_i.text.hasOwnProperty(t)||Pj.hasOwnProperty(t)}isExpandable(t){var r=this.macros.get(t);return r!=null?typeof r=="string"||typeof r=="function"||!r.unexpandable:Fh.hasOwnProperty(t)&&!Fh[t].primitive}},GY=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,jC=Object.freeze({"\u208A":"+","\u208B":"-","\u208C":"=","\u208D":"(","\u208E":")","\u2080":"0","\u2081":"1","\u2082":"2","\u2083":"3","\u2084":"4","\u2085":"5","\u2086":"6","\u2087":"7","\u2088":"8","\u2089":"9","\u2090":"a","\u2091":"e","\u2095":"h","\u1D62":"i","\u2C7C":"j","\u2096":"k","\u2097":"l","\u2098":"m","\u2099":"n","\u2092":"o","\u209A":"p","\u1D63":"r","\u209B":"s","\u209C":"t","\u1D64":"u","\u1D65":"v","\u2093":"x","\u1D66":"\u03B2","\u1D67":"\u03B3","\u1D68":"\u03C1","\u1D69":"\u03D5","\u1D6A":"\u03C7","\u207A":"+","\u207B":"-","\u207C":"=","\u207D":"(","\u207E":")","\u2070":"0","\xB9":"1","\xB2":"2","\xB3":"3","\u2074":"4","\u2075":"5","\u2076":"6","\u2077":"7","\u2078":"8","\u2079":"9","\u1D2C":"A","\u1D2E":"B","\u1D30":"D","\u1D31":"E","\u1D33":"G","\u1D34":"H","\u1D35":"I","\u1D36":"J","\u1D37":"K","\u1D38":"L","\u1D39":"M","\u1D3A":"N","\u1D3C":"O","\u1D3E":"P","\u1D3F":"R","\u1D40":"T","\u1D41":"U","\u2C7D":"V","\u1D42":"W","\u1D43":"a","\u1D47":"b","\u1D9C":"c","\u1D48":"d","\u1D49":"e","\u1DA0":"f","\u1D4D":"g",\u02B0:"h","\u2071":"i",\u02B2:"j","\u1D4F":"k",\u02E1:"l","\u1D50":"m",\u207F:"n","\u1D52":"o","\u1D56":"p",\u02B3:"r",\u02E2:"s","\u1D57":"t","\u1D58":"u","\u1D5B":"v",\u02B7:"w",\u02E3:"x",\u02B8:"y","\u1DBB":"z","\u1D5D":"\u03B2","\u1D5E":"\u03B3","\u1D5F":"\u03B4","\u1D60":"\u03D5","\u1D61":"\u03C7","\u1DBF":"\u03B8"}),K7={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030C":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030A":{text:"\\r",math:"\\mathring"},"\u030B":{text:"\\H"},"\u0327":{text:"\\c"}},VY={\u00E1:"a\u0301",\u00E0:"a\u0300",\u00E4:"a\u0308",\u01DF:"a\u0308\u0304",\u00E3:"a\u0303",\u0101:"a\u0304",\u0103:"a\u0306",\u1EAF:"a\u0306\u0301",\u1EB1:"a\u0306\u0300",\u1EB5:"a\u0306\u0303",\u01CE:"a\u030C",\u00E2:"a\u0302",\u1EA5:"a\u0302\u0301",\u1EA7:"a\u0302\u0300",\u1EAB:"a\u0302\u0303",\u0227:"a\u0307",\u01E1:"a\u0307\u0304",\u00E5:"a\u030A",\u01FB:"a\u030A\u0301",\u1E03:"b\u0307",\u0107:"c\u0301",\u1E09:"c\u0327\u0301",\u010D:"c\u030C",\u0109:"c\u0302",\u010B:"c\u0307",\u00E7:"c\u0327",\u010F:"d\u030C",\u1E0B:"d\u0307",\u1E11:"d\u0327",\u00E9:"e\u0301",\u00E8:"e\u0300",\u00EB:"e\u0308",\u1EBD:"e\u0303",\u0113:"e\u0304",\u1E17:"e\u0304\u0301",\u1E15:"e\u0304\u0300",\u0115:"e\u0306",\u1E1D:"e\u0327\u0306",\u011B:"e\u030C",\u00EA:"e\u0302",\u1EBF:"e\u0302\u0301",\u1EC1:"e\u0302\u0300",\u1EC5:"e\u0302\u0303",\u0117:"e\u0307",\u0229:"e\u0327",\u1E1F:"f\u0307",\u01F5:"g\u0301",\u1E21:"g\u0304",\u011F:"g\u0306",\u01E7:"g\u030C",\u011D:"g\u0302",\u0121:"g\u0307",\u0123:"g\u0327",\u1E27:"h\u0308",\u021F:"h\u030C",\u0125:"h\u0302",\u1E23:"h\u0307",\u1E29:"h\u0327",\u00ED:"i\u0301",\u00EC:"i\u0300",\u00EF:"i\u0308",\u1E2F:"i\u0308\u0301",\u0129:"i\u0303",\u012B:"i\u0304",\u012D:"i\u0306",\u01D0:"i\u030C",\u00EE:"i\u0302",\u01F0:"j\u030C",\u0135:"j\u0302",\u1E31:"k\u0301",\u01E9:"k\u030C",\u0137:"k\u0327",\u013A:"l\u0301",\u013E:"l\u030C",\u013C:"l\u0327",\u1E3F:"m\u0301",\u1E41:"m\u0307",\u0144:"n\u0301",\u01F9:"n\u0300",\u00F1:"n\u0303",\u0148:"n\u030C",\u1E45:"n\u0307",\u0146:"n\u0327",\u00F3:"o\u0301",\u00F2:"o\u0300",\u00F6:"o\u0308",\u022B:"o\u0308\u0304",\u00F5:"o\u0303",\u1E4D:"o\u0303\u0301",\u1E4F:"o\u0303\u0308",\u022D:"o\u0303\u0304",\u014D:"o\u0304",\u1E53:"o\u0304\u0301",\u1E51:"o\u0304\u0300",\u014F:"o\u0306",\u01D2:"o\u030C",\u00F4:"o\u0302",\u1ED1:"o\u0302\u0301",\u1ED3:"o\u0302\u0300",\u1ED7:"o\u0302\u0303",\u022F:"o\u0307",\u0231:"o\u0307\u0304",\u0151:"o\u030B",\u1E55:"p\u0301",\u1E57:"p\u0307",\u0155:"r\u0301",\u0159:"r\u030C",\u1E59:"r\u0307",\u0157:"r\u0327",\u015B:"s\u0301",\u1E65:"s\u0301\u0307",\u0161:"s\u030C",\u1E67:"s\u030C\u0307",\u015D:"s\u0302",\u1E61:"s\u0307",\u015F:"s\u0327",\u1E97:"t\u0308",\u0165:"t\u030C",\u1E6B:"t\u0307",\u0163:"t\u0327",\u00FA:"u\u0301",\u00F9:"u\u0300",\u00FC:"u\u0308",\u01D8:"u\u0308\u0301",\u01DC:"u\u0308\u0300",\u01D6:"u\u0308\u0304",\u01DA:"u\u0308\u030C",\u0169:"u\u0303",\u1E79:"u\u0303\u0301",\u016B:"u\u0304",\u1E7B:"u\u0304\u0308",\u016D:"u\u0306",\u01D4:"u\u030C",\u00FB:"u\u0302",\u016F:"u\u030A",\u0171:"u\u030B",\u1E7D:"v\u0303",\u1E83:"w\u0301",\u1E81:"w\u0300",\u1E85:"w\u0308",\u0175:"w\u0302",\u1E87:"w\u0307",\u1E98:"w\u030A",\u1E8D:"x\u0308",\u1E8B:"x\u0307",\u00FD:"y\u0301",\u1EF3:"y\u0300",\u00FF:"y\u0308",\u1EF9:"y\u0303",\u0233:"y\u0304",\u0177:"y\u0302",\u1E8F:"y\u0307",\u1E99:"y\u030A",\u017A:"z\u0301",\u017E:"z\u030C",\u1E91:"z\u0302",\u017C:"z\u0307",\u00C1:"A\u0301",\u00C0:"A\u0300",\u00C4:"A\u0308",\u01DE:"A\u0308\u0304",\u00C3:"A\u0303",\u0100:"A\u0304",\u0102:"A\u0306",\u1EAE:"A\u0306\u0301",\u1EB0:"A\u0306\u0300",\u1EB4:"A\u0306\u0303",\u01CD:"A\u030C",\u00C2:"A\u0302",\u1EA4:"A\u0302\u0301",\u1EA6:"A\u0302\u0300",\u1EAA:"A\u0302\u0303",\u0226:"A\u0307",\u01E0:"A\u0307\u0304",\u00C5:"A\u030A",\u01FA:"A\u030A\u0301",\u1E02:"B\u0307",\u0106:"C\u0301",\u1E08:"C\u0327\u0301",\u010C:"C\u030C",\u0108:"C\u0302",\u010A:"C\u0307",\u00C7:"C\u0327",\u010E:"D\u030C",\u1E0A:"D\u0307",\u1E10:"D\u0327",\u00C9:"E\u0301",\u00C8:"E\u0300",\u00CB:"E\u0308",\u1EBC:"E\u0303",\u0112:"E\u0304",\u1E16:"E\u0304\u0301",\u1E14:"E\u0304\u0300",\u0114:"E\u0306",\u1E1C:"E\u0327\u0306",\u011A:"E\u030C",\u00CA:"E\u0302",\u1EBE:"E\u0302\u0301",\u1EC0:"E\u0302\u0300",\u1EC4:"E\u0302\u0303",\u0116:"E\u0307",\u0228:"E\u0327",\u1E1E:"F\u0307",\u01F4:"G\u0301",\u1E20:"G\u0304",\u011E:"G\u0306",\u01E6:"G\u030C",\u011C:"G\u0302",\u0120:"G\u0307",\u0122:"G\u0327",\u1E26:"H\u0308",\u021E:"H\u030C",\u0124:"H\u0302",\u1E22:"H\u0307",\u1E28:"H\u0327",\u00CD:"I\u0301",\u00CC:"I\u0300",\u00CF:"I\u0308",\u1E2E:"I\u0308\u0301",\u0128:"I\u0303",\u012A:"I\u0304",\u012C:"I\u0306",\u01CF:"I\u030C",\u00CE:"I\u0302",\u0130:"I\u0307",\u0134:"J\u0302",\u1E30:"K\u0301",\u01E8:"K\u030C",\u0136:"K\u0327",\u0139:"L\u0301",\u013D:"L\u030C",\u013B:"L\u0327",\u1E3E:"M\u0301",\u1E40:"M\u0307",\u0143:"N\u0301",\u01F8:"N\u0300",\u00D1:"N\u0303",\u0147:"N\u030C",\u1E44:"N\u0307",\u0145:"N\u0327",\u00D3:"O\u0301",\u00D2:"O\u0300",\u00D6:"O\u0308",\u022A:"O\u0308\u0304",\u00D5:"O\u0303",\u1E4C:"O\u0303\u0301",\u1E4E:"O\u0303\u0308",\u022C:"O\u0303\u0304",\u014C:"O\u0304",\u1E52:"O\u0304\u0301",\u1E50:"O\u0304\u0300",\u014E:"O\u0306",\u01D1:"O\u030C",\u00D4:"O\u0302",\u1ED0:"O\u0302\u0301",\u1ED2:"O\u0302\u0300",\u1ED6:"O\u0302\u0303",\u022E:"O\u0307",\u0230:"O\u0307\u0304",\u0150:"O\u030B",\u1E54:"P\u0301",\u1E56:"P\u0307",\u0154:"R\u0301",\u0158:"R\u030C",\u1E58:"R\u0307",\u0156:"R\u0327",\u015A:"S\u0301",\u1E64:"S\u0301\u0307",\u0160:"S\u030C",\u1E66:"S\u030C\u0307",\u015C:"S\u0302",\u1E60:"S\u0307",\u015E:"S\u0327",\u0164:"T\u030C",\u1E6A:"T\u0307",\u0162:"T\u0327",\u00DA:"U\u0301",\u00D9:"U\u0300",\u00DC:"U\u0308",\u01D7:"U\u0308\u0301",\u01DB:"U\u0308\u0300",\u01D5:"U\u0308\u0304",\u01D9:"U\u0308\u030C",\u0168:"U\u0303",\u1E78:"U\u0303\u0301",\u016A:"U\u0304",\u1E7A:"U\u0304\u0308",\u016C:"U\u0306",\u01D3:"U\u030C",\u00DB:"U\u0302",\u016E:"U\u030A",\u0170:"U\u030B",\u1E7C:"V\u0303",\u1E82:"W\u0301",\u1E80:"W\u0300",\u1E84:"W\u0308",\u0174:"W\u0302",\u1E86:"W\u0307",\u1E8C:"X\u0308",\u1E8A:"X\u0307",\u00DD:"Y\u0301",\u1EF2:"Y\u0300",\u0178:"Y\u0308",\u1EF8:"Y\u0303",\u0232:"Y\u0304",\u0176:"Y\u0302",\u1E8E:"Y\u0307",\u0179:"Z\u0301",\u017D:"Z\u030C",\u1E90:"Z\u0302",\u017B:"Z\u0307",\u03AC:"\u03B1\u0301",\u1F70:"\u03B1\u0300",\u1FB1:"\u03B1\u0304",\u1FB0:"\u03B1\u0306",\u03AD:"\u03B5\u0301",\u1F72:"\u03B5\u0300",\u03AE:"\u03B7\u0301",\u1F74:"\u03B7\u0300",\u03AF:"\u03B9\u0301",\u1F76:"\u03B9\u0300",\u03CA:"\u03B9\u0308",\u0390:"\u03B9\u0308\u0301",\u1FD2:"\u03B9\u0308\u0300",\u1FD1:"\u03B9\u0304",\u1FD0:"\u03B9\u0306",\u03CC:"\u03BF\u0301",\u1F78:"\u03BF\u0300",\u03CD:"\u03C5\u0301",\u1F7A:"\u03C5\u0300",\u03CB:"\u03C5\u0308",\u03B0:"\u03C5\u0308\u0301",\u1FE2:"\u03C5\u0308\u0300",\u1FE1:"\u03C5\u0304",\u1FE0:"\u03C5\u0306",\u03CE:"\u03C9\u0301",\u1F7C:"\u03C9\u0300",\u038E:"\u03A5\u0301",\u1FEA:"\u03A5\u0300",\u03AB:"\u03A5\u0308",\u1FE9:"\u03A5\u0304",\u1FE8:"\u03A5\u0306",\u038F:"\u03A9\u0301",\u1FFA:"\u03A9\u0300"},ik=class e{static{o(this,"Parser")}constructor(t,r){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new lD(t,r,this.mode),this.settings=r,this.leftrightDepth=0}expect(t,r){if(r===void 0&&(r=!0),this.fetch().text!==t)throw new Lt("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());r&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var r=this.nextToken;this.consume(),this.gullet.pushToken(new eo("}")),this.gullet.pushTokens(t);var i=this.parseExpression(!1);return this.expect("}"),this.nextToken=r,i}parseExpression(t,r){for(var i=[];;){this.mode==="math"&&this.consumeSpaces();var n=this.fetch();if(e.endOfExpression.indexOf(n.text)!==-1||r&&n.text===r||t&&Fh[n.text]&&Fh[n.text].infix)break;var a=this.parseAtom(r);if(a){if(a.type==="internal")continue}else break;i.push(a)}return this.mode==="text"&&this.formLigatures(i),this.handleInfixNodes(i)}handleInfixNodes(t){for(var r=-1,i,n=0;n=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+r[0]+'" used in math mode',t);var l=_i[this.mode][r].group,u=bs.range(t),h;if(GIe.hasOwnProperty(l)){var d=l;h={type:"atom",mode:this.mode,family:d,loc:u,text:r}}else h={type:l,mode:this.mode,loc:u,text:r};s=h}else if(r.charCodeAt(0)>=128)this.settings.strict&&(qY(r.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+r[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+r[0]+'"'+(" ("+r.charCodeAt(0)+")"),t)),s={type:"textord",mode:"text",loc:bs.range(t),text:r};else return null;if(this.consume(),a)for(var f=0;f{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),Ro.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}var Uf,Q9e,J9e,Yj,Uj,fr,tOe,rOe,iOe,nOe,jj,Hf,aOe,sOe,cc,AD,oOe,lOe,Hj,hk,Bi,Yf,cOe,Fm,vt,Ir=z(()=>{"use strict";uv();br();Uf=//gi,Q9e=o(e=>e?jj(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),J9e=(()=>{let e=!1;return()=>{e||(eOe(),e=!0)}})();o(eOe,"setupDompurifyHooks");Yj=o(e=>(J9e(),Ro.sanitize(e)),"removeScript"),Uj=o((e,t)=>{if(Mr(t)){let r=t.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?e=Yj(e):r!=="loose"&&(e=jj(e),e=e.replace(//g,">"),e=e.replace(/=/g,"="),e=nOe(e))}return e},"sanitizeMore"),fr=o((e,t)=>e&&(t.dompurifyConfig?e=Ro.sanitize(Uj(e,t),t.dompurifyConfig).toString():e=Ro.sanitize(Uj(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),tOe=o((e,t)=>typeof e=="string"?fr(e,t):e.flat().map(r=>fr(r,t)),"sanitizeTextOrArray"),rOe=o(e=>Uf.test(e),"hasBreaks"),iOe=o(e=>e.split(Uf),"splitBreaks"),nOe=o(e=>e.replace(/#br#/g,"
    "),"placeholderToBreak"),jj=o(e=>e.replace(Uf,"#br#"),"breakToPlaceholder"),Hf=o(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),aOe=o(function(...e){let t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),sOe=o(function(...e){let t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),cc=o(function(e){let t=e.split(/(,)/),r=[];for(let i=0;i0&&i+1Math.max(0,e.split(t).length-1),"countOccurrence"),oOe=o((e,t)=>{let r=AD(e,"~"),i=AD(t,"~");return r===1&&i===1},"shouldCombineSets"),lOe=o(e=>{let t=AD(e,"~"),r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);let i=[...e],n=i.indexOf("~"),a=i.lastIndexOf("~");for(;n!==-1&&a!==-1&&n!==a;)i[n]="<",i[a]=">",n=i.indexOf("~"),a=i.lastIndexOf("~");return r&&i.unshift("~"),i.join("")},"processSet"),Hj=o(()=>window.MathMLElement!==void 0,"isMathMLSupported"),hk=/\$\$(.*)\$\$/g,Bi=o(e=>(e.match(hk)?.length??0)>0,"hasKatex"),Yf=o(async(e,t)=>{let r=document.createElement("div");r.innerHTML=await Fm(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",r);let n={width:r.clientWidth,height:r.clientHeight};return r.remove(),n},"calculateMathMLDimensions"),cOe=o(async(e,t)=>{if(!Bi(e))return e;if(!(Hj()||t.legacyMathML||t.forceLegacyMathML))return e.replace(hk,"MathML is unsupported in this environment.");{let{default:r}=await Promise.resolve().then(()=>(qj(),Wj)),i=t.forceLegacyMathML||!Hj()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(Uf).map(n=>Bi(n)?`

    ${n}
    `:`
    ${n}
    `).join("").replace(hk,(n,a)=>r.renderToString(a,{throwOnError:!0,displayMode:!0,output:i}).replace(/\n/g," ").replace(//g,""))}return e.replace(hk,"Katex is not supported in @mermaid-js/tiny. Please use the full mermaid library.")},"renderKatexUnsanitized"),Fm=o(async(e,t)=>fr(await cOe(e,t),t),"renderKatexSanitized"),vt={getRows:Q9e,sanitizeText:fr,sanitizeTextOrArray:tOe,hasBreaks:rOe,splitBreaks:iOe,lineBreakRegex:Uf,removeScript:Yj,getUrl:Hf,evaluate:Aa,getMax:aOe,getMin:sOe}});var DD,_D,Xj,dk,Kj,Zj,ks,uc=z(()=>{"use strict";UU();br();Ir();St();DD={body:'?',height:80,width:80},_D=new Map,Xj=new Map,dk=o(e=>{for(let t of e){if(!t.name)throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');if(Z.debug("Registering icon pack:",t.name),"loader"in t)Xj.set(t.name,t.loader);else if("icons"in t)_D.set(t.name,t.icons);else throw Z.error("Invalid icon loader:",t),new Error('Invalid icon loader. Must have either "icons" or "loader" property.')}},"registerIconPacks"),Kj=o(async(e,t)=>{let r=J_(e,!0,t!==void 0);if(!r)throw new Error(`Invalid icon name: ${e}`);let i=r.prefix||t;if(!i)throw new Error(`Icon name must contain a prefix: ${e}`);let n=_D.get(i);if(!n){let s=Xj.get(i);if(!s)throw new Error(`Icon set not found: ${r.prefix}`);try{n={...await s(),prefix:i},_D.set(i,n)}catch(l){throw Z.error(l),new Error(`Failed to load icon set: ${r.prefix}`)}}let a=t7(n,r.name);if(!a)throw new Error(`Icon not found: ${e}`);return a},"getRegisteredIconData"),Zj=o(async e=>{try{return await Kj(e),!0}catch{return!1}},"isIconAvailable"),ks=o(async(e,t,r)=>{let i;try{i=await Kj(e,t?.fallbackPrefix)}catch(s){Z.error(s),i=DD}let n=i7(i,t),a=a7(n7(n.body),{...n.attributes,...r});return fr(a,Nt())},"getIconSVG")});function fk(e){for(var t=[],r=1;r{"use strict";o(fk,"dedent")});var pk,jf,Qj,mk=z(()=>{"use strict";pk=/^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s,jf=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,Qj=/\s*%%.*\n/gm});var $m,LD=z(()=>{"use strict";$m=class extends Error{static{o(this,"UnknownDiagramError")}constructor(t){super(t),this.name="UnknownDiagramError"}}});var ku,zm,Cv,MD,Jj,Xf=z(()=>{"use strict";St();mk();LD();ku={},zm=o(function(e,t){e=e.replace(pk,"").replace(jf,"").replace(Qj,` +`);for(let[r,{detector:i}]of Object.entries(ku))if(i(e,t))return r;throw new $m(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),Cv=o((...e)=>{for(let{id:t,detector:r,loader:i}of e)MD(t,r,i)},"registerLazyLoadedDiagrams"),MD=o((e,t,r)=>{ku[e]&&Z.warn(`Detector with key ${e} already exists. Overwriting.`),ku[e]={detector:t,loader:r},Z.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),Jj=o(e=>ku[e].loader,"getDiagramLoader")});var kv,eX,ND=z(()=>{"use strict";kv=(function(){var e=o(function(ke,Fe,He,at){for(He=He||{},at=ke.length;at--;He[ke[at]]=Fe);return He},"o"),t=[1,24],r=[1,25],i=[1,26],n=[1,27],a=[1,28],s=[1,63],l=[1,64],u=[1,65],h=[1,66],d=[1,67],f=[1,68],p=[1,69],m=[1,29],g=[1,30],y=[1,31],v=[1,32],x=[1,33],b=[1,34],T=[1,35],w=[1,36],C=[1,37],k=[1,38],E=[1,39],A=[1,40],N=[1,41],P=[1,42],I=[1,43],D=[1,44],_=[1,45],R=[1,46],M=[1,47],L=[1,48],B=[1,50],O=[1,51],$=[1,52],G=[1,53],F=[1,54],V=[1,55],H=[1,56],j=[1,57],U=[1,58],Q=[1,59],Y=[1,60],ae=[14,42],J=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],te=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],re=[1,82],ee=[1,83],Te=[1,84],ue=[1,85],De=[12,14,42],Ie=[12,14,33,42],Ee=[12,14,33,42,76,77,79,80],we=[12,33],Me=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],$e={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:o(function(Fe,He,at,qe,Ue,ye,ve){var ie=ye.length-1;switch(Ue){case 3:qe.setDirection("TB");break;case 4:qe.setDirection("BT");break;case 5:qe.setDirection("RL");break;case 6:qe.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:qe.setC4Type(ye[ie-3]);break;case 19:qe.setTitle(ye[ie].substring(6)),this.$=ye[ie].substring(6);break;case 20:qe.setAccDescription(ye[ie].substring(15)),this.$=ye[ie].substring(15);break;case 21:this.$=ye[ie].trim(),qe.setTitle(this.$);break;case 22:case 23:this.$=ye[ie].trim(),qe.setAccDescription(this.$);break;case 28:ye[ie].splice(2,0,"ENTERPRISE"),qe.addPersonOrSystemBoundary(...ye[ie]),this.$=ye[ie];break;case 29:ye[ie].splice(2,0,"SYSTEM"),qe.addPersonOrSystemBoundary(...ye[ie]),this.$=ye[ie];break;case 30:qe.addPersonOrSystemBoundary(...ye[ie]),this.$=ye[ie];break;case 31:ye[ie].splice(2,0,"CONTAINER"),qe.addContainerBoundary(...ye[ie]),this.$=ye[ie];break;case 32:qe.addDeploymentNode("node",...ye[ie]),this.$=ye[ie];break;case 33:qe.addDeploymentNode("nodeL",...ye[ie]),this.$=ye[ie];break;case 34:qe.addDeploymentNode("nodeR",...ye[ie]),this.$=ye[ie];break;case 35:qe.popBoundaryParseStack();break;case 39:qe.addPersonOrSystem("person",...ye[ie]),this.$=ye[ie];break;case 40:qe.addPersonOrSystem("external_person",...ye[ie]),this.$=ye[ie];break;case 41:qe.addPersonOrSystem("system",...ye[ie]),this.$=ye[ie];break;case 42:qe.addPersonOrSystem("system_db",...ye[ie]),this.$=ye[ie];break;case 43:qe.addPersonOrSystem("system_queue",...ye[ie]),this.$=ye[ie];break;case 44:qe.addPersonOrSystem("external_system",...ye[ie]),this.$=ye[ie];break;case 45:qe.addPersonOrSystem("external_system_db",...ye[ie]),this.$=ye[ie];break;case 46:qe.addPersonOrSystem("external_system_queue",...ye[ie]),this.$=ye[ie];break;case 47:qe.addContainer("container",...ye[ie]),this.$=ye[ie];break;case 48:qe.addContainer("container_db",...ye[ie]),this.$=ye[ie];break;case 49:qe.addContainer("container_queue",...ye[ie]),this.$=ye[ie];break;case 50:qe.addContainer("external_container",...ye[ie]),this.$=ye[ie];break;case 51:qe.addContainer("external_container_db",...ye[ie]),this.$=ye[ie];break;case 52:qe.addContainer("external_container_queue",...ye[ie]),this.$=ye[ie];break;case 53:qe.addComponent("component",...ye[ie]),this.$=ye[ie];break;case 54:qe.addComponent("component_db",...ye[ie]),this.$=ye[ie];break;case 55:qe.addComponent("component_queue",...ye[ie]),this.$=ye[ie];break;case 56:qe.addComponent("external_component",...ye[ie]),this.$=ye[ie];break;case 57:qe.addComponent("external_component_db",...ye[ie]),this.$=ye[ie];break;case 58:qe.addComponent("external_component_queue",...ye[ie]),this.$=ye[ie];break;case 60:qe.addRel("rel",...ye[ie]),this.$=ye[ie];break;case 61:qe.addRel("birel",...ye[ie]),this.$=ye[ie];break;case 62:qe.addRel("rel_u",...ye[ie]),this.$=ye[ie];break;case 63:qe.addRel("rel_d",...ye[ie]),this.$=ye[ie];break;case 64:qe.addRel("rel_l",...ye[ie]),this.$=ye[ie];break;case 65:qe.addRel("rel_r",...ye[ie]),this.$=ye[ie];break;case 66:qe.addRel("rel_b",...ye[ie]),this.$=ye[ie];break;case 67:ye[ie].splice(0,1),qe.addRel("rel",...ye[ie]),this.$=ye[ie];break;case 68:qe.updateElStyle("update_el_style",...ye[ie]),this.$=ye[ie];break;case 69:qe.updateRelStyle("update_rel_style",...ye[ie]),this.$=ye[ie];break;case 70:qe.updateLayoutConfig("update_layout_config",...ye[ie]),this.$=ye[ie];break;case 71:this.$=[ye[ie]];break;case 72:ye[ie].unshift(ye[ie-1]),this.$=ye[ie];break;case 73:case 75:this.$=ye[ie].trim();break;case 74:let fe={};fe[ye[ie-1].trim()]=ye[ie].trim(),this.$=fe;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:r,24:i,26:n,28:a,29:49,30:61,32:62,34:s,36:l,37:u,38:h,39:d,40:f,41:p,43:23,44:m,45:g,46:y,47:v,48:x,49:b,50:T,51:w,52:C,53:k,54:E,55:A,56:N,57:P,58:I,59:D,60:_,61:R,62:M,63:L,64:B,65:O,66:$,67:G,68:F,69:V,70:H,71:j,72:U,73:Q,74:Y},{13:70,19:20,20:21,21:22,22:t,23:r,24:i,26:n,28:a,29:49,30:61,32:62,34:s,36:l,37:u,38:h,39:d,40:f,41:p,43:23,44:m,45:g,46:y,47:v,48:x,49:b,50:T,51:w,52:C,53:k,54:E,55:A,56:N,57:P,58:I,59:D,60:_,61:R,62:M,63:L,64:B,65:O,66:$,67:G,68:F,69:V,70:H,71:j,72:U,73:Q,74:Y},{13:71,19:20,20:21,21:22,22:t,23:r,24:i,26:n,28:a,29:49,30:61,32:62,34:s,36:l,37:u,38:h,39:d,40:f,41:p,43:23,44:m,45:g,46:y,47:v,48:x,49:b,50:T,51:w,52:C,53:k,54:E,55:A,56:N,57:P,58:I,59:D,60:_,61:R,62:M,63:L,64:B,65:O,66:$,67:G,68:F,69:V,70:H,71:j,72:U,73:Q,74:Y},{13:72,19:20,20:21,21:22,22:t,23:r,24:i,26:n,28:a,29:49,30:61,32:62,34:s,36:l,37:u,38:h,39:d,40:f,41:p,43:23,44:m,45:g,46:y,47:v,48:x,49:b,50:T,51:w,52:C,53:k,54:E,55:A,56:N,57:P,58:I,59:D,60:_,61:R,62:M,63:L,64:B,65:O,66:$,67:G,68:F,69:V,70:H,71:j,72:U,73:Q,74:Y},{13:73,19:20,20:21,21:22,22:t,23:r,24:i,26:n,28:a,29:49,30:61,32:62,34:s,36:l,37:u,38:h,39:d,40:f,41:p,43:23,44:m,45:g,46:y,47:v,48:x,49:b,50:T,51:w,52:C,53:k,54:E,55:A,56:N,57:P,58:I,59:D,60:_,61:R,62:M,63:L,64:B,65:O,66:$,67:G,68:F,69:V,70:H,71:j,72:U,73:Q,74:Y},{14:[1,74]},e(ae,[2,13],{43:23,29:49,30:61,32:62,20:75,34:s,36:l,37:u,38:h,39:d,40:f,41:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T,51:w,52:C,53:k,54:E,55:A,56:N,57:P,58:I,59:D,60:_,61:R,62:M,63:L,64:B,65:O,66:$,67:G,68:F,69:V,70:H,71:j,72:U,73:Q,74:Y}),e(ae,[2,14]),e(J,[2,16],{12:[1,76]}),e(ae,[2,36],{12:[1,77]}),e(te,[2,19]),e(te,[2,20]),{25:[1,78]},{27:[1,79]},e(te,[2,23]),{35:80,75:81,76:re,77:ee,79:Te,80:ue},{35:86,75:81,76:re,77:ee,79:Te,80:ue},{35:87,75:81,76:re,77:ee,79:Te,80:ue},{35:88,75:81,76:re,77:ee,79:Te,80:ue},{35:89,75:81,76:re,77:ee,79:Te,80:ue},{35:90,75:81,76:re,77:ee,79:Te,80:ue},{35:91,75:81,76:re,77:ee,79:Te,80:ue},{35:92,75:81,76:re,77:ee,79:Te,80:ue},{35:93,75:81,76:re,77:ee,79:Te,80:ue},{35:94,75:81,76:re,77:ee,79:Te,80:ue},{35:95,75:81,76:re,77:ee,79:Te,80:ue},{35:96,75:81,76:re,77:ee,79:Te,80:ue},{35:97,75:81,76:re,77:ee,79:Te,80:ue},{35:98,75:81,76:re,77:ee,79:Te,80:ue},{35:99,75:81,76:re,77:ee,79:Te,80:ue},{35:100,75:81,76:re,77:ee,79:Te,80:ue},{35:101,75:81,76:re,77:ee,79:Te,80:ue},{35:102,75:81,76:re,77:ee,79:Te,80:ue},{35:103,75:81,76:re,77:ee,79:Te,80:ue},{35:104,75:81,76:re,77:ee,79:Te,80:ue},e(De,[2,59]),{35:105,75:81,76:re,77:ee,79:Te,80:ue},{35:106,75:81,76:re,77:ee,79:Te,80:ue},{35:107,75:81,76:re,77:ee,79:Te,80:ue},{35:108,75:81,76:re,77:ee,79:Te,80:ue},{35:109,75:81,76:re,77:ee,79:Te,80:ue},{35:110,75:81,76:re,77:ee,79:Te,80:ue},{35:111,75:81,76:re,77:ee,79:Te,80:ue},{35:112,75:81,76:re,77:ee,79:Te,80:ue},{35:113,75:81,76:re,77:ee,79:Te,80:ue},{35:114,75:81,76:re,77:ee,79:Te,80:ue},{35:115,75:81,76:re,77:ee,79:Te,80:ue},{20:116,29:49,30:61,32:62,34:s,36:l,37:u,38:h,39:d,40:f,41:p,43:23,44:m,45:g,46:y,47:v,48:x,49:b,50:T,51:w,52:C,53:k,54:E,55:A,56:N,57:P,58:I,59:D,60:_,61:R,62:M,63:L,64:B,65:O,66:$,67:G,68:F,69:V,70:H,71:j,72:U,73:Q,74:Y},{12:[1,118],33:[1,117]},{35:119,75:81,76:re,77:ee,79:Te,80:ue},{35:120,75:81,76:re,77:ee,79:Te,80:ue},{35:121,75:81,76:re,77:ee,79:Te,80:ue},{35:122,75:81,76:re,77:ee,79:Te,80:ue},{35:123,75:81,76:re,77:ee,79:Te,80:ue},{35:124,75:81,76:re,77:ee,79:Te,80:ue},{35:125,75:81,76:re,77:ee,79:Te,80:ue},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(ae,[2,15]),e(J,[2,17],{21:22,19:130,22:t,23:r,24:i,26:n,28:a}),e(ae,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:r,24:i,26:n,28:a,34:s,36:l,37:u,38:h,39:d,40:f,41:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T,51:w,52:C,53:k,54:E,55:A,56:N,57:P,58:I,59:D,60:_,61:R,62:M,63:L,64:B,65:O,66:$,67:G,68:F,69:V,70:H,71:j,72:U,73:Q,74:Y}),e(te,[2,21]),e(te,[2,22]),e(De,[2,39]),e(Ie,[2,71],{75:81,35:132,76:re,77:ee,79:Te,80:ue}),e(Ee,[2,73]),{78:[1,133]},e(Ee,[2,75]),e(Ee,[2,76]),e(De,[2,40]),e(De,[2,41]),e(De,[2,42]),e(De,[2,43]),e(De,[2,44]),e(De,[2,45]),e(De,[2,46]),e(De,[2,47]),e(De,[2,48]),e(De,[2,49]),e(De,[2,50]),e(De,[2,51]),e(De,[2,52]),e(De,[2,53]),e(De,[2,54]),e(De,[2,55]),e(De,[2,56]),e(De,[2,57]),e(De,[2,58]),e(De,[2,60]),e(De,[2,61]),e(De,[2,62]),e(De,[2,63]),e(De,[2,64]),e(De,[2,65]),e(De,[2,66]),e(De,[2,67]),e(De,[2,68]),e(De,[2,69]),e(De,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(we,[2,28]),e(we,[2,29]),e(we,[2,30]),e(we,[2,31]),e(we,[2,32]),e(we,[2,33]),e(we,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(J,[2,18]),e(ae,[2,38]),e(Ie,[2,72]),e(Ee,[2,74]),e(De,[2,24]),e(De,[2,35]),e(Me,[2,25]),e(Me,[2,26],{12:[1,138]}),e(Me,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:o(function(Fe,He){if(He.recoverable)this.trace(Fe);else{var at=new Error(Fe);throw at.hash=He,at}},"parseError"),parse:o(function(Fe){var He=this,at=[0],qe=[],Ue=[null],ye=[],ve=this.table,ie="",fe=0,W=0,ce=0,K=2,Re=1,xe=ye.slice.call(arguments,1),Oe=Object.create(this.lexer),be={yy:{}};for(var Be in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Be)&&(be.yy[Be]=this.yy[Be]);Oe.setInput(Fe,be.yy),be.yy.lexer=Oe,be.yy.parser=this,typeof Oe.yylloc>"u"&&(Oe.yylloc={});var Ae=Oe.yylloc;ye.push(Ae);var Ve=Oe.options&&Oe.options.ranges;typeof be.yy.parseError=="function"?this.parseError=be.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Pe(et){at.length=at.length-2*et,Ue.length=Ue.length-et,ye.length=ye.length-et}o(Pe,"popStack");function Ye(){var et;return et=qe.pop()||Oe.lex()||Re,typeof et!="number"&&(et instanceof Array&&(qe=et,et=qe.pop()),et=He.symbols_[et]||et),et}o(Ye,"lex");for(var le,st,me,ot,kt,Gt,Tt={},Et,yt,oe,ht;;){if(me=at[at.length-1],this.defaultActions[me]?ot=this.defaultActions[me]:((le===null||typeof le>"u")&&(le=Ye()),ot=ve[me]&&ve[me][le]),typeof ot>"u"||!ot.length||!ot[0]){var gt="";ht=[];for(Et in ve[me])this.terminals_[Et]&&Et>K&&ht.push("'"+this.terminals_[Et]+"'");Oe.showPosition?gt="Parse error on line "+(fe+1)+`: +`+Oe.showPosition()+` +Expecting `+ht.join(", ")+", got '"+(this.terminals_[le]||le)+"'":gt="Parse error on line "+(fe+1)+": Unexpected "+(le==Re?"end of input":"'"+(this.terminals_[le]||le)+"'"),this.parseError(gt,{text:Oe.match,token:this.terminals_[le]||le,line:Oe.yylineno,loc:Ae,expected:ht})}if(ot[0]instanceof Array&&ot.length>1)throw new Error("Parse Error: multiple actions possible at state: "+me+", token: "+le);switch(ot[0]){case 1:at.push(le),Ue.push(Oe.yytext),ye.push(Oe.yylloc),at.push(ot[1]),le=null,st?(le=st,st=null):(W=Oe.yyleng,ie=Oe.yytext,fe=Oe.yylineno,Ae=Oe.yylloc,ce>0&&ce--);break;case 2:if(yt=this.productions_[ot[1]][1],Tt.$=Ue[Ue.length-yt],Tt._$={first_line:ye[ye.length-(yt||1)].first_line,last_line:ye[ye.length-1].last_line,first_column:ye[ye.length-(yt||1)].first_column,last_column:ye[ye.length-1].last_column},Ve&&(Tt._$.range=[ye[ye.length-(yt||1)].range[0],ye[ye.length-1].range[1]]),Gt=this.performAction.apply(Tt,[ie,W,fe,be.yy,ot[1],Ue,ye].concat(xe)),typeof Gt<"u")return Gt;yt&&(at=at.slice(0,-1*yt*2),Ue=Ue.slice(0,-1*yt),ye=ye.slice(0,-1*yt)),at.push(this.productions_[ot[1]][0]),Ue.push(Tt.$),ye.push(Tt._$),oe=ve[at[at.length-2]][at[at.length-1]],at.push(oe);break;case 3:return!0}}return!0},"parse")},de=(function(){var ke={EOF:1,parseError:o(function(He,at){if(this.yy.parser)this.yy.parser.parseError(He,at);else throw new Error(He)},"parseError"),setInput:o(function(Fe,He){return this.yy=He||this.yy||{},this._input=Fe,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var Fe=this._input[0];this.yytext+=Fe,this.yyleng++,this.offset++,this.match+=Fe,this.matched+=Fe;var He=Fe.match(/(?:\r\n?|\n).*/g);return He?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Fe},"input"),unput:o(function(Fe){var He=Fe.length,at=Fe.split(/(?:\r\n?|\n)/g);this._input=Fe+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-He),this.offset-=He;var qe=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),at.length-1&&(this.yylineno-=at.length-1);var Ue=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:at?(at.length===qe.length?this.yylloc.first_column:0)+qe[qe.length-at.length].length-at[0].length:this.yylloc.first_column-He},this.options.ranges&&(this.yylloc.range=[Ue[0],Ue[0]+this.yyleng-He]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(Fe){this.unput(this.match.slice(Fe))},"less"),pastInput:o(function(){var Fe=this.matched.substr(0,this.matched.length-this.match.length);return(Fe.length>20?"...":"")+Fe.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var Fe=this.match;return Fe.length<20&&(Fe+=this._input.substr(0,20-Fe.length)),(Fe.substr(0,20)+(Fe.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var Fe=this.pastInput(),He=new Array(Fe.length+1).join("-");return Fe+this.upcomingInput()+` +`+He+"^"},"showPosition"),test_match:o(function(Fe,He){var at,qe,Ue;if(this.options.backtrack_lexer&&(Ue={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(Ue.yylloc.range=this.yylloc.range.slice(0))),qe=Fe[0].match(/(?:\r\n?|\n).*/g),qe&&(this.yylineno+=qe.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:qe?qe[qe.length-1].length-qe[qe.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Fe[0].length},this.yytext+=Fe[0],this.match+=Fe[0],this.matches=Fe,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(Fe[0].length),this.matched+=Fe[0],at=this.performAction.call(this,this.yy,this,He,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),at)return at;if(this._backtrack){for(var ye in Ue)this[ye]=Ue[ye];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Fe,He,at,qe;this._more||(this.yytext="",this.match="");for(var Ue=this._currentRules(),ye=0;yeHe[0].length)){if(He=at,qe=ye,this.options.backtrack_lexer){if(Fe=this.test_match(at,Ue[ye]),Fe!==!1)return Fe;if(this._backtrack){He=!1;continue}else return!1}else if(!this.options.flex)break}return He?(Fe=this.test_match(He,Ue[qe]),Fe!==!1?Fe:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var He=this.next();return He||this.lex()},"lex"),begin:o(function(He){this.conditionStack.push(He)},"begin"),popState:o(function(){var He=this.conditionStack.length-1;return He>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(He){return He=this.conditionStack.length-1-Math.abs(He||0),He>=0?this.conditionStack[He]:"INITIAL"},"topState"),pushState:o(function(He){this.begin(He)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:o(function(He,at,qe,Ue){var ye=Ue;switch(qe){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),26;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:break;case 14:c;break;case 15:return 12;case 16:break;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;break;case 23:return this.begin("person"),44;break;case 24:return this.begin("system_ext_queue"),51;break;case 25:return this.begin("system_ext_db"),50;break;case 26:return this.begin("system_ext"),49;break;case 27:return this.begin("system_queue"),48;break;case 28:return this.begin("system_db"),47;break;case 29:return this.begin("system"),46;break;case 30:return this.begin("boundary"),37;break;case 31:return this.begin("enterprise_boundary"),34;break;case 32:return this.begin("system_boundary"),36;break;case 33:return this.begin("container_ext_queue"),57;break;case 34:return this.begin("container_ext_db"),56;break;case 35:return this.begin("container_ext"),55;break;case 36:return this.begin("container_queue"),54;break;case 37:return this.begin("container_db"),53;break;case 38:return this.begin("container"),52;break;case 39:return this.begin("container_boundary"),38;break;case 40:return this.begin("component_ext_queue"),63;break;case 41:return this.begin("component_ext_db"),62;break;case 42:return this.begin("component_ext"),61;break;case 43:return this.begin("component_queue"),60;break;case 44:return this.begin("component_db"),59;break;case 45:return this.begin("component"),58;break;case 46:return this.begin("node"),39;break;case 47:return this.begin("node"),39;break;case 48:return this.begin("node_l"),40;break;case 49:return this.begin("node_r"),41;break;case 50:return this.begin("rel"),64;break;case 51:return this.begin("birel"),65;break;case 52:return this.begin("rel_u"),66;break;case 53:return this.begin("rel_u"),66;break;case 54:return this.begin("rel_d"),67;break;case 55:return this.begin("rel_d"),67;break;case 56:return this.begin("rel_l"),68;break;case 57:return this.begin("rel_l"),68;break;case 58:return this.begin("rel_r"),69;break;case 59:return this.begin("rel_r"),69;break;case 60:return this.begin("rel_b"),70;break;case 61:return this.begin("rel_index"),71;break;case 62:return this.begin("update_el_style"),72;break;case 63:return this.begin("update_rel_style"),73;break;case 64:return this.begin("update_layout_config"),74;break;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";break;case 67:this.begin("attribute");break;case 68:this.popState(),this.popState();break;case 69:return 80;case 70:break;case 71:return 80;case 72:this.begin("string");break;case 73:this.popState();break;case 74:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";break;case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 79:this.popState(),this.popState();break;case 80:return"STR";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[65,66,67,68],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}};return ke})();$e.lexer=de;function rt(){this.yy={}}return o(rt,"Parser"),rt.prototype=$e,$e.Parser=rt,new rt})();kv.parser=kv;eX=kv});var uOe,hOe,Br,Io,Di=z(()=>{"use strict";St();uOe=o(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),hOe=o(function(e,t,r){let i=new Map;return r?(i.set("width","100%"),i.set("style",`max-width: ${t}px;`)):(i.set("height",e),i.set("width",t)),i},"calculateSvgSizeAttrs"),Br=o(function(e,t,r,i){let n=hOe(t,r,i);uOe(e,n)},"configureSvgSize"),Io=o(function(e,t,r,i){let n=t.node().getBBox(),a=n.width,s=n.height;Z.info(`SVG bounds: ${a}x${s}`,n);let l=0,u=0;Z.info(`Graph bounds: ${l}x${u}`,e),l=a+r*2,u=s+r*2,Z.info(`Calculated bounds: ${l}x${u}`),Br(t,u,l,i);let h=`${n.x-r} ${n.y-r} ${n.width+2*r} ${n.height+2*r}`;t.attr("viewBox",h)},"setupGraphViewbox")});function ID(e){return[...e.cssRules].map(t=>t.cssText).join(` +`)}var gk,dOe,tX,rX,OD=z(()=>{"use strict";St();gk={};o(ID,"cssStyleSheetToString");dOe=o((e,t,r,i)=>{let n="";return e in gk&&gk[e]?n=gk[e]({...r,svgId:i}):Z.warn(`No theme found for ${e}`),` & { + font-family: ${r.fontFamily}; + font-size: ${r.fontSize}; + fill: ${r.textColor} + } + @keyframes edge-animation-frame { + from { + stroke-dashoffset: 0; + } + } + @keyframes dash { + to { + stroke-dashoffset: 0; + } + } + & .edge-animation-slow { + stroke-dasharray: 9,5 !important; + stroke-dashoffset: 900; + animation: dash 50s linear infinite; + stroke-linecap: round; + } + & .edge-animation-fast { + stroke-dasharray: 9,5 !important; + stroke-dashoffset: 900; + animation: dash 20s linear infinite; + stroke-linecap: round; + } + /* Classes common for multiple diagrams */ + + & .error-icon { + fill: ${r.errorBkgColor}; + } + & .error-text { + fill: ${r.errorTextColor}; + stroke: ${r.errorTextColor}; + } + + & .edge-thickness-normal { + stroke-width: ${r.strokeWidth??1}px; + } + & .edge-thickness-thick { + stroke-width: 3.5px + } + & .edge-pattern-solid { + stroke-dasharray: 0; + } + & .edge-thickness-invisible { + stroke-width: 0; + fill: none; + } + & .edge-pattern-dashed{ + stroke-dasharray: 3; + } + .edge-pattern-dotted { + stroke-dasharray: 2; + } + + & .marker { + fill: ${r.lineColor}; + stroke: ${r.lineColor}; + } + & .marker.cross { + stroke: ${r.lineColor}; + } + + & svg { + font-family: ${r.fontFamily}; + font-size: ${r.fontSize}; + } + & p { + margin: 0 + } + + ${n} + .node .neo-node { + stroke: ${r.nodeBorder}; + } + + [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon { + stroke: ${r.useGradient?"url("+i+"-gradient)":r.nodeBorder}; + filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${i}-drop-shadow)`):"none"}; + } + + + [data-look="neo"].node path { + stroke: ${r.useGradient?"url("+i+"-gradient)":r.nodeBorder}; + stroke-width: ${r.strokeWidth??1}px; + } + + [data-look="neo"].node .outer-path { + filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${i}-drop-shadow)`):"none"}; + } + + [data-look="neo"].node .neo-line path { + stroke: ${r.nodeBorder}; + filter: none; + } + + [data-look="neo"].node circle{ + stroke: ${r.useGradient?"url("+i+"-gradient)":r.nodeBorder}; + filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${i}-drop-shadow)`):"none"}; + } + + [data-look="neo"].node circle .state-start{ + fill: #000000; + } + + [data-look="neo"].icon-shape .icon { + fill: ${r.useGradient?"url("+i+"-gradient)":r.nodeBorder}; + filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${i}-drop-shadow)`):"none"}; + } + + [data-look="neo"].icon-shape .icon-neo path { + stroke: ${r.useGradient?"url("+i+"-gradient)":r.nodeBorder}; + filter: ${r.dropShadow?r.dropShadow.replace("url(#drop-shadow)",`url(${i}-drop-shadow)`):"none"}; + } + + ${t} +`},"getStyles"),tX=o((e,t)=>{t!==void 0&&(gk[e]=t)},"addStylesForDiagram"),rX=dOe});var wv={};xr(wv,{clear:()=>gr,getAccDescription:()=>Sr,getAccTitle:()=>kr,getDiagramTitle:()=>Er,setAccDescription:()=>wr,setAccTitle:()=>Cr,setDiagramTitle:()=>Ar});var PD,BD,FD,$D,gr,Cr,kr,wr,Sr,Ar,Er,Ci=z(()=>{"use strict";Ir();br();PD="",BD="",FD="",$D=o(e=>fr(e,Nt()),"sanitizeText"),gr=o(()=>{PD="",FD="",BD=""},"clear"),Cr=o(e=>{PD=$D(e).replace(/^\s+/g,"")},"setAccTitle"),kr=o(()=>PD,"getAccTitle"),wr=o(e=>{FD=$D(e).replace(/\n\s+/g,` +`)},"setAccDescription"),Sr=o(()=>FD,"getAccDescription"),Ar=o(e=>{BD=$D(e)},"setDiagramTitle"),Er=o(()=>BD,"getDiagramTitle")});var iX,fOe,ge,Sv,vk,Ev,Av,pOe,yk,Kf,_v,zD,Ut=z(()=>{"use strict";Xf();St();br();Ir();Di();OD();Ci();iX=Z,fOe=Zy,ge=Nt,Sv=OC,vk=Ph,Ev=o(e=>fr(e,ge()),"sanitizeText"),Av=Io,pOe=o(()=>wv,"getCommonDb"),yk={},Kf=o((e,t,r)=>{yk[e]&&iX.warn(`Diagram with id ${e} already registered. Overwriting.`),yk[e]=t,r&&MD(e,r),tX(e,t.styles),t.injectUtils?.(iX,fOe,ge,Ev,Av,pOe(),()=>{})},"registerDiagram"),_v=o(e=>{if(e in yk)return yk[e];throw new zD(e)},"getDiagram"),zD=class extends Error{static{o(this,"DiagramNotFoundError")}constructor(t){super(`Diagram ${t} not found.`)}}});var yl,Vh,Xa,gl,hc,Dv,GD,VD,xk,bk,nX,mOe,gOe,yOe,vOe,xOe,bOe,TOe,COe,kOe,wOe,SOe,EOe,AOe,_Oe,DOe,ROe,LOe,aX,MOe,NOe,sX,IOe,OOe,POe,BOe,Wh,FOe,$Oe,zOe,GOe,VOe,Rv,WD=z(()=>{"use strict";Ut();Ir();Ci();yl=[],Vh=[""],Xa="global",gl="",hc=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],Dv=[],GD="",VD=!1,xk=4,bk=2,mOe=o(function(){return nX},"getC4Type"),gOe=o(function(e){nX=fr(e,ge())},"setC4Type"),yOe=o(function(e,t,r,i,n,a,s,l,u){if(e==null||t===void 0||t===null||r===void 0||r===null||i===void 0||i===null)return;let h={},d=Dv.find(f=>f.from===t&&f.to===r);if(d?h=d:Dv.push(h),h.type=e,h.from=t,h.to=r,h.label={text:i},n==null)h.techn={text:""};else if(typeof n=="object"){let[f,p]=Object.entries(n)[0];h[f]={text:p}}else h.techn={text:n};if(a==null)h.descr={text:""};else if(typeof a=="object"){let[f,p]=Object.entries(a)[0];h[f]={text:p}}else h.descr={text:a};if(typeof s=="object"){let[f,p]=Object.entries(s)[0];h[f]=p}else h.sprite=s;if(typeof l=="object"){let[f,p]=Object.entries(l)[0];h[f]=p}else h.tags=l;if(typeof u=="object"){let[f,p]=Object.entries(u)[0];h[f]=p}else h.link=u;h.wrap=Wh()},"addRel"),vOe=o(function(e,t,r,i,n,a,s){if(t===null||r===null)return;let l={},u=yl.find(h=>h.alias===t);if(u&&t===u.alias?l=u:(l.alias=t,yl.push(l)),r==null?l.label={text:""}:l.label={text:r},i==null)l.descr={text:""};else if(typeof i=="object"){let[h,d]=Object.entries(i)[0];l[h]={text:d}}else l.descr={text:i};if(typeof n=="object"){let[h,d]=Object.entries(n)[0];l[h]=d}else l.sprite=n;if(typeof a=="object"){let[h,d]=Object.entries(a)[0];l[h]=d}else l.tags=a;if(typeof s=="object"){let[h,d]=Object.entries(s)[0];l[h]=d}else l.link=s;l.typeC4Shape={text:e},l.parentBoundary=Xa,l.wrap=Wh()},"addPersonOrSystem"),xOe=o(function(e,t,r,i,n,a,s,l){if(t===null||r===null)return;let u={},h=yl.find(d=>d.alias===t);if(h&&t===h.alias?u=h:(u.alias=t,yl.push(u)),r==null?u.label={text:""}:u.label={text:r},i==null)u.techn={text:""};else if(typeof i=="object"){let[d,f]=Object.entries(i)[0];u[d]={text:f}}else u.techn={text:i};if(n==null)u.descr={text:""};else if(typeof n=="object"){let[d,f]=Object.entries(n)[0];u[d]={text:f}}else u.descr={text:n};if(typeof a=="object"){let[d,f]=Object.entries(a)[0];u[d]=f}else u.sprite=a;if(typeof s=="object"){let[d,f]=Object.entries(s)[0];u[d]=f}else u.tags=s;if(typeof l=="object"){let[d,f]=Object.entries(l)[0];u[d]=f}else u.link=l;u.wrap=Wh(),u.typeC4Shape={text:e},u.parentBoundary=Xa},"addContainer"),bOe=o(function(e,t,r,i,n,a,s,l){if(t===null||r===null)return;let u={},h=yl.find(d=>d.alias===t);if(h&&t===h.alias?u=h:(u.alias=t,yl.push(u)),r==null?u.label={text:""}:u.label={text:r},i==null)u.techn={text:""};else if(typeof i=="object"){let[d,f]=Object.entries(i)[0];u[d]={text:f}}else u.techn={text:i};if(n==null)u.descr={text:""};else if(typeof n=="object"){let[d,f]=Object.entries(n)[0];u[d]={text:f}}else u.descr={text:n};if(typeof a=="object"){let[d,f]=Object.entries(a)[0];u[d]=f}else u.sprite=a;if(typeof s=="object"){let[d,f]=Object.entries(s)[0];u[d]=f}else u.tags=s;if(typeof l=="object"){let[d,f]=Object.entries(l)[0];u[d]=f}else u.link=l;u.wrap=Wh(),u.typeC4Shape={text:e},u.parentBoundary=Xa},"addComponent"),TOe=o(function(e,t,r,i,n){if(e===null||t===null)return;let a={},s=hc.find(l=>l.alias===e);if(s&&e===s.alias?a=s:(a.alias=e,hc.push(a)),t==null?a.label={text:""}:a.label={text:t},r==null)a.type={text:"system"};else if(typeof r=="object"){let[l,u]=Object.entries(r)[0];a[l]={text:u}}else a.type={text:r};if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.tags=i;if(typeof n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.link=n;a.parentBoundary=Xa,a.wrap=Wh(),gl=Xa,Xa=e,Vh.push(gl)},"addPersonOrSystemBoundary"),COe=o(function(e,t,r,i,n){if(e===null||t===null)return;let a={},s=hc.find(l=>l.alias===e);if(s&&e===s.alias?a=s:(a.alias=e,hc.push(a)),t==null?a.label={text:""}:a.label={text:t},r==null)a.type={text:"container"};else if(typeof r=="object"){let[l,u]=Object.entries(r)[0];a[l]={text:u}}else a.type={text:r};if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.tags=i;if(typeof n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.link=n;a.parentBoundary=Xa,a.wrap=Wh(),gl=Xa,Xa=e,Vh.push(gl)},"addContainerBoundary"),kOe=o(function(e,t,r,i,n,a,s,l){if(t===null||r===null)return;let u={},h=hc.find(d=>d.alias===t);if(h&&t===h.alias?u=h:(u.alias=t,hc.push(u)),r==null?u.label={text:""}:u.label={text:r},i==null)u.type={text:"node"};else if(typeof i=="object"){let[d,f]=Object.entries(i)[0];u[d]={text:f}}else u.type={text:i};if(n==null)u.descr={text:""};else if(typeof n=="object"){let[d,f]=Object.entries(n)[0];u[d]={text:f}}else u.descr={text:n};if(typeof s=="object"){let[d,f]=Object.entries(s)[0];u[d]=f}else u.tags=s;if(typeof l=="object"){let[d,f]=Object.entries(l)[0];u[d]=f}else u.link=l;u.nodeType=e,u.parentBoundary=Xa,u.wrap=Wh(),gl=Xa,Xa=t,Vh.push(gl)},"addDeploymentNode"),wOe=o(function(){Xa=gl,Vh.pop(),gl=Vh.pop(),Vh.push(gl)},"popBoundaryParseStack"),SOe=o(function(e,t,r,i,n,a,s,l,u,h,d){let f=yl.find(p=>p.alias===t);if(!(f===void 0&&(f=hc.find(p=>p.alias===t),f===void 0))){if(r!=null)if(typeof r=="object"){let[p,m]=Object.entries(r)[0];f[p]=m}else f.bgColor=r;if(i!=null)if(typeof i=="object"){let[p,m]=Object.entries(i)[0];f[p]=m}else f.fontColor=i;if(n!=null)if(typeof n=="object"){let[p,m]=Object.entries(n)[0];f[p]=m}else f.borderColor=n;if(a!=null)if(typeof a=="object"){let[p,m]=Object.entries(a)[0];f[p]=m}else f.shadowing=a;if(s!=null)if(typeof s=="object"){let[p,m]=Object.entries(s)[0];f[p]=m}else f.shape=s;if(l!=null)if(typeof l=="object"){let[p,m]=Object.entries(l)[0];f[p]=m}else f.sprite=l;if(u!=null)if(typeof u=="object"){let[p,m]=Object.entries(u)[0];f[p]=m}else f.techn=u;if(h!=null)if(typeof h=="object"){let[p,m]=Object.entries(h)[0];f[p]=m}else f.legendText=h;if(d!=null)if(typeof d=="object"){let[p,m]=Object.entries(d)[0];f[p]=m}else f.legendSprite=d}},"updateElStyle"),EOe=o(function(e,t,r,i,n,a,s){let l=Dv.find(u=>u.from===t&&u.to===r);if(l!==void 0){if(i!=null)if(typeof i=="object"){let[u,h]=Object.entries(i)[0];l[u]=h}else l.textColor=i;if(n!=null)if(typeof n=="object"){let[u,h]=Object.entries(n)[0];l[u]=h}else l.lineColor=n;if(a!=null)if(typeof a=="object"){let[u,h]=Object.entries(a)[0];l[u]=parseInt(h)}else l.offsetX=parseInt(a);if(s!=null)if(typeof s=="object"){let[u,h]=Object.entries(s)[0];l[u]=parseInt(h)}else l.offsetY=parseInt(s)}},"updateRelStyle"),AOe=o(function(e,t,r){let i=xk,n=bk;if(typeof t=="object"){let a=Object.values(t)[0];i=parseInt(a)}else i=parseInt(t);if(typeof r=="object"){let a=Object.values(r)[0];n=parseInt(a)}else n=parseInt(r);i>=1&&(xk=i),n>=1&&(bk=n)},"updateLayoutConfig"),_Oe=o(function(){return xk},"getC4ShapeInRow"),DOe=o(function(){return bk},"getC4BoundaryInRow"),ROe=o(function(){return Xa},"getCurrentBoundaryParse"),LOe=o(function(){return gl},"getParentBoundaryParse"),aX=o(function(e){return e==null?yl:yl.filter(t=>t.parentBoundary===e)},"getC4ShapeArray"),MOe=o(function(e){return yl.find(t=>t.alias===e)},"getC4Shape"),NOe=o(function(e){return Object.keys(aX(e))},"getC4ShapeKeys"),sX=o(function(e){return e==null?hc:hc.filter(t=>t.parentBoundary===e)},"getBoundaries"),IOe=sX,OOe=o(function(){return Dv},"getRels"),POe=o(function(){return GD},"getTitle"),BOe=o(function(e){VD=e},"setWrap"),Wh=o(function(){return VD},"autoWrap"),FOe=o(function(){yl=[],hc=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],gl="",Xa="global",Vh=[""],Dv=[],Vh=[""],GD="",VD=!1,xk=4,bk=2},"clear"),$Oe={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},zOe={FILLED:0,OPEN:1},GOe={LEFTOF:0,RIGHTOF:1,OVER:2},VOe=o(function(e){GD=fr(e,ge())},"setTitle"),Rv={addPersonOrSystem:vOe,addPersonOrSystemBoundary:TOe,addContainer:xOe,addContainerBoundary:COe,addComponent:bOe,addDeploymentNode:kOe,popBoundaryParseStack:wOe,addRel:yOe,updateElStyle:SOe,updateRelStyle:EOe,updateLayoutConfig:AOe,autoWrap:Wh,setWrap:BOe,getC4ShapeArray:aX,getC4Shape:MOe,getC4ShapeKeys:NOe,getBoundaries:sX,getBoundarys:IOe,getCurrentBoundaryParse:ROe,getParentBoundaryParse:LOe,getRels:OOe,getTitle:POe,getC4Type:mOe,getC4ShapeInRow:_Oe,getC4BoundaryInRow:DOe,setAccTitle:Cr,getAccTitle:kr,getAccDescription:Sr,setAccDescription:wr,getConfig:o(()=>ge().c4,"getConfig"),clear:FOe,LINETYPE:$Oe,ARROWTYPE:zOe,PLACEMENT:GOe,setTitle:VOe,setC4Type:gOe}});function Zf(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}var qD=z(()=>{"use strict";o(Zf,"ascending")});function UD(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}var oX=z(()=>{"use strict";o(UD,"descending")});function Qf(e){let t,r,i;e.length!==2?(t=Zf,r=o((l,u)=>Zf(e(l),u),"compare2"),i=o((l,u)=>e(l)-u,"delta")):(t=e===Zf||e===UD?e:WOe,r=e,i=e);function n(l,u,h=0,d=l.length){if(h>>1;r(l[f],u)<0?h=f+1:d=f}while(h>>1;r(l[f],u)<=0?h=f+1:d=f}while(hh&&i(l[f-1],u)>-i(l[f],u)?f-1:f}return o(s,"center"),{left:n,center:s,right:a}}function WOe(){return 0}var HD=z(()=>{"use strict";qD();oX();o(Qf,"bisector");o(WOe,"zero")});function YD(e){return e===null?NaN:+e}var lX=z(()=>{"use strict";o(YD,"number")});var cX,uX,qOe,UOe,jD,hX=z(()=>{"use strict";qD();HD();lX();cX=Qf(Zf),uX=cX.right,qOe=cX.left,UOe=Qf(YD).center,jD=uX});function dX({_intern:e,_key:t},r){let i=t(r);return e.has(i)?e.get(i):r}function HOe({_intern:e,_key:t},r){let i=t(r);return e.has(i)?e.get(i):(e.set(i,r),r)}function YOe({_intern:e,_key:t},r){let i=t(r);return e.has(i)&&(r=e.get(i),e.delete(i)),r}function jOe(e){return e!==null&&typeof e=="object"?e.valueOf():e}var Gm,fX=z(()=>{"use strict";Gm=class extends Map{static{o(this,"InternMap")}constructor(t,r=jOe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[i,n]of t)this.set(i,n)}get(t){return super.get(dX(this,t))}has(t){return super.has(dX(this,t))}set(t,r){return super.set(HOe(this,t),r)}delete(t){return super.delete(YOe(this,t))}};o(dX,"intern_get");o(HOe,"intern_set");o(YOe,"intern_delete");o(jOe,"keyof")});function Tk(e,t,r){let i=(t-e)/Math.max(0,r),n=Math.floor(Math.log10(i)),a=i/Math.pow(10,n),s=a>=XOe?10:a>=KOe?5:a>=ZOe?2:1,l,u,h;return n<0?(h=Math.pow(10,-n)/s,l=Math.round(e*h),u=Math.round(t*h),l/ht&&--u,h=-h):(h=Math.pow(10,n)*s,l=Math.round(e/h),u=Math.round(t/h),l*ht&&--u),u0))return[];if(e===t)return[e];let i=t=n))return[];let l=a-n+1,u=new Array(l);if(i)if(s<0)for(let h=0;h{"use strict";XOe=Math.sqrt(50),KOe=Math.sqrt(10),ZOe=Math.sqrt(2);o(Tk,"tickSpec");o(Ck,"ticks");o(Lv,"tickIncrement");o(Vm,"tickStep")});function kk(e,t){let r;if(t===void 0)for(let i of e)i!=null&&(r=i)&&(r=i);else{let i=-1;for(let n of e)(n=t(n,++i,e))!=null&&(r=n)&&(r=n)}return r}var mX=z(()=>{"use strict";o(kk,"max")});function wk(e,t){let r;if(t===void 0)for(let i of e)i!=null&&(r>i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let n of e)(n=t(n,++i,e))!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}return r}var gX=z(()=>{"use strict";o(wk,"min")});function Sk(e,t,r){e=+e,t=+t,r=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+r;for(var i=-1,n=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(n);++i{"use strict";o(Sk,"range")});var qh=z(()=>{"use strict";hX();HD();mX();gX();yX();pX();fX()});function XD(e){return e}var vX=z(()=>{"use strict";o(XD,"default")});function QOe(e){return"translate("+e+",0)"}function JOe(e){return"translate(0,"+e+")"}function ePe(e){return t=>+e(t)}function tPe(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function rPe(){return!this.__axis}function bX(e,t){var r=[],i=null,n=null,a=6,s=6,l=3,u=typeof window<"u"&&window.devicePixelRatio>1?0:.5,h=e===Ak||e===Ek?-1:1,d=e===Ek||e===KD?"x":"y",f=e===Ak||e===ZD?QOe:JOe;function p(m){var g=i??(t.ticks?t.ticks.apply(t,r):t.domain()),y=n??(t.tickFormat?t.tickFormat.apply(t,r):XD),v=Math.max(a,0)+l,x=t.range(),b=+x[0]+u,T=+x[x.length-1]+u,w=(t.bandwidth?tPe:ePe)(t.copy(),u),C=m.selection?m.selection():m,k=C.selectAll(".domain").data([null]),E=C.selectAll(".tick").data(g,t).order(),A=E.exit(),N=E.enter().append("g").attr("class","tick"),P=E.select("line"),I=E.select("text");k=k.merge(k.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),E=E.merge(N),P=P.merge(N.append("line").attr("stroke","currentColor").attr(d+"2",h*a)),I=I.merge(N.append("text").attr("fill","currentColor").attr(d,h*v).attr("dy",e===Ak?"0em":e===ZD?"0.71em":"0.32em")),m!==C&&(k=k.transition(m),E=E.transition(m),P=P.transition(m),I=I.transition(m),A=A.transition(m).attr("opacity",xX).attr("transform",function(D){return isFinite(D=w(D))?f(D+u):this.getAttribute("transform")}),N.attr("opacity",xX).attr("transform",function(D){var _=this.parentNode.__axis;return f((_&&isFinite(_=_(D))?_:w(D))+u)})),A.remove(),k.attr("d",e===Ek||e===KD?s?"M"+h*s+","+b+"H"+u+"V"+T+"H"+h*s:"M"+u+","+b+"V"+T:s?"M"+b+","+h*s+"V"+u+"H"+T+"V"+h*s:"M"+b+","+u+"H"+T),E.attr("opacity",1).attr("transform",function(D){return f(w(D)+u)}),P.attr(d+"2",h*a),I.attr(d,h*v).text(y),C.filter(rPe).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===KD?"start":e===Ek?"end":"middle"),C.each(function(){this.__axis=w})}return o(p,"axis"),p.scale=function(m){return arguments.length?(t=m,p):t},p.ticks=function(){return r=Array.from(arguments),p},p.tickArguments=function(m){return arguments.length?(r=m==null?[]:Array.from(m),p):r.slice()},p.tickValues=function(m){return arguments.length?(i=m==null?null:Array.from(m),p):i&&i.slice()},p.tickFormat=function(m){return arguments.length?(n=m,p):n},p.tickSize=function(m){return arguments.length?(a=s=+m,p):a},p.tickSizeInner=function(m){return arguments.length?(a=+m,p):a},p.tickSizeOuter=function(m){return arguments.length?(s=+m,p):s},p.tickPadding=function(m){return arguments.length?(l=+m,p):l},p.offset=function(m){return arguments.length?(u=+m,p):u},p}function QD(e){return bX(Ak,e)}function JD(e){return bX(ZD,e)}var Ak,KD,ZD,Ek,xX,TX=z(()=>{"use strict";vX();Ak=1,KD=2,ZD=3,Ek=4,xX=1e-6;o(QOe,"translateX");o(JOe,"translateY");o(ePe,"number");o(tPe,"center");o(rPe,"entering");o(bX,"axis");o(QD,"axisTop");o(JD,"axisBottom")});var CX=z(()=>{"use strict";TX()});function wX(){for(var e=0,t=arguments.length,r={},i;e=0&&(i=r.slice(n+1),r=r.slice(0,n)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}function aPe(e,t){for(var r=0,i=e.length,n;r{"use strict";iPe={value:o(()=>{},"value")};o(wX,"dispatch");o(_k,"Dispatch");o(nPe,"parseTypenames");_k.prototype=wX.prototype={constructor:_k,on:o(function(e,t){var r=this._,i=nPe(e+"",r),n,a=-1,s=i.length;if(arguments.length<2){for(;++a0)for(var r=new Array(n),i=0,n,a;i{"use strict";SX()});var Dk,r8,i8=z(()=>{"use strict";Dk="http://www.w3.org/1999/xhtml",r8={svg:"http://www.w3.org/2000/svg",xhtml:Dk,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}});function dc(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),r8.hasOwnProperty(t)?{space:r8[t],local:e}:e}var Rk=z(()=>{"use strict";i8();o(dc,"default")});function sPe(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Dk&&t.documentElement.namespaceURI===Dk?t.createElement(e):t.createElementNS(r,e)}}function oPe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Mv(e){var t=dc(e);return(t.local?oPe:sPe)(t)}var n8=z(()=>{"use strict";Rk();i8();o(sPe,"creatorInherit");o(oPe,"creatorFixed");o(Mv,"default")});function lPe(){}function Uh(e){return e==null?lPe:function(){return this.querySelector(e)}}var Lk=z(()=>{"use strict";o(lPe,"none");o(Uh,"default")});function a8(e){typeof e!="function"&&(e=Uh(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n{"use strict";vl();Lk();o(a8,"default")});function s8(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}var AX=z(()=>{"use strict";o(s8,"array")});function cPe(){return[]}function Wm(e){return e==null?cPe:function(){return this.querySelectorAll(e)}}var o8=z(()=>{"use strict";o(cPe,"empty");o(Wm,"default")});function uPe(e){return function(){return s8(e.apply(this,arguments))}}function l8(e){typeof e=="function"?e=uPe(e):e=Wm(e);for(var t=this._groups,r=t.length,i=[],n=[],a=0;a{"use strict";vl();AX();o8();o(uPe,"arrayAll");o(l8,"default")});function qm(e){return function(){return this.matches(e)}}function Mk(e){return function(t){return t.matches(e)}}var Nv=z(()=>{"use strict";o(qm,"default");o(Mk,"childMatcher")});function dPe(e){return function(){return hPe.call(this.children,e)}}function fPe(){return this.firstElementChild}function c8(e){return this.select(e==null?fPe:dPe(typeof e=="function"?e:Mk(e)))}var hPe,DX=z(()=>{"use strict";Nv();hPe=Array.prototype.find;o(dPe,"childFind");o(fPe,"childFirst");o(c8,"default")});function mPe(){return Array.from(this.children)}function gPe(e){return function(){return pPe.call(this.children,e)}}function u8(e){return this.selectAll(e==null?mPe:gPe(typeof e=="function"?e:Mk(e)))}var pPe,RX=z(()=>{"use strict";Nv();pPe=Array.prototype.filter;o(mPe,"children");o(gPe,"childrenFilter");o(u8,"default")});function h8(e){typeof e!="function"&&(e=qm(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n{"use strict";vl();Nv();o(h8,"default")});function Iv(e){return new Array(e.length)}var d8=z(()=>{"use strict";o(Iv,"default")});function f8(){return new sn(this._enter||this._groups.map(Iv),this._parents)}function Ov(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}var p8=z(()=>{"use strict";d8();vl();o(f8,"default");o(Ov,"EnterNode");Ov.prototype={constructor:Ov,appendChild:o(function(e){return this._parent.insertBefore(e,this._next)},"appendChild"),insertBefore:o(function(e,t){return this._parent.insertBefore(e,t)},"insertBefore"),querySelector:o(function(e){return this._parent.querySelector(e)},"querySelector"),querySelectorAll:o(function(e){return this._parent.querySelectorAll(e)},"querySelectorAll")}});function m8(e){return function(){return e}}var MX=z(()=>{"use strict";o(m8,"default")});function yPe(e,t,r,i,n,a){for(var s=0,l,u=t.length,h=a.length;s=T&&(T=b+1);!(C=v[T])&&++T{"use strict";vl();p8();MX();o(yPe,"bindIndex");o(vPe,"bindKey");o(xPe,"datum");o(g8,"default");o(bPe,"arraylike")});function y8(){return new sn(this._exit||this._groups.map(Iv),this._parents)}var IX=z(()=>{"use strict";d8();vl();o(y8,"default")});function v8(e,t,r){var i=this.enter(),n=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(n=t(n),n&&(n=n.selection())),r==null?a.remove():r(a),i&&n?i.merge(n).order():n}var OX=z(()=>{"use strict";o(v8,"default")});function x8(e){for(var t=e.selection?e.selection():e,r=this._groups,i=t._groups,n=r.length,a=i.length,s=Math.min(n,a),l=new Array(n),u=0;u{"use strict";vl();o(x8,"default")});function b8(){for(var e=this._groups,t=-1,r=e.length;++t=0;)(s=i[n])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}var BX=z(()=>{"use strict";o(b8,"default")});function T8(e){e||(e=TPe);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}o(t,"compareNode");for(var r=this._groups,i=r.length,n=new Array(i),a=0;at?1:e>=t?0:NaN}var FX=z(()=>{"use strict";vl();o(T8,"default");o(TPe,"ascending")});function C8(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}var $X=z(()=>{"use strict";o(C8,"default")});function k8(){return Array.from(this)}var zX=z(()=>{"use strict";o(k8,"default")});function w8(){for(var e=this._groups,t=0,r=e.length;t{"use strict";o(w8,"default")});function S8(){let e=0;for(let t of this)++e;return e}var VX=z(()=>{"use strict";o(S8,"default")});function E8(){return!this.node()}var WX=z(()=>{"use strict";o(E8,"default")});function A8(e){for(var t=this._groups,r=0,i=t.length;r{"use strict";o(A8,"default")});function CPe(e){return function(){this.removeAttribute(e)}}function kPe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wPe(e,t){return function(){this.setAttribute(e,t)}}function SPe(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function EPe(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function APe(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function _8(e,t){var r=dc(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((t==null?r.local?kPe:CPe:typeof t=="function"?r.local?APe:EPe:r.local?SPe:wPe)(r,t))}var UX=z(()=>{"use strict";Rk();o(CPe,"attrRemove");o(kPe,"attrRemoveNS");o(wPe,"attrConstant");o(SPe,"attrConstantNS");o(EPe,"attrFunction");o(APe,"attrFunctionNS");o(_8,"default")});function Pv(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}var D8=z(()=>{"use strict";o(Pv,"default")});function _Pe(e){return function(){this.style.removeProperty(e)}}function DPe(e,t,r){return function(){this.style.setProperty(e,t,r)}}function RPe(e,t,r){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function R8(e,t,r){return arguments.length>1?this.each((t==null?_Pe:typeof t=="function"?RPe:DPe)(e,t,r??"")):Hh(this.node(),e)}function Hh(e,t){return e.style.getPropertyValue(t)||Pv(e).getComputedStyle(e,null).getPropertyValue(t)}var L8=z(()=>{"use strict";D8();o(_Pe,"styleRemove");o(DPe,"styleConstant");o(RPe,"styleFunction");o(R8,"default");o(Hh,"styleValue")});function LPe(e){return function(){delete this[e]}}function MPe(e,t){return function(){this[e]=t}}function NPe(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function M8(e,t){return arguments.length>1?this.each((t==null?LPe:typeof t=="function"?NPe:MPe)(e,t)):this.node()[e]}var HX=z(()=>{"use strict";o(LPe,"propertyRemove");o(MPe,"propertyConstant");o(NPe,"propertyFunction");o(M8,"default")});function YX(e){return e.trim().split(/^|\s+/)}function N8(e){return e.classList||new jX(e)}function jX(e){this._node=e,this._names=YX(e.getAttribute("class")||"")}function XX(e,t){for(var r=N8(e),i=-1,n=t.length;++i{"use strict";o(YX,"classArray");o(N8,"classList");o(jX,"ClassList");jX.prototype={add:o(function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},"add"),remove:o(function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},"remove"),contains:o(function(e){return this._names.indexOf(e)>=0},"contains")};o(XX,"classedAdd");o(KX,"classedRemove");o(IPe,"classedTrue");o(OPe,"classedFalse");o(PPe,"classedFunction");o(I8,"default")});function BPe(){this.textContent=""}function FPe(e){return function(){this.textContent=e}}function $Pe(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function O8(e){return arguments.length?this.each(e==null?BPe:(typeof e=="function"?$Pe:FPe)(e)):this.node().textContent}var QX=z(()=>{"use strict";o(BPe,"textRemove");o(FPe,"textConstant");o($Pe,"textFunction");o(O8,"default")});function zPe(){this.innerHTML=""}function GPe(e){return function(){this.innerHTML=e}}function VPe(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function P8(e){return arguments.length?this.each(e==null?zPe:(typeof e=="function"?VPe:GPe)(e)):this.node().innerHTML}var JX=z(()=>{"use strict";o(zPe,"htmlRemove");o(GPe,"htmlConstant");o(VPe,"htmlFunction");o(P8,"default")});function WPe(){this.nextSibling&&this.parentNode.appendChild(this)}function B8(){return this.each(WPe)}var eK=z(()=>{"use strict";o(WPe,"raise");o(B8,"default")});function qPe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function F8(){return this.each(qPe)}var tK=z(()=>{"use strict";o(qPe,"lower");o(F8,"default")});function $8(e){var t=typeof e=="function"?e:Mv(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}var rK=z(()=>{"use strict";n8();o($8,"default")});function UPe(){return null}function z8(e,t){var r=typeof e=="function"?e:Mv(e),i=t==null?UPe:typeof t=="function"?t:Uh(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}var iK=z(()=>{"use strict";n8();Lk();o(UPe,"constantNull");o(z8,"default")});function HPe(){var e=this.parentNode;e&&e.removeChild(this)}function G8(){return this.each(HPe)}var nK=z(()=>{"use strict";o(HPe,"remove");o(G8,"default")});function YPe(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jPe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function V8(e){return this.select(e?jPe:YPe)}var aK=z(()=>{"use strict";o(YPe,"selection_cloneShallow");o(jPe,"selection_cloneDeep");o(V8,"default")});function W8(e){return arguments.length?this.property("__data__",e):this.node().__data__}var sK=z(()=>{"use strict";o(W8,"default")});function XPe(e){return function(t){e.call(this,t,this.__data__)}}function KPe(e){return e.trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");return i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),{type:t,name:r}})}function ZPe(e){return function(){var t=this.__on;if(t){for(var r=0,i=-1,n=t.length,a;r{"use strict";o(XPe,"contextListener");o(KPe,"parseTypenames");o(ZPe,"onRemove");o(QPe,"onAdd");o(q8,"default")});function lK(e,t,r){var i=Pv(e),n=i.CustomEvent;typeof n=="function"?n=new n(t,r):(n=i.document.createEvent("Event"),r?(n.initEvent(t,r.bubbles,r.cancelable),n.detail=r.detail):n.initEvent(t,!1,!1)),e.dispatchEvent(n)}function JPe(e,t){return function(){return lK(this,e,t)}}function eBe(e,t){return function(){return lK(this,e,t.apply(this,arguments))}}function U8(e,t){return this.each((typeof t=="function"?eBe:JPe)(e,t))}var cK=z(()=>{"use strict";D8();o(lK,"dispatchEvent");o(JPe,"dispatchConstant");o(eBe,"dispatchFunction");o(U8,"default")});function*H8(){for(var e=this._groups,t=0,r=e.length;t{"use strict";o(H8,"default")});function sn(e,t){this._groups=e,this._parents=t}function hK(){return new sn([[document.documentElement]],Y8)}function tBe(){return this}var Y8,wu,vl=z(()=>{"use strict";EX();_X();DX();RX();LX();NX();p8();IX();OX();PX();BX();FX();$X();zX();GX();VX();WX();qX();UX();L8();HX();ZX();QX();JX();eK();tK();rK();iK();nK();aK();sK();oK();cK();uK();Y8=[null];o(sn,"Selection");o(hK,"selection");o(tBe,"selection_selection");sn.prototype=hK.prototype={constructor:sn,select:a8,selectAll:l8,selectChild:c8,selectChildren:u8,filter:h8,data:g8,enter:f8,exit:y8,join:v8,merge:x8,selection:tBe,order:b8,sort:T8,call:C8,nodes:k8,node:w8,size:S8,empty:E8,each:A8,attr:_8,style:R8,property:M8,classed:I8,text:O8,html:P8,raise:B8,lower:F8,append:$8,insert:z8,remove:G8,clone:V8,datum:W8,on:q8,dispatch:U8,[Symbol.iterator]:H8};wu=hK});function Je(e){return typeof e=="string"?new sn([[document.querySelector(e)]],[document.documentElement]):new sn([[e]],Y8)}var dK=z(()=>{"use strict";vl();o(Je,"default")});var xl=z(()=>{"use strict";Nv();Rk();dK();vl();Lk();o8();L8()});var fK=z(()=>{"use strict"});function Yh(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Um(e,t){var r=Object.create(e.prototype);for(var i in t)r[i]=t[i];return r}var j8=z(()=>{"use strict";o(Yh,"default");o(Um,"extend")});function jh(){}function mK(){return this.rgb().formatHex()}function cBe(){return this.rgb().formatHex8()}function uBe(){return CK(this).formatHsl()}function gK(){return this.rgb().formatRgb()}function Tl(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=rBe.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?yK(t):r===3?new ua(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Nk(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Nk(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=iBe.exec(e))?new ua(t[1],t[2],t[3],1):(t=nBe.exec(e))?new ua(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=aBe.exec(e))?Nk(t[1],t[2],t[3],t[4]):(t=sBe.exec(e))?Nk(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=oBe.exec(e))?bK(t[1],t[2]/100,t[3]/100,1):(t=lBe.exec(e))?bK(t[1],t[2]/100,t[3]/100,t[4]):pK.hasOwnProperty(e)?yK(pK[e]):e==="transparent"?new ua(NaN,NaN,NaN,0):null}function yK(e){return new ua(e>>16&255,e>>8&255,e&255,1)}function Nk(e,t,r,i){return i<=0&&(e=t=r=NaN),new ua(e,t,r,i)}function K8(e){return e instanceof jh||(e=Tl(e)),e?(e=e.rgb(),new ua(e.r,e.g,e.b,e.opacity)):new ua}function Ym(e,t,r,i){return arguments.length===1?K8(e):new ua(e,t,r,i??1)}function ua(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}function vK(){return`#${Jf(this.r)}${Jf(this.g)}${Jf(this.b)}`}function hBe(){return`#${Jf(this.r)}${Jf(this.g)}${Jf(this.b)}${Jf((isNaN(this.opacity)?1:this.opacity)*255)}`}function xK(){let e=Pk(this.opacity);return`${e===1?"rgb(":"rgba("}${ep(this.r)}, ${ep(this.g)}, ${ep(this.b)}${e===1?")":`, ${e})`}`}function Pk(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ep(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Jf(e){return e=ep(e),(e<16?"0":"")+e.toString(16)}function bK(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new bl(e,t,r,i)}function CK(e){if(e instanceof bl)return new bl(e.h,e.s,e.l,e.opacity);if(e instanceof jh||(e=Tl(e)),!e)return new bl;if(e instanceof bl)return e;e=e.rgb();var t=e.r/255,r=e.g/255,i=e.b/255,n=Math.min(t,r,i),a=Math.max(t,r,i),s=NaN,l=a-n,u=(a+n)/2;return l?(t===a?s=(r-i)/l+(r0&&u<1?0:s,new bl(s,l,u,e.opacity)}function kK(e,t,r,i){return arguments.length===1?CK(e):new bl(e,t,r,i??1)}function bl(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}function TK(e){return e=(e||0)%360,e<0?e+360:e}function Ik(e){return Math.max(0,Math.min(1,e||0))}function X8(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var Bv,Ok,Hm,Fv,fc,rBe,iBe,nBe,aBe,sBe,oBe,lBe,pK,Z8=z(()=>{"use strict";j8();o(jh,"Color");Bv=.7,Ok=1/Bv,Hm="\\s*([+-]?\\d+)\\s*",Fv="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",rBe=/^#([0-9a-f]{3,8})$/,iBe=new RegExp(`^rgb\\(${Hm},${Hm},${Hm}\\)$`),nBe=new RegExp(`^rgb\\(${fc},${fc},${fc}\\)$`),aBe=new RegExp(`^rgba\\(${Hm},${Hm},${Hm},${Fv}\\)$`),sBe=new RegExp(`^rgba\\(${fc},${fc},${fc},${Fv}\\)$`),oBe=new RegExp(`^hsl\\(${Fv},${fc},${fc}\\)$`),lBe=new RegExp(`^hsla\\(${Fv},${fc},${fc},${Fv}\\)$`),pK={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Yh(jh,Tl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:mK,formatHex:mK,formatHex8:cBe,formatHsl:uBe,formatRgb:gK,toString:gK});o(mK,"color_formatHex");o(cBe,"color_formatHex8");o(uBe,"color_formatHsl");o(gK,"color_formatRgb");o(Tl,"color");o(yK,"rgbn");o(Nk,"rgba");o(K8,"rgbConvert");o(Ym,"rgb");o(ua,"Rgb");Yh(ua,Ym,Um(jh,{brighter(e){return e=e==null?Ok:Math.pow(Ok,e),new ua(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Bv:Math.pow(Bv,e),new ua(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ua(ep(this.r),ep(this.g),ep(this.b),Pk(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:vK,formatHex:vK,formatHex8:hBe,formatRgb:xK,toString:xK}));o(vK,"rgb_formatHex");o(hBe,"rgb_formatHex8");o(xK,"rgb_formatRgb");o(Pk,"clampa");o(ep,"clampi");o(Jf,"hex");o(bK,"hsla");o(CK,"hslConvert");o(kK,"hsl");o(bl,"Hsl");Yh(bl,kK,Um(jh,{brighter(e){return e=e==null?Ok:Math.pow(Ok,e),new bl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Bv:Math.pow(Bv,e),new bl(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*t,n=2*r-i;return new ua(X8(e>=240?e-240:e+120,n,i),X8(e,n,i),X8(e<120?e+240:e-120,n,i),this.opacity)},clamp(){return new bl(TK(this.h),Ik(this.s),Ik(this.l),Pk(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Pk(this.opacity);return`${e===1?"hsl(":"hsla("}${TK(this.h)}, ${Ik(this.s)*100}%, ${Ik(this.l)*100}%${e===1?")":`, ${e})`}`}}));o(TK,"clamph");o(Ik,"clampt");o(X8,"hsl2rgb")});var wK,SK,EK=z(()=>{"use strict";wK=Math.PI/180,SK=180/Math.PI});function MK(e){if(e instanceof pc)return new pc(e.l,e.a,e.b,e.opacity);if(e instanceof Su)return NK(e);e instanceof ua||(e=K8(e));var t=tR(e.r),r=tR(e.g),i=tR(e.b),n=Q8((.2225045*t+.7168786*r+.0606169*i)/_K),a,s;return t===r&&r===i?a=s=n:(a=Q8((.4360747*t+.3850649*r+.1430804*i)/AK),s=Q8((.0139322*t+.0971045*r+.7141733*i)/DK)),new pc(116*n-16,500*(a-n),200*(n-s),e.opacity)}function rR(e,t,r,i){return arguments.length===1?MK(e):new pc(e,t,r,i??1)}function pc(e,t,r,i){this.l=+e,this.a=+t,this.b=+r,this.opacity=+i}function Q8(e){return e>dBe?Math.pow(e,1/3):e/LK+RK}function J8(e){return e>jm?e*e*e:LK*(e-RK)}function eR(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function tR(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function fBe(e){if(e instanceof Su)return new Su(e.h,e.c,e.l,e.opacity);if(e instanceof pc||(e=MK(e)),e.a===0&&e.b===0)return new Su(NaN,0{"use strict";j8();Z8();EK();Bk=18,AK=.96422,_K=1,DK=.82521,RK=4/29,jm=6/29,LK=3*jm*jm,dBe=jm*jm*jm;o(MK,"labConvert");o(rR,"lab");o(pc,"Lab");Yh(pc,rR,Um(jh,{brighter(e){return new pc(this.l+Bk*(e??1),this.a,this.b,this.opacity)},darker(e){return new pc(this.l-Bk*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=AK*J8(t),e=_K*J8(e),r=DK*J8(r),new ua(eR(3.1338561*t-1.6168667*e-.4906146*r),eR(-.9787684*t+1.9161415*e+.033454*r),eR(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));o(Q8,"xyz2lab");o(J8,"lab2xyz");o(eR,"lrgb2rgb");o(tR,"rgb2lrgb");o(fBe,"hclConvert");o($v,"hcl");o(Su,"Hcl");o(NK,"hcl2lab");Yh(Su,$v,Um(jh,{brighter(e){return new Su(this.h,this.c,this.l+Bk*(e??1),this.opacity)},darker(e){return new Su(this.h,this.c,this.l-Bk*(e??1),this.opacity)},rgb(){return NK(this).rgb()}}))});var Xm=z(()=>{"use strict";Z8();IK()});function iR(e,t,r,i,n){var a=e*e,s=a*e;return((1-3*e+3*a-s)*t+(4-6*a+3*s)*r+(1+3*e+3*a-3*s)*i+s*n)/6}function nR(e){var t=e.length-1;return function(r){var i=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),n=e[i],a=e[i+1],s=i>0?e[i-1]:2*n-a,l=i{"use strict";o(iR,"basis");o(nR,"default")});function sR(e){var t=e.length;return function(r){var i=Math.floor(((r%=1)<0?++r:r)*t),n=e[(i+t-1)%t],a=e[i%t],s=e[(i+1)%t],l=e[(i+2)%t];return iR((r-i/t)*t,n,a,s,l)}}var OK=z(()=>{"use strict";aR();o(sR,"default")});var Km,oR=z(()=>{"use strict";Km=o(e=>()=>e,"default")});function PK(e,t){return function(r){return e+r*t}}function pBe(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(i){return Math.pow(e+i*t,r)}}function BK(e,t){var r=t-e;return r?PK(e,r>180||r<-180?r-360*Math.round(r/360):r):Km(isNaN(e)?t:e)}function FK(e){return(e=+e)==1?Eu:function(t,r){return r-t?pBe(t,r,e):Km(isNaN(t)?r:t)}}function Eu(e,t){var r=t-e;return r?PK(e,r):Km(isNaN(e)?t:e)}var lR=z(()=>{"use strict";oR();o(PK,"linear");o(pBe,"exponential");o(BK,"hue");o(FK,"gamma");o(Eu,"nogamma")});function $K(e){return function(t){var r=t.length,i=new Array(r),n=new Array(r),a=new Array(r),s,l;for(s=0;s{"use strict";Xm();aR();OK();lR();tp=o((function e(t){var r=FK(t);function i(n,a){var s=r((n=Ym(n)).r,(a=Ym(a)).r),l=r(n.g,a.g),u=r(n.b,a.b),h=Eu(n.opacity,a.opacity);return function(d){return n.r=s(d),n.g=l(d),n.b=u(d),n.opacity=h(d),n+""}}return o(i,"rgb"),i.gamma=e,i}),"rgbGamma")(1);o($K,"rgbSpline");mBe=$K(nR),gBe=$K(sR)});function uR(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,i=t.slice(),n;return function(a){for(n=0;n{"use strict";o(uR,"default");o(zK,"isNumberArray")});function VK(e,t){var r=t?t.length:0,i=e?Math.min(r,e.length):0,n=new Array(i),a=new Array(r),s;for(s=0;s{"use strict";Fk();o(VK,"genericArray")});function hR(e,t){var r=new Date;return e=+e,t=+t,function(i){return r.setTime(e*(1-i)+t*i),r}}var qK=z(()=>{"use strict";o(hR,"default")});function Zn(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var zv=z(()=>{"use strict";o(Zn,"default")});function dR(e,t){var r={},i={},n;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(n in t)n in e?r[n]=Xh(e[n],t[n]):i[n]=t[n];return function(a){for(n in r)i[n]=r[n](a);return i}}var UK=z(()=>{"use strict";Fk();o(dR,"default")});function yBe(e){return function(){return e}}function vBe(e){return function(t){return e(t)+""}}function Zm(e,t){var r=pR.lastIndex=fR.lastIndex=0,i,n,a,s=-1,l=[],u=[];for(e=e+"",t=t+"";(i=pR.exec(e))&&(n=fR.exec(t));)(a=n.index)>r&&(a=t.slice(r,a),l[s]?l[s]+=a:l[++s]=a),(i=i[0])===(n=n[0])?l[s]?l[s]+=n:l[++s]=n:(l[++s]=null,u.push({i:s,x:Zn(i,n)})),r=fR.lastIndex;return r{"use strict";zv();pR=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fR=new RegExp(pR.source,"g");o(yBe,"zero");o(vBe,"one");o(Zm,"default")});function Xh(e,t){var r=typeof t,i;return t==null||r==="boolean"?Km(t):(r==="number"?Zn:r==="string"?(i=Tl(t))?(t=i,tp):Zm:t instanceof Tl?tp:t instanceof Date?hR:zK(t)?uR:Array.isArray(t)?VK:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?dR:Zn)(e,t)}var Fk=z(()=>{"use strict";Xm();cR();WK();qK();zv();UK();mR();oR();GK();o(Xh,"default")});function $k(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var HK=z(()=>{"use strict";o($k,"default")});function Gk(e,t,r,i,n,a){var s,l,u;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(u=e*r+t*i)&&(r-=e*u,i-=t*u),(l=Math.sqrt(r*r+i*i))&&(r/=l,i/=l,u/=l),e*i{"use strict";YK=180/Math.PI,zk={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};o(Gk,"default")});function XK(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?zk:Gk(t.a,t.b,t.c,t.d,t.e,t.f)}function KK(e){return e==null?zk:(Vk||(Vk=document.createElementNS("http://www.w3.org/2000/svg","g")),Vk.setAttribute("transform",e),(e=Vk.transform.baseVal.consolidate())?(e=e.matrix,Gk(e.a,e.b,e.c,e.d,e.e,e.f)):zk)}var Vk,ZK=z(()=>{"use strict";jK();o(XK,"parseCss");o(KK,"parseSvg")});function QK(e,t,r,i){function n(h){return h.length?h.pop()+" ":""}o(n,"pop");function a(h,d,f,p,m,g){if(h!==f||d!==p){var y=m.push("translate(",null,t,null,r);g.push({i:y-4,x:Zn(h,f)},{i:y-2,x:Zn(d,p)})}else(f||p)&&m.push("translate("+f+t+p+r)}o(a,"translate");function s(h,d,f,p){h!==d?(h-d>180?d+=360:d-h>180&&(h+=360),p.push({i:f.push(n(f)+"rotate(",null,i)-2,x:Zn(h,d)})):d&&f.push(n(f)+"rotate("+d+i)}o(s,"rotate");function l(h,d,f,p){h!==d?p.push({i:f.push(n(f)+"skewX(",null,i)-2,x:Zn(h,d)}):d&&f.push(n(f)+"skewX("+d+i)}o(l,"skewX");function u(h,d,f,p,m,g){if(h!==f||d!==p){var y=m.push(n(m)+"scale(",null,",",null,")");g.push({i:y-4,x:Zn(h,f)},{i:y-2,x:Zn(d,p)})}else(f!==1||p!==1)&&m.push(n(m)+"scale("+f+","+p+")")}return o(u,"scale"),function(h,d){var f=[],p=[];return h=e(h),d=e(d),a(h.translateX,h.translateY,d.translateX,d.translateY,f,p),s(h.rotate,d.rotate,f,p),l(h.skewX,d.skewX,f,p),u(h.scaleX,h.scaleY,d.scaleX,d.scaleY,f,p),h=d=null,function(m){for(var g=-1,y=p.length,v;++g{"use strict";zv();ZK();o(QK,"interpolateTransform");gR=QK(XK,"px, ","px)","deg)"),yR=QK(KK,", ",")",")")});function eZ(e){return function(t,r){var i=e((t=$v(t)).h,(r=$v(r)).h),n=Eu(t.c,r.c),a=Eu(t.l,r.l),s=Eu(t.opacity,r.opacity);return function(l){return t.h=i(l),t.c=n(l),t.l=a(l),t.opacity=s(l),t+""}}}var vR,xBe,tZ=z(()=>{"use strict";Xm();lR();o(eZ,"hcl");vR=eZ(BK),xBe=eZ(Eu)});var Qm=z(()=>{"use strict";Fk();zv();HK();mR();JK();cR();tZ()});function Hv(){return rp||(nZ(bBe),rp=qv.now()+Uk)}function bBe(){rp=0}function Uv(){this._call=this._time=this._next=null}function Hk(e,t,r){var i=new Uv;return i.restart(e,t,r),i}function aZ(){Hv(),++Jm;for(var e=Wk,t;e;)(t=rp-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jm}function rZ(){rp=(qk=qv.now())+Uk,Jm=Vv=0;try{aZ()}finally{Jm=0,CBe(),rp=0}}function TBe(){var e=qv.now(),t=e-qk;t>iZ&&(Uk-=t,qk=e)}function CBe(){for(var e,t=Wk,r,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Wk=r);Wv=e,xR(i)}function xR(e){if(!Jm){Vv&&(Vv=clearTimeout(Vv));var t=e-rp;t>24?(e<1/0&&(Vv=setTimeout(rZ,e-qv.now()-Uk)),Gv&&(Gv=clearInterval(Gv))):(Gv||(qk=qv.now(),Gv=setInterval(TBe,iZ)),Jm=1,nZ(rZ))}}var Jm,Vv,Gv,iZ,Wk,Wv,qk,rp,Uk,qv,nZ,bR=z(()=>{"use strict";Jm=0,Vv=0,Gv=0,iZ=1e3,qk=0,rp=0,Uk=0,qv=typeof performance=="object"&&performance.now?performance:Date,nZ=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};o(Hv,"now");o(bBe,"clearNow");o(Uv,"Timer");Uv.prototype=Hk.prototype={constructor:Uv,restart:o(function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Hv():+r)+(t==null?0:+t),!this._next&&Wv!==this&&(Wv?Wv._next=this:Wk=this,Wv=this),this._call=e,this._time=r,xR()},"restart"),stop:o(function(){this._call&&(this._call=null,this._time=1/0,xR())},"stop")};o(Hk,"timer");o(aZ,"timerFlush");o(rZ,"wake");o(TBe,"poke");o(CBe,"nap");o(xR,"sleep")});function Yv(e,t,r){var i=new Uv;return t=t==null?0:+t,i.restart(n=>{i.stop(),e(n+t)},t,r),i}var sZ=z(()=>{"use strict";bR();o(Yv,"default")});var Yk=z(()=>{"use strict";bR();sZ()});function Au(e,t,r,i,n,a){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;SBe(e,r,{name:t,index:i,group:n,on:kBe,tween:wBe,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:cZ})}function Xv(e,t){var r=$n(e,t);if(r.state>cZ)throw new Error("too late; already scheduled");return r}function ha(e,t){var r=$n(e,t);if(r.state>jk)throw new Error("too late; already running");return r}function $n(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function SBe(e,t,r){var i=e.__transition,n;i[t]=r,r.timer=Hk(a,0,r.time);function a(h){r.state=oZ,r.timer.restart(s,r.delay,r.time),r.delay<=h&&s(h-r.delay)}o(a,"schedule");function s(h){var d,f,p,m;if(r.state!==oZ)return u();for(d in i)if(m=i[d],m.name===r.name){if(m.state===jk)return Yv(s);m.state===lZ?(m.state=jv,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete i[d]):+d{"use strict";t8();Yk();kBe=e8("start","end","cancel","interrupt"),wBe=[],cZ=0,oZ=1,Xk=2,jk=3,lZ=4,Kk=5,jv=6;o(Au,"default");o(Xv,"init");o(ha,"set");o($n,"get");o(SBe,"create")});function Kv(e,t){var r=e.__transition,i,n,a=!0,s;if(r){t=t==null?null:t+"";for(s in r){if((i=r[s]).name!==t){a=!1;continue}n=i.state>Xk&&i.state{"use strict";ws();o(Kv,"default")});function TR(e){return this.each(function(){Kv(this,e)})}var hZ=z(()=>{"use strict";uZ();o(TR,"default")});function EBe(e,t){var r,i;return function(){var n=ha(this,e),a=n.tween;if(a!==r){i=r=a;for(var s=0,l=i.length;s{"use strict";ws();o(EBe,"tweenRemove");o(ABe,"tweenFunction");o(CR,"default");o(eg,"tweenValue")});function Qv(e,t){var r;return(typeof t=="number"?Zn:t instanceof Tl?tp:(r=Tl(t))?(t=r,tp):Zm)(e,t)}var kR=z(()=>{"use strict";Xm();Qm();o(Qv,"default")});function _Be(e){return function(){this.removeAttribute(e)}}function DBe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function RBe(e,t,r){var i,n=r+"",a;return function(){var s=this.getAttribute(e);return s===n?null:s===i?a:a=t(i=s,r)}}function LBe(e,t,r){var i,n=r+"",a;return function(){var s=this.getAttributeNS(e.space,e.local);return s===n?null:s===i?a:a=t(i=s,r)}}function MBe(e,t,r){var i,n,a;return function(){var s,l=r(this),u;return l==null?void this.removeAttribute(e):(s=this.getAttribute(e),u=l+"",s===u?null:s===i&&u===n?a:(n=u,a=t(i=s,l)))}}function NBe(e,t,r){var i,n,a;return function(){var s,l=r(this),u;return l==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),u=l+"",s===u?null:s===i&&u===n?a:(n=u,a=t(i=s,l)))}}function wR(e,t){var r=dc(e),i=r==="transform"?yR:Qv;return this.attrTween(e,typeof t=="function"?(r.local?NBe:MBe)(r,i,eg(this,"attr."+e,t)):t==null?(r.local?DBe:_Be)(r):(r.local?LBe:RBe)(r,i,t))}var dZ=z(()=>{"use strict";Qm();xl();Zv();kR();o(_Be,"attrRemove");o(DBe,"attrRemoveNS");o(RBe,"attrConstant");o(LBe,"attrConstantNS");o(MBe,"attrFunction");o(NBe,"attrFunctionNS");o(wR,"default")});function IBe(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function OBe(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function PBe(e,t){var r,i;function n(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&OBe(e,a)),r}return o(n,"tween"),n._value=t,n}function BBe(e,t){var r,i;function n(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&IBe(e,a)),r}return o(n,"tween"),n._value=t,n}function SR(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var i=dc(e);return this.tween(r,(i.local?PBe:BBe)(i,t))}var fZ=z(()=>{"use strict";xl();o(IBe,"attrInterpolate");o(OBe,"attrInterpolateNS");o(PBe,"attrTweenNS");o(BBe,"attrTween");o(SR,"default")});function FBe(e,t){return function(){Xv(this,e).delay=+t.apply(this,arguments)}}function $Be(e,t){return t=+t,function(){Xv(this,e).delay=t}}function ER(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?FBe:$Be)(t,e)):$n(this.node(),t).delay}var pZ=z(()=>{"use strict";ws();o(FBe,"delayFunction");o($Be,"delayConstant");o(ER,"default")});function zBe(e,t){return function(){ha(this,e).duration=+t.apply(this,arguments)}}function GBe(e,t){return t=+t,function(){ha(this,e).duration=t}}function AR(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?zBe:GBe)(t,e)):$n(this.node(),t).duration}var mZ=z(()=>{"use strict";ws();o(zBe,"durationFunction");o(GBe,"durationConstant");o(AR,"default")});function VBe(e,t){if(typeof t!="function")throw new Error;return function(){ha(this,e).ease=t}}function _R(e){var t=this._id;return arguments.length?this.each(VBe(t,e)):$n(this.node(),t).ease}var gZ=z(()=>{"use strict";ws();o(VBe,"easeConstant");o(_R,"default")});function WBe(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;ha(this,e).ease=r}}function DR(e){if(typeof e!="function")throw new Error;return this.each(WBe(this._id,e))}var yZ=z(()=>{"use strict";ws();o(WBe,"easeVarying");o(DR,"default")});function RR(e){typeof e!="function"&&(e=qm(e));for(var t=this._groups,r=t.length,i=new Array(r),n=0;n{"use strict";xl();ip();o(RR,"default")});function LR(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,i=t.length,n=r.length,a=Math.min(i,n),s=new Array(i),l=0;l{"use strict";ip();o(LR,"default")});function qBe(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function UBe(e,t,r){var i,n,a=qBe(t)?Xv:ha;return function(){var s=a(this,e),l=s.on;l!==i&&(n=(i=l).copy()).on(t,r),s.on=n}}function MR(e,t){var r=this._id;return arguments.length<2?$n(this.node(),r).on.on(e):this.each(UBe(r,e,t))}var bZ=z(()=>{"use strict";ws();o(qBe,"start");o(UBe,"onFunction");o(MR,"default")});function HBe(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function NR(){return this.on("end.remove",HBe(this._id))}var TZ=z(()=>{"use strict";o(HBe,"removeFunction");o(NR,"default")});function IR(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Uh(e));for(var i=this._groups,n=i.length,a=new Array(n),s=0;s{"use strict";xl();ip();ws();o(IR,"default")});function OR(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Wm(e));for(var i=this._groups,n=i.length,a=[],s=[],l=0;l{"use strict";xl();ip();ws();o(OR,"default")});function PR(){return new YBe(this._groups,this._parents)}var YBe,wZ=z(()=>{"use strict";xl();YBe=wu.prototype.constructor;o(PR,"default")});function jBe(e,t){var r,i,n;return function(){var a=Hh(this,e),s=(this.style.removeProperty(e),Hh(this,e));return a===s?null:a===r&&s===i?n:n=t(r=a,i=s)}}function SZ(e){return function(){this.style.removeProperty(e)}}function XBe(e,t,r){var i,n=r+"",a;return function(){var s=Hh(this,e);return s===n?null:s===i?a:a=t(i=s,r)}}function KBe(e,t,r){var i,n,a;return function(){var s=Hh(this,e),l=r(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(e),Hh(this,e))),s===u?null:s===i&&u===n?a:(n=u,a=t(i=s,l))}}function ZBe(e,t){var r,i,n,a="style."+t,s="end."+a,l;return function(){var u=ha(this,e),h=u.on,d=u.value[a]==null?l||(l=SZ(t)):void 0;(h!==r||n!==d)&&(i=(r=h).copy()).on(s,n=d),u.on=i}}function BR(e,t,r){var i=(e+="")=="transform"?gR:Qv;return t==null?this.styleTween(e,jBe(e,i)).on("end.style."+e,SZ(e)):typeof t=="function"?this.styleTween(e,KBe(e,i,eg(this,"style."+e,t))).each(ZBe(this._id,e)):this.styleTween(e,XBe(e,i,t),r).on("end.style."+e,null)}var EZ=z(()=>{"use strict";Qm();xl();ws();Zv();kR();o(jBe,"styleNull");o(SZ,"styleRemove");o(XBe,"styleConstant");o(KBe,"styleFunction");o(ZBe,"styleMaybeRemove");o(BR,"default")});function QBe(e,t,r){return function(i){this.style.setProperty(e,t.call(this,i),r)}}function JBe(e,t,r){var i,n;function a(){var s=t.apply(this,arguments);return s!==n&&(i=(n=s)&&QBe(e,s,r)),i}return o(a,"tween"),a._value=t,a}function FR(e,t,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,JBe(e,t,r??""))}var AZ=z(()=>{"use strict";o(QBe,"styleInterpolate");o(JBe,"styleTween");o(FR,"default")});function eFe(e){return function(){this.textContent=e}}function tFe(e){return function(){var t=e(this);this.textContent=t??""}}function $R(e){return this.tween("text",typeof e=="function"?tFe(eg(this,"text",e)):eFe(e==null?"":e+""))}var _Z=z(()=>{"use strict";Zv();o(eFe,"textConstant");o(tFe,"textFunction");o($R,"default")});function rFe(e){return function(t){this.textContent=e.call(this,t)}}function iFe(e){var t,r;function i(){var n=e.apply(this,arguments);return n!==r&&(t=(r=n)&&rFe(n)),t}return o(i,"tween"),i._value=e,i}function zR(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,iFe(e))}var DZ=z(()=>{"use strict";o(rFe,"textInterpolate");o(iFe,"textTween");o(zR,"default")});function GR(){for(var e=this._name,t=this._id,r=Zk(),i=this._groups,n=i.length,a=0;a{"use strict";ip();ws();o(GR,"default")});function VR(){var e,t,r=this,i=r._id,n=r.size();return new Promise(function(a,s){var l={value:s},u={value:o(function(){--n===0&&a()},"value")};r.each(function(){var h=ha(this,i),d=h.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(u)),h.on=t}),n===0&&a()})}var LZ=z(()=>{"use strict";ws();o(VR,"default")});function Ka(e,t,r,i){this._groups=e,this._parents=t,this._name=r,this._id=i}function MZ(e){return wu().transition(e)}function Zk(){return++nFe}var nFe,_u,ip=z(()=>{"use strict";xl();dZ();fZ();pZ();mZ();gZ();yZ();vZ();xZ();bZ();TZ();CZ();kZ();wZ();EZ();AZ();_Z();DZ();RZ();Zv();LZ();nFe=0;o(Ka,"Transition");o(MZ,"transition");o(Zk,"newId");_u=wu.prototype;Ka.prototype=MZ.prototype={constructor:Ka,select:IR,selectAll:OR,selectChild:_u.selectChild,selectChildren:_u.selectChildren,filter:RR,merge:LR,selection:PR,transition:GR,call:_u.call,nodes:_u.nodes,node:_u.node,size:_u.size,empty:_u.empty,each:_u.each,on:MR,attr:wR,attrTween:SR,style:BR,styleTween:FR,text:$R,textTween:zR,remove:NR,tween:CR,delay:ER,duration:AR,ease:_R,easeVarying:DR,end:VR,[Symbol.iterator]:_u[Symbol.iterator]}});function Qk(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var NZ=z(()=>{"use strict";o(Qk,"cubicInOut")});var WR=z(()=>{"use strict";NZ()});function sFe(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function qR(e){var t,r;e instanceof Ka?(t=e._id,e=e._name):(t=Zk(),(r=aFe).time=Hv(),e=e==null?null:e+"");for(var i=this._groups,n=i.length,a=0;a{"use strict";ip();ws();WR();Yk();aFe={time:null,delay:0,duration:250,ease:Qk};o(sFe,"inherit");o(qR,"default")});var OZ=z(()=>{"use strict";xl();hZ();IZ();wu.prototype.interrupt=TR;wu.prototype.transition=qR});var Jk=z(()=>{"use strict";OZ()});var PZ=z(()=>{"use strict"});var BZ=z(()=>{"use strict"});var FZ=z(()=>{"use strict"});function $Z(e){return[+e[0],+e[1]]}function oFe(e){return[$Z(e[0]),$Z(e[1])]}function UR(e){return{type:e}}var TBt,CBt,kBt,wBt,SBt,EBt,zZ=z(()=>{"use strict";Jk();PZ();BZ();FZ();({abs:TBt,max:CBt,min:kBt}=Math);o($Z,"number1");o(oFe,"number2");wBt={name:"x",handles:["w","e"].map(UR),input:o(function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},"input"),output:o(function(e){return e&&[e[0][0],e[1][0]]},"output")},SBt={name:"y",handles:["n","s"].map(UR),input:o(function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},"input"),output:o(function(e){return e&&[e[0][1],e[1][1]]},"output")},EBt={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(UR),input:o(function(e){return e==null?null:oFe(e)},"input"),output:o(function(e){return e},"output")};o(UR,"type")});var GZ=z(()=>{"use strict";zZ()});function VZ(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return VZ;let r=10**t;return function(i){this._+=i[0];for(let n=1,a=i.length;n{"use strict";HR=Math.PI,YR=2*HR,np=1e-6,lFe=YR-np;o(VZ,"append");o(cFe,"appendRound");ap=class{static{o(this,"Path")}constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?VZ:cFe(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,i,n){this._append`Q${+t},${+r},${this._x1=+i},${this._y1=+n}`}bezierCurveTo(t,r,i,n,a,s){this._append`C${+t},${+r},${+i},${+n},${this._x1=+a},${this._y1=+s}`}arcTo(t,r,i,n,a){if(t=+t,r=+r,i=+i,n=+n,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,l=this._y1,u=i-t,h=n-r,d=s-t,f=l-r,p=d*d+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(p>np)if(!(Math.abs(f*u-h*d)>np)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let m=i-s,g=n-l,y=u*u+h*h,v=m*m+g*g,x=Math.sqrt(y),b=Math.sqrt(p),T=a*Math.tan((HR-Math.acos((y+p-v)/(2*x*b)))/2),w=T/b,C=T/x;Math.abs(w-1)>np&&this._append`L${t+w*d},${r+w*f}`,this._append`A${a},${a},0,0,${+(f*m>d*g)},${this._x1=t+C*u},${this._y1=r+C*h}`}}arc(t,r,i,n,a,s){if(t=+t,r=+r,i=+i,s=!!s,i<0)throw new Error(`negative radius: ${i}`);let l=i*Math.cos(n),u=i*Math.sin(n),h=t+l,d=r+u,f=1^s,p=s?n-a:a-n;this._x1===null?this._append`M${h},${d}`:(Math.abs(this._x1-h)>np||Math.abs(this._y1-d)>np)&&this._append`L${h},${d}`,i&&(p<0&&(p=p%YR+YR),p>lFe?this._append`A${i},${i},0,1,${f},${t-l},${r-u}A${i},${i},0,1,${f},${this._x1=h},${this._y1=d}`:p>np&&this._append`A${i},${i},0,${+(p>=HR)},${f},${this._x1=t+i*Math.cos(a)},${this._y1=r+i*Math.sin(a)}`)}rect(t,r,i,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${i=+i}v${+n}h${-i}Z`}toString(){return this._}};o(WZ,"path");WZ.prototype=ap.prototype});var jR=z(()=>{"use strict";qZ()});var UZ=z(()=>{"use strict"});var HZ=z(()=>{"use strict"});var YZ=z(()=>{"use strict"});var jZ=z(()=>{"use strict"});var XZ=z(()=>{"use strict"});var KZ=z(()=>{"use strict"});var ZZ=z(()=>{"use strict"});function XR(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function sp(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,i=e.slice(0,r);return[i.length>1?i[0]+i.slice(2):i,+e.slice(r+1)]}var Jv=z(()=>{"use strict";o(XR,"default");o(sp,"formatDecimalParts")});function Cl(e){return e=sp(Math.abs(e)),e?e[1]:NaN}var ex=z(()=>{"use strict";Jv();o(Cl,"default")});function KR(e,t){return function(r,i){for(var n=r.length,a=[],s=0,l=e[0],u=0;n>0&&l>0&&(u+l+1>i&&(l=Math.max(1,i-u)),a.push(r.substring(n-=l,n+l)),!((u+=l+1)>i));)l=e[s=(s+1)%e.length];return a.reverse().join(t)}}var QZ=z(()=>{"use strict";o(KR,"default")});function ZR(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var JZ=z(()=>{"use strict";o(ZR,"default")});function Kh(e){if(!(t=uFe.exec(e)))throw new Error("invalid format: "+e);var t;return new ew({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function ew(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}var uFe,QR=z(()=>{"use strict";uFe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;o(Kh,"formatSpecifier");Kh.prototype=ew.prototype;o(ew,"FormatSpecifier");ew.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type}});function JR(e){e:for(var t=e.length,r=1,i=-1,n;r0&&(i=0);break}return i>0?e.slice(0,i)+e.slice(n+1):e}var eQ=z(()=>{"use strict";o(JR,"default")});function tL(e,t){var r=sp(e,t);if(!r)return e+"";var i=r[0],n=r[1],a=n-(eL=Math.max(-8,Math.min(8,Math.floor(n/3)))*3)+1,s=i.length;return a===s?i:a>s?i+new Array(a-s+1).join("0"):a>0?i.slice(0,a)+"."+i.slice(a):"0."+new Array(1-a).join("0")+sp(e,Math.max(0,t+a-1))[0]}var eL,rL=z(()=>{"use strict";Jv();o(tL,"default")});function tw(e,t){var r=sp(e,t);if(!r)return e+"";var i=r[0],n=r[1];return n<0?"0."+new Array(-n).join("0")+i:i.length>n+1?i.slice(0,n+1)+"."+i.slice(n+1):i+new Array(n-i.length+2).join("0")}var tQ=z(()=>{"use strict";Jv();o(tw,"default")});var iL,rQ=z(()=>{"use strict";Jv();rL();tQ();iL={"%":o((e,t)=>(e*100).toFixed(t),"%"),b:o(e=>Math.round(e).toString(2),"b"),c:o(e=>e+"","c"),d:XR,e:o((e,t)=>e.toExponential(t),"e"),f:o((e,t)=>e.toFixed(t),"f"),g:o((e,t)=>e.toPrecision(t),"g"),o:o(e=>Math.round(e).toString(8),"o"),p:o((e,t)=>tw(e*100,t),"p"),r:tw,s:tL,X:o(e=>Math.round(e).toString(16).toUpperCase(),"X"),x:o(e=>Math.round(e).toString(16),"x")}});function rw(e){return e}var iQ=z(()=>{"use strict";o(rw,"default")});function nL(e){var t=e.grouping===void 0||e.thousands===void 0?rw:KR(nQ.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",i=e.currency===void 0?"":e.currency[1]+"",n=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?rw:ZR(nQ.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"\u2212":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function h(f){f=Kh(f);var p=f.fill,m=f.align,g=f.sign,y=f.symbol,v=f.zero,x=f.width,b=f.comma,T=f.precision,w=f.trim,C=f.type;C==="n"?(b=!0,C="g"):iL[C]||(T===void 0&&(T=12),w=!0,C="g"),(v||p==="0"&&m==="=")&&(v=!0,p="0",m="=");var k=y==="$"?r:y==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",E=y==="$"?i:/[%p]/.test(C)?s:"",A=iL[C],N=/[defgprs%]/.test(C);T=T===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,T)):Math.max(0,Math.min(20,T));function P(I){var D=k,_=E,R,M,L;if(C==="c")_=A(I)+_,I="";else{I=+I;var B=I<0||1/I<0;if(I=isNaN(I)?u:A(Math.abs(I),T),w&&(I=JR(I)),B&&+I==0&&g!=="+"&&(B=!1),D=(B?g==="("?g:l:g==="-"||g==="("?"":g)+D,_=(C==="s"?aQ[8+eL/3]:"")+_+(B&&g==="("?")":""),N){for(R=-1,M=I.length;++RL||L>57){_=(L===46?n+I.slice(R+1):I.slice(R))+_,I=I.slice(0,R);break}}}b&&!v&&(I=t(I,1/0));var O=D.length+I.length+_.length,$=O>1)+D+I+_+$.slice(O);break;default:I=$+D+I+_;break}return a(I)}return o(P,"format"),P.toString=function(){return f+""},P}o(h,"newFormat");function d(f,p){var m=h((f=Kh(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(Cl(p)/3)))*3,y=Math.pow(10,-g),v=aQ[8+g/3];return function(x){return m(y*x)+v}}return o(d,"formatPrefix"),{format:h,formatPrefix:d}}var nQ,aQ,sQ=z(()=>{"use strict";ex();QZ();JZ();QR();eQ();rQ();rL();iQ();nQ=Array.prototype.map,aQ=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];o(nL,"default")});function aL(e){return iw=nL(e),mc=iw.format,nw=iw.formatPrefix,iw}var iw,mc,nw,oQ=z(()=>{"use strict";sQ();aL({thousands:",",grouping:[3],currency:["$",""]});o(aL,"defaultLocale")});function aw(e){return Math.max(0,-Cl(Math.abs(e)))}var lQ=z(()=>{"use strict";ex();o(aw,"default")});function sw(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Cl(t)/3)))*3-Cl(Math.abs(e)))}var cQ=z(()=>{"use strict";ex();o(sw,"default")});function ow(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Cl(t)-Cl(e))+1}var uQ=z(()=>{"use strict";ex();o(ow,"default")});var sL=z(()=>{"use strict";oQ();QR();lQ();cQ();uQ()});var hQ=z(()=>{"use strict"});function hFe(e){var t=0,r=e.children,i=r&&r.length;if(!i)t=1;else for(;--i>=0;)t+=r[i].value;e.value=t}function oL(){return this.eachAfter(hFe)}var dQ=z(()=>{"use strict";o(hFe,"count");o(oL,"default")});function lL(e,t){let r=-1;for(let i of this)e.call(t,i,++r,this);return this}var fQ=z(()=>{"use strict";o(lL,"default")});function cL(e,t){for(var r=this,i=[r],n,a,s=-1;r=i.pop();)if(e.call(t,r,++s,this),n=r.children)for(a=n.length-1;a>=0;--a)i.push(n[a]);return this}var pQ=z(()=>{"use strict";o(cL,"default")});function uL(e,t){for(var r=this,i=[r],n=[],a,s,l,u=-1;r=i.pop();)if(n.push(r),a=r.children)for(s=0,l=a.length;s{"use strict";o(uL,"default")});function hL(e,t){let r=-1;for(let i of this)if(e.call(t,i,++r,this))return i}var gQ=z(()=>{"use strict";o(hL,"default")});function dL(e){return this.eachAfter(function(t){for(var r=+e(t.data)||0,i=t.children,n=i&&i.length;--n>=0;)r+=i[n].value;t.value=r})}var yQ=z(()=>{"use strict";o(dL,"default")});function fL(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}var vQ=z(()=>{"use strict";o(fL,"default")});function pL(e){for(var t=this,r=dFe(t,e),i=[t];t!==r;)t=t.parent,i.push(t);for(var n=i.length;e!==r;)i.splice(n,0,e),e=e.parent;return i}function dFe(e,t){if(e===t)return e;var r=e.ancestors(),i=t.ancestors(),n=null;for(e=r.pop(),t=i.pop();e===t;)n=e,e=r.pop(),t=i.pop();return n}var xQ=z(()=>{"use strict";o(pL,"default");o(dFe,"leastCommonAncestor")});function mL(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}var bQ=z(()=>{"use strict";o(mL,"default")});function gL(){return Array.from(this)}var TQ=z(()=>{"use strict";o(gL,"default")});function yL(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}var CQ=z(()=>{"use strict";o(yL,"default")});function vL(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}var kQ=z(()=>{"use strict";o(vL,"default")});function*xL(){var e=this,t,r=[e],i,n,a;do for(t=r.reverse(),r=[];e=t.pop();)if(yield e,i=e.children)for(n=0,a=i.length;n{"use strict";o(xL,"default")});function tg(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=mFe)):t===void 0&&(t=pFe);for(var r=new tx(e),i,n=[r],a,s,l,u;i=n.pop();)if((s=t(i.data))&&(u=(s=Array.from(s)).length))for(i.children=s,l=u-1;l>=0;--l)n.push(a=s[l]=new tx(s[l])),a.parent=i,a.depth=i.depth+1;return r.eachBefore(yFe)}function fFe(){return tg(this).eachBefore(gFe)}function pFe(e){return e.children}function mFe(e){return Array.isArray(e)?e[1]:null}function gFe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function yFe(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function tx(e){this.data=e,this.depth=this.height=0,this.parent=null}var SQ=z(()=>{"use strict";dQ();fQ();pQ();mQ();gQ();yQ();vQ();xQ();bQ();TQ();CQ();kQ();wQ();o(tg,"hierarchy");o(fFe,"node_copy");o(pFe,"objectChildren");o(mFe,"mapChildren");o(gFe,"copyData");o(yFe,"computeHeight");o(tx,"Node");tx.prototype=tg.prototype={constructor:tx,count:oL,each:lL,eachAfter:uL,eachBefore:cL,find:hL,sum:dL,sort:fL,path:pL,ancestors:mL,descendants:gL,leaves:yL,links:vL,copy:fFe,[Symbol.iterator]:xL}});function EQ(e){if(typeof e!="function")throw new Error;return e}var AQ=z(()=>{"use strict";o(EQ,"required")});function rg(){return 0}function op(e){return function(){return e}}var _Q=z(()=>{"use strict";o(rg,"constantZero");o(op,"default")});function bL(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}var DQ=z(()=>{"use strict";o(bL,"default")});function TL(e,t,r,i,n){for(var a=e.children,s,l=-1,u=a.length,h=e.value&&(i-t)/e.value;++l{"use strict";o(TL,"default")});function CL(e,t,r,i,n){for(var a=e.children,s,l=-1,u=a.length,h=e.value&&(n-r)/e.value;++l{"use strict";o(CL,"default")});function xFe(e,t,r,i,n,a){for(var s=[],l=t.children,u,h,d=0,f=0,p=l.length,m,g,y=t.value,v,x,b,T,w,C,k;db&&(b=h),k=v*v*C,T=Math.max(b/k,k/x),T>w){v-=h;break}w=T}s.push(u={value:v,dice:m{"use strict";RQ();LQ();vFe=(1+Math.sqrt(5))/2;o(xFe,"squarifyRatio");MQ=o((function e(t){function r(i,n,a,s,l){xFe(t,i,n,a,s,l)}return o(r,"squarify"),r.ratio=function(i){return e((i=+i)>1?i:1)},r}),"custom")(vFe)});function lw(){var e=MQ,t=!1,r=1,i=1,n=[0],a=rg,s=rg,l=rg,u=rg,h=rg;function d(p){return p.x0=p.y0=0,p.x1=r,p.y1=i,p.eachBefore(f),n=[0],t&&p.eachBefore(bL),p}o(d,"treemap");function f(p){var m=n[p.depth],g=p.x0+m,y=p.y0+m,v=p.x1-m,x=p.y1-m;v{"use strict";DQ();NQ();AQ();_Q();o(lw,"default")});var OQ=z(()=>{"use strict";SQ();IQ()});var PQ=z(()=>{"use strict"});var BQ=z(()=>{"use strict"});function Zh(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var rx=z(()=>{"use strict";o(Zh,"initRange")});function ro(){var e=new Gm,t=[],r=[],i=kL;function n(a){let s=e.get(a);if(s===void 0){if(i!==kL)return i;e.set(a,s=t.push(a)-1)}return r[s%r.length]}return o(n,"scale"),n.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new Gm;for(let s of a)e.has(s)||e.set(s,t.push(s)-1);return n},n.range=function(a){return arguments.length?(r=Array.from(a),n):r.slice()},n.unknown=function(a){return arguments.length?(i=a,n):i},n.copy=function(){return ro(t,r).unknown(i)},Zh.apply(n,arguments),n}var kL,wL=z(()=>{"use strict";qh();rx();kL=Symbol("implicit");o(ro,"ordinal")});function ig(){var e=ro().unknown(void 0),t=e.domain,r=e.range,i=0,n=1,a,s,l=!1,u=0,h=0,d=.5;delete e.unknown;function f(){var p=t().length,m=n{"use strict";qh();rx();wL();o(ig,"band")});function SL(e){return function(){return e}}var $Q=z(()=>{"use strict";o(SL,"constants")});function EL(e){return+e}var zQ=z(()=>{"use strict";o(EL,"number")});function ng(e){return e}function AL(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:SL(isNaN(t)?NaN:.5)}function bFe(e,t){var r;return e>t&&(r=e,e=t,t=r),function(i){return Math.max(e,Math.min(t,i))}}function TFe(e,t,r){var i=e[0],n=e[1],a=t[0],s=t[1];return n2?CFe:TFe,u=h=null,f}o(d,"rescale");function f(p){return p==null||isNaN(p=+p)?a:(u||(u=l(e.map(i),t,r)))(i(s(p)))}return o(f,"scale"),f.invert=function(p){return s(n((h||(h=l(t,e.map(i),Zn)))(p)))},f.domain=function(p){return arguments.length?(e=Array.from(p,EL),d()):e.slice()},f.range=function(p){return arguments.length?(t=Array.from(p),d()):t.slice()},f.rangeRound=function(p){return t=Array.from(p),r=$k,d()},f.clamp=function(p){return arguments.length?(s=p?!0:ng,d()):s!==ng},f.interpolate=function(p){return arguments.length?(r=p,d()):r},f.unknown=function(p){return arguments.length?(a=p,f):a},function(p,m){return i=p,n=m,d()}}function ix(){return kFe()(ng,ng)}var GQ,_L=z(()=>{"use strict";qh();Qm();$Q();zQ();GQ=[0,1];o(ng,"identity");o(AL,"normalize");o(bFe,"clamper");o(TFe,"bimap");o(CFe,"polymap");o(cw,"copy");o(kFe,"transformer");o(ix,"continuous")});function DL(e,t,r,i){var n=Vm(e,t,r),a;switch(i=Kh(i??",f"),i.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return i.precision==null&&!isNaN(a=sw(n,s))&&(i.precision=a),nw(i,s)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(a=ow(n,Math.max(Math.abs(e),Math.abs(t))))&&(i.precision=a-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(a=aw(n))&&(i.precision=a-(i.type==="%")*2);break}}return mc(i)}var VQ=z(()=>{"use strict";qh();sL();o(DL,"tickFormat")});function wFe(e){var t=e.domain;return e.ticks=function(r){var i=t();return Ck(i[0],i[i.length-1],r??10)},e.tickFormat=function(r,i){var n=t();return DL(n[0],n[n.length-1],r??10,i)},e.nice=function(r){r==null&&(r=10);var i=t(),n=0,a=i.length-1,s=i[n],l=i[a],u,h,d=10;for(l0;){if(h=Lv(s,l,r),h===u)return i[n]=s,i[a]=l,t(i);if(h>0)s=Math.floor(s/h)*h,l=Math.ceil(l/h)*h;else if(h<0)s=Math.ceil(s*h)/h,l=Math.floor(l*h)/h;else break;u=h}return e},e}function kl(){var e=ix();return e.copy=function(){return cw(e,kl())},Zh.apply(e,arguments),wFe(e)}var WQ=z(()=>{"use strict";qh();_L();rx();VQ();o(wFe,"linearish");o(kl,"linear")});function RL(e,t){e=e.slice();var r=0,i=e.length-1,n=e[r],a=e[i],s;return a{"use strict";o(RL,"nice")});function ki(e,t,r,i){function n(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return o(n,"interval"),n.floor=a=>(e(a=new Date(+a)),a),n.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),n.round=a=>{let s=n(a),l=n.ceil(a);return a-s(t(a=new Date(+a),s==null?1:Math.floor(s)),a),n.range=(a,s,l)=>{let u=[];if(a=n.ceil(a),l=l==null?1:Math.floor(l),!(a0))return u;let h;do u.push(h=new Date(+a)),t(a,l),e(a);while(hki(s=>{if(s>=s)for(;e(s),!a(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;t(s,-1),!a(s););else for(;--l>=0;)for(;t(s,1),!a(s););}),r&&(n.count=(a,s)=>(LL.setTime(+a),ML.setTime(+s),e(LL),e(ML),Math.floor(r(LL,ML))),n.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?n.filter(i?s=>i(s)%a===0:s=>n.count(0,s)%a===0):n)),n}var LL,ML,Du=z(()=>{"use strict";LL=new Date,ML=new Date;o(ki,"timeInterval")});var gc,UQ,NL=z(()=>{"use strict";Du();gc=ki(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);gc.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ki(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):gc);UQ=gc.range});var io,HQ,IL=z(()=>{"use strict";Du();io=ki(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),HQ=io.range});var Ru,SFe,uw,EFe,OL=z(()=>{"use strict";Du();Ru=ki(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),SFe=Ru.range,uw=ki(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),EFe=uw.range});var Lu,AFe,hw,_Fe,PL=z(()=>{"use strict";Du();Lu=ki(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),AFe=Lu.range,hw=ki(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),_Fe=hw.range});var Oo,DFe,ax,RFe,dw,LFe,BL=z(()=>{"use strict";Du();Oo=ki(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),DFe=Oo.range,ax=ki(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),RFe=ax.range,dw=ki(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),LFe=dw.range});function up(e){return ki(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}function hp(e){return ki(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var wl,Qh,fw,pw,vc,mw,gw,jQ,MFe,NFe,IFe,OFe,PFe,BFe,dp,ag,XQ,KQ,Jh,ZQ,QQ,JQ,FFe,$Fe,zFe,GFe,VFe,WFe,FL=z(()=>{"use strict";Du();o(up,"timeWeekday");wl=up(0),Qh=up(1),fw=up(2),pw=up(3),vc=up(4),mw=up(5),gw=up(6),jQ=wl.range,MFe=Qh.range,NFe=fw.range,IFe=pw.range,OFe=vc.range,PFe=mw.range,BFe=gw.range;o(hp,"utcWeekday");dp=hp(0),ag=hp(1),XQ=hp(2),KQ=hp(3),Jh=hp(4),ZQ=hp(5),QQ=hp(6),JQ=dp.range,FFe=ag.range,$Fe=XQ.range,zFe=KQ.range,GFe=Jh.range,VFe=ZQ.range,WFe=QQ.range});var Mu,qFe,yw,UFe,$L=z(()=>{"use strict";Du();Mu=ki(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),qFe=Mu.range,yw=ki(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),UFe=yw.range});var no,HFe,Sl,YFe,zL=z(()=>{"use strict";Du();no=ki(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());no.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ki(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});HFe=no.range,Sl=ki(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Sl.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ki(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});YFe=Sl.range});function tJ(e,t,r,i,n,a){let s=[[io,1,1e3],[io,5,5*1e3],[io,15,15*1e3],[io,30,30*1e3],[a,1,6e4],[a,5,5*6e4],[a,15,15*6e4],[a,30,30*6e4],[n,1,36e5],[n,3,3*36e5],[n,6,6*36e5],[n,12,12*36e5],[i,1,864e5],[i,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function l(h,d,f){let p=dv).right(s,p);if(m===s.length)return e.every(Vm(h/31536e6,d/31536e6,f));if(m===0)return gc.every(Math.max(Vm(h,d,f),1));let[g,y]=s[p/s[m-1][2]{"use strict";qh();NL();IL();OL();PL();BL();FL();$L();zL();o(tJ,"ticker");[XFe,KFe]=tJ(Sl,yw,dp,dw,hw,uw),[GL,VL]=tJ(no,Mu,wl,Oo,Lu,Ru)});var vw=z(()=>{"use strict";NL();IL();OL();PL();BL();FL();$L();zL();rJ()});function WL(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function qL(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function sx(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function UL(e){var t=e.dateTime,r=e.date,i=e.time,n=e.periods,a=e.days,s=e.shortDays,l=e.months,u=e.shortMonths,h=ox(n),d=lx(n),f=ox(a),p=lx(a),m=ox(s),g=lx(s),y=ox(l),v=lx(l),x=ox(u),b=lx(u),T={a:B,A:O,b:$,B:G,c:null,d:lJ,e:lJ,f:x$e,g:D$e,G:L$e,H:g$e,I:y$e,j:v$e,L:fJ,m:b$e,M:T$e,p:F,q:V,Q:hJ,s:dJ,S:C$e,u:k$e,U:w$e,V:S$e,w:E$e,W:A$e,x:null,X:null,y:_$e,Y:R$e,Z:M$e,"%":uJ},w={a:H,A:j,b:U,B:Q,c:null,d:cJ,e:cJ,f:P$e,g:H$e,G:j$e,H:N$e,I:I$e,j:O$e,L:mJ,m:B$e,M:F$e,p:Y,q:ae,Q:hJ,s:dJ,S:$$e,u:z$e,U:G$e,V:V$e,w:W$e,W:q$e,x:null,X:null,y:U$e,Y:Y$e,Z:X$e,"%":uJ},C={a:P,A:I,b:D,B:_,c:R,d:sJ,e:sJ,f:d$e,g:aJ,G:nJ,H:oJ,I:oJ,j:l$e,L:h$e,m:o$e,M:c$e,p:N,q:s$e,Q:p$e,s:m$e,S:u$e,u:t$e,U:r$e,V:i$e,w:e$e,W:n$e,x:M,X:L,y:aJ,Y:nJ,Z:a$e,"%":f$e};T.x=k(r,T),T.X=k(i,T),T.c=k(t,T),w.x=k(r,w),w.X=k(i,w),w.c=k(t,w);function k(J,te){return function(re){var ee=[],Te=-1,ue=0,De=J.length,Ie,Ee,we;for(re instanceof Date||(re=new Date(+re));++Te53)return null;"w"in ee||(ee.w=1),"Z"in ee?(ue=qL(sx(ee.y,0,1)),De=ue.getUTCDay(),ue=De>4||De===0?ag.ceil(ue):ag(ue),ue=ax.offset(ue,(ee.V-1)*7),ee.y=ue.getUTCFullYear(),ee.m=ue.getUTCMonth(),ee.d=ue.getUTCDate()+(ee.w+6)%7):(ue=WL(sx(ee.y,0,1)),De=ue.getDay(),ue=De>4||De===0?Qh.ceil(ue):Qh(ue),ue=Oo.offset(ue,(ee.V-1)*7),ee.y=ue.getFullYear(),ee.m=ue.getMonth(),ee.d=ue.getDate()+(ee.w+6)%7)}else("W"in ee||"U"in ee)&&("w"in ee||(ee.w="u"in ee?ee.u%7:"W"in ee?1:0),De="Z"in ee?qL(sx(ee.y,0,1)).getUTCDay():WL(sx(ee.y,0,1)).getDay(),ee.m=0,ee.d="W"in ee?(ee.w+6)%7+ee.W*7-(De+5)%7:ee.w+ee.U*7-(De+6)%7);return"Z"in ee?(ee.H+=ee.Z/100|0,ee.M+=ee.Z%100,qL(ee)):WL(ee)}}o(E,"newParse");function A(J,te,re,ee){for(var Te=0,ue=te.length,De=re.length,Ie,Ee;Te=De)return-1;if(Ie=te.charCodeAt(Te++),Ie===37){if(Ie=te.charAt(Te++),Ee=C[Ie in iJ?te.charAt(Te++):Ie],!Ee||(ee=Ee(J,re,ee))<0)return-1}else if(Ie!=re.charCodeAt(ee++))return-1}return ee}o(A,"parseSpecifier");function N(J,te,re){var ee=h.exec(te.slice(re));return ee?(J.p=d.get(ee[0].toLowerCase()),re+ee[0].length):-1}o(N,"parsePeriod");function P(J,te,re){var ee=m.exec(te.slice(re));return ee?(J.w=g.get(ee[0].toLowerCase()),re+ee[0].length):-1}o(P,"parseShortWeekday");function I(J,te,re){var ee=f.exec(te.slice(re));return ee?(J.w=p.get(ee[0].toLowerCase()),re+ee[0].length):-1}o(I,"parseWeekday");function D(J,te,re){var ee=x.exec(te.slice(re));return ee?(J.m=b.get(ee[0].toLowerCase()),re+ee[0].length):-1}o(D,"parseShortMonth");function _(J,te,re){var ee=y.exec(te.slice(re));return ee?(J.m=v.get(ee[0].toLowerCase()),re+ee[0].length):-1}o(_,"parseMonth");function R(J,te,re){return A(J,t,te,re)}o(R,"parseLocaleDateTime");function M(J,te,re){return A(J,r,te,re)}o(M,"parseLocaleDate");function L(J,te,re){return A(J,i,te,re)}o(L,"parseLocaleTime");function B(J){return s[J.getDay()]}o(B,"formatShortWeekday");function O(J){return a[J.getDay()]}o(O,"formatWeekday");function $(J){return u[J.getMonth()]}o($,"formatShortMonth");function G(J){return l[J.getMonth()]}o(G,"formatMonth");function F(J){return n[+(J.getHours()>=12)]}o(F,"formatPeriod");function V(J){return 1+~~(J.getMonth()/3)}o(V,"formatQuarter");function H(J){return s[J.getUTCDay()]}o(H,"formatUTCShortWeekday");function j(J){return a[J.getUTCDay()]}o(j,"formatUTCWeekday");function U(J){return u[J.getUTCMonth()]}o(U,"formatUTCShortMonth");function Q(J){return l[J.getUTCMonth()]}o(Q,"formatUTCMonth");function Y(J){return n[+(J.getUTCHours()>=12)]}o(Y,"formatUTCPeriod");function ae(J){return 1+~~(J.getUTCMonth()/3)}return o(ae,"formatUTCQuarter"),{format:o(function(J){var te=k(J+="",T);return te.toString=function(){return J},te},"format"),parse:o(function(J){var te=E(J+="",!1);return te.toString=function(){return J},te},"parse"),utcFormat:o(function(J){var te=k(J+="",w);return te.toString=function(){return J},te},"utcFormat"),utcParse:o(function(J){var te=E(J+="",!0);return te.toString=function(){return J},te},"utcParse")}}function Qr(e,t,r){var i=e<0?"-":"",n=(i?-e:e)+"",a=n.length;return i+(a[t.toLowerCase(),r]))}function e$e(e,t,r){var i=Qn.exec(t.slice(r,r+1));return i?(e.w=+i[0],r+i[0].length):-1}function t$e(e,t,r){var i=Qn.exec(t.slice(r,r+1));return i?(e.u=+i[0],r+i[0].length):-1}function r$e(e,t,r){var i=Qn.exec(t.slice(r,r+2));return i?(e.U=+i[0],r+i[0].length):-1}function i$e(e,t,r){var i=Qn.exec(t.slice(r,r+2));return i?(e.V=+i[0],r+i[0].length):-1}function n$e(e,t,r){var i=Qn.exec(t.slice(r,r+2));return i?(e.W=+i[0],r+i[0].length):-1}function nJ(e,t,r){var i=Qn.exec(t.slice(r,r+4));return i?(e.y=+i[0],r+i[0].length):-1}function aJ(e,t,r){var i=Qn.exec(t.slice(r,r+2));return i?(e.y=+i[0]+(+i[0]>68?1900:2e3),r+i[0].length):-1}function a$e(e,t,r){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return i?(e.Z=i[1]?0:-(i[2]+(i[3]||"00")),r+i[0].length):-1}function s$e(e,t,r){var i=Qn.exec(t.slice(r,r+1));return i?(e.q=i[0]*3-3,r+i[0].length):-1}function o$e(e,t,r){var i=Qn.exec(t.slice(r,r+2));return i?(e.m=i[0]-1,r+i[0].length):-1}function sJ(e,t,r){var i=Qn.exec(t.slice(r,r+2));return i?(e.d=+i[0],r+i[0].length):-1}function l$e(e,t,r){var i=Qn.exec(t.slice(r,r+3));return i?(e.m=0,e.d=+i[0],r+i[0].length):-1}function oJ(e,t,r){var i=Qn.exec(t.slice(r,r+2));return i?(e.H=+i[0],r+i[0].length):-1}function c$e(e,t,r){var i=Qn.exec(t.slice(r,r+2));return i?(e.M=+i[0],r+i[0].length):-1}function u$e(e,t,r){var i=Qn.exec(t.slice(r,r+2));return i?(e.S=+i[0],r+i[0].length):-1}function h$e(e,t,r){var i=Qn.exec(t.slice(r,r+3));return i?(e.L=+i[0],r+i[0].length):-1}function d$e(e,t,r){var i=Qn.exec(t.slice(r,r+6));return i?(e.L=Math.floor(i[0]/1e3),r+i[0].length):-1}function f$e(e,t,r){var i=ZFe.exec(t.slice(r,r+1));return i?r+i[0].length:-1}function p$e(e,t,r){var i=Qn.exec(t.slice(r));return i?(e.Q=+i[0],r+i[0].length):-1}function m$e(e,t,r){var i=Qn.exec(t.slice(r));return i?(e.s=+i[0],r+i[0].length):-1}function lJ(e,t){return Qr(e.getDate(),t,2)}function g$e(e,t){return Qr(e.getHours(),t,2)}function y$e(e,t){return Qr(e.getHours()%12||12,t,2)}function v$e(e,t){return Qr(1+Oo.count(no(e),e),t,3)}function fJ(e,t){return Qr(e.getMilliseconds(),t,3)}function x$e(e,t){return fJ(e,t)+"000"}function b$e(e,t){return Qr(e.getMonth()+1,t,2)}function T$e(e,t){return Qr(e.getMinutes(),t,2)}function C$e(e,t){return Qr(e.getSeconds(),t,2)}function k$e(e){var t=e.getDay();return t===0?7:t}function w$e(e,t){return Qr(wl.count(no(e)-1,e),t,2)}function pJ(e){var t=e.getDay();return t>=4||t===0?vc(e):vc.ceil(e)}function S$e(e,t){return e=pJ(e),Qr(vc.count(no(e),e)+(no(e).getDay()===4),t,2)}function E$e(e){return e.getDay()}function A$e(e,t){return Qr(Qh.count(no(e)-1,e),t,2)}function _$e(e,t){return Qr(e.getFullYear()%100,t,2)}function D$e(e,t){return e=pJ(e),Qr(e.getFullYear()%100,t,2)}function R$e(e,t){return Qr(e.getFullYear()%1e4,t,4)}function L$e(e,t){var r=e.getDay();return e=r>=4||r===0?vc(e):vc.ceil(e),Qr(e.getFullYear()%1e4,t,4)}function M$e(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Qr(t/60|0,"0",2)+Qr(t%60,"0",2)}function cJ(e,t){return Qr(e.getUTCDate(),t,2)}function N$e(e,t){return Qr(e.getUTCHours(),t,2)}function I$e(e,t){return Qr(e.getUTCHours()%12||12,t,2)}function O$e(e,t){return Qr(1+ax.count(Sl(e),e),t,3)}function mJ(e,t){return Qr(e.getUTCMilliseconds(),t,3)}function P$e(e,t){return mJ(e,t)+"000"}function B$e(e,t){return Qr(e.getUTCMonth()+1,t,2)}function F$e(e,t){return Qr(e.getUTCMinutes(),t,2)}function $$e(e,t){return Qr(e.getUTCSeconds(),t,2)}function z$e(e){var t=e.getUTCDay();return t===0?7:t}function G$e(e,t){return Qr(dp.count(Sl(e)-1,e),t,2)}function gJ(e){var t=e.getUTCDay();return t>=4||t===0?Jh(e):Jh.ceil(e)}function V$e(e,t){return e=gJ(e),Qr(Jh.count(Sl(e),e)+(Sl(e).getUTCDay()===4),t,2)}function W$e(e){return e.getUTCDay()}function q$e(e,t){return Qr(ag.count(Sl(e)-1,e),t,2)}function U$e(e,t){return Qr(e.getUTCFullYear()%100,t,2)}function H$e(e,t){return e=gJ(e),Qr(e.getUTCFullYear()%100,t,2)}function Y$e(e,t){return Qr(e.getUTCFullYear()%1e4,t,4)}function j$e(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Jh(e):Jh.ceil(e),Qr(e.getUTCFullYear()%1e4,t,4)}function X$e(){return"+0000"}function uJ(){return"%"}function hJ(e){return+e}function dJ(e){return Math.floor(+e/1e3)}var iJ,Qn,ZFe,QFe,yJ=z(()=>{"use strict";vw();o(WL,"localDate");o(qL,"utcDate");o(sx,"newDate");o(UL,"formatLocale");iJ={"-":"",_:" ",0:"0"},Qn=/^\s*\d+/,ZFe=/^%/,QFe=/[\\^$*+?|[\]().{}]/g;o(Qr,"pad");o(JFe,"requote");o(ox,"formatRe");o(lx,"formatLookup");o(e$e,"parseWeekdayNumberSunday");o(t$e,"parseWeekdayNumberMonday");o(r$e,"parseWeekNumberSunday");o(i$e,"parseWeekNumberISO");o(n$e,"parseWeekNumberMonday");o(nJ,"parseFullYear");o(aJ,"parseYear");o(a$e,"parseZone");o(s$e,"parseQuarter");o(o$e,"parseMonthNumber");o(sJ,"parseDayOfMonth");o(l$e,"parseDayOfYear");o(oJ,"parseHour24");o(c$e,"parseMinutes");o(u$e,"parseSeconds");o(h$e,"parseMilliseconds");o(d$e,"parseMicroseconds");o(f$e,"parseLiteralPercent");o(p$e,"parseUnixTimestamp");o(m$e,"parseUnixTimestampSeconds");o(lJ,"formatDayOfMonth");o(g$e,"formatHour24");o(y$e,"formatHour12");o(v$e,"formatDayOfYear");o(fJ,"formatMilliseconds");o(x$e,"formatMicroseconds");o(b$e,"formatMonthNumber");o(T$e,"formatMinutes");o(C$e,"formatSeconds");o(k$e,"formatWeekdayNumberMonday");o(w$e,"formatWeekNumberSunday");o(pJ,"dISO");o(S$e,"formatWeekNumberISO");o(E$e,"formatWeekdayNumberSunday");o(A$e,"formatWeekNumberMonday");o(_$e,"formatYear");o(D$e,"formatYearISO");o(R$e,"formatFullYear");o(L$e,"formatFullYearISO");o(M$e,"formatZone");o(cJ,"formatUTCDayOfMonth");o(N$e,"formatUTCHour24");o(I$e,"formatUTCHour12");o(O$e,"formatUTCDayOfYear");o(mJ,"formatUTCMilliseconds");o(P$e,"formatUTCMicroseconds");o(B$e,"formatUTCMonthNumber");o(F$e,"formatUTCMinutes");o($$e,"formatUTCSeconds");o(z$e,"formatUTCWeekdayNumberMonday");o(G$e,"formatUTCWeekNumberSunday");o(gJ,"UTCdISO");o(V$e,"formatUTCWeekNumberISO");o(W$e,"formatUTCWeekdayNumberSunday");o(q$e,"formatUTCWeekNumberMonday");o(U$e,"formatUTCYear");o(H$e,"formatUTCYearISO");o(Y$e,"formatUTCFullYear");o(j$e,"formatUTCFullYearISO");o(X$e,"formatUTCZone");o(uJ,"formatLiteralPercent");o(hJ,"formatUnixTimestamp");o(dJ,"formatUnixTimestampSeconds")});function HL(e){return sg=UL(e),fp=sg.format,vJ=sg.parse,xJ=sg.utcFormat,bJ=sg.utcParse,sg}var sg,fp,vJ,xJ,bJ,TJ=z(()=>{"use strict";yJ();HL({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});o(HL,"defaultLocale")});var YL=z(()=>{"use strict";TJ()});function K$e(e){return new Date(e)}function Z$e(e){return e instanceof Date?+e:+new Date(+e)}function CJ(e,t,r,i,n,a,s,l,u,h){var d=ix(),f=d.invert,p=d.domain,m=h(".%L"),g=h(":%S"),y=h("%I:%M"),v=h("%I %p"),x=h("%a %d"),b=h("%b %d"),T=h("%B"),w=h("%Y");function C(k){return(u(k){"use strict";vw();YL();_L();rx();qQ();o(K$e,"date");o(Z$e,"number");o(CJ,"calendar");o(xw,"time")});var wJ=z(()=>{"use strict";FQ();WQ();wL();kJ()});function jL(e){for(var t=e.length/6|0,r=new Array(t),i=0;i{"use strict";o(jL,"default")});var XL,EJ=z(()=>{"use strict";SJ();XL=jL("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab")});var AJ=z(()=>{"use strict";EJ()});function Fi(e){return o(function(){return e},"constant")}var bw=z(()=>{"use strict";o(Fi,"default")});function DJ(e){return e>1?0:e<-1?og:Math.acos(e)}function ZL(e){return e>=1?cx:e<=-1?-cx:Math.asin(e)}var KL,da,ed,_J,Tw,El,pp,Jn,og,cx,lg,Cw=z(()=>{"use strict";KL=Math.abs,da=Math.atan2,ed=Math.cos,_J=Math.max,Tw=Math.min,El=Math.sin,pp=Math.sqrt,Jn=1e-12,og=Math.PI,cx=og/2,lg=2*og;o(DJ,"acos");o(ZL,"asin")});function kw(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let i=Math.floor(r);if(!(i>=0))throw new RangeError(`invalid digits: ${r}`);t=i}return e},()=>new ap(t)}var QL=z(()=>{"use strict";jR();o(kw,"withPath")});function Q$e(e){return e.innerRadius}function J$e(e){return e.outerRadius}function eze(e){return e.startAngle}function tze(e){return e.endAngle}function rze(e){return e&&e.padAngle}function ize(e,t,r,i,n,a,s,l){var u=r-e,h=i-t,d=s-n,f=l-a,p=f*u-d*h;if(!(p*pR*R+M*M&&(A=P,N=I),{cx:A,cy:N,x01:-d,y01:-f,x11:A*(n/C-1),y11:N*(n/C-1)}}function Al(){var e=Q$e,t=J$e,r=Fi(0),i=null,n=eze,a=tze,s=rze,l=null,u=kw(h);function h(){var d,f,p=+e.apply(this,arguments),m=+t.apply(this,arguments),g=n.apply(this,arguments)-cx,y=a.apply(this,arguments)-cx,v=KL(y-g),x=y>g;if(l||(l=d=u()),mJn))l.moveTo(0,0);else if(v>lg-Jn)l.moveTo(m*ed(g),m*El(g)),l.arc(0,0,m,g,y,!x),p>Jn&&(l.moveTo(p*ed(y),p*El(y)),l.arc(0,0,p,y,g,x));else{var b=g,T=y,w=g,C=y,k=v,E=v,A=s.apply(this,arguments)/2,N=A>Jn&&(i?+i.apply(this,arguments):pp(p*p+m*m)),P=Tw(KL(m-p)/2,+r.apply(this,arguments)),I=P,D=P,_,R;if(N>Jn){var M=ZL(N/p*El(A)),L=ZL(N/m*El(A));(k-=M*2)>Jn?(M*=x?1:-1,w+=M,C-=M):(k=0,w=C=(g+y)/2),(E-=L*2)>Jn?(L*=x?1:-1,b+=L,T-=L):(E=0,b=T=(g+y)/2)}var B=m*ed(b),O=m*El(b),$=p*ed(C),G=p*El(C);if(P>Jn){var F=m*ed(T),V=m*El(T),H=p*ed(w),j=p*El(w),U;if(vJn?D>Jn?(_=ww(H,j,B,O,m,D,x),R=ww(F,V,$,G,m,D,x),l.moveTo(_.cx+_.x01,_.cy+_.y01),DJn)||!(k>Jn)?l.lineTo($,G):I>Jn?(_=ww($,G,F,V,p,-I,x),R=ww(B,O,H,j,p,-I,x),l.lineTo(_.cx+_.x01,_.cy+_.y01),I{"use strict";bw();Cw();QL();o(Q$e,"arcInnerRadius");o(J$e,"arcOuterRadius");o(eze,"arcStartAngle");o(tze,"arcEndAngle");o(rze,"arcPadAngle");o(ize,"intersect");o(ww,"cornerTangents");o(Al,"default")});function ux(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}var uVt,JL=z(()=>{"use strict";uVt=Array.prototype.slice;o(ux,"default")});function LJ(e){this._context=e}function xc(e){return new LJ(e)}var eM=z(()=>{"use strict";o(LJ,"Linear");LJ.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._point=0},"lineStart"),lineEnd:o(function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}},"point")};o(xc,"default")});function MJ(e){return e[0]}function NJ(e){return e[1]}var IJ=z(()=>{"use strict";o(MJ,"x");o(NJ,"y")});function _l(e,t){var r=Fi(!0),i=null,n=xc,a=null,s=kw(l);e=typeof e=="function"?e:e===void 0?MJ:Fi(e),t=typeof t=="function"?t:t===void 0?NJ:Fi(t);function l(u){var h,d=(u=ux(u)).length,f,p=!1,m;for(i==null&&(a=n(m=s())),h=0;h<=d;++h)!(h{"use strict";JL();bw();eM();QL();IJ();o(_l,"default")});function tM(e,t){return te?1:t>=e?0:NaN}var PJ=z(()=>{"use strict";o(tM,"default")});function rM(e){return e}var BJ=z(()=>{"use strict";o(rM,"default")});function Sw(){var e=rM,t=tM,r=null,i=Fi(0),n=Fi(lg),a=Fi(0);function s(l){var u,h=(l=ux(l)).length,d,f,p=0,m=new Array(h),g=new Array(h),y=+i.apply(this,arguments),v=Math.min(lg,Math.max(-lg,n.apply(this,arguments)-y)),x,b=Math.min(Math.abs(v)/h,a.apply(this,arguments)),T=b*(v<0?-1:1),w;for(u=0;u0&&(p+=w);for(t!=null?m.sort(function(C,k){return t(g[C],g[k])}):r!=null&&m.sort(function(C,k){return r(l[C],l[k])}),u=0,f=p?(v-h*T)/p:0;u0?w*f:0)+T,g[d]={data:l[d],index:u,value:w,startAngle:y,endAngle:x,padAngle:b};return g}return o(s,"pie"),s.value=function(l){return arguments.length?(e=typeof l=="function"?l:Fi(+l),s):e},s.sortValues=function(l){return arguments.length?(t=l,r=null,s):t},s.sort=function(l){return arguments.length?(r=l,t=null,s):r},s.startAngle=function(l){return arguments.length?(i=typeof l=="function"?l:Fi(+l),s):i},s.endAngle=function(l){return arguments.length?(n=typeof l=="function"?l:Fi(+l),s):n},s.padAngle=function(l){return arguments.length?(a=typeof l=="function"?l:Fi(+l),s):a},s}var FJ=z(()=>{"use strict";JL();bw();PJ();BJ();Cw();o(Sw,"default")});function hx(e){return new Ew(e,!0)}function dx(e){return new Ew(e,!1)}var Ew,$J=z(()=>{"use strict";Ew=class{static{o(this,"Bump")}constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}};o(hx,"bumpX");o(dx,"bumpY")});function ao(){}var fx=z(()=>{"use strict";o(ao,"default")});function cg(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function px(e){this._context=e}function Dl(e){return new px(e)}var mx=z(()=>{"use strict";o(cg,"point");o(px,"Basis");px.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 3:cg(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:cg(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t},"point")};o(Dl,"default")});function zJ(e){this._context=e}function Aw(e){return new zJ(e)}var GJ=z(()=>{"use strict";fx();mx();o(zJ,"BasisClosed");zJ.prototype={areaStart:ao,areaEnd:ao,lineStart:o(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},"lineEnd"),point:o(function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:cg(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t},"point")};o(Aw,"default")});function VJ(e){this._context=e}function _w(e){return new VJ(e)}var WJ=z(()=>{"use strict";mx();o(VJ,"BasisOpen");VJ.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},"lineStart"),lineEnd:o(function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,i=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,i):this._context.moveTo(r,i);break;case 3:this._point=4;default:cg(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t},"point")};o(_w,"default")});function qJ(e,t){this._basis=new px(e),this._beta=t}var iM,UJ=z(()=>{"use strict";mx();o(qJ,"Bundle");qJ.prototype={lineStart:o(function(){this._x=[],this._y=[],this._basis.lineStart()},"lineStart"),lineEnd:o(function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var i=e[0],n=t[0],a=e[r]-i,s=t[r]-n,l=-1,u;++l<=r;)u=l/r,this._basis.point(this._beta*e[l]+(1-this._beta)*(i+u*a),this._beta*t[l]+(1-this._beta)*(n+u*s));this._x=this._y=null,this._basis.lineEnd()},"lineEnd"),point:o(function(e,t){this._x.push(+e),this._y.push(+t)},"point")};iM=o((function e(t){function r(i){return t===1?new px(i):new qJ(i,t)}return o(r,"bundle"),r.beta=function(i){return e(+i)},r}),"custom")(.85)});function ug(e,t,r){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-r),e._x2,e._y2)}function Dw(e,t){this._context=e,this._k=(1-t)/6}var gx,yx=z(()=>{"use strict";o(ug,"point");o(Dw,"Cardinal");Dw.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ug(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:ug(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t},"point")};gx=o((function e(t){function r(i){return new Dw(i,t)}return o(r,"cardinal"),r.tension=function(i){return e(+i)},r}),"custom")(0)});function Rw(e,t){this._context=e,this._k=(1-t)/6}var nM,aM=z(()=>{"use strict";fx();yx();o(Rw,"CardinalClosed");Rw.prototype={areaStart:ao,areaEnd:ao,lineStart:o(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},"lineEnd"),point:o(function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:ug(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t},"point")};nM=o((function e(t){function r(i){return new Rw(i,t)}return o(r,"cardinal"),r.tension=function(i){return e(+i)},r}),"custom")(0)});function Lw(e,t){this._context=e,this._k=(1-t)/6}var sM,oM=z(()=>{"use strict";yx();o(Lw,"CardinalOpen");Lw.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:o(function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:ug(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t},"point")};sM=o((function e(t){function r(i){return new Lw(i,t)}return o(r,"cardinal"),r.tension=function(i){return e(+i)},r}),"custom")(0)});function vx(e,t,r){var i=e._x1,n=e._y1,a=e._x2,s=e._y2;if(e._l01_a>Jn){var l=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,u=3*e._l01_a*(e._l01_a+e._l12_a);i=(i*l-e._x0*e._l12_2a+e._x2*e._l01_2a)/u,n=(n*l-e._y0*e._l12_2a+e._y2*e._l01_2a)/u}if(e._l23_a>Jn){var h=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,d=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*h+e._x1*e._l23_2a-t*e._l12_2a)/d,s=(s*h+e._y1*e._l23_2a-r*e._l12_2a)/d}e._context.bezierCurveTo(i,n,a,s,e._x2,e._y2)}function HJ(e,t){this._context=e,this._alpha=t}var xx,Mw=z(()=>{"use strict";Cw();yx();o(vx,"point");o(HJ,"CatmullRom");HJ.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:vx(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t},"point")};xx=o((function e(t){function r(i){return t?new HJ(i,t):new Dw(i,0)}return o(r,"catmullRom"),r.alpha=function(i){return e(+i)},r}),"custom")(.5)});function YJ(e,t){this._context=e,this._alpha=t}var lM,jJ=z(()=>{"use strict";aM();fx();Mw();o(YJ,"CatmullRomClosed");YJ.prototype={areaStart:ao,areaEnd:ao,lineStart:o(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},"lineEnd"),point:o(function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+i*i,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:vx(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t},"point")};lM=o((function e(t){function r(i){return t?new YJ(i,t):new Rw(i,0)}return o(r,"catmullRom"),r.alpha=function(i){return e(+i)},r}),"custom")(.5)});function XJ(e,t){this._context=e,this._alpha=t}var cM,KJ=z(()=>{"use strict";oM();Mw();o(XJ,"CatmullRomOpen");XJ.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:o(function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(e,t){if(e=+e,t=+t,this._point){var r=this._x2-e,i=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+i*i,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:vx(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t},"point")};cM=o((function e(t){function r(i){return t?new XJ(i,t):new Lw(i,0)}return o(r,"catmullRom"),r.alpha=function(i){return e(+i)},r}),"custom")(.5)});function ZJ(e){this._context=e}function Nw(e){return new ZJ(e)}var QJ=z(()=>{"use strict";fx();o(ZJ,"LinearClosed");ZJ.prototype={areaStart:ao,areaEnd:ao,lineStart:o(function(){this._point=0},"lineStart"),lineEnd:o(function(){this._point&&this._context.closePath()},"lineEnd"),point:o(function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))},"point")};o(Nw,"default")});function JJ(e){return e<0?-1:1}function eee(e,t,r){var i=e._x1-e._x0,n=t-e._x1,a=(e._y1-e._y0)/(i||n<0&&-0),s=(r-e._y1)/(n||i<0&&-0),l=(a*n+s*i)/(i+n);return(JJ(a)+JJ(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(l))||0}function tee(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function uM(e,t,r){var i=e._x0,n=e._y0,a=e._x1,s=e._y1,l=(a-i)/3;e._context.bezierCurveTo(i+l,n+l*t,a-l,s-l*r,a,s)}function Iw(e){this._context=e}function ree(e){this._context=new iee(e)}function iee(e){this._context=e}function bx(e){return new Iw(e)}function Tx(e){return new ree(e)}var nee=z(()=>{"use strict";o(JJ,"sign");o(eee,"slope3");o(tee,"slope2");o(uM,"point");o(Iw,"MonotoneX");Iw.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},"lineStart"),lineEnd:o(function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:uM(this,this._t0,tee(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:o(function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,uM(this,tee(this,r=eee(this,e,t)),r);break;default:uM(this,this._t0,r=eee(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}},"point")};o(ree,"MonotoneY");(ree.prototype=Object.create(Iw.prototype)).point=function(e,t){Iw.prototype.point.call(this,t,e)};o(iee,"ReflectContext");iee.prototype={moveTo:o(function(e,t){this._context.moveTo(t,e)},"moveTo"),closePath:o(function(){this._context.closePath()},"closePath"),lineTo:o(function(e,t){this._context.lineTo(t,e)},"lineTo"),bezierCurveTo:o(function(e,t,r,i,n,a){this._context.bezierCurveTo(t,e,i,r,a,n)},"bezierCurveTo")};o(bx,"monotoneX");o(Tx,"monotoneY")});function see(e){this._context=e}function aee(e){var t,r=e.length-1,i,n=new Array(r),a=new Array(r),s=new Array(r);for(n[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t=0;--t)n[t]=(s[t]-n[t+1])/a[t];for(a[r-1]=(e[r]+n[r-1])/2,t=0;t{"use strict";o(see,"Natural");see.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x=[],this._y=[]},"lineStart"),lineEnd:o(function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var i=aee(e),n=aee(t),a=0,s=1;s{"use strict";o(Ow,"Step");Ow.prototype={areaStart:o(function(){this._line=0},"areaStart"),areaEnd:o(function(){this._line=NaN},"areaEnd"),lineStart:o(function(){this._x=this._y=NaN,this._point=0},"lineStart"),lineEnd:o(function(){0=0&&(this._t=1-this._t,this._line=1-this._line)},"lineEnd"),point:o(function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t},"point")};o(dg,"default");o(Cx,"stepBefore");o(kx,"stepAfter")});var cee=z(()=>{"use strict";RJ();OJ();FJ();GJ();WJ();mx();$J();UJ();aM();oM();yx();jJ();KJ();Mw();QJ();eM();nee();oee();lee()});var uee=z(()=>{"use strict"});var hee=z(()=>{"use strict"});function td(e,t,r){this.k=e,this.x=t,this.y=r}function dM(e){for(;!e.__zoom;)if(!(e=e.parentNode))return hM;return e.__zoom}var hM,fM=z(()=>{"use strict";o(td,"Transform");td.prototype={constructor:td,scale:o(function(e){return e===1?this:new td(this.k*e,this.x,this.y)},"scale"),translate:o(function(e,t){return e===0&t===0?this:new td(this.k,this.x+this.k*e,this.y+this.k*t)},"translate"),apply:o(function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},"apply"),applyX:o(function(e){return e*this.k+this.x},"applyX"),applyY:o(function(e){return e*this.k+this.y},"applyY"),invert:o(function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},"invert"),invertX:o(function(e){return(e-this.x)/this.k},"invertX"),invertY:o(function(e){return(e-this.y)/this.k},"invertY"),rescaleX:o(function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},"rescaleX"),rescaleY:o(function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},"rescaleY"),toString:o(function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"},"toString")};hM=new td(1,0,0);dM.prototype=td.prototype;o(dM,"transform")});var dee=z(()=>{"use strict"});var fee=z(()=>{"use strict";Jk();uee();hee();fM();dee()});var pee=z(()=>{"use strict";fee();fM()});var Rr=z(()=>{"use strict";qh();CX();GZ();UZ();Xm();HZ();YZ();t8();fK();jZ();WR();XZ();ZZ();sL();hQ();OQ();Qm();jR();PQ();KZ();BQ();wJ();AJ();xl();cee();vw();YL();Yk();Jk();pee()});var mee=Js(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.BLANK_URL=ea.relativeFirstCharacters=ea.whitespaceEscapeCharsRegex=ea.urlSchemeRegex=ea.ctrlCharactersRegex=ea.htmlCtrlEntityRegex=ea.htmlEntitiesRegex=ea.invalidProtocolRegex=void 0;ea.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im;ea.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g;ea.htmlCtrlEntityRegex=/&(newline|tab);/gi;ea.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim;ea.urlSchemeRegex=/^.+(:|:)/gim;ea.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;ea.relativeFirstCharacters=[".","/"];ea.BLANK_URL="about:blank"});var fg=Js(Pw=>{"use strict";Object.defineProperty(Pw,"__esModule",{value:!0});Pw.sanitizeUrl=void 0;var Da=mee();function nze(e){return Da.relativeFirstCharacters.indexOf(e[0])>-1}o(nze,"isRelativeUrlWithoutProtocol");function aze(e){var t=e.replace(Da.ctrlCharactersRegex,"");return t.replace(Da.htmlEntitiesRegex,function(r,i){return String.fromCharCode(i)})}o(aze,"decodeHtmlCharacters");function sze(e){return URL.canParse(e)}o(sze,"isValidUrl");function gee(e){try{return decodeURIComponent(e)}catch{return e}}o(gee,"decodeURI");function oze(e){if(!e)return Da.BLANK_URL;var t,r=gee(e.trim());do r=aze(r).replace(Da.htmlCtrlEntityRegex,"").replace(Da.ctrlCharactersRegex,"").replace(Da.whitespaceEscapeCharsRegex,"").trim(),r=gee(r),t=r.match(Da.ctrlCharactersRegex)||r.match(Da.htmlEntitiesRegex)||r.match(Da.htmlCtrlEntityRegex)||r.match(Da.whitespaceEscapeCharsRegex);while(t&&t.length>0);var i=r;if(!i)return Da.BLANK_URL;if(nze(i))return i;var n=i.trimStart(),a=n.match(Da.urlSchemeRegex);if(!a)return i;var s=a[0].toLowerCase().trim();if(Da.invalidProtocolRegex.test(s))return Da.BLANK_URL;var l=n.replace(/\\/g,"/");if(s==="mailto:"||s.includes("://"))return l;if(s==="http:"||s==="https:"){if(!sze(l))return Da.BLANK_URL;var u=new URL(l);return u.protocol=u.protocol.toLowerCase(),u.hostname=u.hostname.toLowerCase(),u.toString()}return l}o(oze,"sanitizeUrl");Pw.sanitizeUrl=oze});var pM,mp,Bw,yee,Fw,$w,fa,wx,zw,gp=z(()=>{"use strict";pM=ys(fg(),1);Rr();Ir();mp=o((e,t)=>{let r=e.append("rect");if(r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),t.name&&r.attr("name",t.name),t.rx&&r.attr("rx",t.rx),t.ry&&r.attr("ry",t.ry),t.attrs!==void 0)for(let i in t.attrs)r.attr(i,t.attrs[i]);return t.class&&r.attr("class",t.class),r},"drawRect"),Bw=o((e,t)=>{let r={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};mp(e,r).lower()},"drawBackgroundRect"),yee=o((e,t)=>{let r=t.text.replace(Uf," "),i=e.append("text");i.attr("x",t.x),i.attr("y",t.y),i.attr("class","legend"),i.style("text-anchor",t.anchor),t.class&&i.attr("class",t.class);let n=i.append("tspan");return n.attr("x",t.x+t.textMargin*2),n.text(r),i},"drawText"),Fw=o((e,t,r,i)=>{let n=e.append("image");n.attr("x",t),n.attr("y",r);let a=(0,pM.sanitizeUrl)(i);n.attr("xlink:href",a)},"drawImage"),$w=o((e,t,r,i)=>{let n=e.append("use");n.attr("x",t),n.attr("y",r);let a=(0,pM.sanitizeUrl)(i);n.attr("xlink:href",`#${a}`)},"drawEmbeddedImage"),fa=o(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),wx=o(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),zw=o(()=>{let e=Je(".mermaidTooltip");return e.empty()&&(e=Je("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),e},"createTooltip")});var vee,mM,xee,lze,cze,uze,hze,dze,fze,pze,mze,gze,yze,vze,Nu,Rl,bee=z(()=>{"use strict";Ir();gp();vee=ys(fg(),1),mM=o(function(e,t){return mp(e,t)},"drawRect"),xee=o(function(e,t,r,i,n,a){let s=e.append("image");s.attr("width",t),s.attr("height",r),s.attr("x",i),s.attr("y",n);let l=a.startsWith("data:image/png;base64")?a:(0,vee.sanitizeUrl)(a);s.attr("xlink:href",l)},"drawImage"),lze=o((e,t,r,i)=>{let n=e.append("g"),a=0;for(let s of t){let l=s.textColor?s.textColor:"#444444",u=s.lineColor?s.lineColor:"#444444",h=s.offsetX?parseInt(s.offsetX):0,d=s.offsetY?parseInt(s.offsetY):0,f="";if(a===0){let m=n.append("line");m.attr("x1",s.startPoint.x),m.attr("y1",s.startPoint.y),m.attr("x2",s.endPoint.x),m.attr("y2",s.endPoint.y),m.attr("stroke-width","1"),m.attr("stroke",u),m.style("fill","none"),s.type!=="rel_b"&&m.attr("marker-end","url("+f+"#"+i+"-arrowhead)"),(s.type==="birel"||s.type==="rel_b")&&m.attr("marker-start","url("+f+"#"+i+"-arrowend)"),a=-1}else{let m=n.append("path");m.attr("fill","none").attr("stroke-width","1").attr("stroke",u).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",s.startPoint.x).replaceAll("starty",s.startPoint.y).replaceAll("controlx",s.startPoint.x+(s.endPoint.x-s.startPoint.x)/2-(s.endPoint.x-s.startPoint.x)/4).replaceAll("controly",s.startPoint.y+(s.endPoint.y-s.startPoint.y)/2).replaceAll("stopx",s.endPoint.x).replaceAll("stopy",s.endPoint.y)),s.type!=="rel_b"&&m.attr("marker-end","url("+f+"#"+i+"-arrowhead)"),(s.type==="birel"||s.type==="rel_b")&&m.attr("marker-start","url("+f+"#"+i+"-arrowend)")}let p=r.messageFont();Nu(r)(s.label.text,n,Math.min(s.startPoint.x,s.endPoint.x)+Math.abs(s.endPoint.x-s.startPoint.x)/2+h,Math.min(s.startPoint.y,s.endPoint.y)+Math.abs(s.endPoint.y-s.startPoint.y)/2+d,s.label.width,s.label.height,{fill:l},p),s.techn&&s.techn.text!==""&&(p=r.messageFont(),Nu(r)("["+s.techn.text+"]",n,Math.min(s.startPoint.x,s.endPoint.x)+Math.abs(s.endPoint.x-s.startPoint.x)/2+h,Math.min(s.startPoint.y,s.endPoint.y)+Math.abs(s.endPoint.y-s.startPoint.y)/2+r.messageFontSize+5+d,Math.max(s.label.width,s.techn.width),s.techn.height,{fill:l,"font-style":"italic"},p))}},"drawRels"),cze=o(function(e,t,r){let i=e.append("g"),n=t.bgColor?t.bgColor:"none",a=t.borderColor?t.borderColor:"#444444",s=t.fontColor?t.fontColor:"black",l={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};t.nodeType&&(l={"stroke-width":1});let u={x:t.x,y:t.y,fill:n,stroke:a,width:t.width,height:t.height,rx:2.5,ry:2.5,attrs:l};mM(i,u);let h=r.boundaryFont();h.fontWeight="bold",h.fontSize=h.fontSize+2,h.fontColor=s,Nu(r)(t.label.text,i,t.x,t.y+t.label.Y,t.width,t.height,{fill:"#444444"},h),t.type&&t.type.text!==""&&(h=r.boundaryFont(),h.fontColor=s,Nu(r)(t.type.text,i,t.x,t.y+t.type.Y,t.width,t.height,{fill:"#444444"},h)),t.descr&&t.descr.text!==""&&(h=r.boundaryFont(),h.fontSize=h.fontSize-2,h.fontColor=s,Nu(r)(t.descr.text,i,t.x,t.y+t.descr.Y,t.width,t.height,{fill:"#444444"},h))},"drawBoundary"),uze=o(function(e,t,r){let i=t.bgColor?t.bgColor:r[t.typeC4Shape.text+"_bg_color"],n=t.borderColor?t.borderColor:r[t.typeC4Shape.text+"_border_color"],a=t.fontColor?t.fontColor:"#FFFFFF",s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";switch(t.typeC4Shape.text){case"person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";break;case"external_person":s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";break}let l=e.append("g");l.attr("class","person-man");let u=fa();switch(t.typeC4Shape.text){case"person":case"external_person":case"system":case"external_system":case"container":case"external_container":case"component":case"external_component":u.x=t.x,u.y=t.y,u.fill=i,u.width=t.width,u.height=t.height,u.stroke=n,u.rx=2.5,u.ry=2.5,u.attrs={"stroke-width":.5},mM(l,u);break;case"system_db":case"external_system_db":case"container_db":case"external_container_db":case"component_db":case"external_component_db":l.append("path").attr("fill",i).attr("stroke-width","0.5").attr("stroke",n).attr("d","Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2).replaceAll("height",t.height)),l.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",n).attr("d","Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("half",t.width/2));break;case"system_queue":case"external_system_queue":case"container_queue":case"external_container_queue":case"component_queue":case"external_component_queue":l.append("path").attr("fill",i).attr("stroke-width","0.5").attr("stroke",n).attr("d","Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx",t.x).replaceAll("starty",t.y).replaceAll("width",t.width).replaceAll("half",t.height/2)),l.append("path").attr("fill","none").attr("stroke-width","0.5").attr("stroke",n).attr("d","Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx",t.x+t.width).replaceAll("starty",t.y).replaceAll("half",t.height/2));break}let h=vze(r,t.typeC4Shape.text);switch(l.append("text").attr("fill",a).attr("font-family",h.fontFamily).attr("font-size",h.fontSize-2).attr("font-style","italic").attr("lengthAdjust","spacing").attr("textLength",t.typeC4Shape.width).attr("x",t.x+t.width/2-t.typeC4Shape.width/2).attr("y",t.y+t.typeC4Shape.Y).text("<<"+t.typeC4Shape.text+">>"),t.typeC4Shape.text){case"person":case"external_person":xee(l,48,48,t.x+t.width/2-24,t.y+t.image.Y,s);break}let d=r[t.typeC4Shape.text+"Font"]();return d.fontWeight="bold",d.fontSize=d.fontSize+2,d.fontColor=a,Nu(r)(t.label.text,l,t.x,t.y+t.label.Y,t.width,t.height,{fill:a},d),d=r[t.typeC4Shape.text+"Font"](),d.fontColor=a,t.techn&&t.techn?.text!==""?Nu(r)(t.techn.text,l,t.x,t.y+t.techn.Y,t.width,t.height,{fill:a,"font-style":"italic"},d):t.type&&t.type.text!==""&&Nu(r)(t.type.text,l,t.x,t.y+t.type.Y,t.width,t.height,{fill:a,"font-style":"italic"},d),t.descr&&t.descr.text!==""&&(d=r.personFont(),d.fontColor=a,Nu(r)(t.descr.text,l,t.x,t.y+t.descr.Y,t.width,t.height,{fill:a},d)),t.height},"drawC4Shape"),hze=o(function(e,t){e.append("defs").append("symbol").attr("id",t+"-database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),dze=o(function(e,t){e.append("defs").append("symbol").attr("id",t+"-computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),fze=o(function(e,t){e.append("defs").append("symbol").attr("id",t+"-clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),pze=o(function(e,t){e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),mze=o(function(e,t){e.append("defs").append("marker").attr("id",t+"-arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),gze=o(function(e,t){e.append("defs").append("marker").attr("id",t+"-filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),yze=o(function(e,t){let i=e.append("defs").append("marker").attr("id",t+"-crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);i.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),i.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),vze=o((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"getC4ShapeFont"),Nu=(function(){function e(n,a,s,l,u,h,d){let f=a.append("text").attr("x",s+u/2).attr("y",l+h/2+5).style("text-anchor","middle").text(n);i(f,d)}o(e,"byText");function t(n,a,s,l,u,h,d,f){let{fontSize:p,fontFamily:m,fontWeight:g}=f,y=n.split(vt.lineBreakRegex);for(let v=0;v=0}var Cee=z(()=>{"use strict";o(Tee,"isLength")});function Vw(e){return e!=null&&typeof e!="function"&&Tee(e.length)}var gM=z(()=>{"use strict";Cee();o(Vw,"isArrayLike")});function kee(e){return e==="__proto__"}var wee=z(()=>{"use strict";o(kee,"isUnsafeProperty")});function rd(e){return e==null||typeof e!="object"&&typeof e!="function"}var Sx=z(()=>{"use strict";o(rd,"isPrimitive")});function Ww(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var yM=z(()=>{"use strict";o(Ww,"getSymbols")});function Iu(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var Ex=z(()=>{"use strict";o(Iu,"getTag")});var Ax,id,yp,vp,xp,_x,Dx,Rx,Lx,qw,Mx,pg,Nx,Uw,Hw,Yw,jw,Xw,Kw,Zw,Qw,Jw,e4=z(()=>{"use strict";Ax="[object RegExp]",id="[object String]",yp="[object Number]",vp="[object Boolean]",xp="[object Arguments]",_x="[object Symbol]",Dx="[object Date]",Rx="[object Map]",Lx="[object Set]",qw="[object Array]",Mx="[object ArrayBuffer]",pg="[object Object]",Nx="[object DataView]",Uw="[object Uint8Array]",Hw="[object Uint8ClampedArray]",Yw="[object Uint16Array]",jw="[object Uint32Array]",Xw="[object Int8Array]",Kw="[object Int16Array]",Zw="[object Int32Array]",Qw="[object Float32Array]",Jw="[object Float64Array]"});function mg(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}var t4=z(()=>{"use strict";o(mg,"isTypedArray")});function See(e,t){return gg(e,void 0,e,new Map,t)}function gg(e,t,r,i=new Map,n=void 0){let a=n?.(e,t,r,i);if(a!==void 0)return a;if(rd(e))return e;if(i.has(e))return i.get(e);if(Array.isArray(e)){let s=new Array(e.length);i.set(e,s);for(let l=0;l{"use strict";yM();Ex();e4();Sx();t4();o(See,"cloneDeepWith");o(gg,"cloneDeepWithImpl");o(Po,"copyProperties");o(xze,"isCloneableObject")});function Aee(e,t){return See(e,(r,i,n,a)=>{let s=t?.(r,i,n,a);if(s!==void 0)return s;if(typeof e=="object"){if(Iu(e)===pg&&typeof e.constructor!="function"){let l={};return a.set(e,l),Po(l,e,n,a),l}switch(Object.prototype.toString.call(e)){case yp:case id:case vp:{let l=new e.constructor(e?.valueOf());return Po(l,e),l}case xp:{let l={};return Po(l,e),l.length=e.length,l[Symbol.iterator]=e[Symbol.iterator],l}default:return}}})}var _ee=z(()=>{"use strict";Eee();Ex();e4();o(Aee,"cloneDeepWith")});function vM(e){return Aee(e)}var Dee=z(()=>{"use strict";_ee();o(vM,"cloneDeep")});function Ix(e){return e!==null&&typeof e=="object"&&Iu(e)==="[object Arguments]"}var xM=z(()=>{"use strict";Ex();o(Ix,"isArguments")});function Ox(e){return typeof e=="object"&&e!==null}var bM=z(()=>{"use strict";o(Ox,"isObjectLike")});function Ree(e){return Ox(e)&&Vw(e)}var Lee=z(()=>{"use strict";gM();bM();o(Ree,"isArrayLikeObject")});function Mee(e){return Array.isArray(e)}var Nee=z(()=>{"use strict";o(Mee,"isArray")});function bp(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");let r=o(function(...n){let a=t?t.apply(this,n):n[0],s=r.cache;if(s.has(a))return s.get(a);let l=e.apply(this,n);return r.cache=s.set(a,l)||s,l},"memoized"),i=bp.Cache||Map;return r.cache=new i,r}var Iee=z(()=>{"use strict";o(bp,"memoize");bp.Cache=Map});function Oee(){}var Pee=z(()=>{"use strict";o(Oee,"noop")});function Bee(e){let t=e?.constructor,r=typeof t=="function"?t.prototype:Object.prototype;return e===r}var Fee=z(()=>{"use strict";o(Bee,"isPrototype")});function nd(e){return mg(e)}var r4=z(()=>{"use strict";t4();o(nd,"isTypedArray")});function CM(e){if(rd(e))return e;let t=Iu(e);if(!bze(e))return{};if(Mee(e)){let i=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(i.index=e.index,i.input=e.input),i}if(nd(e)){let i=e,n=i.constructor;return new n(i.buffer,i.byteOffset,i.length)}if(t===Mx)return new ArrayBuffer(e.byteLength);if(t===Nx){let i=e,n=i.buffer,a=i.byteOffset,s=i.byteLength,l=new ArrayBuffer(s),u=new Uint8Array(n,a,s);return new Uint8Array(l).set(u),new DataView(l)}if(t===vp||t===yp||t===id){let i=e.constructor,n=new i(e.valueOf());return t===id?Cze(n,e):TM(n,e),n}if(t===Dx)return new Date(Number(e));if(t===Ax){let i=e,n=new RegExp(i.source,i.flags);return n.lastIndex=i.lastIndex,n}if(t===_x)return Object(Symbol.prototype.valueOf.call(e));if(t===Rx){let i=e,n=new Map;return i.forEach((a,s)=>{n.set(s,a)}),n}if(t===Lx){let i=e,n=new Set;return i.forEach(a=>{n.add(a)}),n}if(t===xp){let i=e,n={};return TM(n,i),n.length=i.length,n[Symbol.iterator]=i[Symbol.iterator],n}let r={};return kze(r,e),TM(r,e),Tze(r,e),r}function bze(e){switch(Iu(e)){case xp:case qw:case Mx:case Nx:case vp:case Dx:case Qw:case Jw:case Xw:case Kw:case Zw:case Rx:case yp:case pg:case Ax:case Lx:case id:case _x:case Uw:case Hw:case Yw:case jw:return!0;default:return!1}}function TM(e,t){for(let r in t)Object.hasOwn(t,r)&&(e[r]=t[r])}function Tze(e,t){let r=Object.getOwnPropertySymbols(t);for(let i=0;i=r)&&(e[i]=t[i])}function kze(e,t){let r=Object.getPrototypeOf(t);r!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,r)}var $ee=z(()=>{"use strict";Sx();Ex();e4();Nee();r4();o(CM,"clone");o(bze,"isCloneableObject");o(TM,"copyOwnProperties");o(Tze,"copySymbolProperties");o(Cze,"cloneStringObjectProperties");o(kze,"copyPrototype")});function i4(e){if(typeof e!="object"||e==null)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!=="[object Object]"){let r=e[Symbol.toStringTag];return r==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${r}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var zee=z(()=>{"use strict";o(i4,"isPlainObject")});function Gee(e){if(rd(e))return e;if(Array.isArray(e)||mg(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);let r=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new r(e);if(e instanceof RegExp){let i=new r(e);return i.lastIndex=e.lastIndex,i}if(e instanceof DataView)return new r(e.buffer.slice(0));if(e instanceof Error){let i;return e instanceof AggregateError?i=new r(e.errors,e.message,{cause:e.cause}):i=new r(e.message,{cause:e.cause}),i.stack=e.stack,Object.assign(i,e),i}if(typeof File<"u"&&e instanceof File)return new r([e],e.name,{type:e.type,lastModified:e.lastModified});if(typeof e=="object"){let i=Object.create(t);return Object.assign(i,e)}return e}var Vee=z(()=>{"use strict";Sx();t4();o(Gee,"clone")});function Wee(e,...t){let r=t.slice(0,-1),i=t[t.length-1],n=e;for(let a=0;a{"use strict";Dee();wee();Vee();Sx();yM();xM();Lee();bM();zee();r4();o(Wee,"mergeWith");o(n4,"mergeWithDeep")});function kM(e,...t){return Wee(e,...t,Oee)}var Uee=z(()=>{"use strict";qee();Pee();o(kM,"merge")});function a4(e){if(e==null)return!0;if(Vw(e))return typeof e.splice!="function"&&typeof e!="string"&&(typeof Buffer>"u"||!Buffer.isBuffer(e))&&!nd(e)&&!Ix(e)?!1:e.length===0;if(typeof e=="object"){if(e instanceof Map||e instanceof Set)return e.size===0;let t=Object.keys(e);return Bee(e)?t.filter(r=>r!=="constructor").length===0:t.length===0}return!0}var Hee=z(()=>{"use strict";xM();gM();r4();Fee();o(a4,"isEmpty")});var s4=z(()=>{"use strict";Iee();$ee();Uee();Hee()});function EM(e,t){if(!e)return t;let r=`curve${e.charAt(0).toUpperCase()+e.slice(1)}`;return wze[r]??t}function _ze(e,t){let r=e.trim();if(r)return t.securityLevel!=="loose"?(0,Xee.sanitizeUrl)(r):r}function Qee(e,t){return!e||!t?0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Rze(e){let t,r=0;e.forEach(n=>{r+=Qee(n,t),t=n});let i=r/2;return AM(e,i)}function Lze(e){return e.length===1?e[0]:Rze(e)}function Nze(e,t,r){let i=structuredClone(r);Z.info("our points",i),t!=="start_left"&&t!=="start_right"&&i.reverse();let n=25+e,a=AM(i,n),s=10+e*.5,l=Math.atan2(i[0].y-a.y,i[0].x-a.x),u={x:0,y:0};return t==="start_left"?(u.x=Math.sin(l+Math.PI)*s+(i[0].x+a.x)/2,u.y=-Math.cos(l+Math.PI)*s+(i[0].y+a.y)/2):t==="end_right"?(u.x=Math.sin(l-Math.PI)*s+(i[0].x+a.x)/2-5,u.y=-Math.cos(l-Math.PI)*s+(i[0].y+a.y)/2-5):t==="end_left"?(u.x=Math.sin(l)*s+(i[0].x+a.x)/2-5,u.y=-Math.cos(l)*s+(i[0].y+a.y)/2-5):(u.x=Math.sin(l)*s+(i[0].x+a.x)/2,u.y=-Math.cos(l)*s+(i[0].y+a.y)/2),u}function _M(e){let t="",r="";for(let i of e)i!==void 0&&(i.startsWith("color:")||i.startsWith("text-align:")?r=r+i+";":t=t+i+";");return{style:t,labelStyle:r}}function Ize(e){let t="",r="0123456789abcdef",i=r.length;for(let n=0;nMath.round(parseFloat(a)).toString());return n.includes(r.toString())||n.includes(i.toString())}var Xee,SM,wze,Sze,Eze,Kee,Zee,Aze,Dze,Yee,AM,Mze,jee,DM,RM,Oze,Pze,Tp,Bze,Px,wM,o4,Fze,$ze,Za,Zt,Jee,Qa,bc,Xt=z(()=>{"use strict";Xee=ys(fg(),1);Rr();Ir();MC();St();Xf();Dm();s4();mk();SM="\u200B",wze={curveBasis:Dl,curveBasisClosed:Aw,curveBasisOpen:_w,curveBumpX:hx,curveBumpY:dx,curveBundle:iM,curveCardinalClosed:nM,curveCardinalOpen:sM,curveCardinal:gx,curveCatmullRomClosed:lM,curveCatmullRomOpen:cM,curveCatmullRom:xx,curveLinear:xc,curveLinearClosed:Nw,curveMonotoneX:bx,curveMonotoneY:Tx,curveNatural:hg,curveStep:dg,curveStepAfter:kx,curveStepBefore:Cx},Sze=/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,Eze=o(function(e,t){let r=Kee(e,/(?:init\b)|(?:initialize\b)/),i={};if(Array.isArray(r)){let s=r.map(l=>l.args);Lm(s),i=Ai(i,[...s])}else i=r.args;if(!i)return;let n=zm(e,t),a="config";return i[a]!==void 0&&(n==="flowchart-v2"&&(n="flowchart"),i[n]=i[a],delete i[a]),i},"detectInit"),Kee=o(function(e,t=null){try{let r=new RegExp(`[%]{2}(?![{]${Sze.source})(?=[}][%]{2}).* +`,"ig");e=e.trim().replace(r,"").replace(/'/gm,'"'),Z.debug(`Detecting diagram directive${t!==null?" type:"+t:""} based on the text:${e}`);let i,n=[];for(;(i=jf.exec(e))!==null;)if(i.index===jf.lastIndex&&jf.lastIndex++,i&&!t||t&&i[1]?.match(t)||t&&i[2]?.match(t)){let a=i[1]?i[1]:i[2],s=i[3]?i[3].trim():i[4]?JSON.parse(i[4].trim()):null;n.push({type:a,args:s})}return n.length===0?{type:e,args:null}:n.length===1?n[0]:n}catch(r){return Z.error(`ERROR: ${r.message} - Unable to parse directive type: '${t}' based on the text: '${e}'`),{type:void 0,args:null}}},"detectDirective"),Zee=o(function(e){return e.replace(jf,"")},"removeDirectives"),Aze=o(function(e,t){for(let[r,i]of t.entries())if(i.match(e))return r;return-1},"isSubstringInArray");o(EM,"interpolateToCurve");o(_ze,"formatUrl");Dze=o((e,...t)=>{let r=e.split("."),i=r.length-1,n=r[i],a=window;for(let s=0;s{let r=Math.pow(10,t);return Math.round(e*r)/r},"roundNumber"),AM=o((e,t)=>{let r,i=t;for(let n of e){if(r){let a=Qee(n,r);if(a===0)return r;if(a=1)return{x:n.x,y:n.y};if(s>0&&s<1)return{x:Yee((1-s)*r.x+s*n.x,5),y:Yee((1-s)*r.y+s*n.y,5)}}}r=n}throw new Error("Could not find a suitable point for the given distance")},"calculatePoint"),Mze=o((e,t,r)=>{Z.info(`our points ${JSON.stringify(t)}`),t[0]!==r&&(t=t.reverse());let n=AM(t,25),a=e?10:5,s=Math.atan2(t[0].y-n.y,t[0].x-n.x),l={x:0,y:0};return l.x=Math.sin(s)*a+(t[0].x+n.x)/2,l.y=-Math.cos(s)*a+(t[0].y+n.y)/2,l},"calcCardinalityPosition");o(Nze,"calcTerminalLabelPosition");o(_M,"getStylesFromArray");jee=0,DM=o(()=>(jee++,"id-"+Math.random().toString(36).substr(2,12)+"-"+jee),"generateId");o(Ize,"makeRandomHex");RM=o(e=>Ize(e.length),"random"),Oze=o(function(){return{x:0,y:0,fill:void 0,anchor:"start",style:"#666",width:100,height:100,textMargin:0,rx:0,ry:0,valign:void 0,text:""}},"getTextObj"),Pze=o(function(e,t){let r=t.text.replace(vt.lineBreakRegex," "),[,i]=Za(t.fontSize),n=e.append("text");n.attr("x",t.x),n.attr("y",t.y),n.style("text-anchor",t.anchor),n.style("font-family",t.fontFamily),n.style("font-size",i),n.style("font-weight",t.fontWeight),n.attr("fill",t.fill),t.class!==void 0&&n.attr("class",t.class);let a=n.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.attr("fill",t.fill),a.text(r),n},"drawSimpleText"),Tp=bp((e,t,r)=>{if(!e||(r=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",joinWith:"
    "},r),vt.lineBreakRegex.test(e)))return e;let i=e.split(" ").filter(Boolean),n=[],a="";return i.forEach((s,l)=>{let u=ta(`${s} `,r),h=ta(a,r);if(u>t){let{hyphenatedStrings:p,remainingWord:m}=Bze(s,t,"-",r);n.push(a,...p),a=m}else h+u>=t?(n.push(a),a=s):a=[a,s].filter(Boolean).join(" ");l+1===i.length&&n.push(a)}),n.filter(s=>s!=="").join(r.joinWith)},(e,t,r)=>`${e}${t}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),Bze=bp((e,t,r="-",i)=>{i=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},i);let n=[...e],a=[],s="";return n.forEach((l,u)=>{let h=`${s}${l}`;if(ta(h,i)>=t){let f=u+1,p=n.length===f,m=`${h}${r}`;a.push(p?h:m),s=""}else s=h}),{hyphenatedStrings:a,remainingWord:s}},(e,t,r="-",i)=>`${e}${t}${r}${i.fontSize}${i.fontWeight}${i.fontFamily}`);o(l4,"calculateTextHeight");o(ta,"calculateTextWidth");Px=bp((e,t)=>{let{fontSize:r=12,fontFamily:i="Arial",fontWeight:n=400}=t;if(!e)return{width:0,height:0};let[,a]=Za(r),s=["sans-serif",i],l=e.split(vt.lineBreakRegex),u=[],h=Je("body");if(!h.remove)return{width:0,height:0,lineHeight:0};let d=h.append("svg");for(let p of s){let m=0,g={width:0,height:0,lineHeight:0};for(let y of l){let v=Oze();v.text=y||SM;let x=Pze(d,v).style("font-size",a).style("font-weight",n).style("font-family",p),b=(x._groups||x)[0][0].getBBox();if(b.width===0&&b.height===0)throw new Error("svg element not in render tree");g.width=Math.round(Math.max(g.width,b.width)),m=Math.round(b.height),g.height+=m,g.lineHeight=Math.round(Math.max(g.lineHeight,m))}u.push(g)}d.remove();let f=isNaN(u[1].height)||isNaN(u[1].width)||isNaN(u[1].lineHeight)||u[0].height>u[1].height&&u[0].width>u[1].width&&u[0].lineHeight>u[1].lineHeight?0:1;return u[f]},(e,t)=>`${e}${t.fontSize}${t.fontWeight}${t.fontFamily}`),wM=class{constructor(t=!1,r){this.count=0;this.count=r?r.length:0,this.next=t?()=>this.count++:()=>Date.now()}static{o(this,"InitIDGenerator")}},Fze=o(function(e){return o4=o4||document.createElement("div"),e=escape(e).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),o4.innerHTML=e,unescape(o4.textContent)},"entityDecode");o(LM,"isDetailedError");$ze=o((e,t,r,i)=>{if(!i)return;let n=e.node()?.getBBox();n&&e.append("text").text(i).attr("text-anchor","middle").attr("x",n.x+n.width/2).attr("y",-r).attr("class",t)},"insertTitle"),Za=o(e=>{if(typeof e=="number")return[e,e+"px"];let t=parseInt(e??"",10);return Number.isNaN(t)?[void 0,void 0]:e===String(t)?[t,e+"px"]:[t,e]},"parseFontSize");o(Gr,"cleanAndMerge");Zt={assignWithDepth:Ai,wrapLabel:Tp,calculateTextHeight:l4,calculateTextWidth:ta,calculateTextDimensions:Px,cleanAndMerge:Gr,detectInit:Eze,detectDirective:Kee,isSubstringInArray:Aze,interpolateToCurve:EM,calcLabelPosition:Lze,calcCardinalityPosition:Mze,calcTerminalLabelPosition:Nze,formatUrl:_ze,getStylesFromArray:_M,generateId:DM,random:RM,runFunc:Dze,entityDecode:Fze,insertTitle:$ze,isLabelCoordinateInPath:zze,parseFontSize:Za,InitIDGenerator:wM},Jee=o(function(e){let t=e;return t=t.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),t=t.replace(/#\w+;/g,function(r){let i=r.substring(1,r.length-1);return/^\+?\d+$/.test(i)?"\uFB02\xB0\xB0"+i+"\xB6\xDF":"\uFB02\xB0"+i+"\xB6\xDF"}),t},"encodeEntities"),Qa=o(function(e){return e.replace(/fl°°/g,"&#").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),bc=o((e,t,{counter:r=0,prefix:i,suffix:n},a)=>a||`${i?`${i}_`:""}${e}_${t}_${r}${n?`_${n}`:""}`,"getEdgeId");o(ii,"handleUndefinedAttr");o(zze,"isLabelCoordinateInPath")});function Ll(e,t,r,i,n){if(!t[e].width)if(r)t[e].text=Tp(t[e].text,n,i),t[e].textLines=t[e].text.split(vt.lineBreakRegex).length,t[e].width=n,t[e].height=l4(t[e].text,i);else{let a=t[e].text.split(vt.lineBreakRegex);t[e].textLines=a.length;let s=0;t[e].height=0,t[e].width=0;for(let l of a)t[e].width=Math.max(ta(l,i),t[e].width),s=l4(l,i),t[e].height=t[e].height+s}}function nte(e,t,r,i,n){let a=new d4(n);a.data.widthLimit=r.data.widthLimit/Math.min(MM,i.length);for(let[s,l]of i.entries()){let u=0;l.image={width:0,height:0,Y:0},l.sprite&&(l.image.width=48,l.image.height=48,l.image.Y=u,u=l.image.Y+l.image.height);let h=l.wrap&&er.wrap,d=c4(er);if(d.fontSize=d.fontSize+2,d.fontWeight="bold",Ll("label",l,h,d,a.data.widthLimit),l.label.Y=u+8,u=l.label.Y+l.label.height,l.type&&l.type.text!==""){l.type.text="["+l.type.text+"]";let g=c4(er);Ll("type",l,h,g,a.data.widthLimit),l.type.Y=u+5,u=l.type.Y+l.type.height}if(l.descr&&l.descr.text!==""){let g=c4(er);g.fontSize=g.fontSize-2,Ll("descr",l,h,g,a.data.widthLimit),l.descr.Y=u+20,u=l.descr.Y+l.descr.height}if(s==0||s%MM===0){let g=r.data.startx+er.diagramMarginX,y=r.data.stopy+er.diagramMarginY+u;a.setData(g,g,y,y)}else{let g=a.data.stopx!==a.data.startx?a.data.stopx+er.diagramMarginX:a.data.startx,y=a.data.starty;a.setData(g,g,y,y)}a.name=l.alias;let f=n.db.getC4ShapeArray(l.alias),p=n.db.getC4ShapeKeys(l.alias);p.length>0&&ite(a,e,f,p),t=l.alias;let m=n.db.getBoundaries(t);m.length>0&&nte(e,t,a,m,n),l.alias!=="global"&&rte(e,l,a),r.data.stopy=Math.max(a.data.stopy+er.c4ShapeMargin,r.data.stopy),r.data.stopx=Math.max(a.data.stopx+er.c4ShapeMargin,r.data.stopx),u4=Math.max(u4,r.data.stopx),h4=Math.max(h4,r.data.stopy)}}var u4,h4,tte,MM,er,d4,NM,Bx,c4,Gze,rte,ite,Ss,ete,Vze,Wze,qze,IM,ate=z(()=>{"use strict";Rr();bee();St();ND();Ir();WD();Ut();Dm();Xt();Di();u4=0,h4=0,tte=4,MM=2;kv.yy=Rv;er={},d4=class{static{o(this,"Bounds")}constructor(t){this.name="",this.data={},this.data.startx=void 0,this.data.stopx=void 0,this.data.starty=void 0,this.data.stopy=void 0,this.data.widthLimit=void 0,this.nextData={},this.nextData.startx=void 0,this.nextData.stopx=void 0,this.nextData.starty=void 0,this.nextData.stopy=void 0,this.nextData.cnt=0,NM(t.db.getConfig())}setData(t,r,i,n){this.nextData.startx=this.data.startx=t,this.nextData.stopx=this.data.stopx=r,this.nextData.starty=this.data.starty=i,this.nextData.stopy=this.data.stopy=n}updateVal(t,r,i,n){t[r]===void 0?t[r]=i:t[r]=n(i,t[r])}insert(t){this.nextData.cnt=this.nextData.cnt+1;let r=this.nextData.startx===this.nextData.stopx?this.nextData.stopx+t.margin:this.nextData.stopx+t.margin*2,i=r+t.width,n=this.nextData.starty+t.margin*2,a=n+t.height;(r>=this.data.widthLimit||i>=this.data.widthLimit||this.nextData.cnt>tte)&&(r=this.nextData.startx+t.margin+er.nextLinePaddingX,n=this.nextData.stopy+t.margin*2,this.nextData.stopx=i=r+t.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=a=n+t.height,this.nextData.cnt=1),t.x=r,t.y=n,this.updateVal(this.data,"startx",r,Math.min),this.updateVal(this.data,"starty",n,Math.min),this.updateVal(this.data,"stopx",i,Math.max),this.updateVal(this.data,"stopy",a,Math.max),this.updateVal(this.nextData,"startx",r,Math.min),this.updateVal(this.nextData,"starty",n,Math.min),this.updateVal(this.nextData,"stopx",i,Math.max),this.updateVal(this.nextData,"stopy",a,Math.max)}init(t){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},NM(t.db.getConfig())}bumpLastMargin(t){this.data.stopx+=t,this.data.stopy+=t}},NM=o(function(e){Ai(er,e),e.fontFamily&&(er.personFontFamily=er.systemFontFamily=er.messageFontFamily=e.fontFamily),e.fontSize&&(er.personFontSize=er.systemFontSize=er.messageFontSize=e.fontSize),e.fontWeight&&(er.personFontWeight=er.systemFontWeight=er.messageFontWeight=e.fontWeight)},"setConf"),Bx=o((e,t)=>({fontFamily:e[t+"FontFamily"],fontSize:e[t+"FontSize"],fontWeight:e[t+"FontWeight"]}),"c4ShapeFont"),c4=o(e=>({fontFamily:e.boundaryFontFamily,fontSize:e.boundaryFontSize,fontWeight:e.boundaryFontWeight}),"boundaryFont"),Gze=o(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont");o(Ll,"calcC4ShapeTextWH");rte=o(function(e,t,r){t.x=r.data.startx,t.y=r.data.starty,t.width=r.data.stopx-r.data.startx,t.height=r.data.stopy-r.data.starty,t.label.y=er.c4ShapeMargin-35;let i=t.wrap&&er.wrap,n=c4(er);n.fontSize=n.fontSize+2,n.fontWeight="bold";let a=ta(t.label.text,n);Ll("label",t,i,n,a),Rl.drawBoundary(e,t,er)},"drawBoundary"),ite=o(function(e,t,r,i){let n=0;for(let a of i){n=0;let s=r[a],l=Bx(er,s.typeC4Shape.text);switch(l.fontSize=l.fontSize-2,s.typeC4Shape.width=ta("\xAB"+s.typeC4Shape.text+"\xBB",l),s.typeC4Shape.height=l.fontSize+2,s.typeC4Shape.Y=er.c4ShapePadding,n=s.typeC4Shape.Y+s.typeC4Shape.height-4,s.image={width:0,height:0,Y:0},s.typeC4Shape.text){case"person":case"external_person":s.image.width=48,s.image.height=48,s.image.Y=n,n=s.image.Y+s.image.height;break}s.sprite&&(s.image.width=48,s.image.height=48,s.image.Y=n,n=s.image.Y+s.image.height);let u=s.wrap&&er.wrap,h=er.width-er.c4ShapePadding*2,d=Bx(er,s.typeC4Shape.text);if(d.fontSize=d.fontSize+2,d.fontWeight="bold",Ll("label",s,u,d,h),s.label.Y=n+8,n=s.label.Y+s.label.height,s.type&&s.type.text!==""){s.type.text="["+s.type.text+"]";let m=Bx(er,s.typeC4Shape.text);Ll("type",s,u,m,h),s.type.Y=n+5,n=s.type.Y+s.type.height}else if(s.techn&&s.techn.text!==""){s.techn.text="["+s.techn.text+"]";let m=Bx(er,s.techn.text);Ll("techn",s,u,m,h),s.techn.Y=n+5,n=s.techn.Y+s.techn.height}let f=n,p=s.label.width;if(s.descr&&s.descr.text!==""){let m=Bx(er,s.typeC4Shape.text);Ll("descr",s,u,m,h),s.descr.Y=n+20,n=s.descr.Y+s.descr.height,p=Math.max(s.label.width,s.descr.width),f=n-s.descr.textLines*5}p=p+er.c4ShapePadding,s.width=Math.max(s.width||er.width,p,er.width),s.height=Math.max(s.height||er.height,f,er.height),s.margin=s.margin||er.c4ShapeMargin,e.insert(s),Rl.drawC4Shape(t,s,er)}e.bumpLastMargin(er.c4ShapeMargin)},"drawC4ShapeArray"),Ss=class{static{o(this,"Point")}constructor(t,r){this.x=t,this.y=r}},ete=o(function(e,t){let r=e.x,i=e.y,n=t.x,a=t.y,s=r+e.width/2,l=i+e.height/2,u=Math.abs(r-n),h=Math.abs(i-a),d=h/u,f=e.height/e.width,p=null;return i==a&&rn?p=new Ss(r,l):r==n&&ia&&(p=new Ss(s,i)),r>n&&i=d?p=new Ss(r,l+d*e.width/2):p=new Ss(s-u/h*e.height/2,i+e.height):r=d?p=new Ss(r+e.width,l+d*e.width/2):p=new Ss(s+u/h*e.height/2,i+e.height):ra?f>=d?p=new Ss(r+e.width,l-d*e.width/2):p=new Ss(s+e.height/2*u/h,i):r>n&&i>a&&(f>=d?p=new Ss(r,l-e.width/2*d):p=new Ss(s-e.height/2*u/h,i)),p},"getIntersectPoint"),Vze=o(function(e,t){let r={x:0,y:0};r.x=t.x+t.width/2,r.y=t.y+t.height/2;let i=ete(e,r);r.x=e.x+e.width/2,r.y=e.y+e.height/2;let n=ete(t,r);return{startPoint:i,endPoint:n}},"getIntersectPoints"),Wze=o(function(e,t,r,i,n){let a=0;for(let s of t){a=a+1;let l=s.wrap&&er.wrap,u=Gze(er);i.db.getC4Type()==="C4Dynamic"&&(s.label.text=a+": "+s.label.text);let d=ta(s.label.text,u);Ll("label",s,l,u,d),s.techn&&s.techn.text!==""&&(d=ta(s.techn.text,u),Ll("techn",s,l,u,d)),s.descr&&s.descr.text!==""&&(d=ta(s.descr.text,u),Ll("descr",s,l,u,d));let f=r(s.from),p=r(s.to),m=Vze(f,p);s.startPoint=m.startPoint,s.endPoint=m.endPoint}Rl.drawRels(e,t,er,n)},"drawRels");o(nte,"drawInsideBoundary");qze=o(function(e,t,r,i){er=ge().c4;let n=ge().securityLevel,a;n==="sandbox"&&(a=Je("#i"+t));let s=n==="sandbox"?Je(a.nodes()[0].contentDocument.body):Je("body"),l=i.db;i.db.setWrap(er.wrap),tte=l.getC4ShapeInRow(),MM=l.getC4BoundaryInRow(),Z.debug(`C:${JSON.stringify(er,null,2)}`);let u=n==="sandbox"?s.select(`[id="${t}"]`):Je(`[id="${t}"]`);Rl.insertComputerIcon(u,t),Rl.insertDatabaseIcon(u,t),Rl.insertClockIcon(u,t);let h=new d4(i);h.setData(er.diagramMarginX,er.diagramMarginX,er.diagramMarginY,er.diagramMarginY),h.data.widthLimit=screen.availWidth,u4=er.diagramMarginX,h4=er.diagramMarginY;let d=i.db.getTitle(),f=i.db.getBoundaries("");nte(u,"",h,f,i),Rl.insertArrowHead(u,t),Rl.insertArrowEnd(u,t),Rl.insertArrowCrossHead(u,t),Rl.insertArrowFilledHead(u,t),Wze(u,i.db.getRels(),i.db.getC4Shape,i,t),h.data.stopx=u4,h.data.stopy=h4;let p=h.data,g=p.stopy-p.starty+2*er.diagramMarginY,v=p.stopx-p.startx+2*er.diagramMarginX;d&&u.append("text").text(d).attr("x",(p.stopx-p.startx)/2-4*er.diagramMarginX).attr("y",p.starty+er.diagramMarginY),Br(u,g,v,er.useMaxWidth);let x=d?60:0;u.attr("viewBox",p.startx-er.diagramMarginX+" -"+(er.diagramMarginY+x)+" "+v+" "+(g+x)),Z.debug("models:",p)},"draw"),IM={drawPersonOrSystemArray:ite,drawBoundary:rte,setConf:NM,draw:qze}});var Uze,ste,ote=z(()=>{"use strict";Uze=o(e=>`.person { + stroke: ${e.personBorder}; + fill: ${e.personBkg}; + } +`,"getStyles"),ste=Uze});var lte={};xr(lte,{diagram:()=>Hze});var Hze,cte=z(()=>{"use strict";ND();WD();ate();ote();Hze={parser:eX,db:Rv,renderer:IM,styles:ste,init:o(({c4:e,wrap:t})=>{IM.setConf(e),Rv.setWrap(t)},"init")}});function Ete(e){return typeof e>"u"||e===null}function Kze(e){return typeof e=="object"&&e!==null}function Zze(e){return Array.isArray(e)?e:Ete(e)?[]:[e]}function Qze(e,t){var r,i,n,a;if(t)for(a=Object.keys(t),r=0,i=a.length;rl&&(a=" ... ",t=i-l+a.length),r-i>l&&(s=" ...",r=i+l-s.length),{str:a+e.slice(t,r).replace(/\t/g,"\u2192")+s,pos:i-t+a.length}}function PM(e,t){return zn.repeat(" ",t-e.length)+e}function oGe(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,i=[0],n=[],a,s=-1;a=r.exec(e.buffer);)n.push(a.index),i.push(a.index+a[0].length),e.position<=a.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);var l="",u,h,d=Math.min(e.line+t.linesAfter,n.length).toString().length,f=t.maxLength-(t.indent+d+3);for(u=1;u<=t.linesBefore&&!(s-u<0);u++)h=OM(e.buffer,i[s-u],n[s-u],e.position-(i[s]-i[s-u]),f),l=zn.repeat(" ",t.indent)+PM((e.line-u+1).toString(),d)+" | "+h.str+` +`+l;for(h=OM(e.buffer,i[s],n[s],e.position,f),l+=zn.repeat(" ",t.indent)+PM((e.line+1).toString(),d)+" | "+h.str+` +`,l+=zn.repeat("-",t.indent+d+3+h.pos)+`^ +`,u=1;u<=t.linesAfter&&!(s+u>=n.length);u++)h=OM(e.buffer,i[s+u],n[s+u],e.position-(i[s]-i[s+u]),f),l+=zn.repeat(" ",t.indent)+PM((e.line+u+1).toString(),d)+" | "+h.str+` +`;return l.replace(/\n$/,"")}function hGe(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(i){t[String(i)]=r})}),t}function dGe(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(cGe.indexOf(r)===-1)throw new Es('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=hGe(t.styleAliases||null),uGe.indexOf(this.kind)===-1)throw new Es('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}function hte(e,t){var r=[];return e[t].forEach(function(i){var n=r.length;r.forEach(function(a,s){a.tag===i.tag&&a.kind===i.kind&&a.multi===i.multi&&(n=s)}),r[n]=i}),r}function fGe(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,r;function i(n){n.multi?(e.multi[n.kind].push(n),e.multi.fallback.push(n)):e[n.kind][n.tag]=e.fallback[n.tag]=n}for(o(i,"collectType"),t=0,r=arguments.length;t=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:r*parseFloat(t,10)}function FGe(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(zn.isNegativeZero(e))return"-0.0";return r=e.toString(10),BGe.test(r)?r.replace("e",".e"):r}function $Ge(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||zn.isNegativeZero(e))}function VGe(e){return e===null?!1:Dte.exec(e)!==null||Rte.exec(e)!==null}function WGe(e){var t,r,i,n,a,s,l,u=0,h=null,d,f,p;if(t=Dte.exec(e),t===null&&(t=Rte.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],i=+t[2]-1,n=+t[3],!t[4])return new Date(Date.UTC(r,i,n));if(a=+t[4],s=+t[5],l=+t[6],t[7]){for(u=t[7].slice(0,3);u.length<3;)u+="0";u=+u}return t[9]&&(d=+t[10],f=+(t[11]||0),h=(d*60+f)*6e4,t[9]==="-"&&(h=-h)),p=new Date(Date.UTC(r,i,n,a,s,l,u)),h&&p.setTime(p.getTime()-h),p}function qGe(e){return e.toISOString()}function HGe(e){return e==="<<"||e===null}function jGe(e){if(e===null)return!1;var t,r,i=0,n=e.length,a=WM;for(r=0;r64)){if(t<0)return!1;i+=6}return i%8===0}function XGe(e){var t,r,i=e.replace(/[\r\n=]/g,""),n=i.length,a=WM,s=0,l=[];for(t=0;t>16&255),l.push(s>>8&255),l.push(s&255)),s=s<<6|a.indexOf(i.charAt(t));return r=n%4*6,r===0?(l.push(s>>16&255),l.push(s>>8&255),l.push(s&255)):r===18?(l.push(s>>10&255),l.push(s>>2&255)):r===12&&l.push(s>>4&255),new Uint8Array(l)}function KGe(e){var t="",r=0,i,n,a=e.length,s=WM;for(i=0;i>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]),r=(r<<8)+e[i];return n=a%3,n===0?(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]):n===2?(t+=s[r>>10&63],t+=s[r>>4&63],t+=s[r<<2&63],t+=s[64]):n===1&&(t+=s[r>>2&63],t+=s[r<<4&63],t+=s[64],t+=s[64]),t}function ZGe(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}function tVe(e){if(e===null)return!0;var t=[],r,i,n,a,s,l=e;for(r=0,i=l.length;r>10)+55296,(e-65536&1023)+56320)}function Pte(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[t]=r}function bVe(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Lte,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function $te(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=lGe(r),new Es(t,r)}function ar(e,t){throw $te(e,t)}function m4(e,t){e.onWarning&&e.onWarning.call(null,$te(e,t))}function ad(e,t,r,i){var n,a,s,l;if(t1&&(e.result+=zn.repeat(` +`,t-1))}function TVe(e,t,r){var i,n,a,s,l,u,h,d,f=e.kind,p=e.result,m;if(m=e.input.charCodeAt(e.position),As(m)||vg(m)||m===35||m===38||m===42||m===33||m===124||m===62||m===39||m===34||m===37||m===64||m===96||(m===63||m===45)&&(n=e.input.charCodeAt(e.position+1),As(n)||r&&vg(n)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,l=!1;m!==0;){if(m===58){if(n=e.input.charCodeAt(e.position+1),As(n)||r&&vg(n))break}else if(m===35){if(i=e.input.charCodeAt(e.position-1),As(i))break}else{if(e.position===e.lineStart&&v4(e)||r&&vg(m))break;if(Tc(m))if(u=e.line,h=e.lineStart,d=e.lineIndent,En(e,!1,-1),e.lineIndent>=t){l=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=u,e.lineStart=h,e.lineIndent=d;break}}l&&(ad(e,a,s,!1),UM(e,e.line-u),a=s=e.position,l=!1),kp(m)||(s=e.position+1),m=e.input.charCodeAt(++e.position)}return ad(e,a,s,!1),e.result?!0:(e.kind=f,e.result=p,!1)}function CVe(e,t){var r,i,n;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=n=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(ad(e,i,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)i=e.position,e.position++,n=e.position;else return!0;else Tc(r)?(ad(e,i,n,!0),UM(e,En(e,!1,t)),i=n=e.position):e.position===e.lineStart&&v4(e)?ar(e,"unexpected end of the document within a single quoted scalar"):(e.position++,n=e.position);ar(e,"unexpected end of the stream within a single quoted scalar")}function kVe(e,t){var r,i,n,a,s,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return ad(e,r,e.position,!0),e.position++,!0;if(l===92){if(ad(e,r,e.position,!0),l=e.input.charCodeAt(++e.position),Tc(l))En(e,!1,t);else if(l<256&&Bte[l])e.result+=Fte[l],e.position++;else if((s=yVe(l))>0){for(n=s,a=0;n>0;n--)l=e.input.charCodeAt(++e.position),(s=gVe(l))>=0?a=(a<<4)+s:ar(e,"expected hexadecimal character");e.result+=xVe(a),e.position++}else ar(e,"unknown escape sequence");r=i=e.position}else Tc(l)?(ad(e,r,i,!0),UM(e,En(e,!1,t)),r=i=e.position):e.position===e.lineStart&&v4(e)?ar(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}ar(e,"unexpected end of the stream within a double quoted scalar")}function wVe(e,t){var r=!0,i,n,a,s=e.tag,l,u=e.anchor,h,d,f,p,m,g=Object.create(null),y,v,x,b;if(b=e.input.charCodeAt(e.position),b===91)d=93,m=!1,l=[];else if(b===123)d=125,m=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),b=e.input.charCodeAt(++e.position);b!==0;){if(En(e,!0,t),b=e.input.charCodeAt(e.position),b===d)return e.position++,e.tag=s,e.anchor=u,e.kind=m?"mapping":"sequence",e.result=l,!0;r?b===44&&ar(e,"expected the node content, but found ','"):ar(e,"missed comma between flow collection entries"),v=y=x=null,f=p=!1,b===63&&(h=e.input.charCodeAt(e.position+1),As(h)&&(f=p=!0,e.position++,En(e,!0,t))),i=e.line,n=e.lineStart,a=e.position,bg(e,t,f4,!1,!0),v=e.tag,y=e.result,En(e,!0,t),b=e.input.charCodeAt(e.position),(p||e.line===i)&&b===58&&(f=!0,b=e.input.charCodeAt(++e.position),En(e,!0,t),bg(e,t,f4,!1,!0),x=e.result),m?xg(e,l,g,v,y,x,i,n,a):f?l.push(xg(e,null,g,v,y,x,i,n,a)):l.push(y),En(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(r=!0,b=e.input.charCodeAt(++e.position)):r=!1}ar(e,"unexpected end of the stream within a flow collection")}function SVe(e,t){var r,i,n=BM,a=!1,s=!1,l=t,u=0,h=!1,d,f;if(f=e.input.charCodeAt(e.position),f===124)i=!1;else if(f===62)i=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)BM===n?n=f===43?dte:dVe:ar(e,"repeat of a chomping mode identifier");else if((d=vVe(f))>=0)d===0?ar(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?ar(e,"repeat of an indentation width identifier"):(l=t+d-1,s=!0);else break;if(kp(f)){do f=e.input.charCodeAt(++e.position);while(kp(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!Tc(f)&&f!==0)}for(;f!==0;){for(qM(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!s||e.lineIndentl&&(l=e.lineIndent),Tc(f)){u++;continue}if(e.lineIndentt)&&u!==0)ar(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&(v&&(s=e.line,l=e.lineStart,u=e.position),bg(e,t,p4,!0,n)&&(v?g=e.result:y=e.result),v||(xg(e,f,p,m,g,y,s,l,u),m=g=y=null),En(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>t)&&b!==0)ar(e,"bad indentation of a mapping entry");else if(e.lineIndentt?u=1:e.lineIndent===t?u=0:e.lineIndentt?u=1:e.lineIndent===t?u=0:e.lineIndent tag; it should be "scalar", not "'+e.kind+'"'),f=0,p=e.implicitTypes.length;f"),e.result!==null&&g.kind!==e.kind&&ar(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):ar(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}function RVe(e){var t=e.position,r,i,n,a=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(En(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(a=!0,s=e.input.charCodeAt(++e.position),r=e.position;s!==0&&!As(s);)s=e.input.charCodeAt(++e.position);for(i=e.input.slice(r,e.position),n=[],i.length<1&&ar(e,"directive name must not be less than one character in length");s!==0;){for(;kp(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Tc(s));break}if(Tc(s))break;for(r=e.position;s!==0&&!As(s);)s=e.input.charCodeAt(++e.position);n.push(e.input.slice(r,e.position))}s!==0&&qM(e),sd.call(mte,i)?mte[i](e,i,n):m4(e,'unknown document directive "'+i+'"')}if(En(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,En(e,!0,-1)):a&&ar(e,"directives end mark is expected"),bg(e,e.lineIndent-1,p4,!1,!0),En(e,!0,-1),e.checkLineBreaks&&pVe.test(e.input.slice(t,e.position))&&m4(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&v4(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,En(e,!0,-1));return}if(e.position"u"&&(r=t,t=null);var i=zte(e,r);if(typeof t!="function")return i;for(var n=0,a=i.length;n=55296&&r<=56319&&t+1=56320&&i<=57343)?(r-55296)*1024+i-56320+65536:r}function Xte(e){var t=/^\n* /;return t.test(e)}function sWe(e,t,r,i,n,a,s,l){var u,h=0,d=null,f=!1,p=!1,m=i!==-1,g=-1,y=nWe(Fx(e,0))&&aWe(Fx(e,e.length-1));if(t||s)for(u=0;u=65536?u+=2:u++){if(h=Fx(e,u),!Vx(h))return yg;y=y&&bte(h,d,l),d=h}else{for(u=0;u=65536?u+=2:u++){if(h=Fx(e,u),h===zx)f=!0,m&&(p=p||u-g-1>i&&e[g+1]!==" ",g=u);else if(!Vx(h))return yg;y=y&&bte(h,d,l),d=h}p=p||m&&u-g-1>i&&e[g+1]!==" "}return!f&&!p?y&&!s&&!n(e)?Kte:a===Gx?yg:GM:r>9&&Xte(e)?yg:s?a===Gx?yg:GM:p?Qte:Zte}function oWe(e,t,r,i,n){e.dump=(function(){if(t.length===0)return e.quotingType===Gx?'""':"''";if(!e.noCompatMode&&(ZVe.indexOf(t)!==-1||QVe.test(t)))return e.quotingType===Gx?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,r),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),l=i||e.flowLevel>-1&&r>=e.flowLevel;function u(h){return iWe(e,h)}switch(o(u,"testAmbiguity"),sWe(t,l,e.indent,s,u,e.quotingType,e.forceQuotes&&!i,n)){case Kte:return t;case GM:return"'"+t.replace(/'/g,"''")+"'";case Zte:return"|"+Tte(t,e.indent)+Cte(vte(t,a));case Qte:return">"+Tte(t,e.indent)+Cte(vte(lWe(t,s),a));case yg:return'"'+cWe(t)+'"';default:throw new Es("impossible error: invalid scalar style")}})()}function Tte(e,t){var r=Xte(e)?String(t):"",i=e[e.length-1]===` +`,n=i&&(e[e.length-2]===` +`||e===` +`),a=n?"+":i?"":"-";return r+a+` +`}function Cte(e){return e[e.length-1]===` +`?e.slice(0,-1):e}function lWe(e,t){for(var r=/(\n+)([^\n]*)/g,i=(function(){var h=e.indexOf(` +`);return h=h!==-1?h:e.length,r.lastIndex=h,kte(e.slice(0,h),t)})(),n=e[0]===` +`||e[0]===" ",a,s;s=r.exec(e);){var l=s[1],u=s[2];a=u[0]===" ",i+=l+(!n&&!a&&u!==""?` +`:"")+kte(u,t),n=a}return i}function kte(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,i,n=0,a,s=0,l=0,u="";i=r.exec(e);)l=i.index,l-n>t&&(a=s>n?s:l,u+=` +`+e.slice(n,a),n=a+1),s=l;return u+=` +`,e.length-n>t&&s>n?u+=e.slice(n,s)+` +`+e.slice(s+1):u+=e.slice(n),u.slice(1)}function cWe(e){for(var t="",r=0,i,n=0;n=65536?n+=2:n++)r=Fx(e,n),i=La[r],!i&&Vx(r)?(t+=e[n],r>=65536&&(t+=e[n+1])):t+=i||eWe(r);return t}function uWe(e,t,r){var i="",n=e.tag,a,s,l;for(a=0,s=r.length;a"u"&&Ou(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=n,e.dump="["+i+"]"}function wte(e,t,r,i){var n="",a=e.tag,s,l,u;for(s=0,l=r.length;s"u"&&Ou(e,t+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=zM(e,t)),e.dump&&zx===e.dump.charCodeAt(0)?n+="-":n+="- ",n+=e.dump);e.tag=a,e.dump=n||"[]"}function hWe(e,t,r){var i="",n=e.tag,a=Object.keys(r),s,l,u,h,d;for(s=0,l=a.length;s1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ou(e,t,h,!1,!1)&&(d+=e.dump,i+=d));e.tag=n,e.dump="{"+i+"}"}function dWe(e,t,r,i){var n="",a=e.tag,s=Object.keys(r),l,u,h,d,f,p;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Es("sortKeys must be a boolean or a function");for(l=0,u=s.length;l1024,f&&(e.dump&&zx===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,f&&(p+=zM(e,t)),Ou(e,t+1,d,!0,f)&&(e.dump&&zx===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,n+=p));e.tag=a,e.dump=n||"{}"}function Ste(e,t,r){var i,n,a,s,l,u;for(n=r?e.explicitTypes:e.implicitTypes,a=0,s=n.length;a tag resolver accepts not "'+u+'" style');e.dump=i}return!0}return!1}function Ou(e,t,r,i,n,a,s){e.tag=null,e.dump=r,Ste(e,r,!1)||Ste(e,r,!0);var l=Vte.call(e.dump),u=i,h;i&&(i=e.flowLevel<0||e.flowLevel>t);var d=l==="[object Object]"||l==="[object Array]",f,p;if(d&&(f=e.duplicates.indexOf(r),p=f!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(n=!1),p&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(d&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),l==="[object Object]")i&&Object.keys(e.dump).length!==0?(dWe(e,t,e.dump,n),p&&(e.dump="&ref_"+f+e.dump)):(hWe(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?wte(e,t-1,e.dump,n):wte(e,t,e.dump,n),p&&(e.dump="&ref_"+f+e.dump)):(uWe(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&oWe(e,e.dump,t,a,u);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new Es("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(h=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?h="!"+h:h.slice(0,18)==="tag:yaml.org,2002:"?h="!!"+h.slice(18):h="!<"+h+">",e.dump=h+" "+e.dump)}return!0}function fWe(e,t){var r=[],i=[],n,a;for(VM(e,r,i),n=0,a=i.length;n{"use strict";o(Ete,"isNothing");o(Kze,"isObject");o(Zze,"toArray");o(Qze,"extend");o(Jze,"repeat");o(eGe,"isNegativeZero");tGe=Ete,rGe=Kze,iGe=Zze,nGe=Jze,aGe=eGe,sGe=Qze,zn={isNothing:tGe,isObject:rGe,toArray:iGe,repeat:nGe,isNegativeZero:aGe,extend:sGe};o(Ate,"formatError");o($x,"YAMLException$1");$x.prototype=Object.create(Error.prototype);$x.prototype.constructor=$x;$x.prototype.toString=o(function(t){return this.name+": "+Ate(this,t)},"toString");Es=$x;o(OM,"getLine");o(PM,"padStart");o(oGe,"makeSnippet");lGe=oGe,cGe=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],uGe=["scalar","sequence","mapping"];o(hGe,"compileStyleAliases");o(dGe,"Type$1");Ra=dGe;o(hte,"compileList");o(fGe,"compileMap");o(FM,"Schema$1");FM.prototype.extend=o(function(t){var r=[],i=[];if(t instanceof Ra)i.push(t);else if(Array.isArray(t))i=i.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit));else throw new Es("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(a){if(!(a instanceof Ra))throw new Es("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new Es("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new Es("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(a){if(!(a instanceof Ra))throw new Es("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var n=Object.create(FM.prototype);return n.implicit=(this.implicit||[]).concat(r),n.explicit=(this.explicit||[]).concat(i),n.compiledImplicit=hte(n,"implicit"),n.compiledExplicit=hte(n,"explicit"),n.compiledTypeMap=fGe(n.compiledImplicit,n.compiledExplicit),n},"extend");pGe=FM,mGe=new Ra("tag:yaml.org,2002:str",{kind:"scalar",construct:o(function(e){return e!==null?e:""},"construct")}),gGe=new Ra("tag:yaml.org,2002:seq",{kind:"sequence",construct:o(function(e){return e!==null?e:[]},"construct")}),yGe=new Ra("tag:yaml.org,2002:map",{kind:"mapping",construct:o(function(e){return e!==null?e:{}},"construct")}),vGe=new pGe({explicit:[mGe,gGe,yGe]});o(xGe,"resolveYamlNull");o(bGe,"constructYamlNull");o(TGe,"isNull");CGe=new Ra("tag:yaml.org,2002:null",{kind:"scalar",resolve:xGe,construct:bGe,predicate:TGe,represent:{canonical:o(function(){return"~"},"canonical"),lowercase:o(function(){return"null"},"lowercase"),uppercase:o(function(){return"NULL"},"uppercase"),camelcase:o(function(){return"Null"},"camelcase"),empty:o(function(){return""},"empty")},defaultStyle:"lowercase"});o(kGe,"resolveYamlBoolean");o(wGe,"constructYamlBoolean");o(SGe,"isBoolean");EGe=new Ra("tag:yaml.org,2002:bool",{kind:"scalar",resolve:kGe,construct:wGe,predicate:SGe,represent:{lowercase:o(function(e){return e?"true":"false"},"lowercase"),uppercase:o(function(e){return e?"TRUE":"FALSE"},"uppercase"),camelcase:o(function(e){return e?"True":"False"},"camelcase")},defaultStyle:"lowercase"});o(AGe,"isHexCode");o(_Ge,"isOctCode");o(DGe,"isDecCode");o(RGe,"resolveYamlInteger");o(LGe,"constructYamlInteger");o(MGe,"isInteger");NGe=new Ra("tag:yaml.org,2002:int",{kind:"scalar",resolve:RGe,construct:LGe,predicate:MGe,represent:{binary:o(function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},"binary"),octal:o(function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},"octal"),decimal:o(function(e){return e.toString(10)},"decimal"),hexadecimal:o(function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)},"hexadecimal")},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),IGe=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");o(OGe,"resolveYamlFloat");o(PGe,"constructYamlFloat");BGe=/^[-+]?[0-9]+e/;o(FGe,"representYamlFloat");o($Ge,"isFloat");zGe=new Ra("tag:yaml.org,2002:float",{kind:"scalar",resolve:OGe,construct:PGe,predicate:$Ge,represent:FGe,defaultStyle:"lowercase"}),_te=vGe.extend({implicit:[CGe,EGe,NGe,zGe]}),GGe=_te,Dte=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Rte=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");o(VGe,"resolveYamlTimestamp");o(WGe,"constructYamlTimestamp");o(qGe,"representYamlTimestamp");UGe=new Ra("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:VGe,construct:WGe,instanceOf:Date,represent:qGe});o(HGe,"resolveYamlMerge");YGe=new Ra("tag:yaml.org,2002:merge",{kind:"scalar",resolve:HGe}),WM=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= +\r`;o(jGe,"resolveYamlBinary");o(XGe,"constructYamlBinary");o(KGe,"representYamlBinary");o(ZGe,"isBinary");QGe=new Ra("tag:yaml.org,2002:binary",{kind:"scalar",resolve:jGe,construct:XGe,predicate:ZGe,represent:KGe}),JGe=Object.prototype.hasOwnProperty,eVe=Object.prototype.toString;o(tVe,"resolveYamlOmap");o(rVe,"constructYamlOmap");iVe=new Ra("tag:yaml.org,2002:omap",{kind:"sequence",resolve:tVe,construct:rVe}),nVe=Object.prototype.toString;o(aVe,"resolveYamlPairs");o(sVe,"constructYamlPairs");oVe=new Ra("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:aVe,construct:sVe}),lVe=Object.prototype.hasOwnProperty;o(cVe,"resolveYamlSet");o(uVe,"constructYamlSet");hVe=new Ra("tag:yaml.org,2002:set",{kind:"mapping",resolve:cVe,construct:uVe}),Lte=GGe.extend({implicit:[UGe,YGe],explicit:[QGe,iVe,oVe,hVe]}),sd=Object.prototype.hasOwnProperty,f4=1,Mte=2,Nte=3,p4=4,BM=1,dVe=2,dte=3,fVe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,pVe=/[\x85\u2028\u2029]/,mVe=/[,\[\]\{\}]/,Ite=/^(?:!|!!|![a-z\-]+!)$/i,Ote=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;o(fte,"_class");o(Tc,"is_EOL");o(kp,"is_WHITE_SPACE");o(As,"is_WS_OR_EOL");o(vg,"is_FLOW_INDICATOR");o(gVe,"fromHexCode");o(yVe,"escapedHexLen");o(vVe,"fromDecimalCode");o(pte,"simpleEscapeSequence");o(xVe,"charFromCodepoint");o(Pte,"setProperty");Bte=new Array(256),Fte=new Array(256);for(Cp=0;Cp<256;Cp++)Bte[Cp]=pte(Cp)?1:0,Fte[Cp]=pte(Cp);o(bVe,"State$1");o($te,"generateError");o(ar,"throwError");o(m4,"throwWarning");mte={YAML:o(function(t,r,i){var n,a,s;t.version!==null&&ar(t,"duplication of %YAML directive"),i.length!==1&&ar(t,"YAML directive accepts exactly one argument"),n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),n===null&&ar(t,"ill-formed argument of the YAML directive"),a=parseInt(n[1],10),s=parseInt(n[2],10),a!==1&&ar(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&m4(t,"unsupported YAML version of the document")},"handleYamlDirective"),TAG:o(function(t,r,i){var n,a;i.length!==2&&ar(t,"TAG directive accepts exactly two arguments"),n=i[0],a=i[1],Ite.test(n)||ar(t,"ill-formed tag handle (first argument) of the TAG directive"),sd.call(t.tagMap,n)&&ar(t,'there is a previously declared suffix for "'+n+'" tag handle'),Ote.test(a)||ar(t,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{ar(t,"tag prefix is malformed: "+a)}t.tagMap[n]=a},"handleTagDirective")};o(ad,"captureSegment");o(gte,"mergeMappings");o(xg,"storeMappingPair");o(qM,"readLineBreak");o(En,"skipSeparationSpace");o(v4,"testDocumentSeparator");o(UM,"writeFoldedLines");o(TVe,"readPlainScalar");o(CVe,"readSingleQuotedScalar");o(kVe,"readDoubleQuotedScalar");o(wVe,"readFlowCollection");o(SVe,"readBlockScalar");o(yte,"readBlockSequence");o(EVe,"readBlockMapping");o(AVe,"readTagProperty");o(_Ve,"readAnchorProperty");o(DVe,"readAlias");o(bg,"composeNode");o(RVe,"readDocument");o(zte,"loadDocuments");o(LVe,"loadAll$1");o(MVe,"load$1");NVe=LVe,IVe=MVe,Gte={loadAll:NVe,load:IVe},Vte=Object.prototype.toString,Wte=Object.prototype.hasOwnProperty,HM=65279,OVe=9,zx=10,PVe=13,BVe=32,FVe=33,$Ve=34,$M=35,zVe=37,GVe=38,VVe=39,WVe=42,qte=44,qVe=45,g4=58,UVe=61,HVe=62,YVe=63,jVe=64,Ute=91,Hte=93,XVe=96,Yte=123,KVe=124,jte=125,La={};La[0]="\\0";La[7]="\\a";La[8]="\\b";La[9]="\\t";La[10]="\\n";La[11]="\\v";La[12]="\\f";La[13]="\\r";La[27]="\\e";La[34]='\\"';La[92]="\\\\";La[133]="\\N";La[160]="\\_";La[8232]="\\L";La[8233]="\\P";ZVe=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],QVe=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;o(JVe,"compileStyleMap");o(eWe,"encodeHex");tWe=1,Gx=2;o(rWe,"State");o(vte,"indentString");o(zM,"generateNextLine");o(iWe,"testImplicitResolving");o(y4,"isWhitespace");o(Vx,"isPrintable");o(xte,"isNsCharOrWhitespace");o(bte,"isPlainSafe");o(nWe,"isPlainSafeFirst");o(aWe,"isPlainSafeLast");o(Fx,"codePointAt");o(Xte,"needIndentIndicator");Kte=1,GM=2,Zte=3,Qte=4,yg=5;o(sWe,"chooseScalarStyle");o(oWe,"writeScalar");o(Tte,"blockHeader");o(Cte,"dropEndingNewline");o(lWe,"foldString");o(kte,"foldLine");o(cWe,"escapeString");o(uWe,"writeFlowSequence");o(wte,"writeBlockSequence");o(hWe,"writeFlowMapping");o(dWe,"writeBlockMapping");o(Ste,"detectType");o(Ou,"writeNode");o(fWe,"getDuplicateReferences");o(VM,"inspectNode");o(pWe,"dump$1");mWe=pWe,gWe={dump:mWe};o(YM,"renamed");od=_te,ld=Gte.load,yYt=Gte.loadAll,vYt=gWe.dump,xYt=YM("safeLoad","load"),bYt=YM("safeLoadAll","loadAll"),TYt=YM("safeDump","dump")});function ZM(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function nre(e){Sp=e}function li(e,t=""){let r=typeof e=="string"?e:e.source,i={replace:o((n,a)=>{let s=typeof a=="string"?a:a.source;return s=s.replace(Ja.caret,"$1"),r=r.replace(n,s),i},"replace"),getRegex:o(()=>new RegExp(r,t),"getRegex")};return i}function Cc(e,t){if(t){if(Ja.escapeTest.test(e))return e.replace(Ja.escapeReplace,ere)}else if(Ja.escapeTestNoEncode.test(e))return e.replace(Ja.escapeReplaceNoEncode,ere);return e}function tre(e){try{e=encodeURI(e).replace(Ja.percentDecode,"%")}catch{return null}return e}function rre(e,t){let r=e.replace(Ja.findPipe,(a,s,l)=>{let u=!1,h=s;for(;--h>=0&&l[h]==="\\";)u=!u;return u?"|":" |"}),i=r.split(Ja.splitPipe),n=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length0?-2:-1}function ire(e,t,r,i,n){let a=t.href,s=t.title||null,l=e[1].replace(n.other.outputLinkReplace,"$1");i.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:a,title:s,text:l,tokens:i.inlineTokens(l)};return i.state.inLink=!1,u}function ZWe(e,t,r){let i=e.match(r.other.indentCodeCompensation);if(i===null)return t;let n=i[1];return t.split(` +`).map(a=>{let s=a.match(r.other.beginningSpace);if(s===null)return a;let[l]=s;return l.length>=n.length?a.slice(n.length):a}).join(` +`)}function ni(e,t){return wp.parse(e,t)}var Sp,Yx,Ja,yWe,vWe,xWe,jx,bWe,QM,are,sre,TWe,JM,CWe,eN,kWe,wWe,w4,tN,SWe,ore,EWe,rN,Jte,AWe,_We,DWe,RWe,lre,LWe,S4,iN,cre,MWe,ure,NWe,IWe,OWe,hre,PWe,BWe,dre,FWe,$We,zWe,GWe,VWe,WWe,qWe,T4,UWe,fre,pre,HWe,nN,YWe,jM,jWe,b4,qx,XWe,ere,C4,Pu,k4,aN,Bu,Hx,QWe,wp,kYt,wYt,SYt,EYt,AYt,_Yt,DYt,mre=z(()=>{"use strict";o(ZM,"L");Sp=ZM();o(nre,"G");Yx={exec:o(()=>null,"exec")};o(li,"h");Ja={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^
    /i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:o(e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),"listItemRegex"),nextBulletRegex:o(e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),"nextBulletRegex"),hrRegex:o(e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),"hrRegex"),fencesBeginRegex:o(e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),"fencesBeginRegex"),headingBeginRegex:o(e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),"headingBeginRegex"),htmlBeginRegex:o(e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),"htmlBeginRegex")},yWe=/^(?:[ \t]*(?:\n|$))+/,vWe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,xWe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,jx=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,bWe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,QM=/(?:[*+-]|\d{1,9}[.)])/,are=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,sre=li(are).replace(/bull/g,QM).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),TWe=li(are).replace(/bull/g,QM).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),JM=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,CWe=/^[^\n]+/,eN=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,kWe=li(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",eN).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),wWe=li(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,QM).getRegex(),w4="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",tN=/|$))/,SWe=li("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",tN).replace("tag",w4).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ore=li(JM).replace("hr",jx).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",w4).getRegex(),EWe=li(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ore).getRegex(),rN={blockquote:EWe,code:vWe,def:kWe,fences:xWe,heading:bWe,hr:jx,html:SWe,lheading:sre,list:wWe,newline:yWe,paragraph:ore,table:Yx,text:CWe},Jte=li("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",jx).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",w4).getRegex(),AWe={...rN,lheading:TWe,table:Jte,paragraph:li(JM).replace("hr",jx).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jte).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",w4).getRegex()},_We={...rN,html:li(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",tN).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Yx,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:li(JM).replace("hr",jx).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",sre).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},DWe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,RWe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,lre=/^( {2,}|\\)\n(?!\s*$)/,LWe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,hre=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,PWe=li(hre,"u").replace(/punct/g,S4).getRegex(),BWe=li(hre,"u").replace(/punct/g,ure).getRegex(),dre="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",FWe=li(dre,"gu").replace(/notPunctSpace/g,cre).replace(/punctSpace/g,iN).replace(/punct/g,S4).getRegex(),$We=li(dre,"gu").replace(/notPunctSpace/g,IWe).replace(/punctSpace/g,NWe).replace(/punct/g,ure).getRegex(),zWe=li("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,cre).replace(/punctSpace/g,iN).replace(/punct/g,S4).getRegex(),GWe=li(/\\(punct)/,"gu").replace(/punct/g,S4).getRegex(),VWe=li(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),WWe=li(tN).replace("(?:-->|$)","-->").getRegex(),qWe=li("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",WWe).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),T4=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`[^`]*`|[^\[\]\\`])*?/,UWe=li(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",T4).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fre=li(/^!?\[(label)\]\[(ref)\]/).replace("label",T4).replace("ref",eN).getRegex(),pre=li(/^!?\[(ref)\](?:\[\])?/).replace("ref",eN).getRegex(),HWe=li("reflink|nolink(?!\\()","g").replace("reflink",fre).replace("nolink",pre).getRegex(),nN={_backpedal:Yx,anyPunctuation:GWe,autolink:VWe,blockSkip:OWe,br:lre,code:RWe,del:Yx,emStrongLDelim:PWe,emStrongRDelimAst:FWe,emStrongRDelimUnd:zWe,escape:DWe,link:UWe,nolink:pre,punctuation:MWe,reflink:fre,reflinkSearch:HWe,tag:qWe,text:LWe,url:Yx},YWe={...nN,link:li(/^!?\[(label)\]\((.*?)\)/).replace("label",T4).getRegex(),reflink:li(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",T4).getRegex()},jM={...nN,emStrongRDelimAst:$We,emStrongLDelim:BWe,url:li(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},ere=o(e=>XWe[e],"ke");o(Cc,"w");o(tre,"J");o(rre,"V");o(Ux,"z");o(KWe,"ge");o(ire,"fe");o(ZWe,"Je");C4=class{static{o(this,"y")}options;rules;lexer;constructor(e){this.options=e||Sp}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Ux(r,` +`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],i=ZWe(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:i}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let i=Ux(r,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(r=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Ux(t[0],` +`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=Ux(t[0],` +`).split(` +`),i="",n="",a=[];for(;r.length>0;){let s=!1,l=[],u;for(u=0;u1,n={type:"list",raw:"",ordered:i,start:i?+r.slice(0,-1):"",loose:!1,items:[]};r=i?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=i?r:"[*+-]");let a=this.rules.other.listItemRegex(r),s=!1;for(;e;){let u=!1,h="",d="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;h=t[0],e=e.substring(h.length);let f=t[2].split(` +`,1)[0].replace(this.rules.other.listReplaceTabs,x=>" ".repeat(3*x.length)),p=e.split(` +`,1)[0],m=!f.trim(),g=0;if(this.options.pedantic?(g=2,d=f.trimStart()):m?g=t[1].length+1:(g=t[2].search(this.rules.other.nonSpaceChar),g=g>4?1:g,d=f.slice(g),g+=t[1].length),m&&this.rules.other.blankLine.test(p)&&(h+=p+` +`,e=e.substring(p.length+1),u=!0),!u){let x=this.rules.other.nextBulletRegex(g),b=this.rules.other.hrRegex(g),T=this.rules.other.fencesBeginRegex(g),w=this.rules.other.headingBeginRegex(g),C=this.rules.other.htmlBeginRegex(g);for(;e;){let k=e.split(` +`,1)[0],E;if(p=k,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),E=p):E=p.replace(this.rules.other.tabCharGlobal," "),T.test(p)||w.test(p)||C.test(p)||x.test(p)||b.test(p))break;if(E.search(this.rules.other.nonSpaceChar)>=g||!p.trim())d+=` +`+E.slice(g);else{if(m||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||T.test(f)||w.test(f)||b.test(f))break;d+=` +`+p}!m&&!p.trim()&&(m=!0),h+=k+` +`,e=e.substring(k.length+1),f=E.slice(g)}}n.loose||(s?n.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(s=!0));let y=null,v;this.options.gfm&&(y=this.rules.other.listIsTask.exec(d),y&&(v=y[0]!=="[ ] ",d=d.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:h,task:!!y,checked:v,loose:!1,text:d,tokens:[]}),n.raw+=h}let l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let u=0;uf.type==="space"),d=h.length>0&&h.some(f=>this.rules.other.anyLine.test(f.raw));n.loose=d}if(n.loose)for(let u=0;u({text:l,tokens:this.lexer.inline(l),header:!1,align:a.align[u]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===` +`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let a=Ux(r.slice(0,-1),"\\");if((r.length-a.length)%2===0)return}else{let a=KWe(t[2],"()");if(a===-2)return;if(a>-1){let s=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,s).trim(),t[3]=""}}let i=t[2],n="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(i);a&&(i=a[1],n=a[3])}else n=t[3]?t[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i=i.slice(1):i=i.slice(1,-1)),ire(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let i=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[i.toLowerCase()];if(!n){let a=r[0].charAt(0);return{type:"text",raw:a,text:a}}return ire(r,n,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!r||this.rules.inline.punctuation.exec(r))){let n=[...i[0]].length-1,a,s,l=n,u=0,h=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,t=t.slice(-1*e.length+n);(i=h.exec(t))!=null;){if(a=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!a)continue;if(s=[...a].length,i[3]||i[4]){l+=s;continue}else if((i[5]||i[6])&&n%3&&!((n+s)%3)){u+=s;continue}if(l-=s,l>0)continue;s=Math.min(s,s+l+u);let d=[...i[0]][0].length,f=e.slice(0,n+i.index+d+s);if(Math.min(n,s)%2){let m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}let p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return i&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,i;return t[2]==="@"?(r=t[1],i="mailto:"+r):(r=t[1],i=r),{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},Pu=class XM{static{o(this,"l")}tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Sp,this.options.tokenizer=this.options.tokenizer||new C4,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:Ja,block:b4.normal,inline:qx.normal};this.options.pedantic?(r.block=b4.pedantic,r.inline=qx.pedantic):this.options.gfm&&(r.block=b4.gfm,this.options.breaks?r.inline=qx.breaks:r.inline=qx.gfm),this.tokenizer.rules=r}static get rules(){return{block:b4,inline:qx}}static lex(t,r){return new XM(r).lex(t)}static lexInline(t,r){return new XM(r).inlineTokens(t)}lex(t){t=t.replace(Ja.carriageReturn,` +`),this.blockTokens(t,this.tokens);for(let r=0;r(n=s.call({lexer:this},t,r))?(t=t.substring(n.raw.length),r.push(n),!0):!1))continue;if(n=this.tokenizer.space(t)){t=t.substring(n.raw.length);let s=r.at(-1);n.raw.length===1&&s!==void 0?s.raw+=` +`:r.push(n);continue}if(n=this.tokenizer.code(t)){t=t.substring(n.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+n.raw,s.text+=` +`+n.text,this.inlineQueue.at(-1).src=s.text):r.push(n);continue}if(n=this.tokenizer.fences(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.heading(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.hr(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.blockquote(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.list(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.html(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.def(t)){t=t.substring(n.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+n.raw,s.text+=` +`+n.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},r.push(n));continue}if(n=this.tokenizer.table(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.lheading(t)){t=t.substring(n.raw.length),r.push(n);continue}let a=t;if(this.options.extensions?.startBlock){let s=1/0,l=t.slice(1),u;this.options.extensions.startBlock.forEach(h=>{u=h.call({lexer:this},l),typeof u=="number"&&u>=0&&(s=Math.min(s,u))}),s<1/0&&s>=0&&(a=t.substring(0,s+1))}if(this.state.top&&(n=this.tokenizer.paragraph(a))){let s=r.at(-1);i&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+n.raw,s.text+=` +`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(n),i=a.length!==t.length,t=t.substring(n.raw.length);continue}if(n=this.tokenizer.text(t)){t=t.substring(n.raw.length);let s=r.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(` +`)?"":` +`)+n.raw,s.text+=` +`+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(n);continue}if(t){let s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let i=t,n=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)l.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,n.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(n=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)i=i.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let a=!1,s="";for(;t;){a||(s=""),a=!1;let l;if(this.options.extensions?.inline?.some(h=>(l=h.call({lexer:this},t,r))?(t=t.substring(l.raw.length),r.push(l),!0):!1))continue;if(l=this.tokenizer.escape(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.tag(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.link(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(l.raw.length);let h=r.at(-1);l.type==="text"&&h?.type==="text"?(h.raw+=l.raw,h.text+=l.text):r.push(l);continue}if(l=this.tokenizer.emStrong(t,i,s)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.codespan(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.br(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.del(t)){t=t.substring(l.raw.length),r.push(l);continue}if(l=this.tokenizer.autolink(t)){t=t.substring(l.raw.length),r.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(t))){t=t.substring(l.raw.length),r.push(l);continue}let u=t;if(this.options.extensions?.startInline){let h=1/0,d=t.slice(1),f;this.options.extensions.startInline.forEach(p=>{f=p.call({lexer:this},d),typeof f=="number"&&f>=0&&(h=Math.min(h,f))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(l=this.tokenizer.inlineText(u)){t=t.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(s=l.raw.slice(-1)),a=!0;let h=r.at(-1);h?.type==="text"?(h.raw+=l.raw,h.text+=l.text):r.push(l);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return r}},k4=class{static{o(this,"P")}options;parser;constructor(e){this.options=e||Sp}space(e){return""}code({text:e,lang:t,escaped:r}){let i=(t||"").match(Ja.notSpaceStart)?.[0],n=e.replace(Ja.endingNewline,"")+` +`;return i?'
    '+(r?n:Cc(n,!0))+`
    +`:"
    "+(r?n:Cc(n,!0))+`
    +`}blockquote({tokens:e}){return`
    +${this.parser.parse(e)}
    +`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} +`}hr(e){return`
    +`}list(e){let t=e.ordered,r=e.start,i="";for(let s=0;s +`+i+" +`}listitem(e){let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+Cc(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`
  • ${t}
  • +`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    +`}table(e){let t="",r="";for(let n=0;n${i}`),` + +`+t+` +`+i+`
    +`}tablerow({text:e}){return` +${e} +`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+` +`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Cc(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:r}){let i=this.parser.parseInline(r),n=tre(e);if(n===null)return i;e=n;let a='
    ",a}image({href:e,title:t,text:r,tokens:i}){i&&(r=this.parser.parseInline(i,this.parser.textRenderer));let n=tre(e);if(n===null)return Cc(r);e=n;let a=`${r}{let s=n[a].flat(1/0);r=r.concat(this.walkTokens(s,t))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let a=t.renderers[n.name];a?t.renderers[n.name]=function(...s){let l=n.renderer.apply(this,s);return l===!1&&(l=a.apply(this,s)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[n.level];a?a.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),i.extensions=t),r.renderer){let n=this.defaults.renderer||new k4(this.defaults);for(let a in r.renderer){if(!(a in n))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let s=a,l=r.renderer[s],u=n[s];n[s]=(...h)=>{let d=l.apply(n,h);return d===!1&&(d=u.apply(n,h)),d||""}}i.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new C4(this.defaults);for(let a in r.tokenizer){if(!(a in n))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let s=a,l=r.tokenizer[s],u=n[s];n[s]=(...h)=>{let d=l.apply(n,h);return d===!1&&(d=u.apply(n,h)),d}}i.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new Hx;for(let a in r.hooks){if(!(a in n))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let s=a,l=r.hooks[s],u=n[s];Hx.passThroughHooks.has(a)?n[s]=h=>{if(this.defaults.async&&Hx.passThroughHooksRespectAsync.has(a))return Promise.resolve(l.call(n,h)).then(f=>u.call(n,f));let d=l.call(n,h);return u.call(n,d)}:n[s]=(...h)=>{let d=l.apply(n,h);return d===!1&&(d=u.apply(n,h)),d}}i.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,a=r.walkTokens;i.walkTokens=function(s){let l=[];return l.push(a.call(this,s)),n&&(l=l.concat(n.call(this,s))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Pu.lex(e,t??this.defaults)}parser(e,t){return Bu.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let i={...r},n={...this.defaults,...i},a=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&i.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));n.hooks&&(n.hooks.options=n,n.hooks.block=e);let s=n.hooks?n.hooks.provideLexer():e?Pu.lex:Pu.lexInline,l=n.hooks?n.hooks.provideParser():e?Bu.parse:Bu.parseInline;if(n.async)return Promise.resolve(n.hooks?n.hooks.preprocess(t):t).then(u=>s(u,n)).then(u=>n.hooks?n.hooks.processAllTokens(u):u).then(u=>n.walkTokens?Promise.all(this.walkTokens(u,n.walkTokens)).then(()=>u):u).then(u=>l(u,n)).then(u=>n.hooks?n.hooks.postprocess(u):u).catch(a);try{n.hooks&&(t=n.hooks.preprocess(t));let u=s(t,n);n.hooks&&(u=n.hooks.processAllTokens(u)),n.walkTokens&&this.walkTokens(u,n.walkTokens);let h=l(u,n);return n.hooks&&(h=n.hooks.postprocess(h)),h}catch(u){return a(u)}}}onError(e,t){return r=>{if(r.message+=` +Please report this to https://github.com/markedjs/marked.`,e){let i="

    An error occurred:

    "+Cc(r.message+"",!0)+"
    ";return t?Promise.resolve(i):i}if(t)return Promise.reject(r);throw r}}},wp=new QWe;o(ni,"d");ni.options=ni.setOptions=function(e){return wp.setOptions(e),ni.defaults=wp.defaults,nre(ni.defaults),ni};ni.getDefaults=ZM;ni.defaults=Sp;ni.use=function(...e){return wp.use(...e),ni.defaults=wp.defaults,nre(ni.defaults),ni};ni.walkTokens=function(e,t){return wp.walkTokens(e,t)};ni.parseInline=wp.parseInline;ni.Parser=Bu;ni.parser=Bu.parse;ni.Renderer=k4;ni.TextRenderer=aN;ni.Lexer=Pu;ni.lexer=Pu.lex;ni.Tokenizer=C4;ni.Hooks=Hx;ni.parse=ni;kYt=ni.options,wYt=ni.setOptions,SYt=ni.use,EYt=ni.walkTokens,AYt=ni.parseInline,_Yt=Bu.parse,DYt=Pu.lex});function JWe(e,{markdownAutoWrap:t}){let i=e.replace(//g,` +`).replace(/\n{2,}/g,` +`);return fk(i)}function gre(e){return e.split(/\\n|\n|/gi).map(t=>t.trim().match(/<[^>]+>|[^\s<>]+/g)?.map(r=>({content:r,type:"normal"}))??[])}function yre(e,t={}){let r=JWe(e,t),i=ni.lexer(r),n=[[]],a=0;function s(l,u="normal"){l.type==="text"?l.text.split(` +`).forEach((d,f)=>{f!==0&&(a++,n.push([])),d.split(" ").forEach(p=>{p=p.replace(/'/g,"'"),p&&n[a].push({content:p,type:u})})}):l.type==="strong"||l.type==="em"?l.tokens.forEach(h=>{s(h,l.type)}):l.type==="html"&&n[a].push({content:l.text,type:"normal"})}return o(s,"processNode"),i.forEach(l=>{l.type==="paragraph"?l.tokens?.forEach(u=>{s(u)}):l.type==="html"?n[a].push({content:l.text,type:"normal"}):n[a].push({content:l.raw,type:"normal"})}),n}function vre(e){return e?`

    ${e.replace(/\\n|\n/g,"
    ")}

    `:""}function xre(e,{markdownAutoWrap:t}={}){let r=ni.lexer(e);function i(n){return n.type==="text"?t===!1?n.text.replace(/\n */g,"
    ").replace(/ /g," "):n.text.replace(/\n */g,"
    "):n.type==="strong"?`${n.tokens?.map(i).join("")}`:n.type==="em"?`${n.tokens?.map(i).join("")}`:n.type==="paragraph"?`

    ${n.tokens?.map(i).join("")}

    `:n.type==="space"?"":n.type==="html"?`${n.text}`:n.type==="escape"?n.text:(Z.warn(`Unsupported markdown: ${n.type}`),n.raw)}return o(i,"output"),r.map(i).join("")}var bre=z(()=>{"use strict";mre();RD();St();o(JWe,"preprocessMarkdown");o(gre,"nonMarkdownToLines");o(yre,"markdownToLines");o(vre,"nonMarkdownToHTML");o(xre,"markdownToHTML")});function eqe(e){return Intl.Segmenter?[...new Intl.Segmenter().segment(e)].map(t=>t.segment):[...e]}function tqe(e,t){let r=eqe(t.content);return Tre(e,[],r,t.type)}function Tre(e,t,r,i){if(r.length===0)return[{content:t.join(""),type:i},{content:"",type:i}];let[n,...a]=r,s=[...t,n];return e([{content:s.join(""),type:i}])?Tre(e,s,a,i):(t.length===0&&n&&(t.push(n),r.shift()),[{content:t.join(""),type:i},{content:r.join(""),type:i}])}function Cre(e,t){if(e.some(({content:r})=>r.includes(` +`)))throw new Error("splitLineToFitWidth does not support newlines in the line");return sN(e,t)}function sN(e,t,r=[],i=[]){if(e.length===0)return i.length>0&&r.push(i),r.length>0?r:[];let n="";e[0].content===" "&&(n=" ",e.shift());let a=e.shift()??{content:" ",type:"normal"},s=[...i];if(n!==""&&s.push({content:n,type:"normal"}),s.push(a),t(s))return sN(e,t,r,s);if(i.length>0)r.push(i),e.unshift(a);else if(a.content){let[l,u]=tqe(t,a);r.push([l]),u.content&&e.unshift(u)}return sN(e,t,r)}var kre=z(()=>{"use strict";o(eqe,"splitTextToChars");o(tqe,"splitWordToFitWidth");o(Tre,"splitWordToFitWidthRecursion");o(Cre,"splitLineToFitWidth");o(sN,"splitLineToFitWidthRecursion")});function wre(e,t){t&&e.attr("style",t)}async function rqe(e,t,r,i,n=!1,a=Nt()){let s=e.append("foreignObject");s.attr("width",`${Math.min(10*r,Sre)}px`),s.attr("height",`${Math.min(10*r,Sre)}px`);let l=s.append("xhtml:div"),u=Bi(t.label)?await Fm(t.label.replace(vt.lineBreakRegex,` +`),a):fr(t.label,a),h=t.isNode?"nodeLabel":"edgeLabel",d=l.append("span");d.html(u),wre(d,t.labelStyle),d.attr("class",`${h} ${i}`),wre(l,t.labelStyle),l.style("display","table-cell"),l.style("white-space","nowrap"),l.style("line-height","1.5"),r!==Number.POSITIVE_INFINITY&&(l.style("max-width",r+"px"),l.style("text-align","center")),l.attr("xmlns","http://www.w3.org/1999/xhtml"),n&&l.attr("class","labelBkg");let f=l.node().getBoundingClientRect();return f.width===r&&(l.style("display","table"),l.style("white-space","break-spaces"),l.style("width",r+"px"),f=l.node().getBoundingClientRect()),s.node()}function oN(e,t,r,i=!1){let n=e.append("tspan").attr("class","text-outer-tspan").attr("x",0).attr("y",t*r-.1+"em").attr("dy",r+"em");return i&&n.attr("text-anchor","middle"),n}function iqe(e,t,r){let i=e.append("text"),n=oN(i,1,t);lN(n,r);let a=n.node().getComputedTextLength();return i.remove(),a}function Are(e,t,r){let i=e.append("text"),n=oN(i,1,t);lN(n,[{content:r,type:"normal"}]);let a=n.node()?.getBoundingClientRect();return a&&i.remove(),a}function nqe(e,t,r,i=!1,n=!1){let s=t.append("g"),l=s.insert("rect").attr("class","background").attr("style","stroke: none"),u=s.append("text").attr("y","-10.1");n&&u.attr("text-anchor","middle");let h=0;for(let d of r){let f=o(m=>iqe(s,1.1,m)<=e,"checkWidth"),p=f(d)?[d]:Cre(d,f);for(let m of p){let g=oN(u,h,1.1,n);lN(g,m),h++}}if(i){let d=u.node().getBBox(),f=2;return l.attr("x",d.x-f).attr("y",d.y-f).attr("width",d.width+2*f).attr("height",d.height+2*f),s.node()}else return u.node()}function Ere(e){let t=/&(amp|lt|gt);/g;return e.replace(t,(r,i)=>{switch(i){case"amp":return"&";case"lt":return"<";case"gt":return">";default:return r}})}function lN(e,t){e.text(""),t.forEach((r,i)=>{let n=e.append("tspan").attr("font-style",r.type==="em"?"italic":"normal").attr("class","text-inner-tspan").attr("font-weight",r.type==="strong"?"bold":"normal");i===0?n.text(Ere(r.content)):n.text(" "+Ere(r.content))})}async function aqe(e,t={}){let r=[];e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,(n,a,s)=>(r.push((async()=>{let l=`${a}:${s}`;return await Zj(l)?await ks(l,void 0,{class:"label-icon"}):``})()),n));let i=await Promise.all(r);return e.replace(/(fa[bklrs]?):fa-([\w-]+)/g,()=>i.shift()??"")}var Sre,wi,_s=z(()=>{"use strict";Rr();Ir();St();bre();Xt();uc();kre();br();o(wre,"applyStyle");Sre=16384;o(rqe,"addHtmlSpan");o(oN,"createTspan");o(iqe,"computeWidthOfText");o(Are,"computeDimensionOfText");o(nqe,"createFormattedText");o(Ere,"decodeHTMLEntities");o(lN,"updateTextContentAndStyles");o(aqe,"replaceIconSubstring");wi=o(async(e,t="",{style:r="",isTitle:i=!1,classes:n="",useHtmlLabels:a=!0,markdown:s=!0,isNode:l=!0,width:u=200,addSvgBackground:h=!1}={},d)=>{if(Z.debug("XYZ createText",t,r,i,n,a,l,"addSvgBackground: ",h),a){let f=s?xre(t,d):vre(t),p=await aqe(Qa(f),d),m=t.replace(/\\\\/g,"\\"),g={isNode:l,label:Bi(t)?m:p,labelStyle:r.replace("fill:","color:")};return await rqe(e,g,u,n,h,d)}else{let f=Qa(t.replace(//g,"
    ")),p=s?yre(f.replace("
    ","
    "),d):gre(f),m=nqe(u,e,p,t?h:!1,!l);if(l){/stroke:/.exec(r)&&(r=r.replace("stroke:","lineColor:"));let g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Je(m).attr("style",g)}else{let g=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/background:/g,"fill:");Je(m).select("rect").attr("style",g.replace(/background:/g,"fill:"));let y=r.replace(/stroke:[^;]+;?/g,"").replace(/stroke-width:[^;]+;?/g,"").replace(/fill:[^;]+;?/g,"").replace(/color:/g,"fill:");Je(m).select("text").attr("style",y)}return i?Je(m).selectAll("tspan.text-outer-tspan").classed("title-row",!0):Je(m).selectAll("tspan.text-outer-tspan").classed("row",!0),m}},"createText")});async function E4(e,t){let r=e.getElementsByTagName("img");if(!r||r.length===0)return;let i=t.replace(/]*>/g,"").trim()==="";await Promise.all([...r].map(n=>new Promise(a=>{function s(){if(n.style.display="flex",n.style.flexDirection="column",i){let l=ge().fontSize?ge().fontSize:window.getComputedStyle(document.body).fontSize,u=5,[h=or.fontSize]=Za(l),d=h*u+"px";n.style.minWidth=d,n.style.maxWidth=d}else n.style.width="100%";a(n)}o(s,"setupImage"),setTimeout(()=>{n.complete&&s()}),n.addEventListener("error",s),n.addEventListener("load",s)})))}var cN=z(()=>{"use strict";Ut();Bn();Xt();o(E4,"configureLabelImages")});function tr(e){let t=e.map((r,i)=>`${i===0?"M":"L"}${r.x},${r.y}`);return t.push("Z"),t.join(" ")}function Bo(e,t,r,i,n,a){let s=[],u=r-e,h=i-t,d=u/a,f=2*Math.PI/d,p=t+h/2;for(let m=0;m<=50;m++){let g=m/50,y=e+g*u,v=p+n*Math.sin(f*(y-e));s.push({x:y,y:v})}return s}function Ep(e,t,r,i,n,a){let s=[],l=n*Math.PI/180,d=(a*Math.PI/180-l)/(i-1);for(let f=0;fu.tagName==="path"),r=document.createElementNS("http://www.w3.org/2000/svg","path"),i=t.map(u=>u.getAttribute("d")).filter(u=>u!==null).join(" ");r.setAttribute("d",i);let n=t.find(u=>u.getAttribute("fill")!=="none"),a=t.find(u=>u.getAttribute("stroke")!=="none"),s=o((u,h)=>u?.getAttribute(h)??void 0,"getAttr");if(n){let u={fill:s(n,"fill"),"fill-opacity":s(n,"fill-opacity")??"1"};Object.entries(u).forEach(([h,d])=>{d&&r.setAttribute(h,d)})}if(a){let u={stroke:s(a,"stroke"),"stroke-width":s(a,"stroke-width")??"1","stroke-opacity":s(a,"stroke-opacity")??"1"};Object.entries(u).forEach(([h,d])=>{d&&r.setAttribute(h,d)})}let l=document.createElementNS("http://www.w3.org/2000/svg","g");return l.appendChild(r),l}var At,A4,ft,Ct,Wt=z(()=>{"use strict";_s();Ut();br();Rr();Ir();Xt();cN();At=o(async(e,t,r)=>{let i,n=t.useHtmlLabels||Aa(ge()?.htmlLabels);r?i=r:i="node default";let a=e.insert("g").attr("class",i).attr("id",t.domId||t.id),s=a.insert("g").attr("class","label").attr("style",ii(t.labelStyle)),l;t.label===void 0?l="":l=typeof t.label=="string"?t.label:t.label[0];let u=!!t.icon||!!t.img,h=t.labelType==="markdown",d=await wi(s,fr(Qa(l),ge()),{useHtmlLabels:n,width:t.width||ge().flowchart?.wrappingWidth,classes:h?"markdown-node-label":"",style:t.labelStyle,addSvgBackground:u,markdown:h},ge()),f=d.getBBox(),p=(t?.padding??0)/2;if(n){let m=d.children[0],g=Je(d);await E4(m,l),f=m.getBoundingClientRect(),g.attr("width",f.width),g.attr("height",f.height)}return n?s.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):s.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&s.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),s.insert("rect",":first-child"),{shapeSvg:a,bbox:f,halfPadding:p,label:s}},"labelHelper"),A4=o(async(e,t,r)=>{let i=r.useHtmlLabels??Mr(ge()),n=e.insert("g").attr("class","label").attr("style",r.labelStyle||""),a=await wi(n,fr(Qa(t),ge()),{useHtmlLabels:i,width:r.width||ge()?.flowchart?.wrappingWidth,style:r.labelStyle,addSvgBackground:!!r.icon||!!r.img}),s=a.getBBox(),l=r.padding/2;if(Mr(ge())){let u=a.children[0],h=Je(a);s=u.getBoundingClientRect(),h.attr("width",s.width),h.attr("height",s.height)}return i?n.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"):n.attr("transform","translate(0, "+-s.height/2+")"),r.centerLabel&&n.attr("transform","translate("+-s.width/2+", "+-s.height/2+")"),n.insert("rect",":first-child"),{shapeSvg:e,bbox:s,halfPadding:l,label:n}},"insertLabel"),ft=o((e,t)=>{let r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds"),Ct=o((e,t)=>(e.look==="handDrawn"?"rough-node":"node")+" "+e.cssClasses+" "+(t||""),"getNodeClasses");o(tr,"createPathFromPoints");o(Bo,"generateFullSineWavePoints");o(Ep,"generateCirclePoints");o(uN,"mergePaths")});function sqe(e,t){return e.intersect(t)}var _re,Dre=z(()=>{"use strict";o(sqe,"intersectNode");_re=sqe});function oqe(e,t,r,i){var n=e.x,a=e.y,s=n-i.x,l=a-i.y,u=Math.sqrt(t*t*l*l+r*r*s*s),h=Math.abs(t*r*s/u);i.x{"use strict";o(oqe,"intersectEllipse");_4=oqe});function lqe(e,t,r){return _4(e,t,t,r)}var Rre,Lre=z(()=>{"use strict";hN();o(lqe,"intersectCircle");Rre=lqe});function cqe(e,t,r,i){{let n=t.y-e.y,a=e.x-t.x,s=t.x*e.y-e.x*t.y,l=n*r.x+a*r.y+s,u=n*i.x+a*i.y+s,h=1e-6;if(l!==0&&u!==0&&Mre(l,u))return;let d=i.y-r.y,f=r.x-i.x,p=i.x*r.y-r.x*i.y,m=d*e.x+f*e.y+p,g=d*t.x+f*t.y+p;if(Math.abs(m)0}var Nre,Ire=z(()=>{"use strict";o(cqe,"intersectLine");o(Mre,"sameSign");Nre=cqe});function uqe(e,t,r){let i=e.x,n=e.y,a=[],s=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(d){s=Math.min(s,d.x),l=Math.min(l,d.y)}):(s=Math.min(s,t.x),l=Math.min(l,t.y));let u=i-e.width/2-s,h=n-e.height/2-l;for(let d=0;d1&&a.sort(function(d,f){let p=d.x-r.x,m=d.y-r.y,g=Math.sqrt(p*p+m*m),y=f.x-r.x,v=f.y-r.y,x=Math.sqrt(y*y+v*v);return g{"use strict";Ire();o(uqe,"intersectPolygon");Ore=uqe});var hqe,cd,dN=z(()=>{"use strict";hqe=o((e,t)=>{var r=e.x,i=e.y,n=t.x-r,a=t.y-i,s=e.width/2,l=e.height/2,u,h;return Math.abs(a)*s>Math.abs(n)*l?(a<0&&(l=-l),u=a===0?0:l*n/a,h=l):(n<0&&(s=-s),u=s,h=n===0?0:s*a/n),{x:r+u,y:i+h}},"intersectRect"),cd=hqe});var lt,Kt=z(()=>{"use strict";Dre();Lre();hN();Pre();dN();lt={node:_re,circle:Rre,ellipse:_4,polygon:Ore,rect:cd}});var Bre,kc,dqe,Xx,ct,mt,fqe,Ht=z(()=>{"use strict";Ut();Bre=o(e=>{let{handDrawnSeed:t}=ge();return{fill:e,hachureAngle:120,hachureGap:4,fillWeight:2,roughness:.7,stroke:e,seed:t}},"solidStateFill"),kc=o(e=>{let t=dqe([...e.cssCompiledStyles||[],...e.cssStyles||[],...e.labelStyle||[]]);return{stylesMap:t,stylesArray:[...t]}},"compileStyles"),dqe=o(e=>{let t=new Map;return e.forEach(r=>{let[i,n]=r.split(":");t.set(i.trim(),n?.trim())}),t},"styles2Map"),Xx=o(e=>e==="color"||e==="font-size"||e==="font-family"||e==="font-weight"||e==="font-style"||e==="text-decoration"||e==="text-align"||e==="text-transform"||e==="line-height"||e==="letter-spacing"||e==="word-spacing"||e==="text-shadow"||e==="text-overflow"||e==="white-space"||e==="word-wrap"||e==="word-break"||e==="overflow-wrap"||e==="hyphens","isLabelStyle"),ct=o(e=>{let{stylesArray:t}=kc(e),r=[],i=[],n=[],a=[];return t.forEach(s=>{let l=s[0];Xx(l)?r.push(s.join(":")+" !important"):(i.push(s.join(":")+" !important"),l.includes("stroke")&&n.push(s.join(":")+" !important"),l==="fill"&&a.push(s.join(":")+" !important"))}),{labelStyles:r.join(";"),nodeStyles:i.join(";"),stylesArray:t,borderStyles:n,backgroundStyles:a}},"styles2String"),mt=o((e,t)=>{let{themeVariables:r,handDrawnSeed:i}=ge(),{nodeBorder:n,mainBkg:a}=r,{stylesMap:s}=kc(e);return Object.assign({roughness:.7,fill:s.get("fill")||a,fillStyle:"hachure",fillWeight:4,hachureGap:5.2,stroke:s.get("stroke")||n,seed:i,strokeWidth:s.get("stroke-width")?.replace("px","")||1.3,fillLineDash:[0,0],strokeLineDash:fqe(s.get("stroke-dasharray"))},t)},"userNodeOverrides"),fqe=o(e=>{if(!e)return[0,0];let t=e.trim().split(/\s+/).map(Number);if(t.length===1){let n=isNaN(t[0])?0:t[0];return[n,n]}let r=isNaN(t[0])?0:t[0],i=isNaN(t[1])?0:t[1];return[r,i]},"getStrokeDashArray")});function fN(e,t,r){if(e&&e.length){let[i,n]=t,a=Math.PI/180*r,s=Math.cos(a),l=Math.sin(a);for(let u of e){let[h,d]=u;u[0]=(h-i)*s-(d-n)*l+i,u[1]=(h-i)*l+(d-n)*s+n}}}function pqe(e,t){return e[0]===t[0]&&e[1]===t[1]}function mqe(e,t,r,i=1){let n=r,a=Math.max(t,.1),s=e[0]&&e[0][0]&&typeof e[0][0]=="number"?[e]:e,l=[0,0];if(n)for(let h of s)fN(h,l,n);let u=(function(h,d,f){let p=[];for(let b of h){let T=[...b];pqe(T[0],T[T.length-1])||T.push([T[0][0],T[0][1]]),T.length>2&&p.push(T)}let m=[];d=Math.max(d,.1);let g=[];for(let b of p)for(let T=0;Tb.yminT.ymin?1:b.xT.x?1:b.ymax===T.ymax?0:(b.ymax-T.ymax)/Math.abs(b.ymax-T.ymax))),!g.length)return m;let y=[],v=g[0].ymin,x=0;for(;y.length||g.length;){if(g.length){let b=-1;for(let T=0;Tv);T++)b=T;g.splice(0,b+1).forEach((T=>{y.push({s:v,edge:T})}))}if(y=y.filter((b=>!(b.edge.ymax<=v))),y.sort(((b,T)=>b.edge.x===T.edge.x?0:(b.edge.x-T.edge.x)/Math.abs(b.edge.x-T.edge.x))),(f!==1||x%d==0)&&y.length>1)for(let b=0;b=y.length)break;let w=y[b].edge,C=y[T].edge;m.push([[Math.round(w.x),v],[Math.round(C.x),v]])}v+=f,y.forEach((b=>{b.edge.x=b.edge.x+f*b.edge.islope})),x++}return m})(s,a,i);if(n){for(let h of s)fN(h,l,-n);(function(h,d,f){let p=[];h.forEach((m=>p.push(...m))),fN(p,d,f)})(u,l,-n)}return u}function Jx(e,t){var r;let i=t.hachureAngle+90,n=t.hachureGap;n<0&&(n=4*t.strokeWidth),n=Math.round(Math.max(n,.1));let a=1;return t.roughness>=1&&(((r=t.randomizer)===null||r===void 0?void 0:r.next())||Math.random())>.7&&(a=n),mqe(e,n,i,a||1)}function B4(e){let t=e[0],r=e[1];return Math.sqrt(Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2))}function mN(e,t){return e.type===t}function DN(e){let t=[],r=(function(s){let l=new Array;for(;s!=="";)if(s.match(/^([ \t\r\n,]+)/))s=s.substr(RegExp.$1.length);else if(s.match(/^([aAcChHlLmMqQsStTvVzZ])/))l[l.length]={type:gqe,text:RegExp.$1},s=s.substr(RegExp.$1.length);else{if(!s.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))return[];l[l.length]={type:pN,text:`${parseFloat(RegExp.$1)}`},s=s.substr(RegExp.$1.length)}return l[l.length]={type:Fre,text:""},l})(e),i="BOD",n=0,a=r[n];for(;!mN(a,Fre);){let s=0,l=[];if(i==="BOD"){if(a.text!=="M"&&a.text!=="m")return DN("M0,0"+e);n++,s=D4[a.text],i=a.text}else mN(a,pN)?s=D4[i]:(n++,s=D4[a.text],i=a.text);if(!(n+sd%2?h+r:h+t));a.push({key:"C",data:u}),t=u[4],r=u[5];break}case"Q":a.push({key:"Q",data:[...l]}),t=l[2],r=l[3];break;case"q":{let u=l.map(((h,d)=>d%2?h+r:h+t));a.push({key:"Q",data:u}),t=u[2],r=u[3];break}case"A":a.push({key:"A",data:[...l]}),t=l[5],r=l[6];break;case"a":t+=l[5],r+=l[6],a.push({key:"A",data:[l[0],l[1],l[2],l[3],l[4],t,r]});break;case"H":a.push({key:"H",data:[...l]}),t=l[0];break;case"h":t+=l[0],a.push({key:"H",data:[t]});break;case"V":a.push({key:"V",data:[...l]}),r=l[0];break;case"v":r+=l[0],a.push({key:"V",data:[r]});break;case"S":a.push({key:"S",data:[...l]}),t=l[2],r=l[3];break;case"s":{let u=l.map(((h,d)=>d%2?h+r:h+t));a.push({key:"S",data:u}),t=u[2],r=u[3];break}case"T":a.push({key:"T",data:[...l]}),t=l[0],r=l[1];break;case"t":t+=l[0],r+=l[1],a.push({key:"T",data:[t,r]});break;case"Z":case"z":a.push({key:"Z",data:[]}),t=i,r=n}return a}function Yre(e){let t=[],r="",i=0,n=0,a=0,s=0,l=0,u=0;for(let{key:h,data:d}of e){switch(h){case"M":t.push({key:"M",data:[...d]}),[i,n]=d,[a,s]=d;break;case"C":t.push({key:"C",data:[...d]}),i=d[4],n=d[5],l=d[2],u=d[3];break;case"L":t.push({key:"L",data:[...d]}),[i,n]=d;break;case"H":i=d[0],t.push({key:"L",data:[i,n]});break;case"V":n=d[0],t.push({key:"L",data:[i,n]});break;case"S":{let f=0,p=0;r==="C"||r==="S"?(f=i+(i-l),p=n+(n-u)):(f=i,p=n),t.push({key:"C",data:[f,p,...d]}),l=d[0],u=d[1],i=d[2],n=d[3];break}case"T":{let[f,p]=d,m=0,g=0;r==="Q"||r==="T"?(m=i+(i-l),g=n+(n-u)):(m=i,g=n);let y=i+2*(m-i)/3,v=n+2*(g-n)/3,x=f+2*(m-f)/3,b=p+2*(g-p)/3;t.push({key:"C",data:[y,v,x,b,f,p]}),l=m,u=g,i=f,n=p;break}case"Q":{let[f,p,m,g]=d,y=i+2*(f-i)/3,v=n+2*(p-n)/3,x=m+2*(f-m)/3,b=g+2*(p-g)/3;t.push({key:"C",data:[y,v,x,b,m,g]}),l=f,u=p,i=m,n=g;break}case"A":{let f=Math.abs(d[0]),p=Math.abs(d[1]),m=d[2],g=d[3],y=d[4],v=d[5],x=d[6];f===0||p===0?(t.push({key:"C",data:[i,n,v,x,v,x]}),i=v,n=x):(i!==v||n!==x)&&(jre(i,n,v,x,f,p,m,g,y).forEach((function(b){t.push({key:"C",data:b})})),i=v,n=x);break}case"Z":t.push({key:"Z",data:[]}),i=a,n=s}r=h}return t}function Kx(e,t,r){return[e*Math.cos(r)-t*Math.sin(r),e*Math.sin(r)+t*Math.cos(r)]}function jre(e,t,r,i,n,a,s,l,u,h){let d=(f=s,Math.PI*f/180);var f;let p=[],m=0,g=0,y=0,v=0;if(h)[m,g,y,v]=h;else{[e,t]=Kx(e,t,-d),[r,i]=Kx(r,i,-d);let _=(e-r)/2,R=(t-i)/2,M=_*_/(n*n)+R*R/(a*a);M>1&&(M=Math.sqrt(M),n*=M,a*=M);let L=n*n,B=a*a,O=L*B-L*R*R-B*_*_,$=L*R*R+B*_*_,G=(l===u?-1:1)*Math.sqrt(Math.abs(O/$));y=G*n*R/a+(e+r)/2,v=G*-a*_/n+(t+i)/2,m=Math.asin(parseFloat(((t-v)/a).toFixed(9))),g=Math.asin(parseFloat(((i-v)/a).toFixed(9))),eg&&(m-=2*Math.PI),!u&&g>m&&(g-=2*Math.PI)}let x=g-m;if(Math.abs(x)>120*Math.PI/180){let _=g,R=r,M=i;g=u&&g>m?m+120*Math.PI/180*1:m+120*Math.PI/180*-1,p=jre(r=y+n*Math.cos(g),i=v+a*Math.sin(g),R,M,n,a,s,0,u,[g,_,y,v])}x=g-m;let b=Math.cos(m),T=Math.sin(m),w=Math.cos(g),C=Math.sin(g),k=Math.tan(x/4),E=4/3*n*k,A=4/3*a*k,N=[e,t],P=[e+E*T,t-A*b],I=[r+E*C,i-A*w],D=[r,i];if(P[0]=2*N[0]-P[0],P[1]=2*N[1]-P[1],h)return[P,I,D].concat(p);{p=[P,I,D].concat(p);let _=[];for(let R=0;R2){let n=[];for(let a=0;a2*Math.PI&&(m=0,g=2*Math.PI);let y=2*Math.PI/u.curveStepCount,v=Math.min(y/2,(g-m)/2),x=qre(v,h,d,f,p,m,g,1,u);if(!u.disableMultiStroke){let b=qre(v,h,d,f,p,m,g,1.5,u);x.push(...b)}return s&&(l?x.push(...ud(h,d,h+f*Math.cos(m),d+p*Math.sin(m),u),...ud(h,d,h+f*Math.cos(g),d+p*Math.sin(g),u)):x.push({op:"lineTo",data:[h,d]},{op:"lineTo",data:[h+f*Math.cos(m),d+p*Math.sin(m)]})),{type:"path",ops:x}}function Gre(e,t){let r=Yre(Hre(DN(e))),i=[],n=[0,0],a=[0,0];for(let{key:s,data:l}of r)switch(s){case"M":a=[l[0],l[1]],n=[l[0],l[1]];break;case"L":i.push(...ud(a[0],a[1],l[0],l[1],t)),a=[l[0],l[1]];break;case"C":{let[u,h,d,f,p,m]=l;i.push(...xqe(u,h,d,f,p,m,a,t)),a=[p,m];break}case"Z":i.push(...ud(a[0],a[1],n[0],n[1],t)),a=[n[0],n[1]]}return{type:"path",ops:i}}function gN(e,t){let r=[];for(let i of e)if(i.length){let n=t.maxRandomnessOffset||0,a=i.length;if(a>2){r.push({op:"move",data:[i[0][0]+pr(n,t),i[0][1]+pr(n,t)]});for(let s=1;s500?.4:-.0016668*u+1.233334;let d=n.maxRandomnessOffset||0;d*d*100>l&&(d=u/10);let f=d/2,p=.2+.2*Zre(n),m=n.bowing*n.maxRandomnessOffset*(i-t)/200,g=n.bowing*n.maxRandomnessOffset*(e-r)/200;m=pr(m,n,h),g=pr(g,n,h);let y=[],v=o(()=>pr(f,n,h),"M"),x=o(()=>pr(d,n,h),"k"),b=n.preserveVertices;return a&&(s?y.push({op:"move",data:[e+(b?0:v()),t+(b?0:v())]}):y.push({op:"move",data:[e+(b?0:pr(d,n,h)),t+(b?0:pr(d,n,h))]})),s?y.push({op:"bcurveTo",data:[m+e+(r-e)*p+v(),g+t+(i-t)*p+v(),m+e+2*(r-e)*p+v(),g+t+2*(i-t)*p+v(),r+(b?0:v()),i+(b?0:v())]}):y.push({op:"bcurveTo",data:[m+e+(r-e)*p+x(),g+t+(i-t)*p+x(),m+e+2*(r-e)*p+x(),g+t+2*(i-t)*p+x(),r+(b?0:x()),i+(b?0:x())]}),y}function R4(e,t,r){if(!e.length)return[];let i=[];i.push([e[0][0]+pr(t,r),e[0][1]+pr(t,r)]),i.push([e[0][0]+pr(t,r),e[0][1]+pr(t,r)]);for(let n=1;n3){let a=[],s=1-r.curveTightness;n.push({op:"move",data:[e[1][0],e[1][1]]});for(let l=1;l+21&&n.push(l)):n.push(l),n.push(e[t+3])}else{let u=e[t+0],h=e[t+1],d=e[t+2],f=e[t+3],p=Ap(u,h,.5),m=Ap(h,d,.5),g=Ap(d,f,.5),y=Ap(p,m,.5),v=Ap(m,g,.5),x=Ap(y,v,.5);EN([u,p,y,x],0,r,n),EN([x,v,g,f],0,r,n)}var a,s;return n}function Tqe(e,t){return P4(e,0,e.length,t)}function P4(e,t,r,i,n){let a=n||[],s=e[t],l=e[r-1],u=0,h=1;for(let d=t+1;du&&(u=f,h=d)}return Math.sqrt(u)>i?(P4(e,t,h+1,i,a),P4(e,h,r,i,a)):(a.length||a.push(s),a.push(l)),a}function yN(e,t=.15,r){let i=[],n=(e.length-1)/3;for(let a=0;a0?P4(i,0,i.length,r):i}var Qx,vN,xN,bN,TN,CN,Ds,kN,gqe,pN,Fre,D4,yqe,so,Cg,AN,L4,_N,ut,jt=z(()=>{"use strict";o(fN,"t");o(pqe,"e");o(mqe,"s");o(Jx,"n");Qx=class{static{o(this,"o")}constructor(t){this.helper=t}fillPolygons(t,r){return this._fillPolygons(t,r)}_fillPolygons(t,r){let i=Jx(t,r);return{type:"fillSketch",ops:this.renderLines(i,r)}}renderLines(t,r){let i=[];for(let n of t)i.push(...this.helper.doubleLineOps(n[0][0],n[0][1],n[1][0],n[1][1],r));return i}};o(B4,"a");vN=class extends Qx{static{o(this,"h")}fillPolygons(t,r){let i=r.hachureGap;i<0&&(i=4*r.strokeWidth),i=Math.max(i,.1);let n=Jx(t,Object.assign({},r,{hachureGap:i})),a=Math.PI/180*r.hachureAngle,s=[],l=.5*i*Math.cos(a),u=.5*i*Math.sin(a);for(let[h,d]of n)B4([h,d])&&s.push([[h[0]-l,h[1]+u],[...d]],[[h[0]+l,h[1]-u],[...d]]);return{type:"fillSketch",ops:this.renderLines(s,r)}}},xN=class extends Qx{static{o(this,"r")}fillPolygons(t,r){let i=this._fillPolygons(t,r),n=Object.assign({},r,{hachureAngle:r.hachureAngle+90}),a=this._fillPolygons(t,n);return i.ops=i.ops.concat(a.ops),i}},bN=class{static{o(this,"i")}constructor(t){this.helper=t}fillPolygons(t,r){let i=Jx(t,r=Object.assign({},r,{hachureAngle:0}));return this.dotsOnLines(i,r)}dotsOnLines(t,r){let i=[],n=r.hachureGap;n<0&&(n=4*r.strokeWidth),n=Math.max(n,.1);let a=r.fillWeight;a<0&&(a=r.strokeWidth/2);let s=n/4;for(let l of t){let u=B4(l),h=u/n,d=Math.ceil(h)-1,f=u-d*n,p=(l[0][0]+l[1][0])/2-n/4,m=Math.min(l[0][1],l[1][1]);for(let g=0;g{let l=B4(s),u=Math.floor(l/(i+n)),h=(l+n-u*(i+n))/2,d=s[0],f=s[1];d[0]>f[0]&&(d=s[1],f=s[0]);let p=Math.atan((f[1]-d[1])/(f[0]-d[0]));for(let m=0;m{let s=B4(a),l=Math.round(s/(2*r)),u=a[0],h=a[1];u[0]>h[0]&&(u=a[1],h=a[0]);let d=Math.atan((h[1]-u[1])/(h[0]-u[0]));for(let f=0;f2*Math.PI&&(E=0,A=2*Math.PI);let N=(A-E)/b.curveStepCount,P=[];for(let I=E;I<=A;I+=N)P.push([T+C*Math.cos(I),w+k*Math.sin(I)]);return P.push([T+C*Math.cos(A),w+k*Math.sin(A)]),P.push([T,w]),Tg([P],b)})(t,r,i,n,a,s,h));return h.stroke!==so&&d.push(f),this._d("arc",d,h)}curve(t,r){let i=this._o(r),n=[],a=$re(t,i);if(i.fill&&i.fill!==so)if(i.fillStyle==="solid"){let s=$re(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(s.ops)})}else{let s=[],l=t;if(l.length){let u=typeof l[0][0]=="number"?[l]:l;for(let h of u)h.length<3?s.push(...h):h.length===3?s.push(...yN(Ure([h[0],h[0],h[1],h[2]]),10,(1+i.roughness)/2)):s.push(...yN(Ure(h),10,(1+i.roughness)/2))}s.length&&n.push(Tg([s],i))}return i.stroke!==so&&n.push(a),this._d("curve",n,i)}polygon(t,r){let i=this._o(r),n=[],a=M4(t,!0,i);return i.fill&&(i.fillStyle==="solid"?n.push(gN([t],i)):n.push(Tg([t],i))),i.stroke!==so&&n.push(a),this._d("polygon",n,i)}path(t,r){let i=this._o(r),n=[];if(!t)return this._d("path",n,i);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let a=i.fill&&i.fill!=="transparent"&&i.fill!==so,s=i.stroke!==so,l=!!(i.simplification&&i.simplification<1),u=(function(d,f,p){let m=Yre(Hre(DN(d))),g=[],y=[],v=[0,0],x=[],b=o(()=>{x.length>=4&&y.push(...yN(x,f)),x=[]},"i"),T=o(()=>{b(),y.length&&(g.push(y),y=[])},"c");for(let{key:C,data:k}of m)switch(C){case"M":T(),v=[k[0],k[1]],y.push(v);break;case"L":b(),y.push([k[0],k[1]]);break;case"C":if(!x.length){let E=y.length?y[y.length-1]:v;x.push([E[0],E[1]])}x.push([k[0],k[1]]),x.push([k[2],k[3]]),x.push([k[4],k[5]]);break;case"Z":b(),y.push([v[0],v[1]])}if(T(),!p)return g;let w=[];for(let C of g){let k=Tqe(C,p);k.length&&w.push(k)}return w})(t,1,l?4-4*(i.simplification||1):(1+i.roughness)/2),h=Gre(t,i);if(a)if(i.fillStyle==="solid")if(u.length===1){let d=Gre(t,Object.assign(Object.assign({},i),{disableMultiStroke:!0,roughness:i.roughness?i.roughness+i.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(d.ops)})}else n.push(gN(u,i));else n.push(Tg(u,i));return s&&(l?u.forEach((d=>{n.push(M4(d,!1,i))})):n.push(h)),this._d("path",n,i)}opsToPath(t,r){let i="";for(let n of t.ops){let a=typeof r=="number"&&r>=0?n.data.map((s=>+s.toFixed(r))):n.data;switch(n.op){case"move":i+=`M${a[0]} ${a[1]} `;break;case"bcurveTo":i+=`C${a[0]} ${a[1]}, ${a[2]} ${a[3]}, ${a[4]} ${a[5]} `;break;case"lineTo":i+=`L${a[0]} ${a[1]} `}}return i.trim()}toPaths(t){let r=t.sets||[],i=t.options||this.defaultOptions,n=[];for(let a of r){let s=null;switch(a.type){case"path":s={d:this.opsToPath(a),stroke:i.stroke,strokeWidth:i.strokeWidth,fill:so};break;case"fillPath":s={d:this.opsToPath(a),stroke:so,strokeWidth:0,fill:i.fill||so};break;case"fillSketch":s=this.fillSketch(a,i)}s&&n.push(s)}return n}fillSketch(t,r){let i=r.fillWeight;return i<0&&(i=r.strokeWidth/2),{d:this.opsToPath(t),stroke:r.fill||so,strokeWidth:i,fill:so}}_mergedShape(t){return t.filter(((r,i)=>i===0||r.op!=="move"))}},AN=class{static{o(this,"st")}constructor(t,r){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new Cg(r)}draw(t){let r=t.sets||[],i=t.options||this.getDefaultOptions(),n=this.ctx,a=t.options.fixedDecimalPlaceDigits;for(let s of r)switch(s.type){case"path":n.save(),n.strokeStyle=i.stroke==="none"?"transparent":i.stroke,n.lineWidth=i.strokeWidth,i.strokeLineDash&&n.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(n.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(n,s,a),n.restore();break;case"fillPath":{n.save(),n.fillStyle=i.fill||"";let l=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(n,s,a,l),n.restore();break}case"fillSketch":this.fillSketch(n,s,i)}}fillSketch(t,r,i){let n=i.fillWeight;n<0&&(n=i.strokeWidth/2),t.save(),i.fillLineDash&&t.setLineDash(i.fillLineDash),i.fillLineDashOffset&&(t.lineDashOffset=i.fillLineDashOffset),t.strokeStyle=i.fill||"",t.lineWidth=n,this._drawToContext(t,r,i.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,r,i,n="nonzero"){t.beginPath();for(let a of r.ops){let s=typeof i=="number"&&i>=0?a.data.map((l=>+l.toFixed(i))):a.data;switch(a.op){case"move":t.moveTo(s[0],s[1]);break;case"bcurveTo":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"lineTo":t.lineTo(s[0],s[1])}}r.type==="fillPath"?t.fill(n):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,r,i,n,a){let s=this.gen.line(t,r,i,n,a);return this.draw(s),s}rectangle(t,r,i,n,a){let s=this.gen.rectangle(t,r,i,n,a);return this.draw(s),s}ellipse(t,r,i,n,a){let s=this.gen.ellipse(t,r,i,n,a);return this.draw(s),s}circle(t,r,i,n){let a=this.gen.circle(t,r,i,n);return this.draw(a),a}linearPath(t,r){let i=this.gen.linearPath(t,r);return this.draw(i),i}polygon(t,r){let i=this.gen.polygon(t,r);return this.draw(i),i}arc(t,r,i,n,a,s,l=!1,u){let h=this.gen.arc(t,r,i,n,a,s,l,u);return this.draw(h),h}curve(t,r){let i=this.gen.curve(t,r);return this.draw(i),i}path(t,r){let i=this.gen.path(t,r);return this.draw(i),i}},L4="http://www.w3.org/2000/svg",_N=class{static{o(this,"ot")}constructor(t,r){this.svg=t,this.gen=new Cg(r)}draw(t){let r=t.sets||[],i=t.options||this.getDefaultOptions(),n=this.svg.ownerDocument||window.document,a=n.createElementNS(L4,"g"),s=t.options.fixedDecimalPlaceDigits;for(let l of r){let u=null;switch(l.type){case"path":u=n.createElementNS(L4,"path"),u.setAttribute("d",this.opsToPath(l,s)),u.setAttribute("stroke",i.stroke),u.setAttribute("stroke-width",i.strokeWidth+""),u.setAttribute("fill","none"),i.strokeLineDash&&u.setAttribute("stroke-dasharray",i.strokeLineDash.join(" ").trim()),i.strokeLineDashOffset&&u.setAttribute("stroke-dashoffset",`${i.strokeLineDashOffset}`);break;case"fillPath":u=n.createElementNS(L4,"path"),u.setAttribute("d",this.opsToPath(l,s)),u.setAttribute("stroke","none"),u.setAttribute("stroke-width","0"),u.setAttribute("fill",i.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||u.setAttribute("fill-rule","evenodd");break;case"fillSketch":u=this.fillSketch(n,l,i)}u&&a.appendChild(u)}return a}fillSketch(t,r,i){let n=i.fillWeight;n<0&&(n=i.strokeWidth/2);let a=t.createElementNS(L4,"path");return a.setAttribute("d",this.opsToPath(r,i.fixedDecimalPlaceDigits)),a.setAttribute("stroke",i.fill||""),a.setAttribute("stroke-width",n+""),a.setAttribute("fill","none"),i.fillLineDash&&a.setAttribute("stroke-dasharray",i.fillLineDash.join(" ").trim()),i.fillLineDashOffset&&a.setAttribute("stroke-dashoffset",`${i.fillLineDashOffset}`),a}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,r){return this.gen.opsToPath(t,r)}line(t,r,i,n,a){let s=this.gen.line(t,r,i,n,a);return this.draw(s)}rectangle(t,r,i,n,a){let s=this.gen.rectangle(t,r,i,n,a);return this.draw(s)}ellipse(t,r,i,n,a){let s=this.gen.ellipse(t,r,i,n,a);return this.draw(s)}circle(t,r,i,n){let a=this.gen.circle(t,r,i,n);return this.draw(a)}linearPath(t,r){let i=this.gen.linearPath(t,r);return this.draw(i)}polygon(t,r){let i=this.gen.polygon(t,r);return this.draw(i)}arc(t,r,i,n,a,s,l=!1,u){let h=this.gen.arc(t,r,i,n,a,s,l,u);return this.draw(h)}curve(t,r){let i=this.gen.curve(t,r);return this.draw(i)}path(t,r){let i=this.gen.path(t,r);return this.draw(i)}},ut={canvas:o((e,t)=>new AN(e,t),"canvas"),svg:o((e,t)=>new _N(e,t),"svg"),generator:o(e=>new Cg(e),"generator"),newSeed:o(()=>Cg.newSeed(),"newSeed")}});function Qre(e,t){let{labelStyles:r}=ct(t);t.labelStyle=r;let i=Ct(t),n=i;i||(n="anchor");let a=e.insert("g").attr("class",n).attr("id",t.domId||t.id),s=1,{cssStyles:l}=t,u=ut.svg(a),h=mt(t,{fill:"black",stroke:"none",fillStyle:"solid"});t.look!=="handDrawn"&&(h.roughness=0);let d=u.circle(0,0,s*2,h),f=a.insert(()=>d,":first-child");return f.attr("class","anchor").attr("style",ii(l)),ft(t,f),t.intersect=function(p){return Z.info("Circle intersect",t,s,p),lt.circle(t,s,p)},a}var Jre=z(()=>{"use strict";St();Wt();Kt();Ht();jt();Xt();o(Qre,"anchor")});function eie(e,t,r,i,n,a,s){let u=(e+r)/2,h=(t+i)/2,d=Math.atan2(i-t,r-e),f=(r-e)/2,p=(i-t)/2,m=f/n,g=p/a,y=Math.sqrt(m**2+g**2);if(y>1)throw new Error("The given radii are too small to create an arc between the points.");let v=Math.sqrt(1-y**2),x=u+v*a*Math.sin(d)*(s?-1:1),b=h-v*n*Math.cos(d)*(s?-1:1),T=Math.atan2((t-b)/a,(e-x)/n),C=Math.atan2((i-b)/a,(r-x)/n)-T;s&&C<0&&(C+=2*Math.PI),!s&&C>0&&(C-=2*Math.PI);let k=[];for(let E=0;E<20;E++){let A=E/19,N=T+A*C,P=x+n*Math.cos(N),I=b+a*Math.sin(N);k.push({x:P,y:I})}return k}function Cqe(e,t,r){let[i,n]=[t,r].sort((a,s)=>s-a);return n*(1-Math.sqrt(1-(e/i/2)**2))}async function tie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?12:n,l=o(N=>N+s,"calcTotalHeight"),u=o(N=>{let P=N/2;return[P/(2.5+N/50),P]},"calcEllipseRadius"),{shapeSvg:h,bbox:d}=await At(e,t,Ct(t)),f=l(t?.height?t?.height:d.height),[p,m]=u(f),g=Cqe(f,p,m),v=(t?.width?t?.width:d.width)+a*2+g-g,x=f,{cssStyles:b}=t,T=[{x:v/2,y:-x/2},{x:-v/2,y:-x/2},...eie(-v/2,-x/2,-v/2,x/2,p,m,!1),{x:v/2,y:x/2},...eie(v/2,x/2,v/2,-x/2,p,m,!0)],w=ut.svg(h),C=mt(t,{});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");let k=tr(T),E=w.path(k,C),A=h.insert(()=>E,":first-child");return A.attr("class","basic label-container outer-path"),b&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",b),i&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",i),A.attr("transform",`translate(${p/2}, 0)`),ft(t,A),t.intersect=function(N){return lt.polygon(t,T,N)},h}var rie=z(()=>{"use strict";Wt();Kt();Ht();jt();o(eie,"generateArcPoints");o(Cqe,"calculateArcSagitta");o(tie,"bowTieRect")});function Ma(e,t,r,i){return e.insert("polygon",":first-child").attr("points",i.map(function(n){return n.x+","+n.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}var Fu=z(()=>{"use strict";o(Ma,"insertPolygonShape")});async function iie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?28:n,s=t.look==="neo"?24:n,{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=(t?.width??u.width)+(t.look==="neo"?a*2:a+F4),d=(t?.height??u.height)+(t.look==="neo"?s*2:s),f=0,p=h,m=-d,g=0,y=[{x:f+F4,y:m},{x:p,y:m},{x:p,y:g},{x:f,y:g},{x:f,y:m+F4},{x:f+F4,y:m}],v,{cssStyles:x}=t;if(t.look==="handDrawn"){let b=ut.svg(l),T=mt(t,{}),w=tr(y),C=b.path(w,T);v=l.insert(()=>C,":first-child").attr("transform",`translate(${-h/2}, ${d/2})`),x&&v.attr("style",x)}else v=Ma(l,h,d,y);return i&&v.attr("style",i),ft(t,v),t.intersect=function(b){return lt.polygon(t,y,b)},l}var F4,nie=z(()=>{"use strict";Wt();Kt();Ht();jt();Fu();Wt();F4=12;o(iie,"card")});function aie(e,t){let{nodeStyles:r}=ct(t);t.label="";let i=e.insert("g").attr("class",Ct(t)).attr("id",t.domId??t.id),{cssStyles:n}=t,a=Math.max(28,t.width??0),s=[{x:0,y:a/2},{x:a/2,y:0},{x:0,y:-a/2},{x:-a/2,y:0}],l=ut.svg(i),u=mt(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let h=tr(s),d=l.path(h,u),f=i.insert(()=>d,":first-child");return n&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",n),r&&t.look!=="handDrawn"&&f.selectAll("path").attr("style",r),t.width=28,t.height=28,t.intersect=function(p){return lt.polygon(t,s,p)},i}var sie=z(()=>{"use strict";Kt();jt();Ht();Wt();o(aie,"choice")});async function $4(e,t,r){let{labelStyles:i,nodeStyles:n}=ct(t);t.labelStyle=i;let{shapeSvg:a,bbox:s,halfPadding:l}=await At(e,t,Ct(t)),u=16,h=r?.padding??l,d=t.look==="neo"?s.width/2+u*2:s.width/2+h,f,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=ut.svg(a),g=mt(t,{}),y=m.circle(0,0,d*2,g);f=a.insert(()=>y,":first-child"),f.attr("class","basic label-container").attr("style",ii(p))}else f=a.insert("circle",":first-child").attr("class","basic label-container").attr("style",n).attr("r",d).attr("cx",0).attr("cy",0);return ft(t,f),t.calcIntersect=function(m,g){let y=m.width/2;return lt.circle(m,y,g)},t.intersect=function(m){return Z.info("Circle intersect",t,d,m),lt.circle(t,d,m)},a}var RN=z(()=>{"use strict";jt();St();Xt();Kt();Ht();Wt();o($4,"circle")});function kqe(e){let t=Math.cos(Math.PI/4),r=Math.sin(Math.PI/4),i=e*2,n={x:i/2*t,y:i/2*r},a={x:-(i/2)*t,y:i/2*r},s={x:-(i/2)*t,y:-(i/2)*r},l={x:i/2*t,y:-(i/2)*r};return`M ${a.x},${a.y} L ${l.x},${l.y} + M ${n.x},${n.y} L ${s.x},${s.y}`}function oie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r,t.label="";let n=e.insert("g").attr("class",Ct(t)).attr("id",t.domId??t.id),a=Math.max(30,t?.width??0),{cssStyles:s}=t,l=ut.svg(n),u=mt(t,{});t.look!=="handDrawn"&&(u.roughness=0,u.fillStyle="solid");let h=l.circle(0,0,a*2,u),d=kqe(a),f=l.path(d,u),p=n.insert(()=>h,":first-child");return p.insert(()=>f),p.attr("class","outer-path"),s&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",s),i&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",i),ft(t,p),t.intersect=function(m){return Z.info("crossedCircle intersect",t,{radius:a,point:m}),lt.circle(t,a,m)},n}var lie=z(()=>{"use strict";St();Wt();Ht();jt();Kt();o(kqe,"createLine");o(oie,"crossedCircle")});function hd(e,t,r,i=100,n=0,a=180){let s=[],l=n*Math.PI/180,d=(a*Math.PI/180-l)/(i-1);for(let f=0;fC,":first-child").attr("stroke-opacity",0),k.insert(()=>T,":first-child"),k.attr("class","text"),p&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",i),k.attr("transform",`translate(${f}, 0)`),s.attr("transform",`translate(${-h/2+f-(a.x-(a.left??0))},${-d/2+(t.padding??0)/2-(a.y-(a.top??0))})`),ft(t,k),t.intersect=function(E){return lt.polygon(t,g,E)},n}var uie=z(()=>{"use strict";Wt();Kt();Ht();jt();o(hd,"generateCirclePoints");o(cie,"curlyBraceLeft")});function dd(e,t,r,i=100,n=0,a=180){let s=[],l=n*Math.PI/180,d=(a*Math.PI/180-l)/(i-1);for(let f=0;fC,":first-child").attr("stroke-opacity",0),k.insert(()=>T,":first-child"),k.attr("class","text"),p&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&k.selectAll("path").attr("style",i),k.attr("transform",`translate(${-f}, 0)`),s.attr("transform",`translate(${-h/2+(t.padding??0)/2-(a.x-(a.left??0))},${-d/2+(t.padding??0)/2-(a.y-(a.top??0))})`),ft(t,k),t.intersect=function(E){return lt.polygon(t,g,E)},n}var die=z(()=>{"use strict";Wt();Kt();Ht();jt();o(dd,"generateCirclePoints");o(hie,"curlyBraceRight")});function Na(e,t,r,i=100,n=0,a=180){let s=[],l=n*Math.PI/180,d=(a*Math.PI/180-l)/(i-1);for(let f=0;fN,":first-child").attr("stroke-opacity",0),P.insert(()=>w,":first-child"),P.insert(()=>E,":first-child"),P.attr("class","text"),p&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",p),i&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",i),P.attr("transform",`translate(${f-f/4}, 0)`),s.attr("transform",`translate(${-h/2+(t.padding??0)/2-(a.x-(a.left??0))},${-d/2+(t.padding??0)/2-(a.y-(a.top??0))})`),ft(t,P),t.intersect=function(I){return lt.polygon(t,y,I)},n}var pie=z(()=>{"use strict";Wt();Kt();Ht();jt();o(Na,"generateCirclePoints");o(fie,"curlyBraces")});async function mie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?12:n,l=20,u=5,{shapeSvg:h,bbox:d}=await At(e,t,Ct(t)),f=Math.max(l,(d.width+a*2)*1.25,t?.width??0),p=Math.max(u,d.height+s*2,t?.height??0),m=p/2,{cssStyles:g}=t,y=ut.svg(h),v=mt(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let x=f,b=p,T=x-m,w=b/4,C=[{x:T,y:0},{x:w,y:0},{x:0,y:b/2},{x:w,y:b},{x:T,y:b},...Ep(-T,-b/2,m,50,270,90)],k=tr(C),E=y.path(k,v),A=h.insert(()=>E,":first-child");return A.attr("class","basic label-container outer-path"),g&&t.look!=="handDrawn"&&A.selectChildren("path").attr("style",g),i&&t.look!=="handDrawn"&&A.selectChildren("path").attr("style",i),A.attr("transform",`translate(${-f/2}, ${-p/2})`),ft(t,A),t.intersect=function(N){return lt.polygon(t,C,N)},h}var gie=z(()=>{"use strict";Wt();Kt();Ht();jt();o(mie,"curvedTrapezoid")});async function xie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?24:n,s=t.look==="neo"?24:n;if(t.width||t.height){let v=t.width??0;t.width=(t.width??0)-s,t.widthC,":first-child"),g=l.insert(()=>w,":first-child"),g.attr("class","basic label-container"),y&&g.attr("style",y)}else{let v=wqe(0,0,d,m,f,p);g=l.insert("path",":first-child").attr("d",v).attr("class","basic label-container outer-path").attr("style",ii(y)).attr("style",i)}return g.attr("label-offset-y",p),g.attr("transform",`translate(${-d/2}, ${-(m/2+p)})`),ft(t,g),h.attr("transform",`translate(${-(u.width/2)-(u.x-(u.left??0))}, ${-(u.height/2)+(t.padding??0)/1.5-(u.y-(u.top??0))})`),t.intersect=function(v){let x=lt.rect(t,v),b=x.x-(t.x??0);if(f!=0&&(Math.abs(b)<(t.width??0)/2||Math.abs(b)==(t.width??0)/2&&Math.abs(x.y-(t.y??0))>(t.height??0)/2-p)){let T=p*p*(1-b*b/(f*f));T>0&&(T=Math.sqrt(T)),T=p-T,v.y-(t.y??0)>0&&(T=-T),x.y+=T}return x},l}var wqe,Sqe,Eqe,yie,vie,bie=z(()=>{"use strict";Wt();Kt();Ht();jt();Xt();wqe=o((e,t,r,i,n,a)=>[`M${e},${t+a}`,`a${n},${a} 0,0,0 ${r},0`,`a${n},${a} 0,0,0 ${-r},0`,`l0,${i}`,`a${n},${a} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createCylinderPathD"),Sqe=o((e,t,r,i,n,a)=>[`M${e},${t+a}`,`M${e+r},${t+a}`,`a${n},${a} 0,0,0 ${-r},0`,`l0,${i}`,`a${n},${a} 0,0,0 ${r},0`,`l0,${-i}`].join(" "),"createOuterCylinderPathD"),Eqe=o((e,t,r,i,n,a)=>[`M${e-r/2},${-i/2}`,`a${n},${a} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),yie=8,vie=8;o(xie,"cylinder")});var Rs,_p=z(()=>{"use strict";Rs=o((e,t,r,i,n)=>["M",e+n,t,"H",e+r-n,"A",n,n,0,0,1,e+r,t+n,"V",t+i-n,"A",n,n,0,0,1,e+r-n,t+i,"H",e+n,"A",n,n,0,0,1,e,t+i-n,"V",t+n,"A",n,n,0,0,1,e+n,t,"Z"].join(" "),"createRoundedRectPathD")});async function Ml(e,t,r){let{labelStyles:i,nodeStyles:n}=ct(t);t.labelStyle=i;let{shapeSvg:a,bbox:s}=await At(e,t,Ct(t)),l=Math.max(s.width+r.labelPaddingX*2,t?.width||0),u=Math.max(s.height+r.labelPaddingY*2,t?.height||0),h=-l/2,d=-u/2,f,{rx:p,ry:m}=t,{cssStyles:g}=t;if(r?.rx&&r.ry&&(p=r.rx,m=r.ry),t.look==="handDrawn"){let y=ut.svg(a),v=mt(t,{}),x=p||m?y.path(Rs(h,d,l,u,p||0),v):y.rectangle(h,d,l,u,v);f=a.insert(()=>x,":first-child"),f.attr("class","basic label-container").attr("style",ii(g))}else f=a.insert("rect",":first-child"),f.attr("class","basic label-container").attr("style",n).attr("rx",ii(p)).attr("ry",ii(m)).attr("x",h).attr("y",d).attr("width",l).attr("height",u);return ft(t,f),t.calcIntersect=function(y,v){return lt.rect(y,v)},t.intersect=function(y){return lt.rect(t,y)},a}var Dp=z(()=>{"use strict";Wt();Kt();_p();Ht();jt();Xt();o(Ml,"drawRect")});async function Tie(e,t){let{cssClasses:r,labelPaddingX:i,labelPaddingY:n,padding:a,width:s,height:l}=t,u={rx:0,ry:0,classes:r??"",labelPaddingX:i??(a??0)*2,labelPaddingY:n??a??0},h=await Ml(e,t,u);if(t.look==="handDrawn"){let m=ut.svg(h),g=mt(t,{}),y=h.select(".basic.label-container > path:nth-child(2)"),v=y.node();if(!v)return h;let x=null;if(v instanceof SVGGraphicsElement)x=v.getBBox();else return h;return h.insert(()=>m.line(x.x,x.y,x.x+x.width,x.y,g),".basic.label-container g.label"),h.insert(()=>m.line(x.x,x.y+x.height,x.x+x.width,x.y+x.height,g),".basic.label-container g.label"),y.remove(),h}let d=h.select(".basic.label-container"),f=(Number(d.attr("width"))||s)??0,p=(Number(d.attr("height"))||l)??0;return f>0&&p>0&&d.attr("stroke-dasharray",`${f} ${p}`),h}var Cie=z(()=>{"use strict";Dp();Ht();jt();o(Tie,"datastore")});async function kie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.look==="neo"?16:t.padding??0,a=t.look==="neo"?16:t.padding??0,{shapeSvg:s,bbox:l,label:u}=await At(e,t,Ct(t)),h=l.width+n,d=l.height+a,f=d*.2,p=-h/2,m=-d/2-f/2,{cssStyles:g}=t,y=ut.svg(s),v=mt(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let x=[{x:p,y:m+f},{x:-p,y:m+f},{x:-p,y:-m},{x:p,y:-m},{x:p,y:m},{x:-p,y:m},{x:-p,y:m+f}],b=y.polygon(x.map(w=>[w.x,w.y]),v),T=s.insert(()=>b,":first-child");return T.attr("class","basic label-container outer-path"),g&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",g),i&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",i),u.attr("transform",`translate(${p+(t.padding??0)/2-(l.x-(l.left??0))}, ${m+f+(t.padding??0)/2-(l.y-(l.top??0))})`),ft(t,T),t.intersect=function(w){return lt.rect(t,w)},s}var wie=z(()=>{"use strict";Wt();Kt();Ht();jt();o(kie,"dividedRectangle")});async function Sie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t),n=t.look==="neo"?12:5;t.labelStyle=r;let a=t.padding??0,s=t.look==="neo"?16:a,{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=(t?.width?t?.width/2:u.width/2)+(s??0),d=h-n,f,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=ut.svg(l),g=mt(t,{roughness:.2,strokeWidth:2.5}),y=mt(t,{roughness:.2,strokeWidth:1.5}),v=m.circle(0,0,h*2,g),x=m.circle(0,0,d*2,y);f=l.insert("g",":first-child"),f.attr("class",ii(t.cssClasses)).attr("style",ii(p)),f.node()?.appendChild(v),f.node()?.appendChild(x)}else{f=l.insert("g",":first-child");let m=f.insert("circle",":first-child"),g=f.insert("circle");f.attr("class","basic label-container").attr("style",i),m.attr("class","outer-circle").attr("style",i).attr("r",h).attr("cx",0).attr("cy",0),g.attr("class","inner-circle").attr("style",i).attr("r",d).attr("cx",0).attr("cy",0)}return ft(t,f),t.intersect=function(m){return Z.info("DoubleCircle intersect",t,h,m),lt.circle(t,h,m)},l}var Eie=z(()=>{"use strict";St();Wt();Kt();Ht();jt();Xt();o(Sie,"doublecircle")});function Aie(e,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:n}=ct(t);t.label="",t.labelStyle=i;let a=e.insert("g").attr("class",Ct(t)).attr("id",t.domId??t.id),s=7,{cssStyles:l}=t,u=ut.svg(a),{nodeBorder:h}=r,d=mt(t,{fillStyle:"solid"});t.look!=="handDrawn"&&(d.roughness=0);let f=u.circle(0,0,s*2,d),p=a.insert(()=>f,":first-child");return p.selectAll("path").attr("style",`fill: ${h} !important;`),l&&l.length>0&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",l),n&&t.look!=="handDrawn"&&p.selectAll("path").attr("style",n),ft(t,p),t.intersect=function(m){return Z.info("filledCircle intersect",t,{radius:s,point:m}),lt.circle(t,s,m)},a}var _ie=z(()=>{"use strict";jt();St();Kt();Ht();Wt();o(Aie,"filledCircle")});async function Lie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?n*2:n;(t.width||t.height)&&(t.height=t?.height??0,t.heightx,":first-child").attr("transform",`translate(${-d/2}, ${d/2})`).attr("class","outer-path");return m&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",m),i&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",i),t.width=h,t.height=d,ft(t,b),u.attr("transform",`translate(${-l.width/2-(l.x-(l.left??0))}, ${-d/2+(t.padding??0)/2+(l.y-(l.top??0))})`),t.intersect=function(T){return Z.info("Triangle intersect",t,p,T),lt.polygon(t,p,T)},s}var Die,Rie,Mie=z(()=>{"use strict";St();Wt();Kt();Ht();jt();Wt();Die=10,Rie=10;o(Lie,"flippedTriangle")});function Nie(e,t,{dir:r,config:{state:i,themeVariables:n}}){let{nodeStyles:a}=ct(t);t.label="";let s=e.insert("g").attr("class",Ct(t)).attr("id",t.domId??t.id),{cssStyles:l}=t,u=Math.max(70,t?.width??0),h=Math.max(10,t?.height??0);r==="LR"&&(u=Math.max(10,t?.width??0),h=Math.max(70,t?.height??0));let d=-1*u/2,f=-1*h/2,p=ut.svg(s),m=mt(t,{stroke:n.lineColor,fill:n.lineColor});t.look!=="handDrawn"&&(m.roughness=0,m.fillStyle="solid");let g=p.rectangle(d,f,u,h,m),y=s.insert(()=>g,":first-child");l&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",l),a&&t.look!=="handDrawn"&&y.selectAll("path").attr("style",a),ft(t,y);let v=i?.padding??0;return t.width&&t.height&&(t.width+=v/2||0,t.height+=v/2||0),t.intersect=function(x){return lt.rect(t,x)},s}var Iie=z(()=>{"use strict";jt();Kt();Ht();Wt();o(Nie,"forkJoin")});async function Oie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=15,a=10,s=t.look==="neo"?16:t.padding??0,l=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.height=(t?.height??0)-l*2,t.heightb,":first-child");return T.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&T.selectChildren("path").attr("style",m),i&&t.look!=="handDrawn"&&T.selectChildren("path").attr("style",i),ft(t,T),t.intersect=function(w){return Z.info("Pill intersect",t,{radius:p,point:w}),lt.polygon(t,v,w)},u}var Pie=z(()=>{"use strict";St();Wt();Kt();Ht();jt();o(Oie,"halfRoundedRectangle")});async function Bie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t),n=t.look==="neo"?3.5:4;t.labelStyle=r;let a=t.padding??0,s=70,l=32,u=t.look==="neo"?s:a,h=t.look==="neo"?l:a;if(t.width||t.height){let T=(t.height??0)/n;t.width=(t?.width??0)-2*T-h,t.height=(t.height??0)-u}let{shapeSvg:d,bbox:f}=await At(e,t,Ct(t)),p=(t?.height?t?.height:f.height)+u,m=p/n,g=(t?.width?t?.width:f.width)+2*m+h,y=[{x:m,y:0},{x:g-m,y:0},{x:g,y:-p/2},{x:g-m,y:-p},{x:m,y:-p},{x:0,y:-p/2}],v,{cssStyles:x}=t;if(t.look==="handDrawn"){let b=ut.svg(d),T=mt(t,{}),w=Aqe(0,0,g,p,m),C=b.path(w,T);v=d.insert(()=>C,":first-child").attr("transform",`translate(${-g/2}, ${p/2})`),x&&v.attr("style",x)}else v=Ma(d,g,p,y);return i&&v.attr("style",i),t.width=g,t.height=p,ft(t,v),t.intersect=function(b){return lt.polygon(t,y,b)},d}var Aqe,Fie=z(()=>{"use strict";Wt();Kt();Ht();jt();Fu();Aqe=o((e,t,r,i,n)=>[`M${e+n},${t}`,`L${e+r-n},${t}`,`L${e+r},${t-i/2}`,`L${e+r-n},${t-i}`,`L${e+n},${t-i}`,`L${e},${t-i/2}`,"Z"].join(" "),"createHexagonPathD");o(Bie,"hexagon")});async function $ie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.label="",t.labelStyle=r;let{shapeSvg:n}=await At(e,t,Ct(t)),a=Math.max(30,t?.width??0),s=Math.max(30,t?.height??0),{cssStyles:l}=t,u=ut.svg(n),h=mt(t,{});t.look!=="handDrawn"&&(h.roughness=0,h.fillStyle="solid");let d=[{x:0,y:0},{x:a,y:0},{x:0,y:s},{x:a,y:s}],f=tr(d),p=u.path(f,h),m=n.insert(()=>p,":first-child");return m.attr("class","basic label-container outer-path"),l&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",l),i&&t.look!=="handDrawn"&&m.selectChildren("path").attr("style",i),m.attr("transform",`translate(${-a/2}, ${-s/2})`),ft(t,m),t.intersect=function(g){return Z.info("Pill intersect",t,{points:d}),lt.polygon(t,d,g)},n}var zie=z(()=>{"use strict";St();Wt();Kt();Ht();jt();o($ie,"hourglass")});async function Gie(e,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:n}=ct(t);t.labelStyle=n;let a=t.assetHeight??48,s=t.assetWidth??48,l=Math.max(a,s),u=i?.wrappingWidth;t.width=Math.max(l,u??0);let{shapeSvg:h,bbox:d,label:f}=await At(e,t,"icon-shape default"),p=t.pos==="t",m=l,g=l,{nodeBorder:y}=r,{stylesMap:v}=kc(t),x=-g/2,b=-m/2,T=t.label?8:0,w=ut.svg(h),C=mt(t,{stroke:"none",fill:"none"});t.look!=="handDrawn"&&(C.roughness=0,C.fillStyle="solid");let k=w.rectangle(x,b,g,m,C),E=Math.max(g,d.width),A=m+d.height+T,N=w.rectangle(-E/2,-A/2,E,A,{...C,fill:"transparent",stroke:"none"}),P=h.insert(()=>k,":first-child"),I=h.insert(()=>N);if(t.icon){let D=h.append("g");D.html(`${await ks(t.icon,{height:l,width:l,fallbackPrefix:""})}`);let _=D.node().getBBox(),R=_.width,M=_.height,L=_.x,B=_.y;D.attr("transform",`translate(${-R/2-L},${p?d.height/2+T/2-M/2-B:-d.height/2-T/2-M/2-B})`),D.attr("style",`color: ${v.get("stroke")??y};`)}return f.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${p?-A/2:A/2-d.height})`),P.attr("transform",`translate(0,${p?d.height/2+T/2:-d.height/2-T/2})`),ft(t,I),t.intersect=function(D){if(Z.info("iconSquare intersect",t,D),!t.label)return lt.rect(t,D);let _=t.x??0,R=t.y??0,M=t.height??0,L=[];return p?L=[{x:_-d.width/2,y:R-M/2},{x:_+d.width/2,y:R-M/2},{x:_+d.width/2,y:R-M/2+d.height+T},{x:_+g/2,y:R-M/2+d.height+T},{x:_+g/2,y:R+M/2},{x:_-g/2,y:R+M/2},{x:_-g/2,y:R-M/2+d.height+T},{x:_-d.width/2,y:R-M/2+d.height+T}]:L=[{x:_-g/2,y:R-M/2},{x:_+g/2,y:R-M/2},{x:_+g/2,y:R-M/2+m},{x:_+d.width/2,y:R-M/2+m},{x:_+d.width/2/2,y:R+M/2},{x:_-d.width/2,y:R+M/2},{x:_-d.width/2,y:R-M/2+m},{x:_-g/2,y:R-M/2+m}],lt.polygon(t,L,D)},h}var Vie=z(()=>{"use strict";jt();St();uc();Kt();Ht();Wt();o(Gie,"icon")});async function Wie(e,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:n}=ct(t);t.labelStyle=n;let a=t.assetHeight??48,s=t.assetWidth??48,l=Math.max(a,s),u=i?.wrappingWidth;t.width=Math.max(l,u??0);let{shapeSvg:h,bbox:d,label:f}=await At(e,t,"icon-shape default"),p=20,m=t.label?8:0,g=t.pos==="t",{nodeBorder:y,mainBkg:v}=r,{stylesMap:x}=kc(t),b=ut.svg(h),T=mt(t,{});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");let w=x.get("fill");T.stroke=w??v;let C=h.append("g");t.icon&&C.html(`${await ks(t.icon,{height:l,width:l,fallbackPrefix:""})}`);let k=C.node().getBBox(),E=k.width,A=k.height,N=k.x,P=k.y,I=Math.max(E,A)*Math.SQRT2+p*2,D=b.circle(0,0,I,T),_=Math.max(I,d.width),R=I+d.height+m,M=b.rectangle(-_/2,-R/2,_,R,{...T,fill:"transparent",stroke:"none"}),L=h.insert(()=>D,":first-child"),B=h.insert(()=>M);return C.attr("transform",`translate(${-E/2-N},${g?d.height/2+m/2-A/2-P:-d.height/2-m/2-A/2-P})`),C.attr("style",`color: ${x.get("stroke")??y};`),f.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${g?-R/2:R/2-d.height})`),L.attr("transform",`translate(0,${g?d.height/2+m/2:-d.height/2-m/2})`),ft(t,B),t.intersect=function(O){return Z.info("iconSquare intersect",t,O),lt.rect(t,O)},h}var qie=z(()=>{"use strict";jt();St();uc();Kt();Ht();Wt();o(Wie,"iconCircle")});async function Uie(e,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:n}=ct(t);t.labelStyle=n;let a=t.assetHeight??48,s=t.assetWidth??48,l=Math.max(a,s),u=i?.wrappingWidth;t.width=Math.max(l,u??0);let{shapeSvg:h,bbox:d,halfPadding:f,label:p}=await At(e,t,"icon-shape default"),m=t.pos==="t",g=l+f*2,y=l+f*2,{nodeBorder:v,mainBkg:x}=r,{stylesMap:b}=kc(t),T=-y/2,w=-g/2,C=t.label?8:0,k=ut.svg(h),E=mt(t,{});t.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");let A=b.get("fill");E.stroke=A??x;let N=k.path(Rs(T,w,y,g,5),E),P=Math.max(y,d.width),I=g+d.height+C,D=k.rectangle(-P/2,-I/2,P,I,{...E,fill:"transparent",stroke:"none"}),_=h.insert(()=>N,":first-child").attr("class","icon-shape2"),R=h.insert(()=>D);if(t.icon){let M=h.append("g");M.html(`${await ks(t.icon,{height:l,width:l,fallbackPrefix:""})}`);let L=M.node().getBBox(),B=L.width,O=L.height,$=L.x,G=L.y;M.attr("transform",`translate(${-B/2-$},${m?d.height/2+C/2-O/2-G:-d.height/2-C/2-O/2-G})`),M.attr("style",`color: ${b.get("stroke")??v};`)}return p.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${m?-I/2:I/2-d.height})`),_.attr("transform",`translate(0,${m?d.height/2+C/2:-d.height/2-C/2})`),ft(t,R),t.intersect=function(M){if(Z.info("iconSquare intersect",t,M),!t.label)return lt.rect(t,M);let L=t.x??0,B=t.y??0,O=t.height??0,$=[];return m?$=[{x:L-d.width/2,y:B-O/2},{x:L+d.width/2,y:B-O/2},{x:L+d.width/2,y:B-O/2+d.height+C},{x:L+y/2,y:B-O/2+d.height+C},{x:L+y/2,y:B+O/2},{x:L-y/2,y:B+O/2},{x:L-y/2,y:B-O/2+d.height+C},{x:L-d.width/2,y:B-O/2+d.height+C}]:$=[{x:L-y/2,y:B-O/2},{x:L+y/2,y:B-O/2},{x:L+y/2,y:B-O/2+g},{x:L+d.width/2,y:B-O/2+g},{x:L+d.width/2/2,y:B+O/2},{x:L-d.width/2,y:B+O/2},{x:L-d.width/2,y:B-O/2+g},{x:L-y/2,y:B-O/2+g}],lt.polygon(t,$,M)},h}var Hie=z(()=>{"use strict";jt();St();uc();Kt();Ht();_p();Wt();o(Uie,"iconRounded")});async function Yie(e,t,{config:{themeVariables:r,flowchart:i}}){let{labelStyles:n}=ct(t);t.labelStyle=n;let a=t.assetHeight??48,s=t.assetWidth??48,l=Math.max(a,s),u=i?.wrappingWidth;t.width=Math.max(l,u??0);let{shapeSvg:h,bbox:d,halfPadding:f,label:p}=await At(e,t,"icon-shape default"),m=t.pos==="t",g=l+f*2,y=l+f*2,{nodeBorder:v,mainBkg:x}=r,{stylesMap:b}=kc(t),T=-y/2,w=-g/2,C=t.label?8:0,k=ut.svg(h),E=mt(t,{});t.look!=="handDrawn"&&(E.roughness=0,E.fillStyle="solid");let A=b.get("fill");E.stroke=A??x;let N=k.path(Rs(T,w,y,g,.1),E),P=Math.max(y,d.width),I=g+d.height+C,D=k.rectangle(-P/2,-I/2,P,I,{...E,fill:"transparent",stroke:"none"}),_=h.insert(()=>N,":first-child"),R=h.insert(()=>D);if(t.icon){let M=h.append("g");M.html(`${await ks(t.icon,{height:l,width:l,fallbackPrefix:""})}`);let L=M.node().getBBox(),B=L.width,O=L.height,$=L.x,G=L.y;M.attr("transform",`translate(${-B/2-$},${m?d.height/2+C/2-O/2-G:-d.height/2-C/2-O/2-G})`),M.attr("style",`color: ${b.get("stroke")??v};`)}return p.attr("transform",`translate(${-d.width/2-(d.x-(d.left??0))},${m?-I/2:I/2-d.height})`),_.attr("transform",`translate(0,${m?d.height/2+C/2:-d.height/2-C/2})`),ft(t,R),t.intersect=function(M){if(Z.info("iconSquare intersect",t,M),!t.label)return lt.rect(t,M);let L=t.x??0,B=t.y??0,O=t.height??0,$=[];return m?$=[{x:L-d.width/2,y:B-O/2},{x:L+d.width/2,y:B-O/2},{x:L+d.width/2,y:B-O/2+d.height+C},{x:L+y/2,y:B-O/2+d.height+C},{x:L+y/2,y:B+O/2},{x:L-y/2,y:B+O/2},{x:L-y/2,y:B-O/2+d.height+C},{x:L-d.width/2,y:B-O/2+d.height+C}]:$=[{x:L-y/2,y:B-O/2},{x:L+y/2,y:B-O/2},{x:L+y/2,y:B-O/2+g},{x:L+d.width/2,y:B-O/2+g},{x:L+d.width/2/2,y:B+O/2},{x:L-d.width/2,y:B+O/2},{x:L-d.width/2,y:B-O/2+g},{x:L-y/2,y:B-O/2+g}],lt.polygon(t,$,M)},h}var jie=z(()=>{"use strict";jt();St();uc();Kt();_p();Ht();Wt();o(Yie,"iconSquare")});async function Xie(e,t,{config:{flowchart:r}}){let i=new Image;i.src=t?.img??"",await i.decode();let n=Number(i.naturalWidth.toString().replace("px","")),a=Number(i.naturalHeight.toString().replace("px",""));t.imageAspectRatio=n/a;let{labelStyles:s}=ct(t);t.labelStyle=s;let l=r?.wrappingWidth;t.defaultWidth=r?.wrappingWidth;let u=Math.max(t.label?l??0:0,t?.assetWidth??n),h=t.constraint==="on"&&t?.assetHeight?t.assetHeight*t.imageAspectRatio:u,d=t.constraint==="on"?h/t.imageAspectRatio:t?.assetHeight??a;t.width=Math.max(h,l??0);let{shapeSvg:f,bbox:p,label:m}=await At(e,t,"image-shape default"),g=t.pos==="t",y=-h/2,v=-d/2,x=t.label?8:0,b=ut.svg(f),T=mt(t,{});t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");let w=b.rectangle(y,v,h,d,T),C=Math.max(h,p.width),k=d+p.height+x,E=b.rectangle(-C/2,-k/2,C,k,{...T,fill:"none",stroke:"none"}),A=f.insert(()=>w,":first-child"),N=f.insert(()=>E);if(t.img){let P=f.append("image");P.attr("href",t.img),P.attr("width",h),P.attr("height",d),P.attr("preserveAspectRatio","none"),P.attr("transform",`translate(${-h/2},${g?k/2-d:-k/2})`)}return m.attr("transform",`translate(${-p.width/2-(p.x-(p.left??0))},${g?-d/2-p.height/2-x/2:d/2-p.height/2+x/2})`),A.attr("transform",`translate(0,${g?p.height/2+x/2:-p.height/2-x/2})`),ft(t,N),t.intersect=function(P){if(Z.info("iconSquare intersect",t,P),!t.label)return lt.rect(t,P);let I=t.x??0,D=t.y??0,_=t.height??0,R=[];return g?R=[{x:I-p.width/2,y:D-_/2},{x:I+p.width/2,y:D-_/2},{x:I+p.width/2,y:D-_/2+p.height+x},{x:I+h/2,y:D-_/2+p.height+x},{x:I+h/2,y:D+_/2},{x:I-h/2,y:D+_/2},{x:I-h/2,y:D-_/2+p.height+x},{x:I-p.width/2,y:D-_/2+p.height+x}]:R=[{x:I-h/2,y:D-_/2},{x:I+h/2,y:D-_/2},{x:I+h/2,y:D-_/2+d},{x:I+p.width/2,y:D-_/2+d},{x:I+p.width/2/2,y:D+_/2},{x:I-p.width/2,y:D+_/2},{x:I-p.width/2,y:D-_/2+d},{x:I-h/2,y:D-_/2+d}],lt.polygon(t,R,P)},f}var Kie=z(()=>{"use strict";jt();St();Kt();Ht();Wt();o(Xie,"imageSquare")});async function Zie(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=n,s=t.look==="neo"?n*2:n,{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=Math.max(u.width+(s??0)*2,t?.width??0),d=Math.max(u.height+(a??0)*2,t?.height??0),f=[{x:0,y:0},{x:h,y:0},{x:h+3*d/6,y:-d},{x:-3*d/6,y:-d}],p,{cssStyles:m}=t;if(t.look==="handDrawn"){let g=ut.svg(l),y=mt(t,{}),v=tr(f),x=g.path(v,y);p=l.insert(()=>x,":first-child").attr("transform",`translate(${-h/2}, ${d/2})`),m&&p.attr("style",m)}else p=Ma(l,h,d,f);return i&&p.attr("style",i),t.width=h,t.height=d,ft(t,p),t.intersect=function(g){return lt.polygon(t,f,g)},l}var Qie=z(()=>{"use strict";Wt();Kt();Ht();jt();Fu();o(Zie,"inv_trapezoid")});async function Jie(e,t){let{shapeSvg:r,bbox:i,label:n}=await At(e,t,"label"),a=r.insert("rect",":first-child");return a.attr("width",.1).attr("height",.1),r.attr("class","label edgeLabel"),n.attr("transform",`translate(${-(i.width/2)-(i.x-(i.left??0))}, ${-(i.height/2)-(i.y-(i.top??0))})`),ft(t,a),t.intersect=function(u){return lt.rect(t,u)},r}var ene=z(()=>{"use strict";Dp();Wt();Kt();o(Jie,"labelRect")});async function tne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=n,s=t.look==="neo"?n*2:n,{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=(t?.height??u.height)+a,d=(t?.width??u.width)+s,f=[{x:0,y:0},{x:d+3*h/6,y:0},{x:d,y:-h},{x:-(3*h)/6,y:-h}],p,{cssStyles:m}=t;if(t.look==="handDrawn"){let g=ut.svg(l),y=mt(t,{}),v=tr(f),x=g.path(v,y);p=l.insert(()=>x,":first-child").attr("transform",`translate(${-d/2}, ${h/2})`),m&&p.attr("style",m)}else p=Ma(l,d,h,f);return i&&p.attr("style",i),t.width=d,t.height=h,ft(t,p),t.intersect=function(g){return lt.polygon(t,f,g)},l}var rne=z(()=>{"use strict";Wt();Kt();Ht();jt();Fu();o(tne,"lean_left")});async function ine(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=n,s=t.look==="neo"?n*2:n,{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=(t?.height??u.height)+a,d=(t?.width??u.width)+s,f=[{x:-3*h/6,y:0},{x:d,y:0},{x:d+3*h/6,y:-h},{x:0,y:-h}],p,{cssStyles:m}=t;if(t.look==="handDrawn"){let g=ut.svg(l),y=mt(t,{}),v=tr(f),x=g.path(v,y);p=l.insert(()=>x,":first-child").attr("transform",`translate(${-d/2}, ${h/2})`),m&&p.attr("style",m)}else p=Ma(l,d,h,f);return i&&p.attr("style",i),t.width=d,t.height=h,ft(t,p),t.intersect=function(g){return lt.polygon(t,f,g)},l}var nne=z(()=>{"use strict";Wt();Kt();Ht();jt();Fu();o(ine,"lean_right")});function ane(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.label="",t.labelStyle=r;let n=e.insert("g").attr("class",Ct(t)).attr("id",t.domId??t.id),{cssStyles:a}=t,s=Math.max(35,t?.width??0),l=Math.max(35,t?.height??0),u=7,h=[{x:s,y:0},{x:0,y:l+u/2},{x:s-2*u,y:l+u/2},{x:0,y:2*l},{x:s,y:l-u/2},{x:2*u,y:l-u/2}],d=ut.svg(n),f=mt(t,{});t.look!=="handDrawn"&&(f.roughness=0,f.fillStyle="solid");let p=tr(h),m=d.path(p,f),g=n.insert(()=>m,":first-child");return g.attr("class","outer-path"),a&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",a),i&&t.look!=="handDrawn"&&g.selectAll("path").attr("style",i),g.attr("transform",`translate(-${s/2},${-l})`),ft(t,g),t.intersect=function(y){return Z.info("lightningBolt intersect",t,y),lt.polygon(t,h,y)},n}var sne=z(()=>{"use strict";St();Wt();Ht();jt();Kt();Wt();o(ane,"lightningBolt")});async function cne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?24:n;if(t.width||t.height){let x=t.width??0;t.width=(t.width??0)-a,t.widthk,":first-child").attr("class","line"),y=l.insert(()=>C,":first-child"),y.attr("class","basic label-container"),v&&y.attr("style",v)}else{let x=_qe(0,0,d,m,f,p,g);y=l.insert("path",":first-child").attr("d",x).attr("class","basic label-container outer-path").attr("style",ii(v)).attr("style",i)}return y.attr("label-offset-y",p),y.attr("transform",`translate(${-d/2}, ${-(m/2+p)})`),ft(t,y),h.attr("transform",`translate(${-(u.width/2)-(u.x-(u.left??0))}, ${-(u.height/2)+p-(u.y-(u.top??0))})`),t.intersect=function(x){let b=lt.rect(t,x),T=b.x-(t.x??0);if(f!=0&&(Math.abs(T)<(t.width??0)/2||Math.abs(T)==(t.width??0)/2&&Math.abs(b.y-(t.y??0))>(t.height??0)/2-p)){let w=p*p*(1-T*T/(f*f));w>0&&(w=Math.sqrt(w)),w=p-w,x.y-(t.y??0)>0&&(w=-w),b.y+=w}return b},l}var _qe,Dqe,Rqe,one,lne,une=z(()=>{"use strict";Wt();Kt();Ht();jt();Xt();_qe=o((e,t,r,i,n,a,s)=>[`M${e},${t+a}`,`a${n},${a} 0,0,0 ${r},0`,`a${n},${a} 0,0,0 ${-r},0`,`l0,${i}`,`a${n},${a} 0,0,0 ${r},0`,`l0,${-i}`,`M${e},${t+a+s}`,`a${n},${a} 0,0,0 ${r},0`].join(" "),"createCylinderPathD"),Dqe=o((e,t,r,i,n,a,s)=>[`M${e},${t+a}`,`M${e+r},${t+a}`,`a${n},${a} 0,0,0 ${-r},0`,`l0,${i}`,`a${n},${a} 0,0,0 ${r},0`,`l0,${-i}`,`M${e},${t+a+s}`,`a${n},${a} 0,0,0 ${r},0`].join(" "),"createOuterCylinderPathD"),Rqe=o((e,t,r,i,n,a)=>[`M${e-r/2},${-i/2}`,`a${n},${a} 0,0,0 ${r},0`].join(" "),"createInnerCylinderPathD"),one=10,lne=10;o(cne,"linedCylinder")});async function hne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?12:n;if(t.width||t.height){let w=t.width;t.width=(w??0)*10/11-a*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-s*2,t.height<10&&(t.height=10)}let{shapeSvg:l,bbox:u,label:h}=await At(e,t,Ct(t)),d=(t?.width?t?.width:u.width)+(a??0)*2,f=(t?.height?t?.height:u.height)+(s??0)*2,p=t.look==="neo"?f/4:f/8,m=f+p,{cssStyles:g}=t,y=ut.svg(l),v=mt(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let x=[{x:-d/2-d/2*.1,y:-m/2},{x:-d/2-d/2*.1,y:m/2},...Bo(-d/2-d/2*.1,m/2,d/2+d/2*.1,m/2,p,.8),{x:d/2+d/2*.1,y:-m/2},{x:-d/2-d/2*.1,y:-m/2},{x:-d/2,y:-m/2},{x:-d/2,y:m/2*1.1},{x:-d/2,y:-m/2}],b=y.polygon(x.map(w=>[w.x,w.y]),v),T=l.insert(()=>b,":first-child");return T.attr("class","basic label-container outer-path"),g&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",g),i&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",i),T.attr("transform",`translate(0,${-p/2})`),h.attr("transform",`translate(${-d/2+(t.padding??0)+d/2*.1/2-(u.x-(u.left??0))},${-f/2+(t.padding??0)-p/2-(u.y-(u.top??0))})`),ft(t,T),t.intersect=function(w){return lt.polygon(t,x,w)},l}var dne=z(()=>{"use strict";Wt();Kt();jt();Ht();o(hne,"linedWaveEdgedRect")});async function fne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?12:n,l=t.look==="neo"?10:5;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-a*2-2*l,10),t.height=Math.max((t?.height??0)-s*2-2*l,10));let{shapeSvg:u,bbox:h,label:d}=await At(e,t,Ct(t)),f=(t?.width?t?.width:h.width)+a*2+2*l,p=(t?.height?t?.height:h.height)+s*2+2*l,m=f-2*l,g=p-2*l,y=-m/2,v=-g/2,{cssStyles:x}=t,b=ut.svg(u),T=mt(t,{}),w=[{x:y-l,y:v+l},{x:y-l,y:v+g+l},{x:y+m-l,y:v+g+l},{x:y+m-l,y:v+g},{x:y+m,y:v+g},{x:y+m,y:v+g-l},{x:y+m+l,y:v+g-l},{x:y+m+l,y:v-l},{x:y+l,y:v-l},{x:y+l,y:v},{x:y,y:v},{x:y,y:v+l}],C=[{x:y,y:v+l},{x:y+m-l,y:v+l},{x:y+m-l,y:v+g},{x:y+m,y:v+g},{x:y+m,y:v},{x:y,y:v}];t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");let k=tr(w),E=b.path(k,T),A=tr(C),N=b.path(A,T);t.look!=="handDrawn"&&(E=uN(E),N=uN(N));let P=u.insert("g",":first-child");return P.insert(()=>E),P.insert(()=>N),P.attr("class","basic label-container outer-path"),x&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",x),i&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",i),d.attr("transform",`translate(${-(h.width/2)-l-(h.x-(h.left??0))}, ${-(h.height/2)+l-(h.y-(h.top??0))})`),ft(t,P),t.intersect=function(I){return lt.polygon(t,w,I)},u}var pne=z(()=>{"use strict";Wt();Ht();jt();Kt();o(fne,"multiRect")});async function mne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let{shapeSvg:n,bbox:a,label:s}=await At(e,t,Ct(t)),l=t.padding??0,u=t.look==="neo"?16:l,h=t.look==="neo"?12:l,d=!0;(t.width||t.height)&&(d=!1,t.width=(t?.width??0)-u*2,t.height=(t?.height??0)-h*3);let f=Math.max(a.width,t?.width??0)+u*2,p=Math.max(a.height,t?.height??0)+h*3,m=t.look==="neo"?p/4:p/8,g=p+(d?m/2:-m/2),y=-f/2,v=-g/2,x=10,{cssStyles:b}=t,T=Bo(y-x,v+g+x,y+f-x,v+g+x,m,.8),w=T?.[T.length-1],C=[{x:y-x,y:v+x},{x:y-x,y:v+g+x},...T,{x:y+f-x,y:w.y-x},{x:y+f,y:w.y-x},{x:y+f,y:w.y-2*x},{x:y+f+x,y:w.y-2*x},{x:y+f+x,y:v-x},{x:y+x,y:v-x},{x:y+x,y:v},{x:y,y:v},{x:y,y:v+x}],k=[{x:y,y:v+x},{x:y+f-x,y:v+x},{x:y+f-x,y:w.y-x},{x:y+f,y:w.y-x},{x:y+f,y:v},{x:y,y:v}],E=ut.svg(n),A=mt(t,{});t.look!=="handDrawn"&&(A.roughness=0,A.fillStyle="solid");let N=tr(C),P=E.path(N,A),I=tr(k),D=E.path(I,A),_=n.insert(()=>P,":first-child");return _.insert(()=>D),_.attr("class","basic label-container outer-path"),b&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",b),i&&t.look!=="handDrawn"&&_.selectAll("path").attr("style",i),_.attr("transform",`translate(0,${-m/2})`),s.attr("transform",`translate(${-(a.width/2)-x-(a.x-(a.left??0))}, ${-(a.height/2)+x-m/2-(a.y-(a.top??0))})`),ft(t,_),t.intersect=function(R){return lt.polygon(t,C,R)},n}var gne=z(()=>{"use strict";Wt();Kt();jt();Ht();o(mne,"multiWaveEdgedRectangle")});async function yne(e,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:n}=ct(t);t.labelStyle=i,t.useHtmlLabels||Mr(Nt())||(t.centerLabel=!0);let{shapeSvg:s,bbox:l,label:u}=await At(e,t,Ct(t)),h=Math.max(l.width+(t.padding??0)*2,t?.width??0),d=Math.max(l.height+(t.padding??0)*2,t?.height??0),f=-h/2,p=-d/2,{cssStyles:m}=t,g=ut.svg(s),y=mt(t,{fill:r.noteBkgColor,stroke:r.noteBorderColor});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=g.rectangle(f,p,h,d,y),x=s.insert(()=>v,":first-child");return x.attr("class","basic label-container outer-path"),u.attr("class","label noteLabel"),m&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",m),n&&t.look!=="handDrawn"&&x.selectAll("path").attr("style",n),u.attr("transform",`translate(${-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),ft(t,x),t.intersect=function(b){return lt.rect(t,b)},s}var vne=z(()=>{"use strict";jt();Kt();Ht();Wt();br();br();o(yne,"note")});async function xne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let{shapeSvg:n,bbox:a}=await At(e,t,Ct(t)),s=a.width+(t.padding??0),l=a.height+(t.padding??0),u=s+l,h=.5,d=[{x:u/2,y:0},{x:u,y:-u/2},{x:u/2,y:-u},{x:0,y:-u/2}],f,{cssStyles:p}=t;if(t.look==="handDrawn"){let m=ut.svg(n),g=mt(t,{}),y=Lqe(0,0,u),v=m.path(y,g);f=n.insert(()=>v,":first-child").attr("transform",`translate(${-u/2+h}, ${u/2})`),p&&f.attr("style",p)}else f=Ma(n,u,u,d),f.attr("transform",`translate(${-u/2+h}, ${u/2})`);return i&&f.attr("style",i),ft(t,f),t.calcIntersect=function(m,g){let y=m.width,v=[{x:y/2,y:0},{x:y,y:-y/2},{x:y/2,y:-y},{x:0,y:-y/2}],x=lt.polygon(m,v,g);return{x:x.x-.5,y:x.y-.5}},t.intersect=function(m){return this.calcIntersect(t,m)},n}var Lqe,bne=z(()=>{"use strict";Wt();Kt();Ht();jt();Fu();Lqe=o((e,t,r)=>[`M${e+r/2},${t}`,`L${e+r},${t-r/2}`,`L${e+r/2},${t-r}`,`L${e},${t-r/2}`,"Z"].join(" "),"createDecisionBoxPathD");o(xne,"question")});async function Tne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?21:n??0,s=t.look==="neo"?12:n??0,{shapeSvg:l,bbox:u,label:h}=await At(e,t,Ct(t)),d=(t?.width??u.width)+(t.look==="neo"?a*2:a),f=(t?.height??u.height)+(t.look==="neo"?s*2:s),p=-d/2,m=-f/2,g=m/2,y=[{x:p+g,y:m},{x:p,y:0},{x:p+g,y:-m},{x:-p,y:-m},{x:-p,y:m}],{cssStyles:v}=t,x=ut.svg(l),b=mt(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let T=tr(y),w=x.path(T,b),C=l.insert(()=>w,":first-child");return C.attr("class","basic label-container outer-path"),v&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",v),i&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",i),C.attr("transform",`translate(${-g/2},0)`),h.attr("transform",`translate(${-g/2-u.width/2-(u.x-(u.left??0))}, ${-(u.height/2)-(u.y-(u.top??0))})`),ft(t,C),t.intersect=function(k){return lt.polygon(t,y,k)},l}var Cne=z(()=>{"use strict";Wt();Kt();Ht();jt();o(Tne,"rect_left_inv_arrow")});var Mqe,Nl,z4=z(()=>{"use strict";br();Ut();_s();Mqe=o(async(e,t,r,i=!1,n=!1)=>{let a=t||"";typeof a=="object"&&(a=a[0]);let s=ge(),l=Mr(s);return await wi(e,a,{style:r,isTitle:i,useHtmlLabels:l,markdown:!1,isNode:n,width:Number.POSITIVE_INFINITY},s)},"createLabel"),Nl=Mqe});async function kne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n;t.cssClasses?n="node "+t.cssClasses:n="node default";let a=e.insert("g").attr("class",n).attr("id",t.domId||t.id),s=a.insert("g"),l=a.insert("g").attr("class","label").attr("style",i),u=t.description,h=t.label,d=await Nl(l,h,t.labelStyle,!0,!0),f={width:0,height:0};if(Mr(ge())){let A=d.children[0],N=Je(d);f=A.getBoundingClientRect(),N.attr("width",f.width),N.attr("height",f.height)}Z.info("Text 2",u);let p=u||[],m=d.getBBox(),g=await Nl(l,Array.isArray(p)?p.join("
    "):p,t.labelStyle,!0,!0),y=g.children[0],v=Je(g);f=y.getBoundingClientRect(),v.attr("width",f.width),v.attr("height",f.height);let x=(t.padding||0)/2;Je(g).attr("transform","translate( "+(f.width>m.width?0:(m.width-f.width)/2)+", "+(m.height+x+5)+")"),Je(d).attr("transform","translate( "+(f.width(Z.debug("Rough node insert CXC",P),I),":first-child"),k=a.insert(()=>(Z.debug("Rough node insert CXC",P),P),":first-child")}else k=s.insert("rect",":first-child"),E=s.insert("line"),k.attr("class","outer title-state").attr("style",i).attr("x",-f.width/2-x).attr("y",-f.height/2-x).attr("width",f.width+(t.padding||0)).attr("height",f.height+(t.padding||0)),E.attr("class","divider").attr("x1",-f.width/2-x).attr("x2",f.width/2+x).attr("y1",-f.height/2-x+m.height+x).attr("y2",-f.height/2-x+m.height+x);return ft(t,k),t.intersect=function(A){return lt.rect(t,A)},a}var wne=z(()=>{"use strict";Rr();Wt();z4();Kt();Ht();jt();Ut();_p();St();br();o(kne,"rectWithTitle")});async function Sne(e,t,{config:{themeVariables:r}}){let i=r?.radius??5,n={rx:i,ry:i,classes:"",labelPaddingX:(t?.padding??0)*1,labelPaddingY:(t?.padding??0)*1};return Ml(e,t,n)}var Ene=z(()=>{"use strict";Dp();o(Sne,"roundedRect")});async function Ane(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.look==="neo"?16:t.padding??0,a=t.look==="neo"?12:t.padding??0,{shapeSvg:s,bbox:l,label:u}=await At(e,t,Ct(t)),h=(t?.width??l.width)+n*2+(t.look==="neo"?Rp:Rp*2),d=(t?.height??l.height)+a*2,f=h-Rp,p=d,m=Rp-h/2,g=-d/2,{cssStyles:y}=t,v=ut.svg(s),x=mt(t,{});t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");let b=[{x:m,y:g},{x:m+f,y:g},{x:m+f,y:g+p},{x:m-Rp,y:g+p},{x:m-Rp,y:g},{x:m,y:g},{x:m,y:g+p}],T=v.polygon(b.map(C=>[C.x,C.y]),x),w=s.insert(()=>T,":first-child");return w.attr("class","basic label-container outer-path").attr("style",ii(y)),i&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",i),y&&t.look!=="handDrawn"&&w.selectAll("path").attr("style",i),u.attr("transform",`translate(${Rp/2-l.width/2-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),ft(t,w),t.intersect=function(C){return lt.rect(t,C)},s}var Rp,_ne=z(()=>{"use strict";Wt();Kt();Ht();jt();Xt();Rp=8;o(Ane,"shadedProcess")});async function Dne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?12:n;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-a*2,10),t.height=Math.max((t?.height??0)/1.5-s*2,10));let{shapeSvg:l,bbox:u,label:h}=await At(e,t,Ct(t)),d=(t?.width?t?.width:u.width)+a*2,f=((t?.height?t?.height:u.height)+s*2)*1.5,p=d,m=f/1.5,g=-p/2,y=-m/2,{cssStyles:v}=t,x=ut.svg(l),b=mt(t,{});t.look!=="handDrawn"&&(b.roughness=0,b.fillStyle="solid");let T=[{x:g,y},{x:g,y:y+m},{x:g+p,y:y+m},{x:g+p,y:y-m/2}],w=tr(T),C=x.path(w,b),k=l.insert(()=>C,":first-child");return k.attr("class","basic label-container outer-path"),v&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",v),i&&t.look!=="handDrawn"&&k.selectChildren("path").attr("style",i),k.attr("transform",`translate(0, ${m/4})`),h.attr("transform",`translate(${-p/2+(t.padding??0)-(u.x-(u.left??0))}, ${-m/4+(t.padding??0)-(u.y-(u.top??0))})`),ft(t,k),t.intersect=function(E){return lt.polygon(t,T,E)},l}var Rne=z(()=>{"use strict";Wt();Kt();Ht();jt();o(Dne,"slopedRect")});async function Lne(e,t){let r=t.padding??0,i=t.look==="neo"?16:r*2,n=t.look==="neo"?12:r,a={rx:0,ry:0,classes:"",labelPaddingX:t.labelPaddingX??i,labelPaddingY:n};return Ml(e,t,a)}var Mne=z(()=>{"use strict";Dp();o(Lne,"squareRect")});async function Nne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?20:n,s=t.look==="neo"?12:n,{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=u.height+(t.look==="neo"?s*2:s),d=u.width+h/4+(t.look==="neo"?a*2:a),f=h/2,{cssStyles:p}=t,m=ut.svg(l),g=mt(t,{});t.look!=="handDrawn"&&(g.roughness=0,g.fillStyle="solid");let y=[{x:-d/2+f,y:-h/2},{x:d/2-f,y:-h/2},...Ep(-d/2+f,0,f,50,90,270),{x:d/2-f,y:h/2},...Ep(d/2-f,0,f,50,270,450)],v=tr(y),x=m.path(v,g),b=l.insert(()=>x,":first-child");return b.attr("class","basic label-container outer-path"),p&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",p),i&&t.look!=="handDrawn"&&b.selectChildren("path").attr("style",i),ft(t,b),t.intersect=function(T){return lt.polygon(t,y,T)},l}var Ine=z(()=>{"use strict";Wt();Kt();Ht();jt();o(Nne,"stadium")});async function One(e,t){let r={rx:t.look==="neo"?3:5,ry:t.look==="neo"?3:5,classes:"flowchart-node"};return Ml(e,t,r)}var Pne=z(()=>{"use strict";Dp();o(One,"state")});function Bne(e,t,{config:{themeVariables:r}}){let{labelStyles:i,nodeStyles:n}=ct(t);t.labelStyle=i;let{cssStyles:a}=t,{lineColor:s,stateBorder:l,nodeBorder:u,nodeShadow:h}=r;(t.width||t.height)&&((t.width??0)<14&&(t.width=14),(t.height??0)<14&&(t.height=14)),t.width||(t.width=14),t.height||(t.height=14);let d=e.insert("g").attr("class","node default").attr("id",t.domId??t.id),f=ut.svg(d),p=mt(t,{});t.look!=="handDrawn"&&(p.roughness=0,p.fillStyle="solid");let m=f.circle(0,0,t.width,{...p,stroke:s,strokeWidth:2}),g=l??u,y=(t.width??0)*5/14,v=f.circle(0,0,y,{...p,fill:g,stroke:g,strokeWidth:2,fillStyle:"solid"}),x=d.insert(()=>m,":first-child");if(x.insert(()=>v),t.look!=="handDrawn"&&x.attr("class","outer-path"),a&&x.selectAll("path").attr("style",a),n&&x.selectAll("path").attr("style",n),t.width<25&&h&&t.look!=="handDrawn"){let b=e.node()?.ownerSVGElement?.id??"",T=b?`${b}-drop-shadow-small`:"drop-shadow-small";x.attr("style",`filter:url(#${T})`)}return ft(t,x),t.intersect=function(b){return lt.circle(t,(t.width??0)/2,b)},d}var Fne=z(()=>{"use strict";jt();Kt();Ht();Wt();o(Bne,"stateEnd")});function $ne(e,t,{config:{themeVariables:r}}){let{lineColor:i,nodeShadow:n}=r;(t.width||t.height)&&((t.width??0)<14&&(t.width=14),(t.height??0)<14&&(t.height=14)),t.width||(t.width=14),t.height||(t.height=14);let a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s;if(t.look==="handDrawn"){let u=ut.svg(a).circle(0,0,t.width,Bre(i));s=a.insert(()=>u),s.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14)}else s=a.insert("circle",":first-child"),s.attr("class","state-start").attr("r",(t.width??7)/2).attr("width",t.width??14).attr("height",t.height??14);if(t.width<25&&n&&t.look!=="handDrawn"){let l=e.node()?.ownerSVGElement?.id??"",u=l?`${l}-drop-shadow-small`:"drop-shadow-small";s.attr("style",`filter:url(#${u})`)}return ft(t,s),t.intersect=function(l){return lt.circle(t,(t.width??7)/2,l)},a}var zne=z(()=>{"use strict";jt();Kt();Ht();Wt();o($ne,"stateStart")});async function Gne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t?.padding??8,a=t.look==="neo"?28:n,s=t.look==="neo"?12:n,{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=(t?.width??u.width)+2*kg+a,d=(t?.height??u.height)+s,f=h-2*kg,p=d,m=-h/2,g=-d/2,y=[{x:0,y:0},{x:f,y:0},{x:f,y:-p},{x:0,y:-p},{x:0,y:0},{x:-8,y:0},{x:f+8,y:0},{x:f+8,y:-p},{x:-8,y:-p},{x:-8,y:0}];if(t.look==="handDrawn"){let v=ut.svg(l),x=mt(t,{}),b=v.rectangle(m,g,f+16,p,x),T=v.line(m+kg,g,m+kg,g+p,x),w=v.line(m+kg+f,g,m+kg+f,g+p,x);l.insert(()=>T,":first-child"),l.insert(()=>w,":first-child");let C=l.insert(()=>b,":first-child"),{cssStyles:k}=t;C.attr("class","basic label-container").attr("style",ii(k)),ft(t,C)}else{let v=Ma(l,f,p,y);i&&v.attr("style",i),ft(t,v)}return t.intersect=function(v){return lt.polygon(t,y,v)},l}var kg,Vne=z(()=>{"use strict";Wt();Kt();Ht();jt();Fu();Xt();kg=8;o(Gne,"subroutine")});async function Wne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?12:n;(t.width||t.height)&&(t.height=Math.max((t?.height??0)-s*2,10),t.width=Math.max((t?.width??0)-a*2-LN*(t.height+s*2),10));let{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=(t?.height?t?.height:u.height)+s*2,d=LN*h,f=LN*h,m=(t?.width?t?.width:u.width)+a*2+d-d,g=h,y=-m/2,v=-g/2,{cssStyles:x}=t,b=ut.svg(l),T=mt(t,{}),w=[{x:y-d/2,y:v},{x:y+m+d/2,y:v},{x:y+m+d/2,y:v+g},{x:y-d/2,y:v+g}],C=[{x:y+m-d/2,y:v+g},{x:y+m+d/2,y:v+g},{x:y+m+d/2,y:v+g-f}];t.look!=="handDrawn"&&(T.roughness=0,T.fillStyle="solid");let k=tr(w),E=b.path(k,T),A=tr(C),N=b.path(A,{...T,fillStyle:"solid"}),P=l.insert(()=>N,":first-child");return P.insert(()=>E,":first-child"),P.attr("class","basic label-container outer-path"),x&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",x),i&&t.look!=="handDrawn"&&P.selectAll("path").attr("style",i),ft(t,P),t.intersect=function(I){return lt.polygon(t,w,I)},l}var LN,qne=z(()=>{"use strict";Wt();Ht();jt();Kt();LN=.2;o(Wne,"taggedRect")});async function Une(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let{shapeSvg:n,bbox:a,label:s}=await At(e,t,Ct(t)),l=Math.max(a.width+(t.padding??0)*2,t?.width??0),u=Math.max(a.height+(t.padding??0)*2,t?.height??0),h=u/8,d=.2*l,f=.2*u,p=u+h,{cssStyles:m}=t,g=ut.svg(n),y=mt(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=[{x:-l/2-l/2*.1,y:p/2},...Bo(-l/2-l/2*.1,p/2,l/2+l/2*.1,p/2,h,.8),{x:l/2+l/2*.1,y:-p/2},{x:-l/2-l/2*.1,y:-p/2}],x=-l/2+l/2*.1,b=-p/2-f*.4,T=[{x:x+l-d,y:(b+u)*1.3},{x:x+l,y:b+u-f},{x:x+l,y:(b+u)*.9},...Bo(x+l,(b+u)*1.25,x+l-d,(b+u)*1.3,-u*.02,.5)],w=tr(v),C=g.path(w,y),k=tr(T),E=g.path(k,{...y,fillStyle:"solid"}),A=n.insert(()=>E,":first-child");return A.insert(()=>C,":first-child"),A.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",i),A.attr("transform",`translate(0,${-h/2})`),s.attr("transform",`translate(${-l/2+(t.padding??0)-(a.x-(a.left??0))},${-u/2+(t.padding??0)-h/2-(a.y-(a.top??0))})`),ft(t,A),t.intersect=function(N){return lt.polygon(t,v,N)},n}var Hne=z(()=>{"use strict";Wt();Kt();jt();Ht();o(Une,"taggedWaveEdgedRectangle")});async function Yne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let{shapeSvg:n,bbox:a}=await At(e,t,Ct(t)),s=Math.max(a.width+(t.padding??0),t?.width||0),l=Math.max(a.height+(t.padding??0),t?.height||0),u=-s/2,h=-l/2,d=n.insert("rect",":first-child");return d.attr("class","text").attr("style",i).attr("rx",0).attr("ry",0).attr("x",u).attr("y",h).attr("width",s).attr("height",l),ft(t,d),t.intersect=function(f){return lt.rect(t,f)},n}var jne=z(()=>{"use strict";Wt();Kt();Ht();o(Yne,"text")});async function Zne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?12:n/2;if(t.width||t.height){let y=t.height??0;t.height=(t.height??0)-a,t.heightT,":first-child"),g=s.insert(()=>b,":first-child"),g.attr("class","basic label-container"),m&&g.attr("style",m)}else{let y=Nqe(0,0,p,h,f,d);g=s.insert("path",":first-child").attr("d",y).attr("class","basic label-container").attr("style",ii(m)).attr("style",i),g.attr("class","basic label-container outer-path"),m&&g.selectAll("path").attr("style",m),i&&g.selectAll("path").attr("style",i)}return g.attr("label-offset-x",f),g.attr("transform",`translate(${-p/2}, ${h/2} )`),u.attr("transform",`translate(${-(l.width/2)-f-(l.x-(l.left??0))}, ${-(l.height/2)-(l.y-(l.top??0))})`),ft(t,g),t.intersect=function(y){let v=lt.rect(t,y),x=v.y-(t.y??0);if(d!=0&&(Math.abs(x)<(t.height??0)/2||Math.abs(x)==(t.height??0)/2&&Math.abs(v.x-(t.x??0))>(t.width??0)/2-f)){let b=f*f*(1-x*x/(d*d));b!=0&&(b=Math.sqrt(Math.abs(b))),b=f-b,y.x-(t.x??0)>0&&(b=-b),v.x+=b}return v},s}var Nqe,Iqe,Oqe,Xne,Kne,Qne=z(()=>{"use strict";Wt();Ht();jt();Kt();Xt();Nqe=o((e,t,r,i,n,a)=>`M${e},${t} + a${n},${a} 0,0,1 0,${-i} + l${r},0 + a${n},${a} 0,0,1 0,${i} + M${r},${-i} + a${n},${a} 0,0,0 0,${i} + l${-r},0`,"createCylinderPathD"),Iqe=o((e,t,r,i,n,a)=>[`M${e},${t}`,`M${e+r},${t}`,`a${n},${a} 0,0,0 0,${-i}`,`l${-r},0`,`a${n},${a} 0,0,0 0,${i}`,`l${r},0`].join(" "),"createOuterCylinderPathD"),Oqe=o((e,t,r,i,n,a)=>[`M${e+r/2},${-i/2}`,`a${n},${a} 0,0,0 0,${i}`].join(" "),"createInnerCylinderPathD"),Xne=5,Kne=10;o(Zne,"tiltedCylinder")});async function Jne(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=(t.look==="neo",n),s=t.look==="neo"?n*2:n,{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=(t?.height??u.height)+a,d=(t?.width??u.width)+s,f=[{x:-3*h/6,y:0},{x:d+3*h/6,y:0},{x:d,y:-h},{x:0,y:-h}],p,{cssStyles:m}=t;if(t.look==="handDrawn"){let g=ut.svg(l),y=mt(t,{}),v=tr(f),x=g.path(v,y);p=l.insert(()=>x,":first-child").attr("transform",`translate(${-d/2}, ${h/2})`),m&&p.attr("style",m)}else p=Ma(l,d,h,f);return i&&p.attr("style",i),t.width=d,t.height=h,ft(t,p),t.intersect=function(g){return lt.polygon(t,f,g)},l}var eae=z(()=>{"use strict";Wt();Kt();Ht();jt();Fu();o(Jne,"trapezoid")});async function tae(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?12:n,l=15,u=5;(t.width||t.height)&&(t.height=(t.height??0)-s*2,t.heightb,":first-child");return T.attr("class","basic label-container outer-path"),m&&t.look!=="handDrawn"&&T.selectChildren("path").attr("style",m),i&&t.look!=="handDrawn"&&T.selectChildren("path").attr("style",i),ft(t,T),t.intersect=function(w){return lt.polygon(t,v,w)},h}var rae=z(()=>{"use strict";Wt();Kt();Ht();jt();o(tae,"trapezoidalPentagon")});async function aae(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?n*2:n;(t.width||t.height)&&(t.width=((t?.width??0)-a)/2,t.widthb,":first-child").attr("transform",`translate(${-f/2}, ${f/2})`).attr("class","outer-path");return g&&t.look!=="handDrawn"&&T.selectChildren("path").attr("style",g),i&&t.look!=="handDrawn"&&T.selectChildren("path").attr("style",i),t.width=d,t.height=f,ft(t,T),u.attr("transform",`translate(${-l.width/2-(l.x-(l.left??0))}, ${f/2-(l.height+(t.padding??0)/(h?2:1)-(l.y-(l.top??0)))})`),t.intersect=function(w){return Z.info("Triangle intersect",t,m,w),lt.polygon(t,m,w)},s}var iae,nae,sae=z(()=>{"use strict";St();Wt();Kt();Ht();jt();Wt();Ir();Ut();iae=10,nae=10;o(aae,"triangle")});async function oae(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?12:n,l=!0;(t.width||t.height)&&(l=!1,t.width=(t?.width??0)-a*2,t.width<10&&(t.width=10),t.height=(t?.height??0)-s*2,t.height<10&&(t.height=10));let{shapeSvg:u,bbox:h,label:d}=await At(e,t,Ct(t)),f=(t?.width?t?.width:h.width)+(a??0)*2,p=(t?.height?t?.height:h.height)+(s??0)*2,m=t.look==="neo"?p/4:p/8,g=p+(l?m:-m),{cssStyles:y}=t,x=14-f,b=x>0?x/2:0,T=ut.svg(u),w=mt(t,{});t.look!=="handDrawn"&&(w.roughness=0,w.fillStyle="solid");let C=[{x:-f/2-b,y:g/2},...Bo(-f/2-b,g/2,f/2+b,g/2,m,.8),{x:f/2+b,y:-g/2},{x:-f/2-b,y:-g/2}],k=tr(C),E=T.path(k,w),A=u.insert(()=>E,":first-child");return A.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",y),i&&t.look!=="handDrawn"&&A.selectAll("path").attr("style",i),A.attr("transform",`translate(0,${-m/2})`),d.attr("transform",`translate(${-f/2+(t.padding??0)-(h.x-(h.left??0))},${-p/2+(t.padding??0)-m-(h.y-(h.top??0))})`),ft(t,A),t.intersect=function(N){return lt.polygon(t,C,N)},u}var lae=z(()=>{"use strict";Wt();Kt();jt();Ht();o(oae,"waveEdgedRectangle")});async function cae(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.padding??0,a=t.look==="neo"?16:n,s=t.look==="neo"?20:n;if(t.width||t.height){t.width=t?.width??0,t.width<20&&(t.width=20),t.height=t?.height??0,t.height<10&&(t.height=10);let w=Math.min(t.height*.2,t.height/4);t.height=Math.ceil(t.height-s-w*(20/9)),t.width=t.width-a*2}let{shapeSvg:l,bbox:u}=await At(e,t,Ct(t)),h=(t?.width?t?.width:u.width)+a*2,d=(t?.height?t?.height:u.height)+s,f=d/8,p=d+f*2,{cssStyles:m}=t,g=ut.svg(l),y=mt(t,{});t.look!=="handDrawn"&&(y.roughness=0,y.fillStyle="solid");let v=[{x:-h/2,y:p/2},...Bo(-h/2,p/2,h/2,p/2,f,1),{x:h/2,y:-p/2},...Bo(h/2,-p/2,-h/2,-p/2,f,-1)],x=tr(v),b=g.path(x,y),T=l.insert(()=>b,":first-child");return T.attr("class","basic label-container"),m&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",m),i&&t.look!=="handDrawn"&&T.selectAll("path").attr("style",i),ft(t,T),t.intersect=function(w){return lt.polygon(t,v,w)},l}var uae=z(()=>{"use strict";Wt();Kt();Ht();jt();o(cae,"waveRectangle")});async function hae(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t.look==="neo"?16:t.padding??0,a=t.look==="neo"?12:t.padding??0;(t.width||t.height)&&(t.width=Math.max((t?.width??0)-n*2-on,10),t.height=Math.max((t?.height??0)-a*2-on,10));let{shapeSvg:s,bbox:l,label:u}=await At(e,t,Ct(t)),h=(t?.width?t?.width:l.width)+n*2+on,d=(t?.height?t?.height:l.height)+a*2+on,f=h-on,p=d-on,m=-f/2,g=-p/2,{cssStyles:y}=t,v=ut.svg(s),x=mt(t,{}),b=[{x:m-on,y:g-on},{x:m-on,y:g+p},{x:m+f,y:g+p},{x:m+f,y:g-on}],T=`M${m-on},${g-on} L${m+f},${g-on} L${m+f},${g+p} L${m-on},${g+p} L${m-on},${g-on} + M${m-on},${g} L${m+f},${g} + M${m},${g-on} L${m},${g+p}`;t.look!=="handDrawn"&&(x.roughness=0,x.fillStyle="solid");let w=v.path(T,x),C=s.insert(()=>w,":first-child");return C.attr("transform",`translate(${on/2}, ${on/2})`),C.attr("class","basic label-container outer-path"),y&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",y),i&&t.look!=="handDrawn"&&C.selectAll("path").attr("style",i),u.attr("transform",`translate(${-(l.width/2)+on/2-(l.x-(l.left??0))}, ${-(l.height/2)+on/2-(l.y-(l.top??0))})`),ft(t,C),t.intersect=function(k){return lt.polygon(t,b,k)},s}var on,dae=z(()=>{"use strict";Wt();Ht();jt();Kt();on=10;o(hae,"windowPane")});async function MN(e,t){let r=t;r.alias&&(t.label=r.alias);let{theme:i,themeVariables:n}=Nt(),{rowEven:a,rowOdd:s,nodeBorder:l,borderColorArray:u}=n;if(t.look==="handDrawn"){let{themeVariables:Q}=Nt(),{background:Y}=Q,ae={...t,id:t.id+"-background",domId:(t.domId||t.id)+"-background",look:"default",cssStyles:["stroke: none",`fill: ${Y}`]};await MN(e,ae)}let h=Nt();t.useHtmlLabels=h.htmlLabels;let d=h.er?.diagramPadding??10,f=h.er?.entityPadding??6,{cssStyles:p}=t,{labelStyles:m,nodeStyles:g}=ct(t);if(r.attributes.length===0&&t.label){let Q={rx:0,ry:0,labelPaddingX:d,labelPaddingY:d*1.5,classes:""};ta(t.label,h)+Q.labelPaddingX*20){let Q=x.width+d*2-(C+k+E+A);C+=Q/I,k+=Q/I,E>0&&(E+=Q/I),A>0&&(A+=Q/I)}let _=C+k+E+A,R=ut.svg(v),M=mt(t,{});t.look!=="handDrawn"&&(M.roughness=0,M.fillStyle="solid");let L=0;w.length>0&&(L=w.reduce((Q,Y)=>Q+(Y?.rowHeight??0),0));let B=Math.max(D.width+d*2,t?.width||0,_),O=Math.max((L??0)+x.height,t?.height||0),$=-B/2,G=-O/2;if(v.selectAll("g:not(:first-child)").each((Q,Y,ae)=>{let J=Je(ae[Y]),te=J.attr("transform"),re=0,ee=0;if(te){let ue=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(te);ue&&(re=parseFloat(ue[1]),ee=parseFloat(ue[2]),J.attr("class").includes("attribute-name")?re+=C:J.attr("class").includes("attribute-keys")?re+=C+k:J.attr("class").includes("attribute-comment")&&(re+=C+k+E))}J.attr("transform",`translate(${$+d/2+re}, ${ee+G+x.height+f/2})`)}),v.select(".name").attr("transform","translate("+-x.width/2+", "+(G+f/2)+")"),i!=null&&fae.has(i)){let Q=r.colorIndex??0;v.attr("data-color-id",`color-${Q%u.length}`)}let F=R.rectangle($,G,B,O,M),V=v.insert(()=>F,":first-child").attr("class","outer-path").attr("style",p.join(""));T.push(0);for(let[Q,Y]of w.entries()){let J=(Q+1)%2===0&&Y.yOffset!==0,te=R.rectangle($,x.height+G+Y?.yOffset,B,Y?.rowHeight,{...M,fill:J?a:s,stroke:l});v.insert(()=>te,"g.label").attr("style",p.join("")).attr("class",`row-rect-${J?"even":"odd"}`)}let H=1e-4,j=tb($,x.height+G,B+$,x.height+G,H),U=R.polygon(j.map(Q=>[Q.x,Q.y]),M);if(v.insert(()=>U).attr("class","divider"),j=tb(C+$,x.height+G,C+$,O+G,H),U=R.polygon(j.map(Q=>[Q.x,Q.y]),M),v.insert(()=>U).attr("class","divider"),N){let Q=C+k+$;j=tb(Q,x.height+G,Q,O+G,H),U=R.polygon(j.map(Y=>[Y.x,Y.y]),M),v.insert(()=>U).attr("class","divider")}if(P){let Q=C+k+E+$;j=tb(Q,x.height+G,Q,O+G,H),U=R.polygon(j.map(Y=>[Y.x,Y.y]),M),v.insert(()=>U).attr("class","divider")}for(let Q of T){let Y=x.height+G+Q;j=tb($,Y,B+$,Y,H),U=R.polygon(j.map(ae=>[ae.x,ae.y]),M),v.insert(()=>U).attr("class","divider")}if(ft(t,V),g&&t.look!=="handDrawn")if(i!=null&&Pqe.has(i))v.selectAll("path").attr("style",g);else{let Y=g.split(";")?.filter(ae=>ae.includes("stroke"))?.map(ae=>`${ae}`).join("; ");v.selectAll("path").attr("style",Y??""),v.selectAll(".row-rect-even path").attr("style",g)}return t.intersect=function(Q){return lt.rect(t,Q)},v}async function eb(e,t,r,i=0,n=0,a=[],s=""){let l=e.insert("g").attr("class",`label ${a.join(" ")}`).attr("transform",`translate(${i}, ${n})`).attr("style",s);t!==cc(t)&&(t=cc(t),t=t.replaceAll("<","<").replaceAll(">",">"));let u=l.node().appendChild(await wi(l,t,{width:ta(t,r)+100,style:s,useHtmlLabels:r.htmlLabels},r));if(t.includes("<")||t.includes(">")){let d=u.children[0];for(d.textContent=d.textContent.replaceAll("<","<").replaceAll(">",">");d.childNodes[0];)d=d.childNodes[0],d.textContent=d.textContent.replaceAll("<","<").replaceAll(">",">")}let h=u.getBBox();if(Aa(r.htmlLabels)){let d=u.children[0];d.style.textAlign="start";let f=Je(u);h=d.getBoundingClientRect(),f.attr("width",h.width),f.attr("height",h.height)}return h}function tb(e,t,r,i,n){return e===r?[{x:e-n/2,y:t},{x:e+n/2,y:t},{x:r+n/2,y:i},{x:r-n/2,y:i}]:[{x:e,y:t-n/2},{x:e,y:t+n/2},{x:r,y:i+n/2},{x:r,y:i-n/2}]}var fae,Pqe,pae=z(()=>{"use strict";Wt();Kt();Ht();jt();Dp();br();_s();Ir();Rr();Xt();fae=new Set(["redux-color","redux-dark-color"]),Pqe=new Set(["redux","redux-dark","redux-color","redux-dark-color"]);o(MN,"erBox");o(eb,"addText");o(tb,"lineToPolygon")});async function mae(e,t,r,i,n=r.class.padding??12){let a=i?0:3,s=e.insert("g").attr("class",Ct(t)).attr("id",t.domId||t.id),l=null,u=null,h=null,d=null,f=0,p=0,m=0;if(l=s.insert("g").attr("class","annotation-group text"),t.annotations.length>0){let b=t.annotations[0];await G4(l,{text:`\xAB${b}\xBB`},0),f=l.node().getBBox().height}u=s.insert("g").attr("class","label-group text"),await G4(u,t,0,["font-weight: bolder"]);let g=u.node().getBBox();p=g.height,h=s.insert("g").attr("class","members-group text");let y=0;for(let b of t.members){let T=await G4(h,b,y,[b.parseClassifier()]);y+=T+a}m=h.node().getBBox().height,m<=0&&(m=n/2),d=s.insert("g").attr("class","methods-group text");let v=0;for(let b of t.methods){let T=await G4(d,b,v,[b.parseClassifier()]);v+=T+a}let x=s.node().getBBox();if(l!==null){let b=l.node().getBBox();l.attr("transform",`translate(${-b.width/2})`)}return u.attr("transform",`translate(${-g.width/2}, ${f})`),x=s.node().getBBox(),h.attr("transform",`translate(0, ${f+p+n*2})`),x=s.node().getBBox(),d.attr("transform",`translate(0, ${f+p+(m?m+n*4:n*2)})`),x=s.node().getBBox(),{shapeSvg:s,bbox:x}}async function G4(e,t,r,i=[]){let n=e.insert("g").attr("class","label").attr("style",i.join("; ")),a=Nt(),s="useHtmlLabels"in t?t.useHtmlLabels:Aa(a.htmlLabels)??!0,l="";"text"in t?l=t.text:l=t.label,!s&&l.startsWith("\\")&&(l=l.substring(1)),Bi(l)&&(s=!0);let u=await wi(n,Ev(Qa(l)),{width:ta(l,a)+50,classes:"markdown-node-label",useHtmlLabels:s},a),h,d=1;if(s){let f=u.children[0],p=Je(u);d=f.innerHTML.split("
    ").length,f.innerHTML.includes("")&&(d+=f.innerHTML.split("").length-1);let m=f.getElementsByTagName("img");if(m){let g=l.replace(/]*>/g,"").trim()==="";await Promise.all([...m].map(y=>new Promise(v=>{function x(){if(y.style.display="flex",y.style.flexDirection="column",g){let b=a.fontSize?.toString()??window.getComputedStyle(document.body).fontSize,w=parseInt(b,10)*5+"px";y.style.minWidth=w,y.style.maxWidth=w}else y.style.width="100%";v(y)}o(x,"setupImage"),setTimeout(()=>{y.complete&&x()}),y.addEventListener("error",x),y.addEventListener("load",x)})))}h=f.getBoundingClientRect(),p.attr("width",h.width),p.attr("height",h.height)}else{i.includes("font-weight: bolder")&&Je(u).selectAll("tspan").attr("font-weight",""),d=u.children.length;let f=u.children[0];(u.textContent===""||u.textContent.includes(">"))&&(f.textContent=l[0]+l.substring(1).replaceAll(">",">").replaceAll("<","<").trim(),l[1]===" "&&(f.textContent=f.textContent[0]+" "+f.textContent.substring(1))),f.textContent==="undefined"&&(f.textContent=""),h=u.getBBox()}return n.attr("transform","translate(0,"+(-h.height/(2*d)+r)+")"),h.height}var gae=z(()=>{"use strict";Rr();br();Wt();Xt();Ut();_s();Ir();o(mae,"textHelper");o(G4,"addText")});async function yae(e,t){let r=ge(),{themeVariables:i}=r,{useGradient:n}=i,a=r.class.padding??12,s=a,l=t.useHtmlLabels??Aa(r.htmlLabels)??!0,u=t;u.annotations=u.annotations??[],u.members=u.members??[],u.methods=u.methods??[];let{shapeSvg:h,bbox:d}=await mae(e,t,r,l,s),{labelStyles:f,nodeStyles:p}=ct(t);t.labelStyle=f,t.cssStyles=u.styles||"";let m=u.styles?.join(";")||p||"";t.cssStyles||(t.cssStyles=m.replaceAll("!important","").split(";"));let g=u.members.length===0&&u.methods.length===0&&!r.class?.hideEmptyMembersBox,y=ut.svg(h),v=mt(t,{});t.look!=="handDrawn"&&(v.roughness=0,v.fillStyle="solid");let x=Math.max(t.width??0,d.width),b=Math.max(t.height??0,d.height),T=(t.height??0)>d.height;u.members.length===0&&u.methods.length===0?b+=s:u.members.length>0&&u.methods.length===0&&(b+=s*2);let w=-x/2,C=-b/2,k=g?a*2:u.members.length===0&&u.methods.length===0?-a:0;T&&(k=a*2);let E=y.rectangle(w-a,C-a-(g?a:u.members.length===0&&u.methods.length===0?-a/2:0),x+2*a,b+2*a+k,v),A=h.insert(()=>E,":first-child");A.attr("class","basic label-container outer-path");let N=A.node().getBBox(),P=h.select(".annotation-group").node().getBBox().height-(g?a/2:0)||0,I=h.select(".label-group").node().getBBox().height-(g?a/2:0)||0,D=h.select(".members-group").node().getBBox().height-(g?a/2:0)||0,_=(P+I+C+a-(C-a-(g?a:u.members.length===0&&u.methods.length===0?-a/2:0)))/2;if(h.selectAll(".text").each((R,M,L)=>{let B=Je(L[M]),O=B.attr("transform"),$=0;if(O){let H=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(O);H&&($=parseFloat(H[2]))}let G=$+C+a-(g?a:u.members.length===0&&u.methods.length===0?-a/2:0);if(B.attr("class").includes("methods-group")){let V=Math.max(D,s/2);T?G=Math.max(_,P+I+V+C+s*2+a)+s*2:G=P+I+V+C+s*4+a}u.members.length===0&&u.methods.length===0&&r.class?.hideEmptyMembersBox&&(u.annotations.length>0?G=$-s:G=$),l||(G-=4);let F=w;(B.attr("class").includes("label-group")||B.attr("class").includes("annotation-group"))&&(F=-B.node()?.getBBox().width/2||0,h.selectAll("text").each(function(V,H,j){window.getComputedStyle(j[H]).textAnchor==="middle"&&(F=0)})),B.attr("transform",`translate(${F}, ${G})`)}),u.members.length>0||u.methods.length>0||g){let R=P+I+C+a,M=y.line(N.x,R,N.x+N.width,R+.001,v);h.insert(()=>M).attr("class",`divider${t.look==="neo"&&!n?" neo-line":""}`).attr("style",m)}if(g||u.members.length>0||u.methods.length>0){let R=P+I+D+C+s*2+a,M=y.line(N.x,T?Math.max(_,R):R,N.x+N.width,(T?Math.max(_,R):R)+.001,v);h.insert(()=>M).attr("class",`divider${t.look==="neo"&&!n?" neo-line":""}`).attr("style",m)}if(u.look!=="handDrawn"&&h.selectAll("path").attr("style",m),A.select(":nth-child(2)").attr("style",m),h.selectAll(".divider").select("path").attr("style",m),t.labelStyle?h.selectAll("span").attr("style",t.labelStyle):h.selectAll("span").attr("style",m),!l){let R=RegExp(/color\s*:\s*([^;]*)/),M=R.exec(m);if(M){let L=M[0].replace("color","fill");h.selectAll("tspan").attr("style",L)}else if(f){let L=R.exec(f);if(L){let B=L[0].replace("color","fill");h.selectAll("tspan").attr("style",B)}}}return ft(t,A),t.intersect=function(R){return lt.rect(t,R)},h}var vae=z(()=>{"use strict";Wt();Ut();Rr();jt();Ht();Kt();gae();Ir();o(yae,"classBox")});async function xae(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let n=t,a=t,s=20,l=20,u="verifyMethod"in t,h=Ct(t),{themeVariables:d}=ge(),{borderColorArray:f,requirementEdgeLabelBackground:p}=d,m=e.insert("g").attr("class",h).attr("id",t.domId??t.id),g;u?g=await $u(m,`<<${n.type}>>`,0,t.labelStyle):g=await $u(m,"<<Element>>",0,t.labelStyle);let y=g,v=await $u(m,n.name,y,t.labelStyle+"; font-weight: bold;");if(y+=v+l,u){let N=await $u(m,`${n.requirementId?`ID: ${n.requirementId}`:""}`,y,t.labelStyle);y+=N;let P=await $u(m,`${n.text?`Text: ${n.text}`:""}`,y,t.labelStyle);y+=P;let I=await $u(m,`${n.risk?`Risk: ${n.risk}`:""}`,y,t.labelStyle);y+=I,await $u(m,`${n.verifyMethod?`Verification: ${n.verifyMethod}`:""}`,y,t.labelStyle)}else{let N=await $u(m,`${a.type?`Type: ${a.type}`:""}`,y,t.labelStyle);y+=N,await $u(m,`${a.docRef?`Doc Ref: ${a.docRef}`:""}`,y,t.labelStyle)}let x=(m.node()?.getBBox().width??200)+s,b=(m.node()?.getBBox().height??200)+s,T=-x/2,w=-b/2,C=ut.svg(m),k=mt(t,{});t.look!=="handDrawn"&&(k.roughness=0,k.fillStyle="solid");let E=C.rectangle(T,w,x,b,k),A=m.insert(()=>E,":first-child");if(A.attr("class","basic label-container outer-path").attr("style",i),f?.length){let N=t.colorIndex??0;m.attr("data-color-id",`color-${N%f.length}`)}if(m.selectAll(".label").each((N,P,I)=>{let D=Je(I[P]),_=D.attr("transform"),R=0,M=0;if(_){let $=RegExp(/translate\(([^,]+),([^)]+)\)/).exec(_);$&&(R=parseFloat($[1]),M=parseFloat($[2]))}let L=M-b/2,B=T+s/2;(P===0||P===1)&&(B=R),D.attr("transform",`translate(${B}, ${L+s})`)}),y>g+v+l){let N=w+g+v+l,P;if(t.look==="neo"){let _=[[T,N],[T+x,N],[T+x,N+.001],[T,N+.001]];P=C.polygon(_,k)}else P=C.line(T,N,T+x,N,k);m.insert(()=>P).attr("class","divider")}return ft(t,A),t.intersect=function(N){return lt.rect(t,N)},i&&t.look!=="handDrawn"&&(p||f?.length)&&m.selectAll("path").attr("style",i),m}async function $u(e,t,r,i=""){if(t==="")return 0;let n=e.insert("g").attr("class","label").attr("style",i),a=ge(),s=a.htmlLabels??!0,l=await wi(n,Ev(Qa(t)),{width:ta(t,a)+50,classes:"markdown-node-label",useHtmlLabels:s,style:i},a),u;if(s){let h=l.children[0],d=Je(l);u=h.getBoundingClientRect(),d.attr("width",u.width),d.attr("height",u.height)}else{let h=l.children[0];for(let d of h.children)i&&d.setAttribute("style",i);u=l.getBBox(),u.height+=6}return n.attr("transform",`translate(${-u.width/2},${-u.height/2+r})`),u.height}var bae=z(()=>{"use strict";Wt();Kt();Ht();jt();Xt();Ut();_s();Rr();o(xae,"requirementBox");o($u,"addText")});async function Tae(e,t,{config:r}){let{labelStyles:i,nodeStyles:n}=ct(t);t.labelStyle=i||"";let a=10,s=t.width;t.width=(t.width??200)-10;let{shapeSvg:l,bbox:u,label:h}=await At(e,t,Ct(t)),d=t.padding||10,f="",p;"ticket"in t&&t.ticket&&r?.kanban?.ticketBaseUrl&&(f=r?.kanban?.ticketBaseUrl.replace("#TICKET#",t.ticket),p=l.insert("svg:a",":first-child").attr("class","kanban-ticket-link").attr("xlink:href",f).attr("target","_blank"));let m={useHtmlLabels:t.useHtmlLabels,labelStyle:t.labelStyle||"",width:t.width,img:t.img,padding:t.padding||8,centerLabel:!1},g,y;p?{label:g,bbox:y}=await A4(p,"ticket"in t&&t.ticket||"",m):{label:g,bbox:y}=await A4(l,"ticket"in t&&t.ticket||"",m);let{label:v,bbox:x}=await A4(l,"assigned"in t&&t.assigned||"",m);t.width=s;let b=10,T=t?.width||0,w=Math.max(y.height,x.height)/2,C=Math.max(u.height+b*2,t?.height||0)+w,k=-T/2,E=-C/2;h.attr("transform","translate("+(d-T/2)+", "+(-w-u.height/2)+")"),g.attr("transform","translate("+(d-T/2)+", "+(-w+u.height/2)+")"),v.attr("transform","translate("+(d+T/2-x.width-2*a)+", "+(-w+u.height/2)+")");let A,{rx:N,ry:P}=t,{cssStyles:I}=t;if(t.look==="handDrawn"){let D=ut.svg(l),_=mt(t,{}),R=N||P?D.path(Rs(k,E,T,C,N||0),_):D.rectangle(k,E,T,C,_);A=l.insert(()=>R,":first-child"),A.attr("class","basic label-container").attr("style",I||null)}else{A=l.insert("rect",":first-child"),A.attr("class","basic label-container __APA__").attr("style",n).attr("rx",N??5).attr("ry",P??5).attr("x",k).attr("y",E).attr("width",T).attr("height",C);let D="priority"in t&&t.priority;if(D){let _=l.append("line"),R=k+2,M=E+Math.floor((N??0)/2),L=E+C-Math.floor((N??0)/2);_.attr("x1",R).attr("y1",M).attr("x2",R).attr("y2",L).attr("stroke-width","4").attr("stroke",Bqe(D))}}return ft(t,A),t.height=C,t.intersect=function(D){return lt.rect(t,D)},l}var Bqe,Cae=z(()=>{"use strict";Wt();Kt();_p();Ht();jt();Bqe=o(e=>{switch(e){case"Very High":return"red";case"High":return"orange";case"Medium":return null;case"Low":return"blue";case"Very Low":return"lightblue"}},"colorFromPriority");o(Tae,"kanbanItem")});async function kae(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let{shapeSvg:n,bbox:a,halfPadding:s,label:l}=await At(e,t,Ct(t)),u=a.width+10*s,h=a.height+8*s,d=.15*u,{cssStyles:f}=t,p=a.width+20,m=a.height+20,g=Math.max(u,p),y=Math.max(h,m);l.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`);let v,x=`M0 0 + a${d},${d} 1 0,0 ${g*.25},${-1*y*.1} + a${d},${d} 1 0,0 ${g*.25},0 + a${d},${d} 1 0,0 ${g*.25},0 + a${d},${d} 1 0,0 ${g*.25},${y*.1} + + a${d},${d} 1 0,0 ${g*.15},${y*.33} + a${d*.8},${d*.8} 1 0,0 0,${y*.34} + a${d},${d} 1 0,0 ${-1*g*.15},${y*.33} + + a${d},${d} 1 0,0 ${-1*g*.25},${y*.15} + a${d},${d} 1 0,0 ${-1*g*.25},0 + a${d},${d} 1 0,0 ${-1*g*.25},0 + a${d},${d} 1 0,0 ${-1*g*.25},${-1*y*.15} + + a${d},${d} 1 0,0 ${-1*g*.1},${-1*y*.33} + a${d*.8},${d*.8} 1 0,0 0,${-1*y*.34} + a${d},${d} 1 0,0 ${g*.1},${-1*y*.33} + H0 V0 Z`;if(t.look==="handDrawn"){let b=ut.svg(n),T=mt(t,{}),w=b.path(x,T);v=n.insert(()=>w,":first-child"),v.attr("class","basic label-container").attr("style",ii(f))}else v=n.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",x);return v.attr("transform",`translate(${-g/2}, ${-y/2})`),ft(t,v),t.calcIntersect=function(b,T){return lt.rect(b,T)},t.intersect=function(b){return Z.info("Bang intersect",t,b),lt.rect(t,b)},n}var wae=z(()=>{"use strict";St();Wt();Kt();Ht();jt();Xt();o(kae,"bang")});async function Sae(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let{shapeSvg:n,bbox:a,halfPadding:s,label:l}=await At(e,t,Ct(t)),u=a.width+2*s,h=a.height+2*s,d=.15*u,f=.25*u,p=.35*u,m=.2*u,{cssStyles:g}=t,y,v=`M0 0 + a${d},${d} 0 0,1 ${u*.25},${-1*u*.1} + a${p},${p} 1 0,1 ${u*.4},${-1*u*.1} + a${f},${f} 1 0,1 ${u*.35},${u*.2} + + a${d},${d} 1 0,1 ${u*.15},${h*.35} + a${m},${m} 1 0,1 ${-1*u*.15},${h*.65} + + a${f},${d} 1 0,1 ${-1*u*.25},${u*.15} + a${p},${p} 1 0,1 ${-1*u*.5},0 + a${d},${d} 1 0,1 ${-1*u*.25},${-1*u*.15} + + a${d},${d} 1 0,1 ${-1*u*.1},${-1*h*.35} + a${m},${m} 1 0,1 ${u*.1},${-1*h*.65} + H0 V0 Z`;if(t.look==="handDrawn"){let x=ut.svg(n),b=mt(t,{}),T=x.path(v,b);y=n.insert(()=>T,":first-child"),y.attr("class","basic label-container").attr("style",ii(g))}else y=n.insert("path",":first-child").attr("class","basic label-container").attr("style",i).attr("d",v);return l.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`),y.attr("transform",`translate(${-u/2}, ${-h/2})`),ft(t,y),t.calcIntersect=function(x,b){return lt.rect(x,b)},t.intersect=function(x){return Z.info("Cloud intersect",t,x),lt.rect(t,x)},n}var Eae=z(()=>{"use strict";jt();St();Xt();Kt();Ht();Wt();o(Sae,"cloud")});async function Aae(e,t){let{labelStyles:r,nodeStyles:i}=ct(t);t.labelStyle=r;let{shapeSvg:n,bbox:a,halfPadding:s,label:l}=await At(e,t,Ct(t)),u=a.width+8*s,h=a.height+2*s,d=5,f=t.look==="neo"?` + M${-u/2} ${h/2-d} + v${-h+2*d} + q0,-${d} ${d},-${d} + h${u-2*d} + q${d},0 ${d},${d} + v${h-d} + H${-u/2} + Z + `:` + M${-u/2} ${h/2-d} + v${-h+2*d} + q0,-${d} ${d},-${d} + h${u-2*d} + q${d},0 ${d},${d} + v${h-2*d} + q0,${d} ${-d},${d} + h${-(u-2*d)} + q${-d},0 ${-d},${-d} + Z + `;if(!t.domId)throw new Error(`defaultMindmapNode: node "${t.id}" is missing a domId \u2014 was render.ts domId prefixing skipped?`);let p=n.append("path").attr("id",t.domId).attr("class","node-bkg node-"+t.type).attr("style",i).attr("d",f);return n.append("line").attr("class","node-line-").attr("x1",-u/2).attr("y1",h/2).attr("x2",u/2).attr("y2",h/2),l.attr("transform",`translate(${-a.width/2}, ${-a.height/2})`),n.append(()=>l.node()),ft(t,p),t.calcIntersect=function(m,g){return lt.rect(m,g)},t.intersect=function(m){return lt.rect(t,m)},n}var _ae=z(()=>{"use strict";Kt();Ht();Wt();o(Aae,"defaultMindmapNode")});async function Dae(e,t){let r={padding:t.padding??0};return $4(e,t,r)}var Rae=z(()=>{"use strict";RN();o(Dae,"mindmapCircle")});function Lae(e){return e in NN}var Fqe,$qe,NN,IN=z(()=>{"use strict";Jre();rie();nie();sie();RN();lie();uie();die();pie();gie();bie();Cie();wie();Eie();_ie();Mie();Iie();Pie();Fie();zie();Vie();qie();Hie();jie();Kie();Qie();ene();rne();nne();sne();une();dne();pne();gne();vne();bne();Cne();wne();Ene();_ne();Rne();Mne();Ine();Pne();Fne();zne();Vne();qne();Hne();jne();Qne();eae();rae();sae();lae();uae();dae();pae();vae();bae();Cae();wae();Eae();_ae();Rae();Fqe=[{semanticName:"Process",name:"Rectangle",shortName:"rect",description:"Standard process shape",aliases:["proc","process","rectangle"],internalAliases:["squareRect"],handler:Lne},{semanticName:"Event",name:"Rounded Rectangle",shortName:"rounded",description:"Represents an event",aliases:["event"],internalAliases:["roundedRect"],handler:Sne},{semanticName:"Terminal Point",name:"Stadium",shortName:"stadium",description:"Terminal point",aliases:["terminal","pill"],handler:Nne},{semanticName:"Subprocess",name:"Framed Rectangle",shortName:"fr-rect",description:"Subprocess",aliases:["subprocess","subproc","framed-rectangle","subroutine"],handler:Gne},{semanticName:"Database",name:"Cylinder",shortName:"cyl",description:"Database storage",aliases:["db","database","cylinder"],handler:xie},{semanticName:"Data Store",name:"Data Store",shortName:"datastore",description:"Data flow diagram data store",aliases:["data-store"],handler:Tie},{semanticName:"Start",name:"Circle",shortName:"circle",description:"Starting point",aliases:["circ"],handler:$4},{semanticName:"Bang",name:"Bang",shortName:"bang",description:"Bang",aliases:["bang"],handler:kae},{semanticName:"Cloud",name:"Cloud",shortName:"cloud",description:"cloud",aliases:["cloud"],handler:Sae},{semanticName:"Decision",name:"Diamond",shortName:"diam",description:"Decision-making step",aliases:["decision","diamond","question"],handler:xne},{semanticName:"Prepare Conditional",name:"Hexagon",shortName:"hex",description:"Preparation or condition step",aliases:["hexagon","prepare"],handler:Bie},{semanticName:"Data Input/Output",name:"Lean Right",shortName:"lean-r",description:"Represents input or output",aliases:["lean-right","in-out"],internalAliases:["lean_right"],handler:ine},{semanticName:"Data Input/Output",name:"Lean Left",shortName:"lean-l",description:"Represents output or input",aliases:["lean-left","out-in"],internalAliases:["lean_left"],handler:tne},{semanticName:"Priority Action",name:"Trapezoid Base Bottom",shortName:"trap-b",description:"Priority action",aliases:["priority","trapezoid-bottom","trapezoid"],handler:Jne},{semanticName:"Manual Operation",name:"Trapezoid Base Top",shortName:"trap-t",description:"Represents a manual task",aliases:["manual","trapezoid-top","inv-trapezoid"],internalAliases:["inv_trapezoid"],handler:Zie},{semanticName:"Stop",name:"Double Circle",shortName:"dbl-circ",description:"Represents a stop point",aliases:["double-circle"],internalAliases:["doublecircle"],handler:Sie},{semanticName:"Text Block",name:"Text Block",shortName:"text",description:"Text block",handler:Yne},{semanticName:"Card",name:"Notched Rectangle",shortName:"notch-rect",description:"Represents a card",aliases:["card","notched-rectangle"],handler:iie},{semanticName:"Lined/Shaded Process",name:"Lined Rectangle",shortName:"lin-rect",description:"Lined process shape",aliases:["lined-rectangle","lined-process","lin-proc","shaded-process"],handler:Ane},{semanticName:"Start",name:"Small Circle",shortName:"sm-circ",description:"Small starting point",aliases:["start","small-circle"],internalAliases:["stateStart"],handler:$ne},{semanticName:"Stop",name:"Framed Circle",shortName:"fr-circ",description:"Stop point",aliases:["stop","framed-circle"],internalAliases:["stateEnd"],handler:Bne},{semanticName:"Fork/Join",name:"Filled Rectangle",shortName:"fork",description:"Fork or join in process flow",aliases:["join"],internalAliases:["forkJoin"],handler:Nie},{semanticName:"Collate",name:"Hourglass",shortName:"hourglass",description:"Represents a collate operation",aliases:["hourglass","collate"],handler:$ie},{semanticName:"Comment",name:"Curly Brace",shortName:"brace",description:"Adds a comment",aliases:["comment","brace-l"],handler:cie},{semanticName:"Comment Right",name:"Curly Brace",shortName:"brace-r",description:"Adds a comment",handler:hie},{semanticName:"Comment with braces on both sides",name:"Curly Braces",shortName:"braces",description:"Adds a comment",handler:fie},{semanticName:"Com Link",name:"Lightning Bolt",shortName:"bolt",description:"Communication link",aliases:["com-link","lightning-bolt"],handler:ane},{semanticName:"Document",name:"Document",shortName:"doc",description:"Represents a document",aliases:["doc","document"],handler:oae},{semanticName:"Delay",name:"Half-Rounded Rectangle",shortName:"delay",description:"Represents a delay",aliases:["half-rounded-rectangle"],handler:Oie},{semanticName:"Direct Access Storage",name:"Horizontal Cylinder",shortName:"h-cyl",description:"Direct access storage",aliases:["das","horizontal-cylinder"],handler:Zne},{semanticName:"Disk Storage",name:"Lined Cylinder",shortName:"lin-cyl",description:"Disk storage",aliases:["disk","lined-cylinder"],handler:cne},{semanticName:"Display",name:"Curved Trapezoid",shortName:"curv-trap",description:"Represents a display",aliases:["curved-trapezoid","display"],handler:mie},{semanticName:"Divided Process",name:"Divided Rectangle",shortName:"div-rect",description:"Divided process shape",aliases:["div-proc","divided-rectangle","divided-process"],handler:kie},{semanticName:"Extract",name:"Triangle",shortName:"tri",description:"Extraction process",aliases:["extract","triangle"],handler:aae},{semanticName:"Internal Storage",name:"Window Pane",shortName:"win-pane",description:"Internal storage",aliases:["internal-storage","window-pane"],handler:hae},{semanticName:"Junction",name:"Filled Circle",shortName:"f-circ",description:"Junction point",aliases:["junction","filled-circle"],handler:Aie},{semanticName:"Loop Limit",name:"Trapezoidal Pentagon",shortName:"notch-pent",description:"Loop limit step",aliases:["loop-limit","notched-pentagon"],handler:tae},{semanticName:"Manual File",name:"Flipped Triangle",shortName:"flip-tri",description:"Manual file operation",aliases:["manual-file","flipped-triangle"],handler:Lie},{semanticName:"Manual Input",name:"Sloped Rectangle",shortName:"sl-rect",description:"Manual input step",aliases:["manual-input","sloped-rectangle"],handler:Dne},{semanticName:"Multi-Document",name:"Stacked Document",shortName:"docs",description:"Multiple documents",aliases:["documents","st-doc","stacked-document"],handler:mne},{semanticName:"Multi-Process",name:"Stacked Rectangle",shortName:"st-rect",description:"Multiple processes",aliases:["procs","processes","stacked-rectangle"],handler:fne},{semanticName:"Stored Data",name:"Bow Tie Rectangle",shortName:"bow-rect",description:"Stored data",aliases:["stored-data","bow-tie-rectangle"],handler:tie},{semanticName:"Summary",name:"Crossed Circle",shortName:"cross-circ",description:"Summary",aliases:["summary","crossed-circle"],handler:oie},{semanticName:"Tagged Document",name:"Tagged Document",shortName:"tag-doc",description:"Tagged document",aliases:["tag-doc","tagged-document"],handler:Une},{semanticName:"Tagged Process",name:"Tagged Rectangle",shortName:"tag-rect",description:"Tagged process",aliases:["tagged-rectangle","tag-proc","tagged-process"],handler:Wne},{semanticName:"Paper Tape",name:"Flag",shortName:"flag",description:"Paper tape",aliases:["paper-tape"],handler:cae},{semanticName:"Odd",name:"Odd",shortName:"odd",description:"Odd shape",internalAliases:["rect_left_inv_arrow"],handler:Tne},{semanticName:"Lined Document",name:"Lined Document",shortName:"lin-doc",description:"Lined document",aliases:["lined-document"],handler:hne}],$qe=o(()=>{let t=[...Object.entries({state:One,choice:aie,note:yne,rectWithTitle:kne,labelRect:Jie,iconSquare:Yie,iconCircle:Wie,icon:Gie,iconRounded:Uie,imageSquare:Xie,anchor:Qre,kanbanItem:Tae,mindmapCircle:Dae,defaultMindmapNode:Aae,classBox:yae,erBox:MN,requirementBox:xae}),...Fqe.flatMap(r=>[r.shortName,..."aliases"in r?r.aliases:[],..."internalAliases"in r?r.internalAliases:[]].map(n=>[n,r.handler]))];return Object.fromEntries(t)},"generateShapeMap"),NN=$qe();o(Lae,"isValidShape")});var zqe,V4,Mae=z(()=>{"use strict";Rr();Wx();Ut();St();IN();Xt();Ir();Ci();gp();uv();zqe="flowchart-",V4=class{constructor(){this.vertexCounter=0;this.config=ge();this.diagramId="";this.vertices=new Map;this.edges=[];this.classes=new Map;this.subGraphs=[];this.subGraphLookup=new Map;this.tooltips=new Map;this.subCount=0;this.firstGraphFlag=!0;this.secCount=-1;this.posCrossRef=[];this.funs=[];this.setAccTitle=Cr;this.setAccDescription=wr;this.setDiagramTitle=Ar;this.getAccTitle=kr;this.getAccDescription=Sr;this.getDiagramTitle=Er;this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{o(this,"FlowDB")}sanitizeText(t){return vt.sanitizeText(t,this.config)}sanitizeNodeLabelType(t){switch(t){case"markdown":case"string":case"text":return t;default:return"markdown"}}setDiagramId(t){this.diagramId=t}lookUpDomId(t){for(let r of this.vertices.values())if(r.id===t)return this.diagramId?`${this.diagramId}-${r.domId}`:r.domId;return this.diagramId?`${this.diagramId}-${t}`:t}addVertex(t,r,i,n,a,s,l={},u){if(!t||t.trim().length===0)return;let h;if(u!==void 0){let m;u.includes(` +`)?m=u+` +`:m=`{ +`+u+` +}`,h=ld(m,{schema:od})}let d=this.edges.find(m=>m.id===t);if(d){let m=h;m?.animate!==void 0&&(d.animate=m.animate),m?.animation!==void 0&&(d.animation=m.animation),m?.curve!==void 0&&(d.interpolate=m.curve);return}let f,p=this.vertices.get(t);if(p===void 0&&(r===void 0&&i===void 0&&n!==void 0&&n!==null&&Z.warn(`Style applied to unknown node "${t}". This may indicate a typo. The node will be created automatically.`),p={id:t,labelType:"text",domId:zqe+t+"-"+this.vertexCounter,styles:[],classes:[]},this.vertices.set(t,p)),this.vertexCounter++,r!==void 0?(this.config=ge(),f=this.sanitizeText(r.text.trim()),p.labelType=r.type,f.startsWith('"')&&f.endsWith('"')&&(f=f.substring(1,f.length-1)),p.text=f):p.text===void 0&&(p.text=t),i!==void 0&&(p.type=i),n?.forEach(m=>{p.styles.push(m)}),a?.forEach(m=>{p.classes.push(m)}),s!==void 0&&(p.dir=s),p.props===void 0?p.props=l:l!==void 0&&Object.assign(p.props,l),h!==void 0){if(h.shape){if(h.shape!==h.shape.toLowerCase()||h.shape.includes("_"))throw new Error(`No such shape: ${h.shape}. Shape names should be lowercase.`);if(!Lae(h.shape))throw new Error(`No such shape: ${h.shape}.`);p.type=h?.shape}h?.label&&(p.text=h?.label,p.labelType=this.sanitizeNodeLabelType(h?.labelType)),h?.icon&&(p.icon=h?.icon,!h.label?.trim()&&p.text===t&&(p.text="")),h?.form&&(p.form=h?.form),h?.pos&&(p.pos=h?.pos),h?.img&&(p.img=h?.img,!h.label?.trim()&&p.text===t&&(p.text="")),h?.constraint&&(p.constraint=h.constraint),h.w&&(p.assetWidth=Number(h.w)),h.h&&(p.assetHeight=Number(h.h))}}addSingleLink(t,r,i,n){let l={start:t,end:r,type:void 0,text:"",labelType:"text",classes:[],isUserDefinedId:!1,interpolate:this.edges.defaultInterpolate};Z.info("abc78 Got edge...",l);let u=i.text;if(u!==void 0&&(l.text=this.sanitizeText(u.text.trim()),l.text.startsWith('"')&&l.text.endsWith('"')&&(l.text=l.text.substring(1,l.text.length-1)),l.labelType=this.sanitizeNodeLabelType(u.type)),i!==void 0&&(l.type=i.type,l.stroke=i.stroke,l.length=i.length>10?10:i.length),n&&!this.edges.some(h=>h.id===n))l.id=n,l.isUserDefinedId=!0;else{let h=this.edges.filter(d=>d.start===l.start&&d.end===l.end);h.length===0?l.id=bc(l.start,l.end,{counter:0,prefix:"L"}):l.id=bc(l.start,l.end,{counter:h.length+1,prefix:"L"})}if(this.edges.length<(this.config.maxEdges??500))Z.info("Pushing edge..."),this.edges.push(l);else throw new Error(`Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}. + +Initialize mermaid with maxEdges set to a higher number to allow more edges. +You cannot set this config via configuration inside the diagram as it is a secure config. +You have to call mermaid.initialize.`)}isLinkData(t){return t!==null&&typeof t=="object"&&"id"in t&&typeof t.id=="string"}addLink(t,r,i){let n=this.isLinkData(i)?i.id.replace("@",""):void 0;Z.info("addLink",t,r,n);for(let a of t)for(let s of r){let l=a===t[t.length-1],u=s===r[0];l&&u?this.addSingleLink(a,s,i,n):this.addSingleLink(a,s,i,void 0)}}updateLinkInterpolate(t,r){t.forEach(i=>{i==="default"?this.edges.defaultInterpolate=r:this.edges[i].interpolate=r})}updateLink(t,r){t.forEach(i=>{if(typeof i=="number"&&i>=this.edges.length)throw new Error(`The index ${i} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`);i==="default"?this.edges.defaultStyle=r:(this.edges[i].style=r,(this.edges[i]?.style?.length??0)>0&&!this.edges[i]?.style?.some(n=>n?.startsWith("fill"))&&this.edges[i]?.style?.push("fill:none"))})}addClass(t,r){let i=r.join().replace(/\\,/g,"\xA7\xA7\xA7").replace(/,/g,";").replace(/§§§/g,",").split(";");t.split(",").forEach(n=>{let a=this.classes.get(n);a===void 0&&(a={id:n,styles:[],textStyles:[]},this.classes.set(n,a)),i?.forEach(s=>{if(/color/.exec(s)){let l=s.replace("fill","bgFill");a.textStyles.push(l)}a.styles.push(s)})})}setDirection(t){this.direction=t.trim(),/.*/.exec(this.direction)&&(this.direction="LR"),/.*v/.exec(this.direction)&&(this.direction="TB"),this.direction==="TD"&&(this.direction="TB")}setClass(t,r){for(let i of t.split(",")){let n=this.vertices.get(i);n&&n.classes.push(r);let a=this.edges.find(l=>l.id===i);a&&a.classes.push(r);let s=this.subGraphLookup.get(i);s&&s.classes.push(r)}}setTooltip(t,r){if(r!==void 0){r=this.sanitizeText(r);for(let i of t.split(","))this.tooltips.set(this.version==="gen-1"?this.lookUpDomId(i):i,r)}}setClickFun(t,r,i){if(ge().securityLevel!=="loose"||r===void 0)return;let n=[];if(typeof i=="string"){n=i.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let s=0;s{let s=this.lookUpDomId(t),l=document.querySelector(`[id="${s}"]`);l!==null&&l.addEventListener("click",()=>{Zt.runFunc(r,...n)},!1)}))}setLink(t,r,i){t.split(",").forEach(n=>{let a=this.vertices.get(n);a!==void 0&&(a.link=Zt.formatUrl(r,this.config),a.linkTarget=i)}),this.setClass(t,"clickable")}getTooltip(t){return this.tooltips.get(t)}setClickEvent(t,r,i){t.split(",").forEach(n=>{this.setClickFun(n,r,i)}),this.setClass(t,"clickable")}bindFunctions(t){this.funs.forEach(r=>{r(t)})}getDirection(){return this.direction?.trim()}getVertices(){return this.vertices}getEdges(){return this.edges}getClasses(){return this.classes}setupToolTips(t){let r=zw();Je(t).select("svg").selectAll("g.node").on("mouseover",a=>{let s=Je(a.currentTarget),l=s.attr("title");if(l===null)return;let u=a.currentTarget?.getBoundingClientRect();r.transition().duration(200).style("opacity",".9"),r.text(s.attr("title")).style("left",window.scrollX+u.left+(u.right-u.left)/2+"px").style("top",window.scrollY+u.bottom+"px"),r.html(Ro.sanitize(l)),s.classed("hover",!0)}).on("mouseout",a=>{r.transition().duration(500).style("opacity",0),Je(a.currentTarget).classed("hover",!1)})}clear(t="gen-2"){this.vertices=new Map,this.classes=new Map,this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.diagramId="",this.subGraphs=[],this.subGraphLookup=new Map,this.subCount=0,this.tooltips=new Map,this.firstGraphFlag=!0,this.version=t,this.config=ge(),gr()}setGen(t){this.version=t||"gen-2"}defaultStyle(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}addSubGraph(t,r,i){let n=t.text.trim(),a=i.text;t===i&&/\s/.exec(i.text)&&(n=void 0);let l=o(p=>{let m={boolean:{},number:{},string:{}},g=[],y;return{nodeList:p.filter(function(x){let b=typeof x;return x.stmt&&x.stmt==="dir"?(y=x.value,!1):x.trim()===""?!1:b in m?m[b].hasOwnProperty(x)?!1:m[b][x]=!0:g.includes(x)?!1:g.push(x)}),dir:y}},"uniq")(r.flat()),u=l.nodeList,h=l.dir,d=ge().flowchart??{};if(h=h??(d.inheritDir?this.getDirection()??ge().direction??void 0:void 0),this.version==="gen-1")for(let p=0;p2e3)return{result:!1,count:0};if(this.posCrossRef[this.secCount]=r,this.subGraphs[r].id===t)return{result:!0,count:0};let n=0,a=1;for(;n=0){let l=this.indexNodes2(t,s);if(l.result)return{result:!0,count:a+l.count};a=a+l.count}n=n+1}return{result:!1,count:a}}getDepthFirstPos(t){return this.posCrossRef[t]}indexNodes(){this.secCount=-1,this.subGraphs.length>0&&this.indexNodes2("none",this.subGraphs.length-1)}getSubGraphs(){return this.subGraphs}firstGraph(){return this.firstGraphFlag?(this.firstGraphFlag=!1,!0):!1}destructStartLink(t){let r=t.trim(),i="arrow_open";switch(r[0]){case"<":i="arrow_point",r=r.slice(1);break;case"x":i="arrow_cross",r=r.slice(1);break;case"o":i="arrow_circle",r=r.slice(1);break}let n="normal";return r.includes("=")&&(n="thick"),r.includes(".")&&(n="dotted"),{type:i,stroke:n}}countChar(t,r){let i=r.length,n=0;for(let a=0;a":n="arrow_point",r.startsWith("<")&&(n="double_"+n,i=i.slice(1));break;case"o":n="arrow_circle",r.startsWith("o")&&(n="double_"+n,i=i.slice(1));break}let a="normal",s=i.length-1;i.startsWith("=")&&(a="thick"),i.startsWith("~")&&(a="invisible");let l=this.countChar(".",i);return l&&(a="dotted",s=l),{type:n,stroke:a,length:s}}destructLink(t,r){let i=this.destructEndLink(t),n;if(r){if(n=this.destructStartLink(r),n.stroke!==i.stroke)return{type:"INVALID",stroke:"INVALID"};if(n.type==="arrow_open")n.type=i.type;else{if(n.type!==i.type)return{type:"INVALID",stroke:"INVALID"};n.type="double_"+n.type}return n.type==="double_arrow"&&(n.type="double_arrow_point"),n.length=i.length,n}return i}exists(t,r){for(let i of t)if(i.nodes.includes(r))return!0;return!1}makeUniq(t,r){let i=[];return t.nodes.forEach((n,a)=>{this.exists(r,n)||i.push(t.nodes[a])}),{nodes:i}}getTypeFromVertex(t){if(t.img)return"imageSquare";if(t.icon)return t.form==="circle"?"iconCircle":t.form==="square"?"iconSquare":t.form==="rounded"?"iconRounded":"icon";switch(t.type){case"square":case void 0:return"squareRect";case"round":return"roundedRect";case"ellipse":return"ellipse";default:return t.type}}findNode(t,r){return t.find(i=>i.id===r)}destructEdgeType(t){let r="none",i="arrow_point";switch(t){case"arrow_point":case"arrow_circle":case"arrow_cross":i=t;break;case"double_arrow_point":case"double_arrow_circle":case"double_arrow_cross":r=t.replace("double_",""),i=r;break}return{arrowTypeStart:r,arrowTypeEnd:i}}addNodeFromVertex(t,r,i,n,a,s){let l=i.get(t.id),u=n.get(t.id)??!1,h=this.findNode(r,t.id);if(h)h.cssStyles=t.styles,h.cssCompiledStyles=this.getCompiledStyles(t.classes),h.cssClasses=t.classes.join(" ");else{let d={id:t.id,label:t.text,labelType:t.labelType,labelStyle:"",parentId:l,padding:a.flowchart?.padding||8,cssStyles:t.styles,cssCompiledStyles:this.getCompiledStyles(["default","node",...t.classes]),cssClasses:"default "+t.classes.join(" "),dir:t.dir,domId:t.domId,look:s,link:t.link,linkTarget:t.linkTarget,tooltip:this.getTooltip(t.id),icon:t.icon,pos:t.pos,img:t.img,assetWidth:t.assetWidth,assetHeight:t.assetHeight,constraint:t.constraint};u?r.push({...d,isGroup:!0,shape:"rect"}):r.push({...d,isGroup:!1,shape:this.getTypeFromVertex(t)})}}getCompiledStyles(t){let r=[];for(let i of t){let n=this.classes.get(i);n?.styles&&(r=[...r,...n.styles??[]].map(a=>a.trim())),n?.textStyles&&(r=[...r,...n.textStyles??[]].map(a=>a.trim()))}return r}getData(){let t=ge(),r=[],i=[],n=this.getSubGraphs(),a=new Map,s=new Map;for(let h=n.length-1;h>=0;h--){let d=n[h];d.nodes.length>0&&s.set(d.id,!0);for(let f of d.nodes)a.set(f,d.id)}for(let h=n.length-1;h>=0;h--){let d=n[h];r.push({id:d.id,label:d.title,labelStyle:"",labelType:d.labelType,parentId:a.get(d.id),padding:8,cssCompiledStyles:this.getCompiledStyles(d.classes),cssClasses:d.classes.join(" "),shape:"rect",dir:d.dir,isGroup:!0,look:t.look})}this.getVertices().forEach(h=>{this.addNodeFromVertex(h,r,a,s,t,t.look||"classic")});let u=this.getEdges();return u.forEach((h,d)=>{let{arrowTypeStart:f,arrowTypeEnd:p}=this.destructEdgeType(h.type),m=[...u.defaultStyle??[]];h.style&&m.push(...h.style);let g={id:bc(h.start,h.end,{counter:d,prefix:"L"},h.id),isUserDefinedId:h.isUserDefinedId,start:h.start,end:h.end,type:h.type??"normal",label:h.text,labelType:h.labelType,labelpos:"c",thickness:h.stroke,minlen:h.length,classes:h?.stroke==="invisible"?"":"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:h?.stroke==="invisible"||h?.type==="arrow_open"?"none":f,arrowTypeEnd:h?.stroke==="invisible"||h?.type==="arrow_open"?"none":p,arrowheadStyle:"fill: #333",cssCompiledStyles:this.getCompiledStyles(h.classes),labelStyle:m,style:m,pattern:h.stroke,look:t.look,animate:h.animate,animation:h.animation,curve:h.interpolate||this.edges.defaultInterpolate||t.flowchart?.curve};i.push(g)}),{nodes:r,edges:i,other:{},config:t}}defaultConfig(){return vk.flowchart}}});var Fo,Lp=z(()=>{"use strict";Rr();Fo=o((e,t)=>{let r;return t==="sandbox"&&(r=Je("#i"+e)),(t==="sandbox"?Je(r.nodes()[0].contentDocument.body):Je("body")).select(`[id="${e}"]`)},"getDiagramElement")});var zu,rb=z(()=>{"use strict";zu=o(({flowchart:e})=>{let t=e?.subGraphTitleMargin?.top??0,r=e?.subGraphTitleMargin?.bottom??0,i=t+r;return{subGraphTitleTopMargin:t,subGraphTitleBottomMargin:r,subGraphTitleTotalMargin:i}},"getSubGraphTitleMargins")});var Nae,Gqe,Vqe,Wqe,qqe,Uqe,Hqe,Iae,wg,Oae,W4=z(()=>{"use strict";Ut();br();St();rb();Rr();jt();_s();dN();z4();_p();Ht();Nae=o(async(e,t)=>{Z.info("Creating subgraph rect for ",t.id,t);let r=ge(),{themeVariables:i,handDrawnSeed:n}=r,{clusterBkg:a,clusterBorder:s}=i,{labelStyles:l,nodeStyles:u,borderStyles:h,backgroundStyles:d}=ct(t),f=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),p=Mr(r),m=f.insert("g").attr("class","cluster-label "),g;t.labelType==="markdown"?g=await wi(m,t.label,{style:t.labelStyle,useHtmlLabels:p,isNode:!0,width:t.width}):g=await Nl(m,t.label,t.labelStyle||"",!1,!0);let y=g.getBBox();if(Mr(r)){let E=g.children[0],A=Je(g);y=E.getBoundingClientRect(),A.attr("width",y.width),A.attr("height",y.height)}let v=t.width<=y.width+t.padding?y.width+t.padding:t.width;t.width<=y.width+t.padding?t.diff=(v-t.width)/2-t.padding:t.diff=-t.padding;let x=t.height,b=t.x-v/2,T=t.y-x/2;Z.trace("Data ",t,JSON.stringify(t));let w;if(t.look==="handDrawn"){let E=ut.svg(f),A=mt(t,{roughness:.7,fill:a,stroke:s,fillWeight:3,seed:n}),N=E.path(Rs(b,T,v,x,0),A);w=f.insert(()=>(Z.debug("Rough node insert CXC",N),N),":first-child"),w.select("path:nth-child(2)").attr("style",h.join(";")),w.select("path").attr("style",d.join(";").replace("fill","stroke"))}else w=f.insert("rect",":first-child"),w.attr("style",u).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",T).attr("width",v).attr("height",x);let{subGraphTitleTopMargin:C}=zu(r);if(m.attr("transform",`translate(${t.x-y.width/2}, ${t.y-t.height/2+C})`),l){let E=m.select("span");E&&E.attr("style",l)}let k=w.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=y.height-t.padding/2,t.intersect=function(E){return cd(t,E)},{cluster:f,labelBBox:y}},"rect"),Gqe=o((e,t)=>{let r=e.insert("g").attr("class","note-cluster").attr("id",t.domId),i=r.insert("rect",":first-child"),n=0*t.padding,a=n/2;i.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+n).attr("height",t.height+n).attr("fill","none");let s=i.node().getBBox();return t.width=s.width,t.height=s.height,t.intersect=function(l){return cd(t,l)},{cluster:r,labelBBox:{width:0,height:0}}},"noteGroup"),Vqe=o(async(e,t)=>{let r=ge(),{themeVariables:i,handDrawnSeed:n}=r,{altBackground:a,compositeBackground:s,compositeTitleBackground:l,nodeBorder:u}=i,h=e.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-id",t.id).attr("data-look",t.look),d=h.insert("g",":first-child"),f=h.insert("g").attr("class","cluster-label"),p=h.append("rect"),m=await Nl(f,t.label,t.labelStyle,void 0,!0),g=m.getBBox();if(Mr(r)){let N=m.children[0],P=Je(m);g=N.getBoundingClientRect(),P.attr("width",g.width),P.attr("height",g.height)}let y=0*t.padding,v=y/2,x=(t.width<=g.width+t.padding?g.width+t.padding:t.width)+y;t.width<=g.width+t.padding?t.diff=(x-t.width)/2-t.padding:t.diff=-t.padding;let b=t.height+y,T=t.height+y-g.height-6,w=t.x-x/2,C=t.y-b/2;t.width=x;let k=t.y-t.height/2-v+g.height+2,E;if(t.look==="handDrawn"){let N=t.cssClasses.includes("statediagram-cluster-alt"),P=ut.svg(h),I=t.rx||t.ry?P.path(Rs(w,C,x,b,10),{roughness:.7,fill:l,fillStyle:"solid",stroke:u,seed:n}):P.rectangle(w,C,x,b,{seed:n});E=h.insert(()=>I,":first-child");let D=P.rectangle(w,k,x,T,{fill:N?a:s,fillStyle:N?"hachure":"solid",stroke:u,seed:n});E=h.insert(()=>I,":first-child"),p=h.insert(()=>D)}else E=d.insert("rect",":first-child"),E.attr("class","outer").attr("x",w).attr("y",C).attr("width",x).attr("height",b).attr("data-look",t.look),p.attr("class","inner").attr("x",w).attr("y",k).attr("width",x).attr("height",T);f.attr("transform",`translate(${t.x-g.width/2}, ${C+1-(Mr(r)?0:3)})`);let A=E.node().getBBox();return t.height=A.height,t.offsetX=0,t.offsetY=g.height-t.padding/2,t.labelBBox=g,t.intersect=function(N){return cd(t,N)},{cluster:h,labelBBox:g}},"roundedWithTitle"),Wqe=o(async(e,t)=>{Z.info("Creating subgraph rect for ",t.id,t);let r=ge(),{themeVariables:i,handDrawnSeed:n}=r,{clusterBkg:a,clusterBorder:s}=i,{labelStyles:l,nodeStyles:u,borderStyles:h,backgroundStyles:d}=ct(t),f=e.insert("g").attr("class","cluster "+t.cssClasses).attr("id",t.domId).attr("data-look",t.look),p=Mr(r),m=f.insert("g").attr("class","cluster-label "),g=await wi(m,t.label,{style:t.labelStyle,useHtmlLabels:p,isNode:!0,width:t.width}),y=g.getBBox();if(Mr(r)){let E=g.children[0],A=Je(g);y=E.getBoundingClientRect(),A.attr("width",y.width),A.attr("height",y.height)}let v=t.width<=y.width+t.padding?y.width+t.padding:t.width;t.width<=y.width+t.padding?t.diff=(v-t.width)/2-t.padding:t.diff=-t.padding;let x=t.height,b=t.x-v/2,T=t.y-x/2;Z.trace("Data ",t,JSON.stringify(t));let w;if(t.look==="handDrawn"){let E=ut.svg(f),A=mt(t,{roughness:.7,fill:a,stroke:s,fillWeight:4,seed:n}),N=E.path(Rs(b,T,v,x,t.rx),A);w=f.insert(()=>(Z.debug("Rough node insert CXC",N),N),":first-child"),w.select("path:nth-child(2)").attr("style",h.join(";")),w.select("path").attr("style",d.join(";").replace("fill","stroke"))}else w=f.insert("rect",":first-child"),w.attr("style",u).attr("rx",t.rx).attr("ry",t.ry).attr("x",b).attr("y",T).attr("width",v).attr("height",x);let{subGraphTitleTopMargin:C}=zu(r);if(m.attr("transform",`translate(${t.x-y.width/2}, ${t.y-t.height/2+C})`),l){let E=m.select("span");E&&E.attr("style",l)}let k=w.node().getBBox();return t.offsetX=0,t.width=k.width,t.height=k.height,t.offsetY=y.height-t.padding/2,t.intersect=function(E){return cd(t,E)},{cluster:f,labelBBox:y}},"kanbanSection"),qqe=o((e,t)=>{let r=ge(),{themeVariables:i,handDrawnSeed:n}=r,{nodeBorder:a}=i,s=e.insert("g").attr("class",t.cssClasses).attr("id",t.domId).attr("data-look",t.look),l=s.insert("g",":first-child"),u=0*t.padding,h=t.width+u;t.diff=-t.padding;let d=t.height+u,f=t.x-h/2,p=t.y-d/2;t.width=h;let m;if(t.look==="handDrawn"){let v=ut.svg(s).rectangle(f,p,h,d,{fill:"lightgrey",roughness:.5,strokeLineDash:[5],stroke:a,seed:n});m=s.insert(()=>v,":first-child")}else{m=l.insert("rect",":first-child");let y="outer";t.look,y="divider",m.attr("class",y).attr("x",f).attr("y",p).attr("width",h).attr("height",d).attr("data-look",t.look)}let g=m.node().getBBox();return t.height=g.height,t.offsetX=0,t.offsetY=0,t.intersect=function(y){return cd(t,y)},{cluster:s,labelBBox:{}}},"divider"),Uqe=Nae,Hqe={rect:Nae,squareRect:Uqe,roundedWithTitle:Vqe,noteGroup:Gqe,divider:qqe,kanbanSection:Wqe},Iae=new Map,wg=o(async(e,t)=>{let r=t.shape||"rect",i=await Hqe[r](e,t);return Iae.set(t.id,i),i},"insertCluster"),Oae=o(()=>{Iae=new Map},"clear")});var $o,ON=z(()=>{"use strict";$o=o((e,t)=>{if(t)return"translate("+-e.width/2+", "+-e.height/2+")";let r=e.x??0,i=e.y??0;return"translate("+-(r+e.width/2)+", "+-(i+e.height/2)+")"},"computeLabelTransform")});function q4(e,t){if(e===void 0||t===void 0)return{angle:0,deltaX:0,deltaY:0};e=Ui(e),t=Ui(t);let[r,i]=[e.x,e.y],[n,a]=[t.x,t.y],s=n-r,l=a-i;return{angle:Math.atan(l/s),deltaX:s,deltaY:l}}var pa,PN,Ui,U4,BN=z(()=>{"use strict";pa={aggregation:17.25,extension:17.25,composition:17.25,dependency:6,lollipop:13.5,arrow_point:4,arrow_barb:0,arrow_barb_neo:5.5},PN={arrow_point:4,arrow_cross:12.5,arrow_circle:12.5};o(q4,"calculateDeltaAndAngle");Ui=o(e=>Array.isArray(e)?{x:e[0],y:e[1]}:e,"pointTransformer"),U4=o(e=>({x:o(function(t,r,i){let n=0,a=Ui(i[0]).x=0?1:-1)}else if(r===i.length-1&&Object.hasOwn(pa,e.arrowTypeEnd)){let{angle:m,deltaX:g}=q4(i[i.length-1],i[i.length-2]);n=pa[e.arrowTypeEnd]*Math.cos(m)*(g>=0?1:-1)}let s=Math.abs(Ui(t).x-Ui(i[i.length-1]).x),l=Math.abs(Ui(t).y-Ui(i[i.length-1]).y),u=Math.abs(Ui(t).x-Ui(i[0]).x),h=Math.abs(Ui(t).y-Ui(i[0]).y),d=pa[e.arrowTypeStart],f=pa[e.arrowTypeEnd],p=1;if(s0&&l0&&h=0?1:-1)}else if(r===i.length-1&&Object.hasOwn(pa,e.arrowTypeEnd)){let{angle:m,deltaY:g}=q4(i[i.length-1],i[i.length-2]);n=pa[e.arrowTypeEnd]*Math.abs(Math.sin(m))*(g>=0?1:-1)}let s=Math.abs(Ui(t).y-Ui(i[i.length-1]).y),l=Math.abs(Ui(t).x-Ui(i[i.length-1]).x),u=Math.abs(Ui(t).y-Ui(i[0]).y),h=Math.abs(Ui(t).x-Ui(i[0]).x),d=pa[e.arrowTypeStart],f=pa[e.arrowTypeEnd],p=1;if(s0&&l0&&h{"use strict";St();Bae=o((e,t,r,i,n,a=!1,s)=>{t.arrowTypeStart&&Pae(e,"start",t.arrowTypeStart,r,i,n,a,s),t.arrowTypeEnd&&Pae(e,"end",t.arrowTypeEnd,r,i,n,a,s)},"addEdgeMarkers"),Yqe={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_barb_neo:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},jqe=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],Pae=o((e,t,r,i,n,a,s=!1,l)=>{let u=Yqe[r],h=u&&jqe.includes(u.type);if(!u){Z.warn(`Unknown arrow type: ${r}`);return}let d=u.type,m=`${n}_${a}-${d}${t==="start"?"Start":"End"}${s&&h?"-margin":""}`;if(l&&l.trim()!==""){let g=l.replace(/[^\dA-Za-z]/g,"_"),y=`${m}_${g}`;if(!document.getElementById(y)){let v=document.getElementById(m);if(v){let x=v.cloneNode(!0);x.id=y,x.querySelectorAll("path, circle, line").forEach(T=>{T.setAttribute("stroke",l),u.fill&&T.setAttribute("fill",l)}),v.parentNode?.appendChild(x)}}e.attr(`marker-${t}`,`url(${i}#${y})`)}else e.attr(`marker-${t}`,`url(${i}#${m})`)},"addEdgeMarker")});function H4(e,t){Mr(ge())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}function Qqe(e){let t=[],r=[];for(let i=1;i5&&Math.abs(a.y-n.y)>5||n.y===a.y&&a.x===s.x&&Math.abs(a.x-n.x)>5&&Math.abs(a.y-s.y)>5)&&(t.push(a),r.push(i))}return{cornerPoints:t,cornerPointPositions:r}}function tUe(e,t){if(e.length<2)return"";let r="",i=e.length,n=1e-5;for(let a=0;a({...n}));if(e.length>=2&&pa[t.arrowTypeStart]){let n=pa[t.arrowTypeStart],a=e[0],s=e[1],{angle:l}=Gae(a,s),u=n*Math.cos(l),h=n*Math.sin(l);r[0].x=a.x+u,r[0].y=a.y+h}let i=e.length;if(i>=2&&pa[t.arrowTypeEnd]){let n=pa[t.arrowTypeEnd],a=e[i-1],s=e[i-2],{angle:l}=Gae(s,a),u=n*Math.cos(l),h=n*Math.sin(l);r[i-1].x=a.x-u,r[i-1].y=a.y-h}return r}var Xqe,Y4,ma,Vae,ib,j4,X4,Kqe,Zqe,$ae,zae,Jqe,eUe,K4,FN=z(()=>{"use strict";Ut();br();St();_s();ON();Xt();BN();rb();Rr();jt();z4();Fae();Ht();Xqe=o(e=>typeof e=="string"?e:ge()?.flowchart?.curve,"resolveEdgeCurveType"),Y4=new Map,ma=new Map,Vae=o(()=>{Y4.clear(),ma.clear()},"clear"),ib=o(e=>e?typeof e=="string"?e:e.reduce((t,r)=>t+";"+r,""):"","getLabelStyles"),j4=o(async(e,t)=>{let r=ge(),i=Mr(r),{labelStyles:n}=ct(t);t.labelStyle=n;let a=e.insert("g").attr("class","edgeLabel"),s=a.insert("g").attr("class","label").attr("data-id",t.id),l=t.labelType==="markdown",h=await wi(e,t.label,{style:ib(t.labelStyle),useHtmlLabels:i,addSvgBackground:!0,isNode:!1,markdown:l,width:l?void 0:void 0},r);s.node().appendChild(h),Z.info("abc82",t,t.labelType);let d=h.getBBox(),f=d;if(i){let m=h.children[0],g=Je(h);d=m.getBoundingClientRect(),f=d,g.attr("width",d.width),g.attr("height",d.height)}else{let m=Je(h).select("text").node();m&&typeof m.getBBox=="function"&&(f=m.getBBox())}s.attr("transform",$o(f,i)),Y4.set(t.id,a),t.width=d.width,t.height=d.height;let p;if(t.startLabelLeft){let m=e.insert("g").attr("class","edgeTerminals"),g=m.insert("g").attr("class","inner"),y=await Nl(g,t.startLabelLeft,ib(t.labelStyle)||"",!1,!1);p=y;let v=y.getBBox();if(i){let x=y.children[0],b=Je(y);v=x.getBoundingClientRect(),b.attr("width",v.width),b.attr("height",v.height)}g.attr("transform",$o(v,i)),ma.get(t.id)||ma.set(t.id,{}),ma.get(t.id).startLeft=m,H4(p,t.startLabelLeft)}if(t.startLabelRight){let m=e.insert("g").attr("class","edgeTerminals"),g=m.insert("g").attr("class","inner"),y=await Nl(g,t.startLabelRight,ib(t.labelStyle)||"",!1,!1);p=y;let v=y.getBBox();if(i){let x=y.children[0],b=Je(y);v=x.getBoundingClientRect(),b.attr("width",v.width),b.attr("height",v.height)}g.attr("transform",$o(v,i)),ma.get(t.id)||ma.set(t.id,{}),ma.get(t.id).startRight=m,H4(p,t.startLabelRight)}if(t.endLabelLeft){let m=e.insert("g").attr("class","edgeTerminals"),g=m.insert("g").attr("class","inner"),y=await Nl(m,t.endLabelLeft,ib(t.labelStyle)||"",!1,!1);p=y;let v=y.getBBox();if(i){let x=y.children[0],b=Je(y);v=x.getBoundingClientRect(),b.attr("width",v.width),b.attr("height",v.height)}g.attr("transform",$o(v,i)),ma.get(t.id)||ma.set(t.id,{}),ma.get(t.id).endLeft=m,H4(p,t.endLabelLeft)}if(t.endLabelRight){let m=e.insert("g").attr("class","edgeTerminals"),g=m.insert("g").attr("class","inner"),y=await Nl(m,t.endLabelRight,ib(t.labelStyle)||"",!1,!1);p=y;let v=y.getBBox();if(i){let x=y.children[0],b=Je(y);v=x.getBoundingClientRect(),b.attr("width",v.width),b.attr("height",v.height)}g.attr("transform",$o(v,i)),ma.get(t.id)||ma.set(t.id,{}),ma.get(t.id).endRight=m,H4(p,t.endLabelRight)}return h},"insertEdgeLabel");o(H4,"setTerminalWidth");X4=o((e,t)=>{Z.debug("Moving label abc88 ",e.id,e.label,Y4.get(e.id),t);let r=t.updatedPath?t.updatedPath:t.originalPath,i=ge(),{subGraphTitleTotalMargin:n}=zu(i);if(e.label){let a=Y4.get(e.id),s=e.x,l=e.y;if(r){let u=Zt.calcLabelPosition(r);Z.debug("Moving label "+e.label+" from (",s,",",l,") to (",u.x,",",u.y,") abc88"),t.updatedPath&&(s=u.x,l=u.y)}a.attr("transform",`translate(${s}, ${l+n/2})`)}if(e.startLabelLeft){let a=ma.get(e.id).startLeft,s=e.x,l=e.y;if(r){let u=Zt.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=u.x,l=u.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.startLabelRight){let a=ma.get(e.id).startRight,s=e.x,l=e.y;if(r){let u=Zt.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=u.x,l=u.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.endLabelLeft){let a=ma.get(e.id).endLeft,s=e.x,l=e.y;if(r){let u=Zt.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=u.x,l=u.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.endLabelRight){let a=ma.get(e.id).endRight,s=e.x,l=e.y;if(r){let u=Zt.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=u.x,l=u.y}a.attr("transform",`translate(${s}, ${l})`)}},"positionEdgeLabel"),Kqe=o((e,t)=>{let r=e.x,i=e.y,n=Math.abs(t.x-r),a=Math.abs(t.y-i),s=e.width/2,l=e.height/2;return n>=s||a>=l},"outsideNode"),Zqe=o((e,t,r)=>{Z.debug(`intersection calc abc89: + outsidePoint: ${JSON.stringify(t)} + insidePoint : ${JSON.stringify(r)} + node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);let i=e.x,n=e.y,a=Math.abs(i-r.x),s=e.width/2,l=r.xMath.abs(i-t.x)*u){let f=r.y{Z.warn("abc88 cutPathAtIntersect",e,t);let r=[],i=e[0],n=!1;return e.forEach(a=>{if(Z.info("abc88 checking point",a,t),!Kqe(t,a)&&!n){let s=Zqe(t,i,a);Z.debug("abc88 inside",a,i,s),Z.debug("abc88 intersection",s,t);let l=!1;r.forEach(u=>{l=l||u.x===s.x&&u.y===s.y}),r.some(u=>u.x===s.x&&u.y===s.y)?Z.warn("abc88 no intersect",s,r):r.push(s),n=!0}else Z.warn("abc88 outside",a,i),i=a,n||r.push(a)}),Z.debug("returning points",r),r},"cutPathAtIntersect");o(Qqe,"extractCornerPoints");zae=o(function(e,t,r){let i=t.x-e.x,n=t.y-e.y,a=Math.sqrt(i*i+n*n),s=r/a;return{x:t.x-s*i,y:t.y-s*n}},"findAdjacentPoint"),Jqe=o(function(e){let{cornerPointPositions:t}=Qqe(e),r=[];for(let i=0;i10&&Math.abs(a.y-n.y)>=10){Z.debug("Corner point fixing",Math.abs(a.x-n.x),Math.abs(a.y-n.y));let m=5;s.x===l.x?p={x:h<0?l.x-m+f:l.x+m-f,y:d<0?l.y-f:l.y+f}:p={x:h<0?l.x-f:l.x+f,y:d<0?l.y-m+f:l.y+m-f}}else Z.debug("Corner point skipping fixing",Math.abs(a.x-n.x),Math.abs(a.y-n.y));r.push(p,u)}else r.push(e[i]);return r},"fixCorners"),eUe=o((e,t,r)=>{let i=e-t-r,n=2,a=2,s=n+a,l=Math.floor(i/s),u=Array(l).fill(`${n} ${a}`).join(" ");return`0 ${t} ${u} ${r}`},"generateDashArray"),K4=o(function(e,t,r,i,n,a,s,l=!1){if(!s)throw new Error(`insertEdge: missing diagramId for edge "${t.id}" \u2014 edge IDs require a diagram prefix for uniqueness`);let{handDrawnSeed:u}=ge(),h=t.points,d=!1,f=n;var p=a;let m=[];for(let B in t.cssCompiledStyles)Xx(B)||m.push(t.cssCompiledStyles[B]);Z.debug("UIO intersect check",t.points,p.x,f.x),p.intersect&&f.intersect&&!l&&(h=h.slice(1,t.points.length-1),h.unshift(f.intersect(h[0])),Z.debug("Last point UIO",t.start,"-->",t.end,h[h.length-1],p,p.intersect(h[h.length-1])),h.push(p.intersect(h[h.length-1])));let g=btoa(JSON.stringify(h));t.toCluster&&(Z.info("to cluster abc88",r.get(t.toCluster)),h=$ae(t.points,r.get(t.toCluster).node),d=!0),t.fromCluster&&(Z.debug("from cluster abc88",r.get(t.fromCluster),JSON.stringify(h,null,2)),h=$ae(h.reverse(),r.get(t.fromCluster).node).reverse(),d=!0);let y=h.filter(B=>!Number.isNaN(B.y)),v=Xqe(t.curve);v!=="rounded"&&(y=Jqe(y));let x=xc;switch(v){case"linear":x=xc;break;case"basis":x=Dl;break;case"cardinal":x=gx;break;case"bumpX":x=hx;break;case"bumpY":x=dx;break;case"catmullRom":x=xx;break;case"monotoneX":x=bx;break;case"monotoneY":x=Tx;break;case"natural":x=hg;break;case"step":x=dg;break;case"stepAfter":x=kx;break;case"stepBefore":x=Cx;break;case"rounded":x=xc;break;default:x=Dl}let{x:b,y:T}=U4(t),w=_l().x(b).y(T).curve(x),C;switch(t.thickness){case"normal":C="edge-thickness-normal";break;case"thick":C="edge-thickness-thick";break;case"invisible":C="edge-thickness-invisible";break;default:C="edge-thickness-normal"}switch(t.pattern){case"solid":C+=" edge-pattern-solid";break;case"dotted":C+=" edge-pattern-dotted";break;case"dashed":C+=" edge-pattern-dashed";break;default:C+=" edge-pattern-solid"}let k,E=v==="rounded"?tUe(rUe(y,t),5):w(y),A=Array.isArray(t.style)?t.style:[t.style],N=A.find(B=>B?.startsWith("stroke:")),P="";t.animate&&(P="edge-animation-fast"),t.animation&&(P="edge-animation-"+t.animation);let I=!1;if(t.look==="handDrawn"){let B=ut.svg(e);Object.assign([],y);let O=B.path(E,{roughness:.3,seed:u});C+=" transition",k=Je(O).select("path").attr("id",`${s}-${t.id}`).attr("class"," "+C+(t.classes?" "+t.classes:"")+(P?" "+P:"")).attr("style",A?A.reduce((G,F)=>G+";"+F,""):"");let $=k.attr("d");k.attr("d",$),e.node().appendChild(k.node())}else{let B=m.join(";"),O=A?A.reduce((j,U)=>j+U+";",""):"",$=(B?B+";"+O+";":O)+";"+(A?A.reduce((j,U)=>j+";"+U,""):"");k=e.append("path").attr("d",E).attr("id",`${s}-${t.id}`).attr("class"," "+C+(t.classes?" "+t.classes:"")+(P?" "+P:"")).attr("style",$),N=$.match(/stroke:([^;]+)/)?.[1],I=t.animate===!0||!!t.animation||B.includes("animation");let G=k.node(),F=typeof G.getTotalLength=="function"?G.getTotalLength():0,V=PN[t.arrowTypeStart]||0,H=PN[t.arrowTypeEnd]||0;if(t.look==="neo"&&!I){let U=`stroke-dasharray: ${t.pattern==="dotted"||t.pattern==="dashed"?eUe(F,V,H):`0 ${V} ${F-V-H} ${H}`}; stroke-dashoffset: 0;`;k.attr("style",U+k.attr("style"))}}k.attr("data-edge",!0),k.attr("data-et","edge"),k.attr("data-id",t.id),k.attr("data-points",g),k.attr("data-look",ii(t.look)),t.showPoints&&y.forEach(B=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",B.x).attr("cy",B.y)});let D="";(ge().flowchart.arrowMarkerAbsolute||ge().state.arrowMarkerAbsolute)&&(D=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,D=D.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),Z.info("arrowTypeStart",t.arrowTypeStart),Z.info("arrowTypeEnd",t.arrowTypeEnd);let _=!I&&t?.look==="neo";Bae(k,t,D,s,i,_,N);let R=Math.floor(h.length/2),M=h[R];Zt.isLabelCoordinateInPath(M,k.attr("d"))||(d=!0);let L={};return d&&(L.updatedPath=h),L.originalPath=t.points,L},"insertEdge");o(tUe,"generateRoundedPath");o(Gae,"calculateDeltaAndAngle");o(rUe,"applyMarkerOffsetsToPoints")});var iUe,nUe,aUe,sUe,oUe,lUe,cUe,uUe,hUe,dUe,fUe,pUe,mUe,gUe,yUe,vUe,xUe,bUe,TUe,CUe,kUe,wUe,SUe,EUe,Z4,$N=z(()=>{"use strict";St();br();iUe=o((e,t,r,i)=>{t.forEach(n=>{EUe[n](e,r,i)})},"insertMarkers"),nUe=o((e,t,r)=>{Z.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z"),e.append("marker").attr("id",r+"_"+t+"-extensionStart-margin").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,7 18,13 18,1").style("stroke-width",2).style("stroke-dasharray","0"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd-margin").attr("class","marker extension "+t).attr("refX",9).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("viewBox","0 0 20 14").append("polygon").attr("points","10,1 10,13 18,7").style("stroke-width",2).style("stroke-dasharray","0")},"extension"),aUe=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart-margin").attr("class","marker composition "+t).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("viewBox","0 0 15 15").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd-margin").attr("class","marker composition "+t).attr("refX",3.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),sUe=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart-margin").attr("class","marker aggregation "+t).attr("refX",15).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd-margin").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",2).attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),oUe=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart-margin").attr("class","marker dependency "+t).attr("refX",4).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd-margin").attr("class","marker dependency "+t).attr("refX",16).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").style("stroke-width",0).attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),lUe=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart-margin").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd-margin").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6).attr("stroke-width",2)},"lollipop"),cUe=o((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointEnd-margin").attr("class","marker "+t).attr("viewBox","0 0 11.5 14").attr("refX",11.5).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",10.5).attr("markerHeight",14).attr("orient","auto").append("path").attr("d","M 0 0 L 11.5 7 L 0 14 z").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart-margin").attr("class","marker "+t).attr("viewBox","0 0 11.5 14").attr("refX",1).attr("refY",7).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11.5).attr("markerHeight",14).attr("orient","auto").append("polygon").attr("points","0,7 11.5,14 11.5,0").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"point"),uUe=o((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleEnd-margin").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refY",5).attr("refX",12.25).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart-margin").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-2).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",14).attr("markerHeight",14).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",0).style("stroke-dasharray","1,0")},"circle"),hUe=o((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossEnd-margin").attr("class","marker cross "+t).attr("viewBox","0 0 15 15").attr("refX",17.7).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5),e.append("marker").attr("id",r+"_"+t+"-crossStart-margin").attr("class","marker cross "+t).attr("viewBox","0 0 15 15").attr("refX",-3.5).attr("refY",7.5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 1,1 L 14,14 M 1,14 L 14,1").attr("class","arrowMarkerPath").style("stroke-width",2.5).style("stroke-dasharray","1,0")},"cross"),dUe=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),fUe=o((e,t,r)=>{let i=Nt(),{themeVariables:n}=i,{transitionColor:a}=n;e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd-margin").attr("refX",17).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L11,14 L13,7 L11,0 Z").attr("fill",`${a}`)},"barbNeo"),pUe=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),mUe=o((e,t,r)=>{let i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),i.append("path").attr("d","M9,0 L9,18");let n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),n.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),gUe=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),yUe=o((e,t,r)=>{let i=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),i.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");let n=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");n.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),n.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),vUe=o((e,t,r)=>{let i=Nt(),{themeVariables:n}=i,{strokeWidth:a}=n;e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneStart").attr("class","marker onlyOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M9,0 L9,18 M15,0 L15,18").attr("stroke-width",`${a}`),e.append("defs").append("marker").attr("id",r+"_"+t+"-onlyOneEnd").attr("class","marker onlyOne "+t).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M3,0 L3,18 M9,0 L9,18").attr("stroke-width",`${a}`)},"only_one_neo"),xUe=o((e,t,r)=>{let i=Nt(),{themeVariables:n}=i,{strokeWidth:a,mainBkg:s}=n,l=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneStart").attr("class","marker zeroOrOne "+t).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto").attr("markerUnits","userSpaceOnUse");l.append("circle").attr("fill",s??"white").attr("cx",21).attr("cy",9).attr("stroke-width",`${a}`).attr("r",6),l.append("path").attr("d","M9,0 L9,18").attr("stroke-width",`${a}`);let u=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+t).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("markerUnits","userSpaceOnUse").attr("orient","auto");u.append("circle").attr("fill",s??"white").attr("cx",9).attr("cy",9).attr("stroke-width",`${a}`).attr("r",6),u.append("path").attr("d","M21,0 L21,18").attr("stroke-width",`${a}`)},"zero_or_one_neo"),bUe=o((e,t,r)=>{let i=Nt(),{themeVariables:n}=i,{strokeWidth:a}=n;e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreStart").attr("class","marker oneOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27").attr("stroke-width",`${a}`),e.append("defs").append("marker").attr("id",r+"_"+t+"-oneOrMoreEnd").attr("class","marker oneOrMore "+t).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18").attr("stroke-width",`${a}`)},"one_or_more_neo"),TUe=o((e,t,r)=>{let i=Nt(),{themeVariables:n}=i,{strokeWidth:a,mainBkg:s}=n,l=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+t).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("markerUnits","userSpaceOnUse").attr("orient","auto");l.append("circle").attr("fill",s??"white").attr("cx",45.5).attr("cy",18).attr("r",6).attr("stroke-width",`${a}`),l.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18").attr("stroke-width",`${a}`);let u=e.append("defs").append("marker").attr("id",r+"_"+t+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+t).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto").attr("markerUnits","userSpaceOnUse");u.append("circle").attr("fill",s??"white").attr("cx",11).attr("cy",18).attr("r",6).attr("stroke-width",`${a}`),u.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18").attr("stroke-width",`${a}`)},"zero_or_more_neo"),CUe=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0 + L20,10 + M20,10 + L0,20`)},"requirement_arrow"),kUe=o((e,t,r)=>{let i=Nt(),{themeVariables:n}=i,{strokeWidth:a}=n;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${a}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0 + L20,10 + M20,10 + L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),wUe=o((e,t,r)=>{let i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),SUe=o((e,t,r)=>{let i=Nt(),{themeVariables:n}=i,{strokeWidth:a}=n,s=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");s.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),s.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),s.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),s.selectAll("*").attr("stroke-width",`${a}`)},"requirement_contains_neo"),EUe={extension:nUe,composition:aUe,aggregation:sUe,dependency:oUe,lollipop:lUe,point:cUe,circle:uUe,cross:hUe,barb:dUe,barbNeo:fUe,only_one:pUe,zero_or_one:mUe,one_or_more:gUe,zero_or_more:yUe,only_one_neo:vUe,zero_or_one_neo:xUe,one_or_more_neo:bUe,zero_or_more_neo:TUe,requirement_arrow:CUe,requirement_contains:wUe,requirement_arrow_neo:kUe,requirement_contains_neo:SUe},Z4=iUe});async function Sg(e,t,r){let i,n;t.shape==="rect"&&(t.rx&&t.ry?t.shape="roundedRect":t.shape="squareRect");let a=t.shape?NN[t.shape]:void 0;if(!a)throw new Error(`No such shape: ${t.shape}. Please check your syntax.`);if(t.link){let s;r.config.securityLevel==="sandbox"?s="_top":t.linkTarget&&(s=t.linkTarget||"_blank"),i=e.insert("svg:a").attr("xlink:href",t.link).attr("target",s??null),n=await a(i,t,r)}else n=await a(e,t,r),i=n;return i.attr("data-look",ii(t.look)),t.tooltip&&n.attr("title",t.tooltip),Q4.set(t.id,i),t.haveCallback&&i.attr("class",i.attr("class")+" clickable"),i}var Q4,Wae,qae,nb,J4=z(()=>{"use strict";St();IN();Xt();Q4=new Map;o(Sg,"insertNode");Wae=o((e,t)=>{Q4.set(t.id,e)},"setNodeElem"),qae=o(()=>{Q4.clear()},"clear"),nb=o(e=>{let t=Q4.get(e.id);Z.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");let r=8,i=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+i-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),i},"positionNode")});var Uae,Hae=z(()=>{"use strict";br();Ir();St();W4();FN();$N();J4();Wt();Xt();Uae={common:vt,getConfig:Nt,insertCluster:wg,insertEdge:K4,insertEdgeLabel:j4,insertMarkers:Z4,insertNode:Sg,interpolateToCurve:EM,labelHelper:At,log:Z,positionEdgeLabel:X4}});var AUe,eS,zN=z(()=>{"use strict";AUe=typeof global=="object"&&global&&global.Object===Object&&global,eS=AUe});var _Ue,DUe,ln,zo=z(()=>{"use strict";zN();_Ue=typeof self=="object"&&self&&self.Object===Object&&self,DUe=eS||_Ue||Function("return this")(),ln=DUe});var RUe,ra,Mp=z(()=>{"use strict";zo();RUe=ln.Symbol,ra=RUe});function NUe(e){var t=LUe.call(e,ab),r=e[ab];try{e[ab]=void 0;var i=!0}catch{}var n=MUe.call(e);return i&&(t?e[ab]=r:delete e[ab]),n}var Yae,LUe,MUe,ab,jae,Xae=z(()=>{"use strict";Mp();Yae=Object.prototype,LUe=Yae.hasOwnProperty,MUe=Yae.toString,ab=ra?ra.toStringTag:void 0;o(NUe,"getRawTag");jae=NUe});function PUe(e){return OUe.call(e)}var IUe,OUe,Kae,Zae=z(()=>{"use strict";IUe=Object.prototype,OUe=IUe.toString;o(PUe,"objectToString");Kae=PUe});function $Ue(e){return e==null?e===void 0?FUe:BUe:Qae&&Qae in Object(e)?jae(e):Kae(e)}var BUe,FUe,Qae,es,fd=z(()=>{"use strict";Mp();Xae();Zae();BUe="[object Null]",FUe="[object Undefined]",Qae=ra?ra.toStringTag:void 0;o($Ue,"baseGetTag");es=$Ue});function zUe(e){return e!=null&&typeof e=="object"}var yn,Il=z(()=>{"use strict";o(zUe,"isObjectLike");yn=zUe});function VUe(e){return typeof e=="symbol"||yn(e)&&es(e)==GUe}var GUe,oo,Np=z(()=>{"use strict";fd();Il();GUe="[object Symbol]";o(VUe,"isSymbol");oo=VUe});function WUe(e,t){for(var r=-1,i=e==null?0:e.length,n=Array(i);++r{"use strict";o(WUe,"arrayMap");wc=WUe});var qUe,Or,An=z(()=>{"use strict";qUe=Array.isArray,Or=qUe});function tse(e){if(typeof e=="string")return e;if(Or(e))return wc(e,tse)+"";if(oo(e))return ese?ese.call(e):"";var t=e+"";return t=="0"&&1/e==-UUe?"-0":t}var UUe,Jae,ese,rse,ise=z(()=>{"use strict";Mp();sb();An();Np();UUe=1/0,Jae=ra?ra.prototype:void 0,ese=Jae?Jae.toString:void 0;o(tse,"baseToString");rse=tse});function YUe(e){for(var t=e.length;t--&&HUe.test(e.charAt(t)););return t}var HUe,nse,ase=z(()=>{"use strict";HUe=/\s/;o(YUe,"trimmedEndIndex");nse=YUe});function XUe(e){return e&&e.slice(0,nse(e)+1).replace(jUe,"")}var jUe,sse,ose=z(()=>{"use strict";ase();jUe=/^\s+/;o(XUe,"baseTrim");sse=XUe});function KUe(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Hi,Go=z(()=>{"use strict";o(KUe,"isObject");Hi=KUe});function tHe(e){if(typeof e=="number")return e;if(oo(e))return lse;if(Hi(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Hi(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=sse(e);var r=QUe.test(e);return r||JUe.test(e)?eHe(e.slice(2),r?2:8):ZUe.test(e)?lse:+e}var lse,ZUe,QUe,JUe,eHe,cse,use=z(()=>{"use strict";ose();Go();Np();lse=NaN,ZUe=/^[-+]0x[0-9a-f]+$/i,QUe=/^0b[01]+$/i,JUe=/^0o[0-7]+$/i,eHe=parseInt;o(tHe,"toNumber");cse=tHe});function iHe(e){if(!e)return e===0?e:0;if(e=cse(e),e===hse||e===-hse){var t=e<0?-1:1;return t*rHe}return e===e?e:0}var hse,rHe,Eg,GN=z(()=>{"use strict";use();hse=1/0,rHe=17976931348623157e292;o(iHe,"toFinite");Eg=iHe});function nHe(e){var t=Eg(e),r=t%1;return t===t?r?t-r:t:0}var dse,fse=z(()=>{"use strict";GN();o(nHe,"toInteger");dse=nHe});function aHe(e){return e}var Ls,pd=z(()=>{"use strict";o(aHe,"identity");Ls=aHe});function uHe(e){if(!Hi(e))return!1;var t=es(e);return t==oHe||t==lHe||t==sHe||t==cHe}var sHe,oHe,lHe,cHe,Sc,ob=z(()=>{"use strict";fd();Go();sHe="[object AsyncFunction]",oHe="[object Function]",lHe="[object GeneratorFunction]",cHe="[object Proxy]";o(uHe,"isFunction");Sc=uHe});var hHe,tS,pse=z(()=>{"use strict";zo();hHe=ln["__core-js_shared__"],tS=hHe});function dHe(e){return!!mse&&mse in e}var mse,gse,yse=z(()=>{"use strict";pse();mse=(function(){var e=/[^.]+$/.exec(tS&&tS.keys&&tS.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();o(dHe,"isMasked");gse=dHe});function mHe(e){if(e!=null){try{return pHe.call(e)}catch{}try{return e+""}catch{}}return""}var fHe,pHe,Gu,VN=z(()=>{"use strict";fHe=Function.prototype,pHe=fHe.toString;o(mHe,"toSource");Gu=mHe});function kHe(e){if(!Hi(e)||gse(e))return!1;var t=Sc(e)?CHe:yHe;return t.test(Gu(e))}var gHe,yHe,vHe,xHe,bHe,THe,CHe,vse,xse=z(()=>{"use strict";ob();yse();Go();VN();gHe=/[\\^$.*+?()[\]{}|]/g,yHe=/^\[object .+?Constructor\]$/,vHe=Function.prototype,xHe=Object.prototype,bHe=vHe.toString,THe=xHe.hasOwnProperty,CHe=RegExp("^"+bHe.call(THe).replace(gHe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");o(kHe,"baseIsNative");vse=kHe});function wHe(e,t){return e?.[t]}var bse,Tse=z(()=>{"use strict";o(wHe,"getValue");bse=wHe});function SHe(e,t){var r=bse(e,t);return vse(r)?r:void 0}var Ms,md=z(()=>{"use strict";xse();Tse();o(SHe,"getNative");Ms=SHe});var EHe,rS,Cse=z(()=>{"use strict";md();zo();EHe=Ms(ln,"WeakMap"),rS=EHe});var kse,AHe,wse,Sse=z(()=>{"use strict";Go();kse=Object.create,AHe=(function(){function e(){}return o(e,"object"),function(t){if(!Hi(t))return{};if(kse)return kse(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),wse=AHe});function _He(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Ese,Ase=z(()=>{"use strict";o(_He,"apply");Ese=_He});function DHe(){}var _se,Dse=z(()=>{"use strict";o(DHe,"noop");_se=DHe});function RHe(e,t){var r=-1,i=e.length;for(t||(t=Array(i));++r{"use strict";o(RHe,"copyArray");iS=RHe});function IHe(e){var t=0,r=0;return function(){var i=NHe(),n=MHe-(i-r);if(r=i,n>0){if(++t>=LHe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var LHe,MHe,NHe,Rse,Lse=z(()=>{"use strict";LHe=800,MHe=16,NHe=Date.now;o(IHe,"shortOut");Rse=IHe});function OHe(e){return function(){return e}}var Ns,qN=z(()=>{"use strict";o(OHe,"constant");Ns=OHe});var PHe,Ag,UN=z(()=>{"use strict";md();PHe=(function(){try{var e=Ms(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Ag=PHe});var BHe,Mse,Nse=z(()=>{"use strict";qN();UN();pd();BHe=Ag?function(e,t){return Ag(e,"toString",{configurable:!0,enumerable:!1,value:Ns(t),writable:!0})}:Ls,Mse=BHe});var FHe,nS,HN=z(()=>{"use strict";Nse();Lse();FHe=Rse(Mse),nS=FHe});function $He(e,t){for(var r=-1,i=e==null?0:e.length;++r{"use strict";o($He,"arrayEach");aS=$He});function zHe(e,t,r,i){for(var n=e.length,a=r+(i?1:-1);i?a--:++a{"use strict";o(zHe,"baseFindIndex");sS=zHe});function GHe(e){return e!==e}var Ise,Ose=z(()=>{"use strict";o(GHe,"baseIsNaN");Ise=GHe});function VHe(e,t,r){for(var i=r-1,n=e.length;++i{"use strict";o(VHe,"strictIndexOf");Pse=VHe});function WHe(e,t,r){return t===t?Pse(e,t,r):sS(e,Ise,r)}var Fse,$se=z(()=>{"use strict";jN();Ose();Bse();o(WHe,"baseIndexOf");Fse=WHe});function qHe(e,t){var r=e==null?0:e.length;return!!r&&Fse(e,t,0)>-1}var zse,Gse=z(()=>{"use strict";$se();o(qHe,"arrayIncludes");zse=qHe});function YHe(e,t){var r=typeof e;return t=t??UHe,!!t&&(r=="number"||r!="symbol"&&HHe.test(e))&&e>-1&&e%1==0&&e{"use strict";UHe=9007199254740991,HHe=/^(?:0|[1-9]\d*)$/;o(YHe,"isIndex");gd=YHe});function jHe(e,t,r){t=="__proto__"&&Ag?Ag(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var yd,cb=z(()=>{"use strict";UN();o(jHe,"baseAssignValue");yd=jHe});function XHe(e,t){return e===t||e!==e&&t!==t}var Vo,Ip=z(()=>{"use strict";o(XHe,"eq");Vo=XHe});function QHe(e,t,r){var i=e[t];(!(ZHe.call(e,t)&&Vo(i,r))||r===void 0&&!(t in e))&&yd(e,t,r)}var KHe,ZHe,vd,ub=z(()=>{"use strict";cb();Ip();KHe=Object.prototype,ZHe=KHe.hasOwnProperty;o(QHe,"assignValue");vd=QHe});function JHe(e,t,r,i){var n=!r;r||(r={});for(var a=-1,s=t.length;++a{"use strict";ub();cb();o(JHe,"copyObject");Ec=JHe});function eYe(e,t,r){return t=Vse(t===void 0?e.length-1:t,0),function(){for(var i=arguments,n=-1,a=Vse(i.length-t,0),s=Array(a);++n{"use strict";Ase();Vse=Math.max;o(eYe,"overRest");oS=eYe});function tYe(e,t){return nS(oS(e,t,Ls),e+"")}var xd,hb=z(()=>{"use strict";pd();XN();HN();o(tYe,"baseRest");xd=tYe});function iYe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=rYe}var rYe,Dg,lS=z(()=>{"use strict";rYe=9007199254740991;o(iYe,"isLength");Dg=iYe});function nYe(e){return e!=null&&Dg(e.length)&&!Sc(e)}var ia,Ac=z(()=>{"use strict";ob();lS();o(nYe,"isArrayLike");ia=nYe});function aYe(e,t,r){if(!Hi(r))return!1;var i=typeof t;return(i=="number"?ia(r)&&gd(t,r.length):i=="string"&&t in r)?Vo(r[t],e):!1}var Vu,db=z(()=>{"use strict";Ip();Ac();lb();Go();o(aYe,"isIterateeCall");Vu=aYe});function sYe(e){return xd(function(t,r){var i=-1,n=r.length,a=n>1?r[n-1]:void 0,s=n>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(n--,a):void 0,s&&Vu(r[0],r[1],s)&&(a=n<3?void 0:a,n=1),t=Object(t);++i{"use strict";hb();db();o(sYe,"createAssigner");Wse=sYe});function lYe(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||oYe;return e===r}var oYe,bd,fb=z(()=>{"use strict";oYe=Object.prototype;o(lYe,"isPrototype");bd=lYe});function cYe(e,t){for(var r=-1,i=Array(e);++r{"use strict";o(cYe,"baseTimes");Use=cYe});function hYe(e){return yn(e)&&es(e)==uYe}var uYe,KN,Yse=z(()=>{"use strict";fd();Il();uYe="[object Arguments]";o(hYe,"baseIsArguments");KN=hYe});var jse,dYe,fYe,pYe,Ol,Rg=z(()=>{"use strict";Yse();Il();jse=Object.prototype,dYe=jse.hasOwnProperty,fYe=jse.propertyIsEnumerable,pYe=KN((function(){return arguments})())?KN:function(e){return yn(e)&&dYe.call(e,"callee")&&!fYe.call(e,"callee")},Ol=pYe});function mYe(){return!1}var Xse,Kse=z(()=>{"use strict";o(mYe,"stubFalse");Xse=mYe});var Jse,Zse,gYe,Qse,yYe,vYe,Pl,Lg=z(()=>{"use strict";zo();Kse();Jse=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zse=Jse&&typeof module=="object"&&module&&!module.nodeType&&module,gYe=Zse&&Zse.exports===Jse,Qse=gYe?ln.Buffer:void 0,yYe=Qse?Qse.isBuffer:void 0,vYe=yYe||Xse,Pl=vYe});function WYe(e){return yn(e)&&Dg(e.length)&&!!$i[es(e)]}var xYe,bYe,TYe,CYe,kYe,wYe,SYe,EYe,AYe,_Ye,DYe,RYe,LYe,MYe,NYe,IYe,OYe,PYe,BYe,FYe,$Ye,zYe,GYe,VYe,$i,eoe,toe=z(()=>{"use strict";fd();lS();Il();xYe="[object Arguments]",bYe="[object Array]",TYe="[object Boolean]",CYe="[object Date]",kYe="[object Error]",wYe="[object Function]",SYe="[object Map]",EYe="[object Number]",AYe="[object Object]",_Ye="[object RegExp]",DYe="[object Set]",RYe="[object String]",LYe="[object WeakMap]",MYe="[object ArrayBuffer]",NYe="[object DataView]",IYe="[object Float32Array]",OYe="[object Float64Array]",PYe="[object Int8Array]",BYe="[object Int16Array]",FYe="[object Int32Array]",$Ye="[object Uint8Array]",zYe="[object Uint8ClampedArray]",GYe="[object Uint16Array]",VYe="[object Uint32Array]",$i={};$i[IYe]=$i[OYe]=$i[PYe]=$i[BYe]=$i[FYe]=$i[$Ye]=$i[zYe]=$i[GYe]=$i[VYe]=!0;$i[xYe]=$i[bYe]=$i[MYe]=$i[TYe]=$i[NYe]=$i[CYe]=$i[kYe]=$i[wYe]=$i[SYe]=$i[EYe]=$i[AYe]=$i[_Ye]=$i[DYe]=$i[RYe]=$i[LYe]=!1;o(WYe,"baseIsTypedArray");eoe=WYe});function qYe(e){return function(t){return e(t)}}var Td,pb=z(()=>{"use strict";o(qYe,"baseUnary");Td=qYe});var roe,mb,UYe,ZN,HYe,Wu,cS=z(()=>{"use strict";zN();roe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,mb=roe&&typeof module=="object"&&module&&!module.nodeType&&module,UYe=mb&&mb.exports===roe,ZN=UYe&&eS.process,HYe=(function(){try{var e=mb&&mb.require&&mb.require("util").types;return e||ZN&&ZN.binding&&ZN.binding("util")}catch{}})(),Wu=HYe});var ioe,YYe,Cd,gb=z(()=>{"use strict";toe();pb();cS();ioe=Wu&&Wu.isTypedArray,YYe=ioe?Td(ioe):eoe,Cd=YYe});function KYe(e,t){var r=Or(e),i=!r&&Ol(e),n=!r&&!i&&Pl(e),a=!r&&!i&&!n&&Cd(e),s=r||i||n||a,l=s?Use(e.length,String):[],u=l.length;for(var h in e)(t||XYe.call(e,h))&&!(s&&(h=="length"||n&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||gd(h,u)))&&l.push(h);return l}var jYe,XYe,uS,QN=z(()=>{"use strict";Hse();Rg();An();Lg();lb();gb();jYe=Object.prototype,XYe=jYe.hasOwnProperty;o(KYe,"arrayLikeKeys");uS=KYe});function ZYe(e,t){return function(r){return e(t(r))}}var hS,JN=z(()=>{"use strict";o(ZYe,"overArg");hS=ZYe});var QYe,noe,aoe=z(()=>{"use strict";JN();QYe=hS(Object.keys,Object),noe=QYe});function tje(e){if(!bd(e))return noe(e);var t=[];for(var r in Object(e))eje.call(e,r)&&r!="constructor"&&t.push(r);return t}var JYe,eje,Mg,dS=z(()=>{"use strict";fb();aoe();JYe=Object.prototype,eje=JYe.hasOwnProperty;o(tje,"baseKeys");Mg=tje});function rje(e){return ia(e)?uS(e):Mg(e)}var cn,qu=z(()=>{"use strict";QN();dS();Ac();o(rje,"keys");cn=rje});function ije(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var soe,ooe=z(()=>{"use strict";o(ije,"nativeKeysIn");soe=ije});function sje(e){if(!Hi(e))return soe(e);var t=bd(e),r=[];for(var i in e)i=="constructor"&&(t||!aje.call(e,i))||r.push(i);return r}var nje,aje,loe,coe=z(()=>{"use strict";Go();fb();ooe();nje=Object.prototype,aje=nje.hasOwnProperty;o(sje,"baseKeysIn");loe=sje});function oje(e){return ia(e)?uS(e,!0):loe(e)}var Is,kd=z(()=>{"use strict";QN();coe();Ac();o(oje,"keysIn");Is=oje});function uje(e,t){if(Or(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||oo(e)?!0:cje.test(e)||!lje.test(e)||t!=null&&e in Object(t)}var lje,cje,Ng,fS=z(()=>{"use strict";An();Np();lje=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cje=/^\w*$/;o(uje,"isKey");Ng=uje});var hje,Uu,yb=z(()=>{"use strict";md();hje=Ms(Object,"create"),Uu=hje});function dje(){this.__data__=Uu?Uu(null):{},this.size=0}var uoe,hoe=z(()=>{"use strict";yb();o(dje,"hashClear");uoe=dje});function fje(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var doe,foe=z(()=>{"use strict";o(fje,"hashDelete");doe=fje});function yje(e){var t=this.__data__;if(Uu){var r=t[e];return r===pje?void 0:r}return gje.call(t,e)?t[e]:void 0}var pje,mje,gje,poe,moe=z(()=>{"use strict";yb();pje="__lodash_hash_undefined__",mje=Object.prototype,gje=mje.hasOwnProperty;o(yje,"hashGet");poe=yje});function bje(e){var t=this.__data__;return Uu?t[e]!==void 0:xje.call(t,e)}var vje,xje,goe,yoe=z(()=>{"use strict";yb();vje=Object.prototype,xje=vje.hasOwnProperty;o(bje,"hashHas");goe=bje});function Cje(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Uu&&t===void 0?Tje:t,this}var Tje,voe,xoe=z(()=>{"use strict";yb();Tje="__lodash_hash_undefined__";o(Cje,"hashSet");voe=Cje});function Ig(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t{"use strict";hoe();foe();moe();yoe();xoe();o(Ig,"Hash");Ig.prototype.clear=uoe;Ig.prototype.delete=doe;Ig.prototype.get=poe;Ig.prototype.has=goe;Ig.prototype.set=voe;eI=Ig});function kje(){this.__data__=[],this.size=0}var Toe,Coe=z(()=>{"use strict";o(kje,"listCacheClear");Toe=kje});function wje(e,t){for(var r=e.length;r--;)if(Vo(e[r][0],t))return r;return-1}var wd,vb=z(()=>{"use strict";Ip();o(wje,"assocIndexOf");wd=wje});function Aje(e){var t=this.__data__,r=wd(t,e);if(r<0)return!1;var i=t.length-1;return r==i?t.pop():Eje.call(t,r,1),--this.size,!0}var Sje,Eje,koe,woe=z(()=>{"use strict";vb();Sje=Array.prototype,Eje=Sje.splice;o(Aje,"listCacheDelete");koe=Aje});function _je(e){var t=this.__data__,r=wd(t,e);return r<0?void 0:t[r][1]}var Soe,Eoe=z(()=>{"use strict";vb();o(_je,"listCacheGet");Soe=_je});function Dje(e){return wd(this.__data__,e)>-1}var Aoe,_oe=z(()=>{"use strict";vb();o(Dje,"listCacheHas");Aoe=Dje});function Rje(e,t){var r=this.__data__,i=wd(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}var Doe,Roe=z(()=>{"use strict";vb();o(Rje,"listCacheSet");Doe=Rje});function Og(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t{"use strict";Coe();woe();Eoe();_oe();Roe();o(Og,"ListCache");Og.prototype.clear=Toe;Og.prototype.delete=koe;Og.prototype.get=Soe;Og.prototype.has=Aoe;Og.prototype.set=Doe;Sd=Og});var Lje,Ed,pS=z(()=>{"use strict";md();zo();Lje=Ms(ln,"Map"),Ed=Lje});function Mje(){this.size=0,this.__data__={hash:new eI,map:new(Ed||Sd),string:new eI}}var Loe,Moe=z(()=>{"use strict";boe();xb();pS();o(Mje,"mapCacheClear");Loe=Mje});function Nje(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Noe,Ioe=z(()=>{"use strict";o(Nje,"isKeyable");Noe=Nje});function Ije(e,t){var r=e.__data__;return Noe(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Ad,bb=z(()=>{"use strict";Ioe();o(Ije,"getMapData");Ad=Ije});function Oje(e){var t=Ad(this,e).delete(e);return this.size-=t?1:0,t}var Ooe,Poe=z(()=>{"use strict";bb();o(Oje,"mapCacheDelete");Ooe=Oje});function Pje(e){return Ad(this,e).get(e)}var Boe,Foe=z(()=>{"use strict";bb();o(Pje,"mapCacheGet");Boe=Pje});function Bje(e){return Ad(this,e).has(e)}var $oe,zoe=z(()=>{"use strict";bb();o(Bje,"mapCacheHas");$oe=Bje});function Fje(e,t){var r=Ad(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}var Goe,Voe=z(()=>{"use strict";bb();o(Fje,"mapCacheSet");Goe=Fje});function Pg(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t{"use strict";Moe();Poe();Foe();zoe();Voe();o(Pg,"MapCache");Pg.prototype.clear=Loe;Pg.prototype.delete=Ooe;Pg.prototype.get=Boe;Pg.prototype.has=$oe;Pg.prototype.set=Goe;Op=Pg});function tI(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError($je);var r=o(function(){var i=arguments,n=t?t.apply(this,i):i[0],a=r.cache;if(a.has(n))return a.get(n);var s=e.apply(this,i);return r.cache=a.set(n,s)||a,s},"memoized");return r.cache=new(tI.Cache||Op),r}var $je,Woe,qoe=z(()=>{"use strict";mS();$je="Expected a function";o(tI,"memoize");tI.Cache=Op;Woe=tI});function Gje(e){var t=Woe(e,function(i){return r.size===zje&&r.clear(),i}),r=t.cache;return t}var zje,Uoe,Hoe=z(()=>{"use strict";qoe();zje=500;o(Gje,"memoizeCapped");Uoe=Gje});var Vje,Wje,qje,Yoe,joe=z(()=>{"use strict";Hoe();Vje=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wje=/\\(\\)?/g,qje=Uoe(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Vje,function(r,i,n,a){t.push(n?a.replace(Wje,"$1"):i||r)}),t}),Yoe=qje});function Uje(e){return e==null?"":rse(e)}var gS,rI=z(()=>{"use strict";ise();o(Uje,"toString");gS=Uje});function Hje(e,t){return Or(e)?e:Ng(e,t)?[e]:Yoe(gS(e))}var _d,Tb=z(()=>{"use strict";An();fS();joe();rI();o(Hje,"castPath");_d=Hje});function jje(e){if(typeof e=="string"||oo(e))return e;var t=e+"";return t=="0"&&1/e==-Yje?"-0":t}var Yje,_c,Bg=z(()=>{"use strict";Np();Yje=1/0;o(jje,"toKey");_c=jje});function Xje(e,t){t=_d(t,e);for(var r=0,i=t.length;e!=null&&r{"use strict";Tb();Bg();o(Xje,"baseGet");Dd=Xje});function Kje(e,t,r){var i=e==null?void 0:Dd(e,t);return i===void 0?r:i}var Xoe,Koe=z(()=>{"use strict";Cb();o(Kje,"get");Xoe=Kje});function Zje(e,t){for(var r=-1,i=t.length,n=e.length;++r{"use strict";o(Zje,"arrayPush");Fg=Zje});function Qje(e){return Or(e)||Ol(e)||!!(Zoe&&e&&e[Zoe])}var Zoe,Qoe,Joe=z(()=>{"use strict";Mp();Rg();An();Zoe=ra?ra.isConcatSpreadable:void 0;o(Qje,"isFlattenable");Qoe=Qje});function ele(e,t,r,i,n){var a=-1,s=e.length;for(r||(r=Qoe),n||(n=[]);++a0&&r(l)?t>1?ele(l,t-1,r,i,n):Fg(n,l):i||(n[n.length]=l)}return n}var $g,vS=z(()=>{"use strict";yS();Joe();o(ele,"baseFlatten");$g=ele});function Jje(e){var t=e==null?0:e.length;return t?$g(e,1):[]}var Wo,iI=z(()=>{"use strict";vS();o(Jje,"flatten");Wo=Jje});function eXe(e){return nS(oS(e,void 0,Wo),e+"")}var tle,rle=z(()=>{"use strict";iI();XN();HN();o(eXe,"flatRest");tle=eXe});var tXe,zg,xS=z(()=>{"use strict";JN();tXe=hS(Object.getPrototypeOf,Object),zg=tXe});function oXe(e){if(!yn(e)||es(e)!=rXe)return!1;var t=zg(e);if(t===null)return!0;var r=aXe.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ile.call(r)==sXe}var rXe,iXe,nXe,ile,aXe,sXe,nle,ale=z(()=>{"use strict";fd();xS();Il();rXe="[object Object]",iXe=Function.prototype,nXe=Object.prototype,ile=iXe.toString,aXe=nXe.hasOwnProperty,sXe=ile.call(Object);o(oXe,"isPlainObject");nle=oXe});function gXe(e){return mXe.test(e)}var lXe,cXe,uXe,hXe,dXe,fXe,pXe,mXe,sle,ole=z(()=>{"use strict";lXe="\\ud800-\\udfff",cXe="\\u0300-\\u036f",uXe="\\ufe20-\\ufe2f",hXe="\\u20d0-\\u20ff",dXe=cXe+uXe+hXe,fXe="\\ufe0e\\ufe0f",pXe="\\u200d",mXe=RegExp("["+pXe+lXe+dXe+fXe+"]");o(gXe,"hasUnicode");sle=gXe});function yXe(e,t,r,i){var n=-1,a=e==null?0:e.length;for(i&&a&&(r=e[++n]);++n{"use strict";o(yXe,"arrayReduce");lle=yXe});function vXe(){this.__data__=new Sd,this.size=0}var ule,hle=z(()=>{"use strict";xb();o(vXe,"stackClear");ule=vXe});function xXe(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var dle,fle=z(()=>{"use strict";o(xXe,"stackDelete");dle=xXe});function bXe(e){return this.__data__.get(e)}var ple,mle=z(()=>{"use strict";o(bXe,"stackGet");ple=bXe});function TXe(e){return this.__data__.has(e)}var gle,yle=z(()=>{"use strict";o(TXe,"stackHas");gle=TXe});function kXe(e,t){var r=this.__data__;if(r instanceof Sd){var i=r.__data__;if(!Ed||i.length{"use strict";xb();pS();mS();CXe=200;o(kXe,"stackSet");vle=kXe});function Gg(e){var t=this.__data__=new Sd(e);this.size=t.size}var Dc,kb=z(()=>{"use strict";xb();hle();fle();mle();yle();xle();o(Gg,"Stack");Gg.prototype.clear=ule;Gg.prototype.delete=dle;Gg.prototype.get=ple;Gg.prototype.has=gle;Gg.prototype.set=vle;Dc=Gg});function wXe(e,t){return e&&Ec(t,cn(t),e)}var ble,Tle=z(()=>{"use strict";_g();qu();o(wXe,"baseAssign");ble=wXe});function SXe(e,t){return e&&Ec(t,Is(t),e)}var Cle,kle=z(()=>{"use strict";_g();kd();o(SXe,"baseAssignIn");Cle=SXe});function AXe(e,t){if(t)return e.slice();var r=e.length,i=Ele?Ele(r):new e.constructor(r);return e.copy(i),i}var Ale,wle,EXe,Sle,Ele,bS,nI=z(()=>{"use strict";zo();Ale=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wle=Ale&&typeof module=="object"&&module&&!module.nodeType&&module,EXe=wle&&wle.exports===Ale,Sle=EXe?ln.Buffer:void 0,Ele=Sle?Sle.allocUnsafe:void 0;o(AXe,"cloneBuffer");bS=AXe});function _Xe(e,t){for(var r=-1,i=e==null?0:e.length,n=0,a=[];++r{"use strict";o(_Xe,"arrayFilter");TS=_Xe});function DXe(){return[]}var CS,sI=z(()=>{"use strict";o(DXe,"stubArray");CS=DXe});var RXe,LXe,_le,MXe,Vg,kS=z(()=>{"use strict";aI();sI();RXe=Object.prototype,LXe=RXe.propertyIsEnumerable,_le=Object.getOwnPropertySymbols,MXe=_le?function(e){return e==null?[]:(e=Object(e),TS(_le(e),function(t){return LXe.call(e,t)}))}:CS,Vg=MXe});function NXe(e,t){return Ec(e,Vg(e),t)}var Dle,Rle=z(()=>{"use strict";_g();kS();o(NXe,"copySymbols");Dle=NXe});var IXe,OXe,wS,oI=z(()=>{"use strict";yS();xS();kS();sI();IXe=Object.getOwnPropertySymbols,OXe=IXe?function(e){for(var t=[];e;)Fg(t,Vg(e)),e=zg(e);return t}:CS,wS=OXe});function PXe(e,t){return Ec(e,wS(e),t)}var Lle,Mle=z(()=>{"use strict";_g();oI();o(PXe,"copySymbolsIn");Lle=PXe});function BXe(e,t,r){var i=t(e);return Or(e)?i:Fg(i,r(e))}var SS,lI=z(()=>{"use strict";yS();An();o(BXe,"baseGetAllKeys");SS=BXe});function FXe(e){return SS(e,cn,Vg)}var wb,cI=z(()=>{"use strict";lI();kS();qu();o(FXe,"getAllKeys");wb=FXe});function $Xe(e){return SS(e,Is,wS)}var Nle,Ile=z(()=>{"use strict";lI();oI();kd();o($Xe,"getAllKeysIn");Nle=$Xe});var zXe,ES,Ole=z(()=>{"use strict";md();zo();zXe=Ms(ln,"DataView"),ES=zXe});var GXe,AS,Ple=z(()=>{"use strict";md();zo();GXe=Ms(ln,"Promise"),AS=GXe});var VXe,Rd,uI=z(()=>{"use strict";md();zo();VXe=Ms(ln,"Set"),Rd=VXe});var Ble,WXe,Fle,$le,zle,Gle,qXe,UXe,HXe,YXe,jXe,Pp,lo,Bp=z(()=>{"use strict";Ole();pS();Ple();uI();Cse();fd();VN();Ble="[object Map]",WXe="[object Object]",Fle="[object Promise]",$le="[object Set]",zle="[object WeakMap]",Gle="[object DataView]",qXe=Gu(ES),UXe=Gu(Ed),HXe=Gu(AS),YXe=Gu(Rd),jXe=Gu(rS),Pp=es;(ES&&Pp(new ES(new ArrayBuffer(1)))!=Gle||Ed&&Pp(new Ed)!=Ble||AS&&Pp(AS.resolve())!=Fle||Rd&&Pp(new Rd)!=$le||rS&&Pp(new rS)!=zle)&&(Pp=o(function(e){var t=es(e),r=t==WXe?e.constructor:void 0,i=r?Gu(r):"";if(i)switch(i){case qXe:return Gle;case UXe:return Ble;case HXe:return Fle;case YXe:return $le;case jXe:return zle}return t},"getTag"));lo=Pp});function ZXe(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&KXe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var XXe,KXe,Vle,Wle=z(()=>{"use strict";XXe=Object.prototype,KXe=XXe.hasOwnProperty;o(ZXe,"initCloneArray");Vle=ZXe});var QXe,Wg,hI=z(()=>{"use strict";zo();QXe=ln.Uint8Array,Wg=QXe});function JXe(e){var t=new e.constructor(e.byteLength);return new Wg(t).set(new Wg(e)),t}var qg,_S=z(()=>{"use strict";hI();o(JXe,"cloneArrayBuffer");qg=JXe});function eKe(e,t){var r=t?qg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var qle,Ule=z(()=>{"use strict";_S();o(eKe,"cloneDataView");qle=eKe});function rKe(e){var t=new e.constructor(e.source,tKe.exec(e));return t.lastIndex=e.lastIndex,t}var tKe,Hle,Yle=z(()=>{"use strict";tKe=/\w*$/;o(rKe,"cloneRegExp");Hle=rKe});function iKe(e){return Xle?Object(Xle.call(e)):{}}var jle,Xle,Kle,Zle=z(()=>{"use strict";Mp();jle=ra?ra.prototype:void 0,Xle=jle?jle.valueOf:void 0;o(iKe,"cloneSymbol");Kle=iKe});function nKe(e,t){var r=t?qg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var DS,dI=z(()=>{"use strict";_S();o(nKe,"cloneTypedArray");DS=nKe});function wKe(e,t,r){var i=e.constructor;switch(t){case fKe:return qg(e);case aKe:case sKe:return new i(+e);case pKe:return qle(e,r);case mKe:case gKe:case yKe:case vKe:case xKe:case bKe:case TKe:case CKe:case kKe:return DS(e,r);case oKe:return new i;case lKe:case hKe:return new i(e);case cKe:return Hle(e);case uKe:return new i;case dKe:return Kle(e)}}var aKe,sKe,oKe,lKe,cKe,uKe,hKe,dKe,fKe,pKe,mKe,gKe,yKe,vKe,xKe,bKe,TKe,CKe,kKe,Qle,Jle=z(()=>{"use strict";_S();Ule();Yle();Zle();dI();aKe="[object Boolean]",sKe="[object Date]",oKe="[object Map]",lKe="[object Number]",cKe="[object RegExp]",uKe="[object Set]",hKe="[object String]",dKe="[object Symbol]",fKe="[object ArrayBuffer]",pKe="[object DataView]",mKe="[object Float32Array]",gKe="[object Float64Array]",yKe="[object Int8Array]",vKe="[object Int16Array]",xKe="[object Int32Array]",bKe="[object Uint8Array]",TKe="[object Uint8ClampedArray]",CKe="[object Uint16Array]",kKe="[object Uint32Array]";o(wKe,"initCloneByTag");Qle=wKe});function SKe(e){return typeof e.constructor=="function"&&!bd(e)?wse(zg(e)):{}}var RS,fI=z(()=>{"use strict";Sse();xS();fb();o(SKe,"initCloneObject");RS=SKe});function AKe(e){return yn(e)&&lo(e)==EKe}var EKe,ece,tce=z(()=>{"use strict";Bp();Il();EKe="[object Map]";o(AKe,"baseIsMap");ece=AKe});var rce,_Ke,ice,nce=z(()=>{"use strict";tce();pb();cS();rce=Wu&&Wu.isMap,_Ke=rce?Td(rce):ece,ice=_Ke});function RKe(e){return yn(e)&&lo(e)==DKe}var DKe,ace,sce=z(()=>{"use strict";Bp();Il();DKe="[object Set]";o(RKe,"baseIsSet");ace=RKe});var oce,LKe,lce,cce=z(()=>{"use strict";sce();pb();cS();oce=Wu&&Wu.isSet,LKe=oce?Td(oce):ace,lce=LKe});function LS(e,t,r,i,n,a){var s,l=t&MKe,u=t&NKe,h=t&IKe;if(r&&(s=n?r(e,i,n,a):r(e)),s!==void 0)return s;if(!Hi(e))return e;var d=Or(e);if(d){if(s=Vle(e),!l)return iS(e,s)}else{var f=lo(e),p=f==hce||f==$Ke;if(Pl(e))return bS(e,l);if(f==dce||f==uce||p&&!n){if(s=u||p?{}:RS(e),!l)return u?Lle(e,Cle(s,e)):Dle(e,ble(s,e))}else{if(!Ri[f])return n?e:{};s=Qle(e,f,l)}}a||(a=new Dc);var m=a.get(e);if(m)return m;a.set(e,s),lce(e)?e.forEach(function(v){s.add(LS(v,t,r,v,e,a))}):ice(e)&&e.forEach(function(v,x){s.set(x,LS(v,t,r,x,e,a))});var g=h?u?Nle:wb:u?Is:cn,y=d?void 0:g(e);return aS(y||e,function(v,x){y&&(x=v,v=e[x]),vd(s,x,LS(v,t,r,x,e,a))}),s}var MKe,NKe,IKe,uce,OKe,PKe,BKe,FKe,hce,$Ke,zKe,GKe,dce,VKe,WKe,qKe,UKe,HKe,YKe,jKe,XKe,KKe,ZKe,QKe,JKe,eZe,tZe,rZe,iZe,Ri,MS,pI=z(()=>{"use strict";kb();YN();ub();Tle();kle();nI();WN();Rle();Mle();cI();Ile();Bp();Wle();Jle();fI();An();Lg();nce();Go();cce();qu();kd();MKe=1,NKe=2,IKe=4,uce="[object Arguments]",OKe="[object Array]",PKe="[object Boolean]",BKe="[object Date]",FKe="[object Error]",hce="[object Function]",$Ke="[object GeneratorFunction]",zKe="[object Map]",GKe="[object Number]",dce="[object Object]",VKe="[object RegExp]",WKe="[object Set]",qKe="[object String]",UKe="[object Symbol]",HKe="[object WeakMap]",YKe="[object ArrayBuffer]",jKe="[object DataView]",XKe="[object Float32Array]",KKe="[object Float64Array]",ZKe="[object Int8Array]",QKe="[object Int16Array]",JKe="[object Int32Array]",eZe="[object Uint8Array]",tZe="[object Uint8ClampedArray]",rZe="[object Uint16Array]",iZe="[object Uint32Array]",Ri={};Ri[uce]=Ri[OKe]=Ri[YKe]=Ri[jKe]=Ri[PKe]=Ri[BKe]=Ri[XKe]=Ri[KKe]=Ri[ZKe]=Ri[QKe]=Ri[JKe]=Ri[zKe]=Ri[GKe]=Ri[dce]=Ri[VKe]=Ri[WKe]=Ri[qKe]=Ri[UKe]=Ri[eZe]=Ri[tZe]=Ri[rZe]=Ri[iZe]=!0;Ri[FKe]=Ri[hce]=Ri[HKe]=!1;o(LS,"baseClone");MS=LS});function aZe(e){return MS(e,nZe)}var nZe,mI,fce=z(()=>{"use strict";pI();nZe=4;o(aZe,"clone");mI=aZe});function lZe(e){return MS(e,sZe|oZe)}var sZe,oZe,gI,pce=z(()=>{"use strict";pI();sZe=1,oZe=4;o(lZe,"cloneDeep");gI=lZe});function uZe(e){return this.__data__.set(e,cZe),this}var cZe,mce,gce=z(()=>{"use strict";cZe="__lodash_hash_undefined__";o(uZe,"setCacheAdd");mce=uZe});function hZe(e){return this.__data__.has(e)}var yce,vce=z(()=>{"use strict";o(hZe,"setCacheHas");yce=hZe});function NS(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Op;++t{"use strict";mS();gce();vce();o(NS,"SetCache");NS.prototype.add=NS.prototype.push=mce;NS.prototype.has=yce;IS=NS});function dZe(e,t){for(var r=-1,i=e==null?0:e.length;++r{"use strict";o(dZe,"arraySome");xce=dZe});function fZe(e,t){return e.has(t)}var OS,vI=z(()=>{"use strict";o(fZe,"cacheHas");OS=fZe});function gZe(e,t,r,i,n,a){var s=r&pZe,l=e.length,u=t.length;if(l!=u&&!(s&&u>l))return!1;var h=a.get(e),d=a.get(t);if(h&&d)return h==t&&d==e;var f=-1,p=!0,m=r&mZe?new IS:void 0;for(a.set(e,t),a.set(t,e);++f{"use strict";yI();bce();vI();pZe=1,mZe=2;o(gZe,"equalArrays");PS=gZe});function yZe(e){var t=-1,r=Array(e.size);return e.forEach(function(i,n){r[++t]=[n,i]}),r}var Tce,Cce=z(()=>{"use strict";o(yZe,"mapToArray");Tce=yZe});function vZe(e){var t=-1,r=Array(e.size);return e.forEach(function(i){r[++t]=i}),r}var Ug,BS=z(()=>{"use strict";o(vZe,"setToArray");Ug=vZe});function MZe(e,t,r,i,n,a,s){switch(r){case LZe:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case RZe:return!(e.byteLength!=t.byteLength||!a(new Wg(e),new Wg(t)));case TZe:case CZe:case SZe:return Vo(+e,+t);case kZe:return e.name==t.name&&e.message==t.message;case EZe:case _Ze:return e==t+"";case wZe:var l=Tce;case AZe:var u=i&xZe;if(l||(l=Ug),e.size!=t.size&&!u)return!1;var h=s.get(e);if(h)return h==t;i|=bZe,s.set(e,t);var d=PS(l(e),l(t),i,n,a,s);return s.delete(e),d;case DZe:if(bI)return bI.call(e)==bI.call(t)}return!1}var xZe,bZe,TZe,CZe,kZe,wZe,SZe,EZe,AZe,_Ze,DZe,RZe,LZe,kce,bI,wce,Sce=z(()=>{"use strict";Mp();hI();Ip();xI();Cce();BS();xZe=1,bZe=2,TZe="[object Boolean]",CZe="[object Date]",kZe="[object Error]",wZe="[object Map]",SZe="[object Number]",EZe="[object RegExp]",AZe="[object Set]",_Ze="[object String]",DZe="[object Symbol]",RZe="[object ArrayBuffer]",LZe="[object DataView]",kce=ra?ra.prototype:void 0,bI=kce?kce.valueOf:void 0;o(MZe,"equalByTag");wce=MZe});function PZe(e,t,r,i,n,a){var s=r&NZe,l=wb(e),u=l.length,h=wb(t),d=h.length;if(u!=d&&!s)return!1;for(var f=u;f--;){var p=l[f];if(!(s?p in t:OZe.call(t,p)))return!1}var m=a.get(e),g=a.get(t);if(m&&g)return m==t&&g==e;var y=!0;a.set(e,t),a.set(t,e);for(var v=s;++f{"use strict";cI();NZe=1,IZe=Object.prototype,OZe=IZe.hasOwnProperty;o(PZe,"equalObjects");Ece=PZe});function $Ze(e,t,r,i,n,a){var s=Or(e),l=Or(t),u=s?Dce:lo(e),h=l?Dce:lo(t);u=u==_ce?FS:u,h=h==_ce?FS:h;var d=u==FS,f=h==FS,p=u==h;if(p&&Pl(e)){if(!Pl(t))return!1;s=!0,d=!1}if(p&&!d)return a||(a=new Dc),s||Cd(e)?PS(e,t,r,i,n,a):wce(e,t,u,r,i,n,a);if(!(r&BZe)){var m=d&&Rce.call(e,"__wrapped__"),g=f&&Rce.call(t,"__wrapped__");if(m||g){var y=m?e.value():e,v=g?t.value():t;return a||(a=new Dc),n(y,v,r,i,a)}}return p?(a||(a=new Dc),Ece(e,t,r,i,n,a)):!1}var BZe,_ce,Dce,FS,FZe,Rce,Lce,Mce=z(()=>{"use strict";kb();xI();Sce();Ace();Bp();An();Lg();gb();BZe=1,_ce="[object Arguments]",Dce="[object Array]",FS="[object Object]",FZe=Object.prototype,Rce=FZe.hasOwnProperty;o($Ze,"baseIsEqualDeep");Lce=$Ze});function Nce(e,t,r,i,n){return e===t?!0:e==null||t==null||!yn(e)&&!yn(t)?e!==e&&t!==t:Lce(e,t,r,i,Nce,n)}var $S,TI=z(()=>{"use strict";Mce();Il();o(Nce,"baseIsEqual");$S=Nce});function VZe(e,t,r,i){var n=r.length,a=n,s=!i;if(e==null)return!a;for(e=Object(e);n--;){var l=r[n];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++n{"use strict";kb();TI();zZe=1,GZe=2;o(VZe,"baseIsMatch");Ice=VZe});function WZe(e){return e===e&&!Hi(e)}var zS,CI=z(()=>{"use strict";Go();o(WZe,"isStrictComparable");zS=WZe});function qZe(e){for(var t=cn(e),r=t.length;r--;){var i=t[r],n=e[i];t[r]=[i,n,zS(n)]}return t}var Pce,Bce=z(()=>{"use strict";CI();qu();o(qZe,"getMatchData");Pce=qZe});function UZe(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var GS,kI=z(()=>{"use strict";o(UZe,"matchesStrictComparable");GS=UZe});function HZe(e){var t=Pce(e);return t.length==1&&t[0][2]?GS(t[0][0],t[0][1]):function(r){return r===e||Ice(r,e,t)}}var Fce,$ce=z(()=>{"use strict";Oce();Bce();kI();o(HZe,"baseMatches");Fce=HZe});function YZe(e,t){return e!=null&&t in Object(e)}var zce,Gce=z(()=>{"use strict";o(YZe,"baseHasIn");zce=YZe});function jZe(e,t,r){t=_d(t,e);for(var i=-1,n=t.length,a=!1;++i{"use strict";Tb();Rg();An();lb();lS();Bg();o(jZe,"hasPath");VS=jZe});function XZe(e,t){return e!=null&&VS(e,t,zce)}var WS,SI=z(()=>{"use strict";Gce();wI();o(XZe,"hasIn");WS=XZe});function QZe(e,t){return Ng(e)&&zS(t)?GS(_c(e),t):function(r){var i=Xoe(r,e);return i===void 0&&i===t?WS(r,e):$S(t,i,KZe|ZZe)}}var KZe,ZZe,Vce,Wce=z(()=>{"use strict";TI();Koe();SI();fS();CI();kI();Bg();KZe=1,ZZe=2;o(QZe,"baseMatchesProperty");Vce=QZe});function JZe(e){return function(t){return t?.[e]}}var qS,EI=z(()=>{"use strict";o(JZe,"baseProperty");qS=JZe});function eQe(e){return function(t){return Dd(t,e)}}var qce,Uce=z(()=>{"use strict";Cb();o(eQe,"basePropertyDeep");qce=eQe});function tQe(e){return Ng(e)?qS(_c(e)):qce(e)}var Hce,Yce=z(()=>{"use strict";EI();Uce();fS();Bg();o(tQe,"property");Hce=tQe});function rQe(e){return typeof e=="function"?e:e==null?Ls:typeof e=="object"?Or(e)?Vce(e[0],e[1]):Fce(e):Hce(e)}var Ia,Hu=z(()=>{"use strict";$ce();Wce();pd();An();Yce();o(rQe,"baseIteratee");Ia=rQe});function iQe(e){return function(t,r,i){for(var n=-1,a=Object(t),s=i(t),l=s.length;l--;){var u=s[e?l:++n];if(r(a[u],u,a)===!1)break}return t}}var jce,Xce=z(()=>{"use strict";o(iQe,"createBaseFor");jce=iQe});var nQe,Hg,US=z(()=>{"use strict";Xce();nQe=jce(),Hg=nQe});function aQe(e,t){return e&&Hg(e,t,cn)}var Yg,HS=z(()=>{"use strict";US();qu();o(aQe,"baseForOwn");Yg=aQe});function sQe(e,t){return function(r,i){if(r==null)return r;if(!ia(r))return e(r,i);for(var n=r.length,a=t?n:-1,s=Object(r);(t?a--:++a{"use strict";Ac();o(sQe,"createBaseEach");Kce=sQe});var oQe,Ld,Sb=z(()=>{"use strict";HS();Zce();oQe=Kce(Yg),Ld=oQe});var lQe,YS,Qce=z(()=>{"use strict";zo();lQe=o(function(){return ln.Date.now()},"now"),YS=lQe});var Jce,cQe,uQe,AI,eue=z(()=>{"use strict";hb();Ip();db();kd();Jce=Object.prototype,cQe=Jce.hasOwnProperty,uQe=xd(function(e,t){e=Object(e);var r=-1,i=t.length,n=i>2?t[2]:void 0;for(n&&Vu(t[0],t[1],n)&&(i=1);++r{"use strict";cb();Ip();o(hQe,"assignMergeValue");Eb=hQe});function dQe(e){return yn(e)&&ia(e)}var jS,DI=z(()=>{"use strict";Ac();Il();o(dQe,"isArrayLikeObject");jS=dQe});function fQe(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Ab,RI=z(()=>{"use strict";o(fQe,"safeGet");Ab=fQe});function pQe(e){return Ec(e,Is(e))}var tue,rue=z(()=>{"use strict";_g();kd();o(pQe,"toPlainObject");tue=pQe});function mQe(e,t,r,i,n,a,s){var l=Ab(e,r),u=Ab(t,r),h=s.get(u);if(h){Eb(e,r,h);return}var d=a?a(l,u,r+"",e,t,s):void 0,f=d===void 0;if(f){var p=Or(u),m=!p&&Pl(u),g=!p&&!m&&Cd(u);d=u,p||m||g?Or(l)?d=l:jS(l)?d=iS(l):m?(f=!1,d=bS(u,!0)):g?(f=!1,d=DS(u,!0)):d=[]:nle(u)||Ol(u)?(d=l,Ol(l)?d=tue(l):(!Hi(l)||Sc(l))&&(d=RS(u))):f=!1}f&&(s.set(u,d),n(d,u,i,a,s),s.delete(u)),Eb(e,r,d)}var iue,nue=z(()=>{"use strict";_I();nI();dI();WN();fI();Rg();An();DI();Lg();ob();Go();ale();gb();RI();rue();o(mQe,"baseMergeDeep");iue=mQe});function aue(e,t,r,i,n){e!==t&&Hg(t,function(a,s){if(n||(n=new Dc),Hi(a))iue(e,t,s,r,aue,i,n);else{var l=i?i(Ab(e,s),a,s+"",e,t,n):void 0;l===void 0&&(l=a),Eb(e,s,l)}},Is)}var sue,oue=z(()=>{"use strict";kb();_I();US();nue();Go();kd();RI();o(aue,"baseMerge");sue=aue});function gQe(e,t,r){for(var i=-1,n=e==null?0:e.length;++i{"use strict";o(gQe,"arrayIncludesWith");lue=gQe});function yQe(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Md,uue=z(()=>{"use strict";o(yQe,"last");Md=yQe});function vQe(e){return typeof e=="function"?e:Ls}var jg,XS=z(()=>{"use strict";pd();o(vQe,"castFunction");jg=vQe});function xQe(e,t){var r=Or(e)?aS:Ld;return r(e,jg(t))}var tt,LI=z(()=>{"use strict";YN();Sb();XS();An();o(xQe,"forEach");tt=xQe});var hue=z(()=>{"use strict";LI()});function bQe(e,t){var r=[];return Ld(e,function(i,n,a){t(i,n,a)&&r.push(i)}),r}var due,fue=z(()=>{"use strict";Sb();o(bQe,"baseFilter");due=bQe});function TQe(e,t){var r=Or(e)?TS:due;return r(e,Ia(t,3))}var ts,pue=z(()=>{"use strict";aI();fue();Hu();An();o(TQe,"filter");ts=TQe});function CQe(e){return function(t,r,i){var n=Object(t);if(!ia(t)){var a=Ia(r,3);t=cn(t),r=o(function(l){return a(n[l],l,n)},"predicate")}var s=e(t,r,i);return s>-1?n[a?t[s]:s]:void 0}}var mue,gue=z(()=>{"use strict";Hu();Ac();qu();o(CQe,"createFind");mue=CQe});function wQe(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var n=r==null?0:dse(r);return n<0&&(n=kQe(i+n,0)),sS(e,Ia(t,3),n)}var kQe,yue,vue=z(()=>{"use strict";jN();Hu();fse();kQe=Math.max;o(wQe,"findIndex");yue=wQe});var SQe,Xg,xue=z(()=>{"use strict";gue();vue();SQe=mue(yue),Xg=SQe});function EQe(e,t){var r=-1,i=ia(e)?Array(e.length):[];return Ld(e,function(n,a,s){i[++r]=t(n,a,s)}),i}var KS,MI=z(()=>{"use strict";Sb();Ac();o(EQe,"baseMap");KS=EQe});function AQe(e,t){var r=Or(e)?wc:KS;return r(e,Ia(t,3))}var Jr,bue=z(()=>{"use strict";sb();Hu();MI();An();o(AQe,"map");Jr=AQe});function _Qe(e,t){return e==null?e:Hg(e,jg(t),Is)}var NI,Tue=z(()=>{"use strict";US();XS();kd();o(_Qe,"forIn");NI=_Qe});function DQe(e,t){return e&&Yg(e,jg(t))}var II,Cue=z(()=>{"use strict";HS();XS();o(DQe,"forOwn");II=DQe});function RQe(e,t){return e>t}var kue,wue=z(()=>{"use strict";o(RQe,"baseGt");kue=RQe});function NQe(e,t){return e!=null&&MQe.call(e,t)}var LQe,MQe,Sue,Eue=z(()=>{"use strict";LQe=Object.prototype,MQe=LQe.hasOwnProperty;o(NQe,"baseHas");Sue=NQe});function IQe(e,t){return e!=null&&VS(e,t,Sue)}var _b,Aue=z(()=>{"use strict";Eue();wI();o(IQe,"has");_b=IQe});function PQe(e){return typeof e=="string"||!Or(e)&&yn(e)&&es(e)==OQe}var OQe,_ue,Due=z(()=>{"use strict";fd();An();Il();OQe="[object String]";o(PQe,"isString");_ue=PQe});function BQe(e,t){return wc(t,function(r){return e[r]})}var Rue,Lue=z(()=>{"use strict";sb();o(BQe,"baseValues");Rue=BQe});function FQe(e){return e==null?[]:Rue(e,cn(e))}var co,Mue=z(()=>{"use strict";Lue();qu();o(FQe,"values");co=FQe});function WQe(e){if(e==null)return!0;if(ia(e)&&(Or(e)||typeof e=="string"||typeof e.splice=="function"||Pl(e)||Cd(e)||Ol(e)))return!e.length;var t=lo(e);if(t==$Qe||t==zQe)return!e.size;if(bd(e))return!Mg(e).length;for(var r in e)if(VQe.call(e,r))return!1;return!0}var $Qe,zQe,GQe,VQe,ZS,Nue=z(()=>{"use strict";dS();Bp();Rg();An();Ac();Lg();fb();gb();$Qe="[object Map]",zQe="[object Set]",GQe=Object.prototype,VQe=GQe.hasOwnProperty;o(WQe,"isEmpty");ZS=WQe});function qQe(e){return e===void 0}var yi,Iue=z(()=>{"use strict";o(qQe,"isUndefined");yi=qQe});function UQe(e,t){return e{"use strict";o(UQe,"baseLt");QS=UQe});function HQe(e,t){var r={};return t=Ia(t,3),Yg(e,function(i,n,a){yd(r,n,t(i,n,a))}),r}var Fp,Oue=z(()=>{"use strict";cb();HS();Hu();o(HQe,"mapValues");Fp=HQe});function YQe(e,t,r){for(var i=-1,n=e.length;++i{"use strict";Np();o(YQe,"baseExtremum");Kg=YQe});function jQe(e){return e&&e.length?Kg(e,Ls,kue):void 0}var Os,Pue=z(()=>{"use strict";JS();wue();pd();o(jQe,"max");Os=jQe});var XQe,Zg,Bue=z(()=>{"use strict";oue();qse();XQe=Wse(function(e,t,r){sue(e,t,r)}),Zg=XQe});function KQe(e){return e&&e.length?Kg(e,Ls,QS):void 0}var Yu,Fue=z(()=>{"use strict";JS();OI();pd();o(KQe,"min");Yu=KQe});function ZQe(e,t){return e&&e.length?Kg(e,Ia(t,2),QS):void 0}var $p,$ue=z(()=>{"use strict";JS();Hu();OI();o(ZQe,"minBy");$p=ZQe});function QQe(e,t,r,i){if(!Hi(e))return e;t=_d(t,e);for(var n=-1,a=t.length,s=a-1,l=e;l!=null&&++n{"use strict";ub();Tb();lb();Go();Bg();o(QQe,"baseSet");zue=QQe});function JQe(e,t,r){for(var i=-1,n=t.length,a={};++i{"use strict";Cb();Gue();Tb();o(JQe,"basePickBy");Vue=JQe});function eJe(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}var que,Uue=z(()=>{"use strict";o(eJe,"baseSortBy");que=eJe});function tJe(e,t){if(e!==t){var r=e!==void 0,i=e===null,n=e===e,a=oo(e),s=t!==void 0,l=t===null,u=t===t,h=oo(t);if(!l&&!h&&!a&&e>t||a&&s&&u&&!l&&!h||i&&s&&u||!r&&u||!n)return 1;if(!i&&!a&&!h&&e{"use strict";Np();o(tJe,"compareAscending");Hue=tJe});function rJe(e,t,r){for(var i=-1,n=e.criteria,a=t.criteria,s=n.length,l=r.length;++i=l)return u;var h=r[i];return u*(h=="desc"?-1:1)}}return e.index-t.index}var jue,Xue=z(()=>{"use strict";Yue();o(rJe,"compareMultiple");jue=rJe});function iJe(e,t,r){t.length?t=wc(t,function(a){return Or(a)?function(s){return Dd(s,a.length===1?a[0]:a)}:a}):t=[Ls];var i=-1;t=wc(t,Td(Ia));var n=KS(e,function(a,s,l){var u=wc(t,function(h){return h(a)});return{criteria:u,index:++i,value:a}});return que(n,function(a,s){return jue(a,s,r)})}var Kue,Zue=z(()=>{"use strict";sb();Cb();Hu();MI();Uue();pb();Xue();pd();An();o(iJe,"baseOrderBy");Kue=iJe});var nJe,Que,Jue=z(()=>{"use strict";EI();nJe=qS("length"),Que=nJe});function gJe(e){for(var t=ehe.lastIndex=0;ehe.test(e);)++t;return t}var the,aJe,sJe,oJe,lJe,cJe,uJe,PI,BI,hJe,rhe,ihe,nhe,dJe,ahe,she,fJe,pJe,mJe,ehe,ohe,lhe=z(()=>{"use strict";the="\\ud800-\\udfff",aJe="\\u0300-\\u036f",sJe="\\ufe20-\\ufe2f",oJe="\\u20d0-\\u20ff",lJe=aJe+sJe+oJe,cJe="\\ufe0e\\ufe0f",uJe="["+the+"]",PI="["+lJe+"]",BI="\\ud83c[\\udffb-\\udfff]",hJe="(?:"+PI+"|"+BI+")",rhe="[^"+the+"]",ihe="(?:\\ud83c[\\udde6-\\uddff]){2}",nhe="[\\ud800-\\udbff][\\udc00-\\udfff]",dJe="\\u200d",ahe=hJe+"?",she="["+cJe+"]?",fJe="(?:"+dJe+"(?:"+[rhe,ihe,nhe].join("|")+")"+she+ahe+")*",pJe=she+ahe+fJe,mJe="(?:"+[rhe+PI+"?",PI,ihe,nhe,uJe].join("|")+")",ehe=RegExp(BI+"(?="+BI+")|"+mJe+pJe,"g");o(gJe,"unicodeSize");ohe=gJe});function yJe(e){return sle(e)?ohe(e):Que(e)}var che,uhe=z(()=>{"use strict";Jue();ole();lhe();o(yJe,"stringSize");che=yJe});function vJe(e,t){return Vue(e,t,function(r,i){return WS(e,i)})}var hhe,dhe=z(()=>{"use strict";Wue();SI();o(vJe,"basePick");hhe=vJe});var xJe,zp,fhe=z(()=>{"use strict";dhe();rle();xJe=tle(function(e,t){return e==null?{}:hhe(e,t)}),zp=xJe});function CJe(e,t,r,i){for(var n=-1,a=TJe(bJe((t-e)/(r||1)),0),s=Array(a);a--;)s[i?a:++n]=e,e+=r;return s}var bJe,TJe,phe,mhe=z(()=>{"use strict";bJe=Math.ceil,TJe=Math.max;o(CJe,"baseRange");phe=CJe});function kJe(e){return function(t,r,i){return i&&typeof i!="number"&&Vu(t,r,i)&&(r=i=void 0),t=Eg(t),r===void 0?(r=t,t=0):r=Eg(r),i=i===void 0?t{"use strict";mhe();db();GN();o(kJe,"createRange");ghe=kJe});var wJe,qo,vhe=z(()=>{"use strict";yhe();wJe=ghe(),qo=wJe});function SJe(e,t,r,i,n){return n(e,function(a,s,l){r=i?(i=!1,a):t(r,a,s,l)}),r}var xhe,bhe=z(()=>{"use strict";o(SJe,"baseReduce");xhe=SJe});function EJe(e,t,r){var i=Or(e)?lle:xhe,n=arguments.length<3;return i(e,Ia(t,4),r,n,Ld)}var Rc,The=z(()=>{"use strict";cle();Sb();Hu();bhe();An();o(EJe,"reduce");Rc=EJe});function DJe(e){if(e==null)return 0;if(ia(e))return _ue(e)?che(e):e.length;var t=lo(e);return t==AJe||t==_Je?e.size:Mg(e).length}var AJe,_Je,FI,Che=z(()=>{"use strict";dS();Bp();Ac();Due();uhe();AJe="[object Map]",_Je="[object Set]";o(DJe,"size");FI=DJe});var RJe,Lc,khe=z(()=>{"use strict";vS();Zue();hb();db();RJe=xd(function(e,t){if(e==null)return[];var r=t.length;return r>1&&Vu(e,t[0],t[1])?t=[]:r>2&&Vu(t[0],t[1],t[2])&&(t=[t[0]]),Kue(e,$g(t,1),[])}),Lc=RJe});var LJe,MJe,whe,She=z(()=>{"use strict";uI();Dse();BS();LJe=1/0,MJe=Rd&&1/Ug(new Rd([,-0]))[1]==LJe?function(e){return new Rd(e)}:_se,whe=MJe});function IJe(e,t,r){var i=-1,n=zse,a=e.length,s=!0,l=[],u=l;if(r)s=!1,n=lue;else if(a>=NJe){var h=t?null:whe(e);if(h)return Ug(h);s=!1,n=OS,u=new IS}else u=t?[]:l;e:for(;++i{"use strict";yI();Gse();cue();vI();She();BS();NJe=200;o(IJe,"baseUniq");Ehe=IJe});var OJe,$I,_he=z(()=>{"use strict";vS();hb();Ahe();DI();OJe=xd(function(e){return Ehe($g(e,1,jS,!0))}),$I=OJe});function BJe(e){var t=++PJe;return gS(e)+t}var PJe,Gp,Dhe=z(()=>{"use strict";rI();PJe=0;o(BJe,"uniqueId");Gp=BJe});function FJe(e,t,r){for(var i=-1,n=e.length,a=t.length,s={};++i{"use strict";o(FJe,"baseZipObject");Rhe=FJe});function $Je(e,t){return Rhe(e||[],t||[],vd)}var e3,Mhe=z(()=>{"use strict";ub();Lhe();o($Je,"zipObject");e3=$Je});var ci=z(()=>{"use strict";fce();pce();qN();eue();hue();pue();xue();iI();LI();Tue();Cue();Aue();An();Nue();ob();Iue();qu();uue();bue();Oue();Pue();Bue();Fue();$ue();Qce();fhe();vhe();The();Che();khe();_he();Dhe();Mue();Mhe();});function Ihe(e,t){e[t]?e[t]++:e[t]=1}function Ohe(e,t){--e[t]||delete e[t]}function Db(e,t,r,i){var n=""+t,a=""+r;if(!e&&n>a){var s=n;n=a,a=s}return n+Nhe+a+Nhe+(yi(i)?zJe:i)}function GJe(e,t,r,i){var n=""+t,a=""+r;if(!e&&n>a){var s=n;n=a,a=s}var l={v:n,w:a};return i&&(l.name=i),l}function zI(e,t){return Db(e,t.v,t.w,t.name)}var zJe,Vp,Nhe,ui,t3=z(()=>{"use strict";ci();zJe="\0",Vp="\0",Nhe="",ui=class{static{o(this,"Graph")}constructor(t={}){this._isDirected=Object.prototype.hasOwnProperty.call(t,"directed")?t.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(t,"multigraph")?t.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(t,"compound")?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=Ns(void 0),this._defaultEdgeLabelFn=Ns(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[Vp]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return Sc(t)||(t=Ns(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return cn(this._nodes)}sources(){var t=this;return ts(this.nodes(),function(r){return ZS(t._in[r])})}sinks(){var t=this;return ts(this.nodes(),function(r){return ZS(t._out[r])})}setNodes(t,r){var i=arguments,n=this;return tt(t,function(a){i.length>1?n.setNode(a,r):n.setNode(a)}),this}setNode(t,r){return Object.prototype.hasOwnProperty.call(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=Vp,this._children[t]={},this._children[Vp][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var r=o(i=>this.removeEdge(this._edgeObjs[i]),"removeEdge");delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],tt(this.children(t),i=>{this.setParent(i)}),delete this._children[t]),tt(cn(this._in[t]),r),delete this._in[t],delete this._preds[t],tt(cn(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(yi(r))r=Vp;else{r+="";for(var i=r;!yi(i);i=this.parent(i))if(i===t)throw new Error("Setting "+r+" as parent of "+t+" would create a cycle");this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var r=this._parent[t];if(r!==Vp)return r}}children(t){if(yi(t)&&(t=Vp),this._isCompound){var r=this._children[t];if(r)return cn(r)}else{if(t===Vp)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var r=this._preds[t];if(r)return cn(r)}successors(t){var r=this._sucs[t];if(r)return cn(r)}neighbors(t){var r=this.predecessors(t);if(r)return $I(r,this.successors(t))}isLeaf(t){var r;return this.isDirected()?r=this.successors(t):r=this.neighbors(t),r.length===0}filterNodes(t){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var i=this;tt(this._nodes,function(s,l){t(l)&&r.setNode(l,s)}),tt(this._edgeObjs,function(s){r.hasNode(s.v)&&r.hasNode(s.w)&&r.setEdge(s,i.edge(s))});var n={};function a(s){var l=i.parent(s);return l===void 0||r.hasNode(l)?(n[s]=l,l):l in n?n[l]:a(l)}return o(a,"findParent"),this._isCompound&&tt(r.nodes(),function(s){r.setParent(s,a(s))}),r}setDefaultEdgeLabel(t){return Sc(t)||(t=Ns(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return co(this._edgeObjs)}setPath(t,r){var i=this,n=arguments;return Rc(t,function(a,s){return n.length>1?i.setEdge(a,s,r):i.setEdge(a,s),s}),this}setEdge(){var t,r,i,n,a=!1,s=arguments[0];typeof s=="object"&&s!==null&&"v"in s?(t=s.v,r=s.w,i=s.name,arguments.length===2&&(n=arguments[1],a=!0)):(t=s,r=arguments[1],i=arguments[3],arguments.length>2&&(n=arguments[2],a=!0)),t=""+t,r=""+r,yi(i)||(i=""+i);var l=Db(this._isDirected,t,r,i);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,l))return a&&(this._edgeLabels[l]=n),this;if(!yi(i)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(r),this._edgeLabels[l]=a?n:this._defaultEdgeLabelFn(t,r,i);var u=GJe(this._isDirected,t,r,i);return t=u.v,r=u.w,Object.freeze(u),this._edgeObjs[l]=u,Ihe(this._preds[r],t),Ihe(this._sucs[t],r),this._in[r][l]=u,this._out[t][l]=u,this._edgeCount++,this}edge(t,r,i){var n=arguments.length===1?zI(this._isDirected,arguments[0]):Db(this._isDirected,t,r,i);return this._edgeLabels[n]}hasEdge(t,r,i){var n=arguments.length===1?zI(this._isDirected,arguments[0]):Db(this._isDirected,t,r,i);return Object.prototype.hasOwnProperty.call(this._edgeLabels,n)}removeEdge(t,r,i){var n=arguments.length===1?zI(this._isDirected,arguments[0]):Db(this._isDirected,t,r,i),a=this._edgeObjs[n];return a&&(t=a.v,r=a.w,delete this._edgeLabels[n],delete this._edgeObjs[n],Ohe(this._preds[r],t),Ohe(this._sucs[t],r),delete this._in[r][n],delete this._out[t][n],this._edgeCount--),this}inEdges(t,r){var i=this._in[t];if(i){var n=co(i);return r?ts(n,function(a){return a.v===r}):n}}outEdges(t,r){var i=this._out[t];if(i){var n=co(i);return r?ts(n,function(a){return a.w===r}):n}}nodeEdges(t,r){var i=this.inEdges(t,r);if(i)return i.concat(this.outEdges(t,r))}};ui.prototype._nodeCount=0;ui.prototype._edgeCount=0;o(Ihe,"incrementOrInitEntry");o(Ohe,"decrementOrRemoveEntry");o(Db,"edgeArgsToId");o(GJe,"edgeArgsToObj");o(zI,"edgeObjToId")});var Uo=z(()=>{"use strict";t3()});function Phe(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function VJe(e,t){if(e!=="_next"&&e!=="_prev")return t}var i3,Bhe=z(()=>{"use strict";i3=class{static{o(this,"List")}constructor(){var t={};t._next=t._prev=t,this._sentinel=t}dequeue(){var t=this._sentinel,r=t._prev;if(r!==t)return Phe(r),r}enqueue(t){var r=this._sentinel;t._prev&&t._next&&Phe(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r}toString(){for(var t=[],r=this._sentinel,i=r._prev;i!==r;)t.push(JSON.stringify(i,VJe)),i=i._prev;return"["+t.join(", ")+"]"}};o(Phe,"unlink");o(VJe,"filterOutLinks")});function Fhe(e,t){if(e.nodeCount()<=1)return[];var r=UJe(e,t||WJe),i=qJe(r.graph,r.buckets,r.zeroIdx);return Wo(Jr(i,function(n){return e.outEdges(n.v,n.w)}))}function qJe(e,t,r){for(var i=[],n=t[t.length-1],a=t[0],s;e.nodeCount();){for(;s=a.dequeue();)GI(e,t,r,s);for(;s=n.dequeue();)GI(e,t,r,s);if(e.nodeCount()){for(var l=t.length-2;l>0;--l)if(s=t[l].dequeue(),s){i=i.concat(GI(e,t,r,s,!0));break}}}return i}function GI(e,t,r,i,n){var a=n?[]:void 0;return tt(e.inEdges(i.v),function(s){var l=e.edge(s),u=e.node(s.v);n&&a.push({v:s.v,w:s.w}),u.out-=l,VI(t,r,u)}),tt(e.outEdges(i.v),function(s){var l=e.edge(s),u=s.w,h=e.node(u);h.in-=l,VI(t,r,h)}),e.removeNode(i.v),a}function UJe(e,t){var r=new ui,i=0,n=0;tt(e.nodes(),function(l){r.setNode(l,{v:l,in:0,out:0})}),tt(e.edges(),function(l){var u=r.edge(l.v,l.w)||0,h=t(l),d=u+h;r.setEdge(l.v,l.w,d),n=Math.max(n,r.node(l.v).out+=h),i=Math.max(i,r.node(l.w).in+=h)});var a=qo(n+i+3).map(function(){return new i3}),s=i+1;return tt(r.nodes(),function(l){VI(a,s,r.node(l))}),{graph:r,buckets:a,zeroIdx:s}}function VI(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}var WJe,$he=z(()=>{"use strict";ci();Uo();Bhe();WJe=Ns(1);o(Fhe,"greedyFAS");o(qJe,"doGreedyFAS");o(GI,"removeNode");o(UJe,"buildState");o(VI,"assignBucket")});function zhe(e){var t=e.graph().acyclicer==="greedy"?Fhe(e,r(e)):HJe(e);tt(t,function(i){var n=e.edge(i);e.removeEdge(i),n.forwardName=i.name,n.reversed=!0,e.setEdge(i.w,i.v,n,Gp("rev"))});function r(i){return function(n){return i.edge(n).weight}}o(r,"weightFn")}function HJe(e){var t=[],r={},i={};function n(a){Object.prototype.hasOwnProperty.call(i,a)||(i[a]=!0,r[a]=!0,tt(e.outEdges(a),function(s){Object.prototype.hasOwnProperty.call(r,s.w)?t.push(s):n(s.w)}),delete r[a])}return o(n,"dfs"),tt(e.nodes(),n),t}function Ghe(e){tt(e.edges(),function(t){var r=e.edge(t);if(r.reversed){e.removeEdge(t);var i=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,i)}})}var WI=z(()=>{"use strict";ci();$he();o(zhe,"run");o(HJe,"dfsFAS");o(Ghe,"undo")});function Mc(e,t,r,i){var n;do n=Gp(i);while(e.hasNode(n));return r.dummy=t,e.setNode(n,r),n}function Whe(e){var t=new ui().setGraph(e.graph());return tt(e.nodes(),function(r){t.setNode(r,e.node(r))}),tt(e.edges(),function(r){var i=t.edge(r.v,r.w)||{weight:0,minlen:1},n=e.edge(r);t.setEdge(r.v,r.w,{weight:i.weight+n.weight,minlen:Math.max(i.minlen,n.minlen)})}),t}function n3(e){var t=new ui({multigraph:e.isMultigraph()}).setGraph(e.graph());return tt(e.nodes(),function(r){e.children(r).length||t.setNode(r,e.node(r))}),tt(e.edges(),function(r){t.setEdge(r,e.edge(r))}),t}function qI(e,t){var r=e.x,i=e.y,n=t.x-r,a=t.y-i,s=e.width/2,l=e.height/2;if(!n&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var u,h;return Math.abs(a)*s>Math.abs(n)*l?(a<0&&(l=-l),u=l*n/a,h=l):(n<0&&(s=-s),u=s,h=s*a/n),{x:r+u,y:i+h}}function Nd(e){var t=Jr(qo(HI(e)+1),function(){return[]});return tt(e.nodes(),function(r){var i=e.node(r),n=i.rank;yi(n)||(t[n][i.order]=r)}),t}function qhe(e){var t=Yu(Jr(e.nodes(),function(r){return e.node(r).rank}));tt(e.nodes(),function(r){var i=e.node(r);_b(i,"rank")&&(i.rank-=t)})}function Uhe(e){var t=Yu(Jr(e.nodes(),function(a){return e.node(a).rank})),r=[];tt(e.nodes(),function(a){var s=e.node(a).rank-t;r[s]||(r[s]=[]),r[s].push(a)});var i=0,n=e.graph().nodeRankFactor;tt(r,function(a,s){yi(a)&&s%n!==0?--i:i&&tt(a,function(l){e.node(l).rank+=i})})}function UI(e,t,r,i){var n={width:0,height:0};return arguments.length>=4&&(n.rank=r,n.order=i),Mc(e,"border",n,t)}function HI(e){return Os(Jr(e.nodes(),function(t){var r=e.node(t).rank;if(!yi(r))return r}))}function Hhe(e,t){var r={lhs:[],rhs:[]};return tt(e,function(i){t(i)?r.lhs.push(i):r.rhs.push(i)}),r}function Yhe(e,t){var r=YS();try{return t()}finally{console.log(e+" time: "+(YS()-r)+"ms")}}function jhe(e,t){return t()}var Nc=z(()=>{"use strict";ci();Uo();o(Mc,"addDummyNode");o(Whe,"simplify");o(n3,"asNonCompoundGraph");o(qI,"intersectRect");o(Nd,"buildLayerMatrix");o(qhe,"normalizeRanks");o(Uhe,"removeEmptyRanks");o(UI,"addBorderNode");o(HI,"maxRank");o(Hhe,"partition");o(Yhe,"time");o(jhe,"notime")});function Khe(e){function t(r){var i=e.children(r),n=e.node(r);if(i.length&&tt(i,t),Object.prototype.hasOwnProperty.call(n,"minRank")){n.borderLeft=[],n.borderRight=[];for(var a=n.minRank,s=n.maxRank+1;a{"use strict";ci();Nc();o(Khe,"addBorderSegments");o(Xhe,"addBorderNode")});function Jhe(e){var t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&tde(e)}function ede(e){var t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&YJe(e),(t==="lr"||t==="rl")&&(jJe(e),tde(e))}function tde(e){tt(e.nodes(),function(t){Qhe(e.node(t))}),tt(e.edges(),function(t){Qhe(e.edge(t))})}function Qhe(e){var t=e.width;e.width=e.height,e.height=t}function YJe(e){tt(e.nodes(),function(t){YI(e.node(t))}),tt(e.edges(),function(t){var r=e.edge(t);tt(r.points,YI),Object.prototype.hasOwnProperty.call(r,"y")&&YI(r)})}function YI(e){e.y=-e.y}function jJe(e){tt(e.nodes(),function(t){jI(e.node(t))}),tt(e.edges(),function(t){var r=e.edge(t);tt(r.points,jI),Object.prototype.hasOwnProperty.call(r,"x")&&jI(r)})}function jI(e){var t=e.x;e.x=e.y,e.y=t}var rde=z(()=>{"use strict";ci();o(Jhe,"adjust");o(ede,"undo");o(tde,"swapWidthHeight");o(Qhe,"swapWidthHeightOne");o(YJe,"reverseY");o(YI,"reverseYOne");o(jJe,"swapXY");o(jI,"swapXYOne")});function ide(e){e.graph().dummyChains=[],tt(e.edges(),function(t){KJe(e,t)})}function KJe(e,t){var r=t.v,i=e.node(r).rank,n=t.w,a=e.node(n).rank,s=t.name,l=e.edge(t),u=l.labelRank;if(a!==i+1){e.removeEdge(t);var h=void 0,d,f;for(f=0,++i;i{"use strict";ci();Nc();o(ide,"run");o(KJe,"normalizeEdge");o(nde,"undo")});function Rb(e){var t={};function r(i){var n=e.node(i);if(Object.prototype.hasOwnProperty.call(t,i))return n.rank;t[i]=!0;var a=Yu(Jr(e.outEdges(i),function(s){return r(s.w)-e.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),n.rank=a}o(r,"dfs"),tt(e.sources(),r)}function Wp(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var a3=z(()=>{"use strict";ci();o(Rb,"longestPath");o(Wp,"slack")});function s3(e){var t=new ui({directed:!1}),r=e.nodes()[0],i=e.nodeCount();t.setNode(r,{});for(var n,a;ZJe(t,e){"use strict";ci();Uo();a3();o(s3,"feasibleTree");o(ZJe,"tightTree");o(QJe,"findMinSlackEdge");o(JJe,"shiftRanks")});var sde=z(()=>{"use strict"});var ZI=z(()=>{"use strict"});var H2r,QI=z(()=>{"use strict";ci();ZI();H2r=Ns(1)});var ode=z(()=>{"use strict";QI()});var JI=z(()=>{"use strict"});var lde=z(()=>{"use strict";JI()});var iTr,cde=z(()=>{"use strict";ci();iTr=Ns(1)});function e9(e){var t={},r={},i=[];function n(a){if(Object.prototype.hasOwnProperty.call(r,a))throw new Lb;Object.prototype.hasOwnProperty.call(t,a)||(r[a]=!0,t[a]=!0,tt(e.predecessors(a),n),delete r[a],i.push(a))}if(o(n,"visit"),tt(e.sinks(),n),FI(t)!==e.nodeCount())throw new Lb;return i}function Lb(){}var t9=z(()=>{"use strict";ci();e9.CycleException=Lb;o(e9,"topsort");o(Lb,"CycleException");Lb.prototype=new Error});var ude=z(()=>{"use strict";t9()});function o3(e,t,r){Or(t)||(t=[t]);var i=(e.isDirected()?e.successors:e.neighbors).bind(e),n=[],a={};return tt(t,function(s){if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);hde(e,s,r==="post",a,i,n)}),n}function hde(e,t,r,i,n,a){Object.prototype.hasOwnProperty.call(i,t)||(i[t]=!0,r||a.push(t),tt(n(t),function(s){hde(e,s,r,i,n,a)}),r&&a.push(t))}var r9=z(()=>{"use strict";ci();o(o3,"dfs");o(hde,"doDfs")});function i9(e,t){return o3(e,t,"post")}var dde=z(()=>{"use strict";r9();o(i9,"postorder")});function n9(e,t){return o3(e,t,"pre")}var fde=z(()=>{"use strict";r9();o(n9,"preorder")});var pde=z(()=>{"use strict";ZI();t3()});var mde=z(()=>{"use strict";sde();QI();ode();lde();cde();ude();dde();fde();pde();JI();t9()});function Od(e){e=Whe(e),Rb(e);var t=s3(e);s9(t),a9(t,e);for(var r,i;r=xde(t);)i=bde(t,e,r),Tde(t,e,r,i)}function a9(e,t){var r=i9(e,e.nodes());r=r.slice(0,r.length-1),tt(r,function(i){net(e,t,i)})}function net(e,t,r){var i=e.node(r),n=i.parent;e.edge(r,n).cutvalue=yde(e,t,r)}function yde(e,t,r){var i=e.node(r),n=i.parent,a=!0,s=t.edge(r,n),l=0;return s||(a=!1,s=t.edge(n,r)),l=s.weight,tt(t.nodeEdges(r),function(u){var h=u.v===r,d=h?u.w:u.v;if(d!==n){var f=h===a,p=t.edge(u).weight;if(l+=f?p:-p,set(e,r,d)){var m=e.edge(r,d).cutvalue;l+=f?-m:m}}}),l}function s9(e,t){arguments.length<2&&(t=e.nodes()[0]),vde(e,{},1,t)}function vde(e,t,r,i,n){var a=r,s=e.node(i);return t[i]=!0,tt(e.neighbors(i),function(l){Object.prototype.hasOwnProperty.call(t,l)||(r=vde(e,t,r,l,i))}),s.low=a,s.lim=r++,n?s.parent=n:delete s.parent,r}function xde(e){return Xg(e.edges(),function(t){return e.edge(t).cutvalue<0})}function bde(e,t,r){var i=r.v,n=r.w;t.hasEdge(i,n)||(i=r.w,n=r.v);var a=e.node(i),s=e.node(n),l=a,u=!1;a.lim>s.lim&&(l=s,u=!0);var h=ts(t.edges(),function(d){return u===gde(e,e.node(d.v),l)&&u!==gde(e,e.node(d.w),l)});return $p(h,function(d){return Wp(t,d)})}function Tde(e,t,r,i){var n=r.v,a=r.w;e.removeEdge(n,a),e.setEdge(i.v,i.w,{}),s9(e),a9(e,t),aet(e,t)}function aet(e,t){var r=Xg(e.nodes(),function(n){return!t.node(n).parent}),i=n9(e,r);i=i.slice(1),tt(i,function(n){var a=e.node(n).parent,s=t.edge(n,a),l=!1;s||(s=t.edge(a,n),l=!0),t.node(n).rank=t.node(a).rank+(l?s.minlen:-s.minlen)})}function set(e,t,r){return e.hasEdge(t,r)}function gde(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}var Cde=z(()=>{"use strict";ci();mde();Nc();KI();a3();Od.initLowLimValues=s9;Od.initCutValues=a9;Od.calcCutValue=yde;Od.leaveEdge=xde;Od.enterEdge=bde;Od.exchangeEdges=Tde;o(Od,"networkSimplex");o(a9,"initCutValues");o(net,"assignCutValue");o(yde,"calcCutValue");o(s9,"initLowLimValues");o(vde,"dfsAssignLowLim");o(xde,"leaveEdge");o(bde,"enterEdge");o(Tde,"exchangeEdges");o(aet,"updateRanks");o(set,"isTreeEdge");o(gde,"isDescendant")});function o9(e){switch(e.graph().ranker){case"network-simplex":kde(e);break;case"tight-tree":cet(e);break;case"longest-path":oet(e);break;default:kde(e)}}function cet(e){Rb(e),s3(e)}function kde(e){Od(e)}var oet,l9=z(()=>{"use strict";KI();Cde();a3();o(o9,"rank");oet=Rb;o(cet,"tightTreeRanker");o(kde,"networkSimplexRanker")});function wde(e){var t=Mc(e,"root",{},"_root"),r=uet(e),i=Os(co(r))-1,n=2*i+1;e.graph().nestingRoot=t,tt(e.edges(),function(s){e.edge(s).minlen*=n});var a=het(e)+1;tt(e.children(),function(s){Sde(e,t,n,a,i,r,s)}),e.graph().nodeRankFactor=n}function Sde(e,t,r,i,n,a,s){var l=e.children(s);if(!l.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:r});return}var u=UI(e,"_bt"),h=UI(e,"_bb"),d=e.node(s);e.setParent(u,s),d.borderTop=u,e.setParent(h,s),d.borderBottom=h,tt(l,function(f){Sde(e,t,r,i,n,a,f);var p=e.node(f),m=p.borderTop?p.borderTop:f,g=p.borderBottom?p.borderBottom:f,y=p.borderTop?i:2*i,v=m!==g?1:n-a[s]+1;e.setEdge(u,m,{weight:y,minlen:v,nestingEdge:!0}),e.setEdge(g,h,{weight:y,minlen:v,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,u,{weight:0,minlen:n+a[s]})}function uet(e){var t={};function r(i,n){var a=e.children(i);a&&a.length&&tt(a,function(s){r(s,n+1)}),t[i]=n}return o(r,"dfs"),tt(e.children(),function(i){r(i,1)}),t}function het(e){return Rc(e.edges(),function(t,r){return t+e.edge(r).weight},0)}function Ede(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,tt(e.edges(),function(r){var i=e.edge(r);i.nestingEdge&&e.removeEdge(r)})}var Ade=z(()=>{"use strict";ci();Nc();o(wde,"run");o(Sde,"dfs");o(uet,"treeDepths");o(het,"sumWeights");o(Ede,"cleanup")});function _de(e,t,r){var i={},n;tt(r,function(a){for(var s=e.parent(a),l,u;s;){if(l=e.parent(s),l?(u=i[l],i[l]=s):(u=n,n=s),u&&u!==s){t.setEdge(u,s);return}s=l}})}var Dde=z(()=>{"use strict";ci();o(_de,"addSubgraphConstraints")});function Rde(e,t,r){var i=fet(e),n=new ui({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(function(a){return e.node(a)});return tt(e.nodes(),function(a){var s=e.node(a),l=e.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(n.setNode(a),n.setParent(a,l||i),tt(e[r](a),function(u){var h=u.v===a?u.w:u.v,d=n.edge(h,a),f=yi(d)?0:d.weight;n.setEdge(h,a,{weight:e.edge(u).weight+f})}),Object.prototype.hasOwnProperty.call(s,"minRank")&&n.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),n}function fet(e){for(var t;e.hasNode(t=Gp("_root")););return t}var Lde=z(()=>{"use strict";ci();Uo();o(Rde,"buildLayerGraph");o(fet,"createRootNode")});function Mde(e,t){for(var r=0,i=1;i0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=h.weight;u+=h.weight*f})),u}var Nde=z(()=>{"use strict";ci();o(Mde,"crossCount");o(pet,"twoLayerCrossCount")});function Ide(e){var t={},r=ts(e.nodes(),function(l){return!e.children(l).length}),i=Os(Jr(r,function(l){return e.node(l).rank})),n=Jr(qo(i+1),function(){return[]});function a(l){if(!_b(t,l)){t[l]=!0;var u=e.node(l);n[u.rank].push(l),tt(e.successors(l),a)}}o(a,"dfs");var s=Lc(r,function(l){return e.node(l).rank});return tt(s,a),n}var Ode=z(()=>{"use strict";ci();o(Ide,"initOrder")});function Pde(e,t){return Jr(t,function(r){var i=e.inEdges(r);if(i.length){var n=Rc(i,function(a,s){var l=e.edge(s),u=e.node(s.v);return{sum:a.sum+l.weight*u.order,weight:a.weight+l.weight}},{sum:0,weight:0});return{v:r,barycenter:n.sum/n.weight,weight:n.weight}}else return{v:r}})}var Bde=z(()=>{"use strict";ci();o(Pde,"barycenter")});function Fde(e,t){var r={};tt(e,function(n,a){var s=r[n.v]={indegree:0,in:[],out:[],vs:[n.v],i:a};yi(n.barycenter)||(s.barycenter=n.barycenter,s.weight=n.weight)}),tt(t.edges(),function(n){var a=r[n.v],s=r[n.w];!yi(a)&&!yi(s)&&(s.indegree++,a.out.push(r[n.w]))});var i=ts(r,function(n){return!n.indegree});return met(i)}function met(e){var t=[];function r(a){return function(s){s.merged||(yi(s.barycenter)||yi(a.barycenter)||s.barycenter>=a.barycenter)&&get(a,s)}}o(r,"handleIn");function i(a){return function(s){s.in.push(a),--s.indegree===0&&e.push(s)}}for(o(i,"handleOut");e.length;){var n=e.pop();t.push(n),tt(n.in.reverse(),r(n)),tt(n.out,i(n))}return Jr(ts(t,function(a){return!a.merged}),function(a){return zp(a,["vs","i","barycenter","weight"])})}function get(e,t){var r=0,i=0;e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/i,e.weight=i,e.i=Math.min(t.i,e.i),t.merged=!0}var $de=z(()=>{"use strict";ci();o(Fde,"resolveConflicts");o(met,"doResolveConflicts");o(get,"mergeEntries")});function Gde(e,t){var r=Hhe(e,function(d){return Object.prototype.hasOwnProperty.call(d,"barycenter")}),i=r.lhs,n=Lc(r.rhs,function(d){return-d.i}),a=[],s=0,l=0,u=0;i.sort(yet(!!t)),u=zde(a,n,u),tt(i,function(d){u+=d.vs.length,a.push(d.vs),s+=d.barycenter*d.weight,l+=d.weight,u=zde(a,n,u)});var h={vs:Wo(a)};return l&&(h.barycenter=s/l,h.weight=l),h}function zde(e,t,r){for(var i;t.length&&(i=Md(t)).i<=r;)t.pop(),e.push(i.vs),r++;return r}function yet(e){return function(t,r){return t.barycenterr.barycenter?1:e?r.i-t.i:t.i-r.i}}var Vde=z(()=>{"use strict";ci();Nc();o(Gde,"sort");o(zde,"consumeUnsortable");o(yet,"compareWithBias")});function c9(e,t,r,i){var n=e.children(t),a=e.node(t),s=a?a.borderLeft:void 0,l=a?a.borderRight:void 0,u={};s&&(n=ts(n,function(g){return g!==s&&g!==l}));var h=Pde(e,n);tt(h,function(g){if(e.children(g.v).length){var y=c9(e,g.v,r,i);u[g.v]=y,Object.prototype.hasOwnProperty.call(y,"barycenter")&&xet(g,y)}});var d=Fde(h,r);vet(d,u);var f=Gde(d,i);if(s&&(f.vs=Wo([s,f.vs,l]),e.predecessors(s).length)){var p=e.node(e.predecessors(s)[0]),m=e.node(e.predecessors(l)[0]);Object.prototype.hasOwnProperty.call(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+m.order)/(f.weight+2),f.weight+=2}return f}function vet(e,t){tt(e,function(r){r.vs=Wo(r.vs.map(function(i){return t[i]?t[i].vs:i}))})}function xet(e,t){yi(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}var Wde=z(()=>{"use strict";ci();Bde();$de();Vde();o(c9,"sortSubgraph");o(vet,"expandSubgraphs");o(xet,"mergeBarycenters")});function Hde(e){var t=HI(e),r=qde(e,qo(1,t+1),"inEdges"),i=qde(e,qo(t-1,-1,-1),"outEdges"),n=Ide(e);Ude(e,n);for(var a=Number.POSITIVE_INFINITY,s,l=0,u=0;u<4;++l,++u){bet(l%2?r:i,l%4>=2),n=Nd(e);var h=Mde(e,n);h{"use strict";ci();Uo();Nc();Dde();Lde();Nde();Ode();Wde();o(Hde,"order");o(qde,"buildLayerGraphs");o(bet,"sweepLayerGraphs");o(Ude,"assignOrder")});function jde(e){var t=Cet(e);tt(e.graph().dummyChains,function(r){for(var i=e.node(r),n=i.edgeObj,a=Tet(e,t,n.v,n.w),s=a.path,l=a.lca,u=0,h=s[u],d=!0;r!==n.w;){if(i=e.node(r),d){for(;(h=s[u])!==l&&e.node(h).maxRanks||l>t[u].lim));for(h=u,u=i;(u=e.parent(u))!==h;)a.push(u);return{path:n.concat(a.reverse()),lca:h}}function Cet(e){var t={},r=0;function i(n){var a=r;tt(e.children(n),i),t[n]={low:a,lim:r++}}return o(i,"dfs"),tt(e.children(),i),t}var Xde=z(()=>{"use strict";ci();o(jde,"parentDummyChains");o(Tet,"findPath");o(Cet,"postorder")});function ket(e,t){var r={};function i(n,a){var s=0,l=0,u=n.length,h=Md(a);return tt(a,function(d,f){var p=Eet(e,d),m=p?e.node(p).order:u;(p||d===h)&&(tt(a.slice(l,f+1),function(g){tt(e.predecessors(g),function(y){var v=e.node(y),x=v.order;(xh)&&Kde(r,p,d)})})}o(i,"scan");function n(a,s){var l=-1,u,h=0;return tt(s,function(d,f){if(e.node(d).dummy==="border"){var p=e.predecessors(d);p.length&&(u=e.node(p[0]).order,i(s,h,f,l,u),h=f,l=u)}i(s,h,s.length,u,a.length)}),s}return o(n,"visitLayer"),Rc(t,n),r}function Eet(e,t){if(e.node(t).dummy)return Xg(e.predecessors(t),function(r){return e.node(r).dummy})}function Kde(e,t,r){if(t>r){var i=t;t=r,r=i}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var n=e[t];Object.defineProperty(n,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Aet(e,t,r){if(t>r){var i=t;t=r,r=i}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],r)}function _et(e,t,r,i){var n={},a={},s={};return tt(t,function(l){tt(l,function(u,h){n[u]=u,a[u]=u,s[u]=h})}),tt(t,function(l){var u=-1;tt(l,function(h){var d=i(h);if(d.length){d=Lc(d,function(y){return s[y]});for(var f=(d.length-1)/2,p=Math.floor(f),m=Math.ceil(f);p<=m;++p){var g=d[p];a[h]===h&&u{"use strict";ci();Uo();Nc();o(ket,"findType1Conflicts");o(wet,"findType2Conflicts");o(Eet,"findOtherInnerSegmentNode");o(Kde,"addConflict");o(Aet,"hasConflict");o(_et,"verticalAlignment");o(Det,"horizontalCompaction");o(Ret,"buildBlockGraph");o(Let,"findSmallestWidthAlignment");o(Met,"alignCoordinates");o(Net,"balance");o(Zde,"positionX");o(Iet,"sep");o(Oet,"width")});function Jde(e){e=n3(e),Pet(e),II(Zde(e),function(t,r){e.node(r).x=t})}function Pet(e){var t=Nd(e),r=e.graph().ranksep,i=0;tt(t,function(n){var a=Os(Jr(n,function(s){return e.node(s).height}));tt(n,function(s){e.node(s).y=i+a/2}),i+=a+r})}var efe=z(()=>{"use strict";ci();Nc();Qde();o(Jde,"position");o(Pet,"positionY")});function Mb(e,t){var r=t&&t.debugTiming?Yhe:jhe;r("layout",()=>{var i=r(" buildLayoutGraph",()=>Yet(e));r(" runLayout",()=>Bet(i,r)),r(" updateInputGraph",()=>Fet(e,i))})}function Bet(e,t){t(" makeSpaceForEdgeLabels",()=>jet(e)),t(" removeSelfEdges",()=>itt(e)),t(" acyclic",()=>zhe(e)),t(" nestingGraph.run",()=>wde(e)),t(" rank",()=>o9(n3(e))),t(" injectEdgeLabelProxies",()=>Xet(e)),t(" removeEmptyRanks",()=>Uhe(e)),t(" nestingGraph.cleanup",()=>Ede(e)),t(" normalizeRanks",()=>qhe(e)),t(" assignRankMinMax",()=>Ket(e)),t(" removeEdgeLabelProxies",()=>Zet(e)),t(" normalize.run",()=>ide(e)),t(" parentDummyChains",()=>jde(e)),t(" addBorderSegments",()=>Khe(e)),t(" order",()=>Hde(e)),t(" insertSelfEdges",()=>ntt(e)),t(" adjustCoordinateSystem",()=>Jhe(e)),t(" position",()=>Jde(e)),t(" positionSelfEdges",()=>att(e)),t(" removeBorderNodes",()=>rtt(e)),t(" normalize.undo",()=>nde(e)),t(" fixupEdgeLabelCoords",()=>ett(e)),t(" undoCoordinateSystem",()=>ede(e)),t(" translateGraph",()=>Qet(e)),t(" assignNodeIntersects",()=>Jet(e)),t(" reversePoints",()=>ttt(e)),t(" acyclic.undo",()=>Ghe(e))}function Fet(e,t){tt(e.nodes(),function(r){var i=e.node(r),n=t.node(r);i&&(i.x=n.x,i.y=n.y,t.children(r).length&&(i.width=n.width,i.height=n.height))}),tt(e.edges(),function(r){var i=e.edge(r),n=t.edge(r);i.points=n.points,Object.prototype.hasOwnProperty.call(n,"x")&&(i.x=n.x,i.y=n.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}function Yet(e){var t=new ui({multigraph:!0,compound:!0}),r=h9(e.graph());return t.setGraph(Zg({},zet,u9(r,$et),zp(r,Get))),tt(e.nodes(),function(i){var n=h9(e.node(i));t.setNode(i,AI(u9(n,Vet),Wet)),t.setParent(i,e.parent(i))}),tt(e.edges(),function(i){var n=h9(e.edge(i));t.setEdge(i,Zg({},Uet,u9(n,qet),zp(n,Het)))}),t}function jet(e){var t=e.graph();t.ranksep/=2,tt(e.edges(),function(r){var i=e.edge(r);i.minlen*=2,i.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function Xet(e){tt(e.edges(),function(t){var r=e.edge(t);if(r.width&&r.height){var i=e.node(t.v),n=e.node(t.w),a={rank:(n.rank-i.rank)/2+i.rank,e:t};Mc(e,"edge-proxy",a,"_ep")}})}function Ket(e){var t=0;tt(e.nodes(),function(r){var i=e.node(r);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,t=Os(t,i.maxRank))}),e.graph().maxRank=t}function Zet(e){tt(e.nodes(),function(t){var r=e.node(t);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(t))})}function Qet(e){var t=Number.POSITIVE_INFINITY,r=0,i=Number.POSITIVE_INFINITY,n=0,a=e.graph(),s=a.marginx||0,l=a.marginy||0;function u(h){var d=h.x,f=h.y,p=h.width,m=h.height;t=Math.min(t,d-p/2),r=Math.max(r,d+p/2),i=Math.min(i,f-m/2),n=Math.max(n,f+m/2)}o(u,"getExtremes"),tt(e.nodes(),function(h){u(e.node(h))}),tt(e.edges(),function(h){var d=e.edge(h);Object.prototype.hasOwnProperty.call(d,"x")&&u(d)}),t-=s,i-=l,tt(e.nodes(),function(h){var d=e.node(h);d.x-=t,d.y-=i}),tt(e.edges(),function(h){var d=e.edge(h);tt(d.points,function(f){f.x-=t,f.y-=i}),Object.prototype.hasOwnProperty.call(d,"x")&&(d.x-=t),Object.prototype.hasOwnProperty.call(d,"y")&&(d.y-=i)}),a.width=r-t+s,a.height=n-i+l}function Jet(e){tt(e.edges(),function(t){var r=e.edge(t),i=e.node(t.v),n=e.node(t.w),a,s;r.points?(a=r.points[0],s=r.points[r.points.length-1]):(r.points=[],a=n,s=i),r.points.unshift(qI(i,a)),r.points.push(qI(n,s))})}function ett(e){tt(e.edges(),function(t){var r=e.edge(t);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function ttt(e){tt(e.edges(),function(t){var r=e.edge(t);r.reversed&&r.points.reverse()})}function rtt(e){tt(e.nodes(),function(t){if(e.children(t).length){var r=e.node(t),i=e.node(r.borderTop),n=e.node(r.borderBottom),a=e.node(Md(r.borderLeft)),s=e.node(Md(r.borderRight));r.width=Math.abs(s.x-a.x),r.height=Math.abs(n.y-i.y),r.x=a.x+r.width/2,r.y=i.y+r.height/2}}),tt(e.nodes(),function(t){e.node(t).dummy==="border"&&e.removeNode(t)})}function itt(e){tt(e.edges(),function(t){if(t.v===t.w){var r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function ntt(e){var t=Nd(e);tt(t,function(r){var i=0;tt(r,function(n,a){var s=e.node(n);s.order=a+i,tt(s.selfEdges,function(l){Mc(e,"selfedge",{width:l.label.width,height:l.label.height,rank:s.rank,order:a+ ++i,e:l.e,label:l.label},"_se")}),delete s.selfEdges})})}function att(e){tt(e.nodes(),function(t){var r=e.node(t);if(r.dummy==="selfedge"){var i=e.node(r.e.v),n=i.x+i.width/2,a=i.y,s=r.x-n,l=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:n+2*s/3,y:a-l},{x:n+5*s/6,y:a-l},{x:n+s,y:a},{x:n+5*s/6,y:a+l},{x:n+2*s/3,y:a+l}],r.label.x=r.x,r.label.y=r.y}})}function u9(e,t){return Fp(zp(e,t),Number)}function h9(e){var t={};return tt(e,function(r,i){t[i.toLowerCase()]=r}),t}var $et,zet,Get,Vet,Wet,qet,Uet,Het,tfe=z(()=>{"use strict";ci();Uo();Zhe();rde();WI();XI();l9();Ade();Yde();Xde();efe();Nc();o(Mb,"layout");o(Bet,"runLayout");o(Fet,"updateInputGraph");$et=["nodesep","edgesep","ranksep","marginx","marginy"],zet={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Get=["acyclicer","ranker","rankdir","align"],Vet=["width","height"],Wet={width:0,height:0},qet=["minlen","weight","width","height","labeloffset"],Uet={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Het=["labelpos"];o(Yet,"buildLayoutGraph");o(jet,"makeSpaceForEdgeLabels");o(Xet,"injectEdgeLabelProxies");o(Ket,"assignRankMinMax");o(Zet,"removeEdgeLabelProxies");o(Qet,"translateGraph");o(Jet,"assignNodeIntersects");o(ett,"fixupEdgeLabelCoords");o(ttt,"reversePointsForReversedEdges");o(rtt,"removeBorderNodes");o(itt,"removeSelfEdges");o(ntt,"insertSelfEdges");o(att,"positionSelfEdges");o(u9,"selectNumberAttrs");o(h9,"canonicalize")});var d9=z(()=>{"use strict";WI();tfe();XI();l9()});function Ho(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:stt(e),edges:ott(e)};return yi(e.graph())||(t.value=mI(e.graph())),t}function stt(e){return Jr(e.nodes(),function(t){var r=e.node(t),i=e.parent(t),n={v:t};return yi(r)||(n.value=r),yi(i)||(n.parent=i),n})}function ott(e){return Jr(e.edges(),function(t){var r=e.edge(t),i={v:t.v,w:t.w};return yi(t.name)||(i.name=t.name),yi(r)||(i.value=r),i})}var f9=z(()=>{"use strict";ci();t3();o(Ho,"write");o(stt,"writeNodes");o(ott,"writeEdges")});var Pr,qp,nfe,afe,l3,ltt,sfe,ofe,ctt,Qg,ife,lfe,cfe,ufe,hfe,dfe=z(()=>{"use strict";St();Uo();f9();Pr=new Map,qp=new Map,nfe=new Map,afe=o(()=>{qp.clear(),nfe.clear(),Pr.clear()},"clear"),l3=o((e,t)=>{let r=qp.get(t)||[];return Z.trace("In isDescendant",t," ",e," = ",r.includes(e)),r.includes(e)},"isDescendant"),ltt=o((e,t)=>{let r=qp.get(t)||[];return Z.info("Descendants of ",t," is ",r),Z.info("Edge is ",e),e.v===t||e.w===t?!1:r?r.includes(e.v)||l3(e.v,t)||l3(e.w,t)||r.includes(e.w):(Z.debug("Tilt, ",t,",not in descendants"),!1)},"edgeInCluster"),sfe=o((e,t,r,i)=>{Z.warn("Copying children of ",e,"root",i,"data",t.node(e),i);let n=t.children(e)||[];e!==i&&n.push(e),Z.warn("Copying (nodes) clusterId",e,"nodes",n),n.forEach(a=>{if(t.children(a).length>0)sfe(a,t,r,i);else{let s=t.node(a);Z.info("cp ",a," to ",i," with parent ",e),r.setNode(a,s),i!==t.parent(a)&&(Z.warn("Setting parent",a,t.parent(a)),r.setParent(a,t.parent(a))),e!==i&&a!==e?(Z.debug("Setting parent",a,e),r.setParent(a,e)):(Z.info("In copy ",e,"root",i,"data",t.node(e),i),Z.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==i,"node!==clusterId",a!==e));let l=t.edges(a);Z.debug("Copying Edges",l),l.forEach(u=>{Z.info("Edge",u);let h=t.edge(u.v,u.w,u.name);Z.info("Edge data",h,i);try{ltt(u,i)?(Z.info("Copying as ",u.v,u.w,h,u.name),r.setEdge(u.v,u.w,h,u.name),Z.info("newGraph edges ",r.edges(),r.edge(r.edges()[0]))):Z.info("Skipping copy of edge ",u.v,"-->",u.w," rootId: ",i," clusterId:",e)}catch(d){Z.error(d)}})}Z.debug("Removing node",a),t.removeNode(a)})},"copy"),ofe=o((e,t)=>{let r=t.children(e),i=[...r];for(let n of r)nfe.set(n,e),i=[...i,...ofe(n,t)];return i},"extractDescendants"),ctt=o((e,t,r)=>{let i=e.edges().filter(u=>u.v===t||u.w===t),n=e.edges().filter(u=>u.v===r||u.w===r),a=i.map(u=>({v:u.v===t?r:u.v,w:u.w===t?t:u.w})),s=n.map(u=>({v:u.v,w:u.w}));return a.filter(u=>s.some(h=>u.v===h.v&&u.w===h.w))},"findCommonEdges"),Qg=o((e,t,r)=>{let i=t.children(e);if(Z.trace("Searching children of id ",e,i),i.length<1)return e;let n;for(let a of i){let s=Qg(a,t,r),l=ctt(t,r,s);if(s)if(l.length>0)n=s;else return s}return n},"findNonClusterChild"),ife=o(e=>!Pr.has(e)||!Pr.get(e).externalConnections?e:Pr.has(e)?Pr.get(e).id:e,"getAnchorId"),lfe=o((e,t)=>{if(!e||t>10){Z.debug("Opting out, no graph ");return}else Z.debug("Opting in, graph ");e.nodes().forEach(function(r){e.children(r).length>0&&(Z.warn("Cluster identified",r," Replacement id in edges: ",Qg(r,e,r)),qp.set(r,ofe(r,e)),Pr.set(r,{id:Qg(r,e,r),clusterData:e.node(r)}))}),e.nodes().forEach(function(r){let i=e.children(r),n=e.edges();i.length>0?(Z.debug("Cluster identified",r,qp),n.forEach(a=>{let s=l3(a.v,r),l=l3(a.w,r);s^l&&(Z.warn("Edge: ",a," leaves cluster ",r),Z.warn("Descendants of XXX ",r,": ",qp.get(r)),Pr.get(r).externalConnections=!0)})):Z.debug("Not a cluster ",r,qp)});for(let r of Pr.keys()){let i=Pr.get(r).id,n=e.parent(i);n!==r&&Pr.has(n)&&!Pr.get(n).externalConnections&&(Pr.get(r).id=n)}e.edges().forEach(function(r){let i=e.edge(r);Z.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(r)),Z.warn("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(e.edge(r)));let n=r.v,a=r.w;if(Z.warn("Fix XXX",Pr,"ids:",r.v,r.w,"Translating: ",Pr.get(r.v)," --- ",Pr.get(r.w)),Pr.get(r.v)||Pr.get(r.w)){if(Z.warn("Fixing and trying - removing XXX",r.v,r.w,r.name),n=ife(r.v),a=ife(r.w),e.removeEdge(r.v,r.w,r.name),n!==r.v){let s=e.parent(n);Pr.get(s).externalConnections=!0,i.fromCluster=r.v}if(a!==r.w){let s=e.parent(a);Pr.get(s).externalConnections=!0,i.toCluster=r.w}Z.warn("Fix Replacing with XXX",n,a,r.name),e.setEdge(n,a,i,r.name)}}),Z.warn("Adjusted Graph",Ho(e)),cfe(e,0),Z.trace(Pr)},"adjustClustersAndEdges"),cfe=o((e,t)=>{if(Z.warn("extractor - ",t,Ho(e),e.children("D")),t>10){Z.error("Bailing out");return}let r=e.nodes(),i=!1;for(let n of r){let a=e.children(n);i=i||a.length>0}if(!i){Z.debug("Done, no node has children",e.nodes());return}Z.debug("Nodes = ",r,t);for(let n of r)if(Z.debug("Extracting node",n,Pr,Pr.has(n)&&!Pr.get(n).externalConnections,!e.parent(n),e.node(n),e.children("D")," Depth ",t),!Pr.has(n))Z.debug("Not a cluster",n,t);else if(!Pr.get(n).externalConnections&&e.children(n)&&e.children(n).length>0){Z.warn("Cluster without external connections, without a parent and with children",n,t);let s=e.graph().rankdir==="TB"?"LR":"TB";Pr.get(n)?.clusterData?.dir&&(s=Pr.get(n).clusterData.dir,Z.warn("Fixing dir",Pr.get(n).clusterData.dir,s));let l=new ui({multigraph:!0,compound:!0}).setGraph({rankdir:s,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});Z.warn("Old graph before copy",Ho(e)),sfe(n,e,l,n),e.setNode(n,{clusterNode:!0,id:n,clusterData:Pr.get(n).clusterData,label:Pr.get(n).label,graph:l}),Z.warn("New graph after copy node: (",n,")",Ho(l)),Z.debug("Old graph after copy",Ho(e))}else Z.warn("Cluster ** ",n," **not meeting the criteria !externalConnections:",!Pr.get(n).externalConnections," no parent: ",!e.parent(n)," children ",e.children(n)&&e.children(n).length>0,e.children("D"),t),Z.debug(Pr);r=e.nodes(),Z.warn("New list of nodes",r);for(let n of r){let a=e.node(n);Z.warn(" Now next level",n,a),a?.clusterNode&&cfe(a.graph,t+1)}},"extractor"),ufe=o((e,t)=>{if(t.length===0)return[];let r=Object.assign([],t);return t.forEach(i=>{let n=e.children(i),a=ufe(e,n);r=[...r,...a]}),r},"sorter"),hfe=o(e=>ufe(e,e.children()),"sortNodesByHierarchy")});var pfe={};xr(pfe,{render:()=>utt});var ffe,utt,mfe=z(()=>{"use strict";d9();f9();Uo();$N();Wt();dfe();J4();W4();FN();St();rb();Ut();ffe=o(async(e,t,r,i,n,a)=>{Z.warn("Graph in recursive render:XAX",Ho(t),n);let s=t.graph().rankdir;Z.trace("Dir in recursive render - dir:",s);let l=e.insert("g").attr("class","root");t.nodes()?Z.info("Recursive render XXX",t.nodes()):Z.info("No nodes found for",t),t.edges().length>0&&Z.info("Recursive edges",t.edge(t.edges()[0]));let u=l.insert("g").attr("class","clusters"),h=l.insert("g").attr("class","edgePaths"),d=l.insert("g").attr("class","edgeLabels"),f=l.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(y){let v=t.node(y);if(n!==void 0){let x=JSON.parse(JSON.stringify(n.clusterData));Z.trace(`Setting data for parent cluster XXX + Node.id = `,y,` + data=`,x.height,` +Parent cluster`,n.height),t.setNode(n.id,x),t.parent(y)||(Z.trace("Setting parent",y,n.id),t.setParent(y,n.id,x))}if(Z.info("(Insert) Node XXX"+y+": "+JSON.stringify(t.node(y))),v?.clusterNode){Z.info("Cluster identified XBX",y,v.width,t.node(y));let{ranksep:x,nodesep:b}=t.graph();v.graph.setGraph({...v.graph.graph(),ranksep:x+25,nodesep:b});let T=await ffe(f,v.graph,r,i,t.node(y),a),w=T.elem;ft(v,w),v.diff=T.diff||0,Z.info("New compound node after recursive render XAX",y,"width",v.width,"height",v.height),Wae(w,v)}else t.children(y).length>0?(Z.trace("Cluster - the non recursive path XBX",y,v.id,v,v.width,"Graph:",t),Z.trace(Qg(v.id,t)),Pr.set(v.id,{id:Qg(v.id,t),node:v})):(Z.trace("Node - the non recursive path XAX",y,f,t.node(y),s),await Sg(f,t.node(y),{config:a,dir:s}))})),await o(async()=>{let y=t.edges().map(async function(v){let x=t.edge(v.v,v.w,v.name);Z.info("Edge "+v.v+" -> "+v.w+": "+JSON.stringify(v)),Z.info("Edge "+v.v+" -> "+v.w+": ",v," ",JSON.stringify(t.edge(v))),Z.info("Fix",Pr,"ids:",v.v,v.w,"Translating: ",Pr.get(v.v),Pr.get(v.w)),await j4(d,x)});await Promise.all(y)},"processEdges")(),Z.info("Graph before layout:",JSON.stringify(Ho(t))),Z.info("############################################# XXX"),Z.info("### Layout ### XXX"),Z.info("############################################# XXX"),Mb(t),Z.info("Graph after layout:",JSON.stringify(Ho(t)));let m=0,{subGraphTitleTotalMargin:g}=zu(a);return await Promise.all(hfe(t).map(async function(y){let v=t.node(y);if(Z.info("Position XBX => "+y+": ("+v.x,","+v.y,") width: ",v.width," height: ",v.height),v?.clusterNode)v.y+=g,Z.info("A tainted cluster node XBX1",y,v.id,v.width,v.height,v.x,v.y,t.parent(y)),Pr.get(v.id).node=v,nb(v);else if(t.children(y).length>0){Z.info("A pure cluster node XBX1",y,v.id,v.x,v.y,v.width,v.height,t.parent(y)),v.height+=g,t.node(v.parentId);let x=v?.padding/2||0,b=v?.labelBBox?.height||0,T=b-x||0;Z.debug("OffsetY",T,"labelHeight",b,"halfPadding",x),await wg(u,v),Pr.get(v.id).node=v}else{let x=t.node(v.parentId);v.y+=g/2,Z.info("A regular node XBX1 - using the padding",v.id,"parent",v.parentId,v.width,v.height,v.x,v.y,"offsetY",v.offsetY,"parent",x,x?.offsetY,v),nb(v)}})),t.edges().forEach(function(y){let v=t.edge(y);Z.info("Edge "+y.v+" -> "+y.w+": "+JSON.stringify(v),v),v.points.forEach(w=>w.y+=g/2);let x=t.node(y.v);var b=t.node(y.w);let T=K4(h,v,Pr,r,x,b,i);X4(v,T)}),t.nodes().forEach(function(y){let v=t.node(y);Z.info(y,v.type,v.diff),v.isGroup&&(m=v.diff)}),Z.warn("Returning from recursive render XAX",l,m),{elem:l,diff:m}},"recursiveRender"),utt=o(async(e,t)=>{let r=new ui({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),i=t.select("g");Z4(i,e.markers,e.type,e.diagramId),qae(),Vae(),Oae(),afe(),e.nodes.forEach(a=>{r.setNode(a.id,{...a}),a.parentId&&r.setParent(a.id,a.parentId)}),Z.debug("Edges:",e.edges),e.edges.forEach(a=>{if(a.start===a.end){let s=a.start,l=s+"---"+s+"---1",u=s+"---"+s+"---2",h=r.node(s);r.setNode(l,{domId:l,id:l,parentId:h.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),r.setParent(l,h.parentId),r.setNode(u,{domId:u,id:u,parentId:h.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),r.setParent(u,h.parentId);let d=structuredClone(a),f=structuredClone(a),p=structuredClone(a);d.label="",d.arrowTypeEnd="none",d.endLabelLeft="",d.endLabelRight="",d.startLabelLeft="",d.id=s+"-cyclic-special-1",f.startLabelRight="",f.startLabelLeft="",f.endLabelLeft="",f.endLabelRight="",f.arrowTypeStart="none",f.arrowTypeEnd="none",f.id=s+"-cyclic-special-mid",p.label="",p.startLabelRight="",p.startLabelLeft="",p.arrowTypeStart="none",h.isGroup&&(d.fromCluster=s,p.toCluster=s),p.id=s+"-cyclic-special-2",p.arrowTypeStart="none",r.setEdge(s,l,d,s+"-cyclic-special-0"),r.setEdge(l,u,f,s+"-cyclic-special-1"),r.setEdge(u,s,p,s+"-cyce.length)&&(t=e.length);for(var r=0,i=Array(t);r=e.length?{done:!0}:{done:!1,value:e[i++]}},"n"),e:o(function(u){throw u},"e"),f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,l=!1;return{s:o(function(){r=r.call(e)},"s"),n:o(function(){var u=r.next();return s=u.done,u},"n"),e:o(function(u){l=!0,a=u},"e"),f:o(function(){try{s||r.return==null||r.return()}finally{if(l)throw a}},"f")}}function q0e(e,t,r){return(t=U0e(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ptt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function mtt(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,n,a,s,l=[],u=!0,h=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==t);u=!0);}catch(d){h=!0,n=d}finally{try{if(!u&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(h)throw n}}return l}}function gtt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ytt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dn(e,t){return htt(e)||mtt(e,t)||uP(e,t)||gtt()}function N3(e){return dtt(e)||ptt(e)||uP(e)||ytt()}function vtt(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function U0e(e){var t=vtt(e,"string");return typeof t=="symbol"?t:t+""}function Wn(e){"@babel/helpers - typeof";return Wn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wn(e)}function uP(e,t){if(e){if(typeof e=="string")return qO(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qO(e,t):void 0}}function n2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a2(){if(vfe)return p9;vfe=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return o(e,"isObject"),p9=e,p9}function Gtt(){if(xfe)return m9;xfe=1;var e=typeof c3=="object"&&c3&&c3.Object===Object&&c3;return m9=e,m9}function j3(){if(bfe)return g9;bfe=1;var e=Gtt(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return g9=r,g9}function Vtt(){if(Tfe)return y9;Tfe=1;var e=j3(),t=o(function(){return e.Date.now()},"now");return y9=t,y9}function Wtt(){if(Cfe)return v9;Cfe=1;var e=/\s/;function t(r){for(var i=r.length;i--&&e.test(r.charAt(i)););return i}return o(t,"trimmedEndIndex"),v9=t,v9}function qtt(){if(kfe)return x9;kfe=1;var e=Wtt(),t=/^\s+/;function r(i){return i&&i.slice(0,e(i)+1).replace(t,"")}return o(r,"baseTrim"),x9=r,x9}function fP(){if(wfe)return b9;wfe=1;var e=j3(),t=e.Symbol;return b9=t,b9}function Utt(){if(Sfe)return T9;Sfe=1;var e=fP(),t=Object.prototype,r=t.hasOwnProperty,i=t.toString,n=e?e.toStringTag:void 0;function a(s){var l=r.call(s,n),u=s[n];try{s[n]=void 0;var h=!0}catch{}var d=i.call(s);return h&&(l?s[n]=u:delete s[n]),d}return o(a,"getRawTag"),T9=a,T9}function Htt(){if(Efe)return C9;Efe=1;var e=Object.prototype,t=e.toString;function r(i){return t.call(i)}return o(r,"objectToString"),C9=r,C9}function eme(){if(Afe)return k9;Afe=1;var e=fP(),t=Utt(),r=Htt(),i="[object Null]",n="[object Undefined]",a=e?e.toStringTag:void 0;function s(l){return l==null?l===void 0?n:i:a&&a in Object(l)?t(l):r(l)}return o(s,"baseGetTag"),k9=s,k9}function Ytt(){if(_fe)return w9;_fe=1;function e(t){return t!=null&&typeof t=="object"}return o(e,"isObjectLike"),w9=e,w9}function s2(){if(Dfe)return S9;Dfe=1;var e=eme(),t=Ytt(),r="[object Symbol]";function i(n){return typeof n=="symbol"||t(n)&&e(n)==r}return o(i,"isSymbol"),S9=i,S9}function jtt(){if(Rfe)return E9;Rfe=1;var e=qtt(),t=a2(),r=s2(),i=NaN,n=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;function u(h){if(typeof h=="number")return h;if(r(h))return i;if(t(h)){var d=typeof h.valueOf=="function"?h.valueOf():h;h=t(d)?d+"":d}if(typeof h!="string")return h===0?h:+h;h=e(h);var f=a.test(h);return f||s.test(h)?l(h.slice(2),f?2:8):n.test(h)?i:+h}return o(u,"toNumber"),E9=u,E9}function Xtt(){if(Lfe)return A9;Lfe=1;var e=a2(),t=Vtt(),r=jtt(),i="Expected a function",n=Math.max,a=Math.min;function s(l,u,h){var d,f,p,m,g,y,v=0,x=!1,b=!1,T=!0;if(typeof l!="function")throw new TypeError(i);u=r(u)||0,e(h)&&(x=!!h.leading,b="maxWait"in h,p=b?n(r(h.maxWait)||0,u):p,T="trailing"in h?!!h.trailing:T);function w(_){var R=d,M=f;return d=f=void 0,v=_,m=l.apply(M,R),m}o(w,"invokeFunc");function C(_){return v=_,g=setTimeout(A,u),x?w(_):m}o(C,"leadingEdge");function k(_){var R=_-y,M=_-v,L=u-R;return b?a(L,p-M):L}o(k,"remainingWait");function E(_){var R=_-y,M=_-v;return y===void 0||R>=u||R<0||b&&M>=p}o(E,"shouldInvoke");function A(){var _=t();if(E(_))return N(_);g=setTimeout(A,k(_))}o(A,"timerExpired");function N(_){return g=void 0,T&&d?w(_):(d=f=void 0,m)}o(N,"trailingEdge");function P(){g!==void 0&&clearTimeout(g),v=0,d=y=f=g=void 0}o(P,"cancel");function I(){return g===void 0?m:N(t())}o(I,"flush");function D(){var _=t(),R=E(_);if(d=arguments,f=this,y=_,R){if(g===void 0)return C(y);if(b)return clearTimeout(g),g=setTimeout(A,u),w(y)}return g===void 0&&(g=setTimeout(A,u)),m}return o(D,"debounced"),D.cancel=P,D.flush=I,D}return o(s,"debounce"),A9=s,A9}function ert(e,t,r,i,n){var a=n*Math.PI/180,s=Math.cos(a)*(e-r)-Math.sin(a)*(t-i)+r,l=Math.sin(a)*(e-r)+Math.cos(a)*(t-i)+i;return{x:s,y:l}}function rrt(e,t,r){if(r===0)return e;var i=(t.x1+t.x2)/2,n=(t.y1+t.y2)/2,a=t.w/t.h,s=1/a,l=ert(e.x,e.y,i,n,r),u=trt(l.x,l.y,i,n,a,s);return{x:u.x,y:u.y}}function frt(){return Pfe||(Pfe=1,(function(e,t){(function(){var r,i,n,a,s,l,u,h,d,f,p,m,g,y,v;n=Math.floor,f=Math.min,i=o(function(x,b){return xb?1:0},"defaultCmp"),d=o(function(x,b,T,w,C){var k;if(T==null&&(T=0),C==null&&(C=i),T<0)throw new Error("lo must be non-negative");for(w==null&&(w=x.length);TP;0<=P?N++:N--)A.push(N);return A}).apply(this).reverse(),E=[],w=0,C=k.length;wI;0<=I?++A:--A)D.push(s(x,T));return D},"nsmallest"),y=o(function(x,b,T,w){var C,k,E;for(w==null&&(w=i),C=x[T];T>b;){if(E=T-1>>1,k=x[E],w(C,k)<0){x[T]=k,T=E;continue}break}return x[T]=C},"_siftdown"),v=o(function(x,b,T){var w,C,k,E,A;for(T==null&&(T=i),C=x.length,A=b,k=x[b],w=2*b+1;w-1}return o(t,"listCacheHas"),rO=t,rO}function snt(){if(kpe)return iO;kpe=1;var e=eE();function t(r,i){var n=this.__data__,a=e(n,r);return a<0?(++this.size,n.push([r,i])):n[a][1]=i,this}return o(t,"listCacheSet"),iO=t,iO}function ont(){if(wpe)return nO;wpe=1;var e=rnt(),t=int(),r=nnt(),i=ant(),n=snt();function a(s){var l=-1,u=s==null?0:s.length;for(this.clear();++l-1&&i%1==0&&i0;){var d=n.shift();t(d),a.add(d.id()),l&&i(n,a,d)}return e}function Lme(e,t,r){if(r.isParent())for(var i=r._private.children,n=0;n0&&arguments[0]!==void 0?arguments[0]:yat,t=arguments.length>1?arguments[1]:void 0,r=0;r0?D=R:I=R;while(Math.abs(_)>s&&++M=a?b(P,M):L===0?M:w(P,I,I+h)}o(C,"getTForX");var k=!1;function E(){k=!0,(e!==t||r!==i)&&T()}o(E,"precompute");var A=o(function(I){return k||E(),e===t&&r===i?I:I===0?0:I===1?1:v(C(I),t,i)},"f");A.getControlPoints=function(){return[{x:e,y:t},{x:r,y:i}]};var N="generateBezier("+[e,t,r,i]+")";return A.toString=function(){return N},A}function f0e(e,t,r,i,n){if(i===1||t===r)return r;var a=n(t,r,i);return e==null||((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max))),a}function p0e(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function t1(e,t,r,i,n){var a=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var s=p0e(e,n),l=p0e(t,n);if(Ot(s)&&Ot(l))return f0e(a,s,l,r,i);if(Si(s)&&Si(l)){for(var u=[],h=0;h0?(m==="spring"&&g.push(s.duration),s.easingImpl=A3[m].apply(null,g)):s.easingImpl=A3[m]}var y=s.easingImpl,v;if(s.duration===0?v=1:v=(r-u)/s.duration,s.applying&&(v=s.progress),v<0?v=0:v>1&&(v=1),s.delay==null){var x=s.startPosition,b=s.position;if(b&&n&&!e.locked()){var T={};Pb(x.x,b.x)&&(T.x=t1(x.x,b.x,v,y)),Pb(x.y,b.y)&&(T.y=t1(x.y,b.y,v,y)),e.position(T)}var w=s.startPan,C=s.pan,k=a.pan,E=C!=null&&i;E&&(Pb(w.x,C.x)&&(k.x=t1(w.x,C.x,v,y)),Pb(w.y,C.y)&&(k.y=t1(w.y,C.y,v,y)),e.emit("pan"));var A=s.startZoom,N=s.zoom,P=N!=null&&i;P&&(Pb(A,N)&&(a.zoom=Xb(a.minZoom,t1(A,N,v,y),a.maxZoom)),e.emit("zoom")),(E||P)&&e.emit("viewport");var I=s.style;if(I&&I.length>0&&n){for(var D=0;D=0;E--){var A=k[E];A()}k.splice(0,k.length)},"callbacks"),b=m.length-1;b>=0;b--){var T=m[b],w=T._private;if(w.stopped){m.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,x(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Lat(d,T,e),Rat(d,T,e,f),w.applying&&(w.applying=!1),x(w.frames),w.step!=null&&w.step(e),T.completed()&&(m.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,x(w.completes)),y=!0)}return!f&&m.length===0&&g.length===0&&i.push(d),y}o(n,"stepOne");for(var a=!1,s=0;s0?t.notify("draw",r):t.notify("draw")),r.unmerge(i),t.emit("step")}function Xme(e){this.options=hr({},$at,zat,e)}function Kme(e){this.options=hr({},Gat,e)}function Zme(e){this.options=hr({},Vat,e)}function lE(e){this.options=hr({},Wat,e),this.options.layout=this;var t=this.options.eles.nodes(),r=this.options.eles.edges(),i=r.filter(function(n){var a=n.source().data("id"),s=n.target().data("id"),l=t.some(function(h){return h.data("id")===a}),u=t.some(function(h){return h.data("id")===s});return!l||!u});this.options.eles=this.options.eles.not(i)}function tge(e){this.options=hr({},nst,e)}function DP(e){this.options=hr({},ast,e)}function rge(e){this.options=hr({},sst,e)}function ige(e){this.options=hr({},ost,e)}function nge(e){this.options=e,this.notifications=0}function oge(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function LP(e,t,r,i){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return i===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(ust(e,t,r,i,n),{cx:tP,cy:rP,radius:Xp,startX:age,startY:sge,stopX:iP,stopY:nP,startAngle:Pc.ang+Math.PI/2*Zp,endAngle:Yo.ang-Math.PI/2*Zp,counterClockwise:R3})}function lge(e){var t=[];if(e!=null){for(var r=0;r5&&arguments[5]!==void 0?arguments[5]:5,s=Math.min(a,i/2,n/2);e.beginPath(),e.moveTo(t+s,r),e.lineTo(t+i-s,r),e.quadraticCurveTo(t+i,r,t+i,r+s),e.lineTo(t+i,r+n-s),e.quadraticCurveTo(t+i,r+n,t+i-s,r+n),e.lineTo(t+s,r+n),e.quadraticCurveTo(t,r+n,t,r+n-s),e.lineTo(t,r+s),e.quadraticCurveTo(t,r,t+s,r),e.closePath()}function O0e(e,t,r){var i=e.createShader(t);if(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(i));return i}function Jst(e,t,r){var i=O0e(e,e.VERTEX_SHADER,t),n=O0e(e,e.FRAGMENT_SHADER,r),a=e.createProgram();if(e.attachShader(a,i),e.attachShader(a,n),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function eot(e,t,r){r===void 0&&(r=t);var i=e.makeOffscreenCanvas(t,r),n=i.context=i.getContext("2d");return i.clear=function(){return n.clearRect(0,0,i.width,i.height)},i.clear(),i}function IP(e){var t=e.pixelRatio,r=e.cy.zoom(),i=e.cy.pan();return{zoom:r*t,pan:{x:i.x*t,y:i.y*t}}}function tot(e){var t=e.pixelRatio,r=e.cy.zoom();return r*t}function rot(e,t,r,i,n){var a=i*r+t.x,s=n*r+t.y;return s=Math.round(e.canvasHeight-s),[a,s]}function iot(e){return e.pstyle("background-fill").value!=="solid"||e.pstyle("background-image").strValue!=="none"?!1:e.pstyle("border-width").value===0||e.pstyle("border-opacity").value===0?!0:e.pstyle("border-style").value==="solid"}function not(e,t){if(e.length!==t.length)return!1;for(var r=0;r>0&255)/255,r[1]=(e>>8&255)/255,r[2]=(e>>16&255)/255,r[3]=(e>>24&255)/255,r}function aot(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function sot(e,t){var r=e.createTexture();return r.buffer=function(i){e.bindTexture(e.TEXTURE_2D,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},r.deleteTexture=function(){e.deleteTexture(r)},r}function Tge(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function Cge(e,t,r){switch(t){case e.FLOAT:return new Float32Array(r);case e.INT:return new Int32Array(r)}}function oot(e,t,r,i,n,a){switch(t){case e.FLOAT:return new Float32Array(r.buffer,a*i,n);case e.INT:return new Int32Array(r.buffer,a*i,n)}}function lot(e,t,r,i){var n=Tge(e,t),a=Dn(n,2),s=a[0],l=a[1],u=Cge(e,l,i),h=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,h),e.bufferData(e.ARRAY_BUFFER,u,e.STATIC_DRAW),l===e.FLOAT?e.vertexAttribPointer(r,s,l,!1,0,0):l===e.INT&&e.vertexAttribIPointer(r,s,l,0,0),e.enableVertexAttribArray(r),e.bindBuffer(e.ARRAY_BUFFER,null),h}function Oc(e,t,r,i){var n=Tge(e,r),a=Dn(n,3),s=a[0],l=a[1],u=a[2],h=Cge(e,l,t*s),d=s*u,f=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,t*d,e.DYNAMIC_DRAW),e.enableVertexAttribArray(i),l===e.FLOAT?e.vertexAttribPointer(i,s,l,!1,d,0):l===e.INT&&e.vertexAttribIPointer(i,s,l,d,0),e.vertexAttribDivisor(i,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var p=new Array(t),m=0;mgge?(Sot(e),t.call(e,a)):(Eot(e),Ege(e,a,Ub.SCREEN)))}}{var r=e.matchCanvasSize;e.matchCanvasSize=function(a){r.call(e,a),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0}}e.findNearestElements=function(a,s,l,u){return Mot(e,a,s)};{var i=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){i.call(e),e.pickingFrameBuffer.needsDraw=!0}}{var n=e.notify;e.notify=function(a,s){n.call(e,a,s),a==="viewport"||a==="bounds"?e.pickingFrameBuffer.needsDraw=!0:a==="background"&&e.drawing.invalidate(s,{type:"node-body"})}}}function Sot(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function Eot(e){var t=o(function(i){i.save(),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,e.canvasWidth,e.canvasHeight),i.restore()},"clear");t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function Aot(e){var t=e.canvasWidth,r=e.canvasHeight,i=IP(e),n=i.pan,a=i.zoom,s=FO();M3(s,s,[n.x,n.y]),sP(s,s,[a,a]);var l=FO();dot(l,t,r);var u=FO();return hot(u,l,s),u}function Sge(e,t){var r=e.canvasWidth,i=e.canvasHeight,n=IP(e),a=n.pan,s=n.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,r,i),t.translate(a.x,a.y),t.scale(s,s)}function _ot(e,t){e.drawSelectionRectangle(t,function(r){return Sge(e,r)})}function Dot(e){var t=e.data.contexts[e.NODE];t.save(),Sge(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function Rot(e){var t=o(function(n,a,s){for(var l=n.atlasManager.getAtlasCollection(a),u=e.data.contexts[e.NODE],h=l.atlases,d=0;d=0&&w.add(E)}return w}function Mot(e,t,r){var i=Lot(e,t,r),n=e.getCachedZSortedEles(),a,s,l=Fs(i),u;try{for(l.s();!(u=l.n()).done;){var h=u.value,d=n[h];if(!a&&d.isNode()&&(a=d),!s&&d.isEdge()&&(s=d),a&&s)break}}catch(f){l.e(f)}finally{l.f()}return[a,s].filter(Boolean)}function WO(e,t,r){var i=e.drawing;t+=1,r.isNode()?(i.drawNode(r,t,"node-underlay"),i.drawNode(r,t,"node-body"),i.drawTexture(r,t,"label"),i.drawNode(r,t,"node-overlay")):(i.drawEdgeLine(r,t),i.drawEdgeArrow(r,t,"source"),i.drawEdgeArrow(r,t,"target"),i.drawTexture(r,t,"label"),i.drawTexture(r,t,"edge-source-label"),i.drawTexture(r,t,"edge-target-label"))}function Ege(e,t,r){var i;e.webglDebug&&(i=performance.now());var n=e.drawing,a=0;if(r.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&_ot(e,t),e.data.canvasNeedsRedraw[e.NODE]||r.picking){var s=e.data.contexts[e.WEBGL];r.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var l=Aot(e),u=e.getCachedZSortedEles();if(a=u.length,n.startFrame(l,r),r.screen){for(var h=0;h{"use strict";o(qO,"_arrayLikeToArray");o(htt,"_arrayWithHoles");o(dtt,"_arrayWithoutHoles");o(Kd,"_classCallCheck");o(ftt,"_defineProperties");o(Zd,"_createClass");o(Fs,"_createForOfIteratorHelper");o(q0e,"_defineProperty$1");o(ptt,"_iterableToArray");o(mtt,"_iterableToArrayLimit");o(gtt,"_nonIterableRest");o(ytt,"_nonIterableSpread");o(Dn,"_slicedToArray");o(N3,"_toConsumableArray");o(vtt,"_toPrimitive");o(U0e,"_toPropertyKey");o(Wn,"_typeof");o(uP,"_unsupportedIterableToArray");Gn=typeof window>"u"?null:window,gfe=Gn?Gn.navigator:null;Gn&&Gn.document;xtt=Wn(""),H0e=Wn({}),btt=Wn(function(){}),Ttt=typeof HTMLElement>"u"?"undefined":Wn(HTMLElement),r2=o(function(t){return t&&t.instanceString&&Ji(t.instanceString)?t.instanceString():null},"instanceStr"),sr=o(function(t){return t!=null&&Wn(t)==xtt},"string"),Ji=o(function(t){return t!=null&&Wn(t)===btt},"fn"),Si=o(function(t){return!uo(t)&&(Array.isArray?Array.isArray(t):t!=null&&t instanceof Array)},"array"),Xr=o(function(t){return t!=null&&Wn(t)===H0e&&!Si(t)&&t.constructor===Object},"plainObject"),Ctt=o(function(t){return t!=null&&Wn(t)===H0e},"object"),Ot=o(function(t){return t!=null&&Wn(t)===Wn(1)&&!isNaN(t)},"number"),ktt=o(function(t){return Ot(t)&&Math.floor(t)===t},"integer"),I3=o(function(t){if(Ttt!=="undefined")return t!=null&&t instanceof HTMLElement},"htmlElement"),uo=o(function(t){return i2(t)||Y0e(t)},"elementOrCollection"),i2=o(function(t){return r2(t)==="collection"&&t._private.single},"element"),Y0e=o(function(t){return r2(t)==="collection"&&!t._private.single},"collection"),hP=o(function(t){return r2(t)==="core"},"core"),j0e=o(function(t){return r2(t)==="stylesheet"},"stylesheet"),wtt=o(function(t){return r2(t)==="event"},"event"),qd=o(function(t){return t==null?!0:!!(t===""||t.match(/^\s+$/))},"emptyString"),Stt=o(function(t){return typeof HTMLElement>"u"?!1:t instanceof HTMLElement},"domElement"),Ett=o(function(t){return Xr(t)&&Ot(t.x1)&&Ot(t.x2)&&Ot(t.y1)&&Ot(t.y2)},"boundingBox"),Att=o(function(t){return Ctt(t)&&Ji(t.then)},"promise"),_tt=o(function(){return gfe&&gfe.userAgent.match(/msie|trident|edge/i)},"ms"),p1=o(function(t,r){r||(r=o(function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var a=[],s=0;sr?1:0},"ascending"),Ott=o(function(t,r){return-1*K0e(t,r)},"descending"),hr=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,r=1;r1&&(v-=1),v<1/6?g+(y-g)*6*v:v<1/2?y:v<2/3?g+(y-g)*(2/3-v)*6:g}o(d,"hue2rgb");var f=new RegExp("^"+Ltt+"$").exec(t);if(f){if(i=parseInt(f[1]),i<0?i=(360- -1*i%360)%360:i>360&&(i=i%360),i/=360,n=parseFloat(f[2]),n<0||n>100||(n=n/100,a=parseFloat(f[3]),a<0||a>100)||(a=a/100,s=f[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)l=u=h=Math.round(a*255);else{var p=a<.5?a*(1+n):a+n-a*n,m=2*a-p;l=Math.round(255*d(m,p,i+1/3)),u=Math.round(255*d(m,p,i)),h=Math.round(255*d(m,p,i-1/3))}r=[l,u,h,s]}return r},"hsl2tuple"),Ftt=o(function(t){var r,i=new RegExp("^"+Dtt+"$").exec(t);if(i){r=[];for(var n=[],a=1;a<=3;a++){var s=i[a];if(s[s.length-1]==="%"&&(n[a]=!0),s=parseFloat(s),n[a]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var l=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(l&&!u)return;var h=i[4];if(h!==void 0){if(h=parseFloat(h),h<0||h>1)return;r.push(h)}}return r},"rgb2tuple"),$tt=o(function(t){return ztt[t.toLowerCase()]},"colorname2tuple"),Z0e=o(function(t){return(Si(t)?t:null)||$tt(t)||Ptt(t)||Ftt(t)||Btt(t)},"color2tuple"),ztt={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Q0e=o(function(t){for(var r=t.map,i=t.keys,n=i.length,a=0;a1&&arguments[1]!==void 0?arguments[1]:Kp,i=r,n;n=t.next(),!n.done;)i=i*rme+n.value|0;return i},"hashIterableInts"),Hb=o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Kp;return r*rme+t|0},"hashInt"),Yb=o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s1;return(r<<5)+r+t|0},"hashIntAlt"),Qtt=o(function(t,r){return t*2097152+r},"combineHashes"),Pd=o(function(t){return t[0]*2097152+t[1]},"combineHashesArray"),u3=o(function(t,r){return[Hb(t[0],r[0]),Yb(t[1],r[1])]},"hashArrays"),Mfe=o(function(t,r){var i={value:0,done:!1},n=0,a=t.length,s={next:o(function(){return n=0;n--)t[n]===r&&t.splice(n,1)},"removeFromArray"),gP=o(function(t){t.splice(0,t.length)},"clearArray"),lrt=o(function(t,r){for(var i=0;i"u"?"undefined":Wn(Set))!==urt?Set:hrt,X3=o(function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(t===void 0||r===void 0||!hP(t)){Yi("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){Yi("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var a=this._private={cy:t,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new y1,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),r.renderedPosition){var s=r.renderedPosition,l=t.pan(),u=t.zoom();a.position={x:(s.x-l.x)/u,y:(s.y-l.y)/u}}var h=[];Si(r.classes)?h=r.classes:sr(r.classes)&&(h=r.classes.split(/\s+/));for(var d=0,f=h.length;d0;){var k=b.pop(),E=v(k),A=k.id();if(p[A]=E,E!==1/0)for(var N=k.neighborhood().intersect(g),P=0;P0)for(O.unshift(B);f[G];){var F=f[G];O.unshift(F.edge),O.unshift(F.node),$=F.node,G=$.id()}return l.spawn(O)},"pathTo")}},"dijkstra")},vrt={kruskal:o(function(t){t=t||function(T){return 1};for(var r=this.byGroup(),i=r.nodes,n=r.edges,a=i.length,s=new Array(a),l=i,u=o(function(w){for(var C=0;C0;){if(C(),E++,w===d){for(var A=[],N=a,P=d,I=x[P];A.unshift(N),I!=null&&A.unshift(I),N=v[P],N!=null;)P=N.id(),I=x[P];return{found:!0,distance:f[w],path:this.spawn(A),steps:E}}m[w]=!0;for(var D=T._private.edges,_=0;_I&&(g[P]=I,b[P]=N,T[P]=C),!a){var D=N*d+A;!a&&g[D]>I&&(g[D]=I,b[D]=A,T[D]=C)}}}for(var _=0;_1&&arguments[1]!==void 0?arguments[1]:s,$e=T(we),de=[],rt=$e;;){if(rt==null)return r.spawn();var ke=b(rt),Fe=ke.edge,He=ke.pred;if(de.unshift(rt[0]),rt.same(Me)&&de.length>0)break;Fe!=null&&de.unshift(Fe),rt=He}return u.spawn(de)},"pathTo"),k=0;k=0;d--){var f=h[d],p=f[1],m=f[2];(r[p]===l&&r[m]===u||r[p]===u&&r[m]===l)&&h.splice(d,1)}for(var g=0;gn;){var a=Math.floor(Math.random()*r.length);r=Ert(a,t,r),i--}return r},"contractUntil"),Art={kargerStein:o(function(){var t=this,r=this.byGroup(),i=r.nodes,n=r.edges;n.unmergeBy(function(O){return O.isLoop()});var a=i.length,s=n.length,l=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),u=Math.floor(a/Srt);if(a<2){Yi("At least 2 nodes are required for Karger-Stein algorithm");return}for(var h=[],d=0;d1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,n=1/0,a=r;a1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,n=-1/0,a=r;a1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,n=0,a=0,s=r;s1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?t=t.slice(r,i):(i0&&t.splice(0,r));for(var l=0,u=t.length-1;u>=0;u--){var h=t[u];s?isFinite(h)||(t[u]=-1/0,l++):t.splice(u,1)}a&&t.sort(function(p,m){return p-m});var d=t.length,f=Math.floor(d/2);return d%2!==0?t[f+1+l]:(t[f-1+l]+t[f+l])/2},"median"),Nrt=o(function(t){return Math.PI*t/180},"deg2rad"),h3=o(function(t,r){return Math.atan2(r,t)-Math.PI/2},"getAngleFromDisp"),yP=Math.log2||function(e){return Math.log(e)/Math.log(2)},vP=o(function(t){return t>0?1:t<0?-1:0},"signum"),e0=o(function(t,r){return Math.sqrt(jp(t,r))},"dist"),jp=o(function(t,r){var i=r.x-t.x,n=r.y-t.y;return i*i+n*n},"sqdist"),Irt=o(function(t){for(var r=t.length,i=0,n=0;n=t.x1&&t.y2>=t.y1)return{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,w:t.x2-t.x1,h:t.y2-t.y1};if(t.w!=null&&t.h!=null&&t.w>=0&&t.h>=0)return{x1:t.x1,y1:t.y1,x2:t.x1+t.w,y2:t.y1+t.h,w:t.w,h:t.h}}},"makeBoundingBox"),Prt=o(function(t){return{x1:t.x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h}},"copyBoundingBox"),Brt=o(function(t){t.x1=1/0,t.y1=1/0,t.x2=-1/0,t.y2=-1/0,t.w=0,t.h=0},"clearBoundingBox"),Frt=o(function(t,r){t.x1=Math.min(t.x1,r.x1),t.x2=Math.max(t.x2,r.x2),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,r.y1),t.y2=Math.max(t.y2,r.y2),t.h=t.y2-t.y1},"updateBoundingBox"),ume=o(function(t,r,i){t.x1=Math.min(t.x1,r),t.x2=Math.max(t.x2,r),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,i),t.y2=Math.max(t.y2,i),t.h=t.y2-t.y1},"expandBoundingBoxByPoint"),k3=o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.x1-=r,t.x2+=r,t.y1-=r,t.y2+=r,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},"expandBoundingBox"),w3=o(function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],i,n,a,s;if(r.length===1)i=n=a=s=r[0];else if(r.length===2)i=a=r[0],s=n=r[1];else if(r.length===4){var l=Dn(r,4);i=l[0],n=l[1],a=l[2],s=l[3]}return t.x1-=s,t.x2+=n,t.y1-=i,t.y2+=a,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},"expandBoundingBoxSides"),Ffe=o(function(t,r){t.x1=r.x1,t.y1=r.y1,t.x2=r.x2,t.y2=r.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1},"assignBoundingBox"),xP=o(function(t,r){return!(t.x1>r.x2||r.x1>t.x2||t.x2r.y2||r.y1>t.y2)},"boundingBoxesIntersect"),zd=o(function(t,r,i){return t.x1<=r&&r<=t.x2&&t.y1<=i&&i<=t.y2},"inBoundingBox"),$fe=o(function(t,r){return zd(t,r.x,r.y)},"pointInBoundingBox"),hme=o(function(t,r){return zd(t,r.x1,r.y1)&&zd(t,r.x2,r.y2)},"boundingBoxInBoundingBox"),$rt=(L9=Math.hypot)!==null&&L9!==void 0?L9:function(e,t){return Math.sqrt(e*e+t*t)};o(zrt,"inflatePolygon");o(Grt,"miterBox");dme=o(function(t,r,i,n,a,s,l){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",h=u==="auto"?Hd(a,s):u,d=a/2,f=s/2;h=Math.min(h,d,f);var p=h!==d,m=h!==f,g;if(p){var y=i-d+h-l,v=n-f-l,x=i+d-h+l,b=v;if(g=Gd(t,r,i,n,y,v,x,b,!1),g.length>0)return g}if(m){var T=i+d+l,w=n-f+h-l,C=T,k=n+f-h+l;if(g=Gd(t,r,i,n,T,w,C,k,!1),g.length>0)return g}if(p){var E=i-d+h-l,A=n+f+l,N=i+d-h+l,P=A;if(g=Gd(t,r,i,n,E,A,N,P,!1),g.length>0)return g}if(m){var I=i-d-l,D=n-f+h-l,_=I,R=n+f-h+l;if(g=Gd(t,r,i,n,I,D,_,R,!1),g.length>0)return g}var M;{var L=i-d+h,B=n-f+h;if(M=zb(t,r,i,n,L,B,h+l),M.length>0&&M[0]<=L&&M[1]<=B)return[M[0],M[1]]}{var O=i+d-h,$=n-f+h;if(M=zb(t,r,i,n,O,$,h+l),M.length>0&&M[0]>=O&&M[1]<=$)return[M[0],M[1]]}{var G=i+d-h,F=n+f-h;if(M=zb(t,r,i,n,G,F,h+l),M.length>0&&M[0]>=G&&M[1]>=F)return[M[0],M[1]]}{var V=i-d+h,H=n+f-h;if(M=zb(t,r,i,n,V,H,h+l),M.length>0&&M[0]<=V&&M[1]>=H)return[M[0],M[1]]}return[]},"roundRectangleIntersectLine"),Vrt=o(function(t,r,i,n,a,s,l){var u=l,h=Math.min(i,a),d=Math.max(i,a),f=Math.min(n,s),p=Math.max(n,s);return h-u<=t&&t<=d+u&&f-u<=r&&r<=p+u},"inLineVicinity"),Wrt=o(function(t,r,i,n,a,s,l,u,h){var d={x1:Math.min(i,l,a)-h,x2:Math.max(i,l,a)+h,y1:Math.min(n,u,s)-h,y2:Math.max(n,u,s)+h};return!(td.x2||rd.y2)},"inBezierVicinity"),qrt=o(function(t,r,i,n){i-=n;var a=r*r-4*t*i;if(a<0)return[];var s=Math.sqrt(a),l=2*t,u=(-r+s)/l,h=(-r-s)/l;return[u,h]},"solveQuadratic"),Urt=o(function(t,r,i,n,a){var s=1e-5;t===0&&(t=s),r/=t,i/=t,n/=t;var l,u,h,d,f,p,m,g;if(u=(3*i-r*r)/9,h=-(27*n)+r*(9*i-2*(r*r)),h/=54,l=u*u*u+h*h,a[1]=0,m=r/3,l>0){f=h+Math.sqrt(l),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),p=h-Math.sqrt(l),p=p<0?-Math.pow(-p,1/3):Math.pow(p,1/3),a[0]=-m+f+p,m+=(f+p)/2,a[4]=a[2]=-m,m=Math.sqrt(3)*(-p+f)/2,a[3]=m,a[5]=-m;return}if(a[5]=a[3]=0,l===0){g=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),a[0]=-m+2*g,a[4]=a[2]=-(g+m);return}u=-u,d=u*u*u,d=Math.acos(h/Math.sqrt(d)),g=2*Math.sqrt(u),a[0]=-m+g*Math.cos(d/3),a[2]=-m+g*Math.cos((d+2*Math.PI)/3),a[4]=-m+g*Math.cos((d+4*Math.PI)/3)},"solveCubic"),Hrt=o(function(t,r,i,n,a,s,l,u){var h=1*i*i-4*i*a+2*i*l+4*a*a-4*a*l+l*l+n*n-4*n*s+2*n*u+4*s*s-4*s*u+u*u,d=9*i*a-3*i*i-3*i*l-6*a*a+3*a*l+9*n*s-3*n*n-3*n*u-6*s*s+3*s*u,f=3*i*i-6*i*a+i*l-i*t+2*a*a+2*a*t-l*t+3*n*n-6*n*s+n*u-n*r+2*s*s+2*s*r-u*r,p=1*i*a-i*i+i*t-a*t+n*s-n*n+n*r-s*r,m=[];Urt(h,d,f,p,m);for(var g=1e-7,y=[],v=0;v<6;v+=2)Math.abs(m[v+1])=0&&m[v]<=1&&y.push(m[v]);y.push(1),y.push(0);for(var x=-1,b,T,w,C=0;C=0?wh?(t-a)*(t-a)+(r-s)*(r-s):d-p},"sqdistToFiniteLine"),Bs=o(function(t,r,i){for(var n,a,s,l,u,h=0,d=0;d=t&&t>=s||n<=t&&t<=s)u=(t-n)/(s-n)*(l-a)+a,u>r&&h++;else continue;return h%2!==0},"pointInsidePolygonPoints"),Qu=o(function(t,r,i,n,a,s,l,u,h){var d=new Array(i.length),f;u[0]!=null?(f=Math.atan(u[1]/u[0]),u[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=u;for(var p=Math.cos(-f),m=Math.sin(-f),g=0;g0){var v=F3(d,-h);y=B3(v)}else y=d;return Bs(t,r,y)},"pointInsidePolygon"),jrt=o(function(t,r,i,n,a,s,l,u){for(var h=new Array(i.length*2),d=0;d=0&&v<=1&&b.push(v),x>=0&&x<=1&&b.push(x),b.length===0)return[];var T=b[0]*u[0]+t,w=b[0]*u[1]+r;if(b.length>1){if(b[0]==b[1])return[T,w];var C=b[1]*u[0]+t,k=b[1]*u[1]+r;return[T,w,C,k]}else return[T,w]},"intersectLineCircle"),M9=o(function(t,r,i){return r<=t&&t<=i||i<=t&&t<=r?t:t<=r&&r<=i||i<=r&&r<=t?r:i},"midOfThree"),Gd=o(function(t,r,i,n,a,s,l,u,h){var d=t-a,f=i-t,p=l-a,m=r-s,g=n-r,y=u-s,v=p*m-y*d,x=f*m-g*d,b=y*f-p*g;if(b!==0){var T=v/b,w=x/b,C=.001,k=0-C,E=1+C;return k<=T&&T<=E&&k<=w&&w<=E?[t+T*f,r+T*g]:h?[t+T*f,r+T*g]:[]}else return v===0||x===0?M9(t,i,l)===l?[l,u]:M9(t,i,a)===a?[a,s]:M9(a,l,i)===i?[i,n]:[]:[]},"finiteLinesIntersect"),Krt=o(function(t,r,i,n,a){var s=[],l=n/2,u=a/2,h=r,d=i;s.push({x:h+l*t[0],y:d+u*t[1]});for(var f=1;f0){var y=F3(f,-u);m=B3(y)}else m=f}else m=i;for(var v,x,b,T,w=0;w2){for(var g=[d[0],d[1]],y=Math.pow(g[0]-t,2)+Math.pow(g[1]-r,2),v=1;vd&&(d=w)},"set"),get:o(function(T){return h[T]},"get")},p=0;p0?M=R.edgesTo(_)[0]:M=_.edgesTo(R)[0];var L=n(M);_=_.id(),E[_]>E[I]+L&&(E[_]=E[I]+L,A.nodes.indexOf(_)<0?A.push(_):A.updateItem(_),k[_]=0,C[_]=[]),E[_]==E[I]+L&&(k[_]=k[_]+k[I],C[_].push(I))}else for(var B=0;B0;){for(var F=w.pop(),V=0;V0&&l.push(i[u]);l.length!==0&&a.push(n.collection(l))}return a},"assign"),hit=o(function(t,r){for(var i=0;i5&&arguments[5]!==void 0?arguments[5]:pit,l=n,u,h,d=0;d=2?Nb(t,r,i,0,qfe,mit):Nb(t,r,i,0,Wfe)},"euclidean"),squaredEuclidean:o(function(t,r,i){return Nb(t,r,i,0,qfe)},"squaredEuclidean"),manhattan:o(function(t,r,i){return Nb(t,r,i,0,Wfe)},"manhattan"),max:o(function(t,r,i){return Nb(t,r,i,-1/0,git)},"max")};m1["squared-euclidean"]=m1.squaredEuclidean;m1.squaredeuclidean=m1.squaredEuclidean;o(Z3,"clusteringDistance");yit=va({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),TP=o(function(t){return yit(t)},"setOptions"),$3=o(function(t,r,i,n,a){var s=a!=="kMedoids",l=s?function(f){return i[f]}:function(f){return n[f](i)},u=o(function(p){return n[p](r)},"getQ"),h=i,d=r;return Z3(t,n.length,l,u,h,d)},"getDist"),I9=o(function(t,r,i){for(var n=i.length,a=new Array(n),s=new Array(n),l=new Array(r),u=null,h=0;hi)return!1}return!0},"haveMatricesConverged"),bit=o(function(t,r,i){for(var n=0;nl&&(l=r[h][d],u=d);a[u].push(t[h])}for(var f=0;f=a.threshold||a.mode==="dendrogram"&&t.length===1)return!1;var g=r[s],y=r[n[s]],v;a.mode==="dendrogram"?v={left:g,right:y,key:g.key}:v={value:g.value.concat(y.value),key:g.key},t[g.index]=v,t.splice(y.index,1),r[g.key]=v;for(var x=0;xi[y.key][b.key]&&(u=i[y.key][b.key])):a.linkage==="max"?(u=i[g.key][b.key],i[g.key][b.key]0&&n.push(a);return n},"findExemplars"),Kfe=o(function(t,r,i){for(var n=[],a=0;al&&(s=h,l=r[a*t+h])}s>0&&n.push(s)}for(var d=0;dh&&(u=d,h=f)}i[a]=s[u]}return n=Kfe(t,r,i),n},"assign"),Zfe=o(function(t){for(var r=this.cy(),i=this.nodes(),n=Mit(t),a={},s=0;s=I?(D=I,I=R,_=M):R>D&&(D=R);for(var L=0;L0?1:0;E[N%n.minIterations*l+V]=H,F+=H}if(F>0&&(N>=n.minIterations-1||N==n.maxIterations-1)){for(var j=0,U=0;U1||k>1)&&(l=!0),f[T]=[],b.outgoers().forEach(function(A){A.isEdge()&&f[T].push(A.id())})}else p[T]=[void 0,b.target().id()]}):s.forEach(function(b){var T=b.id();if(b.isNode()){var w=b.degree(!0);w%2&&(u?h?l=!0:h=T:u=T),f[T]=[],b.connectedEdges().forEach(function(C){return f[T].push(C.id())})}else p[T]=[b.source().id(),b.target().id()]});var m={found:!1,trail:void 0};if(l)return m;if(h&&u)if(a){if(d&&h!=d)return m;d=h}else{if(d&&h!=d&&u!=d)return m;d||(d=h)}else d||(d=s[0].id());var g=o(function(T){for(var w=T,C=[T],k,E,A;f[w].length;)k=f[w].shift(),E=p[k][0],A=p[k][1],w!=A?(f[A]=f[A].filter(function(N){return N!=k}),w=A):!a&&w!=E&&(f[E]=f[E].filter(function(N){return N!=k}),w=E),C.unshift(k),C.unshift(w);return C},"walk"),y=[],v=[];for(v=g(d);v.length!=1;)f[v[0]].length==0?(y.unshift(s.getElementById(v.shift())),y.unshift(s.getElementById(v.shift()))):v=g(v.shift()).concat(v);y.unshift(s.getElementById(v.shift()));for(var x in f)if(f[x].length)return m;return m.found=!0,m.trail=this.spawn(y,!0),m},"hierholzer")},f3=o(function(){var t=this,r={},i=0,n=0,a=[],s=[],l={},u=o(function(p,m){for(var g=s.length-1,y=[],v=t.spawn();s[g].x!=p||s[g].y!=m;)y.push(s.pop().edge),g--;y.push(s.pop().edge),y.forEach(function(x){var b=x.connectedNodes().intersection(t);v.merge(x),b.forEach(function(T){var w=T.id(),C=T.connectedEdges().intersection(t);v.merge(T),r[w].cutVertex?v.merge(C.filter(function(k){return k.isLoop()})):v.merge(C)})}),a.push(v)},"buildComponent"),h=o(function(p,m,g){p===g&&(n+=1),r[m]={id:i,low:i++,cutVertex:!1};var y=t.getElementById(m).connectedEdges().intersection(t);if(y.size()===0)a.push(t.spawn(t.getElementById(m)));else{var v,x,b,T;y.forEach(function(w){v=w.source().id(),x=w.target().id(),b=v===m?x:v,b!==g&&(T=w.id(),l[T]||(l[T]=!0,s.push({x:m,y:b,edge:w})),b in r?r[m].low=Math.min(r[m].low,r[b].id):(h(p,b,m),r[m].low=Math.min(r[m].low,r[b].low),r[m].id<=r[b].low&&(r[m].cutVertex=!0,u(m,b))))})}},"biconnectedSearch");t.forEach(function(f){if(f.isNode()){var p=f.id();p in r||(n=0,h(p,p),r[p].cutVertex=n>1)}});var d=Object.keys(r).filter(function(f){return r[f].cutVertex}).map(function(f){return t.getElementById(f)});return{cut:t.spawn(d),components:a}},"hopcroftTarjanBiconnected"),zit={hopcroftTarjanBiconnected:f3,htbc:f3,htb:f3,hopcroftTarjanBiconnectedComponents:f3},p3=o(function(){var t=this,r={},i=0,n=[],a=[],s=t.spawn(t),l=o(function(h){a.push(h),r[h]={index:i,low:i++,explored:!1};var d=t.getElementById(h).connectedEdges().intersection(t);if(d.forEach(function(y){var v=y.target().id();v!==h&&(v in r||l(v),r[v].explored||(r[h].low=Math.min(r[h].low,r[v].low)))}),r[h].index===r[h].low){for(var f=t.spawn();;){var p=a.pop();if(f.merge(t.getElementById(p)),r[p].low=r[h].index,r[p].explored=!0,p===h)break}var m=f.edgesWith(f),g=f.merge(m);n.push(g),s=s.difference(g)}},"stronglyConnectedSearch");return t.forEach(function(u){if(u.isNode()){var h=u.id();h in r||l(h)}}),{cut:s,components:n}},"tarjanStronglyConnected"),Git={tarjanStronglyConnected:p3,tsc:p3,tscc:p3,tarjanStronglyConnectedComponents:p3},xme={};[jb,yrt,vrt,brt,Crt,wrt,Art,eit,h1,d1,YO,fit,Eit,Rit,Bit,$it,zit,Git].forEach(function(e){hr(xme,e)});bme=0,Tme=1,Cme=2,$l=o(function(t){if(!(this instanceof $l))return new $l(t);this.id="Thenable/1.0.7",this.state=bme,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))},"api");$l.prototype={fulfill:o(function(t){return Qfe(this,Tme,"fulfillValue",t)},"fulfill"),reject:o(function(t){return Qfe(this,Cme,"rejectReason",t)},"reject"),then:o(function(t,r){var i=this,n=new $l;return i.onFulfilled.push(epe(t,n,"fulfill")),i.onRejected.push(epe(r,n,"reject")),kme(i),n.proxy},"then")};Qfe=o(function(t,r,i,n){return t.state===bme&&(t.state=r,t[i]=n,kme(t)),t},"deliver"),kme=o(function(t){t.state===Tme?Jfe(t,"onFulfilled",t.fulfillValue):t.state===Cme&&Jfe(t,"onRejected",t.rejectReason)},"execute"),Jfe=o(function(t,r,i){if(t[r].length!==0){var n=t[r];t[r]=[];var a=o(function(){for(var l=0;l0},"animatedImpl")},"animated"),clearQueue:o(function(){return o(function(){var r=this,i=r.length!==void 0,n=i?r:[r],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var s=0;s0&&this.spawn(n).updateStyle().emit("class"),r},"classes"),addClass:o(function(t){return this.toggleClass(t,!0)},"addClass"),hasClass:o(function(t){var r=this[0];return r!=null&&r._private.classes.has(t)},"hasClass"),toggleClass:o(function(t,r){Si(t)||(t=t.match(/\S+/g)||[]);for(var i=this,n=r===void 0,a=[],s=0,l=i.length;s0&&this.spawn(a).updateStyle().emit("class"),i},"toggleClass"),removeClass:o(function(t){return this.toggleClass(t,!1)},"removeClass"),flashClass:o(function(t,r){var i=this;if(r==null)r=250;else if(r===0)return i;return i.addClass(t),setTimeout(function(){i.removeClass(t)},r),i},"flashClass")};S3.className=S3.classNames=S3.classes;jr={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Vn,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};jr.variable="(?:[\\w-.]|(?:\\\\"+jr.metaChar+"))+";jr.className="(?:[\\w-]|(?:\\\\"+jr.metaChar+"))+";jr.value=jr.string+"|"+jr.number;jr.id=jr.variable;(function(){var e,t,r;for(e=jr.comparatorOp.split("|"),r=0;r=0)&&t!=="="&&(jr.comparatorOp+="|\\!"+t)})();xi=o(function(){return{checks:[]}},"newQuery"),Yt={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},ZO=[{selector:":selected",matches:o(function(t){return t.selected()},"matches")},{selector:":unselected",matches:o(function(t){return!t.selected()},"matches")},{selector:":selectable",matches:o(function(t){return t.selectable()},"matches")},{selector:":unselectable",matches:o(function(t){return!t.selectable()},"matches")},{selector:":locked",matches:o(function(t){return t.locked()},"matches")},{selector:":unlocked",matches:o(function(t){return!t.locked()},"matches")},{selector:":visible",matches:o(function(t){return t.visible()},"matches")},{selector:":hidden",matches:o(function(t){return!t.visible()},"matches")},{selector:":transparent",matches:o(function(t){return t.transparent()},"matches")},{selector:":grabbed",matches:o(function(t){return t.grabbed()},"matches")},{selector:":free",matches:o(function(t){return!t.grabbed()},"matches")},{selector:":removed",matches:o(function(t){return t.removed()},"matches")},{selector:":inside",matches:o(function(t){return!t.removed()},"matches")},{selector:":grabbable",matches:o(function(t){return t.grabbable()},"matches")},{selector:":ungrabbable",matches:o(function(t){return!t.grabbable()},"matches")},{selector:":animated",matches:o(function(t){return t.animated()},"matches")},{selector:":unanimated",matches:o(function(t){return!t.animated()},"matches")},{selector:":parent",matches:o(function(t){return t.isParent()},"matches")},{selector:":childless",matches:o(function(t){return t.isChildless()},"matches")},{selector:":child",matches:o(function(t){return t.isChild()},"matches")},{selector:":orphan",matches:o(function(t){return t.isOrphan()},"matches")},{selector:":nonorphan",matches:o(function(t){return t.isChild()},"matches")},{selector:":compound",matches:o(function(t){return t.isNode()?t.isParent():t.source().isParent()||t.target().isParent()},"matches")},{selector:":loop",matches:o(function(t){return t.isLoop()},"matches")},{selector:":simple",matches:o(function(t){return t.isSimple()},"matches")},{selector:":active",matches:o(function(t){return t.active()},"matches")},{selector:":inactive",matches:o(function(t){return!t.active()},"matches")},{selector:":backgrounding",matches:o(function(t){return t.backgrounding()},"matches")},{selector:":nonbackgrounding",matches:o(function(t){return!t.backgrounding()},"matches")}].sort(function(e,t){return Ott(e.selector,t.selector)}),Fnt=(function(){for(var e={},t,r=0;r0&&d.edgeCount>0)return di("The selector `"+t+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(d.edgeCount>1)return di("The selector `"+t+"` is invalid because it uses multiple edge selectors"),!1;d.edgeCount===1&&di("The selector `"+t+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},"parse"),qnt=o(function(){if(this.toStringCache!=null)return this.toStringCache;for(var t=o(function(d){return d??""},"clean"),r=o(function(d){return sr(d)?'"'+d+'"':t(d)},"cleanVal"),i=o(function(d){return" "+d+" "},"space"),n=o(function(d,f){var p=d.type,m=d.value;switch(p){case Yt.GROUP:{var g=t(m);return g.substring(0,g.length-1)}case Yt.DATA_COMPARE:{var y=d.field,v=d.operator;return"["+y+i(t(v))+r(m)+"]"}case Yt.DATA_BOOL:{var x=d.operator,b=d.field;return"["+t(x)+b+"]"}case Yt.DATA_EXIST:{var T=d.field;return"["+T+"]"}case Yt.META_COMPARE:{var w=d.operator,C=d.field;return"[["+C+i(t(w))+r(m)+"]]"}case Yt.STATE:return m;case Yt.ID:return"#"+m;case Yt.CLASS:return"."+m;case Yt.PARENT:case Yt.CHILD:return a(d.parent,f)+i(">")+a(d.child,f);case Yt.ANCESTOR:case Yt.DESCENDANT:return a(d.ancestor,f)+" "+a(d.descendant,f);case Yt.COMPOUND_SPLIT:{var k=a(d.left,f),E=a(d.subject,f),A=a(d.right,f);return k+(k.length>0?" ":"")+E+A}case Yt.TRUE:return""}},"checkToString"),a=o(function(d,f){return d.checks.reduce(function(p,m,g){return p+(f===d&&g===0?"$":"")+n(m,f)},"")},"queryToString"),s="",l=0;l1&&l=0&&(r=r.replace("!",""),f=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),d=!0),(a||l||d)&&(u=!a&&!s?"":""+t,h=""+i),d&&(t=u=u.toLowerCase(),i=h=h.toLowerCase()),r){case"*=":n=u.indexOf(h)>=0;break;case"$=":n=u.indexOf(h,u.length-h.length)>=0;break;case"^=":n=u.indexOf(h)===0;break;case"=":n=t===i;break;case">":p=!0,n=t>i;break;case">=":p=!0,n=t>=i;break;case"<":p=!0,n=t1&&arguments[1]!==void 0?arguments[1]:!0;return SP(this,e,t,Lme)};o(Mme,"addParent");g1.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return SP(this,e,t,Mme)};o(Qnt,"addParentAndChildren");g1.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return SP(this,e,t,Qnt)};g1.ancestors=g1.parents;Zb=Nme={data:hi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:hi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:hi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:hi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:hi.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:hi.removeData({field:"rscratch",triggerEvent:!1}),id:o(function(){var t=this[0];if(t)return t._private.data.id},"id")};Zb.attr=Zb.data;Zb.removeAttr=Zb.removeData;Jnt=Nme,rE={};o(MO,"defineDegreeFunction");hr(rE,{degree:MO(function(e,t){return t.source().same(t.target())?2:1}),indegree:MO(function(e,t){return t.target().same(e)?1:0}),outdegree:MO(function(e,t){return t.source().same(e)?1:0})});o(e1,"defineDegreeBoundsFunction");hr(rE,{minDegree:e1("degree",function(e,t){return et}),minIndegree:e1("indegree",function(e,t){return et}),minOutdegree:e1("outdegree",function(e,t){return et})});hr(rE,{totalDegree:o(function(t){for(var r=0,i=this.nodes(),n=0;n0,p=f;f&&(d=d[0]);var m=p?d.position():{x:0,y:0};r!==void 0?h.position(t,r+m[t]):a!==void 0&&h.position({x:a.x+m.x,y:a.y+m.y})}else{var g=i.position(),y=l?i.parent():null,v=y&&y.length>0,x=v;v&&(y=y[0]);var b=x?y.position():{x:0,y:0};return a={x:g.x-b.x,y:g.y-b.y},t===void 0?a:a[t]}else if(!s)return;return this},"relativePosition")};Fl.modelPosition=Fl.point=Fl.position;Fl.modelPositions=Fl.points=Fl.positions;Fl.renderedPoint=Fl.renderedPosition;Fl.relativePoint=Fl.relativePosition;eat=Ime;f1=Qd={};Qd.renderedBoundingBox=function(e){var t=this.boundingBox(e),r=this.cy(),i=r.zoom(),n=r.pan(),a=t.x1*i+n.x,s=t.x2*i+n.x,l=t.y1*i+n.y,u=t.y2*i+n.y;return{x1:a,x2:s,y1:l,y2:u,w:s-a,h:u-l}};Qd.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var i=r._private;i.compoundBoundsClean=!1,i.bbCache=null,e||r.emitAndNotify("bounds")}}),this)};Qd.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function r(s){if(!s.isParent())return;var l=s._private,u=s.children(),h=s.pstyle("compound-sizing-wrt-labels").value==="include",d={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},f=u.boundingBox({includeLabels:h,includeOverlays:!1,useCache:!1}),p=l.position;(f.w===0||f.h===0)&&(f={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},f.x1=p.x-f.w/2,f.x2=p.x+f.w/2,f.y1=p.y-f.h/2,f.y2=p.y+f.h/2);function m(N,P,I){var D=0,_=0,R=P+I;return N>0&&R>0&&(D=P/R*N,_=I/R*N),{biasDiff:D,biasComplementDiff:_}}o(m,"computeBiasValues");function g(N,P,I,D){if(I.units==="%")switch(D){case"width":return N>0?I.pfValue*N:0;case"height":return P>0?I.pfValue*P:0;case"average":return N>0&&P>0?I.pfValue*(N+P)/2:0;case"min":return N>0&&P>0?N>P?I.pfValue*P:I.pfValue*N:0;case"max":return N>0&&P>0?N>P?I.pfValue*N:I.pfValue*P:0;default:return 0}else return I.units==="px"?I.pfValue:0}o(g,"computePaddingValues");var y=d.width.left.value;d.width.left.units==="px"&&d.width.val>0&&(y=y*100/d.width.val);var v=d.width.right.value;d.width.right.units==="px"&&d.width.val>0&&(v=v*100/d.width.val);var x=d.height.top.value;d.height.top.units==="px"&&d.height.val>0&&(x=x*100/d.height.val);var b=d.height.bottom.value;d.height.bottom.units==="px"&&d.height.val>0&&(b=b*100/d.height.val);var T=m(d.width.val-f.w,y,v),w=T.biasDiff,C=T.biasComplementDiff,k=m(d.height.val-f.h,x,b),E=k.biasDiff,A=k.biasComplementDiff;l.autoPadding=g(f.w,f.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),l.autoWidth=Math.max(f.w,d.width.val),p.x=(-w+f.x1+f.x2+C)/2,l.autoHeight=Math.max(f.h,d.height.val),p.y=(-E+f.y1+f.y2+A)/2}o(r,"update");for(var i=0;it.x2?n:t.x2,t.y1=it.y2?a:t.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1)},"updateBounds"),Fd=o(function(t,r){return r==null?t:Bl(t,r.x1,r.y1,r.x2,r.y2)},"updateBoundsFromBox"),Ib=o(function(t,r,i){return Ps(t,r,i)},"prefixedProperty"),m3=o(function(t,r,i){if(!r.cy().headless()){var n=r._private,a=n.rstyle,s=a.arrowWidth/2,l=r.pstyle(i+"-arrow-shape").value,u,h;if(l!=="none"){i==="source"?(u=a.srcX,h=a.srcY):i==="target"?(u=a.tgtX,h=a.tgtY):(u=a.midX,h=a.midY);var d=n.arrowBounds=n.arrowBounds||{},f=d[i]=d[i]||{};f.x1=u-s,f.y1=h-s,f.x2=u+s,f.y2=h+s,f.w=f.x2-f.x1,f.h=f.y2-f.y1,k3(f,1),Bl(t,f.x1,f.y1,f.x2,f.y2)}}},"updateBoundsFromArrow"),NO=o(function(t,r,i){if(!r.cy().headless()){var n;i?n=i+"-":n="";var a=r._private,s=a.rstyle,l=r.pstyle(n+"label").strValue;if(l){var u=r.pstyle("text-halign"),h=r.pstyle("text-valign"),d=Ib(s,"labelWidth",i),f=Ib(s,"labelHeight",i),p=Ib(s,"labelX",i),m=Ib(s,"labelY",i),g=r.pstyle(n+"text-margin-x").pfValue,y=r.pstyle(n+"text-margin-y").pfValue,v=r.isEdge(),x=r.pstyle(n+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,T=r.pstyle("text-border-width").pfValue,w=T/2,C=r.pstyle("text-background-padding").pfValue,k=2,E=f,A=d,N=A/2,P=E/2,I,D,_,R;if(v)I=p-N,D=p+N,_=m-P,R=m+P;else{switch(u.value){case"left":I=p-A,D=p;break;case"center":I=p-N,D=p+N;break;case"right":I=p,D=p+A;break}switch(h.value){case"top":_=m-E,R=m;break;case"center":_=m-P,R=m+P;break;case"bottom":_=m,R=m+E;break}}var M=g-Math.max(b,w)-C-k,L=g+Math.max(b,w)+C+k,B=y-Math.max(b,w)-C-k,O=y+Math.max(b,w)+C+k;I+=M,D+=L,_+=B,R+=O;var $=i||"main",G=a.labelBounds,F=G[$]=G[$]||{};F.x1=I,F.y1=_,F.x2=D,F.y2=R,F.w=D-I,F.h=R-_,F.leftPad=M,F.rightPad=L,F.topPad=B,F.botPad=O;var V=v&&x.strValue==="autorotate",H=x.pfValue!=null&&x.pfValue!==0;if(V||H){var j=V?Ib(a.rstyle,"labelAngle",i):x.pfValue,U=Math.cos(j),Q=Math.sin(j),Y=(I+D)/2,ae=(_+R)/2;if(!v){switch(u.value){case"left":Y=D;break;case"right":Y=I;break}switch(h.value){case"top":ae=R;break;case"bottom":ae=_;break}}var J=o(function(Ee,we){return Ee=Ee-Y,we=we-ae,{x:Ee*U-we*Q+Y,y:Ee*Q+we*U+ae}},"rotate"),te=J(I,_),re=J(I,R),ee=J(D,_),Te=J(D,R);I=Math.min(te.x,re.x,ee.x,Te.x),D=Math.max(te.x,re.x,ee.x,Te.x),_=Math.min(te.y,re.y,ee.y,Te.y),R=Math.max(te.y,re.y,ee.y,Te.y)}var ue=$+"Rot",De=G[ue]=G[ue]||{};De.x1=I,De.y1=_,De.x2=D,De.y2=R,De.w=D-I,De.h=R-_,Bl(t,I,_,D,R),Bl(a.labelBounds.all,I,_,D,R)}return t}},"updateBoundsFromLabel"),Jpe=o(function(t,r){if(!r.cy().headless()){var i=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value,a=r.pstyle("outline-offset").value,s=n+a;Pme(t,r,i,s,"outside",s/2)}},"updateBoundsFromOutline"),Pme=o(function(t,r,i,n,a,s){if(!(i===0||n<=0||a==="inside")){var l=r.cy(),u=r.pstyle("shape").value,h=l.renderer().nodeShapes[u],d=r.position(),f=d.x,p=d.y,m=r.width(),g=r.height();if(h.hasMiterBounds){a==="center"&&(n/=2);var y=h.miterBounds(f,p,m,g,n);Fd(t,y)}else s!=null&&s>0&&w3(t,[s,s,s,s])}},"updateBoundsFromMiter"),tat=o(function(t,r){if(!r.cy().headless()){var i=r.pstyle("border-opacity").value,n=r.pstyle("border-width").pfValue,a=r.pstyle("border-position").value;Pme(t,r,i,n,a)}},"updateBoundsFromMiterBorder"),rat=o(function(t,r){var i=t._private.cy,n=i.styleEnabled(),a=i.headless(),s=is(),l=t._private,u=t.isNode(),h=t.isEdge(),d,f,p,m,g,y,v=l.rstyle,x=u&&n?t.pstyle("bounds-expansion").pfValue:[0],b=o(function(Ie){return Ie.pstyle("display").value!=="none"},"isDisplayed"),T=!n||b(t)&&(!h||b(t.source())&&b(t.target()));if(T){var w=0,C=0;n&&r.includeOverlays&&(w=t.pstyle("overlay-opacity").value,w!==0&&(C=t.pstyle("overlay-padding").value));var k=0,E=0;n&&r.includeUnderlays&&(k=t.pstyle("underlay-opacity").value,k!==0&&(E=t.pstyle("underlay-padding").value));var A=Math.max(C,E),N=0,P=0;if(n&&(N=t.pstyle("width").pfValue,P=N/2),u&&r.includeNodes){var I=t.position();g=I.x,y=I.y;var D=t.outerWidth(),_=D/2,R=t.outerHeight(),M=R/2;d=g-_,f=g+_,p=y-M,m=y+M,Bl(s,d,p,f,m),n&&Jpe(s,t),n&&r.includeOutlines&&!a&&Jpe(s,t),n&&tat(s,t)}else if(h&&r.includeEdges)if(n&&!a){var L=t.pstyle("curve-style").strValue;if(d=Math.min(v.srcX,v.midX,v.tgtX),f=Math.max(v.srcX,v.midX,v.tgtX),p=Math.min(v.srcY,v.midY,v.tgtY),m=Math.max(v.srcY,v.midY,v.tgtY),d-=P,f+=P,p-=P,m+=P,Bl(s,d,p,f,m),L==="haystack"){var B=v.haystackPts;if(B&&B.length===2){if(d=B[0].x,p=B[0].y,f=B[1].x,m=B[1].y,d>f){var O=d;d=f,f=O}if(p>m){var $=p;p=m,m=$}Bl(s,d-P,p-P,f+P,m+P)}}else if(L==="bezier"||L==="unbundled-bezier"||$d(L,"segments")||$d(L,"taxi")){var G;switch(L){case"bezier":case"unbundled-bezier":G=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":G=v.linePts;break}if(G!=null)for(var F=0;Ff){var Y=d;d=f,f=Y}if(p>m){var ae=p;p=m,m=ae}d-=P,f+=P,p-=P,m+=P,Bl(s,d,p,f,m)}if(n&&r.includeEdges&&h&&(m3(s,t,"mid-source"),m3(s,t,"mid-target"),m3(s,t,"source"),m3(s,t,"target")),n){var J=t.pstyle("ghost").value==="yes";if(J){var te=t.pstyle("ghost-offset-x").pfValue,re=t.pstyle("ghost-offset-y").pfValue;Bl(s,s.x1+te,s.y1+re,s.x2+te,s.y2+re)}}var ee=l.bodyBounds=l.bodyBounds||{};Ffe(ee,s),w3(ee,x),k3(ee,1),n&&(d=s.x1,f=s.x2,p=s.y1,m=s.y2,Bl(s,d-A,p-A,f+A,m+A));var Te=l.overlayBounds=l.overlayBounds||{};Ffe(Te,s),w3(Te,x),k3(Te,1);var ue=l.labelBounds=l.labelBounds||{};ue.all!=null?Brt(ue.all):ue.all=is(),n&&r.includeLabels&&(r.includeMainLabels&&NO(s,t,null),h&&(r.includeSourceLabels&&NO(s,t,"source"),r.includeTargetLabels&&NO(s,t,"target")))}return s.x1=jo(s.x1),s.y1=jo(s.y1),s.x2=jo(s.x2),s.y2=jo(s.y2),s.w=jo(s.x2-s.x1),s.h=jo(s.y2-s.y1),s.w>0&&s.h>0&&T&&(w3(s,x),k3(s,1)),s},"boundingBoxImpl"),Bme=o(function(t){var r=0,i=o(function(s){return(s?1:0)<=0;l--)s(l);return this};Xd.removeAllListeners=function(){return this.removeListener("*")};Xd.emit=Xd.trigger=function(e,t,r){var i=this.listeners,n=i.length;return this.emitting++,Si(t)||(t=[t]),vat(this,function(a,s){r!=null&&(i=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],n=i.length);for(var l=o(function(){var d=i[u];if(d.type===s.type&&(!d.namespace||d.namespace===s.namespace||d.namespace===gat)&&a.eventMatches(a.context,d,s)){var f=[s];t!=null&&lrt(f,t),a.beforeEmit(a.context,d,s),d.conf&&d.conf.one&&(a.listeners=a.listeners.filter(function(g){return g!==d}));var p=a.callbackContext(a.context,d,s),m=d.callback.apply(p,f);a.afterEmit(a.context,d,s),m===!1&&(s.stopPropagation(),s.preventDefault())}},"_loop2"),u=0;u1&&!s){var l=this.length-1,u=this[l],h=u._private.data.id;this[l]=void 0,this[t]=u,a.set(h,{ele:u,index:t})}return this.length--,this},"unmergeAt"),unmergeOne:o(function(t){t=t[0];var r=this._private,i=t._private.data.id,n=r.map,a=n.get(i);if(!a)return this;var s=a.index;return this.unmergeAt(s),this},"unmergeOne"),unmerge:o(function(t){var r=this._private.cy;if(!t)return this;if(t&&sr(t)){var i=t;t=r.mutableElements().filter(i)}for(var n=0;n=0;r--){var i=this[r];t(i)&&this.unmergeAt(r)}return this},"unmergeBy"),map:o(function(t,r){for(var i=[],n=this,a=0;ai&&(i=u,n=l)}return{value:i,ele:n}},"max"),min:o(function(t,r){for(var i=1/0,n,a=this,s=0;s=0&&a"u"?"undefined":Wn(Symbol))!=t&&Wn(Symbol.iterator)!=t;r&&(z3[Symbol.iterator]=function(){var i=this,n={value:void 0,done:!1},a=0,s=this.length;return q0e({next:o(function(){return a1&&arguments[1]!==void 0?arguments[1]:!0,i=this[0],n=i.cy();if(n.styleEnabled()&&i){i._private.styleDirty&&(i._private.styleDirty=!1,n.style().apply(i));var a=i._private.style[t];return a??(r?n.style().getDefaultProperty(t):null)}},"parsedStyle"),numericStyle:o(function(t){var r=this[0];if(r.cy().styleEnabled()&&r){var i=r.pstyle(t);return i.pfValue!==void 0?i.pfValue:i.value}},"numericStyle"),numericStyleUnits:o(function(t){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(t).units},"numericStyleUnits"),renderedStyle:o(function(t){var r=this.cy();if(!r.styleEnabled())return this;var i=this[0];if(i)return r.style().getRenderedStyle(i,t)},"renderedStyle"),style:o(function(t,r){var i=this.cy();if(!i.styleEnabled())return this;var n=!1,a=i.style();if(Xr(t)){var s=t;a.applyBypass(this,s,n),this.emitAndNotify("style")}else if(sr(t))if(r===void 0){var l=this[0];return l?a.getStylePropertyValue(l,t):void 0}else a.applyBypass(this,t,r,n),this.emitAndNotify("style");else if(t===void 0){var u=this[0];return u?a.getRawStyle(u):void 0}return this},"style"),removeStyle:o(function(t){var r=this.cy();if(!r.styleEnabled())return this;var i=!1,n=r.style(),a=this;if(t===void 0)for(var s=0;s0&&t.push(d[0]),t.push(l[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:o(function(t){return this.neighborhood().add(this).filter(t)},"closedNeighborhood"),openNeighborhood:o(function(t){return this.neighborhood(t)},"openNeighborhood")});Oa.neighbourhood=Oa.neighborhood;Oa.closedNeighbourhood=Oa.closedNeighborhood;Oa.openNeighbourhood=Oa.openNeighborhood;hr(Oa,{source:Xo(o(function(t){var r=this[0],i;return r&&(i=r._private.source||r.cy().collection()),i&&t?i.filter(t):i},"sourceImpl"),"source"),target:Xo(o(function(t){var r=this[0],i;return r&&(i=r._private.target||r.cy().collection()),i&&t?i.filter(t):i},"targetImpl"),"target"),sources:u0e({attr:"source"}),targets:u0e({attr:"target"})});o(u0e,"defineSourceFunction");hr(Oa,{edgesWith:Xo(h0e(),"edgesWith"),edgesTo:Xo(h0e({thisIsSrc:!0}),"edgesTo")});o(h0e,"defineEdgesWithFunction");hr(Oa,{connectedEdges:Xo(function(e){for(var t=[],r=this,i=0;i0);return s},"components"),component:o(function(){var t=this[0];return t.cy().mutableElements().components(t)[0]},"component")});Oa.componentsOf=Oa.components;ya=o(function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t===void 0){Yi("A collection must have a reference to the core");return}var a=new Ku,s=!1;if(!r)r=[];else if(r.length>0&&Xr(r[0])&&!i2(r[0])){s=!0;for(var l=[],u=new y1,h=0,d=r.length;h0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,i=r.cy(),n=i._private,a=[],s=[],l,u=0,h=r.length;u0){for(var $=l.length===r.length?r:new ya(i,l),G=0;G<$.length;G++){var F=$[G];F.isNode()||(F.parallelEdges().clearTraversalCache(),F.source().clearTraversalCache(),F.target().clearTraversalCache())}var V;n.hasCompoundNodes?V=i.collection().merge($).merge($.connectedNodes()).merge($.parent()):V=$,V.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?$.emitAndNotify("add"):t&&$.emit("add")}return r};Mi.removed=function(){var e=this[0];return e&&e._private.removed};Mi.inside=function(){var e=this[0];return e&&!e._private.removed};Mi.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,i=[],n={},a=r._private.cy;function s(R){for(var M=R._private.edges,L=0;L0&&(e?I.emitAndNotify("remove"):t&&I.emit("remove"));for(var D=0;Dd&&Math.abs(g.v)>d;);return p?function(y){return u[y*(u.length-1)|0]}:h},"springRK4Factory")})(),Li=o(function(t,r,i,n){var a=_at(t,r,i,n);return function(s,l,u){return s+(l-s)*a(u)}},"cubicBezier"),A3={linear:o(function(t,r,i){return t+(r-t)*i},"linear"),ease:Li(.25,.1,.25,1),"ease-in":Li(.42,0,1,1),"ease-out":Li(0,0,.58,1),"ease-in-out":Li(.42,0,.58,1),"ease-in-sine":Li(.47,0,.745,.715),"ease-out-sine":Li(.39,.575,.565,1),"ease-in-out-sine":Li(.445,.05,.55,.95),"ease-in-quad":Li(.55,.085,.68,.53),"ease-out-quad":Li(.25,.46,.45,.94),"ease-in-out-quad":Li(.455,.03,.515,.955),"ease-in-cubic":Li(.55,.055,.675,.19),"ease-out-cubic":Li(.215,.61,.355,1),"ease-in-out-cubic":Li(.645,.045,.355,1),"ease-in-quart":Li(.895,.03,.685,.22),"ease-out-quart":Li(.165,.84,.44,1),"ease-in-out-quart":Li(.77,0,.175,1),"ease-in-quint":Li(.755,.05,.855,.06),"ease-out-quint":Li(.23,1,.32,1),"ease-in-out-quint":Li(.86,0,.07,1),"ease-in-expo":Li(.95,.05,.795,.035),"ease-out-expo":Li(.19,1,.22,1),"ease-in-out-expo":Li(1,0,0,1),"ease-in-circ":Li(.6,.04,.98,.335),"ease-out-circ":Li(.075,.82,.165,1),"ease-in-out-circ":Li(.785,.135,.15,.86),spring:o(function(t,r,i){if(i===0)return A3.linear;var n=Dat(t,r,i);return function(a,s,l){return a+(s-a)*n(l)}},"spring"),"cubic-bezier":Li};o(f0e,"getEasedValue");o(p0e,"getValue");o(t1,"ease");o(Rat,"step$1");o(Pb,"valid");o(Lat,"startAnimation");o(m0e,"stepAll");Mat={animate:hi.animate(),animation:hi.animation(),animated:hi.animated(),clearQueue:hi.clearQueue(),delay:hi.delay(),delayAnimation:hi.delayAnimation(),stop:hi.stop(),addToAnimationPool:o(function(t){var r=this;r.styleEnabled()&&r._private.aniEles.merge(t)},"addToAnimationPool"),stopAnimationLoop:o(function(){this._private.animationsRunning=!1},"stopAnimationLoop"),startAnimationLoop:o(function(){var t=this;if(t._private.animationsRunning=!0,!t.styleEnabled())return;function r(){t._private.animationsRunning&&O3(o(function(a){m0e(a,t),r()},"animationStep"))}o(r,"headlessStep");var i=t.renderer();i&&i.beforeRender?i.beforeRender(o(function(a,s){m0e(s,t)},"rendererAnimationStep"),i.beforeRenderPriorities.animations):r()},"startAnimationLoop")},Nat={qualifierCompare:o(function(t,r){return t==null||r==null?t==null&&r==null:t.sameText(r)},"qualifierCompare"),eventMatches:o(function(t,r,i){var n=r.qualifier;return n!=null?t!==i.target&&i2(i.target)&&n.matches(i.target):!0},"eventMatches"),addEventFields:o(function(t,r){r.cy=t,r.target=t},"addEventFields"),callbackContext:o(function(t,r,i){return r.qualifier!=null?i.target:t},"callbackContext")},v3=o(function(t){return sr(t)?new Yd(t):t},"argSelector"),jme={createEmitter:o(function(){var t=this._private;return t.emitter||(t.emitter=new iE(Nat,this)),this},"createEmitter"),emitter:o(function(){return this._private.emitter},"emitter"),on:o(function(t,r,i){return this.emitter().on(t,v3(r),i),this},"on"),removeListener:o(function(t,r,i){return this.emitter().removeListener(t,v3(r),i),this},"removeListener"),removeAllListeners:o(function(){return this.emitter().removeAllListeners(),this},"removeAllListeners"),one:o(function(t,r,i){return this.emitter().one(t,v3(r),i),this},"one"),once:o(function(t,r,i){return this.emitter().one(t,v3(r),i),this},"once"),emit:o(function(t,r){return this.emitter().emit(t,r),this},"emit"),emitAndNotify:o(function(t,r){return this.emit(t),this.notify(t,r),this},"emitAndNotify")};hi.eventAliasesOn(jme);JO={png:o(function(t){var r=this._private.renderer;return t=t||{},r.png(t)},"png"),jpg:o(function(t){var r=this._private.renderer;return t=t||{},t.bg=t.bg||"#fff",r.jpg(t)},"jpg")};JO.jpeg=JO.jpg;_3={layout:o(function(t){var r=this;if(t==null){Yi("Layout options must be specified to make a layout");return}if(t.name==null){Yi("A `name` must be specified to make a layout");return}var i=t.name,n=r.extension("layout",i);if(n==null){Yi("No such layout `"+i+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;sr(t.eles)?a=r.$(t.eles):a=t.eles!=null?t.eles:r.$();var s=new n(hr({},t,{cy:r,eles:a}));return s},"layout")};_3.createLayout=_3.makeLayout=_3.layout;Iat={notify:o(function(t,r){var i=this._private;if(this.batching()){i.batchNotifications=i.batchNotifications||{};var n=i.batchNotifications[t]=i.batchNotifications[t]||this.collection();r!=null&&n.merge(r);return}if(i.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.notify(t,r)}},"notify"),notifications:o(function(t){var r=this._private;return t===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!t,this)},"notifications"),noNotifications:o(function(t){this.notifications(!1),t(),this.notifications(!0)},"noNotifications"),batching:o(function(){return this._private.batchCount>0},"batching"),startBatch:o(function(){var t=this._private;return t.batchCount==null&&(t.batchCount=0),t.batchCount===0&&(t.batchStyleEles=this.collection(),t.batchNotifications={}),t.batchCount++,this},"startBatch"),endBatch:o(function(){var t=this._private;if(t.batchCount===0)return this;if(t.batchCount--,t.batchCount===0){t.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(t.batchNotifications).forEach(function(i){var n=t.batchNotifications[i];n.empty()?r.notify(i):r.notify(i,n)})}return this},"endBatch"),batch:o(function(t){return this.startBatch(),t(),this.endBatch(),this},"batch"),batchData:o(function(t){var r=this;return this.batch(function(){for(var i=Object.keys(t),n=0;n0;)r.removeChild(r.childNodes[0]);t._private.renderer=null,t.mutableElements().forEach(function(i){var n=i._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},"destroyRenderer"),onRender:o(function(t){return this.on("render",t)},"onRender"),offRender:o(function(t){return this.off("render",t)},"offRender")};eP.invalidateDimensions=eP.resize;D3={collection:o(function(t,r){return sr(t)?this.$(t):uo(t)?t.collection():Si(t)?(r||(r={}),new ya(this,t,r.unique,r.removed)):new ya(this)},"collection"),nodes:o(function(t){var r=this.$(function(i){return i.isNode()});return t?r.filter(t):r},"nodes"),edges:o(function(t){var r=this.$(function(i){return i.isEdge()});return t?r.filter(t):r},"edges"),$:o(function(t){var r=this._private.elements;return t?r.filter(t):r.spawnSelf()},"$"),mutableElements:o(function(){return this._private.elements},"mutableElements")};D3.elements=D3.filter=D3.$;sa={},Wb="t",Pat="f";sa.apply=function(e){for(var t=this,r=t._private,i=r.cy,n=i.collection(),a=0;a0;if(p||f&&m){var g=void 0;p&&m||p?g=h.properties:m&&(g=h.mappedProperties);for(var y=0;y1&&(w=1),l.color){var k=i.valueMin[0],E=i.valueMax[0],A=i.valueMin[1],N=i.valueMax[1],P=i.valueMin[2],I=i.valueMax[2],D=i.valueMin[3]==null?1:i.valueMin[3],_=i.valueMax[3]==null?1:i.valueMax[3],R=[Math.round(k+(E-k)*w),Math.round(A+(N-A)*w),Math.round(P+(I-P)*w),Math.round(D+(_-D)*w)];a={bypass:i.bypass,name:i.name,value:R,strValue:"rgb("+R[0]+", "+R[1]+", "+R[2]+")"}}else if(l.number){var M=i.valueMin+(i.valueMax-i.valueMin)*w;a=this.parse(i.name,M,i.bypass,p)}else return!1;if(!a)return y(),!1;a.mapping=i,i=a;break}case s.data:{for(var L=i.field.split("."),B=f.data,O=0;O0&&a>0){for(var l={},u=!1,h=0;h0?e.delayAnimation(s).play().promise().then(T):T()}).then(function(){return e.animation({style:l,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,n),e.emitAndNotify("style"),i.transitioning=!1})}else i.transitioning&&(this.removeBypasses(e,n),e.emitAndNotify("style"),i.transitioning=!1)};sa.checkTrigger=function(e,t,r,i,n,a){var s=this.properties[t],l=n(s);e.removed()||l!=null&&l(r,i,e)&&a(s)};sa.checkZOrderTrigger=function(e,t,r,i){var n=this;this.checkTrigger(e,t,r,i,function(a){return a.triggersZOrder},function(){n._private.cy.notify("zorder",e)})};sa.checkBoundsTrigger=function(e,t,r,i){this.checkTrigger(e,t,r,i,function(n){return n.triggersBounds},function(n){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})};sa.checkConnectedEdgesBoundsTrigger=function(e,t,r,i){this.checkTrigger(e,t,r,i,function(n){return n.triggersBoundsOfConnectedEdges},function(n){e.connectedEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};sa.checkParallelEdgesBoundsTrigger=function(e,t,r,i){this.checkTrigger(e,t,r,i,function(n){return n.triggersBoundsOfParallelEdges},function(n){e.parallelEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})};sa.checkTriggers=function(e,t,r,i){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,r,i),this.checkBoundsTrigger(e,t,r,i),this.checkConnectedEdgesBoundsTrigger(e,t,r,i),this.checkParallelEdgesBoundsTrigger(e,t,r,i)};u2={};u2.applyBypass=function(e,t,r,i){var n=this,a=[],s=!0;if(t==="*"||t==="**"){if(r!==void 0)for(var l=0;ln.length?i=i.substr(n.length):i=""}o(l,"removeSelAndBlockFromRemaining");function u(){a.length>s.length?a=a.substr(s.length):a=""}for(o(u,"removePropAndValFromRem");;){var h=i.match(/^\s*$/);if(h)break;var d=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){di("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}n=d[0];var f=d[1];if(f!=="core"){var p=new Yd(f);if(p.invalid){di("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),l();continue}}var m=d[2],g=!1;a=m;for(var y=[];;){var v=a.match(/^\s*$/);if(v)break;var x=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!x){di("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+m),g=!0;break}s=x[0];var b=x[1],T=x[2],w=t.properties[b];if(!w){di("Skipping property: Invalid property name in: "+s),u();continue}var C=r.parse(b,T);if(!C){di("Skipping property: Invalid property definition in: "+s),u();continue}y.push({name:b,val:T}),u()}if(g){l();break}r.selector(f);for(var k=0;k=7&&t[0]==="d"&&(d=new RegExp(l.data.regex).exec(t))){if(r)return!1;var p=l.data;return{name:e,value:d,strValue:""+t,mapped:p,field:d[1],bypass:r}}else if(t.length>=10&&t[0]==="m"&&(f=new RegExp(l.mapData.regex).exec(t))){if(r||h.multiple)return!1;var m=l.mapData;if(!(h.color||h.number))return!1;var g=this.parse(e,f[4]);if(!g||g.mapped)return!1;var y=this.parse(e,f[5]);if(!y||y.mapped)return!1;if(g.pfValue===y.pfValue||g.strValue===y.strValue)return di("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+g.strValue+"`"),this.parse(e,g.strValue);if(h.color){var v=g.value,x=y.value,b=v[0]===x[0]&&v[1]===x[1]&&v[2]===x[2]&&(v[3]===x[3]||(v[3]==null||v[3]===1)&&(x[3]==null||x[3]===1));if(b)return!1}return{name:e,value:f,strValue:""+t,mapped:m,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:g.value,valueMax:y.value,bypass:r}}}if(h.multiple&&i!=="multiple"){var T;if(u?T=t.split(/\s+/):Si(t)?T=t:T=[t],h.evenMultiple&&T.length%2!==0)return null;for(var w=[],C=[],k=[],E="",A=!1,N=0;N0?" ":"")+P.strValue}return h.validate&&!h.validate(w,C)?null:h.singleEnum&&A?w.length===1&&sr(w[0])?{name:e,value:w[0],strValue:w[0],bypass:r}:null:{name:e,value:w,pfValue:k,strValue:E,bypass:r,units:C}}var I=o(function(){for(var J=0;Jh.max||h.strictMax&&t===h.max))return null;var L={name:e,value:t,strValue:""+t+(D||""),units:D,bypass:r};return h.unitless||D!=="px"&&D!=="em"?L.pfValue=t:L.pfValue=D==="px"||!D?t:this.getEmSizeInPixels()*t,(D==="ms"||D==="s")&&(L.pfValue=D==="ms"?t:1e3*t),(D==="deg"||D==="rad")&&(L.pfValue=D==="rad"?t:Nrt(t)),D==="%"&&(L.pfValue=t/100),L}else if(h.propList){var B=[],O=""+t;if(O!=="none"){for(var $=O.split(/\s*,\s*|\s+/),G=0;G<$.length;G++){var F=$[G].trim();n.properties[F]?B.push(F):di("`"+F+"` is not a valid property name")}if(B.length===0)return null}return{name:e,value:B,strValue:B.length===0?"none":B.join(" "),bypass:r}}else if(h.color){var V=Z0e(t);return V?{name:e,value:V,pfValue:V,strValue:"rgb("+V[0]+","+V[1]+","+V[2]+")",bypass:r}:null}else if(h.regex||h.regexes){if(h.enums){var H=I();if(H)return H}for(var j=h.regexes?h.regexes:[h.regex],U=0;U0&&l>0&&!isNaN(i.w)&&!isNaN(i.h)&&i.w>0&&i.h>0){u=Math.min((s-2*r)/i.w,(l-2*r)/i.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u=i.minZoom&&(i.maxZoom=r),this},"zoomRange"),minZoom:o(function(t){return t===void 0?this._private.minZoom:this.zoomRange({min:t})},"minZoom"),maxZoom:o(function(t){return t===void 0?this._private.maxZoom:this.zoomRange({max:t})},"maxZoom"),getZoomedViewport:o(function(t){var r=this._private,i=r.pan,n=r.zoom,a,s,l=!1;if(r.zoomingEnabled||(l=!0),Ot(t)?s=t:Xr(t)&&(s=t.level,t.position!=null?a=K3(t.position,n,i):t.renderedPosition!=null&&(a=t.renderedPosition),a!=null&&!r.panningEnabled&&(l=!0)),s=s>r.maxZoom?r.maxZoom:s,s=sr.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=u,a.push("zoom"))}if(n&&(!s||!t.cancelOnFailedZoom)&&r.panningEnabled){var h=t.pan;Ot(h.x)&&(r.pan.x=h.x,l=!1),Ot(h.y)&&(r.pan.y=h.y,l=!1),l||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},"viewport"),center:o(function(t){var r=this.getCenterPan(t);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},"center"),getCenterPan:o(function(t,r){if(this._private.panningEnabled){if(sr(t)){var i=t;t=this.mutableElements().filter(i)}else uo(t)||(t=this.mutableElements());if(t.length!==0){var n=t.boundingBox(),a=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var l={x:(a-r*(n.x1+n.x2))/2,y:(s-r*(n.y1+n.y2))/2};return l}}},"getCenterPan"),reset:o(function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},"reset"),invalidateSize:o(function(){this._private.sizeCache=null},"invalidateSize"),size:o(function(){var t=this._private,r=t.container,i=this;return t.sizeCache=t.sizeCache||(r?(function(){var n=i.window().getComputedStyle(r),a=o(function(l){return parseFloat(n.getPropertyValue(l))},"val");return{width:r.clientWidth-a("padding-left")-a("padding-right"),height:r.clientHeight-a("padding-top")-a("padding-bottom")}})():{width:1,height:1})},"size"),width:o(function(){return this.size().width},"width"),height:o(function(){return this.size().height},"height"),extent:o(function(){var t=this._private.pan,r=this._private.zoom,i=this.renderedExtent(),n={x1:(i.x1-t.x)/r,x2:(i.x2-t.x)/r,y1:(i.y1-t.y)/r,y2:(i.y2-t.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},"extent"),renderedExtent:o(function(){var t=this.width(),r=this.height();return{x1:0,y1:0,x2:t,y2:r,w:t,h:r}},"renderedExtent"),multiClickDebounceTime:o(function(t){if(t)this._private.multiClickDebounceTime=t;else return this._private.multiClickDebounceTime;return this},"multiClickDebounceTime")};r0.centre=r0.center;r0.autolockNodes=r0.autolock;r0.autoungrabifyNodes=r0.autoungrabify;Jb={data:hi.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:hi.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:hi.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:hi.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Jb.attr=Jb.data;Jb.removeAttr=Jb.removeData;e2=o(function(t){var r=this;t=hr({},t);var i=t.container;i&&!I3(i)&&I3(i[0])&&(i=i[0]);var n=i?i._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var a=n.readies=n.readies||[];i&&(i._cyreg=n),n.cy=r;var s=Gn!==void 0&&i!==void 0&&!t.headless,l=t;l.layout=hr({name:s?"grid":"null"},l.layout),l.renderer=hr({name:s?"canvas":"null"},l.renderer);var u=o(function(g,y,v){return y!==void 0?y:v!==void 0?v:g},"defVal"),h=this._private={container:i,ready:!1,options:l,elements:new ya(this),listeners:[],aniEles:new ya(this),data:l.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,l.zoomingEnabled),userZoomingEnabled:u(!0,l.userZoomingEnabled),panningEnabled:u(!0,l.panningEnabled),userPanningEnabled:u(!0,l.userPanningEnabled),boxSelectionEnabled:u(!0,l.boxSelectionEnabled),autolock:u(!1,l.autolock,l.autolockNodes),autoungrabify:u(!1,l.autoungrabify,l.autoungrabifyNodes),autounselectify:u(!1,l.autounselectify),styleEnabled:l.styleEnabled===void 0?s:l.styleEnabled,zoom:Ot(l.zoom)?l.zoom:1,pan:{x:Xr(l.pan)&&Ot(l.pan.x)?l.pan.x:0,y:Xr(l.pan)&&Ot(l.pan.y)?l.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,l.multiClickDebounceTime)};this.createEmitter(),this.selectionType(l.selectionType),this.zoomRange({min:l.minZoom,max:l.maxZoom});var d=o(function(g,y){var v=g.some(Att);if(v)return v1.all(g).then(y);y(g)},"loadExtData");h.styleEnabled&&r.setStyle([]);var f=hr({},l,l.renderer);r.initRenderer(f);var p=o(function(g,y,v){r.notifications(!1);var x=r.mutableElements();x.length>0&&x.remove(),g!=null&&(Xr(g)||Si(g))&&r.add(g),r.one("layoutready",function(T){r.notifications(!0),r.emit(T),r.one("load",y),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",v),r.emit("done")});var b=hr({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()},"setElesAndLayout");d([l.style,l.elements],function(m){var g=m[0],y=m[1];h.styleEnabled&&r.style().append(g),p(y,function(){r.startAnimationLoop(),h.ready=!0,Ji(l.ready)&&r.on("ready",l.ready);for(var v=0;v0,l=!!e.boundingBox,u=is(l?e.boundingBox:structuredClone(t.extent())),h;if(uo(e.roots))h=e.roots;else if(Si(e.roots)){for(var d=[],f=0;f0;){var R=_(),M=N(R,I);if(M)R.outgoers().filter(function(Me){return Me.isNode()&&r.has(Me)}).forEach(D);else if(M===null){di("Detected double maximal shift for node `"+R.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var L=0;if(e.avoidOverlap)for(var B=0;B0&&x[0].length<=3?Fe/2:0),at=2*Math.PI/x[rt].length*ke;return rt===0&&x[0].length===1&&(He=1),{x:ee.x+He*Math.cos(at),y:ee.y+He*Math.sin(at)}}else{var qe=x[rt].length,Ue=Math.max(qe===1?0:l?(u.w-e.padding*2-Te.w)/((e.grid?De:qe)-1):(u.w-e.padding*2-Te.w)/((e.grid?De:qe)+1),L),ye={x:ee.x+(ke+1-(qe+1)/2)*Ue,y:ee.y+(rt+1-(U+1)/2)*ue};return ye}},"getPositionTopBottom"),Ee={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(Ee).indexOf(e.direction)===-1&&Yi("Invalid direction '".concat(e.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Ee).join(", ")));var we=o(function($e){return rrt(Ie($e),u,Ee[e.direction])},"getPosition");return r.nodes().layoutPositions(this,e,we),this};Gat={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:o(function(t,r){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:o(function(t,r){return r},"transform")};o(Kme,"CircleLayout");Kme.prototype.run=function(){var e=this.options,t=e,r=e.cy,i=t.eles,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,a=i.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var s=is(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep,h=u/Math.max(1,a.length-1),d,f=0,p=0;p1&&t.avoidOverlap){f*=1.75;var x=Math.cos(h)-Math.cos(0),b=Math.sin(h)-Math.sin(0),T=Math.sqrt(f*f/(x*x+b*b));d=Math.max(T,d)}var w=o(function(k,E){var A=t.startAngle+E*h*(n?1:-1),N=d*Math.cos(A),P=d*Math.sin(A),I={x:l.x+N,y:l.y+P};return I},"getPos");return i.nodes().layoutPositions(this,t,w),this};Vat={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:o(function(t){return t.degree()},"concentric"),levelWidth:o(function(t){return t.maxDegree()/4},"levelWidth"),animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:o(function(t,r){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:o(function(t,r){return r},"transform")};o(Zme,"ConcentricLayout");Zme.prototype.run=function(){for(var e=this.options,t=e,r=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,i=e.cy,n=t.eles,a=n.nodes().not(":parent"),s=is(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:i.width(),h:i.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],h=0,d=0;d0){var C=Math.abs(b[0].value-w.value);C>=v&&(b=[],x.push(b))}b.push(w)}var k=h+t.minNodeSpacing;if(!t.avoidOverlap){var E=x.length>0&&x[0].length>1,A=Math.min(s.w,s.h)/2-k,N=A/(x.length+E?1:0);k=Math.min(k,N)}for(var P=0,I=0;I1&&t.avoidOverlap){var M=Math.cos(R)-Math.cos(0),L=Math.sin(R)-Math.sin(0),B=Math.sqrt(k*k/(M*M+L*L));P=Math.max(B,P)}D.r=P,P+=k}if(t.equidistant){for(var O=0,$=0,G=0;G=e.numIter||(Xat(i,e),i.temperature=i.temperature*e.coolingFactor,i.temperature=e.animationThreshold&&a(),O3(d)}},"frame");d()}else{for(;h;)h=s(u),u++;v0e(i,e),l()}return this};lE.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};lE.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};qat=o(function(t,r,i){for(var n=i.eles.edges(),a=i.eles.nodes(),s=is(i.boundingBox?i.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),l={isCompound:t.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:i.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},u=i.eles.components(),h={},d=0;d0){l.graphSet.push(A);for(var d=0;dn.count?0:n.graph},"findLCA"),Qme=o(function(t,r,i,n){var a=n.graphSet[i];if(-10)var f=n.nodeOverlap*d,p=Math.sqrt(l*l+u*u),m=f*l/p,g=f*u/p;else var y=V3(t,l,u),v=V3(r,-1*l,-1*u),x=v.x-y.x,b=v.y-y.y,T=x*x+b*b,p=Math.sqrt(T),f=(t.nodeRepulsion+r.nodeRepulsion)/T,m=f*x/p,g=f*b/p;t.isLocked||(t.offsetX-=m,t.offsetY-=g),r.isLocked||(r.offsetX+=m,r.offsetY+=g)}},"nodeRepulsion"),Qat=o(function(t,r,i,n){if(i>0)var a=t.maxX-r.minX;else var a=r.maxX-t.minX;if(n>0)var s=t.maxY-r.minY;else var s=r.maxY-t.minY;return a>=0&&s>=0?Math.sqrt(a*a+s*s):0},"nodesOverlap"),V3=o(function(t,r,i){var n=t.positionX,a=t.positionY,s=t.height||1,l=t.width||1,u=i/r,h=s/l,d={};return r===0&&0i?(d.x=n,d.y=a+s/2,d):0r&&-1*h<=u&&u<=h?(d.x=n-l/2,d.y=a-l*i/2/r,d):0=h)?(d.x=n+s*r/2/i,d.y=a+s/2,d):(0>i&&(u<=-1*h||u>=h)&&(d.x=n-s*r/2/i,d.y=a-s/2),d)},"findClippingPoint"),Jat=o(function(t,r){for(var i=0;ii){var v=r.gravity*m/y,x=r.gravity*g/y;p.offsetX+=v,p.offsetY+=x}}}}},"calculateGravityForces"),tst=o(function(t,r){var i=[],n=0,a=-1;for(i.push.apply(i,t.graphSet[0]),a+=t.graphSet[0].length;n<=a;){var s=i[n++],l=t.idToIndex[s],u=t.layoutNodes[l],h=u.children;if(0i)var a={x:i*t/n,y:i*r/n};else var a={x:t,y:r};return a},"limitForce"),ege=o(function(t,r){var i=t.parentId;if(i!=null){var n=r.layoutNodes[r.idToIndex[i]],a=!1;if((n.maxX==null||t.maxX+n.padRight>n.maxX)&&(n.maxX=t.maxX+n.padRight,a=!0),(n.minX==null||t.minX-n.padLeftn.maxY)&&(n.maxY=t.maxY+n.padBottom,a=!0),(n.minY==null||t.minY-n.padTopx&&(g+=v+r.componentSpacing,m=0,y=0,v=0)}}},"separateComponents"),nst={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:o(function(t){},"position"),sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:o(function(t,r){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:o(function(t,r){return r},"transform")};o(tge,"GridLayout");tge.prototype.run=function(){var e=this.options,t=e,r=e.cy,i=t.eles,n=i.nodes().not(":parent");t.sort&&(n=n.sort(t.sort));var a=is(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(a.h===0||a.w===0)i.nodes().layoutPositions(this,t,function(H){return{x:a.x1,y:a.y1}});else{var s=n.size(),l=Math.sqrt(s*a.h/a.w),u=Math.round(l),h=Math.round(a.w/a.h*l),d=o(function(j){if(j==null)return Math.min(u,h);var U=Math.min(u,h);U==u?u=j:h=j},"small"),f=o(function(j){if(j==null)return Math.max(u,h);var U=Math.max(u,h);U==u?u=j:h=j},"large"),p=t.rows,m=t.cols!=null?t.cols:t.columns;if(p!=null&&m!=null)u=p,h=m;else if(p!=null&&m==null)u=p,h=Math.ceil(s/u);else if(p==null&&m!=null)h=m,u=Math.ceil(s/h);else if(h*u>s){var g=d(),y=f();(g-1)*y>=s?d(g-1):(y-1)*g>=s&&f(y-1)}else for(;h*u=s?f(x+1):d(v+1)}var b=a.w/h,T=a.h/u;if(t.condense&&(b=0,T=0),t.avoidOverlap)for(var w=0;w=h&&(M=0,R++)},"moveToNextCell"),B={},O=0;O(M=Yrt(e,t,L[B],L[B+1],L[B+2],L[B+3])))return v(E,M),!0}else if(N.edgeType==="bezier"||N.edgeType==="multibezier"||N.edgeType==="self"||N.edgeType==="compound"){for(var L=N.allpts,B=0;B+5(M=Hrt(e,t,L[B],L[B+1],L[B+2],L[B+3],L[B+4],L[B+5])))return v(E,M),!0}for(var O=O||A.source,$=$||A.target,G=n.getArrowWidth(P,I),F=[{name:"source",x:N.arrowStartX,y:N.arrowStartY,angle:N.srcArrowAngle},{name:"target",x:N.arrowEndX,y:N.arrowEndY,angle:N.tgtArrowAngle},{name:"mid-source",x:N.midX,y:N.midY,angle:N.midsrcArrowAngle},{name:"mid-target",x:N.midX,y:N.midY,angle:N.midtgtArrowAngle}],B=0;B0&&(x(O),x($))}o(b,"checkEdge");function T(E,A,N){return Ps(E,A,N)}o(T,"preprop");function w(E,A){var N=E._private,P=p,I;A?I=A+"-":I="",E.boundingBox();var D=N.labelBounds[A||"main"],_=E.pstyle(I+"label").value,R=E.pstyle("text-events").strValue==="yes";if(!(!R||!_)){var M=T(N.rscratch,"labelX",A),L=T(N.rscratch,"labelY",A),B=T(N.rscratch,"labelAngle",A),O=E.pstyle(I+"text-margin-x").pfValue,$=E.pstyle(I+"text-margin-y").pfValue,G=D.x1-P-O,F=D.x2+P-O,V=D.y1-P-$,H=D.y2+P-$;if(B){var j=Math.cos(B),U=Math.sin(B),Q=o(function(Te,ue){return Te=Te-M,ue=ue-L,{x:Te*j-ue*U+M,y:Te*U+ue*j+L}},"rotate"),Y=Q(G,V),ae=Q(G,H),J=Q(F,V),te=Q(F,H),re=[Y.x+O,Y.y+$,J.x+O,J.y+$,te.x+O,te.y+$,ae.x+O,ae.y+$];if(Bs(e,t,re))return v(E),!0}else if(zd(D,e,t))return v(E),!0}}o(w,"checkLabel");for(var C=s.length-1;C>=0;C--){var k=s[C];k.isNode()?x(k)||w(k):b(k)||w(k)||w(k,"source")||w(k,"target")}return l};n0.getAllInBox=function(e,t,r,i){var n=this.getCachedZSortedEles().interactive,a=this.cy.zoom(),s=2/a,l=[],u=Math.min(e,r),h=Math.max(e,r),d=Math.min(t,i),f=Math.max(t,i);e=u,r=h,t=d,i=f;var p=is({x1:e,y1:t,x2:r,y2:i}),m=[{x:p.x1,y:p.y1},{x:p.x2,y:p.y1},{x:p.x2,y:p.y2},{x:p.x1,y:p.y2}],g=[[m[0],m[1]],[m[1],m[2]],[m[2],m[3]],[m[3],m[0]]];function y(Te,ue,De){return Ps(Te,ue,De)}o(y,"preprop");function v(Te,ue){var De=Te._private,Ie=s,Ee="";Te.boundingBox();var we=De.labelBounds.main;if(!we)return null;var Me=y(De.rscratch,"labelX",ue),$e=y(De.rscratch,"labelY",ue),de=y(De.rscratch,"labelAngle",ue),rt=Te.pstyle(Ee+"text-margin-x").pfValue,ke=Te.pstyle(Ee+"text-margin-y").pfValue,Fe=we.x1-Ie-rt,He=we.x2+Ie-rt,at=we.y1-Ie-ke,qe=we.y2+Ie-ke;if(de){var Ue=Math.cos(de),ye=Math.sin(de),ve=o(function(fe,W){return fe=fe-Me,W=W-$e,{x:fe*Ue-W*ye+Me,y:fe*ye+W*Ue+$e}},"rotate");return[ve(Fe,at),ve(He,at),ve(He,qe),ve(Fe,qe)]}else return[{x:Fe,y:at},{x:He,y:at},{x:He,y:qe},{x:Fe,y:qe}]}o(v,"getRotatedLabelBox");function x(Te,ue,De,Ie){function Ee(we,Me,$e){return($e.y-we.y)*(Me.x-we.x)>(Me.y-we.y)*($e.x-we.x)}return o(Ee,"ccw"),Ee(Te,De,Ie)!==Ee(ue,De,Ie)&&Ee(Te,ue,De)!==Ee(Te,ue,Ie)}o(x,"doLinesIntersect");for(var b=0;b0?-(Math.PI-t.ang):Math.PI+t.ang},"invertVec"),ust=o(function(t,r,i,n,a){if(t!==k0e?w0e(r,t,Pc):cst(Yo,Pc),w0e(r,i,Yo),T0e=Pc.nx*Yo.ny-Pc.ny*Yo.nx,C0e=Pc.nx*Yo.nx-Pc.ny*-Yo.ny,ju=Math.asin(Math.max(-1,Math.min(1,T0e))),Math.abs(ju)<1e-6){tP=r.x,rP=r.y,Xp=i1=0;return}Zp=1,R3=!1,C0e<0?ju<0?ju=Math.PI+ju:(ju=Math.PI-ju,Zp=-1,R3=!0):ju>0&&(Zp=-1,R3=!0),r.radius!==void 0?i1=r.radius:i1=n,Up=ju/2,x3=Math.min(Pc.len/2,Yo.len/2),a?(Ic=Math.abs(Math.cos(Up)*i1/Math.sin(Up)),Ic>x3?(Ic=x3,Xp=Math.abs(Ic*Math.sin(Up)/Math.cos(Up))):Xp=i1):(Ic=Math.min(x3,i1),Xp=Math.abs(Ic*Math.sin(Up)/Math.cos(Up))),iP=r.x+Yo.nx*Ic,nP=r.y+Yo.ny*Ic,tP=iP-Yo.ny*Xp*Zp,rP=nP+Yo.nx*Xp*Zp,age=r.x+Pc.nx*Ic,sge=r.y+Pc.ny*Ic,k0e=r},"calcCornerArc");o(oge,"drawPreparedRoundCorner");o(LP,"getRoundCorner");t2=.01,hst=Math.sqrt(2*t2),Ba={};Ba.findMidptPtsEtc=function(e,t){var r=t.posPts,i=t.intersectionPts,n=t.vectorNormInverse,a,s=e.pstyle("source-endpoint"),l=e.pstyle("target-endpoint"),u=s.units!=null&&l.units!=null,h=o(function(C,k,E,A){var N=A-k,P=E-C,I=Math.sqrt(P*P+N*N);return{x:-N/I,y:P/I}},"recalcVectorNormInverse"),d=e.pstyle("edge-distances").value;switch(d){case"node-position":a=r;break;case"intersection":a=i;break;case"endpoints":{if(u){var f=this.manualEndptToPx(e.source()[0],s),p=Dn(f,2),m=p[0],g=p[1],y=this.manualEndptToPx(e.target()[0],l),v=Dn(y,2),x=v[0],b=v[1],T={x1:m,y1:g,x2:x,y2:b};n=h(m,g,x,b),a=T}else di("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),a=i;break}}return{midptPts:a,vectorNormInverse:n}};Ba.findHaystackPoints=function(e){for(var t=0;t0?Math.max(W-ce,0):Math.min(W+ce,0)},"subDWH"),_=D(P,A),R=D(I,N),M=!1;b===h?x=Math.abs(_)>Math.abs(R)?n:i:b===u||b===l?(x=i,M=!0):(b===a||b===s)&&(x=n,M=!0);var L=x===i,B=L?R:_,O=L?I:P,$=vP(O),G=!1;!(M&&(w||k))&&(b===l&&O<0||b===u&&O>0||b===a&&O>0||b===s&&O<0)&&($*=-1,B=$*Math.abs(B),G=!0);var F;if(w){var V=C<0?1+C:C;F=V*B}else{var H=C<0?B:0;F=H+C*$}var j=o(function(W){return Math.abs(W)=Math.abs(B)},"getIsTooClose"),U=j(F),Q=j(Math.abs(B)-Math.abs(F)),Y=U||Q;if(Y&&!G)if(L){var ae=Math.abs(O)<=p/2,J=Math.abs(P)<=m/2;if(ae){var te=(d.x1+d.x2)/2,re=d.y1,ee=d.y2;r.segpts=[te,re,te,ee]}else if(J){var Te=(d.y1+d.y2)/2,ue=d.x1,De=d.x2;r.segpts=[ue,Te,De,Te]}else r.segpts=[d.x1,d.y2]}else{var Ie=Math.abs(O)<=f/2,Ee=Math.abs(I)<=g/2;if(Ie){var we=(d.y1+d.y2)/2,Me=d.x1,$e=d.x2;r.segpts=[Me,we,$e,we]}else if(Ee){var de=(d.x1+d.x2)/2,rt=d.y1,ke=d.y2;r.segpts=[de,rt,de,ke]}else r.segpts=[d.x2,d.y1]}else if(L){var Fe=d.y1+F+(v?p/2*$:0),He=d.x1,at=d.x2;r.segpts=[He,Fe,at,Fe]}else{var qe=d.x1+F+(v?f/2*$:0),Ue=d.y1,ye=d.y2;r.segpts=[qe,Ue,qe,ye]}if(r.isRound){var ve=e.pstyle("taxi-radius").value,ie=e.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ve),r.isArcRadius=new Array(r.segpts.length/2).fill(ie)}};Ba.tryToCorrectInvalidPoints=function(e,t){var r=e._private.rscratch;if(r.edgeType==="bezier"){var i=t.srcPos,n=t.tgtPos,a=t.srcW,s=t.srcH,l=t.tgtW,u=t.tgtH,h=t.srcShape,d=t.tgtShape,f=t.srcCornerRadius,p=t.tgtCornerRadius,m=t.srcRs,g=t.tgtRs,y=!Ot(r.startX)||!Ot(r.startY),v=!Ot(r.arrowStartX)||!Ot(r.arrowStartY),x=!Ot(r.endX)||!Ot(r.endY),b=!Ot(r.arrowEndX)||!Ot(r.arrowEndY),T=3,w=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,C=T*w,k=e0({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),E=kO.poolIndex()){var $=B;B=O,O=$}var G=_.srcPos=B.position(),F=_.tgtPos=O.position(),V=_.srcW=B.outerWidth(),H=_.srcH=B.outerHeight(),j=_.tgtW=O.outerWidth(),U=_.tgtH=O.outerHeight(),Q=_.srcShape=r.nodeShapes[t.getNodeShape(B)],Y=_.tgtShape=r.nodeShapes[t.getNodeShape(O)],ae=_.srcCornerRadius=B.pstyle("corner-radius").value==="auto"?"auto":B.pstyle("corner-radius").pfValue,J=_.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,te=_.tgtRs=O._private.rscratch,re=_.srcRs=B._private.rscratch;_.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var ee=0;ee<_.eles.length;ee++){var Te=_.eles[ee],ue=Te[0]._private.rscratch,De=Te.pstyle("curve-style").value,Ie=De==="unbundled-bezier"||$d(De,"segments")||$d(De,"taxi"),Ee=!B.same(Te.source());if(!_.calculatedIntersection&&B!==O&&(_.hasBezier||_.hasUnbundled)){_.calculatedIntersection=!0;var we=Q.intersectLine(G.x,G.y,V,H,F.x,F.y,0,ae,re),Me=_.srcIntn=we,$e=Y.intersectLine(F.x,F.y,j,U,G.x,G.y,0,J,te),de=_.tgtIntn=$e,rt=_.intersectionPts={x1:we[0],x2:$e[0],y1:we[1],y2:$e[1]},ke=_.posPts={x1:G.x,x2:F.x,y1:G.y,y2:F.y},Fe=$e[1]-we[1],He=$e[0]-we[0],at=Math.sqrt(He*He+Fe*Fe);Ot(at)&&at>=hst||(at=Math.sqrt(Math.max(He*He,t2)+Math.max(Fe*Fe,t2)));var qe=_.vector={x:He,y:Fe},Ue=_.vectorNorm={x:qe.x/at,y:qe.y/at},ye={x:-Ue.y,y:Ue.x};_.nodesOverlap=!Ot(at)||Y.checkPoint(we[0],we[1],0,j,U,F.x,F.y,J,te)||Q.checkPoint($e[0],$e[1],0,V,H,G.x,G.y,ae,re),_.vectorNormInverse=ye,R={nodesOverlap:_.nodesOverlap,dirCounts:_.dirCounts,calculatedIntersection:!0,hasBezier:_.hasBezier,hasUnbundled:_.hasUnbundled,eles:_.eles,srcPos:F,srcRs:te,tgtPos:G,tgtRs:re,srcW:j,srcH:U,tgtW:V,tgtH:H,srcIntn:de,tgtIntn:Me,srcShape:Y,tgtShape:Q,posPts:{x1:ke.x2,y1:ke.y2,x2:ke.x1,y2:ke.y1},intersectionPts:{x1:rt.x2,y1:rt.y2,x2:rt.x1,y2:rt.y1},vector:{x:-qe.x,y:-qe.y},vectorNorm:{x:-Ue.x,y:-Ue.y},vectorNormInverse:{x:-ye.x,y:-ye.y}}}var ve=Ee?R:_;ue.nodesOverlap=ve.nodesOverlap,ue.srcIntn=ve.srcIntn,ue.tgtIntn=ve.tgtIntn,ue.isRound=De.startsWith("round"),n&&(B.isParent()||B.isChild()||O.isParent()||O.isChild())&&(B.parents().anySame(O)||O.parents().anySame(B)||B.same(O)&&B.isParent())?t.findCompoundLoopPoints(Te,ve,ee,Ie):B===O?t.findLoopPoints(Te,ve,ee,Ie):De.endsWith("segments")?t.findSegmentsPoints(Te,ve):De.endsWith("taxi")?t.findTaxiPoints(Te,ve):De==="straight"||!Ie&&_.eles.length%2===1&&ee===Math.floor(_.eles.length/2)?t.findStraightEdgePoints(Te):t.findBezierPoints(Te,ve,ee,Ie,Ee),t.findEndpoints(Te),t.tryToCorrectInvalidPoints(Te,ve),t.checkForInvalidEdgeWarning(Te),t.storeAllpts(Te),t.storeEdgeProjections(Te),t.calculateArrowAngles(Te),t.recalculateEdgeLabelProjections(Te),t.calculateLabelAngles(Te)}},"_loop"),E=0;E0){var we=h,Me=jp(we,o1(s)),$e=jp(we,o1(Ee)),de=Me;if($e2){var rt=jp(we,{x:Ee[2],y:Ee[3]});rt0){var K=d,Re=jp(K,o1(s)),xe=jp(K,o1(ce)),Oe=Re;if(xe2){var be=jp(K,{x:ce[2],y:ce[3]});be=g||E){v={cp:w,segment:k};break}}if(v)break}var A=v.cp,N=v.segment,P=(g-x)/N.length,I=N.t1-N.t0,D=m?N.t0+I*P:N.t1-I*P;D=Xb(0,D,1),t=u1(A.p0,A.p1,A.p2,D),p=fst(A.p0,A.p1,A.p2,D);break}case"straight":case"segments":case"haystack":{for(var _=0,R,M,L,B,O=i.allpts.length,$=0;$+3=g));$+=2);var G=g-M,F=G/R;F=Xb(0,F,1),t=Ort(L,B,F),p=uge(L,B);break}}s("labelX",f,t.x),s("labelY",f,t.y),s("labelAutoAngle",f,p)}},"calculateEndProjection");h("source"),h("target"),this.applyLabelDimensions(e)}};$c.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))};$c.applyPrefixedLabelDimensions=function(e,t){var r=e._private,i=this.getLabelText(e,t),n=Jp(i,e._private.labelDimsKey);if(Ps(r.rscratch,"prefixedLabelDimsKey",t)!==n){Xu(r.rscratch,"prefixedLabelDimsKey",t,n);var a=this.calculateLabelDimensions(e,i),s=e.pstyle("line-height").pfValue,l=e.pstyle("text-wrap").strValue,u=Ps(r.rscratch,"labelWrapCachedLines",t)||[],h=l!=="wrap"?1:Math.max(u.length,1),d=a.height/h,f=d*s,p=a.width,m=a.height+(h-1)*(s-1)*d;Xu(r.rstyle,"labelWidth",t,p),Xu(r.rscratch,"labelWidth",t,p),Xu(r.rstyle,"labelHeight",t,m),Xu(r.rscratch,"labelHeight",t,m),Xu(r.rscratch,"labelLineHeight",t,f)}};$c.getLabelText=function(e,t){var r=e._private,i=t?t+"-":"",n=e.pstyle(i+"label").strValue,a=e.pstyle("text-transform").value,s=o(function(H,j){return j?(Xu(r.rscratch,H,t,j),j):Ps(r.rscratch,H,t)},"rscratch");if(!n)return"";a=="none"||(a=="uppercase"?n=n.toUpperCase():a=="lowercase"&&(n=n.toLowerCase()));var l=e.pstyle("text-wrap").value;if(l==="wrap"){var u=s("labelKey");if(u!=null&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var h="\u200B",d=n.split(` +`),f=e.pstyle("text-max-width").pfValue,p=e.pstyle("text-overflow-wrap").value,m=p==="anywhere",g=[],y=/[\s\u200b]+|$/g,v=0;vf){var C=x.matchAll(y),k="",E=0,A=Fs(C),N;try{for(A.s();!(N=A.n()).done;){var P=N.value,I=P[0],D=x.substring(E,P.index);E=P.index+I.length;var _=k.length===0?D:k+D+I,R=this.calculateLabelDimensions(e,_),M=R.width;M<=f?k+=D+I:(k&&g.push(k),k=D+I)}}catch(V){A.e(V)}finally{A.f()}k.match(/^[\s\u200b]+$/)||g.push(k)}else g.push(x)}s("labelWrapCachedLines",g),n=s("labelWrapCachedText",g.join(` +`)),s("labelWrapKey",u)}else if(l==="ellipsis"){var L=e.pstyle("text-max-width").pfValue,B="",O="\u2026",$=!1;if(this.calculateLabelDimensions(e,n).widthL)break;B+=n[G],G===n.length-1&&($=!0)}return $||(B+=O),B}return n};$c.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,r=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t};$c.calculateLabelDimensions=function(e,t){var r=this,i=r.cy.window(),n=i.document,a=0,s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,h=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=n.createElement("canvas"),f=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}f.font="".concat(s," ").concat(h," ").concat(l,"px ").concat(u);for(var m=0,g=0,y=t.split(` +`),v=0;v1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(s),l)for(var u=0;u=e.desktopTapThreshold2}var oe=a(W);ot&&(e.hoverData.tapholdCancelled=!0);var ht=o(function(){var pt=e.hoverData.dragDelta=e.hoverData.dragDelta||[];pt.length===0?(pt.push(st[0]),pt.push(st[1])):(pt[0]+=st[0],pt[1]+=st[1])},"updateDragDelta");K=!0,n(Pe,["mousemove","vmousemove","tapdrag"],W,{x:be[0],y:be[1]});var gt=o(function(pt){return{originalEvent:W,type:pt,position:{x:be[0],y:be[1]}}},"makeEvent"),et=o(function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||Re.emit(gt("boxstart")),Ve[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()},"goIntoBoxMode");if(e.hoverData.which===3){if(ot){var pe=gt("cxtdrag");le?le.emit(pe):Re.emit(pe),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||Pe!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(gt("cxtdragout")),e.hoverData.cxtOver=Pe,Pe&&Pe.emit(gt("cxtdragover")))}}else if(e.hoverData.dragging){if(K=!0,Re.panningEnabled()&&Re.userPanningEnabled()){var Qe;if(e.hoverData.justStartedPan){var nt=e.hoverData.mdownPos;Qe={x:(be[0]-nt[0])*xe,y:(be[1]-nt[1])*xe},e.hoverData.justStartedPan=!1}else Qe={x:st[0]*xe,y:st[1]*xe};Re.panBy(Qe),Re.emit(gt("dragpan")),e.hoverData.dragged=!0}be=e.projectIntoViewport(W.clientX,W.clientY)}else if(Ve[4]==1&&(le==null||le.pannable())){if(ot){if(!e.hoverData.dragging&&Re.boxSelectionEnabled()&&(oe||!Re.panningEnabled()||!Re.userPanningEnabled()))et();else if(!e.hoverData.selecting&&Re.panningEnabled()&&Re.userPanningEnabled()){var dt=s(le,e.hoverData.downs);dt&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Ve[4]=0,e.data.bgActivePosistion=o1(Be),e.redrawHint("select",!0),e.redraw())}le&&le.pannable()&&le.active()&&le.unactivate()}}else{if(le&&le.pannable()&&le.active()&&le.unactivate(),(!le||!le.grabbed())&&Pe!=Ye&&(Ye&&n(Ye,["mouseout","tapdragout"],W,{x:be[0],y:be[1]}),Pe&&n(Pe,["mouseover","tapdragover"],W,{x:be[0],y:be[1]}),e.hoverData.last=Pe),le)if(ot){if(Re.boxSelectionEnabled()&&oe)le&&le.grabbed()&&(x(me),le.emit(gt("freeon")),me.emit(gt("free")),e.dragData.didDrag&&(le.emit(gt("dragfreeon")),me.emit(gt("dragfree")))),et();else if(le&&le.grabbed()&&e.nodeIsDraggable(le)){var Ft=!e.dragData.didDrag;Ft&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||y(me,{inDragLayer:!0});var Rt={x:0,y:0};if(Ot(st[0])&&Ot(st[1])&&(Rt.x+=st[0],Rt.y+=st[1],Ft)){var $t=e.hoverData.dragDelta;$t&&Ot($t[0])&&Ot($t[1])&&(Rt.x+=$t[0],Rt.y+=$t[1])}e.hoverData.draggingEles=!0,me.silentShift(Rt).emit(gt("position")).emit(gt("drag")),e.redrawHint("drag",!0),e.redraw()}}else ht();K=!0}if(Ve[2]=be[0],Ve[3]=be[1],K)return W.stopPropagation&&W.stopPropagation(),W.preventDefault&&W.preventDefault(),!1}},"mousemoveHandler"),!1);var D,_,R;e.registerBinding(t,"mouseup",o(function(W){if(!(e.hoverData.which===1&&W.which!==1&&e.hoverData.capture)){var ce=e.hoverData.capture;if(ce){e.hoverData.capture=!1;var K=e.cy,Re=e.projectIntoViewport(W.clientX,W.clientY),xe=e.selection,Oe=e.findNearestElement(Re[0],Re[1],!0,!1),be=e.dragData.possibleDragElements,Be=e.hoverData.down,Ae=a(W);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,Be&&Be.unactivate();var Ve=o(function(kt){return{originalEvent:W,type:kt,position:{x:Re[0],y:Re[1]}}},"makeEvent");if(e.hoverData.which===3){var Pe=Ve("cxttapend");if(Be?Be.emit(Pe):K.emit(Pe),!e.hoverData.cxtDragged){var Ye=Ve("cxttap");Be?Be.emit(Ye):K.emit(Ye)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(n(Oe,["mouseup","tapend","vmouseup"],W,{x:Re[0],y:Re[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(n(Be,["click","tap","vclick"],W,{x:Re[0],y:Re[1]}),_=!1,W.timeStamp-R<=K.multiClickDebounceTime()?(D&&clearTimeout(D),_=!0,R=null,n(Be,["dblclick","dbltap","vdblclick"],W,{x:Re[0],y:Re[1]})):(D=setTimeout(function(){_||n(Be,["oneclick","onetap","voneclick"],W,{x:Re[0],y:Re[1]})},K.multiClickDebounceTime()),R=W.timeStamp)),Be==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(W)&&(K.$(r).unselect(["tapunselect"]),be.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=be=K.collection()),Oe==Be&&!e.dragData.didDrag&&!e.hoverData.selecting&&Oe!=null&&Oe._private.selectable&&(e.hoverData.dragging||(K.selectionType()==="additive"||Ae?Oe.selected()?Oe.unselect(["tapunselect"]):Oe.select(["tapselect"]):Ae||(K.$(r).unmerge(Oe).unselect(["tapunselect"]),Oe.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var le=K.collection(e.getAllInBox(xe[0],xe[1],xe[2],xe[3]));e.redrawHint("select",!0),le.length>0&&e.redrawHint("eles",!0),K.emit(Ve("boxend"));var st=o(function(kt){return kt.selectable()&&!kt.selected()},"eleWouldBeSelected");K.selectionType()==="additive"||Ae||K.$(r).unmerge(le).unselect(),le.emit(Ve("box")).stdFilter(st).select().emit(Ve("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!xe[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var me=Be&&Be.grabbed();x(be),me&&(Be.emit(Ve("freeon")),be.emit(Ve("free")),e.dragData.didDrag&&(Be.emit(Ve("dragfreeon")),be.emit(Ve("dragfree"))))}}xe[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},"mouseupHandler"),!1);var M=[],L=4,B,O=1e5,$=o(function(W,ce){for(var K=0;K=L){var Re=M;if(B=$(Re,5),!B){var xe=Math.abs(Re[0]);B=G(Re)&&xe>5}if(B)for(var Oe=0;Oe5&&(K=vP(K)*5),Ye=K/-250,B&&(Ye/=O,Ye*=3),Ye=Ye*e.wheelSensitivity;var le=W.deltaMode===1;le&&(Ye*=33);var st=be.zoom()*Math.pow(10,Ye);W.type==="gesturechange"&&(st=e.gestureStartZoom*W.scale),be.zoom({level:st,renderedPosition:{x:Pe[0],y:Pe[1]}}),be.emit({type:W.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:W,position:{x:Ve[0],y:Ve[1]}})}}}},"wheelHandler");e.registerBinding(e.container,"wheel",F,!0),e.registerBinding(t,"scroll",o(function(W){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},"scrollHandler"),!0),e.registerBinding(e.container,"gesturestart",o(function(W){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||W.preventDefault()},"gestureStartHandler"),!0),e.registerBinding(e.container,"gesturechange",function(fe){e.hasTouchStarted||F(fe)},!0),e.registerBinding(e.container,"mouseout",o(function(W){var ce=e.projectIntoViewport(W.clientX,W.clientY);e.cy.emit({originalEvent:W,type:"mouseout",position:{x:ce[0],y:ce[1]}})},"mouseOutHandler"),!1),e.registerBinding(e.container,"mouseover",o(function(W){var ce=e.projectIntoViewport(W.clientX,W.clientY);e.cy.emit({originalEvent:W,type:"mouseover",position:{x:ce[0],y:ce[1]}})},"mouseOverHandler"),!1);var V,H,j,U,Q,Y,ae,J,te,re,ee,Te,ue,De=o(function(W,ce,K,Re){return Math.sqrt((K-W)*(K-W)+(Re-ce)*(Re-ce))},"distance"),Ie=o(function(W,ce,K,Re){return(K-W)*(K-W)+(Re-ce)*(Re-ce)},"distanceSq"),Ee;e.registerBinding(e.container,"touchstart",Ee=o(function(W){if(e.hasTouchStarted=!0,!!P(W)){T(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var ce=e.cy,K=e.touchData.now,Re=e.touchData.earlier;if(W.touches[0]){var xe=e.projectIntoViewport(W.touches[0].clientX,W.touches[0].clientY);K[0]=xe[0],K[1]=xe[1]}if(W.touches[1]){var xe=e.projectIntoViewport(W.touches[1].clientX,W.touches[1].clientY);K[2]=xe[0],K[3]=xe[1]}if(W.touches[2]){var xe=e.projectIntoViewport(W.touches[2].clientX,W.touches[2].clientY);K[4]=xe[0],K[5]=xe[1]}var Oe=o(function(oe){return{originalEvent:W,type:oe,position:{x:K[0],y:K[1]}}},"makeEvent");if(W.touches[1]){e.touchData.singleTouchMoved=!0,x(e.dragData.touchDragEles);var be=e.findContainerClientCoords();te=be[0],re=be[1],ee=be[2],Te=be[3],V=W.touches[0].clientX-te,H=W.touches[0].clientY-re,j=W.touches[1].clientX-te,U=W.touches[1].clientY-re,ue=0<=V&&V<=ee&&0<=j&&j<=ee&&0<=H&&H<=Te&&0<=U&&U<=Te;var Be=ce.pan(),Ae=ce.zoom();Q=De(V,H,j,U),Y=Ie(V,H,j,U),ae=[(V+j)/2,(H+U)/2],J=[(ae[0]-Be.x)/Ae,(ae[1]-Be.y)/Ae];var Ve=200,Pe=Ve*Ve;if(Y=1){for(var Gt=e.touchData.startPosition=[null,null,null,null,null,null],Tt=0;Tt=e.touchTapThreshold2}if(ce&&e.touchData.cxt){W.preventDefault();var Tt=W.touches[0].clientX-te,Et=W.touches[0].clientY-re,yt=W.touches[1].clientX-te,oe=W.touches[1].clientY-re,ht=Ie(Tt,Et,yt,oe),gt=ht/Y,et=150,pe=et*et,Qe=1.5,nt=Qe*Qe;if(gt>=nt||ht>=pe){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var dt=Ae("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(dt),e.touchData.start=null):Re.emit(dt)}}if(ce&&e.touchData.cxt){var dt=Ae("cxtdrag");e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(dt):Re.emit(dt),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var Ft=e.findNearestElement(xe[0],xe[1],!0,!0);(!e.touchData.cxtOver||Ft!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(Ae("cxtdragout")),e.touchData.cxtOver=Ft,Ft&&Ft.emit(Ae("cxtdragover")))}else if(ce&&W.touches[2]&&Re.boxSelectionEnabled())W.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||Re.emit(Ae("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,K[4]=1,!K||K.length===0||K[0]===void 0?(K[0]=(xe[0]+xe[2]+xe[4])/3,K[1]=(xe[1]+xe[3]+xe[5])/3,K[2]=(xe[0]+xe[2]+xe[4])/3+1,K[3]=(xe[1]+xe[3]+xe[5])/3+1):(K[2]=(xe[0]+xe[2]+xe[4])/3,K[3]=(xe[1]+xe[3]+xe[5])/3),e.redrawHint("select",!0),e.redraw();else if(ce&&W.touches[1]&&!e.touchData.didSelect&&Re.zoomingEnabled()&&Re.panningEnabled()&&Re.userZoomingEnabled()&&Re.userPanningEnabled()){W.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Rt=e.dragData.touchDragEles;if(Rt){e.redrawHint("drag",!0);for(var $t=0;$t0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},"touchmoveHandler"),!1);var Me;e.registerBinding(t,"touchcancel",Me=o(function(W){var ce=e.touchData.start;e.touchData.capture=!1,ce&&ce.unactivate()},"touchcancelHandler"));var $e,de,rt,ke;if(e.registerBinding(t,"touchend",$e=o(function(W){var ce=e.touchData.start,K=e.touchData.capture;if(K)W.touches.length===0&&(e.touchData.capture=!1),W.preventDefault();else return;var Re=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var xe=e.cy,Oe=xe.zoom(),be=e.touchData.now,Be=e.touchData.earlier;if(W.touches[0]){var Ae=e.projectIntoViewport(W.touches[0].clientX,W.touches[0].clientY);be[0]=Ae[0],be[1]=Ae[1]}if(W.touches[1]){var Ae=e.projectIntoViewport(W.touches[1].clientX,W.touches[1].clientY);be[2]=Ae[0],be[3]=Ae[1]}if(W.touches[2]){var Ae=e.projectIntoViewport(W.touches[2].clientX,W.touches[2].clientY);be[4]=Ae[0],be[5]=Ae[1]}var Ve=o(function(pe){return{originalEvent:W,type:pe,position:{x:be[0],y:be[1]}}},"makeEvent");ce&&ce.unactivate();var Pe;if(e.touchData.cxt){if(Pe=Ve("cxttapend"),ce?ce.emit(Pe):xe.emit(Pe),!e.touchData.cxtDragged){var Ye=Ve("cxttap");ce?ce.emit(Ye):xe.emit(Ye)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!W.touches[2]&&xe.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var le=xe.collection(e.getAllInBox(Re[0],Re[1],Re[2],Re[3]));Re[0]=void 0,Re[1]=void 0,Re[2]=void 0,Re[3]=void 0,Re[4]=0,e.redrawHint("select",!0),xe.emit(Ve("boxend"));var st=o(function(pe){return pe.selectable()&&!pe.selected()},"eleWouldBeSelected");le.emit(Ve("box")).stdFilter(st).select().emit(Ve("boxselect")),le.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(ce?.unactivate(),W.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!W.touches[1]){if(!W.touches[0]){if(!W.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var me=e.dragData.touchDragEles;if(ce!=null){var ot=ce._private.grabbed;x(me),e.redrawHint("drag",!0),e.redrawHint("eles",!0),ot&&(ce.emit(Ve("freeon")),me.emit(Ve("free")),e.dragData.didDrag&&(ce.emit(Ve("dragfreeon")),me.emit(Ve("dragfree")))),n(ce,["touchend","tapend","vmouseup","tapdragout"],W,{x:be[0],y:be[1]}),ce.unactivate(),e.touchData.start=null}else{var kt=e.findNearestElement(be[0],be[1],!0,!0);n(kt,["touchend","tapend","vmouseup","tapdragout"],W,{x:be[0],y:be[1]})}var Gt=e.touchData.startPosition[0]-be[0],Tt=Gt*Gt,Et=e.touchData.startPosition[1]-be[1],yt=Et*Et,oe=Tt+yt,ht=oe*Oe*Oe;e.touchData.singleTouchMoved||(ce||xe.$(":selected").unselect(["tapunselect"]),n(ce,["tap","vclick"],W,{x:be[0],y:be[1]}),de=!1,W.timeStamp-ke<=xe.multiClickDebounceTime()?(rt&&clearTimeout(rt),de=!0,ke=null,n(ce,["dbltap","vdblclick"],W,{x:be[0],y:be[1]})):(rt=setTimeout(function(){de||n(ce,["onetap","voneclick"],W,{x:be[0],y:be[1]})},xe.multiClickDebounceTime()),ke=W.timeStamp)),ce!=null&&!e.dragData.didDrag&&ce._private.selectable&&ht"u"){var Fe=[],He=o(function(W){return{clientX:W.clientX,clientY:W.clientY,force:1,identifier:W.pointerId,pageX:W.pageX,pageY:W.pageY,radiusX:W.width/2,radiusY:W.height/2,screenX:W.screenX,screenY:W.screenY,target:W.target}},"makeTouch"),at=o(function(W){return{event:W,touch:He(W)}},"makePointer"),qe=o(function(W){Fe.push(at(W))},"addPointer"),Ue=o(function(W){for(var ce=0;ce0)return V[0]}return null},"getCurveT"),g=Object.keys(p),y=0;y0?m:dme(a,s,t,r,i,n,l,u)},"intersectLine"),checkPoint:o(function(t,r,i,n,a,s,l,u){u=u==="auto"?Hd(n,a):u;var h=2*u;if(Qu(t,r,this.points,s,l,n,a-h,[0,-1],i)||Qu(t,r,this.points,s,l,n-h,a,[0,-1],i))return!0;var d=n/2+2*i,f=a/2+2*i,p=[s-d,l-f,s-d,l,s+d,l,s+d,l-f];return!!(Bs(t,r,p)||Qp(t,r,h,h,s+n/2-u,l+a/2-u,i)||Qp(t,r,h,h,s-n/2+u,l+a/2-u,i))},"checkPoint")}};Ju.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",rs(3,0)),this.generateRoundPolygon("round-triangle",rs(3,0)),this.generatePolygon("rectangle",rs(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",rs(5,0)),this.generateRoundPolygon("round-pentagon",rs(5,0)),this.generatePolygon("hexagon",rs(6,0)),this.generateRoundPolygon("round-hexagon",rs(6,0)),this.generatePolygon("heptagon",rs(7,0)),this.generateRoundPolygon("round-heptagon",rs(7,0)),this.generatePolygon("octagon",rs(8,0)),this.generateRoundPolygon("round-octagon",rs(8,0));var i=new Array(20);{var n=UO(5,0),a=UO(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var l=0;l=t.deqFastCost*w)break}else if(h){if(b>=t.deqCost*m||b>=t.deqAvgCost*p)break}else if(T>=t.deqNoDrawCost*PO)break;var C=t.deq(i,v,y);if(C.length>0)for(var k=0;k0&&(t.onDeqd(i,g),!h&&t.shouldRedraw(i,g,v,y)&&a())},"dequeue"),l=t.priority||mP;n.beforeRender(s,l(i))}},"setupDequeueingImpl")},"setupDequeueing")},mst=(function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:P3;Kd(this,e),this.idsByKey=new Ku,this.keyForId=new Ku,this.cachesByLvl=new Ku,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=r}return o(e,"ElementTextureCacheLookup"),Zd(e,[{key:"getIdsFor",value:o(function(r){r==null&&Yi("Can not get id list for null key");var i=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new y1,i.set(r,n)),n},"getIdsFor")},{key:"addIdForKey",value:o(function(r,i){r!=null&&this.getIdsFor(r).add(i)},"addIdForKey")},{key:"deleteIdForKey",value:o(function(r,i){r!=null&&this.getIdsFor(r).delete(i)},"deleteIdForKey")},{key:"getNumberOfIdsForKey",value:o(function(r){return r==null?0:this.getIdsFor(r).size},"getNumberOfIdsForKey")},{key:"updateKeyMappingFor",value:o(function(r){var i=r.id(),n=this.keyForId.get(i),a=this.getKey(r);this.deleteIdForKey(n,i),this.addIdForKey(a,i),this.keyForId.set(i,a)},"updateKeyMappingFor")},{key:"deleteKeyMappingFor",value:o(function(r){var i=r.id(),n=this.keyForId.get(i);this.deleteIdForKey(n,i),this.keyForId.delete(i)},"deleteKeyMappingFor")},{key:"keyHasChangedFor",value:o(function(r){var i=r.id(),n=this.keyForId.get(i),a=this.getKey(r);return n!==a},"keyHasChangedFor")},{key:"isInvalid",value:o(function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)},"isInvalid")},{key:"getCachesAt",value:o(function(r){var i=this.cachesByLvl,n=this.lvls,a=i.get(r);return a||(a=new Ku,i.set(r,a),n.push(r)),a},"getCachesAt")},{key:"getCache",value:o(function(r,i){return this.getCachesAt(i).get(r)},"getCache")},{key:"get",value:o(function(r,i){var n=this.getKey(r),a=this.getCache(n,i);return a!=null&&this.updateKeyMappingFor(r),a},"get")},{key:"getForCachedKey",value:o(function(r,i){var n=this.keyForId.get(r.id()),a=this.getCache(n,i);return a},"getForCachedKey")},{key:"hasCache",value:o(function(r,i){return this.getCachesAt(i).has(r)},"hasCache")},{key:"has",value:o(function(r,i){var n=this.getKey(r);return this.hasCache(n,i)},"has")},{key:"setCache",value:o(function(r,i,n){n.key=r,this.getCachesAt(i).set(r,n)},"setCache")},{key:"set",value:o(function(r,i,n){var a=this.getKey(r);this.setCache(a,i,n),this.updateKeyMappingFor(r)},"set")},{key:"deleteCache",value:o(function(r,i){this.getCachesAt(i).delete(r)},"deleteCache")},{key:"delete",value:o(function(r,i){var n=this.getKey(r);this.deleteCache(n,i)},"_delete")},{key:"invalidateKey",value:o(function(r){var i=this;this.lvls.forEach(function(n){return i.deleteCache(r,n)})},"invalidateKey")},{key:"invalidate",value:o(function(r){var i=r.id(),n=this.keyForId.get(i);this.deleteKeyMappingFor(r);var a=this.doesEleInvalidateKey(r);return a&&this.invalidateKey(n),a||this.getNumberOfIdsForKey(n)===0},"invalidate")}])})(),_0e=25,b3=50,L3=-4,aP=3,gge=7.99,gst=8,yst=1024,vst=1024,xst=1024,bst=.2,Tst=.8,Cst=10,kst=.15,wst=.1,Sst=.9,Est=.9,Ast=100,_st=1,c1={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Dst=va({getKey:null,doesEleInvalidateKey:P3,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:ame,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Vb=o(function(t,r){var i=this;i.renderer=t,i.onDequeues=[];var n=Dst(r);hr(i,n),i.lookup=new mst(n.getKey,n.doesEleInvalidateKey),i.setupDequeueing()},"ElementTextureCache"),qn=Vb.prototype;qn.reasons=c1;qn.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]};qn.getRetiredTextureQueue=function(e){var t=this,r=t.eleImgCaches.retired=t.eleImgCaches.retired||{},i=r[e]=r[e]||[];return i};qn.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new l2(function(r,i){return i.reqs-r.reqs});return t};qn.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t};qn.getElement=function(e,t,r,i,n){var a=this,s=this.renderer,l=s.cy.zoom(),u=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(i==null&&(i=Math.ceil(yP(l*r))),i=gge||i>aP)return null;var h=Math.pow(2,i),d=t.h*h,f=t.w*h,p=s.eleTextBiggerThanMin(e,h);if(!this.isVisible(e,p))return null;var m=u.get(e,i);if(m&&m.invalidated&&(m.invalidated=!1,m.texture.invalidatedWidth-=m.width),m)return m;var g;if(d<=_0e?g=_0e:d<=b3?g=b3:g=Math.ceil(d/b3)*b3,d>xst||f>vst)return null;var y=a.getTextureQueue(g),v=y[y.length-2],x=o(function(){return a.recycleTexture(g,f)||a.addTexture(g,f)},"addNewTxr");v||(v=y[y.length-1]),v||(v=x()),v.width-v.usedWidthi;I--)N=a.getElement(e,t,r,I,c1.downscale);P()}else return a.queueElement(e,k.level-1),k;else{var D;if(!T&&!w&&!C)for(var _=i-1;_>=L3;_--){var R=u.get(e,_);if(R){D=R;break}}if(b(D))return a.queueElement(e,i),D;v.context.translate(v.usedWidth,0),v.context.scale(h,h),this.drawElement(v.context,e,t,p,!1),v.context.scale(1/h,1/h),v.context.translate(-v.usedWidth,0)}return m={x:v.usedWidth,texture:v,level:i,scale:h,width:f,height:d,scaledLabelShown:p},v.usedWidth+=Math.ceil(f+gst),v.eleCaches.push(m),u.set(e,i,m),a.checkTextureFullness(v),m};qn.invalidateElements=function(e){for(var t=0;t=bst*e.width&&this.retireTexture(e)};qn.checkTextureFullness=function(e){var t=this,r=t.getTextureQueue(e.height);e.usedWidth/e.width>Tst&&e.fullnessChecks>=Cst?Ud(r,e):e.fullnessChecks++};qn.retireTexture=function(e){var t=this,r=e.height,i=t.getTextureQueue(r),n=this.lookup;Ud(i,e),e.retired=!0;for(var a=e.eleCaches,s=0;s=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,gP(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),Ud(n,s),i.push(s),s}};qn.queueElement=function(e,t){var r=this,i=r.getElementQueue(),n=r.getElementKeyToQueue(),a=this.getKey(e),s=n[a];if(s)s.level=Math.max(s.level,t),s.eles.merge(e),s.reqs++,i.updateItem(s);else{var l={eles:e.spawn().merge(e),level:t,reqs:1,key:a};i.push(l),n[a]=l}};qn.dequeue=function(e){for(var t=this,r=t.getElementQueue(),i=t.getElementKeyToQueue(),n=[],a=t.lookup,s=0;s<_st&&r.size()>0;s++){var l=r.pop(),u=l.key,h=l.eles[0],d=a.hasCache(h,l.level);if(i[u]=null,d)continue;n.push(l);var f=t.getBoundingBox(h);t.getElement(h,f,e,l.level,c1.dequeue)}return n};qn.removeFromQueue=function(e){var t=this,r=t.getElementQueue(),i=t.getElementKeyToQueue(),n=this.getKey(e),a=i[n];a!=null&&(a.eles.length===1?(a.reqs=pP,r.updateItem(a),r.pop(),i[n]=null):a.eles.unmerge(e))};qn.onDequeue=function(e){this.onDequeues.push(e)};qn.offDequeue=function(e){Ud(this.onDequeues,e)};qn.setupDequeueing=mge.setupDequeueing({deqRedrawThreshold:Ast,deqCost:kst,deqAvgCost:wst,deqNoDrawCost:Sst,deqFastCost:Est,deq:o(function(t,r,i){return t.dequeue(r,i)},"deq"),onDeqd:o(function(t,r){for(var i=0;i=Lst||r>q3)return null}i.validateLayersElesOrdering(r,e);var u=i.layersByLevel,h=Math.pow(2,r),d=u[r]=u[r]||[],f,p=i.levelIsComplete(r,e),m,g=o(function(){var P=o(function(M){if(i.validateLayersElesOrdering(M,e),i.levelIsComplete(M,e))return m=u[M],!0},"canUseAsTmpLvl"),I=o(function(M){if(!m)for(var L=r+M;qb<=L&&L<=q3&&!P(L);L+=M);},"checkLvls");I(1),I(-1);for(var D=d.length-1;D>=0;D--){var _=d[D];_.invalid&&Ud(d,_)}},"checkTempLevels");if(!p)g();else return d;var y=o(function(){if(!f){f=is();for(var P=0;PR0e||_>R0e)return null;var R=D*_;if(R>$st)return null;var M=i.makeLayer(f,r);if(I!=null){var L=d.indexOf(I)+1;d.splice(L,0,M)}else(P.insert===void 0||P.insert)&&d.unshift(M);return M},"makeLayer");if(i.skipping&&!l)return null;for(var x=null,b=e.length/Rst,T=!l,w=0;w=b||!hme(x.bb,C.boundingBox()))&&(x=v({insert:!0,after:x}),!x))return null;m||T?i.queueLayer(x,C):i.drawEleInLayer(x,C,r,t),x.eles.push(C),E[r]=x}return m||(T?null:d)};xa.getEleLevelForLayerLevel=function(e,t){return e};xa.drawEleInLayer=function(e,t,r,i){var n=this,a=this.renderer,s=e.context,l=t.boundingBox();l.w===0||l.h===0||!t.visible()||(r=n.getEleLevelForLayerLevel(r,i),a.setImgSmoothing(s,!1),a.drawCachedElement(s,t,null,null,r,zst),a.setImgSmoothing(s,!0))};xa.levelIsComplete=function(e,t){var r=this,i=r.layersByLevel[e];if(!i||i.length===0)return!1;for(var n=0,a=0;a0||s.invalid)return!1;n+=s.eles.length}return n===t.length};xa.validateLayersElesOrdering=function(e,t){var r=this.layersByLevel[e];if(r)for(var i=0;i0){t=!0;break}}return t};xa.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Zu(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,o(function(i,n,a){t.invalidateLayer(i)},"invalAssocLayers")))};xa.invalidateLayer=function(e){if(this.lastInvalidationTime=Zu(),!e.invalid){var t=e.level,r=e.eles,i=this.layersByLevel[t];Ud(i,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,l=t._private.rscratch;if(!(a&&!t.visible())&&!(l.badLine||l.allpts==null||isNaN(l.allpts[0]))){var u;r&&(u=r,e.translate(-u.x1,-u.y1));var h=a?t.pstyle("opacity").value:1,d=a?t.pstyle("line-opacity").value:1,f=t.pstyle("curve-style").value,p=t.pstyle("line-style").value,m=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,y=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,x=h*d,b=h*d,T=o(function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x;f==="straight-triangle"?(s.eleStrokeStyle(e,t,M),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=m,e.lineCap=g,s.eleStrokeStyle(e,t,M),s.drawEdgePath(t,e,l.allpts,p),e.lineCap="butt")},"drawLine"),w=o(function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x;if(e.lineWidth=m+y,e.lineCap=g,y>0)s.colorStrokeStyle(e,v[0],v[1],v[2],M);else{e.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(t,e,l.allpts):(s.drawEdgePath(t,e,l.allpts,p),e.lineCap="butt")},"drawLineOutline"),C=o(function(){n&&s.drawEdgeOverlay(e,t)},"drawOverlay"),k=o(function(){n&&s.drawEdgeUnderlay(e,t)},"drawUnderlay"),E=o(function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;s.drawArrowheads(e,t,M)},"drawArrows"),A=o(function(){s.drawElementText(e,t,null,i)},"drawText");e.lineJoin="round";var N=t.pstyle("ghost").value==="yes";if(N){var P=t.pstyle("ghost-offset-x").pfValue,I=t.pstyle("ghost-offset-y").pfValue,D=t.pstyle("ghost-opacity").value,_=x*D;e.translate(P,I),T(_),E(_),e.translate(-P,-I)}else w();k(),T(),E(),C(),A(),r&&e.translate(u.x1,u.y1)}};xge=o(function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(r,i){if(i.visible()){var n=i.pstyle("".concat(t,"-opacity")).value;if(n!==0){var a=this,s=a.usePaths(),l=i._private.rscratch,u=i.pstyle("".concat(t,"-padding")).pfValue,h=2*u,d=i.pstyle("".concat(t,"-color")).value;r.lineWidth=h,l.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",a.colorStrokeStyle(r,d[0],d[1],d[2],n),a.drawEdgePath(i,r,l.allpts,"solid")}}}},"drawEdgeOverlayUnderlay");eh.drawEdgeOverlay=xge("overlay");eh.drawEdgeUnderlay=xge("underlay");eh.drawEdgePath=function(e,t,r,i){var n=e._private.rscratch,a=t,s,l=!1,u=this.usePaths(),h=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var f=r.join("$"),p=n.pathCacheKey&&n.pathCacheKey===f;p?(s=t=n.pathCache,l=!0):(s=t=new Path2D,n.pathCacheKey=f,n.pathCache=s)}if(a.setLineDash)switch(i){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(h),a.lineDashOffset=d;break;case"solid":a.setLineDash([]);break}if(!l&&!n.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var m=2;m+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(i==null){if(a&&!s.eleTextBiggerThanMin(t))return}else if(i===!1)return;if(t.isNode()){var l=t.pstyle("label");if(!l||!l.value)return;var u=s.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var h=t.element()._private.rscratch.badLine,d=t.pstyle("label"),f=t.pstyle("source-label"),p=t.pstyle("target-label");if(h||(!d||!d.value)&&(!f||!f.value)&&(!p||!p.value))return;e.textAlign="center",e.textBaseline="bottom"}var m=!r,g;r&&(g=r,e.translate(-g.x1,-g.y1)),n==null?(s.drawText(e,t,null,m,a),t.isEdge()&&(s.drawText(e,t,"source",m,a),s.drawText(e,t,"target",m,a))):s.drawText(e,t,n,m,a),r&&e.translate(g.x1,g.y1)};a0.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!0,i=t.pstyle("font-style").strValue,n=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,s=t.pstyle("font-weight").strValue,l=r?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*l,h=t.pstyle("color").value,d=t.pstyle("text-outline-color").value;e.font=i+" "+s+" "+n+" "+a,e.lineJoin="round",this.colorFillStyle(e,h[0],h[1],h[2],l),this.colorStrokeStyle(e,d[0],d[1],d[2],u)};o(Zst,"circle");o(I0e,"roundRect");a0.getTextAngle=function(e,t){var r,i=e._private,n=i.rscratch,a=t?t+"-":"",s=e.pstyle(a+"text-rotation");if(s.strValue==="autorotate"){var l=Ps(n,"labelAngle",t);r=e.isEdge()?l:0}else s.strValue==="none"?r=0:r=s.pfValue;return r};a0.drawText=function(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private,s=a.rscratch,l=n?t.effectiveOpacity():1;if(!(n&&(l===0||t.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=Ps(s,"labelX",r),h=Ps(s,"labelY",r),d,f,p=this.getLabelText(t,r);if(p!=null&&p!==""&&!isNaN(u)&&!isNaN(h)){this.setupTextStyle(e,t,n);var m=r?r+"-":"",g=Ps(s,"labelWidth",r),y=Ps(s,"labelHeight",r),v=t.pstyle(m+"text-margin-x").pfValue,x=t.pstyle(m+"text-margin-y").pfValue,b=t.isEdge(),T=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;b&&(T="center",w="center"),u+=v,h+=x;var C;switch(i?C=this.getTextAngle(t,r):C=0,C!==0&&(d=u,f=h,e.translate(d,f),e.rotate(C),u=0,h=0),w){case"top":break;case"center":h+=y/2;break;case"bottom":h+=y;break}var k=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,A=t.pstyle("text-border-width").pfValue,N=t.pstyle("text-background-padding").pfValue,P=t.pstyle("text-background-shape").strValue,I=P==="round-rectangle"||P==="roundrectangle",D=P==="circle",_=2;if(k>0||A>0&&E>0){var R=e.fillStyle,M=e.strokeStyle,L=e.lineWidth,B=t.pstyle("text-background-color").value,O=t.pstyle("text-border-color").value,$=t.pstyle("text-border-style").value,G=k>0,F=A>0&&E>0,V=u-N;switch(T){case"left":V-=g;break;case"center":V-=g/2;break}var H=h-y-N,j=g+2*N,U=y+2*N;if(G&&(e.fillStyle="rgba(".concat(B[0],",").concat(B[1],",").concat(B[2],",").concat(k*l,")")),F&&(e.strokeStyle="rgba(".concat(O[0],",").concat(O[1],",").concat(O[2],",").concat(E*l,")"),e.lineWidth=A,e.setLineDash))switch($){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=A/4,e.setLineDash([]);break;case"solid":default:e.setLineDash([]);break}if(I?(e.beginPath(),I0e(e,V,H,j,U,_)):D?(e.beginPath(),Zst(e,V,H,j,U)):(e.beginPath(),e.rect(V,H,j,U)),G&&e.fill(),F&&e.stroke(),F&&$==="double"){var Q=A/2;e.beginPath(),I?I0e(e,V+Q,H+Q,j-2*Q,U-2*Q,_):e.rect(V+Q,H+Q,j-2*Q,U-2*Q),e.stroke()}e.fillStyle=R,e.strokeStyle=M,e.lineWidth=L,e.setLineDash&&e.setLineDash([])}var Y=2*t.pstyle("text-outline-width").pfValue;if(Y>0&&(e.lineWidth=Y),t.pstyle("text-wrap").value==="wrap"){var ae=Ps(s,"labelWrapCachedLines",r),J=Ps(s,"labelLineHeight",r),te=g/2,re=this.getLabelJustification(t);switch(re==="auto"||(T==="left"?re==="left"?u+=-g:re==="center"&&(u+=-te):T==="center"?re==="left"?u+=-te:re==="right"&&(u+=te):T==="right"&&(re==="center"?u+=te:re==="right"&&(u+=g))),w){case"top":h-=(ae.length-1)*J;break;case"center":case"bottom":h-=(ae.length-1)*J;break}for(var ee=0;ee0&&e.strokeText(ae[ee],u,h),e.fillText(ae[ee],u,h),h+=J}else Y>0&&e.strokeText(p,u,h),e.fillText(p,u,h);C!==0&&(e.rotate(-C),e.translate(-d,-f))}}};Jd={};Jd.drawNode=function(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,l,u,h=t._private,d=h.rscratch,f=t.position();if(!(!Ot(f.x)||!Ot(f.y))&&!(a&&!t.visible())){var p=a?t.effectiveOpacity():1,m=s.usePaths(),g,y=!1,v=t.padding();l=t.width()+2*v,u=t.height()+2*v;var x;r&&(x=r,e.translate(-x.x1,-x.y1));for(var b=t.pstyle("background-image"),T=b.value,w=new Array(T.length),C=new Array(T.length),k=0,E=0;E0&&arguments[0]!==void 0?arguments[0]:_;s.eleFillStyle(e,t,ie)},"setupShapeColor"),J=o(function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;s.colorStrokeStyle(e,R[0],R[1],R[2],ie)},"setupBorderColor"),te=o(function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:U;s.colorStrokeStyle(e,H[0],H[1],H[2],ie)},"setupOutlineColor"),re=o(function(ie,fe,W,ce){var K=s.nodePathCache=s.nodePathCache||[],Re=nme(W==="polygon"?W+","+ce.join(","):W,""+fe,""+ie,""+Y),xe=K[Re],Oe,be=!1;return xe!=null?(Oe=xe,be=!0,d.pathCache=Oe):(Oe=new Path2D,K[Re]=d.pathCache=Oe),{path:Oe,cacheHit:be}},"getPath"),ee=t.pstyle("shape").strValue,Te=t.pstyle("shape-polygon-points").pfValue;if(m){e.translate(f.x,f.y);var ue=re(l,u,ee,Te);g=ue.path,y=ue.cacheHit}var De=o(function(){if(!y){var ie=f;m&&(ie={x:0,y:0}),s.nodeShapes[s.getNodeShape(t)].draw(g||e,ie.x,ie.y,l,u,Y,d)}m?e.fill(g):e.fill()},"drawShape"),Ie=o(function(){for(var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,W=h.backgrounding,ce=0,K=0;K0&&arguments[0]!==void 0?arguments[0]:!1,fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;s.hasPie(t)&&(s.drawPie(e,t,fe),ie&&(m||s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,l,u,Y,d)))},"drawPie"),we=o(function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;s.hasStripe(t)&&(e.save(),m?e.clip(d.pathCache):(s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,l,u,Y,d),e.clip()),s.drawStripe(e,t,fe),e.restore(),ie&&(m||s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,l,u,Y,d)))},"drawStripe"),Me=o(function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,fe=(I>0?I:-I)*ie,W=I>0?0:255;I!==0&&(s.colorFillStyle(e,W,W,W,fe),m?e.fill(g):e.fill())},"darken"),$e=o(function(){if(D>0){if(e.lineWidth=D,e.lineCap=B,e.lineJoin=L,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash($),e.lineDashOffset=G;break;case"solid":case"double":e.setLineDash([]);break}if(O!=="center"){if(e.save(),e.lineWidth*=2,O==="inside")m?e.clip(g):e.clip();else{var ie=new Path2D;ie.rect(-l/2-D,-u/2-D,l+2*D,u+2*D),ie.addPath(g),e.clip(ie,"evenodd")}m?e.stroke(g):e.stroke(),e.restore()}else m?e.stroke(g):e.stroke();if(M==="double"){e.lineWidth=D/3;var fe=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",m?e.stroke(g):e.stroke(),e.globalCompositeOperation=fe}e.setLineDash&&e.setLineDash([])}},"drawBorder"),de=o(function(){if(V>0){if(e.lineWidth=V,e.lineCap="butt",e.setLineDash)switch(j){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var ie=f;m&&(ie={x:0,y:0});var fe=s.getNodeShape(t),W=D;O==="inside"&&(W=0),O==="outside"&&(W*=2);var ce=(l+W+(V+Q))/l,K=(u+W+(V+Q))/u,Re=l*ce,xe=u*K,Oe=s.nodeShapes[fe].points,be;if(m){var Be=re(Re,xe,fe,Oe);be=Be.path}if(fe==="ellipse")s.drawEllipsePath(be||e,ie.x,ie.y,Re,xe);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(fe)){var Ae=0,Ve=0,Pe=0;fe==="round-diamond"?Ae=(W+Q+V)*1.4:fe==="round-heptagon"?(Ae=(W+Q+V)*1.075,Pe=-(W/2+Q+V)/35):fe==="round-hexagon"?Ae=(W+Q+V)*1.12:fe==="round-pentagon"?(Ae=(W+Q+V)*1.13,Pe=-(W/2+Q+V)/15):fe==="round-tag"?(Ae=(W+Q+V)*1.12,Ve=(W/2+V+Q)*.07):fe==="round-triangle"&&(Ae=(W+Q+V)*(Math.PI/2),Pe=-(W+Q/2+V)/Math.PI),Ae!==0&&(ce=(l+Ae)/l,Re=l*ce,["round-hexagon","round-tag"].includes(fe)||(K=(u+Ae)/u,xe=u*K)),Y=Y==="auto"?pme(Re,xe):Y;for(var Ye=Re/2,le=xe/2,st=Y+(W+V+Q)/2,me=new Array(Oe.length/2),ot=new Array(Oe.length/2),kt=0;kt0){if(n=n||i.position(),a==null||s==null){var m=i.padding();a=i.width()+2*m,s=i.height()+2*m}l.colorFillStyle(r,d[0],d[1],d[2],h),l.nodeShapes[f].draw(r,n.x,n.y,a+u*2,s+u*2,p),r.fill()}}}},"drawNodeOverlayUnderlay");Jd.drawNodeOverlay=bge("overlay");Jd.drawNodeUnderlay=bge("underlay");Jd.hasPie=function(e){return e=e[0],e._private.hasPie};Jd.hasStripe=function(e){return e=e[0],e._private.hasStripe};Jd.drawPie=function(e,t,r,i){t=t[0],i=i||t.position();var n=t.cy().style(),a=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),l=t.pstyle("pie-start-angle").pfValue,u=i.x,h=i.y,d=t.width(),f=t.height(),p=Math.min(d,f)/2,m,g=0,y=this.usePaths();if(y&&(u=0,h=0),a.units==="%"?p=p*a.pfValue:a.pfValue!==void 0&&(p=a.pfValue/2),s.units==="%"?m=p*s.pfValue:s.pfValue!==void 0&&(m=s.pfValue/2),!(m>=p))for(var v=1;v<=n.pieBackgroundN;v++){var x=t.pstyle("pie-"+v+"-background-size").value,b=t.pstyle("pie-"+v+"-background-color").value,T=t.pstyle("pie-"+v+"-background-opacity").value*r,w=x/100;w+g>1&&(w=1-g);var C=1.5*Math.PI+2*Math.PI*g;C+=l;var k=2*Math.PI*w,E=C+k;x===0||g>=1||g+w>1||(m===0?(e.beginPath(),e.moveTo(u,h),e.arc(u,h,p,C,E),e.closePath()):(e.beginPath(),e.arc(u,h,p,C,E),e.arc(u,h,m,E,C,!0),e.closePath()),this.colorFillStyle(e,b[0],b[1],b[2],T),e.fill(),g+=w)}};Jd.drawStripe=function(e,t,r,i){t=t[0],i=i||t.position();var n=t.cy().style(),a=i.x,s=i.y,l=t.width(),u=t.height(),h=0,d=this.usePaths();e.save();var f=t.pstyle("stripe-direction").value,p=t.pstyle("stripe-size");switch(f){case"vertical":break;case"righward":e.rotate(-Math.PI/2);break}var m=l,g=u;p.units==="%"?(m=m*p.pfValue,g=g*p.pfValue):p.pfValue!==void 0&&(m=p.pfValue,g=p.pfValue),d&&(a=0,s=0),s-=m/2,a-=g/2;for(var y=1;y<=n.stripeBackgroundN;y++){var v=t.pstyle("stripe-"+y+"-background-size").value,x=t.pstyle("stripe-"+y+"-background-color").value,b=t.pstyle("stripe-"+y+"-background-opacity").value*r,T=v/100;T+h>1&&(T=1-h),!(v===0||h>=1||h+T>1)&&(e.beginPath(),e.rect(a,s+g*h,m,g*T),e.closePath(),this.colorFillStyle(e,x[0],x[1],x[2],b),e.fill(),h+=T)}e.restore()};ns={},Qst=100;ns.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),r=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/r};ns.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],r=!0,i,n=0;nt.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!f&&(d[t.NODE]=!0,d[t.SELECT_BOX]=!0);var b=r.style(),T=r.zoom(),w=s!==void 0?s:T,C=r.pan(),k={x:C.x,y:C.y},E={zoom:T,pan:{x:C.x,y:C.y}},A=t.prevViewport,N=A===void 0||E.zoom!==A.zoom||E.pan.x!==A.pan.x||E.pan.y!==A.pan.y;!N&&!(y&&!g)&&(t.motionBlurPxRatio=1),l&&(k=l),w*=u,k.x*=u,k.y*=u;var P=t.getCachedZSortedEles();function I(J,te,re,ee,Te){var ue=J.globalCompositeOperation;J.globalCompositeOperation="destination-out",t.colorFillStyle(J,255,255,255,t.motionBlurTransparency),J.fillRect(te,re,ee,Te),J.globalCompositeOperation=ue}o(I,"mbclear");function D(J,te){var re,ee,Te,ue;!t.clearingMotionBlur&&(J===h.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||J===h.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(re={x:C.x*m,y:C.y*m},ee=T*m,Te=t.canvasWidth*m,ue=t.canvasHeight*m):(re=k,ee=w,Te=t.canvasWidth,ue=t.canvasHeight),J.setTransform(1,0,0,1,0,0),te==="motionBlur"?I(J,0,0,Te,ue):!i&&(te===void 0||te)&&J.clearRect(0,0,Te,ue),n||(J.translate(re.x,re.y),J.scale(ee,ee)),l&&J.translate(l.x,l.y),s&&J.scale(s,s)}if(o(D,"setContextTransform"),f||(t.textureDrawLastFrame=!1),f){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=r.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var _=t.data.bufferContexts[t.TEXTURE_BUFFER];_.setTransform(1,0,0,1,0,0),_.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:_,drawOnlyNodeLayer:!0,forcedPxRatio:u*t.textureMult});var E=t.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:t.canvasWidth,height:t.canvasHeight};E.mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}d[t.DRAG]=!1,d[t.NODE]=!1;var R=h.contexts[t.NODE],M=t.textureCache.texture,E=t.textureCache.viewport;R.setTransform(1,0,0,1,0,0),p?I(R,0,0,E.width,E.height):R.clearRect(0,0,E.width,E.height);var L=b.core("outside-texture-bg-color").value,B=b.core("outside-texture-bg-opacity").value;t.colorFillStyle(R,L[0],L[1],L[2],B),R.fillRect(0,0,E.width,E.height);var T=r.zoom();D(R,!1),R.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/u,E.height/E.zoom/u),R.drawImage(M,E.mpan.x,E.mpan.y,E.width/E.zoom/u,E.height/E.zoom/u)}else t.textureOnViewport&&!i&&(t.textureCache=null);var O=r.extent(),$=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),G=t.hideEdgesOnViewport&&$,F=[];if(F[t.NODE]=!d[t.NODE]&&p&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,F[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),F[t.DRAG]=!d[t.DRAG]&&p&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,F[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),d[t.NODE]||n||a||F[t.NODE]){var V=p&&!F[t.NODE]&&m!==1,R=i||(V?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:h.contexts[t.NODE]),H=p&&!V?"motionBlur":void 0;D(R,H),G?t.drawCachedNodes(R,P.nondrag,u,O):t.drawLayeredElements(R,P.nondrag,u,O),t.debug&&t.drawDebugPoints(R,P.nondrag),!n&&!p&&(d[t.NODE]=!1)}if(!a&&(d[t.DRAG]||n||F[t.DRAG])){var V=p&&!F[t.DRAG]&&m!==1,R=i||(V?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:h.contexts[t.DRAG]);D(R,p&&!V?"motionBlur":void 0),G?t.drawCachedNodes(R,P.drag,u,O):t.drawCachedElements(R,P.drag,u,O),t.debug&&t.drawDebugPoints(R,P.drag),!n&&!p&&(d[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,D),p&&m!==1){var j=h.contexts[t.NODE],U=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],Q=h.contexts[t.DRAG],Y=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],ae=o(function(te,re,ee){te.setTransform(1,0,0,1,0,0),ee||!x?te.clearRect(0,0,t.canvasWidth,t.canvasHeight):I(te,0,0,t.canvasWidth,t.canvasHeight);var Te=m;te.drawImage(re,0,0,t.canvasWidth*Te,t.canvasHeight*Te,0,0,t.canvasWidth,t.canvasHeight)},"drawMotionBlur");(d[t.NODE]||F[t.NODE])&&(ae(j,U,F[t.NODE]),d[t.NODE]=!1),(d[t.DRAG]||F[t.DRAG])&&(ae(Q,Y,F[t.DRAG]),d[t.DRAG]=!1)}t.prevViewport=E,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),p&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!f,t.mbFrames=0,d[t.NODE]=!0,d[t.DRAG]=!0,t.redraw()},Qst)),i||r.emit("render")};ns.drawSelectionRectangle=function(e,t){var r=this,i=r.cy,n=r.data,a=i.style(),s=e.drawOnlyNodeLayer,l=e.drawAllLayers,u=n.canvasNeedsRedraw,h=e.forcedContext;if(r.showFps||!s&&u[r.SELECT_BOX]&&!l){var d=h||n.contexts[r.SELECT_BOX];if(t(d),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var f=r.cy.zoom(),p=a.core("selection-box-border-width").value/f;d.lineWidth=p,d.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",d.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),p>0&&(d.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",d.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(n.bgActivePosistion&&!r.hoverData.selecting){var f=r.cy.zoom(),m=n.bgActivePosistion;d.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",d.beginPath(),d.arc(m.x,m.y,a.core("active-bg-size").pfValue/f,0,2*Math.PI),d.fill()}var g=r.lastRedrawTime;if(r.showFps&&g){g=Math.round(g);var y=Math.round(1e3/g),v="1 frame = "+g+" ms = "+y+" fps";if(d.setTransform(1,0,0,1,0,0),d.fillStyle="rgba(255, 0, 0, 0.75)",d.strokeStyle="rgba(255, 0, 0, 0.75)",d.font="30px Arial",!Bb){var x=d.measureText(v);Bb=x.actualBoundingBoxAscent}d.fillText(v,0,Bb);var b=60;d.strokeRect(0,Bb+10,250,20),d.fillRect(0,Bb+10,250*Math.min(y/b,1),20)}l||(u[r.SELECT_BOX]=!1)}};o(O0e,"compileShader");o(Jst,"createProgram");o(eot,"createTextureCanvas");o(IP,"getEffectivePanZoom");o(tot,"getEffectiveZoom");o(rot,"modelToRenderedPosition");o(iot,"isSimpleShape");o(not,"arrayEqual");o(Hp,"toWebGLColor");o(n1,"indexToVec4");o(aot,"vec4ToIndex");o(sot,"createTexture");o(Tge,"getTypeInfo");o(Cge,"createTypedArray");o(oot,"createTypedArrayView");o(lot,"createBufferStaticDraw");o(Oc,"createBufferDynamicDraw");o(cot,"create3x3MatrixBufferDynamicDraw");o(uot,"createPickingFrameBuffer");P0e=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});o(FO,"create");o(B0e,"identity");o(hot,"multiply");o(M3,"translate");o(F0e,"rotate");o(sP,"scale");o(dot,"projection");fot=(function(){function e(t,r,i,n){Kd(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=r,this.texRows=i,this.texHeight=Math.floor(r/i),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=n(t,r,r),this.scratch=n(t,r,this.texHeight,"scratch")}return o(e,"Atlas"),Zd(e,[{key:"lock",value:o(function(){this.locked=!0},"lock")},{key:"getKeys",value:o(function(){return new Set(this.keyToLocation.keys())},"getKeys")},{key:"getScale",value:o(function(r){var i=r.w,n=r.h,a=this.texHeight,s=this.texSize,l=a/n,u=i*l,h=n*l;return u>s&&(l=s/i,u=i*l,h=n*l),{scale:l,texW:u,texH:h}},"getScale")},{key:"draw",value:o(function(r,i,n){var a=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,l=this.texRows,u=this.texHeight,h=this.getScale(i),d=h.scale,f=h.texW,p=h.texH,m=o(function(T,w){if(n&&w){var C=w.context,k=T.x,E=T.row,A=k,N=u*E;C.save(),C.translate(A,N),C.scale(d,d),n(C,i),C.restore()}},"drawAt"),g=[null,null],y=o(function(){m(a.freePointer,a.canvas),g[0]={x:a.freePointer.x,y:a.freePointer.row*u,w:f,h:p},g[1]={x:a.freePointer.x+f,y:a.freePointer.row*u,w:0,h:p},a.freePointer.x+=f,a.freePointer.x==s&&(a.freePointer.x=0,a.freePointer.row++)},"drawNormal"),v=o(function(){var T=a.scratch,w=a.canvas;T.clear(),m({x:0,row:0},T);var C=s-a.freePointer.x,k=f-C,E=u;{var A=a.freePointer.x,N=a.freePointer.row*u,P=C;w.context.drawImage(T,0,0,P,E,A,N,P,E),g[0]={x:A,y:N,w:P,h:p}}{var I=C,D=(a.freePointer.row+1)*u,_=k;w&&w.context.drawImage(T,I,0,_,E,0,D,_,E),g[1]={x:0,y:D,w:_,h:p}}a.freePointer.x=k,a.freePointer.row++},"drawWrapped"),x=o(function(){a.freePointer.x=0,a.freePointer.row++},"moveToStartOfNextRow");if(this.freePointer.x+f<=s)y();else{if(this.freePointer.row>=l-1)return!1;this.freePointer.x===s?(x(),y()):this.enableWrapping?v():(x(),y())}return this.keyToLocation.set(r,g),this.needsBuffer=!0,g},"draw")},{key:"getOffsets",value:o(function(r){return this.keyToLocation.get(r)},"getOffsets")},{key:"isEmpty",value:o(function(){return this.freePointer.x===0&&this.freePointer.row===0},"isEmpty")},{key:"canFit",value:o(function(r){if(this.locked)return!1;var i=this.texSize,n=this.texRows,a=this.getScale(r),s=a.texW;return this.freePointer.x+s>i?this.freePointer.row1&&arguments[1]!==void 0?arguments[1]:{},a=n.forceRedraw,s=a===void 0?!1:a,l=n.filterEle,u=l===void 0?function(){return!0}:l,h=n.filterType,d=h===void 0?function(){return!0}:h,f=!1,p=!1,m=Fs(r),g;try{for(m.s();!(g=m.n()).done;){var y=g.value;if(u(y)){var v=Fs(this.renderTypes.values()),x;try{var b=o(function(){var w=x.value,C=w.type;if(d(C)){var k=i.collections.get(w.collection),E=w.getKey(y),A=Array.isArray(E)?E:[E];if(s)A.forEach(function(D){return k.markKeyForGC(D)}),p=!0;else{var N=w.getID?w.getID(y):y.id(),P=i._key(C,N),I=i.typeAndIdToKey.get(P);I!==void 0&&!not(A,I)&&(f=!0,i.typeAndIdToKey.delete(P),I.forEach(function(D){return k.markKeyForGC(D)}))}}},"_loop2");for(v.s();!(x=v.n()).done;)b()}catch(T){v.e(T)}finally{v.f()}}}}catch(T){m.e(T)}finally{m.f()}return p&&(this.gc(),f=!1),f},"invalidate")},{key:"gc",value:o(function(){var r=Fs(this.collections.values()),i;try{for(r.s();!(i=r.n()).done;){var n=i.value;n.gc()}}catch(a){r.e(a)}finally{r.f()}},"gc")},{key:"getOrCreateAtlas",value:o(function(r,i,n,a){var s=this.renderTypes.get(i),l=this.collections.get(s.collection),u=!1,h=l.draw(a,n,function(p){s.drawClipped?(p.save(),p.beginPath(),p.rect(0,0,n.w,n.h),p.clip(),s.drawElement(p,r,n,!0,!0),p.restore()):s.drawElement(p,r,n,!0,!0),u=!0});if(u){var d=s.getID?s.getID(r):r.id(),f=this._key(i,d);this.typeAndIdToKey.has(f)?this.typeAndIdToKey.get(f).push(a):this.typeAndIdToKey.set(f,[a])}return h},"getOrCreateAtlas")},{key:"getAtlasInfo",value:o(function(r,i){var n=this,a=this.renderTypes.get(i),s=a.getKey(r),l=Array.isArray(s)?s:[s];return l.map(function(u){var h=a.getBoundingBox(r,u),d=n.getOrCreateAtlas(r,i,h,u),f=d.getOffsets(u),p=Dn(f,2),m=p[0],g=p[1];return{atlas:d,tex:m,tex1:m,tex2:g,bb:h}})},"getAtlasInfo")},{key:"getDebugInfo",value:o(function(){var r=[],i=Fs(this.collections),n;try{for(i.s();!(n=i.n()).done;){var a=Dn(n.value,2),s=a[0],l=a[1],u=l.getCounts(),h=u.keyCount,d=u.atlasCount;r.push({type:s,keyCount:h,atlasCount:d})}}catch(f){i.e(f)}finally{i.f()}return r},"getDebugInfo")}])})(),yot=(function(){function e(t){Kd(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return o(e,"AtlasBatchManager"),Zd(e,[{key:"getMaxAtlasesPerBatch",value:o(function(){return this.maxAtlasesPerBatch},"getMaxAtlasesPerBatch")},{key:"getAtlasSize",value:o(function(){return this.atlasSize},"getAtlasSize")},{key:"getIndexArray",value:o(function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,i){return i})},"getIndexArray")},{key:"startBatch",value:o(function(){this.batchAtlases=[]},"startBatch")},{key:"getAtlasCount",value:o(function(){return this.batchAtlases.length},"getAtlasCount")},{key:"getAtlases",value:o(function(){return this.batchAtlases},"getAtlases")},{key:"canAddToCurrentBatch",value:o(function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0},"canAddToCurrentBatch")},{key:"getAtlasIndexForBatch",value:o(function(r){var i=this.batchAtlases.indexOf(r);if(i<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),i=this.batchAtlases.length-1}return i},"getAtlasIndexForBatch")}])})(),vot=` + float circleSD(vec2 p, float r) { + return distance(vec2(0), p) - r; // signed distance + } +`,xot=` + float rectangleSD(vec2 p, vec2 b) { + vec2 d = abs(p)-b; + return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0); + } +`,bot=` + float roundRectangleSD(vec2 p, vec2 b, vec4 cr) { + cr.xy = (p.x > 0.0) ? cr.xy : cr.zw; + cr.x = (p.y > 0.0) ? cr.x : cr.y; + vec2 q = abs(p) - b + cr.x; + return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x; + } +`,Tot=` + float ellipseSD(vec2 p, vec2 ab) { + p = abs( p ); // symmetry + + // find root with Newton solver + vec2 q = ab*(p-ab); + float w = (q.x1.0) ? d : -d; + } +`,Ub={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},U3={IGNORE:1,USE_BB:2},$O=0,$0e=1,z0e=2,zO=3,a1=4,T3=5,Fb=6,$b=7,Cot=(function(){function e(t,r,i){Kd(this,e),this.r=t,this.gl=r,this.maxInstances=i.webglBatchSize,this.atlasSize=i.webglTexSize,this.bgColor=i.bgColor,this.debug=i.webglDebug,this.batchDebugInfo=[],i.enableWrapping=!0,i.createTextureCanvas=eot,this.atlasManager=new got(t,i),this.batchManager=new yot(i),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Ub.SCREEN),this.pickingProgram=this._createShaderProgram(Ub.PICKING),this.vao=this._createVAO()}return o(e,"ElementDrawingWebGL"),Zd(e,[{key:"addAtlasCollection",value:o(function(r,i){this.atlasManager.addAtlasCollection(r,i)},"addAtlasCollection")},{key:"addTextureAtlasRenderType",value:o(function(r,i){this.atlasManager.addRenderType(r,i)},"addTextureAtlasRenderType")},{key:"addSimpleShapeRenderType",value:o(function(r,i){this.simpleShapeOptions.set(r,i)},"addSimpleShapeRenderType")},{key:"invalidate",value:o(function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=i.type,a=this.atlasManager;return n?a.invalidate(r,{filterType:o(function(l){return l===n},"filterType"),forceRedraw:!0}):a.invalidate(r)},"invalidate")},{key:"gc",value:o(function(){this.atlasManager.gc()},"gc")},{key:"_createShaderProgram",value:o(function(r){var i=this.gl,n=`#version 300 es + precision highp float; + + uniform mat3 uPanZoomMatrix; + uniform int uAtlasSize; + + // instanced + in vec2 aPosition; // a vertex from the unit square + + in mat3 aTransform; // used to transform verticies, eg into a bounding box + in int aVertType; // the type of thing we are rendering + + // the z-index that is output when using picking mode + in vec4 aIndex; + + // For textures + in int aAtlasId; // which shader unit/atlas to use + in vec4 aTex; // x/y/w/h of texture in atlas + + // for edges + in vec4 aPointAPointB; + in vec4 aPointCPointD; + in vec2 aLineWidth; // also used for node border width + + // simple shapes + in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left] + in vec4 aColor; // also used for edges + in vec4 aBorderColor; // aLineWidth is used for border width + + // output values passed to the fragment shader + out vec2 vTexCoord; + out vec4 vColor; + out vec2 vPosition; + // flat values are not interpolated + flat out int vAtlasId; + flat out int vVertType; + flat out vec2 vTopRight; + flat out vec2 vBotLeft; + flat out vec4 vCornerRadius; + flat out vec4 vBorderColor; + flat out vec2 vBorderWidth; + flat out vec4 vIndex; + + void main(void) { + int vid = gl_VertexID; + vec2 position = aPosition; // TODO make this a vec3, simplifies some code below + + if(aVertType == `.concat($O,`) { + float texX = aTex.x; // texture coordinates + float texY = aTex.y; + float texW = aTex.z; + float texH = aTex.w; + + if(vid == 1 || vid == 2 || vid == 4) { + texX += texW; + } + if(vid == 2 || vid == 4 || vid == 5) { + texY += texH; + } + + float d = float(uAtlasSize); + vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1 + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + } + else if(aVertType == `).concat(a1," || aVertType == ").concat($b,` + || aVertType == `).concat(T3," || aVertType == ").concat(Fb,`) { // simple shapes + + // the bounding box is needed by the fragment shader + vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat + vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat + vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated + + // calculations are done in the fragment shader, just pass these along + vColor = aColor; + vCornerRadius = aCornerRadius; + vBorderColor = aBorderColor; + vBorderWidth = aLineWidth; + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + } + else if(aVertType == `).concat($0e,`) { + vec2 source = aPointAPointB.xy; + vec2 target = aPointAPointB.zw; + + // adjust the geometry so that the line is centered on the edge + position.y = position.y - 0.5; + + // stretch the unit square into a long skinny rectangle + vec2 xBasis = target - source; + vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x)); + vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y; + + gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0); + vColor = aColor; + } + else if(aVertType == `).concat(z0e,`) { + vec2 pointA = aPointAPointB.xy; + vec2 pointB = aPointAPointB.zw; + vec2 pointC = aPointCPointD.xy; + vec2 pointD = aPointCPointD.zw; + + // adjust the geometry so that the line is centered on the edge + position.y = position.y - 0.5; + + vec2 p0, p1, p2, pos; + if(position.x == 0.0) { // The left side of the unit square + p0 = pointA; + p1 = pointB; + p2 = pointC; + pos = position; + } else { // The right side of the unit square, use same approach but flip the geometry upside down + p0 = pointD; + p1 = pointC; + p2 = pointB; + pos = vec2(0.0, -position.y); + } + + vec2 p01 = p1 - p0; + vec2 p12 = p2 - p1; + vec2 p21 = p1 - p2; + + // Find the normal vector. + vec2 tangent = normalize(normalize(p12) + normalize(p01)); + vec2 normal = vec2(-tangent.y, tangent.x); + + // Find the vector perpendicular to p0 -> p1. + vec2 p01Norm = normalize(vec2(-p01.y, p01.x)); + + // Determine the bend direction. + float sigma = sign(dot(p01 + p21, normal)); + float width = aLineWidth[0]; + + if(sign(pos.y) == -sigma) { + // This is an intersecting vertex. Adjust the position so that there's no overlap. + vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm); + gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); + } else { + // This is a non-intersecting vertex. Treat it like a mitre join. + vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm); + gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); + } + + vColor = aColor; + } + else if(aVertType == `).concat(zO,` && vid < 3) { + // massage the first triangle into an edge arrow + if(vid == 0) + position = vec2(-0.15, -0.3); + if(vid == 1) + position = vec2( 0.0, 0.0); + if(vid == 2) + position = vec2( 0.15, -0.3); + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + vColor = aColor; + } + else { + gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space + } + + vAtlasId = aAtlasId; + vVertType = aVertType; + vIndex = aIndex; + } + `),a=this.batchManager.getIndexArray(),s=`#version 300 es + precision highp float; + + // declare texture unit for each texture atlas in the batch + `.concat(a.map(function(h){return"uniform sampler2D uTexture".concat(h,";")}).join(` + `),` + + uniform vec4 uBGColor; + uniform float uZoom; + + in vec2 vTexCoord; + in vec4 vColor; + in vec2 vPosition; // model coordinates + + flat in int vAtlasId; + flat in vec4 vIndex; + flat in int vVertType; + flat in vec2 vTopRight; + flat in vec2 vBotLeft; + flat in vec4 vCornerRadius; + flat in vec4 vBorderColor; + flat in vec2 vBorderWidth; + + out vec4 outColor; + + `).concat(vot,` + `).concat(xot,` + `).concat(bot,` + `).concat(Tot,` + + vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha + return vec4( + top.rgb + (bot.rgb * (1.0 - top.a)), + top.a + (bot.a * (1.0 - top.a)) + ); + } + + vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance + // scale to the zoom level so that borders don't look blurry when zoomed in + // note 1.5 is an aribitrary value chosen because it looks good + return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); + } + + void main(void) { + if(vVertType == `).concat($O,`) { + // look up the texel from the texture unit + `).concat(a.map(function(h){return"if(vAtlasId == ".concat(h,") outColor = texture(uTexture").concat(h,", vTexCoord);")}).join(` + else `),` + } + else if(vVertType == `).concat(zO,`) { + // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out'; + outColor = blend(vColor, uBGColor); + outColor.a = 1.0; // make opaque, masks out line under arrow + } + else if(vVertType == `).concat(a1,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border + outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done + } + else if(vVertType == `).concat(a1," || vVertType == ").concat($b,` + || vVertType == `).concat(T3," || vVertType == ").concat(Fb,`) { // use SDF + + float outerBorder = vBorderWidth[0]; + float innerBorder = vBorderWidth[1]; + float borderPadding = outerBorder * 2.0; + float w = vTopRight.x - vBotLeft.x - borderPadding; + float h = vTopRight.y - vBotLeft.y - borderPadding; + vec2 b = vec2(w/2.0, h/2.0); // half width, half height + vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center + + float d; // signed distance + if(vVertType == `).concat(a1,`) { + d = rectangleSD(p, b); + } else if(vVertType == `).concat($b,` && w == h) { + d = circleSD(p, b.x); // faster than ellipse + } else if(vVertType == `).concat($b,`) { + d = ellipseSD(p, b); + } else { + d = roundRectangleSD(p, b, vCornerRadius.wzyx); + } + + // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling + // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box + if(d > 0.0) { + if(d > outerBorder) { + discard; + } else { + outColor = distInterp(vBorderColor, vec4(0), d - outerBorder); + } + } else { + if(d > innerBorder) { + vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor; + vec4 innerBorderColor = blend(vBorderColor, vColor); + outColor = distInterp(innerBorderColor, outerColor, d); + } + else { + vec4 outerColor; + if(innerBorder == 0.0 && outerBorder == 0.0) { + outerColor = vec4(0); + } else if(innerBorder == 0.0) { + outerColor = vBorderColor; + } else { + outerColor = blend(vBorderColor, vColor); + } + outColor = distInterp(vColor, outerColor, d - innerBorder); + } + } + } + else { + outColor = vColor; + } + + `).concat(r.picking?`if(outColor.a == 0.0) discard; + else outColor = vIndex;`:"",` + } + `),l=Jst(i,n,s);l.aPosition=i.getAttribLocation(l,"aPosition"),l.aIndex=i.getAttribLocation(l,"aIndex"),l.aVertType=i.getAttribLocation(l,"aVertType"),l.aTransform=i.getAttribLocation(l,"aTransform"),l.aAtlasId=i.getAttribLocation(l,"aAtlasId"),l.aTex=i.getAttribLocation(l,"aTex"),l.aPointAPointB=i.getAttribLocation(l,"aPointAPointB"),l.aPointCPointD=i.getAttribLocation(l,"aPointCPointD"),l.aLineWidth=i.getAttribLocation(l,"aLineWidth"),l.aColor=i.getAttribLocation(l,"aColor"),l.aCornerRadius=i.getAttribLocation(l,"aCornerRadius"),l.aBorderColor=i.getAttribLocation(l,"aBorderColor"),l.uPanZoomMatrix=i.getUniformLocation(l,"uPanZoomMatrix"),l.uAtlasSize=i.getUniformLocation(l,"uAtlasSize"),l.uBGColor=i.getUniformLocation(l,"uBGColor"),l.uZoom=i.getUniformLocation(l,"uZoom"),l.uTextures=[];for(var u=0;u1&&arguments[1]!==void 0?arguments[1]:Ub.SCREEN;this.panZoomMatrix=r,this.renderTarget=i,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()},"startFrame")},{key:"startBatch",value:o(function(){this.instanceCount=0,this.batchManager.startBatch()},"startBatch")},{key:"endFrame",value:o(function(){this.endBatch()},"endFrame")},{key:"_isVisible",value:o(function(r,i){return r.visible()?i&&i.isVisible?i.isVisible(r):!0:!1},"_isVisible")},{key:"drawTexture",value:o(function(r,i,n){var a=this.atlasManager,s=this.batchManager,l=a.getRenderTypeOpts(n);if(this._isVisible(r,l)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&l.getTexPickingMode){var u=l.getTexPickingMode(r);if(u===U3.IGNORE)return;if(u==U3.USE_BB){this.drawPickingRectangle(r,i,n);return}}var h=a.getAtlasInfo(r,n),d=Fs(h),f;try{for(d.s();!(f=d.n()).done;){var p=f.value,m=p.atlas,g=p.tex1,y=p.tex2;s.canAddToCurrentBatch(m)||this.endBatch();for(var v=s.getAtlasIndexForBatch(m),x=0,b=[[g,!0],[y,!1]];x=this.maxInstances&&this.endBatch()}}}}catch(I){d.e(I)}finally{d.f()}}},"drawTexture")},{key:"setTransformMatrix",value:o(function(r,i,n,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,l=0;if(n.shapeProps&&n.shapeProps.padding&&(l=r.pstyle(n.shapeProps.padding).pfValue),a){var u=a.bb,h=a.tex1,d=a.tex2,f=h.w/(h.w+d.w);s||(f=1-f);var p=this._getAdjustedBB(u,l,s,f);this._applyTransformMatrix(i,p,n,r)}else{var m=n.getBoundingBox(r),g=this._getAdjustedBB(m,l,!0,1);this._applyTransformMatrix(i,g,n,r)}},"setTransformMatrix")},{key:"_applyTransformMatrix",value:o(function(r,i,n,a){var s,l;B0e(r);var u=n.getRotation?n.getRotation(a):0;if(u!==0){var h=n.getRotationPoint(a),d=h.x,f=h.y;M3(r,r,[d,f]),F0e(r,r,u);var p=n.getRotationOffset(a);s=p.x+(i.xOffset||0),l=p.y+(i.yOffset||0)}else s=i.x1,l=i.y1;M3(r,r,[s,l]),sP(r,r,[i.w,i.h])},"_applyTransformMatrix")},{key:"_getAdjustedBB",value:o(function(r,i,n,a){var s=r.x1,l=r.y1,u=r.w,h=r.h,d=r.yOffset;i&&(s-=i,l-=i,u+=2*i,h+=2*i);var f=0,p=u*a;return n&&a<1?u=p:!n&&a<1&&(f=u-p,s+=f,u=p),{x1:s,y1:l,w:u,h,xOffset:f,yOffset:d}},"_getAdjustedBB")},{key:"drawPickingRectangle",value:o(function(r,i,n){var a=this.atlasManager.getRenderTypeOpts(n),s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=a1;var l=this.indexBuffer.getView(s);n1(i,l);var u=this.colorBuffer.getView(s);Hp([0,0,0],1,u);var h=this.transformBuffer.getMatrixView(s);this.setTransformMatrix(r,h,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()},"drawPickingRectangle")},{key:"drawNode",value:o(function(r,i,n){var a=this.simpleShapeOptions.get(n);if(this._isVisible(r,a)){var s=a.shapeProps,l=this._getVertTypeForShape(r,s.shape);if(l===void 0||a.isSimple&&!a.isSimple(r)){this.drawTexture(r,i,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=l,l===T3||l===Fb){var h=a.getBoundingBox(r),d=this._getCornerRadius(r,s.radius,h),f=this.cornerRadiusBuffer.getView(u);f[0]=d,f[1]=d,f[2]=d,f[3]=d,l===Fb&&(f[0]=0,f[2]=0)}var p=this.indexBuffer.getView(u);n1(i,p);var m=r.pstyle(s.color).value,g=r.pstyle(s.opacity).value,y=this.colorBuffer.getView(u);Hp(m,g,y);var v=this.lineWidthBuffer.getView(u);if(v[0]=0,v[1]=0,s.border){var x=r.pstyle("border-width").value;if(x>0){var b=r.pstyle("border-color").value,T=r.pstyle("border-opacity").value,w=this.borderColorBuffer.getView(u);Hp(b,T,w);var C=r.pstyle("border-position").value;if(C==="inside")v[0]=0,v[1]=-x;else if(C==="outside")v[0]=x,v[1]=0;else{var k=x/2;v[0]=k,v[1]=-k}}}var E=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(r,E,a),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},"drawNode")},{key:"_getVertTypeForShape",value:o(function(r,i){var n=r.pstyle(i).value;switch(n){case"rectangle":return a1;case"ellipse":return $b;case"roundrectangle":case"round-rectangle":return T3;case"bottom-round-rectangle":return Fb;default:return}},"_getVertTypeForShape")},{key:"_getCornerRadius",value:o(function(r,i,n){var a=n.w,s=n.h;if(r.pstyle(i).value==="auto")return Hd(a,s);var l=r.pstyle(i).pfValue,u=a/2,h=s/2;return Math.min(l,h,u)},"_getCornerRadius")},{key:"drawEdgeArrow",value:o(function(r,i,n){if(r.visible()){var a=r._private.rscratch,s,l,u;if(n==="source"?(s=a.arrowStartX,l=a.arrowStartY,u=a.srcArrowAngle):(s=a.arrowEndX,l=a.arrowEndY,u=a.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(l)||l==null||isNaN(u)||u==null)){var h=r.pstyle(n+"-arrow-shape").value;if(h!=="none"){var d=r.pstyle(n+"-arrow-color").value,f=r.pstyle("opacity").value,p=r.pstyle("line-opacity").value,m=f*p,g=r.pstyle("width").pfValue,y=r.pstyle("arrow-scale").value,v=this.r.getArrowWidth(g,y),x=this.instanceCount,b=this.transformBuffer.getMatrixView(x);B0e(b),M3(b,b,[s,l]),sP(b,b,[v,v]),F0e(b,b,u),this.vertTypeBuffer.getView(x)[0]=zO;var T=this.indexBuffer.getView(x);n1(i,T);var w=this.colorBuffer.getView(x);Hp(d,m,w),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},"drawEdgeArrow")},{key:"drawEdgeLine",value:o(function(r,i){if(r.visible()){var n=this._getEdgePoints(r);if(n){var a=r.pstyle("opacity").value,s=r.pstyle("line-opacity").value,l=r.pstyle("width").pfValue,u=r.pstyle("line-color").value,h=a*s;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var d=this.instanceCount;this.vertTypeBuffer.getView(d)[0]=$0e;var f=this.indexBuffer.getView(d);n1(i,f);var p=this.colorBuffer.getView(d);Hp(u,h,p);var m=this.lineWidthBuffer.getView(d);m[0]=l;var g=this.pointAPointBBuffer.getView(d);g[0]=n[0],g[1]=n[1],g[2]=n[2],g[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var y=0;y=this.maxInstances&&this.endBatch()}}}},"drawEdgeLine")},{key:"_isValidEdge",value:o(function(r){var i=r._private.rscratch;return!(i.badLine||i.allpts==null||isNaN(i.allpts[0]))},"_isValidEdge")},{key:"_getEdgePoints",value:o(function(r){var i=r._private.rscratch;if(this._isValidEdge(r)){var n=i.allpts;if(n.length==4)return n;var a=this._getNumSegments(r);return this._getCurveSegmentPoints(n,a)}},"_getEdgePoints")},{key:"_getNumSegments",value:o(function(r){var i=15;return Math.min(Math.max(i,5),this.maxInstances)},"_getNumSegments")},{key:"_getCurveSegmentPoints",value:o(function(r,i){if(r.length==4)return r;for(var n=Array((i+1)*2),a=0;a<=i;a++)if(a==0)n[0]=r[0],n[1]=r[1];else if(a==i)n[a*2]=r[r.length-2],n[a*2+1]=r[r.length-1];else{var s=a/i;this._setCurvePoint(r,s,n,a*2)}return n},"_getCurveSegmentPoints")},{key:"_setCurvePoint",value:o(function(r,i,n,a){if(r.length<=2)n[a]=r[0],n[a+1]=r[1];else{for(var s=Array(r.length-2),l=0;l0}},"isLayerVisible"),l=o(function(f){var p=f.pstyle("text-events").strValue==="yes";return p?U3.USE_BB:U3.IGNORE},"getTexPickingMode"),u=o(function(f){var p=f.position(),m=p.x,g=p.y,y=f.outerWidth(),v=f.outerHeight();return{w:y,h:v,x1:m-y/2,y1:g-v/2}},"getBBForSimpleShape");r.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:iot,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:s("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:s("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:l,getKey:GO(t.getLabelKey,null),getBoundingBox:VO(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:n(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:l,getKey:GO(t.getSourceLabelKey,"source"),getBoundingBox:VO(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:n("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:l,getKey:GO(t.getTargetLabelKey,"target"),getBoundingBox:VO(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:n("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a("target-label")});var h=o2(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(d,f){var p=!1;f&&f.length>0&&(p|=r.drawing.invalidate(f)),p&&h()}),wot(r)};o(kot,"getBGColor");o(wge,"getLabelLines");GO=o(function(t,r){return function(i){var n=t(i),a=wge(i,r);return a.length>1?a.map(function(s,l){return"".concat(n,"_").concat(l)}):n}},"getStyleKeysForLabel"),VO=o(function(t,r){return function(i,n){var a=t(i);if(typeof n=="string"){var s=n.indexOf("_");if(s>0){var l=Number(n.substring(s+1)),u=wge(i,r),h=a.h/u.length,d=h*l,f=a.y1+d;return{x1:a.x1,w:a.w,y1:f,h,yOffset:d}}}return a}},"getBoundingBoxForLabel");o(wot,"overrideCanvasRendererFunctions");o(Sot,"clearWebgl");o(Eot,"clearCanvas");o(Aot,"createPanZoomMatrix");o(Sge,"setContextTransform");o(_ot,"drawSelectionRectangle");o(Dot,"drawAxes");o(Rot,"drawAtlases");o(Lot,"getPickingIndexes");o(Mot,"findNearestElementsWebgl");o(WO,"drawEle");o(Ege,"renderWebgl");ef={};ef.drawPolygonPath=function(e,t,r,i,n,a){var s=i/2,l=n/2;e.beginPath&&e.beginPath(),e.moveTo(t+s*a[0],r+l*a[1]);for(var u=1;u0&&s>0){m.clearRect(0,0,a,s),m.globalCompositeOperation="source-over";var g=this.getCachedZSortedEles();if(e.full)m.translate(-i.x1*h,-i.y1*h),m.scale(h,h),this.drawElements(m,g),m.scale(1/h,1/h),m.translate(i.x1*h,i.y1*h);else{var y=t.pan(),v={x:y.x*h,y:y.y*h};h*=t.zoom(),m.translate(v.x,v.y),m.scale(h,h),this.drawElements(m,g),m.scale(1/h,1/h),m.translate(-v.x,-v.y)}e.bg&&(m.globalCompositeOperation="destination-over",m.fillStyle=e.bg,m.rect(0,0,a,s),m.fill())}return p};o(Not,"b64ToBlob");o(W0e,"b64UriToB64");o(_ge,"output");f2.png=function(e){return _ge(e,this.bufferCanvasImage(e),"image/png")};f2.jpg=function(e){return _ge(e,this.bufferCanvasImage(e),"image/jpeg")};Dge={};Dge.nodeShapeImpl=function(e,t,r,i,n,a,s,l){switch(e){case"ellipse":return this.drawEllipsePath(t,r,i,n,a);case"polygon":return this.drawPolygonPath(t,r,i,n,a,s);case"round-polygon":return this.drawRoundPolygonPath(t,r,i,n,a,s,l);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,r,i,n,a,l);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,r,i,n,a,s,l);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,r,i,n,a,l);case"barrel":return this.drawBarrelPath(t,r,i,n,a)}};Iot=Rge,Fr=Rge.prototype;Fr.CANVAS_LAYERS=3;Fr.SELECT_BOX=0;Fr.DRAG=1;Fr.NODE=2;Fr.WEBGL=3;Fr.CANVAS_TYPES=["2d","2d","2d","webgl2"];Fr.BUFFER_COUNT=3;Fr.TEXTURE_BUFFER=0;Fr.MOTIONBLUR_BUFFER_NODE=1;Fr.MOTIONBLUR_BUFFER_DRAG=2;o(Rge,"CanvasRenderer");Fr.redrawHint=function(e,t){var r=this;switch(e){case"eles":r.data.canvasNeedsRedraw[Fr.NODE]=t;break;case"drag":r.data.canvasNeedsRedraw[Fr.DRAG]=t;break;case"select":r.data.canvasNeedsRedraw[Fr.SELECT_BOX]=t;break;case"gc":r.data.gc=!0;break}};Oot=typeof Path2D<"u";Fr.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e};Fr.usePaths=function(){return Oot&&this.pathsEnabled};Fr.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)};Fr.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled};Fr.makeOffscreenCanvas=function(e,t){var r;if((typeof OffscreenCanvas>"u"?"undefined":Wn(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(e,t);else{var i=this.cy.window(),n=i.document;r=n.createElement("canvas"),r.width=e,r.height=t}return r};[vge,zc,eh,NP,a0,Jd,ns,kge,ef,f2,Dge].forEach(function(e){hr(Fr,e)});Pot=[{name:"null",impl:nge},{name:"base",impl:pge},{name:"canvas",impl:Iot}],Bot=[{type:"layout",extensions:lst},{type:"renderer",extensions:Pot}],Lge={},Mge={};o(Nge,"setExtension");o(Ige,"getExtension");o(Fot,"setModule");o($ot,"getModule");cP=o(function(){if(arguments.length===2)return Ige.apply(null,arguments);if(arguments.length===3)return Nge.apply(null,arguments);if(arguments.length===4)return $ot.apply(null,arguments);if(arguments.length===5)return Fot.apply(null,arguments);Yi("Invalid extension access syntax")},"extension");e2.prototype.extension=cP;Bot.forEach(function(e){e.extensions.forEach(function(t){Nge(e.type,t.name,t.impl)})});H3=o(function(){if(!(this instanceof H3))return new H3;this.length=0},"Stylesheet"),i0=H3.prototype;i0.instanceString=function(){return"stylesheet"};i0.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this};i0.css=function(e,t){var r=this.length-1;if(sr(e))this[r].properties.push({name:e,value:t});else if(Xr(e))for(var i=e,n=Object.keys(i),a=0;a{"use strict";o((function(t,r){typeof p2=="object"&&typeof PP=="object"?PP.exports=r():typeof define=="function"&&define.amd?define([],r):typeof p2=="object"?p2.layoutBase=r():t.layoutBase=r()}),"webpackUniversalModuleDefinition")(p2,function(){return(function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return o(r,"__webpack_require__"),r.m=e,r.c=t,r.i=function(i){return i},r.d=function(i,n,a){r.o(i,n)||Object.defineProperty(i,n,{configurable:!1,enumerable:!0,get:a})},r.n=function(i){var n=i&&i.__esModule?o(function(){return i.default},"getDefault"):o(function(){return i},"getModuleExports");return r.d(n,"a",n),n},r.o=function(i,n){return Object.prototype.hasOwnProperty.call(i,n)},r.p="",r(r.s=26)})([(function(e,t,r){"use strict";function i(){}o(i,"LayoutConstants"),i.QUALITY=1,i.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,i.DEFAULT_INCREMENTAL=!1,i.DEFAULT_ANIMATION_ON_LAYOUT=!0,i.DEFAULT_ANIMATION_DURING_LAYOUT=!1,i.DEFAULT_ANIMATION_PERIOD=50,i.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,i.DEFAULT_GRAPH_MARGIN=15,i.NODE_DIMENSIONS_INCLUDE_LABELS=!1,i.SIMPLE_NODE_SIZE=40,i.SIMPLE_NODE_HALF_SIZE=i.SIMPLE_NODE_SIZE/2,i.EMPTY_COMPOUND_NODE_SIZE=40,i.MIN_EDGE_LENGTH=1,i.WORLD_BOUNDARY=1e6,i.INITIAL_WORLD_BOUNDARY=i.WORLD_BOUNDARY/1e3,i.WORLD_CENTER_X=1200,i.WORLD_CENTER_Y=900,e.exports=i}),(function(e,t,r){"use strict";var i=r(2),n=r(8),a=r(9);function s(u,h,d){i.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=u,this.target=h}o(s,"LEdge"),s.prototype=Object.create(i.prototype);for(var l in i)s[l]=i[l];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(u){if(this.source===u)return this.target;if(this.target===u)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(u,h){for(var d=this.getOtherEnd(u),f=h.getGraphManager().getRoot();;){if(d.getOwner()==h)return d;if(d.getOwner()==f)break;d=d.getOwner().getParent()}return null},s.prototype.updateLength=function(){var u=new Array(4);this.isOverlapingSourceAndTarget=n.getIntersection(this.target.getRect(),this.source.getRect(),u),this.isOverlapingSourceAndTarget||(this.lengthX=u[0]-u[2],this.lengthY=u[1]-u[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=s}),(function(e,t,r){"use strict";function i(n){this.vGraphObject=n}o(i,"LGraphObject"),e.exports=i}),(function(e,t,r){"use strict";var i=r(2),n=r(10),a=r(13),s=r(0),l=r(16),u=r(4);function h(f,p,m,g){m==null&&g==null&&(g=p),i.call(this,g),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=n.MIN_VALUE,this.inclusionTreeDepth=n.MAX_VALUE,this.vGraphObject=g,this.edges=[],this.graphManager=f,m!=null&&p!=null?this.rect=new a(p.x,p.y,m.width,m.height):this.rect=new a}o(h,"LNode"),h.prototype=Object.create(i.prototype);for(var d in i)h[d]=i[d];h.prototype.getEdges=function(){return this.edges},h.prototype.getChild=function(){return this.child},h.prototype.getOwner=function(){return this.owner},h.prototype.getWidth=function(){return this.rect.width},h.prototype.setWidth=function(f){this.rect.width=f},h.prototype.getHeight=function(){return this.rect.height},h.prototype.setHeight=function(f){this.rect.height=f},h.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},h.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},h.prototype.getCenter=function(){return new u(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},h.prototype.getLocation=function(){return new u(this.rect.x,this.rect.y)},h.prototype.getRect=function(){return this.rect},h.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},h.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},h.prototype.setRect=function(f,p){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=p.width,this.rect.height=p.height},h.prototype.setCenter=function(f,p){this.rect.x=f-this.rect.width/2,this.rect.y=p-this.rect.height/2},h.prototype.setLocation=function(f,p){this.rect.x=f,this.rect.y=p},h.prototype.moveBy=function(f,p){this.rect.x+=f,this.rect.y+=p},h.prototype.getEdgeListToNode=function(f){var p=[],m,g=this;return g.edges.forEach(function(y){if(y.target==f){if(y.source!=g)throw"Incorrect edge source!";p.push(y)}}),p},h.prototype.getEdgesBetween=function(f){var p=[],m,g=this;return g.edges.forEach(function(y){if(!(y.source==g||y.target==g))throw"Incorrect edge source and/or target";(y.target==f||y.source==f)&&p.push(y)}),p},h.prototype.getNeighborsList=function(){var f=new Set,p=this;return p.edges.forEach(function(m){if(m.source==p)f.add(m.target);else{if(m.target!=p)throw"Incorrect incidency!";f.add(m.source)}}),f},h.prototype.withChildren=function(){var f=new Set,p,m;if(f.add(this),this.child!=null)for(var g=this.child.getNodes(),y=0;yp&&(this.rect.x-=(this.labelWidth-p)/2,this.setWidth(this.labelWidth)),this.labelHeight>m&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-m)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-m),this.setHeight(this.labelHeight))}}},h.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==n.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},h.prototype.transform=function(f){var p=this.rect.x;p>s.WORLD_BOUNDARY?p=s.WORLD_BOUNDARY:p<-s.WORLD_BOUNDARY&&(p=-s.WORLD_BOUNDARY);var m=this.rect.y;m>s.WORLD_BOUNDARY?m=s.WORLD_BOUNDARY:m<-s.WORLD_BOUNDARY&&(m=-s.WORLD_BOUNDARY);var g=new u(p,m),y=f.inverseTransformPoint(g);this.setLocation(y.x,y.y)},h.prototype.getLeft=function(){return this.rect.x},h.prototype.getRight=function(){return this.rect.x+this.rect.width},h.prototype.getTop=function(){return this.rect.y},h.prototype.getBottom=function(){return this.rect.y+this.rect.height},h.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},e.exports=h}),(function(e,t,r){"use strict";function i(n,a){n==null&&a==null?(this.x=0,this.y=0):(this.x=n,this.y=a)}o(i,"PointD"),i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.setX=function(n){this.x=n},i.prototype.setY=function(n){this.y=n},i.prototype.getDifference=function(n){return new DimensionD(this.x-n.x,this.y-n.y)},i.prototype.getCopy=function(){return new i(this.x,this.y)},i.prototype.translate=function(n){return this.x+=n.width,this.y+=n.height,this},e.exports=i}),(function(e,t,r){"use strict";var i=r(2),n=r(10),a=r(0),s=r(6),l=r(3),u=r(1),h=r(13),d=r(12),f=r(11);function p(g,y,v){i.call(this,v),this.estimatedSize=n.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=g,y!=null&&y instanceof s?this.graphManager=y:y!=null&&y instanceof Layout&&(this.graphManager=y.graphManager)}o(p,"LGraph"),p.prototype=Object.create(i.prototype);for(var m in i)p[m]=i[m];p.prototype.getNodes=function(){return this.nodes},p.prototype.getEdges=function(){return this.edges},p.prototype.getGraphManager=function(){return this.graphManager},p.prototype.getParent=function(){return this.parent},p.prototype.getLeft=function(){return this.left},p.prototype.getRight=function(){return this.right},p.prototype.getTop=function(){return this.top},p.prototype.getBottom=function(){return this.bottom},p.prototype.isConnected=function(){return this.isConnected},p.prototype.add=function(g,y,v){if(y==null&&v==null){var x=g;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(x)>-1)throw"Node already in graph!";return x.owner=this,this.getNodes().push(x),x}else{var b=g;if(!(this.getNodes().indexOf(y)>-1&&this.getNodes().indexOf(v)>-1))throw"Source or target not in graph!";if(!(y.owner==v.owner&&y.owner==this))throw"Both owners must be this graph!";return y.owner!=v.owner?null:(b.source=y,b.target=v,b.isInterGraph=!1,this.getEdges().push(b),y.edges.push(b),v!=y&&v.edges.push(b),b)}},p.prototype.remove=function(g){var y=g;if(g instanceof l){if(y==null)throw"Node is null!";if(!(y.owner!=null&&y.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var v=y.edges.slice(),x,b=v.length,T=0;T-1&&k>-1))throw"Source and/or target doesn't know this edge!";x.source.edges.splice(C,1),x.target!=x.source&&x.target.edges.splice(k,1);var w=x.source.owner.getEdges().indexOf(x);if(w==-1)throw"Not in owner's edge list!";x.source.owner.getEdges().splice(w,1)}},p.prototype.updateLeftTop=function(){for(var g=n.MAX_VALUE,y=n.MAX_VALUE,v,x,b,T=this.getNodes(),w=T.length,C=0;Cv&&(g=v),y>x&&(y=x)}return g==n.MAX_VALUE?null:(T[0].getParent().paddingLeft!=null?b=T[0].getParent().paddingLeft:b=this.margin,this.left=y-b,this.top=g-b,new d(this.left,this.top))},p.prototype.updateBounds=function(g){for(var y=n.MAX_VALUE,v=-n.MAX_VALUE,x=n.MAX_VALUE,b=-n.MAX_VALUE,T,w,C,k,E,A=this.nodes,N=A.length,P=0;PT&&(y=T),vC&&(x=C),bT&&(y=T),vC&&(x=C),b=this.nodes.length){var N=0;v.forEach(function(P){P.owner==g&&N++}),N==this.nodes.length&&(this.isConnected=!0)}},e.exports=p}),(function(e,t,r){"use strict";var i,n=r(1);function a(s){i=r(5),this.layout=s,this.graphs=[],this.edges=[]}o(a,"LGraphManager"),a.prototype.addRoot=function(){var s=this.layout.newGraph(),l=this.layout.newNode(null),u=this.add(s,l);return this.setRootGraph(u),this.rootGraph},a.prototype.add=function(s,l,u,h,d){if(u==null&&h==null&&d==null){if(s==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return s.parent=l,l.child=s,s}else{d=u,h=l,u=s;var f=h.getOwner(),p=d.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(p!=null&&p.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==p)return u.isInterGraph=!1,f.add(u,h,d);if(u.isInterGraph=!0,u.source=h,u.target=d,this.edges.indexOf(u)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(u),!(u.source!=null&&u.target!=null))throw"Edge source and/or target is null!";if(!(u.source.edges.indexOf(u)==-1&&u.target.edges.indexOf(u)==-1))throw"Edge already in source and/or target incidency list!";return u.source.edges.push(u),u.target.edges.push(u),u}},a.prototype.remove=function(s){if(s instanceof i){var l=s;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var u=[];u=u.concat(l.getEdges());for(var h,d=u.length,f=0;f=s.getRight()?l[0]+=Math.min(s.getX()-a.getX(),a.getRight()-s.getRight()):s.getX()<=a.getX()&&s.getRight()>=a.getRight()&&(l[0]+=Math.min(a.getX()-s.getX(),s.getRight()-a.getRight())),a.getY()<=s.getY()&&a.getBottom()>=s.getBottom()?l[1]+=Math.min(s.getY()-a.getY(),a.getBottom()-s.getBottom()):s.getY()<=a.getY()&&s.getBottom()>=a.getBottom()&&(l[1]+=Math.min(a.getY()-s.getY(),s.getBottom()-a.getBottom()));var d=Math.abs((s.getCenterY()-a.getCenterY())/(s.getCenterX()-a.getCenterX()));s.getCenterY()===a.getCenterY()&&s.getCenterX()===a.getCenterX()&&(d=1);var f=d*l[0],p=l[1]/d;l[0]f)return l[0]=u,l[1]=m,l[2]=d,l[3]=A,!1;if(hd)return l[0]=p,l[1]=h,l[2]=k,l[3]=f,!1;if(ud?(l[0]=y,l[1]=v,D=!0):(l[0]=g,l[1]=m,D=!0):R===L&&(u>d?(l[0]=p,l[1]=m,D=!0):(l[0]=x,l[1]=v,D=!0)),-M===L?d>u?(l[2]=E,l[3]=A,_=!0):(l[2]=k,l[3]=C,_=!0):M===L&&(d>u?(l[2]=w,l[3]=C,_=!0):(l[2]=N,l[3]=A,_=!0)),D&&_)return!1;if(u>d?h>f?(B=this.getCardinalDirection(R,L,4),O=this.getCardinalDirection(M,L,2)):(B=this.getCardinalDirection(-R,L,3),O=this.getCardinalDirection(-M,L,1)):h>f?(B=this.getCardinalDirection(-R,L,1),O=this.getCardinalDirection(-M,L,3)):(B=this.getCardinalDirection(R,L,2),O=this.getCardinalDirection(M,L,4)),!D)switch(B){case 1:G=m,$=u+-T/L,l[0]=$,l[1]=G;break;case 2:$=x,G=h+b*L,l[0]=$,l[1]=G;break;case 3:G=v,$=u+T/L,l[0]=$,l[1]=G;break;case 4:$=y,G=h+-b*L,l[0]=$,l[1]=G;break}if(!_)switch(O){case 1:V=C,F=d+-I/L,l[2]=F,l[3]=V;break;case 2:F=N,V=f+P*L,l[2]=F,l[3]=V;break;case 3:V=A,F=d+I/L,l[2]=F,l[3]=V;break;case 4:F=E,V=f+-P*L,l[2]=F,l[3]=V;break}}return!1},n.getCardinalDirection=function(a,s,l){return a>s?l:1+l%4},n.getIntersection=function(a,s,l,u){if(u==null)return this.getIntersection2(a,s,l);var h=a.x,d=a.y,f=s.x,p=s.y,m=l.x,g=l.y,y=u.x,v=u.y,x=void 0,b=void 0,T=void 0,w=void 0,C=void 0,k=void 0,E=void 0,A=void 0,N=void 0;return T=p-d,C=h-f,E=f*d-h*p,w=v-g,k=m-y,A=y*g-m*v,N=T*k-w*C,N===0?null:(x=(C*A-k*E)/N,b=(w*E-T*A)/N,new i(x,b))},n.angleOfVector=function(a,s,l,u){var h=void 0;return a!==l?(h=Math.atan((u-s)/(l-a)),l0?1:n<0?-1:0},i.floor=function(n){return n<0?Math.ceil(n):Math.floor(n)},i.ceil=function(n){return n<0?Math.floor(n):Math.ceil(n)},e.exports=i}),(function(e,t,r){"use strict";function i(){}o(i,"Integer"),i.MAX_VALUE=2147483647,i.MIN_VALUE=-2147483648,e.exports=i}),(function(e,t,r){"use strict";var i=(function(){function h(d,f){for(var p=0;p"u"?"undefined":i(a);return a==null||s!="object"&&s!="function"},e.exports=n}),(function(e,t,r){"use strict";function i(m){if(Array.isArray(m)){for(var g=0,y=Array(m.length);g0&&g;){for(T.push(C[0]);T.length>0&&g;){var k=T[0];T.splice(0,1),b.add(k);for(var E=k.getEdges(),x=0;x-1&&C.splice(I,1)}b=new Set,w=new Map}}return m},p.prototype.createDummyNodesForBendpoints=function(m){for(var g=[],y=m.source,v=this.graphManager.calcLowestCommonAncestor(m.source,m.target),x=0;x0){for(var v=this.edgeToDummyNodes.get(y),x=0;x=0&&g.splice(A,1);var N=w.getNeighborsList();N.forEach(function(D){if(y.indexOf(D)<0){var _=v.get(D),R=_-1;R==1&&k.push(D),v.set(D,R)}})}y=y.concat(k),(g.length==1||g.length==2)&&(x=!0,b=g[0])}return b},p.prototype.setGraphManager=function(m){this.graphManager=m},e.exports=p}),(function(e,t,r){"use strict";function i(){}o(i,"RandomSeed"),i.seed=1,i.x=0,i.nextDouble=function(){return i.x=Math.sin(i.seed++)*1e4,i.x-Math.floor(i.x)},e.exports=i}),(function(e,t,r){"use strict";var i=r(4);function n(a,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o(n,"Transform"),n.prototype.getWorldOrgX=function(){return this.lworldOrgX},n.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},n.prototype.getWorldOrgY=function(){return this.lworldOrgY},n.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},n.prototype.getWorldExtX=function(){return this.lworldExtX},n.prototype.setWorldExtX=function(a){this.lworldExtX=a},n.prototype.getWorldExtY=function(){return this.lworldExtY},n.prototype.setWorldExtY=function(a){this.lworldExtY=a},n.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},n.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},n.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},n.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},n.prototype.getDeviceExtX=function(){return this.ldeviceExtX},n.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},n.prototype.getDeviceExtY=function(){return this.ldeviceExtY},n.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},n.prototype.transformX=function(a){var s=0,l=this.lworldExtX;return l!=0&&(s=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/l),s},n.prototype.transformY=function(a){var s=0,l=this.lworldExtY;return l!=0&&(s=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/l),s},n.prototype.inverseTransformX=function(a){var s=0,l=this.ldeviceExtX;return l!=0&&(s=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/l),s},n.prototype.inverseTransformY=function(a){var s=0,l=this.ldeviceExtY;return l!=0&&(s=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/l),s},n.prototype.inverseTransformPoint=function(a){var s=new i(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return s},e.exports=n}),(function(e,t,r){"use strict";function i(f){if(Array.isArray(f)){for(var p=0,m=Array(f.length);pa.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(f>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),p,m=0;m0&&arguments[0]!==void 0?arguments[0]:!0,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,m,g,y,v,x=this.getAllNodes(),b;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),b=new Set,m=0;mT||b>T)&&(f.gravitationForceX=-this.gravityConstant*y,f.gravitationForceY=-this.gravityConstant*v)):(T=p.getEstimatedSize()*this.compoundGravityRangeFactor,(x>T||b>T)&&(f.gravitationForceX=-this.gravityConstant*y*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*v*this.compoundGravityConstant))},h.prototype.isConverged=function(){var f,p=!1;return this.totalIterations>this.maxIterations/3&&(p=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement=x.length||T>=x[0].length)){for(var w=0;wh},"_defaultCompareFunction")}]),l})();e.exports=s}),(function(e,t,r){"use strict";var i=(function(){function s(l,u){for(var h=0;h2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;n(this,s),this.sequence1=l,this.sequence2=u,this.match_score=h,this.mismatch_penalty=d,this.gap_penalty=f,this.iMax=l.length+1,this.jMax=u.length+1,this.grid=new Array(this.iMax);for(var p=0;p=0;l--){var u=this.listeners[l];u.event===a&&u.callback===s&&this.listeners.splice(l,1)}},n.emit=function(a,s){for(var l=0;l{"use strict";o((function(t,r){typeof m2=="object"&&typeof FP=="object"?FP.exports=r(BP()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof m2=="object"?m2.coseBase=r(BP()):t.coseBase=r(t.layoutBase)}),"webpackUniversalModuleDefinition")(m2,function(e){return(function(t){var r={};function i(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return o(i,"__webpack_require__"),i.m=t,i.c=r,i.i=function(n){return n},i.d=function(n,a,s){i.o(n,a)||Object.defineProperty(n,a,{configurable:!1,enumerable:!0,get:s})},i.n=function(n){var a=n&&n.__esModule?o(function(){return n.default},"getDefault"):o(function(){return n},"getModuleExports");return i.d(a,"a",a),a},i.o=function(n,a){return Object.prototype.hasOwnProperty.call(n,a)},i.p="",i(i.s=7)})([(function(t,r){t.exports=e}),(function(t,r,i){"use strict";var n=i(0).FDLayoutConstants;function a(){}o(a,"CoSEConstants");for(var s in n)a[s]=n[s];a.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,a.DEFAULT_RADIAL_SEPARATION=n.DEFAULT_EDGE_LENGTH,a.DEFAULT_COMPONENT_SEPERATION=60,a.TILE=!0,a.TILING_PADDING_VERTICAL=10,a.TILING_PADDING_HORIZONTAL=10,a.TREE_REDUCTION_ON_INCREMENTAL=!1,t.exports=a}),(function(t,r,i){"use strict";var n=i(0).FDLayoutEdge;function a(l,u,h){n.call(this,l,u,h)}o(a,"CoSEEdge"),a.prototype=Object.create(n.prototype);for(var s in n)a[s]=n[s];t.exports=a}),(function(t,r,i){"use strict";var n=i(0).LGraph;function a(l,u,h){n.call(this,l,u,h)}o(a,"CoSEGraph"),a.prototype=Object.create(n.prototype);for(var s in n)a[s]=n[s];t.exports=a}),(function(t,r,i){"use strict";var n=i(0).LGraphManager;function a(l){n.call(this,l)}o(a,"CoSEGraphManager"),a.prototype=Object.create(n.prototype);for(var s in n)a[s]=n[s];t.exports=a}),(function(t,r,i){"use strict";var n=i(0).FDLayoutNode,a=i(0).IMath;function s(u,h,d,f){n.call(this,u,h,d,f)}o(s,"CoSENode"),s.prototype=Object.create(n.prototype);for(var l in n)s[l]=n[l];s.prototype.move=function(){var u=this.graphManager.getLayout();this.displacementX=u.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=u.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>u.coolingFactor*u.maxNodeDisplacement&&(this.displacementX=u.coolingFactor*u.maxNodeDisplacement*a.sign(this.displacementX)),Math.abs(this.displacementY)>u.coolingFactor*u.maxNodeDisplacement&&(this.displacementY=u.coolingFactor*u.maxNodeDisplacement*a.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),u.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},s.prototype.propogateDisplacementToChildren=function(u,h){for(var d=this.getChild().getNodes(),f,p=0;p0)this.positionNodesRadially(C);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var k=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(A){return k.has(A)});this.graphManager.setAllNodesToApplyGravitation(E),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},T.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var C=new Set(this.getAllNodes()),k=this.nodesWithGravity.filter(function(N){return C.has(N)});this.graphManager.setAllNodesToApplyGravitation(k),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var E=!this.isTreeGrowing&&!this.isGrowthFinished,A=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(E,A),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},T.prototype.getPositionsData=function(){for(var C=this.graphManager.getAllNodes(),k={},E=0;E1){var D;for(D=0;DA&&(A=Math.floor(I.y)),P=Math.floor(I.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new m(f.WORLD_CENTER_X-I.x/2,f.WORLD_CENTER_Y-I.y/2))},T.radialLayout=function(C,k,E){var A=Math.max(this.maxDiagonalInTree(C),h.DEFAULT_RADIAL_SEPARATION);T.branchRadialLayout(k,null,0,359,0,A);var N=x.calculateBounds(C),P=new b;P.setDeviceOrgX(N.getMinX()),P.setDeviceOrgY(N.getMinY()),P.setWorldOrgX(E.x),P.setWorldOrgY(E.y);for(var I=0;I1;){var H=V[0];V.splice(0,1);var j=B.indexOf(H);j>=0&&B.splice(j,1),G--,O--}k!=null?F=(B.indexOf(V[0])+1)%G:F=0;for(var U=Math.abs(A-E)/O,Q=F;$!=O;Q=++Q%G){var Y=B[Q].getOtherEnd(C);if(Y!=k){var ae=(E+$*U)%360,J=(ae+U)%360;T.branchRadialLayout(Y,C,ae,J,N+P,P),$++}}},T.maxDiagonalInTree=function(C){for(var k=y.MIN_VALUE,E=0;Ek&&(k=N)}return k},T.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},T.prototype.groupZeroDegreeMembers=function(){var C=this,k={};this.memberGroups={},this.idToDummyNode={};for(var E=[],A=this.graphManager.getAllNodes(),N=0;N"u"&&(k[D]=[]),k[D]=k[D].concat(P)}Object.keys(k).forEach(function(_){if(k[_].length>1){var R="DummyCompound_"+_;C.memberGroups[R]=k[_];var M=k[_][0].getParent(),L=new l(C.graphManager);L.id=R,L.paddingLeft=M.paddingLeft||0,L.paddingRight=M.paddingRight||0,L.paddingBottom=M.paddingBottom||0,L.paddingTop=M.paddingTop||0,C.idToDummyNode[R]=L;var B=C.getGraphManager().add(C.newGraph(),L),O=M.getChild();O.add(L);for(var $=0;$=0;C--){var k=this.compoundOrder[C],E=k.id,A=k.paddingLeft,N=k.paddingTop;this.adjustLocations(this.tiledMemberPack[E],k.rect.x,k.rect.y,A,N)}},T.prototype.repopulateZeroDegreeMembers=function(){var C=this,k=this.tiledZeroDegreePack;Object.keys(k).forEach(function(E){var A=C.idToDummyNode[E],N=A.paddingLeft,P=A.paddingTop;C.adjustLocations(k[E],A.rect.x,A.rect.y,N,P)})},T.prototype.getToBeTiled=function(C){var k=C.id;if(this.toBeTiled[k]!=null)return this.toBeTiled[k];var E=C.getChild();if(E==null)return this.toBeTiled[k]=!1,!1;for(var A=E.getNodes(),N=0;N0)return this.toBeTiled[k]=!1,!1;if(P.getChild()==null){this.toBeTiled[P.id]=!1;continue}if(!this.getToBeTiled(P))return this.toBeTiled[k]=!1,!1}return this.toBeTiled[k]=!0,!0},T.prototype.getNodeDegree=function(C){for(var k=C.id,E=C.getEdges(),A=0,N=0;N_&&(_=M.rect.height)}E+=_+C.verticalPadding}},T.prototype.tileCompoundMembers=function(C,k){var E=this;this.tiledMemberPack=[],Object.keys(C).forEach(function(A){var N=k[A];E.tiledMemberPack[A]=E.tileNodes(C[A],N.paddingLeft+N.paddingRight),N.rect.width=E.tiledMemberPack[A].width,N.rect.height=E.tiledMemberPack[A].height})},T.prototype.tileNodes=function(C,k){var E=h.TILING_PADDING_VERTICAL,A=h.TILING_PADDING_HORIZONTAL,N={rows:[],rowWidth:[],rowHeight:[],width:0,height:k,verticalPadding:E,horizontalPadding:A};C.sort(function(D,_){return D.rect.width*D.rect.height>_.rect.width*_.rect.height?-1:D.rect.width*D.rect.height<_.rect.width*_.rect.height?1:0});for(var P=0;P0&&(I+=C.horizontalPadding),C.rowWidth[E]=I,C.width0&&(D+=C.verticalPadding);var _=0;D>C.rowHeight[E]&&(_=C.rowHeight[E],C.rowHeight[E]=D,_=C.rowHeight[E]-_),C.height+=_,C.rows[E].push(k)},T.prototype.getShortestRowIndex=function(C){for(var k=-1,E=Number.MAX_VALUE,A=0;AE&&(k=A,E=C.rowWidth[A]);return k},T.prototype.canAddHorizontal=function(C,k,E){var A=this.getShortestRowIndex(C);if(A<0)return!0;var N=C.rowWidth[A];if(N+C.horizontalPadding+k<=C.width)return!0;var P=0;C.rowHeight[A]0&&(P=E+C.verticalPadding-C.rowHeight[A]);var I;C.width-N>=k+C.horizontalPadding?I=(C.height+P)/(N+k+C.horizontalPadding):I=(C.height+P)/C.width,P=E+C.verticalPadding;var D;return C.widthP&&k!=E){A.splice(-1,1),C.rows[E].push(N),C.rowWidth[k]=C.rowWidth[k]-P,C.rowWidth[E]=C.rowWidth[E]+P,C.width=C.rowWidth[instance.getLongestRowIndex(C)];for(var I=Number.MIN_VALUE,D=0;DI&&(I=A[D].height);k>0&&(I+=C.verticalPadding);var _=C.rowHeight[k]+C.rowHeight[E];C.rowHeight[k]=I,C.rowHeight[E]0)for(var O=N;O<=P;O++)B[0]+=this.grid[O][I-1].length+this.grid[O][I].length-1;if(P0)for(var O=I;O<=D;O++)B[3]+=this.grid[N-1][O].length+this.grid[N][O].length-1;for(var $=y.MAX_VALUE,G,F,V=0;V{"use strict";o((function(t,r){typeof g2=="object"&&typeof zP=="object"?zP.exports=r($P()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof g2=="object"?g2.cytoscapeCoseBilkent=r($P()):t.cytoscapeCoseBilkent=r(t.coseBase)}),"webpackUniversalModuleDefinition")(g2,function(e){return(function(t){var r={};function i(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return o(i,"__webpack_require__"),i.m=t,i.c=r,i.i=function(n){return n},i.d=function(n,a,s){i.o(n,a)||Object.defineProperty(n,a,{configurable:!1,enumerable:!0,get:s})},i.n=function(n){var a=n&&n.__esModule?o(function(){return n.default},"getDefault"):o(function(){return n},"getModuleExports");return i.d(a,"a",a),a},i.o=function(n,a){return Object.prototype.hasOwnProperty.call(n,a)},i.p="",i(i.s=1)})([(function(t,r){t.exports=e}),(function(t,r,i){"use strict";var n=i(0).layoutBase.LayoutConstants,a=i(0).layoutBase.FDLayoutConstants,s=i(0).CoSEConstants,l=i(0).CoSELayout,u=i(0).CoSENode,h=i(0).layoutBase.PointD,d=i(0).layoutBase.DimensionD,f={ready:o(function(){},"ready"),stop:o(function(){},"stop"),quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function p(v,x){var b={};for(var T in v)b[T]=v[T];for(var T in x)b[T]=x[T];return b}o(p,"extend");function m(v){this.options=p(f,v),g(this.options)}o(m,"_CoSELayout");var g=o(function(x){x.nodeRepulsion!=null&&(s.DEFAULT_REPULSION_STRENGTH=a.DEFAULT_REPULSION_STRENGTH=x.nodeRepulsion),x.idealEdgeLength!=null&&(s.DEFAULT_EDGE_LENGTH=a.DEFAULT_EDGE_LENGTH=x.idealEdgeLength),x.edgeElasticity!=null&&(s.DEFAULT_SPRING_STRENGTH=a.DEFAULT_SPRING_STRENGTH=x.edgeElasticity),x.nestingFactor!=null&&(s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=x.nestingFactor),x.gravity!=null&&(s.DEFAULT_GRAVITY_STRENGTH=a.DEFAULT_GRAVITY_STRENGTH=x.gravity),x.numIter!=null&&(s.MAX_ITERATIONS=a.MAX_ITERATIONS=x.numIter),x.gravityRange!=null&&(s.DEFAULT_GRAVITY_RANGE_FACTOR=a.DEFAULT_GRAVITY_RANGE_FACTOR=x.gravityRange),x.gravityCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=x.gravityCompound),x.gravityRangeCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=x.gravityRangeCompound),x.initialEnergyOnIncremental!=null&&(s.DEFAULT_COOLING_FACTOR_INCREMENTAL=a.DEFAULT_COOLING_FACTOR_INCREMENTAL=x.initialEnergyOnIncremental),x.quality=="draft"?n.QUALITY=0:x.quality=="proof"?n.QUALITY=2:n.QUALITY=1,s.NODE_DIMENSIONS_INCLUDE_LABELS=a.NODE_DIMENSIONS_INCLUDE_LABELS=n.NODE_DIMENSIONS_INCLUDE_LABELS=x.nodeDimensionsIncludeLabels,s.DEFAULT_INCREMENTAL=a.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=!x.randomize,s.ANIMATE=a.ANIMATE=n.ANIMATE=x.animate,s.TILE=x.tile,s.TILING_PADDING_VERTICAL=typeof x.tilingPaddingVertical=="function"?x.tilingPaddingVertical.call():x.tilingPaddingVertical,s.TILING_PADDING_HORIZONTAL=typeof x.tilingPaddingHorizontal=="function"?x.tilingPaddingHorizontal.call():x.tilingPaddingHorizontal},"getUserOptions");m.prototype.run=function(){var v,x,b=this.options,T=this.idToLNode={},w=this.layout=new l,C=this;C.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var k=w.newGraphManager();this.gm=k;var E=this.options.eles.nodes(),A=this.options.eles.edges();this.root=k.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(E),w);for(var N=0;N0){var D;D=b.getGraphManager().add(b.newGraph(),E),this.processChildrenList(D,k,b)}}},m.prototype.stop=function(){return this.stopped=!0,this};var y=o(function(x){x("layout","cose-bilkent",m)},"register");typeof cytoscape<"u"&&y(cytoscape),t.exports=y})])})});function Got(e,t){e.forEach(r=>{let i={id:r.id,labelText:r.label,height:r.height,width:r.width,padding:r.padding??0};Object.keys(r).forEach(n=>{["id","label","height","width","padding","x","y"].includes(n)||(i[n]=r[n])}),t.add({group:"nodes",data:i,position:{x:r.x??0,y:r.y??0}})})}function Vot(e,t){e.forEach(r=>{let i={id:r.id,source:r.start,target:r.end};Object.keys(r).forEach(n=>{["id","start","end"].includes(n)||(i[n]=r[n])}),t.add({group:"edges",data:i})})}function Bge(e){return new Promise(t=>{let r=Je("body").append("div").attr("id","cy").attr("style","display:none"),i=Ko({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});r.remove(),Got(e.nodes,i),Vot(e.edges,i),i.nodes().forEach(function(a){a.layoutDimensions=()=>{let s=a.data();return{w:s.width,h:s.height}}});let n={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};i.layout(n).run(),i.ready(a=>{Z.info("Cytoscape ready",a),t(i)})})}function Fge(e){return e.nodes().map(t=>{let r=t.data(),i=t.position(),n={id:r.id,x:i.x,y:i.y};return Object.keys(r).forEach(a=>{a!=="id"&&(n[a]=r[a])}),n})}function $ge(e){return e.edges().map(t=>{let r=t.data(),i=t._private.rscratch,n={id:r.id,source:r.source,target:r.target,startX:i.startX,startY:i.startY,midX:i.midX,midY:i.midY,endX:i.endX,endY:i.endY};return Object.keys(r).forEach(a=>{["id","source","target"].includes(a)||(n[a]=r[a])}),n})}var Pge,zge=z(()=>{"use strict";OP();Pge=ys(Oge(),1);Rr();St();Ko.use(Pge.default);o(Got,"addNodes");o(Vot,"addEdges");o(Bge,"createCytoscapeInstance");o(Fge,"extractPositionedNodes");o($ge,"extractPositionedEdges")});async function Gge(e,t){Z.debug("Starting cose-bilkent layout algorithm");try{Wot(e);let r=await Bge(e),i=Fge(r),n=$ge(r);return Z.debug(`Layout completed: ${i.length} nodes, ${n.length} edges`),{nodes:i,edges:n}}catch(r){throw Z.error("Error in cose-bilkent layout algorithm:",r),r}}function Wot(e){if(!e)throw new Error("Layout data is required");if(!e.config)throw new Error("Configuration is required in layout data");if(!e.rootNode)throw new Error("Root node is required");if(!e.nodes||!Array.isArray(e.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(e.edges))throw new Error("Edges array is required in layout data");return!0}var Vge=z(()=>{"use strict";St();zge();o(Gge,"executeCoseBilkentLayout");o(Wot,"validateLayoutData")});var Wge,qge=z(()=>{"use strict";Vge();Wge=o(async(e,t,{insertCluster:r,insertEdge:i,insertEdgeLabel:n,insertMarkers:a,insertNode:s,log:l,positionEdgeLabel:u},{algorithm:h})=>{let d={},f={},p=t.select("g");a(p,e.markers,e.type,e.diagramId);let m=p.insert("g").attr("class","subgraphs"),g=p.insert("g").attr("class","edgePaths"),y=p.insert("g").attr("class","edgeLabels"),v=p.insert("g").attr("class","nodes");l.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(e.nodes.map(async T=>{if(T.isGroup){let w={...T};f[T.id]=w,d[T.id]=w,await r(m,T)}else{let w={...T};d[T.id]=w;let C=await s(v,T,{config:e.config,dir:e.direction||"TB"}),k=C.node().getBBox();w.width=k.width,w.height=k.height,w.domId=C,l.debug(`Node ${T.id} dimensions: ${k.width}x${k.height}`)}})),l.debug("Running cose-bilkent layout algorithm");let x={...e,nodes:e.nodes.map(T=>{let w=d[T.id];return{...T,width:w.width,height:w.height}})},b=await Gge(x,e.config);l.debug("Positioning nodes based on layout results"),b.nodes.forEach(T=>{let w=d[T.id];w?.domId&&(w.domId.attr("transform",`translate(${T.x}, ${T.y})`),w.x=T.x,w.y=T.y,l.debug(`Positioned node ${w.id} at center (${T.x}, ${T.y})`))}),b.edges.forEach(T=>{let w=e.edges.find(C=>C.id===T.id);w&&(w.points=[{x:T.startX,y:T.startY},{x:T.midX,y:T.midY},{x:T.endX,y:T.endY}])}),l.debug("Inserting and positioning edges"),await Promise.all(e.edges.map(async T=>{let w=await n(y,T),C=d[T.start??""],k=d[T.end??""];if(C&&k){let E=b.edges.find(A=>A.id===T.id);if(E){l.debug("APA01 positionedEdge",E);let A={...T},N=i(g,A,f,e.type,C,k,e.diagramId);u(A,N)}else{let A={...T,points:[{x:C.x||0,y:C.y||0},{x:k.x||0,y:k.y||0}]},N=i(g,A,f,e.type,C,k,e.diagramId);u(A,N)}}})),l.debug("Cose-bilkent rendering completed")},"render")});var Uge={};xr(Uge,{render:()=>qot});var qot,Hge=z(()=>{"use strict";qge();qot=Wge});var y2,GP,Uot,Zo,Gc,tf=z(()=>{"use strict";Hae();St();y2={},GP=o(e=>{for(let t of e)y2[t.name]=t},"registerLayoutLoaders"),Uot=o(()=>{GP([{name:"dagre",loader:o(async()=>await Promise.resolve().then(()=>(mfe(),pfe)),"loader")},{name:"cose-bilkent",loader:o(async()=>await Promise.resolve().then(()=>(Hge(),Uge)),"loader")}])},"registerDefaultLayoutLoaders");Uot();Zo=o(async(e,t)=>{if(!(e.layoutAlgorithm in y2))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(let d of e.nodes){let f=d.domId||d.id;d.domId=`${e.diagramId}-${f}`}let r=y2[e.layoutAlgorithm],i=await r.loader(),{theme:n,themeVariables:a}=e.config,{useGradient:s,gradientStart:l,gradientStop:u}=a,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${n?.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${n?.includes("dark")?"#FFFFFF":"#000000"}`),s){let d=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");d.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),d.append("svg:stop").attr("offset","100%").attr("stop-color",u).attr("stop-opacity",1)}return i.render(e,t,Uae,{algorithm:r.algorithm})},"render"),Gc=o((e="",{fallback:t="dagre"}={})=>{if(e in y2)return e;if(t in y2)return Z.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm")});var $s,Hot,Yot,rf=z(()=>{"use strict";Di();St();$s=o((e,t,r,i)=>{e.attr("class",r);let{width:n,height:a,x:s,y:l}=Hot(e,t);Br(e,a,n,i);let u=Yot(s,l,n,a,t);e.attr("viewBox",u),Z.debug(`viewBox configured: ${u} with padding: ${t}`)},"setupViewPortForSVG"),Hot=o((e,t)=>{let r=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:r.width+t*2,height:r.height+t*2,x:r.x,y:r.y}},"calculateDimensionsWithPadding"),Yot=o((e,t,r,i,n)=>`${e-n} ${t-n} ${r} ${i}`,"createViewBox")});var jot,Xot,Yge,jge=z(()=>{"use strict";Ut();St();Lp();tf();rf();Xt();jot=o(function(e,t){return t.db.getClasses()},"getClasses"),Xot=o(async function(e,t,r,i){Z.info("REF0:"),Z.info("Drawing state diagram (v2)",t);let{securityLevel:n,flowchart:a,layout:s}=ge();i.db.setDiagramId(t),Z.debug("Before getData: ");let l=i.db.getData();Z.debug("Data: ",l);let u=Fo(t,n),h=i.db.getDirection();l.type=i.type,l.layoutAlgorithm=Gc(s),l.layoutAlgorithm==="dagre"&&s==="elk"&&Z.warn("flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback."),l.direction=h,l.nodeSpacing=a?.nodeSpacing||50,l.rankSpacing=a?.rankSpacing||50,l.markers=["point","circle","cross"],l.diagramId=t,Z.debug("REF1:",l),await Zo(l,u);let d=l.config.flowchart?.diagramPadding??8;Zt.insertTitle(u,"flowchartTitleText",a?.titleTopMargin||0,i.db.getDiagramTitle()),$s(u,d,"flowchart",a?.useMaxWidth||!1)},"draw"),Yge={getClasses:jot,draw:Xot}});var VP,WP,Xge=z(()=>{"use strict";VP=(function(){var e=o(function(zt,Mt,qt,Qt){for(qt=qt||{},Qt=zt.length;Qt--;qt[zt[Qt]]=Mt);return qt},"o"),t=[1,4],r=[1,3],i=[1,5],n=[1,8,9,10,11,27,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124,125],a=[2,2],s=[1,13],l=[1,14],u=[1,15],h=[1,16],d=[1,23],f=[1,25],p=[1,26],m=[1,27],g=[1,50],y=[1,49],v=[1,29],x=[1,30],b=[1,31],T=[1,32],w=[1,33],C=[1,45],k=[1,47],E=[1,43],A=[1,48],N=[1,44],P=[1,51],I=[1,46],D=[1,52],_=[1,53],R=[1,34],M=[1,35],L=[1,36],B=[1,37],O=[1,38],$=[1,58],G=[1,8,9,10,11,27,32,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124,125],F=[1,62],V=[1,61],H=[1,63],j=[8,9,11,75,77,78],U=[1,79],Q=[1,92],Y=[1,97],ae=[1,96],J=[1,93],te=[1,89],re=[1,95],ee=[1,91],Te=[1,98],ue=[1,94],De=[1,99],Ie=[1,90],Ee=[8,9,10,11,40,75,77,78],we=[8,9,10,11,40,46,75,77,78],Me=[8,9,10,11,29,40,44,46,48,50,52,54,56,58,60,63,65,67,68,70,75,77,78,89,102,105,106,109,111,114,115,116],$e=[8,9,11,44,60,75,77,78,89,102,105,106,109,111,114,115,116],de=[44,60,89,102,105,106,109,111,114,115,116],rt=[1,122],ke=[1,123],Fe=[1,125],He=[1,124],at=[44,60,62,74,89,102,105,106,109,111,114,115,116],qe=[1,134],Ue=[1,148],ye=[1,149],ve=[1,150],ie=[1,151],fe=[1,136],W=[1,138],ce=[1,142],K=[1,143],Re=[1,144],xe=[1,145],Oe=[1,146],be=[1,147],Be=[1,152],Ae=[1,153],Ve=[1,132],Pe=[1,133],Ye=[1,140],le=[1,135],st=[1,139],me=[1,137],ot=[8,9,10,11,27,32,34,36,38,44,60,84,85,86,87,88,89,102,105,106,109,111,114,115,116,121,122,123,124,125],kt=[1,155],Gt=[1,157],Tt=[8,9,11],Et=[8,9,10,11,14,44,60,89,105,106,109,111,114,115,116],yt=[1,177],oe=[1,173],ht=[1,174],gt=[1,178],et=[1,175],pe=[1,176],Qe=[77,116,119],nt=[8,9,10,11,12,14,27,29,32,44,60,75,84,85,86,87,88,89,90,105,109,111,114,115,116],dt=[10,106],Ft=[31,49,51,53,55,57,62,64,66,67,69,71,116,117,118],Rt=[1,248],$t=[1,246],lr=[1,250],pt=[1,244],Se=[1,245],it=[1,247],xt=[1,249],rr=[1,251],_r=[1,269],Ur=[8,9,11,106],Dr=[8,9,10,11,60,84,105,106,109,110,111,112],Xi={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,graphConfig:4,document:5,line:6,statement:7,SEMI:8,NEWLINE:9,SPACE:10,EOF:11,GRAPH:12,NODIR:13,DIR:14,FirstStmtSeparator:15,ending:16,endToken:17,spaceList:18,spaceListNewline:19,vertexStatement:20,separator:21,styleStatement:22,linkStyleStatement:23,classDefStatement:24,classStatement:25,clickStatement:26,subgraph:27,textNoTags:28,SQS:29,text:30,SQE:31,end:32,direction:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,shapeData:39,SHAPE_DATA:40,link:41,node:42,styledVertex:43,AMP:44,vertex:45,STYLE_SEPARATOR:46,idString:47,DOUBLECIRCLESTART:48,DOUBLECIRCLEEND:49,PS:50,PE:51,"(-":52,"-)":53,STADIUMSTART:54,STADIUMEND:55,SUBROUTINESTART:56,SUBROUTINEEND:57,VERTEX_WITH_PROPS_START:58,"NODE_STRING[field]":59,COLON:60,"NODE_STRING[value]":61,PIPE:62,CYLINDERSTART:63,CYLINDEREND:64,DIAMOND_START:65,DIAMOND_STOP:66,TAGEND:67,TRAPSTART:68,TRAPEND:69,INVTRAPSTART:70,INVTRAPEND:71,linkStatement:72,arrowText:73,TESTSTR:74,START_LINK:75,edgeText:76,LINK:77,LINK_ID:78,edgeTextToken:79,STR:80,MD_STR:81,textToken:82,keywords:83,STYLE:84,LINKSTYLE:85,CLASSDEF:86,CLASS:87,CLICK:88,DOWN:89,UP:90,textNoTagsToken:91,stylesOpt:92,"idString[vertex]":93,"idString[class]":94,CALLBACKNAME:95,CALLBACKARGS:96,HREF:97,LINK_TARGET:98,"STR[link]":99,"STR[tooltip]":100,alphaNum:101,DEFAULT:102,numList:103,INTERPOLATE:104,NUM:105,COMMA:106,style:107,styleComponent:108,NODE_STRING:109,UNIT:110,BRKT:111,PCT:112,idStringToken:113,MINUS:114,MULT:115,UNICODE_TEXT:116,TEXT:117,TAGSTART:118,EDGE_TEXT:119,alphaNumToken:120,direction_tb:121,direction_bt:122,direction_rl:123,direction_lr:124,direction_td:125,$accept:0,$end:1},terminals_:{2:"error",8:"SEMI",9:"NEWLINE",10:"SPACE",11:"EOF",12:"GRAPH",13:"NODIR",14:"DIR",27:"subgraph",29:"SQS",31:"SQE",32:"end",34:"acc_title",35:"acc_title_value",36:"acc_descr",37:"acc_descr_value",38:"acc_descr_multiline_value",40:"SHAPE_DATA",44:"AMP",46:"STYLE_SEPARATOR",48:"DOUBLECIRCLESTART",49:"DOUBLECIRCLEEND",50:"PS",51:"PE",52:"(-",53:"-)",54:"STADIUMSTART",55:"STADIUMEND",56:"SUBROUTINESTART",57:"SUBROUTINEEND",58:"VERTEX_WITH_PROPS_START",59:"NODE_STRING[field]",60:"COLON",61:"NODE_STRING[value]",62:"PIPE",63:"CYLINDERSTART",64:"CYLINDEREND",65:"DIAMOND_START",66:"DIAMOND_STOP",67:"TAGEND",68:"TRAPSTART",69:"TRAPEND",70:"INVTRAPSTART",71:"INVTRAPEND",74:"TESTSTR",75:"START_LINK",77:"LINK",78:"LINK_ID",80:"STR",81:"MD_STR",84:"STYLE",85:"LINKSTYLE",86:"CLASSDEF",87:"CLASS",88:"CLICK",89:"DOWN",90:"UP",93:"idString[vertex]",94:"idString[class]",95:"CALLBACKNAME",96:"CALLBACKARGS",97:"HREF",98:"LINK_TARGET",99:"STR[link]",100:"STR[tooltip]",102:"DEFAULT",104:"INTERPOLATE",105:"NUM",106:"COMMA",109:"NODE_STRING",110:"UNIT",111:"BRKT",112:"PCT",114:"MINUS",115:"MULT",116:"UNICODE_TEXT",117:"TEXT",118:"TAGSTART",119:"EDGE_TEXT",121:"direction_tb",122:"direction_bt",123:"direction_rl",124:"direction_lr",125:"direction_td"},productions_:[0,[3,2],[5,0],[5,2],[6,1],[6,1],[6,1],[6,1],[6,1],[4,2],[4,2],[4,2],[4,3],[16,2],[16,1],[17,1],[17,1],[17,1],[15,1],[15,1],[15,2],[19,2],[19,2],[19,1],[19,1],[18,2],[18,1],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,9],[7,6],[7,4],[7,1],[7,2],[7,2],[7,1],[21,1],[21,1],[21,1],[39,2],[39,1],[20,4],[20,3],[20,4],[20,2],[20,2],[20,1],[42,1],[42,6],[42,5],[43,1],[43,3],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,8],[45,4],[45,4],[45,4],[45,6],[45,4],[45,4],[45,4],[45,4],[45,4],[45,1],[41,2],[41,3],[41,3],[41,1],[41,3],[41,4],[76,1],[76,2],[76,1],[76,1],[72,1],[72,2],[73,3],[30,1],[30,2],[30,1],[30,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[28,1],[28,2],[28,1],[28,1],[24,5],[25,5],[26,2],[26,4],[26,3],[26,5],[26,3],[26,5],[26,5],[26,7],[26,2],[26,4],[26,2],[26,4],[26,4],[26,6],[22,5],[23,5],[23,5],[23,9],[23,9],[23,7],[23,7],[103,1],[103,3],[92,1],[92,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[113,1],[82,1],[82,1],[82,1],[82,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[91,1],[79,1],[79,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[47,1],[47,2],[101,1],[101,2],[33,1],[33,1],[33,1],[33,1],[33,1]],performAction:o(function(Mt,qt,Qt,_t,oi,Ce,Zs){var _e=Ce.length-1;switch(oi){case 2:this.$=[];break;case 3:(!Array.isArray(Ce[_e])||Ce[_e].length>0)&&Ce[_e-1].push(Ce[_e]),this.$=Ce[_e-1];break;case 4:case 183:this.$=Ce[_e];break;case 11:_t.setDirection("TB"),this.$="TB";break;case 12:_t.setDirection(Ce[_e-1]),this.$=Ce[_e-1];break;case 27:this.$=Ce[_e-1].nodes;break;case 28:case 29:case 30:case 31:case 32:this.$=[];break;case 33:this.$=_t.addSubGraph(Ce[_e-6],Ce[_e-1],Ce[_e-4]);break;case 34:this.$=_t.addSubGraph(Ce[_e-3],Ce[_e-1],Ce[_e-3]);break;case 35:this.$=_t.addSubGraph(void 0,Ce[_e-1],void 0);break;case 37:this.$=Ce[_e].trim(),_t.setAccTitle(this.$);break;case 38:case 39:this.$=Ce[_e].trim(),_t.setAccDescription(this.$);break;case 43:this.$=Ce[_e-1]+Ce[_e];break;case 44:this.$=Ce[_e];break;case 45:_t.addVertex(Ce[_e-1][Ce[_e-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,Ce[_e]),_t.addLink(Ce[_e-3].stmt,Ce[_e-1],Ce[_e-2]),this.$={stmt:Ce[_e-1],nodes:Ce[_e-1].concat(Ce[_e-3].nodes)};break;case 46:_t.addLink(Ce[_e-2].stmt,Ce[_e],Ce[_e-1]),this.$={stmt:Ce[_e],nodes:Ce[_e].concat(Ce[_e-2].nodes)};break;case 47:_t.addLink(Ce[_e-3].stmt,Ce[_e-1],Ce[_e-2]),this.$={stmt:Ce[_e-1],nodes:Ce[_e-1].concat(Ce[_e-3].nodes)};break;case 48:this.$={stmt:Ce[_e-1],nodes:Ce[_e-1]};break;case 49:_t.addVertex(Ce[_e-1][Ce[_e-1].length-1],void 0,void 0,void 0,void 0,void 0,void 0,Ce[_e]),this.$={stmt:Ce[_e-1],nodes:Ce[_e-1],shapeData:Ce[_e]};break;case 50:this.$={stmt:Ce[_e],nodes:Ce[_e]};break;case 51:this.$=[Ce[_e]];break;case 52:_t.addVertex(Ce[_e-5][Ce[_e-5].length-1],void 0,void 0,void 0,void 0,void 0,void 0,Ce[_e-4]),this.$=Ce[_e-5].concat(Ce[_e]);break;case 53:this.$=Ce[_e-4].concat(Ce[_e]);break;case 54:this.$=Ce[_e];break;case 55:this.$=Ce[_e-2],_t.setClass(Ce[_e-2],Ce[_e]);break;case 56:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"square");break;case 57:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"doublecircle");break;case 58:this.$=Ce[_e-5],_t.addVertex(Ce[_e-5],Ce[_e-2],"circle");break;case 59:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"ellipse");break;case 60:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"stadium");break;case 61:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"subroutine");break;case 62:this.$=Ce[_e-7],_t.addVertex(Ce[_e-7],Ce[_e-1],"rect",void 0,void 0,void 0,Object.fromEntries([[Ce[_e-5],Ce[_e-3]]]));break;case 63:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"cylinder");break;case 64:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"round");break;case 65:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"diamond");break;case 66:this.$=Ce[_e-5],_t.addVertex(Ce[_e-5],Ce[_e-2],"hexagon");break;case 67:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"odd");break;case 68:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"trapezoid");break;case 69:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"inv_trapezoid");break;case 70:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"lean_right");break;case 71:this.$=Ce[_e-3],_t.addVertex(Ce[_e-3],Ce[_e-1],"lean_left");break;case 72:this.$=Ce[_e],_t.addVertex(Ce[_e]);break;case 73:Ce[_e-1].text=Ce[_e],this.$=Ce[_e-1];break;case 74:case 75:Ce[_e-2].text=Ce[_e-1],this.$=Ce[_e-2];break;case 76:this.$=Ce[_e];break;case 77:var an=_t.destructLink(Ce[_e],Ce[_e-2]);this.$={type:an.type,stroke:an.stroke,length:an.length,text:Ce[_e-1]};break;case 78:var an=_t.destructLink(Ce[_e],Ce[_e-2]);this.$={type:an.type,stroke:an.stroke,length:an.length,text:Ce[_e-1],id:Ce[_e-3]};break;case 79:this.$={text:Ce[_e],type:"text"};break;case 80:this.$={text:Ce[_e-1].text+""+Ce[_e],type:Ce[_e-1].type};break;case 81:this.$={text:Ce[_e],type:"string"};break;case 82:this.$={text:Ce[_e],type:"markdown"};break;case 83:var an=_t.destructLink(Ce[_e]);this.$={type:an.type,stroke:an.stroke,length:an.length};break;case 84:var an=_t.destructLink(Ce[_e]);this.$={type:an.type,stroke:an.stroke,length:an.length,id:Ce[_e-1]};break;case 85:this.$=Ce[_e-1];break;case 86:this.$={text:Ce[_e],type:"text"};break;case 87:this.$={text:Ce[_e-1].text+""+Ce[_e],type:Ce[_e-1].type};break;case 88:this.$={text:Ce[_e],type:"string"};break;case 89:case 104:this.$={text:Ce[_e],type:"markdown"};break;case 101:this.$={text:Ce[_e],type:"text"};break;case 102:this.$={text:Ce[_e-1].text+""+Ce[_e],type:Ce[_e-1].type};break;case 103:this.$={text:Ce[_e],type:"text"};break;case 105:this.$=Ce[_e-4],_t.addClass(Ce[_e-2],Ce[_e]);break;case 106:this.$=Ce[_e-4],_t.setClass(Ce[_e-2],Ce[_e]);break;case 107:case 115:this.$=Ce[_e-1],_t.setClickEvent(Ce[_e-1],Ce[_e]);break;case 108:case 116:this.$=Ce[_e-3],_t.setClickEvent(Ce[_e-3],Ce[_e-2]),_t.setTooltip(Ce[_e-3],Ce[_e]);break;case 109:this.$=Ce[_e-2],_t.setClickEvent(Ce[_e-2],Ce[_e-1],Ce[_e]);break;case 110:this.$=Ce[_e-4],_t.setClickEvent(Ce[_e-4],Ce[_e-3],Ce[_e-2]),_t.setTooltip(Ce[_e-4],Ce[_e]);break;case 111:this.$=Ce[_e-2],_t.setLink(Ce[_e-2],Ce[_e]);break;case 112:this.$=Ce[_e-4],_t.setLink(Ce[_e-4],Ce[_e-2]),_t.setTooltip(Ce[_e-4],Ce[_e]);break;case 113:this.$=Ce[_e-4],_t.setLink(Ce[_e-4],Ce[_e-2],Ce[_e]);break;case 114:this.$=Ce[_e-6],_t.setLink(Ce[_e-6],Ce[_e-4],Ce[_e]),_t.setTooltip(Ce[_e-6],Ce[_e-2]);break;case 117:this.$=Ce[_e-1],_t.setLink(Ce[_e-1],Ce[_e]);break;case 118:this.$=Ce[_e-3],_t.setLink(Ce[_e-3],Ce[_e-2]),_t.setTooltip(Ce[_e-3],Ce[_e]);break;case 119:this.$=Ce[_e-3],_t.setLink(Ce[_e-3],Ce[_e-2],Ce[_e]);break;case 120:this.$=Ce[_e-5],_t.setLink(Ce[_e-5],Ce[_e-4],Ce[_e]),_t.setTooltip(Ce[_e-5],Ce[_e-2]);break;case 121:this.$=Ce[_e-4],_t.addVertex(Ce[_e-2],void 0,void 0,Ce[_e]);break;case 122:this.$=Ce[_e-4],_t.updateLink([Ce[_e-2]],Ce[_e]);break;case 123:this.$=Ce[_e-4],_t.updateLink(Ce[_e-2],Ce[_e]);break;case 124:this.$=Ce[_e-8],_t.updateLinkInterpolate([Ce[_e-6]],Ce[_e-2]),_t.updateLink([Ce[_e-6]],Ce[_e]);break;case 125:this.$=Ce[_e-8],_t.updateLinkInterpolate(Ce[_e-6],Ce[_e-2]),_t.updateLink(Ce[_e-6],Ce[_e]);break;case 126:this.$=Ce[_e-6],_t.updateLinkInterpolate([Ce[_e-4]],Ce[_e]);break;case 127:this.$=Ce[_e-6],_t.updateLinkInterpolate(Ce[_e-4],Ce[_e]);break;case 128:case 130:this.$=[Ce[_e]];break;case 129:case 131:Ce[_e-2].push(Ce[_e]),this.$=Ce[_e-2];break;case 133:this.$=Ce[_e-1]+Ce[_e];break;case 181:this.$=Ce[_e];break;case 182:this.$=Ce[_e-1]+""+Ce[_e];break;case 184:this.$=Ce[_e-1]+""+Ce[_e];break;case 185:this.$={stmt:"dir",value:"TB"};break;case 186:this.$={stmt:"dir",value:"BT"};break;case 187:this.$={stmt:"dir",value:"RL"};break;case 188:this.$={stmt:"dir",value:"LR"};break;case 189:this.$={stmt:"dir",value:"TD"};break}},"anonymous"),table:[{3:1,4:2,9:t,10:r,12:i},{1:[3]},e(n,a,{5:6}),{4:7,9:t,10:r,12:i},{4:8,9:t,10:r,12:i},{13:[1,9],14:[1,10]},{1:[2,1],6:11,7:12,8:s,9:l,10:u,11:h,20:17,22:18,23:19,24:20,25:21,26:22,27:d,33:24,34:f,36:p,38:m,42:28,43:39,44:g,45:40,47:41,60:y,84:v,85:x,86:b,87:T,88:w,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_,121:R,122:M,123:L,124:B,125:O},e(n,[2,9]),e(n,[2,10]),e(n,[2,11]),{8:[1,55],9:[1,56],10:$,15:54,18:57},e(G,[2,3]),e(G,[2,4]),e(G,[2,5]),e(G,[2,6]),e(G,[2,7]),e(G,[2,8]),{8:F,9:V,11:H,21:59,41:60,72:64,75:[1,65],77:[1,67],78:[1,66]},{8:F,9:V,11:H,21:68},{8:F,9:V,11:H,21:69},{8:F,9:V,11:H,21:70},{8:F,9:V,11:H,21:71},{8:F,9:V,11:H,21:72},{8:F,9:V,10:[1,73],11:H,21:74},e(G,[2,36]),{35:[1,75]},{37:[1,76]},e(G,[2,39]),e(j,[2,50],{18:77,39:78,10:$,40:U}),{10:[1,80]},{10:[1,81]},{10:[1,82]},{10:[1,83]},{14:Q,44:Y,60:ae,80:[1,87],89:J,95:[1,84],97:[1,85],101:86,105:te,106:re,109:ee,111:Te,114:ue,115:De,116:Ie,120:88},e(G,[2,185]),e(G,[2,186]),e(G,[2,187]),e(G,[2,188]),e(G,[2,189]),e(Ee,[2,51]),e(Ee,[2,54],{46:[1,100]}),e(we,[2,72],{113:113,29:[1,101],44:g,48:[1,102],50:[1,103],52:[1,104],54:[1,105],56:[1,106],58:[1,107],60:y,63:[1,108],65:[1,109],67:[1,110],68:[1,111],70:[1,112],89:C,102:k,105:E,106:A,109:N,111:P,114:I,115:D,116:_}),e(Me,[2,181]),e(Me,[2,142]),e(Me,[2,143]),e(Me,[2,144]),e(Me,[2,145]),e(Me,[2,146]),e(Me,[2,147]),e(Me,[2,148]),e(Me,[2,149]),e(Me,[2,150]),e(Me,[2,151]),e(Me,[2,152]),e(n,[2,12]),e(n,[2,18]),e(n,[2,19]),{9:[1,114]},e($e,[2,26],{18:115,10:$}),e(G,[2,27]),{42:116,43:39,44:g,45:40,47:41,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_},e(G,[2,40]),e(G,[2,41]),e(G,[2,42]),e(de,[2,76],{73:117,62:[1,119],74:[1,118]}),{76:120,79:121,80:rt,81:ke,116:Fe,119:He},{75:[1,126],77:[1,127]},e(at,[2,83]),e(G,[2,28]),e(G,[2,29]),e(G,[2,30]),e(G,[2,31]),e(G,[2,32]),{10:qe,12:Ue,14:ye,27:ve,28:128,32:ie,44:fe,60:W,75:ce,80:[1,130],81:[1,131],83:141,84:K,85:Re,86:xe,87:Oe,88:be,89:Be,90:Ae,91:129,105:Ve,109:Pe,111:Ye,114:le,115:st,116:me},e(ot,a,{5:154}),e(G,[2,37]),e(G,[2,38]),e(j,[2,48],{44:kt}),e(j,[2,49],{18:156,10:$,40:Gt}),e(Ee,[2,44]),{44:g,47:158,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_},{102:[1,159],103:160,105:[1,161]},{44:g,47:162,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_},{44:g,47:163,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_},e(Tt,[2,107],{10:[1,164],96:[1,165]}),{80:[1,166]},e(Tt,[2,115],{120:168,10:[1,167],14:Q,44:Y,60:ae,89:J,105:te,106:re,109:ee,111:Te,114:ue,115:De,116:Ie}),e(Tt,[2,117],{10:[1,169]}),e(Et,[2,183]),e(Et,[2,170]),e(Et,[2,171]),e(Et,[2,172]),e(Et,[2,173]),e(Et,[2,174]),e(Et,[2,175]),e(Et,[2,176]),e(Et,[2,177]),e(Et,[2,178]),e(Et,[2,179]),e(Et,[2,180]),{44:g,47:170,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_},{30:171,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{30:179,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{30:181,50:[1,180],67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{30:182,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{30:183,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{30:184,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{109:[1,185]},{30:186,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{30:187,65:[1,188],67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{30:189,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{30:190,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{30:191,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},e(Me,[2,182]),e(n,[2,20]),e($e,[2,25]),e(j,[2,46],{39:192,18:193,10:$,40:U}),e(de,[2,73],{10:[1,194]}),{10:[1,195]},{30:196,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{77:[1,197],79:198,116:Fe,119:He},e(Qe,[2,79]),e(Qe,[2,81]),e(Qe,[2,82]),e(Qe,[2,168]),e(Qe,[2,169]),{76:199,79:121,80:rt,81:ke,116:Fe,119:He},e(at,[2,84]),{8:F,9:V,10:qe,11:H,12:Ue,14:ye,21:201,27:ve,29:[1,200],32:ie,44:fe,60:W,75:ce,83:141,84:K,85:Re,86:xe,87:Oe,88:be,89:Be,90:Ae,91:202,105:Ve,109:Pe,111:Ye,114:le,115:st,116:me},e(nt,[2,101]),e(nt,[2,103]),e(nt,[2,104]),e(nt,[2,157]),e(nt,[2,158]),e(nt,[2,159]),e(nt,[2,160]),e(nt,[2,161]),e(nt,[2,162]),e(nt,[2,163]),e(nt,[2,164]),e(nt,[2,165]),e(nt,[2,166]),e(nt,[2,167]),e(nt,[2,90]),e(nt,[2,91]),e(nt,[2,92]),e(nt,[2,93]),e(nt,[2,94]),e(nt,[2,95]),e(nt,[2,96]),e(nt,[2,97]),e(nt,[2,98]),e(nt,[2,99]),e(nt,[2,100]),{6:11,7:12,8:s,9:l,10:u,11:h,20:17,22:18,23:19,24:20,25:21,26:22,27:d,32:[1,203],33:24,34:f,36:p,38:m,42:28,43:39,44:g,45:40,47:41,60:y,84:v,85:x,86:b,87:T,88:w,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_,121:R,122:M,123:L,124:B,125:O},{10:$,18:204},{44:[1,205]},e(Ee,[2,43]),{10:[1,206],44:g,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:113,114:I,115:D,116:_},{10:[1,207]},{10:[1,208],106:[1,209]},e(dt,[2,128]),{10:[1,210],44:g,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:113,114:I,115:D,116:_},{10:[1,211],44:g,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:113,114:I,115:D,116:_},{80:[1,212]},e(Tt,[2,109],{10:[1,213]}),e(Tt,[2,111],{10:[1,214]}),{80:[1,215]},e(Et,[2,184]),{80:[1,216],98:[1,217]},e(Ee,[2,55],{113:113,44:g,60:y,89:C,102:k,105:E,106:A,109:N,111:P,114:I,115:D,116:_}),{31:[1,218],67:yt,82:219,116:gt,117:et,118:pe},e(Ft,[2,86]),e(Ft,[2,88]),e(Ft,[2,89]),e(Ft,[2,153]),e(Ft,[2,154]),e(Ft,[2,155]),e(Ft,[2,156]),{49:[1,220],67:yt,82:219,116:gt,117:et,118:pe},{30:221,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{51:[1,222],67:yt,82:219,116:gt,117:et,118:pe},{53:[1,223],67:yt,82:219,116:gt,117:et,118:pe},{55:[1,224],67:yt,82:219,116:gt,117:et,118:pe},{57:[1,225],67:yt,82:219,116:gt,117:et,118:pe},{60:[1,226]},{64:[1,227],67:yt,82:219,116:gt,117:et,118:pe},{66:[1,228],67:yt,82:219,116:gt,117:et,118:pe},{30:229,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},{31:[1,230],67:yt,82:219,116:gt,117:et,118:pe},{67:yt,69:[1,231],71:[1,232],82:219,116:gt,117:et,118:pe},{67:yt,69:[1,234],71:[1,233],82:219,116:gt,117:et,118:pe},e(j,[2,45],{18:156,10:$,40:Gt}),e(j,[2,47],{44:kt}),e(de,[2,75]),e(de,[2,74]),{62:[1,235],67:yt,82:219,116:gt,117:et,118:pe},e(de,[2,77]),e(Qe,[2,80]),{77:[1,236],79:198,116:Fe,119:He},{30:237,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},e(ot,a,{5:238}),e(nt,[2,102]),e(G,[2,35]),{43:239,44:g,45:40,47:41,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_},{10:$,18:240},{10:Rt,60:$t,84:lr,92:241,105:pt,107:242,108:243,109:Se,110:it,111:xt,112:rr},{10:Rt,60:$t,84:lr,92:252,104:[1,253],105:pt,107:242,108:243,109:Se,110:it,111:xt,112:rr},{10:Rt,60:$t,84:lr,92:254,104:[1,255],105:pt,107:242,108:243,109:Se,110:it,111:xt,112:rr},{105:[1,256]},{10:Rt,60:$t,84:lr,92:257,105:pt,107:242,108:243,109:Se,110:it,111:xt,112:rr},{44:g,47:258,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_},e(Tt,[2,108]),{80:[1,259]},{80:[1,260],98:[1,261]},e(Tt,[2,116]),e(Tt,[2,118],{10:[1,262]}),e(Tt,[2,119]),e(we,[2,56]),e(Ft,[2,87]),e(we,[2,57]),{51:[1,263],67:yt,82:219,116:gt,117:et,118:pe},e(we,[2,64]),e(we,[2,59]),e(we,[2,60]),e(we,[2,61]),{109:[1,264]},e(we,[2,63]),e(we,[2,65]),{66:[1,265],67:yt,82:219,116:gt,117:et,118:pe},e(we,[2,67]),e(we,[2,68]),e(we,[2,70]),e(we,[2,69]),e(we,[2,71]),e([10,44,60,89,102,105,106,109,111,114,115,116],[2,85]),e(de,[2,78]),{31:[1,266],67:yt,82:219,116:gt,117:et,118:pe},{6:11,7:12,8:s,9:l,10:u,11:h,20:17,22:18,23:19,24:20,25:21,26:22,27:d,32:[1,267],33:24,34:f,36:p,38:m,42:28,43:39,44:g,45:40,47:41,60:y,84:v,85:x,86:b,87:T,88:w,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_,121:R,122:M,123:L,124:B,125:O},e(Ee,[2,53]),{43:268,44:g,45:40,47:41,60:y,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_},e(Tt,[2,121],{106:_r}),e(Ur,[2,130],{108:270,10:Rt,60:$t,84:lr,105:pt,109:Se,110:it,111:xt,112:rr}),e(Dr,[2,132]),e(Dr,[2,134]),e(Dr,[2,135]),e(Dr,[2,136]),e(Dr,[2,137]),e(Dr,[2,138]),e(Dr,[2,139]),e(Dr,[2,140]),e(Dr,[2,141]),e(Tt,[2,122],{106:_r}),{10:[1,271]},e(Tt,[2,123],{106:_r}),{10:[1,272]},e(dt,[2,129]),e(Tt,[2,105],{106:_r}),e(Tt,[2,106],{113:113,44:g,60:y,89:C,102:k,105:E,106:A,109:N,111:P,114:I,115:D,116:_}),e(Tt,[2,110]),e(Tt,[2,112],{10:[1,273]}),e(Tt,[2,113]),{98:[1,274]},{51:[1,275]},{62:[1,276]},{66:[1,277]},{8:F,9:V,11:H,21:278},e(G,[2,34]),e(Ee,[2,52]),{10:Rt,60:$t,84:lr,105:pt,107:279,108:243,109:Se,110:it,111:xt,112:rr},e(Dr,[2,133]),{14:Q,44:Y,60:ae,89:J,101:280,105:te,106:re,109:ee,111:Te,114:ue,115:De,116:Ie,120:88},{14:Q,44:Y,60:ae,89:J,101:281,105:te,106:re,109:ee,111:Te,114:ue,115:De,116:Ie,120:88},{98:[1,282]},e(Tt,[2,120]),e(we,[2,58]),{30:283,67:yt,80:oe,81:ht,82:172,116:gt,117:et,118:pe},e(we,[2,66]),e(ot,a,{5:284}),e(Ur,[2,131],{108:270,10:Rt,60:$t,84:lr,105:pt,109:Se,110:it,111:xt,112:rr}),e(Tt,[2,126],{120:168,10:[1,285],14:Q,44:Y,60:ae,89:J,105:te,106:re,109:ee,111:Te,114:ue,115:De,116:Ie}),e(Tt,[2,127],{120:168,10:[1,286],14:Q,44:Y,60:ae,89:J,105:te,106:re,109:ee,111:Te,114:ue,115:De,116:Ie}),e(Tt,[2,114]),{31:[1,287],67:yt,82:219,116:gt,117:et,118:pe},{6:11,7:12,8:s,9:l,10:u,11:h,20:17,22:18,23:19,24:20,25:21,26:22,27:d,32:[1,288],33:24,34:f,36:p,38:m,42:28,43:39,44:g,45:40,47:41,60:y,84:v,85:x,86:b,87:T,88:w,89:C,102:k,105:E,106:A,109:N,111:P,113:42,114:I,115:D,116:_,121:R,122:M,123:L,124:B,125:O},{10:Rt,60:$t,84:lr,92:289,105:pt,107:242,108:243,109:Se,110:it,111:xt,112:rr},{10:Rt,60:$t,84:lr,92:290,105:pt,107:242,108:243,109:Se,110:it,111:xt,112:rr},e(we,[2,62]),e(G,[2,33]),e(Tt,[2,124],{106:_r}),e(Tt,[2,125],{106:_r})],defaultActions:{},parseError:o(function(Mt,qt){if(qt.recoverable)this.trace(Mt);else{var Qt=new Error(Mt);throw Qt.hash=qt,Qt}},"parseError"),parse:o(function(Mt){var qt=this,Qt=[0],_t=[],oi=[null],Ce=[],Zs=this.table,_e="",an=0,H_=0,xC=0,rNe=2,SU=1,iNe=Ce.slice.call(arguments,1),Kn=Object.create(this.lexer),Of={yy:{}};for(var Y_ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y_)&&(Of.yy[Y_]=this.yy[Y_]);Kn.setInput(Mt,Of.yy),Of.yy.lexer=Kn,Of.yy.parser=this,typeof Kn.yylloc>"u"&&(Kn.yylloc={});var j_=Kn.yylloc;Ce.push(j_);var nNe=Kn.options&&Kn.options.ranges;typeof Of.yy.parseError=="function"?this.parseError=Of.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function o6t(Qs){Qt.length=Qt.length-2*Qs,oi.length=oi.length-Qs,Ce.length=Ce.length-Qs}o(o6t,"popStack");function aNe(){var Qs;return Qs=_t.pop()||Kn.lex()||SU,typeof Qs!="number"&&(Qs instanceof Array&&(_t=Qs,Qs=_t.pop()),Qs=qt.symbols_[Qs]||Qs),Qs}o(aNe,"lex");for(var Va,X_,Pf,wo,l6t,K_,Am={},bC,hu,EU,TC;;){if(Pf=Qt[Qt.length-1],this.defaultActions[Pf]?wo=this.defaultActions[Pf]:((Va===null||typeof Va>"u")&&(Va=aNe()),wo=Zs[Pf]&&Zs[Pf][Va]),typeof wo>"u"||!wo.length||!wo[0]){var Z_="";TC=[];for(bC in Zs[Pf])this.terminals_[bC]&&bC>rNe&&TC.push("'"+this.terminals_[bC]+"'");Kn.showPosition?Z_="Parse error on line "+(an+1)+`: +`+Kn.showPosition()+` +Expecting `+TC.join(", ")+", got '"+(this.terminals_[Va]||Va)+"'":Z_="Parse error on line "+(an+1)+": Unexpected "+(Va==SU?"end of input":"'"+(this.terminals_[Va]||Va)+"'"),this.parseError(Z_,{text:Kn.match,token:this.terminals_[Va]||Va,line:Kn.yylineno,loc:j_,expected:TC})}if(wo[0]instanceof Array&&wo.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Pf+", token: "+Va);switch(wo[0]){case 1:Qt.push(Va),oi.push(Kn.yytext),Ce.push(Kn.yylloc),Qt.push(wo[1]),Va=null,X_?(Va=X_,X_=null):(H_=Kn.yyleng,_e=Kn.yytext,an=Kn.yylineno,j_=Kn.yylloc,xC>0&&xC--);break;case 2:if(hu=this.productions_[wo[1]][1],Am.$=oi[oi.length-hu],Am._$={first_line:Ce[Ce.length-(hu||1)].first_line,last_line:Ce[Ce.length-1].last_line,first_column:Ce[Ce.length-(hu||1)].first_column,last_column:Ce[Ce.length-1].last_column},nNe&&(Am._$.range=[Ce[Ce.length-(hu||1)].range[0],Ce[Ce.length-1].range[1]]),K_=this.performAction.apply(Am,[_e,H_,an,Of.yy,wo[1],oi,Ce].concat(iNe)),typeof K_<"u")return K_;hu&&(Qt=Qt.slice(0,-1*hu*2),oi=oi.slice(0,-1*hu),Ce=Ce.slice(0,-1*hu)),Qt.push(this.productions_[wo[1]][0]),oi.push(Am.$),Ce.push(Am._$),EU=Zs[Qt[Qt.length-2]][Qt[Qt.length-1]],Qt.push(EU);break;case 3:return!0}}return!0},"parse")},In=(function(){var zt={EOF:1,parseError:o(function(qt,Qt){if(this.yy.parser)this.yy.parser.parseError(qt,Qt);else throw new Error(qt)},"parseError"),setInput:o(function(Mt,qt){return this.yy=qt||this.yy||{},this._input=Mt,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var Mt=this._input[0];this.yytext+=Mt,this.yyleng++,this.offset++,this.match+=Mt,this.matched+=Mt;var qt=Mt.match(/(?:\r\n?|\n).*/g);return qt?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Mt},"input"),unput:o(function(Mt){var qt=Mt.length,Qt=Mt.split(/(?:\r\n?|\n)/g);this._input=Mt+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-qt),this.offset-=qt;var _t=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),Qt.length-1&&(this.yylineno-=Qt.length-1);var oi=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:Qt?(Qt.length===_t.length?this.yylloc.first_column:0)+_t[_t.length-Qt.length].length-Qt[0].length:this.yylloc.first_column-qt},this.options.ranges&&(this.yylloc.range=[oi[0],oi[0]+this.yyleng-qt]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(Mt){this.unput(this.match.slice(Mt))},"less"),pastInput:o(function(){var Mt=this.matched.substr(0,this.matched.length-this.match.length);return(Mt.length>20?"...":"")+Mt.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var Mt=this.match;return Mt.length<20&&(Mt+=this._input.substr(0,20-Mt.length)),(Mt.substr(0,20)+(Mt.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var Mt=this.pastInput(),qt=new Array(Mt.length+1).join("-");return Mt+this.upcomingInput()+` +`+qt+"^"},"showPosition"),test_match:o(function(Mt,qt){var Qt,_t,oi;if(this.options.backtrack_lexer&&(oi={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(oi.yylloc.range=this.yylloc.range.slice(0))),_t=Mt[0].match(/(?:\r\n?|\n).*/g),_t&&(this.yylineno+=_t.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:_t?_t[_t.length-1].length-_t[_t.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Mt[0].length},this.yytext+=Mt[0],this.match+=Mt[0],this.matches=Mt,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(Mt[0].length),this.matched+=Mt[0],Qt=this.performAction.call(this,this.yy,this,qt,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),Qt)return Qt;if(this._backtrack){for(var Ce in oi)this[Ce]=oi[Ce];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Mt,qt,Qt,_t;this._more||(this.yytext="",this.match="");for(var oi=this._currentRules(),Ce=0;Ceqt[0].length)){if(qt=Qt,_t=Ce,this.options.backtrack_lexer){if(Mt=this.test_match(Qt,oi[Ce]),Mt!==!1)return Mt;if(this._backtrack){qt=!1;continue}else return!1}else if(!this.options.flex)break}return qt?(Mt=this.test_match(qt,oi[_t]),Mt!==!1?Mt:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var qt=this.next();return qt||this.lex()},"lex"),begin:o(function(qt){this.conditionStack.push(qt)},"begin"),popState:o(function(){var qt=this.conditionStack.length-1;return qt>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(qt){return qt=this.conditionStack.length-1-Math.abs(qt||0),qt>=0?this.conditionStack[qt]:"INITIAL"},"topState"),pushState:o(function(qt){this.begin(qt)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:o(function(qt,Qt,_t,oi){var Ce=oi;switch(_t){case 0:return this.begin("acc_title"),34;break;case 1:return this.popState(),"acc_title_value";break;case 2:return this.begin("acc_descr"),36;break;case 3:return this.popState(),"acc_descr_value";break;case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return this.pushState("shapeData"),Qt.yytext="",40;break;case 8:return this.pushState("shapeDataStr"),40;break;case 9:return this.popState(),40;break;case 10:let Zs=/\n\s*/g;return Qt.yytext=Qt.yytext.replace(Zs,"
    "),40;break;case 11:return 40;case 12:this.popState();break;case 13:this.begin("callbackname");break;case 14:this.popState();break;case 15:this.popState(),this.begin("callbackargs");break;case 16:return 95;case 17:this.popState();break;case 18:return 96;case 19:return"MD_STR";case 20:this.popState();break;case 21:this.begin("md_string");break;case 22:return"STR";case 23:this.popState();break;case 24:this.pushState("string");break;case 25:return 84;case 26:return 102;case 27:return 85;case 28:return 104;case 29:return 86;case 30:return 87;case 31:return 97;case 32:this.begin("click");break;case 33:this.popState();break;case 34:return 88;case 35:return qt.lex.firstGraph()&&this.begin("dir"),12;break;case 36:return qt.lex.firstGraph()&&this.begin("dir"),12;break;case 37:return qt.lex.firstGraph()&&this.begin("dir"),12;break;case 38:return 27;case 39:return 32;case 40:return 98;case 41:return 98;case 42:return 98;case 43:return 98;case 44:return this.popState(),13;break;case 45:return this.popState(),14;break;case 46:return this.popState(),14;break;case 47:return this.popState(),14;break;case 48:return this.popState(),14;break;case 49:return this.popState(),14;break;case 50:return this.popState(),14;break;case 51:return this.popState(),14;break;case 52:return this.popState(),14;break;case 53:return this.popState(),14;break;case 54:return this.popState(),14;break;case 55:return 121;case 56:return 122;case 57:return 123;case 58:return 124;case 59:return 125;case 60:return 78;case 61:return 105;case 62:return 111;case 63:return 46;case 64:return 60;case 65:return 44;case 66:return 8;case 67:return 106;case 68:return 115;case 69:return this.popState(),77;break;case 70:return this.pushState("edgeText"),75;break;case 71:return 119;case 72:return this.popState(),77;break;case 73:return this.pushState("thickEdgeText"),75;break;case 74:return 119;case 75:return this.popState(),77;break;case 76:return this.pushState("dottedEdgeText"),75;break;case 77:return 119;case 78:return 77;case 79:return this.popState(),53;break;case 80:return"TEXT";case 81:return this.pushState("ellipseText"),52;break;case 82:return this.popState(),55;break;case 83:return this.pushState("text"),54;break;case 84:return this.popState(),57;break;case 85:return this.pushState("text"),56;break;case 86:return 58;case 87:return this.pushState("text"),67;break;case 88:return this.popState(),64;break;case 89:return this.pushState("text"),63;break;case 90:return this.popState(),49;break;case 91:return this.pushState("text"),48;break;case 92:return this.popState(),69;break;case 93:return this.popState(),71;break;case 94:return 117;case 95:return this.pushState("trapText"),68;break;case 96:return this.pushState("trapText"),70;break;case 97:return 118;case 98:return 67;case 99:return 90;case 100:return"SEP";case 101:return 89;case 102:return 115;case 103:return 111;case 104:return 44;case 105:return 109;case 106:return 114;case 107:return 116;case 108:return this.popState(),62;break;case 109:return this.pushState("text"),62;break;case 110:return this.popState(),51;break;case 111:return this.pushState("text"),50;break;case 112:return this.popState(),31;break;case 113:return this.pushState("text"),29;break;case 114:return this.popState(),66;break;case 115:return this.pushState("text"),65;break;case 116:return"TEXT";case 117:return"QUOTE";case 118:return 9;case 119:return 10;case 120:return 11}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:@\{)/,/^(?:["])/,/^(?:["])/,/^(?:[^\"]+)/,/^(?:[^}^"]+)/,/^(?:\})/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["][`])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:["])/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s])/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:flowchart-elk\b)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:.*direction\s+TD[^\n]*)/,/^(?:[^\s\"]+@(?=[^\{\"]))/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:[^-]|-(?!-)+)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:[^=]|=(?!))/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:[^\.]|\.(?!))/,/^(?:\s*~~[\~]+\s*)/,/^(?:[-/\)][\)])/,/^(?:[^\(\)\[\]\{\}]|!\)+)/,/^(?:\(-)/,/^(?:\]\))/,/^(?:\(\[)/,/^(?:\]\])/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:>)/,/^(?:\)\])/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\(\(\()/,/^(?:[\\(?=\])][\]])/,/^(?:\/(?=\])\])/,/^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:\*)/,/^(?:#)/,/^(?:&)/,/^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/,/^(?:-)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\|)/,/^(?:\))/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:(\}))/,/^(?:\{)/,/^(?:[^\[\]\(\)\{\}\|\"]+)/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],conditions:{shapeDataEndBracket:{rules:[21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},shapeDataStr:{rules:[9,10,21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},shapeData:{rules:[8,11,12,21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},callbackargs:{rules:[17,18,21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},callbackname:{rules:[14,15,16,21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},href:{rules:[21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},click:{rules:[21,24,33,34,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},dottedEdgeText:{rules:[21,24,75,77,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},thickEdgeText:{rules:[21,24,72,74,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},edgeText:{rules:[21,24,69,71,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},trapText:{rules:[21,24,78,81,83,85,89,91,92,93,94,95,96,109,111,113,115],inclusive:!1},ellipseText:{rules:[21,24,78,79,80,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},text:{rules:[21,24,78,81,82,83,84,85,88,89,90,91,95,96,108,109,110,111,112,113,114,115,116],inclusive:!1},vertex:{rules:[21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},dir:{rules:[21,24,44,45,46,47,48,49,50,51,52,53,54,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},acc_descr_multiline:{rules:[5,6,21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},acc_descr:{rules:[3,21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},acc_title:{rules:[1,21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},md_string:{rules:[19,20,21,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},string:{rules:[21,22,23,24,78,81,83,85,89,91,95,96,109,111,113,115],inclusive:!1},INITIAL:{rules:[0,2,4,7,13,21,24,25,26,27,28,29,30,31,32,35,36,37,38,39,40,41,42,43,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,72,73,75,76,78,81,83,85,86,87,89,91,95,96,97,98,99,100,101,102,103,104,105,106,107,109,111,113,115,117,118,119,120],inclusive:!0}}};return zt})();Xi.lexer=In;function pi(){this.yy={}}return o(pi,"Parser"),pi.prototype=Xi,Xi.Parser=pi,new pi})();VP.parser=VP;WP=VP});var Kge,Zge,Qge=z(()=>{"use strict";Xge();Kge=Object.assign({},WP);Kge.parse=e=>{let t=e.replace(/}\s*\n/g,`} +`);return WP.parse(t)};Zge=Kge});var Vc,k1=z(()=>{"use strict";Vc=o(()=>` + /* Font Awesome icon styling - consolidated */ + .label-icon { + display: inline-block; + height: 1em; + overflow: visible; + vertical-align: -0.125em; + } + + .node .label-icon path { + fill: currentColor; + stroke: revert; + stroke-width: revert; + } +`,"getIconStyles")});var Kot,Zot,Jge,e1e=z(()=>{"use strict";Cn();k1();Kot=o((e,t)=>{let r=Ff,i=r(e,"r"),n=r(e,"g"),a=r(e,"b");return mn(i,n,a,t)},"fade"),Zot=o(e=>`.label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor||e.textColor}; + } + .cluster-label text { + fill: ${e.titleColor}; + } + .cluster-label span { + color: ${e.titleColor}; + } + .cluster-label span p { + background-color: transparent; + } + + .label text,span { + fill: ${e.nodeTextColor||e.textColor}; + color: ${e.nodeTextColor||e.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: ${e.strokeWidth??1}px; + } + .rough-node .label text , .node .label text, .image-shape .label, .icon-shape .label { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .katex path { + fill: #000; + stroke: #000; + stroke-width: 1px; + } + + .rough-node .label,.node .label, .image-shape .label, .icon-shape .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + + .root .anchor path { + fill: ${e.lineColor} !important; + stroke-width: 0; + stroke: ${e.lineColor}; + } + + .arrowheadPath { + fill: ${e.arrowheadColor}; + } + + .edgePath .path { + stroke: ${e.lineColor}; + stroke-width: ${e.strokeWidth??2}px; + } + + .flowchart-link { + stroke: ${e.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${e.edgeLabelBackground}; + p { + background-color: ${e.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${Kot(e.edgeLabelBackground,.5)}; + // background-color: + } + + .cluster rect { + fill: ${e.clusterBkg}; + stroke: ${e.clusterBorder}; + stroke-width: 1px; + } + + .cluster text { + fill: ${e.titleColor}; + } + + .cluster span { + color: ${e.titleColor}; + } + /* .cluster div { + color: ${e.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${e.fontFamily}; + font-size: 12px; + background: ${e.tertiaryColor}; + border: 1px solid ${e.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; + } + + rect.text { + fill: none; + stroke-width: 0; + } + + .icon-shape, .image-shape { + background-color: ${e.edgeLabelBackground}; + p { + background-color: ${e.edgeLabelBackground}; + padding: 2px; + } + .label rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; + } + ${Vc()} +`,"getStyles"),Jge=Zot});var hE={};xr(hE,{diagram:()=>Qot});var Qot,dE=z(()=>{"use strict";Ut();Mae();jge();Qge();e1e();Qot={parser:Zge,get db(){return new V4},renderer:Yge,styles:Jge,init:o(e=>{e.flowchart||(e.flowchart={}),e.layout&&Sv({layout:e.layout}),e.flowchart.arrowMarkerAbsolute=e.arrowMarkerAbsolute,Sv({flowchart:{arrowMarkerAbsolute:e.arrowMarkerAbsolute}})},"init")}});var qP,a1e,s1e=z(()=>{"use strict";qP=(function(){var e=o(function(De,Ie,Ee,we){for(Ee=Ee||{},we=De.length;we--;Ee[De[we]]=Ie);return Ee},"o"),t=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],r=[1,10],i=[1,11],n=[1,12],a=[1,13],s=[1,23],l=[1,24],u=[1,25],h=[1,26],d=[1,27],f=[1,19],p=[1,28],m=[1,29],g=[1,20],y=[1,18],v=[1,21],x=[1,22],b=[1,36],T=[1,37],w=[1,38],C=[1,39],k=[1,40],E=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,65,66,67,68,69],A=[1,45],N=[1,46],P=[1,55],I=[40,48,50,51,52,70,71],D=[1,66],_=[1,64],R=[1,61],M=[1,65],L=[1,67],B=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,65,66,67,68,69],O=[65,66,67,68,69],$=[1,84],G=[1,83],F=[1,81],V=[1,82],H=[6,10,42,47],j=[6,10,13,41,42,47,48,49],U=[1,92],Q=[1,91],Y=[1,90],ae=[19,58],J=[1,101],te=[1,100],re=[19,58,60,62],ee={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,attributeKeyType:59,",":60,ATTRIBUTE_KEY:61,COMMENT:62,cardinality:63,relType:64,ZERO_OR_ONE:65,ZERO_OR_MORE:66,ONE_OR_MORE:67,ONLY_ONE:68,MD_PARENT:69,NON_IDENTIFYING:70,IDENTIFYING:71,WORD:72,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",60:",",61:"ATTRIBUTE_KEY",62:"COMMENT",65:"ZERO_OR_ONE",66:"ZERO_OR_MORE",67:"ONE_OR_MORE",68:"ONLY_ONE",69:"MD_PARENT",70:"NON_IDENTIFYING",71:"IDENTIFYING",72:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[55,1],[56,1],[56,3],[59,1],[57,1],[12,3],[63,1],[63,1],[63,1],[63,1],[63,1],[64,1],[64,1],[14,1],[14,1],[14,1]],performAction:o(function(Ie,Ee,we,Me,$e,de,rt){var ke=de.length-1;switch($e){case 1:break;case 2:this.$=[];break;case 3:de[ke-1].push(de[ke]),this.$=de[ke-1];break;case 4:case 5:this.$=de[ke];break;case 6:case 7:this.$=[];break;case 8:Me.addEntity(de[ke-4]),Me.addEntity(de[ke-2]),Me.addRelationship(de[ke-4],de[ke],de[ke-2],de[ke-3]);break;case 9:Me.addEntity(de[ke-8]),Me.addEntity(de[ke-4]),Me.addRelationship(de[ke-8],de[ke],de[ke-4],de[ke-5]),Me.setClass([de[ke-8]],de[ke-6]),Me.setClass([de[ke-4]],de[ke-2]);break;case 10:Me.addEntity(de[ke-6]),Me.addEntity(de[ke-2]),Me.addRelationship(de[ke-6],de[ke],de[ke-2],de[ke-3]),Me.setClass([de[ke-6]],de[ke-4]);break;case 11:Me.addEntity(de[ke-6]),Me.addEntity(de[ke-4]),Me.addRelationship(de[ke-6],de[ke],de[ke-4],de[ke-5]),Me.setClass([de[ke-4]],de[ke-2]);break;case 12:Me.addEntity(de[ke-3]),Me.addAttributes(de[ke-3],de[ke-1]);break;case 13:Me.addEntity(de[ke-5]),Me.addAttributes(de[ke-5],de[ke-1]),Me.setClass([de[ke-5]],de[ke-3]);break;case 14:Me.addEntity(de[ke-2]);break;case 15:Me.addEntity(de[ke-4]),Me.setClass([de[ke-4]],de[ke-2]);break;case 16:Me.addEntity(de[ke]);break;case 17:Me.addEntity(de[ke-2]),Me.setClass([de[ke-2]],de[ke]);break;case 18:Me.addEntity(de[ke-6],de[ke-4]),Me.addAttributes(de[ke-6],de[ke-1]);break;case 19:Me.addEntity(de[ke-8],de[ke-6]),Me.addAttributes(de[ke-8],de[ke-1]),Me.setClass([de[ke-8]],de[ke-3]);break;case 20:Me.addEntity(de[ke-5],de[ke-3]);break;case 21:Me.addEntity(de[ke-7],de[ke-5]),Me.setClass([de[ke-7]],de[ke-2]);break;case 22:Me.addEntity(de[ke-3],de[ke-1]);break;case 23:Me.addEntity(de[ke-5],de[ke-3]),Me.setClass([de[ke-5]],de[ke]);break;case 24:case 25:this.$=de[ke].trim(),Me.setAccTitle(this.$);break;case 26:case 27:this.$=de[ke].trim(),Me.setAccDescription(this.$);break;case 32:Me.setDirection("TB");break;case 33:Me.setDirection("BT");break;case 34:Me.setDirection("RL");break;case 35:Me.setDirection("LR");break;case 36:this.$=de[ke-3],Me.addClass(de[ke-2],de[ke-1]);break;case 37:case 38:case 59:case 67:this.$=[de[ke]];break;case 39:case 40:this.$=de[ke-2].concat([de[ke]]);break;case 41:this.$=de[ke-2],Me.setClass(de[ke-1],de[ke]);break;case 42:this.$=de[ke-3],Me.addCssStyles(de[ke-2],de[ke-1]);break;case 43:this.$=[de[ke]];break;case 44:de[ke-2].push(de[ke]),this.$=de[ke-2];break;case 46:this.$=de[ke-1]+de[ke];break;case 54:case 79:case 80:this.$=de[ke].replace(/"/g,"");break;case 55:case 56:case 57:case 58:case 81:this.$=de[ke];break;case 60:de[ke].push(de[ke-1]),this.$=de[ke];break;case 61:this.$={type:de[ke-1],name:de[ke]};break;case 62:this.$={type:de[ke-2],name:de[ke-1],keys:de[ke]};break;case 63:this.$={type:de[ke-2],name:de[ke-1],comment:de[ke]};break;case 64:this.$={type:de[ke-3],name:de[ke-2],keys:de[ke-1],comment:de[ke]};break;case 65:case 66:case 69:this.$=de[ke];break;case 68:de[ke-2].push(de[ke]),this.$=de[ke-2];break;case 70:this.$=de[ke].replace(/"/g,"");break;case 71:this.$={cardA:de[ke],relType:de[ke-1],cardB:de[ke-2]};break;case 72:this.$=Me.Cardinality.ZERO_OR_ONE;break;case 73:this.$=Me.Cardinality.ZERO_OR_MORE;break;case 74:this.$=Me.Cardinality.ONE_OR_MORE;break;case 75:this.$=Me.Cardinality.ONLY_ONE;break;case 76:this.$=Me.Cardinality.MD_PARENT;break;case 77:this.$=Me.Identification.NON_IDENTIFYING;break;case 78:this.$=Me.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:r,24:i,26:n,28:a,29:14,30:15,31:16,32:17,33:s,34:l,35:u,36:h,37:d,40:f,43:p,44:m,48:g,50:y,51:v,52:x},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:30,11:9,22:r,24:i,26:n,28:a,29:14,30:15,31:16,32:17,33:s,34:l,35:u,36:h,37:d,40:f,43:p,44:m,48:g,50:y,51:v,52:x},e(t,[2,5]),e(t,[2,6]),e(t,[2,16],{12:31,63:35,15:[1,32],17:[1,33],20:[1,34],65:b,66:T,67:w,68:C,69:k}),{23:[1,41]},{25:[1,42]},{27:[1,43]},e(t,[2,27]),e(t,[2,28]),e(t,[2,29]),e(t,[2,30]),e(t,[2,31]),e(E,[2,54]),e(E,[2,55]),e(E,[2,56]),e(E,[2,57]),e(E,[2,58]),e(t,[2,32]),e(t,[2,33]),e(t,[2,34]),e(t,[2,35]),{16:44,40:A,41:N},{16:47,40:A,41:N},{16:48,40:A,41:N},e(t,[2,4]),{11:49,40:f,48:g,50:y,51:v,52:x},{16:50,40:A,41:N},{18:51,19:[1,52],53:53,54:54,58:P},{11:56,40:f,48:g,50:y,51:v,52:x},{64:57,70:[1,58],71:[1,59]},e(I,[2,72]),e(I,[2,73]),e(I,[2,74]),e(I,[2,75]),e(I,[2,76]),e(t,[2,24]),e(t,[2,25]),e(t,[2,26]),{13:D,38:60,41:_,42:R,45:62,46:63,48:M,49:L},e(B,[2,37]),e(B,[2,38]),{16:68,40:A,41:N,42:R},{13:D,38:69,41:_,42:R,45:62,46:63,48:M,49:L},{13:[1,70],15:[1,71]},e(t,[2,17],{63:35,12:72,17:[1,73],42:R,65:b,66:T,67:w,68:C,69:k}),{19:[1,74]},e(t,[2,14]),{18:75,19:[2,59],53:53,54:54,58:P},{55:76,58:[1,77]},{58:[2,65]},{21:[1,78]},{63:79,65:b,66:T,67:w,68:C,69:k},e(O,[2,77]),e(O,[2,78]),{6:$,10:G,39:80,42:F,47:V},{40:[1,85],41:[1,86]},e(H,[2,43],{46:87,13:D,41:_,48:M,49:L}),e(j,[2,45]),e(j,[2,50]),e(j,[2,51]),e(j,[2,52]),e(j,[2,53]),e(t,[2,41],{42:R}),{6:$,10:G,39:88,42:F,47:V},{14:89,40:U,50:Q,72:Y},{16:93,40:A,41:N},{11:94,40:f,48:g,50:y,51:v,52:x},{18:95,19:[1,96],53:53,54:54,58:P},e(t,[2,12]),{19:[2,60]},e(ae,[2,61],{56:97,57:98,59:99,61:J,62:te}),e([19,58,61,62],[2,66]),e(t,[2,22],{15:[1,103],17:[1,102]}),e([40,48,50,51,52],[2,71]),e(t,[2,36]),{13:D,41:_,45:104,46:63,48:M,49:L},e(t,[2,47]),e(t,[2,48]),e(t,[2,49]),e(B,[2,39]),e(B,[2,40]),e(j,[2,46]),e(t,[2,42]),e(t,[2,8]),e(t,[2,79]),e(t,[2,80]),e(t,[2,81]),{13:[1,105],42:R},{13:[1,107],15:[1,106]},{19:[1,108]},e(t,[2,15]),e(ae,[2,62],{57:109,60:[1,110],62:te}),e(ae,[2,63]),e(re,[2,67]),e(ae,[2,70]),e(re,[2,69]),{18:111,19:[1,112],53:53,54:54,58:P},{16:113,40:A,41:N},e(H,[2,44],{46:87,13:D,41:_,48:M,49:L}),{14:114,40:U,50:Q,72:Y},{16:115,40:A,41:N},{14:116,40:U,50:Q,72:Y},e(t,[2,13]),e(ae,[2,64]),{59:117,61:J},{19:[1,118]},e(t,[2,20]),e(t,[2,23],{17:[1,119],42:R}),e(t,[2,11]),{13:[1,120],42:R},e(t,[2,10]),e(re,[2,68]),e(t,[2,18]),{18:121,19:[1,122],53:53,54:54,58:P},{14:123,40:U,50:Q,72:Y},{19:[1,124]},e(t,[2,21]),e(t,[2,9]),e(t,[2,19])],defaultActions:{55:[2,65],75:[2,60]},parseError:o(function(Ie,Ee){if(Ee.recoverable)this.trace(Ie);else{var we=new Error(Ie);throw we.hash=Ee,we}},"parseError"),parse:o(function(Ie){var Ee=this,we=[0],Me=[],$e=[null],de=[],rt=this.table,ke="",Fe=0,He=0,at=0,qe=2,Ue=1,ye=de.slice.call(arguments,1),ve=Object.create(this.lexer),ie={yy:{}};for(var fe in this.yy)Object.prototype.hasOwnProperty.call(this.yy,fe)&&(ie.yy[fe]=this.yy[fe]);ve.setInput(Ie,ie.yy),ie.yy.lexer=ve,ie.yy.parser=this,typeof ve.yylloc>"u"&&(ve.yylloc={});var W=ve.yylloc;de.push(W);var ce=ve.options&&ve.options.ranges;typeof ie.yy.parseError=="function"?this.parseError=ie.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function K(kt){we.length=we.length-2*kt,$e.length=$e.length-kt,de.length=de.length-kt}o(K,"popStack");function Re(){var kt;return kt=Me.pop()||ve.lex()||Ue,typeof kt!="number"&&(kt instanceof Array&&(Me=kt,kt=Me.pop()),kt=Ee.symbols_[kt]||kt),kt}o(Re,"lex");for(var xe,Oe,be,Be,Ae,Ve,Pe={},Ye,le,st,me;;){if(be=we[we.length-1],this.defaultActions[be]?Be=this.defaultActions[be]:((xe===null||typeof xe>"u")&&(xe=Re()),Be=rt[be]&&rt[be][xe]),typeof Be>"u"||!Be.length||!Be[0]){var ot="";me=[];for(Ye in rt[be])this.terminals_[Ye]&&Ye>qe&&me.push("'"+this.terminals_[Ye]+"'");ve.showPosition?ot="Parse error on line "+(Fe+1)+`: +`+ve.showPosition()+` +Expecting `+me.join(", ")+", got '"+(this.terminals_[xe]||xe)+"'":ot="Parse error on line "+(Fe+1)+": Unexpected "+(xe==Ue?"end of input":"'"+(this.terminals_[xe]||xe)+"'"),this.parseError(ot,{text:ve.match,token:this.terminals_[xe]||xe,line:ve.yylineno,loc:W,expected:me})}if(Be[0]instanceof Array&&Be.length>1)throw new Error("Parse Error: multiple actions possible at state: "+be+", token: "+xe);switch(Be[0]){case 1:we.push(xe),$e.push(ve.yytext),de.push(ve.yylloc),we.push(Be[1]),xe=null,Oe?(xe=Oe,Oe=null):(He=ve.yyleng,ke=ve.yytext,Fe=ve.yylineno,W=ve.yylloc,at>0&&at--);break;case 2:if(le=this.productions_[Be[1]][1],Pe.$=$e[$e.length-le],Pe._$={first_line:de[de.length-(le||1)].first_line,last_line:de[de.length-1].last_line,first_column:de[de.length-(le||1)].first_column,last_column:de[de.length-1].last_column},ce&&(Pe._$.range=[de[de.length-(le||1)].range[0],de[de.length-1].range[1]]),Ve=this.performAction.apply(Pe,[ke,He,Fe,ie.yy,Be[1],$e,de].concat(ye)),typeof Ve<"u")return Ve;le&&(we=we.slice(0,-1*le*2),$e=$e.slice(0,-1*le),de=de.slice(0,-1*le)),we.push(this.productions_[Be[1]][0]),$e.push(Pe.$),de.push(Pe._$),st=rt[we[we.length-2]][we[we.length-1]],we.push(st);break;case 3:return!0}}return!0},"parse")},Te=(function(){var De={EOF:1,parseError:o(function(Ee,we){if(this.yy.parser)this.yy.parser.parseError(Ee,we);else throw new Error(Ee)},"parseError"),setInput:o(function(Ie,Ee){return this.yy=Ee||this.yy||{},this._input=Ie,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var Ie=this._input[0];this.yytext+=Ie,this.yyleng++,this.offset++,this.match+=Ie,this.matched+=Ie;var Ee=Ie.match(/(?:\r\n?|\n).*/g);return Ee?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Ie},"input"),unput:o(function(Ie){var Ee=Ie.length,we=Ie.split(/(?:\r\n?|\n)/g);this._input=Ie+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Ee),this.offset-=Ee;var Me=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),we.length-1&&(this.yylineno-=we.length-1);var $e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:we?(we.length===Me.length?this.yylloc.first_column:0)+Me[Me.length-we.length].length-we[0].length:this.yylloc.first_column-Ee},this.options.ranges&&(this.yylloc.range=[$e[0],$e[0]+this.yyleng-Ee]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(Ie){this.unput(this.match.slice(Ie))},"less"),pastInput:o(function(){var Ie=this.matched.substr(0,this.matched.length-this.match.length);return(Ie.length>20?"...":"")+Ie.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var Ie=this.match;return Ie.length<20&&(Ie+=this._input.substr(0,20-Ie.length)),(Ie.substr(0,20)+(Ie.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var Ie=this.pastInput(),Ee=new Array(Ie.length+1).join("-");return Ie+this.upcomingInput()+` +`+Ee+"^"},"showPosition"),test_match:o(function(Ie,Ee){var we,Me,$e;if(this.options.backtrack_lexer&&($e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&($e.yylloc.range=this.yylloc.range.slice(0))),Me=Ie[0].match(/(?:\r\n?|\n).*/g),Me&&(this.yylineno+=Me.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:Me?Me[Me.length-1].length-Me[Me.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Ie[0].length},this.yytext+=Ie[0],this.match+=Ie[0],this.matches=Ie,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(Ie[0].length),this.matched+=Ie[0],we=this.performAction.call(this,this.yy,this,Ee,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),we)return we;if(this._backtrack){for(var de in $e)this[de]=$e[de];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Ie,Ee,we,Me;this._more||(this.yytext="",this.match="");for(var $e=this._currentRules(),de=0;de<$e.length;de++)if(we=this._input.match(this.rules[$e[de]]),we&&(!Ee||we[0].length>Ee[0].length)){if(Ee=we,Me=de,this.options.backtrack_lexer){if(Ie=this.test_match(we,$e[de]),Ie!==!1)return Ie;if(this._backtrack){Ee=!1;continue}else return!1}else if(!this.options.flex)break}return Ee?(Ie=this.test_match(Ee,$e[Me]),Ie!==!1?Ie:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var Ee=this.next();return Ee||this.lex()},"lex"),begin:o(function(Ee){this.conditionStack.push(Ee)},"begin"),popState:o(function(){var Ee=this.conditionStack.length-1;return Ee>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(Ee){return Ee=this.conditionStack.length-1-Math.abs(Ee||0),Ee>=0?this.conditionStack[Ee]:"INITIAL"},"topState"),pushState:o(function(Ee){this.begin(Ee)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(Ee,we,Me,$e){var de=$e;switch(Me){case 0:return this.begin("acc_title"),24;break;case 1:return this.popState(),"acc_title_value";break;case 2:return this.begin("acc_descr"),26;break;case 3:return this.popState(),"acc_descr_value";break;case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return 33;case 8:return 34;case 9:return 35;case 10:return 36;case 11:return 10;case 12:break;case 13:return 8;case 14:return 50;case 15:return 72;case 16:return 4;case 17:return this.begin("block"),17;break;case 18:return 49;case 19:return 49;case 20:return 42;case 21:return 15;case 22:return 13;case 23:break;case 24:return 61;case 25:return 58;case 26:return 58;case 27:return 62;case 28:break;case 29:return this.popState(),19;break;case 30:return we.yytext[0];case 31:return 20;case 32:return 21;case 33:return this.begin("style"),44;break;case 34:return this.popState(),10;break;case 35:break;case 36:return 13;case 37:return 42;case 38:return 49;case 39:return this.begin("style"),37;break;case 40:return 43;case 41:return 65;case 42:return 67;case 43:return 67;case 44:return 67;case 45:return 65;case 46:return 65;case 47:return 66;case 48:return 66;case 49:return 66;case 50:return 66;case 51:return 66;case 52:return 67;case 53:return 66;case 54:return 67;case 55:return 68;case 56:return 68;case 57:return 51;case 58:return 68;case 59:return 68;case 60:return 68;case 61:return 52;case 62:return 48;case 63:return 68;case 64:return 65;case 65:return 66;case 66:return 67;case 67:return 69;case 68:return 70;case 69:return 71;case 70:return 71;case 71:return 70;case 72:return 70;case 73:return 70;case 74:return 41;case 75:return 47;case 76:return 40;case 77:return we.yytext[0];case 78:return 6}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:#)/i,/^(?:#)/i,/^(?:,)/i,/^(?::::)/i,/^(?::)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:([^\s]*)[~].*[~]([^\s]*))/i,/^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:style\b)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?::)/i,/^(?:,)/i,/^(?:#)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:[0-9]+\.[0-9]+)/i,/^(?:1(?=\s+[A-Za-z_"']))/i,/^(?:1(?=\s+[0-9]))/i,/^(?:1(?=(--|\.\.|\.-|-\.)))/i,/^(?:1\b)/i,/^(?:[0-9]+)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:u(?=[\.\-\|]))/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:;)/i,/^(?:([^\x00-\x7F]|\w|-|\*|\.)+)/i,/^(?:.)/i,/^(?:$)/i],conditions:{style:{rules:[34,35,36,37,38,74,75],inclusive:!1},acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},block:{rules:[23,24,25,26,27,28,29,30],inclusive:!1},INITIAL:{rules:[0,2,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,31,32,33,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,76,77,78],inclusive:!0}}};return De})();ee.lexer=Te;function ue(){this.yy={}}return o(ue,"Parser"),ue.prototype=ee,ee.Parser=ue,new ue})();qP.parser=qP;a1e=qP});var fE,o1e=z(()=>{"use strict";St();Ut();Ci();Xt();fE=class{constructor(){this.entities=new Map;this.relationships=[];this.classes=new Map;this.direction="TB";this.Cardinality={ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE",MD_PARENT:"MD_PARENT"};this.Identification={NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"};this.setAccTitle=Cr;this.getAccTitle=kr;this.setAccDescription=wr;this.getAccDescription=Sr;this.setDiagramTitle=Ar;this.getDiagramTitle=Er;this.getConfig=o(()=>ge().er,"getConfig");this.clear(),this.addEntity=this.addEntity.bind(this),this.addAttributes=this.addAttributes.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setDirection=this.setDirection.bind(this),this.addCssStyles=this.addCssStyles.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{o(this,"ErDB")}addEntity(t,r=""){return this.entities.has(t)?!this.entities.get(t)?.alias&&r&&(this.entities.get(t).alias=r,Z.info(`Add alias '${r}' to entity '${t}'`)):(this.entities.set(t,{id:`entity-${t}-${this.entities.size}`,label:t,attributes:[],alias:r,shape:"erBox",look:ge().look??"default",cssClasses:"default",cssStyles:[],labelType:"markdown"}),Z.info("Added new entity :",t)),this.entities.get(t)}getEntity(t){return this.entities.get(t)}getEntities(){return this.entities}getClasses(){return this.classes}addAttributes(t,r){let i=this.addEntity(t),n;for(n=r.length-1;n>=0;n--)r[n].keys||(r[n].keys=[]),r[n].comment||(r[n].comment=""),i.attributes.push(r[n]),Z.debug("Added attribute ",r[n].name)}addRelationship(t,r,i,n){let a=this.entities.get(t),s=this.entities.get(i);if(!a||!s)return;let l={entityA:a.id,roleA:r,entityB:s.id,relSpec:n};this.relationships.push(l),Z.debug("Added new relationship :",l)}getRelationships(){return this.relationships}getDirection(){return this.direction}setDirection(t){this.direction=t}getCompiledStyles(t){let r=[];for(let i of t){let n=this.classes.get(i);n?.styles&&(r=[...r,...n.styles??[]].map(a=>a.trim())),n?.textStyles&&(r=[...r,...n.textStyles??[]].map(a=>a.trim()))}return r}addCssStyles(t,r){for(let i of t){let n=this.entities.get(i);if(!r||!n)return;for(let a of r)n.cssStyles.push(a)}}addClass(t,r){t.forEach(i=>{let n=this.classes.get(i);n===void 0&&(n={id:i,styles:[],textStyles:[]},this.classes.set(i,n)),r&&r.forEach(function(a){if(/color/.exec(a)){let s=a.replace("fill","bgFill");n.textStyles.push(s)}n.styles.push(a)})})}setClass(t,r){for(let i of t){let n=this.entities.get(i);if(n)for(let a of r)n.cssClasses+=" "+a}}clear(){this.entities=new Map,this.classes=new Map,this.relationships=[],gr()}getData(){let t=[],r=[],i=ge(),n=0;for(let s of this.entities.keys()){let l=this.entities.get(s);l&&(l.cssCompiledStyles=this.getCompiledStyles(l.cssClasses.split(" ")),l.colorIndex=n++,t.push(l))}let a=0;for(let s of this.relationships){let l={id:bc(s.entityA,s.entityB,{prefix:"id",counter:a++}),type:"normal",curve:"basis",start:s.entityA,end:s.entityB,label:s.roleA,labelpos:"c",thickness:"normal",classes:"relationshipLine",arrowTypeStart:s.relSpec.cardB.toLowerCase(),arrowTypeEnd:s.relSpec.cardA.toLowerCase(),pattern:s.relSpec.relType=="IDENTIFYING"?"solid":"dashed",look:i.look,labelType:"markdown"};r.push(l)}return{nodes:t,edges:r,other:{},config:i,direction:"TB"}}}});var UP={};xr(UP,{draw:()=>alt});var alt,l1e=z(()=>{"use strict";Ut();St();Lp();tf();rf();Xt();Rr();alt=o(async function(e,t,r,i){Z.info("REF0:"),Z.info("Drawing er diagram (unified)",t);let{securityLevel:n,er:a,layout:s}=ge(),l=i.db.getData(),u=Fo(t,n);l.type=i.type,l.layoutAlgorithm=Gc(s),l.config.flowchart.nodeSpacing=a?.nodeSpacing||140,l.config.flowchart.rankSpacing=a?.rankSpacing||80,l.direction=i.db.getDirection();let{config:h}=l,{look:d}=h;d==="neo"?l.markers=["only_one_neo","zero_or_one_neo","one_or_more_neo","zero_or_more_neo"]:l.markers=["only_one","zero_or_one","one_or_more","zero_or_more"],l.diagramId=t,await Zo(l,u),l.layoutAlgorithm==="elk"&&u.select(".edges").lower();let f=u.selectAll('[id*="-background"]');Array.from(f).length>0&&f.each(function(){let m=Je(this),y=m.attr("id").replace("-background",""),v=u.select(`#${CSS.escape(y)}`);if(!v.empty()){let x=v.attr("transform");m.attr("transform",x)}});let p=8;Zt.insertTitle(u,"erDiagramTitleText",a?.titleTopMargin??25,i.db.getDiagramTitle()),$s(u,p,"erDiagram",a?.useMaxWidth??!0)},"draw")});var c1e,pE,slt,olt,u1e,h1e=z(()=>{"use strict";Cn();c1e=o((e,t)=>{let r=Ff,i=r(e,"r"),n=r(e,"g"),a=r(e,"b");return mn(i,n,a,t)},"fade"),pE=new Set(["redux-color","redux-dark-color"]),slt=o(e=>{let{theme:t,look:r,bkgColorArray:i,borderColorArray:n}=e;if(!pE.has(t))return"";let a=i?.length>0,s="";for(let l=0;l{let{look:t,theme:r,erEdgeLabelBackground:i,strokeWidth:n}=e;return` + ${slt(e)} + .entityBox { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + } + + .relationshipLabelBox { + fill: ${e.tertiaryColor}; + opacity: 0.7; + background-color: ${e.tertiaryColor}; + rect { + opacity: 0.5; + } + } + + .labelBkg { + background-color: ${pE.has(r)&&i?i:c1e(e.tertiaryColor,.5)}; + } + + .edgeLabel { + background-color: ${pE.has(r)&&i?i:e.edgeLabelBackground}; + } + .edgeLabel .label rect { + fill: ${pE.has(r)&&i?i:e.edgeLabelBackground}; + } + .edgeLabel .label text { + fill: ${e.textColor}; + } + + .edgeLabel .label { + fill: ${e.nodeBorder}; + font-size: 14px; + } + + .label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor||e.textColor}; + } + + .edge-pattern-dashed { + stroke-dasharray: 8,8; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon + { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: ${t==="neo"?n:"1px"}; + } + + .relationshipLine { + stroke: ${e.lineColor}; + stroke-width: ${t==="neo"?n:"1px"}; + fill: none; + } + + .marker { + fill: none !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; + } + [data-look=neo].labelBkg { + background-color: ${c1e(e.tertiaryColor,.5)}; + } +`},"getStyles"),u1e=olt});var d1e={};xr(d1e,{diagram:()=>llt});var llt,f1e=z(()=>{"use strict";s1e();o1e();l1e();h1e();llt={parser:a1e,get db(){return new fE},renderer:UP,styles:u1e}});function Rn(e){return typeof e=="object"&&e!==null&&typeof e.$type=="string"}function ss(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"ref"in e}function Qc(e){return typeof e=="object"&&e!==null&&typeof e.$refText=="string"&&"items"in e}function f$(e){return typeof e=="object"&&e!==null&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.path=="string"}function g0(e){return typeof e=="object"&&e!==null&&typeof e.info=="object"&&typeof e.message=="string"}function oh(e){return typeof e=="object"&&e!==null&&Array.isArray(e.content)}function q0(e){return typeof e=="object"&&e!==null&&typeof e.tokenType=="object"}function H5(e){return oh(e)&&typeof e.fullText=="string"}function hve(e){return typeof e=="string"?e:typeof e>"u"?"undefined":typeof e.toString=="function"?e.toString():Object.prototype.toString.call(e)}function rT(e){return!!e&&typeof e[Symbol.iterator]=="function"}function gi(...e){if(e.length===1){let t=e[0];if(t instanceof Kc)return t;if(rT(t))return new Kc(()=>t[Symbol.iterator](),r=>r.next());if(typeof t.length=="number")return new Kc(()=>({index:0}),r=>r.index1?new Kc(()=>({collIndex:0,arrIndex:0}),t=>{do{if(t.iterator){let r=t.iterator.next();if(!r.done)return r;t.iterator=void 0}if(t.array){if(t.arrIndex{Rn(n)&&(n.$container=e,n.$containerProperty=r,n.$containerIndex=a,t.deep&&j1(n,t))}):Rn(i)&&(i.$container=e,i.$containerProperty=r,t.deep&&j1(i,t)))}function U0(e,t){let r=e;for(;r;){if(t(r))return r;r=r.$container}}function dve(e,t){let r=e;for(;r;){if(t(r))return!0;r=r.$container}return!1}function Wl(e){let r=V1(e).$document;if(!r)throw new Error("AST node has no document.");return r}function V1(e){for(;e.$container;)e=e.$container;return e}function r5(e){return ss(e)?e.ref?[e.ref]:[]:Qc(e)?e.items.map(t=>t.ref):[]}function CT(e,t){if(!e)throw new Error("Node must be an AstNode.");let r=t?.range;return new Kc(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),i=>{for(;i.keyIndexCT(r,t))}function ql(e,t){if(e){if(t?.range&&!i5(e,t.range))return new Y1(e,()=>[])}else throw new Error("Root node must be an AstNode.");return new Y1(e,r=>CT(r,t),{includeRoot:!0})}function i5(e,t){if(!t)return!0;let r=e.$cstNode?.range;return r?$$(r,t):!1}function X1(e){return new Kc(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),t=>{for(;t.keyIndexoh(t)?t.content:[],{includeRoot:!0})}function Lve(e){return Z1(e).filter(q0)}function B$(e,t){for(;e.container;)if(e=e.container,e===t)return!0;return!1}function nT(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function Q1(e){if(!e)return;let{offset:t,end:r,range:i}=e;return{range:i,offset:t,end:r,length:r-t}}function F$(e,t){if(e.end.linet.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return Xc.After;let r=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,i=e.end.lineXc.After}function Mve(e,t,r=z$){if(e){if(t>0){let i=t-e.offset,n=e.text.charAt(i);r.test(n)||t--}return J5(e,t)}}function G$(e,t){if(e){let r=q$(e,!0);if(r&&v5(r,t))return r;if(H5(e)){let i=e.content.findIndex(n=>!n.hidden);for(let n=i-1;n>=0;n--){let a=e.content[n];if(v5(a,t))return a}}}}function v5(e,t){return q0(e)&&t.includes(e.tokenType.name)}function J5(e,t){if(q0(e))return e;if(oh(e)){let r=W$(e,t,!1);if(r)return J5(r,t)}}function V$(e,t){if(q0(e))return e;if(oh(e)){let r=W$(e,t,!0);if(r)return V$(r,t)}}function W$(e,t,r){let i=0,n=e.content.length-1,a;for(;i<=n;){let s=Math.floor((i+n)/2),l=e.content[s];if(l.offset<=t&&l.end>t)return l;l.end<=t?(a=r?l:void 0,i=s+1):n=s-1}return a}function q$(e,t=!0){for(;e.container;){let r=e.container,i=r.content.indexOf(e);for(;i>0;){i--;let n=r.content[i];if(t||!n.hidden)return n}e=r}}function Nve(e,t=!0){for(;e.container;){let r=e.container,i=r.content.indexOf(e),n=r.content.length-1;for(;it.test(r))}function sy(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X$(e,t){let r=K$(e),i=t.match(r);return!!i&&i[0].length>0}function K$(e){typeof e=="string"&&(e=new RegExp(e));let t=e,r=e.source,i=0;function n(){let a="",s;function l(h){a+=r.substr(i,h),i+=h}o(l,"appendRaw"),S(l,"appendRaw");function u(h){a+="(?:"+r.substr(i,h)+"|$)",i+=h}for(o(u,"appendOptional"),S(u,"appendOptional");i",i)-i+1);break;default:u(2);break}break;case"[":s=/\[(?:\\.|.)*?\]/g,s.lastIndex=i,s=s.exec(r)||[],u(s[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":l(1);break;case"{":s=/\{\d+,?\d*\}/g,s.lastIndex=i,s=s.exec(r),s?l(s[0].length):u(1);break;case"(":if(r[i+1]==="?")switch(r[i+2]){case":":a+="(?:",i+=3,a+=n()+"|$)";break;case"=":a+="(?=",i+=3,a+=n()+")";break;case"!":s=i,i+=3,n(),a+=r.substr(s,i-s);break;case"<":switch(r[i+3]){case"=":case"!":s=i,i+=4,n(),a+=r.substr(s,i-s);break;default:l(r.indexOf(">",i)-i+1),a+=n()+"|$)";break}break}else l(1),a+=n()+"|$)";break;case")":return++i,a;default:u(1);break}return a}return o(n,"process2"),S(n,"process"),new RegExp(n(),e.flags)}function Z$(e){return e.rules.find(t=>cs(t)&&t.entry)}function Q$(e){return e.rules.filter(t=>rl(t)&&t.hidden)}function iA(e,t){let r=new Set,i=Z$(e);if(!i)return new Set(e.rules);let n=[i].concat(Q$(e));for(let s of n)J$(s,r,t);let a=new Set;for(let s of e.rules)(r.has(s.name)||rl(s)&&s.hidden)&&a.add(s);return a}function J$(e,t,r){t.add(e.name),yh(e).forEach(i=>{if(uh(i)||r&&K5(i)){let n=i.rule.ref;n&&!t.has(n.name)&&J$(n,t,r)}})}function Vve(e){let t=new Set;return yh(e).forEach(r=>{Y0(r)&&(cs(r.type.ref)&&t.add(r.type.ref),kT(r.type.ref)&&cs(r.type.ref.$container)&&t.add(r.type.ref.$container))}),t}function ez(e){if(e.terminal)return e.terminal;if(e.type.ref)return oA(e.type.ref)?.terminal}function tz(e){return e.hidden&&!rA(ET(e))}function rz(e,t){return!e||!t?[]:aA(e,t,e.astNode,!0)}function nA(e,t,r){if(!e||!t)return;let i=aA(e,t,e.astNode,!0);if(i.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,i.length-1)):r=0,i[r]}function aA(e,t,r,i){if(!i){let n=U0(e.grammarSource,lh);if(n&&n.feature===t)return[e]}return oh(e)&&e.astNode===r?e.content.flatMap(n=>aA(n,t,r,!1)):[]}function Wve(e,t){return e?sA(e,t,e?.astNode):[]}function iz(e,t,r){if(!e)return;let i=sA(e,t,e?.astNode);if(i.length!==0)return r!==void 0?r=Math.max(0,Math.min(r,i.length-1)):r=0,i[r]}function sA(e,t,r){if(e.astNode!==r)return[];if(ch(e.grammarSource)&&e.grammarSource.value===t)return[e];let i=Z1(e).iterator(),n,a=[];do if(n=i.next(),!n.done){let s=n.value;s.astNode===r?ch(s.grammarSource)&&s.grammarSource.value===t&&a.push(s):i.prune()}while(!n.done);return a}function nz(e){let t=e.astNode;for(;t===e.container?.astNode;){let r=U0(e.grammarSource,lh);if(r)return r;e=e.container}}function oA(e){let t=e;return kT(t)&&(pf(t.$container)?t=t.$container.$container:H0(t.$container)?t=t.$container:bf(t.$container)),az(e,t,new Map)}function az(e,t,r){function i(n,a){let s;return U0(n,lh)||(s=az(a,a,r)),r.set(e,s),s}if(o(i,"go"),S(i,"go"),r.has(e))return r.get(e);r.set(e,void 0);for(let n of yh(t)){if(lh(n)&&n.feature.toLowerCase()==="name")return r.set(e,n),n;if(uh(n)&&cs(n.rule.ref))return i(n,n.rule.ref);if(X5(n)&&n.typeRef?.ref)return i(n,n.typeRef.ref)}}function sz(e){let t=e.$container;if(j0(t)){let r=t.elements,i=r.indexOf(e);for(let n=i-1;n>=0;n--){let a=r[n];if(pf(a))return a;{let s=yh(r[n]).find(pf);if(s)return s}}}if(Y5(t))return sz(t)}function qve(e,t){return e==="?"||e==="*"||j0(t)&&!!t.guardCondition}function Uve(e){return e==="*"||e==="+"}function Hve(e){return e==="+="}function wT(e){return oz(e,new Set)}function oz(e,t){if(t.has(e))return!0;t.add(e);for(let r of yh(e))if(uh(r)){if(!r.rule.ref||cs(r.rule.ref)&&!oz(r.rule.ref,t)||K1(r.rule.ref))return!1}else{if(lh(r))return!1;if(pf(r))return!1}return!!e.definition}function Yve(e){return T5(e.type,new Set)}function T5(e,t){if(t.has(e))return!0;if(t.add(e),v$(e))return!1;if(_$(e))return!1;if(N$(e))return e.types.every(r=>T5(r,t));if(X5(e)){if(e.primitiveType!==void 0)return!0;if(e.stringType!==void 0)return!0;if(e.typeRef!==void 0){let r=e.typeRef.ref;return Z5(r)?T5(r.type,t):!1}else return!1}else return!1}function ST(e){if(!rl(e)){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){let t=e.returnType.ref;if(t)return t.name}}}function $0(e){if(H0(e))return cs(e)&&wT(e)?e.name:ST(e)??e.name;if(w$(e)||Z5(e)||R$(e))return e.name;if(pf(e)){let t=lz(e);if(t)return t}else if(kT(e))return e.name;throw new Error("Cannot get name of Unknown Type")}function lz(e){if(e.inferredType)return e.inferredType.name;if(e.type?.ref)return $0(e.type.ref)}function jve(e){return rl(e)?e.type?.name??"string":cs(e)&&wT(e)?e.name:ST(e)??e.name}function cz(e){return rl(e)?e.type?.name??"string":ST(e)??e.name}function ET(e){let t={s:!1,i:!1,u:!1},r=X0(e.definition,t),i=Object.entries(t).filter(([,n])=>n).map(([n])=>n).join("");return new RegExp(r,i)}function X0(e,t){if(L$(e))return Xve(e);if(M$(e))return Kve(e);if(b$(e))return Jve(e);if(K5(e)){let r=e.rule.ref;if(!r)throw new Error("Missing rule reference.");return Jc(X0(r.definition),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}else{if(S$(e))return Qve(e);if(I$(e))return Zve(e);if(D$(e)){let r=e.regex.lastIndexOf("/"),i=e.regex.substring(1,r),n=e.regex.substring(r+1);return t&&(t.i=n.includes("i"),t.s=n.includes("s"),t.u=n.includes("u")),Jc(i,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}else{if(O$(e))return Jc(uz,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized});throw new Error(`Invalid terminal element: ${e?.$type}, ${e?.$cstNode?.text}`)}}}function Xve(e){return Jc(e.elements.map(t=>X0(t)).join("|"),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function Kve(e){return Jc(e.elements.map(t=>X0(t)).join(""),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function Zve(e){return Jc(`${uz}*?${X0(e.terminal)}`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function Qve(e){return Jc(`(?!${X0(e.terminal)})${uz}*?`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized})}function Jve(e){return e.right?Jc(`[${VE(e.left)}-${VE(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1}):Jc(VE(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,parenthesized:e.parenthesized,wrap:!1})}function VE(e){return sy(e.value)}function Jc(e,t){return(t.parenthesized||t.lookahead||t.wrap!==!1)&&(e=`(${t.lookahead??(t.parenthesized?"":"?:")}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function hz(e){let t=[],r=e.Grammar;for(let i of r.rules)rl(i)&&tz(i)&&j$(ET(i))&&t.push(i.name);return{multilineCommentRules:t,nameRegexp:z$}}function rxe(e){var t=ict.call(e,x2),r=e[x2];try{e[x2]=void 0;var i=!0}catch{}var n=nct.call(e);return i&&(t?e[x2]=r:delete e[x2]),n}function ixe(e){return oct.call(e)}function nxe(e){return e==null?e===void 0?uct:cct:v1e&&v1e in Object(e)?act(e):lct(e)}function axe(e){return e!=null&&typeof e=="object"}function sxe(e){return typeof e=="symbol"||Yl(e)&&Tf(e)==hct}function oxe(e,t){for(var r=-1,i=e==null?0:e.length,n=Array(i);++r0){if(++t>=jct)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Sxe(e){return function(){return e}}function Exe(e,t){for(var r=-1,i=e==null?0:e.length;++r-1}function Oxe(e,t){var r=typeof e;return t=t??sut,!!t&&(r=="number"||r!="symbol"&&out.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=hut}function Wxe(e){return e!=null&&gz(e.length)&&!vh(e)}function qxe(e,t,r){if(!tl(r))return!1;var i=typeof t;return(i=="number"?ru(r)&&cA(t,r.length):i=="string"&&t in r)?DT(r[t],e):!1}function Uxe(e){return mz(function(t,r){var i=-1,n=r.length,a=n>1?r[n-1]:void 0,s=n>2?r[2]:void 0;for(a=e.length>3&&typeof a=="function"?(n--,a):void 0,s&&hA(r[0],r[1],s)&&(a=n<3?void 0:a,n=1),t=Object(t);++i-1}function Cbe(e,t){var r=this.__data__,i=pA(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function J0(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t0&&r(l)?t>1?Tz(l,t-1,r,i,n):bz(n,l):i||(n[n.length]=l)}return n}function Fbe(e){var t=e==null?0:e.length;return t?Cz(e,1):[]}function zbe(e,t,r){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),r=r>n?n:r,r<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(n);++il))return!1;var h=a.get(e),d=a.get(t);if(h&&d)return h==t&&d==e;var f=-1,p=!0,m=r&zft?new Ez:void 0;for(a.set(e,t),a.set(t,e);++f=Npt&&(a=Az,s=!1,t=new Ez(t));e:for(;++n-1?n[a?t[s]:s]:void 0}}function CTe(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var n=r==null?0:_T(r);return n<0&&(n=zpt(i+n,0)),Dxe(e,iu(t,3),n)}function kTe(e){return e&&e.length?e[0]:void 0}function wTe(e,t){var r=-1,i=ru(e)?Array(e.length):[];return rm(e,function(n,a,s){i[++r]=t(n,a,s)}),i}function STe(e,t){var r=Kr(e)?AT:Wpt;return r(e,iu(t,3))}function ETe(e,t){return Cz(nr(e,t),1)}function ATe(e,t){return e!=null&&Xpt.call(e,t)}function _Te(e,t){return e!=null&&H2e(e,t,Kpt)}function DTe(e){return typeof e=="string"||!Kr(e)&&Yl(e)&&Tf(e)==Zpt}function RTe(e,t){return AT(t,function(r){return e[r]})}function LTe(e){return e==null?[]:Qpt(e,po(e))}function MTe(e,t,r,i){e=ru(e)?e:Hn(e),r=r&&!i?_T(r):0;var n=e.length;return r<0&&(r=Jpt(n+r,0)),Vs(e)?r<=n&&e.indexOf(t,r)>-1:!!n&&fz(e,t,r)>-1}function NTe(e,t,r){var i=e==null?0:e.length;if(!i)return-1;var n=r==null?0:_T(r);return n<0&&(n=e0t(i+n,0)),fz(e,t,n)}function ITe(e){if(e==null)return!0;if(ru(e)&&(Kr(e)||typeof e=="string"||typeof e.splice=="function"||aT(e)||yz(e)||dA(e)))return!e.length;var t=ey(e);if(t==t0t||t==r0t)return!e.size;if(LT(e))return!sbe(e).length;for(var r in e)if(n0t.call(e,r))return!1;return!0}function OTe(e){return Yl(e)&&Tf(e)==a0t}function PTe(e){return e===void 0}function BTe(e){if(typeof e!="function")throw new TypeError(l0t);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function FTe(e,t,r,i){if(!tl(e))return e;t=xA(t,e);for(var n=-1,a=t.length,s=a-1,l=e;l!=null&&++n=y0t){var h=t?null:g0t(e);if(h)return _z(h);s=!1,n=Az,u=new Ez}else u=t?[]:l;e:for(;++iuT(i,t)):e instanceof us&&fs(t,e)?!1:e instanceof nu?(e instanceof us&&t.push(e),Hl(e.definition,i=>uT(i,t))):!1}function JTe(e){return e instanceof Us}function Gl(e){if(e instanceof us)return"SUBRULE";if(e instanceof Ca)return"OPTION";if(e instanceof Us)return"OR";if(e instanceof yo)return"AT_LEAST_ONE";if(e instanceof vo)return"AT_LEAST_ONE_SEP";if(e instanceof qs)return"MANY_SEP";if(e instanceof hn)return"MANY";if(e instanceof Wi)return"CONSUME";throw Error("non exhaustive match")}function bF(e,t,r){return[new Ca({definition:[new Wi({terminalType:e.separator})].concat(e.definition)})].concat(t,r)}function cy(e){if(e instanceof us)return cy(e.referencedRule);if(e instanceof Wi)return rCe(e);if(QTe(e))return eCe(e);if(JTe(e))return tCe(e);throw Error("non exhaustive match")}function eCe(e){let t=[],r=e.definition,i=0,n=r.length>i,a,s=!0;for(;n&&s;)a=r[i],s=uT(a),t=t.concat(cy(a)),i=i+1,n=r.length>i;return Lz(t)}function tCe(e){let t=nr(e.definition,r=>cy(r));return Lz(Ul(t))}function rCe(e){return[e.terminalType]}function nCe(e){let t={};return vr(e,r=>{let i=new x0t(r).startWalking();mo(t,i)}),t}function aCe(e,t){return e.name+t+iCe}function OT(e){let t=e.toString();if(WE.hasOwnProperty(t))return WE[t];{let r=b0t.pattern(t);return WE[t]=r,r}}function sCe(){WE={}}function lCe(e,t=!1){try{let r=OT(e);return E5(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===oCe)t&&Mz(`${S5} Unable to optimize: < ${e.toString()} > + Complement Sets cannot be automatically optimized. + This will disable the lexer's first char optimizations. + See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let i="";t&&(i=` + This will disable the lexer's first char optimizations. + See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),w5(`${S5} + Failed parsing: < ${e.toString()} > + Using the @chevrotain/regexp-to-ast library + Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+i)}}return[]}function E5(e,t,r){switch(e.type){case"Disjunction":for(let n=0;n{if(typeof u=="number")O2(u,t,r);else{let h=u;if(r===!0)for(let d=h.from;d<=h.to;d++)O2(d,t,r);else{for(let d=h.from;d<=h.to&&d=B2){let d=h.from>=B2?h.from:B2,f=h.to,p=fh(d),m=fh(f);for(let g=p;g<=m;g++)t[g]=g}}}});break;case"Group":E5(s.value,t,r);break;default:throw Error("Non Exhaustive Match")}let l=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&A5(s)===!1||s.type!=="Group"&&l===!1)break}break;default:throw Error("non exhaustive match!")}return Hn(t)}function O2(e,t,r){let i=fh(e);t[i]=i,r===!0&&cCe(e,t)}function cCe(e,t){let r=String.fromCharCode(e),i=r.toUpperCase();if(i!==r){let n=fh(i.charCodeAt(0));t[n]=n}else{let n=r.toLowerCase();if(n!==r){let a=fh(n.charCodeAt(0));t[a]=a}}}function TF(e,t){return ty(e.value,r=>{if(typeof r=="number")return fs(t,r);{let i=r;return ty(t,n=>i.from<=n&&n<=i.to)!==void 0}})}function A5(e){let t=e.quantifier;return t&&t.atLeast===0?!0:e.value?Kr(e.value)?Hl(e.value,A5):A5(e.value):!1}function kA(e,t){if(t instanceof RegExp){let r=OT(t),i=new T0t(e);return i.visit(r),i.found}else return ty(t,r=>fs(e,r.charCodeAt(0)))!==void 0}function hCe(e,t){t=Rz(t,{useSticky:uCe,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` +`],tracer:S((b,T)=>T(),"tracer")});let r=t.tracer;r("initCharCodeToOptimizedIndexMap",()=>{MCe()});let i;r("Reject Lexer.NA",()=>{i=TA(e,b=>b[G0]===ls.NA)});let n=!1,a;r("Transform Patterns",()=>{n=!1,a=nr(i,b=>{let T=b[G0];if(hh(T)){let w=T.source;return w.length===1&&w!=="^"&&w!=="$"&&w!=="."&&!T.ignoreCase?w:w.length===2&&w[0]==="\\"&&!fs(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],w[1])?w[1]:t.useSticky?kF(T):CF(T)}else{if(vh(T))return n=!0,{exec:T};if(typeof T=="object")return n=!0,T;if(typeof T=="string"){if(T.length===1)return T;{let w=T.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),C=new RegExp(w);return t.useSticky?kF(C):CF(C)}}else throw Error("non exhaustive match")}})});let s,l,u,h,d;r("misc mapping",()=>{s=nr(i,b=>b.tokenTypeIdx),l=nr(i,b=>{let T=b.GROUP;if(T!==ls.SKIPPED){if(Vs(T))return T;if(dh(T))return!1;throw Error("non exhaustive match")}}),u=nr(i,b=>{let T=b.LONGER_ALT;if(T)return Kr(T)?nr(T,C=>K1e(i,C)):[K1e(i,T)]}),h=nr(i,b=>b.PUSH_MODE),d=nr(i,b=>mr(b,"POP_MODE"))});let f;r("Line Terminator Handling",()=>{let b=Bz(t.lineTerminatorCharacters);f=nr(i,T=>!1),t.positionTracking!=="onlyOffset"&&(f=nr(i,T=>mr(T,"LINE_BREAKS")?!!T.LINE_BREAKS:Pz(T,b)===!1&&kA(b,T.PATTERN)))});let p,m,g,y;r("Misc Mapping #2",()=>{p=nr(i,Oz),m=nr(a,RCe),g=go(i,(b,T)=>{let w=T.GROUP;return Vs(w)&&w!==ls.SKIPPED&&(b[w]=[]),b},{}),y=nr(a,(b,T)=>({pattern:a[T],longerAlt:u[T],canLineTerminator:f[T],isCustom:p[T],short:m[T],group:l[T],push:h[T],pop:d[T],tokenTypeIdx:s[T],tokenType:i[T]}))});let v=!0,x=[];return t.safeMode||r("First Char Optimization",()=>{x=go(i,(b,T,w)=>{if(typeof T.PATTERN=="string"){let C=T.PATTERN.charCodeAt(0),k=fh(C);qE(b,k,y[w])}else if(Kr(T.START_CHARS_HINT)){let C;vr(T.START_CHARS_HINT,k=>{let E=typeof k=="string"?k.charCodeAt(0):k,A=fh(E);C!==A&&(C=A,qE(b,A,y[w]))})}else if(hh(T.PATTERN))if(T.PATTERN.unicode)v=!1,t.ensureOptimizations&&w5(`${S5} Unable to analyze < ${T.PATTERN.toString()} > pattern. + The regexp unicode flag is not currently supported by the regexp-to-ast library. + This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let C=lCe(T.PATTERN,t.ensureOptimizations);Oi(C)&&(v=!1),vr(C,k=>{qE(b,k,y[w])})}else t.ensureOptimizations&&w5(`${S5} TokenType: <${T.name}> is using a custom token pattern without providing parameter. + This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),v=!1;return b},[])}),{emptyGroups:g,patternIdxToConfig:y,charCodeToPatternIdxToConfig:x,hasCustom:n,canBeOptimized:v}}function dCe(e,t){let r=[],i=pCe(e);r=r.concat(i.errors);let n=mCe(i.valid),a=n.valid;return r=r.concat(n.errors),r=r.concat(fCe(a)),r=r.concat(TCe(a)),r=r.concat(CCe(a,t)),r=r.concat(kCe(a)),r}function fCe(e){let t=[],r=il(e,i=>hh(i[G0]));return t=t.concat(gCe(r)),t=t.concat(vCe(r)),t=t.concat(xCe(r)),t=t.concat(bCe(r)),t=t.concat(yCe(r)),t}function pCe(e){let t=il(e,n=>!mr(n,G0)),r=nr(t,n=>({message:"Token Type: ->"+n.name+"<- missing static 'PATTERN' property",type:dn.MISSING_PATTERN,tokenTypes:[n]})),i=bA(e,t);return{errors:r,valid:i}}function mCe(e){let t=il(e,n=>{let a=n[G0];return!hh(a)&&!vh(a)&&!mr(a,"exec")&&!Vs(a)}),r=nr(t,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:dn.INVALID_PATTERN,tokenTypes:[n]})),i=bA(e,t);return{errors:r,valid:i}}function gCe(e){class t extends tA{static{o(this,"EndAnchorFinder")}static{S(this,"EndAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitEndAnchor(a){this.found=!0}}let r=il(e,n=>{let a=n.PATTERN;try{let s=OT(a),l=new t;return l.visit(s),l.found}catch{return C0t.test(a.source)}});return nr(r,n=>({message:`Unexpected RegExp Anchor Error: + Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain end of input anchor '$' + See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:dn.EOI_ANCHOR_FOUND,tokenTypes:[n]}))}function yCe(e){let t=il(e,i=>i.PATTERN.test(""));return nr(t,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' must not match an empty string",type:dn.EMPTY_MATCH_PATTERN,tokenTypes:[i]}))}function vCe(e){class t extends tA{static{o(this,"StartAnchorFinder")}static{S(this,"StartAnchorFinder")}constructor(){super(...arguments),this.found=!1}visitStartAnchor(a){this.found=!0}}let r=il(e,n=>{let a=n.PATTERN;try{let s=OT(a),l=new t;return l.visit(s),l.found}catch{return k0t.test(a.source)}});return nr(r,n=>({message:`Unexpected RegExp Anchor Error: + Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain start of input anchor '^' + See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:dn.SOI_ANCHOR_FOUND,tokenTypes:[n]}))}function xCe(e){let t=il(e,i=>{let n=i[G0];return n instanceof RegExp&&(n.multiline||n.global)});return nr(t,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:dn.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[i]}))}function bCe(e){let t=[],r=nr(e,a=>go(e,(s,l)=>(a.PATTERN.source===l.PATTERN.source&&!fs(t,l)&&l.PATTERN!==ls.NA&&(t.push(l),s.push(l)),s),[]));r=IT(r);let i=il(r,a=>a.length>1);return nr(i,a=>{let s=nr(a,u=>u.name);return{message:`The same RegExp pattern ->${jl(a).PATTERN}<-has been used in all of the following Token Types: ${s.join(", ")} <-`,type:dn.DUPLICATE_PATTERNS_FOUND,tokenTypes:a}})}function TCe(e){let t=il(e,i=>{if(!mr(i,"GROUP"))return!1;let n=i.GROUP;return n!==ls.SKIPPED&&n!==ls.NA&&!Vs(n)});return nr(t,i=>({message:"Token Type: ->"+i.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:dn.INVALID_GROUP_TYPE_FOUND,tokenTypes:[i]}))}function CCe(e,t){let r=il(e,n=>n.PUSH_MODE!==void 0&&!fs(t,n.PUSH_MODE));return nr(r,n=>({message:`Token Type: ->${n.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${n.PUSH_MODE}<-which does not exist`,type:dn.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[n]}))}function kCe(e){let t=[],r=go(e,(i,n,a)=>{let s=n.PATTERN;return s===ls.NA||(Vs(s)?i.push({str:s,idx:a,tokenType:n}):hh(s)&&SCe(s)&&i.push({str:s.source,idx:a,tokenType:n})),i},[]);return vr(e,(i,n)=>{vr(r,({str:a,idx:s,tokenType:l})=>{if(n${l.name}<- can never be matched. +Because it appears AFTER the Token Type ->${i.name}<-in the lexer's definition. +See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:u,type:dn.UNREACHABLE_PATTERN,tokenTypes:[i,l]})}})}),t}function wCe(e,t){if(hh(t)){if(ECe(t))return!1;let r=t.exec(e);return r!==null&&r.index===0}else{if(vh(t))return t(e,0,[],{});if(mr(t,"exec"))return t.exec(e,0,[],{});if(typeof t=="string")return t===e;throw Error("non exhaustive match")}}function SCe(e){return ty([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>e.source.indexOf(r)!==-1)===void 0}function ECe(e){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\? property in its definition +`,type:dn.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),mr(e,yE)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+yE+`> property in its definition +`,type:dn.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),mr(e,yE)&&mr(e,P2)&&!mr(e.modes,e.defaultMode)&&i.push({message:`A MultiMode Lexer cannot be initialized with a ${P2}: <${e.defaultMode}>which does not exist +`,type:dn.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),mr(e,yE)&&vr(e.modes,(n,a)=>{vr(n,(s,l)=>{if(dh(s))i.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${a}> at index: <${l}> +`,type:dn.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(mr(s,"LONGER_ALT")){let u=Kr(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT];vr(u,h=>{!dh(h)&&!fs(n,h)&&i.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${h.name}> on token <${s.name}> outside of mode <${a}> +`,type:dn.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),i}function _Ce(e,t,r){let i=[],n=!1,a=IT(Ul(Hn(e.modes))),s=TA(a,u=>u[G0]===ls.NA),l=Bz(r);return t&&vr(s,u=>{let h=Pz(u,l);if(h!==!1){let f={message:LCe(u,h),type:h.issue,tokenType:u};i.push(f)}else mr(u,"LINE_BREAKS")?u.LINE_BREAKS===!0&&(n=!0):kA(l,u.PATTERN)&&(n=!0)}),t&&!n&&i.push({message:`Warning: No LINE_BREAKS Found. + This Lexer has been defined to track line and column information, + But none of the Token Types can be identified as matching a line terminator. + See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS + for details.`,type:dn.NO_LINE_BREAKS_FLAGS}),i}function DCe(e){let t={},r=po(e);return vr(r,i=>{let n=e[i];if(Kr(n))t[i]=[];else throw Error("non exhaustive match")}),t}function Oz(e){let t=e.PATTERN;if(hh(t))return!1;if(vh(t))return!0;if(mr(t,"exec"))return!0;if(Vs(t))return!1;throw Error("non exhaustive match")}function RCe(e){return Vs(e)&&e.length===1?e.charCodeAt(0):!1}function Pz(e,t){if(mr(e,"LINE_BREAKS"))return!1;if(hh(e.PATTERN)){try{kA(t,e.PATTERN)}catch(r){return{issue:dn.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(Vs(e.PATTERN))return!1;if(Oz(e))return{issue:dn.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function LCe(e,t){if(t.issue===dn.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern. + The problem is in the <${e.name}> Token Type + Root cause: ${t.errMsg}. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===dn.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the option. + The problem is in the <${e.name}> Token Type + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Bz(e){return nr(e,r=>Vs(r)?r.charCodeAt(0):r)}function qE(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function fh(e){return e255?255+~~(e/255):e}}function uy(e,t){let r=e.tokenTypeIdx;return r===t.tokenTypeIdx?!0:t.isParent===!0&&t.categoryMatchesMap[r]===!0}function hT(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}function hy(e){let t=ICe(e);OCe(t),BCe(t),PCe(t),vr(t,r=>{r.isParent=r.categoryMatches.length>0})}function ICe(e){let t=ka(e),r=e,i=!0;for(;i;){r=IT(Ul(nr(r,a=>a.CATEGORIES)));let n=bA(r,t);t=t.concat(n),Oi(n)?i=!1:r=n}return t}function OCe(e){vr(e,t=>{$z(t)||(NCe[Q1e]=t,t.tokenTypeIdx=Q1e++),wF(t)&&!Kr(t.CATEGORIES)&&(t.CATEGORIES=[t.CATEGORIES]),wF(t)||(t.CATEGORIES=[]),FCe(t)||(t.categoryMatches=[]),$Ce(t)||(t.categoryMatchesMap={})})}function PCe(e){vr(e,t=>{t.categoryMatches=[],vr(t.categoryMatchesMap,(r,i)=>{t.categoryMatches.push(NCe[i].tokenTypeIdx)})})}function BCe(e){vr(e,t=>{Fz([],t)})}function Fz(e,t){vr(e,r=>{t.categoryMatchesMap[r.tokenTypeIdx]=!0}),vr(t.CATEGORIES,r=>{let i=e.concat(t);fs(i,r)||Fz(i,r)})}function $z(e){return mr(e,"tokenTypeIdx")}function wF(e){return mr(e,"CATEGORIES")}function FCe(e){return mr(e,"categoryMatches")}function $Ce(e){return mr(e,"categoryMatchesMap")}function zCe(e){return mr(e,"tokenTypeIdx")}function B0(e){return zz(e)?e.LABEL:e.name}function zz(e){return Vs(e.LABEL)&&e.LABEL!==""}function q1(e){return GCe(e)}function GCe(e){let t=e.pattern,r={};if(r.name=e.name,dh(t)||(r.PATTERN=t),mr(e,S0t))throw`The parent property is no longer supported. +See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return mr(e,J1e)&&(r.CATEGORIES=e[J1e]),hy([r]),mr(e,eye)&&(r.LABEL=e[eye]),mr(e,tye)&&(r.GROUP=e[tye]),mr(e,iye)&&(r.POP_MODE=e[iye]),mr(e,rye)&&(r.PUSH_MODE=e[rye]),mr(e,nye)&&(r.LONGER_ALT=e[nye]),mr(e,aye)&&(r.LINE_BREAKS=e[aye]),mr(e,sye)&&(r.START_CHARS_HINT=e[sye]),r}function PT(e,t,r,i,n,a,s,l){return{image:t,startOffset:r,endOffset:i,startLine:n,endLine:a,startColumn:s,endColumn:l,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}function Gz(e,t){return uy(e,t)}function VCe(e,t){let r=new A0t(e,t);return r.resolveRefs(),r.errors}function _5(e,t,r=[]){r=ka(r);let i=[],n=0;function a(l){return l.concat(Ta(e,n+1))}o(a,"remainingPathWith"),S(a,"remainingPathWith");function s(l){let u=_5(a(l),t,r);return i.concat(u)}for(o(s,"getAlternativesForProd"),S(s,"getAlternativesForProd");r.length{Oi(u.definition)===!1&&(i=s(u.definition))}),i;if(l instanceof Wi)r.push(l.terminalType);else throw Error("non exhaustive match")}n++}return i.push({partialPath:r,suffixDef:Ta(e,n)}),i}function Vz(e,t,r,i){let n="EXIT_NONE_TERMINAL",a=[n],s="EXIT_ALTERNATIVE",l=!1,u=t.length,h=u-i-1,d=[],f=[];for(f.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!Oi(f);){let p=f.pop();if(p===s){l&&z0(f).idx<=h&&f.pop();continue}let m=p.def,g=p.idx,y=p.ruleStack,v=p.occurrenceStack;if(Oi(m))continue;let x=m[0];if(x===n){let b={idx:g,def:Ta(m),ruleStack:cT(y),occurrenceStack:cT(v)};f.push(b)}else if(x instanceof Wi)if(g=0;b--){let T=x.definition[b],w={idx:g,def:T.definition.concat(Ta(m)),ruleStack:y,occurrenceStack:v};f.push(w),f.push(s)}else if(x instanceof Ws)f.push({idx:g,def:x.definition.concat(Ta(m)),ruleStack:y,occurrenceStack:v});else if(x instanceof oy)f.push(WCe(x,g,y,v));else throw Error("non exhaustive match")}return d}function WCe(e,t,r,i){let n=ka(r);n.push(e.name);let a=ka(i);return a.push(1),{idx:t,def:e.definition,ruleStack:n,occurrenceStack:a}}function SA(e){if(e instanceof Ca||e==="Option")return en.OPTION;if(e instanceof hn||e==="Repetition")return en.REPETITION;if(e instanceof yo||e==="RepetitionMandatory")return en.REPETITION_MANDATORY;if(e instanceof vo||e==="RepetitionMandatoryWithSeparator")return en.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof qs||e==="RepetitionWithSeparator")return en.REPETITION_WITH_SEPARATOR;if(e instanceof Us||e==="Alternation")return en.ALTERNATION;throw Error("non exhaustive match")}function EF(e){let{occurrence:t,rule:r,prodType:i,maxLookahead:n}=e,a=SA(i);return a===en.ALTERNATION?BT(t,r,n):FT(t,r,a,n)}function qCe(e,t,r,i,n,a){let s=BT(e,t,r),l=qz(s)?hT:uy;return a(s,i,l,n)}function UCe(e,t,r,i,n,a){let s=FT(e,t,n,r),l=qz(s)?hT:uy;return a(s[0],l,i)}function HCe(e,t,r,i){let n=e.length,a=Hl(e,s=>Hl(s,l=>l.length===1));if(t)return function(s){let l=nr(s,u=>u.GATE);for(let u=0;uUl(u)),l=go(s,(u,h,d)=>(vr(h,f=>{mr(u,f.tokenTypeIdx)||(u[f.tokenTypeIdx]=d),vr(f.categoryMatches,p=>{mr(u,p)||(u[p]=d)})}),u),{});return function(){let u=this.LA(1);return l[u.tokenTypeIdx]}}else return function(){for(let s=0;sa.length===1),n=e.length;if(i&&!r){let a=Ul(e);if(a.length===1&&Oi(a[0].categoryMatches)){let l=a[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===l}}else{let s=go(a,(l,u,h)=>(l[u.tokenTypeIdx]=!0,vr(u.categoryMatches,d=>{l[d]=!0}),l),[]);return function(){let l=this.LA(1);return s[l.tokenTypeIdx]===!0}}}else return function(){e:for(let a=0;a_5([s],1)),i=AF(r.length),n=nr(r,s=>{let l={};return vr(s,u=>{let h=HE(u.partialPath);vr(h,d=>{l[d]=!0})}),l}),a=r;for(let s=1;s<=t;s++){let l=a;a=AF(l.length);for(let u=0;u{let x=HE(v.partialPath);vr(x,b=>{n[u][b]=!0})})}}}}return i}function BT(e,t,r,i){let n=new jCe(e,en.ALTERNATION,i);return t.accept(n),Wz(n.result,r)}function FT(e,t,r,i){let n=new jCe(e,r);t.accept(n);let a=n.result,l=new M0t(t,e,r).startWalking(),u=new Ws({definition:a}),h=new Ws({definition:l});return Wz([u,h],i)}function D5(e,t){e:for(let r=0;r{let n=t[i];return r===n||n.categoryMatchesMap[r.tokenTypeIdx]})}function qz(e){return Hl(e,t=>Hl(t,r=>Hl(r,i=>Oi(i.categoryMatches))))}function ZCe(e){let t=e.lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName});return nr(t,r=>Object.assign({type:hs.CUSTOM_LOOKAHEAD_VALIDATION},r))}function QCe(e,t,r,i){let n=Jo(e,u=>JCe(u,r)),a=cke(e,t,r),s=Jo(e,u=>ake(u,r)),l=Jo(e,u=>tke(u,e,i,r));return n.concat(a,s,l)}function JCe(e,t){let r=new N0t;e.accept(r);let i=r.allProductions,n=Ypt(i,eke),a=Xl(n,l=>l.length>1);return nr(Hn(a),l=>{let u=jl(l),h=t.buildDuplicateFoundError(e,l),d=Gl(u),f={message:h,type:hs.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:d,occurrence:u.idx},p=Uz(u);return p&&(f.parameter=p),f})}function eke(e){return`${Gl(e)}_#_${e.idx}_#_${Uz(e)}`}function Uz(e){return e instanceof Wi?e.terminalType.name:e instanceof us?e.nonTerminalName:""}function tke(e,t,r,i){let n=[];if(go(t,(s,l)=>l.name===e.name?s+1:s,0)>1){let s=i.buildDuplicateRuleNameError({topLevelRule:e,grammarName:r});n.push({message:s,type:hs.DUPLICATE_RULE_NAME,ruleName:e.name})}return n}function rke(e,t,r){let i=[],n;return fs(t,e)||(n=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,i.push({message:n,type:hs.INVALID_RULE_OVERRIDE,ruleName:e})),i}function Hz(e,t,r,i=[]){let n=[],a=Z2(t.definition);if(Oi(a))return[];{let s=e.name;fs(a,e)&&n.push({message:r.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:i}),type:hs.LEFT_RECURSION,ruleName:s});let u=bA(a,i.concat([e])),h=Jo(u,d=>{let f=ka(i);return f.push(d),Hz(e,d,r,f)});return n.concat(h)}}function Z2(e){let t=[];if(Oi(e))return t;let r=jl(e);if(r instanceof us)t.push(r.referencedRule);else if(r instanceof Ws||r instanceof Ca||r instanceof yo||r instanceof vo||r instanceof qs||r instanceof hn)t=t.concat(Z2(r.definition));else if(r instanceof Us)t=Ul(nr(r.definition,a=>Z2(a.definition)));else if(!(r instanceof Wi))throw Error("non exhaustive match");let i=uT(r),n=e.length>1;if(i&&n){let a=Ta(e);return t.concat(Z2(a))}else return t}function ike(e,t){let r=new Yz;e.accept(r);let i=r.alternations;return Jo(i,a=>{let s=cT(a.definition);return Jo(s,(l,u)=>{let h=Vz([l],[],uy,1);return Oi(h)?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:a,emptyChoiceIdx:u}),type:hs.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:a.idx,alternative:u+1}]:[]})})}function nke(e,t,r){let i=new Yz;e.accept(i);let n=i.alternations;return n=TA(n,s=>s.ignoreAmbiguities===!0),Jo(n,s=>{let l=s.idx,u=s.maxLookahead||t,h=BT(l,e,u,s),d=oke(h,s,e,r),f=lke(h,s,e,r);return d.concat(f)})}function ake(e,t){let r=new Yz;e.accept(r);let i=r.alternations;return Jo(i,a=>a.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:a}),type:hs.TOO_MANY_ALTS,ruleName:e.name,occurrence:a.idx}]:[])}function ske(e,t,r){let i=[];return vr(e,n=>{let a=new I0t;n.accept(a);let s=a.allProductions;vr(s,l=>{let u=SA(l),h=l.maxLookahead||t,d=l.idx,p=FT(d,n,u,h)[0];if(Oi(Ul(p))){let m=r.buildEmptyRepetitionError({topLevelRule:n,repetition:l});i.push({message:m,type:hs.NO_NON_EMPTY_LOOKAHEAD,ruleName:n.name})}})}),i}function oke(e,t,r,i){let n=[],a=go(e,(l,u,h)=>(t.definition[h].ignoreAmbiguities===!0||vr(u,d=>{let f=[h];vr(e,(p,m)=>{h!==m&&D5(p,d)&&t.definition[m].ignoreAmbiguities!==!0&&f.push(m)}),f.length>1&&!D5(n,d)&&(n.push(d),l.push({alts:f,path:d}))}),l),[]);return nr(a,l=>{let u=nr(l.alts,d=>d+1);return{message:i.buildAlternationAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:u,prefixPath:l.path}),type:hs.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:t.idx,alternatives:l.alts}})}function lke(e,t,r,i){let n=go(e,(s,l,u)=>{let h=nr(l,d=>({idx:u,path:d}));return s.concat(h)},[]);return IT(Jo(n,s=>{if(t.definition[s.idx].ignoreAmbiguities===!0)return[];let u=s.idx,h=s.path,d=il(n,p=>t.definition[p.idx].ignoreAmbiguities!==!0&&p.idx{let m=[p.idx+1,u+1],g=t.idx===0?"":t.idx;return{message:i.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:t,ambiguityIndices:m,prefixPath:p.path}),type:hs.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:g,alternatives:m}})}))}function cke(e,t,r){let i=[],n=nr(t,a=>a.name);return vr(e,a=>{let s=a.name;if(fs(n,s)){let l=r.buildNamespaceConflictError(a);i.push({message:l,type:hs.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:s})}}),i}function uke(e){let t=Rz(e,{errMsgProvider:E0t}),r={};return vr(e.rules,i=>{r[i.name]=i}),VCe(r,t.errMsgProvider)}function hke(e){return e=Rz(e,{errMsgProvider:I0}),QCe(e.rules,e.tokenTypes,e.errMsgProvider,e.grammarName)}function dT(e){return fs(gke,e.name)}function xke(e,t,r,i,n,a,s){let l=this.getKeyForAutomaticLookahead(i,n),u=this.firstAfterRepMap[l];if(u===void 0){let p=this.getCurrRuleFullName(),m=this.getGAstProductions()[p];u=new a(m,n).startWalking(),this.firstAfterRepMap[l]=u}let h=u.token,d=u.occurrence,f=u.isEndOfRule;this.RULE_STACK.length===1&&f&&h===void 0&&(h=gf,d=1),!(h===void 0||d===void 0)&&this.shouldInRepetitionRecoveryBeTried(h,d,s)&&this.tryInRepetitionRecovery(e,t,r,h)}function jE(e,t,r){return r|t|e}function Cke(e){vE.reset(),e.accept(vE);let t=vE.dslMethods;return vE.reset(),t}function LF(e,t){isNaN(e.startOffset)===!0?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffsets.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: + ${a.join(` + +`).replace(/\n/g,` + `)}`)}},"validateVisitor")};return r.prototype=i,r.prototype.constructor=r,r._RULE_NAMES=t,r}function Ake(e,t,r){let i=S(function(){},"derivedConstructor");Xz(i,e+"BaseSemanticsWithDefaults");let n=Object.create(r.prototype);return vr(t,a=>{n[a]=Ske}),i.prototype=n,i.prototype.constructor=i,i}function _ke(e,t){return Dke(e,t)}function Dke(e,t){let r=il(t,n=>vh(e[n])===!1),i=nr(r,n=>({msg:`Missing visitor method: <${n}> on ${e.constructor.name} CST Visitor.`,type:NF.MISSING_METHOD,methodName:n}));return IT(i)}function L1(e,t,r,i=!1){fT(r);let n=z0(this.recordingProdStack),a=vh(t)?t:t.DEF,s=new e({definition:[],idx:r});return i&&(s.separator=t.SEP),mr(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(s),a.call(this),n.definition.push(s),this.recordingProdStack.pop(),AA}function Mke(e,t){fT(t);let r=z0(this.recordingProdStack),i=Kr(e)===!1,n=i===!1?e:e.DEF,a=new Us({definition:[],idx:t,ignoreAmbiguities:i&&e.IGNORE_AMBIGUITIES===!0});mr(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD);let s=HTe(n,l=>vh(l.GATE));return a.hasPredicates=s,r.definition.push(a),vr(n,l=>{let u=new Ws({definition:[]});a.definition.push(u),mr(l,"IGNORE_AMBIGUITIES")?u.ignoreAmbiguities=l.IGNORE_AMBIGUITIES:mr(l,"GATE")&&(u.ignoreAmbiguities=!0),this.recordingProdStack.push(u),l.ALT.call(this),this.recordingProdStack.pop()}),AA}function IF(e){return e===0?"":`${e}`}function fT(e){if(e<0||e>uye){let t=new Error(`Invalid DSL Method idx value: <${e}> + Idx value must be a none negative value smaller than ${uye+1}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}function Nke(e,t){t.forEach(r=>{let i=r.prototype;Object.getOwnPropertyNames(i).forEach(n=>{if(n==="constructor")return;let a=Object.getOwnPropertyDescriptor(i,n);a&&(a.get||a.set)?Object.defineProperty(e.prototype,n,a):e.prototype[n]=r.prototype[n]})})}function OF(e=void 0){return function(){return e}}function Oke(e,t){for(var r=-1,i=e==null?0:e.length,n=Array(i);++r-1}function qke(e,t){var r=this.__data__,i=_A(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}function im(e){var t=-1,r=e==null?0:e.length;for(this.clear();++tl))return!1;var h=a.get(e),d=a.get(t);if(h&&d)return h==t&&d==e;var f=-1,p=!0,m=r&fgt?new kwe:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=jgt}function Ywe(e){return ry(e)&&Jz(e.length)&&!!Vi[dy(e)]}function jwe(e){return function(t){return e(t)}}function Kwe(e,t){var r=ds(e),i=!r&&MA(e),n=!r&&!i&&M5(e),a=!r&&!i&&!n&&eG(e),s=r||i||n||a,l=s?Bgt(e.length,String):[],u=l.length;for(var h in e)(t||S1t.call(e,h))&&!(s&&(h=="length"||n&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Uwe(h,u)))&&l.push(h);return l}function Zwe(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||A1t;return e===r}function Jwe(e,t){return function(r){return e(t(r))}}function e4e(e){if(!Qwe(e))return R1t(e);var t=[];for(var r in Object(e))M1t.call(e,r)&&r!="constructor"&&t.push(r);return t}function r4e(e){return e!=null&&Jz(e.length)&&!rwe(e)}function i4e(e){return NA(e)?E1t(e):t4e(e)}function n4e(e){return Lgt(e,tG,Pgt)}function a4e(e,t,r,i,n,a){var s=r&N1t,l=Cye(e),u=l.length,h=Cye(t),d=h.length;if(u!=d&&!s)return!1;for(var f=u;f--;){var p=l[f];if(!(s?p in t:O1t.call(t,p)))return!1}var m=a.get(e),g=a.get(t);if(m&&g)return m==t&&g==e;var y=!0;a.set(e,t),a.set(t,e);for(var v=s;++fcG(e,t,s));return lm(e,t,i,r,...n)}function Q4e(e,t,r){let i=Yn(e,t,r,{type:yf});bh(e,i);let n=lm(e,t,i,r,kf(e,t,r));return J4e(e,t,r,n)}function kf(e,t,r){let i=Iyt(sh(r.definition,n=>cG(e,t,n)),n=>n!==void 0);return i.length===1?i[0]:i.length===0?void 0:tSe(e,i)}function uG(e,t,r,i,n){let a=i.left,s=i.right,l=Yn(e,t,r,{type:$yt});bh(e,l);let u=Yn(e,t,r,{type:W4e});return a.loopback=l,u.loopback=l,e.decisionMap[V0(t,n?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",r.idx)]=l,vn(s,l),n===void 0?(vn(l,a),vn(l,u)):(vn(l,u),vn(l,n.left),vn(n.right,a)),{left:a,right:u}}function hG(e,t,r,i,n){let a=i.left,s=i.right,l=Yn(e,t,r,{type:Fyt});bh(e,l);let u=Yn(e,t,r,{type:W4e}),h=Yn(e,t,r,{type:Byt});return l.loopback=h,u.loopback=h,vn(l,a),vn(l,u),vn(s,h),n!==void 0?(vn(h,u),vn(h,n.left),vn(n.right,a)):vn(h,l),e.decisionMap[V0(t,n?"RepetitionWithSeparator":"Repetition",r.idx)]=l,{left:l,right:u}}function J4e(e,t,r,i){let n=i.left,a=i.right;return vn(n,a),e.decisionMap[V0(t,"Option",r.idx)]=n,i}function bh(e,t){return e.decisionStates.push(t),t.decision=e.decisionStates.length-1,t.decision}function lm(e,t,r,i,...n){let a=Yn(e,t,i,{type:Pyt,start:r});r.end=a;for(let l of n)l!==void 0?(vn(r,l.left),vn(l.right,a)):vn(r,a);let s={left:r,right:a};return e.decisionMap[V0(t,eSe(i),i.idx)]=r,s}function eSe(e){if(e instanceof Us)return"Alternation";if(e instanceof Ca)return"Option";if(e instanceof hn)return"Repetition";if(e instanceof qs)return"RepetitionWithSeparator";if(e instanceof yo)return"RepetitionMandatory";if(e instanceof vo)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function tSe(e,t){let r=t.length;for(let a=0;ar.stateNumber.toString()).join("_")}`}function aSe(e,t,r){for(var i=-1,n=e.length;++i0&&r(l)?t>1?fG(l,t-1,r,i,n):Nwe(n,l):i||(n[n.length]=l)}return n}function uSe(e,t){return cSe(sh(e,t),1)}function hSe(e,t,r,i){for(var n=e.length,a=r+(i?1:-1);i?a--:++a-1}function gSe(e,t,r){for(var i=-1,n=e==null?0:e.length;++i=tvt){var h=t?null:evt(e);if(h)return Qz(h);s=!1,n=Ewe,u=new kwe}else u=t?[]:l;e:for(;++i{let n=i.toString(),a=r[n];return a!==void 0||(a={atnStartState:e,decision:t,states:{}},r[n]=a),a}}function GF(e,t=!0){let r=new Set;for(let i of e){let n=new Set;for(let a of i){if(a===void 0){if(t)break;return!1}let s=[a.tokenTypeIdx].concat(a.categoryMatches);for(let l of s)if(r.has(l)){if(!n.has(l))return!1}else r.add(l),n.add(l)}}return!0}function RSe(e){let t=e.decisionStates.length,r=Array(t);for(let i=0;iB0(n)).join(", "),r=e.production.idx===0?"":e.production.idx,i=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(", ")}> in <${OSe(e.production)}${r}> inside <${e.topLevelRule.name}> Rule, +<${t}> may appears as a prefix path in all these alternatives. +`;return i=i+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES +For Further details.`,i}function OSe(e){if(e instanceof us)return"SUBRULE";if(e instanceof Ca)return"OPTION";if(e instanceof Us)return"OR";if(e instanceof yo)return"AT_LEAST_ONE";if(e instanceof vo)return"AT_LEAST_ONE_SEP";if(e instanceof qs)return"MANY_SEP";if(e instanceof hn)return"MANY";if(e instanceof Wi)return"CONSUME";throw Error("non exhaustive match")}function PSe(e,t,r){let i=qyt(t.configs.elements,a=>a.state.transitions),n=ivt(i.filter(a=>a instanceof oG).map(a=>a.tokenType),a=>a.tokenTypeIdx);return{actualToken:r,possibleTokenTypes:n,tokenPath:e}}function BSe(e,t){return e.edges[t.tokenTypeIdx]}function FSe(e,t,r){let i=new zF,n=[];for(let s of e.elements){if(r.is(s.alt)===!1)continue;if(s.state.type===$T){n.push(s);continue}let l=s.state.transitions.length;for(let u=0;u0&&!WSe(a))for(let s of n)a.add(s);return a}function $Se(e,t){if(e instanceof oG&&Gz(t,e.tokenType))return e.target}function zSe(e,t){let r;for(let i of e.elements)if(t.is(i.alt)===!0){if(r===void 0)r=i.alt;else if(r!==i.alt)return}return r}function pG(e){return{configs:e,edges:{},isAcceptState:!1,prediction:-1}}function VF(e,t,r,i){return i=mG(e,i),t.edges[r.tokenTypeIdx]=i,i}function mG(e,t){if(t===N5)return t;let r=t.configs.key,i=e.states[r];return i!==void 0?i:(t.configs.finalize(),e.states[r]=t,t)}function GSe(e){let t=new zF,r=e.transitions.length;for(let i=0;i0){let n=[...e.stack],s={state:n.pop(),alt:e.alt,stack:n};yT(s,t)}else t.add(e);return}r.epsilonOnlyTransitions||t.add(e);let i=r.transitions.length;for(let n=0;n1)return!0;return!1}function jSe(e){for(let t of Array.from(e.values()))if(Object.keys(t).length===1)return!0;return!1}function ZE(e){return e.$type===O5}function VA(e,t,r){return r3e({parser:t,tokens:r,ruleNames:new Map},e),t}function r3e(e,t){let r=iA(t,!1),i=gi(t.rules).filter(cs).filter(a=>r.has(a));for(let a of i){let s={...e,consume:1,optional:1,subrule:1,many:1,or:1};e.parser.rule(a,vf(s,a.definition))}let n=gi(t.rules).filter(K1).filter(a=>r.has(a));for(let a of n)e.parser.rule(a,i3e(e,a))}function i3e(e,t){let r=t.call.rule.ref;if(!r)throw new Error("Could not resolve reference to infix operator rule: "+t.call.rule.$refText);if(rl(r))throw new Error("Cannot use terminal rule in infix expression");let i=t.operators.precedences.flatMap(m=>m.operators),n={$type:"Group",elements:[]},a={$container:n,$type:"Assignment",feature:"parts",operator:"+=",terminal:t.call},s={$container:n,$type:"Group",elements:[],cardinality:"*"};n.elements.push(a,s);let u={$container:s,$type:"Assignment",feature:"operators",operator:"+=",terminal:{$type:"Alternatives",elements:i}},h={...a,$container:s};s.elements.push(u,h);let f=i.map(m=>e.tokens[m.value]).map((m,g)=>({ALT:S(()=>e.parser.consume(g,m,u),"ALT")})),p;return m=>{p??(p=WA(e,r)),e.parser.subrule(0,p,!1,a,m),e.parser.many(0,{DEF:S(()=>{e.parser.alternatives(0,f),e.parser.subrule(1,p,!1,h,m)},"DEF")})}}function vf(e,t,r=!1){let i;if(ch(t))i=u3e(e,t);else if(pf(t))i=n3e(e,t);else if(lh(t))i=vf(e,t.terminal);else if(Y0(t))i=bG(e,t);else if(uh(t))i=a3e(e,t);else if(j5(t))i=o3e(e,t);else if(Q5(t))i=l3e(e,t);else if(j0(t))i=c3e(e,t);else if(k$(t)){let n=e.consume++;i=S(()=>e.parser.consume(n,gf,t),"method")}else throw new eA(t.$cstNode,`Unexpected element type: ${t.$type}`);return TG(e,r?void 0:vT(t),i,t.cardinality)}function n3e(e,t){let r=$0(t);return()=>e.parser.action(r,t)}function a3e(e,t){let r=t.rule.ref;if(H0(r)){let i=e.subrule++,n=cs(r)&&r.fragment,a=t.arguments.length>0?s3e(r,t.arguments):()=>({}),s;return l=>{s??(s=WA(e,r)),e.parser.subrule(i,s,n,t,a(l))}}else if(rl(r)){let i=e.consume++,n=P5(e,r.name);return()=>e.parser.consume(i,n,t)}else if(r)bf(r);else throw new eA(t.$cstNode,`Undefined rule: ${t.rule.$refText}`)}function s3e(e,t){if(t.some(i=>i.calledByName)){let i=t.map(n=>({parameterName:n.parameter?.ref?.name,predicate:Vl(n.value)}));return n=>{let a={};for(let{parameterName:s,predicate:l}of i)s&&(a[s]=l(n));return a}}else{let i=t.map(n=>Vl(n.value));return n=>{let a={};for(let s=0;st(i)||r(i)}else if(T$(e)){let t=Vl(e.left),r=Vl(e.right);return i=>t(i)&&r(i)}else if(E$(e)){let t=Vl(e.value);return r=>!t(r)}else if(A$(e)){let t=e.parameter.ref.name;return r=>r!==void 0&&r[t]===!0}else if(x$(e)){let t=!!e.true;return()=>t}bf(e)}function o3e(e,t){if(t.elements.length===1)return vf(e,t.elements[0]);{let r=[];for(let n of t.elements){let a={ALT:vf(e,n,!0)},s=vT(n);s&&(a.GATE=Vl(s)),r.push(a)}let i=e.or++;return n=>e.parser.alternatives(i,r.map(a=>{let s={ALT:S(()=>a.ALT(n),"ALT")},l=a.GATE;return l&&(s.GATE=()=>l(n)),s}))}}function l3e(e,t){if(t.elements.length===1)return vf(e,t.elements[0]);let r=[];for(let l of t.elements){let u={ALT:vf(e,l,!0)},h=vT(l);h&&(u.GATE=Vl(h)),r.push(u)}let i=e.or++,n=S((l,u)=>{let h=u.getRuleStack().join("-");return`uGroup_${l}_${h}`},"idFunc"),a=S(l=>e.parser.alternatives(i,r.map((u,h)=>{let d={ALT:S(()=>!0,"ALT")},f=e.parser;d.ALT=()=>{if(u.ALT(l),!f.isRecording()){let m=n(i,f);f.unorderedGroups.get(m)||f.unorderedGroups.set(m,[]);let g=f.unorderedGroups.get(m);typeof g?.[h]>"u"&&(g[h]=!0)}};let p=u.GATE;return p?d.GATE=()=>p(l):d.GATE=()=>!f.unorderedGroups.get(n(i,f))?.[h],d})),"alternatives"),s=TG(e,vT(t),a,"*");return l=>{s(l),e.parser.isRecording()||e.parser.unorderedGroups.delete(n(i,e.parser))}}function c3e(e,t){let r=t.elements.map(i=>vf(e,i));return i=>r.forEach(n=>n(i))}function vT(e){if(j0(e))return e.guardCondition}function bG(e,t,r=t.terminal){if(r)if(uh(r)&&cs(r.rule.ref)){let i=r.rule.ref,n=e.subrule++,a;return s=>{a??(a=WA(e,i)),e.parser.subrule(n,a,!1,t,s)}}else if(uh(r)&&rl(r.rule.ref)){let i=e.consume++,n=P5(e,r.rule.ref.name);return()=>e.parser.consume(i,n,t)}else if(ch(r)){let i=e.consume++,n=P5(e,r.value);return()=>e.parser.consume(i,n,t)}else throw new Error("Could not build cross reference parser");else{if(!t.type.ref)throw new Error("Could not resolve reference to type: "+t.type.$refText);let n=oA(t.type.ref)?.terminal;if(!n)throw new Error("Could not find name assignment for type: "+$0(t.type.ref));return bG(e,t,n)}}function u3e(e,t){let r=e.consume++,i=e.tokens[t.value];if(!i)throw new Error("Could not find token for keyword: "+t.value);return()=>e.parser.consume(r,i,t)}function TG(e,t,r,i){let n=t&&Vl(t);if(!i)if(n){let a=e.or++;return s=>e.parser.alternatives(a,[{ALT:S(()=>r(s),"ALT"),GATE:S(()=>n(s),"GATE")},{ALT:OF(),GATE:S(()=>!n(s),"GATE")}])}else return r;if(i==="*"){let a=e.many++;return s=>e.parser.many(a,{DEF:S(()=>r(s),"DEF"),GATE:n?()=>n(s):void 0})}else if(i==="+"){let a=e.many++;if(n){let s=e.or++;return l=>e.parser.alternatives(s,[{ALT:S(()=>e.parser.atLeastOne(a,{DEF:S(()=>r(l),"DEF")}),"ALT"),GATE:S(()=>n(l),"GATE")},{ALT:OF(),GATE:S(()=>!n(l),"GATE")}])}else return s=>e.parser.atLeastOne(a,{DEF:S(()=>r(s),"DEF")})}else if(i==="?"){let a=e.optional++;return s=>e.parser.optional(a,{DEF:S(()=>r(s),"DEF"),GATE:n?()=>n(s):void 0})}else bf(i)}function WA(e,t){let r=h3e(e,t),i=e.parser.getRule(r);if(!i)throw new Error(`Rule "${r}" not found."`);return i}function h3e(e,t){if(H0(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let r=t,i=r.$container,n=t.$type;for(;!cs(i);)(j0(i)||j5(i)||Q5(i))&&(n=i.elements.indexOf(r).toString()+":"+n),r=i,i=i.$container;return n=i.name+":"+n,e.ruleNames.set(t,n),n}}function P5(e,t){let r=e.tokens[t];if(!r)throw new Error(`Token "${t}" not found."`);return r}function CG(e){let t=e.Grammar,r=e.parser.Lexer,i=new e3e(e);return VA(t,i,r.definition),i.finalize(),i}function kG(e){let t=wG(e);return t.finalize(),t}function wG(e){let t=e.Grammar,r=e.parser.Lexer,i=new QSe(e);return VA(t,i,r.definition)}function UA(){return new Promise(e=>{typeof setImmediate>"u"?setTimeout(e,0):setImmediate(e)})}function HA(){return QE=performance.now(),new Ii.CancellationTokenSource}function EG(e){d3e=e}function cm(e){return e===Zc}async function la(e){if(e===Ii.CancellationToken.None)return;let t=performance.now();if(t-QE>=d3e&&(QE=t,await UA(),QE=performance.now()),e.isCancellationRequested)throw Zc}function F5(e,t){if(e.length<=1)return e;let r=e.length/2|0,i=e.slice(0,r),n=e.slice(r);F5(i,t),F5(n,t);let a=0,s=0,l=0;for(;ar.line||t.line===r.line&&t.character>r.character?{start:r,end:t}:e}function f3e(e){let t=_G(e.range);return t!==e.range?{newText:e.newText,range:t}:e}function RG(e){return typeof e.name=="string"}function NG(e){return typeof e.$comment=="string"}function HF(e){return typeof e=="object"&&!!e&&("$ref"in e||"$error"in e)}function O0(e){return{code:e}}function IG(e){if(e.range)return e.range;let t;return typeof e.property=="string"?t=nA(e.node.$cstNode,e.property,e.index):typeof e.keyword=="string"&&(t=iz(e.node.$cstNode,e.keyword,e.index)),t??(t=e.node.$cstNode),t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function J2(e){switch(e){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+e)}}function OG(e){switch(e){case"error":return O0(Qo.LexingError);case"warning":return O0(Qo.LexingWarning);case"info":return O0(Qo.LexingInfo);case"hint":return O0(Qo.LexingHint);default:throw new Error("Invalid diagnostic severity: "+e)}}function KA(e){return Array.isArray(e)&&(e.length===0||"name"in e[0])}function ZA(e){return e&&"modes"in e&&"defaultMode"in e}function G5(e){return!KA(e)&&!ZA(e)}function FG(e,t,r){let i,n;typeof e=="string"?(n=t,i=r):(n=e.range.start,i=t),n||(n=ai.create(0,0));let a=zG(e),s=QA(i),l=B3e({lines:a,position:n,options:s});return z3e({index:0,tokens:l,position:n})}function $G(e,t){let r=QA(t),i=zG(e);if(i.length===0)return!1;let n=i[0],a=i[i.length-1],s=r.start,l=r.end;return!!s?.exec(n)&&!!l?.exec(a)}function zG(e){let t="";return typeof e=="string"?t=e:t=e.text,t.split(Fve)}function B3e(e){let t=[],r=e.position.line,i=e.position.character;for(let n=0;n=l.length){if(t.length>0){let d=ai.create(r,i);t.push({type:"break",content:"",range:qr.create(d,d)})}}else{Fye.lastIndex=u;let d=Fye.exec(l);if(d){let f=d[0],p=d[1],m=ai.create(r,i+u),g=ai.create(r,i+u+f.length);t.push({type:"tag",content:p,range:qr.create(m,g)}),u+=f.length,u=V5(l,u)}if(u0&&t[t.length-1].type==="break"?t.slice(0,-1):t}function F3e(e,t,r,i){let n=[];if(e.length===0){let a=ai.create(r,i),s=ai.create(r,i+t.length);n.push({type:"text",content:t,range:qr.create(a,s)})}else{let a=0;for(let l of e){let u=l.index,h=t.substring(a,u);h.length>0&&n.push({type:"text",content:t.substring(a,u),range:qr.create(ai.create(r,a+i),ai.create(r,u+i))});let d=h.length+1,f=l[1];if(n.push({type:"inline-tag",content:f,range:qr.create(ai.create(r,a+d+i),ai.create(r,a+d+f.length+i))}),d+=f.length,l.length===4){d+=l[2].length;let p=l[3];n.push({type:"text",content:p,range:qr.create(ai.create(r,a+d+i),ai.create(r,a+d+p.length+i))})}else n.push({type:"text",content:"",range:qr.create(ai.create(r,a+d+i),ai.create(r,a+d+i))});a=u+l[0].length}let s=t.substring(a);s.length>0&&n.push({type:"text",content:s,range:qr.create(ai.create(r,a+i),ai.create(r,a+i+s.length))})}return n}function V5(e,t){let r=e.substring(t).match(Tvt);return r?t+r.index:e.length}function $3e(e){let t=e.match(Cvt);if(t&&typeof t.index=="number")return t.index}function z3e(e){let t=ai.create(e.position.line,e.position.character);if(e.tokens.length===0)return new $ye([],qr.create(t,t));let r=[];for(;e.index0){let s=V5(t,i);n=t.substring(s),t=t.substring(0,i)}return(e==="linkcode"||e==="link"&&r.link==="code")&&(n=`\`${n}\``),r.renderLink?.(t,n)??U3e(t,n)}}function U3e(e,t){try{return fo.parse(e,!0),`[${t}](${e})`}catch{return e}}function jF(e){return e.endsWith(` +`)?` +`:` + +`}function rn(e){return{documentation:{CommentProvider:S(t=>new j3e(t),"CommentProvider"),DocumentationProvider:S(t=>new Y3e(t),"DocumentationProvider")},parser:{AsyncParser:S(t=>new X3e(t),"AsyncParser"),GrammarConfig:S(t=>hz(t),"GrammarConfig"),LangiumParser:S(t=>kG(t),"LangiumParser"),CompletionParser:S(t=>CG(t),"CompletionParser"),ValueConverter:S(()=>new SG,"ValueConverter"),TokenBuilder:S(()=>new qA,"TokenBuilder"),Lexer:S(t=>new BG(t),"Lexer"),ParserErrorMessageProvider:S(()=>new xG,"ParserErrorMessageProvider"),LexerErrorMessageProvider:S(()=>new P3e,"LexerErrorMessageProvider")},workspace:{AstNodeLocator:S(()=>new L3e,"AstNodeLocator"),AstNodeDescriptionProvider:S(t=>new D3e(t),"AstNodeDescriptionProvider"),ReferenceDescriptionProvider:S(t=>new R3e(t),"ReferenceDescriptionProvider")},references:{Linker:S(t=>new y3e(t),"Linker"),NameProvider:S(()=>new v3e,"NameProvider"),ScopeProvider:S(t=>new k3e(t),"ScopeProvider"),ScopeComputation:S(t=>new b3e(t),"ScopeComputation"),References:S(t=>new x3e(t),"References")},serializer:{Hydrator:S(t=>new Z3e(t),"Hydrator"),JsonSerializer:S(t=>new w3e(t),"JsonSerializer")},validation:{DocumentValidator:S(t=>new _3e(t),"DocumentValidator"),ValidationRegistry:S(t=>new E3e(t),"ValidationRegistry")},shared:S(()=>e.shared,"shared")}}function nn(e){return{ServiceRegistry:S(t=>new S3e(t),"ServiceRegistry"),workspace:{LangiumDocuments:S(t=>new g3e(t),"LangiumDocuments"),LangiumDocumentFactory:S(t=>new m3e(t),"LangiumDocumentFactory"),DocumentBuilder:S(t=>new N3e(t),"DocumentBuilder"),IndexManager:S(t=>new I3e(t),"IndexManager"),WorkspaceManager:S(t=>new O3e(t),"WorkspaceManager"),FileSystemProvider:S(t=>e.fileSystemProvider(t),"FileSystemProvider"),WorkspaceLock:S(()=>new K3e,"WorkspaceLock"),ConfigurationProvider:S(t=>new M3e(t),"ConfigurationProvider")},profilers:{}}}function Hr(e,t,r,i,n,a,s,l,u){let h=[e,t,r,i,n,a,s,l,u].reduce(iy,{});return UG(h)}function qG(e){if(e&&e[Q3e])for(let t of Object.values(e))qG(t);return e}function UG(e,t){let r=new Proxy({},{deleteProperty:S(()=>!1,"deleteProperty"),set:S(()=>{throw new Error("Cannot set property on injected service container")},"set"),get:S((i,n)=>n===Q3e?!0:KF(i,n,e,t||r),"get"),getOwnPropertyDescriptor:S((i,n)=>(KF(i,n,e,t||r),Object.getOwnPropertyDescriptor(i,n)),"getOwnPropertyDescriptor"),has:S((i,n)=>n in e,"has"),ownKeys:S(()=>[...Object.getOwnPropertyNames(e)],"ownKeys")});return r}function KF(e,t,r,i){if(t in e){if(e[t]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable. Cause: "+e[t]);if(e[t]===zye)throw new Error('Cycle detected. Please make "'+String(t)+'" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies');return e[t]}else if(t in r){let n=r[t];e[t]=zye;try{e[t]=typeof n=="function"?n(i):UG(n,i)}catch(a){throw e[t]=a instanceof Error?a:void 0,a}return e[t]}else return}function iy(e,t){if(t){for(let[r,i]of Object.entries(t))if(i!=null)if(typeof i=="object"){let n=e[r];typeof n=="object"&&n!==null?e[r]=iy(n,i):e[r]=iy({},i)}else e[r]=i}return e}function tEe(){let e=Hr(nn(fn),Avt),t=Hr(rn({shared:e}),Evt);return e.ServiceRegistry.register(t),t}function xo(e){let t=tEe(),r=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(r,fo.parse(`memory:/${r.name??"grammar"}.langium`)),r}function iEe(e){return bo.isInstance(e,Yc.$type)}function nEe(e){return bo.isInstance(e,eT.$type)}function aEe(e){return bo.isInstance(e,_0.$type)}function sEe(e){return e==="rmo"||e==="readmodel"||e==="ui"||e==="cmd"||e==="command"||e==="evt"||e==="event"||e==="pcr"||e==="processor"}function JA(e){return bo.isInstance(e,ih.$type)}function oEe(e){return bo.isInstance(e,df.$type)}function lEe(e){return bo.isInstance(e,G1.$type)}function cEe(e){return bo.isInstance(e,D0.$type)}function uEe(e){return bo.isInstance(e,R0.$type)}function hEe(e){return bo.isInstance(e,L0.$type)}function dEe(e){return bo.isInstance(e,ff.$type)}function fEe(e){return bo.isInstance(e,tT.$type)}function pEe(e){return bo.isInstance(e,M0.$type)}function mEe(e){return bo.isInstance(e,oa.$type)}var dlt,xT,flt,l$,plt,mlt,S,glt,Lr,xf,t5,W5,c$,u$,q5,fB,NE,pB,A2,ai,qr,_2,mB,IE,gB,yB,vB,xB,OE,bB,TB,CB,D2,l0,qc,c0,ba,th,R2,E1,A1,_1,PE,v2,HP,tve,kB,wB,L2,SB,BE,D1,EB,AB,_B,DB,RB,LB,MB,NB,M2,IB,OB,PB,BB,FB,$B,zB,GB,VB,WB,qB,N2,UB,HB,YB,jB,XB,KB,ZB,QB,JB,eF,tF,rF,iF,FE,$E,nF,aF,sF,oF,lF,cF,uF,hF,rve,dF,m1e,Ze,bT,W0,TT,ny,U5,nve,sve,ylt,vlt,ove,xlt,blt,Tlt,Clt,fF,klt,ay,g1e,tn,h$,wlt,Slt,Elt,Alt,_lt,Dlt,Rlt,Llt,Mlt,Nlt,Ilt,Olt,Plt,Blt,Flt,$lt,zlt,Glt,Vlt,Wlt,qlt,Ult,Hlt,Ylt,jlt,uve,d$,p$,Kc,H1,as,Y1,iT,m$,fve,Xlt,zs,$2,N1,ho,of,z2,a5,s5,lf,o5,cf,uf,G2,hf,V2,l5,nh,c5,y0,u5,Hc,W2,h5,I1,O1,P1,v0,d5,f5,B1,p5,zl,q2,x0,m5,b0,F1,g5,T0,Gs,C0,ah,k0,U2,w0,S0,y5,H2,E0,A0,$1,P$,dr,Xc,z$,U$,eA,Y$,x5,b5,y1e,Klt,mE,Zlt,Bve,tA,Fve,$ve,Qlt,N0,Gve,uz,Jlt,exe,ect,tct,tu,rct,el,txe,ict,nct,x2,act,sct,oct,lct,cct,uct,v1e,Tf,Yl,hct,lA,AT,dct,Kr,fct,x1e,b1e,pct,mct,gct,yct,vct,tl,T1e,xct,bct,Tct,Cct,kct,C1e,wct,Sct,_T,J1,Ect,Act,_ct,Dct,vh,Rct,YP,k1e,Lct,Mct,Nct,K0,Ict,Oct,Pct,Bct,Fct,$ct,zct,Gct,Vct,Z0,Wct,gF,w1e,qct,Uct,Hct,Un,Yct,jct,Xct,Kct,Zct,Qct,Jct,C5,eut,tut,rut,iut,Axe,Dxe,nut,aut,fz,Ixe,sut,out,cA,pz,DT,lut,cut,uA,RT,S1e,uut,mz,hut,gz,ru,hA,dut,fut,LT,put,mut,E1e,Xxe,gut,yut,vut,dA,xut,Zxe,A1e,but,_1e,Tut,Cut,aT,kut,wut,Sut,Eut,Aut,_ut,Dut,Rut,Lut,Mut,Nut,Iut,Out,Put,But,Fut,$ut,zut,Gut,Vut,Wut,qut,Uut,Hut,Gi,Yut,MT,ebe,Y2,jut,jP,Xut,mf,D1e,Kut,yz,Zut,Qut,rbe,nbe,Jut,eht,tht,rht,sbe,po,iht,nht,aht,mo,sht,oht,lht,cht,fA,uht,hht,vz,dht,sT,fht,pht,mht,ght,yht,vht,xht,bht,Tht,Cht,kht,R1e,wht,pA,Sht,Eht,Aht,_ht,Dht,Rht,mA,Lht,oT,Mht,Nht,gA,Iht,Oht,Pht,Bht,yA,Fht,$ht,zht,Ght,Vht,Wht,qht,Uht,Hht,xA,Yht,NT,xz,jht,bz,L1e,Xht,Cz,Ul,Kht,$be,Gbe,Zht,Qht,Jht,edt,tdt,rdt,idt,j2,ndt,adt,Kbe,M1e,sdt,N1e,I1e,odt,kz,e2e,ldt,cdt,O1e,udt,wz,hdt,ddt,fdt,r2e,pdt,a2e,yF,l2e,mdt,vF,gdt,xF,ydt,W1,P1e,vdt,B1e,F1e,$1e,z1e,xdt,bdt,Tdt,Cdt,kdt,h0,ey,wdt,Sdt,Edt,Adt,k5,Sz,_dt,Ddt,Rdt,G1e,V1e,Ldt,Mdt,Ndt,Idt,Odt,Pdt,Bdt,Fdt,$dt,zdt,Gdt,Vdt,Wdt,qdt,Udt,Hdt,Ydt,jdt,Xdt,Kdt,Zdt,Qdt,Jdt,eft,tft,W1e,rft,ift,nft,aft,q1e,sft,oft,lft,cft,uft,x2e,hft,dft,fft,pft,b2e,mft,gft,yft,T2e,vft,xft,bft,Tft,Cft,kft,wft,Sft,Eft,Aft,_ft,Dft,Rft,Lft,Mft,Nft,Ni,Ift,Oft,ka,IT,Pft,Bft,Fft,Ez,A2e,Az,$ft,zft,R2e,Gft,_z,Vft,Wft,qft,Uft,Hft,Yft,jft,Xft,Kft,Zft,Qft,Jft,ept,U1e,XP,tpt,rpt,ipt,npt,apt,spt,H1e,Y1e,gE,opt,j1e,lpt,P2e,cpt,upt,hpt,$2e,dpt,V2e,fpt,ppt,H2e,mpt,gpt,ypt,vpt,xpt,bpt,Tpt,iu,Cpt,kpt,wpt,Spt,Ept,Apt,_pt,rm,Dpt,Rpt,aTe,Lpt,Mpt,Rz,X1e,lTe,Npt,Ipt,Opt,bA,z0,Ta,cT,Ppt,vr,Bpt,Fpt,Hl,xTe,il,$pt,zpt,Gpt,Vpt,ty,jl,Wpt,nr,Jo,qpt,Upt,Hpt,Ypt,jpt,Xpt,Kpt,mr,Zpt,Vs,Qpt,Hn,Jpt,fs,e0t,K1e,t0t,r0t,i0t,n0t,Oi,a0t,s0t,Z1e,o0t,hh,dh,l0t,c0t,u0t,h0t,Xl,d0t,go,TA,f0t,HTe,p0t,m0t,g0t,y0t,v0t,Lz,nu,us,oy,Ws,Ca,yo,vo,hn,qs,Us,Wi,ly,CA,iCe,x0t,WE,b0t,oCe,S5,T0t,G0,P2,yE,uCe,C0t,k0t,w0t,B2,UE,Q1e,NCe,SF,dn,F2,ls,S0t,J1e,eye,tye,rye,iye,nye,aye,sye,gf,z1,E0t,I0,A0t,_0t,D0t,wA,R0t,oye,L0t,lye,en,M0t,jCe,N0t,Yz,I0t,dke,fke,pke,mke,gke,EA,yke,O0t,P0t,B0t,KP,vke,F0t,$0t,z0t,Cf,G0t,bke,Tke,_F,DF,RF,YE,_wr,jz,V0t,W0t,vE,q0t,NF,U0t,H0t,Y0t,j0t,X0t,K0t,AA,cye,uye,Rke,Lke,Z0t,Q0t,J0t,R5,ph,L5,hs,Kz,emt,Pke,tmt,$ke,_A,rmt,imt,nmt,amt,smt,omt,DA,lmt,cmt,umt,hmt,dmt,Xke,fmt,pmt,xh,mmt,eu,Kke,gmt,ymt,b2,vmt,xmt,bmt,Tmt,Cmt,kmt,hye,dy,Zz,wmt,Smt,Emt,Amt,rwe,_mt,ZP,dye,Dmt,Rmt,Lmt,nm,Mmt,Nmt,Imt,Omt,Pmt,Bmt,Fmt,$mt,zmt,fy,Gmt,pT,Vmt,mT,Wmt,qmt,Umt,Hmt,Ymt,jmt,Xmt,Kmt,Zmt,Qmt,Jmt,fye,egt,tgt,RA,rgt,igt,ngt,agt,LA,sgt,ogt,XE,lgt,cgt,ugt,kwe,hgt,Ewe,dgt,fgt,_we,pgt,pye,mgt,Qz,ggt,ygt,vgt,xgt,bgt,Tgt,Cgt,kgt,wgt,Sgt,Egt,Agt,_gt,mye,QP,Dgt,Nwe,Rgt,ds,Lgt,Pwe,Mgt,Ngt,Igt,gye,Ogt,Pgt,Bgt,ry,Fgt,yye,Gwe,$gt,zgt,Ggt,MA,Vgt,Wwe,vye,Wgt,xye,qgt,Ugt,M5,Hgt,Ygt,Uwe,jgt,Jz,Xgt,Kgt,Zgt,Qgt,Jgt,e1t,t1t,r1t,i1t,n1t,a1t,s1t,o1t,l1t,c1t,u1t,h1t,d1t,f1t,p1t,m1t,g1t,y1t,v1t,Vi,x1t,b1t,Xwe,Q2,T1t,JP,C1t,bye,Tye,k1t,eG,w1t,S1t,E1t,A1t,Qwe,_1t,D1t,R1t,L1t,M1t,t4e,NA,tG,Cye,N1t,I1t,O1t,P1t,B1t,PF,F1t,BF,$1t,U1,z1t,FF,kye,G1t,wye,Sye,Eye,Aye,V1t,W1t,q1t,U1t,H1t,d0,$F,Y1t,_ye,Dye,xE,j1t,Rye,X1t,o4e,K1t,Z1t,Q1t,u4e,J1t,f4e,eyt,tyt,IA,ryt,iyt,iG,nyt,ayt,syt,oyt,lyt,cyt,uyt,hyt,dyt,Lye,Mye,fyt,pyt,b4e,myt,PA,k4e,gyt,yyt,vyt,xyt,byt,Tyt,Cyt,aG,kyt,wyt,Syt,BA,Eyt,Ayt,_yt,Dyt,Ryt,Lyt,FA,Myt,sh,Nyt,Iyt,yf,Oyt,G4e,V4e,$T,Pyt,Byt,Fyt,$yt,W4e,sG,oG,q4e,lG,N5,zF,zyt,Gyt,Vyt,Nye,Wyt,cSe,qyt,Uyt,Hyt,Yyt,jyt,Xyt,Kyt,Zyt,Qyt,Jyt,evt,tvt,rvt,ivt,nvt,avt,svt,eB,ovt,lvt,cvt,uvt,hvt,dvt,fvt,Iye,DSe,Oye,pvt,XSe,gG,I5,GA,mvt,yG,O5,Pye,ZSe,vG,QSe,JSe,xG,e3e,gvt,t3e,yvt,qA,SG,jc,Ii,QE,d3e,Zc,mh,Bye,B5,p3e,fo,T2,os,DG,zr,m3e,g3e,f0,y3e,v3e,x3e,gh,$5,b3e,UF,vvt,T3e,xvt,YA,LG,jA,C3e,MG,k3e,w3e,S3e,z5,E3e,A3e,_3e,Qo,D3e,R3e,L3e,XA,M3e,bE,F0,N3e,I3e,O3e,P3e,PG,BG,Fye,bvt,Tvt,Cvt,$ye,tB,YF,H3e,Y3e,j3e,X3e,kvt,wvt,K3e,Z3e,XF,Q3e,zye,ZF,P0,J3e,Svt,HG,eEe,fn,Evt,Avt,_vt,rEe,QF,JF,e$,t$,r$,i$,n$,a$,s$,o$,Dwr,TE,CE,C2,rB,Yc,kE,eT,Gye,wE,iB,_0,SE,s0,EE,AE,Vye,w1,Wc,p0,af,k2,Wye,nB,_E,ih,nf,aB,Uc,qye,DE,sB,df,w2,G1,S2,oB,E2,RE,o0,D0,LE,lB,R0,L0,ff,tT,cB,ME,sf,uB,S1,hB,m0,M0,dB,e5,M1,oa,gEe,bo,Uye,Dvt,Hye,Rvt,Yye,Lvt,jye,Mvt,Xye,Nvt,Kye,Ivt,Zye,Ovt,Qye,Pvt,Jye,Bvt,eve,Fvt,$vt,zvt,Gvt,Vvt,Wvt,qvt,Uvt,Hvt,Yvt,jvt,xn,YG,jG,XG,KG,ZG,QG,JG,eV,tV,rV,Xvt,Kvt,Zvt,Qvt,nl,Kl,Ln,Jvt,pn=z(()=>{"use strict";dlt=Object.create,xT=Object.defineProperty,flt=Object.getOwnPropertyDescriptor,l$=Object.getOwnPropertyNames,plt=Object.getPrototypeOf,mlt=Object.prototype.hasOwnProperty,S=o((e,t)=>xT(e,"name",{value:t,configurable:!0}),"__name"),glt=o((e,t)=>o(function(){return e&&(t=(0,e[l$(e)[0]])(e=0)),t},"__init"),"__esm"),Lr=o((e,t)=>o(function(){return t||(0,e[l$(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require"),"__commonJS"),xf=o((e,t)=>{for(var r in t)xT(e,r,{get:t[r],enumerable:!0})},"__export"),t5=o((e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of l$(t))!mlt.call(e,n)&&n!==r&&xT(e,n,{get:o(()=>t[n],"get"),enumerable:!(i=flt(t,n))||i.enumerable});return e},"__copyProps"),W5=o((e,t,r)=>(t5(e,t,"default"),r&&t5(r,t,"default")),"__reExport"),c$=o((e,t,r)=>(r=e!=null?dlt(plt(e)):{},t5(t||!e||!e.__esModule?xT(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),u$=o(e=>t5(xT({},"__esModule",{value:!0}),e),"__toCommonJS"),q5={};xf(q5,{AnnotatedTextEdit:o(()=>th,"AnnotatedTextEdit"),ChangeAnnotation:o(()=>c0,"ChangeAnnotation"),ChangeAnnotationIdentifier:o(()=>ba,"ChangeAnnotationIdentifier"),CodeAction:o(()=>HB,"CodeAction"),CodeActionContext:o(()=>UB,"CodeActionContext"),CodeActionKind:o(()=>qB,"CodeActionKind"),CodeActionTriggerKind:o(()=>N2,"CodeActionTriggerKind"),CodeDescription:o(()=>CB,"CodeDescription"),CodeLens:o(()=>YB,"CodeLens"),Color:o(()=>IE,"Color"),ColorInformation:o(()=>gB,"ColorInformation"),ColorPresentation:o(()=>yB,"ColorPresentation"),Command:o(()=>l0,"Command"),CompletionItem:o(()=>MB,"CompletionItem"),CompletionItemKind:o(()=>EB,"CompletionItemKind"),CompletionItemLabelDetails:o(()=>LB,"CompletionItemLabelDetails"),CompletionItemTag:o(()=>_B,"CompletionItemTag"),CompletionList:o(()=>NB,"CompletionList"),CreateFile:o(()=>E1,"CreateFile"),DeleteFile:o(()=>_1,"DeleteFile"),Diagnostic:o(()=>D2,"Diagnostic"),DiagnosticRelatedInformation:o(()=>OE,"DiagnosticRelatedInformation"),DiagnosticSeverity:o(()=>bB,"DiagnosticSeverity"),DiagnosticTag:o(()=>TB,"DiagnosticTag"),DocumentHighlight:o(()=>FB,"DocumentHighlight"),DocumentHighlightKind:o(()=>BB,"DocumentHighlightKind"),DocumentLink:o(()=>XB,"DocumentLink"),DocumentSymbol:o(()=>WB,"DocumentSymbol"),DocumentUri:o(()=>fB,"DocumentUri"),EOL:o(()=>rve,"EOL"),FoldingRange:o(()=>xB,"FoldingRange"),FoldingRangeKind:o(()=>vB,"FoldingRangeKind"),FormattingOptions:o(()=>jB,"FormattingOptions"),Hover:o(()=>IB,"Hover"),InlayHint:o(()=>nF,"InlayHint"),InlayHintKind:o(()=>FE,"InlayHintKind"),InlayHintLabelPart:o(()=>$E,"InlayHintLabelPart"),InlineCompletionContext:o(()=>uF,"InlineCompletionContext"),InlineCompletionItem:o(()=>sF,"InlineCompletionItem"),InlineCompletionList:o(()=>oF,"InlineCompletionList"),InlineCompletionTriggerKind:o(()=>lF,"InlineCompletionTriggerKind"),InlineValueContext:o(()=>iF,"InlineValueContext"),InlineValueEvaluatableExpression:o(()=>rF,"InlineValueEvaluatableExpression"),InlineValueText:o(()=>eF,"InlineValueText"),InlineValueVariableLookup:o(()=>tF,"InlineValueVariableLookup"),InsertReplaceEdit:o(()=>DB,"InsertReplaceEdit"),InsertTextFormat:o(()=>AB,"InsertTextFormat"),InsertTextMode:o(()=>RB,"InsertTextMode"),Location:o(()=>_2,"Location"),LocationLink:o(()=>mB,"LocationLink"),MarkedString:o(()=>M2,"MarkedString"),MarkupContent:o(()=>D1,"MarkupContent"),MarkupKind:o(()=>BE,"MarkupKind"),OptionalVersionedTextDocumentIdentifier:o(()=>L2,"OptionalVersionedTextDocumentIdentifier"),ParameterInformation:o(()=>OB,"ParameterInformation"),Position:o(()=>ai,"Position"),Range:o(()=>qr,"Range"),RenameFile:o(()=>A1,"RenameFile"),SelectedCompletionInfo:o(()=>cF,"SelectedCompletionInfo"),SelectionRange:o(()=>KB,"SelectionRange"),SemanticTokenModifiers:o(()=>QB,"SemanticTokenModifiers"),SemanticTokenTypes:o(()=>ZB,"SemanticTokenTypes"),SemanticTokens:o(()=>JB,"SemanticTokens"),SignatureInformation:o(()=>PB,"SignatureInformation"),StringValue:o(()=>aF,"StringValue"),SymbolInformation:o(()=>GB,"SymbolInformation"),SymbolKind:o(()=>$B,"SymbolKind"),SymbolTag:o(()=>zB,"SymbolTag"),TextDocument:o(()=>dF,"TextDocument"),TextDocumentEdit:o(()=>R2,"TextDocumentEdit"),TextDocumentIdentifier:o(()=>kB,"TextDocumentIdentifier"),TextDocumentItem:o(()=>SB,"TextDocumentItem"),TextEdit:o(()=>qc,"TextEdit"),URI:o(()=>NE,"URI"),VersionedTextDocumentIdentifier:o(()=>wB,"VersionedTextDocumentIdentifier"),WorkspaceChange:o(()=>tve,"WorkspaceChange"),WorkspaceEdit:o(()=>PE,"WorkspaceEdit"),WorkspaceFolder:o(()=>hF,"WorkspaceFolder"),WorkspaceSymbol:o(()=>VB,"WorkspaceSymbol"),integer:o(()=>pB,"integer"),uinteger:o(()=>A2,"uinteger")});bT=glt({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){"use strict";(function(e){function t(r){return typeof r=="string"}o(t,"is"),S(t,"is"),e.is=t})(fB||(fB={})),(function(e){function t(r){return typeof r=="string"}o(t,"is"),S(t,"is"),e.is=t})(NE||(NE={})),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}o(t,"is"),S(t,"is"),e.is=t})(pB||(pB={})),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}o(t,"is"),S(t,"is"),e.is=t})(A2||(A2={})),(function(e){function t(i,n){return i===Number.MAX_VALUE&&(i=A2.MAX_VALUE),n===Number.MAX_VALUE&&(n=A2.MAX_VALUE),{line:i,character:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&Ze.uinteger(n.line)&&Ze.uinteger(n.character)}o(r,"is"),S(r,"is"),e.is=r})(ai||(ai={})),(function(e){function t(i,n,a,s){if(Ze.uinteger(i)&&Ze.uinteger(n)&&Ze.uinteger(a)&&Ze.uinteger(s))return{start:ai.create(i,n),end:ai.create(a,s)};if(ai.is(i)&&ai.is(n))return{start:i,end:n};throw new Error(`Range#create called with invalid arguments[${i}, ${n}, ${a}, ${s}]`)}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&ai.is(n.start)&&ai.is(n.end)}o(r,"is"),S(r,"is"),e.is=r})(qr||(qr={})),(function(e){function t(i,n){return{uri:i,range:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&qr.is(n.range)&&(Ze.string(n.uri)||Ze.undefined(n.uri))}o(r,"is"),S(r,"is"),e.is=r})(_2||(_2={})),(function(e){function t(i,n,a,s){return{targetUri:i,targetRange:n,targetSelectionRange:a,originSelectionRange:s}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&qr.is(n.targetRange)&&Ze.string(n.targetUri)&&qr.is(n.targetSelectionRange)&&(qr.is(n.originSelectionRange)||Ze.undefined(n.originSelectionRange))}o(r,"is"),S(r,"is"),e.is=r})(mB||(mB={})),(function(e){function t(i,n,a,s){return{red:i,green:n,blue:a,alpha:s}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&Ze.numberRange(n.red,0,1)&&Ze.numberRange(n.green,0,1)&&Ze.numberRange(n.blue,0,1)&&Ze.numberRange(n.alpha,0,1)}o(r,"is"),S(r,"is"),e.is=r})(IE||(IE={})),(function(e){function t(i,n){return{range:i,color:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&qr.is(n.range)&&IE.is(n.color)}o(r,"is"),S(r,"is"),e.is=r})(gB||(gB={})),(function(e){function t(i,n,a){return{label:i,textEdit:n,additionalTextEdits:a}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&Ze.string(n.label)&&(Ze.undefined(n.textEdit)||qc.is(n))&&(Ze.undefined(n.additionalTextEdits)||Ze.typedArray(n.additionalTextEdits,qc.is))}o(r,"is"),S(r,"is"),e.is=r})(yB||(yB={})),(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(vB||(vB={})),(function(e){function t(i,n,a,s,l,u){let h={startLine:i,endLine:n};return Ze.defined(a)&&(h.startCharacter=a),Ze.defined(s)&&(h.endCharacter=s),Ze.defined(l)&&(h.kind=l),Ze.defined(u)&&(h.collapsedText=u),h}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&Ze.uinteger(n.startLine)&&Ze.uinteger(n.startLine)&&(Ze.undefined(n.startCharacter)||Ze.uinteger(n.startCharacter))&&(Ze.undefined(n.endCharacter)||Ze.uinteger(n.endCharacter))&&(Ze.undefined(n.kind)||Ze.string(n.kind))}o(r,"is"),S(r,"is"),e.is=r})(xB||(xB={})),(function(e){function t(i,n){return{location:i,message:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&_2.is(n.location)&&Ze.string(n.message)}o(r,"is"),S(r,"is"),e.is=r})(OE||(OE={})),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(bB||(bB={})),(function(e){e.Unnecessary=1,e.Deprecated=2})(TB||(TB={})),(function(e){function t(r){let i=r;return Ze.objectLiteral(i)&&Ze.string(i.href)}o(t,"is"),S(t,"is"),e.is=t})(CB||(CB={})),(function(e){function t(i,n,a,s,l,u){let h={range:i,message:n};return Ze.defined(a)&&(h.severity=a),Ze.defined(s)&&(h.code=s),Ze.defined(l)&&(h.source=l),Ze.defined(u)&&(h.relatedInformation=u),h}o(t,"create"),S(t,"create"),e.create=t;function r(i){var n;let a=i;return Ze.defined(a)&&qr.is(a.range)&&Ze.string(a.message)&&(Ze.number(a.severity)||Ze.undefined(a.severity))&&(Ze.integer(a.code)||Ze.string(a.code)||Ze.undefined(a.code))&&(Ze.undefined(a.codeDescription)||Ze.string((n=a.codeDescription)===null||n===void 0?void 0:n.href))&&(Ze.string(a.source)||Ze.undefined(a.source))&&(Ze.undefined(a.relatedInformation)||Ze.typedArray(a.relatedInformation,OE.is))}o(r,"is"),S(r,"is"),e.is=r})(D2||(D2={})),(function(e){function t(i,n,...a){let s={title:i,command:n};return Ze.defined(a)&&a.length>0&&(s.arguments=a),s}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&Ze.string(n.title)&&Ze.string(n.command)}o(r,"is"),S(r,"is"),e.is=r})(l0||(l0={})),(function(e){function t(a,s){return{range:a,newText:s}}o(t,"replace"),S(t,"replace"),e.replace=t;function r(a,s){return{range:{start:a,end:a},newText:s}}o(r,"insert"),S(r,"insert"),e.insert=r;function i(a){return{range:a,newText:""}}o(i,"del"),S(i,"del"),e.del=i;function n(a){let s=a;return Ze.objectLiteral(s)&&Ze.string(s.newText)&&qr.is(s.range)}o(n,"is"),S(n,"is"),e.is=n})(qc||(qc={})),(function(e){function t(i,n,a){let s={label:i};return n!==void 0&&(s.needsConfirmation=n),a!==void 0&&(s.description=a),s}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&Ze.string(n.label)&&(Ze.boolean(n.needsConfirmation)||n.needsConfirmation===void 0)&&(Ze.string(n.description)||n.description===void 0)}o(r,"is"),S(r,"is"),e.is=r})(c0||(c0={})),(function(e){function t(r){let i=r;return Ze.string(i)}o(t,"is"),S(t,"is"),e.is=t})(ba||(ba={})),(function(e){function t(a,s,l){return{range:a,newText:s,annotationId:l}}o(t,"replace"),S(t,"replace"),e.replace=t;function r(a,s,l){return{range:{start:a,end:a},newText:s,annotationId:l}}o(r,"insert"),S(r,"insert"),e.insert=r;function i(a,s){return{range:a,newText:"",annotationId:s}}o(i,"del"),S(i,"del"),e.del=i;function n(a){let s=a;return qc.is(s)&&(c0.is(s.annotationId)||ba.is(s.annotationId))}o(n,"is"),S(n,"is"),e.is=n})(th||(th={})),(function(e){function t(i,n){return{textDocument:i,edits:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&L2.is(n.textDocument)&&Array.isArray(n.edits)}o(r,"is"),S(r,"is"),e.is=r})(R2||(R2={})),(function(e){function t(i,n,a){let s={kind:"create",uri:i};return n!==void 0&&(n.overwrite!==void 0||n.ignoreIfExists!==void 0)&&(s.options=n),a!==void 0&&(s.annotationId=a),s}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return n&&n.kind==="create"&&Ze.string(n.uri)&&(n.options===void 0||(n.options.overwrite===void 0||Ze.boolean(n.options.overwrite))&&(n.options.ignoreIfExists===void 0||Ze.boolean(n.options.ignoreIfExists)))&&(n.annotationId===void 0||ba.is(n.annotationId))}o(r,"is"),S(r,"is"),e.is=r})(E1||(E1={})),(function(e){function t(i,n,a,s){let l={kind:"rename",oldUri:i,newUri:n};return a!==void 0&&(a.overwrite!==void 0||a.ignoreIfExists!==void 0)&&(l.options=a),s!==void 0&&(l.annotationId=s),l}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return n&&n.kind==="rename"&&Ze.string(n.oldUri)&&Ze.string(n.newUri)&&(n.options===void 0||(n.options.overwrite===void 0||Ze.boolean(n.options.overwrite))&&(n.options.ignoreIfExists===void 0||Ze.boolean(n.options.ignoreIfExists)))&&(n.annotationId===void 0||ba.is(n.annotationId))}o(r,"is"),S(r,"is"),e.is=r})(A1||(A1={})),(function(e){function t(i,n,a){let s={kind:"delete",uri:i};return n!==void 0&&(n.recursive!==void 0||n.ignoreIfNotExists!==void 0)&&(s.options=n),a!==void 0&&(s.annotationId=a),s}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return n&&n.kind==="delete"&&Ze.string(n.uri)&&(n.options===void 0||(n.options.recursive===void 0||Ze.boolean(n.options.recursive))&&(n.options.ignoreIfNotExists===void 0||Ze.boolean(n.options.ignoreIfNotExists)))&&(n.annotationId===void 0||ba.is(n.annotationId))}o(r,"is"),S(r,"is"),e.is=r})(_1||(_1={})),(function(e){function t(r){let i=r;return i&&(i.changes!==void 0||i.documentChanges!==void 0)&&(i.documentChanges===void 0||i.documentChanges.every(n=>Ze.string(n.kind)?E1.is(n)||A1.is(n)||_1.is(n):R2.is(n)))}o(t,"is"),S(t,"is"),e.is=t})(PE||(PE={})),v2=class{static{o(this,"TextEditChangeImpl")}static{S(this,"TextEditChangeImpl")}constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let i,n;if(r===void 0?i=qc.insert(e,t):ba.is(r)?(n=r,i=th.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(r),i=th.insert(e,t,n)),this.edits.push(i),n!==void 0)return n}replace(e,t,r){let i,n;if(r===void 0?i=qc.replace(e,t):ba.is(r)?(n=r,i=th.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(r),i=th.replace(e,t,n)),this.edits.push(i),n!==void 0)return n}delete(e,t){let r,i;if(t===void 0?r=qc.del(e):ba.is(t)?(i=t,r=th.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(t),r=th.del(e,i)),this.edits.push(r),i!==void 0)return i}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},HP=class{static{o(this,"ChangeAnnotations")}static{S(this,"ChangeAnnotations")}constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(ba.is(e)?r=e:(r=this.nextId(),t=e),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(t===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},tve=class{static{o(this,"WorkspaceChange")}static{S(this,"WorkspaceChange")}constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new HP(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(t=>{if(R2.is(t)){let r=new v2(t.edits,this._changeAnnotations);this._textEditChanges[t.textDocument.uri]=r}})):e.changes&&Object.keys(e.changes).forEach(t=>{let r=new v2(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(L2.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let t={uri:e.uri,version:e.version},r=this._textEditChanges[t.uri];if(!r){let i=[],n={textDocument:t,edits:i};this._workspaceEdit.documentChanges.push(n),r=new v2(i,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new v2(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new HP,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;c0.is(t)||ba.is(t)?i=t:r=t;let n,a;if(i===void 0?n=E1.create(e,r):(a=ba.is(i)?i:this._changeAnnotations.manage(i),n=E1.create(e,r,a)),this._workspaceEdit.documentChanges.push(n),a!==void 0)return a}renameFile(e,t,r,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;c0.is(r)||ba.is(r)?n=r:i=r;let a,s;if(n===void 0?a=A1.create(e,t,i):(s=ba.is(n)?n:this._changeAnnotations.manage(n),a=A1.create(e,t,i,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}deleteFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;c0.is(t)||ba.is(t)?i=t:r=t;let n,a;if(i===void 0?n=_1.create(e,r):(a=ba.is(i)?i:this._changeAnnotations.manage(i),n=_1.create(e,r,a)),this._workspaceEdit.documentChanges.push(n),a!==void 0)return a}},(function(e){function t(i){return{uri:i}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&Ze.string(n.uri)}o(r,"is"),S(r,"is"),e.is=r})(kB||(kB={})),(function(e){function t(i,n){return{uri:i,version:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&Ze.string(n.uri)&&Ze.integer(n.version)}o(r,"is"),S(r,"is"),e.is=r})(wB||(wB={})),(function(e){function t(i,n){return{uri:i,version:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&Ze.string(n.uri)&&(n.version===null||Ze.integer(n.version))}o(r,"is"),S(r,"is"),e.is=r})(L2||(L2={})),(function(e){function t(i,n,a,s){return{uri:i,languageId:n,version:a,text:s}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&Ze.string(n.uri)&&Ze.string(n.languageId)&&Ze.integer(n.version)&&Ze.string(n.text)}o(r,"is"),S(r,"is"),e.is=r})(SB||(SB={})),(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){let i=r;return i===e.PlainText||i===e.Markdown}o(t,"is"),S(t,"is"),e.is=t})(BE||(BE={})),(function(e){function t(r){let i=r;return Ze.objectLiteral(r)&&BE.is(i.kind)&&Ze.string(i.value)}o(t,"is"),S(t,"is"),e.is=t})(D1||(D1={})),(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(EB||(EB={})),(function(e){e.PlainText=1,e.Snippet=2})(AB||(AB={})),(function(e){e.Deprecated=1})(_B||(_B={})),(function(e){function t(i,n,a){return{newText:i,insert:n,replace:a}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return n&&Ze.string(n.newText)&&qr.is(n.insert)&&qr.is(n.replace)}o(r,"is"),S(r,"is"),e.is=r})(DB||(DB={})),(function(e){e.asIs=1,e.adjustIndentation=2})(RB||(RB={})),(function(e){function t(r){let i=r;return i&&(Ze.string(i.detail)||i.detail===void 0)&&(Ze.string(i.description)||i.description===void 0)}o(t,"is"),S(t,"is"),e.is=t})(LB||(LB={})),(function(e){function t(r){return{label:r}}o(t,"create"),S(t,"create"),e.create=t})(MB||(MB={})),(function(e){function t(r,i){return{items:r||[],isIncomplete:!!i}}o(t,"create"),S(t,"create"),e.create=t})(NB||(NB={})),(function(e){function t(i){return i.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}o(t,"fromPlainText"),S(t,"fromPlainText"),e.fromPlainText=t;function r(i){let n=i;return Ze.string(n)||Ze.objectLiteral(n)&&Ze.string(n.language)&&Ze.string(n.value)}o(r,"is"),S(r,"is"),e.is=r})(M2||(M2={})),(function(e){function t(r){let i=r;return!!i&&Ze.objectLiteral(i)&&(D1.is(i.contents)||M2.is(i.contents)||Ze.typedArray(i.contents,M2.is))&&(r.range===void 0||qr.is(r.range))}o(t,"is"),S(t,"is"),e.is=t})(IB||(IB={})),(function(e){function t(r,i){return i?{label:r,documentation:i}:{label:r}}o(t,"create"),S(t,"create"),e.create=t})(OB||(OB={})),(function(e){function t(r,i,...n){let a={label:r};return Ze.defined(i)&&(a.documentation=i),Ze.defined(n)?a.parameters=n:a.parameters=[],a}o(t,"create"),S(t,"create"),e.create=t})(PB||(PB={})),(function(e){e.Text=1,e.Read=2,e.Write=3})(BB||(BB={})),(function(e){function t(r,i){let n={range:r};return Ze.number(i)&&(n.kind=i),n}o(t,"create"),S(t,"create"),e.create=t})(FB||(FB={})),(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})($B||($B={})),(function(e){e.Deprecated=1})(zB||(zB={})),(function(e){function t(r,i,n,a,s){let l={name:r,kind:i,location:{uri:a,range:n}};return s&&(l.containerName=s),l}o(t,"create"),S(t,"create"),e.create=t})(GB||(GB={})),(function(e){function t(r,i,n,a){return a!==void 0?{name:r,kind:i,location:{uri:n,range:a}}:{name:r,kind:i,location:{uri:n}}}o(t,"create"),S(t,"create"),e.create=t})(VB||(VB={})),(function(e){function t(i,n,a,s,l,u){let h={name:i,detail:n,kind:a,range:s,selectionRange:l};return u!==void 0&&(h.children=u),h}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return n&&Ze.string(n.name)&&Ze.number(n.kind)&&qr.is(n.range)&&qr.is(n.selectionRange)&&(n.detail===void 0||Ze.string(n.detail))&&(n.deprecated===void 0||Ze.boolean(n.deprecated))&&(n.children===void 0||Array.isArray(n.children))&&(n.tags===void 0||Array.isArray(n.tags))}o(r,"is"),S(r,"is"),e.is=r})(WB||(WB={})),(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(qB||(qB={})),(function(e){e.Invoked=1,e.Automatic=2})(N2||(N2={})),(function(e){function t(i,n,a){let s={diagnostics:i};return n!=null&&(s.only=n),a!=null&&(s.triggerKind=a),s}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&Ze.typedArray(n.diagnostics,D2.is)&&(n.only===void 0||Ze.typedArray(n.only,Ze.string))&&(n.triggerKind===void 0||n.triggerKind===N2.Invoked||n.triggerKind===N2.Automatic)}o(r,"is"),S(r,"is"),e.is=r})(UB||(UB={})),(function(e){function t(i,n,a){let s={title:i},l=!0;return typeof n=="string"?(l=!1,s.kind=n):l0.is(n)?s.command=n:s.edit=n,l&&a!==void 0&&(s.kind=a),s}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return n&&Ze.string(n.title)&&(n.diagnostics===void 0||Ze.typedArray(n.diagnostics,D2.is))&&(n.kind===void 0||Ze.string(n.kind))&&(n.edit!==void 0||n.command!==void 0)&&(n.command===void 0||l0.is(n.command))&&(n.isPreferred===void 0||Ze.boolean(n.isPreferred))&&(n.edit===void 0||PE.is(n.edit))}o(r,"is"),S(r,"is"),e.is=r})(HB||(HB={})),(function(e){function t(i,n){let a={range:i};return Ze.defined(n)&&(a.data=n),a}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&qr.is(n.range)&&(Ze.undefined(n.command)||l0.is(n.command))}o(r,"is"),S(r,"is"),e.is=r})(YB||(YB={})),(function(e){function t(i,n){return{tabSize:i,insertSpaces:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&Ze.uinteger(n.tabSize)&&Ze.boolean(n.insertSpaces)}o(r,"is"),S(r,"is"),e.is=r})(jB||(jB={})),(function(e){function t(i,n,a){return{range:i,target:n,data:a}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&qr.is(n.range)&&(Ze.undefined(n.target)||Ze.string(n.target))}o(r,"is"),S(r,"is"),e.is=r})(XB||(XB={})),(function(e){function t(i,n){return{range:i,parent:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&qr.is(n.range)&&(n.parent===void 0||e.is(n.parent))}o(r,"is"),S(r,"is"),e.is=r})(KB||(KB={})),(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(ZB||(ZB={})),(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(QB||(QB={})),(function(e){function t(r){let i=r;return Ze.objectLiteral(i)&&(i.resultId===void 0||typeof i.resultId=="string")&&Array.isArray(i.data)&&(i.data.length===0||typeof i.data[0]=="number")}o(t,"is"),S(t,"is"),e.is=t})(JB||(JB={})),(function(e){function t(i,n){return{range:i,text:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return n!=null&&qr.is(n.range)&&Ze.string(n.text)}o(r,"is"),S(r,"is"),e.is=r})(eF||(eF={})),(function(e){function t(i,n,a){return{range:i,variableName:n,caseSensitiveLookup:a}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return n!=null&&qr.is(n.range)&&Ze.boolean(n.caseSensitiveLookup)&&(Ze.string(n.variableName)||n.variableName===void 0)}o(r,"is"),S(r,"is"),e.is=r})(tF||(tF={})),(function(e){function t(i,n){return{range:i,expression:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return n!=null&&qr.is(n.range)&&(Ze.string(n.expression)||n.expression===void 0)}o(r,"is"),S(r,"is"),e.is=r})(rF||(rF={})),(function(e){function t(i,n){return{frameId:i,stoppedLocation:n}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.defined(n)&&qr.is(i.stoppedLocation)}o(r,"is"),S(r,"is"),e.is=r})(iF||(iF={})),(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}o(t,"is"),S(t,"is"),e.is=t})(FE||(FE={})),(function(e){function t(i){return{value:i}}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&(n.tooltip===void 0||Ze.string(n.tooltip)||D1.is(n.tooltip))&&(n.location===void 0||_2.is(n.location))&&(n.command===void 0||l0.is(n.command))}o(r,"is"),S(r,"is"),e.is=r})($E||($E={})),(function(e){function t(i,n,a){let s={position:i,label:n};return a!==void 0&&(s.kind=a),s}o(t,"create"),S(t,"create"),e.create=t;function r(i){let n=i;return Ze.objectLiteral(n)&&ai.is(n.position)&&(Ze.string(n.label)||Ze.typedArray(n.label,$E.is))&&(n.kind===void 0||FE.is(n.kind))&&n.textEdits===void 0||Ze.typedArray(n.textEdits,qc.is)&&(n.tooltip===void 0||Ze.string(n.tooltip)||D1.is(n.tooltip))&&(n.paddingLeft===void 0||Ze.boolean(n.paddingLeft))&&(n.paddingRight===void 0||Ze.boolean(n.paddingRight))}o(r,"is"),S(r,"is"),e.is=r})(nF||(nF={})),(function(e){function t(r){return{kind:"snippet",value:r}}o(t,"createSnippet"),S(t,"createSnippet"),e.createSnippet=t})(aF||(aF={})),(function(e){function t(r,i,n,a){return{insertText:r,filterText:i,range:n,command:a}}o(t,"create"),S(t,"create"),e.create=t})(sF||(sF={})),(function(e){function t(r){return{items:r}}o(t,"create"),S(t,"create"),e.create=t})(oF||(oF={})),(function(e){e.Invoked=0,e.Automatic=1})(lF||(lF={})),(function(e){function t(r,i){return{range:r,text:i}}o(t,"create"),S(t,"create"),e.create=t})(cF||(cF={})),(function(e){function t(r,i){return{triggerKind:r,selectedCompletionInfo:i}}o(t,"create"),S(t,"create"),e.create=t})(uF||(uF={})),(function(e){function t(r){let i=r;return Ze.objectLiteral(i)&&NE.is(i.uri)&&Ze.string(i.name)}o(t,"is"),S(t,"is"),e.is=t})(hF||(hF={})),rve=[` +`,`\r +`,"\r"],(function(e){function t(a,s,l,u){return new m1e(a,s,l,u)}o(t,"create"),S(t,"create"),e.create=t;function r(a){let s=a;return!!(Ze.defined(s)&&Ze.string(s.uri)&&(Ze.undefined(s.languageId)||Ze.string(s.languageId))&&Ze.uinteger(s.lineCount)&&Ze.func(s.getText)&&Ze.func(s.positionAt)&&Ze.func(s.offsetAt))}o(r,"is"),S(r,"is"),e.is=r;function i(a,s){let l=a.getText(),u=n(s,(d,f)=>{let p=d.range.start.line-f.range.start.line;return p===0?d.range.start.character-f.range.start.character:p}),h=l.length;for(let d=u.length-1;d>=0;d--){let f=u[d],p=a.offsetAt(f.range.start),m=a.offsetAt(f.range.end);if(m<=h)l=l.substring(0,p)+f.newText+l.substring(m,l.length);else throw new Error("Overlapping edit");h=p}return l}o(i,"applyEdits"),S(i,"applyEdits"),e.applyEdits=i;function n(a,s){if(a.length<=1)return a;let l=a.length/2|0,u=a.slice(0,l),h=a.slice(l);n(u,s),n(h,s);let d=0,f=0,p=0;for(;d0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),r=0,i=t.length;if(i===0)return ai.create(0,e);for(;re?i=a:r=a+1}let n=r-1;return ai.create(n,e-t[n])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let r=t[e.line],i=e.line+1"u"}o(i,"undefined2"),S(i,"undefined"),e.undefined=i;function n(m){return m===!0||m===!1}o(n,"boolean"),S(n,"boolean"),e.boolean=n;function a(m){return t.call(m)==="[object String]"}o(a,"string"),S(a,"string"),e.string=a;function s(m){return t.call(m)==="[object Number]"}o(s,"number"),S(s,"number"),e.number=s;function l(m,g,y){return t.call(m)==="[object Number]"&&g<=m&&m<=y}o(l,"numberRange"),S(l,"numberRange"),e.numberRange=l;function u(m){return t.call(m)==="[object Number]"&&-2147483648<=m&&m<=2147483647}o(u,"integer2"),S(u,"integer"),e.integer=u;function h(m){return t.call(m)==="[object Number]"&&0<=m&&m<=2147483647}o(h,"uinteger2"),S(h,"uinteger"),e.uinteger=h;function d(m){return t.call(m)==="[object Function]"}o(d,"func"),S(d,"func"),e.func=d;function f(m){return m!==null&&typeof m=="object"}o(f,"objectLiteral"),S(f,"objectLiteral"),e.objectLiteral=f;function p(m,g){return Array.isArray(m)&&m.every(g)}o(p,"typedArray"),S(p,"typedArray"),e.typedArray=p})(Ze||(Ze={}))}}),W0=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/ral.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t;function r(){if(t===void 0)throw new Error("No runtime abstraction layer installed");return t}o(r,"RAL"),S(r,"RAL"),(function(i){function n(a){if(a===void 0)throw new Error("No runtime abstraction layer provided");t=a}o(n,"install"),S(n,"install"),i.install=n})(r||(r={})),e.default=r}}),TT=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/is.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(u){return u===!0||u===!1}o(t,"boolean"),S(t,"boolean"),e.boolean=t;function r(u){return typeof u=="string"||u instanceof String}o(r,"string"),S(r,"string"),e.string=r;function i(u){return typeof u=="number"||u instanceof Number}o(i,"number"),S(i,"number"),e.number=i;function n(u){return u instanceof Error}o(n,"error"),S(n,"error"),e.error=n;function a(u){return typeof u=="function"}o(a,"func"),S(a,"func"),e.func=a;function s(u){return Array.isArray(u)}o(s,"array"),S(s,"array"),e.array=s;function l(u){return s(u)&&u.every(h=>r(h))}o(l,"stringArray"),S(l,"stringArray"),e.stringArray=l}}),ny=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/events.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;var t=W0(),r;(function(a){let s={dispose(){}};a.None=function(){return s}})(r||(e.Event=r={}));var i=class{static{o(this,"CallbackList")}static{S(this,"CallbackList")}add(a,s=null,l){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(a),this._contexts.push(s),Array.isArray(l)&&l.push({dispose:S(()=>this.remove(a,s),"dispose")})}remove(a,s=null){if(!this._callbacks)return;let l=!1;for(let u=0,h=this._callbacks.length;u{this._callbacks||(this._callbacks=new i),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(s,l);let h={dispose:S(()=>{this._callbacks&&(this._callbacks.remove(s,l),h.dispose=ive._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))},"dispose")};return Array.isArray(u)&&u.push(h),h}),this._event}fire(s){this._callbacks&&this._callbacks.invoke.call(this._callbacks,s)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};e.Emitter=n,n._noop=function(){}}}),U5=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/cancellation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;var t=W0(),r=TT(),i=ny(),n;(function(u){u.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:i.Event.None}),u.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:i.Event.None});function h(d){let f=d;return f&&(f===u.None||f===u.Cancelled||r.boolean(f.isCancellationRequested)&&!!f.onCancellationRequested)}o(h,"is"),S(h,"is"),u.is=h})(n||(e.CancellationToken=n={}));var a=Object.freeze(function(u,h){let d=(0,t.default)().timer.setTimeout(u.bind(h),0);return{dispose(){d.dispose()}}}),s=class{static{o(this,"MutableToken")}static{S(this,"MutableToken")}constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?a:(this._emitter||(this._emitter=new i.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},l=class{static{o(this,"CancellationTokenSource3")}static{S(this,"CancellationTokenSource")}get token(){return this._token||(this._token=new s),this._token}cancel(){this._token?this._token.cancel():this._token=n.Cancelled}dispose(){this._token?this._token instanceof s&&this._token.dispose():this._token=n.None}};e.CancellationTokenSource=l}}),nve=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messages.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Message=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType=e.RequestType0=e.AbstractMessageSignature=e.ParameterStructures=e.ResponseError=e.ErrorCodes=void 0;var t=TT(),r;(function(_){_.ParseError=-32700,_.InvalidRequest=-32600,_.MethodNotFound=-32601,_.InvalidParams=-32602,_.InternalError=-32603,_.jsonrpcReservedErrorRangeStart=-32099,_.serverErrorStart=-32099,_.MessageWriteError=-32099,_.MessageReadError=-32098,_.PendingResponseRejected=-32097,_.ConnectionInactive=-32096,_.ServerNotInitialized=-32002,_.UnknownErrorCode=-32001,_.jsonrpcReservedErrorRangeEnd=-32e3,_.serverErrorEnd=-32e3})(r||(e.ErrorCodes=r={}));var i=class ave extends Error{static{o(this,"_ResponseError")}static{S(this,"ResponseError")}constructor(R,M,L){super(M),this.code=t.number(R)?R:r.UnknownErrorCode,this.data=L,Object.setPrototypeOf(this,ave.prototype)}toJson(){let R={code:this.code,message:this.message};return this.data!==void 0&&(R.data=this.data),R}};e.ResponseError=i;var n=class zE{static{o(this,"_ParameterStructures")}static{S(this,"ParameterStructures")}constructor(R){this.kind=R}static is(R){return R===zE.auto||R===zE.byName||R===zE.byPosition}toString(){return this.kind}};e.ParameterStructures=n,n.auto=new n("auto"),n.byPosition=new n("byPosition"),n.byName=new n("byName");var a=class{static{o(this,"AbstractMessageSignature")}static{S(this,"AbstractMessageSignature")}constructor(_,R){this.method=_,this.numberOfParams=R}get parameterStructures(){return n.auto}};e.AbstractMessageSignature=a;var s=class extends a{static{o(this,"RequestType0")}static{S(this,"RequestType0")}constructor(_){super(_,0)}};e.RequestType0=s;var l=class extends a{static{o(this,"RequestType")}static{S(this,"RequestType")}constructor(_,R=n.auto){super(_,1),this._parameterStructures=R}get parameterStructures(){return this._parameterStructures}};e.RequestType=l;var u=class extends a{static{o(this,"RequestType1")}static{S(this,"RequestType1")}constructor(_,R=n.auto){super(_,1),this._parameterStructures=R}get parameterStructures(){return this._parameterStructures}};e.RequestType1=u;var h=class extends a{static{o(this,"RequestType2")}static{S(this,"RequestType2")}constructor(_){super(_,2)}};e.RequestType2=h;var d=class extends a{static{o(this,"RequestType3")}static{S(this,"RequestType3")}constructor(_){super(_,3)}};e.RequestType3=d;var f=class extends a{static{o(this,"RequestType4")}static{S(this,"RequestType4")}constructor(_){super(_,4)}};e.RequestType4=f;var p=class extends a{static{o(this,"RequestType5")}static{S(this,"RequestType5")}constructor(_){super(_,5)}};e.RequestType5=p;var m=class extends a{static{o(this,"RequestType6")}static{S(this,"RequestType6")}constructor(_){super(_,6)}};e.RequestType6=m;var g=class extends a{static{o(this,"RequestType7")}static{S(this,"RequestType7")}constructor(_){super(_,7)}};e.RequestType7=g;var y=class extends a{static{o(this,"RequestType8")}static{S(this,"RequestType8")}constructor(_){super(_,8)}};e.RequestType8=y;var v=class extends a{static{o(this,"RequestType9")}static{S(this,"RequestType9")}constructor(_){super(_,9)}};e.RequestType9=v;var x=class extends a{static{o(this,"NotificationType")}static{S(this,"NotificationType")}constructor(_,R=n.auto){super(_,1),this._parameterStructures=R}get parameterStructures(){return this._parameterStructures}};e.NotificationType=x;var b=class extends a{static{o(this,"NotificationType0")}static{S(this,"NotificationType0")}constructor(_){super(_,0)}};e.NotificationType0=b;var T=class extends a{static{o(this,"NotificationType1")}static{S(this,"NotificationType1")}constructor(_,R=n.auto){super(_,1),this._parameterStructures=R}get parameterStructures(){return this._parameterStructures}};e.NotificationType1=T;var w=class extends a{static{o(this,"NotificationType2")}static{S(this,"NotificationType2")}constructor(_){super(_,2)}};e.NotificationType2=w;var C=class extends a{static{o(this,"NotificationType3")}static{S(this,"NotificationType3")}constructor(_){super(_,3)}};e.NotificationType3=C;var k=class extends a{static{o(this,"NotificationType4")}static{S(this,"NotificationType4")}constructor(_){super(_,4)}};e.NotificationType4=k;var E=class extends a{static{o(this,"NotificationType5")}static{S(this,"NotificationType5")}constructor(_){super(_,5)}};e.NotificationType5=E;var A=class extends a{static{o(this,"NotificationType6")}static{S(this,"NotificationType6")}constructor(_){super(_,6)}};e.NotificationType6=A;var N=class extends a{static{o(this,"NotificationType7")}static{S(this,"NotificationType7")}constructor(_){super(_,7)}};e.NotificationType7=N;var P=class extends a{static{o(this,"NotificationType8")}static{S(this,"NotificationType8")}constructor(_){super(_,8)}};e.NotificationType8=P;var I=class extends a{static{o(this,"NotificationType9")}static{S(this,"NotificationType9")}constructor(_){super(_,9)}};e.NotificationType9=I;var D;(function(_){function R(B){let O=B;return O&&t.string(O.method)&&(t.string(O.id)||t.number(O.id))}o(R,"isRequest"),S(R,"isRequest"),_.isRequest=R;function M(B){let O=B;return O&&t.string(O.method)&&B.id===void 0}o(M,"isNotification"),S(M,"isNotification"),_.isNotification=M;function L(B){let O=B;return O&&(O.result!==void 0||!!O.error)&&(t.string(O.id)||t.number(O.id)||O.id===null)}o(L,"isResponse"),S(L,"isResponse"),_.isResponse=L})(D||(e.Message=D={}))}}),sve=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(e){"use strict";var t;Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=e.LinkedMap=e.Touch=void 0;var r;(function(a){a.None=0,a.First=1,a.AsOld=a.First,a.Last=2,a.AsNew=a.Last})(r||(e.Touch=r={}));var i=class{static{o(this,"LinkedMap")}static{S(this,"LinkedMap")}constructor(){this[t]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(a){return this._map.has(a)}get(a,s=r.None){let l=this._map.get(a);if(l)return s!==r.None&&this.touch(l,s),l.value}set(a,s,l=r.None){let u=this._map.get(a);if(u)u.value=s,l!==r.None&&this.touch(u,l);else{switch(u={key:a,value:s,next:void 0,previous:void 0},l){case r.None:this.addItemLast(u);break;case r.First:this.addItemFirst(u);break;case r.Last:this.addItemLast(u);break;default:this.addItemLast(u);break}this._map.set(a,u),this._size++}return this}delete(a){return!!this.remove(a)}remove(a){let s=this._map.get(a);if(s)return this._map.delete(a),this.removeItem(s),this._size--,s.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let a=this._head;return this._map.delete(a.key),this.removeItem(a),this._size--,a.value}forEach(a,s){let l=this._state,u=this._head;for(;u;){if(s?a.bind(s)(u.value,u.key,this):a(u.value,u.key,this),this._state!==l)throw new Error("LinkedMap got modified during iteration.");u=u.next}}keys(){let a=this._state,s=this._head,l={[Symbol.iterator]:()=>l,next:S(()=>{if(this._state!==a)throw new Error("LinkedMap got modified during iteration.");if(s){let u={value:s.key,done:!1};return s=s.next,u}else return{value:void 0,done:!0}},"next")};return l}values(){let a=this._state,s=this._head,l={[Symbol.iterator]:()=>l,next:S(()=>{if(this._state!==a)throw new Error("LinkedMap got modified during iteration.");if(s){let u={value:s.value,done:!1};return s=s.next,u}else return{value:void 0,done:!0}},"next")};return l}entries(){let a=this._state,s=this._head,l={[Symbol.iterator]:()=>l,next:S(()=>{if(this._state!==a)throw new Error("LinkedMap got modified during iteration.");if(s){let u={value:[s.key,s.value],done:!1};return s=s.next,u}else return{value:void 0,done:!0}},"next")};return l}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(a){if(a>=this.size)return;if(a===0){this.clear();return}let s=this._head,l=this.size;for(;s&&l>a;)this._map.delete(s.key),s=s.next,l--;this._head=s,this._size=l,s&&(s.previous=void 0),this._state++}addItemFirst(a){if(!this._head&&!this._tail)this._tail=a;else if(this._head)a.next=this._head,this._head.previous=a;else throw new Error("Invalid list");this._head=a,this._state++}addItemLast(a){if(!this._head&&!this._tail)this._head=a;else if(this._tail)a.previous=this._tail,this._tail.next=a;else throw new Error("Invalid list");this._tail=a,this._state++}removeItem(a){if(a===this._head&&a===this._tail)this._head=void 0,this._tail=void 0;else if(a===this._head){if(!a.next)throw new Error("Invalid list");a.next.previous=void 0,this._head=a.next}else if(a===this._tail){if(!a.previous)throw new Error("Invalid list");a.previous.next=void 0,this._tail=a.previous}else{let s=a.next,l=a.previous;if(!s||!l)throw new Error("Invalid list");s.previous=l,l.next=s}a.next=void 0,a.previous=void 0,this._state++}touch(a,s){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(s!==r.First&&s!==r.Last)){if(s===r.First){if(a===this._head)return;let l=a.next,u=a.previous;a===this._tail?(u.next=void 0,this._tail=u):(l.previous=u,u.next=l),a.previous=void 0,a.next=this._head,this._head.previous=a,this._head=a,this._state++}else if(s===r.Last){if(a===this._tail)return;let l=a.next,u=a.previous;a===this._head?(l.previous=void 0,this._head=l):(l.previous=u,u.next=l),a.next=void 0,a.previous=this._tail,this._tail.next=a,this._tail=a,this._state++}}}toJSON(){let a=[];return this.forEach((s,l)=>{a.push([l,s])}),a}fromJSON(a){this.clear();for(let[s,l]of a)this.set(s,l)}};e.LinkedMap=i;var n=class extends i{static{o(this,"LRUCache")}static{S(this,"LRUCache")}constructor(a,s=1){super(),this._limit=a,this._ratio=Math.min(Math.max(0,s),1)}get limit(){return this._limit}set limit(a){this._limit=a,this.checkTrim()}get ratio(){return this._ratio}set ratio(a){this._ratio=Math.min(Math.max(0,a),1),this.checkTrim()}get(a,s=r.AsNew){return super.get(a,s)}peek(a){return super.get(a,r.None)}set(a,s){return super.set(a,s,r.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};e.LRUCache=n}}),ylt=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/disposable.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Disposable=void 0;var t;(function(r){function i(n){return{dispose:n}}o(i,"create"),S(i,"create"),r.create=i})(t||(e.Disposable=t={}))}}),vlt=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=void 0;var t=U5(),r;(function(l){l.Continue=0,l.Cancelled=1})(r||(r={}));var i=class{static{o(this,"SharedArraySenderStrategy")}static{S(this,"SharedArraySenderStrategy")}constructor(){this.buffers=new Map}enableCancellation(l){if(l.id===null)return;let u=new SharedArrayBuffer(4),h=new Int32Array(u,0,1);h[0]=r.Continue,this.buffers.set(l.id,u),l.$cancellationData=u}async sendCancellation(l,u){let h=this.buffers.get(u);if(h===void 0)return;let d=new Int32Array(h,0,1);Atomics.store(d,0,r.Cancelled)}cleanup(l){this.buffers.delete(l)}dispose(){this.buffers.clear()}};e.SharedArraySenderStrategy=i;var n=class{static{o(this,"SharedArrayBufferCancellationToken")}static{S(this,"SharedArrayBufferCancellationToken")}constructor(l){this.data=new Int32Array(l,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===r.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},a=class{static{o(this,"SharedArrayBufferCancellationTokenSource")}static{S(this,"SharedArrayBufferCancellationTokenSource")}constructor(l){this.token=new n(l)}cancel(){}dispose(){}},s=class{static{o(this,"SharedArrayReceiverStrategy")}static{S(this,"SharedArrayReceiverStrategy")}constructor(){this.kind="request"}createCancellationTokenSource(l){let u=l.$cancellationData;return u===void 0?new t.CancellationTokenSource:new a(u)}};e.SharedArrayReceiverStrategy=s}}),ove=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/semaphore.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Semaphore=void 0;var t=W0(),r=class{static{o(this,"Semaphore")}static{S(this,"Semaphore")}constructor(i=1){if(i<=0)throw new Error("Capacity must be greater than 0");this._capacity=i,this._active=0,this._waiting=[]}lock(i){return new Promise((n,a)=>{this._waiting.push({thunk:i,resolve:n,reject:a}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let i=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{let n=i.thunk();n instanceof Promise?n.then(a=>{this._active--,i.resolve(a),this.runNext()},a=>{this._active--,i.reject(a),this.runNext()}):(this._active--,i.resolve(n),this.runNext())}catch(n){this._active--,i.reject(n),this.runNext()}}};e.Semaphore=r}}),xlt=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageReader.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;var t=W0(),r=TT(),i=ny(),n=ove(),a;(function(h){function d(f){let p=f;return p&&r.func(p.listen)&&r.func(p.dispose)&&r.func(p.onError)&&r.func(p.onClose)&&r.func(p.onPartialMessage)}o(d,"is"),S(d,"is"),h.is=d})(a||(e.MessageReader=a={}));var s=class{static{o(this,"AbstractMessageReader")}static{S(this,"AbstractMessageReader")}constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter,this.partialMessageEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(h){this.errorEmitter.fire(this.asError(h))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(h){this.partialMessageEmitter.fire(h)}asError(h){return h instanceof Error?h:new Error(`Reader received error. Reason: ${r.string(h.message)?h.message:"unknown"}`)}};e.AbstractMessageReader=s;var l;(function(h){function d(f){let p,m,g,y=new Map,v,x=new Map;if(f===void 0||typeof f=="string")p=f??"utf-8";else{if(p=f.charset??"utf-8",f.contentDecoder!==void 0&&(g=f.contentDecoder,y.set(g.name,g)),f.contentDecoders!==void 0)for(let b of f.contentDecoders)y.set(b.name,b);if(f.contentTypeDecoder!==void 0&&(v=f.contentTypeDecoder,x.set(v.name,v)),f.contentTypeDecoders!==void 0)for(let b of f.contentTypeDecoders)x.set(b.name,b)}return v===void 0&&(v=(0,t.default)().applicationJson.decoder,x.set(v.name,v)),{charset:p,contentDecoder:g,contentDecoders:y,contentTypeDecoder:v,contentTypeDecoders:x}}o(d,"fromOptions"),S(d,"fromOptions"),h.fromOptions=d})(l||(l={}));var u=class extends s{static{o(this,"ReadableStreamMessageReader")}static{S(this,"ReadableStreamMessageReader")}constructor(h,d){super(),this.readable=h,this.options=l.fromOptions(d),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new n.Semaphore(1)}set partialMessageTimeout(h){this._partialMessageTimeout=h}get partialMessageTimeout(){return this._partialMessageTimeout}listen(h){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=h;let d=this.readable.onData(f=>{this.onData(f)});return this.readable.onError(f=>this.fireError(f)),this.readable.onClose(()=>this.fireClose()),d}onData(h){try{for(this.buffer.append(h);;){if(this.nextMessageLength===-1){let f=this.buffer.tryReadHeaders(!0);if(!f)return;let p=f.get("content-length");if(!p){this.fireError(new Error(`Header must provide a Content-Length property. +${JSON.stringify(Object.fromEntries(f))}`));return}let m=parseInt(p);if(isNaN(m)){this.fireError(new Error(`Content-Length value must be a number. Got ${p}`));return}this.nextMessageLength=m}let d=this.buffer.tryReadBody(this.nextMessageLength);if(d===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let f=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(d):d,p=await this.options.contentTypeDecoder.decode(f,this.options);this.callback(p)}).catch(f=>{this.fireError(f)})}}catch(d){this.fireError(d)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((h,d)=>{this.partialMessageTimer=void 0,h===this.messageToken&&(this.firePartialMessage({messageToken:h,waitingTime:d}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};e.ReadableStreamMessageReader=u}}),blt=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;var t=W0(),r=TT(),i=ove(),n=ny(),a="Content-Length: ",s=`\r +`,l;(function(f){function p(m){let g=m;return g&&r.func(g.dispose)&&r.func(g.onClose)&&r.func(g.onError)&&r.func(g.write)}o(p,"is"),S(p,"is"),f.is=p})(l||(e.MessageWriter=l={}));var u=class{static{o(this,"AbstractMessageWriter")}static{S(this,"AbstractMessageWriter")}constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(f,p,m){this.errorEmitter.fire([this.asError(f),p,m])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(f){return f instanceof Error?f:new Error(`Writer received error. Reason: ${r.string(f.message)?f.message:"unknown"}`)}};e.AbstractMessageWriter=u;var h;(function(f){function p(m){return m===void 0||typeof m=="string"?{charset:m??"utf-8",contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:m.charset??"utf-8",contentEncoder:m.contentEncoder,contentTypeEncoder:m.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}o(p,"fromOptions"),S(p,"fromOptions"),f.fromOptions=p})(h||(h={}));var d=class extends u{static{o(this,"WriteableStreamMessageWriter")}static{S(this,"WriteableStreamMessageWriter")}constructor(f,p){super(),this.writable=f,this.options=h.fromOptions(p),this.errorCount=0,this.writeSemaphore=new i.Semaphore(1),this.writable.onError(m=>this.fireError(m)),this.writable.onClose(()=>this.fireClose())}async write(f){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(f,this.options).then(m=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(m):m).then(m=>{let g=[];return g.push(a,m.byteLength.toString(),s),g.push(s),this.doWrite(f,g,m)},m=>{throw this.fireError(m),m}))}async doWrite(f,p,m){try{return await this.writable.write(p.join(""),"ascii"),this.writable.write(m)}catch(g){return this.handleError(g,f),Promise.reject(g)}}handleError(f,p){this.errorCount++,this.fireError(f,p,this.errorCount)}end(){this.writable.end()}};e.WriteableStreamMessageWriter=d}}),Tlt=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMessageBuffer=void 0;var t=13,r=10,i=`\r +`,n=class{static{o(this,"AbstractMessageBuffer")}static{S(this,"AbstractMessageBuffer")}constructor(a="utf-8"){this._encoding=a,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(a){let s=typeof a=="string"?this.fromString(a,this._encoding):a;this._chunks.push(s),this._totalLength+=s.byteLength}tryReadHeaders(a=!1){if(this._chunks.length===0)return;let s=0,l=0,u=0,h=0;e:for(;lthis._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===a){let h=this._chunks[0];return this._chunks.shift(),this._totalLength-=a,this.asNative(h)}if(this._chunks[0].byteLength>a){let h=this._chunks[0],d=this.asNative(h,a);return this._chunks[0]=h.slice(a),this._totalLength-=a,d}let s=this.allocNative(a),l=0,u=0;for(;a>0;){let h=this._chunks[u];if(h.byteLength>a){let d=h.slice(0,a);s.set(d,l),l+=a,this._chunks[u]=h.slice(a),this._totalLength-=a,a-=a}else s.set(h,l),l+=h.byteLength,this._chunks.shift(),this._totalLength-=h.byteLength,a-=h.byteLength}return s}};e.AbstractMessageBuffer=n}}),Clt=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/connection.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;var t=W0(),r=TT(),i=nve(),n=sve(),a=ny(),s=U5(),l;(function(_){_.type=new i.NotificationType("$/cancelRequest")})(l||(l={}));var u;(function(_){function R(M){return typeof M=="string"||typeof M=="number"}o(R,"is"),S(R,"is"),_.is=R})(u||(e.ProgressToken=u={}));var h;(function(_){_.type=new i.NotificationType("$/progress")})(h||(h={}));var d=class{static{o(this,"ProgressType")}static{S(this,"ProgressType")}constructor(){}};e.ProgressType=d;var f;(function(_){function R(M){return r.func(M)}o(R,"is"),S(R,"is"),_.is=R})(f||(f={})),e.NullLogger=Object.freeze({error:S(()=>{},"error"),warn:S(()=>{},"warn"),info:S(()=>{},"info"),log:S(()=>{},"log")});var p;(function(_){_[_.Off=0]="Off",_[_.Messages=1]="Messages",_[_.Compact=2]="Compact",_[_.Verbose=3]="Verbose"})(p||(e.Trace=p={}));var m;(function(_){_.Off="off",_.Messages="messages",_.Compact="compact",_.Verbose="verbose"})(m||(e.TraceValues=m={})),(function(_){function R(L){if(!r.string(L))return _.Off;switch(L=L.toLowerCase(),L){case"off":return _.Off;case"messages":return _.Messages;case"compact":return _.Compact;case"verbose":return _.Verbose;default:return _.Off}}o(R,"fromString"),S(R,"fromString"),_.fromString=R;function M(L){switch(L){case _.Off:return"off";case _.Messages:return"messages";case _.Compact:return"compact";case _.Verbose:return"verbose";default:return"off"}}o(M,"toString4"),S(M,"toString"),_.toString=M})(p||(e.Trace=p={}));var g;(function(_){_.Text="text",_.JSON="json"})(g||(e.TraceFormat=g={})),(function(_){function R(M){return r.string(M)?(M=M.toLowerCase(),M==="json"?_.JSON:_.Text):_.Text}o(R,"fromString"),S(R,"fromString"),_.fromString=R})(g||(e.TraceFormat=g={}));var y;(function(_){_.type=new i.NotificationType("$/setTrace")})(y||(e.SetTraceNotification=y={}));var v;(function(_){_.type=new i.NotificationType("$/logTrace")})(v||(e.LogTraceNotification=v={}));var x;(function(_){_[_.Closed=1]="Closed",_[_.Disposed=2]="Disposed",_[_.AlreadyListening=3]="AlreadyListening"})(x||(e.ConnectionErrors=x={}));var b=class lve extends Error{static{o(this,"_ConnectionError")}static{S(this,"ConnectionError")}constructor(R,M){super(M),this.code=R,Object.setPrototypeOf(this,lve.prototype)}};e.ConnectionError=b;var T;(function(_){function R(M){let L=M;return L&&r.func(L.cancelUndispatched)}o(R,"is"),S(R,"is"),_.is=R})(T||(e.ConnectionStrategy=T={}));var w;(function(_){function R(M){let L=M;return L&&(L.kind===void 0||L.kind==="id")&&r.func(L.createCancellationTokenSource)&&(L.dispose===void 0||r.func(L.dispose))}o(R,"is"),S(R,"is"),_.is=R})(w||(e.IdCancellationReceiverStrategy=w={}));var C;(function(_){function R(M){let L=M;return L&&L.kind==="request"&&r.func(L.createCancellationTokenSource)&&(L.dispose===void 0||r.func(L.dispose))}o(R,"is"),S(R,"is"),_.is=R})(C||(e.RequestCancellationReceiverStrategy=C={}));var k;(function(_){_.Message=Object.freeze({createCancellationTokenSource(M){return new s.CancellationTokenSource}});function R(M){return w.is(M)||C.is(M)}o(R,"is"),S(R,"is"),_.is=R})(k||(e.CancellationReceiverStrategy=k={}));var E;(function(_){_.Message=Object.freeze({sendCancellation(M,L){return M.sendNotification(l.type,{id:L})},cleanup(M){}});function R(M){let L=M;return L&&r.func(L.sendCancellation)&&r.func(L.cleanup)}o(R,"is"),S(R,"is"),_.is=R})(E||(e.CancellationSenderStrategy=E={}));var A;(function(_){_.Message=Object.freeze({receiver:k.Message,sender:E.Message});function R(M){let L=M;return L&&k.is(L.receiver)&&E.is(L.sender)}o(R,"is"),S(R,"is"),_.is=R})(A||(e.CancellationStrategy=A={}));var N;(function(_){function R(M){let L=M;return L&&r.func(L.handleMessage)}o(R,"is"),S(R,"is"),_.is=R})(N||(e.MessageStrategy=N={}));var P;(function(_){function R(M){let L=M;return L&&(A.is(L.cancellationStrategy)||T.is(L.connectionStrategy)||N.is(L.messageStrategy))}o(R,"is"),S(R,"is"),_.is=R})(P||(e.ConnectionOptions=P={}));var I;(function(_){_[_.New=1]="New",_[_.Listening=2]="Listening",_[_.Closed=3]="Closed",_[_.Disposed=4]="Disposed"})(I||(I={}));function D(_,R,M,L){let B=M!==void 0?M:e.NullLogger,O=0,$=0,G=0,F="2.0",V,H=new Map,j,U=new Map,Q=new Map,Y,ae=new n.LinkedMap,J=new Map,te=new Set,re=new Map,ee=p.Off,Te=g.Text,ue,De=I.New,Ie=new a.Emitter,Ee=new a.Emitter,we=new a.Emitter,Me=new a.Emitter,$e=new a.Emitter,de=L&&L.cancellationStrategy?L.cancellationStrategy:A.Message;function rt(pe){if(pe===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+pe.toString()}o(rt,"createRequestQueueKey"),S(rt,"createRequestQueueKey");function ke(pe){return pe===null?"res-unknown-"+(++G).toString():"res-"+pe.toString()}o(ke,"createResponseQueueKey"),S(ke,"createResponseQueueKey");function Fe(){return"not-"+(++$).toString()}o(Fe,"createNotificationQueueKey"),S(Fe,"createNotificationQueueKey");function He(pe,Qe){i.Message.isRequest(Qe)?pe.set(rt(Qe.id),Qe):i.Message.isResponse(Qe)?pe.set(ke(Qe.id),Qe):pe.set(Fe(),Qe)}o(He,"addMessageToQueue"),S(He,"addMessageToQueue");function at(pe){}o(at,"cancelUndispatched"),S(at,"cancelUndispatched");function qe(){return De===I.Listening}o(qe,"isListening"),S(qe,"isListening");function Ue(){return De===I.Closed}o(Ue,"isClosed"),S(Ue,"isClosed");function ye(){return De===I.Disposed}o(ye,"isDisposed"),S(ye,"isDisposed");function ve(){(De===I.New||De===I.Listening)&&(De=I.Closed,Ee.fire(void 0))}o(ve,"closeHandler"),S(ve,"closeHandler");function ie(pe){Ie.fire([pe,void 0,void 0])}o(ie,"readErrorHandler"),S(ie,"readErrorHandler");function fe(pe){Ie.fire(pe)}o(fe,"writeErrorHandler"),S(fe,"writeErrorHandler"),_.onClose(ve),_.onError(ie),R.onClose(ve),R.onError(fe);function W(){Y||ae.size===0||(Y=(0,t.default)().timer.setImmediate(()=>{Y=void 0,K()}))}o(W,"triggerMessageQueue"),S(W,"triggerMessageQueue");function ce(pe){i.Message.isRequest(pe)?xe(pe):i.Message.isNotification(pe)?be(pe):i.Message.isResponse(pe)?Oe(pe):Be(pe)}o(ce,"handleMessage"),S(ce,"handleMessage");function K(){if(ae.size===0)return;let pe=ae.shift();try{let Qe=L?.messageStrategy;N.is(Qe)?Qe.handleMessage(pe,ce):ce(pe)}finally{W()}}o(K,"processMessageQueue"),S(K,"processMessageQueue");let Re=S(pe=>{try{if(i.Message.isNotification(pe)&&pe.method===l.type.method){let Qe=pe.params.id,nt=rt(Qe),dt=ae.get(nt);if(i.Message.isRequest(dt)){let Rt=L?.connectionStrategy,$t=Rt&&Rt.cancelUndispatched?Rt.cancelUndispatched(dt,at):void 0;if($t&&($t.error!==void 0||$t.result!==void 0)){ae.delete(nt),re.delete(Qe),$t.id=dt.id,Ye($t,pe.method,Date.now()),R.write($t).catch(()=>B.error("Sending response for canceled message failed."));return}}let Ft=re.get(Qe);if(Ft!==void 0){Ft.cancel(),st(pe);return}else te.add(Qe)}He(ae,pe)}finally{W()}},"callback");function xe(pe){if(ye())return;function Qe(pt,Se,it){let xt={jsonrpc:F,id:pe.id};pt instanceof i.ResponseError?xt.error=pt.toJson():xt.result=pt===void 0?null:pt,Ye(xt,Se,it),R.write(xt).catch(()=>B.error("Sending response failed."))}o(Qe,"reply"),S(Qe,"reply");function nt(pt,Se,it){let xt={jsonrpc:F,id:pe.id,error:pt.toJson()};Ye(xt,Se,it),R.write(xt).catch(()=>B.error("Sending response failed."))}o(nt,"replyError"),S(nt,"replyError");function dt(pt,Se,it){pt===void 0&&(pt=null);let xt={jsonrpc:F,id:pe.id,result:pt};Ye(xt,Se,it),R.write(xt).catch(()=>B.error("Sending response failed."))}o(dt,"replySuccess"),S(dt,"replySuccess"),le(pe);let Ft=H.get(pe.method),Rt,$t;Ft&&(Rt=Ft.type,$t=Ft.handler);let lr=Date.now();if($t||V){let pt=pe.id??String(Date.now()),Se=w.is(de.receiver)?de.receiver.createCancellationTokenSource(pt):de.receiver.createCancellationTokenSource(pe);pe.id!==null&&te.has(pe.id)&&Se.cancel(),pe.id!==null&&re.set(pt,Se);try{let it;if($t)if(pe.params===void 0){if(Rt!==void 0&&Rt.numberOfParams!==0){nt(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${pe.method} defines ${Rt.numberOfParams} params but received none.`),pe.method,lr);return}it=$t(Se.token)}else if(Array.isArray(pe.params)){if(Rt!==void 0&&Rt.parameterStructures===i.ParameterStructures.byName){nt(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${pe.method} defines parameters by name but received parameters by position`),pe.method,lr);return}it=$t(...pe.params,Se.token)}else{if(Rt!==void 0&&Rt.parameterStructures===i.ParameterStructures.byPosition){nt(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${pe.method} defines parameters by position but received parameters by name`),pe.method,lr);return}it=$t(pe.params,Se.token)}else V&&(it=V(pe.method,pe.params,Se.token));let xt=it;it?xt.then?xt.then(rr=>{re.delete(pt),Qe(rr,pe.method,lr)},rr=>{re.delete(pt),rr instanceof i.ResponseError?nt(rr,pe.method,lr):rr&&r.string(rr.message)?nt(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${pe.method} failed with message: ${rr.message}`),pe.method,lr):nt(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${pe.method} failed unexpectedly without providing any details.`),pe.method,lr)}):(re.delete(pt),Qe(it,pe.method,lr)):(re.delete(pt),dt(it,pe.method,lr))}catch(it){re.delete(pt),it instanceof i.ResponseError?Qe(it,pe.method,lr):it&&r.string(it.message)?nt(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${pe.method} failed with message: ${it.message}`),pe.method,lr):nt(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${pe.method} failed unexpectedly without providing any details.`),pe.method,lr)}}else nt(new i.ResponseError(i.ErrorCodes.MethodNotFound,`Unhandled method ${pe.method}`),pe.method,lr)}o(xe,"handleRequest"),S(xe,"handleRequest");function Oe(pe){if(!ye())if(pe.id===null)pe.error?B.error(`Received response message without id: Error is: +${JSON.stringify(pe.error,void 0,4)}`):B.error("Received response message without id. No further error information provided.");else{let Qe=pe.id,nt=J.get(Qe);if(me(pe,nt),nt!==void 0){J.delete(Qe);try{if(pe.error){let dt=pe.error;nt.reject(new i.ResponseError(dt.code,dt.message,dt.data))}else if(pe.result!==void 0)nt.resolve(pe.result);else throw new Error("Should never happen.")}catch(dt){dt.message?B.error(`Response handler '${nt.method}' failed with message: ${dt.message}`):B.error(`Response handler '${nt.method}' failed unexpectedly.`)}}}}o(Oe,"handleResponse"),S(Oe,"handleResponse");function be(pe){if(ye())return;let Qe,nt;if(pe.method===l.type.method){let dt=pe.params.id;te.delete(dt),st(pe);return}else{let dt=U.get(pe.method);dt&&(nt=dt.handler,Qe=dt.type)}if(nt||j)try{if(st(pe),nt)if(pe.params===void 0)Qe!==void 0&&Qe.numberOfParams!==0&&Qe.parameterStructures!==i.ParameterStructures.byName&&B.error(`Notification ${pe.method} defines ${Qe.numberOfParams} params but received none.`),nt();else if(Array.isArray(pe.params)){let dt=pe.params;pe.method===h.type.method&&dt.length===2&&u.is(dt[0])?nt({token:dt[0],value:dt[1]}):(Qe!==void 0&&(Qe.parameterStructures===i.ParameterStructures.byName&&B.error(`Notification ${pe.method} defines parameters by name but received parameters by position`),Qe.numberOfParams!==pe.params.length&&B.error(`Notification ${pe.method} defines ${Qe.numberOfParams} params but received ${dt.length} arguments`)),nt(...dt))}else Qe!==void 0&&Qe.parameterStructures===i.ParameterStructures.byPosition&&B.error(`Notification ${pe.method} defines parameters by position but received parameters by name`),nt(pe.params);else j&&j(pe.method,pe.params)}catch(dt){dt.message?B.error(`Notification handler '${pe.method}' failed with message: ${dt.message}`):B.error(`Notification handler '${pe.method}' failed unexpectedly.`)}else we.fire(pe)}o(be,"handleNotification"),S(be,"handleNotification");function Be(pe){if(!pe){B.error("Received empty message.");return}B.error(`Received message which is neither a response nor a notification message: +${JSON.stringify(pe,null,4)}`);let Qe=pe;if(r.string(Qe.id)||r.number(Qe.id)){let nt=Qe.id,dt=J.get(nt);dt&&dt.reject(new Error("The received response has neither a result nor an error property."))}}o(Be,"handleInvalidMessage"),S(Be,"handleInvalidMessage");function Ae(pe){if(pe!=null)switch(ee){case p.Verbose:return JSON.stringify(pe,null,4);case p.Compact:return JSON.stringify(pe);default:return}}o(Ae,"stringifyTrace"),S(Ae,"stringifyTrace");function Ve(pe){if(!(ee===p.Off||!ue))if(Te===g.Text){let Qe;(ee===p.Verbose||ee===p.Compact)&&pe.params&&(Qe=`Params: ${Ae(pe.params)} + +`),ue.log(`Sending request '${pe.method} - (${pe.id})'.`,Qe)}else ot("send-request",pe)}o(Ve,"traceSendingRequest"),S(Ve,"traceSendingRequest");function Pe(pe){if(!(ee===p.Off||!ue))if(Te===g.Text){let Qe;(ee===p.Verbose||ee===p.Compact)&&(pe.params?Qe=`Params: ${Ae(pe.params)} + +`:Qe=`No parameters provided. + +`),ue.log(`Sending notification '${pe.method}'.`,Qe)}else ot("send-notification",pe)}o(Pe,"traceSendingNotification"),S(Pe,"traceSendingNotification");function Ye(pe,Qe,nt){if(!(ee===p.Off||!ue))if(Te===g.Text){let dt;(ee===p.Verbose||ee===p.Compact)&&(pe.error&&pe.error.data?dt=`Error data: ${Ae(pe.error.data)} + +`:pe.result?dt=`Result: ${Ae(pe.result)} + +`:pe.error===void 0&&(dt=`No result returned. + +`)),ue.log(`Sending response '${Qe} - (${pe.id})'. Processing request took ${Date.now()-nt}ms`,dt)}else ot("send-response",pe)}o(Ye,"traceSendingResponse"),S(Ye,"traceSendingResponse");function le(pe){if(!(ee===p.Off||!ue))if(Te===g.Text){let Qe;(ee===p.Verbose||ee===p.Compact)&&pe.params&&(Qe=`Params: ${Ae(pe.params)} + +`),ue.log(`Received request '${pe.method} - (${pe.id})'.`,Qe)}else ot("receive-request",pe)}o(le,"traceReceivedRequest"),S(le,"traceReceivedRequest");function st(pe){if(!(ee===p.Off||!ue||pe.method===v.type.method))if(Te===g.Text){let Qe;(ee===p.Verbose||ee===p.Compact)&&(pe.params?Qe=`Params: ${Ae(pe.params)} + +`:Qe=`No parameters provided. + +`),ue.log(`Received notification '${pe.method}'.`,Qe)}else ot("receive-notification",pe)}o(st,"traceReceivedNotification"),S(st,"traceReceivedNotification");function me(pe,Qe){if(!(ee===p.Off||!ue))if(Te===g.Text){let nt;if((ee===p.Verbose||ee===p.Compact)&&(pe.error&&pe.error.data?nt=`Error data: ${Ae(pe.error.data)} + +`:pe.result?nt=`Result: ${Ae(pe.result)} + +`:pe.error===void 0&&(nt=`No result returned. + +`)),Qe){let dt=pe.error?` Request failed: ${pe.error.message} (${pe.error.code}).`:"";ue.log(`Received response '${Qe.method} - (${pe.id})' in ${Date.now()-Qe.timerStart}ms.${dt}`,nt)}else ue.log(`Received response ${pe.id} without active response promise.`,nt)}else ot("receive-response",pe)}o(me,"traceReceivedResponse"),S(me,"traceReceivedResponse");function ot(pe,Qe){if(!ue||ee===p.Off)return;let nt={isLSPMessage:!0,type:pe,message:Qe,timestamp:Date.now()};ue.log(nt)}o(ot,"logLSPMessage"),S(ot,"logLSPMessage");function kt(){if(Ue())throw new b(x.Closed,"Connection is closed.");if(ye())throw new b(x.Disposed,"Connection is disposed.")}o(kt,"throwIfClosedOrDisposed"),S(kt,"throwIfClosedOrDisposed");function Gt(){if(qe())throw new b(x.AlreadyListening,"Connection is already listening")}o(Gt,"throwIfListening"),S(Gt,"throwIfListening");function Tt(){if(!qe())throw new Error("Call listen() first.")}o(Tt,"throwIfNotListening"),S(Tt,"throwIfNotListening");function Et(pe){return pe===void 0?null:pe}o(Et,"undefinedToNull"),S(Et,"undefinedToNull");function yt(pe){if(pe!==null)return pe}o(yt,"nullToUndefined"),S(yt,"nullToUndefined");function oe(pe){return pe!=null&&!Array.isArray(pe)&&typeof pe=="object"}o(oe,"isNamedParam"),S(oe,"isNamedParam");function ht(pe,Qe){switch(pe){case i.ParameterStructures.auto:return oe(Qe)?yt(Qe):[Et(Qe)];case i.ParameterStructures.byName:if(!oe(Qe))throw new Error("Received parameters by name but param is not an object literal.");return yt(Qe);case i.ParameterStructures.byPosition:return[Et(Qe)];default:throw new Error(`Unknown parameter structure ${pe.toString()}`)}}o(ht,"computeSingleParam"),S(ht,"computeSingleParam");function gt(pe,Qe){let nt,dt=pe.numberOfParams;switch(dt){case 0:nt=void 0;break;case 1:nt=ht(pe.parameterStructures,Qe[0]);break;default:nt=[];for(let Ft=0;Ft{kt();let nt,dt;if(r.string(pe)){nt=pe;let Rt=Qe[0],$t=0,lr=i.ParameterStructures.auto;i.ParameterStructures.is(Rt)&&($t=1,lr=Rt);let pt=Qe.length,Se=pt-$t;switch(Se){case 0:dt=void 0;break;case 1:dt=ht(lr,Qe[$t]);break;default:if(lr===i.ParameterStructures.byName)throw new Error(`Received ${Se} parameters for 'by Name' notification parameter structure.`);dt=Qe.slice($t,pt).map(it=>Et(it));break}}else{let Rt=Qe;nt=pe.method,dt=gt(pe,Rt)}let Ft={jsonrpc:F,method:nt,params:dt};return Pe(Ft),R.write(Ft).catch(Rt=>{throw B.error("Sending notification failed."),Rt})},"sendNotification"),onNotification:S((pe,Qe)=>{kt();let nt;return r.func(pe)?j=pe:Qe&&(r.string(pe)?(nt=pe,U.set(pe,{type:void 0,handler:Qe})):(nt=pe.method,U.set(pe.method,{type:pe,handler:Qe}))),{dispose:S(()=>{nt!==void 0?U.delete(nt):j=void 0},"dispose")}},"onNotification"),onProgress:S((pe,Qe,nt)=>{if(Q.has(Qe))throw new Error(`Progress handler for token ${Qe} already registered`);return Q.set(Qe,nt),{dispose:S(()=>{Q.delete(Qe)},"dispose")}},"onProgress"),sendProgress:S((pe,Qe,nt)=>et.sendNotification(h.type,{token:Qe,value:nt}),"sendProgress"),onUnhandledProgress:Me.event,sendRequest:S((pe,...Qe)=>{kt(),Tt();let nt,dt,Ft;if(r.string(pe)){nt=pe;let pt=Qe[0],Se=Qe[Qe.length-1],it=0,xt=i.ParameterStructures.auto;i.ParameterStructures.is(pt)&&(it=1,xt=pt);let rr=Qe.length;s.CancellationToken.is(Se)&&(rr=rr-1,Ft=Se);let _r=rr-it;switch(_r){case 0:dt=void 0;break;case 1:dt=ht(xt,Qe[it]);break;default:if(xt===i.ParameterStructures.byName)throw new Error(`Received ${_r} parameters for 'by Name' request parameter structure.`);dt=Qe.slice(it,rr).map(Ur=>Et(Ur));break}}else{let pt=Qe;nt=pe.method,dt=gt(pe,pt);let Se=pe.numberOfParams;Ft=s.CancellationToken.is(pt[Se])?pt[Se]:void 0}let Rt=O++,$t;Ft&&($t=Ft.onCancellationRequested(()=>{let pt=de.sender.sendCancellation(et,Rt);return pt===void 0?(B.log(`Received no promise from cancellation strategy when cancelling id ${Rt}`),Promise.resolve()):pt.catch(()=>{B.log(`Sending cancellation messages for id ${Rt} failed`)})}));let lr={jsonrpc:F,id:Rt,method:nt,params:dt};return Ve(lr),typeof de.sender.enableCancellation=="function"&&de.sender.enableCancellation(lr),new Promise(async(pt,Se)=>{let it=S(_r=>{pt(_r),de.sender.cleanup(Rt),$t?.dispose()},"resolveWithCleanup"),xt=S(_r=>{Se(_r),de.sender.cleanup(Rt),$t?.dispose()},"rejectWithCleanup"),rr={method:nt,timerStart:Date.now(),resolve:it,reject:xt};try{await R.write(lr),J.set(Rt,rr)}catch(_r){throw B.error("Sending request failed."),rr.reject(new i.ResponseError(i.ErrorCodes.MessageWriteError,_r.message?_r.message:"Unknown reason")),_r}})},"sendRequest"),onRequest:S((pe,Qe)=>{kt();let nt=null;return f.is(pe)?(nt=void 0,V=pe):r.string(pe)?(nt=null,Qe!==void 0&&(nt=pe,H.set(pe,{handler:Qe,type:void 0}))):Qe!==void 0&&(nt=pe.method,H.set(pe.method,{type:pe,handler:Qe})),{dispose:S(()=>{nt!==null&&(nt!==void 0?H.delete(nt):V=void 0)},"dispose")}},"onRequest"),hasPendingResponse:S(()=>J.size>0,"hasPendingResponse"),trace:S(async(pe,Qe,nt)=>{let dt=!1,Ft=g.Text;nt!==void 0&&(r.boolean(nt)?dt=nt:(dt=nt.sendNotification||!1,Ft=nt.traceFormat||g.Text)),ee=pe,Te=Ft,ee===p.Off?ue=void 0:ue=Qe,dt&&!Ue()&&!ye()&&await et.sendNotification(y.type,{value:p.toString(pe)})},"trace"),onError:Ie.event,onClose:Ee.event,onUnhandledNotification:we.event,onDispose:$e.event,end:S(()=>{R.end()},"end"),dispose:S(()=>{if(ye())return;De=I.Disposed,$e.fire(void 0);let pe=new i.ResponseError(i.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let Qe of J.values())Qe.reject(pe);J=new Map,re=new Map,te=new Set,ae=new n.LinkedMap,r.func(R.dispose)&&R.dispose(),r.func(_.dispose)&&_.dispose()},"dispose"),listen:S(()=>{kt(),Gt(),De=I.Listening,_.listen(Re)},"listen"),inspect:S(()=>{(0,t.default)().console.log("inspect")},"inspect")};return et.onNotification(v.type,pe=>{if(ee===p.Off||!ue)return;let Qe=ee===p.Verbose||ee===p.Compact;ue.log(pe.message,Qe?pe.verbose:void 0)}),et.onNotification(h.type,pe=>{let Qe=Q.get(pe.token);Qe?Qe(pe.value):Me.fire(pe)}),et}o(D,"createMessageConnection"),S(D,"createMessageConnection"),e.createMessageConnection=D}}),fF=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/api.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;var t=nve();Object.defineProperty(e,"Message",{enumerable:!0,get:S(function(){return t.Message},"get")}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:S(function(){return t.RequestType},"get")}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:S(function(){return t.RequestType0},"get")}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:S(function(){return t.RequestType1},"get")}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:S(function(){return t.RequestType2},"get")}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:S(function(){return t.RequestType3},"get")}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:S(function(){return t.RequestType4},"get")}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:S(function(){return t.RequestType5},"get")}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:S(function(){return t.RequestType6},"get")}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:S(function(){return t.RequestType7},"get")}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:S(function(){return t.RequestType8},"get")}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:S(function(){return t.RequestType9},"get")}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:S(function(){return t.ResponseError},"get")}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:S(function(){return t.ErrorCodes},"get")}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:S(function(){return t.NotificationType},"get")}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:S(function(){return t.NotificationType0},"get")}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:S(function(){return t.NotificationType1},"get")}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:S(function(){return t.NotificationType2},"get")}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:S(function(){return t.NotificationType3},"get")}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:S(function(){return t.NotificationType4},"get")}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:S(function(){return t.NotificationType5},"get")}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:S(function(){return t.NotificationType6},"get")}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:S(function(){return t.NotificationType7},"get")}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:S(function(){return t.NotificationType8},"get")}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:S(function(){return t.NotificationType9},"get")}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:S(function(){return t.ParameterStructures},"get")});var r=sve();Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:S(function(){return r.LinkedMap},"get")}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:S(function(){return r.LRUCache},"get")}),Object.defineProperty(e,"Touch",{enumerable:!0,get:S(function(){return r.Touch},"get")});var i=ylt();Object.defineProperty(e,"Disposable",{enumerable:!0,get:S(function(){return i.Disposable},"get")});var n=ny();Object.defineProperty(e,"Event",{enumerable:!0,get:S(function(){return n.Event},"get")}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:S(function(){return n.Emitter},"get")});var a=U5();Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:S(function(){return a.CancellationTokenSource},"get")}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:S(function(){return a.CancellationToken},"get")});var s=vlt();Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:S(function(){return s.SharedArraySenderStrategy},"get")}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:S(function(){return s.SharedArrayReceiverStrategy},"get")});var l=xlt();Object.defineProperty(e,"MessageReader",{enumerable:!0,get:S(function(){return l.MessageReader},"get")}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:S(function(){return l.AbstractMessageReader},"get")}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:S(function(){return l.ReadableStreamMessageReader},"get")});var u=blt();Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:S(function(){return u.MessageWriter},"get")}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:S(function(){return u.AbstractMessageWriter},"get")}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:S(function(){return u.WriteableStreamMessageWriter},"get")});var h=Tlt();Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:S(function(){return h.AbstractMessageBuffer},"get")});var d=Clt();Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:S(function(){return d.ConnectionStrategy},"get")}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:S(function(){return d.ConnectionOptions},"get")}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:S(function(){return d.NullLogger},"get")}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:S(function(){return d.createMessageConnection},"get")}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:S(function(){return d.ProgressToken},"get")}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:S(function(){return d.ProgressType},"get")}),Object.defineProperty(e,"Trace",{enumerable:!0,get:S(function(){return d.Trace},"get")}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:S(function(){return d.TraceValues},"get")}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:S(function(){return d.TraceFormat},"get")}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:S(function(){return d.SetTraceNotification},"get")}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:S(function(){return d.LogTraceNotification},"get")}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:S(function(){return d.ConnectionErrors},"get")}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:S(function(){return d.ConnectionError},"get")}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:S(function(){return d.CancellationReceiverStrategy},"get")}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:S(function(){return d.CancellationSenderStrategy},"get")}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:S(function(){return d.CancellationStrategy},"get")}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:S(function(){return d.MessageStrategy},"get")});var f=W0();e.RAL=f.default}}),klt=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/ril.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=fF(),r=class cve extends t.AbstractMessageBuffer{static{o(this,"_MessageBuffer")}static{S(this,"MessageBuffer")}constructor(h="utf-8"){super(h),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return cve.emptyBuffer}fromString(h,d){return new TextEncoder().encode(h)}toString(h,d){return d==="ascii"?this.asciiDecoder.decode(h):new TextDecoder(d).decode(h)}asNative(h,d){return d===void 0?h:h.slice(0,d)}allocNative(h){return new Uint8Array(h)}};r.emptyBuffer=new Uint8Array(0);var i=class{static{o(this,"ReadableStreamWrapper")}static{S(this,"ReadableStreamWrapper")}constructor(u){this.socket=u,this._onData=new t.Emitter,this._messageListener=h=>{h.data.arrayBuffer().then(f=>{this._onData.fire(new Uint8Array(f))},()=>{(0,t.RAL)().console.error("Converting blob to array buffer failed.")})},this.socket.addEventListener("message",this._messageListener)}onClose(u){return this.socket.addEventListener("close",u),t.Disposable.create(()=>this.socket.removeEventListener("close",u))}onError(u){return this.socket.addEventListener("error",u),t.Disposable.create(()=>this.socket.removeEventListener("error",u))}onEnd(u){return this.socket.addEventListener("end",u),t.Disposable.create(()=>this.socket.removeEventListener("end",u))}onData(u){return this._onData.event(u)}},n=class{static{o(this,"WritableStreamWrapper")}static{S(this,"WritableStreamWrapper")}constructor(u){this.socket=u}onClose(u){return this.socket.addEventListener("close",u),t.Disposable.create(()=>this.socket.removeEventListener("close",u))}onError(u){return this.socket.addEventListener("error",u),t.Disposable.create(()=>this.socket.removeEventListener("error",u))}onEnd(u){return this.socket.addEventListener("end",u),t.Disposable.create(()=>this.socket.removeEventListener("end",u))}write(u,h){if(typeof u=="string"){if(h!==void 0&&h!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${h}`);this.socket.send(u)}else this.socket.send(u);return Promise.resolve()}end(){this.socket.close()}},a=new TextEncoder,s=Object.freeze({messageBuffer:Object.freeze({create:S(u=>new r(u),"create")}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:S((u,h)=>{if(h.charset!=="utf-8")throw new Error(`In a Browser environments only utf-8 text encoding is supported. But got encoding: ${h.charset}`);return Promise.resolve(a.encode(JSON.stringify(u,void 0,0)))},"encode")}),decoder:Object.freeze({name:"application/json",decode:S((u,h)=>{if(!(u instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(h.charset).decode(u)))},"decode")})}),stream:Object.freeze({asReadableStream:S(u=>new i(u),"asReadableStream"),asWritableStream:S(u=>new n(u),"asWritableStream")}),console,timer:Object.freeze({setTimeout(u,h,...d){let f=setTimeout(u,h,...d);return{dispose:S(()=>clearTimeout(f),"dispose")}},setImmediate(u,...h){let d=setTimeout(u,0,...h);return{dispose:S(()=>clearTimeout(d),"dispose")}},setInterval(u,h,...d){let f=setInterval(u,h,...d);return{dispose:S(()=>clearInterval(f),"dispose")}}})});function l(){return s}o(l,"RIL"),S(l,"RIL"),(function(u){function h(){t.RAL.install(s)}o(h,"install"),S(h,"install"),u.install=h})(l||(l={})),e.default=l}}),ay=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/browser/main.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(u,h,d,f){f===void 0&&(f=d);var p=Object.getOwnPropertyDescriptor(h,d);(!p||("get"in p?!h.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:S(function(){return h[d]},"get")}),Object.defineProperty(u,f,p)}):(function(u,h,d,f){f===void 0&&(f=d),u[f]=h[d]})),r=e&&e.__exportStar||function(u,h){for(var d in u)d!=="default"&&!Object.prototype.hasOwnProperty.call(h,d)&&t(h,u,d)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.BrowserMessageWriter=e.BrowserMessageReader=void 0;var i=klt();i.default.install();var n=fF();r(fF(),e);var a=class extends n.AbstractMessageReader{static{o(this,"BrowserMessageReader")}static{S(this,"BrowserMessageReader")}constructor(u){super(),this._onData=new n.Emitter,this._messageListener=h=>{this._onData.fire(h.data)},u.addEventListener("error",h=>this.fireError(h)),u.onmessage=this._messageListener}listen(u){return this._onData.event(u)}};e.BrowserMessageReader=a;var s=class extends n.AbstractMessageWriter{static{o(this,"BrowserMessageWriter")}static{S(this,"BrowserMessageWriter")}constructor(u){super(),this.port=u,this.errorCount=0,u.addEventListener("error",h=>this.fireError(h))}write(u){try{return this.port.postMessage(u),Promise.resolve()}catch(h){return this.handleError(h,u),Promise.reject(h)}}handleError(u,h){this.errorCount++,this.fireError(u,h,this.errorCount)}end(){}};e.BrowserMessageWriter=s;function l(u,h,d,f){return d===void 0&&(d=n.NullLogger),n.ConnectionStrategy.is(f)&&(f={connectionStrategy:f}),(0,n.createMessageConnection)(u,h,d,f)}o(l,"createMessageConnection"),S(l,"createMessageConnection"),e.createMessageConnection=l}}),g1e=Lr({"../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/browser.js"(e,t){"use strict";t.exports=ay()}}),tn=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/messages.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ProtocolNotificationType=e.ProtocolNotificationType0=e.ProtocolRequestType=e.ProtocolRequestType0=e.RegistrationType=e.MessageDirection=void 0;var t=ay(),r;(function(u){u.clientToServer="clientToServer",u.serverToClient="serverToClient",u.both="both"})(r||(e.MessageDirection=r={}));var i=class{static{o(this,"RegistrationType")}static{S(this,"RegistrationType")}constructor(u){this.method=u}};e.RegistrationType=i;var n=class extends t.RequestType0{static{o(this,"ProtocolRequestType0")}static{S(this,"ProtocolRequestType0")}constructor(u){super(u)}};e.ProtocolRequestType0=n;var a=class extends t.RequestType{static{o(this,"ProtocolRequestType")}static{S(this,"ProtocolRequestType")}constructor(u){super(u,t.ParameterStructures.byName)}};e.ProtocolRequestType=a;var s=class extends t.NotificationType0{static{o(this,"ProtocolNotificationType0")}static{S(this,"ProtocolNotificationType0")}constructor(u){super(u)}};e.ProtocolNotificationType0=s;var l=class extends t.NotificationType{static{o(this,"ProtocolNotificationType")}static{S(this,"ProtocolNotificationType")}constructor(u){super(u,t.ParameterStructures.byName)}};e.ProtocolNotificationType=l}}),h$=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.objectLiteral=e.typedArray=e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(d){return d===!0||d===!1}o(t,"boolean"),S(t,"boolean"),e.boolean=t;function r(d){return typeof d=="string"||d instanceof String}o(r,"string"),S(r,"string"),e.string=r;function i(d){return typeof d=="number"||d instanceof Number}o(i,"number"),S(i,"number"),e.number=i;function n(d){return d instanceof Error}o(n,"error"),S(n,"error"),e.error=n;function a(d){return typeof d=="function"}o(a,"func"),S(a,"func"),e.func=a;function s(d){return Array.isArray(d)}o(s,"array"),S(s,"array"),e.array=s;function l(d){return s(d)&&d.every(f=>r(f))}o(l,"stringArray"),S(l,"stringArray"),e.stringArray=l;function u(d,f){return Array.isArray(d)&&d.every(f)}o(u,"typedArray"),S(u,"typedArray"),e.typedArray=u;function h(d){return d!==null&&typeof d=="object"}o(h,"objectLiteral"),S(h,"objectLiteral"),e.objectLiteral=h}}),wlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationRequest=void 0;var t=tn(),r;(function(i){i.method="textDocument/implementation",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.ImplementationRequest=r={}))}}),Slt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeDefinitionRequest=void 0;var t=tn(),r;(function(i){i.method="textDocument/typeDefinition",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.TypeDefinitionRequest=r={}))}}),Elt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=void 0;var t=tn(),r;(function(n){n.method="workspace/workspaceFolders",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType0(n.method)})(r||(e.WorkspaceFoldersRequest=r={}));var i;(function(n){n.method="workspace/didChangeWorkspaceFolders",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolNotificationType(n.method)})(i||(e.DidChangeWorkspaceFoldersNotification=i={}))}}),Alt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ConfigurationRequest=void 0;var t=tn(),r;(function(i){i.method="workspace/configuration",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType(i.method)})(r||(e.ConfigurationRequest=r={}))}}),_lt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ColorPresentationRequest=e.DocumentColorRequest=void 0;var t=tn(),r;(function(n){n.method="textDocument/documentColor",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.DocumentColorRequest=r={}));var i;(function(n){n.method="textDocument/colorPresentation",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(i||(e.ColorPresentationRequest=i={}))}}),Dlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=void 0;var t=tn(),r;(function(n){n.method="textDocument/foldingRange",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.FoldingRangeRequest=r={}));var i;(function(n){n.method="workspace/foldingRange/refresh",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType0(n.method)})(i||(e.FoldingRangeRefreshRequest=i={}))}}),Rlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DeclarationRequest=void 0;var t=tn(),r;(function(i){i.method="textDocument/declaration",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.DeclarationRequest=r={}))}}),Llt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionRangeRequest=void 0;var t=tn(),r;(function(i){i.method="textDocument/selectionRange",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.SelectionRangeRequest=r={}))}}),Mlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=void 0;var t=ay(),r=tn(),i;(function(s){s.type=new t.ProgressType;function l(u){return u===s.type}o(l,"is"),S(l,"is"),s.is=l})(i||(e.WorkDoneProgress=i={}));var n;(function(s){s.method="window/workDoneProgress/create",s.messageDirection=r.MessageDirection.serverToClient,s.type=new r.ProtocolRequestType(s.method)})(n||(e.WorkDoneProgressCreateRequest=n={}));var a;(function(s){s.method="window/workDoneProgress/cancel",s.messageDirection=r.MessageDirection.clientToServer,s.type=new r.ProtocolNotificationType(s.method)})(a||(e.WorkDoneProgressCancelNotification=a={}))}}),Nlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.CallHierarchyPrepareRequest=void 0;var t=tn(),r;(function(a){a.method="textDocument/prepareCallHierarchy",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(r||(e.CallHierarchyPrepareRequest=r={}));var i;(function(a){a.method="callHierarchy/incomingCalls",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(i||(e.CallHierarchyIncomingCallsRequest=i={}));var n;(function(a){a.method="callHierarchy/outgoingCalls",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(n||(e.CallHierarchyOutgoingCallsRequest=n={}))}}),Ilt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.SemanticTokensRegistrationType=e.TokenFormat=void 0;var t=tn(),r;(function(u){u.Relative="relative"})(r||(e.TokenFormat=r={}));var i;(function(u){u.method="textDocument/semanticTokens",u.type=new t.RegistrationType(u.method)})(i||(e.SemanticTokensRegistrationType=i={}));var n;(function(u){u.method="textDocument/semanticTokens/full",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method),u.registrationMethod=i.method})(n||(e.SemanticTokensRequest=n={}));var a;(function(u){u.method="textDocument/semanticTokens/full/delta",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method),u.registrationMethod=i.method})(a||(e.SemanticTokensDeltaRequest=a={}));var s;(function(u){u.method="textDocument/semanticTokens/range",u.messageDirection=t.MessageDirection.clientToServer,u.type=new t.ProtocolRequestType(u.method),u.registrationMethod=i.method})(s||(e.SemanticTokensRangeRequest=s={}));var l;(function(u){u.method="workspace/semanticTokens/refresh",u.messageDirection=t.MessageDirection.serverToClient,u.type=new t.ProtocolRequestType0(u.method)})(l||(e.SemanticTokensRefreshRequest=l={}))}}),Olt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ShowDocumentRequest=void 0;var t=tn(),r;(function(i){i.method="window/showDocument",i.messageDirection=t.MessageDirection.serverToClient,i.type=new t.ProtocolRequestType(i.method)})(r||(e.ShowDocumentRequest=r={}))}}),Plt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedEditingRangeRequest=void 0;var t=tn(),r;(function(i){i.method="textDocument/linkedEditingRange",i.messageDirection=t.MessageDirection.clientToServer,i.type=new t.ProtocolRequestType(i.method)})(r||(e.LinkedEditingRangeRequest=r={}))}}),Blt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.DidRenameFilesNotification=e.WillRenameFilesRequest=e.DidCreateFilesNotification=e.WillCreateFilesRequest=e.FileOperationPatternKind=void 0;var t=tn(),r;(function(h){h.file="file",h.folder="folder"})(r||(e.FileOperationPatternKind=r={}));var i;(function(h){h.method="workspace/willCreateFiles",h.messageDirection=t.MessageDirection.clientToServer,h.type=new t.ProtocolRequestType(h.method)})(i||(e.WillCreateFilesRequest=i={}));var n;(function(h){h.method="workspace/didCreateFiles",h.messageDirection=t.MessageDirection.clientToServer,h.type=new t.ProtocolNotificationType(h.method)})(n||(e.DidCreateFilesNotification=n={}));var a;(function(h){h.method="workspace/willRenameFiles",h.messageDirection=t.MessageDirection.clientToServer,h.type=new t.ProtocolRequestType(h.method)})(a||(e.WillRenameFilesRequest=a={}));var s;(function(h){h.method="workspace/didRenameFiles",h.messageDirection=t.MessageDirection.clientToServer,h.type=new t.ProtocolNotificationType(h.method)})(s||(e.DidRenameFilesNotification=s={}));var l;(function(h){h.method="workspace/didDeleteFiles",h.messageDirection=t.MessageDirection.clientToServer,h.type=new t.ProtocolNotificationType(h.method)})(l||(e.DidDeleteFilesNotification=l={}));var u;(function(h){h.method="workspace/willDeleteFiles",h.messageDirection=t.MessageDirection.clientToServer,h.type=new t.ProtocolRequestType(h.method)})(u||(e.WillDeleteFilesRequest=u={}))}}),Flt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=void 0;var t=tn(),r;(function(a){a.document="document",a.project="project",a.group="group",a.scheme="scheme",a.global="global"})(r||(e.UniquenessLevel=r={}));var i;(function(a){a.$import="import",a.$export="export",a.local="local"})(i||(e.MonikerKind=i={}));var n;(function(a){a.method="textDocument/moniker",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(n||(e.MonikerRequest=n={}))}}),$lt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeHierarchySubtypesRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchyPrepareRequest=void 0;var t=tn(),r;(function(a){a.method="textDocument/prepareTypeHierarchy",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(r||(e.TypeHierarchyPrepareRequest=r={}));var i;(function(a){a.method="typeHierarchy/supertypes",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(i||(e.TypeHierarchySupertypesRequest=i={}));var n;(function(a){a.method="typeHierarchy/subtypes",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(n||(e.TypeHierarchySubtypesRequest=n={}))}}),zlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlineValueRefreshRequest=e.InlineValueRequest=void 0;var t=tn(),r;(function(n){n.method="textDocument/inlineValue",n.messageDirection=t.MessageDirection.clientToServer,n.type=new t.ProtocolRequestType(n.method)})(r||(e.InlineValueRequest=r={}));var i;(function(n){n.method="workspace/inlineValue/refresh",n.messageDirection=t.MessageDirection.serverToClient,n.type=new t.ProtocolRequestType0(n.method)})(i||(e.InlineValueRefreshRequest=i={}))}}),Glt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=void 0;var t=tn(),r;(function(a){a.method="textDocument/inlayHint",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(r||(e.InlayHintRequest=r={}));var i;(function(a){a.method="inlayHint/resolve",a.messageDirection=t.MessageDirection.clientToServer,a.type=new t.ProtocolRequestType(a.method)})(i||(e.InlayHintResolveRequest=i={}));var n;(function(a){a.method="workspace/inlayHint/refresh",a.messageDirection=t.MessageDirection.serverToClient,a.type=new t.ProtocolRequestType0(a.method)})(n||(e.InlayHintRefreshRequest=n={}))}}),Vlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=void 0;var t=ay(),r=h$(),i=tn(),n;(function(h){function d(f){let p=f;return p&&r.boolean(p.retriggerRequest)}o(d,"is"),S(d,"is"),h.is=d})(n||(e.DiagnosticServerCancellationData=n={}));var a;(function(h){h.Full="full",h.Unchanged="unchanged"})(a||(e.DocumentDiagnosticReportKind=a={}));var s;(function(h){h.method="textDocument/diagnostic",h.messageDirection=i.MessageDirection.clientToServer,h.type=new i.ProtocolRequestType(h.method),h.partialResult=new t.ProgressType})(s||(e.DocumentDiagnosticRequest=s={}));var l;(function(h){h.method="workspace/diagnostic",h.messageDirection=i.MessageDirection.clientToServer,h.type=new i.ProtocolRequestType(h.method),h.partialResult=new t.ProgressType})(l||(e.WorkspaceDiagnosticRequest=l={}));var u;(function(h){h.method="workspace/diagnostic/refresh",h.messageDirection=i.MessageDirection.serverToClient,h.type=new i.ProtocolRequestType0(h.method)})(u||(e.DiagnosticRefreshRequest=u={}))}}),Wlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=void 0;var t=(bT(),u$(q5)),r=h$(),i=tn(),n;(function(g){g.Markup=1,g.Code=2;function y(v){return v===1||v===2}o(y,"is"),S(y,"is"),g.is=y})(n||(e.NotebookCellKind=n={}));var a;(function(g){function y(b,T){let w={executionOrder:b};return(T===!0||T===!1)&&(w.success=T),w}o(y,"create"),S(y,"create"),g.create=y;function v(b){let T=b;return r.objectLiteral(T)&&t.uinteger.is(T.executionOrder)&&(T.success===void 0||r.boolean(T.success))}o(v,"is"),S(v,"is"),g.is=v;function x(b,T){return b===T?!0:b==null||T===null||T===void 0?!1:b.executionOrder===T.executionOrder&&b.success===T.success}o(x,"equals"),S(x,"equals"),g.equals=x})(a||(e.ExecutionSummary=a={}));var s;(function(g){function y(T,w){return{kind:T,document:w}}o(y,"create"),S(y,"create"),g.create=y;function v(T){let w=T;return r.objectLiteral(w)&&n.is(w.kind)&&t.DocumentUri.is(w.document)&&(w.metadata===void 0||r.objectLiteral(w.metadata))}o(v,"is"),S(v,"is"),g.is=v;function x(T,w){let C=new Set;return T.document!==w.document&&C.add("document"),T.kind!==w.kind&&C.add("kind"),T.executionSummary!==w.executionSummary&&C.add("executionSummary"),(T.metadata!==void 0||w.metadata!==void 0)&&!b(T.metadata,w.metadata)&&C.add("metadata"),(T.executionSummary!==void 0||w.executionSummary!==void 0)&&!a.equals(T.executionSummary,w.executionSummary)&&C.add("executionSummary"),C}o(x,"diff"),S(x,"diff"),g.diff=x;function b(T,w){if(T===w)return!0;if(T==null||w===null||w===void 0||typeof T!=typeof w||typeof T!="object")return!1;let C=Array.isArray(T),k=Array.isArray(w);if(C!==k)return!1;if(C&&k){if(T.length!==w.length)return!1;for(let E=0;E0}o(ht,"hasId"),S(ht,"hasId"),oe.hasId=ht})(O||(e.StaticRegistrationOptions=O={}));var $;(function(oe){function ht(gt){let et=gt;return et&&(et.documentSelector===null||D.is(et.documentSelector))}o(ht,"is"),S(ht,"is"),oe.is=ht})($||(e.TextDocumentRegistrationOptions=$={}));var G;(function(oe){function ht(et){let pe=et;return i.objectLiteral(pe)&&(pe.workDoneProgress===void 0||i.boolean(pe.workDoneProgress))}o(ht,"is"),S(ht,"is"),oe.is=ht;function gt(et){let pe=et;return pe&&i.boolean(pe.workDoneProgress)}o(gt,"hasWorkDoneProgress"),S(gt,"hasWorkDoneProgress"),oe.hasWorkDoneProgress=gt})(G||(e.WorkDoneProgressOptions=G={}));var F;(function(oe){oe.method="initialize",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(F||(e.InitializeRequest=F={}));var V;(function(oe){oe.unknownProtocolVersion=1})(V||(e.InitializeErrorCodes=V={}));var H;(function(oe){oe.method="initialized",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolNotificationType(oe.method)})(H||(e.InitializedNotification=H={}));var j;(function(oe){oe.method="shutdown",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType0(oe.method)})(j||(e.ShutdownRequest=j={}));var U;(function(oe){oe.method="exit",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolNotificationType0(oe.method)})(U||(e.ExitNotification=U={}));var Q;(function(oe){oe.method="workspace/didChangeConfiguration",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolNotificationType(oe.method)})(Q||(e.DidChangeConfigurationNotification=Q={}));var Y;(function(oe){oe.Error=1,oe.Warning=2,oe.Info=3,oe.Log=4,oe.Debug=5})(Y||(e.MessageType=Y={}));var ae;(function(oe){oe.method="window/showMessage",oe.messageDirection=t.MessageDirection.serverToClient,oe.type=new t.ProtocolNotificationType(oe.method)})(ae||(e.ShowMessageNotification=ae={}));var J;(function(oe){oe.method="window/showMessageRequest",oe.messageDirection=t.MessageDirection.serverToClient,oe.type=new t.ProtocolRequestType(oe.method)})(J||(e.ShowMessageRequest=J={}));var te;(function(oe){oe.method="window/logMessage",oe.messageDirection=t.MessageDirection.serverToClient,oe.type=new t.ProtocolNotificationType(oe.method)})(te||(e.LogMessageNotification=te={}));var re;(function(oe){oe.method="telemetry/event",oe.messageDirection=t.MessageDirection.serverToClient,oe.type=new t.ProtocolNotificationType(oe.method)})(re||(e.TelemetryEventNotification=re={}));var ee;(function(oe){oe.None=0,oe.Full=1,oe.Incremental=2})(ee||(e.TextDocumentSyncKind=ee={}));var Te;(function(oe){oe.method="textDocument/didOpen",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolNotificationType(oe.method)})(Te||(e.DidOpenTextDocumentNotification=Te={}));var ue;(function(oe){function ht(et){let pe=et;return pe!=null&&typeof pe.text=="string"&&pe.range!==void 0&&(pe.rangeLength===void 0||typeof pe.rangeLength=="number")}o(ht,"isIncremental"),S(ht,"isIncremental"),oe.isIncremental=ht;function gt(et){let pe=et;return pe!=null&&typeof pe.text=="string"&&pe.range===void 0&&pe.rangeLength===void 0}o(gt,"isFull"),S(gt,"isFull"),oe.isFull=gt})(ue||(e.TextDocumentContentChangeEvent=ue={}));var De;(function(oe){oe.method="textDocument/didChange",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolNotificationType(oe.method)})(De||(e.DidChangeTextDocumentNotification=De={}));var Ie;(function(oe){oe.method="textDocument/didClose",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolNotificationType(oe.method)})(Ie||(e.DidCloseTextDocumentNotification=Ie={}));var Ee;(function(oe){oe.method="textDocument/didSave",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolNotificationType(oe.method)})(Ee||(e.DidSaveTextDocumentNotification=Ee={}));var we;(function(oe){oe.Manual=1,oe.AfterDelay=2,oe.FocusOut=3})(we||(e.TextDocumentSaveReason=we={}));var Me;(function(oe){oe.method="textDocument/willSave",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolNotificationType(oe.method)})(Me||(e.WillSaveTextDocumentNotification=Me={}));var $e;(function(oe){oe.method="textDocument/willSaveWaitUntil",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})($e||(e.WillSaveTextDocumentWaitUntilRequest=$e={}));var de;(function(oe){oe.method="workspace/didChangeWatchedFiles",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolNotificationType(oe.method)})(de||(e.DidChangeWatchedFilesNotification=de={}));var rt;(function(oe){oe.Created=1,oe.Changed=2,oe.Deleted=3})(rt||(e.FileChangeType=rt={}));var ke;(function(oe){function ht(gt){let et=gt;return i.objectLiteral(et)&&(r.URI.is(et.baseUri)||r.WorkspaceFolder.is(et.baseUri))&&i.string(et.pattern)}o(ht,"is"),S(ht,"is"),oe.is=ht})(ke||(e.RelativePattern=ke={}));var Fe;(function(oe){oe.Create=1,oe.Change=2,oe.Delete=4})(Fe||(e.WatchKind=Fe={}));var He;(function(oe){oe.method="textDocument/publishDiagnostics",oe.messageDirection=t.MessageDirection.serverToClient,oe.type=new t.ProtocolNotificationType(oe.method)})(He||(e.PublishDiagnosticsNotification=He={}));var at;(function(oe){oe.Invoked=1,oe.TriggerCharacter=2,oe.TriggerForIncompleteCompletions=3})(at||(e.CompletionTriggerKind=at={}));var qe;(function(oe){oe.method="textDocument/completion",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(qe||(e.CompletionRequest=qe={}));var Ue;(function(oe){oe.method="completionItem/resolve",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Ue||(e.CompletionResolveRequest=Ue={}));var ye;(function(oe){oe.method="textDocument/hover",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(ye||(e.HoverRequest=ye={}));var ve;(function(oe){oe.Invoked=1,oe.TriggerCharacter=2,oe.ContentChange=3})(ve||(e.SignatureHelpTriggerKind=ve={}));var ie;(function(oe){oe.method="textDocument/signatureHelp",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(ie||(e.SignatureHelpRequest=ie={}));var fe;(function(oe){oe.method="textDocument/definition",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(fe||(e.DefinitionRequest=fe={}));var W;(function(oe){oe.method="textDocument/references",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(W||(e.ReferencesRequest=W={}));var ce;(function(oe){oe.method="textDocument/documentHighlight",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(ce||(e.DocumentHighlightRequest=ce={}));var K;(function(oe){oe.method="textDocument/documentSymbol",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(K||(e.DocumentSymbolRequest=K={}));var Re;(function(oe){oe.method="textDocument/codeAction",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Re||(e.CodeActionRequest=Re={}));var xe;(function(oe){oe.method="codeAction/resolve",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(xe||(e.CodeActionResolveRequest=xe={}));var Oe;(function(oe){oe.method="workspace/symbol",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Oe||(e.WorkspaceSymbolRequest=Oe={}));var be;(function(oe){oe.method="workspaceSymbol/resolve",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(be||(e.WorkspaceSymbolResolveRequest=be={}));var Be;(function(oe){oe.method="textDocument/codeLens",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Be||(e.CodeLensRequest=Be={}));var Ae;(function(oe){oe.method="codeLens/resolve",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Ae||(e.CodeLensResolveRequest=Ae={}));var Ve;(function(oe){oe.method="workspace/codeLens/refresh",oe.messageDirection=t.MessageDirection.serverToClient,oe.type=new t.ProtocolRequestType0(oe.method)})(Ve||(e.CodeLensRefreshRequest=Ve={}));var Pe;(function(oe){oe.method="textDocument/documentLink",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Pe||(e.DocumentLinkRequest=Pe={}));var Ye;(function(oe){oe.method="documentLink/resolve",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Ye||(e.DocumentLinkResolveRequest=Ye={}));var le;(function(oe){oe.method="textDocument/formatting",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(le||(e.DocumentFormattingRequest=le={}));var st;(function(oe){oe.method="textDocument/rangeFormatting",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(st||(e.DocumentRangeFormattingRequest=st={}));var me;(function(oe){oe.method="textDocument/rangesFormatting",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(me||(e.DocumentRangesFormattingRequest=me={}));var ot;(function(oe){oe.method="textDocument/onTypeFormatting",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(ot||(e.DocumentOnTypeFormattingRequest=ot={}));var kt;(function(oe){oe.Identifier=1})(kt||(e.PrepareSupportDefaultBehavior=kt={}));var Gt;(function(oe){oe.method="textDocument/rename",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Gt||(e.RenameRequest=Gt={}));var Tt;(function(oe){oe.method="textDocument/prepareRename",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Tt||(e.PrepareRenameRequest=Tt={}));var Et;(function(oe){oe.method="workspace/executeCommand",oe.messageDirection=t.MessageDirection.clientToServer,oe.type=new t.ProtocolRequestType(oe.method)})(Et||(e.ExecuteCommandRequest=Et={}));var yt;(function(oe){oe.method="workspace/applyEdit",oe.messageDirection=t.MessageDirection.serverToClient,oe.type=new t.ProtocolRequestType("workspace/applyEdit")})(yt||(e.ApplyWorkspaceEditRequest=yt={}))}}),Hlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/connection.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;var t=ay();function r(i,n,a,s){return t.ConnectionStrategy.is(s)&&(s={connectionStrategy:s}),(0,t.createMessageConnection)(i,n,a,s)}o(r,"createProtocolConnection"),S(r,"createProtocolConnection"),e.createProtocolConnection=r}}),Ylt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/common/api.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(a,s,l,u){u===void 0&&(u=l);var h=Object.getOwnPropertyDescriptor(s,l);(!h||("get"in h?!s.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:S(function(){return s[l]},"get")}),Object.defineProperty(a,u,h)}):(function(a,s,l,u){u===void 0&&(u=l),a[u]=s[l]})),r=e&&e.__exportStar||function(a,s){for(var l in a)l!=="default"&&!Object.prototype.hasOwnProperty.call(s,l)&&t(s,a,l)};Object.defineProperty(e,"__esModule",{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,r(ay(),e),r((bT(),u$(q5)),e),r(tn(),e),r(Ult(),e);var i=Hlt();Object.defineProperty(e,"createProtocolConnection",{enumerable:!0,get:S(function(){return i.createProtocolConnection},"get")});var n;(function(a){a.lspReservedErrorRangeStart=-32899,a.RequestFailed=-32803,a.ServerCancelled=-32802,a.ContentModified=-32801,a.RequestCancelled=-32800,a.lspReservedErrorRangeEnd=-32800})(n||(e.LSPErrorCodes=n={}))}}),jlt=Lr({"../../node_modules/.pnpm/vscode-languageserver-protocol@3.17.5/node_modules/vscode-languageserver-protocol/lib/browser/main.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?(function(a,s,l,u){u===void 0&&(u=l);var h=Object.getOwnPropertyDescriptor(s,l);(!h||("get"in h?!s.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:S(function(){return s[l]},"get")}),Object.defineProperty(a,u,h)}):(function(a,s,l,u){u===void 0&&(u=l),a[u]=s[l]})),r=e&&e.__exportStar||function(a,s){for(var l in a)l!=="default"&&!Object.prototype.hasOwnProperty.call(s,l)&&t(s,a,l)};Object.defineProperty(e,"__esModule",{value:!0}),e.createProtocolConnection=void 0;var i=g1e();r(g1e(),e),r(Ylt(),e);function n(a,s,l,u){return(0,i.createMessageConnection)(a,s,l,u)}o(n,"createProtocolConnection"),S(n,"createProtocolConnection"),e.createProtocolConnection=n}}),uve={};xf(uve,{AbstractAstReflection:o(()=>p$,"AbstractAstReflection"),AbstractCstNode:o(()=>gG,"AbstractCstNode"),AbstractLangiumParser:o(()=>vG,"AbstractLangiumParser"),AbstractParserErrorMessageProvider:o(()=>JSe,"AbstractParserErrorMessageProvider"),AbstractThreadedAsyncParser:o(()=>kvt,"AbstractThreadedAsyncParser"),AstUtils:o(()=>m$,"AstUtils"),BiMap:o(()=>$5,"BiMap"),Cancellation:o(()=>Ii,"Cancellation"),CompositeCstNodeImpl:o(()=>GA,"CompositeCstNodeImpl"),ContextCache:o(()=>jA,"ContextCache"),CstNodeBuilder:o(()=>XSe,"CstNodeBuilder"),CstUtils:o(()=>d$,"CstUtils"),DEFAULT_TOKENIZE_OPTIONS:o(()=>PG,"DEFAULT_TOKENIZE_OPTIONS"),DONE_RESULT:o(()=>as,"DONE_RESULT"),DatatypeSymbol:o(()=>O5,"DatatypeSymbol"),DefaultAstNodeDescriptionProvider:o(()=>D3e,"DefaultAstNodeDescriptionProvider"),DefaultAstNodeLocator:o(()=>L3e,"DefaultAstNodeLocator"),DefaultAsyncParser:o(()=>X3e,"DefaultAsyncParser"),DefaultCommentProvider:o(()=>j3e,"DefaultCommentProvider"),DefaultConfigurationProvider:o(()=>M3e,"DefaultConfigurationProvider"),DefaultDocumentBuilder:o(()=>N3e,"DefaultDocumentBuilder"),DefaultDocumentValidator:o(()=>_3e,"DefaultDocumentValidator"),DefaultHydrator:o(()=>Z3e,"DefaultHydrator"),DefaultIndexManager:o(()=>I3e,"DefaultIndexManager"),DefaultJsonSerializer:o(()=>w3e,"DefaultJsonSerializer"),DefaultLangiumDocumentFactory:o(()=>m3e,"DefaultLangiumDocumentFactory"),DefaultLangiumDocuments:o(()=>g3e,"DefaultLangiumDocuments"),DefaultLangiumProfiler:o(()=>_vt,"DefaultLangiumProfiler"),DefaultLexer:o(()=>BG,"DefaultLexer"),DefaultLexerErrorMessageProvider:o(()=>P3e,"DefaultLexerErrorMessageProvider"),DefaultLinker:o(()=>y3e,"DefaultLinker"),DefaultNameProvider:o(()=>v3e,"DefaultNameProvider"),DefaultReferenceDescriptionProvider:o(()=>R3e,"DefaultReferenceDescriptionProvider"),DefaultReferences:o(()=>x3e,"DefaultReferences"),DefaultScopeComputation:o(()=>b3e,"DefaultScopeComputation"),DefaultScopeProvider:o(()=>k3e,"DefaultScopeProvider"),DefaultServiceRegistry:o(()=>S3e,"DefaultServiceRegistry"),DefaultTokenBuilder:o(()=>qA,"DefaultTokenBuilder"),DefaultValueConverter:o(()=>SG,"DefaultValueConverter"),DefaultWorkspaceLock:o(()=>K3e,"DefaultWorkspaceLock"),DefaultWorkspaceManager:o(()=>O3e,"DefaultWorkspaceManager"),Deferred:o(()=>mh,"Deferred"),Disposable:o(()=>F0,"Disposable"),DisposableCache:o(()=>YA,"DisposableCache"),DocumentCache:o(()=>C3e,"DocumentCache"),DocumentState:o(()=>zr,"DocumentState"),DocumentValidator:o(()=>Qo,"DocumentValidator"),EMPTY_SCOPE:o(()=>xvt,"EMPTY_SCOPE"),EMPTY_STREAM:o(()=>H1,"EMPTY_STREAM"),EmptyFileSystem:o(()=>fn,"EmptyFileSystem"),EmptyFileSystemProvider:o(()=>eEe,"EmptyFileSystemProvider"),ErrorWithLocation:o(()=>eA,"ErrorWithLocation"),GrammarAST:o(()=>fve,"GrammarAST"),GrammarUtils:o(()=>U$,"GrammarUtils"),IndentationAwareLexer:o(()=>Svt,"IndentationAwareLexer"),IndentationAwareTokenBuilder:o(()=>J3e,"IndentationAwareTokenBuilder"),JSDocDocumentationProvider:o(()=>Y3e,"JSDocDocumentationProvider"),LangiumCompletionParser:o(()=>e3e,"LangiumCompletionParser"),LangiumParser:o(()=>QSe,"LangiumParser"),LangiumParserErrorMessageProvider:o(()=>xG,"LangiumParserErrorMessageProvider"),LeafCstNodeImpl:o(()=>I5,"LeafCstNodeImpl"),LexingMode:o(()=>P0,"LexingMode"),MapScope:o(()=>vvt,"MapScope"),Module:o(()=>XF,"Module"),MultiMap:o(()=>gh,"MultiMap"),MultiMapScope:o(()=>T3e,"MultiMapScope"),OperationCancelled:o(()=>Zc,"OperationCancelled"),ParserWorker:o(()=>wvt,"ParserWorker"),ProfilingTask:o(()=>rEe,"ProfilingTask"),Reduction:o(()=>iT,"Reduction"),RefResolving:o(()=>f0,"RefResolving"),RegExpUtils:o(()=>Y$,"RegExpUtils"),RootCstNodeImpl:o(()=>yG,"RootCstNodeImpl"),SimpleCache:o(()=>LG,"SimpleCache"),StreamImpl:o(()=>Kc,"StreamImpl"),StreamScope:o(()=>UF,"StreamScope"),TextDocument:o(()=>B5,"TextDocument"),TreeStreamImpl:o(()=>Y1,"TreeStreamImpl"),URI:o(()=>fo,"URI"),UriTrie:o(()=>DG,"UriTrie"),UriUtils:o(()=>os,"UriUtils"),VALIDATE_EACH_NODE:o(()=>A3e,"VALIDATE_EACH_NODE"),ValidationCategory:o(()=>z5,"ValidationCategory"),ValidationRegistry:o(()=>E3e,"ValidationRegistry"),ValueConverter:o(()=>jc,"ValueConverter"),WorkspaceCache:o(()=>MG,"WorkspaceCache"),assertCondition:o(()=>H$,"assertCondition"),assertUnreachable:o(()=>bf,"assertUnreachable"),createCompletionParser:o(()=>CG,"createCompletionParser"),createDefaultCoreModule:o(()=>rn,"createDefaultCoreModule"),createDefaultSharedCoreModule:o(()=>nn,"createDefaultSharedCoreModule"),createGrammarConfig:o(()=>hz,"createGrammarConfig"),createLangiumParser:o(()=>kG,"createLangiumParser"),createParser:o(()=>VA,"createParser"),delayNextTick:o(()=>UA,"delayNextTick"),diagnosticData:o(()=>O0,"diagnosticData"),eagerLoad:o(()=>qG,"eagerLoad"),getDiagnosticRange:o(()=>IG,"getDiagnosticRange"),indentationBuilderDefaultOptions:o(()=>ZF,"indentationBuilderDefaultOptions"),inject:o(()=>Hr,"inject"),interruptAndCheck:o(()=>la,"interruptAndCheck"),isAstNode:o(()=>Rn,"isAstNode"),isAstNodeDescription:o(()=>f$,"isAstNodeDescription"),isAstNodeWithComment:o(()=>NG,"isAstNodeWithComment"),isCompositeCstNode:o(()=>oh,"isCompositeCstNode"),isIMultiModeLexerDefinition:o(()=>ZA,"isIMultiModeLexerDefinition"),isJSDoc:o(()=>$G,"isJSDoc"),isLeafCstNode:o(()=>q0,"isLeafCstNode"),isLinkingError:o(()=>g0,"isLinkingError"),isMultiReference:o(()=>Qc,"isMultiReference"),isNamed:o(()=>RG,"isNamed"),isOperationCancelled:o(()=>cm,"isOperationCancelled"),isReference:o(()=>ss,"isReference"),isRootCstNode:o(()=>H5,"isRootCstNode"),isTokenTypeArray:o(()=>KA,"isTokenTypeArray"),isTokenTypeDictionary:o(()=>G5,"isTokenTypeDictionary"),loadGrammarFromJson:o(()=>xo,"loadGrammarFromJson"),parseJSDoc:o(()=>FG,"parseJSDoc"),prepareLangiumParser:o(()=>wG,"prepareLangiumParser"),setInterruptionPeriod:o(()=>EG,"setInterruptionPeriod"),startCancelableOperation:o(()=>HA,"startCancelableOperation"),stream:o(()=>gi,"stream"),toDiagnosticData:o(()=>OG,"toDiagnosticData"),toDiagnosticSeverity:o(()=>J2,"toDiagnosticSeverity")});d$={};xf(d$,{DefaultNameRegexp:o(()=>z$,"DefaultNameRegexp"),RangeComparison:o(()=>Xc,"RangeComparison"),compareRange:o(()=>F$,"compareRange"),findCommentNode:o(()=>G$,"findCommentNode"),findDeclarationNodeAtOffset:o(()=>Mve,"findDeclarationNodeAtOffset"),findLeafNodeAtOffset:o(()=>J5,"findLeafNodeAtOffset"),findLeafNodeBeforeOffset:o(()=>V$,"findLeafNodeBeforeOffset"),flattenCst:o(()=>Lve,"flattenCst"),getDatatypeNode:o(()=>Rve,"getDatatypeNode"),getInteriorNodes:o(()=>Ove,"getInteriorNodes"),getNextNode:o(()=>Nve,"getNextNode"),getPreviousNode:o(()=>q$,"getPreviousNode"),getStartlineNode:o(()=>Ive,"getStartlineNode"),inRange:o(()=>$$,"inRange"),isChildNode:o(()=>B$,"isChildNode"),isCommentNode:o(()=>v5,"isCommentNode"),streamCst:o(()=>Z1,"streamCst"),toDocumentSegment:o(()=>Q1,"toDocumentSegment"),tokenToRange:o(()=>nT,"tokenToRange")});o(Rn,"isAstNode");S(Rn,"isAstNode");o(ss,"isReference");S(ss,"isReference");o(Qc,"isMultiReference");S(Qc,"isMultiReference");o(f$,"isAstNodeDescription");S(f$,"isAstNodeDescription");o(g0,"isLinkingError");S(g0,"isLinkingError");p$=class{static{o(this,"AbstractAstReflection")}static{S(this,"AbstractAstReflection")}constructor(){this.subtypes={},this.allSubtypes={}}getAllTypes(){return Object.keys(this.types)}getReferenceType(e){let t=this.types[e.container.$type];if(!t)throw new Error(`Type ${e.container.$type||"undefined"} not found.`);let r=t.properties[e.property]?.referenceType;if(!r)throw new Error(`Property ${e.property||"undefined"} of type ${e.container.$type} is not a reference.`);return r}getTypeMetaData(e){let t=this.types[e];return t||{name:e,properties:{},superTypes:[]}}isInstance(e,t){return Rn(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});let i=r[t];if(i!==void 0)return i;{let n=this.types[e],a=n?n.superTypes.some(s=>this.isSubtype(s,t)):!1;return r[t]=a,a}}getAllSubTypes(e){let t=this.allSubtypes[e];if(t)return t;{let r=this.getAllTypes(),i=[];for(let n of r)this.isSubtype(n,e)&&i.push(n);return this.allSubtypes[e]=i,i}}};o(oh,"isCompositeCstNode");S(oh,"isCompositeCstNode");o(q0,"isLeafCstNode");S(q0,"isLeafCstNode");o(H5,"isRootCstNode");S(H5,"isRootCstNode");Kc=class rh{static{o(this,"_StreamImpl")}static{S(this,"StreamImpl")}constructor(t,r){this.startFn=t,this.nextFn=r}iterator(){let t={state:this.startFn(),next:S(()=>this.nextFn(t.state),"next"),[Symbol.iterator]:()=>t};return t}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let t=this.iterator(),r=0,i=t.next();for(;!i.done;)r++,i=t.next();return r}toArray(){let t=[],r=this.iterator(),i;do i=r.next(),i.value!==void 0&&t.push(i.value);while(!i.done);return t}toSet(){return new Set(this)}toMap(t,r){let i=this.map(n=>[t?t(n):n,r?r(n):n]);return new Map(i)}toString(){return this.join()}concat(t){return new rh(()=>({first:this.startFn(),firstDone:!1,iterator:t[Symbol.iterator]()}),r=>{let i;if(!r.firstDone){do if(i=this.nextFn(r.first),!i.done)return i;while(!i.done);r.firstDone=!0}do if(i=r.iterator.next(),!i.done)return i;while(!i.done);return as})}join(t=","){let r=this.iterator(),i="",n,a=!1;do n=r.next(),n.done||(a&&(i+=t),i+=hve(n.value)),a=!0;while(!n.done);return i}indexOf(t,r=0){let i=this.iterator(),n=0,a=i.next();for(;!a.done;){if(n>=r&&a.value===t)return n;a=i.next(),n++}return-1}every(t){let r=this.iterator(),i=r.next();for(;!i.done;){if(!t(i.value))return!1;i=r.next()}return!0}some(t){let r=this.iterator(),i=r.next();for(;!i.done;){if(t(i.value))return!0;i=r.next()}return!1}forEach(t){let r=this.iterator(),i=0,n=r.next();for(;!n.done;)t(n.value,i),n=r.next(),i++}map(t){return new rh(this.startFn,r=>{let{done:i,value:n}=this.nextFn(r);return i?as:{done:!1,value:t(n)}})}filter(t){return new rh(this.startFn,r=>{let i;do if(i=this.nextFn(r),!i.done&&t(i.value))return i;while(!i.done);return as})}nonNullable(){return this.filter(t=>t!=null)}reduce(t,r){let i=this.iterator(),n=r,a=i.next();for(;!a.done;)n===void 0?n=a.value:n=t(n,a.value),a=i.next();return n}reduceRight(t,r){return this.recursiveReduce(this.iterator(),t,r)}recursiveReduce(t,r,i){let n=t.next();if(n.done)return i;let a=this.recursiveReduce(t,r,i);return a===void 0?n.value:r(a,n.value)}find(t){let r=this.iterator(),i=r.next();for(;!i.done;){if(t(i.value))return i.value;i=r.next()}}findIndex(t){let r=this.iterator(),i=0,n=r.next();for(;!n.done;){if(t(n.value))return i;n=r.next(),i++}return-1}includes(t){let r=this.iterator(),i=r.next();for(;!i.done;){if(i.value===t)return!0;i=r.next()}return!1}flatMap(t){return new rh(()=>({this:this.startFn()}),r=>{do{if(r.iterator){let a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}let{done:i,value:n}=this.nextFn(r.this);if(!i){let a=t(n);if(rT(a))r.iterator=a[Symbol.iterator]();else return{done:!1,value:a}}}while(r.iterator);return as})}flat(t){if(t===void 0&&(t=1),t<=0)return this;let r=t>1?this.flat(t-1):this;return new rh(()=>({this:r.startFn()}),i=>{do{if(i.iterator){let s=i.iterator.next();if(s.done)i.iterator=void 0;else return s}let{done:n,value:a}=r.nextFn(i.this);if(!n)if(rT(a))i.iterator=a[Symbol.iterator]();else return{done:!1,value:a}}while(i.iterator);return as})}head(){let r=this.iterator().next();if(!r.done)return r.value}tail(t=1){return new rh(()=>{let r=this.startFn();for(let i=0;i({size:0,state:this.startFn()}),r=>(r.size++,r.size>t?as:this.nextFn(r.state)))}distinct(t){return new rh(()=>({set:new Set,internalState:this.startFn()}),r=>{let i;do if(i=this.nextFn(r.internalState),!i.done){let n=t?t(i.value):i.value;if(!r.set.has(n))return r.set.add(n),i}while(!i.done);return as})}exclude(t,r){let i=new Set;for(let n of t){let a=r?r(n):n;i.add(a)}return this.filter(n=>{let a=r?r(n):n;return!i.has(a)})}};o(hve,"toString");S(hve,"toString");o(rT,"isIterable");S(rT,"isIterable");H1=new Kc(()=>{},()=>as),as=Object.freeze({done:!0,value:void 0});o(gi,"stream");S(gi,"stream");Y1=class extends Kc{static{o(this,"TreeStreamImpl")}static{S(this,"TreeStreamImpl")}constructor(e,t,r){super(()=>({iterators:r?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){let a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(t(a.value)[Symbol.iterator]()),a}return as})}iterator(){let e={state:this.startFn(),next:S(()=>this.nextFn(e.state),"next"),prune:S(()=>{e.state.pruned=!0},"prune"),[Symbol.iterator]:()=>e};return e}};(function(e){function t(a){return a.reduce((s,l)=>s+l,0)}o(t,"sum"),S(t,"sum"),e.sum=t;function r(a){return a.reduce((s,l)=>s*l,0)}o(r,"product"),S(r,"product"),e.product=r;function i(a){return a.reduce((s,l)=>Math.min(s,l))}o(i,"min2"),S(i,"min"),e.min=i;function n(a){return a.reduce((s,l)=>Math.max(s,l))}o(n,"max"),S(n,"max"),e.max=n})(iT||(iT={}));m$={};xf(m$,{assignMandatoryProperties:o(()=>g$,"assignMandatoryProperties"),copyAstNode:o(()=>n5,"copyAstNode"),findRootNode:o(()=>V1,"findRootNode"),getContainerOfType:o(()=>U0,"getContainerOfType"),getDocument:o(()=>Wl,"getDocument"),getReferenceNodes:o(()=>r5,"getReferenceNodes"),hasContainerOfType:o(()=>dve,"hasContainerOfType"),linkContentToContainer:o(()=>j1,"linkContentToContainer"),streamAllContents:o(()=>yh,"streamAllContents"),streamAst:o(()=>ql,"streamAst"),streamContents:o(()=>CT,"streamContents"),streamReferences:o(()=>X1,"streamReferences")});o(j1,"linkContentToContainer");S(j1,"linkContentToContainer");o(U0,"getContainerOfType");S(U0,"getContainerOfType");o(dve,"hasContainerOfType");S(dve,"hasContainerOfType");o(Wl,"getDocument");S(Wl,"getDocument");o(V1,"findRootNode");S(V1,"findRootNode");o(r5,"getReferenceNodes");S(r5,"getReferenceNodes");o(CT,"streamContents");S(CT,"streamContents");o(yh,"streamAllContents");S(yh,"streamAllContents");o(ql,"streamAst");S(ql,"streamAst");o(i5,"isAstNodeInRange");S(i5,"isAstNodeInRange");o(X1,"streamReferences");S(X1,"streamReferences");o(g$,"assignMandatoryProperties");S(g$,"assignMandatoryProperties");o(y$,"copyDefaultValue");S(y$,"copyDefaultValue");o(n5,"copyAstNode");S(n5,"copyAstNode");fve={};xf(fve,{AbstractElement:o(()=>zs,"AbstractElement"),AbstractParserRule:o(()=>$2,"AbstractParserRule"),AbstractRule:o(()=>N1,"AbstractRule"),AbstractType:o(()=>ho,"AbstractType"),Action:o(()=>of,"Action"),Alternatives:o(()=>z2,"Alternatives"),ArrayLiteral:o(()=>a5,"ArrayLiteral"),ArrayType:o(()=>s5,"ArrayType"),Assignment:o(()=>lf,"Assignment"),BooleanLiteral:o(()=>o5,"BooleanLiteral"),CharacterRange:o(()=>cf,"CharacterRange"),Condition:o(()=>uf,"Condition"),Conjunction:o(()=>G2,"Conjunction"),CrossReference:o(()=>hf,"CrossReference"),Disjunction:o(()=>V2,"Disjunction"),EndOfFile:o(()=>l5,"EndOfFile"),Grammar:o(()=>nh,"Grammar"),GrammarImport:o(()=>c5,"GrammarImport"),Group:o(()=>y0,"Group"),InferredType:o(()=>u5,"InferredType"),InfixRule:o(()=>Hc,"InfixRule"),InfixRuleOperatorList:o(()=>W2,"InfixRuleOperatorList"),InfixRuleOperators:o(()=>h5,"InfixRuleOperators"),Interface:o(()=>I1,"Interface"),Keyword:o(()=>O1,"Keyword"),LangiumGrammarAstReflection:o(()=>P$,"LangiumGrammarAstReflection"),LangiumGrammarTerminals:o(()=>Xlt,"LangiumGrammarTerminals"),NamedArgument:o(()=>P1,"NamedArgument"),NegatedToken:o(()=>v0,"NegatedToken"),Negation:o(()=>d5,"Negation"),NumberLiteral:o(()=>f5,"NumberLiteral"),Parameter:o(()=>B1,"Parameter"),ParameterReference:o(()=>p5,"ParameterReference"),ParserRule:o(()=>zl,"ParserRule"),ReferenceType:o(()=>q2,"ReferenceType"),RegexToken:o(()=>x0,"RegexToken"),ReturnType:o(()=>m5,"ReturnType"),RuleCall:o(()=>b0,"RuleCall"),SimpleType:o(()=>F1,"SimpleType"),StringLiteral:o(()=>g5,"StringLiteral"),TerminalAlternatives:o(()=>T0,"TerminalAlternatives"),TerminalElement:o(()=>Gs,"TerminalElement"),TerminalGroup:o(()=>C0,"TerminalGroup"),TerminalRule:o(()=>ah,"TerminalRule"),TerminalRuleCall:o(()=>k0,"TerminalRuleCall"),Type:o(()=>U2,"Type"),TypeAttribute:o(()=>w0,"TypeAttribute"),TypeDefinition:o(()=>S0,"TypeDefinition"),UnionType:o(()=>y5,"UnionType"),UnorderedGroup:o(()=>H2,"UnorderedGroup"),UntilToken:o(()=>E0,"UntilToken"),ValueLiteral:o(()=>A0,"ValueLiteral"),Wildcard:o(()=>$1,"Wildcard"),isAbstractElement:o(()=>Y5,"isAbstractElement"),isAbstractParserRule:o(()=>H0,"isAbstractParserRule"),isAbstractRule:o(()=>pve,"isAbstractRule"),isAbstractType:o(()=>mve,"isAbstractType"),isAction:o(()=>pf,"isAction"),isAlternatives:o(()=>j5,"isAlternatives"),isArrayLiteral:o(()=>gve,"isArrayLiteral"),isArrayType:o(()=>v$,"isArrayType"),isAssignment:o(()=>lh,"isAssignment"),isBooleanLiteral:o(()=>x$,"isBooleanLiteral"),isCharacterRange:o(()=>b$,"isCharacterRange"),isCondition:o(()=>yve,"isCondition"),isConjunction:o(()=>T$,"isConjunction"),isCrossReference:o(()=>Y0,"isCrossReference"),isDisjunction:o(()=>C$,"isDisjunction"),isEndOfFile:o(()=>k$,"isEndOfFile"),isGrammar:o(()=>vve,"isGrammar"),isGrammarImport:o(()=>xve,"isGrammarImport"),isGroup:o(()=>j0,"isGroup"),isInferredType:o(()=>kT,"isInferredType"),isInfixRule:o(()=>K1,"isInfixRule"),isInfixRuleOperatorList:o(()=>bve,"isInfixRuleOperatorList"),isInfixRuleOperators:o(()=>Tve,"isInfixRuleOperators"),isInterface:o(()=>w$,"isInterface"),isKeyword:o(()=>ch,"isKeyword"),isNamedArgument:o(()=>Cve,"isNamedArgument"),isNegatedToken:o(()=>S$,"isNegatedToken"),isNegation:o(()=>E$,"isNegation"),isNumberLiteral:o(()=>kve,"isNumberLiteral"),isParameter:o(()=>wve,"isParameter"),isParameterReference:o(()=>A$,"isParameterReference"),isParserRule:o(()=>cs,"isParserRule"),isReferenceType:o(()=>_$,"isReferenceType"),isRegexToken:o(()=>D$,"isRegexToken"),isReturnType:o(()=>R$,"isReturnType"),isRuleCall:o(()=>uh,"isRuleCall"),isSimpleType:o(()=>X5,"isSimpleType"),isStringLiteral:o(()=>Sve,"isStringLiteral"),isTerminalAlternatives:o(()=>L$,"isTerminalAlternatives"),isTerminalElement:o(()=>Eve,"isTerminalElement"),isTerminalGroup:o(()=>M$,"isTerminalGroup"),isTerminalRule:o(()=>rl,"isTerminalRule"),isTerminalRuleCall:o(()=>K5,"isTerminalRuleCall"),isType:o(()=>Z5,"isType"),isTypeAttribute:o(()=>Ave,"isTypeAttribute"),isTypeDefinition:o(()=>_ve,"isTypeDefinition"),isUnionType:o(()=>N$,"isUnionType"),isUnorderedGroup:o(()=>Q5,"isUnorderedGroup"),isUntilToken:o(()=>I$,"isUntilToken"),isValueLiteral:o(()=>Dve,"isValueLiteral"),isWildcard:o(()=>O$,"isWildcard"),reflection:o(()=>dr,"reflection")});Xlt={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},zs={$type:"AbstractElement",cardinality:"cardinality"};o(Y5,"isAbstractElement");S(Y5,"isAbstractElement");$2={$type:"AbstractParserRule"};o(H0,"isAbstractParserRule");S(H0,"isAbstractParserRule");N1={$type:"AbstractRule"};o(pve,"isAbstractRule");S(pve,"isAbstractRule");ho={$type:"AbstractType"};o(mve,"isAbstractType");S(mve,"isAbstractType");of={$type:"Action",cardinality:"cardinality",feature:"feature",inferredType:"inferredType",operator:"operator",type:"type"};o(pf,"isAction");S(pf,"isAction");z2={$type:"Alternatives",cardinality:"cardinality",elements:"elements"};o(j5,"isAlternatives");S(j5,"isAlternatives");a5={$type:"ArrayLiteral",elements:"elements"};o(gve,"isArrayLiteral");S(gve,"isArrayLiteral");s5={$type:"ArrayType",elementType:"elementType"};o(v$,"isArrayType");S(v$,"isArrayType");lf={$type:"Assignment",cardinality:"cardinality",feature:"feature",operator:"operator",predicate:"predicate",terminal:"terminal"};o(lh,"isAssignment");S(lh,"isAssignment");o5={$type:"BooleanLiteral",true:"true"};o(x$,"isBooleanLiteral");S(x$,"isBooleanLiteral");cf={$type:"CharacterRange",cardinality:"cardinality",left:"left",lookahead:"lookahead",parenthesized:"parenthesized",right:"right"};o(b$,"isCharacterRange");S(b$,"isCharacterRange");uf={$type:"Condition"};o(yve,"isCondition");S(yve,"isCondition");G2={$type:"Conjunction",left:"left",right:"right"};o(T$,"isConjunction");S(T$,"isConjunction");hf={$type:"CrossReference",cardinality:"cardinality",deprecatedSyntax:"deprecatedSyntax",isMulti:"isMulti",terminal:"terminal",type:"type"};o(Y0,"isCrossReference");S(Y0,"isCrossReference");V2={$type:"Disjunction",left:"left",right:"right"};o(C$,"isDisjunction");S(C$,"isDisjunction");l5={$type:"EndOfFile",cardinality:"cardinality"};o(k$,"isEndOfFile");S(k$,"isEndOfFile");nh={$type:"Grammar",imports:"imports",interfaces:"interfaces",isDeclared:"isDeclared",name:"name",rules:"rules",types:"types"};o(vve,"isGrammar");S(vve,"isGrammar");c5={$type:"GrammarImport",path:"path"};o(xve,"isGrammarImport");S(xve,"isGrammarImport");y0={$type:"Group",cardinality:"cardinality",elements:"elements",guardCondition:"guardCondition",predicate:"predicate"};o(j0,"isGroup");S(j0,"isGroup");u5={$type:"InferredType",name:"name"};o(kT,"isInferredType");S(kT,"isInferredType");Hc={$type:"InfixRule",call:"call",dataType:"dataType",inferredType:"inferredType",name:"name",operators:"operators",parameters:"parameters",returnType:"returnType"};o(K1,"isInfixRule");S(K1,"isInfixRule");W2={$type:"InfixRuleOperatorList",associativity:"associativity",operators:"operators"};o(bve,"isInfixRuleOperatorList");S(bve,"isInfixRuleOperatorList");h5={$type:"InfixRuleOperators",precedences:"precedences"};o(Tve,"isInfixRuleOperators");S(Tve,"isInfixRuleOperators");I1={$type:"Interface",attributes:"attributes",name:"name",superTypes:"superTypes"};o(w$,"isInterface");S(w$,"isInterface");O1={$type:"Keyword",cardinality:"cardinality",predicate:"predicate",value:"value"};o(ch,"isKeyword");S(ch,"isKeyword");P1={$type:"NamedArgument",calledByName:"calledByName",parameter:"parameter",value:"value"};o(Cve,"isNamedArgument");S(Cve,"isNamedArgument");v0={$type:"NegatedToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};o(S$,"isNegatedToken");S(S$,"isNegatedToken");d5={$type:"Negation",value:"value"};o(E$,"isNegation");S(E$,"isNegation");f5={$type:"NumberLiteral",value:"value"};o(kve,"isNumberLiteral");S(kve,"isNumberLiteral");B1={$type:"Parameter",name:"name"};o(wve,"isParameter");S(wve,"isParameter");p5={$type:"ParameterReference",parameter:"parameter"};o(A$,"isParameterReference");S(A$,"isParameterReference");zl={$type:"ParserRule",dataType:"dataType",definition:"definition",entry:"entry",fragment:"fragment",inferredType:"inferredType",name:"name",parameters:"parameters",returnType:"returnType"};o(cs,"isParserRule");S(cs,"isParserRule");q2={$type:"ReferenceType",isMulti:"isMulti",referenceType:"referenceType"};o(_$,"isReferenceType");S(_$,"isReferenceType");x0={$type:"RegexToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",regex:"regex"};o(D$,"isRegexToken");S(D$,"isRegexToken");m5={$type:"ReturnType",name:"name"};o(R$,"isReturnType");S(R$,"isReturnType");b0={$type:"RuleCall",arguments:"arguments",cardinality:"cardinality",predicate:"predicate",rule:"rule"};o(uh,"isRuleCall");S(uh,"isRuleCall");F1={$type:"SimpleType",primitiveType:"primitiveType",stringType:"stringType",typeRef:"typeRef"};o(X5,"isSimpleType");S(X5,"isSimpleType");g5={$type:"StringLiteral",value:"value"};o(Sve,"isStringLiteral");S(Sve,"isStringLiteral");T0={$type:"TerminalAlternatives",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};o(L$,"isTerminalAlternatives");S(L$,"isTerminalAlternatives");Gs={$type:"TerminalElement",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};o(Eve,"isTerminalElement");S(Eve,"isTerminalElement");C0={$type:"TerminalGroup",cardinality:"cardinality",elements:"elements",lookahead:"lookahead",parenthesized:"parenthesized"};o(M$,"isTerminalGroup");S(M$,"isTerminalGroup");ah={$type:"TerminalRule",definition:"definition",fragment:"fragment",hidden:"hidden",name:"name",type:"type"};o(rl,"isTerminalRule");S(rl,"isTerminalRule");k0={$type:"TerminalRuleCall",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",rule:"rule"};o(K5,"isTerminalRuleCall");S(K5,"isTerminalRuleCall");U2={$type:"Type",name:"name",type:"type"};o(Z5,"isType");S(Z5,"isType");w0={$type:"TypeAttribute",defaultValue:"defaultValue",isOptional:"isOptional",name:"name",type:"type"};o(Ave,"isTypeAttribute");S(Ave,"isTypeAttribute");S0={$type:"TypeDefinition"};o(_ve,"isTypeDefinition");S(_ve,"isTypeDefinition");y5={$type:"UnionType",types:"types"};o(N$,"isUnionType");S(N$,"isUnionType");H2={$type:"UnorderedGroup",cardinality:"cardinality",elements:"elements"};o(Q5,"isUnorderedGroup");S(Q5,"isUnorderedGroup");E0={$type:"UntilToken",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized",terminal:"terminal"};o(I$,"isUntilToken");S(I$,"isUntilToken");A0={$type:"ValueLiteral"};o(Dve,"isValueLiteral");S(Dve,"isValueLiteral");$1={$type:"Wildcard",cardinality:"cardinality",lookahead:"lookahead",parenthesized:"parenthesized"};o(O$,"isWildcard");S(O$,"isWildcard");P$=class extends p${static{o(this,"LangiumGrammarAstReflection")}static{S(this,"LangiumGrammarAstReflection")}constructor(){super(...arguments),this.types={AbstractElement:{name:zs.$type,properties:{cardinality:{name:zs.cardinality}},superTypes:[]},AbstractParserRule:{name:$2.$type,properties:{},superTypes:[N1.$type,ho.$type]},AbstractRule:{name:N1.$type,properties:{},superTypes:[]},AbstractType:{name:ho.$type,properties:{},superTypes:[]},Action:{name:of.$type,properties:{cardinality:{name:of.cardinality},feature:{name:of.feature},inferredType:{name:of.inferredType},operator:{name:of.operator},type:{name:of.type,referenceType:ho.$type}},superTypes:[zs.$type]},Alternatives:{name:z2.$type,properties:{cardinality:{name:z2.cardinality},elements:{name:z2.elements,defaultValue:[]}},superTypes:[zs.$type]},ArrayLiteral:{name:a5.$type,properties:{elements:{name:a5.elements,defaultValue:[]}},superTypes:[A0.$type]},ArrayType:{name:s5.$type,properties:{elementType:{name:s5.elementType}},superTypes:[S0.$type]},Assignment:{name:lf.$type,properties:{cardinality:{name:lf.cardinality},feature:{name:lf.feature},operator:{name:lf.operator},predicate:{name:lf.predicate},terminal:{name:lf.terminal}},superTypes:[zs.$type]},BooleanLiteral:{name:o5.$type,properties:{true:{name:o5.true,defaultValue:!1}},superTypes:[uf.$type,A0.$type]},CharacterRange:{name:cf.$type,properties:{cardinality:{name:cf.cardinality},left:{name:cf.left},lookahead:{name:cf.lookahead},parenthesized:{name:cf.parenthesized,defaultValue:!1},right:{name:cf.right}},superTypes:[Gs.$type]},Condition:{name:uf.$type,properties:{},superTypes:[]},Conjunction:{name:G2.$type,properties:{left:{name:G2.left},right:{name:G2.right}},superTypes:[uf.$type]},CrossReference:{name:hf.$type,properties:{cardinality:{name:hf.cardinality},deprecatedSyntax:{name:hf.deprecatedSyntax,defaultValue:!1},isMulti:{name:hf.isMulti,defaultValue:!1},terminal:{name:hf.terminal},type:{name:hf.type,referenceType:ho.$type}},superTypes:[zs.$type]},Disjunction:{name:V2.$type,properties:{left:{name:V2.left},right:{name:V2.right}},superTypes:[uf.$type]},EndOfFile:{name:l5.$type,properties:{cardinality:{name:l5.cardinality}},superTypes:[zs.$type]},Grammar:{name:nh.$type,properties:{imports:{name:nh.imports,defaultValue:[]},interfaces:{name:nh.interfaces,defaultValue:[]},isDeclared:{name:nh.isDeclared,defaultValue:!1},name:{name:nh.name},rules:{name:nh.rules,defaultValue:[]},types:{name:nh.types,defaultValue:[]}},superTypes:[]},GrammarImport:{name:c5.$type,properties:{path:{name:c5.path}},superTypes:[]},Group:{name:y0.$type,properties:{cardinality:{name:y0.cardinality},elements:{name:y0.elements,defaultValue:[]},guardCondition:{name:y0.guardCondition},predicate:{name:y0.predicate}},superTypes:[zs.$type]},InferredType:{name:u5.$type,properties:{name:{name:u5.name}},superTypes:[ho.$type]},InfixRule:{name:Hc.$type,properties:{call:{name:Hc.call},dataType:{name:Hc.dataType},inferredType:{name:Hc.inferredType},name:{name:Hc.name},operators:{name:Hc.operators},parameters:{name:Hc.parameters,defaultValue:[]},returnType:{name:Hc.returnType,referenceType:ho.$type}},superTypes:[$2.$type]},InfixRuleOperatorList:{name:W2.$type,properties:{associativity:{name:W2.associativity},operators:{name:W2.operators,defaultValue:[]}},superTypes:[]},InfixRuleOperators:{name:h5.$type,properties:{precedences:{name:h5.precedences,defaultValue:[]}},superTypes:[]},Interface:{name:I1.$type,properties:{attributes:{name:I1.attributes,defaultValue:[]},name:{name:I1.name},superTypes:{name:I1.superTypes,defaultValue:[],referenceType:ho.$type}},superTypes:[ho.$type]},Keyword:{name:O1.$type,properties:{cardinality:{name:O1.cardinality},predicate:{name:O1.predicate},value:{name:O1.value}},superTypes:[zs.$type]},NamedArgument:{name:P1.$type,properties:{calledByName:{name:P1.calledByName,defaultValue:!1},parameter:{name:P1.parameter,referenceType:B1.$type},value:{name:P1.value}},superTypes:[]},NegatedToken:{name:v0.$type,properties:{cardinality:{name:v0.cardinality},lookahead:{name:v0.lookahead},parenthesized:{name:v0.parenthesized,defaultValue:!1},terminal:{name:v0.terminal}},superTypes:[Gs.$type]},Negation:{name:d5.$type,properties:{value:{name:d5.value}},superTypes:[uf.$type]},NumberLiteral:{name:f5.$type,properties:{value:{name:f5.value}},superTypes:[A0.$type]},Parameter:{name:B1.$type,properties:{name:{name:B1.name}},superTypes:[]},ParameterReference:{name:p5.$type,properties:{parameter:{name:p5.parameter,referenceType:B1.$type}},superTypes:[uf.$type]},ParserRule:{name:zl.$type,properties:{dataType:{name:zl.dataType},definition:{name:zl.definition},entry:{name:zl.entry,defaultValue:!1},fragment:{name:zl.fragment,defaultValue:!1},inferredType:{name:zl.inferredType},name:{name:zl.name},parameters:{name:zl.parameters,defaultValue:[]},returnType:{name:zl.returnType,referenceType:ho.$type}},superTypes:[$2.$type]},ReferenceType:{name:q2.$type,properties:{isMulti:{name:q2.isMulti,defaultValue:!1},referenceType:{name:q2.referenceType}},superTypes:[S0.$type]},RegexToken:{name:x0.$type,properties:{cardinality:{name:x0.cardinality},lookahead:{name:x0.lookahead},parenthesized:{name:x0.parenthesized,defaultValue:!1},regex:{name:x0.regex}},superTypes:[Gs.$type]},ReturnType:{name:m5.$type,properties:{name:{name:m5.name}},superTypes:[]},RuleCall:{name:b0.$type,properties:{arguments:{name:b0.arguments,defaultValue:[]},cardinality:{name:b0.cardinality},predicate:{name:b0.predicate},rule:{name:b0.rule,referenceType:N1.$type}},superTypes:[zs.$type]},SimpleType:{name:F1.$type,properties:{primitiveType:{name:F1.primitiveType},stringType:{name:F1.stringType},typeRef:{name:F1.typeRef,referenceType:ho.$type}},superTypes:[S0.$type]},StringLiteral:{name:g5.$type,properties:{value:{name:g5.value}},superTypes:[A0.$type]},TerminalAlternatives:{name:T0.$type,properties:{cardinality:{name:T0.cardinality},elements:{name:T0.elements,defaultValue:[]},lookahead:{name:T0.lookahead},parenthesized:{name:T0.parenthesized,defaultValue:!1}},superTypes:[Gs.$type]},TerminalElement:{name:Gs.$type,properties:{cardinality:{name:Gs.cardinality},lookahead:{name:Gs.lookahead},parenthesized:{name:Gs.parenthesized,defaultValue:!1}},superTypes:[zs.$type]},TerminalGroup:{name:C0.$type,properties:{cardinality:{name:C0.cardinality},elements:{name:C0.elements,defaultValue:[]},lookahead:{name:C0.lookahead},parenthesized:{name:C0.parenthesized,defaultValue:!1}},superTypes:[Gs.$type]},TerminalRule:{name:ah.$type,properties:{definition:{name:ah.definition},fragment:{name:ah.fragment,defaultValue:!1},hidden:{name:ah.hidden,defaultValue:!1},name:{name:ah.name},type:{name:ah.type}},superTypes:[N1.$type]},TerminalRuleCall:{name:k0.$type,properties:{cardinality:{name:k0.cardinality},lookahead:{name:k0.lookahead},parenthesized:{name:k0.parenthesized,defaultValue:!1},rule:{name:k0.rule,referenceType:ah.$type}},superTypes:[Gs.$type]},Type:{name:U2.$type,properties:{name:{name:U2.name},type:{name:U2.type}},superTypes:[ho.$type]},TypeAttribute:{name:w0.$type,properties:{defaultValue:{name:w0.defaultValue},isOptional:{name:w0.isOptional,defaultValue:!1},name:{name:w0.name},type:{name:w0.type}},superTypes:[]},TypeDefinition:{name:S0.$type,properties:{},superTypes:[]},UnionType:{name:y5.$type,properties:{types:{name:y5.types,defaultValue:[]}},superTypes:[S0.$type]},UnorderedGroup:{name:H2.$type,properties:{cardinality:{name:H2.cardinality},elements:{name:H2.elements,defaultValue:[]}},superTypes:[zs.$type]},UntilToken:{name:E0.$type,properties:{cardinality:{name:E0.cardinality},lookahead:{name:E0.lookahead},parenthesized:{name:E0.parenthesized,defaultValue:!1},terminal:{name:E0.terminal}},superTypes:[Gs.$type]},ValueLiteral:{name:A0.$type,properties:{},superTypes:[]},Wildcard:{name:$1.$type,properties:{cardinality:{name:$1.cardinality},lookahead:{name:$1.lookahead},parenthesized:{name:$1.parenthesized,defaultValue:!1}},superTypes:[Gs.$type]}}}},dr=new P$;o(Rve,"getDatatypeNode");S(Rve,"getDatatypeNode");o(Z1,"streamCst");S(Z1,"streamCst");o(Lve,"flattenCst");S(Lve,"flattenCst");o(B$,"isChildNode");S(B$,"isChildNode");o(nT,"tokenToRange");S(nT,"tokenToRange");o(Q1,"toDocumentSegment");S(Q1,"toDocumentSegment");(function(e){e[e.Before=0]="Before",e[e.After=1]="After",e[e.OverlapFront=2]="OverlapFront",e[e.OverlapBack=3]="OverlapBack",e[e.Inside=4]="Inside",e[e.Outside=5]="Outside"})(Xc||(Xc={}));o(F$,"compareRange");S(F$,"compareRange");o($$,"inRange");S($$,"inRange");z$=/^[\w\p{L}]$/u;o(Mve,"findDeclarationNodeAtOffset");S(Mve,"findDeclarationNodeAtOffset");o(G$,"findCommentNode");S(G$,"findCommentNode");o(v5,"isCommentNode");S(v5,"isCommentNode");o(J5,"findLeafNodeAtOffset");S(J5,"findLeafNodeAtOffset");o(V$,"findLeafNodeBeforeOffset");S(V$,"findLeafNodeBeforeOffset");o(W$,"binarySearch");S(W$,"binarySearch");o(q$,"getPreviousNode");S(q$,"getPreviousNode");o(Nve,"getNextNode");S(Nve,"getNextNode");o(Ive,"getStartlineNode");S(Ive,"getStartlineNode");o(Ove,"getInteriorNodes");S(Ove,"getInteriorNodes");o(Pve,"getCommonParent");S(Pve,"getCommonParent");o(pF,"getParentChain");S(pF,"getParentChain");U$={};xf(U$,{findAssignment:o(()=>nz,"findAssignment"),findNameAssignment:o(()=>oA,"findNameAssignment"),findNodeForKeyword:o(()=>iz,"findNodeForKeyword"),findNodeForProperty:o(()=>nA,"findNodeForProperty"),findNodesForKeyword:o(()=>Wve,"findNodesForKeyword"),findNodesForKeywordInternal:o(()=>sA,"findNodesForKeywordInternal"),findNodesForProperty:o(()=>rz,"findNodesForProperty"),getActionAtElement:o(()=>sz,"getActionAtElement"),getActionType:o(()=>lz,"getActionType"),getAllReachableRules:o(()=>iA,"getAllReachableRules"),getAllRulesUsedForCrossReferences:o(()=>Vve,"getAllRulesUsedForCrossReferences"),getCrossReferenceTerminal:o(()=>ez,"getCrossReferenceTerminal"),getEntryRule:o(()=>Z$,"getEntryRule"),getExplicitRuleType:o(()=>ST,"getExplicitRuleType"),getHiddenRules:o(()=>Q$,"getHiddenRules"),getRuleType:o(()=>cz,"getRuleType"),getRuleTypeName:o(()=>jve,"getRuleTypeName"),getTypeName:o(()=>$0,"getTypeName"),isArrayCardinality:o(()=>Uve,"isArrayCardinality"),isArrayOperator:o(()=>Hve,"isArrayOperator"),isCommentTerminal:o(()=>tz,"isCommentTerminal"),isDataType:o(()=>Yve,"isDataType"),isDataTypeRule:o(()=>wT,"isDataTypeRule"),isOptionalCardinality:o(()=>qve,"isOptionalCardinality"),terminalRegex:o(()=>ET,"terminalRegex")});eA=class extends Error{static{o(this,"ErrorWithLocation")}static{S(this,"ErrorWithLocation")}constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};o(bf,"assertUnreachable");S(bf,"assertUnreachable");o(H$,"assertCondition");S(H$,"assertCondition");Y$={};xf(Y$,{NEWLINE_REGEXP:o(()=>Fve,"NEWLINE_REGEXP"),escapeRegExp:o(()=>sy,"escapeRegExp"),getTerminalParts:o(()=>zve,"getTerminalParts"),isMultilineComment:o(()=>j$,"isMultilineComment"),isWhitespace:o(()=>rA,"isWhitespace"),partialMatches:o(()=>X$,"partialMatches"),partialRegExp:o(()=>K$,"partialRegExp"),whitespaceCharacters:o(()=>Gve,"whitespaceCharacters")});o(yr,"cc");S(yr,"cc");o(GE,"insertToSet");S(GE,"insertToSet");o(R1,"addFlag");S(R1,"addFlag");o(u0,"ASSERT_EXISTS");S(u0,"ASSERT_EXISTS");o(I2,"ASSERT_NEVER_REACH_HERE");S(I2,"ASSERT_NEVER_REACH_HERE");o(mF,"isCharacter");S(mF,"isCharacter");x5=[];for(let e=yr("0");e<=yr("9");e++)x5.push(e);b5=[yr("_")].concat(x5);for(let e=yr("a");e<=yr("z");e++)b5.push(e);for(let e=yr("A");e<=yr("Z");e++)b5.push(e);y1e=[yr(" "),yr("\f"),yr(` +`),yr("\r"),yr(" "),yr("\v"),yr(" "),yr("\xA0"),yr("\u1680"),yr("\u2000"),yr("\u2001"),yr("\u2002"),yr("\u2003"),yr("\u2004"),yr("\u2005"),yr("\u2006"),yr("\u2007"),yr("\u2008"),yr("\u2009"),yr("\u200A"),yr("\u2028"),yr("\u2029"),yr("\u202F"),yr("\u205F"),yr("\u3000"),yr("\uFEFF")],Klt=/[0-9a-fA-F]/,mE=/[0-9]/,Zlt=/[1-9]/,Bve=class{static{o(this,"RegExpParser")}static{S(this,"RegExpParser")}constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let t=this.disjunction();this.consumeChar("/");let r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":R1(r,"global");break;case"i":R1(r,"ignoreCase");break;case"m":R1(r,"multiLine");break;case"u":R1(r,"unicode");break;case"y":R1(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}break}}u0(t);let r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return I2()}quantifier(e=!1){let t,r=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":let n;this.isDigit()?(n=this.integerIncludingZero(),t={atLeast:i,atMost:n}):t={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;u0(t);break}if(!(e===!0&&t===void 0)&&u0(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(r),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),u0(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):I2()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[yr(` +`),yr("\r"),yr("\u2028"),yr("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=x5;break;case"D":e=x5,t=!0;break;case"s":e=y1e;break;case"S":e=y1e,t=!0;break;case"w":e=b5;break;case"W":e=b5,t=!0;break}return u0(e)?{type:"Set",value:e,complement:t}:I2()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=yr("\f");break;case"n":e=yr(` +`);break;case"r":e=yr("\r");break;case"t":e=yr(" ");break;case"v":e=yr("\v");break}return u0(e)?{type:"Character",value:e}:I2()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:yr("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:yr(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case` +`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:yr(e)}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let r=this.classAtom(),i=r.type==="Character";if(mF(r)&&this.isRangeDash()){this.consumeChar("-");let n=this.classAtom(),a=n.type==="Character";if(mF(n)){if(n.value=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}},tA=class{static{o(this,"BaseRegExpVisitor")}static{S(this,"BaseRegExpVisitor")}visitChildren(e){for(let t in e){let r=e[t];e.hasOwnProperty(t)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},Fve=/\r?\n/gm,$ve=new Bve,Qlt=class extends tA{static{o(this,"TerminalRegExpVisitor")}static{S(this,"TerminalRegExpVisitor")}constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let t=String.fromCharCode(e.value);if(!this.multiline&&t===` +`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let r=sy(t);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){let t=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(t);this.multiline=!!` +`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}},N0=new Qlt;o(zve,"getTerminalParts");S(zve,"getTerminalParts");o(j$,"isMultilineComment");S(j$,"isMultilineComment");Gve=`\f +\r \v \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF`.split("");o(rA,"isWhitespace");S(rA,"isWhitespace");o(sy,"escapeRegExp");S(sy,"escapeRegExp");o(X$,"partialMatches");S(X$,"partialMatches");o(K$,"partialRegExp");S(K$,"partialRegExp");o(Z$,"getEntryRule");S(Z$,"getEntryRule");o(Q$,"getHiddenRules");S(Q$,"getHiddenRules");o(iA,"getAllReachableRules");S(iA,"getAllReachableRules");o(J$,"ruleDfs");S(J$,"ruleDfs");o(Vve,"getAllRulesUsedForCrossReferences");S(Vve,"getAllRulesUsedForCrossReferences");o(ez,"getCrossReferenceTerminal");S(ez,"getCrossReferenceTerminal");o(tz,"isCommentTerminal");S(tz,"isCommentTerminal");o(rz,"findNodesForProperty");S(rz,"findNodesForProperty");o(nA,"findNodeForProperty");S(nA,"findNodeForProperty");o(aA,"findNodesForPropertyInternal");S(aA,"findNodesForPropertyInternal");o(Wve,"findNodesForKeyword");S(Wve,"findNodesForKeyword");o(iz,"findNodeForKeyword");S(iz,"findNodeForKeyword");o(sA,"findNodesForKeywordInternal");S(sA,"findNodesForKeywordInternal");o(nz,"findAssignment");S(nz,"findAssignment");o(oA,"findNameAssignment");S(oA,"findNameAssignment");o(az,"findNameAssignmentInternal");S(az,"findNameAssignmentInternal");o(sz,"getActionAtElement");S(sz,"getActionAtElement");o(qve,"isOptionalCardinality");S(qve,"isOptionalCardinality");o(Uve,"isArrayCardinality");S(Uve,"isArrayCardinality");o(Hve,"isArrayOperator");S(Hve,"isArrayOperator");o(wT,"isDataTypeRule");S(wT,"isDataTypeRule");o(oz,"isDataTypeRuleInternal");S(oz,"isDataTypeRuleInternal");o(Yve,"isDataType");S(Yve,"isDataType");o(T5,"isDataTypeInternal");S(T5,"isDataTypeInternal");o(ST,"getExplicitRuleType");S(ST,"getExplicitRuleType");o($0,"getTypeName");S($0,"getTypeName");o(lz,"getActionType");S(lz,"getActionType");o(jve,"getRuleTypeName");S(jve,"getRuleTypeName");o(cz,"getRuleType");S(cz,"getRuleType");o(ET,"terminalRegex");S(ET,"terminalRegex");uz=/[\s\S]/.source;o(X0,"abstractElementToRegex");S(X0,"abstractElementToRegex");o(Xve,"terminalAlternativesToRegex");S(Xve,"terminalAlternativesToRegex");o(Kve,"terminalGroupToRegex");S(Kve,"terminalGroupToRegex");o(Zve,"untilTokenToRegex");S(Zve,"untilTokenToRegex");o(Qve,"negateTokenToRegex");S(Qve,"negateTokenToRegex");o(Jve,"characterRangeToRegex");S(Jve,"characterRangeToRegex");o(VE,"keywordToRegex");S(VE,"keywordToRegex");o(Jc,"withCardinality");S(Jc,"withCardinality");o(hz,"createGrammarConfig");S(hz,"createGrammarConfig");Jlt=typeof global=="object"&&global&&global.Object===Object&&global,exe=Jlt,ect=typeof self=="object"&&self&&self.Object===Object&&self,tct=exe||ect||Function("return this")(),tu=tct,rct=tu.Symbol,el=rct,txe=Object.prototype,ict=txe.hasOwnProperty,nct=txe.toString,x2=el?el.toStringTag:void 0;o(rxe,"getRawTag");S(rxe,"getRawTag");act=rxe,sct=Object.prototype,oct=sct.toString;o(ixe,"objectToString");S(ixe,"objectToString");lct=ixe,cct="[object Null]",uct="[object Undefined]",v1e=el?el.toStringTag:void 0;o(nxe,"baseGetTag");S(nxe,"baseGetTag");Tf=nxe;o(axe,"isObjectLike");S(axe,"isObjectLike");Yl=axe,hct="[object Symbol]";o(sxe,"isSymbol");S(sxe,"isSymbol");lA=sxe;o(oxe,"arrayMap");S(oxe,"arrayMap");AT=oxe,dct=Array.isArray,Kr=dct,fct=1/0,x1e=el?el.prototype:void 0,b1e=x1e?x1e.toString:void 0;o(dz,"baseToString");S(dz,"baseToString");pct=dz,mct=/\s/;o(lxe,"trimmedEndIndex");S(lxe,"trimmedEndIndex");gct=lxe,yct=/^\s+/;o(cxe,"baseTrim");S(cxe,"baseTrim");vct=cxe;o(uxe,"isObject");S(uxe,"isObject");tl=uxe,T1e=NaN,xct=/^[-+]0x[0-9a-f]+$/i,bct=/^0b[01]+$/i,Tct=/^0o[0-7]+$/i,Cct=parseInt;o(hxe,"toNumber");S(hxe,"toNumber");kct=hxe,C1e=1/0,wct=17976931348623157e292;o(dxe,"toFinite");S(dxe,"toFinite");Sct=dxe;o(fxe,"toInteger");S(fxe,"toInteger");_T=fxe;o(pxe,"identity");S(pxe,"identity");J1=pxe,Ect="[object AsyncFunction]",Act="[object Function]",_ct="[object GeneratorFunction]",Dct="[object Proxy]";o(mxe,"isFunction");S(mxe,"isFunction");vh=mxe,Rct=tu["__core-js_shared__"],YP=Rct,k1e=(function(){var e=/[^.]+$/.exec(YP&&YP.keys&&YP.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();o(gxe,"isMasked");S(gxe,"isMasked");Lct=gxe,Mct=Function.prototype,Nct=Mct.toString;o(yxe,"toSource");S(yxe,"toSource");K0=yxe,Ict=/[\\^$.*+?()[\]{}|]/g,Oct=/^\[object .+?Constructor\]$/,Pct=Function.prototype,Bct=Object.prototype,Fct=Pct.toString,$ct=Bct.hasOwnProperty,zct=RegExp("^"+Fct.call($ct).replace(Ict,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");o(vxe,"baseIsNative");S(vxe,"baseIsNative");Gct=vxe;o(xxe,"getValue");S(xxe,"getValue");Vct=xxe;o(bxe,"getNative");S(bxe,"getNative");Z0=bxe,Wct=Z0(tu,"WeakMap"),gF=Wct,w1e=Object.create,qct=(function(){function e(){}return o(e,"object"),S(e,"object"),function(t){if(!tl(t))return{};if(w1e)return w1e(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),Uct=qct;o(Txe,"apply");S(Txe,"apply");Hct=Txe;o(Cxe,"noop");S(Cxe,"noop");Un=Cxe;o(kxe,"copyArray");S(kxe,"copyArray");Yct=kxe,jct=800,Xct=16,Kct=Date.now;o(wxe,"shortOut");S(wxe,"shortOut");Zct=wxe;o(Sxe,"constant");S(Sxe,"constant");Qct=Sxe,Jct=(function(){try{var e=Z0(Object,"defineProperty");return e({},"",{}),e}catch{}})(),C5=Jct,eut=C5?function(e,t){return C5(e,"toString",{configurable:!0,enumerable:!1,value:Qct(t),writable:!0})}:J1,tut=eut,rut=Zct(tut),iut=rut;o(Exe,"arrayEach");S(Exe,"arrayEach");Axe=Exe;o(_xe,"baseFindIndex");S(_xe,"baseFindIndex");Dxe=_xe;o(Rxe,"baseIsNaN");S(Rxe,"baseIsNaN");nut=Rxe;o(Lxe,"strictIndexOf");S(Lxe,"strictIndexOf");aut=Lxe;o(Mxe,"baseIndexOf");S(Mxe,"baseIndexOf");fz=Mxe;o(Nxe,"arrayIncludes");S(Nxe,"arrayIncludes");Ixe=Nxe,sut=9007199254740991,out=/^(?:0|[1-9]\d*)$/;o(Oxe,"isIndex");S(Oxe,"isIndex");cA=Oxe;o(Pxe,"baseAssignValue");S(Pxe,"baseAssignValue");pz=Pxe;o(Bxe,"eq");S(Bxe,"eq");DT=Bxe,lut=Object.prototype,cut=lut.hasOwnProperty;o(Fxe,"assignValue");S(Fxe,"assignValue");uA=Fxe;o($xe,"copyObject");S($xe,"copyObject");RT=$xe,S1e=Math.max;o(zxe,"overRest");S(zxe,"overRest");uut=zxe;o(Gxe,"baseRest");S(Gxe,"baseRest");mz=Gxe,hut=9007199254740991;o(Vxe,"isLength");S(Vxe,"isLength");gz=Vxe;o(Wxe,"isArrayLike");S(Wxe,"isArrayLike");ru=Wxe;o(qxe,"isIterateeCall");S(qxe,"isIterateeCall");hA=qxe;o(Uxe,"createAssigner");S(Uxe,"createAssigner");dut=Uxe,fut=Object.prototype;o(Hxe,"isPrototype");S(Hxe,"isPrototype");LT=Hxe;o(Yxe,"baseTimes");S(Yxe,"baseTimes");put=Yxe,mut="[object Arguments]";o(jxe,"baseIsArguments");S(jxe,"baseIsArguments");E1e=jxe,Xxe=Object.prototype,gut=Xxe.hasOwnProperty,yut=Xxe.propertyIsEnumerable,vut=E1e((function(){return arguments})())?E1e:function(e){return Yl(e)&&gut.call(e,"callee")&&!yut.call(e,"callee")},dA=vut;o(Kxe,"stubFalse");S(Kxe,"stubFalse");xut=Kxe,Zxe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,A1e=Zxe&&typeof module=="object"&&module&&!module.nodeType&&module,but=A1e&&A1e.exports===Zxe,_1e=but?tu.Buffer:void 0,Tut=_1e?_1e.isBuffer:void 0,Cut=Tut||xut,aT=Cut,kut="[object Arguments]",wut="[object Array]",Sut="[object Boolean]",Eut="[object Date]",Aut="[object Error]",_ut="[object Function]",Dut="[object Map]",Rut="[object Number]",Lut="[object Object]",Mut="[object RegExp]",Nut="[object Set]",Iut="[object String]",Out="[object WeakMap]",Put="[object ArrayBuffer]",But="[object DataView]",Fut="[object Float32Array]",$ut="[object Float64Array]",zut="[object Int8Array]",Gut="[object Int16Array]",Vut="[object Int32Array]",Wut="[object Uint8Array]",qut="[object Uint8ClampedArray]",Uut="[object Uint16Array]",Hut="[object Uint32Array]",Gi={};Gi[Fut]=Gi[$ut]=Gi[zut]=Gi[Gut]=Gi[Vut]=Gi[Wut]=Gi[qut]=Gi[Uut]=Gi[Hut]=!0;Gi[kut]=Gi[wut]=Gi[Put]=Gi[Sut]=Gi[But]=Gi[Eut]=Gi[Aut]=Gi[_ut]=Gi[Dut]=Gi[Rut]=Gi[Lut]=Gi[Mut]=Gi[Nut]=Gi[Iut]=Gi[Out]=!1;o(Qxe,"baseIsTypedArray");S(Qxe,"baseIsTypedArray");Yut=Qxe;o(Jxe,"baseUnary");S(Jxe,"baseUnary");MT=Jxe,ebe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Y2=ebe&&typeof module=="object"&&module&&!module.nodeType&&module,jut=Y2&&Y2.exports===ebe,jP=jut&&exe.process,Xut=(function(){try{var e=Y2&&Y2.require&&Y2.require("util").types;return e||jP&&jP.binding&&jP.binding("util")}catch{}})(),mf=Xut,D1e=mf&&mf.isTypedArray,Kut=D1e?MT(D1e):Yut,yz=Kut,Zut=Object.prototype,Qut=Zut.hasOwnProperty;o(tbe,"arrayLikeKeys");S(tbe,"arrayLikeKeys");rbe=tbe;o(ibe,"overArg");S(ibe,"overArg");nbe=ibe,Jut=nbe(Object.keys,Object),eht=Jut,tht=Object.prototype,rht=tht.hasOwnProperty;o(abe,"baseKeys");S(abe,"baseKeys");sbe=abe;o(obe,"keys");S(obe,"keys");po=obe,iht=Object.prototype,nht=iht.hasOwnProperty,aht=dut(function(e,t){if(LT(t)||ru(t)){RT(t,po(t),e);return}for(var r in t)nht.call(t,r)&&uA(e,r,t[r])}),mo=aht;o(lbe,"nativeKeysIn");S(lbe,"nativeKeysIn");sht=lbe,oht=Object.prototype,lht=oht.hasOwnProperty;o(cbe,"baseKeysIn");S(cbe,"baseKeysIn");cht=cbe;o(ube,"keysIn");S(ube,"keysIn");fA=ube,uht=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hht=/^\w*$/;o(hbe,"isKey");S(hbe,"isKey");vz=hbe,dht=Z0(Object,"create"),sT=dht;o(dbe,"hashClear");S(dbe,"hashClear");fht=dbe;o(fbe,"hashDelete");S(fbe,"hashDelete");pht=fbe,mht="__lodash_hash_undefined__",ght=Object.prototype,yht=ght.hasOwnProperty;o(pbe,"hashGet");S(pbe,"hashGet");vht=pbe,xht=Object.prototype,bht=xht.hasOwnProperty;o(mbe,"hashHas");S(mbe,"hashHas");Tht=mbe,Cht="__lodash_hash_undefined__";o(gbe,"hashSet");S(gbe,"hashSet");kht=gbe;o(Q0,"Hash");S(Q0,"Hash");Q0.prototype.clear=fht;Q0.prototype.delete=pht;Q0.prototype.get=vht;Q0.prototype.has=Tht;Q0.prototype.set=kht;R1e=Q0;o(ybe,"listCacheClear");S(ybe,"listCacheClear");wht=ybe;o(vbe,"assocIndexOf");S(vbe,"assocIndexOf");pA=vbe,Sht=Array.prototype,Eht=Sht.splice;o(xbe,"listCacheDelete");S(xbe,"listCacheDelete");Aht=xbe;o(bbe,"listCacheGet");S(bbe,"listCacheGet");_ht=bbe;o(Tbe,"listCacheHas");S(Tbe,"listCacheHas");Dht=Tbe;o(Cbe,"listCacheSet");S(Cbe,"listCacheSet");Rht=Cbe;o(J0,"ListCache");S(J0,"ListCache");J0.prototype.clear=wht;J0.prototype.delete=Aht;J0.prototype.get=_ht;J0.prototype.has=Dht;J0.prototype.set=Rht;mA=J0,Lht=Z0(tu,"Map"),oT=Lht;o(kbe,"mapCacheClear");S(kbe,"mapCacheClear");Mht=kbe;o(wbe,"isKeyable");S(wbe,"isKeyable");Nht=wbe;o(Sbe,"getMapData");S(Sbe,"getMapData");gA=Sbe;o(Ebe,"mapCacheDelete");S(Ebe,"mapCacheDelete");Iht=Ebe;o(Abe,"mapCacheGet");S(Abe,"mapCacheGet");Oht=Abe;o(_be,"mapCacheHas");S(_be,"mapCacheHas");Pht=_be;o(Dbe,"mapCacheSet");S(Dbe,"mapCacheSet");Bht=Dbe;o(em,"MapCache");S(em,"MapCache");em.prototype.clear=Mht;em.prototype.delete=Iht;em.prototype.get=Oht;em.prototype.has=Pht;em.prototype.set=Bht;yA=em,Fht="Expected a function";o(vA,"memoize");S(vA,"memoize");vA.Cache=yA;$ht=vA,zht=500;o(Rbe,"memoizeCapped");S(Rbe,"memoizeCapped");Ght=Rbe,Vht=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wht=/\\(\\)?/g,qht=Ght(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Vht,function(r,i,n,a){t.push(n?a.replace(Wht,"$1"):i||r)}),t}),Uht=qht;o(Lbe,"toString2");S(Lbe,"toString");Hht=Lbe;o(Mbe,"castPath");S(Mbe,"castPath");xA=Mbe,Yht=1/0;o(Nbe,"toKey");S(Nbe,"toKey");NT=Nbe;o(Ibe,"baseGet");S(Ibe,"baseGet");xz=Ibe;o(Obe,"get");S(Obe,"get");jht=Obe;o(Pbe,"arrayPush");S(Pbe,"arrayPush");bz=Pbe,L1e=el?el.isConcatSpreadable:void 0;o(Bbe,"isFlattenable");S(Bbe,"isFlattenable");Xht=Bbe;o(Tz,"baseFlatten");S(Tz,"baseFlatten");Cz=Tz;o(Fbe,"flatten");S(Fbe,"flatten");Ul=Fbe,Kht=nbe(Object.getPrototypeOf,Object),$be=Kht;o(zbe,"baseSlice");S(zbe,"baseSlice");Gbe=zbe;o(Vbe,"arrayReduce");S(Vbe,"arrayReduce");Zht=Vbe;o(Wbe,"stackClear");S(Wbe,"stackClear");Qht=Wbe;o(qbe,"stackDelete");S(qbe,"stackDelete");Jht=qbe;o(Ube,"stackGet");S(Ube,"stackGet");edt=Ube;o(Hbe,"stackHas");S(Hbe,"stackHas");tdt=Hbe,rdt=200;o(Ybe,"stackSet");S(Ybe,"stackSet");idt=Ybe;o(tm,"Stack");S(tm,"Stack");tm.prototype.clear=Qht;tm.prototype.delete=Jht;tm.prototype.get=edt;tm.prototype.has=tdt;tm.prototype.set=idt;j2=tm;o(jbe,"baseAssign");S(jbe,"baseAssign");ndt=jbe;o(Xbe,"baseAssignIn");S(Xbe,"baseAssignIn");adt=Xbe,Kbe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,M1e=Kbe&&typeof module=="object"&&module&&!module.nodeType&&module,sdt=M1e&&M1e.exports===Kbe,N1e=sdt?tu.Buffer:void 0,I1e=N1e?N1e.allocUnsafe:void 0;o(Zbe,"cloneBuffer");S(Zbe,"cloneBuffer");odt=Zbe;o(Qbe,"arrayFilter");S(Qbe,"arrayFilter");kz=Qbe;o(Jbe,"stubArray");S(Jbe,"stubArray");e2e=Jbe,ldt=Object.prototype,cdt=ldt.propertyIsEnumerable,O1e=Object.getOwnPropertySymbols,udt=O1e?function(e){return e==null?[]:(e=Object(e),kz(O1e(e),function(t){return cdt.call(e,t)}))}:e2e,wz=udt;o(t2e,"copySymbols");S(t2e,"copySymbols");hdt=t2e,ddt=Object.getOwnPropertySymbols,fdt=ddt?function(e){for(var t=[];e;)bz(t,wz(e)),e=$be(e);return t}:e2e,r2e=fdt;o(i2e,"copySymbolsIn");S(i2e,"copySymbolsIn");pdt=i2e;o(n2e,"baseGetAllKeys");S(n2e,"baseGetAllKeys");a2e=n2e;o(s2e,"getAllKeys");S(s2e,"getAllKeys");yF=s2e;o(o2e,"getAllKeysIn");S(o2e,"getAllKeysIn");l2e=o2e,mdt=Z0(tu,"DataView"),vF=mdt,gdt=Z0(tu,"Promise"),xF=gdt,ydt=Z0(tu,"Set"),W1=ydt,P1e="[object Map]",vdt="[object Object]",B1e="[object Promise]",F1e="[object Set]",$1e="[object WeakMap]",z1e="[object DataView]",xdt=K0(vF),bdt=K0(oT),Tdt=K0(xF),Cdt=K0(W1),kdt=K0(gF),h0=Tf;(vF&&h0(new vF(new ArrayBuffer(1)))!=z1e||oT&&h0(new oT)!=P1e||xF&&h0(xF.resolve())!=B1e||W1&&h0(new W1)!=F1e||gF&&h0(new gF)!=$1e)&&(h0=S(function(e){var t=Tf(e),r=t==vdt?e.constructor:void 0,i=r?K0(r):"";if(i)switch(i){case xdt:return z1e;case bdt:return P1e;case Tdt:return B1e;case Cdt:return F1e;case kdt:return $1e}return t},"getTag"));ey=h0,wdt=Object.prototype,Sdt=wdt.hasOwnProperty;o(c2e,"initCloneArray");S(c2e,"initCloneArray");Edt=c2e,Adt=tu.Uint8Array,k5=Adt;o(u2e,"cloneArrayBuffer");S(u2e,"cloneArrayBuffer");Sz=u2e;o(h2e,"cloneDataView");S(h2e,"cloneDataView");_dt=h2e,Ddt=/\w*$/;o(d2e,"cloneRegExp");S(d2e,"cloneRegExp");Rdt=d2e,G1e=el?el.prototype:void 0,V1e=G1e?G1e.valueOf:void 0;o(f2e,"cloneSymbol");S(f2e,"cloneSymbol");Ldt=f2e;o(p2e,"cloneTypedArray");S(p2e,"cloneTypedArray");Mdt=p2e,Ndt="[object Boolean]",Idt="[object Date]",Odt="[object Map]",Pdt="[object Number]",Bdt="[object RegExp]",Fdt="[object Set]",$dt="[object String]",zdt="[object Symbol]",Gdt="[object ArrayBuffer]",Vdt="[object DataView]",Wdt="[object Float32Array]",qdt="[object Float64Array]",Udt="[object Int8Array]",Hdt="[object Int16Array]",Ydt="[object Int32Array]",jdt="[object Uint8Array]",Xdt="[object Uint8ClampedArray]",Kdt="[object Uint16Array]",Zdt="[object Uint32Array]";o(m2e,"initCloneByTag");S(m2e,"initCloneByTag");Qdt=m2e;o(g2e,"initCloneObject");S(g2e,"initCloneObject");Jdt=g2e,eft="[object Map]";o(y2e,"baseIsMap");S(y2e,"baseIsMap");tft=y2e,W1e=mf&&mf.isMap,rft=W1e?MT(W1e):tft,ift=rft,nft="[object Set]";o(v2e,"baseIsSet");S(v2e,"baseIsSet");aft=v2e,q1e=mf&&mf.isSet,sft=q1e?MT(q1e):aft,oft=sft,lft=1,cft=2,uft=4,x2e="[object Arguments]",hft="[object Array]",dft="[object Boolean]",fft="[object Date]",pft="[object Error]",b2e="[object Function]",mft="[object GeneratorFunction]",gft="[object Map]",yft="[object Number]",T2e="[object Object]",vft="[object RegExp]",xft="[object Set]",bft="[object String]",Tft="[object Symbol]",Cft="[object WeakMap]",kft="[object ArrayBuffer]",wft="[object DataView]",Sft="[object Float32Array]",Eft="[object Float64Array]",Aft="[object Int8Array]",_ft="[object Int16Array]",Dft="[object Int32Array]",Rft="[object Uint8Array]",Lft="[object Uint8ClampedArray]",Mft="[object Uint16Array]",Nft="[object Uint32Array]",Ni={};Ni[x2e]=Ni[hft]=Ni[kft]=Ni[wft]=Ni[dft]=Ni[fft]=Ni[Sft]=Ni[Eft]=Ni[Aft]=Ni[_ft]=Ni[Dft]=Ni[gft]=Ni[yft]=Ni[T2e]=Ni[vft]=Ni[xft]=Ni[bft]=Ni[Tft]=Ni[Rft]=Ni[Lft]=Ni[Mft]=Ni[Nft]=!0;Ni[pft]=Ni[b2e]=Ni[Cft]=!1;o(X2,"baseClone");S(X2,"baseClone");Ift=X2,Oft=4;o(C2e,"clone");S(C2e,"clone");ka=C2e;o(k2e,"compact");S(k2e,"compact");IT=k2e,Pft="__lodash_hash_undefined__";o(w2e,"setCacheAdd");S(w2e,"setCacheAdd");Bft=w2e;o(S2e,"setCacheHas");S(S2e,"setCacheHas");Fft=S2e;o(lT,"SetCache");S(lT,"SetCache");lT.prototype.add=lT.prototype.push=Bft;lT.prototype.has=Fft;Ez=lT;o(E2e,"arraySome");S(E2e,"arraySome");A2e=E2e;o(_2e,"cacheHas");S(_2e,"cacheHas");Az=_2e,$ft=1,zft=2;o(D2e,"equalArrays");S(D2e,"equalArrays");R2e=D2e;o(L2e,"mapToArray");S(L2e,"mapToArray");Gft=L2e;o(M2e,"setToArray");S(M2e,"setToArray");_z=M2e,Vft=1,Wft=2,qft="[object Boolean]",Uft="[object Date]",Hft="[object Error]",Yft="[object Map]",jft="[object Number]",Xft="[object RegExp]",Kft="[object Set]",Zft="[object String]",Qft="[object Symbol]",Jft="[object ArrayBuffer]",ept="[object DataView]",U1e=el?el.prototype:void 0,XP=U1e?U1e.valueOf:void 0;o(N2e,"equalByTag");S(N2e,"equalByTag");tpt=N2e,rpt=1,ipt=Object.prototype,npt=ipt.hasOwnProperty;o(I2e,"equalObjects");S(I2e,"equalObjects");apt=I2e,spt=1,H1e="[object Arguments]",Y1e="[object Array]",gE="[object Object]",opt=Object.prototype,j1e=opt.hasOwnProperty;o(O2e,"baseIsEqualDeep");S(O2e,"baseIsEqualDeep");lpt=O2e;o(Dz,"baseIsEqual");S(Dz,"baseIsEqual");P2e=Dz,cpt=1,upt=2;o(B2e,"baseIsMatch");S(B2e,"baseIsMatch");hpt=B2e;o(F2e,"isStrictComparable");S(F2e,"isStrictComparable");$2e=F2e;o(z2e,"getMatchData");S(z2e,"getMatchData");dpt=z2e;o(G2e,"matchesStrictComparable");S(G2e,"matchesStrictComparable");V2e=G2e;o(W2e,"baseMatches");S(W2e,"baseMatches");fpt=W2e;o(q2e,"baseHasIn");S(q2e,"baseHasIn");ppt=q2e;o(U2e,"hasPath");S(U2e,"hasPath");H2e=U2e;o(Y2e,"hasIn");S(Y2e,"hasIn");mpt=Y2e,gpt=1,ypt=2;o(j2e,"baseMatchesProperty");S(j2e,"baseMatchesProperty");vpt=j2e;o(X2e,"baseProperty");S(X2e,"baseProperty");xpt=X2e;o(K2e,"basePropertyDeep");S(K2e,"basePropertyDeep");bpt=K2e;o(Z2e,"property");S(Z2e,"property");Tpt=Z2e;o(Q2e,"baseIteratee");S(Q2e,"baseIteratee");iu=Q2e;o(J2e,"arrayAggregator");S(J2e,"arrayAggregator");Cpt=J2e;o(eTe,"createBaseFor");S(eTe,"createBaseFor");kpt=eTe,wpt=kpt(),Spt=wpt;o(tTe,"baseForOwn");S(tTe,"baseForOwn");Ept=tTe;o(rTe,"createBaseEach");S(rTe,"createBaseEach");Apt=rTe,_pt=Apt(Ept),rm=_pt;o(iTe,"baseAggregator");S(iTe,"baseAggregator");Dpt=iTe;o(nTe,"createAggregator");S(nTe,"createAggregator");Rpt=nTe,aTe=Object.prototype,Lpt=aTe.hasOwnProperty,Mpt=mz(function(e,t){e=Object(e);var r=-1,i=t.length,n=i>2?t[2]:void 0;for(n&&hA(t[0],t[1],n)&&(i=1);++r{t.accept(e)})}},us=class extends nu{static{o(this,"NonTerminal")}static{S(this,"NonTerminal")}constructor(e){super([]),this.idx=1,mo(this,Xl(e,t=>t!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},oy=class extends nu{static{o(this,"Rule")}static{S(this,"Rule")}constructor(e){super(e.definition),this.orgText="",mo(this,Xl(e,t=>t!==void 0))}},Ws=class extends nu{static{o(this,"Alternative")}static{S(this,"Alternative")}constructor(e){super(e.definition),this.ignoreAmbiguities=!1,mo(this,Xl(e,t=>t!==void 0))}},Ca=class extends nu{static{o(this,"Option")}static{S(this,"Option")}constructor(e){super(e.definition),this.idx=1,mo(this,Xl(e,t=>t!==void 0))}},yo=class extends nu{static{o(this,"RepetitionMandatory")}static{S(this,"RepetitionMandatory")}constructor(e){super(e.definition),this.idx=1,mo(this,Xl(e,t=>t!==void 0))}},vo=class extends nu{static{o(this,"RepetitionMandatoryWithSeparator")}static{S(this,"RepetitionMandatoryWithSeparator")}constructor(e){super(e.definition),this.idx=1,mo(this,Xl(e,t=>t!==void 0))}},hn=class extends nu{static{o(this,"Repetition")}static{S(this,"Repetition")}constructor(e){super(e.definition),this.idx=1,mo(this,Xl(e,t=>t!==void 0))}},qs=class extends nu{static{o(this,"RepetitionWithSeparator")}static{S(this,"RepetitionWithSeparator")}constructor(e){super(e.definition),this.idx=1,mo(this,Xl(e,t=>t!==void 0))}},Us=class extends nu{static{o(this,"Alternation")}static{S(this,"Alternation")}get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,mo(this,Xl(e,t=>t!==void 0))}},Wi=class{static{o(this,"Terminal")}static{S(this,"Terminal")}constructor(e){this.idx=1,mo(this,Xl(e,t=>t!==void 0))}accept(e){e.visit(this)}};o(ZTe,"serializeGrammar");S(ZTe,"serializeGrammar");o(K2,"serializeProduction");S(K2,"serializeProduction");ly=class{static{o(this,"GAstVisitor")}static{S(this,"GAstVisitor")}visit(e){let t=e;switch(t.constructor){case us:return this.visitNonTerminal(t);case Ws:return this.visitAlternative(t);case Ca:return this.visitOption(t);case yo:return this.visitRepetitionMandatory(t);case vo:return this.visitRepetitionMandatoryWithSeparator(t);case qs:return this.visitRepetitionWithSeparator(t);case hn:return this.visitRepetition(t);case Us:return this.visitAlternation(t);case Wi:return this.visitTerminal(t);case oy:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};o(QTe,"isSequenceProd");S(QTe,"isSequenceProd");o(uT,"isOptionalProd");S(uT,"isOptionalProd");o(JTe,"isBranchingProd");S(JTe,"isBranchingProd");o(Gl,"getProductionDslName");S(Gl,"getProductionDslName");CA=class{static{o(this,"RestWalker")}static{S(this,"RestWalker")}walk(e,t=[]){vr(e.definition,(r,i)=>{let n=Ta(e.definition,i+1);if(r instanceof us)this.walkProdRef(r,n,t);else if(r instanceof Wi)this.walkTerminal(r,n,t);else if(r instanceof Ws)this.walkFlat(r,n,t);else if(r instanceof Ca)this.walkOption(r,n,t);else if(r instanceof yo)this.walkAtLeastOne(r,n,t);else if(r instanceof vo)this.walkAtLeastOneSep(r,n,t);else if(r instanceof qs)this.walkManySep(r,n,t);else if(r instanceof hn)this.walkMany(r,n,t);else if(r instanceof Us)this.walkOr(r,n,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,r){}walkProdRef(e,t,r){}walkFlat(e,t,r){let i=t.concat(r);this.walk(e,i)}walkOption(e,t,r){let i=t.concat(r);this.walk(e,i)}walkAtLeastOne(e,t,r){let i=[new Ca({definition:e.definition})].concat(t,r);this.walk(e,i)}walkAtLeastOneSep(e,t,r){let i=bF(e,t,r);this.walk(e,i)}walkMany(e,t,r){let i=[new Ca({definition:e.definition})].concat(t,r);this.walk(e,i)}walkManySep(e,t,r){let i=bF(e,t,r);this.walk(e,i)}walkOr(e,t,r){let i=t.concat(r);vr(e.definition,n=>{let a=new Ws({definition:[n]});this.walk(a,i)})}};o(bF,"restForRepetitionWithSeparator");S(bF,"restForRepetitionWithSeparator");o(cy,"first");S(cy,"first");o(eCe,"firstForSequence");S(eCe,"firstForSequence");o(tCe,"firstForBranching");S(tCe,"firstForBranching");o(rCe,"firstForTerminal");S(rCe,"firstForTerminal");iCe="_~IN~_",x0t=class extends CA{static{o(this,"ResyncFollowsWalker")}static{S(this,"ResyncFollowsWalker")}constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,r){}walkProdRef(e,t,r){let i=aCe(e.referencedRule,e.idx)+this.topProd.name,n=t.concat(r),a=new Ws({definition:n}),s=cy(a);this.follows[i]=s}};o(nCe,"computeAllProdsFollows");S(nCe,"computeAllProdsFollows");o(aCe,"buildBetweenProdsFollowPrefix");S(aCe,"buildBetweenProdsFollowPrefix");WE={},b0t=new Bve;o(OT,"getRegExpAst");S(OT,"getRegExpAst");o(sCe,"clearRegExpParserCache");S(sCe,"clearRegExpParserCache");oCe="Complement Sets are not supported for first char optimization",S5=`Unable to use "first char" lexer optimizations: +`;o(lCe,"getOptimizedStartCodesIndices");S(lCe,"getOptimizedStartCodesIndices");o(E5,"firstCharOptimizedIndices");S(E5,"firstCharOptimizedIndices");o(O2,"addOptimizedIdxToResult");S(O2,"addOptimizedIdxToResult");o(cCe,"handleIgnoreCase");S(cCe,"handleIgnoreCase");o(TF,"findCode");S(TF,"findCode");o(A5,"isWholeOptional");S(A5,"isWholeOptional");T0t=class extends tA{static{o(this,"CharCodeFinder")}static{S(this,"CharCodeFinder")}constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){fs(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?TF(e,this.targetCharCodes)===void 0&&(this.found=!0):TF(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};o(kA,"canMatchCharCode");S(kA,"canMatchCharCode");G0="PATTERN",P2="defaultMode",yE="modes",uCe=typeof new RegExp("(?:)").sticky=="boolean";o(hCe,"analyzeTokenTypes");S(hCe,"analyzeTokenTypes");o(dCe,"validatePatterns");S(dCe,"validatePatterns");o(fCe,"validateRegExpPattern");S(fCe,"validateRegExpPattern");o(pCe,"findMissingPatterns");S(pCe,"findMissingPatterns");o(mCe,"findInvalidPatterns");S(mCe,"findInvalidPatterns");C0t=/[^\\][$]/;o(gCe,"findEndOfInputAnchor");S(gCe,"findEndOfInputAnchor");o(yCe,"findEmptyMatchRegExps");S(yCe,"findEmptyMatchRegExps");k0t=/[^\\[][\^]|^\^/;o(vCe,"findStartOfInputAnchor");S(vCe,"findStartOfInputAnchor");o(xCe,"findUnsupportedFlags");S(xCe,"findUnsupportedFlags");o(bCe,"findDuplicatePatterns");S(bCe,"findDuplicatePatterns");o(TCe,"findInvalidGroupType");S(TCe,"findInvalidGroupType");o(CCe,"findModesThatDoNotExist");S(CCe,"findModesThatDoNotExist");o(kCe,"findUnreachablePatterns");S(kCe,"findUnreachablePatterns");o(wCe,"tryToMatchStrToPattern");S(wCe,"tryToMatchStrToPattern");o(SCe,"noMetaChar");S(SCe,"noMetaChar");o(ECe,"usesLookAheadOrBehind");S(ECe,"usesLookAheadOrBehind");o(CF,"addStartOfInput");S(CF,"addStartOfInput");o(kF,"addStickyFlag");S(kF,"addStickyFlag");o(ACe,"performRuntimeChecks");S(ACe,"performRuntimeChecks");o(_Ce,"performWarningRuntimeChecks");S(_Ce,"performWarningRuntimeChecks");o(DCe,"cloneEmptyGroups");S(DCe,"cloneEmptyGroups");o(Oz,"isCustomPattern");S(Oz,"isCustomPattern");o(RCe,"isShortPattern");S(RCe,"isShortPattern");w0t={test:S(function(e){let t=e.length;for(let r=this.lastIndex;r${e.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(e,t,r,i,n,a){return`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${r} characters.`}};(function(e){e[e.MISSING_PATTERN=0]="MISSING_PATTERN",e[e.INVALID_PATTERN=1]="INVALID_PATTERN",e[e.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",e[e.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",e[e.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",e[e.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",e[e.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",e[e.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",e[e.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",e[e.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",e[e.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",e[e.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",e[e.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(dn||(dn={}));F2={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` +`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:SF,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(F2);ls=class{static{o(this,"Lexer")}static{S(this,"Lexer")}constructor(e,t=F2){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,n)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${i}>`);let{time:s,value:l}=Nz(n),u=s>10?console.warn:console.log;return this.traceInitIndent time: ${s}ms`),this.traceInitIndent--,l}else return n()},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object. +a boolean 2nd argument is no longer supported`);this.config=mo({},F2,t);let r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,n=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===F2.lineTerminatorsPattern)this.config.lineTerminatorsPattern=w0t;else if(this.config.lineTerminatorCharacters===F2.lineTerminatorCharacters)throw Error(`Error: Missing property on the Lexer config. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Kr(e)?i={modes:{defaultMode:ka(e)},defaultMode:P2}:(n=!1,i=ka(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(ACe(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(_Ce(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},vr(i.modes,(s,l)=>{i.modes[l]=TA(s,u=>dh(u))});let a=po(i.modes);if(vr(i.modes,(s,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(dCe(s,a))}),Oi(this.lexerDefinitionErrors)){hy(s);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=hCe(s,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=u.charCodeToPatternIdxToConfig,this.emptyGroups=mo({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!Oi(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let l=nr(this.lexerDefinitionErrors,u=>u.message).join(`----------------------- +`);throw new Error(`Errors detected in definition of Lexer: +`+l)}vr(this.lexerDefinitionWarning,s=>{Mz(s.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(uCe?(this.chopInput=J1,this.match=this.matchWithTest):(this.updateLastIndex=Un,this.match=this.matchWithExec),n&&(this.handleModes=Un),this.trackStartLines===!1&&(this.computeNewColumn=J1),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Un),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let s=go(this.canModeBeOptimized,(l,u,h)=>(u===!1&&l.push(h),l),[]);if(t.ensureOptimizations&&!Oi(s))throw Error(`Lexer Modes: < ${s.join(", ")} > cannot be optimized. + Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. + Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{sCe()}),this.TRACE_INIT("toFastProperties",()=>{Iz(this)})})}tokenize(e,t=this.defaultMode){if(!Oi(this.lexerDefinitionErrors)){let i=nr(this.lexerDefinitionErrors,n=>n.message).join(`----------------------- +`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer: +`+i)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let r,i,n,a,s,l,u,h,d,f,p,m,g,y,v,x,b=e,T=b.length,w=0,C=0,k=this.hasCustom?0:Math.floor(e.length/10),E=new Array(k),A=[],N=this.trackStartLines?1:void 0,P=this.trackStartLines?1:void 0,I=DCe(this.emptyGroups),D=this.trackStartLines,_=this.config.lineTerminatorsPattern,R=0,M=[],L=[],B=[],O=[];Object.freeze(O);let $;function G(){return M}o(G,"getPossiblePatternsSlow"),S(G,"getPossiblePatternsSlow");function F(Q){let Y=fh(Q),ae=L[Y];return ae===void 0?O:ae}o(F,"getPossiblePatternsOptimized"),S(F,"getPossiblePatternsOptimized");let V=S(Q=>{if(B.length===1&&Q.tokenType.PUSH_MODE===void 0){let Y=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(Q);A.push({offset:Q.startOffset,line:Q.startLine,column:Q.startColumn,length:Q.image.length,message:Y})}else{B.pop();let Y=z0(B);M=this.patternIdxToConfig[Y],L=this.charCodeToPatternIdxToConfig[Y],R=M.length;let ae=this.canModeBeOptimized[Y]&&this.config.safeMode===!1;L&&ae?$=F:$=G}},"pop_mode");function H(Q){B.push(Q),L=this.charCodeToPatternIdxToConfig[Q],M=this.patternIdxToConfig[Q],R=M.length,R=M.length;let Y=this.canModeBeOptimized[Q]&&this.config.safeMode===!1;L&&Y?$=F:$=G}o(H,"push_mode"),S(H,"push_mode"),H.call(this,t);let j,U=this.config.recoveryEnabled;for(;wl.length){l=a,u=h,j=ee;break}}}break}}if(l!==null){if(d=l.length,f=j.group,f!==void 0&&(p=j.tokenTypeIdx,m=this.createTokenInstance(l,w,p,j.tokenType,N,P,d),this.handlePayload(m,u),f===!1?C=this.addToken(E,C,m):I[f].push(m)),e=this.chopInput(e,d),w=w+d,P=this.computeNewColumn(P,d),D===!0&&j.canLineTerminator===!0){let J=0,te,re;_.lastIndex=0;do te=_.test(l),te===!0&&(re=_.lastIndex-1,J++);while(te===!0);J!==0&&(N=N+J,P=d-re,this.updateTokenEndLineColumnLocation(m,f,re,J,N,P,d))}this.handleModes(j,V,H,m)}else{let J=w,te=N,re=P,ee=U===!1;for(;ee===!1&&w ${B0(e)} <--`:`token of type --> ${e.name} <--`} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:e,ruleName:t}){return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:r,customUserDescription:i,ruleName:n}){let a="Expecting: ",l=` +but found: '`+jl(t).image+"'";if(i)return a+i+l;{let u=go(e,(p,m)=>p.concat(m),[]),h=nr(u,p=>`[${nr(p,m=>B0(m)).join(", ")}]`),f=`one of these possible Token sequences: +${nr(h,(p,m)=>` ${m+1}. ${p}`).join(` +`)}`;return a+f+l}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:r,ruleName:i}){let n="Expecting: ",s=` +but found: '`+jl(t).image+"'";if(r)return n+r+s;{let u=`expecting at least one iteration which starts with one of these possible Token sequences:: + <${nr(e,h=>`[${nr(h,d=>B0(d)).join(",")}]`).join(" ,")}>`;return n+u+s}}};Object.freeze(z1);E0t={buildRuleNotFoundError(e,t){return"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+`<- +inside top level rule: ->`+e.name+"<-"}},I0={buildDuplicateFoundError(e,t){function r(d){return d instanceof Wi?d.terminalType.name:d instanceof us?d.nonTerminalName:""}o(r,"getExtraProductionArgument2"),S(r,"getExtraProductionArgument");let i=e.name,n=jl(t),a=n.idx,s=Gl(n),l=r(n),u=a>0,h=`->${s}${u?a:""}<- ${l?`with argument: ->${l}<-`:""} + appears more than once (${t.length} times) in the top level rule: ->${i}<-. + For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES + `;return h=h.replace(/[ \t]+/g," "),h=h.replace(/\s\s+/g,` +`),h},buildNamespaceConflictError(e){return`Namespace conflict found in grammar. +The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>. +To resolve this make sure each Terminal and Non-Terminal names are unique +This is easy to accomplish by using the convention that Terminal names start with an uppercase letter +and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(e){let t=nr(e.prefixPath,n=>B0(n)).join(", "),r=e.alternation.idx===0?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix +in inside <${e.topLevelRule.name}> Rule, +<${t}> may appears as a prefix path in all these alternatives. +See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX +For Further details.`},buildAlternationAmbiguityError(e){let t=nr(e.prefixPath,n=>B0(n)).join(", "),r=e.alternation.idx===0?"":e.alternation.idx,i=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in inside <${e.topLevelRule.name}> Rule, +<${t}> may appears as a prefix path in all these alternatives. +`;return i=i+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES +For Further details.`,i},buildEmptyRepetitionError(e){let t=Gl(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens. +This could lead to an infinite loop.`},buildTokenNameError(e){return"deprecated"},buildEmptyAlternationError(e){return`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in inside <${e.topLevelRule.name}> Rule. +Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(e){return`An Alternation cannot have more than 256 alternatives: + inside <${e.topLevelRule.name}> Rule. + has ${e.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(e){let t=e.topLevelRule.name,r=nr(e.leftRecursionPath,a=>a.name),i=`${t} --> ${r.concat([t]).join(" --> ")}`;return`Left Recursion found in grammar. +rule: <${t}> can be invoked from itself (directly or indirectly) +without consuming any Tokens. The grammar path that causes this is: + ${i} + To fix this refactor your grammar to remove the left recursion. +see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(e){return"deprecated"},buildDuplicateRuleNameError(e){let t;return e.topLevelRule instanceof oy?t=e.topLevelRule.name:t=e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};o(VCe,"resolveGrammar");S(VCe,"resolveGrammar");A0t=class extends ly{static{o(this,"GastRefResolverVisitor")}static{S(this,"GastRefResolverVisitor")}constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){vr(Hn(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:hs.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},_0t=class extends CA{static{o(this,"AbstractNextPossibleTokensWalker")}static{S(this,"AbstractNextPossibleTokensWalker")}constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=ka(this.path.ruleStack).reverse(),this.occurrenceStack=ka(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=t.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){Oi(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},D0t=class extends _0t{static{o(this,"NextAfterTokenWalker")}static{S(this,"NextAfterTokenWalker")}constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=t.concat(r),n=new Ws({definition:i});this.possibleTokTypes=cy(n),this.found=!0}}},wA=class extends CA{static{o(this,"AbstractNextTerminalAfterProductionWalker")}static{S(this,"AbstractNextTerminalAfterProductionWalker")}constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},R0t=class extends wA{static{o(this,"NextTerminalAfterManyWalker")}static{S(this,"NextTerminalAfterManyWalker")}walkMany(e,t,r){if(e.idx===this.occurrence){let i=jl(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Wi&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,t,r)}},oye=class extends wA{static{o(this,"NextTerminalAfterManySepWalker")}static{S(this,"NextTerminalAfterManySepWalker")}walkManySep(e,t,r){if(e.idx===this.occurrence){let i=jl(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Wi&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,t,r)}},L0t=class extends wA{static{o(this,"NextTerminalAfterAtLeastOneWalker")}static{S(this,"NextTerminalAfterAtLeastOneWalker")}walkAtLeastOne(e,t,r){if(e.idx===this.occurrence){let i=jl(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Wi&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,t,r)}},lye=class extends wA{static{o(this,"NextTerminalAfterAtLeastOneSepWalker")}static{S(this,"NextTerminalAfterAtLeastOneSepWalker")}walkAtLeastOneSep(e,t,r){if(e.idx===this.occurrence){let i=jl(t.concat(r));this.result.isEndOfRule=i===void 0,i instanceof Wi&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,t,r)}};o(_5,"possiblePathsFrom");S(_5,"possiblePathsFrom");o(Vz,"nextPossibleTokensAfter");S(Vz,"nextPossibleTokensAfter");o(WCe,"expandTopLevelRule");S(WCe,"expandTopLevelRule");(function(e){e[e.OPTION=0]="OPTION",e[e.REPETITION=1]="REPETITION",e[e.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",e[e.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",e[e.ALTERNATION=5]="ALTERNATION"})(en||(en={}));o(SA,"getProdType");S(SA,"getProdType");o(EF,"getLookaheadPaths");S(EF,"getLookaheadPaths");o(qCe,"buildLookaheadFuncForOr");S(qCe,"buildLookaheadFuncForOr");o(UCe,"buildLookaheadFuncForOptionalProd");S(UCe,"buildLookaheadFuncForOptionalProd");o(HCe,"buildAlternativesLookAheadFunc");S(HCe,"buildAlternativesLookAheadFunc");o(YCe,"buildSingleAlternativeLookaheadFunction");S(YCe,"buildSingleAlternativeLookaheadFunction");M0t=class extends CA{static{o(this,"RestDefinitionFinderWalker")}static{S(this,"RestDefinitionFinderWalker")}constructor(e,t,r){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===t?(this.restDef=r.concat(i),!0):!1}walkOption(e,t,r){this.checkIsTarget(e,en.OPTION,t,r)||super.walkOption(e,t,r)}walkAtLeastOne(e,t,r){this.checkIsTarget(e,en.REPETITION_MANDATORY,t,r)||super.walkOption(e,t,r)}walkAtLeastOneSep(e,t,r){this.checkIsTarget(e,en.REPETITION_MANDATORY_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}walkMany(e,t,r){this.checkIsTarget(e,en.REPETITION,t,r)||super.walkOption(e,t,r)}walkManySep(e,t,r){this.checkIsTarget(e,en.REPETITION_WITH_SEPARATOR,t,r)||super.walkOption(e,t,r)}},jCe=class extends ly{static{o(this,"InsideDefinitionFinderVisitor")}static{S(this,"InsideDefinitionFinderVisitor")}constructor(e,t,r){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=r,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,en.OPTION)}visitRepetition(e){this.checkIsTarget(e,en.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,en.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,en.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,en.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,en.ALTERNATION)}};o(AF,"initializeArrayOfArrays");S(AF,"initializeArrayOfArrays");o(HE,"pathToHashKeys");S(HE,"pathToHashKeys");o(XCe,"isUniquePrefixHash");S(XCe,"isUniquePrefixHash");o(Wz,"lookAheadSequenceFromAlternatives");S(Wz,"lookAheadSequenceFromAlternatives");o(BT,"getLookaheadPathsForOr");S(BT,"getLookaheadPathsForOr");o(FT,"getLookaheadPathsForOptionalProd");S(FT,"getLookaheadPathsForOptionalProd");o(D5,"containsPath");S(D5,"containsPath");o(KCe,"isStrictPrefixOfPath");S(KCe,"isStrictPrefixOfPath");o(qz,"areTokenCategoriesNotUsed");S(qz,"areTokenCategoriesNotUsed");o(ZCe,"validateLookahead");S(ZCe,"validateLookahead");o(QCe,"validateGrammar");S(QCe,"validateGrammar");o(JCe,"validateDuplicateProductions");S(JCe,"validateDuplicateProductions");o(eke,"identifyProductionForDuplicates");S(eke,"identifyProductionForDuplicates");o(Uz,"getExtraProductionArgument");S(Uz,"getExtraProductionArgument");N0t=class extends ly{static{o(this,"OccurrenceValidationCollector")}static{S(this,"OccurrenceValidationCollector")}constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};o(tke,"validateRuleDoesNotAlreadyExist");S(tke,"validateRuleDoesNotAlreadyExist");o(rke,"validateRuleIsOverridden");S(rke,"validateRuleIsOverridden");o(Hz,"validateNoLeftRecursion");S(Hz,"validateNoLeftRecursion");o(Z2,"getFirstNoneTerminal");S(Z2,"getFirstNoneTerminal");Yz=class extends ly{static{o(this,"OrCollector")}static{S(this,"OrCollector")}constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};o(ike,"validateEmptyOrAlternative");S(ike,"validateEmptyOrAlternative");o(nke,"validateAmbiguousAlternationAlternatives");S(nke,"validateAmbiguousAlternationAlternatives");I0t=class extends ly{static{o(this,"RepetitionCollector")}static{S(this,"RepetitionCollector")}constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};o(ake,"validateTooManyAlts");S(ake,"validateTooManyAlts");o(ske,"validateSomeNonEmptyLookaheadPath");S(ske,"validateSomeNonEmptyLookaheadPath");o(oke,"checkAlternativesAmbiguities");S(oke,"checkAlternativesAmbiguities");o(lke,"checkPrefixAlternativesAmbiguities");S(lke,"checkPrefixAlternativesAmbiguities");o(cke,"checkTerminalAndNoneTerminalsNameSpace");S(cke,"checkTerminalAndNoneTerminalsNameSpace");o(uke,"resolveGrammar2");S(uke,"resolveGrammar");o(hke,"validateGrammar2");S(hke,"validateGrammar");dke="MismatchedTokenException",fke="NoViableAltException",pke="EarlyExitException",mke="NotAllInputParsedException",gke=[dke,fke,pke,mke];Object.freeze(gke);o(dT,"isRecognitionException");S(dT,"isRecognitionException");EA=class extends Error{static{o(this,"RecognitionException")}static{S(this,"RecognitionException")}constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},yke=class extends EA{static{o(this,"MismatchedTokenException")}static{S(this,"MismatchedTokenException")}constructor(e,t,r){super(e,t),this.previousToken=r,this.name=dke}},O0t=class extends EA{static{o(this,"NoViableAltException")}static{S(this,"NoViableAltException")}constructor(e,t,r){super(e,t),this.previousToken=r,this.name=fke}},P0t=class extends EA{static{o(this,"NotAllInputParsedException")}static{S(this,"NotAllInputParsedException")}constructor(e,t){super(e,t),this.name=mke}},B0t=class extends EA{static{o(this,"EarlyExitException")}static{S(this,"EarlyExitException")}constructor(e,t,r){super(e,t),this.previousToken=r,this.name=pke}},KP={},vke="InRuleRecoveryException",F0t=class extends Error{static{o(this,"InRuleRecoveryException")}static{S(this,"InRuleRecoveryException")}constructor(e){super(e),this.name=vke}},$0t=class{static{o(this,"Recoverable")}static{S(this,"Recoverable")}initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=mr(e,"recoveryEnabled")?e.recoveryEnabled:ph.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=xke)}getTokenToInsert(e){let t=PT(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,r,i){let n=this.findReSyncTokenType(),a=this.exportLexerState(),s=[],l=!1,u=this.LA(1),h=this.LA(1),d=S(()=>{let f=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:f,ruleName:this.getCurrRuleFullName()}),m=new yke(p,u,this.LA(0));m.resyncedTokens=cT(s),this.SAVE_ERROR(m)},"generateErrorMessage");for(;!l;)if(this.tokenMatcher(h,i)){d();return}else if(r.call(this)){d(),e.apply(this,t);return}else this.tokenMatcher(h,n)?l=!0:(h=this.SKIP_TOKEN(),this.addToResyncTokens(h,s));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){let r=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new F0t("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||Oi(t))return!1;let r=this.LA(1);return ty(t,n=>this.tokenMatcher(r,n))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(t);return fs(r,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA(1),r=2;for(;;){let i=ty(e,n=>Gz(t,n));if(i!==void 0)return i;t=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return KP;let e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return nr(e,(r,i)=>i===0?KP:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:t[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=nr(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t));return Ul(e)}getFollowSetFromFollowKey(e){if(e===KP)return[gf];let t=e.ruleName+e.idxInCallingRule+iCe+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,gf)||t.push(e),t}reSyncTo(e){let t=[],r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,t);return cT(t)}attemptInRepetitionRecovery(e,t,r,i,n,a,s){}getCurrentGrammarPath(e,t){let r=this.getHumanReadableRuleStack(),i=ka(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return nr(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};o(xke,"attemptInRepetitionRecovery");S(xke,"attemptInRepetitionRecovery");z0t=4,Cf=8,G0t=8,bke=1<Hz(t,t,I0))}validateEmptyOrAlternatives(e){return Jo(e,t=>ike(t,I0))}validateAmbiguousAlternationAlternatives(e,t){return Jo(e,r=>nke(r,t,I0))}validateSomeNonEmptyLookaheadPath(e,t){return ske(e,t,I0)}buildLookaheadForAlternation(e){return qCe(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,HCe)}buildLookaheadForOptional(e){return UCe(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,SA(e.prodType),YCe)}},V0t=class{static{o(this,"LooksAhead")}static{S(this,"LooksAhead")}initLooksAhead(e){this.dynamicTokensEnabled=mr(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ph.dynamicTokensEnabled,this.maxLookahead=mr(e,"maxLookahead")?e.maxLookahead:ph.maxLookahead,this.lookaheadStrategy=mr(e,"lookaheadStrategy")?e.lookaheadStrategy:new jz({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){vr(e,t=>{this.TRACE_INIT(`${t.name} Rule Lookahead`,()=>{let{alternation:r,repetition:i,option:n,repetitionMandatory:a,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:l}=Cke(t);vr(r,u=>{let h=u.idx===0?"":u.idx;this.TRACE_INIT(`${Gl(u)}${h}`,()=>{let d=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:t,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=jE(this.fullRuleNameToShort[t.name],bke,u.idx);this.setLaFuncCache(f,d)})}),vr(i,u=>{this.computeLookaheadFunc(t,u.idx,_F,"Repetition",u.maxLookahead,Gl(u))}),vr(n,u=>{this.computeLookaheadFunc(t,u.idx,Tke,"Option",u.maxLookahead,Gl(u))}),vr(a,u=>{this.computeLookaheadFunc(t,u.idx,DF,"RepetitionMandatory",u.maxLookahead,Gl(u))}),vr(s,u=>{this.computeLookaheadFunc(t,u.idx,YE,"RepetitionMandatoryWithSeparator",u.maxLookahead,Gl(u))}),vr(l,u=>{this.computeLookaheadFunc(t,u.idx,RF,"RepetitionWithSeparator",u.maxLookahead,Gl(u))})})})}computeLookaheadFunc(e,t,r,i,n,a){this.TRACE_INIT(`${a}${t===0?"":t}`,()=>{let s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:n||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),l=jE(this.fullRuleNameToShort[e.name],r,t);this.setLaFuncCache(l,s)})}getKeyForAutomaticLookahead(e,t){let r=this.getLastExplicitRuleShortName();return jE(r,e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}},W0t=class extends ly{static{o(this,"DslMethodsCollectorVisitor")}static{S(this,"DslMethodsCollectorVisitor")}constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},vE=new W0t;o(Cke,"collectMethods");S(Cke,"collectMethods");o(LF,"setNodeLocationOnlyOffset");S(LF,"setNodeLocationOnlyOffset");o(MF,"setNodeLocationFull");S(MF,"setNodeLocationFull");o(kke,"addTerminalToCst");S(kke,"addTerminalToCst");o(wke,"addNoneTerminalToCst");S(wke,"addNoneTerminalToCst");q0t="name";o(Xz,"defineNameProp");S(Xz,"defineNameProp");o(Ske,"defaultVisit");S(Ske,"defaultVisit");o(Eke,"createBaseSemanticVisitorConstructor");S(Eke,"createBaseSemanticVisitorConstructor");o(Ake,"createBaseVisitorConstructorWithDefaults");S(Ake,"createBaseVisitorConstructorWithDefaults");(function(e){e[e.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",e[e.MISSING_METHOD=1]="MISSING_METHOD"})(NF||(NF={}));o(_ke,"validateVisitor");S(_ke,"validateVisitor");o(Dke,"validateMissingCstMethods");S(Dke,"validateMissingCstMethods");U0t=class{static{o(this,"TreeBuilder")}static{S(this,"TreeBuilder")}initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=mr(e,"nodeLocationTracking")?e.nodeLocationTracking:ph.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Un,this.cstFinallyStateUpdate=Un,this.cstPostTerminal=Un,this.cstPostNonTerminal=Un,this.cstPostRule=Un;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=MF,this.setNodeLocationFromNode=MF,this.cstPostRule=Un,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Un,this.setNodeLocationFromNode=Un,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=LF,this.setNodeLocationFromNode=LF,this.cstPostRule=Un,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Un,this.setNodeLocationFromNode=Un,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Un,this.setNodeLocationFromNode=Un,this.cstPostRule=Un,this.setInitialNodeLocation=Un;else throw Error(`Invalid config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?(r.endOffset=t.endOffset,r.endLine=t.endLine,r.endColumn=t.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){let t=this.LA(0),r=e.location;r.startOffset<=t.startOffset?r.endOffset=t.endOffset:r.startOffset=NaN}cstPostTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];kke(r,t,e),this.setNodeLocationFromToken(r.location,t)}cstPostNonTerminal(e,t){let r=this.CST_STACK[this.CST_STACK.length-1];wke(r,t,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(dh(this.baseCstVisitorConstructor)){let e=Eke(this.className,po(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(dh(this.baseCstVisitorWithDefaultsConstructor)){let e=Ake(this.className,po(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}},H0t=class{static{o(this,"LexerAdapter")}static{S(this,"LexerAdapter")}initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):R5}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?R5:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}},Y0t=class{static{o(this,"RecognizerApi")}static{S(this,"RecognizerApi")}ACTION(e){return e.call(this)}consume(e,t,r){return this.consumeInternal(t,e,r)}subrule(e,t,r){return this.subruleInternal(t,e,r)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,r=L5){if(fs(this.definedRulesNames,e)){let a={message:I0.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:hs.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);let i=this.defineRule(e,t,r);return this[e]=i,i}OVERRIDE_RULE(e,t,r=L5){let i=rke(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let n=this.defineRule(e,t,r);return this[e]=n,n}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);let r=this.saveRecogState();try{return e.apply(this,t),!0}catch(i){if(dT(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return ZTe(Hn(this.gastProductionsCache))}},j0t=class{static{o(this,"RecognizerEngine")}static{S(this,"RecognizerEngine")}initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=hT,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},mr(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. + See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0 + For Further details.`);if(Kr(e)){if(Oi(e))throw Error(`A Token Vocabulary cannot be empty. + Note that the first argument for the parser constructor + is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument. + See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0 + For Further details.`)}if(Kr(e))this.tokensMap=go(e,(n,a)=>(n[a.name]=a,n),{});else if(mr(e,"modes")&&Hl(Ul(Hn(e.modes)),zCe)){let n=Ul(Hn(e.modes)),a=Lz(n);this.tokensMap=go(a,(s,l)=>(s[l.name]=l,s),{})}else if(tl(e))this.tokensMap=ka(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=gf;let r=mr(e,"modes")?Ul(Hn(e.modes)):Hn(e),i=Hl(r,n=>Oi(n.categoryMatches));this.tokenMatcher=i?hT:uy,hy(Hn(this.tokensMap))}defineRule(e,t,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called' +Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let i=mr(r,"resyncEnabled")?r.resyncEnabled:L5.resyncEnabled,n=mr(r,"recoveryValueFunc")?r.recoveryValueFunc:L5.recoveryValueFunc,a=this.ruleShortNameIdx<a.call(this)&&s.call(this),"lookAheadFunc")}}else n=e;if(i.call(this)===!0)return n.call(this)}atLeastOneInternal(e,t){let r=this.getKeyForAutomaticLookahead(DF,e);return this.atLeastOneInternalLogic(e,t,r)}atLeastOneInternalLogic(e,t,r){let i=this.getLaFuncFromCache(r),n;if(typeof t!="function"){n=t.DEF;let a=t.GATE;if(a!==void 0){let s=i;i=S(()=>a.call(this)&&s.call(this),"lookAheadFunc")}}else n=t;if(i.call(this)===!0){let a=this.doSingleRepetition(n);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(n)}else throw this.raiseEarlyExitException(e,en.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,DF,e,L0t)}atLeastOneSepFirstInternal(e,t){let r=this.getKeyForAutomaticLookahead(YE,e);this.atLeastOneSepFirstInternalLogic(e,t,r)}atLeastOneSepFirstInternalLogic(e,t,r){let i=t.DEF,n=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);let s=S(()=>this.tokenMatcher(this.LA(1),n),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),n)===!0;)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,s,i,lye],s,YE,e,lye)}else throw this.raiseEarlyExitException(e,en.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let r=this.getKeyForAutomaticLookahead(_F,e);return this.manyInternalLogic(e,t,r)}manyInternalLogic(e,t,r){let i=this.getLaFuncFromCache(r),n;if(typeof t!="function"){n=t.DEF;let s=t.GATE;if(s!==void 0){let l=i;i=S(()=>s.call(this)&&l.call(this),"lookaheadFunction")}}else n=t;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(n);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,_F,e,R0t,a)}manySepFirstInternal(e,t){let r=this.getKeyForAutomaticLookahead(RF,e);this.manySepFirstInternalLogic(e,t,r)}manySepFirstInternalLogic(e,t,r){let i=t.DEF,n=t.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);let s=S(()=>this.tokenMatcher(this.LA(1),n),"separatorLookAheadFunc");for(;this.tokenMatcher(this.LA(1),n)===!0;)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,s,i,oye],s,RF,e,oye)}}repetitionSepSecondInternal(e,t,r,i,n){for(;r();)this.CONSUME(t),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,r,i,n],r,YE,e,n)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let r=this.getKeyForAutomaticLookahead(bke,t),i=Kr(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new P0t(t,e))}}subruleInternal(e,t,r){let i;try{let n=r!==void 0?r.ARGS:void 0;return this.subruleIdx=t,i=e.apply(this,n),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(n){throw this.subruleInternalError(n,r,e.ruleName)}}subruleInternalError(e,t,r){throw dT(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,t,r){let i;try{let n=this.LA(1);this.tokenMatcher(n,e)===!0?(this.consumeToken(),i=n):this.consumeInternalError(e,n,r)}catch(n){i=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,i),i}consumeInternalError(e,t,r){let i,n=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new yke(i,t,n))}consumeInternalRecovery(e,t,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){let i=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,i)}catch(n){throw n.name===vke?r:n}}else throw r}saveRecogState(){let e=this.errors,t=ka(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),gf)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},X0t=class{static{o(this,"ErrorHandler")}static{S(this,"ErrorHandler")}initErrorHandler(e){this._errors=[],this.errorMessageProvider=mr(e,"errorMessageProvider")?e.errorMessageProvider:ph.errorMessageProvider}SAVE_ERROR(e){if(dT(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:ka(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return ka(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,r){let i=this.getCurrRuleFullName(),n=this.getGAstProductions()[i],s=FT(e,n,t,this.maxLookahead)[0],l=[];for(let h=1;h<=this.maxLookahead;h++)l.push(this.LA(h));let u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:s,actual:l,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new B0t(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],n=BT(e,i,this.maxLookahead),a=[];for(let u=1;u<=this.maxLookahead;u++)a.push(this.LA(u));let s=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:n,actual:a,previous:s,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new O0t(l,this.LA(1),s))}},K0t=class{static{o(this,"ContentAssist")}static{S(this,"ContentAssist")}initContentAssist(){}computeContentAssist(e,t){let r=this.gastProductionsCache[e];if(dh(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Vz([r],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let t=jl(e.ruleStack),i=this.getGAstProductions()[t];return new D0t(i,e).startWalking()}},AA={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(AA);cye=!0,uye=Math.pow(2,Cf)-1,Rke=q1({name:"RECORDING_PHASE_TOKEN",pattern:ls.NA});hy([Rke]);Lke=PT(Rke,`This IToken indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Lke);Z0t={name:`This CSTNode indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},Q0t=class{static{o(this,"GastRecorder")}static{S(this,"GastRecorder")}initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";this[`CONSUME${t}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${t}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${t}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${t}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${t}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${t}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${t}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${t}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,t,r){return this.consumeInternalRecord(t,e,r)},this.subrule=function(e,t,r){return this.subruleInternalRecord(t,e,r)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let t=0;t<10;t++){let r=t>0?t:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return R5}topLevelRuleRecord(e,t){try{let r=new oy({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),t.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+` + This error was thrown during the "grammar recording phase" For more info see: + https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,t){return L1.call(this,Ca,e,t)}atLeastOneInternalRecord(e,t){L1.call(this,yo,t,e)}atLeastOneSepFirstInternalRecord(e,t){L1.call(this,vo,t,e,cye)}manyInternalRecord(e,t){L1.call(this,hn,t,e)}manySepFirstInternalRecord(e,t){L1.call(this,qs,t,e,cye)}orInternalRecord(e,t){return Mke.call(this,e,t)}subruleInternalRecord(e,t,r){if(fT(t),!e||mr(e,"ruleName")===!1){let s=new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}> + inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=z0(this.recordingProdStack),n=e.ruleName,a=new us({idx:t,nonTerminalName:n,label:r?.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?Z0t:AA}consumeInternalRecord(e,t,r){if(fT(t),!$z(e)){let a=new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}> + inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=z0(this.recordingProdStack),n=new Wi({idx:t,terminalType:e,label:r?.LABEL});return i.definition.push(n),Lke}};o(L1,"recordProd");S(L1,"recordProd");o(Mke,"recordOrProd");S(Mke,"recordOrProd");o(IF,"getIdxSuffix");S(IF,"getIdxSuffix");o(fT,"assertMethodIdxIsValid");S(fT,"assertMethodIdxIsValid");J0t=class{static{o(this,"PerformanceTracer")}static{S(this,"PerformanceTracer")}initPerformanceTracer(e){if(mr(e,"traceInitPerf")){let t=e.traceInitPerf,r=typeof t=="number";this.traceInitMaxIdent=r?t:1/0,this.traceInitPerf=r?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=ph.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;let r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${e}>`);let{time:i,value:n}=Nz(t),a=i>10?console.warn:console.log;return this.traceInitIndent time: ${i}ms`),this.traceInitIndent--,n}else return t()}};o(Nke,"applyMixins");S(Nke,"applyMixins");R5=PT(gf,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(R5);ph=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:z1,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),L5=Object.freeze({recoveryValueFunc:S(()=>{},"recoveryValueFunc"),resyncEnabled:!0});(function(e){e[e.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",e[e.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",e[e.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",e[e.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",e[e.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",e[e.LEFT_RECURSION=5]="LEFT_RECURSION",e[e.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",e[e.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",e[e.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",e[e.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",e[e.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",e[e.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(hs||(hs={}));o(OF,"EMPTY_ALT");S(OF,"EMPTY_ALT");Kz=class Ike{static{o(this,"_Parser")}static{S(this,"Parser")}static performSelfAnalysis(t){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let t;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{Iz(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),vr(this.definedRulesNames,n=>{let s=this[n].originalGrammarAction,l;this.TRACE_INIT(`${n} Rule`,()=>{l=this.topLevelRuleRecord(n,s)}),this.gastProductionsCache[n]=l})}finally{this.disableRecording()}});let i=[];if(this.TRACE_INIT("Grammar Resolving",()=>{i=uke({rules:Hn(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(i)}),this.TRACE_INIT("Grammar Validations",()=>{if(Oi(i)&&this.skipValidations===!1){let n=hke({rules:Hn(this.gastProductionsCache),tokenTypes:Hn(this.tokensMap),errMsgProvider:I0,grammarName:r}),a=ZCe({lookaheadStrategy:this.lookaheadStrategy,rules:Hn(this.gastProductionsCache),tokenTypes:Hn(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(n,a)}}),Oi(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let n=nCe(Hn(this.gastProductionsCache));this.resyncFollows=n}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var n,a;(a=(n=this.lookaheadStrategy).initialize)===null||a===void 0||a.call(n,{rules:Hn(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Hn(this.gastProductionsCache))})),!Ike.DEFER_DEFINITION_ERRORS_HANDLING&&!Oi(this.definitionErrors))throw t=nr(this.definitionErrors,n=>n.message),new Error(`Parser Definition Errors detected: + ${t.join(` +------------------------------- +`)}`)})}constructor(t,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let i=this;if(i.initErrorHandler(r),i.initLexerAdapter(),i.initLooksAhead(r),i.initRecognizerEngine(t,r),i.initRecoverable(r),i.initTreeBuilder(r),i.initContentAssist(),i.initGastRecorder(r),i.initPerformanceTracer(r),mr(r,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated. + Please use the flag on the relevant DSL method instead. + See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES + For further details.`);this.skipValidations=mr(r,"skipValidations")?r.skipValidations:ph.skipValidations}};Kz.DEFER_DEFINITION_ERRORS_HANDLING=!1;Nke(Kz,[$0t,V0t,U0t,H0t,j0t,Y0t,X0t,K0t,Q0t,J0t]);emt=class extends Kz{static{o(this,"EmbeddedActionsParser")}static{S(this,"EmbeddedActionsParser")}constructor(e,t=ph){let r=ka(t);r.outputCst=!1,super(e,r)}};o(Oke,"arrayMap2");S(Oke,"arrayMap");Pke=Oke;o(Bke,"listCacheClear2");S(Bke,"listCacheClear");tmt=Bke;o(Fke,"eq2");S(Fke,"eq");$ke=Fke;o(zke,"assocIndexOf2");S(zke,"assocIndexOf");_A=zke,rmt=Array.prototype,imt=rmt.splice;o(Gke,"listCacheDelete2");S(Gke,"listCacheDelete");nmt=Gke;o(Vke,"listCacheGet2");S(Vke,"listCacheGet");amt=Vke;o(Wke,"listCacheHas2");S(Wke,"listCacheHas");smt=Wke;o(qke,"listCacheSet2");S(qke,"listCacheSet");omt=qke;o(im,"ListCache2");S(im,"ListCache");im.prototype.clear=tmt;im.prototype.delete=nmt;im.prototype.get=amt;im.prototype.has=smt;im.prototype.set=omt;DA=im;o(Uke,"stackClear2");S(Uke,"stackClear");lmt=Uke;o(Hke,"stackDelete2");S(Hke,"stackDelete");cmt=Hke;o(Yke,"stackGet2");S(Yke,"stackGet");umt=Yke;o(jke,"stackHas2");S(jke,"stackHas");hmt=jke,dmt=typeof global=="object"&&global&&global.Object===Object&&global,Xke=dmt,fmt=typeof self=="object"&&self&&self.Object===Object&&self,pmt=Xke||fmt||Function("return this")(),xh=pmt,mmt=xh.Symbol,eu=mmt,Kke=Object.prototype,gmt=Kke.hasOwnProperty,ymt=Kke.toString,b2=eu?eu.toStringTag:void 0;o(Zke,"getRawTag2");S(Zke,"getRawTag");vmt=Zke,xmt=Object.prototype,bmt=xmt.toString;o(Qke,"objectToString2");S(Qke,"objectToString");Tmt=Qke,Cmt="[object Null]",kmt="[object Undefined]",hye=eu?eu.toStringTag:void 0;o(Jke,"baseGetTag2");S(Jke,"baseGetTag");dy=Jke;o(ewe,"isObject2");S(ewe,"isObject");Zz=ewe,wmt="[object AsyncFunction]",Smt="[object Function]",Emt="[object GeneratorFunction]",Amt="[object Proxy]";o(twe,"isFunction2");S(twe,"isFunction");rwe=twe,_mt=xh["__core-js_shared__"],ZP=_mt,dye=(function(){var e=/[^.]+$/.exec(ZP&&ZP.keys&&ZP.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();o(iwe,"isMasked2");S(iwe,"isMasked");Dmt=iwe,Rmt=Function.prototype,Lmt=Rmt.toString;o(nwe,"toSource2");S(nwe,"toSource");nm=nwe,Mmt=/[\\^$.*+?()[\]{}|]/g,Nmt=/^\[object .+?Constructor\]$/,Imt=Function.prototype,Omt=Object.prototype,Pmt=Imt.toString,Bmt=Omt.hasOwnProperty,Fmt=RegExp("^"+Pmt.call(Bmt).replace(Mmt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");o(awe,"baseIsNative2");S(awe,"baseIsNative");$mt=awe;o(swe,"getValue2");S(swe,"getValue");zmt=swe;o(owe,"getNative2");S(owe,"getNative");fy=owe,Gmt=fy(xh,"Map"),pT=Gmt,Vmt=fy(Object,"create"),mT=Vmt;o(lwe,"hashClear2");S(lwe,"hashClear");Wmt=lwe;o(cwe,"hashDelete2");S(cwe,"hashDelete");qmt=cwe,Umt="__lodash_hash_undefined__",Hmt=Object.prototype,Ymt=Hmt.hasOwnProperty;o(uwe,"hashGet2");S(uwe,"hashGet");jmt=uwe,Xmt=Object.prototype,Kmt=Xmt.hasOwnProperty;o(hwe,"hashHas2");S(hwe,"hashHas");Zmt=hwe,Qmt="__lodash_hash_undefined__";o(dwe,"hashSet2");S(dwe,"hashSet");Jmt=dwe;o(am,"Hash2");S(am,"Hash");am.prototype.clear=Wmt;am.prototype.delete=qmt;am.prototype.get=jmt;am.prototype.has=Zmt;am.prototype.set=Jmt;fye=am;o(fwe,"mapCacheClear2");S(fwe,"mapCacheClear");egt=fwe;o(pwe,"isKeyable2");S(pwe,"isKeyable");tgt=pwe;o(mwe,"getMapData2");S(mwe,"getMapData");RA=mwe;o(gwe,"mapCacheDelete2");S(gwe,"mapCacheDelete");rgt=gwe;o(ywe,"mapCacheGet2");S(ywe,"mapCacheGet");igt=ywe;o(vwe,"mapCacheHas2");S(vwe,"mapCacheHas");ngt=vwe;o(xwe,"mapCacheSet2");S(xwe,"mapCacheSet");agt=xwe;o(sm,"MapCache2");S(sm,"MapCache");sm.prototype.clear=egt;sm.prototype.delete=rgt;sm.prototype.get=igt;sm.prototype.has=ngt;sm.prototype.set=agt;LA=sm,sgt=200;o(bwe,"stackSet2");S(bwe,"stackSet");ogt=bwe;o(om,"Stack2");S(om,"Stack");om.prototype.clear=lmt;om.prototype.delete=cmt;om.prototype.get=umt;om.prototype.has=hmt;om.prototype.set=ogt;XE=om,lgt="__lodash_hash_undefined__";o(Twe,"setCacheAdd2");S(Twe,"setCacheAdd");cgt=Twe;o(Cwe,"setCacheHas2");S(Cwe,"setCacheHas");ugt=Cwe;o(gT,"SetCache2");S(gT,"SetCache");gT.prototype.add=gT.prototype.push=cgt;gT.prototype.has=ugt;kwe=gT;o(wwe,"arraySome2");S(wwe,"arraySome");hgt=wwe;o(Swe,"cacheHas2");S(Swe,"cacheHas");Ewe=Swe,dgt=1,fgt=2;o(Awe,"equalArrays2");S(Awe,"equalArrays");_we=Awe,pgt=xh.Uint8Array,pye=pgt;o(Dwe,"mapToArray2");S(Dwe,"mapToArray");mgt=Dwe;o(Rwe,"setToArray2");S(Rwe,"setToArray");Qz=Rwe,ggt=1,ygt=2,vgt="[object Boolean]",xgt="[object Date]",bgt="[object Error]",Tgt="[object Map]",Cgt="[object Number]",kgt="[object RegExp]",wgt="[object Set]",Sgt="[object String]",Egt="[object Symbol]",Agt="[object ArrayBuffer]",_gt="[object DataView]",mye=eu?eu.prototype:void 0,QP=mye?mye.valueOf:void 0;o(Lwe,"equalByTag2");S(Lwe,"equalByTag");Dgt=Lwe;o(Mwe,"arrayPush2");S(Mwe,"arrayPush");Nwe=Mwe,Rgt=Array.isArray,ds=Rgt;o(Iwe,"baseGetAllKeys2");S(Iwe,"baseGetAllKeys");Lgt=Iwe;o(Owe,"arrayFilter2");S(Owe,"arrayFilter");Pwe=Owe;o(Bwe,"stubArray2");S(Bwe,"stubArray");Mgt=Bwe,Ngt=Object.prototype,Igt=Ngt.propertyIsEnumerable,gye=Object.getOwnPropertySymbols,Ogt=gye?function(e){return e==null?[]:(e=Object(e),Pwe(gye(e),function(t){return Igt.call(e,t)}))}:Mgt,Pgt=Ogt;o(Fwe,"baseTimes2");S(Fwe,"baseTimes");Bgt=Fwe;o($we,"isObjectLike2");S($we,"isObjectLike");ry=$we,Fgt="[object Arguments]";o(zwe,"baseIsArguments2");S(zwe,"baseIsArguments");yye=zwe,Gwe=Object.prototype,$gt=Gwe.hasOwnProperty,zgt=Gwe.propertyIsEnumerable,Ggt=yye((function(){return arguments})())?yye:function(e){return ry(e)&&$gt.call(e,"callee")&&!zgt.call(e,"callee")},MA=Ggt;o(Vwe,"stubFalse2");S(Vwe,"stubFalse");Vgt=Vwe,Wwe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vye=Wwe&&typeof module=="object"&&module&&!module.nodeType&&module,Wgt=vye&&vye.exports===Wwe,xye=Wgt?xh.Buffer:void 0,qgt=xye?xye.isBuffer:void 0,Ugt=qgt||Vgt,M5=Ugt,Hgt=9007199254740991,Ygt=/^(?:0|[1-9]\d*)$/;o(qwe,"isIndex2");S(qwe,"isIndex");Uwe=qwe,jgt=9007199254740991;o(Hwe,"isLength2");S(Hwe,"isLength");Jz=Hwe,Xgt="[object Arguments]",Kgt="[object Array]",Zgt="[object Boolean]",Qgt="[object Date]",Jgt="[object Error]",e1t="[object Function]",t1t="[object Map]",r1t="[object Number]",i1t="[object Object]",n1t="[object RegExp]",a1t="[object Set]",s1t="[object String]",o1t="[object WeakMap]",l1t="[object ArrayBuffer]",c1t="[object DataView]",u1t="[object Float32Array]",h1t="[object Float64Array]",d1t="[object Int8Array]",f1t="[object Int16Array]",p1t="[object Int32Array]",m1t="[object Uint8Array]",g1t="[object Uint8ClampedArray]",y1t="[object Uint16Array]",v1t="[object Uint32Array]",Vi={};Vi[u1t]=Vi[h1t]=Vi[d1t]=Vi[f1t]=Vi[p1t]=Vi[m1t]=Vi[g1t]=Vi[y1t]=Vi[v1t]=!0;Vi[Xgt]=Vi[Kgt]=Vi[l1t]=Vi[Zgt]=Vi[c1t]=Vi[Qgt]=Vi[Jgt]=Vi[e1t]=Vi[t1t]=Vi[r1t]=Vi[i1t]=Vi[n1t]=Vi[a1t]=Vi[s1t]=Vi[o1t]=!1;o(Ywe,"baseIsTypedArray2");S(Ywe,"baseIsTypedArray");x1t=Ywe;o(jwe,"baseUnary2");S(jwe,"baseUnary");b1t=jwe,Xwe=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Q2=Xwe&&typeof module=="object"&&module&&!module.nodeType&&module,T1t=Q2&&Q2.exports===Xwe,JP=T1t&&Xke.process,C1t=(function(){try{var e=Q2&&Q2.require&&Q2.require("util").types;return e||JP&&JP.binding&&JP.binding("util")}catch{}})(),bye=C1t,Tye=bye&&bye.isTypedArray,k1t=Tye?b1t(Tye):x1t,eG=k1t,w1t=Object.prototype,S1t=w1t.hasOwnProperty;o(Kwe,"arrayLikeKeys2");S(Kwe,"arrayLikeKeys");E1t=Kwe,A1t=Object.prototype;o(Zwe,"isPrototype2");S(Zwe,"isPrototype");Qwe=Zwe;o(Jwe,"overArg2");S(Jwe,"overArg");_1t=Jwe,D1t=_1t(Object.keys,Object),R1t=D1t,L1t=Object.prototype,M1t=L1t.hasOwnProperty;o(e4e,"baseKeys2");S(e4e,"baseKeys");t4e=e4e;o(r4e,"isArrayLike2");S(r4e,"isArrayLike");NA=r4e;o(i4e,"keys2");S(i4e,"keys");tG=i4e;o(n4e,"getAllKeys2");S(n4e,"getAllKeys");Cye=n4e,N1t=1,I1t=Object.prototype,O1t=I1t.hasOwnProperty;o(a4e,"equalObjects2");S(a4e,"equalObjects");P1t=a4e,B1t=fy(xh,"DataView"),PF=B1t,F1t=fy(xh,"Promise"),BF=F1t,$1t=fy(xh,"Set"),U1=$1t,z1t=fy(xh,"WeakMap"),FF=z1t,kye="[object Map]",G1t="[object Object]",wye="[object Promise]",Sye="[object Set]",Eye="[object WeakMap]",Aye="[object DataView]",V1t=nm(PF),W1t=nm(pT),q1t=nm(BF),U1t=nm(U1),H1t=nm(FF),d0=dy;(PF&&d0(new PF(new ArrayBuffer(1)))!=Aye||pT&&d0(new pT)!=kye||BF&&d0(BF.resolve())!=wye||U1&&d0(new U1)!=Sye||FF&&d0(new FF)!=Eye)&&(d0=S(function(e){var t=dy(e),r=t==G1t?e.constructor:void 0,i=r?nm(r):"";if(i)switch(i){case V1t:return Aye;case W1t:return kye;case q1t:return wye;case U1t:return Sye;case H1t:return Eye}return t},"getTag"));$F=d0,Y1t=1,_ye="[object Arguments]",Dye="[object Array]",xE="[object Object]",j1t=Object.prototype,Rye=j1t.hasOwnProperty;o(s4e,"baseIsEqualDeep2");S(s4e,"baseIsEqualDeep");X1t=s4e;o(rG,"baseIsEqual2");S(rG,"baseIsEqual");o4e=rG,K1t=1,Z1t=2;o(l4e,"baseIsMatch2");S(l4e,"baseIsMatch");Q1t=l4e;o(c4e,"isStrictComparable2");S(c4e,"isStrictComparable");u4e=c4e;o(h4e,"getMatchData2");S(h4e,"getMatchData");J1t=h4e;o(d4e,"matchesStrictComparable2");S(d4e,"matchesStrictComparable");f4e=d4e;o(p4e,"baseMatches2");S(p4e,"baseMatches");eyt=p4e,tyt="[object Symbol]";o(m4e,"isSymbol2");S(m4e,"isSymbol");IA=m4e,ryt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,iyt=/^\w*$/;o(g4e,"isKey2");S(g4e,"isKey");iG=g4e,nyt="Expected a function";o(OA,"memoize2");S(OA,"memoize");OA.Cache=LA;ayt=OA,syt=500;o(y4e,"memoizeCapped2");S(y4e,"memoizeCapped");oyt=y4e,lyt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,cyt=/\\(\\)?/g,uyt=oyt(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(lyt,function(r,i,n,a){t.push(n?a.replace(cyt,"$1"):i||r)}),t}),hyt=uyt,dyt=1/0,Lye=eu?eu.prototype:void 0,Mye=Lye?Lye.toString:void 0;o(nG,"baseToString2");S(nG,"baseToString");fyt=nG;o(v4e,"toString3");S(v4e,"toString");pyt=v4e;o(x4e,"castPath2");S(x4e,"castPath");b4e=x4e,myt=1/0;o(T4e,"toKey2");S(T4e,"toKey");PA=T4e;o(C4e,"baseGet2");S(C4e,"baseGet");k4e=C4e;o(w4e,"get2");S(w4e,"get");gyt=w4e;o(S4e,"baseHasIn2");S(S4e,"baseHasIn");yyt=S4e;o(E4e,"hasPath2");S(E4e,"hasPath");vyt=E4e;o(A4e,"hasIn2");S(A4e,"hasIn");xyt=A4e,byt=1,Tyt=2;o(_4e,"baseMatchesProperty2");S(_4e,"baseMatchesProperty");Cyt=_4e;o(D4e,"identity2");S(D4e,"identity");aG=D4e;o(R4e,"baseProperty2");S(R4e,"baseProperty");kyt=R4e;o(L4e,"basePropertyDeep2");S(L4e,"basePropertyDeep");wyt=L4e;o(M4e,"property2");S(M4e,"property");Syt=M4e;o(N4e,"baseIteratee2");S(N4e,"baseIteratee");BA=N4e;o(I4e,"createBaseFor2");S(I4e,"createBaseFor");Eyt=I4e,Ayt=Eyt(),_yt=Ayt;o(O4e,"baseForOwn2");S(O4e,"baseForOwn");Dyt=O4e;o(P4e,"createBaseEach2");S(P4e,"createBaseEach");Ryt=P4e,Lyt=Ryt(Dyt),FA=Lyt;o(B4e,"baseMap2");S(B4e,"baseMap");Myt=B4e;o(F4e,"map2");S(F4e,"map");sh=F4e;o($4e,"baseFilter2");S($4e,"baseFilter");Nyt=$4e;o(z4e,"filter2");S(z4e,"filter");Iyt=z4e;o(V0,"buildATNKey");S(V0,"buildATNKey");yf=1,Oyt=2,G4e=4,V4e=5,$T=7,Pyt=8,Byt=9,Fyt=10,$yt=11,W4e=12,sG=class{static{o(this,"AbstractTransition")}static{S(this,"AbstractTransition")}constructor(e){this.target=e}isEpsilon(){return!1}},oG=class extends sG{static{o(this,"AtomTransition")}static{S(this,"AtomTransition")}constructor(e,t){super(e),this.tokenType=t}},q4e=class extends sG{static{o(this,"EpsilonTransition")}static{S(this,"EpsilonTransition")}constructor(e){super(e)}isEpsilon(){return!0}},lG=class extends sG{static{o(this,"RuleTransition")}static{S(this,"RuleTransition")}constructor(e,t,r){super(e),this.rule=t,this.followState=r}isEpsilon(){return!0}};o(U4e,"createATN");S(U4e,"createATN");o(H4e,"createRuleStartAndStopATNStates");S(H4e,"createRuleStartAndStopATNStates");o(cG,"atom");S(cG,"atom");o(Y4e,"repetition");S(Y4e,"repetition");o(j4e,"repetitionSep");S(j4e,"repetitionSep");o(X4e,"repetitionMandatory");S(X4e,"repetitionMandatory");o(K4e,"repetitionMandatorySep");S(K4e,"repetitionMandatorySep");o(Z4e,"alternation");S(Z4e,"alternation");o(Q4e,"option");S(Q4e,"option");o(kf,"block");S(kf,"block");o(uG,"plus");S(uG,"plus");o(hG,"star");S(hG,"star");o(J4e,"optional");S(J4e,"optional");o(bh,"defineDecisionState");S(bh,"defineDecisionState");o(lm,"makeAlts");S(lm,"makeAlts");o(eSe,"getProdType2");S(eSe,"getProdType");o(tSe,"makeBlock");S(tSe,"makeBlock");o($A,"tokenRef");S($A,"tokenRef");o(rSe,"ruleRef");S(rSe,"ruleRef");o(iSe,"buildRuleHandle");S(iSe,"buildRuleHandle");o(vn,"epsilon");S(vn,"epsilon");o(Yn,"newState");S(Yn,"newState");o(zA,"addTransition");S(zA,"addTransition");o(nSe,"removeState");S(nSe,"removeState");N5={},zF=class{static{o(this,"ATNConfigSet")}static{S(this,"ATNConfigSet")}constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){let t=dG(e);t in this.map||(this.map[t]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return sh(this.configs,e=>e.alt)}get key(){let e="";for(let t in this.map)e+=t+":";return e}};o(dG,"getATNConfigKey");S(dG,"getATNConfigKey");o(aSe,"baseExtremum");S(aSe,"baseExtremum");zyt=aSe;o(sSe,"baseLt");S(sSe,"baseLt");Gyt=sSe;o(oSe,"min");S(oSe,"min");Vyt=oSe,Nye=eu?eu.isConcatSpreadable:void 0;o(lSe,"isFlattenable2");S(lSe,"isFlattenable");Wyt=lSe;o(fG,"baseFlatten2");S(fG,"baseFlatten");cSe=fG;o(uSe,"flatMap2");S(uSe,"flatMap");qyt=uSe;o(hSe,"baseFindIndex2");S(hSe,"baseFindIndex");Uyt=hSe;o(dSe,"baseIsNaN2");S(dSe,"baseIsNaN");Hyt=dSe;o(fSe,"strictIndexOf2");S(fSe,"strictIndexOf");Yyt=fSe;o(pSe,"baseIndexOf2");S(pSe,"baseIndexOf");jyt=pSe;o(mSe,"arrayIncludes2");S(mSe,"arrayIncludes");Xyt=mSe;o(gSe,"arrayIncludesWith2");S(gSe,"arrayIncludesWith");Kyt=gSe;o(ySe,"noop2");S(ySe,"noop");Zyt=ySe,Qyt=1/0,Jyt=U1&&1/Qz(new U1([,-0]))[1]==Qyt?function(e){return new U1(e)}:Zyt,evt=Jyt,tvt=200;o(vSe,"baseUniq2");S(vSe,"baseUniq");rvt=vSe;o(xSe,"uniqBy");S(xSe,"uniqBy");ivt=xSe;o(bSe,"flatten2");S(bSe,"flatten");nvt=bSe;o(TSe,"arrayEach2");S(TSe,"arrayEach");avt=TSe;o(CSe,"castFunction2");S(CSe,"castFunction");svt=CSe;o(kSe,"forEach2");S(kSe,"forEach");eB=kSe,ovt="[object Map]",lvt="[object Set]",cvt=Object.prototype,uvt=cvt.hasOwnProperty;o(wSe,"isEmpty2");S(wSe,"isEmpty");hvt=wSe;o(SSe,"arrayReduce2");S(SSe,"arrayReduce");dvt=SSe;o(ESe,"baseReduce2");S(ESe,"baseReduce");fvt=ESe;o(ASe,"reduce2");S(ASe,"reduce");Iye=ASe;o(_Se,"createDFACache");S(_Se,"createDFACache");DSe=class{static{o(this,"PredicateSet")}static{S(this,"PredicateSet")}constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,t){this.predicates[e]=t}toString(){let e="",t=this.predicates.length;for(let r=0;rconsole.log(r))}initialize(e){this.atn=U4e(e.rules),this.dfas=RSe(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){let{prodOccurrence:t,rule:r,hasPredicates:i,dynamicTokensEnabled:n}=e,a=this.dfas,s=this.logging,l=V0(r,"Alternation",t),h=this.atn.decisionMap[l].decision,d=sh(EF({maxLookahead:1,occurrence:t,prodType:"Alternation",rule:r}),f=>sh(f,p=>p[0]));if(GF(d,!1)&&!n){let f=Iye(d,(p,m,g)=>(eB(m,y=>{y&&(p[y.tokenTypeIdx]=g,eB(y.categoryMatches,v=>{p[v]=g}))}),p),{});return i?function(p){var m;let g=this.LA(1),y=f[g.tokenTypeIdx];if(p!==void 0&&y!==void 0){let v=(m=p[y])===null||m===void 0?void 0:m.GATE;if(v!==void 0&&v.call(this)===!1)return}return y}:function(){let p=this.LA(1);return f[p.tokenTypeIdx]}}else return i?function(f){let p=new DSe,m=f===void 0?0:f.length;for(let y=0;ysh(f,p=>p[0]));if(GF(d)&&d[0][0]&&!n){let f=d[0],p=nvt(f);if(p.length===1&&hvt(p[0].categoryMatches)){let g=p[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===g}}else{let m=Iye(p,(g,y)=>(y!==void 0&&(g[y.tokenTypeIdx]=!0,eB(y.categoryMatches,v=>{g[v]=!0})),g),{});return function(){let g=this.LA(1);return m[g.tokenTypeIdx]===!0}}}return function(){let f=KE.call(this,a,h,Oye,s);return typeof f=="object"?!1:f===0}}};o(GF,"isLL1Sequence");S(GF,"isLL1Sequence");o(RSe,"initATNSimulator");S(RSe,"initATNSimulator");o(KE,"adaptivePredict");S(KE,"adaptivePredict");o(LSe,"performLookahead");S(LSe,"performLookahead");o(MSe,"computeLookaheadTarget");S(MSe,"computeLookaheadTarget");o(NSe,"reportLookaheadAmbiguity");S(NSe,"reportLookaheadAmbiguity");o(ISe,"buildAmbiguityError");S(ISe,"buildAmbiguityError");o(OSe,"getProductionDslName2");S(OSe,"getProductionDslName");o(PSe,"buildAdaptivePredictError");S(PSe,"buildAdaptivePredictError");o(BSe,"getExistingTargetState");S(BSe,"getExistingTargetState");o(FSe,"computeReachSet");S(FSe,"computeReachSet");o($Se,"getReachableTarget");S($Se,"getReachableTarget");o(zSe,"getUniqueAlt");S(zSe,"getUniqueAlt");o(pG,"newDFAState");S(pG,"newDFAState");o(VF,"addDFAEdge");S(VF,"addDFAEdge");o(mG,"addDFAState");S(mG,"addDFAState");o(GSe,"computeStartState");S(GSe,"computeStartState");o(yT,"closure");S(yT,"closure");o(VSe,"getEpsilonTarget");S(VSe,"getEpsilonTarget");o(WSe,"hasConfigInRuleStopState");S(WSe,"hasConfigInRuleStopState");o(qSe,"allConfigsInRuleStopStates");S(qSe,"allConfigsInRuleStopStates");o(USe,"hasConflictTerminatingPrediction");S(USe,"hasConflictTerminatingPrediction");o(HSe,"getConflictingAltSets");S(HSe,"getConflictingAltSets");o(YSe,"hasConflictingAltSet");S(YSe,"hasConflictingAltSet");o(jSe,"hasStateAssociatedWithOneAlt");S(jSe,"hasStateAssociatedWithOneAlt");bT();XSe=class{static{o(this,"CstNodeBuilder")}static{S(this,"CstNodeBuilder")}constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new yG(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new GA;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let r=new I5(e.startOffset,e.image.length,nT(e),e.tokenType,!t);return r.grammarSource=t,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){let t=e.container;if(t){let r=t.content.indexOf(e);r>=0&&t.content.splice(r,1)}}addHiddenNodes(e){let t=[];for(let n of e){let a=new I5(n.startOffset,n.image.length,nT(n),n.tokenType,!0);a.root=this.rootNode,t.push(a)}let r=this.current,i=!1;if(r.content.length>0){r.content.push(...t);return}for(;r.container;){let n=r.container.content.indexOf(r);if(n>0){r.container.content.splice(n,0,...t),i=!0;break}r=r.container}i||this.rootNode.content.unshift(...t)}construct(e){let t=this.current;typeof e.$type=="string"&&!e.$infix&&(this.current.astNode=e),e.$cstNode=t;let r=this.nodeStack.pop();r?.content.length===0&&this.removeNode(r)}},gG=class{static{o(this,"AbstractCstNode")}static{S(this,"AbstractCstNode")}get hidden(){return!1}get astNode(){let e=typeof this._astNode?.$type=="string"?this._astNode:this.container?.astNode;if(!e)throw new Error("This node has no associated AST element");return e}set astNode(e){this._astNode=e}get text(){return this.root.fullText.substring(this.offset,this.end)}},I5=class extends gG{static{o(this,"LeafCstNodeImpl")}static{S(this,"LeafCstNodeImpl")}get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,t,r,i,n=!1){super(),this._hidden=n,this._offset=e,this._tokenType=i,this._length=t,this._range=r}},GA=class extends gG{static{o(this,"CompositeCstNodeImpl")}static{S(this,"CompositeCstNodeImpl")}constructor(){super(...arguments),this.content=new mvt(this)}get offset(){return this.firstNonHiddenNode?.offset??0}get length(){return this.end-this.offset}get end(){return this.lastNonHiddenNode?.end??0}get range(){let e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(this._rangeCache===void 0){let{range:r}=e,{range:i}=t;this._rangeCache={start:r.start,end:i.end.line=0;e--){let t=this.content[e];if(!t.hidden)return t}return this.content[this.content.length-1]}},mvt=class KSe extends Array{static{o(this,"_CstNodeContainer")}static{S(this,"CstNodeContainer")}constructor(t){super(),this.parent=t,Object.setPrototypeOf(this,KSe.prototype)}push(...t){return this.addParents(t),super.push(...t)}unshift(...t){return this.addParents(t),super.unshift(...t)}splice(t,r,...i){return this.addParents(i),super.splice(t,r,...i)}addParents(t){for(let r of t)r.container=this.parent}},yG=class extends GA{static{o(this,"RootCstNodeImpl")}static{S(this,"RootCstNodeImpl")}get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}},O5=Symbol("Datatype");o(ZE,"isDataTypeNode");S(ZE,"isDataTypeNode");Pye="\u200B",ZSe=S(e=>e.endsWith(Pye)?e:e+Pye,"withRuleSuffix"),vG=class{static{o(this,"AbstractLangiumParser")}static{S(this,"AbstractLangiumParser")}constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;let t=this.lexer.definition,r=e.LanguageMetaData.mode==="production";e.shared.profilers.LangiumProfiler?.isActive("parsing")?this.wrapper=new yvt(t,{...e.parser.ParserConfig,skipValidations:r,errorMessageProvider:e.parser.ParserErrorMessageProvider},e.shared.profilers.LangiumProfiler.createTask("parsing",e.LanguageMetaData.languageId)):this.wrapper=new t3e(t,{...e.parser.ParserConfig,skipValidations:r,errorMessageProvider:e.parser.ParserErrorMessageProvider})}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},QSe=class extends vG{static{o(this,"LangiumParser")}static{S(this,"LangiumParser")}get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new XSe,this.stack=[],this.assignmentMap=new Map,this.operatorPrecedence=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){let r=this.computeRuleType(e),i;K1(e)&&(i=e.name,this.registerPrecedenceMap(e));let n=this.wrapper.DEFINE_RULE(ZSe(e.name),this.startImplementation(r,i,t).bind(this));return this.allRules.set(e.name,n),cs(e)&&e.entry&&(this.mainRule=n),n}registerPrecedenceMap(e){let t=e.name,r=new Map;for(let i=0;i0&&(t=this.construct()),t===void 0)throw new Error("No result from parser");if(this.stack.length>0)throw new Error("Parser stack is not empty after parsing");return t}startImplementation(e,t,r){return i=>{let n=!this.isRecording()&&e!==void 0;if(n){let a={$type:e};this.stack.push(a),e===O5?a.value="":t!==void 0&&(a.$infixName=t)}return r(i),n?this.construct():void 0}}extractHiddenTokens(e){let t=this.lexerResult.hidden;if(!t.length)return[];let r=e.startOffset;for(let i=0;ir)return t.splice(0,i);return t.splice(0,t.length)}consume(e,t,r){let i=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(i)){let n=this.extractHiddenTokens(i);this.nodeBuilder.addHiddenNodes(n);let a=this.nodeBuilder.buildLeafNode(i,r),{assignment:s,crossRef:l}=this.getAssignment(r),u=this.current;if(s){let h=ch(r)?i.image:this.converter.convert(i.image,a);this.assign(s.operator,s.feature,h,a,l)}else if(ZE(u)){let h=i.image;ch(r)||(h=this.converter.convert(h,a).toString()),u.value+=h}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,t,r,i,n){let a;!this.isRecording()&&!r&&(a=this.nodeBuilder.buildCompositeNode(i));let s;try{s=this.wrapper.wrapSubrule(e,t,n)}finally{this.isRecording()||(s===void 0&&!r&&(s=this.construct()),s!==void 0&&a&&a.length>0&&this.performSubruleAssignment(s,i,a))}}performSubruleAssignment(e,t,r){let{assignment:i,crossRef:n}=this.getAssignment(t);if(i)this.assign(i.operator,i.feature,e,r,n);else if(!i){let a=this.current;if(ZE(a))a.value+=e.toString();else if(typeof e=="object"&&e){let l=this.assignWithoutOverride(e,a);this.stack.pop(),this.stack.push(l)}}}action(e,t){if(!this.isRecording()){let r=this.current;if(t.feature&&t.operator){r=this.construct(),this.nodeBuilder.removeNode(r.$cstNode),this.nodeBuilder.buildCompositeNode(t).content.push(r.$cstNode);let n={$type:e};this.stack.push(n),this.assign(t.operator,t.feature,r,r.$cstNode)}else r.$type=e}}construct(){if(this.isRecording())return;let e=this.stack.pop();return this.nodeBuilder.construct(e),"$infixName"in e?this.constructInfix(e,this.operatorPrecedence.get(e.$infixName)):ZE(e)?this.converter.convert(e.value,e.$cstNode):(g$(this.astReflection,e),e)}constructInfix(e,t){let r=e.parts;if(!Array.isArray(r)||r.length===0)return;let i=e.operators;if(!Array.isArray(i)||r.length<2)return r[0];let n=0,a=-1;for(let g=0;ga?(a=v.precedence,n=g):v.precedence===a&&(v.rightAssoc||(n=g))}let s=i.slice(0,n),l=i.slice(n+1),u=r.slice(0,n+1),h=r.slice(n+1),d={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:u,operators:s},f={$infixName:e.$infixName,$type:e.$type,$cstNode:e.$cstNode,parts:h,operators:l},p=this.constructInfix(d,t),m=this.constructInfix(f,t);return{$type:e.$type,$cstNode:e.$cstNode,left:p,operator:i[n],right:m}}getAssignment(e){if(!this.assignmentMap.has(e)){let t=U0(e,lh);this.assignmentMap.set(e,{assignment:t,crossRef:t&&Y0(t.terminal)?t.terminal.isMulti?"multi":"single":void 0})}return this.assignmentMap.get(e)}assign(e,t,r,i,n){let a=this.current,s;switch(n==="single"&&typeof r=="string"?s=this.linker.buildReference(a,t,i,r):n==="multi"&&typeof r=="string"?s=this.linker.buildMultiReference(a,t,i,r):s=r,e){case"=":{a[t]=s;break}case"?=":{a[t]=!0;break}case"+=":Array.isArray(a[t])||(a[t]=[]),a[t].push(s)}}assignWithoutOverride(e,t){for(let[i,n]of Object.entries(t)){let a=e[i];a===void 0?e[i]=n:Array.isArray(a)&&Array.isArray(n)&&(n.push(...a),e[i]=n)}let r=e.$cstNode;return r&&(r.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}},JSe=class{static{o(this,"AbstractParserErrorMessageProvider")}static{S(this,"AbstractParserErrorMessageProvider")}buildMismatchTokenMessage(e){return z1.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return z1.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return z1.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return z1.buildEarlyExitMessage(e)}},xG=class extends JSe{static{o(this,"LangiumParserErrorMessageProvider")}static{S(this,"LangiumParserErrorMessageProvider")}buildMismatchTokenMessage({expected:e,actual:t}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},e3e=class extends vG{static{o(this,"LangiumCompletionParser")}static{S(this,"LangiumCompletionParser")}constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();let t=this.lexer.tokenize(e,{mode:"partial"});return this.tokens=t.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,t){let r=this.wrapper.DEFINE_RULE(ZSe(e.name),this.startImplementation(t).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{let r=this.keepStackSize();try{e(t)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,t,r){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,r,i,n){this.before(i),this.wrapper.wrapSubrule(e,t,n),this.after(i)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}},gvt={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new xG},t3e=class extends emt{static{o(this,"ChevrotainWrapper")}static{S(this,"ChevrotainWrapper")}constructor(e,t){let r=t&&"maxLookahead"in t;super(e,{...gvt,lookaheadStrategy:r?new jz({maxLookahead:t.maxLookahead}):new pvt({logging:t.skipValidations?()=>{}:void 0}),...t})}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t,r){return this.RULE(e,t,r)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t,void 0)}wrapSubrule(e,t,r){return this.subrule(e,t,{ARGS:[r]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}rule(e){return e.call(this,{})}},yvt=class extends t3e{static{o(this,"ProfilerWrapper")}static{S(this,"ProfilerWrapper")}constructor(e,t,r){super(e,t),this.task=r}rule(e){this.task.start(),this.task.startSubTask(this.ruleName(e));try{return super.rule(e)}finally{this.task.stopSubTask(this.ruleName(e)),this.task.stop()}}ruleName(e){return e.ruleName}subrule(e,t,r){this.task.startSubTask(this.ruleName(t));try{return super.subrule(e,t,r)}finally{this.task.stopSubTask(this.ruleName(t))}}};o(VA,"createParser");S(VA,"createParser");o(r3e,"buildRules");S(r3e,"buildRules");o(i3e,"buildInfixRule");S(i3e,"buildInfixRule");o(vf,"buildElement");S(vf,"buildElement");o(n3e,"buildAction");S(n3e,"buildAction");o(a3e,"buildRuleCall");S(a3e,"buildRuleCall");o(s3e,"buildRuleCallPredicate");S(s3e,"buildRuleCallPredicate");o(Vl,"buildPredicate");S(Vl,"buildPredicate");o(o3e,"buildAlternatives");S(o3e,"buildAlternatives");o(l3e,"buildUnorderedGroup");S(l3e,"buildUnorderedGroup");o(c3e,"buildGroup");S(c3e,"buildGroup");o(vT,"getGuardCondition");S(vT,"getGuardCondition");o(bG,"buildCrossReference");S(bG,"buildCrossReference");o(u3e,"buildKeyword");S(u3e,"buildKeyword");o(TG,"wrap");S(TG,"wrap");o(WA,"getRule");S(WA,"getRule");o(h3e,"getRuleName");S(h3e,"getRuleName");o(P5,"getToken");S(P5,"getToken");o(CG,"createCompletionParser");S(CG,"createCompletionParser");o(kG,"createLangiumParser");S(kG,"createLangiumParser");o(wG,"prepareLangiumParser");S(wG,"prepareLangiumParser");qA=class{static{o(this,"DefaultTokenBuilder")}static{S(this,"DefaultTokenBuilder")}constructor(){this.diagnostics=[]}buildTokens(e,t){let r=gi(iA(e,!1)),i=this.buildTerminalTokens(r),n=this.buildKeywordTokens(r,i,t);return n.push(...i),n}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(rl).filter(t=>!t.fragment).map(t=>this.buildTerminalToken(t)).toArray()}buildTerminalToken(e){let t=ET(e),r=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,i={name:e.name,PATTERN:r};return typeof r=="function"&&(i.LINE_BREAKS=!0),e.hidden&&(i.GROUP=rA(t)?ls.SKIPPED:"hidden"),i}requiresCustomPattern(e){return!!(e.flags.includes("u")||e.flags.includes("s"))}regexPatternFunction(e){let t=new RegExp(e,e.flags+"y");return(r,i)=>(t.lastIndex=i,t.exec(r))}buildKeywordTokens(e,t,r){return e.filter(H0).flatMap(i=>yh(i).filter(ch)).distinct(i=>i.value).toArray().sort((i,n)=>n.value.length-i.value.length).map(i=>this.buildKeywordToken(i,t,!!r?.caseInsensitive))}buildKeywordToken(e,t,r){let i=this.buildKeywordPattern(e,r),n={name:e.value,PATTERN:i,LONGER_ALT:this.findLongerAlt(e,t)};return typeof i=="function"&&(n.LINE_BREAKS=!0),n}buildKeywordPattern(e,t){return t?new RegExp(sy(e.value),"i"):e.value}findLongerAlt(e,t){return t.reduce((r,i)=>{let n=i?.PATTERN;return n?.source&&X$("^"+n.source+"$",e.value)&&r.push(i),r},[])}},SG=class{static{o(this,"DefaultValueConverter")}static{S(this,"DefaultValueConverter")}convert(e,t){let r=t.grammarSource;if(Y0(r)&&(r=ez(r)),uh(r)){let i=r.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,t)}return e}runConverter(e,t,r){switch(e.name.toUpperCase()){case"INT":return jc.convertInt(t);case"STRING":return jc.convertString(t);case"ID":return jc.convertID(t)}switch(cz(e)?.toLowerCase()){case"number":return jc.convertNumber(t);case"boolean":return jc.convertBoolean(t);case"bigint":return jc.convertBigint(t);case"date":return jc.convertDate(t);default:return t}}};(function(e){function t(h){let d="";for(let f=1;f{this.resolve=r=>(e(r),this),this.reject=r=>(t(r),this)})}},Bye=class WF{static{o(this,"_FullTextDocument")}static{S(this,"FullTextDocument")}constructor(t,r,i,n){this._uri=t,this._languageId=r,this._version=i,this._content=n,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let r=this.offsetAt(t.start),i=this.offsetAt(t.end);return this._content.substring(r,i)}return this._content}update(t,r){for(let i of t)if(WF.isIncremental(i)){let n=_G(i.range),a=this.offsetAt(n.start),s=this.offsetAt(n.end);this._content=this._content.substring(0,a)+i.text+this._content.substring(s,this._content.length);let l=Math.max(n.start.line,0),u=Math.max(n.end.line,0),h=this._lineOffsets,d=qF(i.text,!1,a);if(u-l===d.length)for(let p=0,m=d.length;pt?n=s:i=s+1}let a=i-1;return t=this.ensureBeforeEOL(t,r[a]),{line:a,character:t-r[a]}}offsetAt(t){let r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;let i=r[t.line];if(t.character<=0)return i;let n=t.line+1r&&AG(this._content.charCodeAt(t-1));)t--;return t}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(t){let r=t;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}};(function(e){function t(n,a,s,l){return new Bye(n,a,s,l)}o(t,"create"),S(t,"create"),e.create=t;function r(n,a,s){if(n instanceof Bye)return n.update(a,s),n;throw new Error("TextDocument.update: document must be created by TextDocument.create")}o(r,"update"),S(r,"update"),e.update=r;function i(n,a){let s=n.getText(),l=F5(a.map(f3e),(d,f)=>{let p=d.range.start.line-f.range.start.line;return p===0?d.range.start.character-f.range.start.character:p}),u=0,h=[];for(let d of l){let f=n.offsetAt(d.range.start);if(fu&&h.push(s.substring(u,f)),d.newText.length&&h.push(d.newText),u=n.offsetAt(d.range.end)}return h.push(s.substr(u)),h.join("")}o(i,"applyEdits"),S(i,"applyEdits"),e.applyEdits=i})(B5||(B5={}));o(F5,"mergeSort");S(F5,"mergeSort");o(qF,"computeLineOffsets");S(qF,"computeLineOffsets");o(AG,"isEOL");S(AG,"isEOL");o(_G,"getWellformedRange");S(_G,"getWellformedRange");o(f3e,"getWellformedEdit");S(f3e,"getWellformedEdit");(()=>{"use strict";var e={975:I=>{function D(M){if(typeof M!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(M))}o(D,"e2"),S(D,"e");function _(M,L){for(var B,O="",$=0,G=-1,F=0,V=0;V<=M.length;++V){if(V2){var H=O.lastIndexOf("/");if(H!==O.length-1){H===-1?(O="",$=0):$=(O=O.slice(0,H)).length-1-O.lastIndexOf("/"),G=V,F=0;continue}}else if(O.length===2||O.length===1){O="",$=0,G=V,F=0;continue}}L&&(O.length>0?O+="/..":O="..",$=2)}else O.length>0?O+="/"+M.slice(G+1,V):O=M.slice(G+1,V),$=V-G-1;G=V,F=0}else B===46&&F!==-1?++F:F=-1}return O}o(_,"r2"),S(_,"r");var R={resolve:S(function(){for(var M,L="",B=!1,O=arguments.length-1;O>=-1&&!B;O--){var $;O>=0?$=arguments[O]:(M===void 0&&(M=process.cwd()),$=M),D($),$.length!==0&&(L=$+"/"+L,B=$.charCodeAt(0)===47)}return L=_(L,!B),B?L.length>0?"/"+L:"/":L.length>0?L:"."},"resolve"),normalize:S(function(M){if(D(M),M.length===0)return".";var L=M.charCodeAt(0)===47,B=M.charCodeAt(M.length-1)===47;return(M=_(M,!L)).length!==0||L||(M="."),M.length>0&&B&&(M+="/"),L?"/"+M:M},"normalize"),isAbsolute:S(function(M){return D(M),M.length>0&&M.charCodeAt(0)===47},"isAbsolute"),join:S(function(){if(arguments.length===0)return".";for(var M,L=0;L0&&(M===void 0?M=B:M+="/"+B)}return M===void 0?".":R.normalize(M)},"join"),relative:S(function(M,L){if(D(M),D(L),M===L||(M=R.resolve(M))===(L=R.resolve(L)))return"";for(var B=1;BV){if(L.charCodeAt(G+j)===47)return L.slice(G+j+1);if(j===0)return L.slice(G+j)}else $>V&&(M.charCodeAt(B+j)===47?H=j:j===0&&(H=0));break}var U=M.charCodeAt(B+j);if(U!==L.charCodeAt(G+j))break;U===47&&(H=j)}var Q="";for(j=B+H+1;j<=O;++j)j!==O&&M.charCodeAt(j)!==47||(Q.length===0?Q+="..":Q+="/..");return Q.length>0?Q+L.slice(G+H):(G+=H,L.charCodeAt(G)===47&&++G,L.slice(G))},"relative"),_makeLong:S(function(M){return M},"_makeLong"),dirname:S(function(M){if(D(M),M.length===0)return".";for(var L=M.charCodeAt(0),B=L===47,O=-1,$=!0,G=M.length-1;G>=1;--G)if((L=M.charCodeAt(G))===47){if(!$){O=G;break}}else $=!1;return O===-1?B?"/":".":B&&O===1?"//":M.slice(0,O)},"dirname"),basename:S(function(M,L){if(L!==void 0&&typeof L!="string")throw new TypeError('"ext" argument must be a string');D(M);var B,O=0,$=-1,G=!0;if(L!==void 0&&L.length>0&&L.length<=M.length){if(L.length===M.length&&L===M)return"";var F=L.length-1,V=-1;for(B=M.length-1;B>=0;--B){var H=M.charCodeAt(B);if(H===47){if(!G){O=B+1;break}}else V===-1&&(G=!1,V=B+1),F>=0&&(H===L.charCodeAt(F)?--F==-1&&($=B):(F=-1,$=V))}return O===$?$=V:$===-1&&($=M.length),M.slice(O,$)}for(B=M.length-1;B>=0;--B)if(M.charCodeAt(B)===47){if(!G){O=B+1;break}}else $===-1&&(G=!1,$=B+1);return $===-1?"":M.slice(O,$)},"basename"),extname:S(function(M){D(M);for(var L=-1,B=0,O=-1,$=!0,G=0,F=M.length-1;F>=0;--F){var V=M.charCodeAt(F);if(V!==47)O===-1&&($=!1,O=F+1),V===46?L===-1?L=F:G!==1&&(G=1):L!==-1&&(G=-1);else if(!$){B=F+1;break}}return L===-1||O===-1||G===0||G===1&&L===O-1&&L===B+1?"":M.slice(L,O)},"extname"),format:S(function(M){if(M===null||typeof M!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof M);return(function(L,B){var O=B.dir||B.root,$=B.base||(B.name||"")+(B.ext||"");return O?O===B.root?O+$:O+"/"+$:$})(0,M)},"format"),parse:S(function(M){D(M);var L={root:"",dir:"",base:"",ext:"",name:""};if(M.length===0)return L;var B,O=M.charCodeAt(0),$=O===47;$?(L.root="/",B=1):B=0;for(var G=-1,F=0,V=-1,H=!0,j=M.length-1,U=0;j>=B;--j)if((O=M.charCodeAt(j))!==47)V===-1&&(H=!1,V=j+1),O===46?G===-1?G=j:U!==1&&(U=1):G!==-1&&(U=-1);else if(!H){F=j+1;break}return G===-1||V===-1||U===0||U===1&&G===V-1&&G===F+1?V!==-1&&(L.base=L.name=F===0&&$?M.slice(1,V):M.slice(F,V)):(F===0&&$?(L.name=M.slice(1,G),L.base=M.slice(1,V)):(L.name=M.slice(F,G),L.base=M.slice(F,V)),L.ext=M.slice(G,V)),F>0?L.dir=M.slice(0,F-1):$&&(L.dir="/"),L},"parse"),sep:"/",delimiter:":",win32:null,posix:null};R.posix=R,I.exports=R}},t={};function r(I){var D=t[I];if(D!==void 0)return D.exports;var _=t[I]={exports:{}};return e[I](_,_.exports,r),_.exports}o(r,"r"),S(r,"r"),r.d=(I,D)=>{for(var _ in D)r.o(D,_)&&!r.o(I,_)&&Object.defineProperty(I,_,{enumerable:!0,get:D[_]})},r.o=(I,D)=>Object.prototype.hasOwnProperty.call(I,D),r.r=I=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(I,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(I,"__esModule",{value:!0})};var i={};let n;r.r(i),r.d(i,{URI:S(()=>p,"URI"),Utils:S(()=>P,"Utils")}),typeof process=="object"?n=process.platform==="win32":typeof navigator=="object"&&(n=navigator.userAgent.indexOf("Windows")>=0);let a=/^\w[\w\d+.-]*$/,s=/^\//,l=/^\/\//;function u(I,D){if(!I.scheme&&D)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${I.authority}", path: "${I.path}", query: "${I.query}", fragment: "${I.fragment}"}`);if(I.scheme&&!a.test(I.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(I.path){if(I.authority){if(!s.test(I.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(l.test(I.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}o(u,"a"),S(u,"a");let h="",d="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class p{static{o(this,"l")}static{S(this,"l")}static isUri(D){return D instanceof p||!!D&&typeof D.authority=="string"&&typeof D.fragment=="string"&&typeof D.path=="string"&&typeof D.query=="string"&&typeof D.scheme=="string"&&typeof D.fsPath=="string"&&typeof D.with=="function"&&typeof D.toString=="function"}scheme;authority;path;query;fragment;constructor(D,_,R,M,L,B=!1){typeof D=="object"?(this.scheme=D.scheme||h,this.authority=D.authority||h,this.path=D.path||h,this.query=D.query||h,this.fragment=D.fragment||h):(this.scheme=(function(O,$){return O||$?O:"file"})(D,B),this.authority=_||h,this.path=(function(O,$){switch(O){case"https":case"http":case"file":$?$[0]!==d&&($=d+$):$=d}return $})(this.scheme,R||h),this.query=M||h,this.fragment=L||h,u(this,B))}get fsPath(){return b(this,!1)}with(D){if(!D)return this;let{scheme:_,authority:R,path:M,query:L,fragment:B}=D;return _===void 0?_=this.scheme:_===null&&(_=h),R===void 0?R=this.authority:R===null&&(R=h),M===void 0?M=this.path:M===null&&(M=h),L===void 0?L=this.query:L===null&&(L=h),B===void 0?B=this.fragment:B===null&&(B=h),_===this.scheme&&R===this.authority&&M===this.path&&L===this.query&&B===this.fragment?this:new g(_,R,M,L,B)}static parse(D,_=!1){let R=f.exec(D);return R?new g(R[2]||h,k(R[4]||h),k(R[5]||h),k(R[7]||h),k(R[9]||h),_):new g(h,h,h,h,h)}static file(D){let _=h;if(n&&(D=D.replace(/\\/g,d)),D[0]===d&&D[1]===d){let R=D.indexOf(d,2);R===-1?(_=D.substring(2),D=d):(_=D.substring(2,R),D=D.substring(R)||d)}return new g("file",_,D,h,h)}static from(D){let _=new g(D.scheme,D.authority,D.path,D.query,D.fragment);return u(_,!0),_}toString(D=!1){return T(this,D)}toJSON(){return this}static revive(D){if(D){if(D instanceof p)return D;{let _=new g(D);return _._formatted=D.external,_._fsPath=D._sep===m?D.fsPath:null,_}}return D}}let m=n?1:void 0;class g extends p{static{o(this,"d")}static{S(this,"d")}_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=b(this,!1)),this._fsPath}toString(D=!1){return D?T(this,!0):(this._formatted||(this._formatted=T(this,!1)),this._formatted)}toJSON(){let D={$mid:1};return this._fsPath&&(D.fsPath=this._fsPath,D._sep=m),this._formatted&&(D.external=this._formatted),this.path&&(D.path=this.path),this.scheme&&(D.scheme=this.scheme),this.authority&&(D.authority=this.authority),this.query&&(D.query=this.query),this.fragment&&(D.fragment=this.fragment),D}}let y={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function v(I,D,_){let R,M=-1;for(let L=0;L=97&&B<=122||B>=65&&B<=90||B>=48&&B<=57||B===45||B===46||B===95||B===126||D&&B===47||_&&B===91||_&&B===93||_&&B===58)M!==-1&&(R+=encodeURIComponent(I.substring(M,L)),M=-1),R!==void 0&&(R+=I.charAt(L));else{R===void 0&&(R=I.substr(0,L));let O=y[B];O!==void 0?(M!==-1&&(R+=encodeURIComponent(I.substring(M,L)),M=-1),R+=O):M===-1&&(M=L)}}return M!==-1&&(R+=encodeURIComponent(I.substring(M))),R!==void 0?R:I}o(v,"m"),S(v,"m");function x(I){let D;for(let _=0;_1&&I.scheme==="file"?`//${I.authority}${I.path}`:I.path.charCodeAt(0)===47&&(I.path.charCodeAt(1)>=65&&I.path.charCodeAt(1)<=90||I.path.charCodeAt(1)>=97&&I.path.charCodeAt(1)<=122)&&I.path.charCodeAt(2)===58?D?I.path.substr(1):I.path[1].toLowerCase()+I.path.substr(2):I.path,n&&(_=_.replace(/\//g,"\\")),_}o(b,"v"),S(b,"v");function T(I,D){let _=D?x:v,R="",{scheme:M,authority:L,path:B,query:O,fragment:$}=I;if(M&&(R+=M,R+=":"),(L||M==="file")&&(R+=d,R+=d),L){let G=L.indexOf("@");if(G!==-1){let F=L.substr(0,G);L=L.substr(G+1),G=F.lastIndexOf(":"),G===-1?R+=_(F,!1,!1):(R+=_(F.substr(0,G),!1,!1),R+=":",R+=_(F.substr(G+1),!1,!0)),R+="@"}L=L.toLowerCase(),G=L.lastIndexOf(":"),G===-1?R+=_(L,!1,!0):(R+=_(L.substr(0,G),!1,!0),R+=L.substr(G))}if(B){if(B.length>=3&&B.charCodeAt(0)===47&&B.charCodeAt(2)===58){let G=B.charCodeAt(1);G>=65&&G<=90&&(B=`/${String.fromCharCode(G+32)}:${B.substr(3)}`)}else if(B.length>=2&&B.charCodeAt(1)===58){let G=B.charCodeAt(0);G>=65&&G<=90&&(B=`${String.fromCharCode(G+32)}:${B.substr(2)}`)}R+=_(B,!0,!1)}return O&&(R+="?",R+=_(O,!1,!1)),$&&(R+="#",R+=D?$:v($,!1,!1)),R}o(T,"b"),S(T,"b");function w(I){try{return decodeURIComponent(I)}catch{return I.length>3?I.substr(0,3)+w(I.substr(3)):I}}o(w,"C"),S(w,"C");let C=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function k(I){return I.match(C)?I.replace(C,(D=>w(D))):I}o(k,"w"),S(k,"w");var E=r(975);let A=E.posix||E,N="/";var P;(function(I){I.joinPath=function(D,..._){return D.with({path:A.join(D.path,..._)})},I.resolvePath=function(D,..._){let R=D.path,M=!1;R[0]!==N&&(R=N+R,M=!0);let L=A.resolve(R,..._);return M&&L[0]===N&&!D.authority&&(L=L.substring(1)),D.with({path:L})},I.dirname=function(D){if(D.path.length===0||D.path===N)return D;let _=A.dirname(D.path);return _.length===1&&_.charCodeAt(0)===46&&(_=""),D.with({path:_})},I.basename=function(D){return A.basename(D.path)},I.extname=function(D){return A.extname(D.path)}})(P||(P={})),p3e=i})();({URI:fo,Utils:T2}=p3e);(function(e){e.basename=T2.basename,e.dirname=T2.dirname,e.extname=T2.extname,e.joinPath=T2.joinPath,e.resolvePath=T2.resolvePath;let t=typeof process=="object"&&process?.platform==="win32";function r(s,l){return s?.toString()===l?.toString()}o(r,"equals"),S(r,"equals"),e.equals=r;function i(s,l){let u=typeof s=="string"?fo.parse(s).path:s.path,h=typeof l=="string"?fo.parse(l).path:l.path,d=u.split("/").filter(y=>y.length>0),f=h.split("/").filter(y=>y.length>0);if(t){let y=/^[A-Z]:$/;if(d[0]&&y.test(d[0])&&(d[0]=d[0].toLowerCase()),f[0]&&y.test(f[0])&&(f[0]=f[0].toLowerCase()),d[0]!==f[0])return h.substring(1)}let p=0;for(;p({name:i.name,uri:os.joinPath(fo.parse(t),i.name).toString(),element:i.element})):[]}all(){return this.collectValues(this.root)}findAll(e){let t=this.getNode(os.normalize(e),!1);return t?this.collectValues(t):[]}getNode(e,t){let r=e.split("/");e.charAt(e.length-1)==="/"&&r.pop();let i=this.root;for(let n of r){let a=i.children.get(n);if(!a)if(t)a={name:n,children:new Map,parent:i},i.children.set(n,a);else return;i=a}return i}collectValues(e){let t=[];e.element&&t.push(e.element);for(let r of e.children.values())t.push(...this.collectValues(r));return t}};(function(e){e[e.Changed=0]="Changed",e[e.Parsed=1]="Parsed",e[e.IndexedContent=2]="IndexedContent",e[e.ComputedScopes=3]="ComputedScopes",e[e.Linked=4]="Linked",e[e.IndexedReferences=5]="IndexedReferences",e[e.Validated=6]="Validated"})(zr||(zr={}));m3e=class{static{o(this,"DefaultLangiumDocumentFactory")}static{S(this,"DefaultLangiumDocumentFactory")}constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=Ii.CancellationToken.None){let r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,t)}fromTextDocument(e,t,r){return t=t??fo.parse(e.uri),Ii.CancellationToken.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromString(e,t,r){return Ii.CancellationToken.is(r)?this.createAsync(t,e,r):this.create(t,e,r)}fromModel(e,t){return this.create(t,{$model:e})}create(e,t,r){if(typeof t=="string"){let i=this.parse(e,t,r);return this.createLangiumDocument(i,e,void 0,t)}else if("$model"in t){let i={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(i,e)}else{let i=this.parse(e,t.getText(),r);return this.createLangiumDocument(i,e,t)}}async createAsync(e,t,r){if(typeof t=="string"){let i=await this.parseAsync(e,t,r);return this.createLangiumDocument(i,e,void 0,t)}else{let i=await this.parseAsync(e,t.getText(),r);return this.createLangiumDocument(i,e,t)}}createLangiumDocument(e,t,r,i){let n;if(r)n={parseResult:e,uri:t,state:zr.Parsed,references:[],textDocument:r};else{let a=this.createTextDocumentGetter(t,i);n={parseResult:e,uri:t,state:zr.Parsed,references:[],get textDocument(){return a()}}}return e.value.$document=n,n}async update(e,t){let r=e.parseResult.value.$cstNode?.root.fullText,i=this.textDocuments?.get(e.uri.toString()),n=i?i.getText():await this.fileSystemProvider.readFile(e.uri);if(i)Object.defineProperty(e,"textDocument",{value:i});else{let a=this.createTextDocumentGetter(e.uri,n);Object.defineProperty(e,"textDocument",{get:a})}return r!==n&&(e.parseResult=await this.parseAsync(e.uri,n,t),e.parseResult.value.$document=e),e.state=zr.Parsed,e}parse(e,t,r){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(t,r)}parseAsync(e,t,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(t,r)}createTextDocumentGetter(e,t){let r=this.serviceRegistry,i;return()=>i??(i=B5.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,t??""))}},g3e=class{static{o(this,"DefaultLangiumDocuments")}static{S(this,"DefaultLangiumDocuments")}constructor(e){this.documentTrie=new DG,this.services=e,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.documentBuilder=()=>e.workspace.DocumentBuilder}get all(){return gi(this.documentTrie.all())}addDocument(e){let t=e.uri.toString();if(this.documentTrie.has(t))throw new Error(`A document with the URI '${t}' is already present.`);this.documentTrie.insert(t,e)}getDocument(e){let t=e.toString();return this.documentTrie.find(t)}getDocuments(e){let t=e.toString();return this.documentTrie.findAll(t)}async getOrCreateDocument(e,t){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(r),r)}createDocument(e,t,r){if(r)return this.langiumDocumentFactory.fromString(t,e,r).then(i=>(this.addDocument(i),i));{let i=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(i),i}}hasDocument(e){return this.documentTrie.has(e.toString())}invalidateDocument(e){let t=e.toString(),r=this.documentTrie.find(t);return r&&this.documentBuilder().resetToState(r,zr.Changed),r}deleteDocument(e){let t=e.toString(),r=this.documentTrie.find(t);return r&&(r.state=zr.Changed,this.documentTrie.delete(t)),r}deleteDocuments(e){let t=e.toString(),r=this.documentTrie.findAll(t);for(let i of r)i.state=zr.Changed;return this.documentTrie.delete(t),r}},f0=Symbol("RefResolving"),y3e=class{static{o(this,"DefaultLinker")}static{S(this,"DefaultLinker")}constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async link(e,t=Ii.CancellationToken.None){if(this.profiler?.isActive("linking")){let r=this.profiler.createTask("linking",this.languageId);r.start();try{for(let i of ql(e.parseResult.value))await la(t),X1(i).forEach(n=>{let a=`${i.$type}:${n.property}`;r.startSubTask(a);try{this.doLink(n,e)}finally{r.stopSubTask(a)}})}finally{r.stop()}}else for(let r of ql(e.parseResult.value))await la(t),X1(r).forEach(i=>this.doLink(i,e))}doLink(e,t){let r=e.reference;if("_ref"in r&&r._ref===void 0){r._ref=f0;try{let i=this.getCandidate(e);if(g0(i))r._ref=i;else{r._nodeDescription=i;let n=this.loadAstNode(i);r._ref=n??this.createLinkingError(e,i)}}catch(i){console.error(`An error occurred while resolving reference to '${r.$refText}':`,i);let n=i.message??String(i);r._ref={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${n}`}}t.references.push(r)}else if("_items"in r&&r._items===void 0){r._items=f0;try{let i=this.getCandidates(e),n=[];if(g0(i))r._linkingError=i;else for(let a of i){let s=this.loadAstNode(a);s&&n.push({ref:s,$nodeDescription:a})}r._items=n}catch(i){r._linkingError={info:e,message:`An error occurred while resolving reference to '${r.$refText}': ${i}`},r._items=[]}t.references.push(r)}}unlink(e){for(let t of e.references)"_ref"in t?(t._ref=void 0,delete t._nodeDescription):"_items"in t&&(t._items=void 0,delete t._linkingError);e.references=[]}getCandidate(e){return this.scopeProvider.getScope(e).getElement(e.reference.$refText)??this.createLinkingError(e)}getCandidates(e){let r=this.scopeProvider.getScope(e).getElements(e.reference.$refText).distinct(i=>`${i.documentUri}#${i.path}`).toArray();return r.length>0?r:this.createLinkingError(e)}buildReference(e,t,r,i){let n=this,a={$refNode:r,$refText:i,_ref:void 0,get ref(){if(Rn(this._ref))return this._ref;if(f$(this._nodeDescription)){let s=n.loadAstNode(this._nodeDescription);this._ref=s??n.createLinkingError({reference:a,container:e,property:t},this._nodeDescription)}else if(this._ref===void 0){this._ref=f0;let s=V1(e).$document,l=n.getLinkedNode({reference:a,container:e,property:t});if(l.error&&s&&s.state0))return this._linkingError=n.createLinkingError({reference:a,container:e,property:t})}};return a}throwCyclicReferenceError(e,t,r){throw new Error(`Cyclic reference resolution detected: ${this.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`)}getLinkedNode(e){try{let t=this.getCandidate(e);if(g0(t))return{error:t};let r=this.loadAstNode(t);return r?{node:r,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,t);let r=t.message??String(t);return{error:{info:e,message:`An error occurred while resolving reference to '${e.reference.$refText}': ${r}`}}}}loadAstNode(e){if(e.node)return e.node;let t=this.langiumDocuments().getDocument(e.documentUri);if(t)return this.astNodeLocator.getAstNode(t.parseResult.value,e.path)}createLinkingError(e,t){let r=V1(e.container).$document;r&&r.stateY0(t)&&t.isMulti)}findDeclarations(e){if(e){let t=nz(e),r=e.astNode;if(t&&r){let i=r[t.feature];if(ss(i)||Qc(i))return r5(i);if(Array.isArray(i)){for(let n of i)if((ss(n)||Qc(n))&&n.$refNode&&n.$refNode.offset<=e.offset&&n.$refNode.end>=e.end)return r5(n)}}if(r){let i=this.nameProvider.getNameNode(r);if(i&&(i===e||B$(e,i)))return this.getSelfNodes(r)}}return[]}getSelfNodes(e){if(this.hasMultiReference){let t=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e)),r=this.getNodeFromReferenceDescription(t.head());if(r){for(let i of X1(r))if(Qc(i.reference)&&i.reference.items.some(n=>n.ref===e))return i.reference.items.map(n=>n.ref)}return[e]}else return[e]}getNodeFromReferenceDescription(e){if(!e)return;let t=this.documents.getDocument(e.sourceUri);if(t)return this.nodeLocator.getAstNode(t.parseResult.value,e.sourcePath)}findDeclarationNodes(e){let t=this.findDeclarations(e),r=[];for(let i of t){let n=this.nameProvider.getNameNode(i)??i.$cstNode;n&&r.push(n)}return r}findReferences(e,t){let r=[];t.includeDeclaration&&r.push(...this.getSelfReferences(e));let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(i=i.filter(n=>os.equals(n.sourceUri,t.documentUri))),r.push(...i),gi(r)}getSelfReferences(e){let t=this.getSelfNodes(e),r=[];for(let i of t){let n=this.nameProvider.getNameNode(i);if(n){let a=Wl(i),s=this.nodeLocator.getAstNodePath(i);r.push({sourceUri:a.uri,sourcePath:s,targetUri:a.uri,targetPath:s,segment:Q1(n),local:!0})}}return r}},gh=class{static{o(this,"MultiMap")}static{S(this,"MultiMap")}constructor(e){if(this.map=new Map,e)for(let[t,r]of e)this.add(t,r)}get size(){return iT.sum(gi(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(t===void 0)return this.map.delete(e);{let r=this.map.get(e);if(r){let i=r.indexOf(t);if(i>=0)return r.length===1?this.map.delete(e):r.splice(i,1),!0}return!1}}get(e){return this.map.get(e)??[]}getStream(e){let t=this.map.get(e);return t?gi(t):H1}has(e,t){if(t===void 0)return this.map.has(e);{let r=this.map.get(e);return r?r.indexOf(t)>=0:!1}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach((t,r)=>t.forEach(i=>e(i,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return gi(this.map.entries()).flatMap(([e,t])=>t.map(r=>[e,r]))}keys(){return gi(this.map.keys())}values(){return gi(this.map.values()).flat()}entriesGroupedByKey(){return gi(this.map.entries())}},$5=class{static{o(this,"BiMap")}static{S(this,"BiMap")}get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[t,r]of e)this.set(t,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,t){return this.map.set(e,t),this.inverse.set(t,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let t=this.map.get(e);return t!==void 0?(this.map.delete(e),this.inverse.delete(t),!0):!1}},b3e=class{static{o(this,"DefaultScopeComputation")}static{S(this,"DefaultScopeComputation")}constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async collectExportedSymbols(e,t=Ii.CancellationToken.None){return this.collectExportedSymbolsForNode(e.parseResult.value,e,void 0,t)}async collectExportedSymbolsForNode(e,t,r=CT,i=Ii.CancellationToken.None){let n=[];this.addExportedSymbol(e,n,t);for(let a of r(e))await la(i),this.addExportedSymbol(a,n,t);return n}addExportedSymbol(e,t,r){let i=this.nameProvider.getName(e);i&&t.push(this.descriptions.createDescription(e,i,r))}async collectLocalSymbols(e,t=Ii.CancellationToken.None){let r=e.parseResult.value,i=new gh;for(let n of yh(r))await la(t),this.addLocalSymbol(n,e,i);return i}addLocalSymbol(e,t,r){let i=e.$container;if(i){let n=this.nameProvider.getName(e);n&&r.add(i,this.descriptions.createDescription(e,n,t))}}},UF=class{static{o(this,"StreamScope")}static{S(this,"StreamScope")}constructor(e,t,r){this.elements=e,this.outerScope=t,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.find(i=>i.name.toLowerCase()===t):this.elements.find(i=>i.name===e);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getElements(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.caseInsensitive?this.elements.filter(i=>i.name.toLowerCase()===t):this.elements.filter(i=>i.name===e);return(this.concatOuterScope||r.isEmpty())&&this.outerScope?r.concat(this.outerScope.getElements(e)):r}},vvt=class{static{o(this,"MapScope")}static{S(this,"MapScope")}constructor(e,t,r){this.elements=new Map,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0;for(let i of e){let n=this.caseInsensitive?i.name.toLowerCase():i.name;this.elements.set(n,i)}this.outerScope=t}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getElements(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t),i=r?[r]:[];return(this.concatOuterScope||i.length>0)&&this.outerScope?gi(i).concat(this.outerScope.getElements(e)):gi(i)}getAllElements(){let e=gi(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},T3e=class{static{o(this,"MultiMapScope")}static{S(this,"MultiMapScope")}constructor(e,t,r){this.elements=new gh,this.caseInsensitive=r?.caseInsensitive??!1,this.concatOuterScope=r?.concatOuterScope??!0;for(let i of e){let n=this.caseInsensitive?i.name.toLowerCase():i.name;this.elements.add(n,i)}this.outerScope=t}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t)[0];if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getElements(e){let t=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(t);return(this.concatOuterScope||r.length===0)&&this.outerScope?gi(r).concat(this.outerScope.getElements(e)):gi(r)}getAllElements(){let e=gi(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}},xvt={getElement(){},getElements(){return H1},getAllElements(){return H1}},YA=class{static{o(this,"DisposableCache")}static{S(this,"DisposableCache")}constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}},LG=class extends YA{static{o(this,"SimpleCache")}static{S(this,"SimpleCache")}constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,t){this.throwIfDisposed(),this.cache.set(e,t)}get(e,t){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(t){let r=t();return this.cache.set(e,r),r}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},jA=class extends YA{static{o(this,"ContextCache")}static{S(this,"ContextCache")}constructor(e){super(),this.cache=new Map,this.converter=e??(t=>t)}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,r){this.throwIfDisposed(),this.cacheForContext(e).set(t,r)}get(e,t,r){this.throwIfDisposed();let i=this.cacheForContext(e);if(i.has(t))return i.get(t);if(r){let n=r();return i.set(t,n),n}else return}delete(e,t){return this.throwIfDisposed(),this.cacheForContext(e).delete(t)}clear(e){if(this.throwIfDisposed(),e){let t=this.converter(e);this.cache.delete(t)}else this.cache.clear()}cacheForContext(e){let t=this.converter(e),r=this.cache.get(t);return r||(r=new Map,this.cache.set(t,r)),r}},C3e=class extends jA{static{o(this,"DocumentCache")}static{S(this,"DocumentCache")}constructor(e,t){super(r=>r.toString()),t?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(t,r=>{this.clear(r.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{for(let n of i)this.clear(n)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{let n=r.concat(i);for(let a of n)this.clear(a)}))}},MG=class extends LG{static{o(this,"WorkspaceCache")}static{S(this,"WorkspaceCache")}constructor(e,t){super(),t?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(t,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((r,i)=>{i.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}},k3e=class{static{o(this,"DefaultScopeProvider")}static{S(this,"DefaultScopeProvider")}constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new MG(e.shared)}getScope(e){let t=[],r=this.reflection.getReferenceType(e),i=Wl(e.container).localSymbols;if(i){let a=e.container;do i.has(a)&&t.push(i.getStream(a).filter(s=>this.reflection.isSubtype(s.type,r))),a=a.$container;while(a)}let n=this.getGlobalScope(r,e);for(let a=t.length-1;a>=0;a--)n=this.createScope(t[a],n);return n}createScope(e,t,r){return new UF(gi(e),t,r)}createScopeForNodes(e,t,r){let i=gi(e).map(n=>{let a=this.nameProvider.getName(n);if(a)return this.descriptions.createDescription(n,a)}).nonNullable();return new UF(i,t,r)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new T3e(this.indexManager.allElements(e)))}};o(NG,"isAstNodeWithComment");S(NG,"isAstNodeWithComment");o(HF,"isIntermediateReference");S(HF,"isIntermediateReference");w3e=class{static{o(this,"DefaultJsonSerializer")}static{S(this,"DefaultJsonSerializer")}constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,t){let r=t??{},i=t?.replacer,n=S((s,l)=>this.replacer(s,l,r),"defaultReplacer"),a=i?(s,l)=>i(s,l,n):n;try{return this.currentDocument=Wl(e),JSON.stringify(e,a,t?.space)}finally{this.currentDocument=void 0}}deserialize(e,t){let r=t??{},i=JSON.parse(e);return this.linkNode(i,i,r),i}replacer(e,t,{refText:r,sourceText:i,textRegions:n,comments:a,uriConverter:s}){if(!this.ignoreProperties.has(e))if(ss(t)){let l=t.ref,u=r?t.$refText:void 0;if(l){let h=Wl(l),d="";this.currentDocument&&this.currentDocument!==h&&(s?d=s(h.uri,l):d=h.uri.toString());let f=this.astNodeLocator.getAstNodePath(l);return{$ref:`${d}#${f}`,$refText:u}}else return{$error:t.error?.message??"Could not resolve reference",$refText:u}}else if(Qc(t)){let l=r?t.$refText:void 0,u=[];for(let h of t.items){let d=h.ref,f=Wl(h.ref),p="";this.currentDocument&&this.currentDocument!==f&&(s?p=s(f.uri,d):p=f.uri.toString());let m=this.astNodeLocator.getAstNodePath(d);u.push(`${p}#${m}`)}return{$refs:u,$refText:l}}else if(Rn(t)){let l;if(n&&(l=this.addAstNodeRegionWithAssignmentsTo({...t}),(!e||t.$document)&&l?.$textRegion&&(l.$textRegion.documentURI=this.currentDocument?.uri.toString())),i&&!e&&(l??(l={...t}),l.$sourceText=t.$cstNode?.text),a){l??(l={...t});let u=this.commentProvider.getComment(t);u&&(l.$comment=u.replace(/\r/g,""))}return l??t}else return t}addAstNodeRegionWithAssignmentsTo(e){let t=S(r=>({offset:r.offset,end:r.end,length:r.length,range:r.range}),"createDocumentSegment");if(e.$cstNode){let r=e.$textRegion=t(e.$cstNode),i=r.assignments={};return Object.keys(e).filter(n=>!n.startsWith("$")).forEach(n=>{let a=rz(e.$cstNode,n).map(t);a.length!==0&&(i[n]=a)}),e}}linkNode(e,t,r,i,n,a){for(let[l,u]of Object.entries(e))if(Array.isArray(u))for(let h=0;h{await this.handleException(()=>e.call(t,r,i,n),"An error occurred during validation",i,r)}}async handleException(e,t,r,i){try{await e()}catch(n){if(cm(n))throw n;console.error(`${t}:`,n),n instanceof Error&&n.stack&&console.error(n.stack);let a=n instanceof Error?n.message:String(n);r("error",`${t}: ${a}`,{node:i})}}addEntry(e,t){if(e==="AstNode"){this.entries.add("AstNode",t);return}for(let r of this.reflection.getAllSubTypes(e))this.entries.add(r,t)}getChecks(e,t){let r=gi(this.entries.get(e)).concat(this.entries.get("AstNode"));return t&&(r=r.filter(i=>t.includes(i.category))),r.map(i=>i.check)}registerBeforeDocument(e,t=this){this.entriesBefore.push(this.wrapPreparationException(e,"An error occurred during set-up of the validation",t))}registerAfterDocument(e,t=this){this.entriesAfter.push(this.wrapPreparationException(e,"An error occurred during tear-down of the validation",t))}wrapPreparationException(e,t,r){return async(i,n,a,s)=>{await this.handleException(()=>e.call(r,i,n,a,s),t,n,i)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}getAllValidationCategories(e){return this.knownCategories}},A3e=Object.freeze({validateNode:!0,validateChildren:!0}),_3e=class{static{o(this,"DefaultDocumentValidator")}static{S(this,"DefaultDocumentValidator")}constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData,this.profiler=e.shared.profilers.LangiumProfiler,this.languageId=e.LanguageMetaData.languageId}async validateDocument(e,t={},r=Ii.CancellationToken.None){let i=e.parseResult,n=[];if(await la(r),(!t.categories||t.categories.includes("built-in"))&&(this.processLexingErrors(i,n,t),t.stopAfterLexingErrors&&n.some(a=>a.data?.code===Qo.LexingError)||(this.processParsingErrors(i,n,t),t.stopAfterParsingErrors&&n.some(a=>a.data?.code===Qo.ParsingError))||(this.processLinkingErrors(e,n,t),t.stopAfterLinkingErrors&&n.some(a=>a.data?.code===Qo.LinkingError))))return n;try{n.push(...await this.validateAst(i.value,t,r))}catch(a){if(cm(a))throw a;console.error("An error occurred during validation:",a)}return await la(r),n}processLexingErrors(e,t,r){let i=[...e.lexerErrors,...e.lexerReport?.diagnostics??[]];for(let n of i){let a=n.severity??"error",s={severity:J2(a),range:{start:{line:n.line-1,character:n.column-1},end:{line:n.line-1,character:n.column+n.length-1}},message:n.message,data:OG(a),source:this.getSource()};t.push(s)}}processParsingErrors(e,t,r){for(let i of e.parserErrors){let n;if(isNaN(i.token.startOffset)){if("previousToken"in i){let a=i.previousToken;if(isNaN(a.startOffset)){let s={line:0,character:0};n={start:s,end:s}}else{let s={line:a.endLine-1,character:a.endColumn};n={start:s,end:s}}}}else n=nT(i.token);if(n){let a={severity:J2("error"),range:n,message:i.message,data:O0(Qo.ParsingError),source:this.getSource()};t.push(a)}}}processLinkingErrors(e,t,r){for(let i of e.references){let n=i.error;if(n){let a={node:n.info.container,range:i.$refNode?.range,property:n.info.property,index:n.info.index,data:{code:Qo.LinkingError,containerType:n.info.container.$type,property:n.info.property,refText:n.info.reference.$refText}};t.push(this.toDiagnostic("error",n.message,a))}}}async validateAst(e,t,r=Ii.CancellationToken.None){let i=[],n=S((a,s,l)=>{i.push(this.toDiagnostic(a,s,l))},"acceptor");return await this.validateAstBefore(e,t,n,r),await this.validateAstNodes(e,t,n,r),await this.validateAstAfter(e,t,n,r),i}async validateAstBefore(e,t,r,i=Ii.CancellationToken.None){let n=this.validationRegistry.checksBefore;for(let a of n)await la(i),await a(e,r,t.categories??[],i)}async validateAstNodes(e,t,r,i=Ii.CancellationToken.None){if(this.profiler?.isActive("validating")){let n=this.profiler.createTask("validating",this.languageId);n.start();try{let a=ql(e).iterator();for(let s of a){n.startSubTask(s.$type);let l=this.validateSingleNodeOptions(s,t);if(l.validateNode)try{let u=this.validationRegistry.getChecks(s.$type,t.categories);for(let h of u)await h(s,r,i)}finally{n.stopSubTask(s.$type)}l.validateChildren||a.prune()}}finally{n.stop()}}else{let n=ql(e).iterator();for(let a of n){await la(i);let s=this.validateSingleNodeOptions(a,t);if(s.validateNode){let l=this.validationRegistry.getChecks(a.$type,t.categories);for(let u of l)await u(a,r,i)}s.validateChildren||n.prune()}}}validateSingleNodeOptions(e,t){return A3e}async validateAstAfter(e,t,r,i=Ii.CancellationToken.None){let n=this.validationRegistry.checksAfter;for(let a of n)await la(i),await a(e,r,t.categories??[],i)}toDiagnostic(e,t,r){return{message:t,range:IG(r),severity:J2(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};o(IG,"getDiagnosticRange");S(IG,"getDiagnosticRange");o(J2,"toDiagnosticSeverity");S(J2,"toDiagnosticSeverity");o(OG,"toDiagnosticData");S(OG,"toDiagnosticData");(function(e){e.LexingError="lexing-error",e.LexingWarning="lexing-warning",e.LexingInfo="lexing-info",e.LexingHint="lexing-hint",e.ParsingError="parsing-error",e.LinkingError="linking-error"})(Qo||(Qo={}));D3e=class{static{o(this,"DefaultAstNodeDescriptionProvider")}static{S(this,"DefaultAstNodeDescriptionProvider")}constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,r){let i=r??Wl(e);t??(t=this.nameProvider.getName(e));let n=this.astNodeLocator.getAstNodePath(e);if(!t)throw new Error(`Node at path ${n} has no name.`);let a,s=S(()=>a??(a=Q1(this.nameProvider.getNameNode(e)??e.$cstNode)),"nameSegmentGetter");return{node:e,name:t,get nameSegment(){return s()},selectionSegment:Q1(e.$cstNode),type:e.$type,documentUri:i.uri,path:n}}},R3e=class{static{o(this,"DefaultReferenceDescriptionProvider")}static{S(this,"DefaultReferenceDescriptionProvider")}constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=Ii.CancellationToken.None){let r=[],i=e.parseResult.value;for(let n of ql(i))await la(t),X1(n).forEach(a=>{a.reference.error||r.push(...this.createInfoDescriptions(a))});return r}createInfoDescriptions(e){let t=e.reference;if(t.error||!t.$refNode)return[];let r=[];ss(t)&&t.$nodeDescription?r=[t.$nodeDescription]:Qc(t)&&(r=t.items.map(l=>l.$nodeDescription).filter(l=>l!==void 0));let i=Wl(e.container).uri,n=this.nodeLocator.getAstNodePath(e.container),a=[],s=Q1(t.$refNode);for(let l of r)a.push({sourceUri:i,sourcePath:n,targetUri:l.documentUri,targetPath:l.path,segment:s,local:os.equals(l.documentUri,i)});return a}},L3e=class{static{o(this,"DefaultAstNodeLocator")}static{S(this,"DefaultAstNodeLocator")}constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){let t=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return t+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return t!==void 0?e+this.indexSeparator+t:e}getAstNode(e,t){return t.split(this.segmentSeparator).reduce((i,n)=>{if(!i||n.length===0)return i;let a=n.indexOf(this.indexSeparator);if(a>0){let s=n.substring(0,a),l=parseInt(n.substring(a+1));return i[s]?.[l]}return i[n]},e)}},XA={};W5(XA,c$(ny(),1));M3e=class{static{o(this,"DefaultConfigurationProvider")}static{S(this,"DefaultConfigurationProvider")}constructor(e){this._ready=new mh,this.onConfigurationSectionUpdateEmitter=new XA.Emitter,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){this.workspaceConfig=e.capabilities.workspace?.configuration??!1}async initialized(e){if(this.workspaceConfig){if(e.register){let t=this.serviceRegistry.all;e.register({section:t.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let t=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),r=await e.fetchConfiguration(t);t.forEach((i,n)=>{this.updateSectionConfiguration(i.section,r[n])})}}this._ready.resolve()}updateConfiguration(e){typeof e.settings!="object"||e.settings===null||Object.entries(e.settings).forEach(([t,r])=>{this.updateSectionConfiguration(t,r),this.onConfigurationSectionUpdateEmitter.fire({section:t,configuration:r})})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;let r=this.toSectionName(e);if(this.settings[r])return this.settings[r][t]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}},bE=c$(jlt(),1);(function(e){function t(r){return{dispose:S(async()=>await r(),"dispose")}}o(t,"create"),S(t,"create"),e.create=t})(F0||(F0={}));N3e=class{static{o(this,"DefaultDocumentBuilder")}static{S(this,"DefaultDocumentBuilder")}constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new gh,this.documentPhaseListeners=new gh,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=zr.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.fileSystemProvider=e.workspace.FileSystemProvider,this.workspaceManager=()=>e.workspace.WorkspaceManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},r=Ii.CancellationToken.None){for(let i of e){let n=i.uri.toString();if(i.state===zr.Validated){if(typeof t.validation=="boolean"&&t.validation)this.resetToState(i,zr.IndexedReferences);else if(typeof t.validation=="object"){let a=this.findMissingValidationCategories(i,t);a.length>0&&(this.buildState.set(n,{completed:!1,options:{validation:{categories:a}},result:this.buildState.get(n)?.result}),i.state=zr.IndexedReferences)}}else this.buildState.delete(n)}this.currentState=zr.Changed,await this.emitUpdate(e.map(i=>i.uri),[]),await this.buildDocuments(e,t,r)}async update(e,t,r=Ii.CancellationToken.None){this.currentState=zr.Changed;let i=[];for(let l of t){let u=this.langiumDocuments.deleteDocuments(l);for(let h of u)i.push(h.uri),this.cleanUpDeleted(h)}let n=(await Promise.all(e.map(l=>this.findChangedUris(l)))).flat();for(let l of n){let u=this.langiumDocuments.getDocument(l);u===void 0&&(u=this.langiumDocumentFactory.fromModel({$type:"INVALID"},l),u.state=zr.Changed,this.langiumDocuments.addDocument(u)),this.resetToState(u,zr.Changed)}let a=gi(n).concat(i).map(l=>l.toString()).toSet();this.langiumDocuments.all.filter(l=>!a.has(l.uri.toString())&&this.shouldRelink(l,a)).forEach(l=>this.resetToState(l,zr.ComputedScopes)),await this.emitUpdate(n,i),await la(r);let s=this.sortDocuments(this.langiumDocuments.all.filter(l=>l.state=1}findMissingValidationCategories(e,t){let r=this.buildState.get(e.uri.toString()),i=this.serviceRegistry.getServices(e.uri).validation.ValidationRegistry.getAllValidationCategories(e),n=r?.result?.validationChecks?new Set(r?.result?.validationChecks):r?.completed?i:new Set,a=t===void 0||t.validation===!0?i:typeof t.validation=="object"?t.validation.categories??i:[];return gi(a).filter(s=>!n.has(s)).toArray()}async findChangedUris(e){if(this.langiumDocuments.getDocument(e)??this.textDocuments?.get(e))return[e];try{let r=await this.fileSystemProvider.stat(e);if(r.isDirectory)return await this.workspaceManager().searchFolder(e);if(this.workspaceManager().shouldIncludeEntry(r))return[e]}catch{}return[]}async emitUpdate(e,t){await Promise.all(this.updateListeners.map(r=>r(e,t)))}sortDocuments(e){let t=0,r=e.length-1;for(;t=0&&!this.hasTextDocument(e[r]);)r--;tr.error!==void 0)?!0:this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),F0.create(()=>{let t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}resetToState(e,t){switch(t){case zr.Changed:case zr.Parsed:this.indexManager.removeContent(e.uri);case zr.IndexedContent:e.localSymbols=void 0;case zr.ComputedScopes:this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e);case zr.Linked:this.indexManager.removeReferences(e.uri);case zr.IndexedReferences:e.diagnostics=void 0,this.buildState.delete(e.uri.toString());case zr.Validated:}e.state>t&&(e.state=t)}cleanUpDeleted(e){this.buildState.delete(e.uri.toString()),this.indexManager.remove(e.uri),e.state=zr.Changed}async buildDocuments(e,t,r){this.prepareBuild(e,t),await this.runCancelable(e,zr.Parsed,r,a=>this.langiumDocumentFactory.update(a,r)),await this.runCancelable(e,zr.IndexedContent,r,a=>this.indexManager.updateContent(a,r)),await this.runCancelable(e,zr.ComputedScopes,r,async a=>{let s=this.serviceRegistry.getServices(a.uri).references.ScopeComputation;a.localSymbols=await s.collectLocalSymbols(a,r)});let i=e.filter(a=>this.shouldLink(a));await this.runCancelable(i,zr.Linked,r,a=>this.serviceRegistry.getServices(a.uri).references.Linker.link(a,r)),await this.runCancelable(i,zr.IndexedReferences,r,a=>this.indexManager.updateReferences(a,r));let n=e.filter(a=>this.shouldValidate(a)?!0:(this.markAsCompleted(a),!1));await this.runCancelable(n,zr.Validated,r,async a=>{await this.validate(a,r),this.markAsCompleted(a)})}markAsCompleted(e){let t=this.buildState.get(e.uri.toString());t&&(t.completed=!0)}prepareBuild(e,t){for(let r of e){let i=r.uri.toString(),n=this.buildState.get(i);(!n||n.completed)&&this.buildState.set(i,{completed:!1,options:t,result:n?.result})}}async runCancelable(e,t,r,i){for(let a of e)a.statea.state===t);await this.notifyBuildPhase(n,t,r),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),F0.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),F0.create(()=>{this.documentPhaseListeners.delete(e,t)})}waitUntil(e,t,r){let i;return t&&"path"in t?i=t:r=t,r??(r=Ii.CancellationToken.None),i?this.awaitDocumentState(e,i,r):this.awaitBuilderState(e,r)}awaitDocumentState(e,t,r){let i=this.langiumDocuments.getDocument(t);if(i){if(i.state>=e)return Promise.resolve(t);if(r.isCancellationRequested)return Promise.reject(Zc);if(this.currentState>=e&&e>i.state)return Promise.reject(new bE.ResponseError(bE.LSPErrorCodes.RequestFailed,`Document state of ${t.toString()} is ${zr[i.state]}, requiring ${zr[e]}, but workspace state is already ${zr[this.currentState]}. Returning undefined.`))}else return Promise.reject(new bE.ResponseError(bE.LSPErrorCodes.ServerCancelled,`No document found for URI: ${t.toString()}`));return new Promise((n,a)=>{let s=this.onDocumentPhase(e,u=>{os.equals(u.uri,t)&&(s.dispose(),l.dispose(),n(u.uri))}),l=r.onCancellationRequested(()=>{s.dispose(),l.dispose(),a(Zc)})})}awaitBuilderState(e,t){return this.currentState>=e?Promise.resolve():t.isCancellationRequested?Promise.reject(Zc):new Promise((r,i)=>{let n=this.onBuildPhase(e,()=>{n.dispose(),a.dispose(),r()}),a=t.onCancellationRequested(()=>{n.dispose(),a.dispose(),i(Zc)})})}async notifyDocumentPhase(e,t,r){let n=this.documentPhaseListeners.get(t).slice();for(let a of n)try{await la(r),await a(e,r)}catch(s){if(!cm(s))throw s}}async notifyBuildPhase(e,t,r){if(e.length===0)return;let n=this.buildPhaseListeners.get(t).slice();for(let a of n)await la(r),await a(e,r)}shouldLink(e){return this.getBuildOptions(e).eagerLinking??!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,t){let r=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,i=this.getBuildOptions(e),n=typeof i.validation=="object"?{...i.validation}:{};n.categories=this.findMissingValidationCategories(e,i);let a=await r.validateDocument(e,n,t);e.diagnostics?e.diagnostics.push(...a):e.diagnostics=a;let s=this.buildState.get(e.uri.toString());s&&(s.result??(s.result={}),s.result.validationChecks?s.result.validationChecks=gi(s.result.validationChecks).concat(n.categories).distinct().toArray():s.result.validationChecks=[...n.categories])}getBuildOptions(e){return this.buildState.get(e.uri.toString())?.options??{}}},I3e=class{static{o(this,"DefaultIndexManager")}static{S(this,"DefaultIndexManager")}constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new jA,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){let r=Wl(e).uri,i=[];return this.referenceIndex.forEach(n=>{n.forEach(a=>{os.equals(a.targetUri,r)&&a.targetPath===t&&i.push(a)})}),gi(i)}allElements(e,t){let r=gi(this.symbolIndex.keys());return t&&(r=r.filter(i=>!t||t.has(i))),r.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,t){return t?this.symbolByTypeIndex.get(e,t,()=>(this.symbolIndex.get(e)??[]).filter(n=>this.astReflection.isSubtype(n.type,t))):this.symbolIndex.get(e)??[]}remove(e){this.removeContent(e),this.removeReferences(e)}removeContent(e){let t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t)}removeReferences(e){let t=e.toString();this.referenceIndex.delete(t)}async updateContent(e,t=Ii.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.collectExportedSymbols(e,t),n=e.uri.toString();this.symbolIndex.set(n,i),this.symbolByTypeIndex.clear(n)}async updateReferences(e,t=Ii.CancellationToken.None){let i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,t){let r=this.referenceIndex.get(e.uri.toString());return r?r.some(i=>!i.local&&t.has(i.targetUri.toString())):!1}},O3e=class{static{o(this,"DefaultWorkspaceManager")}static{S(this,"DefaultWorkspaceManager")}constructor(e){this.initialBuildOptions={},this._ready=new mh,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){this.folders=e.workspaceFolders??void 0}initialized(e){return this.mutex.write(t=>this.initializeWorkspace(this.folders??[],t))}async initializeWorkspace(e,t=Ii.CancellationToken.None){let r=await this.performStartup(e);await la(t),await this.documentBuilder.build(r,this.initialBuildOptions,t)}async performStartup(e){let t=[],r=S(a=>{t.push(a),this.langiumDocuments.hasDocument(a.uri)||this.langiumDocuments.addDocument(a)},"collector");await this.loadAdditionalDocuments(e,r);let i=[];await Promise.all(e.map(a=>this.getRootFolder(a)).map(async a=>this.traverseFolder(a,i)));let n=gi(i).distinct(a=>a.toString()).filter(a=>!this.langiumDocuments.hasDocument(a));return await this.loadWorkspaceDocuments(n,r),this._ready.resolve(),t}async loadWorkspaceDocuments(e,t){await Promise.all(e.map(async r=>{let i=await this.langiumDocuments.getOrCreateDocument(r);t(i)}))}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return fo.parse(e.uri)}async traverseFolder(e,t){try{let r=await this.fileSystemProvider.readDirectory(e);await Promise.all(r.map(async i=>{this.shouldIncludeEntry(i)&&(i.isDirectory?await this.traverseFolder(i.uri,t):i.isFile&&t.push(i.uri))}))}catch(r){console.error("Failure to read directory content of "+e.toString(!0),r)}}async searchFolder(e){let t=[];return await this.traverseFolder(e,t),t}shouldIncludeEntry(e){let t=os.basename(e.uri);return t.startsWith(".")?!1:e.isDirectory?t!=="node_modules"&&t!=="out":e.isFile?this.serviceRegistry.hasServices(e.uri):!1}},P3e=class{static{o(this,"DefaultLexerErrorMessageProvider")}static{S(this,"DefaultLexerErrorMessageProvider")}buildUnexpectedCharactersMessage(e,t,r,i,n){return SF.buildUnexpectedCharactersMessage(e,t,r,i,n)}buildUnableToPopLexerModeMessage(e){return SF.buildUnableToPopLexerModeMessage(e)}},PG={mode:"full"},BG=class{static{o(this,"DefaultLexer")}static{S(this,"DefaultLexer")}constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;let t=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(t);let r=G5(t)?Object.values(t):t,i=e.LanguageMetaData.mode==="production";this.chevrotainLexer=new ls(r,{positionTracking:"full",skipValidations:i,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=PG){let r=this.chevrotainLexer.tokenize(e);return{tokens:r.tokens,errors:r.errors,hidden:r.groups.hidden??[],report:this.tokenBuilder.flushLexingReport?.(e)}}toTokenTypeDictionary(e){if(G5(e))return e;let t=ZA(e)?Object.values(e.modes).flat():e,r={};return t.forEach(i=>r[i.name]=i),r}};o(KA,"isTokenTypeArray");S(KA,"isTokenTypeArray");o(ZA,"isIMultiModeLexerDefinition");S(ZA,"isIMultiModeLexerDefinition");o(G5,"isTokenTypeDictionary");S(G5,"isTokenTypeDictionary");bT();o(FG,"parseJSDoc");S(FG,"parseJSDoc");o($G,"isJSDoc");S($G,"isJSDoc");o(zG,"getLines");S(zG,"getLines");Fye=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,bvt=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;o(B3e,"tokenize");S(B3e,"tokenize");o(F3e,"buildInlineTokens");S(F3e,"buildInlineTokens");Tvt=/\S/,Cvt=/\s*$/;o(V5,"skipWhitespace");S(V5,"skipWhitespace");o($3e,"lastCharacter");S($3e,"lastCharacter");o(z3e,"parseJSDocComment");S(z3e,"parseJSDocComment");o(G3e,"parseJSDocElement");S(G3e,"parseJSDocElement");o(V3e,"appendEmptyLine");S(V3e,"appendEmptyLine");o(GG,"parseJSDocText");S(GG,"parseJSDocText");o(W3e,"parseJSDocInline");S(W3e,"parseJSDocInline");o(VG,"parseJSDocTag");S(VG,"parseJSDocTag");o(WG,"parseJSDocLine");S(WG,"parseJSDocLine");o(QA,"normalizeOptions");S(QA,"normalizeOptions");o(JE,"normalizeOption");S(JE,"normalizeOption");$ye=class{static{o(this,"JSDocCommentImpl")}static{S(this,"JSDocCommentImpl")}constructor(e,t){this.elements=e,this.range=t}getTag(e){return this.getAllTags().find(t=>t.name===e)}getTags(e){return this.getAllTags().filter(t=>t.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(let t of this.elements)if(e.length===0)e=t.toString();else{let r=t.toString();e+=jF(e)+r}return e.trim()}toMarkdown(e){let t="";for(let r of this.elements)if(t.length===0)t=r.toMarkdown(e);else{let i=r.toMarkdown(e);t+=jF(t)+i}return t.trim()}},tB=class{static{o(this,"JSDocTagImpl")}static{S(this,"JSDocTagImpl")}constructor(e,t,r,i){this.name=e,this.content=t,this.inline=r,this.range=i}toString(){let e=`@${this.name}`,t=this.content.toString();return this.content.inlines.length===1?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e} +${t}`),this.inline?`{${e}}`:e}toMarkdown(e){return e?.renderTag?.(this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){let t=this.content.toMarkdown(e);if(this.inline){let n=q3e(this.name,t,e??{});if(typeof n=="string")return n}let r="";e?.tag==="italic"||e?.tag===void 0?r="*":e?.tag==="bold"?r="**":e?.tag==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} \u2014 ${t}`:this.content.inlines.length>1&&(i=`${i} +${t}`),this.inline?`{${i}}`:i}};o(q3e,"renderInlineTag");S(q3e,"renderInlineTag");o(U3e,"renderLinkDefault");S(U3e,"renderLinkDefault");YF=class{static{o(this,"JSDocTextImpl")}static{S(this,"JSDocTextImpl")}constructor(e,t){this.inlines=e,this.range=t}toString(){let e="";for(let t=0;tr.range.start.line&&(e+=` +`)}return e}toMarkdown(e){let t="";for(let r=0;ri.range.start.line&&(t+=` +`)}return t}},H3e=class{static{o(this,"JSDocLineImpl")}static{S(this,"JSDocLineImpl")}constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}};o(jF,"fillNewlines");S(jF,"fillNewlines");Y3e=class{static{o(this,"JSDocDocumentationProvider")}static{S(this,"JSDocDocumentationProvider")}constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let t=this.commentProvider.getComment(e);if(t&&$G(t))return FG(t).toMarkdown({renderLink:S((i,n)=>this.documentationLinkRenderer(e,i,n),"renderLink"),renderTag:S(i=>this.documentationTagRenderer(e,i),"renderTag")})}documentationLinkRenderer(e,t,r){let i=this.findNameInLocalSymbols(e,t)??this.findNameInGlobalScope(e,t);if(i&&i.nameSegment){let n=i.nameSegment.range.start.line+1,a=i.nameSegment.range.start.character+1,s=i.documentUri.with({fragment:`L${n},${a}`});return`[${r}](${s.toString()})`}else return}documentationTagRenderer(e,t){}findNameInLocalSymbols(e,t){let i=Wl(e).localSymbols;if(!i)return;let n=e;do{let s=i.getStream(n).find(l=>l.name===t);if(s)return s;n=n.$container}while(n)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(i=>i.name===t)}},j3e=class{static{o(this,"DefaultCommentProvider")}static{S(this,"DefaultCommentProvider")}constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return NG(e)?e.$comment:G$(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}},X3e=class{static{o(this,"DefaultAsyncParser")}static{S(this,"DefaultAsyncParser")}constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}},kvt=class{static{o(this,"AbstractThreadedAsyncParser")}static{S(this,"AbstractThreadedAsyncParser")}constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length{if(this.queue.length>0){let t=this.queue.shift();t&&(e.lock(),t.resolve(e))}}),this.workerPool.push(e)}}async parse(e,t){let r=await this.acquireParserWorker(t),i=new mh,n,a=t.onCancellationRequested(()=>{n=setTimeout(()=>{this.terminateWorker(r)},this.terminationDelay)});return r.parse(e).then(s=>{let l=this.hydrator.hydrate(s);i.resolve(l)}).catch(s=>{i.reject(s)}).finally(()=>{a.dispose(),clearTimeout(n)}),i.promise}terminateWorker(e){e.terminate();let t=this.workerPool.indexOf(e);t>=0&&this.workerPool.splice(t,1)}async acquireParserWorker(e){this.initializeWorkers();for(let r of this.workerPool)if(r.ready)return r.lock(),r;let t=new mh;return e.onCancellationRequested(()=>{let r=this.queue.indexOf(t);r>=0&&this.queue.splice(r,1),t.reject(Zc)}),this.queue.push(t),t.promise}},wvt=class{static{o(this,"ParserWorker")}static{S(this,"ParserWorker")}get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,t,r,i){this.onReadyEmitter=new XA.Emitter,this.deferred=new mh,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=i,t(n=>{let a=n;this.deferred.resolve(a),this.unlock()}),r(n=>{this.deferred.reject(n),this.unlock()})}terminate(){this.deferred.reject(Zc),this._terminate()}lock(){this._ready=!1}unlock(){this._parsing=!1,this._ready=!0,this.onReadyEmitter.fire()}parse(e){if(this._parsing)throw new Error("Parser worker is busy");return this._parsing=!0,this.deferred=new mh,this.sendMessage(e),this.deferred.promise}},K3e=class{static{o(this,"DefaultWorkspaceLock")}static{S(this,"DefaultWorkspaceLock")}constructor(){this.previousTokenSource=new Ii.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let t=HA();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,r=Ii.CancellationToken.None){let i=new mh,n={action:t,deferred:i,cancellationToken:r};return e.push(n),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:t,deferred:r,cancellationToken:i})=>{try{let n=await Promise.resolve().then(()=>t(i));r.resolve(n)}catch(n){cm(n)?r.resolve(void 0):r.reject(n)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}},Z3e=class{static{o(this,"DefaultHydrator")}static{S(this,"DefaultHydrator")}constructor(e){this.grammarElementIdMap=new $5,this.tokenTypeIdMap=new $5,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(t=>({...t,message:t.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){let t=new Map,r=new Map;for(let i of ql(e))t.set(i,{});if(e.$cstNode)for(let i of Z1(e.$cstNode))r.set(i,{});return{astNodes:t,cstNodes:r}}dehydrateAstNode(e,t){let r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(let[i,n]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(n)){let a=[];r[i]=a;for(let s of n)Rn(s)?a.push(this.dehydrateAstNode(s,t)):ss(s)?a.push(this.dehydrateReference(s,t)):a.push(s)}else Rn(n)?r[i]=this.dehydrateAstNode(n,t):ss(n)?r[i]=this.dehydrateReference(n,t):n!==void 0&&(r[i]=n);return r}dehydrateReference(e,t){let r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=t.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,t){let r=t.cstNodes.get(e);return H5(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=t.astNodes.get(e.astNode),oh(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,t)):q0(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){let t=e.value,r=this.createHydrationContext(t);return"$cstNode"in t&&this.hydrateCstNode(t.$cstNode,r),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,r)}}createHydrationContext(e){let t=new Map,r=new Map;for(let n of ql(e))t.set(n,{});let i;if(e.$cstNode)for(let n of Z1(e.$cstNode)){let a;"fullText"in n?(a=new yG(n.fullText),i=a):"content"in n?a=new GA:"tokenType"in n&&(a=this.hydrateCstLeafNode(n)),a&&(r.set(n,a),a.root=i)}return{astNodes:t,cstNodes:r}}hydrateAstNode(e,t){let r=t.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=t.cstNodes.get(e.$cstNode));for(let[i,n]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(n)){let a=[];r[i]=a;for(let s of n)Rn(s)?a.push(this.setParent(this.hydrateAstNode(s,t),r)):ss(s)?a.push(this.hydrateReference(s,r,i,t)):a.push(s)}else Rn(n)?r[i]=this.setParent(this.hydrateAstNode(n,t),r):ss(n)?r[i]=this.hydrateReference(n,r,i,t):n!==void 0&&(r[i]=n);return r}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,r,i){return this.linker.buildReference(t,r,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,r=0){let i=t.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=t.astNodes.get(e.astNode),oh(i))for(let n of e.content){let a=this.hydrateCstNode(n,t,r++);i.content.push(a)}return i}hydrateCstLeafNode(e){let t=this.getTokenType(e.tokenType),r=e.offset,i=e.length,n=e.startLine,a=e.startColumn,s=e.endLine,l=e.endColumn,u=e.hidden;return new I5(r,i,{start:{line:n,character:a},end:{line:s,character:l}},t,u)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(let t of ql(this.grammar))Y5(t)&&this.grammarElementIdMap.set(t,e++)}};o(rn,"createDefaultCoreModule");S(rn,"createDefaultCoreModule");o(nn,"createDefaultSharedCoreModule");S(nn,"createDefaultSharedCoreModule");(function(e){e.merge=(t,r)=>iy(iy({},t),r)})(XF||(XF={}));o(Hr,"inject");S(Hr,"inject");Q3e=Symbol("isProxy");o(qG,"eagerLoad");S(qG,"eagerLoad");o(UG,"_inject");S(UG,"_inject");zye=Symbol();o(KF,"_resolve");S(KF,"_resolve");o(iy,"_merge");S(iy,"_merge");ZF={indentTokenName:"INDENT",dedentTokenName:"DEDENT",whitespaceTokenName:"WS",ignoreIndentationDelimiters:[]};(function(e){e.REGULAR="indentation-sensitive",e.IGNORE_INDENTATION="ignore-indentation"})(P0||(P0={}));J3e=class extends qA{static{o(this,"IndentationAwareTokenBuilder")}static{S(this,"IndentationAwareTokenBuilder")}constructor(e=ZF){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options={...ZF,...e},this.indentTokenType=q1({name:this.options.indentTokenName,pattern:this.indentMatcher.bind(this),line_breaks:!1}),this.dedentTokenType=q1({name:this.options.dedentTokenName,pattern:this.dedentMatcher.bind(this),line_breaks:!1})}buildTokens(e,t){let r=super.buildTokens(e,t);if(!KA(r))throw new Error("Invalid tokens built by default builder");let{indentTokenName:i,dedentTokenName:n,whitespaceTokenName:a,ignoreIndentationDelimiters:s}=this.options,l,u,h,d=[];for(let f of r){for(let[p,m]of s)f.name===p?f.PUSH_MODE=P0.IGNORE_INDENTATION:f.name===m&&(f.POP_MODE=!0);f.name===n?l=f:f.name===i?u=f:f.name===a?h=f:d.push(f)}if(!l||!u||!h)throw new Error("Some indentation/whitespace tokens not found!");return s.length>0?{modes:{[P0.REGULAR]:[l,u,...d,h],[P0.IGNORE_INDENTATION]:[...d,h]},defaultMode:P0.REGULAR}:[l,u,h,...d]}flushLexingReport(e){return{...super.flushLexingReport(e),remainingDedents:this.flushRemainingDedents(e)}}isStartOfLine(e,t){return t===0||`\r +`.includes(e[t-1])}matchWhitespace(e,t,r,i){this.whitespaceRegExp.lastIndex=t;let n=this.whitespaceRegExp.exec(e);return{currIndentLevel:n?.[0].length??0,prevIndentLevel:this.indentationStack.at(-1),match:n}}createIndentationTokenInstance(e,t,r,i){let n=this.getLineNumber(t,i);return PT(e,r,i,i+r.length,n,n,1,r.length)}getLineNumber(e,t){return e.substring(0,t).split(/\r\n|\r|\n/).length}indentMatcher(e,t,r,i){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:n,prevIndentLevel:a,match:s}=this.matchWhitespace(e,t,r,i);return n<=a?null:(this.indentationStack.push(n),s)}dedentMatcher(e,t,r,i){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:n,prevIndentLevel:a,match:s}=this.matchWhitespace(e,t,r,i);if(n>=a)return null;let l=this.indentationStack.lastIndexOf(n);if(l===-1)return this.diagnostics.push({severity:"error",message:`Invalid dedent level ${n} at offset: ${t}. Current indentation stack: ${this.indentationStack}`,offset:t,length:s?.[0]?.length??0,line:this.getLineNumber(e,t),column:1}),null;let u=this.indentationStack.length-l-1,h=e.substring(0,t).match(/[\r\n]+$/)?.[0].length??1;for(let d=0;d1;)t.push(this.createIndentationTokenInstance(this.dedentTokenType,e,"",e.length)),this.indentationStack.pop();return this.indentationStack=[0],t}},Svt=class extends BG{static{o(this,"IndentationAwareLexer")}static{S(this,"IndentationAwareLexer")}constructor(e){if(super(e),e.parser.TokenBuilder instanceof J3e)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw new Error("IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder")}tokenize(e,t=PG){let r=super.tokenize(e),i=r.report;t?.mode==="full"&&r.tokens.push(...i.remainingDedents),i.remainingDedents=[];let{indentTokenType:n,dedentTokenType:a}=this.indentationTokenBuilder,s=n.tokenTypeIdx,l=a.tokenTypeIdx,u=[],h=r.tokens.length-1;for(let d=0;d=0&&u.push(r.tokens[h]),r.tokens=u,r}},HG={};xf(HG,{AstUtils:o(()=>m$,"AstUtils"),BiMap:o(()=>$5,"BiMap"),Cancellation:o(()=>Ii,"Cancellation"),ContextCache:o(()=>jA,"ContextCache"),CstUtils:o(()=>d$,"CstUtils"),DONE_RESULT:o(()=>as,"DONE_RESULT"),Deferred:o(()=>mh,"Deferred"),Disposable:o(()=>F0,"Disposable"),DisposableCache:o(()=>YA,"DisposableCache"),DocumentCache:o(()=>C3e,"DocumentCache"),EMPTY_STREAM:o(()=>H1,"EMPTY_STREAM"),ErrorWithLocation:o(()=>eA,"ErrorWithLocation"),GrammarUtils:o(()=>U$,"GrammarUtils"),MultiMap:o(()=>gh,"MultiMap"),OperationCancelled:o(()=>Zc,"OperationCancelled"),Reduction:o(()=>iT,"Reduction"),RegExpUtils:o(()=>Y$,"RegExpUtils"),SimpleCache:o(()=>LG,"SimpleCache"),StreamImpl:o(()=>Kc,"StreamImpl"),TreeStreamImpl:o(()=>Y1,"TreeStreamImpl"),URI:o(()=>fo,"URI"),UriTrie:o(()=>DG,"UriTrie"),UriUtils:o(()=>os,"UriUtils"),WorkspaceCache:o(()=>MG,"WorkspaceCache"),assertCondition:o(()=>H$,"assertCondition"),assertUnreachable:o(()=>bf,"assertUnreachable"),delayNextTick:o(()=>UA,"delayNextTick"),interruptAndCheck:o(()=>la,"interruptAndCheck"),isOperationCancelled:o(()=>cm,"isOperationCancelled"),loadGrammarFromJson:o(()=>xo,"loadGrammarFromJson"),setInterruptionPeriod:o(()=>EG,"setInterruptionPeriod"),startCancelableOperation:o(()=>HA,"startCancelableOperation"),stream:o(()=>gi,"stream")});W5(HG,XA);eEe=class{static{o(this,"EmptyFileSystemProvider")}static{S(this,"EmptyFileSystemProvider")}stat(e){throw new Error("No file system is available.")}statSync(e){throw new Error("No file system is available.")}async exists(){return!1}existsSync(){return!1}readBinary(){throw new Error("No file system is available.")}readBinarySync(){throw new Error("No file system is available.")}readFile(){throw new Error("No file system is available.")}readFileSync(){throw new Error("No file system is available.")}async readDirectory(){return[]}readDirectorySync(){return[]}},fn={fileSystemProvider:S(()=>new eEe,"fileSystemProvider")},Evt={Grammar:S(()=>{},"Grammar"),LanguageMetaData:S(()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"}),"LanguageMetaData")},Avt={AstReflection:S(()=>new P$,"AstReflection")};o(tEe,"createMinimalGrammarServices");S(tEe,"createMinimalGrammarServices");o(xo,"loadGrammarFromJson");S(xo,"loadGrammarFromJson");W5(uve,HG);_vt=class{static{o(this,"DefaultLangiumProfiler")}static{S(this,"DefaultLangiumProfiler")}constructor(e){this.activeCategories=new Set,this.allCategories=new Set(["validating","parsing","linking"]),this.activeCategories=e??new Set(this.allCategories),this.records=new gh}isActive(e){return this.activeCategories.has(e)}start(...e){e?e.forEach(t=>this.activeCategories.add(t)):this.activeCategories=new Set(this.allCategories)}stop(...e){e?e.forEach(t=>this.activeCategories.delete(t)):this.activeCategories.clear()}createTask(e,t){if(!this.isActive(e))throw new Error(`Category "${e}" is not active.`);return console.log(`Creating profiling task for '${e}.${t}'.`),new rEe(r=>this.records.add(e,this.dumpRecord(e,r)),t)}dumpRecord(e,t){console.info(`Task ${e}.${t.identifier} executed in ${t.duration.toFixed(2)}ms and ended at ${t.date.toISOString()}`);let r=[];for(let a of t.entries.keys()){let s=t.entries.get(a),l=s.reduce((u,h)=>u+h);r.push({name:`${t.identifier}.${a}`,count:s.length,duration:l})}let i=t.duration-r.map(a=>a.duration).reduce((a,s)=>a+s,0);r.push({name:t.identifier,count:1,duration:i}),r.sort((a,s)=>s.duration-a.duration);function n(a){return Math.round(100*a)/100}return o(n,"Round"),S(n,"Round"),console.table(r.map(a=>({Element:a.name,Count:a.count,"Self %":n(100*a.duration/t.duration),"Time (ms)":n(a.duration)}))),t}getRecords(...e){return e.length===0?this.records.values():this.records.entries().filter(t=>e.some(r=>r===t[0])).flatMap(t=>t[1])}},rEe=class{static{o(this,"ProfilingTask")}static{S(this,"ProfilingTask")}constructor(e,t){this.stack=[],this.entries=new gh,this.addRecord=e,this.identifier=t}start(){if(this.startTime!==void 0)throw new Error(`Task "${this.identifier}" is already started.`);this.startTime=performance.now()}stop(){if(this.startTime===void 0)throw new Error(`Task "${this.identifier}" was not started.`);if(this.stack.length!==0)throw new Error(`Task "${this.identifier}" cannot be stopped before sub-task(s): ${this.stack.map(t=>t.id).join(", ")}.`);let e={identifier:this.identifier,date:new Date,duration:performance.now()-this.startTime,entries:this.entries};this.addRecord(e),this.startTime=void 0,this.entries.clear()}startSubTask(e){this.stack.push({id:e,start:performance.now(),content:0})}stopSubTask(e){let t=this.stack.pop();if(!t)throw new Error(`Task "${this.identifier}.${e}" was not started.`);if(t.id!==e)throw new Error(`Sub-Task "${t.id}" is not already stopped.`);let r=performance.now()-t.start;this.stack.at(-1)!==void 0&&(this.stack[this.stack.length-1].content+=r);let i=r-t.content;this.entries.add(e,i)}};(e=>{e.Terminals={ARROW_DIRECTION:/L|R|T|B/,ARROW_GROUP:/\{group\}/,ARROW_INTO:/<|>/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,ARCH_ICON:/\([\w-:]+\)/,ARCH_TITLE:/\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[\w ]+)\]/}})(QF||(QF={}));(e=>{e.Terminals={EM_ID:/[_a-zA-Z][\w_]*/,EM_FID:/\d{1,3}/,EM_DATA_INLINE:/\{(.*)\}|"(.*)"|'(.*)'/,EM_DATA_BLOCK:/\{[\t ]*\r?\n(?:[\S\s]*?\r?\n)?\}(?:\r?\n|(?!\S))/,EM_ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,EM_ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,EM_TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,EM_WS:/\s+/,EM_YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,EM_DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,EM_SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,EM_ML_COMMENT:/\/\*[\s\S]*?\*\//,EM_SL_COMMENT:/\/\/[^\n\r]*/}})(JF||(JF={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/,REFERENCE:/\w([-\./\w]*[-\w])?/}})(e$||(e$={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(t$||(t$={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(r$||(r$={}));(e=>{e.Terminals={NUMBER_PIE:/(?:-?[0-9]+\.[0-9]+(?!\.))|(?:-?(0|[1-9][0-9]*)(?!\.))/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(i$||(i$={}));(e=>{e.Terminals={GRATICULE:/circle|polygon/,BOOLEAN:/true|false/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,NUMBER:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(n$||(n$={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,TREEMAP_KEYWORD:/treemap-beta|treemap/,CLASS_DEF:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/,STYLE_SEPARATOR:/:::/,SEPARATOR:/:/,COMMA:/,/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,ID2:/[a-zA-Z_][a-zA-Z0-9_]*/,NUMBER2:/[0-9_\.\,]+/,STRING2:/"[^"]*"|'[^']*'/}})(a$||(a$={}));(e=>{e.Terminals={ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INDENTATION:/[ \t]{1,}/,WS:/[ \t]+/,ML_COMMENT:/\%\%[^\n]*/,NL:/\r?\n/,STRING2:/"[^"]*"|'[^']*'/}})(s$||(s$={}));(e=>{e.Terminals={WARDLEY_NUMBER:/[0-9]+\.[0-9]+/,ARROW:/->/,LINK_PORT:/\+<>|\+>|\+|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/,LINK_LABEL:/;[^\n\r]+/,STRATEGY:/build|buy|outsource|market/,KW_WARDLEY:/wardley-beta/,KW_SIZE:/size/,KW_EVOLUTION:/evolution/,KW_ANCHOR:/anchor/,KW_COMPONENT:/component/,KW_LABEL:/label/,KW_INERTIA:/inertia/,KW_EVOLVE:/evolve/,KW_PIPELINE:/pipeline/,KW_NOTE:/note/,KW_ANNOTATIONS:/annotations/,KW_ANNOTATION:/annotation/,KW_ACCELERATOR:/accelerator/,KW_DEACCELERATOR:/deaccelerator/,NAME_WITH_SPACES:/(?!title\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/,WS:/[ \t]+/,ACC_DESCR:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/,ACC_TITLE:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/,TITLE:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/,INT:/0|[1-9][0-9]*(?!\.)/,STRING:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/,ID:/[\w]([-\w]*\w)?/,NEWLINE:/\r?\n/,WHITESPACE:/[\t ]+/,YAML:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/,DIRECTIVE:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/,SINGLE_LINE_COMMENT:/[\t ]*%%[^\n\r]*/}})(o$||(o$={}));Dwr={...QF.Terminals,...JF.Terminals,...e$.Terminals,...t$.Terminals,...r$.Terminals,...i$.Terminals,...n$.Terminals,...s$.Terminals,...a$.Terminals,...o$.Terminals},TE={$type:"Accelerator",name:"name",x:"x",y:"y"},CE={$type:"Anchor",evolution:"evolution",name:"name",visibility:"visibility"},C2={$type:"Annotation",number:"number",text:"text",x:"x",y:"y"},rB={$type:"Annotations",x:"x",y:"y"},Yc={$type:"Architecture",accDescr:"accDescr",accTitle:"accTitle",edges:"edges",groups:"groups",junctions:"junctions",services:"services",title:"title"};o(iEe,"isArchitecture");S(iEe,"isArchitecture");kE={$type:"Axis",label:"label",name:"name"},eT={$type:"Branch",name:"name",order:"order"};o(nEe,"isBranch");S(nEe,"isBranch");Gye={$type:"Checkout",branch:"branch"},wE={$type:"CherryPicking",id:"id",parent:"parent",tags:"tags"},iB={$type:"ClassDefStatement",className:"className",styleText:"styleText"},_0={$type:"Commit",id:"id",message:"message",tags:"tags",type:"type"};o(aEe,"isCommit");S(aEe,"isCommit");SE={$type:"Common",accDescr:"accDescr",accTitle:"accTitle",title:"title"},s0={$type:"Component",decorator:"decorator",evolution:"evolution",inertia:"inertia",label:"label",name:"name",visibility:"visibility"},EE={$type:"Curve",entries:"entries",label:"label",name:"name"},AE={$type:"Deaccelerator",name:"name",x:"x",y:"y"},Vye={$type:"Decorator",strategy:"strategy"},w1={$type:"Direction",accDescr:"accDescr",accTitle:"accTitle",dir:"dir",statements:"statements",title:"title"},Wc={$type:"Edge",lhsDir:"lhsDir",lhsGroup:"lhsGroup",lhsId:"lhsId",lhsInto:"lhsInto",rhsDir:"rhsDir",rhsGroup:"rhsGroup",rhsId:"rhsId",rhsInto:"rhsInto",title:"title"},p0={$type:"EmDataEntity",dataBlockValue:"dataBlockValue",dataType:"dataType",name:"name"},af={$type:"EmFrame"},k2={$type:"EmGwt",givenStatements:"givenStatements",sourceFrame:"sourceFrame",thenStatements:"thenStatements",whenStatements:"whenStatements"},Wye={$type:"EmGwtStatement",entityIdentifier:"entityIdentifier"},nB={$type:"EmModelEntity",name:"name"};o(sEe,"isEmModelEntityType");S(sEe,"isEmModelEntityType");_E={$type:"EmNoteEntity",dataBlockValue:"dataBlockValue",dataType:"dataType",sourceFrame:"sourceFrame"},ih={$type:"EmResetFrame",dataInlineValue:"dataInlineValue",dataReference:"dataReference",dataType:"dataType",entityIdentifier:"entityIdentifier",modelEntityType:"modelEntityType",name:"name",sourceFrames:"sourceFrames"};o(JA,"isEmResetFrame");S(JA,"isEmResetFrame");nf={$type:"EmTimeFrame",dataInlineValue:"dataInlineValue",dataReference:"dataReference",dataType:"dataType",entityIdentifier:"entityIdentifier",modelEntityType:"modelEntityType",name:"name",sourceFrames:"sourceFrames"},aB={$type:"Entry",axis:"axis",value:"value"},Uc={$type:"EventModel",accDescr:"accDescr",accTitle:"accTitle",dataEntities:"dataEntities",frames:"frames",gwtEntities:"gwtEntities",modelEntities:"modelEntities",noteEntities:"noteEntities",title:"title"},qye={$type:"Evolution",stages:"stages"},DE={$type:"EvolutionStage",boundary:"boundary",name:"name",secondName:"secondName"},sB={$type:"Evolve",component:"component",target:"target"},df={$type:"GitGraph",accDescr:"accDescr",accTitle:"accTitle",statements:"statements",title:"title"};o(oEe,"isGitGraph");S(oEe,"isGitGraph");w2={$type:"Group",icon:"icon",id:"id",in:"in",title:"title"},G1={$type:"Info",accDescr:"accDescr",accTitle:"accTitle",title:"title"};o(lEe,"isInfo");S(lEe,"isInfo");S2={$type:"Item",classSelector:"classSelector",name:"name"},oB={$type:"Junction",id:"id",in:"in"},E2={$type:"Label",negX:"negX",negY:"negY",offsetX:"offsetX",offsetY:"offsetY"},RE={$type:"Leaf",classSelector:"classSelector",name:"name",value:"value"},o0={$type:"Link",arrow:"arrow",from:"from",fromPort:"fromPort",linkLabel:"linkLabel",to:"to",toPort:"toPort"},D0={$type:"Merge",branch:"branch",id:"id",tags:"tags",type:"type"};o(cEe,"isMerge");S(cEe,"isMerge");LE={$type:"Note",evolution:"evolution",text:"text",visibility:"visibility"},lB={$type:"Option",name:"name",value:"value"},R0={$type:"Packet",accDescr:"accDescr",accTitle:"accTitle",blocks:"blocks",title:"title"};o(uEe,"isPacket");S(uEe,"isPacket");L0={$type:"PacketBlock",bits:"bits",end:"end",label:"label",start:"start"};o(hEe,"isPacketBlock");S(hEe,"isPacketBlock");ff={$type:"Pie",accDescr:"accDescr",accTitle:"accTitle",sections:"sections",showData:"showData",title:"title"};o(dEe,"isPie");S(dEe,"isPie");tT={$type:"PieSection",label:"label",value:"value"};o(fEe,"isPieSection");S(fEe,"isPieSection");cB={$type:"Pipeline",components:"components",parent:"parent"},ME={$type:"PipelineComponent",evolution:"evolution",label:"label",name:"name"},sf={$type:"Radar",accDescr:"accDescr",accTitle:"accTitle",axes:"axes",curves:"curves",options:"options",title:"title"},uB={$type:"Section",classSelector:"classSelector",name:"name"},S1={$type:"Service",icon:"icon",iconText:"iconText",id:"id",in:"in",title:"title"},hB={$type:"Size",height:"height",width:"width"},m0={$type:"Statement"},M0={$type:"Treemap",accDescr:"accDescr",accTitle:"accTitle",title:"title",TreemapRows:"TreemapRows"};o(pEe,"isTreemap");S(pEe,"isTreemap");dB={$type:"TreemapRow",indent:"indent",item:"item"},e5={$type:"TreeNode",indent:"indent",name:"name"},M1={$type:"TreeView",accDescr:"accDescr",accTitle:"accTitle",nodes:"nodes",title:"title"},oa={$type:"Wardley",accDescr:"accDescr",accelerators:"accelerators",accTitle:"accTitle",anchors:"anchors",annotation:"annotation",annotations:"annotations",components:"components",deaccelerators:"deaccelerators",evolution:"evolution",evolves:"evolves",links:"links",notes:"notes",pipelines:"pipelines",size:"size",title:"title"};o(mEe,"isWardley");S(mEe,"isWardley");gEe=class extends p${static{o(this,"MermaidAstReflection")}constructor(){super(...arguments),this.types={Accelerator:{name:TE.$type,properties:{name:{name:TE.name},x:{name:TE.x},y:{name:TE.y}},superTypes:[]},Anchor:{name:CE.$type,properties:{evolution:{name:CE.evolution},name:{name:CE.name},visibility:{name:CE.visibility}},superTypes:[]},Annotation:{name:C2.$type,properties:{number:{name:C2.number},text:{name:C2.text},x:{name:C2.x},y:{name:C2.y}},superTypes:[]},Annotations:{name:rB.$type,properties:{x:{name:rB.x},y:{name:rB.y}},superTypes:[]},Architecture:{name:Yc.$type,properties:{accDescr:{name:Yc.accDescr},accTitle:{name:Yc.accTitle},edges:{name:Yc.edges,defaultValue:[]},groups:{name:Yc.groups,defaultValue:[]},junctions:{name:Yc.junctions,defaultValue:[]},services:{name:Yc.services,defaultValue:[]},title:{name:Yc.title}},superTypes:[]},Axis:{name:kE.$type,properties:{label:{name:kE.label},name:{name:kE.name}},superTypes:[]},Branch:{name:eT.$type,properties:{name:{name:eT.name},order:{name:eT.order}},superTypes:[m0.$type]},Checkout:{name:Gye.$type,properties:{branch:{name:Gye.branch}},superTypes:[m0.$type]},CherryPicking:{name:wE.$type,properties:{id:{name:wE.id},parent:{name:wE.parent},tags:{name:wE.tags,defaultValue:[]}},superTypes:[m0.$type]},ClassDefStatement:{name:iB.$type,properties:{className:{name:iB.className},styleText:{name:iB.styleText}},superTypes:[]},Commit:{name:_0.$type,properties:{id:{name:_0.id},message:{name:_0.message},tags:{name:_0.tags,defaultValue:[]},type:{name:_0.type}},superTypes:[m0.$type]},Common:{name:SE.$type,properties:{accDescr:{name:SE.accDescr},accTitle:{name:SE.accTitle},title:{name:SE.title}},superTypes:[]},Component:{name:s0.$type,properties:{decorator:{name:s0.decorator},evolution:{name:s0.evolution},inertia:{name:s0.inertia,defaultValue:!1},label:{name:s0.label},name:{name:s0.name},visibility:{name:s0.visibility}},superTypes:[]},Curve:{name:EE.$type,properties:{entries:{name:EE.entries,defaultValue:[]},label:{name:EE.label},name:{name:EE.name}},superTypes:[]},Deaccelerator:{name:AE.$type,properties:{name:{name:AE.name},x:{name:AE.x},y:{name:AE.y}},superTypes:[]},Decorator:{name:Vye.$type,properties:{strategy:{name:Vye.strategy}},superTypes:[]},Direction:{name:w1.$type,properties:{accDescr:{name:w1.accDescr},accTitle:{name:w1.accTitle},dir:{name:w1.dir},statements:{name:w1.statements,defaultValue:[]},title:{name:w1.title}},superTypes:[df.$type]},Edge:{name:Wc.$type,properties:{lhsDir:{name:Wc.lhsDir},lhsGroup:{name:Wc.lhsGroup,defaultValue:!1},lhsId:{name:Wc.lhsId},lhsInto:{name:Wc.lhsInto,defaultValue:!1},rhsDir:{name:Wc.rhsDir},rhsGroup:{name:Wc.rhsGroup,defaultValue:!1},rhsId:{name:Wc.rhsId},rhsInto:{name:Wc.rhsInto,defaultValue:!1},title:{name:Wc.title}},superTypes:[]},EmDataEntity:{name:p0.$type,properties:{dataBlockValue:{name:p0.dataBlockValue},dataType:{name:p0.dataType},name:{name:p0.name}},superTypes:[]},EmFrame:{name:af.$type,properties:{},superTypes:[]},EmGwt:{name:k2.$type,properties:{givenStatements:{name:k2.givenStatements,defaultValue:[]},sourceFrame:{name:k2.sourceFrame,referenceType:af.$type},thenStatements:{name:k2.thenStatements,defaultValue:[]},whenStatements:{name:k2.whenStatements,defaultValue:[]}},superTypes:[]},EmGwtStatement:{name:Wye.$type,properties:{entityIdentifier:{name:Wye.entityIdentifier,referenceType:nB.$type}},superTypes:[]},EmModelEntity:{name:nB.$type,properties:{name:{name:nB.name}},superTypes:[]},EmNoteEntity:{name:_E.$type,properties:{dataBlockValue:{name:_E.dataBlockValue},dataType:{name:_E.dataType},sourceFrame:{name:_E.sourceFrame,referenceType:af.$type}},superTypes:[]},EmResetFrame:{name:ih.$type,properties:{dataInlineValue:{name:ih.dataInlineValue},dataReference:{name:ih.dataReference,referenceType:p0.$type},dataType:{name:ih.dataType},entityIdentifier:{name:ih.entityIdentifier},modelEntityType:{name:ih.modelEntityType},name:{name:ih.name},sourceFrames:{name:ih.sourceFrames,defaultValue:[],referenceType:af.$type}},superTypes:[af.$type]},EmTimeFrame:{name:nf.$type,properties:{dataInlineValue:{name:nf.dataInlineValue},dataReference:{name:nf.dataReference,referenceType:p0.$type},dataType:{name:nf.dataType},entityIdentifier:{name:nf.entityIdentifier},modelEntityType:{name:nf.modelEntityType},name:{name:nf.name},sourceFrames:{name:nf.sourceFrames,defaultValue:[],referenceType:af.$type}},superTypes:[af.$type]},Entry:{name:aB.$type,properties:{axis:{name:aB.axis,referenceType:kE.$type},value:{name:aB.value}},superTypes:[]},EventModel:{name:Uc.$type,properties:{accDescr:{name:Uc.accDescr},accTitle:{name:Uc.accTitle},dataEntities:{name:Uc.dataEntities,defaultValue:[]},frames:{name:Uc.frames,defaultValue:[]},gwtEntities:{name:Uc.gwtEntities,defaultValue:[]},modelEntities:{name:Uc.modelEntities,defaultValue:[]},noteEntities:{name:Uc.noteEntities,defaultValue:[]},title:{name:Uc.title}},superTypes:[]},Evolution:{name:qye.$type,properties:{stages:{name:qye.stages,defaultValue:[]}},superTypes:[]},EvolutionStage:{name:DE.$type,properties:{boundary:{name:DE.boundary},name:{name:DE.name},secondName:{name:DE.secondName}},superTypes:[]},Evolve:{name:sB.$type,properties:{component:{name:sB.component},target:{name:sB.target}},superTypes:[]},GitGraph:{name:df.$type,properties:{accDescr:{name:df.accDescr},accTitle:{name:df.accTitle},statements:{name:df.statements,defaultValue:[]},title:{name:df.title}},superTypes:[]},Group:{name:w2.$type,properties:{icon:{name:w2.icon},id:{name:w2.id},in:{name:w2.in},title:{name:w2.title}},superTypes:[]},Info:{name:G1.$type,properties:{accDescr:{name:G1.accDescr},accTitle:{name:G1.accTitle},title:{name:G1.title}},superTypes:[]},Item:{name:S2.$type,properties:{classSelector:{name:S2.classSelector},name:{name:S2.name}},superTypes:[]},Junction:{name:oB.$type,properties:{id:{name:oB.id},in:{name:oB.in}},superTypes:[]},Label:{name:E2.$type,properties:{negX:{name:E2.negX,defaultValue:!1},negY:{name:E2.negY,defaultValue:!1},offsetX:{name:E2.offsetX},offsetY:{name:E2.offsetY}},superTypes:[]},Leaf:{name:RE.$type,properties:{classSelector:{name:RE.classSelector},name:{name:RE.name},value:{name:RE.value}},superTypes:[S2.$type]},Link:{name:o0.$type,properties:{arrow:{name:o0.arrow},from:{name:o0.from},fromPort:{name:o0.fromPort},linkLabel:{name:o0.linkLabel},to:{name:o0.to},toPort:{name:o0.toPort}},superTypes:[]},Merge:{name:D0.$type,properties:{branch:{name:D0.branch},id:{name:D0.id},tags:{name:D0.tags,defaultValue:[]},type:{name:D0.type}},superTypes:[m0.$type]},Note:{name:LE.$type,properties:{evolution:{name:LE.evolution},text:{name:LE.text},visibility:{name:LE.visibility}},superTypes:[]},Option:{name:lB.$type,properties:{name:{name:lB.name},value:{name:lB.value,defaultValue:!1}},superTypes:[]},Packet:{name:R0.$type,properties:{accDescr:{name:R0.accDescr},accTitle:{name:R0.accTitle},blocks:{name:R0.blocks,defaultValue:[]},title:{name:R0.title}},superTypes:[]},PacketBlock:{name:L0.$type,properties:{bits:{name:L0.bits},end:{name:L0.end},label:{name:L0.label},start:{name:L0.start}},superTypes:[]},Pie:{name:ff.$type,properties:{accDescr:{name:ff.accDescr},accTitle:{name:ff.accTitle},sections:{name:ff.sections,defaultValue:[]},showData:{name:ff.showData,defaultValue:!1},title:{name:ff.title}},superTypes:[]},PieSection:{name:tT.$type,properties:{label:{name:tT.label},value:{name:tT.value}},superTypes:[]},Pipeline:{name:cB.$type,properties:{components:{name:cB.components,defaultValue:[]},parent:{name:cB.parent}},superTypes:[]},PipelineComponent:{name:ME.$type,properties:{evolution:{name:ME.evolution},label:{name:ME.label},name:{name:ME.name}},superTypes:[]},Radar:{name:sf.$type,properties:{accDescr:{name:sf.accDescr},accTitle:{name:sf.accTitle},axes:{name:sf.axes,defaultValue:[]},curves:{name:sf.curves,defaultValue:[]},options:{name:sf.options,defaultValue:[]},title:{name:sf.title}},superTypes:[]},Section:{name:uB.$type,properties:{classSelector:{name:uB.classSelector},name:{name:uB.name}},superTypes:[S2.$type]},Service:{name:S1.$type,properties:{icon:{name:S1.icon},iconText:{name:S1.iconText},id:{name:S1.id},in:{name:S1.in},title:{name:S1.title}},superTypes:[]},Size:{name:hB.$type,properties:{height:{name:hB.height},width:{name:hB.width}},superTypes:[]},Statement:{name:m0.$type,properties:{},superTypes:[]},TreeNode:{name:e5.$type,properties:{indent:{name:e5.indent},name:{name:e5.name}},superTypes:[]},TreeView:{name:M1.$type,properties:{accDescr:{name:M1.accDescr},accTitle:{name:M1.accTitle},nodes:{name:M1.nodes,defaultValue:[]},title:{name:M1.title}},superTypes:[]},Treemap:{name:M0.$type,properties:{accDescr:{name:M0.accDescr},accTitle:{name:M0.accTitle},title:{name:M0.title},TreemapRows:{name:M0.TreemapRows,defaultValue:[]}},superTypes:[]},TreemapRow:{name:dB.$type,properties:{indent:{name:dB.indent},item:{name:dB.item}},superTypes:[]},Wardley:{name:oa.$type,properties:{accDescr:{name:oa.accDescr},accelerators:{name:oa.accelerators,defaultValue:[]},accTitle:{name:oa.accTitle},anchors:{name:oa.anchors,defaultValue:[]},annotation:{name:oa.annotation,defaultValue:[]},annotations:{name:oa.annotations,defaultValue:[]},components:{name:oa.components,defaultValue:[]},deaccelerators:{name:oa.deaccelerators,defaultValue:[]},evolution:{name:oa.evolution},evolves:{name:oa.evolves,defaultValue:[]},links:{name:oa.links,defaultValue:[]},notes:{name:oa.notes,defaultValue:[]},pipelines:{name:oa.pipelines,defaultValue:[]},size:{name:oa.size},title:{name:oa.title}},superTypes:[]}}}static{S(this,"MermaidAstReflection")}},bo=new gEe,Dvt=S(()=>Uye??(Uye=xo(`{"$type":"Grammar","isDeclared":true,"name":"ArchitectureGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Architecture","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"LeftPort","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"RightPort","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Arrow","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@18"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@19"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[(?:\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'|[\\\\w ]+)\\\\]/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)),"ArchitectureGrammarGrammar"),Rvt=S(()=>Hye??(Hye=xo('{"$type":"Grammar","isDeclared":true,"name":"EventModeling","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","entry":true,"name":"EventModel","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"eventmodeling"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"frames","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"dataEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"noteEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"gwtEntities","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmModelEntityType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rmo"},{"$type":"Keyword","value":"readmodel"},{"$type":"Keyword","value":"ui"},{"$type":"Keyword","value":"cmd"},{"$type":"Keyword","value":"command"},{"$type":"Keyword","value":"evt"},{"$type":"Keyword","value":"event"},{"$type":"Keyword","value":"pcr"},{"$type":"Keyword","value":"processor"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmDataType","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"json"},{"$type":"Keyword","value":"jsobj"},{"$type":"Keyword","value":"figma"},{"$type":"Keyword","value":"salt"},{"$type":"Keyword","value":"uri"},{"$type":"Keyword","value":"md"},{"$type":"Keyword","value":"html"},{"$type":"Keyword","value":"text"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"EmDataInline","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"`"},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":"`"}],"cardinality":"?"},{"$type":"Assignment","feature":"dataInlineValue","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"EmDataBlock","definition":{"$type":"Group","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"`"},{"$type":"Assignment","feature":"dataType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":"`"}],"cardinality":"?"},{"$type":"Assignment","feature":"dataBlockValue","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"QualifiedName","dataType":"string","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"."},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}],"cardinality":"*"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmTimeFrame","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"tf"},{"$type":"Keyword","value":"timeframe"}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntityType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"->>"},{"$type":"Assignment","feature":"sourceFrames","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"[["},{"$type":"Assignment","feature":"dataReference","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@10"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"]]"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmResetFrame","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"rf"},{"$type":"Keyword","value":"resetframe"}]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"modelEntityType","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"->>"},{"$type":"Assignment","feature":"sourceFrames","operator":"+=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"[["},{"$type":"Assignment","feature":"dataReference","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@10"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"]]"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmFrame","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmModelEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"entity"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmDataEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"data"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmNoteEntity","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"note"},{"$type":"Assignment","feature":"sourceFrame","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmGwt","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"gwt"},{"$type":"Assignment","feature":"sourceFrame","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@8"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":"given"},{"$type":"Assignment","feature":"givenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"},{"$type":"Group","elements":[{"$type":"Keyword","value":"when"},{"$type":"Assignment","feature":"whenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"}],"cardinality":"?"},{"$type":"Keyword","value":"then"},{"$type":"Assignment","feature":"thenStatements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"+"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EmGwtStatement","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},{"$type":"Assignment","feature":"entityIdentifier","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@9"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EM_EID","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EM_FI","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"EM_ID","definition":{"$type":"RegexToken","regex":"/[_a-zA-Z][\\\\w_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_FID","definition":{"$type":"RegexToken","regex":"/\\\\d{1,3}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_DATA_INLINE","definition":{"$type":"RegexToken","regex":"/\\\\{(.*)\\\\}|\\"(.*)\\"|\'(.*)\'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_DATA_BLOCK","definition":{"$type":"RegexToken","regex":"/\\\\{[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?\\\\}(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"EM_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"EM_WS","definition":{"$type":"RegexToken","regex":"/\\\\s+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"EM_SL_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\/\\\\/[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"imports":[],"types":[]}')),"EventModelingGrammar"),Lvt=S(()=>Yye??(Yye=xo(`{"$type":"Grammar","isDeclared":true,"name":"GitGraphGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"GitGraph","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@14"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","name":"REFERENCE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[],"types":[]}`)),"GitGraphGrammarGrammar"),Mvt=S(()=>jye??(jye=xo(`{"$type":"Grammar","isDeclared":true,"name":"InfoGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Info","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"?"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@7"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"InfoGrammarGrammar"),Nvt=S(()=>Xye??(Xye=xo(`{"$type":"Grammar","isDeclared":true,"name":"PacketGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Packet","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"packet"},{"$type":"Keyword","value":"packet-beta"}]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}],"cardinality":"?"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"+"},{"$type":"Assignment","feature":"bits","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]}]},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@8"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@9"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"PacketGrammarGrammar"),Ivt=S(()=>Kye??(Kye=xo(`{"$type":"Grammar","isDeclared":true,"name":"PieGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Pie","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"FLOAT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/-?(0|[1-9][0-9]*)(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER_PIE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@2"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@3"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@11"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@12"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"PieGrammarGrammar"),Ovt=S(()=>Zye??(Zye=xo(`{"$type":"Grammar","isDeclared":true,"name":"RadarGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Radar","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":"radar-beta:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"radar-beta"},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]},{"$type":"Group","elements":[{"$type":"Keyword","value":"axis"},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"axes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"curve"},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"curves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"options","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}}],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Label","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Axis","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Curve","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Keyword","value":"}"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Entries","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":","},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"},{"$type":"Assignment","feature":"entries","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"*"}]}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"DetailedEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"axis","operator":"=","terminal":{"$type":"CrossReference","type":{"$ref":"#/rules@2"},"terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},"deprecatedSyntax":false,"isMulti":false}},{"$type":"Keyword","value":":","cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"NumberEntry","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Option","definition":{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"showLegend"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"ticks"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"max"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"min"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Keyword","value":"graticule"}},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"GRATICULE","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"circle"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"polygon"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@15"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@16"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[{"$type":"Interface","name":"Entry","attributes":[{"$type":"TypeAttribute","name":"axis","isOptional":true,"type":{"$type":"ReferenceType","referenceType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@2"}},"isMulti":false}},{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}],"superTypes":[]}],"types":[]}`)),"RadarGrammarGrammar"),Pvt=S(()=>Qye??(Qye=xo(`{"$type":"Grammar","isDeclared":true,"name":"TreemapGrammar","rules":[{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"Treemap","returnType":{"$ref":"#/interfaces@4"},"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"TreemapRows","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"TREEMAP_KEYWORD","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap-beta"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"treemap"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"CLASS_DEF","definition":{"$type":"RegexToken","regex":"/classDef\\\\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\\\\s+([^;\\\\r\\\\n]*))?(?:;)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STYLE_SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":::"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"SEPARATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":":"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"COMMA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":","},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreemapRow","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"item","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"ClassDef","dataType":"string","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Item","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Section","returnType":{"$ref":"#/interfaces@1"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Leaf","returnType":{"$ref":"#/interfaces@2"},"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},{"$type":"Assignment","feature":"classSelector","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"ID2","definition":{"$type":"RegexToken","regex":"/[a-zA-Z_][a-zA-Z0-9_]*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER2","definition":{"$type":"RegexToken","regex":"/[0-9_\\\\.\\\\,]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"MyNumber","dataType":"number","definition":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"Item","attributes":[{"$type":"TypeAttribute","name":"name","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"classSelector","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]},{"$type":"Interface","name":"Section","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[]},{"$type":"Interface","name":"Leaf","superTypes":[{"$ref":"#/interfaces@0"}],"attributes":[{"$type":"TypeAttribute","name":"value","type":{"$type":"SimpleType","primitiveType":"number"},"isOptional":false}]},{"$type":"Interface","name":"ClassDefStatement","attributes":[{"$type":"TypeAttribute","name":"className","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false},{"$type":"TypeAttribute","name":"styleText","type":{"$type":"SimpleType","primitiveType":"string"},"isOptional":false}],"superTypes":[]},{"$type":"Interface","name":"Treemap","attributes":[{"$type":"TypeAttribute","name":"TreemapRows","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@15"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * Treemap grammar for Langium\\n * Converted from mindmap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treemap declaration.\\n */"}`)),"TreemapGrammarGrammar"),Bvt=S(()=>Jye??(Jye=xo(`{"$type":"Grammar","isDeclared":true,"name":"TreeViewGrammar","rules":[{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"ParserRule","entry":true,"name":"TreeView","returnType":{"$ref":"#/interfaces@0"},"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"treeView-beta"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[],"cardinality":"?"},{"$type":"Assignment","feature":"nodes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]},"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"INDENTATION","definition":{"$type":"RegexToken","regex":"/[ \\\\t]{1,}/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"ML_COMMENT","definition":{"$type":"RegexToken","regex":"/\\\\%\\\\%[^\\\\n]*/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"NL","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"TreeNode","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"indent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"STRING2","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/","parenthesized":false},"fragment":false,"hidden":false}],"interfaces":[{"$type":"Interface","name":"TreeView","attributes":[{"$type":"TypeAttribute","name":"nodes","type":{"$type":"ArrayType","elementType":{"$type":"SimpleType","typeRef":{"$ref":"#/rules@9"}}},"isOptional":false},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"imports":[],"types":[],"$comment":"/**\\n * TreeView grammar for Langium\\n * Converted from treemap grammar\\n *\\n * The ML_COMMENT and NL hidden terminals handle whitespace, comments, and newlines\\n * before the treemap keyword, allowing for empty lines and comments before the\\n * treeView declaration.\\n */"}`)),"TreeViewGrammarGrammar"),Fvt=S(()=>eve??(eve=xo(`{"$type":"Grammar","isDeclared":true,"name":"WardleyGrammar","imports":[],"rules":[{"$type":"ParserRule","entry":true,"name":"Wardley","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@25"},"arguments":[]},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@42"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"*"}]},"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"size","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"anchors","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"links","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Assignment","feature":"evolves","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"pipelines","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"notes","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Assignment","feature":"annotations","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]}},{"$type":"Assignment","feature":"annotation","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]}},{"$type":"Assignment","feature":"accelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}},{"$type":"Assignment","feature":"deaccelerators","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}]},"entry":false,"parameters":[]},{"$type":"ParserRule","name":"Size","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@26"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"width","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"height","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolution","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@27"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]},{"$type":"Assignment","feature":"stages","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}}],"cardinality":"+"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"EvolutionStage","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"@"},{"$type":"Assignment","feature":"boundary","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}}],"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"/"},{"$type":"Assignment","feature":"secondName","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}}],"cardinality":"?"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Anchor","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@28"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Component","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"decorator","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"inertia","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@31"},"arguments":[]}},{"$type":"Keyword","value":")"}]}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Label","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@30"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"negX","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetX","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"negY","operator":"?=","terminal":{"$type":"Keyword","value":"-"},"cardinality":"?"},{"$type":"Assignment","feature":"offsetY","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":"]"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Decorator","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"("},{"$type":"Assignment","feature":"strategy","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@24"},"arguments":[]}},{"$type":"Keyword","value":")"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Link","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"from","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"fromPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"arrow","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@22"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]},"cardinality":"?"},{"$type":"Assignment","feature":"to","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"toPort","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"linkLabel","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@23"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Evolve","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@32"},"arguments":[]},{"$type":"Assignment","feature":"component","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Assignment","feature":"target","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Pipeline","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@33"},"arguments":[]},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"{"},{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"components","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"+"},{"$type":"Keyword","value":"}"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"PipelineComponent","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@29"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Note","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@34"},"arguments":[]},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"visibility","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"evolution","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotations","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@35"},"arguments":[]},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Annotation","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@36"},"arguments":[]},{"$type":"Assignment","feature":"number","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"Assignment","feature":"text","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"CoordinateValue","dataType":"number","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@48"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Accelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@37"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","name":"Deaccelerator","definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@38"},"arguments":[]},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@50"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@51"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@39"},"arguments":[]}]}},{"$type":"Keyword","value":"["},{"$type":"Assignment","feature":"x","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":","},{"$type":"Assignment","feature":"y","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Keyword","value":"]"},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"TerminalRule","name":"WARDLEY_NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"->"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_PORT","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<>"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+>"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"+<"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_ARROW","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-->"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"-.->"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":">"},"parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'<>/","parenthesized":false}],"parenthesized":false},{"$type":"RegexToken","regex":"/\\\\+'[^']*'/","parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"LINK_LABEL","definition":{"$type":"RegexToken","regex":"/;[^\\\\n\\\\r]+/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRATEGY","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"build"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"buy"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"outsource"},"parenthesized":false}],"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"market"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_WARDLEY","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"wardley-beta"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_SIZE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"size"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLUTION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolution"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANCHOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"anchor"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_COMPONENT","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"component"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_LABEL","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"label"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_INERTIA","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"inertia"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_EVOLVE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"evolve"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_PIPELINE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"pipeline"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_NOTE","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"note"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATIONS","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotations"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ANNOTATION","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"annotation"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_ACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"accelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"KW_DEACCELERATOR","definition":{"$type":"CharacterRange","left":{"$type":"Keyword","value":"deaccelerator"},"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NAME_WITH_SPACES","definition":{"$type":"RegexToken","regex":"/(?!title\\\\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \\\\t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WS","definition":{"$type":"RegexToken","regex":"/[ \\\\t]+/","parenthesized":false},"fragment":false},{"$type":"ParserRule","name":"EOL","dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@52"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"entry":false,"fragment":false,"parameters":[]},{"$type":"ParserRule","fragment":true,"name":"TitleAndAccessibilities","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@44"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@45"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@46"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@41"},"arguments":[]}],"cardinality":"+"},"entry":false,"parameters":[]},{"$type":"TerminalRule","name":"BOOLEAN","type":{"$type":"ReturnType","name":"boolean"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"true"},"parenthesized":false},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"false"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"FLOAT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+\\\\.[0-9]+(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*(?!\\\\.)/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NUMBER","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@47"},"parenthesized":false},{"$type":"TerminalRuleCall","rule":{"$ref":"#/rules@48"},"parenthesized":false}],"parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\"([^\\"\\\\\\\\]|\\\\\\\\.)*\\"|'([^'\\\\\\\\]|\\\\\\\\.)*'/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/[\\\\w]([-\\\\w]*\\\\w)?/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/","parenthesized":false},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/","parenthesized":false},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/","parenthesized":false},"fragment":false}],"interfaces":[],"types":[]}`)),"WardleyGrammarGrammar"),$vt={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},zvt={languageId:"eventmodeling",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Gvt={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Vvt={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Wvt={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},qvt={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Uvt={languageId:"radar",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Hvt={languageId:"treemap",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},Yvt={languageId:"treeView",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},jvt={languageId:"wardley",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1,mode:"production"},xn={AstReflection:S(()=>new gEe,"AstReflection")},YG={Grammar:S(()=>Dvt(),"Grammar"),LanguageMetaData:S(()=>$vt,"LanguageMetaData"),parser:{}},jG={Grammar:S(()=>Rvt(),"Grammar"),LanguageMetaData:S(()=>zvt,"LanguageMetaData"),parser:{}},XG={Grammar:S(()=>Lvt(),"Grammar"),LanguageMetaData:S(()=>Gvt,"LanguageMetaData"),parser:{}},KG={Grammar:S(()=>Mvt(),"Grammar"),LanguageMetaData:S(()=>Vvt,"LanguageMetaData"),parser:{}},ZG={Grammar:S(()=>Nvt(),"Grammar"),LanguageMetaData:S(()=>Wvt,"LanguageMetaData"),parser:{}},QG={Grammar:S(()=>Ivt(),"Grammar"),LanguageMetaData:S(()=>qvt,"LanguageMetaData"),parser:{}},JG={Grammar:S(()=>Ovt(),"Grammar"),LanguageMetaData:S(()=>Uvt,"LanguageMetaData"),parser:{}},eV={Grammar:S(()=>Pvt(),"Grammar"),LanguageMetaData:S(()=>Hvt,"LanguageMetaData"),parser:{}},tV={Grammar:S(()=>Bvt(),"Grammar"),LanguageMetaData:S(()=>Yvt,"LanguageMetaData"),parser:{}},rV={Grammar:S(()=>Fvt(),"Grammar"),LanguageMetaData:S(()=>jvt,"LanguageMetaData"),parser:{}},Xvt=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,Kvt=/accTitle[\t ]*:([^\n\r]*)/,Zvt=/title([\t ][^\n\r]*|)/,Qvt={ACC_DESCR:Xvt,ACC_TITLE:Kvt,TITLE:Zvt},nl=class extends SG{static{o(this,"AbstractMermaidValueConverter")}static{S(this,"AbstractMermaidValueConverter")}runConverter(e,t,r){let i=this.runCommonConverter(e,t,r);return i===void 0&&(i=this.runCustomConverter(e,t,r)),i===void 0?super.runConverter(e,t,r):i}runCommonConverter(e,t,r){let i=Qvt[e.name];if(i===void 0)return;let n=i.exec(t);if(n!==null){if(n[1]!==void 0)return n[1].trim().replace(/[\t ]{2,}/gm," ");if(n[2]!==void 0)return n[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,` +`)}}},Kl=class extends nl{static{o(this,"CommonValueConverter")}static{S(this,"CommonValueConverter")}runCustomConverter(e,t,r){}},Ln=class extends qA{static{o(this,"AbstractMermaidTokenBuilder")}static{S(this,"AbstractMermaidTokenBuilder")}constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,t,r){let i=super.buildKeywordTokens(e,t,r);return i.forEach(n=>{this.keywords.has(n.name)&&n.PATTERN!==void 0&&(n.PATTERN=new RegExp(n.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),i}},Jvt=class extends Ln{static{o(this,"CommonTokenBuilder")}static{S(this,"CommonTokenBuilder")}};});function t6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),JG,e6);return t.ServiceRegistry.register(r),{shared:t,Radar:r}}var ext,e6,iV=z(()=>{"use strict";pn();ext=class extends Ln{static{o(this,"RadarTokenBuilder")}static{S(this,"RadarTokenBuilder")}constructor(){super(["radar-beta"])}},e6={parser:{TokenBuilder:S(()=>new ext,"TokenBuilder"),ValueConverter:S(()=>new Kl,"ValueConverter")}};o(t6,"createRadarServices");S(t6,"createRadarServices")});function yEe(e){let t=e.validation.TreemapValidator,r=e.validation.ValidationRegistry;if(r){let i={Treemap:t.checkSingleRoot.bind(t)};r.register(i,t)}}function i6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),eV,r6);return t.ServiceRegistry.register(r),yEe(r),{shared:t,Treemap:r}}var txt,rxt,ixt,nxt,r6,nV=z(()=>{"use strict";pn();txt=class extends Ln{static{o(this,"TreemapTokenBuilder")}static{S(this,"TreemapTokenBuilder")}constructor(){super(["treemap"])}},rxt=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/,ixt=class extends nl{static{o(this,"TreemapValueConverter")}static{S(this,"TreemapValueConverter")}runCustomConverter(e,t,r){if(e.name==="NUMBER2")return parseFloat(t.replace(/,/g,""));if(e.name==="SEPARATOR")return t.substring(1,t.length-1);if(e.name==="STRING2")return t.substring(1,t.length-1);if(e.name==="INDENTATION")return t.length;if(e.name==="ClassDef"){if(typeof t!="string")return t;let i=rxt.exec(t);if(i)return{$type:"ClassDefStatement",className:i[1],styleText:i[2]||void 0}}}};o(yEe,"registerValidationChecks");S(yEe,"registerValidationChecks");nxt=class{static{o(this,"TreemapValidator")}static{S(this,"TreemapValidator")}checkSingleRoot(e,t){let r;for(let i of e.TreemapRows)i.item&&(r===void 0&&i.indent===void 0?r=0:i.indent===void 0?t("error","Multiple root nodes are not allowed in a treemap.",{node:i,property:"item"}):r!==void 0&&r>=parseInt(i.indent,10)&&t("error","Multiple root nodes are not allowed in a treemap.",{node:i,property:"item"}))}},r6={parser:{TokenBuilder:S(()=>new txt,"TokenBuilder"),ValueConverter:S(()=>new ixt,"ValueConverter")},validation:{TreemapValidator:S(()=>new nxt,"TreemapValidator")}};o(i6,"createTreemapServices");S(i6,"createTreemapServices")});function a6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),rV,n6);return t.ServiceRegistry.register(r),{shared:t,Wardley:r}}var axt,n6,aV=z(()=>{"use strict";pn();axt=class extends nl{static{o(this,"WardleyValueConverter")}static{S(this,"WardleyValueConverter")}runCustomConverter(e,t,r){switch(e.name.toUpperCase()){case"LINK_LABEL":return t.substring(1).trim();default:return}}},n6={parser:{ValueConverter:S(()=>new axt,"ValueConverter")}};o(a6,"createWardleyServices");S(a6,"createWardleyServices")});function o6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),XG,s6);return t.ServiceRegistry.register(r),{shared:t,GitGraph:r}}var sxt,s6,sV=z(()=>{"use strict";pn();sxt=class extends Ln{static{o(this,"GitGraphTokenBuilder")}static{S(this,"GitGraphTokenBuilder")}constructor(){super(["gitGraph"])}},s6={parser:{TokenBuilder:S(()=>new sxt,"TokenBuilder"),ValueConverter:S(()=>new Kl,"ValueConverter")}};o(o6,"createGitGraphServices");S(o6,"createGitGraphServices")});function c6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),KG,l6);return t.ServiceRegistry.register(r),{shared:t,Info:r}}var oxt,l6,oV=z(()=>{"use strict";pn();oxt=class extends Ln{static{o(this,"InfoTokenBuilder")}static{S(this,"InfoTokenBuilder")}constructor(){super(["info","showInfo"])}},l6={parser:{TokenBuilder:S(()=>new oxt,"TokenBuilder"),ValueConverter:S(()=>new Kl,"ValueConverter")}};o(c6,"createInfoServices");S(c6,"createInfoServices")});function h6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),ZG,u6);return t.ServiceRegistry.register(r),{shared:t,Packet:r}}var lxt,u6,lV=z(()=>{"use strict";pn();lxt=class extends Ln{static{o(this,"PacketTokenBuilder")}static{S(this,"PacketTokenBuilder")}constructor(){super(["packet"])}},u6={parser:{TokenBuilder:S(()=>new lxt,"TokenBuilder"),ValueConverter:S(()=>new Kl,"ValueConverter")}};o(h6,"createPacketServices");S(h6,"createPacketServices")});function f6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),QG,d6);return t.ServiceRegistry.register(r),{shared:t,Pie:r}}var cxt,uxt,d6,cV=z(()=>{"use strict";pn();cxt=class extends Ln{static{o(this,"PieTokenBuilder")}static{S(this,"PieTokenBuilder")}constructor(){super(["pie","showData"])}},uxt=class extends nl{static{o(this,"PieValueConverter")}static{S(this,"PieValueConverter")}runCustomConverter(e,t,r){if(e.name==="PIE_SECTION_LABEL")return t.replace(/"/g,"").trim()}},d6={parser:{TokenBuilder:S(()=>new cxt,"TokenBuilder"),ValueConverter:S(()=>new uxt,"ValueConverter")}};o(f6,"createPieServices");S(f6,"createPieServices")});function m6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),tV,p6);return t.ServiceRegistry.register(r),{shared:t,TreeView:r}}var hxt,dxt,p6,uV=z(()=>{"use strict";pn();hxt=class extends nl{static{o(this,"TreeViewValueConverter")}static{S(this,"TreeViewValueConverter")}runCustomConverter(e,t,r){if(e.name==="INDENTATION")return t?.length||0;if(e.name==="STRING2")return t.substring(1,t.length-1)}},dxt=class extends Ln{static{o(this,"TreeViewTokenBuilder")}static{S(this,"TreeViewTokenBuilder")}constructor(){super(["treeView-beta"])}},p6={parser:{TokenBuilder:S(()=>new dxt,"TokenBuilder"),ValueConverter:S(()=>new hxt,"ValueConverter")}};o(m6,"createTreeViewServices");S(m6,"createTreeViewServices")});function y6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),YG,g6);return t.ServiceRegistry.register(r),{shared:t,Architecture:r}}var fxt,pxt,g6,hV=z(()=>{"use strict";pn();fxt=class extends Ln{static{o(this,"ArchitectureTokenBuilder")}static{S(this,"ArchitectureTokenBuilder")}constructor(){super(["architecture"])}},pxt=class extends nl{static{o(this,"ArchitectureValueConverter")}static{S(this,"ArchitectureValueConverter")}runCustomConverter(e,t,r){if(e.name==="ARCH_ICON")return t.replace(/[()]/g,"").trim();if(e.name==="ARCH_TEXT_ICON")return t.replace(/["()]/g,"");if(e.name==="ARCH_TITLE"){let i=t.replace(/^\[|]$/g,"").trim();return(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1),i=i.replace(/\\"/g,'"').replace(/\\'/g,"'")),i.trim()}}},g6={parser:{TokenBuilder:S(()=>new fxt,"TokenBuilder"),ValueConverter:S(()=>new pxt,"ValueConverter")}};o(y6,"createArchitectureServices");S(y6,"createArchitectureServices")});function CEe(e){let t=e.validation.EventModelingValidator,r=e.validation.ValidationRegistry;if(r){let i={EmTimeFrame:t.checkSourceFrameTypes.bind(t),EmResetFrame:t.checkSourceFrameTypes.bind(t)};r.register(i,t)}}function x6(e=fn){let t=Hr(nn(e),xn),r=Hr(rn({shared:t}),jG,v6);return t.ServiceRegistry.register(r),CEe(r),{shared:t,EventModel:r}}var mxt,vEe,xEe,dV,bEe,TEe,gxt,v6,fV=z(()=>{"use strict";pn();mxt=class extends Ln{static{o(this,"EventModelingTokenBuilder")}static{S(this,"EventModelingTokenBuilder")}constructor(){super(["eventmodeling"])}},vEe=new Set(["cmd","command"]),xEe=new Set(["evt","event"]),dV=new Set(["rmo","readmodel"]),bEe=new Set(["pcr","processor"]),TEe=new Set(["ui"]);o(CEe,"registerValidationChecks");S(CEe,"registerValidationChecks");gxt=class{static{o(this,"EventModelingValidator")}static{S(this,"EventModelingValidator")}checkSourceFrameTypes(e,t){e.sourceFrames.length!==0&&(vEe.has(e.modelEntityType)?this.validateSources(e,new Set([...TEe,...bEe]),"command","ui or processor",t):xEe.has(e.modelEntityType)?this.validateSources(e,vEe,"event","command",t):dV.has(e.modelEntityType)?this.validateSources(e,xEe,"read model","event",t):bEe.has(e.modelEntityType)?this.validateSources(e,dV,"processor","read model",t):TEe.has(e.modelEntityType)&&this.validateSources(e,dV,"ui","read model",t))}validateSources(e,t,r,i,n){for(let a of e.sourceFrames){let s=a.ref;s!==void 0&&!t.has(s.modelEntityType)&&n("error",`A ${r} can only receive input from a ${i}, not from '${s.modelEntityType}'.`,{node:e,property:"sourceFrames"})}}},v6={parser:{TokenBuilder:S(()=>new mxt,"TokenBuilder"),ValueConverter:S(()=>new Kl,"ValueConverter")},validation:{EventModelingValidator:S(()=>new gxt,"EventModelingValidator")}};o(x6,"createEventModelingServices");S(x6,"createEventModelingServices")});var kEe={};xr(kEe,{InfoModule:()=>l6,createInfoServices:()=>c6});var wEe=z(()=>{"use strict";oV();pn()});var SEe={};xr(SEe,{PacketModule:()=>u6,createPacketServices:()=>h6});var EEe=z(()=>{"use strict";lV();pn()});var AEe={};xr(AEe,{PieModule:()=>d6,createPieServices:()=>f6});var _Ee=z(()=>{"use strict";cV();pn()});var DEe={};xr(DEe,{TreeViewModule:()=>p6,createTreeViewServices:()=>m6});var REe=z(()=>{"use strict";uV();pn()});var LEe={};xr(LEe,{ArchitectureModule:()=>g6,createArchitectureServices:()=>y6});var MEe=z(()=>{"use strict";hV();pn()});var NEe={};xr(NEe,{GitGraphModule:()=>s6,createGitGraphServices:()=>o6});var IEe=z(()=>{"use strict";sV();pn()});var OEe={};xr(OEe,{EventModelingModule:()=>v6,createEventModelingServices:()=>x6});var PEe=z(()=>{"use strict";fV();pn()});var BEe={};xr(BEe,{RadarModule:()=>e6,createRadarServices:()=>t6});var FEe=z(()=>{"use strict";iV();pn()});var $Ee={};xr($Ee,{TreemapModule:()=>r6,createTreemapServices:()=>i6});var zEe=z(()=>{"use strict";nV();pn()});var GEe={};xr(GEe,{WardleyModule:()=>n6,createWardleyServices:()=>a6});var VEe=z(()=>{"use strict";aV();pn()});async function bn(e,t){let r=yxt[e];if(!r)throw new Error(`Unknown diagram type: ${e}`);al[e]||await r();let n=al[e].parse(t);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new vxt(n);return n.value}var al,yxt,vxt,sl=z(()=>{"use strict";iV();nV();aV();sV();oV();lV();cV();uV();hV();fV();pn();al={},yxt={info:S(async()=>{let{createInfoServices:e}=await Promise.resolve().then(()=>(wEe(),kEe)),t=e().Info.parser.LangiumParser;al.info=t},"info"),packet:S(async()=>{let{createPacketServices:e}=await Promise.resolve().then(()=>(EEe(),SEe)),t=e().Packet.parser.LangiumParser;al.packet=t},"packet"),pie:S(async()=>{let{createPieServices:e}=await Promise.resolve().then(()=>(_Ee(),AEe)),t=e().Pie.parser.LangiumParser;al.pie=t},"pie"),treeView:S(async()=>{let{createTreeViewServices:e}=await Promise.resolve().then(()=>(REe(),DEe)),t=e().TreeView.parser.LangiumParser;al.treeView=t},"treeView"),architecture:S(async()=>{let{createArchitectureServices:e}=await Promise.resolve().then(()=>(MEe(),LEe)),t=e().Architecture.parser.LangiumParser;al.architecture=t},"architecture"),gitGraph:S(async()=>{let{createGitGraphServices:e}=await Promise.resolve().then(()=>(IEe(),NEe)),t=e().GitGraph.parser.LangiumParser;al.gitGraph=t},"gitGraph"),eventmodeling:S(async()=>{let{createEventModelingServices:e}=await Promise.resolve().then(()=>(PEe(),OEe)),t=e().EventModel.parser.LangiumParser;al.eventmodeling=t},"eventmodeling"),radar:S(async()=>{let{createRadarServices:e}=await Promise.resolve().then(()=>(FEe(),BEe)),t=e().Radar.parser.LangiumParser;al.radar=t},"radar"),treemap:S(async()=>{let{createTreemapServices:e}=await Promise.resolve().then(()=>(zEe(),$Ee)),t=e().Treemap.parser.LangiumParser;al.treemap=t},"treemap"),wardley:S(async()=>{let{createWardleyServices:e}=await Promise.resolve().then(()=>(VEe(),GEe)),t=e().Wardley.parser.LangiumParser;al.wardley=t},"wardley")};o(bn,"parse");S(bn,"parse");vxt=class extends Error{static{o(this,"MermaidParseError")}constructor(e){let t=e.lexerErrors.map(i=>{let n=i.line!==void 0&&!isNaN(i.line)?i.line:"?",a=i.column!==void 0&&!isNaN(i.column)?i.column:"?";return`Lexer error on line ${n}, column ${a}: ${i.message}`}).join(` +`),r=e.parserErrors.map(i=>{let n=i.token.startLine!==void 0&&!isNaN(i.token.startLine)?i.token.startLine:"?",a=i.token.startColumn!==void 0&&!isNaN(i.token.startColumn)?i.token.startColumn:"?";return`Parse error on line ${n}, column ${a}: ${i.message}`}).join(` +`);super(`Parsing failed: ${t} ${r}`),this.result=e}static{S(this,"MermaidParseError")}}});function ca(e,t){e.accDescr&&t.setAccDescription?.(e.accDescr),e.accTitle&&t.setAccTitle?.(e.accTitle),e.title&&t.setDiagramTitle?.(e.title)}var au=z(()=>{"use strict";o(ca,"populateCommonDb")});var si,b6=z(()=>{"use strict";si={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4}});var wf,T6=z(()=>{"use strict";wf=class{constructor(t){this.init=t;this.records=this.init()}static{o(this,"ImperativeState")}reset(){this.records=this.init()}}});function pV(){return RM({length:7})}function bxt(e,t){let r=Object.create(null);return e.reduce((i,n)=>{let a=t(n);return r[a]||(r[a]=!0,i.push(n)),i},[])}function WEe(e,t,r){let i=e.indexOf(t);i===-1?e.push(r):e.splice(i,1,r)}function UEe(e){let t=e.reduce((n,a)=>n.seq>a.seq?n:a,e[0]),r="";e.forEach(function(n){n===t?r+=" *":r+=" |"});let i=[r,t.id,t.seq];for(let n in Pt.records.branches)Pt.records.branches.get(n)===t.id&&i.push(n);if(Z.debug(i.join(" ")),t.parents&&t.parents.length==2&&t.parents[0]&&t.parents[1]){let n=Pt.records.commits.get(t.parents[0]);WEe(e,t,n),t.parents[1]&&e.push(Pt.records.commits.get(t.parents[1]))}else{if(t.parents.length==0)return;if(t.parents[0]){let n=Pt.records.commits.get(t.parents[0]);WEe(e,t,n)}}e=bxt(e,n=>n.id),UEe(e)}var xxt,um,Pt,Txt,Cxt,kxt,wxt,Sxt,Ext,Axt,qEe,_xt,Dxt,Rxt,Lxt,Mxt,HEe,Nxt,Ixt,Oxt,C6,mV=z(()=>{"use strict";St();Xt();br();Ir();Ci();b6();T6();Bn();xxt=or.gitGraph,um=o(()=>Gr({...xxt,...Nt().gitGraph}),"getConfig"),Pt=new wf(()=>{let e=um(),t=e.mainBranchName,r=e.mainBranchOrder;return{mainBranchName:t,commits:new Map,head:null,branchConfig:new Map([[t,{name:t,order:r}]]),branches:new Map([[t,null]]),currBranch:t,direction:"LR",seq:0,options:{}}});o(pV,"getID");o(bxt,"uniqBy");Txt=o(function(e){Pt.records.direction=e},"setDirection"),Cxt=o(function(e){Z.debug("options str",e),e=e?.trim(),e=e||"{}";try{Pt.records.options=JSON.parse(e)}catch(t){Z.error("error while parsing gitGraph options",t.message)}},"setOptions"),kxt=o(function(){return Pt.records.options},"getOptions"),wxt=o(function(e){let t=e.msg,r=e.id,i=e.type,n=e.tags;Z.info("commit",t,r,i,n),Z.debug("Entering commit:",t,r,i,n);let a=um();r=vt.sanitizeText(r,a),t=vt.sanitizeText(t,a),n=n?.map(l=>vt.sanitizeText(l,a));let s={id:r||Pt.records.seq+"-"+pV(),message:t,seq:Pt.records.seq++,type:i??si.NORMAL,tags:n??[],parents:Pt.records.head==null?[]:[Pt.records.head.id],branch:Pt.records.currBranch};Pt.records.head=s,Z.info("main branch",a.mainBranchName),Pt.records.commits.has(s.id)&&Z.warn(`Commit ID ${s.id} already exists`),Pt.records.commits.set(s.id,s),Pt.records.branches.set(Pt.records.currBranch,s.id),Z.debug("in pushCommit "+s.id)},"commit"),Sxt=o(function(e){let t=e.name,r=e.order;if(t=vt.sanitizeText(t,um()),Pt.records.branches.has(t))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${t}")`);Pt.records.branches.set(t,Pt.records.head!=null?Pt.records.head.id:null),Pt.records.branchConfig.set(t,{name:t,order:r}),qEe(t),Z.debug("in createBranch")},"branch"),Ext=o(e=>{let t=e.branch,r=e.id,i=e.type,n=e.tags,a=um();t=vt.sanitizeText(t,a),r&&(r=vt.sanitizeText(r,a));let s=Pt.records.branches.get(Pt.records.currBranch),l=Pt.records.branches.get(t),u=s?Pt.records.commits.get(s):void 0,h=l?Pt.records.commits.get(l):void 0;if(u&&h&&u.branch===t)throw new Error(`Cannot merge branch '${t}' into itself.`);if(Pt.records.currBranch===t){let p=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw p.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},p}if(u===void 0||!u){let p=new Error(`Incorrect usage of "merge". Current branch (${Pt.records.currBranch})has no commits`);throw p.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["commit"]},p}if(!Pt.records.branches.has(t)){let p=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") does not exist");throw p.hash={text:`merge ${t}`,token:`merge ${t}`,expected:[`branch ${t}`]},p}if(h===void 0||!h){let p=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") has no commits");throw p.hash={text:`merge ${t}`,token:`merge ${t}`,expected:['"commit"']},p}if(u===h){let p=new Error('Incorrect usage of "merge". Both branches have same head');throw p.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},p}if(r&&Pt.records.commits.has(r)){let p=new Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");throw p.hash={text:`merge ${t} ${r} ${i} ${n?.join(" ")}`,token:`merge ${t} ${r} ${i} ${n?.join(" ")}`,expected:[`merge ${t} ${r}_UNIQUE ${i} ${n?.join(" ")}`]},p}let d=l||"",f={id:r||`${Pt.records.seq}-${pV()}`,message:`merged branch ${t} into ${Pt.records.currBranch}`,seq:Pt.records.seq++,parents:Pt.records.head==null?[]:[Pt.records.head.id,d],branch:Pt.records.currBranch,type:si.MERGE,customType:i,customId:!!r,tags:n??[]};Pt.records.head=f,Pt.records.commits.set(f.id,f),Pt.records.branches.set(Pt.records.currBranch,f.id),Z.debug(Pt.records.branches),Z.debug("in mergeBranch")},"merge"),Axt=o(function(e){let t=e.id,r=e.targetId,i=e.tags,n=e.parent;Z.debug("Entering cherryPick:",t,r,i);let a=um();if(t=vt.sanitizeText(t,a),r=vt.sanitizeText(r,a),i=i?.map(u=>vt.sanitizeText(u,a)),n=vt.sanitizeText(n,a),!t||!Pt.records.commits.has(t)){let u=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw u.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},u}let s=Pt.records.commits.get(t);if(s===void 0||!s)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(n&&!(Array.isArray(s.parents)&&s.parents.includes(n)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let l=s.branch;if(s.type===si.MERGE&&!n)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!Pt.records.commits.has(r)){if(l===Pt.records.currBranch){let f=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},f}let u=Pt.records.branches.get(Pt.records.currBranch);if(u===void 0||!u){let f=new Error(`Incorrect usage of "cherry-pick". Current branch (${Pt.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},f}let h=Pt.records.commits.get(u);if(h===void 0||!h){let f=new Error(`Incorrect usage of "cherry-pick". Current branch (${Pt.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},f}let d={id:Pt.records.seq+"-"+pV(),message:`cherry-picked ${s?.message} into ${Pt.records.currBranch}`,seq:Pt.records.seq++,parents:Pt.records.head==null?[]:[Pt.records.head.id,s.id],branch:Pt.records.currBranch,type:si.CHERRY_PICK,tags:i?i.filter(Boolean):[`cherry-pick:${s.id}${s.type===si.MERGE?`|parent:${n}`:""}`]};Pt.records.head=d,Pt.records.commits.set(d.id,d),Pt.records.branches.set(Pt.records.currBranch,d.id),Z.debug(Pt.records.branches),Z.debug("in cherryPick")}},"cherryPick"),qEe=o(function(e){if(e=vt.sanitizeText(e,um()),Pt.records.branches.has(e)){Pt.records.currBranch=e;let t=Pt.records.branches.get(Pt.records.currBranch);t===void 0||!t?Pt.records.head=null:Pt.records.head=Pt.records.commits.get(t)??null}else{let t=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw t.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},t}},"checkout");o(WEe,"upsert");o(UEe,"prettyPrintCommitHistory");_xt=o(function(){Z.debug(Pt.records.commits);let e=HEe()[0];UEe([e])},"prettyPrint"),Dxt=o(function(){Pt.reset(),gr()},"clear"),Rxt=o(function(){return[...Pt.records.branchConfig.values()].map((t,r)=>t.order!==null&&t.order!==void 0?t:{...t,order:parseFloat(`0.${r}`)}).sort((t,r)=>(t.order??0)-(r.order??0)).map(({name:t})=>({name:t}))},"getBranchesAsObjArray"),Lxt=o(function(){return Pt.records.branches},"getBranches"),Mxt=o(function(){return Pt.records.commits},"getCommits"),HEe=o(function(){let e=[...Pt.records.commits.values()];return e.forEach(function(t){Z.debug(t.id)}),e.sort((t,r)=>t.seq-r.seq),e},"getCommitsArray"),Nxt=o(function(){return Pt.records.currBranch},"getCurrentBranch"),Ixt=o(function(){return Pt.records.direction},"getDirection"),Oxt=o(function(){return Pt.records.head},"getHead"),C6={commitType:si,getConfig:um,setDirection:Txt,setOptions:Cxt,getOptions:kxt,commit:wxt,branch:Sxt,merge:Ext,cherryPick:Axt,checkout:qEe,prettyPrint:_xt,clear:Dxt,getBranchesAsObjArray:Rxt,getBranches:Lxt,getCommits:Mxt,getCommitsArray:HEe,getCurrentBranch:Nxt,getDirection:Ixt,getHead:Oxt,setAccTitle:Cr,getAccTitle:kr,getAccDescription:Sr,setAccDescription:wr,setDiagramTitle:Ar,getDiagramTitle:Er}});var Pxt,Bxt,Fxt,$xt,zxt,Gxt,Vxt,YEe,jEe=z(()=>{"use strict";sl();St();au();mV();b6();Pxt=o((e,t)=>{ca(e,t),e.dir&&t.setDirection(e.dir);for(let r of e.statements)Bxt(r,t)},"populate"),Bxt=o((e,t)=>{let i={Commit:o(n=>t.commit(Fxt(n)),"Commit"),Branch:o(n=>t.branch($xt(n)),"Branch"),Merge:o(n=>t.merge(zxt(n)),"Merge"),Checkout:o(n=>t.checkout(Gxt(n)),"Checkout"),CherryPicking:o(n=>t.cherryPick(Vxt(n)),"CherryPicking")}[e.$type];i?i(e):Z.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Fxt=o(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?si[e.type]:si.NORMAL,tags:e.tags??void 0}),"parseCommit"),$xt=o(e=>({name:e.name,order:e.order??0}),"parseBranch"),zxt=o(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?si[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Gxt=o(e=>e.branch,"parseCheckout"),Vxt=o(e=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),YEe={parse:o(async e=>{let t=await bn("gitGraph",e);Z.debug(t),Pxt(t,C6)},"parse")}});var Sf,Ef,su,Th,hm,S6,gV,yV,Wxt,dm,Hs,Ys,k6,zT,w6,Ch,Vr,qxt,KEe,ZEe,Uxt,Hxt,Yxt,jxt,Xxt,Kxt,Zxt,Qxt,Jxt,ebt,tbt,rbt,XEe,ibt,GT,nbt,abt,sbt,obt,lbt,QEe,JEe=z(()=>{"use strict";Rr();Ut();St();Xt();b6();Sf=10,Ef=40,su=4,Th=2,hm=8,S6=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),gV=12,yV=new Set(["redux-color","redux-dark-color"]),Wxt=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),dm=o((e,t,r=!1)=>r&&e>0?(e-1)%(t-1)+1:e%t,"calcColorIndex"),Hs=new Map,Ys=new Map,k6=30,zT=new Map,w6=[],Ch=0,Vr="LR",qxt=o(()=>{Hs.clear(),Ys.clear(),zT.clear(),Ch=0,w6=[],Vr="LR"},"clear"),KEe=o(e=>{let t=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(i=>{let n=document.createElementNS("http://www.w3.org/2000/svg","tspan");n.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),n.setAttribute("dy","1em"),n.setAttribute("x","0"),n.setAttribute("class","row"),n.textContent=i.trim(),t.appendChild(n)}),t},"drawText"),ZEe=o(e=>{let t,r,i;return Vr==="BT"?(r=o((n,a)=>n<=a,"comparisonFunc"),i=1/0):(r=o((n,a)=>n>=a,"comparisonFunc"),i=0),e.forEach(n=>{let a=Vr==="TB"||Vr=="BT"?Ys.get(n)?.y:Ys.get(n)?.x;a!==void 0&&r(a,i)&&(t=n,i=a)}),t},"findClosestParent"),Uxt=o(e=>{let t="",r=1/0;return e.forEach(i=>{let n=Ys.get(i).y;n<=r&&(t=i,r=n)}),t||void 0},"findClosestParentBT"),Hxt=o((e,t,r)=>{let i=r,n=r,a=[];e.forEach(s=>{let l=t.get(s);if(!l)throw new Error(`Commit not found for key ${s}`);l.parents.length?(i=jxt(l),n=Math.max(i,n)):a.push(l),Xxt(l,i)}),i=n,a.forEach(s=>{Kxt(s,i,r)}),e.forEach(s=>{let l=t.get(s);if(l?.parents.length){let u=Uxt(l.parents);i=Ys.get(u).y-Ef,i<=n&&(n=i);let h=Hs.get(l.branch).pos,d=i-Sf;Ys.set(l.id,{x:h,y:d})}})},"setParallelBTPos"),Yxt=o(e=>{let t=ZEe(e.parents.filter(i=>i!==null));if(!t)throw new Error(`Closest parent not found for commit ${e.id}`);let r=Ys.get(t)?.y;if(r===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return r},"findClosestParentPos"),jxt=o(e=>Yxt(e)+Ef,"calculateCommitPosition"),Xxt=o((e,t)=>{let r=Hs.get(e.branch);if(!r)throw new Error(`Branch not found for commit ${e.id}`);let i=r.pos,n=t+Sf;return Ys.set(e.id,{x:i,y:n}),{x:i,y:n}},"setCommitPosition"),Kxt=o((e,t,r)=>{let i=Hs.get(e.branch);if(!i)throw new Error(`Branch not found for commit ${e.id}`);let n=t+r,a=i.pos;Ys.set(e.id,{x:a,y:n})},"setRootPosition"),Zxt=o((e,t,r,i,n,a)=>{let{theme:s}=ge(),l=S6.has(s??""),u=yV.has(s??""),h=Wxt.has(s??"");if(a===si.HIGHLIGHT)e.append("rect").attr("x",r.x-10+(l?3:0)).attr("y",r.y-10+(l?3:0)).attr("width",l?14:20).attr("height",l?14:20).attr("class",`commit ${t.id} commit-highlight${dm(n,hm,u)} ${i}-outer`),e.append("rect").attr("x",r.x-6+(l?2:0)).attr("y",r.y-6+(l?2:0)).attr("width",l?8:12).attr("height",l?8:12).attr("class",`commit ${t.id} commit${dm(n,hm,u)} ${i}-inner`);else if(a===si.CHERRY_PICK)e.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",l?7:10).attr("class",`commit ${t.id} ${i}`),e.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",l?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${t.id} ${i}`),e.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",l?2.5:2.75).attr("fill",h?"#000000":"#fff").attr("class",`commit ${t.id} ${i}`),e.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${t.id} ${i}`),e.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",h?"#000000":"#fff").attr("class",`commit ${t.id} ${i}`);else{let d=e.append("circle");if(d.attr("cx",r.x),d.attr("cy",r.y),d.attr("r",l?7:10),d.attr("class",`commit ${t.id} commit${dm(n,hm,u)}`),a===si.MERGE){let f=e.append("circle");f.attr("cx",r.x),f.attr("cy",r.y),f.attr("r",l?5:6),f.attr("class",`commit ${i} ${t.id} commit${dm(n,hm,u)}`)}if(a===si.REVERSE){let f=e.append("path"),p=l?4:5;f.attr("d",`M ${r.x-p},${r.y-p}L${r.x+p},${r.y+p}M${r.x-p},${r.y+p}L${r.x+p},${r.y-p}`).attr("class",`commit ${i} ${t.id} commit${dm(n,hm,u)}`)}}},"drawCommitBullet"),Qxt=o((e,t,r,i,n)=>{if(t.type!==si.CHERRY_PICK&&(t.customId&&t.type===si.MERGE||t.type!==si.MERGE)&&n.showCommitLabel){let a=e.append("g"),s=a.insert("rect").attr("class","commit-label-bkg"),l=a.append("text").attr("x",i).attr("y",r.y+25).attr("class","commit-label").text(t.id),u=l.node()?.getBBox();if(u&&(s.attr("x",r.posWithOffset-u.width/2-Th).attr("y",r.y+13.5).attr("width",u.width+2*Th).attr("height",u.height+2*Th),Vr==="TB"||Vr==="BT"?(s.attr("x",r.x-(u.width+4*su+5)).attr("y",r.y-12),l.attr("x",r.x-(u.width+4*su)).attr("y",r.y+u.height-12)):l.attr("x",r.posWithOffset-u.width/2),n.rotateCommitLabel))if(Vr==="TB"||Vr==="BT")l.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),s.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{let h=-7.5-(u.width+10)/25*9.5,d=10+u.width/25*8.5;a.attr("transform","translate("+h+", "+d+") rotate(-45, "+i+", "+r.y+")")}}},"drawCommitLabel"),Jxt=o((e,t,r,i)=>{if(t.tags.length>0){let n=0,a=0,s=0,l=[];for(let u of t.tags.reverse()){let h=e.insert("polygon"),d=e.append("circle"),f=e.append("text").attr("y",r.y-16-n).attr("class","tag-label").text(u),p=f.node()?.getBBox();if(!p)throw new Error("Tag bbox not found");a=Math.max(a,p.width),s=Math.max(s,p.height),f.attr("x",r.posWithOffset-p.width/2),l.push({tag:f,hole:d,rect:h,yOffset:n}),n+=20}for(let{tag:u,hole:h,rect:d,yOffset:f}of l){let p=s/2,m=r.y-19.2-f;if(d.attr("class","tag-label-bkg").attr("points",` + ${i-a/2-su/2},${m+Th} + ${i-a/2-su/2},${m-Th} + ${r.posWithOffset-a/2-su},${m-p-Th} + ${r.posWithOffset+a/2+su},${m-p-Th} + ${r.posWithOffset+a/2+su},${m+p+Th} + ${r.posWithOffset-a/2-su},${m+p+Th}`),h.attr("cy",m).attr("cx",i-a/2+su/2).attr("r",1.5).attr("class","tag-hole"),Vr==="TB"||Vr==="BT"){let g=i+f;d.attr("class","tag-label-bkg").attr("points",` + ${r.x},${g+2} + ${r.x},${g-2} + ${r.x+Sf},${g-p-2} + ${r.x+Sf+a+4},${g-p-2} + ${r.x+Sf+a+4},${g+p+2} + ${r.x+Sf},${g+p+2}`).attr("transform","translate(12,12) rotate(45, "+r.x+","+i+")"),h.attr("cx",r.x+su/2).attr("cy",g).attr("transform","translate(12,12) rotate(45, "+r.x+","+i+")"),u.attr("x",r.x+5).attr("y",g+3).attr("transform","translate(14,14) rotate(45, "+r.x+","+i+")")}}}},"drawCommitTags"),ebt=o(e=>{switch(e.customType??e.type){case si.NORMAL:return"commit-normal";case si.REVERSE:return"commit-reverse";case si.HIGHLIGHT:return"commit-highlight";case si.MERGE:return"commit-merge";case si.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),tbt=o((e,t,r,i)=>{let n={x:0,y:0};if(e.parents.length>0){let a=ZEe(e.parents);if(a){let s=i.get(a)??n;return t==="TB"?s.y+Ef:t==="BT"?(i.get(e.id)??n).y-Ef:s.x+Ef}}else return t==="TB"?k6:t==="BT"?(i.get(e.id)??n).y-Ef:0;return 0},"calculatePosition"),rbt=o((e,t,r)=>{let i=Vr==="BT"&&r?t:t+Sf,n=Hs.get(e.branch)?.pos,a=Vr==="TB"||Vr==="BT"?Hs.get(e.branch)?.pos:i;if(a===void 0||n===void 0)throw new Error(`Position were undefined for commit ${e.id}`);let s=S6.has(ge().theme??""),l=Vr==="TB"||Vr==="BT"?i:n+(s?gV/2+1:-2);return{x:a,y:l,posWithOffset:i}},"getCommitPosition"),XEe=o((e,t,r,i)=>{let n=e.append("g").attr("class","commit-bullets"),a=e.append("g").attr("class","commit-labels"),s=Vr==="TB"||Vr==="BT"?k6:0,l=[...t.keys()],u=i.parallelCommits??!1,h=o((f,p)=>{let m=t.get(f)?.seq,g=t.get(p)?.seq;return m!==void 0&&g!==void 0?m-g:0},"sortKeys"),d=l.sort(h);Vr==="BT"&&(u&&Hxt(d,t,s),d=d.reverse()),d.forEach(f=>{let p=t.get(f);if(!p)throw new Error(`Commit not found for key ${f}`);u&&(s=tbt(p,Vr,s,Ys));let m=rbt(p,s,u);if(r){let g=ebt(p),y=p.customType??p.type,v=Hs.get(p.branch)?.index??0;Zxt(n,p,m,g,v,y),Qxt(a,p,m,s,i),Jxt(a,p,m,s)}Vr==="TB"||Vr==="BT"?Ys.set(p.id,{x:m.x,y:m.posWithOffset}):Ys.set(p.id,{x:m.posWithOffset,y:m.y}),s=Vr==="BT"&&u?s+Ef:s+Ef+Sf,s>Ch&&(Ch=s)})},"drawCommits"),ibt=o((e,t,r,i,n)=>{let s=(Vr==="TB"||Vr==="BT"?r.xh.branch===s,"isOnBranchToGetCurve"),u=o(h=>h.seq>e.seq&&h.sequ(h)&&l(h))},"shouldRerouteArrow"),GT=o((e,t,r=0)=>{let i=e+Math.abs(e-t)/2;if(r>5)return i;if(w6.every(s=>Math.abs(s-i)>=10))return w6.push(i),i;let a=Math.abs(e-t);return GT(e,t-a/5,r+1)},"findLane"),nbt=o((e,t,r,i)=>{let{theme:n}=ge(),a=yV.has(n??""),s=Ys.get(t.id),l=Ys.get(r.id);if(s===void 0||l===void 0)throw new Error(`Commit positions not found for commits ${t.id} and ${r.id}`);let u=ibt(t,r,s,l,i),h="",d="",f=0,p=0,m=Hs.get(r.branch)?.index;r.type===si.MERGE&&t.id!==r.parents[0]&&(m=Hs.get(t.branch)?.index);let g;if(u){h="A 10 10, 0, 0, 0,",d="A 10 10, 0, 0, 1,",f=10,p=10;let y=s.yl.x&&(h="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",f=20,p=20,r.type===si.MERGE&&t.id!==r.parents[0]?g=`M ${s.x} ${s.y} L ${s.x} ${l.y-f} ${d} ${s.x-p} ${l.y} L ${l.x} ${l.y}`:g=`M ${s.x} ${s.y} L ${l.x+f} ${s.y} ${h} ${l.x} ${s.y+p} L ${l.x} ${l.y}`),s.x===l.x&&(g=`M ${s.x} ${s.y} L ${l.x} ${l.y}`)):Vr==="BT"?(s.xl.x&&(h="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",f=20,p=20,r.type===si.MERGE&&t.id!==r.parents[0]?g=`M ${s.x} ${s.y} L ${s.x} ${l.y+f} ${h} ${s.x-p} ${l.y} L ${l.x} ${l.y}`:g=`M ${s.x} ${s.y} L ${l.x+f} ${s.y} ${d} ${l.x} ${s.y-p} L ${l.x} ${l.y}`),s.x===l.x&&(g=`M ${s.x} ${s.y} L ${l.x} ${l.y}`)):(s.yl.y&&(r.type===si.MERGE&&t.id!==r.parents[0]?g=`M ${s.x} ${s.y} L ${l.x-f} ${s.y} ${h} ${l.x} ${s.y-p} L ${l.x} ${l.y}`:g=`M ${s.x} ${s.y} L ${s.x} ${l.y+f} ${d} ${s.x+p} ${l.y} L ${l.x} ${l.y}`),s.y===l.y&&(g=`M ${s.x} ${s.y} L ${l.x} ${l.y}`));if(g===void 0)throw new Error("Line definition not found");e.append("path").attr("d",g).attr("class","arrow arrow"+dm(m,hm,a))},"drawArrow"),abt=o((e,t)=>{let r=e.append("g").attr("class","commit-arrows");[...t.keys()].forEach(i=>{let n=t.get(i);n.parents&&n.parents.length>0&&n.parents.forEach(a=>{nbt(r,t.get(a),n,t)})})},"drawArrows"),sbt=o((e,t,r,i)=>{let{look:n,theme:a,themeVariables:s}=ge(),{dropShadow:l,THEME_COLOR_LIMIT:u}=s,h=S6.has(a??""),d=yV.has(a??""),f=e.append("g");t.forEach((p,m)=>{let g=dm(m,h?u:hm,d),y=Hs.get(p.name)?.pos;if(y===void 0)throw new Error(`Position not found for branch ${p.name}`);let v=Vr==="TB"||Vr==="BT"?y:h?y+gV/2+1:y-2,x=f.append("line");x.attr("x1",0),x.attr("y1",v),x.attr("x2",Ch),x.attr("y2",v),x.attr("class","branch branch"+g),Vr==="TB"?(x.attr("y1",k6),x.attr("x1",y),x.attr("y2",Ch),x.attr("x2",y)):Vr==="BT"&&(x.attr("y1",Ch),x.attr("x1",y),x.attr("y2",k6),x.attr("x2",y)),w6.push(v);let b=p.name,T=KEe(b),w=f.insert("rect"),k=f.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+g);k.node().appendChild(T);let E=T.getBBox(),A=h?0:4,N=h?16:0,P=h?gV:0;n==="neo"&&w.attr("data-look","neo"),w.attr("class","branchLabelBkg label"+g).attr("style",n==="neo"?`filter:${h?`url(#${i}-drop-shadow)`:l}`:"").attr("rx",A).attr("ry",A).attr("x",-E.width-4-(r.rotateCommitLabel===!0?30:0)).attr("y",-E.height/2+10).attr("width",E.width+18+N).attr("height",E.height+4+P),k.attr("transform","translate("+(-E.width-14-(r.rotateCommitLabel===!0?30:0)+N/2)+", "+(v-E.height/2-2)+")"),Vr==="TB"?(w.attr("x",y-E.width/2-10).attr("y",0),k.attr("transform","translate("+(y-E.width/2-5)+", 0)"),h&&(w.attr("transform",`translate(${-N/2-3}, ${-P-10})`),k.attr("transform","translate("+(y-E.width/2-5)+", "+(-P*2+7)+")"))):Vr==="BT"?(w.attr("x",y-E.width/2-10).attr("y",Ch),k.attr("transform","translate("+(y-E.width/2-5)+", "+Ch+")"),h&&(w.attr("transform",`translate(${-N/2-3}, ${P+10})`),k.attr("transform","translate("+(y-E.width/2-5)+", "+(Ch+P*2+4)+")"))):w.attr("transform","translate(-19, "+(v-12-P/2)+")")})},"drawBranches"),obt=o(function(e,t,r,i,n){return Hs.set(e,{pos:t,index:r}),t+=50+(n?40:0)+(Vr==="TB"||Vr==="BT"?i.width/2:0),t},"setBranchPosition"),lbt=o(function(e,t,r,i){qxt(),Z.debug("in gitgraph renderer",e+` +`,"id:",t,r);let n=i.db;if(!n.getConfig){Z.error("getConfig method is not available on db");return}let a=n.getConfig(),s=a.rotateCommitLabel??!1;zT=n.getCommits();let l=n.getBranchesAsObjArray();Vr=n.getDirection();let u=Je(`[id="${t}"]`),{look:h,theme:d,themeVariables:f}=ge(),{useGradient:p,gradientStart:m,gradientStop:g,filterColor:y}=f;if(p){let x=u.append("defs").append("linearGradient").attr("id",t+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");x.append("stop").attr("offset","0%").attr("stop-color",m).attr("stop-opacity",1),x.append("stop").attr("offset","100%").attr("stop-color",g).attr("stop-opacity",1)}h==="neo"&&S6.has(d??"")&&u.append("defs").append("filter").attr("id",t+"-drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",y);let v=0;l.forEach((x,b)=>{let T=KEe(x.name),w=u.append("g"),C=w.insert("g").attr("class","branchLabel"),k=C.insert("g").attr("class","label branch-label");k.node()?.appendChild(T);let E=T.getBBox();v=obt(x.name,v,b,E,s),k.remove(),C.remove(),w.remove()}),XEe(u,zT,!1,a),a.showBranches&&sbt(u,l,a,t),abt(u,zT),XEe(u,zT,!0,a),Zt.insertTitle(u,"gitTitleText",a.titleTopMargin??0,n.getDiagramTitle()),Av(void 0,u,a.diagramPadding,a.useMaxWidth)},"draw"),QEe={draw:lbt}});var e5e,t5e,cbt,ubt,hbt,dbt,fbt,pbt,mbt,gbt,r5e,i5e=z(()=>{"use strict";br();e5e=8,t5e=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),cbt=new Set(["redux-color","redux-dark-color"]),ubt=new Set(["neo","neo-dark"]),hbt=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),dbt=new Set(["redux","redux-dark","redux-color","redux-dark-color","neo","neo-dark"]),fbt=o(e=>{let{svgId:t}=e,r="";if(e.useGradient&&t)for(let i=0;i{let t=Nt(),{theme:r,themeVariables:i}=t,{borderColorArray:n}=i,a=t5e.has(r);if(ubt.has(r)){let s="";for(let l=0;l`${Array.from({length:e.THEME_COLOR_LIMIT},(t,r)=>r).map(t=>{let r=t%e5e;return` + .branch-label${t} { fill: ${e["gitBranchLabel"+r]}; } + .commit${t} { stroke: ${e["git"+r]}; fill: ${e["git"+r]}; } + .commit-highlight${t} { stroke: ${e["gitInv"+r]}; fill: ${e["gitInv"+r]}; } + .label${t} { fill: ${e["git"+r]}; } + .arrow${t} { stroke: ${e["git"+r]}; } + `}).join(` +`)}`,"normalTheme"),gbt=o(e=>{let t=Nt(),{theme:r}=t,i=dbt.has(r);return` + .commit-id, + .commit-msg, + .branch-label { + fill: lightgrey; + color: lightgrey; + font-family: 'trebuchet ms', verdana, arial, sans-serif; + font-family: var(--mermaid-font-family); + } + + ${i?pbt(e):mbt(e)} + + .branch { + stroke-width: ${e.strokeWidth}; + stroke: ${e.commitLineColor??e.lineColor}; + stroke-dasharray: ${i?"4 2":"2"}; + } + .commit-label { font-size: ${e.commitLabelFontSize}; fill: ${i?e.nodeBorder:e.commitLabelColor}; ${i?`font-weight:${e.noteFontWeight};`:""}} + .commit-label-bkg { font-size: ${e.commitLabelFontSize}; fill: ${i?"transparent":e.commitLabelBackground}; opacity: ${i?"":.5}; } + .tag-label { font-size: ${e.tagLabelFontSize}; fill: ${e.tagLabelColor};} + .tag-label-bkg { fill: ${i?e.mainBkg:e.tagLabelBackground}; stroke: ${i?e.nodeBorder:e.tagLabelBorder}; ${i?`filter:${e.dropShadow}`:""} } + .tag-hole { fill: ${e.textColor}; } + + .commit-merge { + stroke: ${i?e.mainBkg:e.primaryColor}; + fill: ${i?e.mainBkg:e.primaryColor}; + } + .commit-reverse { + stroke: ${i?e.mainBkg:e.primaryColor}; + fill: ${i?e.mainBkg:e.primaryColor}; + stroke-width: ${i?e.strokeWidth:3}; + } + .commit-highlight-outer { + } + .commit-highlight-inner { + stroke: ${i?e.mainBkg:e.primaryColor}; + fill: ${i?e.mainBkg:e.primaryColor}; + } + + .arrow { + /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */ + stroke-width: ${t5e.has(r)?e.strokeWidth:8}; + stroke-linecap: round; + fill: none + } + .gitTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; + } +`},"getStyles"),r5e=gbt});var n5e={};xr(n5e,{diagram:()=>ybt});var ybt,a5e=z(()=>{"use strict";jEe();mV();JEe();i5e();ybt={parser:YEe,db:C6,renderer:QEe,styles:r5e}});var vV,l5e,c5e=z(()=>{"use strict";vV=(function(){var e=o(function(_,R,M,L){for(M=M||{},L=_.length;L--;M[_[L]]=R);return M},"o"),t=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],r=[1,26],i=[1,27],n=[1,28],a=[1,29],s=[1,30],l=[1,31],u=[1,32],h=[1,33],d=[1,34],f=[1,9],p=[1,10],m=[1,11],g=[1,12],y=[1,13],v=[1,14],x=[1,15],b=[1,16],T=[1,19],w=[1,20],C=[1,21],k=[1,22],E=[1,23],A=[1,25],N=[1,35],P={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:o(function(R,M,L,B,O,$,G){var F=$.length-1;switch(O){case 1:return $[F-1];case 2:this.$=[];break;case 3:$[F-1].push($[F]),this.$=$[F-1];break;case 4:case 5:this.$=$[F];break;case 6:case 7:this.$=[];break;case 8:B.setWeekday("monday");break;case 9:B.setWeekday("tuesday");break;case 10:B.setWeekday("wednesday");break;case 11:B.setWeekday("thursday");break;case 12:B.setWeekday("friday");break;case 13:B.setWeekday("saturday");break;case 14:B.setWeekday("sunday");break;case 15:B.setWeekend("friday");break;case 16:B.setWeekend("saturday");break;case 17:B.setDateFormat($[F].substr(11)),this.$=$[F].substr(11);break;case 18:B.enableInclusiveEndDates(),this.$=$[F].substr(18);break;case 19:B.TopAxis(),this.$=$[F].substr(8);break;case 20:B.setAxisFormat($[F].substr(11)),this.$=$[F].substr(11);break;case 21:B.setTickInterval($[F].substr(13)),this.$=$[F].substr(13);break;case 22:B.setExcludes($[F].substr(9)),this.$=$[F].substr(9);break;case 23:B.setIncludes($[F].substr(9)),this.$=$[F].substr(9);break;case 24:B.setTodayMarker($[F].substr(12)),this.$=$[F].substr(12);break;case 27:B.setDiagramTitle($[F].substr(6)),this.$=$[F].substr(6);break;case 28:this.$=$[F].trim(),B.setAccTitle(this.$);break;case 29:case 30:this.$=$[F].trim(),B.setAccDescription(this.$);break;case 31:B.addSection($[F].substr(8)),this.$=$[F].substr(8);break;case 33:B.addTask($[F-1],$[F]),this.$="task";break;case 34:this.$=$[F-1],B.setClickEvent($[F-1],$[F],null);break;case 35:this.$=$[F-2],B.setClickEvent($[F-2],$[F-1],$[F]);break;case 36:this.$=$[F-2],B.setClickEvent($[F-2],$[F-1],null),B.setLink($[F-2],$[F]);break;case 37:this.$=$[F-3],B.setClickEvent($[F-3],$[F-2],$[F-1]),B.setLink($[F-3],$[F]);break;case 38:this.$=$[F-2],B.setClickEvent($[F-2],$[F],null),B.setLink($[F-2],$[F-1]);break;case 39:this.$=$[F-3],B.setClickEvent($[F-3],$[F-1],$[F]),B.setLink($[F-3],$[F-2]);break;case 40:this.$=$[F-1],B.setLink($[F-1],$[F]);break;case 41:case 47:this.$=$[F-1]+" "+$[F];break;case 42:case 43:case 45:this.$=$[F-2]+" "+$[F-1]+" "+$[F];break;case 44:case 46:this.$=$[F-3]+" "+$[F-2]+" "+$[F-1]+" "+$[F];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:r,13:i,14:n,15:a,16:s,17:l,18:u,19:18,20:h,21:d,22:f,23:p,24:m,25:g,26:y,27:v,28:x,29:b,30:T,31:w,33:C,35:k,36:E,37:24,38:A,40:N},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:36,11:17,12:r,13:i,14:n,15:a,16:s,17:l,18:u,19:18,20:h,21:d,22:f,23:p,24:m,25:g,26:y,27:v,28:x,29:b,30:T,31:w,33:C,35:k,36:E,37:24,38:A,40:N},e(t,[2,5]),e(t,[2,6]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,20]),e(t,[2,21]),e(t,[2,22]),e(t,[2,23]),e(t,[2,24]),e(t,[2,25]),e(t,[2,26]),e(t,[2,27]),{32:[1,37]},{34:[1,38]},e(t,[2,30]),e(t,[2,31]),e(t,[2,32]),{39:[1,39]},e(t,[2,8]),e(t,[2,9]),e(t,[2,10]),e(t,[2,11]),e(t,[2,12]),e(t,[2,13]),e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),{41:[1,40],43:[1,41]},e(t,[2,4]),e(t,[2,28]),e(t,[2,29]),e(t,[2,33]),e(t,[2,34],{42:[1,42],43:[1,43]}),e(t,[2,40],{41:[1,44]}),e(t,[2,35],{43:[1,45]}),e(t,[2,36]),e(t,[2,38],{42:[1,46]}),e(t,[2,37]),e(t,[2,39])],defaultActions:{},parseError:o(function(R,M){if(M.recoverable)this.trace(R);else{var L=new Error(R);throw L.hash=M,L}},"parseError"),parse:o(function(R){var M=this,L=[0],B=[],O=[null],$=[],G=this.table,F="",V=0,H=0,j=0,U=2,Q=1,Y=$.slice.call(arguments,1),ae=Object.create(this.lexer),J={yy:{}};for(var te in this.yy)Object.prototype.hasOwnProperty.call(this.yy,te)&&(J.yy[te]=this.yy[te]);ae.setInput(R,J.yy),J.yy.lexer=ae,J.yy.parser=this,typeof ae.yylloc>"u"&&(ae.yylloc={});var re=ae.yylloc;$.push(re);var ee=ae.options&&ae.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Te(qe){L.length=L.length-2*qe,O.length=O.length-qe,$.length=$.length-qe}o(Te,"popStack");function ue(){var qe;return qe=B.pop()||ae.lex()||Q,typeof qe!="number"&&(qe instanceof Array&&(B=qe,qe=B.pop()),qe=M.symbols_[qe]||qe),qe}o(ue,"lex");for(var De,Ie,Ee,we,Me,$e,de={},rt,ke,Fe,He;;){if(Ee=L[L.length-1],this.defaultActions[Ee]?we=this.defaultActions[Ee]:((De===null||typeof De>"u")&&(De=ue()),we=G[Ee]&&G[Ee][De]),typeof we>"u"||!we.length||!we[0]){var at="";He=[];for(rt in G[Ee])this.terminals_[rt]&&rt>U&&He.push("'"+this.terminals_[rt]+"'");ae.showPosition?at="Parse error on line "+(V+1)+`: +`+ae.showPosition()+` +Expecting `+He.join(", ")+", got '"+(this.terminals_[De]||De)+"'":at="Parse error on line "+(V+1)+": Unexpected "+(De==Q?"end of input":"'"+(this.terminals_[De]||De)+"'"),this.parseError(at,{text:ae.match,token:this.terminals_[De]||De,line:ae.yylineno,loc:re,expected:He})}if(we[0]instanceof Array&&we.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Ee+", token: "+De);switch(we[0]){case 1:L.push(De),O.push(ae.yytext),$.push(ae.yylloc),L.push(we[1]),De=null,Ie?(De=Ie,Ie=null):(H=ae.yyleng,F=ae.yytext,V=ae.yylineno,re=ae.yylloc,j>0&&j--);break;case 2:if(ke=this.productions_[we[1]][1],de.$=O[O.length-ke],de._$={first_line:$[$.length-(ke||1)].first_line,last_line:$[$.length-1].last_line,first_column:$[$.length-(ke||1)].first_column,last_column:$[$.length-1].last_column},ee&&(de._$.range=[$[$.length-(ke||1)].range[0],$[$.length-1].range[1]]),$e=this.performAction.apply(de,[F,H,V,J.yy,we[1],O,$].concat(Y)),typeof $e<"u")return $e;ke&&(L=L.slice(0,-1*ke*2),O=O.slice(0,-1*ke),$=$.slice(0,-1*ke)),L.push(this.productions_[we[1]][0]),O.push(de.$),$.push(de._$),Fe=G[L[L.length-2]][L[L.length-1]],L.push(Fe);break;case 3:return!0}}return!0},"parse")},I=(function(){var _={EOF:1,parseError:o(function(M,L){if(this.yy.parser)this.yy.parser.parseError(M,L);else throw new Error(M)},"parseError"),setInput:o(function(R,M){return this.yy=M||this.yy||{},this._input=R,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var R=this._input[0];this.yytext+=R,this.yyleng++,this.offset++,this.match+=R,this.matched+=R;var M=R.match(/(?:\r\n?|\n).*/g);return M?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),R},"input"),unput:o(function(R){var M=R.length,L=R.split(/(?:\r\n?|\n)/g);this._input=R+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-M),this.offset-=M;var B=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),L.length-1&&(this.yylineno-=L.length-1);var O=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:L?(L.length===B.length?this.yylloc.first_column:0)+B[B.length-L.length].length-L[0].length:this.yylloc.first_column-M},this.options.ranges&&(this.yylloc.range=[O[0],O[0]+this.yyleng-M]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(R){this.unput(this.match.slice(R))},"less"),pastInput:o(function(){var R=this.matched.substr(0,this.matched.length-this.match.length);return(R.length>20?"...":"")+R.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var R=this.match;return R.length<20&&(R+=this._input.substr(0,20-R.length)),(R.substr(0,20)+(R.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var R=this.pastInput(),M=new Array(R.length+1).join("-");return R+this.upcomingInput()+` +`+M+"^"},"showPosition"),test_match:o(function(R,M){var L,B,O;if(this.options.backtrack_lexer&&(O={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(O.yylloc.range=this.yylloc.range.slice(0))),B=R[0].match(/(?:\r\n?|\n).*/g),B&&(this.yylineno+=B.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:B?B[B.length-1].length-B[B.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+R[0].length},this.yytext+=R[0],this.match+=R[0],this.matches=R,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(R[0].length),this.matched+=R[0],L=this.performAction.call(this,this.yy,this,M,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),L)return L;if(this._backtrack){for(var $ in O)this[$]=O[$];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var R,M,L,B;this._more||(this.yytext="",this.match="");for(var O=this._currentRules(),$=0;$M[0].length)){if(M=L,B=$,this.options.backtrack_lexer){if(R=this.test_match(L,O[$]),R!==!1)return R;if(this._backtrack){M=!1;continue}else return!1}else if(!this.options.flex)break}return M?(R=this.test_match(M,O[B]),R!==!1?R:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var M=this.next();return M||this.lex()},"lex"),begin:o(function(M){this.conditionStack.push(M)},"begin"),popState:o(function(){var M=this.conditionStack.length-1;return M>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(M){return M=this.conditionStack.length-1-Math.abs(M||0),M>=0?this.conditionStack[M]:"INITIAL"},"topState"),pushState:o(function(M){this.begin(M)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(M,L,B,O){var $=O;switch(B){case 0:return this.begin("open_directive"),"open_directive";break;case 1:return this.begin("acc_title"),31;break;case 2:return this.popState(),"acc_title_value";break;case 3:return this.begin("acc_descr"),33;break;case 4:return this.popState(),"acc_descr_value";break;case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:break;case 9:break;case 10:break;case 11:return 10;case 12:break;case 13:break;case 14:this.begin("href");break;case 15:this.popState();break;case 16:return 43;case 17:this.begin("callbackname");break;case 18:this.popState();break;case 19:this.popState(),this.begin("callbackargs");break;case 20:return 41;case 21:this.popState();break;case 22:return 42;case 23:this.begin("click");break;case 24:this.popState();break;case 25:return 40;case 26:return 4;case 27:return 22;case 28:return 23;case 29:return 24;case 30:return 25;case 31:return 26;case 32:return 28;case 33:return 27;case 34:return 29;case 35:return 12;case 36:return 13;case 37:return 14;case 38:return 15;case 39:return 16;case 40:return 17;case 41:return 18;case 42:return 20;case 43:return 21;case 44:return"date";case 45:return 30;case 46:return"accDescription";case 47:return 36;case 48:return 38;case 49:return 39;case 50:return":";case 51:return 6;case 52:return"INVALID"}},"anonymous"),rules:[/^(?:%%\{)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:tickInterval\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:weekday\s+monday\b)/i,/^(?:weekday\s+tuesday\b)/i,/^(?:weekday\s+wednesday\b)/i,/^(?:weekday\s+thursday\b)/i,/^(?:weekday\s+friday\b)/i,/^(?:weekday\s+saturday\b)/i,/^(?:weekday\s+sunday\b)/i,/^(?:weekend\s+friday\b)/i,/^(?:weekend\s+saturday\b)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accDescription\s[^#\n;]+)/i,/^(?:section\s[^\n]+)/i,/^(?:[^:\n]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[6,7],inclusive:!1},acc_descr:{rules:[4],inclusive:!1},acc_title:{rules:[2],inclusive:!1},callbackargs:{rules:[21,22],inclusive:!1},callbackname:{rules:[18,19,20],inclusive:!1},href:{rules:[15,16],inclusive:!1},click:{rules:[24,25],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,17,23,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}};return _})();P.lexer=I;function D(){this.yy={}}return o(D,"Parser"),D.prototype=P,P.Parser=D,new D})();vV.parser=vV;l5e=vV});var u5e=Js((xV,bV)=>{"use strict";(function(e,t){typeof xV=="object"&&typeof bV<"u"?bV.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_isoWeek=t()})(xV,(function(){"use strict";var e="day";return function(t,r,i){var n=o(function(l){return l.add(4-l.isoWeekday(),e)},"a"),a=r.prototype;a.isoWeekYear=function(){return n(this).year()},a.isoWeek=function(l){if(!this.$utils().u(l))return this.add(7*(l-this.isoWeek()),e);var u,h,d,f,p=n(this),m=(u=this.isoWeekYear(),h=this.$u,d=(h?i.utc:i)().year(u).startOf("year"),f=4-d.isoWeekday(),d.isoWeekday()>4&&(f+=7),d.add(f,e));return p.diff(m,"week")+1},a.isoWeekday=function(l){return this.$utils().u(l)?this.day()||7:this.day(this.day()%7?l:l-7)};var s=a.startOf;a.startOf=function(l,u){var h=this.$utils(),d=!!h.u(u)||u;return h.p(l)==="isoweek"?d?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):s.bind(this)(l,u)}}}))});var h5e=Js((TV,CV)=>{"use strict";(function(e,t){typeof TV=="object"&&typeof CV<"u"?CV.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_customParseFormat=t()})(TV,(function(){"use strict";var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,r=/\d/,i=/\d\d/,n=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,s={},l=o(function(g){return(g=+g)+(g>68?1900:2e3)},"a"),u=o(function(g){return function(y){this[g]=+y}},"f"),h=[/[+-]\d\d:?(\d\d)?|Z/,function(g){(this.zone||(this.zone={})).offset=(function(y){if(!y||y==="Z")return 0;var v=y.match(/([+-]|\d\d)/g),x=60*v[1]+(+v[2]||0);return x===0?0:v[0]==="+"?-x:x})(g)}],d=o(function(g){var y=s[g];return y&&(y.indexOf?y:y.s.concat(y.f))},"u"),f=o(function(g,y){var v,x=s.meridiem;if(x){for(var b=1;b<=24;b+=1)if(g.indexOf(x(b,0,y))>-1){v=b>12;break}}else v=g===(y?"pm":"PM");return v},"d"),p={A:[a,function(g){this.afternoon=f(g,!1)}],a:[a,function(g){this.afternoon=f(g,!0)}],Q:[r,function(g){this.month=3*(g-1)+1}],S:[r,function(g){this.milliseconds=100*+g}],SS:[i,function(g){this.milliseconds=10*+g}],SSS:[/\d{3}/,function(g){this.milliseconds=+g}],s:[n,u("seconds")],ss:[n,u("seconds")],m:[n,u("minutes")],mm:[n,u("minutes")],H:[n,u("hours")],h:[n,u("hours")],HH:[n,u("hours")],hh:[n,u("hours")],D:[n,u("day")],DD:[i,u("day")],Do:[a,function(g){var y=s.ordinal,v=g.match(/\d+/);if(this.day=v[0],y)for(var x=1;x<=31;x+=1)y(x).replace(/\[|\]/g,"")===g&&(this.day=x)}],w:[n,u("week")],ww:[i,u("week")],M:[n,u("month")],MM:[i,u("month")],MMM:[a,function(g){var y=d("months"),v=(d("monthsShort")||y.map((function(x){return x.slice(0,3)}))).indexOf(g)+1;if(v<1)throw new Error;this.month=v%12||v}],MMMM:[a,function(g){var y=d("months").indexOf(g)+1;if(y<1)throw new Error;this.month=y%12||y}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(g){this.year=l(g)}],YYYY:[/\d{4}/,u("year")],Z:h,ZZ:h};function m(g){var y,v;y=g,v=s&&s.formats;for(var x=(g=y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(A,N,P){var I=P&&P.toUpperCase();return N||v[P]||e[P]||v[I].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(D,_,R){return _||R.slice(1)}))}))).match(t),b=x.length,T=0;T-1)return new Date((L==="X"?1e3:1)*M);var $=m(L)(M),G=$.year,F=$.month,V=$.day,H=$.hours,j=$.minutes,U=$.seconds,Q=$.milliseconds,Y=$.zone,ae=$.week,J=new Date,te=V||(G||F?1:J.getDate()),re=G||J.getFullYear(),ee=0;G&&!F||(ee=F>0?F-1:J.getMonth());var Te,ue=H||0,De=j||0,Ie=U||0,Ee=Q||0;return Y?new Date(Date.UTC(re,ee,te,ue,De,Ie,Ee+60*Y.offset*1e3)):B?new Date(Date.UTC(re,ee,te,ue,De,Ie,Ee)):(Te=new Date(re,ee,te,ue,De,Ie,Ee),ae&&(Te=O(Te).week(ae).toDate()),Te)}catch{return new Date("")}})(w,E,C,v),this.init(),I&&I!==!0&&(this.$L=this.locale(I).$L),P&&w!=this.format(E)&&(this.$d=new Date("")),s={}}else if(E instanceof Array)for(var D=E.length,_=1;_<=D;_+=1){k[1]=E[_-1];var R=v.apply(this,k);if(R.isValid()){this.$d=R.$d,this.$L=R.$L,this.init();break}_===D&&(this.$d=new Date(""))}else b.call(this,T)}}}))});var d5e=Js((kV,wV)=>{"use strict";(function(e,t){typeof kV=="object"&&typeof wV<"u"?wV.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_advancedFormat=t()})(kV,(function(){"use strict";return function(e,t){var r=t.prototype,i=r.format;r.format=function(n){var a=this,s=this.$locale();if(!this.isValid())return i.bind(this)(n);var l=this.$utils(),u=(n||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return s.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return s.ordinal(a.week(),"W");case"w":case"ww":return l.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return l.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return l.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return i.bind(this)(u)}}}))});function _5e(e,t,r){let i=!0;for(;i;)i=!1,r.forEach(function(n){let a="^\\s*"+n+"\\s*$",s=new RegExp(a);e[0].match(s)&&(t[n]=!0,e.shift(1),i=!0)})}var m5e,To,g5e,y5e,v5e,f5e,ou,_V,DV,RV,VT,WT,LV,MV,_6,gy,NV,x5e,IV,py,qT,OV,PV,D6,SV,Tbt,Cbt,kbt,wbt,Sbt,Ebt,Abt,_bt,Dbt,Rbt,Lbt,Mbt,Nbt,Ibt,Obt,Pbt,Bbt,Fbt,$bt,zbt,Gbt,Vbt,Wbt,qbt,b5e,Ubt,Hbt,Ybt,T5e,jbt,EV,C5e,k5e,E6,my,Xbt,Kbt,AV,A6,jn,w5e,Zbt,fm,Qbt,p5e,Jbt,S5e,e2t,E5e,t2t,r2t,A5e,D5e=z(()=>{"use strict";m5e=ys(fg(),1),To=ys(wC(),1),g5e=ys(u5e(),1),y5e=ys(h5e(),1),v5e=ys(d5e(),1);St();Ut();Xt();Ci();To.default.extend(g5e.default);To.default.extend(y5e.default);To.default.extend(v5e.default);f5e={friday:5,saturday:6},ou="",_V="",RV="",VT=[],WT=[],LV=new Map,MV=[],_6=[],gy="",NV="",x5e=["active","done","crit","milestone","vert"],IV=[],py="",qT=!1,OV=!1,PV="sunday",D6="saturday",SV=0,Tbt=o(function(){MV=[],_6=[],gy="",IV=[],E6=0,AV=void 0,A6=void 0,jn=[],ou="",_V="",NV="",DV=void 0,RV="",VT=[],WT=[],qT=!1,OV=!1,SV=0,LV=new Map,py="",gr(),PV="sunday",D6="saturday"},"clear"),Cbt=o(function(e){py=e},"setDiagramId"),kbt=o(function(e){_V=e},"setAxisFormat"),wbt=o(function(){return _V},"getAxisFormat"),Sbt=o(function(e){DV=e},"setTickInterval"),Ebt=o(function(){return DV},"getTickInterval"),Abt=o(function(e){RV=e},"setTodayMarker"),_bt=o(function(){return RV},"getTodayMarker"),Dbt=o(function(e){ou=e},"setDateFormat"),Rbt=o(function(){qT=!0},"enableInclusiveEndDates"),Lbt=o(function(){return qT},"endDatesAreInclusive"),Mbt=o(function(){OV=!0},"enableTopAxis"),Nbt=o(function(){return OV},"topAxisEnabled"),Ibt=o(function(e){NV=e},"setDisplayMode"),Obt=o(function(){return NV},"getDisplayMode"),Pbt=o(function(){return ou},"getDateFormat"),Bbt=o(function(e){VT=e.toLowerCase().split(/[\s,]+/)},"setIncludes"),Fbt=o(function(){return VT},"getIncludes"),$bt=o(function(e){WT=e.toLowerCase().split(/[\s,]+/)},"setExcludes"),zbt=o(function(){return WT},"getExcludes"),Gbt=o(function(){return LV},"getLinks"),Vbt=o(function(e){gy=e,MV.push(e)},"addSection"),Wbt=o(function(){return MV},"getSections"),qbt=o(function(){let e=p5e(),t=10,r=0;for(;!e&&rl))throw new Error("Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations.");e=e.add(1,"d")}return[t,s]},"fixTaskDates"),EV=o(function(e,t,r){if(r=r.trim(),o(l=>{let u=l.trim();return u==="x"||u==="X"},"isTimestampFormat")(t)&&/^\d+$/.test(r))return new Date(Number(r));let a=/^after\s+(?[\d\w- ]+)/.exec(r);if(a!==null){let l=null;for(let h of a.groups.ids.split(" ")){let d=fm(h);d!==void 0&&(!l||d.endTime>l.endTime)&&(l=d)}if(l)return l.endTime;let u=new Date;return u.setHours(0,0,0,0),u}let s=(0,To.default)(r,t.trim(),!0);if(s.isValid())return s.toDate();{Z.debug("Invalid date:"+r),Z.debug("With date format:"+t.trim());let l=new Date(r);if(l===void 0||isNaN(l.getTime())||l.getFullYear()<-1e4||l.getFullYear()>1e4)throw new Error("Invalid date:"+r);return l}},"getStartDate"),C5e=o(function(e){let t=/^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(e.trim());return t!==null?[Number.parseFloat(t[1]),t[2]]:[NaN,"ms"]},"parseDuration"),k5e=o(function(e,t,r,i=!1){r=r.trim();let a=/^until\s+(?[\d\w- ]+)/.exec(r);if(a!==null){let d=null;for(let p of a.groups.ids.split(" ")){let m=fm(p);m!==void 0&&(!d||m.startTime{window.open(r,"_self")}),LV.set(i,r))}),S5e(e,"clickable")},"setLink"),S5e=o(function(e,t){e.split(",").forEach(function(r){let i=fm(r);i!==void 0&&i.classes.push(t)})},"setClass"),e2t=o(function(e,t,r){if(ge().securityLevel!=="loose"||t===void 0)return;let i=[];if(typeof r=="string"){i=r.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let a=0;a{Zt.runFunc(t,...i)})},"setClickFun"),E5e=o(function(e,t){IV.push(function(){let r=py?`${py}-${e}`:e,i=document.querySelector(`[id="${r}"]`);i!==null&&i.addEventListener("click",function(){t()})},function(){let r=py?`${py}-${e}`:e,i=document.querySelector(`[id="${r}-text"]`);i!==null&&i.addEventListener("click",function(){t()})})},"pushFun"),t2t=o(function(e,t,r){e.split(",").forEach(function(i){e2t(i,t,r)}),S5e(e,"clickable")},"setClickEvent"),r2t=o(function(e){IV.forEach(function(t){t(e)})},"bindFunctions"),A5e={getConfig:o(()=>ge().gantt,"getConfig"),clear:Tbt,setDateFormat:Dbt,getDateFormat:Pbt,enableInclusiveEndDates:Rbt,endDatesAreInclusive:Lbt,enableTopAxis:Mbt,topAxisEnabled:Nbt,setAxisFormat:kbt,getAxisFormat:wbt,setTickInterval:Sbt,getTickInterval:Ebt,setTodayMarker:Abt,getTodayMarker:_bt,setAccTitle:Cr,getAccTitle:kr,setDiagramTitle:Ar,getDiagramTitle:Er,setDiagramId:Cbt,setDisplayMode:Ibt,getDisplayMode:Obt,setAccDescription:wr,getAccDescription:Sr,addSection:Vbt,getSections:Wbt,getTasks:qbt,addTask:Zbt,findTaskById:fm,addTaskOrg:Qbt,setIncludes:Bbt,getIncludes:Fbt,setExcludes:$bt,getExcludes:zbt,setClickEvent:t2t,setLink:Jbt,getLinks:Gbt,bindFunctions:r2t,parseDuration:C5e,isInvalidDate:b5e,setWeekday:Ubt,getWeekday:Hbt,setWeekend:Ybt};o(_5e,"getTaskTags")});var R5e=Js((BV,FV)=>{"use strict";(function(e,t){typeof BV=="object"&&typeof FV<"u"?FV.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs_plugin_duration=t()})(BV,(function(){"use strict";var e,t,r=1e3,i=6e4,n=36e5,a=864e5,s=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,l=31536e6,u=2628e6,h=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,d={years:l,months:u,days:a,hours:n,minutes:i,seconds:r,milliseconds:1,weeks:6048e5},f=o(function(w){return w instanceof b},"c"),p=o(function(w,C,k){return new b(w,k,C.$l)},"f"),m=o(function(w){return t.p(w)+"s"},"m"),g=o(function(w){return w<0},"l"),y=o(function(w){return g(w)?Math.ceil(w):Math.floor(w)},"$"),v=o(function(w){return Math.abs(w)},"y"),x=o(function(w,C){return w?g(w)?{negative:!0,format:""+v(w)+C}:{negative:!1,format:""+w+C}:{negative:!1,format:""}},"v"),b=(function(){function w(k,E,A){var N=this;if(this.$d={},this.$l=A,k===void 0&&(this.$ms=0,this.parseFromMilliseconds()),E)return p(k*d[m(E)],this);if(typeof k=="number")return this.$ms=k,this.parseFromMilliseconds(),this;if(typeof k=="object")return Object.keys(k).forEach((function(D){N.$d[m(D)]=k[D]})),this.calMilliseconds(),this;if(typeof k=="string"){var P=k.match(h);if(P){var I=P.slice(2).map((function(D){return D!=null?Number(D):0}));return this.$d.years=I[0],this.$d.months=I[1],this.$d.weeks=I[2],this.$d.days=I[3],this.$d.hours=I[4],this.$d.minutes=I[5],this.$d.seconds=I[6],this.calMilliseconds(),this}}return this}o(w,"l");var C=w.prototype;return C.calMilliseconds=function(){var k=this;this.$ms=Object.keys(this.$d).reduce((function(E,A){return E+(k.$d[A]||0)*d[A]}),0)},C.parseFromMilliseconds=function(){var k=this.$ms;this.$d.years=y(k/l),k%=l,this.$d.months=y(k/u),k%=u,this.$d.days=y(k/a),k%=a,this.$d.hours=y(k/n),k%=n,this.$d.minutes=y(k/i),k%=i,this.$d.seconds=y(k/r),k%=r,this.$d.milliseconds=k},C.toISOString=function(){var k=x(this.$d.years,"Y"),E=x(this.$d.months,"M"),A=+this.$d.days||0;this.$d.weeks&&(A+=7*this.$d.weeks);var N=x(A,"D"),P=x(this.$d.hours,"H"),I=x(this.$d.minutes,"M"),D=this.$d.seconds||0;this.$d.milliseconds&&(D+=this.$d.milliseconds/1e3,D=Math.round(1e3*D)/1e3);var _=x(D,"S"),R=k.negative||E.negative||N.negative||P.negative||I.negative||_.negative,M=P.format||I.format||_.format?"T":"",L=(R?"-":"")+"P"+k.format+E.format+N.format+M+P.format+I.format+_.format;return L==="P"||L==="-P"?"P0D":L},C.toJSON=function(){return this.toISOString()},C.format=function(k){var E=k||"YYYY-MM-DDTHH:mm:ss",A={Y:this.$d.years,YY:t.s(this.$d.years,2,"0"),YYYY:t.s(this.$d.years,4,"0"),M:this.$d.months,MM:t.s(this.$d.months,2,"0"),D:this.$d.days,DD:t.s(this.$d.days,2,"0"),H:this.$d.hours,HH:t.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:t.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:t.s(this.$d.seconds,2,"0"),SSS:t.s(this.$d.milliseconds,3,"0")};return E.replace(s,(function(N,P){return P||String(A[N])}))},C.as=function(k){return this.$ms/d[m(k)]},C.get=function(k){var E=this.$ms,A=m(k);return A==="milliseconds"?E%=1e3:E=A==="weeks"?y(E/d[A]):this.$d[A],E||0},C.add=function(k,E,A){var N;return N=E?k*d[m(E)]:f(k)?k.$ms:p(k,this).$ms,p(this.$ms+N*(A?-1:1),this)},C.subtract=function(k,E){return this.add(k,E,!0)},C.locale=function(k){var E=this.clone();return E.$l=k,E},C.clone=function(){return p(this.$ms,this)},C.humanize=function(k){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!k)},C.valueOf=function(){return this.asMilliseconds()},C.milliseconds=function(){return this.get("milliseconds")},C.asMilliseconds=function(){return this.as("milliseconds")},C.seconds=function(){return this.get("seconds")},C.asSeconds=function(){return this.as("seconds")},C.minutes=function(){return this.get("minutes")},C.asMinutes=function(){return this.as("minutes")},C.hours=function(){return this.get("hours")},C.asHours=function(){return this.as("hours")},C.days=function(){return this.get("days")},C.asDays=function(){return this.as("days")},C.weeks=function(){return this.get("weeks")},C.asWeeks=function(){return this.as("weeks")},C.months=function(){return this.get("months")},C.asMonths=function(){return this.as("months")},C.years=function(){return this.get("years")},C.asYears=function(){return this.as("years")},w})(),T=o(function(w,C,k){return w.add(C.years()*k,"y").add(C.months()*k,"M").add(C.days()*k,"d").add(C.hours()*k,"h").add(C.minutes()*k,"m").add(C.seconds()*k,"s").add(C.milliseconds()*k,"ms")},"p");return function(w,C,k){e=k,t=k().$utils(),k.duration=function(N,P){var I=k.locale();return p(N,{$l:I},P)},k.isDuration=f;var E=C.prototype.add,A=C.prototype.subtract;C.prototype.add=function(N,P){return f(N)?T(this,N,1):E.bind(this)(N,P)},C.prototype.subtract=function(N,P){return f(N)?T(this,N,-1):A.bind(this)(N,P)}}}))});var yy,M5e,i2t,L5e,n2t,kh,$V,a2t,N5e,I5e=z(()=>{"use strict";yy=ys(wC(),1),M5e=ys(R5e(),1);St();Rr();Ir();Ut();Di();yy.default.extend(M5e.default);i2t=o(function(){Z.debug("Something is calling, setConf, remove the call")},"setConf"),L5e={monday:Qh,tuesday:fw,wednesday:pw,thursday:vc,friday:mw,saturday:gw,sunday:wl},n2t=o((e,t)=>{let r=[...e].map(()=>-1/0),i=[...e].sort((a,s)=>a.startTime-s.startTime||a.order-s.order),n=0;for(let a of i)for(let s=0;s=r[s]){r[s]=a.endTime,a.order=s+t,s>n&&(n=s);break}return n},"getMaxIntersections"),$V=1e4,a2t=o(function(e,t,r,i){let n=ge().gantt;i.db.setDiagramId(t);let a=ge().securityLevel,s;a==="sandbox"&&(s=Je("#i"+t));let l=a==="sandbox"?Je(s.nodes()[0].contentDocument.body):Je("body"),u=a==="sandbox"?s.nodes()[0].contentDocument:document,h=u.getElementById(t);kh=h.parentElement.offsetWidth,kh===void 0&&(kh=1200),n.useWidth!==void 0&&(kh=n.useWidth);let d=i.db.getTasks(),f=[];for(let N of d)f.push(N.type);f=A(f);let p={},m=2*n.topPadding;if(i.db.getDisplayMode()==="compact"||n.displayMode==="compact"){let N={};for(let I of d)N[I.section]===void 0?N[I.section]=[I]:N[I.section].push(I);let P=0;for(let I of Object.keys(N)){let D=n2t(N[I],P)+1;P+=D,m+=D*(n.barHeight+n.barGap),p[I]=D}}else{m+=d.length*(n.barHeight+n.barGap);for(let N of f)p[N]=d.filter(P=>P.type===N).length}h.setAttribute("viewBox","0 0 "+kh+" "+m);let g=l.select(`[id="${t}"]`),y=xw().domain([wk(d,function(N){return N.startTime}),kk(d,function(N){return N.endTime})]).rangeRound([0,kh-n.leftPadding-n.rightPadding]);function v(N,P){let I=N.startTime,D=P.startTime,_=0;return I>D?_=1:IF.vert===V.vert?0:F.vert?1:-1);let B=[...new Set(N.map(F=>F.order))].map(F=>N.find(V=>V.order===F));g.append("g").selectAll("rect").data(B).enter().append("rect").attr("x",0).attr("y",function(F,V){return V=F.order,V*P+I-2}).attr("width",function(){return M-n.rightPadding/2}).attr("height",P).attr("class",function(F){for(let[V,H]of f.entries())if(F.type===H)return"section section"+V%n.numberSectionStyles;return"section section0"}).enter();let O=g.append("g").selectAll("rect").data(N).enter(),$=i.db.getLinks();if(O.append("rect").attr("id",function(F){return t+"-"+F.id}).attr("rx",3).attr("ry",3).attr("x",function(F){return F.milestone?y(F.startTime)+D+.5*(y(F.endTime)-y(F.startTime))-.5*_:y(F.startTime)+D}).attr("y",function(F,V){return V=F.order,F.vert?n.gridLineStartPadding:V*P+I}).attr("width",function(F){return F.milestone?_:F.vert?.08*_:y(F.renderEndTime||F.endTime)-y(F.startTime)}).attr("height",function(F){return F.vert?d.length*(n.barHeight+n.barGap)+n.barHeight*2:_}).attr("transform-origin",function(F,V){return V=F.order,(y(F.startTime)+D+.5*(y(F.endTime)-y(F.startTime))).toString()+"px "+(V*P+I+.5*_).toString()+"px"}).attr("class",function(F){let V="task",H="";F.classes.length>0&&(H=F.classes.join(" "));let j=0;for(let[Q,Y]of f.entries())F.type===Y&&(j=Q%n.numberSectionStyles);let U="";return F.active?F.crit?U+=" activeCrit":U=" active":F.done?F.crit?U=" doneCrit":U=" done":F.crit&&(U+=" crit"),U.length===0&&(U=" task"),F.milestone&&(U=" milestone "+U),F.vert&&(U=" vert "+U),U+=j,U+=" "+H,V+U}),O.append("text").attr("id",function(F){return t+"-"+F.id+"-text"}).text(function(F){return F.task}).attr("font-size",n.fontSize).attr("x",function(F){let V=y(F.startTime),H=y(F.renderEndTime||F.endTime);if(F.milestone&&(V+=.5*(y(F.endTime)-y(F.startTime))-.5*_,H=V+_),F.vert)return y(F.startTime)+D;let j=this.getBBox().width;return j>H-V?H+j+1.5*n.leftPadding>M?V+D-5:H+D+5:(H-V)/2+V+D}).attr("y",function(F,V){return F.vert?n.gridLineStartPadding+d.length*(n.barHeight+n.barGap)+60:(V=F.order,V*P+n.barHeight/2+(n.fontSize/2-2)+I)}).attr("text-height",_).attr("class",function(F){let V=y(F.startTime),H=y(F.endTime);F.milestone&&(H=V+_);let j=this.getBBox().width,U="";F.classes.length>0&&(U=F.classes.join(" "));let Q=0;for(let[ae,J]of f.entries())F.type===J&&(Q=ae%n.numberSectionStyles);let Y="";return F.active&&(F.crit?Y="activeCritText"+Q:Y="activeText"+Q),F.done?F.crit?Y=Y+" doneCritText"+Q:Y=Y+" doneText"+Q:F.crit&&(Y=Y+" critText"+Q),F.milestone&&(Y+=" milestoneText"),F.vert&&(Y+=" vertText"),j>H-V?H+j+1.5*n.leftPadding>M?U+" taskTextOutsideLeft taskTextOutside"+Q+" "+Y:U+" taskTextOutsideRight taskTextOutside"+Q+" "+Y+" width-"+j:U+" taskText taskText"+Q+" "+Y+" width-"+j}),ge().securityLevel==="sandbox"){let F;F=Je("#i"+t);let V=F.nodes()[0].contentDocument;O.filter(function(H){return $.has(H.id)}).each(function(H){var j=V.querySelector("#"+CSS.escape(t+"-"+H.id)),U=V.querySelector("#"+CSS.escape(t+"-"+H.id+"-text"));let Q=j.parentNode;var Y=V.createElement("a");Y.setAttribute("xlink:href",$.get(H.id)),Y.setAttribute("target","_top"),Q.appendChild(Y),Y.appendChild(j),Y.appendChild(U)})}}o(b,"drawRects");function T(N,P,I,D,_,R,M,L){if(M.length===0&&L.length===0)return;let B,O;for(let{startTime:j,endTime:U}of R)(B===void 0||jO)&&(O=U);if(!B||!O)return;if((0,yy.default)(O).diff((0,yy.default)(B),"year")>5){Z.warn("The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days.");return}let $=i.db.getDateFormat(),G=[],F=null,V=(0,yy.default)(B);for(;V.valueOf()<=O;)i.db.isInvalidDate(V,$,M,L)?F?F.end=V:F={start:V,end:V}:F&&(G.push(F),F=null),V=V.add(1,"d");g.append("g").selectAll("rect").data(G).enter().append("rect").attr("id",j=>t+"-exclude-"+j.start.format("YYYY-MM-DD")).attr("x",j=>y(j.start.startOf("day"))+I).attr("y",n.gridLineStartPadding).attr("width",j=>y(j.end.endOf("day"))-y(j.start.startOf("day"))).attr("height",_-P-n.gridLineStartPadding).attr("transform-origin",function(j,U){return(y(j.start)+I+.5*(y(j.end)-y(j.start))).toString()+"px "+(U*N+.5*_).toString()+"px"}).attr("class","exclude-range")}o(T,"drawExcludeDays");function w(N,P,I,D){if(I<=0||N>P)return 1/0;let _=P-N,R=yy.default.duration({[D??"day"]:I}).asMilliseconds();return R<=0?1/0:Math.ceil(_/R)}o(w,"getEstimatedTickCount");function C(N,P,I,D){let _=i.db.getDateFormat(),R=i.db.getAxisFormat(),M;R?M=R:_==="D"?M="%d":M=n.axisFormat??"%Y-%m-%d";let L=JD(y).tickSize(-D+P+n.gridLineStartPadding).tickFormat(fp(M)),O=/^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(i.db.getTickInterval()||n.tickInterval);if(O!==null){let $=parseInt(O[1],10);if(isNaN($)||$<=0)Z.warn(`Invalid tick interval value: "${O[1]}". Skipping custom tick interval.`);else{let G=O[2],F=i.db.getWeekday()||n.weekday,V=y.domain(),H=V[0],j=V[1],U=w(H,j,$,G);if(U>$V)Z.warn(`The tick interval "${$}${G}" would generate ${U} ticks, which exceeds the maximum allowed (${$V}). This may indicate an invalid date or time range. Skipping custom tick interval.`);else switch(G){case"millisecond":L.ticks(gc.every($));break;case"second":L.ticks(io.every($));break;case"minute":L.ticks(Ru.every($));break;case"hour":L.ticks(Lu.every($));break;case"day":L.ticks(Oo.every($));break;case"week":L.ticks(L5e[F].every($));break;case"month":L.ticks(Mu.every($));break}}}if(g.append("g").attr("class","grid").attr("transform","translate("+N+", "+(D-50)+")").call(L).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10).attr("dy","1em"),i.db.topAxisEnabled()||n.topAxis){let $=QD(y).tickSize(-D+P+n.gridLineStartPadding).tickFormat(fp(M));if(O!==null){let G=parseInt(O[1],10);if(isNaN(G)||G<=0)Z.warn(`Invalid tick interval value: "${O[1]}". Skipping custom tick interval.`);else{let F=O[2],V=i.db.getWeekday()||n.weekday,H=y.domain(),j=H[0],U=H[1];if(w(j,U,G,F)<=$V)switch(F){case"millisecond":$.ticks(gc.every(G));break;case"second":$.ticks(io.every(G));break;case"minute":$.ticks(Ru.every(G));break;case"hour":$.ticks(Lu.every(G));break;case"day":$.ticks(Oo.every(G));break;case"week":$.ticks(L5e[V].every(G));break;case"month":$.ticks(Mu.every(G));break}}}g.append("g").attr("class","grid").attr("transform","translate("+N+", "+P+")").call($).selectAll("text").style("text-anchor","middle").attr("fill","#000").attr("stroke","none").attr("font-size",10)}}o(C,"makeGrid");function k(N,P){let I=0,D=Object.keys(p).map(_=>[_,p[_]]);g.append("g").selectAll("text").data(D).enter().append(function(_){let R=_[0].split(vt.lineBreakRegex),M=-(R.length-1)/2,L=u.createElementNS("http://www.w3.org/2000/svg","text");L.setAttribute("dy",M+"em");for(let[B,O]of R.entries()){let $=u.createElementNS("http://www.w3.org/2000/svg","tspan");$.setAttribute("alignment-baseline","central"),$.setAttribute("x","10"),B>0&&$.setAttribute("dy","1em"),$.textContent=O,L.appendChild($)}return L}).attr("x",10).attr("y",function(_,R){if(R>0)for(let M=0;M{"use strict";s2t=o(e=>` + .mermaid-main-font { + font-family: ${e.fontFamily}; + } + + .exclude-range { + fill: ${e.excludeBkgColor}; + } + + .section { + stroke: none; + opacity: 0.2; + } + + .section0 { + fill: ${e.sectionBkgColor}; + } + + .section2 { + fill: ${e.sectionBkgColor2}; + } + + .section1, + .section3 { + fill: ${e.altSectionBkgColor}; + opacity: 0.2; + } + + .sectionTitle0 { + fill: ${e.titleColor}; + } + + .sectionTitle1 { + fill: ${e.titleColor}; + } + + .sectionTitle2 { + fill: ${e.titleColor}; + } + + .sectionTitle3 { + fill: ${e.titleColor}; + } + + .sectionTitle { + text-anchor: start; + font-family: ${e.fontFamily}; + } + + + /* Grid and axis */ + + .grid .tick { + stroke: ${e.gridColor}; + opacity: 0.8; + shape-rendering: crispEdges; + } + + .grid .tick text { + font-family: ${e.fontFamily}; + fill: ${e.textColor}; + } + + .grid path { + stroke-width: 0; + } + + + /* Today line */ + + .today { + fill: none; + stroke: ${e.todayLineColor}; + stroke-width: 2px; + } + + + /* Task styling */ + + /* Default task */ + + .task { + stroke-width: 2; + } + + .taskText { + text-anchor: middle; + font-family: ${e.fontFamily}; + } + + .taskTextOutsideRight { + fill: ${e.taskTextDarkColor}; + text-anchor: start; + font-family: ${e.fontFamily}; + } + + .taskTextOutsideLeft { + fill: ${e.taskTextDarkColor}; + text-anchor: end; + } + + + /* Special case clickable */ + + .task.clickable { + cursor: pointer; + } + + .taskText.clickable { + cursor: pointer; + fill: ${e.taskTextClickableColor} !important; + font-weight: bold; + } + + .taskTextOutsideLeft.clickable { + cursor: pointer; + fill: ${e.taskTextClickableColor} !important; + font-weight: bold; + } + + .taskTextOutsideRight.clickable { + cursor: pointer; + fill: ${e.taskTextClickableColor} !important; + font-weight: bold; + } + + + /* Specific task settings for the sections*/ + + .taskText0, + .taskText1, + .taskText2, + .taskText3 { + fill: ${e.taskTextColor}; + } + + .task0, + .task1, + .task2, + .task3 { + fill: ${e.taskBkgColor}; + stroke: ${e.taskBorderColor}; + } + + .taskTextOutside0, + .taskTextOutside2 + { + fill: ${e.taskTextOutsideColor}; + } + + .taskTextOutside1, + .taskTextOutside3 { + fill: ${e.taskTextOutsideColor}; + } + + + /* Active task */ + + .active0, + .active1, + .active2, + .active3 { + fill: ${e.activeTaskBkgColor}; + stroke: ${e.activeTaskBorderColor}; + } + + .activeText0, + .activeText1, + .activeText2, + .activeText3 { + fill: ${e.taskTextDarkColor} !important; + } + + + /* Completed task */ + + .done0, + .done1, + .done2, + .done3 { + stroke: ${e.doneTaskBorderColor}; + fill: ${e.doneTaskBkgColor}; + stroke-width: 2; + } + + .doneText0, + .doneText1, + .doneText2, + .doneText3 { + fill: ${e.taskTextDarkColor} !important; + } + + /* Done task text displayed outside the bar sits against the diagram background, + not against the done-task bar, so it must use the outside/contrast color. */ + .doneText0.taskTextOutsideLeft, + .doneText0.taskTextOutsideRight, + .doneText1.taskTextOutsideLeft, + .doneText1.taskTextOutsideRight, + .doneText2.taskTextOutsideLeft, + .doneText2.taskTextOutsideRight, + .doneText3.taskTextOutsideLeft, + .doneText3.taskTextOutsideRight { + fill: ${e.taskTextOutsideColor} !important; + } + + + /* Tasks on the critical line */ + + .crit0, + .crit1, + .crit2, + .crit3 { + stroke: ${e.critBorderColor}; + fill: ${e.critBkgColor}; + stroke-width: 2; + } + + .activeCrit0, + .activeCrit1, + .activeCrit2, + .activeCrit3 { + stroke: ${e.critBorderColor}; + fill: ${e.activeTaskBkgColor}; + stroke-width: 2; + } + + .doneCrit0, + .doneCrit1, + .doneCrit2, + .doneCrit3 { + stroke: ${e.critBorderColor}; + fill: ${e.doneTaskBkgColor}; + stroke-width: 2; + cursor: pointer; + shape-rendering: crispEdges; + } + + .milestone { + transform: rotate(45deg) scale(0.8,0.8); + } + + .milestoneText { + font-style: italic; + } + .doneCritText0, + .doneCritText1, + .doneCritText2, + .doneCritText3 { + fill: ${e.taskTextDarkColor} !important; + } + + /* Done-crit task text outside the bar \u2014 same reasoning as doneText above. */ + .doneCritText0.taskTextOutsideLeft, + .doneCritText0.taskTextOutsideRight, + .doneCritText1.taskTextOutsideLeft, + .doneCritText1.taskTextOutsideRight, + .doneCritText2.taskTextOutsideLeft, + .doneCritText2.taskTextOutsideRight, + .doneCritText3.taskTextOutsideLeft, + .doneCritText3.taskTextOutsideRight { + fill: ${e.taskTextOutsideColor} !important; + } + + .vert { + stroke: ${e.vertLineColor}; + } + + .vertText { + font-size: 15px; + text-anchor: middle; + fill: ${e.vertLineColor} !important; + } + + .activeCritText0, + .activeCritText1, + .activeCritText2, + .activeCritText3 { + fill: ${e.taskTextDarkColor} !important; + } + + .titleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.titleColor||e.textColor}; + font-family: ${e.fontFamily}; + } +`,"getStyles"),O5e=s2t});var B5e={};xr(B5e,{diagram:()=>o2t});var o2t,F5e=z(()=>{"use strict";c5e();D5e();I5e();P5e();o2t={parser:l5e,db:A5e,renderer:N5e,styles:O5e}});var G5e,V5e=z(()=>{"use strict";sl();St();G5e={parse:o(async e=>{let t=await bn("info",e);Z.debug(t)},"parse")}});var h2t,d2t,W5e,q5e=z(()=>{"use strict";h2t={version:"11.15.0"},d2t=o(()=>h2t.version,"getVersion"),W5e={getVersion:d2t}});var bi,ps=z(()=>{"use strict";Rr();Ut();bi=o(e=>{let{securityLevel:t}=ge(),r=Je("body");if(t==="sandbox"){let a=Je(`#i${e}`).node()?.contentDocument??document;r=Je(a.body)}return r.select(`#${e}`)},"selectSvgElement")});var f2t,U5e,H5e=z(()=>{"use strict";St();ps();Di();f2t=o((e,t,r)=>{Z.debug(`rendering info diagram +`+e);let i=bi(t);Br(i,100,400,!0),i.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${r}`)},"draw"),U5e={draw:f2t}});var Y5e={};xr(Y5e,{diagram:()=>p2t});var p2t,j5e=z(()=>{"use strict";V5e();q5e();H5e();p2t={parser:G5e,db:W5e,renderer:U5e}});var Z5e,zV,R6,GV,y2t,v2t,x2t,b2t,T2t,C2t,k2t,L6,VV=z(()=>{"use strict";St();Ci();Bn();Z5e=or.pie,zV={sections:new Map,showData:!1,config:Z5e},R6=zV.sections,GV=zV.showData,y2t=structuredClone(Z5e),v2t=o(()=>structuredClone(y2t),"getConfig"),x2t=o(()=>{R6=new Map,GV=zV.showData,gr()},"clear"),b2t=o(({label:e,value:t})=>{if(t<0)throw new Error(`"${e}" has invalid value: ${t}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);R6.has(e)||(R6.set(e,t),Z.debug(`added new section: ${e}, with value: ${t}`))},"addSection"),T2t=o(()=>R6,"getSections"),C2t=o(e=>{GV=e},"setShowData"),k2t=o(()=>GV,"getShowData"),L6={getConfig:v2t,clear:x2t,setDiagramTitle:Ar,getDiagramTitle:Er,setAccTitle:Cr,getAccTitle:kr,setAccDescription:wr,getAccDescription:Sr,addSection:b2t,getSections:T2t,setShowData:C2t,getShowData:k2t}});var w2t,Q5e,J5e=z(()=>{"use strict";sl();St();au();VV();w2t=o((e,t)=>{ca(e,t),t.setShowData(e.showData),e.sections.map(t.addSection)},"populateDb"),Q5e={parse:o(async e=>{let t=await bn("pie",e);Z.debug(t),w2t(t,L6)},"parse")}});var S2t,eAe,tAe=z(()=>{"use strict";S2t=o(e=>` + .pieCircle{ + stroke: ${e.pieStrokeColor}; + stroke-width : ${e.pieStrokeWidth}; + opacity : ${e.pieOpacity}; + } + .pieOuterCircle{ + stroke: ${e.pieOuterStrokeColor}; + stroke-width: ${e.pieOuterStrokeWidth}; + fill: none; + } + .pieTitleText { + text-anchor: middle; + font-size: ${e.pieTitleTextSize}; + fill: ${e.pieTitleTextColor}; + font-family: ${e.fontFamily}; + } + .slice { + font-family: ${e.fontFamily}; + fill: ${e.pieSectionTextColor}; + font-size:${e.pieSectionTextSize}; + // fill: white; + } + .legend text { + fill: ${e.pieLegendTextColor}; + font-family: ${e.fontFamily}; + font-size: ${e.pieLegendTextSize}; + } +`,"getStyles"),eAe=S2t});var E2t,A2t,rAe,iAe=z(()=>{"use strict";Rr();Ut();St();ps();Di();Xt();E2t=o(e=>{let t=[...e.values()].reduce((n,a)=>n+a,0),r=[...e.entries()].map(([n,a])=>({label:n,value:a})).filter(n=>n.value/t*100>=1);return Sw().value(n=>n.value).sort(null)(r)},"createPieArcs"),A2t=o((e,t,r,i)=>{Z.debug(`rendering pie chart +`+e);let n=i.db,a=ge(),s=Gr(n.getConfig(),a.pie),l=40,u=18,h=4,d=450,f=d,p=bi(t),m=p.append("g");m.attr("transform","translate("+f/2+","+d/2+")");let{themeVariables:g}=a,[y]=Za(g.pieOuterStrokeWidth);y??=2;let v=s.textPosition,x=Math.min(f,d)/2-l,b=Al().innerRadius(0).outerRadius(x),T=Al().innerRadius(x*v).outerRadius(x*v);m.append("circle").attr("cx",0).attr("cy",0).attr("r",x+y/2).attr("class","pieOuterCircle");let w=n.getSections(),C=E2t(w),k=[g.pie1,g.pie2,g.pie3,g.pie4,g.pie5,g.pie6,g.pie7,g.pie8,g.pie9,g.pie10,g.pie11,g.pie12],E=0;w.forEach(F=>{E+=F});let A=C.filter(F=>(F.data.value/E*100).toFixed(0)!=="0"),N=ro(k).domain([...w.keys()]);m.selectAll("mySlices").data(A).enter().append("path").attr("d",b).attr("fill",F=>N(F.data.label)).attr("class","pieCircle"),m.selectAll("mySlices").data(A).enter().append("text").text(F=>(F.data.value/E*100).toFixed(0)+"%").attr("transform",F=>"translate("+T.centroid(F)+")").style("text-anchor","middle").attr("class","slice");let P=m.append("text").text(n.getDiagramTitle()).attr("x",0).attr("y",-(d-50)/2).attr("class","pieTitleText"),I=[...w.entries()].map(([F,V])=>({label:F,value:V})),D=m.selectAll(".legend").data(I).enter().append("g").attr("class","legend").attr("transform",(F,V)=>{let H=u+h,j=H*I.length/2,U=12*u,Q=V*H-j;return"translate("+U+","+Q+")"});D.append("rect").attr("width",u).attr("height",u).style("fill",F=>N(F.label)).style("stroke",F=>N(F.label)),D.append("text").attr("x",u+h).attr("y",u-h).text(F=>n.getShowData()?`${F.label} [${F.value}]`:F.label);let _=Math.max(...D.selectAll("text").nodes().map(F=>F?.getBoundingClientRect().width??0)),R=f+l+u+h+_,M=P.node()?.getBoundingClientRect().width??0,L=f/2-M/2,B=f/2+M/2,O=Math.min(0,L),G=Math.max(R,B)-O;p.attr("viewBox",`${O} 0 ${G} ${d}`),Br(p,d,G,s.useMaxWidth)},"draw"),rAe={draw:A2t}});var nAe={};xr(nAe,{diagram:()=>_2t});var _2t,aAe=z(()=>{"use strict";J5e();VV();tAe();iAe();_2t={parser:Q5e,db:L6,renderer:rAe,styles:eAe}});var WV,oAe,lAe=z(()=>{"use strict";WV=(function(){var e=o(function(W,ce,K,Re){for(K=K||{},Re=W.length;Re--;K[W[Re]]=ce);return K},"o"),t=[1,3],r=[1,4],i=[1,5],n=[1,6],a=[1,7],s=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],l=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],u=[55,56,57],h=[2,36],d=[1,37],f=[1,36],p=[1,38],m=[1,35],g=[1,43],y=[1,41],v=[1,45],x=[1,14],b=[1,23],T=[1,18],w=[1,19],C=[1,20],k=[1,21],E=[1,22],A=[1,24],N=[1,25],P=[1,26],I=[1,27],D=[1,28],_=[1,29],R=[1,32],M=[1,33],L=[1,34],B=[1,39],O=[1,40],$=[1,42],G=[1,44],F=[1,63],V=[1,62],H=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],j=[1,66],U=[1,67],Q=[1,68],Y=[1,69],ae=[1,70],J=[1,71],te=[1,72],re=[1,73],ee=[1,74],Te=[1,75],ue=[1,76],De=[1,77],Ie=[4,5,6,7,8,9,10,11,12,13,14,15,18],Ee=[1,91],we=[1,92],Me=[1,93],$e=[1,100],de=[1,94],rt=[1,97],ke=[1,95],Fe=[1,96],He=[1,98],at=[1,99],qe=[1,103],Ue=[10,55,56,57],ye=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],ve={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(ce,K,Re,xe,Oe,be,Be){var Ae=be.length-1;switch(Oe){case 23:this.$=be[Ae];break;case 24:this.$=be[Ae-1]+""+be[Ae];break;case 26:this.$=be[Ae-1]+be[Ae];break;case 27:this.$=[be[Ae].trim()];break;case 28:be[Ae-2].push(be[Ae].trim()),this.$=be[Ae-2];break;case 29:this.$=be[Ae-4],xe.addClass(be[Ae-2],be[Ae]);break;case 37:this.$=[];break;case 42:this.$=be[Ae].trim(),xe.setDiagramTitle(this.$);break;case 43:this.$=be[Ae].trim(),xe.setAccTitle(this.$);break;case 44:case 45:this.$=be[Ae].trim(),xe.setAccDescription(this.$);break;case 46:xe.addSection(be[Ae].substr(8)),this.$=be[Ae].substr(8);break;case 47:xe.addPoint(be[Ae-3],"",be[Ae-1],be[Ae],[]);break;case 48:xe.addPoint(be[Ae-4],be[Ae-3],be[Ae-1],be[Ae],[]);break;case 49:xe.addPoint(be[Ae-4],"",be[Ae-2],be[Ae-1],be[Ae]);break;case 50:xe.addPoint(be[Ae-5],be[Ae-4],be[Ae-2],be[Ae-1],be[Ae]);break;case 51:xe.setXAxisLeftText(be[Ae-2]),xe.setXAxisRightText(be[Ae]);break;case 52:be[Ae-1].text+=" \u27F6 ",xe.setXAxisLeftText(be[Ae-1]);break;case 53:xe.setXAxisLeftText(be[Ae]);break;case 54:xe.setYAxisBottomText(be[Ae-2]),xe.setYAxisTopText(be[Ae]);break;case 55:be[Ae-1].text+=" \u27F6 ",xe.setYAxisBottomText(be[Ae-1]);break;case 56:xe.setYAxisBottomText(be[Ae]);break;case 57:xe.setQuadrant1Text(be[Ae]);break;case 58:xe.setQuadrant2Text(be[Ae]);break;case 59:xe.setQuadrant3Text(be[Ae]);break;case 60:xe.setQuadrant4Text(be[Ae]);break;case 64:this.$={text:be[Ae],type:"text"};break;case 65:this.$={text:be[Ae-1].text+""+be[Ae],type:be[Ae-1].type};break;case 66:this.$={text:be[Ae],type:"text"};break;case 67:this.$={text:be[Ae],type:"markdown"};break;case 68:this.$=be[Ae];break;case 69:this.$=be[Ae-1]+""+be[Ae];break}},"anonymous"),table:[{18:t,26:1,27:2,28:r,55:i,56:n,57:a},{1:[3]},{18:t,26:8,27:2,28:r,55:i,56:n,57:a},{18:t,26:9,27:2,28:r,55:i,56:n,57:a},e(s,[2,33],{29:10}),e(l,[2,61]),e(l,[2,62]),e(l,[2,63]),{1:[2,30]},{1:[2,31]},e(u,h,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:f,10:p,12:m,13:g,14:y,15:v,18:x,25:b,35:T,37:w,39:C,41:k,42:E,48:A,50:N,51:P,52:I,53:D,54:_,60:R,61:M,63:L,64:B,65:O,66:$,67:G}),e(s,[2,34]),{27:46,55:i,56:n,57:a},e(u,[2,37]),e(u,h,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:f,10:p,12:m,13:g,14:y,15:v,18:x,25:b,35:T,37:w,39:C,41:k,42:E,48:A,50:N,51:P,52:I,53:D,54:_,60:R,61:M,63:L,64:B,65:O,66:$,67:G}),e(u,[2,39]),e(u,[2,40]),e(u,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},e(u,[2,45]),e(u,[2,46]),{18:[1,51]},{4:d,5:f,10:p,12:m,13:g,14:y,15:v,43:52,58:31,60:R,61:M,63:L,64:B,65:O,66:$,67:G},{4:d,5:f,10:p,12:m,13:g,14:y,15:v,43:53,58:31,60:R,61:M,63:L,64:B,65:O,66:$,67:G},{4:d,5:f,10:p,12:m,13:g,14:y,15:v,43:54,58:31,60:R,61:M,63:L,64:B,65:O,66:$,67:G},{4:d,5:f,10:p,12:m,13:g,14:y,15:v,43:55,58:31,60:R,61:M,63:L,64:B,65:O,66:$,67:G},{4:d,5:f,10:p,12:m,13:g,14:y,15:v,43:56,58:31,60:R,61:M,63:L,64:B,65:O,66:$,67:G},{4:d,5:f,10:p,12:m,13:g,14:y,15:v,43:57,58:31,60:R,61:M,63:L,64:B,65:O,66:$,67:G},{4:d,5:f,8:F,10:p,12:m,13:g,14:y,15:v,18:V,44:[1,58],47:[1,59],58:61,59:60,63:L,64:B,65:O,66:$,67:G},e(H,[2,64]),e(H,[2,66]),e(H,[2,67]),e(H,[2,70]),e(H,[2,71]),e(H,[2,72]),e(H,[2,73]),e(H,[2,74]),e(H,[2,75]),e(H,[2,76]),e(H,[2,77]),e(H,[2,78]),e(H,[2,79]),e(H,[2,80]),e(H,[2,81]),e(s,[2,35]),e(u,[2,38]),e(u,[2,42]),e(u,[2,43]),e(u,[2,44]),{3:65,4:j,5:U,6:Q,7:Y,8:ae,9:J,10:te,11:re,12:ee,13:Te,14:ue,15:De,21:64},e(u,[2,53],{59:60,58:61,4:d,5:f,8:F,10:p,12:m,13:g,14:y,15:v,18:V,49:[1,78],63:L,64:B,65:O,66:$,67:G}),e(u,[2,56],{59:60,58:61,4:d,5:f,8:F,10:p,12:m,13:g,14:y,15:v,18:V,49:[1,79],63:L,64:B,65:O,66:$,67:G}),e(u,[2,57],{59:60,58:61,4:d,5:f,8:F,10:p,12:m,13:g,14:y,15:v,18:V,63:L,64:B,65:O,66:$,67:G}),e(u,[2,58],{59:60,58:61,4:d,5:f,8:F,10:p,12:m,13:g,14:y,15:v,18:V,63:L,64:B,65:O,66:$,67:G}),e(u,[2,59],{59:60,58:61,4:d,5:f,8:F,10:p,12:m,13:g,14:y,15:v,18:V,63:L,64:B,65:O,66:$,67:G}),e(u,[2,60],{59:60,58:61,4:d,5:f,8:F,10:p,12:m,13:g,14:y,15:v,18:V,63:L,64:B,65:O,66:$,67:G}),{45:[1,80]},{44:[1,81]},e(H,[2,65]),e(H,[2,82]),e(H,[2,83]),e(H,[2,84]),{3:83,4:j,5:U,6:Q,7:Y,8:ae,9:J,10:te,11:re,12:ee,13:Te,14:ue,15:De,18:[1,82]},e(Ie,[2,23]),e(Ie,[2,1]),e(Ie,[2,2]),e(Ie,[2,3]),e(Ie,[2,4]),e(Ie,[2,5]),e(Ie,[2,6]),e(Ie,[2,7]),e(Ie,[2,8]),e(Ie,[2,9]),e(Ie,[2,10]),e(Ie,[2,11]),e(Ie,[2,12]),e(u,[2,52],{58:31,43:84,4:d,5:f,10:p,12:m,13:g,14:y,15:v,60:R,61:M,63:L,64:B,65:O,66:$,67:G}),e(u,[2,55],{58:31,43:85,4:d,5:f,10:p,12:m,13:g,14:y,15:v,60:R,61:M,63:L,64:B,65:O,66:$,67:G}),{46:[1,86]},{45:[1,87]},{4:Ee,5:we,6:Me,8:$e,11:de,13:rt,16:90,17:ke,18:Fe,19:He,20:at,22:89,23:88},e(Ie,[2,24]),e(u,[2,51],{59:60,58:61,4:d,5:f,8:F,10:p,12:m,13:g,14:y,15:v,18:V,63:L,64:B,65:O,66:$,67:G}),e(u,[2,54],{59:60,58:61,4:d,5:f,8:F,10:p,12:m,13:g,14:y,15:v,18:V,63:L,64:B,65:O,66:$,67:G}),e(u,[2,47],{22:89,16:90,23:101,4:Ee,5:we,6:Me,8:$e,11:de,13:rt,17:ke,18:Fe,19:He,20:at}),{46:[1,102]},e(u,[2,29],{10:qe}),e(Ue,[2,27],{16:104,4:Ee,5:we,6:Me,8:$e,11:de,13:rt,17:ke,18:Fe,19:He,20:at}),e(ye,[2,25]),e(ye,[2,13]),e(ye,[2,14]),e(ye,[2,15]),e(ye,[2,16]),e(ye,[2,17]),e(ye,[2,18]),e(ye,[2,19]),e(ye,[2,20]),e(ye,[2,21]),e(ye,[2,22]),e(u,[2,49],{10:qe}),e(u,[2,48],{22:89,16:90,23:105,4:Ee,5:we,6:Me,8:$e,11:de,13:rt,17:ke,18:Fe,19:He,20:at}),{4:Ee,5:we,6:Me,8:$e,11:de,13:rt,16:90,17:ke,18:Fe,19:He,20:at,22:106},e(ye,[2,26]),e(u,[2,50],{10:qe}),e(Ue,[2,28],{16:104,4:Ee,5:we,6:Me,8:$e,11:de,13:rt,17:ke,18:Fe,19:He,20:at})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(ce,K){if(K.recoverable)this.trace(ce);else{var Re=new Error(ce);throw Re.hash=K,Re}},"parseError"),parse:o(function(ce){var K=this,Re=[0],xe=[],Oe=[null],be=[],Be=this.table,Ae="",Ve=0,Pe=0,Ye=0,le=2,st=1,me=be.slice.call(arguments,1),ot=Object.create(this.lexer),kt={yy:{}};for(var Gt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Gt)&&(kt.yy[Gt]=this.yy[Gt]);ot.setInput(ce,kt.yy),kt.yy.lexer=ot,kt.yy.parser=this,typeof ot.yylloc>"u"&&(ot.yylloc={});var Tt=ot.yylloc;be.push(Tt);var Et=ot.options&&ot.options.ranges;typeof kt.yy.parseError=="function"?this.parseError=kt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function yt(Se){Re.length=Re.length-2*Se,Oe.length=Oe.length-Se,be.length=be.length-Se}o(yt,"popStack");function oe(){var Se;return Se=xe.pop()||ot.lex()||st,typeof Se!="number"&&(Se instanceof Array&&(xe=Se,Se=xe.pop()),Se=K.symbols_[Se]||Se),Se}o(oe,"lex");for(var ht,gt,et,pe,Qe,nt,dt={},Ft,Rt,$t,lr;;){if(et=Re[Re.length-1],this.defaultActions[et]?pe=this.defaultActions[et]:((ht===null||typeof ht>"u")&&(ht=oe()),pe=Be[et]&&Be[et][ht]),typeof pe>"u"||!pe.length||!pe[0]){var pt="";lr=[];for(Ft in Be[et])this.terminals_[Ft]&&Ft>le&&lr.push("'"+this.terminals_[Ft]+"'");ot.showPosition?pt="Parse error on line "+(Ve+1)+`: +`+ot.showPosition()+` +Expecting `+lr.join(", ")+", got '"+(this.terminals_[ht]||ht)+"'":pt="Parse error on line "+(Ve+1)+": Unexpected "+(ht==st?"end of input":"'"+(this.terminals_[ht]||ht)+"'"),this.parseError(pt,{text:ot.match,token:this.terminals_[ht]||ht,line:ot.yylineno,loc:Tt,expected:lr})}if(pe[0]instanceof Array&&pe.length>1)throw new Error("Parse Error: multiple actions possible at state: "+et+", token: "+ht);switch(pe[0]){case 1:Re.push(ht),Oe.push(ot.yytext),be.push(ot.yylloc),Re.push(pe[1]),ht=null,gt?(ht=gt,gt=null):(Pe=ot.yyleng,Ae=ot.yytext,Ve=ot.yylineno,Tt=ot.yylloc,Ye>0&&Ye--);break;case 2:if(Rt=this.productions_[pe[1]][1],dt.$=Oe[Oe.length-Rt],dt._$={first_line:be[be.length-(Rt||1)].first_line,last_line:be[be.length-1].last_line,first_column:be[be.length-(Rt||1)].first_column,last_column:be[be.length-1].last_column},Et&&(dt._$.range=[be[be.length-(Rt||1)].range[0],be[be.length-1].range[1]]),nt=this.performAction.apply(dt,[Ae,Pe,Ve,kt.yy,pe[1],Oe,be].concat(me)),typeof nt<"u")return nt;Rt&&(Re=Re.slice(0,-1*Rt*2),Oe=Oe.slice(0,-1*Rt),be=be.slice(0,-1*Rt)),Re.push(this.productions_[pe[1]][0]),Oe.push(dt.$),be.push(dt._$),$t=Be[Re[Re.length-2]][Re[Re.length-1]],Re.push($t);break;case 3:return!0}}return!0},"parse")},ie=(function(){var W={EOF:1,parseError:o(function(K,Re){if(this.yy.parser)this.yy.parser.parseError(K,Re);else throw new Error(K)},"parseError"),setInput:o(function(ce,K){return this.yy=K||this.yy||{},this._input=ce,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var ce=this._input[0];this.yytext+=ce,this.yyleng++,this.offset++,this.match+=ce,this.matched+=ce;var K=ce.match(/(?:\r\n?|\n).*/g);return K?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ce},"input"),unput:o(function(ce){var K=ce.length,Re=ce.split(/(?:\r\n?|\n)/g);this._input=ce+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-K),this.offset-=K;var xe=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),Re.length-1&&(this.yylineno-=Re.length-1);var Oe=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:Re?(Re.length===xe.length?this.yylloc.first_column:0)+xe[xe.length-Re.length].length-Re[0].length:this.yylloc.first_column-K},this.options.ranges&&(this.yylloc.range=[Oe[0],Oe[0]+this.yyleng-K]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(ce){this.unput(this.match.slice(ce))},"less"),pastInput:o(function(){var ce=this.matched.substr(0,this.matched.length-this.match.length);return(ce.length>20?"...":"")+ce.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var ce=this.match;return ce.length<20&&(ce+=this._input.substr(0,20-ce.length)),(ce.substr(0,20)+(ce.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var ce=this.pastInput(),K=new Array(ce.length+1).join("-");return ce+this.upcomingInput()+` +`+K+"^"},"showPosition"),test_match:o(function(ce,K){var Re,xe,Oe;if(this.options.backtrack_lexer&&(Oe={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(Oe.yylloc.range=this.yylloc.range.slice(0))),xe=ce[0].match(/(?:\r\n?|\n).*/g),xe&&(this.yylineno+=xe.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:xe?xe[xe.length-1].length-xe[xe.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+ce[0].length},this.yytext+=ce[0],this.match+=ce[0],this.matches=ce,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(ce[0].length),this.matched+=ce[0],Re=this.performAction.call(this,this.yy,this,K,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),Re)return Re;if(this._backtrack){for(var be in Oe)this[be]=Oe[be];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var ce,K,Re,xe;this._more||(this.yytext="",this.match="");for(var Oe=this._currentRules(),be=0;beK[0].length)){if(K=Re,xe=be,this.options.backtrack_lexer){if(ce=this.test_match(Re,Oe[be]),ce!==!1)return ce;if(this._backtrack){K=!1;continue}else return!1}else if(!this.options.flex)break}return K?(ce=this.test_match(K,Oe[xe]),ce!==!1?ce:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var K=this.next();return K||this.lex()},"lex"),begin:o(function(K){this.conditionStack.push(K)},"begin"),popState:o(function(){var K=this.conditionStack.length-1;return K>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(K){return K=this.conditionStack.length-1-Math.abs(K||0),K>=0?this.conditionStack[K]:"INITIAL"},"topState"),pushState:o(function(K){this.begin(K)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(K,Re,xe,Oe){var be=Oe;switch(xe){case 0:break;case 1:break;case 2:return 55;case 3:break;case 4:return this.begin("title"),35;break;case 5:return this.popState(),"title_value";break;case 6:return this.begin("acc_title"),37;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),39;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 48;case 14:return 50;case 15:return 49;case 16:return 51;case 17:return 52;case 18:return 53;case 19:return 54;case 20:return 25;case 21:this.begin("md_string");break;case 22:return"MD_STR";case 23:this.popState();break;case 24:this.begin("string");break;case 25:this.popState();break;case 26:return"STR";case 27:this.begin("class_name");break;case 28:return this.popState(),47;break;case 29:return this.begin("point_start"),44;break;case 30:return this.begin("point_x"),45;break;case 31:this.popState();break;case 32:this.popState(),this.begin("point_y");break;case 33:return this.popState(),46;break;case 34:return 28;case 35:return 4;case 36:return 15;case 37:return 11;case 38:return 64;case 39:return 10;case 40:return 65;case 41:return 65;case 42:return 14;case 43:return 13;case 44:return 67;case 45:return 66;case 46:return 12;case 47:return 8;case 48:return 5;case 49:return 18;case 50:return 56;case 51:return 63;case 52:return 57}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?: *x-axis *)/i,/^(?: *y-axis *)/i,/^(?: *--+> *)/i,/^(?: *quadrant-1 *)/i,/^(?: *quadrant-2 *)/i,/^(?: *quadrant-3 *)/i,/^(?: *quadrant-4 *)/i,/^(?:classDef\b)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?::::)/i,/^(?:^\w+)/i,/^(?:\s*:\s*\[\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?:\s*\] *)/i,/^(?:\s*,\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?: *quadrantChart *)/i,/^(?:[A-Za-z]+)/i,/^(?:[^\x00-\x7F]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s)/i,/^(?:;)/i,/^(?:[!"#$%&'*+,-.`?\\_/])/i,/^(?:$)/i],conditions:{class_name:{rules:[28],inclusive:!1},point_y:{rules:[33],inclusive:!1},point_x:{rules:[32],inclusive:!1},point_start:{rules:[30,31],inclusive:!1},acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},title:{rules:[5],inclusive:!1},md_string:{rules:[22,23],inclusive:!1},string:{rules:[25,26],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,6,8,10,13,14,15,16,17,18,19,20,21,24,27,29,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}};return W})();ve.lexer=ie;function fe(){this.yy={}}return o(fe,"Parser"),fe.prototype=ve,ve.Parser=fe,new fe})();WV.parser=WV;oAe=WV});var ms,M6,cAe=z(()=>{"use strict";Rr();Bn();St();$f();ms=Ao(),M6=class{constructor(){this.classes=new Map;this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData()}static{o(this,"QuadrantBuilder")}getDefaultData(){return{titleText:"",quadrant1Text:"",quadrant2Text:"",quadrant3Text:"",quadrant4Text:"",xAxisLeftText:"",xAxisRightText:"",yAxisBottomText:"",yAxisTopText:"",points:[]}}getDefaultConfig(){return{showXAxis:!0,showYAxis:!0,showTitle:!0,chartHeight:or.quadrantChart?.chartWidth||500,chartWidth:or.quadrantChart?.chartHeight||500,titlePadding:or.quadrantChart?.titlePadding||10,titleFontSize:or.quadrantChart?.titleFontSize||20,quadrantPadding:or.quadrantChart?.quadrantPadding||5,xAxisLabelPadding:or.quadrantChart?.xAxisLabelPadding||5,yAxisLabelPadding:or.quadrantChart?.yAxisLabelPadding||5,xAxisLabelFontSize:or.quadrantChart?.xAxisLabelFontSize||16,yAxisLabelFontSize:or.quadrantChart?.yAxisLabelFontSize||16,quadrantLabelFontSize:or.quadrantChart?.quadrantLabelFontSize||16,quadrantTextTopPadding:or.quadrantChart?.quadrantTextTopPadding||5,pointTextPadding:or.quadrantChart?.pointTextPadding||5,pointLabelFontSize:or.quadrantChart?.pointLabelFontSize||12,pointRadius:or.quadrantChart?.pointRadius||5,xAxisPosition:or.quadrantChart?.xAxisPosition||"top",yAxisPosition:or.quadrantChart?.yAxisPosition||"left",quadrantInternalBorderStrokeWidth:or.quadrantChart?.quadrantInternalBorderStrokeWidth||1,quadrantExternalBorderStrokeWidth:or.quadrantChart?.quadrantExternalBorderStrokeWidth||2}}getDefaultThemeConfig(){return{quadrant1Fill:ms.quadrant1Fill,quadrant2Fill:ms.quadrant2Fill,quadrant3Fill:ms.quadrant3Fill,quadrant4Fill:ms.quadrant4Fill,quadrant1TextFill:ms.quadrant1TextFill,quadrant2TextFill:ms.quadrant2TextFill,quadrant3TextFill:ms.quadrant3TextFill,quadrant4TextFill:ms.quadrant4TextFill,quadrantPointFill:ms.quadrantPointFill,quadrantPointTextFill:ms.quadrantPointTextFill,quadrantXAxisTextFill:ms.quadrantXAxisTextFill,quadrantYAxisTextFill:ms.quadrantYAxisTextFill,quadrantTitleFill:ms.quadrantTitleFill,quadrantInternalBorderStrokeFill:ms.quadrantInternalBorderStrokeFill,quadrantExternalBorderStrokeFill:ms.quadrantExternalBorderStrokeFill}}clear(){this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData(),this.classes=new Map,Z.info("clear called")}setData(t){this.data={...this.data,...t}}addPoints(t){this.data.points=[...t,...this.data.points]}addClass(t,r){this.classes.set(t,r)}setConfig(t){Z.trace("setConfig called with: ",t),this.config={...this.config,...t}}setThemeConfig(t){Z.trace("setThemeConfig called with: ",t),this.themeConfig={...this.themeConfig,...t}}calculateSpace(t,r,i,n){let a=this.config.xAxisLabelPadding*2+this.config.xAxisLabelFontSize,s={top:t==="top"&&r?a:0,bottom:t==="bottom"&&r?a:0},l=this.config.yAxisLabelPadding*2+this.config.yAxisLabelFontSize,u={left:this.config.yAxisPosition==="left"&&i?l:0,right:this.config.yAxisPosition==="right"&&i?l:0},h=this.config.titleFontSize+this.config.titlePadding*2,d={top:n?h:0},f=this.config.quadrantPadding+u.left,p=this.config.quadrantPadding+s.top+d.top,m=this.config.chartWidth-this.config.quadrantPadding*2-u.left-u.right,g=this.config.chartHeight-this.config.quadrantPadding*2-s.top-s.bottom-d.top,y=m/2,v=g/2;return{xAxisSpace:s,yAxisSpace:u,titleSpace:d,quadrantSpace:{quadrantLeft:f,quadrantTop:p,quadrantWidth:m,quadrantHalfWidth:y,quadrantHeight:g,quadrantHalfHeight:v}}}getAxisLabels(t,r,i,n){let{quadrantSpace:a,titleSpace:s}=n,{quadrantHalfHeight:l,quadrantHeight:u,quadrantLeft:h,quadrantHalfWidth:d,quadrantTop:f,quadrantWidth:p}=a,m=!!this.data.xAxisRightText,g=!!this.data.yAxisTopText,y=[];return this.data.xAxisLeftText&&r&&y.push({text:this.data.xAxisLeftText,fill:this.themeConfig.quadrantXAxisTextFill,x:h+(m?d/2:0),y:t==="top"?this.config.xAxisLabelPadding+s.top:this.config.xAxisLabelPadding+f+u+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:m?"center":"left",horizontalPos:"top",rotation:0}),this.data.xAxisRightText&&r&&y.push({text:this.data.xAxisRightText,fill:this.themeConfig.quadrantXAxisTextFill,x:h+d+(m?d/2:0),y:t==="top"?this.config.xAxisLabelPadding+s.top:this.config.xAxisLabelPadding+f+u+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:m?"center":"left",horizontalPos:"top",rotation:0}),this.data.yAxisBottomText&&i&&y.push({text:this.data.yAxisBottomText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+h+p+this.config.quadrantPadding,y:f+u-(g?l/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:g?"center":"left",horizontalPos:"top",rotation:-90}),this.data.yAxisTopText&&i&&y.push({text:this.data.yAxisTopText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+h+p+this.config.quadrantPadding,y:f+l-(g?l/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:g?"center":"left",horizontalPos:"top",rotation:-90}),y}getQuadrants(t){let{quadrantSpace:r}=t,{quadrantHalfHeight:i,quadrantLeft:n,quadrantHalfWidth:a,quadrantTop:s}=r,l=[{text:{text:this.data.quadrant1Text,fill:this.themeConfig.quadrant1TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n+a,y:s,width:a,height:i,fill:this.themeConfig.quadrant1Fill},{text:{text:this.data.quadrant2Text,fill:this.themeConfig.quadrant2TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n,y:s,width:a,height:i,fill:this.themeConfig.quadrant2Fill},{text:{text:this.data.quadrant3Text,fill:this.themeConfig.quadrant3TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n,y:s+i,width:a,height:i,fill:this.themeConfig.quadrant3Fill},{text:{text:this.data.quadrant4Text,fill:this.themeConfig.quadrant4TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:n+a,y:s+i,width:a,height:i,fill:this.themeConfig.quadrant4Fill}];for(let u of l)u.text.x=u.x+u.width/2,this.data.points.length===0?(u.text.y=u.y+u.height/2,u.text.horizontalPos="middle"):(u.text.y=u.y+this.config.quadrantTextTopPadding,u.text.horizontalPos="top");return l}getQuadrantPoints(t){let{quadrantSpace:r}=t,{quadrantHeight:i,quadrantLeft:n,quadrantTop:a,quadrantWidth:s}=r,l=kl().domain([0,1]).range([n,s+n]),u=kl().domain([0,1]).range([i+a,a]);return this.data.points.map(d=>{let f=this.classes.get(d.className);return f&&(d={...f,...d}),{x:l(d.x),y:u(d.y),fill:d.color??this.themeConfig.quadrantPointFill,radius:d.radius??this.config.pointRadius,text:{text:d.text,fill:this.themeConfig.quadrantPointTextFill,x:l(d.x),y:u(d.y)+this.config.pointTextPadding,verticalPos:"center",horizontalPos:"top",fontSize:this.config.pointLabelFontSize,rotation:0},strokeColor:d.strokeColor??this.themeConfig.quadrantPointFill,strokeWidth:d.strokeWidth??"0px"}})}getBorders(t){let r=this.config.quadrantExternalBorderStrokeWidth/2,{quadrantSpace:i}=t,{quadrantHalfHeight:n,quadrantHeight:a,quadrantLeft:s,quadrantHalfWidth:l,quadrantTop:u,quadrantWidth:h}=i;return[{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:s-r,y1:u,x2:s+h+r,y2:u},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:s+h,y1:u+r,x2:s+h,y2:u+a-r},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:s-r,y1:u+a,x2:s+h+r,y2:u+a},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:s,y1:u+r,x2:s,y2:u+a-r},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:s+l,y1:u+r,x2:s+l,y2:u+a-r},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:s+r,y1:u+n,x2:s+h-r,y2:u+n}]}getTitle(t){if(t)return{text:this.data.titleText,fill:this.themeConfig.quadrantTitleFill,fontSize:this.config.titleFontSize,horizontalPos:"top",verticalPos:"center",rotation:0,y:this.config.titlePadding,x:this.config.chartWidth/2}}build(){let t=this.config.showXAxis&&!!(this.data.xAxisLeftText||this.data.xAxisRightText),r=this.config.showYAxis&&!!(this.data.yAxisTopText||this.data.yAxisBottomText),i=this.config.showTitle&&!!this.data.titleText,n=this.data.points.length>0?"bottom":this.config.xAxisPosition,a=this.calculateSpace(n,t,r,i);return{points:this.getQuadrantPoints(a),quadrants:this.getQuadrants(a),axisLabels:this.getAxisLabels(n,t,r,a),borderLines:this.getBorders(a),title:this.getTitle(i)}}}});function qV(e){return!/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(e)}function uAe(e){return!/^\d+$/.test(e)}function hAe(e){return!/^\d+px$/.test(e)}var pm,dAe=z(()=>{"use strict";pm=class extends Error{static{o(this,"InvalidStyleError")}constructor(t,r,i){super(`value for ${t} ${r} is invalid, please use a valid ${i}`),this.name="InvalidStyleError"}};o(qV,"validateHexCode");o(uAe,"validateNumber");o(hAe,"validateSizeInPixels")});function wh(e){return fr(e.trim(),L2t)}function M2t(e){wa.setData({quadrant1Text:wh(e.text)})}function N2t(e){wa.setData({quadrant2Text:wh(e.text)})}function I2t(e){wa.setData({quadrant3Text:wh(e.text)})}function O2t(e){wa.setData({quadrant4Text:wh(e.text)})}function P2t(e){wa.setData({xAxisLeftText:wh(e.text)})}function B2t(e){wa.setData({xAxisRightText:wh(e.text)})}function F2t(e){wa.setData({yAxisTopText:wh(e.text)})}function $2t(e){wa.setData({yAxisBottomText:wh(e.text)})}function UV(e){let t={};for(let r of e){let[i,n]=r.trim().split(/\s*:\s*/);if(i==="radius"){if(uAe(n))throw new pm(i,n,"number");t.radius=parseInt(n)}else if(i==="color"){if(qV(n))throw new pm(i,n,"hex code");t.color=n}else if(i==="stroke-color"){if(qV(n))throw new pm(i,n,"hex code");t.strokeColor=n}else if(i==="stroke-width"){if(hAe(n))throw new pm(i,n,"number of pixels (eg. 10px)");t.strokeWidth=n}else throw new Error(`style named ${i} is not supported.`)}return t}function z2t(e,t,r,i,n){let a=UV(n);wa.addPoints([{x:r,y:i,text:wh(e.text),className:t,...a}])}function G2t(e,t){wa.addClass(e,UV(t))}function V2t(e){wa.setConfig({chartWidth:e})}function W2t(e){wa.setConfig({chartHeight:e})}function q2t(){let e=ge(),{themeVariables:t,quadrantChart:r}=e;return r&&wa.setConfig(r),wa.setThemeConfig({quadrant1Fill:t.quadrant1Fill,quadrant2Fill:t.quadrant2Fill,quadrant3Fill:t.quadrant3Fill,quadrant4Fill:t.quadrant4Fill,quadrant1TextFill:t.quadrant1TextFill,quadrant2TextFill:t.quadrant2TextFill,quadrant3TextFill:t.quadrant3TextFill,quadrant4TextFill:t.quadrant4TextFill,quadrantPointFill:t.quadrantPointFill,quadrantPointTextFill:t.quadrantPointTextFill,quadrantXAxisTextFill:t.quadrantXAxisTextFill,quadrantYAxisTextFill:t.quadrantYAxisTextFill,quadrantExternalBorderStrokeFill:t.quadrantExternalBorderStrokeFill,quadrantInternalBorderStrokeFill:t.quadrantInternalBorderStrokeFill,quadrantTitleFill:t.quadrantTitleFill}),wa.setData({titleText:Er()}),wa.build()}var L2t,wa,U2t,fAe,pAe=z(()=>{"use strict";Ut();Ir();Ci();cAe();dAe();L2t=ge();o(wh,"textSanitizer");wa=new M6;o(M2t,"setQuadrant1Text");o(N2t,"setQuadrant2Text");o(I2t,"setQuadrant3Text");o(O2t,"setQuadrant4Text");o(P2t,"setXAxisLeftText");o(B2t,"setXAxisRightText");o(F2t,"setYAxisTopText");o($2t,"setYAxisBottomText");o(UV,"parseStyles");o(z2t,"addPoint");o(G2t,"addClass");o(V2t,"setWidth");o(W2t,"setHeight");o(q2t,"getQuadrantData");U2t=o(function(){wa.clear(),gr()},"clear"),fAe={setWidth:V2t,setHeight:W2t,setQuadrant1Text:M2t,setQuadrant2Text:N2t,setQuadrant3Text:I2t,setQuadrant4Text:O2t,setXAxisLeftText:P2t,setXAxisRightText:B2t,setYAxisTopText:F2t,setYAxisBottomText:$2t,parseStyles:UV,addPoint:z2t,addClass:G2t,getQuadrantData:q2t,clear:U2t,setAccTitle:Cr,getAccTitle:kr,setDiagramTitle:Ar,getDiagramTitle:Er,getAccDescription:Sr,setAccDescription:wr}});var H2t,mAe,gAe=z(()=>{"use strict";Rr();Ut();St();Di();H2t=o((e,t,r,i)=>{function n(A){return A==="top"?"hanging":"middle"}o(n,"getDominantBaseLine");function a(A){return A==="left"?"start":"middle"}o(a,"getTextAnchor");function s(A){return`translate(${A.x}, ${A.y}) rotate(${A.rotation||0})`}o(s,"getTransformation");let l=ge();Z.debug(`Rendering quadrant chart +`+e);let u=l.securityLevel,h;u==="sandbox"&&(h=Je("#i"+t));let f=(u==="sandbox"?Je(h.nodes()[0].contentDocument.body):Je("body")).select(`[id="${t}"]`),p=f.append("g").attr("class","main"),m=l.quadrantChart?.chartWidth??500,g=l.quadrantChart?.chartHeight??500;Br(f,g,m,l.quadrantChart?.useMaxWidth??!0),f.attr("viewBox","0 0 "+m+" "+g),i.db.setHeight(g),i.db.setWidth(m);let y=i.db.getQuadrantData(),v=p.append("g").attr("class","quadrants"),x=p.append("g").attr("class","border"),b=p.append("g").attr("class","data-points"),T=p.append("g").attr("class","labels"),w=p.append("g").attr("class","title");y.title&&w.append("text").attr("x",0).attr("y",0).attr("fill",y.title.fill).attr("font-size",y.title.fontSize).attr("dominant-baseline",n(y.title.horizontalPos)).attr("text-anchor",a(y.title.verticalPos)).attr("transform",s(y.title)).text(y.title.text),y.borderLines&&x.selectAll("line").data(y.borderLines).enter().append("line").attr("x1",A=>A.x1).attr("y1",A=>A.y1).attr("x2",A=>A.x2).attr("y2",A=>A.y2).style("stroke",A=>A.strokeFill).style("stroke-width",A=>A.strokeWidth);let C=v.selectAll("g.quadrant").data(y.quadrants).enter().append("g").attr("class","quadrant");C.append("rect").attr("x",A=>A.x).attr("y",A=>A.y).attr("width",A=>A.width).attr("height",A=>A.height).attr("fill",A=>A.fill),C.append("text").attr("x",0).attr("y",0).attr("fill",A=>A.text.fill).attr("font-size",A=>A.text.fontSize).attr("dominant-baseline",A=>n(A.text.horizontalPos)).attr("text-anchor",A=>a(A.text.verticalPos)).attr("transform",A=>s(A.text)).text(A=>A.text.text),T.selectAll("g.label").data(y.axisLabels).enter().append("g").attr("class","label").append("text").attr("x",0).attr("y",0).text(A=>A.text).attr("fill",A=>A.fill).attr("font-size",A=>A.fontSize).attr("dominant-baseline",A=>n(A.horizontalPos)).attr("text-anchor",A=>a(A.verticalPos)).attr("transform",A=>s(A));let E=b.selectAll("g.data-point").data(y.points).enter().append("g").attr("class","data-point");E.append("circle").attr("cx",A=>A.x).attr("cy",A=>A.y).attr("r",A=>A.radius).attr("fill",A=>A.fill).attr("stroke",A=>A.strokeColor).attr("stroke-width",A=>A.strokeWidth),E.append("text").attr("x",0).attr("y",0).text(A=>A.text.text).attr("fill",A=>A.text.fill).attr("font-size",A=>A.text.fontSize).attr("dominant-baseline",A=>n(A.text.horizontalPos)).attr("text-anchor",A=>a(A.text.verticalPos)).attr("transform",A=>s(A.text))},"draw"),mAe={draw:H2t}});var yAe={};xr(yAe,{diagram:()=>Y2t});var Y2t,vAe=z(()=>{"use strict";lAe();pAe();gAe();Y2t={parser:oAe,db:fAe,renderer:mAe,styles:o(()=>"","styles")}});var HV,TAe,CAe=z(()=>{"use strict";HV=(function(){var e=o(function(M,L,B,O){for(B=B||{},O=M.length;O--;B[M[O]]=L);return B},"o"),t=[1,10,12,14,16,18,19,21,23],r=[2,6],i=[1,3],n=[1,5],a=[1,6],s=[1,7],l=[1,5,10,12,14,16,18,19,21,23,34,35,36],u=[1,25],h=[1,26],d=[1,28],f=[1,29],p=[1,30],m=[1,31],g=[1,32],y=[1,33],v=[1,34],x=[1,35],b=[1,36],T=[1,37],w=[1,43],C=[1,42],k=[1,47],E=[1,50],A=[1,10,12,14,16,18,19,21,23,34,35,36],N=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],P=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],I=[1,64],D={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:o(function(L,B,O,$,G,F,V){var H=F.length-1;switch(G){case 5:$.setOrientation(F[H]);break;case 9:$.setDiagramTitle(F[H].text.trim());break;case 12:$.setLineData({text:"",type:"text"},F[H]);break;case 13:$.setLineData(F[H-1],F[H]);break;case 14:$.setBarData({text:"",type:"text"},F[H]);break;case 15:$.setBarData(F[H-1],F[H]);break;case 16:this.$=F[H].trim(),$.setAccTitle(this.$);break;case 17:case 18:this.$=F[H].trim(),$.setAccDescription(this.$);break;case 19:this.$=F[H-1];break;case 20:this.$=[Number(F[H-2]),...F[H]];break;case 21:this.$=[Number(F[H])];break;case 22:$.setXAxisTitle(F[H]);break;case 23:$.setXAxisTitle(F[H-1]);break;case 24:$.setXAxisTitle({type:"text",text:""});break;case 25:$.setXAxisBand(F[H]);break;case 26:$.setXAxisRangeData(Number(F[H-2]),Number(F[H]));break;case 27:this.$=F[H-1];break;case 28:this.$=[F[H-2],...F[H]];break;case 29:this.$=[F[H]];break;case 30:$.setYAxisTitle(F[H]);break;case 31:$.setYAxisTitle(F[H-1]);break;case 32:$.setYAxisTitle({type:"text",text:""});break;case 33:$.setYAxisRangeData(Number(F[H-2]),Number(F[H]));break;case 37:this.$={text:F[H],type:"text"};break;case 38:this.$={text:F[H],type:"text"};break;case 39:this.$={text:F[H],type:"markdown"};break;case 40:this.$=F[H];break;case 41:this.$=F[H-1]+""+F[H];break}},"anonymous"),table:[e(t,r,{3:1,4:2,7:4,5:i,34:n,35:a,36:s}),{1:[3]},e(t,r,{4:2,7:4,3:8,5:i,34:n,35:a,36:s}),e(t,r,{4:2,7:4,6:9,3:10,5:i,8:[1,11],34:n,35:a,36:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(l,[2,34]),e(l,[2,35]),e(l,[2,36]),{1:[2,1]},e(t,r,{4:2,7:4,3:21,5:i,34:n,35:a,36:s}),{1:[2,3]},e(l,[2,5]),e(t,[2,7],{4:22,34:n,35:a,36:s}),{11:23,37:24,38:u,39:h,40:27,41:d,42:f,43:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T},{11:39,13:38,24:w,27:C,29:40,30:41,37:24,38:u,39:h,40:27,41:d,42:f,43:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T},{11:45,15:44,27:k,33:46,37:24,38:u,39:h,40:27,41:d,42:f,43:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T},{11:49,17:48,24:E,37:24,38:u,39:h,40:27,41:d,42:f,43:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T},{11:52,17:51,24:E,37:24,38:u,39:h,40:27,41:d,42:f,43:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T},{20:[1,53]},{22:[1,54]},e(A,[2,18]),{1:[2,2]},e(A,[2,8]),e(A,[2,9]),e(N,[2,37],{40:55,41:d,42:f,43:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T}),e(N,[2,38]),e(N,[2,39]),e(P,[2,40]),e(P,[2,42]),e(P,[2,43]),e(P,[2,44]),e(P,[2,45]),e(P,[2,46]),e(P,[2,47]),e(P,[2,48]),e(P,[2,49]),e(P,[2,50]),e(P,[2,51]),e(A,[2,10]),e(A,[2,22],{30:41,29:56,24:w,27:C}),e(A,[2,24]),e(A,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:u,39:h,40:27,41:d,42:f,43:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T},e(A,[2,11]),e(A,[2,30],{33:60,27:k}),e(A,[2,32]),{31:[1,61]},e(A,[2,12]),{17:62,24:E},{25:63,27:I},e(A,[2,14]),{17:65,24:E},e(A,[2,16]),e(A,[2,17]),e(P,[2,41]),e(A,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(A,[2,31]),{27:[1,69]},e(A,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(A,[2,15]),e(A,[2,26]),e(A,[2,27]),{11:59,32:72,37:24,38:u,39:h,40:27,41:d,42:f,43:p,44:m,45:g,46:y,47:v,48:x,49:b,50:T},e(A,[2,33]),e(A,[2,19]),{25:73,27:I},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:o(function(L,B){if(B.recoverable)this.trace(L);else{var O=new Error(L);throw O.hash=B,O}},"parseError"),parse:o(function(L){var B=this,O=[0],$=[],G=[null],F=[],V=this.table,H="",j=0,U=0,Q=0,Y=2,ae=1,J=F.slice.call(arguments,1),te=Object.create(this.lexer),re={yy:{}};for(var ee in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ee)&&(re.yy[ee]=this.yy[ee]);te.setInput(L,re.yy),re.yy.lexer=te,re.yy.parser=this,typeof te.yylloc>"u"&&(te.yylloc={});var Te=te.yylloc;F.push(Te);var ue=te.options&&te.options.ranges;typeof re.yy.parseError=="function"?this.parseError=re.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function De(ye){O.length=O.length-2*ye,G.length=G.length-ye,F.length=F.length-ye}o(De,"popStack");function Ie(){var ye;return ye=$.pop()||te.lex()||ae,typeof ye!="number"&&(ye instanceof Array&&($=ye,ye=$.pop()),ye=B.symbols_[ye]||ye),ye}o(Ie,"lex");for(var Ee,we,Me,$e,de,rt,ke={},Fe,He,at,qe;;){if(Me=O[O.length-1],this.defaultActions[Me]?$e=this.defaultActions[Me]:((Ee===null||typeof Ee>"u")&&(Ee=Ie()),$e=V[Me]&&V[Me][Ee]),typeof $e>"u"||!$e.length||!$e[0]){var Ue="";qe=[];for(Fe in V[Me])this.terminals_[Fe]&&Fe>Y&&qe.push("'"+this.terminals_[Fe]+"'");te.showPosition?Ue="Parse error on line "+(j+1)+`: +`+te.showPosition()+` +Expecting `+qe.join(", ")+", got '"+(this.terminals_[Ee]||Ee)+"'":Ue="Parse error on line "+(j+1)+": Unexpected "+(Ee==ae?"end of input":"'"+(this.terminals_[Ee]||Ee)+"'"),this.parseError(Ue,{text:te.match,token:this.terminals_[Ee]||Ee,line:te.yylineno,loc:Te,expected:qe})}if($e[0]instanceof Array&&$e.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Me+", token: "+Ee);switch($e[0]){case 1:O.push(Ee),G.push(te.yytext),F.push(te.yylloc),O.push($e[1]),Ee=null,we?(Ee=we,we=null):(U=te.yyleng,H=te.yytext,j=te.yylineno,Te=te.yylloc,Q>0&&Q--);break;case 2:if(He=this.productions_[$e[1]][1],ke.$=G[G.length-He],ke._$={first_line:F[F.length-(He||1)].first_line,last_line:F[F.length-1].last_line,first_column:F[F.length-(He||1)].first_column,last_column:F[F.length-1].last_column},ue&&(ke._$.range=[F[F.length-(He||1)].range[0],F[F.length-1].range[1]]),rt=this.performAction.apply(ke,[H,U,j,re.yy,$e[1],G,F].concat(J)),typeof rt<"u")return rt;He&&(O=O.slice(0,-1*He*2),G=G.slice(0,-1*He),F=F.slice(0,-1*He)),O.push(this.productions_[$e[1]][0]),G.push(ke.$),F.push(ke._$),at=V[O[O.length-2]][O[O.length-1]],O.push(at);break;case 3:return!0}}return!0},"parse")},_=(function(){var M={EOF:1,parseError:o(function(B,O){if(this.yy.parser)this.yy.parser.parseError(B,O);else throw new Error(B)},"parseError"),setInput:o(function(L,B){return this.yy=B||this.yy||{},this._input=L,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var L=this._input[0];this.yytext+=L,this.yyleng++,this.offset++,this.match+=L,this.matched+=L;var B=L.match(/(?:\r\n?|\n).*/g);return B?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),L},"input"),unput:o(function(L){var B=L.length,O=L.split(/(?:\r\n?|\n)/g);this._input=L+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-B),this.offset-=B;var $=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),O.length-1&&(this.yylineno-=O.length-1);var G=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:O?(O.length===$.length?this.yylloc.first_column:0)+$[$.length-O.length].length-O[0].length:this.yylloc.first_column-B},this.options.ranges&&(this.yylloc.range=[G[0],G[0]+this.yyleng-B]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(L){this.unput(this.match.slice(L))},"less"),pastInput:o(function(){var L=this.matched.substr(0,this.matched.length-this.match.length);return(L.length>20?"...":"")+L.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var L=this.match;return L.length<20&&(L+=this._input.substr(0,20-L.length)),(L.substr(0,20)+(L.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var L=this.pastInput(),B=new Array(L.length+1).join("-");return L+this.upcomingInput()+` +`+B+"^"},"showPosition"),test_match:o(function(L,B){var O,$,G;if(this.options.backtrack_lexer&&(G={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(G.yylloc.range=this.yylloc.range.slice(0))),$=L[0].match(/(?:\r\n?|\n).*/g),$&&(this.yylineno+=$.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:$?$[$.length-1].length-$[$.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+L[0].length},this.yytext+=L[0],this.match+=L[0],this.matches=L,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(L[0].length),this.matched+=L[0],O=this.performAction.call(this,this.yy,this,B,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),O)return O;if(this._backtrack){for(var F in G)this[F]=G[F];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var L,B,O,$;this._more||(this.yytext="",this.match="");for(var G=this._currentRules(),F=0;FB[0].length)){if(B=O,$=F,this.options.backtrack_lexer){if(L=this.test_match(O,G[F]),L!==!1)return L;if(this._backtrack){B=!1;continue}else return!1}else if(!this.options.flex)break}return B?(L=this.test_match(B,G[$]),L!==!1?L:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var B=this.next();return B||this.lex()},"lex"),begin:o(function(B){this.conditionStack.push(B)},"begin"),popState:o(function(){var B=this.conditionStack.length-1;return B>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(B){return B=this.conditionStack.length-1-Math.abs(B||0),B>=0?this.conditionStack[B]:"INITIAL"},"topState"),pushState:o(function(B){this.begin(B)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(B,O,$,G){var F=G;switch($){case 0:break;case 1:break;case 2:return this.popState(),34;break;case 3:return this.popState(),34;break;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 31;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 27;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 43;case 33:return"COLON";case 34:return 44;case 35:return 28;case 36:return 45;case 37:return 46;case 38:return 48;case 39:return 50;case 40:return 47;case 41:return 41;case 42:return 49;case 43:return 42;case 44:break;case 45:return 35;case 46:return 36}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return M})();D.lexer=_;function R(){this.yy={}}return o(R,"Parser"),R.prototype=D,D.Parser=R,new R})();HV.parser=HV;TAe=HV});function YV(e){return e.type==="bar"}function N6(e){return e.type==="band"}function vy(e){return e.type==="linear"}var I6=z(()=>{"use strict";o(YV,"isBarPlot");o(N6,"isBandAxisData");o(vy,"isLinearAxisData")});var xy,jV=z(()=>{"use strict";_s();xy=class{constructor(t){this.parentGroup=t}static{o(this,"TextDimensionCalculatorWithFont")}getMaxDimension(t,r){if(!this.parentGroup)return{width:t.reduce((a,s)=>Math.max(s.length,a),0)*r,height:r};let i={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",r);for(let a of t){let s=Are(n,1,a),l=s?s.width:a.length*r,u=s?s.height:r;i.width=Math.max(i.width,l),i.height=Math.max(i.height,u)}return n.remove(),i}}});var by,XV=z(()=>{"use strict";by=class{constructor(t,r,i,n){this.axisConfig=t;this.title=r;this.textDimensionCalculator=i;this.axisThemeConfig=n;this.boundingRect={x:0,y:0,width:0,height:0};this.axisPosition="left";this.showTitle=!1;this.showLabel=!1;this.showTick=!1;this.showAxisLine=!1;this.outerPadding=0;this.titleTextHeight=0;this.labelTextHeight=0;this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}static{o(this,"BaseAxis")}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){let t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){.7*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let r=t.height;if(this.axisConfig.showAxisLine&&r>this.axisConfig.axisLineWidth&&(r-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let i=this.getLabelDimension(),n=.2*t.width;this.outerPadding=Math.min(i.width/2,n);let a=i.height+this.axisConfig.labelPadding*2;this.labelTextHeight=i.height,a<=r&&(r-=a,this.showLabel=!0)}if(this.axisConfig.showTick&&r>=this.axisConfig.tickLength&&(this.showTick=!0,r-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let i=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=i.height+this.axisConfig.titlePadding*2;this.titleTextHeight=i.height,n<=r&&(r-=n,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-r}calculateSpaceIfDrawnVertical(t){let r=t.width;if(this.axisConfig.showAxisLine&&r>this.axisConfig.axisLineWidth&&(r-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let i=this.getLabelDimension(),n=.2*t.height;this.outerPadding=Math.min(i.height/2,n);let a=i.width+this.axisConfig.labelPadding*2;a<=r&&(r-=a,this.showLabel=!0)}if(this.axisConfig.showTick&&r>=this.axisConfig.tickLength&&(this.showTick=!0,r-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let i=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=i.height+this.axisConfig.titlePadding*2;this.titleTextHeight=i.height,n<=r&&(r-=n,this.showTitle=!0)}this.boundingRect.width=t.width-r,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){let t=[];if(this.showAxisLine){let r=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${r},${this.boundingRect.y} L ${r},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(r=>({text:r.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(r),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){let r=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(i=>({path:`M ${r},${this.getScaleValue(i)} L ${r-this.axisConfig.tickLength},${this.getScaleValue(i)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){let t=[];if(this.showAxisLine){let r=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${r} L ${this.boundingRect.x+this.boundingRect.width},${r}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(r=>({text:r.toString(),x:this.getScaleValue(r),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let r=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(i=>({path:`M ${this.getScaleValue(i)},${r} L ${this.getScaleValue(i)},${r+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){let t=[];if(this.showAxisLine){let r=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${r} L ${this.boundingRect.x+this.boundingRect.width},${r}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(r=>({text:r.toString(),x:this.getScaleValue(r),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let r=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(i=>({path:`M ${this.getScaleValue(i)},${r+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(i)},${r+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}}});var O6,kAe=z(()=>{"use strict";Rr();St();XV();O6=class extends by{static{o(this,"BandAxis")}constructor(t,r,i,n,a){super(t,n,a,r),this.categories=i,this.scale=ig().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=ig().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),Z.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}}});var P6,wAe=z(()=>{"use strict";Rr();XV();P6=class extends by{static{o(this,"LinearAxis")}constructor(t,r,i,n,a){super(t,n,a,r),this.domain=i,this.scale=kl().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=kl().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}}});function KV(e,t,r,i){let n=new xy(i);return N6(e)?new O6(t,r,e.categories,e.title,n):new P6(t,r,[e.min,e.max],e.title,n)}var SAe=z(()=>{"use strict";I6();jV();kAe();wAe();o(KV,"getAxis")});function EAe(e,t,r,i){let n=new xy(i);return new ZV(n,e,t,r)}var ZV,AAe=z(()=>{"use strict";jV();ZV=class{constructor(t,r,i,n){this.textDimensionCalculator=t;this.chartConfig=r;this.chartData=i;this.chartThemeConfig=n;this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{o(this,"ChartTitle")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){let r=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),i=Math.max(r.width,t.width),n=r.height+2*this.chartConfig.titlePadding;return r.width<=i&&r.height<=n&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=i,this.boundingRect.height=n,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}};o(EAe,"getChartTitleComponent")});var B6,_Ae=z(()=>{"use strict";Rr();B6=class{constructor(t,r,i,n,a){this.plotData=t;this.xAxis=r;this.yAxis=i;this.orientation=n;this.plotIndex=a}static{o(this,"LinePlot")}getDrawableElement(){let t=this.plotData.data.map(i=>[this.xAxis.getScaleValue(i[0]),this.yAxis.getScaleValue(i[1])]),r;return this.orientation==="horizontal"?r=_l().y(i=>i[0]).x(i=>i[1])(t):r=_l().x(i=>i[0]).y(i=>i[1])(t),r?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:r,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}}});var F6,DAe=z(()=>{"use strict";F6=class{constructor(t,r,i,n,a,s){this.barData=t;this.boundingRect=r;this.xAxis=i;this.yAxis=n;this.orientation=a;this.plotIndex=s}static{o(this,"BarPlot")}getDrawableElement(){let t=this.barData.data.map(a=>[this.xAxis.getScaleValue(a[0]),this.yAxis.getScaleValue(a[1])]),i=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),n=i/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(a=>({x:this.boundingRect.x,y:a[0]-n,height:i,width:a[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(a=>({x:a[0]-n,y:a[1],width:i,height:this.boundingRect.y+this.boundingRect.height-a[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}}});function RAe(e,t,r){return new QV(e,t,r)}var QV,LAe=z(()=>{"use strict";_Ae();DAe();QV=class{constructor(t,r,i){this.chartConfig=t;this.chartData=r;this.chartThemeConfig=i;this.boundingRect={x:0,y:0,width:0,height:0}}static{o(this,"BasePlot")}setAxes(t,r){this.xAxis=t,this.yAxis=r}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let t=[];for(let[r,i]of this.chartData.plots.entries())switch(i.type){case"line":{let n=new B6(i,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,r);t.push(...n.getDrawableElement())}break;case"bar":{let n=new F6(i,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,r);t.push(...n.getDrawableElement())}break}return t}};o(RAe,"getPlotComponent")});var $6,MAe=z(()=>{"use strict";SAe();AAe();LAe();I6();$6=class{constructor(t,r,i,n){this.chartConfig=t;this.chartData=r;this.componentStore={title:EAe(t,r,i,n),plot:RAe(t,r,i),xAxis:KV(r.xAxis,t.xAxis,{titleColor:i.xAxisTitleColor,labelColor:i.xAxisLabelColor,tickColor:i.xAxisTickColor,axisLineColor:i.xAxisLineColor},n),yAxis:KV(r.yAxis,t.yAxis,{titleColor:i.yAxisTitleColor,labelColor:i.yAxisLabelColor,tickColor:i.yAxisTickColor,axisLineColor:i.yAxisLineColor},n)}}static{o(this,"Orchestrator")}calculateVerticalSpace(){let t=this.chartConfig.width,r=this.chartConfig.height,i=0,n=0,a=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),s=Math.floor(r*this.chartConfig.plotReservedSpacePercent/100),l=this.componentStore.plot.calculateSpace({width:a,height:s});t-=l.width,r-=l.height,l=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:r}),n=l.height,r-=l.height,this.componentStore.xAxis.setAxisPosition("bottom"),l=this.componentStore.xAxis.calculateSpace({width:t,height:r}),r-=l.height,this.componentStore.yAxis.setAxisPosition("left"),l=this.componentStore.yAxis.calculateSpace({width:t,height:r}),i=l.width,t-=l.width,t>0&&(a+=t,t=0),r>0&&(s+=r,r=0),this.componentStore.plot.calculateSpace({width:a,height:s}),this.componentStore.plot.setBoundingBoxXY({x:i,y:n}),this.componentStore.xAxis.setRange([i,i+a]),this.componentStore.xAxis.setBoundingBoxXY({x:i,y:n+s}),this.componentStore.yAxis.setRange([n,n+s]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(u=>YV(u))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,r=this.chartConfig.height,i=0,n=0,a=0,s=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),l=Math.floor(r*this.chartConfig.plotReservedSpacePercent/100),u=this.componentStore.plot.calculateSpace({width:s,height:l});t-=u.width,r-=u.height,u=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:r}),i=u.height,r-=u.height,this.componentStore.xAxis.setAxisPosition("left"),u=this.componentStore.xAxis.calculateSpace({width:t,height:r}),t-=u.width,n=u.width,this.componentStore.yAxis.setAxisPosition("top"),u=this.componentStore.yAxis.calculateSpace({width:t,height:r}),r-=u.height,a=i+u.height,t>0&&(s+=t,t=0),r>0&&(l+=r,r=0),this.componentStore.plot.calculateSpace({width:s,height:l}),this.componentStore.plot.setBoundingBoxXY({x:n,y:a}),this.componentStore.yAxis.setRange([n,n+s]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:i}),this.componentStore.xAxis.setRange([a,a+l]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some(h=>YV(h))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let r of Object.values(this.componentStore))t.push(...r.getDrawableElements());return t}}});var z6,NAe=z(()=>{"use strict";MAe();z6=class{static{o(this,"XYChartBuilder")}static build(t,r,i,n){return new $6(t,r,i,n).getDrawableElement()}}});function OAe(){let e=Ao(),t=Nt();return Gr(e.xyChart,t.themeVariables.xyChart)}function PAe(){let e=Nt();return Gr(or.xyChart,e.xyChart)}function BAe(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function tW(e){let t=Nt();return fr(e.trim(),t)}function Z2t(e){IAe=e}function Q2t(e){e==="horizontal"?HT.chartOrientation="horizontal":HT.chartOrientation="vertical"}function J2t(e){fi.xAxis.title=tW(e.text)}function FAe(e,t){fi.xAxis={type:"linear",title:fi.xAxis.title,min:e,max:t},G6=!0}function eTt(e){fi.xAxis={type:"band",title:fi.xAxis.title,categories:e.map(t=>tW(t.text))},G6=!0}function tTt(e){fi.yAxis.title=tW(e.text)}function rTt(e,t){fi.yAxis={type:"linear",title:fi.yAxis.title,min:e,max:t},eW=!0}function iTt(e){let t=Math.min(...e),r=Math.max(...e),i=vy(fi.yAxis)?fi.yAxis.min:1/0,n=vy(fi.yAxis)?fi.yAxis.max:-1/0;fi.yAxis={type:"linear",title:fi.yAxis.title,min:Math.min(i,t),max:Math.max(n,r)}}function $Ae(e){let t=[];if(e.length===0)return t;if(!G6){let r=vy(fi.xAxis)?fi.xAxis.min:1/0,i=vy(fi.xAxis)?fi.xAxis.max:-1/0;FAe(Math.min(r,1),Math.max(i,e.length))}if(eW||iTt(e),N6(fi.xAxis)&&(t=fi.xAxis.categories.map((r,i)=>[r,e[i]])),vy(fi.xAxis)){let r=fi.xAxis.min,i=fi.xAxis.max,n=(i-r)/(e.length-1),a=[];for(let s=r;s<=i;s+=n)a.push(`${s}`);t=a.map((s,l)=>[s,e[l]])}return t}function zAe(e){return JV[e===0?0:e%JV.length]}function nTt(e,t){let r=$Ae(t);fi.plots.push({type:"line",strokeFill:zAe(UT),strokeWidth:2,data:r}),UT++}function aTt(e,t){let r=$Ae(t);fi.plots.push({type:"bar",fill:zAe(UT),data:r}),UT++}function sTt(){if(fi.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return fi.title=Er(),z6.build(HT,fi,YT,IAe)}function oTt(){return YT}function lTt(){return HT}function cTt(){return fi}var UT,IAe,HT,YT,fi,JV,G6,eW,uTt,GAe,VAe=z(()=>{"use strict";br();Bn();$f();Xt();Ir();Ci();NAe();I6();UT=0,HT=PAe(),YT=OAe(),fi=BAe(),JV=YT.plotColorPalette.split(",").map(e=>e.trim()),G6=!1,eW=!1;o(OAe,"getChartDefaultThemeConfig");o(PAe,"getChartDefaultConfig");o(BAe,"getChartDefaultData");o(tW,"textSanitizer");o(Z2t,"setTmpSVGG");o(Q2t,"setOrientation");o(J2t,"setXAxisTitle");o(FAe,"setXAxisRangeData");o(eTt,"setXAxisBand");o(tTt,"setYAxisTitle");o(rTt,"setYAxisRangeData");o(iTt,"setYAxisRangeFromPlotData");o($Ae,"transformDataWithoutCategory");o(zAe,"getPlotColorFromPalette");o(nTt,"setLineData");o(aTt,"setBarData");o(sTt,"getDrawableElem");o(oTt,"getChartThemeConfig");o(lTt,"getChartConfig");o(cTt,"getXYChartData");uTt=o(function(){gr(),UT=0,HT=PAe(),fi=BAe(),YT=OAe(),JV=YT.plotColorPalette.split(",").map(e=>e.trim()),G6=!1,eW=!1},"clear"),GAe={getDrawableElem:sTt,clear:uTt,setAccTitle:Cr,getAccTitle:kr,setDiagramTitle:Ar,getDiagramTitle:Er,getAccDescription:Sr,setAccDescription:wr,setOrientation:Q2t,setXAxisTitle:J2t,setXAxisRangeData:FAe,setXAxisBand:eTt,setYAxisTitle:tTt,setYAxisRangeData:rTt,setLineData:nTt,setBarData:aTt,setTmpSVGG:Z2t,getChartThemeConfig:oTt,getChartConfig:lTt,getXYChartData:cTt}});var hTt,WAe,qAe=z(()=>{"use strict";St();ps();Di();hTt=o((e,t,r,i)=>{let n=i.db,a=n.getChartThemeConfig(),s=n.getChartConfig(),l=n.getXYChartData().plots[0].data.map(T=>T[1]);function u(T){return T==="top"?"text-before-edge":"middle"}o(u,"getDominantBaseLine");function h(T){return T==="left"?"start":T==="right"?"end":"middle"}o(h,"getTextAnchor");function d(T){return`translate(${T.x}, ${T.y}) rotate(${T.rotation||0})`}o(d,"getTextTransformation"),Z.debug(`Rendering xychart chart +`+e);let f=bi(t),p=f.append("g").attr("class","main"),m=p.append("rect").attr("width",s.width).attr("height",s.height).attr("class","background");Br(f,s.height,s.width,!0),f.attr("viewBox",`0 0 ${s.width} ${s.height}`),m.attr("fill",a.backgroundColor),n.setTmpSVGG(f.append("g").attr("class","mermaid-tmp-group"));let g=n.getDrawableElem(),y={};function v(T){let w=p,C="";for(let[k]of T.entries()){let E=p;k>0&&y[C]&&(E=y[C]),C+=T[k],w=y[C],w||(w=y[C]=E.append("g").attr("class",T[k]))}return w}o(v,"getGroup");for(let T of g){if(T.data.length===0)continue;let w=v(T.groupTexts);switch(T.type){case"rect":if(w.selectAll("rect").data(T.data).enter().append("rect").attr("x",C=>C.x).attr("y",C=>C.y).attr("width",C=>C.width).attr("height",C=>C.height).attr("fill",C=>C.fill).attr("stroke",C=>C.strokeFill).attr("stroke-width",C=>C.strokeWidth),s.showDataLabel){let C=s.showDataLabelOutsideBar;if(s.chartOrientation==="horizontal"){let N=function(_,R){let{data:M,label:L}=_;return R*L.length*.7<=M.width-10};var x=N;o(N,"fitsHorizontally");let k=.7,E=10,A=T.data.map((_,R)=>({data:_,label:l[R].toString()})).filter(_=>_.data.width>0&&_.data.height>0),P=A.map(_=>{let{data:R}=_,M=R.height*.7;for(;!N(_,M)&&M>0;)M-=1;return M}),I=Math.floor(Math.min(...P)),D=o(_=>C?_.data.x+_.data.width+10:_.data.x+_.data.width-10,"determineLabelXPosition");w.selectAll("text").data(A).enter().append("text").attr("x",D).attr("y",_=>_.data.y+_.data.height/2).attr("text-anchor",C?"start":"end").attr("dominant-baseline","middle").attr("fill",a.dataLabelColor).attr("font-size",`${I}px`).text(_=>_.label)}else{let A=function(D,_,R){let{data:M,label:L}=D,O=_*L.length*.7,$=M.x+M.width/2,G=$-O/2,F=$+O/2,V=G>=M.x&&F<=M.x+M.width,H=M.y+R+_<=M.y+M.height;return V&&H};var b=A;o(A,"fitsInBar");let k=10,E=T.data.map((D,_)=>({data:D,label:l[_].toString()})).filter(D=>D.data.width>0&&D.data.height>0),N=E.map(D=>{let{data:_,label:R}=D,M=_.width/(R.length*.7);for(;!A(D,M,10)&&M>0;)M-=1;return M}),P=Math.floor(Math.min(...N)),I=o(D=>C?D.data.y-10:D.data.y+10,"determineLabelYPosition");w.selectAll("text").data(E).enter().append("text").attr("x",D=>D.data.x+D.data.width/2).attr("y",I).attr("text-anchor","middle").attr("dominant-baseline",C?"auto":"hanging").attr("fill",a.dataLabelColor).attr("font-size",`${P}px`).text(D=>D.label)}}break;case"text":w.selectAll("text").data(T.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",C=>C.fill).attr("font-size",C=>C.fontSize).attr("dominant-baseline",C=>u(C.verticalPos)).attr("text-anchor",C=>h(C.horizontalPos)).attr("transform",C=>d(C)).text(C=>C.text);break;case"path":w.selectAll("path").data(T.data).enter().append("path").attr("d",C=>C.path).attr("fill",C=>C.fill?C.fill:"none").attr("stroke",C=>C.strokeFill).attr("stroke-width",C=>C.strokeWidth);break}}},"draw"),WAe={draw:hTt}});var UAe={};xr(UAe,{diagram:()=>dTt});var dTt,HAe=z(()=>{"use strict";CAe();VAe();qAe();dTt={parser:TAe,db:GAe,renderer:WAe}});var rW,XAe,KAe=z(()=>{"use strict";rW=(function(){var e=o(function(ye,ve,ie,fe){for(ie=ie||{},fe=ye.length;fe--;ie[ye[fe]]=ve);return ie},"o"),t=[1,3],r=[1,4],i=[1,5],n=[1,6],a=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],s=[1,22],l=[2,7],u=[1,26],h=[1,27],d=[1,28],f=[1,29],p=[1,33],m=[1,34],g=[1,35],y=[1,36],v=[1,37],x=[1,38],b=[1,24],T=[1,31],w=[1,32],C=[1,30],k=[1,39],E=[1,40],A=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],N=[1,61],P=[89,90],I=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],D=[27,29],_=[1,70],R=[1,71],M=[1,72],L=[1,73],B=[1,74],O=[1,75],$=[1,76],G=[1,83],F=[1,80],V=[1,84],H=[1,85],j=[1,86],U=[1,87],Q=[1,88],Y=[1,89],ae=[1,90],J=[1,91],te=[1,92],re=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],ee=[63,64],Te=[1,101],ue=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],De=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Ie=[1,110],Ee=[1,106],we=[1,107],Me=[1,108],$e=[1,109],de=[1,111],rt=[1,116],ke=[1,117],Fe=[1,114],He=[1,115],at={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:o(function(ve,ie,fe,W,ce,K,Re){var xe=K.length-1;switch(ce){case 4:this.$=K[xe].trim(),W.setAccTitle(this.$);break;case 5:case 6:this.$=K[xe].trim(),W.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:W.setDirection("TB");break;case 18:W.setDirection("BT");break;case 19:W.setDirection("RL");break;case 20:W.setDirection("LR");break;case 21:W.addRequirement(K[xe-3],K[xe-4]);break;case 22:W.addRequirement(K[xe-5],K[xe-6]),W.setClass([K[xe-5]],K[xe-3]);break;case 23:W.setNewReqId(K[xe-2]);break;case 24:W.setNewReqText(K[xe-2]);break;case 25:W.setNewReqRisk(K[xe-2]);break;case 26:W.setNewReqVerifyMethod(K[xe-2]);break;case 29:this.$=W.RequirementType.REQUIREMENT;break;case 30:this.$=W.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=W.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=W.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=W.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=W.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=W.RiskLevel.LOW_RISK;break;case 36:this.$=W.RiskLevel.MED_RISK;break;case 37:this.$=W.RiskLevel.HIGH_RISK;break;case 38:this.$=W.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=W.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=W.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=W.VerifyType.VERIFY_TEST;break;case 42:W.addElement(K[xe-3]);break;case 43:W.addElement(K[xe-5]),W.setClass([K[xe-5]],K[xe-3]);break;case 44:W.setNewElementType(K[xe-2]);break;case 45:W.setNewElementDocRef(K[xe-2]);break;case 48:W.addRelationship(K[xe-2],K[xe],K[xe-4]);break;case 49:W.addRelationship(K[xe-2],K[xe-4],K[xe]);break;case 50:this.$=W.Relationships.CONTAINS;break;case 51:this.$=W.Relationships.COPIES;break;case 52:this.$=W.Relationships.DERIVES;break;case 53:this.$=W.Relationships.SATISFIES;break;case 54:this.$=W.Relationships.VERIFIES;break;case 55:this.$=W.Relationships.REFINES;break;case 56:this.$=W.Relationships.TRACES;break;case 57:this.$=K[xe-2],W.defineClass(K[xe-1],K[xe]);break;case 58:W.setClass(K[xe-1],K[xe]);break;case 59:W.setClass([K[xe-2]],K[xe]);break;case 60:case 62:this.$=[K[xe]];break;case 61:case 63:this.$=K[xe-2].concat([K[xe]]);break;case 64:this.$=K[xe-2],W.setCssStyle(K[xe-1],K[xe]);break;case 65:this.$=[K[xe]];break;case 66:K[xe-2].push(K[xe]),this.$=K[xe-2];break;case 68:this.$=K[xe-1]+K[xe];break}},"anonymous"),table:[{3:1,4:2,6:t,9:r,11:i,13:n},{1:[3]},{3:8,4:2,5:[1,7],6:t,9:r,11:i,13:n},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(a,[2,6]),{3:12,4:2,6:t,9:r,11:i,13:n},{1:[2,2]},{4:17,5:s,7:13,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},e(a,[2,4]),e(a,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:s,7:42,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},{4:17,5:s,7:43,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},{4:17,5:s,7:44,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},{4:17,5:s,7:45,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},{4:17,5:s,7:46,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},{4:17,5:s,7:47,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},{4:17,5:s,7:48,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},{4:17,5:s,7:49,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},{4:17,5:s,7:50,8:l,9:r,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:u,22:h,23:d,24:f,25:23,33:25,41:p,42:m,43:g,44:y,45:v,46:x,54:b,72:T,74:w,77:C,89:k,90:E},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(A,[2,17]),e(A,[2,18]),e(A,[2,19]),e(A,[2,20]),{30:60,33:62,75:N,89:k,90:E},{30:63,33:62,75:N,89:k,90:E},{30:64,33:62,75:N,89:k,90:E},e(P,[2,29]),e(P,[2,30]),e(P,[2,31]),e(P,[2,32]),e(P,[2,33]),e(P,[2,34]),e(I,[2,81]),e(I,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(D,[2,79]),e(D,[2,80]),{27:[1,67],29:[1,68]},e(D,[2,85]),e(D,[2,86]),{62:69,65:_,66:R,67:M,68:L,69:B,70:O,71:$},{62:77,65:_,66:R,67:M,68:L,69:B,70:O,71:$},{30:78,33:62,75:N,89:k,90:E},{73:79,75:G,76:F,78:81,79:82,80:V,81:H,82:j,83:U,84:Q,85:Y,86:ae,87:J,88:te},e(re,[2,60]),e(re,[2,62]),{73:93,75:G,76:F,78:81,79:82,80:V,81:H,82:j,83:U,84:Q,85:Y,86:ae,87:J,88:te},{30:94,33:62,75:N,76:F,89:k,90:E},{5:[1,95]},{30:96,33:62,75:N,89:k,90:E},{5:[1,97]},{30:98,33:62,75:N,89:k,90:E},{63:[1,99]},e(ee,[2,50]),e(ee,[2,51]),e(ee,[2,52]),e(ee,[2,53]),e(ee,[2,54]),e(ee,[2,55]),e(ee,[2,56]),{64:[1,100]},e(A,[2,59],{76:F}),e(A,[2,64],{76:Te}),{33:103,75:[1,102],89:k,90:E},e(ue,[2,65],{79:104,75:G,80:V,81:H,82:j,83:U,84:Q,85:Y,86:ae,87:J,88:te}),e(De,[2,67]),e(De,[2,69]),e(De,[2,70]),e(De,[2,71]),e(De,[2,72]),e(De,[2,73]),e(De,[2,74]),e(De,[2,75]),e(De,[2,76]),e(De,[2,77]),e(De,[2,78]),e(A,[2,57],{76:Te}),e(A,[2,58],{76:F}),{5:Ie,28:105,31:Ee,34:we,36:Me,38:$e,40:de},{27:[1,112],76:F},{5:rt,40:ke,56:113,57:Fe,59:He},{27:[1,118],76:F},{33:119,89:k,90:E},{33:120,89:k,90:E},{75:G,78:121,79:82,80:V,81:H,82:j,83:U,84:Q,85:Y,86:ae,87:J,88:te},e(re,[2,61]),e(re,[2,63]),e(De,[2,68]),e(A,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:Ie,28:126,31:Ee,34:we,36:Me,38:$e,40:de},e(A,[2,28]),{5:[1,127]},e(A,[2,42]),{32:[1,128]},{32:[1,129]},{5:rt,40:ke,56:130,57:Fe,59:He},e(A,[2,47]),{5:[1,131]},e(A,[2,48]),e(A,[2,49]),e(ue,[2,66],{79:104,75:G,80:V,81:H,82:j,83:U,84:Q,85:Y,86:ae,87:J,88:te}),{33:132,89:k,90:E},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(A,[2,27]),{5:Ie,28:145,31:Ee,34:we,36:Me,38:$e,40:de},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(A,[2,46]),{5:rt,40:ke,56:152,57:Fe,59:He},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(A,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(A,[2,43]),{5:Ie,28:159,31:Ee,34:we,36:Me,38:$e,40:de},{5:Ie,28:160,31:Ee,34:we,36:Me,38:$e,40:de},{5:Ie,28:161,31:Ee,34:we,36:Me,38:$e,40:de},{5:Ie,28:162,31:Ee,34:we,36:Me,38:$e,40:de},{5:rt,40:ke,56:163,57:Fe,59:He},{5:rt,40:ke,56:164,57:Fe,59:He},e(A,[2,23]),e(A,[2,24]),e(A,[2,25]),e(A,[2,26]),e(A,[2,44]),e(A,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:o(function(ve,ie){if(ie.recoverable)this.trace(ve);else{var fe=new Error(ve);throw fe.hash=ie,fe}},"parseError"),parse:o(function(ve){var ie=this,fe=[0],W=[],ce=[null],K=[],Re=this.table,xe="",Oe=0,be=0,Be=0,Ae=2,Ve=1,Pe=K.slice.call(arguments,1),Ye=Object.create(this.lexer),le={yy:{}};for(var st in this.yy)Object.prototype.hasOwnProperty.call(this.yy,st)&&(le.yy[st]=this.yy[st]);Ye.setInput(ve,le.yy),le.yy.lexer=Ye,le.yy.parser=this,typeof Ye.yylloc>"u"&&(Ye.yylloc={});var me=Ye.yylloc;K.push(me);var ot=Ye.options&&Ye.options.ranges;typeof le.yy.parseError=="function"?this.parseError=le.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function kt(Rt){fe.length=fe.length-2*Rt,ce.length=ce.length-Rt,K.length=K.length-Rt}o(kt,"popStack");function Gt(){var Rt;return Rt=W.pop()||Ye.lex()||Ve,typeof Rt!="number"&&(Rt instanceof Array&&(W=Rt,Rt=W.pop()),Rt=ie.symbols_[Rt]||Rt),Rt}o(Gt,"lex");for(var Tt,Et,yt,oe,ht,gt,et={},pe,Qe,nt,dt;;){if(yt=fe[fe.length-1],this.defaultActions[yt]?oe=this.defaultActions[yt]:((Tt===null||typeof Tt>"u")&&(Tt=Gt()),oe=Re[yt]&&Re[yt][Tt]),typeof oe>"u"||!oe.length||!oe[0]){var Ft="";dt=[];for(pe in Re[yt])this.terminals_[pe]&&pe>Ae&&dt.push("'"+this.terminals_[pe]+"'");Ye.showPosition?Ft="Parse error on line "+(Oe+1)+`: +`+Ye.showPosition()+` +Expecting `+dt.join(", ")+", got '"+(this.terminals_[Tt]||Tt)+"'":Ft="Parse error on line "+(Oe+1)+": Unexpected "+(Tt==Ve?"end of input":"'"+(this.terminals_[Tt]||Tt)+"'"),this.parseError(Ft,{text:Ye.match,token:this.terminals_[Tt]||Tt,line:Ye.yylineno,loc:me,expected:dt})}if(oe[0]instanceof Array&&oe.length>1)throw new Error("Parse Error: multiple actions possible at state: "+yt+", token: "+Tt);switch(oe[0]){case 1:fe.push(Tt),ce.push(Ye.yytext),K.push(Ye.yylloc),fe.push(oe[1]),Tt=null,Et?(Tt=Et,Et=null):(be=Ye.yyleng,xe=Ye.yytext,Oe=Ye.yylineno,me=Ye.yylloc,Be>0&&Be--);break;case 2:if(Qe=this.productions_[oe[1]][1],et.$=ce[ce.length-Qe],et._$={first_line:K[K.length-(Qe||1)].first_line,last_line:K[K.length-1].last_line,first_column:K[K.length-(Qe||1)].first_column,last_column:K[K.length-1].last_column},ot&&(et._$.range=[K[K.length-(Qe||1)].range[0],K[K.length-1].range[1]]),gt=this.performAction.apply(et,[xe,be,Oe,le.yy,oe[1],ce,K].concat(Pe)),typeof gt<"u")return gt;Qe&&(fe=fe.slice(0,-1*Qe*2),ce=ce.slice(0,-1*Qe),K=K.slice(0,-1*Qe)),fe.push(this.productions_[oe[1]][0]),ce.push(et.$),K.push(et._$),nt=Re[fe[fe.length-2]][fe[fe.length-1]],fe.push(nt);break;case 3:return!0}}return!0},"parse")},qe=(function(){var ye={EOF:1,parseError:o(function(ie,fe){if(this.yy.parser)this.yy.parser.parseError(ie,fe);else throw new Error(ie)},"parseError"),setInput:o(function(ve,ie){return this.yy=ie||this.yy||{},this._input=ve,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var ve=this._input[0];this.yytext+=ve,this.yyleng++,this.offset++,this.match+=ve,this.matched+=ve;var ie=ve.match(/(?:\r\n?|\n).*/g);return ie?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ve},"input"),unput:o(function(ve){var ie=ve.length,fe=ve.split(/(?:\r\n?|\n)/g);this._input=ve+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-ie),this.offset-=ie;var W=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),fe.length-1&&(this.yylineno-=fe.length-1);var ce=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:fe?(fe.length===W.length?this.yylloc.first_column:0)+W[W.length-fe.length].length-fe[0].length:this.yylloc.first_column-ie},this.options.ranges&&(this.yylloc.range=[ce[0],ce[0]+this.yyleng-ie]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(ve){this.unput(this.match.slice(ve))},"less"),pastInput:o(function(){var ve=this.matched.substr(0,this.matched.length-this.match.length);return(ve.length>20?"...":"")+ve.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var ve=this.match;return ve.length<20&&(ve+=this._input.substr(0,20-ve.length)),(ve.substr(0,20)+(ve.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var ve=this.pastInput(),ie=new Array(ve.length+1).join("-");return ve+this.upcomingInput()+` +`+ie+"^"},"showPosition"),test_match:o(function(ve,ie){var fe,W,ce;if(this.options.backtrack_lexer&&(ce={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(ce.yylloc.range=this.yylloc.range.slice(0))),W=ve[0].match(/(?:\r\n?|\n).*/g),W&&(this.yylineno+=W.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:W?W[W.length-1].length-W[W.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+ve[0].length},this.yytext+=ve[0],this.match+=ve[0],this.matches=ve,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(ve[0].length),this.matched+=ve[0],fe=this.performAction.call(this,this.yy,this,ie,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),fe)return fe;if(this._backtrack){for(var K in ce)this[K]=ce[K];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var ve,ie,fe,W;this._more||(this.yytext="",this.match="");for(var ce=this._currentRules(),K=0;Kie[0].length)){if(ie=fe,W=K,this.options.backtrack_lexer){if(ve=this.test_match(fe,ce[K]),ve!==!1)return ve;if(this._backtrack){ie=!1;continue}else return!1}else if(!this.options.flex)break}return ie?(ve=this.test_match(ie,ce[W]),ve!==!1?ve:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var ie=this.next();return ie||this.lex()},"lex"),begin:o(function(ie){this.conditionStack.push(ie)},"begin"),popState:o(function(){var ie=this.conditionStack.length-1;return ie>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(ie){return ie=this.conditionStack.length-1-Math.abs(ie||0),ie>=0?this.conditionStack[ie]:"INITIAL"},"topState"),pushState:o(function(ie){this.begin(ie)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(ie,fe,W,ce){var K=ce;switch(W){case 0:return"title";case 1:return this.begin("acc_title"),9;break;case 2:return this.popState(),"acc_title_value";break;case 3:return this.begin("acc_descr"),11;break;case 4:return this.popState(),"acc_descr_value";break;case 5:this.begin("acc_descr_multiline");break;case 6:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:return 21;case 9:return 22;case 10:return 23;case 11:return 24;case 12:return 5;case 13:break;case 14:break;case 15:break;case 16:return 8;case 17:return 6;case 18:return 27;case 19:return 40;case 20:return 29;case 21:return 32;case 22:return 31;case 23:return 34;case 24:return 36;case 25:return 38;case 26:return 41;case 27:return 42;case 28:return 43;case 29:return 44;case 30:return 45;case 31:return 46;case 32:return 47;case 33:return 48;case 34:return 49;case 35:return 50;case 36:return 51;case 37:return 52;case 38:return 53;case 39:return 54;case 40:return 65;case 41:return 66;case 42:return 67;case 43:return 68;case 44:return 69;case 45:return 70;case 46:return 71;case 47:return 57;case 48:return 59;case 49:return this.begin("style"),77;break;case 50:return 75;case 51:return 81;case 52:return 88;case 53:return"PERCENT";case 54:return 86;case 55:return 84;case 56:break;case 57:this.begin("string");break;case 58:this.popState();break;case 59:return this.begin("style"),72;break;case 60:return this.begin("style"),74;break;case 61:return 61;case 62:return 64;case 63:return 63;case 64:this.begin("string");break;case 65:this.popState();break;case 66:return"qString";case 67:return fe.yytext=fe.yytext.trim(),89;break;case 68:return 75;case 69:return 80;case 70:return 76}},"anonymous"),rules:[/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::{3})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:style\b)/i,/^(?:\w+)/i,/^(?::)/i,/^(?:;)/i,/^(?:%)/i,/^(?:-)/i,/^(?:#)/i,/^(?: )/i,/^(?:["])/i,/^(?:\n)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^:,\r\n\{\<\>\-\=]*)/i,/^(?:\w+)/i,/^(?:[0-9]+)/i,/^(?:,)/i],conditions:{acc_descr_multiline:{rules:[6,7,68,69,70],inclusive:!1},acc_descr:{rules:[4,68,69,70],inclusive:!1},acc_title:{rules:[2,68,69,70],inclusive:!1},style:{rules:[50,51,52,53,54,55,56,57,58,68,69,70],inclusive:!1},unqString:{rules:[68,69,70],inclusive:!1},token:{rules:[68,69,70],inclusive:!1},string:{rules:[65,66,68,69,70],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,59,60,61,62,63,64,67,68,69,70],inclusive:!0}}};return ye})();at.lexer=qe;function Ue(){this.yy={}}return o(Ue,"Parser"),Ue.prototype=at,at.Parser=Ue,new Ue})();rW.parser=rW;XAe=rW});var V6,ZAe=z(()=>{"use strict";Ut();St();Ci();V6=class{constructor(){this.relations=[];this.latestRequirement=this.getInitialRequirement();this.requirements=new Map;this.latestElement=this.getInitialElement();this.elements=new Map;this.classes=new Map;this.direction="TB";this.RequirementType={REQUIREMENT:"Requirement",FUNCTIONAL_REQUIREMENT:"Functional Requirement",INTERFACE_REQUIREMENT:"Interface Requirement",PERFORMANCE_REQUIREMENT:"Performance Requirement",PHYSICAL_REQUIREMENT:"Physical Requirement",DESIGN_CONSTRAINT:"Design Constraint"};this.RiskLevel={LOW_RISK:"Low",MED_RISK:"Medium",HIGH_RISK:"High"};this.VerifyType={VERIFY_ANALYSIS:"Analysis",VERIFY_DEMONSTRATION:"Demonstration",VERIFY_INSPECTION:"Inspection",VERIFY_TEST:"Test"};this.Relationships={CONTAINS:"contains",COPIES:"copies",DERIVES:"derives",SATISFIES:"satisfies",VERIFIES:"verifies",REFINES:"refines",TRACES:"traces"};this.setAccTitle=Cr;this.getAccTitle=kr;this.setAccDescription=wr;this.getAccDescription=Sr;this.setDiagramTitle=Ar;this.getDiagramTitle=Er;this.getConfig=o(()=>ge().requirement,"getConfig");this.clear(),this.setDirection=this.setDirection.bind(this),this.addRequirement=this.addRequirement.bind(this),this.setNewReqId=this.setNewReqId.bind(this),this.setNewReqRisk=this.setNewReqRisk.bind(this),this.setNewReqText=this.setNewReqText.bind(this),this.setNewReqVerifyMethod=this.setNewReqVerifyMethod.bind(this),this.addElement=this.addElement.bind(this),this.setNewElementType=this.setNewElementType.bind(this),this.setNewElementDocRef=this.setNewElementDocRef.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setCssStyle=this.setCssStyle.bind(this),this.setClass=this.setClass.bind(this),this.defineClass=this.defineClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{o(this,"RequirementDB")}getDirection(){return this.direction}setDirection(t){this.direction=t}resetLatestRequirement(){this.latestRequirement=this.getInitialRequirement()}resetLatestElement(){this.latestElement=this.getInitialElement()}getInitialRequirement(){return{requirementId:"",text:"",risk:"",verifyMethod:"",name:"",type:"",cssStyles:[],classes:["default"]}}getInitialElement(){return{name:"",type:"",docRef:"",cssStyles:[],classes:["default"]}}addRequirement(t,r){return this.requirements.has(t)||this.requirements.set(t,{name:t,type:r,requirementId:this.latestRequirement.requirementId,text:this.latestRequirement.text,risk:this.latestRequirement.risk,verifyMethod:this.latestRequirement.verifyMethod,cssStyles:[],classes:["default"]}),this.resetLatestRequirement(),this.requirements.get(t)}getRequirements(){return this.requirements}setNewReqId(t){this.latestRequirement!==void 0&&(this.latestRequirement.requirementId=t)}setNewReqText(t){this.latestRequirement!==void 0&&(this.latestRequirement.text=t)}setNewReqRisk(t){this.latestRequirement!==void 0&&(this.latestRequirement.risk=t)}setNewReqVerifyMethod(t){this.latestRequirement!==void 0&&(this.latestRequirement.verifyMethod=t)}addElement(t){return this.elements.has(t)||(this.elements.set(t,{name:t,type:this.latestElement.type,docRef:this.latestElement.docRef,cssStyles:[],classes:["default"]}),Z.info("Added new element: ",t)),this.resetLatestElement(),this.elements.get(t)}getElements(){return this.elements}setNewElementType(t){this.latestElement!==void 0&&(this.latestElement.type=t)}setNewElementDocRef(t){this.latestElement!==void 0&&(this.latestElement.docRef=t)}addRelationship(t,r,i){this.relations.push({type:t,src:r,dst:i})}getRelationships(){return this.relations}clear(){this.relations=[],this.resetLatestRequirement(),this.requirements=new Map,this.resetLatestElement(),this.elements=new Map,this.classes=new Map,gr()}setCssStyle(t,r){for(let i of t){let n=this.requirements.get(i)??this.elements.get(i);if(!r||!n)return;for(let a of r)a.includes(",")?n.cssStyles.push(...a.split(",")):n.cssStyles.push(a)}}setClass(t,r){for(let i of t){let n=this.requirements.get(i)??this.elements.get(i);if(n)for(let a of r){n.classes.push(a);let s=this.classes.get(a)?.styles;s&&n.cssStyles.push(...s)}}}defineClass(t,r){for(let i of t){let n=this.classes.get(i);n===void 0&&(n={id:i,styles:[],textStyles:[]},this.classes.set(i,n)),r&&r.forEach(function(a){if(/color/.exec(a)){let s=a.replace("fill","bgFill");n.textStyles.push(s)}n.styles.push(a)}),this.requirements.forEach(a=>{a.classes.includes(i)&&a.cssStyles.push(...r.flatMap(s=>s.split(",")))}),this.elements.forEach(a=>{a.classes.includes(i)&&a.cssStyles.push(...r.flatMap(s=>s.split(",")))})}}getClasses(){return this.classes}getData(){let t=ge(),r=[],i=[];for(let n of this.requirements.values()){let a=n;a.id=n.name,a.cssStyles=n.cssStyles,a.cssClasses=n.classes.join(" "),a.shape="requirementBox",a.look=t.look,a.colorIndex=r.length,r.push(a)}for(let n of this.elements.values()){let a=n;a.shape="requirementBox",a.look=t.look,a.id=n.name,a.cssStyles=n.cssStyles,a.cssClasses=n.classes.join(" "),a.colorIndex=r.length,r.push(a)}for(let n of this.relations){let a=0,s=n.type===this.Relationships.CONTAINS,l={id:`${n.src}-${n.dst}-${a}`,start:this.requirements.get(n.src)?.name??this.elements.get(n.src)?.name,end:this.requirements.get(n.dst)?.name??this.elements.get(n.dst)?.name,label:`<<${n.type}>>`,classes:"relationshipLine",style:["fill:none",s?"":"stroke-dasharray: 10,7"],labelpos:"c",thickness:"normal",type:"normal",pattern:s?"normal":"dashed",arrowTypeStart:s?"requirement_contains":"",arrowTypeEnd:s?"":"requirement_arrow",look:t.look,labelType:"markdown"};i.push(l),a++}return{nodes:r,edges:i,other:{},config:t,direction:this.getDirection()}}}});var gTt,yTt,QAe,JAe=z(()=>{"use strict";br();gTt=o(e=>{let t=Nt(),{themeVariables:r,look:i}=t,{bkgColorArray:n,borderColorArray:a}=r;if(!a?.length)return"";let s="";for(let l=0;l{let t=Nt(),{look:r,themeVariables:i}=t,{requirementEdgeLabelBackground:n}=i;return` + ${gTt(e)} + marker { + fill: ${e.relationColor}; + stroke: ${e.relationColor}; + } + + marker.cross { + stroke: ${e.lineColor}; + } + + svg { + font-family: ${e.fontFamily}; + font-size: ${e.fontSize}; + } + + .reqBox { + fill: ${e.requirementBackground}; + fill-opacity: 1.0; + stroke: ${e.requirementBorderColor}; + stroke-width: ${e.requirementBorderSize}; + } + + .reqTitle, .reqLabel{ + fill: ${e.requirementTextColor}; + } + .reqLabelBox { + fill: ${e.relationLabelBackground}; + fill-opacity: 1.0; + } + + .req-title-line { + stroke: ${e.requirementBorderColor}; + stroke-width: ${e.requirementBorderSize}; + } + .relationshipLine { + stroke: ${e.relationColor}; + stroke-width: ${r==="neo"?e.strokeWidth:"1px"}; + } + .relationshipLabel { + fill: ${e.relationLabelColor}; + } + .edgeLabel { + background-color: ${e.edgeLabelBackground}; + } + .edgeLabel .label rect { + fill: ${e.edgeLabelBackground}; + } + .edgeLabel .label text { + fill: ${e.relationLabelColor}; + } + .divider { + stroke: ${e.nodeBorder}; + stroke-width: 1; + } + .label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor||e.textColor}; + } + .label text,span { + fill: ${e.nodeTextColor||e.textColor}; + color: ${e.nodeTextColor||e.textColor}; + } + .labelBkg { + background-color: ${n??e.edgeLabelBackground}; + } + +`},"getStyles"),QAe=yTt});var iW={};xr(iW,{draw:()=>vTt});var vTt,e6e=z(()=>{"use strict";Ut();St();Lp();tf();rf();Xt();vTt=o(async function(e,t,r,i){Z.info("REF0:"),Z.info("Drawing requirement diagram (unified)",t);let{securityLevel:n,state:a,layout:s,look:l}=ge(),u=i.db.getData(),h=Fo(t,n);u.type=i.type,u.layoutAlgorithm=Gc(s),u.nodeSpacing=a?.nodeSpacing??50,u.rankSpacing=a?.rankSpacing??50,u.markers=l==="neo"?["requirement_contains_neo","requirement_arrow_neo"]:["requirement_contains","requirement_arrow"],u.diagramId=t,await Zo(u,h);let d=8;Zt.insertTitle(h,"requirementDiagramTitleText",a?.titleTopMargin??25,i.db.getDiagramTitle()),$s(h,d,"requirementDiagram",a?.useMaxWidth??!0)},"draw")});var t6e={};xr(t6e,{diagram:()=>xTt});var xTt,r6e=z(()=>{"use strict";KAe();ZAe();JAe();e6e();xTt={parser:XAe,get db(){return new V6},renderer:iW,styles:QAe}});var nW,a6e,s6e=z(()=>{"use strict";nW=(function(){var e=o(function(be,Be,Ae,Ve){for(Ae=Ae||{},Ve=be.length;Ve--;Ae[be[Ve]]=Be);return Ae},"o"),t=[1,2],r=[1,3],i=[1,4],n=[2,4],a=[1,9],s=[1,11],l=[1,12],u=[1,14],h=[1,15],d=[1,17],f=[1,18],p=[1,19],m=[1,25],g=[1,26],y=[1,27],v=[1,28],x=[1,29],b=[1,30],T=[1,31],w=[1,32],C=[1,33],k=[1,34],E=[1,35],A=[1,36],N=[1,37],P=[1,38],I=[1,39],D=[1,40],_=[1,42],R=[1,43],M=[1,44],L=[1,45],B=[1,46],O=[1,47],$=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],G=[1,74],F=[1,80],V=[1,81],H=[1,82],j=[1,83],U=[1,84],Q=[1,85],Y=[1,86],ae=[1,87],J=[1,88],te=[1,89],re=[1,90],ee=[1,91],Te=[1,92],ue=[1,93],De=[1,94],Ie=[1,95],Ee=[1,96],we=[1,97],Me=[1,98],$e=[1,99],de=[1,100],rt=[1,101],ke=[1,102],Fe=[1,103],He=[1,104],at=[1,105],qe=[2,78],Ue=[4,5,17,51,53,54],ye=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],ve=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],ie=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],fe=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],W=[5,52],ce=[70,71,72,73],K=[1,151],Re={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:o(function(Be,Ae,Ve,Pe,Ye,le,st){var me=le.length-1;switch(Ye){case 3:return Pe.apply(le[me]),le[me];break;case 4:case 10:this.$=[];break;case 5:case 11:le[me-1].push(le[me]),this.$=le[me-1];break;case 6:case 7:case 12:case 13:this.$=le[me];break;case 8:case 9:case 14:this.$=[];break;case 16:le[me].type="createParticipant",this.$=le[me];break;case 17:le[me-1].unshift({type:"boxStart",boxData:Pe.parseBoxData(le[me-2])}),le[me-1].push({type:"boxEnd",boxText:le[me-2]}),this.$=le[me-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(le[me-2]),sequenceIndexStep:Number(le[me-1]),sequenceVisible:!0,signalType:Pe.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(le[me-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:Pe.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:Pe.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:Pe.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:Pe.LINETYPE.ACTIVE_START,actor:le[me-1].actor};break;case 24:this.$={type:"activeEnd",signalType:Pe.LINETYPE.ACTIVE_END,actor:le[me-1].actor};break;case 30:Pe.setDiagramTitle(le[me].substring(6)),this.$=le[me].substring(6);break;case 31:Pe.setDiagramTitle(le[me].substring(7)),this.$=le[me].substring(7);break;case 32:this.$=le[me].trim(),Pe.setAccTitle(this.$);break;case 33:case 34:this.$=le[me].trim(),Pe.setAccDescription(this.$);break;case 35:le[me-1].unshift({type:"loopStart",loopText:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.LOOP_START}),le[me-1].push({type:"loopEnd",loopText:le[me-2],signalType:Pe.LINETYPE.LOOP_END}),this.$=le[me-1];break;case 36:le[me-1].unshift({type:"rectStart",color:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.RECT_START}),le[me-1].push({type:"rectEnd",color:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.RECT_END}),this.$=le[me-1];break;case 37:le[me-1].unshift({type:"optStart",optText:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.OPT_START}),le[me-1].push({type:"optEnd",optText:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.OPT_END}),this.$=le[me-1];break;case 38:le[me-1].unshift({type:"altStart",altText:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.ALT_START}),le[me-1].push({type:"altEnd",signalType:Pe.LINETYPE.ALT_END}),this.$=le[me-1];break;case 39:le[me-1].unshift({type:"parStart",parText:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.PAR_START}),le[me-1].push({type:"parEnd",signalType:Pe.LINETYPE.PAR_END}),this.$=le[me-1];break;case 40:le[me-1].unshift({type:"parStart",parText:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.PAR_OVER_START}),le[me-1].push({type:"parEnd",signalType:Pe.LINETYPE.PAR_END}),this.$=le[me-1];break;case 41:le[me-1].unshift({type:"criticalStart",criticalText:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.CRITICAL_START}),le[me-1].push({type:"criticalEnd",signalType:Pe.LINETYPE.CRITICAL_END}),this.$=le[me-1];break;case 42:le[me-1].unshift({type:"breakStart",breakText:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.BREAK_START}),le[me-1].push({type:"breakEnd",optText:Pe.parseMessage(le[me-2]),signalType:Pe.LINETYPE.BREAK_END}),this.$=le[me-1];break;case 44:this.$=le[me-3].concat([{type:"option",optionText:Pe.parseMessage(le[me-1]),signalType:Pe.LINETYPE.CRITICAL_OPTION},le[me]]);break;case 46:this.$=le[me-3].concat([{type:"and",parText:Pe.parseMessage(le[me-1]),signalType:Pe.LINETYPE.PAR_AND},le[me]]);break;case 48:this.$=le[me-3].concat([{type:"else",altText:Pe.parseMessage(le[me-1]),signalType:Pe.LINETYPE.ALT_ELSE},le[me]]);break;case 49:le[me-3].draw="participant",le[me-3].type="addParticipant",le[me-3].description=Pe.parseMessage(le[me-1]),this.$=le[me-3];break;case 50:le[me-1].draw="participant",le[me-1].type="addParticipant",this.$=le[me-1];break;case 51:le[me-3].draw="actor",le[me-3].type="addParticipant",le[me-3].description=Pe.parseMessage(le[me-1]),this.$=le[me-3];break;case 52:case 57:le[me-1].draw="actor",le[me-1].type="addParticipant",this.$=le[me-1];break;case 53:le[me-1].type="destroyParticipant",this.$=le[me-1];break;case 54:le[me-3].draw="participant",le[me-3].type="addParticipant",le[me-3].description=Pe.parseMessage(le[me-1]),this.$=le[me-3];break;case 55:le[me-1].draw="participant",le[me-1].type="addParticipant",this.$=le[me-1];break;case 56:le[me-3].draw="actor",le[me-3].type="addParticipant",le[me-3].description=Pe.parseMessage(le[me-1]),this.$=le[me-3];break;case 58:this.$=[le[me-1],{type:"addNote",placement:le[me-2],actor:le[me-1].actor,text:le[me]}];break;case 59:le[me-2]=[].concat(le[me-1],le[me-1]).slice(0,2),le[me-2][0]=le[me-2][0].actor,le[me-2][1]=le[me-2][1].actor,this.$=[le[me-1],{type:"addNote",placement:Pe.PLACEMENT.OVER,actor:le[me-2].slice(0,2),text:le[me]}];break;case 60:this.$=[le[me-1],{type:"addLinks",actor:le[me-1].actor,text:le[me]}];break;case 61:this.$=[le[me-1],{type:"addALink",actor:le[me-1].actor,text:le[me]}];break;case 62:this.$=[le[me-1],{type:"addProperties",actor:le[me-1].actor,text:le[me]}];break;case 63:this.$=[le[me-1],{type:"addDetails",actor:le[me-1].actor,text:le[me]}];break;case 66:this.$=[le[me-2],le[me]];break;case 67:this.$=le[me];break;case 68:this.$=Pe.PLACEMENT.LEFTOF;break;case 69:this.$=Pe.PLACEMENT.RIGHTOF;break;case 70:this.$=[le[me-4],le[me-1],{type:"addMessage",from:le[me-4].actor,to:le[me-1].actor,signalType:le[me-3],msg:le[me],activate:!0},{type:"activeStart",signalType:Pe.LINETYPE.ACTIVE_START,actor:le[me-1].actor}];break;case 71:this.$=[le[me-4],le[me-1],{type:"addMessage",from:le[me-4].actor,to:le[me-1].actor,signalType:le[me-3],msg:le[me]},{type:"activeEnd",signalType:Pe.LINETYPE.ACTIVE_END,actor:le[me-4].actor}];break;case 72:this.$=[le[me-4],le[me-1],{type:"addMessage",from:le[me-4].actor,to:le[me-1].actor,signalType:le[me-3],msg:le[me],activate:!0,centralConnection:Pe.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:Pe.LINETYPE.CENTRAL_CONNECTION,actor:le[me-1].actor}];break;case 73:this.$=[le[me-4],le[me-1],{type:"addMessage",from:le[me-4].actor,to:le[me-1].actor,signalType:le[me-2],msg:le[me],activate:!1,centralConnection:Pe.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:Pe.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:le[me-4].actor}];break;case 74:this.$=[le[me-5],le[me-1],{type:"addMessage",from:le[me-5].actor,to:le[me-1].actor,signalType:le[me-3],msg:le[me],activate:!0,centralConnection:Pe.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:Pe.LINETYPE.CENTRAL_CONNECTION,actor:le[me-1].actor},{type:"centralConnectionReverse",signalType:Pe.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:le[me-5].actor}];break;case 75:this.$=[le[me-3],le[me-1],{type:"addMessage",from:le[me-3].actor,to:le[me-1].actor,signalType:le[me-2],msg:le[me]}];break;case 76:this.$={type:"addParticipant",actor:le[me-1],config:le[me]};break;case 77:this.$=le[me-1].trim();break;case 78:this.$={type:"addParticipant",actor:le[me]};break;case 79:this.$=Pe.LINETYPE.SOLID_OPEN;break;case 80:this.$=Pe.LINETYPE.DOTTED_OPEN;break;case 81:this.$=Pe.LINETYPE.SOLID;break;case 82:this.$=Pe.LINETYPE.SOLID_TOP;break;case 83:this.$=Pe.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=Pe.LINETYPE.STICK_TOP;break;case 85:this.$=Pe.LINETYPE.STICK_BOTTOM;break;case 86:this.$=Pe.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=Pe.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=Pe.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=Pe.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=Pe.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=Pe.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=Pe.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=Pe.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=Pe.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=Pe.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=Pe.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=Pe.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=Pe.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=Pe.LINETYPE.DOTTED;break;case 100:this.$=Pe.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=Pe.LINETYPE.SOLID_CROSS;break;case 102:this.$=Pe.LINETYPE.DOTTED_CROSS;break;case 103:this.$=Pe.LINETYPE.SOLID_POINT;break;case 104:this.$=Pe.LINETYPE.DOTTED_POINT;break;case 105:this.$=Pe.parseMessage(le[me].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:r,6:i},{1:[3]},{3:5,4:t,5:r,6:i},{3:6,4:t,5:r,6:i},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],n,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:a,5:s,8:8,9:10,10:l,13:13,14:u,15:h,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:g,32:y,34:v,36:x,37:b,38:T,39:w,40:C,42:k,44:E,45:A,47:N,51:P,53:I,54:D,56:_,61:R,62:M,63:L,64:B,73:O},e($,[2,5]),{9:48,13:13,14:u,15:h,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:g,32:y,34:v,36:x,37:b,38:T,39:w,40:C,42:k,44:E,45:A,47:N,51:P,53:I,54:D,56:_,61:R,62:M,63:L,64:B,73:O},e($,[2,7]),e($,[2,8]),e($,[2,9]),e($,[2,15]),{13:49,51:P,53:I,54:D},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:O},{23:56,73:O},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e($,[2,30]),e($,[2,31]),{33:[1,62]},{35:[1,63]},e($,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:G},{23:75,55:76,73:G},{23:77,73:O},{69:78,72:[1,79],78:F,79:V,80:H,81:j,82:U,83:Q,84:Y,85:ae,86:J,87:te,88:re,89:ee,90:Te,91:ue,92:De,93:Ie,94:Ee,95:we,96:Me,97:$e,98:de,99:rt,100:ke,101:Fe,102:He,103:at},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:O},{23:111,73:O},{23:112,73:O},{23:113,73:O},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],qe),e($,[2,6]),e($,[2,16]),e(Ue,[2,10],{11:114}),e($,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e($,[2,22]),{5:[1,118]},{5:[1,119]},e($,[2,25]),e($,[2,26]),e($,[2,27]),e($,[2,28]),e($,[2,29]),e($,[2,32]),e($,[2,33]),e(ye,n,{7:120}),e(ye,n,{7:121}),e(ye,n,{7:122}),e(ve,n,{41:123,7:124}),e(ie,n,{43:125,7:126}),e(ie,n,{7:126,43:127}),e(fe,n,{46:128,7:129}),e(ye,n,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(W,qe,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:O},{69:146,78:F,79:V,80:H,81:j,82:U,83:Q,84:Y,85:ae,86:J,87:te,88:re,89:ee,90:Te,91:ue,92:De,93:Ie,94:Ee,95:we,96:Me,97:$e,98:de,99:rt,100:ke,101:Fe,102:He,103:at},e(ce,[2,79]),e(ce,[2,80]),e(ce,[2,81]),e(ce,[2,82]),e(ce,[2,83]),e(ce,[2,84]),e(ce,[2,85]),e(ce,[2,86]),e(ce,[2,87]),e(ce,[2,88]),e(ce,[2,89]),e(ce,[2,90]),e(ce,[2,91]),e(ce,[2,92]),e(ce,[2,93]),e(ce,[2,94]),e(ce,[2,95]),e(ce,[2,96]),e(ce,[2,97]),e(ce,[2,98]),e(ce,[2,99]),e(ce,[2,100]),e(ce,[2,101]),e(ce,[2,102]),e(ce,[2,103]),e(ce,[2,104]),{23:147,73:O},{23:149,60:148,73:O},{73:[2,68]},{73:[2,69]},{58:150,104:K},{58:152,104:K},{58:153,104:K},{58:154,104:K},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:P,53:I,54:D},{5:[1,160]},e($,[2,20]),e($,[2,21]),e($,[2,23]),e($,[2,24]),{4:a,5:s,8:8,9:10,10:l,13:13,14:u,15:h,17:[1,161],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:g,32:y,34:v,36:x,37:b,38:T,39:w,40:C,42:k,44:E,45:A,47:N,51:P,53:I,54:D,56:_,61:R,62:M,63:L,64:B,73:O},{4:a,5:s,8:8,9:10,10:l,13:13,14:u,15:h,17:[1,162],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:g,32:y,34:v,36:x,37:b,38:T,39:w,40:C,42:k,44:E,45:A,47:N,51:P,53:I,54:D,56:_,61:R,62:M,63:L,64:B,73:O},{4:a,5:s,8:8,9:10,10:l,13:13,14:u,15:h,17:[1,163],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:g,32:y,34:v,36:x,37:b,38:T,39:w,40:C,42:k,44:E,45:A,47:N,51:P,53:I,54:D,56:_,61:R,62:M,63:L,64:B,73:O},{17:[1,164]},{4:a,5:s,8:8,9:10,10:l,13:13,14:u,15:h,17:[2,47],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:g,32:y,34:v,36:x,37:b,38:T,39:w,40:C,42:k,44:E,45:A,47:N,50:[1,165],51:P,53:I,54:D,56:_,61:R,62:M,63:L,64:B,73:O},{17:[1,166]},{4:a,5:s,8:8,9:10,10:l,13:13,14:u,15:h,17:[2,45],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:g,32:y,34:v,36:x,37:b,38:T,39:w,40:C,42:k,44:E,45:A,47:N,49:[1,167],51:P,53:I,54:D,56:_,61:R,62:M,63:L,64:B,73:O},{17:[1,168]},{17:[1,169]},{4:a,5:s,8:8,9:10,10:l,13:13,14:u,15:h,17:[2,43],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:g,32:y,34:v,36:x,37:b,38:T,39:w,40:C,42:k,44:E,45:A,47:N,48:[1,170],51:P,53:I,54:D,56:_,61:R,62:M,63:L,64:B,73:O},{4:a,5:s,8:8,9:10,10:l,13:13,14:u,15:h,17:[1,171],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:g,32:y,34:v,36:x,37:b,38:T,39:w,40:C,42:k,44:E,45:A,47:N,51:P,53:I,54:D,56:_,61:R,62:M,63:L,64:B,73:O},{16:[1,172]},e($,[2,50]),{16:[1,173]},e($,[2,55]),e(W,[2,76]),{76:[1,174]},{16:[1,175]},e($,[2,52]),{16:[1,176]},e($,[2,57]),e($,[2,53]),{23:177,73:O},{23:178,73:O},{23:179,73:O},{58:180,104:K},{23:181,72:[1,182],73:O},{58:183,104:K},{58:184,104:K},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e($,[2,17]),e(Ue,[2,11]),{13:186,51:P,53:I,54:D},e(Ue,[2,13]),e(Ue,[2,14]),e($,[2,19]),e($,[2,35]),e($,[2,36]),e($,[2,37]),e($,[2,38]),{16:[1,187]},e($,[2,39]),{16:[1,188]},e($,[2,40]),e($,[2,41]),{16:[1,189]},e($,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:K},{58:196,104:K},{58:197,104:K},{5:[2,75]},{58:198,104:K},{23:199,73:O},{5:[2,58]},{5:[2,59]},{23:200,73:O},e(Ue,[2,12]),e(ve,n,{7:124,41:201}),e(ie,n,{7:126,43:202}),e(fe,n,{7:129,46:203}),e($,[2,49]),e($,[2,54]),e(W,[2,77]),e($,[2,51]),e($,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:K},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:o(function(Be,Ae){if(Ae.recoverable)this.trace(Be);else{var Ve=new Error(Be);throw Ve.hash=Ae,Ve}},"parseError"),parse:o(function(Be){var Ae=this,Ve=[0],Pe=[],Ye=[null],le=[],st=this.table,me="",ot=0,kt=0,Gt=0,Tt=2,Et=1,yt=le.slice.call(arguments,1),oe=Object.create(this.lexer),ht={yy:{}};for(var gt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,gt)&&(ht.yy[gt]=this.yy[gt]);oe.setInput(Be,ht.yy),ht.yy.lexer=oe,ht.yy.parser=this,typeof oe.yylloc>"u"&&(oe.yylloc={});var et=oe.yylloc;le.push(et);var pe=oe.options&&oe.options.ranges;typeof ht.yy.parseError=="function"?this.parseError=ht.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Qe(Dr){Ve.length=Ve.length-2*Dr,Ye.length=Ye.length-Dr,le.length=le.length-Dr}o(Qe,"popStack");function nt(){var Dr;return Dr=Pe.pop()||oe.lex()||Et,typeof Dr!="number"&&(Dr instanceof Array&&(Pe=Dr,Dr=Pe.pop()),Dr=Ae.symbols_[Dr]||Dr),Dr}o(nt,"lex");for(var dt,Ft,Rt,$t,lr,pt,Se={},it,xt,rr,_r;;){if(Rt=Ve[Ve.length-1],this.defaultActions[Rt]?$t=this.defaultActions[Rt]:((dt===null||typeof dt>"u")&&(dt=nt()),$t=st[Rt]&&st[Rt][dt]),typeof $t>"u"||!$t.length||!$t[0]){var Ur="";_r=[];for(it in st[Rt])this.terminals_[it]&&it>Tt&&_r.push("'"+this.terminals_[it]+"'");oe.showPosition?Ur="Parse error on line "+(ot+1)+`: +`+oe.showPosition()+` +Expecting `+_r.join(", ")+", got '"+(this.terminals_[dt]||dt)+"'":Ur="Parse error on line "+(ot+1)+": Unexpected "+(dt==Et?"end of input":"'"+(this.terminals_[dt]||dt)+"'"),this.parseError(Ur,{text:oe.match,token:this.terminals_[dt]||dt,line:oe.yylineno,loc:et,expected:_r})}if($t[0]instanceof Array&&$t.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Rt+", token: "+dt);switch($t[0]){case 1:Ve.push(dt),Ye.push(oe.yytext),le.push(oe.yylloc),Ve.push($t[1]),dt=null,Ft?(dt=Ft,Ft=null):(kt=oe.yyleng,me=oe.yytext,ot=oe.yylineno,et=oe.yylloc,Gt>0&&Gt--);break;case 2:if(xt=this.productions_[$t[1]][1],Se.$=Ye[Ye.length-xt],Se._$={first_line:le[le.length-(xt||1)].first_line,last_line:le[le.length-1].last_line,first_column:le[le.length-(xt||1)].first_column,last_column:le[le.length-1].last_column},pe&&(Se._$.range=[le[le.length-(xt||1)].range[0],le[le.length-1].range[1]]),pt=this.performAction.apply(Se,[me,kt,ot,ht.yy,$t[1],Ye,le].concat(yt)),typeof pt<"u")return pt;xt&&(Ve=Ve.slice(0,-1*xt*2),Ye=Ye.slice(0,-1*xt),le=le.slice(0,-1*xt)),Ve.push(this.productions_[$t[1]][0]),Ye.push(Se.$),le.push(Se._$),rr=st[Ve[Ve.length-2]][Ve[Ve.length-1]],Ve.push(rr);break;case 3:return!0}}return!0},"parse")},xe=(function(){var be={EOF:1,parseError:o(function(Ae,Ve){if(this.yy.parser)this.yy.parser.parseError(Ae,Ve);else throw new Error(Ae)},"parseError"),setInput:o(function(Be,Ae){return this.yy=Ae||this.yy||{},this._input=Be,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var Be=this._input[0];this.yytext+=Be,this.yyleng++,this.offset++,this.match+=Be,this.matched+=Be;var Ae=Be.match(/(?:\r\n?|\n).*/g);return Ae?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Be},"input"),unput:o(function(Be){var Ae=Be.length,Ve=Be.split(/(?:\r\n?|\n)/g);this._input=Be+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-Ae),this.offset-=Ae;var Pe=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),Ve.length-1&&(this.yylineno-=Ve.length-1);var Ye=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:Ve?(Ve.length===Pe.length?this.yylloc.first_column:0)+Pe[Pe.length-Ve.length].length-Ve[0].length:this.yylloc.first_column-Ae},this.options.ranges&&(this.yylloc.range=[Ye[0],Ye[0]+this.yyleng-Ae]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(Be){this.unput(this.match.slice(Be))},"less"),pastInput:o(function(){var Be=this.matched.substr(0,this.matched.length-this.match.length);return(Be.length>20?"...":"")+Be.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var Be=this.match;return Be.length<20&&(Be+=this._input.substr(0,20-Be.length)),(Be.substr(0,20)+(Be.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var Be=this.pastInput(),Ae=new Array(Be.length+1).join("-");return Be+this.upcomingInput()+` +`+Ae+"^"},"showPosition"),test_match:o(function(Be,Ae){var Ve,Pe,Ye;if(this.options.backtrack_lexer&&(Ye={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(Ye.yylloc.range=this.yylloc.range.slice(0))),Pe=Be[0].match(/(?:\r\n?|\n).*/g),Pe&&(this.yylineno+=Pe.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:Pe?Pe[Pe.length-1].length-Pe[Pe.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Be[0].length},this.yytext+=Be[0],this.match+=Be[0],this.matches=Be,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(Be[0].length),this.matched+=Be[0],Ve=this.performAction.call(this,this.yy,this,Ae,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),Ve)return Ve;if(this._backtrack){for(var le in Ye)this[le]=Ye[le];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Be,Ae,Ve,Pe;this._more||(this.yytext="",this.match="");for(var Ye=this._currentRules(),le=0;leAe[0].length)){if(Ae=Ve,Pe=le,this.options.backtrack_lexer){if(Be=this.test_match(Ve,Ye[le]),Be!==!1)return Be;if(this._backtrack){Ae=!1;continue}else return!1}else if(!this.options.flex)break}return Ae?(Be=this.test_match(Ae,Ye[Pe]),Be!==!1?Be:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var Ae=this.next();return Ae||this.lex()},"lex"),begin:o(function(Ae){this.conditionStack.push(Ae)},"begin"),popState:o(function(){var Ae=this.conditionStack.length-1;return Ae>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(Ae){return Ae=this.conditionStack.length-1-Math.abs(Ae||0),Ae>=0?this.conditionStack[Ae]:"INITIAL"},"topState"),pushState:o(function(Ae){this.begin(Ae)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(Ae,Ve,Pe,Ye){var le=Ye;switch(Pe){case 0:return 5;case 1:break;case 2:break;case 3:break;case 4:break;case 5:break;case 6:return 20;case 7:return this.begin("CONFIG"),75;break;case 8:return 76;case 9:return this.popState(),this.begin("ALIAS"),77;break;case 10:return this.popState(),this.popState(),77;break;case 11:return Ve.yytext=Ve.yytext.trim(),73;break;case 12:return Ve.yytext=Ve.yytext.trim(),this.begin("ALIAS"),73;break;case 13:return Ve.yytext=Ve.yytext.trim(),this.popState(),73;break;case 14:return this.popState(),10;break;case 15:return Ve.yytext=Ve.yytext.trim(),this.popState(),10;break;case 16:return this.begin("LINE"),15;break;case 17:return this.begin("ID"),51;break;case 18:return this.begin("ID"),53;break;case 19:return 14;case 20:return this.begin("ID"),54;break;case 21:return this.popState(),this.popState(),this.begin("LINE"),52;break;case 22:return this.popState(),this.popState(),5;break;case 23:return this.begin("LINE"),37;break;case 24:return this.begin("LINE"),38;break;case 25:return this.begin("LINE"),39;break;case 26:return this.begin("LINE"),40;break;case 27:return this.begin("LINE"),50;break;case 28:return this.begin("LINE"),42;break;case 29:return this.begin("LINE"),44;break;case 30:return this.begin("LINE"),49;break;case 31:return this.begin("LINE"),45;break;case 32:return this.begin("LINE"),48;break;case 33:return this.begin("LINE"),47;break;case 34:return this.popState(),16;break;case 35:return 17;case 36:return 67;case 37:return 68;case 38:return 61;case 39:return 62;case 40:return 63;case 41:return 64;case 42:return 59;case 43:return 56;case 44:return this.begin("ID"),22;break;case 45:return this.begin("ID"),24;break;case 46:return 30;case 47:return 31;case 48:return this.begin("acc_title"),32;break;case 49:return this.popState(),"acc_title_value";break;case 50:return this.begin("acc_descr"),34;break;case 51:return this.popState(),"acc_descr_value";break;case 52:this.begin("acc_descr_multiline");break;case 53:this.popState();break;case 54:return"acc_descr_multiline_value";case 55:return 6;case 56:return 19;case 57:return 21;case 58:return 66;case 59:return 5;case 60:return Ve.yytext=Ve.yytext.trim(),73;break;case 61:return 80;case 62:return 97;case 63:return 98;case 64:return 99;case 65:return 78;case 66:return 79;case 67:return 100;case 68:return 101;case 69:return 102;case 70:return 103;case 71:return 85;case 72:return 86;case 73:return 87;case 74:return 88;case 75:return 93;case 76:return 94;case 77:return 95;case 78:return 96;case 79:return 81;case 80:return 82;case 81:return 83;case 82:return 84;case 83:return 89;case 84:return 90;case 85:return 91;case 86:return 92;case 87:return 104;case 88:return 104;case 89:return 70;case 90:return 71;case 91:return 72;case 92:return 5;case 93:return 10}},"anonymous"),rules:[/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:([0-9]+(\.[0-9]{1,2})?|\.[0-9]{1,2})(?=[ \n]+))/i,/^(?:@\{)/i,/^(?:[^\}]+)/i,/^(?:\}(?=\s+as\s))/i,/^(?:\})/i,/^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i,/^(?:[^<>:\n,;@\s]+(?=\s+as\s))/i,/^(?:[^<>:\n,;@]+(?=\s*[\n;#]|$))/i,/^(?:[^<>:\n,;@]*<[^\n]*)/i,/^(?:[^\n]+)/i,/^(?:box\b)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:create\b)/i,/^(?:destroy\b)/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:par_over\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\/\\\+\()\+<\->\->:\n,;]+((?!(-x|--x|-\)|--\)|-\|\\|-\\|-\/|-\/\/|-\|\/|\/\|-|\\\|-|\/\/-|\\\\-|\/\|-|--\|\\|--|\(\)))[\-]*[^\+<\->\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:<<->>)/i,/^(?:-->>)/i,/^(?:<<-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?:--\|\\)/i,/^(?:--\|\/)/i,/^(?:--\\\\)/i,/^(?:--\/\/)/i,/^(?:\/\|--)/i,/^(?:\\\|--)/i,/^(?:\/\/--)/i,/^(?:\\\\--)/i,/^(?:-\|\\)/i,/^(?:-\|\/)/i,/^(?:-\\\\)/i,/^(?:-\/\/)/i,/^(?:\/\|-)/i,/^(?:\\\|-)/i,/^(?:\/\/-)/i,/^(?:\\\\-)/i,/^(?::(?:(?:no)?wrap)?[^#\n;]*)/i,/^(?::)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:\(\))/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[53,54],inclusive:!1},acc_descr:{rules:[51],inclusive:!1},acc_title:{rules:[49],inclusive:!1},ID:{rules:[2,3,7,11,12,13,14,15],inclusive:!1},ALIAS:{rules:[2,3,21,22],inclusive:!1},LINE:{rules:[2,3,34],inclusive:!1},CONFIG:{rules:[8,9,10],inclusive:!1},CONFIG_DATA:{rules:[],inclusive:!1},INITIAL:{rules:[0,1,3,4,5,6,16,17,18,19,20,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44,45,46,47,48,50,52,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93],inclusive:!0}}};return be})();Re.lexer=xe;function Oe(){this.yy={}}return o(Oe,"Parser"),Oe.prototype=Re,Re.Parser=Oe,new Oe})();nW.parser=nW;a6e=nW});var kTt,wTt,STt,jT,W6,aW=z(()=>{"use strict";Ut();Wx();St();T6();Ir();Ci();kTt={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25,AUTONUMBER:26,CRITICAL_START:27,CRITICAL_OPTION:28,CRITICAL_END:29,BREAK_START:30,BREAK_END:31,PAR_OVER_START:32,BIDIRECTIONAL_SOLID:33,BIDIRECTIONAL_DOTTED:34,SOLID_TOP:41,SOLID_BOTTOM:42,STICK_TOP:43,STICK_BOTTOM:44,SOLID_ARROW_TOP_REVERSE:45,SOLID_ARROW_BOTTOM_REVERSE:46,STICK_ARROW_TOP_REVERSE:47,STICK_ARROW_BOTTOM_REVERSE:48,SOLID_TOP_DOTTED:51,SOLID_BOTTOM_DOTTED:52,STICK_TOP_DOTTED:53,STICK_BOTTOM_DOTTED:54,SOLID_ARROW_TOP_REVERSE_DOTTED:55,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:56,STICK_ARROW_TOP_REVERSE_DOTTED:57,STICK_ARROW_BOTTOM_REVERSE_DOTTED:58,CENTRAL_CONNECTION:59,CENTRAL_CONNECTION_REVERSE:60,CENTRAL_CONNECTION_DUAL:61},wTt={FILLED:0,OPEN:1},STt={LEFTOF:0,RIGHTOF:1,OVER:2},jT={ACTOR:"actor",BOUNDARY:"boundary",COLLECTIONS:"collections",CONTROL:"control",DATABASE:"database",ENTITY:"entity",PARTICIPANT:"participant",QUEUE:"queue"},W6=class{constructor(){this.state=new wf(()=>({prevActor:void 0,actors:new Map,createdActors:new Map,destroyedActors:new Map,boxes:[],messages:[],notes:[],sequenceNumbersEnabled:!1,wrapEnabled:void 0,currentBox:void 0,lastCreated:void 0,lastDestroyed:void 0}));this.setAccTitle=Cr;this.setAccDescription=wr;this.setDiagramTitle=Ar;this.getAccTitle=kr;this.getAccDescription=Sr;this.getDiagramTitle=Er;this.apply=this.apply.bind(this),this.parseBoxData=this.parseBoxData.bind(this),this.parseMessage=this.parseMessage.bind(this),this.clear(),this.setWrap(ge().wrap),this.LINETYPE=kTt,this.ARROWTYPE=wTt,this.PLACEMENT=STt}static{o(this,"SequenceDB")}addBox(t){this.state.records.boxes.push({name:t.text,wrap:t.wrap??this.autoWrap(),fill:t.color,actorKeys:[]}),this.state.records.currentBox=this.state.records.boxes.slice(-1)[0]}addActor(t,r,i,n,a){let s=this.state.records.currentBox,l;if(a!==void 0){let h;a.includes(` +`)?h=a+` +`:h=`{ +`+a+` +}`,l=ld(h,{schema:od})}n=l?.type??n,l?.alias&&(!i||i.text===r)&&(i={text:l.alias,wrap:i?.wrap,type:n});let u=this.state.records.actors.get(t);if(u){if(this.state.records.currentBox&&u.box&&this.state.records.currentBox!==u.box)throw new Error(`A same participant should only be defined in one Box: ${u.name} can't be in '${u.box.name}' and in '${this.state.records.currentBox.name}' at the same time.`);if(s=u.box?u.box:this.state.records.currentBox,u.box=s,u&&r===u.name&&i==null)return}if(i?.text==null&&(i={text:r,type:n}),(n==null||i.text==null)&&(i={text:r,type:n}),this.state.records.actors.set(t,{box:s,name:r,description:i.text,wrap:i.wrap??this.autoWrap(),prevActor:this.state.records.prevActor,links:{},properties:{},actorCnt:null,rectData:null,type:n??"participant"}),this.state.records.prevActor){let h=this.state.records.actors.get(this.state.records.prevActor);h&&(h.nextActor=t)}this.state.records.currentBox&&this.state.records.currentBox.actorKeys.push(t),this.state.records.prevActor=t}activationCount(t){let r,i=0;if(!t)return 0;for(r=0;r>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},u}return this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:t,to:r,message:i?.text??"",wrap:i?.wrap??this.autoWrap(),type:n,activate:a,centralConnection:s??0}),!0}hasAtLeastOneBox(){return this.state.records.boxes.length>0}hasAtLeastOneBoxWithTitle(){return this.state.records.boxes.some(t=>t.name)}getMessages(){return this.state.records.messages}getBoxes(){return this.state.records.boxes}getActors(){return this.state.records.actors}getCreatedActors(){return this.state.records.createdActors}getDestroyedActors(){return this.state.records.destroyedActors}getActor(t){return this.state.records.actors.get(t)}getActorKeys(){return[...this.state.records.actors.keys()]}enableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!0}disableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!1}showSequenceNumbers(){return this.state.records.sequenceNumbersEnabled}setWrap(t){this.state.records.wrapEnabled=t}extractWrap(t){if(t===void 0)return{};t=t.trim();let r=/^:?wrap:/.exec(t)!==null?!0:/^:?nowrap:/.exec(t)!==null?!1:void 0;return{cleanedText:(r===void 0?t:t.replace(/^:?(?:no)?wrap:/,"")).trim(),wrap:r}}autoWrap(){return this.state.records.wrapEnabled!==void 0?this.state.records.wrapEnabled:ge().sequence?.wrap??!1}clear(){this.state.reset(),gr()}parseMessage(t){let r=t.trim(),{wrap:i,cleanedText:n}=this.extractWrap(r),a={text:n,wrap:i};return Z.debug(`parseMessage: ${JSON.stringify(a)}`),a}parseBoxData(t){let r=/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(t),i=r?.[1]?r[1].trim():"transparent",n=r?.[2]?r[2].trim():void 0;if(window?.CSS)window.CSS.supports("color",i)||(i="transparent",n=t.trim());else{let l=new Option().style;l.color=i,l.color!==i&&(i="transparent",n=t.trim())}let{wrap:a,cleanedText:s}=this.extractWrap(n);return{text:s?fr(s,ge()):void 0,color:i,wrap:a}}addNote(t,r,i){let n={actor:t,placement:r,message:i.text,wrap:i.wrap??this.autoWrap()},a=[].concat(t,t);this.state.records.notes.push(n),this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:a[0],to:a[1],message:i.text,wrap:i.wrap??this.autoWrap(),type:this.LINETYPE.NOTE,placement:r})}addLinks(t,r){let i=this.getActor(t);try{let n=fr(r.text,ge());n=n.replace(/=/g,"="),n=n.replace(/&/g,"&");let a=JSON.parse(n);this.insertLinks(i,a)}catch(n){Z.error("error while parsing actor link text",n)}}addALink(t,r){let i=this.getActor(t);try{let n={},a=fr(r.text,ge()),s=a.indexOf("@");a=a.replace(/=/g,"="),a=a.replace(/&/g,"&");let l=a.slice(0,s-1).trim(),u=a.slice(s+1).trim();n[l]=u,this.insertLinks(i,n)}catch(n){Z.error("error while parsing actor link text",n)}}insertLinks(t,r){if(t.links==null)t.links=r;else for(let i in r)t.links[i]=r[i]}addProperties(t,r){let i=this.getActor(t);try{let n=fr(r.text,ge()),a=JSON.parse(n);this.insertProperties(i,a)}catch(n){Z.error("error while parsing actor properties text",n)}}insertProperties(t,r){if(t.properties==null)t.properties=r;else for(let i in r)t.properties[i]=r[i]}boxEnd(){this.state.records.currentBox=void 0}addDetails(t,r){let i=this.getActor(t),n=document.getElementById(r.text);try{let a=n.innerHTML,s=JSON.parse(a);s.properties&&this.insertProperties(i,s.properties),s.links&&this.insertLinks(i,s.links)}catch(a){Z.error("error while parsing actor details text",a)}}getActorProperty(t,r){if(t?.properties!==void 0)return t.properties[r]}apply(t){if(Array.isArray(t))t.forEach(r=>{this.apply(r)});else switch(t.type){case"sequenceIndex":this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:void 0,to:void 0,message:{start:t.sequenceIndex,step:t.sequenceIndexStep,visible:t.sequenceVisible},wrap:!1,type:t.signalType});break;case"addParticipant":this.addActor(t.actor,t.actor,t.description,t.draw,t.config);break;case"createParticipant":if(this.state.records.actors.has(t.actor))throw new Error("It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior");this.state.records.lastCreated=t.actor,this.addActor(t.actor,t.actor,t.description,t.draw,t.config),this.state.records.createdActors.set(t.actor,this.state.records.messages.length);break;case"destroyParticipant":this.state.records.lastDestroyed=t.actor,this.state.records.destroyedActors.set(t.actor,this.state.records.messages.length);break;case"activeStart":this.addSignal(t.actor,void 0,void 0,t.signalType);break;case"centralConnection":this.addSignal(t.actor,void 0,void 0,t.signalType);break;case"centralConnectionReverse":this.addSignal(t.actor,void 0,void 0,t.signalType);break;case"activeEnd":this.addSignal(t.actor,void 0,void 0,t.signalType);break;case"addNote":this.addNote(t.actor,t.placement,t.text);break;case"addLinks":this.addLinks(t.actor,t.text);break;case"addALink":this.addALink(t.actor,t.text);break;case"addProperties":this.addProperties(t.actor,t.text);break;case"addDetails":this.addDetails(t.actor,t.text);break;case"addMessage":if(this.state.records.lastCreated){if(t.to!==this.state.records.lastCreated)throw new Error("The created participant "+this.state.records.lastCreated.name+" does not have an associated creating message after its declaration. Please check the sequence diagram.");this.state.records.lastCreated=void 0}else if(this.state.records.lastDestroyed){if(t.to!==this.state.records.lastDestroyed&&t.from!==this.state.records.lastDestroyed)throw new Error("The destroyed participant "+this.state.records.lastDestroyed.name+" does not have an associated destroying message after its declaration. Please check the sequence diagram.");this.state.records.lastDestroyed=void 0}this.addSignal(t.from,t.to,t.msg,t.signalType,t.activate,t.centralConnection);break;case"boxStart":this.addBox(t.boxData);break;case"boxEnd":this.boxEnd();break;case"loopStart":this.addSignal(void 0,void 0,t.loopText,t.signalType);break;case"loopEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"rectStart":this.addSignal(void 0,void 0,t.color,t.signalType);break;case"rectEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"optStart":this.addSignal(void 0,void 0,t.optText,t.signalType);break;case"optEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"altStart":this.addSignal(void 0,void 0,t.altText,t.signalType);break;case"else":this.addSignal(void 0,void 0,t.altText,t.signalType);break;case"altEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"setAccTitle":Cr(t.text);break;case"parStart":this.addSignal(void 0,void 0,t.parText,t.signalType);break;case"and":this.addSignal(void 0,void 0,t.parText,t.signalType);break;case"parEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"criticalStart":this.addSignal(void 0,void 0,t.criticalText,t.signalType);break;case"option":this.addSignal(void 0,void 0,t.optionText,t.signalType);break;case"criticalEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"breakStart":this.addSignal(void 0,void 0,t.breakText,t.signalType);break;case"breakEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break}}getConfig(){return ge().sequence}}});var ETt,o6e,l6e=z(()=>{"use strict";Ut();ETt=o(e=>{let t=e.dropShadow??"none",{look:r}=ge();return`.actor { + stroke: ${e.actorBorder}; + fill: ${e.actorBkg}; + stroke-width: ${e.strokeWidth??1}; + } + + rect.actor.outer-path[data-look="neo"] { + filter: ${t}; + } + + rect.note[data-look="neo"] { + stroke:${e.noteBorderColor}; + fill:${e.noteBkgColor}; + filter: ${t}; + } + + text.actor > tspan { + fill: ${e.actorTextColor}; + stroke: none; + } + + .actor-line { + stroke: ${e.actorLineColor}; + } + + .innerArc { + stroke-width: 1.5; + stroke-dasharray: none; + } + + .messageLine0 { + stroke-width: 1.5; + stroke-dasharray: none; + stroke: ${e.signalColor}; + } + + .messageLine1 { + stroke-width: 1.5; + stroke-dasharray: 2, 2; + stroke: ${e.signalColor}; + } + + [id$="-arrowhead"] path { + fill: ${e.signalColor}; + stroke: ${e.signalColor}; + } + + .sequenceNumber { + fill: ${e.sequenceNumberColor}; + } + + [id$="-sequencenumber"] { + fill: ${e.signalColor}; + } + + [id$="-crosshead"] path { + fill: ${e.signalColor}; + stroke: ${e.signalColor}; + } + + .messageText { + fill: ${e.signalTextColor}; + stroke: none; + } + + .labelBox { + stroke: ${e.labelBoxBorderColor}; + fill: ${e.labelBoxBkgColor}; + filter: ${r==="neo"?t:"none"}; + } + + .labelText, .labelText > tspan { + fill: ${e.labelTextColor}; + stroke: none; + } + + .loopText, .loopText > tspan { + fill: ${e.loopTextColor}; + stroke: none; + } + + .sectionTitle, .sectionTitle > tspan { + fill: ${e.loopTextColor}; + stroke: none; + } + + .loopLine { + stroke-width: 2px; + stroke-dasharray: 2, 2; + stroke: ${e.labelBoxBorderColor}; + fill: ${e.labelBoxBorderColor}; + } + + .note { + //stroke: #decc93; + stroke: ${e.noteBorderColor}; + fill: ${e.noteBkgColor}; + } + + .noteText, .noteText > tspan { + fill: ${e.noteTextColor}; + stroke: none; + ${e.noteFontWeight?`font-weight: ${e.noteFontWeight};`:""} + } + + .activation0 { + fill: ${e.activationBkgColor}; + stroke: ${e.activationBorderColor}; + } + + .activation1 { + fill: ${e.activationBkgColor}; + stroke: ${e.activationBorderColor}; + } + + .activation2 { + fill: ${e.activationBkgColor}; + stroke: ${e.activationBorderColor}; + } + + .actorPopupMenu { + position: absolute; + } + + .actorPopupMenuPanel { + position: absolute; + fill: ${e.actorBkg}; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4)); +} + .actor-man circle, line { + fill: ${e.actorBkg}; + stroke-width: 2px; + } + + g rect.rect { + filter: ${t}; + stroke: ${e.nodeBorder}; + } +`},"getStyles"),o6e=ETt});var sW,Af,_f,Df,q6,mm,Sh,XT,ATt,U6,KT,gm,c6e,Wr,oW,_Tt,DTt,RTt,LTt,MTt,NTt,ITt,OTt,PTt,BTt,FTt,$Tt,zTt,u6e,GTt,VTt,WTt,qTt,UTt,HTt,YTt,jTt,h6e,XTt,Eh,KTt,ZTt,QTt,JTt,eCt,Ei,d6e=z(()=>{"use strict";sW=ys(fg(),1);br();Xt();Ir();gp();Af=36,_f="actor-top",Df="actor-bottom",q6="actor-box",mm="actor-man",Sh=new Set(["redux-color","redux-dark-color"]),XT=o(function(e,t){let r=mp(e,t);return Nt().look==="neo"&&r.attr("data-look","neo"),r},"drawRect"),ATt=o(function(e,t,r,i,n){if(t.links===void 0||t.links===null||Object.keys(t.links).length===0)return{height:0,width:0};let a=t.links,s=t.actorCnt,l=t.rectData;var u="none";n&&(u="block !important");let h=e.append("g");h.attr("id","actor"+s+"_popup"),h.attr("class","actorPopupMenu"),h.attr("display",u);var d="";l.class!==void 0&&(d=" "+l.class);let f=l.width>r?l.width:r,p=h.append("rect");if(p.attr("class","actorPopupMenuPanel"+d),p.attr("x",l.x),p.attr("y",l.height),p.attr("fill",l.fill),p.attr("stroke",l.stroke),p.attr("width",f),p.attr("height",l.height),p.attr("rx",l.rx),p.attr("ry",l.ry),a!=null){var m=20;for(let v in a){var g=h.append("a"),y=(0,sW.sanitizeUrl)(a[v]);g.attr("xlink:href",y),g.attr("target","_blank"),KTt(i)(v,g,l.x+10,l.height+m,f,20,{class:"actor"},i),m+=30}}return p.attr("height",m),{height:l.height+m,width:f}},"drawPopup"),U6=o(function(e){return"var pu = document.getElementById('"+e+"'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }"},"popupMenuToggle"),KT=o(async function(e,t,r=null){let i=e.append("foreignObject"),n=await Fm(t.text,Nt()),s=i.append("xhtml:div").attr("style","width: fit-content;").attr("xmlns","http://www.w3.org/1999/xhtml").html(n).node().getBoundingClientRect();if(i.attr("height",Math.round(s.height)).attr("width",Math.round(s.width)),t.class==="noteText"){let l=e.node().firstChild;l.setAttribute("height",s.height+2*t.textMargin);let u=l.getBBox();i.attr("x",Math.round(u.x+u.width/2-s.width/2)).attr("y",Math.round(u.y+u.height/2-s.height/2))}else if(r){let{startx:l,stopx:u,starty:h}=r;if(l>u){let d=l;l=u,u=d}i.attr("x",Math.round(l+Math.abs(l-u)/2-s.width/2)),t.class==="loopText"?i.attr("y",Math.round(h)):i.attr("y",Math.round(h-s.height))}return[i]},"drawKatex"),gm=o(function(e,t){let r=0,i=0,n=t.text.split(vt.lineBreakRegex),[a,s]=Za(t.fontSize),l=[],u=0,h=o(()=>t.y,"yfunc");if(t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0)switch(t.valign){case"top":case"start":h=o(()=>Math.round(t.y+t.textMargin),"yfunc");break;case"middle":case"center":h=o(()=>Math.round(t.y+(r+i+t.textMargin)/2),"yfunc");break;case"bottom":case"end":h=o(()=>Math.round(t.y+(r+i+2*t.textMargin)-t.textMargin),"yfunc");break}if(t.anchor!==void 0&&t.textMargin!==void 0&&t.width!==void 0)switch(t.anchor){case"left":case"start":t.x=Math.round(t.x+t.textMargin),t.anchor="start",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"middle":case"center":t.x=Math.round(t.x+t.width/2),t.anchor="middle",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"right":case"end":t.x=Math.round(t.x+t.width-t.textMargin),t.anchor="end",t.dominantBaseline="middle",t.alignmentBaseline="middle";break}for(let[d,f]of n.entries()){t.textMargin!==void 0&&t.textMargin===0&&a!==void 0&&(u=d*a);let p=e.append("text");p.attr("x",t.x),p.attr("y",h()),t.anchor!==void 0&&p.attr("text-anchor",t.anchor).attr("dominant-baseline",t.dominantBaseline).attr("alignment-baseline",t.alignmentBaseline),t.fontFamily!==void 0&&p.style("font-family",t.fontFamily),s!==void 0&&p.style("font-size",s),t.fontWeight!==void 0&&p.style("font-weight",t.fontWeight),t.fill!==void 0&&p.attr("fill",t.fill),t.class!==void 0&&p.attr("class",t.class),t.dy!==void 0?p.attr("dy",t.dy):u!==0&&p.attr("dy",u);let m=f||SM;if(t.tspan){let g=p.append("tspan");g.attr("x",t.x),t.fill!==void 0&&g.attr("fill",t.fill),g.text(m)}else p.text(m);t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0&&(i+=(p._groups||p)[0][0].getBBox().height,r=i),l.push(p)}return l},"drawText"),c6e=o(function(e,t){function r(n,a,s,l,u){return n+","+a+" "+(n+s)+","+a+" "+(n+s)+","+(a+l-u)+" "+(n+s-u*1.2)+","+(a+l)+" "+n+","+(a+l)}o(r,"genPoints");let i=e.append("polygon");return i.attr("points",r(t.x,t.y,t.width,t.height,7)),i.attr("class","labelBox"),t.y=t.y+t.height/2,gm(e,t),i},"drawLabel"),Wr=-1,oW=o((e,t,r,i)=>{e.select&&r.forEach(n=>{let a=t.get(n),s=e.select("#actor"+a.actorCnt);!i.mirrorActors&&a.stopy?s.attr("y2",a.stopy+a.height/2):i.mirrorActors&&s.attr("y2",a.stopy)})},"fixLifeLineHeights"),_Tt=o(function(e,t,r,i,n){let a=i?t.stopy:t.starty,s=t.x+t.width/2,l=a+t.height,{look:u,theme:h,themeVariables:d}=r,{bkgColorArray:f,borderColorArray:p}=d,m=e.append("g").lower();var g=m;i||(Wr++,Object.keys(t.links||{}).length&&!r.forceMenus&&g.attr("onclick",U6(`actor${Wr}_popup`)).attr("cursor","pointer"),g.append("line").attr("id","actor"+Wr).attr("x1",s).attr("y1",l).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),g=m.append("g"),t.actorCnt=Wr,t.links!=null&&g.attr("id","root-"+Wr),u==="neo"&&g.attr("data-look","neo"));let y=fa();var v="actor";t.properties?.class?v=t.properties.class:y.fill="#eaeaea",i?v+=` ${Df}`:v+=` ${_f}`,y.x=t.x,y.y=a,y.width=t.width,y.height=t.height,y.class=v,y.rx=3,y.ry=3,y.name=t.name,u==="neo"&&(y.rx=6,y.ry=6);let x=XT(g,y),b=n.get(t.name)??0;if(Sh.has(h)&&(x.style("stroke",p[b%p.length]),x.style("fill",f[b%p.length])),u==="neo"&&x.attr("filter","url(#drop-shadow)"),t.rectData=y,t.properties?.icon){let w=t.properties.icon.trim();w.charAt(0)==="@"?$w(g,y.x+y.width-20,y.y+10,w.substr(1)):Fw(g,y.x+y.width-20,y.y+10,w)}i||(g.attr("data-et","participant"),g.attr("data-type","participant"),g.attr("data-id",t.name)),Eh(r,Bi(t.description))(t.description,g,y.x,y.y,y.width,y.height,{class:`actor ${q6}`},r);let T=t.height;if(x.node){let w=x.node().getBBox();t.height=w.height,T=w.height}return T},"drawActorTypeParticipant"),DTt=o(function(e,t,r,i,n){let a=i?t.stopy:t.starty,s=t.x+t.width/2,l=a+t.height,{look:u,theme:h,themeVariables:d}=r,{bkgColorArray:f,borderColorArray:p}=d,m=e.append("g").lower();var g=m;i||(Wr++,Object.keys(t.links||{}).length&&!r.forceMenus&&g.attr("onclick",U6(`actor${Wr}_popup`)).attr("cursor","pointer"),g.append("line").attr("id","actor"+Wr).attr("x1",s).attr("y1",l).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),g=m.append("g"),t.actorCnt=Wr,t.links!=null&&g.attr("id","root-"+Wr),u==="neo"&&g.attr("data-look","neo"));let y=fa();var v="actor";t.properties?.class?v=t.properties.class:y.fill="#eaeaea",i?v+=` ${Df}`:v+=` ${_f}`,y.x=t.x,y.y=a,y.width=t.width,y.height=t.height,y.class=v,y.name=t.name;let x=6,b={...y,x:y.x+-x,y:y.y+ +x,class:"actor"},T=XT(g,y),w=XT(g,b);t.rectData=y,u==="neo"&&g.attr("filter","url(#drop-shadow)");let C=n.get(t.name)??0;if(Sh.has(h)&&(T.style("stroke",p[C%p.length]),T.style("fill",f[C%p.length]),w.style("stroke",p[C%p.length]),w.style("fill",f[C%p.length])),t.properties?.icon){let E=t.properties.icon.trim();E.charAt(0)==="@"?$w(g,y.x+y.width-20,y.y+10,E.substr(1)):Fw(g,y.x+y.width-20,y.y+10,E)}Eh(r,Bi(t.description))(t.description,g,y.x-x,y.y+x,y.width,y.height,{class:`actor ${q6}`},r);let k=t.height;if(T.node){let E=T.node().getBBox();t.height=E.height,k=E.height}return i||(g.attr("data-et","participant"),g.attr("data-type","collections"),g.attr("data-id",t.name)),k},"drawActorTypeCollections"),RTt=o(function(e,t,r,i,n){let a=i?t.stopy:t.starty,s=t.x+t.width/2,l=a+t.height,{look:u,theme:h,themeVariables:d}=r,{bkgColorArray:f,borderColorArray:p}=d,m=e.append("g").lower(),g=m;i||(Wr++,Object.keys(t.links||{}).length&&!r.forceMenus&&g.attr("onclick",U6(`actor${Wr}_popup`)).attr("cursor","pointer"),g.append("line").attr("id","actor"+Wr).attr("x1",s).attr("y1",l).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),g=m.append("g"),t.actorCnt=Wr,t.links!=null&&g.attr("id","root-"+Wr),u==="neo"&&g.attr("data-look","neo"));let y=fa(),v="actor";t.properties?.class?v=t.properties.class:y.fill="#eaeaea",i?v+=` ${Df}`:v+=` ${_f}`,g.attr("class",v),y.x=t.x,y.y=a,y.width=t.width,y.height=t.height,y.name=t.name;let x=y.height/2,b=x/(2.5+y.height/50),T=g.append("g"),w=g.append("g"),C=`M ${y.x},${y.y+x} + a ${b},${x} 0 0 0 0,${y.height} + h ${y.width-2*b} + a ${b},${x} 0 0 0 0,-${y.height} + Z + `;T.append("path").attr("d",C),w.append("path").attr("d",`M ${y.x},${y.y+x} + a ${b},${x} 0 0 0 0,${y.height}`),T.attr("transform",`translate(${b}, ${-(y.height/2)})`),w.attr("transform",`translate(${y.width-b}, ${-y.height/2})`),t.rectData=y,u==="neo"&&T.attr("filter","url(#drop-shadow)");let k=n.get(t.name)??0;if(Sh.has(h)&&(T.style("stroke",p[k%p.length]),T.style("fill",f[k%p.length]),w.style("stroke",p[k%p.length]),w.style("fill",f[k%p.length])),t.properties?.icon){let N=t.properties.icon.trim(),P=y.x+y.width-20,I=y.y+10;N.charAt(0)==="@"?$w(g,P,I,N.substr(1)):Fw(g,P,I,N)}Eh(r,Bi(t.description))(t.description,g,y.x,y.y,y.width,y.height,{class:`actor ${q6}`},r);let E=t.height,A=T.select("path:last-child");if(A.node()){let N=A.node().getBBox();t.height=N.height,E=N.height}return i||(g.attr("data-et","participant"),g.attr("data-type","queue"),g.attr("data-id",t.name)),E},"drawActorTypeQueue"),LTt=o(function(e,t,r,i,n,a){let s=i?t.stopy:t.starty,l=t.x+t.width/2,u=s+75,{look:h,theme:d,themeVariables:f}=r,{bkgColorArray:p,borderColorArray:m,actorBorder:g,actorBkg:y}=f,v=e.append("g").lower();i||(Wr++,v.append("line").attr("id","actor"+Wr).attr("x1",l).attr("y1",u).attr("x2",l).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Wr);let x=e.append("g"),b=mm;i?b+=` ${Df}`:b+=` ${_f}`,x.attr("class",b),x.attr("name",t.name);let T=fa();T.x=t.x,T.y=s,T.fill="#eaeaea",T.width=t.width,T.height=t.height,T.class="actor";let w=t.x+t.width/2,C=s+32,k=22;x.append("defs").append("marker").attr("id",n+"-filled-head-control").attr("refX",11).attr("refY",5.8).attr("markerWidth",20).attr("markerHeight",28).attr("orient","172.5").attr("stroke-width",1.2).append("path").attr("d","M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z"),x.append("circle").attr("cx",w).attr("cy",C).attr("r",k).attr("filter",`${h==="neo"?"url(#drop-shadow)":""}`),x.append("line").attr("marker-end","url(#"+n+"-filled-head-control)").attr("transform",`translate(${w}, ${C-k})`);let E=a.get(t.name)??0;Sh.has(d)?(x.style("stroke",m[E%m.length]),x.style("fill",p[E%m.length])):(x.style("stroke",g),x.style("fill",y));let A=x.node().getBBox();return t.height=A.height+2*(r?.sequence?.labelBoxHeight??0),Eh(r,Bi(t.description))(t.description,x,T.x,T.y+k+(i?5:12),T.width,T.height,{class:`actor ${mm}`},r),i||(x.attr("data-et","participant"),x.attr("data-type","control"),x.attr("data-id",t.name)),t.height},"drawActorTypeControl"),MTt=o(function(e,t,r,i,n){let a=i?t.stopy:t.starty,s=t.x+t.width/2,l=a+75,{look:u,theme:h,themeVariables:d}=r,{bkgColorArray:f,borderColorArray:p}=d,m=e.append("g").lower(),g=e.append("g"),y="actor";i?y+=` ${Df}`:y+=` ${_f}`,g.attr("class",y),g.attr("name",t.name);let v=fa();v.x=t.x,v.y=a,v.fill="#eaeaea",v.width=t.width,v.height=t.height,v.class="actor";let x=t.x+t.width/2,b=a+(i?10:25),T=22;g.append("circle").attr("cx",x).attr("cy",b).attr("r",T).attr("width",t.width).attr("height",t.height),g.append("line").attr("x1",x-T).attr("x2",x+T).attr("y1",b+T).attr("y2",b+T).attr("stroke-width",2),u==="neo"&&g.attr("filter","url(#drop-shadow)");let w=n.get(t.name)??0;Sh.has(h)&&(g.style("stroke",p[w%p.length]),g.style("fill",f[w%p.length]));let C=g.node().getBBox();return t.height=C.height+(r?.sequence?.labelBoxHeight??0),i||(Wr++,m.append("line").attr("id","actor"+Wr).attr("x1",s).attr("y1",l).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Wr),Eh(r,Bi(t.description))(t.description,g,v.x,v.y+(i?15:30),v.width,v.height,{class:`actor ${mm}`},r),i?g.attr("transform",`translate(0, ${T})`):(g.attr("transform",`translate(0, ${T/2-5})`),g.attr("data-et","participant"),g.attr("data-type","entity"),g.attr("data-id",t.name)),t.height},"drawActorTypeEntity"),NTt=o(function(e,t,r,i,n){let a=i?t.stopy:t.starty,s=t.x+t.width/2,l=a+t.height+2*r.boxTextMargin,{theme:u,themeVariables:h,look:d}=r,{bkgColorArray:f,borderColorArray:p,actorBorder:m}=h,g=e.append("g").lower(),y=g;i||(Wr++,Object.keys(t.links||{}).length&&!r.forceMenus&&y.attr("onclick",U6(`actor${Wr}_popup`)).attr("cursor","pointer"),y.append("line").attr("id","actor"+Wr).attr("x1",s).attr("y1",l).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),y=g.append("g"),t.actorCnt=Wr,t.links!=null&&y.attr("id","root-"+Wr),d==="neo"&&y.attr("data-look","neo"));let v=fa(),x="actor";t.properties?.class?x=t.properties.class:v.fill="#eaeaea",i?x+=` ${Df}`:x+=` ${_f}`,v.x=t.x,v.y=a,v.width=t.width,v.height=t.height,v.class=x,v.name=t.name,v.x=t.x,v.y=a;let b=v.width/3,T=v.width/3,w=b/2,C=w/(2.5+b/50),k=y.append("g");k.attr("class",x);let E=` + M ${v.x},${v.y+C} + a ${w},${C} 0 0 0 ${b},0 + a ${w},${C} 0 0 0 -${b},0 + l 0,${T-2*C} + a ${w},${C} 0 0 0 ${b},0 + l 0,-${T-2*C} +`;k.append("path").attr("d",E),d==="neo"&&k.attr("filter","url(#drop-shadow)");let A=n.get(t.name)??0;Sh.has(u)?(k.style("stroke",p[A%p.length]),k.style("fill",f[A%p.length])):k.style("stroke",m),k.attr("transform",`translate(${b}, ${C})`),t.rectData=v,Eh(r,Bi(t.description))(t.description,y,v.x,v.y+35,v.width,v.height,{class:`actor ${q6}`},r);let N=k.select("path:last-child");if(N.node()){let P=N.node().getBBox();t.height=P.height+(r.sequence.labelBoxHeight??0)}return i||(y.attr("data-et","participant"),y.attr("data-type","database"),y.attr("data-id",t.name)),t.height},"drawActorTypeDatabase"),ITt=o(function(e,t,r,i,n){let a=i?t.stopy:t.starty,s=t.x+t.width/2,l=a+80,u=22,h=e.append("g").lower(),{look:d,theme:f,themeVariables:p}=r,{bkgColorArray:m,borderColorArray:g,actorBorder:y}=p;i||(Wr++,h.append("line").attr("id","actor"+Wr).attr("x1",s).attr("y1",l).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Wr);let v=e.append("g"),x=mm;i?x+=` ${Df}`:x+=` ${_f}`,v.attr("class",x),v.attr("name",t.name);let b=fa();b.x=t.x,b.y=a,b.fill="#eaeaea",b.width=t.width,b.height=t.height,b.class="actor",v.append("line").attr("id","actor-man-torso"+Wr).attr("x1",t.x+t.width/2-u*2.5).attr("y1",a+12).attr("x2",t.x+t.width/2-15).attr("y2",a+12),v.append("line").attr("id","actor-man-arms"+Wr).attr("x1",t.x+t.width/2-u*2.5).attr("y1",a+2).attr("x2",t.x+t.width/2-u*2.5).attr("y2",a+22),v.append("circle").attr("cx",t.x+t.width/2).attr("cy",a+12).attr("r",u),d==="neo"&&v.attr("filter","url(#drop-shadow)");let T=n.get(t.name)??0;Sh.has(f)?(v.style("stroke",g[T%g.length]),v.style("fill",m[T%g.length])):v.style("stroke",y);let w=v.node().getBBox();return t.height=w.height+(r.sequence.labelBoxHeight??0),Eh(r,Bi(t.description))(t.description,v,b.x,b.y+15,b.width,b.height,{class:`actor ${mm}`},r),v.attr("transform",`translate(0,${u/2+10})`),i||(v.attr("data-et","participant"),v.attr("data-type","boundary"),v.attr("data-id",t.name)),t.height},"drawActorTypeBoundary"),OTt=o(function(e,t,r,i,n){let a=i?t.stopy:t.starty,s=t.x+t.width/2,l=a+80,{look:u,theme:h,themeVariables:d}=r,{bkgColorArray:f,borderColorArray:p,actorBorder:m}=d,g=e.append("g").lower();i||(Wr++,g.append("line").attr("id","actor"+Wr).attr("x1",s).attr("y1",l).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name).attr("data-et","life-line").attr("data-id",t.name),t.actorCnt=Wr);let y=e.append("g"),v=mm;i?v+=` ${Df}`:v+=` ${_f}`,y.attr("class",v),y.attr("name",t.name),i||y.attr("data-et","participant").attr("data-type","actor").attr("data-id",t.name);let x=u==="neo"?.5:1,b=u==="neo"?a+(1-x)*30:a;y.append("line").attr("id","actor-man-torso"+Wr).attr("x1",s).attr("y1",b+25*x).attr("x2",s).attr("y2",b+45*x),y.append("line").attr("id","actor-man-arms"+Wr).attr("x1",s-Af/2*x).attr("y1",b+33*x).attr("x2",s+Af/2*x).attr("y2",b+33*x),y.append("line").attr("x1",s-Af/2*x).attr("y1",b+60*x).attr("x2",s).attr("y2",b+45*x),y.append("line").attr("x1",s).attr("y1",b+45*x).attr("x2",s+(Af/2-2)*x).attr("y2",b+60*x);let T=y.append("circle");T.attr("cx",t.x+t.width/2),T.attr("cy",b+10*x),T.attr("r",15*x),T.attr("width",t.width*x),T.attr("height",t.height*x);let w=y.node().getBBox();t.height=w.height;let C=fa();C.x=t.x,C.y=b,C.fill="#eaeaea",C.width=t.width,C.height=t.height/x,C.class="actor",C.rx=3,C.ry=3;let k=n.get(t.name)??0;return Sh.has(h)?(y.style("stroke",p[k%p.length]),y.style("fill",f[k%p.length])):y.style("stroke",m),Eh(r,Bi(t.description))(t.description,y,C.x,b+35*x-(u==="neo"?10:0),C.width,C.height,{class:`actor ${mm}`},r),t.height},"drawActorTypeActor"),PTt=o(async function(e,t,r,i,n,a,s){let l=s??new Map([...a.db.getActors().values()].map((u,h)=>[u.name,h]));switch(t.type){case"actor":return await OTt(e,t,r,i,l);case"participant":return await _Tt(e,t,r,i,l);case"boundary":return await ITt(e,t,r,i,l);case"control":return await LTt(e,t,r,i,n,l);case"entity":return await MTt(e,t,r,i,l);case"database":return await NTt(e,t,r,i,l);case"collections":return await DTt(e,t,r,i,l);case"queue":return await RTt(e,t,r,i,l)}},"drawActor"),BTt=o(function(e,t,r){let n=e.append("g");u6e(n,t),t.name&&Eh(r)(t.name,n,t.x,t.y+r.boxTextMargin+(t.textMaxHeight||0)/2,t.width,0,{class:"text"},r),n.lower()},"drawBox"),FTt=o(function(e){return e.append("g")},"anchorElement"),$Tt=o(function(e,t,r,i,n,a,s){let{theme:l,themeVariables:u}=i,{bkgColorArray:h,borderColorArray:d,mainBkg:f}=u,p=fa(),m=t.anchored,g=t.actor;p.x=t.startx,p.y=t.starty,p.class="activation"+n%3,p.width=t.stopx-t.startx,p.height=r-t.starty;let y=XT(m,p),x=(s??new Map([...a.db.getActors().values()].map((b,T)=>[b.name,T]))).get(g)??0;Sh.has(l)&&(y.style("stroke",d[x%d.length]),y.style("fill",h[x%d.length]??f))},"drawActivation"),zTt=o(async function(e,t,r,i,n){let{boxMargin:a,boxTextMargin:s,labelBoxHeight:l,labelBoxWidth:u,messageFontFamily:h,messageFontSize:d,messageFontWeight:f}=i,p=e.append("g").attr("data-et","control-structure").attr("data-id","i"+n.id),m=o(function(v,x,b,T){return p.append("line").attr("x1",v).attr("y1",x).attr("x2",b).attr("y2",T).attr("class","loopLine")},"drawLoopLine");m(t.startx,t.starty,t.stopx,t.starty),m(t.stopx,t.starty,t.stopx,t.stopy),m(t.startx,t.stopy,t.stopx,t.stopy),m(t.startx,t.starty,t.startx,t.stopy),t.sections!==void 0&&t.sections.forEach(function(v){m(t.startx,v.y,t.stopx,v.y).style("stroke-dasharray","3, 3")});let g=wx();g.text=r,g.x=t.startx,g.y=t.starty,g.fontFamily=h,g.fontSize=d,g.fontWeight=f,g.anchor="middle",g.valign="middle",g.tspan=!1,g.width=Math.max(u??0,50),g.height=l+(i.look==="neo"?15:0)||20,g.textMargin=s,g.class="labelText",c6e(p,g),g=h6e(),g.text=t.title,g.x=t.startx+u/2+(t.stopx-t.startx)/2,g.y=t.starty+a+s,g.anchor="middle",g.valign="middle",g.textMargin=s,g.class="loopText",g.fontFamily=h,g.fontSize=d,g.fontWeight=f,g.wrap=!0;let y=Bi(g.text)?await KT(p,g,t):gm(p,g);if(t.sectionTitles!==void 0){for(let[v,x]of Object.entries(t.sectionTitles))if(x.message){g.text=x.message,g.x=t.startx+(t.stopx-t.startx)/2,g.y=t.sections[v].y+a+s,g.class="sectionTitle",g.anchor="middle",g.valign="middle",g.tspan=!1,g.fontFamily=h,g.fontSize=d,g.fontWeight=f,g.wrap=t.wrap,Bi(g.text)?(t.starty=t.sections[v].y,await KT(p,g,t)):gm(p,g);let b=Math.round(y.map(T=>(T._groups||T)[0][0].getBBox().height).reduce((T,w)=>T+w));t.sections[v].height+=b-(a+s)}}return t.height=Math.round(t.stopy-t.starty),p},"drawLoop"),u6e=o(function(e,t){Bw(e,t)},"drawBackgroundRect"),GTt=o(function(e,t){e.append("defs").append("symbol").attr("id",t+"-database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),VTt=o(function(e,t){e.append("defs").append("symbol").attr("id",t+"-computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),WTt=o(function(e,t){e.append("defs").append("symbol").attr("id",t+"-clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),qTt=o(function(e,t){e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",7.9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto-start-reverse").append("path").attr("d","M -1 0 L 10 5 L 0 10 z")},"insertArrowHead"),UTt=o(function(e,t){e.append("defs").append("marker").attr("id",t+"-filled-head").attr("refX",15.5).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),HTt=o(function(e,t){e.append("defs").append("marker").attr("id",t+"-sequencenumber").attr("refX",15).attr("refY",15).attr("markerWidth",60).attr("markerHeight",40).attr("orient","auto").append("circle").attr("cx",15).attr("cy",15).attr("r",6)},"insertSequenceNumber"),YTt=o(function(e,t){e.append("defs").append("marker").attr("id",t+"-crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",4).attr("refY",4.5).append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1pt").attr("d","M 1,2 L 6,7 M 6,2 L 1,7")},"insertArrowCrossHead"),jTt=o(function(e,t){let{theme:r}=t;e.append("defs").append("filter").attr("id","drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${r==="redux"||r==="redux-color"?"#000000":"#FFFFFF"}`)},"insertDropShadow"),h6e=o(function(){return{x:0,y:0,fill:void 0,anchor:void 0,style:"#666",width:void 0,height:void 0,textMargin:0,rx:0,ry:0,tspan:!0,valign:void 0}},"getTextObj"),XTt=o(function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Eh=(function(){function e(a,s,l,u,h,d,f){let p=s.append("text").attr("x",l+h/2).attr("y",u+d/2+5).style("text-anchor","middle").text(a);n(p,f)}o(e,"byText");function t(a,s,l,u,h,d,f,p){let{actorFontSize:m,actorFontFamily:g,actorFontWeight:y}=p,[v,x]=Za(m),b=a.split(vt.lineBreakRegex);for(let T=0;T{let s=ym(We),l=a.actorKeys.reduce((f,p)=>f+=e.get(p).width+(e.get(p).margin||0),0),u=We.boxMargin*8;l+=u,l-=2*We.boxTextMargin,a.wrap&&(a.name=Zt.wrapLabel(a.name,l-2*We.wrapPadding,s));let h=Zt.calculateTextDimensions(a.name,s);n=vt.getMax(h.height,n);let d=vt.getMax(l,h.width+2*We.wrapPadding);if(a.margin=We.boxTextMargin,la.textMaxHeight=n),vt.getMax(i,We.height)}var We,bt,tCt,f6e,ym,Ty,cW,iCt,nCt,uW,m6e,g6e,H6,p6e,sCt,lCt,uCt,hCt,dCt,lW,fCt,y6e,pCt,mCt,gCt,v6e,x6e=z(()=>{"use strict";Rr();d6e();St();Ir();Ir();gp();Ut();Dm();Xt();Di();aW();We={},bt={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],activations:[],models:{getHeight:o(function(){return Math.max.apply(null,this.actors.length===0?[0]:this.actors.map(e=>e.height||0))+(this.loops.length===0?0:this.loops.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.messages.length===0?0:this.messages.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.notes.length===0?0:this.notes.map(e=>e.height||0).reduce((e,t)=>e+t))},"getHeight"),clear:o(function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},"clear"),addBox:o(function(e){this.boxes.push(e)},"addBox"),addActor:o(function(e){this.actors.push(e)},"addActor"),addLoop:o(function(e){this.loops.push(e)},"addLoop"),addMessage:o(function(e){this.messages.push(e)},"addMessage"),addNote:o(function(e){this.notes.push(e)},"addNote"),lastActor:o(function(){return this.actors[this.actors.length-1]},"lastActor"),lastLoop:o(function(){return this.loops[this.loops.length-1]},"lastLoop"),lastMessage:o(function(){return this.messages[this.messages.length-1]},"lastMessage"),lastNote:o(function(){return this.notes[this.notes.length-1]},"lastNote"),actors:[],boxes:[],loops:[],messages:[],notes:[]},init:o(function(){this.sequenceItems=[],this.activations=[],this.models.clear(),this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0,g6e(ge())},"init"),updateVal:o(function(e,t,r,i){e[t]===void 0?e[t]=r:e[t]=i(r,e[t])},"updateVal"),updateBounds:o(function(e,t,r,i){let n=this,a=0;function s(l){return o(function(h){a++;let d=n.sequenceItems.length-a+1;n.updateVal(h,"starty",t-d*We.boxMargin,Math.min),n.updateVal(h,"stopy",i+d*We.boxMargin,Math.max),n.updateVal(bt.data,"startx",e-d*We.boxMargin,Math.min),n.updateVal(bt.data,"stopx",r+d*We.boxMargin,Math.max),l!=="activation"&&(n.updateVal(h,"startx",e-d*We.boxMargin,Math.min),n.updateVal(h,"stopx",r+d*We.boxMargin,Math.max),n.updateVal(bt.data,"starty",t-d*We.boxMargin,Math.min),n.updateVal(bt.data,"stopy",i+d*We.boxMargin,Math.max))},"updateItemBounds")}o(s,"updateFn"),this.sequenceItems.forEach(s()),this.activations.forEach(s("activation"))},"updateBounds"),insert:o(function(e,t,r,i){let n=vt.getMin(e,r),a=vt.getMax(e,r),s=vt.getMin(t,i),l=vt.getMax(t,i);this.updateVal(bt.data,"startx",n,Math.min),this.updateVal(bt.data,"starty",s,Math.min),this.updateVal(bt.data,"stopx",a,Math.max),this.updateVal(bt.data,"stopy",l,Math.max),this.updateBounds(n,s,a,l)},"insert"),newActivation:o(function(e,t,r){let i=r.get(e.from),n=H6(e.from).length||0,a=i.x+i.width/2+(n-1)*We.activationWidth/2;this.activations.push({startx:a,starty:this.verticalPos+2,stopx:a+We.activationWidth,stopy:void 0,actor:e.from,anchored:Ei.anchorElement(t)})},"newActivation"),endActivation:o(function(e){let t=this.activations.map(function(r){return r.actor}).lastIndexOf(e.from);return this.activations.splice(t,1)[0]},"endActivation"),createLoop:o(function(e={message:void 0,wrap:!1,width:void 0},t){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:e.message,wrap:e.wrap,width:e.width,height:0,fill:t}},"createLoop"),newLoop:o(function(e={message:void 0,wrap:!1,width:void 0},t){this.sequenceItems.push(this.createLoop(e,t))},"newLoop"),endLoop:o(function(){return this.sequenceItems.pop()},"endLoop"),isLoopOverlap:o(function(){return this.sequenceItems.length?this.sequenceItems[this.sequenceItems.length-1].overlap:!1},"isLoopOverlap"),addSectionToLoop:o(function(e){let t=this.sequenceItems.pop();t.sections=t.sections||[],t.sectionTitles=t.sectionTitles||[],t.sections.push({y:bt.getVerticalPos(),height:0}),t.sectionTitles.push(e),this.sequenceItems.push(t)},"addSectionToLoop"),saveVerticalPos:o(function(){this.isLoopOverlap()&&(this.savedVerticalPos=this.verticalPos)},"saveVerticalPos"),resetVerticalPos:o(function(){this.isLoopOverlap()&&(this.verticalPos=this.savedVerticalPos)},"resetVerticalPos"),bumpVerticalPos:o(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=vt.getMax(this.data.stopy,this.verticalPos)},"bumpVerticalPos"),getVerticalPos:o(function(){return this.verticalPos},"getVerticalPos"),getBounds:o(function(){return{bounds:this.data,models:this.models}},"getBounds")},tCt=o(async function(e,t,r){bt.bumpVerticalPos(We.boxMargin),t.height=We.boxMargin,t.starty=bt.getVerticalPos();let i=fa();i.x=t.startx,i.y=t.starty,i.width=t.width||We.width,i.class="note";let n=e.append("g");n.attr("data-et","note"),n.attr("data-id","i"+r);let a=Ei.drawRect(n,i),s=wx();s.x=t.startx,s.y=t.starty,s.width=i.width,s.dy="1em",s.text=t.message,s.class="noteText",s.fontFamily=We.noteFontFamily,s.fontSize=We.noteFontSize,s.fontWeight=We.noteFontWeight,s.anchor=We.noteAlign,s.textMargin=We.noteMargin,s.valign="center";let l=Bi(s.text)?await KT(n,s):gm(n,s),u=Math.round(l.map(h=>(h._groups||h)[0][0].getBBox().height).reduce((h,d)=>h+d));a.attr("height",u+2*We.noteMargin),t.height+=u+2*We.noteMargin,bt.bumpVerticalPos(u+2*We.noteMargin),t.stopy=t.starty+u+2*We.noteMargin,t.stopx=t.startx+i.width,bt.insert(t.startx,t.starty,t.stopx,t.stopy),bt.models.addNote(t)},"drawNote"),f6e=o(function(e,t,r,i,n,a,s){let l=i.db.getActors(),u=l.get(t.from),h=l.get(t.to),d=r.sequenceVisible,f=u.x+u.width/2,p=h.x+h.width/2,m=f<=p,g=y6e(t,i),y=e.append("g"),v=16.5,x=o((k,E)=>{let A=k?v:-v;return E?-A:A},"getCircleOffset"),b=o(k=>{y.append("circle").attr("cx",k).attr("cy",s).attr("r",5).attr("width",10).attr("height",10)},"drawCircle"),{CENTRAL_CONNECTION:T,CENTRAL_CONNECTION_REVERSE:w,CENTRAL_CONNECTION_DUAL:C}=i.db.LINETYPE;if(d)switch(t.centralConnection){case T:g&&(p+=x(m,!0));break;case w:g||(f+=x(m,!1));break;case C:g?p+=x(m,!0):f+=x(m,!1);break}switch(t.centralConnection){case T:b(p);break;case w:b(f);break;case C:b(f),b(p);break}},"drawCentralConnection"),ym=o(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont"),Ty=o(e=>({fontFamily:e.noteFontFamily,fontSize:e.noteFontSize,fontWeight:e.noteFontWeight}),"noteFont"),cW=o(e=>({fontFamily:e.actorFontFamily,fontSize:e.actorFontSize,fontWeight:e.actorFontWeight}),"actorFont");o(rCt,"boundMessage");iCt=o(async function(e,t,r,i,n,a){let{startx:s,stopx:l,starty:u,message:h,type:d,sequenceIndex:f,sequenceVisible:p}=t,m=Zt.calculateTextDimensions(h,ym(We)),g=wx();g.x=Math.min(s,l),g.y=u+10,g.width=Math.abs(l-s),g.class="messageText",g.dy="1em",g.text=h,g.fontFamily=We.messageFontFamily,g.fontSize=We.messageFontSize,g.fontWeight=We.messageFontWeight,g.anchor=We.messageAlign,g.valign="center",g.textMargin=We.wrapPadding,g.tspan=!1,Bi(g.text)?await KT(e,g,{startx:s,stopx:l,starty:r}):gm(e,g);let y=m.width,v;if(s===l){let b=p||We.showSequenceNumbers,T=y6e(n,i),w=pCt(n,i),C=s+(b&&(T||w)?10:0);We.rightAngles?v=e.append("path").attr("d",`M ${C},${r} H ${s+vt.getMax(We.width/2,y/2)} V ${r+25} H ${s}`):v=e.append("path").attr("d","M "+C+","+r+" C "+(C+60)+","+(r-10)+" "+(s+60)+","+(r+30)+" "+s+","+(r+20)),lW(n,i)&&f6e(e,n,t,i,s,l,r)}else v=e.append("line"),v.attr("x1",s),v.attr("y1",r),v.attr("x2",l),v.attr("y2",r),lW(n,i)&&f6e(e,n,t,i,s,l,r);d===i.db.LINETYPE.DOTTED||d===i.db.LINETYPE.DOTTED_CROSS||d===i.db.LINETYPE.DOTTED_POINT||d===i.db.LINETYPE.DOTTED_OPEN||d===i.db.LINETYPE.BIDIRECTIONAL_DOTTED||d===i.db.LINETYPE.SOLID_TOP_DOTTED||d===i.db.LINETYPE.SOLID_BOTTOM_DOTTED||d===i.db.LINETYPE.STICK_TOP_DOTTED||d===i.db.LINETYPE.STICK_BOTTOM_DOTTED||d===i.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED||d===i.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED||d===i.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED||d===i.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED?(v.style("stroke-dasharray","3, 3"),v.attr("class","messageLine1")):v.attr("class","messageLine0"),v.attr("data-et","message"),v.attr("data-id","i"+t.id),v.attr("data-from",t.from),v.attr("data-to",t.to);let x="";if(We.arrowMarkerAbsolute&&(x=Hf(!0)),v.attr("stroke-width",2),v.attr("stroke","none"),v.style("fill","none"),(d===i.db.LINETYPE.SOLID_TOP||d===i.db.LINETYPE.SOLID_TOP_DOTTED)&&v.attr("marker-end","url("+x+"#"+a+"-solidTopArrowHead)"),(d===i.db.LINETYPE.SOLID_BOTTOM||d===i.db.LINETYPE.SOLID_BOTTOM_DOTTED)&&v.attr("marker-end","url("+x+"#"+a+"-solidBottomArrowHead)"),(d===i.db.LINETYPE.STICK_TOP||d===i.db.LINETYPE.STICK_TOP_DOTTED)&&v.attr("marker-end","url("+x+"#"+a+"-stickTopArrowHead)"),(d===i.db.LINETYPE.STICK_BOTTOM||d===i.db.LINETYPE.STICK_BOTTOM_DOTTED)&&v.attr("marker-end","url("+x+"#"+a+"-stickBottomArrowHead)"),(d===i.db.LINETYPE.SOLID_ARROW_TOP_REVERSE||d===i.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED)&&v.attr("marker-start","url("+x+"#"+a+"-solidBottomArrowHead)"),(d===i.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE||d===i.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED)&&v.attr("marker-start","url("+x+"#"+a+"-solidTopArrowHead)"),(d===i.db.LINETYPE.STICK_ARROW_TOP_REVERSE||d===i.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED)&&v.attr("marker-start","url("+x+"#"+a+"-stickBottomArrowHead)"),(d===i.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE||d===i.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED)&&v.attr("marker-start","url("+x+"#"+a+"-stickTopArrowHead)"),(d===i.db.LINETYPE.SOLID||d===i.db.LINETYPE.DOTTED)&&v.attr("marker-end","url("+x+"#"+a+"-arrowhead)"),(d===i.db.LINETYPE.BIDIRECTIONAL_SOLID||d===i.db.LINETYPE.BIDIRECTIONAL_DOTTED)&&(v.attr("marker-start","url("+x+"#"+a+"-arrowhead)"),v.attr("marker-end","url("+x+"#"+a+"-arrowhead)")),(d===i.db.LINETYPE.SOLID_POINT||d===i.db.LINETYPE.DOTTED_POINT)&&v.attr("marker-end","url("+x+"#"+a+"-filled-head)"),(d===i.db.LINETYPE.SOLID_CROSS||d===i.db.LINETYPE.DOTTED_CROSS)&&v.attr("marker-end","url("+x+"#"+a+"-crosshead)"),p||We.showSequenceNumbers){let b=d===i.db.LINETYPE.BIDIRECTIONAL_SOLID||d===i.db.LINETYPE.BIDIRECTIONAL_DOTTED,T=d===i.db.LINETYPE.SOLID_ARROW_TOP_REVERSE||d===i.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED||d===i.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE||d===i.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED||d===i.db.LINETYPE.STICK_ARROW_TOP_REVERSE||d===i.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED||d===i.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE||d===i.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,w=6,C=lW(n,i),k=s,E=l;b?(ss?E=l-2*w:(E=l-w,k+=n?.centralConnection===i.db.LINETYPE.CENTRAL_CONNECTION_DUAL||n?.centralConnection===i.db.LINETYPE.CENTRAL_CONNECTION_REVERSE?-7.5:0),E+=C?15:0,v.attr("x2",E),v.attr("x1",k)):v.attr("x1",s+w);let A=0,N=s===l,P=s<=l;N?A=t.fromBounds+1:T?A=P?t.toBounds-1:t.fromBounds+1:A=P?t.fromBounds+1:t.toBounds-1;let I="12px",D=f.toString().length;D>5?I="7px":D>3&&(I="9px"),e.append("line").attr("x1",A).attr("y1",r).attr("x2",A).attr("y2",r).attr("stroke-width",0).attr("marker-start","url("+x+"#"+a+"-sequencenumber)"),e.append("text").attr("x",A).attr("y",r+4).attr("font-family","sans-serif").attr("font-size",I).attr("text-anchor","middle").attr("class","sequenceNumber").text(f)}},"drawMessage"),nCt=o(function(e,t,r,i,n,a,s){let l=0,u=0,h,d=0;for(let f of i){let p=t.get(f),m=p.box;h&&h!=m&&(s||bt.models.addBox(h),u+=We.boxMargin+h.margin),m&&m!=h&&(s||(m.x=l+u,m.y=n),u+=m.margin),p.width=vt.getMax(p.width||We.width,We.width),p.height=vt.getMax(p.height||We.height,We.height),p.margin=p.margin||We.actorMargin,d=vt.getMax(d,p.height),r.get(p.name)&&(u+=p.width/2),p.x=l+u,p.starty=bt.getVerticalPos(),bt.insert(p.x,n,p.x+p.width,p.height),l+=p.width+u,p.box&&(p.box.width=l+m.margin-p.box.x),u=p.margin,h=p.box,bt.models.addActor(p)}h&&!s&&bt.models.addBox(h),bt.bumpVerticalPos(d)},"addActorRenderingData"),uW=o(async function(e,t,r,i,n,a,s){if(i){let l=0;bt.bumpVerticalPos(We.boxMargin*2);for(let u of r){let h=t.get(u);h.stopy||(h.stopy=bt.getVerticalPos());let d=await Ei.drawActor(e,h,We,!0,n,a,s);l=vt.getMax(l,d)}bt.bumpVerticalPos(l+We.boxMargin)}else for(let l of r){let u=t.get(l);await Ei.drawActor(e,u,We,!1,n,a,s)}},"drawActors"),m6e=o(function(e,t,r,i){let n=0,a=0;for(let s of r){let l=t.get(s),u=lCt(l),h=Ei.drawPopup(e,l,u,We,We.forceMenus,i);h.height>n&&(n=h.height),h.width+l.x>a&&(a=h.width+l.x)}return{maxHeight:n,maxWidth:a}},"drawActorsPopup"),g6e=o(function(e){Ai(We,e),e.fontFamily&&(We.actorFontFamily=We.noteFontFamily=We.messageFontFamily=e.fontFamily),e.fontSize&&(We.actorFontSize=We.noteFontSize=We.messageFontSize=e.fontSize),e.fontWeight&&(We.actorFontWeight=We.noteFontWeight=We.messageFontWeight=e.fontWeight)},"setConf"),H6=o(function(e){return bt.activations.filter(function(t){return t.actor===e})},"actorActivations"),p6e=o(function(e,t){let r=t.get(e),i=H6(e),n=i.reduce(function(s,l){return vt.getMin(s,l.startx)},r.x+r.width/2-1),a=i.reduce(function(s,l){return vt.getMax(s,l.stopx)},r.x+r.width/2+1);return[n,a]},"activationBounds");o(lu,"adjustLoopHeightForWrap");o(aCt,"adjustCreatedDestroyedData");sCt=o(async function(e,t,r,i){let{securityLevel:n,sequence:a,look:s}=ge();We=a;let l;n==="sandbox"&&(l=Je("#i"+t));let u=n==="sandbox"?Je(l.nodes()[0].contentDocument.body):Je("body"),h=n==="sandbox"?l.nodes()[0].contentDocument:document;bt.init(),Z.debug(i.db);let d=n==="sandbox"?u.select(`[id="${t}"]`):Je(`[id="${t}"]`),f=i.db.getActors(),p=i.db.getCreatedActors(),m=i.db.getDestroyedActors(),g=i.db.getBoxes(),y=i.db.getActorKeys(),v=i.db.getMessages(),x=i.db.getDiagramTitle(),b=i.db.hasAtLeastOneBox(),T=i.db.hasAtLeastOneBoxWithTitle(),w=await oCt(f,v,i);if(We.height=await cCt(f,w,g),Ei.insertComputerIcon(d,t),Ei.insertDatabaseIcon(d,t),Ei.insertClockIcon(d,t),b&&(bt.bumpVerticalPos(We.boxMargin),T&&bt.bumpVerticalPos(g[0].textMaxHeight)),We.hideUnusedParticipants===!0){let F=new Set;v.forEach(V=>{F.add(V.from),F.add(V.to)}),y=y.filter(V=>F.has(V))}let C=new Map(y.map((F,V)=>[f.get(F)?.name??F,V]));nCt(d,f,p,y,0,v,!1);let k=await gCt(v,f,w,i);Ei.insertArrowHead(d,t),Ei.insertArrowCrossHead(d,t),Ei.insertArrowFilledHead(d,t),Ei.insertSequenceNumber(d,t),Ei.insertSolidTopArrowHead(d,t),Ei.insertSolidBottomArrowHead(d,t),Ei.insertStickTopArrowHead(d,t),Ei.insertStickBottomArrowHead(d,t),s==="neo"&&Ei.insertDropShadow(d,We);function E(F,V){let H=bt.endActivation(F);H.starty+18>V&&(H.starty=V-6,V+=12),Ei.drawActivation(d,H,V,We,H6(F.from).length,i,C),bt.insert(H.startx,V-10,H.stopx,V)}o(E,"activeEnd");let A=1,N=1,P=[],I=[],D=0;for(let F of v){let V,H,j;switch(F.type){case i.db.LINETYPE.NOTE:bt.resetVerticalPos(),H=F.noteModel,await tCt(d,H,F.id);break;case i.db.LINETYPE.ACTIVE_START:bt.newActivation(F,d,f);break;case i.db.LINETYPE.CENTRAL_CONNECTION:bt.newActivation(F,d,f);break;case i.db.LINETYPE.CENTRAL_CONNECTION_REVERSE:bt.newActivation(F,d,f);break;case i.db.LINETYPE.ACTIVE_END:E(F,bt.getVerticalPos());break;case i.db.LINETYPE.LOOP_START:lu(k,F,We.boxMargin,We.boxMargin+We.boxTextMargin,U=>bt.newLoop(U));break;case i.db.LINETYPE.LOOP_END:V=bt.endLoop(),await Ei.drawLoop(d,V,"loop",We,F),bt.bumpVerticalPos(V.stopy-bt.getVerticalPos()),bt.models.addLoop(V);break;case i.db.LINETYPE.RECT_START:lu(k,F,We.boxMargin,We.boxMargin,U=>bt.newLoop(void 0,U.message));break;case i.db.LINETYPE.RECT_END:V=bt.endLoop(),I.push(V),bt.models.addLoop(V),bt.bumpVerticalPos(V.stopy-bt.getVerticalPos());break;case i.db.LINETYPE.OPT_START:lu(k,F,We.boxMargin,We.boxMargin+We.boxTextMargin,U=>bt.newLoop(U));break;case i.db.LINETYPE.OPT_END:V=bt.endLoop(),await Ei.drawLoop(d,V,"opt",We,F),bt.bumpVerticalPos(V.stopy-bt.getVerticalPos()),bt.models.addLoop(V);break;case i.db.LINETYPE.ALT_START:lu(k,F,We.boxMargin,We.boxMargin+We.boxTextMargin,U=>bt.newLoop(U));break;case i.db.LINETYPE.ALT_ELSE:lu(k,F,We.boxMargin+We.boxTextMargin,We.boxMargin,U=>bt.addSectionToLoop(U));break;case i.db.LINETYPE.ALT_END:V=bt.endLoop(),await Ei.drawLoop(d,V,"alt",We,F),bt.bumpVerticalPos(V.stopy-bt.getVerticalPos()),bt.models.addLoop(V);break;case i.db.LINETYPE.PAR_START:case i.db.LINETYPE.PAR_OVER_START:lu(k,F,We.boxMargin,We.boxMargin+We.boxTextMargin,U=>bt.newLoop(U)),bt.saveVerticalPos();break;case i.db.LINETYPE.PAR_AND:lu(k,F,We.boxMargin+We.boxTextMargin,We.boxMargin,U=>bt.addSectionToLoop(U));break;case i.db.LINETYPE.PAR_END:V=bt.endLoop(),await Ei.drawLoop(d,V,"par",We,F),bt.bumpVerticalPos(V.stopy-bt.getVerticalPos()),bt.models.addLoop(V);break;case i.db.LINETYPE.AUTONUMBER:A=F.message.start||A,N=F.message.step||N,F.message.visible?i.db.enableSequenceNumbers():i.db.disableSequenceNumbers();break;case i.db.LINETYPE.CRITICAL_START:lu(k,F,We.boxMargin,We.boxMargin+We.boxTextMargin,U=>bt.newLoop(U));break;case i.db.LINETYPE.CRITICAL_OPTION:lu(k,F,We.boxMargin+We.boxTextMargin,We.boxMargin,U=>bt.addSectionToLoop(U));break;case i.db.LINETYPE.CRITICAL_END:V=bt.endLoop(),await Ei.drawLoop(d,V,"critical",We,F),bt.bumpVerticalPos(V.stopy-bt.getVerticalPos()),bt.models.addLoop(V);break;case i.db.LINETYPE.BREAK_START:lu(k,F,We.boxMargin,We.boxMargin+We.boxTextMargin,U=>bt.newLoop(U));break;case i.db.LINETYPE.BREAK_END:V=bt.endLoop(),await Ei.drawLoop(d,V,"break",We,F),bt.bumpVerticalPos(V.stopy-bt.getVerticalPos()),bt.models.addLoop(V);break;default:try{j=F.msgModel,j.starty=bt.getVerticalPos(),j.sequenceIndex=A,j.sequenceVisible=i.db.showSequenceNumbers(),j.id=F.id,j.from=F.from,j.to=F.to;let U=await rCt(d,j);aCt(F,j,U,D,f,p,m),P.push({messageModel:j,lineStartY:U,msg:F}),bt.models.addMessage(j)}catch(U){Z.error("error while drawing message",U)}}[i.db.LINETYPE.SOLID_OPEN,i.db.LINETYPE.DOTTED_OPEN,i.db.LINETYPE.SOLID,i.db.LINETYPE.SOLID_TOP,i.db.LINETYPE.SOLID_BOTTOM,i.db.LINETYPE.STICK_TOP,i.db.LINETYPE.STICK_BOTTOM,i.db.LINETYPE.SOLID_TOP_DOTTED,i.db.LINETYPE.SOLID_BOTTOM_DOTTED,i.db.LINETYPE.STICK_TOP_DOTTED,i.db.LINETYPE.STICK_BOTTOM_DOTTED,i.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,i.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE,i.db.LINETYPE.STICK_ARROW_TOP_REVERSE,i.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,i.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,i.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,i.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,i.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,i.db.LINETYPE.DOTTED,i.db.LINETYPE.SOLID_CROSS,i.db.LINETYPE.DOTTED_CROSS,i.db.LINETYPE.SOLID_POINT,i.db.LINETYPE.DOTTED_POINT,i.db.LINETYPE.BIDIRECTIONAL_SOLID,i.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(F.type)&&(A=Math.round((A+N)*100)/100),D++}Z.debug("createdActors",p),Z.debug("destroyedActors",m),await uW(d,f,y,!1,t,i,C);for(let F of P)await iCt(d,F.messageModel,F.lineStartY,i,F.msg,t);We.mirrorActors&&await uW(d,f,y,!0,t,i,C),I.forEach(F=>Ei.drawBackgroundRect(d,F)),oW(d,f,y,We);for(let F of bt.models.boxes){F.height=bt.getVerticalPos()-F.y,bt.insert(F.x,F.y,F.x+F.width,F.height);let V=We.boxMargin*2;F.startx=F.x-V,F.starty=F.y-V*.25,F.stopx=F.startx+F.width+2*V,F.stopy=F.starty+F.height+V*.75,F.stroke="rgb(0,0,0, 0.5)",Ei.drawBox(d,F,We)}b&&bt.bumpVerticalPos(We.boxMargin);let _=m6e(d,f,y,h),{bounds:R}=bt.getBounds();R.startx===void 0&&(R.startx=0),R.starty===void 0&&(R.starty=0),R.stopx===void 0&&(R.stopx=0),R.stopy===void 0&&(R.stopy=0);let M=R.stopy-R.starty;M<_.maxHeight&&(M=_.maxHeight);let L=M+2*We.diagramMarginY;We.mirrorActors&&(L=L-We.boxMargin+We.bottomMarginAdj);let B=R.stopx-R.startx;B<_.maxWidth&&(B=_.maxWidth);let O=B+2*We.diagramMarginX;x&&d.append("text").text(x).attr("x",(R.stopx-R.startx)/2-2*We.diagramMarginX).attr("y",-25),Br(d,L,O,We.useMaxWidth);let $=x?40:0,G=f.size&&s==="neo"?30:0;d.attr("viewBox",R.startx-We.diagramMarginX+" -"+(We.diagramMarginY+$)+" "+O+" "+(L+$+G)),Z.debug("models:",bt.models)},"draw");o(oCt,"getMaxMessageWidthPerActor");lCt=o(function(e){let t=0,r=cW(We);for(let i in e.links){let a=Zt.calculateTextDimensions(i,r).width+2*We.wrapPadding+2*We.boxMargin;t2,p=o(v=>u?-v:v,"adjustValue");e.from===e.to?d=h:(e.activate&&!f&&(d+=p(We.activationWidth/2-1)),[r.db.LINETYPE.SOLID_OPEN,r.db.LINETYPE.DOTTED_OPEN,r.db.LINETYPE.STICK_TOP,r.db.LINETYPE.STICK_BOTTOM,r.db.LINETYPE.STICK_TOP_DOTTED,r.db.LINETYPE.STICK_BOTTOM_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,r.db.LINETYPE.STICK_ARROW_TOP_REVERSE,r.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE,r.db.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED,r.db.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE].includes(e.type)||(d+=p(3)),[r.db.LINETYPE.BIDIRECTIONAL_SOLID,r.db.LINETYPE.BIDIRECTIONAL_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED,r.db.LINETYPE.SOLID_ARROW_TOP_REVERSE,r.db.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE].includes(e.type)&&(h-=p(3)));let m=[n,a,s,l],g=Math.abs(h-d);e.wrap&&e.message&&(e.message=Zt.wrapLabel(e.message,vt.getMax(g+2*We.wrapPadding,We.width),ym(We)));let y=Zt.calculateTextDimensions(e.message,ym(We));return{width:vt.getMax(e.wrap?0:y.width+2*We.wrapPadding,g+2*We.wrapPadding,We.width),height:0,startx:h,stopx:d,starty:0,stopy:0,message:e.message,type:e.type,wrap:e.wrap,fromBounds:Math.min.apply(null,m),toBounds:Math.max.apply(null,m)}},"buildMessageModel"),gCt=o(async function(e,t,r,i){let n={},a=[],s,l,u;for(let h of e){switch(h.type){case i.db.LINETYPE.LOOP_START:case i.db.LINETYPE.ALT_START:case i.db.LINETYPE.OPT_START:case i.db.LINETYPE.PAR_START:case i.db.LINETYPE.PAR_OVER_START:case i.db.LINETYPE.CRITICAL_START:case i.db.LINETYPE.BREAK_START:a.push({id:h.id,msg:h.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case i.db.LINETYPE.ALT_ELSE:case i.db.LINETYPE.PAR_AND:case i.db.LINETYPE.CRITICAL_OPTION:h.message&&(s=a.pop(),n[s.id]=s,n[h.id]=s,a.push(s));break;case i.db.LINETYPE.LOOP_END:case i.db.LINETYPE.ALT_END:case i.db.LINETYPE.OPT_END:case i.db.LINETYPE.PAR_END:case i.db.LINETYPE.CRITICAL_END:case i.db.LINETYPE.BREAK_END:s=a.pop(),n[s.id]=s;break;case i.db.LINETYPE.ACTIVE_START:{let f=t.get(h.from?h.from:h.to.actor),p=H6(h.from?h.from:h.to.actor).length,m=f.x+f.width/2+(p-1)*We.activationWidth/2,g={startx:m,stopx:m+We.activationWidth,actor:h.from,enabled:!0};bt.activations.push(g)}break;case i.db.LINETYPE.ACTIVE_END:{let f=bt.activations.map(p=>p.actor).lastIndexOf(h.from);bt.activations.splice(f,1).splice(0,1)}break}h.placement!==void 0?(l=await uCt(h,t,i),h.noteModel=l,a.forEach(f=>{s=f,s.from=vt.getMin(s.from,l.startx),s.to=vt.getMax(s.to,l.startx+l.width),s.width=vt.getMax(s.width,Math.abs(s.from-s.to))-We.labelBoxWidth})):(u=mCt(h,t,i),h.msgModel=u,u.startx&&u.stopx&&a.length>0&&a.forEach(f=>{if(s=f,u.startx===u.stopx){let p=t.get(h.from),m=t.get(h.to);s.from=vt.getMin(p.x-u.width/2,p.x-p.width/2,s.from),s.to=vt.getMax(m.x+u.width/2,m.x+p.width/2,s.to),s.width=vt.getMax(s.width,Math.abs(s.to-s.from))-We.labelBoxWidth}else s.from=vt.getMin(u.startx,s.from),s.to=vt.getMax(u.stopx,s.to),s.width=vt.getMax(s.width,u.width)-We.labelBoxWidth}))}return bt.activations=[],Z.debug("Loop type widths:",n),n},"calculateLoopBounds"),v6e={bounds:bt,drawActors:uW,drawActorsPopup:m6e,setConf:g6e,draw:sCt}});var b6e={};xr(b6e,{diagram:()=>yCt});var yCt,T6e=z(()=>{"use strict";s6e();aW();l6e();Ut();x6e();yCt={parser:a6e,get db(){return new W6},renderer:v6e,styles:o6e,init:o(e=>{e.sequence||(e.sequence={}),e.wrap&&(e.sequence.wrap=e.wrap,Sv({sequence:{wrap:e.wrap}}))},"init")}});var hW,Y6,dW=z(()=>{"use strict";hW=(function(){var e=o(function(qe,Ue,ye,ve){for(ye=ye||{},ve=qe.length;ve--;ye[qe[ve]]=Ue);return ye},"o"),t=[1,18],r=[1,19],i=[1,20],n=[1,41],a=[1,26],s=[1,42],l=[1,24],u=[1,25],h=[1,32],d=[1,33],f=[1,34],p=[1,45],m=[1,35],g=[1,36],y=[1,37],v=[1,38],x=[1,27],b=[1,28],T=[1,29],w=[1,30],C=[1,31],k=[1,44],E=[1,46],A=[1,43],N=[1,47],P=[1,9],I=[1,8,9],D=[1,58],_=[1,59],R=[1,60],M=[1,61],L=[1,62],B=[1,63],O=[1,64],$=[1,8,9,41],G=[1,77],F=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],V=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],H=[13,60,86,100,102,103],j=[13,60,73,74,86,100,102,103],U=[13,60,68,69,70,71,72,86,100,102,103],Q=[1,103],Y=[1,121],ae=[1,117],J=[1,113],te=[1,119],re=[1,114],ee=[1,115],Te=[1,116],ue=[1,118],De=[1,120],Ie=[22,50,60,61,82,86,87,88,89,90],Ee=[1,128],we=[12,39],Me=[1,8,9,39,41,44,46],$e=[1,8,9,22],de=[1,153],rt=[1,8,9,61],ke=[1,8,9,22,50,60,61,82,86,87,88,89,90],Fe={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:o(function(Ue,ye,ve,ie,fe,W,ce){var K=W.length-1;switch(fe){case 8:this.$=W[K-1];break;case 9:case 10:case 13:case 15:this.$=W[K];break;case 11:case 14:this.$=W[K-2]+"."+W[K];break;case 12:case 16:this.$=W[K-1]+W[K];break;case 17:case 18:this.$=W[K-1]+"~"+W[K]+"~";break;case 19:ie.addRelation(W[K]);break;case 20:W[K-1].title=ie.cleanupLabel(W[K]),ie.addRelation(W[K-1]);break;case 31:this.$=W[K].trim(),ie.setAccTitle(this.$);break;case 32:case 33:this.$=W[K].trim(),ie.setAccDescription(this.$);break;case 34:ie.addClassesToNamespace(W[K-3],W[K-1][0],W[K-1][1]),ie.popNamespace();break;case 35:ie.addClassesToNamespace(W[K-4],W[K-1][0],W[K-1][1]),ie.popNamespace();break;case 36:this.$=ie.addNamespace(W[K]);break;case 37:this.$=ie.addNamespace(W[K-1],W[K]);break;case 38:this.$=[[W[K]],[]];break;case 39:this.$=[[W[K-1]],[]];break;case 40:W[K][0].unshift(W[K-2]),this.$=W[K];break;case 41:this.$=[[],[W[K]]];break;case 42:this.$=[[],[W[K-1]]];break;case 43:W[K][1].unshift(W[K-2]),this.$=W[K];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=W[K];break;case 48:ie.setCssClass(W[K-2],W[K]);break;case 49:ie.addMembers(W[K-3],W[K-1]);break;case 51:ie.setCssClass(W[K-5],W[K-3]),ie.addMembers(W[K-5],W[K-1]);break;case 52:ie.addAnnotation(W[K-3],W[K-1]);break;case 53:ie.addAnnotation(W[K-6],W[K-4]),ie.addMembers(W[K-6],W[K-1]);break;case 54:ie.addAnnotation(W[K-5],W[K-3]);break;case 55:this.$=W[K],ie.addClass(W[K]);break;case 56:this.$=W[K-1],ie.addClass(W[K-1]),ie.setClassLabel(W[K-1],W[K]);break;case 60:ie.addAnnotation(W[K],W[K-2]);break;case 61:case 74:this.$=[W[K]];break;case 62:W[K].push(W[K-1]),this.$=W[K];break;case 63:break;case 64:ie.addMember(W[K-1],ie.cleanupLabel(W[K]));break;case 65:break;case 66:break;case 67:this.$={id1:W[K-2],id2:W[K],relation:W[K-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:W[K-3],id2:W[K],relation:W[K-1],relationTitle1:W[K-2],relationTitle2:"none"};break;case 69:this.$={id1:W[K-3],id2:W[K],relation:W[K-2],relationTitle1:"none",relationTitle2:W[K-1]};break;case 70:this.$={id1:W[K-4],id2:W[K],relation:W[K-2],relationTitle1:W[K-3],relationTitle2:W[K-1]};break;case 71:this.$=ie.addNote(W[K],W[K-1]);break;case 72:this.$=ie.addNote(W[K]);break;case 73:this.$=W[K-2],ie.defineClass(W[K-1],W[K]);break;case 75:this.$=W[K-2].concat([W[K]]);break;case 76:ie.setDirection("TB");break;case 77:ie.setDirection("BT");break;case 78:ie.setDirection("RL");break;case 79:ie.setDirection("LR");break;case 80:this.$={type1:W[K-2],type2:W[K],lineType:W[K-1]};break;case 81:this.$={type1:"none",type2:W[K],lineType:W[K-1]};break;case 82:this.$={type1:W[K-1],type2:"none",lineType:W[K]};break;case 83:this.$={type1:"none",type2:"none",lineType:W[K]};break;case 84:this.$=ie.relationType.AGGREGATION;break;case 85:this.$=ie.relationType.EXTENSION;break;case 86:this.$=ie.relationType.COMPOSITION;break;case 87:this.$=ie.relationType.DEPENDENCY;break;case 88:this.$=ie.relationType.LOLLIPOP;break;case 89:this.$=ie.lineType.LINE;break;case 90:this.$=ie.lineType.DOTTED_LINE;break;case 91:case 97:this.$=W[K-2],ie.setClickEvent(W[K-1],W[K]);break;case 92:case 98:this.$=W[K-3],ie.setClickEvent(W[K-2],W[K-1]),ie.setTooltip(W[K-2],W[K]);break;case 93:this.$=W[K-2],ie.setLink(W[K-1],W[K]);break;case 94:this.$=W[K-3],ie.setLink(W[K-2],W[K-1],W[K]);break;case 95:this.$=W[K-3],ie.setLink(W[K-2],W[K-1]),ie.setTooltip(W[K-2],W[K]);break;case 96:this.$=W[K-4],ie.setLink(W[K-3],W[K-2],W[K]),ie.setTooltip(W[K-3],W[K-1]);break;case 99:this.$=W[K-3],ie.setClickEvent(W[K-2],W[K-1],W[K]);break;case 100:this.$=W[K-4],ie.setClickEvent(W[K-3],W[K-2],W[K-1]),ie.setTooltip(W[K-3],W[K]);break;case 101:this.$=W[K-3],ie.setLink(W[K-2],W[K]);break;case 102:this.$=W[K-4],ie.setLink(W[K-3],W[K-1],W[K]);break;case 103:this.$=W[K-4],ie.setLink(W[K-3],W[K-1]),ie.setTooltip(W[K-3],W[K]);break;case 104:this.$=W[K-5],ie.setLink(W[K-4],W[K-2],W[K]),ie.setTooltip(W[K-4],W[K-1]);break;case 105:this.$=W[K-2],ie.setCssStyle(W[K-1],W[K]);break;case 106:ie.setCssClass(W[K-1],W[K]);break;case 107:this.$=[W[K]];break;case 108:W[K-2].push(W[K]),this.$=W[K-2];break;case 110:this.$=W[K-1]+W[K];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:t,35:r,37:i,38:22,42:n,43:23,46:a,48:s,51:l,52:u,54:h,56:d,57:f,60:p,62:m,63:g,64:y,65:v,75:x,76:b,78:T,82:w,83:C,86:k,100:E,102:A,103:N},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},e(P,[2,5],{8:[1,48]}),{8:[1,49]},e(I,[2,19],{22:[1,50]}),e(I,[2,21]),e(I,[2,22]),e(I,[2,23]),e(I,[2,24]),e(I,[2,25]),e(I,[2,26]),e(I,[2,27]),e(I,[2,28]),e(I,[2,29]),e(I,[2,30]),{34:[1,51]},{36:[1,52]},e(I,[2,33]),e(I,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:D,69:_,70:R,71:M,72:L,73:B,74:O}),{39:[1,65]},e($,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),e(I,[2,65]),e(I,[2,66]),{16:69,60:p,86:k,100:E,102:A},{16:39,17:40,19:70,60:p,86:k,100:E,102:A,103:N},{16:39,17:40,19:71,60:p,86:k,100:E,102:A,103:N},{16:39,17:40,19:72,60:p,86:k,100:E,102:A,103:N},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:p,86:k,100:E,102:A,103:N},{13:G,55:76},{58:78,60:[1,79]},e(I,[2,76]),e(I,[2,77]),e(I,[2,78]),e(I,[2,79]),e(F,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:p,86:k,100:E,102:A,103:N}),e(F,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:p,86:k,100:E,102:A,103:N},{16:39,17:40,19:87,60:p,86:k,100:E,102:A,103:N},e(V,[2,133]),e(V,[2,134]),e(V,[2,135]),e(V,[2,136]),e([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),e(P,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:t,35:r,37:i,42:n,46:a,48:s,51:l,52:u,54:h,56:d,57:f,60:p,62:m,63:g,64:y,65:v,75:x,76:b,78:T,82:w,83:C,86:k,100:E,102:A,103:N}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:t,35:r,37:i,38:22,42:n,43:23,46:a,48:s,51:l,52:u,54:h,56:d,57:f,60:p,62:m,63:g,64:y,65:v,75:x,76:b,78:T,82:w,83:C,86:k,100:E,102:A,103:N},e(I,[2,20]),e(I,[2,31]),e(I,[2,32]),{13:[1,91],16:39,17:40,19:90,60:p,86:k,100:E,102:A,103:N},{53:92,66:56,67:57,68:D,69:_,70:R,71:M,72:L,73:B,74:O},e(I,[2,64]),{67:93,73:B,74:O},e(H,[2,83],{66:94,68:D,69:_,70:R,71:M,72:L}),e(j,[2,84]),e(j,[2,85]),e(j,[2,86]),e(j,[2,87]),e(j,[2,88]),e(U,[2,89]),e(U,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:n,43:23,48:s,54:h,56:d},{16:100,60:p,86:k,100:E,102:A},{41:[1,102],45:101,51:Q},{16:104,60:p,86:k,100:E,102:A},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:Y,50:ae,59:110,60:J,82:te,84:111,85:112,86:re,87:ee,88:Te,89:ue,90:De},{60:[1,122]},{13:G,55:123},e($,[2,72]),e($,[2,138]),{22:Y,50:ae,59:124,60:J,61:[1,125],82:te,84:111,85:112,86:re,87:ee,88:Te,89:ue,90:De},e(Ie,[2,74]),{16:39,17:40,19:126,60:p,86:k,100:E,102:A,103:N},e(F,[2,16]),e(F,[2,17]),e(F,[2,18]),{11:127,12:Ee,39:[2,36]},e(we,[2,9],{16:85,17:86,15:130,18:[1,129],60:p,86:k,100:E,102:A,103:N}),e(we,[2,10]),e(Me,[2,55],{11:131,12:Ee}),e(P,[2,7]),{9:[1,132]},e($e,[2,67]),{16:39,17:40,19:133,60:p,86:k,100:E,102:A,103:N},{13:[1,135],16:39,17:40,19:134,60:p,86:k,100:E,102:A,103:N},e(H,[2,82],{66:136,68:D,69:_,70:R,71:M,72:L}),e(H,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:n,43:23,48:s,54:h,56:d},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},e($,[2,48],{39:[1,142]}),{41:[1,143]},e($,[2,50]),{41:[2,61],45:144,51:Q},{47:[1,145]},{16:39,17:40,19:146,60:p,86:k,100:E,102:A,103:N},e(I,[2,91],{13:[1,147]}),e(I,[2,93],{13:[1,149],77:[1,148]}),e(I,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},e(I,[2,105],{61:de}),e(rt,[2,107],{85:154,22:Y,50:ae,60:J,82:te,86:re,87:ee,88:Te,89:ue,90:De}),e(ke,[2,109]),e(ke,[2,111]),e(ke,[2,112]),e(ke,[2,113]),e(ke,[2,114]),e(ke,[2,115]),e(ke,[2,116]),e(ke,[2,117]),e(ke,[2,118]),e(ke,[2,119]),e(I,[2,106]),e($,[2,71]),e(I,[2,73],{61:de}),{60:[1,155]},e(F,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:p,86:k,100:E,102:A,103:N},e(we,[2,12]),e(Me,[2,56]),{1:[2,4]},e($e,[2,69]),e($e,[2,68]),{16:39,17:40,19:158,60:p,86:k,100:E,102:A,103:N},e(H,[2,80]),e($,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:n,43:23,48:s,54:h,56:d},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:n,43:23,48:s,54:h,56:d},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:n,43:23,48:s,54:h,56:d},{45:163,51:Q},e($,[2,49]),{41:[2,62]},e($,[2,52],{39:[1,164]}),e(I,[2,60]),e(I,[2,92]),e(I,[2,94]),e(I,[2,95],{77:[1,165]}),e(I,[2,98]),e(I,[2,99],{13:[1,166]}),e(I,[2,101],{13:[1,168],77:[1,167]}),{22:Y,50:ae,60:J,82:te,84:169,85:112,86:re,87:ee,88:Te,89:ue,90:De},e(ke,[2,110]),e(Ie,[2,75]),{14:[1,170]},e(we,[2,11]),e($e,[2,70]),e($,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:Q},e(I,[2,96]),e(I,[2,100]),e(I,[2,102]),e(I,[2,103],{77:[1,174]}),e(rt,[2,108],{85:154,22:Y,50:ae,60:J,82:te,86:re,87:ee,88:Te,89:ue,90:De}),e(Me,[2,8]),e($,[2,51]),{41:[1,175]},e($,[2,54]),e(I,[2,104]),e($,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:o(function(Ue,ye){if(ye.recoverable)this.trace(Ue);else{var ve=new Error(Ue);throw ve.hash=ye,ve}},"parseError"),parse:o(function(Ue){var ye=this,ve=[0],ie=[],fe=[null],W=[],ce=this.table,K="",Re=0,xe=0,Oe=0,be=2,Be=1,Ae=W.slice.call(arguments,1),Ve=Object.create(this.lexer),Pe={yy:{}};for(var Ye in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ye)&&(Pe.yy[Ye]=this.yy[Ye]);Ve.setInput(Ue,Pe.yy),Pe.yy.lexer=Ve,Pe.yy.parser=this,typeof Ve.yylloc>"u"&&(Ve.yylloc={});var le=Ve.yylloc;W.push(le);var st=Ve.options&&Ve.options.ranges;typeof Pe.yy.parseError=="function"?this.parseError=Pe.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function me(dt){ve.length=ve.length-2*dt,fe.length=fe.length-dt,W.length=W.length-dt}o(me,"popStack");function ot(){var dt;return dt=ie.pop()||Ve.lex()||Be,typeof dt!="number"&&(dt instanceof Array&&(ie=dt,dt=ie.pop()),dt=ye.symbols_[dt]||dt),dt}o(ot,"lex");for(var kt,Gt,Tt,Et,yt,oe,ht={},gt,et,pe,Qe;;){if(Tt=ve[ve.length-1],this.defaultActions[Tt]?Et=this.defaultActions[Tt]:((kt===null||typeof kt>"u")&&(kt=ot()),Et=ce[Tt]&&ce[Tt][kt]),typeof Et>"u"||!Et.length||!Et[0]){var nt="";Qe=[];for(gt in ce[Tt])this.terminals_[gt]&>>be&&Qe.push("'"+this.terminals_[gt]+"'");Ve.showPosition?nt="Parse error on line "+(Re+1)+`: +`+Ve.showPosition()+` +Expecting `+Qe.join(", ")+", got '"+(this.terminals_[kt]||kt)+"'":nt="Parse error on line "+(Re+1)+": Unexpected "+(kt==Be?"end of input":"'"+(this.terminals_[kt]||kt)+"'"),this.parseError(nt,{text:Ve.match,token:this.terminals_[kt]||kt,line:Ve.yylineno,loc:le,expected:Qe})}if(Et[0]instanceof Array&&Et.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Tt+", token: "+kt);switch(Et[0]){case 1:ve.push(kt),fe.push(Ve.yytext),W.push(Ve.yylloc),ve.push(Et[1]),kt=null,Gt?(kt=Gt,Gt=null):(xe=Ve.yyleng,K=Ve.yytext,Re=Ve.yylineno,le=Ve.yylloc,Oe>0&&Oe--);break;case 2:if(et=this.productions_[Et[1]][1],ht.$=fe[fe.length-et],ht._$={first_line:W[W.length-(et||1)].first_line,last_line:W[W.length-1].last_line,first_column:W[W.length-(et||1)].first_column,last_column:W[W.length-1].last_column},st&&(ht._$.range=[W[W.length-(et||1)].range[0],W[W.length-1].range[1]]),oe=this.performAction.apply(ht,[K,xe,Re,Pe.yy,Et[1],fe,W].concat(Ae)),typeof oe<"u")return oe;et&&(ve=ve.slice(0,-1*et*2),fe=fe.slice(0,-1*et),W=W.slice(0,-1*et)),ve.push(this.productions_[Et[1]][0]),fe.push(ht.$),W.push(ht._$),pe=ce[ve[ve.length-2]][ve[ve.length-1]],ve.push(pe);break;case 3:return!0}}return!0},"parse")},He=(function(){var qe={EOF:1,parseError:o(function(ye,ve){if(this.yy.parser)this.yy.parser.parseError(ye,ve);else throw new Error(ye)},"parseError"),setInput:o(function(Ue,ye){return this.yy=ye||this.yy||{},this._input=Ue,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var Ue=this._input[0];this.yytext+=Ue,this.yyleng++,this.offset++,this.match+=Ue,this.matched+=Ue;var ye=Ue.match(/(?:\r\n?|\n).*/g);return ye?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Ue},"input"),unput:o(function(Ue){var ye=Ue.length,ve=Ue.split(/(?:\r\n?|\n)/g);this._input=Ue+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-ye),this.offset-=ye;var ie=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),ve.length-1&&(this.yylineno-=ve.length-1);var fe=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:ve?(ve.length===ie.length?this.yylloc.first_column:0)+ie[ie.length-ve.length].length-ve[0].length:this.yylloc.first_column-ye},this.options.ranges&&(this.yylloc.range=[fe[0],fe[0]+this.yyleng-ye]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(Ue){this.unput(this.match.slice(Ue))},"less"),pastInput:o(function(){var Ue=this.matched.substr(0,this.matched.length-this.match.length);return(Ue.length>20?"...":"")+Ue.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var Ue=this.match;return Ue.length<20&&(Ue+=this._input.substr(0,20-Ue.length)),(Ue.substr(0,20)+(Ue.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var Ue=this.pastInput(),ye=new Array(Ue.length+1).join("-");return Ue+this.upcomingInput()+` +`+ye+"^"},"showPosition"),test_match:o(function(Ue,ye){var ve,ie,fe;if(this.options.backtrack_lexer&&(fe={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(fe.yylloc.range=this.yylloc.range.slice(0))),ie=Ue[0].match(/(?:\r\n?|\n).*/g),ie&&(this.yylineno+=ie.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ie?ie[ie.length-1].length-ie[ie.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Ue[0].length},this.yytext+=Ue[0],this.match+=Ue[0],this.matches=Ue,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(Ue[0].length),this.matched+=Ue[0],ve=this.performAction.call(this,this.yy,this,ye,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),ve)return ve;if(this._backtrack){for(var W in fe)this[W]=fe[W];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Ue,ye,ve,ie;this._more||(this.yytext="",this.match="");for(var fe=this._currentRules(),W=0;Wye[0].length)){if(ye=ve,ie=W,this.options.backtrack_lexer){if(Ue=this.test_match(ve,fe[W]),Ue!==!1)return Ue;if(this._backtrack){ye=!1;continue}else return!1}else if(!this.options.flex)break}return ye?(Ue=this.test_match(ye,fe[ie]),Ue!==!1?Ue:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var ye=this.next();return ye||this.lex()},"lex"),begin:o(function(ye){this.conditionStack.push(ye)},"begin"),popState:o(function(){var ye=this.conditionStack.length-1;return ye>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(ye){return ye=this.conditionStack.length-1-Math.abs(ye||0),ye>=0?this.conditionStack[ye]:"INITIAL"},"topState"),pushState:o(function(ye){this.begin(ye)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:o(function(ye,ve,ie,fe){var W=fe;switch(ie){case 0:return 62;case 1:return 63;case 2:return 64;case 3:return 65;case 4:break;case 5:break;case 6:return this.begin("acc_title"),33;break;case 7:return this.popState(),"acc_title_value";break;case 8:return this.begin("acc_descr"),35;break;case 9:return this.popState(),"acc_descr_value";break;case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 8;case 14:break;case 15:return 7;case 16:return 7;case 17:return"EDGE_STATE";case 18:this.begin("callback_name");break;case 19:this.popState();break;case 20:this.popState(),this.begin("callback_args");break;case 21:return 79;case 22:this.popState();break;case 23:return 80;case 24:this.popState();break;case 25:return"STR";case 26:this.begin("string");break;case 27:return 82;case 28:return 57;case 29:return this.begin("namespace"),42;break;case 30:return this.popState(),8;break;case 31:break;case 32:return this.begin("namespace-body"),39;break;case 33:this.popState(),this.less(0);break;case 34:return this.popState(),41;break;case 35:return"EOF_IN_STRUCT";case 36:return 8;case 37:break;case 38:return"EDGE_STATE";case 39:return this.begin("class"),48;break;case 40:return this.popState(),8;break;case 41:break;case 42:return this.popState(),this.popState(),41;break;case 43:return this.begin("class-body"),39;break;case 44:return this.popState(),41;break;case 45:return"EOF_IN_STRUCT";case 46:return"EDGE_STATE";case 47:return"OPEN_IN_STRUCT";case 48:break;case 49:return"MEMBER";case 50:return 83;case 51:return 75;case 52:return 76;case 53:return 78;case 54:return 54;case 55:return 56;case 56:return 46;case 57:return 47;case 58:return 81;case 59:this.popState();break;case 60:return"GENERICTYPE";case 61:this.begin("generic");break;case 62:this.popState();break;case 63:return"BQUOTE_STR";case 64:this.begin("bqstring");break;case 65:return 77;case 66:return 77;case 67:return 77;case 68:return 77;case 69:return 69;case 70:return 69;case 71:return 71;case 72:return 71;case 73:return 70;case 74:return 68;case 75:return 72;case 76:return 73;case 77:return 74;case 78:return 22;case 79:return 44;case 80:return 100;case 81:return 18;case 82:return"PLUS";case 83:return 87;case 84:return 61;case 85:return 89;case 86:return 89;case 87:return 90;case 88:return"EQUALS";case 89:return"EQUALS";case 90:return 60;case 91:return 12;case 92:return 14;case 93:return"PUNCTUATION";case 94:return 86;case 95:return 102;case 96:return 50;case 97:return 50;case 98:return 9}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:\[\*\])/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:["])/,/^(?:[^"]*)/,/^(?:["])/,/^(?:style\b)/,/^(?:classDef\b)/,/^(?:namespace\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[{])/,/^(?:[}])/,/^(?:[}])/,/^(?:$)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:\[\*\])/,/^(?:class\b)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:[}])/,/^(?:[{])/,/^(?:[}])/,/^(?:$)/,/^(?:\[\*\])/,/^(?:[{])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:note for\b)/,/^(?:note\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:href\b)/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:~)/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:[`])/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:\s*\(\))/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?::)/,/^(?:,)/,/^(?:#)/,/^(?:#)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:\[)/,/^(?:\])/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:\s)/,/^(?:$)/],conditions:{"namespace-body":{rules:[26,29,34,35,36,37,38,39,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},namespace:{rules:[26,29,30,31,32,33,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},"class-body":{rules:[26,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},class:{rules:[26,40,41,42,43,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},acc_descr_multiline:{rules:[11,12,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},acc_descr:{rules:[9,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},acc_title:{rules:[7,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},callback_args:{rules:[22,23,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},callback_name:{rules:[19,20,21,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},href:{rules:[26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},struct:{rules:[26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},generic:{rules:[26,50,51,52,53,54,55,56,57,58,59,60,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},bqstring:{rules:[26,50,51,52,53,54,55,56,57,58,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},string:{rules:[24,25,26,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,87,88,89,90,91,92,93,94,95,96,98],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,26,27,28,29,39,50,51,52,53,54,55,56,57,58,61,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98],inclusive:!0}}};return qe})();Fe.lexer=He;function at(){this.yy={}}return o(at,"Parser"),at.prototype=Fe,Fe.Parser=at,new at})();hW.parser=hW;Y6=hW});var w6e,ZT,S6e=z(()=>{"use strict";Ut();Ir();w6e=["#","+","~","-",""],ZT=class{static{o(this,"ClassMember")}constructor(t,r){this.memberType=r,this.visibility="",this.classifier="",this.text="";let i=fr(t,ge());this.parseMember(i)}getDisplayDetails(){let t=this.visibility+cc(this.id);this.memberType==="method"&&(t+=`(${cc(this.parameters.trim())})`,this.returnType&&(t+=" : "+cc(this.returnType))),t=t.trim();let r=this.parseClassifier();return{displayText:t,cssStyle:r}}parseMember(t){let r="";if(this.memberType==="method"){let a=/([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(t);if(a){let s=a[1]?a[1].trim():"";if(w6e.includes(s)&&(this.visibility=s),this.id=a[2],this.parameters=a[3]?a[3].trim():"",r=a[4]?a[4].trim():"",this.returnType=a[5]?a[5].trim():"",r===""){let l=this.returnType.substring(this.returnType.length-1);/[$*]/.exec(l)&&(r=l,this.returnType=this.returnType.substring(0,this.returnType.length-1))}}}else{let n=t.length,a=t.substring(0,1),s=t.substring(n-1);w6e.includes(a)&&(this.visibility=a),/[$*]/.exec(s)&&(r=s),this.id=t.substring(this.visibility===""?0:1,r===""?n:n-1)}this.classifier=r,this.id=this.id.startsWith(" ")?" "+this.id.trim():this.id.trim();let i=`${this.visibility?"\\"+this.visibility:""}${cc(this.id)}${this.memberType==="method"?`(${cc(this.parameters)})${this.returnType?" : "+cc(this.returnType):""}`:""}`;this.text=i.replaceAll("<","<").replaceAll(">",">"),this.text.startsWith("\\<")&&(this.text=this.text.replace("\\<","~"))}parseClassifier(){switch(this.classifier){case"*":return"font-style:italic;";case"$":return"text-decoration:underline;";default:return""}}}});var j6,E6e,vm,Cy,fW=z(()=>{"use strict";Rr();St();Ut();Ir();Xt();Ci();gp();S6e();uv();j6="classId-",E6e=0,vm=o(e=>vt.sanitizeText(e,ge()),"sanitizeText"),Cy=class e{constructor(){this.relations=[];this.classes=new Map;this.styleClasses=new Map;this.notes=new Map;this.interfaces=[];this.namespaces=new Map;this.namespaceCounter=0;this.namespaceStack=[];this.diagramId="";this.functions=[];this.lineType={LINE:0,DOTTED_LINE:1};this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4};this.setupToolTips=o(t=>{let r=zw();Je(t).select("svg").selectAll("g").filter(function(){return Je(this).attr("title")!==null}).on("mouseover",a=>{let s=Je(a.currentTarget),l=s.attr("title");if(!l)return;let u=a.currentTarget.getBoundingClientRect();r.transition().duration(200).style("opacity",".9"),r.html(Ro.sanitize(l)).style("left",`${window.scrollX+u.left+u.width/2}px`).style("top",`${window.scrollY+u.bottom+4}px`),s.classed("hover",!0)}).on("mouseout",a=>{r.transition().duration(500).style("opacity",0),Je(a.currentTarget).classed("hover",!1)})},"setupToolTips");this.direction="TB";this.setAccTitle=Cr;this.getAccTitle=kr;this.setAccDescription=wr;this.getAccDescription=Sr;this.setDiagramTitle=Ar;this.getDiagramTitle=Er;this.getConfig=o(()=>ge().class,"getConfig");this.functions.push(this.setupToolTips.bind(this)),this.clear(),this.addRelation=this.addRelation.bind(this),this.addClassesToNamespace=this.addClassesToNamespace.bind(this),this.addNamespace=this.addNamespace.bind(this),this.popNamespace=this.popNamespace.bind(this),this.setCssClass=this.setCssClass.bind(this),this.addMembers=this.addMembers.bind(this),this.addClass=this.addClass.bind(this),this.setClassLabel=this.setClassLabel.bind(this),this.addAnnotation=this.addAnnotation.bind(this),this.addMember=this.addMember.bind(this),this.cleanupLabel=this.cleanupLabel.bind(this),this.addNote=this.addNote.bind(this),this.defineClass=this.defineClass.bind(this),this.setDirection=this.setDirection.bind(this),this.setLink=this.setLink.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.clear=this.clear.bind(this),this.setTooltip=this.setTooltip.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setCssStyle=this.setCssStyle.bind(this)}static{o(this,"ClassDB")}splitClassNameAndType(t){let r=vt.sanitizeText(t,ge()),i="",n=r;if(r.indexOf("~")>0){let a=r.split("~");n=vm(a[0]),i=vm(a[1])}return{className:n,type:i}}setClassLabel(t,r){let i=vt.sanitizeText(t,ge());r&&(r=vm(r));let{className:n}=this.splitClassNameAndType(i);this.classes.get(n).label=r,this.classes.get(n).text=`${r}${this.classes.get(n).type?`<${this.classes.get(n).type}>`:""}`}addClass(t){let r=vt.sanitizeText(t,ge()),{className:i,type:n}=this.splitClassNameAndType(r);if(this.classes.has(i))return;let a=vt.sanitizeText(i,ge());this.classes.set(a,{id:a,type:n,label:a,text:`${a}${n?`<${n}>`:""}`,shape:"classBox",cssClasses:"default",methods:[],members:[],annotations:[],styles:[],domId:j6+a+"-"+E6e}),E6e++}addInterface(t,r){let i={id:`interface${this.interfaces.length}`,label:t,classId:r};this.interfaces.push(i)}setDiagramId(t){this.diagramId=t}lookUpDomId(t){let r=vt.sanitizeText(t,ge());if(this.classes.has(r)){let i=this.classes.get(r).domId;return this.diagramId?`${this.diagramId}-${i}`:i}throw new Error("Class not found: "+r)}clear(){this.relations=[],this.classes=new Map,this.notes=new Map,this.interfaces=[],this.functions=[],this.functions.push(this.setupToolTips.bind(this)),this.namespaces=new Map,this.namespaceCounter=0,this.namespaceStack=[],this.diagramId="",this.direction="TB",gr()}getClass(t){return this.classes.get(t)}getClasses(){return this.classes}getRelations(){return this.relations}getNote(t){let r=typeof t=="number"?`note${t}`:t;return this.notes.get(r)}getNotes(){return this.notes}addRelation(t){Z.debug("Adding relation: "+JSON.stringify(t));let r=[this.relationType.LOLLIPOP,this.relationType.AGGREGATION,this.relationType.COMPOSITION,this.relationType.DEPENDENCY,this.relationType.EXTENSION];t.relation.type1===this.relationType.LOLLIPOP&&!r.includes(t.relation.type2)?(this.addClass(t.id2),this.addInterface(t.id1,t.id2),t.id1=`interface${this.interfaces.length-1}`):t.relation.type2===this.relationType.LOLLIPOP&&!r.includes(t.relation.type1)?(this.addClass(t.id1),this.addInterface(t.id2,t.id1),t.id2=`interface${this.interfaces.length-1}`):(this.addClass(t.id1),this.addClass(t.id2)),t.id1=this.splitClassNameAndType(t.id1).className,t.id2=this.splitClassNameAndType(t.id2).className,t.relationTitle1=vt.sanitizeText(t.relationTitle1.trim(),ge()),t.relationTitle2=vt.sanitizeText(t.relationTitle2.trim(),ge()),this.relations.push(t)}addAnnotation(t,r){let i=this.splitClassNameAndType(t).className;this.classes.get(i).annotations.push(r)}addMember(t,r){this.addClass(t);let i=this.splitClassNameAndType(t).className,n=this.classes.get(i);if(typeof r=="string"){let a=r.trim();a.startsWith("<<")&&a.endsWith(">>")?n.annotations.push(vm(a.substring(2,a.length-2))):a.indexOf(")")>0?n.methods.push(new ZT(a,"method")):a&&n.members.push(new ZT(a,"attribute"))}}addMembers(t,r){Array.isArray(r)&&(r.reverse(),r.forEach(i=>this.addMember(t,i)))}addNote(t,r){let i=this.notes.size,n={id:`note${i}`,class:r,text:t,index:i};return this.notes.set(n.id,n),n.id}cleanupLabel(t){return t.startsWith(":")&&(t=t.substring(1)),vm(t.trim())}setCssClass(t,r){t.split(",").forEach(i=>{let n=i;/\d/.exec(i[0])&&(n=j6+n);let a=this.classes.get(n);a&&(a.cssClasses+=" "+r)})}defineClass(t,r){for(let i of t){let n=this.styleClasses.get(i);n===void 0&&(n={id:i,styles:[],textStyles:[]},this.styleClasses.set(i,n)),r&&r.forEach(a=>{if(/color/.exec(a)){let s=a.replace("fill","bgFill");n.textStyles.push(s)}n.styles.push(a)}),this.classes.forEach(a=>{a.cssClasses.includes(i)&&a.styles.push(...r.flatMap(s=>s.split(",")))})}}setTooltip(t,r){t.split(",").forEach(i=>{r!==void 0&&(this.classes.get(i).tooltip=vm(r))})}getTooltip(t,r){return r&&this.namespaces.has(r)?this.namespaces.get(r).classes.get(t).tooltip:this.classes.get(t).tooltip}setLink(t,r,i){let n=ge();t.split(",").forEach(a=>{let s=a;/\d/.exec(a[0])&&(s=j6+s);let l=this.classes.get(s);l&&(l.link=Zt.formatUrl(r,n),n.securityLevel==="sandbox"?l.linkTarget="_top":typeof i=="string"?l.linkTarget=vm(i):l.linkTarget="_blank")}),this.setCssClass(t,"clickable")}setClickEvent(t,r,i){t.split(",").forEach(n=>{this.setClickFunc(n,r,i),this.classes.get(n).haveCallback=!0}),this.setCssClass(t,"clickable")}setClickFunc(t,r,i){let n=vt.sanitizeText(t,ge());if(ge().securityLevel!=="loose"||r===void 0)return;let s=n;if(this.classes.has(s)){let l=[];if(typeof i=="string"){l=i.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);for(let u=0;u{let u=this.lookUpDomId(s),h=document.querySelector(`[id="${u}"]`);h!==null&&h.addEventListener("click",()=>{Zt.runFunc(r,...l)},!1)})}}bindFunctions(t){this.functions.forEach(r=>{r(t)})}escapeHtml(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}getDirection(){return this.direction}setDirection(t){this.direction=t}static resolveQualifiedId(t,r){let i=r.at(-1);return i?`${i}.${t}`:t}static getAncestorIds(t){let r=t.split("."),i=new Array(r.length);i[0]=r[0];for(let n=1;n0?a[s-1]:void 0,h=s===a.length-1,d=h&&r?r:n[s];this.namespaces.has(l)?h&&(this.namespaces.get(l).explicit=!0):this.namespaces.set(l,this.createNamespaceNode(l,d,u,h)),u&&this.linkParentChild(u,l)}return i}popNamespace(){this.namespaceStack.pop()}getNamespace(t){return this.namespaces.get(t)}getNamespaces(){return this.namespaces}addClassesToNamespace(t,r,i){if(this.namespaces.has(t)){for(let n of r){let{className:a}=this.splitClassNameAndType(n),s=this.getClass(a);s.parent=t,this.namespaces.get(t).classes.set(a,s)}for(let n of i){let a=this.getNote(n);a.parent=t,this.namespaces.get(t).notes.set(n,a)}}}setCssStyle(t,r){let i=this.classes.get(t);if(!(!r||!i))for(let n of r)n.includes(",")?i.styles.push(...n.split(",")):i.styles.push(n)}getArrowMarker(t){let r;switch(t){case 0:r="aggregation";break;case 1:r="extension";break;case 2:r="composition";break;case 3:r="dependency";break;case 4:r="lollipop";break;default:r="none"}return r}resolveExplicitAncestor(t){let r=t;for(;r;){let i=this.namespaces.get(r);if(!i)return;if(i.explicit)return r;r=i.parent}}getData(){let t=[],r=[],i=ge(),n=i.class?.hierarchicalNamespaces??!0;for(let s of this.namespaces.values()){if(!n&&!s.explicit)continue;let l={id:s.id,label:n?s.label:s.id,isGroup:!0,padding:i.class.padding??16,shape:"rect",cssStyles:[],look:i.look,parentId:n?s.parent:void 0};t.push(l)}for(let s of this.classes.values()){let l=n?s.parent:this.resolveExplicitAncestor(s.parent),u={...s,type:void 0,isGroup:!1,parentId:l,look:i.look};t.push(u)}for(let s of this.notes.values()){let l=n?s.parent:this.resolveExplicitAncestor(s.parent),u={id:s.id,label:s.text,isGroup:!1,shape:"note",padding:i.class.padding??6,cssStyles:["text-align: left","white-space: nowrap",`fill: ${i.themeVariables.noteBkgColor}`,`stroke: ${i.themeVariables.noteBorderColor}`],look:i.look,parentId:l,labelType:"markdown"};t.push(u);let h=this.classes.get(s.class)?.id;if(h){let d={id:`edgeNote${s.index}`,start:s.id,end:h,type:"normal",thickness:"normal",classes:"relation",arrowTypeStart:"none",arrowTypeEnd:"none",arrowheadStyle:"",labelStyle:[""],style:["fill: none"],pattern:"dotted",look:i.look};r.push(d)}}for(let s of this.interfaces){let l={id:s.id,label:s.label,isGroup:!1,shape:"rect",cssStyles:["opacity: 0;"],look:i.look};t.push(l)}let a=0;for(let s of this.relations){a++;let l={id:bc(s.id1,s.id2,{prefix:"id",counter:a}),start:s.id1,end:s.id2,type:"normal",label:s.title,labelpos:"c",thickness:"normal",classes:"relation",arrowTypeStart:this.getArrowMarker(s.relation.type1),arrowTypeEnd:this.getArrowMarker(s.relation.type2),startLabelRight:s.relationTitle1==="none"?"":s.relationTitle1,endLabelLeft:s.relationTitle2==="none"?"":s.relationTitle2,arrowheadStyle:"",labelStyle:["display: inline-block"],style:s.style||"",pattern:s.relation.lineType==1?"dashed":"solid",look:i.look,labelType:"markdown"};r.push(l)}return{nodes:t,edges:r,other:{},config:i,direction:this.getDirection()}}}});var TCt,X6,pW=z(()=>{"use strict";k1();TCt=o(e=>`g.classGroup text { + fill: ${e.nodeBorder||e.classText}; + stroke: none; + font-family: ${e.fontFamily}; + font-size: 10px; + + .title { + font-weight: bolder; + } + +} + + .cluster-label text { + fill: ${e.titleColor}; + } + .cluster-label span { + color: ${e.titleColor}; + } + .cluster-label span p { + background-color: transparent; + } + + .cluster rect { + fill: ${e.clusterBkg}; + stroke: ${e.clusterBorder}; + stroke-width: 1px; + } + + .cluster text { + fill: ${e.titleColor}; + } + + .cluster span { + color: ${e.titleColor}; + } + +.nodeLabel, .edgeLabel { + color: ${e.classText}; +} + +.noteLabel .nodeLabel, .noteLabel .edgeLabel { + color: ${e.noteTextColor}; +} +.edgeLabel .label rect { + fill: ${e.mainBkg}; +} +.label text { + fill: ${e.classText}; +} + +.labelBkg { + background: ${e.mainBkg}; +} +.edgeLabel .label span { + background: ${e.mainBkg}; +} + +.classTitle { + font-weight: bolder; +} +.node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: ${e.strokeWidth}; + } + + +.divider { + stroke: ${e.nodeBorder}; + stroke-width: 1; +} + +g.clickable { + cursor: pointer; +} + +g.classGroup rect { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; +} + +g.classGroup line { + stroke: ${e.nodeBorder}; + stroke-width: 1; +} + +.classLabel .box { + stroke: none; + stroke-width: 0; + fill: ${e.mainBkg}; + opacity: 0.5; +} + +.classLabel .label { + fill: ${e.nodeBorder}; + font-size: 10px; +} + +.relation { + stroke: ${e.lineColor}; + stroke-width: ${e.strokeWidth}; + fill: none; +} + +.dashed-line{ + stroke-dasharray: 3; +} + +.dotted-line{ + stroke-dasharray: 1 2; +} + +[id$="-compositionStart"], .composition { + fill: ${e.lineColor} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +[id$="-compositionEnd"], .composition { + fill: ${e.lineColor} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +[id$="-dependencyStart"], .dependency { + fill: ${e.lineColor} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +[id$="-dependencyEnd"], .dependency { + fill: ${e.lineColor} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +[id$="-extensionStart"], .extension { + fill: transparent !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +[id$="-extensionEnd"], .extension { + fill: transparent !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +[id$="-aggregationStart"], .aggregation { + fill: transparent !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +[id$="-aggregationEnd"], .aggregation { + fill: transparent !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +[id$="-lollipopStart"], .lollipop { + fill: ${e.mainBkg} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +[id$="-lollipopEnd"], .lollipop { + fill: ${e.mainBkg} !important; + stroke: ${e.lineColor} !important; + stroke-width: 1; +} + +.edgeTerminals { + font-size: 11px; + line-height: initial; +} + +.classTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; +} + +.edgeLabel[data-look="neo"] { + background-color: ${e.edgeLabelBackground}; + p { + background-color: ${e.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; +} + ${Vc()} +`,"getStyles"),X6=TCt});var CCt,kCt,wCt,K6,mW=z(()=>{"use strict";Ut();St();Lp();tf();rf();Xt();CCt=o((e,t="TB")=>{if(!e.doc)return t;let r=t;for(let i of e.doc)i.stmt==="dir"&&(r=i.value);return r},"getDir"),kCt=o(function(e,t){return t.db.getClasses()},"getClasses"),wCt=o(async function(e,t,r,i){Z.info("REF0:"),Z.info("Drawing class diagram (v3)",t);let{securityLevel:n,state:a,layout:s}=ge();i.db.setDiagramId(t);let l=i.db.getData(),u=Fo(t,n);l.type=i.type,l.layoutAlgorithm=Gc(s),l.nodeSpacing=a?.nodeSpacing||50,l.rankSpacing=a?.rankSpacing||50,l.markers=["aggregation","extension","composition","dependency","lollipop"],l.diagramId=t,await Zo(l,u);let h=8;Zt.insertTitle(u,"classDiagramTitleText",a?.titleTopMargin??25,i.db.getDiagramTitle()),$s(u,h,"classDiagram",a?.useMaxWidth??!0)},"draw"),K6={getClasses:kCt,draw:wCt,getDir:CCt}});var A6e={};xr(A6e,{diagram:()=>SCt});var SCt,_6e=z(()=>{"use strict";dW();fW();pW();mW();SCt={parser:Y6,get db(){return new Cy},renderer:K6,styles:X6,init:o(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var L6e={};xr(L6e,{diagram:()=>DCt});var DCt,M6e=z(()=>{"use strict";dW();fW();pW();mW();DCt={parser:Y6,get db(){return new Cy},renderer:K6,styles:X6,init:o(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var gW,Z6,yW=z(()=>{"use strict";gW=(function(){var e=o(function($,G,F,V){for(F=F||{},V=$.length;V--;F[$[V]]=G);return F},"o"),t=[1,2],r=[1,3],i=[1,4],n=[2,4],a=[1,9],s=[1,11],l=[1,16],u=[1,17],h=[1,18],d=[1,19],f=[1,33],p=[1,20],m=[1,21],g=[1,22],y=[1,23],v=[1,24],x=[1,26],b=[1,27],T=[1,28],w=[1,29],C=[1,30],k=[1,31],E=[1,32],A=[1,35],N=[1,36],P=[1,37],I=[1,38],D=[1,34],_=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],R=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],M=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],L={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:o(function(G,F,V,H,j,U,Q){var Y=U.length-1;switch(j){case 3:return H.setRootDoc(U[Y]),U[Y];break;case 4:this.$=[];break;case 5:U[Y]!="nl"&&(U[Y-1].push(U[Y]),this.$=U[Y-1]);break;case 6:case 7:this.$=U[Y];break;case 8:this.$="nl";break;case 12:this.$=U[Y];break;case 13:let re=U[Y-1];re.description=H.trimColon(U[Y]),this.$=re;break;case 14:this.$={stmt:"relation",state1:U[Y-2],state2:U[Y]};break;case 15:let ee=H.trimColon(U[Y]);this.$={stmt:"relation",state1:U[Y-3],state2:U[Y-1],description:ee};break;case 19:this.$={stmt:"state",id:U[Y-3],type:"default",description:"",doc:U[Y-1]};break;case 20:var ae=U[Y],J=U[Y-2].trim();if(U[Y].match(":")){var te=U[Y].split(":");ae=te[0],J=[J,te[1]]}this.$={stmt:"state",id:ae,type:"default",description:J};break;case 21:this.$={stmt:"state",id:U[Y-3],type:"default",description:U[Y-5],doc:U[Y-1]};break;case 22:this.$={stmt:"state",id:U[Y],type:"fork"};break;case 23:this.$={stmt:"state",id:U[Y],type:"join"};break;case 24:this.$={stmt:"state",id:U[Y],type:"choice"};break;case 25:this.$={stmt:"state",id:H.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:U[Y-1].trim(),note:{position:U[Y-2].trim(),text:U[Y].trim()}};break;case 29:this.$=U[Y].trim(),H.setAccTitle(this.$);break;case 30:case 31:this.$=U[Y].trim(),H.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:U[Y-3],url:U[Y-2],tooltip:U[Y-1]};break;case 33:this.$={stmt:"click",id:U[Y-3],url:U[Y-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:U[Y-1].trim(),classes:U[Y].trim()};break;case 36:this.$={stmt:"style",id:U[Y-1].trim(),styleClass:U[Y].trim()};break;case 37:this.$={stmt:"applyClass",id:U[Y-1].trim(),styleClass:U[Y].trim()};break;case 38:H.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:H.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:H.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:H.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:U[Y].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:U[Y-2].trim(),classes:[U[Y].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:U[Y-2].trim(),classes:[U[Y].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:t,5:r,6:i},{1:[3]},{3:5,4:t,5:r,6:i},{3:6,4:t,5:r,6:i},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],n,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:u,19:h,22:d,24:f,25:p,26:m,27:g,28:y,29:v,32:25,33:x,35:b,37:T,38:w,41:C,45:k,48:E,51:A,52:N,53:P,54:I,57:D},e(_,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:l,17:u,19:h,22:d,24:f,25:p,26:m,27:g,28:y,29:v,32:25,33:x,35:b,37:T,38:w,41:C,45:k,48:E,51:A,52:N,53:P,54:I,57:D},e(_,[2,7]),e(_,[2,8]),e(_,[2,9]),e(_,[2,10]),e(_,[2,11]),e(_,[2,12],{14:[1,40],15:[1,41]}),e(_,[2,16]),{18:[1,42]},e(_,[2,18],{20:[1,43]}),{23:[1,44]},e(_,[2,22]),e(_,[2,23]),e(_,[2,24]),e(_,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},e(_,[2,28]),{34:[1,49]},{36:[1,50]},e(_,[2,31]),{13:51,24:f,57:D},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},e(R,[2,44],{58:[1,56]}),e(R,[2,45],{58:[1,57]}),e(_,[2,38]),e(_,[2,39]),e(_,[2,40]),e(_,[2,41]),e(_,[2,6]),e(_,[2,13]),{13:58,24:f,57:D},e(_,[2,17]),e(M,n,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},e(_,[2,29]),e(_,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},e(_,[2,14],{14:[1,71]}),{4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:u,19:h,21:[1,72],22:d,24:f,25:p,26:m,27:g,28:y,29:v,32:25,33:x,35:b,37:T,38:w,41:C,45:k,48:E,51:A,52:N,53:P,54:I,57:D},e(_,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},e(_,[2,34]),e(_,[2,35]),e(_,[2,36]),e(_,[2,37]),e(R,[2,46]),e(R,[2,47]),e(_,[2,15]),e(_,[2,19]),e(M,n,{7:78}),e(_,[2,26]),e(_,[2,27]),{5:[1,79]},{5:[1,80]},{4:a,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:u,19:h,21:[1,81],22:d,24:f,25:p,26:m,27:g,28:y,29:v,32:25,33:x,35:b,37:T,38:w,41:C,45:k,48:E,51:A,52:N,53:P,54:I,57:D},e(_,[2,32]),e(_,[2,33]),e(_,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:o(function(G,F){if(F.recoverable)this.trace(G);else{var V=new Error(G);throw V.hash=F,V}},"parseError"),parse:o(function(G){var F=this,V=[0],H=[],j=[null],U=[],Q=this.table,Y="",ae=0,J=0,te=0,re=2,ee=1,Te=U.slice.call(arguments,1),ue=Object.create(this.lexer),De={yy:{}};for(var Ie in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ie)&&(De.yy[Ie]=this.yy[Ie]);ue.setInput(G,De.yy),De.yy.lexer=ue,De.yy.parser=this,typeof ue.yylloc>"u"&&(ue.yylloc={});var Ee=ue.yylloc;U.push(Ee);var we=ue.options&&ue.options.ranges;typeof De.yy.parseError=="function"?this.parseError=De.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Me(W){V.length=V.length-2*W,j.length=j.length-W,U.length=U.length-W}o(Me,"popStack");function $e(){var W;return W=H.pop()||ue.lex()||ee,typeof W!="number"&&(W instanceof Array&&(H=W,W=H.pop()),W=F.symbols_[W]||W),W}o($e,"lex");for(var de,rt,ke,Fe,He,at,qe={},Ue,ye,ve,ie;;){if(ke=V[V.length-1],this.defaultActions[ke]?Fe=this.defaultActions[ke]:((de===null||typeof de>"u")&&(de=$e()),Fe=Q[ke]&&Q[ke][de]),typeof Fe>"u"||!Fe.length||!Fe[0]){var fe="";ie=[];for(Ue in Q[ke])this.terminals_[Ue]&&Ue>re&&ie.push("'"+this.terminals_[Ue]+"'");ue.showPosition?fe="Parse error on line "+(ae+1)+`: +`+ue.showPosition()+` +Expecting `+ie.join(", ")+", got '"+(this.terminals_[de]||de)+"'":fe="Parse error on line "+(ae+1)+": Unexpected "+(de==ee?"end of input":"'"+(this.terminals_[de]||de)+"'"),this.parseError(fe,{text:ue.match,token:this.terminals_[de]||de,line:ue.yylineno,loc:Ee,expected:ie})}if(Fe[0]instanceof Array&&Fe.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ke+", token: "+de);switch(Fe[0]){case 1:V.push(de),j.push(ue.yytext),U.push(ue.yylloc),V.push(Fe[1]),de=null,rt?(de=rt,rt=null):(J=ue.yyleng,Y=ue.yytext,ae=ue.yylineno,Ee=ue.yylloc,te>0&&te--);break;case 2:if(ye=this.productions_[Fe[1]][1],qe.$=j[j.length-ye],qe._$={first_line:U[U.length-(ye||1)].first_line,last_line:U[U.length-1].last_line,first_column:U[U.length-(ye||1)].first_column,last_column:U[U.length-1].last_column},we&&(qe._$.range=[U[U.length-(ye||1)].range[0],U[U.length-1].range[1]]),at=this.performAction.apply(qe,[Y,J,ae,De.yy,Fe[1],j,U].concat(Te)),typeof at<"u")return at;ye&&(V=V.slice(0,-1*ye*2),j=j.slice(0,-1*ye),U=U.slice(0,-1*ye)),V.push(this.productions_[Fe[1]][0]),j.push(qe.$),U.push(qe._$),ve=Q[V[V.length-2]][V[V.length-1]],V.push(ve);break;case 3:return!0}}return!0},"parse")},B=(function(){var $={EOF:1,parseError:o(function(F,V){if(this.yy.parser)this.yy.parser.parseError(F,V);else throw new Error(F)},"parseError"),setInput:o(function(G,F){return this.yy=F||this.yy||{},this._input=G,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var G=this._input[0];this.yytext+=G,this.yyleng++,this.offset++,this.match+=G,this.matched+=G;var F=G.match(/(?:\r\n?|\n).*/g);return F?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),G},"input"),unput:o(function(G){var F=G.length,V=G.split(/(?:\r\n?|\n)/g);this._input=G+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-F),this.offset-=F;var H=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),V.length-1&&(this.yylineno-=V.length-1);var j=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:V?(V.length===H.length?this.yylloc.first_column:0)+H[H.length-V.length].length-V[0].length:this.yylloc.first_column-F},this.options.ranges&&(this.yylloc.range=[j[0],j[0]+this.yyleng-F]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(G){this.unput(this.match.slice(G))},"less"),pastInput:o(function(){var G=this.matched.substr(0,this.matched.length-this.match.length);return(G.length>20?"...":"")+G.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var G=this.match;return G.length<20&&(G+=this._input.substr(0,20-G.length)),(G.substr(0,20)+(G.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var G=this.pastInput(),F=new Array(G.length+1).join("-");return G+this.upcomingInput()+` +`+F+"^"},"showPosition"),test_match:o(function(G,F){var V,H,j;if(this.options.backtrack_lexer&&(j={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(j.yylloc.range=this.yylloc.range.slice(0))),H=G[0].match(/(?:\r\n?|\n).*/g),H&&(this.yylineno+=H.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:H?H[H.length-1].length-H[H.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+G[0].length},this.yytext+=G[0],this.match+=G[0],this.matches=G,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(G[0].length),this.matched+=G[0],V=this.performAction.call(this,this.yy,this,F,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),V)return V;if(this._backtrack){for(var U in j)this[U]=j[U];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var G,F,V,H;this._more||(this.yytext="",this.match="");for(var j=this._currentRules(),U=0;UF[0].length)){if(F=V,H=U,this.options.backtrack_lexer){if(G=this.test_match(V,j[U]),G!==!1)return G;if(this._backtrack){F=!1;continue}else return!1}else if(!this.options.flex)break}return F?(G=this.test_match(F,j[H]),G!==!1?G:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var F=this.next();return F||this.lex()},"lex"),begin:o(function(F){this.conditionStack.push(F)},"begin"),popState:o(function(){var F=this.conditionStack.length-1;return F>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(F){return F=this.conditionStack.length-1-Math.abs(F||0),F>=0?this.conditionStack[F]:"INITIAL"},"topState"),pushState:o(function(F){this.begin(F)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(F,V,H,j){function U(){let Y=V.yytext.indexOf("%%");if(Y===0)return!1;if(Y>0){let ae=V.yytext.slice(0,Y),J=V.yytext.slice(Y);J&&F.lexer.unput(J),V.yytext=ae}return!0}o(U,"processId");var Q=j;switch(H){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState("SCALE"),17;break;case 14:return 18;case 15:this.popState();break;case 16:return this.begin("acc_title"),33;break;case 17:return this.popState(),"acc_title_value";break;case 18:return this.begin("acc_descr"),35;break;case 19:return this.popState(),"acc_descr_value";break;case 20:this.begin("acc_descr_multiline");break;case 21:this.popState();break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;break;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 25:return this.popState(),this.pushState("CLASSDEFID"),42;break;case 26:return this.popState(),43;break;case 27:return this.pushState("CLASS"),48;break;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;break;case 29:return this.popState(),50;break;case 30:return this.pushState("STYLE"),45;break;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;break;case 32:return this.popState(),47;break;case 33:return this.pushState("SCALE"),17;break;case 34:return 18;case 35:this.popState();break;case 36:this.pushState("STATE");break;case 37:return this.popState(),V.yytext=V.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),V.yytext=V.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),V.yytext=V.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),V.yytext=V.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),V.yytext=V.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),V.yytext=V.yytext.slice(0,-10).trim(),27;break;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";break;case 49:if(!U())return;return this.popState(),"ID";break;case 50:this.popState();break;case 51:return"STATE_DESCR";case 52:return 19;case 53:this.popState();break;case 54:return this.popState(),this.pushState("struct"),20;break;case 55:return this.popState(),21;break;case 56:break;case 57:return this.begin("NOTE"),29;break;case 58:return this.popState(),this.pushState("NOTE_ID"),59;break;case 59:return this.popState(),this.pushState("NOTE_ID"),60;break;case 60:this.popState(),this.pushState("FLOATING_NOTE");break;case 61:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 62:break;case 63:return"NOTE_TEXT";case 64:if(!U())return;return this.popState(),"ID";break;case 65:if(!U())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 66:return this.popState(),V.yytext=V.yytext.substr(2).trim(),31;break;case 67:return this.popState(),V.yytext=V.yytext.slice(0,-8).trim(),31;break;case 68:return 6;case 69:return 6;case 70:return 16;case 71:return 57;case 72:return U()?24:void 0;case 73:return V.yytext=V.yytext.trim(),14;break;case 74:return 15;case 75:return 28;case 76:return 58;case 77:return 5;case 78:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,55,56,57,71,72,73,74,75,76],inclusive:!1},FLOATING_NOTE_ID:{rules:[64],inclusive:!1},FLOATING_NOTE:{rules:[61,62,63],inclusive:!1},NOTE_TEXT:{rules:[66,67],inclusive:!1},NOTE_ID:{rules:[65],inclusive:!1},NOTE:{rules:[58,59,60],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,54,57,68,69,70,71,72,73,74,76,77,78],inclusive:!0}}};return $})();L.lexer=B;function O(){this.yy={}}return o(O,"Parser"),O.prototype=L,L.Parser=O,new O})();gW.parser=gW;Z6=gW});var Rf,xm,QT,O6e,P6e,B6e,bm,Q6,vW,xW,bW,TW,J6,e_,F6e,$6e,CW,kW,z6e,G6e,ky,NCt,V6e,wW,ICt,OCt,W6e,q6e,PCt,U6e,BCt,H6e,SW,EW,Y6e,t_,j6e,AW,r_=z(()=>{"use strict";Rf="state",xm="root",QT="relation",O6e="classDef",P6e="style",B6e="applyClass",bm="default",Q6="divider",vW="fill:none",xW="fill: #333",bW="markdown",TW="normal",J6="rect",e_="rectWithTitle",F6e="stateStart",$6e="stateEnd",CW="divider",kW="roundedWithTitle",z6e="note",G6e="noteGroup",ky="statediagram",NCt="state",V6e=`${ky}-${NCt}`,wW="transition",ICt="note",OCt="note-edge",W6e=`${wW} ${OCt}`,q6e=`${ky}-${ICt}`,PCt="cluster",U6e=`${ky}-${PCt}`,BCt="cluster-alt",H6e=`${ky}-${BCt}`,SW="parent",EW="note",Y6e="state",t_="----",j6e=`${t_}${EW}`,AW=`${t_}${SW}`});function _W(e="",t=0,r="",i=t_){let n=r!==null&&r.length>0?`${i}${r}`:"";return`${Y6e}-${e}${n}-${t}`}function i_(e,t,r){if(!t.id||t.id===""||t.id==="")return;t.cssClasses&&(Array.isArray(t.cssCompiledStyles)||(t.cssCompiledStyles=[]),t.cssClasses.split(" ").forEach(n=>{let a=r.get(n);a&&(t.cssCompiledStyles=[...t.cssCompiledStyles??[],...a.styles])}));let i=e.find(n=>n.id===t.id);i?Object.assign(i,t):e.push(t)}function $Ct(e){return e?.classes?.join(" ")??""}function zCt(e){return e?.styles??[]}var n_,Lf,FCt,X6e,wy,Z6e,Q6e=z(()=>{"use strict";Ut();St();Ir();r_();n_=new Map,Lf=0;o(_W,"stateDomId");FCt=o((e,t,r,i,n,a,s,l)=>{Z.trace("items",t),t.forEach(u=>{switch(u.stmt){case Rf:wy(e,u,r,i,n,a,s,l);break;case bm:wy(e,u,r,i,n,a,s,l);break;case QT:{wy(e,u.state1,r,i,n,a,s,l),wy(e,u.state2,r,i,n,a,s,l);let h=s==="neo",d={id:"edge"+Lf,start:u.state1.id,end:u.state2.id,arrowhead:"normal",arrowTypeEnd:h?"arrow_barb_neo":"arrow_barb",style:vW,labelStyle:"",label:vt.sanitizeText(u.description??"",ge()),arrowheadStyle:xW,labelpos:"c",labelType:bW,thickness:TW,classes:wW,look:s};n.push(d),Lf++}break}})},"setupDoc"),X6e=o((e,t="TB")=>{let r=t;if(e.doc)for(let i of e.doc)i.stmt==="dir"&&(r=i.value);return r},"getDir");o(i_,"insertOrUpdateNode");o($Ct,"getClassesFromDbInfo");o(zCt,"getStylesFromDbInfo");wy=o((e,t,r,i,n,a,s,l)=>{let u=t.id,h=r.get(u),d=$Ct(h),f=zCt(h),p=ge();if(Z.info("dataFetcher parsedItem",t,h,f),u!=="root"){let m=J6;t.start===!0?m=F6e:t.start===!1&&(m=$6e),t.type!==bm&&(m=t.type),n_.get(u)||n_.set(u,{id:u,shape:m,description:vt.sanitizeText(u,p),cssClasses:`${d} ${V6e}`,cssStyles:f});let g=n_.get(u);t.description&&(Array.isArray(g.description)?(g.shape=e_,g.description.push(t.description)):g.description?.length&&g.description.length>0?(g.shape=e_,g.description===u?g.description=[t.description]:g.description=[g.description,t.description]):(g.shape=J6,g.description=t.description),g.description=vt.sanitizeTextOrArray(g.description,p)),g.description?.length===1&&g.shape===e_&&(g.type==="group"?g.shape=kW:g.shape=J6),!g.type&&t.doc&&(Z.info("Setting cluster for XCX",u,X6e(t)),g.type="group",g.isGroup=!0,g.dir=X6e(t),g.shape=t.type===Q6?CW:kW,g.cssClasses=`${g.cssClasses} ${U6e} ${a?H6e:""}`);let y={labelStyle:"",shape:g.shape,label:g.description,cssClasses:g.cssClasses,cssCompiledStyles:[],cssStyles:g.cssStyles,id:u,dir:g.dir,domId:_W(u,Lf),type:g.type,isGroup:g.type==="group",padding:8,rx:10,ry:10,look:s,labelType:"markdown"};if(y.shape===CW&&(y.label=""),e&&e.id!=="root"&&(Z.trace("Setting node ",u," to be child of its parent ",e.id),y.parentId=e.id),y.centerLabel=!0,t.note){let v={labelStyle:"",shape:z6e,label:t.note.text,labelType:"markdown",cssClasses:q6e,cssStyles:[],cssCompiledStyles:[],id:u+j6e+"-"+Lf,domId:_W(u,Lf,EW),type:g.type,isGroup:g.type==="group",padding:p.flowchart?.padding,look:s,position:t.note.position},x=u+AW,b={labelStyle:"",shape:G6e,label:t.note.text,cssClasses:g.cssClasses,cssStyles:[],id:u+AW,domId:_W(u,Lf,SW),type:"group",isGroup:!0,padding:16,look:s,position:t.note.position};Lf++,b.id=x,v.parentId=x,i_(i,b,l),i_(i,v,l),i_(i,y,l);let T=u,w=v.id;t.note.position==="left of"&&(T=v.id,w=u),n.push({id:T+"-"+w,start:T,end:w,arrowhead:"none",arrowTypeEnd:"",style:vW,labelStyle:"",classes:W6e,arrowheadStyle:xW,labelpos:"c",labelType:bW,thickness:TW,look:s})}else i_(i,y,l)}t.doc&&(Z.trace("Adding nodes children "),FCt(t,t.doc,r,i,n,!a,s,l))},"dataFetcher"),Z6e=o(()=>{n_.clear(),Lf=0},"reset")});var RW,GCt,VCt,J6e,LW=z(()=>{"use strict";Ut();St();Lp();tf();rf();Xt();r_();RW=o((e,t="TB")=>{if(!e.doc)return t;let r=t;for(let i of e.doc)i.stmt==="dir"&&(r=i.value);return r},"getDir"),GCt=o(function(e,t){return t.db.getClasses()},"getClasses"),VCt=o(async function(e,t,r,i){Z.info("REF0:"),Z.info("Drawing state diagram (v2)",t);let{securityLevel:n,state:a,layout:s}=ge();i.db.extract(i.db.getRootDocV2());let l=i.db.getData(),u=Fo(t,n);l.type=i.type,l.layoutAlgorithm=s,l.nodeSpacing=a?.nodeSpacing||50,l.rankSpacing=a?.rankSpacing||50,ge().look==="neo"?l.markers=["barbNeo"]:l.markers=["barb"],l.diagramId=t,await Zo(l,u);let d=8;try{(typeof i.db.getLinks=="function"?i.db.getLinks():new Map).forEach((p,m)=>{let g=typeof m=="string"?m:typeof m?.id=="string"?m.id:"";if(!g){Z.warn("\u26A0\uFE0F Invalid or missing stateId from key:",JSON.stringify(m));return}let y=u.node()?.querySelectorAll("g"),v;if(y?.forEach(w=>{w.textContent?.trim()===g&&(v=w)}),!v){Z.warn("\u26A0\uFE0F Could not find node matching text:",g);return}let x=v.parentNode;if(!x){Z.warn("\u26A0\uFE0F Node has no parent, cannot wrap:",g);return}let b=document.createElementNS("http://www.w3.org/2000/svg","a"),T=p.url.replace(/^"+|"+$/g,"");if(b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",T),b.setAttribute("target","_blank"),p.tooltip){let w=p.tooltip.replace(/^"+|"+$/g,"");b.setAttribute("title",w)}x.replaceChild(b,v),b.appendChild(v),Z.info("\u{1F517} Wrapped node in
    tag for:",g,p.url)})}catch(f){Z.error("\u274C Error injecting clickable links:",f)}Zt.insertTitle(u,"statediagramTitleText",a?.titleTopMargin??25,i.db.getDiagramTitle()),$s(u,d,ky,a?.useMaxWidth??!0)},"draw"),J6e={getClasses:GCt,draw:VCt,getDir:RW}});var gs,t_e,r_e,a_,ol,s_=z(()=>{"use strict";Ut();St();Xt();Ir();Ci();Q6e();LW();r_();gs={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},t_e=o(()=>new Map,"newClassesList"),r_e=o(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),a_=o(e=>JSON.parse(JSON.stringify(e)),"clone"),ol=class{constructor(t){this.version=t;this.nodes=[];this.edges=[];this.rootDoc=[];this.classes=t_e();this.documents={root:r_e()};this.currentDocument=this.documents.root;this.startEndCount=0;this.dividerCnt=0;this.links=new Map;this.getAccTitle=kr;this.setAccTitle=Cr;this.getAccDescription=Sr;this.setAccDescription=wr;this.setDiagramTitle=Ar;this.getDiagramTitle=Er;this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this)}static{o(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(t){this.clear(!0);for(let n of Array.isArray(t)?t:t.doc)switch(n.stmt){case Rf:this.addState(n.id.trim(),n.type,n.doc,n.description,n.note);break;case QT:this.addRelation(n.state1,n.state2,n.description);break;case O6e:this.addStyleClass(n.id.trim(),n.classes);break;case P6e:this.handleStyleDef(n);break;case B6e:this.setCssClass(n.id.trim(),n.styleClass);break;case"click":this.addLink(n.id,n.url,n.tooltip);break}let r=this.getStates(),i=ge();Z6e(),wy(void 0,this.getRootDocV2(),r,this.nodes,this.edges,!0,i.look,this.classes);for(let n of this.nodes)if(Array.isArray(n.label)){if(n.description=n.label.slice(1),n.isGroup&&n.description.length>0)throw new Error(`Group nodes can only have label. Remove the additional description for node [${n.id}]`);n.label=n.label[0]}}handleStyleDef(t){let r=t.id.trim().split(","),i=t.styleClass.split(",");for(let n of r){let a=this.getState(n);if(!a){let s=n.trim();this.addState(s),a=this.getState(s)}a&&(a.styles=i.map(s=>s.replace(/;/g,"")?.trim()))}}setRootDoc(t){Z.info("Setting root doc",t),this.rootDoc=t,this.version===1?this.extract(t):this.extract(this.getRootDocV2())}docTranslator(t,r,i){if(r.stmt===QT){this.docTranslator(t,r.state1,!0),this.docTranslator(t,r.state2,!1);return}if(r.stmt===Rf&&(r.id===gs.START_NODE?(r.id=t.id+(i?"_start":"_end"),r.start=i):r.id=r.id.trim()),r.stmt!==xm&&r.stmt!==Rf||!r.doc)return;let n=[],a=[];for(let s of r.doc)if(s.type===Q6){let l=a_(s);l.doc=a_(a),n.push(l),a=[]}else a.push(s);if(n.length>0&&a.length>0){let s={stmt:Rf,id:DM(),type:"divider",doc:a_(a)};n.push(a_(s)),r.doc=n}r.doc.forEach(s=>this.docTranslator(r,s,!0))}getRootDocV2(){return this.docTranslator({id:xm,stmt:xm},{id:xm,stmt:xm,doc:this.rootDoc},!0),{id:xm,doc:this.rootDoc}}addState(t,r=bm,i=void 0,n=void 0,a=void 0,s=void 0,l=void 0,u=void 0){let h=t?.trim();if(!this.currentDocument.states.has(h))Z.info("Adding state ",h,n),this.currentDocument.states.set(h,{stmt:Rf,id:h,descriptions:[],type:r,doc:i,note:a,classes:[],styles:[],textStyles:[]});else{let d=this.currentDocument.states.get(h);if(!d)throw new Error(`State not found: ${h}`);d.doc||(d.doc=i),d.type||(d.type=r)}if(n&&(Z.info("Setting state description",h,n),(Array.isArray(n)?n:[n]).forEach(f=>this.addDescription(h,f.trim()))),a){let d=this.currentDocument.states.get(h);if(!d)throw new Error(`State not found: ${h}`);d.note=a,d.note.text=vt.sanitizeText(d.note.text,ge())}s&&(Z.info("Setting state classes",h,s),(Array.isArray(s)?s:[s]).forEach(f=>this.setCssClass(h,f.trim()))),l&&(Z.info("Setting state styles",h,l),(Array.isArray(l)?l:[l]).forEach(f=>this.setStyle(h,f.trim()))),u&&(Z.info("Setting state styles",h,l),(Array.isArray(u)?u:[u]).forEach(f=>this.setTextStyle(h,f.trim())))}clear(t){this.nodes=[],this.edges=[],this.documents={root:r_e()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=t_e(),t||(this.links=new Map,gr())}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){Z.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(t,r,i){this.links.set(t,{url:r,tooltip:i}),Z.warn("Adding link",t,r,i)}getLinks(){return this.links}startIdIfNeeded(t=""){return t===gs.START_NODE?(this.startEndCount++,`${gs.START_TYPE}${this.startEndCount}`):t}startTypeIfNeeded(t="",r=bm){return t===gs.START_NODE?gs.START_TYPE:r}endIdIfNeeded(t=""){return t===gs.END_NODE?(this.startEndCount++,`${gs.END_TYPE}${this.startEndCount}`):t}endTypeIfNeeded(t="",r=bm){return t===gs.END_NODE?gs.END_TYPE:r}addRelationObjs(t,r,i=""){let n=this.startIdIfNeeded(t.id.trim()),a=this.startTypeIfNeeded(t.id.trim(),t.type),s=this.startIdIfNeeded(r.id.trim()),l=this.startTypeIfNeeded(r.id.trim(),r.type);this.addState(n,a,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(s,l,r.doc,r.description,r.note,r.classes,r.styles,r.textStyles),this.currentDocument.relations.push({id1:n,id2:s,relationTitle:vt.sanitizeText(i,ge())})}addRelation(t,r,i){if(typeof t=="object"&&typeof r=="object")this.addRelationObjs(t,r,i);else if(typeof t=="string"&&typeof r=="string"){let n=this.startIdIfNeeded(t.trim()),a=this.startTypeIfNeeded(t),s=this.endIdIfNeeded(r.trim()),l=this.endTypeIfNeeded(r);this.addState(n,a),this.addState(s,l),this.currentDocument.relations.push({id1:n,id2:s,relationTitle:i?vt.sanitizeText(i,ge()):void 0})}}addDescription(t,r){let i=this.currentDocument.states.get(t),n=r.startsWith(":")?r.replace(":","").trim():r;i?.descriptions?.push(vt.sanitizeText(n,ge()))}cleanupLabel(t){return t.startsWith(":")?t.slice(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(t,r=""){this.classes.has(t)||this.classes.set(t,{id:t,styles:[],textStyles:[]});let i=this.classes.get(t);r&&i&&r.split(gs.STYLECLASS_SEP).forEach(n=>{let a=n.replace(/([^;]*);/,"$1").trim();if(RegExp(gs.COLOR_KEYWORD).exec(n)){let l=a.replace(gs.FILL_KEYWORD,gs.BG_FILL).replace(gs.COLOR_KEYWORD,gs.FILL_KEYWORD);i.textStyles.push(l)}i.styles.push(a)})}getClasses(){return this.classes}setCssClass(t,r){t.split(",").forEach(i=>{let n=this.getState(i);if(!n){let a=i.trim();this.addState(a),n=this.getState(a)}n?.classes?.push(r)})}setStyle(t,r){this.getState(t)?.styles?.push(r)}setTextStyle(t,r){this.getState(t)?.textStyles?.push(r)}getDirectionStatement(){return this.rootDoc.find(t=>t.stmt==="dir")}getDirection(){return this.getDirectionStatement()?.value??"TB"}setDirection(t){let r=this.getDirectionStatement();r?r.value=t:this.rootDoc.unshift({stmt:"dir",value:t})}trimColon(t){return t.startsWith(":")?t.slice(1).trim():t.trim()}getData(){let t=ge();return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:RW(this.getRootDocV2())}}getConfig(){return ge().state}}});var qCt,o_,MW=z(()=>{"use strict";qCt=o(e=>` +defs [id$="-barbEnd"] { + fill: ${e.transitionColor}; + stroke: ${e.transitionColor}; + } +g.stateGroup text { + fill: ${e.nodeBorder}; + stroke: none; + font-size: 10px; +} +g.stateGroup text { + fill: ${e.textColor}; + stroke: none; + font-size: 10px; + +} +g.stateGroup .state-title { + font-weight: bolder; + fill: ${e.stateLabelColor}; +} + +g.stateGroup rect { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; +} + +g.stateGroup line { + stroke: ${e.lineColor}; + stroke-width: ${e.strokeWidth||1}; +} + +.transition { + stroke: ${e.transitionColor}; + stroke-width: ${e.strokeWidth||1}; + fill: none; +} + +.stateGroup .composit { + fill: ${e.background}; + border-bottom: 1px +} + +.stateGroup .alt-composit { + fill: #e0e0e0; + border-bottom: 1px +} + +.state-note { + stroke: ${e.noteBorderColor}; + fill: ${e.noteBkgColor}; + + text { + fill: ${e.noteTextColor}; + stroke: none; + font-size: 10px; + } +} + +.stateLabel .box { + stroke: none; + stroke-width: 0; + fill: ${e.mainBkg}; + opacity: 0.5; +} + +.edgeLabel .label rect { + fill: ${e.labelBackgroundColor}; + opacity: 0.5; +} +.edgeLabel { + background-color: ${e.edgeLabelBackground}; + p { + background-color: ${e.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; +} +.edgeLabel .label text { + fill: ${e.transitionLabelColor||e.tertiaryTextColor}; +} +.label div .edgeLabel { + color: ${e.transitionLabelColor||e.tertiaryTextColor}; +} + +.stateLabel text { + fill: ${e.stateLabelColor}; + font-size: 10px; + font-weight: bold; +} + +.node circle.state-start { + fill: ${e.specialStateColor}; + stroke: ${e.specialStateColor}; +} + +.node .fork-join { + fill: ${e.specialStateColor}; + stroke: ${e.specialStateColor}; +} + +.node circle.state-end { + fill: ${e.innerEndBackground}; + stroke: ${e.background}; + stroke-width: 1.5 +} +.end-state-inner { + fill: ${e.compositeBackground||e.background}; + // stroke: ${e.background}; + stroke-width: 1.5 +} + +.node rect { + fill: ${e.stateBkg||e.mainBkg}; + stroke: ${e.stateBorder||e.nodeBorder}; + stroke-width: ${e.strokeWidth||1}px; +} +.node polygon { + fill: ${e.mainBkg}; + stroke: ${e.stateBorder||e.nodeBorder};; + stroke-width: ${e.strokeWidth||1}px; +} +[id$="-barbEnd"] { + fill: ${e.lineColor}; +} + +.statediagram-cluster rect { + fill: ${e.compositeTitleBackground}; + stroke: ${e.stateBorder||e.nodeBorder}; + stroke-width: ${e.strokeWidth||1}px; +} + +.cluster-label, .nodeLabel { + color: ${e.stateLabelColor}; + // line-height: 1; +} + +.statediagram-cluster rect.outer { + rx: 5px; + ry: 5px; +} +.statediagram-state .divider { + stroke: ${e.stateBorder||e.nodeBorder}; +} + +.statediagram-state .title-state { + rx: 5px; + ry: 5px; +} +.statediagram-cluster.statediagram-cluster .inner { + fill: ${e.compositeBackground||e.background}; +} +.statediagram-cluster.statediagram-cluster-alt .inner { + fill: ${e.altBackground?e.altBackground:"#efefef"}; +} + +.statediagram-cluster .inner { + rx:0; + ry:0; +} + +.statediagram-state rect.basic { + rx: 5px; + ry: 5px; +} +.statediagram-state rect.divider { + stroke-dasharray: 10,10; + fill: ${e.altBackground?e.altBackground:"#efefef"}; +} + +.note-edge { + stroke-dasharray: 5; +} + +.statediagram-note rect { + fill: ${e.noteBkgColor}; + stroke: ${e.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} +.statediagram-note rect { + fill: ${e.noteBkgColor}; + stroke: ${e.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} + +.statediagram-note text { + fill: ${e.noteTextColor}; +} + +.statediagram-note .nodeLabel { + color: ${e.noteTextColor}; +} +.statediagram .edgeLabel { + color: red; // ${e.noteTextColor}; +} + +[id$="-dependencyStart"], [id$="-dependencyEnd"] { + fill: ${e.lineColor}; + stroke: ${e.lineColor}; + stroke-width: ${e.strokeWidth||1}; +} + +.statediagramTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; +} + +[data-look="neo"].statediagram-cluster rect { + fill: ${e.mainBkg}; + stroke: ${e.useGradient?"url("+e.svgId+"-gradient)":e.stateBorder||e.nodeBorder}; + stroke-width: ${e.strokeWidth??1}; +} +[data-look="neo"].statediagram-cluster rect.outer { + rx: ${e.radius}px; + ry: ${e.radius}px; + filter: ${e.dropShadow?e.dropShadow.replace("url(#drop-shadow)",`url(${e.svgId}-drop-shadow)`):"none"} +} +`,"getStyles"),o_=qCt});var UCt,HCt,YCt,jCt,n_e,XCt,KCt,ZCt,QCt,NW,i_e,a_e,s_e=z(()=>{"use strict";Rr();s_();Xt();Ir();Ut();St();UCt=o(e=>e.append("circle").attr("class","start-state").attr("r",ge().state.sizeUnit).attr("cx",ge().state.padding+ge().state.sizeUnit).attr("cy",ge().state.padding+ge().state.sizeUnit),"drawStartState"),HCt=o(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",ge().state.textHeight).attr("class","divider").attr("x2",ge().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),YCt=o((e,t)=>{let r=e.append("text").attr("x",2*ge().state.padding).attr("y",ge().state.textHeight+2*ge().state.padding).attr("font-size",ge().state.fontSize).attr("class","state-title").text(t.id),i=r.node().getBBox();return e.insert("rect",":first-child").attr("x",ge().state.padding).attr("y",ge().state.padding).attr("width",i.width+2*ge().state.padding).attr("height",i.height+2*ge().state.padding).attr("rx",ge().state.radius),r},"drawSimpleState"),jCt=o((e,t)=>{let r=o(function(p,m,g){let y=p.append("tspan").attr("x",2*ge().state.padding).text(m);g||y.attr("dy",ge().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*ge().state.padding).attr("y",ge().state.textHeight+1.3*ge().state.padding).attr("font-size",ge().state.fontSize).attr("class","state-title").text(t.descriptions[0]).node().getBBox(),a=n.height,s=e.append("text").attr("x",ge().state.padding).attr("y",a+ge().state.padding*.4+ge().state.dividerMargin+ge().state.textHeight).attr("class","state-description"),l=!0,u=!0;t.descriptions.forEach(function(p){l||(r(s,p,u),u=!1),l=!1});let h=e.append("line").attr("x1",ge().state.padding).attr("y1",ge().state.padding+a+ge().state.dividerMargin/2).attr("y2",ge().state.padding+a+ge().state.dividerMargin/2).attr("class","descr-divider"),d=s.node().getBBox(),f=Math.max(d.width,n.width);return h.attr("x2",f+3*ge().state.padding),e.insert("rect",":first-child").attr("x",ge().state.padding).attr("y",ge().state.padding).attr("width",f+2*ge().state.padding).attr("height",d.height+a+2*ge().state.padding).attr("rx",ge().state.radius),e},"drawDescrState"),n_e=o((e,t,r)=>{let i=ge().state.padding,n=2*ge().state.padding,a=e.node().getBBox(),s=a.width,l=a.x,u=e.append("text").attr("x",0).attr("y",ge().state.titleShift).attr("font-size",ge().state.fontSize).attr("class","state-title").text(t.id),d=u.node().getBBox().width+n,f=Math.max(d,s);f===s&&(f=f+n);let p,m=e.node().getBBox();t.doc,p=l-i,d>s&&(p=(s-f)/2+i),Math.abs(l-m.x)s&&(p=l-(d-s)/2);let g=1-ge().state.textHeight;return e.insert("rect",":first-child").attr("x",p).attr("y",g).attr("class",r?"alt-composit":"composit").attr("width",f).attr("height",m.height+ge().state.textHeight+ge().state.titleShift+1).attr("rx","0"),u.attr("x",p+i),d<=s&&u.attr("x",l+(f-n)/2-d/2+i),e.insert("rect",":first-child").attr("x",p).attr("y",ge().state.titleShift-ge().state.textHeight-ge().state.padding).attr("width",f).attr("height",ge().state.textHeight*3).attr("rx",ge().state.radius),e.insert("rect",":first-child").attr("x",p).attr("y",ge().state.titleShift-ge().state.textHeight-ge().state.padding).attr("width",f).attr("height",m.height+3+2*ge().state.textHeight).attr("rx",ge().state.radius),e},"addTitleAndBox"),XCt=o(e=>(e.append("circle").attr("class","end-state-outer").attr("r",ge().state.sizeUnit+ge().state.miniPadding).attr("cx",ge().state.padding+ge().state.sizeUnit+ge().state.miniPadding).attr("cy",ge().state.padding+ge().state.sizeUnit+ge().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",ge().state.sizeUnit).attr("cx",ge().state.padding+ge().state.sizeUnit+2).attr("cy",ge().state.padding+ge().state.sizeUnit+2)),"drawEndState"),KCt=o((e,t)=>{let r=ge().state.forkWidth,i=ge().state.forkHeight;if(t.parentId){let n=r;r=i,i=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",r).attr("height",i).attr("x",ge().state.padding).attr("y",ge().state.padding)},"drawForkJoinState"),ZCt=o((e,t,r,i)=>{let n=0,a=i.append("text");a.style("text-anchor","start"),a.attr("class","noteText");let s=e.replace(/\r\n/g,"
    ");s=s.replace(/\n/g,"
    ");let l=s.split(vt.lineBreakRegex),u=1.25*ge().state.noteMargin;for(let h of l){let d=h.trim();if(d.length>0){let f=a.append("tspan");if(f.text(d),u===0){let p=f.node().getBBox();u+=p.height}n+=u,f.attr("x",t+ge().state.noteMargin),f.attr("y",r+n+1.25*ge().state.noteMargin)}}return{textWidth:a.node().getBBox().width,textHeight:n}},"_drawLongText"),QCt=o((e,t)=>{t.attr("class","state-note");let r=t.append("rect").attr("x",0).attr("y",ge().state.padding),i=t.append("g"),{textWidth:n,textHeight:a}=ZCt(e,0,0,i);return r.attr("height",a+2*ge().state.noteMargin),r.attr("width",n+ge().state.noteMargin*2),r},"drawNote"),NW=o(function(e,t){let r=t.id,i={id:r,label:t.id,width:0,height:0},n=e.append("g").attr("id",r).attr("class","stateGroup");t.type==="start"&&UCt(n),t.type==="end"&&XCt(n),(t.type==="fork"||t.type==="join")&&KCt(n,t),t.type==="note"&&QCt(t.note.text,n),t.type==="divider"&&HCt(n),t.type==="default"&&t.descriptions.length===0&&YCt(n,t),t.type==="default"&&t.descriptions.length>0&&jCt(n,t);let a=n.node().getBBox();return i.width=a.width+2*ge().state.padding,i.height=a.height+2*ge().state.padding,i},"drawState"),i_e=0,a_e=o(function(e,t,r){let i=o(function(u){switch(u){case ol.relationType.AGGREGATION:return"aggregation";case ol.relationType.EXTENSION:return"extension";case ol.relationType.COMPOSITION:return"composition";case ol.relationType.DEPENDENCY:return"dependency"}},"getRelationType");t.points=t.points.filter(u=>!Number.isNaN(u.y));let n=t.points,a=_l().x(function(u){return u.x}).y(function(u){return u.y}).curve(Dl),s=e.append("path").attr("d",a(n)).attr("id","edge"+i_e).attr("class","transition"),l="";if(ge().state.arrowMarkerAbsolute&&(l=Hf(!0)),s.attr("marker-end","url("+l+"#"+i(ol.relationType.DEPENDENCY)+"End)"),r.title!==void 0){let u=e.append("g").attr("class","stateLabel"),{x:h,y:d}=Zt.calcLabelPosition(t.points),f=vt.getRows(r.title),p=0,m=[],g=0,y=0;for(let b=0;b<=f.length;b++){let T=u.append("text").attr("text-anchor","middle").text(f[b]).attr("x",h).attr("y",d+p),w=T.node().getBBox();g=Math.max(g,w.width),y=Math.min(y,w.x),Z.info(w.x,h,d+p),p===0&&(p=T.node().getBBox().height,Z.info("Title height",p,d)),m.push(T)}let v=p*f.length;if(f.length>1){let b=(f.length-1)*p*.5;m.forEach((T,w)=>T.attr("y",d+w*p-b)),v=p*f.length}let x=u.node().getBBox();u.insert("rect",":first-child").attr("class","box").attr("x",h-g/2-ge().state.padding/2).attr("y",d-v/2-ge().state.padding/2-3.5).attr("width",g+ge().state.padding).attr("height",v+ge().state.padding),Z.info(x)}i_e++},"drawEdge")});var Co,IW,JCt,ekt,tkt,rkt,o_e,l_e,c_e=z(()=>{"use strict";Rr();d9();Uo();St();Ir();s_e();Ut();Di();IW={},JCt=o(function(){},"setConf"),ekt=o(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),tkt=o(function(e,t,r,i){Co=ge().state;let n=ge().securityLevel,a;n==="sandbox"&&(a=Je("#i"+t));let s=n==="sandbox"?Je(a.nodes()[0].contentDocument.body):Je("body"),l=n==="sandbox"?a.nodes()[0].contentDocument:document;Z.debug("Rendering diagram "+e);let u=s.select(`[id='${t}']`);ekt(u);let h=i.db.getRootDoc(),d=u.append("g").attr("id",t+"-root");o_e(h,d,void 0,!1,s,l,i);let f=Co.padding,p=u.node().getBBox(),m=p.width+f*2,g=p.height+f*2,y=m*1.75;Br(u,g,y,Co.useMaxWidth),u.attr("viewBox",`${p.x-Co.padding} ${p.y-Co.padding} `+m+" "+g)},"draw"),rkt=o(e=>e?e.length*Co.fontSizeFactor:1,"getLabelWidth"),o_e=o((e,t,r,i,n,a,s)=>{let l=new ui({compound:!0,multigraph:!0}),u,h=!0;for(u=0;u{let C=w.parentElement,k=0,E=0;C&&(C.parentElement&&(k=C.parentElement.getBBox().width),E=parseInt(C.getAttribute("data-x-shift"),10),Number.isNaN(E)&&(E=0)),w.setAttribute("x1",0-E+8),w.setAttribute("x2",k-E-8)})):Z.debug("No Node "+b+": "+JSON.stringify(l.node(b)))});let v=y.getBBox();l.edges().forEach(function(b){b!==void 0&&l.edge(b)!==void 0&&(Z.debug("Edge "+b.v+" -> "+b.w+": "+JSON.stringify(l.edge(b))),a_e(t,l.edge(b),l.edge(b).relation))}),v=y.getBBox();let x={id:r||"root",label:r||"root",width:0,height:0};return x.width=v.width+2*Co.padding,x.height=v.height+2*Co.padding,Z.debug("Doc rendered",x,l),x},"renderDoc"),l_e={setConf:JCt,draw:tkt}});var u_e={};xr(u_e,{diagram:()=>ikt});var ikt,h_e=z(()=>{"use strict";yW();s_();MW();c_e();ikt={parser:Z6,get db(){return new ol(1)},renderer:l_e,styles:o_,init:o(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var p_e={};xr(p_e,{diagram:()=>okt});var okt,m_e=z(()=>{"use strict";yW();s_();MW();LW();okt={parser:Z6,get db(){return new ol(2)},renderer:J6e,styles:o_,init:o(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}});var OW,v_e,x_e=z(()=>{"use strict";OW=(function(){var e=o(function(f,p,m,g){for(m=m||{},g=f.length;g--;m[f[g]]=p);return m},"o"),t=[6,8,10,11,12,14,16,17,18],r=[1,9],i=[1,10],n=[1,11],a=[1,12],s=[1,13],l=[1,14],u={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:o(function(p,m,g,y,v,x,b){var T=x.length-1;switch(v){case 1:return x[T-1];case 2:this.$=[];break;case 3:x[T-1].push(x[T]),this.$=x[T-1];break;case 4:case 5:this.$=x[T];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(x[T].substr(6)),this.$=x[T].substr(6);break;case 9:this.$=x[T].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=x[T].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(x[T].substr(8)),this.$=x[T].substr(8);break;case 13:y.addTask(x[T-1],x[T]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:r,12:i,14:n,16:a,17:s,18:l},e(t,[2,7],{1:[2,1]}),e(t,[2,3]),{9:15,11:r,12:i,14:n,16:a,17:s,18:l},e(t,[2,5]),e(t,[2,6]),e(t,[2,8]),{13:[1,16]},{15:[1,17]},e(t,[2,11]),e(t,[2,12]),{19:[1,18]},e(t,[2,4]),e(t,[2,9]),e(t,[2,10]),e(t,[2,13])],defaultActions:{},parseError:o(function(p,m){if(m.recoverable)this.trace(p);else{var g=new Error(p);throw g.hash=m,g}},"parseError"),parse:o(function(p){var m=this,g=[0],y=[],v=[null],x=[],b=this.table,T="",w=0,C=0,k=0,E=2,A=1,N=x.slice.call(arguments,1),P=Object.create(this.lexer),I={yy:{}};for(var D in this.yy)Object.prototype.hasOwnProperty.call(this.yy,D)&&(I.yy[D]=this.yy[D]);P.setInput(p,I.yy),I.yy.lexer=P,I.yy.parser=this,typeof P.yylloc>"u"&&(P.yylloc={});var _=P.yylloc;x.push(_);var R=P.options&&P.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function M(J){g.length=g.length-2*J,v.length=v.length-J,x.length=x.length-J}o(M,"popStack");function L(){var J;return J=y.pop()||P.lex()||A,typeof J!="number"&&(J instanceof Array&&(y=J,J=y.pop()),J=m.symbols_[J]||J),J}o(L,"lex");for(var B,O,$,G,F,V,H={},j,U,Q,Y;;){if($=g[g.length-1],this.defaultActions[$]?G=this.defaultActions[$]:((B===null||typeof B>"u")&&(B=L()),G=b[$]&&b[$][B]),typeof G>"u"||!G.length||!G[0]){var ae="";Y=[];for(j in b[$])this.terminals_[j]&&j>E&&Y.push("'"+this.terminals_[j]+"'");P.showPosition?ae="Parse error on line "+(w+1)+`: +`+P.showPosition()+` +Expecting `+Y.join(", ")+", got '"+(this.terminals_[B]||B)+"'":ae="Parse error on line "+(w+1)+": Unexpected "+(B==A?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(ae,{text:P.match,token:this.terminals_[B]||B,line:P.yylineno,loc:_,expected:Y})}if(G[0]instanceof Array&&G.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+B);switch(G[0]){case 1:g.push(B),v.push(P.yytext),x.push(P.yylloc),g.push(G[1]),B=null,O?(B=O,O=null):(C=P.yyleng,T=P.yytext,w=P.yylineno,_=P.yylloc,k>0&&k--);break;case 2:if(U=this.productions_[G[1]][1],H.$=v[v.length-U],H._$={first_line:x[x.length-(U||1)].first_line,last_line:x[x.length-1].last_line,first_column:x[x.length-(U||1)].first_column,last_column:x[x.length-1].last_column},R&&(H._$.range=[x[x.length-(U||1)].range[0],x[x.length-1].range[1]]),V=this.performAction.apply(H,[T,C,w,I.yy,G[1],v,x].concat(N)),typeof V<"u")return V;U&&(g=g.slice(0,-1*U*2),v=v.slice(0,-1*U),x=x.slice(0,-1*U)),g.push(this.productions_[G[1]][0]),v.push(H.$),x.push(H._$),Q=b[g[g.length-2]][g[g.length-1]],g.push(Q);break;case 3:return!0}}return!0},"parse")},h=(function(){var f={EOF:1,parseError:o(function(m,g){if(this.yy.parser)this.yy.parser.parseError(m,g);else throw new Error(m)},"parseError"),setInput:o(function(p,m){return this.yy=m||this.yy||{},this._input=p,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var p=this._input[0];this.yytext+=p,this.yyleng++,this.offset++,this.match+=p,this.matched+=p;var m=p.match(/(?:\r\n?|\n).*/g);return m?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),p},"input"),unput:o(function(p){var m=p.length,g=p.split(/(?:\r\n?|\n)/g);this._input=p+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-m),this.offset-=m;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var v=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===y.length?this.yylloc.first_column:0)+y[y.length-g.length].length-g[0].length:this.yylloc.first_column-m},this.options.ranges&&(this.yylloc.range=[v[0],v[0]+this.yyleng-m]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(p){this.unput(this.match.slice(p))},"less"),pastInput:o(function(){var p=this.matched.substr(0,this.matched.length-this.match.length);return(p.length>20?"...":"")+p.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var p=this.match;return p.length<20&&(p+=this._input.substr(0,20-p.length)),(p.substr(0,20)+(p.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var p=this.pastInput(),m=new Array(p.length+1).join("-");return p+this.upcomingInput()+` +`+m+"^"},"showPosition"),test_match:o(function(p,m){var g,y,v;if(this.options.backtrack_lexer&&(v={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(v.yylloc.range=this.yylloc.range.slice(0))),y=p[0].match(/(?:\r\n?|\n).*/g),y&&(this.yylineno+=y.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:y?y[y.length-1].length-y[y.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+p[0].length},this.yytext+=p[0],this.match+=p[0],this.matches=p,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(p[0].length),this.matched+=p[0],g=this.performAction.call(this,this.yy,this,m,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),g)return g;if(this._backtrack){for(var x in v)this[x]=v[x];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var p,m,g,y;this._more||(this.yytext="",this.match="");for(var v=this._currentRules(),x=0;xm[0].length)){if(m=g,y=x,this.options.backtrack_lexer){if(p=this.test_match(g,v[x]),p!==!1)return p;if(this._backtrack){m=!1;continue}else return!1}else if(!this.options.flex)break}return m?(p=this.test_match(m,v[y]),p!==!1?p:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var m=this.next();return m||this.lex()},"lex"),begin:o(function(m){this.conditionStack.push(m)},"begin"),popState:o(function(){var m=this.conditionStack.length-1;return m>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(m){return m=this.conditionStack.length-1-Math.abs(m||0),m>=0?this.conditionStack[m]:"INITIAL"},"topState"),pushState:o(function(m){this.begin(m)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(m,g,y,v){var x=v;switch(y){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.begin("acc_descr"),14;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}};return f})();u.lexer=h;function d(){this.yy={}}return o(d,"Parser"),d.prototype=u,u.Parser=d,new d})();OW.parser=OW;v_e=OW});var Sy,PW,JT,eC,hkt,dkt,fkt,pkt,mkt,gkt,ykt,b_e,vkt,BW,T_e=z(()=>{"use strict";Ut();Ci();Sy="",PW=[],JT=[],eC=[],hkt=o(function(){PW.length=0,JT.length=0,Sy="",eC.length=0,gr()},"clear"),dkt=o(function(e){Sy=e,PW.push(e)},"addSection"),fkt=o(function(){return PW},"getSections"),pkt=o(function(){let e=b_e(),t=100,r=0;for(;!e&&r{r.people&&e.push(...r.people)}),[...new Set(e)].sort()},"updateActors"),gkt=o(function(e,t){let r=t.substr(1).split(":"),i=0,n=[];r.length===1?(i=Number(r[0]),n=[]):(i=Number(r[0]),n=r[1].split(","));let a=n.map(l=>l.trim()),s={section:Sy,type:Sy,people:a,task:e,score:i};eC.push(s)},"addTask"),ykt=o(function(e){let t={section:Sy,type:Sy,description:e,task:e,classes:[]};JT.push(t)},"addTaskOrg"),b_e=o(function(){let e=o(function(r){return eC[r].processed},"compileTask"),t=!0;for(let[r,i]of eC.entries())e(r),t=t&&i.processed;return t},"compileTasks"),vkt=o(function(){return mkt()},"getActors"),BW={getConfig:o(()=>ge().journey,"getConfig"),clear:hkt,setDiagramTitle:Ar,getDiagramTitle:Er,setAccTitle:Cr,getAccTitle:kr,setAccDescription:wr,getAccDescription:Sr,addSection:dkt,getSections:fkt,getTasks:pkt,addTask:gkt,addTaskOrg:ykt,getActors:vkt}});var xkt,C_e,k_e=z(()=>{"use strict";k1();xkt=o(e=>`.label { + font-family: ${e.fontFamily}; + color: ${e.textColor}; + } + .mouth { + stroke: #666; + } + + line { + stroke: ${e.textColor} + } + + .legend { + fill: ${e.textColor}; + font-family: ${e.fontFamily}; + } + + .label text { + fill: #333; + } + .label { + color: ${e.textColor} + } + + .face { + ${e.faceColor?`fill: ${e.faceColor}`:"fill: #FFF8DC"}; + stroke: #999; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: 1px; + } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${e.arrowheadColor}; + } + + .edgePath .path { + stroke: ${e.lineColor}; + stroke-width: 1.5px; + } + + .flowchart-link { + stroke: ${e.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${e.edgeLabelBackground}; + rect { + opacity: 0.5; + } + text-align: center; + } + + .cluster rect { + } + + .cluster text { + fill: ${e.titleColor}; + } + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${e.fontFamily}; + font-size: 12px; + background: ${e.tertiaryColor}; + border: 1px solid ${e.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .task-type-0, .section-type-0 { + ${e.fillType0?`fill: ${e.fillType0}`:""}; + } + .task-type-1, .section-type-1 { + ${e.fillType0?`fill: ${e.fillType1}`:""}; + } + .task-type-2, .section-type-2 { + ${e.fillType0?`fill: ${e.fillType2}`:""}; + } + .task-type-3, .section-type-3 { + ${e.fillType0?`fill: ${e.fillType3}`:""}; + } + .task-type-4, .section-type-4 { + ${e.fillType0?`fill: ${e.fillType4}`:""}; + } + .task-type-5, .section-type-5 { + ${e.fillType0?`fill: ${e.fillType5}`:""}; + } + .task-type-6, .section-type-6 { + ${e.fillType0?`fill: ${e.fillType6}`:""}; + } + .task-type-7, .section-type-7 { + ${e.fillType0?`fill: ${e.fillType7}`:""}; + } + + .actor-0 { + ${e.actor0?`fill: ${e.actor0}`:""}; + } + .actor-1 { + ${e.actor1?`fill: ${e.actor1}`:""}; + } + .actor-2 { + ${e.actor2?`fill: ${e.actor2}`:""}; + } + .actor-3 { + ${e.actor3?`fill: ${e.actor3}`:""}; + } + .actor-4 { + ${e.actor4?`fill: ${e.actor4}`:""}; + } + .actor-5 { + ${e.actor5?`fill: ${e.actor5}`:""}; + } + ${Vc()} +`,"getStyles"),C_e=xkt});var $W,bkt,w_e,S_e,Tkt,Ckt,FW,kkt,wkt,E_e,Skt,Ey,A_e=z(()=>{"use strict";Rr();gp();$W=o(function(e,t){return mp(e,t)},"drawRect"),bkt=o(function(e,t){let i=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),n=e.append("g");n.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),n.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function a(u){let h=Al().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);u.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}o(a,"smile");function s(u){let h=Al().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);u.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}o(s,"sad");function l(u){u.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return o(l,"ambivalent"),t.score>3?a(n):t.score<3?s(n):l(n),i},"drawFace"),w_e=o(function(e,t){let r=e.append("circle");return r.attr("cx",t.cx),r.attr("cy",t.cy),r.attr("class","actor-"+t.pos),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("r",t.r),r.class!==void 0&&r.attr("class",r.class),t.title!==void 0&&r.append("title").text(t.title),r},"drawCircle"),S_e=o(function(e,t){return yee(e,t)},"drawText"),Tkt=o(function(e,t){function r(n,a,s,l,u){return n+","+a+" "+(n+s)+","+a+" "+(n+s)+","+(a+l-u)+" "+(n+s-u*1.2)+","+(a+l)+" "+n+","+(a+l)}o(r,"genPoints");let i=e.append("polygon");i.attr("points",r(t.x,t.y,50,20,7)),i.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,S_e(e,t)},"drawLabel"),Ckt=o(function(e,t,r){let i=e.append("g"),n=fa();n.x=t.x,n.y=t.y,n.fill=t.fill,n.width=r.width*t.taskCount+r.diagramMarginX*(t.taskCount-1),n.height=r.height,n.class="journey-section section-type-"+t.num,n.rx=3,n.ry=3,$W(i,n),E_e(r)(t.text,i,n.x,n.y,n.width,n.height,{class:"journey-section section-type-"+t.num},r,t.colour)},"drawSection"),FW=-1,kkt=o(function(e,t,r,i){let n=t.x+r.width/2,a=e.append("g");FW++,a.append("line").attr("id",i+"-task"+FW).attr("x1",n).attr("y1",t.y).attr("x2",n).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),bkt(a,{cx:n,cy:300+(5-t.score)*30,score:t.score});let l=fa();l.x=t.x,l.y=t.y,l.fill=t.fill,l.width=r.width,l.height=r.height,l.class="task task-type-"+t.num,l.rx=3,l.ry=3,$W(a,l);let u=t.x+14;t.people.forEach(h=>{let d=t.actors[h].color,f={cx:u,cy:t.y,r:7,fill:d,stroke:"#000",title:h,pos:t.actors[h].position};w_e(a,f),u+=10}),E_e(r)(t.task,a,l.x,l.y,l.width,l.height,{class:"task"},r,t.colour)},"drawTask"),wkt=o(function(e,t){Bw(e,t)},"drawBackgroundRect"),E_e=(function(){function e(n,a,s,l,u,h,d,f){let p=a.append("text").attr("x",s+u/2).attr("y",l+h/2+5).style("font-color",f).style("text-anchor","middle").text(n);i(p,d)}o(e,"byText");function t(n,a,s,l,u,h,d,f,p){let{taskFontSize:m,taskFontFamily:g}=f,y=n.split(//gi);for(let v=0;v{let a=Ah[n].color,s={cx:20,cy:i,r:7,fill:a,stroke:"#000",pos:Ah[n].position};Ey.drawCircle(e,s);let l=e.append("text").attr("visibility","hidden").text(n),u=l.node().getBoundingClientRect().width;l.remove();let h=[];if(u<=r)h=[n];else{let d=n.split(" "),f="";l=e.append("text").attr("visibility","hidden"),d.forEach(p=>{let m=f?`${f} ${p}`:p;if(l.text(m),l.node().getBoundingClientRect().width>r){if(f&&h.push(f),f=p,l.text(p),l.node().getBoundingClientRect().width>r){let y="";for(let v of p)y+=v,l.text(y+"-"),l.node().getBoundingClientRect().width>r&&(h.push(y.slice(0,-1)+"-"),y=v);f=y}}else f=m}),f&&h.push(f),l.remove()}h.forEach((d,f)=>{let p={x:40,y:i+7+f*20,fill:"#666",text:d,textMargin:t.boxTextMargin??5},g=Ey.drawText(e,p).node().getBoundingClientRect().width;g>l_&&g>t.leftMargin-g&&(l_=g)}),i+=Math.max(20,h.length*20)})}var Ekt,Ah,l_,Zl,Mf,_kt,ll,zW,__e,Dkt,GW,D_e=z(()=>{"use strict";Rr();A_e();Ut();Di();Ekt=o(function(e){Object.keys(e).forEach(function(r){Zl[r]=e[r]})},"setConf"),Ah={},l_=0;o(Akt,"drawActorLegend");Zl=ge().journey,Mf=0,_kt=o(function(e,t,r,i){let n=ge(),a=n.journey.titleColor,s=n.journey.titleFontSize,l=n.journey.titleFontFamily,u=n.securityLevel,h;u==="sandbox"&&(h=Je("#i"+t));let d=u==="sandbox"?Je(h.nodes()[0].contentDocument.body):Je("body");ll.init();let f=d.select("#"+t);Ey.initGraphics(f,t);let p=i.db.getTasks(),m=i.db.getDiagramTitle(),g=i.db.getActors();for(let w in Ah)delete Ah[w];let y=0;g.forEach(w=>{Ah[w]={color:Zl.actorColours[y%Zl.actorColours.length],position:y},y++}),Akt(f),Mf=Zl.leftMargin+l_,ll.insert(0,0,Mf,Object.keys(Ah).length*50),Dkt(f,p,0,t);let v=ll.getBounds();m&&f.append("text").text(m).attr("x",Mf).attr("font-size",s).attr("font-weight","bold").attr("y",25).attr("fill",a).attr("font-family",l);let x=v.stopy-v.starty+2*Zl.diagramMarginY,b=Mf+v.stopx+2*Zl.diagramMarginX;Br(f,x,b,Zl.useMaxWidth),f.append("line").attr("x1",Mf).attr("y1",Zl.height*4).attr("x2",b-Mf-4).attr("y2",Zl.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#"+t+"-arrowhead)");let T=m?70:0;f.attr("viewBox",`${v.startx} -25 ${b} ${x+T}`),f.attr("preserveAspectRatio","xMinYMin meet"),f.attr("height",x+T+25)},"draw"),ll={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:o(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:o(function(e,t,r,i){e[t]===void 0?e[t]=r:e[t]=i(r,e[t])},"updateVal"),updateBounds:o(function(e,t,r,i){let n=ge().journey,a=this,s=0;function l(u){return o(function(d){s++;let f=a.sequenceItems.length-s+1;a.updateVal(d,"starty",t-f*n.boxMargin,Math.min),a.updateVal(d,"stopy",i+f*n.boxMargin,Math.max),a.updateVal(ll.data,"startx",e-f*n.boxMargin,Math.min),a.updateVal(ll.data,"stopx",r+f*n.boxMargin,Math.max),u!=="activation"&&(a.updateVal(d,"startx",e-f*n.boxMargin,Math.min),a.updateVal(d,"stopx",r+f*n.boxMargin,Math.max),a.updateVal(ll.data,"starty",t-f*n.boxMargin,Math.min),a.updateVal(ll.data,"stopy",i+f*n.boxMargin,Math.max))},"updateItemBounds")}o(l,"updateFn"),this.sequenceItems.forEach(l())},"updateBounds"),insert:o(function(e,t,r,i){let n=Math.min(e,r),a=Math.max(e,r),s=Math.min(t,i),l=Math.max(t,i);this.updateVal(ll.data,"startx",n,Math.min),this.updateVal(ll.data,"starty",s,Math.min),this.updateVal(ll.data,"stopx",a,Math.max),this.updateVal(ll.data,"stopy",l,Math.max),this.updateBounds(n,s,a,l)},"insert"),bumpVerticalPos:o(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:o(function(){return this.verticalPos},"getVerticalPos"),getBounds:o(function(){return this.data},"getBounds")},zW=Zl.sectionFills,__e=Zl.sectionColours,Dkt=o(function(e,t,r,i){let n=ge().journey,a="",s=n.height*2+n.diagramMarginY,l=r+s,u=0,h="#CCC",d="black",f=0;for(let[p,m]of t.entries()){if(a!==m.section){h=zW[u%zW.length],f=u%zW.length,d=__e[u%__e.length];let y=0,v=m.section;for(let b=p;b(Ah[v]&&(y[v]=Ah[v]),y),{});m.x=p*n.taskMargin+p*n.width+Mf,m.y=l,m.width=n.diagramMarginX,m.height=n.diagramMarginY,m.colour=d,m.fill=h,m.num=f,m.actors=g,Ey.drawTask(e,m,n,i),ll.insert(m.x,m.y,m.x+m.width+n.taskMargin,450)}},"drawTasks"),GW={setConf:Ekt,draw:_kt}});var R_e={};xr(R_e,{diagram:()=>Rkt});var Rkt,L_e=z(()=>{"use strict";x_e();T_e();k_e();D_e();Rkt={parser:v_e,db:BW,renderer:GW,styles:C_e,init:o(e=>{GW.setConf(e.journey),BW.clear()},"init")}});var WW,F_e,$_e=z(()=>{"use strict";WW=(function(){var e=o(function(p,m,g,y){for(g=g||{},y=p.length;y--;g[p[y]]=m);return g},"o"),t=[6,11,13,14,15,17,19,20,23,24],r=[1,12],i=[1,13],n=[1,14],a=[1,15],s=[1,16],l=[1,19],u=[1,20],h={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o(function(m,g,y,v,x,b,T){var w=b.length-1;switch(x){case 1:return b[w-1];case 3:v.setDirection("LR");break;case 4:v.setDirection("TD");break;case 5:this.$=[];break;case 6:b[w-1].push(b[w]),this.$=b[w-1];break;case 7:case 8:this.$=b[w];break;case 9:case 10:this.$=[];break;case 11:v.getCommonDb().setDiagramTitle(b[w].substr(6)),this.$=b[w].substr(6);break;case 12:this.$=b[w].trim(),v.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=b[w].trim(),v.getCommonDb().setAccDescription(this.$);break;case 15:v.addSection(b[w].substr(8)),this.$=b[w].substr(8);break;case 18:v.addTask(b[w],0,""),this.$=b[w];break;case 19:v.addEvent(b[w].substr(2)),this.$=b[w];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:r,15:i,17:n,19:a,20:s,21:17,22:18,23:l,24:u},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:r,15:i,17:n,19:a,20:s,21:17,22:18,23:l,24:u},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o(function(m,g){if(g.recoverable)this.trace(m);else{var y=new Error(m);throw y.hash=g,y}},"parseError"),parse:o(function(m){var g=this,y=[0],v=[],x=[null],b=[],T=this.table,w="",C=0,k=0,E=0,A=2,N=1,P=b.slice.call(arguments,1),I=Object.create(this.lexer),D={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(D.yy[_]=this.yy[_]);I.setInput(m,D.yy),D.yy.lexer=I,D.yy.parser=this,typeof I.yylloc>"u"&&(I.yylloc={});var R=I.yylloc;b.push(R);var M=I.options&&I.options.ranges;typeof D.yy.parseError=="function"?this.parseError=D.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function L(te){y.length=y.length-2*te,x.length=x.length-te,b.length=b.length-te}o(L,"popStack");function B(){var te;return te=v.pop()||I.lex()||N,typeof te!="number"&&(te instanceof Array&&(v=te,te=v.pop()),te=g.symbols_[te]||te),te}o(B,"lex");for(var O,$,G,F,V,H,j={},U,Q,Y,ae;;){if(G=y[y.length-1],this.defaultActions[G]?F=this.defaultActions[G]:((O===null||typeof O>"u")&&(O=B()),F=T[G]&&T[G][O]),typeof F>"u"||!F.length||!F[0]){var J="";ae=[];for(U in T[G])this.terminals_[U]&&U>A&&ae.push("'"+this.terminals_[U]+"'");I.showPosition?J="Parse error on line "+(C+1)+`: +`+I.showPosition()+` +Expecting `+ae.join(", ")+", got '"+(this.terminals_[O]||O)+"'":J="Parse error on line "+(C+1)+": Unexpected "+(O==N?"end of input":"'"+(this.terminals_[O]||O)+"'"),this.parseError(J,{text:I.match,token:this.terminals_[O]||O,line:I.yylineno,loc:R,expected:ae})}if(F[0]instanceof Array&&F.length>1)throw new Error("Parse Error: multiple actions possible at state: "+G+", token: "+O);switch(F[0]){case 1:y.push(O),x.push(I.yytext),b.push(I.yylloc),y.push(F[1]),O=null,$?(O=$,$=null):(k=I.yyleng,w=I.yytext,C=I.yylineno,R=I.yylloc,E>0&&E--);break;case 2:if(Q=this.productions_[F[1]][1],j.$=x[x.length-Q],j._$={first_line:b[b.length-(Q||1)].first_line,last_line:b[b.length-1].last_line,first_column:b[b.length-(Q||1)].first_column,last_column:b[b.length-1].last_column},M&&(j._$.range=[b[b.length-(Q||1)].range[0],b[b.length-1].range[1]]),H=this.performAction.apply(j,[w,k,C,D.yy,F[1],x,b].concat(P)),typeof H<"u")return H;Q&&(y=y.slice(0,-1*Q*2),x=x.slice(0,-1*Q),b=b.slice(0,-1*Q)),y.push(this.productions_[F[1]][0]),x.push(j.$),b.push(j._$),Y=T[y[y.length-2]][y[y.length-1]],y.push(Y);break;case 3:return!0}}return!0},"parse")},d=(function(){var p={EOF:1,parseError:o(function(g,y){if(this.yy.parser)this.yy.parser.parseError(g,y);else throw new Error(g)},"parseError"),setInput:o(function(m,g){return this.yy=g||this.yy||{},this._input=m,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var g=m.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},"input"),unput:o(function(m){var g=m.length,y=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var v=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),y.length-1&&(this.yylineno-=y.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:y?(y.length===v.length?this.yylloc.first_column:0)+v[v.length-y.length].length-y[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(m){this.unput(this.match.slice(m))},"less"),pastInput:o(function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var m=this.pastInput(),g=new Array(m.length+1).join("-");return m+this.upcomingInput()+` +`+g+"^"},"showPosition"),test_match:o(function(m,g){var y,v,x;if(this.options.backtrack_lexer&&(x={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(x.yylloc.range=this.yylloc.range.slice(0))),v=m[0].match(/(?:\r\n?|\n).*/g),v&&(this.yylineno+=v.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:v?v[v.length-1].length-v[v.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+m[0].length},this.yytext+=m[0],this.match+=m[0],this.matches=m,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(m[0].length),this.matched+=m[0],y=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y)return y;if(this._backtrack){for(var b in x)this[b]=x[b];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var m,g,y,v;this._more||(this.yytext="",this.match="");for(var x=this._currentRules(),b=0;bg[0].length)){if(g=y,v=b,this.options.backtrack_lexer){if(m=this.test_match(y,x[b]),m!==!1)return m;if(this._backtrack){g=!1;continue}else return!1}else if(!this.options.flex)break}return g?(m=this.test_match(g,x[v]),m!==!1?m:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var g=this.next();return g||this.lex()},"lex"),begin:o(function(g){this.conditionStack.push(g)},"begin"),popState:o(function(){var g=this.conditionStack.length-1;return g>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(g){return g=this.conditionStack.length-1-Math.abs(g||0),g>=0?this.conditionStack[g]:"INITIAL"},"topState"),pushState:o(function(g){this.begin(g)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(g,y,v,x){var b=x;switch(v){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;break;case 10:return this.popState(),"acc_title_value";break;case 11:return this.begin("acc_descr"),17;break;case 12:return this.popState(),"acc_descr_value";break;case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}};return p})();h.lexer=d;function f(){this.yy={}}return o(f,"Parser"),f.prototype=h,h.Parser=f,new f})();WW.parser=WW;F_e=WW});var HW={};xr(HW,{addEvent:()=>K_e,addSection:()=>H_e,addTask:()=>X_e,addTaskOrg:()=>Z_e,clear:()=>W_e,default:()=>$kt,getCommonDb:()=>V_e,getDirection:()=>U_e,getSections:()=>Y_e,getTasks:()=>j_e,setDirection:()=>q_e});var Ay,G_e,qW,UW,c_,_y,V_e,W_e,q_e,U_e,H_e,Y_e,j_e,X_e,K_e,Z_e,z_e,$kt,Q_e=z(()=>{"use strict";Ci();Ay="",G_e=0,qW="LR",UW=[],c_=[],_y=[],V_e=o(()=>wv,"getCommonDb"),W_e=o(function(){UW.length=0,c_.length=0,Ay="",_y.length=0,qW="LR",gr()},"clear"),q_e=o(function(e){qW=e},"setDirection"),U_e=o(function(){return qW},"getDirection"),H_e=o(function(e){Ay=e,UW.push(e)},"addSection"),Y_e=o(function(){return UW},"getSections"),j_e=o(function(){let e=z_e(),t=100,r=0;for(;!e&&rr.id===G_e-1).events.push(e)},"addEvent"),Z_e=o(function(e){let t={section:Ay,type:Ay,description:e,task:e,classes:[]};c_.push(t)},"addTaskOrg"),z_e=o(function(){let e=o(function(r){return _y[r].processed},"compileTask"),t=!0;for(let[r,i]of _y.entries())e(r),t=t&&i.processed;return t},"compileTasks"),$kt={clear:W_e,getCommonDb:V_e,getDirection:U_e,setDirection:q_e,addSection:H_e,getSections:Y_e,getTasks:j_e,addTask:X_e,addTaskOrg:Z_e,addEvent:K_e}});function r7e(e,t){e.each(function(){var r=Je(this),i=r.text().split(/(\s+|
    )/).reverse(),n,a=[],s=1.1,l=r.attr("y"),u=parseFloat(r.attr("dy")),h=r.text(null).append("tspan").attr("x",0).attr("y",l).attr("dy",u+"em");for(let d=0;dt||n==="
    ")&&(a.pop(),h.text(a.join(" ").trim()),n==="
    "?a=[""]:a=[n],h=r.append("tspan").attr("x",0).attr("y",l).attr("dy",s+"em").text(n))})}var J_e,u_,zkt,Gkt,e7e,Vkt,Wkt,YW,qkt,Ukt,Hkt,jW,t7e,Ykt,jkt,Xkt,Kkt,Fa,XW=z(()=>{"use strict";Rr();J_e=0,u_=o(function(e,t){let r=e.append("rect");return r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),r.attr("rx",t.rx),r.attr("ry",t.ry),t.class!==void 0&&r.attr("class",t.class),r},"drawRect"),zkt=o(function(e,t){let i=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),n=e.append("g");n.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),n.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function a(u){let h=Al().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);u.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}o(a,"smile");function s(u){let h=Al().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);u.append("path").attr("class","mouth").attr("d",h).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}o(s,"sad");function l(u){u.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return o(l,"ambivalent"),t.score>3?a(n):t.score<3?s(n):l(n),i},"drawFace"),Gkt=o(function(e,t){let r=e.append("circle");return r.attr("cx",t.cx),r.attr("cy",t.cy),r.attr("class","actor-"+t.pos),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("r",t.r),r.class!==void 0&&r.attr("class",r.class),t.title!==void 0&&r.append("title").text(t.title),r},"drawCircle"),e7e=o(function(e,t){let r=t.text.replace(//gi," "),i=e.append("text");i.attr("x",t.x),i.attr("y",t.y),i.attr("class","legend"),i.style("text-anchor",t.anchor),t.class!==void 0&&i.attr("class",t.class);let n=i.append("tspan");return n.attr("x",t.x+t.textMargin*2),n.text(r),i},"drawText"),Vkt=o(function(e,t){function r(n,a,s,l,u){return n+","+a+" "+(n+s)+","+a+" "+(n+s)+","+(a+l-u)+" "+(n+s-u*1.2)+","+(a+l)+" "+n+","+(a+l)}o(r,"genPoints");let i=e.append("polygon");i.attr("points",r(t.x,t.y,50,20,7)),i.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,e7e(e,t)},"drawLabel"),Wkt=o(function(e,t,r){let i=e.append("g"),n=jW();n.x=t.x,n.y=t.y,n.fill=t.fill,n.width=r.width,n.height=r.height,n.class="journey-section section-type-"+t.num,n.rx=3,n.ry=3,u_(i,n),t7e(r)(t.text,i,n.x,n.y,n.width,n.height,{class:"journey-section section-type-"+t.num},r,t.colour)},"drawSection"),YW=-1,qkt=o(function(e,t,r,i){let n=t.x+r.width/2,a=e.append("g");YW++,a.append("line").attr("id",i+"-task"+YW).attr("x1",n).attr("y1",t.y).attr("x2",n).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),zkt(a,{cx:n,cy:300+(5-t.score)*30,score:t.score});let l=jW();l.x=t.x,l.y=t.y,l.fill=t.fill,l.width=r.width,l.height=r.height,l.class="task task-type-"+t.num,l.rx=3,l.ry=3,u_(a,l),t7e(r)(t.task,a,l.x,l.y,l.width,l.height,{class:"task"},r,t.colour)},"drawTask"),Ukt=o(function(e,t){u_(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),Hkt=o(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),jW=o(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),t7e=(function(){function e(n,a,s,l,u,h,d,f){let p=a.append("text").attr("x",s+u/2).attr("y",l+h/2+5).style("font-color",f).style("text-anchor","middle").text(n);i(p,d)}o(e,"byText");function t(n,a,s,l,u,h,d,f,p){let{taskFontSize:m,taskFontFamily:g}=f,y=n.split(//gi);for(let v=0;v0?`M0 ${t.height-l} v${-t.height+2*l} q0,-${s},${s},-${s} h${t.width-2*l} q${s},0,${s},${s} v${t.height-l} H0 Z`:`M0 ${t.height-l} v${-(t.height-l)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",i+"-node-"+J_e++).attr("class","node-bkg node-"+t.type).attr("d",u),a?.includes("redux")||e.append("line").attr("class","node-line-"+r).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),Fa={drawRect:u_,drawCircle:Gkt,drawSection:Wkt,drawText:e7e,drawLabel:Vkt,drawTask:qkt,drawBackgroundRect:Ukt,getTextObj:Hkt,getNoteRect:jW,initGraphics:Ykt,drawNode:jkt,getVirtualNodeHeight:Xkt}});var Zkt,i7e,Qkt,n7e,a7e=z(()=>{"use strict";Rr();XW();St();Ut();Di();Zkt=o(function(e,t,r,i){let n=ge(),{look:a,theme:s,themeVariables:l}=n,{useGradient:u,gradientStart:h,gradientStop:d}=l,f=n.timeline?.leftMargin??50;Z.debug("timeline",i.db);let p=n.securityLevel,m;p==="sandbox"&&(m=Je("#i"+t));let y=(p==="sandbox"?Je(m.nodes()[0].contentDocument.body):Je("body")).select("#"+t);y.append("g");let v=i.db.getTasks(),x=i.db.getCommonDb().getDiagramTitle();Z.debug("task",v),Fa.initGraphics(y,t);let b=i.db.getSections();Z.debug("sections",b);let T=0,w=0,C=0,k=0,E=50+f,A=50;k=50;let N=0,P=!0;b.forEach(function(M){let L={number:N,descr:M,section:N,width:150,padding:20,maxHeight:T},B=Fa.getVirtualNodeHeight(y,L,n);Z.debug("sectionHeight before draw",B),T=Math.max(T,B+20)});let I=0,D=0;Z.debug("tasks.length",v.length);for(let[M,L]of v.entries()){let B={number:M,descr:L,section:L.section,width:150,padding:20,maxHeight:w},O=Fa.getVirtualNodeHeight(y,B,n);Z.debug("taskHeight before draw",O),w=Math.max(w,O+20),I=Math.max(I,L.events.length);let $=0;for(let G of L.events){let F={descr:G,section:L.section,number:L.section,width:150,padding:20,maxHeight:50};$+=Fa.getVirtualNodeHeight(y,F,n)}L.events.length>0&&($+=(L.events.length-1)*10),D=Math.max(D,$)}Z.debug("maxSectionHeight before draw",T),Z.debug("maxTaskHeight before draw",w),b&&b.length>0?b.forEach(M=>{let L=v.filter(G=>G.section===M),B={number:N,descr:M,section:N,width:200*Math.max(L.length,1)-50,padding:20,maxHeight:T};Z.debug("sectionNode",B);let O=y.append("g"),$=Fa.drawNode(O,B,N,n,t);Z.debug("sectionNode output",$),O.attr("transform",`translate(${E}, ${k})`),A+=T+50,L.length>0&&i7e(y,L,N,E,A,w,n,I,D,T,!1,t),E+=200*Math.max(L.length,1),A=k,N++}):(P=!1,i7e(y,v,N,E,A,w,n,I,D,T,!0,t));let _=y.node().getBBox();if(Z.debug("bounds",_),x&&y.append("text").text(x).attr("x",a==="neo"?_.x*2+f:_.width/2-f).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),C=P?T+w+150:w+100,y.append("g").attr("class","lineWrapper").append("line").attr("x1",f).attr("y1",C).attr("x2",_.width+3*f).attr("y2",C).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),a==="neo"&&u&&s!=="neutral"){let M=y.select("defs"),B=(M.empty()?y.append("defs"):M).append("linearGradient").attr("id",y.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");B.append("stop").attr("offset","0%").attr("stop-color",h).attr("stop-opacity",1),B.append("stop").attr("offset","100%").attr("stop-color",d).attr("stop-opacity",1)}Io(void 0,y,n.timeline?.padding??50,n.timeline?.useMaxWidth??!1)},"draw"),i7e=o(function(e,t,r,i,n,a,s,l,u,h,d,f){for(let p of t){let m={descr:p.task,section:r,number:r,width:150,padding:20,maxHeight:a};Z.debug("taskNode",m);let g=e.append("g").attr("class","taskWrapper"),v=Fa.drawNode(g,m,r,s,f).height;if(Z.debug("taskHeight after draw",v),g.attr("transform",`translate(${i}, ${n})`),a=Math.max(a,v),p.events){let x=e.append("g").attr("class","lineWrapper"),b=a;n+=100,b=b+Qkt(e,p.events,r,i,n,s,f),n-=100,x.append("line").attr("x1",i+190/2).attr("y1",n+a).attr("x2",i+190/2).attr("y2",n+a+100+u+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${f}-arrowhead)`).attr("stroke-dasharray","5,5")}i=i+200,d&&!s.timeline?.disableMulticolor&&r++}n=n-10},"drawTasks"),Qkt=o(function(e,t,r,i,n,a,s){let l=0,u=n;n=n+100;for(let h of t){let d={descr:h,section:r,number:r,width:150,padding:20,maxHeight:50};Z.debug("eventNode",d);let f=e.append("g").attr("class","eventWrapper"),m=Fa.drawNode(f,d,r,a,s,!0).height;l=l+m,f.attr("transform",`translate(${i}, ${n})`),n=n+10+m}return n=u,l},"drawEvents"),n7e={setConf:o(()=>{},"setConf"),draw:Zkt}});var h_,_h,Jkt,KW,ewt,c7e,twt,s7e,u7e,o7e,h7e,rwt,l7e,iwt,d7e,f7e=z(()=>{"use strict";XW();St();Ut();Di();ps();Xt();h_=200,_h=5,Jkt=h_+_h*2,KW=h_+100,ewt=KW+_h*2,c7e=10,twt=0,s7e=20,u7e=20,o7e=30,h7e=50,rwt=o(function(e,t,r,i){let n=ge(),a=n.timeline?.leftMargin??50;Z.debug("timeline",i.db);let s=bi(t);s.append("g");let l=i.db.getTasks(),u=i.db.getCommonDb().getDiagramTitle();Z.debug("task",l),Fa.initGraphics(s);let h=i.db.getSections();Z.debug("sections",h);let d=0,f=0,p=50+a,m=50,g=m,y=p,v=Jkt+u7e,x=ewt+h7e,b=y+v,T=0,w=h&&h.length>0,C=w?b:p+v,k=Math.max(50,v+x-_h*2);h.forEach(function(M){let L={number:T,descr:M,section:T,width:k,padding:_h,maxHeight:d},B=Fa.getVirtualNodeHeight(s,L,n);Z.debug("sectionHeight before draw",B),d=Math.max(d,B)});let E=0;Z.debug("tasks.length",l.length);for(let[M,L]of l.entries()){let B={number:M,descr:L,section:L.section,width:h_,padding:_h,maxHeight:f},O=Fa.getVirtualNodeHeight(s,B,n);Z.debug("taskHeight before draw",O),f=Math.max(f,O);let $=0;for(let G of L.events){let F={descr:G,section:L.section,number:L.section,width:KW,padding:_h,maxHeight:50};$+=Fa.getVirtualNodeHeight(s,F,n)}L.events.length>0&&($+=(L.events.length-1)*c7e),E=Math.max(E,$)+twt}Z.debug("maxSectionHeight before draw",d),Z.debug("maxTaskHeight before draw",f);let N=Math.max(f,E)+o7e;w?h.forEach(M=>{let L=l.filter(j=>j.section===M),B={number:T,descr:M,section:T,width:k,padding:_h,maxHeight:d};Z.debug("sectionNode",B);let O=s.append("g"),$=Fa.drawNode(O,B,T,n);Z.debug("sectionNode output",$);let G=C-v;O.attr("transform",`translate(${G}, ${m})`);let F=m+$.height+s7e;L.length>0&&l7e(s,L,T,C,F,f,n,N,!1);let V=L.length,H=$.height+s7e+N*Math.max(V,1)-(V>0?o7e*2:0);m+=H,T++}):l7e(s,l,T,C,m,f,n,N,!0);let P=s.node()?.getBBox();if(!P)throw new Error("bbox not found");if(Z.debug("bounds",P),u){if(s.append("text").text(u).attr("x",P.width/2-a).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),P=s.node()?.getBBox(),!P)throw new Error("bbox not found");Z.debug("bounds after title",P)}let[I]=Za(n.fontSize),D=(I??16)*2,_=(I??16)*.5+20,R=s.append("g").attr("class","lineWrapper");R.append("line").attr("x1",C).attr("y1",g-D).attr("x2",C).attr("y2",P.y+P.height+_).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),R.lower(),Io(void 0,s,n.timeline?.padding??50,n.timeline?.useMaxWidth??!1)},"draw"),l7e=o(function(e,t,r,i,n,a,s,l,u){for(let h of t){let d={descr:h.task,section:r,number:r,width:h_,padding:_h,maxHeight:a};Z.debug("taskNode",d);let f=e.append("g").attr("class","taskWrapper"),p=Fa.drawNode(f,d,r,s),m=p.height;Z.debug("taskHeight after draw",m);let g=i-u7e-p.width;if(f.attr("transform",`translate(${g}, ${n})`),a=Math.max(a,m),h.events&&h.events.length>0){let y=n,v=i+h7e;iwt(e,h.events,r,i,v,y,s)}n=n+l,u&&!s.timeline?.disableMulticolor&&r++}},"drawTasks"),iwt=o(function(e,t,r,i,n,a,s){let l=a;for(let u of t){let h={descr:u,section:r,number:r,width:KW,padding:_h,maxHeight:0};Z.debug("eventNode",h);let d=e.append("g").attr("class","eventWrapper"),p=Fa.drawNode(d,h,r,s).height;d.attr("transform",`translate(${n}, ${l})`);let m=e.append("g").attr("class","lineWrapper"),g=l+p/2;m.append("line").attr("x1",i).attr("y1",g).attr("x2",n).attr("y2",g).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),l=l+p+c7e}return l-a},"drawEvents"),d7e={setConf:o(()=>{},"setConf"),draw:rwt}});var nwt,awt,swt,p7e,m7e=z(()=>{"use strict";Cn();br();nwt=o(e=>{let{theme:t}=Nt(),r=t?.includes("dark"),i=t?.includes("color"),n=e.svgId?.replace(/^#/,"")??"",a=n?`url(#${n}-drop-shadow)`:e.dropShadow??"none",s="";for(let l=0;l{let t="";for(let r=0;r{let{theme:t}=Nt(),r=t?.includes("redux"),i=t==="neutral",n=e.svgId?.replace(/^#/,"")??"",a="";if(e.useGradient&&n&&e.THEME_COLOR_LIMIT&&!i)for(let s=0;slwt});var owt,lwt,y7e=z(()=>{"use strict";$_e();Q_e();a7e();f7e();m7e();owt={setConf:o(()=>{},"setConf"),draw:o((e,t,r,i)=>(i?.db?.getDirection?.()??"LR")==="TD"?d7e.draw(e,t,r,i):n7e.draw(e,t,r,i),"draw")},lwt={db:HW,renderer:owt,parser:F_e,styles:p7e}});var ZW,b7e,T7e=z(()=>{"use strict";ZW=(function(){var e=o(function(w,C,k,E){for(k=k||{},E=w.length;E--;k[w[E]]=C);return k},"o"),t=[1,4],r=[1,13],i=[1,12],n=[1,15],a=[1,16],s=[1,20],l=[1,19],u=[6,7,8],h=[1,26],d=[1,24],f=[1,25],p=[6,7,11],m=[1,6,13,15,16,19,22],g=[1,33],y=[1,34],v=[1,6,7,11,13,15,16,19,22],x={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:o(function(C,k,E,A,N,P,I){var D=P.length-1;switch(N){case 6:case 7:return A;case 8:A.getLogger().trace("Stop NL ");break;case 9:A.getLogger().trace("Stop EOF ");break;case 11:A.getLogger().trace("Stop NL2 ");break;case 12:A.getLogger().trace("Stop EOF2 ");break;case 15:A.getLogger().info("Node: ",P[D].id),A.addNode(P[D-1].length,P[D].id,P[D].descr,P[D].type);break;case 16:A.getLogger().trace("Icon: ",P[D]),A.decorateNode({icon:P[D]});break;case 17:case 21:A.decorateNode({class:P[D]});break;case 18:A.getLogger().trace("SPACELIST");break;case 19:A.getLogger().trace("Node: ",P[D].id),A.addNode(0,P[D].id,P[D].descr,P[D].type);break;case 20:A.decorateNode({icon:P[D]});break;case 25:A.getLogger().trace("node found ..",P[D-2]),this.$={id:P[D-1],descr:P[D-1],type:A.getType(P[D-2],P[D])};break;case 26:this.$={id:P[D],descr:P[D],type:A.nodeType.DEFAULT};break;case 27:A.getLogger().trace("node found ..",P[D-3]),this.$={id:P[D-3],descr:P[D-1],type:A.getType(P[D-2],P[D])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:i,14:14,15:n,16:a,17:17,18:18,19:s,22:l},e(u,[2,3]),{1:[2,2]},e(u,[2,4]),e(u,[2,5]),{1:[2,6],6:r,12:21,13:i,14:14,15:n,16:a,17:17,18:18,19:s,22:l},{6:r,9:22,12:11,13:i,14:14,15:n,16:a,17:17,18:18,19:s,22:l},{6:h,7:d,10:23,11:f},e(p,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:l}),e(p,[2,18]),e(p,[2,19]),e(p,[2,20]),e(p,[2,21]),e(p,[2,23]),e(p,[2,24]),e(p,[2,26],{19:[1,30]}),{20:[1,31]},{6:h,7:d,10:32,11:f},{1:[2,7],6:r,12:21,13:i,14:14,15:n,16:a,17:17,18:18,19:s,22:l},e(m,[2,14],{7:g,11:y}),e(v,[2,8]),e(v,[2,9]),e(v,[2,10]),e(p,[2,15]),e(p,[2,16]),e(p,[2,17]),{20:[1,35]},{21:[1,36]},e(m,[2,13],{7:g,11:y}),e(v,[2,11]),e(v,[2,12]),{21:[1,37]},e(p,[2,25]),e(p,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(C,k){if(k.recoverable)this.trace(C);else{var E=new Error(C);throw E.hash=k,E}},"parseError"),parse:o(function(C){var k=this,E=[0],A=[],N=[null],P=[],I=this.table,D="",_=0,R=0,M=0,L=2,B=1,O=P.slice.call(arguments,1),$=Object.create(this.lexer),G={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(G.yy[F]=this.yy[F]);$.setInput(C,G.yy),G.yy.lexer=$,G.yy.parser=this,typeof $.yylloc>"u"&&($.yylloc={});var V=$.yylloc;P.push(V);var H=$.options&&$.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function j(we){E.length=E.length-2*we,N.length=N.length-we,P.length=P.length-we}o(j,"popStack");function U(){var we;return we=A.pop()||$.lex()||B,typeof we!="number"&&(we instanceof Array&&(A=we,we=A.pop()),we=k.symbols_[we]||we),we}o(U,"lex");for(var Q,Y,ae,J,te,re,ee={},Te,ue,De,Ie;;){if(ae=E[E.length-1],this.defaultActions[ae]?J=this.defaultActions[ae]:((Q===null||typeof Q>"u")&&(Q=U()),J=I[ae]&&I[ae][Q]),typeof J>"u"||!J.length||!J[0]){var Ee="";Ie=[];for(Te in I[ae])this.terminals_[Te]&&Te>L&&Ie.push("'"+this.terminals_[Te]+"'");$.showPosition?Ee="Parse error on line "+(_+1)+`: +`+$.showPosition()+` +Expecting `+Ie.join(", ")+", got '"+(this.terminals_[Q]||Q)+"'":Ee="Parse error on line "+(_+1)+": Unexpected "+(Q==B?"end of input":"'"+(this.terminals_[Q]||Q)+"'"),this.parseError(Ee,{text:$.match,token:this.terminals_[Q]||Q,line:$.yylineno,loc:V,expected:Ie})}if(J[0]instanceof Array&&J.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ae+", token: "+Q);switch(J[0]){case 1:E.push(Q),N.push($.yytext),P.push($.yylloc),E.push(J[1]),Q=null,Y?(Q=Y,Y=null):(R=$.yyleng,D=$.yytext,_=$.yylineno,V=$.yylloc,M>0&&M--);break;case 2:if(ue=this.productions_[J[1]][1],ee.$=N[N.length-ue],ee._$={first_line:P[P.length-(ue||1)].first_line,last_line:P[P.length-1].last_line,first_column:P[P.length-(ue||1)].first_column,last_column:P[P.length-1].last_column},H&&(ee._$.range=[P[P.length-(ue||1)].range[0],P[P.length-1].range[1]]),re=this.performAction.apply(ee,[D,R,_,G.yy,J[1],N,P].concat(O)),typeof re<"u")return re;ue&&(E=E.slice(0,-1*ue*2),N=N.slice(0,-1*ue),P=P.slice(0,-1*ue)),E.push(this.productions_[J[1]][0]),N.push(ee.$),P.push(ee._$),De=I[E[E.length-2]][E[E.length-1]],E.push(De);break;case 3:return!0}}return!0},"parse")},b=(function(){var w={EOF:1,parseError:o(function(k,E){if(this.yy.parser)this.yy.parser.parseError(k,E);else throw new Error(k)},"parseError"),setInput:o(function(C,k){return this.yy=k||this.yy||{},this._input=C,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var C=this._input[0];this.yytext+=C,this.yyleng++,this.offset++,this.match+=C,this.matched+=C;var k=C.match(/(?:\r\n?|\n).*/g);return k?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),C},"input"),unput:o(function(C){var k=C.length,E=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-k),this.offset-=k;var A=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var N=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===A.length?this.yylloc.first_column:0)+A[A.length-E.length].length-E[0].length:this.yylloc.first_column-k},this.options.ranges&&(this.yylloc.range=[N[0],N[0]+this.yyleng-k]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(C){this.unput(this.match.slice(C))},"less"),pastInput:o(function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var C=this.pastInput(),k=new Array(C.length+1).join("-");return C+this.upcomingInput()+` +`+k+"^"},"showPosition"),test_match:o(function(C,k){var E,A,N;if(this.options.backtrack_lexer&&(N={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(N.yylloc.range=this.yylloc.range.slice(0))),A=C[0].match(/(?:\r\n?|\n).*/g),A&&(this.yylineno+=A.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:A?A[A.length-1].length-A[A.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+C[0].length},this.yytext+=C[0],this.match+=C[0],this.matches=C,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(C[0].length),this.matched+=C[0],E=this.performAction.call(this,this.yy,this,k,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),E)return E;if(this._backtrack){for(var P in N)this[P]=N[P];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,k,E,A;this._more||(this.yytext="",this.match="");for(var N=this._currentRules(),P=0;Pk[0].length)){if(k=E,A=P,this.options.backtrack_lexer){if(C=this.test_match(E,N[P]),C!==!1)return C;if(this._backtrack){k=!1;continue}else return!1}else if(!this.options.flex)break}return k?(C=this.test_match(k,N[A]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var k=this.next();return k||this.lex()},"lex"),begin:o(function(k){this.conditionStack.push(k)},"begin"),popState:o(function(){var k=this.conditionStack.length-1;return k>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(k){return k=this.conditionStack.length-1-Math.abs(k||0),k>=0?this.conditionStack[k]:"INITIAL"},"topState"),pushState:o(function(k){this.begin(k)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(k,E,A,N){var P=N;switch(A){case 0:return k.getLogger().trace("Found comment",E.yytext),6;break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;break;case 4:this.popState();break;case 5:k.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return k.getLogger().trace("SPACELINE"),6;break;case 7:return 7;case 8:return 15;case 9:k.getLogger().trace("end icon"),this.popState();break;case 10:return k.getLogger().trace("Exploding node"),this.begin("NODE"),19;break;case 11:return k.getLogger().trace("Cloud"),this.begin("NODE"),19;break;case 12:return k.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;break;case 13:return k.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;break;case 14:return this.begin("NODE"),19;break;case 15:return this.begin("NODE"),19;break;case 16:return this.begin("NODE"),19;break;case 17:return this.begin("NODE"),19;break;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:k.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return k.getLogger().trace("description:",E.yytext),"NODE_DESCR";break;case 26:this.popState();break;case 27:return this.popState(),k.getLogger().trace("node end ))"),"NODE_DEND";break;case 28:return this.popState(),k.getLogger().trace("node end )"),"NODE_DEND";break;case 29:return this.popState(),k.getLogger().trace("node end ...",E.yytext),"NODE_DEND";break;case 30:return this.popState(),k.getLogger().trace("node end (("),"NODE_DEND";break;case 31:return this.popState(),k.getLogger().trace("node end (-"),"NODE_DEND";break;case 32:return this.popState(),k.getLogger().trace("node end (-"),"NODE_DEND";break;case 33:return this.popState(),k.getLogger().trace("node end (("),"NODE_DEND";break;case 34:return this.popState(),k.getLogger().trace("node end (("),"NODE_DEND";break;case 35:return k.getLogger().trace("Long description:",E.yytext),20;break;case 36:return k.getLogger().trace("Long description:",E.yytext),20;break}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return w})();x.lexer=b;function T(){this.yy={}}return o(T,"Parser"),T.prototype=x,x.Parser=T,new T})();ZW.parser=ZW;b7e=ZW});function C7e(e,t=0){return(Sa[e[t+0]]+Sa[e[t+1]]+Sa[e[t+2]]+Sa[e[t+3]]+"-"+Sa[e[t+4]]+Sa[e[t+5]]+"-"+Sa[e[t+6]]+Sa[e[t+7]]+"-"+Sa[e[t+8]]+Sa[e[t+9]]+"-"+Sa[e[t+10]]+Sa[e[t+11]]+Sa[e[t+12]]+Sa[e[t+13]]+Sa[e[t+14]]+Sa[e[t+15]]).toLowerCase()}var Sa,k7e=z(()=>{"use strict";Sa=[];for(let e=0;e<256;++e)Sa.push((e+256).toString(16).slice(1));o(C7e,"unsafeStringify")});function QW(){return crypto.getRandomValues(dwt)}var dwt,w7e=z(()=>{"use strict";dwt=new Uint8Array(16);o(QW,"rng")});function fwt(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():pwt(e,t,r)}function pwt(e,t,r){e=e||{};let i=e.random??e.rng?.()??QW();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let n=0;n<16;++n)t[r+n]=i[n];return t}return C7e(i)}var JW,S7e=z(()=>{"use strict";w7e();k7e();o(fwt,"v4");o(pwt,"_v4");JW=fwt});var E7e=z(()=>{"use strict";S7e()});var A7e,_7e=z(()=>{"use strict";_s();Xt();A7e=12});var Dh,d_,D7e=z(()=>{"use strict";Ut();E7e();Ir();St();Bn();br();_7e();Dh={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},d_=class{constructor(){this.nodes=[];this.count=0;this.elements={};this.getLogger=this.getLogger.bind(this),this.nodeType=Dh,this.clear(),this.getType=this.getType.bind(this),this.getElementById=this.getElementById.bind(this),this.getParent=this.getParent.bind(this),this.getMindmap=this.getMindmap.bind(this),this.addNode=this.addNode.bind(this),this.decorateNode=this.decorateNode.bind(this)}static{o(this,"MindmapDB")}clear(){this.nodes=[],this.count=0,this.elements={},this.baseLevel=void 0}getParent(t){for(let r=this.nodes.length-1;r>=0;r--)if(this.nodes[r].level0?this.nodes[0]:null}addNode(t,r,i,n){Z.info("addNode",t,r,i,n);let a=!1;this.nodes.length===0?(this.baseLevel=t,t=0,a=!0):this.baseLevel!==void 0&&(t=t-this.baseLevel,a=!1);let s=ge(),l=s.mindmap?.padding??or.mindmap.padding;switch(n){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:l*=2;break}let u={id:this.count++,nodeId:fr(r,s),level:t,descr:fr(i,s),type:n,children:[],width:s.mindmap?.maxNodeWidth??or.mindmap.maxNodeWidth,padding:l,isRoot:a},h=this.getParent(t);if(h)h.children.push(u),this.nodes.push(u);else if(a)this.nodes.push(u);else throw new Error(`There can be only one root. No parent could be found for ("${u.descr}")`)}getType(t,r){switch(Z.debug("In get type",t,r),t){case"[":return this.nodeType.RECT;case"(":return r===")"?this.nodeType.ROUNDED_RECT:this.nodeType.CLOUD;case"((":return this.nodeType.CIRCLE;case")":return this.nodeType.CLOUD;case"))":return this.nodeType.BANG;case"{{":return this.nodeType.HEXAGON;default:return this.nodeType.DEFAULT}}setElementForId(t,r){this.elements[t]=r}getElementById(t){return this.elements[t]}decorateNode(t){if(!t)return;let r=ge(),i=this.nodes[this.nodes.length-1];t.icon&&(i.icon=fr(t.icon,r)),t.class&&(i.class=fr(t.class,r))}type2Str(t){switch(t){case this.nodeType.DEFAULT:return"no-border";case this.nodeType.RECT:return"rect";case this.nodeType.ROUNDED_RECT:return"rounded-rect";case this.nodeType.CIRCLE:return"circle";case this.nodeType.CLOUD:return"cloud";case this.nodeType.BANG:return"bang";case this.nodeType.HEXAGON:return"hexgon";default:return"no-border"}}assignSections(t,r){if(t.level===0?t.section=void 0:t.section=r,t.children)for(let[i,n]of t.children.entries()){let a=t.level===0?i%(A7e-1):r;this.assignSections(n,a)}}flattenNodes(t,r){let i=ge(),n=["mindmap-node"];t.isRoot===!0?n.push("section-root","section--1"):t.section!==void 0&&n.push(`section-${t.section}`),t.class&&n.push(t.class);let a=n.join(" "),s=o(u=>{let d=(i.theme?.toLowerCase()??"").includes("redux");switch(u){case Dh.CIRCLE:return"mindmapCircle";case Dh.RECT:return"rect";case Dh.ROUNDED_RECT:return"rounded";case Dh.CLOUD:return"cloud";case Dh.BANG:return"bang";case Dh.HEXAGON:return"hexagon";case Dh.DEFAULT:return d?"rounded":"defaultMindmapNode";case Dh.NO_BORDER:default:return"rect"}},"getShapeFromType"),l={id:t.id.toString(),domId:"node_"+t.id.toString(),label:t.descr,labelType:"markdown",isGroup:!1,shape:s(t.type),width:t.width,height:t.height??0,padding:t.padding,cssClasses:a,cssStyles:[],look:i.look,icon:t.icon,x:t.x,y:t.y,level:t.level,nodeId:t.nodeId,type:t.type,section:t.section};if(r.push(l),t.children)for(let u of t.children)this.flattenNodes(u,r)}generateEdges(t,r){if(!t.children)return;let i=ge();for(let n of t.children){let a="edge";n.section!==void 0&&(a+=` section-edge-${n.section}`);let s=t.level+1;a+=` edge-depth-${s}`;let l={id:`edge_${t.id}_${n.id}`,start:t.id.toString(),end:n.id.toString(),type:"normal",curve:"basis",thickness:"normal",look:i.look,classes:a,depth:t.level,section:n.section};r.push(l),this.generateEdges(n,r)}}getData(){let t=this.getMindmap(),r=ge(),n=JH().layout!==void 0,a=r;if(n||(a.layout="cose-bilkent"),!t)return{nodes:[],edges:[],config:a};Z.debug("getData: mindmapRoot",t,r),this.assignSections(t);let s=[],l=[];this.flattenNodes(t,s),this.generateEdges(t,l),Z.debug(`getData: processed ${s.length} nodes and ${l.length} edges`);let u=new Map;for(let h of s)u.set(h.id,{shape:h.shape,width:h.width,height:h.height,padding:h.padding});return{nodes:s,edges:l,config:a,rootNode:t,markers:["point"],direction:"TB",nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(u),type:"mindmap",diagramId:"mindmap-"+JW()}}getLogger(){return Z}}});var mwt,R7e,L7e=z(()=>{"use strict";St();Lp();tf();rf();Bn();br();mwt=o(async(e,t,r,i)=>{Z.debug(`Rendering mindmap diagram +`+e);let n=i.db,a=n.getData(),s=Fo(t,a.config.securityLevel);if(a.type=i.type,a.layoutAlgorithm=Gc(a.config.layout,{fallback:"cose-bilkent"}),a.diagramId=t,!n.getMindmap())return;a.nodes.forEach(p=>{p.shape==="rounded"?(p.radius=15,p.taper=15,p.stroke="none",p.width=0,p.padding=15):p.shape==="circle"?p.padding=10:p.shape==="rect"?(p.width=0,p.padding=10):p.shape==="hexagon"&&(p.width=0,p.height=0)}),await Zo(a,s);let{themeVariables:u}=Nt(),{useGradient:h,gradientStart:d,gradientStop:f}=u;if(h&&d&&f){let p=s.attr("id"),m=s.append("defs").append("linearGradient").attr("id",`${p}-gradient`).attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");m.append("stop").attr("offset","0%").attr("stop-color",d).attr("stop-opacity",1),m.append("stop").attr("offset","100%").attr("stop-color",f).attr("stop-opacity",1)}$s(s,a.config.mindmap?.padding??or.mindmap.padding,"mindmapDiagram",a.config.mindmap?.useMaxWidth??or.mindmap.useMaxWidth)},"draw"),R7e={draw:mwt}});var gwt,ywt,vwt,M7e,N7e=z(()=>{"use strict";Cn();gwt=o(e=>{let{theme:t,look:r}=e,i="";for(let n=0;n{let i="";for(let n=0;n{let{theme:t}=e,r=e.svgId,i=e.dropShadow?e.dropShadow.replace("url(#drop-shadow)",`url(${r}-drop-shadow)`):"none";return` + .edge { + stroke-width: 3; + } + ${gwt(e)} + .section-root rect, .section-root path, .section-root circle, .section-root polygon { + fill: ${e.git0}; + } + .section-root text { + fill: ${e.gitBranchLabel0}; + } + .section-root span { + color: ${t?.includes("redux")?e.nodeBorder:e.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .mindmap-node-label { + dy: 1em; + alignment-baseline: middle; + text-anchor: middle; + dominant-baseline: middle; + text-align: center; + } + [data-look="neo"].mindmap-node { + filter: ${i}; + } + [data-look="neo"].mindmap-node.section-root rect, [data-look="neo"].mindmap-node.section-root path, [data-look="neo"].mindmap-node.section-root circle, [data-look="neo"].mindmap-node.section-root polygon { + fill: ${t?.includes("redux")?e.mainBkg:e.git0}; + } + [data-look="neo"].mindmap-node.section-root .text-inner-tspan { + fill: ${t?.includes("redux")?e.nodeBorder:e["cScaleLabel"+(t==="neutral"?1:0)]}; + } + ${e.useGradient&&r&&e.mainBkg?ywt(e.THEME_COLOR_LIMIT,r,e.mainBkg):""} +`},"getStyles"),M7e=vwt});var I7e={};xr(I7e,{diagram:()=>xwt});var xwt,O7e=z(()=>{"use strict";T7e();D7e();L7e();N7e();xwt={get db(){return new d_},renderer:R7e,parser:b7e,styles:M7e}});var eq,F7e,$7e=z(()=>{"use strict";eq=(function(){var e=o(function(E,A,N,P){for(N=N||{},P=E.length;P--;N[E[P]]=A);return N},"o"),t=[1,4],r=[1,13],i=[1,12],n=[1,15],a=[1,16],s=[1,20],l=[1,19],u=[6,7,8],h=[1,26],d=[1,24],f=[1,25],p=[6,7,11],m=[1,31],g=[6,7,11,24],y=[1,6,13,16,17,20,23],v=[1,35],x=[1,36],b=[1,6,7,11,13,16,17,20,23],T=[1,38],w={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:o(function(A,N,P,I,D,_,R){var M=_.length-1;switch(D){case 6:case 7:return I;case 8:I.getLogger().trace("Stop NL ");break;case 9:I.getLogger().trace("Stop EOF ");break;case 11:I.getLogger().trace("Stop NL2 ");break;case 12:I.getLogger().trace("Stop EOF2 ");break;case 15:I.getLogger().info("Node: ",_[M-1].id),I.addNode(_[M-2].length,_[M-1].id,_[M-1].descr,_[M-1].type,_[M]);break;case 16:I.getLogger().info("Node: ",_[M].id),I.addNode(_[M-1].length,_[M].id,_[M].descr,_[M].type);break;case 17:I.getLogger().trace("Icon: ",_[M]),I.decorateNode({icon:_[M]});break;case 18:case 23:I.decorateNode({class:_[M]});break;case 19:I.getLogger().trace("SPACELIST");break;case 20:I.getLogger().trace("Node: ",_[M-1].id),I.addNode(0,_[M-1].id,_[M-1].descr,_[M-1].type,_[M]);break;case 21:I.getLogger().trace("Node: ",_[M].id),I.addNode(0,_[M].id,_[M].descr,_[M].type);break;case 22:I.decorateNode({icon:_[M]});break;case 27:I.getLogger().trace("node found ..",_[M-2]),this.$={id:_[M-1],descr:_[M-1],type:I.getType(_[M-2],_[M])};break;case 28:this.$={id:_[M],descr:_[M],type:0};break;case 29:I.getLogger().trace("node found ..",_[M-3]),this.$={id:_[M-3],descr:_[M-1],type:I.getType(_[M-2],_[M])};break;case 30:this.$=_[M-1]+_[M];break;case 31:this.$=_[M];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:i,14:14,16:n,17:a,18:17,19:18,20:s,23:l},e(u,[2,3]),{1:[2,2]},e(u,[2,4]),e(u,[2,5]),{1:[2,6],6:r,12:21,13:i,14:14,16:n,17:a,18:17,19:18,20:s,23:l},{6:r,9:22,12:11,13:i,14:14,16:n,17:a,18:17,19:18,20:s,23:l},{6:h,7:d,10:23,11:f},e(p,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:s,23:l}),e(p,[2,19]),e(p,[2,21],{15:30,24:m}),e(p,[2,22]),e(p,[2,23]),e(g,[2,25]),e(g,[2,26]),e(g,[2,28],{20:[1,32]}),{21:[1,33]},{6:h,7:d,10:34,11:f},{1:[2,7],6:r,12:21,13:i,14:14,16:n,17:a,18:17,19:18,20:s,23:l},e(y,[2,14],{7:v,11:x}),e(b,[2,8]),e(b,[2,9]),e(b,[2,10]),e(p,[2,16],{15:37,24:m}),e(p,[2,17]),e(p,[2,18]),e(p,[2,20],{24:T}),e(g,[2,31]),{21:[1,39]},{22:[1,40]},e(y,[2,13],{7:v,11:x}),e(b,[2,11]),e(b,[2,12]),e(p,[2,15],{24:T}),e(g,[2,30]),{22:[1,41]},e(g,[2,27]),e(g,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(A,N){if(N.recoverable)this.trace(A);else{var P=new Error(A);throw P.hash=N,P}},"parseError"),parse:o(function(A){var N=this,P=[0],I=[],D=[null],_=[],R=this.table,M="",L=0,B=0,O=0,$=2,G=1,F=_.slice.call(arguments,1),V=Object.create(this.lexer),H={yy:{}};for(var j in this.yy)Object.prototype.hasOwnProperty.call(this.yy,j)&&(H.yy[j]=this.yy[j]);V.setInput(A,H.yy),H.yy.lexer=V,H.yy.parser=this,typeof V.yylloc>"u"&&(V.yylloc={});var U=V.yylloc;_.push(U);var Q=V.options&&V.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Y(de){P.length=P.length-2*de,D.length=D.length-de,_.length=_.length-de}o(Y,"popStack");function ae(){var de;return de=I.pop()||V.lex()||G,typeof de!="number"&&(de instanceof Array&&(I=de,de=I.pop()),de=N.symbols_[de]||de),de}o(ae,"lex");for(var J,te,re,ee,Te,ue,De={},Ie,Ee,we,Me;;){if(re=P[P.length-1],this.defaultActions[re]?ee=this.defaultActions[re]:((J===null||typeof J>"u")&&(J=ae()),ee=R[re]&&R[re][J]),typeof ee>"u"||!ee.length||!ee[0]){var $e="";Me=[];for(Ie in R[re])this.terminals_[Ie]&&Ie>$&&Me.push("'"+this.terminals_[Ie]+"'");V.showPosition?$e="Parse error on line "+(L+1)+`: +`+V.showPosition()+` +Expecting `+Me.join(", ")+", got '"+(this.terminals_[J]||J)+"'":$e="Parse error on line "+(L+1)+": Unexpected "+(J==G?"end of input":"'"+(this.terminals_[J]||J)+"'"),this.parseError($e,{text:V.match,token:this.terminals_[J]||J,line:V.yylineno,loc:U,expected:Me})}if(ee[0]instanceof Array&&ee.length>1)throw new Error("Parse Error: multiple actions possible at state: "+re+", token: "+J);switch(ee[0]){case 1:P.push(J),D.push(V.yytext),_.push(V.yylloc),P.push(ee[1]),J=null,te?(J=te,te=null):(B=V.yyleng,M=V.yytext,L=V.yylineno,U=V.yylloc,O>0&&O--);break;case 2:if(Ee=this.productions_[ee[1]][1],De.$=D[D.length-Ee],De._$={first_line:_[_.length-(Ee||1)].first_line,last_line:_[_.length-1].last_line,first_column:_[_.length-(Ee||1)].first_column,last_column:_[_.length-1].last_column},Q&&(De._$.range=[_[_.length-(Ee||1)].range[0],_[_.length-1].range[1]]),ue=this.performAction.apply(De,[M,B,L,H.yy,ee[1],D,_].concat(F)),typeof ue<"u")return ue;Ee&&(P=P.slice(0,-1*Ee*2),D=D.slice(0,-1*Ee),_=_.slice(0,-1*Ee)),P.push(this.productions_[ee[1]][0]),D.push(De.$),_.push(De._$),we=R[P[P.length-2]][P[P.length-1]],P.push(we);break;case 3:return!0}}return!0},"parse")},C=(function(){var E={EOF:1,parseError:o(function(N,P){if(this.yy.parser)this.yy.parser.parseError(N,P);else throw new Error(N)},"parseError"),setInput:o(function(A,N){return this.yy=N||this.yy||{},this._input=A,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var A=this._input[0];this.yytext+=A,this.yyleng++,this.offset++,this.match+=A,this.matched+=A;var N=A.match(/(?:\r\n?|\n).*/g);return N?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),A},"input"),unput:o(function(A){var N=A.length,P=A.split(/(?:\r\n?|\n)/g);this._input=A+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-N),this.offset-=N;var I=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),P.length-1&&(this.yylineno-=P.length-1);var D=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:P?(P.length===I.length?this.yylloc.first_column:0)+I[I.length-P.length].length-P[0].length:this.yylloc.first_column-N},this.options.ranges&&(this.yylloc.range=[D[0],D[0]+this.yyleng-N]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(A){this.unput(this.match.slice(A))},"less"),pastInput:o(function(){var A=this.matched.substr(0,this.matched.length-this.match.length);return(A.length>20?"...":"")+A.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var A=this.match;return A.length<20&&(A+=this._input.substr(0,20-A.length)),(A.substr(0,20)+(A.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var A=this.pastInput(),N=new Array(A.length+1).join("-");return A+this.upcomingInput()+` +`+N+"^"},"showPosition"),test_match:o(function(A,N){var P,I,D;if(this.options.backtrack_lexer&&(D={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(D.yylloc.range=this.yylloc.range.slice(0))),I=A[0].match(/(?:\r\n?|\n).*/g),I&&(this.yylineno+=I.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:I?I[I.length-1].length-I[I.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+A[0].length},this.yytext+=A[0],this.match+=A[0],this.matches=A,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(A[0].length),this.matched+=A[0],P=this.performAction.call(this,this.yy,this,N,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),P)return P;if(this._backtrack){for(var _ in D)this[_]=D[_];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var A,N,P,I;this._more||(this.yytext="",this.match="");for(var D=this._currentRules(),_=0;_N[0].length)){if(N=P,I=_,this.options.backtrack_lexer){if(A=this.test_match(P,D[_]),A!==!1)return A;if(this._backtrack){N=!1;continue}else return!1}else if(!this.options.flex)break}return N?(A=this.test_match(N,D[I]),A!==!1?A:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var N=this.next();return N||this.lex()},"lex"),begin:o(function(N){this.conditionStack.push(N)},"begin"),popState:o(function(){var N=this.conditionStack.length-1;return N>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(N){return N=this.conditionStack.length-1-Math.abs(N||0),N>=0?this.conditionStack[N]:"INITIAL"},"topState"),pushState:o(function(N){this.begin(N)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(N,P,I,D){var _=D;switch(I){case 0:return this.pushState("shapeData"),P.yytext="",24;break;case 1:return this.pushState("shapeDataStr"),24;break;case 2:return this.popState(),24;break;case 3:let R=/\n\s*/g;return P.yytext=P.yytext.replace(R,"
    "),24;break;case 4:return 24;case 5:this.popState();break;case 6:return N.getLogger().trace("Found comment",P.yytext),6;break;case 7:return 8;case 8:this.begin("CLASS");break;case 9:return this.popState(),17;break;case 10:this.popState();break;case 11:N.getLogger().trace("Begin icon"),this.begin("ICON");break;case 12:return N.getLogger().trace("SPACELINE"),6;break;case 13:return 7;case 14:return 16;case 15:N.getLogger().trace("end icon"),this.popState();break;case 16:return N.getLogger().trace("Exploding node"),this.begin("NODE"),20;break;case 17:return N.getLogger().trace("Cloud"),this.begin("NODE"),20;break;case 18:return N.getLogger().trace("Explosion Bang"),this.begin("NODE"),20;break;case 19:return N.getLogger().trace("Cloud Bang"),this.begin("NODE"),20;break;case 20:return this.begin("NODE"),20;break;case 21:return this.begin("NODE"),20;break;case 22:return this.begin("NODE"),20;break;case 23:return this.begin("NODE"),20;break;case 24:return 13;case 25:return 23;case 26:return 11;case 27:this.begin("NSTR2");break;case 28:return"NODE_DESCR";case 29:this.popState();break;case 30:N.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 31:return N.getLogger().trace("description:",P.yytext),"NODE_DESCR";break;case 32:this.popState();break;case 33:return this.popState(),N.getLogger().trace("node end ))"),"NODE_DEND";break;case 34:return this.popState(),N.getLogger().trace("node end )"),"NODE_DEND";break;case 35:return this.popState(),N.getLogger().trace("node end ...",P.yytext),"NODE_DEND";break;case 36:return this.popState(),N.getLogger().trace("node end (("),"NODE_DEND";break;case 37:return this.popState(),N.getLogger().trace("node end (-"),"NODE_DEND";break;case 38:return this.popState(),N.getLogger().trace("node end (-"),"NODE_DEND";break;case 39:return this.popState(),N.getLogger().trace("node end (("),"NODE_DEND";break;case 40:return this.popState(),N.getLogger().trace("node end (("),"NODE_DEND";break;case 41:return N.getLogger().trace("Long description:",P.yytext),21;break;case 42:return N.getLogger().trace("Long description:",P.yytext),21;break}},"anonymous"),rules:[/^(?:@\{)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^\"]+)/i,/^(?:[^}^"]+)/i,/^(?:\})/i,/^(?:\s*%%.*)/i,/^(?:kanban\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}@]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{shapeDataEndBracket:{rules:[],inclusive:!1},shapeDataStr:{rules:[2,3],inclusive:!1},shapeData:{rules:[1,4,5],inclusive:!1},CLASS:{rules:[9,10],inclusive:!1},ICON:{rules:[14,15],inclusive:!1},NSTR2:{rules:[28,29],inclusive:!1},NSTR:{rules:[31,32],inclusive:!1},NODE:{rules:[27,30,33,34,35,36,37,38,39,40,41,42],inclusive:!1},INITIAL:{rules:[0,6,7,8,11,12,13,16,17,18,19,20,21,22,23,24,25,26],inclusive:!0}}};return E})();w.lexer=C;function k(){this.yy={}}return o(k,"Parser"),k.prototype=w,w.Parser=k,new k})();eq.parser=eq;F7e=eq});var cl,rq,tq,iq,kwt,wwt,z7e,Swt,Ewt,Xn,Awt,_wt,Dwt,Rwt,Lwt,Mwt,Nwt,G7e,V7e=z(()=>{"use strict";Ut();Ir();St();Bn();Wx();cl=[],rq=[],tq=0,iq={},kwt=o(()=>{cl=[],rq=[],tq=0,iq={}},"clear"),wwt=o(e=>{if(cl.length===0)return null;let t=cl[0].level,r=null;for(let i=cl.length-1;i>=0;i--)if(cl[i].level===t&&!r&&(r=cl[i]),cl[i].levell.parentId===n.id);for(let l of s){let u={id:l.id,parentId:n.id,label:fr(l.label??"",i),labelType:"markdown",isGroup:!1,ticket:l?.ticket,priority:l?.priority,assigned:l?.assigned,icon:l?.icon,shape:"kanbanItem",level:l.level,rx:5,ry:5,cssStyles:["text-align: left"]};t.push(u)}}return{nodes:t,edges:e,other:{},config:ge()}},"getData"),Ewt=o((e,t,r,i,n)=>{let a=ge(),s=a.mindmap?.padding??or.mindmap.padding;switch(i){case Xn.ROUNDED_RECT:case Xn.RECT:case Xn.HEXAGON:s*=2}let l={id:fr(t,a)||"kbn"+tq++,level:e,label:fr(r,a),width:a.mindmap?.maxNodeWidth??or.mindmap.maxNodeWidth,padding:s,isGroup:!1};if(n!==void 0){let h;n.includes(` +`)?h=n+` +`:h=`{ +`+n+` +}`;let d=ld(h,{schema:od});if(d.shape&&(d.shape!==d.shape.toLowerCase()||d.shape.includes("_")))throw new Error(`No such shape: ${d.shape}. Shape names should be lowercase.`);d?.shape&&d.shape==="kanbanItem"&&(l.shape=d?.shape),d?.label&&(l.label=d?.label),d?.icon&&(l.icon=d?.icon.toString()),d?.assigned&&(l.assigned=d?.assigned.toString()),d?.ticket&&(l.ticket=d?.ticket.toString()),d?.priority&&(l.priority=d?.priority)}let u=wwt(e);u?l.parentId=u.id||"kbn"+tq++:rq.push(l),cl.push(l)},"addNode"),Xn={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},Awt=o((e,t)=>{switch(Z.debug("In get type",e,t),e){case"[":return Xn.RECT;case"(":return t===")"?Xn.ROUNDED_RECT:Xn.CLOUD;case"((":return Xn.CIRCLE;case")":return Xn.CLOUD;case"))":return Xn.BANG;case"{{":return Xn.HEXAGON;default:return Xn.DEFAULT}},"getType"),_wt=o((e,t)=>{iq[e]=t},"setElementForId"),Dwt=o(e=>{if(!e)return;let t=ge(),r=cl[cl.length-1];e.icon&&(r.icon=fr(e.icon,t)),e.class&&(r.cssClasses=fr(e.class,t))},"decorateNode"),Rwt=o(e=>{switch(e){case Xn.DEFAULT:return"no-border";case Xn.RECT:return"rect";case Xn.ROUNDED_RECT:return"rounded-rect";case Xn.CIRCLE:return"circle";case Xn.CLOUD:return"cloud";case Xn.BANG:return"bang";case Xn.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),Lwt=o(()=>Z,"getLogger"),Mwt=o(e=>iq[e],"getElementById"),Nwt={clear:kwt,addNode:Ewt,getSections:z7e,getData:Swt,nodeType:Xn,getType:Awt,setElementForId:_wt,decorateNode:Dwt,type2Str:Rwt,getLogger:Lwt,getElementById:Mwt},G7e=Nwt});var Iwt,W7e,q7e=z(()=>{"use strict";Ut();St();ps();Di();Bn();W4();J4();Iwt=o(async(e,t,r,i)=>{Z.debug(`Rendering kanban diagram +`+e);let a=i.db.getData(),s=ge();s.htmlLabels=!1;let l=bi(t);for(let v of a.nodes)v.domId=`${t}-${v.id}`;let u=l.append("g");u.attr("class","sections");let h=l.append("g");h.attr("class","items");let d=a.nodes.filter(v=>v.isGroup),f=0,p=10,m=[],g=25;for(let v of d){let x=s?.kanban?.sectionWidth||200;f=f+1,v.x=x*f+(f-1)*p/2,v.width=x,v.y=0,v.height=x*3,v.rx=5,v.ry=5,v.cssClasses=v.cssClasses+" section-"+f;let b=await wg(u,v);g=Math.max(g,b?.labelBBox?.height),m.push(b)}let y=0;for(let v of d){let x=m[y];y=y+1;let b=s?.kanban?.sectionWidth||200,T=-b*3/2+g,w=T,C=a.nodes.filter(A=>A.parentId===v.id);for(let A of C){if(A.isGroup)throw new Error("Groups within groups are not allowed in Kanban diagrams");A.x=v.x,A.width=b-1.5*p;let P=(await Sg(h,A,{config:s})).node().getBBox();A.y=w+P.height/2,await nb(A),w=A.y+P.height/2+p/2}let k=x.cluster.select("rect"),E=Math.max(w-T+3*p,50)+(g-25);k.attr("height",E)}Io(void 0,l,s.mindmap?.padding??or.kanban.padding,s.mindmap?.useMaxWidth??or.kanban.useMaxWidth)},"draw"),W7e={draw:Iwt}});var Owt,Pwt,U7e,H7e=z(()=>{"use strict";Cn();k1();Owt=o(e=>{let t="";for(let i=0;ie.darkMode?Xe(i,n):je(i,n),"adjuster");for(let i=0;i` + .edge { + stroke-width: 3; + } + ${Owt(e)} + .section-root rect, .section-root path, .section-root circle, .section-root polygon { + fill: ${e.git0}; + } + .section-root text { + fill: ${e.gitBranchLabel0}; + } + .icon-container { + height:100%; + display: flex; + justify-content: center; + align-items: center; + } + .edge { + fill: none; + } + .cluster-label, .label { + color: ${e.textColor}; + fill: ${e.textColor}; + } + .kanban-label { + dy: 1em; + alignment-baseline: middle; + text-anchor: middle; + dominant-baseline: middle; + text-align: center; + } + ${Vc()} +`,"getStyles"),U7e=Pwt});var Y7e={};xr(Y7e,{diagram:()=>Bwt});var Bwt,j7e=z(()=>{"use strict";$7e();V7e();q7e();H7e();Bwt={db:G7e,renderer:W7e,parser:F7e,styles:U7e}});var nq,tC,Z7e=z(()=>{"use strict";nq=(function(){var e=o(function(l,u,h,d){for(h=h||{},d=l.length;d--;h[l[d]]=u);return h},"o"),t=[1,9],r=[1,10],i=[1,5,10,12],n={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:o(function(u,h,d,f,p,m,g){var y=m.length-1;switch(p){case 7:let v=f.findOrCreateNode(m[y-4].trim().replaceAll('""','"')),x=f.findOrCreateNode(m[y-2].trim().replaceAll('""','"')),b=parseFloat(m[y].trim());f.addLink(v,x,b);break;case 8:case 9:case 11:this.$=m[y];break;case 10:this.$=m[y-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:t,20:r},{1:[2,6],7:11,10:[1,12]},e(r,[2,4],{9:13,5:[1,14]}),{12:[1,15]},e(i,[2,8]),e(i,[2,9]),{19:[1,16]},e(i,[2,11]),{1:[2,1]},{1:[2,5]},e(r,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:t,20:r},{15:18,16:7,17:8,18:t,20:r},{18:[1,19]},e(r,[2,3]),{12:[1,20]},e(i,[2,10]),{15:21,16:7,17:8,18:t,20:r},e([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:o(function(u,h){if(h.recoverable)this.trace(u);else{var d=new Error(u);throw d.hash=h,d}},"parseError"),parse:o(function(u){var h=this,d=[0],f=[],p=[null],m=[],g=this.table,y="",v=0,x=0,b=0,T=2,w=1,C=m.slice.call(arguments,1),k=Object.create(this.lexer),E={yy:{}};for(var A in this.yy)Object.prototype.hasOwnProperty.call(this.yy,A)&&(E.yy[A]=this.yy[A]);k.setInput(u,E.yy),E.yy.lexer=k,E.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var N=k.yylloc;m.push(N);var P=k.options&&k.options.ranges;typeof E.yy.parseError=="function"?this.parseError=E.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function I(U){d.length=d.length-2*U,p.length=p.length-U,m.length=m.length-U}o(I,"popStack");function D(){var U;return U=f.pop()||k.lex()||w,typeof U!="number"&&(U instanceof Array&&(f=U,U=f.pop()),U=h.symbols_[U]||U),U}o(D,"lex");for(var _,R,M,L,B,O,$={},G,F,V,H;;){if(M=d[d.length-1],this.defaultActions[M]?L=this.defaultActions[M]:((_===null||typeof _>"u")&&(_=D()),L=g[M]&&g[M][_]),typeof L>"u"||!L.length||!L[0]){var j="";H=[];for(G in g[M])this.terminals_[G]&&G>T&&H.push("'"+this.terminals_[G]+"'");k.showPosition?j="Parse error on line "+(v+1)+`: +`+k.showPosition()+` +Expecting `+H.join(", ")+", got '"+(this.terminals_[_]||_)+"'":j="Parse error on line "+(v+1)+": Unexpected "+(_==w?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(j,{text:k.match,token:this.terminals_[_]||_,line:k.yylineno,loc:N,expected:H})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+M+", token: "+_);switch(L[0]){case 1:d.push(_),p.push(k.yytext),m.push(k.yylloc),d.push(L[1]),_=null,R?(_=R,R=null):(x=k.yyleng,y=k.yytext,v=k.yylineno,N=k.yylloc,b>0&&b--);break;case 2:if(F=this.productions_[L[1]][1],$.$=p[p.length-F],$._$={first_line:m[m.length-(F||1)].first_line,last_line:m[m.length-1].last_line,first_column:m[m.length-(F||1)].first_column,last_column:m[m.length-1].last_column},P&&($._$.range=[m[m.length-(F||1)].range[0],m[m.length-1].range[1]]),O=this.performAction.apply($,[y,x,v,E.yy,L[1],p,m].concat(C)),typeof O<"u")return O;F&&(d=d.slice(0,-1*F*2),p=p.slice(0,-1*F),m=m.slice(0,-1*F)),d.push(this.productions_[L[1]][0]),p.push($.$),m.push($._$),V=g[d[d.length-2]][d[d.length-1]],d.push(V);break;case 3:return!0}}return!0},"parse")},a=(function(){var l={EOF:1,parseError:o(function(h,d){if(this.yy.parser)this.yy.parser.parseError(h,d);else throw new Error(h)},"parseError"),setInput:o(function(u,h){return this.yy=h||this.yy||{},this._input=u,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var u=this._input[0];this.yytext+=u,this.yyleng++,this.offset++,this.match+=u,this.matched+=u;var h=u.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),u},"input"),unput:o(function(u){var h=u.length,d=u.split(/(?:\r\n?|\n)/g);this._input=u+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1&&(this.yylineno-=d.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===f.length?this.yylloc.first_column:0)+f[f.length-d.length].length-d[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(u){this.unput(this.match.slice(u))},"less"),pastInput:o(function(){var u=this.matched.substr(0,this.matched.length-this.match.length);return(u.length>20?"...":"")+u.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var u=this.match;return u.length<20&&(u+=this._input.substr(0,20-u.length)),(u.substr(0,20)+(u.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var u=this.pastInput(),h=new Array(u.length+1).join("-");return u+this.upcomingInput()+` +`+h+"^"},"showPosition"),test_match:o(function(u,h){var d,f,p;if(this.options.backtrack_lexer&&(p={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(p.yylloc.range=this.yylloc.range.slice(0))),f=u[0].match(/(?:\r\n?|\n).*/g),f&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+u[0].length},this.yytext+=u[0],this.match+=u[0],this.matches=u,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(u[0].length),this.matched+=u[0],d=this.performAction.call(this,this.yy,this,h,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),d)return d;if(this._backtrack){for(var m in p)this[m]=p[m];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var u,h,d,f;this._more||(this.yytext="",this.match="");for(var p=this._currentRules(),m=0;mh[0].length)){if(h=d,f=m,this.options.backtrack_lexer){if(u=this.test_match(d,p[m]),u!==!1)return u;if(this._backtrack){h=!1;continue}else return!1}else if(!this.options.flex)break}return h?(u=this.test_match(h,p[f]),u!==!1?u:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var h=this.next();return h||this.lex()},"lex"),begin:o(function(h){this.conditionStack.push(h)},"begin"),popState:o(function(){var h=this.conditionStack.length-1;return h>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(h){return h=this.conditionStack.length-1-Math.abs(h||0),h>=0?this.conditionStack[h]:"INITIAL"},"topState"),pushState:o(function(h){this.begin(h)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(h,d,f,p){var m=p;switch(f){case 0:return this.pushState("csv"),4;break;case 1:return this.pushState("csv"),4;break;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;break;case 6:return 20;case 7:return this.popState("escaped_text"),18;break;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}};return l})();n.lexer=a;function s(){this.yy={}}return o(s,"Parser"),s.prototype=n,n.Parser=s,new s})();nq.parser=nq;tC=nq});var p_,m_,f_,Gwt,aq,Vwt,sq,Wwt,qwt,Uwt,Hwt,Q7e,J7e=z(()=>{"use strict";Ut();Ir();Ci();p_=[],m_=[],f_=new Map,Gwt=o(()=>{p_=[],m_=[],f_=new Map,gr()},"clear"),aq=class{constructor(t,r,i=0){this.source=t;this.target=r;this.value=i}static{o(this,"SankeyLink")}},Vwt=o((e,t,r)=>{p_.push(new aq(e,t,r))},"addLink"),sq=class{constructor(t){this.ID=t}static{o(this,"SankeyNode")}},Wwt=o(e=>{e=vt.sanitizeText(e,ge());let t=f_.get(e);return t===void 0&&(t=new sq(e),f_.set(e,t),m_.push(t)),t},"findOrCreateNode"),qwt=o(()=>m_,"getNodes"),Uwt=o(()=>p_,"getLinks"),Hwt=o(()=>({nodes:m_.map(e=>({id:e.ID})),links:p_.map(e=>({source:e.source.ID,target:e.target.ID,value:e.value}))}),"getGraph"),Q7e={nodesMap:f_,getConfig:o(()=>ge().sankey,"getConfig"),getNodes:qwt,getLinks:Uwt,getGraph:Hwt,addLink:Vwt,findOrCreateNode:Wwt,getAccTitle:kr,setAccTitle:Cr,getAccDescription:Sr,setAccDescription:wr,getDiagramTitle:Er,setDiagramTitle:Ar,clear:Gwt}});function rC(e,t){let r;if(t===void 0)for(let i of e)i!=null&&(r=i)&&(r=i);else{let i=-1;for(let n of e)(n=t(n,++i,e))!=null&&(r=n)&&(r=n)}return r}var eDe=z(()=>{"use strict";o(rC,"max")});function Dy(e,t){let r;if(t===void 0)for(let i of e)i!=null&&(r>i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let n of e)(n=t(n,++i,e))!=null&&(r>n||r===void 0&&n>=n)&&(r=n)}return r}var tDe=z(()=>{"use strict";o(Dy,"min")});function Ry(e,t){let r=0;if(t===void 0)for(let i of e)(i=+i)&&(r+=i);else{let i=-1;for(let n of e)(n=+t(n,++i,e))&&(r+=n)}return r}var rDe=z(()=>{"use strict";o(Ry,"sum")});var oq=z(()=>{"use strict";eDe();tDe();rDe()});function Ywt(e){return e.target.depth}function lq(e){return e.depth}function cq(e,t){return t-1-e.height}function iC(e,t){return e.sourceLinks.length?e.depth:t-1}function uq(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Dy(e.sourceLinks,Ywt)-1:0}var hq=z(()=>{"use strict";oq();o(Ywt,"targetDepth");o(lq,"left");o(cq,"right");o(iC,"justify");o(uq,"center")});function Ly(e){return function(){return e}}var iDe=z(()=>{"use strict";o(Ly,"constant")});function nDe(e,t){return g_(e.source,t.source)||e.index-t.index}function aDe(e,t){return g_(e.target,t.target)||e.index-t.index}function g_(e,t){return e.y0-t.y0}function dq(e){return e.value}function jwt(e){return e.index}function Xwt(e){return e.nodes}function Kwt(e){return e.links}function sDe(e,t){let r=e.get(t);if(!r)throw new Error("missing: "+t);return r}function oDe({nodes:e}){for(let t of e){let r=t.y0,i=r;for(let n of t.sourceLinks)n.y0=r+n.width/2,r+=n.width;for(let n of t.targetLinks)n.y1=i+n.width/2,i+=n.width}}function y_(){let e=0,t=0,r=1,i=1,n=24,a=8,s,l=jwt,u=iC,h,d,f=Xwt,p=Kwt,m=6;function g(){let M={nodes:f.apply(null,arguments),links:p.apply(null,arguments)};return y(M),v(M),x(M),b(M),C(M),oDe(M),M}o(g,"sankey"),g.update=function(M){return oDe(M),M},g.nodeId=function(M){return arguments.length?(l=typeof M=="function"?M:Ly(M),g):l},g.nodeAlign=function(M){return arguments.length?(u=typeof M=="function"?M:Ly(M),g):u},g.nodeSort=function(M){return arguments.length?(h=M,g):h},g.nodeWidth=function(M){return arguments.length?(n=+M,g):n},g.nodePadding=function(M){return arguments.length?(a=s=+M,g):a},g.nodes=function(M){return arguments.length?(f=typeof M=="function"?M:Ly(M),g):f},g.links=function(M){return arguments.length?(p=typeof M=="function"?M:Ly(M),g):p},g.linkSort=function(M){return arguments.length?(d=M,g):d},g.size=function(M){return arguments.length?(e=t=0,r=+M[0],i=+M[1],g):[r-e,i-t]},g.extent=function(M){return arguments.length?(e=+M[0][0],r=+M[1][0],t=+M[0][1],i=+M[1][1],g):[[e,t],[r,i]]},g.iterations=function(M){return arguments.length?(m=+M,g):m};function y({nodes:M,links:L}){for(let[O,$]of M.entries())$.index=O,$.sourceLinks=[],$.targetLinks=[];let B=new Map(M.map((O,$)=>[l(O,$,M),O]));for(let[O,$]of L.entries()){$.index=O;let{source:G,target:F}=$;typeof G!="object"&&(G=$.source=sDe(B,G)),typeof F!="object"&&(F=$.target=sDe(B,F)),G.sourceLinks.push($),F.targetLinks.push($)}if(d!=null)for(let{sourceLinks:O,targetLinks:$}of M)O.sort(d),$.sort(d)}o(y,"computeNodeLinks");function v({nodes:M}){for(let L of M)L.value=L.fixedValue===void 0?Math.max(Ry(L.sourceLinks,dq),Ry(L.targetLinks,dq)):L.fixedValue}o(v,"computeNodeValues");function x({nodes:M}){let L=M.length,B=new Set(M),O=new Set,$=0;for(;B.size;){for(let G of B){G.depth=$;for(let{target:F}of G.sourceLinks)O.add(F)}if(++$>L)throw new Error("circular link");B=O,O=new Set}}o(x,"computeNodeDepths");function b({nodes:M}){let L=M.length,B=new Set(M),O=new Set,$=0;for(;B.size;){for(let G of B){G.height=$;for(let{source:F}of G.targetLinks)O.add(F)}if(++$>L)throw new Error("circular link");B=O,O=new Set}}o(b,"computeNodeHeights");function T({nodes:M}){let L=rC(M,$=>$.depth)+1,B=(r-e-n)/(L-1),O=new Array(L);for(let $ of M){let G=Math.max(0,Math.min(L-1,Math.floor(u.call(null,$,L))));$.layer=G,$.x0=e+G*B,$.x1=$.x0+n,O[G]?O[G].push($):O[G]=[$]}if(h)for(let $ of O)$.sort(h);return O}o(T,"computeNodeLayers");function w(M){let L=Dy(M,B=>(i-t-(B.length-1)*s)/Ry(B,dq));for(let B of M){let O=t;for(let $ of B){$.y0=O,$.y1=O+$.value*L,O=$.y1+s;for(let G of $.sourceLinks)G.width=G.value*L}O=(i-O+s)/(B.length+1);for(let $=0;$B.length)-1)),w(L);for(let B=0;B0))continue;let j=(V/H-F.y0)*L;F.y0+=j,F.y1+=j,I(F)}h===void 0&&G.sort(g_),A(G,B)}}o(k,"relaxLeftToRight");function E(M,L,B){for(let O=M.length,$=O-2;$>=0;--$){let G=M[$];for(let F of G){let V=0,H=0;for(let{target:U,value:Q}of F.sourceLinks){let Y=Q*(U.layer-F.layer);V+=R(F,U)*Y,H+=Y}if(!(H>0))continue;let j=(V/H-F.y0)*L;F.y0+=j,F.y1+=j,I(F)}h===void 0&&G.sort(g_),A(G,B)}}o(E,"relaxRightToLeft");function A(M,L){let B=M.length>>1,O=M[B];P(M,O.y0-s,B-1,L),N(M,O.y1+s,B+1,L),P(M,i,M.length-1,L),N(M,t,0,L)}o(A,"resolveCollisions");function N(M,L,B,O){for(;B1e-6&&($.y0+=G,$.y1+=G),L=$.y1+s}}o(N,"resolveCollisionsTopToBottom");function P(M,L,B,O){for(;B>=0;--B){let $=M[B],G=($.y1-L)*O;G>1e-6&&($.y0-=G,$.y1-=G),L=$.y0-s}}o(P,"resolveCollisionsBottomToTop");function I({sourceLinks:M,targetLinks:L}){if(d===void 0){for(let{source:{sourceLinks:B}}of L)B.sort(aDe);for(let{target:{targetLinks:B}}of M)B.sort(nDe)}}o(I,"reorderNodeLinks");function D(M){if(d===void 0)for(let{sourceLinks:L,targetLinks:B}of M)L.sort(aDe),B.sort(nDe)}o(D,"reorderLinks");function _(M,L){let B=M.y0-(M.sourceLinks.length-1)*s/2;for(let{target:O,width:$}of M.sourceLinks){if(O===L)break;B+=$+s}for(let{source:O,width:$}of L.targetLinks){if(O===M)break;B-=$}return B}o(_,"targetTop");function R(M,L){let B=L.y0-(L.targetLinks.length-1)*s/2;for(let{source:O,width:$}of L.targetLinks){if(O===M)break;B+=$+s}for(let{target:O,width:$}of M.sourceLinks){if(O===L)break;B-=$}return B}return o(R,"sourceTop"),g}var lDe=z(()=>{"use strict";oq();hq();iDe();o(nDe,"ascendingSourceBreadth");o(aDe,"ascendingTargetBreadth");o(g_,"ascendingBreadth");o(dq,"value");o(jwt,"defaultId");o(Xwt,"defaultNodes");o(Kwt,"defaultLinks");o(sDe,"find");o(oDe,"computeLinkBreadths");o(y_,"Sankey")});function mq(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function cDe(){return new mq}var fq,pq,Tm,Zwt,gq,uDe=z(()=>{"use strict";fq=Math.PI,pq=2*fq,Tm=1e-6,Zwt=pq-Tm;o(mq,"Path");o(cDe,"path");mq.prototype=cDe.prototype={constructor:mq,moveTo:o(function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},"moveTo"),closePath:o(function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},"closePath"),lineTo:o(function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},"lineTo"),quadraticCurveTo:o(function(e,t,r,i){this._+="Q"+ +e+","+ +t+","+(this._x1=+r)+","+(this._y1=+i)},"quadraticCurveTo"),bezierCurveTo:o(function(e,t,r,i,n,a){this._+="C"+ +e+","+ +t+","+ +r+","+ +i+","+(this._x1=+n)+","+(this._y1=+a)},"bezierCurveTo"),arcTo:o(function(e,t,r,i,n){e=+e,t=+t,r=+r,i=+i,n=+n;var a=this._x1,s=this._y1,l=r-e,u=i-t,h=a-e,d=s-t,f=h*h+d*d;if(n<0)throw new Error("negative radius: "+n);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(f>Tm)if(!(Math.abs(d*l-u*h)>Tm)||!n)this._+="L"+(this._x1=e)+","+(this._y1=t);else{var p=r-a,m=i-s,g=l*l+u*u,y=p*p+m*m,v=Math.sqrt(g),x=Math.sqrt(f),b=n*Math.tan((fq-Math.acos((g+f-y)/(2*v*x)))/2),T=b/x,w=b/v;Math.abs(T-1)>Tm&&(this._+="L"+(e+T*h)+","+(t+T*d)),this._+="A"+n+","+n+",0,0,"+ +(d*p>h*m)+","+(this._x1=e+w*l)+","+(this._y1=t+w*u)}},"arcTo"),arc:o(function(e,t,r,i,n,a){e=+e,t=+t,r=+r,a=!!a;var s=r*Math.cos(i),l=r*Math.sin(i),u=e+s,h=t+l,d=1^a,f=a?i-n:n-i;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+u+","+h:(Math.abs(this._x1-u)>Tm||Math.abs(this._y1-h)>Tm)&&(this._+="L"+u+","+h),r&&(f<0&&(f=f%pq+pq),f>Zwt?this._+="A"+r+","+r+",0,1,"+d+","+(e-s)+","+(t-l)+"A"+r+","+r+",0,1,"+d+","+(this._x1=u)+","+(this._y1=h):f>Tm&&(this._+="A"+r+","+r+",0,"+ +(f>=fq)+","+d+","+(this._x1=e+r*Math.cos(n))+","+(this._y1=t+r*Math.sin(n))))},"arc"),rect:o(function(e,t,r,i){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +r+"v"+ +i+"h"+-r+"Z"},"rect"),toString:o(function(){return this._},"toString")};gq=cDe});var hDe=z(()=>{"use strict";uDe()});function v_(e){return o(function(){return e},"constant")}var dDe=z(()=>{"use strict";o(v_,"default")});function fDe(e){return e[0]}function pDe(e){return e[1]}var mDe=z(()=>{"use strict";o(fDe,"x");o(pDe,"y")});var gDe,yDe=z(()=>{"use strict";gDe=Array.prototype.slice});function Qwt(e){return e.source}function Jwt(e){return e.target}function e4t(e){var t=Qwt,r=Jwt,i=fDe,n=pDe,a=null;function s(){var l,u=gDe.call(arguments),h=t.apply(this,u),d=r.apply(this,u);if(a||(a=l=gq()),e(a,+i.apply(this,(u[0]=h,u)),+n.apply(this,u),+i.apply(this,(u[0]=d,u)),+n.apply(this,u)),l)return a=null,l+""||null}return o(s,"link"),s.source=function(l){return arguments.length?(t=l,s):t},s.target=function(l){return arguments.length?(r=l,s):r},s.x=function(l){return arguments.length?(i=typeof l=="function"?l:v_(+l),s):i},s.y=function(l){return arguments.length?(n=typeof l=="function"?l:v_(+l),s):n},s.context=function(l){return arguments.length?(a=l??null,s):a},s}function t4t(e,t,r,i,n){e.moveTo(t,r),e.bezierCurveTo(t=(t+i)/2,r,t,n,i,n)}function yq(){return e4t(t4t)}var vDe=z(()=>{"use strict";hDe();yDe();dDe();mDe();o(Qwt,"linkSource");o(Jwt,"linkTarget");o(e4t,"link");o(t4t,"curveHorizontal");o(yq,"linkHorizontal")});var xDe=z(()=>{"use strict";vDe()});function r4t(e){return[e.source.x1,e.y0]}function i4t(e){return[e.target.x0,e.y1]}function x_(){return yq().source(r4t).target(i4t)}var bDe=z(()=>{"use strict";xDe();o(r4t,"horizontalSource");o(i4t,"horizontalTarget");o(x_,"default")});var TDe=z(()=>{"use strict";lDe();hq();bDe()});var nC,CDe=z(()=>{"use strict";nC=class e{static{o(this,"Uid")}static{this.count=0}static next(t){return new e(t+ ++e.count)}constructor(t){this.id=t,this.href=`#${t}`}toString(){return"url("+this.href+")"}}});var n4t,a4t,s4t,kDe,wDe=z(()=>{"use strict";Ut();Rr();TDe();Di();CDe();n4t={left:lq,right:cq,center:uq,justify:iC},a4t=o(e=>{let t=0,r=0;for(let i of e){let n=i.value??0;n>t&&(t=n,r=i.layer??0)}return r},"findCentralNodeLayer"),s4t=o(function(e,t,r,i){let{securityLevel:n,sankey:a}=ge(),s=vk.sankey,l;n==="sandbox"&&(l=Je("#i"+t));let u=n==="sandbox"?Je(l.nodes()[0].contentDocument.body):Je("body"),h=n==="sandbox"?u.select(`[id="${t}"]`):Je(`[id="${t}"]`),d=a?.width??s.width,f=a?.height??s.width,p=a?.useMaxWidth??s.useMaxWidth,m=a?.nodeAlignment??s.nodeAlignment,g=a?.prefix??s.prefix,y=a?.suffix??s.suffix,v=a?.showValues??s.showValues,x=a?.nodeWidth??s.nodeWidth??10,b=a?.nodePadding??s.nodePadding??12,T=a?.labelStyle??s.labelStyle??"legacy",w=a?.nodeColors??{},C=i.db.getGraph(),k=n4t[m];y_().nodeId(O=>O.id).nodeWidth(x).nodePadding(b+(v?15:0)).nodeAlign(k).extent([[0,0],[d,f]])(C);let A=a4t(C.nodes),N=ro(XL),P=o(O=>w[O]??N(O),"getNodeColor");h.append("g").attr("class","nodes").selectAll(".node").data(C.nodes).join("g").attr("class","node").attr("id",O=>(O.uid=nC.next("node-")).id).attr("transform",function(O){return"translate("+O.x0+","+O.y0+")"}).attr("x",O=>O.x0).attr("y",O=>O.y0).append("rect").attr("height",O=>O.y1-O.y0).attr("width",O=>O.x1-O.x0).attr("fill",O=>P(O.id));let I=o(({id:O,value:$})=>v?`${O} +${g}${Math.round($*100)/100}${y}`:O,"getText"),D=o(O=>T==="outlined"?(O.layer??0)_.selectAll(O?`.${O}`:"text").data(C.nodes).join("text").attr("class",O??null).attr("x",$=>D($).x).attr("y",$=>($.y1+$.y0)/2).attr("dy",`${v?"0":"0.35"}em`).attr("text-anchor",$=>D($).anchor).text(I),"appendLabel");T==="outlined"?(R("sankey-label-bg"),R("sankey-label-fg")):R();let M=h.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(C.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),L=a?.linkColor??"gradient";if(L==="gradient"){let O=M.append("linearGradient").attr("id",$=>($.uid=nC.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",$=>$.source.x1).attr("x2",$=>$.target.x0);O.append("stop").attr("offset","0%").attr("stop-color",$=>P($.source.id)),O.append("stop").attr("offset","100%").attr("stop-color",$=>P($.target.id))}let B;switch(L){case"gradient":B=o(O=>O.uid,"coloring");break;case"source":B=o(O=>P(O.source.id),"coloring");break;case"target":B=o(O=>P(O.target.id),"coloring");break;default:B=L}M.append("path").attr("d",x_()).attr("stroke",B).attr("stroke-width",O=>Math.max(1,O.width)),Io(void 0,h,0,p)},"draw"),kDe={draw:s4t}});var SDe,EDe=z(()=>{"use strict";SDe=o(e=>e.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,` +`).trim(),"prepareTextForParsing")});var o4t,ADe,_De=z(()=>{"use strict";o4t=o(e=>`.label { + font-family: ${e.fontFamily}; + } + + .node-labels { + font-family: ${e.fontFamily}; + } + + /* Outlined label style - background stroke for better readability */ + .sankey-label-bg { + stroke: ${e.mainBkg||e.background||"#fff"}; + stroke-width: 4px; + stroke-linejoin: round; + paint-order: stroke; + } + + /* Foreground label text */ + .sankey-label-fg { + fill: ${e.textColor}; + } + + /* Node styling */ + .node rect { + shape-rendering: crispEdges; + } + + /* Link styling */ + .link { + fill: none; + stroke-opacity: 0.5; + mix-blend-mode: multiply; + } +`,"getStyles"),ADe=o4t});var DDe={};xr(DDe,{diagram:()=>c4t});var l4t,c4t,RDe=z(()=>{"use strict";Z7e();J7e();wDe();EDe();_De();l4t=tC.parse.bind(tC);tC.parse=e=>l4t(SDe(e));c4t={styles:ADe,parser:tC,db:Q7e,renderer:kDe}});var f4t,My,vq=z(()=>{"use strict";br();Bn();Xt();Ci();f4t=or.packet,My=class{constructor(){this.packet=[];this.setAccTitle=Cr;this.getAccTitle=kr;this.setDiagramTitle=Ar;this.getDiagramTitle=Er;this.getAccDescription=Sr;this.setAccDescription=wr}static{o(this,"PacketDB")}getConfig(){let t=Gr({...f4t,...Nt().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){gr(),this.packet=[]}}});var p4t,m4t,g4t,xq,NDe=z(()=>{"use strict";sl();St();au();vq();p4t=1e4,m4t=o((e,t)=>{ca(e,t);let r=-1,i=[],n=1,{bitsPerRow:a}=t.getConfig();for(let{start:s,end:l,bits:u,label:h}of e.blocks){if(s!==void 0&&l!==void 0&&l{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*r)return[e,void 0];let i=t*r-1,n=t*r;return[{start:e.start,end:i,label:e.label,bits:i-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),xq={parser:{yy:void 0},parse:o(async e=>{let t=await bn("packet",e),r=xq.parser?.yy;if(!(r instanceof My))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Z.debug(t),m4t(t,r)},"parse")}});var y4t,v4t,IDe,ODe=z(()=>{"use strict";ps();Di();y4t=o((e,t,r,i)=>{let n=i.db,a=n.getConfig(),{rowHeight:s,paddingY:l,bitWidth:u,bitsPerRow:h}=a,d=n.getPacket(),f=n.getDiagramTitle(),p=s+l,m=p*(d.length+1)-(f?0:s),g=u*h+2,y=bi(t);y.attr("viewBox",`0 0 ${g} ${m}`),Br(y,m,g,a.useMaxWidth);for(let[v,x]of d.entries())v4t(y,x,v,a);y.append("text").text(f).attr("x",g/2).attr("y",m-p/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),v4t=o((e,t,r,{rowHeight:i,paddingX:n,paddingY:a,bitWidth:s,bitsPerRow:l,showBits:u})=>{let h=e.append("g"),d=r*(i+a)+a;for(let f of t){let p=f.start%l*s+1,m=(f.end-f.start+1)*s-n;if(h.append("rect").attr("x",p).attr("y",d).attr("width",m).attr("height",i).attr("class","packetBlock"),h.append("text").attr("x",p+m/2).attr("y",d+i/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(f.label),!u)continue;let g=f.end===f.start,y=d-2;h.append("text").attr("x",p+(g?m/2:0)).attr("y",y).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",g?"middle":"start").text(f.start),g||h.append("text").attr("x",p+m).attr("y",y).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(f.end)}},"drawWord"),IDe={draw:y4t}});var x4t,PDe,BDe=z(()=>{"use strict";Xt();x4t={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},PDe=o(({packet:e}={})=>{let t=Gr(x4t,e);return` + .packetByte { + font-size: ${t.byteFontSize}; + } + .packetByte.start { + fill: ${t.startByteColor}; + } + .packetByte.end { + fill: ${t.endByteColor}; + } + .packetLabel { + fill: ${t.labelColor}; + font-size: ${t.labelFontSize}; + } + .packetTitle { + fill: ${t.titleColor}; + font-size: ${t.titleFontSize}; + } + .packetBlock { + stroke: ${t.blockStrokeColor}; + stroke-width: ${t.blockStrokeWidth}; + fill: ${t.blockFillColor}; + } + `},"styles")});var FDe={};xr(FDe,{diagram:()=>b4t});var b4t,$De=z(()=>{"use strict";vq();NDe();ODe();BDe();b4t={parser:xq,get db(){return new My},renderer:IDe,styles:PDe}});var Ny,VDe,Cm,k4t,w4t,WDe,S4t,E4t,A4t,_4t,D4t,R4t,L4t,km,bq=z(()=>{"use strict";br();Bn();Xt();Ci();Ny={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},VDe={axes:[],curves:[],options:Ny},Cm=structuredClone(VDe),k4t=or.radar,w4t=o(()=>Gr({...k4t,...Nt().radar}),"getConfig"),WDe=o(()=>Cm.axes,"getAxes"),S4t=o(()=>Cm.curves,"getCurves"),E4t=o(()=>Cm.options,"getOptions"),A4t=o(e=>{Cm.axes=e.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),_4t=o(e=>{Cm.curves=e.map(t=>({name:t.name,label:t.label??t.name,entries:D4t(t.entries)}))},"setCurves"),D4t=o(e=>{if(e[0].axis==null)return e.map(r=>r.value);let t=WDe();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(r=>{let i=e.find(n=>n.axis?.$refText===r.name);if(i===void 0)throw new Error("Missing entry for axis "+r.label);return i.value})},"computeCurveEntries"),R4t=o(e=>{let t=e.reduce((r,i)=>(r[i.name]=i,r),{});Cm.options={showLegend:t.showLegend?.value??Ny.showLegend,ticks:t.ticks?.value??Ny.ticks,max:t.max?.value??Ny.max,min:t.min?.value??Ny.min,graticule:t.graticule?.value??Ny.graticule}},"setOptions"),L4t=o(()=>{gr(),Cm=structuredClone(VDe)},"clear"),km={getAxes:WDe,getCurves:S4t,getOptions:E4t,setAxes:A4t,setCurves:_4t,setOptions:R4t,getConfig:w4t,clear:L4t,setAccTitle:Cr,getAccTitle:kr,setDiagramTitle:Ar,getDiagramTitle:Er,getAccDescription:Sr,setAccDescription:wr}});var M4t,qDe,UDe=z(()=>{"use strict";sl();St();au();bq();M4t=o(e=>{ca(e,km);let{axes:t,curves:r,options:i}=e;km.setAxes(t),km.setCurves(r),km.setOptions(i)},"populate"),qDe={parse:o(async e=>{let t=await bn("radar",e);Z.debug(t),M4t(t)},"parse")}});function B4t(e,t,r,i,n,a,s){let l=t.length,u=Math.min(s.width,s.height)/2;r.forEach((h,d)=>{if(h.entries.length!==l)return;let f=h.entries.map((p,m)=>{let g=2*Math.PI*m/l-Math.PI/2,y=F4t(p,i,n,u),v=y*Math.cos(g),x=y*Math.sin(g);return{x:v,y:x}});a==="circle"?e.append("path").attr("d",$4t(f,s.curveTension)).attr("class",`radarCurve-${d}`):a==="polygon"&&e.append("polygon").attr("points",f.map(p=>`${p.x},${p.y}`).join(" ")).attr("class",`radarCurve-${d}`)})}function F4t(e,t,r,i){let n=Math.min(Math.max(e,t),r);return i*(n-t)/(r-t)}function $4t(e,t){let r=e.length,i=`M${e[0].x},${e[0].y}`;for(let n=0;n{let h=e.append("g").attr("transform",`translate(${n}, ${a+u*s})`);h.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${u}`),h.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(l.label)})}var N4t,I4t,O4t,P4t,HDe,YDe=z(()=>{"use strict";ps();Di();N4t=o((e,t,r,i)=>{let n=i.db,a=n.getAxes(),s=n.getCurves(),l=n.getOptions(),u=n.getConfig(),h=n.getDiagramTitle(),d=bi(t),f=I4t(d,u),p=l.max??Math.max(...s.map(y=>Math.max(...y.entries))),m=l.min,g=Math.min(u.width,u.height)/2;O4t(f,a,g,l.ticks,l.graticule),P4t(f,a,g,u),B4t(f,a,s,m,p,l.graticule,u),z4t(f,s,l.showLegend,u),f.append("text").attr("class","radarTitle").text(h).attr("x",0).attr("y",-u.height/2-u.marginTop)},"draw"),I4t=o((e,t)=>{let r=t.width+t.marginLeft+t.marginRight,i=t.height+t.marginTop+t.marginBottom,n={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return Br(e,i,r,t.useMaxWidth??!0),e.attr("viewBox",`0 0 ${r} ${i}`),e.append("g").attr("transform",`translate(${n.x}, ${n.y})`)},"drawFrame"),O4t=o((e,t,r,i,n)=>{if(n==="circle")for(let a=0;a{let f=2*d*Math.PI/a-Math.PI/2,p=l*Math.cos(f),m=l*Math.sin(f);return`${p},${m}`}).join(" ");e.append("polygon").attr("points",u).attr("class","radarGraticule")}}},"drawGraticule"),P4t=o((e,t,r,i)=>{let n=t.length;for(let a=0;a{"use strict";Xt();$f();br();G4t=o((e,t)=>{let r="";for(let i=0;i{let t=Ao(),r=Nt(),i=Gr(t,r.themeVariables),n=Gr(i.radar,e);return{themeVariables:i,radarOptions:n}},"buildRadarStyleOptions"),jDe=o(({radar:e}={})=>{let{themeVariables:t,radarOptions:r}=V4t(e);return` + .radarTitle { + font-size: ${t.fontSize}; + color: ${t.titleColor}; + dominant-baseline: hanging; + text-anchor: middle; + } + .radarAxisLine { + stroke: ${r.axisColor}; + stroke-width: ${r.axisStrokeWidth}; + } + .radarAxisLabel { + dominant-baseline: middle; + text-anchor: middle; + font-size: ${r.axisLabelFontSize}px; + color: ${r.axisColor}; + } + .radarGraticule { + fill: ${r.graticuleColor}; + fill-opacity: ${r.graticuleOpacity}; + stroke: ${r.graticuleColor}; + stroke-width: ${r.graticuleStrokeWidth}; + } + .radarLegendText { + text-anchor: start; + font-size: ${r.legendFontSize}px; + dominant-baseline: hanging; + } + ${G4t(t,r)} + `},"styles")});var KDe={};xr(KDe,{diagram:()=>W4t});var W4t,ZDe=z(()=>{"use strict";bq();UDe();YDe();XDe();W4t={parser:qDe,db:km,renderer:HDe,styles:jDe}});var Tq,e8e,t8e=z(()=>{"use strict";Tq=(function(){var e=o(function(T,w,C,k){for(C=C||{},k=T.length;k--;C[T[k]]=w);return C},"o"),t=[1,15],r=[1,7],i=[1,13],n=[1,14],a=[1,19],s=[1,16],l=[1,17],u=[1,18],h=[8,30],d=[8,10,21,28,29,30,31,39,43,46],f=[1,23],p=[1,24],m=[8,10,15,16,21,28,29,30,31,39,43,46],g=[8,10,15,16,21,27,28,29,30,31,39,43,46],y=[1,49],v={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:o(function(w,C,k,E,A,N,P){var I=N.length-1;switch(A){case 4:E.getLogger().debug("Rule: separator (NL) ");break;case 5:E.getLogger().debug("Rule: separator (Space) ");break;case 6:E.getLogger().debug("Rule: separator (EOF) ");break;case 7:E.getLogger().debug("Rule: hierarchy: ",N[I-1]),E.setHierarchy(N[I-1]);break;case 8:E.getLogger().debug("Stop NL ");break;case 9:E.getLogger().debug("Stop EOF ");break;case 10:E.getLogger().debug("Stop NL2 ");break;case 11:E.getLogger().debug("Stop EOF2 ");break;case 12:E.getLogger().debug("Rule: statement: ",N[I]),typeof N[I].length=="number"?this.$=N[I]:this.$=[N[I]];break;case 13:E.getLogger().debug("Rule: statement #2: ",N[I-1]),this.$=[N[I-1]].concat(N[I]);break;case 14:E.getLogger().debug("Rule: link: ",N[I],w),this.$={edgeTypeStr:N[I],label:""};break;case 15:E.getLogger().debug("Rule: LABEL link: ",N[I-3],N[I-1],N[I]),this.$={edgeTypeStr:N[I],label:N[I-1]};break;case 18:let D=parseInt(N[I]),_=E.generateId();this.$={id:_,type:"space",label:"",width:D,children:[]};break;case 23:E.getLogger().debug("Rule: (nodeStatement link node) ",N[I-2],N[I-1],N[I]," typestr: ",N[I-1].edgeTypeStr);let R=E.edgeStrToEdgeData(N[I-1].edgeTypeStr),M=E.edgeStrToEdgeStartData(N[I-1].edgeTypeStr),L=E.edgeStrToThickness(N[I-1].edgeTypeStr),B=E.edgeStrToPattern(N[I-1].edgeTypeStr);this.$=[{id:N[I-2].id,label:N[I-2].label,type:N[I-2].type,directions:N[I-2].directions},{id:N[I-2].id+"-"+N[I].id,start:N[I-2].id,end:N[I].id,label:N[I-1].label,type:"edge",thickness:L,pattern:B,directions:N[I].directions,arrowTypeEnd:R,arrowTypeStart:M},{id:N[I].id,label:N[I].label,type:E.typeStr2Type(N[I].typeStr),directions:N[I].directions}];break;case 24:E.getLogger().debug("Rule: nodeStatement (abc88 node size) ",N[I-1],N[I]),this.$={id:N[I-1].id,label:N[I-1].label,type:E.typeStr2Type(N[I-1].typeStr),directions:N[I-1].directions,widthInColumns:parseInt(N[I],10)};break;case 25:E.getLogger().debug("Rule: nodeStatement (node) ",N[I]),this.$={id:N[I].id,label:N[I].label,type:E.typeStr2Type(N[I].typeStr),directions:N[I].directions,widthInColumns:1};break;case 26:E.getLogger().debug("APA123",this?this:"na"),E.getLogger().debug("COLUMNS: ",N[I]),this.$={type:"column-setting",columns:N[I]==="auto"?-1:parseInt(N[I])};break;case 27:E.getLogger().debug("Rule: id-block statement : ",N[I-2],N[I-1]);let O=E.generateId();this.$={...N[I-2],type:"composite",children:N[I-1]};break;case 28:E.getLogger().debug("Rule: blockStatement : ",N[I-2],N[I-1],N[I]);let $=E.generateId();this.$={id:$,type:"composite",label:"",children:N[I-1]};break;case 29:E.getLogger().debug("Rule: node (NODE_ID separator): ",N[I]),this.$={id:N[I]};break;case 30:E.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",N[I-1],N[I]),this.$={id:N[I-1],label:N[I].label,typeStr:N[I].typeStr,directions:N[I].directions};break;case 31:E.getLogger().debug("Rule: dirList: ",N[I]),this.$=[N[I]];break;case 32:E.getLogger().debug("Rule: dirList: ",N[I-1],N[I]),this.$=[N[I-1]].concat(N[I]);break;case 33:E.getLogger().debug("Rule: nodeShapeNLabel: ",N[I-2],N[I-1],N[I]),this.$={typeStr:N[I-2]+N[I],label:N[I-1]};break;case 34:E.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",N[I-3],N[I-2]," #3:",N[I-1],N[I]),this.$={typeStr:N[I-3]+N[I],label:N[I-2],directions:N[I-1]};break;case 35:case 36:this.$={type:"classDef",id:N[I-1].trim(),css:N[I].trim()};break;case 37:this.$={type:"applyClass",id:N[I-1].trim(),styleClass:N[I].trim()};break;case 38:this.$={type:"applyStyles",id:N[I-1].trim(),stylesStr:N[I].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:i,29:n,31:a,39:s,43:l,46:u},{8:[1,20]},e(h,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:r,28:i,29:n,31:a,39:s,43:l,46:u}),e(d,[2,16],{14:22,15:f,16:p}),e(d,[2,17]),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,22]),e(m,[2,25],{27:[1,25]}),e(d,[2,26]),{19:26,26:12,31:a},{10:t,11:27,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:i,29:n,31:a,39:s,43:l,46:u},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(g,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(h,[2,13]),{26:35,31:a},{31:[2,14]},{17:[1,36]},e(m,[2,24]),{10:t,11:37,13:4,14:22,15:f,16:p,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:i,29:n,31:a,39:s,43:l,46:u},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(g,[2,30]),{18:[1,43]},{18:[1,44]},e(m,[2,23]),{18:[1,45]},{30:[1,46]},e(d,[2,28]),e(d,[2,35]),e(d,[2,36]),e(d,[2,37]),e(d,[2,38]),{36:[1,47]},{33:48,34:y},{15:[1,50]},e(d,[2,27]),e(g,[2,33]),{38:[1,51]},{33:52,34:y,38:[2,31]},{31:[2,15]},e(g,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:o(function(w,C){if(C.recoverable)this.trace(w);else{var k=new Error(w);throw k.hash=C,k}},"parseError"),parse:o(function(w){var C=this,k=[0],E=[],A=[null],N=[],P=this.table,I="",D=0,_=0,R=0,M=2,L=1,B=N.slice.call(arguments,1),O=Object.create(this.lexer),$={yy:{}};for(var G in this.yy)Object.prototype.hasOwnProperty.call(this.yy,G)&&($.yy[G]=this.yy[G]);O.setInput(w,$.yy),$.yy.lexer=O,$.yy.parser=this,typeof O.yylloc>"u"&&(O.yylloc={});var F=O.yylloc;N.push(F);var V=O.options&&O.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function H(Ee){k.length=k.length-2*Ee,A.length=A.length-Ee,N.length=N.length-Ee}o(H,"popStack");function j(){var Ee;return Ee=E.pop()||O.lex()||L,typeof Ee!="number"&&(Ee instanceof Array&&(E=Ee,Ee=E.pop()),Ee=C.symbols_[Ee]||Ee),Ee}o(j,"lex");for(var U,Q,Y,ae,J,te,re={},ee,Te,ue,De;;){if(Y=k[k.length-1],this.defaultActions[Y]?ae=this.defaultActions[Y]:((U===null||typeof U>"u")&&(U=j()),ae=P[Y]&&P[Y][U]),typeof ae>"u"||!ae.length||!ae[0]){var Ie="";De=[];for(ee in P[Y])this.terminals_[ee]&&ee>M&&De.push("'"+this.terminals_[ee]+"'");O.showPosition?Ie="Parse error on line "+(D+1)+`: +`+O.showPosition()+` +Expecting `+De.join(", ")+", got '"+(this.terminals_[U]||U)+"'":Ie="Parse error on line "+(D+1)+": Unexpected "+(U==L?"end of input":"'"+(this.terminals_[U]||U)+"'"),this.parseError(Ie,{text:O.match,token:this.terminals_[U]||U,line:O.yylineno,loc:F,expected:De})}if(ae[0]instanceof Array&&ae.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Y+", token: "+U);switch(ae[0]){case 1:k.push(U),A.push(O.yytext),N.push(O.yylloc),k.push(ae[1]),U=null,Q?(U=Q,Q=null):(_=O.yyleng,I=O.yytext,D=O.yylineno,F=O.yylloc,R>0&&R--);break;case 2:if(Te=this.productions_[ae[1]][1],re.$=A[A.length-Te],re._$={first_line:N[N.length-(Te||1)].first_line,last_line:N[N.length-1].last_line,first_column:N[N.length-(Te||1)].first_column,last_column:N[N.length-1].last_column},V&&(re._$.range=[N[N.length-(Te||1)].range[0],N[N.length-1].range[1]]),te=this.performAction.apply(re,[I,_,D,$.yy,ae[1],A,N].concat(B)),typeof te<"u")return te;Te&&(k=k.slice(0,-1*Te*2),A=A.slice(0,-1*Te),N=N.slice(0,-1*Te)),k.push(this.productions_[ae[1]][0]),A.push(re.$),N.push(re._$),ue=P[k[k.length-2]][k[k.length-1]],k.push(ue);break;case 3:return!0}}return!0},"parse")},x=(function(){var T={EOF:1,parseError:o(function(C,k){if(this.yy.parser)this.yy.parser.parseError(C,k);else throw new Error(C)},"parseError"),setInput:o(function(w,C){return this.yy=C||this.yy||{},this._input=w,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var w=this._input[0];this.yytext+=w,this.yyleng++,this.offset++,this.match+=w,this.matched+=w;var C=w.match(/(?:\r\n?|\n).*/g);return C?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),w},"input"),unput:o(function(w){var C=w.length,k=w.split(/(?:\r\n?|\n)/g);this._input=w+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-C),this.offset-=C;var E=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),k.length-1&&(this.yylineno-=k.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:k?(k.length===E.length?this.yylloc.first_column:0)+E[E.length-k.length].length-k[0].length:this.yylloc.first_column-C},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-C]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(w){this.unput(this.match.slice(w))},"less"),pastInput:o(function(){var w=this.matched.substr(0,this.matched.length-this.match.length);return(w.length>20?"...":"")+w.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var w=this.match;return w.length<20&&(w+=this._input.substr(0,20-w.length)),(w.substr(0,20)+(w.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var w=this.pastInput(),C=new Array(w.length+1).join("-");return w+this.upcomingInput()+` +`+C+"^"},"showPosition"),test_match:o(function(w,C){var k,E,A;if(this.options.backtrack_lexer&&(A={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(A.yylloc.range=this.yylloc.range.slice(0))),E=w[0].match(/(?:\r\n?|\n).*/g),E&&(this.yylineno+=E.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:E?E[E.length-1].length-E[E.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+w[0].length},this.yytext+=w[0],this.match+=w[0],this.matches=w,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(w[0].length),this.matched+=w[0],k=this.performAction.call(this,this.yy,this,C,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),k)return k;if(this._backtrack){for(var N in A)this[N]=A[N];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var w,C,k,E;this._more||(this.yytext="",this.match="");for(var A=this._currentRules(),N=0;NC[0].length)){if(C=k,E=N,this.options.backtrack_lexer){if(w=this.test_match(k,A[N]),w!==!1)return w;if(this._backtrack){C=!1;continue}else return!1}else if(!this.options.flex)break}return C?(w=this.test_match(C,A[E]),w!==!1?w:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var C=this.next();return C||this.lex()},"lex"),begin:o(function(C){this.conditionStack.push(C)},"begin"),popState:o(function(){var C=this.conditionStack.length-1;return C>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(C){return C=this.conditionStack.length-1-Math.abs(C||0),C>=0?this.conditionStack[C]:"INITIAL"},"topState"),pushState:o(function(C){this.begin(C)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:o(function(C,k,E,A){var N=A;switch(E){case 0:return C.getLogger().debug("Found block-beta"),10;break;case 1:return C.getLogger().debug("Found id-block"),29;break;case 2:return C.getLogger().debug("Found block"),10;break;case 3:C.getLogger().debug(".",k.yytext);break;case 4:C.getLogger().debug("_",k.yytext);break;case 5:return 5;case 6:return k.yytext=-1,28;break;case 7:return k.yytext=k.yytext.replace(/columns\s+/,""),C.getLogger().debug("COLUMNS (LEX)",k.yytext),28;break;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:C.getLogger().debug("LEX: POPPING STR:",k.yytext),this.popState();break;case 13:return C.getLogger().debug("LEX: STR end:",k.yytext),"STR";break;case 14:return k.yytext=k.yytext.replace(/space\:/,""),C.getLogger().debug("SPACE NUM (LEX)",k.yytext),21;break;case 15:return k.yytext="1",C.getLogger().debug("COLUMNS (LEX)",k.yytext),21;break;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;break;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 21:return this.popState(),this.pushState("CLASSDEFID"),40;break;case 22:return this.popState(),41;break;case 23:return this.pushState("CLASS"),43;break;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;break;case 25:return this.popState(),45;break;case 26:return this.pushState("STYLE_STMNT"),46;break;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;break;case 28:return this.popState(),48;break;case 29:return this.pushState("acc_title"),"acc_title";break;case 30:return this.popState(),"acc_title_value";break;case 31:return this.pushState("acc_descr"),"acc_descr";break;case 32:return this.popState(),"acc_descr_value";break;case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),C.getLogger().debug("Lex: (("),"NODE_DEND";break;case 38:return this.popState(),C.getLogger().debug("Lex: (("),"NODE_DEND";break;case 39:return this.popState(),C.getLogger().debug("Lex: ))"),"NODE_DEND";break;case 40:return this.popState(),C.getLogger().debug("Lex: (("),"NODE_DEND";break;case 41:return this.popState(),C.getLogger().debug("Lex: (("),"NODE_DEND";break;case 42:return this.popState(),C.getLogger().debug("Lex: (-"),"NODE_DEND";break;case 43:return this.popState(),C.getLogger().debug("Lex: -)"),"NODE_DEND";break;case 44:return this.popState(),C.getLogger().debug("Lex: (("),"NODE_DEND";break;case 45:return this.popState(),C.getLogger().debug("Lex: ]]"),"NODE_DEND";break;case 46:return this.popState(),C.getLogger().debug("Lex: ("),"NODE_DEND";break;case 47:return this.popState(),C.getLogger().debug("Lex: ])"),"NODE_DEND";break;case 48:return this.popState(),C.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 49:return this.popState(),C.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 50:return this.popState(),C.getLogger().debug("Lex: )]"),"NODE_DEND";break;case 51:return this.popState(),C.getLogger().debug("Lex: )"),"NODE_DEND";break;case 52:return this.popState(),C.getLogger().debug("Lex: ]>"),"NODE_DEND";break;case 53:return this.popState(),C.getLogger().debug("Lex: ]"),"NODE_DEND";break;case 54:return C.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;break;case 55:return C.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;break;case 56:return C.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;break;case 57:return C.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 58:return C.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;break;case 59:return C.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 60:return C.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 61:return C.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 62:return C.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;break;case 63:return C.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;break;case 64:return C.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 65:return this.pushState("NODE"),35;break;case 66:return this.pushState("NODE"),35;break;case 67:return this.pushState("NODE"),35;break;case 68:return this.pushState("NODE"),35;break;case 69:return this.pushState("NODE"),35;break;case 70:return this.pushState("NODE"),35;break;case 71:return this.pushState("NODE"),35;break;case 72:return C.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;break;case 73:return this.pushState("BLOCK_ARROW"),C.getLogger().debug("LEX ARR START"),37;break;case 74:return C.getLogger().debug("Lex: NODE_ID",k.yytext),31;break;case 75:return C.getLogger().debug("Lex: EOF",k.yytext),8;break;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:C.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:C.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return C.getLogger().debug("LEX: NODE_DESCR:",k.yytext),"NODE_DESCR";break;case 83:C.getLogger().debug("LEX POPPING"),this.popState();break;case 84:C.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return k.yytext=k.yytext.replace(/^,\s*/,""),C.getLogger().debug("Lex (right): dir:",k.yytext),"DIR";break;case 86:return k.yytext=k.yytext.replace(/^,\s*/,""),C.getLogger().debug("Lex (left):",k.yytext),"DIR";break;case 87:return k.yytext=k.yytext.replace(/^,\s*/,""),C.getLogger().debug("Lex (x):",k.yytext),"DIR";break;case 88:return k.yytext=k.yytext.replace(/^,\s*/,""),C.getLogger().debug("Lex (y):",k.yytext),"DIR";break;case 89:return k.yytext=k.yytext.replace(/^,\s*/,""),C.getLogger().debug("Lex (up):",k.yytext),"DIR";break;case 90:return k.yytext=k.yytext.replace(/^,\s*/,""),C.getLogger().debug("Lex (down):",k.yytext),"DIR";break;case 91:return k.yytext="]>",C.getLogger().debug("Lex (ARROW_DIR end):",k.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";break;case 92:return C.getLogger().debug("Lex: LINK","#"+k.yytext+"#"),15;break;case 93:return C.getLogger().debug("Lex: LINK",k.yytext),15;break;case 94:return C.getLogger().debug("Lex: LINK",k.yytext),15;break;case 95:return C.getLogger().debug("Lex: LINK",k.yytext),15;break;case 96:return C.getLogger().debug("Lex: START_LINK",k.yytext),this.pushState("LLABEL"),16;break;case 97:return C.getLogger().debug("Lex: START_LINK",k.yytext),this.pushState("LLABEL"),16;break;case 98:return C.getLogger().debug("Lex: START_LINK",k.yytext),this.pushState("LLABEL"),16;break;case 99:this.pushState("md_string");break;case 100:return C.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";break;case 101:return this.popState(),C.getLogger().debug("Lex: LINK","#"+k.yytext+"#"),15;break;case 102:return this.popState(),C.getLogger().debug("Lex: LINK",k.yytext),15;break;case 103:return this.popState(),C.getLogger().debug("Lex: LINK",k.yytext),15;break;case 104:return C.getLogger().debug("Lex: COLON",k.yytext),k.yytext=k.yytext.slice(1),27;break}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return T})();v.lexer=x;function b(){this.yy={}}return o(b,"Parser"),b.prototype=v,v.Parser=b,new b})();Tq.parser=Tq;e8e=Tq});function J4t(e){switch(Z.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return Z.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}function eSt(e){switch(Z.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}function tSt(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}function rSt(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}function iSt(e){return e.includes("==")?"thick":"normal"}function nSt(e){return e.includes(".-")?"dotted":"solid"}var Ql,kq,Cq,r8e,i8e,H4t,a8e,Y4t,b_,wq,j4t,X4t,K4t,Z4t,s8e,Sq,aC,Q4t,n8e,aSt,sSt,oSt,lSt,cSt,uSt,hSt,dSt,fSt,pSt,mSt,gSt,ySt,o8e,l8e=z(()=>{"use strict";s4();br();Ut();St();Ir();Ci();Ql=new Map,kq=[],Cq=new Map,r8e="color",i8e="fill",H4t="bgFill",a8e=",",Y4t=ge(),b_=new Map,wq="",j4t=o(e=>vt.sanitizeText(e,Y4t),"sanitizeText"),X4t=o(function(e,t=""){let r=b_.get(e);r||(r={id:e,styles:[],textStyles:[]},b_.set(e,r)),t?.split(a8e).forEach(i=>{let n=i.replace(/([^;]*);/,"$1").trim();if(RegExp(r8e).exec(i)){let s=n.replace(i8e,H4t).replace(r8e,i8e);r.textStyles.push(s)}r.styles.push(n)})},"addStyleClass"),K4t=o(function(e,t=""){let r=Ql.get(e);t!=null&&(r.styles=t.split(a8e))},"addStyle2Node"),Z4t=o(function(e,t){e.split(",").forEach(function(r){let i=Ql.get(r);if(i===void 0){let n=r.trim();i={id:n,type:"na",children:[]},Ql.set(n,i)}i.classes||(i.classes=[]),i.classes.push(t)})},"setCssClass"),s8e=o((e,t)=>{let r=e.flat(),i=[],a=r.find(s=>s?.type==="column-setting")?.columns??-1;for(let s of r){if(typeof a=="number"&&a>0&&s.type!=="column-setting"&&typeof s.widthInColumns=="number"&&s.widthInColumns>a&&Z.warn(`Block ${s.id} width ${s.widthInColumns} exceeds configured column width ${a}`),s.label&&(s.label=j4t(s.label)),s.type==="classDef"){X4t(s.id,s.css);continue}if(s.type==="applyClass"){Z4t(s.id,s?.styleClass??"");continue}if(s.type==="applyStyles"){s?.stylesStr&&K4t(s.id,s?.stylesStr);continue}if(s.type==="column-setting")t.columns=s.columns??-1;else if(s.type==="edge"){let l=(Cq.get(s.id)??0)+1;Cq.set(s.id,l),s.id=l+"-"+s.id,kq.push(s)}else{s.label||(s.type==="composite"?s.label="":s.label=s.id);let l=Ql.get(s.id);if(l===void 0?Ql.set(s.id,s):(s.type!=="na"&&(l.type=s.type),s.label!==s.id&&(l.label=s.label)),s.children&&s8e(s.children,s),s.type==="space"){let u=s.width??1;for(let h=0;h{Z.debug("Clear called"),gr(),aC={id:"root",type:"composite",children:[],columns:-1},Ql=new Map([["root",aC]]),Sq=[],b_=new Map,kq=[],Cq=new Map,wq=""},"clear");o(J4t,"typeStr2Type");o(eSt,"edgeTypeStr2Type");o(tSt,"edgeStrToEdgeData");o(rSt,"edgeStrToEdgeStartData");o(iSt,"edgeStrToThickness");o(nSt,"edgeStrToPattern");n8e=0,aSt=o(()=>(n8e++,"id-"+Math.random().toString(36).substr(2,12)+"-"+n8e),"generateId"),sSt=o(e=>{aC.children=e,s8e(e,aC),Sq=aC.children},"setHierarchy"),oSt=o(e=>{let t=Ql.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),lSt=o(()=>[...Ql.values()],"getBlocksFlat"),cSt=o(()=>Sq||[],"getBlocks"),uSt=o(()=>kq,"getEdges"),hSt=o(e=>Ql.get(e),"getBlock"),dSt=o(e=>{Ql.set(e.id,e)},"setBlock"),fSt=o(e=>{wq=e},"setDiagramId"),pSt=o(()=>wq,"getDiagramId"),mSt=o(()=>Z,"getLogger"),gSt=o(function(){return b_},"getClasses"),ySt={getConfig:o(()=>Nt().block,"getConfig"),typeStr2Type:J4t,edgeTypeStr2Type:eSt,edgeStrToEdgeData:tSt,edgeStrToEdgeStartData:rSt,edgeStrToThickness:iSt,edgeStrToPattern:nSt,getLogger:mSt,getBlocksFlat:lSt,getBlocks:cSt,getEdges:uSt,setHierarchy:sSt,getBlock:hSt,setBlock:dSt,getColumns:oSt,getClasses:gSt,clear:Q4t,generateId:aSt,setDiagramId:fSt,getDiagramId:pSt},o8e=ySt});var Eq,vSt,c8e,u8e=z(()=>{"use strict";Cn();k1();Eq=o((e,t)=>{let r=Ff,i=r(e,"r"),n=r(e,"g"),a=r(e,"b");return mn(i,n,a,t)},"fade"),vSt=o(e=>`.label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor||e.textColor}; + } + .cluster-label text { + fill: ${e.titleColor}; + } + .cluster-label span,p { + color: ${e.titleColor}; + } + + + + .label text,span,p { + fill: ${e.nodeTextColor||e.textColor}; + color: ${e.nodeTextColor||e.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: 1px; + } + .flowchart-label text { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${e.arrowheadColor}; + } + + .edgePath .path { + stroke: ${e.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${e.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${e.edgeLabelBackground}; + /* + * This is for backward compatibility with existing code that didn't + * add a \`

    \` around edge labels. + * + * TODO: We should probably remove this in a future release. + */ + p { + margin: 0; + padding: 0; + display: inline; + } + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${e.edgeLabelBackground}; + } + + .node .cluster { + // fill: ${Eq(e.mainBkg,.5)}; + fill: ${Eq(e.clusterBkg,.5)}; + stroke: ${Eq(e.clusterBorder,.2)}; + box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; + stroke-width: 1px; + } + + .cluster text { + fill: ${e.titleColor}; + } + + .cluster span,p { + color: ${e.titleColor}; + } + /* .cluster div { + color: ${e.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${e.fontFamily}; + font-size: 12px; + background: ${e.tertiaryColor}; + border: 1px solid ${e.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; + } + ${Vc()} +`,"getStyles"),c8e=vSt});var xSt,bSt,TSt,CSt,kSt,wSt,SSt,ESt,ASt,_St,DSt,h8e,d8e=z(()=>{"use strict";St();xSt=o((e,t,r,i)=>{t.forEach(n=>{DSt[n](e,r,i)})},"insertMarkers"),bSt=o((e,t,r)=>{Z.trace("Making markers for ",r),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),TSt=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),CSt=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),kSt=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",r+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),wSt=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",r+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),SSt=o((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),ESt=o((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),ASt=o((e,t,r)=>{e.append("marker").attr("id",r+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",r+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),_St=o((e,t,r)=>{e.append("defs").append("marker").attr("id",r+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),DSt={extension:bSt,composition:TSt,aggregation:CSt,dependency:kSt,lollipop:wSt,point:SSt,circle:ESt,cross:ASt,barb:_St},h8e=xSt});function f8e(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};let r=t%e,i=Math.floor(t/e);return{px:r,py:i}}function Aq(e,t,r=0,i=0){Z.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",r),e?.size?.width||(e.size={width:r,height:i,x:0,y:0});let n=0,a=0;if(e.children?.length>0){for(let m of e.children)Aq(m,t);let s=RSt(e);n=s.width,a=s.height,Z.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",n,a);for(let m of e.children)m.size&&(Z.debug(`abc95 Setting size of children of ${e.id} id=${m.id} ${n} ${a} ${JSON.stringify(m.size)}`),m.size.width=n*(m.widthInColumns??1)+Tn*((m.widthInColumns??1)-1),m.size.height=a,m.size.x=0,m.size.y=0,Z.debug(`abc95 updating size of ${e.id} children child:${m.id} maxWidth:${n} maxHeight:${a}`));for(let m of e.children)Aq(m,t,n,a);let l=e.columns??-1,u=0;for(let m of e.children)u+=m.widthInColumns??1;let h=e.children.length;l>0&&l0?Math.min(e.children.length,l):e.children.length;if(m>0){let g=(f-m*Tn-Tn)/m;Z.debug("abc95 (growing to fit) width",e.id,f,e.size?.width,g);for(let y of e.children)y.size&&(y.size.width=g)}}e.size={width:f,height:p,x:0,y:0}}Z.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}function p8e(e,t){Z.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);let r=e.columns??-1;if(Z.debug("layoutBlocks columns abc95",e.id,"=>",r,e),e.children&&e.children.length>0){let i=e?.children[0]?.size?.width??0,n=e.children.length*i+(e.children.length-1)*Tn;Z.debug("widthOfChildren 88",n,"posX");let a=new Map;{let d=0;for(let f of e.children){if(!f.size)continue;let{py:p}=f8e(r,d),m=a.get(p)??0;f.size.height>m&&a.set(p,f.size.height);let g=f?.widthInColumns??1;r>0&&(g=Math.min(g,r-d%r)),d+=g}}let s=new Map;{let d=0,f=[...a.keys()].sort((p,m)=>p-m);for(let p of f)s.set(p,d),d+=(a.get(p)??0)+Tn}let l=0;Z.debug("abc91 block?.size?.x",e.id,e?.size?.x);let u=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-Tn,h=0;for(let d of e.children){let f=e;if(!d.size)continue;let{width:p,height:m}=d.size,{px:g,py:y}=f8e(r,l);if(y!=h&&(h=y,u=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-Tn,Z.debug("New row in layout for block",e.id," and child ",d.id,h)),Z.debug(`abc89 layout blocks (child) id: ${d.id} Pos: ${l} (px, py) ${g},${y} (${f?.size?.x},${f?.size?.y}) parent: ${f.id} width: ${p}${Tn}`),f.size){let x=p/2;d.size.x=u+Tn+x,Z.debug(`abc91 layout blocks (calc) px, pyid:${d.id} startingPos=X${u} new startingPosX${d.size.x} ${x} padding=${Tn} width=${p} halfWidth=${x} => x:${d.size.x} y:${d.size.y} ${d.widthInColumns} (width * (child?.w || 1)) / 2 ${p*(d?.widthInColumns??1)/2}`),u=d.size.x+x;let b=s.get(y)??0,T=a.get(y)??m;d.size.y=f.size.y-f.size.height/2+b+T/2+Tn,Z.debug(`abc88 layout blocks (calc) px, pyid:${d.id}startingPosX${u}${Tn}${x}=>x:${d.size.x}y:${d.size.y}${d.widthInColumns}(width * (child?.w || 1)) / 2${p*(d?.widthInColumns??1)/2}`)}d.children&&p8e(d,t);let v=d?.widthInColumns??1;r>0&&(v=Math.min(v,r-l%r)),l+=v,Z.debug("abc88 columnsPos",d,l)}}Z.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}function m8e(e,{minX:t,minY:r,maxX:i,maxY:n}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){let{x:a,y:s,width:l,height:u}=e.size;a-l/2i&&(i=a+l/2),s+u/2>n&&(n=s+u/2)}if(e.children)for(let a of e.children)({minX:t,minY:r,maxX:i,maxY:n}=m8e(a,{minX:t,minY:r,maxX:i,maxY:n}));return{minX:t,minY:r,maxX:i,maxY:n}}function g8e(e){let t=e.getBlock("root");if(!t)return;Aq(t,e,0,0),p8e(t,e),Z.debug("getBlocks",JSON.stringify(t,null,2));let{minX:r,minY:i,maxX:n,maxY:a}=m8e(t),s=a-i,l=n-r;return{x:r,y:i,width:l,height:s}}var Tn,RSt,y8e=z(()=>{"use strict";St();Ut();Tn=ge()?.block?.padding??8;o(f8e,"calculateBlockPosition");RSt=o(e=>{let t=0,r=0;for(let i of e.children){let{width:n,height:a,x:s,y:l}=i.size??{width:0,height:0,x:0,y:0};if(Z.debug("getMaxChildSize abc95 child:",i.id,"width:",n,"height:",a,"x:",s,"y:",l,i.type),i.type==="space")continue;let u=n/(i.widthInColumns??1);u>t&&(t=u),a>r&&(r=a)}return{width:t,height:r}},"getMaxChildSize");o(Aq,"setBlockSizes");o(p8e,"layoutBlocks");o(m8e,"findBounds");o(g8e,"layout")});var LSt,js,T_=z(()=>{"use strict";br();Ut();_s();LSt=o(async(e,t,r,i=!1,n=!1)=>{let a=t||"";typeof a=="object"&&(a=a[0]);let s=ge(),l=Mr(s);return await wi(e,a,{style:r,isTitle:i,useHtmlLabels:l,markdown:!1,isNode:n,width:Number.POSITIVE_INFINITY},s)},"createLabel"),js=LSt});var x8e,MSt,v8e,b8e=z(()=>{"use strict";St();x8e=o((e,t,r,i,n)=>{t.arrowTypeStart&&v8e(e,"start",t.arrowTypeStart,r,i,n),t.arrowTypeEnd&&v8e(e,"end",t.arrowTypeEnd,r,i,n)},"addEdgeMarkers"),MSt={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},v8e=o((e,t,r,i,n,a)=>{let s=MSt[r];if(!s){Z.warn(`Unknown arrow type: ${r}`);return}let l=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${i}#${n}_${a}-${s}${l})`)},"addEdgeMarker")});function C_(e,t){Mr(ge())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}var _q,$a,C8e,k8e,NSt,ISt,T8e,w8e,S8e=z(()=>{"use strict";St();T_();_s();ON();Rr();Ut();br();Xt();Ir();BN();rb();b8e();_q={},$a={},C8e=o(async(e,t)=>{let r=ge(),i=Mr(r),n=e.insert("g").attr("class","edgeLabel"),a=n.insert("g").attr("class","label"),s=t.labelType==="markdown",l=await wi(e,t.label,{style:t.labelStyle,useHtmlLabels:i,addSvgBackground:s,isNode:!1,markdown:s,width:s?void 0:Number.POSITIVE_INFINITY},r);a.node().appendChild(l);let u=l.getBBox(),h=u;if(i){let f=l.children[0],p=Je(l);u=f.getBoundingClientRect(),h=u,p.attr("width",u.width),p.attr("height",u.height)}else{let f=Je(l).select("text").node();f&&typeof f.getBBox=="function"&&(h=f.getBBox())}a.attr("transform",$o(h,i)),_q[t.id]=n,t.width=u.width,t.height=u.height;let d;if(t.startLabelLeft){let f=e.insert("g").attr("class","edgeTerminals"),p=f.insert("g").attr("class","inner"),m=await js(p,t.startLabelLeft,t.labelStyle);d=m;let g=m.getBBox();if(i){let y=m.children[0],v=Je(m);g=y.getBoundingClientRect(),v.attr("width",g.width),v.attr("height",g.height)}p.attr("transform",$o(g,i)),$a[t.id]||($a[t.id]={}),$a[t.id].startLeft=f,C_(d,t.startLabelLeft)}if(t.startLabelRight){let f=e.insert("g").attr("class","edgeTerminals"),p=f.insert("g").attr("class","inner"),m=await js(p,t.startLabelRight,t.labelStyle);d=m;let g=m.getBBox();if(i){let y=m.children[0],v=Je(m);g=y.getBoundingClientRect(),v.attr("width",g.width),v.attr("height",g.height)}p.attr("transform",$o(g,i)),$a[t.id]||($a[t.id]={}),$a[t.id].startRight=f,C_(d,t.startLabelRight)}if(t.endLabelLeft){let f=e.insert("g").attr("class","edgeTerminals"),p=f.insert("g").attr("class","inner"),m=await js(f,t.endLabelLeft,t.labelStyle);d=m;let g=m.getBBox();if(i){let y=m.children[0],v=Je(m);g=y.getBoundingClientRect(),v.attr("width",g.width),v.attr("height",g.height)}p.attr("transform",$o(g,i)),$a[t.id]||($a[t.id]={}),$a[t.id].endLeft=f,C_(d,t.endLabelLeft)}if(t.endLabelRight){let f=e.insert("g").attr("class","edgeTerminals"),p=f.insert("g").attr("class","inner"),m=await js(f,t.endLabelRight,t.labelStyle);d=m;let g=m.getBBox();if(i){let y=m.children[0],v=Je(m);g=y.getBoundingClientRect(),v.attr("width",g.width),v.attr("height",g.height)}p.attr("transform",$o(g,i)),$a[t.id]||($a[t.id]={}),$a[t.id].endRight=f,C_(d,t.endLabelRight)}return l},"insertEdgeLabel");o(C_,"setTerminalWidth");k8e=o((e,t)=>{Z.debug("Moving label abc88 ",e.id,e.label,_q[e.id],t);let r=t.updatedPath?t.updatedPath:t.originalPath,i=ge(),{subGraphTitleTotalMargin:n}=zu(i);if(e.label){let a=_q[e.id],s=e.x,l=e.y;if(r){let u=Zt.calcLabelPosition(r);Z.debug("Moving label "+e.label+" from (",s,",",l,") to (",u.x,",",u.y,") abc88"),t.updatedPath&&(s=u.x,l=u.y)}a.attr("transform",`translate(${s}, ${l+n/2})`)}if(e.startLabelLeft){let a=$a[e.id].startLeft,s=e.x,l=e.y;if(r){let u=Zt.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",r);s=u.x,l=u.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.startLabelRight){let a=$a[e.id].startRight,s=e.x,l=e.y;if(r){let u=Zt.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",r);s=u.x,l=u.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.endLabelLeft){let a=$a[e.id].endLeft,s=e.x,l=e.y;if(r){let u=Zt.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",r);s=u.x,l=u.y}a.attr("transform",`translate(${s}, ${l})`)}if(e.endLabelRight){let a=$a[e.id].endRight,s=e.x,l=e.y;if(r){let u=Zt.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",r);s=u.x,l=u.y}a.attr("transform",`translate(${s}, ${l})`)}},"positionEdgeLabel"),NSt=o((e,t)=>{let r=e.x,i=e.y,n=Math.abs(t.x-r),a=Math.abs(t.y-i),s=e.width/2,l=e.height/2;return n>=s||a>=l},"outsideNode"),ISt=o((e,t,r)=>{Z.debug(`intersection calc abc89: + outsidePoint: ${JSON.stringify(t)} + insidePoint : ${JSON.stringify(r)} + node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);let i=e.x,n=e.y,a=Math.abs(i-r.x),s=e.width/2,l=r.xMath.abs(i-t.x)*u){let f=r.y{Z.debug("abc88 cutPathAtIntersect",e,t);let r=[],i=e[0],n=!1;return e.forEach(a=>{if(!NSt(t,a)&&!n){let s=ISt(t,i,a),l=!1;r.forEach(u=>{l=l||u.x===s.x&&u.y===s.y}),r.some(u=>u.x===s.x&&u.y===s.y)||r.push(s),n=!0}else i=a,n||r.push(a)}),r},"cutPathAtIntersect"),w8e=o(function(e,t,r,i,n,a,s){let l=r.points;Z.debug("abc88 InsertEdge: edge=",r,"e=",t);let u=!1,h=a.node(t.v);var d=a.node(t.w);d?.intersect&&h?.intersect&&(l=l.slice(1,r.points.length-1),l.unshift(h.intersect(l[0])),l.push(d.intersect(l[l.length-1]))),r.toCluster&&(Z.debug("to cluster abc88",i[r.toCluster]),l=T8e(r.points,i[r.toCluster].node),u=!0),r.fromCluster&&(Z.debug("from cluster abc88",i[r.fromCluster]),l=T8e(l.reverse(),i[r.fromCluster].node).reverse(),u=!0);let f=l.filter(w=>!Number.isNaN(w.y)),p=Dl;r.curve&&(n==="graph"||n==="flowchart")&&(p=r.curve);let{x:m,y:g}=U4(r),y=_l().x(m).y(g).curve(p),v;switch(r.thickness){case"normal":v="edge-thickness-normal";break;case"thick":v="edge-thickness-thick";break;case"invisible":v="edge-thickness-thick";break;default:v=""}switch(r.pattern){case"solid":v+=" edge-pattern-solid";break;case"dotted":v+=" edge-pattern-dotted";break;case"dashed":v+=" edge-pattern-dashed";break}let x=e.append("path").attr("d",y(f)).attr("id",r.id).attr("class"," "+v+(r.classes?" "+r.classes:"")).attr("style",r.style),b="";(ge().flowchart.arrowMarkerAbsolute||ge().state.arrowMarkerAbsolute)&&(b=Hf(!0)),x8e(x,r,b,s,n);let T={};return u&&(T.updatedPath=l),T.originalPath=r.points,T},"insertEdge")});var OSt,E8e,A8e=z(()=>{"use strict";OSt=o(e=>{let t=new Set;for(let r of e)switch(r){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(r);break}return t},"expandAndDeduplicateDirections"),E8e=o((e,t,r,i)=>{let n=OSt(e),a=2,s=t.height+2*r.padding,l=s/a,u=i??t.width+2*l+r.padding,h=r.padding/2;return n.has("right")&&n.has("left")&&n.has("up")&&n.has("down")?[{x:0,y:0},{x:l,y:0},{x:u/2,y:2*h},{x:u-l,y:0},{x:u,y:0},{x:u,y:-s/3},{x:u+2*h,y:-s/2},{x:u,y:-2*s/3},{x:u,y:-s},{x:u-l,y:-s},{x:u/2,y:-s-2*h},{x:l,y:-s},{x:0,y:-s},{x:0,y:-2*s/3},{x:-2*h,y:-s/2},{x:0,y:-s/3}]:n.has("right")&&n.has("left")&&n.has("up")?[{x:l,y:0},{x:u-l,y:0},{x:u,y:-s/2},{x:u-l,y:-s},{x:l,y:-s},{x:0,y:-s/2}]:n.has("right")&&n.has("left")&&n.has("down")?[{x:0,y:0},{x:l,y:-s},{x:u-l,y:-s},{x:u,y:0}]:n.has("right")&&n.has("up")&&n.has("down")?[{x:0,y:0},{x:u,y:-l},{x:u,y:-s+l},{x:0,y:-s}]:n.has("left")&&n.has("up")&&n.has("down")?[{x:u,y:0},{x:0,y:-l},{x:0,y:-s+l},{x:u,y:-s}]:n.has("right")&&n.has("left")?[{x:l,y:0},{x:l,y:-h},{x:u-l,y:-h},{x:u-l,y:0},{x:u,y:-s/2},{x:u-l,y:-s},{x:u-l,y:-s+h},{x:l,y:-s+h},{x:l,y:-s},{x:0,y:-s/2}]:n.has("up")&&n.has("down")?[{x:u/2,y:0},{x:0,y:-h},{x:l,y:-h},{x:l,y:-s+h},{x:0,y:-s+h},{x:u/2,y:-s},{x:u,y:-s+h},{x:u-l,y:-s+h},{x:u-l,y:-h},{x:u,y:-h}]:n.has("right")&&n.has("up")?[{x:0,y:0},{x:u,y:-l},{x:0,y:-s}]:n.has("right")&&n.has("down")?[{x:0,y:0},{x:u,y:0},{x:0,y:-s}]:n.has("left")&&n.has("up")?[{x:u,y:0},{x:0,y:-l},{x:u,y:-s}]:n.has("left")&&n.has("down")?[{x:u,y:0},{x:0,y:0},{x:u,y:-s}]:n.has("right")?[{x:l,y:-h},{x:l,y:-h},{x:u-l,y:-h},{x:u-l,y:0},{x:u,y:-s/2},{x:u-l,y:-s},{x:u-l,y:-s+h},{x:l,y:-s+h},{x:l,y:-s+h}]:n.has("left")?[{x:l,y:0},{x:l,y:-h},{x:u-l,y:-h},{x:u-l,y:-s+h},{x:l,y:-s+h},{x:l,y:-s},{x:0,y:-s/2}]:n.has("up")?[{x:l,y:-h},{x:l,y:-s+h},{x:0,y:-s+h},{x:u/2,y:-s},{x:u,y:-s+h},{x:u-l,y:-s+h},{x:u-l,y:-h}]:n.has("down")?[{x:u/2,y:0},{x:0,y:-h},{x:l,y:-h},{x:l,y:-s+h},{x:u-l,y:-s+h},{x:u-l,y:-h},{x:u,y:-h}]:[{x:0,y:0}]},"getArrowPoints")});function PSt(e,t){return e.intersect(t)}var _8e,D8e=z(()=>{"use strict";o(PSt,"intersectNode");_8e=PSt});function BSt(e,t,r,i){var n=e.x,a=e.y,s=n-i.x,l=a-i.y,u=Math.sqrt(t*t*l*l+r*r*s*s),h=Math.abs(t*r*s/u);i.x{"use strict";o(BSt,"intersectEllipse");k_=BSt});function FSt(e,t,r){return k_(e,t,t,r)}var R8e,L8e=z(()=>{"use strict";Dq();o(FSt,"intersectCircle");R8e=FSt});function $St(e,t,r,i){var n,a,s,l,u,h,d,f,p,m,g,y,v,x,b;if(n=t.y-e.y,s=e.x-t.x,u=t.x*e.y-e.x*t.y,p=n*r.x+s*r.y+u,m=n*i.x+s*i.y+u,!(p!==0&&m!==0&&M8e(p,m))&&(a=i.y-r.y,l=r.x-i.x,h=i.x*r.y-r.x*i.y,d=a*e.x+l*e.y+h,f=a*t.x+l*t.y+h,!(d!==0&&f!==0&&M8e(d,f))&&(g=n*l-a*s,g!==0)))return y=Math.abs(g/2),v=s*h-l*u,x=v<0?(v-y)/g:(v+y)/g,v=a*u-n*h,b=v<0?(v-y)/g:(v+y)/g,{x,y:b}}function M8e(e,t){return e*t>0}var N8e,I8e=z(()=>{"use strict";o($St,"intersectLine");o(M8e,"sameSign");N8e=$St});function zSt(e,t,r){var i=e.x,n=e.y,a=[],s=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(g){s=Math.min(s,g.x),l=Math.min(l,g.y)}):(s=Math.min(s,t.x),l=Math.min(l,t.y));for(var u=i-e.width/2-s,h=n-e.height/2-l,d=0;d1&&a.sort(function(g,y){var v=g.x-r.x,x=g.y-r.y,b=Math.sqrt(v*v+x*x),T=y.x-r.x,w=y.y-r.y,C=Math.sqrt(T*T+w*w);return b{"use strict";I8e();O8e=zSt;o(zSt,"intersectPolygon")});var GSt,B8e,F8e=z(()=>{"use strict";GSt=o((e,t)=>{var r=e.x,i=e.y,n=t.x-r,a=t.y-i,s=e.width/2,l=e.height/2,u,h;return Math.abs(a)*s>Math.abs(n)*l?(a<0&&(l=-l),u=a===0?0:l*n/a,h=l):(n<0&&(s=-s),u=s,h=n===0?0:s*a/n),{x:r+u,y:i+h}},"intersectRect"),B8e=GSt});var Pi,Rq=z(()=>{"use strict";D8e();L8e();Dq();P8e();F8e();Pi={node:_8e,circle:R8e,ellipse:k_,polygon:O8e,rect:B8e}});function Jl(e,t,r,i){return e.insert("polygon",":first-child").attr("points",i.map(function(n){return n.x+","+n.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+r/2+")")}var Mn,ji,Lq=z(()=>{"use strict";T_();_s();Ut();br();Rr();Ir();Xt();cN();Mn=o(async(e,t,r,i)=>{let n=ge(),a,s=t.useHtmlLabels||Mr(n);r?a=r:a="node default";let l=e.insert("g").attr("class",a).attr("id",t.domId||t.id),u=l.insert("g").attr("class","label").attr("style",t.labelStyle),h;t.labelText===void 0?h="":h=typeof t.labelText=="string"?t.labelText:t.labelText[0];let d;t.labelType==="markdown"?d=wi(u,fr(Qa(h),n),{useHtmlLabels:s,width:t.width||n.flowchart.wrappingWidth,classes:"markdown-node-label"},n):d=await js(u,fr(Qa(h),n),t.labelStyle,!1,i);let f=d.getBBox(),p=t.padding/2;if(Mr(n)){let m=d.children[0],g=Je(d);await E4(m,h),f=m.getBoundingClientRect(),g.attr("width",f.width),g.attr("height",f.height)}return s?u.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"):u.attr("transform","translate(0, "+-f.height/2+")"),t.centerLabel&&u.attr("transform","translate("+-f.width/2+", "+-f.height/2+")"),u.insert("rect",":first-child"),{shapeSvg:l,bbox:f,halfPadding:p,label:u}},"labelHelper"),ji=o((e,t)=>{let r=t.node().getBBox();e.width=r.width,e.height=r.height},"updateNodeBounds");o(Jl,"insertPolygonShape")});var VSt,$8e,z8e=z(()=>{"use strict";Lq();St();Ut();br();Rq();VSt=o(async(e,t)=>{t.useHtmlLabels||Mr(ge())||(t.centerLabel=!0);let{shapeSvg:i,bbox:n,halfPadding:a}=await Mn(e,t,"node "+t.classes,!0);Z.info("Classes = ",t.classes);let s=i.insert("rect",":first-child");return s.attr("rx",t.rx).attr("ry",t.ry).attr("x",-n.width/2-a).attr("y",-n.height/2-a).attr("width",n.width+t.padding).attr("height",n.height+t.padding),ji(t,s),t.intersect=function(l){return Pi.rect(t,l)},i},"note"),$8e=VSt});function Mq(e,t,r,i){let n=[],a=o(l=>{n.push(l,0)},"addBorder"),s=o(l=>{n.push(0,l)},"skipBorder");t.includes("t")?(Z.debug("add top border"),a(r)):s(r),t.includes("r")?(Z.debug("add right border"),a(i)):s(i),t.includes("b")?(Z.debug("add bottom border"),a(r)):s(r),t.includes("l")?(Z.debug("add left border"),a(i)):s(i),e.attr("stroke-dasharray",n.join(" "))}var G8e,ko,V8e,WSt,qSt,USt,HSt,YSt,jSt,XSt,KSt,ZSt,QSt,JSt,e3t,t3t,r3t,i3t,n3t,a3t,s3t,o3t,W8e,l3t,c3t,q8e,w_,Nq,U8e,H8e=z(()=>{"use strict";Rr();Ut();br();St();A8e();T_();Rq();z8e();Lq();G8e=o(e=>e?" "+e:"","formatClass"),ko=o((e,t)=>`${t||"node default"}${G8e(e.classes)} ${G8e(e.class)}`,"getClassesFromNode"),V8e=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=i.width+t.padding,a=i.height+t.padding,s=n+a,l=[{x:s/2,y:0},{x:s,y:-s/2},{x:s/2,y:-s},{x:0,y:-s/2}];Z.info("Question main (Circle)");let u=Jl(r,s,s,l);return u.attr("style",t.style),ji(t,u),t.intersect=function(h){return Z.warn("Intersect called"),Pi.polygon(t,l,h)},r},"question"),WSt=o((e,t)=>{let r=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=28,n=[{x:0,y:i/2},{x:i/2,y:0},{x:0,y:-i/2},{x:-i/2,y:0}];return r.insert("polygon",":first-child").attr("points",n.map(function(s){return s.x+","+s.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(s){return Pi.circle(t,14,s)},r},"choice"),qSt=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=4,a=t.positioned?t.height:i.height+t.padding,s=a/n,l=t.positioned?t.width:i.width+2*s+t.padding,u=[{x:s,y:0},{x:l-s,y:0},{x:l,y:-a/2},{x:l-s,y:-a},{x:s,y:-a},{x:0,y:-a/2}],h=Jl(r,l,a,u);return h.attr("style",t.style),ji(t,h),t.intersect=function(d){return Pi.polygon(t,u,d)},r},"hexagon"),USt=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,void 0,!0),n=2,a=i.height+2*t.padding,s=a/n,l=i.width+2*s+t.padding,h=t.positioned&&(t.widthInColumns??1)>1&&t.width>l?t.width:l,d=E8e(t.directions,i,t,h),f=Jl(r,h,a,d);return f.attr("style",t.style),ji(t,f),t.intersect=function(p){return Pi.polygon(t,d,p)},r},"block_arrow"),HSt=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=i.width+t.padding,a=i.height+t.padding,s=[{x:-a/2,y:0},{x:n,y:0},{x:n,y:-a},{x:-a/2,y:-a},{x:0,y:-a/2}];return Jl(r,n,a,s).attr("style",t.style),t.width=n+a,t.height=a,t.intersect=function(u){return Pi.polygon(t,s,u)},r},"rect_left_inv_arrow"),YSt=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t),!0),n=i.width+t.padding,a=i.height+t.padding,s=[{x:-2*a/6,y:0},{x:n-a/6,y:0},{x:n+2*a/6,y:-a},{x:a/6,y:-a}],l=Jl(r,n,a,s);return l.attr("style",t.style),ji(t,l),t.intersect=function(u){return Pi.polygon(t,s,u)},r},"lean_right"),jSt=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=i.width+t.padding,a=i.height+t.padding,s=[{x:2*a/6,y:0},{x:n+a/6,y:0},{x:n-2*a/6,y:-a},{x:-a/6,y:-a}],l=Jl(r,n,a,s);return l.attr("style",t.style),ji(t,l),t.intersect=function(u){return Pi.polygon(t,s,u)},r},"lean_left"),XSt=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=i.width+t.padding,a=i.height+t.padding,s=[{x:-2*a/6,y:0},{x:n+2*a/6,y:0},{x:n-a/6,y:-a},{x:a/6,y:-a}],l=Jl(r,n,a,s);return l.attr("style",t.style),ji(t,l),t.intersect=function(u){return Pi.polygon(t,s,u)},r},"trapezoid"),KSt=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=i.width+t.padding,a=i.height+t.padding,s=[{x:a/6,y:0},{x:n-a/6,y:0},{x:n+2*a/6,y:-a},{x:-2*a/6,y:-a}],l=Jl(r,n,a,s);return l.attr("style",t.style),ji(t,l),t.intersect=function(u){return Pi.polygon(t,s,u)},r},"inv_trapezoid"),ZSt=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=i.width+t.padding,a=i.height+t.padding,s=[{x:0,y:0},{x:n+a/2,y:0},{x:n,y:-a/2},{x:n+a/2,y:-a},{x:0,y:-a}],l=Jl(r,n,a,s);return l.attr("style",t.style),ji(t,l),t.intersect=function(u){return Pi.polygon(t,s,u)},r},"rect_right_inv_arrow"),QSt=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=i.width+t.padding,a=n/2,s=a/(2.5+n/50),l=i.height+s+t.padding,u="M 0,"+s+" a "+a+","+s+" 0,0,0 "+n+" 0 a "+a+","+s+" 0,0,0 "+-n+" 0 l 0,"+l+" a "+a+","+s+" 0,0,0 "+n+" 0 l 0,"+-l,h=r.attr("label-offset-y",s).insert("path",":first-child").attr("style",t.style).attr("d",u).attr("transform","translate("+-n/2+","+-(l/2+s)+")");return ji(t,h),t.intersect=function(d){let f=Pi.rect(t,d),p=f.x-t.x;if(a!=0&&(Math.abs(p)t.height/2-s)){let m=s*s*(1-p*p/(a*a));m!=0&&(m=Math.sqrt(m)),m=s-m,d.y-t.y>0&&(m=-m),f.y+=m}return f},r},"cylinder"),JSt=o(async(e,t)=>{let{shapeSvg:r,bbox:i,halfPadding:n}=await Mn(e,t,"node "+t.classes+" "+t.class,!0),a=r.insert("rect",":first-child"),s=t.positioned?t.width:i.width+t.padding,l=t.positioned?t.height:i.height+t.padding,u=t.positioned?-s/2:-i.width/2-n,h=t.positioned?-l/2:-i.height/2-n;if(a.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",u).attr("y",h).attr("width",s).attr("height",l),t.props){let d=new Set(Object.keys(t.props));t.props.borders&&(Mq(a,t.props.borders,s,l),d.delete("borders")),d.forEach(f=>{Z.warn(`Unknown node property ${f}`)})}return ji(t,a),t.intersect=function(d){return Pi.rect(t,d)},r},"rect"),e3t=o(async(e,t)=>{let{shapeSvg:r,bbox:i,halfPadding:n}=await Mn(e,t,"node "+t.classes,!0),a=r.insert("rect",":first-child"),s=t.positioned?t.width:i.width+t.padding,l=t.positioned?t.height:i.height+t.padding,u=t.positioned?-s/2:-i.width/2-n,h=t.positioned?-l/2:-i.height/2-n;if(a.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",u).attr("y",h).attr("width",s).attr("height",l),t.props){let d=new Set(Object.keys(t.props));t.props.borders&&(Mq(a,t.props.borders,s,l),d.delete("borders")),d.forEach(f=>{Z.warn(`Unknown node property ${f}`)})}return ji(t,a),t.intersect=function(d){return Pi.rect(t,d)},r},"composite"),t3t=o(async(e,t)=>{let{shapeSvg:r}=await Mn(e,t,"label",!0);Z.trace("Classes = ",t.class);let i=r.insert("rect",":first-child"),n=0,a=0;if(i.attr("width",n).attr("height",a),r.attr("class","label edgeLabel"),t.props){let s=new Set(Object.keys(t.props));t.props.borders&&(Mq(i,t.props.borders,n,a),s.delete("borders")),s.forEach(l=>{Z.warn(`Unknown node property ${l}`)})}return ji(t,i),t.intersect=function(s){return Pi.rect(t,s)},r},"labelRect");o(Mq,"applyNodePropertyBorders");r3t=o(async(e,t)=>{let r;t.classes?r="node "+t.classes:r="node default";let i=e.insert("g").attr("class",r).attr("id",t.domId||t.id),n=i.insert("rect",":first-child"),a=i.insert("line"),s=i.insert("g").attr("class","label"),l=t.labelText.flat?t.labelText.flat():t.labelText,u="";typeof l=="object"?u=l[0]:u=l,Z.info("Label text abc79",u,l,typeof l=="object");let h=await js(s,u,t.labelStyle,!0,!0),d={width:0,height:0};if(Mr(ge())){let y=h.children[0],v=Je(h);d=y.getBoundingClientRect(),v.attr("width",d.width),v.attr("height",d.height)}Z.info("Text 2",l);let f=l.slice(1,l.length),p=h.getBBox(),m=await js(s,f.join?f.join("
    "):f,t.labelStyle,!0,!0);if(Mr(ge())){let y=m.children[0],v=Je(m);d=y.getBoundingClientRect(),v.attr("width",d.width),v.attr("height",d.height)}let g=t.padding/2;return Je(m).attr("transform","translate( "+(d.width>p.width?0:(p.width-d.width)/2)+", "+(p.height+g+5)+")"),Je(h).attr("transform","translate( "+(d.width{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=i.height+t.padding,a=i.width+n/4+t.padding,s=r.insert("rect",":first-child").attr("style",t.style).attr("rx",n/2).attr("ry",n/2).attr("x",-a/2).attr("y",-n/2).attr("width",a).attr("height",n);return ji(t,s),t.intersect=function(l){return Pi.rect(t,l)},r},"stadium"),n3t=o(async(e,t)=>{let{shapeSvg:r,bbox:i,halfPadding:n}=await Mn(e,t,ko(t,void 0),!0),a=r.insert("circle",":first-child");return a.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+n).attr("width",i.width+t.padding).attr("height",i.height+t.padding),Z.info("Circle main"),ji(t,a),t.intersect=function(s){return Z.info("Circle intersect",t,i.width/2+n,s),Pi.circle(t,i.width/2+n,s)},r},"circle"),a3t=o(async(e,t)=>{let{shapeSvg:r,bbox:i,halfPadding:n}=await Mn(e,t,ko(t,void 0),!0),a=5,s=r.insert("g",":first-child"),l=s.insert("circle"),u=s.insert("circle");return s.attr("class",t.class),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+n+a).attr("width",i.width+t.padding+a*2).attr("height",i.height+t.padding+a*2),u.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",i.width/2+n).attr("width",i.width+t.padding).attr("height",i.height+t.padding),Z.info("DoubleCircle main"),ji(t,l),t.intersect=function(h){return Z.info("DoubleCircle intersect",t,i.width/2+n+a,h),Pi.circle(t,i.width/2+n+a,h)},r},"doublecircle"),s3t=o(async(e,t)=>{let{shapeSvg:r,bbox:i}=await Mn(e,t,ko(t,void 0),!0),n=i.width+t.padding,a=i.height+t.padding,s=[{x:0,y:0},{x:n,y:0},{x:n,y:-a},{x:0,y:-a},{x:0,y:0},{x:-8,y:0},{x:n+8,y:0},{x:n+8,y:-a},{x:-8,y:-a},{x:-8,y:0}],l=Jl(r,n,a,s);return l.attr("style",t.style),ji(t,l),t.intersect=function(u){return Pi.polygon(t,s,u)},r},"subroutine"),o3t=o((e,t)=>{let r=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=r.insert("circle",":first-child");return i.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),ji(t,i),t.intersect=function(n){return Pi.circle(t,7,n)},r},"start"),W8e=o((e,t,r)=>{let i=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),n=70,a=10;r==="LR"&&(n=10,a=70);let s=i.append("rect").attr("x",-1*n/2).attr("y",-1*a/2).attr("width",n).attr("height",a).attr("class","fork-join");return ji(t,s),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(l){return Pi.rect(t,l)},i},"forkJoin"),l3t=o((e,t)=>{let r=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),i=r.insert("circle",":first-child"),n=r.insert("circle",":first-child");return n.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),i.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),ji(t,n),t.intersect=function(a){return Pi.circle(t,7,a)},r},"end"),c3t=o(async(e,t)=>{let r=t.padding/2,i=4,n=8,a;t.classes?a="node "+t.classes:a="node default";let s=e.insert("g").attr("class",a).attr("id",t.domId||t.id),l=s.insert("rect",":first-child"),u=s.insert("line"),h=s.insert("line"),d=0,f=i,p=s.insert("g").attr("class","label"),m=0,g=t.classData.annotations?.[0],y=t.classData.annotations[0]?"\xAB"+t.classData.annotations[0]+"\xBB":"",v=await js(p,y,t.labelStyle,!0,!0),x=v.getBBox();if(Mr(ge())){let A=v.children[0],N=Je(v);x=A.getBoundingClientRect(),N.attr("width",x.width),N.attr("height",x.height)}t.classData.annotations[0]&&(f+=x.height+i,d+=x.width);let b=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(Mr(ge())?b+="<"+t.classData.type+">":b+="<"+t.classData.type+">");let T=await js(p,b,t.labelStyle,!0,!0);Je(T).attr("class","classTitle");let w=T.getBBox();if(Mr(ge())){let A=T.children[0],N=Je(T);w=A.getBoundingClientRect(),N.attr("width",w.width),N.attr("height",w.height)}f+=w.height+i,w.width>d&&(d=w.width);let C=[];t.classData.members.forEach(async A=>{let N=A.getDisplayDetails(),P=N.displayText;Mr(ge())&&(P=P.replace(//g,">"));let I=await js(p,P,N.cssStyle?N.cssStyle:t.labelStyle,!0,!0),D=I.getBBox();if(Mr(ge())){let _=I.children[0],R=Je(I);D=_.getBoundingClientRect(),R.attr("width",D.width),R.attr("height",D.height)}D.width>d&&(d=D.width),f+=D.height+i,C.push(I)}),f+=n;let k=[];if(t.classData.methods.forEach(async A=>{let N=A.getDisplayDetails(),P=N.displayText;Mr(ge())&&(P=P.replace(//g,">"));let I=await js(p,P,N.cssStyle?N.cssStyle:t.labelStyle,!0,!0),D=I.getBBox();if(Mr(ge())){let _=I.children[0],R=Je(I);D=_.getBoundingClientRect(),R.attr("width",D.width),R.attr("height",D.height)}D.width>d&&(d=D.width),f+=D.height+i,k.push(I)}),f+=n,g){let A=(d-x.width)/2;Je(v).attr("transform","translate( "+(-1*d/2+A)+", "+-1*f/2+")"),m=x.height+i}let E=(d-w.width)/2;return Je(T).attr("transform","translate( "+(-1*d/2+E)+", "+(-1*f/2+m)+")"),m+=w.height+i,u.attr("class","divider").attr("x1",-d/2-r).attr("x2",d/2+r).attr("y1",-f/2-r+n+m).attr("y2",-f/2-r+n+m),m+=n,C.forEach(A=>{Je(A).attr("transform","translate( "+-d/2+", "+(-1*f/2+m+n/2)+")");let N=A?.getBBox();m+=(N?.height??0)+i}),m+=n,h.attr("class","divider").attr("x1",-d/2-r).attr("x2",d/2+r).attr("y1",-f/2-r+n+m).attr("y2",-f/2-r+n+m),m+=n,k.forEach(A=>{Je(A).attr("transform","translate( "+-d/2+", "+(-1*f/2+m)+")");let N=A?.getBBox();m+=(N?.height??0)+i}),l.attr("style",t.style).attr("class","outer title-state").attr("x",-d/2-r).attr("y",-(f/2)-r).attr("width",d+t.padding).attr("height",f+t.padding),ji(t,l),t.intersect=function(A){return Pi.rect(t,A)},s},"class_box"),q8e={rhombus:V8e,composite:e3t,question:V8e,rect:JSt,labelRect:t3t,rectWithTitle:r3t,choice:WSt,circle:n3t,doublecircle:a3t,stadium:i3t,hexagon:qSt,block_arrow:USt,rect_left_inv_arrow:HSt,lean_right:YSt,lean_left:jSt,trapezoid:XSt,inv_trapezoid:KSt,rect_right_inv_arrow:ZSt,cylinder:QSt,start:o3t,end:l3t,note:$8e,subroutine:s3t,fork:W8e,join:W8e,class_box:c3t},w_={},Nq=o(async(e,t,r)=>{let i,n;if(t.link){let a;ge().securityLevel==="sandbox"?a="_top":t.linkTarget&&(a=t.linkTarget||"_blank"),i=e.insert("svg:a").attr("xlink:href",t.link).attr("target",a),n=await q8e[t.shape](i,t,r)}else n=await q8e[t.shape](e,t,r),i=n;return t.tooltip&&n.attr("title",t.tooltip),t.class&&n.attr("class","node default "+t.class),w_[t.id]=i,t.haveCallback&&w_[t.id].attr("class",w_[t.id].attr("class")+" clickable"),i},"insertNode"),U8e=o(e=>{let t=w_[e.id];Z.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");let r=8,i=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+i-e.width/2)+", "+(e.y-e.height/2-r)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),i},"positionNode")});function Y8e(e,t,r=!1){let i=e,n="default";(i?.classes?.length||0)>0&&(n=(i?.classes??[]).join(" ")),n=n+" flowchart-label";let a=0,s="",l;switch(i.type){case"round":a=5,s="rect";break;case"composite":a=0,s="composite",l=0;break;case"square":s="rect";break;case"diamond":s="question";break;case"hexagon":s="hexagon";break;case"block_arrow":s="block_arrow";break;case"odd":s="rect_left_inv_arrow";break;case"lean_right":s="lean_right";break;case"lean_left":s="lean_left";break;case"trapezoid":s="trapezoid";break;case"inv_trapezoid":s="inv_trapezoid";break;case"rect_left_inv_arrow":s="rect_left_inv_arrow";break;case"circle":s="circle";break;case"ellipse":s="ellipse";break;case"stadium":s="stadium";break;case"subroutine":s="subroutine";break;case"cylinder":s="cylinder";break;case"group":s="rect";break;case"doublecircle":s="doublecircle";break;default:s="rect"}let u=_M(i?.styles??[]),h=i.label,d=i.size??{width:0,height:0,x:0,y:0},f=t.getDiagramId();return{labelStyle:u.labelStyle,shape:s,labelText:h,rx:a,ry:a,class:n,style:u.style,id:i.id,domId:f?`${f}-${i.id}`:i.id,directions:i.directions,width:d.width,height:d.height,x:d.x,y:d.y,positioned:r,intersect:void 0,type:i.type,padding:l??Nt()?.block?.padding??0,widthInColumns:i.widthInColumns??1}}async function u3t(e,t,r){let i=Y8e(t,r,!1);if(i.type==="group")return;let n=Nt(),a=await Nq(e,i,{config:n}),s=a.node().getBBox(),l=r.getBlock(i.id);l.size={width:s.width,height:s.height,x:0,y:0,node:a},r.setBlock(l),a.remove()}async function h3t(e,t,r){let i=Y8e(t,r,!0);if(r.getBlock(i.id).type!=="space"){let a=Nt();await Nq(e,i,{config:a}),t.intersect=i?.intersect,U8e(i)}}async function Iq(e,t,r,i){for(let n of t)await i(e,n,r),n.children&&await Iq(e,n.children,r,i)}async function j8e(e,t,r){await Iq(e,t,r,u3t)}async function X8e(e,t,r){await Iq(e,t,r,h3t)}async function K8e(e,t,r,i,n){let a=new ui({multigraph:!0,compound:!0});a.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(let s of r)s.size&&a.setNode(s.id,{width:s.size.width,height:s.size.height,intersect:s.intersect});for(let s of t)if(s.start&&s.end){let l=i.getBlock(s.start),u=i.getBlock(s.end);if(l?.size&&u?.size){let h=l.size,d=u.size,f=[{x:h.x,y:h.y},{x:h.x+(d.x-h.x)/2,y:h.y+(d.y-h.y)/2},{x:d.x,y:d.y}],p=n?`${n}-${s.id}`:s.id,m=s.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",g=s.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",y=`${m} ${g} flowchart-link LS-a1 LE-b1`;w8e(e,{v:s.start,w:s.end,name:p},{...s,id:p,arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:f,classes:y},void 0,"block",a,n),s.label&&(await C8e(e,{...s,label:s.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:s.arrowTypeEnd,arrowTypeStart:s.arrowTypeStart,points:f,classes:y}),k8e({...s,x:f[1].x,y:f[1].y},{originalPath:f}))}}}var Z8e=z(()=>{"use strict";Uo();br();S8e();H8e();Xt();o(Y8e,"getNodeFromBlock");o(u3t,"calculateBlockSize");o(h3t,"insertBlockPositioned");o(Iq,"performOperations");o(j8e,"calculateBlockSizes");o(X8e,"insertBlocks");o(K8e,"insertEdges")});var d3t,f3t,Q8e,J8e=z(()=>{"use strict";Rr();br();d8e();St();Di();y8e();Z8e();d3t=o(function(e,t){return t.db.getClasses()},"getClasses"),f3t=o(async function(e,t,r,i){let{securityLevel:n,block:a}=Nt(),s=i.db;s.setDiagramId(t);let l;n==="sandbox"&&(l=Je("#i"+t));let u=n==="sandbox"?Je(l.nodes()[0].contentDocument.body):Je("body"),h=n==="sandbox"?u.select(`[id="${t}"]`):Je(`[id="${t}"]`);h8e(h,["point","circle","cross"],i.type,t);let f=s.getBlocks(),p=s.getBlocksFlat(),m=s.getEdges(),g=h.insert("g").attr("class","block");await j8e(g,f,s);let y=g8e(s);if(await X8e(g,f,s),await K8e(g,m,p,s,t),y){let v=y,x=Math.max(1,Math.round(.125*(v.width/v.height))),b=v.height+x+10,T=v.width+10,{useMaxWidth:w}=a;Br(h,b,T,!!w),Z.debug("Here Bounds",y,v),h.attr("viewBox",`${v.x-5} ${v.y-5} ${v.width+10} ${v.height+10}`)}},"draw"),Q8e={draw:f3t,getClasses:d3t}});var eRe={};xr(eRe,{diagram:()=>p3t});var p3t,tRe=z(()=>{"use strict";t8e();l8e();u8e();J8e();p3t={parser:e8e,db:o8e,renderer:Q8e,styles:c8e}});var cu,v3t,x3t,b3t,T3t,C3t,k3t,w3t,sC,Oq=z(()=>{"use strict";br();Bn();Ci();Xt();T6();cu=new wf(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),v3t=o(()=>{cu.reset(),gr()},"clear"),x3t=o(()=>cu.records.stack[0],"getRoot"),b3t=o(()=>cu.records.cnt,"getCount"),T3t=or.treeView,C3t=o(()=>Gr(T3t,Nt().treeView),"getConfig"),k3t=o((e,t)=>{for(;e<=cu.records.stack[cu.records.stack.length-1].level;)cu.records.stack.pop();let r={id:cu.records.cnt++,level:e,name:t,children:[]};cu.records.stack[cu.records.stack.length-1].children.push(r),cu.records.stack.push(r)},"addNode"),w3t={clear:v3t,addNode:k3t,getRoot:x3t,getCount:b3t,getConfig:C3t,getAccTitle:kr,getAccDescription:Sr,getDiagramTitle:Er,setAccDescription:wr,setAccTitle:Cr,setDiagramTitle:Ar},sC=w3t});var S3t,nRe,aRe=z(()=>{"use strict";St();au();Oq();sl();S3t=o(e=>{ca(e,sC),e.nodes.map(t=>sC.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),nRe={parse:o(async e=>{let t=await bn("treeView",e);Z.debug(t),S3t(t)},"parse")}});var E3t,sRe,A3t,_3t,D3t,oRe,lRe=z(()=>{"use strict";St();ps();Di();E3t=o((e,t,r,i,n)=>{let a=i.append("text").text(r.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:s,width:l}=a.node().getBBox(),u=s+n.paddingY*2,h=l+n.paddingX*2;a.attr("x",e+n.paddingX),a.attr("y",t+u/2),r.BBox={x:e,y:t,width:h,height:u}},"positionLabel"),sRe=o((e,t,r,i,n,a)=>e.append("line").attr("x1",t).attr("y1",r).attr("x2",i).attr("y2",n).attr("stroke-width",a).attr("class","treeView-node-line"),"positionLine"),A3t=o((e,t,r)=>{let i=0,n=0,a=o((l,u,h,d)=>{let f=d*(h.rowIndent+h.paddingX);E3t(f,i,u,l,h);let{height:p,width:m}=u.BBox;sRe(l,f-h.rowIndent,i+p/2,f,i+p/2,h.lineThickness),n=Math.max(n,f+m),i+=p},"drawNode"),s=o((l,u=0)=>{a(e,l,r,u),l.children.forEach(p=>{s(p,u+1)});let{x:h,y:d,height:f}=l.BBox;if(l.children.length){let{y:p,height:m}=l.children[l.children.length-1].BBox;sRe(e,h+r.paddingX,d+f,h+r.paddingX,p+m/2+r.lineThickness/2,r.lineThickness)}},"processNode");return s(t),{totalHeight:i,totalWidth:n}},"drawTree"),_3t=o((e,t,r,i)=>{Z.debug(`Rendering treeView diagram +`+e);let n=i.db,a=n.getRoot(),s=n.getConfig(),l=bi(t),u=l.append("g");u.attr("class","tree-view");let{totalHeight:h,totalWidth:d}=A3t(u,a,s);l.attr("viewBox",`-${s.lineThickness/2} 0 ${d} ${h}`),Br(l,h,d,s.useMaxWidth)},"draw"),D3t={draw:_3t},oRe=D3t});var R3t,L3t,cRe,uRe=z(()=>{"use strict";Xt();R3t={labelFontSize:"16px",labelColor:"black",lineColor:"black"},L3t=o(({treeView:e})=>{let{labelFontSize:t,labelColor:r,lineColor:i}=Gr(R3t,e);return` + .treeView-node-label { + font-size: ${t}; + fill: ${r}; + } + .treeView-node-line { + stroke: ${i}; + } + `},"styles"),cRe=L3t});var hRe={};xr(hRe,{diagram:()=>M3t});var M3t,dRe=z(()=>{"use strict";aRe();Oq();lRe();uRe();M3t={db:sC,renderer:oRe,parser:nRe,styles:cRe}});var Pq,Bq,oC,mRe,Fq,za,uu,lC,gRe,P3t,cC,yRe,vRe,xRe,bRe,TRe,S_,Nf,E_=z(()=>{"use strict";Pq={L:"left",R:"right",T:"top",B:"bottom"},Bq={L:o(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:o(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:o(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:o(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},oC={L:o((e,t)=>e-t+2,"L"),R:o((e,t)=>e-2,"R"),T:o((e,t)=>e-t+2,"T"),B:o((e,t)=>e-2,"B")},mRe=o(function(e){return za(e)?e==="L"?"R":"L":e==="T"?"B":"T"},"getOppositeArchitectureDirection"),Fq=o(function(e){let t=e;return t==="L"||t==="R"||t==="T"||t==="B"},"isArchitectureDirection"),za=o(function(e){let t=e;return t==="L"||t==="R"},"isArchitectureDirectionX"),uu=o(function(e){let t=e;return t==="T"||t==="B"},"isArchitectureDirectionY"),lC=o(function(e,t){let r=za(e)&&uu(t),i=uu(e)&&za(t);return r||i},"isArchitectureDirectionXY"),gRe=o(function(e){let t=e[0],r=e[1],i=za(t)&&uu(r),n=uu(t)&&za(r);return i||n},"isArchitecturePairXY"),P3t=o(function(e){return e!=="LL"&&e!=="RR"&&e!=="TT"&&e!=="BB"},"isValidArchitectureDirectionPair"),cC=o(function(e,t){let r=`${e}${t}`;return P3t(r)?r:void 0},"getArchitectureDirectionPair"),yRe=o(function([e,t],r){let i=r[0],n=r[1];return za(i)?uu(n)?[e+(i==="L"?-1:1),t+(n==="T"?1:-1)]:[e+(i==="L"?-1:1),t]:za(n)?[e+(n==="L"?1:-1),t+(i==="T"?1:-1)]:[e,t+(i==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),vRe=o(function(e){return e==="LT"||e==="TL"?[1,1]:e==="BL"||e==="LB"?[1,-1]:e==="BR"||e==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),xRe=o(function(e,t){return lC(e,t)?"bend":za(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),bRe=o(function(e){return e.type==="service"},"isArchitectureService"),TRe=o(function(e){return e.type==="junction"},"isArchitectureJunction"),S_=o(e=>e.data(),"edgeData"),Nf=o(e=>e.data(),"nodeData")});var B3t,Iy,$q=z(()=>{"use strict";br();Bn();Xt();Ci();E_();B3t=or.architecture,Iy=class{constructor(){this.nodes={};this.groups={};this.edges=[];this.registeredIds={};this.elements={};this.diagramId="";this.setAccTitle=Cr;this.getAccTitle=kr;this.setDiagramTitle=Ar;this.getDiagramTitle=Er;this.getAccDescription=Sr;this.setAccDescription=wr;this.clear()}static{o(this,"ArchitectureDB")}setDiagramId(t){this.diagramId=t}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",gr()}addService({id:t,icon:r,in:i,title:n,iconText:a}){if(this.registeredIds[t]!==void 0)throw new Error(`The service id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The service [${t}] cannot be placed within itself`);if(this.registeredIds[i]===void 0)throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[i]==="node")throw new Error(`The service [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"service",icon:r,iconText:a,title:n,edges:[],in:i}}getServices(){return Object.values(this.nodes).filter(bRe)}addJunction({id:t,in:r}){if(this.registeredIds[t]!==void 0)throw new Error(`The junction id [${t}] is already in use by another ${this.registeredIds[t]}`);if(r!==void 0){if(t===r)throw new Error(`The junction [${t}] cannot be placed within itself`);if(this.registeredIds[r]===void 0)throw new Error(`The junction [${t}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[r]==="node")throw new Error(`The junction [${t}]'s parent is not a group`)}this.registeredIds[t]="node",this.nodes[t]={id:t,type:"junction",edges:[],in:r}}getJunctions(){return Object.values(this.nodes).filter(TRe)}getNodes(){return Object.values(this.nodes)}getNode(t){return this.nodes[t]??null}addGroup({id:t,icon:r,in:i,title:n}){if(this.registeredIds?.[t]!==void 0)throw new Error(`The group id [${t}] is already in use by another ${this.registeredIds[t]}`);if(i!==void 0){if(t===i)throw new Error(`The group [${t}] cannot be placed within itself`);if(this.registeredIds?.[i]===void 0)throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[i]==="node")throw new Error(`The group [${t}]'s parent is not a group`)}this.registeredIds[t]="group",this.groups[t]={id:t,icon:r,title:n,in:i}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:t,rhsId:r,lhsDir:i,rhsDir:n,lhsInto:a,rhsInto:s,lhsGroup:l,rhsGroup:u,title:h}){if(!Fq(i))throw new Error(`Invalid direction given for left hand side of edge ${t}--${r}. Expected (L,R,T,B) got ${String(i)}`);if(!Fq(n))throw new Error(`Invalid direction given for right hand side of edge ${t}--${r}. Expected (L,R,T,B) got ${String(n)}`);if(this.nodes[t]===void 0&&this.groups[t]===void 0)throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[r]===void 0&&this.groups[r]===void 0)throw new Error(`The right-hand id [${r}] does not yet exist. Please create the service/group before declaring an edge to it.`);let d=this.nodes[t].in,f=this.nodes[r].in;if(l&&d&&f&&d==f)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(u&&d&&f&&d==f)throw new Error(`The right-hand id [${r}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let p={lhsId:t,lhsDir:i,lhsInto:a,lhsGroup:l,rhsId:r,rhsDir:n,rhsInto:s,rhsGroup:u,title:h};this.edges.push(p),this.nodes[t]&&this.nodes[r]&&(this.nodes[t].edges.push(this.edges[this.edges.length-1]),this.nodes[r].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(this.dataStructures===void 0){let t={},r=Object.entries(this.nodes).reduce((u,[h,d])=>(u[h]=d.edges.reduce((f,p)=>{let m=this.getNode(p.lhsId)?.in,g=this.getNode(p.rhsId)?.in;if(m&&g&&m!==g){let y=xRe(p.lhsDir,p.rhsDir);y!=="bend"&&(t[m]??={},t[m][g]=y,t[g]??={},t[g][m]=y)}if(p.lhsId===h){let y=cC(p.lhsDir,p.rhsDir);y&&(f[y]=p.rhsId)}else{let y=cC(p.rhsDir,p.lhsDir);y&&(f[y]=p.lhsId)}return f},{}),u),{}),i=Object.keys(r)[0],n={[i]:1},a=Object.keys(r).reduce((u,h)=>h===i?u:{...u,[h]:1},{}),s=o(u=>{let h={[u]:[0,0]},d=[u];for(;d.length>0;){let f=d.shift();if(f){n[f]=1,delete a[f];let p=r[f],[m,g]=h[f];Object.entries(p).forEach(([y,v])=>{n[v]||(h[v]=yRe([m,g],y),d.push(v))})}}return h},"BFS"),l=[s(i)];for(;Object.keys(a).length>0;)l.push(s(Object.keys(a)[0]));this.dataStructures={adjList:r,spatialMaps:l,groupAlignments:t}}return this.dataStructures}setElementForId(t,r){this.elements[t]=r}getElementById(t){return this.elements[t]}getConfig(){return Gr({...B3t,...Nt().architecture})}getConfigField(t){return this.getConfig()[t]}}});var F3t,zq,CRe=z(()=>{"use strict";sl();St();au();$q();F3t=o((e,t)=>{ca(e,t),e.groups.map(r=>t.addGroup(r)),e.services.map(r=>t.addService({...r,type:"service"})),e.junctions.map(r=>t.addJunction({...r,type:"junction"})),e.edges.map(r=>t.addEdge(r))},"populateDb"),zq={parser:{yy:void 0},parse:o(async e=>{let t=await bn("architecture",e);Z.debug(t);let r=zq.parser?.yy;if(!(r instanceof Iy))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");F3t(t,r)},"parse")}});var $3t,kRe,wRe=z(()=>{"use strict";$3t=o(e=>` + .edge { + stroke-width: ${e.archEdgeWidth}; + stroke: ${e.archEdgeColor}; + fill: none; + } + + .arrow { + fill: ${e.archEdgeArrowColor}; + } + + .node-bkg { + fill: none; + stroke: ${e.archGroupBorderColor}; + stroke-width: ${e.archGroupBorderWidth}; + stroke-dasharray: 8; + } + .node-icon-text { + display: flex; + align-items: center; + } + + .node-icon-text > div { + color: #fff; + margin: 1px; + height: fit-content; + text-align: center; + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + } +`,"getStyles"),kRe=$3t});var Vq=Js((uC,Gq)=>{"use strict";o((function(t,r){typeof uC=="object"&&typeof Gq=="object"?Gq.exports=r():typeof define=="function"&&define.amd?define([],r):typeof uC=="object"?uC.layoutBase=r():t.layoutBase=r()}),"webpackUniversalModuleDefinition")(uC,function(){return(function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return o(r,"__webpack_require__"),r.m=e,r.c=t,r.i=function(i){return i},r.d=function(i,n,a){r.o(i,n)||Object.defineProperty(i,n,{configurable:!1,enumerable:!0,get:a})},r.n=function(i){var n=i&&i.__esModule?o(function(){return i.default},"getDefault"):o(function(){return i},"getModuleExports");return r.d(n,"a",n),n},r.o=function(i,n){return Object.prototype.hasOwnProperty.call(i,n)},r.p="",r(r.s=28)})([(function(e,t,r){"use strict";function i(){}o(i,"LayoutConstants"),i.QUALITY=1,i.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,i.DEFAULT_INCREMENTAL=!1,i.DEFAULT_ANIMATION_ON_LAYOUT=!0,i.DEFAULT_ANIMATION_DURING_LAYOUT=!1,i.DEFAULT_ANIMATION_PERIOD=50,i.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,i.DEFAULT_GRAPH_MARGIN=15,i.NODE_DIMENSIONS_INCLUDE_LABELS=!1,i.SIMPLE_NODE_SIZE=40,i.SIMPLE_NODE_HALF_SIZE=i.SIMPLE_NODE_SIZE/2,i.EMPTY_COMPOUND_NODE_SIZE=40,i.MIN_EDGE_LENGTH=1,i.WORLD_BOUNDARY=1e6,i.INITIAL_WORLD_BOUNDARY=i.WORLD_BOUNDARY/1e3,i.WORLD_CENTER_X=1200,i.WORLD_CENTER_Y=900,e.exports=i}),(function(e,t,r){"use strict";var i=r(2),n=r(8),a=r(9);function s(u,h,d){i.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=u,this.target=h}o(s,"LEdge"),s.prototype=Object.create(i.prototype);for(var l in i)s[l]=i[l];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(u){if(this.source===u)return this.target;if(this.target===u)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(u,h){for(var d=this.getOtherEnd(u),f=h.getGraphManager().getRoot();;){if(d.getOwner()==h)return d;if(d.getOwner()==f)break;d=d.getOwner().getParent()}return null},s.prototype.updateLength=function(){var u=new Array(4);this.isOverlapingSourceAndTarget=n.getIntersection(this.target.getRect(),this.source.getRect(),u),this.isOverlapingSourceAndTarget||(this.lengthX=u[0]-u[2],this.lengthY=u[1]-u[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=s}),(function(e,t,r){"use strict";function i(n){this.vGraphObject=n}o(i,"LGraphObject"),e.exports=i}),(function(e,t,r){"use strict";var i=r(2),n=r(10),a=r(13),s=r(0),l=r(16),u=r(5);function h(f,p,m,g){m==null&&g==null&&(g=p),i.call(this,g),f.graphManager!=null&&(f=f.graphManager),this.estimatedSize=n.MIN_VALUE,this.inclusionTreeDepth=n.MAX_VALUE,this.vGraphObject=g,this.edges=[],this.graphManager=f,m!=null&&p!=null?this.rect=new a(p.x,p.y,m.width,m.height):this.rect=new a}o(h,"LNode"),h.prototype=Object.create(i.prototype);for(var d in i)h[d]=i[d];h.prototype.getEdges=function(){return this.edges},h.prototype.getChild=function(){return this.child},h.prototype.getOwner=function(){return this.owner},h.prototype.getWidth=function(){return this.rect.width},h.prototype.setWidth=function(f){this.rect.width=f},h.prototype.getHeight=function(){return this.rect.height},h.prototype.setHeight=function(f){this.rect.height=f},h.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},h.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},h.prototype.getCenter=function(){return new u(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},h.prototype.getLocation=function(){return new u(this.rect.x,this.rect.y)},h.prototype.getRect=function(){return this.rect},h.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},h.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},h.prototype.setRect=function(f,p){this.rect.x=f.x,this.rect.y=f.y,this.rect.width=p.width,this.rect.height=p.height},h.prototype.setCenter=function(f,p){this.rect.x=f-this.rect.width/2,this.rect.y=p-this.rect.height/2},h.prototype.setLocation=function(f,p){this.rect.x=f,this.rect.y=p},h.prototype.moveBy=function(f,p){this.rect.x+=f,this.rect.y+=p},h.prototype.getEdgeListToNode=function(f){var p=[],m,g=this;return g.edges.forEach(function(y){if(y.target==f){if(y.source!=g)throw"Incorrect edge source!";p.push(y)}}),p},h.prototype.getEdgesBetween=function(f){var p=[],m,g=this;return g.edges.forEach(function(y){if(!(y.source==g||y.target==g))throw"Incorrect edge source and/or target";(y.target==f||y.source==f)&&p.push(y)}),p},h.prototype.getNeighborsList=function(){var f=new Set,p=this;return p.edges.forEach(function(m){if(m.source==p)f.add(m.target);else{if(m.target!=p)throw"Incorrect incidency!";f.add(m.source)}}),f},h.prototype.withChildren=function(){var f=new Set,p,m;if(f.add(this),this.child!=null)for(var g=this.child.getNodes(),y=0;yp?(this.rect.x-=(this.labelWidth-p)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(p+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(m+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>m?(this.rect.y-=(this.labelHeight-m)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(m+this.labelHeight))}}},h.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==n.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},h.prototype.transform=function(f){var p=this.rect.x;p>s.WORLD_BOUNDARY?p=s.WORLD_BOUNDARY:p<-s.WORLD_BOUNDARY&&(p=-s.WORLD_BOUNDARY);var m=this.rect.y;m>s.WORLD_BOUNDARY?m=s.WORLD_BOUNDARY:m<-s.WORLD_BOUNDARY&&(m=-s.WORLD_BOUNDARY);var g=new u(p,m),y=f.inverseTransformPoint(g);this.setLocation(y.x,y.y)},h.prototype.getLeft=function(){return this.rect.x},h.prototype.getRight=function(){return this.rect.x+this.rect.width},h.prototype.getTop=function(){return this.rect.y},h.prototype.getBottom=function(){return this.rect.y+this.rect.height},h.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},e.exports=h}),(function(e,t,r){"use strict";var i=r(0);function n(){}o(n,"FDLayoutConstants");for(var a in i)n[a]=i[a];n.MAX_ITERATIONS=2500,n.DEFAULT_EDGE_LENGTH=50,n.DEFAULT_SPRING_STRENGTH=.45,n.DEFAULT_REPULSION_STRENGTH=4500,n.DEFAULT_GRAVITY_STRENGTH=.4,n.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,n.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,n.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,n.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,n.COOLING_ADAPTATION_FACTOR=.33,n.ADAPTATION_LOWER_NODE_LIMIT=1e3,n.ADAPTATION_UPPER_NODE_LIMIT=5e3,n.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,n.MAX_NODE_DISPLACEMENT=n.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,n.MIN_REPULSION_DIST=n.DEFAULT_EDGE_LENGTH/10,n.CONVERGENCE_CHECK_PERIOD=100,n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,n.MIN_EDGE_LENGTH=1,n.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=n}),(function(e,t,r){"use strict";function i(n,a){n==null&&a==null?(this.x=0,this.y=0):(this.x=n,this.y=a)}o(i,"PointD"),i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.setX=function(n){this.x=n},i.prototype.setY=function(n){this.y=n},i.prototype.getDifference=function(n){return new DimensionD(this.x-n.x,this.y-n.y)},i.prototype.getCopy=function(){return new i(this.x,this.y)},i.prototype.translate=function(n){return this.x+=n.width,this.y+=n.height,this},e.exports=i}),(function(e,t,r){"use strict";var i=r(2),n=r(10),a=r(0),s=r(7),l=r(3),u=r(1),h=r(13),d=r(12),f=r(11);function p(g,y,v){i.call(this,v),this.estimatedSize=n.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=g,y!=null&&y instanceof s?this.graphManager=y:y!=null&&y instanceof Layout&&(this.graphManager=y.graphManager)}o(p,"LGraph"),p.prototype=Object.create(i.prototype);for(var m in i)p[m]=i[m];p.prototype.getNodes=function(){return this.nodes},p.prototype.getEdges=function(){return this.edges},p.prototype.getGraphManager=function(){return this.graphManager},p.prototype.getParent=function(){return this.parent},p.prototype.getLeft=function(){return this.left},p.prototype.getRight=function(){return this.right},p.prototype.getTop=function(){return this.top},p.prototype.getBottom=function(){return this.bottom},p.prototype.isConnected=function(){return this.isConnected},p.prototype.add=function(g,y,v){if(y==null&&v==null){var x=g;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(x)>-1)throw"Node already in graph!";return x.owner=this,this.getNodes().push(x),x}else{var b=g;if(!(this.getNodes().indexOf(y)>-1&&this.getNodes().indexOf(v)>-1))throw"Source or target not in graph!";if(!(y.owner==v.owner&&y.owner==this))throw"Both owners must be this graph!";return y.owner!=v.owner?null:(b.source=y,b.target=v,b.isInterGraph=!1,this.getEdges().push(b),y.edges.push(b),v!=y&&v.edges.push(b),b)}},p.prototype.remove=function(g){var y=g;if(g instanceof l){if(y==null)throw"Node is null!";if(!(y.owner!=null&&y.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var v=y.edges.slice(),x,b=v.length,T=0;T-1&&k>-1))throw"Source and/or target doesn't know this edge!";x.source.edges.splice(C,1),x.target!=x.source&&x.target.edges.splice(k,1);var w=x.source.owner.getEdges().indexOf(x);if(w==-1)throw"Not in owner's edge list!";x.source.owner.getEdges().splice(w,1)}},p.prototype.updateLeftTop=function(){for(var g=n.MAX_VALUE,y=n.MAX_VALUE,v,x,b,T=this.getNodes(),w=T.length,C=0;Cv&&(g=v),y>x&&(y=x)}return g==n.MAX_VALUE?null:(T[0].getParent().paddingLeft!=null?b=T[0].getParent().paddingLeft:b=this.margin,this.left=y-b,this.top=g-b,new d(this.left,this.top))},p.prototype.updateBounds=function(g){for(var y=n.MAX_VALUE,v=-n.MAX_VALUE,x=n.MAX_VALUE,b=-n.MAX_VALUE,T,w,C,k,E,A=this.nodes,N=A.length,P=0;PT&&(y=T),vC&&(x=C),bT&&(y=T),vC&&(x=C),b=this.nodes.length){var N=0;v.forEach(function(P){P.owner==g&&N++}),N==this.nodes.length&&(this.isConnected=!0)}},e.exports=p}),(function(e,t,r){"use strict";var i,n=r(1);function a(s){i=r(6),this.layout=s,this.graphs=[],this.edges=[]}o(a,"LGraphManager"),a.prototype.addRoot=function(){var s=this.layout.newGraph(),l=this.layout.newNode(null),u=this.add(s,l);return this.setRootGraph(u),this.rootGraph},a.prototype.add=function(s,l,u,h,d){if(u==null&&h==null&&d==null){if(s==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return s.parent=l,l.child=s,s}else{d=u,h=l,u=s;var f=h.getOwner(),p=d.getOwner();if(!(f!=null&&f.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(p!=null&&p.getGraphManager()==this))throw"Target not in this graph mgr!";if(f==p)return u.isInterGraph=!1,f.add(u,h,d);if(u.isInterGraph=!0,u.source=h,u.target=d,this.edges.indexOf(u)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(u),!(u.source!=null&&u.target!=null))throw"Edge source and/or target is null!";if(!(u.source.edges.indexOf(u)==-1&&u.target.edges.indexOf(u)==-1))throw"Edge already in source and/or target incidency list!";return u.source.edges.push(u),u.target.edges.push(u),u}},a.prototype.remove=function(s){if(s instanceof i){var l=s;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var u=[];u=u.concat(l.getEdges());for(var h,d=u.length,f=0;f=s.getRight()?l[0]+=Math.min(s.getX()-a.getX(),a.getRight()-s.getRight()):s.getX()<=a.getX()&&s.getRight()>=a.getRight()&&(l[0]+=Math.min(a.getX()-s.getX(),s.getRight()-a.getRight())),a.getY()<=s.getY()&&a.getBottom()>=s.getBottom()?l[1]+=Math.min(s.getY()-a.getY(),a.getBottom()-s.getBottom()):s.getY()<=a.getY()&&s.getBottom()>=a.getBottom()&&(l[1]+=Math.min(a.getY()-s.getY(),s.getBottom()-a.getBottom()));var d=Math.abs((s.getCenterY()-a.getCenterY())/(s.getCenterX()-a.getCenterX()));s.getCenterY()===a.getCenterY()&&s.getCenterX()===a.getCenterX()&&(d=1);var f=d*l[0],p=l[1]/d;l[0]f)return l[0]=u,l[1]=m,l[2]=d,l[3]=A,!1;if(hd)return l[0]=p,l[1]=h,l[2]=k,l[3]=f,!1;if(ud?(l[0]=y,l[1]=v,D=!0):(l[0]=g,l[1]=m,D=!0):R===L&&(u>d?(l[0]=p,l[1]=m,D=!0):(l[0]=x,l[1]=v,D=!0)),-M===L?d>u?(l[2]=E,l[3]=A,_=!0):(l[2]=k,l[3]=C,_=!0):M===L&&(d>u?(l[2]=w,l[3]=C,_=!0):(l[2]=N,l[3]=A,_=!0)),D&&_)return!1;if(u>d?h>f?(B=this.getCardinalDirection(R,L,4),O=this.getCardinalDirection(M,L,2)):(B=this.getCardinalDirection(-R,L,3),O=this.getCardinalDirection(-M,L,1)):h>f?(B=this.getCardinalDirection(-R,L,1),O=this.getCardinalDirection(-M,L,3)):(B=this.getCardinalDirection(R,L,2),O=this.getCardinalDirection(M,L,4)),!D)switch(B){case 1:G=m,$=u+-T/L,l[0]=$,l[1]=G;break;case 2:$=x,G=h+b*L,l[0]=$,l[1]=G;break;case 3:G=v,$=u+T/L,l[0]=$,l[1]=G;break;case 4:$=y,G=h+-b*L,l[0]=$,l[1]=G;break}if(!_)switch(O){case 1:V=C,F=d+-I/L,l[2]=F,l[3]=V;break;case 2:F=N,V=f+P*L,l[2]=F,l[3]=V;break;case 3:V=A,F=d+I/L,l[2]=F,l[3]=V;break;case 4:F=E,V=f+-P*L,l[2]=F,l[3]=V;break}}return!1},n.getCardinalDirection=function(a,s,l){return a>s?l:1+l%4},n.getIntersection=function(a,s,l,u){if(u==null)return this.getIntersection2(a,s,l);var h=a.x,d=a.y,f=s.x,p=s.y,m=l.x,g=l.y,y=u.x,v=u.y,x=void 0,b=void 0,T=void 0,w=void 0,C=void 0,k=void 0,E=void 0,A=void 0,N=void 0;return T=p-d,C=h-f,E=f*d-h*p,w=v-g,k=m-y,A=y*g-m*v,N=T*k-w*C,N===0?null:(x=(C*A-k*E)/N,b=(w*E-T*A)/N,new i(x,b))},n.angleOfVector=function(a,s,l,u){var h=void 0;return a!==l?(h=Math.atan((u-s)/(l-a)),l=0){var v=(-m+Math.sqrt(m*m-4*p*g))/(2*p),x=(-m-Math.sqrt(m*m-4*p*g))/(2*p),b=null;return v>=0&&v<=1?[v]:x>=0&&x<=1?[x]:b}else return null},n.HALF_PI=.5*Math.PI,n.ONE_AND_HALF_PI=1.5*Math.PI,n.TWO_PI=2*Math.PI,n.THREE_PI=3*Math.PI,e.exports=n}),(function(e,t,r){"use strict";function i(){}o(i,"IMath"),i.sign=function(n){return n>0?1:n<0?-1:0},i.floor=function(n){return n<0?Math.ceil(n):Math.floor(n)},i.ceil=function(n){return n<0?Math.floor(n):Math.ceil(n)},e.exports=i}),(function(e,t,r){"use strict";function i(){}o(i,"Integer"),i.MAX_VALUE=2147483647,i.MIN_VALUE=-2147483648,e.exports=i}),(function(e,t,r){"use strict";var i=(function(){function h(d,f){for(var p=0;p"u"?"undefined":i(a);return a==null||s!="object"&&s!="function"},e.exports=n}),(function(e,t,r){"use strict";function i(m){if(Array.isArray(m)){for(var g=0,y=Array(m.length);g0&&g;){for(T.push(C[0]);T.length>0&&g;){var k=T[0];T.splice(0,1),b.add(k);for(var E=k.getEdges(),x=0;x-1&&C.splice(I,1)}b=new Set,w=new Map}}return m},p.prototype.createDummyNodesForBendpoints=function(m){for(var g=[],y=m.source,v=this.graphManager.calcLowestCommonAncestor(m.source,m.target),x=0;x0){for(var v=this.edgeToDummyNodes.get(y),x=0;x=0&&g.splice(A,1);var N=w.getNeighborsList();N.forEach(function(D){if(y.indexOf(D)<0){var _=v.get(D),R=_-1;R==1&&k.push(D),v.set(D,R)}})}y=y.concat(k),(g.length==1||g.length==2)&&(x=!0,b=g[0])}return b},p.prototype.setGraphManager=function(m){this.graphManager=m},e.exports=p}),(function(e,t,r){"use strict";function i(){}o(i,"RandomSeed"),i.seed=1,i.x=0,i.nextDouble=function(){return i.x=Math.sin(i.seed++)*1e4,i.x-Math.floor(i.x)},e.exports=i}),(function(e,t,r){"use strict";var i=r(5);function n(a,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o(n,"Transform"),n.prototype.getWorldOrgX=function(){return this.lworldOrgX},n.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},n.prototype.getWorldOrgY=function(){return this.lworldOrgY},n.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},n.prototype.getWorldExtX=function(){return this.lworldExtX},n.prototype.setWorldExtX=function(a){this.lworldExtX=a},n.prototype.getWorldExtY=function(){return this.lworldExtY},n.prototype.setWorldExtY=function(a){this.lworldExtY=a},n.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},n.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},n.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},n.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},n.prototype.getDeviceExtX=function(){return this.ldeviceExtX},n.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},n.prototype.getDeviceExtY=function(){return this.ldeviceExtY},n.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},n.prototype.transformX=function(a){var s=0,l=this.lworldExtX;return l!=0&&(s=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/l),s},n.prototype.transformY=function(a){var s=0,l=this.lworldExtY;return l!=0&&(s=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/l),s},n.prototype.inverseTransformX=function(a){var s=0,l=this.ldeviceExtX;return l!=0&&(s=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/l),s},n.prototype.inverseTransformY=function(a){var s=0,l=this.ldeviceExtY;return l!=0&&(s=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/l),s},n.prototype.inverseTransformPoint=function(a){var s=new i(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return s},e.exports=n}),(function(e,t,r){"use strict";function i(f){if(Array.isArray(f)){for(var p=0,m=Array(f.length);pa.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(f>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(f-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var f=this.getAllEdges(),p,m=0;m0&&arguments[0]!==void 0?arguments[0]:!0,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,m,g,y,v,x=this.getAllNodes(),b;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&f&&this.updateGrid(),b=new Set,m=0;mT||b>T)&&(f.gravitationForceX=-this.gravityConstant*y,f.gravitationForceY=-this.gravityConstant*v)):(T=p.getEstimatedSize()*this.compoundGravityRangeFactor,(x>T||b>T)&&(f.gravitationForceX=-this.gravityConstant*y*this.compoundGravityConstant,f.gravitationForceY=-this.gravityConstant*v*this.compoundGravityConstant))},h.prototype.isConverged=function(){var f,p=!1;return this.totalIterations>this.maxIterations/3&&(p=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),f=this.totalDisplacement=x.length||T>=x[0].length)){for(var w=0;wh},"_defaultCompareFunction")}]),l})();e.exports=s}),(function(e,t,r){"use strict";function i(){}o(i,"SVD"),i.svd=function(n){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=n.length,this.n=n[0].length;var a=Math.min(this.m,this.n);this.s=(function(Et){for(var yt=[];Et-- >0;)yt.push(0);return yt})(Math.min(this.m+1,this.n)),this.U=(function(Et){var yt=o(function oe(ht){if(ht.length==0)return 0;for(var gt=[],et=0;et0;)yt.push(0);return yt})(this.n),l=(function(Et){for(var yt=[];Et-- >0;)yt.push(0);return yt})(this.m),u=!0,h=!0,d=Math.min(this.m-1,this.n),f=Math.max(0,Math.min(this.n-2,this.m)),p=0;p=0;L--)if(this.s[L]!==0){for(var B=L+1;B=0;j--){if((function(Et,yt){return Et&&yt})(j0;){var ue=void 0,De=void 0;for(ue=_-2;ue>=-1&&ue!==-1;ue--)if(Math.abs(s[ue])<=Te+ee*(Math.abs(this.s[ue])+Math.abs(this.s[ue+1]))){s[ue]=0;break}if(ue===_-2)De=4;else{var Ie=void 0;for(Ie=_-1;Ie>=ue&&Ie!==ue;Ie--){var Ee=(Ie!==_?Math.abs(s[Ie]):0)+(Ie!==ue+1?Math.abs(s[Ie-1]):0);if(Math.abs(this.s[Ie])<=Te+ee*Ee){this.s[Ie]=0;break}}Ie===ue?De=3:Ie===_-1?De=1:(De=2,ue=Ie)}switch(ue++,De){case 1:{var we=s[_-2];s[_-2]=0;for(var Me=_-2;Me>=ue;Me--){var $e=i.hypot(this.s[Me],we),de=this.s[Me]/$e,rt=we/$e;if(this.s[Me]=$e,Me!==ue&&(we=-rt*s[Me-1],s[Me-1]=de*s[Me-1]),h)for(var ke=0;ke=this.s[ue+1]);){var ot=this.s[ue];if(this.s[ue]=this.s[ue+1],this.s[ue+1]=ot,h&&ueMath.abs(a)?(s=a/n,s=Math.abs(n)*Math.sqrt(1+s*s)):a!=0?(s=n/a,s=Math.abs(a)*Math.sqrt(1+s*s)):s=0,s},e.exports=i}),(function(e,t,r){"use strict";var i=(function(){function s(l,u){for(var h=0;h2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;n(this,s),this.sequence1=l,this.sequence2=u,this.match_score=h,this.mismatch_penalty=d,this.gap_penalty=f,this.iMax=l.length+1,this.jMax=u.length+1,this.grid=new Array(this.iMax);for(var p=0;p=0;l--){var u=this.listeners[l];u.event===a&&u.callback===s&&this.listeners.splice(l,1)}},n.emit=function(a,s){for(var l=0;l{"use strict";o((function(t,r){typeof hC=="object"&&typeof Wq=="object"?Wq.exports=r(Vq()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof hC=="object"?hC.coseBase=r(Vq()):t.coseBase=r(t.layoutBase)}),"webpackUniversalModuleDefinition")(hC,function(e){return(()=>{"use strict";var t={45:((a,s,l)=>{var u={};u.layoutBase=l(551),u.CoSEConstants=l(806),u.CoSEEdge=l(767),u.CoSEGraph=l(880),u.CoSEGraphManager=l(578),u.CoSELayout=l(765),u.CoSENode=l(991),u.ConstraintHandler=l(902),a.exports=u}),806:((a,s,l)=>{var u=l(551).FDLayoutConstants;function h(){}o(h,"CoSEConstants");for(var d in u)h[d]=u[d];h.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,h.DEFAULT_RADIAL_SEPARATION=u.DEFAULT_EDGE_LENGTH,h.DEFAULT_COMPONENT_SEPERATION=60,h.TILE=!0,h.TILING_PADDING_VERTICAL=10,h.TILING_PADDING_HORIZONTAL=10,h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0,h.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,h.TREE_REDUCTION_ON_INCREMENTAL=!0,h.PURE_INCREMENTAL=h.DEFAULT_INCREMENTAL,a.exports=h}),767:((a,s,l)=>{var u=l(551).FDLayoutEdge;function h(f,p,m){u.call(this,f,p,m)}o(h,"CoSEEdge"),h.prototype=Object.create(u.prototype);for(var d in u)h[d]=u[d];a.exports=h}),880:((a,s,l)=>{var u=l(551).LGraph;function h(f,p,m){u.call(this,f,p,m)}o(h,"CoSEGraph"),h.prototype=Object.create(u.prototype);for(var d in u)h[d]=u[d];a.exports=h}),578:((a,s,l)=>{var u=l(551).LGraphManager;function h(f){u.call(this,f)}o(h,"CoSEGraphManager"),h.prototype=Object.create(u.prototype);for(var d in u)h[d]=u[d];a.exports=h}),765:((a,s,l)=>{var u=l(551).FDLayout,h=l(578),d=l(880),f=l(991),p=l(767),m=l(806),g=l(902),y=l(551).FDLayoutConstants,v=l(551).LayoutConstants,x=l(551).Point,b=l(551).PointD,T=l(551).DimensionD,w=l(551).Layout,C=l(551).Integer,k=l(551).IGeometry,E=l(551).LGraph,A=l(551).Transform,N=l(551).LinkedList;function P(){u.call(this),this.toBeTiled={},this.constraints={}}o(P,"CoSELayout"),P.prototype=Object.create(u.prototype);for(var I in u)P[I]=u[I];P.prototype.newGraphManager=function(){var D=new h(this);return this.graphManager=D,D},P.prototype.newGraph=function(D){return new d(null,this.graphManager,D)},P.prototype.newNode=function(D){return new f(this.graphManager,D)},P.prototype.newEdge=function(D){return new p(null,null,D)},P.prototype.initParameters=function(){u.prototype.initParameters.call(this,arguments),this.isSubLayout||(m.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=m.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=m.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=y.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=y.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=y.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=y.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},P.prototype.initSpringEmbedder=function(){u.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/y.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},P.prototype.layout=function(){var D=v.DEFAULT_CREATE_BENDS_AS_NEEDED;return D&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},P.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(m.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var _=new Set(this.getAllNodes()),R=this.nodesWithGravity.filter(function(B){return _.has(B)});this.graphManager.setAllNodesToApplyGravitation(R)}}else{var D=this.getFlatForest();if(D.length>0)this.positionNodesRadially(D);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var _=new Set(this.getAllNodes()),R=this.nodesWithGravity.filter(function(M){return _.has(M)});this.graphManager.setAllNodesToApplyGravitation(R),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(g.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),m.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},P.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%y.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var D=new Set(this.getAllNodes()),_=this.nodesWithGravity.filter(function(L){return D.has(L)});this.graphManager.setAllNodesToApplyGravitation(_),this.graphManager.updateBounds(),this.updateGrid(),m.PURE_INCREMENTAL?this.coolingFactor=y.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=y.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),m.PURE_INCREMENTAL?this.coolingFactor=y.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=y.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var R=!this.isTreeGrowing&&!this.isGrowthFinished,M=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(R,M),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},P.prototype.getPositionsData=function(){for(var D=this.graphManager.getAllNodes(),_={},R=0;R0&&this.updateDisplacements();for(var R=0;R0&&(M.fixedNodeWeight=B)}}if(this.constraints.relativePlacementConstraint){var O=new Map,$=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(Y){D.fixedNodesOnHorizontal.add(Y),D.fixedNodesOnVertical.add(Y)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var G=this.constraints.alignmentConstraint.vertical,R=0;R=2*Y.length/3;te--)ae=Math.floor(Math.random()*(te+1)),J=Y[te],Y[te]=Y[ae],Y[ae]=J;return Y},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(Y){if(Y.left){var ae=O.has(Y.left)?O.get(Y.left):Y.left,J=O.has(Y.right)?O.get(Y.right):Y.right;D.nodesInRelativeHorizontal.includes(ae)||(D.nodesInRelativeHorizontal.push(ae),D.nodeToRelativeConstraintMapHorizontal.set(ae,[]),D.dummyToNodeForVerticalAlignment.has(ae)?D.nodeToTempPositionMapHorizontal.set(ae,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(ae)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(ae,D.idToNodeMap.get(ae).getCenterX())),D.nodesInRelativeHorizontal.includes(J)||(D.nodesInRelativeHorizontal.push(J),D.nodeToRelativeConstraintMapHorizontal.set(J,[]),D.dummyToNodeForVerticalAlignment.has(J)?D.nodeToTempPositionMapHorizontal.set(J,D.idToNodeMap.get(D.dummyToNodeForVerticalAlignment.get(J)[0]).getCenterX()):D.nodeToTempPositionMapHorizontal.set(J,D.idToNodeMap.get(J).getCenterX())),D.nodeToRelativeConstraintMapHorizontal.get(ae).push({right:J,gap:Y.gap}),D.nodeToRelativeConstraintMapHorizontal.get(J).push({left:ae,gap:Y.gap})}else{var te=$.has(Y.top)?$.get(Y.top):Y.top,re=$.has(Y.bottom)?$.get(Y.bottom):Y.bottom;D.nodesInRelativeVertical.includes(te)||(D.nodesInRelativeVertical.push(te),D.nodeToRelativeConstraintMapVertical.set(te,[]),D.dummyToNodeForHorizontalAlignment.has(te)?D.nodeToTempPositionMapVertical.set(te,D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(te)[0]).getCenterY()):D.nodeToTempPositionMapVertical.set(te,D.idToNodeMap.get(te).getCenterY())),D.nodesInRelativeVertical.includes(re)||(D.nodesInRelativeVertical.push(re),D.nodeToRelativeConstraintMapVertical.set(re,[]),D.dummyToNodeForHorizontalAlignment.has(re)?D.nodeToTempPositionMapVertical.set(re,D.idToNodeMap.get(D.dummyToNodeForHorizontalAlignment.get(re)[0]).getCenterY()):D.nodeToTempPositionMapVertical.set(re,D.idToNodeMap.get(re).getCenterY())),D.nodeToRelativeConstraintMapVertical.get(te).push({bottom:re,gap:Y.gap}),D.nodeToRelativeConstraintMapVertical.get(re).push({top:te,gap:Y.gap})}});else{var V=new Map,H=new Map;this.constraints.relativePlacementConstraint.forEach(function(Y){if(Y.left){var ae=O.has(Y.left)?O.get(Y.left):Y.left,J=O.has(Y.right)?O.get(Y.right):Y.right;V.has(ae)?V.get(ae).push(J):V.set(ae,[J]),V.has(J)?V.get(J).push(ae):V.set(J,[ae])}else{var te=$.has(Y.top)?$.get(Y.top):Y.top,re=$.has(Y.bottom)?$.get(Y.bottom):Y.bottom;H.has(te)?H.get(te).push(re):H.set(te,[re]),H.has(re)?H.get(re).push(te):H.set(re,[te])}});var j=o(function(ae,J){var te=[],re=[],ee=new N,Te=new Set,ue=0;return ae.forEach(function(De,Ie){if(!Te.has(Ie)){te[ue]=[],re[ue]=!1;var Ee=Ie;for(ee.push(Ee),Te.add(Ee),te[ue].push(Ee);ee.length!=0;){Ee=ee.shift(),J.has(Ee)&&(re[ue]=!0);var we=ae.get(Ee);we.forEach(function(Me){Te.has(Me)||(ee.push(Me),Te.add(Me),te[ue].push(Me))})}ue++}}),{components:te,isFixed:re}},"constructComponents"),U=j(V,D.fixedNodesOnHorizontal);this.componentsOnHorizontal=U.components,this.fixedComponentsOnHorizontal=U.isFixed;var Q=j(H,D.fixedNodesOnVertical);this.componentsOnVertical=Q.components,this.fixedComponentsOnVertical=Q.isFixed}}},P.prototype.updateDisplacements=function(){var D=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(Q){var Y=D.idToNodeMap.get(Q.nodeId);Y.displacementX=0,Y.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var _=this.constraints.alignmentConstraint.vertical,R=0;R<_.length;R++){for(var M=0,L=0;L<_[R].length;L++){if(this.fixedNodeSet.has(_[R][L])){M=0;break}M+=this.idToNodeMap.get(_[R][L]).displacementX}for(var B=M/_[R].length,L=0;L<_[R].length;L++)this.idToNodeMap.get(_[R][L]).displacementX=B}if(this.constraints.alignmentConstraint.horizontal)for(var O=this.constraints.alignmentConstraint.horizontal,R=0;R1){var $;for($=0;$M&&(M=Math.floor(O.y)),B=Math.floor(O.x+m.DEFAULT_COMPONENT_SEPERATION)}this.transform(new b(v.WORLD_CENTER_X-O.x/2,v.WORLD_CENTER_Y-O.y/2))},P.radialLayout=function(D,_,R){var M=Math.max(this.maxDiagonalInTree(D),m.DEFAULT_RADIAL_SEPARATION);P.branchRadialLayout(_,null,0,359,0,M);var L=E.calculateBounds(D),B=new A;B.setDeviceOrgX(L.getMinX()),B.setDeviceOrgY(L.getMinY()),B.setWorldOrgX(R.x),B.setWorldOrgY(R.y);for(var O=0;O1;){var te=J[0];J.splice(0,1);var re=j.indexOf(te);re>=0&&j.splice(re,1),Y--,U--}_!=null?ae=(j.indexOf(J[0])+1)%Y:ae=0;for(var ee=Math.abs(M-R)/U,Te=ae;Q!=U;Te=++Te%Y){var ue=j[Te].getOtherEnd(D);if(ue!=_){var De=(R+Q*ee)%360,Ie=(De+ee)%360;P.branchRadialLayout(ue,D,De,Ie,L+B,B),Q++}}},P.maxDiagonalInTree=function(D){for(var _=C.MIN_VALUE,R=0;R_&&(_=L)}return _},P.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},P.prototype.groupZeroDegreeMembers=function(){var D=this,_={};this.memberGroups={},this.idToDummyNode={};for(var R=[],M=this.graphManager.getAllNodes(),L=0;L"u"&&(_[$]=[]),_[$]=_[$].concat(B)}Object.keys(_).forEach(function(G){if(_[G].length>1){var F="DummyCompound_"+G;D.memberGroups[F]=_[G];var V=_[G][0].getParent(),H=new f(D.graphManager);H.id=F,H.paddingLeft=V.paddingLeft||0,H.paddingRight=V.paddingRight||0,H.paddingBottom=V.paddingBottom||0,H.paddingTop=V.paddingTop||0,D.idToDummyNode[F]=H;var j=D.getGraphManager().add(D.newGraph(),H),U=V.getChild();U.add(H);for(var Q=0;Q<_[G].length;Q++){var Y=_[G][Q];U.remove(Y),j.add(Y)}}})},P.prototype.clearCompounds=function(){var D={},_={};this.performDFSOnCompounds();for(var R=0;RL?(M.rect.x-=(M.labelWidth-L)/2,M.setWidth(M.labelWidth),M.labelMarginLeft=(M.labelWidth-L)/2):M.labelPosHorizontal=="right"&&M.setWidth(L+M.labelWidth)),M.labelHeight&&(M.labelPosVertical=="top"?(M.rect.y-=M.labelHeight,M.setHeight(B+M.labelHeight),M.labelMarginTop=M.labelHeight):M.labelPosVertical=="center"&&M.labelHeight>B?(M.rect.y-=(M.labelHeight-B)/2,M.setHeight(M.labelHeight),M.labelMarginTop=(M.labelHeight-B)/2):M.labelPosVertical=="bottom"&&M.setHeight(B+M.labelHeight))}})},P.prototype.repopulateCompounds=function(){for(var D=this.compoundOrder.length-1;D>=0;D--){var _=this.compoundOrder[D],R=_.id,M=_.paddingLeft,L=_.paddingTop,B=_.labelMarginLeft,O=_.labelMarginTop;this.adjustLocations(this.tiledMemberPack[R],_.rect.x,_.rect.y,M,L,B,O)}},P.prototype.repopulateZeroDegreeMembers=function(){var D=this,_=this.tiledZeroDegreePack;Object.keys(_).forEach(function(R){var M=D.idToDummyNode[R],L=M.paddingLeft,B=M.paddingTop,O=M.labelMarginLeft,$=M.labelMarginTop;D.adjustLocations(_[R],M.rect.x,M.rect.y,L,B,O,$)})},P.prototype.getToBeTiled=function(D){var _=D.id;if(this.toBeTiled[_]!=null)return this.toBeTiled[_];var R=D.getChild();if(R==null)return this.toBeTiled[_]=!1,!1;for(var M=R.getNodes(),L=0;L0)return this.toBeTiled[_]=!1,!1;if(B.getChild()==null){this.toBeTiled[B.id]=!1;continue}if(!this.getToBeTiled(B))return this.toBeTiled[_]=!1,!1}return this.toBeTiled[_]=!0,!0},P.prototype.getNodeDegree=function(D){for(var _=D.id,R=D.getEdges(),M=0,L=0;LV&&(V=j.rect.height)}R+=V+D.verticalPadding}},P.prototype.tileCompoundMembers=function(D,_){var R=this;this.tiledMemberPack=[],Object.keys(D).forEach(function(M){var L=_[M];if(R.tiledMemberPack[M]=R.tileNodes(D[M],L.paddingLeft+L.paddingRight),L.rect.width=R.tiledMemberPack[M].width,L.rect.height=R.tiledMemberPack[M].height,L.setCenter(R.tiledMemberPack[M].centerX,R.tiledMemberPack[M].centerY),L.labelMarginLeft=0,L.labelMarginTop=0,m.NODE_DIMENSIONS_INCLUDE_LABELS){var B=L.rect.width,O=L.rect.height;L.labelWidth&&(L.labelPosHorizontal=="left"?(L.rect.x-=L.labelWidth,L.setWidth(B+L.labelWidth),L.labelMarginLeft=L.labelWidth):L.labelPosHorizontal=="center"&&L.labelWidth>B?(L.rect.x-=(L.labelWidth-B)/2,L.setWidth(L.labelWidth),L.labelMarginLeft=(L.labelWidth-B)/2):L.labelPosHorizontal=="right"&&L.setWidth(B+L.labelWidth)),L.labelHeight&&(L.labelPosVertical=="top"?(L.rect.y-=L.labelHeight,L.setHeight(O+L.labelHeight),L.labelMarginTop=L.labelHeight):L.labelPosVertical=="center"&&L.labelHeight>O?(L.rect.y-=(L.labelHeight-O)/2,L.setHeight(L.labelHeight),L.labelMarginTop=(L.labelHeight-O)/2):L.labelPosVertical=="bottom"&&L.setHeight(O+L.labelHeight))}})},P.prototype.tileNodes=function(D,_){var R=this.tileNodesByFavoringDim(D,_,!0),M=this.tileNodesByFavoringDim(D,_,!1),L=this.getOrgRatio(R),B=this.getOrgRatio(M),O;return B$&&($=Q.getWidth())});var G=B/L,F=O/L,V=Math.pow(R-M,2)+4*(G+M)*(F+R)*L,H=(M-R+Math.sqrt(V))/(2*(G+M)),j;_?(j=Math.ceil(H),j==H&&j++):j=Math.floor(H);var U=j*(G+M)-M;return $>U&&(U=$),U+=M*2,U},P.prototype.tileNodesByFavoringDim=function(D,_,R){var M=m.TILING_PADDING_VERTICAL,L=m.TILING_PADDING_HORIZONTAL,B=m.TILING_COMPARE_BY,O={rows:[],rowWidth:[],rowHeight:[],width:0,height:_,verticalPadding:M,horizontalPadding:L,centerX:0,centerY:0};B&&(O.idealRowWidth=this.calcIdealRowWidth(D,R));var $=o(function(Y){return Y.rect.width*Y.rect.height},"getNodeArea"),G=o(function(Y,ae){return $(ae)-$(Y)},"areaCompareFcn");D.sort(function(Q,Y){var ae=G;return O.idealRowWidth?(ae=B,ae(Q.id,Y.id)):ae(Q,Y)});for(var F=0,V=0,H=0;H0&&(O+=D.horizontalPadding),D.rowWidth[R]=O,D.width0&&($+=D.verticalPadding);var G=0;$>D.rowHeight[R]&&(G=D.rowHeight[R],D.rowHeight[R]=$,G=D.rowHeight[R]-G),D.height+=G,D.rows[R].push(_)},P.prototype.getShortestRowIndex=function(D){for(var _=-1,R=Number.MAX_VALUE,M=0;MR&&(_=M,R=D.rowWidth[M]);return _},P.prototype.canAddHorizontal=function(D,_,R){if(D.idealRowWidth){var M=D.rows.length-1,L=D.rowWidth[M];return L+_+D.horizontalPadding<=D.idealRowWidth}var B=this.getShortestRowIndex(D);if(B<0)return!0;var O=D.rowWidth[B];if(O+D.horizontalPadding+_<=D.width)return!0;var $=0;D.rowHeight[B]0&&($=R+D.verticalPadding-D.rowHeight[B]);var G;D.width-O>=_+D.horizontalPadding?G=(D.height+$)/(O+_+D.horizontalPadding):G=(D.height+$)/D.width,$=R+D.verticalPadding;var F;return D.width<_?F=(D.height+$)/_:F=(D.height+$)/D.width,F<1&&(F=1/F),G<1&&(G=1/G),GB&&_!=R){M.splice(-1,1),D.rows[R].push(L),D.rowWidth[_]=D.rowWidth[_]-B,D.rowWidth[R]=D.rowWidth[R]+B,D.width=D.rowWidth[instance.getLongestRowIndex(D)];for(var O=Number.MIN_VALUE,$=0;$O&&(O=M[$].height);_>0&&(O+=D.verticalPadding);var G=D.rowHeight[_]+D.rowHeight[R];D.rowHeight[_]=O,D.rowHeight[R]0)for(var U=L;U<=B;U++)j[0]+=this.grid[U][O-1].length+this.grid[U][O].length-1;if(B0)for(var U=O;U<=$;U++)j[3]+=this.grid[L-1][U].length+this.grid[L][U].length-1;for(var Q=C.MAX_VALUE,Y,ae,J=0;J{var u=l(551).FDLayoutNode,h=l(551).IMath;function d(p,m,g,y){u.call(this,p,m,g,y)}o(d,"CoSENode"),d.prototype=Object.create(u.prototype);for(var f in u)d[f]=u[f];d.prototype.calculateDisplacement=function(){var p=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=p.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=p.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=p.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=p.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>p.coolingFactor*p.maxNodeDisplacement&&(this.displacementX=p.coolingFactor*p.maxNodeDisplacement*h.sign(this.displacementX)),Math.abs(this.displacementY)>p.coolingFactor*p.maxNodeDisplacement&&(this.displacementY=p.coolingFactor*p.maxNodeDisplacement*h.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},d.prototype.propogateDisplacementToChildren=function(p,m){for(var g=this.getChild().getNodes(),y,v=0;v{function u(g){if(Array.isArray(g)){for(var y=0,v=Array(g.length);y0){var st=0;le.forEach(function(ot){fe=="horizontal"?(Oe.set(ot,x.has(ot)?b[x.get(ot)]:ce.get(ot)),st+=Oe.get(ot)):(Oe.set(ot,x.has(ot)?T[x.get(ot)]:ce.get(ot)),st+=Oe.get(ot))}),st=st/le.length,Ye.forEach(function(ot){W.has(ot)||Oe.set(ot,st)})}else{var me=0;Ye.forEach(function(ot){fe=="horizontal"?me+=x.has(ot)?b[x.get(ot)]:ce.get(ot):me+=x.has(ot)?T[x.get(ot)]:ce.get(ot)}),me=me/Ye.length,Ye.forEach(function(ot){Oe.set(ot,me)})}});for(var Ae=o(function(){var le=Be.shift(),st=ie.get(le);st.forEach(function(me){if(Oe.get(me.id)ot&&(ot=gt),etkt&&(kt=et)}}catch(lr){Tt=!0,Et=lr}finally{try{!Gt&&yt.return&&yt.return()}finally{if(Tt)throw Et}}var pe=(st+ot)/2-(me+kt)/2,Qe=!0,nt=!1,dt=void 0;try{for(var Ft=Ye[Symbol.iterator](),Rt;!(Qe=(Rt=Ft.next()).done);Qe=!0){var $t=Rt.value;Oe.set($t,Oe.get($t)+pe)}}catch(lr){nt=!0,dt=lr}finally{try{!Qe&&Ft.return&&Ft.return()}finally{if(nt)throw dt}}})}return Oe},"findAppropriatePositionForRelativePlacement"),I=o(function(ie){var fe=0,W=0,ce=0,K=0;if(ie.forEach(function(be){be.left?b[x.get(be.left)]-b[x.get(be.right)]>=0?fe++:W++:T[x.get(be.top)]-T[x.get(be.bottom)]>=0?ce++:K++}),fe>W&&ce>K)for(var Re=0;ReW)for(var xe=0;xeK)for(var Oe=0;Oe1)y.fixedNodeConstraint.forEach(function(ve,ie){M[ie]=[ve.position.x,ve.position.y],L[ie]=[b[x.get(ve.nodeId)],T[x.get(ve.nodeId)]]}),B=!0;else if(y.alignmentConstraint)(function(){var ve=0;if(y.alignmentConstraint.vertical){for(var ie=y.alignmentConstraint.vertical,fe=o(function(Oe){var be=new Set;ie[Oe].forEach(function(Ve){be.add(Ve)});var Be=new Set([].concat(u(be)).filter(function(Ve){return $.has(Ve)})),Ae=void 0;Be.size>0?Ae=b[x.get(Be.values().next().value)]:Ae=N(be).x,ie[Oe].forEach(function(Ve){M[ve]=[Ae,T[x.get(Ve)]],L[ve]=[b[x.get(Ve)],T[x.get(Ve)]],ve++})},"_loop2"),W=0;W0?Ae=b[x.get(Be.values().next().value)]:Ae=N(be).y,ce[Oe].forEach(function(Ve){M[ve]=[b[x.get(Ve)],Ae],L[ve]=[b[x.get(Ve)],T[x.get(Ve)]],ve++})},"_loop3"),Re=0;ReH&&(H=V[U].length,j=U);if(H0){var de={x:0,y:0};y.fixedNodeConstraint.forEach(function(ve,ie){var fe={x:b[x.get(ve.nodeId)],y:T[x.get(ve.nodeId)]},W=ve.position,ce=A(W,fe);de.x+=ce.x,de.y+=ce.y}),de.x/=y.fixedNodeConstraint.length,de.y/=y.fixedNodeConstraint.length,b.forEach(function(ve,ie){b[ie]+=de.x}),T.forEach(function(ve,ie){T[ie]+=de.y}),y.fixedNodeConstraint.forEach(function(ve){b[x.get(ve.nodeId)]=ve.position.x,T[x.get(ve.nodeId)]=ve.position.y})}if(y.alignmentConstraint){if(y.alignmentConstraint.vertical)for(var rt=y.alignmentConstraint.vertical,ke=o(function(ie){var fe=new Set;rt[ie].forEach(function(K){fe.add(K)});var W=new Set([].concat(u(fe)).filter(function(K){return $.has(K)})),ce=void 0;W.size>0?ce=b[x.get(W.values().next().value)]:ce=N(fe).x,fe.forEach(function(K){$.has(K)||(b[x.get(K)]=ce)})},"_loop4"),Fe=0;Fe0?ce=T[x.get(W.values().next().value)]:ce=N(fe).y,fe.forEach(function(K){$.has(K)||(T[x.get(K)]=ce)})},"_loop5"),qe=0;qe{a.exports=e})},r={};function i(a){var s=r[a];if(s!==void 0)return s.exports;var l=r[a]={exports:{}};return t[a](l,l.exports,i),l.exports}o(i,"__webpack_require__");var n=i(45);return n})()})});var SRe=Js((dC,Uq)=>{"use strict";o((function(t,r){typeof dC=="object"&&typeof Uq=="object"?Uq.exports=r(qq()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof dC=="object"?dC.cytoscapeFcose=r(qq()):t.cytoscapeFcose=r(t.coseBase)}),"webpackUniversalModuleDefinition")(dC,function(e){return(()=>{"use strict";var t={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(s){for(var l=arguments.length,u=Array(l>1?l-1:0),h=1;h{var u=(function(){function f(p,m){var g=[],y=!0,v=!1,x=void 0;try{for(var b=p[Symbol.iterator](),T;!(y=(T=b.next()).done)&&(g.push(T.value),!(m&&g.length===m));y=!0);}catch(w){v=!0,x=w}finally{try{!y&&b.return&&b.return()}finally{if(v)throw x}}return g}return o(f,"sliceIterator"),function(p,m){if(Array.isArray(p))return p;if(Symbol.iterator in Object(p))return f(p,m);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),h=l(140).layoutBase.LinkedList,d={};d.getTopMostNodes=function(f){for(var p={},m=0;m0&&B.merge(F)});for(var O=0;O1){T=x[0],w=T.connectedEdges().length,x.forEach(function(L){L.connectedEdges().length0&&g.set("dummy"+(g.size+1),E),A},d.relocateComponent=function(f,p,m){if(!m.fixedNodeConstraint){var g=Number.POSITIVE_INFINITY,y=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY;if(m.quality=="draft"){var b=!0,T=!1,w=void 0;try{for(var C=p.nodeIndexes[Symbol.iterator](),k;!(b=(k=C.next()).done);b=!0){var E=k.value,A=u(E,2),N=A[0],P=A[1],I=m.cy.getElementById(N);if(I){var D=I.boundingBox(),_=p.xCoords[P]-D.w/2,R=p.xCoords[P]+D.w/2,M=p.yCoords[P]-D.h/2,L=p.yCoords[P]+D.h/2;_y&&(y=R),Mx&&(x=L)}}}catch(F){T=!0,w=F}finally{try{!b&&C.return&&C.return()}finally{if(T)throw w}}var B=f.x-(y+g)/2,O=f.y-(x+v)/2;p.xCoords=p.xCoords.map(function(F){return F+B}),p.yCoords=p.yCoords.map(function(F){return F+O})}else{Object.keys(p).forEach(function(F){var V=p[F],H=V.getRect().x,j=V.getRect().x+V.getRect().width,U=V.getRect().y,Q=V.getRect().y+V.getRect().height;Hy&&(y=j),Ux&&(x=Q)});var $=f.x-(y+g)/2,G=f.y-(x+v)/2;Object.keys(p).forEach(function(F){var V=p[F];V.setCenter(V.getCenterX()+$,V.getCenterY()+G)})}}},d.calcBoundingBox=function(f,p,m,g){for(var y=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER,x=Number.MAX_SAFE_INTEGER,b=Number.MIN_SAFE_INTEGER,T=void 0,w=void 0,C=void 0,k=void 0,E=f.descendants().not(":parent"),A=E.length,N=0;NT&&(y=T),vC&&(x=C),b{var u=l(548),h=l(140).CoSELayout,d=l(140).CoSENode,f=l(140).layoutBase.PointD,p=l(140).layoutBase.DimensionD,m=l(140).layoutBase.LayoutConstants,g=l(140).layoutBase.FDLayoutConstants,y=l(140).CoSEConstants,v=o(function(b,T){var w=b.cy,C=b.eles,k=C.nodes(),E=C.edges(),A=void 0,N=void 0,P=void 0,I={};b.randomize&&(A=T.nodeIndexes,N=T.xCoords,P=T.yCoords);var D=o(function(F){return typeof F=="function"},"isFn"),_=o(function(F,V){return D(F)?F(V):F},"optFn"),R=u.calcParentsWithoutChildren(w,C),M=o(function G(F,V,H,j){for(var U=V.length,Q=0;Q0){var ee=void 0;ee=H.getGraphManager().add(H.newGraph(),J),G(ee,ae,H,j)}}},"processChildrenList"),L=o(function(F,V,H){for(var j=0,U=0,Q=0;Q0?y.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=j/U:D(b.idealEdgeLength)?y.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=50:y.DEFAULT_EDGE_LENGTH=g.DEFAULT_EDGE_LENGTH=b.idealEdgeLength,y.MIN_REPULSION_DIST=g.MIN_REPULSION_DIST=g.DEFAULT_EDGE_LENGTH/10,y.DEFAULT_RADIAL_SEPARATION=g.DEFAULT_EDGE_LENGTH)},"processEdges"),B=o(function(F,V){V.fixedNodeConstraint&&(F.constraints.fixedNodeConstraint=V.fixedNodeConstraint),V.alignmentConstraint&&(F.constraints.alignmentConstraint=V.alignmentConstraint),V.relativePlacementConstraint&&(F.constraints.relativePlacementConstraint=V.relativePlacementConstraint)},"processConstraints");b.nestingFactor!=null&&(y.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=b.nestingFactor),b.gravity!=null&&(y.DEFAULT_GRAVITY_STRENGTH=g.DEFAULT_GRAVITY_STRENGTH=b.gravity),b.numIter!=null&&(y.MAX_ITERATIONS=g.MAX_ITERATIONS=b.numIter),b.gravityRange!=null&&(y.DEFAULT_GRAVITY_RANGE_FACTOR=g.DEFAULT_GRAVITY_RANGE_FACTOR=b.gravityRange),b.gravityCompound!=null&&(y.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=b.gravityCompound),b.gravityRangeCompound!=null&&(y.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=b.gravityRangeCompound),b.initialEnergyOnIncremental!=null&&(y.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.DEFAULT_COOLING_FACTOR_INCREMENTAL=b.initialEnergyOnIncremental),b.tilingCompareBy!=null&&(y.TILING_COMPARE_BY=b.tilingCompareBy),b.quality=="proof"?m.QUALITY=2:m.QUALITY=0,y.NODE_DIMENSIONS_INCLUDE_LABELS=g.NODE_DIMENSIONS_INCLUDE_LABELS=m.NODE_DIMENSIONS_INCLUDE_LABELS=b.nodeDimensionsIncludeLabels,y.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=m.DEFAULT_INCREMENTAL=!b.randomize,y.ANIMATE=g.ANIMATE=m.ANIMATE=b.animate,y.TILE=b.tile,y.TILING_PADDING_VERTICAL=typeof b.tilingPaddingVertical=="function"?b.tilingPaddingVertical.call():b.tilingPaddingVertical,y.TILING_PADDING_HORIZONTAL=typeof b.tilingPaddingHorizontal=="function"?b.tilingPaddingHorizontal.call():b.tilingPaddingHorizontal,y.DEFAULT_INCREMENTAL=g.DEFAULT_INCREMENTAL=m.DEFAULT_INCREMENTAL=!0,y.PURE_INCREMENTAL=!b.randomize,m.DEFAULT_UNIFORM_LEAF_NODE_SIZES=b.uniformNodeDimensions,b.step=="transformed"&&(y.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,y.ENFORCE_CONSTRAINTS=!1,y.APPLY_LAYOUT=!1),b.step=="enforced"&&(y.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,y.ENFORCE_CONSTRAINTS=!0,y.APPLY_LAYOUT=!1),b.step=="cose"&&(y.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,y.ENFORCE_CONSTRAINTS=!1,y.APPLY_LAYOUT=!0),b.step=="all"&&(b.randomize?y.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:y.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,y.ENFORCE_CONSTRAINTS=!0,y.APPLY_LAYOUT=!0),b.fixedNodeConstraint||b.alignmentConstraint||b.relativePlacementConstraint?y.TREE_REDUCTION_ON_INCREMENTAL=!1:y.TREE_REDUCTION_ON_INCREMENTAL=!0;var O=new h,$=O.newGraphManager();return M($.addRoot(),u.getTopMostNodes(k),O,b),L(O,$,E),B(O,b),O.runLayout(),I},"coseLayout");a.exports={coseLayout:v}}),212:((a,s,l)=>{var u=(function(){function b(T,w){for(var C=0;C0)if(L){var $=f.getTopMostNodes(C.eles.nodes());if(D=f.connectComponents(k,C.eles,$),D.forEach(function(Ee){var we=Ee.boundingBox();_.push({x:we.x1+we.w/2,y:we.y1+we.h/2})}),C.randomize&&D.forEach(function(Ee){C.eles=Ee,A.push(m(C))}),C.quality=="default"||C.quality=="proof"){var G=k.collection();if(C.tile){var F=new Map,V=[],H=[],j=0,U={nodeIndexes:F,xCoords:V,yCoords:H},Q=[];if(D.forEach(function(Ee,we){Ee.edges().length==0&&(Ee.nodes().forEach(function(Me,$e){G.merge(Ee.nodes()[$e]),Me.isParent()||(U.nodeIndexes.set(Ee.nodes()[$e].id(),j++),U.xCoords.push(Ee.nodes()[0].position().x),U.yCoords.push(Ee.nodes()[0].position().y))}),Q.push(we))}),G.length>1){var Y=G.boundingBox();_.push({x:Y.x1+Y.w/2,y:Y.y1+Y.h/2}),D.push(G),A.push(U);for(var ae=Q.length-1;ae>=0;ae--)D.splice(Q[ae],1),A.splice(Q[ae],1),_.splice(Q[ae],1)}}D.forEach(function(Ee,we){C.eles=Ee,I.push(y(C,A[we])),f.relocateComponent(_[we],I[we],C)})}else D.forEach(function(Ee,we){f.relocateComponent(_[we],A[we],C)});var J=new Set;if(D.length>1){var te=[],re=E.filter(function(Ee){return Ee.css("display")=="none"});D.forEach(function(Ee,we){var Me=void 0;if(C.quality=="draft"&&(Me=A[we].nodeIndexes),Ee.nodes().not(re).length>0){var $e={};$e.edges=[],$e.nodes=[];var de=void 0;Ee.nodes().not(re).forEach(function(rt){if(C.quality=="draft")if(!rt.isParent())de=Me.get(rt.id()),$e.nodes.push({x:A[we].xCoords[de]-rt.boundingbox().w/2,y:A[we].yCoords[de]-rt.boundingbox().h/2,width:rt.boundingbox().w,height:rt.boundingbox().h});else{var ke=f.calcBoundingBox(rt,A[we].xCoords,A[we].yCoords,Me);$e.nodes.push({x:ke.topLeftX,y:ke.topLeftY,width:ke.width,height:ke.height})}else I[we][rt.id()]&&$e.nodes.push({x:I[we][rt.id()].getLeft(),y:I[we][rt.id()].getTop(),width:I[we][rt.id()].getWidth(),height:I[we][rt.id()].getHeight()})}),Ee.edges().forEach(function(rt){var ke=rt.source(),Fe=rt.target();if(ke.css("display")!="none"&&Fe.css("display")!="none")if(C.quality=="draft"){var He=Me.get(ke.id()),at=Me.get(Fe.id()),qe=[],Ue=[];if(ke.isParent()){var ye=f.calcBoundingBox(ke,A[we].xCoords,A[we].yCoords,Me);qe.push(ye.topLeftX+ye.width/2),qe.push(ye.topLeftY+ye.height/2)}else qe.push(A[we].xCoords[He]),qe.push(A[we].yCoords[He]);if(Fe.isParent()){var ve=f.calcBoundingBox(Fe,A[we].xCoords,A[we].yCoords,Me);Ue.push(ve.topLeftX+ve.width/2),Ue.push(ve.topLeftY+ve.height/2)}else Ue.push(A[we].xCoords[at]),Ue.push(A[we].yCoords[at]);$e.edges.push({startX:qe[0],startY:qe[1],endX:Ue[0],endY:Ue[1]})}else I[we][ke.id()]&&I[we][Fe.id()]&&$e.edges.push({startX:I[we][ke.id()].getCenterX(),startY:I[we][ke.id()].getCenterY(),endX:I[we][Fe.id()].getCenterX(),endY:I[we][Fe.id()].getCenterY()})}),$e.nodes.length>0&&(te.push($e),J.add(we))}});var ee=M.packComponents(te,C.randomize).shifts;if(C.quality=="draft")A.forEach(function(Ee,we){var Me=Ee.xCoords.map(function(de){return de+ee[we].dx}),$e=Ee.yCoords.map(function(de){return de+ee[we].dy});Ee.xCoords=Me,Ee.yCoords=$e});else{var Te=0;J.forEach(function(Ee){Object.keys(I[Ee]).forEach(function(we){var Me=I[Ee][we];Me.setCenter(Me.getCenterX()+ee[Te].dx,Me.getCenterY()+ee[Te].dy)}),Te++})}}}else{var B=C.eles.boundingBox();if(_.push({x:B.x1+B.w/2,y:B.y1+B.h/2}),C.randomize){var O=m(C);A.push(O)}C.quality=="default"||C.quality=="proof"?(I.push(y(C,A[0])),f.relocateComponent(_[0],I[0],C)):f.relocateComponent(_[0],A[0],C)}var ue=o(function(we,Me){if(C.quality=="default"||C.quality=="proof"){typeof we=="number"&&(we=Me);var $e=void 0,de=void 0,rt=we.data("id");return I.forEach(function(Fe){rt in Fe&&($e={x:Fe[rt].getRect().getCenterX(),y:Fe[rt].getRect().getCenterY()},de=Fe[rt])}),C.nodeDimensionsIncludeLabels&&(de.labelWidth&&(de.labelPosHorizontal=="left"?$e.x+=de.labelWidth/2:de.labelPosHorizontal=="right"&&($e.x-=de.labelWidth/2)),de.labelHeight&&(de.labelPosVertical=="top"?$e.y+=de.labelHeight/2:de.labelPosVertical=="bottom"&&($e.y-=de.labelHeight/2))),$e==null&&($e={x:we.position("x"),y:we.position("y")}),{x:$e.x,y:$e.y}}else{var ke=void 0;return A.forEach(function(Fe){var He=Fe.nodeIndexes.get(we.id());He!=null&&(ke={x:Fe.xCoords[He],y:Fe.yCoords[He]})}),ke==null&&(ke={x:we.position("x"),y:we.position("y")}),{x:ke.x,y:ke.y}}},"getPositions");if(C.quality=="default"||C.quality=="proof"||C.randomize){var De=f.calcParentsWithoutChildren(k,E),Ie=E.filter(function(Ee){return Ee.css("display")=="none"});C.eles=E.not(Ie),E.nodes().not(":parent").not(Ie).layoutPositions(w,C,ue),De.length>0&&De.forEach(function(Ee){Ee.position(ue(Ee))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")},"run")}]),b})();a.exports=x}),657:((a,s,l)=>{var u=l(548),h=l(140).layoutBase.Matrix,d=l(140).layoutBase.SVD,f=o(function(m){var g=m.cy,y=m.eles,v=y.nodes(),x=y.nodes(":parent"),b=new Map,T=new Map,w=new Map,C=[],k=[],E=[],A=[],N=[],P=[],I=[],D=[],_=void 0,R=void 0,M=1e8,L=1e-9,B=m.piTol,O=m.samplingType,$=m.nodeSeparation,G=void 0,F=o(function(){for(var fe=0,W=0,ce=!1;W=Re;){Oe=K[Re++];for(var Ye=C[Oe],le=0;leAe&&(Ae=N[me],Ve=me)}return Ve},"BFS"),H=o(function(fe){var W=void 0;if(fe){W=Math.floor(Math.random()*R),_=W;for(var K=0;K=1)break;Ae=Be}for(var Ye=0;Ye=1)break;Ae=Be}for(var st=0;st0&&(W.isParent()?C[fe].push(w.get(W.id())):C[fe].push(W.id()))})});var De=o(function(fe){var W=T.get(fe),ce=void 0;b.get(fe).forEach(function(K){g.getElementById(K).isParent()?ce=w.get(K):ce=K,C[W].push(ce),C[T.get(ce)].push(fe)})},"_loop"),Ie=!0,Ee=!1,we=void 0;try{for(var Me=b.keys()[Symbol.iterator](),$e;!(Ie=($e=Me.next()).done);Ie=!0){var de=$e.value;De(de)}}catch(ie){Ee=!0,we=ie}finally{try{!Ie&&Me.return&&Me.return()}finally{if(Ee)throw we}}R=T.size;var rt=void 0;if(R>2){G=R{var u=l(212),h=o(function(f){f&&f("layout","fcose",u)},"register");typeof cytoscape<"u"&&h(cytoscape),a.exports=h}),140:(a=>{a.exports=e})},r={};function i(a){var s=r[a];if(s!==void 0)return s.exports;var l=r[a]={exports:{}};return t[a](l,l.exports,i),l.exports}o(i,"__webpack_require__");var n=i(579);return n})()})});var Oy,wm,Hq=z(()=>{"use strict";uc();Oy=o(e=>`${e}`,"wrapIcon"),wm={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:Oy('')},server:{body:Oy('')},disk:{body:Oy('')},internet:{body:Oy('')},cloud:{body:Oy('')},unknown:DD,blank:{body:Oy("")}}}});var ERe,ARe,_Re,DRe,RRe=z(()=>{"use strict";Ut();_s();uc();Ir();Hq();E_();Xt();ERe=o(async function(e,t,r,i){let n=r.getConfigField("padding"),a=r.getConfigField("iconSize"),s=a/2,l=a/6,u=l/2;await Promise.all(t.edges().map(async h=>{let{source:d,sourceDir:f,sourceArrow:p,sourceGroup:m,target:g,targetDir:y,targetArrow:v,targetGroup:x,label:b}=S_(h),{x:T,y:w}=h[0].sourceEndpoint(),{x:C,y:k}=h[0].midpoint(),{x:E,y:A}=h[0].targetEndpoint(),N=n+4;if(m&&(za(f)?T+=f==="L"?-N:N:w+=f==="T"?-N:N+18),x&&(za(y)?E+=y==="L"?-N:N:A+=y==="T"?-N:N+18),!m&&r.getNode(d)?.type==="junction"&&(za(f)?T+=f==="L"?s:-s:w+=f==="T"?s:-s),!x&&r.getNode(g)?.type==="junction"&&(za(y)?E+=y==="L"?s:-s:A+=y==="T"?s:-s),h[0]._private.rscratch){let P=e.insert("g");if(P.insert("path").attr("d",`M ${T},${w} L ${C},${k} L${E},${A} `).attr("class","edge").attr("id",`${i}-${bc(d,g,{prefix:"L"})}`),p){let I=za(f)?oC[f](T,l):T-u,D=uu(f)?oC[f](w,l):w-u;P.insert("polygon").attr("points",Bq[f](l)).attr("transform",`translate(${I},${D})`).attr("class","arrow")}if(v){let I=za(y)?oC[y](E,l):E-u,D=uu(y)?oC[y](A,l):A-u;P.insert("polygon").attr("points",Bq[y](l)).attr("transform",`translate(${I},${D})`).attr("class","arrow")}if(b){let I=lC(f,y)?"XY":za(f)?"X":"Y",D=0;I==="X"?D=Math.abs(T-E):I==="Y"?D=Math.abs(w-A)/1.5:D=Math.abs(T-E)/2;let _=P.append("g");if(await wi(_,b,{useHtmlLabels:!1,width:D,classes:"architecture-service-label"},ge()),_.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),I==="X")_.attr("transform","translate("+C+", "+k+")");else if(I==="Y")_.attr("transform","translate("+C+", "+k+") rotate(-90)");else if(I==="XY"){let R=cC(f,y);if(R&&gRe(R)){let M=_.node().getBoundingClientRect(),[L,B]=vRe(R);_.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*L*B*45})`);let O=_.node().getBoundingClientRect();_.attr("transform",` + translate(${C}, ${k-M.height/2}) + translate(${L*O.width/2}, ${B*O.height/2}) + rotate(${-1*L*B*45}, 0, ${M.height/2}) + `)}}}}}))},"drawEdges"),ARe=o(async function(e,t,r,i){let a=r.getConfigField("padding")*.75,s=r.getConfigField("fontSize"),u=r.getConfigField("iconSize")/2;await Promise.all(t.nodes().map(async h=>{let d=Nf(h);if(d.type==="group"){let{h:f,w:p,x1:m,y1:g}=h.boundingBox(),y=e.append("rect");y.attr("id",`${i}-group-${d.id}`).attr("x",m+u).attr("y",g+u).attr("width",p).attr("height",f).attr("class","node-bkg");let v=e.append("g"),x=m,b=g;if(d.icon){let T=v.append("g");T.html(`${await ks(d.icon,{height:a,width:a,fallbackPrefix:wm.prefix})}`),T.attr("transform","translate("+(x+u+1)+", "+(b+u+1)+")"),x+=a,b+=s/2-1-2}if(d.label){let T=v.append("g");await wi(T,d.label,{useHtmlLabels:!1,width:p,classes:"architecture-service-label"},ge()),T.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),T.attr("transform","translate("+(x+u+4)+", "+(b+u+2)+")")}r.setElementForId(d.id,y)}}))},"drawGroups"),_Re=o(async function(e,t,r,i){let n=ge();for(let a of r){let s=t.append("g"),l=e.getConfigField("iconSize");if(a.title){let f=s.append("g");await wi(f,a.title,{useHtmlLabels:!1,width:l*1.5,classes:"architecture-service-label"},n),f.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),f.attr("transform","translate("+l/2+", "+l+")")}let u=s.append("g");if(a.icon)u.html(`${await ks(a.icon,{height:l,width:l,fallbackPrefix:wm.prefix})}`);else if(a.iconText){u.html(`${await ks("blank",{height:l,width:l,fallbackPrefix:wm.prefix})}`);let m=u.append("g").append("foreignObject").attr("width",l).attr("height",l).append("div").attr("class","node-icon-text").attr("style",`height: ${l}px;`).append("div").html(fr(a.iconText,n)),g=parseInt(window.getComputedStyle(m.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;m.attr("style",`-webkit-line-clamp: ${Math.floor((l-2)/g)};`)}else u.append("path").attr("class","node-bkg").attr("id",`${i}-node-${a.id}`).attr("d",`M0,${l} V5 Q0,0 5,0 H${l-5} Q${l},0 ${l},5 V${l} Z`);s.attr("id",`${i}-service-${a.id}`).attr("class","architecture-service");let{width:h,height:d}=s.node().getBBox();a.width=h,a.height=d,e.setElementForId(a.id,s)}return 0},"drawServices"),DRe=o(function(e,t,r,i){r.forEach(n=>{let a=t.append("g"),s=e.getConfigField("iconSize");a.append("g").append("rect").attr("id",`${i}-node-${n.id}`).attr("fill-opacity","0").attr("width",s).attr("height",s),a.attr("class","architecture-junction");let{width:u,height:h}=a._groups[0][0].getBBox();a.width=u,a.height=h,e.setElementForId(n.id,a)})},"drawJunctions")});function z3t(e,t,r){e.forEach(i=>{t.add({group:"nodes",data:{type:"service",id:i.id,icon:i.icon,label:i.title,parent:i.in,width:r.getConfigField("iconSize"),height:r.getConfigField("iconSize")},classes:"node-service"})})}function G3t(e,t,r){e.forEach(i=>{t.add({group:"nodes",data:{type:"junction",id:i.id,parent:i.in,width:r.getConfigField("iconSize"),height:r.getConfigField("iconSize")},classes:"node-junction"})})}function V3t(e,t){t.nodes().map(r=>{let i=Nf(r);if(i.type==="group")return;i.x=r.position().x,i.y=r.position().y,e.getElementById(i.id).attr("transform","translate("+(i.x||0)+","+(i.y||0)+")")})}function W3t(e,t){e.forEach(r=>{t.add({group:"nodes",data:{type:"group",id:r.id,icon:r.icon,label:r.title,parent:r.in},classes:"node-group"})})}function q3t(e,t){e.forEach(r=>{let{lhsId:i,rhsId:n,lhsInto:a,lhsGroup:s,rhsInto:l,lhsDir:u,rhsDir:h,rhsGroup:d,title:f}=r,p=lC(r.lhsDir,r.rhsDir)?"segments":"straight",m={id:`${i}-${n}`,label:f,source:i,sourceDir:u,sourceArrow:a,sourceGroup:s,sourceEndpoint:u==="L"?"0 50%":u==="R"?"100% 50%":u==="T"?"50% 0":"50% 100%",target:n,targetDir:h,targetArrow:l,targetGroup:d,targetEndpoint:h==="L"?"0 50%":h==="R"?"100% 50%":h==="T"?"50% 0":"50% 100%"};t.add({group:"edges",data:m,classes:p})})}function U3t(e,t,r){let i=o((l,u)=>Object.entries(l).reduce((h,[d,f])=>{let p=0,m=Object.entries(f);if(m.length===1)return h[d]=m[0][1],h;for(let g=0;g{let u={},h={};return Object.entries(l).forEach(([d,[f,p]])=>{let m=e.getNode(d)?.in??"default";u[p]??={},u[p][m]??=[],u[p][m].push(d),h[f]??={},h[f][m]??=[],h[f][m].push(d)}),{horiz:Object.values(i(u,"horizontal")).filter(d=>d.length>1),vert:Object.values(i(h,"vertical")).filter(d=>d.length>1)}}),[a,s]=n.reduce(([l,u],{horiz:h,vert:d})=>[[...l,...h],[...u,...d]],[[],[]]);return{horizontal:a,vertical:s}}function H3t(e,t){let r=[],i=o(a=>`${a[0]},${a[1]}`,"posToStr"),n=o(a=>a.split(",").map(s=>parseInt(s)),"strToPos");return e.forEach(a=>{let s=Object.fromEntries(Object.entries(a).map(([d,f])=>[i(f),d])),l=[i([0,0])],u={},h={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;l.length>0;){let d=l.shift();if(d){u[d]=1;let f=s[d];if(f){let p=n(d);Object.entries(h).forEach(([m,g])=>{let y=i([p[0]+g[0],p[1]+g[1]]),v=s[y];v&&!u[y]&&(l.push(y),r.push({[Pq[m]]:v,[Pq[mRe(m)]]:f,gap:1.5*t.getConfigField("iconSize")}))})}}}}),r}function Y3t(e,t,r,i,n,{spatialMaps:a,groupAlignments:s}){return new Promise(l=>{let u=Je("body").append("div").attr("id","cy").attr("style","display:none"),h=Ko({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${n.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${n.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});u.remove(),W3t(r,h),z3t(e,h,n),G3t(t,h,n),q3t(i,h);let d=U3t(n,a,s),f=H3t(a,n),p=n.getConfigField("iconSize"),m=n.getConfigField("idealEdgeLengthMultiplier")*p,g=.5*p,y=n.getConfigField("edgeElasticity"),v=h.layout({name:"fcose",quality:"proof",randomize:n.getConfigField("randomize"),nodeSeparation:n.getConfigField("nodeSeparation"),numIter:n.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(x){let[b,T]=x.connectedNodes(),{parent:w}=Nf(b),{parent:C}=Nf(T);return w===C?m:g},edgeElasticity(x){let[b,T]=x.connectedNodes(),{parent:w}=Nf(b),{parent:C}=Nf(T);return w===C?y:.001},alignmentConstraint:d,relativePlacementConstraint:f});v.one("layoutstop",()=>{function x(b,T,w,C){let k,E,{x:A,y:N}=b,{x:P,y:I}=T;E=(C-N+(A-w)*(N-I)/(A-P))/Math.sqrt(1+Math.pow((N-I)/(A-P),2)),k=Math.sqrt(Math.pow(C-N,2)+Math.pow(w-A,2)-Math.pow(E,2));let D=Math.sqrt(Math.pow(P-A,2)+Math.pow(I-N,2));k=k/D;let _=(P-A)*(C-N)-(I-N)*(w-A);switch(!0){case _>=0:_=1;break;case _<0:_=-1;break}let R=(P-A)*(w-A)+(I-N)*(C-N);switch(!0){case R>=0:R=1;break;case R<0:R=-1;break}return E=Math.abs(E)*_,k=k*R,{distances:E,weights:k}}o(x,"getSegmentWeights"),h.startBatch();for(let b of Object.values(h.edges()))if(b.data?.()){let{x:T,y:w}=b.source().position(),{x:C,y:k}=b.target().position();if(T!==C&&w!==k){let E=b.sourceEndpoint(),A=b.targetEndpoint(),{sourceDir:N}=S_(b),[P,I]=uu(N)?[E.x,A.y]:[A.x,E.y],{weights:D,distances:_}=x(E,A,P,I);b.style("segment-distances",_),b.style("segment-weights",D)}}h.endBatch(),v.run()}),v.run(),h.ready(x=>{Z.info("Ready",x),l(h)})})}var LRe,j3t,MRe,NRe=z(()=>{"use strict";OP();LRe=ys(SRe(),1);Rr();St();uc();ps();Di();Hq();E_();RRe();dk([{name:wm.prefix,icons:wm}]);Ko.use(LRe.default);o(z3t,"addServices");o(G3t,"addJunctions");o(V3t,"positionNodes");o(W3t,"addGroups");o(q3t,"addEdges");o(U3t,"getAlignments");o(H3t,"getRelativeConstraints");o(Y3t,"layoutArchitecture");j3t=o(async(e,t,r,i)=>{let n=i.db;n.setDiagramId(t);let a=n.getServices(),s=n.getJunctions(),l=n.getGroups(),u=n.getEdges(),h=n.getDataStructures(),d=bi(t),f=d.append("g");f.attr("class","architecture-edges");let p=d.append("g");p.attr("class","architecture-services");let m=d.append("g");m.attr("class","architecture-groups"),await _Re(n,p,a,t),DRe(n,p,s,t);let g=await Y3t(a,s,l,u,n,h);await ERe(f,g,n,t),await ARe(m,g,n,t),V3t(n,g),Io(void 0,d,n.getConfigField("padding"),n.getConfigField("useMaxWidth"))},"draw"),MRe={draw:j3t}});var IRe={};xr(IRe,{diagram:()=>X3t});var X3t,ORe=z(()=>{"use strict";CRe();$q();wRe();NRe();X3t={parser:zq,get db(){return new Iy},renderer:MRe,styles:kRe}});var Yq,jq,A_,Xq,FRe=z(()=>{"use strict";Yq="position frame",jq="frame positioned",A_="position relation",Xq="relation positioned"});function rEt(){Qq={}}function aEt(){let e=oEt,{ast:t}=Qq,r=zRe();if(!t)throw new Error("No data for EventModel");return t.frames.forEach((i,n)=>{let a=fEt(i,t.dataEntities,r);e=Zq(e,{$kind:Yq,index:n,frame:i,textProps:a});let s;xEt(i)?(Z.debug("source frame",i.sourceFrames),s=t.frames.filter(l=>i.sourceFrames.some(u=>u.$refText===l.name)),s.forEach(l=>{e=Zq(e,{$kind:A_,index:n,frame:i,sourceFrame:l})})):e=Zq(e,{$kind:A_,index:n,frame:i})}),e={...e,sortedSwimlanesArray:GRe(e.swimlanes)},e}function sEt(e){Qq.ast=e}function zRe(){return ti}function lEt(e){let t=e.split(".");if(t.length===2)return t[0]}function cEt(e){let t=e.split(".");return t.length===2?t[1]:e}function uEt(e,t){if(!(!t||t.length===0))return Object.values(e).find(r=>r.namespace===t)}function Kq(e,t,r){return Math.max(t,...Object.keys(e).filter(i=>{let n=Number.parseInt(i);return n>t&&nNumber.parseInt(i)))+1}function hEt(e,t){let r=lEt(e.entityIdentifier),i=uEt(t,r);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||ti.labelUiAutomation}:r?{index:Kq(t,0,100),label:ti.labelUiAutomationPrefix+r}:{index:0,label:ti.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||ti.labelCommandReadModel}:r?{index:Kq(t,100,200),label:ti.labelCommandReadModelPrefix+r}:{index:100,label:ti.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||ti.labelEvents}:r?{index:Kq(t,200,300),label:ti.labelEventsPrefix+r}:{index:200,label:ti.labelEvents}}}function dEt(e){let{themeVariables:t}=Nt();switch(e.modelEntityType){case"ui":return{fill:t.emUiFill??"white",stroke:t.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:t.emProcessorFill??"#edb3f6",stroke:t.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:t.emReadModelFill??"#d3f1a2",stroke:t.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:t.emCommandFill??"#bcd6fe",stroke:t.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:t.emEventFill??"#ffb778",stroke:t.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}function fEt(e,t,r){let i=Nt(),n=fr(cEt(e.entityIdentifier)??"",i),a,s={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
    "},u=`${Tp(n,r.textMaxWidth,s)}`;if(e.dataInlineValue&&(a=e.dataInlineValue,a=a.substring(a.indexOf("{")+1),a=a.substring(0,a.lastIndexOf("}")-1),a=fr(a,i),a=Tp(a,r.textMaxWidth,s),a=a.replaceAll(" "," ")),e.dataReference){let g=t.find(y=>y.name===e.dataReference?.$refText);g&&(a=g.dataBlockValue,a=a.substring(a.indexOf(`{ +`)+2),a=a.substring(0,a.lastIndexOf("}")-1),a=fr(a,i),a=Tp(a,r.textMaxWidth,s),a=a.replaceAll(" "," "),a+="
    ")}let h=a!==void 0;h&&(u+=`

    ${a}`);let d={fontSize:s.fontSize,fontWeight:s.fontWeight,fontFamily:s.fontFamily},f=Px(u,d),p=h?f.width/3:f.width,m={content:u,width:p,height:f.height};return Z.debug(`[${e.name}] ${e.entityIdentifier} text`,m),m}function pEt(e,t){let r=t,i=dEt(r.frame),n={width:r.textProps.width+2*ti.boxTextPadding,height:r.textProps.height+2*ti.boxTextPadding};return[{$kind:jq,frame:r.frame,index:r.index,visual:i,dimension:n,textProps:r.textProps}]}function mEt(e,t,r){return t===void 0?ti.contentStartX:t.index===e.index&&e.r?e.r+ti.boxPadding:r===void 0?ti.contentStartX:r.r-ti.boxOverlap+ti.boxPadding}function gEt(e,t){let r=[...e.map(i=>i.r),t];return Math.max(...r)}function GRe(e){return Object.values(e).sort((t,r)=>t.index-r.index)}function yEt(e,t){let r=t,i=hEt(r.frame,e.swimlanes),n;i.index in e.swimlanes?n=e.swimlanes[i.index]:n={index:i.index,label:i.label,r:0,y:i.index*ti.swimlaneMinHeight+ti.swimlaneGap,height:ti.swimlaneMinHeight,maxHeight:ti.swimlaneMinHeight};let a=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,s=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,l={width:Math.max(ti.boxMinWidth,Math.min(ti.boxMaxWidth,r.dimension.width))+2*ti.boxPadding,height:Math.max(ti.boxMinHeight,Math.min(ti.boxMaxHeight,r.dimension.height))+2*ti.boxPadding},u=mEt(n,s,a),h=u+l.width+ti.boxPadding,d=gEt(Object.values(e.swimlanes),h);n.r=u+l.width,n.maxHeight=Math.max(n.maxHeight,l.height),n.height=Math.max(ti.swimlaneMinHeight,n.maxHeight)+2*ti.swimlanePadding;let f={x:u,y:ti.swimlanePadding+n.y,r:h,dimension:l,leftSibling:!1,swimlane:n,visual:r.visual,text:r.textProps.content,frame:r.frame,index:r.index},p={...e,boxes:[...e.boxes,f],swimlanes:{...e.swimlanes,[`${n.index}`]:n},previousSwimlaneNumber:i.index,previousFrame:r.frame,maxR:d},m=GRe(p.swimlanes);m.length>0&&(m[0].y=0);for(let g=1;g0}function $Re(e,t){if(t!=null)return e.find(r=>r.frame.name===t.name)}function bEt(e,t,r){if(!(r<0))for(let i=r;i>=0;i--){let n=e[i];if(n.swimlane.index!==t)return n}}function TEt(e,t){let r=t;if(JA(r.frame)||vEt(r.index,r.frame))return[];let i=$Re(e.boxes,r.frame);if(i===void 0)throw new Error(`Target box not found for frame ${r.frame.name}`);let n;return r.sourceFrame?n=$Re(e.boxes,r.sourceFrame):n=bEt(e.boxes,i.swimlane.index,r.index-1),n===void 0?[]:[{$kind:Xq,frame:r.frame,index:r.index,sourceBox:n,targetBox:i}]}function CEt(e,t){let r=t,i={visual:{fill:"none",stroke:"#000"},source:{x:r.sourceBox.x,y:r.sourceBox.y},target:{x:r.targetBox.x,y:r.targetBox.y},sourceBox:r.sourceBox,targetBox:r.targetBox};return{...e,relations:[...e.relations,i]}}function SEt(e,t){let r=kEt[t.$kind];if(r==null)return[];let i=r(e,t);return Z.debug("decided events",i),i}function EEt(e,t){let r=t.reduce((i,n)=>{let a=wEt[n.$kind];return a==null?i:a(i,n)},e);return Z.debug("evolve events",{state:e,newState:r,events:t}),r}function Zq(e,t){let r=SEt(e,t);return EEt(e,r)}var J3t,eEt,tEt,iEt,nEt,Qq,ti,oEt,kEt,wEt,fC,Jq=z(()=>{"use strict";St();Xt();Xt();br();Ci();Ir();Bn();sl();FRe();J3t=o(function(e){Z.debug("options str",e)},"setOptions"),eEt=o(function(){return{}},"getOptions"),tEt=o(function(){rEt(),gr()},"clear");o(rEt,"reset");iEt=or.eventmodeling,nEt=o(()=>Gr({...iEt,...Nt().eventmodeling}),"getConfig"),Qq={};o(aEt,"getState");o(sEt,"setAst");ti={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};o(zRe,"getDiagramProps");oEt={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};o(lEt,"extractNamespace");o(cEt,"extractName");o(uEt,"findSwimlaneByNamespace");o(Kq,"findNextAvailableIndex");o(hEt,"calculateSwimlaneProps");o(dEt,"calculateEntityVisualProps");o(fEt,"calculateTextProps");o(pEt,"decidePositionFrame");o(mEt,"calculateX");o(gEt,"calculateMaxRight");o(GRe,"sortedSwimlanesArray");o(yEt,"evolveFramePositioned");o(vEt,"isFirstFrame");o(xEt,"hasSourceFrame");o($Re,"findBoxByFrame");o(bEt,"findBoxByLineIndex");o(TEt,"decidePositionRelation");o(CEt,"evolveRelationPositioned");kEt={[Yq]:pEt,[A_]:TEt},wEt={[jq]:yEt,[Xq]:CEt};o(SEt,"decide");o(EEt,"evolve");o(Zq,"dispatch");fC={getConfig:nEt,setOptions:J3t,getOptions:eEt,clear:tEt,setAccTitle:Cr,getAccTitle:kr,getAccDescription:Sr,setAccDescription:wr,setDiagramTitle:Ar,getDiagramTitle:Er,setAst:sEt,getDiagramProps:zRe,getState:aEt}});var VRe,WRe=z(()=>{"use strict";sl();St();au();Jq();VRe={parse:o(async e=>{let t=await bn("eventmodeling",e);Z.debug(t),fC.setAst(t),ca(t,fC)},"parse")}});function DEt(e,t){return r=>{let i=r.swimlane.y+t.swimlanePadding,n=e.append("g").attr("class","em-box");n.append("rect").attr("x",r.x).attr("y",i).attr("rx","3").attr("width",r.dimension.width).attr("height",r.dimension.height).attr("stroke",r.visual.stroke).attr("fill",r.visual.fill),n.append("foreignObject").attr("x",r.x+t.boxPadding).attr("y",i+10).attr("width",r.dimension.width-2*t.boxPadding).attr("height",r.dimension.height-2*t.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(r.text)}}function REt(e,t){return e>t}function LEt(e,t,r,i){return n=>{let a=n.sourceBox.swimlane.y+t.swimlanePadding,s=n.targetBox.swimlane.y+t.swimlanePadding,l=REt(a,s),u=n.sourceBox.x+n.sourceBox.dimension.width*2/3,h=n.targetBox.x+n.targetBox.dimension.width/3,d,f;Z.debug(`rendering relation up=${l} for `,{sourceBox:n.sourceBox,targetBox:n.targetBox}),l?(d=a,f=s+n.targetBox.dimension.height):(d=a+n.sourceBox.dimension.height,f=s);let p=i.emRelationStroke??n.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",n.visual.fill).attr("stroke",p).attr("stroke-width","1").attr("marker-end",`url(#${r})`).attr("d",`M${u} ${d} L${h} ${f}`)}}function MEt(e,t,r,i){return n=>{let a=e.append("g").attr("class","em-swimlane"),s=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",l=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";a.append("rect").attr("x",0).attr("y",n.y).attr("rx","3").attr("width",t+r.swimlanePadding).attr("height",n.height).attr("fill",s).attr("stroke",l),a.append("text").attr("font-weight",r.swimlaneTextFontWeight).attr("x",30).attr("y",n.y+30).text(n.label)}}var AEt,_Et,NEt,qRe,URe=z(()=>{"use strict";Rr();Ut();St();AEt=ge(),_Et=AEt?.eventmodeling;o(DEt,"renderD3Box");o(REt,"dirUpwards");o(LEt,"renderD3Relation");o(MEt,"renderD3Swimlane");NEt=o(function(e,t,r,i){if(Z.debug("in eventmodeling renderer",e+` +`,"id:",t,r),!_Et)throw new Error("EventModeling config not found");let n=i.db,{themeVariables:a,eventmodeling:s}=ge(),l=Je(`[id="${t}"]`),u=n.getDiagramProps(),h=n.getState(),d=`em-arrowhead-${t}`,f=a.emArrowhead??"#000000";h.sortedSwimlanesArray.forEach(MEt(l,h.maxR,u,a)),h.boxes.forEach(DEt(l,u)),h.relations.forEach(LEt(l,u,d,a)),l.append("defs").append("marker").attr("id",d).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",f),Av(void 0,l,s?.padding??30,s?.useMaxWidth)},"draw"),qRe={draw:NEt}});var IEt,HRe,YRe=z(()=>{"use strict";IEt=o(e=>"","getStyles"),HRe=IEt});var jRe={};xr(jRe,{diagram:()=>OEt});var OEt,XRe=z(()=>{"use strict";WRe();Jq();URe();YRe();OEt={parser:VRe,db:fC,renderer:qRe,styles:HRe}});var eU,QRe,JRe=z(()=>{"use strict";eU=(function(){var e=o(function(x,b,T,w){for(T=T||{},w=x.length;w--;T[x[w]]=b);return T},"o"),t=[1,4],r=[1,14],i=[1,12],n=[1,13],a=[6,7,8],s=[1,20],l=[1,18],u=[1,19],h=[6,7,11],d=[1,6,13,14],f=[1,23],p=[1,24],m=[1,6,7,11,13,14],g={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(b,T,w,C,k,E,A){var N=E.length-1;switch(k){case 6:case 7:return C;case 15:C.addNode(E[N-1].length,E[N].trim());break;case 16:C.addNode(0,E[N].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:i,14:n},e(a,[2,3]),{1:[2,2]},e(a,[2,4]),e(a,[2,5]),{1:[2,6],6:r,12:15,13:i,14:n},{6:r,9:16,12:11,13:i,14:n},{6:s,7:l,10:17,11:u},e(h,[2,18],{14:[1,21]}),e(h,[2,16]),e(h,[2,17]),{6:s,7:l,10:22,11:u},{1:[2,7],6:r,12:15,13:i,14:n},e(d,[2,14],{7:f,11:p}),e(m,[2,8]),e(m,[2,9]),e(m,[2,10]),e(h,[2,15]),e(d,[2,13],{7:f,11:p}),e(m,[2,11]),e(m,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(b,T){if(T.recoverable)this.trace(b);else{var w=new Error(b);throw w.hash=T,w}},"parseError"),parse:o(function(b){var T=this,w=[0],C=[],k=[null],E=[],A=this.table,N="",P=0,I=0,D=0,_=2,R=1,M=E.slice.call(arguments,1),L=Object.create(this.lexer),B={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(B.yy[O]=this.yy[O]);L.setInput(b,B.yy),B.yy.lexer=L,B.yy.parser=this,typeof L.yylloc>"u"&&(L.yylloc={});var $=L.yylloc;E.push($);var G=L.options&&L.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(De){w.length=w.length-2*De,k.length=k.length-De,E.length=E.length-De}o(F,"popStack");function V(){var De;return De=C.pop()||L.lex()||R,typeof De!="number"&&(De instanceof Array&&(C=De,De=C.pop()),De=T.symbols_[De]||De),De}o(V,"lex");for(var H,j,U,Q,Y,ae,J={},te,re,ee,Te;;){if(U=w[w.length-1],this.defaultActions[U]?Q=this.defaultActions[U]:((H===null||typeof H>"u")&&(H=V()),Q=A[U]&&A[U][H]),typeof Q>"u"||!Q.length||!Q[0]){var ue="";Te=[];for(te in A[U])this.terminals_[te]&&te>_&&Te.push("'"+this.terminals_[te]+"'");L.showPosition?ue="Parse error on line "+(P+1)+`: +`+L.showPosition()+` +Expecting `+Te.join(", ")+", got '"+(this.terminals_[H]||H)+"'":ue="Parse error on line "+(P+1)+": Unexpected "+(H==R?"end of input":"'"+(this.terminals_[H]||H)+"'"),this.parseError(ue,{text:L.match,token:this.terminals_[H]||H,line:L.yylineno,loc:$,expected:Te})}if(Q[0]instanceof Array&&Q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+H);switch(Q[0]){case 1:w.push(H),k.push(L.yytext),E.push(L.yylloc),w.push(Q[1]),H=null,j?(H=j,j=null):(I=L.yyleng,N=L.yytext,P=L.yylineno,$=L.yylloc,D>0&&D--);break;case 2:if(re=this.productions_[Q[1]][1],J.$=k[k.length-re],J._$={first_line:E[E.length-(re||1)].first_line,last_line:E[E.length-1].last_line,first_column:E[E.length-(re||1)].first_column,last_column:E[E.length-1].last_column},G&&(J._$.range=[E[E.length-(re||1)].range[0],E[E.length-1].range[1]]),ae=this.performAction.apply(J,[N,I,P,B.yy,Q[1],k,E].concat(M)),typeof ae<"u")return ae;re&&(w=w.slice(0,-1*re*2),k=k.slice(0,-1*re),E=E.slice(0,-1*re)),w.push(this.productions_[Q[1]][0]),k.push(J.$),E.push(J._$),ee=A[w[w.length-2]][w[w.length-1]],w.push(ee);break;case 3:return!0}}return!0},"parse")},y=(function(){var x={EOF:1,parseError:o(function(T,w){if(this.yy.parser)this.yy.parser.parseError(T,w);else throw new Error(T)},"parseError"),setInput:o(function(b,T){return this.yy=T||this.yy||{},this._input=b,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var b=this._input[0];this.yytext+=b,this.yyleng++,this.offset++,this.match+=b,this.matched+=b;var T=b.match(/(?:\r\n?|\n).*/g);return T?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),b},"input"),unput:o(function(b){var T=b.length,w=b.split(/(?:\r\n?|\n)/g);this._input=b+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-T),this.offset-=T;var C=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),w.length-1&&(this.yylineno-=w.length-1);var k=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:w?(w.length===C.length?this.yylloc.first_column:0)+C[C.length-w.length].length-w[0].length:this.yylloc.first_column-T},this.options.ranges&&(this.yylloc.range=[k[0],k[0]+this.yyleng-T]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(b){this.unput(this.match.slice(b))},"less"),pastInput:o(function(){var b=this.matched.substr(0,this.matched.length-this.match.length);return(b.length>20?"...":"")+b.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var b=this.match;return b.length<20&&(b+=this._input.substr(0,20-b.length)),(b.substr(0,20)+(b.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var b=this.pastInput(),T=new Array(b.length+1).join("-");return b+this.upcomingInput()+` +`+T+"^"},"showPosition"),test_match:o(function(b,T){var w,C,k;if(this.options.backtrack_lexer&&(k={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(k.yylloc.range=this.yylloc.range.slice(0))),C=b[0].match(/(?:\r\n?|\n).*/g),C&&(this.yylineno+=C.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:C?C[C.length-1].length-C[C.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],w=this.performAction.call(this,this.yy,this,T,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),w)return w;if(this._backtrack){for(var E in k)this[E]=k[E];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var b,T,w,C;this._more||(this.yytext="",this.match="");for(var k=this._currentRules(),E=0;ET[0].length)){if(T=w,C=E,this.options.backtrack_lexer){if(b=this.test_match(w,k[E]),b!==!1)return b;if(this._backtrack){T=!1;continue}else return!1}else if(!this.options.flex)break}return T?(b=this.test_match(T,k[C]),b!==!1?b:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var T=this.next();return T||this.lex()},"lex"),begin:o(function(T){this.conditionStack.push(T)},"begin"),popState:o(function(){var T=this.conditionStack.length-1;return T>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(T){return T=this.conditionStack.length-1-Math.abs(T||0),T>=0?this.conditionStack[T]:"INITIAL"},"topState"),pushState:o(function(T){this.begin(T)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(T,w,C,k){var E=k;switch(C){case 0:return 6;case 1:return 8;case 2:return 8;case 3:return 6;case 4:return 7;case 5:return 13;case 6:return 14;case 7:return 11}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:ishikawa-beta\b)/i,/^(?:ishikawa\b)/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:[^\n]+)/i,/^(?:$)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};return x})();g.lexer=y;function v(){this.yy={}}return o(v,"Parser"),v.prototype=g,g.Parser=v,new v})();eU.parser=eU;QRe=eU});var __,eLe=z(()=>{"use strict";Ut();Ir();Ci();__=class{constructor(){this.stack=[];this.clear=this.clear.bind(this),this.addNode=this.addNode.bind(this),this.getRoot=this.getRoot.bind(this)}static{o(this,"IshikawaDB")}clear(){this.root=void 0,this.stack=[],this.baseLevel=void 0,gr()}getRoot(){return this.root}addNode(t,r){let i=vt.sanitizeText(r,ge());if(!this.root){this.root={text:i,children:[]},this.stack=[{level:0,node:this.root}],Ar(i);return}this.baseLevel??=t;let n=t-this.baseLevel+1;for(n<=0&&(n=1);this.stack.length>1&&this.stack[this.stack.length-1].level>=n;)this.stack.pop();let a=this.stack[this.stack.length-1].node,s={text:i,children:[]};a.children.push(s),this.stack.push({level:n,node:s})}getAccTitle(){return kr()}setAccTitle(t){Cr(t)}getAccDescription(){return Sr()}setAccDescription(t){wr(t)}getDiagramTitle(){return Er()}setDiagramTitle(t){Ar(t)}}});var $Et,Py,zEt,GEt,VEt,sLe,tLe,rLe,iLe,WEt,nLe,qEt,UEt,HEt,tU,YEt,jEt,oLe,D_,aLe,By,lLe,cLe=z(()=>{"use strict";Ut();ps();Di();Xt();jt();$Et=14,Py=250,zEt=30,GEt=60,VEt=5,sLe=82*Math.PI/180,tLe=Math.cos(sLe),rLe=Math.sin(sLe),iLe=o((e,t,r)=>{let i=e.node().getBBox(),n=i.width+t*2,a=i.height+t*2;Br(e,a,n,r),e.attr("viewBox",`${i.x-t} ${i.y-t} ${n} ${a}`)},"applyPaddedViewBox"),WEt=o((e,t,r,i)=>{let a=i.db.getRoot();if(!a)return;let s=ge(),{look:l,handDrawnSeed:u,themeVariables:h}=s,d=Za(s.fontSize)[0]??$Et,f=l==="handDrawn",p=a.children??[],m=s.ishikawa?.diagramPadding??20,g=s.ishikawa?.useMaxWidth??!1,y=bi(t),v=y.append("g").attr("class","ishikawa"),x=f?ut.svg(y.node()):void 0,b=x?{roughSvg:x,seed:u??0,lineColor:h?.lineColor??"#333",fillColor:h?.mainBkg??"#fff"}:void 0,T=`ishikawa-arrow-${t}`;f||v.append("defs").append("marker").attr("id",T).attr("viewBox","0 0 10 10").attr("refX",0).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 Z").attr("class","ishikawa-arrow");let w=0,C=Py,k=f?void 0:By(v,w,C,w,C,"ishikawa-spine");if(qEt(v,w,C,a.text,d,b),!p.length){f&&By(v,w,C,w,C,"ishikawa-spine",b),iLe(y,m,g);return}w-=20;let E=p.filter((L,B)=>B%2===0),A=p.filter((L,B)=>B%2===1),N=nLe(E),P=nLe(A),I=N.total+P.total,D=Py,_=Py;if(I>0){let L=Py*2,B=Py*.3;D=Math.max(B,L*(N.total/I)),_=Math.max(B,L*(P.total/I))}let R=d*2;D=Math.max(D,N.max*R),_=Math.max(_,P.max*R),C=Math.max(D,Py),k&&k.attr("y1",C).attr("y2",C),v.select(".ishikawa-head-group").attr("transform",`translate(0,${C})`);let M=Math.ceil(p.length/2);for(let L=0;LMath.min(O,$.getBBox().x),1/0)}if(f)By(v,w,C,0,C,"ishikawa-spine",b);else{k.attr("x1",w);let L=`url(#${T})`;v.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start",L)}iLe(y,m,g)},"draw"),nLe=o(e=>{let t=o(r=>r.children.reduce((i,n)=>i+1+t(n),0),"countDescendants");return e.reduce((r,i)=>{let n=t(i);return r.total+=n,r.max=Math.max(r.max,n),r},{total:0,max:0})},"sideStats"),qEt=o((e,t,r,i,n,a)=>{let s=Math.max(6,Math.floor(110/(n*.6))),l=e.append("g").attr("class","ishikawa-head-group").attr("transform",`translate(${t},${r})`),u=D_(l,oLe(i,s),0,0,"ishikawa-head-label","start",n),h=u.node().getBBox(),d=Math.max(60,h.width+6),f=Math.max(40,h.height*2+40),p=`M 0 ${-f/2} L 0 ${f/2} Q ${d*2.4} 0 0 ${-f/2} Z`;if(a){let m=a.roughSvg.path(p,{roughness:1.5,seed:a.seed,fill:a.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:a.lineColor,strokeWidth:2});l.insert(()=>m,":first-child").attr("class","ishikawa-head")}else l.insert("path",":first-child").attr("class","ishikawa-head").attr("d",p);u.attr("transform",`translate(${(d-h.width)/2-h.x+3},${-h.y-h.height/2})`)},"drawHead"),UEt=o((e,t)=>{let r=[],i=[],n=o((a,s,l)=>{let u=t===-1?[...a].reverse():a;for(let h of u){let d=r.length,f=h.children??[];r.push({depth:l,text:oLe(h.text,15),parentIndex:s,childCount:f.length}),l%2===0?(i.push(d),f.length&&n(f,d,l+1)):(f.length&&n(f,d,l+1),i.push(d))}},"walk");return n(e,-1,2),{entries:r,yOrder:i}},"flattenTree"),HEt=o((e,t,r,i,n,a,s)=>{let l=e.append("g").attr("class","ishikawa-label-group"),h=D_(l,t,r,i+11*n,"ishikawa-label cause","middle",a).node().getBBox();if(s){let d=s.roughSvg.rectangle(h.x-20,h.y-2,h.width+40,h.height+4,{roughness:1.5,seed:s.seed,fill:s.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:s.lineColor,strokeWidth:2});l.insert(()=>d,":first-child").attr("class","ishikawa-label-box")}else l.insert("rect",":first-child").attr("class","ishikawa-label-box").attr("x",h.x-20).attr("y",h.y-2).attr("width",h.width+40).attr("height",h.height+4)},"drawCauseLabel"),tU=o((e,t,r,i,n,a)=>{let s=Math.sqrt(i*i+n*n);if(s===0)return;let l=i/s,u=n/s,h=6,d=-u*h,f=l*h,p=t,m=r,g=`M ${p} ${m} L ${p-l*h*2+d} ${m-u*h*2+f} L ${p-l*h*2-d} ${m-u*h*2-f} Z`,y=a.roughSvg.path(g,{roughness:1,seed:a.seed,fill:a.lineColor,fillStyle:"solid",stroke:a.lineColor,strokeWidth:1});e.append(()=>y)},"drawArrowMarker"),YEt=o((e,t,r,i,n,a,s,l)=>{let u=t.children??[],h=a*(u.length?1:.2),d=-tLe*h,f=rLe*h*n,p=r+d,m=i+f;if(By(e,r,i,p,m,"ishikawa-branch",l),l&&tU(e,r,i,r-p,i-m,l),HEt(e,t.text,p,m,n,s,l),!u.length)return;let{entries:g,yOrder:y}=UEt(u,n),v=g.length,x=new Array(v);for(let[k,E]of y.entries())x[E]=i+f*((k+1)/(v+1));let b=new Map;b.set(-1,{x0:r,y0:i,x1:p,y1:m,childCount:u.length,childrenDrawn:0});let T=-tLe,w=rLe*n,C=n<0?"ishikawa-label up":"ishikawa-label down";for(let[k,E]of g.entries()){let A=x[k],N=b.get(E.parentIndex),P=e.append("g").attr("class","ishikawa-sub-group"),I=0,D=0,_=0;if(E.depth%2===0){let R=N.y1-N.y0;I=aLe(N.x0,N.x1,R?(A-N.y0)/R:.5),D=A,_=I-(E.childCount>0?GEt+E.childCount*VEt:zEt),By(P,I,A,_,A,"ishikawa-sub-branch",l),l&&tU(P,I,A,1,0,l),D_(P,E.text,_,A,"ishikawa-label align","end",s)}else{let R=N.childrenDrawn++;I=aLe(N.x0,N.x1,(N.childCount-R)/(N.childCount+1)),D=N.y0,_=I+T*((A-D)/w),By(P,I,D,_,A,"ishikawa-sub-branch",l),l&&tU(P,I,D,I-_,D-A,l),D_(P,E.text,_,A,C,"end",s)}E.childCount>0&&b.set(k,{x0:I,y0:D,x1:_,y1:A,childCount:E.childCount,childrenDrawn:0})}},"drawBranch"),jEt=o(e=>e.split(/|\n/),"splitLines"),oLe=o((e,t)=>{if(e.length<=t)return e;let r=[];for(let i of e.split(/\s+/)){let n=r.length-1;n>=0&&r[n].length+1+i.length<=t?r[n]+=" "+i:r.push(i)}return r.join(` +`)},"wrapText"),D_=o((e,t,r,i,n,a,s)=>{let l=jEt(t),u=s*1.05,h=e.append("text").attr("class",n).attr("text-anchor",a).attr("x",r).attr("y",i-(l.length-1)*u/2);for(let[d,f]of l.entries())h.append("tspan").attr("x",r).attr("dy",d===0?0:u).text(f);return h},"drawMultilineText"),aLe=o((e,t,r)=>e+(t-e)*r,"lerp"),By=o((e,t,r,i,n,a,s)=>{if(s){let l=s.roughSvg.line(t,r,i,n,{roughness:1.5,seed:s.seed,stroke:s.lineColor,strokeWidth:2});e.append(()=>l).attr("class",a);return}return e.append("line").attr("class",a).attr("x1",t).attr("y1",r).attr("x2",i).attr("y2",n)},"drawLine"),lLe={draw:WEt}});var XEt,uLe,hLe=z(()=>{"use strict";XEt=o(e=>` +.ishikawa .ishikawa-spine, +.ishikawa .ishikawa-branch, +.ishikawa .ishikawa-sub-branch { + stroke: ${e.lineColor}; + stroke-width: 2; + fill: none; +} + +.ishikawa .ishikawa-sub-branch { + stroke-width: 1; +} + +.ishikawa .ishikawa-arrow { + fill: ${e.lineColor}; +} + +.ishikawa .ishikawa-head { + fill: ${e.mainBkg}; + stroke: ${e.lineColor}; + stroke-width: 2; +} + +.ishikawa .ishikawa-label-box { + fill: ${e.mainBkg}; + stroke: ${e.lineColor}; + stroke-width: 2; +} + +.ishikawa text { + font-family: ${e.fontFamily}; + font-size: ${e.fontSize}; + fill: ${e.textColor}; +} + +.ishikawa .ishikawa-head-label { + font-weight: 600; + text-anchor: middle; + dominant-baseline: middle; + font-size: 14px; +} + +.ishikawa .ishikawa-label { + text-anchor: end; +} + +.ishikawa .ishikawa-label.cause { + text-anchor: middle; + dominant-baseline: middle; +} + +.ishikawa .ishikawa-label.align { + text-anchor: end; + dominant-baseline: middle; +} + +.ishikawa .ishikawa-label.up { + dominant-baseline: baseline; +} + +.ishikawa .ishikawa-label.down { + dominant-baseline: hanging; +} +`,"getStyles"),uLe=XEt});var dLe={};xr(dLe,{diagram:()=>KEt});var KEt,fLe=z(()=>{"use strict";JRe();eLe();cLe();hLe();KEt={parser:QRe,get db(){return new __},renderer:lLe,styles:uLe}});var rU,gLe,yLe=z(()=>{"use strict";rU=(function(){var e=o(function(b,T,w,C){for(w=w||{},C=b.length;C--;w[b[C]]=T);return w},"o"),t=[5,8],r=[7,8,11,12,17,19,22,24],i=[1,17],n=[1,18],a=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],s=[1,31],l=[1,39],u=[7,8,11,12,17,19,22,24,27],h=[1,57],d=[1,56],f=[1,58],p=[1,59],m=[1,60],g=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],y={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:o(function(T,w,C,k,E,A,N){var P=A.length-1;switch(E){case 1:return A[P-1];case 2:case 3:case 4:this.$=[];break;case 5:A[P-1].push(A[P]),this.$=A[P-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=A[P];break;case 8:k.setDiagramTitle(A[P].substr(6)),this.$=A[P].substr(6);break;case 9:k.addSubsetData([A[P]],void 0,void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 10:k.addSubsetData([A[P-1]],A[P],void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 11:k.addSubsetData([A[P-2]],void 0,parseFloat(A[P])),k.setIndentMode&&k.setIndentMode(!0);break;case 12:k.addSubsetData([A[P-3]],A[P-2],parseFloat(A[P])),k.setIndentMode&&k.setIndentMode(!0);break;case 13:if(A[P].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(A[P]),k.addSubsetData(A[P],void 0,void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 14:if(A[P-1].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(A[P-1]),k.addSubsetData(A[P-1],A[P],void 0),k.setIndentMode&&k.setIndentMode(!0);break;case 15:if(A[P-2].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(A[P-2]),k.addSubsetData(A[P-2],void 0,parseFloat(A[P])),k.setIndentMode&&k.setIndentMode(!0);break;case 16:if(A[P-3].length<2)throw new Error("union requires multiple identifiers");k.validateUnionIdentifiers&&k.validateUnionIdentifiers(A[P-3]),k.addSubsetData(A[P-3],A[P-2],parseFloat(A[P])),k.setIndentMode&&k.setIndentMode(!0);break;case 17:case 18:case 19:k.addTextData(A[P-1],A[P],void 0);break;case 20:case 21:k.addTextData(A[P-2],A[P-1],A[P]);break;case 23:k.addStyleData(A[P-1],A[P]);break;case 24:case 25:case 26:var I=k.getCurrentSets();if(!I)throw new Error("text requires set");k.addTextData(I,A[P],void 0);break;case 27:case 28:var I=k.getCurrentSets();if(!I)throw new Error("text requires set");k.addTextData(I,A[P-1],A[P]);break;case 29:case 41:this.$=[A[P]];break;case 30:case 42:this.$=[...A[P-2],A[P]];break;case 31:this.$=[A[P-2],A[P]];break;case 33:this.$=A[P].join(" ");break;case 34:this.$=[A[P]];break;case 35:A[P-1].push(A[P]),this.$=A[P-1];break;case 43:case 44:this.$=A[P];break}},"anonymous"),table:[e(t,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},e(r,[2,4],{6:5}),e(t,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},e(r,[2,5]),e(r,[2,6]),e(r,[2,7]),e(r,[2,8]),{13:16,20:i,21:n},{13:20,18:19,20:i,21:n},{13:20,18:21,20:i,21:n},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:i,21:n},e(r,[2,9],{14:[1,27],15:[1,28]}),e(a,[2,43]),e(a,[2,44]),e(r,[2,13],{14:[1,29],15:[1,30],27:s}),e(a,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:s},e(r,[2,22]),e(r,[2,24],{14:[1,35]}),e(r,[2,25],{14:[1,36]}),e(r,[2,26]),{20:l,25:37,26:38,27:s},e(r,[2,10],{15:[1,40]}),{16:[1,41]},e(r,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:i,21:n},e(r,[2,17],{14:[1,45]}),e(r,[2,18],{14:[1,46]}),e(r,[2,19]),e(r,[2,27]),e(r,[2,28]),e(r,[2,23],{27:[1,47]}),e(u,[2,29]),{15:[1,48]},{16:[1,49]},e(r,[2,11]),{16:[1,50]},e(r,[2,15]),e(a,[2,42]),e(r,[2,20]),e(r,[2,21]),{20:l,26:51},{16:h,20:d,21:[1,53],28:52,29:54,30:55,31:f,32:p,33:m},e(r,[2,12]),e(r,[2,16]),e(u,[2,30]),e(u,[2,31]),e(u,[2,32]),e(u,[2,33],{30:61,16:h,20:d,31:f,32:p,33:m}),e(g,[2,34]),e(g,[2,36]),e(g,[2,37]),e(g,[2,38]),e(g,[2,39]),e(g,[2,40]),e(g,[2,35])],defaultActions:{6:[2,1]},parseError:o(function(T,w){if(w.recoverable)this.trace(T);else{var C=new Error(T);throw C.hash=w,C}},"parseError"),parse:o(function(T){var w=this,C=[0],k=[],E=[null],A=[],N=this.table,P="",I=0,D=0,_=0,R=2,M=1,L=A.slice.call(arguments,1),B=Object.create(this.lexer),O={yy:{}};for(var $ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,$)&&(O.yy[$]=this.yy[$]);B.setInput(T,O.yy),O.yy.lexer=B,O.yy.parser=this,typeof B.yylloc>"u"&&(B.yylloc={});var G=B.yylloc;A.push(G);var F=B.options&&B.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function V(Ie){C.length=C.length-2*Ie,E.length=E.length-Ie,A.length=A.length-Ie}o(V,"popStack");function H(){var Ie;return Ie=k.pop()||B.lex()||M,typeof Ie!="number"&&(Ie instanceof Array&&(k=Ie,Ie=k.pop()),Ie=w.symbols_[Ie]||Ie),Ie}o(H,"lex");for(var j,U,Q,Y,ae,J,te={},re,ee,Te,ue;;){if(Q=C[C.length-1],this.defaultActions[Q]?Y=this.defaultActions[Q]:((j===null||typeof j>"u")&&(j=H()),Y=N[Q]&&N[Q][j]),typeof Y>"u"||!Y.length||!Y[0]){var De="";ue=[];for(re in N[Q])this.terminals_[re]&&re>R&&ue.push("'"+this.terminals_[re]+"'");B.showPosition?De="Parse error on line "+(I+1)+`: +`+B.showPosition()+` +Expecting `+ue.join(", ")+", got '"+(this.terminals_[j]||j)+"'":De="Parse error on line "+(I+1)+": Unexpected "+(j==M?"end of input":"'"+(this.terminals_[j]||j)+"'"),this.parseError(De,{text:B.match,token:this.terminals_[j]||j,line:B.yylineno,loc:G,expected:ue})}if(Y[0]instanceof Array&&Y.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Q+", token: "+j);switch(Y[0]){case 1:C.push(j),E.push(B.yytext),A.push(B.yylloc),C.push(Y[1]),j=null,U?(j=U,U=null):(D=B.yyleng,P=B.yytext,I=B.yylineno,G=B.yylloc,_>0&&_--);break;case 2:if(ee=this.productions_[Y[1]][1],te.$=E[E.length-ee],te._$={first_line:A[A.length-(ee||1)].first_line,last_line:A[A.length-1].last_line,first_column:A[A.length-(ee||1)].first_column,last_column:A[A.length-1].last_column},F&&(te._$.range=[A[A.length-(ee||1)].range[0],A[A.length-1].range[1]]),J=this.performAction.apply(te,[P,D,I,O.yy,Y[1],E,A].concat(L)),typeof J<"u")return J;ee&&(C=C.slice(0,-1*ee*2),E=E.slice(0,-1*ee),A=A.slice(0,-1*ee)),C.push(this.productions_[Y[1]][0]),E.push(te.$),A.push(te._$),Te=N[C[C.length-2]][C[C.length-1]],C.push(Te);break;case 3:return!0}}return!0},"parse")},v=(function(){var b={EOF:1,parseError:o(function(w,C){if(this.yy.parser)this.yy.parser.parseError(w,C);else throw new Error(w)},"parseError"),setInput:o(function(T,w){return this.yy=w||this.yy||{},this._input=T,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var T=this._input[0];this.yytext+=T,this.yyleng++,this.offset++,this.match+=T,this.matched+=T;var w=T.match(/(?:\r\n?|\n).*/g);return w?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),T},"input"),unput:o(function(T){var w=T.length,C=T.split(/(?:\r\n?|\n)/g);this._input=T+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-w),this.offset-=w;var k=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),C.length-1&&(this.yylineno-=C.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:C?(C.length===k.length?this.yylloc.first_column:0)+k[k.length-C.length].length-C[0].length:this.yylloc.first_column-w},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-w]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(T){this.unput(this.match.slice(T))},"less"),pastInput:o(function(){var T=this.matched.substr(0,this.matched.length-this.match.length);return(T.length>20?"...":"")+T.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var T=this.match;return T.length<20&&(T+=this._input.substr(0,20-T.length)),(T.substr(0,20)+(T.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var T=this.pastInput(),w=new Array(T.length+1).join("-");return T+this.upcomingInput()+` +`+w+"^"},"showPosition"),test_match:o(function(T,w){var C,k,E;if(this.options.backtrack_lexer&&(E={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(E.yylloc.range=this.yylloc.range.slice(0))),k=T[0].match(/(?:\r\n?|\n).*/g),k&&(this.yylineno+=k.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:k?k[k.length-1].length-k[k.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+T[0].length},this.yytext+=T[0],this.match+=T[0],this.matches=T,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(T[0].length),this.matched+=T[0],C=this.performAction.call(this,this.yy,this,w,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),C)return C;if(this._backtrack){for(var A in E)this[A]=E[A];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var T,w,C,k;this._more||(this.yytext="",this.match="");for(var E=this._currentRules(),A=0;Aw[0].length)){if(w=C,k=A,this.options.backtrack_lexer){if(T=this.test_match(C,E[A]),T!==!1)return T;if(this._backtrack){w=!1;continue}else return!1}else if(!this.options.flex)break}return w?(T=this.test_match(w,E[k]),T!==!1?T:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. +`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var w=this.next();return w||this.lex()},"lex"),begin:o(function(w){this.conditionStack.push(w)},"begin"),popState:o(function(){var w=this.conditionStack.length-1;return w>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(w){return w=this.conditionStack.length-1-Math.abs(w||0),w>=0?this.conditionStack[w]:"INITIAL"},"topState"),pushState:o(function(w){this.begin(w)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(w,C,k,E){var A=E;switch(k){case 0:break;case 1:break;case 2:break;case 3:if(w.getIndentMode&&w.getIndentMode())return w.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:w.setIndentMode&&w.setIndentMode(!1),this.begin("INITIAL"),this.unput(C.yytext);break;case 6:return this.begin("bol"),8;break;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(w.consumeIndentText)w.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return C.yytext=C.yytext.slice(2,-2),14;break;case 17:return C.yytext=C.yytext.slice(1,-1).trim(),14;break;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return b})();y.lexer=v;function x(){this.yy={}}return o(x,"Parser"),x.prototype=y,y.Parser=x,new x})();rU.parser=rU;gLe=rU});function h5t(){return Gr(u5t,Nt().venn)}var iU,nU,aU,sU,oU,lU,JEt,e5t,pC,t5t,r5t,i5t,n5t,R_,a5t,s5t,o5t,l5t,c5t,u5t,d5t,vLe,xLe=z(()=>{"use strict";Xt();br();Ci();Bn();iU=[],nU=[],aU=[],sU=new Set,lU=!1,JEt=o((e,t,r)=>{let i=R_(e).sort(),n=r??10/Math.pow(e.length,2);oU=i,i.length===1&&sU.add(i[0]),iU.push({sets:i,size:n,label:t?pC(t):void 0})},"addSubsetData"),e5t=o(()=>iU,"getSubsetData"),pC=o(e=>{let t=e.trim();return t.length>=2&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t},"normalizeText"),t5t=o(e=>e&&pC(e),"normalizeStyleValue"),r5t=o((e,t,r)=>{let i=pC(t);nU.push({sets:R_(e).sort(),id:i,label:r?pC(r):void 0})},"addTextData"),i5t=o((e,t)=>{let r=R_(e).sort(),i={};for(let[n,a]of t)i[n]=t5t(a)??a;aU.push({targets:r,styles:i})},"addStyleData"),n5t=o(()=>aU,"getStyleData"),R_=o(e=>e.map(t=>pC(t)),"normalizeIdentifierList"),a5t=o(e=>{let r=R_(e).filter(i=>!sU.has(i));if(r.length>0)throw new Error(`unknown set identifier: ${r.join(", ")}`)},"validateUnionIdentifiers"),s5t=o(()=>nU,"getTextData"),o5t=o(()=>oU,"getCurrentSets"),l5t=o(()=>lU,"getIndentMode"),c5t=o(e=>{lU=e},"setIndentMode"),u5t=or.venn;o(h5t,"getConfig");d5t=o(()=>{gr(),iU.length=0,nU.length=0,aU.length=0,sU.clear(),oU=void 0,lU=!1},"customClear"),vLe={getConfig:h5t,clear:d5t,setAccTitle:Cr,getAccTitle:kr,setDiagramTitle:Ar,getDiagramTitle:Er,getAccDescription:Sr,setAccDescription:wr,addSubsetData:JEt,getSubsetData:e5t,addTextData:r5t,addStyleData:i5t,validateUnionIdentifiers:a5t,getTextData:s5t,getStyleData:n5t,getCurrentSets:o5t,getIndentMode:l5t,setIndentMode:c5t}});var f5t,bLe,TLe=z(()=>{"use strict";f5t=o(e=>` + .venn-title { + font-size: 32px; + fill: ${e.vennTitleTextColor}; + font-family: ${e.fontFamily}; + } + + .venn-circle text { + font-size: 48px; + font-family: ${e.fontFamily}; + } + + .venn-intersection text { + font-size: 48px; + fill: ${e.vennSetTextColor}; + font-family: ${e.fontFamily}; + } + + .venn-text-node { + font-family: ${e.fontFamily}; + color: ${e.vennSetTextColor}; + } +`,"getStyles"),bLe=f5t});function L_(e,t){let r=m5t(e),i=r.filter(l=>p5t(l,e)),n=0,a=0,s=[];if(i.length>1){let l=SLe(i);for(let h=0;hd.angle-h.angle);let u=i[i.length-1];for(let h=0;hg.radius*2&&(T=g.radius*2),(p==null||p.width>T)&&(p={circle:g,width:T,p1:d,p2:u,large:T>g.radius,sweep:!0})}p!=null&&(s.push(p),n+=hU(p.circle.radius,p.width),u=d)}}else{let l=e[0];for(let h=1;hMath.abs(l.radius-e[h].radius)){u=!0;break}u?n=a=0:(n=l.radius*l.radius*Math.PI,s.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-1e-10,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return a/=2,t&&(t.area=n+a,t.arcArea=n,t.polygonArea=a,t.arcs=s,t.innerPoints=i,t.intersectionPoints=r),n+a}function p5t(e,t){return t.every(r=>Xs(e,r)=e+t)return 0;if(r<=Math.abs(e-t))return Math.PI*Math.min(e,t)*Math.min(e,t);let i=e-(r*r-t*t+e*e)/(2*r),n=t-(r*r-e*e+t*t)/(2*r);return hU(e,i)+hU(t,n)}function wLe(e,t){let r=Xs(e,t),i=e.radius,n=t.radius;if(r>=i+n||r<=Math.abs(i-n))return[];let a=(i*i-n*n+r*r)/(2*r),s=Math.sqrt(i*i-a*a),l=e.x+a*(t.x-e.x)/r,u=e.y+a*(t.y-e.y)/r,h=-(t.y-e.y)*(s/r),d=-(t.x-e.x)*(s/r);return[{x:l+h,y:u-d},{x:l-h,y:u+d}]}function SLe(e){let t={x:0,y:0};for(let r of e)t.x+=r.x,t.y+=r.y;return t.x/=e.length,t.y/=e.length,t}function g5t(e,t,r,i){i=i||{};let n=i.maxIterations||100,a=i.tolerance||1e-10,s=e(t),l=e(r),u=r-t;if(s*l>0)throw"Initial bisect points must have opposite signs";if(s===0)return t;if(l===0)return r;for(let h=0;h=0&&(t=d),Math.abs(u)dU(t))}function Fy(e,t){let r=0;for(let i=0;iC.fx-k.fx,"sortOrder"),x=t.slice(),b=t.slice(),T=t.slice(),w=t.slice();for(let C=0;C{let N=A.slice();return N.fx=A.fx,N.id=A.id,N});E.sort((A,N)=>A.id-N.id),r.history.push({x:g[0].slice(),fx:g[0].fx,simplex:E})}p=0;for(let E=0;E=g[m-1].fx){let E=!1;if(b.fx>k.fx?(Rh(T,1+d,x,-d,k),T.fx=e(T),T.fx=1)break;for(let A=1;Al+a*n*u||h>=v)y=n;else{if(Math.abs(f)<=-s*u)return n;f*(y-g)>=0&&(y=g),g=n,v=h}return 0}o(m,"zoom");for(let g=0;g<10;++g){if(Rh(i.x,1,r.x,n,t),h=i.fx=e(i.x,i.fxprime),f=Fy(i.fxprime,t),h>l+a*n*u||g&&h>=d)return m(p,n,d);if(Math.abs(f)<=-s*u)return n;if(f>=0)return m(n,p,h);d=h,p=n,n*=2}return n}function v5t(e,t,r){let i={x:t.slice(),fx:0,fxprime:t.slice()},n={x:t.slice(),fx:0,fxprime:t.slice()},a=t.slice(),s,l,u=1,h;r=r||{},h=r.maxIterations||t.length*20,i.fx=e(i.x,i.fxprime),s=i.fxprime.slice(),pU(s,i.fxprime,-1);for(let d=0;d{let f={};for(let p=0;pyU(e,t,i)-r,0,e+t)}function x5t(e,t={}){let r=t.distinct,i=e.map(l=>Object.assign({},l));function n(l){return l.join(";")}if(o(n,"toKey"),r){let l=new Map;for(let u of i)for(let h=0;hl===u?0:la.sets.length===2).forEach(a=>{let s=r[a.sets[0]],l=r[a.sets[1]],u=Math.sqrt(t[s].size/Math.PI),h=Math.sqrt(t[l].size/Math.PI),d=mU(u,h,a.size);i[s][l]=i[l][s]=d;let f=0;a.size+1e-10>=Math.min(t[s].size,t[l].size)?f=1:a.size<=1e-10&&(f=-1),n[s][l]=n[l][s]=f}),{distances:i,constraints:n}}function T5t(e,t,r,i){for(let a=0;a0&&g<=f||p<0&&g>=f||(n+=2*y*y,t[2*a]+=4*y*(s-h),t[2*a+1]+=4*y*(l-d),t[2*u]+=4*y*(h-s),t[2*u+1]+=4*y*(d-l))}}return n}function C5t(e,t={}){let r=w5t(e,t),i=t.lossFunction||$y;if(e.length>=8){let n=k5t(e,t),a=i(n,e),s=i(r,e);a+1e-8p.map(m=>m/l));let u=o((p,m)=>T5t(p,m,a,s),"obj"),h=null;for(let p=0;pf.sets.length===2);for(let f of e){let p=f.weight!=null?f.weight:1,m=f.sets[0],g=f.sets[1];f.size+_Le>=Math.min(i[m].size,i[g].size)&&(p=0),n[m].push({set:g,size:f.size,weight:p}),n[g].push({set:m,size:f.size,weight:p})}let a=[];Object.keys(n).forEach(f=>{let p=0;for(let m=0;me[s]));let a=i.weight!=null?i.weight:1;r+=a*(n-i.size)*(n-i.size)}return r}function DLe(e,t){let r=0;for(let i of t){if(i.sets.length===1)continue;let n;if(i.sets.length===2){let l=e[i.sets[0]],u=e[i.sets[1]];n=yU(l.radius,u.radius,Xs(l,u))}else n=L_(i.sets.map(l=>e[l]));let a=i.weight!=null?i.weight:1,s=Math.log((n+1)/(i.size+1));r+=a*s*s}return r}function S5t(e,t,r){if(r==null?e.sort((n,a)=>a.radius-n.radius):e.sort(r),e.length>0){let n=e[0].x,a=e[0].y;for(let s of e)s.x-=n,s.y-=a}if(e.length===2&&Xs(e[0],e[1])1){let n=Math.atan2(e[1].x,e[1].y)-t,a=Math.cos(n),s=Math.sin(n);for(let l of e){let u=l.x,h=l.y;l.x=a*u-s*h,l.y=s*u+a*h}}if(e.length>2){let n=Math.atan2(e[2].x,e[2].y)-t;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){let a=e[1].y/(1e-10+e[1].x);for(let s of e){var i=(s.x+a*s.y)/(1+a*a);s.x=2*i-s.x,s.y=2*i*a-s.y}}}}function E5t(e){e.forEach(n=>{n.parent=n});function t(n){return n.parent!==n&&(n.parent=t(n.parent)),n.parent}o(t,"find");function r(n,a){let s=t(n),l=t(a);s.parent=l}o(r,"union");for(let n=0;n{delete n.parent}),Array.from(i.values())}function gU(e){let t=o(r=>{let i=e.reduce((a,s)=>Math.max(a,s[r]+s.radius),Number.NEGATIVE_INFINITY),n=e.reduce((a,s)=>Math.min(a,s[r]-s.radius),Number.POSITIVE_INFINITY);return{max:i,min:n}},"minMax");return{xRange:t("x"),yRange:t("y")}}function RLe(e,t,r){t==null&&(t=Math.PI/2);let i=NLe(e).map(h=>Object.assign({},h)),n=E5t(i);for(let h of n){S5t(h,t,r);let d=gU(h);h.size=(d.xRange.max-d.xRange.min)*(d.yRange.max-d.yRange.min),h.bounds=d}n.sort((h,d)=>d.size-h.size),i=n[0];let a=i.bounds,s=(a.xRange.max-a.xRange.min)/50;function l(h,d,f){if(!h)return;let p=h.bounds,m,g;if(d)m=a.xRange.max-p.xRange.min+s;else{m=a.xRange.max-p.xRange.max;let y=(p.xRange.max-p.xRange.min)/2-(a.xRange.max-a.xRange.min)/2;y<0&&(m+=y)}if(f)g=a.yRange.max-p.yRange.min+s;else{g=a.yRange.max-p.yRange.max;let y=(p.yRange.max-p.yRange.min)/2-(a.yRange.max-a.yRange.min)/2;y<0&&(g+=y)}for(let y of h)y.x+=m,y.y+=g,i.push(y)}o(l,"addCluster");let u=1;for(;u({radius:d*m.radius,x:i+f+(m.x-s.min)*d,y:i+p+(m.y-l.min)*d,setid:m.setid})))}function MLe(e){let t={};for(let r of e)t[r.setid]=r;return t}function NLe(e){return Object.keys(e).map(r=>Object.assign(e[r],{setid:r}))}function ILe(e={}){let t=!1,r=600,i=350,n=15,a=1e3,s=Math.PI/2,l=!0,u=null,h=!0,d=!0,f=null,p=null,m=!1,g=null,y=e&&e.symmetricalTextCentre?e.symmetricalTextCentre:!1,v={},x=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],b=0,T=o(function(E){if(E in v)return v[E];var A=v[E]=x[b];return b+=1,b>=x.length&&(b=0),A},"colours"),w=ALe,C=$y;function k(E){let A=E.datum(),N=new Set;A.forEach(Y=>{Y.size==0&&Y.sets.length==1&&N.add(Y.sets[0])}),A=A.filter(Y=>!Y.sets.some(ae=>N.has(ae)));let P={},I={};if(A.length>0){let Y=w(A,{lossFunction:C,distinct:m});l&&(Y=RLe(Y,s,p)),P=LLe(Y,r,i,n,u),I=PLe(P,A,y)}let D={};A.forEach(Y=>{Y.label&&(D[Y.sets]=Y.label)});function _(Y){if(Y.sets in D)return D[Y.sets];if(Y.sets.length==1)return""+Y.sets[0]}o(_,"label"),E.selectAll("svg").data([P]).enter().append("svg");let R=E.select("svg");t?R.attr("viewBox",`0 0 ${r} ${i}`):R.attr("width",r).attr("height",i);let M={},L=!1;R.selectAll(".venn-area path").each(function(Y){let ae=this.getAttribute("d");Y.sets.length==1&&ae&&!m&&(L=!0,M[Y.sets[0]]=D5t(ae))});function B(Y){return ae=>{let J=Y.sets.map(te=>{let re=M[te],ee=P[te];return re||(re={x:r/2,y:i/2,radius:1}),ee||(ee={x:r/2,y:i/2,radius:1}),{x:re.x*(1-ae)+ee.x*ae,y:re.y*(1-ae)+ee.y*ae,radius:re.radius*(1-ae)+ee.radius*ae}});return kLe(J,g)}}o(B,"pathTween");let O=R.selectAll(".venn-area").data(A,Y=>Y.sets),$=O.enter().append("g").attr("class",Y=>`venn-area venn-${Y.sets.length==1?"circle":"intersection"}${Y.colour||Y.color?" venn-coloured":""}`).attr("data-venn-sets",Y=>Y.sets.join("_")),G=$.append("path"),F=$.append("text").attr("class","label").text(Y=>_(Y)).attr("text-anchor","middle").attr("dy",".35em").attr("x",r/2).attr("y",i/2);d&&(G.style("fill-opacity","0").filter(Y=>Y.sets.length==1).style("fill",Y=>Y.colour?Y.colour:Y.color?Y.color:T(Y.sets)).style("fill-opacity",".25"),F.style("fill",Y=>Y.colour||Y.color?"#FFF":e.textFill?e.textFill:Y.sets.length==1?T(Y.sets):"#444"));function V(Y){return typeof Y.transition=="function"?Y.transition("venn").duration(a):Y}o(V,"asTransition");let H=E;L&&typeof H.transition=="function"?(H=V(E),H.selectAll("path").attrTween("d",B)):H.selectAll("path").attr("d",Y=>kLe(Y.sets.map(ae=>P[ae])),g);let j=H.selectAll("text").filter(Y=>Y.sets in I).text(Y=>_(Y)).attr("x",Y=>Math.floor(I[Y.sets].x)).attr("y",Y=>Math.floor(I[Y.sets].y));h&&(L?"on"in j?j.on("end",cU(P,_)):j.each("end",cU(P,_)):j.each(cU(P,_)));let U=V(O.exit()).remove();typeof O.transition=="function"&&U.selectAll("path").attrTween("d",B);let Q=U.selectAll("text").attr("x",r/2).attr("y",i/2);return f!==null&&(F.style("font-size","0px"),j.style("font-size",f),Q.style("font-size","0px")),{circles:P,textCentres:I,nodes:O,enter:$,update:H,exit:U}}return o(k,"chart"),k.wrap=function(E){return arguments.length?(h=E,k):h},k.useViewBox=function(){return t=!0,k},k.width=function(E){return arguments.length?(r=E,k):r},k.height=function(E){return arguments.length?(i=E,k):i},k.padding=function(E){return arguments.length?(n=E,k):n},k.distinct=function(E){return arguments.length?(m=E,k):m},k.colours=function(E){return arguments.length?(T=E,k):T},k.colors=function(E){return arguments.length?(T=E,k):T},k.fontSize=function(E){return arguments.length?(f=E,k):f},k.round=function(E){return arguments.length?(g=E,k):g},k.duration=function(E){return arguments.length?(a=E,k):a},k.layoutFunction=function(E){return arguments.length?(w=E,k):w},k.normalize=function(E){return arguments.length?(l=E,k):l},k.scaleToFit=function(E){return arguments.length?(u=E,k):u},k.styled=function(E){return arguments.length?(d=E,k):d},k.orientation=function(E){return arguments.length?(s=E,k):s},k.orientationOrder=function(E){return arguments.length?(p=E,k):p},k.lossFunction=function(E){return arguments.length?(C=E==="default"?$y:E==="logRatio"?DLe:E,k):C},k}function cU(e,t){return function(r){let i=this,n=e[r.sets[0]].radius||50,a=t(r)||"",s=a.split(/\s+/).reverse(),u=(a.length+s.length)/3,h=s.pop(),d=[h],f=0,p=1.1;i.textContent=null;let m=[];function g(T){let w=i.ownerDocument.createElementNS(i.namespaceURI,"tspan");return w.textContent=T,m.push(w),i.append(w),w}o(g,"append");let y=g(h);for(;h=s.pop(),!!h;){d.push(h);let T=d.join(" ");y.textContent=T,T.length>u&&y.getComputedTextLength()>n&&(d.pop(),y.textContent=d.join(" "),d=[h],y=g(h),f++)}let v=.35-f*p/2,x=i.getAttribute("x"),b=i.getAttribute("y");m.forEach((T,w)=>{T.setAttribute("x",x),T.setAttribute("y",b),T.setAttribute("dy",`${v+w*p}em`)})}}function uU(e,t,r){let i=t[0].radius-Xs(t[0],e);for(let n=1;n=a&&(n=i[d],a=f)}let s=ELe(d=>-1*uU({x:d[0],y:d[1]},e,t),[n.x,n.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:r?0:s[0],y:s[1]},u=!0;for(let d of e)if(Xs(l,d)>d.radius){u=!1;break}for(let d of t)if(Xs(l,d)d.p1))}function A5t(e){let t={},r=Object.keys(e);for(let i of r)t[i]=[];for(let i=0;i0&&console.log("WARNING: area "+s+" not represented on screen")}return i}function _5t(e,t,r){let i=[];return i.push(` +M`,e,t),i.push(` +m`,-r,0),i.push(` +a`,r,r,0,1,0,r*2,0),i.push(` +a`,r,r,0,1,0,-r*2,0),i.join(" ")}function D5t(e){let t=e.split(" ");return{x:Number.parseFloat(t[1]),y:Number.parseFloat(t[2]),radius:-Number.parseFloat(t[4])}}function BLe(e){if(e.length===0)return[];let t={};return L_(e,t),t.arcs}function FLe(e,t){if(e.length===0)return"M 0 0";let r=Math.pow(10,t||0),i=t!=null?a=>Math.round(a*r)/r:a=>a;if(e.length==1){let a=e[0].circle;return _5t(i(a.x),i(a.y),i(a.radius))}let n=[` +M`,i(e[0].p2.x),i(e[0].p2.y)];for(let a of e){let s=i(a.circle.radius);n.push(` +A`,s,s,0,a.large?1:0,a.sweep?1:0,i(a.p1.x),i(a.p1.y))}return n.join(" ")}function kLe(e,t){return FLe(BLe(e),t)}function $Le(e,t={}){let{lossFunction:r,layoutFunction:i=ALe,normalize:n=!0,orientation:a=Math.PI/2,orientationOrder:s,width:l=600,height:u=350,padding:h=15,scaleToFit:d=!1,symmetricalTextCentre:f=!1,distinct:p,round:m=2}=t,g=i(e,{lossFunction:r==="default"||!r?$y:r==="logRatio"?DLe:r,distinct:p});n&&(g=RLe(g,a,s));let y=LLe(g,l,u,h,d),v=PLe(y,e,f),x=new Map(Object.keys(y).map(w=>[w,{set:w,x:y[w].x,y:y[w].y,radius:y[w].radius}])),b=e.map(w=>{let C=w.sets.map(A=>x.get(A)),k=BLe(C),E=FLe(k,m);return{circles:C,arcs:k,path:E,area:w,has:new Set(w.sets)}});function T(w){let C="";for(let k of b)k.has.size>w.length&&w.every(E=>k.has.has(E))&&(C+=" "+k.path);return C}return o(T,"genDistinctPath"),b.map(({circles:w,arcs:C,path:k,area:E})=>({data:E,text:v[E.sets],circles:w,arcs:C,path:k,distinctPath:k+T(E.sets)}))}var _Le,zLe=z(()=>{"use strict";o(L_,"intersectionArea");o(p5t,"containedInCircles");o(m5t,"getIntersectionPoints");o(hU,"circleArea");o(Xs,"distance");o(yU,"circleOverlap");o(wLe,"circleCircleIntersection");o(SLe,"getCenter");o(g5t,"bisect");o(dU,"zeros");o(CLe,"zerosM");o(Fy,"dot");o(fU,"norm2");o(pU,"scale");o(Rh,"weightedSum");o(ELe,"nelderMead");o(y5t,"wolfeLineSearch");o(v5t,"conjugateGradient");o(ALe,"venn");_Le=1e-10;o(mU,"distanceFromIntersectArea");o(x5t,"addMissingAreas");o(b5t,"getDistanceMatrices");o(T5t,"constrainedMDSGradient");o(C5t,"bestInitialLayout");o(k5t,"constrainedMDSLayout");o(w5t,"greedyLayout");o($y,"lossFunction");o(DLe,"logRatioLossFunction");o(S5t,"orientateCircles");o(E5t,"disjointCluster");o(gU,"getBoundingBox");o(RLe,"normalizeSolution");o(LLe,"scaleSolution");o(MLe,"toObjectNotation");o(NLe,"fromObjectNotation");o(ILe,"VennDiagram");o(cU,"wrapText");o(uU,"circleMargin");o(OLe,"computeTextCentre");o(A5t,"getOverlappingCircles");o(PLe,"computeTextCentres");o(_5t,"circlePath");o(D5t,"circleFromPath");o(BLe,"intersectionAreaArcs");o(FLe,"arcsToPath");o(kLe,"intersectionAreaPath");o($Le,"layout")});function L5t(e){let t=new Map;for(let r of e){let i=r.targets.join("|"),n=t.get(i);n?Object.assign(n,r.styles):t.set(i,{...r.styles})}return t}function Sm(e){return e.join("|")}function N5t(e,t,r,i,n,a){let s=e?.useDebugLayout??!1,u=r.select("svg").append("g").attr("class","venn-text-nodes"),h=new Map;for(let d of i){let f=Sm(d.sets),p=h.get(f);p?p.push(d):h.set(f,[d])}for(let[d,f]of h.entries()){let p=t.get(d);if(!p?.text)continue;let m=p.text.x,g=p.text.y,y=Math.min(...p.circles.map(R=>R.radius)),v=Math.min(...p.circles.map(R=>R.radius-Math.hypot(m-R.x,g-R.y))),x=Number.isFinite(v)?Math.max(0,v):0;x===0&&Number.isFinite(y)&&(x=y*.6);let b=u.append("g").attr("class","venn-text-area").attr("font-size",`${40*n}px`);s&&b.append("circle").attr("class","venn-text-debug-circle").attr("cx",m).attr("cy",g).attr("r",x).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*n).attr("stroke-dasharray",`${6*n} ${4*n}`);let T=Math.max(80*n,x*2*.95),w=Math.max(60*n,x*2*.95),E=(p.data.label&&p.data.label.length>0?Math.min(32*n,x*.25):0)+(f.length<=2?30*n:0),A=m-T/2,N=g-w/2+E,P=Math.max(1,Math.ceil(Math.sqrt(f.length))),I=Math.max(1,Math.ceil(f.length/P)),D=T/P,_=w/I;for(let[R,M]of f.entries()){let L=R%P,B=Math.floor(R/P),O=A+D*(L+.5),$=N+_*(B+.5);s&&b.append("rect").attr("class","venn-text-debug-cell").attr("x",A+D*L).attr("y",N+_*B).attr("width",D).attr("height",_).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*n).attr("stroke-dasharray",`${4*n} ${3*n}`);let G=D*.9,F=_*.9,V=b.append("foreignObject").attr("class","venn-text-node-fo").attr("width",G).attr("height",F).attr("x",O-G/2).attr("y",$-F/2).attr("overflow","visible"),H=a.get(M.id)?.color,j=V.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(M.label??M.id);H&&j.style("color",H)}}}var M5t,GLe,VLe=z(()=>{"use strict";Rr();Cn();br();ps();zLe();Di();jt();o(L5t,"buildStyleByKey");M5t=o((e,t,r,i)=>{let n=i.db,a=n.getConfig?.(),{themeVariables:s,look:l,handDrawnSeed:u}=Nt(),h=l==="handDrawn",d=[s.venn1,s.venn2,s.venn3,s.venn4,s.venn5,s.venn6,s.venn7,s.venn8].filter(Boolean),f=n.getDiagramTitle?.(),p=n.getSubsetData(),m=n.getTextData(),g=L5t(n.getStyleData()),y=a?.width??800,v=a?.height??450,b=y/1600,T=f?48*b:0,w=s.primaryTextColor??s.textColor,C=bi(t);C.attr("viewBox",`0 0 ${y} ${v}`),f&&C.append("text").text(f).attr("class","venn-title").attr("font-size",`${32*b}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*b).style("fill",s.vennTitleTextColor||s.titleColor);let k=Je(document.createElement("div")),E=ILe().width(y).height(v-T);k.datum(p).call(E);let A=h?ut.svg(k.select("svg").node()):void 0,N=$Le(p,{width:y,height:v-T,padding:a?.padding??15}),P=new Map;for(let R of N){let M=Sm([...R.data.sets].sort());P.set(M,R)}m.length>0&&N5t(a,P,k,m,b,g);let I=ri(s.background||"#f4f4f4");k.selectAll(".venn-circle").each(function(R,M){let L=Je(this),O=Sm([...R.sets].sort()),$=g.get(O),G=$?.fill||d[M%d.length]||s.primaryColor;L.classed(`venn-set-${M%8}`,!0);let F=$?.["fill-opacity"]??.1,V=$?.stroke||G,H=$?.["stroke-width"]||`${5*b}`;if(h&&A){let U=P.get(O);if(U&&U.circles.length>0){let Q=U.circles[0],Y=A.circle(Q.x,Q.y,Q.radius*2,{roughness:.7,seed:u,fill:RC(G,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+M*60,stroke:V,strokeWidth:parseFloat(String(H))});L.select("path").remove(),L.node()?.insertBefore(Y,L.select("text").node())}}else L.select("path").style("fill",G).style("fill-opacity",F).style("stroke",V).style("stroke-width",H).style("stroke-opacity",.95);let j=$?.color||(I?je(G,30):Xe(G,30));L.select("text").style("font-size",`${48*b}px`).style("fill",j)}),h&&A?k.selectAll(".venn-intersection").each(function(R){let M=Je(this),B=Sm([...R.sets].sort()),O=g.get(B),$=O?.fill;if($){let G=M.select("path"),F=G.attr("d");if(F){let V=A.path(F,{roughness:.7,seed:u,fill:RC($,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),H=G.node();H?.parentNode?.insertBefore(V,H),G.remove()}}else M.select("path").style("fill-opacity",0);M.select("text").style("font-size",`${48*b}px`).style("fill",O?.color??s.vennSetTextColor??w)}):(k.selectAll(".venn-intersection text").style("font-size",`${48*b}px`).style("fill",R=>{let L=Sm([...R.sets].sort());return g.get(L)?.color??s.vennSetTextColor??w}),k.selectAll(".venn-intersection path").style("fill-opacity",R=>{let L=Sm([...R.sets].sort());return g.get(L)?.fill?1:0}).style("fill",R=>{let L=Sm([...R.sets].sort());return g.get(L)?.fill??"transparent"}));let D=C.append("g").attr("transform",`translate(0, ${T})`),_=k.select("svg").node();if(_&&"childNodes"in _)for(let R of[..._.childNodes])D.node()?.appendChild(R);Br(C,v,y,a?.useMaxWidth??!0)},"draw");o(Sm,"stableSetsKey");o(N5t,"renderTextNodes");GLe={draw:M5t}});var WLe={};xr(WLe,{diagram:()=>I5t});var I5t,qLe=z(()=>{"use strict";yLe();xLe();TLe();VLe();I5t={parser:gLe,db:vLe,renderer:GLe,styles:bLe}});var zy,vU=z(()=>{"use strict";Bn();br();Xt();Ht();Ci();zy=class{constructor(){this.nodes=[];this.levels=new Map;this.outerNodes=[];this.classes=new Map;this.setAccTitle=Cr;this.getAccTitle=kr;this.setDiagramTitle=Ar;this.getDiagramTitle=Er;this.getAccDescription=Sr;this.setAccDescription=wr}static{o(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){let t=or,r=Nt();return Gr({...t.treemap,...r.treemap??{}})}addNode(t,r){this.nodes.push(t),this.levels.set(t,r),r===0&&(this.outerNodes.push(t),this.root??=t)}getRoot(){return{name:"",children:this.outerNodes}}addClass(t,r){let i=this.classes.get(t)??{id:t,styles:[],textStyles:[]},n=r.replace(/\\,/g,"\xA7\xA7\xA7").replace(/,/g,";").replace(/§§§/g,",").split(";");n&&n.forEach(a=>{Xx(a)&&(i?.textStyles?i.textStyles.push(a):i.textStyles=[a]),i?.styles?i.styles.push(a):i.styles=[a]}),this.classes.set(t,i)}getClasses(){return this.classes}getStylesForClass(t){return this.classes.get(t)?.styles??[]}clear(){gr(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}}});function YLe(e){if(!e.length)return[];let t=[],r=[];return e.forEach(i=>{let n={name:i.name,children:i.type==="Leaf"?void 0:[]};for(n.classSelector=i?.classSelector,i?.cssCompiledStyles&&(n.cssCompiledStyles=i.cssCompiledStyles),i.type==="Leaf"&&i.value!==void 0&&(n.value=i.value);r.length>0&&r[r.length-1].level>=i.level;)r.pop();if(r.length===0)t.push(n);else{let a=r[r.length-1].node;a.children?a.children.push(n):a.children=[n]}i.type!=="Leaf"&&r.push({node:n,level:i.level})}),t}var jLe=z(()=>{"use strict";o(YLe,"buildHierarchy")});var F5t,$5t,xU,XLe=z(()=>{"use strict";sl();St();au();jLe();vU();F5t=o((e,t)=>{ca(e,t);let r=[];for(let a of e.TreemapRows??[])a.$type==="ClassDefStatement"&&t.addClass(a.className??"",a.styleText??"");for(let a of e.TreemapRows??[]){let s=a.item;if(!s)continue;let l=a.indent?parseInt(a.indent):0,u=$5t(s),h=s.classSelector?t.getStylesForClass(s.classSelector):[],d=h.length>0?h:void 0,f={level:l,name:u,type:s.$type,value:s.value,classSelector:s.classSelector,cssCompiledStyles:d};r.push(f)}let i=YLe(r),n=o((a,s)=>{for(let l of a)t.addNode(l,s),l.children&&l.children.length>0&&n(l.children,s+1)},"addNodesRecursively");n(i,0)},"populate"),$5t=o(e=>e.name?String(e.name):"","getItemName"),xU={parser:{yy:void 0},parse:o(async e=>{try{let r=await bn("treemap",e);Z.debug("Treemap AST:",r);let i=xU.parser?.yy;if(!(i instanceof zy))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");F5t(r,i)}catch(t){throw Z.error("Error parsing treemap:",t),t}},"parse")}});var z5t,Gy,mC,G5t,V5t,KLe,ZLe=z(()=>{"use strict";ps();rf();Di();Rr();Ht();br();St();z5t=10,Gy=10,mC=25,G5t=o((e,t,r,i)=>{let n=i.db,a=n.getConfig(),s=a.padding??z5t,l=n.getDiagramTitle(),u=n.getRoot(),{themeVariables:h}=Nt();if(!u)return;let d=l?30:0,f=bi(t),p=a.nodeWidth?a.nodeWidth*Gy:960,m=a.nodeHeight?a.nodeHeight*Gy:500,g=p,y=m+d;f.attr("viewBox",`0 0 ${g} ${y}`),Br(f,y,g,a.useMaxWidth);let v;try{let R=a.valueFormat||",";if(R==="$0,0")v=o(M=>"$"+mc(",")(M),"valueFormat");else if(R.startsWith("$")&&R.includes(",")){let M=/\.\d+/.exec(R),L=M?M[0]:"";v=o(B=>"$"+mc(","+L)(B),"valueFormat")}else if(R.startsWith("$")){let M=R.substring(1);v=o(L=>"$"+mc(M||"")(L),"valueFormat")}else v=mc(R)}catch(R){Z.error("Error creating format function:",R),v=mc(",")}let x=ro().range(["transparent",h.cScale0,h.cScale1,h.cScale2,h.cScale3,h.cScale4,h.cScale5,h.cScale6,h.cScale7,h.cScale8,h.cScale9,h.cScale10,h.cScale11]),b=ro().range(["transparent",h.cScalePeer0,h.cScalePeer1,h.cScalePeer2,h.cScalePeer3,h.cScalePeer4,h.cScalePeer5,h.cScalePeer6,h.cScalePeer7,h.cScalePeer8,h.cScalePeer9,h.cScalePeer10,h.cScalePeer11]),T=ro().range([h.cScaleLabel0,h.cScaleLabel1,h.cScaleLabel2,h.cScaleLabel3,h.cScaleLabel4,h.cScaleLabel5,h.cScaleLabel6,h.cScaleLabel7,h.cScaleLabel8,h.cScaleLabel9,h.cScaleLabel10,h.cScaleLabel11]);l&&f.append("text").attr("x",g/2).attr("y",d/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(l);let w=f.append("g").attr("transform",`translate(0, ${d})`).attr("class","treemapContainer"),C=tg(u).sum(R=>R.value??0).sort((R,M)=>(M.value??0)-(R.value??0)),E=lw().size([p,m]).paddingTop(R=>R.children&&R.children.length>0?mC+Gy:0).paddingInner(s).paddingLeft(R=>R.children&&R.children.length>0?Gy:0).paddingRight(R=>R.children&&R.children.length>0?Gy:0).paddingBottom(R=>R.children&&R.children.length>0?Gy:0).round(!0)(C),A=E.descendants().filter(R=>R.children&&R.children.length>0),N=w.selectAll(".treemapSection").data(A).enter().append("g").attr("class","treemapSection").attr("transform",R=>`translate(${R.x0},${R.y0})`);N.append("rect").attr("width",R=>R.x1-R.x0).attr("height",mC).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",R=>R.depth===0?"display: none;":""),N.append("clipPath").attr("id",(R,M)=>`clip-section-${t}-${M}`).append("rect").attr("width",R=>Math.max(0,R.x1-R.x0-12)).attr("height",mC),N.append("rect").attr("width",R=>R.x1-R.x0).attr("height",R=>R.y1-R.y0).attr("class",(R,M)=>`treemapSection section${M}`).attr("fill",R=>x(R.data.name)).attr("fill-opacity",.6).attr("stroke",R=>b(R.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",R=>{if(R.depth===0)return"display: none;";let M=ct({cssCompiledStyles:R.data.cssCompiledStyles});return M.nodeStyles+";"+M.borderStyles.join(";")}),N.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",mC/2).attr("dominant-baseline","middle").text(R=>R.depth===0?"":R.data.name).attr("font-weight","bold").attr("style",R=>{if(R.depth===0)return"display: none;";let M="dominant-baseline: middle; font-size: 12px; fill:"+T(R.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",L=ct({cssCompiledStyles:R.data.cssCompiledStyles});return M+L.labelStyles.replace("color:","fill:")}).each(function(R){if(R.depth===0)return;let M=Je(this),L=R.data.name;M.text(L);let B=R.x1-R.x0,O=6,$;a.showValues!==!1&&R.value?$=B-10-30-10-O:$=B-O-6;let F=Math.max(15,$),V=M.node();if(V.getComputedTextLength()>F){let U=L;for(;U.length>0;){if(U=L.substring(0,U.length-1),U.length===0){M.text("..."),V.getComputedTextLength()>F&&M.text("");break}if(M.text(U+"..."),V.getComputedTextLength()<=F)break}}}),a.showValues!==!1&&N.append("text").attr("class","treemapSectionValue").attr("x",R=>R.x1-R.x0-10).attr("y",mC/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(R=>R.value?v(R.value):"").attr("font-style","italic").attr("style",R=>{if(R.depth===0)return"display: none;";let M="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+T(R.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",L=ct({cssCompiledStyles:R.data.cssCompiledStyles});return M+L.labelStyles.replace("color:","fill:")});let P=E.leaves(),I=w.selectAll(".treemapLeafGroup").data(P).enter().append("g").attr("class",(R,M)=>`treemapNode treemapLeafGroup leaf${M}${R.data.classSelector?` ${R.data.classSelector}`:""}x`).attr("transform",R=>`translate(${R.x0},${R.y0})`);I.append("rect").attr("width",R=>R.x1-R.x0).attr("height",R=>R.y1-R.y0).attr("class","treemapLeaf").attr("fill",R=>R.parent?x(R.parent.data.name):x(R.data.name)).attr("style",R=>ct({cssCompiledStyles:R.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",R=>R.parent?x(R.parent.data.name):x(R.data.name)).attr("stroke-width",3),I.append("clipPath").attr("id",(R,M)=>`clip-${t}-${M}`).append("rect").attr("width",R=>Math.max(0,R.x1-R.x0-4)).attr("height",R=>Math.max(0,R.y1-R.y0-4)),I.append("text").attr("class","treemapLabel").attr("x",R=>(R.x1-R.x0)/2).attr("y",R=>(R.y1-R.y0)/2).attr("style",R=>{let M="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+T(R.data.name)+";",L=ct({cssCompiledStyles:R.data.cssCompiledStyles});return M+L.labelStyles.replace("color:","fill:")}).attr("clip-path",(R,M)=>`url(#clip-${t}-${M})`).text(R=>R.data.name).each(function(R){let M=Je(this),L=R.x1-R.x0,B=R.y1-R.y0,O=M.node(),$=4,G=L-2*$,F=B-2*$;if(G<10||F<10){M.style("display","none");return}let V=parseInt(M.style("font-size"),10),H=8,j=28,U=.6,Q=6,Y=2;for(;O.getComputedTextLength()>G&&V>H;)V--,M.style("font-size",`${V}px`);let ae=Math.max(Q,Math.min(j,Math.round(V*U))),J=V+Y+ae;for(;J>F&&V>H&&(V--,ae=Math.max(Q,Math.min(j,Math.round(V*U))),!(aeF;M.style("font-size",`${V}px`),(O.getComputedTextLength()>G||V(M.x1-M.x0)/2).attr("y",function(M){return(M.y1-M.y0)/2}).attr("style",M=>{let L="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+T(M.data.name)+";",B=ct({cssCompiledStyles:M.data.cssCompiledStyles});return L+B.labelStyles.replace("color:","fill:")}).attr("clip-path",(M,L)=>`url(#clip-${t}-${L})`).text(M=>M.value?v(M.value):"").each(function(M){let L=Je(this),B=this.parentNode;if(!B){L.style("display","none");return}let O=Je(B).select(".treemapLabel");if(O.empty()||O.style("display")==="none"){L.style("display","none");return}let $=parseFloat(O.style("font-size")),G=28,F=.6,V=6,H=2,j=Math.max(V,Math.min(G,Math.round($*F)));L.style("font-size",`${j}px`);let Q=(M.y1-M.y0)/2+$/2+H;L.attr("y",Q);let Y=M.x1-M.x0,te=M.y1-M.y0-4,re=Y-8;L.node().getComputedTextLength()>re||Q+j>te||j{"use strict";Xt();$f();br();W5t={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},q5t=o(({treemap:e}={})=>{let t=Ao(),r=Nt(),i=Gr(t,r.themeVariables),n=Gr(W5t,e),a=n.titleColor??i.titleColor,s=n.labelColor??i.textColor,l=n.valueColor??i.textColor;return` + .treemapNode.section { + stroke: ${n.sectionStrokeColor}; + stroke-width: ${n.sectionStrokeWidth}; + fill: ${n.sectionFillColor}; + } + .treemapNode.leaf { + stroke: ${n.leafStrokeColor}; + stroke-width: ${n.leafStrokeWidth}; + fill: ${n.leafFillColor}; + } + .treemapLabel { + fill: ${s}; + font-size: ${n.labelFontSize}; + } + .treemapValue { + fill: ${l}; + font-size: ${n.valueFontSize}; + } + .treemapTitle { + fill: ${a}; + font-size: ${n.titleFontSize}; + } + `},"getStyles"),QLe=q5t});var eMe={};xr(eMe,{diagram:()=>U5t});var U5t,tMe=z(()=>{"use strict";vU();XLe();ZLe();JLe();U5t={parser:xU,get db(){return new zy},renderer:KLe,styles:QLe}});var M_,Em,nMe,j5t,X5t,bU,aMe=z(()=>{"use strict";sl();St();au();M_=o((e,t)=>{let r=e<=1?e*100:e;if(r<0||r>100)throw new Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return r},"toPercent"),Em=o((e,t,r)=>({x:M_(t,`${r} evolution`),y:M_(e,`${r} visibility`)}),"toCoordinates"),nMe=o(e=>{if(e){if(e==="+<>")return"bidirectional";if(e==="+<")return"backward";if(e==="+>")return"forward"}},"getFlowFromPort"),j5t=o(e=>{if(!e?.startsWith("+"))return{};let r=/^\+'([^']*)'/.exec(e)?.[1];return e.includes("<>")?{flow:"bidirectional",label:r}:e.includes("<")?{flow:"backward",label:r}:e.includes(">")?{flow:"forward",label:r}:{label:r}},"extractFlowFromArrow"),X5t=o((e,t)=>{if(ca(e,t),e.size&&t.setSize(e.size.width,e.size.height),e.evolution){let r=e.evolution.stages.map(n=>n.secondName?`${n.name.trim()} / ${n.secondName.trim()}`:n.name.trim()),i=e.evolution.stages.filter(n=>n.boundary!==void 0).map(n=>n.boundary);t.updateAxes({stages:r,stageBoundaries:i})}if(e.anchors.forEach(r=>{let i=Em(r.visibility,r.evolution,`Anchor "${r.name}"`);t.addNode(r.name,r.name,i.x,i.y,"anchor")}),e.components.forEach(r=>{let i=Em(r.visibility,r.evolution,`Component "${r.name}"`),n=r.label?(r.label.negX?-1:1)*r.label.offsetX:void 0,a=r.label?(r.label.negY?-1:1)*r.label.offsetY:void 0,s=r.decorator?.strategy;t.addNode(r.name,r.name,i.x,i.y,"component",n,a,r.inertia,s)}),e.notes.forEach(r=>{let i=Em(r.visibility,r.evolution,`Note "${r.text}"`);t.addNote(r.text,i.x,i.y)}),e.pipelines.forEach(r=>{let i=t.getNode(r.parent);if(!i||typeof i.y!="number")throw new Error(`Pipeline "${r.parent}" must reference an existing component with coordinates.`);let n=i.y;t.startPipeline(r.parent),r.components.forEach(a=>{let s=`${r.parent}_${a.name}`,l=a.label?(a.label.negX?-1:1)*a.label.offsetX:void 0,u=a.label?(a.label.negY?-1:1)*a.label.offsetY:void 0,h=M_(a.evolution,`Pipeline component "${a.name}" evolution`);t.addNode(s,a.name,h,n,"pipeline-component",l,u),t.addPipelineComponent(r.parent,s)})}),e.links.forEach(r=>{let i=!!r.arrow&&(r.arrow.includes("-.->")||r.arrow.includes(".-.")),n=nMe(r.fromPort)??nMe(r.toPort),{flow:a,label:s}=j5t(r.arrow);!n&&a&&(n=a);let l=r.linkLabel,u=s??l;t.addLink(t.resolveNodeId(r.from),t.resolveNodeId(r.to),i,u,n)}),e.evolves.forEach(r=>{let i=t.getNode(r.component);if(i?.y!==void 0){let n=M_(r.target,`Evolve target for "${r.component}"`);t.addTrend(r.component,n,i.y)}}),e.annotations.length>0){let r=e.annotations[0],i=Em(r.x,r.y,"Annotations box");t.setAnnotationsBox(i.x,i.y)}e.annotation.forEach(r=>{let i=Em(r.x,r.y,`Annotation ${r.number}`);t.addAnnotation(r.number,[{x:i.x,y:i.y}],r.text)}),e.accelerators.forEach(r=>{let i=Em(r.x,r.y,`Accelerator "${r.name}"`);t.addAccelerator(r.name,i.x,i.y)}),e.deaccelerators.forEach(r=>{let i=Em(r.x,r.y,`Deaccelerator "${r.name}"`);t.addDeaccelerator(r.name,i.x,i.y)})},"populateDb"),bU={parser:{yy:void 0},parse:o(async e=>{let t=await bn("wardley",e);Z.debug(t);let r=bU.parser?.yy;if(!r||typeof r.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");X5t(t,r)},"parse")}});var N_,sMe=z(()=>{"use strict";N_=class{constructor(){this.nodes=new Map;this.links=[];this.trends=new Map;this.pipelines=new Map;this.annotations=[];this.notes=[];this.accelerators=[];this.deaccelerators=[];this.axes={}}static{o(this,"WardleyBuilder")}addNode(t){let r=this.nodes.get(t.id)??{id:t.id,label:t.label},i={...r,...t,className:t.className??r.className,labelOffsetX:t.labelOffsetX??r.labelOffsetX,labelOffsetY:t.labelOffsetY??r.labelOffsetY};this.nodes.set(t.id,i)}addLink(t){this.links.push(t)}addTrend(t){this.trends.set(t.nodeId,t)}startPipeline(t){this.pipelines.set(t,{nodeId:t,componentIds:[]});let r=this.nodes.get(t);r&&(r.isPipelineParent=!0)}addPipelineComponent(t,r){let i=this.pipelines.get(t);i&&i.componentIds.push(r);let n=this.nodes.get(r);n&&(n.inPipeline=!0)}addAnnotation(t){this.annotations.push(t)}addNote(t){this.notes.push(t)}addAccelerator(t){this.accelerators.push(t)}addDeaccelerator(t){this.deaccelerators.push(t)}setAnnotationsBox(t,r){this.annotationsBox={x:t,y:r}}setAxes(t){this.axes={...this.axes,...t}}setSize(t,r){this.size={width:t,height:r}}getNode(t){return this.nodes.get(t)}resolveNodeId(t){if(this.nodes.has(t))return t;for(let[r,i]of this.nodes)if(i.label===t)return r;return t}build(){let t=[];for(let r of this.nodes.values()){if(typeof r.x!="number"||typeof r.y!="number")throw new Error(`Node "${r.label}" is missing coordinates`);t.push(r)}return{nodes:t,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}}});function K5t(){return ge()["wardley-beta"]}function Z5t(e,t,r,i,n,a,s,l,u){Ga.addNode({id:e,label:t,x:r,y:i,className:n,labelOffsetX:a,labelOffsetY:s,inertia:l,sourceStrategy:u})}function Q5t(e,t,r=!1,i,n){Ga.addLink({source:e,target:t,dashed:r,label:i,flow:n})}function J5t(e,t,r){Ga.addTrend({nodeId:e,targetX:t,targetY:r})}function eAt(e,t,r){Ga.addAnnotation({number:e,coordinates:t,text:r})}function tAt(e,t,r){Ga.addNote({text:e,x:t,y:r})}function rAt(e,t,r){Ga.addAccelerator({name:e,x:t,y:r})}function iAt(e,t,r){Ga.addDeaccelerator({name:e,x:t,y:r})}function nAt(e,t){Ga.setAnnotationsBox(e,t)}function aAt(e,t){Ga.setSize(e,t)}function sAt(e){Ga.startPipeline(e)}function oAt(e,t){Ga.addPipelineComponent(e,t)}function lAt(e){Ga.setAxes(e)}function cAt(e){return Ga.getNode(e)}function uAt(e){return Ga.resolveNodeId(e)}function hAt(){return Ga.build()}function dAt(){Ga.clear(),gr()}var Ga,oMe,lMe=z(()=>{"use strict";Ut();Ci();sMe();Ga=new N_;o(K5t,"getConfig");o(Z5t,"addNode");o(Q5t,"addLink");o(J5t,"addTrend");o(eAt,"addAnnotation");o(tAt,"addNote");o(rAt,"addAccelerator");o(iAt,"addDeaccelerator");o(nAt,"setAnnotationsBox");o(aAt,"setSize");o(sAt,"startPipeline");o(oAt,"addPipelineComponent");o(lAt,"updateAxes");o(cAt,"getNode");o(uAt,"resolveNodeId");o(hAt,"getWardleyData");o(dAt,"clear");oMe={getConfig:K5t,addNode:Z5t,addLink:Q5t,addTrend:J5t,addAnnotation:eAt,addNote:tAt,addAccelerator:rAt,addDeaccelerator:iAt,setAnnotationsBox:nAt,setSize:aAt,startPipeline:sAt,addPipelineComponent:oAt,updateAxes:lAt,getNode:cAt,resolveNodeId:uAt,getWardleyData:hAt,clear:dAt,setAccTitle:Cr,getAccTitle:kr,setDiagramTitle:Ar,getDiagramTitle:Er,getAccDescription:Sr,setAccDescription:wr}});var fAt,pAt,mAt,gAt,cMe,uMe=z(()=>{"use strict";Ut();St();ps();Di();fAt=["Genesis","Custom Built","Product","Commodity"],pAt=o(()=>{let{themeVariables:e}=ge();return{backgroundColor:e.wardley?.backgroundColor??e.background??"#fff",axisColor:e.wardley?.axisColor??"#000",axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??"#222",gridColor:e.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:e.wardley?.componentFill??"#fff",componentStroke:e.wardley?.componentStroke??"#000",componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??"#222",linkStroke:e.wardley?.linkStroke??"#000",evolutionStroke:e.wardley?.evolutionStroke??"#dc3545",annotationStroke:e.wardley?.annotationStroke??"#000",annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??"#222",annotationFill:e.wardley?.annotationFill??e.background??"#fff"}},"getTheme"),mAt=o(()=>{let e=ge()["wardley-beta"];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},"getConfigValues"),gAt=o((e,t,r,i)=>{Z.debug(`Rendering Wardley map +`+e);let n=mAt(),a=pAt(),s=n.nodeRadius*1.6,l=i.db,u=l.getWardleyData(),h=l.getDiagramTitle(),d=u.size?.width??n.width,f=u.size?.height??n.height,p=bi(t);p.selectAll("*").remove(),Br(p,f,d,n.useMaxWidth),p.attr("viewBox",`0 0 ${d} ${f}`);let m=p.append("g").attr("class","wardley-map"),g=p.append("defs");g.append("marker").attr("id",`arrow-${t}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",a.evolutionStroke).attr("stroke","none"),g.append("marker").attr("id",`link-arrow-end-${t}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",a.linkStroke).attr("stroke","none"),g.append("marker").attr("id",`link-arrow-start-${t}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",a.linkStroke).attr("stroke","none"),m.append("rect").attr("class","wardley-background").attr("width",d).attr("height",f).attr("fill",a.backgroundColor);let y=d-n.padding*2,v=f-n.padding*2;h&&m.append("text").attr("class","wardley-title").attr("x",d/2).attr("y",n.padding/2).attr("fill",a.axisTextColor).attr("font-size",n.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(h);let x=o(O=>n.padding+O/100*y,"projectX"),b=o(O=>f-n.padding-O/100*v,"projectY"),T=m.append("g").attr("class","wardley-axes");T.append("line").attr("x1",n.padding).attr("x2",d-n.padding).attr("y1",f-n.padding).attr("y2",f-n.padding).attr("stroke",a.axisColor).attr("stroke-width",1),T.append("line").attr("x1",n.padding).attr("x2",n.padding).attr("y1",n.padding).attr("y2",f-n.padding).attr("stroke",a.axisColor).attr("stroke-width",1);let w=u.axes.xLabel??"Evolution",C=u.axes.yLabel??"Visibility";T.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",n.padding+y/2).attr("y",f-n.padding/4).attr("fill",a.axisTextColor).attr("font-size",n.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(w),T.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",n.padding/3).attr("y",n.padding+v/2).attr("fill",a.axisTextColor).attr("font-size",n.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${n.padding/3} ${n.padding+v/2})`).text(C);let k=u.axes.stages&&u.axes.stages.length>0?u.axes.stages:fAt;if(k.length>0){let O=m.append("g").attr("class","wardley-stages"),$=u.axes.stageBoundaries,G=[];if($&&$.length===k.length){let F=0;$.forEach(V=>{G.push({start:F,end:V}),F=V})}else{let F=1/k.length;k.forEach((V,H)=>{G.push({start:H*F,end:(H+1)*F})})}k.forEach((F,V)=>{let H=G[V],j=n.padding+H.start*y,U=n.padding+H.end*y,Q=(j+U)/2;V>0&&O.append("line").attr("x1",j).attr("x2",j).attr("y1",n.padding).attr("y2",f-n.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),O.append("text").attr("class","wardley-stage-label").attr("x",Q).attr("y",f-n.padding/1.5).attr("fill",a.axisTextColor).attr("font-size",n.axisFontSize-2).attr("text-anchor","middle").text(F)})}if(n.showGrid){let O=m.append("g").attr("class","wardley-grid");for(let $=1;$<4;$++){let G=$/4,F=n.padding+y*G;O.append("line").attr("x1",F).attr("x2",F).attr("y1",n.padding).attr("y2",f-n.padding).attr("stroke",a.gridColor).attr("stroke-dasharray","2 6"),O.append("line").attr("x1",n.padding).attr("x2",d-n.padding).attr("y1",f-n.padding-v*G).attr("y2",f-n.padding-v*G).attr("stroke",a.gridColor).attr("stroke-dasharray","2 6")}}let E=new Map;if(u.nodes.forEach(O=>{E.set(O.id,{x:x(O.x),y:b(O.y),node:O})}),u.pipelines.length>0){let O=m.append("g").attr("class","wardley-pipelines"),$=m.append("g").attr("class","wardley-pipeline-links");u.pipelines.forEach(G=>{if(G.componentIds.length===0)return;let F=G.componentIds.map(U=>({id:U,pos:E.get(U),node:u.nodes.find(Q=>Q.id===U)})).filter(U=>U.pos&&U.node).sort((U,Q)=>U.node.x-Q.node.x);for(let U=0;U{let Q=E.get(U);Q&&(V=Math.min(V,Q.x),H=Math.max(H,Q.x),j=Q.y)}),V!==1/0&&H!==-1/0){let Q=n.nodeRadius*4,Y=j-Q/2,ae=E.get(G.nodeId);if(ae){let J=(V+H)/2;ae.x=J,ae.y=Y-s/6}O.append("rect").attr("class","wardley-pipeline-box").attr("x",V-15).attr("y",Y).attr("width",H-V+30).attr("height",Q).attr("fill","none").attr("stroke",a.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let A=m.append("g").attr("class","wardley-links"),N=new Map;u.pipelines.forEach(O=>{N.set(O.nodeId,new Set(O.componentIds))});let P=u.links.filter(O=>!(!E.has(O.source)||!E.has(O.target)||N.get(O.target)?.has(O.source)));A.selectAll("line").data(P).enter().append("line").attr("class",O=>`wardley-link${O.dashed?" wardley-link--dashed":""}`).attr("x1",O=>{let $=E.get(O.source),G=E.get(O.target),V=u.nodes.find(Q=>Q.id===O.source).isPipelineParent?s/Math.sqrt(2):n.nodeRadius,H=G.x-$.x,j=G.y-$.y,U=Math.sqrt(H*H+j*j);return $.x+H/U*V}).attr("y1",O=>{let $=E.get(O.source),G=E.get(O.target),V=u.nodes.find(Q=>Q.id===O.source).isPipelineParent?s/Math.sqrt(2):n.nodeRadius,H=G.x-$.x,j=G.y-$.y,U=Math.sqrt(H*H+j*j);return $.y+j/U*V}).attr("x2",O=>{let $=E.get(O.source),G=E.get(O.target),V=u.nodes.find(Q=>Q.id===O.target).isPipelineParent?s/Math.sqrt(2):n.nodeRadius,H=$.x-G.x,j=$.y-G.y,U=Math.sqrt(H*H+j*j);return G.x+H/U*V}).attr("y2",O=>{let $=E.get(O.source),G=E.get(O.target),V=u.nodes.find(Q=>Q.id===O.target).isPipelineParent?s/Math.sqrt(2):n.nodeRadius,H=$.x-G.x,j=$.y-G.y,U=Math.sqrt(H*H+j*j);return G.y+j/U*V}).attr("stroke",a.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",O=>O.dashed?"6 6":null).attr("marker-end",O=>O.flow==="forward"||O.flow==="bidirectional"?`url(#link-arrow-end-${t})`:null).attr("marker-start",O=>O.flow==="backward"||O.flow==="bidirectional"?`url(#link-arrow-start-${t})`:null),A.selectAll("text").data(P.filter(O=>O.label)).enter().append("text").attr("class","wardley-link-label").attr("x",O=>{let $=E.get(O.source),G=E.get(O.target),F=($.x+G.x)/2,V=G.y-$.y,H=G.x-$.x,j=Math.sqrt(H*H+V*V),U=8,Q=V/j;return F+Q*U}).attr("y",O=>{let $=E.get(O.source),G=E.get(O.target),F=($.y+G.y)/2,V=G.x-$.x,H=G.y-$.y,j=Math.sqrt(V*V+H*H),U=8,Q=-V/j;return F+Q*U}).attr("fill",a.axisTextColor).attr("font-size",n.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",O=>{let $=E.get(O.source),G=E.get(O.target),F=($.x+G.x)/2,V=($.y+G.y)/2,H=G.x-$.x,j=G.y-$.y,U=Math.sqrt(H*H+j*j),Q=8,Y=j/U,ae=-H/U,J=F+Y*Q,te=V+ae*Q,re=Math.atan2(j,H)*180/Math.PI;return(re>90||re<-90)&&(re+=180),`rotate(${re} ${J} ${te})`}).text(O=>O.label);let I=m.append("g").attr("class","wardley-trends"),D=u.trends.map(O=>{let $=E.get(O.nodeId);if(!$)return null;let G=x(O.targetX),F=b(O.targetY),V=G-$.x,H=F-$.y,j=Math.sqrt(V*V+H*H),U=n.nodeRadius+2,Q=j>U?G-V/j*U:G,Y=j>U?F-H/j*U:F;return{origin:$,targetX:G,targetY:F,adjustedX2:Q,adjustedY2:Y}}).filter(O=>O!==null);I.selectAll("line").data(D).enter().append("line").attr("class","wardley-trend").attr("x1",O=>O.origin.x).attr("y1",O=>O.origin.y).attr("x2",O=>O.adjustedX2).attr("y2",O=>O.adjustedY2).attr("stroke",a.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${t})`);let R=m.append("g").attr("class","wardley-nodes").selectAll("g").data(u.nodes).enter().append("g").attr("class",O=>["wardley-node",O.className?`wardley-node--${O.className}`:""].filter(Boolean).join(" "));R.filter(O=>O.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",O=>E.get(O.id).x).attr("cy",O=>E.get(O.id).y).attr("r",n.nodeRadius*2).attr("fill","#666").attr("stroke",a.componentStroke).attr("stroke-width",1),R.filter(O=>O.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",O=>E.get(O.id).x).attr("cy",O=>E.get(O.id).y).attr("r",n.nodeRadius*2).attr("fill","#ccc").attr("stroke",a.componentStroke).attr("stroke-width",1),R.filter(O=>O.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",O=>E.get(O.id).x).attr("cy",O=>E.get(O.id).y).attr("r",n.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let M=R.filter(O=>O.sourceStrategy==="market");M.append("circle").attr("class","wardley-market-overlay").attr("cx",O=>E.get(O.id).x).attr("cy",O=>E.get(O.id).y).attr("r",n.nodeRadius*2).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",1),R.filter(O=>!O.isPipelineParent&&O.sourceStrategy!=="market"&&O.className!=="anchor").append("circle").attr("cx",O=>E.get(O.id).x).attr("cy",O=>E.get(O.id).y).attr("r",n.nodeRadius).attr("fill",a.componentFill).attr("stroke",a.componentStroke).attr("stroke-width",1);let L=n.nodeRadius*.7,B=n.nodeRadius*1.2;if(M.append("line").attr("class","wardley-market-line").attr("x1",O=>E.get(O.id).x).attr("y1",O=>E.get(O.id).y-B).attr("x2",O=>E.get(O.id).x-B*Math.cos(Math.PI/6)).attr("y2",O=>E.get(O.id).y+B*Math.sin(Math.PI/6)).attr("stroke",a.componentStroke).attr("stroke-width",1),M.append("line").attr("class","wardley-market-line").attr("x1",O=>E.get(O.id).x-B*Math.cos(Math.PI/6)).attr("y1",O=>E.get(O.id).y+B*Math.sin(Math.PI/6)).attr("x2",O=>E.get(O.id).x+B*Math.cos(Math.PI/6)).attr("y2",O=>E.get(O.id).y+B*Math.sin(Math.PI/6)).attr("stroke",a.componentStroke).attr("stroke-width",1),M.append("line").attr("class","wardley-market-line").attr("x1",O=>E.get(O.id).x+B*Math.cos(Math.PI/6)).attr("y1",O=>E.get(O.id).y+B*Math.sin(Math.PI/6)).attr("x2",O=>E.get(O.id).x).attr("y2",O=>E.get(O.id).y-B).attr("stroke",a.componentStroke).attr("stroke-width",1),M.append("circle").attr("class","wardley-market-dot").attr("cx",O=>E.get(O.id).x).attr("cy",O=>E.get(O.id).y-B).attr("r",L).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",2),M.append("circle").attr("class","wardley-market-dot").attr("cx",O=>E.get(O.id).x-B*Math.cos(Math.PI/6)).attr("cy",O=>E.get(O.id).y+B*Math.sin(Math.PI/6)).attr("r",L).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",2),M.append("circle").attr("class","wardley-market-dot").attr("cx",O=>E.get(O.id).x+B*Math.cos(Math.PI/6)).attr("cy",O=>E.get(O.id).y+B*Math.sin(Math.PI/6)).attr("r",L).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",2),R.filter(O=>O.isPipelineParent===!0).append("rect").attr("x",O=>E.get(O.id).x-s/2).attr("y",O=>E.get(O.id).y-s/2).attr("width",s).attr("height",s).attr("fill",a.componentFill).attr("stroke",a.componentStroke).attr("stroke-width",1),R.filter(O=>O.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",O=>{let $=E.get(O.id),G=O.isPipelineParent?s/2+15:n.nodeRadius+15;return O.sourceStrategy&&(G+=n.nodeRadius+10),$.x+G}).attr("y1",O=>{let $=E.get(O.id),G=O.isPipelineParent?s:n.nodeRadius*2;return $.y-G/2}).attr("x2",O=>{let $=E.get(O.id),G=O.isPipelineParent?s/2+15:n.nodeRadius+15;return O.sourceStrategy&&(G+=n.nodeRadius+10),$.x+G}).attr("y2",O=>{let $=E.get(O.id),G=O.isPipelineParent?s:n.nodeRadius*2;return $.y+G/2}).attr("stroke",a.componentStroke).attr("stroke-width",6),R.append("text").attr("x",O=>{let $=E.get(O.id);if(O.className==="anchor")return O.labelOffsetX!==void 0?$.x+O.labelOffsetX:$.x;let G=n.nodeLabelOffset;O.sourceStrategy&&O.labelOffsetX===void 0&&(G+=10);let F=O.labelOffsetX??G;return $.x+F}).attr("y",O=>{let $=E.get(O.id);if(O.className==="anchor")return O.labelOffsetY!==void 0?$.y+O.labelOffsetY:$.y-3;let G=-n.nodeLabelOffset;O.sourceStrategy&&O.labelOffsetY===void 0&&(G-=10);let F=O.labelOffsetY??G;return $.y+F}).attr("class","wardley-node-label").attr("fill",O=>O.className==="evolved"?a.evolutionStroke:O.className==="anchor"?"#000":a.componentLabelColor).attr("font-size",n.labelFontSize).attr("font-weight",O=>O.className==="anchor"?"bold":"normal").attr("text-anchor",O=>O.className==="anchor"?"middle":"start").attr("dominant-baseline",O=>O.className==="anchor"?"middle":"auto").text(O=>O.label),u.annotations.length>0){let O=m.append("g").attr("class","wardley-annotations");if(u.annotations.forEach($=>{let G=$.coordinates.map(F=>({x:x(F.x),y:b(F.y)}));if(G.length>1)for(let F=0;F{let V=O.append("g").attr("class","wardley-annotation");V.append("circle").attr("cx",F.x).attr("cy",F.y).attr("r",10).attr("fill","white").attr("stroke",a.axisColor).attr("stroke-width",1.5),V.append("text").attr("x",F.x).attr("y",F.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.number)})}),u.annotationsBox){let $=x(u.annotationsBox.x),G=b(u.annotationsBox.y),F=10,V=16,H=11,j=O.append("g").attr("class","wardley-annotations-box"),U=[...u.annotations].filter(Y=>Y.text).sort((Y,ae)=>Y.number-ae.number),Q=[];if(U.forEach((Y,ae)=>{let J=j.append("text").attr("x",$+F).attr("y",G+F+(ae+1)*V).attr("font-size",H).attr("fill",a.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${Y.number}. ${Y.text}`);Q.push(J)}),Q.length>0){let Y=0,ae=0;Q.forEach(De=>{let Ie=De.node(),Ee=Ie.getComputedTextLength();Y=Math.max(Y,Ee);let we=Ie.getBBox();ae=Math.max(ae,we.height)});let J=Y+F*2+105,te=U.length*V+F*2+ae/2,re=n.padding,ee=d-n.padding-J,Te=n.padding,ue=f-n.padding-te;$=Math.max(re,Math.min($,ee)),G=Math.max(Te,Math.min(G,ue)),Q.forEach((De,Ie)=>{De.attr("x",$+F).attr("y",G+F+(Ie+1)*V)}),j.insert("rect","text").attr("x",$).attr("y",G).attr("width",J).attr("height",te).attr("fill","white").attr("stroke",a.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(u.notes.length>0){let O=m.append("g").attr("class","wardley-notes");u.notes.forEach($=>{let G=x($.x),F=b($.y);O.append("text").attr("x",G).attr("y",F).attr("text-anchor","start").attr("font-size",11).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.text)})}if(u.accelerators.length>0){let O=m.append("g").attr("class","wardley-accelerators");u.accelerators.forEach($=>{let G=x($.x),F=b($.y),V=60,H=30,j=20,U=` + M ${G} ${F-H/2} + L ${G+V-j} ${F-H/2} + L ${G+V-j} ${F-H/2-8} + L ${G+V} ${F} + L ${G+V-j} ${F+H/2+8} + L ${G+V-j} ${F+H/2} + L ${G} ${F+H/2} + Z + `;O.append("path").attr("d",U).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",1),O.append("text").attr("x",G+V/2).attr("y",F+H/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.name)})}if(u.deaccelerators.length>0){let O=m.append("g").attr("class","wardley-deaccelerators");u.deaccelerators.forEach($=>{let G=x($.x),F=b($.y),V=60,H=30,j=20,U=` + M ${G+V} ${F-H/2} + L ${G+j} ${F-H/2} + L ${G+j} ${F-H/2-8} + L ${G} ${F} + L ${G+j} ${F+H/2+8} + L ${G+j} ${F+H/2} + L ${G+V} ${F+H/2} + Z + `;O.append("path").attr("d",U).attr("fill","white").attr("stroke",a.componentStroke).attr("stroke-width",1),O.append("text").attr("x",G+V/2).attr("y",F+H/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",a.axisTextColor).attr("font-weight","bold").text($.name)})}},"draw"),cMe={draw:gAt}});var hMe,dMe=z(()=>{"use strict";Xt();$f();br();hMe=o(({wardley:e}={})=>{let t=Ao(),r=Nt(),i=Gr(t,r.themeVariables),n=Gr(i.wardley,e);return` + .wardley-background { + fill: ${n.backgroundColor}; + } + .wardley-axes line, .wardley-axes path { + stroke: ${n.axisColor}; + } + .wardley-axis-label { + fill: ${n.axisTextColor}; + } + .wardley-stage-label { + fill: ${n.axisTextColor}; + } + .wardley-grid line { + stroke: ${n.gridColor}; + } + .wardley-node circle { + fill: ${n.componentFill}; + stroke: ${n.componentStroke}; + } + .wardley-node-label { + fill: ${n.componentLabelColor}; + } + .wardley-link { + stroke: ${n.linkStroke}; + } + .wardley-link--dashed { + stroke-dasharray: 4 4; + } + .wardley-link-label { + fill: ${n.axisTextColor}; + } + .wardley-trend line { + stroke: ${n.evolutionStroke}; + } + .wardley-annotation-line { + stroke: ${n.annotationStroke}; + } + .wardley-annotation circle { + fill: ${n.annotationFill}; + stroke: ${n.annotationStroke}; + } + .wardley-annotation text { + fill: ${n.annotationTextColor}; + } + .wardley-annotations-box rect { + fill: ${n.annotationFill}; + stroke: ${n.annotationStroke}; + } + .wardley-annotations-box text { + fill: ${n.annotationTextColor}; + } + .wardley-pipeline-box { + stroke: ${n.componentStroke}; + } + .wardley-notes text { + fill: ${n.axisTextColor}; + } + `},"styles")});var fMe={};xr(fMe,{diagram:()=>yAt});var yAt,pMe=z(()=>{"use strict";aMe();lMe();uMe();dMe();yAt={parser:bU,db:oMe,renderer:cMe,styles:hMe}});var s6t={};xr(s6t,{default:()=>a6t});uc();RD();Xf();var Yze=o(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),jze=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(cte(),lte));return{id:"c4",diagram:e}},"loader"),Xze={id:"c4",detector:Yze,loader:jze},ute=Xze;var t1e="flowchart",Jot=o((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),elt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(dE(),hE));return{id:t1e,diagram:e}},"loader"),tlt={id:t1e,detector:Jot,loader:elt},r1e=tlt;var i1e="flowchart-v2",rlt=o((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),ilt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(dE(),hE));return{id:i1e,diagram:e}},"loader"),nlt={id:i1e,detector:rlt,loader:ilt},n1e=nlt;var clt=o(e=>/^\s*erDiagram/.test(e),"detector"),ult=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(f1e(),d1e));return{id:"er",diagram:e}},"loader"),hlt={id:"er",detector:clt,loader:ult},p1e=hlt;var s5e="gitGraph",vbt=o(e=>/^\s*gitGraph/.test(e),"detector"),xbt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(a5e(),n5e));return{id:s5e,diagram:e}},"loader"),bbt={id:s5e,detector:vbt,loader:xbt},o5e=bbt;var $5e="gantt",l2t=o(e=>/^\s*gantt/.test(e),"detector"),c2t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(F5e(),B5e));return{id:$5e,diagram:e}},"loader"),u2t={id:$5e,detector:l2t,loader:c2t},z5e=u2t;var X5e="info",m2t=o(e=>/^\s*info/.test(e),"detector"),g2t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(j5e(),Y5e));return{id:X5e,diagram:e}},"loader"),K5e={id:X5e,detector:m2t,loader:g2t};var D2t=o(e=>/^\s*pie/.test(e),"detector"),R2t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(aAe(),nAe));return{id:"pie",diagram:e}},"loader"),sAe={id:"pie",detector:D2t,loader:R2t};var xAe="quadrantChart",j2t=o(e=>/^\s*quadrantChart/.test(e),"detector"),X2t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(vAe(),yAe));return{id:xAe,diagram:e}},"loader"),K2t={id:xAe,detector:j2t,loader:X2t},bAe=K2t;var YAe="xychart",fTt=o(e=>/^\s*xychart(-beta)?/.test(e),"detector"),pTt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(HAe(),UAe));return{id:YAe,diagram:e}},"loader"),mTt={id:YAe,detector:fTt,loader:pTt},jAe=mTt;var i6e="requirement",bTt=o(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),TTt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(r6e(),t6e));return{id:i6e,diagram:e}},"loader"),CTt={id:i6e,detector:bTt,loader:TTt},n6e=CTt;var C6e="sequence",vCt=o(e=>/^\s*sequenceDiagram/.test(e),"detector"),xCt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(T6e(),b6e));return{id:C6e,diagram:e}},"loader"),bCt={id:C6e,detector:vCt,loader:xCt},k6e=bCt;var D6e="class",ECt=o((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),ACt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(_6e(),A6e));return{id:D6e,diagram:e}},"loader"),_Ct={id:D6e,detector:ECt,loader:ACt},R6e=_Ct;var N6e="classDiagram",RCt=o((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),LCt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(M6e(),L6e));return{id:N6e,diagram:e}},"loader"),MCt={id:N6e,detector:RCt,loader:LCt},I6e=MCt;var d_e="state",nkt=o((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),akt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(h_e(),u_e));return{id:d_e,diagram:e}},"loader"),skt={id:d_e,detector:nkt,loader:akt},f_e=skt;var g_e="stateDiagram",lkt=o((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),ckt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(m_e(),p_e));return{id:g_e,diagram:e}},"loader"),ukt={id:g_e,detector:lkt,loader:ckt},y_e=ukt;var M_e="journey",Lkt=o(e=>/^\s*journey/.test(e),"detector"),Mkt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(L_e(),R_e));return{id:M_e,diagram:e}},"loader"),Nkt={id:M_e,detector:Lkt,loader:Mkt},N_e=Nkt;St();ps();Di();var Ikt=o((e,t,r)=>{Z.debug(`rendering svg for syntax error +`);let i=bi(t),n=i.append("g");i.attr("viewBox","0 0 2412 512"),Br(i,100,512,!0),n.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),n.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),n.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),n.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),n.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),n.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),n.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),n.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),VW={draw:Ikt},I_e=VW;var Okt={db:{},renderer:VW,parser:{parse:o(()=>{},"parse")}},O_e=Okt;var P_e="flowchart-elk",Pkt=o((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),Bkt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(dE(),hE));return{id:P_e,diagram:e}},"loader"),Fkt={id:P_e,detector:Pkt,loader:Bkt},B_e=Fkt;var v7e="timeline",cwt=o(e=>/^\s*timeline/.test(e),"detector"),uwt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(y7e(),g7e));return{id:v7e,diagram:e}},"loader"),hwt={id:v7e,detector:cwt,loader:uwt},x7e=hwt;var P7e="mindmap",bwt=o(e=>/^\s*mindmap/.test(e),"detector"),Twt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(O7e(),I7e));return{id:P7e,diagram:e}},"loader"),Cwt={id:P7e,detector:bwt,loader:Twt},B7e=Cwt;var X7e="kanban",Fwt=o(e=>/^\s*kanban/.test(e),"detector"),$wt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(j7e(),Y7e));return{id:X7e,diagram:e}},"loader"),zwt={id:X7e,detector:Fwt,loader:$wt},K7e=zwt;var LDe="sankey",u4t=o(e=>/^\s*sankey(-beta)?/.test(e),"detector"),h4t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(RDe(),DDe));return{id:LDe,diagram:e}},"loader"),d4t={id:LDe,detector:u4t,loader:h4t},MDe=d4t;var zDe="packet",T4t=o(e=>/^\s*packet(-beta)?/.test(e),"detector"),C4t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>($De(),FDe));return{id:zDe,diagram:e}},"loader"),GDe={id:zDe,detector:T4t,loader:C4t};var QDe="radar",q4t=o(e=>/^\s*radar-beta/.test(e),"detector"),U4t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(ZDe(),KDe));return{id:QDe,diagram:e}},"loader"),JDe={id:QDe,detector:q4t,loader:U4t};var rRe="block",m3t=o(e=>/^\s*block(-beta)?/.test(e),"detector"),g3t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(tRe(),eRe));return{id:rRe,diagram:e}},"loader"),y3t={id:rRe,detector:m3t,loader:g3t},iRe=y3t;var fRe="treeView",N3t=o(e=>/^\s*treeView-beta/.test(e),"detector"),I3t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(dRe(),hRe));return{id:fRe,diagram:e}},"loader"),O3t={id:fRe,detector:N3t,loader:I3t},pRe=O3t;var PRe="architecture",K3t=o(e=>/^\s*architecture/.test(e),"detector"),Z3t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(ORe(),IRe));return{id:PRe,diagram:e}},"loader"),Q3t={id:PRe,detector:K3t,loader:Z3t},BRe=Q3t;var KRe="eventmodeling",PEt=o(e=>/^\s*eventmodeling/.test(e),"detector"),BEt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(XRe(),jRe));return{id:KRe,diagram:e}},"loader"),FEt={id:KRe,detector:PEt,loader:BEt},ZRe=FEt;var pLe="ishikawa",ZEt=o(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),QEt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(fLe(),dLe));return{id:pLe,diagram:e}},"loader"),mLe={id:pLe,detector:ZEt,loader:QEt};var ULe="venn",O5t=o(e=>/^\s*venn-beta/.test(e),"detector"),P5t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(qLe(),WLe));return{id:ULe,diagram:e}},"loader"),B5t={id:ULe,detector:O5t,loader:P5t},HLe=B5t;Xf();Ut();var rMe="treemap",H5t=o(e=>/^\s*treemap/.test(e),"detector"),Y5t=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(tMe(),eMe));return{id:rMe,diagram:e}},"loader"),iMe={id:rMe,detector:H5t,loader:Y5t};var mMe="wardley-beta",vAt=o(e=>/^\s*wardley-beta/i.test(e),"detector"),xAt=o(async()=>{let{diagram:e}=await Promise.resolve().then(()=>(pMe(),fMe));return{id:mMe,diagram:e}},"loader"),bAt={id:mMe,detector:vAt,loader:xAt},gMe=bAt;var yMe=!1,Vy=o(()=>{yMe||(yMe=!0,Kf("error",O_e,e=>e.toLowerCase().trim()==="error"),Kf("---",{db:{clear:o(()=>{},"clear")},styles:{},renderer:{draw:o(()=>{},"draw")},parser:{parse:o(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:o(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),Cv(B_e,B7e,BRe),Cv(ute,K7e,I6e,R6e,p1e,z5e,K5e,sAe,n6e,k6e,n1e,r1e,x7e,o5e,y_e,f_e,N_e,bAe,MDe,GDe,jAe,iRe,ZRe,pRe,JDe,mLe,iMe,HLe,gMe))},"addDiagrams");St();Xf();Ut();var vMe=o(async()=>{Z.debug("Loading registered diagrams");let t=(await Promise.allSettled(Object.entries(ku).map(async([r,{detector:i,loader:n}])=>{if(n)try{_v(r)}catch{try{let{diagram:a,id:s}=await n();Kf(s,a,i)}catch(a){throw Z.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete ku[r],a}}}))).filter(r=>r.status==="rejected");if(t.length>0){Z.error(`Failed to load ${t.length} external diagrams`);for(let r of t)Z.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams");St();Rr();var Wy="comm",I_="rule",O_="decl";var xMe="@media",bMe="@import";var TMe="@supports";var CMe="@namespace",gC="@keyframes";var P_="@layer",kMe="@scope";var TU=Math.abs,yC=String.fromCharCode;function B_(e){return e.trim()}o(B_,"trim");function qy(e,t,r){return e.replace(t,r)}o(qy,"replace");function wMe(e,t,r){return e.indexOf(t,r)}o(wMe,"indexof");function Lh(e,t){return e.charCodeAt(t)|0}o(Lh,"charat");function Mh(e,t,r){return e.slice(t,r)}o(Mh,"substr");function Ks(e){return e.length}o(Ks,"strlen");function F_(e){return e.length}o(F_,"sizeof");function Uy(e,t){return t.push(e),e}o(Uy,"append");var $_=1,Hy=1,SMe=0,ul=0,Nn=0,jy="";function z_(e,t,r,i,n,a,s,l){return{value:e,root:t,parent:r,type:i,props:n,children:a,line:$_,column:Hy,length:s,return:"",siblings:l}}o(z_,"node");function EMe(){return Nn}o(EMe,"char");function AMe(){return Nn=ul>0?Lh(jy,--ul):0,Hy--,Nn===10&&(Hy=1,$_--),Nn}o(AMe,"prev");function hl(){return Nn=ul2||Yy(Nn)>3?"":" "}o(RMe,"whitespace");function LMe(e,t){for(;--t&&hl()&&!(Nn<48||Nn>102||Nn>57&&Nn<65||Nn>70&&Nn<97););return G_(e,vC()+(t<6&&Nh()==32&&hl()==32))}o(LMe,"escaping");function CU(e){for(;hl();)switch(Nn){case e:return ul;case 34:case 39:e!==34&&e!==39&&CU(Nn);break;case 40:e===41&&CU(e);break;case 92:hl();break}return ul}o(CU,"delimiter");function MMe(e,t){for(;hl()&&e+Nn!==57;)if(e+Nn===84&&Nh()===47)break;return"/*"+G_(t,ul-1)+"*"+yC(e===47?e:hl())}o(MMe,"commenter");function NMe(e){for(;!Yy(Nh());)hl();return G_(e,ul)}o(NMe,"identifier");function PMe(e){return DMe(W_("",null,null,null,[""],e=_Me(e),0,[0],e))}o(PMe,"compile");function W_(e,t,r,i,n,a,s,l,u){for(var h=0,d=0,f=s,p=0,m=0,g=0,y=1,v=1,x=1,b=0,T="",w=n,C=a,k=i,E=T;v;)switch(g=b,b=hl()){case 40:if(g!=108&&Lh(E,f-1)==58){wMe(E+=qy(V_(b),"&","&\f"),"&\f",TU(h?l[h-1]:0))!=-1&&(x=-1);break}case 34:case 39:case 91:E+=V_(b);break;case 9:case 10:case 13:case 32:E+=RMe(g);break;case 92:E+=LMe(vC()-1,7);continue;case 47:switch(Nh()){case 42:case 47:Uy(CAt(MMe(hl(),vC()),t,r,u),u),(Yy(g||1)==5||Yy(Nh()||1)==5)&&Ks(E)&&Mh(E,-1,void 0)!==" "&&(E+=" ");break;default:E+="/"}break;case 123*y:l[h++]=Ks(E)*x;case 125*y:case 59:case 0:switch(b){case 0:case 125:v=0;case 59+d:x==-1&&(E=qy(E,/\f/g,"")),m>0&&(Ks(E)-f||y===0&&g===47)&&Uy(m>32?OMe(E+";",i,r,f-1,u):OMe(qy(E," ","")+";",i,r,f-2,u),u);break;case 59:E+=";";default:if(Uy(k=IMe(E,t,r,h,d,n,l,T,w=[],C=[],f,a),a),b===123)if(d===0)W_(E,t,k,k,w,a,f,l,C);else{switch(p){case 99:if(Lh(E,3)===110)break;case 108:if(Lh(E,2)===97)break;default:d=0;case 100:case 109:case 115:}d?W_(e,k,k,i&&Uy(IMe(e,k,k,0,0,n,l,T,n,w=[],f,C),C),n,C,f,l,i?w:C):W_(E,k,k,k,[""],C,0,l,C)}}h=d=m=0,y=x=1,T=E="",f=s;break;case 58:f=1+Ks(E),m=g;default:if(y<1){if(b==123)--y;else if(b==125&&y++==0&&AMe()==125)continue}switch(E+=yC(b),b*y){case 38:x=d>0?1:(E+="\f",-1);break;case 44:l[h++]=(Ks(E)-1)*x,x=1;break;case 64:Nh()===45&&(E+=V_(hl())),p=Nh(),d=f=Ks(T=E+=NMe(vC())),b++;break;case 45:g===45&&Ks(E)==2&&(y=0)}}return a}o(W_,"parse");function IMe(e,t,r,i,n,a,s,l,u,h,d,f){for(var p=n-1,m=n===0?a:[""],g=F_(m),y=0,v=0,x=0;y0?m[b]+" "+T:qy(T,/&\f/g,m[b])))&&(u[x++]=w);return z_(e,t,r,n===0?I_:l,u,h,d,f)}o(IMe,"ruleset");function CAt(e,t,r,i){return z_(e,t,r,Wy,yC(EMe()),Mh(e,2,-2),0,i)}o(CAt,"comment");function OMe(e,t,r,i,n){return z_(e,t,r,O_,Mh(e,0,i),Mh(e,i+1,-1),i,n)}o(OMe,"declaration");function q_(e,t){for(var r="",i=0;i{GMe.forEach(e=>{e()}),GMe=[]},"attachFunctions");St();var WMe=o(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");mk();Wx();function qMe(e){let t=e.match(pk);if(!t)return{text:e,metadata:{}};let r=ld(t[1],{schema:od})??{};r=typeof r=="object"&&!Array.isArray(r)?r:{};let i={};return r.displayMode&&(i.displayMode=r.displayMode.toString()),r.title&&(i.title=r.title.toString()),r.config&&(i.config=r.config),{text:e.slice(t[0].length),metadata:i}}o(qMe,"extractFrontMatter");Xt();var wAt=o(e=>e.replace(/\r\n?/g,` +`).replace(/<(\w+)([^>]*)>/g,(t,r,i)=>"<"+r+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),SAt=o(e=>{let{text:t,metadata:r}=qMe(e),{displayMode:i,title:n,config:a={}}=r;return i&&(a.gantt||(a.gantt={}),a.gantt.displayMode=i),{title:n,config:a,text:t}},"processFrontmatter"),EAt=o(e=>{let t=Zt.detectInit(e)??{},r=Zt.detectDirective(e,"wrap");return Array.isArray(r)?t.wrap=r.some(({type:i})=>i==="wrap"):r?.type==="wrap"&&(t.wrap=!0),{text:Zee(e),directive:t}},"processDirectives");function kU(e){let t=wAt(e),r=SAt(t),i=EAt(r.text),n=Gr(r.config,i.directive);return e=WMe(i.text),{code:e,title:r.title,config:n}}o(kU,"preprocessDiagram");OD();LC();Xt();function UMe(e){let t=new TextEncoder().encode(e),r=Array.from(t,i=>String.fromCodePoint(i)).join("");return btoa(r)}o(UMe,"toBase64");MC();var AAt=5e4,_At="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",DAt="sandbox",RAt="loose",LAt="http://www.w3.org/2000/svg",MAt="http://www.w3.org/1999/xlink",NAt="http://www.w3.org/1999/xhtml",IAt="100%",OAt="100%",PAt="border:0;margin:0;",BAt="margin:0",FAt="allow-top-navigation-by-user-activation allow-popups",$At='The "iframe" tag is not supported by your browser.',zAt=["foreignobject"],GAt=["dominant-baseline"];function XMe(e){let t=kU(e);return iv(),KH(t.config??{}),t}o(XMe,"processAndSetConfigs");async function VAt(e,t){Vy();try{let{code:r,config:i}=XMe(e);return{diagramType:(await KMe(r)).type,config:i}}catch(r){if(t?.suppressErrors)return!1;throw r}}o(VAt,"parse");var HMe=o((e,t,r=[])=>{let i=A7(`{ ${r.join(" !important; ")} !important; }`);return`.${e} ${t} ${i}`},"cssImportantStyles"),WAt=o((e,t=new Map)=>{let r=new CSSStyleSheet;if(e.fontFamily!==void 0&&r.insertRule(`:root { --mermaid-font-family: ${e.fontFamily}}`,r.cssRules.length),e.altFontFamily!==void 0&&r.insertRule(`:root { --mermaid-alt-font-family: ${e.altFontFamily}}`,r.cssRules.length),t instanceof Map){let l=Mr(e)?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(u=>{a4(u.styles)||l.forEach(h=>{r.insertRule(HMe(u.id,h,u.styles),r.cssRules.length)}),a4(u.textStyles)||r.insertRule(HMe(u.id,"tspan",(u?.textStyles||[]).map(h=>h.replace("color","fill"))),r.cssRules.length)})}let i="";if(e.themeCSS!==void 0)if(typeof r.replaceSync=="function"){let n=new CSSStyleSheet;n.replaceSync(e.themeCSS),i=ID(n)+` +`}else i+=`${e.themeCSS} +`;return i+ID(r)},"createCssStyles"),qAt=o((e,t)=>q_(PMe(`${e}{${t}}`),FMe([o(function(i,n,a,s){if(i.type==="rule"&&Array.isArray(i.props)){if(i.parent&&i.parent.type===gC)return;i.props=i.props.map(l=>l.startsWith(e)?l:`${e} ${l}`)}else i.type.startsWith("@")&&([...[xMe,TMe,P_,kMe,"@container","@starting-style"],gC].includes(i.type)||(Z.warn(`Removing unsupported at-rule ${i.type} from CSS`),i.type=Wy))},"addNamespace"),BMe])),"compileCSS"),UAt=o((e,t,r,i)=>{let n=WAt(e,r),a=rX(t,n,{...e.themeVariables,theme:e.theme,look:e.look},i);return qAt(i,a)},"createUserStyles"),HAt=o((e="",t,r)=>{let i=e;return!r&&!t&&(i=i.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),i=Qa(i),i=i.replace(/
    /g,"
    "),i},"cleanUpSvgCode"),YAt=o((e="",t)=>{let r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":OAt,i=UMe(`${e}`);return``},"putIntoIFrame"),YMe=o((e,t,r,i,n)=>{let a=e.append("div");a.attr("id",r),i&&a.attr("style",i);let s=a.append("svg").attr("id",t).attr("width","100%").attr("xmlns",LAt);return n&&s.attr("xmlns:xlink",n),s.append("g"),e},"appendDivSvgG");function jMe(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}o(jMe,"sandboxedIframe");var jAt=o((e,t,r,i)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(i)?.remove()},"removeExistingElements"),XAt=o(async function(e,t,r){Vy();let i=XMe(t);t=i.code;let n=Nt();Z.debug(n),t.length>(n?.maxTextSize??AAt)&&(t=_At);let a=`#${e}`,s="i"+e,l="#"+s,u="d"+e,h="#"+u,d=o(()=>{let _=Je(p?l:h).node();_&&"remove"in _&&_.remove()},"removeTempElements"),f=Je(document.body),p=n.securityLevel===DAt,m=n.securityLevel===RAt,g=n.fontFamily;if(r!==void 0){if(r&&(r.innerHTML=""),p){let D=jMe(Je(r),s);f=Je(D.nodes()[0].contentDocument.body),f.node().style.margin="0"}else f=Je(r);YMe(f,e,u,`font-family: ${g}`,MAt)}else{if(jAt(document,e,u,s),p){let D=jMe(Je(document.body),s);f=Je(D.nodes()[0].contentDocument.body),f.node().style.margin="0"}else f=Je("body");YMe(f,e,u)}let y,v;try{y=await Xy.fromText(t,{title:i.title})}catch(D){if(n.suppressErrorRendering)throw d(),D;y=await Xy.fromText("error"),v=D}let x=f.select(h).node(),b=y.type,T=x.firstChild,w=T.firstChild,C=y.renderer.getClasses?.(t,y),k=UAt(n,b,C,a),E=document.createElement("style");E.innerHTML=k,T.insertBefore(E,w);try{await y.renderer.draw(t,e,"11.15.0",y)}catch(D){throw n.suppressErrorRendering?d():I_e.draw(t,e,"11.15.0"),D}let A=f.select(`${h} svg`),N=y.db.getAccTitle?.(),P=y.db.getAccDescription?.();ZAt(b,A,N,P),f.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns",NAt);let I=f.select(h).node().innerHTML;if(Z.debug("config.arrowMarkerAbsolute",n.arrowMarkerAbsolute),I=HAt(I,p,Aa(n.arrowMarkerAbsolute)),p){let D=f.select(h+" svg").node();I=YAt(I,D)}else m||(I=Ro.sanitize(I,{ADD_TAGS:zAt,ADD_ATTR:GAt,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(VMe(),v)throw v;return d(),{diagramType:b,svg:I,bindFunctions:y.db.bindFunctions}},"render");function KAt(e={}){let t=Ai({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),YH(t),t?.theme&&t.theme in _o?t.themeVariables=_o[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=_o.default.getThemeVariables(t.themeVariables));let r=typeof t=="object"?_7(t):D7();Zy(r.logLevel),Vy()}o(KAt,"initialize");var KMe=o((e,t={})=>{let{code:r}=kU(e);return Xy.fromText(r,t)},"getDiagramFromText");function ZAt(e,t,r,i){$Me(t,e),zMe(t,r,i,t.attr("id"))}o(ZAt,"addA11yInfo");var If=Object.freeze({render:XAt,parse:VAt,getDiagramFromText:KMe,initialize:KAt,getConfig:Nt,setConfig:OC,getSiteConfig:D7,updateSiteConfig:jH,reset:o(()=>{iv()},"reset"),globalReset:o(()=>{iv(Ph)},"globalReset"),defaultConfig:Ph});Zy(Nt().logLevel);iv(Nt());tf();Xt();var QAt=o((e,t,r)=>{Z.warn(e),LM(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),ZMe=o(async function(e={querySelector:".mermaid"}){try{await JAt(e)}catch(t){if(LM(t)&&Z.error(t.str),Ih.parseError&&Ih.parseError(t),!e.suppressErrors)throw Z.error("Use the suppressErrors option to suppress these errors"),t}},"run"),JAt=o(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){let i=If.getConfig();Z.debug(`${e?"":"No "}Callback function found`);let n;if(r)n=r;else if(t)n=document.querySelectorAll(t);else throw new Error("Nodes and querySelector are both undefined");Z.debug(`Found ${n.length} diagrams`),i?.startOnLoad!==void 0&&(Z.debug("Start On Load: "+i?.startOnLoad),If.updateSiteConfig({startOnLoad:i?.startOnLoad}));let a=new Zt.InitIDGenerator(i.deterministicIds,i.deterministicIDSeed),s,l=[];for(let u of Array.from(n)){Z.info("Rendering diagram: "+u.id);if(u.getAttribute("data-processed"))continue;u.setAttribute("data-processed","true");let h=`mermaid-${a.next()}`;s=u.innerHTML,s=fk(Zt.entityDecode(s)).trim().replace(//gi,"
    ");let d=Zt.detectInit(s);d&&Z.debug("Detected early reinit: ",d);try{let{svg:f,bindFunctions:p}=await tNe(h,s,u);u.innerHTML=f,e&&await e(h),p&&p(u)}catch(f){QAt(f,l,Ih.parseError)}}if(l.length>0)throw l[0]},"runThrowsErrors"),QMe=o(function(e){If.initialize(e)},"initialize"),e6t=o(async function(e,t,r){Z.warn("mermaid.init is deprecated. Please use run instead."),e&&QMe(e);let i={postRenderCallback:r,querySelector:".mermaid"};typeof t=="string"?i.querySelector=t:t&&(t instanceof HTMLElement?i.nodes=[t]:i.nodes=t),await ZMe(i)},"init"),t6t=o(async(e,{lazyLoad:t=!0}={})=>{Vy(),Cv(...e),t===!1&&await vMe()},"registerExternalDiagrams"),JMe=o(function(){if(Ih.startOnLoad){let{startOnLoad:e}=If.getConfig();e&&Ih.run().catch(t=>Z.error("Mermaid failed to initialize",t))}},"contentLoaded");if(typeof document<"u"){window.addEventListener("load",JMe,!1)}var r6t=o(function(e){Ih.parseError=e},"setParseErrorHandler"),U_=[],wU=!1,eNe=o(async()=>{if(!wU){for(wU=!0;U_.length>0;){let e=U_.shift();if(e)try{await e()}catch(t){Z.error("Error executing queue",t)}}wU=!1}},"executeQueue"),i6t=o(async(e,t)=>new Promise((r,i)=>{let n=o(()=>new Promise((a,s)=>{If.parse(e,t).then(l=>{a(l),r(l)},l=>{Z.error("Error parsing",l),Ih.parseError?.(l),s(l),i(l)})}),"performCall");U_.push(n),eNe().catch(i)}),"parse"),tNe=o((e,t,r)=>new Promise((i,n)=>{let a=o(()=>new Promise((s,l)=>{If.render(e,t,r).then(u=>{s(u),i(u)},u=>{Z.error("Error parsing",u),Ih.parseError?.(u),l(u),n(u)})}),"performCall");U_.push(a),eNe().catch(n)}),"render"),n6t=o(()=>Object.keys(ku).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),Ih={startOnLoad:!0,mermaidAPI:If,parse:i6t,render:tNe,init:e6t,run:ZMe,registerExternalDiagrams:t6t,registerLayoutLoaders:GP,initialize:QMe,parseError:void 0,contentLoaded:JMe,setParseErrorHandler:r6t,detectType:zm,registerIconPacks:dk,getRegisteredDiagramsMetadata:n6t},a6t=Ih;return hNe(s6t);})(); +/*! Bundled license information: + +lodash-es/lodash.js: + (** + * @license + * Lodash (Custom Build) + * Build: `lodash modularize exports="es" -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + *) +*/ +/*! Check if previously processed */ +/*! + * Wait for document loaded before starting the execution + */ +/*! Bundled license information: + +dompurify/dist/purify.es.mjs: + (*! @license DOMPurify 3.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.0/LICENSE *) + +js-yaml/dist/js-yaml.mjs: + (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *) + +lodash-es/lodash.js: + (** + * @license + * Lodash (Custom Build) + * Build: `lodash modularize exports="es" --repo lodash/lodash#4.18.1 -o ./` + * Copyright OpenJS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + *) + +cytoscape/dist/cytoscape.esm.mjs: + (*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + *) + (*! + Event object based on jQuery events, MIT license + + https://jquery.org/license/ + https://tldrlegal.com/license/mit-license + https://github.com/jquery/jquery/blob/master/src/event.js + *) + (*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *) + (*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *) +*/ +globalThis["mermaid"] = globalThis.__esbuild_esm_mermaid_nm["mermaid"].default; diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.min.js.map b/tools/ui/node_modules/mermaid/dist/mermaid.min.js.map new file mode 100644 index 0000000000000000000000000000000000000000..27d1538c0413a12732ad0eae45cd471947a7efe3 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.min.js.map @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0e6a574bcd0191ce05b70ba109de724a1e2da9b581f6f39dd5d2b44f9c83012 +size 12210930 diff --git a/tools/ui/node_modules/mermaid/dist/mermaid.spec.d.ts b/tools/ui/node_modules/mermaid/dist/mermaid.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dfbd63d9f76c4d85e0e28fcc63b1cf6cd5736723 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaid.spec.d.ts @@ -0,0 +1 @@ +import './diagram-api/diagram-orchestration.js'; diff --git a/tools/ui/node_modules/mermaid/dist/mermaidAPI.d.ts b/tools/ui/node_modules/mermaid/dist/mermaidAPI.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..661383d3912ad32e056407fe272b0ce290fc1cee --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaidAPI.d.ts @@ -0,0 +1,94 @@ +import type { MermaidConfig } from './config.type.js'; +import type { DiagramMetadata, DiagramStyleClassDef } from './diagram-api/types.js'; +import { Diagram } from './Diagram.js'; +import type { D3HtmlSelection, ParseOptions, ParseResult, RenderResult } from './types.js'; +/** + * Parse the text and validate the syntax. + * @param text - The mermaid diagram definition. + * @param parseOptions - Options for parsing. @see {@link ParseOptions} + * @returns An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`. + * @throws Error if the diagram is invalid and parseOptions.suppressErrors is false or not set. + */ +declare function parse(text: string, parseOptions: ParseOptions & { + suppressErrors: true; +}): Promise; +declare function parse(text: string, parseOptions?: ParseOptions): Promise; +/** + * Create a CSS style that starts with the given class name, then the element, + * with an enclosing block that has each of the cssClasses followed by !important; + * @param cssClass - CSS class name + * @param element - CSS element + * @param cssClasses - list of CSS styles to append after the element + * @returns - the constructed string + */ +export declare const cssImportantStyles: (cssClass: string, element: string, cssClasses?: string[]) => string; +/** + * Create the user styles + * @internal + * @param config - configuration that has style and theme settings to use + * @param classDefs - the classDefs in the diagram text. Might be null if none were defined. Usually is the result of a call to getClasses(...) + * @returns the string with all the user styles + */ +export declare const createCssStyles: (config: MermaidConfig, classDefs?: Map | null | undefined) => string; +export declare const createUserStyles: (config: MermaidConfig, graphType: string, classDefs: Map | undefined, svgId: `#${string}`) => string; +/** + * Clean up svgCode. Do replacements needed + * + * @param svgCode - the code to clean up + * @param inSandboxMode - security level + * @param useArrowMarkerUrls - should arrow marker's use full urls? (vs. just the anchors) + * @returns the cleaned up svgCode + */ +export declare const cleanUpSvgCode: (svgCode: string | undefined, inSandboxMode: boolean, useArrowMarkerUrls: boolean) => string; +/** + * Put the svgCode into an iFrame. Return the iFrame code + * + * @param svgCode - the svg code to put inside the iFrame + * @param svgElement - the d3 node that has the current svgElement so we can get the height from it + * @returns - the code with the iFrame that now contains the svgCode + */ +export declare const putIntoIFrame: (svgCode?: string, svgElement?: SVGSVGElement) => string; +/** + * Append an enclosing div, then svg, then g (group) to the d3 parentRoot. Set attributes. + * Only set the style attribute on the enclosing div if divStyle is given. + * Only set the xmlns:xlink attribute on svg if svgXlink is given. + * Return the last node appended + * + * @param parentRoot - the d3 node to append things to + * @param id - the value to set the id attr to + * @param enclosingDivId - the id to set the enclosing div to + * @param divStyle - if given, the style to set the enclosing div to + * @param svgXlink - if given, the link to set the new svg element to + * @returns - returns the parentRoot that had nodes appended + */ +export declare const appendDivSvgG: (parentRoot: D3HtmlSelection | D3HtmlSelection, id: string, enclosingDivId: string, divStyle?: string, svgXlink?: string) => D3HtmlSelection | D3HtmlSelection; +/** + * Remove any existing elements from the given document + * + * @param doc - the document to removed elements from + * @param id - id for any existing SVG element + * @param divSelector - selector for any existing enclosing div element + * @param iFrameSelector - selector for any existing iFrame element + */ +export declare const removeExistingElements: (doc: Document, id: string, divId: string, iFrameId: string) => void; +/** + * @param userOptions - Initial Mermaid options + */ +declare function initialize(userOptions?: MermaidConfig): void; +/** + * @internal - Use mermaid.function instead of mermaid.mermaidAPI.function + */ +export declare const mermaidAPI: Readonly<{ + render: (id: string, text: string, svgContainingElement?: Element) => Promise; + parse: typeof parse; + getDiagramFromText: (text: string, metadata?: Pick) => Promise; + initialize: typeof initialize; + getConfig: () => MermaidConfig; + setConfig: (conf: MermaidConfig) => MermaidConfig; + getSiteConfig: () => MermaidConfig; + updateSiteConfig: (conf: MermaidConfig) => MermaidConfig; + reset: () => void; + globalReset: () => void; + defaultConfig: MermaidConfig; +}>; +export default mermaidAPI; diff --git a/tools/ui/node_modules/mermaid/dist/mermaidAPI.spec.d.ts b/tools/ui/node_modules/mermaid/dist/mermaidAPI.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/mermaidAPI.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/preprocess.d.ts b/tools/ui/node_modules/mermaid/dist/preprocess.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e63f384d96ca03bb0d458655003f781e106cedb --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/preprocess.d.ts @@ -0,0 +1,11 @@ +/** + * Preprocess the given code by cleaning it up, extracting front matter and directives, + * cleaning and merging configuration, and removing comments. + * @param code - The code to preprocess. + * @returns The object containing the preprocessed code, title, and configuration. + */ +export declare function preprocessDiagram(code: string): { + code: string; + title: string | undefined; + config: import("./config.type.js").MermaidConfig; +}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/createText.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/createText.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d4f88d3c5ffedbb539cd7c03bee4e3edb88fc786 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/createText.d.ts @@ -0,0 +1,35 @@ +import type { MermaidConfig } from '../config.type.js'; +import type { SVGGroup } from '../diagram-api/types.js'; +import type { D3Selection } from '../types.js'; +export declare function computeDimensionOfText(parentNode: SVGGroup, lineHeight: number, text: string): DOMRect | undefined; +/** + * Convert fontawesome labels into fontawesome icons by using a regex pattern + * @param text - The raw string to convert + * @param config - Mermaid config + * @returns string with fontawesome icons as svg if the icon is registered otherwise as i tags + */ +export declare function replaceIconSubstring(text: string, config?: MermaidConfig): Promise; +/** + * Creates a text element within the given SVG group element. + * + * If `markdown` is `true`, basic markdown syntax will be processed. + * Otherwise, if: + * - `useHtmlLabels` is `true`, the text will be sanitized and set in `` as HTML. + * - `useHtmlLabels` is `false`, the text will be added as a `` element using `.text` + * + * @param el - The parent SVG `` element to append the text element to. + * @param text - The text content to be displayed. + * @param options - Optional options + * @param config - Mermaid configuration object + * @returns The created text element, either a `` or a `` element depending on the options. + */ +export declare const createText: (el: D3Selection, text?: string, { style, isTitle, classes, useHtmlLabels, markdown, isNode, width, addSvgBackground, }?: { + style?: string | undefined; + isTitle?: boolean | undefined; + classes?: string | undefined; + useHtmlLabels?: boolean | undefined; + markdown?: boolean | undefined; + isNode?: boolean | undefined; + width?: number | undefined; + addSvgBackground?: boolean | undefined; +}, config?: MermaidConfig) => Promise; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/createText.spec.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/createText.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/createText.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/handle-markdown-text.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/handle-markdown-text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2ed5caea5cddf4193e6d040bd4f49b58cb8014c2 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/handle-markdown-text.d.ts @@ -0,0 +1,22 @@ +import type { MarkdownLine } from './types.js'; +import type { MermaidConfig } from '../config.type.js'; +/** + * @param nonMarkdownText - Non-markdown text to split into plain-text formatted lines. + * This treats new lines, `\n`, and `
    ` as line breaks, and splits on spaces for words. + * SVG tags are preserved as separate words to maintain proper formatting. + */ +export declare function nonMarkdownToLines(nonMarkdownText: string): MarkdownLine[]; +/** + * @param markdown - markdown to split into lines + */ +export declare function markdownToLines(markdown: string, config?: MermaidConfig): MarkdownLine[]; +/** + * Counterpart to {@link markdownToHTML} for non-markdown text. + * + * Non-markdown text is not wrapped normally, and users can use an explicit `\n` + * sequence to add a line break. + * + * @param text - Non-markdown text to convert to HTML. + */ +export declare function nonMarkdownToHTML(text: string): string; +export declare function markdownToHTML(markdown: string, { markdownAutoWrap }?: MermaidConfig): string; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/handle-markdown-text.spec.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/handle-markdown-text.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/handle-markdown-text.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/icons.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/icons.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9345adfefe70fe0a83de3e237a3d31ad8f8ba2d8 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/icons.d.ts @@ -0,0 +1,17 @@ +import type { IconifyIcon, IconifyJSON } from '@iconify/types'; +import type { IconifyIconCustomisations } from '@iconify/utils'; +export interface AsyncIconLoader { + name: string; + loader: () => Promise; +} +export interface SyncIconLoader { + name: string; + icons: IconifyJSON; +} +export type IconLoader = AsyncIconLoader | SyncIconLoader; +export declare const unknownIcon: IconifyIcon; +export declare const registerIconPacks: (iconLoaders: IconLoader[]) => void; +export declare const isIconAvailable: (iconName: string) => Promise; +export declare const getIconSVG: (iconName: string, customisations?: IconifyIconCustomisations & { + fallbackPrefix?: string; +}, extraAttributes?: Record) => Promise; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/insertElementsForSize.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/insertElementsForSize.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8db1429f8270ba3556bdad7a59828a5d1357f65d --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/insertElementsForSize.d.ts @@ -0,0 +1 @@ +export function getDiagramElement(id: any, securityLevel: any): any; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/labelTransform.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/labelTransform.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be49106db4fd70407a0fd58ef40260b557304030 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/labelTransform.d.ts @@ -0,0 +1,26 @@ +/** + * Bounding box used for label transform computation. + * For SVG getBBox(), x/y may be present; for HTML getBoundingClientRect(), only width/height are used. + */ +export interface LabelBBox { + x?: number; + y?: number; + width: number; + height: number; +} +/** + * Compute the SVG translate transform needed to center a label element at the origin. + * + * For HTML labels, getBoundingClientRect() is used and its x/y are viewport-absolute, + * so only width/height are relevant for centering within the SVG group. + * + * For SVG labels, getBBox() returns coordinates in the element's local coordinate system. + * When addSvgBackground is true, the background extends beyond the text (making + * bbox.x/y negative), so we include those offsets to correctly center the visual + * content at the origin. + * + * @param bbox - The bounding box of the label element + * @param useHtmlLabels - Whether HTML labels are in use + * @returns SVG transform string, e.g. "translate(-20, -10)" + */ +export declare const computeLabelTransform: (bbox: LabelBBox, useHtmlLabels: boolean) => string; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9375479e710b2ab11cf59069abc85909e343c6cc --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.d.ts @@ -0,0 +1,53 @@ +import cytoscape from 'cytoscape'; +import type { LayoutData, Node, Edge } from '../../types.js'; +import type { PositionedNode, PositionedEdge } from './types.js'; +/** + * Declare module augmentation for cytoscape edge types + */ +declare module 'cytoscape' { + interface EdgeSingular { + _private: { + bodyBounds: unknown; + rscratch: { + startX: number; + startY: number; + midX: number; + midY: number; + endX: number; + endY: number; + }; + }; + } +} +/** + * Add nodes to cytoscape instance from provided node array + * This function processes only the nodes provided in the data structure + * @param nodes - Array of nodes to add + * @param cy - The cytoscape instance + */ +export declare function addNodes(nodes: Node[], cy: cytoscape.Core): void; +/** + * Add edges to cytoscape instance from provided edge array + * This function processes only the edges provided in the data structure + * @param edges - Array of edges to add + * @param cy - The cytoscape instance + */ +export declare function addEdges(edges: Edge[], cy: cytoscape.Core): void; +/** + * Create and configure cytoscape instance + * @param data - Layout data containing nodes and edges + * @returns Promise resolving to configured cytoscape instance + */ +export declare function createCytoscapeInstance(data: LayoutData): Promise; +/** + * Extract positioned nodes from cytoscape instance + * @param cy - The cytoscape instance after layout + * @returns Array of positioned nodes + */ +export declare function extractPositionedNodes(cy: cytoscape.Core): PositionedNode[]; +/** + * Extract positioned edges from cytoscape instance + * @param cy - The cytoscape instance after layout + * @returns Array of positioned edges + */ +export declare function extractPositionedEdges(cy: cytoscape.Core): PositionedEdge[]; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.test.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.test.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/index.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e14f5c8c3cc5399be46d242cbbc8f27296694d19 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/index.d.ts @@ -0,0 +1,22 @@ +/** + * Cose-Bilkent Layout Algorithm for Generic Diagrams + * + * This module provides a layout algorithm implementation using Cytoscape + * with the cose-bilkent algorithm for positioning nodes and edges. + * + * The algorithm follows the unified rendering pattern and can be used + * by any diagram type that provides compatible LayoutData. + */ +/** + * Render function for the cose-bilkent layout algorithm + * + * This function follows the unified rendering pattern used by all layout algorithms. + * It takes LayoutData, inserts nodes into DOM, runs the cose-bilkent layout algorithm, + * and renders the positioned elements to the SVG. + * + * @param layoutData - Layout data containing nodes, edges, and configuration + * @param svg - SVG element to render to + * @param helpers - Internal helper functions for rendering + * @param options - Rendering options + */ +export declare const render: (data4Layout: import("../../types.js").LayoutData, svg: import("../../../mermaid.js").SVG, { insertCluster, insertEdge, insertEdgeLabel, insertMarkers, insertNode, log, positionEdgeLabel, }: import("../../../internals.js").InternalHelpers, { algorithm: _algorithm }: import("../../render.js").RenderOptions) => Promise; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2940df2158f29617b92eb68d1bf08a3ba9e145b9 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.d.ts @@ -0,0 +1,20 @@ +import type { MermaidConfig } from '../../../config.type.js'; +import type { LayoutData } from '../../types.js'; +import type { LayoutResult } from './types.js'; +/** + * Execute the cose-bilkent layout algorithm on generic layout data + * + * This function takes layout data and uses Cytoscape with the cose-bilkent + * algorithm to calculate optimal node positions and edge paths. + * + * @param data - The layout data containing nodes, edges, and configuration + * @param config - Mermaid configuration object + * @returns Promise resolving to layout result with positioned nodes and edges + */ +export declare function executeCoseBilkentLayout(data: LayoutData, _config: MermaidConfig): Promise; +/** + * Validate layout data structure + * @param data - The data to validate + * @returns True if data is valid, throws error otherwise + */ +export declare function validateLayoutData(data: LayoutData): boolean; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.test.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.test.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/render.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/render.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..26e6d8e0fabdae927561a1ae75c68f5b0f9a9b34 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/render.d.ts @@ -0,0 +1,10 @@ +import type { InternalHelpers, LayoutData, RenderOptions, SVG } from 'mermaid'; +/** + * Render function for cose-bilkent layout algorithm + * + * This follows the same pattern as ELK and dagre renderers: + * 1. Insert nodes into DOM to get their actual dimensions + * 2. Run the layout algorithm to calculate positions + * 3. Position the nodes and edges based on layout results + */ +export declare const render: (data4Layout: LayoutData, svg: SVG, { insertCluster, insertEdge, insertEdgeLabel, insertMarkers, insertNode, log, positionEdgeLabel, }: InternalHelpers, { algorithm: _algorithm }: RenderOptions) => Promise; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/types.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0ffbd00ad9baf11e0817ff48a88bf67a6e30d627 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/types.d.ts @@ -0,0 +1,40 @@ +/** + * Positioned node after layout calculation + */ +export interface PositionedNode { + id: string; + x: number; + y: number; + [key: string]: unknown; +} +/** + * Positioned edge after layout calculation + */ +export interface PositionedEdge { + id: string; + source: string; + target: string; + startX: number; + startY: number; + midX: number; + midY: number; + endX: number; + endY: number; + [key: string]: unknown; +} +/** + * Result of layout algorithm execution + */ +export interface LayoutResult { + nodes: PositionedNode[]; + edges: PositionedEdge[]; +} +/** + * Cytoscape layout configuration + */ +export interface CytoscapeLayoutConfig { + name: 'cose-bilkent'; + quality: 'proof'; + styleEnabled: boolean; + animate: boolean; +} diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/index.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..32cd656c010b530bf4d96b4f8bb6f2227acd204b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/index.d.ts @@ -0,0 +1 @@ +export function render(data4Layout: any, svg: any): Promise; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/mermaid-graphlib.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/mermaid-graphlib.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e245dbcb192e5b6927446246cb360445e449ccdb --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/mermaid-graphlib.d.ts @@ -0,0 +1,8 @@ +export let clusterDb: Map; +export function clear(): void; +export function extractDescendants(id: any, graph: any): any[]; +export function validate(graph: any): boolean; +export function findNonClusterChild(id: any, graph: any, clusterId: any): any; +export function adjustClustersAndEdges(graph: any, depth: any): void; +export function extractor(graph: any, depth: any): void; +export function sortNodesByHierarchy(graph: any): any; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/multi-diagram-id-uniqueness.spec.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/multi-diagram-id-uniqueness.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/multi-diagram-id-uniqueness.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/render.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/render.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0050d268574f247d68b7496e7ec64ede70a40f29 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/render.d.ts @@ -0,0 +1,23 @@ +import type { SVG } from '../diagram-api/types.js'; +import type { InternalHelpers } from '../internals.js'; +import type { LayoutData } from './types.js'; +export interface RenderOptions { + algorithm?: string; +} +export interface LayoutAlgorithm { + render(layoutData: LayoutData, svg: SVG, helpers: InternalHelpers, options?: RenderOptions): Promise; +} +export type LayoutLoader = () => Promise; +export interface LayoutLoaderDefinition { + name: string; + loader: LayoutLoader; + algorithm?: string; +} +export declare const registerLayoutLoaders: (loaders: LayoutLoaderDefinition[]) => void; +export declare const render: (data4Layout: LayoutData, svg: SVG) => Promise; +/** + * Get the registered layout algorithm. If the algorithm is not registered, use the fallback algorithm. + */ +export declare const getRegisteredLayoutAlgorithm: (algorithm?: string, { fallback }?: { + fallback?: string | undefined; +}) => string; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/clusters.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/clusters.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..48dca42b9962073a9b0221857684cf3743394d04 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/clusters.d.ts @@ -0,0 +1,42 @@ +export function insertCluster(elem: any, node: import("../types.js").ClusterNode): Promise; +export function getClusterTitleWidth(elem: any, node: any): any; +export function clear(): void; +export function positionCluster(node: any): void; +export type ClusterShapeID = keyof typeof shapes; +declare namespace shapes { + export { rect }; + export { squareRect }; + export { roundedWithTitle }; + export { noteGroup }; + export { divider }; + export { kanbanSection }; +} +declare function rect(parent: any, node: any): Promise<{ + cluster: any; + labelBBox: DOMRect; +}>; +declare function squareRect(parent: any, node: any): Promise<{ + cluster: any; + labelBBox: DOMRect; +}>; +declare function roundedWithTitle(parent: any, node: any): Promise<{ + cluster: any; + labelBBox: DOMRect; +}>; +/** + * Non visible cluster where the note is group with its + * + * @param {any} parent + * @param {any} node + * @returns {any} ShapeSvg + */ +declare function noteGroup(parent: any, node: any): any; +declare function divider(parent: any, node: any): { + cluster: any; + labelBBox: {}; +}; +declare function kanbanSection(parent: any, node: any): Promise<{ + cluster: any; + labelBBox: DOMRect; +}>; +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/createLabel.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/createLabel.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..83c073e4c014bde0de6a494b324b996a2899a123 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/createLabel.d.ts @@ -0,0 +1,28 @@ +export default createLabel; +/** + * @param {import('../../types.js').D3Selection} element - The parent element to which the label will be appended. + * @param {string | [string] | undefined} _vertexText - The text content of the label. + * @param {string} style + * @param {boolean} [isTitle] - If `true`, style this as a title label, else as a normal label. + * @param {boolean} [isNode] - If `true`, style this as a node label, else as an edge label. + * @deprecated svg-util/createText instead + * + * @example + * + * If `getEffectiveHtmlLabels(getConfig())` is `true`, you must reset the width + * and height of the created label after creation, like this: + * + * ```js + * const labelElement = await createLabel(parent, ... ); + * let slBox = labelElement.getBBox(); + * if (useHtmlLabels) { + * const div = labelElement.children[0]; + * const dv = select(labelElement); + * slBox = div.getBoundingClientRect(); + * dv.attr('width', slBox.width); + * dv.attr('height', slBox.height); + * } + * parent.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')'); + * ``` + */ +declare function createLabel(element: import("../../types.js").D3Selection, _vertexText: string | [string] | undefined, style: string, isTitle?: boolean, isNode?: boolean): Promise; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/edgeMarker.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/edgeMarker.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0dc2f59d2601a7079806111ca9c1f905e2388364 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/edgeMarker.d.ts @@ -0,0 +1,12 @@ +import type { SVG } from '../../diagram-api/types.js'; +import type { EdgeData } from '../../types.js'; +/** + * Adds SVG markers to a path element based on the arrow types specified in the edge. + * + * @param svgPath - The SVG path element to add markers to. + * @param edge - The edge data object containing the arrow types. + * @param url - The URL of the SVG marker definitions. + * @param id - The ID prefix for the SVG marker definitions. + * @param diagramType - The type of diagram being rendered. + */ +export declare const addEdgeMarkers: (svgPath: SVG, edge: Pick, url: string, id: string, diagramType: string, useMargin?: boolean, strokeColor?: string) => void; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/edgeMarker.spec.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/edgeMarker.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/edgeMarker.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/edges.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/edges.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..61265cc04db4099c5b33a8baa32da01ffe1f9f29 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/edges.d.ts @@ -0,0 +1,18 @@ +export function resolveEdgeCurveType(edgeCurve: any): string | undefined; +export const edgeLabels: Map; +export const terminalLabels: Map; +export function clear(): void; +export function getLabelStyles(styleArray: any): any; +export function insertEdgeLabel(elem: any, edge: any): Promise; +export function positionEdgeLabel(edge: any, paths: any): void; +export function intersection(node: any, outsidePoint: any, insidePoint: any): { + x: any; + y: number; +} | { + x: number; + y: any; +}; +export function insertEdge(elem: any, edge: any, clusterDb: any, diagramType: any, startNode: any, endNode: any, diagramId: any, skipIntersect?: boolean): { + updatedPath: any; + originalPath: any; +}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/index.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..759b5ce974bc71e7cff66df9918b31d5cca31df1 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/index.d.ts @@ -0,0 +1,13 @@ +declare namespace _default { + export { node }; + export { circle }; + export { ellipse }; + export { polygon }; + export { rect }; +} +export default _default; +import node from './intersect-node.js'; +import circle from './intersect-circle.js'; +import ellipse from './intersect-ellipse.js'; +import polygon from './intersect-polygon.js'; +import rect from './intersect-rect.js'; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-circle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-circle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..48b65ba75c60ccc91cae7184551270dc6809c138 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-circle.d.ts @@ -0,0 +1,5 @@ +export default intersectCircle; +declare function intersectCircle(node: any, rx: any, point: any): { + x: any; + y: any; +}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-ellipse.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-ellipse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b7cd4021a7addbb5dbea66fe4dfbaf7554476671 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-ellipse.d.ts @@ -0,0 +1,5 @@ +export default intersectEllipse; +declare function intersectEllipse(node: any, rx: any, ry: any, point: any): { + x: any; + y: any; +}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-line.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-line.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8c302c7b647755fdea884f4214a4ae00c0d94903 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-line.d.ts @@ -0,0 +1,8 @@ +export default intersectLine; +/** + * Returns the point at which two lines, p and q, intersect or returns undefined if they do not intersect. + */ +declare function intersectLine(p1: any, p2: any, q1: any, q2: any): { + x: number; + y: number; +} | undefined; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-node.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-node.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d969898b928d9495c56dc4d6c908392597f3ee0a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-node.d.ts @@ -0,0 +1,2 @@ +export default intersectNode; +declare function intersectNode(node: any, point: any): any; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-polygon.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-polygon.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c10558eebe4068de2a681d5248bb4cc46132c9ed --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-polygon.d.ts @@ -0,0 +1,6 @@ +export default intersectPolygon; +/** + * Returns the point ({x, y}) at which the point argument intersects with the node argument assuming + * that it has the shape specified by polygon. + */ +declare function intersectPolygon(node: any, polyPoints: any, point: any): any; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-rect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-rect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..53913d4cead9416a7226843e3a511dc292935967 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/intersect/intersect-rect.d.ts @@ -0,0 +1,5 @@ +export default intersectRect; +declare function intersectRect(node: any, point: any): { + x: any; + y: any; +}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/markers.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/markers.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..253e8f2d4ffaf799533bceea7747420677d08d72 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/markers.d.ts @@ -0,0 +1,2 @@ +export default insertMarkers; +declare function insertMarkers(elem: any, markerArray: any, type: any, id: any): void; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/nodes.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/nodes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5c4e2217a6d56435bbf5420463bbd91e3e53fa36 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/nodes.d.ts @@ -0,0 +1,12 @@ +import { shapes } from './shapes.js'; +import type { Node, NonClusterNode, ShapeRenderOptions } from '../types.js'; +import type { SVGGroup } from '../../mermaid.js'; +import type { D3Selection } from '../../types.js'; +import type { graphlib } from 'dagre-d3-es'; +type ShapeHandler = (typeof shapes)[keyof typeof shapes]; +type NodeElement = D3Selection | Awaited>; +export declare function insertNode(elem: SVGGroup, node: NonClusterNode, renderOptions: ShapeRenderOptions): Promise | D3Selection>; +export declare const setNodeElem: (elem: NodeElement, node: Pick) => void; +export declare const clear: () => void; +export declare const positionNode: (node: ReturnType) => any; +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/nodes.spec.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/nodes.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/nodes.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c751223643ed86a813d69ab3cded910c2717bb60 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes.d.ts @@ -0,0 +1,430 @@ +import type { D3Selection, MaybePromise } from '../../types.js'; +import type { Node, ShapeRenderOptions } from '../types.js'; +import { anchor } from './shapes/anchor.js'; +import { bowTieRect } from './shapes/bowTieRect.js'; +import { card } from './shapes/card.js'; +import { choice } from './shapes/choice.js'; +import { circle } from './shapes/circle.js'; +import { crossedCircle } from './shapes/crossedCircle.js'; +import { curlyBraceLeft } from './shapes/curlyBraceLeft.js'; +import { curlyBraceRight } from './shapes/curlyBraceRight.js'; +import { curlyBraces } from './shapes/curlyBraces.js'; +import { curvedTrapezoid } from './shapes/curvedTrapezoid.js'; +import { cylinder } from './shapes/cylinder.js'; +import { datastore } from './shapes/datastore.js'; +import { dividedRectangle } from './shapes/dividedRect.js'; +import { doublecircle } from './shapes/doubleCircle.js'; +import { filledCircle } from './shapes/filledCircle.js'; +import { flippedTriangle } from './shapes/flippedTriangle.js'; +import { forkJoin } from './shapes/forkJoin.js'; +import { halfRoundedRectangle } from './shapes/halfRoundedRectangle.js'; +import { hexagon } from './shapes/hexagon.js'; +import { hourglass } from './shapes/hourglass.js'; +import { icon } from './shapes/icon.js'; +import { iconCircle } from './shapes/iconCircle.js'; +import { iconRounded } from './shapes/iconRounded.js'; +import { iconSquare } from './shapes/iconSquare.js'; +import { imageSquare } from './shapes/imageSquare.js'; +import { inv_trapezoid } from './shapes/invertedTrapezoid.js'; +import { labelRect } from './shapes/labelRect.js'; +import { lean_left } from './shapes/leanLeft.js'; +import { lean_right } from './shapes/leanRight.js'; +import { lightningBolt } from './shapes/lightningBolt.js'; +import { linedCylinder } from './shapes/linedCylinder.js'; +import { linedWaveEdgedRect } from './shapes/linedWaveEdgedRect.js'; +import { multiRect } from './shapes/multiRect.js'; +import { multiWaveEdgedRectangle } from './shapes/multiWaveEdgedRectangle.js'; +import { note } from './shapes/note.js'; +import { question } from './shapes/question.js'; +import { rect_left_inv_arrow } from './shapes/rectLeftInvArrow.js'; +import { rectWithTitle } from './shapes/rectWithTitle.js'; +import { roundedRect } from './shapes/roundedRect.js'; +import { shadedProcess } from './shapes/shadedProcess.js'; +import { slopedRect } from './shapes/slopedRect.js'; +import { squareRect } from './shapes/squareRect.js'; +import { stadium } from './shapes/stadium.js'; +import { state } from './shapes/state.js'; +import { stateEnd } from './shapes/stateEnd.js'; +import { stateStart } from './shapes/stateStart.js'; +import { subroutine } from './shapes/subroutine.js'; +import { taggedRect } from './shapes/taggedRect.js'; +import { taggedWaveEdgedRectangle } from './shapes/taggedWaveEdgedRectangle.js'; +import { text } from './shapes/text.js'; +import { tiltedCylinder } from './shapes/tiltedCylinder.js'; +import { trapezoid } from './shapes/trapezoid.js'; +import { trapezoidalPentagon } from './shapes/trapezoidalPentagon.js'; +import { triangle } from './shapes/triangle.js'; +import { waveEdgedRectangle } from './shapes/waveEdgedRectangle.js'; +import { waveRectangle } from './shapes/waveRectangle.js'; +import { windowPane } from './shapes/windowPane.js'; +import { erBox } from './shapes/erBox.js'; +import { classBox } from './shapes/classBox.js'; +import { requirementBox } from './shapes/requirementBox.js'; +import { kanbanItem } from './shapes/kanbanItem.js'; +import { bang } from './shapes/bang.js'; +import { cloud } from './shapes/cloud.js'; +import { defaultMindmapNode } from './shapes/defaultMindmapNode.js'; +import { mindmapCircle } from './shapes/mindmapCircle.js'; +type ShapeHandler = (parent: D3Selection, node: Node, options: ShapeRenderOptions) => MaybePromise>; +export interface ShapeDefinition { + semanticName: string; + name: string; + shortName: string; + description: string; + /** + * Aliases can include descriptive names, other short names, etc. + */ + aliases?: string[]; + /** + * These are names used by mermaid before the introduction of new shapes. These will not be in standard formats, and shouldn't be used by the users + */ + internalAliases?: string[]; + handler: ShapeHandler; +} +export declare const shapesDefs: [{ + readonly semanticName: "Process"; + readonly name: "Rectangle"; + readonly shortName: "rect"; + readonly description: "Standard process shape"; + readonly aliases: ["proc", "process", "rectangle"]; + readonly internalAliases: ["squareRect"]; + readonly handler: typeof squareRect; +}, { + readonly semanticName: "Event"; + readonly name: "Rounded Rectangle"; + readonly shortName: "rounded"; + readonly description: "Represents an event"; + readonly aliases: ["event"]; + readonly internalAliases: ["roundedRect"]; + readonly handler: typeof roundedRect; +}, { + readonly semanticName: "Terminal Point"; + readonly name: "Stadium"; + readonly shortName: "stadium"; + readonly description: "Terminal point"; + readonly aliases: ["terminal", "pill"]; + readonly handler: typeof stadium; +}, { + readonly semanticName: "Subprocess"; + readonly name: "Framed Rectangle"; + readonly shortName: "fr-rect"; + readonly description: "Subprocess"; + readonly aliases: ["subprocess", "subproc", "framed-rectangle", "subroutine"]; + readonly handler: typeof subroutine; +}, { + readonly semanticName: "Database"; + readonly name: "Cylinder"; + readonly shortName: "cyl"; + readonly description: "Database storage"; + readonly aliases: ["db", "database", "cylinder"]; + readonly handler: typeof cylinder; +}, { + readonly semanticName: "Data Store"; + readonly name: "Data Store"; + readonly shortName: "datastore"; + readonly description: "Data flow diagram data store"; + readonly aliases: ["data-store"]; + readonly handler: typeof datastore; +}, { + readonly semanticName: "Start"; + readonly name: "Circle"; + readonly shortName: "circle"; + readonly description: "Starting point"; + readonly aliases: ["circ"]; + readonly handler: typeof circle; +}, { + readonly semanticName: "Bang"; + readonly name: "Bang"; + readonly shortName: "bang"; + readonly description: "Bang"; + readonly aliases: ["bang"]; + readonly handler: typeof bang; +}, { + readonly semanticName: "Cloud"; + readonly name: "Cloud"; + readonly shortName: "cloud"; + readonly description: "cloud"; + readonly aliases: ["cloud"]; + readonly handler: typeof cloud; +}, { + readonly semanticName: "Decision"; + readonly name: "Diamond"; + readonly shortName: "diam"; + readonly description: "Decision-making step"; + readonly aliases: ["decision", "diamond", "question"]; + readonly handler: typeof question; +}, { + readonly semanticName: "Prepare Conditional"; + readonly name: "Hexagon"; + readonly shortName: "hex"; + readonly description: "Preparation or condition step"; + readonly aliases: ["hexagon", "prepare"]; + readonly handler: typeof hexagon; +}, { + readonly semanticName: "Data Input/Output"; + readonly name: "Lean Right"; + readonly shortName: "lean-r"; + readonly description: "Represents input or output"; + readonly aliases: ["lean-right", "in-out"]; + readonly internalAliases: ["lean_right"]; + readonly handler: typeof lean_right; +}, { + readonly semanticName: "Data Input/Output"; + readonly name: "Lean Left"; + readonly shortName: "lean-l"; + readonly description: "Represents output or input"; + readonly aliases: ["lean-left", "out-in"]; + readonly internalAliases: ["lean_left"]; + readonly handler: typeof lean_left; +}, { + readonly semanticName: "Priority Action"; + readonly name: "Trapezoid Base Bottom"; + readonly shortName: "trap-b"; + readonly description: "Priority action"; + readonly aliases: ["priority", "trapezoid-bottom", "trapezoid"]; + readonly handler: typeof trapezoid; +}, { + readonly semanticName: "Manual Operation"; + readonly name: "Trapezoid Base Top"; + readonly shortName: "trap-t"; + readonly description: "Represents a manual task"; + readonly aliases: ["manual", "trapezoid-top", "inv-trapezoid"]; + readonly internalAliases: ["inv_trapezoid"]; + readonly handler: typeof inv_trapezoid; +}, { + readonly semanticName: "Stop"; + readonly name: "Double Circle"; + readonly shortName: "dbl-circ"; + readonly description: "Represents a stop point"; + readonly aliases: ["double-circle"]; + readonly internalAliases: ["doublecircle"]; + readonly handler: typeof doublecircle; +}, { + readonly semanticName: "Text Block"; + readonly name: "Text Block"; + readonly shortName: "text"; + readonly description: "Text block"; + readonly handler: typeof text; +}, { + readonly semanticName: "Card"; + readonly name: "Notched Rectangle"; + readonly shortName: "notch-rect"; + readonly description: "Represents a card"; + readonly aliases: ["card", "notched-rectangle"]; + readonly handler: typeof card; +}, { + readonly semanticName: "Lined/Shaded Process"; + readonly name: "Lined Rectangle"; + readonly shortName: "lin-rect"; + readonly description: "Lined process shape"; + readonly aliases: ["lined-rectangle", "lined-process", "lin-proc", "shaded-process"]; + readonly handler: typeof shadedProcess; +}, { + readonly semanticName: "Start"; + readonly name: "Small Circle"; + readonly shortName: "sm-circ"; + readonly description: "Small starting point"; + readonly aliases: ["start", "small-circle"]; + readonly internalAliases: ["stateStart"]; + readonly handler: typeof stateStart; +}, { + readonly semanticName: "Stop"; + readonly name: "Framed Circle"; + readonly shortName: "fr-circ"; + readonly description: "Stop point"; + readonly aliases: ["stop", "framed-circle"]; + readonly internalAliases: ["stateEnd"]; + readonly handler: typeof stateEnd; +}, { + readonly semanticName: "Fork/Join"; + readonly name: "Filled Rectangle"; + readonly shortName: "fork"; + readonly description: "Fork or join in process flow"; + readonly aliases: ["join"]; + readonly internalAliases: ["forkJoin"]; + readonly handler: typeof forkJoin; +}, { + readonly semanticName: "Collate"; + readonly name: "Hourglass"; + readonly shortName: "hourglass"; + readonly description: "Represents a collate operation"; + readonly aliases: ["hourglass", "collate"]; + readonly handler: typeof hourglass; +}, { + readonly semanticName: "Comment"; + readonly name: "Curly Brace"; + readonly shortName: "brace"; + readonly description: "Adds a comment"; + readonly aliases: ["comment", "brace-l"]; + readonly handler: typeof curlyBraceLeft; +}, { + readonly semanticName: "Comment Right"; + readonly name: "Curly Brace"; + readonly shortName: "brace-r"; + readonly description: "Adds a comment"; + readonly handler: typeof curlyBraceRight; +}, { + readonly semanticName: "Comment with braces on both sides"; + readonly name: "Curly Braces"; + readonly shortName: "braces"; + readonly description: "Adds a comment"; + readonly handler: typeof curlyBraces; +}, { + readonly semanticName: "Com Link"; + readonly name: "Lightning Bolt"; + readonly shortName: "bolt"; + readonly description: "Communication link"; + readonly aliases: ["com-link", "lightning-bolt"]; + readonly handler: typeof lightningBolt; +}, { + readonly semanticName: "Document"; + readonly name: "Document"; + readonly shortName: "doc"; + readonly description: "Represents a document"; + readonly aliases: ["doc", "document"]; + readonly handler: typeof waveEdgedRectangle; +}, { + readonly semanticName: "Delay"; + readonly name: "Half-Rounded Rectangle"; + readonly shortName: "delay"; + readonly description: "Represents a delay"; + readonly aliases: ["half-rounded-rectangle"]; + readonly handler: typeof halfRoundedRectangle; +}, { + readonly semanticName: "Direct Access Storage"; + readonly name: "Horizontal Cylinder"; + readonly shortName: "h-cyl"; + readonly description: "Direct access storage"; + readonly aliases: ["das", "horizontal-cylinder"]; + readonly handler: typeof tiltedCylinder; +}, { + readonly semanticName: "Disk Storage"; + readonly name: "Lined Cylinder"; + readonly shortName: "lin-cyl"; + readonly description: "Disk storage"; + readonly aliases: ["disk", "lined-cylinder"]; + readonly handler: typeof linedCylinder; +}, { + readonly semanticName: "Display"; + readonly name: "Curved Trapezoid"; + readonly shortName: "curv-trap"; + readonly description: "Represents a display"; + readonly aliases: ["curved-trapezoid", "display"]; + readonly handler: typeof curvedTrapezoid; +}, { + readonly semanticName: "Divided Process"; + readonly name: "Divided Rectangle"; + readonly shortName: "div-rect"; + readonly description: "Divided process shape"; + readonly aliases: ["div-proc", "divided-rectangle", "divided-process"]; + readonly handler: typeof dividedRectangle; +}, { + readonly semanticName: "Extract"; + readonly name: "Triangle"; + readonly shortName: "tri"; + readonly description: "Extraction process"; + readonly aliases: ["extract", "triangle"]; + readonly handler: typeof triangle; +}, { + readonly semanticName: "Internal Storage"; + readonly name: "Window Pane"; + readonly shortName: "win-pane"; + readonly description: "Internal storage"; + readonly aliases: ["internal-storage", "window-pane"]; + readonly handler: typeof windowPane; +}, { + readonly semanticName: "Junction"; + readonly name: "Filled Circle"; + readonly shortName: "f-circ"; + readonly description: "Junction point"; + readonly aliases: ["junction", "filled-circle"]; + readonly handler: typeof filledCircle; +}, { + readonly semanticName: "Loop Limit"; + readonly name: "Trapezoidal Pentagon"; + readonly shortName: "notch-pent"; + readonly description: "Loop limit step"; + readonly aliases: ["loop-limit", "notched-pentagon"]; + readonly handler: typeof trapezoidalPentagon; +}, { + readonly semanticName: "Manual File"; + readonly name: "Flipped Triangle"; + readonly shortName: "flip-tri"; + readonly description: "Manual file operation"; + readonly aliases: ["manual-file", "flipped-triangle"]; + readonly handler: typeof flippedTriangle; +}, { + readonly semanticName: "Manual Input"; + readonly name: "Sloped Rectangle"; + readonly shortName: "sl-rect"; + readonly description: "Manual input step"; + readonly aliases: ["manual-input", "sloped-rectangle"]; + readonly handler: typeof slopedRect; +}, { + readonly semanticName: "Multi-Document"; + readonly name: "Stacked Document"; + readonly shortName: "docs"; + readonly description: "Multiple documents"; + readonly aliases: ["documents", "st-doc", "stacked-document"]; + readonly handler: typeof multiWaveEdgedRectangle; +}, { + readonly semanticName: "Multi-Process"; + readonly name: "Stacked Rectangle"; + readonly shortName: "st-rect"; + readonly description: "Multiple processes"; + readonly aliases: ["procs", "processes", "stacked-rectangle"]; + readonly handler: typeof multiRect; +}, { + readonly semanticName: "Stored Data"; + readonly name: "Bow Tie Rectangle"; + readonly shortName: "bow-rect"; + readonly description: "Stored data"; + readonly aliases: ["stored-data", "bow-tie-rectangle"]; + readonly handler: typeof bowTieRect; +}, { + readonly semanticName: "Summary"; + readonly name: "Crossed Circle"; + readonly shortName: "cross-circ"; + readonly description: "Summary"; + readonly aliases: ["summary", "crossed-circle"]; + readonly handler: typeof crossedCircle; +}, { + readonly semanticName: "Tagged Document"; + readonly name: "Tagged Document"; + readonly shortName: "tag-doc"; + readonly description: "Tagged document"; + readonly aliases: ["tag-doc", "tagged-document"]; + readonly handler: typeof taggedWaveEdgedRectangle; +}, { + readonly semanticName: "Tagged Process"; + readonly name: "Tagged Rectangle"; + readonly shortName: "tag-rect"; + readonly description: "Tagged process"; + readonly aliases: ["tagged-rectangle", "tag-proc", "tagged-process"]; + readonly handler: typeof taggedRect; +}, { + readonly semanticName: "Paper Tape"; + readonly name: "Flag"; + readonly shortName: "flag"; + readonly description: "Paper tape"; + readonly aliases: ["paper-tape"]; + readonly handler: typeof waveRectangle; +}, { + readonly semanticName: "Odd"; + readonly name: "Odd"; + readonly shortName: "odd"; + readonly description: "Odd shape"; + readonly internalAliases: ["rect_left_inv_arrow"]; + readonly handler: typeof rect_left_inv_arrow; +}, { + readonly semanticName: "Lined Document"; + readonly name: "Lined Document"; + readonly shortName: "lin-doc"; + readonly description: "Lined document"; + readonly aliases: ["lined-document"]; + readonly handler: typeof linedWaveEdgedRect; +}]; +export declare const shapes: Record<"join" | "rounded" | "state" | "anchor" | "db" | "summary" | "database" | "start" | "document" | "event" | "stop" | "process" | "text" | "circle" | "rect" | "display" | "squareRect" | "choice" | "note" | "rectWithTitle" | "labelRect" | "iconSquare" | "iconCircle" | "icon" | "iconRounded" | "imageSquare" | "kanbanItem" | "mindmapCircle" | "defaultMindmapNode" | "classBox" | "erBox" | "requirementBox" | "proc" | "rectangle" | "roundedRect" | "stadium" | "terminal" | "pill" | "fr-rect" | "subprocess" | "subproc" | "framed-rectangle" | "subroutine" | "cyl" | "cylinder" | "datastore" | "data-store" | "circ" | "bang" | "cloud" | "diam" | "decision" | "diamond" | "question" | "hex" | "hexagon" | "prepare" | "lean-r" | "lean-right" | "in-out" | "lean_right" | "lean-l" | "lean-left" | "out-in" | "lean_left" | "trap-b" | "priority" | "trapezoid-bottom" | "trapezoid" | "trap-t" | "manual" | "trapezoid-top" | "inv-trapezoid" | "inv_trapezoid" | "dbl-circ" | "double-circle" | "doublecircle" | "notch-rect" | "card" | "notched-rectangle" | "lin-rect" | "lined-rectangle" | "lined-process" | "lin-proc" | "shaded-process" | "sm-circ" | "small-circle" | "stateStart" | "fr-circ" | "framed-circle" | "stateEnd" | "fork" | "forkJoin" | "hourglass" | "collate" | "brace" | "comment" | "brace-l" | "brace-r" | "braces" | "bolt" | "com-link" | "lightning-bolt" | "doc" | "delay" | "half-rounded-rectangle" | "h-cyl" | "das" | "horizontal-cylinder" | "lin-cyl" | "disk" | "lined-cylinder" | "curv-trap" | "curved-trapezoid" | "div-rect" | "div-proc" | "divided-rectangle" | "divided-process" | "tri" | "extract" | "triangle" | "win-pane" | "internal-storage" | "window-pane" | "f-circ" | "junction" | "filled-circle" | "notch-pent" | "loop-limit" | "notched-pentagon" | "flip-tri" | "manual-file" | "flipped-triangle" | "sl-rect" | "manual-input" | "sloped-rectangle" | "docs" | "documents" | "st-doc" | "stacked-document" | "st-rect" | "procs" | "processes" | "stacked-rectangle" | "bow-rect" | "stored-data" | "bow-tie-rectangle" | "cross-circ" | "crossed-circle" | "tag-doc" | "tagged-document" | "tag-rect" | "tagged-rectangle" | "tag-proc" | "tagged-process" | "flag" | "paper-tape" | "odd" | "rect_left_inv_arrow" | "lin-doc" | "lined-document", typeof state | typeof choice | typeof note | typeof rectWithTitle | typeof labelRect | typeof iconSquare | typeof iconCircle | typeof icon | typeof iconRounded | typeof imageSquare | typeof anchor | typeof kanbanItem | typeof mindmapCircle | typeof defaultMindmapNode | typeof classBox | typeof erBox | typeof requirementBox | typeof squareRect | typeof roundedRect | typeof stadium | typeof subroutine | typeof cylinder | typeof datastore | typeof circle | typeof bang | typeof cloud | typeof question | typeof hexagon | typeof lean_right | typeof lean_left | typeof trapezoid | typeof inv_trapezoid | typeof doublecircle | typeof text | typeof card | typeof shadedProcess | typeof stateStart | typeof stateEnd | typeof forkJoin | typeof hourglass | typeof curlyBraceLeft | typeof curlyBraceRight | typeof curlyBraces | typeof lightningBolt | typeof waveEdgedRectangle | typeof halfRoundedRectangle | typeof tiltedCylinder | typeof linedCylinder | typeof curvedTrapezoid | typeof dividedRectangle | typeof triangle | typeof windowPane | typeof filledCircle | typeof trapezoidalPentagon | typeof flippedTriangle | typeof slopedRect | typeof multiWaveEdgedRectangle | typeof multiRect | typeof bowTieRect | typeof crossedCircle | typeof taggedWaveEdgedRectangle | typeof taggedRect | typeof waveRectangle | typeof rect_left_inv_arrow | typeof linedWaveEdgedRect>; +export declare function isValidShape(shape: string): shape is ShapeID; +export type ShapeID = keyof typeof shapes; +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/anchor.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/anchor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..affb5849d2c547fa342c2fb68ab3c91e52eb0fba --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/anchor.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function anchor(parent: D3Selection, node: Node): import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/bang.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/bang.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e594d997462e0ce5e1352f5f8fc6c59c9d9e1cf1 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/bang.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function bang(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/bowTieRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/bowTieRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7113c146e196a9a373b006c7782f3482a39bf859 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/bowTieRect.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function bowTieRect(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/card.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/card.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..25bf10e0199f734c5f884d861b2dd55391e2eeef --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/card.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function card(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/choice.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/choice.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..80a8914e49b98a892daf051fb96905939711a736 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/choice.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function choice(parent: D3Selection, node: Node): import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/circle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/circle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c6b4bf0d5d7843979ab9f0e4f8b5cd537deecd7a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/circle.d.ts @@ -0,0 +1,3 @@ +import type { D3Selection } from '../../../types.js'; +import type { MindmapOptions, Node, ShapeRenderOptions } from '../../types.js'; +export declare function circle(parent: D3Selection, node: Node, options?: MindmapOptions | ShapeRenderOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/classBox.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/classBox.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9e8621737a16fad38aba5553582889ea7ab0ba21 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/classBox.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function classBox(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/cloud.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/cloud.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8021478c583734635e1d873371aa9e58663757a9 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/cloud.d.ts @@ -0,0 +1,3 @@ +import type { D3Selection } from '../../../types.js'; +import type { Node } from '../../types.js'; +export declare function cloud(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/crossedCircle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/crossedCircle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ba9e9b8308a075cadb22790c7436c15600f7d20 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/crossedCircle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function crossedCircle(parent: D3Selection, node: Node): import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curlyBraceLeft.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curlyBraceLeft.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..639dcc025b46c44c2d03b70bc623f9f640847302 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curlyBraceLeft.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function curlyBraceLeft(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curlyBraceRight.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curlyBraceRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c45f3e36935c198bfdb6666e57c05365799a9acd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curlyBraceRight.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function curlyBraceRight(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curlyBraces.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curlyBraces.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..186f000efe14d9e56256e197bbacd302e54e2c9c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curlyBraces.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function curlyBraces(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curvedTrapezoid.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curvedTrapezoid.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ae7593c70938648314d18da3c59827f64a2dd44 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/curvedTrapezoid.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function curvedTrapezoid(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/cylinder.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/cylinder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1cd615bb4f633494ab64d6d18dd89399e73a297b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/cylinder.d.ts @@ -0,0 +1,6 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare const createCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare const createOuterCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare const createInnerCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare function cylinder(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/datastore.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/datastore.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1aa7fddd3eb748a6424f6150acbb902ac7fe061c --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/datastore.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function datastore(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/defaultMindmapNode.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/defaultMindmapNode.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ec6c678dcd460726901d0275438bdd5c374826ac --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/defaultMindmapNode.d.ts @@ -0,0 +1,3 @@ +import type { D3Selection } from '../../../types.js'; +import type { Node } from '../../types.js'; +export declare function defaultMindmapNode(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/defaultMindmapNode.spec.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/defaultMindmapNode.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/defaultMindmapNode.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/dividedRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/dividedRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4df274569577206dd07494dc310f9ee983369476 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/dividedRect.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function dividedRectangle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/document.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/document.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1cd615bb4f633494ab64d6d18dd89399e73a297b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/document.d.ts @@ -0,0 +1,6 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare const createCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare const createOuterCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare const createInnerCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare function cylinder(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/doubleCircle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/doubleCircle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e43692e622327bd20a6f0085a70818d0d944e8d4 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/doubleCircle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function doublecircle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/drawRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/drawRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9d2fdb9bc6b26807bdcdc45a510b8680aedaa827 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/drawRect.d.ts @@ -0,0 +1,3 @@ +import type { Node, RectOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function drawRect(parent: D3Selection, node: Node, options: RectOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/erBox.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/erBox.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..76d12a94697d538e8ec516479d1b0ca54dcdf427 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/erBox.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function erBox(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/filledCircle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/filledCircle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6bd855475cd7d26d6b6e49ab4c5317f987d9d339 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/filledCircle.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function filledCircle(parent: D3Selection, node: Node, { config: { themeVariables } }: ShapeRenderOptions): import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/flippedTriangle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/flippedTriangle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb2651c11ff5195c7657aa58ae7115ee10026cf3 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/flippedTriangle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function flippedTriangle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/forkJoin.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/forkJoin.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dae03e5105010cceb8f94d62c310447803ce72a6 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/forkJoin.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function forkJoin(parent: D3Selection, node: Node, { dir, config: { state, themeVariables } }: ShapeRenderOptions): import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/halfRoundedRectangle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/halfRoundedRectangle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..35797d19be3b1086f1ccdac56447ee5f715e01c2 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/halfRoundedRectangle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function halfRoundedRectangle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9197e3613e2f962630774e5aafe8540ffebe6d08 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.d.ts @@ -0,0 +1,24 @@ +import type { Node } from '../../types.js'; +export declare const solidStateFill: (color: string) => { + fill: string; + hachureAngle: number; + hachureGap: number; + fillWeight: number; + roughness: number; + stroke: string; + seed: number | undefined; +}; +export declare const compileStyles: (node: Node) => { + stylesMap: Map; + stylesArray: [string, string][]; +}; +export declare const styles2Map: (styles: string[]) => Map; +export declare const isLabelStyle: (key: string) => key is "font-family" | "font-size" | "font-weight" | "text-align" | "font-style" | "white-space" | "line-height" | "color" | "text-decoration" | "text-transform" | "letter-spacing" | "word-spacing" | "text-shadow" | "text-overflow" | "word-wrap" | "word-break" | "overflow-wrap" | "hyphens"; +export declare const styles2String: (node: Node) => { + labelStyles: string; + nodeStyles: string; + stylesArray: [string, string][]; + borderStyles: string[]; + backgroundStyles: string[]; +}; +export declare const userNodeOverrides: (node: Node, options: any) => any; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/hexagon.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/hexagon.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f063377c646ae8a95548e3d5eb3abb8a4bbe75b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/hexagon.d.ts @@ -0,0 +1,4 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare const createHexagonPathD: (x: number, y: number, width: number, height: number, m: number) => string; +export declare function hexagon(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/hourglass.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/hourglass.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d095e7bc5ccd740fc8348bafb4c15fea880a3f5f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/hourglass.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function hourglass(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/icon.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/icon.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d01d2f3504da554a67f0b509eef7a2de93bc5095 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/icon.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function icon(parent: D3Selection, node: Node, { config: { themeVariables, flowchart } }: ShapeRenderOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/iconCircle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/iconCircle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4122571ff27043232c6e3d2f89f0107d65e096cc --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/iconCircle.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function iconCircle(parent: D3Selection, node: Node, { config: { themeVariables, flowchart } }: ShapeRenderOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/iconRounded.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/iconRounded.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8397ce31735d27de0c53f24b504d8d5c7a7be43b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/iconRounded.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function iconRounded(parent: D3Selection, node: Node, { config: { themeVariables, flowchart } }: ShapeRenderOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/iconSquare.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/iconSquare.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7128c931e76ee432cd618016c9126f671dfc7a4f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/iconSquare.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function iconSquare(parent: D3Selection, node: Node, { config: { themeVariables, flowchart } }: ShapeRenderOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/imageSquare.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/imageSquare.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5c50414c6517f708192e40a88e657f9fdef47369 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/imageSquare.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function imageSquare(parent: D3Selection, node: Node, { config: { flowchart } }: ShapeRenderOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/insertPolygonShape.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/insertPolygonShape.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd33f2aeb7cc433618162bd0cdefb1cd040dd78d --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/insertPolygonShape.d.ts @@ -0,0 +1,5 @@ +import type { D3Selection } from '../../../types.js'; +export declare function insertPolygonShape(parent: D3Selection, w: number, h: number, points: { + x: number; + y: number; +}[]): import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/invertedTrapezoid.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/invertedTrapezoid.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6104989fbe5395a6f348005d23846bfd29162da4 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/invertedTrapezoid.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function inv_trapezoid(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/kanbanItem.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/kanbanItem.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0cc7fd1e40ae80f22840c8588f524a51341d1f2a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/kanbanItem.d.ts @@ -0,0 +1,3 @@ +import type { Node, KanbanNode, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function kanbanItem(parent: D3Selection, kanbanNode: Omit | Omit, { config }: ShapeRenderOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/labelImageUtils.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/labelImageUtils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9c4188ee5aa89a370b075aa020aadbbfc7abced --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/labelImageUtils.d.ts @@ -0,0 +1,9 @@ +/** + * Waits for all images in a container to load and applies appropriate styling. + * This ensures accurate bounding box measurements after images are loaded. + * + * @param container - The HTML element containing img tags + * @param labelText - The original label text to check if there's text besides images + * @returns Promise that resolves when all images are loaded and styled + */ +export declare function configureLabelImages(container: HTMLElement, labelText: string): Promise; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/labelRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/labelRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a0091d29e2e79e740eb9886bd935f2505ad85ff --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/labelRect.d.ts @@ -0,0 +1,4 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function roundedRect(parent: D3Selection, node: Node): Promise>; +export declare function labelRect(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/leanLeft.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/leanLeft.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed3e644d2c61d61dab088fc509f3d62b6160695e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/leanLeft.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function lean_left(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/leanRight.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/leanRight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..38437c738fd7502ec5500f2460d96bea0ac2c0ec --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/leanRight.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function lean_right(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/lightningBolt.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/lightningBolt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bba5f52bdcd0ad981c9be9d3fa284ba25f678ac2 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/lightningBolt.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function lightningBolt(parent: D3Selection, node: Node): import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/linedCylinder.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/linedCylinder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9bd480a589f4a1960ece2a164e90fcafa4874a5b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/linedCylinder.d.ts @@ -0,0 +1,6 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare const createCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number, outerOffset: number) => string; +export declare const createOuterCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number, outerOffset: number) => string; +export declare const createInnerCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare function linedCylinder(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..264a1ca98ce722105ef2a06a874aa762cf076347 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function linedWaveEdgedRect(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/mindmapCircle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/mindmapCircle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ef60db041f46423b620ac2e56e44702d942481c9 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/mindmapCircle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function mindmapCircle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/multiRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/multiRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..45428b91db2acbe3776ba0f1e446d29f1755b01b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/multiRect.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function multiRect(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/multiWaveEdgedRectangle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/multiWaveEdgedRectangle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..47d155e4db345b0eacf53711dff23bd965f3e9c2 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/multiWaveEdgedRectangle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function multiWaveEdgedRectangle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/note.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/note.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd7f40104ad31e9228890e51d526d8599f184837 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/note.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function note(parent: D3Selection, node: Node, { config: { themeVariables } }: ShapeRenderOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/question.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/question.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..96b9a58073f629bd954482ab36cd53f204b57ffd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/question.d.ts @@ -0,0 +1,4 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare const createDecisionBoxPathD: (x: number, y: number, size: number) => string; +export declare function question(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/rectLeftInvArrow.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/rectLeftInvArrow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d4f60848d5180e0e53c7d33597441a8ae62865e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/rectLeftInvArrow.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function rect_left_inv_arrow(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/rectWithTitle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/rectWithTitle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8c712aa811790d317746498aad47a5d6e6c8bb3d --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/rectWithTitle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function rectWithTitle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/requirementBox.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/requirementBox.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d694baf593902ae55afa7aaa32f44b77aa62eb1 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/requirementBox.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function requirementBox(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/roundedRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/roundedRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..501e38e8dd4b8bdb07e34c0f46d32a2a0a0b39c9 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/roundedRect.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function roundedRect(parent: D3Selection, node: Node, { config: { themeVariables } }: ShapeRenderOptions): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/roundedRectPath.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/roundedRectPath.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..463f53c76e7ea441dbe9fd03194661d09d01c08f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/roundedRectPath.d.ts @@ -0,0 +1 @@ +export declare const createRoundedRectPathD: (x: number, y: number, totalWidth: number, totalHeight: number, radius: number) => string; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/shadedProcess.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/shadedProcess.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..10162ed89b96a91cafaeb5fedc1c9ded26cf9ec7 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/shadedProcess.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function shadedProcess(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/slopedRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/slopedRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9bd4cb45e7f492cbb99ee6de6dcfbea9f89d06f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/slopedRect.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function slopedRect(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/squareRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/squareRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee1cbbce61a6bf755d459fa00bd95ad221123afd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/squareRect.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function squareRect(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/stadium.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/stadium.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8fdcae4705fe7bd84820e0699f0f5ccdb7bd6ae6 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/stadium.d.ts @@ -0,0 +1,4 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare const createStadiumPathD: (x: number, y: number, totalWidth: number, totalHeight: number) => string; +export declare function stadium(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/state.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/state.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1aa6ff25b495a9b7756fa1090d427b3c4010b04b --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/state.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function state(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/stateEnd.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/stateEnd.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c5d2cb504e0be4f88b76cb21e1a44411c44b9447 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/stateEnd.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function stateEnd(parent: D3Selection, node: Node, { config: { themeVariables } }: ShapeRenderOptions): import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/stateStart.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/stateStart.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d53628bc4045b594545781326c7c6200eb5baf5 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/stateStart.d.ts @@ -0,0 +1,3 @@ +import type { Node, ShapeRenderOptions } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function stateStart(parent: D3Selection, node: Node, { config: { themeVariables } }: ShapeRenderOptions): import("d3-selection").Selection; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/subroutine.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/subroutine.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ba55f347241bea19e25481d9344229c272646787 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/subroutine.d.ts @@ -0,0 +1,4 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare const createSubroutinePathD: (x: number, y: number, width: number, height: number) => string; +export declare function subroutine(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/taggedRect.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/taggedRect.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..91d7d888825427458d72e551f255a2a9c14bea7a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/taggedRect.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function taggedRect(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/taggedWaveEdgedRectangle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/taggedWaveEdgedRectangle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..916d5fce0dc6c198d222c62f52ad7e1b9fe8a6ad --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/taggedWaveEdgedRectangle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function taggedWaveEdgedRectangle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/text.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..048864898cb3df79794400e87ce57e1ef5c2a7db --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/text.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function text(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/tiltedCylinder.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/tiltedCylinder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ae58d98021d6021fa9215498e24046cb5b63a6d --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/tiltedCylinder.d.ts @@ -0,0 +1,6 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare const createCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare const createOuterCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare const createInnerCylinderPathD: (x: number, y: number, width: number, height: number, rx: number, ry: number) => string; +export declare function tiltedCylinder(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/trapezoid.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/trapezoid.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..490bbe8c4524812e1829f5413ccff49d4dc418dc --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/trapezoid.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function trapezoid(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/trapezoidalPentagon.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/trapezoidalPentagon.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f4289d9fbcc7215ff9f2cfdd9c275a006785f3cf --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/trapezoidalPentagon.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function trapezoidalPentagon(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/triangle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/triangle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f99b3d666dfb51b578f8f7c3d9255153c2fbdcf7 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/triangle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function triangle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/util.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/util.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e41b552ce95edbe859a7402b3e2a9a98cc77f319 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/util.d.ts @@ -0,0 +1,50 @@ +import type { Node } from '../../types.js'; +import type { D3Selection, Point } from '../../../types.js'; +export declare const labelHelper: (parent: D3Selection, node: Node, _classes?: string) => Promise<{ + shapeSvg: import("d3-selection").Selection; + bbox: DOMRect; + halfPadding: number; + label: import("d3-selection").Selection; +}>; +export declare const insertLabel: (parent: D3Selection, label: string, options: { + labelStyle?: string | undefined; + icon?: boolean | undefined; + img?: string | undefined; + useHtmlLabels?: boolean | undefined; + padding: number; + width?: number | undefined; + centerLabel?: boolean | undefined; + addSvgBackground?: boolean | undefined; +}) => Promise<{ + shapeSvg: D3Selection; + bbox: DOMRect; + halfPadding: number; + label: import("d3-selection").Selection; +}>; +export declare const updateNodeBounds: (node: Node, element: D3Selection | D3Selection) => void; +/** + * @param parent - Parent element to append the polygon to + * @param w - Width of the polygon + * @param h - Height of the polygon + * @param points - Array of points to create the polygon + */ +export declare function insertPolygonShape(parent: D3Selection, w: number, h: number, points: Point[]): import("d3-selection").Selection; +export declare const getNodeClasses: (node: Node, extra?: string) => string; +export declare function createPathFromPoints(points: Point[]): string; +export declare function generateFullSineWavePoints(x1: number, y1: number, x2: number, y2: number, amplitude: number, numCycles: number): { + x: number; + y: number; +}[]; +/** + * @param centerX - x-coordinate of center of circle + * @param centerY - y-coordinate of center of circle + * @param radius - radius of circle + * @param numPoints - total points required + * @param startAngle - angle where arc will start + * @param endAngle - angle where arc will end + */ +export declare function generateCirclePoints(centerX: number, centerY: number, radius: number, numPoints: number, startAngle: number, endAngle: number): { + x: number; + y: number; +}[]; +export declare function mergePaths(roughElement: SVGElement): SVGGElement; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/waveEdgedRectangle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/waveEdgedRectangle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5097e563356a32de17892f1e37ee2272b43c4892 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/waveEdgedRectangle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function waveEdgedRectangle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/waveRectangle.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/waveRectangle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b2e779ebca0bd20a946a384b72dfeae10a4357a3 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/waveRectangle.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function waveRectangle(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/windowPane.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/windowPane.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aae011191d49923434ce1f5f053197d977cd7a97 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/rendering-elements/shapes/windowPane.d.ts @@ -0,0 +1,3 @@ +import type { Node } from '../../types.js'; +import type { D3Selection } from '../../../types.js'; +export declare function windowPane(parent: D3Selection, node: Node): Promise>; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/selectSvgElement.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/selectSvgElement.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c32ece10a98cc0dde90e99bdc5d34cb7e83cef4a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/selectSvgElement.d.ts @@ -0,0 +1,8 @@ +import type { SVG } from '../diagram-api/types.js'; +/** + * Selects the SVG element using {@link id}. + * + * @param id - The diagram ID. + * @returns The selected {@link SVG} element using {@link id}. + */ +export declare const selectSvgElement: (id: string) => SVG; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/setupViewPortForSVG.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/setupViewPortForSVG.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..82dc42b5d16c119fe1ffc1ee4d3a224e4d04e6f4 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/setupViewPortForSVG.d.ts @@ -0,0 +1,2 @@ +import type { SVG } from '../diagram-api/types.js'; +export declare const setupViewPortForSVG: (svg: SVG, padding: number, cssDiagram: string, useMaxWidth: boolean) => void; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/splitText.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/splitText.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..289ab65f98dff5a3b50141e4e88e88d7b422dba5 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/splitText.d.ts @@ -0,0 +1,24 @@ +import type { CheckFitFunction, MarkdownLine, MarkdownWord } from './types.js'; +/** + * Splits a string into graphemes if available, otherwise characters. + */ +export declare function splitTextToChars(text: string): string[]; +/** + * Splits a string into words by using `Intl.Segmenter` if available, or splitting by ' '. + * `Intl.Segmenter` uses the default locale, which might be different across browsers. + */ +export declare function splitLineToWords(text: string): string[]; +/** + * Splits a word into two parts, the first part fits the width and the remaining part. + * @param checkFit - Function to check if word fits + * @param word - Word to split + * @returns [first part of word that fits, rest of word] + */ +export declare function splitWordToFitWidth(checkFit: CheckFitFunction, word: MarkdownWord): [MarkdownWord, MarkdownWord]; +/** + * Splits a line into multiple lines that satisfy the checkFit function. + * @param line - Line to split + * @param checkFit - Function to check if line fits + * @returns Array of lines that fit + */ +export declare function splitLineToFitWidth(line: MarkdownLine, checkFit: CheckFitFunction): MarkdownLine[]; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/splitText.spec.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/splitText.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/splitText.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/types.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dbabcd96e5da6ffe5e290350c84b9396b47bf7ee --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/types.d.ts @@ -0,0 +1,157 @@ +export type MarkdownWordType = 'normal' | 'strong' | 'em'; +import type { MermaidConfig } from '../config.type.js'; +import type { ClusterShapeID } from './rendering-elements/clusters.js'; +import type { ShapeID } from './rendering-elements/shapes.js'; +import type { Bounds, Point } from '../types.js'; +export interface MarkdownWord { + content: string; + type: MarkdownWordType; +} +export type MarkdownLine = MarkdownWord[]; +/** Returns `true` if the line fits a constraint (e.g. it's under 𝑛 chars) */ +export type CheckFitFunction = (text: MarkdownLine) => boolean; +interface BaseNode { + id: string; + label?: string; + description?: string[]; + parentId?: string; + position?: string; + cssStyles?: string[]; + cssCompiledStyles?: string[]; + cssClasses?: string; + labelStyle?: string; + labelType?: string; + domId?: string; + dir?: string; + haveCallback?: boolean; + link?: string; + linkTarget?: string; + tooltip?: string; + padding?: number; + isGroup?: boolean; + width?: number; + height?: number; + intersect?: (point: any) => any; + calcIntersect?: (bounds: Bounds, point: Point) => any; + rx?: number; + ry?: number; + useHtmlLabels?: boolean; + centerLabel?: boolean; + backgroundColor?: string; + borderColor?: string; + borderStyle?: string; + borderWidth?: number; + labelTextColor?: string; + labelPaddingX?: number; + labelPaddingY?: number; + x?: number; + y?: number; + look?: string; + icon?: string; + pos?: 't' | 'b'; + img?: string; + assetWidth?: number; + assetHeight?: number; + defaultWidth?: number; + imageAspectRatio?: number; + constraint?: 'on' | 'off'; + children?: NodeChildren; + nodeId?: string; + level?: number; + descr?: string; + type?: number; + radius?: number; + taper?: number; + stroke?: string; + colorIndex?: number; +} +/** + * Group/cluster nodes, e.g. nodes that contain other nodes. + */ +export type NodeChildren = Node[]; +export interface ClusterNode extends BaseNode { + shape?: ClusterShapeID; + isGroup: true; +} +export interface NonClusterNode extends BaseNode { + shape?: ShapeID; + isGroup: false; +} +export type Node = ClusterNode | NonClusterNode; +export interface Edge { + id: string; + label?: string; + classes?: string; + style?: string[]; + animate?: boolean; + animation?: 'fast' | 'slow'; + arrowhead?: string; + arrowheadStyle?: string; + arrowTypeEnd?: string; + arrowTypeStart?: string; + cssCompiledStyles?: string[]; + defaultInterpolate?: string; + end?: string; + interpolate?: string; + labelType?: string; + length?: number; + start?: string; + stroke?: string; + text?: string; + type?: string; + startLabelRight?: string; + endLabelLeft?: string; + curve?: string; + labelpos?: string; + labelStyle?: string[]; + minlen?: number; + pattern?: string; + thickness?: 'normal' | 'thick' | 'invisible' | 'dotted'; + look?: string; + isUserDefinedId?: boolean; + points?: Point[]; + parentId?: string; + dir?: string; + source?: string; + target?: string; + depth?: number; +} +export interface RectOptions { + rx: number; + ry: number; + labelPaddingX: number; + labelPaddingY: number; + classes: string; +} +export interface MindmapOptions { + padding: number; +} +export type ClassDiagramNode = Node & { + memberData: any; +}; +export interface LayoutData { + nodes: Node[]; + edges: Edge[]; + config: MermaidConfig; + diagramId?: string; + [key: string]: any; +} +export interface RenderData { + items: (Node | Edge)[]; + [key: string]: any; +} +export type LayoutMethod = 'dagre' | 'dagre-wrapper' | 'elk' | 'neato' | 'dot' | 'circo' | 'fdp' | 'osage' | 'grid'; +export interface ShapeRenderOptions { + config: MermaidConfig; + /** Some shapes render differently if a diagram has a direction `LR` */ + dir?: Node['dir']; + padding?: number; +} +export type KanbanNode = Node & { + priority?: 'Very High' | 'High' | 'Medium' | 'Low' | 'Very Low'; + ticket?: string; + assigned?: string; + icon?: string; + level: number; +}; +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/uid.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/uid.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7dbf6528fb6d6ceedea9253fb65f3c53a24d748 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/uid.d.ts @@ -0,0 +1,8 @@ +export declare class Uid { + private static count; + id: string; + href: string; + static next(name: string): Uid; + constructor(id: string); + toString(): string; +} diff --git a/tools/ui/node_modules/mermaid/dist/rendering-util/unique-dom-ids.spec.d.ts b/tools/ui/node_modules/mermaid/dist/rendering-util/unique-dom-ids.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/rendering-util/unique-dom-ids.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/setupGraphViewbox.d.ts b/tools/ui/node_modules/mermaid/dist/setupGraphViewbox.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7ad52c5a89eacc5eeb0b1800c0ed9137aab519f8 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/setupGraphViewbox.d.ts @@ -0,0 +1,3 @@ +export function calculateSvgSizeAttrs(height: number, width: number, useMaxWidth: boolean): Map<"height" | "width" | "style", string>; +export function configureSvgSize(svgElem: import("./diagram-api/types.js").SVG, height: number, width: number, useMaxWidth: boolean): void; +export function setupGraphViewbox(graph: any, svgElem: any, padding: any, useMaxWidth: any): void; diff --git a/tools/ui/node_modules/mermaid/dist/styles.d.ts b/tools/ui/node_modules/mermaid/dist/styles.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46f01b389114c3b8b5d8ccd919825281827c88dd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/styles.d.ts @@ -0,0 +1,23 @@ +import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js'; +import type { DiagramStylesProvider } from './diagram-api/types.js'; +export declare function cssStyleSheetToString(cssStyleSheet: CSSStyleSheet): string; +declare const getStyles: (type: string, userStyles: string, options: { + fontFamily: string; + fontSize: string; + textColor: string; + errorBkgColor: string; + errorTextColor: string; + lineColor: string; + useGradient?: boolean; + dropShadow?: string; + primaryBorderColor?: string; + compositeTitleBackground?: string; + THEME_COLOR_LIMIT?: number; + nodeBorder?: string; + mainBkg?: string; + strokeWidth?: number; + theme?: string; + look?: string; +} & FlowChartStyleOptions, svgId: `${string}`) => string; +export declare const addStylesForDiagram: (type: string, diagramTheme?: DiagramStylesProvider) => void; +export default getStyles; diff --git a/tools/ui/node_modules/mermaid/dist/styles.spec.d.ts b/tools/ui/node_modules/mermaid/dist/styles.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/styles.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/tests/util.d.ts b/tools/ui/node_modules/mermaid/dist/tests/util.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1bed0fa4043c2827d1e5308d23bb2367516864ef --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/tests/util.d.ts @@ -0,0 +1,40 @@ +import type { D3HtmlSelection, D3Selection } from '../types.js'; +export declare const convert: (template: TemplateStringsArray, ...params: unknown[]) => { + [k: string]: unknown; +}[]; +export declare const MOCKED_BBOX: { + x: number; + y: number; + width: number; + height: number; +}; +interface JsdomItInput { + body: D3HtmlSelection; + svg: D3Selection; +} +/** + * Test method borrowed from d3 : https://github.com/d3/d3-selection/blob/v3.0.0/test/jsdom.js + * + * Fools d3 into thinking it's working in a browser with a real DOM. + * + * The DOM is actually an instance of JSDom with monkey-patches for DOM methods that require a + * rendering engine. + * + * The resulting environment is capable of rendering SVGs with the caveat that layouts are + * completely screwed. + * + * This makes it possible to make structural tests instead of mocking everything. + */ +export declare function jsdomIt(message: string, run: (input: JsdomItInput) => void | Promise): void; +/** + * Retrieves the node from its parent with ParentNode#querySelector, + * then checks that it exists before returning it. + */ +export declare function ensureNodeFromSelector(selector: string, parent?: ParentNode): Element; +/** + * Asserts that no element `id` attribute appears more than once within the given DOM subtree. + * Useful for verifying that multiple mermaid diagrams rendered into the same document + * do not produce colliding SVG element IDs. + */ +export declare function assertNoDuplicateIds(root: ParentNode): void; +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/erDiagram-oldHardcodedValues.d.ts b/tools/ui/node_modules/mermaid/dist/themes/erDiagram-oldHardcodedValues.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..15a3e644822fadf7b443d28d97568126205e4295 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/erDiagram-oldHardcodedValues.d.ts @@ -0,0 +1,7 @@ +/** + * Values that have been hardcoded in src/diagrams/er/styles.js. These can be used by + * theme-_._ files to maintain display styles until themes, styles, renderers are revised. -- + * 2022-09-22 + */ +export declare const oldAttributeBackgroundColorOdd = "#ffffff"; +export declare const oldAttributeBackgroundColorEven = "#f2f2f2"; diff --git a/tools/ui/node_modules/mermaid/dist/themes/index.d.ts b/tools/ui/node_modules/mermaid/dist/themes/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bc417eed0b2c564b3485b6cc8f7d288d7c42876a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/index.d.ts @@ -0,0 +1,2368 @@ +declare const _default: { + base: { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + noteBkgColor: string; + noteTextColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + fontFamily: string; + fontSize: string; + useGradient: boolean; + dropShadow: string; + updateColors(): void; + primaryTextColor: any; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + noteBorderColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: any; + arrowheadColor: any; + textColor: any; + border2: any; + nodeBkg: any; + mainBkg: any; + nodeBorder: any; + clusterBkg: any; + clusterBorder: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + vertLineColor: any; + taskTextColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + noteFontWeight: any; + fontWeight: any; + personBorder: any; + personBkg: any; + rowOdd: any; + rowEven: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: any; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + venn1: any; + venn2: any; + venn3: any; + venn4: any; + venn5: any; + venn6: any; + venn7: any; + venn8: any; + vennTitleTextColor: any; + vennSetTextColor: any; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + archEdgeColor: any; + archEdgeArrowColor: any; + archEdgeWidth: any; + archGroupBorderColor: any; + archGroupBorderWidth: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + gradientStart: any; + gradientStop: any; + calculate(overrides: any): void; + }; + }; + dark: { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: string; + textColor: string; + mainBkg: string; + secondBkg: string; + mainContrastColor: string; + darkTextColor: any; + border1: string; + border2: any; + arrowheadColor: string; + fontFamily: string; + fontSize: string; + labelBackground: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + nodeBkg: string; + nodeBorder: string; + clusterBkg: string; + clusterBorder: string; + defaultLinkColor: string; + titleColor: string; + edgeLabelBackground: string; + actorBorder: string; + actorBkg: string; + actorTextColor: string; + actorLineColor: string; + signalColor: string; + signalTextColor: string; + labelBoxBkgColor: string; + labelBoxBorderColor: string; + labelTextColor: string; + loopTextColor: string; + noteBorderColor: string; + noteBkgColor: string; + noteTextColor: string; + activationBorderColor: string; + activationBkgColor: string; + sequenceNumberColor: string; + sectionBkgColor: any; + altSectionBkgColor: string; + sectionBkgColor2: string; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: string; + taskTextColor: string; + taskTextLightColor: string; + taskTextOutsideColor: string; + taskTextClickableColor: string; + activeTaskBorderColor: any; + activeTaskBkgColor: string; + gridColor: string; + doneTaskBkgColor: string; + doneTaskBorderColor: string; + critBorderColor: string; + critBkgColor: string; + taskTextDarkColor: string; + todayLineColor: string; + vertLineColor: string; + personBorder: any; + personBkg: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + rowOdd: any; + rowEven: any; + labelColor: string; + errorBkgColor: string; + errorTextColor: string; + useGradient: boolean; + gradientStart: any; + gradientStop: any; + dropShadow: string; + noteFontWeight: string; + fontWeight: string; + updateColors(): void; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: any; + specialStateColor: string | undefined; + fillType0: string | undefined; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + cScale12: any; + cScale0: any; + scaleLabelColor: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + packet: { + startByteColor: any; + endByteColor: any; + labelColor: any; + titleColor: any; + blockStrokeColor: any; + blockFillColor: string; + } | undefined; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + classText: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; + default: { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + secondaryColor: string; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: string; + textColor: string; + mainBkg: string; + secondBkg: string; + border1: string; + border2: string; + arrowheadColor: string; + fontFamily: string; + fontSize: string; + labelBackground: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + nodeBkg: string; + nodeBorder: string; + clusterBkg: string; + clusterBorder: string; + defaultLinkColor: string; + titleColor: string; + edgeLabelBackground: string; + actorBorder: string; + actorBkg: string; + actorTextColor: string; + actorLineColor: string; + signalColor: string; + signalTextColor: string; + labelBoxBkgColor: string; + labelBoxBorderColor: string; + labelTextColor: string; + loopTextColor: string; + noteBorderColor: string; + noteBkgColor: string; + noteTextColor: string; + activationBorderColor: string; + activationBkgColor: string; + sequenceNumberColor: string; + sectionBkgColor: any; + altSectionBkgColor: string; + sectionBkgColor2: string; + excludeBkgColor: string; + taskBorderColor: string; + taskBkgColor: string; + taskTextLightColor: string; + taskTextColor: string; + taskTextDarkColor: string; + taskTextOutsideColor: string; + taskTextClickableColor: string; + activeTaskBorderColor: string; + activeTaskBkgColor: string; + gridColor: string; + doneTaskBkgColor: string; + doneTaskBorderColor: string; + critBorderColor: string; + critBkgColor: string; + todayLineColor: string; + vertLineColor: string; + noteFontWeight: string; + fontWeight: string; + personBorder: any; + personBkg: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + rowOdd: string; + rowEven: string; + labelColor: string; + errorBkgColor: string; + errorTextColor: string; + useGradient: boolean; + gradientStart: any; + gradientStop: any; + dropShadow: string; + updateColors(): void; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + cScaleLabel0: any; + cScaleLabel3: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + specialStateColor: string | undefined; + classText: any; + fillType0: string | undefined; + fillType1: string | undefined; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + venn1: any; + venn2: any; + venn3: any; + venn4: any; + venn5: any; + venn6: any; + venn7: any; + venn8: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; + forest: { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + secondaryColor: string; + mainBkg: string; + secondBkg: string; + lineColor: any; + border1: string; + border2: string; + arrowheadColor: string; + fontFamily: string; + fontSize: string; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + textColor: any; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + nodeBkg: string; + nodeBorder: string; + clusterBkg: string; + clusterBorder: string; + defaultLinkColor: string; + titleColor: string; + edgeLabelBackground: string; + actorBorder: string; + actorBkg: string; + actorTextColor: string; + actorLineColor: string; + signalColor: string; + signalTextColor: string; + labelBoxBkgColor: string; + labelBoxBorderColor: string; + labelTextColor: string; + loopTextColor: string; + noteBorderColor: string; + noteBkgColor: string; + noteTextColor: string; + activationBorderColor: string; + activationBkgColor: string; + sequenceNumberColor: string; + sectionBkgColor: string; + altSectionBkgColor: string; + sectionBkgColor2: string; + excludeBkgColor: string; + taskBorderColor: string; + taskBkgColor: string; + taskTextLightColor: string; + taskTextColor: string; + taskTextDarkColor: string; + taskTextOutsideColor: string; + taskTextClickableColor: string; + activeTaskBorderColor: string; + activeTaskBkgColor: string; + gridColor: string; + doneTaskBkgColor: string; + doneTaskBorderColor: string; + critBorderColor: string; + critBkgColor: string; + todayLineColor: string; + vertLineColor: string; + personBorder: any; + personBkg: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + noteFontWeight: string; + fontWeight: string; + labelColor: string; + errorBkgColor: string; + errorTextColor: string; + useGradient: boolean; + gradientStart: any; + gradientStop: any; + dropShadow: string; + updateColors(): void; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + rowOdd: any; + rowEven: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: any; + specialStateColor: any; + classText: any; + fillType0: string | undefined; + fillType1: string | undefined; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + venn1: any; + venn2: any; + venn3: any; + venn4: any; + venn5: any; + venn6: any; + venn7: any; + venn8: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + packet: { + startByteColor: any; + endByteColor: any; + labelColor: any; + titleColor: any; + blockStrokeColor: any; + blockFillColor: string; + } | undefined; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; + neutral: { + getThemeVariables: (userOverrides: any) => { + primaryColor: string; + contrast: string; + secondaryColor: any; + background: string; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: string; + textColor: any; + mainBkg: string; + secondBkg: string; + border1: string; + border2: string; + note: string; + text: string; + critical: string; + done: string; + arrowheadColor: string; + fontFamily: string; + fontSize: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + nodeBkg: string; + nodeBorder: string; + clusterBkg: string; + clusterBorder: string; + defaultLinkColor: string; + titleColor: string; + edgeLabelBackground: string; + actorBorder: string; + actorBkg: string; + actorTextColor: string; + actorLineColor: string; + signalColor: string; + signalTextColor: string; + labelBoxBkgColor: string; + labelBoxBorderColor: string; + labelTextColor: string; + loopTextColor: string; + noteBorderColor: string; + noteBkgColor: string; + noteTextColor: string; + activationBorderColor: string; + activationBkgColor: string; + sequenceNumberColor: string; + sectionBkgColor: string; + altSectionBkgColor: string; + sectionBkgColor2: string; + excludeBkgColor: string; + taskBorderColor: string; + taskBkgColor: string; + taskTextLightColor: string; + taskTextColor: string; + taskTextDarkColor: string; + taskTextOutsideColor: string; + taskTextClickableColor: string; + activeTaskBorderColor: string; + activeTaskBkgColor: string; + gridColor: string; + doneTaskBkgColor: string; + doneTaskBorderColor: string; + critBkgColor: string; + critBorderColor: string; + todayLineColor: string; + vertLineColor: string; + personBorder: any; + personBkg: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + noteFontWeight: string; + fontWeight: string; + rowOdd: any; + rowEven: string; + labelColor: string; + errorBkgColor: string; + errorTextColor: string; + useGradient: boolean; + gradientStart: any; + gradientStop: any; + dropShadow: string; + updateColors(): void; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + cScaleLabel0: any; + cScaleLabel2: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + stateBorder: any; + innerEndBackground: any; + specialStateColor: string | undefined; + classText: any; + fillType0: string | undefined; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: string | undefined; + gitBranchLabel2: any; + gitBranchLabel3: string | undefined; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; + neo: { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + mainBkg: string; + noteBkgColor: string; + noteTextColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + primaryBorderColor: any; + fontFamily: string; + fontSize: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + tertiaryColor: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + noteFontWeight: string; + fontWeight: string; + updateColors(): void; + primaryTextColor: any; + secondaryColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + noteBorderColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: any; + arrowheadColor: any; + textColor: any; + border2: any; + nodeBkg: any; + clusterBkg: any; + clusterBorder: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + taskTextOutsideColor: any; + vertLineColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; + 'neo-dark': { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + mainBkg: string; + secondBkg: string; + mainContrastColor: string; + darkTextColor: any; + border1: string; + border2: any; + arrowheadColor: any; + fontFamily: string; + fontSize: string; + labelBackground: string; + textColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + noteBkgColor: string; + noteTextColor: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + noteFontWeight: string; + fontWeight: string; + updateColors(): void; + noteBorderColor: any; + lineColor: any; + nodeBkg: any; + nodeBorder: any; + clusterBkg: any; + clusterBorder: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + vertLineColor: any; + taskTextColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: any; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitDarkMode: boolean | undefined; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; + redux: { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + mainBkg: string; + noteBkgColor: string; + noteTextColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + primaryBorderColor: any; + fontFamily: string; + fontSize: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + nodeShadow: boolean; + tertiaryColor: string; + clusterBkg: string; + clusterBorder: string; + noteBorderColor: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + actorBorder: string; + filterColor: string; + updateColors(): void; + primaryTextColor: any; + secondaryColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: any; + arrowheadColor: any; + textColor: any; + border2: any; + nodeBkg: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + noteFontWeight: number | undefined; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + vertLineColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + compositeTitleBackground: any; + altBackground: any; + stateEdgeLabelBackground: string | undefined; + fontWeight: number | undefined; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + requirementEdgeLabelBackground: string | undefined; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + commitLineColor: any; + erEdgeLabelBackground: string | undefined; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; + 'redux-dark': { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + mainBkg: string; + secondBkg: string; + mainContrastColor: string; + darkTextColor: any; + border1: string; + border2: any; + arrowheadColor: any; + fontFamily: string; + fontSize: string; + labelBackground: string; + textColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + noteBkgColor: string; + noteTextColor: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + nodeShadow: boolean; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + clusterBkg: string; + clusterBorder: string; + noteBorderColor: string; + noteFontWeight: number; + filterColor: string; + updateColors(): void; + lineColor: any; + nodeBkg: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + signalColor: any; + labelBoxBorderColor: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalTextColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + vertLineColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + stateEdgeLabelBackground: string | undefined; + fontWeight: number | undefined; + stateBkg: any; + labelBackgroundColor: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + requirementEdgeLabelBackground: string | undefined; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + commitLineColor: any; + erEdgeLabelBackground: string | undefined; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; + 'redux-color': { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + mainBkg: string; + noteBkgColor: string; + noteTextColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + primaryBorderColor: any; + fontFamily: string; + fontSize: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + nodeShadow: boolean; + tertiaryColor: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + actorBorder: string; + noteBorderColor: string; + noteFontWeight: number; + borderColorArray: string[]; + bkgColorArray: string[]; + filterColor: string; + updateColors(): void; + primaryTextColor: any; + secondaryColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: any; + arrowheadColor: any; + textColor: any; + border2: any; + nodeBkg: any; + clusterBkg: any; + clusterBorder: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + vertLineColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLineColor: any; + commitLabelFontSize: any; + fontWeight: number | undefined; + erEdgeLabelBackground: string | undefined; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; + 'redux-dark-color': { + getThemeVariables: (userOverrides: any) => { + background: string; + primaryColor: string; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + mainBkg: string; + secondBkg: string; + mainContrastColor: string; + darkTextColor: any; + border1: string; + border2: any; + arrowheadColor: any; + fontFamily: string; + fontSize: string; + labelBackground: string; + textColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + noteBkgColor: string; + noteTextColor: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + nodeShadow: boolean; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + clusterBkg: string; + clusterBorder: string; + noteBorderColor: string; + noteFontWeight: number; + borderColorArray: string[]; + bkgColorArray: any[]; + filterColor: string; + updateColors(): void; + lineColor: any; + nodeBkg: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + signalColor: any; + labelBoxBorderColor: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalTextColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + rootLabelColor: string | undefined; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + vertLineColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + commitLineColor: any; + fontWeight: number | undefined; + erEdgeLabelBackground: string | undefined; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; + }; + }; +}; +export default _default; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-base.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-base.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0faa798522a74cbc68c8bf08de623106f29c9148 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-base.d.ts @@ -0,0 +1,232 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + /** # Base variables */ + /** + * - Background - used to know what the background color is of the diagram. This is used for + * deducing colors for instance line color. Default value is #f4f4f4. + */ + background: string; + primaryColor: string; + noteBkgColor: string; + noteTextColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + fontFamily: string; + fontSize: string; + useGradient: boolean; + dropShadow: string; + updateColors(): void; + primaryTextColor: any; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + noteBorderColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: any; + arrowheadColor: any; + textColor: any; + border2: any; + nodeBkg: any; + mainBkg: any; + nodeBorder: any; + clusterBkg: any; + clusterBorder: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + vertLineColor: any; + taskTextColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + noteFontWeight: any; + fontWeight: any; + personBorder: any; + personBkg: any; + rowOdd: any; + rowEven: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: any; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + venn1: any; + venn2: any; + venn3: any; + venn4: any; + venn5: any; + venn6: any; + venn7: any; + venn8: any; + vennTitleTextColor: any; + vennSetTextColor: any; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + archEdgeColor: any; + archEdgeArrowColor: any; + archEdgeWidth: any; + archGroupBorderColor: any; + archGroupBorderWidth: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + gradientStart: any; + gradientStop: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-dark.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-dark.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..37e7f3eb5cbdc5e8a86f7f85fe62b6cd6dbbb4e3 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-dark.d.ts @@ -0,0 +1,220 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + background: string; + primaryColor: string; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: string; + textColor: string; + mainBkg: string; + secondBkg: string; + mainContrastColor: string; + darkTextColor: any; + border1: string; + border2: any; + arrowheadColor: string; + fontFamily: string; + fontSize: string; + labelBackground: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + nodeBkg: string; + nodeBorder: string; + clusterBkg: string; + clusterBorder: string; + defaultLinkColor: string; + titleColor: string; + edgeLabelBackground: string; + actorBorder: string; + actorBkg: string; + actorTextColor: string; + actorLineColor: string; + signalColor: string; + signalTextColor: string; + labelBoxBkgColor: string; + labelBoxBorderColor: string; + labelTextColor: string; + loopTextColor: string; + noteBorderColor: string; + noteBkgColor: string; + noteTextColor: string; + activationBorderColor: string; + activationBkgColor: string; + sequenceNumberColor: string; + sectionBkgColor: any; + altSectionBkgColor: string; + sectionBkgColor2: string; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: string; + taskTextColor: string; + taskTextLightColor: string; + taskTextOutsideColor: string; + taskTextClickableColor: string; + activeTaskBorderColor: any; + activeTaskBkgColor: string; + gridColor: string; + doneTaskBkgColor: string; + doneTaskBorderColor: string; + critBorderColor: string; + critBkgColor: string; + taskTextDarkColor: string; + todayLineColor: string; + vertLineColor: string; + personBorder: any; + personBkg: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + rowOdd: any; + rowEven: any; + labelColor: string; + errorBkgColor: string; + errorTextColor: string; + useGradient: boolean; + gradientStart: any; + gradientStop: any; + dropShadow: string; + noteFontWeight: string; + fontWeight: string; + updateColors(): void; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: any; + specialStateColor: string | undefined; + fillType0: string | undefined; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + cScale12: any; + cScale0: any; + scaleLabelColor: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + packet: { + startByteColor: any; + endByteColor: any; + labelColor: any; + titleColor: any; + blockStrokeColor: any; + blockFillColor: string; + } | undefined; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + classText: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-default.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-default.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f6de10d8bd50ec0dfd460a23058ae25e9f867e9a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-default.d.ts @@ -0,0 +1,231 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + background: string; + primaryColor: string; + secondaryColor: string; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: string; + textColor: string; + mainBkg: string; + secondBkg: string; + border1: string; + border2: string; + arrowheadColor: string; + fontFamily: string; + fontSize: string; + labelBackground: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + nodeBkg: string; + nodeBorder: string; + clusterBkg: string; + clusterBorder: string; + defaultLinkColor: string; + titleColor: string; + edgeLabelBackground: string; + actorBorder: string; + actorBkg: string; + actorTextColor: string; + actorLineColor: string; + signalColor: string; + signalTextColor: string; + labelBoxBkgColor: string; + labelBoxBorderColor: string; + labelTextColor: string; + loopTextColor: string; + noteBorderColor: string; + noteBkgColor: string; + noteTextColor: string; + activationBorderColor: string; + activationBkgColor: string; + sequenceNumberColor: string; + sectionBkgColor: any; + altSectionBkgColor: string; + sectionBkgColor2: string; + excludeBkgColor: string; + taskBorderColor: string; + taskBkgColor: string; + taskTextLightColor: string; + taskTextColor: string; + taskTextDarkColor: string; + taskTextOutsideColor: string; + taskTextClickableColor: string; + activeTaskBorderColor: string; + activeTaskBkgColor: string; + gridColor: string; + doneTaskBkgColor: string; + doneTaskBorderColor: string; + critBorderColor: string; + critBkgColor: string; + todayLineColor: string; + vertLineColor: string; + noteFontWeight: string; + fontWeight: string; + personBorder: any; + personBkg: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + rowOdd: string; + rowEven: string; + labelColor: string; + errorBkgColor: string; + errorTextColor: string; + useGradient: boolean; + gradientStart: any; + gradientStop: any; + dropShadow: string; + updateColors(): void; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + cScaleLabel0: any; + cScaleLabel3: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + specialStateColor: string | undefined; + classText: any; + fillType0: string | undefined; + fillType1: string | undefined; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + venn1: any; + venn2: any; + venn3: any; + venn4: any; + venn5: any; + venn6: any; + venn7: any; + venn8: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-forest.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-forest.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..202b3501bf7143562e4e419fd7bab1d0391a9d47 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-forest.d.ts @@ -0,0 +1,236 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + background: string; + primaryColor: string; + secondaryColor: string; + mainBkg: string; + secondBkg: string; + lineColor: any; + border1: string; + border2: string; + arrowheadColor: string; + fontFamily: string; + fontSize: string; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + textColor: any; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + nodeBkg: string; + nodeBorder: string; + clusterBkg: string; + clusterBorder: string; + defaultLinkColor: string; + titleColor: string; + edgeLabelBackground: string; + actorBorder: string; + actorBkg: string; + actorTextColor: string; + actorLineColor: string; + signalColor: string; + signalTextColor: string; + labelBoxBkgColor: string; + labelBoxBorderColor: string; + labelTextColor: string; + loopTextColor: string; + noteBorderColor: string; + noteBkgColor: string; + noteTextColor: string; + activationBorderColor: string; + activationBkgColor: string; + sequenceNumberColor: string; + sectionBkgColor: string; + altSectionBkgColor: string; + sectionBkgColor2: string; + excludeBkgColor: string; + taskBorderColor: string; + taskBkgColor: string; + taskTextLightColor: string; + taskTextColor: string; + taskTextDarkColor: string; + taskTextOutsideColor: string; + taskTextClickableColor: string; + activeTaskBorderColor: string; + activeTaskBkgColor: string; + gridColor: string; + doneTaskBkgColor: string; + doneTaskBorderColor: string; + critBorderColor: string; + critBkgColor: string; + todayLineColor: string; + vertLineColor: string; + personBorder: any; + personBkg: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + noteFontWeight: string; + fontWeight: string; + labelColor: string; + errorBkgColor: string; + errorTextColor: string; + useGradient: boolean; + gradientStart: any; + gradientStop: any; + dropShadow: string; + updateColors(): void; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + rowOdd: any; + rowEven: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: any; + specialStateColor: any; + classText: any; + fillType0: string | undefined; + fillType1: string | undefined; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + venn1: any; + venn2: any; + venn3: any; + venn4: any; + venn5: any; + venn6: any; + venn7: any; + venn8: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + packet: { + startByteColor: any; + endByteColor: any; + labelColor: any; + titleColor: any; + blockStrokeColor: any; + blockFillColor: string; + } | undefined; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-helpers.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-helpers.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..04c349c71888c3474217b51a8098eb7dd1516573 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-helpers.d.ts @@ -0,0 +1 @@ +export function mkBorder(col: any, darkMode: any): any; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-neo-dark.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-neo-dark.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6ceccae82691e777bb4a06b530dbfc293017a5a8 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-neo-dark.d.ts @@ -0,0 +1,211 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + /** # Base variables */ + /** + * - Background - used to know what the background color is of the diagram. This is used for + * deducing colors for instance line color. Default value is #f4f4f4. + */ + background: string; + primaryColor: string; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + mainBkg: string; + secondBkg: string; + mainContrastColor: string; + darkTextColor: any; + border1: string; + border2: any; + arrowheadColor: any; + fontFamily: string; + fontSize: string; + labelBackground: string; + textColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + noteBkgColor: string; + noteTextColor: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + noteFontWeight: string; + fontWeight: string; + updateColors(): void; + noteBorderColor: any; + lineColor: any; + nodeBkg: any; + nodeBorder: any; + clusterBkg: any; + clusterBorder: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + vertLineColor: any; + taskTextColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: any; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitDarkMode: boolean | undefined; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-neo.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-neo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8494cbbb3c54000ace1bbb2032d7d1f89b76d017 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-neo.d.ts @@ -0,0 +1,206 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + /** # Base variables */ + /** + * - Background - used to know what the background color is of the diagram. This is used for + * deducing colors for instance line color. Default value is #f4f4f4. + */ + background: string; + primaryColor: string; + mainBkg: string; + noteBkgColor: string; + noteTextColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + primaryBorderColor: any; + fontFamily: string; + fontSize: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + tertiaryColor: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + noteFontWeight: string; + fontWeight: string; + updateColors(): void; + primaryTextColor: any; + secondaryColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + noteBorderColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: any; + arrowheadColor: any; + textColor: any; + border2: any; + nodeBkg: any; + clusterBkg: any; + clusterBorder: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + taskTextOutsideColor: any; + vertLineColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-neutral.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-neutral.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e53e328456e368529c77996dad2f82089997cad4 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-neutral.d.ts @@ -0,0 +1,217 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + primaryColor: string; + contrast: string; + secondaryColor: any; + background: string; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: string; + textColor: any; + mainBkg: string; + secondBkg: string; + border1: string; + border2: string; + note: string; + text: string; + critical: string; + done: string; + arrowheadColor: string; + fontFamily: string; + fontSize: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + nodeBkg: string; + nodeBorder: string; + clusterBkg: string; + clusterBorder: string; + defaultLinkColor: string; + titleColor: string; + edgeLabelBackground: string; + actorBorder: string; + actorBkg: string; + actorTextColor: string; + actorLineColor: string; + signalColor: string; + signalTextColor: string; + labelBoxBkgColor: string; + labelBoxBorderColor: string; + labelTextColor: string; + loopTextColor: string; + noteBorderColor: string; + noteBkgColor: string; + noteTextColor: string; + activationBorderColor: string; + activationBkgColor: string; + sequenceNumberColor: string; + sectionBkgColor: string; + altSectionBkgColor: string; + sectionBkgColor2: string; + excludeBkgColor: string; + taskBorderColor: string; + taskBkgColor: string; + taskTextLightColor: string; + taskTextColor: string; + taskTextDarkColor: string; + taskTextOutsideColor: string; + taskTextClickableColor: string; + activeTaskBorderColor: string; + activeTaskBkgColor: string; + gridColor: string; + doneTaskBkgColor: string; + doneTaskBorderColor: string; + critBkgColor: string; + critBorderColor: string; + todayLineColor: string; + vertLineColor: string; + personBorder: any; + personBkg: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + noteFontWeight: string; + fontWeight: string; + rowOdd: any; + rowEven: string; + labelColor: string; + errorBkgColor: string; + errorTextColor: string; + useGradient: boolean; + gradientStart: any; + gradientStop: any; + dropShadow: string; + updateColors(): void; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + cScaleLabel0: any; + cScaleLabel2: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + stateBorder: any; + innerEndBackground: any; + specialStateColor: string | undefined; + classText: any; + fillType0: string | undefined; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + radar: any; + wardleyEvolutionColor: any; + wardley: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: string | undefined; + gitBranchLabel2: any; + gitBranchLabel3: string | undefined; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + emUiFill: any; + emUiStroke: any; + emProcessorFill: any; + emProcessorStroke: any; + emReadModelFill: any; + emReadModelStroke: any; + emCommandFill: any; + emCommandStroke: any; + emEventFill: any; + emEventStroke: any; + emSwimlaneBackgroundOdd: any; + emSwimlaneBackgroundStroke: any; + emArrowhead: any; + emRelationStroke: any; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-redux-color.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-redux-color.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0056efa057e847df621b66fb1dda4a7e72a097f --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-redux-color.d.ts @@ -0,0 +1,212 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + /** # Base variables */ + /** + * - Background - used to know what the background color is of the diagram. This is used for + * deducing colors for instance line color. Default value is #f4f4f4. + */ + background: string; + primaryColor: string; + mainBkg: string; + noteBkgColor: string; + noteTextColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + primaryBorderColor: any; + fontFamily: string; + fontSize: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + nodeShadow: boolean; + tertiaryColor: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + actorBorder: string; + noteBorderColor: string; + noteFontWeight: number; + borderColorArray: string[]; + bkgColorArray: string[]; + filterColor: string; + updateColors(): void; + primaryTextColor: any; + secondaryColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: any; + arrowheadColor: any; + textColor: any; + border2: any; + nodeBkg: any; + clusterBkg: any; + clusterBorder: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + vertLineColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLineColor: any; + commitLabelFontSize: any; + fontWeight: number | undefined; + erEdgeLabelBackground: string | undefined; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-redux-dark-color.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-redux-dark-color.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a4f37576bb2481f5570e764953ff32fb40bb76a --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-redux-dark-color.d.ts @@ -0,0 +1,218 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + /** # Base variables */ + /** + * - Background - used to know what the background color is of the diagram. This is used for + * deducing colors for instance line color. Default value is #f4f4f4. + */ + background: string; + primaryColor: string; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + mainBkg: string; + secondBkg: string; + mainContrastColor: string; + darkTextColor: any; + border1: string; + border2: any; + arrowheadColor: any; + fontFamily: string; + fontSize: string; + labelBackground: string; + textColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + noteBkgColor: string; + noteTextColor: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + nodeShadow: boolean; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + clusterBkg: string; + clusterBorder: string; + noteBorderColor: string; + noteFontWeight: number; + borderColorArray: string[]; + bkgColorArray: any[]; + filterColor: string; + updateColors(): void; + lineColor: any; + nodeBkg: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + signalColor: any; + labelBoxBorderColor: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalTextColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + rootLabelColor: string | undefined; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + vertLineColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + commitLineColor: any; + fontWeight: number | undefined; + erEdgeLabelBackground: string | undefined; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-redux-dark.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-redux-dark.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4f26acc93f5f1b60fae8fd45bf40c20794f94e55 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-redux-dark.d.ts @@ -0,0 +1,217 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + /** # Base variables */ + /** + * - Background - used to know what the background color is of the diagram. This is used for + * deducing colors for instance line color. Default value is #f4f4f4. + */ + background: string; + primaryColor: string; + secondaryColor: any; + tertiaryColor: any; + primaryBorderColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + primaryTextColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + mainBkg: string; + secondBkg: string; + mainContrastColor: string; + darkTextColor: any; + border1: string; + border2: any; + arrowheadColor: any; + fontFamily: string; + fontSize: string; + labelBackground: string; + textColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + noteBkgColor: string; + noteTextColor: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + nodeShadow: boolean; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + clusterBkg: string; + clusterBorder: string; + noteBorderColor: string; + noteFontWeight: number; + filterColor: string; + updateColors(): void; + lineColor: any; + nodeBkg: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + actorBorder: any; + signalColor: any; + labelBoxBorderColor: any; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalTextColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + vertLineColor: any; + compositeBackground: any; + altBackground: any; + compositeTitleBackground: any; + stateEdgeLabelBackground: string | undefined; + fontWeight: number | undefined; + stateBkg: any; + labelBackgroundColor: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + cScale0: any; + cScale1: any; + cScale2: any; + cScale3: any; + cScale4: any; + cScale5: any; + cScale6: any; + cScale7: any; + cScale8: any; + cScale9: any; + cScale10: any; + cScale11: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + requirementEdgeLabelBackground: string | undefined; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + commitLineColor: any; + erEdgeLabelBackground: string | undefined; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/themes/theme-redux.d.ts b/tools/ui/node_modules/mermaid/dist/themes/theme-redux.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..034ab87b3ba904ab00cbad0b4663f563abb70cb2 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/themes/theme-redux.d.ts @@ -0,0 +1,200 @@ +export function getThemeVariables(userOverrides: any): Theme; +declare class Theme { + /** # Base variables */ + /** + * - Background - used to know what the background color is of the diagram. This is used for + * deducing colors for instance line color. Default value is #f4f4f4. + */ + background: string; + primaryColor: string; + mainBkg: string; + noteBkgColor: string; + noteTextColor: string; + THEME_COLOR_LIMIT: number; + radius: number; + strokeWidth: number; + primaryBorderColor: any; + fontFamily: string; + fontSize: string; + nodeBorder: string; + stateBorder: string; + useGradient: boolean; + gradientStart: string; + gradientStop: string; + dropShadow: string; + nodeShadow: boolean; + tertiaryColor: string; + clusterBkg: string; + clusterBorder: string; + noteBorderColor: string; + archEdgeColor: string; + archEdgeArrowColor: string; + archEdgeWidth: string; + archGroupBorderColor: any; + archGroupBorderWidth: string; + actorBorder: string; + filterColor: string; + updateColors(): void; + primaryTextColor: any; + secondaryColor: any; + secondaryBorderColor: any; + tertiaryBorderColor: any; + secondaryTextColor: any; + tertiaryTextColor: any; + lineColor: any; + arrowheadColor: any; + textColor: any; + border2: any; + nodeBkg: any; + defaultLinkColor: any; + titleColor: any; + edgeLabelBackground: any; + nodeTextColor: any; + noteFontWeight: number | undefined; + actorBkg: any; + actorTextColor: any; + actorLineColor: any; + labelBoxBkgColor: any; + signalColor: any; + signalTextColor: any; + labelBoxBorderColor: any; + labelTextColor: any; + loopTextColor: any; + activationBorderColor: any; + activationBkgColor: any; + sequenceNumberColor: any; + sectionBkgColor: any; + altSectionBkgColor: any; + sectionBkgColor2: any; + excludeBkgColor: any; + taskBorderColor: any; + taskBkgColor: any; + activeTaskBorderColor: any; + activeTaskBkgColor: any; + gridColor: any; + doneTaskBkgColor: any; + doneTaskBorderColor: any; + critBorderColor: any; + critBkgColor: any; + todayLineColor: any; + taskTextColor: any; + vertLineColor: any; + taskTextOutsideColor: any; + taskTextLightColor: any; + taskTextDarkColor: any; + taskTextClickableColor: any; + personBorder: any; + personBkg: any; + transitionColor: any; + transitionLabelColor: any; + stateLabelColor: any; + compositeTitleBackground: any; + altBackground: any; + stateEdgeLabelBackground: string | undefined; + fontWeight: number | undefined; + stateBkg: any; + labelBackgroundColor: any; + compositeBackground: any; + compositeBorder: any; + innerEndBackground: string | undefined; + errorBkgColor: any; + errorTextColor: any; + specialStateColor: any; + scaleLabelColor: any; + classText: any; + fillType0: any; + fillType1: any; + fillType2: any; + fillType3: any; + fillType4: any; + fillType5: any; + fillType6: any; + fillType7: any; + pie1: any; + pie2: any; + pie3: any; + pie4: any; + pie5: any; + pie6: any; + pie7: any; + pie8: any; + pie9: any; + pie10: any; + pie11: any; + pie12: any; + pieTitleTextSize: any; + pieTitleTextColor: any; + pieSectionTextSize: any; + pieSectionTextColor: any; + pieLegendTextSize: any; + pieLegendTextColor: any; + pieStrokeColor: any; + pieStrokeWidth: any; + pieOuterStrokeWidth: any; + pieOuterStrokeColor: any; + pieOpacity: any; + vennTitleTextColor: any; + vennSetTextColor: any; + quadrant1Fill: any; + quadrant2Fill: any; + quadrant3Fill: any; + quadrant4Fill: any; + quadrant1TextFill: any; + quadrant2TextFill: any; + quadrant3TextFill: any; + quadrant4TextFill: any; + quadrantPointFill: any; + quadrantPointTextFill: any; + quadrantXAxisTextFill: any; + quadrantYAxisTextFill: any; + quadrantInternalBorderStrokeFill: any; + quadrantExternalBorderStrokeFill: any; + quadrantTitleFill: any; + xyChart: any; + requirementBackground: any; + requirementBorderColor: any; + requirementBorderSize: any; + requirementTextColor: any; + relationColor: any; + relationLabelBackground: any; + relationLabelColor: any; + requirementEdgeLabelBackground: string | undefined; + git0: any; + git1: any; + git2: any; + git3: any; + git4: any; + git5: any; + git6: any; + git7: any; + gitInv0: any; + gitInv1: any; + gitInv2: any; + gitInv3: any; + gitInv4: any; + gitInv5: any; + gitInv6: any; + gitInv7: any; + branchLabelColor: any; + gitBranchLabel0: any; + gitBranchLabel1: any; + gitBranchLabel2: any; + gitBranchLabel3: any; + gitBranchLabel4: any; + gitBranchLabel5: any; + gitBranchLabel6: any; + gitBranchLabel7: any; + tagLabelColor: any; + tagLabelBackground: any; + tagLabelBorder: any; + tagLabelFontSize: any; + commitLabelColor: any; + commitLabelBackground: any; + commitLabelFontSize: any; + commitLineColor: any; + erEdgeLabelBackground: string | undefined; + attributeBackgroundColorOdd: any; + attributeBackgroundColorEven: any; + calculate(overrides: any): void; +} +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/types.d.ts b/tools/ui/node_modules/mermaid/dist/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..37d270277afe85c597337b54224fa431511dfb07 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/types.d.ts @@ -0,0 +1,121 @@ +export interface NodeMetaData { + shape?: string; + label?: string; + icon?: string; + form?: string; + pos?: 't' | 'b'; + img?: string; + w?: string; + h?: string; + constraint?: 'on' | 'off'; + priority: 'Very High' | 'High' | 'Medium' | 'Low' | 'Very Low'; + assigned?: string; + ticket?: string; + labelType?: string; +} +export interface ParticipantMetaData { + type?: 'actor' | 'participant' | 'boundary' | 'control' | 'entity' | 'database' | 'collections' | 'queue'; + alias?: string; +} +export interface EdgeMetaData { + animation?: 'fast' | 'slow'; + animate?: boolean; + curve?: 'basis' | 'bumpX' | 'bumpY' | 'cardinal' | 'catmullRom' | 'linear' | 'monotoneX' | 'monotoneY' | 'natural' | 'step' | 'stepAfter' | 'stepBefore'; +} +import type { MermaidConfig } from './config.type.js'; +export interface Point { + x: number; + y: number; +} +export interface Bounds extends Point { + width: number; + height: number; +} +export interface TextDimensionConfig { + fontSize?: number; + fontWeight?: number; + fontFamily?: string; +} +export interface TextDimensions { + width: number; + height: number; + lineHeight?: number; +} +export interface EdgeData { + arrowheadStyle?: string; + labelpos?: string; + labelType?: string; + label?: string; + classes: string; + pattern: string; + id: string; + arrowhead: string; + startLabelRight: string; + endLabelLeft: string; + arrowTypeStart: string; + arrowTypeEnd: string; + style: string; + labelStyle: string; + curve: any; +} +export type ArrayElement
    = A extends readonly (infer T)[] ? T : never; +export interface ParseOptions { + /** + * If `true`, parse will return `false` instead of throwing error when the diagram is invalid. + * The `parseError` function will not be called. + */ + suppressErrors?: boolean; +} +export interface ParseResult { + /** + * The diagram type, e.g. 'flowchart', 'sequence', etc. + */ + diagramType: string; + /** + * The config passed as YAML frontmatter or directives + */ + config: MermaidConfig; +} +/** + * This makes it clear that we're working with a d3 selected element of some + * kind, even though it's hard to specify the exact type. + * + * @deprecated Use {@link D3Selection} or {@link D3HtmlSelection} instead, depending on the use case. + */ +export type D3Element = any; +/** + * Helper type for d3 selections. + */ +export type D3Selection = D3HtmlSelection; +/** + * Helper type for d3 selections of any {@link Element}, not just SVG elements. + * + * Prefer using {@link D3Selection} whenever possible. + */ +export type D3HtmlSelection = d3.Selection; +export interface RenderResult { + /** + * The svg code for the rendered graph. + */ + svg: string; + /** + * The diagram type, e.g. 'flowchart', 'sequence', etc. + */ + diagramType: string; + /** + * Bind function to be called after the svg has been inserted into the DOM. + * This is necessary for adding event listeners to the elements in the svg. + * ```js + * const { svg, bindFunctions } = await mermaid.render('id1', 'graph TD;A-->B'); + * div.innerHTML = svg; + * bindFunctions?.(div); // To call bindFunctions only if it's present. + * ``` + */ + bindFunctions?: (element: Element) => void; +} +/** + * Can be converted back to `T` by awaiting/`Awaited`. + * + * This is useful for function types that may be either synchronous or asynchronous. + */ +export type MaybePromise = T | Promise; diff --git a/tools/ui/node_modules/mermaid/dist/utils.d.ts b/tools/ui/node_modules/mermaid/dist/utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..24bdbebceaf0b431d65f2839ad3bb78c7c407483 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/utils.d.ts @@ -0,0 +1,309 @@ +import type { BaseType, CurveFactory } from 'd3'; +import type { MermaidConfig } from './config.type.js'; +import type { D3Element, Point, TextDimensionConfig, TextDimensions } from './types.js'; +export declare const ZERO_WIDTH_SPACE = "\u200B"; +/** + * Detects the init config object from the text + * + * @param text - The text defining the graph. For example: + * + * ```mermaid + * %%{init: {"theme": "debug", "logLevel": 1 }}%% + * graph LR + * a-->b + * b-->c + * c-->d + * d-->e + * e-->f + * f-->g + * g-->h + * ``` + * + * Or + * + * ```mermaid + * %%{initialize: {"theme": "dark", logLevel: "debug" }}%% + * graph LR + * a-->b + * b-->c + * c-->d + * d-->e + * e-->f + * f-->g + * g-->h + * ``` + * + * @param config - Optional mermaid configuration object. + * @returns The json object representing the init passed to mermaid.initialize() + */ +export declare const detectInit: (text: string, config?: MermaidConfig) => MermaidConfig | undefined; +interface Directive { + type?: string; + args?: unknown; +} +/** + * Detects the directive from the text. + * + * Text can be single line or multiline. If type is null or omitted, + * the first directive encountered in text will be returned + * + * ```mermaid + * graph LR + * %%{someDirective}%% + * a-->b + * b-->c + * c-->d + * d-->e + * e-->f + * f-->g + * g-->h + * ``` + * + * @param text - The text defining the graph + * @param type - The directive to return (default: `null`) + * @returns An object or Array representing the directive(s) matched by the input type. + * If a single directive was found, that directive object will be returned. + */ +export declare const detectDirective: (text: string, type?: string | RegExp | null) => Directive | Directive[]; +export declare const removeDirectives: (text: string) => string; +/** + * Detects whether a substring in present in a given array + * + * @param str - The substring to detect + * @param arr - The array to search + * @returns The array index containing the substring or -1 if not present + */ +export declare const isSubstringInArray: (str: string, arr: string[]) => number; +/** + * Returns a d3 curve given a curve name + * + * @param interpolate - The interpolation name + * @param defaultCurve - The default curve to return + * @returns The curve factory to use + */ +export declare function interpolateToCurve(interpolate: string | undefined, defaultCurve: CurveFactory): CurveFactory; +/** + * Formats a URL string + * + * @param linkStr - String of the URL + * @param config - Configuration passed to MermaidJS + * @returns The formatted URL or `undefined`. + */ +export declare function formatUrl(linkStr: string, config: MermaidConfig): string | undefined; +/** + * Runs a function + * + * @param functionName - A dot separated path to the function relative to the `window` + * @param params - Parameters to pass to the function + */ +export declare const runFunc: (functionName: string, ...params: unknown[]) => void; +/** + * {@inheritdoc traverseEdge} + */ +declare function calcLabelPosition(points: Point[]): Point; +export declare const roundNumber: (num: number, precision?: number) => number; +export declare const calculatePoint: (points: Point[], distanceToTraverse: number) => Point; +/** + * Calculates the terminal label position. + * + * @param terminalMarkerSize - Terminal marker size. + * @param position - Position of label relative to points. + * @param _points - Array of points. + * @returns - The `cardinalityPosition`. + */ +declare function calcTerminalLabelPosition(terminalMarkerSize: number, position: 'start_left' | 'start_right' | 'end_left' | 'end_right', _points: Point[]): Point; +/** + * Gets styles from an array of declarations + * + * @param arr - Declarations + * @returns The styles grouped as strings + */ +export declare function getStylesFromArray(arr: string[]): { + style: string; + labelStyle: string; +}; +export declare const generateId: () => string; +export declare const random: (options: { + length: number; +}) => string; +export declare const getTextObj: () => { + x: number; + y: number; + fill: undefined; + anchor: string; + style: string; + width: number; + height: number; + textMargin: number; + rx: number; + ry: number; + valign: undefined; + text: string; +}; +/** + * Adds text to an element + * + * @param elem - SVG Element to add text to + * @param textData - Text options. + * @returns Text element with given styling and content + */ +export declare const drawSimpleText: (elem: SVGElement, textData: { + text: string; + x: number; + y: number; + anchor: "start" | "middle" | "end"; + fontFamily: string; + fontSize: string | number; + fontWeight: string | number; + fill: string; + class: string | undefined; + textMargin: number; +}) => SVGTextElement; +interface WrapLabelConfig { + fontSize: number; + fontFamily: string; + fontWeight: number; + joinWith: string; +} +export declare const wrapLabel: (label: string, maxWidth: number, config: WrapLabelConfig) => string; +/** + * This calculates the text's height, taking into account the wrap breaks and both the statically + * configured height, width, and the length of the text (in pixels). + * + * If the wrapped text has greater height, we extend the height, so it's value won't overflow. + * + * @param text - The text to measure + * @param config - The config for fontSize, fontFamily, and fontWeight all impacting the + * resulting size + * @returns The height for the given text + */ +export declare function calculateTextHeight(text: Parameters[0], config: Parameters[1]): ReturnType['height']; +/** + * This calculates the width of the given text, font size and family. + * + * @param text - The text to calculate the width of + * @param config - The config for fontSize, fontFamily, and fontWeight all impacting the + * resulting size + * @returns The width for the given text + */ +export declare function calculateTextWidth(text: Parameters[0], config: Parameters[1]): ReturnType['width']; +/** + * This calculates the dimensions of the given text, font size, font family, font weight, and + * margins. + * + * @param text - The text to calculate the width of + * @param config - The config for fontSize, fontFamily, fontWeight, and margin all impacting + * the resulting size + * @returns The dimensions for the given text + */ +export declare const calculateTextDimensions: (text: string, config: TextDimensionConfig) => TextDimensions; +export declare class InitIDGenerator { + private count; + next: () => number; + constructor(deterministic?: boolean, seed?: string); +} +/** + * Decodes HTML, source: {@link https://github.com/shrpne/entity-decode/blob/v2.0.1/browser.js} + * + * @param html - HTML as a string + * @returns Unescaped HTML + */ +export declare const entityDecode: (html: string) => string; +export interface DetailedError { + str: string; + hash: any; + error?: any; + message?: string; +} +/** @param error - The error to check */ +export declare function isDetailedError(error: any): error is DetailedError; +/** @param error - The error to convert to an error message */ +export declare function getErrorMessage(error: unknown): string; +/** + * Appends element with the given title and css class. + * + * @param parent - d3 svg object to append title to + * @param cssClass - CSS class for the element containing the title + * @param titleTopMargin - Margin in pixels between title and rest of the graph + * @param title - The title. If empty, returns immediately. + */ +export declare const insertTitle: (parent: D3Element, cssClass: string, titleTopMargin: number, title?: string) => void; +/** + * Parses a raw fontSize configuration value into a number and string value. + * + * @param fontSize - a string or number font size configuration value + * + * @returns parsed number and string style font size values, or nulls if a number value can't + * be parsed from an input string. + */ +export declare const parseFontSize: (fontSize: string | number | undefined) => [number?, string?]; +export declare function cleanAndMerge(defaultData: T, data?: Partial): T; +declare const _default: { + assignWithDepth: (dst: any, src: any, { depth, clobber }?: { + depth?: number; + clobber?: boolean; + }) => any; + wrapLabel: (label: string, maxWidth: number, config: WrapLabelConfig) => string; + calculateTextHeight: typeof calculateTextHeight; + calculateTextWidth: typeof calculateTextWidth; + calculateTextDimensions: (text: string, config: TextDimensionConfig) => TextDimensions; + cleanAndMerge: typeof cleanAndMerge; + detectInit: (text: string, config?: MermaidConfig) => MermaidConfig | undefined; + detectDirective: (text: string, type?: string | RegExp | null) => Directive | Directive[]; + isSubstringInArray: (str: string, arr: string[]) => number; + interpolateToCurve: typeof interpolateToCurve; + calcLabelPosition: typeof calcLabelPosition; + calcCardinalityPosition: (isRelationTypePresent: boolean, points: Point[], initialPosition: Point) => { + x: number; + y: number; + }; + calcTerminalLabelPosition: typeof calcTerminalLabelPosition; + formatUrl: typeof formatUrl; + getStylesFromArray: typeof getStylesFromArray; + generateId: () => string; + random: (options: { + length: number; + }) => string; + runFunc: (functionName: string, ...params: unknown[]) => void; + entityDecode: (html: string) => string; + insertTitle: (parent: D3Element, cssClass: string, titleTopMargin: number, title?: string) => void; + isLabelCoordinateInPath: typeof isLabelCoordinateInPath; + parseFontSize: (fontSize: string | number | undefined) => [number?, string?]; + InitIDGenerator: typeof InitIDGenerator; +}; +export default _default; +/** + * @param text - text to be encoded + * @returns + */ +export declare const encodeEntities: (text: string) => string; +/** + * Partially reverts encoding done via {@link encodeEntities} + * + * @param text - text to be decoded + * @returns + */ +export declare const decodeEntities: (text: string) => string; +export declare const isString: (value: unknown) => value is string; +export declare const getEdgeId: (from: string, to: string, { counter, prefix, suffix, }: { + counter?: number; + prefix?: string; + suffix?: string; +}, id?: string) => string; +/** + * D3's `selection.attr` method doesn't officially support `undefined`. + * + * However, it seems if you do pass `undefined`, it seems to be treated as `null` + * (e.g. it removes the attribute). + */ +export declare function handleUndefinedAttr(attrValue: Parameters['attr']>[1] | undefined): string | number | boolean | readonly (string | number)[] | import("d3-selection").ValueFn | null; +/** + * Checks if the x or y coordinate of the edge label + * appears in the given SVG path data string. + * + * @param point - The Point object with x and y properties to check. + * @param dAttr - SVG path data string (the 'd' attribute of an SVG path element). + * @returns - True if the rounded x or y coordinate of the edge label is found + * in the sanitized path data string; otherwise, false. + */ +export declare function isLabelCoordinateInPath(point: Point, dAttr: string): boolean; diff --git a/tools/ui/node_modules/mermaid/dist/utils.spec.d.ts b/tools/ui/node_modules/mermaid/dist/utils.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/utils.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/utils/base64.d.ts b/tools/ui/node_modules/mermaid/dist/utils/base64.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4e93f648e02b51b9941b40bec93e431e4cb1e675 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/utils/base64.d.ts @@ -0,0 +1 @@ +export declare function toBase64(str: string): string; diff --git a/tools/ui/node_modules/mermaid/dist/utils/imperativeState.d.ts b/tools/ui/node_modules/mermaid/dist/utils/imperativeState.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f20cea25cadff8afd752b2d5f849c54effa5d9f2 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/utils/imperativeState.d.ts @@ -0,0 +1,32 @@ +/** + * Resettable state storage. + * @example + * ``` + * const state = new ImperativeState(() => ({ + * foo: undefined as string | undefined, + * bar: [] as number[], + * baz: 1 as number | undefined, + * })); + * + * state.records.foo = "hi"; + * console.log(state.records.foo); // prints "hi"; + * state.reset(); + * console.log(state.records.foo); // prints "default"; + * + * // typeof state.records: + * // { + * // foo: string | undefined, // actual: undefined + * // bar: number[], // actual: [] + * // baz: number | undefined, // actual: 1 + * // } + * ``` + */ +export declare class ImperativeState { + private init; + records: S; + /** + * @param init - Function that creates the default state. + */ + constructor(init: () => S); + reset(): void; +} diff --git a/tools/ui/node_modules/mermaid/dist/utils/imperativeState.spec.d.ts b/tools/ui/node_modules/mermaid/dist/utils/imperativeState.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/utils/imperativeState.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/dist/utils/lineWithOffset.d.ts b/tools/ui/node_modules/mermaid/dist/utils/lineWithOffset.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5e2f9815ab82c46679d62cadd6f5db17be53a5dd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/utils/lineWithOffset.d.ts @@ -0,0 +1,20 @@ +import type { EdgeData, Point } from '../types.js'; +export declare const markerOffsets: { + readonly aggregation: 17.25; + readonly extension: 17.25; + readonly composition: 17.25; + readonly dependency: 6; + readonly lollipop: 13.5; + readonly arrow_point: 4; + readonly arrow_barb: 0; + readonly arrow_barb_neo: 5.5; +}; +export declare const markerOffsets2: { + readonly arrow_point: 4; + readonly arrow_cross: 12.5; + readonly arrow_circle: 12.5; +}; +export declare const getLineFunctionsWithOffset: (edge: Pick) => { + x: (this: void, d: Point | [number, number], i: number, data: (Point | [number, number])[]) => number; + y: (this: void, d: Point | [number, number], i: number, data: (Point | [number, number])[]) => number; +}; diff --git a/tools/ui/node_modules/mermaid/dist/utils/sanitizeDirective.d.ts b/tools/ui/node_modules/mermaid/dist/utils/sanitizeDirective.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2281b80f13b40bc0a4ddfadcedd447d50bc6b0cd --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/utils/sanitizeDirective.d.ts @@ -0,0 +1,7 @@ +/** + * Sanitizes directive objects + * + * @param args - Directive's JSON + */ +export declare const sanitizeDirective: (args: any) => void; +export declare const sanitizeCss: (str: string) => string; diff --git a/tools/ui/node_modules/mermaid/dist/utils/subGraphTitleMargins.d.ts b/tools/ui/node_modules/mermaid/dist/utils/subGraphTitleMargins.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..237f5908bf08fd69609de94dc6b9257f5c8fd919 --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/utils/subGraphTitleMargins.d.ts @@ -0,0 +1,8 @@ +import type { FlowchartDiagramConfig } from '../config.type.js'; +export declare const getSubGraphTitleMargins: ({ flowchart, }: { + flowchart: FlowchartDiagramConfig; +}) => { + subGraphTitleTopMargin: number; + subGraphTitleBottomMargin: number; + subGraphTitleTotalMargin: number; +}; diff --git a/tools/ui/node_modules/mermaid/dist/utils/subGraphTitleMargins.spec.d.ts b/tools/ui/node_modules/mermaid/dist/utils/subGraphTitleMargins.spec.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb0ff5c3b541f646105198ee23ac0fc3d805023e --- /dev/null +++ b/tools/ui/node_modules/mermaid/dist/utils/subGraphTitleMargins.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/ui/node_modules/mermaid/package.json b/tools/ui/node_modules/mermaid/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6c6b92ba75e6cf295105122fcf1395adbf844b89 --- /dev/null +++ b/tools/ui/node_modules/mermaid/package.json @@ -0,0 +1,140 @@ +{ + "name": "mermaid", + "version": "11.15.0", + "description": "Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.", + "type": "module", + "module": "./dist/mermaid.core.mjs", + "types": "./dist/mermaid.d.ts", + "exports": { + ".": { + "types": "./dist/mermaid.d.ts", + "import": "./dist/mermaid.core.mjs", + "default": "./dist/mermaid.core.mjs" + }, + "./*": "./*" + }, + "keywords": [ + "diagram", + "markdown", + "flowchart", + "sequence diagram", + "gantt", + "class diagram", + "git graph", + "mindmap", + "packet diagram", + "c4 diagram", + "er diagram", + "pie chart", + "pie diagram", + "quadrant chart", + "requirement diagram", + "graph", + "eventmodeling diagram" + ], + "repository": { + "type": "git", + "url": "https://github.com/mermaid-js/mermaid" + }, + "author": "Knut Sveidqvist", + "license": "MIT", + "standard": { + "ignore": [ + "**/parser/*.js", + "dist/**/*.js", + "cypress/**/*.js" + ], + "globals": [ + "page" + ] + }, + "dependencies": { + "@braintree/sanitize-url": "^7.1.1", + "@iconify/utils": "^3.0.2", + "@types/d3": "^7.4.3", + "@upsetjs/venn.js": "^2.0.0", + "cytoscape": "^3.33.1", + "cytoscape-cose-bilkent": "^4.1.0", + "cytoscape-fcose": "^2.2.0", + "d3": "^7.9.0", + "d3-sankey": "^0.12.3", + "dagre-d3-es": "7.0.14", + "dayjs": "^1.11.19", + "dompurify": "^3.3.1", + "es-toolkit": "^1.45.1", + "katex": "^0.16.25", + "khroma": "^2.1.0", + "marked": "^16.3.0", + "roughjs": "^4.6.6", + "stylis": "^4.3.6", + "ts-dedent": "^2.2.0", + "uuid": "^11.1.0 || ^12 || ^13 || ^14.0.0", + "@mermaid-js/parser": "^1.1.1" + }, + "devDependencies": { + "@adobe/jsonschema2md": "^8.0.8", + "@iconify/types": "^2.0.0", + "@types/cytoscape": "^3.21.9", + "@types/cytoscape-fcose": "^2.2.5", + "@types/d3-sankey": "^0.12.5", + "@types/d3-scale": "^4.0.9", + "@types/d3-scale-chromatic": "^3.1.0", + "@types/d3-selection": "^3.0.11", + "@types/d3-shape": "^3.1.7", + "@types/jsdom": "^21.1.7", + "@types/katex": "^0.16.7", + "@types/micromatch": "^4.0.10", + "@types/stylis": "^4.2.7", + "ajv": "^8.17.1", + "canvas": "^3.2.0", + "chokidar": "3.6.0", + "concurrently": "^9.2.1", + "csstree-validator": "^4.0.1", + "globby": "^14.1.0", + "jison": "^0.4.18", + "js-base64": "^3.7.8", + "jsdom": "^26.1.0", + "json-schema-to-typescript": "^15.0.4", + "micromatch": "^4.0.8", + "path-browserify": "^1.0.1", + "prettier": "^3.6.2", + "remark": "^15.0.1", + "remark-frontmatter": "^5.0.0", + "remark-gfm": "^4.0.1", + "rimraf": "^6.0.1", + "start-server-and-test": "^2.1.3", + "type-fest": "^4.41.0", + "typedoc": "^0.28.15", + "typedoc-plugin-markdown": "^4.8.1", + "typescript": "~5.7.3", + "unist-util-flatmap": "^1.0.0", + "unist-util-visit": "^5.0.0", + "vitepress": "^1.6.4", + "vitepress-plugin-search": "1.0.4-alpha.22" + }, + "files": [ + "dist/", + "README.md" + ], + "publishConfig": { + "access": "public" + }, + "scripts": { + "clean": "rimraf dist", + "dev": "pnpm -w dev", + "docs:code": "typedoc src/defaultConfig.ts src/config.ts src/mermaid.ts && prettier --write ./src/docs/config/setup", + "docs:build": "rimraf ../../docs && pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts", + "docs:verify": "pnpm docs:code && pnpm docs:spellcheck && tsx scripts/docs.cli.mts --verify", + "docs:pre:vitepress": "pnpm --filter ./src/docs prefetch && rimraf src/vitepress && pnpm docs:code && tsx scripts/docs.cli.mts --vitepress && pnpm --filter ./src/vitepress install --no-frozen-lockfile --ignore-scripts", + "docs:build:vitepress": "pnpm docs:pre:vitepress && (cd src/vitepress && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing", + "docs:dev": "pnpm docs:pre:vitepress && concurrently \"pnpm --filter ./src/vitepress dev\" \"tsx scripts/docs.cli.mts --watch --vitepress\"", + "docs:dev:docker": "pnpm docs:pre:vitepress && concurrently \"pnpm --filter ./src/vitepress dev:docker\" \"tsx scripts/docs.cli.mts --watch --vitepress\"", + "docs:serve": "pnpm docs:build:vitepress && vitepress serve src/vitepress", + "docs:spellcheck": "cspell \"src/docs/**/*.md\"", + "docs:release-version": "tsx scripts/update-release-version.mts", + "docs:verify-version": "tsx scripts/update-release-version.mts --verify", + "types:build-config": "tsx scripts/create-types-from-json-schema.mts", + "types:verify-config": "tsx scripts/create-types-from-json-schema.mts --verify", + "checkCircle": "npx madge --circular ./src" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/index.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bd832f665cfdf802955e1fb1663357efe8d03eff --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/index.d.ts @@ -0,0 +1,23 @@ +export { attention } from "./lib/attention.js"; +export { autolink } from "./lib/autolink.js"; +export { blankLine } from "./lib/blank-line.js"; +export { blockQuote } from "./lib/block-quote.js"; +export { characterEscape } from "./lib/character-escape.js"; +export { characterReference } from "./lib/character-reference.js"; +export { codeFenced } from "./lib/code-fenced.js"; +export { codeIndented } from "./lib/code-indented.js"; +export { codeText } from "./lib/code-text.js"; +export { content } from "./lib/content.js"; +export { definition } from "./lib/definition.js"; +export { hardBreakEscape } from "./lib/hard-break-escape.js"; +export { headingAtx } from "./lib/heading-atx.js"; +export { htmlFlow } from "./lib/html-flow.js"; +export { htmlText } from "./lib/html-text.js"; +export { labelEnd } from "./lib/label-end.js"; +export { labelStartImage } from "./lib/label-start-image.js"; +export { labelStartLink } from "./lib/label-start-link.js"; +export { lineEnding } from "./lib/line-ending.js"; +export { list } from "./lib/list.js"; +export { setextUnderline } from "./lib/setext-underline.js"; +export { thematicBreak } from "./lib/thematic-break.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/index.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..ca7a93a9a2807d2076f2cc871f10d62d40e1265d --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/index.js b/tools/ui/node_modules/micromark-core-commonmark/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f9143e09370ab0b29c410c5efadc2bc529dd7ee1 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/index.js @@ -0,0 +1,22 @@ +export {attention} from './lib/attention.js' +export {autolink} from './lib/autolink.js' +export {blankLine} from './lib/blank-line.js' +export {blockQuote} from './lib/block-quote.js' +export {characterEscape} from './lib/character-escape.js' +export {characterReference} from './lib/character-reference.js' +export {codeFenced} from './lib/code-fenced.js' +export {codeIndented} from './lib/code-indented.js' +export {codeText} from './lib/code-text.js' +export {content} from './lib/content.js' +export {definition} from './lib/definition.js' +export {hardBreakEscape} from './lib/hard-break-escape.js' +export {headingAtx} from './lib/heading-atx.js' +export {htmlFlow} from './lib/html-flow.js' +export {htmlText} from './lib/html-text.js' +export {labelEnd} from './lib/label-end.js' +export {labelStartImage} from './lib/label-start-image.js' +export {labelStartLink} from './lib/label-start-link.js' +export {lineEnding} from './lib/line-ending.js' +export {list} from './lib/list.js' +export {setextUnderline} from './lib/setext-underline.js' +export {thematicBreak} from './lib/thematic-break.js' diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c8a1747cd541882f27256474956bf083271d56d --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const attention: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=attention.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..a903a8668f8add6b01762fe3636413a980b97d87 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/attention.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"attention.d.ts","sourceRoot":"","sources":["attention.js"],"names":[],"mappings":"AAoBA,wBAAwB;AACxB,wBADW,SAAS,CAKnB;+BAdS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/attention.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/attention.js new file mode 100644 index 0000000000000000000000000000000000000000..9c93eb83f76e7948172bb84eb49acfc3595b84ad --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/attention.js @@ -0,0 +1,300 @@ +/** + * @import { + * Code, + * Construct, + * Event, + * Point, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {push, splice} from 'micromark-util-chunked' +import {classifyCharacter} from 'micromark-util-classify-character' +import {resolveAll} from 'micromark-util-resolve-all' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const attention = { + name: 'attention', + resolveAll: resolveAllAttention, + tokenize: tokenizeAttention +} + +/** + * Take all events and resolve attention to emphasis or strong. + * + * @type {Resolver} + */ +// eslint-disable-next-line complexity +function resolveAllAttention(events, context) { + let index = -1 + /** @type {number} */ + let open + /** @type {Token} */ + let group + /** @type {Token} */ + let text + /** @type {Token} */ + let openingSequence + /** @type {Token} */ + let closingSequence + /** @type {number} */ + let use + /** @type {Array} */ + let nextEvents + /** @type {number} */ + let offset + + // Walk through all events. + // + // Note: performance of this is fine on an mb of normal markdown, but it’s + // a bottleneck for malicious stuff. + while (++index < events.length) { + // Find a token that can close. + if ( + events[index][0] === 'enter' && + events[index][1].type === 'attentionSequence' && + events[index][1]._close + ) { + open = index + + // Now walk back to find an opener. + while (open--) { + // Find a token that can open the closer. + if ( + events[open][0] === 'exit' && + events[open][1].type === 'attentionSequence' && + events[open][1]._open && + // If the markers are the same: + context.sliceSerialize(events[open][1]).charCodeAt(0) === + context.sliceSerialize(events[index][1]).charCodeAt(0) + ) { + // If the opening can close or the closing can open, + // and the close size *is not* a multiple of three, + // but the sum of the opening and closing size *is* multiple of three, + // then don’t match. + if ( + (events[open][1]._close || events[index][1]._open) && + (events[index][1].end.offset - events[index][1].start.offset) % 3 && + !( + (events[open][1].end.offset - + events[open][1].start.offset + + events[index][1].end.offset - + events[index][1].start.offset) % + 3 + ) + ) { + continue + } + + // Number of markers to use from the sequence. + use = + events[open][1].end.offset - events[open][1].start.offset > 1 && + events[index][1].end.offset - events[index][1].start.offset > 1 + ? 2 + : 1 + + const start = {...events[open][1].end} + const end = {...events[index][1].start} + movePoint(start, -use) + movePoint(end, use) + + openingSequence = { + type: use > 1 ? types.strongSequence : types.emphasisSequence, + start, + end: {...events[open][1].end} + } + closingSequence = { + type: use > 1 ? types.strongSequence : types.emphasisSequence, + start: {...events[index][1].start}, + end + } + text = { + type: use > 1 ? types.strongText : types.emphasisText, + start: {...events[open][1].end}, + end: {...events[index][1].start} + } + group = { + type: use > 1 ? types.strong : types.emphasis, + start: {...openingSequence.start}, + end: {...closingSequence.end} + } + + events[open][1].end = {...openingSequence.start} + events[index][1].start = {...closingSequence.end} + + nextEvents = [] + + // If there are more markers in the opening, add them before. + if (events[open][1].end.offset - events[open][1].start.offset) { + nextEvents = push(nextEvents, [ + ['enter', events[open][1], context], + ['exit', events[open][1], context] + ]) + } + + // Opening. + nextEvents = push(nextEvents, [ + ['enter', group, context], + ['enter', openingSequence, context], + ['exit', openingSequence, context], + ['enter', text, context] + ]) + + // Always populated by defaults. + assert( + context.parser.constructs.insideSpan.null, + 'expected `insideSpan` to be populated' + ) + + // Between. + nextEvents = push( + nextEvents, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + 1, index), + context + ) + ) + + // Closing. + nextEvents = push(nextEvents, [ + ['exit', text, context], + ['enter', closingSequence, context], + ['exit', closingSequence, context], + ['exit', group, context] + ]) + + // If there are more markers in the closing, add them after. + if (events[index][1].end.offset - events[index][1].start.offset) { + offset = 2 + nextEvents = push(nextEvents, [ + ['enter', events[index][1], context], + ['exit', events[index][1], context] + ]) + } else { + offset = 0 + } + + splice(events, open - 1, index - open + 3, nextEvents) + + index = open + nextEvents.length - offset - 2 + break + } + } + } + } + + // Remove remaining sequences. + index = -1 + + while (++index < events.length) { + if (events[index][1].type === 'attentionSequence') { + events[index][1].type = 'data' + } + } + + return events +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeAttention(effects, ok) { + const attentionMarkers = this.parser.constructs.attentionMarkers.null + const previous = this.previous + const before = classifyCharacter(previous) + + /** @type {NonNullable} */ + let marker + + return start + + /** + * Before a sequence. + * + * ```markdown + * > | ** + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert( + code === codes.asterisk || code === codes.underscore, + 'expected asterisk or underscore' + ) + marker = code + effects.enter('attentionSequence') + return inside(code) + } + + /** + * In a sequence. + * + * ```markdown + * > | ** + * ^^ + * ``` + * + * @type {State} + */ + function inside(code) { + if (code === marker) { + effects.consume(code) + return inside + } + + const token = effects.exit('attentionSequence') + + // To do: next major: move this to resolver, just like `markdown-rs`. + const after = classifyCharacter(code) + + // Always populated by defaults. + assert(attentionMarkers, 'expected `attentionMarkers` to be populated') + + const open = + !after || + (after === constants.characterGroupPunctuation && before) || + attentionMarkers.includes(code) + const close = + !before || + (before === constants.characterGroupPunctuation && after) || + attentionMarkers.includes(previous) + + token._open = Boolean( + marker === codes.asterisk ? open : open && (before || !close) + ) + token._close = Boolean( + marker === codes.asterisk ? close : close && (after || !open) + ) + return ok(code) + } +} + +/** + * Move a point a bit. + * + * Note: `move` only works inside lines! It’s not possible to move past other + * chunks (replacement characters, tabs, or line endings). + * + * @param {Point} point + * Point. + * @param {number} offset + * Amount to move. + * @returns {undefined} + * Nothing. + */ +function movePoint(point, offset) { + point.column += offset + point.offset += offset + point._bufferIndex += offset +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a69457b269fcc1d83c432756ca186d793bac5395 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const autolink: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=autolink.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7b0216b0a09072c2df4bee60f469f5ff8750c413 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/autolink.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"autolink.d.ts","sourceRoot":"","sources":["autolink.js"],"names":[],"mappings":"AAkBA,wBAAwB;AACxB,uBADW,SAAS,CACkD;+BAb5D,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/autolink.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/autolink.js new file mode 100644 index 0000000000000000000000000000000000000000..b951120f88df46eeb96aa1137ca85fd6d8de3f6b --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/autolink.js @@ -0,0 +1,269 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import { + asciiAlphanumeric, + asciiAlpha, + asciiAtext, + asciiControl +} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const autolink = {name: 'autolink', tokenize: tokenizeAutolink} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeAutolink(effects, ok, nok) { + let size = 0 + + return start + + /** + * Start of an autolink. + * + * ```markdown + * > | ab + * ^ + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.lessThan, 'expected `<`') + effects.enter(types.autolink) + effects.enter(types.autolinkMarker) + effects.consume(code) + effects.exit(types.autolinkMarker) + effects.enter(types.autolinkProtocol) + return open + } + + /** + * After `<`, at protocol or atext. + * + * ```markdown + * > | ab + * ^ + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (asciiAlpha(code)) { + effects.consume(code) + return schemeOrEmailAtext + } + + if (code === codes.atSign) { + return nok(code) + } + + return emailAtext(code) + } + + /** + * At second byte of protocol or atext. + * + * ```markdown + * > | ab + * ^ + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function schemeOrEmailAtext(code) { + // ASCII alphanumeric and `+`, `-`, and `.`. + if ( + code === codes.plusSign || + code === codes.dash || + code === codes.dot || + asciiAlphanumeric(code) + ) { + // Count the previous alphabetical from `open` too. + size = 1 + return schemeInsideOrEmailAtext(code) + } + + return emailAtext(code) + } + + /** + * In ambiguous protocol or atext. + * + * ```markdown + * > | ab + * ^ + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function schemeInsideOrEmailAtext(code) { + if (code === codes.colon) { + effects.consume(code) + size = 0 + return urlInside + } + + // ASCII alphanumeric and `+`, `-`, and `.`. + if ( + (code === codes.plusSign || + code === codes.dash || + code === codes.dot || + asciiAlphanumeric(code)) && + size++ < constants.autolinkSchemeSizeMax + ) { + effects.consume(code) + return schemeInsideOrEmailAtext + } + + size = 0 + return emailAtext(code) + } + + /** + * After protocol, in URL. + * + * ```markdown + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function urlInside(code) { + if (code === codes.greaterThan) { + effects.exit(types.autolinkProtocol) + effects.enter(types.autolinkMarker) + effects.consume(code) + effects.exit(types.autolinkMarker) + effects.exit(types.autolink) + return ok + } + + // ASCII control, space, or `<`. + if ( + code === codes.eof || + code === codes.space || + code === codes.lessThan || + asciiControl(code) + ) { + return nok(code) + } + + effects.consume(code) + return urlInside + } + + /** + * In email atext. + * + * ```markdown + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function emailAtext(code) { + if (code === codes.atSign) { + effects.consume(code) + return emailAtSignOrDot + } + + if (asciiAtext(code)) { + effects.consume(code) + return emailAtext + } + + return nok(code) + } + + /** + * In label, after at-sign or dot. + * + * ```markdown + * > | ab + * ^ ^ + * ``` + * + * @type {State} + */ + function emailAtSignOrDot(code) { + return asciiAlphanumeric(code) ? emailLabel(code) : nok(code) + } + + /** + * In label, where `.` and `>` are allowed. + * + * ```markdown + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function emailLabel(code) { + if (code === codes.dot) { + effects.consume(code) + size = 0 + return emailAtSignOrDot + } + + if (code === codes.greaterThan) { + // Exit, then change the token type. + effects.exit(types.autolinkProtocol).type = types.autolinkEmail + effects.enter(types.autolinkMarker) + effects.consume(code) + effects.exit(types.autolinkMarker) + effects.exit(types.autolink) + return ok + } + + return emailValue(code) + } + + /** + * In label, where `.` and `>` are *not* allowed. + * + * Though, this is also used in `emailLabel` to parse other values. + * + * ```markdown + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function emailValue(code) { + // ASCII alphanumeric or `-`. + if ( + (code === codes.dash || asciiAlphanumeric(code)) && + size++ < constants.autolinkDomainSizeMax + ) { + const next = code === codes.dash ? emailValue : emailLabel + effects.consume(code) + return next + } + + return nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a8deca617ee590e8028a5a3caec897d6c5b44d6 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const blankLine: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=blank-line.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f12302d76e6834ec78fb367b18810cba19273ce7 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/blank-line.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"blank-line.d.ts","sourceRoot":"","sources":["blank-line.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,wBADW,SAAS,CACiD;+BAR3D,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/blank-line.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/blank-line.js new file mode 100644 index 0000000000000000000000000000000000000000..db9c817fbd48733f7c8e68cd9c3ded56ac4c4443 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/blank-line.js @@ -0,0 +1,62 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding, markdownSpace} from 'micromark-util-character' +import {codes, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const blankLine = {partial: true, tokenize: tokenizeBlankLine} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeBlankLine(effects, ok, nok) { + return start + + /** + * Start of blank line. + * + * > 👉 **Note**: `␠` represents a space character. + * + * ```markdown + * > | ␠␠␊ + * ^ + * > | ␊ + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + return markdownSpace(code) + ? factorySpace(effects, after, types.linePrefix)(code) + : after(code) + } + + /** + * At eof/eol, after optional whitespace. + * + * > 👉 **Note**: `␠` represents a space character. + * + * ```markdown + * > | ␠␠␊ + * ^ + * > | ␊ + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + return code === codes.eof || markdownLineEnding(code) ? ok(code) : nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf91ff18e8eb3339cbeeda55b8e3a1a2875cddfa --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const blockQuote: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=block-quote.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b19ef02032e9d309cd3b3b73a696e968e77f916e --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/block-quote.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"block-quote.d.ts","sourceRoot":"","sources":["block-quote.js"],"names":[],"mappings":"AAeA,wBAAwB;AACxB,yBADW,SAAS,CAMnB;+BAdS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/block-quote.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/block-quote.js new file mode 100644 index 0000000000000000000000000000000000000000..cc4565d42e9ea883976a0ba3fb40054e2aded2b4 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/block-quote.js @@ -0,0 +1,162 @@ +/** + * @import { + * Construct, + * Exiter, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownSpace} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const blockQuote = { + continuation: {tokenize: tokenizeBlockQuoteContinuation}, + exit, + name: 'blockQuote', + tokenize: tokenizeBlockQuoteStart +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeBlockQuoteStart(effects, ok, nok) { + const self = this + + return start + + /** + * Start of block quote. + * + * ```markdown + * > | > a + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if (code === codes.greaterThan) { + const state = self.containerState + + assert(state, 'expected `containerState` to be defined in container') + + if (!state.open) { + effects.enter(types.blockQuote, {_container: true}) + state.open = true + } + + effects.enter(types.blockQuotePrefix) + effects.enter(types.blockQuoteMarker) + effects.consume(code) + effects.exit(types.blockQuoteMarker) + return after + } + + return nok(code) + } + + /** + * After `>`, before optional whitespace. + * + * ```markdown + * > | > a + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + if (markdownSpace(code)) { + effects.enter(types.blockQuotePrefixWhitespace) + effects.consume(code) + effects.exit(types.blockQuotePrefixWhitespace) + effects.exit(types.blockQuotePrefix) + return ok + } + + effects.exit(types.blockQuotePrefix) + return ok(code) + } +} + +/** + * Start of block quote continuation. + * + * ```markdown + * | > a + * > | > b + * ^ + * ``` + * + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeBlockQuoteContinuation(effects, ok, nok) { + const self = this + + return contStart + + /** + * Start of block quote continuation. + * + * Also used to parse the first block quote opening. + * + * ```markdown + * | > a + * > | > b + * ^ + * ``` + * + * @type {State} + */ + function contStart(code) { + if (markdownSpace(code)) { + // Always populated by defaults. + assert( + self.parser.constructs.disable.null, + 'expected `disable.null` to be populated' + ) + + return factorySpace( + effects, + contBefore, + types.linePrefix, + self.parser.constructs.disable.null.includes('codeIndented') + ? undefined + : constants.tabSize + )(code) + } + + return contBefore(code) + } + + /** + * At `>`, after optional whitespace. + * + * Also used to parse the first block quote opening. + * + * ```markdown + * | > a + * > | > b + * ^ + * ``` + * + * @type {State} + */ + function contBefore(code) { + return effects.attempt(blockQuote, ok, nok)(code) + } +} + +/** @type {Exiter} */ +function exit(effects) { + effects.exit(types.blockQuote) +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c61455e85f343e3acf8814d17091943e638f33d5 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const characterEscape: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=character-escape.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e5ec56e148a65da3a2eae240e2502f900ec3e33b --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-escape.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"character-escape.d.ts","sourceRoot":"","sources":["character-escape.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,8BADW,SAAS,CAInB;+BAXS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-escape.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-escape.js new file mode 100644 index 0000000000000000000000000000000000000000..1604cfaa364fcd64f953eff4d0680397702ee1af --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-escape.js @@ -0,0 +1,69 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {asciiPunctuation} from 'micromark-util-character' +import {codes, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const characterEscape = { + name: 'characterEscape', + tokenize: tokenizeCharacterEscape +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCharacterEscape(effects, ok, nok) { + return start + + /** + * Start of character escape. + * + * ```markdown + * > | a\*b + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.backslash, 'expected `\\`') + effects.enter(types.characterEscape) + effects.enter(types.escapeMarker) + effects.consume(code) + effects.exit(types.escapeMarker) + return inside + } + + /** + * After `\`, at punctuation. + * + * ```markdown + * > | a\*b + * ^ + * ``` + * + * @type {State} + */ + function inside(code) { + // ASCII punctuation. + if (asciiPunctuation(code)) { + effects.enter(types.characterEscapeValue) + effects.consume(code) + effects.exit(types.characterEscapeValue) + effects.exit(types.characterEscape) + return ok + } + + return nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..554fe30dbbb2ccee8dfeb83680019154a5f2ac99 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const characterReference: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=character-reference.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..dd03537d5ff767aaa06234517251c6d536c2f057 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-reference.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"character-reference.d.ts","sourceRoot":"","sources":["character-reference.js"],"names":[],"mappings":"AAmBA,wBAAwB;AACxB,iCADW,SAAS,CAInB;+BAhBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-reference.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-reference.js new file mode 100644 index 0000000000000000000000000000000000000000..a7091b0dc8ecd7a84eb295fd9e16586fd27b4ebe --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/character-reference.js @@ -0,0 +1,166 @@ +/** + * @import { + * Code, + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {decodeNamedCharacterReference} from 'decode-named-character-reference' +import { + asciiAlphanumeric, + asciiDigit, + asciiHexDigit +} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const characterReference = { + name: 'characterReference', + tokenize: tokenizeCharacterReference +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCharacterReference(effects, ok, nok) { + const self = this + let size = 0 + /** @type {number} */ + let max + /** @type {(code: Code) => boolean} */ + let test + + return start + + /** + * Start of character reference. + * + * ```markdown + * > | a&b + * ^ + * > | a{b + * ^ + * > | a b + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.ampersand, 'expected `&`') + effects.enter(types.characterReference) + effects.enter(types.characterReferenceMarker) + effects.consume(code) + effects.exit(types.characterReferenceMarker) + return open + } + + /** + * After `&`, at `#` for numeric references or alphanumeric for named + * references. + * + * ```markdown + * > | a&b + * ^ + * > | a{b + * ^ + * > | a b + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (code === codes.numberSign) { + effects.enter(types.characterReferenceMarkerNumeric) + effects.consume(code) + effects.exit(types.characterReferenceMarkerNumeric) + return numeric + } + + effects.enter(types.characterReferenceValue) + max = constants.characterReferenceNamedSizeMax + test = asciiAlphanumeric + return value(code) + } + + /** + * After `#`, at `x` for hexadecimals or digit for decimals. + * + * ```markdown + * > | a{b + * ^ + * > | a b + * ^ + * ``` + * + * @type {State} + */ + function numeric(code) { + if (code === codes.uppercaseX || code === codes.lowercaseX) { + effects.enter(types.characterReferenceMarkerHexadecimal) + effects.consume(code) + effects.exit(types.characterReferenceMarkerHexadecimal) + effects.enter(types.characterReferenceValue) + max = constants.characterReferenceHexadecimalSizeMax + test = asciiHexDigit + return value + } + + effects.enter(types.characterReferenceValue) + max = constants.characterReferenceDecimalSizeMax + test = asciiDigit + return value(code) + } + + /** + * After markers (`&#x`, `&#`, or `&`), in value, before `;`. + * + * The character reference kind defines what and how many characters are + * allowed. + * + * ```markdown + * > | a&b + * ^^^ + * > | a{b + * ^^^ + * > | a b + * ^ + * ``` + * + * @type {State} + */ + function value(code) { + if (code === codes.semicolon && size) { + const token = effects.exit(types.characterReferenceValue) + + if ( + test === asciiAlphanumeric && + !decodeNamedCharacterReference(self.sliceSerialize(token)) + ) { + return nok(code) + } + + // To do: `markdown-rs` uses a different name: + // `CharacterReferenceMarkerSemi`. + effects.enter(types.characterReferenceMarker) + effects.consume(code) + effects.exit(types.characterReferenceMarker) + effects.exit(types.characterReference) + return ok + } + + if (test(code) && size++ < max) { + effects.consume(code) + return value + } + + return nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d5f5320e90c09fc3b7e2a2b3c8748a7434aa64d --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const codeFenced: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=code-fenced.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b0c28b2d96aa42605169d38e45403610eedd7f50 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"code-fenced.d.ts","sourceRoot":"","sources":["code-fenced.js"],"names":[],"mappings":"AAqBA,wBAAwB;AACxB,yBADW,SAAS,CAKnB;+BAnBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js new file mode 100644 index 0000000000000000000000000000000000000000..b3e6f513886dab1d197d1b6c7956852a48ab7ba1 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js @@ -0,0 +1,514 @@ +/** + * @import { + * Code, + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding, markdownSpace} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +const nonLazyContinuation = { + partial: true, + tokenize: tokenizeNonLazyContinuation +} + +/** @type {Construct} */ +export const codeFenced = { + concrete: true, + name: 'codeFenced', + tokenize: tokenizeCodeFenced +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCodeFenced(effects, ok, nok) { + const self = this + /** @type {Construct} */ + const closeStart = {partial: true, tokenize: tokenizeCloseStart} + let initialPrefix = 0 + let sizeOpen = 0 + /** @type {NonNullable} */ + let marker + + return start + + /** + * Start of code. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function start(code) { + // To do: parse whitespace like `markdown-rs`. + return beforeSequenceOpen(code) + } + + /** + * In opening fence, after prefix, at sequence. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function beforeSequenceOpen(code) { + assert( + code === codes.graveAccent || code === codes.tilde, + 'expected `` ` `` or `~`' + ) + + const tail = self.events[self.events.length - 1] + initialPrefix = + tail && tail[1].type === types.linePrefix + ? tail[2].sliceSerialize(tail[1], true).length + : 0 + + marker = code + effects.enter(types.codeFenced) + effects.enter(types.codeFencedFence) + effects.enter(types.codeFencedFenceSequence) + return sequenceOpen(code) + } + + /** + * In opening fence sequence. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function sequenceOpen(code) { + if (code === marker) { + sizeOpen++ + effects.consume(code) + return sequenceOpen + } + + if (sizeOpen < constants.codeFencedSequenceSizeMin) { + return nok(code) + } + + effects.exit(types.codeFencedFenceSequence) + return markdownSpace(code) + ? factorySpace(effects, infoBefore, types.whitespace)(code) + : infoBefore(code) + } + + /** + * In opening fence, after the sequence (and optional whitespace), before info. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function infoBefore(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFencedFence) + return self.interrupt + ? ok(code) + : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code) + } + + effects.enter(types.codeFencedFenceInfo) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return info(code) + } + + /** + * In info. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function info(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.chunkString) + effects.exit(types.codeFencedFenceInfo) + return infoBefore(code) + } + + if (markdownSpace(code)) { + effects.exit(types.chunkString) + effects.exit(types.codeFencedFenceInfo) + return factorySpace(effects, metaBefore, types.whitespace)(code) + } + + if (code === codes.graveAccent && code === marker) { + return nok(code) + } + + effects.consume(code) + return info + } + + /** + * In opening fence, after info and whitespace, before meta. + * + * ```markdown + * > | ~~~js eval + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function metaBefore(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return infoBefore(code) + } + + effects.enter(types.codeFencedFenceMeta) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return meta(code) + } + + /** + * In meta. + * + * ```markdown + * > | ~~~js eval + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function meta(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.chunkString) + effects.exit(types.codeFencedFenceMeta) + return infoBefore(code) + } + + if (code === codes.graveAccent && code === marker) { + return nok(code) + } + + effects.consume(code) + return meta + } + + /** + * At eol/eof in code, before a non-lazy closing fence or content. + * + * ```markdown + * > | ~~~js + * ^ + * > | alert(1) + * ^ + * | ~~~ + * ``` + * + * @type {State} + */ + function atNonLazyBreak(code) { + assert(markdownLineEnding(code), 'expected eol') + return effects.attempt(closeStart, after, contentBefore)(code) + } + + /** + * Before code content, not a closing fence, at eol. + * + * ```markdown + * | ~~~js + * > | alert(1) + * ^ + * | ~~~ + * ``` + * + * @type {State} + */ + function contentBefore(code) { + assert(markdownLineEnding(code), 'expected eol') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return contentStart + } + + /** + * Before code content, not a closing fence. + * + * ```markdown + * | ~~~js + * > | alert(1) + * ^ + * | ~~~ + * ``` + * + * @type {State} + */ + function contentStart(code) { + return initialPrefix > 0 && markdownSpace(code) + ? factorySpace( + effects, + beforeContentChunk, + types.linePrefix, + initialPrefix + 1 + )(code) + : beforeContentChunk(code) + } + + /** + * Before code content, after optional prefix. + * + * ```markdown + * | ~~~js + * > | alert(1) + * ^ + * | ~~~ + * ``` + * + * @type {State} + */ + function beforeContentChunk(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code) + } + + effects.enter(types.codeFlowValue) + return contentChunk(code) + } + + /** + * In code content. + * + * ```markdown + * | ~~~js + * > | alert(1) + * ^^^^^^^^ + * | ~~~ + * ``` + * + * @type {State} + */ + function contentChunk(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFlowValue) + return beforeContentChunk(code) + } + + effects.consume(code) + return contentChunk + } + + /** + * After code. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + effects.exit(types.codeFenced) + return ok(code) + } + + /** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ + function tokenizeCloseStart(effects, ok, nok) { + let size = 0 + + return startBefore + + /** + * + * + * @type {State} + */ + function startBefore(code) { + assert(markdownLineEnding(code), 'expected eol') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return start + } + + /** + * Before closing fence, at optional whitespace. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // Always populated by defaults. + assert( + self.parser.constructs.disable.null, + 'expected `disable.null` to be populated' + ) + + // To do: `enter` here or in next state? + effects.enter(types.codeFencedFence) + return markdownSpace(code) + ? factorySpace( + effects, + beforeSequenceClose, + types.linePrefix, + self.parser.constructs.disable.null.includes('codeIndented') + ? undefined + : constants.tabSize + )(code) + : beforeSequenceClose(code) + } + + /** + * In closing fence, after optional whitespace, at sequence. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function beforeSequenceClose(code) { + if (code === marker) { + effects.enter(types.codeFencedFenceSequence) + return sequenceClose(code) + } + + return nok(code) + } + + /** + * In closing fence sequence. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function sequenceClose(code) { + if (code === marker) { + size++ + effects.consume(code) + return sequenceClose + } + + if (size >= sizeOpen) { + effects.exit(types.codeFencedFenceSequence) + return markdownSpace(code) + ? factorySpace(effects, sequenceCloseAfter, types.whitespace)(code) + : sequenceCloseAfter(code) + } + + return nok(code) + } + + /** + * After closing fence sequence, after optional whitespace. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function sequenceCloseAfter(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFencedFence) + return ok(code) + } + + return nok(code) + } + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeNonLazyContinuation(effects, ok, nok) { + const self = this + + return start + + /** + * + * + * @type {State} + */ + function start(code) { + if (code === codes.eof) { + return nok(code) + } + + assert(markdownLineEnding(code), 'expected eol') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return lineStart + } + + /** + * + * + * @type {State} + */ + function lineStart(code) { + return self.parser.lazy[self.now().line] ? nok(code) : ok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3c06578bab6c0f9f73a7b88e3ee260db52ca5fa4 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const codeIndented: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=code-indented.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..099be93959e1da2e65f4924ed2b38877c736b22a --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-indented.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"code-indented.d.ts","sourceRoot":"","sources":["code-indented.js"],"names":[],"mappings":"AAcA,wBAAwB;AACxB,2BADW,SAAS,CAInB;+BAZS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-indented.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-indented.js new file mode 100644 index 0000000000000000000000000000000000000000..05e27f6ef812b8fe7cb5587238bff0c56665c660 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-indented.js @@ -0,0 +1,202 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding, markdownSpace} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const codeIndented = { + name: 'codeIndented', + tokenize: tokenizeCodeIndented +} + +/** @type {Construct} */ +const furtherStart = {partial: true, tokenize: tokenizeFurtherStart} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCodeIndented(effects, ok, nok) { + const self = this + return start + + /** + * Start of code (indented). + * + * > **Parsing note**: it is not needed to check if this first line is a + * > filled line (that it has a non-whitespace character), because blank lines + * > are parsed already, so we never run into that. + * + * ```markdown + * > | aaa + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // To do: manually check if interrupting like `markdown-rs`. + assert(markdownSpace(code)) + effects.enter(types.codeIndented) + // To do: use an improved `space_or_tab` function like `markdown-rs`, + // so that we can drop the next state. + return factorySpace( + effects, + afterPrefix, + types.linePrefix, + constants.tabSize + 1 + )(code) + } + + /** + * At start, after 1 or 4 spaces. + * + * ```markdown + * > | aaa + * ^ + * ``` + * + * @type {State} + */ + function afterPrefix(code) { + const tail = self.events[self.events.length - 1] + return tail && + tail[1].type === types.linePrefix && + tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize + ? atBreak(code) + : nok(code) + } + + /** + * At a break. + * + * ```markdown + * > | aaa + * ^ ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === codes.eof) { + return after(code) + } + + if (markdownLineEnding(code)) { + return effects.attempt(furtherStart, atBreak, after)(code) + } + + effects.enter(types.codeFlowValue) + return inside(code) + } + + /** + * In code content. + * + * ```markdown + * > | aaa + * ^^^^ + * ``` + * + * @type {State} + */ + function inside(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.codeFlowValue) + return atBreak(code) + } + + effects.consume(code) + return inside + } + + /** @type {State} */ + function after(code) { + effects.exit(types.codeIndented) + // To do: allow interrupting like `markdown-rs`. + // Feel free to interrupt. + // tokenizer.interrupt = false + return ok(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeFurtherStart(effects, ok, nok) { + const self = this + + return furtherStart + + /** + * At eol, trying to parse another indent. + * + * ```markdown + * > | aaa + * ^ + * | bbb + * ``` + * + * @type {State} + */ + function furtherStart(code) { + // To do: improve `lazy` / `pierce` handling. + // If this is a lazy line, it can’t be code. + if (self.parser.lazy[self.now().line]) { + return nok(code) + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return furtherStart + } + + // To do: the code here in `micromark-js` is a bit different from + // `markdown-rs` because there it can attempt spaces. + // We can’t yet. + // + // To do: use an improved `space_or_tab` function like `markdown-rs`, + // so that we can drop the next state. + return factorySpace( + effects, + afterPrefix, + types.linePrefix, + constants.tabSize + 1 + )(code) + } + + /** + * At start, after 1 or 4 spaces. + * + * ```markdown + * > | aaa + * ^ + * ``` + * + * @type {State} + */ + function afterPrefix(code) { + const tail = self.events[self.events.length - 1] + return tail && + tail[1].type === types.linePrefix && + tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize + ? ok(code) + : markdownLineEnding(code) + ? furtherStart(code) + : nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8047b2c2204dcc2fc21094b69a06ba36881fc3fb --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const codeText: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=code-text.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d5558209fb9b70b3beeee714341631158163311a --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-text.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"code-text.d.ts","sourceRoot":"","sources":["code-text.js"],"names":[],"mappings":"AAgBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BAbS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-text.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-text.js new file mode 100644 index 0000000000000000000000000000000000000000..0f4096f7ba7d24f5e6e82cb31b55aaf7df80acd4 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/code-text.js @@ -0,0 +1,257 @@ +/** + * @import { + * Construct, + * Previous, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {markdownLineEnding} from 'micromark-util-character' +import {codes, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const codeText = { + name: 'codeText', + previous, + resolve: resolveCodeText, + tokenize: tokenizeCodeText +} + +// To do: next major: don’t resolve, like `markdown-rs`. +/** @type {Resolver} */ +function resolveCodeText(events) { + let tailExitIndex = events.length - 4 + let headEnterIndex = 3 + /** @type {number} */ + let index + /** @type {number | undefined} */ + let enter + + // If we start and end with an EOL or a space. + if ( + (events[headEnterIndex][1].type === types.lineEnding || + events[headEnterIndex][1].type === 'space') && + (events[tailExitIndex][1].type === types.lineEnding || + events[tailExitIndex][1].type === 'space') + ) { + index = headEnterIndex + + // And we have data. + while (++index < tailExitIndex) { + if (events[index][1].type === types.codeTextData) { + // Then we have padding. + events[headEnterIndex][1].type = types.codeTextPadding + events[tailExitIndex][1].type = types.codeTextPadding + headEnterIndex += 2 + tailExitIndex -= 2 + break + } + } + } + + // Merge adjacent spaces and data. + index = headEnterIndex - 1 + tailExitIndex++ + + while (++index <= tailExitIndex) { + if (enter === undefined) { + if ( + index !== tailExitIndex && + events[index][1].type !== types.lineEnding + ) { + enter = index + } + } else if ( + index === tailExitIndex || + events[index][1].type === types.lineEnding + ) { + events[enter][1].type = types.codeTextData + + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + tailExitIndex -= index - enter - 2 + index = enter + 2 + } + + enter = undefined + } + } + + return events +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Previous} + */ +function previous(code) { + // If there is a previous code, there will always be a tail. + return ( + code !== codes.graveAccent || + this.events[this.events.length - 1][1].type === types.characterEscape + ) +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCodeText(effects, ok, nok) { + const self = this + let sizeOpen = 0 + /** @type {number} */ + let size + /** @type {Token} */ + let token + + return start + + /** + * Start of code (text). + * + * ```markdown + * > | `a` + * ^ + * > | \`a` + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.graveAccent, 'expected `` ` ``') + assert(previous.call(self, self.previous), 'expected correct previous') + effects.enter(types.codeText) + effects.enter(types.codeTextSequence) + return sequenceOpen(code) + } + + /** + * In opening sequence. + * + * ```markdown + * > | `a` + * ^ + * ``` + * + * @type {State} + */ + function sequenceOpen(code) { + if (code === codes.graveAccent) { + effects.consume(code) + sizeOpen++ + return sequenceOpen + } + + effects.exit(types.codeTextSequence) + return between(code) + } + + /** + * Between something and something else. + * + * ```markdown + * > | `a` + * ^^ + * ``` + * + * @type {State} + */ + function between(code) { + // EOF. + if (code === codes.eof) { + return nok(code) + } + + // To do: next major: don’t do spaces in resolve, but when compiling, + // like `markdown-rs`. + // Tabs don’t work, and virtual spaces don’t make sense. + if (code === codes.space) { + effects.enter('space') + effects.consume(code) + effects.exit('space') + return between + } + + // Closing fence? Could also be data. + if (code === codes.graveAccent) { + token = effects.enter(types.codeTextSequence) + size = 0 + return sequenceClose(code) + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return between + } + + // Data. + effects.enter(types.codeTextData) + return data(code) + } + + /** + * In data. + * + * ```markdown + * > | `a` + * ^ + * ``` + * + * @type {State} + */ + function data(code) { + if ( + code === codes.eof || + code === codes.space || + code === codes.graveAccent || + markdownLineEnding(code) + ) { + effects.exit(types.codeTextData) + return between(code) + } + + effects.consume(code) + return data + } + + /** + * In closing sequence. + * + * ```markdown + * > | `a` + * ^ + * ``` + * + * @type {State} + */ + function sequenceClose(code) { + // More. + if (code === codes.graveAccent) { + effects.consume(code) + size++ + return sequenceClose + } + + // Done! + if (size === sizeOpen) { + effects.exit(types.codeTextSequence) + effects.exit(types.codeText) + return ok(code) + } + + // More or less accents: mark as data. + token.type = types.codeTextData + return data(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/content.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/content.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eec537f9fdae61cfeefbff08e8211eed56228381 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/content.d.ts @@ -0,0 +1,7 @@ +/** + * No name because it must not be turned off. + * @type {Construct} + */ +export const content: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=content.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/content.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/content.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..04ed7089749a041b50aa38f1ab4e94589ebed860 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/content.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["content.js"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,sBAFU,SAAS,CAEwD;+BAbjE,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/content.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/content.js new file mode 100644 index 0000000000000000000000000000000000000000..4d0c424558c687291ced50723bb3472742556c90 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/content.js @@ -0,0 +1,185 @@ +/** + * @import { + * Construct, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding} from 'micromark-util-character' +import {subtokenize} from 'micromark-util-subtokenize' +import {codes, constants, types} from 'micromark-util-symbol' + +/** + * No name because it must not be turned off. + * @type {Construct} + */ +export const content = {resolve: resolveContent, tokenize: tokenizeContent} + +/** @type {Construct} */ +const continuationConstruct = {partial: true, tokenize: tokenizeContinuation} + +/** + * Content is transparent: it’s parsed right now. That way, definitions are also + * parsed right now: before text in paragraphs (specifically, media) are parsed. + * + * @type {Resolver} + */ +function resolveContent(events) { + subtokenize(events) + return events +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeContent(effects, ok) { + /** @type {Token | undefined} */ + let previous + + return chunkStart + + /** + * Before a content chunk. + * + * ```markdown + * > | abc + * ^ + * ``` + * + * @type {State} + */ + function chunkStart(code) { + assert( + code !== codes.eof && !markdownLineEnding(code), + 'expected no eof or eol' + ) + + effects.enter(types.content) + previous = effects.enter(types.chunkContent, { + contentType: constants.contentTypeContent + }) + return chunkInside(code) + } + + /** + * In a content chunk. + * + * ```markdown + * > | abc + * ^^^ + * ``` + * + * @type {State} + */ + function chunkInside(code) { + if (code === codes.eof) { + return contentEnd(code) + } + + // To do: in `markdown-rs`, each line is parsed on its own, and everything + // is stitched together resolving. + if (markdownLineEnding(code)) { + return effects.check( + continuationConstruct, + contentContinue, + contentEnd + )(code) + } + + // Data. + effects.consume(code) + return chunkInside + } + + /** + * + * + * @type {State} + */ + function contentEnd(code) { + effects.exit(types.chunkContent) + effects.exit(types.content) + return ok(code) + } + + /** + * + * + * @type {State} + */ + function contentContinue(code) { + assert(markdownLineEnding(code), 'expected eol') + effects.consume(code) + effects.exit(types.chunkContent) + assert(previous, 'expected previous token') + previous.next = effects.enter(types.chunkContent, { + contentType: constants.contentTypeContent, + previous + }) + previous = previous.next + return chunkInside + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeContinuation(effects, ok, nok) { + const self = this + + return startLookahead + + /** + * + * + * @type {State} + */ + function startLookahead(code) { + assert(markdownLineEnding(code), 'expected a line ending') + effects.exit(types.chunkContent) + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace(effects, prefixed, types.linePrefix) + } + + /** + * + * + * @type {State} + */ + function prefixed(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return nok(code) + } + + // Always populated by defaults. + assert( + self.parser.constructs.disable.null, + 'expected `disable.null` to be populated' + ) + + const tail = self.events[self.events.length - 1] + + if ( + !self.parser.constructs.disable.null.includes('codeIndented') && + tail && + tail[1].type === types.linePrefix && + tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize + ) { + return ok(code) + } + + return effects.interrupt(self.parser.constructs.flow, nok, ok)(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f5a46930596f28abf7c913481080928e132a4ae0 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const definition: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=definition.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..46a16d3ad245346b876d819a8c326ce0d6da5d43 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/definition.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["definition.js"],"names":[],"mappings":"AAuBA,wBAAwB;AACxB,yBADW,SAAS,CACwD;+BAlBlE,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/definition.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/definition.js new file mode 100644 index 0000000000000000000000000000000000000000..9df859cf6345997ddbf1631ab02facb650aa33d3 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/definition.js @@ -0,0 +1,295 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factoryDestination} from 'micromark-factory-destination' +import {factoryLabel} from 'micromark-factory-label' +import {factorySpace} from 'micromark-factory-space' +import {factoryTitle} from 'micromark-factory-title' +import {factoryWhitespace} from 'micromark-factory-whitespace' +import { + markdownLineEndingOrSpace, + markdownLineEnding, + markdownSpace +} from 'micromark-util-character' +import {normalizeIdentifier} from 'micromark-util-normalize-identifier' +import {codes, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const definition = {name: 'definition', tokenize: tokenizeDefinition} + +/** @type {Construct} */ +const titleBefore = {partial: true, tokenize: tokenizeTitleBefore} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeDefinition(effects, ok, nok) { + const self = this + /** @type {string} */ + let identifier + + return start + + /** + * At start of a definition. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // Do not interrupt paragraphs (but do follow definitions). + // To do: do `interrupt` the way `markdown-rs` does. + // To do: parse whitespace the way `markdown-rs` does. + effects.enter(types.definition) + return before(code) + } + + /** + * After optional whitespace, at `[`. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + // To do: parse whitespace the way `markdown-rs` does. + assert(code === codes.leftSquareBracket, 'expected `[`') + return factoryLabel.call( + self, + effects, + labelAfter, + // Note: we don’t need to reset the way `markdown-rs` does. + nok, + types.definitionLabel, + types.definitionLabelMarker, + types.definitionLabelString + )(code) + } + + /** + * After label. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function labelAfter(code) { + identifier = normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + + if (code === codes.colon) { + effects.enter(types.definitionMarker) + effects.consume(code) + effects.exit(types.definitionMarker) + return markerAfter + } + + return nok(code) + } + + /** + * After marker. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function markerAfter(code) { + // Note: whitespace is optional. + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, destinationBefore)(code) + : destinationBefore(code) + } + + /** + * Before destination. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function destinationBefore(code) { + return factoryDestination( + effects, + destinationAfter, + // Note: we don’t need to reset the way `markdown-rs` does. + nok, + types.definitionDestination, + types.definitionDestinationLiteral, + types.definitionDestinationLiteralMarker, + types.definitionDestinationRaw, + types.definitionDestinationString + )(code) + } + + /** + * After destination. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function destinationAfter(code) { + return effects.attempt(titleBefore, after, after)(code) + } + + /** + * After definition. + * + * ```markdown + * > | [a]: b + * ^ + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + return markdownSpace(code) + ? factorySpace(effects, afterWhitespace, types.whitespace)(code) + : afterWhitespace(code) + } + + /** + * After definition, after optional whitespace. + * + * ```markdown + * > | [a]: b + * ^ + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function afterWhitespace(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.definition) + + // Note: we don’t care about uniqueness. + // It’s likely that that doesn’t happen very frequently. + // It is more likely that it wastes precious time. + self.parser.defined.push(identifier) + + // To do: `markdown-rs` interrupt. + // // You’d be interrupting. + // tokenizer.interrupt = true + return ok(code) + } + + return nok(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeTitleBefore(effects, ok, nok) { + return titleBefore + + /** + * After destination, at whitespace. + * + * ```markdown + * > | [a]: b + * ^ + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function titleBefore(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, beforeMarker)(code) + : nok(code) + } + + /** + * At title. + * + * ```markdown + * | [a]: b + * > | "c" + * ^ + * ``` + * + * @type {State} + */ + function beforeMarker(code) { + return factoryTitle( + effects, + titleAfter, + nok, + types.definitionTitle, + types.definitionTitleMarker, + types.definitionTitleString + )(code) + } + + /** + * After title. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function titleAfter(code) { + return markdownSpace(code) + ? factorySpace( + effects, + titleAfterOptionalWhitespace, + types.whitespace + )(code) + : titleAfterOptionalWhitespace(code) + } + + /** + * After title, after optional whitespace. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function titleAfterOptionalWhitespace(code) { + return code === codes.eof || markdownLineEnding(code) ? ok(code) : nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eff01b324e2a82400b61eaecc7c842f6f8765865 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const hardBreakEscape: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=hard-break-escape.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..923753ce13d86326b96e42e9de1a5674fbad0deb --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hard-break-escape.d.ts","sourceRoot":"","sources":["hard-break-escape.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,8BADW,SAAS,CAInB;+BAXS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js new file mode 100644 index 0000000000000000000000000000000000000000..ac7df7d79141514367f4b124db8f3076cebcd43d --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/hard-break-escape.js @@ -0,0 +1,65 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {markdownLineEnding} from 'micromark-util-character' +import {codes, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const hardBreakEscape = { + name: 'hardBreakEscape', + tokenize: tokenizeHardBreakEscape +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeHardBreakEscape(effects, ok, nok) { + return start + + /** + * Start of a hard break (escape). + * + * ```markdown + * > | a\ + * ^ + * | b + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.backslash, 'expected `\\`') + effects.enter(types.hardBreakEscape) + effects.consume(code) + return after + } + + /** + * After `\`, at eol. + * + * ```markdown + * > | a\ + * ^ + * | b + * ``` + * + * @type {State} + */ + function after(code) { + if (markdownLineEnding(code)) { + effects.exit(types.hardBreakEscape) + return ok(code) + } + + return nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a08353b6c5f1798ffd4e7ea29705a9b07d5ca9db --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const headingAtx: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=heading-atx.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8c8eebf31f2cfe32ca43e83fba9fc5d24bf786ea --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/heading-atx.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"heading-atx.d.ts","sourceRoot":"","sources":["heading-atx.js"],"names":[],"mappings":"AAqBA,wBAAwB;AACxB,yBADW,SAAS,CAKnB;+BAlBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js new file mode 100644 index 0000000000000000000000000000000000000000..744e302f9811781f732af20ba2aa40790f2a0a0b --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js @@ -0,0 +1,233 @@ +/** + * @import { + * Construct, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import { + markdownLineEndingOrSpace, + markdownLineEnding, + markdownSpace +} from 'micromark-util-character' +import {splice} from 'micromark-util-chunked' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const headingAtx = { + name: 'headingAtx', + resolve: resolveHeadingAtx, + tokenize: tokenizeHeadingAtx +} + +/** @type {Resolver} */ +function resolveHeadingAtx(events, context) { + let contentEnd = events.length - 2 + let contentStart = 3 + /** @type {Token} */ + let content + /** @type {Token} */ + let text + + // Prefix whitespace, part of the opening. + if (events[contentStart][1].type === types.whitespace) { + contentStart += 2 + } + + // Suffix whitespace, part of the closing. + if ( + contentEnd - 2 > contentStart && + events[contentEnd][1].type === types.whitespace + ) { + contentEnd -= 2 + } + + if ( + events[contentEnd][1].type === types.atxHeadingSequence && + (contentStart === contentEnd - 1 || + (contentEnd - 4 > contentStart && + events[contentEnd - 2][1].type === types.whitespace)) + ) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4 + } + + if (contentEnd > contentStart) { + content = { + type: types.atxHeadingText, + start: events[contentStart][1].start, + end: events[contentEnd][1].end + } + text = { + type: types.chunkText, + start: events[contentStart][1].start, + end: events[contentEnd][1].end, + contentType: constants.contentTypeText + } + + splice(events, contentStart, contentEnd - contentStart + 1, [ + ['enter', content, context], + ['enter', text, context], + ['exit', text, context], + ['exit', content, context] + ]) + } + + return events +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeHeadingAtx(effects, ok, nok) { + let size = 0 + + return start + + /** + * Start of a heading (atx). + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // To do: parse indent like `markdown-rs`. + effects.enter(types.atxHeading) + return before(code) + } + + /** + * After optional whitespace, at `#`. + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + assert(code === codes.numberSign, 'expected `#`') + effects.enter(types.atxHeadingSequence) + return sequenceOpen(code) + } + + /** + * In opening sequence. + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function sequenceOpen(code) { + if ( + code === codes.numberSign && + size++ < constants.atxHeadingOpeningFenceSizeMax + ) { + effects.consume(code) + return sequenceOpen + } + + // Always at least one `#`. + if (code === codes.eof || markdownLineEndingOrSpace(code)) { + effects.exit(types.atxHeadingSequence) + return atBreak(code) + } + + return nok(code) + } + + /** + * After something, before something else. + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === codes.numberSign) { + effects.enter(types.atxHeadingSequence) + return sequenceFurther(code) + } + + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.atxHeading) + // To do: interrupt like `markdown-rs`. + // // Feel free to interrupt. + // tokenizer.interrupt = false + return ok(code) + } + + if (markdownSpace(code)) { + return factorySpace(effects, atBreak, types.whitespace)(code) + } + + // To do: generate `data` tokens, add the `text` token later. + // Needs edit map, see: `markdown.rs`. + effects.enter(types.atxHeadingText) + return data(code) + } + + /** + * In further sequence (after whitespace). + * + * Could be normal “visible” hashes in the heading or a final sequence. + * + * ```markdown + * > | ## aa ## + * ^ + * ``` + * + * @type {State} + */ + function sequenceFurther(code) { + if (code === codes.numberSign) { + effects.consume(code) + return sequenceFurther + } + + effects.exit(types.atxHeadingSequence) + return atBreak(code) + } + + /** + * In text. + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function data(code) { + if ( + code === codes.eof || + code === codes.numberSign || + markdownLineEndingOrSpace(code) + ) { + effects.exit(types.atxHeadingText) + return atBreak(code) + } + + effects.consume(code) + return data + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..83fa70cd1b092c05d7d32527bc43aef4b7c4baa3 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const htmlFlow: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=html-flow.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1a23a6fde0f60733d2f8ab684f91172a97f1a661 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"html-flow.d.ts","sourceRoot":"","sources":["html-flow.js"],"names":[],"mappings":"AAuBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BArBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-flow.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-flow.js new file mode 100644 index 0000000000000000000000000000000000000000..254d9e32105c35541659fdafcb80e372f4b6c331 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-flow.js @@ -0,0 +1,989 @@ +/** + * @import { + * Code, + * Construct, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import { + asciiAlphanumeric, + asciiAlpha, + markdownLineEndingOrSpace, + markdownLineEnding, + markdownSpace +} from 'micromark-util-character' +import {htmlBlockNames, htmlRawNames} from 'micromark-util-html-tag-name' +import {codes, constants, types} from 'micromark-util-symbol' +import {blankLine} from './blank-line.js' + +/** @type {Construct} */ +export const htmlFlow = { + concrete: true, + name: 'htmlFlow', + resolveTo: resolveToHtmlFlow, + tokenize: tokenizeHtmlFlow +} + +/** @type {Construct} */ +const blankLineBefore = {partial: true, tokenize: tokenizeBlankLineBefore} +const nonLazyContinuationStart = { + partial: true, + tokenize: tokenizeNonLazyContinuationStart +} + +/** @type {Resolver} */ +function resolveToHtmlFlow(events) { + let index = events.length + + while (index--) { + if ( + events[index][0] === 'enter' && + events[index][1].type === types.htmlFlow + ) { + break + } + } + + if (index > 1 && events[index - 2][1].type === types.linePrefix) { + // Add the prefix start to the HTML token. + events[index][1].start = events[index - 2][1].start + // Add the prefix start to the HTML line token. + events[index + 1][1].start = events[index - 2][1].start + // Remove the line prefix. + events.splice(index - 2, 2) + } + + return events +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeHtmlFlow(effects, ok, nok) { + const self = this + /** @type {number} */ + let marker + /** @type {boolean} */ + let closingTag + /** @type {string} */ + let buffer + /** @type {number} */ + let index + /** @type {Code} */ + let markerB + + return start + + /** + * Start of HTML (flow). + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // To do: parse indent like `markdown-rs`. + return before(code) + } + + /** + * At `<`, after optional whitespace. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + assert(code === codes.lessThan, 'expected `<`') + effects.enter(types.htmlFlow) + effects.enter(types.htmlFlowData) + effects.consume(code) + return open + } + + /** + * After `<`, at tag name or other stuff. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (code === codes.exclamationMark) { + effects.consume(code) + return declarationOpen + } + + if (code === codes.slash) { + effects.consume(code) + closingTag = true + return tagCloseStart + } + + if (code === codes.questionMark) { + effects.consume(code) + marker = constants.htmlInstruction + // To do: + // tokenizer.concrete = true + // To do: use `markdown-rs` style interrupt. + // While we’re in an instruction instead of a declaration, we’re on a `?` + // right now, so we do need to search for `>`, similar to declarations. + return self.interrupt ? ok : continuationDeclarationInside + } + + // ASCII alphabetical. + if (asciiAlpha(code)) { + assert(code !== null) // Always the case. + effects.consume(code) + buffer = String.fromCharCode(code) + return tagName + } + + return nok(code) + } + + /** + * After ` | + * ^ + * > | + * ^ + * > | &<]]> + * ^ + * ``` + * + * @type {State} + */ + function declarationOpen(code) { + if (code === codes.dash) { + effects.consume(code) + marker = constants.htmlComment + return commentOpenInside + } + + if (code === codes.leftSquareBracket) { + effects.consume(code) + marker = constants.htmlCdata + index = 0 + return cdataOpenInside + } + + // ASCII alphabetical. + if (asciiAlpha(code)) { + effects.consume(code) + marker = constants.htmlDeclaration + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + /** + * After ` | + * ^ + * ``` + * + * @type {State} + */ + function commentOpenInside(code) { + if (code === codes.dash) { + effects.consume(code) + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok : continuationDeclarationInside + } + + return nok(code) + } + + /** + * After ` | &<]]> + * ^^^^^^ + * ``` + * + * @type {State} + */ + function cdataOpenInside(code) { + const value = constants.cdataOpeningString + + if (code === value.charCodeAt(index++)) { + effects.consume(code) + + if (index === value.length) { + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok : continuation + } + + return cdataOpenInside + } + + return nok(code) + } + + /** + * After ` | + * ^ + * ``` + * + * @type {State} + */ + function tagCloseStart(code) { + if (asciiAlpha(code)) { + assert(code !== null) // Always the case. + effects.consume(code) + buffer = String.fromCharCode(code) + return tagName + } + + return nok(code) + } + + /** + * In tag name. + * + * ```markdown + * > | + * ^^ + * > | + * ^^ + * ``` + * + * @type {State} + */ + function tagName(code) { + if ( + code === codes.eof || + code === codes.slash || + code === codes.greaterThan || + markdownLineEndingOrSpace(code) + ) { + const slash = code === codes.slash + const name = buffer.toLowerCase() + + if (!slash && !closingTag && htmlRawNames.includes(name)) { + marker = constants.htmlRaw + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok(code) : continuation(code) + } + + if (htmlBlockNames.includes(buffer.toLowerCase())) { + marker = constants.htmlBasic + + if (slash) { + effects.consume(code) + return basicSelfClosing + } + + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok(code) : continuation(code) + } + + marker = constants.htmlComplete + // Do not support complete HTML when interrupting. + return self.interrupt && !self.parser.lazy[self.now().line] + ? nok(code) + : closingTag + ? completeClosingTagAfter(code) + : completeAttributeNameBefore(code) + } + + // ASCII alphanumerical and `-`. + if (code === codes.dash || asciiAlphanumeric(code)) { + effects.consume(code) + buffer += String.fromCharCode(code) + return tagName + } + + return nok(code) + } + + /** + * After closing slash of a basic tag name. + * + * ```markdown + * > |

    + * ^ + * ``` + * + * @type {State} + */ + function basicSelfClosing(code) { + if (code === codes.greaterThan) { + effects.consume(code) + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok : continuation + } + + return nok(code) + } + + /** + * After closing slash of a complete tag name. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeClosingTagAfter(code) { + if (markdownSpace(code)) { + effects.consume(code) + return completeClosingTagAfter + } + + return completeEnd(code) + } + + /** + * At an attribute name. + * + * At first, this state is used after a complete tag name, after whitespace, + * where it expects optional attributes or the end of the tag. + * It is also reused after attributes, when expecting more optional + * attributes. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * > | + * ^ + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeNameBefore(code) { + if (code === codes.slash) { + effects.consume(code) + return completeEnd + } + + // ASCII alphanumerical and `:` and `_`. + if (code === codes.colon || code === codes.underscore || asciiAlpha(code)) { + effects.consume(code) + return completeAttributeName + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameBefore + } + + return completeEnd(code) + } + + /** + * In attribute name. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeName(code) { + // ASCII alphanumerical and `-`, `.`, `:`, and `_`. + if ( + code === codes.dash || + code === codes.dot || + code === codes.colon || + code === codes.underscore || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return completeAttributeName + } + + return completeAttributeNameAfter(code) + } + + /** + * After attribute name, at an optional initializer, the end of the tag, or + * whitespace. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeNameAfter(code) { + if (code === codes.equalsTo) { + effects.consume(code) + return completeAttributeValueBefore + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeNameAfter + } + + return completeAttributeNameBefore(code) + } + + /** + * Before unquoted, double quoted, or single quoted attribute value, allowing + * whitespace. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeValueBefore(code) { + if ( + code === codes.eof || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.greaterThan || + code === codes.graveAccent + ) { + return nok(code) + } + + if (code === codes.quotationMark || code === codes.apostrophe) { + effects.consume(code) + markerB = code + return completeAttributeValueQuoted + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAttributeValueBefore + } + + return completeAttributeValueUnquoted(code) + } + + /** + * In double or single quoted attribute value. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeValueQuoted(code) { + if (code === markerB) { + effects.consume(code) + markerB = null + return completeAttributeValueQuotedAfter + } + + if (code === codes.eof || markdownLineEnding(code)) { + return nok(code) + } + + effects.consume(code) + return completeAttributeValueQuoted + } + + /** + * In unquoted attribute value. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeValueUnquoted(code) { + if ( + code === codes.eof || + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.slash || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.greaterThan || + code === codes.graveAccent || + markdownLineEndingOrSpace(code) + ) { + return completeAttributeNameAfter(code) + } + + effects.consume(code) + return completeAttributeValueUnquoted + } + + /** + * After double or single quoted attribute value, before whitespace or the + * end of the tag. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeValueQuotedAfter(code) { + if ( + code === codes.slash || + code === codes.greaterThan || + markdownSpace(code) + ) { + return completeAttributeNameBefore(code) + } + + return nok(code) + } + + /** + * In certain circumstances of a complete tag where only an `>` is allowed. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeEnd(code) { + if (code === codes.greaterThan) { + effects.consume(code) + return completeAfter + } + + return nok(code) + } + + /** + * After `>` in a complete tag. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAfter(code) { + if (code === codes.eof || markdownLineEnding(code)) { + // // Do not form containers. + // tokenizer.concrete = true + return continuation(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return completeAfter + } + + return nok(code) + } + + /** + * In continuation of any HTML kind. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuation(code) { + if (code === codes.dash && marker === constants.htmlComment) { + effects.consume(code) + return continuationCommentInside + } + + if (code === codes.lessThan && marker === constants.htmlRaw) { + effects.consume(code) + return continuationRawTagOpen + } + + if (code === codes.greaterThan && marker === constants.htmlDeclaration) { + effects.consume(code) + return continuationClose + } + + if (code === codes.questionMark && marker === constants.htmlInstruction) { + effects.consume(code) + return continuationDeclarationInside + } + + if (code === codes.rightSquareBracket && marker === constants.htmlCdata) { + effects.consume(code) + return continuationCdataInside + } + + if ( + markdownLineEnding(code) && + (marker === constants.htmlBasic || marker === constants.htmlComplete) + ) { + effects.exit(types.htmlFlowData) + return effects.check( + blankLineBefore, + continuationAfter, + continuationStart + )(code) + } + + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.htmlFlowData) + return continuationStart(code) + } + + effects.consume(code) + return continuation + } + + /** + * In continuation, at eol. + * + * ```markdown + * > | + * ^ + * | asd + * ``` + * + * @type {State} + */ + function continuationStart(code) { + return effects.check( + nonLazyContinuationStart, + continuationStartNonLazy, + continuationAfter + )(code) + } + + /** + * In continuation, at eol, before non-lazy content. + * + * ```markdown + * > | + * ^ + * | asd + * ``` + * + * @type {State} + */ + function continuationStartNonLazy(code) { + assert(markdownLineEnding(code)) + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return continuationBefore + } + + /** + * In continuation, before non-lazy content. + * + * ```markdown + * | + * > | asd + * ^ + * ``` + * + * @type {State} + */ + function continuationBefore(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return continuationStart(code) + } + + effects.enter(types.htmlFlowData) + return continuation(code) + } + + /** + * In comment continuation, after one `-`, expecting another. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuationCommentInside(code) { + if (code === codes.dash) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + /** + * In raw continuation, after `<`, at `/`. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuationRawTagOpen(code) { + if (code === codes.slash) { + effects.consume(code) + buffer = '' + return continuationRawEndTag + } + + return continuation(code) + } + + /** + * In raw continuation, after ` | + * ^^^^^^ + * ``` + * + * @type {State} + */ + function continuationRawEndTag(code) { + if (code === codes.greaterThan) { + const name = buffer.toLowerCase() + + if (htmlRawNames.includes(name)) { + effects.consume(code) + return continuationClose + } + + return continuation(code) + } + + if (asciiAlpha(code) && buffer.length < constants.htmlRawSizeMax) { + assert(code !== null) // Always the case. + effects.consume(code) + buffer += String.fromCharCode(code) + return continuationRawEndTag + } + + return continuation(code) + } + + /** + * In cdata continuation, after `]`, expecting `]>`. + * + * ```markdown + * > | &<]]> + * ^ + * ``` + * + * @type {State} + */ + function continuationCdataInside(code) { + if (code === codes.rightSquareBracket) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + /** + * In declaration or instruction continuation, at `>`. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * > | + * ^ + * > | + * ^ + * > | &<]]> + * ^ + * ``` + * + * @type {State} + */ + function continuationDeclarationInside(code) { + if (code === codes.greaterThan) { + effects.consume(code) + return continuationClose + } + + // More dashes. + if (code === codes.dash && marker === constants.htmlComment) { + effects.consume(code) + return continuationDeclarationInside + } + + return continuation(code) + } + + /** + * In closed continuation: everything we get until the eol/eof is part of it. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuationClose(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.htmlFlowData) + return continuationAfter(code) + } + + effects.consume(code) + return continuationClose + } + + /** + * Done. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuationAfter(code) { + effects.exit(types.htmlFlow) + // // Feel free to interrupt. + // tokenizer.interrupt = false + // // No longer concrete. + // tokenizer.concrete = false + return ok(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeNonLazyContinuationStart(effects, ok, nok) { + const self = this + + return start + + /** + * At eol, before continuation. + * + * ```markdown + * > | * ```js + * ^ + * | b + * ``` + * + * @type {State} + */ + function start(code) { + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return after + } + + return nok(code) + } + + /** + * A continuation. + * + * ```markdown + * | * ```js + * > | b + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + return self.parser.lazy[self.now().line] ? nok(code) : ok(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeBlankLineBefore(effects, ok, nok) { + return start + + /** + * Before eol, expecting blank line. + * + * ```markdown + * > |
    + * ^ + * | + * ``` + * + * @type {State} + */ + function start(code) { + assert(markdownLineEnding(code), 'expected a line ending') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return effects.attempt(blankLine, ok, nok) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fccb41bd58dfbdcffca207751c2ff6cf0615f046 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const htmlText: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=html-text.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..98d48a041e45bf766be76dafd07a44fd786229a9 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-text.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"html-text.d.ts","sourceRoot":"","sources":["html-text.js"],"names":[],"mappings":"AAqBA,wBAAwB;AACxB,uBADW,SAAS,CACkD;+BAf5D,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-text.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-text.js new file mode 100644 index 0000000000000000000000000000000000000000..386199fd79f026cae0c05ea860be519a47dc6960 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/html-text.js @@ -0,0 +1,783 @@ +/** + * @import { + * Code, + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import { + asciiAlphanumeric, + asciiAlpha, + markdownLineEndingOrSpace, + markdownLineEnding, + markdownSpace +} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const htmlText = {name: 'htmlText', tokenize: tokenizeHtmlText} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeHtmlText(effects, ok, nok) { + const self = this + /** @type {NonNullable | undefined} */ + let marker + /** @type {number} */ + let index + /** @type {State} */ + let returnState + + return start + + /** + * Start of HTML (text). + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.lessThan, 'expected `<`') + effects.enter(types.htmlText) + effects.enter(types.htmlTextData) + effects.consume(code) + return open + } + + /** + * After `<`, at tag name or other stuff. + * + * ```markdown + * > | a c + * ^ + * > | a c + * ^ + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (code === codes.exclamationMark) { + effects.consume(code) + return declarationOpen + } + + if (code === codes.slash) { + effects.consume(code) + return tagCloseStart + } + + if (code === codes.questionMark) { + effects.consume(code) + return instruction + } + + // ASCII alphabetical. + if (asciiAlpha(code)) { + effects.consume(code) + return tagOpen + } + + return nok(code) + } + + /** + * After ` | a c + * ^ + * > | a c + * ^ + * > | a &<]]> c + * ^ + * ``` + * + * @type {State} + */ + function declarationOpen(code) { + if (code === codes.dash) { + effects.consume(code) + return commentOpenInside + } + + if (code === codes.leftSquareBracket) { + effects.consume(code) + index = 0 + return cdataOpenInside + } + + if (asciiAlpha(code)) { + effects.consume(code) + return declaration + } + + return nok(code) + } + + /** + * In a comment, after ` | a c + * ^ + * ``` + * + * @type {State} + */ + function commentOpenInside(code) { + if (code === codes.dash) { + effects.consume(code) + return commentEnd + } + + return nok(code) + } + + /** + * In comment. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function comment(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.dash) { + effects.consume(code) + return commentClose + } + + if (markdownLineEnding(code)) { + returnState = comment + return lineEndingBefore(code) + } + + effects.consume(code) + return comment + } + + /** + * In comment, after `-`. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function commentClose(code) { + if (code === codes.dash) { + effects.consume(code) + return commentEnd + } + + return comment(code) + } + + /** + * In comment, after `--`. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function commentEnd(code) { + return code === codes.greaterThan + ? end(code) + : code === codes.dash + ? commentClose(code) + : comment(code) + } + + /** + * After ` | a &<]]> b + * ^^^^^^ + * ``` + * + * @type {State} + */ + function cdataOpenInside(code) { + const value = constants.cdataOpeningString + + if (code === value.charCodeAt(index++)) { + effects.consume(code) + return index === value.length ? cdata : cdataOpenInside + } + + return nok(code) + } + + /** + * In CDATA. + * + * ```markdown + * > | a &<]]> b + * ^^^ + * ``` + * + * @type {State} + */ + function cdata(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.rightSquareBracket) { + effects.consume(code) + return cdataClose + } + + if (markdownLineEnding(code)) { + returnState = cdata + return lineEndingBefore(code) + } + + effects.consume(code) + return cdata + } + + /** + * In CDATA, after `]`, at another `]`. + * + * ```markdown + * > | a &<]]> b + * ^ + * ``` + * + * @type {State} + */ + function cdataClose(code) { + if (code === codes.rightSquareBracket) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + /** + * In CDATA, after `]]`, at `>`. + * + * ```markdown + * > | a &<]]> b + * ^ + * ``` + * + * @type {State} + */ + function cdataEnd(code) { + if (code === codes.greaterThan) { + return end(code) + } + + if (code === codes.rightSquareBracket) { + effects.consume(code) + return cdataEnd + } + + return cdata(code) + } + + /** + * In declaration. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function declaration(code) { + if (code === codes.eof || code === codes.greaterThan) { + return end(code) + } + + if (markdownLineEnding(code)) { + returnState = declaration + return lineEndingBefore(code) + } + + effects.consume(code) + return declaration + } + + /** + * In instruction. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function instruction(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.questionMark) { + effects.consume(code) + return instructionClose + } + + if (markdownLineEnding(code)) { + returnState = instruction + return lineEndingBefore(code) + } + + effects.consume(code) + return instruction + } + + /** + * In instruction, after `?`, at `>`. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function instructionClose(code) { + return code === codes.greaterThan ? end(code) : instruction(code) + } + + /** + * After ` | a c + * ^ + * ``` + * + * @type {State} + */ + function tagCloseStart(code) { + // ASCII alphabetical. + if (asciiAlpha(code)) { + effects.consume(code) + return tagClose + } + + return nok(code) + } + + /** + * After ` | a c + * ^ + * ``` + * + * @type {State} + */ + function tagClose(code) { + // ASCII alphanumerical and `-`. + if (code === codes.dash || asciiAlphanumeric(code)) { + effects.consume(code) + return tagClose + } + + return tagCloseBetween(code) + } + + /** + * In closing tag, after tag name. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function tagCloseBetween(code) { + if (markdownLineEnding(code)) { + returnState = tagCloseBetween + return lineEndingBefore(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagCloseBetween + } + + return end(code) + } + + /** + * After ` | a c + * ^ + * ``` + * + * @type {State} + */ + function tagOpen(code) { + // ASCII alphanumerical and `-`. + if (code === codes.dash || asciiAlphanumeric(code)) { + effects.consume(code) + return tagOpen + } + + if ( + code === codes.slash || + code === codes.greaterThan || + markdownLineEndingOrSpace(code) + ) { + return tagOpenBetween(code) + } + + return nok(code) + } + + /** + * In opening tag, after tag name. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function tagOpenBetween(code) { + if (code === codes.slash) { + effects.consume(code) + return end + } + + // ASCII alphabetical and `:` and `_`. + if (code === codes.colon || code === codes.underscore || asciiAlpha(code)) { + effects.consume(code) + return tagOpenAttributeName + } + + if (markdownLineEnding(code)) { + returnState = tagOpenBetween + return lineEndingBefore(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenBetween + } + + return end(code) + } + + /** + * In attribute name. + * + * ```markdown + * > | a d + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeName(code) { + // ASCII alphabetical and `-`, `.`, `:`, and `_`. + if ( + code === codes.dash || + code === codes.dot || + code === codes.colon || + code === codes.underscore || + asciiAlphanumeric(code) + ) { + effects.consume(code) + return tagOpenAttributeName + } + + return tagOpenAttributeNameAfter(code) + } + + /** + * After attribute name, before initializer, the end of the tag, or + * whitespace. + * + * ```markdown + * > | a d + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeNameAfter(code) { + if (code === codes.equalsTo) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeNameAfter + return lineEndingBefore(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeNameAfter + } + + return tagOpenBetween(code) + } + + /** + * Before unquoted, double quoted, or single quoted attribute value, allowing + * whitespace. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeValueBefore(code) { + if ( + code === codes.eof || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.greaterThan || + code === codes.graveAccent + ) { + return nok(code) + } + + if (code === codes.quotationMark || code === codes.apostrophe) { + effects.consume(code) + marker = code + return tagOpenAttributeValueQuoted + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueBefore + return lineEndingBefore(code) + } + + if (markdownSpace(code)) { + effects.consume(code) + return tagOpenAttributeValueBefore + } + + effects.consume(code) + return tagOpenAttributeValueUnquoted + } + + /** + * In double or single quoted attribute value. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code) + marker = undefined + return tagOpenAttributeValueQuotedAfter + } + + if (code === codes.eof) { + return nok(code) + } + + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueQuoted + return lineEndingBefore(code) + } + + effects.consume(code) + return tagOpenAttributeValueQuoted + } + + /** + * In unquoted attribute value. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeValueUnquoted(code) { + if ( + code === codes.eof || + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.lessThan || + code === codes.equalsTo || + code === codes.graveAccent + ) { + return nok(code) + } + + if ( + code === codes.slash || + code === codes.greaterThan || + markdownLineEndingOrSpace(code) + ) { + return tagOpenBetween(code) + } + + effects.consume(code) + return tagOpenAttributeValueUnquoted + } + + /** + * After double or single quoted attribute value, before whitespace or the end + * of the tag. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeValueQuotedAfter(code) { + if ( + code === codes.slash || + code === codes.greaterThan || + markdownLineEndingOrSpace(code) + ) { + return tagOpenBetween(code) + } + + return nok(code) + } + + /** + * In certain circumstances of a tag where only an `>` is allowed. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function end(code) { + if (code === codes.greaterThan) { + effects.consume(code) + effects.exit(types.htmlTextData) + effects.exit(types.htmlText) + return ok + } + + return nok(code) + } + + /** + * At eol. + * + * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about + * > empty tokens. + * + * ```markdown + * > | a + * ``` + * + * @type {State} + */ + function lineEndingBefore(code) { + assert(returnState, 'expected return state') + assert(markdownLineEnding(code), 'expected eol') + effects.exit(types.htmlTextData) + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return lineEndingAfter + } + + /** + * After eol, at optional whitespace. + * + * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about + * > empty tokens. + * + * ```markdown + * | a + * ^ + * ``` + * + * @type {State} + */ + function lineEndingAfter(code) { + // Always populated by defaults. + assert( + self.parser.constructs.disable.null, + 'expected `disable.null` to be populated' + ) + return markdownSpace(code) + ? factorySpace( + effects, + lineEndingAfterPrefix, + types.linePrefix, + self.parser.constructs.disable.null.includes('codeIndented') + ? undefined + : constants.tabSize + )(code) + : lineEndingAfterPrefix(code) + } + + /** + * After eol, after optional whitespace. + * + * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about + * > empty tokens. + * + * ```markdown + * | a + * ^ + * ``` + * + * @type {State} + */ + function lineEndingAfterPrefix(code) { + effects.enter(types.htmlTextData) + return returnState(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c892edb7db82843a0b29f462379a327aa2fe47f6 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const labelEnd: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=label-end.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3d6348f618669da6df07fc2b5b150ac69601ef81 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-end.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"label-end.d.ts","sourceRoot":"","sources":["label-end.js"],"names":[],"mappings":"AAuBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BApBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-end.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-end.js new file mode 100644 index 0000000000000000000000000000000000000000..492756f04eb7e5f0b77d0c4283692ef7457e6d7c --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-end.js @@ -0,0 +1,656 @@ +/** + * @import { + * Construct, + * Event, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factoryDestination} from 'micromark-factory-destination' +import {factoryLabel} from 'micromark-factory-label' +import {factoryTitle} from 'micromark-factory-title' +import {factoryWhitespace} from 'micromark-factory-whitespace' +import {markdownLineEndingOrSpace} from 'micromark-util-character' +import {push, splice} from 'micromark-util-chunked' +import {normalizeIdentifier} from 'micromark-util-normalize-identifier' +import {resolveAll} from 'micromark-util-resolve-all' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const labelEnd = { + name: 'labelEnd', + resolveAll: resolveAllLabelEnd, + resolveTo: resolveToLabelEnd, + tokenize: tokenizeLabelEnd +} + +/** @type {Construct} */ +const resourceConstruct = {tokenize: tokenizeResource} +/** @type {Construct} */ +const referenceFullConstruct = {tokenize: tokenizeReferenceFull} +/** @type {Construct} */ +const referenceCollapsedConstruct = {tokenize: tokenizeReferenceCollapsed} + +/** @type {Resolver} */ +function resolveAllLabelEnd(events) { + let index = -1 + /** @type {Array} */ + const newEvents = [] + while (++index < events.length) { + const token = events[index][1] + newEvents.push(events[index]) + + if ( + token.type === types.labelImage || + token.type === types.labelLink || + token.type === types.labelEnd + ) { + // Remove the marker. + const offset = token.type === types.labelImage ? 4 : 2 + token.type = types.data + index += offset + } + } + + // If the events are equal, we don't have to copy newEvents to events + if (events.length !== newEvents.length) { + splice(events, 0, events.length, newEvents) + } + + return events +} + +/** @type {Resolver} */ +function resolveToLabelEnd(events, context) { + let index = events.length + let offset = 0 + /** @type {Token} */ + let token + /** @type {number | undefined} */ + let open + /** @type {number | undefined} */ + let close + /** @type {Array} */ + let media + + // Find an opening. + while (index--) { + token = events[index][1] + + if (open) { + // If we see another link, or inactive link label, we’ve been here before. + if ( + token.type === types.link || + (token.type === types.labelLink && token._inactive) + ) { + break + } + + // Mark other link openings as inactive, as we can’t have links in + // links. + if (events[index][0] === 'enter' && token.type === types.labelLink) { + token._inactive = true + } + } else if (close) { + if ( + events[index][0] === 'enter' && + (token.type === types.labelImage || token.type === types.labelLink) && + !token._balanced + ) { + open = index + + if (token.type !== types.labelLink) { + offset = 2 + break + } + } + } else if (token.type === types.labelEnd) { + close = index + } + } + + assert(open !== undefined, '`open` is supposed to be found') + assert(close !== undefined, '`close` is supposed to be found') + + const group = { + type: events[open][1].type === types.labelLink ? types.link : types.image, + start: {...events[open][1].start}, + end: {...events[events.length - 1][1].end} + } + + const label = { + type: types.label, + start: {...events[open][1].start}, + end: {...events[close][1].end} + } + + const text = { + type: types.labelText, + start: {...events[open + offset + 2][1].end}, + end: {...events[close - 2][1].start} + } + + media = [ + ['enter', group, context], + ['enter', label, context] + ] + + // Opening marker. + media = push(media, events.slice(open + 1, open + offset + 3)) + + // Text open. + media = push(media, [['enter', text, context]]) + + // Always populated by defaults. + assert( + context.parser.constructs.insideSpan.null, + 'expected `insideSpan.null` to be populated' + ) + // Between. + media = push( + media, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + offset + 4, close - 3), + context + ) + ) + + // Text close, marker close, label close. + media = push(media, [ + ['exit', text, context], + events[close - 2], + events[close - 1], + ['exit', label, context] + ]) + + // Reference, resource, or so. + media = push(media, events.slice(close + 1)) + + // Media close. + media = push(media, [['exit', group, context]]) + + splice(events, open, events.length, media) + + return events +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeLabelEnd(effects, ok, nok) { + const self = this + let index = self.events.length + /** @type {Token} */ + let labelStart + /** @type {boolean} */ + let defined + + // Find an opening. + while (index--) { + if ( + (self.events[index][1].type === types.labelImage || + self.events[index][1].type === types.labelLink) && + !self.events[index][1]._balanced + ) { + labelStart = self.events[index][1] + break + } + } + + return start + + /** + * Start of label end. + * + * ```markdown + * > | [a](b) c + * ^ + * > | [a][b] c + * ^ + * > | [a][] b + * ^ + * > | [a] b + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.rightSquareBracket, 'expected `]`') + + // If there is not an okay opening. + if (!labelStart) { + return nok(code) + } + + // If the corresponding label (link) start is marked as inactive, + // it means we’d be wrapping a link, like this: + // + // ```markdown + // > | a [b [c](d) e](f) g. + // ^ + // ``` + // + // We can’t have that, so it’s just balanced brackets. + if (labelStart._inactive) { + return labelEndNok(code) + } + + defined = self.parser.defined.includes( + normalizeIdentifier( + self.sliceSerialize({start: labelStart.end, end: self.now()}) + ) + ) + effects.enter(types.labelEnd) + effects.enter(types.labelMarker) + effects.consume(code) + effects.exit(types.labelMarker) + effects.exit(types.labelEnd) + return after + } + + /** + * After `]`. + * + * ```markdown + * > | [a](b) c + * ^ + * > | [a][b] c + * ^ + * > | [a][] b + * ^ + * > | [a] b + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + // Note: `markdown-rs` also parses GFM footnotes here, which for us is in + // an extension. + + // Resource (`[asd](fgh)`)? + if (code === codes.leftParenthesis) { + return effects.attempt( + resourceConstruct, + labelEndOk, + defined ? labelEndOk : labelEndNok + )(code) + } + + // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference? + if (code === codes.leftSquareBracket) { + return effects.attempt( + referenceFullConstruct, + labelEndOk, + defined ? referenceNotFull : labelEndNok + )(code) + } + + // Shortcut (`[asd]`) reference? + return defined ? labelEndOk(code) : labelEndNok(code) + } + + /** + * After `]`, at `[`, but not at a full reference. + * + * > 👉 **Note**: we only get here if the label is defined. + * + * ```markdown + * > | [a][] b + * ^ + * > | [a] b + * ^ + * ``` + * + * @type {State} + */ + function referenceNotFull(code) { + return effects.attempt( + referenceCollapsedConstruct, + labelEndOk, + labelEndNok + )(code) + } + + /** + * Done, we found something. + * + * ```markdown + * > | [a](b) c + * ^ + * > | [a][b] c + * ^ + * > | [a][] b + * ^ + * > | [a] b + * ^ + * ``` + * + * @type {State} + */ + function labelEndOk(code) { + // Note: `markdown-rs` does a bunch of stuff here. + return ok(code) + } + + /** + * Done, it’s nothing. + * + * There was an okay opening, but we didn’t match anything. + * + * ```markdown + * > | [a](b c + * ^ + * > | [a][b c + * ^ + * > | [a] b + * ^ + * ``` + * + * @type {State} + */ + function labelEndNok(code) { + labelStart._balanced = true + return nok(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeResource(effects, ok, nok) { + return resourceStart + + /** + * At a resource. + * + * ```markdown + * > | [a](b) c + * ^ + * ``` + * + * @type {State} + */ + function resourceStart(code) { + assert(code === codes.leftParenthesis, 'expected left paren') + effects.enter(types.resource) + effects.enter(types.resourceMarker) + effects.consume(code) + effects.exit(types.resourceMarker) + return resourceBefore + } + + /** + * In resource, after `(`, at optional whitespace. + * + * ```markdown + * > | [a](b) c + * ^ + * ``` + * + * @type {State} + */ + function resourceBefore(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, resourceOpen)(code) + : resourceOpen(code) + } + + /** + * In resource, after optional whitespace, at `)` or a destination. + * + * ```markdown + * > | [a](b) c + * ^ + * ``` + * + * @type {State} + */ + function resourceOpen(code) { + if (code === codes.rightParenthesis) { + return resourceEnd(code) + } + + return factoryDestination( + effects, + resourceDestinationAfter, + resourceDestinationMissing, + types.resourceDestination, + types.resourceDestinationLiteral, + types.resourceDestinationLiteralMarker, + types.resourceDestinationRaw, + types.resourceDestinationString, + constants.linkResourceDestinationBalanceMax + )(code) + } + + /** + * In resource, after destination, at optional whitespace. + * + * ```markdown + * > | [a](b) c + * ^ + * ``` + * + * @type {State} + */ + function resourceDestinationAfter(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, resourceBetween)(code) + : resourceEnd(code) + } + + /** + * At invalid destination. + * + * ```markdown + * > | [a](<<) b + * ^ + * ``` + * + * @type {State} + */ + function resourceDestinationMissing(code) { + return nok(code) + } + + /** + * In resource, after destination and whitespace, at `(` or title. + * + * ```markdown + * > | [a](b ) c + * ^ + * ``` + * + * @type {State} + */ + function resourceBetween(code) { + if ( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis + ) { + return factoryTitle( + effects, + resourceTitleAfter, + nok, + types.resourceTitle, + types.resourceTitleMarker, + types.resourceTitleString + )(code) + } + + return resourceEnd(code) + } + + /** + * In resource, after title, at optional whitespace. + * + * ```markdown + * > | [a](b "c") d + * ^ + * ``` + * + * @type {State} + */ + function resourceTitleAfter(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, resourceEnd)(code) + : resourceEnd(code) + } + + /** + * In resource, at `)`. + * + * ```markdown + * > | [a](b) d + * ^ + * ``` + * + * @type {State} + */ + function resourceEnd(code) { + if (code === codes.rightParenthesis) { + effects.enter(types.resourceMarker) + effects.consume(code) + effects.exit(types.resourceMarker) + effects.exit(types.resource) + return ok + } + + return nok(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeReferenceFull(effects, ok, nok) { + const self = this + + return referenceFull + + /** + * In a reference (full), at the `[`. + * + * ```markdown + * > | [a][b] d + * ^ + * ``` + * + * @type {State} + */ + function referenceFull(code) { + assert(code === codes.leftSquareBracket, 'expected left bracket') + return factoryLabel.call( + self, + effects, + referenceFullAfter, + referenceFullMissing, + types.reference, + types.referenceMarker, + types.referenceString + )(code) + } + + /** + * In a reference (full), after `]`. + * + * ```markdown + * > | [a][b] d + * ^ + * ``` + * + * @type {State} + */ + function referenceFullAfter(code) { + return self.parser.defined.includes( + normalizeIdentifier( + self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1) + ) + ) + ? ok(code) + : nok(code) + } + + /** + * In reference (full) that was missing. + * + * ```markdown + * > | [a][b d + * ^ + * ``` + * + * @type {State} + */ + function referenceFullMissing(code) { + return nok(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeReferenceCollapsed(effects, ok, nok) { + return referenceCollapsedStart + + /** + * In reference (collapsed), at `[`. + * + * > 👉 **Note**: we only get here if the label is defined. + * + * ```markdown + * > | [a][] d + * ^ + * ``` + * + * @type {State} + */ + function referenceCollapsedStart(code) { + // We only attempt a collapsed label if there’s a `[`. + assert(code === codes.leftSquareBracket, 'expected left bracket') + effects.enter(types.reference) + effects.enter(types.referenceMarker) + effects.consume(code) + effects.exit(types.referenceMarker) + return referenceCollapsedOpen + } + + /** + * In reference (collapsed), at `]`. + * + * > 👉 **Note**: we only get here if the label is defined. + * + * ```markdown + * > | [a][] d + * ^ + * ``` + * + * @type {State} + */ + function referenceCollapsedOpen(code) { + if (code === codes.rightSquareBracket) { + effects.enter(types.referenceMarker) + effects.consume(code) + effects.exit(types.referenceMarker) + effects.exit(types.reference) + return ok + } + + return nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a3c6903b673bf64e9072788ce5715586afba77d --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const labelStartImage: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=label-start-image.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e41dbf7453b2769fdcc28edbb1febafd946a2e2b --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"label-start-image.d.ts","sourceRoot":"","sources":["label-start-image.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAZS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js new file mode 100644 index 0000000000000000000000000000000000000000..4448cc9df858c62d9aeb06170dd1a1523323eeae --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js @@ -0,0 +1,110 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {codes, types} from 'micromark-util-symbol' +import {labelEnd} from './label-end.js' + +/** @type {Construct} */ +export const labelStartImage = { + name: 'labelStartImage', + resolveAll: labelEnd.resolveAll, + tokenize: tokenizeLabelStartImage +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeLabelStartImage(effects, ok, nok) { + const self = this + + return start + + /** + * Start of label (image) start. + * + * ```markdown + * > | a ![b] c + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.exclamationMark, 'expected `!`') + effects.enter(types.labelImage) + effects.enter(types.labelImageMarker) + effects.consume(code) + effects.exit(types.labelImageMarker) + return open + } + + /** + * After `!`, at `[`. + * + * ```markdown + * > | a ![b] c + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (code === codes.leftSquareBracket) { + effects.enter(types.labelMarker) + effects.consume(code) + effects.exit(types.labelMarker) + effects.exit(types.labelImage) + return after + } + + return nok(code) + } + + /** + * After `![`. + * + * ```markdown + * > | a ![b] c + * ^ + * ``` + * + * This is needed in because, when GFM footnotes are enabled, images never + * form when started with a `^`. + * Instead, links form: + * + * ```markdown + * ![^a](b) + * + * ![^a][b] + * + * [b]: c + * ``` + * + * ```html + *
    + * ^ + * ``` + * + * @type {State} + */ + function basicSelfClosing(code) { + if (code === 62) { + effects.consume(code); + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok : continuation; + } + return nok(code); + } + + /** + * After closing slash of a complete tag name. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeClosingTagAfter(code) { + if (markdownSpace(code)) { + effects.consume(code); + return completeClosingTagAfter; + } + return completeEnd(code); + } + + /** + * At an attribute name. + * + * At first, this state is used after a complete tag name, after whitespace, + * where it expects optional attributes or the end of the tag. + * It is also reused after attributes, when expecting more optional + * attributes. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * > | + * ^ + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeNameBefore(code) { + if (code === 47) { + effects.consume(code); + return completeEnd; + } + + // ASCII alphanumerical and `:` and `_`. + if (code === 58 || code === 95 || asciiAlpha(code)) { + effects.consume(code); + return completeAttributeName; + } + if (markdownSpace(code)) { + effects.consume(code); + return completeAttributeNameBefore; + } + return completeEnd(code); + } + + /** + * In attribute name. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeName(code) { + // ASCII alphanumerical and `-`, `.`, `:`, and `_`. + if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { + effects.consume(code); + return completeAttributeName; + } + return completeAttributeNameAfter(code); + } + + /** + * After attribute name, at an optional initializer, the end of the tag, or + * whitespace. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeNameAfter(code) { + if (code === 61) { + effects.consume(code); + return completeAttributeValueBefore; + } + if (markdownSpace(code)) { + effects.consume(code); + return completeAttributeNameAfter; + } + return completeAttributeNameBefore(code); + } + + /** + * Before unquoted, double quoted, or single quoted attribute value, allowing + * whitespace. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeValueBefore(code) { + if (code === null || code === 60 || code === 61 || code === 62 || code === 96) { + return nok(code); + } + if (code === 34 || code === 39) { + effects.consume(code); + markerB = code; + return completeAttributeValueQuoted; + } + if (markdownSpace(code)) { + effects.consume(code); + return completeAttributeValueBefore; + } + return completeAttributeValueUnquoted(code); + } + + /** + * In double or single quoted attribute value. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeValueQuoted(code) { + if (code === markerB) { + effects.consume(code); + markerB = null; + return completeAttributeValueQuotedAfter; + } + if (code === null || markdownLineEnding(code)) { + return nok(code); + } + effects.consume(code); + return completeAttributeValueQuoted; + } + + /** + * In unquoted attribute value. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeValueUnquoted(code) { + if (code === null || code === 34 || code === 39 || code === 47 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code)) { + return completeAttributeNameAfter(code); + } + effects.consume(code); + return completeAttributeValueUnquoted; + } + + /** + * After double or single quoted attribute value, before whitespace or the + * end of the tag. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAttributeValueQuotedAfter(code) { + if (code === 47 || code === 62 || markdownSpace(code)) { + return completeAttributeNameBefore(code); + } + return nok(code); + } + + /** + * In certain circumstances of a complete tag where only an `>` is allowed. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeEnd(code) { + if (code === 62) { + effects.consume(code); + return completeAfter; + } + return nok(code); + } + + /** + * After `>` in a complete tag. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function completeAfter(code) { + if (code === null || markdownLineEnding(code)) { + // // Do not form containers. + // tokenizer.concrete = true + return continuation(code); + } + if (markdownSpace(code)) { + effects.consume(code); + return completeAfter; + } + return nok(code); + } + + /** + * In continuation of any HTML kind. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuation(code) { + if (code === 45 && marker === 2) { + effects.consume(code); + return continuationCommentInside; + } + if (code === 60 && marker === 1) { + effects.consume(code); + return continuationRawTagOpen; + } + if (code === 62 && marker === 4) { + effects.consume(code); + return continuationClose; + } + if (code === 63 && marker === 3) { + effects.consume(code); + return continuationDeclarationInside; + } + if (code === 93 && marker === 5) { + effects.consume(code); + return continuationCdataInside; + } + if (markdownLineEnding(code) && (marker === 6 || marker === 7)) { + effects.exit("htmlFlowData"); + return effects.check(blankLineBefore, continuationAfter, continuationStart)(code); + } + if (code === null || markdownLineEnding(code)) { + effects.exit("htmlFlowData"); + return continuationStart(code); + } + effects.consume(code); + return continuation; + } + + /** + * In continuation, at eol. + * + * ```markdown + * > | + * ^ + * | asd + * ``` + * + * @type {State} + */ + function continuationStart(code) { + return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code); + } + + /** + * In continuation, at eol, before non-lazy content. + * + * ```markdown + * > | + * ^ + * | asd + * ``` + * + * @type {State} + */ + function continuationStartNonLazy(code) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return continuationBefore; + } + + /** + * In continuation, before non-lazy content. + * + * ```markdown + * | + * > | asd + * ^ + * ``` + * + * @type {State} + */ + function continuationBefore(code) { + if (code === null || markdownLineEnding(code)) { + return continuationStart(code); + } + effects.enter("htmlFlowData"); + return continuation(code); + } + + /** + * In comment continuation, after one `-`, expecting another. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuationCommentInside(code) { + if (code === 45) { + effects.consume(code); + return continuationDeclarationInside; + } + return continuation(code); + } + + /** + * In raw continuation, after `<`, at `/`. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuationRawTagOpen(code) { + if (code === 47) { + effects.consume(code); + buffer = ''; + return continuationRawEndTag; + } + return continuation(code); + } + + /** + * In raw continuation, after ` | + * ^^^^^^ + * ``` + * + * @type {State} + */ + function continuationRawEndTag(code) { + if (code === 62) { + const name = buffer.toLowerCase(); + if (htmlRawNames.includes(name)) { + effects.consume(code); + return continuationClose; + } + return continuation(code); + } + if (asciiAlpha(code) && buffer.length < 8) { + // Always the case. + effects.consume(code); + buffer += String.fromCharCode(code); + return continuationRawEndTag; + } + return continuation(code); + } + + /** + * In cdata continuation, after `]`, expecting `]>`. + * + * ```markdown + * > | &<]]> + * ^ + * ``` + * + * @type {State} + */ + function continuationCdataInside(code) { + if (code === 93) { + effects.consume(code); + return continuationDeclarationInside; + } + return continuation(code); + } + + /** + * In declaration or instruction continuation, at `>`. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * > | + * ^ + * > | + * ^ + * > | &<]]> + * ^ + * ``` + * + * @type {State} + */ + function continuationDeclarationInside(code) { + if (code === 62) { + effects.consume(code); + return continuationClose; + } + + // More dashes. + if (code === 45 && marker === 2) { + effects.consume(code); + return continuationDeclarationInside; + } + return continuation(code); + } + + /** + * In closed continuation: everything we get until the eol/eof is part of it. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuationClose(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("htmlFlowData"); + return continuationAfter(code); + } + effects.consume(code); + return continuationClose; + } + + /** + * Done. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function continuationAfter(code) { + effects.exit("htmlFlow"); + // // Feel free to interrupt. + // tokenizer.interrupt = false + // // No longer concrete. + // tokenizer.concrete = false + return ok(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeNonLazyContinuationStart(effects, ok, nok) { + const self = this; + return start; + + /** + * At eol, before continuation. + * + * ```markdown + * > | * ```js + * ^ + * | b + * ``` + * + * @type {State} + */ + function start(code) { + if (markdownLineEnding(code)) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return after; + } + return nok(code); + } + + /** + * A continuation. + * + * ```markdown + * | * ```js + * > | b + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + return self.parser.lazy[self.now().line] ? nok(code) : ok(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeBlankLineBefore(effects, ok, nok) { + return start; + + /** + * Before eol, expecting blank line. + * + * ```markdown + * > |
    + * ^ + * | + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return effects.attempt(blankLine, ok, nok); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/html-text.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/html-text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fccb41bd58dfbdcffca207751c2ff6cf0615f046 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/html-text.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const htmlText: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=html-text.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/html-text.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/html-text.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..98d48a041e45bf766be76dafd07a44fd786229a9 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/html-text.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"html-text.d.ts","sourceRoot":"","sources":["html-text.js"],"names":[],"mappings":"AAqBA,wBAAwB;AACxB,uBADW,SAAS,CACkD;+BAf5D,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/html-text.js b/tools/ui/node_modules/micromark-core-commonmark/lib/html-text.js new file mode 100644 index 0000000000000000000000000000000000000000..a455bb09227fc88e0e72932bdd1a3daa00885910 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/html-text.js @@ -0,0 +1,678 @@ +/** + * @import { + * Code, + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** @type {Construct} */ +export const htmlText = { + name: 'htmlText', + tokenize: tokenizeHtmlText +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeHtmlText(effects, ok, nok) { + const self = this; + /** @type {NonNullable | undefined} */ + let marker; + /** @type {number} */ + let index; + /** @type {State} */ + let returnState; + return start; + + /** + * Start of HTML (text). + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("htmlText"); + effects.enter("htmlTextData"); + effects.consume(code); + return open; + } + + /** + * After `<`, at tag name or other stuff. + * + * ```markdown + * > | a c + * ^ + * > | a c + * ^ + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (code === 33) { + effects.consume(code); + return declarationOpen; + } + if (code === 47) { + effects.consume(code); + return tagCloseStart; + } + if (code === 63) { + effects.consume(code); + return instruction; + } + + // ASCII alphabetical. + if (asciiAlpha(code)) { + effects.consume(code); + return tagOpen; + } + return nok(code); + } + + /** + * After ` | a c + * ^ + * > | a c + * ^ + * > | a &<]]> c + * ^ + * ``` + * + * @type {State} + */ + function declarationOpen(code) { + if (code === 45) { + effects.consume(code); + return commentOpenInside; + } + if (code === 91) { + effects.consume(code); + index = 0; + return cdataOpenInside; + } + if (asciiAlpha(code)) { + effects.consume(code); + return declaration; + } + return nok(code); + } + + /** + * In a comment, after ` | a c + * ^ + * ``` + * + * @type {State} + */ + function commentOpenInside(code) { + if (code === 45) { + effects.consume(code); + return commentEnd; + } + return nok(code); + } + + /** + * In comment. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function comment(code) { + if (code === null) { + return nok(code); + } + if (code === 45) { + effects.consume(code); + return commentClose; + } + if (markdownLineEnding(code)) { + returnState = comment; + return lineEndingBefore(code); + } + effects.consume(code); + return comment; + } + + /** + * In comment, after `-`. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function commentClose(code) { + if (code === 45) { + effects.consume(code); + return commentEnd; + } + return comment(code); + } + + /** + * In comment, after `--`. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function commentEnd(code) { + return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code); + } + + /** + * After ` | a &<]]> b + * ^^^^^^ + * ``` + * + * @type {State} + */ + function cdataOpenInside(code) { + const value = "CDATA["; + if (code === value.charCodeAt(index++)) { + effects.consume(code); + return index === value.length ? cdata : cdataOpenInside; + } + return nok(code); + } + + /** + * In CDATA. + * + * ```markdown + * > | a &<]]> b + * ^^^ + * ``` + * + * @type {State} + */ + function cdata(code) { + if (code === null) { + return nok(code); + } + if (code === 93) { + effects.consume(code); + return cdataClose; + } + if (markdownLineEnding(code)) { + returnState = cdata; + return lineEndingBefore(code); + } + effects.consume(code); + return cdata; + } + + /** + * In CDATA, after `]`, at another `]`. + * + * ```markdown + * > | a &<]]> b + * ^ + * ``` + * + * @type {State} + */ + function cdataClose(code) { + if (code === 93) { + effects.consume(code); + return cdataEnd; + } + return cdata(code); + } + + /** + * In CDATA, after `]]`, at `>`. + * + * ```markdown + * > | a &<]]> b + * ^ + * ``` + * + * @type {State} + */ + function cdataEnd(code) { + if (code === 62) { + return end(code); + } + if (code === 93) { + effects.consume(code); + return cdataEnd; + } + return cdata(code); + } + + /** + * In declaration. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function declaration(code) { + if (code === null || code === 62) { + return end(code); + } + if (markdownLineEnding(code)) { + returnState = declaration; + return lineEndingBefore(code); + } + effects.consume(code); + return declaration; + } + + /** + * In instruction. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function instruction(code) { + if (code === null) { + return nok(code); + } + if (code === 63) { + effects.consume(code); + return instructionClose; + } + if (markdownLineEnding(code)) { + returnState = instruction; + return lineEndingBefore(code); + } + effects.consume(code); + return instruction; + } + + /** + * In instruction, after `?`, at `>`. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function instructionClose(code) { + return code === 62 ? end(code) : instruction(code); + } + + /** + * After ` | a c + * ^ + * ``` + * + * @type {State} + */ + function tagCloseStart(code) { + // ASCII alphabetical. + if (asciiAlpha(code)) { + effects.consume(code); + return tagClose; + } + return nok(code); + } + + /** + * After ` | a c + * ^ + * ``` + * + * @type {State} + */ + function tagClose(code) { + // ASCII alphanumerical and `-`. + if (code === 45 || asciiAlphanumeric(code)) { + effects.consume(code); + return tagClose; + } + return tagCloseBetween(code); + } + + /** + * In closing tag, after tag name. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function tagCloseBetween(code) { + if (markdownLineEnding(code)) { + returnState = tagCloseBetween; + return lineEndingBefore(code); + } + if (markdownSpace(code)) { + effects.consume(code); + return tagCloseBetween; + } + return end(code); + } + + /** + * After ` | a c + * ^ + * ``` + * + * @type {State} + */ + function tagOpen(code) { + // ASCII alphanumerical and `-`. + if (code === 45 || asciiAlphanumeric(code)) { + effects.consume(code); + return tagOpen; + } + if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code); + } + return nok(code); + } + + /** + * In opening tag, after tag name. + * + * ```markdown + * > | a c + * ^ + * ``` + * + * @type {State} + */ + function tagOpenBetween(code) { + if (code === 47) { + effects.consume(code); + return end; + } + + // ASCII alphabetical and `:` and `_`. + if (code === 58 || code === 95 || asciiAlpha(code)) { + effects.consume(code); + return tagOpenAttributeName; + } + if (markdownLineEnding(code)) { + returnState = tagOpenBetween; + return lineEndingBefore(code); + } + if (markdownSpace(code)) { + effects.consume(code); + return tagOpenBetween; + } + return end(code); + } + + /** + * In attribute name. + * + * ```markdown + * > | a d + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeName(code) { + // ASCII alphabetical and `-`, `.`, `:`, and `_`. + if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { + effects.consume(code); + return tagOpenAttributeName; + } + return tagOpenAttributeNameAfter(code); + } + + /** + * After attribute name, before initializer, the end of the tag, or + * whitespace. + * + * ```markdown + * > | a d + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeNameAfter(code) { + if (code === 61) { + effects.consume(code); + return tagOpenAttributeValueBefore; + } + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeNameAfter; + return lineEndingBefore(code); + } + if (markdownSpace(code)) { + effects.consume(code); + return tagOpenAttributeNameAfter; + } + return tagOpenBetween(code); + } + + /** + * Before unquoted, double quoted, or single quoted attribute value, allowing + * whitespace. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeValueBefore(code) { + if (code === null || code === 60 || code === 61 || code === 62 || code === 96) { + return nok(code); + } + if (code === 34 || code === 39) { + effects.consume(code); + marker = code; + return tagOpenAttributeValueQuoted; + } + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueBefore; + return lineEndingBefore(code); + } + if (markdownSpace(code)) { + effects.consume(code); + return tagOpenAttributeValueBefore; + } + effects.consume(code); + return tagOpenAttributeValueUnquoted; + } + + /** + * In double or single quoted attribute value. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeValueQuoted(code) { + if (code === marker) { + effects.consume(code); + marker = undefined; + return tagOpenAttributeValueQuotedAfter; + } + if (code === null) { + return nok(code); + } + if (markdownLineEnding(code)) { + returnState = tagOpenAttributeValueQuoted; + return lineEndingBefore(code); + } + effects.consume(code); + return tagOpenAttributeValueQuoted; + } + + /** + * In unquoted attribute value. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeValueUnquoted(code) { + if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) { + return nok(code); + } + if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code); + } + effects.consume(code); + return tagOpenAttributeValueUnquoted; + } + + /** + * After double or single quoted attribute value, before whitespace or the end + * of the tag. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function tagOpenAttributeValueQuotedAfter(code) { + if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { + return tagOpenBetween(code); + } + return nok(code); + } + + /** + * In certain circumstances of a tag where only an `>` is allowed. + * + * ```markdown + * > | a e + * ^ + * ``` + * + * @type {State} + */ + function end(code) { + if (code === 62) { + effects.consume(code); + effects.exit("htmlTextData"); + effects.exit("htmlText"); + return ok; + } + return nok(code); + } + + /** + * At eol. + * + * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about + * > empty tokens. + * + * ```markdown + * > | a + * ``` + * + * @type {State} + */ + function lineEndingBefore(code) { + effects.exit("htmlTextData"); + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return lineEndingAfter; + } + + /** + * After eol, at optional whitespace. + * + * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about + * > empty tokens. + * + * ```markdown + * | a + * ^ + * ``` + * + * @type {State} + */ + function lineEndingAfter(code) { + // Always populated by defaults. + + return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code); + } + + /** + * After eol, after optional whitespace. + * + * > 👉 **Note**: we can’t have blank lines in text, so no need to worry about + * > empty tokens. + * + * ```markdown + * | a + * ^ + * ``` + * + * @type {State} + */ + function lineEndingAfterPrefix(code) { + effects.enter("htmlTextData"); + return returnState(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/label-end.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/label-end.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c892edb7db82843a0b29f462379a327aa2fe47f6 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/label-end.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const labelEnd: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=label-end.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/label-end.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/label-end.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..3d6348f618669da6df07fc2b5b150ac69601ef81 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/label-end.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"label-end.d.ts","sourceRoot":"","sources":["label-end.js"],"names":[],"mappings":"AAuBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BApBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/label-end.js b/tools/ui/node_modules/micromark-core-commonmark/lib/label-end.js new file mode 100644 index 0000000000000000000000000000000000000000..927808f648bac3803c8149d3b24c97e6def7e103 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/label-end.js @@ -0,0 +1,560 @@ +/** + * @import { + * Construct, + * Event, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import { factoryDestination } from 'micromark-factory-destination'; +import { factoryLabel } from 'micromark-factory-label'; +import { factoryTitle } from 'micromark-factory-title'; +import { factoryWhitespace } from 'micromark-factory-whitespace'; +import { markdownLineEndingOrSpace } from 'micromark-util-character'; +import { push, splice } from 'micromark-util-chunked'; +import { normalizeIdentifier } from 'micromark-util-normalize-identifier'; +import { resolveAll } from 'micromark-util-resolve-all'; +/** @type {Construct} */ +export const labelEnd = { + name: 'labelEnd', + resolveAll: resolveAllLabelEnd, + resolveTo: resolveToLabelEnd, + tokenize: tokenizeLabelEnd +}; + +/** @type {Construct} */ +const resourceConstruct = { + tokenize: tokenizeResource +}; +/** @type {Construct} */ +const referenceFullConstruct = { + tokenize: tokenizeReferenceFull +}; +/** @type {Construct} */ +const referenceCollapsedConstruct = { + tokenize: tokenizeReferenceCollapsed +}; + +/** @type {Resolver} */ +function resolveAllLabelEnd(events) { + let index = -1; + /** @type {Array} */ + const newEvents = []; + while (++index < events.length) { + const token = events[index][1]; + newEvents.push(events[index]); + if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") { + // Remove the marker. + const offset = token.type === "labelImage" ? 4 : 2; + token.type = "data"; + index += offset; + } + } + + // If the events are equal, we don't have to copy newEvents to events + if (events.length !== newEvents.length) { + splice(events, 0, events.length, newEvents); + } + return events; +} + +/** @type {Resolver} */ +function resolveToLabelEnd(events, context) { + let index = events.length; + let offset = 0; + /** @type {Token} */ + let token; + /** @type {number | undefined} */ + let open; + /** @type {number | undefined} */ + let close; + /** @type {Array} */ + let media; + + // Find an opening. + while (index--) { + token = events[index][1]; + if (open) { + // If we see another link, or inactive link label, we’ve been here before. + if (token.type === "link" || token.type === "labelLink" && token._inactive) { + break; + } + + // Mark other link openings as inactive, as we can’t have links in + // links. + if (events[index][0] === 'enter' && token.type === "labelLink") { + token._inactive = true; + } + } else if (close) { + if (events[index][0] === 'enter' && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) { + open = index; + if (token.type !== "labelLink") { + offset = 2; + break; + } + } + } else if (token.type === "labelEnd") { + close = index; + } + } + const group = { + type: events[open][1].type === "labelLink" ? "link" : "image", + start: { + ...events[open][1].start + }, + end: { + ...events[events.length - 1][1].end + } + }; + const label = { + type: "label", + start: { + ...events[open][1].start + }, + end: { + ...events[close][1].end + } + }; + const text = { + type: "labelText", + start: { + ...events[open + offset + 2][1].end + }, + end: { + ...events[close - 2][1].start + } + }; + media = [['enter', group, context], ['enter', label, context]]; + + // Opening marker. + media = push(media, events.slice(open + 1, open + offset + 3)); + + // Text open. + media = push(media, [['enter', text, context]]); + + // Always populated by defaults. + + // Between. + media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context)); + + // Text close, marker close, label close. + media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]); + + // Reference, resource, or so. + media = push(media, events.slice(close + 1)); + + // Media close. + media = push(media, [['exit', group, context]]); + splice(events, open, events.length, media); + return events; +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeLabelEnd(effects, ok, nok) { + const self = this; + let index = self.events.length; + /** @type {Token} */ + let labelStart; + /** @type {boolean} */ + let defined; + + // Find an opening. + while (index--) { + if ((self.events[index][1].type === "labelImage" || self.events[index][1].type === "labelLink") && !self.events[index][1]._balanced) { + labelStart = self.events[index][1]; + break; + } + } + return start; + + /** + * Start of label end. + * + * ```markdown + * > | [a](b) c + * ^ + * > | [a][b] c + * ^ + * > | [a][] b + * ^ + * > | [a] b + * ``` + * + * @type {State} + */ + function start(code) { + // If there is not an okay opening. + if (!labelStart) { + return nok(code); + } + + // If the corresponding label (link) start is marked as inactive, + // it means we’d be wrapping a link, like this: + // + // ```markdown + // > | a [b [c](d) e](f) g. + // ^ + // ``` + // + // We can’t have that, so it’s just balanced brackets. + if (labelStart._inactive) { + return labelEndNok(code); + } + defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({ + start: labelStart.end, + end: self.now() + }))); + effects.enter("labelEnd"); + effects.enter("labelMarker"); + effects.consume(code); + effects.exit("labelMarker"); + effects.exit("labelEnd"); + return after; + } + + /** + * After `]`. + * + * ```markdown + * > | [a](b) c + * ^ + * > | [a][b] c + * ^ + * > | [a][] b + * ^ + * > | [a] b + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + // Note: `markdown-rs` also parses GFM footnotes here, which for us is in + // an extension. + + // Resource (`[asd](fgh)`)? + if (code === 40) { + return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code); + } + + // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference? + if (code === 91) { + return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code); + } + + // Shortcut (`[asd]`) reference? + return defined ? labelEndOk(code) : labelEndNok(code); + } + + /** + * After `]`, at `[`, but not at a full reference. + * + * > 👉 **Note**: we only get here if the label is defined. + * + * ```markdown + * > | [a][] b + * ^ + * > | [a] b + * ^ + * ``` + * + * @type {State} + */ + function referenceNotFull(code) { + return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code); + } + + /** + * Done, we found something. + * + * ```markdown + * > | [a](b) c + * ^ + * > | [a][b] c + * ^ + * > | [a][] b + * ^ + * > | [a] b + * ^ + * ``` + * + * @type {State} + */ + function labelEndOk(code) { + // Note: `markdown-rs` does a bunch of stuff here. + return ok(code); + } + + /** + * Done, it’s nothing. + * + * There was an okay opening, but we didn’t match anything. + * + * ```markdown + * > | [a](b c + * ^ + * > | [a][b c + * ^ + * > | [a] b + * ^ + * ``` + * + * @type {State} + */ + function labelEndNok(code) { + labelStart._balanced = true; + return nok(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeResource(effects, ok, nok) { + return resourceStart; + + /** + * At a resource. + * + * ```markdown + * > | [a](b) c + * ^ + * ``` + * + * @type {State} + */ + function resourceStart(code) { + effects.enter("resource"); + effects.enter("resourceMarker"); + effects.consume(code); + effects.exit("resourceMarker"); + return resourceBefore; + } + + /** + * In resource, after `(`, at optional whitespace. + * + * ```markdown + * > | [a](b) c + * ^ + * ``` + * + * @type {State} + */ + function resourceBefore(code) { + return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code); + } + + /** + * In resource, after optional whitespace, at `)` or a destination. + * + * ```markdown + * > | [a](b) c + * ^ + * ``` + * + * @type {State} + */ + function resourceOpen(code) { + if (code === 41) { + return resourceEnd(code); + } + return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(code); + } + + /** + * In resource, after destination, at optional whitespace. + * + * ```markdown + * > | [a](b) c + * ^ + * ``` + * + * @type {State} + */ + function resourceDestinationAfter(code) { + return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code); + } + + /** + * At invalid destination. + * + * ```markdown + * > | [a](<<) b + * ^ + * ``` + * + * @type {State} + */ + function resourceDestinationMissing(code) { + return nok(code); + } + + /** + * In resource, after destination and whitespace, at `(` or title. + * + * ```markdown + * > | [a](b ) c + * ^ + * ``` + * + * @type {State} + */ + function resourceBetween(code) { + if (code === 34 || code === 39 || code === 40) { + return factoryTitle(effects, resourceTitleAfter, nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(code); + } + return resourceEnd(code); + } + + /** + * In resource, after title, at optional whitespace. + * + * ```markdown + * > | [a](b "c") d + * ^ + * ``` + * + * @type {State} + */ + function resourceTitleAfter(code) { + return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code); + } + + /** + * In resource, at `)`. + * + * ```markdown + * > | [a](b) d + * ^ + * ``` + * + * @type {State} + */ + function resourceEnd(code) { + if (code === 41) { + effects.enter("resourceMarker"); + effects.consume(code); + effects.exit("resourceMarker"); + effects.exit("resource"); + return ok; + } + return nok(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeReferenceFull(effects, ok, nok) { + const self = this; + return referenceFull; + + /** + * In a reference (full), at the `[`. + * + * ```markdown + * > | [a][b] d + * ^ + * ``` + * + * @type {State} + */ + function referenceFull(code) { + return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, "reference", "referenceMarker", "referenceString")(code); + } + + /** + * In a reference (full), after `]`. + * + * ```markdown + * > | [a][b] d + * ^ + * ``` + * + * @type {State} + */ + function referenceFullAfter(code) { + return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code); + } + + /** + * In reference (full) that was missing. + * + * ```markdown + * > | [a][b d + * ^ + * ``` + * + * @type {State} + */ + function referenceFullMissing(code) { + return nok(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeReferenceCollapsed(effects, ok, nok) { + return referenceCollapsedStart; + + /** + * In reference (collapsed), at `[`. + * + * > 👉 **Note**: we only get here if the label is defined. + * + * ```markdown + * > | [a][] d + * ^ + * ``` + * + * @type {State} + */ + function referenceCollapsedStart(code) { + // We only attempt a collapsed label if there’s a `[`. + + effects.enter("reference"); + effects.enter("referenceMarker"); + effects.consume(code); + effects.exit("referenceMarker"); + return referenceCollapsedOpen; + } + + /** + * In reference (collapsed), at `]`. + * + * > 👉 **Note**: we only get here if the label is defined. + * + * ```markdown + * > | [a][] d + * ^ + * ``` + * + * @type {State} + */ + function referenceCollapsedOpen(code) { + if (code === 93) { + effects.enter("referenceMarker"); + effects.consume(code); + effects.exit("referenceMarker"); + effects.exit("reference"); + return ok; + } + return nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0a3c6903b673bf64e9072788ce5715586afba77d --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const labelStartImage: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=label-start-image.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e41dbf7453b2769fdcc28edbb1febafd946a2e2b --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"label-start-image.d.ts","sourceRoot":"","sources":["label-start-image.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAZS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-image.js b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-image.js new file mode 100644 index 0000000000000000000000000000000000000000..064080a6d43025768d6465f74321d22ed95a16ef --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-image.js @@ -0,0 +1,102 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { labelEnd } from './label-end.js'; + +/** @type {Construct} */ +export const labelStartImage = { + name: 'labelStartImage', + resolveAll: labelEnd.resolveAll, + tokenize: tokenizeLabelStartImage +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeLabelStartImage(effects, ok, nok) { + const self = this; + return start; + + /** + * Start of label (image) start. + * + * ```markdown + * > | a ![b] c + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("labelImage"); + effects.enter("labelImageMarker"); + effects.consume(code); + effects.exit("labelImageMarker"); + return open; + } + + /** + * After `!`, at `[`. + * + * ```markdown + * > | a ![b] c + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (code === 91) { + effects.enter("labelMarker"); + effects.consume(code); + effects.exit("labelMarker"); + effects.exit("labelImage"); + return after; + } + return nok(code); + } + + /** + * After `![`. + * + * ```markdown + * > | a ![b] c + * ^ + * ``` + * + * This is needed in because, when GFM footnotes are enabled, images never + * form when started with a `^`. + * Instead, links form: + * + * ```markdown + * ![^a](b) + * + * ![^a][b] + * + * [b]: c + * ``` + * + * ```html + *

    !^a

    + *

    !^a

    + * ``` + * + * @type {State} + */ + function after(code) { + // To do: use a new field to do this, this is still needed for + // `micromark-extension-gfm-footnote`, but the `label-start-link` + // behavior isn’t. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..955c873ff3dcafb631cec59cf7b54512272d4aba --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const labelStartLink: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=label-start-link.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b242831ba15fac1a3725811dea1e9d32d39b02d7 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"label-start-link.d.ts","sourceRoot":"","sources":["label-start-link.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,6BADW,SAAS,CAKnB;+BAZS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-link.js b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-link.js new file mode 100644 index 0000000000000000000000000000000000000000..2792d87ac75869ce1692455732b446ba14f4590a --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/label-start-link.js @@ -0,0 +1,55 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { labelEnd } from './label-end.js'; + +/** @type {Construct} */ +export const labelStartLink = { + name: 'labelStartLink', + resolveAll: labelEnd.resolveAll, + tokenize: tokenizeLabelStartLink +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeLabelStartLink(effects, ok, nok) { + const self = this; + return start; + + /** + * Start of label (link) start. + * + * ```markdown + * > | a [b] c + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("labelLink"); + effects.enter("labelMarker"); + effects.consume(code); + effects.exit("labelMarker"); + effects.exit("labelLink"); + return after; + } + + /** @type {State} */ + function after(code) { + // To do: this isn’t needed in `micromark-extension-gfm-footnote`, + // remove. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/line-ending.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/line-ending.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3eb4a88afb8ec44f64729914b561e9fc5eb38d02 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/line-ending.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const lineEnding: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=line-ending.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/line-ending.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/line-ending.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..22bb64a5bed6c25aded0771488c316b138f07c05 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/line-ending.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"line-ending.d.ts","sourceRoot":"","sources":["line-ending.js"],"names":[],"mappings":"AAcA,wBAAwB;AACxB,yBADW,SAAS,CACwD;+BATlE,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/line-ending.js b/tools/ui/node_modules/micromark-core-commonmark/lib/line-ending.js new file mode 100644 index 0000000000000000000000000000000000000000..4df14d6f8dfcf6a24ffa3fbca639a2d6ded334ec --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/line-ending.js @@ -0,0 +1,33 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding } from 'micromark-util-character'; +/** @type {Construct} */ +export const lineEnding = { + name: 'lineEnding', + tokenize: tokenizeLineEnding +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeLineEnding(effects, ok) { + return start; + + /** @type {State} */ + function start(code) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return factorySpace(effects, ok, "linePrefix"); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/list.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/list.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ebecfda629530ee4e2f129755d795c8111ee5879 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/list.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const list: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=list.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/list.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/list.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8731fa642c91a3f999c2781be6c26ce41e253ba3 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/list.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.js"],"names":[],"mappings":"AAkBA,wBAAwB;AACxB,mBADW,SAAS,CAMnB;+BAhBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/list.js b/tools/ui/node_modules/micromark-core-commonmark/lib/list.js new file mode 100644 index 0000000000000000000000000000000000000000..dd3368ecbc8a1995cfdaab38b08738f01b4c02b1 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/list.js @@ -0,0 +1,213 @@ +/** + * @import { + * Code, + * Construct, + * Exiter, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { asciiDigit, markdownSpace } from 'micromark-util-character'; +import { blankLine } from './blank-line.js'; +import { thematicBreak } from './thematic-break.js'; + +/** @type {Construct} */ +export const list = { + continuation: { + tokenize: tokenizeListContinuation + }, + exit: tokenizeListEnd, + name: 'list', + tokenize: tokenizeListStart +}; + +/** @type {Construct} */ +const listItemPrefixWhitespaceConstruct = { + partial: true, + tokenize: tokenizeListItemPrefixWhitespace +}; + +/** @type {Construct} */ +const indentConstruct = { + partial: true, + tokenize: tokenizeIndent +}; + +// To do: `markdown-rs` parses list items on their own and later stitches them +// together. + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeListStart(effects, ok, nok) { + const self = this; + const tail = self.events[self.events.length - 1]; + let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; + let size = 0; + return start; + + /** @type {State} */ + function start(code) { + const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? "listUnordered" : "listOrdered"); + if (kind === "listUnordered" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) { + if (!self.containerState.type) { + self.containerState.type = kind; + effects.enter(kind, { + _container: true + }); + } + if (kind === "listUnordered") { + effects.enter("listItemPrefix"); + return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code); + } + if (!self.interrupt || code === 49) { + effects.enter("listItemPrefix"); + effects.enter("listItemValue"); + return inside(code); + } + } + return nok(code); + } + + /** @type {State} */ + function inside(code) { + if (asciiDigit(code) && ++size < 10) { + effects.consume(code); + return inside; + } + if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) { + effects.exit("listItemValue"); + return atMarker(code); + } + return nok(code); + } + + /** + * @type {State} + **/ + function atMarker(code) { + effects.enter("listItemMarker"); + effects.consume(code); + effects.exit("listItemMarker"); + self.containerState.marker = self.containerState.marker || code; + return effects.check(blankLine, + // Can’t be empty when interrupting. + self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix)); + } + + /** @type {State} */ + function onBlank(code) { + self.containerState.initialBlankLine = true; + initialSize++; + return endOfPrefix(code); + } + + /** @type {State} */ + function otherPrefix(code) { + if (markdownSpace(code)) { + effects.enter("listItemPrefixWhitespace"); + effects.consume(code); + effects.exit("listItemPrefixWhitespace"); + return endOfPrefix; + } + return nok(code); + } + + /** @type {State} */ + function endOfPrefix(code) { + self.containerState.size = initialSize + self.sliceSerialize(effects.exit("listItemPrefix"), true).length; + return ok(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeListContinuation(effects, ok, nok) { + const self = this; + self.containerState._closeFlow = undefined; + return effects.check(blankLine, onBlank, notBlank); + + /** @type {State} */ + function onBlank(code) { + self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine; + + // We have a blank line. + // Still, try to consume at most the items size. + return factorySpace(effects, ok, "listItemIndent", self.containerState.size + 1)(code); + } + + /** @type {State} */ + function notBlank(code) { + if (self.containerState.furtherBlankLines || !markdownSpace(code)) { + self.containerState.furtherBlankLines = undefined; + self.containerState.initialBlankLine = undefined; + return notInCurrentItem(code); + } + self.containerState.furtherBlankLines = undefined; + self.containerState.initialBlankLine = undefined; + return effects.attempt(indentConstruct, ok, notInCurrentItem)(code); + } + + /** @type {State} */ + function notInCurrentItem(code) { + // While we do continue, we signal that the flow should be closed. + self.containerState._closeFlow = true; + // As we’re closing flow, we’re no longer interrupting. + self.interrupt = undefined; + // Always populated by defaults. + + return factorySpace(effects, effects.attempt(list, ok, nok), "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeIndent(effects, ok, nok) { + const self = this; + return factorySpace(effects, afterPrefix, "listItemIndent", self.containerState.size + 1); + + /** @type {State} */ + function afterPrefix(code) { + const tail = self.events[self.events.length - 1]; + return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Exiter} + */ +function tokenizeListEnd(effects) { + effects.exit(this.containerState.type); +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeListItemPrefixWhitespace(effects, ok, nok) { + const self = this; + + // Always populated by defaults. + + return factorySpace(effects, afterPrefix, "listItemPrefixWhitespace", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1); + + /** @type {State} */ + function afterPrefix(code) { + const tail = self.events[self.events.length - 1]; + return !markdownSpace(code) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok(code) : nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d7ca340f4f659fa79d6438660bcdd3a0c8583a21 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const setextUnderline: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=setext-underline.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..296f7c681e31b0a670a4a5091c194be9a77d82ae --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"setext-underline.d.ts","sourceRoot":"","sources":["setext-underline.js"],"names":[],"mappings":"AAgBA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAbS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/setext-underline.js b/tools/ui/node_modules/micromark-core-commonmark/lib/setext-underline.js new file mode 100644 index 0000000000000000000000000000000000000000..5660dd97328b05c3512c6b431919f0c1dba655a3 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/setext-underline.js @@ -0,0 +1,185 @@ +/** + * @import { + * Code, + * Construct, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** @type {Construct} */ +export const setextUnderline = { + name: 'setextUnderline', + resolveTo: resolveToSetextUnderline, + tokenize: tokenizeSetextUnderline +}; + +/** @type {Resolver} */ +function resolveToSetextUnderline(events, context) { + // To do: resolve like `markdown-rs`. + let index = events.length; + /** @type {number | undefined} */ + let content; + /** @type {number | undefined} */ + let text; + /** @type {number | undefined} */ + let definition; + + // Find the opening of the content. + // It’ll always exist: we don’t tokenize if it isn’t there. + while (index--) { + if (events[index][0] === 'enter') { + if (events[index][1].type === "content") { + content = index; + break; + } + if (events[index][1].type === "paragraph") { + text = index; + } + } + // Exit + else { + if (events[index][1].type === "content") { + // Remove the content end (if needed we’ll add it later) + events.splice(index, 1); + } + if (!definition && events[index][1].type === "definition") { + definition = index; + } + } + } + const heading = { + type: "setextHeading", + start: { + ...events[content][1].start + }, + end: { + ...events[events.length - 1][1].end + } + }; + + // Change the paragraph to setext heading text. + events[text][1].type = "setextHeadingText"; + + // If we have definitions in the content, we’ll keep on having content, + // but we need move it. + if (definition) { + events.splice(text, 0, ['enter', heading, context]); + events.splice(definition + 1, 0, ['exit', events[content][1], context]); + events[content][1].end = { + ...events[definition][1].end + }; + } else { + events[content][1] = heading; + } + + // Add the heading exit at the end. + events.push(['exit', heading, context]); + return events; +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeSetextUnderline(effects, ok, nok) { + const self = this; + /** @type {NonNullable} */ + let marker; + return start; + + /** + * At start of heading (setext) underline. + * + * ```markdown + * | aa + * > | == + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + let index = self.events.length; + /** @type {boolean | undefined} */ + let paragraph; + // Find an opening. + while (index--) { + // Skip enter/exit of line ending, line prefix, and content. + // We can now either have a definition or a paragraph. + if (self.events[index][1].type !== "lineEnding" && self.events[index][1].type !== "linePrefix" && self.events[index][1].type !== "content") { + paragraph = self.events[index][1].type === "paragraph"; + break; + } + } + + // To do: handle lazy/pierce like `markdown-rs`. + // To do: parse indent like `markdown-rs`. + if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) { + effects.enter("setextHeadingLine"); + marker = code; + return before(code); + } + return nok(code); + } + + /** + * After optional whitespace, at `-` or `=`. + * + * ```markdown + * | aa + * > | == + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + effects.enter("setextHeadingLineSequence"); + return inside(code); + } + + /** + * In sequence. + * + * ```markdown + * | aa + * > | == + * ^ + * ``` + * + * @type {State} + */ + function inside(code) { + if (code === marker) { + effects.consume(code); + return inside; + } + effects.exit("setextHeadingLineSequence"); + return markdownSpace(code) ? factorySpace(effects, after, "lineSuffix")(code) : after(code); + } + + /** + * After sequence, after optional whitespace. + * + * ```markdown + * | aa + * > | == + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("setextHeadingLine"); + return ok(code); + } + return nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..51e9e97c650792cb0bc40c6e7065c1705796c4ac --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const thematicBreak: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=thematic-break.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d10a65bbc279681c956eddb067552b05eb8ba5a3 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/thematic-break.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"thematic-break.d.ts","sourceRoot":"","sources":["thematic-break.js"],"names":[],"mappings":"AAeA,wBAAwB;AACxB,4BADW,SAAS,CAInB;+BAZS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/thematic-break.js b/tools/ui/node_modules/micromark-core-commonmark/lib/thematic-break.js new file mode 100644 index 0000000000000000000000000000000000000000..ba3fb1990204a9568574067fbe95f49fe06a7f67 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/thematic-break.js @@ -0,0 +1,102 @@ +/** + * @import { + * Code, + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** @type {Construct} */ +export const thematicBreak = { + name: 'thematicBreak', + tokenize: tokenizeThematicBreak +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeThematicBreak(effects, ok, nok) { + let size = 0; + /** @type {NonNullable} */ + let marker; + return start; + + /** + * Start of thematic break. + * + * ```markdown + * > | *** + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("thematicBreak"); + // To do: parse indent like `markdown-rs`. + return before(code); + } + + /** + * After optional whitespace, at marker. + * + * ```markdown + * > | *** + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + marker = code; + return atBreak(code); + } + + /** + * After something, before something else. + * + * ```markdown + * > | *** + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === marker) { + effects.enter("thematicBreakSequence"); + return sequence(code); + } + if (size >= 3 && (code === null || markdownLineEnding(code))) { + effects.exit("thematicBreak"); + return ok(code); + } + return nok(code); + } + + /** + * In sequence. + * + * ```markdown + * > | *** + * ^ + * ``` + * + * @type {State} + */ + function sequence(code) { + if (code === marker) { + effects.consume(code); + size++; + return sequence; + } + effects.exit("thematicBreakSequence"); + return markdownSpace(code) ? factorySpace(effects, atBreak, "whitespace")(code) : atBreak(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/license b/tools/ui/node_modules/micromark-core-commonmark/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-core-commonmark/package.json b/tools/ui/node_modules/micromark-core-commonmark/package.json new file mode 100644 index 0000000000000000000000000000000000000000..3798a68ef0d83cdbf01dff525041286f4cd9ba43 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/package.json @@ -0,0 +1,74 @@ +{ + "name": "micromark-core-commonmark", + "version": "2.0.3", + "description": "The CommonMark markdown constructs", + "license": "MIT", + "keywords": [ + "micromark", + "core", + "commonmark" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-core-commonmark", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "max-depth": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/readme.md b/tools/ui/node_modules/micromark-core-commonmark/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..5cc8b7cafb443a124ffbe1859e03a4a51b9afd47 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/readme.md @@ -0,0 +1,171 @@ +# micromark-core-commonmark + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] constructs that make up the core of CommonMark. +Some of these can be [turned off][disable], but they are often essential to +markdown and weird things might happen. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes the default constructs. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-core-commonmark +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import * as core from 'https://esm.sh/micromark-core-commonmark@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {autolink} from 'micromark-core-commonmark' + +console.log(autolink) // Do things with `autolink`. +``` + +## API + +This module exports the following identifiers: `attention`, `autolink`, +`blankLine`, `blockQuote`, `characterEscape`, `characterReference`, +`codeFenced`, `codeIndented`, `codeText`, `content`, `definition`, +`hardBreakEscape`, `headingAtx`, `htmlFlow`, `htmlText`, `labelEnd`, +`labelStartImage`, `labelStartLink`, `lineEnding`, `list`, `setextUnderline`, +`thematicBreak`. +There is no default export. + +Each identifier refers to a [construct][]. + +See the code for more on the exported constructs. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-core-commonmark@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[bundle-size]: https://bundlejs.com/?q=micromark-core-commonmark + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-core-commonmark + +[chat]: https://github.com/micromark/micromark/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[construct]: https://github.com/micromark/micromark#constructs + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/micromark/micromark + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[disable]: https://github.com/micromark/micromark#case-turn-off-constructs + +[downloads]: https://www.npmjs.com/package/micromark-core-commonmark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-core-commonmark.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[health]: https://github.com/micromark/.github + +[license]: https://github.com/micromark/micromark/blob/main/license + +[micromark]: https://github.com/micromark/micromark + +[npm]: https://docs.npmjs.com/cli/install + +[opencollective]: https://opencollective.com/unified + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[typescript]: https://www.typescriptlang.org diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..36f53b55bf7d7494d1ed6a8b21564825e385142f --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/index.d.ts @@ -0,0 +1,24 @@ +export {gfmAutolinkLiteral} from './lib/syntax.js' +export {gfmAutolinkLiteralHtml} from './lib/html.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Augment token with a field to improve performance. + */ + interface Token { + _gfmAutolinkLiteralWalkedInto?: boolean + } + + /** + * Token types. + */ + interface TokenTypeMap { + literalAutolink: 'literalAutolink' + literalAutolinkEmail: 'literalAutolinkEmail' + literalAutolinkHttp: 'literalAutolinkHttp' + literalAutolinkWww: 'literalAutolinkWww' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/index.js b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..928d4456ab6b3955721b70f09fb05d1bdf22e8b0 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/index.js @@ -0,0 +1,2 @@ +export {gfmAutolinkLiteral} from './lib/syntax.js' +export {gfmAutolinkLiteralHtml} from './lib/html.js' diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..250ffc8fbe401c34891c4a5aed329cad6ec49f25 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/html.d.ts @@ -0,0 +1,10 @@ +/** + * Create an HTML extension for `micromark` to support GitHub autolink literal + * when serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GitHub autolink literal when serializing to HTML. + */ +export function gfmAutolinkLiteralHtml(): HtmlExtension; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..7b8145b346651fd9abc0089c5371f39383839555 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/html.js @@ -0,0 +1,56 @@ +/** + * @import {CompileContext, Handle, HtmlExtension, Token} from 'micromark-util-types' + */ + +import {sanitizeUri} from 'micromark-util-sanitize-uri' + +/** + * Create an HTML extension for `micromark` to support GitHub autolink literal + * when serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GitHub autolink literal when serializing to HTML. + */ +export function gfmAutolinkLiteralHtml() { + return { + exit: {literalAutolinkEmail, literalAutolinkHttp, literalAutolinkWww} + } +} + +/** + * @this {CompileContext} + * @type {Handle} + */ +function literalAutolinkWww(token) { + anchorFromToken.call(this, token, 'http://') +} + +/** + * @this {CompileContext} + * @type {Handle} + */ +function literalAutolinkEmail(token) { + anchorFromToken.call(this, token, 'mailto:') +} + +/** + * @this {CompileContext} + * @type {Handle} + */ +function literalAutolinkHttp(token) { + anchorFromToken.call(this, token) +} + +/** + * @this CompileContext + * @param {Token} token + * @param {string | null | undefined} [protocol] + * @returns {undefined} + */ +function anchorFromToken(token, protocol) { + const url = this.sliceSerialize(token) + this.tag('') + this.raw(this.encode(url)) + this.tag('') +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fc2ddfab5391b1bb2036725392923572bff608e4 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/syntax.d.ts @@ -0,0 +1,10 @@ +/** + * Create an extension for `micromark` to support GitHub autolink literal + * syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * autolink literal syntax. + */ +export function gfmAutolinkLiteral(): Extension; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..904e27200ae4980183beda525d33feef70c2e7f7 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/dev/lib/syntax.js @@ -0,0 +1,983 @@ +/** + * @import {Code, ConstructRecord, Event, Extension, Previous, State, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import { + asciiAlpha, + asciiAlphanumeric, + asciiControl, + markdownLineEndingOrSpace, + unicodePunctuation, + unicodeWhitespace +} from 'micromark-util-character' +import {codes} from 'micromark-util-symbol' + +const wwwPrefix = {tokenize: tokenizeWwwPrefix, partial: true} +const domain = {tokenize: tokenizeDomain, partial: true} +const path = {tokenize: tokenizePath, partial: true} +const trail = {tokenize: tokenizeTrail, partial: true} +const emailDomainDotTrail = { + tokenize: tokenizeEmailDomainDotTrail, + partial: true +} + +const wwwAutolink = { + name: 'wwwAutolink', + tokenize: tokenizeWwwAutolink, + previous: previousWww +} + +const protocolAutolink = { + name: 'protocolAutolink', + tokenize: tokenizeProtocolAutolink, + previous: previousProtocol +} + +const emailAutolink = { + name: 'emailAutolink', + tokenize: tokenizeEmailAutolink, + previous: previousEmail +} + +/** @type {ConstructRecord} */ +const text = {} + +/** + * Create an extension for `micromark` to support GitHub autolink literal + * syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * autolink literal syntax. + */ +export function gfmAutolinkLiteral() { + return {text} +} + +/** @type {Code} */ +let code = codes.digit0 + +// Add alphanumerics. +while (code < codes.leftCurlyBrace) { + text[code] = emailAutolink + code++ + if (code === codes.colon) code = codes.uppercaseA + else if (code === codes.leftSquareBracket) code = codes.lowercaseA +} + +text[codes.plusSign] = emailAutolink +text[codes.dash] = emailAutolink +text[codes.dot] = emailAutolink +text[codes.underscore] = emailAutolink +text[codes.uppercaseH] = [emailAutolink, protocolAutolink] +text[codes.lowercaseH] = [emailAutolink, protocolAutolink] +text[codes.uppercaseW] = [emailAutolink, wwwAutolink] +text[codes.lowercaseW] = [emailAutolink, wwwAutolink] + +// To do: perform email autolink literals on events, afterwards. +// That’s where `markdown-rs` and `cmark-gfm` perform it. +// It should look for `@`, then for atext backwards, and then for a label +// forwards. +// To do: `mailto:`, `xmpp:` protocol as prefix. + +/** + * Email autolink literal. + * + * ```markdown + * > | a contact@example.org b + * ^^^^^^^^^^^^^^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeEmailAutolink(effects, ok, nok) { + const self = this + /** @type {boolean | undefined} */ + let dot + /** @type {boolean} */ + let data + + return start + + /** + * Start of email autolink literal. + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if ( + !gfmAtext(code) || + !previousEmail.call(self, self.previous) || + previousUnbalanced(self.events) + ) { + return nok(code) + } + + effects.enter('literalAutolink') + effects.enter('literalAutolinkEmail') + return atext(code) + } + + /** + * In email atext. + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function atext(code) { + if (gfmAtext(code)) { + effects.consume(code) + return atext + } + + if (code === codes.atSign) { + effects.consume(code) + return emailDomain + } + + return nok(code) + } + + /** + * In email domain. + * + * The reference code is a bit overly complex as it handles the `@`, of which + * there may be just one. + * Source: + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function emailDomain(code) { + // Dot followed by alphanumerical (not `-` or `_`). + if (code === codes.dot) { + return effects.check( + emailDomainDotTrail, + emailDomainAfter, + emailDomainDot + )(code) + } + + // Alphanumerical, `-`, and `_`. + if ( + code === codes.dash || + code === codes.underscore || + asciiAlphanumeric(code) + ) { + data = true + effects.consume(code) + return emailDomain + } + + // To do: `/` if xmpp. + + // Note: normally we’d truncate trailing punctuation from the link. + // However, email autolink literals cannot contain any of those markers, + // except for `.`, but that can only occur if it isn’t trailing. + // So we can ignore truncating! + return emailDomainAfter(code) + } + + /** + * In email domain, on dot that is not a trail. + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function emailDomainDot(code) { + effects.consume(code) + dot = true + return emailDomain + } + + /** + * After email domain. + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function emailDomainAfter(code) { + // Domain must not be empty, must include a dot, and must end in alphabetical. + // Source: . + if (data && dot && asciiAlpha(self.previous)) { + effects.exit('literalAutolinkEmail') + effects.exit('literalAutolink') + return ok(code) + } + + return nok(code) + } +} + +/** + * `www` autolink literal. + * + * ```markdown + * > | a www.example.org b + * ^^^^^^^^^^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeWwwAutolink(effects, ok, nok) { + const self = this + + return wwwStart + + /** + * Start of www autolink literal. + * + * ```markdown + * > | www.example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function wwwStart(code) { + if ( + (code !== codes.uppercaseW && code !== codes.lowercaseW) || + !previousWww.call(self, self.previous) || + previousUnbalanced(self.events) + ) { + return nok(code) + } + + effects.enter('literalAutolink') + effects.enter('literalAutolinkWww') + // Note: we *check*, so we can discard the `www.` we parsed. + // If it worked, we consider it as a part of the domain. + return effects.check( + wwwPrefix, + effects.attempt(domain, effects.attempt(path, wwwAfter), nok), + nok + )(code) + } + + /** + * After a www autolink literal. + * + * ```markdown + * > | www.example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function wwwAfter(code) { + effects.exit('literalAutolinkWww') + effects.exit('literalAutolink') + return ok(code) + } +} + +/** + * Protocol autolink literal. + * + * ```markdown + * > | a https://example.org b + * ^^^^^^^^^^^^^^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeProtocolAutolink(effects, ok, nok) { + const self = this + let buffer = '' + let seen = false + + return protocolStart + + /** + * Start of protocol autolink literal. + * + * ```markdown + * > | https://example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function protocolStart(code) { + if ( + (code === codes.uppercaseH || code === codes.lowercaseH) && + previousProtocol.call(self, self.previous) && + !previousUnbalanced(self.events) + ) { + effects.enter('literalAutolink') + effects.enter('literalAutolinkHttp') + buffer += String.fromCodePoint(code) + effects.consume(code) + return protocolPrefixInside + } + + return nok(code) + } + + /** + * In protocol. + * + * ```markdown + * > | https://example.com/a?b#c + * ^^^^^ + * ``` + * + * @type {State} + */ + function protocolPrefixInside(code) { + // `5` is size of `https` + if (asciiAlpha(code) && buffer.length < 5) { + // @ts-expect-error: definitely number. + buffer += String.fromCodePoint(code) + effects.consume(code) + return protocolPrefixInside + } + + if (code === codes.colon) { + const protocol = buffer.toLowerCase() + + if (protocol === 'http' || protocol === 'https') { + effects.consume(code) + return protocolSlashesInside + } + } + + return nok(code) + } + + /** + * In slashes. + * + * ```markdown + * > | https://example.com/a?b#c + * ^^ + * ``` + * + * @type {State} + */ + function protocolSlashesInside(code) { + if (code === codes.slash) { + effects.consume(code) + + if (seen) { + return afterProtocol + } + + seen = true + return protocolSlashesInside + } + + return nok(code) + } + + /** + * After protocol, before domain. + * + * ```markdown + * > | https://example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function afterProtocol(code) { + // To do: this is different from `markdown-rs`: + // https://github.com/wooorm/markdown-rs/blob/b3a921c761309ae00a51fe348d8a43adbc54b518/src/construct/gfm_autolink_literal.rs#L172-L182 + return code === codes.eof || + asciiControl(code) || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) || + unicodePunctuation(code) + ? nok(code) + : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code) + } + + /** + * After a protocol autolink literal. + * + * ```markdown + * > | https://example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function protocolAfter(code) { + effects.exit('literalAutolinkHttp') + effects.exit('literalAutolink') + return ok(code) + } +} + +/** + * `www` prefix. + * + * ```markdown + * > | a www.example.org b + * ^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeWwwPrefix(effects, ok, nok) { + let size = 0 + + return wwwPrefixInside + + /** + * In www prefix. + * + * ```markdown + * > | www.example.com + * ^^^^ + * ``` + * + * @type {State} + */ + function wwwPrefixInside(code) { + if ((code === codes.uppercaseW || code === codes.lowercaseW) && size < 3) { + size++ + effects.consume(code) + return wwwPrefixInside + } + + if (code === codes.dot && size === 3) { + effects.consume(code) + return wwwPrefixAfter + } + + return nok(code) + } + + /** + * After www prefix. + * + * ```markdown + * > | www.example.com + * ^ + * ``` + * + * @type {State} + */ + function wwwPrefixAfter(code) { + // If there is *anything*, we can link. + return code === codes.eof ? nok(code) : ok(code) + } +} + +/** + * Domain. + * + * ```markdown + * > | a https://example.org b + * ^^^^^^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeDomain(effects, ok, nok) { + /** @type {boolean | undefined} */ + let underscoreInLastSegment + /** @type {boolean | undefined} */ + let underscoreInLastLastSegment + /** @type {boolean | undefined} */ + let seen + + return domainInside + + /** + * In domain. + * + * ```markdown + * > | https://example.com/a + * ^^^^^^^^^^^ + * ``` + * + * @type {State} + */ + function domainInside(code) { + // Check whether this marker, which is a trailing punctuation + // marker, optionally followed by more trailing markers, and then + // followed by an end. + if (code === codes.dot || code === codes.underscore) { + return effects.check(trail, domainAfter, domainAtPunctuation)(code) + } + + // GH documents that only alphanumerics (other than `-`, `.`, and `_`) can + // occur, which sounds like ASCII only, but they also support `www.點看.com`, + // so that’s Unicode. + // Instead of some new production for Unicode alphanumerics, markdown + // already has that for Unicode punctuation and whitespace, so use those. + // Source: . + if ( + code === codes.eof || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) || + (code !== codes.dash && unicodePunctuation(code)) + ) { + return domainAfter(code) + } + + seen = true + effects.consume(code) + return domainInside + } + + /** + * In domain, at potential trailing punctuation, that was not trailing. + * + * ```markdown + * > | https://example.com + * ^ + * ``` + * + * @type {State} + */ + function domainAtPunctuation(code) { + // There is an underscore in the last segment of the domain + if (code === codes.underscore) { + underscoreInLastSegment = true + } + // Otherwise, it’s a `.`: save the last segment underscore in the + // penultimate segment slot. + else { + underscoreInLastLastSegment = underscoreInLastSegment + underscoreInLastSegment = undefined + } + + effects.consume(code) + return domainInside + } + + /** + * After domain. + * + * ```markdown + * > | https://example.com/a + * ^ + * ``` + * + * @type {State} */ + function domainAfter(code) { + // Note: that’s GH says a dot is needed, but it’s not true: + // + if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) { + return nok(code) + } + + return ok(code) + } +} + +/** + * Path. + * + * ```markdown + * > | a https://example.org/stuff b + * ^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizePath(effects, ok) { + let sizeOpen = 0 + let sizeClose = 0 + + return pathInside + + /** + * In path. + * + * ```markdown + * > | https://example.com/a + * ^^ + * ``` + * + * @type {State} + */ + function pathInside(code) { + if (code === codes.leftParenthesis) { + sizeOpen++ + effects.consume(code) + return pathInside + } + + // To do: `markdown-rs` also needs this. + // If this is a paren, and there are less closings than openings, + // we don’t check for a trail. + if (code === codes.rightParenthesis && sizeClose < sizeOpen) { + return pathAtPunctuation(code) + } + + // Check whether this trailing punctuation marker is optionally + // followed by more trailing markers, and then followed + // by an end. + if ( + code === codes.exclamationMark || + code === codes.quotationMark || + code === codes.ampersand || + code === codes.apostrophe || + code === codes.rightParenthesis || + code === codes.asterisk || + code === codes.comma || + code === codes.dot || + code === codes.colon || + code === codes.semicolon || + code === codes.lessThan || + code === codes.questionMark || + code === codes.rightSquareBracket || + code === codes.underscore || + code === codes.tilde + ) { + return effects.check(trail, ok, pathAtPunctuation)(code) + } + + if ( + code === codes.eof || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return ok(code) + } + + effects.consume(code) + return pathInside + } + + /** + * In path, at potential trailing punctuation, that was not trailing. + * + * ```markdown + * > | https://example.com/a"b + * ^ + * ``` + * + * @type {State} + */ + function pathAtPunctuation(code) { + // Count closing parens. + if (code === codes.rightParenthesis) { + sizeClose++ + } + + effects.consume(code) + return pathInside + } +} + +/** + * Trail. + * + * This calls `ok` if this *is* the trail, followed by an end, which means + * the entire trail is not part of the link. + * It calls `nok` if this *is* part of the link. + * + * ```markdown + * > | https://example.com"). + * ^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeTrail(effects, ok, nok) { + return trail + + /** + * In trail of domain or path. + * + * ```markdown + * > | https://example.com"). + * ^ + * ``` + * + * @type {State} + */ + function trail(code) { + // Regular trailing punctuation. + if ( + code === codes.exclamationMark || + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.rightParenthesis || + code === codes.asterisk || + code === codes.comma || + code === codes.dot || + code === codes.colon || + code === codes.semicolon || + code === codes.questionMark || + code === codes.underscore || + code === codes.tilde + ) { + effects.consume(code) + return trail + } + + // `&` followed by one or more alphabeticals and then a `;`, is + // as a whole considered as trailing punctuation. + // In all other cases, it is considered as continuation of the URL. + if (code === codes.ampersand) { + effects.consume(code) + return trailCharacterReferenceStart + } + + // Needed because we allow literals after `[`, as we fix: + // . + // Check that it is not followed by `(` or `[`. + if (code === codes.rightSquareBracket) { + effects.consume(code) + return trailBracketAfter + } + + if ( + // `<` is an end. + code === codes.lessThan || + // So is whitespace. + code === codes.eof || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return ok(code) + } + + return nok(code) + } + + /** + * In trail, after `]`. + * + * > 👉 **Note**: this deviates from `cmark-gfm` to fix a bug. + * > See end of for more. + * + * ```markdown + * > | https://example.com]( + * ^ + * ``` + * + * @type {State} + */ + function trailBracketAfter(code) { + // Whitespace or something that could start a resource or reference is the end. + // Switch back to trail otherwise. + if ( + code === codes.eof || + code === codes.leftParenthesis || + code === codes.leftSquareBracket || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return ok(code) + } + + return trail(code) + } + + /** + * In character-reference like trail, after `&`. + * + * ```markdown + * > | https://example.com&). + * ^ + * ``` + * + * @type {State} + */ + function trailCharacterReferenceStart(code) { + // When non-alpha, it’s not a trail. + return asciiAlpha(code) ? trailCharacterReferenceInside(code) : nok(code) + } + + /** + * In character-reference like trail. + * + * ```markdown + * > | https://example.com&). + * ^ + * ``` + * + * @type {State} + */ + function trailCharacterReferenceInside(code) { + // Switch back to trail if this is well-formed. + if (code === codes.semicolon) { + effects.consume(code) + return trail + } + + if (asciiAlpha(code)) { + effects.consume(code) + return trailCharacterReferenceInside + } + + // It’s not a trail. + return nok(code) + } +} + +/** + * Dot in email domain trail. + * + * This calls `ok` if this *is* the trail, followed by an end, which means + * the trail is not part of the link. + * It calls `nok` if this *is* part of the link. + * + * ```markdown + * > | contact@example.org. + * ^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeEmailDomainDotTrail(effects, ok, nok) { + return start + + /** + * Dot. + * + * ```markdown + * > | contact@example.org. + * ^ ^ + * ``` + * + * @type {State} + */ + function start(code) { + // Must be dot. + effects.consume(code) + return after + } + + /** + * After dot. + * + * ```markdown + * > | contact@example.org. + * ^ ^ + * ``` + * + * @type {State} + */ + function after(code) { + // Not a trail if alphanumeric. + return asciiAlphanumeric(code) ? nok(code) : ok(code) + } +} + +/** + * See: + * . + * + * @type {Previous} + */ +function previousWww(code) { + return ( + code === codes.eof || + code === codes.leftParenthesis || + code === codes.asterisk || + code === codes.underscore || + code === codes.leftSquareBracket || + code === codes.rightSquareBracket || + code === codes.tilde || + markdownLineEndingOrSpace(code) + ) +} + +/** + * See: + * . + * + * @type {Previous} + */ +function previousProtocol(code) { + return !asciiAlpha(code) +} + +/** + * @this {TokenizeContext} + * @type {Previous} + */ +function previousEmail(code) { + // Do not allow a slash “inside” atext. + // The reference code is a bit weird, but that’s what it results in. + // Source: . + // Other than slash, every preceding character is allowed. + return !(code === codes.slash || gfmAtext(code)) +} + +/** + * @param {Code} code + * @returns {boolean} + */ +function gfmAtext(code) { + return ( + code === codes.plusSign || + code === codes.dash || + code === codes.dot || + code === codes.underscore || + asciiAlphanumeric(code) + ) +} + +/** + * @param {Array} events + * @returns {boolean} + */ +function previousUnbalanced(events) { + let index = events.length + let result = false + + while (index--) { + const token = events[index][1] + + if ( + (token.type === 'labelLink' || token.type === 'labelImage') && + !token._balanced + ) { + result = true + break + } + + // If we’ve seen this token, and it was marked as not having any unbalanced + // bracket before it, we can exit. + if (token._gfmAutolinkLiteralWalkedInto) { + result = false + break + } + } + + if (events.length > 0 && !result) { + // Mark the last token as “walked into” w/o finding + // anything. + events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true + } + + return result +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..36f53b55bf7d7494d1ed6a8b21564825e385142f --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/index.d.ts @@ -0,0 +1,24 @@ +export {gfmAutolinkLiteral} from './lib/syntax.js' +export {gfmAutolinkLiteralHtml} from './lib/html.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Augment token with a field to improve performance. + */ + interface Token { + _gfmAutolinkLiteralWalkedInto?: boolean + } + + /** + * Token types. + */ + interface TokenTypeMap { + literalAutolink: 'literalAutolink' + literalAutolinkEmail: 'literalAutolinkEmail' + literalAutolinkHttp: 'literalAutolinkHttp' + literalAutolinkWww: 'literalAutolinkWww' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/index.js b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5194682ad940eb2402efb1de1b57b76fbc082c6e --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/index.js @@ -0,0 +1,2 @@ +export { gfmAutolinkLiteral } from './lib/syntax.js'; +export { gfmAutolinkLiteralHtml } from './lib/html.js'; \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..250ffc8fbe401c34891c4a5aed329cad6ec49f25 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/html.d.ts @@ -0,0 +1,10 @@ +/** + * Create an HTML extension for `micromark` to support GitHub autolink literal + * when serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GitHub autolink literal when serializing to HTML. + */ +export function gfmAutolinkLiteralHtml(): HtmlExtension; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..e0b3c3d21fa8d7f7b6596145d6f817c4089a0614 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/html.js @@ -0,0 +1,60 @@ +/** + * @import {CompileContext, Handle, HtmlExtension, Token} from 'micromark-util-types' + */ + +import { sanitizeUri } from 'micromark-util-sanitize-uri'; + +/** + * Create an HTML extension for `micromark` to support GitHub autolink literal + * when serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GitHub autolink literal when serializing to HTML. + */ +export function gfmAutolinkLiteralHtml() { + return { + exit: { + literalAutolinkEmail, + literalAutolinkHttp, + literalAutolinkWww + } + }; +} + +/** + * @this {CompileContext} + * @type {Handle} + */ +function literalAutolinkWww(token) { + anchorFromToken.call(this, token, 'http://'); +} + +/** + * @this {CompileContext} + * @type {Handle} + */ +function literalAutolinkEmail(token) { + anchorFromToken.call(this, token, 'mailto:'); +} + +/** + * @this {CompileContext} + * @type {Handle} + */ +function literalAutolinkHttp(token) { + anchorFromToken.call(this, token); +} + +/** + * @this CompileContext + * @param {Token} token + * @param {string | null | undefined} [protocol] + * @returns {undefined} + */ +function anchorFromToken(token, protocol) { + const url = this.sliceSerialize(token); + this.tag(''); + this.raw(this.encode(url)); + this.tag(''); +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fc2ddfab5391b1bb2036725392923572bff608e4 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.d.ts @@ -0,0 +1,10 @@ +/** + * Create an extension for `micromark` to support GitHub autolink literal + * syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * autolink literal syntax. + */ +export function gfmAutolinkLiteral(): Extension; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..dffbaf15146b34d3b3f634286629ccb148866f4c --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js @@ -0,0 +1,854 @@ +/** + * @import {Code, ConstructRecord, Event, Extension, Previous, State, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import { asciiAlpha, asciiAlphanumeric, asciiControl, markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character'; +const wwwPrefix = { + tokenize: tokenizeWwwPrefix, + partial: true +}; +const domain = { + tokenize: tokenizeDomain, + partial: true +}; +const path = { + tokenize: tokenizePath, + partial: true +}; +const trail = { + tokenize: tokenizeTrail, + partial: true +}; +const emailDomainDotTrail = { + tokenize: tokenizeEmailDomainDotTrail, + partial: true +}; +const wwwAutolink = { + name: 'wwwAutolink', + tokenize: tokenizeWwwAutolink, + previous: previousWww +}; +const protocolAutolink = { + name: 'protocolAutolink', + tokenize: tokenizeProtocolAutolink, + previous: previousProtocol +}; +const emailAutolink = { + name: 'emailAutolink', + tokenize: tokenizeEmailAutolink, + previous: previousEmail +}; + +/** @type {ConstructRecord} */ +const text = {}; + +/** + * Create an extension for `micromark` to support GitHub autolink literal + * syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * autolink literal syntax. + */ +export function gfmAutolinkLiteral() { + return { + text + }; +} + +/** @type {Code} */ +let code = 48; + +// Add alphanumerics. +while (code < 123) { + text[code] = emailAutolink; + code++; + if (code === 58) code = 65;else if (code === 91) code = 97; +} +text[43] = emailAutolink; +text[45] = emailAutolink; +text[46] = emailAutolink; +text[95] = emailAutolink; +text[72] = [emailAutolink, protocolAutolink]; +text[104] = [emailAutolink, protocolAutolink]; +text[87] = [emailAutolink, wwwAutolink]; +text[119] = [emailAutolink, wwwAutolink]; + +// To do: perform email autolink literals on events, afterwards. +// That’s where `markdown-rs` and `cmark-gfm` perform it. +// It should look for `@`, then for atext backwards, and then for a label +// forwards. +// To do: `mailto:`, `xmpp:` protocol as prefix. + +/** + * Email autolink literal. + * + * ```markdown + * > | a contact@example.org b + * ^^^^^^^^^^^^^^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeEmailAutolink(effects, ok, nok) { + const self = this; + /** @type {boolean | undefined} */ + let dot; + /** @type {boolean} */ + let data; + return start; + + /** + * Start of email autolink literal. + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if (!gfmAtext(code) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) { + return nok(code); + } + effects.enter('literalAutolink'); + effects.enter('literalAutolinkEmail'); + return atext(code); + } + + /** + * In email atext. + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function atext(code) { + if (gfmAtext(code)) { + effects.consume(code); + return atext; + } + if (code === 64) { + effects.consume(code); + return emailDomain; + } + return nok(code); + } + + /** + * In email domain. + * + * The reference code is a bit overly complex as it handles the `@`, of which + * there may be just one. + * Source: + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function emailDomain(code) { + // Dot followed by alphanumerical (not `-` or `_`). + if (code === 46) { + return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code); + } + + // Alphanumerical, `-`, and `_`. + if (code === 45 || code === 95 || asciiAlphanumeric(code)) { + data = true; + effects.consume(code); + return emailDomain; + } + + // To do: `/` if xmpp. + + // Note: normally we’d truncate trailing punctuation from the link. + // However, email autolink literals cannot contain any of those markers, + // except for `.`, but that can only occur if it isn’t trailing. + // So we can ignore truncating! + return emailDomainAfter(code); + } + + /** + * In email domain, on dot that is not a trail. + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function emailDomainDot(code) { + effects.consume(code); + dot = true; + return emailDomain; + } + + /** + * After email domain. + * + * ```markdown + * > | a contact@example.org b + * ^ + * ``` + * + * @type {State} + */ + function emailDomainAfter(code) { + // Domain must not be empty, must include a dot, and must end in alphabetical. + // Source: . + if (data && dot && asciiAlpha(self.previous)) { + effects.exit('literalAutolinkEmail'); + effects.exit('literalAutolink'); + return ok(code); + } + return nok(code); + } +} + +/** + * `www` autolink literal. + * + * ```markdown + * > | a www.example.org b + * ^^^^^^^^^^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeWwwAutolink(effects, ok, nok) { + const self = this; + return wwwStart; + + /** + * Start of www autolink literal. + * + * ```markdown + * > | www.example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function wwwStart(code) { + if (code !== 87 && code !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) { + return nok(code); + } + effects.enter('literalAutolink'); + effects.enter('literalAutolinkWww'); + // Note: we *check*, so we can discard the `www.` we parsed. + // If it worked, we consider it as a part of the domain. + return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code); + } + + /** + * After a www autolink literal. + * + * ```markdown + * > | www.example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function wwwAfter(code) { + effects.exit('literalAutolinkWww'); + effects.exit('literalAutolink'); + return ok(code); + } +} + +/** + * Protocol autolink literal. + * + * ```markdown + * > | a https://example.org b + * ^^^^^^^^^^^^^^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeProtocolAutolink(effects, ok, nok) { + const self = this; + let buffer = ''; + let seen = false; + return protocolStart; + + /** + * Start of protocol autolink literal. + * + * ```markdown + * > | https://example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function protocolStart(code) { + if ((code === 72 || code === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) { + effects.enter('literalAutolink'); + effects.enter('literalAutolinkHttp'); + buffer += String.fromCodePoint(code); + effects.consume(code); + return protocolPrefixInside; + } + return nok(code); + } + + /** + * In protocol. + * + * ```markdown + * > | https://example.com/a?b#c + * ^^^^^ + * ``` + * + * @type {State} + */ + function protocolPrefixInside(code) { + // `5` is size of `https` + if (asciiAlpha(code) && buffer.length < 5) { + // @ts-expect-error: definitely number. + buffer += String.fromCodePoint(code); + effects.consume(code); + return protocolPrefixInside; + } + if (code === 58) { + const protocol = buffer.toLowerCase(); + if (protocol === 'http' || protocol === 'https') { + effects.consume(code); + return protocolSlashesInside; + } + } + return nok(code); + } + + /** + * In slashes. + * + * ```markdown + * > | https://example.com/a?b#c + * ^^ + * ``` + * + * @type {State} + */ + function protocolSlashesInside(code) { + if (code === 47) { + effects.consume(code); + if (seen) { + return afterProtocol; + } + seen = true; + return protocolSlashesInside; + } + return nok(code); + } + + /** + * After protocol, before domain. + * + * ```markdown + * > | https://example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function afterProtocol(code) { + // To do: this is different from `markdown-rs`: + // https://github.com/wooorm/markdown-rs/blob/b3a921c761309ae00a51fe348d8a43adbc54b518/src/construct/gfm_autolink_literal.rs#L172-L182 + return code === null || asciiControl(code) || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || unicodePunctuation(code) ? nok(code) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code); + } + + /** + * After a protocol autolink literal. + * + * ```markdown + * > | https://example.com/a?b#c + * ^ + * ``` + * + * @type {State} + */ + function protocolAfter(code) { + effects.exit('literalAutolinkHttp'); + effects.exit('literalAutolink'); + return ok(code); + } +} + +/** + * `www` prefix. + * + * ```markdown + * > | a www.example.org b + * ^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeWwwPrefix(effects, ok, nok) { + let size = 0; + return wwwPrefixInside; + + /** + * In www prefix. + * + * ```markdown + * > | www.example.com + * ^^^^ + * ``` + * + * @type {State} + */ + function wwwPrefixInside(code) { + if ((code === 87 || code === 119) && size < 3) { + size++; + effects.consume(code); + return wwwPrefixInside; + } + if (code === 46 && size === 3) { + effects.consume(code); + return wwwPrefixAfter; + } + return nok(code); + } + + /** + * After www prefix. + * + * ```markdown + * > | www.example.com + * ^ + * ``` + * + * @type {State} + */ + function wwwPrefixAfter(code) { + // If there is *anything*, we can link. + return code === null ? nok(code) : ok(code); + } +} + +/** + * Domain. + * + * ```markdown + * > | a https://example.org b + * ^^^^^^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeDomain(effects, ok, nok) { + /** @type {boolean | undefined} */ + let underscoreInLastSegment; + /** @type {boolean | undefined} */ + let underscoreInLastLastSegment; + /** @type {boolean | undefined} */ + let seen; + return domainInside; + + /** + * In domain. + * + * ```markdown + * > | https://example.com/a + * ^^^^^^^^^^^ + * ``` + * + * @type {State} + */ + function domainInside(code) { + // Check whether this marker, which is a trailing punctuation + // marker, optionally followed by more trailing markers, and then + // followed by an end. + if (code === 46 || code === 95) { + return effects.check(trail, domainAfter, domainAtPunctuation)(code); + } + + // GH documents that only alphanumerics (other than `-`, `.`, and `_`) can + // occur, which sounds like ASCII only, but they also support `www.點看.com`, + // so that’s Unicode. + // Instead of some new production for Unicode alphanumerics, markdown + // already has that for Unicode punctuation and whitespace, so use those. + // Source: . + if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || code !== 45 && unicodePunctuation(code)) { + return domainAfter(code); + } + seen = true; + effects.consume(code); + return domainInside; + } + + /** + * In domain, at potential trailing punctuation, that was not trailing. + * + * ```markdown + * > | https://example.com + * ^ + * ``` + * + * @type {State} + */ + function domainAtPunctuation(code) { + // There is an underscore in the last segment of the domain + if (code === 95) { + underscoreInLastSegment = true; + } + // Otherwise, it’s a `.`: save the last segment underscore in the + // penultimate segment slot. + else { + underscoreInLastLastSegment = underscoreInLastSegment; + underscoreInLastSegment = undefined; + } + effects.consume(code); + return domainInside; + } + + /** + * After domain. + * + * ```markdown + * > | https://example.com/a + * ^ + * ``` + * + * @type {State} */ + function domainAfter(code) { + // Note: that’s GH says a dot is needed, but it’s not true: + // + if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) { + return nok(code); + } + return ok(code); + } +} + +/** + * Path. + * + * ```markdown + * > | a https://example.org/stuff b + * ^^^^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizePath(effects, ok) { + let sizeOpen = 0; + let sizeClose = 0; + return pathInside; + + /** + * In path. + * + * ```markdown + * > | https://example.com/a + * ^^ + * ``` + * + * @type {State} + */ + function pathInside(code) { + if (code === 40) { + sizeOpen++; + effects.consume(code); + return pathInside; + } + + // To do: `markdown-rs` also needs this. + // If this is a paren, and there are less closings than openings, + // we don’t check for a trail. + if (code === 41 && sizeClose < sizeOpen) { + return pathAtPunctuation(code); + } + + // Check whether this trailing punctuation marker is optionally + // followed by more trailing markers, and then followed + // by an end. + if (code === 33 || code === 34 || code === 38 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 60 || code === 63 || code === 93 || code === 95 || code === 126) { + return effects.check(trail, ok, pathAtPunctuation)(code); + } + if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) { + return ok(code); + } + effects.consume(code); + return pathInside; + } + + /** + * In path, at potential trailing punctuation, that was not trailing. + * + * ```markdown + * > | https://example.com/a"b + * ^ + * ``` + * + * @type {State} + */ + function pathAtPunctuation(code) { + // Count closing parens. + if (code === 41) { + sizeClose++; + } + effects.consume(code); + return pathInside; + } +} + +/** + * Trail. + * + * This calls `ok` if this *is* the trail, followed by an end, which means + * the entire trail is not part of the link. + * It calls `nok` if this *is* part of the link. + * + * ```markdown + * > | https://example.com"). + * ^^^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeTrail(effects, ok, nok) { + return trail; + + /** + * In trail of domain or path. + * + * ```markdown + * > | https://example.com"). + * ^ + * ``` + * + * @type {State} + */ + function trail(code) { + // Regular trailing punctuation. + if (code === 33 || code === 34 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 63 || code === 95 || code === 126) { + effects.consume(code); + return trail; + } + + // `&` followed by one or more alphabeticals and then a `;`, is + // as a whole considered as trailing punctuation. + // In all other cases, it is considered as continuation of the URL. + if (code === 38) { + effects.consume(code); + return trailCharacterReferenceStart; + } + + // Needed because we allow literals after `[`, as we fix: + // . + // Check that it is not followed by `(` or `[`. + if (code === 93) { + effects.consume(code); + return trailBracketAfter; + } + if ( + // `<` is an end. + code === 60 || + // So is whitespace. + code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) { + return ok(code); + } + return nok(code); + } + + /** + * In trail, after `]`. + * + * > 👉 **Note**: this deviates from `cmark-gfm` to fix a bug. + * > See end of for more. + * + * ```markdown + * > | https://example.com]( + * ^ + * ``` + * + * @type {State} + */ + function trailBracketAfter(code) { + // Whitespace or something that could start a resource or reference is the end. + // Switch back to trail otherwise. + if (code === null || code === 40 || code === 91 || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) { + return ok(code); + } + return trail(code); + } + + /** + * In character-reference like trail, after `&`. + * + * ```markdown + * > | https://example.com&). + * ^ + * ``` + * + * @type {State} + */ + function trailCharacterReferenceStart(code) { + // When non-alpha, it’s not a trail. + return asciiAlpha(code) ? trailCharacterReferenceInside(code) : nok(code); + } + + /** + * In character-reference like trail. + * + * ```markdown + * > | https://example.com&). + * ^ + * ``` + * + * @type {State} + */ + function trailCharacterReferenceInside(code) { + // Switch back to trail if this is well-formed. + if (code === 59) { + effects.consume(code); + return trail; + } + if (asciiAlpha(code)) { + effects.consume(code); + return trailCharacterReferenceInside; + } + + // It’s not a trail. + return nok(code); + } +} + +/** + * Dot in email domain trail. + * + * This calls `ok` if this *is* the trail, followed by an end, which means + * the trail is not part of the link. + * It calls `nok` if this *is* part of the link. + * + * ```markdown + * > | contact@example.org. + * ^ + * ``` + * + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeEmailDomainDotTrail(effects, ok, nok) { + return start; + + /** + * Dot. + * + * ```markdown + * > | contact@example.org. + * ^ ^ + * ``` + * + * @type {State} + */ + function start(code) { + // Must be dot. + effects.consume(code); + return after; + } + + /** + * After dot. + * + * ```markdown + * > | contact@example.org. + * ^ ^ + * ``` + * + * @type {State} + */ + function after(code) { + // Not a trail if alphanumeric. + return asciiAlphanumeric(code) ? nok(code) : ok(code); + } +} + +/** + * See: + * . + * + * @type {Previous} + */ +function previousWww(code) { + return code === null || code === 40 || code === 42 || code === 95 || code === 91 || code === 93 || code === 126 || markdownLineEndingOrSpace(code); +} + +/** + * See: + * . + * + * @type {Previous} + */ +function previousProtocol(code) { + return !asciiAlpha(code); +} + +/** + * @this {TokenizeContext} + * @type {Previous} + */ +function previousEmail(code) { + // Do not allow a slash “inside” atext. + // The reference code is a bit weird, but that’s what it results in. + // Source: . + // Other than slash, every preceding character is allowed. + return !(code === 47 || gfmAtext(code)); +} + +/** + * @param {Code} code + * @returns {boolean} + */ +function gfmAtext(code) { + return code === 43 || code === 45 || code === 46 || code === 95 || asciiAlphanumeric(code); +} + +/** + * @param {Array} events + * @returns {boolean} + */ +function previousUnbalanced(events) { + let index = events.length; + let result = false; + while (index--) { + const token = events[index][1]; + if ((token.type === 'labelLink' || token.type === 'labelImage') && !token._balanced) { + result = true; + break; + } + + // If we’ve seen this token, and it was marked as not having any unbalanced + // bracket before it, we can exit. + if (token._gfmAutolinkLiteralWalkedInto) { + result = false; + break; + } + } + if (events.length > 0 && !result) { + // Mark the last token as “walked into” w/o finding + // anything. + events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true; + } + return result; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/license b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/license new file mode 100644 index 0000000000000000000000000000000000000000..39372356c47d0f6e070ff62d84c69f4f5e8c16eb --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/package.json b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2b1b6bd476485d6470ad8f2955c1a9bf3ad511ba --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/package.json @@ -0,0 +1,116 @@ +{ + "name": "micromark-extension-gfm-autolink-literal", + "version": "2.1.0", + "description": "micromark extension to support GFM autolink literals", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "literal", + "url", + "autolink", + "auto", + "link", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-autolink-literal", + "bugs": "https://github.com/micromark/micromark-extension-gfm-autolink-literal/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "create-gfm-fixtures": "^1.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "rehype": "^13.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "complexity": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-string-replace-all": "off" + }, + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "@typescript-eslint/consistent-type-definitions": 0 + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "no-await-in-loop": 0 + } + } + ] + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/readme.md b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..61651de01a7ae52b97ac8e9977ad3d6fcf651535 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-autolink-literal/readme.md @@ -0,0 +1,422 @@ +# micromark-extension-gfm-autolink-literal + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [literal autolinks][spec]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmAutolinkLiteral()`](#gfmautolinkliteral) + * [`gfmAutolinkLiteralHtml()`](#gfmautolinkliteralhtml) +* [Bugs](#bugs) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for the extra autolink syntax +enabled by GFM to [`micromark`][micromark]. + +GitHub employs different algorithms to autolink: one at parse time and one at +transform time (similar to how @mentions are done at transform time). +This difference can be observed because character references and escapes are +handled differently. +But also because issues/PRs/comments omit (perhaps by accident?) the second +algorithm for `www.`, `http://`, and `https://` links (but not for email links). + +As this is a syntax extension, it focuses on the first algorithm. +The second algorithm is performed by +[`mdast-util-gfm-autolink-literal`][mdast-util-gfm-autolink-literal]. +The `html` part of this micromark extension does not operate on an AST and hence +can’t perform the second algorithm. + +The implementation of autolink literal on github.com is currently buggy. +The bugs have been reported on [`cmark-gfm`][cmark-gfm]. +This micromark extension matches github.com except for its bugs. + +## When to use this + +This project is useful when you want to support autolink literals in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm] instead. + +When you need a syntax tree, combine this package with +[`mdast-util-gfm-autolink-literal`][mdast-util-gfm-autolink-literal]. + +All these packages are used in [`remark-gfm`][remark-gfm], which focusses on +making it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-autolink-literal +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmAutolinkLiteral, gfmAutolinkLiteralHtml} from 'https://esm.sh/micromark-extension-gfm-autolink-literal@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import { + gfmAutolinkLiteral, + gfmAutolinkLiteralHtml +} from 'micromark-extension-gfm-autolink-literal' + +const output = micromark('Just a URL: www.example.com.', { + extensions: [gfmAutolinkLiteral()], + htmlExtensions: [gfmAutolinkLiteralHtml()] +}) + +console.log(output) +``` + +Yields: + +```html +

    Just a URL: www.example.com.

    +``` + +## API + +This package exports the identifiers +[`gfmAutolinkLiteral`][api-gfm-autolink-literal] and +[`gfmAutolinkLiteralHtml`][api-gfm-autolink-literal-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfmAutolinkLiteral()` + +Create an extension for `micromark` to support GitHub autolink literal +syntax. + +###### Parameters + +Extension for `micromark` that can be passed in `extensions` to enable GFM +autolink literal syntax ([`Extension`][micromark-extension]). + +### `gfmAutolinkLiteralHtml()` + +Create an HTML extension for `micromark` to support GitHub autolink literal +when serializing to HTML. + +###### Parameters + +Extension for `micromark` that can be passed in `htmlExtensions` to support +GitHub autolink literal when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +## Bugs + +GitHub’s own algorithm to parse autolink literals contains three bugs. +A smaller bug is left unfixed in this project for consistency. +Two main bugs are not present in this project. +The issues relating to autolink literals are: + +* [GFM autolink extension (`www.`, `https?://` parts): links don’t work when + after bracket](https://github.com/github/cmark-gfm/issues/278)\ + fixed here ✅ +* [GFM autolink extension (`www.` part): uppercase does not match on + issues/PRs/comments](https://github.com/github/cmark-gfm/issues/280)\ + fixed here ✅ +* [GFM autolink extension (`www.` part): the word `www` + matches](https://github.com/github/cmark-gfm/issues/279)\ + present here for consistency + +## Authoring + +It is recommended to use labels, either with a resource or a definition, +instead of autolink literals, as those allow relative URLs and descriptive +text to explain the URL in prose. + +## HTML + +GFM autolink literals relate to the `` element in HTML. +See [*§ 4.5.1 The `a` element*][html-a] in the HTML spec for more info. +When an email autolink is used, the string `mailto:` is prepended when +generating the `href` attribute of the hyperlink. +When a www autolink is used, the string `http://` is prepended. + +## CSS + +As hyperlinks are the fundamental thing that makes the web, you will most +definitely have CSS for `a` elements already. +The same CSS can be used for autolink literals, too. + +GitHub itself does not apply interesting CSS to autolink literals. +For any link, it currently (June 2022) [uses][css]: + +```css +a { + background-color: transparent; + color: #58a6ff; + text-decoration: none; +} + +a:active, +a:hover { + outline-width: 0; +} + +a:hover { + text-decoration: underline; +} + +a:not([href]) { + color: inherit; + text-decoration: none; +} +``` + +## Syntax + +Autolink literals form with, roughly, the following BNF: + +```bnf +gfm_autolink_literal ::= gfm_protocol_autolink | gfm_www_autolink | gfm_email_autolink + +; Restriction: the code before must be `www_autolink_before`. +; Restriction: the code after `.` must not be eof. +www_autolink ::= 3('w' | 'W') '.' [domain [path]] +www_autolink_before ::= eof | eol | space_or_tab | '(' | '*' | '_' | '[' | ']' | '~' + +; Restriction: the code before must be `http_autolink_before`. +; Restriction: the code after the protocol must be `http_autolink_protocol_after`. +http_autolink ::= ('h' | 'H') 2('t' | 'T') ('p' | 'P') ['s' | 'S'] ':' 2'/' domain [path] +http_autolink_before ::= byte - ascii_alpha +http_autolink_protocol_after ::= byte - eof - eol - ascii_control - unicode_whitespace - ode_punctuation + +; Restriction: the code before must be `email_autolink_before`. +; Restriction: `ascii_digit` may not occur in the last label part of the label. +email_autolink ::= 1*('+' | '-' | '.' | '_' | ascii_alphanumeric) '@' 1*(1*label_segment l_dot_cont) 1*label_segment +email_autolink_before ::= byte - ascii_alpha - '/' + +; Restriction: `_` may not occur in the last two domain parts. +domain ::= 1*(url_ampt_cont | domain_punct_cont | '-' | byte - eof - ascii_control - ode_whitespace - unicode_punctuation) +; Restriction: must not be followed by `punct`. +domain_punct_cont ::= '.' | '_' +; Restriction: must not be followed by `char-ref`. +url_ampt_cont ::= '&' + +; Restriction: a counter `balance = 0` is increased for every `(`, and decreased for every `)`. +; Restriction: `)` must not be `paren_at_end`. +path ::= 1*(url_ampt_cont | path_punctuation_cont | '(' | ')' | byte - eof - eol - space_or_tab) +; Restriction: must not be followed by `punct`. +path_punctuation_cont ::= trailing_punctuation - '<' +; Restriction: must be followed by `punct` and `balance` must be less than `0`. +paren_at_end ::= ')' + +label_segment ::= label_dash_underscore_cont | ascii_alpha | ascii_digit +; Restriction: if followed by `punct`, the whole email autolink is invalid. +label_dash_underscore_cont ::= '-' | '_' +; Restriction: must not be followed by `punct`. +label_dot_cont ::= '.' + +punct ::= *trailing_punctuation ( byte - eof - eol - space_or_tab - '<' ) +char_ref ::= *ascii_alpha ';' path_end +trailing_punctuation ::= '!' | '"' | '\'' | ')' | '*' | ',' | '.' | ':' | ';' | '<' | '?' | '_' | '~' +``` + +The grammar for GFM autolink literal is very relaxed: basically anything +except for whitespace is allowed after a prefix. +To use whitespace characters and otherwise impossible characters, in URLs, +you can use percent encoding: + +```markdown +https://example.com/alpha%20bravo +``` + +Yields: + +```html +

    https://example.com/alpha%20bravo

    +``` + +There are several cases where incorrect encoding of URLs would, in other +languages, result in a parse error. +In markdown, there are no errors, and URLs are normalized. +In addition, many characters are percent encoded +([`sanitizeUri`][micromark-util-sanitize-uri]). +For example: + +```markdown +www.a👍b% +``` + +Yields: + +```html +

    www.a👍b%

    +``` + +There is a big difference between how www and protocol literals work +compared to how email literals work. +The first two are done when parsing, and work like anything else in +markdown. +But email literals are handled afterwards: when everything is parsed, we +look back at the events to figure out if there were email addresses. +This particularly affects how they interleave with character escapes and +character references. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-autolink-literal@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. +Unlike other links in CommonMark, which allow arbitrary protocols, this +construct always produces safe links. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-autolink-literal`][mdast-util-gfm-autolink-literal] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-autolink-literal/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-autolink-literal/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-autolink-literal.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-autolink-literal + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-autolink-literal.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-autolink-literal + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-autolink-literal + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-autolink-literal + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[micromark-util-sanitize-uri]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-sanitize-uri + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-gfm-autolink-literal]: https://github.com/syntax-tree/mdast-util-gfm-autolink-literal + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[spec]: https://github.github.com/gfm/#autolinks-extension- + +[html-a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element + +[css]: https://github.com/sindresorhus/github-markdown-css + +[cmark-gfm]: https://github.com/github/cmark-gfm + +[api-gfm-autolink-literal]: #gfmautolinkliteral + +[api-gfm-autolink-literal-html]: #gfmautolinkliteralhtml diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1be286871d3a5984a0f8fd12c9a1aef63e1d0af2 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/index.d.ts @@ -0,0 +1,164 @@ +export {gfmFootnoteHtml, defaultBackLabel} from './lib/html.js' +export {gfmFootnote} from './lib/syntax.js' + +/** + * Generate a back label dynamically. + * + * For the following markdown: + * + * ```markdown + * Alpha[^micromark], bravo[^micromark], and charlie[^remark]. + * + * [^remark]: things about remark + * [^micromark]: things about micromark + * ``` + * + * This function will be called with: + * + * * `0` and `0` for the backreference from `things about micromark` to + * `alpha`, as it is the first used definition, and the first call to it + * * `0` and `1` for the backreference from `things about micromark` to + * `bravo`, as it is the first used definition, and the second call to it + * * `1` and `0` for the backreference from `things about remark` to + * `charlie`, as it is the second used definition + * + * @param referenceIndex + * Index of the definition in the order that they are first referenced, + * 0-indexed. + * @param rereferenceIndex + * Index of calls to the same definition, 0-indexed. + * @returns + * Back label to use when linking back from definitions to their reference. + */ +export type BackLabelTemplate = ( + referenceIndex: number, + rereferenceIndex: number +) => string + +/** + * Configuration. + */ +export interface HtmlOptions { + /** + * Prefix to use before the `id` attribute on footnotes to prevent them from + * *clobbering* (default: `'user-content-'`). + * + * Pass `''` for trusted markdown and when you are careful with + * polyfilling. + * You could pass a different prefix. + * + * DOM clobbering is this: + * + * ```html + *

    + * + * ``` + * + * The above example shows that elements are made available by browsers, by + * their ID, on the `window` object. + * This is a security risk because you might be expecting some other variable + * at that place. + * It can also break polyfills. + * Using a prefix solves these problems. + */ + clobberPrefix?: string | null | undefined + /** + * Textual label to use for the footnotes section (default: `'Footnotes'`). + * + * Change it when the markdown is not in English. + * + * This label is typically hidden visually (assuming a `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass different attributes with the `labelAttributes` option. + */ + label?: string | null | undefined + /** + * Attributes to use on the footnote label (default: `'class="sr-only"'`). + * + * Change it to show the label and add other attributes. + * + * This label is typically hidden visually (assuming an `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass an empty string. + * You can also add different attributes. + * + * > 👉 **Note**: `id="footnote-label"` is always added, because footnote + * > calls use it with `aria-describedby` to provide an accessible label. + */ + labelAttributes?: string | null | undefined + /** + * HTML tag name to use for the footnote label element (default: `'h2'`). + * + * Change it to match your document structure. + * + * This label is typically hidden visually (assuming a `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass different attributes with the `labelAttributes` option. + */ + labelTagName?: string | null | undefined + /** + * Textual label to describe the backreference back to references (default: + * `defaultBackLabel`). + * + * The default value is: + * + * ```js + * function defaultBackLabel(referenceIndex, rereferenceIndex) { + * return ( + * 'Back to reference ' + + * (referenceIndex + 1) + + * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '') + * ) + * } + * ``` + * + * Change it when the markdown is not in English. + * + * This label is used in the `aria-label` attribute on each backreference + * (the `↩` links). + * It affects users of assistive technology. + */ + backLabel?: BackLabelTemplate | string | null | undefined +} + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Compile data. + */ + interface CompileData { + gfmFootnoteDefinitions?: Record + gfmFootnoteDefinitionStack?: Array + gfmFootnoteCallCounts?: Record + gfmFootnoteCallOrder?: Array + } + + /** + * Parse context. + */ + interface ParseContext { + gfmFootnotes?: Array + } + + /** + * Token types. + */ + interface TokenTypeMap { + gfmFootnoteCall: 'gfmFootnoteCall' + gfmFootnoteCallLabelMarker: 'gfmFootnoteCallLabelMarker' + gfmFootnoteCallMarker: 'gfmFootnoteCallMarker' + gfmFootnoteCallString: 'gfmFootnoteCallString' + gfmFootnoteDefinition: 'gfmFootnoteDefinition' + gfmFootnoteDefinitionIndent: 'gfmFootnoteDefinitionIndent' + gfmFootnoteDefinitionLabel: 'gfmFootnoteDefinitionLabel' + gfmFootnoteDefinitionLabelMarker: 'gfmFootnoteDefinitionLabelMarker' + gfmFootnoteDefinitionLabelString: 'gfmFootnoteDefinitionLabelString' + gfmFootnoteDefinitionMarker: 'gfmFootnoteDefinitionMarker' + gfmFootnoteDefinitionWhitespace: 'gfmFootnoteDefinitionWhitespace' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/index.js b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a399a81f450889e81de56b02e02c7b3b8d54e5cf --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/index.js @@ -0,0 +1,3 @@ +// Note: types are exported from `dev/index.d.ts`. +export {gfmFootnote} from './lib/syntax.js' +export {gfmFootnoteHtml, defaultBackLabel} from './lib/html.js' diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dbcd2a6c8435163363ee5ee95a301fd91258147d --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/html.d.ts @@ -0,0 +1,25 @@ +/** + * Generate the default label that GitHub uses on backreferences. + * + * @param {number} referenceIndex + * Index of the definition in the order that they are first referenced, + * 0-indexed. + * @param {number} rereferenceIndex + * Index of calls to the same definition, 0-indexed. + * @returns {string} + * Default label. + */ +export function defaultBackLabel(referenceIndex: number, rereferenceIndex: number): string; +/** + * Create an extension for `micromark` to support GFM footnotes when + * serializing to HTML. + * + * @param {Options | null | undefined} [options={}] + * Configuration (optional). + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM footnotes when serializing to HTML. + */ +export function gfmFootnoteHtml(options?: Options | null | undefined): HtmlExtension; +import type { HtmlOptions as Options } from 'micromark-extension-gfm-footnote'; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..d02ffed73da977fc66e30e8b47773ab0a47a6216 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/html.js @@ -0,0 +1,226 @@ +/** + * @import {HtmlOptions as Options} from 'micromark-extension-gfm-footnote' + * @import {HtmlExtension} from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {normalizeIdentifier} from 'micromark-util-normalize-identifier' +import {sanitizeUri} from 'micromark-util-sanitize-uri' + +const own = {}.hasOwnProperty + +/** @type {Options} */ +const emptyOptions = {} + +/** + * Generate the default label that GitHub uses on backreferences. + * + * @param {number} referenceIndex + * Index of the definition in the order that they are first referenced, + * 0-indexed. + * @param {number} rereferenceIndex + * Index of calls to the same definition, 0-indexed. + * @returns {string} + * Default label. + */ +export function defaultBackLabel(referenceIndex, rereferenceIndex) { + return ( + 'Back to reference ' + + (referenceIndex + 1) + + (rereferenceIndex > 1 ? '-' + rereferenceIndex : '') + ) +} + +/** + * Create an extension for `micromark` to support GFM footnotes when + * serializing to HTML. + * + * @param {Options | null | undefined} [options={}] + * Configuration (optional). + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM footnotes when serializing to HTML. + */ +export function gfmFootnoteHtml(options) { + const config = options || emptyOptions + const label = config.label || 'Footnotes' + const labelTagName = config.labelTagName || 'h2' + const labelAttributes = + config.labelAttributes === null || config.labelAttributes === undefined + ? 'class="sr-only"' + : config.labelAttributes + const backLabel = config.backLabel || defaultBackLabel + const clobberPrefix = + config.clobberPrefix === null || config.clobberPrefix === undefined + ? 'user-content-' + : config.clobberPrefix + return { + enter: { + gfmFootnoteDefinition() { + const stack = this.getData('tightStack') + stack.push(false) + }, + gfmFootnoteDefinitionLabelString() { + this.buffer() + }, + gfmFootnoteCallString() { + this.buffer() + } + }, + exit: { + gfmFootnoteDefinition() { + let definitions = this.getData('gfmFootnoteDefinitions') + const footnoteStack = this.getData('gfmFootnoteDefinitionStack') + assert(footnoteStack, 'expected `footnoteStack`') + const tightStack = this.getData('tightStack') + const current = footnoteStack.pop() + const value = this.resume() + + assert(current, 'expected to be in a footnote') + + if (!definitions) { + this.setData('gfmFootnoteDefinitions', (definitions = {})) + } + + if (!own.call(definitions, current)) definitions[current] = value + + tightStack.pop() + this.setData('slurpOneLineEnding', true) + // “Hack” to prevent a line ending from showing up if we’re in a definition in + // an empty list item. + this.setData('lastWasTag') + }, + gfmFootnoteDefinitionLabelString(token) { + let footnoteStack = this.getData('gfmFootnoteDefinitionStack') + + if (!footnoteStack) { + this.setData('gfmFootnoteDefinitionStack', (footnoteStack = [])) + } + + footnoteStack.push(normalizeIdentifier(this.sliceSerialize(token))) + this.resume() // Drop the label. + this.buffer() // Get ready for a value. + }, + gfmFootnoteCallString(token) { + let calls = this.getData('gfmFootnoteCallOrder') + let counts = this.getData('gfmFootnoteCallCounts') + const id = normalizeIdentifier(this.sliceSerialize(token)) + /** @type {number} */ + let counter + + this.resume() + + if (!calls) this.setData('gfmFootnoteCallOrder', (calls = [])) + if (!counts) this.setData('gfmFootnoteCallCounts', (counts = {})) + + const index = calls.indexOf(id) + const safeId = sanitizeUri(id.toLowerCase()) + + if (index === -1) { + calls.push(id) + counts[id] = 1 + counter = calls.length + } else { + counts[id]++ + counter = index + 1 + } + + const reuseCounter = counts[id] + + this.tag( + '' + + String(counter) + + '' + ) + }, + null() { + const calls = this.getData('gfmFootnoteCallOrder') || [] + const counts = this.getData('gfmFootnoteCallCounts') || {} + const definitions = this.getData('gfmFootnoteDefinitions') || {} + let index = -1 + + if (calls.length > 0) { + this.lineEndingIfNeeded() + this.tag( + '
    <' + + labelTagName + + ' id="footnote-label"' + + (labelAttributes ? ' ' + labelAttributes : '') + + '>' + ) + this.raw(this.encode(label)) + this.tag('') + this.lineEndingIfNeeded() + this.tag('
      ') + } + + while (++index < calls.length) { + // Called definitions are always defined. + const id = calls[index] + const safeId = sanitizeUri(id.toLowerCase()) + let referenceIndex = 0 + /** @type {Array} */ + const references = [] + + while (++referenceIndex <= counts[id]) { + references.push( + '↩' + + (referenceIndex > 1 + ? '' + referenceIndex + '' + : '') + + '' + ) + } + + const reference = references.join(' ') + let injected = false + + this.lineEndingIfNeeded() + this.tag('
    1. ') + this.lineEndingIfNeeded() + this.tag( + definitions[id].replace(/<\/p>(?:\r?\n|\r)?$/, function ($0) { + injected = true + return ' ' + reference + $0 + }) + ) + + if (!injected) { + this.lineEndingIfNeeded() + this.tag(reference) + } + + this.lineEndingIfNeeded() + this.tag('
    2. ') + } + + if (calls.length > 0) { + this.lineEndingIfNeeded() + this.tag('
    ') + this.lineEndingIfNeeded() + this.tag('
    ') + } + } + } + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0daa354cd943bd9eec26282f6e7e0ad2b79bca6 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/syntax.d.ts @@ -0,0 +1,9 @@ +/** + * Create an extension for `micromark` to enable GFM footnote syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to + * enable GFM footnote syntax. + */ +export function gfmFootnote(): Extension; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..caf14864b88a30af515a578a9536444d54c8a9f8 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/dev/lib/syntax.js @@ -0,0 +1,558 @@ +/** + * @import {Event, Exiter, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {blankLine} from 'micromark-core-commonmark' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEndingOrSpace} from 'micromark-util-character' +import {normalizeIdentifier} from 'micromark-util-normalize-identifier' +import {codes, constants, types} from 'micromark-util-symbol' + +const indent = {tokenize: tokenizeIndent, partial: true} + +// To do: micromark should support a `_hiddenGfmFootnoteSupport`, which only +// affects label start (image). +// That will let us drop `tokenizePotentialGfmFootnote*`. +// It currently has a `_hiddenFootnoteSupport`, which affects that and more. +// That can be removed when `micromark-extension-footnote` is archived. + +/** + * Create an extension for `micromark` to enable GFM footnote syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to + * enable GFM footnote syntax. + */ +export function gfmFootnote() { + /** @type {Extension} */ + return { + document: { + [codes.leftSquareBracket]: { + name: 'gfmFootnoteDefinition', + tokenize: tokenizeDefinitionStart, + continuation: {tokenize: tokenizeDefinitionContinuation}, + exit: gfmFootnoteDefinitionEnd + } + }, + text: { + [codes.leftSquareBracket]: { + name: 'gfmFootnoteCall', + tokenize: tokenizeGfmFootnoteCall + }, + [codes.rightSquareBracket]: { + name: 'gfmPotentialFootnoteCall', + add: 'after', + tokenize: tokenizePotentialGfmFootnoteCall, + resolveTo: resolveToPotentialGfmFootnoteCall + } + } + } +} + +// To do: remove after micromark update. +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizePotentialGfmFootnoteCall(effects, ok, nok) { + const self = this + let index = self.events.length + const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []) + /** @type {Token} */ + let labelStart + + // Find an opening. + while (index--) { + const token = self.events[index][1] + + if (token.type === types.labelImage) { + labelStart = token + break + } + + // Exit if we’ve walked far enough. + if ( + token.type === 'gfmFootnoteCall' || + token.type === types.labelLink || + token.type === types.label || + token.type === types.image || + token.type === types.link + ) { + break + } + } + + return start + + /** + * @type {State} + */ + function start(code) { + assert(code === codes.rightSquareBracket, 'expected `]`') + + if (!labelStart || !labelStart._balanced) { + return nok(code) + } + + const id = normalizeIdentifier( + self.sliceSerialize({start: labelStart.end, end: self.now()}) + ) + + if (id.codePointAt(0) !== codes.caret || !defined.includes(id.slice(1))) { + return nok(code) + } + + effects.enter('gfmFootnoteCallLabelMarker') + effects.consume(code) + effects.exit('gfmFootnoteCallLabelMarker') + return ok(code) + } +} + +// To do: remove after micromark update. +/** @type {Resolver} */ +function resolveToPotentialGfmFootnoteCall(events, context) { + let index = events.length + /** @type {Token | undefined} */ + let labelStart + + // Find an opening. + while (index--) { + if ( + events[index][1].type === types.labelImage && + events[index][0] === 'enter' + ) { + labelStart = events[index][1] + break + } + } + + assert(labelStart, 'expected `labelStart` to resolve') + + // Change the `labelImageMarker` to a `data`. + events[index + 1][1].type = types.data + events[index + 3][1].type = 'gfmFootnoteCallLabelMarker' + + // The whole (without `!`): + /** @type {Token} */ + const call = { + type: 'gfmFootnoteCall', + start: Object.assign({}, events[index + 3][1].start), + end: Object.assign({}, events[events.length - 1][1].end) + } + // The `^` marker + /** @type {Token} */ + const marker = { + type: 'gfmFootnoteCallMarker', + start: Object.assign({}, events[index + 3][1].end), + end: Object.assign({}, events[index + 3][1].end) + } + // Increment the end 1 character. + marker.end.column++ + marker.end.offset++ + marker.end._bufferIndex++ + /** @type {Token} */ + const string = { + type: 'gfmFootnoteCallString', + start: Object.assign({}, marker.end), + end: Object.assign({}, events[events.length - 1][1].start) + } + /** @type {Token} */ + const chunk = { + type: types.chunkString, + contentType: 'string', + start: Object.assign({}, string.start), + end: Object.assign({}, string.end) + } + + /** @type {Array} */ + const replacement = [ + // Take the `labelImageMarker` (now `data`, the `!`) + events[index + 1], + events[index + 2], + ['enter', call, context], + // The `[` + events[index + 3], + events[index + 4], + // The `^`. + ['enter', marker, context], + ['exit', marker, context], + // Everything in between. + ['enter', string, context], + ['enter', chunk, context], + ['exit', chunk, context], + ['exit', string, context], + // The ending (`]`, properly parsed and labelled). + events[events.length - 2], + events[events.length - 1], + ['exit', call, context] + ] + + events.splice(index, events.length - index + 1, ...replacement) + + return events +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeGfmFootnoteCall(effects, ok, nok) { + const self = this + const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []) + let size = 0 + /** @type {boolean} */ + let data + + // Note: the implementation of `markdown-rs` is different, because it houses + // core *and* extensions in one project. + // Therefore, it can include footnote logic inside `label-end`. + // We can’t do that, but luckily, we can parse footnotes in a simpler way than + // needed for labels. + return start + + /** + * Start of footnote label. + * + * ```markdown + * > | a [^b] c + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter('gfmFootnoteCall') + effects.enter('gfmFootnoteCallLabelMarker') + effects.consume(code) + effects.exit('gfmFootnoteCallLabelMarker') + return callStart + } + + /** + * After `[`, at `^`. + * + * ```markdown + * > | a [^b] c + * ^ + * ``` + * + * @type {State} + */ + function callStart(code) { + if (code !== codes.caret) return nok(code) + + effects.enter('gfmFootnoteCallMarker') + effects.consume(code) + effects.exit('gfmFootnoteCallMarker') + effects.enter('gfmFootnoteCallString') + effects.enter('chunkString').contentType = 'string' + return callData + } + + /** + * In label. + * + * ```markdown + * > | a [^b] c + * ^ + * ``` + * + * @type {State} + */ + function callData(code) { + if ( + // Too long. + size > constants.linkReferenceSizeMax || + // Closing brace with nothing. + (code === codes.rightSquareBracket && !data) || + // Space or tab is not supported by GFM for some reason. + // `\n` and `[` not being supported makes sense. + code === codes.eof || + code === codes.leftSquareBracket || + markdownLineEndingOrSpace(code) + ) { + return nok(code) + } + + if (code === codes.rightSquareBracket) { + effects.exit('chunkString') + const token = effects.exit('gfmFootnoteCallString') + + if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) { + return nok(code) + } + + effects.enter('gfmFootnoteCallLabelMarker') + effects.consume(code) + effects.exit('gfmFootnoteCallLabelMarker') + effects.exit('gfmFootnoteCall') + return ok + } + + if (!markdownLineEndingOrSpace(code)) { + data = true + } + + size++ + effects.consume(code) + return code === codes.backslash ? callEscape : callData + } + + /** + * On character after escape. + * + * ```markdown + * > | a [^b\c] d + * ^ + * ``` + * + * @type {State} + */ + function callEscape(code) { + if ( + code === codes.leftSquareBracket || + code === codes.backslash || + code === codes.rightSquareBracket + ) { + effects.consume(code) + size++ + return callData + } + + return callData(code) + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeDefinitionStart(effects, ok, nok) { + const self = this + const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []) + /** @type {string} */ + let identifier + let size = 0 + /** @type {boolean | undefined} */ + let data + + return start + + /** + * Start of GFM footnote definition. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter('gfmFootnoteDefinition')._container = true + effects.enter('gfmFootnoteDefinitionLabel') + effects.enter('gfmFootnoteDefinitionLabelMarker') + effects.consume(code) + effects.exit('gfmFootnoteDefinitionLabelMarker') + return labelAtMarker + } + + /** + * In label, at caret. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function labelAtMarker(code) { + if (code === codes.caret) { + effects.enter('gfmFootnoteDefinitionMarker') + effects.consume(code) + effects.exit('gfmFootnoteDefinitionMarker') + effects.enter('gfmFootnoteDefinitionLabelString') + effects.enter('chunkString').contentType = 'string' + return labelInside + } + + return nok(code) + } + + /** + * In label. + * + * > 👉 **Note**: `cmark-gfm` prevents whitespace from occurring in footnote + * > definition labels. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function labelInside(code) { + if ( + // Too long. + size > constants.linkReferenceSizeMax || + // Closing brace with nothing. + (code === codes.rightSquareBracket && !data) || + // Space or tab is not supported by GFM for some reason. + // `\n` and `[` not being supported makes sense. + code === codes.eof || + code === codes.leftSquareBracket || + markdownLineEndingOrSpace(code) + ) { + return nok(code) + } + + if (code === codes.rightSquareBracket) { + effects.exit('chunkString') + const token = effects.exit('gfmFootnoteDefinitionLabelString') + identifier = normalizeIdentifier(self.sliceSerialize(token)) + effects.enter('gfmFootnoteDefinitionLabelMarker') + effects.consume(code) + effects.exit('gfmFootnoteDefinitionLabelMarker') + effects.exit('gfmFootnoteDefinitionLabel') + return labelAfter + } + + if (!markdownLineEndingOrSpace(code)) { + data = true + } + + size++ + effects.consume(code) + return code === codes.backslash ? labelEscape : labelInside + } + + /** + * After `\`, at a special character. + * + * > 👉 **Note**: `cmark-gfm` currently does not support escaped brackets: + * > + * + * ```markdown + * > | [^a\*b]: c + * ^ + * ``` + * + * @type {State} + */ + function labelEscape(code) { + if ( + code === codes.leftSquareBracket || + code === codes.backslash || + code === codes.rightSquareBracket + ) { + effects.consume(code) + size++ + return labelInside + } + + return labelInside(code) + } + + /** + * After definition label. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function labelAfter(code) { + if (code === codes.colon) { + effects.enter('definitionMarker') + effects.consume(code) + effects.exit('definitionMarker') + + if (!defined.includes(identifier)) { + defined.push(identifier) + } + + // Any whitespace after the marker is eaten, forming indented code + // is not possible. + // No space is also fine, just like a block quote marker. + return factorySpace( + effects, + whitespaceAfter, + 'gfmFootnoteDefinitionWhitespace' + ) + } + + return nok(code) + } + + /** + * After definition prefix. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function whitespaceAfter(code) { + // `markdown-rs` has a wrapping token for the prefix that is closed here. + return ok(code) + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeDefinitionContinuation(effects, ok, nok) { + /// Start of footnote definition continuation. + /// + /// ```markdown + /// | [^a]: b + /// > | c + /// ^ + /// ``` + // + // Either a blank line, which is okay, or an indented thing. + return effects.check(blankLine, ok, effects.attempt(indent, ok, nok)) +} + +/** @type {Exiter} */ +function gfmFootnoteDefinitionEnd(effects) { + effects.exit('gfmFootnoteDefinition') +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeIndent(effects, ok, nok) { + const self = this + + return factorySpace( + effects, + afterPrefix, + 'gfmFootnoteDefinitionIndent', + constants.tabSize + 1 + ) + + /** + * @type {State} + */ + function afterPrefix(code) { + const tail = self.events[self.events.length - 1] + return tail && + tail[1].type === 'gfmFootnoteDefinitionIndent' && + tail[2].sliceSerialize(tail[1], true).length === constants.tabSize + ? ok(code) + : nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-footnote/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1be286871d3a5984a0f8fd12c9a1aef63e1d0af2 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/index.d.ts @@ -0,0 +1,164 @@ +export {gfmFootnoteHtml, defaultBackLabel} from './lib/html.js' +export {gfmFootnote} from './lib/syntax.js' + +/** + * Generate a back label dynamically. + * + * For the following markdown: + * + * ```markdown + * Alpha[^micromark], bravo[^micromark], and charlie[^remark]. + * + * [^remark]: things about remark + * [^micromark]: things about micromark + * ``` + * + * This function will be called with: + * + * * `0` and `0` for the backreference from `things about micromark` to + * `alpha`, as it is the first used definition, and the first call to it + * * `0` and `1` for the backreference from `things about micromark` to + * `bravo`, as it is the first used definition, and the second call to it + * * `1` and `0` for the backreference from `things about remark` to + * `charlie`, as it is the second used definition + * + * @param referenceIndex + * Index of the definition in the order that they are first referenced, + * 0-indexed. + * @param rereferenceIndex + * Index of calls to the same definition, 0-indexed. + * @returns + * Back label to use when linking back from definitions to their reference. + */ +export type BackLabelTemplate = ( + referenceIndex: number, + rereferenceIndex: number +) => string + +/** + * Configuration. + */ +export interface HtmlOptions { + /** + * Prefix to use before the `id` attribute on footnotes to prevent them from + * *clobbering* (default: `'user-content-'`). + * + * Pass `''` for trusted markdown and when you are careful with + * polyfilling. + * You could pass a different prefix. + * + * DOM clobbering is this: + * + * ```html + *

    + * + * ``` + * + * The above example shows that elements are made available by browsers, by + * their ID, on the `window` object. + * This is a security risk because you might be expecting some other variable + * at that place. + * It can also break polyfills. + * Using a prefix solves these problems. + */ + clobberPrefix?: string | null | undefined + /** + * Textual label to use for the footnotes section (default: `'Footnotes'`). + * + * Change it when the markdown is not in English. + * + * This label is typically hidden visually (assuming a `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass different attributes with the `labelAttributes` option. + */ + label?: string | null | undefined + /** + * Attributes to use on the footnote label (default: `'class="sr-only"'`). + * + * Change it to show the label and add other attributes. + * + * This label is typically hidden visually (assuming an `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass an empty string. + * You can also add different attributes. + * + * > 👉 **Note**: `id="footnote-label"` is always added, because footnote + * > calls use it with `aria-describedby` to provide an accessible label. + */ + labelAttributes?: string | null | undefined + /** + * HTML tag name to use for the footnote label element (default: `'h2'`). + * + * Change it to match your document structure. + * + * This label is typically hidden visually (assuming a `sr-only` CSS class + * is defined that does that) and so affects screen readers only. + * If you do have such a class, but want to show this section to everyone, + * pass different attributes with the `labelAttributes` option. + */ + labelTagName?: string | null | undefined + /** + * Textual label to describe the backreference back to references (default: + * `defaultBackLabel`). + * + * The default value is: + * + * ```js + * function defaultBackLabel(referenceIndex, rereferenceIndex) { + * return ( + * 'Back to reference ' + + * (referenceIndex + 1) + + * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '') + * ) + * } + * ``` + * + * Change it when the markdown is not in English. + * + * This label is used in the `aria-label` attribute on each backreference + * (the `↩` links). + * It affects users of assistive technology. + */ + backLabel?: BackLabelTemplate | string | null | undefined +} + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Compile data. + */ + interface CompileData { + gfmFootnoteDefinitions?: Record + gfmFootnoteDefinitionStack?: Array + gfmFootnoteCallCounts?: Record + gfmFootnoteCallOrder?: Array + } + + /** + * Parse context. + */ + interface ParseContext { + gfmFootnotes?: Array + } + + /** + * Token types. + */ + interface TokenTypeMap { + gfmFootnoteCall: 'gfmFootnoteCall' + gfmFootnoteCallLabelMarker: 'gfmFootnoteCallLabelMarker' + gfmFootnoteCallMarker: 'gfmFootnoteCallMarker' + gfmFootnoteCallString: 'gfmFootnoteCallString' + gfmFootnoteDefinition: 'gfmFootnoteDefinition' + gfmFootnoteDefinitionIndent: 'gfmFootnoteDefinitionIndent' + gfmFootnoteDefinitionLabel: 'gfmFootnoteDefinitionLabel' + gfmFootnoteDefinitionLabelMarker: 'gfmFootnoteDefinitionLabelMarker' + gfmFootnoteDefinitionLabelString: 'gfmFootnoteDefinitionLabelString' + gfmFootnoteDefinitionMarker: 'gfmFootnoteDefinitionMarker' + gfmFootnoteDefinitionWhitespace: 'gfmFootnoteDefinitionWhitespace' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/index.js b/tools/ui/node_modules/micromark-extension-gfm-footnote/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b210cb3dae964bfce62711003eed842d481528e1 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/index.js @@ -0,0 +1,3 @@ +// Note: types are exported from `dev/index.d.ts`. +export { gfmFootnote } from './lib/syntax.js'; +export { gfmFootnoteHtml, defaultBackLabel } from './lib/html.js'; \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dbcd2a6c8435163363ee5ee95a301fd91258147d --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/html.d.ts @@ -0,0 +1,25 @@ +/** + * Generate the default label that GitHub uses on backreferences. + * + * @param {number} referenceIndex + * Index of the definition in the order that they are first referenced, + * 0-indexed. + * @param {number} rereferenceIndex + * Index of calls to the same definition, 0-indexed. + * @returns {string} + * Default label. + */ +export function defaultBackLabel(referenceIndex: number, rereferenceIndex: number): string; +/** + * Create an extension for `micromark` to support GFM footnotes when + * serializing to HTML. + * + * @param {Options | null | undefined} [options={}] + * Configuration (optional). + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM footnotes when serializing to HTML. + */ +export function gfmFootnoteHtml(options?: Options | null | undefined): HtmlExtension; +import type { HtmlOptions as Options } from 'micromark-extension-gfm-footnote'; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..815e4021be5e4ad6e388186f1ca1f7f466a551bd --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/html.js @@ -0,0 +1,154 @@ +/** + * @import {HtmlOptions as Options} from 'micromark-extension-gfm-footnote' + * @import {HtmlExtension} from 'micromark-util-types' + */ + +import { normalizeIdentifier } from 'micromark-util-normalize-identifier'; +import { sanitizeUri } from 'micromark-util-sanitize-uri'; +const own = {}.hasOwnProperty; + +/** @type {Options} */ +const emptyOptions = {}; + +/** + * Generate the default label that GitHub uses on backreferences. + * + * @param {number} referenceIndex + * Index of the definition in the order that they are first referenced, + * 0-indexed. + * @param {number} rereferenceIndex + * Index of calls to the same definition, 0-indexed. + * @returns {string} + * Default label. + */ +export function defaultBackLabel(referenceIndex, rereferenceIndex) { + return 'Back to reference ' + (referenceIndex + 1) + (rereferenceIndex > 1 ? '-' + rereferenceIndex : ''); +} + +/** + * Create an extension for `micromark` to support GFM footnotes when + * serializing to HTML. + * + * @param {Options | null | undefined} [options={}] + * Configuration (optional). + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM footnotes when serializing to HTML. + */ +export function gfmFootnoteHtml(options) { + const config = options || emptyOptions; + const label = config.label || 'Footnotes'; + const labelTagName = config.labelTagName || 'h2'; + const labelAttributes = config.labelAttributes === null || config.labelAttributes === undefined ? 'class="sr-only"' : config.labelAttributes; + const backLabel = config.backLabel || defaultBackLabel; + const clobberPrefix = config.clobberPrefix === null || config.clobberPrefix === undefined ? 'user-content-' : config.clobberPrefix; + return { + enter: { + gfmFootnoteDefinition() { + const stack = this.getData('tightStack'); + stack.push(false); + }, + gfmFootnoteDefinitionLabelString() { + this.buffer(); + }, + gfmFootnoteCallString() { + this.buffer(); + } + }, + exit: { + gfmFootnoteDefinition() { + let definitions = this.getData('gfmFootnoteDefinitions'); + const footnoteStack = this.getData('gfmFootnoteDefinitionStack'); + const tightStack = this.getData('tightStack'); + const current = footnoteStack.pop(); + const value = this.resume(); + if (!definitions) { + this.setData('gfmFootnoteDefinitions', definitions = {}); + } + if (!own.call(definitions, current)) definitions[current] = value; + tightStack.pop(); + this.setData('slurpOneLineEnding', true); + // “Hack” to prevent a line ending from showing up if we’re in a definition in + // an empty list item. + this.setData('lastWasTag'); + }, + gfmFootnoteDefinitionLabelString(token) { + let footnoteStack = this.getData('gfmFootnoteDefinitionStack'); + if (!footnoteStack) { + this.setData('gfmFootnoteDefinitionStack', footnoteStack = []); + } + footnoteStack.push(normalizeIdentifier(this.sliceSerialize(token))); + this.resume(); // Drop the label. + this.buffer(); // Get ready for a value. + }, + gfmFootnoteCallString(token) { + let calls = this.getData('gfmFootnoteCallOrder'); + let counts = this.getData('gfmFootnoteCallCounts'); + const id = normalizeIdentifier(this.sliceSerialize(token)); + /** @type {number} */ + let counter; + this.resume(); + if (!calls) this.setData('gfmFootnoteCallOrder', calls = []); + if (!counts) this.setData('gfmFootnoteCallCounts', counts = {}); + const index = calls.indexOf(id); + const safeId = sanitizeUri(id.toLowerCase()); + if (index === -1) { + calls.push(id); + counts[id] = 1; + counter = calls.length; + } else { + counts[id]++; + counter = index + 1; + } + const reuseCounter = counts[id]; + this.tag('' + String(counter) + ''); + }, + null() { + const calls = this.getData('gfmFootnoteCallOrder') || []; + const counts = this.getData('gfmFootnoteCallCounts') || {}; + const definitions = this.getData('gfmFootnoteDefinitions') || {}; + let index = -1; + if (calls.length > 0) { + this.lineEndingIfNeeded(); + this.tag('
    <' + labelTagName + ' id="footnote-label"' + (labelAttributes ? ' ' + labelAttributes : '') + '>'); + this.raw(this.encode(label)); + this.tag(''); + this.lineEndingIfNeeded(); + this.tag('
      '); + } + while (++index < calls.length) { + // Called definitions are always defined. + const id = calls[index]; + const safeId = sanitizeUri(id.toLowerCase()); + let referenceIndex = 0; + /** @type {Array} */ + const references = []; + while (++referenceIndex <= counts[id]) { + references.push('↩' + (referenceIndex > 1 ? '' + referenceIndex + '' : '') + ''); + } + const reference = references.join(' '); + let injected = false; + this.lineEndingIfNeeded(); + this.tag('
    1. '); + this.lineEndingIfNeeded(); + this.tag(definitions[id].replace(/<\/p>(?:\r?\n|\r)?$/, function ($0) { + injected = true; + return ' ' + reference + $0; + })); + if (!injected) { + this.lineEndingIfNeeded(); + this.tag(reference); + } + this.lineEndingIfNeeded(); + this.tag('
    2. '); + } + if (calls.length > 0) { + this.lineEndingIfNeeded(); + this.tag('
    '); + this.lineEndingIfNeeded(); + this.tag('
    '); + } + } + } + }; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0daa354cd943bd9eec26282f6e7e0ad2b79bca6 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/syntax.d.ts @@ -0,0 +1,9 @@ +/** + * Create an extension for `micromark` to enable GFM footnote syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to + * enable GFM footnote syntax. + */ +export function gfmFootnote(): Extension; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..5a8b1af5ea41c63aa4185d5b0afe143a894c938b --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/lib/syntax.js @@ -0,0 +1,485 @@ +/** + * @import {Event, Exiter, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import { blankLine } from 'micromark-core-commonmark'; +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEndingOrSpace } from 'micromark-util-character'; +import { normalizeIdentifier } from 'micromark-util-normalize-identifier'; +const indent = { + tokenize: tokenizeIndent, + partial: true +}; + +// To do: micromark should support a `_hiddenGfmFootnoteSupport`, which only +// affects label start (image). +// That will let us drop `tokenizePotentialGfmFootnote*`. +// It currently has a `_hiddenFootnoteSupport`, which affects that and more. +// That can be removed when `micromark-extension-footnote` is archived. + +/** + * Create an extension for `micromark` to enable GFM footnote syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to + * enable GFM footnote syntax. + */ +export function gfmFootnote() { + /** @type {Extension} */ + return { + document: { + [91]: { + name: 'gfmFootnoteDefinition', + tokenize: tokenizeDefinitionStart, + continuation: { + tokenize: tokenizeDefinitionContinuation + }, + exit: gfmFootnoteDefinitionEnd + } + }, + text: { + [91]: { + name: 'gfmFootnoteCall', + tokenize: tokenizeGfmFootnoteCall + }, + [93]: { + name: 'gfmPotentialFootnoteCall', + add: 'after', + tokenize: tokenizePotentialGfmFootnoteCall, + resolveTo: resolveToPotentialGfmFootnoteCall + } + } + }; +} + +// To do: remove after micromark update. +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizePotentialGfmFootnoteCall(effects, ok, nok) { + const self = this; + let index = self.events.length; + const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []); + /** @type {Token} */ + let labelStart; + + // Find an opening. + while (index--) { + const token = self.events[index][1]; + if (token.type === "labelImage") { + labelStart = token; + break; + } + + // Exit if we’ve walked far enough. + if (token.type === 'gfmFootnoteCall' || token.type === "labelLink" || token.type === "label" || token.type === "image" || token.type === "link") { + break; + } + } + return start; + + /** + * @type {State} + */ + function start(code) { + if (!labelStart || !labelStart._balanced) { + return nok(code); + } + const id = normalizeIdentifier(self.sliceSerialize({ + start: labelStart.end, + end: self.now() + })); + if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) { + return nok(code); + } + effects.enter('gfmFootnoteCallLabelMarker'); + effects.consume(code); + effects.exit('gfmFootnoteCallLabelMarker'); + return ok(code); + } +} + +// To do: remove after micromark update. +/** @type {Resolver} */ +function resolveToPotentialGfmFootnoteCall(events, context) { + let index = events.length; + /** @type {Token | undefined} */ + let labelStart; + + // Find an opening. + while (index--) { + if (events[index][1].type === "labelImage" && events[index][0] === 'enter') { + labelStart = events[index][1]; + break; + } + } + // Change the `labelImageMarker` to a `data`. + events[index + 1][1].type = "data"; + events[index + 3][1].type = 'gfmFootnoteCallLabelMarker'; + + // The whole (without `!`): + /** @type {Token} */ + const call = { + type: 'gfmFootnoteCall', + start: Object.assign({}, events[index + 3][1].start), + end: Object.assign({}, events[events.length - 1][1].end) + }; + // The `^` marker + /** @type {Token} */ + const marker = { + type: 'gfmFootnoteCallMarker', + start: Object.assign({}, events[index + 3][1].end), + end: Object.assign({}, events[index + 3][1].end) + }; + // Increment the end 1 character. + marker.end.column++; + marker.end.offset++; + marker.end._bufferIndex++; + /** @type {Token} */ + const string = { + type: 'gfmFootnoteCallString', + start: Object.assign({}, marker.end), + end: Object.assign({}, events[events.length - 1][1].start) + }; + /** @type {Token} */ + const chunk = { + type: "chunkString", + contentType: 'string', + start: Object.assign({}, string.start), + end: Object.assign({}, string.end) + }; + + /** @type {Array} */ + const replacement = [ + // Take the `labelImageMarker` (now `data`, the `!`) + events[index + 1], events[index + 2], ['enter', call, context], + // The `[` + events[index + 3], events[index + 4], + // The `^`. + ['enter', marker, context], ['exit', marker, context], + // Everything in between. + ['enter', string, context], ['enter', chunk, context], ['exit', chunk, context], ['exit', string, context], + // The ending (`]`, properly parsed and labelled). + events[events.length - 2], events[events.length - 1], ['exit', call, context]]; + events.splice(index, events.length - index + 1, ...replacement); + return events; +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeGfmFootnoteCall(effects, ok, nok) { + const self = this; + const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []); + let size = 0; + /** @type {boolean} */ + let data; + + // Note: the implementation of `markdown-rs` is different, because it houses + // core *and* extensions in one project. + // Therefore, it can include footnote logic inside `label-end`. + // We can’t do that, but luckily, we can parse footnotes in a simpler way than + // needed for labels. + return start; + + /** + * Start of footnote label. + * + * ```markdown + * > | a [^b] c + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter('gfmFootnoteCall'); + effects.enter('gfmFootnoteCallLabelMarker'); + effects.consume(code); + effects.exit('gfmFootnoteCallLabelMarker'); + return callStart; + } + + /** + * After `[`, at `^`. + * + * ```markdown + * > | a [^b] c + * ^ + * ``` + * + * @type {State} + */ + function callStart(code) { + if (code !== 94) return nok(code); + effects.enter('gfmFootnoteCallMarker'); + effects.consume(code); + effects.exit('gfmFootnoteCallMarker'); + effects.enter('gfmFootnoteCallString'); + effects.enter('chunkString').contentType = 'string'; + return callData; + } + + /** + * In label. + * + * ```markdown + * > | a [^b] c + * ^ + * ``` + * + * @type {State} + */ + function callData(code) { + if ( + // Too long. + size > 999 || + // Closing brace with nothing. + code === 93 && !data || + // Space or tab is not supported by GFM for some reason. + // `\n` and `[` not being supported makes sense. + code === null || code === 91 || markdownLineEndingOrSpace(code)) { + return nok(code); + } + if (code === 93) { + effects.exit('chunkString'); + const token = effects.exit('gfmFootnoteCallString'); + if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) { + return nok(code); + } + effects.enter('gfmFootnoteCallLabelMarker'); + effects.consume(code); + effects.exit('gfmFootnoteCallLabelMarker'); + effects.exit('gfmFootnoteCall'); + return ok; + } + if (!markdownLineEndingOrSpace(code)) { + data = true; + } + size++; + effects.consume(code); + return code === 92 ? callEscape : callData; + } + + /** + * On character after escape. + * + * ```markdown + * > | a [^b\c] d + * ^ + * ``` + * + * @type {State} + */ + function callEscape(code) { + if (code === 91 || code === 92 || code === 93) { + effects.consume(code); + size++; + return callData; + } + return callData(code); + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeDefinitionStart(effects, ok, nok) { + const self = this; + const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []); + /** @type {string} */ + let identifier; + let size = 0; + /** @type {boolean | undefined} */ + let data; + return start; + + /** + * Start of GFM footnote definition. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter('gfmFootnoteDefinition')._container = true; + effects.enter('gfmFootnoteDefinitionLabel'); + effects.enter('gfmFootnoteDefinitionLabelMarker'); + effects.consume(code); + effects.exit('gfmFootnoteDefinitionLabelMarker'); + return labelAtMarker; + } + + /** + * In label, at caret. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function labelAtMarker(code) { + if (code === 94) { + effects.enter('gfmFootnoteDefinitionMarker'); + effects.consume(code); + effects.exit('gfmFootnoteDefinitionMarker'); + effects.enter('gfmFootnoteDefinitionLabelString'); + effects.enter('chunkString').contentType = 'string'; + return labelInside; + } + return nok(code); + } + + /** + * In label. + * + * > 👉 **Note**: `cmark-gfm` prevents whitespace from occurring in footnote + * > definition labels. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function labelInside(code) { + if ( + // Too long. + size > 999 || + // Closing brace with nothing. + code === 93 && !data || + // Space or tab is not supported by GFM for some reason. + // `\n` and `[` not being supported makes sense. + code === null || code === 91 || markdownLineEndingOrSpace(code)) { + return nok(code); + } + if (code === 93) { + effects.exit('chunkString'); + const token = effects.exit('gfmFootnoteDefinitionLabelString'); + identifier = normalizeIdentifier(self.sliceSerialize(token)); + effects.enter('gfmFootnoteDefinitionLabelMarker'); + effects.consume(code); + effects.exit('gfmFootnoteDefinitionLabelMarker'); + effects.exit('gfmFootnoteDefinitionLabel'); + return labelAfter; + } + if (!markdownLineEndingOrSpace(code)) { + data = true; + } + size++; + effects.consume(code); + return code === 92 ? labelEscape : labelInside; + } + + /** + * After `\`, at a special character. + * + * > 👉 **Note**: `cmark-gfm` currently does not support escaped brackets: + * > + * + * ```markdown + * > | [^a\*b]: c + * ^ + * ``` + * + * @type {State} + */ + function labelEscape(code) { + if (code === 91 || code === 92 || code === 93) { + effects.consume(code); + size++; + return labelInside; + } + return labelInside(code); + } + + /** + * After definition label. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function labelAfter(code) { + if (code === 58) { + effects.enter('definitionMarker'); + effects.consume(code); + effects.exit('definitionMarker'); + if (!defined.includes(identifier)) { + defined.push(identifier); + } + + // Any whitespace after the marker is eaten, forming indented code + // is not possible. + // No space is also fine, just like a block quote marker. + return factorySpace(effects, whitespaceAfter, 'gfmFootnoteDefinitionWhitespace'); + } + return nok(code); + } + + /** + * After definition prefix. + * + * ```markdown + * > | [^a]: b + * ^ + * ``` + * + * @type {State} + */ + function whitespaceAfter(code) { + // `markdown-rs` has a wrapping token for the prefix that is closed here. + return ok(code); + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeDefinitionContinuation(effects, ok, nok) { + /// Start of footnote definition continuation. + /// + /// ```markdown + /// | [^a]: b + /// > | c + /// ^ + /// ``` + // + // Either a blank line, which is okay, or an indented thing. + return effects.check(blankLine, ok, effects.attempt(indent, ok, nok)); +} + +/** @type {Exiter} */ +function gfmFootnoteDefinitionEnd(effects) { + effects.exit('gfmFootnoteDefinition'); +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeIndent(effects, ok, nok) { + const self = this; + return factorySpace(effects, afterPrefix, 'gfmFootnoteDefinitionIndent', 4 + 1); + + /** + * @type {State} + */ + function afterPrefix(code) { + const tail = self.events[self.events.length - 1]; + return tail && tail[1].type === 'gfmFootnoteDefinitionIndent' && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok(code) : nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/license b/tools/ui/node_modules/micromark-extension-gfm-footnote/license new file mode 100644 index 0000000000000000000000000000000000000000..f4fb31fe44ababc8c433e7d44eca5f8169e27e00 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2021 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/package.json b/tools/ui/node_modules/micromark-extension-gfm-footnote/package.json new file mode 100644 index 0000000000000000000000000000000000000000..bcbf3e6c464b6b80e1af89338b5a0dfc43970eff --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/package.json @@ -0,0 +1,132 @@ +{ + "name": "micromark-extension-gfm-footnote", + "version": "2.1.0", + "description": "micromark extension to support GFM footnotes", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "gfm", + "footnote", + "note", + "definition", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-footnote", + "bugs": "https://github.com/micromark/micromark-extension-gfm-footnote/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "create-gfm-fixtures": "^1.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-string-replace-all": "off" + }, + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "no-await-in-loop": 0 + } + } + ] + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-footnote/readme.md b/tools/ui/node_modules/micromark-extension-gfm-footnote/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..4c446ae20baab5e2775948fadb6bcf3347443ac2 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-footnote/readme.md @@ -0,0 +1,656 @@ +# micromark-extension-gfm-footnote + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [footnotes][post]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`defaultBackLabel(referenceIndex, rereferenceIndex)`](#defaultbacklabelreferenceindex-rereferenceindex) + * [`gfmFootnote()`](#gfmfootnote) + * [`gfmFootnoteHtml(options?)`](#gfmfootnotehtmloptions) + * [`BackLabelTemplate`](#backlabeltemplate) + * [`HtmlOptions`](#htmloptions) +* [Bugs](#bugs) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for footnotes as enabled by +GFM to [`micromark`][micromark]. + +GitHub announced footnotes [on September 30, 2021][post] but did not specify +them in their GFM spec. +As they are implemented in their parser and supported in all places where +other GFM features work, they can be considered part of GFM. +GitHub employs several other features (such as mentions or frontmatter) that +are either not in their parser, or not in all places where GFM features work, +which should not be considered GFM. + +The implementation of footnotes on github.com is currently buggy. +The bugs have been reported on [`cmark-gfm`][cmark-gfm]. +This micromark extension matches github.com except for its bugs. + +## When to use this + +This project is useful when you want to support footnotes in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm] instead. + +When you need a syntax tree, combine this package with +[`mdast-util-gfm-footnote`][mdast-util-gfm-footnote]. + +All these packages are used in [`remark-gfm`][remark-gfm], which focusses on +making it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-footnote +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmFootnote, gfmFootnoteHtml} from 'https://esm.sh/micromark-extension-gfm-footnote@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +````markdown +Using footnotes is fun![^1] They let you reference relevant information without disrupting the flow of what you’re trying to say.[^bignote] + +[^1]: This is the first footnote. +[^bignote]: Here’s one with multiple paragraphs and code. + + Indent paragraphs to include them in the footnote. + + ``` + my code + ``` + + Add as many paragraphs as you like. + +Text here and here and here. +[Learn more about markdown and footnotes in markdown](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#footnotes) +```` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {micromark} from 'micromark' +import {gfmFootnote, gfmFootnoteHtml} from 'micromark-extension-gfm-footnote' + +const output = micromark(await fs.readFile('example.md'), { + extensions: [gfmFootnote()], + htmlExtensions: [gfmFootnoteHtml()] +}) + +console.log(output) +``` + +…now running `node example.js` yields: + +```html +

    Using footnotes is fun!1 They let you reference relevant information without disrupting the flow of what you’re trying to say.2

    +

    Text here and here and here. +Learn more about markdown and footnotes in markdown

    +

    Footnotes

    +
      +
    1. +

      This is the first footnote. ↩

      +
    2. +
    3. +

      Here’s one with multiple paragraphs and code.

      +

      Indent paragraphs to include them in the footnote.

      +
      my code
      +
      +

      Add as many paragraphs as you like. ↩

      +
    4. +
    +
    +``` + +## API + +This package exports the identifiers +[`defaultBackLabel`][api-default-back-label], +[`gfmFootnote`][api-gfm-footnote], and +[`gfmFootnoteHtml`][api-gfm-footnote-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `defaultBackLabel(referenceIndex, rereferenceIndex)` + +Generate the default label that GitHub uses on backreferences +([`BackLabelTemplate`][api-back-label-template]). + +### `gfmFootnote()` + +Create an extension for `micromark` to enable GFM footnote syntax. + +###### Returns + +Extension for `micromark` that can be passed in `extensions` to enable GFM +footnote syntax ([`Extension`][micromark-extension]). + +### `gfmFootnoteHtml(options?)` + +Create an extension for `micromark` to support GFM footnotes when serializing +to HTML. + +###### Parameters + +* `options` ([`HtmlOptions`][api-html-options], optional) + — configuration + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support GFM +footnotes when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +### `BackLabelTemplate` + +Generate a back label dynamically (TypeScript type). + +For the following markdown: + +```markdown +Alpha[^micromark], bravo[^micromark], and charlie[^remark]. + +[^remark]: things about remark +[^micromark]: things about micromark +``` + +This function will be called with: + +* `0` and `0` for the backreference from `things about micromark` to + `alpha`, as it is the first used definition, and the first call to it +* `0` and `1` for the backreference from `things about micromark` to + `bravo`, as it is the first used definition, and the second call to it +* `1` and `0` for the backreference from `things about remark` to + `charlie`, as it is the second used definition + +###### Parameters + +* `referenceIndex` (`number`) + — index of the definition in the order that they are first referenced, + 0-indexed +* `rereferenceIndex` (`number`) + — index of calls to the same definition, 0-indexed + +###### Returns + +Back label to use when linking back from definitions to their reference +(`string`). + +### `HtmlOptions` + +Configuration (TypeScript type). + +##### Fields + +###### `clobberPrefix` + +Prefix to use before the `id` attribute on footnotes to prevent them from +*clobbering* (`string`, default: `'user-content-'`). + +Pass `''` for trusted markdown and when you are careful with polyfilling. +You could pass a different prefix. + +DOM clobbering is this: + +```html +

    + +``` + +The above example shows that elements are made available by browsers, by their +ID, on the `window` object. +This is a security risk because you might be expecting some other variable at +that place. +It can also break polyfills. +Using a prefix solves these problems. + +###### `label` + +Textual label to use for the footnotes section (`string`, default: +`'Footnotes'`). + +Change it when the markdown is not in English. + +This label is typically hidden visually (assuming a `sr-only` CSS class +is defined that does that) and so affects screen readers only. + +###### `labelAttributes` + +Attributes to use on the footnote label (`string`, default: +`'class="sr-only"'`). + +Change it to show the label and add other attributes. + +This label is typically hidden visually (assuming an `sr-only` CSS class +is defined that does that) and so affects screen readers only. +If you do have such a class, but want to show this section to everyone, +pass an empty string. +You can also add different attributes. + +> 👉 **Note**: `id="footnote-label"` is always added, because footnote +> calls use it with `aria-describedby` to provide an accessible label. + +###### `labelTagName` + +HTML tag name to use for the footnote label element (`string`, default: +`'h2'`). + +Change it to match your document structure. + +This label is typically hidden visually (assuming a `sr-only` CSS class +is defined that does that) and so affects screen readers only. + +###### `backLabel` + +Textual label to describe the backreference back to footnote calls +([`BackLabelTemplate`][api-back-label-template] or `string`, +default: [`defaultBackLabel`][api-default-back-label]). + +Change it when the markdown is not in English. + +This label is used in the [`aria-label`][aria-label] attribute on each +backreference (the `↩` links). +It affects users of assistive technology. + +## Bugs + +GitHub’s own algorithm to parse footnote definitions contains several bugs. +These are not present in this project. +The issues relating to footnote definitions are: + +* [Footnote reference call identifiers are trimmed, but definition + identifiers aren’t](https://github.com/github/cmark-gfm/issues/237)\ + — initial and final whitespace in labels causes them not to match +* [Footnotes are matched case-insensitive, but links keep their casing, + breaking them](https://github.com/github/cmark-gfm/issues/239)\ + — using uppercase (or any character that will be percent encoded) in + identifiers breaks links +* [Colons in footnotes generate links w/o + `href`](https://github.com/github/cmark-gfm/issues/250)\ + — colons in identifiers generate broken links +* [Character escape of `]` does not work in footnote + identifiers](https://github.com/github/cmark-gfm/issues/240)\ + — some character escapes don’t work +* [Footnotes in links are + broken](https://github.com/github/cmark-gfm/issues/249)\ + — while `CommonMark` prevents links in links, GitHub does not prevent + footnotes (which turn into links) in links +* [Footnote-like brackets around image, break that + image](https://github.com/github/cmark-gfm/issues/275)\ + — images can’t be used in what looks like a footnote call +* [GFM footnotes: line ending in footnote definition label causes text to + disappear](https://github.com/github/cmark-gfm/issues/282)\ + — line endings in footnote definitions cause text to disappear + +## Authoring + +When authoring markdown with footnotes it’s recommended to use words instead +of numbers (or letters or anything with an order) as identifiers. +That makes it easier to reuse and reorder footnotes. + +It’s recommended to place footnotes definitions at the bottom of the document. + +## HTML + +GFM footnotes do not, on their own, relate to anything in HTML. +When a footnote reference matches with a definition, they each relate to several +elements in HTML. + +The reference relates to `` and `` elements in HTML: + +```html +1

    +``` + +…where `x` is the identifier used in the markdown source and `1` the number of +corresponding, listed, definition. + +See [*§ 4.5.19 The `sub` and `sup` elements*][html-sup], +[*§ 4.5.1 The `a` element*][html-a], and +[*§ 3.2.6.6 Embedding custom non-visible data with the `data-*` +attributes*][html-data] +in the HTML spec, and +[*§ 6.8 `aria-describedby` property*][aria-describedby] +in WAI-ARIA, for more info. + +When one or more definitions are referenced, a footnote section is generated at +the end of the document, using `
    `, `

    `, and `
      ` elements: + +```html +

      Footnotes

      +
        …
      +
      +``` + +Each definition is generated as a `
    1. ` in the `
        ` in the order they were +first referenced: + +```html +
      1. …
      2. +``` + +Backreferences are injected at the end of the first paragraph, or, when there +is no paragraph, at the end of the definition. +When a definition is referenced multiple times, multiple backreferences are +generated. +Further backreferences use an extra counter in the `href` attribute and +visually in a `` after `↩`. + +```html +↩ ↩2 +``` + +See +[*§ 4.5.1 The `a` element*][html-a], +[*§ 4.3.6 The `h1`, `h2`, `h3`, `h4`, `h5`, and `h6` elements*][html-h], +[*§ 4.4.8 The `li` element*][html-li], +[*§ 4.4.5 The `ol` element*][html-ol], +[*§ 4.4.1 The `p` element*][html-p], +[*§ 4.3.3 The `section` element*][html-section], and +[*§ 4.5.19 The `sub` and `sup` elements*][html-sup] +in the HTML spec, and +[*§ 6.8 `aria-label` property*][aria-label] +in WAI-ARIA, for more info. + +## CSS + +The following CSS is needed to make footnotes look a bit like GitHub (and fixes +a bug). +For the complete actual CSS see +[`sindresorhus/github-markdown-css`](https://github.com/sindresorhus/github-markdown-css). + +```css +/* Style the footnotes section. */ +.footnotes { + font-size: smaller; + color: #8b949e; + border-top: 1px solid #30363d; +} + +/* Hide the section label for visual users. */ +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + word-wrap: normal; + border: 0; +} + +/* Place `[` and `]` around footnote references. */ +[data-footnote-ref]::before { + content: '['; +} + +[data-footnote-ref]::after { + content: ']'; +} +``` + +## Syntax + +Footnotes form with, roughly, the following BNF: + +```bnf +gfm_footnote_reference ::= gfm_footnote_label + +gfm_footnote_definition_start ::= gfm_footnote_label ':' *space_or_tab +; Restriction: blank line allowed. +gfm_footnote_definition_cont ::= 4(space_or_tab) + +; Restriction: maximum `999` codes between `^` and `]`. +gfm_footnote_label ::= '[' '^' 1*(gfm_footnote_label_byte | gfm_footnote_label_escape) ']' +gfm_footnote_label_byte ::= text - '[' - '\\' - ']' +gfm_footnote_label_escape ::= '\\' ['[' | '\\' | ']'] + +; Any byte (u8) +byte ::= 0x00..=0xFFFF +space_or_tab ::= '\t' | ' ' +eol ::= '\n' | '\r' | '\r\n' +line ::= byte - eol +text ::= line - space_or_tab +``` + +Further lines after `gfm_footnote_definition_start` that are not prefixed with +`gfm_footnote_definition_cont` cause the footnote definition to be exited, +except when those lines are lazy continuation or blank. +Like so many things in markdown, footnote definition too are complex. +See [*§ Phase 1: block structure* in `CommonMark`][commonmark-block] for more +on parsing details. + +The identifiers in the `label` parts are interpreted as the +[string][micromark-content-types] content type. +That means that character escapes and character references are allowed. + +Definitions match to references through identifiers. +To match, both labels must be equal after normalizing with +[`normalizeIdentifier`][micromark-normalize-identifier]. +One definition can match to multiple calls. +Multiple definitions with the same, normalized, identifier are ignored: the +first definition is preferred. +To illustrate, the definition with the content of `x` wins: + +```markdown +[^a]: x +[^a]: y + +[^a] +``` + +Importantly, while labels *can* include [string][micromark-content-types] +content (character escapes and character references), these are not considered +when matching. +To illustrate, neither definition matches the reference: + +```markdown +[^a&b]: x +[^a\&b]: y + +[^a&b] +``` + +Because footnote definitions are containers (like block quotes and list items), +they can contain more footnote definitions. +They can even include references to themselves. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`BackLabelTemplate`][api-back-label-template] +and [`HtmlOptions`][api-html-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-footnote@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. +Setting `clobberPrefix = ''` is dangerous, it opens you up to DOM clobbering. +The `labelTagName` and `labelAttributes` options are unsafe when used with user +content, they allow defining arbitrary HTML. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-footnote`][mdast-util-gfm-footnote] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-footnote/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-footnote/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-footnote.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-footnote + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-footnote.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-footnote + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-footnote + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-footnote + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-content-types]: https://github.com/micromark/micromark#content-types + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-normalize-identifier]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-normalize-identifier + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[mdast-util-gfm-footnote]: https://github.com/syntax-tree/mdast-util-gfm-footnote + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[post]: https://github.blog/changelog/2021-09-30-footnotes-now-supported-in-markdown-fields/ + +[cmark-gfm]: https://github.com/github/cmark-gfm + +[commonmark-block]: https://spec.commonmark.org/0.30/#phase-1-block-structure + +[html-a]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element + +[html-data]: https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes + +[html-h]: https://html.spec.whatwg.org/multipage/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements + +[html-li]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element + +[html-ol]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-ol-element + +[html-p]: https://html.spec.whatwg.org/multipage/grouping-content.html#the-p-element + +[html-section]: https://html.spec.whatwg.org/multipage/sections.html#the-section-element + +[html-sup]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-sub-and-sup-elements + +[aria-describedby]: https://w3c.github.io/aria/#aria-describedby + +[aria-label]: https://w3c.github.io/aria/#aria-label + +[api-gfm-footnote]: #gfmfootnote + +[api-gfm-footnote-html]: #gfmfootnotehtmloptions + +[api-html-options]: #htmloptions + +[api-default-back-label]: #defaultbacklabelreferenceindex-rereferenceindex + +[api-back-label-template]: #backlabeltemplate diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..037dac3cae287508c6865d427f7b30353b727842 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/index.d.ts @@ -0,0 +1,30 @@ +export {gfmStrikethroughHtml} from './lib/html.js' +export {gfmStrikethrough} from './lib/syntax.js' + +/** + * Configuration (optional). + */ +export interface Options { + /** + * Whether to support strikethrough with a single tilde (default: `true`). + * + * Single tildes work on github.com, but are technically prohibited by the + * GFM spec. + */ + singleTilde?: boolean | null | undefined +} + +/** + * Augment. + */ +declare module 'micromark-util-types' { + /** + * Token types. + */ + interface TokenTypeMap { + strikethroughSequence: 'strikethroughSequence' + strikethroughSequenceTemporary: 'strikethroughSequenceTemporary' + strikethrough: 'strikethrough' + strikethroughText: 'strikethroughText' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/index.js b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..127b78300b9b44edfab9fa7b9003f6ee9b6ba4e4 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/index.js @@ -0,0 +1,3 @@ +// Note: more types exposed from `index.d.ts`. +export {gfmStrikethroughHtml} from './lib/html.js' +export {gfmStrikethrough} from './lib/syntax.js' diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa15edf69ac437816bfed0f4a5b7be931a957255 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/html.d.ts @@ -0,0 +1,13 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ +/** + * Create an HTML extension for `micromark` to support GFM strikethrough when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions`, to + * support GFM strikethrough when serializing to HTML. + */ +export function gfmStrikethroughHtml(): HtmlExtension; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..bfbf44da9bb5982ec21b8690b0cc91cdee44cb3c --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/html.js @@ -0,0 +1,26 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ + +/** + * Create an HTML extension for `micromark` to support GFM strikethrough when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions`, to + * support GFM strikethrough when serializing to HTML. + */ +export function gfmStrikethroughHtml() { + return { + enter: { + strikethrough() { + this.tag('') + } + }, + exit: { + strikethrough() { + this.tag('') + } + } + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8bfb44bad312272ce86d7c8bd06a58dac1f60d8f --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/syntax.d.ts @@ -0,0 +1,12 @@ +/** + * Create an extension for `micromark` to enable GFM strikethrough syntax. + * + * @param {Options | null | undefined} [options={}] + * Configuration. + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions`, to + * enable GFM strikethrough syntax. + */ +export function gfmStrikethrough(options?: Options | null | undefined): Extension; +import type { Options } from 'micromark-extension-gfm-strikethrough'; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..dc4c18723c7beb47e819280f698c6718fdaaa15e --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/dev/lib/syntax.js @@ -0,0 +1,183 @@ +/** + * @import {Options} from 'micromark-extension-gfm-strikethrough' + * @import {Event, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {splice} from 'micromark-util-chunked' +import {classifyCharacter} from 'micromark-util-classify-character' +import {resolveAll} from 'micromark-util-resolve-all' +import {codes, constants, types} from 'micromark-util-symbol' + +/** + * Create an extension for `micromark` to enable GFM strikethrough syntax. + * + * @param {Options | null | undefined} [options={}] + * Configuration. + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions`, to + * enable GFM strikethrough syntax. + */ +export function gfmStrikethrough(options) { + const options_ = options || {} + let single = options_.singleTilde + const tokenizer = { + name: 'strikethrough', + tokenize: tokenizeStrikethrough, + resolveAll: resolveAllStrikethrough + } + + if (single === null || single === undefined) { + single = true + } + + return { + text: {[codes.tilde]: tokenizer}, + insideSpan: {null: [tokenizer]}, + attentionMarkers: {null: [codes.tilde]} + } + + /** + * Take events and resolve strikethrough. + * + * @type {Resolver} + */ + function resolveAllStrikethrough(events, context) { + let index = -1 + + // Walk through all events. + while (++index < events.length) { + // Find a token that can close. + if ( + events[index][0] === 'enter' && + events[index][1].type === 'strikethroughSequenceTemporary' && + events[index][1]._close + ) { + let open = index + + // Now walk back to find an opener. + while (open--) { + // Find a token that can open the closer. + if ( + events[open][0] === 'exit' && + events[open][1].type === 'strikethroughSequenceTemporary' && + events[open][1]._open && + // If the sizes are the same: + events[index][1].end.offset - events[index][1].start.offset === + events[open][1].end.offset - events[open][1].start.offset + ) { + events[index][1].type = 'strikethroughSequence' + events[open][1].type = 'strikethroughSequence' + + /** @type {Token} */ + const strikethrough = { + type: 'strikethrough', + start: Object.assign({}, events[open][1].start), + end: Object.assign({}, events[index][1].end) + } + + /** @type {Token} */ + const text = { + type: 'strikethroughText', + start: Object.assign({}, events[open][1].end), + end: Object.assign({}, events[index][1].start) + } + + // Opening. + /** @type {Array} */ + const nextEvents = [ + ['enter', strikethrough, context], + ['enter', events[open][1], context], + ['exit', events[open][1], context], + ['enter', text, context] + ] + + const insideSpan = context.parser.constructs.insideSpan.null + + if (insideSpan) { + // Between. + splice( + nextEvents, + nextEvents.length, + 0, + resolveAll(insideSpan, events.slice(open + 1, index), context) + ) + } + + // Closing. + splice(nextEvents, nextEvents.length, 0, [ + ['exit', text, context], + ['enter', events[index][1], context], + ['exit', events[index][1], context], + ['exit', strikethrough, context] + ]) + + splice(events, open - 1, index - open + 3, nextEvents) + + index = open + nextEvents.length - 2 + break + } + } + } + } + + index = -1 + + while (++index < events.length) { + if (events[index][1].type === 'strikethroughSequenceTemporary') { + events[index][1].type = types.data + } + } + + return events + } + + /** + * @this {TokenizeContext} + * @type {Tokenizer} + */ + function tokenizeStrikethrough(effects, ok, nok) { + const previous = this.previous + const events = this.events + let size = 0 + + return start + + /** @type {State} */ + function start(code) { + assert(code === codes.tilde, 'expected `~`') + + if ( + previous === codes.tilde && + events[events.length - 1][1].type !== types.characterEscape + ) { + return nok(code) + } + + effects.enter('strikethroughSequenceTemporary') + return more(code) + } + + /** @type {State} */ + function more(code) { + const before = classifyCharacter(previous) + + if (code === codes.tilde) { + // If this is the third marker, exit. + if (size > 1) return nok(code) + effects.consume(code) + size++ + return more + } + + if (size < 2 && !single) return nok(code) + const token = effects.exit('strikethroughSequenceTemporary') + const after = classifyCharacter(code) + token._open = + !after || (after === constants.attentionSideAfter && Boolean(before)) + token._close = + !before || (before === constants.attentionSideAfter && Boolean(after)) + return ok(code) + } + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..50a0b7e5f6ef27ed02a887f86832aa1d66021621 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/index.d.ts @@ -0,0 +1,24 @@ +export {gfmStrikethroughHtml} from './lib/html.js' +export {gfmStrikethrough} from './lib/syntax.js' + +/** + * Configuration (optional). + */ +export interface Options { + /** + * Whether to support strikethrough with a single tilde (default: `true`). + * + * Single tildes work on github.com, but are technically prohibited by the + * GFM spec. + */ + singleTilde?: boolean | null | undefined +} + +declare module 'micromark-util-types' { + interface TokenTypeMap { + strikethroughSequence: 'strikethroughSequence' + strikethroughSequenceTemporary: 'strikethroughSequenceTemporary' + strikethrough: 'strikethrough' + strikethroughText: 'strikethroughText' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/index.js b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/index.js new file mode 100644 index 0000000000000000000000000000000000000000..da7cbe225887ca47dff43aea11519132d2f1acd2 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/index.js @@ -0,0 +1,3 @@ +// Note: more types exposed from `index.d.ts`. +export { gfmStrikethroughHtml } from './lib/html.js'; +export { gfmStrikethrough } from './lib/syntax.js'; \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa15edf69ac437816bfed0f4a5b7be931a957255 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/html.d.ts @@ -0,0 +1,13 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ +/** + * Create an HTML extension for `micromark` to support GFM strikethrough when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions`, to + * support GFM strikethrough when serializing to HTML. + */ +export function gfmStrikethroughHtml(): HtmlExtension; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..fa8ef76c207f3e7544d16e6cbdcbcfa988feaf3e --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/html.js @@ -0,0 +1,26 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ + +/** + * Create an HTML extension for `micromark` to support GFM strikethrough when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions`, to + * support GFM strikethrough when serializing to HTML. + */ +export function gfmStrikethroughHtml() { + return { + enter: { + strikethrough() { + this.tag(''); + } + }, + exit: { + strikethrough() { + this.tag(''); + } + } + }; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8bfb44bad312272ce86d7c8bd06a58dac1f60d8f --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.d.ts @@ -0,0 +1,12 @@ +/** + * Create an extension for `micromark` to enable GFM strikethrough syntax. + * + * @param {Options | null | undefined} [options={}] + * Configuration. + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions`, to + * enable GFM strikethrough syntax. + */ +export function gfmStrikethrough(options?: Options | null | undefined): Extension; +import type { Options } from 'micromark-extension-gfm-strikethrough'; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..715d5ba4cc0af432ddf7b7ad006398668cdce9ba --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js @@ -0,0 +1,142 @@ +/** + * @import {Options} from 'micromark-extension-gfm-strikethrough' + * @import {Event, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import { splice } from 'micromark-util-chunked'; +import { classifyCharacter } from 'micromark-util-classify-character'; +import { resolveAll } from 'micromark-util-resolve-all'; +/** + * Create an extension for `micromark` to enable GFM strikethrough syntax. + * + * @param {Options | null | undefined} [options={}] + * Configuration. + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions`, to + * enable GFM strikethrough syntax. + */ +export function gfmStrikethrough(options) { + const options_ = options || {}; + let single = options_.singleTilde; + const tokenizer = { + name: 'strikethrough', + tokenize: tokenizeStrikethrough, + resolveAll: resolveAllStrikethrough + }; + if (single === null || single === undefined) { + single = true; + } + return { + text: { + [126]: tokenizer + }, + insideSpan: { + null: [tokenizer] + }, + attentionMarkers: { + null: [126] + } + }; + + /** + * Take events and resolve strikethrough. + * + * @type {Resolver} + */ + function resolveAllStrikethrough(events, context) { + let index = -1; + + // Walk through all events. + while (++index < events.length) { + // Find a token that can close. + if (events[index][0] === 'enter' && events[index][1].type === 'strikethroughSequenceTemporary' && events[index][1]._close) { + let open = index; + + // Now walk back to find an opener. + while (open--) { + // Find a token that can open the closer. + if (events[open][0] === 'exit' && events[open][1].type === 'strikethroughSequenceTemporary' && events[open][1]._open && + // If the sizes are the same: + events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) { + events[index][1].type = 'strikethroughSequence'; + events[open][1].type = 'strikethroughSequence'; + + /** @type {Token} */ + const strikethrough = { + type: 'strikethrough', + start: Object.assign({}, events[open][1].start), + end: Object.assign({}, events[index][1].end) + }; + + /** @type {Token} */ + const text = { + type: 'strikethroughText', + start: Object.assign({}, events[open][1].end), + end: Object.assign({}, events[index][1].start) + }; + + // Opening. + /** @type {Array} */ + const nextEvents = [['enter', strikethrough, context], ['enter', events[open][1], context], ['exit', events[open][1], context], ['enter', text, context]]; + const insideSpan = context.parser.constructs.insideSpan.null; + if (insideSpan) { + // Between. + splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context)); + } + + // Closing. + splice(nextEvents, nextEvents.length, 0, [['exit', text, context], ['enter', events[index][1], context], ['exit', events[index][1], context], ['exit', strikethrough, context]]); + splice(events, open - 1, index - open + 3, nextEvents); + index = open + nextEvents.length - 2; + break; + } + } + } + } + index = -1; + while (++index < events.length) { + if (events[index][1].type === 'strikethroughSequenceTemporary') { + events[index][1].type = "data"; + } + } + return events; + } + + /** + * @this {TokenizeContext} + * @type {Tokenizer} + */ + function tokenizeStrikethrough(effects, ok, nok) { + const previous = this.previous; + const events = this.events; + let size = 0; + return start; + + /** @type {State} */ + function start(code) { + if (previous === 126 && events[events.length - 1][1].type !== "characterEscape") { + return nok(code); + } + effects.enter('strikethroughSequenceTemporary'); + return more(code); + } + + /** @type {State} */ + function more(code) { + const before = classifyCharacter(previous); + if (code === 126) { + // If this is the third marker, exit. + if (size > 1) return nok(code); + effects.consume(code); + size++; + return more; + } + if (size < 2 && !single) return nok(code); + const token = effects.exit('strikethroughSequenceTemporary'); + const after = classifyCharacter(code); + token._open = !after || after === 2 && Boolean(before); + token._close = !before || before === 2 && Boolean(after); + return ok(code); + } + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/license b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/license new file mode 100644 index 0000000000000000000000000000000000000000..39372356c47d0f6e070ff62d84c69f4f5e8c16eb --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/package.json b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/package.json new file mode 100644 index 0000000000000000000000000000000000000000..31b7cd8392d60add7df4ed8afa15d61071798573 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/package.json @@ -0,0 +1,129 @@ +{ + "name": "micromark-extension-gfm-strikethrough", + "version": "2.1.0", + "description": "micromark extension to support GFM strikethrough", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "strikethrough", + "strike", + "through", + "del", + "delete", + "deletion", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-strikethrough", + "bugs": "https://github.com/micromark/micromark-extension-gfm-strikethrough/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "create-gfm-fixtures": "^1.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "tape": "^5.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "max-depth": "off", + "unicorn/prefer-at": "off" + }, + "overrides": [ + { + "files": "**/*.ts", + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": "test/**/*.js", + "rules": { + "no-await-in-loop": 0 + } + } + ] + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-strikethrough/readme.md b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..e2c18d38c97a0603d27687be228cd07bfb6aeaa0 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-strikethrough/readme.md @@ -0,0 +1,304 @@ +# micromark-extension-gfm-strikethrough + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [strikethrough][]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmStrikethrough(options?)`](#gfmstrikethroughoptions) + * [`gfmStrikethroughHtml()`](#gfmstrikethroughhtml) + * [`Options`](#options) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for strikethrough as enabled +by GFM to [`micromark`][micromark]. + +## When to use this + +This project is useful when you want to support strikethrough in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm]. + +When you need a syntax tree, you can combine this package with +[`mdast-util-gfm-strikethrough`][mdast-util-gfm-strikethrough]. + +All these packages are used [`remark-gfm`][remark-gfm], which focusses on making +it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-strikethrough +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmStrikethrough, gfmStrikethroughHtml} from 'https://esm.sh/micromark-extension-gfm-strikethrough@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import { + gfmStrikethrough, + gfmStrikethroughHtml +} from 'micromark-extension-gfm-strikethrough' + +const output = micromark('Some ~strikethrough~.', { + extensions: [gfmStrikethrough()], + htmlExtensions: [gfmStrikethroughHtml()] +}) + +console.log(output) +``` + +Yields: + +```html +

        Some strikethrough

        . +``` + +## API + +This package exports the identifiers +[`gfmStrikethrough`][api-gfm-strikethrough] and +[`gfmStrikethroughHtml`][api-gfm-strikethrough-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfmStrikethrough(options?)` + +Create an extension for `micromark` to enable GFM strikethrough syntax. + +###### Parameters + +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Extension for `micromark` that can be passed in `extensions`, to +enable GFM strikethrough syntax ([`Extension`][micromark-extension]). + +### `gfmStrikethroughHtml()` + +Create an HTML extension for `micromark` to support GFM strikethrough when +serializing to HTML. + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions`, to support +GFM strikethrough when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `singleTilde` (`boolean`, default: `true`) + — whether to support strikethrough with a single tilde. + Single tildes work on github.com, but are technically prohibited by the GFM + spec + +## Authoring + +When authoring markdown with strikethrough, it is recommended to use two +markers. +While `github.com` allows single tildes too, it technically prohibits it in +their spec. + +## HTML + +When tilde sequences match, they together relate to the `` element in +HTML. +See [*§ 4.7.2 The `del` element*][html-del] in the HTML spec for more info. + +## CSS + +GitHub itself does not apply interesting CSS to `del` elements. +It currently (July 2022) does change `code` in `del`. + +```css +del code { + text-decoration: inherit; +} +``` + +For the complete actual CSS see +[`sindresorhus/github-markdown-css`][github-markdown-css]. + +## Syntax + +Strikethrough sequences form with the following BNF: + +```bnf +gfm_attention_sequence ::= 1*'~' +``` + +Sequences are matched together to form strikethrough based on which character +they contain, how long they are, and what character occurs before and after +each sequence. +Otherwise they are turned into data. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-strikethrough@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-strikethrough`][mdast-util-gfm-strikethrough] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-strikethrough/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-strikethrough/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-strikethrough.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-strikethrough + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-strikethrough.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-strikethrough + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-strikethrough + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-strikethrough + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[mdast-util-gfm-strikethrough]: https://github.com/syntax-tree/mdast-util-gfm-strikethrough + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[strikethrough]: https://github.github.com/gfm/#strikethrough-extension- + +[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css + +[html-del]: https://html.spec.whatwg.org/multipage/edits.html#the-del-element + +[api-gfm-strikethrough]: #gfmstrikethroughoptions + +[api-gfm-strikethrough-html]: #gfmstrikethroughhtml + +[api-options]: #options diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be1a117c5c3383d1f194c56950bf7bcc32ad0652 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/index.d.ts @@ -0,0 +1,55 @@ +import type {Align} from './lib/infer.js' + +export {gfmTableHtml} from './lib/html.js' +export {gfmTable} from './lib/syntax.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * State tracked to compile events as HTML, + * extended by `micromark-extension-gfm-table`. + */ + interface CompileData { + /** + * Alignment of current table. + */ + tableAlign?: Array | undefined + /** + * Current table column. + */ + tableColumn?: number | undefined + } + + /** + * Augment token; + * `align` is patched on `table` tokens by + * `micromark-extension-gfm-table`. + */ + interface Token { + /** + * Alignment of current table. + */ + _align?: Array | undefined + } + + /** + * Map of allowed token types, + * extended by `micromark-extension-gfm-table`. + */ + interface TokenTypeMap { + tableBody: 'tableBody' + tableCellDivider: 'tableCellDivider' + tableContent: 'tableContent' + tableData: 'tableData' + tableDelimiterFiller: 'tableDelimiterFiller' + tableDelimiterMarker: 'tableDelimiterMarker' + tableDelimiterRow: 'tableDelimiterRow' + tableDelimiter: 'tableDelimiter' + tableHeader: 'tableHeader' + tableHead: 'tableHead' + tableRow: 'tableRow' + table: 'table' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/index.js b/tools/ui/node_modules/micromark-extension-gfm-table/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..dcb556083f1c3ae04f1c6612ca99f96138230d24 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/index.js @@ -0,0 +1,2 @@ +export {gfmTableHtml} from './lib/html.js' +export {gfmTable} from './lib/syntax.js' diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..02da6f3ec111888fc55dc5e4e6ac71878d3cf44d --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts @@ -0,0 +1,38 @@ +/** + * @import {Event} from 'micromark-util-types' + */ +/** + * @typedef {[number, number, Array]} Change + * @typedef {[number, number, number]} Jump + */ +/** + * Tracks a bunch of edits. + */ +export class EditMap { + /** + * Record of changes. + * + * @type {Array} + */ + map: Array; + /** + * Create an edit: a remove and/or add at a certain place. + * + * @param {number} index + * @param {number} remove + * @param {Array} add + * @returns {undefined} + */ + add(index: number, remove: number, add: Array): undefined; + /** + * Done, change the events. + * + * @param {Array} events + * @returns {undefined} + */ + consume(events: Array): undefined; +} +export type Change = [number, number, Array]; +export type Jump = [number, number, number]; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=edit-map.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts.map b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b522a04952b1d63ebc817b1fa37639ae76619536 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-map.d.ts","sourceRoot":"","sources":["edit-map.js"],"names":[],"mappings":"AAAA;;GAEG;AAeH;;;GAGG;AAEH;;GAEG;AACH;IAKI;;;;OAIG;IACH,KAFU,KAAK,CAAC,MAAM,CAAC,CAEV;IAGf;;;;;;;OAOG;IACH,WALW,MAAM,UACN,MAAM,OACN,KAAK,CAAC,KAAK,CAAC,GACV,SAAS,CAIrB;IAeD;;;;;OAKG;IACH,gBAHW,KAAK,CAAC,KAAK,CAAC,GACV,SAAS,CA2DrB;CACF;qBA7GY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;mBAC9B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;2BAlBb,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js new file mode 100644 index 0000000000000000000000000000000000000000..983d0556e2713dc92982faa6a09b1093ef4d02db --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/edit-map.js @@ -0,0 +1,212 @@ +/** + * @import {Event} from 'micromark-util-types' + */ + +// Port of `edit_map.rs` from `markdown-rs`. +// This should move to `markdown-js` later. + +// Deal with several changes in events, batching them together. +// +// Preferably, changes should be kept to a minimum. +// Sometimes, it’s needed to change the list of events, because parsing can be +// messy, and it helps to expose a cleaner interface of events to the compiler +// and other users. +// It can also help to merge many adjacent similar events. +// And, in other cases, it’s needed to parse subcontent: pass some events +// through another tokenizer and inject the result. + +/** + * @typedef {[number, number, Array]} Change + * @typedef {[number, number, number]} Jump + */ + +/** + * Tracks a bunch of edits. + */ +export class EditMap { + /** + * Create a new edit map. + */ + constructor() { + /** + * Record of changes. + * + * @type {Array} + */ + this.map = [] + } + + /** + * Create an edit: a remove and/or add at a certain place. + * + * @param {number} index + * @param {number} remove + * @param {Array} add + * @returns {undefined} + */ + add(index, remove, add) { + addImplementation(this, index, remove, add) + } + + // To do: add this when moving to `micromark`. + // /** + // * Create an edit: but insert `add` before existing additions. + // * + // * @param {number} index + // * @param {number} remove + // * @param {Array} add + // * @returns {undefined} + // */ + // addBefore(index, remove, add) { + // addImplementation(this, index, remove, add, true) + // } + + /** + * Done, change the events. + * + * @param {Array} events + * @returns {undefined} + */ + consume(events) { + this.map.sort(function (a, b) { + return a[0] - b[0] + }) + + /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */ + if (this.map.length === 0) { + return + } + + // To do: if links are added in events, like they are in `markdown-rs`, + // this is needed. + // // Calculate jumps: where items in the current list move to. + // /** @type {Array} */ + // const jumps = [] + // let index = 0 + // let addAcc = 0 + // let removeAcc = 0 + // while (index < this.map.length) { + // const [at, remove, add] = this.map[index] + // removeAcc += remove + // addAcc += add.length + // jumps.push([at, removeAcc, addAcc]) + // index += 1 + // } + // + // . shiftLinks(events, jumps) + + let index = this.map.length + /** @type {Array>} */ + const vecs = [] + while (index > 0) { + index -= 1 + vecs.push( + events.slice(this.map[index][0] + this.map[index][1]), + this.map[index][2] + ) + + // Truncate rest. + events.length = this.map[index][0] + } + + vecs.push(events.slice()) + events.length = 0 + + let slice = vecs.pop() + + while (slice) { + for (const element of slice) { + events.push(element) + } + + slice = vecs.pop() + } + + // Truncate everything. + this.map.length = 0 + } +} + +/** + * Create an edit. + * + * @param {EditMap} editMap + * @param {number} at + * @param {number} remove + * @param {Array} add + * @returns {undefined} + */ +function addImplementation(editMap, at, remove, add) { + let index = 0 + + /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */ + if (remove === 0 && add.length === 0) { + return + } + + while (index < editMap.map.length) { + if (editMap.map[index][0] === at) { + editMap.map[index][1] += remove + + // To do: before not used by tables, use when moving to micromark. + // if (before) { + // add.push(...editMap.map[index][2]) + // editMap.map[index][2] = add + // } else { + editMap.map[index][2].push(...add) + // } + + return + } + + index += 1 + } + + editMap.map.push([at, remove, add]) +} + +// /** +// * Shift `previous` and `next` links according to `jumps`. +// * +// * This fixes links in case there are events removed or added between them. +// * +// * @param {Array} events +// * @param {Array} jumps +// */ +// function shiftLinks(events, jumps) { +// let jumpIndex = 0 +// let index = 0 +// let add = 0 +// let rm = 0 + +// while (index < events.length) { +// const rmCurr = rm + +// while (jumpIndex < jumps.length && jumps[jumpIndex][0] <= index) { +// add = jumps[jumpIndex][2] +// rm = jumps[jumpIndex][1] +// jumpIndex += 1 +// } + +// // Ignore items that will be removed. +// if (rm > rmCurr) { +// index += rm - rmCurr +// } else { +// // ? +// // if let Some(link) = &events[index].link { +// // if let Some(next) = link.next { +// // events[next].link.as_mut().unwrap().previous = Some(index + add - rm); +// // while jumpIndex < jumps.len() && jumps[jumpIndex].0 <= next { +// // add = jumps[jumpIndex].2; +// // rm = jumps[jumpIndex].1; +// // jumpIndex += 1; +// // } +// // events[index].link.as_mut().unwrap().next = Some(next + add - rm); +// // index = next; +// // continue; +// // } +// // } +// index += 1 +// } +// } +// } diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e4d6696020cd66e121e9cd87f2811e44146da75 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts @@ -0,0 +1,11 @@ +/** + * Create an HTML extension for `micromark` to support GitHub tables when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GitHub tables when serializing to HTML. + */ +export function gfmTableHtml(): HtmlExtension; +import type { HtmlExtension } from 'micromark-util-types'; +//# sourceMappingURL=html.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts.map b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..102bdf290ca0c6151bc963fdd563675da9c72df9 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/html.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["html.js"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,gCAJa,aAAa,CAsHzB;mCAxI+B,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..8397d72ffa37e5e9ee8f94204446d43ae111a478 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/html.js @@ -0,0 +1,148 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' + +const alignment = { + none: '', + left: ' align="left"', + right: ' align="right"', + center: ' align="center"' +} + +// To do: micromark@5: use `infer` here, when all events are exposed. + +/** + * Create an HTML extension for `micromark` to support GitHub tables when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GitHub tables when serializing to HTML. + */ +export function gfmTableHtml() { + return { + enter: { + table(token) { + const tableAlign = token._align + assert(tableAlign, 'expected `_align`') + this.lineEndingIfNeeded() + this.tag('') + this.setData('tableAlign', tableAlign) + }, + tableBody() { + this.tag('') + }, + tableData() { + const tableAlign = this.getData('tableAlign') + const tableColumn = this.getData('tableColumn') + assert(tableAlign, 'expected `tableAlign`') + assert(typeof tableColumn === 'number', 'expected `tableColumn`') + const align = alignment[tableAlign[tableColumn]] + + if (align === undefined) { + // Capture results to ignore them. + this.buffer() + } else { + this.lineEndingIfNeeded() + this.tag('') + } + }, + tableHead() { + this.lineEndingIfNeeded() + this.tag('') + }, + tableHeader() { + const tableAlign = this.getData('tableAlign') + const tableColumn = this.getData('tableColumn') + assert(tableAlign, 'expected `tableAlign`') + assert(typeof tableColumn === 'number', 'expected `tableColumn`') + const align = alignment[tableAlign[tableColumn]] + this.lineEndingIfNeeded() + this.tag('') + }, + tableRow() { + this.setData('tableColumn', 0) + this.lineEndingIfNeeded() + this.tag('') + } + }, + exit: { + // Overwrite the default code text data handler to unescape escaped pipes when + // they are in tables. + codeTextData(token) { + let value = this.sliceSerialize(token) + + if (this.getData('tableAlign')) { + value = value.replace(/\\([\\|])/g, replace) + } + + this.raw(this.encode(value)) + }, + table() { + this.setData('tableAlign') + // Note: we don’t set `slurpAllLineEndings` anymore, in delimiter rows, + // but we do need to reset it to match a funky newline GH generates for + // list items combined with tables. + this.setData('slurpAllLineEndings') + this.lineEndingIfNeeded() + this.tag('
        ') + }, + tableBody() { + this.lineEndingIfNeeded() + this.tag('') + }, + tableData() { + const tableAlign = this.getData('tableAlign') + const tableColumn = this.getData('tableColumn') + assert(tableAlign, 'expected `tableAlign`') + assert(typeof tableColumn === 'number', 'expected `tableColumn`') + + if (tableColumn in tableAlign) { + this.tag('') + this.setData('tableColumn', tableColumn + 1) + } else { + // Stop capturing. + this.resume() + } + }, + tableHead() { + this.lineEndingIfNeeded() + this.tag('') + }, + tableHeader() { + const tableColumn = this.getData('tableColumn') + assert(typeof tableColumn === 'number', 'expected `tableColumn`') + this.tag('') + this.setData('tableColumn', tableColumn + 1) + }, + tableRow() { + const tableAlign = this.getData('tableAlign') + let tableColumn = this.getData('tableColumn') + assert(tableAlign, 'expected `tableAlign`') + assert(typeof tableColumn === 'number', 'expected `tableColumn`') + + while (tableColumn < tableAlign.length) { + this.lineEndingIfNeeded() + this.tag('') + tableColumn++ + } + + this.setData('tableColumn', tableColumn) + this.lineEndingIfNeeded() + this.tag('') + } + } + } +} + +/** + * @param {string} $0 + * @param {string} $1 + * @returns {string} + */ +function replace($0, $1) { + // Pipes work, backslashes don’t (but can’t escape pipes). + return $1 === '|' ? $1 : $0 +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e55881efdde461efa55bea7c47ad9893dc864b20 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts @@ -0,0 +1,14 @@ +/** + * Figure out the alignment of a GFM table. + * + * @param {Readonly>} events + * List of events. + * @param {number} index + * Table enter event. + * @returns {Array} + * List of aligns. + */ +export function gfmTableAlign(events: Readonly>, index: number): Array; +export type Align = "center" | "left" | "none" | "right"; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=infer.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts.map b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c5b12c1ade8d3a0cbb44389f567a3002068b19dc --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/infer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"infer.d.ts","sourceRoot":"","sources":["infer.js"],"names":[],"mappings":"AAUA;;;;;;;;;GASG;AACH,sCAPW,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,SAEtB,MAAM,GAEJ,KAAK,CAAC,KAAK,CAAC,CA8CxB;oBA1DY,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO;2BAJzB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/infer.js b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/infer.js new file mode 100644 index 0000000000000000000000000000000000000000..9a6ecf02ca4e006915ef1a2087e75576e5e9ba2e --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/infer.js @@ -0,0 +1,64 @@ +/** + * @import {Event} from 'micromark-util-types' + */ + +/** + * @typedef {'center' | 'left' | 'none' | 'right'} Align + */ + +import {ok as assert} from 'devlop' + +/** + * Figure out the alignment of a GFM table. + * + * @param {Readonly>} events + * List of events. + * @param {number} index + * Table enter event. + * @returns {Array} + * List of aligns. + */ +export function gfmTableAlign(events, index) { + assert(events[index][1].type === 'table', 'expected table') + let inDelimiterRow = false + /** @type {Array} */ + const align = [] + + while (index < events.length) { + const event = events[index] + + if (inDelimiterRow) { + if (event[0] === 'enter') { + // Start of alignment value: set a new column. + // To do: `markdown-rs` uses `tableDelimiterCellValue`. + if (event[1].type === 'tableContent') { + align.push( + events[index + 1][1].type === 'tableDelimiterMarker' + ? 'left' + : 'none' + ) + } + } + // Exits: + // End of alignment value: change the column. + // To do: `markdown-rs` uses `tableDelimiterCellValue`. + else if (event[1].type === 'tableContent') { + if (events[index - 1][1].type === 'tableDelimiterMarker') { + const alignIndex = align.length - 1 + + align[alignIndex] = align[alignIndex] === 'left' ? 'center' : 'right' + } + } + // Done! + else if (event[1].type === 'tableDelimiterRow') { + break + } + } else if (event[0] === 'enter' && event[1].type === 'tableDelimiterRow') { + inDelimiterRow = true + } + + index += 1 + } + + return align +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecac018a28abeb8490d4e9df56c659b2aa93fcec --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts @@ -0,0 +1,18 @@ +/** + * Create an HTML extension for `micromark` to support GitHub tables syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * table syntax. + */ +export function gfmTable(): Extension; +/** + * Cell info. + */ +export type Range = [number, number, number, number]; +/** + * Where we are: `1` for head row, `2` for delimiter row, `3` for body row. + */ +export type RowKind = 0 | 1 | 2 | 3; +import type { Extension } from 'micromark-util-types'; +//# sourceMappingURL=syntax.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts.map b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..01eedacae562189b56aa95f1925da210f999cfa9 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/syntax.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"syntax.d.ts","sourceRoot":"","sources":["syntax.js"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,4BAJa,SAAS,CAUrB;;;;oBA/BY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;;;;sBAGhC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;+BAPoE,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..71693081622ef30d536e339eb11147488b067fdd --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/dev/lib/syntax.js @@ -0,0 +1,941 @@ +/** + * @import {Event, Extension, Point, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +/** + * @typedef {[number, number, number, number]} Range + * Cell info. + * + * @typedef {0 | 1 | 2 | 3} RowKind + * Where we are: `1` for head row, `2` for delimiter row, `3` for body row. + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import { + markdownLineEnding, + markdownLineEndingOrSpace, + markdownSpace +} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' +import {EditMap} from './edit-map.js' +import {gfmTableAlign} from './infer.js' + +/** + * Create an HTML extension for `micromark` to support GitHub tables syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * table syntax. + */ +export function gfmTable() { + return { + flow: { + null: {name: 'table', tokenize: tokenizeTable, resolveAll: resolveTable} + } + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeTable(effects, ok, nok) { + const self = this + let size = 0 + let sizeB = 0 + /** @type {boolean | undefined} */ + let seen + + return start + + /** + * Start of a GFM table. + * + * If there is a valid table row or table head before, then we try to parse + * another row. + * Otherwise, we try to parse a head. + * + * ```markdown + * > | | a | + * ^ + * | | - | + * > | | b | + * ^ + * ``` + * @type {State} + */ + function start(code) { + let index = self.events.length - 1 + + while (index > -1) { + const type = self.events[index][1].type + if ( + type === types.lineEnding || + // Note: markdown-rs uses `whitespace` instead of `linePrefix` + type === types.linePrefix + ) + index-- + else break + } + + const tail = index > -1 ? self.events[index][1].type : null + + const next = + tail === 'tableHead' || tail === 'tableRow' ? bodyRowStart : headRowBefore + + // Don’t allow lazy body rows. + if (next === bodyRowStart && self.parser.lazy[self.now().line]) { + return nok(code) + } + + return next(code) + } + + /** + * Before table head row. + * + * ```markdown + * > | | a | + * ^ + * | | - | + * | | b | + * ``` + * + * @type {State} + */ + function headRowBefore(code) { + effects.enter('tableHead') + effects.enter('tableRow') + return headRowStart(code) + } + + /** + * Before table head row, after whitespace. + * + * ```markdown + * > | | a | + * ^ + * | | - | + * | | b | + * ``` + * + * @type {State} + */ + function headRowStart(code) { + if (code === codes.verticalBar) { + return headRowBreak(code) + } + + // To do: micromark-js should let us parse our own whitespace in extensions, + // like `markdown-rs`: + // + // ```js + // // 4+ spaces. + // if (markdownSpace(code)) { + // return nok(code) + // } + // ``` + + seen = true + // Count the first character, that isn’t a pipe, double. + sizeB += 1 + return headRowBreak(code) + } + + /** + * At break in table head row. + * + * ```markdown + * > | | a | + * ^ + * ^ + * ^ + * | | - | + * | | b | + * ``` + * + * @type {State} + */ + function headRowBreak(code) { + if (code === codes.eof) { + // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don‘t. + return nok(code) + } + + if (markdownLineEnding(code)) { + // If anything other than one pipe (ignoring whitespace) was used, it’s fine. + if (sizeB > 1) { + sizeB = 0 + // To do: check if this works. + // Feel free to interrupt: + self.interrupt = true + effects.exit('tableRow') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return headDelimiterStart + } + + // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don‘t. + return nok(code) + } + + if (markdownSpace(code)) { + // To do: check if this is fine. + // effects.attempt(State::Next(StateName::GfmTableHeadRowBreak), State::Nok) + // State::Retry(space_or_tab(tokenizer)) + return factorySpace(effects, headRowBreak, types.whitespace)(code) + } + + sizeB += 1 + + if (seen) { + seen = false + // Header cell count. + size += 1 + } + + if (code === codes.verticalBar) { + effects.enter('tableCellDivider') + effects.consume(code) + effects.exit('tableCellDivider') + // Whether a delimiter was seen. + seen = true + return headRowBreak + } + + // Anything else is cell data. + effects.enter(types.data) + return headRowData(code) + } + + /** + * In table head row data. + * + * ```markdown + * > | | a | + * ^ + * | | - | + * | | b | + * ``` + * + * @type {State} + */ + function headRowData(code) { + if ( + code === codes.eof || + code === codes.verticalBar || + markdownLineEndingOrSpace(code) + ) { + effects.exit(types.data) + return headRowBreak(code) + } + + effects.consume(code) + return code === codes.backslash ? headRowEscape : headRowData + } + + /** + * In table head row escape. + * + * ```markdown + * > | | a\-b | + * ^ + * | | ---- | + * | | c | + * ``` + * + * @type {State} + */ + function headRowEscape(code) { + if (code === codes.backslash || code === codes.verticalBar) { + effects.consume(code) + return headRowData + } + + return headRowData(code) + } + + /** + * Before delimiter row. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * | | b | + * ``` + * + * @type {State} + */ + function headDelimiterStart(code) { + // Reset `interrupt`. + self.interrupt = false + + // Note: in `markdown-rs`, we need to handle piercing here too. + if (self.parser.lazy[self.now().line]) { + return nok(code) + } + + effects.enter('tableDelimiterRow') + // Track if we’ve seen a `:` or `|`. + seen = false + + if (markdownSpace(code)) { + assert(self.parser.constructs.disable.null, 'expected `disabled.null`') + return factorySpace( + effects, + headDelimiterBefore, + types.linePrefix, + self.parser.constructs.disable.null.includes('codeIndented') + ? undefined + : constants.tabSize + )(code) + } + + return headDelimiterBefore(code) + } + + /** + * Before delimiter row, after optional whitespace. + * + * Reused when a `|` is found later, to parse another cell. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * | | b | + * ``` + * + * @type {State} + */ + function headDelimiterBefore(code) { + if (code === codes.dash || code === codes.colon) { + return headDelimiterValueBefore(code) + } + + if (code === codes.verticalBar) { + seen = true + // If we start with a pipe, we open a cell marker. + effects.enter('tableCellDivider') + effects.consume(code) + effects.exit('tableCellDivider') + return headDelimiterCellBefore + } + + // More whitespace / empty row not allowed at start. + return headDelimiterNok(code) + } + + /** + * After `|`, before delimiter cell. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterCellBefore(code) { + if (markdownSpace(code)) { + return factorySpace( + effects, + headDelimiterValueBefore, + types.whitespace + )(code) + } + + return headDelimiterValueBefore(code) + } + + /** + * Before delimiter cell value. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterValueBefore(code) { + // Align: left. + if (code === codes.colon) { + sizeB += 1 + seen = true + + effects.enter('tableDelimiterMarker') + effects.consume(code) + effects.exit('tableDelimiterMarker') + return headDelimiterLeftAlignmentAfter + } + + // Align: none. + if (code === codes.dash) { + sizeB += 1 + // To do: seems weird that this *isn’t* left aligned, but that state is used? + return headDelimiterLeftAlignmentAfter(code) + } + + if (code === codes.eof || markdownLineEnding(code)) { + return headDelimiterCellAfter(code) + } + + return headDelimiterNok(code) + } + + /** + * After delimiter cell left alignment marker. + * + * ```markdown + * | | a | + * > | | :- | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterLeftAlignmentAfter(code) { + if (code === codes.dash) { + effects.enter('tableDelimiterFiller') + return headDelimiterFiller(code) + } + + // Anything else is not ok after the left-align colon. + return headDelimiterNok(code) + } + + /** + * In delimiter cell filler. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterFiller(code) { + if (code === codes.dash) { + effects.consume(code) + return headDelimiterFiller + } + + // Align is `center` if it was `left`, `right` otherwise. + if (code === codes.colon) { + seen = true + effects.exit('tableDelimiterFiller') + effects.enter('tableDelimiterMarker') + effects.consume(code) + effects.exit('tableDelimiterMarker') + return headDelimiterRightAlignmentAfter + } + + effects.exit('tableDelimiterFiller') + return headDelimiterRightAlignmentAfter(code) + } + + /** + * After delimiter cell right alignment marker. + * + * ```markdown + * | | a | + * > | | -: | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterRightAlignmentAfter(code) { + if (markdownSpace(code)) { + return factorySpace( + effects, + headDelimiterCellAfter, + types.whitespace + )(code) + } + + return headDelimiterCellAfter(code) + } + + /** + * After delimiter cell. + * + * ```markdown + * | | a | + * > | | -: | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterCellAfter(code) { + if (code === codes.verticalBar) { + return headDelimiterBefore(code) + } + + if (code === codes.eof || markdownLineEnding(code)) { + // Exit when: + // * there was no `:` or `|` at all (it’s a thematic break or setext + // underline instead) + // * the header cell count is not the delimiter cell count + if (!seen || size !== sizeB) { + return headDelimiterNok(code) + } + + // Note: in markdown-rs`, a reset is needed here. + effects.exit('tableDelimiterRow') + effects.exit('tableHead') + // To do: in `markdown-rs`, resolvers need to be registered manually. + // effects.register_resolver(ResolveName::GfmTable) + return ok(code) + } + + return headDelimiterNok(code) + } + + /** + * In delimiter row, at a disallowed byte. + * + * ```markdown + * | | a | + * > | | x | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterNok(code) { + // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don‘t. + return nok(code) + } + + /** + * Before table body row. + * + * ```markdown + * | | a | + * | | - | + * > | | b | + * ^ + * ``` + * + * @type {State} + */ + function bodyRowStart(code) { + // Note: in `markdown-rs` we need to manually take care of a prefix, + // but in `micromark-js` that is done for us, so if we’re here, we’re + // never at whitespace. + effects.enter('tableRow') + return bodyRowBreak(code) + } + + /** + * At break in table body row. + * + * ```markdown + * | | a | + * | | - | + * > | | b | + * ^ + * ^ + * ^ + * ``` + * + * @type {State} + */ + function bodyRowBreak(code) { + if (code === codes.verticalBar) { + effects.enter('tableCellDivider') + effects.consume(code) + effects.exit('tableCellDivider') + return bodyRowBreak + } + + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit('tableRow') + return ok(code) + } + + if (markdownSpace(code)) { + return factorySpace(effects, bodyRowBreak, types.whitespace)(code) + } + + // Anything else is cell content. + effects.enter(types.data) + return bodyRowData(code) + } + + /** + * In table body row data. + * + * ```markdown + * | | a | + * | | - | + * > | | b | + * ^ + * ``` + * + * @type {State} + */ + function bodyRowData(code) { + if ( + code === codes.eof || + code === codes.verticalBar || + markdownLineEndingOrSpace(code) + ) { + effects.exit(types.data) + return bodyRowBreak(code) + } + + effects.consume(code) + return code === codes.backslash ? bodyRowEscape : bodyRowData + } + + /** + * In table body row escape. + * + * ```markdown + * | | a | + * | | ---- | + * > | | b\-c | + * ^ + * ``` + * + * @type {State} + */ + function bodyRowEscape(code) { + if (code === codes.backslash || code === codes.verticalBar) { + effects.consume(code) + return bodyRowData + } + + return bodyRowData(code) + } +} + +/** @type {Resolver} */ + +function resolveTable(events, context) { + let index = -1 + let inFirstCellAwaitingPipe = true + /** @type {RowKind} */ + let rowKind = 0 + /** @type {Range} */ + let lastCell = [0, 0, 0, 0] + /** @type {Range} */ + let cell = [0, 0, 0, 0] + let afterHeadAwaitingFirstBodyRow = false + let lastTableEnd = 0 + /** @type {Token | undefined} */ + let currentTable + /** @type {Token | undefined} */ + let currentBody + /** @type {Token | undefined} */ + let currentCell + + const map = new EditMap() + + while (++index < events.length) { + const event = events[index] + const token = event[1] + + if (event[0] === 'enter') { + // Start of head. + if (token.type === 'tableHead') { + afterHeadAwaitingFirstBodyRow = false + + // Inject previous (body end and) table end. + if (lastTableEnd !== 0) { + assert(currentTable, 'there should be a table opening') + flushTableEnd(map, context, lastTableEnd, currentTable, currentBody) + currentBody = undefined + lastTableEnd = 0 + } + + // Inject table start. + currentTable = { + type: 'table', + start: Object.assign({}, token.start), + // Note: correct end is set later. + end: Object.assign({}, token.end) + } + map.add(index, 0, [['enter', currentTable, context]]) + } else if ( + token.type === 'tableRow' || + token.type === 'tableDelimiterRow' + ) { + inFirstCellAwaitingPipe = true + currentCell = undefined + lastCell = [0, 0, 0, 0] + cell = [0, index + 1, 0, 0] + + // Inject table body start. + if (afterHeadAwaitingFirstBodyRow) { + afterHeadAwaitingFirstBodyRow = false + currentBody = { + type: 'tableBody', + start: Object.assign({}, token.start), + // Note: correct end is set later. + end: Object.assign({}, token.end) + } + map.add(index, 0, [['enter', currentBody, context]]) + } + + rowKind = token.type === 'tableDelimiterRow' ? 2 : currentBody ? 3 : 1 + } + // Cell data. + else if ( + rowKind && + (token.type === types.data || + token.type === 'tableDelimiterMarker' || + token.type === 'tableDelimiterFiller') + ) { + inFirstCellAwaitingPipe = false + + // First value in cell. + if (cell[2] === 0) { + if (lastCell[1] !== 0) { + cell[0] = cell[1] + currentCell = flushCell( + map, + context, + lastCell, + rowKind, + undefined, + currentCell + ) + lastCell = [0, 0, 0, 0] + } + + cell[2] = index + } + } else if (token.type === 'tableCellDivider') { + if (inFirstCellAwaitingPipe) { + inFirstCellAwaitingPipe = false + } else { + if (lastCell[1] !== 0) { + cell[0] = cell[1] + currentCell = flushCell( + map, + context, + lastCell, + rowKind, + undefined, + currentCell + ) + } + + lastCell = cell + cell = [lastCell[1], index, 0, 0] + } + } + } + // Exit events. + else if (token.type === 'tableHead') { + afterHeadAwaitingFirstBodyRow = true + lastTableEnd = index + } else if ( + token.type === 'tableRow' || + token.type === 'tableDelimiterRow' + ) { + lastTableEnd = index + + if (lastCell[1] !== 0) { + cell[0] = cell[1] + currentCell = flushCell( + map, + context, + lastCell, + rowKind, + index, + currentCell + ) + } else if (cell[1] !== 0) { + currentCell = flushCell(map, context, cell, rowKind, index, currentCell) + } + + rowKind = 0 + } else if ( + rowKind && + (token.type === types.data || + token.type === 'tableDelimiterMarker' || + token.type === 'tableDelimiterFiller') + ) { + cell[3] = index + } + } + + if (lastTableEnd !== 0) { + assert(currentTable, 'expected table opening') + flushTableEnd(map, context, lastTableEnd, currentTable, currentBody) + } + + map.consume(context.events) + + // To do: move this into `html`, when events are exposed there. + // That’s what `markdown-rs` does. + // That needs updates to `mdast-util-gfm-table`. + index = -1 + while (++index < context.events.length) { + const event = context.events[index] + if (event[0] === 'enter' && event[1].type === 'table') { + event[1]._align = gfmTableAlign(context.events, index) + } + } + + return events +} + +/** + * Generate a cell. + * + * @param {EditMap} map + * @param {Readonly} context + * @param {Readonly} range + * @param {RowKind} rowKind + * @param {number | undefined} rowEnd + * @param {Token | undefined} previousCell + * @returns {Token | undefined} + */ +// eslint-disable-next-line max-params +function flushCell(map, context, range, rowKind, rowEnd, previousCell) { + // `markdown-rs` uses: + // rowKind === 2 ? 'tableDelimiterCell' : 'tableCell' + const groupName = + rowKind === 1 + ? 'tableHeader' + : rowKind === 2 + ? 'tableDelimiter' + : 'tableData' + // `markdown-rs` uses: + // rowKind === 2 ? 'tableDelimiterCellValue' : 'tableCellText' + const valueName = 'tableContent' + + // Insert an exit for the previous cell, if there is one. + // + // ```markdown + // > | | aa | bb | cc | + // ^-- exit + // ^^^^-- this cell + // ``` + if (range[0] !== 0) { + assert(previousCell, 'expected previous cell enter') + previousCell.end = Object.assign({}, getPoint(context.events, range[0])) + map.add(range[0], 0, [['exit', previousCell, context]]) + } + + // Insert enter of this cell. + // + // ```markdown + // > | | aa | bb | cc | + // ^-- enter + // ^^^^-- this cell + // ``` + const now = getPoint(context.events, range[1]) + previousCell = { + type: groupName, + start: Object.assign({}, now), + // Note: correct end is set later. + end: Object.assign({}, now) + } + map.add(range[1], 0, [['enter', previousCell, context]]) + + // Insert text start at first data start and end at last data end, and + // remove events between. + // + // ```markdown + // > | | aa | bb | cc | + // ^-- enter + // ^-- exit + // ^^^^-- this cell + // ``` + if (range[2] !== 0) { + const relatedStart = getPoint(context.events, range[2]) + const relatedEnd = getPoint(context.events, range[3]) + /** @type {Token} */ + const valueToken = { + type: valueName, + start: Object.assign({}, relatedStart), + end: Object.assign({}, relatedEnd) + } + map.add(range[2], 0, [['enter', valueToken, context]]) + assert(range[3] !== 0) + + if (rowKind !== 2) { + // Fix positional info on remaining events + const start = context.events[range[2]] + const end = context.events[range[3]] + start[1].end = Object.assign({}, end[1].end) + start[1].type = types.chunkText + start[1].contentType = constants.contentTypeText + + // Remove if needed. + if (range[3] > range[2] + 1) { + const a = range[2] + 1 + const b = range[3] - range[2] - 1 + map.add(a, b, []) + } + } + + map.add(range[3] + 1, 0, [['exit', valueToken, context]]) + } + + // Insert an exit for the last cell, if at the row end. + // + // ```markdown + // > | | aa | bb | cc | + // ^-- exit + // ^^^^^^-- this cell (the last one contains two “between” parts) + // ``` + if (rowEnd !== undefined) { + previousCell.end = Object.assign({}, getPoint(context.events, rowEnd)) + map.add(rowEnd, 0, [['exit', previousCell, context]]) + previousCell = undefined + } + + return previousCell +} + +/** + * Generate table end (and table body end). + * + * @param {Readonly} map + * @param {Readonly} context + * @param {number} index + * @param {Token} table + * @param {Token | undefined} tableBody + */ +// eslint-disable-next-line max-params +function flushTableEnd(map, context, index, table, tableBody) { + /** @type {Array} */ + const exits = [] + const related = getPoint(context.events, index) + + if (tableBody) { + tableBody.end = Object.assign({}, related) + exits.push(['exit', tableBody, context]) + } + + table.end = Object.assign({}, related) + exits.push(['exit', table, context]) + + map.add(index + 1, 0, exits) +} + +/** + * @param {Readonly>} events + * @param {number} index + * @returns {Readonly} + */ +function getPoint(events, index) { + const event = events[index] + const side = event[0] === 'enter' ? 'start' : 'end' + return event[1][side] +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be1a117c5c3383d1f194c56950bf7bcc32ad0652 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/index.d.ts @@ -0,0 +1,55 @@ +import type {Align} from './lib/infer.js' + +export {gfmTableHtml} from './lib/html.js' +export {gfmTable} from './lib/syntax.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * State tracked to compile events as HTML, + * extended by `micromark-extension-gfm-table`. + */ + interface CompileData { + /** + * Alignment of current table. + */ + tableAlign?: Array | undefined + /** + * Current table column. + */ + tableColumn?: number | undefined + } + + /** + * Augment token; + * `align` is patched on `table` tokens by + * `micromark-extension-gfm-table`. + */ + interface Token { + /** + * Alignment of current table. + */ + _align?: Array | undefined + } + + /** + * Map of allowed token types, + * extended by `micromark-extension-gfm-table`. + */ + interface TokenTypeMap { + tableBody: 'tableBody' + tableCellDivider: 'tableCellDivider' + tableContent: 'tableContent' + tableData: 'tableData' + tableDelimiterFiller: 'tableDelimiterFiller' + tableDelimiterMarker: 'tableDelimiterMarker' + tableDelimiterRow: 'tableDelimiterRow' + tableDelimiter: 'tableDelimiter' + tableHeader: 'tableHeader' + tableHead: 'tableHead' + tableRow: 'tableRow' + table: 'table' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/index.js b/tools/ui/node_modules/micromark-extension-gfm-table/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8f9afc67d3937d2bd808e29721f1209ae1ae0885 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/index.js @@ -0,0 +1,2 @@ +export { gfmTableHtml } from './lib/html.js'; +export { gfmTable } from './lib/syntax.js'; \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..02da6f3ec111888fc55dc5e4e6ac71878d3cf44d --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts @@ -0,0 +1,38 @@ +/** + * @import {Event} from 'micromark-util-types' + */ +/** + * @typedef {[number, number, Array]} Change + * @typedef {[number, number, number]} Jump + */ +/** + * Tracks a bunch of edits. + */ +export class EditMap { + /** + * Record of changes. + * + * @type {Array} + */ + map: Array; + /** + * Create an edit: a remove and/or add at a certain place. + * + * @param {number} index + * @param {number} remove + * @param {Array} add + * @returns {undefined} + */ + add(index: number, remove: number, add: Array): undefined; + /** + * Done, change the events. + * + * @param {Array} events + * @returns {undefined} + */ + consume(events: Array): undefined; +} +export type Change = [number, number, Array]; +export type Jump = [number, number, number]; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=edit-map.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts.map b/tools/ui/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b522a04952b1d63ebc817b1fa37639ae76619536 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/edit-map.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"edit-map.d.ts","sourceRoot":"","sources":["edit-map.js"],"names":[],"mappings":"AAAA;;GAEG;AAeH;;;GAGG;AAEH;;GAEG;AACH;IAKI;;;;OAIG;IACH,KAFU,KAAK,CAAC,MAAM,CAAC,CAEV;IAGf;;;;;;;OAOG;IACH,WALW,MAAM,UACN,MAAM,OACN,KAAK,CAAC,KAAK,CAAC,GACV,SAAS,CAIrB;IAeD;;;;;OAKG;IACH,gBAHW,KAAK,CAAC,KAAK,CAAC,GACV,SAAS,CA2DrB;CACF;qBA7GY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;mBAC9B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;2BAlBb,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/edit-map.js b/tools/ui/node_modules/micromark-extension-gfm-table/lib/edit-map.js new file mode 100644 index 0000000000000000000000000000000000000000..ecc8bce784d29a48e0869be1c4a2dd5ccf1d3d01 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/edit-map.js @@ -0,0 +1,202 @@ +/** + * @import {Event} from 'micromark-util-types' + */ + +// Port of `edit_map.rs` from `markdown-rs`. +// This should move to `markdown-js` later. + +// Deal with several changes in events, batching them together. +// +// Preferably, changes should be kept to a minimum. +// Sometimes, it’s needed to change the list of events, because parsing can be +// messy, and it helps to expose a cleaner interface of events to the compiler +// and other users. +// It can also help to merge many adjacent similar events. +// And, in other cases, it’s needed to parse subcontent: pass some events +// through another tokenizer and inject the result. + +/** + * @typedef {[number, number, Array]} Change + * @typedef {[number, number, number]} Jump + */ + +/** + * Tracks a bunch of edits. + */ +export class EditMap { + /** + * Create a new edit map. + */ + constructor() { + /** + * Record of changes. + * + * @type {Array} + */ + this.map = []; + } + + /** + * Create an edit: a remove and/or add at a certain place. + * + * @param {number} index + * @param {number} remove + * @param {Array} add + * @returns {undefined} + */ + add(index, remove, add) { + addImplementation(this, index, remove, add); + } + + // To do: add this when moving to `micromark`. + // /** + // * Create an edit: but insert `add` before existing additions. + // * + // * @param {number} index + // * @param {number} remove + // * @param {Array} add + // * @returns {undefined} + // */ + // addBefore(index, remove, add) { + // addImplementation(this, index, remove, add, true) + // } + + /** + * Done, change the events. + * + * @param {Array} events + * @returns {undefined} + */ + consume(events) { + this.map.sort(function (a, b) { + return a[0] - b[0]; + }); + + /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */ + if (this.map.length === 0) { + return; + } + + // To do: if links are added in events, like they are in `markdown-rs`, + // this is needed. + // // Calculate jumps: where items in the current list move to. + // /** @type {Array} */ + // const jumps = [] + // let index = 0 + // let addAcc = 0 + // let removeAcc = 0 + // while (index < this.map.length) { + // const [at, remove, add] = this.map[index] + // removeAcc += remove + // addAcc += add.length + // jumps.push([at, removeAcc, addAcc]) + // index += 1 + // } + // + // . shiftLinks(events, jumps) + + let index = this.map.length; + /** @type {Array>} */ + const vecs = []; + while (index > 0) { + index -= 1; + vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]); + + // Truncate rest. + events.length = this.map[index][0]; + } + vecs.push(events.slice()); + events.length = 0; + let slice = vecs.pop(); + while (slice) { + for (const element of slice) { + events.push(element); + } + slice = vecs.pop(); + } + + // Truncate everything. + this.map.length = 0; + } +} + +/** + * Create an edit. + * + * @param {EditMap} editMap + * @param {number} at + * @param {number} remove + * @param {Array} add + * @returns {undefined} + */ +function addImplementation(editMap, at, remove, add) { + let index = 0; + + /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */ + if (remove === 0 && add.length === 0) { + return; + } + while (index < editMap.map.length) { + if (editMap.map[index][0] === at) { + editMap.map[index][1] += remove; + + // To do: before not used by tables, use when moving to micromark. + // if (before) { + // add.push(...editMap.map[index][2]) + // editMap.map[index][2] = add + // } else { + editMap.map[index][2].push(...add); + // } + + return; + } + index += 1; + } + editMap.map.push([at, remove, add]); +} + +// /** +// * Shift `previous` and `next` links according to `jumps`. +// * +// * This fixes links in case there are events removed or added between them. +// * +// * @param {Array} events +// * @param {Array} jumps +// */ +// function shiftLinks(events, jumps) { +// let jumpIndex = 0 +// let index = 0 +// let add = 0 +// let rm = 0 + +// while (index < events.length) { +// const rmCurr = rm + +// while (jumpIndex < jumps.length && jumps[jumpIndex][0] <= index) { +// add = jumps[jumpIndex][2] +// rm = jumps[jumpIndex][1] +// jumpIndex += 1 +// } + +// // Ignore items that will be removed. +// if (rm > rmCurr) { +// index += rm - rmCurr +// } else { +// // ? +// // if let Some(link) = &events[index].link { +// // if let Some(next) = link.next { +// // events[next].link.as_mut().unwrap().previous = Some(index + add - rm); +// // while jumpIndex < jumps.len() && jumps[jumpIndex].0 <= next { +// // add = jumps[jumpIndex].2; +// // rm = jumps[jumpIndex].1; +// // jumpIndex += 1; +// // } +// // events[index].link.as_mut().unwrap().next = Some(next + add - rm); +// // index = next; +// // continue; +// // } +// // } +// index += 1 +// } +// } +// } \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e4d6696020cd66e121e9cd87f2811e44146da75 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/html.d.ts @@ -0,0 +1,11 @@ +/** + * Create an HTML extension for `micromark` to support GitHub tables when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GitHub tables when serializing to HTML. + */ +export function gfmTableHtml(): HtmlExtension; +import type { HtmlExtension } from 'micromark-util-types'; +//# sourceMappingURL=html.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/html.d.ts.map b/tools/ui/node_modules/micromark-extension-gfm-table/lib/html.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..102bdf290ca0c6151bc963fdd563675da9c72df9 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/html.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["html.js"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,gCAJa,aAAa,CAsHzB;mCAxI+B,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-table/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..5c944a8f7bd7cc7de37d72469ed19f645c9bdbda --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/html.js @@ -0,0 +1,130 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ + +const alignment = { + none: '', + left: ' align="left"', + right: ' align="right"', + center: ' align="center"' +}; + +// To do: micromark@5: use `infer` here, when all events are exposed. + +/** + * Create an HTML extension for `micromark` to support GitHub tables when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GitHub tables when serializing to HTML. + */ +export function gfmTableHtml() { + return { + enter: { + table(token) { + const tableAlign = token._align; + this.lineEndingIfNeeded(); + this.tag(''); + this.setData('tableAlign', tableAlign); + }, + tableBody() { + this.tag(''); + }, + tableData() { + const tableAlign = this.getData('tableAlign'); + const tableColumn = this.getData('tableColumn'); + const align = alignment[tableAlign[tableColumn]]; + if (align === undefined) { + // Capture results to ignore them. + this.buffer(); + } else { + this.lineEndingIfNeeded(); + this.tag(''); + } + }, + tableHead() { + this.lineEndingIfNeeded(); + this.tag(''); + }, + tableHeader() { + const tableAlign = this.getData('tableAlign'); + const tableColumn = this.getData('tableColumn'); + const align = alignment[tableAlign[tableColumn]]; + this.lineEndingIfNeeded(); + this.tag(''); + }, + tableRow() { + this.setData('tableColumn', 0); + this.lineEndingIfNeeded(); + this.tag(''); + } + }, + exit: { + // Overwrite the default code text data handler to unescape escaped pipes when + // they are in tables. + codeTextData(token) { + let value = this.sliceSerialize(token); + if (this.getData('tableAlign')) { + value = value.replace(/\\([\\|])/g, replace); + } + this.raw(this.encode(value)); + }, + table() { + this.setData('tableAlign'); + // Note: we don’t set `slurpAllLineEndings` anymore, in delimiter rows, + // but we do need to reset it to match a funky newline GH generates for + // list items combined with tables. + this.setData('slurpAllLineEndings'); + this.lineEndingIfNeeded(); + this.tag('
        '); + }, + tableBody() { + this.lineEndingIfNeeded(); + this.tag(''); + }, + tableData() { + const tableAlign = this.getData('tableAlign'); + const tableColumn = this.getData('tableColumn'); + if (tableColumn in tableAlign) { + this.tag(''); + this.setData('tableColumn', tableColumn + 1); + } else { + // Stop capturing. + this.resume(); + } + }, + tableHead() { + this.lineEndingIfNeeded(); + this.tag(''); + }, + tableHeader() { + const tableColumn = this.getData('tableColumn'); + this.tag(''); + this.setData('tableColumn', tableColumn + 1); + }, + tableRow() { + const tableAlign = this.getData('tableAlign'); + let tableColumn = this.getData('tableColumn'); + while (tableColumn < tableAlign.length) { + this.lineEndingIfNeeded(); + this.tag(''); + tableColumn++; + } + this.setData('tableColumn', tableColumn); + this.lineEndingIfNeeded(); + this.tag(''); + } + } + }; +} + +/** + * @param {string} $0 + * @param {string} $1 + * @returns {string} + */ +function replace($0, $1) { + // Pipes work, backslashes don’t (but can’t escape pipes). + return $1 === '|' ? $1 : $0; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/infer.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/lib/infer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e55881efdde461efa55bea7c47ad9893dc864b20 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/infer.d.ts @@ -0,0 +1,14 @@ +/** + * Figure out the alignment of a GFM table. + * + * @param {Readonly>} events + * List of events. + * @param {number} index + * Table enter event. + * @returns {Array} + * List of aligns. + */ +export function gfmTableAlign(events: Readonly>, index: number): Array; +export type Align = "center" | "left" | "none" | "right"; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=infer.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/infer.d.ts.map b/tools/ui/node_modules/micromark-extension-gfm-table/lib/infer.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c5b12c1ade8d3a0cbb44389f567a3002068b19dc --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/infer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"infer.d.ts","sourceRoot":"","sources":["infer.js"],"names":[],"mappings":"AAUA;;;;;;;;;GASG;AACH,sCAPW,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,SAEtB,MAAM,GAEJ,KAAK,CAAC,KAAK,CAAC,CA8CxB;oBA1DY,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO;2BAJzB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/infer.js b/tools/ui/node_modules/micromark-extension-gfm-table/lib/infer.js new file mode 100644 index 0000000000000000000000000000000000000000..750f2fde30fbeda52a03a400fc45c1ddc26db595 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/infer.js @@ -0,0 +1,52 @@ +/** + * @import {Event} from 'micromark-util-types' + */ + +/** + * @typedef {'center' | 'left' | 'none' | 'right'} Align + */ + +/** + * Figure out the alignment of a GFM table. + * + * @param {Readonly>} events + * List of events. + * @param {number} index + * Table enter event. + * @returns {Array} + * List of aligns. + */ +export function gfmTableAlign(events, index) { + let inDelimiterRow = false; + /** @type {Array} */ + const align = []; + while (index < events.length) { + const event = events[index]; + if (inDelimiterRow) { + if (event[0] === 'enter') { + // Start of alignment value: set a new column. + // To do: `markdown-rs` uses `tableDelimiterCellValue`. + if (event[1].type === 'tableContent') { + align.push(events[index + 1][1].type === 'tableDelimiterMarker' ? 'left' : 'none'); + } + } + // Exits: + // End of alignment value: change the column. + // To do: `markdown-rs` uses `tableDelimiterCellValue`. + else if (event[1].type === 'tableContent') { + if (events[index - 1][1].type === 'tableDelimiterMarker') { + const alignIndex = align.length - 1; + align[alignIndex] = align[alignIndex] === 'left' ? 'center' : 'right'; + } + } + // Done! + else if (event[1].type === 'tableDelimiterRow') { + break; + } + } else if (event[0] === 'enter' && event[1].type === 'tableDelimiterRow') { + inDelimiterRow = true; + } + index += 1; + } + return align; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecac018a28abeb8490d4e9df56c659b2aa93fcec --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts @@ -0,0 +1,18 @@ +/** + * Create an HTML extension for `micromark` to support GitHub tables syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * table syntax. + */ +export function gfmTable(): Extension; +/** + * Cell info. + */ +export type Range = [number, number, number, number]; +/** + * Where we are: `1` for head row, `2` for delimiter row, `3` for body row. + */ +export type RowKind = 0 | 1 | 2 | 3; +import type { Extension } from 'micromark-util-types'; +//# sourceMappingURL=syntax.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts.map b/tools/ui/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..01eedacae562189b56aa95f1925da210f999cfa9 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/syntax.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"syntax.d.ts","sourceRoot":"","sources":["syntax.js"],"names":[],"mappings":"AAuBA;;;;;;GAMG;AACH,4BAJa,SAAS,CAUrB;;;;oBA/BY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;;;;sBAGhC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;+BAPoE,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-table/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..00b45b02adb80dd2daf12a4a5dbf78ee80e0e83a --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/lib/syntax.js @@ -0,0 +1,819 @@ +/** + * @import {Event, Extension, Point, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +/** + * @typedef {[number, number, number, number]} Range + * Cell info. + * + * @typedef {0 | 1 | 2 | 3} RowKind + * Where we are: `1` for head row, `2` for delimiter row, `3` for body row. + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character'; +import { EditMap } from './edit-map.js'; +import { gfmTableAlign } from './infer.js'; + +/** + * Create an HTML extension for `micromark` to support GitHub tables syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * table syntax. + */ +export function gfmTable() { + return { + flow: { + null: { + name: 'table', + tokenize: tokenizeTable, + resolveAll: resolveTable + } + } + }; +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeTable(effects, ok, nok) { + const self = this; + let size = 0; + let sizeB = 0; + /** @type {boolean | undefined} */ + let seen; + return start; + + /** + * Start of a GFM table. + * + * If there is a valid table row or table head before, then we try to parse + * another row. + * Otherwise, we try to parse a head. + * + * ```markdown + * > | | a | + * ^ + * | | - | + * > | | b | + * ^ + * ``` + * @type {State} + */ + function start(code) { + let index = self.events.length - 1; + while (index > -1) { + const type = self.events[index][1].type; + if (type === "lineEnding" || + // Note: markdown-rs uses `whitespace` instead of `linePrefix` + type === "linePrefix") index--;else break; + } + const tail = index > -1 ? self.events[index][1].type : null; + const next = tail === 'tableHead' || tail === 'tableRow' ? bodyRowStart : headRowBefore; + + // Don’t allow lazy body rows. + if (next === bodyRowStart && self.parser.lazy[self.now().line]) { + return nok(code); + } + return next(code); + } + + /** + * Before table head row. + * + * ```markdown + * > | | a | + * ^ + * | | - | + * | | b | + * ``` + * + * @type {State} + */ + function headRowBefore(code) { + effects.enter('tableHead'); + effects.enter('tableRow'); + return headRowStart(code); + } + + /** + * Before table head row, after whitespace. + * + * ```markdown + * > | | a | + * ^ + * | | - | + * | | b | + * ``` + * + * @type {State} + */ + function headRowStart(code) { + if (code === 124) { + return headRowBreak(code); + } + + // To do: micromark-js should let us parse our own whitespace in extensions, + // like `markdown-rs`: + // + // ```js + // // 4+ spaces. + // if (markdownSpace(code)) { + // return nok(code) + // } + // ``` + + seen = true; + // Count the first character, that isn’t a pipe, double. + sizeB += 1; + return headRowBreak(code); + } + + /** + * At break in table head row. + * + * ```markdown + * > | | a | + * ^ + * ^ + * ^ + * | | - | + * | | b | + * ``` + * + * @type {State} + */ + function headRowBreak(code) { + if (code === null) { + // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don‘t. + return nok(code); + } + if (markdownLineEnding(code)) { + // If anything other than one pipe (ignoring whitespace) was used, it’s fine. + if (sizeB > 1) { + sizeB = 0; + // To do: check if this works. + // Feel free to interrupt: + self.interrupt = true; + effects.exit('tableRow'); + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return headDelimiterStart; + } + + // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don‘t. + return nok(code); + } + if (markdownSpace(code)) { + // To do: check if this is fine. + // effects.attempt(State::Next(StateName::GfmTableHeadRowBreak), State::Nok) + // State::Retry(space_or_tab(tokenizer)) + return factorySpace(effects, headRowBreak, "whitespace")(code); + } + sizeB += 1; + if (seen) { + seen = false; + // Header cell count. + size += 1; + } + if (code === 124) { + effects.enter('tableCellDivider'); + effects.consume(code); + effects.exit('tableCellDivider'); + // Whether a delimiter was seen. + seen = true; + return headRowBreak; + } + + // Anything else is cell data. + effects.enter("data"); + return headRowData(code); + } + + /** + * In table head row data. + * + * ```markdown + * > | | a | + * ^ + * | | - | + * | | b | + * ``` + * + * @type {State} + */ + function headRowData(code) { + if (code === null || code === 124 || markdownLineEndingOrSpace(code)) { + effects.exit("data"); + return headRowBreak(code); + } + effects.consume(code); + return code === 92 ? headRowEscape : headRowData; + } + + /** + * In table head row escape. + * + * ```markdown + * > | | a\-b | + * ^ + * | | ---- | + * | | c | + * ``` + * + * @type {State} + */ + function headRowEscape(code) { + if (code === 92 || code === 124) { + effects.consume(code); + return headRowData; + } + return headRowData(code); + } + + /** + * Before delimiter row. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * | | b | + * ``` + * + * @type {State} + */ + function headDelimiterStart(code) { + // Reset `interrupt`. + self.interrupt = false; + + // Note: in `markdown-rs`, we need to handle piercing here too. + if (self.parser.lazy[self.now().line]) { + return nok(code); + } + effects.enter('tableDelimiterRow'); + // Track if we’ve seen a `:` or `|`. + seen = false; + if (markdownSpace(code)) { + return factorySpace(effects, headDelimiterBefore, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code); + } + return headDelimiterBefore(code); + } + + /** + * Before delimiter row, after optional whitespace. + * + * Reused when a `|` is found later, to parse another cell. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * | | b | + * ``` + * + * @type {State} + */ + function headDelimiterBefore(code) { + if (code === 45 || code === 58) { + return headDelimiterValueBefore(code); + } + if (code === 124) { + seen = true; + // If we start with a pipe, we open a cell marker. + effects.enter('tableCellDivider'); + effects.consume(code); + effects.exit('tableCellDivider'); + return headDelimiterCellBefore; + } + + // More whitespace / empty row not allowed at start. + return headDelimiterNok(code); + } + + /** + * After `|`, before delimiter cell. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterCellBefore(code) { + if (markdownSpace(code)) { + return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code); + } + return headDelimiterValueBefore(code); + } + + /** + * Before delimiter cell value. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterValueBefore(code) { + // Align: left. + if (code === 58) { + sizeB += 1; + seen = true; + effects.enter('tableDelimiterMarker'); + effects.consume(code); + effects.exit('tableDelimiterMarker'); + return headDelimiterLeftAlignmentAfter; + } + + // Align: none. + if (code === 45) { + sizeB += 1; + // To do: seems weird that this *isn’t* left aligned, but that state is used? + return headDelimiterLeftAlignmentAfter(code); + } + if (code === null || markdownLineEnding(code)) { + return headDelimiterCellAfter(code); + } + return headDelimiterNok(code); + } + + /** + * After delimiter cell left alignment marker. + * + * ```markdown + * | | a | + * > | | :- | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterLeftAlignmentAfter(code) { + if (code === 45) { + effects.enter('tableDelimiterFiller'); + return headDelimiterFiller(code); + } + + // Anything else is not ok after the left-align colon. + return headDelimiterNok(code); + } + + /** + * In delimiter cell filler. + * + * ```markdown + * | | a | + * > | | - | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterFiller(code) { + if (code === 45) { + effects.consume(code); + return headDelimiterFiller; + } + + // Align is `center` if it was `left`, `right` otherwise. + if (code === 58) { + seen = true; + effects.exit('tableDelimiterFiller'); + effects.enter('tableDelimiterMarker'); + effects.consume(code); + effects.exit('tableDelimiterMarker'); + return headDelimiterRightAlignmentAfter; + } + effects.exit('tableDelimiterFiller'); + return headDelimiterRightAlignmentAfter(code); + } + + /** + * After delimiter cell right alignment marker. + * + * ```markdown + * | | a | + * > | | -: | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterRightAlignmentAfter(code) { + if (markdownSpace(code)) { + return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code); + } + return headDelimiterCellAfter(code); + } + + /** + * After delimiter cell. + * + * ```markdown + * | | a | + * > | | -: | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterCellAfter(code) { + if (code === 124) { + return headDelimiterBefore(code); + } + if (code === null || markdownLineEnding(code)) { + // Exit when: + // * there was no `:` or `|` at all (it’s a thematic break or setext + // underline instead) + // * the header cell count is not the delimiter cell count + if (!seen || size !== sizeB) { + return headDelimiterNok(code); + } + + // Note: in markdown-rs`, a reset is needed here. + effects.exit('tableDelimiterRow'); + effects.exit('tableHead'); + // To do: in `markdown-rs`, resolvers need to be registered manually. + // effects.register_resolver(ResolveName::GfmTable) + return ok(code); + } + return headDelimiterNok(code); + } + + /** + * In delimiter row, at a disallowed byte. + * + * ```markdown + * | | a | + * > | | x | + * ^ + * ``` + * + * @type {State} + */ + function headDelimiterNok(code) { + // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don‘t. + return nok(code); + } + + /** + * Before table body row. + * + * ```markdown + * | | a | + * | | - | + * > | | b | + * ^ + * ``` + * + * @type {State} + */ + function bodyRowStart(code) { + // Note: in `markdown-rs` we need to manually take care of a prefix, + // but in `micromark-js` that is done for us, so if we’re here, we’re + // never at whitespace. + effects.enter('tableRow'); + return bodyRowBreak(code); + } + + /** + * At break in table body row. + * + * ```markdown + * | | a | + * | | - | + * > | | b | + * ^ + * ^ + * ^ + * ``` + * + * @type {State} + */ + function bodyRowBreak(code) { + if (code === 124) { + effects.enter('tableCellDivider'); + effects.consume(code); + effects.exit('tableCellDivider'); + return bodyRowBreak; + } + if (code === null || markdownLineEnding(code)) { + effects.exit('tableRow'); + return ok(code); + } + if (markdownSpace(code)) { + return factorySpace(effects, bodyRowBreak, "whitespace")(code); + } + + // Anything else is cell content. + effects.enter("data"); + return bodyRowData(code); + } + + /** + * In table body row data. + * + * ```markdown + * | | a | + * | | - | + * > | | b | + * ^ + * ``` + * + * @type {State} + */ + function bodyRowData(code) { + if (code === null || code === 124 || markdownLineEndingOrSpace(code)) { + effects.exit("data"); + return bodyRowBreak(code); + } + effects.consume(code); + return code === 92 ? bodyRowEscape : bodyRowData; + } + + /** + * In table body row escape. + * + * ```markdown + * | | a | + * | | ---- | + * > | | b\-c | + * ^ + * ``` + * + * @type {State} + */ + function bodyRowEscape(code) { + if (code === 92 || code === 124) { + effects.consume(code); + return bodyRowData; + } + return bodyRowData(code); + } +} + +/** @type {Resolver} */ + +function resolveTable(events, context) { + let index = -1; + let inFirstCellAwaitingPipe = true; + /** @type {RowKind} */ + let rowKind = 0; + /** @type {Range} */ + let lastCell = [0, 0, 0, 0]; + /** @type {Range} */ + let cell = [0, 0, 0, 0]; + let afterHeadAwaitingFirstBodyRow = false; + let lastTableEnd = 0; + /** @type {Token | undefined} */ + let currentTable; + /** @type {Token | undefined} */ + let currentBody; + /** @type {Token | undefined} */ + let currentCell; + const map = new EditMap(); + while (++index < events.length) { + const event = events[index]; + const token = event[1]; + if (event[0] === 'enter') { + // Start of head. + if (token.type === 'tableHead') { + afterHeadAwaitingFirstBodyRow = false; + + // Inject previous (body end and) table end. + if (lastTableEnd !== 0) { + flushTableEnd(map, context, lastTableEnd, currentTable, currentBody); + currentBody = undefined; + lastTableEnd = 0; + } + + // Inject table start. + currentTable = { + type: 'table', + start: Object.assign({}, token.start), + // Note: correct end is set later. + end: Object.assign({}, token.end) + }; + map.add(index, 0, [['enter', currentTable, context]]); + } else if (token.type === 'tableRow' || token.type === 'tableDelimiterRow') { + inFirstCellAwaitingPipe = true; + currentCell = undefined; + lastCell = [0, 0, 0, 0]; + cell = [0, index + 1, 0, 0]; + + // Inject table body start. + if (afterHeadAwaitingFirstBodyRow) { + afterHeadAwaitingFirstBodyRow = false; + currentBody = { + type: 'tableBody', + start: Object.assign({}, token.start), + // Note: correct end is set later. + end: Object.assign({}, token.end) + }; + map.add(index, 0, [['enter', currentBody, context]]); + } + rowKind = token.type === 'tableDelimiterRow' ? 2 : currentBody ? 3 : 1; + } + // Cell data. + else if (rowKind && (token.type === "data" || token.type === 'tableDelimiterMarker' || token.type === 'tableDelimiterFiller')) { + inFirstCellAwaitingPipe = false; + + // First value in cell. + if (cell[2] === 0) { + if (lastCell[1] !== 0) { + cell[0] = cell[1]; + currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell); + lastCell = [0, 0, 0, 0]; + } + cell[2] = index; + } + } else if (token.type === 'tableCellDivider') { + if (inFirstCellAwaitingPipe) { + inFirstCellAwaitingPipe = false; + } else { + if (lastCell[1] !== 0) { + cell[0] = cell[1]; + currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell); + } + lastCell = cell; + cell = [lastCell[1], index, 0, 0]; + } + } + } + // Exit events. + else if (token.type === 'tableHead') { + afterHeadAwaitingFirstBodyRow = true; + lastTableEnd = index; + } else if (token.type === 'tableRow' || token.type === 'tableDelimiterRow') { + lastTableEnd = index; + if (lastCell[1] !== 0) { + cell[0] = cell[1]; + currentCell = flushCell(map, context, lastCell, rowKind, index, currentCell); + } else if (cell[1] !== 0) { + currentCell = flushCell(map, context, cell, rowKind, index, currentCell); + } + rowKind = 0; + } else if (rowKind && (token.type === "data" || token.type === 'tableDelimiterMarker' || token.type === 'tableDelimiterFiller')) { + cell[3] = index; + } + } + if (lastTableEnd !== 0) { + flushTableEnd(map, context, lastTableEnd, currentTable, currentBody); + } + map.consume(context.events); + + // To do: move this into `html`, when events are exposed there. + // That’s what `markdown-rs` does. + // That needs updates to `mdast-util-gfm-table`. + index = -1; + while (++index < context.events.length) { + const event = context.events[index]; + if (event[0] === 'enter' && event[1].type === 'table') { + event[1]._align = gfmTableAlign(context.events, index); + } + } + return events; +} + +/** + * Generate a cell. + * + * @param {EditMap} map + * @param {Readonly} context + * @param {Readonly} range + * @param {RowKind} rowKind + * @param {number | undefined} rowEnd + * @param {Token | undefined} previousCell + * @returns {Token | undefined} + */ +// eslint-disable-next-line max-params +function flushCell(map, context, range, rowKind, rowEnd, previousCell) { + // `markdown-rs` uses: + // rowKind === 2 ? 'tableDelimiterCell' : 'tableCell' + const groupName = rowKind === 1 ? 'tableHeader' : rowKind === 2 ? 'tableDelimiter' : 'tableData'; + // `markdown-rs` uses: + // rowKind === 2 ? 'tableDelimiterCellValue' : 'tableCellText' + const valueName = 'tableContent'; + + // Insert an exit for the previous cell, if there is one. + // + // ```markdown + // > | | aa | bb | cc | + // ^-- exit + // ^^^^-- this cell + // ``` + if (range[0] !== 0) { + previousCell.end = Object.assign({}, getPoint(context.events, range[0])); + map.add(range[0], 0, [['exit', previousCell, context]]); + } + + // Insert enter of this cell. + // + // ```markdown + // > | | aa | bb | cc | + // ^-- enter + // ^^^^-- this cell + // ``` + const now = getPoint(context.events, range[1]); + previousCell = { + type: groupName, + start: Object.assign({}, now), + // Note: correct end is set later. + end: Object.assign({}, now) + }; + map.add(range[1], 0, [['enter', previousCell, context]]); + + // Insert text start at first data start and end at last data end, and + // remove events between. + // + // ```markdown + // > | | aa | bb | cc | + // ^-- enter + // ^-- exit + // ^^^^-- this cell + // ``` + if (range[2] !== 0) { + const relatedStart = getPoint(context.events, range[2]); + const relatedEnd = getPoint(context.events, range[3]); + /** @type {Token} */ + const valueToken = { + type: valueName, + start: Object.assign({}, relatedStart), + end: Object.assign({}, relatedEnd) + }; + map.add(range[2], 0, [['enter', valueToken, context]]); + if (rowKind !== 2) { + // Fix positional info on remaining events + const start = context.events[range[2]]; + const end = context.events[range[3]]; + start[1].end = Object.assign({}, end[1].end); + start[1].type = "chunkText"; + start[1].contentType = "text"; + + // Remove if needed. + if (range[3] > range[2] + 1) { + const a = range[2] + 1; + const b = range[3] - range[2] - 1; + map.add(a, b, []); + } + } + map.add(range[3] + 1, 0, [['exit', valueToken, context]]); + } + + // Insert an exit for the last cell, if at the row end. + // + // ```markdown + // > | | aa | bb | cc | + // ^-- exit + // ^^^^^^-- this cell (the last one contains two “between” parts) + // ``` + if (rowEnd !== undefined) { + previousCell.end = Object.assign({}, getPoint(context.events, rowEnd)); + map.add(rowEnd, 0, [['exit', previousCell, context]]); + previousCell = undefined; + } + return previousCell; +} + +/** + * Generate table end (and table body end). + * + * @param {Readonly} map + * @param {Readonly} context + * @param {number} index + * @param {Token} table + * @param {Token | undefined} tableBody + */ +// eslint-disable-next-line max-params +function flushTableEnd(map, context, index, table, tableBody) { + /** @type {Array} */ + const exits = []; + const related = getPoint(context.events, index); + if (tableBody) { + tableBody.end = Object.assign({}, related); + exits.push(['exit', tableBody, context]); + } + table.end = Object.assign({}, related); + exits.push(['exit', table, context]); + map.add(index + 1, 0, exits); +} + +/** + * @param {Readonly>} events + * @param {number} index + * @returns {Readonly} + */ +function getPoint(events, index) { + const event = events[index]; + const side = event[0] === 'enter' ? 'start' : 'end'; + return event[1][side]; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/license b/tools/ui/node_modules/micromark-extension-gfm-table/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/package.json b/tools/ui/node_modules/micromark-extension-gfm-table/package.json new file mode 100644 index 0000000000000000000000000000000000000000..89261b93d743af1eaa786e230c84737398250989 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/package.json @@ -0,0 +1,128 @@ +{ + "author": "Titus Wormer (https://wooorm.com)", + "bugs": "https://github.com/micromark/micromark-extension-gfm-table/issues", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "description": "micromark extension to support GFM tables", + "devDependencies": { + "@types/node": "^22.0.0", + "c8": "^10.0.0", + "create-gfm-fixtures": "^2.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.60.0" + }, + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "files": [ + "dev/", + "index.d.ts", + "index.js", + "lib/" + ], + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "keywords": [ + "cell", + "column", + "gfm", + "markdown", + "micromark-extension", + "micromark", + "row", + "table", + "tabular", + "unified" + ], + "license": "MIT", + "name": "micromark-extension-gfm-table", + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "repository": "micromark/micromark-extension-gfm-table", + "scripts": { + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark --frail --quiet --output -- . && prettier --log-level warn --write -- . && xo --fix", + "test-api-dev": "node --conditions development test/index.js", + "test-api-prod": "node --conditions production test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov -- npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "sideEffects": false, + "typeCoverage": { + "atLeast": 100, + "strict": true + }, + "type": "module", + "version": "2.1.1", + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "no-await-in-loop": "off" + } + } + ], + "prettier": true, + "rules": { + "complexity": "off", + "max-depth": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-table/readme.md b/tools/ui/node_modules/micromark-extension-gfm-table/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..2f437ab54e9648f4a116c9f7d0e37e4452d2a6f3 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-table/readme.md @@ -0,0 +1,515 @@ +# micromark-extension-gfm-table + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [tables][]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmTable()`](#gfmtable) + * [`gfmTableHtml()`](#gfmtablehtml) +* [Bugs](#bugs) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for the table syntax enabled +by GFM to [`micromark`][micromark]. +These extensions match github.com. + +## When to use this + +This project is useful when you want to support tables in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm] instead. + +When you need a syntax tree, combine this package with +[`mdast-util-gfm-table`][mdast-util-gfm-table]. + +All these packages are used in [`remark-gfm`][remark-gfm], which focusses on +making it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-table +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmTable, gfmTableHtml} from 'https://esm.sh/micromark-extension-gfm-table@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table' + +const output = micromark('| a |\n| - |', { + extensions: [gfmTable()], + htmlExtensions: [gfmTableHtml()] +}) + +console.log(output) +``` + +Yields: + +```html + + + + + + +
        a
        +``` + +## API + +This package exports the identifiers [`gfmTable`][api-gfm-table] and +[`gfmTableHtml`][api-gfm-table-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfmTable()` + +Create an HTML extension for `micromark` to support GitHub tables syntax. + +###### Returns + +Extension for `micromark` that can be passed in `extensions` to enable GFM +table syntax ([`Extension`][micromark-extension]). + +### `gfmTableHtml()` + +Create an HTML extension for `micromark` to support GitHub tables when +serializing to HTML. + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support +GFM tables when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +## Bugs + +GitHub’s own algorithm to parse tables contains a bug. +This bug is not present in this project. +The issue relating to tables is: + +* [GFM tables: escaped escapes are incorrectly treated as + escapes](https://github.com/github/cmark-gfm/issues/277) + +## Authoring + +When authoring markdown with GFM tables, it’s recommended to *always* put +pipes around cells. +Without them, it can be hard to infer whether the table will work, how many +columns there are, and which column you are currently editing. + +It is recommended to not use many columns, as it results in very long lines, +making it hard to infer which column you are currently editing. + +For larger tables, particularly when cells vary in size, it is recommended +*not* to manually “pad” cell text. +While it can look better, it results in a lot of time spent realigning +everything when a new, longer cell is added or the longest cell removed, as +every row then must be changed. +Other than costing time, it also causes large diffs in Git. + +To illustrate, when authoring large tables, it is discouraged to pad cells +like this: + +```markdown +| Alpha bravo charlie | delta | +| ------------------- | -----------------: | +| Echo | Foxtrot golf hotel | +``` + +Instead, use single spaces (and single filler dashes): + +```markdown +| Alpha bravo charlie | delta | +| - | -: | +| Echo | Foxtrot golf hotel | +``` + +## HTML + +GFM tables relate to several HTML elements: ``, ``, ``, and ``. +See +[*§ 4.9.1 The `table` element*][html-table], +[*§ 4.9.5 The `tbody` element*][html-tbody], +[*§ 4.9.9 The `td` element*][html-td], +[*§ 4.9.10 The `th` element*][html-th], +[*§ 4.9.6 The `thead` element*][html-thead], and +[*§ 4.9.8 The `tr` element*][html-tr] +in the HTML spec for more info. + +If the alignment of a column is left, right, or center, a deprecated +`align` attribute is added to each `
        `, +``, `
        ` and `` element belonging to +that column. +That attribute is interpreted by browsers as if a CSS `text-align` property +was included, with its value set to that same keyword. + +## CSS + +The following CSS is needed to make tables look a bit like GitHub. +For the complete actual CSS see +[`sindresorhus/github-markdown-css`][github-markdown-css] + +```css +/* Light theme. */ +:root { + --color-canvas-default: #ffffff; + --color-canvas-subtle: #f6f8fa; + --color-border-default: #d0d7de; + --color-border-muted: hsla(210, 18%, 87%, 1); +} + +/* Dark theme. */ +@media (prefers-color-scheme: dark) { + :root { + --color-canvas-default: #0d1117; + --color-canvas-subtle: #161b22; + --color-border-default: #30363d; + --color-border-muted: #21262d; + } +} + +table { + border-spacing: 0; + border-collapse: collapse; + display: block; + margin-top: 0; + margin-bottom: 16px; + width: max-content; + max-width: 100%; + overflow: auto; +} + +tr { + background-color: var(--color-canvas-default); + border-top: 1px solid var(--color-border-muted); +} + +tr:nth-child(2n) { + background-color: var(--color-canvas-subtle); +} + +td, +th { + padding: 6px 13px; + border: 1px solid var(--color-border-default); +} + +th { + font-weight: 600; +} + +table img { + background-color: transparent; +} +``` + +## Syntax + +Tables form with the following BNF: + +```abnf +gfmTable ::= gfmTableHead 0*(eol gfmTableBodyRow) + +; Restriction: both rows must have the same number of cells. +gfmTableHead ::= gfmTableRow eol gfmTableDelimiterRow + +gfmTableRow ::= ["|"] gfmTableCell 0*("|" gfmTableCell) ["|"] *spaceOrTab +gfmTableCell ::= *spaceOrTab gfmTableText *spaceOrTab +gfmTableText ::= 0*(line - "\\" - "|" / "\\" ["\\" / "|"]) + +gfmTableDelimiterRow ::= ["|"] gfmTableDelimiterCell 0*("|" gfmTableDelimiterCell) ["|"] *spaceOrTab +gfmTableDelimiterCell ::= *spaceOrTab gfmTableDelimiterValue *spaceOrTab +gfmTableDelimiterValue ::= [":"] 1*"-" [":"] +``` + +As this construct occurs in flow, like all flow constructs, it must be +followed by an eol (line ending) or eof (end of file). + +The above grammar shows that basically anything can be a cell or a row. +The main thing that makes something a row, is that it occurs directly before +or after a delimiter row, or after another row. + +It is not required for a table to have a body: it can end right after the +delimiter row. + +Each column can be marked with an alignment. +The alignment marker is a colon (`:`) used before and/or after delimiter row +filler. +To illustrate: + +```markdown +| none | left | right | center | +| ---- | :--- | ----: | :----: | +``` + +The number of cells in the delimiter row, is the number of columns of the +table. +Only the head row is required to have the same number of cells. +Body rows are not required to have a certain number of cells. +For body rows that have less cells than the number of columns of the table, +empty cells are injected. +When a row has more cells than the number of columns of the table, the +superfluous cells are dropped. +To illustrate: + +```markdown +| a | b | +| - | - | +| c | +| d | e | f | +``` + +Yields: + +```html + + + + + + + + + + + + + + + + + +
        ab
        c
        de
        +``` + +Each cell’s text is interpreted as the [text][micromark-content-type] content +type. +That means that it can include constructs such as attention (emphasis, strong). + +The grammar for cells prohibits the use of `|` in them. +To use pipes in cells, encode them as a character reference or character +escape: `|` (or `|`, `|`, `|`, `|`) or +`\|`. + +Escapes will typically work, but they are not supported in +code (text) (and the math (text) extension). +To work around this, GitHub came up with a rather weird “trick”. +When inside a table cell *and* inside code, escaped pipes *are* decoded. +To illustrate: + +```markdown +| Name | Character | +| - | - | +| Left curly brace | `{` | +| Pipe | `\|` | +| Right curly brace | `}` | +``` + +Yields: + +```html + + + + + + + + + + + + + + + + + + + + + +
        NameCharacter
        Left curly brace{
        Pipe|
        Right curly brace}
        +``` + +> 👉 **Note**: no other character can be escaped like this. +> Escaping pipes in code does not work when not inside a table, either. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-table@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-table`][mdast-util-gfm-table] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-table/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-table/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-table.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-table + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-table.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-table + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-table + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-table + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-content-type]: https://github.com/micromark/micromark#content-types + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[mdast-util-gfm-table]: https://github.com/syntax-tree/mdast-util-gfm-table + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[tables]: https://github.github.com/gfm/#tables-extension- + +[html-table]: https://html.spec.whatwg.org/multipage/tables.html#the-table-element + +[html-tbody]: https://html.spec.whatwg.org/multipage/tables.html#the-tbody-element + +[html-thead]: https://html.spec.whatwg.org/multipage/tables.html#the-thead-element + +[html-tr]: https://html.spec.whatwg.org/multipage/tables.html#the-tr-element + +[html-td]: https://html.spec.whatwg.org/multipage/tables.html#the-td-element + +[html-th]: https://html.spec.whatwg.org/multipage/tables.html#the-th-element + +[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css + +[api-gfm-table]: #gfmtable + +[api-gfm-table-html]: #gfmtablehtml diff --git a/tools/ui/node_modules/micromark-extension-gfm-tagfilter/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a00c9377f59ca9a2cb0130bcc5cf8e908f37454a --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/index.d.ts @@ -0,0 +1 @@ +export {gfmTagfilterHtml} from './lib/index.js' diff --git a/tools/ui/node_modules/micromark-extension-gfm-tagfilter/index.js b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a00c9377f59ca9a2cb0130bcc5cf8e908f37454a --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/index.js @@ -0,0 +1 @@ +export {gfmTagfilterHtml} from './lib/index.js' diff --git a/tools/ui/node_modules/micromark-extension-gfm-tagfilter/lib/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/lib/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6839a41ba12919efea0c617d8c6a077c383b403e --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/lib/index.d.ts @@ -0,0 +1,12 @@ +/** + * Create an HTML extension for `micromark` to support GitHubs weird and + * useless tagfilter when serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to support + * GitHubs weird and useless tagfilter when serializing to HTML. + */ +export function gfmTagfilterHtml(): HtmlExtension +export type CompileContext = import('micromark-util-types').CompileContext +export type HtmlExtension = import('micromark-util-types').HtmlExtension +export type Token = import('micromark-util-types').Token diff --git a/tools/ui/node_modules/micromark-extension-gfm-tagfilter/lib/index.js b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/lib/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d14eb36cb678a71cdaba0f6ded5b44ae2af76b59 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/lib/index.js @@ -0,0 +1,51 @@ +/** + * @typedef {import('micromark-util-types').CompileContext} CompileContext + * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension + * @typedef {import('micromark-util-types').Token} Token + */ + +// An opening or closing tag start, followed by a case-insensitive specific tag name, +// followed by HTML whitespace, a greater than, or a slash. +const reFlow = + /<(\/?)(iframe|noembed|noframes|plaintext|script|style|title|textarea|xmp)(?=[\t\n\f\r />])/gi + +// As HTML (text) parses tags separately (and very strictly), we don’t need to be +// global. +const reText = new RegExp('^' + reFlow.source, 'i') + +/** + * Create an HTML extension for `micromark` to support GitHubs weird and + * useless tagfilter when serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to support + * GitHubs weird and useless tagfilter when serializing to HTML. + */ +export function gfmTagfilterHtml() { + return { + exit: { + htmlFlowData(token) { + exitHtmlData.call(this, token, reFlow) + }, + htmlTextData(token) { + exitHtmlData.call(this, token, reText) + } + } + } +} + +/** + * @this {CompileContext} + * @param {Token} token + * @param {RegExp} filter + * @returns {undefined} + */ +function exitHtmlData(token, filter) { + let value = this.sliceSerialize(token) + + if (this.options.allowDangerousHtml) { + value = value.replace(filter, '<$1$2') + } + + this.raw(this.encode(value)) +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-tagfilter/license b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/license new file mode 100644 index 0000000000000000000000000000000000000000..39372356c47d0f6e070ff62d84c69f4f5e8c16eb --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-extension-gfm-tagfilter/package.json b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/package.json new file mode 100644 index 0000000000000000000000000000000000000000..179a10583fe8bd64bae8404745288cd33dfc5276 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/package.json @@ -0,0 +1,82 @@ +{ + "name": "micromark-extension-gfm-tagfilter", + "version": "2.0.0", + "description": "micromark extension to support GFM tagfilter", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "tagfilter", + "tag", + "filter", + "dangerous", + "html", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-tagfilter", + "bugs": "https://github.com/micromark/micromark-extension-gfm-tagfilter/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "micromark": "^4.0.0", + "prettier": "^2.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-tagfilter/readme.md b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..f97b2e733b84b80fb70fef8423fc25640946c3bd --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-tagfilter/readme.md @@ -0,0 +1,237 @@ +# micromark-extension-gfm-tagfilter + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extension to support GFM [tag filter][]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmTagfilterHtml()`](#gfmtagfilterhtml) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains an extension that adds support for the tagfilter enabled +by GFM to [`micromark`][micromark]. +The tagfilter is kinda weird and kinda useless. +This package exists for completeness. +The tag filter is a naïve attempt at XSS protection. +You should use a proper HTML sanitizing algorithm. + +## When to use this + +This project is useful when you want to match how GitHub works. +You can use this extension when you are working with [`micromark`][micromark] +already. +When you do, you can instead use +[`micromark-extension-gfm`][micromark-extension-gfm], which includes this +extension, to support all GFM features. + +When you want to deal with syntax trees, you should instead use +[`hast-util-sanitize`][hast-util-sanitize]. + +When you use remark and rehype, you should use +[`rehype-sanitize`][rehype-sanitize]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-tagfilter +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmTagfilterHtml} from 'https://esm.sh/micromark-extension-gfm-tagfilter@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import {gfmTagfilterHtml} from 'micromark-extension-gfm-tagfilter' + +const output = micromark('XSS! ', { + allowDangerousHtml: true, + htmlExtensions: [gfmTagfilterHtml()] +}) + +console.log(output) +``` + +Yields: + +```html +

        XSS! <script>alert(1)</script>

        +``` + +## API + +This package exports the identifier +[`gfmTagfilterHtml`][api-gfm-tagfilter-html]. +There is no default export. + +### `gfmTagfilterHtml()` + +Create an HTML extension for `micromark` to support GitHubs weird and +useless tagfilter when serializing to HTML. + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support +GitHubs weird and useless tagfilter when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +## Authoring + +This package relates to malicious authors, not decent authors. + +## HTML + +GFM tagfilter removes certain dangerous HTML tags: `iframe`, `noembed`, +`noframes`, `plaintext`, `script`, `style`, `title`, `textarea`, and `xmp`. + +## CSS + +This package does not relate to CSS. + +## Syntax + +This package does not change how markdown is parsed. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-tagfilter@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +While micromark is safe by default, this extension only does something when +`allowDangerousHtml: true` is passed, which is an unsafe option. +This package is **not safe**. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`hast-util-sanitize`][hast-util-sanitize] + — hast utility to make trees safe +* [`rehype-sanitize`][rehype-sanitize] + — rehype plugin to sanitize HTML + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-tagfilter/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-tagfilter/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-tagfilter.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-tagfilter + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-tagfilter.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-tagfilter + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-tagfilter + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-tagfilter + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize + +[hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize + +[tag filter]: https://github.github.com/gfm/#disallowed-raw-html-extension- + +[api-gfm-tagfilter-html]: #gfmtagfilterhtml diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3c0d959e29771342952fdb91d23e9da173a98144 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/index.d.ts @@ -0,0 +1,17 @@ +export {gfmTaskListItemHtml} from './lib/html.js' +export {gfmTaskListItem} from './lib/syntax.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Token types. + */ + interface TokenTypeMap { + taskListCheck: 'taskListCheck' + taskListCheckMarker: 'taskListCheckMarker' + taskListCheckValueChecked: 'taskListCheckValueChecked' + taskListCheckValueUnchecked: 'taskListCheckValueUnchecked' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/index.js b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2e18f6c1f8187df801c379d0911a6bd989878dfe --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/index.js @@ -0,0 +1,2 @@ +export {gfmTaskListItemHtml} from './lib/html.js' +export {gfmTaskListItem} from './lib/syntax.js' diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..77a83bdaf606d940ec9151dcae16356f12027b21 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/html.d.ts @@ -0,0 +1,13 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ +/** + * Create an HTML extension for `micromark` to support GFM task list items when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM task list items when serializing to HTML. + */ +export function gfmTaskListItemHtml(): HtmlExtension; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..b4a14addeb51aacc192ad945bb6bd5539d9f2e9c --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/html.js @@ -0,0 +1,29 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ + +/** + * Create an HTML extension for `micromark` to support GFM task list items when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM task list items when serializing to HTML. + */ +export function gfmTaskListItemHtml() { + return { + enter: { + taskListCheck() { + this.tag('') + }, + taskListCheckValueChecked() { + this.tag('checked="" ') + } + } + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3ffb821e47543ebe4a435cc20aac30e748027438 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/syntax.d.ts @@ -0,0 +1,10 @@ +/** + * Create an HTML extension for `micromark` to support GFM task list items + * syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM task list items when serializing to HTML. + */ +export function gfmTaskListItem(): Extension; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..4174cee274c7c0aa474308c01cd78841e284204d --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/dev/lib/syntax.js @@ -0,0 +1,166 @@ +/** + * @import {Extension, State, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import { + markdownLineEnding, + markdownLineEndingOrSpace, + markdownSpace +} from 'micromark-util-character' +import {codes, types} from 'micromark-util-symbol' + +const tasklistCheck = {name: 'tasklistCheck', tokenize: tokenizeTasklistCheck} + +/** + * Create an HTML extension for `micromark` to support GFM task list items + * syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM task list items when serializing to HTML. + */ +export function gfmTaskListItem() { + return { + text: {[codes.leftSquareBracket]: tasklistCheck} + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeTasklistCheck(effects, ok, nok) { + const self = this + + return open + + /** + * At start of task list item check. + * + * ```markdown + * > | * [x] y. + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + + if ( + // Exit if there’s stuff before. + self.previous !== codes.eof || + // Exit if not in the first content that is the first child of a list + // item. + !self._gfmTasklistFirstContentOfListItem + ) { + return nok(code) + } + + effects.enter('taskListCheck') + effects.enter('taskListCheckMarker') + effects.consume(code) + effects.exit('taskListCheckMarker') + return inside + } + + /** + * In task list item check. + * + * ```markdown + * > | * [x] y. + * ^ + * ``` + * + * @type {State} + */ + function inside(code) { + // Currently we match how GH works in files. + // To match how GH works in comments, use `markdownSpace` (`[\t ]`) instead + // of `markdownLineEndingOrSpace` (`[\t\n\r ]`). + if (markdownLineEndingOrSpace(code)) { + effects.enter('taskListCheckValueUnchecked') + effects.consume(code) + effects.exit('taskListCheckValueUnchecked') + return close + } + + if (code === codes.uppercaseX || code === codes.lowercaseX) { + effects.enter('taskListCheckValueChecked') + effects.consume(code) + effects.exit('taskListCheckValueChecked') + return close + } + + return nok(code) + } + + /** + * At close of task list item check. + * + * ```markdown + * > | * [x] y. + * ^ + * ``` + * + * @type {State} + */ + function close(code) { + if (code === codes.rightSquareBracket) { + effects.enter('taskListCheckMarker') + effects.consume(code) + effects.exit('taskListCheckMarker') + effects.exit('taskListCheck') + return after + } + + return nok(code) + } + + /** + * @type {State} + */ + function after(code) { + // EOL in paragraph means there must be something else after it. + if (markdownLineEnding(code)) { + return ok(code) + } + + // Space or tab? + // Check what comes after. + if (markdownSpace(code)) { + return effects.check({tokenize: spaceThenNonSpace}, ok, nok)(code) + } + + // EOF, or non-whitespace, both wrong. + return nok(code) + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function spaceThenNonSpace(effects, ok, nok) { + return factorySpace(effects, after, types.whitespace) + + /** + * After whitespace, after task list item check. + * + * ```markdown + * > | * [x] y. + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + // EOF means there was nothing, so bad. + // EOL means there’s content after it, so good. + // Impossible to have more spaces. + // Anything else is good. + return code === codes.eof ? nok(code) : ok(code) + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3c0d959e29771342952fdb91d23e9da173a98144 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/index.d.ts @@ -0,0 +1,17 @@ +export {gfmTaskListItemHtml} from './lib/html.js' +export {gfmTaskListItem} from './lib/syntax.js' + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Token types. + */ + interface TokenTypeMap { + taskListCheck: 'taskListCheck' + taskListCheckMarker: 'taskListCheckMarker' + taskListCheckValueChecked: 'taskListCheckValueChecked' + taskListCheckValueUnchecked: 'taskListCheckValueUnchecked' + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/index.js b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b7d19c142b4c76efae7a6142ddf47d9a4ed49bd7 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/index.js @@ -0,0 +1,2 @@ +export { gfmTaskListItemHtml } from './lib/html.js'; +export { gfmTaskListItem } from './lib/syntax.js'; \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..77a83bdaf606d940ec9151dcae16356f12027b21 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/html.d.ts @@ -0,0 +1,13 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ +/** + * Create an HTML extension for `micromark` to support GFM task list items when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM task list items when serializing to HTML. + */ +export function gfmTaskListItemHtml(): HtmlExtension; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/html.js b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..a611f71bbe9f7cd59a2ffae85b8d546cf7b6055d --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/html.js @@ -0,0 +1,29 @@ +/** + * @import {HtmlExtension} from 'micromark-util-types' + */ + +/** + * Create an HTML extension for `micromark` to support GFM task list items when + * serializing to HTML. + * + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM task list items when serializing to HTML. + */ +export function gfmTaskListItemHtml() { + return { + enter: { + taskListCheck() { + this.tag(''); + }, + taskListCheckValueChecked() { + this.tag('checked="" '); + } + } + }; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3ffb821e47543ebe4a435cc20aac30e748027438 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.d.ts @@ -0,0 +1,10 @@ +/** + * Create an HTML extension for `micromark` to support GFM task list items + * syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM task list items when serializing to HTML. + */ +export function gfmTaskListItem(): Extension; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..0e1eeaff8ea9df6393ca8f07c09cc89482b72a89 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js @@ -0,0 +1,158 @@ +/** + * @import {Extension, State, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character'; +const tasklistCheck = { + name: 'tasklistCheck', + tokenize: tokenizeTasklistCheck +}; + +/** + * Create an HTML extension for `micromark` to support GFM task list items + * syntax. + * + * @returns {Extension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM task list items when serializing to HTML. + */ +export function gfmTaskListItem() { + return { + text: { + [91]: tasklistCheck + } + }; +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeTasklistCheck(effects, ok, nok) { + const self = this; + return open; + + /** + * At start of task list item check. + * + * ```markdown + * > | * [x] y. + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if ( + // Exit if there’s stuff before. + self.previous !== null || + // Exit if not in the first content that is the first child of a list + // item. + !self._gfmTasklistFirstContentOfListItem) { + return nok(code); + } + effects.enter('taskListCheck'); + effects.enter('taskListCheckMarker'); + effects.consume(code); + effects.exit('taskListCheckMarker'); + return inside; + } + + /** + * In task list item check. + * + * ```markdown + * > | * [x] y. + * ^ + * ``` + * + * @type {State} + */ + function inside(code) { + // Currently we match how GH works in files. + // To match how GH works in comments, use `markdownSpace` (`[\t ]`) instead + // of `markdownLineEndingOrSpace` (`[\t\n\r ]`). + if (markdownLineEndingOrSpace(code)) { + effects.enter('taskListCheckValueUnchecked'); + effects.consume(code); + effects.exit('taskListCheckValueUnchecked'); + return close; + } + if (code === 88 || code === 120) { + effects.enter('taskListCheckValueChecked'); + effects.consume(code); + effects.exit('taskListCheckValueChecked'); + return close; + } + return nok(code); + } + + /** + * At close of task list item check. + * + * ```markdown + * > | * [x] y. + * ^ + * ``` + * + * @type {State} + */ + function close(code) { + if (code === 93) { + effects.enter('taskListCheckMarker'); + effects.consume(code); + effects.exit('taskListCheckMarker'); + effects.exit('taskListCheck'); + return after; + } + return nok(code); + } + + /** + * @type {State} + */ + function after(code) { + // EOL in paragraph means there must be something else after it. + if (markdownLineEnding(code)) { + return ok(code); + } + + // Space or tab? + // Check what comes after. + if (markdownSpace(code)) { + return effects.check({ + tokenize: spaceThenNonSpace + }, ok, nok)(code); + } + + // EOF, or non-whitespace, both wrong. + return nok(code); + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function spaceThenNonSpace(effects, ok, nok) { + return factorySpace(effects, after, "whitespace"); + + /** + * After whitespace, after task list item check. + * + * ```markdown + * > | * [x] y. + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + // EOF means there was nothing, so bad. + // EOL means there’s content after it, so good. + // Impossible to have more spaces. + // Anything else is good. + return code === null ? nok(code) : ok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/license b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/license new file mode 100644 index 0000000000000000000000000000000000000000..39372356c47d0f6e070ff62d84c69f4f5e8c16eb --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/package.json b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/package.json new file mode 100644 index 0000000000000000000000000000000000000000..bfc8bd51bfe86bf6ef8f9855e5c236d3dd3d18e9 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/package.json @@ -0,0 +1,131 @@ +{ + "name": "micromark-extension-gfm-task-list-item", + "version": "2.1.0", + "description": "micromark extension to support GFM task list items", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "task", + "list", + "item", + "check", + "checkbox", + "todo", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm-task-list-item", + "bugs": "https://github.com/micromark/micromark-extension-gfm-task-list-item/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "control-pictures": "^2.0.0", + "create-gfm-fixtures": "^1.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "rules": { + "unicorn/no-this-assignment": "off", + "unicorn/prefer-string-replace-all": "off" + }, + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + }, + { + "files": [ + "test/**/*.js" + ], + "rules": { + "no-await-in-loop": "off" + } + } + ] + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm-task-list-item/readme.md b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..fd8ba964a85fb99ec2d994a1108aab412e2d08f2 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm-task-list-item/readme.md @@ -0,0 +1,305 @@ +# micromark-extension-gfm-task-list-item + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support GFM [task list items][]. + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfmTaskListItem()`](#gfmtasklistitem) + * [`gfmTaskListItemHtml()`](#gfmtasklistitemhtml) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for task lists as enabled by +GFM to [`micromark`][micromark]. +It matches how task list items work on `github.com`. + +## When to use this + +This project is useful when you want to support task lists in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +To support all GFM features, use +[`micromark-extension-gfm`][micromark-extension-gfm]. + +When you need a syntax tree, you can combine this package with +[`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item]. + +All these packages are used [`remark-gfm`][remark-gfm], which focusses on making +it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm-task-list-item +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfmTaskListItem, gfmTaskListItemHtml} from 'https://esm.sh/micromark-extension-gfm-task-list-item@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +```js +import {micromark} from 'micromark' +import { + gfmTaskListItem, + gfmTaskListItemHtml +} from 'micromark-extension-gfm-task-list-item' + +const output = micromark('* [x] a\n* [ ] b', { + extensions: [gfmTaskListItem()], + htmlExtensions: [gfmTaskListItemHtml()] +}) + +console.log(output) +``` + +Yields: + +```html +
          +
        • a
        • +
        • b
        • +
        +``` + +## API + +This package exports the identifiers [`gfmTaskListItem`][api-gfm-task-list-item] +and [`gfmTaskListItemHtml`][api-gfm-task-list-item-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfmTaskListItem()` + +Create an HTML extension for `micromark` to support GFM task list items +syntax. + +###### Returns + +Extension for `micromark` that can be passed in `extensions`, to enable GFM +task list items syntax ([`Extension`][micromark-extension]). + +### `gfmTaskListItemHtml()` + +Create an HTML extension for `micromark` to support GFM task list items when +serializing to HTML. + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support GFM +task list items when serializing to HTML +([`HtmlExtension`][micromark-html-extension]). + +## Authoring + +It is recommended to use lowercase `x` (instead of uppercase `X`), because in +markdown, it is more common to use lowercase in places where casing does not +matter. +It is also recommended to use a space (instead of a tab), as there is no benefit +of using tabs in this case. + +## HTML + +Checks relate to the `` element, in the checkbox state (`type=checkbox`), +in HTML. +See [*§ 4.10.5.1.15 Checkbox state (`type=checkbox`)*][html-input-checkbox] +in the HTML spec for more info. + +```html + +
      3. foo
      4. +
      5. bar
      6. + +``` + +## CSS + +GitHub itself uses slightly different markup for task list items than they +define in their spec. +When following the spec, as this extension does, only inputs are added. +They can be styled with the following CSS: + +```css +input[type="checkbox"] { + margin: 0 .2em .25em -1.6em; + vertical-align: middle; +} + +input[type="checkbox"]:dir(rtl) { + margin: 0 -1.6em .25em .2em; +} +``` + +For the complete actual CSS see +[`sindresorhus/github-markdown-css`][github-markdown-css]. + +## Syntax + +Checks form with the following BNF: + +```bnf +gfm_task_list_item_check ::= '[' (0x09 | ' ' | 'X' | 'x') ']' +``` + +The check is only allowed at the start of the first paragraph, optionally +following zero or more definitions or a blank line, in a list item. +The check must be followed by whitespace (`[\t\n\r ]*`), which is in turn +followed by non-whitespace. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm-task-list-item@^2`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. + +## Related + +* [`micromark-extension-gfm`][micromark-extension-gfm] + — support all of GFM +* [`mdast-util-gfm-task-list-item`][mdast-util-gfm-task-list-item] + — support all of GFM in mdast +* [`mdast-util-gfm`][mdast-util-gfm] + — support all of GFM in mdast +* [`remark-gfm`][remark-gfm] + — support all of GFM in remark + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + + + +[build-badge]: https://github.com/micromark/micromark-extension-gfm-task-list-item/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm-task-list-item/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm-task-list-item.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm-task-list-item + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm-task-list-item.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm-task-list-item + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm-task-list-item + +[size]: https://bundlejs.com/?q=micromark-extension-gfm-task-list-item + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[mdast-util-gfm-task-list-item]: https://github.com/syntax-tree/mdast-util-gfm-task-list-item + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[task list items]: https://github.github.com/gfm/#task-list-items-extension- + +[github-markdown-css]: https://github.com/sindresorhus/github-markdown-css + +[html-input-checkbox]: https://html.spec.whatwg.org/multipage/input.html#checkbox-state-\(type=checkbox\) + +[api-gfm-task-list-item]: #gfmtasklistitem + +[api-gfm-task-list-item-html]: #gfmtasklistitemhtml diff --git a/tools/ui/node_modules/micromark-extension-gfm/index.d.ts b/tools/ui/node_modules/micromark-extension-gfm/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8fdf19672fc8864d0bc7a917b25ecde1f41295cb --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm/index.d.ts @@ -0,0 +1,28 @@ +/** + * Create an extension for `micromark` to enable GFM syntax. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * + * Passed to `micromark-extens-gfm-strikethrough`. + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * syntax. + */ +export function gfm(options?: Options | null | undefined): Extension +/** + * Create an extension for `micromark` to support GFM when serializing to HTML. + * + * @param {HtmlOptions | null | undefined} [options] + * Configuration (optional). + * + * Passed to `micromark-extens-gfm-footnote`. + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM when serializing to HTML. + */ +export function gfmHtml(options?: HtmlOptions | null | undefined): HtmlExtension +export type HtmlOptions = import('micromark-extension-gfm-footnote').HtmlOptions +export type Options = import('micromark-extension-gfm-strikethrough').Options +export type Extension = import('micromark-util-types').Extension +export type HtmlExtension = import('micromark-util-types').HtmlExtension diff --git a/tools/ui/node_modules/micromark-extension-gfm/index.js b/tools/ui/node_modules/micromark-extension-gfm/index.js new file mode 100644 index 0000000000000000000000000000000000000000..839e7358e65a80363c0b46ffa0a8899e91ff6b43 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm/index.js @@ -0,0 +1,69 @@ +/** + * @typedef {import('micromark-extension-gfm-footnote').HtmlOptions} HtmlOptions + * @typedef {import('micromark-extension-gfm-strikethrough').Options} Options + * @typedef {import('micromark-util-types').Extension} Extension + * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension + */ + +import { + combineExtensions, + combineHtmlExtensions +} from 'micromark-util-combine-extensions' +import { + gfmAutolinkLiteral, + gfmAutolinkLiteralHtml +} from 'micromark-extension-gfm-autolink-literal' +import {gfmFootnote, gfmFootnoteHtml} from 'micromark-extension-gfm-footnote' +import { + gfmStrikethrough, + gfmStrikethroughHtml +} from 'micromark-extension-gfm-strikethrough' +import {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table' +import {gfmTagfilterHtml} from 'micromark-extension-gfm-tagfilter' +import { + gfmTaskListItem, + gfmTaskListItemHtml +} from 'micromark-extension-gfm-task-list-item' + +/** + * Create an extension for `micromark` to enable GFM syntax. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * + * Passed to `micromark-extens-gfm-strikethrough`. + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions` to enable GFM + * syntax. + */ +export function gfm(options) { + return combineExtensions([ + gfmAutolinkLiteral(), + gfmFootnote(), + gfmStrikethrough(options), + gfmTable(), + gfmTaskListItem() + ]) +} + +/** + * Create an extension for `micromark` to support GFM when serializing to HTML. + * + * @param {HtmlOptions | null | undefined} [options] + * Configuration (optional). + * + * Passed to `micromark-extens-gfm-footnote`. + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions` to + * support GFM when serializing to HTML. + */ +export function gfmHtml(options) { + return combineHtmlExtensions([ + gfmAutolinkLiteralHtml(), + gfmFootnoteHtml(options), + gfmStrikethroughHtml(), + gfmTableHtml(), + gfmTagfilterHtml(), + gfmTaskListItemHtml() + ]) +} diff --git a/tools/ui/node_modules/micromark-extension-gfm/license b/tools/ui/node_modules/micromark-extension-gfm/license new file mode 100644 index 0000000000000000000000000000000000000000..39372356c47d0f6e070ff62d84c69f4f5e8c16eb --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-extension-gfm/package.json b/tools/ui/node_modules/micromark-extension-gfm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..11c014f89e01863a30e830588cd2eb7e118f92f3 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm/package.json @@ -0,0 +1,107 @@ +{ + "name": "micromark-extension-gfm", + "version": "3.0.0", + "description": "micromark extension to support GFM (GitHub Flavored Markdown)", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "table", + "strikethrough", + "tasklist", + "autolink", + "footnote", + "tagfilter", + "github", + "gfm", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-gfm", + "bugs": "https://github.com/micromark/micromark-extension-gfm/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer (https://wooorm.com)", + "contributors": [ + "Titus Wormer (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "index.d.ts", + "index.js" + ], + "dependencies": { + "micromark-extension-gfm-autolink-literal": "^2.0.0", + "micromark-extension-gfm-footnote": "^2.0.0", + "micromark-extension-gfm-strikethrough": "^2.0.0", + "micromark-extension-gfm-table": "^2.0.0", + "micromark-extension-gfm-tagfilter": "^2.0.0", + "micromark-extension-gfm-task-list-item": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^8.0.0", + "create-gfm-fixtures": "^1.0.0", + "hast-util-from-html": "^1.0.0", + "hast-util-select": "^5.0.0", + "hast-util-to-text": "^3.0.0", + "micromark": "^4.0.0", + "prettier": "^2.0.0", + "rehype": "^12.0.0", + "rehype-sort-attributes": "^4.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "undici": "^5.0.0", + "xo": "^0.54.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", + "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "prettier": true, + "overrides": [ + { + "files": [ + "{test,script}/**/*.js" + ], + "rules": { + "no-await-in-loop": "off" + } + } + ] + } +} diff --git a/tools/ui/node_modules/micromark-extension-gfm/readme.md b/tools/ui/node_modules/micromark-extension-gfm/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..d569a19ac040dae70aab269e7ee1bbe5c631ea50 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-gfm/readme.md @@ -0,0 +1,433 @@ +# micromark-extension-gfm + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support [GitHub flavored markdown][gfm] (GFM). + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`gfm(options?)`](#gfmoptions) + * [`gfmHtml(options?)`](#gfmhtmloptions) + * [`Options`](#options) + * [`HtmlOptions`](#htmloptions) +* [Bugs](#bugs) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains extensions that add support for all features enabled by +GFM to [`micromark`][micromark]. +It supports autolink literals, footnotes, strikethrough, tables, tagfilter, and +tasklists. + +## When to use this + +This project is useful when you want to support GFM in markdown. + +You can use these extensions when you are working with [`micromark`][micromark]. +Alternatively, you can also use the underlying features separately: + +* [`micromark-extension-gfm-autolink-literal`][gfm-autolink-literal] + — support GFM [autolink literals][] +* [`micromark-extension-gfm-footnote`][gfm-footnote] + — support GFM [footnotes][] +* [`micromark-extension-gfm-strikethrough`][gfm-strikethrough] + — support GFM [strikethrough][] +* [`micromark-extension-gfm-table`][gfm-table] + — support GFM [tables][] +* [`micromark-extension-gfm-tagfilter`][gfm-tagfilter] + — support GFM [tagfilter][] +* [`micromark-extension-gfm-task-list-item`][gfm-task-list-item] + — support GFM [tasklists][] + +When you need a syntax tree, combine this package with +[`mdast-util-gfm`][mdast-util-gfm]. + +All these packages are used in [`remark-gfm`][remark-gfm], which focusses on +making it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-extension-gfm +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {gfm, gfmHtml} from 'https://esm.sh/micromark-extension-gfm@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + +## Use + +Say our document `example.md` contains: + +```markdown +# GFM + +## Autolink literals + +www.example.com, https://example.com, and contact@example.com. + +## Footnote + +A note[^1] + +[^1]: Big note. + +## Strikethrough + +~one~ or ~~two~~ tildes. + +## Table + +| a | b | c | d | +| - | :- | -: | :-: | + +## Tag filter + + + +## Tasklist + +* [ ] to do +* [x] done +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {micromark} from 'micromark' +import {gfm, gfmHtml} from 'micromark-extension-gfm' + +const output = micromark(await fs.readFile('example.md'), { + allowDangerousHtml: true, + extensions: [gfm()], + htmlExtensions: [gfmHtml()] +}) + +console.log(output) +``` + +…now running `node example.js` yields: + +```html +<h1>GFM</h1> +<h2>Autolink literals</h2> +<p><a href="http://www.example.com">www.example.com</a>, <a href="https://example.com">https://example.com</a>, and <a href="mailto:contact@example.com">contact@example.com</a>.</p> +<h2>Footnote</h2> +<p>A note<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></p> +<h2>Strikethrough</h2> +<p><del>one</del> or <del>two</del> tildes.</p> +<h2>Table</h2> +<table> +<thead> +<tr> +<th>a</th> +<th align="left">b</th> +<th align="right">c</th> +<th align="center">d</th> +</tr> +</thead> +</table> +<h2>Tag filter</h2> +&lt;plaintext> +<h2>Tasklist</h2> +<ul> +<li><input type="checkbox" disabled="" /> to do</li> +<li><input type="checkbox" disabled="" checked="" /> done</li> +</ul> +<section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> +<ol> +<li id="user-content-fn-1"> +<p>Big note. <a href="#user-content-fnref-1" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩</a></p> +</li> +</ol> +</section> +``` + +## API + +This package exports the identifiers [`gfm`][api-gfm] and +[`gfmHtml`][api-gfm-html]. +There is no default export. + +The separate extensions support the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `gfm(options?)` + +Create an extension for `micromark` to enable GFM syntax. + +###### Parameters + +* `options` ([`Options`][api-options], optional) + — configuration; passed to + [`micromark-extens-gfm-strikethrough`][gfm-strikethrough-options] + +###### Returns + +Extension for `micromark` that can be passed in `extensions` to enable GFM +syntax ([`Extension`][micromark-extension]). + +### `gfmHtml(options?)` + +Create an extension for `micromark` to support GFM when serializing to HTML. + +###### Parameters + +* `options` ([`HtmlOptions`][api-html-options], optional) + — configuration; passed to + [`micromark-extens-gfm-footnote`][gfm-footnote-html-options] + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions` to support GFM +when serializing to HTML ([`HtmlExtension`][micromark-html-extension]). + +### `Options` + +Configuration for syntax (TypeScript type). + +###### Type + +```ts +export type {Options} from 'micromark-extension-gfm-strikethrough' +``` + +[See `Options`][gfm-strikethrough-options]. + +### `HtmlOptions` + +Configuration for HTML (TypeScript type). + +###### Type + +```ts +export type {HtmlOptions} from 'micromark-extension-gfm-footnote' +``` + +[See `HtmlOptions`][gfm-footnote-html-options]. + +## Bugs + +For bugs present in GFM but not here, or other peculiarities that are +supported, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#bugs) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#bugs) +* strikethrough: n/a +* [table](https://github.com/micromark/micromark-extension-gfm-table#bugs) +* tagfilter: n/a +* tasklists: n/a + +## Authoring + +For recommendations on how to author GFM, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#authoring) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#authoring) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#authoring) +* [table](https://github.com/micromark/micromark-extension-gfm-table#authoring) +* tagfilter: n/a +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#authoring) + +## HTML + +For info on what HTML features GFM relates to, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#html) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#html) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#html) +* [table](https://github.com/micromark/micromark-extension-gfm-table#html) +* [tagfilter](https://github.com/micromark/micromark-extension-gfm-tagfilter#html) +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#html) + +## CSS + +For info on how GitHub styles these features, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#css) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#css) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#css) +* [table](https://github.com/micromark/micromark-extension-gfm-table#css) +* tagfilter: n/a +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#css) + +## Syntax + +For info on the syntax of these features, see each corresponding readme: + +* [autolink literal](https://github.com/micromark/micromark-extension-gfm-autolink-literal#syntax) +* [footnote](https://github.com/micromark/micromark-extension-gfm-footnote#syntax) +* [strikethrough](https://github.com/micromark/micromark-extension-gfm-strikethrough#syntax) +* [table](https://github.com/micromark/micromark-extension-gfm-table#syntax) +* tagfilter: n/a +* [tasklists](https://github.com/micromark/micromark-extension-gfm-task-list-item#syntax) + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`HtmlOptions`][api-html-options] and +[`Options`][api-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-gfm@^3`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe. +Setting `clobberPrefix = ''` is dangerous, it opens you up to DOM clobbering. +The `labelTagName` and `labelAttributes` options are unsafe when used with user +content, they allow defining arbitrary HTML. + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark-extension-gfm/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-gfm/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-gfm.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-gfm + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-gfm.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-gfm + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-gfm + +[size]: https://bundlejs.com/?q=micromark-extension-gfm + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[typescript]: https://www.typescriptlang.org + +[gfm]: https://github.github.com/gfm/ + +[strikethrough]: https://github.github.com/gfm/#strikethrough-extension- + +[tables]: https://github.github.com/gfm/#tables-extension- + +[tasklists]: https://github.github.com/gfm/#task-list-items-extension- + +[autolink literals]: https://github.github.com/gfm/#autolinks-extension- + +[tagfilter]: https://github.github.com/gfm/#disallowed-raw-html-extension- + +[footnotes]: https://github.blog/changelog/2021-09-30-footnotes-now-supported-in-markdown-fields/ + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[gfm-strikethrough]: https://github.com/micromark/micromark-extension-gfm-strikethrough + +[gfm-strikethrough-options]: https://github.com/micromark/micromark-extension-gfm-strikethrough#options + +[gfm-autolink-literal]: https://github.com/micromark/micromark-extension-gfm-autolink-literal + +[gfm-footnote]: https://github.com/micromark/micromark-extension-gfm-footnote + +[gfm-footnote-html-options]: https://github.com/micromark/micromark-extension-gfm-footnote#htmloptions + +[gfm-table]: https://github.com/micromark/micromark-extension-gfm-table + +[gfm-tagfilter]: https://github.com/micromark/micromark-extension-gfm-tagfilter + +[gfm-task-list-item]: https://github.com/micromark/micromark-extension-gfm-task-list-item + +[remark-gfm]: https://github.com/remarkjs/remark-gfm + +[mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm + +[api-gfm]: #gfmoptions + +[api-gfm-html]: #gfmhtmloptions + +[api-options]: #options + +[api-html-options]: #htmloptions diff --git a/tools/ui/node_modules/micromark-extension-math/dev/index.d.ts b/tools/ui/node_modules/micromark-extension-math/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d09f0e576d8d5922ae975af3b9ce8adb068214e5 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/index.d.ts @@ -0,0 +1,61 @@ +import type {KatexOptions} from 'katex' + +export {mathHtml} from './lib/html.js' +export {math} from './lib/syntax.js' + +/** + * Configuration for HTML output. + * + * > 👉 **Note**: passed to `katex.renderToString`. + * > `displayMode` is overwritten by this plugin, to `false` for math in + * > text (inline), and `true` for math in flow (block). + */ +export interface HtmlOptions extends KatexOptions { + /** + * The field `displayMode` cannot be passed to `micromark-extension-math`. + * It is overwritten by it, + * to `false` for math in text (inline) and `true` for math in flow (block). + */ + displayMode?: never +} + +/** + * Configuration. + */ +export interface Options { + /** + * Whether to support math (text) with a single dollar (default: `true`). + * + * Single dollars work in Pandoc and many other places, but often interfere + * with “normal” dollars in text. + * If you turn this off, you can use two or more dollars for text math. + */ + singleDollarTextMath?: boolean | null | undefined +} + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Compile data. + */ + interface CompileData { + mathFlowOpen?: boolean + } + + /** + * Token types. + */ + interface TokenTypeMap { + mathFlow: 'mathFlow' + mathFlowFence: 'mathFlowFence' + mathFlowFenceMeta: 'mathFlowFenceMeta' + mathFlowFenceSequence: 'mathFlowFenceSequence' + mathFlowValue: 'mathFlowValue' + mathText: 'mathText' + mathTextData: 'mathTextData' + mathTextPadding: 'mathTextPadding' + mathTextSequence: 'mathTextSequence' + } +} diff --git a/tools/ui/node_modules/micromark-extension-math/dev/index.js b/tools/ui/node_modules/micromark-extension-math/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..120c39c7fc54bafd836bf23d1b6fd5ce365e4973 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/index.js @@ -0,0 +1,3 @@ +// Note: types exported from `index.d.ts`. +export {math} from './lib/syntax.js' +export {mathHtml} from './lib/html.js' diff --git a/tools/ui/node_modules/micromark-extension-math/dev/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-math/dev/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1b230dd20b6bd8e613859520e07f86f909e3f77 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/lib/html.d.ts @@ -0,0 +1,15 @@ +/** + * Create an extension for `micromark` to support math when serializing to + * HTML. + * + * > 👉 **Note**: this uses KaTeX to render math. + * + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions`, to + * support math when serializing to HTML. + */ +export function mathHtml(options?: Options | null | undefined): HtmlExtension; +import type { HtmlOptions as Options } from 'micromark-extension-math'; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-math/dev/lib/html.js b/tools/ui/node_modules/micromark-extension-math/dev/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..635d8dff9510a270874dd8973055f16a7498f643 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/lib/html.js @@ -0,0 +1,82 @@ +/** + * @import {HtmlOptions as Options} from 'micromark-extension-math' + * @import {HtmlExtension} from 'micromark-util-types' + */ + +import katex from 'katex' + +const renderToString = katex.renderToString + +/** + * Create an extension for `micromark` to support math when serializing to + * HTML. + * + * > 👉 **Note**: this uses KaTeX to render math. + * + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions`, to + * support math when serializing to HTML. + */ +export function mathHtml(options) { + return { + enter: { + mathFlow() { + this.lineEndingIfNeeded() + this.tag('<div class="math math-display">') + }, + mathFlowFenceMeta() { + this.buffer() + }, + mathText() { + // Double? + this.tag('<span class="math math-inline">') + this.buffer() + } + }, + exit: { + mathFlow() { + const value = this.resume() + this.tag(math(value.replace(/(?:\r?\n|\r)$/, ''), true)) + this.tag('</div>') + this.setData('mathFlowOpen') + this.setData('slurpOneLineEnding') + }, + mathFlowFence() { + // After the first fence. + if (!this.getData('mathFlowOpen')) { + this.setData('mathFlowOpen', true) + this.setData('slurpOneLineEnding', true) + this.buffer() + } + }, + mathFlowFenceMeta() { + this.resume() + }, + mathFlowValue(token) { + this.raw(this.sliceSerialize(token)) + }, + mathText() { + const value = this.resume() + this.tag(math(value, false)) + this.tag('</span>') + }, + mathTextData(token) { + this.raw(this.sliceSerialize(token)) + } + } + } + + /** + * @param {string} value + * Math text. + * @param {boolean} displayMode + * Whether the math is in display mode. + * @returns {string} + * HTML. + */ + function math(value, displayMode) { + return renderToString(value, {...options, displayMode}) + } +} diff --git a/tools/ui/node_modules/micromark-extension-math/dev/lib/math-flow.d.ts b/tools/ui/node_modules/micromark-extension-math/dev/lib/math-flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..faf8303145f9cb39db4523fd775bb1b0d651a401 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/lib/math-flow.d.ts @@ -0,0 +1,3 @@ +/** @type {Construct} */ +export const mathFlow: Construct; +import type { Construct } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-math/dev/lib/math-flow.js b/tools/ui/node_modules/micromark-extension-math/dev/lib/math-flow.js new file mode 100644 index 0000000000000000000000000000000000000000..d795fabe8289d93633848c784ed150a3dba22bbc --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/lib/math-flow.js @@ -0,0 +1,394 @@ +/** + * @import {Construct, State, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const mathFlow = { + tokenize: tokenizeMathFenced, + concrete: true, + name: 'mathFlow' +} + +/** @type {Construct} */ +const nonLazyContinuation = { + tokenize: tokenizeNonLazyContinuation, + partial: true +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeMathFenced(effects, ok, nok) { + const self = this + const tail = self.events[self.events.length - 1] + const initialSize = + tail && tail[1].type === types.linePrefix + ? tail[2].sliceSerialize(tail[1], true).length + : 0 + let sizeOpen = 0 + + return start + + /** + * Start of math. + * + * ```markdown + * > | $$ + * ^ + * | \frac{1}{2} + * | $$ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.dollarSign, 'expected `$`') + effects.enter('mathFlow') + effects.enter('mathFlowFence') + effects.enter('mathFlowFenceSequence') + return sequenceOpen(code) + } + + /** + * In opening fence sequence. + * + * ```markdown + * > | $$ + * ^ + * | \frac{1}{2} + * | $$ + * ``` + * + * @type {State} + */ + function sequenceOpen(code) { + if (code === codes.dollarSign) { + effects.consume(code) + sizeOpen++ + return sequenceOpen + } + + if (sizeOpen < 2) { + return nok(code) + } + + effects.exit('mathFlowFenceSequence') + return factorySpace(effects, metaBefore, types.whitespace)(code) + } + + /** + * In opening fence, before meta. + * + * ```markdown + * > | $$asciimath + * ^ + * | x < y + * | $$ + * ``` + * + * @type {State} + */ + + function metaBefore(code) { + if (code === codes.eof || markdownLineEnding(code)) { + return metaAfter(code) + } + + effects.enter('mathFlowFenceMeta') + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return meta(code) + } + + /** + * In meta. + * + * ```markdown + * > | $$asciimath + * ^ + * | x < y + * | $$ + * ``` + * + * @type {State} + */ + function meta(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.chunkString) + effects.exit('mathFlowFenceMeta') + return metaAfter(code) + } + + if (code === codes.dollarSign) { + return nok(code) + } + + effects.consume(code) + return meta + } + + /** + * After meta. + * + * ```markdown + * > | $$ + * ^ + * | \frac{1}{2} + * | $$ + * ``` + * + * @type {State} + */ + function metaAfter(code) { + // Guaranteed to be eol/eof. + effects.exit('mathFlowFence') + + if (self.interrupt) { + return ok(code) + } + + return effects.attempt( + nonLazyContinuation, + beforeNonLazyContinuation, + after + )(code) + } + + /** + * After eol/eof in math, at a non-lazy closing fence or content. + * + * ```markdown + * | $$ + * > | \frac{1}{2} + * ^ + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function beforeNonLazyContinuation(code) { + return effects.attempt( + {tokenize: tokenizeClosingFence, partial: true}, + after, + contentStart + )(code) + } + + /** + * Before math content, definitely not before a closing fence. + * + * ```markdown + * | $$ + * > | \frac{1}{2} + * ^ + * | $$ + * ``` + * + * @type {State} + */ + function contentStart(code) { + return ( + initialSize + ? factorySpace( + effects, + beforeContentChunk, + types.linePrefix, + initialSize + 1 + ) + : beforeContentChunk + )(code) + } + + /** + * Before math content, after optional prefix. + * + * ```markdown + * | $$ + * > | \frac{1}{2} + * ^ + * | $$ + * ``` + * + * @type {State} + */ + function beforeContentChunk(code) { + if (code === codes.eof) { + return after(code) + } + + if (markdownLineEnding(code)) { + return effects.attempt( + nonLazyContinuation, + beforeNonLazyContinuation, + after + )(code) + } + + effects.enter('mathFlowValue') + return contentChunk(code) + } + + /** + * In math content. + * + * ```markdown + * | $$ + * > | \frac{1}{2} + * ^ + * | $$ + * ``` + * + * @type {State} + */ + function contentChunk(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit('mathFlowValue') + return beforeContentChunk(code) + } + + effects.consume(code) + return contentChunk + } + + /** + * After math (ha!). + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + effects.exit('mathFlow') + return ok(code) + } + + /** @type {Tokenizer} */ + function tokenizeClosingFence(effects, ok, nok) { + let size = 0 + + assert(self.parser.constructs.disable.null, 'expected `disable.null`') + /** + * Before closing fence, at optional whitespace. + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + */ + return factorySpace( + effects, + beforeSequenceClose, + types.linePrefix, + self.parser.constructs.disable.null.includes('codeIndented') + ? undefined + : constants.tabSize + ) + + /** + * In closing fence, after optional whitespace, at sequence. + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function beforeSequenceClose(code) { + effects.enter('mathFlowFence') + effects.enter('mathFlowFenceSequence') + return sequenceClose(code) + } + + /** + * In closing fence sequence. + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function sequenceClose(code) { + if (code === codes.dollarSign) { + size++ + effects.consume(code) + return sequenceClose + } + + if (size < sizeOpen) { + return nok(code) + } + + effects.exit('mathFlowFenceSequence') + return factorySpace(effects, afterSequenceClose, types.whitespace)(code) + } + + /** + * After closing fence sequence, after optional whitespace. + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function afterSequenceClose(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit('mathFlowFence') + return ok(code) + } + + return nok(code) + } + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeNonLazyContinuation(effects, ok, nok) { + const self = this + + return start + + /** @type {State} */ + function start(code) { + if (code === null) { + return ok(code) + } + + assert(markdownLineEnding(code), 'expected eol') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return lineStart + } + + /** @type {State} */ + function lineStart(code) { + return self.parser.lazy[self.now().line] ? nok(code) : ok(code) + } +} diff --git a/tools/ui/node_modules/micromark-extension-math/dev/lib/math-text.d.ts b/tools/ui/node_modules/micromark-extension-math/dev/lib/math-text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..14bb49ee16419544242883978ab1df40223d7564 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/lib/math-text.d.ts @@ -0,0 +1,9 @@ +/** + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {Construct} + * Construct. + */ +export function mathText(options?: Options | null | undefined): Construct; +import type { Options } from 'micromark-extension-math'; +import type { Construct } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-math/dev/lib/math-text.js b/tools/ui/node_modules/micromark-extension-math/dev/lib/math-text.js new file mode 100644 index 0000000000000000000000000000000000000000..808814f1d6d46e061d105fff57b256e74a225c1f --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/lib/math-text.js @@ -0,0 +1,267 @@ +/** + * @import {Options} from 'micromark-extension-math' + * @import {Construct, Previous, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +// To do: next major: clean spaces in HTML compiler. +// This has to be coordinated together with `mdast-util-math`. + +import {ok as assert} from 'devlop' +import {markdownLineEnding} from 'micromark-util-character' +import {codes, types} from 'micromark-util-symbol' + +/** + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {Construct} + * Construct. + */ +export function mathText(options) { + const options_ = options || {} + let single = options_.singleDollarTextMath + + if (single === null || single === undefined) { + single = true + } + + return { + tokenize: tokenizeMathText, + resolve: resolveMathText, + previous, + name: 'mathText' + } + + /** + * @this {TokenizeContext} + * @type {Tokenizer} + */ + function tokenizeMathText(effects, ok, nok) { + const self = this + let sizeOpen = 0 + /** @type {number} */ + let size + /** @type {Token} */ + let token + + return start + + /** + * Start of math (text). + * + * ```markdown + * > | $a$ + * ^ + * > | \$a$ + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.dollarSign, 'expected `$`') + assert(previous.call(self, self.previous), 'expected correct previous') + effects.enter('mathText') + effects.enter('mathTextSequence') + return sequenceOpen(code) + } + + /** + * In opening sequence. + * + * ```markdown + * > | $a$ + * ^ + * ``` + * + * @type {State} + */ + + function sequenceOpen(code) { + if (code === codes.dollarSign) { + effects.consume(code) + sizeOpen++ + return sequenceOpen + } + + // Not enough markers in the sequence. + if (sizeOpen < 2 && !single) { + return nok(code) + } + + effects.exit('mathTextSequence') + return between(code) + } + + /** + * Between something and something else. + * + * ```markdown + * > | $a$ + * ^^ + * ``` + * + * @type {State} + */ + function between(code) { + if (code === codes.eof) { + return nok(code) + } + + if (code === codes.dollarSign) { + token = effects.enter('mathTextSequence') + size = 0 + return sequenceClose(code) + } + + // Tabs don’t work, and virtual spaces don’t make sense. + if (code === codes.space) { + effects.enter('space') + effects.consume(code) + effects.exit('space') + return between + } + + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return between + } + + // Data. + effects.enter('mathTextData') + return data(code) + } + + /** + * In data. + * + * ```markdown + * > | $a$ + * ^ + * ``` + * + * @type {State} + */ + function data(code) { + if ( + code === codes.eof || + code === codes.space || + code === codes.dollarSign || + markdownLineEnding(code) + ) { + effects.exit('mathTextData') + return between(code) + } + + effects.consume(code) + return data + } + + /** + * In closing sequence. + * + * ```markdown + * > | `a` + * ^ + * ``` + * + * @type {State} + */ + + function sequenceClose(code) { + // More. + if (code === codes.dollarSign) { + effects.consume(code) + size++ + return sequenceClose + } + + // Done! + if (size === sizeOpen) { + effects.exit('mathTextSequence') + effects.exit('mathText') + return ok(code) + } + + // More or less accents: mark as data. + token.type = 'mathTextData' + return data(code) + } + } +} + +/** @type {Resolver} */ +function resolveMathText(events) { + let tailExitIndex = events.length - 4 + let headEnterIndex = 3 + /** @type {number} */ + let index + /** @type {number | undefined} */ + let enter + + // If we start and end with an EOL or a space. + if ( + (events[headEnterIndex][1].type === types.lineEnding || + events[headEnterIndex][1].type === 'space') && + (events[tailExitIndex][1].type === types.lineEnding || + events[tailExitIndex][1].type === 'space') + ) { + index = headEnterIndex + + // And we have data. + while (++index < tailExitIndex) { + if (events[index][1].type === 'mathTextData') { + // Then we have padding. + events[tailExitIndex][1].type = 'mathTextPadding' + events[headEnterIndex][1].type = 'mathTextPadding' + headEnterIndex += 2 + tailExitIndex -= 2 + break + } + } + } + + // Merge adjacent spaces and data. + index = headEnterIndex - 1 + tailExitIndex++ + + while (++index <= tailExitIndex) { + if (enter === undefined) { + if ( + index !== tailExitIndex && + events[index][1].type !== types.lineEnding + ) { + enter = index + } + } else if ( + index === tailExitIndex || + events[index][1].type === types.lineEnding + ) { + events[enter][1].type = 'mathTextData' + + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + tailExitIndex -= index - enter - 2 + index = enter + 2 + } + + enter = undefined + } + } + + return events +} + +/** + * @this {TokenizeContext} + * @type {Previous} + */ +function previous(code) { + // If there is a previous code, there will always be a tail. + return ( + code !== codes.dollarSign || + this.events[this.events.length - 1][1].type === types.characterEscape + ) +} diff --git a/tools/ui/node_modules/micromark-extension-math/dev/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-math/dev/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f15d535b564caf803073465a0bd35415d9df346 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/lib/syntax.d.ts @@ -0,0 +1,12 @@ +/** + * Create an extension for `micromark` to enable math syntax. + * + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions`, to + * enable math syntax. + */ +export function math(options?: Options | null | undefined): Extension; +import type { Options } from 'micromark-extension-math'; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-math/dev/lib/syntax.js b/tools/ui/node_modules/micromark-extension-math/dev/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..501ad98fe41a64ef1abd394c8180df85b6a46395 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/dev/lib/syntax.js @@ -0,0 +1,24 @@ +/** + * @import {Options} from 'micromark-extension-math' + * @import {Extension} from 'micromark-util-types' + */ + +import {codes} from 'micromark-util-symbol' +import {mathFlow} from './math-flow.js' +import {mathText} from './math-text.js' + +/** + * Create an extension for `micromark` to enable math syntax. + * + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions`, to + * enable math syntax. + */ +export function math(options) { + return { + flow: {[codes.dollarSign]: mathFlow}, + text: {[codes.dollarSign]: mathText(options)} + } +} diff --git a/tools/ui/node_modules/micromark-extension-math/index.d.ts b/tools/ui/node_modules/micromark-extension-math/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d09f0e576d8d5922ae975af3b9ce8adb068214e5 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/index.d.ts @@ -0,0 +1,61 @@ +import type {KatexOptions} from 'katex' + +export {mathHtml} from './lib/html.js' +export {math} from './lib/syntax.js' + +/** + * Configuration for HTML output. + * + * > 👉 **Note**: passed to `katex.renderToString`. + * > `displayMode` is overwritten by this plugin, to `false` for math in + * > text (inline), and `true` for math in flow (block). + */ +export interface HtmlOptions extends KatexOptions { + /** + * The field `displayMode` cannot be passed to `micromark-extension-math`. + * It is overwritten by it, + * to `false` for math in text (inline) and `true` for math in flow (block). + */ + displayMode?: never +} + +/** + * Configuration. + */ +export interface Options { + /** + * Whether to support math (text) with a single dollar (default: `true`). + * + * Single dollars work in Pandoc and many other places, but often interfere + * with “normal” dollars in text. + * If you turn this off, you can use two or more dollars for text math. + */ + singleDollarTextMath?: boolean | null | undefined +} + +/** + * Augment types. + */ +declare module 'micromark-util-types' { + /** + * Compile data. + */ + interface CompileData { + mathFlowOpen?: boolean + } + + /** + * Token types. + */ + interface TokenTypeMap { + mathFlow: 'mathFlow' + mathFlowFence: 'mathFlowFence' + mathFlowFenceMeta: 'mathFlowFenceMeta' + mathFlowFenceSequence: 'mathFlowFenceSequence' + mathFlowValue: 'mathFlowValue' + mathText: 'mathText' + mathTextData: 'mathTextData' + mathTextPadding: 'mathTextPadding' + mathTextSequence: 'mathTextSequence' + } +} diff --git a/tools/ui/node_modules/micromark-extension-math/index.js b/tools/ui/node_modules/micromark-extension-math/index.js new file mode 100644 index 0000000000000000000000000000000000000000..59bed9f691f6322b972cb58ff059672e619a6034 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/index.js @@ -0,0 +1,3 @@ +// Note: types exported from `index.d.ts`. +export { math } from './lib/syntax.js'; +export { mathHtml } from './lib/html.js'; \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-math/lib/html.d.ts b/tools/ui/node_modules/micromark-extension-math/lib/html.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b1b230dd20b6bd8e613859520e07f86f909e3f77 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/lib/html.d.ts @@ -0,0 +1,15 @@ +/** + * Create an extension for `micromark` to support math when serializing to + * HTML. + * + * > 👉 **Note**: this uses KaTeX to render math. + * + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions`, to + * support math when serializing to HTML. + */ +export function mathHtml(options?: Options | null | undefined): HtmlExtension; +import type { HtmlOptions as Options } from 'micromark-extension-math'; +import type { HtmlExtension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-math/lib/html.js b/tools/ui/node_modules/micromark-extension-math/lib/html.js new file mode 100644 index 0000000000000000000000000000000000000000..ed467d206f62323cee3a7fc5dc454ca84b1d9291 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/lib/html.js @@ -0,0 +1,84 @@ +/** + * @import {HtmlOptions as Options} from 'micromark-extension-math' + * @import {HtmlExtension} from 'micromark-util-types' + */ + +import katex from 'katex'; +const renderToString = katex.renderToString; + +/** + * Create an extension for `micromark` to support math when serializing to + * HTML. + * + * > 👉 **Note**: this uses KaTeX to render math. + * + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {HtmlExtension} + * Extension for `micromark` that can be passed in `htmlExtensions`, to + * support math when serializing to HTML. + */ +export function mathHtml(options) { + return { + enter: { + mathFlow() { + this.lineEndingIfNeeded(); + this.tag('<div class="math math-display">'); + }, + mathFlowFenceMeta() { + this.buffer(); + }, + mathText() { + // Double? + this.tag('<span class="math math-inline">'); + this.buffer(); + } + }, + exit: { + mathFlow() { + const value = this.resume(); + this.tag(math(value.replace(/(?:\r?\n|\r)$/, ''), true)); + this.tag('</div>'); + this.setData('mathFlowOpen'); + this.setData('slurpOneLineEnding'); + }, + mathFlowFence() { + // After the first fence. + if (!this.getData('mathFlowOpen')) { + this.setData('mathFlowOpen', true); + this.setData('slurpOneLineEnding', true); + this.buffer(); + } + }, + mathFlowFenceMeta() { + this.resume(); + }, + mathFlowValue(token) { + this.raw(this.sliceSerialize(token)); + }, + mathText() { + const value = this.resume(); + this.tag(math(value, false)); + this.tag('</span>'); + }, + mathTextData(token) { + this.raw(this.sliceSerialize(token)); + } + } + }; + + /** + * @param {string} value + * Math text. + * @param {boolean} displayMode + * Whether the math is in display mode. + * @returns {string} + * HTML. + */ + function math(value, displayMode) { + return renderToString(value, { + ...options, + displayMode + }); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-math/lib/math-flow.d.ts b/tools/ui/node_modules/micromark-extension-math/lib/math-flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..faf8303145f9cb39db4523fd775bb1b0d651a401 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/lib/math-flow.d.ts @@ -0,0 +1,3 @@ +/** @type {Construct} */ +export const mathFlow: Construct; +import type { Construct } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-math/lib/math-flow.js b/tools/ui/node_modules/micromark-extension-math/lib/math-flow.js new file mode 100644 index 0000000000000000000000000000000000000000..e5646a713c12adaa44f3b1b294a0ca858daed3a3 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/lib/math-flow.js @@ -0,0 +1,345 @@ +/** + * @import {Construct, State, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding } from 'micromark-util-character'; +/** @type {Construct} */ +export const mathFlow = { + tokenize: tokenizeMathFenced, + concrete: true, + name: 'mathFlow' +}; + +/** @type {Construct} */ +const nonLazyContinuation = { + tokenize: tokenizeNonLazyContinuation, + partial: true +}; + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeMathFenced(effects, ok, nok) { + const self = this; + const tail = self.events[self.events.length - 1]; + const initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; + let sizeOpen = 0; + return start; + + /** + * Start of math. + * + * ```markdown + * > | $$ + * ^ + * | \frac{1}{2} + * | $$ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter('mathFlow'); + effects.enter('mathFlowFence'); + effects.enter('mathFlowFenceSequence'); + return sequenceOpen(code); + } + + /** + * In opening fence sequence. + * + * ```markdown + * > | $$ + * ^ + * | \frac{1}{2} + * | $$ + * ``` + * + * @type {State} + */ + function sequenceOpen(code) { + if (code === 36) { + effects.consume(code); + sizeOpen++; + return sequenceOpen; + } + if (sizeOpen < 2) { + return nok(code); + } + effects.exit('mathFlowFenceSequence'); + return factorySpace(effects, metaBefore, "whitespace")(code); + } + + /** + * In opening fence, before meta. + * + * ```markdown + * > | $$asciimath + * ^ + * | x < y + * | $$ + * ``` + * + * @type {State} + */ + + function metaBefore(code) { + if (code === null || markdownLineEnding(code)) { + return metaAfter(code); + } + effects.enter('mathFlowFenceMeta'); + effects.enter("chunkString", { + contentType: "string" + }); + return meta(code); + } + + /** + * In meta. + * + * ```markdown + * > | $$asciimath + * ^ + * | x < y + * | $$ + * ``` + * + * @type {State} + */ + function meta(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("chunkString"); + effects.exit('mathFlowFenceMeta'); + return metaAfter(code); + } + if (code === 36) { + return nok(code); + } + effects.consume(code); + return meta; + } + + /** + * After meta. + * + * ```markdown + * > | $$ + * ^ + * | \frac{1}{2} + * | $$ + * ``` + * + * @type {State} + */ + function metaAfter(code) { + // Guaranteed to be eol/eof. + effects.exit('mathFlowFence'); + if (self.interrupt) { + return ok(code); + } + return effects.attempt(nonLazyContinuation, beforeNonLazyContinuation, after)(code); + } + + /** + * After eol/eof in math, at a non-lazy closing fence or content. + * + * ```markdown + * | $$ + * > | \frac{1}{2} + * ^ + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function beforeNonLazyContinuation(code) { + return effects.attempt({ + tokenize: tokenizeClosingFence, + partial: true + }, after, contentStart)(code); + } + + /** + * Before math content, definitely not before a closing fence. + * + * ```markdown + * | $$ + * > | \frac{1}{2} + * ^ + * | $$ + * ``` + * + * @type {State} + */ + function contentStart(code) { + return (initialSize ? factorySpace(effects, beforeContentChunk, "linePrefix", initialSize + 1) : beforeContentChunk)(code); + } + + /** + * Before math content, after optional prefix. + * + * ```markdown + * | $$ + * > | \frac{1}{2} + * ^ + * | $$ + * ``` + * + * @type {State} + */ + function beforeContentChunk(code) { + if (code === null) { + return after(code); + } + if (markdownLineEnding(code)) { + return effects.attempt(nonLazyContinuation, beforeNonLazyContinuation, after)(code); + } + effects.enter('mathFlowValue'); + return contentChunk(code); + } + + /** + * In math content. + * + * ```markdown + * | $$ + * > | \frac{1}{2} + * ^ + * | $$ + * ``` + * + * @type {State} + */ + function contentChunk(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('mathFlowValue'); + return beforeContentChunk(code); + } + effects.consume(code); + return contentChunk; + } + + /** + * After math (ha!). + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + effects.exit('mathFlow'); + return ok(code); + } + + /** @type {Tokenizer} */ + function tokenizeClosingFence(effects, ok, nok) { + let size = 0; + /** + * Before closing fence, at optional whitespace. + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + */ + return factorySpace(effects, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4); + + /** + * In closing fence, after optional whitespace, at sequence. + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function beforeSequenceClose(code) { + effects.enter('mathFlowFence'); + effects.enter('mathFlowFenceSequence'); + return sequenceClose(code); + } + + /** + * In closing fence sequence. + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function sequenceClose(code) { + if (code === 36) { + size++; + effects.consume(code); + return sequenceClose; + } + if (size < sizeOpen) { + return nok(code); + } + effects.exit('mathFlowFenceSequence'); + return factorySpace(effects, afterSequenceClose, "whitespace")(code); + } + + /** + * After closing fence sequence, after optional whitespace. + * + * ```markdown + * | $$ + * | \frac{1}{2} + * > | $$ + * ^ + * ``` + * + * @type {State} + */ + function afterSequenceClose(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit('mathFlowFence'); + return ok(code); + } + return nok(code); + } + } +} + +/** + * @this {TokenizeContext} + * @type {Tokenizer} + */ +function tokenizeNonLazyContinuation(effects, ok, nok) { + const self = this; + return start; + + /** @type {State} */ + function start(code) { + if (code === null) { + return ok(code); + } + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return lineStart; + } + + /** @type {State} */ + function lineStart(code) { + return self.parser.lazy[self.now().line] ? nok(code) : ok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-math/lib/math-text.d.ts b/tools/ui/node_modules/micromark-extension-math/lib/math-text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..14bb49ee16419544242883978ab1df40223d7564 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/lib/math-text.d.ts @@ -0,0 +1,9 @@ +/** + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {Construct} + * Construct. + */ +export function mathText(options?: Options | null | undefined): Construct; +import type { Options } from 'micromark-extension-math'; +import type { Construct } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-math/lib/math-text.js b/tools/ui/node_modules/micromark-extension-math/lib/math-text.js new file mode 100644 index 0000000000000000000000000000000000000000..232f63139b3f66b1497305b9df8d948aa0dd9d59 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/lib/math-text.js @@ -0,0 +1,232 @@ +/** + * @import {Options} from 'micromark-extension-math' + * @import {Construct, Previous, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types' + */ + +// To do: next major: clean spaces in HTML compiler. +// This has to be coordinated together with `mdast-util-math`. + +import { markdownLineEnding } from 'micromark-util-character'; +/** + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {Construct} + * Construct. + */ +export function mathText(options) { + const options_ = options || {}; + let single = options_.singleDollarTextMath; + if (single === null || single === undefined) { + single = true; + } + return { + tokenize: tokenizeMathText, + resolve: resolveMathText, + previous, + name: 'mathText' + }; + + /** + * @this {TokenizeContext} + * @type {Tokenizer} + */ + function tokenizeMathText(effects, ok, nok) { + const self = this; + let sizeOpen = 0; + /** @type {number} */ + let size; + /** @type {Token} */ + let token; + return start; + + /** + * Start of math (text). + * + * ```markdown + * > | $a$ + * ^ + * > | \$a$ + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter('mathText'); + effects.enter('mathTextSequence'); + return sequenceOpen(code); + } + + /** + * In opening sequence. + * + * ```markdown + * > | $a$ + * ^ + * ``` + * + * @type {State} + */ + + function sequenceOpen(code) { + if (code === 36) { + effects.consume(code); + sizeOpen++; + return sequenceOpen; + } + + // Not enough markers in the sequence. + if (sizeOpen < 2 && !single) { + return nok(code); + } + effects.exit('mathTextSequence'); + return between(code); + } + + /** + * Between something and something else. + * + * ```markdown + * > | $a$ + * ^^ + * ``` + * + * @type {State} + */ + function between(code) { + if (code === null) { + return nok(code); + } + if (code === 36) { + token = effects.enter('mathTextSequence'); + size = 0; + return sequenceClose(code); + } + + // Tabs don’t work, and virtual spaces don’t make sense. + if (code === 32) { + effects.enter('space'); + effects.consume(code); + effects.exit('space'); + return between; + } + if (markdownLineEnding(code)) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return between; + } + + // Data. + effects.enter('mathTextData'); + return data(code); + } + + /** + * In data. + * + * ```markdown + * > | $a$ + * ^ + * ``` + * + * @type {State} + */ + function data(code) { + if (code === null || code === 32 || code === 36 || markdownLineEnding(code)) { + effects.exit('mathTextData'); + return between(code); + } + effects.consume(code); + return data; + } + + /** + * In closing sequence. + * + * ```markdown + * > | `a` + * ^ + * ``` + * + * @type {State} + */ + + function sequenceClose(code) { + // More. + if (code === 36) { + effects.consume(code); + size++; + return sequenceClose; + } + + // Done! + if (size === sizeOpen) { + effects.exit('mathTextSequence'); + effects.exit('mathText'); + return ok(code); + } + + // More or less accents: mark as data. + token.type = 'mathTextData'; + return data(code); + } + } +} + +/** @type {Resolver} */ +function resolveMathText(events) { + let tailExitIndex = events.length - 4; + let headEnterIndex = 3; + /** @type {number} */ + let index; + /** @type {number | undefined} */ + let enter; + + // If we start and end with an EOL or a space. + if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === 'space')) { + index = headEnterIndex; + + // And we have data. + while (++index < tailExitIndex) { + if (events[index][1].type === 'mathTextData') { + // Then we have padding. + events[tailExitIndex][1].type = 'mathTextPadding'; + events[headEnterIndex][1].type = 'mathTextPadding'; + headEnterIndex += 2; + tailExitIndex -= 2; + break; + } + } + } + + // Merge adjacent spaces and data. + index = headEnterIndex - 1; + tailExitIndex++; + while (++index <= tailExitIndex) { + if (enter === undefined) { + if (index !== tailExitIndex && events[index][1].type !== "lineEnding") { + enter = index; + } + } else if (index === tailExitIndex || events[index][1].type === "lineEnding") { + events[enter][1].type = 'mathTextData'; + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end; + events.splice(enter + 2, index - enter - 2); + tailExitIndex -= index - enter - 2; + index = enter + 2; + } + enter = undefined; + } + } + return events; +} + +/** + * @this {TokenizeContext} + * @type {Previous} + */ +function previous(code) { + // If there is a previous code, there will always be a tail. + return code !== 36 || this.events[this.events.length - 1][1].type === "characterEscape"; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-math/lib/syntax.d.ts b/tools/ui/node_modules/micromark-extension-math/lib/syntax.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f15d535b564caf803073465a0bd35415d9df346 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/lib/syntax.d.ts @@ -0,0 +1,12 @@ +/** + * Create an extension for `micromark` to enable math syntax. + * + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions`, to + * enable math syntax. + */ +export function math(options?: Options | null | undefined): Extension; +import type { Options } from 'micromark-extension-math'; +import type { Extension } from 'micromark-util-types'; diff --git a/tools/ui/node_modules/micromark-extension-math/lib/syntax.js b/tools/ui/node_modules/micromark-extension-math/lib/syntax.js new file mode 100644 index 0000000000000000000000000000000000000000..672bcdc09214fbb19c3b225f83fc23bc898ccf4f --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/lib/syntax.js @@ -0,0 +1,27 @@ +/** + * @import {Options} from 'micromark-extension-math' + * @import {Extension} from 'micromark-util-types' + */ + +import { mathFlow } from './math-flow.js'; +import { mathText } from './math-text.js'; + +/** + * Create an extension for `micromark` to enable math syntax. + * + * @param {Options | null | undefined} [options={}] + * Configuration (default: `{}`). + * @returns {Extension} + * Extension for `micromark` that can be passed in `extensions`, to + * enable math syntax. + */ +export function math(options) { + return { + flow: { + [36]: mathFlow + }, + text: { + [36]: mathText(options) + } + }; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-extension-math/license b/tools/ui/node_modules/micromark-extension-math/license new file mode 100644 index 0000000000000000000000000000000000000000..39372356c47d0f6e070ff62d84c69f4f5e8c16eb --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2020 Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-extension-math/package.json b/tools/ui/node_modules/micromark-extension-math/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1f7c882e2eda4d151a90ea591e1b3b39c7a4c53b --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/package.json @@ -0,0 +1,121 @@ +{ + "name": "micromark-extension-math", + "version": "3.1.0", + "description": "micromark extension to support math (`$C_L$`)", + "license": "MIT", + "keywords": [ + "micromark", + "micromark-extension", + "math", + "katex", + "latex", + "tex", + "markdown", + "unified" + ], + "repository": "micromark/micromark-extension-math", + "bugs": "https://github.com/micromark/micromark-extension-math/issues", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "files": [ + "dev/", + "lib/", + "index.d.ts", + "index.js" + ], + "dependencies": { + "@types/katex": "^0.16.0", + "devlop": "^1.0.0", + "katex": "^0.16.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "c8": "^10.0.0", + "micromark": "^4.0.0", + "micromark-build": "^2.0.0", + "prettier": "^3.0.0", + "remark-cli": "^12.0.0", + "remark-preset-wooorm": "^10.0.0", + "type-coverage": "^2.0.0", + "typescript": "^5.0.0", + "xo": "^0.58.0" + }, + "scripts": { + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage && micromark-build", + "format": "remark . -qfo && prettier . -w --log-level warn && xo --fix", + "test-api-prod": "node --conditions production test/index.js", + "test-api-dev": "node --conditions development test/index.js", + "test-api": "npm run test-api-dev && npm run test-api-prod", + "test-coverage": "c8 --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" + }, + "prettier": { + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false + }, + "remarkConfig": { + "plugins": [ + "remark-preset-wooorm" + ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "ignoreCatch": true, + "strict": true + }, + "xo": { + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + } + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-at": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-extension-math/readme.md b/tools/ui/node_modules/micromark-extension-math/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..6b57c2ab8cdbe8191195cc6b5795c35410b80ab5 --- /dev/null +++ b/tools/ui/node_modules/micromark-extension-math/readme.md @@ -0,0 +1,429 @@ +# micromark-extension-math + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][size-badge]][size] +[![Sponsors][sponsors-badge]][collective] +[![Backers][backers-badge]][collective] +[![Chat][chat-badge]][chat] + +[micromark][] extensions to support math (`$C_L$`). + +## Contents + +* [What is this?](#what-is-this) +* [When to use this](#when-to-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`math(options?)`](#mathoptions) + * [`mathHtml(options?)`](#mathhtmloptions) + * [`HtmlOptions`](#htmloptions) + * [`Options`](#options) +* [Authoring](#authoring) +* [HTML](#html) +* [CSS](#css) +* [Syntax](#syntax) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Related](#related) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package contains two extensions that add support for math syntax +in markdown to [`micromark`][micromark]. + +As there is no spec for math in markdown, this extension follows how code +(fenced and text) works in Commonmark, but uses dollars. + +## When to use this + +This project is useful when you want to support math in markdown. +Extending markdown with a syntax extension makes the markdown less portable. +LaTeX equations are also quite hard. +But this mechanism works well when you want authors, that have some LaTeX +experience, to be able to embed rich diagrams of math in scientific text. + +You can use these extensions when you are working with [`micromark`][micromark] +already. + +When you need a syntax tree, you can combine this package with +[`mdast-util-math`][mdast-util-math]. + +All these packages are used [`remark-math`][remark-math], which focusses on +making it easier to transform content by abstracting these internals away. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +[npm][]: + +```sh +npm install micromark-extension-math +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {math, mathHtml} from 'https://esm.sh/micromark-extension-math@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {math, mathHtml} from 'https://esm.sh/micromark-extension-math@3?bundle' +</script> +``` + +## Use + +Say our document `example.md` contains: + +```markdown +Lift($L$) can be determined by Lift Coefficient ($C_L$) like the following equation. + +$$ +L = \frac{1}{2} \rho v^2 S C_L +$$ +``` + +…and our module `example.js` looks as follows: + +```js +import fs from 'node:fs/promises' +import {micromark} from 'micromark' +import {math, mathHtml} from 'micromark-extension-math' + +const output = micromark(await fs.readFile('example.md'), { + extensions: [math()], + htmlExtensions: [mathHtml()] +}) + +console.log(output) +``` + +…now running `node example.js` yields (abbreviated): + +```html +<p>Lift(<span class="math math-inline"><span class="katex">…</span></span>) can be determined by Lift Coefficient (<span class="math math-inline"><span class="katex">…</span></span>) like the following equation.</p> +<div class="math math-display"><span class="katex-display"><span class="katex">…</span></span></div> +``` + +## API + +This package exports the identifiers [`math`][api-math] and +[`mathHtml`][api-math-html]. +There is no default export. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. + +### `math(options?)` + +Create an extension for `micromark` to enable math syntax. + +###### Parameters + +* `options` ([`Options`][api-options], default: `{}`) + — configuration + +###### Returns + +Extension for `micromark` that can be passed in `extensions`, to enable math +syntax ([`Extension`][micromark-extension]). + +### `mathHtml(options?)` + +Create an extension for `micromark` to support math when serializing to HTML. + +> 👉 **Note**: this uses KaTeX to render math. + +###### Parameters + +* `options` ([`HtmlOptions`][api-html-options], default: `{}`) + — configuration + +###### Returns + +Extension for `micromark` that can be passed in `htmlExtensions`, to support +math when serializing to HTML ([`HtmlExtension`][micromark-html-extension]). + +### `HtmlOptions` + +Configuration for HTML output (optional). + +> 👉 **Note**: passed to [`katex.renderToString`][katex-options]. +> `displayMode` is overwritten by this plugin, to `false` for math in text +> (inline), and `true` for math in flow (block). + +###### Type + +```ts +type Options = Omit<import('katex').KatexOptions, 'displayMode'> +``` + +### `Options` + +Configuration (TypeScript type). + +###### Fields + +* `singleDollarTextMath` (`boolean`, default: `true`) + — whether to support math (text, inline) with a single dollar. + Single dollars work in Pandoc and many other places, but often interfere + with “normal” dollars in text. + If you turn this off, you use two or more dollars for text math. + +## Authoring + +When authoring markdown with math, keep in mind that math doesn’t work in most +places. +Notably, GitHub currently has a really weird crappy client-side regex-based +thing. +But on your own (math-heavy?) site it can be great! +You can use code (fenced) with an info string of `math` to improve this, as +that works in many places. + +## HTML + +Math (flow) does not relate to HTML elements. +`MathML`, which is sort of like SVG but for math, exists but it doesn’t work +well and isn’t widely supported. +Instead, this uses [KaTeX][], which generates MathML as a fallback but also +generates a bunch of divs and spans so math look pretty. +The KaTeX result is wrapped in `<div>` (for flow, block) and `<span>` (for text, +inline) elements, with two classes: `math` and either `math-display` or +`math-inline`. + +When turning markdown into HTML, each line ending in math (text) is turned +into a space. + +## CSS + +The HTML produced by KaTeX requires CSS to render correctly. +You should use `katex.css` somewhere on the page where the math is shown to +style it properly. +At the time of writing, the last version is: + +<!-- To do: update and copy paste the one from: https://katex.org/docs/browser --> + +```html +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css"> +``` + +## Syntax + +Math forms with the following BNF: + +```bnf +; Restriction: the number of markers in the closing sequence must be equal +; to the number of markers in the opening sequence. +math_text ::= sequence_text 1*byte sequence_text +math_flow ::= fence_open *( eol *line ) [ eol fence_close ] + +; Restriction: not preceded or followed by the marker. +sequence_text ::= 1*'$' + +fence_open ::= sequence_flow meta +; Restriction: the number of markers in the closing fence sequence must be +; equal to or greater than the number of markers in the opening fence +; sequence. +fence_close ::= sequence_flow *space_or_tab +sequence_flow ::= 2*'$' +; Restriction: the marker cannot occur in `meta` +meta ::= 1*line + +; Character groups for informational purposes. +byte ::= 0x00..=0xFFFF +eol ::= '\n' | '\r' | '\r\n' +line ::= byte - eol +``` + +The above grammar shows that it is not possible to create empty math (text). +It is possible to include the sequence marker (dollar) in math (text), by +wrapping it in bigger or smaller sequences: + +```markdown +Include more: $a$$b$ or include less: $$a$b$$. +``` + +It is also possible to include just one marker: + +```markdown +Include just one: $$ $ $$. +``` + +Sequences are “gready”, in that they cannot be preceded or followed by more +markers. +To illustrate: + +```markdown +Not math: $$x$. + +Not math: $x$$. + +Escapes work, this is math: \$$x$. + +Escapes work, this is math: $x$\$. +``` + +Yields: + +```html +<p>Not math: $$x$.</p> +<p>Not math: $x$$.</p> +<p>Escapes work, this is math: $<span>…</span>.</p> +<p>Escapes work, this is math: <span>…</span>$.</p> +``` + +That is because, when turning markdown into HTML, the first and last space, +if both exist and there is also a non-space in the math, are removed. +Line endings, at that stage, are considered as spaces. + +As the math (flow) construct occurs in flow, like all flow constructs, it must +be followed by an eol (line ending) or eof (end of file). + +The above grammar does not show how indentation of each line is handled. +To parse math (flow), let `x` be the number of `space_or_tab` characters +before the opening fence sequence, after interpreting tabs based on how many +virtual spaces they represent. +Each line of text is then allowed (not required) to be indented with up +to `x` spaces or tabs, which are then ignored as an indent instead of being +considered as part of the content. +This indent does not affect the closing fence. +It can be indented up to a separate 3 real or virtual spaces. +A bigger indent makes it part of the content instead of a fence. + +The `meta` part is interpreted as the [string][micromark-content-types] content +type. +That means that character escapes and character references are allowed. + +The optional `meta` part is ignored: it is not used when parsing or +rendering. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional types [`HtmlOptions`][api-html-options] +and [`Options`][api-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-extension-math@^3`, compatible with Node.js 16. + +This package works with `micromark` version `3` and later. + +## Security + +This package is safe assuming that you trust KaTeX. +Any vulnerability in it could open you to a [cross-site scripting (XSS)][xss] +attack. + +## Related + +* [`remark-math`][remark-math] + — remark (and rehype) plugins to support math +* [`mdast-util-math`][mdast-util-math] + — mdast utility to support math + +## Contribute + +See [`contributing.md` in `micromark/.github`][contributing] for ways to get +started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organization, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark-extension-math/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark-extension-math/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-math.svg + +[coverage]: https://codecov.io/github/micromark/micromark-extension-math + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-math.svg + +[downloads]: https://www.npmjs.com/package/micromark-extension-math + +[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-extension-math + +[size]: https://bundlejs.com/?q=micromark-extension-math + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[collective]: https://opencollective.com/unified + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[npm]: https://docs.npmjs.com/cli/install + +[esmsh]: https://esm.sh + +[license]: license + +[author]: https://wooorm.com + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[micromark]: https://github.com/micromark/micromark + +[micromark-content-types]: https://github.com/micromark/micromark#content-types + +[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension + +[micromark-extension]: https://github.com/micromark/micromark#syntaxextension + +[mdast-util-math]: https://github.com/syntax-tree/mdast-util-math + +[remark-math]: https://github.com/remarkjs/remark-math + +[katex]: https://katex.org + +[katex-options]: https://katex.org/docs/options.html + +[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting + +[api-math]: #mathoptions + +[api-math-html]: #mathhtmloptions + +[api-options]: #options + +[api-html-options]: #htmloptions diff --git a/tools/ui/node_modules/micromark-factory-destination/dev/index.d.ts b/tools/ui/node_modules/micromark-factory-destination/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d5e02a5d8ed065a2fc82e15e7e16aad882a5cc3 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-destination/dev/index.d.ts @@ -0,0 +1,42 @@ +/** + * Parse destinations. + * + * ###### Examples + * + * ```markdown + * <a> + * <a\>b> + * <a b> + * <a)> + * a + * a\)b + * a(b)c + * a(b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type for whole (`<a>` or `b`). + * @param {TokenType} literalType + * Type when enclosed (`<a>`). + * @param {TokenType} literalMarkerType + * Type for enclosing (`<` and `>`). + * @param {TokenType} rawType + * Type when not enclosed (`b`). + * @param {TokenType} stringType + * Type for the value (`a` or `b`). + * @param {number | undefined} [max=Infinity] + * Depth of nested parens (inclusive). + * @returns {State} + * Start state. + */ +export function factoryDestination(effects: Effects, ok: State, nok: State, type: TokenType, literalType: TokenType, literalMarkerType: TokenType, rawType: TokenType, stringType: TokenType, max?: number | undefined): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-destination/dev/index.d.ts.map b/tools/ui/node_modules/micromark-factory-destination/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..84746ee217e2447f8842e07224b3893e657147b5 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-destination/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,4CArBW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,eAET,SAAS,qBAET,SAAS,WAET,SAAS,cAET,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CAiNjB;6BA7P2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-destination/dev/index.js b/tools/ui/node_modules/micromark-factory-destination/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a4816fdc0dd5d7ee19170a8c09acd4ce3d60831e --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-destination/dev/index.js @@ -0,0 +1,255 @@ +/** + * @import {Effects, State, TokenType} from 'micromark-util-types' + */ + +import { + asciiControl, + markdownLineEndingOrSpace, + markdownLineEnding +} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** + * Parse destinations. + * + * ###### Examples + * + * ```markdown + * <a> + * <a\>b> + * <a b> + * <a)> + * a + * a\)b + * a(b)c + * a(b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type for whole (`<a>` or `b`). + * @param {TokenType} literalType + * Type when enclosed (`<a>`). + * @param {TokenType} literalMarkerType + * Type for enclosing (`<` and `>`). + * @param {TokenType} rawType + * Type when not enclosed (`b`). + * @param {TokenType} stringType + * Type for the value (`a` or `b`). + * @param {number | undefined} [max=Infinity] + * Depth of nested parens (inclusive). + * @returns {State} + * Start state. + */ +export function factoryDestination( + effects, + ok, + nok, + type, + literalType, + literalMarkerType, + rawType, + stringType, + max +) { + const limit = max || Number.POSITIVE_INFINITY + let balance = 0 + + return start + + /** + * Start of destination. + * + * ```markdown + * > | <aa> + * ^ + * > | aa + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if (code === codes.lessThan) { + effects.enter(type) + effects.enter(literalType) + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + return enclosedBefore + } + + // ASCII control, space, closing paren. + if ( + code === codes.eof || + code === codes.space || + code === codes.rightParenthesis || + asciiControl(code) + ) { + return nok(code) + } + + effects.enter(type) + effects.enter(rawType) + effects.enter(stringType) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return raw(code) + } + + /** + * After `<`, at an enclosed destination. + * + * ```markdown + * > | <aa> + * ^ + * ``` + * + * @type {State} + */ + function enclosedBefore(code) { + if (code === codes.greaterThan) { + effects.enter(literalMarkerType) + effects.consume(code) + effects.exit(literalMarkerType) + effects.exit(literalType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return enclosed(code) + } + + /** + * In enclosed destination. + * + * ```markdown + * > | <aa> + * ^ + * ``` + * + * @type {State} + */ + function enclosed(code) { + if (code === codes.greaterThan) { + effects.exit(types.chunkString) + effects.exit(stringType) + return enclosedBefore(code) + } + + if ( + code === codes.eof || + code === codes.lessThan || + markdownLineEnding(code) + ) { + return nok(code) + } + + effects.consume(code) + return code === codes.backslash ? enclosedEscape : enclosed + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | <a\*a> + * ^ + * ``` + * + * @type {State} + */ + function enclosedEscape(code) { + if ( + code === codes.lessThan || + code === codes.greaterThan || + code === codes.backslash + ) { + effects.consume(code) + return enclosed + } + + return enclosed(code) + } + + /** + * In raw destination. + * + * ```markdown + * > | aa + * ^ + * ``` + * + * @type {State} + */ + function raw(code) { + if ( + !balance && + (code === codes.eof || + code === codes.rightParenthesis || + markdownLineEndingOrSpace(code)) + ) { + effects.exit(types.chunkString) + effects.exit(stringType) + effects.exit(rawType) + effects.exit(type) + return ok(code) + } + + if (balance < limit && code === codes.leftParenthesis) { + effects.consume(code) + balance++ + return raw + } + + if (code === codes.rightParenthesis) { + effects.consume(code) + balance-- + return raw + } + + // ASCII control (but *not* `\0`) and space and `(`. + // Note: in `markdown-rs`, `\0` exists in codes, in `micromark-js` it + // doesn’t. + if ( + code === codes.eof || + code === codes.space || + code === codes.leftParenthesis || + asciiControl(code) + ) { + return nok(code) + } + + effects.consume(code) + return code === codes.backslash ? rawEscape : raw + } + + /** + * After `\`, at special character. + * + * ```markdown + * > | a\*a + * ^ + * ``` + * + * @type {State} + */ + function rawEscape(code) { + if ( + code === codes.leftParenthesis || + code === codes.rightParenthesis || + code === codes.backslash + ) { + effects.consume(code) + return raw + } + + return raw(code) + } +} diff --git a/tools/ui/node_modules/micromark-factory-destination/index.d.ts b/tools/ui/node_modules/micromark-factory-destination/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d5e02a5d8ed065a2fc82e15e7e16aad882a5cc3 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-destination/index.d.ts @@ -0,0 +1,42 @@ +/** + * Parse destinations. + * + * ###### Examples + * + * ```markdown + * <a> + * <a\>b> + * <a b> + * <a)> + * a + * a\)b + * a(b)c + * a(b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type for whole (`<a>` or `b`). + * @param {TokenType} literalType + * Type when enclosed (`<a>`). + * @param {TokenType} literalMarkerType + * Type for enclosing (`<` and `>`). + * @param {TokenType} rawType + * Type when not enclosed (`b`). + * @param {TokenType} stringType + * Type for the value (`a` or `b`). + * @param {number | undefined} [max=Infinity] + * Depth of nested parens (inclusive). + * @returns {State} + * Start state. + */ +export function factoryDestination(effects: Effects, ok: State, nok: State, type: TokenType, literalType: TokenType, literalMarkerType: TokenType, rawType: TokenType, stringType: TokenType, max?: number | undefined): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-destination/index.d.ts.map b/tools/ui/node_modules/micromark-factory-destination/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..84746ee217e2447f8842e07224b3893e657147b5 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-destination/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,4CArBW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,eAET,SAAS,qBAET,SAAS,WAET,SAAS,cAET,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CAiNjB;6BA7P2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-destination/index.js b/tools/ui/node_modules/micromark-factory-destination/index.js new file mode 100644 index 0000000000000000000000000000000000000000..eeb60de6d7fcb60021f6290acc7045854bc04ec7 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-destination/index.js @@ -0,0 +1,206 @@ +/** + * @import {Effects, State, TokenType} from 'micromark-util-types' + */ + +import { asciiControl, markdownLineEndingOrSpace, markdownLineEnding } from 'micromark-util-character'; +/** + * Parse destinations. + * + * ###### Examples + * + * ```markdown + * <a> + * <a\>b> + * <a b> + * <a)> + * a + * a\)b + * a(b)c + * a(b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type for whole (`<a>` or `b`). + * @param {TokenType} literalType + * Type when enclosed (`<a>`). + * @param {TokenType} literalMarkerType + * Type for enclosing (`<` and `>`). + * @param {TokenType} rawType + * Type when not enclosed (`b`). + * @param {TokenType} stringType + * Type for the value (`a` or `b`). + * @param {number | undefined} [max=Infinity] + * Depth of nested parens (inclusive). + * @returns {State} + * Start state. + */ +export function factoryDestination(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) { + const limit = max || Number.POSITIVE_INFINITY; + let balance = 0; + return start; + + /** + * Start of destination. + * + * ```markdown + * > | <aa> + * ^ + * > | aa + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if (code === 60) { + effects.enter(type); + effects.enter(literalType); + effects.enter(literalMarkerType); + effects.consume(code); + effects.exit(literalMarkerType); + return enclosedBefore; + } + + // ASCII control, space, closing paren. + if (code === null || code === 32 || code === 41 || asciiControl(code)) { + return nok(code); + } + effects.enter(type); + effects.enter(rawType); + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return raw(code); + } + + /** + * After `<`, at an enclosed destination. + * + * ```markdown + * > | <aa> + * ^ + * ``` + * + * @type {State} + */ + function enclosedBefore(code) { + if (code === 62) { + effects.enter(literalMarkerType); + effects.consume(code); + effects.exit(literalMarkerType); + effects.exit(literalType); + effects.exit(type); + return ok; + } + effects.enter(stringType); + effects.enter("chunkString", { + contentType: "string" + }); + return enclosed(code); + } + + /** + * In enclosed destination. + * + * ```markdown + * > | <aa> + * ^ + * ``` + * + * @type {State} + */ + function enclosed(code) { + if (code === 62) { + effects.exit("chunkString"); + effects.exit(stringType); + return enclosedBefore(code); + } + if (code === null || code === 60 || markdownLineEnding(code)) { + return nok(code); + } + effects.consume(code); + return code === 92 ? enclosedEscape : enclosed; + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | <a\*a> + * ^ + * ``` + * + * @type {State} + */ + function enclosedEscape(code) { + if (code === 60 || code === 62 || code === 92) { + effects.consume(code); + return enclosed; + } + return enclosed(code); + } + + /** + * In raw destination. + * + * ```markdown + * > | aa + * ^ + * ``` + * + * @type {State} + */ + function raw(code) { + if (!balance && (code === null || code === 41 || markdownLineEndingOrSpace(code))) { + effects.exit("chunkString"); + effects.exit(stringType); + effects.exit(rawType); + effects.exit(type); + return ok(code); + } + if (balance < limit && code === 40) { + effects.consume(code); + balance++; + return raw; + } + if (code === 41) { + effects.consume(code); + balance--; + return raw; + } + + // ASCII control (but *not* `\0`) and space and `(`. + // Note: in `markdown-rs`, `\0` exists in codes, in `micromark-js` it + // doesn’t. + if (code === null || code === 32 || code === 40 || asciiControl(code)) { + return nok(code); + } + effects.consume(code); + return code === 92 ? rawEscape : raw; + } + + /** + * After `\`, at special character. + * + * ```markdown + * > | a\*a + * ^ + * ``` + * + * @type {State} + */ + function rawEscape(code) { + if (code === 40 || code === 41 || code === 92) { + effects.consume(code); + return raw; + } + return raw(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-destination/license b/tools/ui/node_modules/micromark-factory-destination/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-destination/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-factory-destination/package.json b/tools/ui/node_modules/micromark-factory-destination/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0863cb696dc99a83fdb4bbd95fcc769119f66b0f --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-destination/package.json @@ -0,0 +1,57 @@ +{ + "name": "micromark-factory-destination", + "version": "2.0.1", + "description": "micromark factory to parse destinations (found in resources, definitions)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "destination" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-destination", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "max-params": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-factory-destination/readme.md b/tools/ui/node_modules/micromark-factory-destination/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..f4899d74da5534f3467da929dfe1a94414cf2e8f --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-destination/readme.md @@ -0,0 +1,234 @@ +# micromark-factory-destination + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse destinations (found in resources, definitions). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factoryDestination(…)`](#factorydestination) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse destinations. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-destination +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factoryDestination} from 'https://esm.sh/micromark-factory-destination@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factoryDestination} from 'https://esm.sh/micromark-factory-destination@1?bundle' +</script> +``` + +## Use + +```js +import {factoryDestination} from 'micromark-factory-destination' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeResource(effects, ok, nok) { + return start + + // … + + /** @type {State} */ + function open(code) { + if (code === codes.rightParenthesis) { + return end(code) + } + + return factoryDestination( + effects, + destinationAfter, + nok, + types.resourceDestination, + types.resourceDestinationLiteral, + types.resourceDestinationLiteralMarker, + types.resourceDestinationRaw, + types.resourceDestinationString, + constants.linkResourceDestinationBalanceMax + )(code) + } + + // … +} +``` + +## API + +This module exports the identifier +[`factoryDestination`][api-factory-destination]. +There is no default export. + +### `factoryDestination(…)` + +Parse destinations. + +###### Examples + +```markdown +<a> +<a\>b> +<a b> +<a)> +a +a\)b +a(b)c +a(b) +``` + +###### Parameters + +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful +* `nok` (`State`) + — state switched to when unsuccessful +* `type` (`string`) + — type for whole (`<a>` or `b`) +* `literalType` (`string`) + — type when enclosed (`<a>`) +* `literalMarkerType` (`string`) + — type for enclosing (`<` and `>`) +* `rawType` (`string`) + — type when not enclosed (`b`) +* `stringType` (`string`) + — type for the value (`a` or `b`) +* `max` (`number`, default: `Infinity`) + — depth of nested parens (inclusive) + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-destination@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-destination.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-destination + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-destination + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-destination + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-destination]: #factorydestination diff --git a/tools/ui/node_modules/micromark-factory-label/dev/index.d.ts b/tools/ui/node_modules/micromark-factory-label/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..99f5bdad4208705c7d113ed649aadaba5ecec347 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-label/dev/index.d.ts @@ -0,0 +1,37 @@ +/** + * Parse labels. + * + * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. + * + * ###### Examples + * + * ```markdown + * [a] + * [a + * b] + * [a\]b] + * ``` + * + * @this {TokenizeContext} + * Tokenize context. + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole label (`[a]`). + * @param {TokenType} markerType + * Type for the markers (`[` and `]`). + * @param {TokenType} stringType + * Type for the identifier (`a`). + * @returns {State} + * Start state. + */ +export function factoryLabel(this: TokenizeContext, effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +import type { TokenizeContext } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-label/dev/index.d.ts.map b/tools/ui/node_modules/micromark-factory-label/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..fe94eeea2d078425e41b8a60785511d169bdae74 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-label/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,6DAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CAkIjB;6BArKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB;qCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-label/dev/index.js b/tools/ui/node_modules/micromark-factory-label/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..242f0ced9cfbe9a1a24cb5bf0b5c5f6ebd558a66 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-label/dev/index.js @@ -0,0 +1,172 @@ +/** + * @import { + * Effects, + * State, + * TokenizeContext, + * TokenType + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {markdownLineEnding, markdownSpace} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** + * Parse labels. + * + * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. + * + * ###### Examples + * + * ```markdown + * [a] + * [a + * b] + * [a\]b] + * ``` + * + * @this {TokenizeContext} + * Tokenize context. + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole label (`[a]`). + * @param {TokenType} markerType + * Type for the markers (`[` and `]`). + * @param {TokenType} stringType + * Type for the identifier (`a`). + * @returns {State} + * Start state. + */ +export function factoryLabel(effects, ok, nok, type, markerType, stringType) { + const self = this + let size = 0 + /** @type {boolean} */ + let seen + + return start + + /** + * Start of label. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.enter(stringType) + return atBreak + } + + /** + * In label, at something, before something else. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if ( + size > constants.linkReferenceSizeMax || + code === codes.eof || + code === codes.leftSquareBracket || + (code === codes.rightSquareBracket && !seen) || + // To do: remove in the future once we’ve switched from + // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`, + // which doesn’t need this. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + (code === codes.caret && + !size && + '_hiddenFootnoteSupport' in self.parser.constructs) + ) { + return nok(code) + } + + if (code === codes.rightSquareBracket) { + effects.exit(stringType) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + // To do: indent? Link chunks and EOLs together? + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return atBreak + } + + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return labelInside(code) + } + + /** + * In label, in text. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function labelInside(code) { + if ( + code === codes.eof || + code === codes.leftSquareBracket || + code === codes.rightSquareBracket || + markdownLineEnding(code) || + size++ > constants.linkReferenceSizeMax + ) { + effects.exit(types.chunkString) + return atBreak(code) + } + + effects.consume(code) + if (!seen) seen = !markdownSpace(code) + return code === codes.backslash ? labelEscape : labelInside + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | [a\*a] + * ^ + * ``` + * + * @type {State} + */ + function labelEscape(code) { + if ( + code === codes.leftSquareBracket || + code === codes.backslash || + code === codes.rightSquareBracket + ) { + effects.consume(code) + size++ + return labelInside + } + + return labelInside(code) + } +} diff --git a/tools/ui/node_modules/micromark-factory-label/index.d.ts b/tools/ui/node_modules/micromark-factory-label/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..99f5bdad4208705c7d113ed649aadaba5ecec347 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-label/index.d.ts @@ -0,0 +1,37 @@ +/** + * Parse labels. + * + * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. + * + * ###### Examples + * + * ```markdown + * [a] + * [a + * b] + * [a\]b] + * ``` + * + * @this {TokenizeContext} + * Tokenize context. + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole label (`[a]`). + * @param {TokenType} markerType + * Type for the markers (`[` and `]`). + * @param {TokenType} stringType + * Type for the identifier (`a`). + * @returns {State} + * Start state. + */ +export function factoryLabel(this: TokenizeContext, effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +import type { TokenizeContext } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-label/index.d.ts.map b/tools/ui/node_modules/micromark-factory-label/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..fe94eeea2d078425e41b8a60785511d169bdae74 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-label/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,6DAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CAkIjB;6BArKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB;qCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-label/index.js b/tools/ui/node_modules/micromark-factory-label/index.js new file mode 100644 index 0000000000000000000000000000000000000000..269340bb85b5ac6297401457b9f6a4a75f13acd1 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-label/index.js @@ -0,0 +1,148 @@ +/** + * @import { + * Effects, + * State, + * TokenizeContext, + * TokenType + * } from 'micromark-util-types' + */ + +import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** + * Parse labels. + * + * > 👉 **Note**: labels in markdown are capped at 999 characters in the string. + * + * ###### Examples + * + * ```markdown + * [a] + * [a + * b] + * [a\]b] + * ``` + * + * @this {TokenizeContext} + * Tokenize context. + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole label (`[a]`). + * @param {TokenType} markerType + * Type for the markers (`[` and `]`). + * @param {TokenType} stringType + * Type for the identifier (`a`). + * @returns {State} + * Start state. + */ +export function factoryLabel(effects, ok, nok, type, markerType, stringType) { + const self = this; + let size = 0; + /** @type {boolean} */ + let seen; + return start; + + /** + * Start of label. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter(type); + effects.enter(markerType); + effects.consume(code); + effects.exit(markerType); + effects.enter(stringType); + return atBreak; + } + + /** + * In label, at something, before something else. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (size > 999 || code === null || code === 91 || code === 93 && !seen || + // To do: remove in the future once we’ve switched from + // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`, + // which doesn’t need this. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + code === 94 && !size && '_hiddenFootnoteSupport' in self.parser.constructs) { + return nok(code); + } + if (code === 93) { + effects.exit(stringType); + effects.enter(markerType); + effects.consume(code); + effects.exit(markerType); + effects.exit(type); + return ok; + } + + // To do: indent? Link chunks and EOLs together? + if (markdownLineEnding(code)) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return atBreak; + } + effects.enter("chunkString", { + contentType: "string" + }); + return labelInside(code); + } + + /** + * In label, in text. + * + * ```markdown + * > | [a] + * ^ + * ``` + * + * @type {State} + */ + function labelInside(code) { + if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) { + effects.exit("chunkString"); + return atBreak(code); + } + effects.consume(code); + if (!seen) seen = !markdownSpace(code); + return code === 92 ? labelEscape : labelInside; + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | [a\*a] + * ^ + * ``` + * + * @type {State} + */ + function labelEscape(code) { + if (code === 91 || code === 92 || code === 93) { + effects.consume(code); + size++; + return labelInside; + } + return labelInside(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-label/license b/tools/ui/node_modules/micromark-factory-label/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-label/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-factory-label/package.json b/tools/ui/node_modules/micromark-factory-label/package.json new file mode 100644 index 0000000000000000000000000000000000000000..db6dca2650e71d2306089ba707433989d1fb33c0 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-label/package.json @@ -0,0 +1,60 @@ +{ + "name": "micromark-factory-label", + "version": "2.0.1", + "description": "micromark factory to parse labels (found in media, definitions)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "label" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-label", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "max-params": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-factory-label/readme.md b/tools/ui/node_modules/micromark-factory-label/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..f4b4eab835f0d664296aaa217b4db65202d78c79 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-label/readme.md @@ -0,0 +1,224 @@ +# micromark-factory-label + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse labels (found in media, definitions). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factoryLabel(…)`](#factorylabel) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse labels. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-label +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factoryLabel} from 'https://esm.sh/micromark-factory-label@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factoryLabel} from 'https://esm.sh/micromark-factory-label@1?bundle' +</script> +``` + +## Use + +```js +import {ok as assert} from 'devlop' +import {factoryLabel} from 'micromark-factory-label' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeDefinition(effects, ok, nok) { + return start + + // … + + /** @type {State} */ + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter(types.definition) + return factoryLabel.call( + self, + effects, + labelAfter, + nok, + types.definitionLabel, + types.definitionLabelMarker, + types.definitionLabelString + )(code) + } + + // … +} +``` + +## API + +This module exports the identifier [`factoryLabel`][api-factory-label]. +There is no default export. + +### `factoryLabel(…)` + +Parse labels. + +> 👉 **Note**: labels in markdown are capped at 999 characters in the string. + +###### Examples + +```markdown +[a] +[a +b] +[a\]b] +``` + +###### Parameters + +* `this` (`TokenizeContext`) + — tokenize context +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful +* `nok` (`State`) + — state switched to when unsuccessful +* `type` (`string`) + — type of the whole label (`[a]`) +* `markerType` (`string`) + — type for the markers (`[` and `]`) +* `stringType` (`string`) + — type for the identifier (`a`) + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-label@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-label.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-label + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-label + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-label + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-label]: #factorylabel diff --git a/tools/ui/node_modules/micromark-factory-space/dev/index.d.ts b/tools/ui/node_modules/micromark-factory-space/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9a30cab17e82ae8c2a761c548161adc2e58d483 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-space/dev/index.d.ts @@ -0,0 +1,37 @@ +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * spaces in markdown are often optional, in which case this factory can be + * used and `ok` will be switched to whether spaces were found or not + * * one line ending or space can be detected with `markdownSpace(code)` right + * before using `factorySpace` + * + * ###### Examples + * + * Where `␉` represents a tab (plus how much it expands) and `␠` represents a + * single space. + * + * ```markdown + * ␉ + * ␠␠␠␠ + * ␉␠ + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {TokenType} type + * Type (`' \t'`). + * @param {number | undefined} [max=Infinity] + * Max (exclusive). + * @returns {State} + * Start state. + */ +export function factorySpace(effects: Effects, ok: State, type: TokenType, max?: number | undefined): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-space/dev/index.d.ts.map b/tools/ui/node_modules/micromark-factory-space/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..42d12792356cdfe4193022ae9e53775884bea5e5 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-space/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;6BAjE2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-space/dev/index.js b/tools/ui/node_modules/micromark-factory-space/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5cead758c12abc6923b79afbe34b68c207fd3b0b --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-space/dev/index.js @@ -0,0 +1,67 @@ +/** + * @import {Effects, State, TokenType} from 'micromark-util-types' + */ + +import {markdownSpace} from 'micromark-util-character' + +// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`. + +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * spaces in markdown are often optional, in which case this factory can be + * used and `ok` will be switched to whether spaces were found or not + * * one line ending or space can be detected with `markdownSpace(code)` right + * before using `factorySpace` + * + * ###### Examples + * + * Where `␉` represents a tab (plus how much it expands) and `␠` represents a + * single space. + * + * ```markdown + * ␉ + * ␠␠␠␠ + * ␉␠ + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {TokenType} type + * Type (`' \t'`). + * @param {number | undefined} [max=Infinity] + * Max (exclusive). + * @returns {State} + * Start state. + */ +export function factorySpace(effects, ok, type, max) { + const limit = max ? max - 1 : Number.POSITIVE_INFINITY + let size = 0 + + return start + + /** @type {State} */ + function start(code) { + if (markdownSpace(code)) { + effects.enter(type) + return prefix(code) + } + + return ok(code) + } + + /** @type {State} */ + function prefix(code) { + if (markdownSpace(code) && size++ < limit) { + effects.consume(code) + return prefix + } + + effects.exit(type) + return ok(code) + } +} diff --git a/tools/ui/node_modules/micromark-factory-space/index.d.ts b/tools/ui/node_modules/micromark-factory-space/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d9a30cab17e82ae8c2a761c548161adc2e58d483 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-space/index.d.ts @@ -0,0 +1,37 @@ +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * spaces in markdown are often optional, in which case this factory can be + * used and `ok` will be switched to whether spaces were found or not + * * one line ending or space can be detected with `markdownSpace(code)` right + * before using `factorySpace` + * + * ###### Examples + * + * Where `␉` represents a tab (plus how much it expands) and `␠` represents a + * single space. + * + * ```markdown + * ␉ + * ␠␠␠␠ + * ␉␠ + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {TokenType} type + * Type (`' \t'`). + * @param {number | undefined} [max=Infinity] + * Max (exclusive). + * @returns {State} + * Start state. + */ +export function factorySpace(effects: Effects, ok: State, type: TokenType, max?: number | undefined): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-space/index.d.ts.map b/tools/ui/node_modules/micromark-factory-space/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..42d12792356cdfe4193022ae9e53775884bea5e5 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-space/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;6BAjE2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-space/index.js b/tools/ui/node_modules/micromark-factory-space/index.js new file mode 100644 index 0000000000000000000000000000000000000000..646117df2d994bec3c11653c84739afb9c760bd7 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-space/index.js @@ -0,0 +1,64 @@ +/** + * @import {Effects, State, TokenType} from 'micromark-util-types' + */ + +import { markdownSpace } from 'micromark-util-character'; + +// To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`. + +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * spaces in markdown are often optional, in which case this factory can be + * used and `ok` will be switched to whether spaces were found or not + * * one line ending or space can be detected with `markdownSpace(code)` right + * before using `factorySpace` + * + * ###### Examples + * + * Where `␉` represents a tab (plus how much it expands) and `␠` represents a + * single space. + * + * ```markdown + * ␉ + * ␠␠␠␠ + * ␉␠ + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {TokenType} type + * Type (`' \t'`). + * @param {number | undefined} [max=Infinity] + * Max (exclusive). + * @returns {State} + * Start state. + */ +export function factorySpace(effects, ok, type, max) { + const limit = max ? max - 1 : Number.POSITIVE_INFINITY; + let size = 0; + return start; + + /** @type {State} */ + function start(code) { + if (markdownSpace(code)) { + effects.enter(type); + return prefix(code); + } + return ok(code); + } + + /** @type {State} */ + function prefix(code) { + if (markdownSpace(code) && size++ < limit) { + effects.consume(code); + return prefix; + } + effects.exit(type); + return ok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-space/license b/tools/ui/node_modules/micromark-factory-space/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-space/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-factory-space/package.json b/tools/ui/node_modules/micromark-factory-space/package.json new file mode 100644 index 0000000000000000000000000000000000000000..45828c493e9a6389ba6eda4d6ea900989afbdfae --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-space/package.json @@ -0,0 +1,55 @@ +{ + "name": "micromark-factory-space", + "version": "2.0.1", + "description": "micromark factory to parse markdown space (found in lots of places)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "space" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-space", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-factory-space/readme.md b/tools/ui/node_modules/micromark-factory-space/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..b9c01776d831d0ccb9249f4d4bf310239ab537e8 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-space/readme.md @@ -0,0 +1,225 @@ +# micromark-factory-space + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse [markdown space][markdown-space] (found in lots +of places). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factorySpace(…)`](#factoryspace) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse spaces and/or tabs. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-space +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factorySpace} from 'https://esm.sh/micromark-factory-space@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factorySpace} from 'https://esm.sh/micromark-factory-space@1?bundle' +</script> +``` + +## Use + +```js +import {factorySpace} from 'micromark-factory-space' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCodeFenced(effects, ok, nok) { + return start + + // … + + /** @type {State} */ + function info(code) { + if (code === codes.eof || markdownLineEndingOrSpace(code)) { + effects.exit(types.chunkString) + effects.exit(types.codeFencedFenceInfo) + return factorySpace(effects, infoAfter, types.whitespace)(code) + } + + if (code === codes.graveAccent && code === marker) return nok(code) + effects.consume(code) + return info + } + + // … +} +``` + +## API + +This module exports the identifier [`factorySpace`][api-factory-space]. +There is no default export. + +### `factorySpace(…)` + +Parse spaces and tabs. + +There is no `nok` parameter: + +* spaces in markdown are often optional, in which case this factory can be + used and `ok` will be switched to whether spaces were found or not +* one line ending or space can be detected with `markdownSpace(code)` right + before using `factorySpace` + +###### Examples + +Where `␉` represents a tab (plus how much it expands) and `␠` represents a +single space. + +```markdown +␉ +␠␠␠␠ +␉␠ +``` + +###### Parameters + +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful +* `type` (`string`) + — type (`' \t'`) +* `max` (`number`, default: `Infinity`) + — max (exclusive) + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-space@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-space.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-space + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-space + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-space + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[markdown-space]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownspacecode + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-space]: #factoryspace diff --git a/tools/ui/node_modules/micromark-factory-title/dev/index.d.ts b/tools/ui/node_modules/micromark-factory-title/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d4b4be20368f32a092c8dd9d42279610c646119 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-title/dev/index.d.ts @@ -0,0 +1,36 @@ +/** + * Parse titles. + * + * ###### Examples + * + * ```markdown + * "a" + * 'b' + * (c) + * "a + * b" + * 'a + * b' + * (a\)b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole title (`"a"`, `'b'`, `(c)`). + * @param {TokenType} markerType + * Type for the markers (`"`, `'`, `(`, and `)`). + * @param {TokenType} stringType + * Type for the value (`a`). + * @returns {State} + * Start state. + */ +export function factoryTitle(effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-title/dev/index.d.ts.map b/tools/ui/node_modules/micromark-factory-title/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0108e7c976ae6c5f989ac1d955b39f5d0985aec7 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-title/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,sCAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CA+HjB;6BAlKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-title/dev/index.js b/tools/ui/node_modules/micromark-factory-title/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4774214cbb38cfed07e30b5d93ea05a6938ad24d --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-title/dev/index.js @@ -0,0 +1,169 @@ +/** + * @import { + * Code, + * Effects, + * State, + * TokenType + * } from 'micromark-util-types' + */ + +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** + * Parse titles. + * + * ###### Examples + * + * ```markdown + * "a" + * 'b' + * (c) + * "a + * b" + * 'a + * b' + * (a\)b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole title (`"a"`, `'b'`, `(c)`). + * @param {TokenType} markerType + * Type for the markers (`"`, `'`, `(`, and `)`). + * @param {TokenType} stringType + * Type for the value (`a`). + * @returns {State} + * Start state. + */ +export function factoryTitle(effects, ok, nok, type, markerType, stringType) { + /** @type {NonNullable<Code>} */ + let marker + + return start + + /** + * Start of title. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if ( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis + ) { + effects.enter(type) + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + marker = code === codes.leftParenthesis ? codes.rightParenthesis : code + return begin + } + + return nok(code) + } + + /** + * After opening marker. + * + * This is also used at the closing marker. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function begin(code) { + if (code === marker) { + effects.enter(markerType) + effects.consume(code) + effects.exit(markerType) + effects.exit(type) + return ok + } + + effects.enter(stringType) + return atBreak(code) + } + + /** + * At something, before something else. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === marker) { + effects.exit(stringType) + return begin(marker) + } + + if (code === codes.eof) { + return nok(code) + } + + // Note: blank lines can’t exist in content. + if (markdownLineEnding(code)) { + // To do: use `space_or_tab_eol_with_options`, connect. + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace(effects, atBreak, types.linePrefix) + } + + effects.enter(types.chunkString, {contentType: constants.contentTypeString}) + return inside(code) + } + + /** + * + * + * @type {State} + */ + function inside(code) { + if (code === marker || code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.chunkString) + return atBreak(code) + } + + effects.consume(code) + return code === codes.backslash ? escape : inside + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | "a\*b" + * ^ + * ``` + * + * @type {State} + */ + function escape(code) { + if (code === marker || code === codes.backslash) { + effects.consume(code) + return inside + } + + return inside(code) + } +} diff --git a/tools/ui/node_modules/micromark-factory-title/index.d.ts b/tools/ui/node_modules/micromark-factory-title/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d4b4be20368f32a092c8dd9d42279610c646119 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-title/index.d.ts @@ -0,0 +1,36 @@ +/** + * Parse titles. + * + * ###### Examples + * + * ```markdown + * "a" + * 'b' + * (c) + * "a + * b" + * 'a + * b' + * (a\)b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole title (`"a"`, `'b'`, `(c)`). + * @param {TokenType} markerType + * Type for the markers (`"`, `'`, `(`, and `)`). + * @param {TokenType} stringType + * Type for the value (`a`). + * @returns {State} + * Start state. + */ +export function factoryTitle(effects: Effects, ok: State, nok: State, type: TokenType, markerType: TokenType, stringType: TokenType): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +import type { TokenType } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-title/index.d.ts.map b/tools/ui/node_modules/micromark-factory-title/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0108e7c976ae6c5f989ac1d955b39f5d0985aec7 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-title/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,sCAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,cAET,SAAS,cAET,SAAS,GAEP,KAAK,CA+HjB;6BAlKS,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-title/index.js b/tools/ui/node_modules/micromark-factory-title/index.js new file mode 100644 index 0000000000000000000000000000000000000000..02c8026c1e7b4a61d6b3a2aa257d8c3ad17a0232 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-title/index.js @@ -0,0 +1,158 @@ +/** + * @import { + * Code, + * Effects, + * State, + * TokenType + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding } from 'micromark-util-character'; +/** + * Parse titles. + * + * ###### Examples + * + * ```markdown + * "a" + * 'b' + * (c) + * "a + * b" + * 'a + * b' + * (a\)b) + * ``` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @param {State} nok + * State switched to when unsuccessful. + * @param {TokenType} type + * Type of the whole title (`"a"`, `'b'`, `(c)`). + * @param {TokenType} markerType + * Type for the markers (`"`, `'`, `(`, and `)`). + * @param {TokenType} stringType + * Type for the value (`a`). + * @returns {State} + * Start state. + */ +export function factoryTitle(effects, ok, nok, type, markerType, stringType) { + /** @type {NonNullable<Code>} */ + let marker; + return start; + + /** + * Start of title. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if (code === 34 || code === 39 || code === 40) { + effects.enter(type); + effects.enter(markerType); + effects.consume(code); + effects.exit(markerType); + marker = code === 40 ? 41 : code; + return begin; + } + return nok(code); + } + + /** + * After opening marker. + * + * This is also used at the closing marker. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function begin(code) { + if (code === marker) { + effects.enter(markerType); + effects.consume(code); + effects.exit(markerType); + effects.exit(type); + return ok; + } + effects.enter(stringType); + return atBreak(code); + } + + /** + * At something, before something else. + * + * ```markdown + * > | "a" + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === marker) { + effects.exit(stringType); + return begin(marker); + } + if (code === null) { + return nok(code); + } + + // Note: blank lines can’t exist in content. + if (markdownLineEnding(code)) { + // To do: use `space_or_tab_eol_with_options`, connect. + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return factorySpace(effects, atBreak, "linePrefix"); + } + effects.enter("chunkString", { + contentType: "string" + }); + return inside(code); + } + + /** + * + * + * @type {State} + */ + function inside(code) { + if (code === marker || code === null || markdownLineEnding(code)) { + effects.exit("chunkString"); + return atBreak(code); + } + effects.consume(code); + return code === 92 ? escape : inside; + } + + /** + * After `\`, at a special character. + * + * ```markdown + * > | "a\*b" + * ^ + * ``` + * + * @type {State} + */ + function escape(code) { + if (code === marker || code === 92) { + effects.consume(code); + return inside; + } + return inside(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-title/license b/tools/ui/node_modules/micromark-factory-title/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-title/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-factory-title/package.json b/tools/ui/node_modules/micromark-factory-title/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f643a5dea3fc8a4b213523ec75ece0a261f683f3 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-title/package.json @@ -0,0 +1,58 @@ +{ + "name": "micromark-factory-title", + "version": "2.0.1", + "description": "micromark factory to parse markdown titles (found in resources, definitions)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "title" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-title", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "max-params": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-factory-title/readme.md b/tools/ui/node_modules/micromark-factory-title/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..ff51cbdebe57cdfc0e1343e12f7402515404e545 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-title/readme.md @@ -0,0 +1,229 @@ +# micromark-factory-title + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse markdown titles (found in resources, +definitions). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factoryTitle(…)`](#factorytitle) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse titles. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-title +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factorySpace} from 'https://esm.sh/micromark-factory-title@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factorySpace} from 'https://esm.sh/micromark-factory-title@1?bundle' +</script> +``` + +## Use + +```js +import {factoryTitle} from 'micromark-factory-title' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeDefinition(effects, ok, nok) { + return start + + // … + + /** @type {State} */ + function before(code) { + if ( + code === codes.quotationMark || + code === codes.apostrophe || + code === codes.leftParenthesis + ) { + return factoryTitle( + effects, + factorySpace(effects, after, types.whitespace), + nok, + types.definitionTitle, + types.definitionTitleMarker, + types.definitionTitleString + )(code) + } + + return nok(code) + } + + // … +} +``` + +## API + +This module exports the identifier [`factoryTitle`][api-factory-title]. +There is no default export. + +### `factoryTitle(…)` + +Parse titles. + +###### Examples + +```markdown +"a" +'b' +(c) +"a +b" +'a + b' +(a\)b) +``` + +###### Parameters + +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful +* `nok` (`State`) + — state switched to when unsuccessful +* `type` (`string`) + — type of the whole title (`"a"`, `'b'`, `(c)`) +* `markerType` (`string`) + — type for the markers (`"`, `'`, `(`, and `)`) +* `stringType` (`string`) + — type for the value (`a`) + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-title@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-title.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-title + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-title + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-title + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-title]: #factorytitle diff --git a/tools/ui/node_modules/micromark-factory-whitespace/dev/index.d.ts b/tools/ui/node_modules/micromark-factory-whitespace/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..52ca4b85bc46db9d049d0ab7ba9438716952442f --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-whitespace/dev/index.d.ts @@ -0,0 +1,22 @@ +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * line endings or spaces in markdown are often optional, in which case this + * factory can be used and `ok` will be switched to whether spaces were found + * or not + * * one line ending or space can be detected with + * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @returns {State} + * Start state. + */ +export function factoryWhitespace(effects: Effects, ok: State): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-whitespace/dev/index.d.ts.map b/tools/ui/node_modules/micromark-factory-whitespace/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5169dc46ad46ea695c469d4dfc7bd808859ed04c --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-whitespace/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;GAiBG;AACH,2CAPW,OAAO,MAEP,KAAK,GAEH,KAAK,CA6BjB;6BAnDgC,sBAAsB;2BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-whitespace/dev/index.js b/tools/ui/node_modules/micromark-factory-whitespace/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3aa9e37b2dd1b3292df40a63e68c62adb38ff6ea --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-whitespace/dev/index.js @@ -0,0 +1,53 @@ +/** + * @import {Effects, State} from 'micromark-util-types' + */ + +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding, markdownSpace} from 'micromark-util-character' +import {types} from 'micromark-util-symbol' + +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * line endings or spaces in markdown are often optional, in which case this + * factory can be used and `ok` will be switched to whether spaces were found + * or not + * * one line ending or space can be detected with + * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @returns {State} + * Start state. + */ +export function factoryWhitespace(effects, ok) { + /** @type {boolean} */ + let seen + + return start + + /** @type {State} */ + function start(code) { + if (markdownLineEnding(code)) { + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + seen = true + return start + } + + if (markdownSpace(code)) { + return factorySpace( + effects, + start, + seen ? types.linePrefix : types.lineSuffix + )(code) + } + + return ok(code) + } +} diff --git a/tools/ui/node_modules/micromark-factory-whitespace/index.d.ts b/tools/ui/node_modules/micromark-factory-whitespace/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..52ca4b85bc46db9d049d0ab7ba9438716952442f --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-whitespace/index.d.ts @@ -0,0 +1,22 @@ +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * line endings or spaces in markdown are often optional, in which case this + * factory can be used and `ok` will be switched to whether spaces were found + * or not + * * one line ending or space can be detected with + * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @returns {State} + * Start state. + */ +export function factoryWhitespace(effects: Effects, ok: State): State; +import type { Effects } from 'micromark-util-types'; +import type { State } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-whitespace/index.d.ts.map b/tools/ui/node_modules/micromark-factory-whitespace/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5169dc46ad46ea695c469d4dfc7bd808859ed04c --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-whitespace/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;GAiBG;AACH,2CAPW,OAAO,MAEP,KAAK,GAEH,KAAK,CA6BjB;6BAnDgC,sBAAsB;2BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-whitespace/index.js b/tools/ui/node_modules/micromark-factory-whitespace/index.js new file mode 100644 index 0000000000000000000000000000000000000000..02243add41e685792bf69165b3c776073049f06b --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-whitespace/index.js @@ -0,0 +1,44 @@ +/** + * @import {Effects, State} from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** + * Parse spaces and tabs. + * + * There is no `nok` parameter: + * + * * line endings or spaces in markdown are often optional, in which case this + * factory can be used and `ok` will be switched to whether spaces were found + * or not + * * one line ending or space can be detected with + * `markdownLineEndingOrSpace(code)` right before using `factoryWhitespace` + * + * @param {Effects} effects + * Context. + * @param {State} ok + * State switched to when successful. + * @returns {State} + * Start state. + */ +export function factoryWhitespace(effects, ok) { + /** @type {boolean} */ + let seen; + return start; + + /** @type {State} */ + function start(code) { + if (markdownLineEnding(code)) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + seen = true; + return start; + } + if (markdownSpace(code)) { + return factorySpace(effects, start, seen ? "linePrefix" : "lineSuffix")(code); + } + return ok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-factory-whitespace/license b/tools/ui/node_modules/micromark-factory-whitespace/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-whitespace/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-factory-whitespace/package.json b/tools/ui/node_modules/micromark-factory-whitespace/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ce733bd06e323c0e3e9b726540b8fc8e7f803c4b --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-whitespace/package.json @@ -0,0 +1,57 @@ +{ + "name": "micromark-factory-whitespace", + "version": "2.0.1", + "description": "micromark factory to parse markdown whitespace (found in lots of places)", + "license": "MIT", + "keywords": [ + "micromark", + "factory", + "whitespace" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-factory-whitespace", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-factory-whitespace/readme.md b/tools/ui/node_modules/micromark-factory-whitespace/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..a846406a5299badbd3aa92b283a28e9488e49862 --- /dev/null +++ b/tools/ui/node_modules/micromark-factory-whitespace/readme.md @@ -0,0 +1,205 @@ +# micromark-factory-whitespace + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] factory to parse [markdown line endings or spaces][ws] (found in +lots of places). + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`factoryWhitespace(…)`](#factorywhitespace) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes states to parse whitespace. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-factory-whitespace +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {factoryWhitespace} from 'https://esm.sh/micromark-factory-whitespace@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {factoryWhitespace} from 'https://esm.sh/micromark-factory-whitespace@1?bundle' +</script> +``` + +## Use + +```js +import {factoryWhitespace} from 'micromark-factory-whitespace' +import {codes, types} from 'micromark-util-symbol' + +// A micromark tokenizer that uses the factory: +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeTitle(effects, ok, nok) { + return start + + /** @type {State} */ + function start(code) { + return markdownLineEndingOrSpace(code) + ? factoryWhitespace(effects, before)(code) + : nok(code) + } + + // … +} +``` + +## API + +This module exports the identifier +[`factoryWhitespace`][api-factory-whitespace]. +There is no default export. + +### `factoryWhitespace(…)` + +Parse spaces and tabs. + +There is no `nok` parameter: + +* line endings or spaces in markdown are often optional, in which case this + factory can be used and `ok` will be switched to whether spaces were found + or not +* one line ending or space can be detected with + [`markdownLineEndingOrSpace(code)`][ws] right before using + `factoryWhitespace` + +###### Parameters + +* `effects` (`Effects`) + — context +* `ok` (`State`) + — state switched to when successful + +###### Returns + +Start state (`State`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-factory-whitespace@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-whitespace.svg + +[downloads]: https://www.npmjs.com/package/micromark-factory-whitespace + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-whitespace + +[bundle-size]: https://bundlejs.com/?q=micromark-factory-whitespace + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[ws]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownlineendingorspacecode + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-factory-whitespace]: #factorywhitespace diff --git a/tools/ui/node_modules/micromark-util-character/dev/index.d.ts b/tools/ui/node_modules/micromark-util-character/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe5289573d03c84b318810d89f5dfbd49702d853 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-character/dev/index.d.ts @@ -0,0 +1,195 @@ +/** + * Check whether a character code is an ASCII control character. + * + * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) + * to U+001F (US), or U+007F (DEL). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function asciiControl(code: Code): boolean; +/** + * Check whether a character code is a markdown line ending. + * + * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN + * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + * + * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE + * RETURN (CR) are replaced by these virtual characters depending on whether + * they occurred together. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEnding(code: Code): boolean; +/** + * Check whether a character code is a markdown line ending (see + * `markdownLineEnding`) or markdown space (see `markdownSpace`). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEndingOrSpace(code: Code): boolean; +/** + * Check whether a character code is a markdown space. + * + * A **markdown space** is the concrete character U+0020 SPACE (SP) and the + * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + * + * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is + * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL + * SPACE (VS) characters, depending on the column at which the tab occurred. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownSpace(code: Code): boolean; +/** + * Check whether the character code represents an ASCII alpha (`a` through `z`, + * case insensitive). + * + * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + * + * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) + * to U+005A (`Z`). + * + * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) + * to U+007A (`z`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlpha: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII alphanumeric (`a` + * through `z`, case insensitive, or `0` through `9`). + * + * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha + * (see `asciiAlpha`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlphanumeric: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII atext. + * + * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in + * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), + * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F + * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E + * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE + * (`{`) to U+007E TILDE (`~`). + * + * See: + * **\[RFC5322]**: + * [Internet Message Format](https://tools.ietf.org/html/rfc5322). + * P. Resnick. + * IETF. + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAtext: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII digit (`0` through `9`). + * + * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to + * U+0039 (`9`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiDigit: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII hex digit (`a` through + * `f`, case insensitive, or `0` through `9`). + * + * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex + * digit, or an ASCII lower hex digit. + * + * An **ASCII upper hex digit** is a character in the inclusive range U+0041 + * (`A`) to U+0046 (`F`). + * + * An **ASCII lower hex digit** is a character in the inclusive range U+0061 + * (`a`) to U+0066 (`f`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiHexDigit: (code: Code) => boolean; +/** + * Check whether the character code represents ASCII punctuation. + * + * An **ASCII punctuation** is a character in the inclusive ranges U+0021 + * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT + * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT + * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiPunctuation: (code: Code) => boolean; +/** + * Check whether the character code represents Unicode punctuation. + * + * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, + * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` + * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` + * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII + * punctuation (see `asciiPunctuation`). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodePunctuation: (code: Code) => boolean; +/** + * Check whether the character code represents Unicode whitespace. + * + * Note that this does handle micromark specific markdown whitespace characters. + * See `markdownLineEndingOrSpace` to check that. + * + * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, + * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), + * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodeWhitespace: (code: Code) => boolean; +import type { Code } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-character/dev/index.d.ts.map b/tools/ui/node_modules/micromark-util-character/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8ded3c1570e11682a465c097443a291216ea9b1a --- /dev/null +++ b/tools/ui/node_modules/micromark-util-character/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;GAUG;AACH,mCALW,IAAI,GAEF,OAAO,CASnB;AAkDD;;;;;;;;;;;;;;GAcG;AACH,yCALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;GAQG;AACH,gDALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;;;;;;;GAcG;AACH,oCALW,IAAI,GAEF,OAAO,CASnB;AAhLD;;;;;;;;;;;;;;;;GAgBG;AACH,gCAmNoB,IAAI,KAAK,OAAO,CAnNY;AAEhD;;;;;;;;;;;GAWG;AACH,uCAqMoB,IAAI,KAAK,OAAO,CArMqB;AAEzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,gCA8KoB,IAAI,KAAK,OAAO,CA9KuB;AAqB3D;;;;;;;;;;GAUG;AACH,gCA8IoB,IAAI,KAAK,OAAO,CA9IM;AAE1C;;;;;;;;;;;;;;;;;GAiBG;AACH,mCA0HoB,IAAI,KAAK,OAAO,CA1HiB;AAErD;;;;;;;;;;;;GAYG;AACH,sCA2GoB,IAAI,KAAK,OAAO,CA3GwB;AA2D5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wCA6BoB,IAAI,KAAK,OAAO,CA7BwB;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uCAOoB,IAAI,KAAK,OAAO,CAPa;0BAlO1B,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-character/dev/index.js b/tools/ui/node_modules/micromark-util-character/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..123745e860dd26c0f12b45f79a0a1fb69b45d6f0 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-character/dev/index.js @@ -0,0 +1,252 @@ +/** + * @import {Code} from 'micromark-util-types' + */ + +import {codes} from 'micromark-util-symbol' + +/** + * Check whether the character code represents an ASCII alpha (`a` through `z`, + * case insensitive). + * + * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + * + * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) + * to U+005A (`Z`). + * + * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) + * to U+007A (`z`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlpha = regexCheck(/[A-Za-z]/) + +/** + * Check whether the character code represents an ASCII alphanumeric (`a` + * through `z`, case insensitive, or `0` through `9`). + * + * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha + * (see `asciiAlpha`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/) + +/** + * Check whether the character code represents an ASCII atext. + * + * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in + * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), + * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F + * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E + * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE + * (`{`) to U+007E TILDE (`~`). + * + * See: + * **\[RFC5322]**: + * [Internet Message Format](https://tools.ietf.org/html/rfc5322). + * P. Resnick. + * IETF. + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/) + +/** + * Check whether a character code is an ASCII control character. + * + * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) + * to U+001F (US), or U+007F (DEL). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code !== null && (code < codes.space || code === codes.del) + ) +} + +/** + * Check whether the character code represents an ASCII digit (`0` through `9`). + * + * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to + * U+0039 (`9`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiDigit = regexCheck(/\d/) + +/** + * Check whether the character code represents an ASCII hex digit (`a` through + * `f`, case insensitive, or `0` through `9`). + * + * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex + * digit, or an ASCII lower hex digit. + * + * An **ASCII upper hex digit** is a character in the inclusive range U+0041 + * (`A`) to U+0046 (`F`). + * + * An **ASCII lower hex digit** is a character in the inclusive range U+0061 + * (`a`) to U+0066 (`f`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiHexDigit = regexCheck(/[\dA-Fa-f]/) + +/** + * Check whether the character code represents ASCII punctuation. + * + * An **ASCII punctuation** is a character in the inclusive ranges U+0021 + * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT + * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT + * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/) + +/** + * Check whether a character code is a markdown line ending. + * + * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN + * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + * + * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE + * RETURN (CR) are replaced by these virtual characters depending on whether + * they occurred together. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEnding(code) { + return code !== null && code < codes.horizontalTab +} + +/** + * Check whether a character code is a markdown line ending (see + * `markdownLineEnding`) or markdown space (see `markdownSpace`). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEndingOrSpace(code) { + return code !== null && (code < codes.nul || code === codes.space) +} + +/** + * Check whether a character code is a markdown space. + * + * A **markdown space** is the concrete character U+0020 SPACE (SP) and the + * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + * + * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is + * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL + * SPACE (VS) characters, depending on the column at which the tab occurred. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownSpace(code) { + return ( + code === codes.horizontalTab || + code === codes.virtualSpace || + code === codes.space + ) +} + +// Size note: removing ASCII from the regex and using `asciiPunctuation` here +// In fact adds to the bundle size. +/** + * Check whether the character code represents Unicode punctuation. + * + * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, + * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` + * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` + * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII + * punctuation (see `asciiPunctuation`). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u) + +/** + * Check whether the character code represents Unicode whitespace. + * + * Note that this does handle micromark specific markdown whitespace characters. + * See `markdownLineEndingOrSpace` to check that. + * + * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, + * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), + * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodeWhitespace = regexCheck(/\s/) + +/** + * Create a code check from a regex. + * + * @param {RegExp} regex + * Expression. + * @returns {(code: Code) => boolean} + * Check. + */ +function regexCheck(regex) { + return check + + /** + * Check whether a code matches the bound regex. + * + * @param {Code} code + * Character code. + * @returns {boolean} + * Whether the character code matches the bound regex. + */ + function check(code) { + return code !== null && code > -1 && regex.test(String.fromCharCode(code)) + } +} diff --git a/tools/ui/node_modules/micromark-util-character/index.d.ts b/tools/ui/node_modules/micromark-util-character/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fe5289573d03c84b318810d89f5dfbd49702d853 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-character/index.d.ts @@ -0,0 +1,195 @@ +/** + * Check whether a character code is an ASCII control character. + * + * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) + * to U+001F (US), or U+007F (DEL). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function asciiControl(code: Code): boolean; +/** + * Check whether a character code is a markdown line ending. + * + * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN + * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + * + * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE + * RETURN (CR) are replaced by these virtual characters depending on whether + * they occurred together. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEnding(code: Code): boolean; +/** + * Check whether a character code is a markdown line ending (see + * `markdownLineEnding`) or markdown space (see `markdownSpace`). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEndingOrSpace(code: Code): boolean; +/** + * Check whether a character code is a markdown space. + * + * A **markdown space** is the concrete character U+0020 SPACE (SP) and the + * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + * + * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is + * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL + * SPACE (VS) characters, depending on the column at which the tab occurred. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownSpace(code: Code): boolean; +/** + * Check whether the character code represents an ASCII alpha (`a` through `z`, + * case insensitive). + * + * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + * + * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) + * to U+005A (`Z`). + * + * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) + * to U+007A (`z`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlpha: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII alphanumeric (`a` + * through `z`, case insensitive, or `0` through `9`). + * + * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha + * (see `asciiAlpha`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlphanumeric: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII atext. + * + * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in + * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), + * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F + * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E + * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE + * (`{`) to U+007E TILDE (`~`). + * + * See: + * **\[RFC5322]**: + * [Internet Message Format](https://tools.ietf.org/html/rfc5322). + * P. Resnick. + * IETF. + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAtext: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII digit (`0` through `9`). + * + * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to + * U+0039 (`9`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiDigit: (code: Code) => boolean; +/** + * Check whether the character code represents an ASCII hex digit (`a` through + * `f`, case insensitive, or `0` through `9`). + * + * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex + * digit, or an ASCII lower hex digit. + * + * An **ASCII upper hex digit** is a character in the inclusive range U+0041 + * (`A`) to U+0046 (`F`). + * + * An **ASCII lower hex digit** is a character in the inclusive range U+0061 + * (`a`) to U+0066 (`f`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiHexDigit: (code: Code) => boolean; +/** + * Check whether the character code represents ASCII punctuation. + * + * An **ASCII punctuation** is a character in the inclusive ranges U+0021 + * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT + * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT + * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiPunctuation: (code: Code) => boolean; +/** + * Check whether the character code represents Unicode punctuation. + * + * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, + * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` + * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` + * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII + * punctuation (see `asciiPunctuation`). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodePunctuation: (code: Code) => boolean; +/** + * Check whether the character code represents Unicode whitespace. + * + * Note that this does handle micromark specific markdown whitespace characters. + * See `markdownLineEndingOrSpace` to check that. + * + * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, + * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), + * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodeWhitespace: (code: Code) => boolean; +import type { Code } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-character/index.d.ts.map b/tools/ui/node_modules/micromark-util-character/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8ded3c1570e11682a465c097443a291216ea9b1a --- /dev/null +++ b/tools/ui/node_modules/micromark-util-character/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;GAUG;AACH,mCALW,IAAI,GAEF,OAAO,CASnB;AAkDD;;;;;;;;;;;;;;GAcG;AACH,yCALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;GAQG;AACH,gDALW,IAAI,GAEF,OAAO,CAKnB;AAED;;;;;;;;;;;;;;GAcG;AACH,oCALW,IAAI,GAEF,OAAO,CASnB;AAhLD;;;;;;;;;;;;;;;;GAgBG;AACH,gCAmNoB,IAAI,KAAK,OAAO,CAnNY;AAEhD;;;;;;;;;;;GAWG;AACH,uCAqMoB,IAAI,KAAK,OAAO,CArMqB;AAEzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,gCA8KoB,IAAI,KAAK,OAAO,CA9KuB;AAqB3D;;;;;;;;;;GAUG;AACH,gCA8IoB,IAAI,KAAK,OAAO,CA9IM;AAE1C;;;;;;;;;;;;;;;;;GAiBG;AACH,mCA0HoB,IAAI,KAAK,OAAO,CA1HiB;AAErD;;;;;;;;;;;;GAYG;AACH,sCA2GoB,IAAI,KAAK,OAAO,CA3GwB;AA2D5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wCA6BoB,IAAI,KAAK,OAAO,CA7BwB;AAE5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uCAOoB,IAAI,KAAK,OAAO,CAPa;0BAlO1B,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-character/index.js b/tools/ui/node_modules/micromark-util-character/index.js new file mode 100644 index 0000000000000000000000000000000000000000..13698f04f2ea3591b7ca012b4270e027fb73e9bf --- /dev/null +++ b/tools/ui/node_modules/micromark-util-character/index.js @@ -0,0 +1,246 @@ +/** + * @import {Code} from 'micromark-util-types' + */ + +/** + * Check whether the character code represents an ASCII alpha (`a` through `z`, + * case insensitive). + * + * An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + * + * An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) + * to U+005A (`Z`). + * + * An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) + * to U+007A (`z`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlpha = regexCheck(/[A-Za-z]/); + +/** + * Check whether the character code represents an ASCII alphanumeric (`a` + * through `z`, case insensitive, or `0` through `9`). + * + * An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha + * (see `asciiAlpha`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); + +/** + * Check whether the character code represents an ASCII atext. + * + * atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in + * the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), + * U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F + * SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E + * CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE + * (`{`) to U+007E TILDE (`~`). + * + * See: + * **\[RFC5322]**: + * [Internet Message Format](https://tools.ietf.org/html/rfc5322). + * P. Resnick. + * IETF. + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); + +/** + * Check whether a character code is an ASCII control character. + * + * An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) + * to U+001F (US), or U+007F (DEL). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function asciiControl(code) { + return ( + // Special whitespace codes (which have negative values), C0 and Control + // character DEL + code !== null && (code < 32 || code === 127) + ); +} + +/** + * Check whether the character code represents an ASCII digit (`0` through `9`). + * + * An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to + * U+0039 (`9`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiDigit = regexCheck(/\d/); + +/** + * Check whether the character code represents an ASCII hex digit (`a` through + * `f`, case insensitive, or `0` through `9`). + * + * An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex + * digit, or an ASCII lower hex digit. + * + * An **ASCII upper hex digit** is a character in the inclusive range U+0041 + * (`A`) to U+0046 (`F`). + * + * An **ASCII lower hex digit** is a character in the inclusive range U+0061 + * (`a`) to U+0066 (`f`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiHexDigit = regexCheck(/[\dA-Fa-f]/); + +/** + * Check whether the character code represents ASCII punctuation. + * + * An **ASCII punctuation** is a character in the inclusive ranges U+0021 + * EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT + * SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT + * (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + * + * @param code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); + +/** + * Check whether a character code is a markdown line ending. + * + * A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN + * LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + * + * In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE + * RETURN (CR) are replaced by these virtual characters depending on whether + * they occurred together. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEnding(code) { + return code !== null && code < -2; +} + +/** + * Check whether a character code is a markdown line ending (see + * `markdownLineEnding`) or markdown space (see `markdownSpace`). + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownLineEndingOrSpace(code) { + return code !== null && (code < 0 || code === 32); +} + +/** + * Check whether a character code is a markdown space. + * + * A **markdown space** is the concrete character U+0020 SPACE (SP) and the + * virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + * + * In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is + * replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL + * SPACE (VS) characters, depending on the column at which the tab occurred. + * + * @param {Code} code + * Code. + * @returns {boolean} + * Whether it matches. + */ +export function markdownSpace(code) { + return code === -2 || code === -1 || code === 32; +} + +// Size note: removing ASCII from the regex and using `asciiPunctuation` here +// In fact adds to the bundle size. +/** + * Check whether the character code represents Unicode punctuation. + * + * A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, + * Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` + * (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` + * (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII + * punctuation (see `asciiPunctuation`). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u); + +/** + * Check whether the character code represents Unicode whitespace. + * + * Note that this does handle micromark specific markdown whitespace characters. + * See `markdownLineEndingOrSpace` to check that. + * + * A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, + * Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), + * U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + * + * See: + * **\[UNICODE]**: + * [The Unicode Standard](https://www.unicode.org/versions/). + * Unicode Consortium. + * + * @param code + * Code. + * @returns + * Whether it matches. + */ +export const unicodeWhitespace = regexCheck(/\s/); + +/** + * Create a code check from a regex. + * + * @param {RegExp} regex + * Expression. + * @returns {(code: Code) => boolean} + * Check. + */ +function regexCheck(regex) { + return check; + + /** + * Check whether a code matches the bound regex. + * + * @param {Code} code + * Character code. + * @returns {boolean} + * Whether the character code matches the bound regex. + */ + function check(code) { + return code !== null && code > -1 && regex.test(String.fromCharCode(code)); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-character/license b/tools/ui/node_modules/micromark-util-character/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-character/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-character/package.json b/tools/ui/node_modules/micromark-util-character/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8af57e3999850b9889844fae78f54beff70f6d19 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-character/package.json @@ -0,0 +1,57 @@ +{ + "name": "micromark-util-character", + "version": "2.1.1", + "description": "micromark utility to handle character codes", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "character" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-character", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-character/readme.md b/tools/ui/node_modules/micromark-util-character/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..2356e4720f39bdb46d111732b65f30aa212d7098 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-character/readme.md @@ -0,0 +1,446 @@ +# micromark-util-character + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to handle [character codes][code]. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`asciiAlpha(code)`](#asciialphacode) + * [`asciiAlphanumeric(code)`](#asciialphanumericcode) + * [`asciiAtext(code)`](#asciiatextcode) + * [`asciiControl(code)`](#asciicontrolcode) + * [`asciiDigit(code)`](#asciidigitcode) + * [`asciiHexDigit(code)`](#asciihexdigitcode) + * [`asciiPunctuation(code)`](#asciipunctuationcode) + * [`markdownLineEnding(code)`](#markdownlineendingcode) + * [`markdownLineEndingOrSpace(code)`](#markdownlineendingorspacecode) + * [`markdownSpace(code)`](#markdownspacecode) + * [`unicodePunctuation(code)`](#unicodepunctuationcode) + * [`unicodeWhitespace(code)`](#unicodewhitespacecode) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes algorithms to check whether characters match groups. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-character +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import * as character from 'https://esm.sh/micromark-util-character@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import * as character from 'https://esm.sh/micromark-util-character@1?bundle' +</script> +``` + +## Use + +```js +import {asciiAlpha} from 'micromark-util-character' + +console.log(asciiAlpha(64)) // false +console.log(asciiAlpha(65)) // true +``` + +## API + +This module exports the identifiers +[`asciiAlpha`][api-ascii-alpha], +[`asciiAlphanumeric`][api-ascii-alphanumeric], +[`asciiAtext`][api-ascii-atext], +[`asciiControl`][api-ascii-control], +[`asciiDigit`][api-ascii-digit], +[`asciiHexDigit`][api-ascii-hex-digit], +[`asciiPunctuation`][api-ascii-punctuation], +[`markdownLineEnding`][api-markdown-line-ending], +[`markdownLineEndingOrSpace`][api-markdown-line-ending-or-space], +[`markdownSpace`][api-markdown-space], +[`unicodePunctuation`][api-unicode-punctuation], +[`unicodeWhitespace`][api-unicode-whitespace]. +There is no default export. + +### `asciiAlpha(code)` + +Check whether the [character code][code] represents an ASCII alpha (`a` through +`z`, case insensitive). + +An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha. + +An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`) +to U+005A (`Z`). + +An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`) +to U+007A (`z`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiAlphanumeric(code)` + +Check whether the [character code][code] represents an ASCII alphanumeric (`a` +through `z`, case insensitive, or `0` through `9`). + +An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha +(see `asciiAlpha`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiAtext(code)` + +Check whether the [character code][code] represents an ASCII atext. + +atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in +the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`), +U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F +SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E +CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE +(`{`) to U+007E TILDE (`~`) (**\[RFC5322]**). + +See **\[RFC5322]**:\ +[Internet Message Format](https://tools.ietf.org/html/rfc5322).\ +P. Resnick.\ +IETF. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiControl(code)` + +Check whether a [character code][code] is an ASCII control character. + +An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL) +to U+001F (US), or U+007F (DEL). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiDigit(code)` + +Check whether the [character code][code] represents an ASCII digit (`0` through +`9`). + +An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to +U+0039 (`9`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiHexDigit(code)` + +Check whether the [character code][code] represents an ASCII hex digit (`a` +through `f`, case insensitive, or `0` through `9`). + +An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex +digit, or an ASCII lower hex digit. + +An **ASCII upper hex digit** is a character in the inclusive range U+0041 +(`A`) to U+0046 (`F`). + +An **ASCII lower hex digit** is a character in the inclusive range U+0061 +(`a`) to U+0066 (`f`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `asciiPunctuation(code)` + +Check whether the [character code][code] represents ASCII punctuation. + +An **ASCII punctuation** is a character in the inclusive ranges U+0021 +EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT +SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT +(`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `markdownLineEnding(code)` + +Check whether a [character code][code] is a markdown line ending. + +A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN +LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR). + +In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE +RETURN (CR) are replaced by these virtual characters depending on whether +they occurred together. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `markdownLineEndingOrSpace(code)` + +Check whether a [character code][code] is a markdown line ending (see +`markdownLineEnding`) or markdown space (see `markdownSpace`). + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `markdownSpace(code)` + +Check whether a [character code][code] is a markdown space. + +A **markdown space** is the concrete character U+0020 SPACE (SP) and the +virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT). + +In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is +replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL +SPACE (VS) characters, depending on the column at which the tab occurred. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `unicodePunctuation(code)` + +Check whether the [character code][code] represents Unicode punctuation. + +A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, +Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` +(Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` +(Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII +punctuation (see `asciiPunctuation`) (**\[UNICODE]**). + +See **\[UNICODE]**:\ +[The Unicode Standard](https://www.unicode.org/versions/).\ +Unicode Consortium. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +### `unicodeWhitespace(code)` + +Check whether the [character code][code] represents Unicode whitespace. + +Note that this does handle micromark specific markdown whitespace characters. +See `markdownLineEndingOrSpace` to check that. + +A **Unicode whitespace** is a character in the Unicode `Zs` (Separator, +Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF), +U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**). + +See **\[UNICODE]**:\ +[The Unicode Standard](https://www.unicode.org/versions/).\ +Unicode Consortium. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Whether it matches (`boolean`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-character@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-character.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-character + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-character + +[bundle-size]: https://bundlejs.com/?q=micromark-util-character + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[code]: https://github.com/micromark/micromark#preprocess + +[api-ascii-alpha]: #asciialphacode + +[api-ascii-alphanumeric]: #asciialphanumericcode + +[api-ascii-atext]: #asciiatextcode + +[api-ascii-control]: #asciicontrolcode + +[api-ascii-digit]: #asciidigitcode + +[api-ascii-hex-digit]: #asciihexdigitcode + +[api-ascii-punctuation]: #asciipunctuationcode + +[api-markdown-line-ending]: #markdownlineendingcode + +[api-markdown-line-ending-or-space]: #markdownlineendingorspacecode + +[api-markdown-space]: #markdownspacecode + +[api-unicode-punctuation]: #unicodepunctuationcode + +[api-unicode-whitespace]: #unicodewhitespacecode diff --git a/tools/ui/node_modules/micromark-util-chunked/dev/index.d.ts b/tools/ui/node_modules/micromark-util-chunked/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed04ba20d0cff35b7d99eb1207a9b90f53c46d38 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-chunked/dev/index.d.ts @@ -0,0 +1,41 @@ +/** + * Like `Array#splice`, but smarter for giant arrays. + * + * `Array#splice` takes all items to be inserted as individual argument which + * causes a stack overflow in V8 when trying to insert 100k items for instance. + * + * Otherwise, this does not return the removed items, and takes `items` as an + * array instead of rest parameters. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {number} start + * Index to remove/insert at (can be negative). + * @param {number} remove + * Number of items to remove. + * @param {Array<T>} items + * Items to inject into `list`. + * @returns {undefined} + * Nothing. + */ +export function splice<T extends unknown>(list: Array<T>, start: number, remove: number, items: Array<T>): undefined; +/** + * Append `items` (an array) at the end of `list` (another array). + * When `list` was empty, returns `items` instead. + * + * This prevents a potentially expensive operation when `list` is empty, + * and adds items in batches to prevent V8 from hanging. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {Array<T>} items + * Items to add to `list`. + * @returns {Array<T>} + * Either `list` or `items`. + */ +export function push<T extends unknown>(list: Array<T>, items: Array<T>): Array<T>; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-chunked/dev/index.d.ts.map b/tools/ui/node_modules/micromark-util-chunked/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..432125397dfaddd1ad0533e9860cabd6ee7187a3 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-chunked/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,uBAbuB,CAAC,SAAX,OAAS,QAEX,KAAK,CAAC,CAAC,CAAC,SAER,MAAM,UAEN,MAAM,SAEN,KAAK,CAAC,CAAC,CAAC,GAEN,SAAS,CA0CrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBATuB,CAAC,SAAX,OAAS,QAEX,KAAK,CAAC,CAAC,CAAC,SAER,KAAK,CAAC,CAAC,CAAC,GAEN,KAAK,CAAC,CAAC,CAAC,CAUpB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-chunked/dev/index.js b/tools/ui/node_modules/micromark-util-chunked/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7b6a18f8713efbd01e657c4861fdf9bea2fcc881 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-chunked/dev/index.js @@ -0,0 +1,89 @@ +import {constants} from 'micromark-util-symbol' + +/** + * Like `Array#splice`, but smarter for giant arrays. + * + * `Array#splice` takes all items to be inserted as individual argument which + * causes a stack overflow in V8 when trying to insert 100k items for instance. + * + * Otherwise, this does not return the removed items, and takes `items` as an + * array instead of rest parameters. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {number} start + * Index to remove/insert at (can be negative). + * @param {number} remove + * Number of items to remove. + * @param {Array<T>} items + * Items to inject into `list`. + * @returns {undefined} + * Nothing. + */ +export function splice(list, start, remove, items) { + const end = list.length + let chunkStart = 0 + /** @type {Array<unknown>} */ + let parameters + + // Make start between zero and `end` (included). + if (start < 0) { + start = -start > end ? 0 : end + start + } else { + start = start > end ? end : start + } + + remove = remove > 0 ? remove : 0 + + // No need to chunk the items if there’s only a couple (10k) items. + if (items.length < constants.v8MaxSafeChunkSize) { + parameters = Array.from(items) + parameters.unshift(start, remove) + // @ts-expect-error Hush, it’s fine. + list.splice(...parameters) + } else { + // Delete `remove` items starting from `start` + if (remove) list.splice(start, remove) + + // Insert the items in chunks to not cause stack overflows. + while (chunkStart < items.length) { + parameters = items.slice( + chunkStart, + chunkStart + constants.v8MaxSafeChunkSize + ) + parameters.unshift(start, 0) + // @ts-expect-error Hush, it’s fine. + list.splice(...parameters) + + chunkStart += constants.v8MaxSafeChunkSize + start += constants.v8MaxSafeChunkSize + } + } +} + +/** + * Append `items` (an array) at the end of `list` (another array). + * When `list` was empty, returns `items` instead. + * + * This prevents a potentially expensive operation when `list` is empty, + * and adds items in batches to prevent V8 from hanging. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {Array<T>} items + * Items to add to `list`. + * @returns {Array<T>} + * Either `list` or `items`. + */ +export function push(list, items) { + if (list.length > 0) { + splice(list, list.length, 0, items) + return list + } + + return items +} diff --git a/tools/ui/node_modules/micromark-util-chunked/index.d.ts b/tools/ui/node_modules/micromark-util-chunked/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed04ba20d0cff35b7d99eb1207a9b90f53c46d38 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-chunked/index.d.ts @@ -0,0 +1,41 @@ +/** + * Like `Array#splice`, but smarter for giant arrays. + * + * `Array#splice` takes all items to be inserted as individual argument which + * causes a stack overflow in V8 when trying to insert 100k items for instance. + * + * Otherwise, this does not return the removed items, and takes `items` as an + * array instead of rest parameters. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {number} start + * Index to remove/insert at (can be negative). + * @param {number} remove + * Number of items to remove. + * @param {Array<T>} items + * Items to inject into `list`. + * @returns {undefined} + * Nothing. + */ +export function splice<T extends unknown>(list: Array<T>, start: number, remove: number, items: Array<T>): undefined; +/** + * Append `items` (an array) at the end of `list` (another array). + * When `list` was empty, returns `items` instead. + * + * This prevents a potentially expensive operation when `list` is empty, + * and adds items in batches to prevent V8 from hanging. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {Array<T>} items + * Items to add to `list`. + * @returns {Array<T>} + * Either `list` or `items`. + */ +export function push<T extends unknown>(list: Array<T>, items: Array<T>): Array<T>; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-chunked/index.d.ts.map b/tools/ui/node_modules/micromark-util-chunked/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..432125397dfaddd1ad0533e9860cabd6ee7187a3 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-chunked/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,uBAbuB,CAAC,SAAX,OAAS,QAEX,KAAK,CAAC,CAAC,CAAC,SAER,MAAM,UAEN,MAAM,SAEN,KAAK,CAAC,CAAC,CAAC,GAEN,SAAS,CA0CrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBATuB,CAAC,SAAX,OAAS,QAEX,KAAK,CAAC,CAAC,CAAC,SAER,KAAK,CAAC,CAAC,CAAC,GAEN,KAAK,CAAC,CAAC,CAAC,CAUpB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-chunked/index.js b/tools/ui/node_modules/micromark-util-chunked/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3a4b2624004bc591d51773ddebe763db7665cfcc --- /dev/null +++ b/tools/ui/node_modules/micromark-util-chunked/index.js @@ -0,0 +1,81 @@ +/** + * Like `Array#splice`, but smarter for giant arrays. + * + * `Array#splice` takes all items to be inserted as individual argument which + * causes a stack overflow in V8 when trying to insert 100k items for instance. + * + * Otherwise, this does not return the removed items, and takes `items` as an + * array instead of rest parameters. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {number} start + * Index to remove/insert at (can be negative). + * @param {number} remove + * Number of items to remove. + * @param {Array<T>} items + * Items to inject into `list`. + * @returns {undefined} + * Nothing. + */ +export function splice(list, start, remove, items) { + const end = list.length; + let chunkStart = 0; + /** @type {Array<unknown>} */ + let parameters; + + // Make start between zero and `end` (included). + if (start < 0) { + start = -start > end ? 0 : end + start; + } else { + start = start > end ? end : start; + } + remove = remove > 0 ? remove : 0; + + // No need to chunk the items if there’s only a couple (10k) items. + if (items.length < 10000) { + parameters = Array.from(items); + parameters.unshift(start, remove); + // @ts-expect-error Hush, it’s fine. + list.splice(...parameters); + } else { + // Delete `remove` items starting from `start` + if (remove) list.splice(start, remove); + + // Insert the items in chunks to not cause stack overflows. + while (chunkStart < items.length) { + parameters = items.slice(chunkStart, chunkStart + 10000); + parameters.unshift(start, 0); + // @ts-expect-error Hush, it’s fine. + list.splice(...parameters); + chunkStart += 10000; + start += 10000; + } + } +} + +/** + * Append `items` (an array) at the end of `list` (another array). + * When `list` was empty, returns `items` instead. + * + * This prevents a potentially expensive operation when `list` is empty, + * and adds items in batches to prevent V8 from hanging. + * + * @template {unknown} T + * Item type. + * @param {Array<T>} list + * List to operate on. + * @param {Array<T>} items + * Items to add to `list`. + * @returns {Array<T>} + * Either `list` or `items`. + */ +export function push(list, items) { + if (list.length > 0) { + splice(list, list.length, 0, items); + return list; + } + return items; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-chunked/license b/tools/ui/node_modules/micromark-util-chunked/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-chunked/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-chunked/package.json b/tools/ui/node_modules/micromark-util-chunked/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8a5c91d3955accaeb57cd41ac8e07881c376584d --- /dev/null +++ b/tools/ui/node_modules/micromark-util-chunked/package.json @@ -0,0 +1,57 @@ +{ + "name": "micromark-util-chunked", + "version": "2.0.1", + "description": "micromark utility to splice and push with giant arrays", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "chunk", + "splice", + "push" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-chunked", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-symbol": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-chunked/readme.md b/tools/ui/node_modules/micromark-util-chunked/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..6628fad732331d86454e5cca0c7b88df7230383d --- /dev/null +++ b/tools/ui/node_modules/micromark-util-chunked/readme.md @@ -0,0 +1,219 @@ +# micromark-util-chunked + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to splice and push with giant arrays. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`push(list, items)`](#pushlist-items) + * [`splice(list, start, remove, items)`](#splicelist-start-remove-items) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to splice for giant arrays, which V8 bugs +out on. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-chunked +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {push, splice} from 'https://esm.sh/micromark-util-chunked@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {push, splice} from 'https://esm.sh/micromark-util-chunked@1?bundle' +</script> +``` + +## Use + +```js +import {push, splice} from 'micromark-util-chunked' + +// … + +nextEvents = push(nextEvents, [ + ['enter', events[open][1], context], + ['exit', events[open][1], context] +]) + +// … + +splice(events, open - 1, index - open + 3, nextEvents) + +// … +``` + +## API + +This module exports the identifiers [`push`][api-push] +and [`splice`][api-splice]. +There is no default export. + +### `push(list, items)` + +Append `items` (an array) at the end of `list` (another array). +When `list` was empty, returns `items` instead. + +This prevents a potentially expensive operation when `list` is empty, +and adds items in batches to prevent V8 from hanging. + +###### Parameters + +* `list` (`Array<unknown>`) + — list to operate on +* `items` (`Array<unknown>`) + — items to add to `list` + +###### Returns + +Either `list` or `items` (`Array<unknown>`). + +### `splice(list, start, remove, items)` + +Like `Array#splice`, but smarter for giant arrays. + +`Array#splice` takes all items to be inserted as individual argument which +causes a stack overflow in V8 when trying to insert 100k items for instance. + +Otherwise, this does not return the removed items, and takes `items` as an +array instead of rest parameters. + +###### Parameters + +* `list` (`Array<unknown>`) + — list to operate on +* `start` (`number`) + — index to remove/insert at (can be negative) +* `remove` (`number`) + — number of items to remove +* `items` (`Array<unknown>`) + — items to inject into `list` + +###### Returns + +Nothing (`undefined`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-chunked@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-chunked.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-chunked + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-chunked + +[bundle-size]: https://bundlejs.com/?q=micromark-util-chunked + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-push]: #pushlist-items + +[api-splice]: #splicelist-start-remove-items diff --git a/tools/ui/node_modules/micromark-util-classify-character/dev/index.d.ts b/tools/ui/node_modules/micromark-util-classify-character/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..db98cd1fe96b08d416945581c6f95e75239e3b05 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-classify-character/dev/index.d.ts @@ -0,0 +1,18 @@ +/** + * Classify whether a code represents whitespace, punctuation, or something + * else. + * + * Used for attention (emphasis, strong), whose sequences can open or close + * based on the class of surrounding characters. + * + * > 👉 **Note**: eof (`null`) is seen as whitespace. + * + * @param {Code} code + * Code. + * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} + * Group. + */ +export function classifyCharacter(code: Code): typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined; +import type { Code } from 'micromark-util-types'; +import { constants } from 'micromark-util-symbol'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-classify-character/dev/index.d.ts.map b/tools/ui/node_modules/micromark-util-classify-character/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..9b63a5bedd53e2b54bf7c62fcf2d6aa699267602 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-classify-character/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,wCALW,IAAI,GAEF,OAAO,SAAS,CAAC,wBAAwB,GAAG,OAAO,SAAS,CAAC,yBAAyB,GAAG,SAAS,CAe9G;0BApCsB,sBAAsB;0BAQd,uBAAuB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-classify-character/dev/index.js b/tools/ui/node_modules/micromark-util-classify-character/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..0d82474555a898de21122e4538bce32bf4ef97ed --- /dev/null +++ b/tools/ui/node_modules/micromark-util-classify-character/dev/index.js @@ -0,0 +1,38 @@ +/** + * @import {Code} from 'micromark-util-types' + */ + +import { + markdownLineEndingOrSpace, + unicodePunctuation, + unicodeWhitespace +} from 'micromark-util-character' +import {codes, constants} from 'micromark-util-symbol' + +/** + * Classify whether a code represents whitespace, punctuation, or something + * else. + * + * Used for attention (emphasis, strong), whose sequences can open or close + * based on the class of surrounding characters. + * + * > 👉 **Note**: eof (`null`) is seen as whitespace. + * + * @param {Code} code + * Code. + * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} + * Group. + */ +export function classifyCharacter(code) { + if ( + code === codes.eof || + markdownLineEndingOrSpace(code) || + unicodeWhitespace(code) + ) { + return constants.characterGroupWhitespace + } + + if (unicodePunctuation(code)) { + return constants.characterGroupPunctuation + } +} diff --git a/tools/ui/node_modules/micromark-util-classify-character/index.d.ts b/tools/ui/node_modules/micromark-util-classify-character/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..db98cd1fe96b08d416945581c6f95e75239e3b05 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-classify-character/index.d.ts @@ -0,0 +1,18 @@ +/** + * Classify whether a code represents whitespace, punctuation, or something + * else. + * + * Used for attention (emphasis, strong), whose sequences can open or close + * based on the class of surrounding characters. + * + * > 👉 **Note**: eof (`null`) is seen as whitespace. + * + * @param {Code} code + * Code. + * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} + * Group. + */ +export function classifyCharacter(code: Code): typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined; +import type { Code } from 'micromark-util-types'; +import { constants } from 'micromark-util-symbol'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-classify-character/index.d.ts.map b/tools/ui/node_modules/micromark-util-classify-character/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..9b63a5bedd53e2b54bf7c62fcf2d6aa699267602 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-classify-character/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,wCALW,IAAI,GAEF,OAAO,SAAS,CAAC,wBAAwB,GAAG,OAAO,SAAS,CAAC,yBAAyB,GAAG,SAAS,CAe9G;0BApCsB,sBAAsB;0BAQd,uBAAuB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-classify-character/index.js b/tools/ui/node_modules/micromark-util-classify-character/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a9aebc6cb8528f0f415e48ca7c1a2ba62b6f6997 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-classify-character/index.js @@ -0,0 +1,27 @@ +/** + * @import {Code} from 'micromark-util-types' + */ + +import { markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character'; +/** + * Classify whether a code represents whitespace, punctuation, or something + * else. + * + * Used for attention (emphasis, strong), whose sequences can open or close + * based on the class of surrounding characters. + * + * > 👉 **Note**: eof (`null`) is seen as whitespace. + * + * @param {Code} code + * Code. + * @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined} + * Group. + */ +export function classifyCharacter(code) { + if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) { + return 1; + } + if (unicodePunctuation(code)) { + return 2; + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-classify-character/license b/tools/ui/node_modules/micromark-util-classify-character/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-classify-character/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-classify-character/package.json b/tools/ui/node_modules/micromark-util-classify-character/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f424ff97e678cbf8e5f5f9c533fa0182599e3dd1 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-classify-character/package.json @@ -0,0 +1,59 @@ +{ + "name": "micromark-util-classify-character", + "version": "2.0.1", + "description": "micromark utility to classify whether a character is whitespace or punctuation", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "attention", + "classify", + "character" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-classify-character", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-classify-character/readme.md b/tools/ui/node_modules/micromark-util-classify-character/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..f0b3ee78dc083f02c980509751babdec753d6298 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-classify-character/readme.md @@ -0,0 +1,205 @@ +# micromark-util-classify-character + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to classify whether a character is whitespace or +punctuation. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`classifyCharacter(code)`](#classifycharactercode) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to classify characters into 3 categories. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-classify-character +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {classifyCharacter} from 'https://esm.sh/micromark-util-classify-character@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {classifyCharacter} from 'https://esm.sh/micromark-util-classify-character@1?bundle' +</script> +``` + +## Use + +```js +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeAttention(effects, ok) { + return start + + // … + + /** @type {State} */ + function sequence(code) { + if (code === marker) { + // … + } + + const token = effects.exit('attentionSequence') + const after = classifyCharacter(code) + const open = + !after || (after === constants.characterGroupPunctuation && before) + const close = + !before || (before === constants.characterGroupPunctuation && after) + // … + } + + // … +} +``` + +## API + +This module exports the identifier +[`classifyCharacter`][api-classify-character]. +There is no default export. + +### `classifyCharacter(code)` + +Classify whether a code represents whitespace, punctuation, or something +else. + +Used for attention (emphasis, strong), whose sequences can open or close +based on the class of surrounding characters. + +> 👉 **Note**: eof (`null`) is seen as whitespace. + +###### Parameters + +* `code` (`Code`) + — code + +###### Returns + +Group (`constants.characterGroupWhitespace`, +`constants.characterGroupPunctuation`, or `undefined`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-classify-character@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-classify-character.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-classify-character + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-classify-character + +[bundle-size]: https://bundlejs.com/?q=micromark-util-classify-character + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-classify-character]: #classifycharactercode diff --git a/tools/ui/node_modules/micromark-util-combine-extensions/index.d.ts b/tools/ui/node_modules/micromark-util-combine-extensions/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dbd674cb8b21a6bb115f9ce162f39f40857df362 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-combine-extensions/index.d.ts @@ -0,0 +1,22 @@ +/** + * Combine multiple syntax extensions into one. + * + * @param {ReadonlyArray<Extension>} extensions + * List of syntax extensions. + * @returns {NormalizedExtension} + * A single combined extension. + */ +export function combineExtensions(extensions: ReadonlyArray<Extension>): NormalizedExtension; +/** + * Combine multiple HTML extensions into one. + * + * @param {ReadonlyArray<HtmlExtension>} htmlExtensions + * List of HTML extensions. + * @returns {HtmlExtension} + * Single combined HTML extension. + */ +export function combineHtmlExtensions(htmlExtensions: ReadonlyArray<HtmlExtension>): HtmlExtension; +import type { Extension } from 'micromark-util-types'; +import type { NormalizedExtension } from 'micromark-util-types'; +import type { HtmlExtension } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-combine-extensions/index.d.ts.map b/tools/ui/node_modules/micromark-util-combine-extensions/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e0ea7bf1ee4212d691d3451008021174be568ed0 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-combine-extensions/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,8CALW,aAAa,CAAC,SAAS,CAAC,GAEtB,mBAAmB,CAa/B;AA+DD;;;;;;;GAOG;AACH,sDALW,aAAa,CAAC,aAAa,CAAC,GAE1B,aAAa,CAazB;+BA1GS,sBAAsB;yCAAtB,sBAAsB;mCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-combine-extensions/index.js b/tools/ui/node_modules/micromark-util-combine-extensions/index.js new file mode 100644 index 0000000000000000000000000000000000000000..bc28f6d9c3184d9da94423271960560323076909 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-combine-extensions/index.js @@ -0,0 +1,143 @@ +/** + * @import { + * Extension, + * Handles, + * HtmlExtension, + * NormalizedExtension + * } from 'micromark-util-types' + */ + +import {splice} from 'micromark-util-chunked' + +const hasOwnProperty = {}.hasOwnProperty + +/** + * Combine multiple syntax extensions into one. + * + * @param {ReadonlyArray<Extension>} extensions + * List of syntax extensions. + * @returns {NormalizedExtension} + * A single combined extension. + */ +export function combineExtensions(extensions) { + /** @type {NormalizedExtension} */ + const all = {} + let index = -1 + + while (++index < extensions.length) { + syntaxExtension(all, extensions[index]) + } + + return all +} + +/** + * Merge `extension` into `all`. + * + * @param {NormalizedExtension} all + * Extension to merge into. + * @param {Extension} extension + * Extension to merge. + * @returns {undefined} + * Nothing. + */ +function syntaxExtension(all, extension) { + /** @type {keyof Extension} */ + let hook + + for (hook in extension) { + const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined + /** @type {Record<string, unknown>} */ + const left = maybe || (all[hook] = {}) + /** @type {Record<string, unknown> | undefined} */ + const right = extension[hook] + /** @type {string} */ + let code + + if (right) { + for (code in right) { + if (!hasOwnProperty.call(left, code)) left[code] = [] + const value = right[code] + constructs( + // @ts-expect-error Looks like a list. + left[code], + Array.isArray(value) ? value : value ? [value] : [] + ) + } + } + } +} + +/** + * Merge `list` into `existing` (both lists of constructs). + * Mutates `existing`. + * + * @param {Array<unknown>} existing + * List of constructs to merge into. + * @param {Array<unknown>} list + * List of constructs to merge. + * @returns {undefined} + * Nothing. + */ +function constructs(existing, list) { + let index = -1 + /** @type {Array<unknown>} */ + const before = [] + + while (++index < list.length) { + // @ts-expect-error Looks like an object. + ;(list[index].add === 'after' ? existing : before).push(list[index]) + } + + splice(existing, 0, 0, before) +} + +/** + * Combine multiple HTML extensions into one. + * + * @param {ReadonlyArray<HtmlExtension>} htmlExtensions + * List of HTML extensions. + * @returns {HtmlExtension} + * Single combined HTML extension. + */ +export function combineHtmlExtensions(htmlExtensions) { + /** @type {HtmlExtension} */ + const handlers = {} + let index = -1 + + while (++index < htmlExtensions.length) { + htmlExtension(handlers, htmlExtensions[index]) + } + + return handlers +} + +/** + * Merge `extension` into `all`. + * + * @param {HtmlExtension} all + * Extension to merge into. + * @param {HtmlExtension} extension + * Extension to merge. + * @returns {undefined} + * Nothing. + */ +function htmlExtension(all, extension) { + /** @type {keyof HtmlExtension} */ + let hook + + for (hook in extension) { + const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined + const left = maybe || (all[hook] = {}) + const right = extension[hook] + /** @type {keyof Handles} */ + let type + + if (right) { + for (type in right) { + // @ts-expect-error assume document vs regular handler are managed correctly. + left[type] = right[type] + } + } + } +} diff --git a/tools/ui/node_modules/micromark-util-combine-extensions/license b/tools/ui/node_modules/micromark-util-combine-extensions/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-combine-extensions/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-combine-extensions/package.json b/tools/ui/node_modules/micromark-util-combine-extensions/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f46ff4099f2a26645e04fb59df07074774cd2e94 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-combine-extensions/package.json @@ -0,0 +1,52 @@ +{ + "name": "micromark-util-combine-extensions", + "version": "2.0.1", + "description": "micromark utility to combine syntax or html extensions", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "extension", + "combine", + "merge" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-combine-extensions", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "guard-for-in": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-combine-extensions/readme.md b/tools/ui/node_modules/micromark-util-combine-extensions/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..b9b6fc13e9a3c7c1647c7ed7509a98a11eef1c7f --- /dev/null +++ b/tools/ui/node_modules/micromark-util-combine-extensions/readme.md @@ -0,0 +1,201 @@ +# micromark-util-combine-extensions + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to combine [syntax][] or [html][] extensions. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`combineExtensions(extensions)`](#combineextensionsextensions) + * [`combineHtmlExtensions(htmlExtensions)`](#combinehtmlextensionshtmlextensions) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package can merge multiple extensions into one. + +## When should I use this? + +This package might be useful when you are making “presets”, such as +[`micromark-extension-gfm`][micromark-extension-gfm]. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-combine-extensions +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {combineExtensions} from 'https://esm.sh/micromark-util-combine-extensions@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {combineExtensions} from 'https://esm.sh/micromark-util-combine-extensions@1?bundle' +</script> +``` + +## Use + +```js +import {gfmAutolinkLiteral} from 'micromark-extension-gfm-autolink-literal' +import {gfmStrikethrough} from 'micromark-extension-gfm-strikethrough' +import {gfmTable} from 'micromark-extension-gfm-table' +import {gfmTaskListItem} from 'micromark-extension-gfm-task-list-item' +import {combineExtensions} from 'micromark-util-combine-extensions' + +const gfm = combineExtensions([gfmAutolinkLiteral, gfmStrikethrough(), gfmTable, gfmTaskListItem]) +``` + +## API + +This module exports the identifiers +[`combineExtensions`][api-combine-extensions] and +[`combineHtmlExtensions`][api-combine-html-extensions]. +There is no default export. + +### `combineExtensions(extensions)` + +Combine multiple syntax extensions into one. + +###### Parameters + +* `extensions` (`Array<Extension>`) + — list of syntax extensions + +###### Returns + +A single combined extension (`Extension`). + +### `combineHtmlExtensions(htmlExtensions)` + +Combine multiple html extensions into one. + +###### Parameters + +* `htmlExtensions` (`Array<HtmlExtension>`) + — list of HTML extensions + +###### Returns + +A single combined HTML extension (`HtmlExtension`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-combine-extensions@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-combine-extensions.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-combine-extensions + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-combine-extensions + +[bundle-size]: https://bundlejs.com/?q=micromark-util-combine-extensions + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[syntax]: https://github.com/micromark/micromark#syntaxextension + +[html]: https://github.com/micromark/micromark#htmlextension + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[micromark-extension-gfm]: https://github.com/micromark/micromark-extension-gfm + +[api-combine-extensions]: #combineextensionsextensions + +[api-combine-html-extensions]: #combinehtmlextensionshtmlextensions diff --git a/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..333bdbbd0e6b51f3e9ef939e8821db1e9a0ff644 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts @@ -0,0 +1,16 @@ +/** + * Turn the number (in string form as either hexa- or plain decimal) coming from + * a numeric character reference into a character. + * + * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes + * non-characters and control characters safe. + * + * @param {string} value + * Value to decode. + * @param {number} base + * Numeric base. + * @returns {string} + * Character. + */ +export function decodeNumericCharacterReference(value: string, base: number): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..17f668f1040f5182cf4f5a7760060368ca76a905 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,uDAPW,MAAM,QAEN,MAAM,GAEJ,MAAM,CA4BlB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/dev/index.js b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a96c423833004a3fa609c647096d357be03e4a5a --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/dev/index.js @@ -0,0 +1,42 @@ +import {codes, values} from 'micromark-util-symbol' + +/** + * Turn the number (in string form as either hexa- or plain decimal) coming from + * a numeric character reference into a character. + * + * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes + * non-characters and control characters safe. + * + * @param {string} value + * Value to decode. + * @param {number} base + * Numeric base. + * @returns {string} + * Character. + */ +export function decodeNumericCharacterReference(value, base) { + const code = Number.parseInt(value, base) + + if ( + // C0 except for HT, LF, FF, CR, space. + code < codes.ht || + code === codes.vt || + (code > codes.cr && code < codes.space) || + // Control character (DEL) of C0, and C1 controls. + (code > codes.tilde && code < 160) || + // Lone high surrogates and low surrogates. + (code > 55_295 && code < 57_344) || + // Noncharacters. + (code > 64_975 && code < 65_008) || + /* eslint-disable no-bitwise */ + (code & 65_535) === 65_535 || + (code & 65_535) === 65_534 || + /* eslint-enable no-bitwise */ + // Out of range + code > 1_114_111 + ) { + return values.replacementCharacter + } + + return String.fromCodePoint(code) +} diff --git a/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..333bdbbd0e6b51f3e9ef939e8821db1e9a0ff644 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts @@ -0,0 +1,16 @@ +/** + * Turn the number (in string form as either hexa- or plain decimal) coming from + * a numeric character reference into a character. + * + * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes + * non-characters and control characters safe. + * + * @param {string} value + * Value to decode. + * @param {number} base + * Numeric base. + * @returns {string} + * Character. + */ +export function decodeNumericCharacterReference(value: string, base: number): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..17f668f1040f5182cf4f5a7760060368ca76a905 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,uDAPW,MAAM,QAEN,MAAM,GAEJ,MAAM,CA4BlB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/index.js b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1d75d7ba5c88e24ec20f2e9aee3de7c57d233123 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/index.js @@ -0,0 +1,32 @@ +/** + * Turn the number (in string form as either hexa- or plain decimal) coming from + * a numeric character reference into a character. + * + * Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes + * non-characters and control characters safe. + * + * @param {string} value + * Value to decode. + * @param {number} base + * Numeric base. + * @returns {string} + * Character. + */ +export function decodeNumericCharacterReference(value, base) { + const code = Number.parseInt(value, base); + if ( + // C0 except for HT, LF, FF, CR, space. + code < 9 || code === 11 || code > 13 && code < 32 || + // Control character (DEL) of C0, and C1 controls. + code > 126 && code < 160 || + // Lone high surrogates and low surrogates. + code > 55_295 && code < 57_344 || + // Noncharacters. + code > 64_975 && code < 65_008 || /* eslint-disable no-bitwise */ + (code & 65_535) === 65_535 || (code & 65_535) === 65_534 || /* eslint-enable no-bitwise */ + // Out of range + code > 1_114_111) { + return "\uFFFD"; + } + return String.fromCodePoint(code); +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/license b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/package.json b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/package.json new file mode 100644 index 0000000000000000000000000000000000000000..759e989b074066d4ea063eb3f859ae0e7010f47d --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/package.json @@ -0,0 +1,59 @@ +{ + "name": "micromark-util-decode-numeric-character-reference", + "version": "2.0.2", + "description": "micromark utility to decode numeric character references", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "decode", + "numeric", + "number", + "character", + "reference" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-decode-numeric-character-reference", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-symbol": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/readme.md b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..4610c59bc957a9c5cc035b53028ac9164efa7e73 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-numeric-character-reference/readme.md @@ -0,0 +1,184 @@ +# micromark-util-decode-numeric-character-reference + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to decode numeric character references. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`decodeNumericCharacterReference(value, base)`](#decodenumericcharacterreferencevalue-base) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to decode numeric character references. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-decode-numeric-character-reference +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {decodeNumericCharacterReference} from 'https://esm.sh/micromark-util-decode-numeric-character-reference@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {decodeNumericCharacterReference} from 'https://esm.sh/micromark-util-decode-numeric-character-reference@1?bundle' +</script> +``` + +## Use + +```js +import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference' + +decodeNumericCharacterReference('41', 16) // 'A' +decodeNumericCharacterReference('65', 10) // 'A' +decodeNumericCharacterReference('A', 16) // '\n' +decodeNumericCharacterReference('7F', 16) // '�' - Control +decodeNumericCharacterReference('110000', 16) // '�' - Out of range +``` + +## API + +This module exports the identifier: +[`decodeNumericCharacterReference`][api-decode-numeric-character-reference]. +There is no default export. + +### `decodeNumericCharacterReference(value, base)` + +Turn the number (in string form as either hexa- or plain decimal) coming from +a numeric character reference into a character. + +Sort of like `String.fromCodePoint(Number.parseInt(value, base))`, but makes +non-characters and control characters safe. + +###### Parameters + +* `value` (`string`) + — value to decode +* `base` (`number`, probably `10` or `16`) + — numeric base + +###### Returns + +Character (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-decode-numeric-character-reference@2`, compatible with +Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-normalize-identifier.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-normalize-identifier + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-normalize-identifier + +[bundle-size]: https://bundlejs.com/?q=micromark-util-normalize-identifier + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-decode-numeric-character-reference]: #decodenumericcharacterreferencevalue-base diff --git a/tools/ui/node_modules/micromark-util-decode-string/dev/index.d.ts b/tools/ui/node_modules/micromark-util-decode-string/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7395fe0985af77c231a2c719020cb4b91fbb2509 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-string/dev/index.d.ts @@ -0,0 +1,14 @@ +/** + * Decode markdown strings (which occur in places such as fenced code info + * strings, destinations, labels, and titles). + * + * The “string” content type allows character escapes and -references. + * This decodes those. + * + * @param {string} value + * Value to decode. + * @returns {string} + * Decoded value. + */ +export function decodeString(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-string/dev/index.d.ts.map b/tools/ui/node_modules/micromark-util-decode-string/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..773ee9f4bce69742a16ded2f58f67a7a516ebcca --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-string/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,oCALW,MAAM,GAEJ,MAAM,CAKlB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-string/dev/index.js b/tools/ui/node_modules/micromark-util-decode-string/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..214ca1663fd8f6a6b50bd99b2004ae3006e7cbec --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-string/dev/index.js @@ -0,0 +1,53 @@ +import {decodeNamedCharacterReference} from 'decode-named-character-reference' +import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference' +import {codes, constants} from 'micromark-util-symbol' + +const characterEscapeOrReference = + /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi + +/** + * Decode markdown strings (which occur in places such as fenced code info + * strings, destinations, labels, and titles). + * + * The “string” content type allows character escapes and -references. + * This decodes those. + * + * @param {string} value + * Value to decode. + * @returns {string} + * Decoded value. + */ +export function decodeString(value) { + return value.replace(characterEscapeOrReference, decode) +} + +/** + * @param {string} $0 + * Match. + * @param {string} $1 + * Character escape. + * @param {string} $2 + * Character reference. + * @returns {string} + * Decoded value + */ +function decode($0, $1, $2) { + if ($1) { + // Escape. + return $1 + } + + // Reference. + const head = $2.charCodeAt(0) + + if (head === codes.numberSign) { + const head = $2.charCodeAt(1) + const hex = head === codes.lowercaseX || head === codes.uppercaseX + return decodeNumericCharacterReference( + $2.slice(hex ? 2 : 1), + hex ? constants.numericBaseHexadecimal : constants.numericBaseDecimal + ) + } + + return decodeNamedCharacterReference($2) || $0 +} diff --git a/tools/ui/node_modules/micromark-util-decode-string/index.d.ts b/tools/ui/node_modules/micromark-util-decode-string/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7395fe0985af77c231a2c719020cb4b91fbb2509 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-string/index.d.ts @@ -0,0 +1,14 @@ +/** + * Decode markdown strings (which occur in places such as fenced code info + * strings, destinations, labels, and titles). + * + * The “string” content type allows character escapes and -references. + * This decodes those. + * + * @param {string} value + * Value to decode. + * @returns {string} + * Decoded value. + */ +export function decodeString(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-string/index.d.ts.map b/tools/ui/node_modules/micromark-util-decode-string/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..773ee9f4bce69742a16ded2f58f67a7a516ebcca --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-string/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,oCALW,MAAM,GAEJ,MAAM,CAKlB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-string/index.js b/tools/ui/node_modules/micromark-util-decode-string/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e6f07c8c16bcaed21789001be0de6b52dfff6466 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-string/index.js @@ -0,0 +1,45 @@ +import { decodeNamedCharacterReference } from 'decode-named-character-reference'; +import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference'; +const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; + +/** + * Decode markdown strings (which occur in places such as fenced code info + * strings, destinations, labels, and titles). + * + * The “string” content type allows character escapes and -references. + * This decodes those. + * + * @param {string} value + * Value to decode. + * @returns {string} + * Decoded value. + */ +export function decodeString(value) { + return value.replace(characterEscapeOrReference, decode); +} + +/** + * @param {string} $0 + * Match. + * @param {string} $1 + * Character escape. + * @param {string} $2 + * Character reference. + * @returns {string} + * Decoded value + */ +function decode($0, $1, $2) { + if ($1) { + // Escape. + return $1; + } + + // Reference. + const head = $2.charCodeAt(0); + if (head === 35) { + const head = $2.charCodeAt(1); + const hex = head === 120 || head === 88; + return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10); + } + return decodeNamedCharacterReference($2) || $0; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-decode-string/license b/tools/ui/node_modules/micromark-util-decode-string/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-string/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-decode-string/package.json b/tools/ui/node_modules/micromark-util-decode-string/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e32660a7a1d8cbe63ef44831d9aef4049cb69269 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-string/package.json @@ -0,0 +1,63 @@ +{ + "name": "micromark-util-decode-string", + "version": "2.0.1", + "description": "micromark utility to decode markdown strings", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "decode", + "character", + "reference", + "escape", + "string" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-decode-string", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "decode-named-character-reference": "^1.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-decode-string/readme.md b/tools/ui/node_modules/micromark-util-decode-string/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..291fe6938ec290a69488bf39709d68ad9790d4df --- /dev/null +++ b/tools/ui/node_modules/micromark-util-decode-string/readme.md @@ -0,0 +1,179 @@ +# micromark-util-decode-string + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to decode markdown strings. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`decodeString(value)`](#decodestringvalue) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to parse character escapes and character +references. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-decode-string +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {decodeString} from 'https://esm.sh/micromark-util-decode-string@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {decodeString} from 'https://esm.sh/micromark-util-decode-string@1?bundle' +</script> +``` + +## Use + +```js +import {decodeString} from 'micromark-util-decode-string' + +decodeString('a &semi; b') // 'a ; b' +decodeString('a \\; b') // 'a ; b' +decodeString('a ; b') // 'a ; b' +``` + +## API + +This module exports the identifier [`decodeString`][api-decode-string]. +There is no default export. + +### `decodeString(value)` + +Decode markdown strings (which occur in places such as fenced code info strings, +destinations, labels, and titles). + +The “string” content type allows character escapes and -references. +This decodes those. + +###### Parameters + +* `value` (`string`) + — value to decode + +###### Returns + +Decoded value (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-decode-string@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-normalize-identifier.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-normalize-identifier + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-normalize-identifier + +[bundle-size]: https://bundlejs.com/?q=micromark-util-normalize-identifier + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-decode-string]: #decodestringvalue diff --git a/tools/ui/node_modules/micromark-util-encode/index.d.ts b/tools/ui/node_modules/micromark-util-encode/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..760226f6188af15bbdf4c8238767d7813a6e8ed0 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-encode/index.d.ts @@ -0,0 +1,14 @@ +/** + * Encode only the dangerous HTML characters. + * + * This ensures that certain characters which have special meaning in HTML are + * dealt with. + * Technically, we can skip `>` and `"` in many cases, but CM includes them. + * + * @param {string} value + * Value to encode. + * @returns {string} + * Encoded value. + */ +export function encode(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-encode/index.d.ts.map b/tools/ui/node_modules/micromark-util-encode/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..16eebb1cc4a391c247cb6954a1bcdccee89417cc --- /dev/null +++ b/tools/ui/node_modules/micromark-util-encode/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,8BALW,MAAM,GAEJ,MAAM,CAqBlB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-encode/index.js b/tools/ui/node_modules/micromark-util-encode/index.js new file mode 100644 index 0000000000000000000000000000000000000000..397f1d4041af0593b79022fa483947534ccb117a --- /dev/null +++ b/tools/ui/node_modules/micromark-util-encode/index.js @@ -0,0 +1,33 @@ +const characterReferences = {'"': 'quot', '&': 'amp', '<': 'lt', '>': 'gt'} + +/** + * Encode only the dangerous HTML characters. + * + * This ensures that certain characters which have special meaning in HTML are + * dealt with. + * Technically, we can skip `>` and `"` in many cases, but CM includes them. + * + * @param {string} value + * Value to encode. + * @returns {string} + * Encoded value. + */ +export function encode(value) { + return value.replace(/["&<>]/g, replace) + + /** + * @param {string} value + * Value to replace. + * @returns {string} + * Encoded value. + */ + function replace(value) { + return ( + '&' + + characterReferences[ + /** @type {keyof typeof characterReferences} */ (value) + ] + + ';' + ) + } +} diff --git a/tools/ui/node_modules/micromark-util-encode/license b/tools/ui/node_modules/micromark-util-encode/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-encode/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-encode/package.json b/tools/ui/node_modules/micromark-util-encode/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a56c6b3b04e95af3f3d2282c85eb13294c185ccb --- /dev/null +++ b/tools/ui/node_modules/micromark-util-encode/package.json @@ -0,0 +1,47 @@ +{ + "name": "micromark-util-encode", + "version": "2.0.1", + "description": "micromark utility to encode dangerous html characters", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "html", + "encode" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-encode", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-string-replace-all": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-encode/readme.md b/tools/ui/node_modules/micromark-util-encode/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..cd27292fe1223af19890419e545ebd4596fdaf24 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-encode/readme.md @@ -0,0 +1,176 @@ +# micromark-util-encode + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to encode dangerous html characters. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`encode(value)`](#encodevalue) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to make text safe for embedding in HTML. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-encode +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {encode} from 'https://esm.sh/micromark-util-encode@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {encode} from 'https://esm.sh/micromark-util-encode@1?bundle' +</script> +``` + +## Use + +```js +import {encode} from 'micromark-util-encode' + +encode('<3') // '&lt;3' +``` + +## API + +This module exports the identifier [`encode`][api-encode]. +There is no default export. + +### `encode(value)` + +Encode only the dangerous HTML characters. + +This ensures that certain characters which have special meaning in HTML are +dealt with. +Technically, we can skip `>` and `"` in many cases, but CM includes them. + +###### Parameters + +* `value` (`string`) + — value to encode + +###### Returns + +Encoded value (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-encode@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-encode.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-encode + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-encode + +[bundle-size]: https://bundlejs.com/?q=micromark-util-encode + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-encode]: #encodevalue diff --git a/tools/ui/node_modules/micromark-util-html-tag-name/index.d.ts b/tools/ui/node_modules/micromark-util-html-tag-name/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd5ef317cd95d6e4214c34043248faccb545e66a --- /dev/null +++ b/tools/ui/node_modules/micromark-util-html-tag-name/index.d.ts @@ -0,0 +1,30 @@ +/** + * List of lowercase HTML “block” tag names. + * + * The list, when parsing HTML (flow), results in more relaxed rules (condition + * 6). + * Because they are known blocks, the HTML-like syntax doesn’t have to be + * strictly parsed. + * For tag names not in this list, a more strict algorithm (condition 7) is used + * to detect whether the HTML-like syntax is seen as HTML (flow) or not. + * + * This is copied from: + * <https://spec.commonmark.org/0.30/#html-blocks>. + * + * > 👉 **Note**: `search` was added in `CommonMark@0.31`. + */ +export const htmlBlockNames: string[]; +/** + * List of lowercase HTML “raw” tag names. + * + * The list, when parsing HTML (flow), results in HTML that can include lines + * without exiting, until a closing tag also in this list is found (condition + * 1). + * + * This module is copied from: + * <https://spec.commonmark.org/0.30/#html-blocks>. + * + * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`. + */ +export const htmlRawNames: string[]; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-html-tag-name/index.d.ts.map b/tools/ui/node_modules/micromark-util-html-tag-name/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..56f2fc0f2e5943da7e191dd897045427131027ae --- /dev/null +++ b/tools/ui/node_modules/micromark-util-html-tag-name/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,sCA+DC;AAED;;;;;;;;;;;GAWG;AACH,oCAAkE"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-html-tag-name/index.js b/tools/ui/node_modules/micromark-util-html-tag-name/index.js new file mode 100644 index 0000000000000000000000000000000000000000..fa0a0fd95004fb549735e5a343e158bcf8145fb5 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-html-tag-name/index.js @@ -0,0 +1,93 @@ +/** + * List of lowercase HTML “block” tag names. + * + * The list, when parsing HTML (flow), results in more relaxed rules (condition + * 6). + * Because they are known blocks, the HTML-like syntax doesn’t have to be + * strictly parsed. + * For tag names not in this list, a more strict algorithm (condition 7) is used + * to detect whether the HTML-like syntax is seen as HTML (flow) or not. + * + * This is copied from: + * <https://spec.commonmark.org/0.30/#html-blocks>. + * + * > 👉 **Note**: `search` was added in `CommonMark@0.31`. + */ +export const htmlBlockNames = [ + 'address', + 'article', + 'aside', + 'base', + 'basefont', + 'blockquote', + 'body', + 'caption', + 'center', + 'col', + 'colgroup', + 'dd', + 'details', + 'dialog', + 'dir', + 'div', + 'dl', + 'dt', + 'fieldset', + 'figcaption', + 'figure', + 'footer', + 'form', + 'frame', + 'frameset', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', + 'head', + 'header', + 'hr', + 'html', + 'iframe', + 'legend', + 'li', + 'link', + 'main', + 'menu', + 'menuitem', + 'nav', + 'noframes', + 'ol', + 'optgroup', + 'option', + 'p', + 'param', + 'search', + 'section', + 'summary', + 'table', + 'tbody', + 'td', + 'tfoot', + 'th', + 'thead', + 'title', + 'tr', + 'track', + 'ul' +] + +/** + * List of lowercase HTML “raw” tag names. + * + * The list, when parsing HTML (flow), results in HTML that can include lines + * without exiting, until a closing tag also in this list is found (condition + * 1). + * + * This module is copied from: + * <https://spec.commonmark.org/0.30/#html-blocks>. + * + * > 👉 **Note**: `textarea` was added in `CommonMark@0.30`. + */ +export const htmlRawNames = ['pre', 'script', 'style', 'textarea'] diff --git a/tools/ui/node_modules/micromark-util-html-tag-name/license b/tools/ui/node_modules/micromark-util-html-tag-name/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-html-tag-name/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-html-tag-name/package.json b/tools/ui/node_modules/micromark-util-html-tag-name/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9015e128c8d0686794806f9ddd1cc9db4f0b2f94 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-html-tag-name/package.json @@ -0,0 +1,47 @@ +{ + "name": "micromark-util-html-tag-name", + "version": "2.0.1", + "description": "micromark utility with list of html tag names", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "html", + "tag", + "name" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-html-tag-name", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-html-tag-name/readme.md b/tools/ui/node_modules/micromark-util-html-tag-name/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..ff16f68e742ddf6e4c713b81ea7bc53ebe15df2e --- /dev/null +++ b/tools/ui/node_modules/micromark-util-html-tag-name/readme.md @@ -0,0 +1,193 @@ +# micromark-util-html-tag-name + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility with list of html tag names. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`htmlBlockNames`](#htmlblocknames) + * [`htmlRawNames`](#htmlrawnames) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes a list of known tag names to markdown. + +## When should I use this? + +This package is only useful if you want to build an alternative to micromark. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-html-tag-name +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {htmlBlockNames, htmlRawNames} from 'https://esm.sh/micromark-util-html-tag-name@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {htmlBlockNames, htmlRawNames} from 'https://esm.sh/micromark-util-html-tag-name@1?bundle' +</script> +``` + +## Use + +```js +import {htmlBlockNames, htmlRawNames} from 'micromark-util-html-tag-name' + +console.log(htmlBlockNames) // ['address', 'article', …] +console.log(htmlRawNames) // ['pre', 'script', …] +``` + +## API + +This module exports the identifiers [`htmlBlockNames`][api-html-block-names] +and [`htmlRawNames`][api-html-raw-names]. +There is no default export. + +### `htmlBlockNames` + +List of lowercase HTML “block” tag names (`Array<string>`). + +The list, when parsing HTML (flow), results in more relaxed rules (condition +6\). +Because they are known blocks, the HTML-like syntax doesn’t have to be strictly +parsed. +For tag names not in this list, a more strict algorithm (condition 7) is used +to detect whether the HTML-like syntax is seen as HTML (flow) or not. + +This is copied from: +<https://spec.commonmark.org/0.30/#html-blocks>. + +> 👉 **Note**: `search` was added in `CommonMark@0.31`. + +### `htmlRawNames` + +List of lowercase HTML “raw” tag names (`Array<string>`). + +The list, when parsing HTML (flow), results in HTML that can include lines +without exiting, until a closing tag also in this list is found (condition +1\). + +This module is copied from: +<https://spec.commonmark.org/0.30/#html-blocks>. + +> 👉 **Note**: `textarea` was added in `CommonMark@0.30`. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-html-tag-name@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-html-tag-name.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-html-tag-name + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-html-tag-name + +[bundle-size]: https://bundlejs.com/?q=micromark-util-html-tag-name + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-html-block-names]: #htmlblocknames + +[api-html-raw-names]: #htmlrawnames diff --git a/tools/ui/node_modules/micromark-util-normalize-identifier/dev/index.d.ts b/tools/ui/node_modules/micromark-util-normalize-identifier/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..96074f603183149066a463cc0cf75485528ec819 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-normalize-identifier/dev/index.d.ts @@ -0,0 +1,21 @@ +/** + * Normalize an identifier (as found in references, definitions). + * + * Collapses markdown whitespace, trim, and then lower- and uppercase. + * + * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their + * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different + * uppercase character (U+0398 (`Θ`)). + * So, to get a canonical form, we perform both lower- and uppercase. + * + * Using uppercase last makes sure keys will never interact with default + * prototypal values (such as `constructor`): nothing in the prototype of + * `Object` is uppercase. + * + * @param {string} value + * Identifier to normalize. + * @returns {string} + * Normalized identifier. + */ +export function normalizeIdentifier(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map b/tools/ui/node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..684ad8d872b8874ce11ce8a82df3eac05f088dde --- /dev/null +++ b/tools/ui/node_modules/micromark-util-normalize-identifier/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,2CALW,MAAM,GAEJ,MAAM,CAmBlB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-normalize-identifier/dev/index.js b/tools/ui/node_modules/micromark-util-normalize-identifier/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ce4ce9b61c571e68e4d5208bf00e58d1fa8f8ffc --- /dev/null +++ b/tools/ui/node_modules/micromark-util-normalize-identifier/dev/index.js @@ -0,0 +1,38 @@ +import {values} from 'micromark-util-symbol' + +/** + * Normalize an identifier (as found in references, definitions). + * + * Collapses markdown whitespace, trim, and then lower- and uppercase. + * + * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their + * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different + * uppercase character (U+0398 (`Θ`)). + * So, to get a canonical form, we perform both lower- and uppercase. + * + * Using uppercase last makes sure keys will never interact with default + * prototypal values (such as `constructor`): nothing in the prototype of + * `Object` is uppercase. + * + * @param {string} value + * Identifier to normalize. + * @returns {string} + * Normalized identifier. + */ +export function normalizeIdentifier(value) { + return ( + value + // Collapse markdown whitespace. + .replace(/[\t\n\r ]+/g, values.space) + // Trim. + .replace(/^ | $/g, '') + // Some characters are considered “uppercase”, but if their lowercase + // counterpart is uppercased will result in a different uppercase + // character. + // Hence, to get that form, we perform both lower- and uppercase. + // Upper case makes sure keys will not interact with default prototypal + // methods: no method is uppercase. + .toLowerCase() + .toUpperCase() + ) +} diff --git a/tools/ui/node_modules/micromark-util-normalize-identifier/index.d.ts b/tools/ui/node_modules/micromark-util-normalize-identifier/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..96074f603183149066a463cc0cf75485528ec819 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-normalize-identifier/index.d.ts @@ -0,0 +1,21 @@ +/** + * Normalize an identifier (as found in references, definitions). + * + * Collapses markdown whitespace, trim, and then lower- and uppercase. + * + * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their + * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different + * uppercase character (U+0398 (`Θ`)). + * So, to get a canonical form, we perform both lower- and uppercase. + * + * Using uppercase last makes sure keys will never interact with default + * prototypal values (such as `constructor`): nothing in the prototype of + * `Object` is uppercase. + * + * @param {string} value + * Identifier to normalize. + * @returns {string} + * Normalized identifier. + */ +export function normalizeIdentifier(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-normalize-identifier/index.d.ts.map b/tools/ui/node_modules/micromark-util-normalize-identifier/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..684ad8d872b8874ce11ce8a82df3eac05f088dde --- /dev/null +++ b/tools/ui/node_modules/micromark-util-normalize-identifier/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,2CALW,MAAM,GAEJ,MAAM,CAmBlB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-normalize-identifier/index.js b/tools/ui/node_modules/micromark-util-normalize-identifier/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f2060214270d5f6a72017ab99d05e1325e50db93 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-normalize-identifier/index.js @@ -0,0 +1,33 @@ +/** + * Normalize an identifier (as found in references, definitions). + * + * Collapses markdown whitespace, trim, and then lower- and uppercase. + * + * Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their + * lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different + * uppercase character (U+0398 (`Θ`)). + * So, to get a canonical form, we perform both lower- and uppercase. + * + * Using uppercase last makes sure keys will never interact with default + * prototypal values (such as `constructor`): nothing in the prototype of + * `Object` is uppercase. + * + * @param {string} value + * Identifier to normalize. + * @returns {string} + * Normalized identifier. + */ +export function normalizeIdentifier(value) { + return value + // Collapse markdown whitespace. + .replace(/[\t\n\r ]+/g, " ") + // Trim. + .replace(/^ | $/g, '') + // Some characters are considered “uppercase”, but if their lowercase + // counterpart is uppercased will result in a different uppercase + // character. + // Hence, to get that form, we perform both lower- and uppercase. + // Upper case makes sure keys will not interact with default prototypal + // methods: no method is uppercase. + .toLowerCase().toUpperCase(); +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-normalize-identifier/license b/tools/ui/node_modules/micromark-util-normalize-identifier/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-normalize-identifier/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-normalize-identifier/package.json b/tools/ui/node_modules/micromark-util-normalize-identifier/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4fb1982df2962948e555d983da15c78ec16d4170 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-normalize-identifier/package.json @@ -0,0 +1,58 @@ +{ + "name": "micromark-util-normalize-identifier", + "version": "2.0.1", + "description": "micromark utility normalize identifiers (as found in references, definitions)", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "normalize", + "id", + "identifier" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-normalize-identifier", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-symbol": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off", + "unicorn/prefer-string-replace-all": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-normalize-identifier/readme.md b/tools/ui/node_modules/micromark-util-normalize-identifier/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..97e2383a1e1adf0bc595c8ccda2dcb2181f23ef0 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-normalize-identifier/readme.md @@ -0,0 +1,187 @@ +# micromark-util-normalize-identifier + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility normalize identifiers. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`normalizeIdentifier(value)`](#normalizeidentifiervalue) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to normalize identifiers found in markdown. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-normalize-identifier +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {normalizeIdentifier} from 'https://esm.sh/micromark-util-normalize-identifier@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {normalizeIdentifier} from 'https://esm.sh/micromark-util-normalize-identifier@1?bundle' +</script> +``` + +## Use + +```js +import {normalizeIdentifier} from 'micromark-util-normalize-identifier' + +normalizeIdentifier(' a ') // 'A' +normalizeIdentifier('a\t\r\nb') // 'A B' +normalizeIdentifier('ТОЛПОЙ') // 'ТОЛПОЙ' +normalizeIdentifier('Толпой') // 'ТОЛПОЙ' +``` + +## API + +This module exports the identifier +[`normalizeIdentifier`][api-normalize-identifier]. +There is no default export. + +### `normalizeIdentifier(value)` + +Normalize an identifier (as found in references, definitions). + +Collapses markdown whitespace, trim, and then lower- and uppercase. + +Some characters are considered “uppercase”, such as U+03F4 (`ϴ`), but if their +lowercase counterpart (U+03B8 (`θ`)) is uppercased will result in a different +uppercase character (U+0398 (`Θ`)). +So, to get a canonical form, we perform both lower- and uppercase. + +Using uppercase last makes sure keys will never interact with default +prototypal values (such as `constructor`): nothing in the prototype of `Object` +is uppercase. + +###### Parameters + +* `value` (`string`) + — identifier to normalize + +###### Returns + +Normalized identifier (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-normalize-identifier@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-normalize-identifier.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-normalize-identifier + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-normalize-identifier + +[bundle-size]: https://bundlejs.com/?q=micromark-util-normalize-identifier + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-normalize-identifier]: #normalizeidentifiervalue diff --git a/tools/ui/node_modules/micromark-util-resolve-all/index.d.ts b/tools/ui/node_modules/micromark-util-resolve-all/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c9cbe16b64d9576aae88238769ecd0fe542f698b --- /dev/null +++ b/tools/ui/node_modules/micromark-util-resolve-all/index.d.ts @@ -0,0 +1,22 @@ +/** + * @import {Event, Resolver, TokenizeContext} from 'micromark-util-types' + */ +/** + * Call all `resolveAll`s. + * + * @param {ReadonlyArray<{resolveAll?: Resolver | undefined}>} constructs + * List of constructs, optionally with `resolveAll`s. + * @param {Array<Event>} events + * List of events. + * @param {TokenizeContext} context + * Context used by `tokenize`. + * @returns {Array<Event>} + * Changed events. + */ +export function resolveAll(constructs: ReadonlyArray<{ + resolveAll?: Resolver | undefined; +}>, events: Array<Event>, context: TokenizeContext): Array<Event>; +import type { Resolver } from 'micromark-util-types'; +import type { Event } from 'micromark-util-types'; +import type { TokenizeContext } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-resolve-all/index.d.ts.map b/tools/ui/node_modules/micromark-util-resolve-all/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8ba707e732fbd0bbcdf3d37bc8f54c64f27b302e --- /dev/null +++ b/tools/ui/node_modules/micromark-util-resolve-all/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,uCATW,aAAa,CAAC;IAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAC,CAAC,UAElD,KAAK,CAAC,KAAK,CAAC,WAEZ,eAAe,GAEb,KAAK,CAAC,KAAK,CAAC,CAkBxB;8BA9BkD,sBAAsB;2BAAtB,sBAAsB;qCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-resolve-all/index.js b/tools/ui/node_modules/micromark-util-resolve-all/index.js new file mode 100644 index 0000000000000000000000000000000000000000..69eb32b604c6c7a1d87bb664825b9be6876181b2 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-resolve-all/index.js @@ -0,0 +1,32 @@ +/** + * @import {Event, Resolver, TokenizeContext} from 'micromark-util-types' + */ + +/** + * Call all `resolveAll`s. + * + * @param {ReadonlyArray<{resolveAll?: Resolver | undefined}>} constructs + * List of constructs, optionally with `resolveAll`s. + * @param {Array<Event>} events + * List of events. + * @param {TokenizeContext} context + * Context used by `tokenize`. + * @returns {Array<Event>} + * Changed events. + */ +export function resolveAll(constructs, events, context) { + /** @type {Array<Resolver>} */ + const called = [] + let index = -1 + + while (++index < constructs.length) { + const resolve = constructs[index].resolveAll + + if (resolve && !called.includes(resolve)) { + events = resolve(events, context) + called.push(resolve) + } + } + + return events +} diff --git a/tools/ui/node_modules/micromark-util-resolve-all/license b/tools/ui/node_modules/micromark-util-resolve-all/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-resolve-all/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-resolve-all/package.json b/tools/ui/node_modules/micromark-util-resolve-all/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f1d7c2b2af2944f79b771d35f070f76ce1378c80 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-resolve-all/package.json @@ -0,0 +1,48 @@ +{ + "name": "micromark-util-resolve-all", + "version": "2.0.1", + "description": "micromark utility to resolve subtokens", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "resolve" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-resolve-all", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-resolve-all/readme.md b/tools/ui/node_modules/micromark-util-resolve-all/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..11eefd47aed053752c497307d3df2c5462eb508b --- /dev/null +++ b/tools/ui/node_modules/micromark-util-resolve-all/readme.md @@ -0,0 +1,238 @@ +# micromark-util-resolve-all + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to resolve subtokens. + +[Resolvers][resolver] are functions that take events and manipulate them. +This is needed for example because media (links, images) and attention (strong, +italic) aren’t parsed left-to-right. +Instead, their openings and closings are parsed, and when done, their openings +and closings are matched, and left overs are turned into plain text. +Because media and attention can’t overlap, we need to perform that operation +when one closing matches an opening, too. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`resolveAll(constructs, events, context)`](#resolveallconstructs-events-context) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes a micromark internal that you probably don’t need. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-resolve-all +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {resolveAll} from 'https://esm.sh/micromark-util-resolve-all@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {resolveAll} from 'https://esm.sh/micromark-util-resolve-all@1?bundle' +</script> +``` + +## Use + +```js +import {push} from 'micromark-util-chunked' +import {resolveAll} from 'micromark-util-resolve-all' + +/** + * @type {Resolver} + */ +function resolveAllAttention(events, context) { + // … + + // Walk through all events. + while (++index < events.length) { + // Find a token that can close. + if ( + events[index][0] === 'enter' && + events[index][1].type === 'attentionSequence' && + events[index][1]._close + ) { + open = index + + // Now walk back to find an opener. + while (open--) { + // Find a token that can open the closer. + if ( + // … + ) { + // … + + // Opening. + nextEvents = push(nextEvents, [ + // … + ]) + + // Between. + nextEvents = push( + nextEvents, + resolveAll( + context.parser.constructs.insideSpan.null, + events.slice(open + 1, index), + context + ) + ) + + // Closing. + nextEvents = push(nextEvents, [ + // … + ]) + + // … + } + } + } + } + + // … +} +``` + +## API + +This module exports the identifier [`resolveAll`][api-resolve-all]. +There is no default export. + +### `resolveAll(constructs, events, context)` + +Call all `resolveAll`s in `constructs`. + +###### Parameters + +* `constructs` (`Array<Construct>`) + — list of constructs, optionally with `resolveAll`s +* `events` (`Array<Event>`) + — list of events +* `context` (`TokenizeContext`) + — context used by `tokenize` + +###### Returns + +Changed events (`Array<Events>`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-resolve-all@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-resolve-all.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-resolve-all + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-resolve-all + +[bundle-size]: https://bundlejs.com/?q=micromark-util-resolve-all + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[resolver]: https://github.com/micromark/micromark/blob/a571c09/packages/micromark-util-types/index.js#L219 + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[api-resolve-all]: #resolveallconstructs-events-context diff --git a/tools/ui/node_modules/micromark-util-sanitize-uri/dev/index.d.ts b/tools/ui/node_modules/micromark-util-sanitize-uri/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a105f230e852e42911bb97b513b8bc8c76b417e9 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-sanitize-uri/dev/index.d.ts @@ -0,0 +1,36 @@ +/** + * Make a value safe for injection as a URL. + * + * This encodes unsafe characters with percent-encoding and skips already + * encoded sequences (see `normalizeUri`). + * Further unsafe characters are encoded as character references (see + * `micromark-util-encode`). + * + * A regex of allowed protocols can be given, in which case the URL is + * sanitized. + * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or + * `/^https?$/i` for `img[src]` (this is what `github.com` allows). + * If the URL includes an unknown protocol (one not matched by `protocol`, such + * as a dangerous example, `javascript:`), the value is ignored. + * + * @param {string | null | undefined} url + * URI to sanitize. + * @param {RegExp | null | undefined} [protocol] + * Allowed protocols. + * @returns {string} + * Sanitized URI. + */ +export function sanitizeUri(url: string | null | undefined, protocol?: RegExp | null | undefined): string; +/** + * Normalize a URL. + * + * Encode unsafe characters with percent-encoding, skipping already encoded + * sequences. + * + * @param {string} value + * URI to normalize. + * @returns {string} + * Normalized URI. + */ +export function normalizeUri(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map b/tools/ui/node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..cab948352403dc772814bc9245e78a475a8900a6 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-sanitize-uri/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iCAPW,MAAM,GAAG,IAAI,GAAG,SAAS,aAEzB,MAAM,GAAG,IAAI,GAAG,SAAS,GAEvB,MAAM,CA6BlB;AAED;;;;;;;;;;GAUG;AACH,oCALW,MAAM,GAEJ,MAAM,CA6DlB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-sanitize-uri/dev/index.js b/tools/ui/node_modules/micromark-util-sanitize-uri/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..cc454b5e02e681a4cf08e1568d52834ad4035e2b --- /dev/null +++ b/tools/ui/node_modules/micromark-util-sanitize-uri/dev/index.js @@ -0,0 +1,124 @@ +import {asciiAlphanumeric} from 'micromark-util-character' +import {encode} from 'micromark-util-encode' +import {codes, values} from 'micromark-util-symbol' + +/** + * Make a value safe for injection as a URL. + * + * This encodes unsafe characters with percent-encoding and skips already + * encoded sequences (see `normalizeUri`). + * Further unsafe characters are encoded as character references (see + * `micromark-util-encode`). + * + * A regex of allowed protocols can be given, in which case the URL is + * sanitized. + * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or + * `/^https?$/i` for `img[src]` (this is what `github.com` allows). + * If the URL includes an unknown protocol (one not matched by `protocol`, such + * as a dangerous example, `javascript:`), the value is ignored. + * + * @param {string | null | undefined} url + * URI to sanitize. + * @param {RegExp | null | undefined} [protocol] + * Allowed protocols. + * @returns {string} + * Sanitized URI. + */ +export function sanitizeUri(url, protocol) { + const value = encode(normalizeUri(url || '')) + + if (!protocol) { + return value + } + + const colon = value.indexOf(':') + const questionMark = value.indexOf('?') + const numberSign = value.indexOf('#') + const slash = value.indexOf('/') + + if ( + // If there is no protocol, it’s relative. + colon < 0 || + // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol. + (slash > -1 && colon > slash) || + (questionMark > -1 && colon > questionMark) || + (numberSign > -1 && colon > numberSign) || + // It is a protocol, it should be allowed. + protocol.test(value.slice(0, colon)) + ) { + return value + } + + return '' +} + +/** + * Normalize a URL. + * + * Encode unsafe characters with percent-encoding, skipping already encoded + * sequences. + * + * @param {string} value + * URI to normalize. + * @returns {string} + * Normalized URI. + */ +export function normalizeUri(value) { + /** @type {Array<string>} */ + const result = [] + let index = -1 + let start = 0 + let skip = 0 + + while (++index < value.length) { + const code = value.charCodeAt(index) + /** @type {string} */ + let replace = '' + + // A correct percent encoded value. + if ( + code === codes.percentSign && + asciiAlphanumeric(value.charCodeAt(index + 1)) && + asciiAlphanumeric(value.charCodeAt(index + 2)) + ) { + skip = 2 + } + // ASCII. + else if (code < 128) { + if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) { + replace = String.fromCharCode(code) + } + } + // Astral. + else if (code > 55_295 && code < 57_344) { + const next = value.charCodeAt(index + 1) + + // A correct surrogate pair. + if (code < 56_320 && next > 56_319 && next < 57_344) { + replace = String.fromCharCode(code, next) + skip = 1 + } + // Lone surrogate. + else { + replace = values.replacementCharacter + } + } + // Unicode. + else { + replace = String.fromCharCode(code) + } + + if (replace) { + result.push(value.slice(start, index), encodeURIComponent(replace)) + start = index + skip + 1 + replace = '' + } + + if (skip) { + index += skip + skip = 0 + } + } + + return result.join('') + value.slice(start) +} diff --git a/tools/ui/node_modules/micromark-util-sanitize-uri/index.d.ts b/tools/ui/node_modules/micromark-util-sanitize-uri/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a105f230e852e42911bb97b513b8bc8c76b417e9 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-sanitize-uri/index.d.ts @@ -0,0 +1,36 @@ +/** + * Make a value safe for injection as a URL. + * + * This encodes unsafe characters with percent-encoding and skips already + * encoded sequences (see `normalizeUri`). + * Further unsafe characters are encoded as character references (see + * `micromark-util-encode`). + * + * A regex of allowed protocols can be given, in which case the URL is + * sanitized. + * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or + * `/^https?$/i` for `img[src]` (this is what `github.com` allows). + * If the URL includes an unknown protocol (one not matched by `protocol`, such + * as a dangerous example, `javascript:`), the value is ignored. + * + * @param {string | null | undefined} url + * URI to sanitize. + * @param {RegExp | null | undefined} [protocol] + * Allowed protocols. + * @returns {string} + * Sanitized URI. + */ +export function sanitizeUri(url: string | null | undefined, protocol?: RegExp | null | undefined): string; +/** + * Normalize a URL. + * + * Encode unsafe characters with percent-encoding, skipping already encoded + * sequences. + * + * @param {string} value + * URI to normalize. + * @returns {string} + * Normalized URI. + */ +export function normalizeUri(value: string): string; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-sanitize-uri/index.d.ts.map b/tools/ui/node_modules/micromark-util-sanitize-uri/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..cab948352403dc772814bc9245e78a475a8900a6 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-sanitize-uri/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,iCAPW,MAAM,GAAG,IAAI,GAAG,SAAS,aAEzB,MAAM,GAAG,IAAI,GAAG,SAAS,GAEvB,MAAM,CA6BlB;AAED;;;;;;;;;;GAUG;AACH,oCALW,MAAM,GAEJ,MAAM,CA6DlB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-sanitize-uri/index.js b/tools/ui/node_modules/micromark-util-sanitize-uri/index.js new file mode 100644 index 0000000000000000000000000000000000000000..fb6fe6fbb8255297c7be9d3850ff945b151a2732 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-sanitize-uri/index.js @@ -0,0 +1,107 @@ +import { asciiAlphanumeric } from 'micromark-util-character'; +import { encode } from 'micromark-util-encode'; +/** + * Make a value safe for injection as a URL. + * + * This encodes unsafe characters with percent-encoding and skips already + * encoded sequences (see `normalizeUri`). + * Further unsafe characters are encoded as character references (see + * `micromark-util-encode`). + * + * A regex of allowed protocols can be given, in which case the URL is + * sanitized. + * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or + * `/^https?$/i` for `img[src]` (this is what `github.com` allows). + * If the URL includes an unknown protocol (one not matched by `protocol`, such + * as a dangerous example, `javascript:`), the value is ignored. + * + * @param {string | null | undefined} url + * URI to sanitize. + * @param {RegExp | null | undefined} [protocol] + * Allowed protocols. + * @returns {string} + * Sanitized URI. + */ +export function sanitizeUri(url, protocol) { + const value = encode(normalizeUri(url || '')); + if (!protocol) { + return value; + } + const colon = value.indexOf(':'); + const questionMark = value.indexOf('?'); + const numberSign = value.indexOf('#'); + const slash = value.indexOf('/'); + if ( + // If there is no protocol, it’s relative. + colon < 0 || + // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol. + slash > -1 && colon > slash || questionMark > -1 && colon > questionMark || numberSign > -1 && colon > numberSign || + // It is a protocol, it should be allowed. + protocol.test(value.slice(0, colon))) { + return value; + } + return ''; +} + +/** + * Normalize a URL. + * + * Encode unsafe characters with percent-encoding, skipping already encoded + * sequences. + * + * @param {string} value + * URI to normalize. + * @returns {string} + * Normalized URI. + */ +export function normalizeUri(value) { + /** @type {Array<string>} */ + const result = []; + let index = -1; + let start = 0; + let skip = 0; + while (++index < value.length) { + const code = value.charCodeAt(index); + /** @type {string} */ + let replace = ''; + + // A correct percent encoded value. + if (code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) { + skip = 2; + } + // ASCII. + else if (code < 128) { + if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) { + replace = String.fromCharCode(code); + } + } + // Astral. + else if (code > 55_295 && code < 57_344) { + const next = value.charCodeAt(index + 1); + + // A correct surrogate pair. + if (code < 56_320 && next > 56_319 && next < 57_344) { + replace = String.fromCharCode(code, next); + skip = 1; + } + // Lone surrogate. + else { + replace = "\uFFFD"; + } + } + // Unicode. + else { + replace = String.fromCharCode(code); + } + if (replace) { + result.push(value.slice(start, index), encodeURIComponent(replace)); + start = index + skip + 1; + replace = ''; + } + if (skip) { + index += skip; + skip = 0; + } + } + return result.join('') + value.slice(start); +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-sanitize-uri/license b/tools/ui/node_modules/micromark-util-sanitize-uri/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-sanitize-uri/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-sanitize-uri/package.json b/tools/ui/node_modules/micromark-util-sanitize-uri/package.json new file mode 100644 index 0000000000000000000000000000000000000000..068ecbc7a4f7ae06c0f6d1ce78dcdfab1a0a4e99 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-sanitize-uri/package.json @@ -0,0 +1,59 @@ +{ + "name": "micromark-util-sanitize-uri", + "version": "2.0.1", + "description": "micromark utility to sanitize urls", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "sanitize", + "clear", + "url" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-sanitize-uri", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-sanitize-uri/readme.md b/tools/ui/node_modules/micromark-util-sanitize-uri/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..2d08fc51fbca8f6a9d438c6d25625748b137121d --- /dev/null +++ b/tools/ui/node_modules/micromark-util-sanitize-uri/readme.md @@ -0,0 +1,214 @@ +# micromark-util-sanitize-uri + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to sanitize urls. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`normalizeUri(value)`](#normalizeurivalue) + * [`sanitizeUri(url[, pattern])`](#sanitizeuriurl-pattern) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes an algorithm to make URLs safe. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-sanitize-uri +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {sanitizeUri} from 'https://esm.sh/micromark-util-sanitize-uri@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {sanitizeUri} from 'https://esm.sh/micromark-util-sanitize-uri@1?bundle' +</script> +``` + +## Use + +```js +import {sanitizeUri} from 'micromark-util-sanitize-uri' + +sanitizeUri('https://example.com/a&amp;b') // 'https://example.com/a&amp;amp;b' +sanitizeUri('https://example.com/a%b') // 'https://example.com/a%25b' +sanitizeUri('https://example.com/a%20b') // 'https://example.com/a%20b' +sanitizeUri('https://example.com/👍') // 'https://example.com/%F0%9F%91%8D' +sanitizeUri('https://example.com/', /^https?$/i) // 'https://example.com/' +sanitizeUri('javascript:alert(1)', /^https?$/i) // '' +sanitizeUri('./example.jpg', /^https?$/i) // './example.jpg' +sanitizeUri('#a', /^https?$/i) // '#a' +``` + +## API + +This module exports the identifiers [`normalizeUri`][api-normalize-uri] and +[`sanitizeUri`][api-sanitize-uri]. +There is no default export. + +### `normalizeUri(value)` + +Normalize a URL. + +Encode unsafe characters with percent-encoding, skipping already encoded +sequences. + +###### Parameters + +* `value` (`string`) + — URI to normalize + +###### Returns + +Normalized URI (`string`). + +### `sanitizeUri(url[, pattern])` + +Make a value safe for injection as a URL. + +This encodes unsafe characters with percent-encoding and skips already +encoded sequences (see [`normalizeUri`][api-normalize-uri]). +Further unsafe characters are encoded as character references (see +[`micromark-util-encode`][micromark-util-encode]). + +A regex of allowed protocols can be given, in which case the URL is sanitized. +For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or +`/^https?$/i` for `img[src]` (this is what `github.com` allows). +If the URL includes an unknown protocol (one not matched by `protocol`, such +as a dangerous example, `javascript:`), the value is ignored. + +###### Parameters + +* `url` (`string`) + — URI to sanitize +* `pattern` (`RegExp`, optional) + — allowed protocols + +###### Returns + +Sanitized URI (`string`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-sanitize-uri@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-sanitize-uri.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-sanitize-uri + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-sanitize-uri + +[bundle-size]: https://bundlejs.com/?q=micromark-util-sanitize-uri + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[micromark-util-encode]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-encode + +[api-normalize-uri]: #normalizeurivalue + +[api-sanitize-uri]: #sanitizeuriurl-pattern diff --git a/tools/ui/node_modules/micromark-util-subtokenize/dev/index.d.ts b/tools/ui/node_modules/micromark-util-subtokenize/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b252238a8812436614faf4342253cc45cc7f3c15 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/dev/index.d.ts @@ -0,0 +1,12 @@ +/** + * Tokenize subcontent. + * + * @param {Array<Event>} eventsArray + * List of events. + * @returns {boolean} + * Whether subtokens were found. + */ +export function subtokenize(eventsArray: Array<Event>): boolean; +export { SpliceBuffer } from "./lib/splice-buffer.js"; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/dev/index.d.ts.map b/tools/ui/node_modules/micromark-util-subtokenize/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e0a024dcaee6e504fa0922fd6470c26eecf59a75 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AAEH,yCANW,KAAK,CAAC,KAAK,CAAC,GAEV,OAAO,CAuHnB;;2BAvIqC,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/dev/index.js b/tools/ui/node_modules/micromark-util-subtokenize/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..986ff0a3e493aa0b48b742aa1202499ba2298236 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/dev/index.js @@ -0,0 +1,284 @@ +/** + * @import {Chunk, Event, Token} from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {splice} from 'micromark-util-chunked' +import {codes, types} from 'micromark-util-symbol' +import {SpliceBuffer} from './lib/splice-buffer.js' + +// Hidden API exposed for testing. +export {SpliceBuffer} from './lib/splice-buffer.js' + +/** + * Tokenize subcontent. + * + * @param {Array<Event>} eventsArray + * List of events. + * @returns {boolean} + * Whether subtokens were found. + */ +// eslint-disable-next-line complexity +export function subtokenize(eventsArray) { + /** @type {Record<string, number>} */ + const jumps = {} + let index = -1 + /** @type {Event} */ + let event + /** @type {number | undefined} */ + let lineIndex + /** @type {number} */ + let otherIndex + /** @type {Event} */ + let otherEvent + /** @type {Array<Event>} */ + let parameters + /** @type {Array<Event>} */ + let subevents + /** @type {boolean | undefined} */ + let more + const events = new SpliceBuffer(eventsArray) + + while (++index < events.length) { + while (index in jumps) { + index = jumps[index] + } + + event = events.get(index) + + // Add a hook for the GFM tasklist extension, which needs to know if text + // is in the first content of a list item. + if ( + index && + event[1].type === types.chunkFlow && + events.get(index - 1)[1].type === types.listItemPrefix + ) { + assert(event[1]._tokenizer, 'expected `_tokenizer` on subtokens') + subevents = event[1]._tokenizer.events + otherIndex = 0 + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === types.lineEndingBlank + ) { + otherIndex += 2 + } + + if ( + otherIndex < subevents.length && + subevents[otherIndex][1].type === types.content + ) { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === types.content) { + break + } + + if (subevents[otherIndex][1].type === types.chunkText) { + subevents[otherIndex][1]._isInFirstContentOfListItem = true + otherIndex++ + } + } + } + } + + // Enter. + if (event[0] === 'enter') { + if (event[1].contentType) { + Object.assign(jumps, subcontent(events, index)) + index = jumps[index] + more = true + } + } + // Exit. + else if (event[1]._container) { + otherIndex = index + lineIndex = undefined + + while (otherIndex--) { + otherEvent = events.get(otherIndex) + + if ( + otherEvent[1].type === types.lineEnding || + otherEvent[1].type === types.lineEndingBlank + ) { + if (otherEvent[0] === 'enter') { + if (lineIndex) { + events.get(lineIndex)[1].type = types.lineEndingBlank + } + + otherEvent[1].type = types.lineEnding + lineIndex = otherIndex + } + } else if ( + otherEvent[1].type === types.linePrefix || + otherEvent[1].type === types.listItemIndent + ) { + // Move past. + } else { + break + } + } + + if (lineIndex) { + // Fix position. + event[1].end = {...events.get(lineIndex)[1].start} + + // Switch container exit w/ line endings. + parameters = events.slice(lineIndex, index) + parameters.unshift(event) + events.splice(lineIndex, index - lineIndex + 1, parameters) + } + } + } + + // The changes to the `events` buffer must be copied back into the eventsArray + splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0)) + return !more +} + +/** + * Tokenize embedded tokens. + * + * @param {SpliceBuffer<Event>} events + * Events. + * @param {number} eventIndex + * Index. + * @returns {Record<string, number>} + * Gaps. + */ +function subcontent(events, eventIndex) { + const token = events.get(eventIndex)[1] + const context = events.get(eventIndex)[2] + let startPosition = eventIndex - 1 + /** @type {Array<number>} */ + const startPositions = [] + assert(token.contentType, 'expected `contentType` on subtokens') + + let tokenizer = token._tokenizer + + if (!tokenizer) { + tokenizer = context.parser[token.contentType](token.start) + + if (token._contentTypeTextTrailing) { + tokenizer._contentTypeTextTrailing = true + } + } + + const childEvents = tokenizer.events + /** @type {Array<[number, number]>} */ + const jumps = [] + /** @type {Record<string, number>} */ + const gaps = {} + /** @type {Array<Chunk>} */ + let stream + /** @type {Token | undefined} */ + let previous + let index = -1 + /** @type {Token | undefined} */ + let current = token + let adjust = 0 + let start = 0 + const breaks = [start] + + // Loop forward through the linked tokens to pass them in order to the + // subtokenizer. + while (current) { + // Find the position of the event for this token. + while (events.get(++startPosition)[1] !== current) { + // Empty. + } + + assert( + !previous || current.previous === previous, + 'expected previous to match' + ) + assert(!previous || previous.next === current, 'expected next to match') + + startPositions.push(startPosition) + + if (!current._tokenizer) { + stream = context.sliceStream(current) + + if (!current.next) { + stream.push(codes.eof) + } + + if (previous) { + tokenizer.defineSkip(current.start) + } + + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true + } + + tokenizer.write(stream) + + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = undefined + } + } + + // Unravel the next token. + previous = current + current = current.next + } + + // Now, loop back through all events (and linked tokens), to figure out which + // parts belong where. + current = token + + while (++index < childEvents.length) { + if ( + // Find a void token that includes a break. + childEvents[index][0] === 'exit' && + childEvents[index - 1][0] === 'enter' && + childEvents[index][1].type === childEvents[index - 1][1].type && + childEvents[index][1].start.line !== childEvents[index][1].end.line + ) { + assert(current, 'expected a current token') + start = index + 1 + breaks.push(start) + // Help GC. + current._tokenizer = undefined + current.previous = undefined + current = current.next + } + } + + // Help GC. + tokenizer.events = [] + + // If there’s one more token (which is the cases for lines that end in an + // EOF), that’s perfect: the last point we found starts it. + // If there isn’t then make sure any remaining content is added to it. + if (current) { + // Help GC. + current._tokenizer = undefined + current.previous = undefined + assert(!current.next, 'expected no next token') + } else { + breaks.pop() + } + + // Now splice the events from the subtokenizer into the current events, + // moving back to front so that splice indices aren’t affected. + index = breaks.length + + while (index--) { + const slice = childEvents.slice(breaks[index], breaks[index + 1]) + const start = startPositions.pop() + assert(start !== undefined, 'expected a start position when splicing') + jumps.push([start, start + slice.length - 1]) + events.splice(start, 2, slice) + } + + jumps.reverse() + index = -1 + + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1] + adjust += jumps[index][1] - jumps[index][0] - 1 + } + + return gaps +} diff --git a/tools/ui/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts b/tools/ui/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e65b62385ad9dfc053775dd90b593528f017523 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts @@ -0,0 +1,161 @@ +/** + * Some of the internal operations of micromark do lots of editing + * operations on very large arrays. This runs into problems with two + * properties of most circa-2020 JavaScript interpreters: + * + * - Array-length modifications at the high end of an array (push/pop) are + * expected to be common and are implemented in (amortized) time + * proportional to the number of elements added or removed, whereas + * other operations (shift/unshift and splice) are much less efficient. + * - Function arguments are passed on the stack, so adding tens of thousands + * of elements to an array with `arr.push(...newElements)` will frequently + * cause stack overflows. (see <https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why>) + * + * SpliceBuffers are an implementation of gap buffers, which are a + * generalization of the "queue made of two stacks" idea. The splice buffer + * maintains a cursor, and moving the cursor has cost proportional to the + * distance the cursor moves, but inserting, deleting, or splicing in + * new information at the cursor is as efficient as the push/pop operation. + * This allows for an efficient sequence of splices (or pushes, pops, shifts, + * or unshifts) as long such edits happen at the same part of the array or + * generally sweep through the array from the beginning to the end. + * + * The interface for splice buffers also supports large numbers of inputs by + * passing a single array argument rather passing multiple arguments on the + * function call stack. + * + * @template T + * Item type. + */ +export class SpliceBuffer<T> { + /** + * @param {ReadonlyArray<T> | null | undefined} [initial] + * Initial items (optional). + * @returns + * Splice buffer. + */ + constructor(initial?: ReadonlyArray<T> | null | undefined); + /** @type {Array<T>} */ + left: Array<T>; + /** @type {Array<T>} */ + right: Array<T>; + /** + * Array access; + * does not move the cursor. + * + * @param {number} index + * Index. + * @return {T} + * Item. + */ + get(index: number): T; + /** + * The length of the splice buffer, one greater than the largest index in the + * array. + */ + get length(): number; + /** + * Remove and return `list[0]`; + * moves the cursor to `0`. + * + * @returns {T | undefined} + * Item, optional. + */ + shift(): T | undefined; + /** + * Slice the buffer to get an array; + * does not move the cursor. + * + * @param {number} start + * Start. + * @param {number | null | undefined} [end] + * End (optional). + * @returns {Array<T>} + * Array of items. + */ + slice(start: number, end?: number | null | undefined): Array<T>; + /** + * Mimics the behavior of Array.prototype.splice() except for the change of + * interface necessary to avoid segfaults when patching in very large arrays. + * + * This operation moves cursor is moved to `start` and results in the cursor + * placed after any inserted items. + * + * @param {number} start + * Start; + * zero-based index at which to start changing the array; + * negative numbers count backwards from the end of the array and values + * that are out-of bounds are clamped to the appropriate end of the array. + * @param {number | null | undefined} [deleteCount=0] + * Delete count (default: `0`); + * maximum number of elements to delete, starting from start. + * @param {Array<T> | null | undefined} [items=[]] + * Items to include in place of the deleted items (default: `[]`). + * @return {Array<T>} + * Any removed items. + */ + splice(start: number, deleteCount?: number | null | undefined, items?: Array<T> | null | undefined): Array<T>; + /** + * Remove and return the highest-numbered item in the array, so + * `list[list.length - 1]`; + * Moves the cursor to `length`. + * + * @returns {T | undefined} + * Item, optional. + */ + pop(): T | undefined; + /** + * Inserts a single item to the high-numbered side of the array; + * moves the cursor to `length`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + push(item: T): undefined; + /** + * Inserts many items to the high-numbered side of the array. + * Moves the cursor to `length`. + * + * @param {Array<T>} items + * Items. + * @returns {undefined} + * Nothing. + */ + pushMany(items: Array<T>): undefined; + /** + * Inserts a single item to the low-numbered side of the array; + * Moves the cursor to `0`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + unshift(item: T): undefined; + /** + * Inserts many items to the low-numbered side of the array; + * moves the cursor to `0`. + * + * @param {Array<T>} items + * Items. + * @returns {undefined} + * Nothing. + */ + unshiftMany(items: Array<T>): undefined; + /** + * Move the cursor to a specific position in the array. Requires + * time proportional to the distance moved. + * + * If `n < 0`, the cursor will end up at the beginning. + * If `n > length`, the cursor will end up at the end. + * + * @param {number} n + * Position. + * @return {undefined} + * Nothing. + */ + setCursor(n: number): undefined; +} +//# sourceMappingURL=splice-buffer.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts.map b/tools/ui/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..438ca1c82c6eaa9c7ea78699198d41066fd60c46 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"splice-buffer.d.ts","sourceRoot":"","sources":["splice-buffer.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,0BAHa,CAAC;IAIZ;;;;;OAKG;IACH,sBALW,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAU7C;IAJC,uBAAuB;IACvB,MADW,KAAK,CAAC,CAAC,CAAC,CACoB;IACvC,uBAAuB;IACvB,OADW,KAAK,CAAC,CAAC,CAAC,CACJ;IAGjB;;;;;;;;OAQG;IACH,WALW,MAAM,GAEL,CAAC,CAgBZ;IAED;;;OAGG;IACH,qBAEC;IAED;;;;;;OAMG;IACH,SAHa,CAAC,GAAG,SAAS,CAMzB;IAED;;;;;;;;;;OAUG;IACH,aAPW,MAAM,QAEN,MAAM,GAAG,IAAI,GAAG,SAAS,GAEvB,KAAK,CAAC,CAAC,CAAC,CA0BpB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAbW,MAAM,gBAKN,MAAM,GAAG,IAAI,GAAG,SAAS,UAGzB,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAE1B,KAAK,CAAC,CAAC,CAAC,CAcnB;IAED;;;;;;;OAOG;IACH,OAHa,CAAC,GAAG,SAAS,CAMzB;IAED;;;;;;;;OAQG;IACH,WALW,CAAC,GAEC,SAAS,CAMrB;IAED;;;;;;;;OAQG;IACH,gBALW,KAAK,CAAC,CAAC,CAAC,GAEN,SAAS,CAMrB;IAED;;;;;;;;OAQG;IACH,cALW,CAAC,GAEC,SAAS,CAMrB;IAED;;;;;;;;OAQG;IACH,mBALW,KAAK,CAAC,CAAC,CAAC,GAEN,SAAS,CAMrB;IAED;;;;;;;;;;;OAWG;IACH,aALW,MAAM,GAEL,SAAS,CAsBpB;CACF"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.js b/tools/ui/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.js new file mode 100644 index 0000000000000000000000000000000000000000..371a9227e22a345a276cd216101bab7b33b416f8 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/dev/lib/splice-buffer.js @@ -0,0 +1,288 @@ +import {constants} from 'micromark-util-symbol' + +/** + * Some of the internal operations of micromark do lots of editing + * operations on very large arrays. This runs into problems with two + * properties of most circa-2020 JavaScript interpreters: + * + * - Array-length modifications at the high end of an array (push/pop) are + * expected to be common and are implemented in (amortized) time + * proportional to the number of elements added or removed, whereas + * other operations (shift/unshift and splice) are much less efficient. + * - Function arguments are passed on the stack, so adding tens of thousands + * of elements to an array with `arr.push(...newElements)` will frequently + * cause stack overflows. (see <https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why>) + * + * SpliceBuffers are an implementation of gap buffers, which are a + * generalization of the "queue made of two stacks" idea. The splice buffer + * maintains a cursor, and moving the cursor has cost proportional to the + * distance the cursor moves, but inserting, deleting, or splicing in + * new information at the cursor is as efficient as the push/pop operation. + * This allows for an efficient sequence of splices (or pushes, pops, shifts, + * or unshifts) as long such edits happen at the same part of the array or + * generally sweep through the array from the beginning to the end. + * + * The interface for splice buffers also supports large numbers of inputs by + * passing a single array argument rather passing multiple arguments on the + * function call stack. + * + * @template T + * Item type. + */ +export class SpliceBuffer { + /** + * @param {ReadonlyArray<T> | null | undefined} [initial] + * Initial items (optional). + * @returns + * Splice buffer. + */ + constructor(initial) { + /** @type {Array<T>} */ + this.left = initial ? [...initial] : [] + /** @type {Array<T>} */ + this.right = [] + } + + /** + * Array access; + * does not move the cursor. + * + * @param {number} index + * Index. + * @return {T} + * Item. + */ + get(index) { + if (index < 0 || index >= this.left.length + this.right.length) { + throw new RangeError( + 'Cannot access index `' + + index + + '` in a splice buffer of size `' + + (this.left.length + this.right.length) + + '`' + ) + } + + if (index < this.left.length) return this.left[index] + return this.right[this.right.length - index + this.left.length - 1] + } + + /** + * The length of the splice buffer, one greater than the largest index in the + * array. + */ + get length() { + return this.left.length + this.right.length + } + + /** + * Remove and return `list[0]`; + * moves the cursor to `0`. + * + * @returns {T | undefined} + * Item, optional. + */ + shift() { + this.setCursor(0) + return this.right.pop() + } + + /** + * Slice the buffer to get an array; + * does not move the cursor. + * + * @param {number} start + * Start. + * @param {number | null | undefined} [end] + * End (optional). + * @returns {Array<T>} + * Array of items. + */ + slice(start, end) { + /** @type {number} */ + const stop = + end === null || end === undefined ? Number.POSITIVE_INFINITY : end + + if (stop < this.left.length) { + return this.left.slice(start, stop) + } + + if (start > this.left.length) { + return this.right + .slice( + this.right.length - stop + this.left.length, + this.right.length - start + this.left.length + ) + .reverse() + } + + return this.left + .slice(start) + .concat( + this.right.slice(this.right.length - stop + this.left.length).reverse() + ) + } + + /** + * Mimics the behavior of Array.prototype.splice() except for the change of + * interface necessary to avoid segfaults when patching in very large arrays. + * + * This operation moves cursor is moved to `start` and results in the cursor + * placed after any inserted items. + * + * @param {number} start + * Start; + * zero-based index at which to start changing the array; + * negative numbers count backwards from the end of the array and values + * that are out-of bounds are clamped to the appropriate end of the array. + * @param {number | null | undefined} [deleteCount=0] + * Delete count (default: `0`); + * maximum number of elements to delete, starting from start. + * @param {Array<T> | null | undefined} [items=[]] + * Items to include in place of the deleted items (default: `[]`). + * @return {Array<T>} + * Any removed items. + */ + splice(start, deleteCount, items) { + /** @type {number} */ + const count = deleteCount || 0 + + this.setCursor(Math.trunc(start)) + const removed = this.right.splice( + this.right.length - count, + Number.POSITIVE_INFINITY + ) + if (items) chunkedPush(this.left, items) + return removed.reverse() + } + + /** + * Remove and return the highest-numbered item in the array, so + * `list[list.length - 1]`; + * Moves the cursor to `length`. + * + * @returns {T | undefined} + * Item, optional. + */ + pop() { + this.setCursor(Number.POSITIVE_INFINITY) + return this.left.pop() + } + + /** + * Inserts a single item to the high-numbered side of the array; + * moves the cursor to `length`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + push(item) { + this.setCursor(Number.POSITIVE_INFINITY) + this.left.push(item) + } + + /** + * Inserts many items to the high-numbered side of the array. + * Moves the cursor to `length`. + * + * @param {Array<T>} items + * Items. + * @returns {undefined} + * Nothing. + */ + pushMany(items) { + this.setCursor(Number.POSITIVE_INFINITY) + chunkedPush(this.left, items) + } + + /** + * Inserts a single item to the low-numbered side of the array; + * Moves the cursor to `0`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + unshift(item) { + this.setCursor(0) + this.right.push(item) + } + + /** + * Inserts many items to the low-numbered side of the array; + * moves the cursor to `0`. + * + * @param {Array<T>} items + * Items. + * @returns {undefined} + * Nothing. + */ + unshiftMany(items) { + this.setCursor(0) + chunkedPush(this.right, items.reverse()) + } + + /** + * Move the cursor to a specific position in the array. Requires + * time proportional to the distance moved. + * + * If `n < 0`, the cursor will end up at the beginning. + * If `n > length`, the cursor will end up at the end. + * + * @param {number} n + * Position. + * @return {undefined} + * Nothing. + */ + setCursor(n) { + if ( + n === this.left.length || + (n > this.left.length && this.right.length === 0) || + (n < 0 && this.left.length === 0) + ) + return + if (n < this.left.length) { + // Move cursor to the this.left + const removed = this.left.splice(n, Number.POSITIVE_INFINITY) + chunkedPush(this.right, removed.reverse()) + } else { + // Move cursor to the this.right + const removed = this.right.splice( + this.left.length + this.right.length - n, + Number.POSITIVE_INFINITY + ) + chunkedPush(this.left, removed.reverse()) + } + } +} + +/** + * Avoid stack overflow by pushing items onto the stack in segments + * + * @template T + * Item type. + * @param {Array<T>} list + * List to inject into. + * @param {ReadonlyArray<T>} right + * Items to inject. + * @return {undefined} + * Nothing. + */ +function chunkedPush(list, right) { + /** @type {number} */ + let chunkStart = 0 + + if (right.length < constants.v8MaxSafeChunkSize) { + list.push(...right) + } else { + while (chunkStart < right.length) { + list.push( + ...right.slice(chunkStart, chunkStart + constants.v8MaxSafeChunkSize) + ) + chunkStart += constants.v8MaxSafeChunkSize + } + } +} diff --git a/tools/ui/node_modules/micromark-util-subtokenize/index.d.ts b/tools/ui/node_modules/micromark-util-subtokenize/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b252238a8812436614faf4342253cc45cc7f3c15 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/index.d.ts @@ -0,0 +1,12 @@ +/** + * Tokenize subcontent. + * + * @param {Array<Event>} eventsArray + * List of events. + * @returns {boolean} + * Whether subtokens were found. + */ +export function subtokenize(eventsArray: Array<Event>): boolean; +export { SpliceBuffer } from "./lib/splice-buffer.js"; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/index.d.ts.map b/tools/ui/node_modules/micromark-util-subtokenize/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e0a024dcaee6e504fa0922fd6470c26eecf59a75 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AAEH,yCANW,KAAK,CAAC,KAAK,CAAC,GAEV,OAAO,CAuHnB;;2BAvIqC,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/index.js b/tools/ui/node_modules/micromark-util-subtokenize/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f046dc30416d45494071dc5d1a75faa9982e1c58 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/index.js @@ -0,0 +1,228 @@ +/** + * @import {Chunk, Event, Token} from 'micromark-util-types' + */ + +import { splice } from 'micromark-util-chunked'; +import { SpliceBuffer } from './lib/splice-buffer.js'; + +// Hidden API exposed for testing. +export { SpliceBuffer } from './lib/splice-buffer.js'; + +/** + * Tokenize subcontent. + * + * @param {Array<Event>} eventsArray + * List of events. + * @returns {boolean} + * Whether subtokens were found. + */ +// eslint-disable-next-line complexity +export function subtokenize(eventsArray) { + /** @type {Record<string, number>} */ + const jumps = {}; + let index = -1; + /** @type {Event} */ + let event; + /** @type {number | undefined} */ + let lineIndex; + /** @type {number} */ + let otherIndex; + /** @type {Event} */ + let otherEvent; + /** @type {Array<Event>} */ + let parameters; + /** @type {Array<Event>} */ + let subevents; + /** @type {boolean | undefined} */ + let more; + const events = new SpliceBuffer(eventsArray); + while (++index < events.length) { + while (index in jumps) { + index = jumps[index]; + } + event = events.get(index); + + // Add a hook for the GFM tasklist extension, which needs to know if text + // is in the first content of a list item. + if (index && event[1].type === "chunkFlow" && events.get(index - 1)[1].type === "listItemPrefix") { + subevents = event[1]._tokenizer.events; + otherIndex = 0; + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") { + otherIndex += 2; + } + if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") { + while (++otherIndex < subevents.length) { + if (subevents[otherIndex][1].type === "content") { + break; + } + if (subevents[otherIndex][1].type === "chunkText") { + subevents[otherIndex][1]._isInFirstContentOfListItem = true; + otherIndex++; + } + } + } + } + + // Enter. + if (event[0] === 'enter') { + if (event[1].contentType) { + Object.assign(jumps, subcontent(events, index)); + index = jumps[index]; + more = true; + } + } + // Exit. + else if (event[1]._container) { + otherIndex = index; + lineIndex = undefined; + while (otherIndex--) { + otherEvent = events.get(otherIndex); + if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") { + if (otherEvent[0] === 'enter') { + if (lineIndex) { + events.get(lineIndex)[1].type = "lineEndingBlank"; + } + otherEvent[1].type = "lineEnding"; + lineIndex = otherIndex; + } + } else if (otherEvent[1].type === "linePrefix" || otherEvent[1].type === "listItemIndent") { + // Move past. + } else { + break; + } + } + if (lineIndex) { + // Fix position. + event[1].end = { + ...events.get(lineIndex)[1].start + }; + + // Switch container exit w/ line endings. + parameters = events.slice(lineIndex, index); + parameters.unshift(event); + events.splice(lineIndex, index - lineIndex + 1, parameters); + } + } + } + + // The changes to the `events` buffer must be copied back into the eventsArray + splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0)); + return !more; +} + +/** + * Tokenize embedded tokens. + * + * @param {SpliceBuffer<Event>} events + * Events. + * @param {number} eventIndex + * Index. + * @returns {Record<string, number>} + * Gaps. + */ +function subcontent(events, eventIndex) { + const token = events.get(eventIndex)[1]; + const context = events.get(eventIndex)[2]; + let startPosition = eventIndex - 1; + /** @type {Array<number>} */ + const startPositions = []; + let tokenizer = token._tokenizer; + if (!tokenizer) { + tokenizer = context.parser[token.contentType](token.start); + if (token._contentTypeTextTrailing) { + tokenizer._contentTypeTextTrailing = true; + } + } + const childEvents = tokenizer.events; + /** @type {Array<[number, number]>} */ + const jumps = []; + /** @type {Record<string, number>} */ + const gaps = {}; + /** @type {Array<Chunk>} */ + let stream; + /** @type {Token | undefined} */ + let previous; + let index = -1; + /** @type {Token | undefined} */ + let current = token; + let adjust = 0; + let start = 0; + const breaks = [start]; + + // Loop forward through the linked tokens to pass them in order to the + // subtokenizer. + while (current) { + // Find the position of the event for this token. + while (events.get(++startPosition)[1] !== current) { + // Empty. + } + startPositions.push(startPosition); + if (!current._tokenizer) { + stream = context.sliceStream(current); + if (!current.next) { + stream.push(null); + } + if (previous) { + tokenizer.defineSkip(current.start); + } + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = true; + } + tokenizer.write(stream); + if (current._isInFirstContentOfListItem) { + tokenizer._gfmTasklistFirstContentOfListItem = undefined; + } + } + + // Unravel the next token. + previous = current; + current = current.next; + } + + // Now, loop back through all events (and linked tokens), to figure out which + // parts belong where. + current = token; + while (++index < childEvents.length) { + if ( + // Find a void token that includes a break. + childEvents[index][0] === 'exit' && childEvents[index - 1][0] === 'enter' && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) { + start = index + 1; + breaks.push(start); + // Help GC. + current._tokenizer = undefined; + current.previous = undefined; + current = current.next; + } + } + + // Help GC. + tokenizer.events = []; + + // If there’s one more token (which is the cases for lines that end in an + // EOF), that’s perfect: the last point we found starts it. + // If there isn’t then make sure any remaining content is added to it. + if (current) { + // Help GC. + current._tokenizer = undefined; + current.previous = undefined; + } else { + breaks.pop(); + } + + // Now splice the events from the subtokenizer into the current events, + // moving back to front so that splice indices aren’t affected. + index = breaks.length; + while (index--) { + const slice = childEvents.slice(breaks[index], breaks[index + 1]); + const start = startPositions.pop(); + jumps.push([start, start + slice.length - 1]); + events.splice(start, 2, slice); + } + jumps.reverse(); + index = -1; + while (++index < jumps.length) { + gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; + adjust += jumps[index][1] - jumps[index][0] - 1; + } + return gaps; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts b/tools/ui/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e65b62385ad9dfc053775dd90b593528f017523 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts @@ -0,0 +1,161 @@ +/** + * Some of the internal operations of micromark do lots of editing + * operations on very large arrays. This runs into problems with two + * properties of most circa-2020 JavaScript interpreters: + * + * - Array-length modifications at the high end of an array (push/pop) are + * expected to be common and are implemented in (amortized) time + * proportional to the number of elements added or removed, whereas + * other operations (shift/unshift and splice) are much less efficient. + * - Function arguments are passed on the stack, so adding tens of thousands + * of elements to an array with `arr.push(...newElements)` will frequently + * cause stack overflows. (see <https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why>) + * + * SpliceBuffers are an implementation of gap buffers, which are a + * generalization of the "queue made of two stacks" idea. The splice buffer + * maintains a cursor, and moving the cursor has cost proportional to the + * distance the cursor moves, but inserting, deleting, or splicing in + * new information at the cursor is as efficient as the push/pop operation. + * This allows for an efficient sequence of splices (or pushes, pops, shifts, + * or unshifts) as long such edits happen at the same part of the array or + * generally sweep through the array from the beginning to the end. + * + * The interface for splice buffers also supports large numbers of inputs by + * passing a single array argument rather passing multiple arguments on the + * function call stack. + * + * @template T + * Item type. + */ +export class SpliceBuffer<T> { + /** + * @param {ReadonlyArray<T> | null | undefined} [initial] + * Initial items (optional). + * @returns + * Splice buffer. + */ + constructor(initial?: ReadonlyArray<T> | null | undefined); + /** @type {Array<T>} */ + left: Array<T>; + /** @type {Array<T>} */ + right: Array<T>; + /** + * Array access; + * does not move the cursor. + * + * @param {number} index + * Index. + * @return {T} + * Item. + */ + get(index: number): T; + /** + * The length of the splice buffer, one greater than the largest index in the + * array. + */ + get length(): number; + /** + * Remove and return `list[0]`; + * moves the cursor to `0`. + * + * @returns {T | undefined} + * Item, optional. + */ + shift(): T | undefined; + /** + * Slice the buffer to get an array; + * does not move the cursor. + * + * @param {number} start + * Start. + * @param {number | null | undefined} [end] + * End (optional). + * @returns {Array<T>} + * Array of items. + */ + slice(start: number, end?: number | null | undefined): Array<T>; + /** + * Mimics the behavior of Array.prototype.splice() except for the change of + * interface necessary to avoid segfaults when patching in very large arrays. + * + * This operation moves cursor is moved to `start` and results in the cursor + * placed after any inserted items. + * + * @param {number} start + * Start; + * zero-based index at which to start changing the array; + * negative numbers count backwards from the end of the array and values + * that are out-of bounds are clamped to the appropriate end of the array. + * @param {number | null | undefined} [deleteCount=0] + * Delete count (default: `0`); + * maximum number of elements to delete, starting from start. + * @param {Array<T> | null | undefined} [items=[]] + * Items to include in place of the deleted items (default: `[]`). + * @return {Array<T>} + * Any removed items. + */ + splice(start: number, deleteCount?: number | null | undefined, items?: Array<T> | null | undefined): Array<T>; + /** + * Remove and return the highest-numbered item in the array, so + * `list[list.length - 1]`; + * Moves the cursor to `length`. + * + * @returns {T | undefined} + * Item, optional. + */ + pop(): T | undefined; + /** + * Inserts a single item to the high-numbered side of the array; + * moves the cursor to `length`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + push(item: T): undefined; + /** + * Inserts many items to the high-numbered side of the array. + * Moves the cursor to `length`. + * + * @param {Array<T>} items + * Items. + * @returns {undefined} + * Nothing. + */ + pushMany(items: Array<T>): undefined; + /** + * Inserts a single item to the low-numbered side of the array; + * Moves the cursor to `0`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + unshift(item: T): undefined; + /** + * Inserts many items to the low-numbered side of the array; + * moves the cursor to `0`. + * + * @param {Array<T>} items + * Items. + * @returns {undefined} + * Nothing. + */ + unshiftMany(items: Array<T>): undefined; + /** + * Move the cursor to a specific position in the array. Requires + * time proportional to the distance moved. + * + * If `n < 0`, the cursor will end up at the beginning. + * If `n > length`, the cursor will end up at the end. + * + * @param {number} n + * Position. + * @return {undefined} + * Nothing. + */ + setCursor(n: number): undefined; +} +//# sourceMappingURL=splice-buffer.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts.map b/tools/ui/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..438ca1c82c6eaa9c7ea78699198d41066fd60c46 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/lib/splice-buffer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"splice-buffer.d.ts","sourceRoot":"","sources":["splice-buffer.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,0BAHa,CAAC;IAIZ;;;;;OAKG;IACH,sBALW,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAU7C;IAJC,uBAAuB;IACvB,MADW,KAAK,CAAC,CAAC,CAAC,CACoB;IACvC,uBAAuB;IACvB,OADW,KAAK,CAAC,CAAC,CAAC,CACJ;IAGjB;;;;;;;;OAQG;IACH,WALW,MAAM,GAEL,CAAC,CAgBZ;IAED;;;OAGG;IACH,qBAEC;IAED;;;;;;OAMG;IACH,SAHa,CAAC,GAAG,SAAS,CAMzB;IAED;;;;;;;;;;OAUG;IACH,aAPW,MAAM,QAEN,MAAM,GAAG,IAAI,GAAG,SAAS,GAEvB,KAAK,CAAC,CAAC,CAAC,CA0BpB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAbW,MAAM,gBAKN,MAAM,GAAG,IAAI,GAAG,SAAS,UAGzB,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAE1B,KAAK,CAAC,CAAC,CAAC,CAcnB;IAED;;;;;;;OAOG;IACH,OAHa,CAAC,GAAG,SAAS,CAMzB;IAED;;;;;;;;OAQG;IACH,WALW,CAAC,GAEC,SAAS,CAMrB;IAED;;;;;;;;OAQG;IACH,gBALW,KAAK,CAAC,CAAC,CAAC,GAEN,SAAS,CAMrB;IAED;;;;;;;;OAQG;IACH,cALW,CAAC,GAEC,SAAS,CAMrB;IAED;;;;;;;;OAQG;IACH,mBALW,KAAK,CAAC,CAAC,CAAC,GAEN,SAAS,CAMrB;IAED;;;;;;;;;;;OAWG;IACH,aALW,MAAM,GAEL,SAAS,CAsBpB;CACF"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/lib/splice-buffer.js b/tools/ui/node_modules/micromark-util-subtokenize/lib/splice-buffer.js new file mode 100644 index 0000000000000000000000000000000000000000..500e42f63b40d04ca8e5a7a09cb8a5f9e51726ec --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/lib/splice-buffer.js @@ -0,0 +1,251 @@ +/** + * Some of the internal operations of micromark do lots of editing + * operations on very large arrays. This runs into problems with two + * properties of most circa-2020 JavaScript interpreters: + * + * - Array-length modifications at the high end of an array (push/pop) are + * expected to be common and are implemented in (amortized) time + * proportional to the number of elements added or removed, whereas + * other operations (shift/unshift and splice) are much less efficient. + * - Function arguments are passed on the stack, so adding tens of thousands + * of elements to an array with `arr.push(...newElements)` will frequently + * cause stack overflows. (see <https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why>) + * + * SpliceBuffers are an implementation of gap buffers, which are a + * generalization of the "queue made of two stacks" idea. The splice buffer + * maintains a cursor, and moving the cursor has cost proportional to the + * distance the cursor moves, but inserting, deleting, or splicing in + * new information at the cursor is as efficient as the push/pop operation. + * This allows for an efficient sequence of splices (or pushes, pops, shifts, + * or unshifts) as long such edits happen at the same part of the array or + * generally sweep through the array from the beginning to the end. + * + * The interface for splice buffers also supports large numbers of inputs by + * passing a single array argument rather passing multiple arguments on the + * function call stack. + * + * @template T + * Item type. + */ +export class SpliceBuffer { + /** + * @param {ReadonlyArray<T> | null | undefined} [initial] + * Initial items (optional). + * @returns + * Splice buffer. + */ + constructor(initial) { + /** @type {Array<T>} */ + this.left = initial ? [...initial] : []; + /** @type {Array<T>} */ + this.right = []; + } + + /** + * Array access; + * does not move the cursor. + * + * @param {number} index + * Index. + * @return {T} + * Item. + */ + get(index) { + if (index < 0 || index >= this.left.length + this.right.length) { + throw new RangeError('Cannot access index `' + index + '` in a splice buffer of size `' + (this.left.length + this.right.length) + '`'); + } + if (index < this.left.length) return this.left[index]; + return this.right[this.right.length - index + this.left.length - 1]; + } + + /** + * The length of the splice buffer, one greater than the largest index in the + * array. + */ + get length() { + return this.left.length + this.right.length; + } + + /** + * Remove and return `list[0]`; + * moves the cursor to `0`. + * + * @returns {T | undefined} + * Item, optional. + */ + shift() { + this.setCursor(0); + return this.right.pop(); + } + + /** + * Slice the buffer to get an array; + * does not move the cursor. + * + * @param {number} start + * Start. + * @param {number | null | undefined} [end] + * End (optional). + * @returns {Array<T>} + * Array of items. + */ + slice(start, end) { + /** @type {number} */ + const stop = end === null || end === undefined ? Number.POSITIVE_INFINITY : end; + if (stop < this.left.length) { + return this.left.slice(start, stop); + } + if (start > this.left.length) { + return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse(); + } + return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse()); + } + + /** + * Mimics the behavior of Array.prototype.splice() except for the change of + * interface necessary to avoid segfaults when patching in very large arrays. + * + * This operation moves cursor is moved to `start` and results in the cursor + * placed after any inserted items. + * + * @param {number} start + * Start; + * zero-based index at which to start changing the array; + * negative numbers count backwards from the end of the array and values + * that are out-of bounds are clamped to the appropriate end of the array. + * @param {number | null | undefined} [deleteCount=0] + * Delete count (default: `0`); + * maximum number of elements to delete, starting from start. + * @param {Array<T> | null | undefined} [items=[]] + * Items to include in place of the deleted items (default: `[]`). + * @return {Array<T>} + * Any removed items. + */ + splice(start, deleteCount, items) { + /** @type {number} */ + const count = deleteCount || 0; + this.setCursor(Math.trunc(start)); + const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY); + if (items) chunkedPush(this.left, items); + return removed.reverse(); + } + + /** + * Remove and return the highest-numbered item in the array, so + * `list[list.length - 1]`; + * Moves the cursor to `length`. + * + * @returns {T | undefined} + * Item, optional. + */ + pop() { + this.setCursor(Number.POSITIVE_INFINITY); + return this.left.pop(); + } + + /** + * Inserts a single item to the high-numbered side of the array; + * moves the cursor to `length`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + push(item) { + this.setCursor(Number.POSITIVE_INFINITY); + this.left.push(item); + } + + /** + * Inserts many items to the high-numbered side of the array. + * Moves the cursor to `length`. + * + * @param {Array<T>} items + * Items. + * @returns {undefined} + * Nothing. + */ + pushMany(items) { + this.setCursor(Number.POSITIVE_INFINITY); + chunkedPush(this.left, items); + } + + /** + * Inserts a single item to the low-numbered side of the array; + * Moves the cursor to `0`. + * + * @param {T} item + * Item. + * @returns {undefined} + * Nothing. + */ + unshift(item) { + this.setCursor(0); + this.right.push(item); + } + + /** + * Inserts many items to the low-numbered side of the array; + * moves the cursor to `0`. + * + * @param {Array<T>} items + * Items. + * @returns {undefined} + * Nothing. + */ + unshiftMany(items) { + this.setCursor(0); + chunkedPush(this.right, items.reverse()); + } + + /** + * Move the cursor to a specific position in the array. Requires + * time proportional to the distance moved. + * + * If `n < 0`, the cursor will end up at the beginning. + * If `n > length`, the cursor will end up at the end. + * + * @param {number} n + * Position. + * @return {undefined} + * Nothing. + */ + setCursor(n) { + if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0) return; + if (n < this.left.length) { + // Move cursor to the this.left + const removed = this.left.splice(n, Number.POSITIVE_INFINITY); + chunkedPush(this.right, removed.reverse()); + } else { + // Move cursor to the this.right + const removed = this.right.splice(this.left.length + this.right.length - n, Number.POSITIVE_INFINITY); + chunkedPush(this.left, removed.reverse()); + } + } +} + +/** + * Avoid stack overflow by pushing items onto the stack in segments + * + * @template T + * Item type. + * @param {Array<T>} list + * List to inject into. + * @param {ReadonlyArray<T>} right + * Items to inject. + * @return {undefined} + * Nothing. + */ +function chunkedPush(list, right) { + /** @type {number} */ + let chunkStart = 0; + if (right.length < 10000) { + list.push(...right); + } else { + while (chunkStart < right.length) { + list.push(...right.slice(chunkStart, chunkStart + 10000)); + chunkStart += 10000; + } + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-subtokenize/license b/tools/ui/node_modules/micromark-util-subtokenize/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-subtokenize/package.json b/tools/ui/node_modules/micromark-util-subtokenize/package.json new file mode 100644 index 0000000000000000000000000000000000000000..e085c487407426447605845092a1eb7a8158fc2d --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/package.json @@ -0,0 +1,60 @@ +{ + "name": "micromark-util-subtokenize", + "version": "2.1.0", + "description": "micromark utility to tokenize subtokens", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "tokenize" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-subtokenize", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "max-depth": "off", + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-subtokenize/readme.md b/tools/ui/node_modules/micromark-util-subtokenize/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..75cf59c1343cc0bf906e29014f01fd7992c43604 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-subtokenize/readme.md @@ -0,0 +1,181 @@ +# micromark-util-subtokenize + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility to tokenize subtokens. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`subtokenize(events)`](#subtokenizeevents) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes a micromark internal that you probably don’t need. + +## When should I use this? + +This package might be useful when you are making your own micromark extensions. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-subtokenize +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {subtokenize} from 'https://esm.sh/micromark-util-subtokenize@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {subtokenize} from 'https://esm.sh/micromark-util-subtokenize@1?bundle' +</script> +``` + +## Use + +```js +import {subtokenize} from 'micromark-util-subtokenize' + +/** + * Content is transparent: it’s parsed right now. That way, definitions are also + * parsed right now: before text in paragraphs (specifically, media) are parsed. + * + * @type {Resolver} + */ +function resolveContent(events) { + subtokenize(events) + return events +} +``` + +## API + +This module exports the identifiers [`subtokenize`][api-subtokenize]. +There is no default export. + +### `subtokenize(events)` + +Tokenize subcontent. + +###### Parameters + +* `events` (`Array<Event>`) + — list of events + +###### Returns + +Whether subtokens were found (`boolean`). + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-subtokenize@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[api-subtokenize]: #subtokenizeevents + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[bundle-size]: https://bundlejs.com/?q=micromark-util-subtokenize + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-subtokenize + +[chat]: https://github.com/micromark/micromark/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/micromark/micromark + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-subtokenize + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-subtokenize.svg + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[health]: https://github.com/micromark/.github + +[license]: https://github.com/micromark/micromark/blob/main/license + +[micromark]: https://github.com/micromark/micromark + +[npm]: https://docs.npmjs.com/cli/install + +[opencollective]: https://opencollective.com/unified + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[typescript]: https://www.typescriptlang.org diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/codes.d.ts b/tools/ui/node_modules/micromark-util-symbol/lib/codes.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..879770a4b6de8d0df7ec99bb3a92d821ff9a7995 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/codes.d.ts @@ -0,0 +1,139 @@ +export namespace codes { + let carriageReturn: -5; + let lineFeed: -4; + let carriageReturnLineFeed: -3; + let horizontalTab: -2; + let virtualSpace: -1; + let eof: null; + let nul: 0; + let soh: 1; + let stx: 2; + let etx: 3; + let eot: 4; + let enq: 5; + let ack: 6; + let bel: 7; + let bs: 8; + let ht: 9; + let lf: 10; + let vt: 11; + let ff: 12; + let cr: 13; + let so: 14; + let si: 15; + let dle: 16; + let dc1: 17; + let dc2: 18; + let dc3: 19; + let dc4: 20; + let nak: 21; + let syn: 22; + let etb: 23; + let can: 24; + let em: 25; + let sub: 26; + let esc: 27; + let fs: 28; + let gs: 29; + let rs: 30; + let us: 31; + let space: 32; + let exclamationMark: 33; + let quotationMark: 34; + let numberSign: 35; + let dollarSign: 36; + let percentSign: 37; + let ampersand: 38; + let apostrophe: 39; + let leftParenthesis: 40; + let rightParenthesis: 41; + let asterisk: 42; + let plusSign: 43; + let comma: 44; + let dash: 45; + let dot: 46; + let slash: 47; + let digit0: 48; + let digit1: 49; + let digit2: 50; + let digit3: 51; + let digit4: 52; + let digit5: 53; + let digit6: 54; + let digit7: 55; + let digit8: 56; + let digit9: 57; + let colon: 58; + let semicolon: 59; + let lessThan: 60; + let equalsTo: 61; + let greaterThan: 62; + let questionMark: 63; + let atSign: 64; + let uppercaseA: 65; + let uppercaseB: 66; + let uppercaseC: 67; + let uppercaseD: 68; + let uppercaseE: 69; + let uppercaseF: 70; + let uppercaseG: 71; + let uppercaseH: 72; + let uppercaseI: 73; + let uppercaseJ: 74; + let uppercaseK: 75; + let uppercaseL: 76; + let uppercaseM: 77; + let uppercaseN: 78; + let uppercaseO: 79; + let uppercaseP: 80; + let uppercaseQ: 81; + let uppercaseR: 82; + let uppercaseS: 83; + let uppercaseT: 84; + let uppercaseU: 85; + let uppercaseV: 86; + let uppercaseW: 87; + let uppercaseX: 88; + let uppercaseY: 89; + let uppercaseZ: 90; + let leftSquareBracket: 91; + let backslash: 92; + let rightSquareBracket: 93; + let caret: 94; + let underscore: 95; + let graveAccent: 96; + let lowercaseA: 97; + let lowercaseB: 98; + let lowercaseC: 99; + let lowercaseD: 100; + let lowercaseE: 101; + let lowercaseF: 102; + let lowercaseG: 103; + let lowercaseH: 104; + let lowercaseI: 105; + let lowercaseJ: 106; + let lowercaseK: 107; + let lowercaseL: 108; + let lowercaseM: 109; + let lowercaseN: 110; + let lowercaseO: 111; + let lowercaseP: 112; + let lowercaseQ: 113; + let lowercaseR: 114; + let lowercaseS: 115; + let lowercaseT: 116; + let lowercaseU: 117; + let lowercaseV: 118; + let lowercaseW: 119; + let lowercaseX: 120; + let lowercaseY: 121; + let lowercaseZ: 122; + let leftCurlyBrace: 123; + let verticalBar: 124; + let rightCurlyBrace: 125; + let tilde: 126; + let del: 127; + let byteOrderMarker: 65279; + let replacementCharacter: 65533; +} +//# sourceMappingURL=codes.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/codes.d.ts.map b/tools/ui/node_modules/micromark-util-symbol/lib/codes.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e45ee7b15623f5d5d366ce7a959c10115addb043 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/codes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["codes.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/codes.js b/tools/ui/node_modules/micromark-util-symbol/lib/codes.js new file mode 100644 index 0000000000000000000000000000000000000000..62fbfd71a399f1a5f03eceab3047730dadbed03e --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/codes.js @@ -0,0 +1,158 @@ +/** + * Character codes. + * + * This module is compiled away! + * + * micromark works based on character codes. + * This module contains constants for the ASCII block and the replacement + * character. + * A couple of them are handled in a special way, such as the line endings + * (CR, LF, and CR+LF, commonly known as end-of-line: EOLs), the tab (horizontal + * tab) and its expansion based on what column it’s at (virtual space), + * and the end-of-file (eof) character. + * As values are preprocessed before handling them, the actual characters LF, + * CR, HT, and NUL (which is present as the replacement character), are + * guaranteed to not exist. + * + * Unicode basic latin block. + */ +export const codes = /** @type {const} */ ({ + carriageReturn: -5, + lineFeed: -4, + carriageReturnLineFeed: -3, + horizontalTab: -2, + virtualSpace: -1, + eof: null, + nul: 0, + soh: 1, + stx: 2, + etx: 3, + eot: 4, + enq: 5, + ack: 6, + bel: 7, + bs: 8, + ht: 9, // `\t` + lf: 10, // `\n` + vt: 11, // `\v` + ff: 12, // `\f` + cr: 13, // `\r` + so: 14, + si: 15, + dle: 16, + dc1: 17, + dc2: 18, + dc3: 19, + dc4: 20, + nak: 21, + syn: 22, + etb: 23, + can: 24, + em: 25, + sub: 26, + esc: 27, + fs: 28, + gs: 29, + rs: 30, + us: 31, + space: 32, + exclamationMark: 33, // `!` + quotationMark: 34, // `"` + numberSign: 35, // `#` + dollarSign: 36, // `$` + percentSign: 37, // `%` + ampersand: 38, // `&` + apostrophe: 39, // `'` + leftParenthesis: 40, // `(` + rightParenthesis: 41, // `)` + asterisk: 42, // `*` + plusSign: 43, // `+` + comma: 44, // `,` + dash: 45, // `-` + dot: 46, // `.` + slash: 47, // `/` + digit0: 48, // `0` + digit1: 49, // `1` + digit2: 50, // `2` + digit3: 51, // `3` + digit4: 52, // `4` + digit5: 53, // `5` + digit6: 54, // `6` + digit7: 55, // `7` + digit8: 56, // `8` + digit9: 57, // `9` + colon: 58, // `:` + semicolon: 59, // `;` + lessThan: 60, // `<` + equalsTo: 61, // `=` + greaterThan: 62, // `>` + questionMark: 63, // `?` + atSign: 64, // `@` + uppercaseA: 65, // `A` + uppercaseB: 66, // `B` + uppercaseC: 67, // `C` + uppercaseD: 68, // `D` + uppercaseE: 69, // `E` + uppercaseF: 70, // `F` + uppercaseG: 71, // `G` + uppercaseH: 72, // `H` + uppercaseI: 73, // `I` + uppercaseJ: 74, // `J` + uppercaseK: 75, // `K` + uppercaseL: 76, // `L` + uppercaseM: 77, // `M` + uppercaseN: 78, // `N` + uppercaseO: 79, // `O` + uppercaseP: 80, // `P` + uppercaseQ: 81, // `Q` + uppercaseR: 82, // `R` + uppercaseS: 83, // `S` + uppercaseT: 84, // `T` + uppercaseU: 85, // `U` + uppercaseV: 86, // `V` + uppercaseW: 87, // `W` + uppercaseX: 88, // `X` + uppercaseY: 89, // `Y` + uppercaseZ: 90, // `Z` + leftSquareBracket: 91, // `[` + backslash: 92, // `\` + rightSquareBracket: 93, // `]` + caret: 94, // `^` + underscore: 95, // `_` + graveAccent: 96, // `` ` `` + lowercaseA: 97, // `a` + lowercaseB: 98, // `b` + lowercaseC: 99, // `c` + lowercaseD: 100, // `d` + lowercaseE: 101, // `e` + lowercaseF: 102, // `f` + lowercaseG: 103, // `g` + lowercaseH: 104, // `h` + lowercaseI: 105, // `i` + lowercaseJ: 106, // `j` + lowercaseK: 107, // `k` + lowercaseL: 108, // `l` + lowercaseM: 109, // `m` + lowercaseN: 110, // `n` + lowercaseO: 111, // `o` + lowercaseP: 112, // `p` + lowercaseQ: 113, // `q` + lowercaseR: 114, // `r` + lowercaseS: 115, // `s` + lowercaseT: 116, // `t` + lowercaseU: 117, // `u` + lowercaseV: 118, // `v` + lowercaseW: 119, // `w` + lowercaseX: 120, // `x` + lowercaseY: 121, // `y` + lowercaseZ: 122, // `z` + leftCurlyBrace: 123, // `{` + verticalBar: 124, // `|` + rightCurlyBrace: 125, // `}` + tilde: 126, // `~` + del: 127, + // Unicode Specials block. + byteOrderMarker: 65_279, + // Unicode Specials block. + replacementCharacter: 65_533 // `�` +}) diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/constants.d.ts b/tools/ui/node_modules/micromark-util-symbol/lib/constants.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f445b69e4b35b6977b6eb9b3faea39f9a1815b04 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/constants.d.ts @@ -0,0 +1,37 @@ +export namespace constants { + let attentionSideAfter: 2; + let attentionSideBefore: 1; + let atxHeadingOpeningFenceSizeMax: 6; + let autolinkDomainSizeMax: 63; + let autolinkSchemeSizeMax: 32; + let cdataOpeningString: "CDATA["; + let characterGroupPunctuation: 2; + let characterGroupWhitespace: 1; + let characterReferenceDecimalSizeMax: 7; + let characterReferenceHexadecimalSizeMax: 6; + let characterReferenceNamedSizeMax: 31; + let codeFencedSequenceSizeMin: 3; + let contentTypeContent: "content"; + let contentTypeDocument: "document"; + let contentTypeFlow: "flow"; + let contentTypeString: "string"; + let contentTypeText: "text"; + let hardBreakPrefixSizeMin: 2; + let htmlBasic: 6; + let htmlCdata: 5; + let htmlComment: 2; + let htmlComplete: 7; + let htmlDeclaration: 4; + let htmlInstruction: 3; + let htmlRawSizeMax: 8; + let htmlRaw: 1; + let linkResourceDestinationBalanceMax: 32; + let linkReferenceSizeMax: 999; + let listItemValueSizeMax: 10; + let numericBaseDecimal: 10; + let numericBaseHexadecimal: 16; + let tabSize: 4; + let thematicBreakMarkerCountMin: 3; + let v8MaxSafeChunkSize: 10000; +} +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/constants.d.ts.map b/tools/ui/node_modules/micromark-util-symbol/lib/constants.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..633429e678c2e3b17e67bdf0c744ea1ac4c5227b --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["constants.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/constants.js b/tools/ui/node_modules/micromark-util-symbol/lib/constants.js new file mode 100644 index 0000000000000000000000000000000000000000..bbd487d26e3cd27929321c467ffb43ba810db0fd --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/constants.js @@ -0,0 +1,44 @@ +/** + * This module is compiled away! + * + * Parsing markdown comes with a couple of constants, such as minimum or maximum + * sizes of certain sequences. + * Additionally, there are a couple symbols used inside micromark. + * These are all defined here, but compiled away by scripts. + */ +export const constants = /** @type {const} */ ({ + attentionSideAfter: 2, // Symbol to mark an attention sequence as after content: `a*` + attentionSideBefore: 1, // Symbol to mark an attention sequence as before content: `*a` + atxHeadingOpeningFenceSizeMax: 6, // 6 number signs is fine, 7 isn’t. + autolinkDomainSizeMax: 63, // 63 characters is fine, 64 is too many. + autolinkSchemeSizeMax: 32, // 32 characters is fine, 33 is too many. + cdataOpeningString: 'CDATA[', // And preceded by `<![`. + characterGroupPunctuation: 2, // Symbol used to indicate a character is punctuation + characterGroupWhitespace: 1, // Symbol used to indicate a character is whitespace + characterReferenceDecimalSizeMax: 7, // `&#9999999;`. + characterReferenceHexadecimalSizeMax: 6, // `&#xff9999;`. + characterReferenceNamedSizeMax: 31, // `&CounterClockwiseContourIntegral;`. + codeFencedSequenceSizeMin: 3, // At least 3 ticks or tildes are needed. + contentTypeContent: 'content', + contentTypeDocument: 'document', + contentTypeFlow: 'flow', + contentTypeString: 'string', + contentTypeText: 'text', + hardBreakPrefixSizeMin: 2, // At least 2 trailing spaces are needed. + htmlBasic: 6, // Symbol for `<div` + htmlCdata: 5, // Symbol for `<![CDATA[]]>` + htmlComment: 2, // Symbol for `<!---->` + htmlComplete: 7, // Symbol for `<x>` + htmlDeclaration: 4, // Symbol for `<!doctype>` + htmlInstruction: 3, // Symbol for `<?php?>` + htmlRawSizeMax: 8, // Length of `textarea`. + htmlRaw: 1, // Symbol for `<script>` + linkResourceDestinationBalanceMax: 32, // See: <https://spec.commonmark.org/0.30/#link-destination>, <https://github.com/remarkjs/react-markdown/issues/658#issuecomment-984345577> + linkReferenceSizeMax: 999, // See: <https://spec.commonmark.org/0.30/#link-label> + listItemValueSizeMax: 10, // See: <https://spec.commonmark.org/0.30/#ordered-list-marker> + numericBaseDecimal: 10, + numericBaseHexadecimal: 0x10, + tabSize: 4, // Tabs have a hard-coded size of 4, per CommonMark. + thematicBreakMarkerCountMin: 3, // At least 3 asterisks, dashes, or underscores are needed. + v8MaxSafeChunkSize: 10_000 // V8 (and potentially others) have problems injecting giant arrays into other arrays, hence we operate in chunks. +}) diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/default.d.ts b/tools/ui/node_modules/micromark-util-symbol/lib/default.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..45ccfdfa0f20764875525ba63e6655b24afc3439 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/default.d.ts @@ -0,0 +1,5 @@ +export { codes } from "./codes.js"; +export { constants } from "./constants.js"; +export { types } from "./types.js"; +export { values } from "./values.js"; +//# sourceMappingURL=default.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/default.d.ts.map b/tools/ui/node_modules/micromark-util-symbol/lib/default.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..235ac4115ba0c16c55158f2d28ce59e60fdd7af2 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/default.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["default.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/default.js b/tools/ui/node_modules/micromark-util-symbol/lib/default.js new file mode 100644 index 0000000000000000000000000000000000000000..4a2680d6d5c44e53c43cfa8394ebc155c6577b72 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/default.js @@ -0,0 +1,4 @@ +export {codes} from './codes.js' +export {constants} from './constants.js' +export {types} from './types.js' +export {values} from './values.js' diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/types.d.ts b/tools/ui/node_modules/micromark-util-symbol/lib/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6596213800e7f347cffd63ae906562dadab8310f --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/types.d.ts @@ -0,0 +1,106 @@ +export namespace types { + let data: "data"; + let whitespace: "whitespace"; + let lineEnding: "lineEnding"; + let lineEndingBlank: "lineEndingBlank"; + let linePrefix: "linePrefix"; + let lineSuffix: "lineSuffix"; + let atxHeading: "atxHeading"; + let atxHeadingSequence: "atxHeadingSequence"; + let atxHeadingText: "atxHeadingText"; + let autolink: "autolink"; + let autolinkEmail: "autolinkEmail"; + let autolinkMarker: "autolinkMarker"; + let autolinkProtocol: "autolinkProtocol"; + let characterEscape: "characterEscape"; + let characterEscapeValue: "characterEscapeValue"; + let characterReference: "characterReference"; + let characterReferenceMarker: "characterReferenceMarker"; + let characterReferenceMarkerNumeric: "characterReferenceMarkerNumeric"; + let characterReferenceMarkerHexadecimal: "characterReferenceMarkerHexadecimal"; + let characterReferenceValue: "characterReferenceValue"; + let codeFenced: "codeFenced"; + let codeFencedFence: "codeFencedFence"; + let codeFencedFenceSequence: "codeFencedFenceSequence"; + let codeFencedFenceInfo: "codeFencedFenceInfo"; + let codeFencedFenceMeta: "codeFencedFenceMeta"; + let codeFlowValue: "codeFlowValue"; + let codeIndented: "codeIndented"; + let codeText: "codeText"; + let codeTextData: "codeTextData"; + let codeTextPadding: "codeTextPadding"; + let codeTextSequence: "codeTextSequence"; + let content: "content"; + let definition: "definition"; + let definitionDestination: "definitionDestination"; + let definitionDestinationLiteral: "definitionDestinationLiteral"; + let definitionDestinationLiteralMarker: "definitionDestinationLiteralMarker"; + let definitionDestinationRaw: "definitionDestinationRaw"; + let definitionDestinationString: "definitionDestinationString"; + let definitionLabel: "definitionLabel"; + let definitionLabelMarker: "definitionLabelMarker"; + let definitionLabelString: "definitionLabelString"; + let definitionMarker: "definitionMarker"; + let definitionTitle: "definitionTitle"; + let definitionTitleMarker: "definitionTitleMarker"; + let definitionTitleString: "definitionTitleString"; + let emphasis: "emphasis"; + let emphasisSequence: "emphasisSequence"; + let emphasisText: "emphasisText"; + let escapeMarker: "escapeMarker"; + let hardBreakEscape: "hardBreakEscape"; + let hardBreakTrailing: "hardBreakTrailing"; + let htmlFlow: "htmlFlow"; + let htmlFlowData: "htmlFlowData"; + let htmlText: "htmlText"; + let htmlTextData: "htmlTextData"; + let image: "image"; + let label: "label"; + let labelText: "labelText"; + let labelLink: "labelLink"; + let labelImage: "labelImage"; + let labelMarker: "labelMarker"; + let labelImageMarker: "labelImageMarker"; + let labelEnd: "labelEnd"; + let link: "link"; + let paragraph: "paragraph"; + let reference: "reference"; + let referenceMarker: "referenceMarker"; + let referenceString: "referenceString"; + let resource: "resource"; + let resourceDestination: "resourceDestination"; + let resourceDestinationLiteral: "resourceDestinationLiteral"; + let resourceDestinationLiteralMarker: "resourceDestinationLiteralMarker"; + let resourceDestinationRaw: "resourceDestinationRaw"; + let resourceDestinationString: "resourceDestinationString"; + let resourceMarker: "resourceMarker"; + let resourceTitle: "resourceTitle"; + let resourceTitleMarker: "resourceTitleMarker"; + let resourceTitleString: "resourceTitleString"; + let setextHeading: "setextHeading"; + let setextHeadingText: "setextHeadingText"; + let setextHeadingLine: "setextHeadingLine"; + let setextHeadingLineSequence: "setextHeadingLineSequence"; + let strong: "strong"; + let strongSequence: "strongSequence"; + let strongText: "strongText"; + let thematicBreak: "thematicBreak"; + let thematicBreakSequence: "thematicBreakSequence"; + let blockQuote: "blockQuote"; + let blockQuotePrefix: "blockQuotePrefix"; + let blockQuoteMarker: "blockQuoteMarker"; + let blockQuotePrefixWhitespace: "blockQuotePrefixWhitespace"; + let listOrdered: "listOrdered"; + let listUnordered: "listUnordered"; + let listItemIndent: "listItemIndent"; + let listItemMarker: "listItemMarker"; + let listItemPrefix: "listItemPrefix"; + let listItemPrefixWhitespace: "listItemPrefixWhitespace"; + let listItemValue: "listItemValue"; + let chunkDocument: "chunkDocument"; + let chunkContent: "chunkContent"; + let chunkFlow: "chunkFlow"; + let chunkText: "chunkText"; + let chunkString: "chunkString"; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/types.d.ts.map b/tools/ui/node_modules/micromark-util-symbol/lib/types.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..2b3984a6e51fbb2461fd69ccb6717a67aa96d5bc --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/types.js b/tools/ui/node_modules/micromark-util-symbol/lib/types.js new file mode 100644 index 0000000000000000000000000000000000000000..603bc9cde054de8293806a196b39c933fbc40049 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/types.js @@ -0,0 +1,453 @@ +/** + * This module is compiled away! + * + * Here is the list of all types of tokens exposed by micromark, with a short + * explanation of what they include and where they are found. + * In picking names, generally, the rule is to be as explicit as possible + * instead of reusing names. + * For example, there is a `definitionDestination` and a `resourceDestination`, + * instead of one shared name. + */ + +// Note: when changing the next record, you must also change `TokenTypeMap` +// in `micromark-util-types/index.d.ts`. +export const types = /** @type {const} */ ({ + // Generic type for data, such as in a title, a destination, etc. + data: 'data', + + // Generic type for syntactic whitespace (tabs, virtual spaces, spaces). + // Such as, between a fenced code fence and an info string. + whitespace: 'whitespace', + + // Generic type for line endings (line feed, carriage return, carriage return + + // line feed). + lineEnding: 'lineEnding', + + // A line ending, but ending a blank line. + lineEndingBlank: 'lineEndingBlank', + + // Generic type for whitespace (tabs, virtual spaces, spaces) at the start of a + // line. + linePrefix: 'linePrefix', + + // Generic type for whitespace (tabs, virtual spaces, spaces) at the end of a + // line. + lineSuffix: 'lineSuffix', + + // Whole ATX heading: + // + // ```markdown + // # + // ## Alpha + // ### Bravo ### + // ``` + // + // Includes `atxHeadingSequence`, `whitespace`, `atxHeadingText`. + atxHeading: 'atxHeading', + + // Sequence of number signs in an ATX heading (`###`). + atxHeadingSequence: 'atxHeadingSequence', + + // Content in an ATX heading (`alpha`). + // Includes text. + atxHeadingText: 'atxHeadingText', + + // Whole autolink (`<https://example.com>` or `<admin@example.com>`) + // Includes `autolinkMarker` and `autolinkProtocol` or `autolinkEmail`. + autolink: 'autolink', + + // Email autolink w/o markers (`admin@example.com`) + autolinkEmail: 'autolinkEmail', + + // Marker around an `autolinkProtocol` or `autolinkEmail` (`<` or `>`). + autolinkMarker: 'autolinkMarker', + + // Protocol autolink w/o markers (`https://example.com`) + autolinkProtocol: 'autolinkProtocol', + + // A whole character escape (`\-`). + // Includes `escapeMarker` and `characterEscapeValue`. + characterEscape: 'characterEscape', + + // The escaped character (`-`). + characterEscapeValue: 'characterEscapeValue', + + // A whole character reference (`&amp;`, `&#8800;`, or `&#x1D306;`). + // Includes `characterReferenceMarker`, an optional + // `characterReferenceMarkerNumeric`, in which case an optional + // `characterReferenceMarkerHexadecimal`, and a `characterReferenceValue`. + characterReference: 'characterReference', + + // The start or end marker (`&` or `;`). + characterReferenceMarker: 'characterReferenceMarker', + + // Mark reference as numeric (`#`). + characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric', + + // Mark reference as numeric (`x` or `X`). + characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal', + + // Value of character reference w/o markers (`amp`, `8800`, or `1D306`). + characterReferenceValue: 'characterReferenceValue', + + // Whole fenced code: + // + // ````markdown + // ```js + // alert(1) + // ``` + // ```` + codeFenced: 'codeFenced', + + // A fenced code fence, including whitespace, sequence, info, and meta + // (` ```js `). + codeFencedFence: 'codeFencedFence', + + // Sequence of grave accent or tilde characters (` ``` `) in a fence. + codeFencedFenceSequence: 'codeFencedFenceSequence', + + // Info word (`js`) in a fence. + // Includes string. + codeFencedFenceInfo: 'codeFencedFenceInfo', + + // Meta words (`highlight="1"`) in a fence. + // Includes string. + codeFencedFenceMeta: 'codeFencedFenceMeta', + + // A line of code. + codeFlowValue: 'codeFlowValue', + + // Whole indented code: + // + // ```markdown + // alert(1) + // ``` + // + // Includes `lineEnding`, `linePrefix`, and `codeFlowValue`. + codeIndented: 'codeIndented', + + // A text code (``` `alpha` ```). + // Includes `codeTextSequence`, `codeTextData`, `lineEnding`, and can include + // `codeTextPadding`. + codeText: 'codeText', + + codeTextData: 'codeTextData', + + // A space or line ending right after or before a tick. + codeTextPadding: 'codeTextPadding', + + // A text code fence (` `` `). + codeTextSequence: 'codeTextSequence', + + // Whole content: + // + // ```markdown + // [a]: b + // c + // = + // d + // ``` + // + // Includes `paragraph` and `definition`. + content: 'content', + // Whole definition: + // + // ```markdown + // [micromark]: https://github.com/micromark/micromark + // ``` + // + // Includes `definitionLabel`, `definitionMarker`, `whitespace`, + // `definitionDestination`, and optionally `lineEnding` and `definitionTitle`. + definition: 'definition', + + // Destination of a definition (`https://github.com/micromark/micromark` or + // `<https://github.com/micromark/micromark>`). + // Includes `definitionDestinationLiteral` or `definitionDestinationRaw`. + definitionDestination: 'definitionDestination', + + // Enclosed destination of a definition + // (`<https://github.com/micromark/micromark>`). + // Includes `definitionDestinationLiteralMarker` and optionally + // `definitionDestinationString`. + definitionDestinationLiteral: 'definitionDestinationLiteral', + + // Markers of an enclosed definition destination (`<` or `>`). + definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker', + + // Unenclosed destination of a definition + // (`https://github.com/micromark/micromark`). + // Includes `definitionDestinationString`. + definitionDestinationRaw: 'definitionDestinationRaw', + + // Text in an destination (`https://github.com/micromark/micromark`). + // Includes string. + definitionDestinationString: 'definitionDestinationString', + + // Label of a definition (`[micromark]`). + // Includes `definitionLabelMarker` and `definitionLabelString`. + definitionLabel: 'definitionLabel', + + // Markers of a definition label (`[` or `]`). + definitionLabelMarker: 'definitionLabelMarker', + + // Value of a definition label (`micromark`). + // Includes string. + definitionLabelString: 'definitionLabelString', + + // Marker between a label and a destination (`:`). + definitionMarker: 'definitionMarker', + + // Title of a definition (`"x"`, `'y'`, or `(z)`). + // Includes `definitionTitleMarker` and optionally `definitionTitleString`. + definitionTitle: 'definitionTitle', + + // Marker around a title of a definition (`"`, `'`, `(`, or `)`). + definitionTitleMarker: 'definitionTitleMarker', + + // Data without markers in a title (`z`). + // Includes string. + definitionTitleString: 'definitionTitleString', + + // Emphasis (`*alpha*`). + // Includes `emphasisSequence` and `emphasisText`. + emphasis: 'emphasis', + + // Sequence of emphasis markers (`*` or `_`). + emphasisSequence: 'emphasisSequence', + + // Emphasis text (`alpha`). + // Includes text. + emphasisText: 'emphasisText', + + // The character escape marker (`\`). + escapeMarker: 'escapeMarker', + + // A hard break created with a backslash (`\\n`). + // Note: does not include the line ending. + hardBreakEscape: 'hardBreakEscape', + + // A hard break created with trailing spaces (` \n`). + // Does not include the line ending. + hardBreakTrailing: 'hardBreakTrailing', + + // Flow HTML: + // + // ```markdown + // <div + // ``` + // + // Inlcudes `lineEnding`, `htmlFlowData`. + htmlFlow: 'htmlFlow', + + htmlFlowData: 'htmlFlowData', + + // HTML in text (the tag in `a <i> b`). + // Includes `lineEnding`, `htmlTextData`. + htmlText: 'htmlText', + + htmlTextData: 'htmlTextData', + + // Whole image (`![alpha](bravo)`, `![alpha][bravo]`, `![alpha][]`, or + // `![alpha]`). + // Includes `label` and an optional `resource` or `reference`. + image: 'image', + + // Whole link label (`[*alpha*]`). + // Includes `labelLink` or `labelImage`, `labelText`, and `labelEnd`. + label: 'label', + + // Text in an label (`*alpha*`). + // Includes text. + labelText: 'labelText', + + // Start a link label (`[`). + // Includes a `labelMarker`. + labelLink: 'labelLink', + + // Start an image label (`![`). + // Includes `labelImageMarker` and `labelMarker`. + labelImage: 'labelImage', + + // Marker of a label (`[` or `]`). + labelMarker: 'labelMarker', + + // Marker to start an image (`!`). + labelImageMarker: 'labelImageMarker', + + // End a label (`]`). + // Includes `labelMarker`. + labelEnd: 'labelEnd', + + // Whole link (`[alpha](bravo)`, `[alpha][bravo]`, `[alpha][]`, or `[alpha]`). + // Includes `label` and an optional `resource` or `reference`. + link: 'link', + + // Whole paragraph: + // + // ```markdown + // alpha + // bravo. + // ``` + // + // Includes text. + paragraph: 'paragraph', + + // A reference (`[alpha]` or `[]`). + // Includes `referenceMarker` and an optional `referenceString`. + reference: 'reference', + + // A reference marker (`[` or `]`). + referenceMarker: 'referenceMarker', + + // Reference text (`alpha`). + // Includes string. + referenceString: 'referenceString', + + // A resource (`(https://example.com "alpha")`). + // Includes `resourceMarker`, an optional `resourceDestination` with an optional + // `whitespace` and `resourceTitle`. + resource: 'resource', + + // A resource destination (`https://example.com`). + // Includes `resourceDestinationLiteral` or `resourceDestinationRaw`. + resourceDestination: 'resourceDestination', + + // A literal resource destination (`<https://example.com>`). + // Includes `resourceDestinationLiteralMarker` and optionally + // `resourceDestinationString`. + resourceDestinationLiteral: 'resourceDestinationLiteral', + + // A resource destination marker (`<` or `>`). + resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker', + + // A raw resource destination (`https://example.com`). + // Includes `resourceDestinationString`. + resourceDestinationRaw: 'resourceDestinationRaw', + + // Resource destination text (`https://example.com`). + // Includes string. + resourceDestinationString: 'resourceDestinationString', + + // A resource marker (`(` or `)`). + resourceMarker: 'resourceMarker', + + // A resource title (`"alpha"`, `'alpha'`, or `(alpha)`). + // Includes `resourceTitleMarker` and optionally `resourceTitleString`. + resourceTitle: 'resourceTitle', + + // A resource title marker (`"`, `'`, `(`, or `)`). + resourceTitleMarker: 'resourceTitleMarker', + + // Resource destination title (`alpha`). + // Includes string. + resourceTitleString: 'resourceTitleString', + + // Whole setext heading: + // + // ```markdown + // alpha + // bravo + // ===== + // ``` + // + // Includes `setextHeadingText`, `lineEnding`, `linePrefix`, and + // `setextHeadingLine`. + setextHeading: 'setextHeading', + + // Content in a setext heading (`alpha\nbravo`). + // Includes text. + setextHeadingText: 'setextHeadingText', + + // Underline in a setext heading, including whitespace suffix (`==`). + // Includes `setextHeadingLineSequence`. + setextHeadingLine: 'setextHeadingLine', + + // Sequence of equals or dash characters in underline in a setext heading (`-`). + setextHeadingLineSequence: 'setextHeadingLineSequence', + + // Strong (`**alpha**`). + // Includes `strongSequence` and `strongText`. + strong: 'strong', + + // Sequence of strong markers (`**` or `__`). + strongSequence: 'strongSequence', + + // Strong text (`alpha`). + // Includes text. + strongText: 'strongText', + + // Whole thematic break: + // + // ```markdown + // * * * + // ``` + // + // Includes `thematicBreakSequence` and `whitespace`. + thematicBreak: 'thematicBreak', + + // A sequence of one or more thematic break markers (`***`). + thematicBreakSequence: 'thematicBreakSequence', + + // Whole block quote: + // + // ```markdown + // > a + // > + // > b + // ``` + // + // Includes `blockQuotePrefix` and flow. + blockQuote: 'blockQuote', + // The `>` or `> ` of a block quote. + blockQuotePrefix: 'blockQuotePrefix', + // The `>` of a block quote prefix. + blockQuoteMarker: 'blockQuoteMarker', + // The optional ` ` of a block quote prefix. + blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace', + + // Whole ordered list: + // + // ```markdown + // 1. a + // b + // ``` + // + // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further + // lines. + listOrdered: 'listOrdered', + + // Whole unordered list: + // + // ```markdown + // - a + // b + // ``` + // + // Includes `listItemPrefix`, flow, and optionally `listItemIndent` on further + // lines. + listUnordered: 'listUnordered', + + // The indent of further list item lines. + listItemIndent: 'listItemIndent', + + // A marker, as in, `*`, `+`, `-`, `.`, or `)`. + listItemMarker: 'listItemMarker', + + // The thing that starts a list item, such as `1. `. + // Includes `listItemValue` if ordered, `listItemMarker`, and + // `listItemPrefixWhitespace` (unless followed by a line ending). + listItemPrefix: 'listItemPrefix', + + // The whitespace after a marker. + listItemPrefixWhitespace: 'listItemPrefixWhitespace', + + // The numerical value of an ordered item. + listItemValue: 'listItemValue', + + // Internal types used for subtokenizers, compiled away + chunkDocument: 'chunkDocument', + chunkContent: 'chunkContent', + chunkFlow: 'chunkFlow', + chunkText: 'chunkText', + chunkString: 'chunkString' +}) diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/values.d.ts b/tools/ui/node_modules/micromark-util-symbol/lib/values.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..74324154fce0dfb08d9c7f239d1e911e83d11c0f --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/values.d.ts @@ -0,0 +1,102 @@ +export namespace values { + let ht: "\t"; + let lf: "\n"; + let cr: "\r"; + let space: " "; + let exclamationMark: "!"; + let quotationMark: "\""; + let numberSign: "#"; + let dollarSign: "$"; + let percentSign: "%"; + let ampersand: "&"; + let apostrophe: "'"; + let leftParenthesis: "("; + let rightParenthesis: ")"; + let asterisk: "*"; + let plusSign: "+"; + let comma: ","; + let dash: "-"; + let dot: "."; + let slash: "/"; + let digit0: "0"; + let digit1: "1"; + let digit2: "2"; + let digit3: "3"; + let digit4: "4"; + let digit5: "5"; + let digit6: "6"; + let digit7: "7"; + let digit8: "8"; + let digit9: "9"; + let colon: ":"; + let semicolon: ";"; + let lessThan: "<"; + let equalsTo: "="; + let greaterThan: ">"; + let questionMark: "?"; + let atSign: "@"; + let uppercaseA: "A"; + let uppercaseB: "B"; + let uppercaseC: "C"; + let uppercaseD: "D"; + let uppercaseE: "E"; + let uppercaseF: "F"; + let uppercaseG: "G"; + let uppercaseH: "H"; + let uppercaseI: "I"; + let uppercaseJ: "J"; + let uppercaseK: "K"; + let uppercaseL: "L"; + let uppercaseM: "M"; + let uppercaseN: "N"; + let uppercaseO: "O"; + let uppercaseP: "P"; + let uppercaseQ: "Q"; + let uppercaseR: "R"; + let uppercaseS: "S"; + let uppercaseT: "T"; + let uppercaseU: "U"; + let uppercaseV: "V"; + let uppercaseW: "W"; + let uppercaseX: "X"; + let uppercaseY: "Y"; + let uppercaseZ: "Z"; + let leftSquareBracket: "["; + let backslash: "\\"; + let rightSquareBracket: "]"; + let caret: "^"; + let underscore: "_"; + let graveAccent: "`"; + let lowercaseA: "a"; + let lowercaseB: "b"; + let lowercaseC: "c"; + let lowercaseD: "d"; + let lowercaseE: "e"; + let lowercaseF: "f"; + let lowercaseG: "g"; + let lowercaseH: "h"; + let lowercaseI: "i"; + let lowercaseJ: "j"; + let lowercaseK: "k"; + let lowercaseL: "l"; + let lowercaseM: "m"; + let lowercaseN: "n"; + let lowercaseO: "o"; + let lowercaseP: "p"; + let lowercaseQ: "q"; + let lowercaseR: "r"; + let lowercaseS: "s"; + let lowercaseT: "t"; + let lowercaseU: "u"; + let lowercaseV: "v"; + let lowercaseW: "w"; + let lowercaseX: "x"; + let lowercaseY: "y"; + let lowercaseZ: "z"; + let leftCurlyBrace: "{"; + let verticalBar: "|"; + let rightCurlyBrace: "}"; + let tilde: "~"; + let replacementCharacter: "�"; +} +//# sourceMappingURL=values.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/values.d.ts.map b/tools/ui/node_modules/micromark-util-symbol/lib/values.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1af4322b51d2d07200da4856f8609e2b345d0531 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/values.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["values.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-util-symbol/lib/values.js b/tools/ui/node_modules/micromark-util-symbol/lib/values.js new file mode 100644 index 0000000000000000000000000000000000000000..d40b5a785c4d120674636181853a32bcdf3e9f21 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/lib/values.js @@ -0,0 +1,109 @@ +/** + * This module is compiled away! + * + * While micromark works based on character codes, this module includes the + * string versions of ’em. + * The C0 block, except for LF, CR, HT, and w/ the replacement character added, + * are available here. + */ +export const values = /** @type {const} */ ({ + ht: '\t', + lf: '\n', + cr: '\r', + space: ' ', + exclamationMark: '!', + quotationMark: '"', + numberSign: '#', + dollarSign: '$', + percentSign: '%', + ampersand: '&', + apostrophe: "'", + leftParenthesis: '(', + rightParenthesis: ')', + asterisk: '*', + plusSign: '+', + comma: ',', + dash: '-', + dot: '.', + slash: '/', + digit0: '0', + digit1: '1', + digit2: '2', + digit3: '3', + digit4: '4', + digit5: '5', + digit6: '6', + digit7: '7', + digit8: '8', + digit9: '9', + colon: ':', + semicolon: ';', + lessThan: '<', + equalsTo: '=', + greaterThan: '>', + questionMark: '?', + atSign: '@', + uppercaseA: 'A', + uppercaseB: 'B', + uppercaseC: 'C', + uppercaseD: 'D', + uppercaseE: 'E', + uppercaseF: 'F', + uppercaseG: 'G', + uppercaseH: 'H', + uppercaseI: 'I', + uppercaseJ: 'J', + uppercaseK: 'K', + uppercaseL: 'L', + uppercaseM: 'M', + uppercaseN: 'N', + uppercaseO: 'O', + uppercaseP: 'P', + uppercaseQ: 'Q', + uppercaseR: 'R', + uppercaseS: 'S', + uppercaseT: 'T', + uppercaseU: 'U', + uppercaseV: 'V', + uppercaseW: 'W', + uppercaseX: 'X', + uppercaseY: 'Y', + uppercaseZ: 'Z', + leftSquareBracket: '[', + backslash: '\\', + rightSquareBracket: ']', + caret: '^', + underscore: '_', + graveAccent: '`', + lowercaseA: 'a', + lowercaseB: 'b', + lowercaseC: 'c', + lowercaseD: 'd', + lowercaseE: 'e', + lowercaseF: 'f', + lowercaseG: 'g', + lowercaseH: 'h', + lowercaseI: 'i', + lowercaseJ: 'j', + lowercaseK: 'k', + lowercaseL: 'l', + lowercaseM: 'm', + lowercaseN: 'n', + lowercaseO: 'o', + lowercaseP: 'p', + lowercaseQ: 'q', + lowercaseR: 'r', + lowercaseS: 's', + lowercaseT: 't', + lowercaseU: 'u', + lowercaseV: 'v', + lowercaseW: 'w', + lowercaseX: 'x', + lowercaseY: 'y', + lowercaseZ: 'z', + leftCurlyBrace: '{', + verticalBar: '|', + rightCurlyBrace: '}', + tilde: '~', + replacementCharacter: '�' +}) diff --git a/tools/ui/node_modules/micromark-util-symbol/license b/tools/ui/node_modules/micromark-util-symbol/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-symbol/package.json b/tools/ui/node_modules/micromark-util-symbol/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b557140a60ffa0d340d86eb4811203411302e592 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/package.json @@ -0,0 +1,43 @@ +{ + "name": "micromark-util-symbol", + "version": "2.0.1", + "description": "micromark utility with symbols", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "symbol" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-symbol", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "lib/" + ], + "exports": "./lib/default.js", + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "unicorn/prefer-code-point": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-symbol/readme.md b/tools/ui/node_modules/micromark-util-symbol/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..4bad177259834ae353c4b615db49687bccda3c7c --- /dev/null +++ b/tools/ui/node_modules/micromark-util-symbol/readme.md @@ -0,0 +1,168 @@ +# micromark-util-symbol + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility with symbols. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes constants used throughout the micromark ecosystem. + +## When should I use this? + +This package is useful when you are making your own micromark extensions. +It’s useful to reference these constants by name instead of value while +developing. +[`micromark-build`][micromark-build] compiles them away for production code. + +## Install + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-symbol +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import * as symbol from 'https://esm.sh/micromark-util-symbol@1' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import * as symbol from 'https://esm.sh/micromark-util-symbol@1?bundle' +</script> +``` + +## Use + +```js +import {codes, constants, types, values} from 'micromark-util-symbol' + +console.log(codes.atSign) // 64 +console.log(constants.characterReferenceNamedSizeMax) // 31 +console.log(types.definitionDestinationRaw) // 'definitionDestinationRaw' +console.log(values.atSign) // '@' +``` + +## API + +This package exports the identifiers `codes`, `constants`, `types`, and +`values`. +There is no default export. + +Each identifier is an object mapping strings to values. +See the code for the exposed data. + +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-symbol@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[coverage]: https://codecov.io/github/micromark/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-symbol.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-symbol + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-symbol + +[bundle-size]: https://bundlejs.com/?q=micromark-util-symbol + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[opencollective]: https://opencollective.com/unified + +[npm]: https://docs.npmjs.com/cli/install + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[chat]: https://github.com/micromark/micromark/discussions + +[license]: https://github.com/micromark/micromark/blob/main/license + +[author]: https://wooorm.com + +[health]: https://github.com/micromark/.github + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[typescript]: https://www.typescriptlang.org + +[micromark]: https://github.com/micromark/micromark + +[micromark-build]: https://github.com/micromark/micromark/tree/main/packages/micromark-build diff --git a/tools/ui/node_modules/micromark-util-types/index.d.ts b/tools/ui/node_modules/micromark-util-types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a960aff7e2f19a3f51a7627b82082c51e3b20b6b --- /dev/null +++ b/tools/ui/node_modules/micromark-util-types/index.d.ts @@ -0,0 +1,1312 @@ +// Note: this file is authored manually, not generated from `index.js`. + +/** + * A character code. + * + * This is often the same as what `String#charCodeAt()` yields but micromark + * adds meaning to certain other values. + * + * `null` represents the end of the input stream (called eof). + * Negative integers are used instead of certain sequences of characters (such + * as line endings and tabs). + */ +export type Code = number | null + +/** + * A chunk is either a character code or a slice of a buffer in the form of a + * string. + * + * Chunks are used because strings are more efficient storage that character + * codes, but limited in what they can represent. + */ +export type Chunk = Code | string + +/** + * Enumeration of the content types. + * + * Technically `document` is also a content type, which includes containers + * (lists, block quotes) and flow. + * As `ContentType` is used on tokens to define the type of subcontent but + * `document` is the highest level of content, so it’s not listed here. + * + * Containers in markdown come from the margin and include more constructs + * on the lines that define them. + * Take for example a block quote with a paragraph inside it (such as + * `> asd`). + * + * `flow` represents the sections, such as headings, code, and content, which + * is also parsed per line + * An example is HTML, which has a certain starting condition (such as + * `<script>` on its own line), then continues for a while, until an end + * condition is found (such as `</style>`). + * If that line with an end condition is never found, that flow goes until + * the end. + * + * `content` is zero or more definitions, and then zero or one paragraph. + * It’s a weird one, and needed to make certain edge cases around definitions + * spec compliant. + * Definitions are unlike other things in markdown, in that they behave like + * `text` in that they can contain arbitrary line endings, but *have* to end + * at a line ending. + * If they end in something else, the whole definition instead is seen as a + * paragraph. + * + * The content in markdown first needs to be parsed up to this level to + * figure out which things are defined, for the whole document, before + * continuing on with `text`, as whether a link or image reference forms or + * not depends on whether it’s defined. + * This unfortunately prevents a true streaming markdown to HTML compiler. + * + * `text` contains phrasing content such as attention (emphasis, strong), + * media (links, images), and actual text. + * + * `string` is a limited `text` like content type which only allows character + * references and character escapes. + * It exists in things such as identifiers (media references, definitions), + * titles, or URLs. + */ +export type ContentType = 'content' | 'document' | 'flow' | 'string' | 'text' + +/** + * A location in the document (`line`/`column`/`offset`) and chunk (`_index`, + * `_bufferIndex`). + * + * `_bufferIndex` is `-1` when `_index` points to a code chunk and it’s a + * non-negative integer when pointing to a string chunk. + * + * The interface for the location in the document comes from unist `Point`: + * <https://github.com/syntax-tree/unist#point> + */ +export interface Point { + /** + * Position in a string chunk (or `-1` when pointing to a numeric chunk). + */ + _bufferIndex: number + + /** + * Position in a list of chunks. + */ + _index: number + + /** + * 1-indexed column number. + */ + column: number + + /** + * 1-indexed line number. + */ + line: number + + /** + * 0-indexed position in the document. + */ + offset: number +} + +/** + * A token: a span of chunks. + * + * Tokens are what the core of micromark produces: the built in HTML compiler + * or other tools can turn them into different things. + * + * Tokens are essentially names attached to a slice of chunks, such as + * `lineEndingBlank` for certain line endings, or `codeFenced` for a whole + * fenced code. + * + * Sometimes, more info is attached to tokens, such as `_open` and `_close` + * by `attention` (strong, emphasis) to signal whether the sequence can open + * or close an attention run. + * + * Linked tokens are used because outer constructs are parsed first. + * Take for example: + * + * ```markdown + * > *a + * b*. + * ``` + * + * 1. The block quote marker and the space after it is parsed first + * 2. The rest of the line is a `chunkFlow` token + * 3. The two spaces on the second line are a `linePrefix` + * 4. The rest of the line is another `chunkFlow` token + * + * The two `chunkFlow` tokens are linked together. + * The chunks they span are then passed through the flow tokenizer. + */ +export interface Token { + /** + * Token type. + */ + type: TokenType + + /** + * Point where the token starts. + */ + start: Point + + /** + * Point where the token ends. + */ + end: Point + + /** + * The previous token in a list of linked tokens. + */ + previous?: Token | undefined + + /** + * The next token in a list of linked tokens. + */ + next?: Token | undefined + + /** + * Declares a token as having content of a certain type. + */ + contentType?: ContentType | undefined + + /** + * Declares that trailing whitespace is sensitive, + * is allowed, + * when `contentType` is `text` (or `string`). + * Normally, + * trailing spaces and tabs are dropped. + */ + _contentTypeTextTrailing?: boolean | undefined + + /** + * Connected tokenizer. + * + * Used when dealing with linked tokens. + * A child tokenizer is needed to tokenize them, which is stored on those + * tokens. + */ + _tokenizer?: TokenizeContext | undefined + + /** + * Field to help parse attention. + * + * Depending on the character before sequences (`**`), the sequence can open, + * close, both, or none. + */ + _open?: boolean | undefined + + /** + * Field to help parse attention. + * + * Depending on the character before sequences (`**`), the sequence can open, + * close, both, or none. + */ + _close?: boolean | undefined + + /** + * Field to help parse GFM task lists. + * + * This boolean is used internally to figure out if a token is in the first + * content of a list item construct. + */ + _isInFirstContentOfListItem?: boolean | undefined + + /** + * Field to help parse containers. + * + * This boolean is used internally to figure out if a token is a container + * token. + */ + _container?: boolean | undefined + + /** + * Field to help parse lists. + * + * This boolean is used internally to figure out if a list is loose or not. + */ + _loose?: boolean | undefined + + /** + * Field to help parse links. + * + * This boolean is used internally to figure out if a link opening + * can’t be used (because links in links are incorrect). + */ + _inactive?: boolean | undefined + + /** + * Field to help parse links. + * + * This boolean is used internally to figure out if a link opening is + * balanced: it’s not a link opening but has a balanced closing. + */ + _balanced?: boolean | undefined +} + +/** + * The start or end of a token amongst other events. + * + * Tokens can “contain” other tokens, even though they are stored in a flat + * list, through `enter`ing before them, and `exit`ing after them. + */ +export type Event = ['enter' | 'exit', Token, TokenizeContext] + +/** + * Open a token. + * + * @param type + * Token type. + * @param fields + * Extra fields. + * @returns {Token} + * Token. + */ +export type Enter = ( + type: TokenType, + fields?: Omit<Partial<Token>, 'type'> | undefined +) => Token + +/** + * Close a token. + * + * @param type + * Token type. + * @returns + * Token. + */ +export type Exit = (type: TokenType) => Token + +/** + * Deal with the character and move to the next. + * + * @param code + * Current code. + */ +export type Consume = (code: Code) => undefined + +/** + * Attempt deals with several values, and tries to parse according to those + * values. + * + * If a value resulted in `ok`, it worked, the tokens that were made are used, + * and `ok` is switched to. + * If the result is `nok`, the attempt failed, so we revert to the original + * state, and `nok` is used. + * + * @param construct + * Construct(s) to try. + * @param ok + * State to move to when successful. + * @param nok + * State to move to when unsuccessful. + * @returns + * Next state. + */ +export type Attempt = ( + construct: Array<Construct> | ConstructRecord | Construct, + ok: State, + nok?: State | undefined +) => State + +/** + * A context object to transition the state machine. + */ +export interface Effects { + /** + * Try to tokenize a construct. + */ + attempt: Attempt + + /** + * Attempt, then revert. + */ + check: Attempt + + /** + * Deal with the character and move to the next. + */ + consume: Consume + + /** + * Start a new token. + */ + enter: Enter + + /** + * End a started token. + */ + exit: Exit + + /** + * Interrupt is used for stuff right after a line of content. + */ + interrupt: Attempt +} + +/** + * The main unit in the state machine: a function that gets a character code + * and has certain effects. + * + * A state function should return another function: the next + * state-as-a-function to go to. + * + * But there is one case where they return `undefined`: for the eof character + * code (at the end of a value). + * The reason being: well, there isn’t any state that makes sense, so + * `undefined` works well. + * Practically that has also helped: if for some reason it was a mistake, then + * an exception is throw because there is no next function, meaning it + * surfaces early. + * + * @param code + * Current code. + * @returns + * Next state. + */ +export type State = (code: Code) => State | undefined + +/** + * A resolver handles and cleans events coming from `tokenize`. + * + * @param events + * List of events. + * @param context + * Tokenize context. + * @returns + * The given, modified, events. + */ +export type Resolver = ( + events: Array<Event>, + context: TokenizeContext +) => Array<Event> + +/** + * A tokenize function sets up a state machine to handle character codes streaming in. + * + * @param this + * Tokenize context. + * @param effects + * Effects. + * @param ok + * State to go to when successful. + * @param nok + * State to go to when unsuccessful. + * @returns + * First state. + */ +export type Tokenizer = ( + this: TokenizeContext, + effects: Effects, + ok: State, + nok: State +) => State + +/** + * Like a tokenizer, but without `ok` or `nok`. + * + * @param this + * Tokenize context. + * @param effects + * Effects. + * @returns + * First state. + */ +export type Initializer = (this: TokenizeContext, effects: Effects) => State + +/** + * Like a tokenizer, but without `ok` or `nok`, and returning `undefined`. + * + * This is the final hook when a container must be closed. + * + * @param this + * Tokenize context. + * @param effects + * Effects. + * @returns + * Nothing. + */ +export type Exiter = (this: TokenizeContext, effects: Effects) => undefined + +/** + * Guard whether `code` can come before the construct. + * + * In certain cases a construct can hook into many potential start characters. + * Instead of setting up an attempt to parse that construct for most + * characters, this is a speedy way to reduce that. + * + * @param this + * Tokenize context. + * @param code + * Previous code. + * @returns + * Whether `code` is allowed before. + */ +export type Previous = (this: TokenizeContext, code: Code) => boolean + +/** + * An object describing how to parse a markdown construct. + */ +export interface Construct { + /** + * Whether the construct, when in a `ConstructRecord`, precedes over existing + * constructs for the same character code when merged. + * + * The default is that new constructs precede over existing ones. + */ + add?: 'after' | 'before' | undefined + + /** + * Concrete constructs cannot be interrupted by more containers. + * + * For example, when parsing the document (containers, such as block quotes + * and lists) and this construct is parsing fenced code: + * + * ````markdown + * > ```js + * > - list? + * ```` + * + * …then `- list?` cannot form if this fenced code construct is concrete. + * + * An example of a construct that is not concrete is a GFM table: + * + * ````markdown + * | a | + * | - | + * > | b | + * ```` + * + * …`b` is not part of the table. + */ + concrete?: boolean | undefined + + /** + * For containers, a continuation construct. + */ + continuation?: Construct | undefined + + /** + * For containers, a final hook. + */ + exit?: Exiter | undefined + + /** + * Name of the construct, used to toggle constructs off. + * + * Named constructs must not be `partial`. + */ + name?: string | undefined + + /** + * Whether this construct represents a partial construct. + * + * Partial constructs must not have a `name`. + */ + partial?: boolean | undefined + + /** + * Guard whether the previous character can come before the construct. + */ + previous?: Previous | undefined + + /** + * Resolve all events when the content is complete, from the start to the end. + * Only used if `tokenize` is successful once in the content. + * + * For example, if we’re currently parsing a link title and this construct + * parses character references, then `resolveAll` is called *if* at least one + * character reference is found, ranging from the start to the end of the link + * title to the end. + */ + resolveAll?: Resolver | undefined + + /** + * Resolve the events from the start of the content (which includes other + * constructs) to the last one parsed by `tokenize`. + * + * For example, if we’re currently parsing a link title and this construct + * parses character references, then `resolveTo` is called with the events + * ranging from the start of the link title to the end of a character + * reference each time one is found. + */ + resolveTo?: Resolver | undefined + + /** + * Resolve the events parsed by `tokenize`. + * + * For example, if we’re currently parsing a link title and this construct + * parses character references, then `resolve` is called with the events + * ranging from the start to the end of a character reference each time one is + * found. + */ + resolve?: Resolver | undefined + + /** + * Set up a state machine to handle character codes streaming in. + */ + tokenize: Tokenizer +} + +/** + * Like a construct, but `tokenize` does not accept `ok` or `nok`. + */ +export interface InitialConstruct extends Omit<Construct, 'tokenize'> { + tokenize: Initializer +} + +/** + * Several constructs, mapped from their initial codes. + */ +export type ConstructRecord = Record< + string, + Array<Construct> | Construct | undefined +> + +/** + * State shared between container calls. + */ +export interface ContainerState { + /** + * Special field to close the current flow (or containers). + */ + _closeFlow?: boolean | undefined + + /** + * Whether there are further blank lines, used by lists. + */ + furtherBlankLines?: boolean | undefined + + /** + * Whether there first line is blank, used by lists. + */ + initialBlankLine?: boolean | undefined + + /** + * Current marker, used by lists. + */ + marker?: Code | undefined + + /** + * Used by block quotes. + */ + open?: boolean | undefined + + /** + * Current size, used by lists. + */ + size?: number | undefined + + /** + * Current token type, used by lists. + */ + type?: TokenType | undefined +} + +/** + * A context object that helps w/ tokenizing markdown constructs. + */ +export interface TokenizeContext { + // To do: next major: remove `_gfmTableDynamicInterruptHack` (no longer + // needed in micromark-extension-gfm-table@1.0.6). + /** + * Internal boolean shared with `micromark-extension-gfm-table` whose body + * rows are not affected by normal interruption rules. + * “Normal” rules are, for example, that an empty list item can’t interrupt: + * + * ````markdown + * a + * * + * ```` + * + * The above is one paragraph. + * These rules don’t apply to table body rows: + * + * ````markdown + * | a | + * | - | + * * + * ```` + * + * The above list interrupts the table. + */ + _gfmTableDynamicInterruptHack?: boolean + + /** + * Internal boolean shared with `micromark-extension-gfm-task-list-item` to + * signal whether the tokenizer is tokenizing the first content of a list item + * construct. + */ + _gfmTasklistFirstContentOfListItem?: boolean | undefined + + /** + * Declares that trailing whitespace is sensitive, + * is allowed, + * when tokenizing `text` (or `string`). + * Normally, + * trailing spaces and tabs are dropped. + */ + _contentTypeTextTrailing?: boolean | undefined + + /** + * Current code. + */ + code: Code + + /** + * Share state set when parsing containers. + * + * Containers are parsed in separate phases: their first line (`tokenize`), + * continued lines (`continuation.tokenize`), and finally `exit`. + * This record can be used to store some information between these hooks. + */ + containerState?: ContainerState | undefined + + /** + * The current construct. + * + * Constructs that are not `partial` are set here. + */ + currentConstruct?: Construct | undefined + + /** + * Current list of events. + */ + events: Array<Event> + + /** + * Whether we’re currently interrupting. + * + * Take for example: + * + * ```markdown + * a + * # b + * ``` + * + * At 2:1, we’re “interrupting”. + */ + interrupt?: boolean | undefined + + /** + * The relevant parsing context. + */ + parser: ParseContext + + /** + * The previous code. + */ + previous: Code + + /** + * Define a skip + * + * As containers (block quotes, lists), “nibble” a prefix from the margins, + * where a line starts after that prefix is defined here. + * When the tokenizers moves after consuming a line ending corresponding to + * the line number in the given point, the tokenizer shifts past the prefix + * based on the column in the shifted point. + * + * @param point + * Skip. + * @returns + * Nothing. + */ + defineSkip(point: Point): undefined + + /** + * Get the current place. + * + * @returns + * Current point. + */ + now(): Point + + /** + * Get the source text that spans a token (or location). + * + * @param token + * Start/end in stream. + * @param expandTabs + * Whether to expand tabs. + * @returns + * Serialized chunks. + */ + sliceSerialize( + token: Pick<Token, 'end' | 'start'>, + expandTabs?: boolean | undefined + ): string + + /** + * Get the chunks that span a token (or location). + * + * @param token + * Start/end in stream. + * @returns + * List of chunks. + */ + sliceStream(token: Pick<Token, 'end' | 'start'>): Array<Chunk> + + /** + * Write a slice of chunks. + * + * The eof code (`null`) can be used to signal the end of the stream. + * + * @param slice + * Chunks. + * @returns + * Events. + */ + write(slice: Array<Chunk>): Array<Event> +} + +/** + * Encodings supported by `TextEncoder`. + * + * Arbitrary encodings can be supported depending on how the engine is built. + * So any string *could* be valid. + * But you probably want `utf-8`. + */ +export type Encoding = + // Encodings supported in Node by default or when built with the small-icu option. + // Does not include aliases. + | 'utf-8' // Always supported in Node. + | 'utf-16le' // Always supported in Node. + | 'utf-16be' // Not supported when ICU is disabled. + // Everything else (depends on browser, or full ICU data). + // eslint-disable-next-line @typescript-eslint/ban-types + | (string & {}) + +/** + * Contents of the file. + * + * Can either be text, or a `Uint8Array` like structure. + */ +export type Value = Uint8Array | string + +/** + * A syntax extension changes how markdown is tokenized. + * + * See: <https://github.com/micromark/micromark#syntaxextension> + */ +export interface Extension { + attentionMarkers?: {null?: Array<Code> | undefined} | undefined + contentInitial?: ConstructRecord | undefined + disable?: {null?: Array<string> | undefined} | undefined + document?: ConstructRecord | undefined + flowInitial?: ConstructRecord | undefined + flow?: ConstructRecord | undefined + insideSpan?: + | {null?: Array<Pick<Construct, 'resolveAll'>> | undefined} + | undefined + string?: ConstructRecord | undefined + text?: ConstructRecord | undefined +} + +/** + * A filtered, combined, extension. + */ +export type NormalizedExtension = { + [Key in keyof Extension]: Exclude<Extension[Key], undefined> +} + +/** + * A full, filtereed, normalized, extension. + */ +export type FullNormalizedExtension = { + [Key in keyof Extension]-?: Exclude<Extension[Key], undefined> +} + +/** + * Create a context. + * + * @param from + * Where to create from. + * @returns + * Context. + */ +export type Create = ( + from?: Omit<Point, '_bufferIndex' | '_index'> | undefined +) => TokenizeContext + +/** + * Config defining how to parse. + */ +export interface ParseOptions { + /** + * Array of syntax extensions (default: `[]`). + */ + extensions?: Array<Extension> | null | undefined +} + +/** + * A context object that helps w/ parsing markdown. + */ +export interface ParseContext { + /** + * All constructs. + */ + constructs: FullNormalizedExtension + + /** + * List of defined identifiers. + */ + defined: Array<string> + + /** + * Map of line numbers to whether they are lazy (as opposed to the line before + * them). + * Take for example: + * + * ```markdown + * > a + * b + * ``` + * + * L1 here is not lazy, L2 is. + */ + lazy: Record<number, boolean> + + /** + * Create a content tokenizer. + */ + content: Create + + /** + * Create a document tokenizer. + */ + document: Create + + /** + * Create a flow tokenizer. + */ + flow: Create + + /** + * Create a string tokenizer. + */ + string: Create + + /** + * Create a text tokenizer. + */ + text: Create +} + +/** + * HTML compiler context. + */ +export interface CompileContext { + /** + * Configuration passed by the user. + */ + options: CompileOptions + + /** + * Capture some of the output data. + * + * @returns + * Nothing. + */ + buffer(): undefined + + /** + * Make a value safe for injection in HTML (except w/ `ignoreEncode`). + * + * @param value + * Raw value. + * @returns + * Safe value. + */ + encode(value: string): string + + /** + * Get data from the key-value store. + * + * @param key + * Key. + * @returns + * Value at `key` in compile data. + */ + getData<Key extends keyof CompileData>(key: Key): CompileData[Key] + + /** + * Output an extra line ending if the previous value wasn’t EOF/EOL. + * + * @returns + * Nothing. + */ + lineEndingIfNeeded(): undefined + + /** + * Output raw data. + * + * @param value + * Raw value. + * @returns + * Nothing. + */ + raw(value: string): undefined + + /** + * Stop capturing and access the output data. + * + * @returns + * Captured data. + */ + resume(): string + + /** + * Set data into the key-value store. + * + * @param key + * Key. + * @param value + * Value. + * @returns + * Nothing. + */ + setData<Key extends keyof CompileData>( + key: Key, + value?: CompileData[Key] + ): undefined + + /** + * Get the string value of a token. + * + * @param token + * Start/end in stream. + * @param expandTabs + * Whether to expand tabs. + * @returns + * Serialized chunks. + */ + sliceSerialize( + token: Pick<Token, 'end' | 'start'>, + expandTabs?: boolean | undefined + ): string + + /** + * Output (parts of) HTML tags. + * + * @param value + * Raw value. + * @returns + * Nothing. + */ + tag(value: string): undefined +} + +/** + * Serialize micromark events as HTML. + */ +export type Compile = (events: Array<Event>) => string + +/** + * Handle one token. + * + * @param token + * Token. + * @returns + * Nothing. + */ +export type Handle = (this: CompileContext, token: Token) => undefined + +/** + * Handle the whole document. + * + * @returns + * Nothing. + */ +export type DocumentHandle = ( + this: Omit<CompileContext, 'sliceSerialize'> +) => undefined + +/** + * Token types mapping to handles. + */ +export interface Handles extends Partial<Record<TokenType, Handle>> { + /** + * Document handle. + */ + null?: DocumentHandle +} + +/** + * Normalized extenion. + */ +export interface HtmlExtension { + enter?: Handles | undefined + exit?: Handles | undefined +} + +/** + * An HTML extension changes how markdown tokens are serialized. + */ +export type NormalizedHtmlExtension = { + [Key in keyof HtmlExtension]-?: Exclude<HtmlExtension[Key], undefined> +} + +/** + * Definition. + */ +export interface Definition { + /** + * Destination. + */ + destination?: string | undefined + /** + * Title. + */ + title?: string | undefined +} + +/** + * State tracked to compile events as HTML. + */ +export interface CompileData { + /** + * Whether the first list item is expected, used by lists. + */ + expectFirstItem?: boolean | undefined + + /** + * Current character reference kind. + */ + characterReferenceType?: string | undefined + + /** + * Collected definitions. + */ + definitions: Record<string, Definition> + + /** + * Whether we’re in fenced code, used by code (fenced). + */ + fencedCodeInside?: boolean | undefined + + /** + * Number of fences that were seen, used by code (fenced). + */ + fencesCount?: number | undefined + + /** + * Whether we’ve seen code data, used by code (fenced, indented). + */ + flowCodeSeenData?: boolean | undefined + + /** + * Current heading rank, used by heading (atx, setext). + */ + headingRank?: number | undefined + + /** + * Ignore encoding unsafe characters, used for example for URLs which are + * first percent encoded, or by HTML when supporting it. + */ + ignoreEncode?: boolean | undefined + + /** + * Whether we’re in code data, used by code (text). + */ + inCodeText?: boolean | undefined + + /** + * Whether the last emitted value was a tag. + */ + lastWasTag?: boolean | undefined + + /** + * Whether to slurp all future line endings (has to be unset manually). + */ + slurpAllLineEndings?: boolean | undefined + + /** + * Whether to slurp the next line ending (resets itself on the next line + * ending). + */ + slurpOneLineEnding?: boolean | undefined + + /** + * Stack of containers, whether they’re tight or not. + */ + tightStack: Array<boolean> +} + +/** + * Type of line ending in markdown. + */ +export type LineEnding = '\r' | '\n' | '\r\n' + +/** + * Compile options. + */ +export interface CompileOptions { + /** + * Whether to allow (dangerous) HTML (`boolean`, default: `false`). + * + * The default is `false`, which still parses the HTML according to + * `CommonMark` but shows the HTML as text instead of as elements. + * + * Pass `true` for trusted content to get actual HTML elements. + */ + allowDangerousHtml?: boolean | null | undefined + + /** + * Whether to allow dangerous protocols in links and images (`boolean`, + * default: `false`). + * + * The default is `false`, which drops URLs in links and images that use + * dangerous protocols. + * + * Pass `true` for trusted content to support all protocols. + * + * URLs that have no protocol (which means it’s relative to the current page, + * such as `./some/page.html`) and URLs that have a safe protocol (for + * images: `http`, `https`; for links: `http`, `https`, `irc`, `ircs`, + * `mailto`, `xmpp`), are safe. + * All other URLs are dangerous and dropped. + */ + allowDangerousProtocol?: boolean | null | undefined + + /** + * Default line ending to use when compiling to HTML, for line endings not in + * `value`. + * + * Generally, `micromark` copies line endings (`\r`, `\n`, `\r\n`) in the + * markdown document over to the compiled HTML. + * In some cases, such as `> a`, CommonMark requires that extra line endings + * are added: `<blockquote>\n<p>a</p>\n</blockquote>`. + * + * To create that line ending, the document is checked for the first line + * ending that is used. + * If there is no line ending, `defaultLineEnding` is used. + * If that isn’t configured, `\n` is used. + */ + defaultLineEnding?: LineEnding | null | undefined + + /** + * Array of HTML extensions (default: `[]`). + */ + htmlExtensions?: Array<HtmlExtension> | null | undefined +} + +/** + * Configuration. + */ +export type Options = CompileOptions & ParseOptions + +/** + * Enum of allowed token types. + */ +export type TokenType = keyof TokenTypeMap + +// Note: when changing the next interface, you likely also have to change +// `micromark-util-symbol`. +/** + * Map of allowed token types. + */ +export interface TokenTypeMap { + // Note: these are compiled away. + attentionSequence: 'attentionSequence' // To do: remove. + space: 'space' // To do: remove. + + data: 'data' + whitespace: 'whitespace' + lineEnding: 'lineEnding' + lineEndingBlank: 'lineEndingBlank' + linePrefix: 'linePrefix' + lineSuffix: 'lineSuffix' + atxHeading: 'atxHeading' + atxHeadingSequence: 'atxHeadingSequence' + atxHeadingText: 'atxHeadingText' + autolink: 'autolink' + autolinkEmail: 'autolinkEmail' + autolinkMarker: 'autolinkMarker' + autolinkProtocol: 'autolinkProtocol' + characterEscape: 'characterEscape' + characterEscapeValue: 'characterEscapeValue' + characterReference: 'characterReference' + characterReferenceMarker: 'characterReferenceMarker' + characterReferenceMarkerNumeric: 'characterReferenceMarkerNumeric' + characterReferenceMarkerHexadecimal: 'characterReferenceMarkerHexadecimal' + characterReferenceValue: 'characterReferenceValue' + codeFenced: 'codeFenced' + codeFencedFence: 'codeFencedFence' + codeFencedFenceSequence: 'codeFencedFenceSequence' + codeFencedFenceInfo: 'codeFencedFenceInfo' + codeFencedFenceMeta: 'codeFencedFenceMeta' + codeFlowValue: 'codeFlowValue' + codeIndented: 'codeIndented' + codeText: 'codeText' + codeTextData: 'codeTextData' + codeTextPadding: 'codeTextPadding' + codeTextSequence: 'codeTextSequence' + content: 'content' + definition: 'definition' + definitionDestination: 'definitionDestination' + definitionDestinationLiteral: 'definitionDestinationLiteral' + definitionDestinationLiteralMarker: 'definitionDestinationLiteralMarker' + definitionDestinationRaw: 'definitionDestinationRaw' + definitionDestinationString: 'definitionDestinationString' + definitionLabel: 'definitionLabel' + definitionLabelMarker: 'definitionLabelMarker' + definitionLabelString: 'definitionLabelString' + definitionMarker: 'definitionMarker' + definitionTitle: 'definitionTitle' + definitionTitleMarker: 'definitionTitleMarker' + definitionTitleString: 'definitionTitleString' + emphasis: 'emphasis' + emphasisSequence: 'emphasisSequence' + emphasisText: 'emphasisText' + escapeMarker: 'escapeMarker' + hardBreakEscape: 'hardBreakEscape' + hardBreakTrailing: 'hardBreakTrailing' + htmlFlow: 'htmlFlow' + htmlFlowData: 'htmlFlowData' + htmlText: 'htmlText' + htmlTextData: 'htmlTextData' + image: 'image' + label: 'label' + labelText: 'labelText' + labelLink: 'labelLink' + labelImage: 'labelImage' + labelMarker: 'labelMarker' + labelImageMarker: 'labelImageMarker' + labelEnd: 'labelEnd' + link: 'link' + paragraph: 'paragraph' + reference: 'reference' + referenceMarker: 'referenceMarker' + referenceString: 'referenceString' + resource: 'resource' + resourceDestination: 'resourceDestination' + resourceDestinationLiteral: 'resourceDestinationLiteral' + resourceDestinationLiteralMarker: 'resourceDestinationLiteralMarker' + resourceDestinationRaw: 'resourceDestinationRaw' + resourceDestinationString: 'resourceDestinationString' + resourceMarker: 'resourceMarker' + resourceTitle: 'resourceTitle' + resourceTitleMarker: 'resourceTitleMarker' + resourceTitleString: 'resourceTitleString' + setextHeading: 'setextHeading' + setextHeadingText: 'setextHeadingText' + setextHeadingLine: 'setextHeadingLine' + setextHeadingLineSequence: 'setextHeadingLineSequence' + strong: 'strong' + strongSequence: 'strongSequence' + strongText: 'strongText' + thematicBreak: 'thematicBreak' + thematicBreakSequence: 'thematicBreakSequence' + blockQuote: 'blockQuote' + blockQuotePrefix: 'blockQuotePrefix' + blockQuoteMarker: 'blockQuoteMarker' + blockQuotePrefixWhitespace: 'blockQuotePrefixWhitespace' + listOrdered: 'listOrdered' + listUnordered: 'listUnordered' + listItemIndent: 'listItemIndent' + listItemMarker: 'listItemMarker' + listItemPrefix: 'listItemPrefix' + listItemPrefixWhitespace: 'listItemPrefixWhitespace' + listItemValue: 'listItemValue' + chunkDocument: 'chunkDocument' + chunkContent: 'chunkContent' + chunkFlow: 'chunkFlow' + chunkText: 'chunkText' + chunkString: 'chunkString' +} diff --git a/tools/ui/node_modules/micromark-util-types/index.js b/tools/ui/node_modules/micromark-util-types/index.js new file mode 100644 index 0000000000000000000000000000000000000000..00d55de7b116199ec457a92a41cfde3a1489c5de --- /dev/null +++ b/tools/ui/node_modules/micromark-util-types/index.js @@ -0,0 +1,2 @@ +// Note: types exported from `index.d.ts`. +export {} diff --git a/tools/ui/node_modules/micromark-util-types/license b/tools/ui/node_modules/micromark-util-types/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark-util-types/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark-util-types/package.json b/tools/ui/node_modules/micromark-util-types/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b56d6483ba581657d2e3c7f1b285b8b7a872793b --- /dev/null +++ b/tools/ui/node_modules/micromark-util-types/package.json @@ -0,0 +1,71 @@ +{ + "name": "micromark-util-types", + "version": "2.0.2", + "description": "micromark utility with a couple of typescript types", + "license": "MIT", + "keywords": [ + "micromark", + "util", + "utility", + "typescript", + "types" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark-util-types", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "index.d.ts.map", + "index.d.ts", + "index.js" + ], + "exports": "./index.js", + "xo": { + "envs": [ + "shared-node-browser" + ], + "overrides": [ + { + "files": [ + "**/*.d.ts" + ], + "rules": { + "@typescript-eslint/array-type": [ + "error", + { + "default": "generic" + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true + } + ], + "@typescript-eslint/consistent-type-definitions": [ + "error", + "interface" + ] + } + } + ], + "prettier": true, + "rules": { + "unicorn/text-encoding-identifier-case": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark-util-types/readme.md b/tools/ui/node_modules/micromark-util-types/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..361624a3f5a7e374795af4eb0a0909f7c067cfa1 --- /dev/null +++ b/tools/ui/node_modules/micromark-util-types/readme.md @@ -0,0 +1,151 @@ +# micromark-util-types + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +[micromark][] utility package with TypeScript types. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This package exposes TypeScript types shared throughout the micromark +ecosystem. + +## When should I use this? + +This package is useful when you are making your own, typed, micromark +extensions. + +## Install + +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark-util-types +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import type {Point, /* … */} from 'https://esm.sh/micromark-util-types@1' +``` + +## Use + +```js +/** + * @import {Point} from 'micromark-util-types' + */ +``` + +## API + +This module exports no identifiers. +There is no default export. + +See [the code][code] for all about the exposed types. + +## Types + +This package is just [TypeScript][] types. +It exports lots of different types. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, +`micromark-util-types@2`, compatible with Node.js 16. +This package works with `micromark@3`. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[bundle-size]: https://bundlejs.com/?q=micromark-util-encode + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-util-encode + +[chat]: https://github.com/micromark/micromark/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[code]: https://github.com/micromark/micromark/blob/main/packages/micromark-util-types/index.d.ts + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/micromark/micromark + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[downloads]: https://www.npmjs.com/package/micromark-util-encode + +[downloads-badge]: https://img.shields.io/npm/dm/micromark-util-encode.svg + +[esmsh]: https://esm.sh + +[health]: https://github.com/micromark/.github + +[license]: https://github.com/micromark/micromark/blob/main/license + +[micromark]: https://github.com/micromark/micromark + +[npm]: https://docs.npmjs.com/cli/install + +[opencollective]: https://opencollective.com/unified + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[typescript]: https://www.typescriptlang.org diff --git a/tools/ui/node_modules/micromark/dev/index.d.ts b/tools/ui/node_modules/micromark/dev/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46d294ea1d1cb82ef885834c68917966dc517675 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/index.d.ts @@ -0,0 +1,82 @@ +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value: Value, encoding: Encoding | null | undefined, options?: Options | null | undefined): string; +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value: Value, options?: Options | null | undefined): string; +export { compile } from "./lib/compile.js"; +export { parse } from "./lib/parse.js"; +export { postprocess } from "./lib/postprocess.js"; +export { preprocess } from "./lib/preprocess.js"; +export type Options = import("micromark-util-types").Options; +import type { Value } from 'micromark-util-types'; +import type { Encoding } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/index.d.ts.map b/tools/ui/node_modules/micromark/dev/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..be751c4343886457124c00c82ae8c74640b962c9 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG,iCACQ,KAAK,YAEL,QAAQ,GAAG,IAAI,GAAG,SAAS,YAG3B,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAGhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCACQ,KAAK,YAEL,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAGhB;;;;;sBAvCU,OAAO,sBAAsB,EAAE,OAAO;2BAJjB,sBAAsB;8BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/index.js b/tools/ui/node_modules/micromark/dev/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e608e4db0b0b5fe893c51bfeb7002ee10e6ec512 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/index.js @@ -0,0 +1,68 @@ +/** + * @import {Encoding, Value} from 'micromark-util-types' + */ + +/** + * @typedef {import('micromark-util-types').Options} Options + */ + +import {compile} from './lib/compile.js' +import {parse} from './lib/parse.js' +import {postprocess} from './lib/postprocess.js' +import {preprocess} from './lib/preprocess.js' + +export {compile} from './lib/compile.js' +export {parse} from './lib/parse.js' +export {postprocess} from './lib/postprocess.js' +export {preprocess} from './lib/preprocess.js' + +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding + encoding = undefined + } + + return compile(options)( + postprocess( + parse(options) + .document() + .write(preprocess()(value, encoding, true)) + ) + ) +} diff --git a/tools/ui/node_modules/micromark/dev/lib/compile.d.ts b/tools/ui/node_modules/micromark/dev/lib/compile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..819d119153c6f01e4810b2afb1fe92f12b340d35 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/compile.d.ts @@ -0,0 +1,16 @@ +/** + * @param {CompileOptions | null | undefined} [options] + * @returns {Compile} + */ +export function compile(options?: CompileOptions | null | undefined): Compile; +export type Media = { + image?: boolean | undefined; + labelId?: string | undefined; + label?: string | undefined; + referenceId?: string | undefined; + destination?: string | undefined; + title?: string | undefined; +}; +import type { CompileOptions } from 'micromark-util-types'; +import type { Compile } from 'micromark-util-types'; +//# sourceMappingURL=compile.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/compile.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/compile.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e8a8c7fa8874424e500599307d99b2a87347263c --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/compile.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["compile.js"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,kCAHW,cAAc,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,CAgkCnB;;YA/lCa,OAAO,GAAG,SAAS;cACnB,MAAM,GAAG,SAAS;YAClB,MAAM,GAAG,SAAS;kBAClB,MAAM,GAAG,SAAS;kBAClB,MAAM,GAAG,SAAS;YAClB,MAAM,GAAG,SAAS;;oCAVtB,sBAAsB;6BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/compile.js b/tools/ui/node_modules/micromark/dev/lib/compile.js new file mode 100644 index 0000000000000000000000000000000000000000..acfb1b6fd3cb08910520e1cb139191e29a27dd50 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/compile.js @@ -0,0 +1,1152 @@ +/** + * While micromark is a lexer/tokenizer, the common case of going from markdown + * to html is currently built in as this module, even though the parts can be + * used separately to build ASTs, CSTs, or many other output formats. + * + * Having an HTML compiler built in is useful because it allows us to check for + * compliancy to CommonMark, the de facto norm of markdown, specified in roughly + * 600 input/output cases. + * + * This module has an interface that accepts lists of events instead of the + * whole at once, however, because markdown can’t be truly streaming, we buffer + * events before processing and outputting the final result. + */ + +/** + * @import { + * CompileContext, + * CompileData, + * CompileOptions, + * Compile, + * Definition, + * Event, + * Handle, + * HtmlExtension, + * LineEnding, + * NormalizedHtmlExtension, + * Token + * } from 'micromark-util-types' + */ + +/** + * @typedef Media + * @property {boolean | undefined} [image] + * @property {string | undefined} [labelId] + * @property {string | undefined} [label] + * @property {string | undefined} [referenceId] + * @property {string | undefined} [destination] + * @property {string | undefined} [title] + */ + +import {decodeNamedCharacterReference} from 'decode-named-character-reference' +import {ok as assert} from 'devlop' +import {push} from 'micromark-util-chunked' +import {combineHtmlExtensions} from 'micromark-util-combine-extensions' +import {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference' +import {encode as _encode} from 'micromark-util-encode' +import {normalizeIdentifier} from 'micromark-util-normalize-identifier' +import {sanitizeUri} from 'micromark-util-sanitize-uri' +import {codes, constants, types} from 'micromark-util-symbol' + +const hasOwnProperty = {}.hasOwnProperty + +/** + * These two are allowlists of safe protocols for full URLs in respectively the + * `href` (on `<a>`) and `src` (on `<img>`) attributes. + * They are based on what is allowed on GitHub, + * <https://github.com/syntax-tree/hast-util-sanitize/blob/9275b21/lib/github.json#L31> + */ +const protocolHref = /^(https?|ircs?|mailto|xmpp)$/i +const protocolSource = /^https?$/i + +/** + * @param {CompileOptions | null | undefined} [options] + * @returns {Compile} + */ +export function compile(options) { + const settings = options || {} + + /** + * Tags is needed because according to markdown, links and emphasis and + * whatnot can exist in images, however, as HTML doesn’t allow content in + * images, the tags are ignored in the `alt` attribute, but the content + * remains. + * + * @type {boolean | undefined} + */ + let tags = true + + /** + * An object to track identifiers to media (URLs and titles) defined with + * definitions. + * + * @type {Record<string, Definition>} + */ + const definitions = {} + + /** + * A lot of the handlers need to capture some of the output data, modify it + * somehow, and then deal with it. + * We do that by tracking a stack of buffers, that can be opened (with + * `buffer`) and closed (with `resume`) to access them. + * + * @type {Array<Array<string>>} + */ + const buffers = [[]] + + /** + * As we can have links in images and the other way around, where the deepest + * ones are closed first, we need to track which one we’re in. + * + * @type {Array<Media>} + */ + const mediaStack = [] + + /** + * Same as `mediaStack` for tightness, which is specific to lists. + * We need to track if we’re currently in a tight or loose container. + * + * @type {Array<boolean>} + */ + const tightStack = [] + + /** @type {HtmlExtension} */ + const defaultHandlers = { + enter: { + blockQuote: onenterblockquote, + codeFenced: onentercodefenced, + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: onentercodeindented, + codeText: onentercodetext, + content: onentercontent, + definition: onenterdefinition, + definitionDestinationString: onenterdefinitiondestinationstring, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: onenteremphasis, + htmlFlow: onenterhtmlflow, + htmlText: onenterhtml, + image: onenterimage, + label: buffer, + link: onenterlink, + listItemMarker: onenterlistitemmarker, + listItemValue: onenterlistitemvalue, + listOrdered: onenterlistordered, + listUnordered: onenterlistunordered, + paragraph: onenterparagraph, + reference: buffer, + resource: onenterresource, + resourceDestinationString: onenterresourcedestinationstring, + resourceTitleString: buffer, + setextHeading: onentersetextheading, + strong: onenterstrong + }, + exit: { + atxHeading: onexitatxheading, + atxHeadingSequence: onexitatxheadingsequence, + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: onexitblockquote, + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: onexitflowcode, + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: onresumedrop, + codeFlowValue: onexitcodeflowvalue, + codeIndented: onexitflowcode, + codeText: onexitcodetext, + codeTextData: onexitdata, + data: onexitdata, + definition: onexitdefinition, + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: onexitemphasis, + hardBreakEscape: onexithardbreak, + hardBreakTrailing: onexithardbreak, + htmlFlow: onexithtml, + htmlFlowData: onexitdata, + htmlText: onexithtml, + htmlTextData: onexitdata, + image: onexitmedia, + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: onexitmedia, + listOrdered: onexitlistordered, + listUnordered: onexitlistunordered, + paragraph: onexitparagraph, + reference: onresumedrop, + referenceString: onexitreferencestring, + resource: onresumedrop, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + setextHeading: onexitsetextheading, + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: onexitstrong, + thematicBreak: onexitthematicbreak + } + } + + /** + * Combine the HTML extensions with the default handlers. + * An HTML extension is an object whose fields are either `enter` or `exit` + * (reflecting whether a token is entered or exited). + * The values at such objects are names of tokens mapping to handlers. + * Handlers are called, respectively when a token is opener or closed, with + * that token, and a context as `this`. + */ + const handlers = /** @type {NormalizedHtmlExtension} */ ( + combineHtmlExtensions([defaultHandlers, ...(settings.htmlExtensions || [])]) + ) + + /** + * Handlers do often need to keep track of some state. + * That state is provided here as a key-value store (an object). + * + * @type {CompileData} + */ + const data = { + definitions, + tightStack + } + + /** + * The context for handlers references a couple of useful functions. + * In handlers from extensions, those can be accessed at `this`. + * For the handlers here, they can be accessed directly. + * + * @type {Omit<CompileContext, 'sliceSerialize'>} + */ + const context = { + buffer, + encode, + getData, + lineEndingIfNeeded, + options: settings, + raw, + resume, + setData, + tag + } + + /** + * Generally, micromark copies line endings (`'\r'`, `'\n'`, `'\r\n'`) in the + * markdown document over to the compiled HTML. + * In some cases, such as `> a`, CommonMark requires that extra line endings + * are added: `<blockquote>\n<p>a</p>\n</blockquote>`. + * This variable hold the default line ending when given (or `undefined`), + * and in the latter case will be updated to the first found line ending if + * there is one. + */ + let lineEndingStyle = settings.defaultLineEnding + + // Return the function that handles a slice of events. + return compile + + /** + * Deal w/ a slice of events. + * Return either the empty string if there’s nothing of note to return, or the + * result when done. + * + * @param {ReadonlyArray<Event>} events + * @returns {string} + */ + function compile(events) { + let index = -1 + let start = 0 + /** @type {Array<number>} */ + const listStack = [] + // As definitions can come after references, we need to figure out the media + // (urls and titles) defined by them before handling the references. + // So, we do sort of what HTML does: put metadata at the start (in head), and + // then put content after (`body`). + /** @type {Array<Event>} */ + let head = [] + /** @type {Array<Event>} */ + let body = [] + + while (++index < events.length) { + // Figure out the line ending style used in the document. + if ( + !lineEndingStyle && + (events[index][1].type === types.lineEnding || + events[index][1].type === types.lineEndingBlank) + ) { + lineEndingStyle = /** @type {LineEnding} */ ( + events[index][2].sliceSerialize(events[index][1]) + ) + } + + // Preprocess lists to infer whether the list is loose or not. + if ( + events[index][1].type === types.listOrdered || + events[index][1].type === types.listUnordered + ) { + if (events[index][0] === 'enter') { + listStack.push(index) + } else { + prepareList(events.slice(listStack.pop(), index)) + } + } + + // Move definitions to the front. + if (events[index][1].type === types.definition) { + if (events[index][0] === 'enter') { + body = push(body, events.slice(start, index)) + start = index + } else { + head = push(head, events.slice(start, index + 1)) + start = index + 1 + } + } + } + + head = push(head, body) + head = push(head, events.slice(start)) + index = -1 + const result = head + + // Handle the start of the document, if defined. + if (handlers.enter.null) { + handlers.enter.null.call(context) + } + + // Handle all events. + while (++index < events.length) { + const handles = handlers[result[index][0]] + const kind = result[index][1].type + const handle = handles[kind] + + if (hasOwnProperty.call(handles, kind) && handle) { + handle.call( + {sliceSerialize: result[index][2].sliceSerialize, ...context}, + result[index][1] + ) + } + } + + // Handle the end of the document, if defined. + if (handlers.exit.null) { + handlers.exit.null.call(context) + } + + return buffers[0].join('') + } + + /** + * Figure out whether lists are loose or not. + * + * @param {ReadonlyArray<Event>} slice + * @returns {undefined} + */ + function prepareList(slice) { + const length = slice.length + let index = 0 // Skip open. + let containerBalance = 0 + let loose = false + /** @type {boolean | undefined} */ + let atMarker + + while (++index < length) { + const event = slice[index] + + if (event[1]._container) { + atMarker = undefined + + if (event[0] === 'enter') { + containerBalance++ + } else { + containerBalance-- + } + } else + switch (event[1].type) { + case types.listItemPrefix: { + if (event[0] === 'exit') { + atMarker = true + } + + break + } + + case types.linePrefix: { + // Ignore + + break + } + + case types.lineEndingBlank: { + if (event[0] === 'enter' && !containerBalance) { + if (atMarker) { + atMarker = undefined + } else { + loose = true + } + } + + break + } + + default: { + atMarker = undefined + } + } + } + + slice[0][1]._loose = loose + } + + /** + * @type {CompileContext['setData']} + */ + function setData(key, value) { + // @ts-expect-error: assume `value` is omitted (`undefined` is passed) only + // if allowed. + data[key] = value + } + + /** + * @type {CompileContext['getData']} + */ + function getData(key) { + return data[key] + } + + /** @type {CompileContext['buffer']} */ + function buffer() { + buffers.push([]) + } + + /** @type {CompileContext['resume']} */ + function resume() { + const buf = buffers.pop() + assert(buf !== undefined, 'Cannot resume w/o buffer') + return buf.join('') + } + + /** @type {CompileContext['tag']} */ + function tag(value) { + if (!tags) return + setData('lastWasTag', true) + buffers[buffers.length - 1].push(value) + } + + /** @type {CompileContext['raw']} */ + function raw(value) { + setData('lastWasTag') + buffers[buffers.length - 1].push(value) + } + + /** + * Output an extra line ending. + * + * @returns {undefined} + */ + function lineEnding() { + raw(lineEndingStyle || '\n') + } + + /** @type {CompileContext['lineEndingIfNeeded']} */ + function lineEndingIfNeeded() { + const buffer = buffers[buffers.length - 1] + const slice = buffer[buffer.length - 1] + const previous = slice ? slice.charCodeAt(slice.length - 1) : codes.eof + + if ( + previous === codes.lf || + previous === codes.cr || + previous === codes.eof + ) { + return + } + + lineEnding() + } + + /** @type {CompileContext['encode']} */ + function encode(value) { + return getData('ignoreEncode') ? value : _encode(value) + } + + // + // Handlers. + // + + /** + * @returns {undefined} + */ + function onresumedrop() { + resume() + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterlistordered(token) { + tightStack.push(!token._loose) + lineEndingIfNeeded() + tag('<ol') + setData('expectFirstItem', true) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterlistunordered(token) { + tightStack.push(!token._loose) + lineEndingIfNeeded() + tag('<ul') + setData('expectFirstItem', true) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterlistitemvalue(token) { + if (getData('expectFirstItem')) { + const value = Number.parseInt( + this.sliceSerialize(token), + constants.numericBaseDecimal + ) + + if (value !== 1) { + tag(' start="' + encode(String(value)) + '"') + } + } + } + + /** + * @returns {undefined} + */ + function onenterlistitemmarker() { + if (getData('expectFirstItem')) { + tag('>') + } else { + onexitlistitem() + } + + lineEndingIfNeeded() + tag('<li>') + setData('expectFirstItem') + // “Hack” to prevent a line ending from showing up if the item is empty. + setData('lastWasTag') + } + + /** + * @returns {undefined} + */ + function onexitlistordered() { + onexitlistitem() + tightStack.pop() + lineEnding() + tag('</ol>') + } + + /** + * @returns {undefined} + */ + function onexitlistunordered() { + onexitlistitem() + tightStack.pop() + lineEnding() + tag('</ul>') + } + + /** + * @returns {undefined} + */ + function onexitlistitem() { + if (getData('lastWasTag') && !getData('slurpAllLineEndings')) { + lineEndingIfNeeded() + } + + tag('</li>') + setData('slurpAllLineEndings') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterblockquote() { + tightStack.push(false) + lineEndingIfNeeded() + tag('<blockquote>') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitblockquote() { + tightStack.pop() + lineEndingIfNeeded() + tag('</blockquote>') + setData('slurpAllLineEndings') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterparagraph() { + if (!tightStack[tightStack.length - 1]) { + lineEndingIfNeeded() + tag('<p>') + } + + setData('slurpAllLineEndings') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitparagraph() { + if (tightStack[tightStack.length - 1]) { + setData('slurpAllLineEndings', true) + } else { + tag('</p>') + } + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onentercodefenced() { + lineEndingIfNeeded() + tag('<pre><code') + setData('fencesCount', 0) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitcodefencedfenceinfo() { + const value = resume() + tag(' class="language-' + value + '"') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitcodefencedfence() { + const count = getData('fencesCount') || 0 + + if (!count) { + tag('>') + setData('slurpOneLineEnding', true) + } + + setData('fencesCount', count + 1) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onentercodeindented() { + lineEndingIfNeeded() + tag('<pre><code>') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitflowcode() { + const count = getData('fencesCount') + + // One special case is if we are inside a container, and the fenced code was + // not closed (meaning it runs to the end). + // In that case, the following line ending, is considered *outside* the + // fenced code and block quote by micromark, but CM wants to treat that + // ending as part of the code. + if ( + count !== undefined && + count < 2 && + data.tightStack.length > 0 && + !getData('lastWasTag') + ) { + lineEnding() + } + + // But in most cases, it’s simpler: when we’ve seen some data, emit an extra + // line ending when needed. + if (getData('flowCodeSeenData')) { + lineEndingIfNeeded() + } + + tag('</code></pre>') + if (count !== undefined && count < 2) lineEndingIfNeeded() + setData('flowCodeSeenData') + setData('fencesCount') + setData('slurpOneLineEnding') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterimage() { + mediaStack.push({image: true}) + tags = undefined // Disallow tags. + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterlink() { + mediaStack.push({}) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitlabeltext(token) { + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitlabel() { + mediaStack[mediaStack.length - 1].label = resume() + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitreferencestring(token) { + mediaStack[mediaStack.length - 1].referenceId = this.sliceSerialize(token) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterresource() { + buffer() // We can have line endings in the resource, ignore them. + mediaStack[mediaStack.length - 1].destination = '' + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterresourcedestinationstring() { + buffer() + // Ignore encoding the result, as we’ll first percent encode the url and + // encode manually after. + setData('ignoreEncode', true) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitresourcedestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume() + setData('ignoreEncode') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitresourcetitlestring() { + mediaStack[mediaStack.length - 1].title = resume() + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitmedia() { + let index = mediaStack.length - 1 // Skip current. + const media = mediaStack[index] + const id = media.referenceId || media.labelId + assert(id !== undefined, 'media should have `referenceId` or `labelId`') + assert(media.label !== undefined, 'media should have `label`') + const context = + media.destination === undefined + ? definitions[normalizeIdentifier(id)] + : media + + tags = true + + while (index--) { + if (mediaStack[index].image) { + tags = undefined + break + } + } + + if (media.image) { + tag( + '<img src="' + + sanitizeUri( + context.destination, + settings.allowDangerousProtocol ? undefined : protocolSource + ) + + '" alt="' + ) + raw(media.label) + tag('"') + } else { + tag( + '<a href="' + + sanitizeUri( + context.destination, + settings.allowDangerousProtocol ? undefined : protocolHref + ) + + '"' + ) + } + + tag(context.title ? ' title="' + context.title + '"' : '') + + if (media.image) { + tag(' />') + } else { + tag('>') + raw(media.label) + tag('</a>') + } + + mediaStack.pop() + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterdefinition() { + buffer() + mediaStack.push({}) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdefinitionlabelstring(token) { + // Discard label, use the source content instead. + resume() + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterdefinitiondestinationstring() { + buffer() + setData('ignoreEncode', true) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdefinitiondestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume() + setData('ignoreEncode') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdefinitiontitlestring() { + mediaStack[mediaStack.length - 1].title = resume() + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdefinition() { + const media = mediaStack[mediaStack.length - 1] + assert(media.labelId !== undefined, 'media should have `labelId`') + const id = normalizeIdentifier(media.labelId) + + resume() + + if (!hasOwnProperty.call(definitions, id)) { + definitions[id] = mediaStack[mediaStack.length - 1] + } + + mediaStack.pop() + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onentercontent() { + setData('slurpAllLineEndings', true) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitatxheadingsequence(token) { + // Exit for further sequences. + if (getData('headingRank')) return + setData('headingRank', this.sliceSerialize(token).length) + lineEndingIfNeeded() + tag('<h' + getData('headingRank') + '>') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onentersetextheading() { + buffer() + setData('slurpAllLineEndings') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitsetextheadingtext() { + setData('slurpAllLineEndings', true) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitatxheading() { + tag('</h' + getData('headingRank') + '>') + setData('headingRank') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitsetextheadinglinesequence(token) { + setData( + 'headingRank', + this.sliceSerialize(token).charCodeAt(0) === codes.equalsTo ? 1 : 2 + ) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitsetextheading() { + const value = resume() + lineEndingIfNeeded() + tag('<h' + getData('headingRank') + '>') + raw(value) + tag('</h' + getData('headingRank') + '>') + setData('slurpAllLineEndings') + setData('headingRank') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdata(token) { + raw(encode(this.sliceSerialize(token))) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitlineending(token) { + if (getData('slurpAllLineEndings')) { + return + } + + if (getData('slurpOneLineEnding')) { + setData('slurpOneLineEnding') + return + } + + if (getData('inCodeText')) { + raw(' ') + return + } + + raw(encode(this.sliceSerialize(token))) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitcodeflowvalue(token) { + raw(encode(this.sliceSerialize(token))) + setData('flowCodeSeenData', true) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexithardbreak() { + tag('<br />') + } + + /** + * @returns {undefined} + */ + function onenterhtmlflow() { + lineEndingIfNeeded() + onenterhtml() + } + + /** + * @returns {undefined} + */ + function onexithtml() { + setData('ignoreEncode') + } + + /** + * @returns {undefined} + */ + function onenterhtml() { + if (settings.allowDangerousHtml) { + setData('ignoreEncode', true) + } + } + + /** + * @returns {undefined} + */ + function onenteremphasis() { + tag('<em>') + } + + /** + * @returns {undefined} + */ + function onenterstrong() { + tag('<strong>') + } + + /** + * @returns {undefined} + */ + function onentercodetext() { + setData('inCodeText', true) + tag('<code>') + } + + /** + * @returns {undefined} + */ + function onexitcodetext() { + setData('inCodeText') + tag('</code>') + } + + /** + * @returns {undefined} + */ + function onexitemphasis() { + tag('</em>') + } + + /** + * @returns {undefined} + */ + function onexitstrong() { + tag('</strong>') + } + + /** + * @returns {undefined} + */ + function onexitthematicbreak() { + lineEndingIfNeeded() + tag('<hr />') + } + + /** + * @this {CompileContext} + * @param {Token} token + * @returns {undefined} + */ + function onexitcharacterreferencemarker(token) { + setData('characterReferenceType', token.type) + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitcharacterreferencevalue(token) { + const value = this.sliceSerialize(token) + const decoded = getData('characterReferenceType') + ? decodeNumericCharacterReference( + value, + getData('characterReferenceType') === + types.characterReferenceMarkerNumeric + ? constants.numericBaseDecimal + : constants.numericBaseHexadecimal + ) + : decodeNamedCharacterReference(value) + + // `decodeNamedCharacterReference` can return `false` for invalid named + // character references, + // but everything we’ve tokenized is valid. + raw(encode(/** @type {string} */ (decoded))) + setData('characterReferenceType') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitautolinkprotocol(token) { + const uri = this.sliceSerialize(token) + tag( + '<a href="' + + sanitizeUri( + uri, + settings.allowDangerousProtocol ? undefined : protocolHref + ) + + '">' + ) + raw(encode(uri)) + tag('</a>') + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitautolinkemail(token) { + const uri = this.sliceSerialize(token) + tag('<a href="' + sanitizeUri('mailto:' + uri) + '">') + raw(encode(uri)) + tag('</a>') + } +} diff --git a/tools/ui/node_modules/micromark/dev/lib/constructs.d.ts b/tools/ui/node_modules/micromark/dev/lib/constructs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a83c7e0f647fe705024dedb909b034f5316dc27f --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/constructs.d.ts @@ -0,0 +1,73 @@ +/** @satisfies {Extension['document']} */ +export const document: { + 42: import("micromark-util-types").Construct; + 43: import("micromark-util-types").Construct; + 45: import("micromark-util-types").Construct; + 48: import("micromark-util-types").Construct; + 49: import("micromark-util-types").Construct; + 50: import("micromark-util-types").Construct; + 51: import("micromark-util-types").Construct; + 52: import("micromark-util-types").Construct; + 53: import("micromark-util-types").Construct; + 54: import("micromark-util-types").Construct; + 55: import("micromark-util-types").Construct; + 56: import("micromark-util-types").Construct; + 57: import("micromark-util-types").Construct; + 62: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['contentInitial']} */ +export const contentInitial: { + 91: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['flowInitial']} */ +export const flowInitial: { + [-2]: import("micromark-util-types").Construct; + [-1]: import("micromark-util-types").Construct; + 32: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['flow']} */ +export const flow: { + 35: import("micromark-util-types").Construct; + 42: import("micromark-util-types").Construct; + 45: import("micromark-util-types").Construct[]; + 60: import("micromark-util-types").Construct; + 61: import("micromark-util-types").Construct; + 95: import("micromark-util-types").Construct; + 96: import("micromark-util-types").Construct; + 126: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['string']} */ +export const string: { + 38: import("micromark-util-types").Construct; + 92: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['text']} */ +export const text: { + [-5]: import("micromark-util-types").Construct; + [-4]: import("micromark-util-types").Construct; + [-3]: import("micromark-util-types").Construct; + 33: import("micromark-util-types").Construct; + 38: import("micromark-util-types").Construct; + 42: import("micromark-util-types").Construct; + 60: import("micromark-util-types").Construct[]; + 91: import("micromark-util-types").Construct; + 92: import("micromark-util-types").Construct[]; + 93: import("micromark-util-types").Construct; + 95: import("micromark-util-types").Construct; + 96: import("micromark-util-types").Construct; +}; +export namespace insideSpan { + let _null: (import("micromark-util-types").Construct | { + resolveAll: import("micromark-util-types").Resolver; + })[]; + export { _null as null }; +} +export namespace attentionMarkers { + let _null_1: (42 | 95)[]; + export { _null_1 as null }; +} +export namespace disable { + let _null_2: never[]; + export { _null_2 as null }; +} +//# sourceMappingURL=constructs.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/constructs.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/constructs.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..58fdf52fb128c25f3596b78bafecdc72a77455db --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/constructs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constructs.d.ts","sourceRoot":"","sources":["constructs.js"],"names":[],"mappings":"AA6BA,yCAAyC;AACzC;;;;;;;;;;;;;;;EAeC;AAED,+CAA+C;AAC/C;;EAEC;AAED,4CAA4C;AAC5C;;;;EAIC;AAED,qCAAqC;AACrC;;;;;;;;;EASC;AAED,uCAAuC;AACvC;;;EAGC;AAED,qCAAqC;AACrC;;;;;;;;;;;;;EAaC"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/constructs.js b/tools/ui/node_modules/micromark/dev/lib/constructs.js new file mode 100644 index 0000000000000000000000000000000000000000..f5720d752e3738d7c1cbe00b25a6376e310f454c --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/constructs.js @@ -0,0 +1,101 @@ +/** + * @import {Extension} from 'micromark-util-types' + */ + +import { + attention, + autolink, + blockQuote, + characterEscape, + characterReference, + codeFenced, + codeIndented, + codeText, + definition, + hardBreakEscape, + headingAtx, + htmlFlow, + htmlText, + labelEnd, + labelStartImage, + labelStartLink, + lineEnding, + list, + setextUnderline, + thematicBreak +} from 'micromark-core-commonmark' +import {codes} from 'micromark-util-symbol' +import {resolver as resolveText} from './initialize/text.js' + +/** @satisfies {Extension['document']} */ +export const document = { + [codes.asterisk]: list, + [codes.plusSign]: list, + [codes.dash]: list, + [codes.digit0]: list, + [codes.digit1]: list, + [codes.digit2]: list, + [codes.digit3]: list, + [codes.digit4]: list, + [codes.digit5]: list, + [codes.digit6]: list, + [codes.digit7]: list, + [codes.digit8]: list, + [codes.digit9]: list, + [codes.greaterThan]: blockQuote +} + +/** @satisfies {Extension['contentInitial']} */ +export const contentInitial = { + [codes.leftSquareBracket]: definition +} + +/** @satisfies {Extension['flowInitial']} */ +export const flowInitial = { + [codes.horizontalTab]: codeIndented, + [codes.virtualSpace]: codeIndented, + [codes.space]: codeIndented +} + +/** @satisfies {Extension['flow']} */ +export const flow = { + [codes.numberSign]: headingAtx, + [codes.asterisk]: thematicBreak, + [codes.dash]: [setextUnderline, thematicBreak], + [codes.lessThan]: htmlFlow, + [codes.equalsTo]: setextUnderline, + [codes.underscore]: thematicBreak, + [codes.graveAccent]: codeFenced, + [codes.tilde]: codeFenced +} + +/** @satisfies {Extension['string']} */ +export const string = { + [codes.ampersand]: characterReference, + [codes.backslash]: characterEscape +} + +/** @satisfies {Extension['text']} */ +export const text = { + [codes.carriageReturn]: lineEnding, + [codes.lineFeed]: lineEnding, + [codes.carriageReturnLineFeed]: lineEnding, + [codes.exclamationMark]: labelStartImage, + [codes.ampersand]: characterReference, + [codes.asterisk]: attention, + [codes.lessThan]: [autolink, htmlText], + [codes.leftSquareBracket]: labelStartLink, + [codes.backslash]: [hardBreakEscape, characterEscape], + [codes.rightSquareBracket]: labelEnd, + [codes.underscore]: attention, + [codes.graveAccent]: codeText +} + +/** @satisfies {Extension['insideSpan']} */ +export const insideSpan = {null: [attention, resolveText]} + +/** @satisfies {Extension['attentionMarkers']} */ +export const attentionMarkers = {null: [codes.asterisk, codes.underscore]} + +/** @satisfies {Extension['disable']} */ +export const disable = {null: []} diff --git a/tools/ui/node_modules/micromark/dev/lib/create-tokenizer.d.ts b/tools/ui/node_modules/micromark/dev/lib/create-tokenizer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..989201b5cdced893bc9c34a72917454b5469cc75 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/create-tokenizer.d.ts @@ -0,0 +1,46 @@ +/** + * Create a tokenizer. + * Tokenizers deal with one type of data (e.g., containers, flow, text). + * The parser is the object dealing with it all. + * `initialize` works like other constructs, except that only its `tokenize` + * function is used, in which case it doesn’t receive an `ok` or `nok`. + * `from` can be given to set the point before the first character, although + * when further lines are indented, they must be set with `defineSkip`. + * + * @param {ParseContext} parser + * Parser. + * @param {InitialConstruct} initialize + * Construct. + * @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from] + * Point (optional). + * @returns {TokenizeContext} + * Context. + */ +export function createTokenizer(parser: ParseContext, initialize: InitialConstruct, from?: Omit<Point, "_bufferIndex" | "_index"> | undefined): TokenizeContext; +/** + * Restore the state. + */ +export type Restore = () => undefined; +/** + * Info. + */ +export type Info = { + /** + * Restore. + */ + restore: Restore; + /** + * From. + */ + from: number; +}; +/** + * Handle a successful run. + */ +export type ReturnHandle = (construct: Construct, info: Info) => undefined; +import type { ParseContext } from 'micromark-util-types'; +import type { InitialConstruct } from 'micromark-util-types'; +import type { Point } from 'micromark-util-types'; +import type { TokenizeContext } from 'micromark-util-types'; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=create-tokenizer.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c4eeb0ab93579edba93c265f0c66b66d68bbf418 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"create-tokenizer.d.ts","sourceRoot":"","sources":["create-tokenizer.js"],"names":[],"mappings":"AAgDA;;;;;;;;;;;;;;;;;GAiBG;AACH,wCATW,YAAY,cAEZ,gBAAgB,SAEhB,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,QAAQ,CAAC,GAAG,SAAS,GAEhD,eAAe,CAwhB3B;;;;4BApkBY,SAAS;;;;;;;;aAKR,OAAO;;;;UAEP,MAAM;;;;;uCAKT,SAAS,QAET,IAAI,KAEF,SAAS;kCAtBZ,sBAAsB;sCAAtB,sBAAsB;2BAAtB,sBAAsB;qCAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/create-tokenizer.js b/tools/ui/node_modules/micromark/dev/lib/create-tokenizer.js new file mode 100644 index 0000000000000000000000000000000000000000..abd242f2cdd975ab0081394299b3e9194384ce8e --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/create-tokenizer.js @@ -0,0 +1,717 @@ +/** + * @import { + * Chunk, + * Code, + * ConstructRecord, + * Construct, + * Effects, + * InitialConstruct, + * ParseContext, + * Point, + * State, + * TokenizeContext, + * Token + * } from 'micromark-util-types' + */ + +/** + * @callback Restore + * Restore the state. + * @returns {undefined} + * Nothing. + * + * @typedef Info + * Info. + * @property {Restore} restore + * Restore. + * @property {number} from + * From. + * + * @callback ReturnHandle + * Handle a successful run. + * @param {Construct} construct + * Construct. + * @param {Info} info + * Info. + * @returns {undefined} + * Nothing. + */ + +import createDebug from 'debug' +import {ok as assert} from 'devlop' +import {markdownLineEnding} from 'micromark-util-character' +import {push, splice} from 'micromark-util-chunked' +import {resolveAll} from 'micromark-util-resolve-all' +import {codes, values} from 'micromark-util-symbol' + +const debug = createDebug('micromark') + +/** + * Create a tokenizer. + * Tokenizers deal with one type of data (e.g., containers, flow, text). + * The parser is the object dealing with it all. + * `initialize` works like other constructs, except that only its `tokenize` + * function is used, in which case it doesn’t receive an `ok` or `nok`. + * `from` can be given to set the point before the first character, although + * when further lines are indented, they must be set with `defineSkip`. + * + * @param {ParseContext} parser + * Parser. + * @param {InitialConstruct} initialize + * Construct. + * @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from] + * Point (optional). + * @returns {TokenizeContext} + * Context. + */ +export function createTokenizer(parser, initialize, from) { + /** @type {Point} */ + let point = { + _bufferIndex: -1, + _index: 0, + line: (from && from.line) || 1, + column: (from && from.column) || 1, + offset: (from && from.offset) || 0 + } + /** @type {Record<string, number>} */ + const columnStart = {} + /** @type {Array<Construct>} */ + const resolveAllConstructs = [] + /** @type {Array<Chunk>} */ + let chunks = [] + /** @type {Array<Token>} */ + let stack = [] + /** @type {boolean | undefined} */ + let consumed = true + + /** + * Tools used for tokenizing. + * + * @type {Effects} + */ + const effects = { + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + consume, + enter, + exit, + interrupt: constructFactory(onsuccessfulcheck, {interrupt: true}) + } + + /** + * State and tools for resolving and serializing. + * + * @type {TokenizeContext} + */ + const context = { + code: codes.eof, + containerState: {}, + defineSkip, + events: [], + now, + parser, + previous: codes.eof, + sliceSerialize, + sliceStream, + write + } + + /** + * The state function. + * + * @type {State | undefined} + */ + let state = initialize.tokenize.call(context, effects) + + /** + * Track which character we expect to be consumed, to catch bugs. + * + * @type {Code} + */ + let expectedCode + + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize) + } + + return context + + /** @type {TokenizeContext['write']} */ + function write(slice) { + chunks = push(chunks, slice) + + main() + + // Exit if we’re not done, resolve might change stuff. + if (chunks[chunks.length - 1] !== codes.eof) { + return [] + } + + addResult(initialize, 0) + + // Otherwise, resolve, and exit. + context.events = resolveAll(resolveAllConstructs, context.events, context) + + return context.events + } + + // + // Tools. + // + + /** @type {TokenizeContext['sliceSerialize']} */ + function sliceSerialize(token, expandTabs) { + return serializeChunks(sliceStream(token), expandTabs) + } + + /** @type {TokenizeContext['sliceStream']} */ + function sliceStream(token) { + return sliceChunks(chunks, token) + } + + /** @type {TokenizeContext['now']} */ + function now() { + // This is a hot path, so we clone manually instead of `Object.assign({}, point)` + const {_bufferIndex, _index, line, column, offset} = point + return {_bufferIndex, _index, line, column, offset} + } + + /** @type {TokenizeContext['defineSkip']} */ + function defineSkip(value) { + columnStart[value.line] = value.column + accountForPotentialSkip() + debug('position: define skip: `%j`', point) + } + + // + // State management. + // + + /** + * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by + * `consume`). + * Here is where we walk through the chunks, which either include strings of + * several characters, or numerical character codes. + * The reason to do this in a loop instead of a call is so the stack can + * drain. + * + * @returns {undefined} + * Nothing. + */ + function main() { + /** @type {number} */ + let chunkIndex + + while (point._index < chunks.length) { + const chunk = chunks[point._index] + + // If we’re in a buffer chunk, loop through it. + if (typeof chunk === 'string') { + chunkIndex = point._index + + if (point._bufferIndex < 0) { + point._bufferIndex = 0 + } + + while ( + point._index === chunkIndex && + point._bufferIndex < chunk.length + ) { + go(chunk.charCodeAt(point._bufferIndex)) + } + } else { + go(chunk) + } + } + } + + /** + * Deal with one code. + * + * @param {Code} code + * Code. + * @returns {undefined} + * Nothing. + */ + function go(code) { + assert(consumed === true, 'expected character to be consumed') + consumed = undefined + debug('main: passing `%s` to %s', code, state && state.name) + expectedCode = code + assert(typeof state === 'function', 'expected state') + state = state(code) + } + + /** @type {Effects['consume']} */ + function consume(code) { + assert(code === expectedCode, 'expected given code to equal expected code') + + debug('consume: `%s`', code) + + assert( + consumed === undefined, + 'expected code to not have been consumed: this might be because `return x(code)` instead of `return x` was used' + ) + assert( + code === null + ? context.events.length === 0 || + context.events[context.events.length - 1][0] === 'exit' + : context.events[context.events.length - 1][0] === 'enter', + 'expected last token to be open' + ) + + if (markdownLineEnding(code)) { + point.line++ + point.column = 1 + point.offset += code === codes.carriageReturnLineFeed ? 2 : 1 + accountForPotentialSkip() + debug('position: after eol: `%j`', point) + } else if (code !== codes.virtualSpace) { + point.column++ + point.offset++ + } + + // Not in a string chunk. + if (point._bufferIndex < 0) { + point._index++ + } else { + point._bufferIndex++ + + // At end of string chunk. + if ( + point._bufferIndex === + // Points w/ non-negative `_bufferIndex` reference + // strings. + /** @type {string} */ (chunks[point._index]).length + ) { + point._bufferIndex = -1 + point._index++ + } + } + + // Expose the previous character. + context.previous = code + + // Mark as consumed. + consumed = true + } + + /** @type {Effects['enter']} */ + function enter(type, fields) { + /** @type {Token} */ + // @ts-expect-error Patch instead of assign required fields to help GC. + const token = fields || {} + token.type = type + token.start = now() + + assert(typeof type === 'string', 'expected string type') + assert(type.length > 0, 'expected non-empty string') + debug('enter: `%s`', type) + + context.events.push(['enter', token, context]) + + stack.push(token) + + return token + } + + /** @type {Effects['exit']} */ + function exit(type) { + assert(typeof type === 'string', 'expected string type') + assert(type.length > 0, 'expected non-empty string') + + const token = stack.pop() + assert(token, 'cannot close w/o open tokens') + token.end = now() + + assert(type === token.type, 'expected exit token to match current token') + + assert( + !( + token.start._index === token.end._index && + token.start._bufferIndex === token.end._bufferIndex + ), + 'expected non-empty token (`' + type + '`)' + ) + + debug('exit: `%s`', token.type) + context.events.push(['exit', token, context]) + + return token + } + + /** + * Use results. + * + * @type {ReturnHandle} + */ + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from) + } + + /** + * Discard results. + * + * @type {ReturnHandle} + */ + function onsuccessfulcheck(_, info) { + info.restore() + } + + /** + * Factory to attempt/check/interrupt. + * + * @param {ReturnHandle} onreturn + * Callback. + * @param {{interrupt?: boolean | undefined} | undefined} [fields] + * Fields. + */ + function constructFactory(onreturn, fields) { + return hook + + /** + * Handle either an object mapping codes to constructs, a list of + * constructs, or a single construct. + * + * @param {Array<Construct> | ConstructRecord | Construct} constructs + * Constructs. + * @param {State} returnState + * State. + * @param {State | undefined} [bogusState] + * State. + * @returns {State} + * State. + */ + function hook(constructs, returnState, bogusState) { + /** @type {ReadonlyArray<Construct>} */ + let listOfConstructs + /** @type {number} */ + let constructIndex + /** @type {Construct} */ + let currentConstruct + /** @type {Info} */ + let info + + return Array.isArray(constructs) + ? /* c8 ignore next 1 */ + handleListOfConstructs(constructs) + : 'tokenize' in constructs + ? // Looks like a construct. + handleListOfConstructs([/** @type {Construct} */ (constructs)]) + : handleMapOfConstructs(constructs) + + /** + * Handle a list of construct. + * + * @param {ConstructRecord} map + * Constructs. + * @returns {State} + * State. + */ + function handleMapOfConstructs(map) { + return start + + /** @type {State} */ + function start(code) { + const left = code !== null && map[code] + const all = code !== null && map.null + const list = [ + // To do: add more extension tests. + /* c8 ignore next 2 */ + ...(Array.isArray(left) ? left : left ? [left] : []), + ...(Array.isArray(all) ? all : all ? [all] : []) + ] + + return handleListOfConstructs(list)(code) + } + } + + /** + * Handle a list of construct. + * + * @param {ReadonlyArray<Construct>} list + * Constructs. + * @returns {State} + * State. + */ + function handleListOfConstructs(list) { + listOfConstructs = list + constructIndex = 0 + + if (list.length === 0) { + assert(bogusState, 'expected `bogusState` to be given') + return bogusState + } + + return handleConstruct(list[constructIndex]) + } + + /** + * Handle a single construct. + * + * @param {Construct} construct + * Construct. + * @returns {State} + * State. + */ + function handleConstruct(construct) { + return start + + /** @type {State} */ + function start(code) { + // To do: not needed to store if there is no bogus state, probably? + // Currently doesn’t work because `inspect` in document does a check + // w/o a bogus, which doesn’t make sense. But it does seem to help perf + // by not storing. + info = store() + currentConstruct = construct + + if (!construct.partial) { + context.currentConstruct = construct + } + + // Always populated by defaults. + assert( + context.parser.constructs.disable.null, + 'expected `disable.null` to be populated' + ) + + if ( + construct.name && + context.parser.constructs.disable.null.includes(construct.name) + ) { + return nok(code) + } + + return construct.tokenize.call( + // If we do have fields, create an object w/ `context` as its + // prototype. + // This allows a “live binding”, which is needed for `interrupt`. + fields ? Object.assign(Object.create(context), fields) : context, + effects, + ok, + nok + )(code) + } + } + + /** @type {State} */ + function ok(code) { + assert(code === expectedCode, 'expected code') + consumed = true + onreturn(currentConstruct, info) + return returnState + } + + /** @type {State} */ + function nok(code) { + assert(code === expectedCode, 'expected code') + consumed = true + info.restore() + + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]) + } + + return bogusState + } + } + } + + /** + * @param {Construct} construct + * Construct. + * @param {number} from + * From. + * @returns {undefined} + * Nothing. + */ + function addResult(construct, from) { + if (construct.resolveAll && !resolveAllConstructs.includes(construct)) { + resolveAllConstructs.push(construct) + } + + if (construct.resolve) { + splice( + context.events, + from, + context.events.length - from, + construct.resolve(context.events.slice(from), context) + ) + } + + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context) + } + + assert( + construct.partial || + context.events.length === 0 || + context.events[context.events.length - 1][0] === 'exit', + 'expected last token to end' + ) + } + + /** + * Store state. + * + * @returns {Info} + * Info. + */ + function store() { + const startPoint = now() + const startPrevious = context.previous + const startCurrentConstruct = context.currentConstruct + const startEventsIndex = context.events.length + const startStack = Array.from(stack) + + return {from: startEventsIndex, restore} + + /** + * Restore state. + * + * @returns {undefined} + * Nothing. + */ + function restore() { + point = startPoint + context.previous = startPrevious + context.currentConstruct = startCurrentConstruct + context.events.length = startEventsIndex + stack = startStack + accountForPotentialSkip() + debug('position: restore: `%j`', point) + } + } + + /** + * Move the current point a bit forward in the line when it’s on a column + * skip. + * + * @returns {undefined} + * Nothing. + */ + function accountForPotentialSkip() { + if (point.line in columnStart && point.column < 2) { + point.column = columnStart[point.line] + point.offset += columnStart[point.line] - 1 + } + } +} + +/** + * Get the chunks from a slice of chunks in the range of a token. + * + * @param {ReadonlyArray<Chunk>} chunks + * Chunks. + * @param {Pick<Token, 'end' | 'start'>} token + * Token. + * @returns {Array<Chunk>} + * Chunks. + */ +function sliceChunks(chunks, token) { + const startIndex = token.start._index + const startBufferIndex = token.start._bufferIndex + const endIndex = token.end._index + const endBufferIndex = token.end._bufferIndex + /** @type {Array<Chunk>} */ + let view + + if (startIndex === endIndex) { + assert(endBufferIndex > -1, 'expected non-negative end buffer index') + assert(startBufferIndex > -1, 'expected non-negative start buffer index') + // @ts-expect-error `_bufferIndex` is used on string chunks. + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)] + } else { + view = chunks.slice(startIndex, endIndex) + + if (startBufferIndex > -1) { + const head = view[0] + if (typeof head === 'string') { + view[0] = head.slice(startBufferIndex) + /* c8 ignore next 4 -- used to be used, no longer */ + } else { + assert(startBufferIndex === 0, 'expected `startBufferIndex` to be `0`') + view.shift() + } + } + + if (endBufferIndex > 0) { + // @ts-expect-error `_bufferIndex` is used on string chunks. + view.push(chunks[endIndex].slice(0, endBufferIndex)) + } + } + + return view +} + +/** + * Get the string value of a slice of chunks. + * + * @param {ReadonlyArray<Chunk>} chunks + * Chunks. + * @param {boolean | undefined} [expandTabs=false] + * Whether to expand tabs (default: `false`). + * @returns {string} + * Result. + */ +function serializeChunks(chunks, expandTabs) { + let index = -1 + /** @type {Array<string>} */ + const result = [] + /** @type {boolean | undefined} */ + let atTab + + while (++index < chunks.length) { + const chunk = chunks[index] + /** @type {string} */ + let value + + if (typeof chunk === 'string') { + value = chunk + } else + switch (chunk) { + case codes.carriageReturn: { + value = values.cr + + break + } + + case codes.lineFeed: { + value = values.lf + + break + } + + case codes.carriageReturnLineFeed: { + value = values.cr + values.lf + + break + } + + case codes.horizontalTab: { + value = expandTabs ? values.space : values.ht + + break + } + + case codes.virtualSpace: { + if (!expandTabs && atTab) continue + value = values.space + + break + } + + default: { + assert(typeof chunk === 'number', 'expected number') + // Currently only replacement character. + value = String.fromCharCode(chunk) + } + } + + atTab = chunk === codes.horizontalTab + result.push(value) + } + + return result.join('') +} diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/content.d.ts b/tools/ui/node_modules/micromark/dev/lib/initialize/content.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..11fda4c1407aec4e6a30aeff11870a2bfd9154fa --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/content.d.ts @@ -0,0 +1,4 @@ +/** @type {InitialConstruct} */ +export const content: InitialConstruct; +import type { InitialConstruct } from 'micromark-util-types'; +//# sourceMappingURL=content.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/content.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/initialize/content.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7670bed73fb1e0dbe91716c13f00ffc2a599045c --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/content.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["content.js"],"names":[],"mappings":"AAeA,+BAA+B;AAC/B,sBADW,gBAAgB,CACyB;sCAT1C,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/content.js b/tools/ui/node_modules/micromark/dev/lib/initialize/content.js new file mode 100644 index 0000000000000000000000000000000000000000..805bc43f7eb76db987543860301fef6f9cd6267e --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/content.js @@ -0,0 +1,99 @@ +/** + * @import { + * InitialConstruct, + * Initializer, + * State, + * TokenizeContext, + * Token + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {InitialConstruct} */ +export const content = {tokenize: initializeContent} + +/** + * @this {TokenizeContext} + * Context. + * @type {Initializer} + * Content. + */ +function initializeContent(effects) { + const contentStart = effects.attempt( + this.parser.constructs.contentInitial, + afterContentStartConstruct, + paragraphInitial + ) + /** @type {Token} */ + let previous + + return contentStart + + /** @type {State} */ + function afterContentStartConstruct(code) { + assert( + code === codes.eof || markdownLineEnding(code), + 'expected eol or eof' + ) + + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace(effects, contentStart, types.linePrefix) + } + + /** @type {State} */ + function paragraphInitial(code) { + assert( + code !== codes.eof && !markdownLineEnding(code), + 'expected anything other than a line ending or EOF' + ) + effects.enter(types.paragraph) + return lineStart(code) + } + + /** @type {State} */ + function lineStart(code) { + const token = effects.enter(types.chunkText, { + contentType: constants.contentTypeText, + previous + }) + + if (previous) { + previous.next = token + } + + previous = token + + return data(code) + } + + /** @type {State} */ + function data(code) { + if (code === codes.eof) { + effects.exit(types.chunkText) + effects.exit(types.paragraph) + effects.consume(code) + return + } + + if (markdownLineEnding(code)) { + effects.consume(code) + effects.exit(types.chunkText) + return lineStart + } + + // Data. + effects.consume(code) + return data + } +} diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/document.d.ts b/tools/ui/node_modules/micromark/dev/lib/initialize/document.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c35a3f76cf96adf527d76b915c7b7373edd3b557 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/document.d.ts @@ -0,0 +1,10 @@ +/** @type {InitialConstruct} */ +export const document: InitialConstruct; +/** + * Construct and its state. + */ +export type StackItem = [Construct, ContainerState]; +import type { InitialConstruct } from 'micromark-util-types'; +import type { Construct } from 'micromark-util-types'; +import type { ContainerState } from 'micromark-util-types'; +//# sourceMappingURL=document.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/document.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/initialize/document.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..af4d9e823b708790e5bc3456fb18b74587910c5e --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/document.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.js"],"names":[],"mappings":"AAyBA,+BAA+B;AAC/B,uBADW,gBAAgB,CAC2B;;;;wBAXzC,CAAC,SAAS,EAAE,cAAc,CAAC;sCAJ9B,sBAAsB;+BAAtB,sBAAsB;oCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/document.js b/tools/ui/node_modules/micromark/dev/lib/initialize/document.js new file mode 100644 index 0000000000000000000000000000000000000000..bca159ead63c2ccb5910d09076ef63b94c307e90 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/document.js @@ -0,0 +1,445 @@ +/** + * @import { + * Construct, + * ContainerState, + * InitialConstruct, + * Initializer, + * Point, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +/** + * @typedef {[Construct, ContainerState]} StackItem + * Construct and its state. + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding} from 'micromark-util-character' +import {splice} from 'micromark-util-chunked' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {InitialConstruct} */ +export const document = {tokenize: initializeDocument} + +/** @type {Construct} */ +const containerConstruct = {tokenize: tokenizeContainer} + +/** + * @this {TokenizeContext} + * Self. + * @type {Initializer} + * Initializer. + */ +function initializeDocument(effects) { + const self = this + /** @type {Array<StackItem>} */ + const stack = [] + let continued = 0 + /** @type {TokenizeContext | undefined} */ + let childFlow + /** @type {Token | undefined} */ + let childToken + /** @type {number} */ + let lineStartOffset + + return start + + /** @type {State} */ + function start(code) { + // First we iterate through the open blocks, starting with the root + // document, and descending through last children down to the last open + // block. + // Each block imposes a condition that the line must satisfy if the block is + // to remain open. + // For example, a block quote requires a `>` character. + // A paragraph requires a non-blank line. + // In this phase we may match all or just some of the open blocks. + // But we cannot close unmatched blocks yet, because we may have a lazy + // continuation line. + if (continued < stack.length) { + const item = stack[continued] + self.containerState = item[1] + assert( + item[0].continuation, + 'expected `continuation` to be defined on container construct' + ) + return effects.attempt( + item[0].continuation, + documentContinue, + checkNewContainers + )(code) + } + + // Done. + return checkNewContainers(code) + } + + /** @type {State} */ + function documentContinue(code) { + assert( + self.containerState, + 'expected `containerState` to be defined after continuation' + ) + + continued++ + + // Note: this field is called `_closeFlow` but it also closes containers. + // Perhaps a good idea to rename it but it’s already used in the wild by + // extensions. + if (self.containerState._closeFlow) { + self.containerState._closeFlow = undefined + + if (childFlow) { + closeFlow() + } + + // Note: this algorithm for moving events around is similar to the + // algorithm when dealing with lazy lines in `writeToChild`. + const indexBeforeExits = self.events.length + let indexBeforeFlow = indexBeforeExits + /** @type {Point | undefined} */ + let point + + // Find the flow chunk. + while (indexBeforeFlow--) { + if ( + self.events[indexBeforeFlow][0] === 'exit' && + self.events[indexBeforeFlow][1].type === types.chunkFlow + ) { + point = self.events[indexBeforeFlow][1].end + break + } + } + + assert(point, 'could not find previous flow chunk') + + exitContainers(continued) + + // Fix positions. + let index = indexBeforeExits + + while (index < self.events.length) { + self.events[index][1].end = {...point} + index++ + } + + // Inject the exits earlier (they’re still also at the end). + splice( + self.events, + indexBeforeFlow + 1, + 0, + self.events.slice(indexBeforeExits) + ) + + // Discard the duplicate exits. + self.events.length = index + + return checkNewContainers(code) + } + + return start(code) + } + + /** @type {State} */ + function checkNewContainers(code) { + // Next, after consuming the continuation markers for existing blocks, we + // look for new block starts (e.g. `>` for a block quote). + // If we encounter a new block start, we close any blocks unmatched in + // step 1 before creating the new block as a child of the last matched + // block. + if (continued === stack.length) { + // No need to `check` whether there’s a container, of `exitContainers` + // would be moot. + // We can instead immediately `attempt` to parse one. + if (!childFlow) { + return documentContinued(code) + } + + // If we have concrete content, such as block HTML or fenced code, + // we can’t have containers “pierce” into them, so we can immediately + // start. + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { + return flowStart(code) + } + + // If we do have flow, it could still be a blank line, + // but we’d be interrupting it w/ a new container if there’s a current + // construct. + // To do: next major: remove `_gfmTableDynamicInterruptHack` (no longer + // needed in micromark-extension-gfm-table@1.0.6). + self.interrupt = Boolean( + childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack + ) + } + + // Check if there is a new container. + self.containerState = {} + return effects.check( + containerConstruct, + thereIsANewContainer, + thereIsNoNewContainer + )(code) + } + + /** @type {State} */ + function thereIsANewContainer(code) { + if (childFlow) closeFlow() + exitContainers(continued) + return documentContinued(code) + } + + /** @type {State} */ + function thereIsNoNewContainer(code) { + self.parser.lazy[self.now().line] = continued !== stack.length + lineStartOffset = self.now().offset + return flowStart(code) + } + + /** @type {State} */ + function documentContinued(code) { + // Try new containers. + self.containerState = {} + return effects.attempt( + containerConstruct, + containerContinue, + flowStart + )(code) + } + + /** @type {State} */ + function containerContinue(code) { + assert( + self.currentConstruct, + 'expected `currentConstruct` to be defined on tokenizer' + ) + assert( + self.containerState, + 'expected `containerState` to be defined on tokenizer' + ) + continued++ + stack.push([self.currentConstruct, self.containerState]) + // Try another. + return documentContinued(code) + } + + /** @type {State} */ + function flowStart(code) { + if (code === codes.eof) { + if (childFlow) closeFlow() + exitContainers(0) + effects.consume(code) + return + } + + childFlow = childFlow || self.parser.flow(self.now()) + effects.enter(types.chunkFlow, { + _tokenizer: childFlow, + contentType: constants.contentTypeFlow, + previous: childToken + }) + + return flowContinue(code) + } + + /** @type {State} */ + function flowContinue(code) { + if (code === codes.eof) { + writeToChild(effects.exit(types.chunkFlow), true) + exitContainers(0) + effects.consume(code) + return + } + + if (markdownLineEnding(code)) { + effects.consume(code) + writeToChild(effects.exit(types.chunkFlow)) + // Get ready for the next line. + continued = 0 + self.interrupt = undefined + return start + } + + effects.consume(code) + return flowContinue + } + + /** + * @param {Token} token + * Token. + * @param {boolean | undefined} [endOfFile] + * Whether the token is at the end of the file (default: `false`). + * @returns {undefined} + * Nothing. + */ + function writeToChild(token, endOfFile) { + assert(childFlow, 'expected `childFlow` to be defined when continuing') + const stream = self.sliceStream(token) + if (endOfFile) stream.push(null) + token.previous = childToken + if (childToken) childToken.next = token + childToken = token + childFlow.defineSkip(token.start) + childFlow.write(stream) + + // Alright, so we just added a lazy line: + // + // ```markdown + // > a + // b. + // + // Or: + // + // > ~~~c + // d + // + // Or: + // + // > | e | + // f + // ``` + // + // The construct in the second example (fenced code) does not accept lazy + // lines, so it marked itself as done at the end of its first line, and + // then the content construct parses `d`. + // Most constructs in markdown match on the first line: if the first line + // forms a construct, a non-lazy line can’t “unmake” it. + // + // The construct in the third example is potentially a GFM table, and + // those are *weird*. + // It *could* be a table, from the first line, if the following line + // matches a condition. + // In this case, that second line is lazy, which “unmakes” the first line + // and turns the whole into one content block. + // + // We’ve now parsed the non-lazy and the lazy line, and can figure out + // whether the lazy line started a new flow block. + // If it did, we exit the current containers between the two flow blocks. + if (self.parser.lazy[token.start.line]) { + let index = childFlow.events.length + + while (index--) { + if ( + // The token starts before the line ending… + childFlow.events[index][1].start.offset < lineStartOffset && + // …and either is not ended yet… + (!childFlow.events[index][1].end || + // …or ends after it. + childFlow.events[index][1].end.offset > lineStartOffset) + ) { + // Exit: there’s still something open, which means it’s a lazy line + // part of something. + return + } + } + + // Note: this algorithm for moving events around is similar to the + // algorithm when closing flow in `documentContinue`. + const indexBeforeExits = self.events.length + let indexBeforeFlow = indexBeforeExits + /** @type {boolean | undefined} */ + let seen + /** @type {Point | undefined} */ + let point + + // Find the previous chunk (the one before the lazy line). + while (indexBeforeFlow--) { + if ( + self.events[indexBeforeFlow][0] === 'exit' && + self.events[indexBeforeFlow][1].type === types.chunkFlow + ) { + if (seen) { + point = self.events[indexBeforeFlow][1].end + break + } + + seen = true + } + } + + assert(point, 'could not find previous flow chunk') + + exitContainers(continued) + + // Fix positions. + index = indexBeforeExits + + while (index < self.events.length) { + self.events[index][1].end = {...point} + index++ + } + + // Inject the exits earlier (they’re still also at the end). + splice( + self.events, + indexBeforeFlow + 1, + 0, + self.events.slice(indexBeforeExits) + ) + + // Discard the duplicate exits. + self.events.length = index + } + } + + /** + * @param {number} size + * Size. + * @returns {undefined} + * Nothing. + */ + function exitContainers(size) { + let index = stack.length + + // Exit open containers. + while (index-- > size) { + const entry = stack[index] + self.containerState = entry[1] + assert( + entry[0].exit, + 'expected `exit` to be defined on container construct' + ) + entry[0].exit.call(self, effects) + } + + stack.length = size + } + + function closeFlow() { + assert( + self.containerState, + 'expected `containerState` to be defined when closing flow' + ) + assert(childFlow, 'expected `childFlow` to be defined when closing it') + childFlow.write([codes.eof]) + childToken = undefined + childFlow = undefined + self.containerState._closeFlow = undefined + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + * Tokenizer. + */ +function tokenizeContainer(effects, ok, nok) { + // Always populated by defaults. + assert( + this.parser.constructs.disable.null, + 'expected `disable.null` to be populated' + ) + return factorySpace( + effects, + effects.attempt(this.parser.constructs.document, ok, nok), + types.linePrefix, + this.parser.constructs.disable.null.includes('codeIndented') + ? undefined + : constants.tabSize + ) +} diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/flow.d.ts b/tools/ui/node_modules/micromark/dev/lib/initialize/flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..55097f4622af6c92e393cc006fbe3dbda82be59c --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/flow.d.ts @@ -0,0 +1,4 @@ +/** @type {InitialConstruct} */ +export const flow: InitialConstruct; +import type { InitialConstruct } from 'micromark-util-types'; +//# sourceMappingURL=flow.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/flow.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/initialize/flow.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5cc25eb14fc177e1389996cb0cccb5057b2c2acd --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/flow.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["flow.js"],"names":[],"mappings":"AAeA,+BAA+B;AAC/B,mBADW,gBAAgB,CACmB;sCAVpC,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/flow.js b/tools/ui/node_modules/micromark/dev/lib/initialize/flow.js new file mode 100644 index 0000000000000000000000000000000000000000..771d5f205c04bb0f6d1f2a7d4e07185c8f4a9962 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/flow.js @@ -0,0 +1,86 @@ +/** + * @import { + * InitialConstruct, + * Initializer, + * State, + * TokenizeContext + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {blankLine, content} from 'micromark-core-commonmark' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding} from 'micromark-util-character' +import {codes, types} from 'micromark-util-symbol' + +/** @type {InitialConstruct} */ +export const flow = {tokenize: initializeFlow} + +/** + * @this {TokenizeContext} + * Self. + * @type {Initializer} + * Initializer. + */ +function initializeFlow(effects) { + const self = this + const initial = effects.attempt( + // Try to parse a blank line. + blankLine, + atBlankEnding, + // Try to parse initial flow (essentially, only code). + effects.attempt( + this.parser.constructs.flowInitial, + afterConstruct, + factorySpace( + effects, + effects.attempt( + this.parser.constructs.flow, + afterConstruct, + effects.attempt(content, afterConstruct) + ), + types.linePrefix + ) + ) + ) + + return initial + + /** @type {State} */ + function atBlankEnding(code) { + assert( + code === codes.eof || markdownLineEnding(code), + 'expected eol or eof' + ) + + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.lineEndingBlank) + effects.consume(code) + effects.exit(types.lineEndingBlank) + self.currentConstruct = undefined + return initial + } + + /** @type {State} */ + function afterConstruct(code) { + assert( + code === codes.eof || markdownLineEnding(code), + 'expected eol or eof' + ) + + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + self.currentConstruct = undefined + return initial + } +} diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/text.d.ts b/tools/ui/node_modules/micromark/dev/lib/initialize/text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5f26fc982b334c1137095ac3859a0e7fb96b896f --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/text.d.ts @@ -0,0 +1,8 @@ +export namespace resolver { + let resolveAll: Resolver; +} +export const string: InitialConstruct; +export const text: InitialConstruct; +import type { Resolver } from 'micromark-util-types'; +import type { InitialConstruct } from 'micromark-util-types'; +//# sourceMappingURL=text.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/text.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/initialize/text.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7f359336a64627f914b0a895ea8f4663cf29d76b --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/text.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":";;;AAeA,sCAAiD;AACjD,oCAA6C;8BARnC,sBAAsB;sCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/initialize/text.js b/tools/ui/node_modules/micromark/dev/lib/initialize/text.js new file mode 100644 index 0000000000000000000000000000000000000000..7192e70a0972e808d779999e57153bf3ed7bfc3a --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/initialize/text.js @@ -0,0 +1,244 @@ +/** + * @import { + * Code, + * InitialConstruct, + * Initializer, + * Resolver, + * State, + * TokenizeContext + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {codes, constants, types} from 'micromark-util-symbol' + +export const resolver = {resolveAll: createResolver()} +export const string = initializeFactory('string') +export const text = initializeFactory('text') + +/** + * @param {'string' | 'text'} field + * Field. + * @returns {InitialConstruct} + * Construct. + */ +function initializeFactory(field) { + return { + resolveAll: createResolver( + field === 'text' ? resolveAllLineSuffixes : undefined + ), + tokenize: initializeText + } + + /** + * @this {TokenizeContext} + * Context. + * @type {Initializer} + */ + function initializeText(effects) { + const self = this + const constructs = this.parser.constructs[field] + const text = effects.attempt(constructs, start, notText) + + return start + + /** @type {State} */ + function start(code) { + return atBreak(code) ? text(code) : notText(code) + } + + /** @type {State} */ + function notText(code) { + if (code === codes.eof) { + effects.consume(code) + return + } + + effects.enter(types.data) + effects.consume(code) + return data + } + + /** @type {State} */ + function data(code) { + if (atBreak(code)) { + effects.exit(types.data) + return text(code) + } + + // Data. + effects.consume(code) + return data + } + + /** + * @param {Code} code + * Code. + * @returns {boolean} + * Whether the code is a break. + */ + function atBreak(code) { + if (code === codes.eof) { + return true + } + + const list = constructs[code] + let index = -1 + + if (list) { + // Always populated by defaults. + assert(Array.isArray(list), 'expected `disable.null` to be populated') + + while (++index < list.length) { + const item = list[index] + if (!item.previous || item.previous.call(self, self.previous)) { + return true + } + } + } + + return false + } + } +} + +/** + * @param {Resolver | undefined} [extraResolver] + * Resolver. + * @returns {Resolver} + * Resolver. + */ +function createResolver(extraResolver) { + return resolveAllText + + /** @type {Resolver} */ + function resolveAllText(events, context) { + let index = -1 + /** @type {number | undefined} */ + let enter + + // A rather boring computation (to merge adjacent `data` events) which + // improves mm performance by 29%. + while (++index <= events.length) { + if (enter === undefined) { + if (events[index] && events[index][1].type === types.data) { + enter = index + index++ + } + } else if (!events[index] || events[index][1].type !== types.data) { + // Don’t do anything if there is one data token. + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end + events.splice(enter + 2, index - enter - 2) + index = enter + 2 + } + + enter = undefined + } + } + + return extraResolver ? extraResolver(events, context) : events + } +} + +/** + * A rather ugly set of instructions which again looks at chunks in the input + * stream. + * The reason to do this here is that it is *much* faster to parse in reverse. + * And that we can’t hook into `null` to split the line suffix before an EOF. + * To do: figure out if we can make this into a clean utility, or even in core. + * As it will be useful for GFMs literal autolink extension (and maybe even + * tables?) + * + * @type {Resolver} + */ +function resolveAllLineSuffixes(events, context) { + let eventIndex = 0 // Skip first. + + while (++eventIndex <= events.length) { + if ( + (eventIndex === events.length || + events[eventIndex][1].type === types.lineEnding) && + events[eventIndex - 1][1].type === types.data + ) { + const data = events[eventIndex - 1][1] + const chunks = context.sliceStream(data) + let index = chunks.length + let bufferIndex = -1 + let size = 0 + /** @type {boolean | undefined} */ + let tabs + + while (index--) { + const chunk = chunks[index] + + if (typeof chunk === 'string') { + bufferIndex = chunk.length + + while (chunk.charCodeAt(bufferIndex - 1) === codes.space) { + size++ + bufferIndex-- + } + + if (bufferIndex) break + bufferIndex = -1 + } + // Number + else if (chunk === codes.horizontalTab) { + tabs = true + size++ + } else if (chunk === codes.virtualSpace) { + // Empty + } else { + // Replacement character, exit. + index++ + break + } + } + + // Allow final trailing whitespace. + if (context._contentTypeTextTrailing && eventIndex === events.length) { + size = 0 + } + + if (size) { + const token = { + type: + eventIndex === events.length || + tabs || + size < constants.hardBreakPrefixSizeMin + ? types.lineSuffix + : types.hardBreakTrailing, + start: { + _bufferIndex: index + ? bufferIndex + : data.start._bufferIndex + bufferIndex, + _index: data.start._index + index, + line: data.end.line, + column: data.end.column - size, + offset: data.end.offset - size + }, + end: {...data.end} + } + + data.end = {...token.start} + + if (data.start.offset === data.end.offset) { + Object.assign(data, token) + } else { + events.splice( + eventIndex, + 0, + ['enter', token, context], + ['exit', token, context] + ) + eventIndex += 2 + } + } + + eventIndex++ + } + } + + return events +} diff --git a/tools/ui/node_modules/micromark/dev/lib/parse.d.ts b/tools/ui/node_modules/micromark/dev/lib/parse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5fa972ec59d90764c9e4ddf08f8903f337936e63 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/parse.d.ts @@ -0,0 +1,10 @@ +/** + * @param {ParseOptions | null | undefined} [options] + * Configuration (optional). + * @returns {ParseContext} + * Parser. + */ +export function parse(options?: ParseOptions | null | undefined): ParseContext; +import type { ParseOptions } from 'micromark-util-types'; +import type { ParseContext } from 'micromark-util-types'; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/parse.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/parse.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..6930aeaf3ee65473bfd20731146ac7101fa4b89f --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["parse.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,gCALW,YAAY,GAAG,IAAI,GAAG,SAAS,GAE7B,YAAY,CAoCxB;kCAlDS,sBAAsB;kCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/parse.js b/tools/ui/node_modules/micromark/dev/lib/parse.js new file mode 100644 index 0000000000000000000000000000000000000000..ffb0f88a2b90ab4605f4961617bd766f5c3af1e0 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/parse.js @@ -0,0 +1,58 @@ +/** + * @import { + * Create, + * FullNormalizedExtension, + * InitialConstruct, + * ParseContext, + * ParseOptions + * } from 'micromark-util-types' + */ + +import {combineExtensions} from 'micromark-util-combine-extensions' +import {content} from './initialize/content.js' +import {document} from './initialize/document.js' +import {flow} from './initialize/flow.js' +import {string, text} from './initialize/text.js' +import * as defaultConstructs from './constructs.js' +import {createTokenizer} from './create-tokenizer.js' + +/** + * @param {ParseOptions | null | undefined} [options] + * Configuration (optional). + * @returns {ParseContext} + * Parser. + */ +export function parse(options) { + const settings = options || {} + const constructs = /** @type {FullNormalizedExtension} */ ( + combineExtensions([defaultConstructs, ...(settings.extensions || [])]) + ) + + /** @type {ParseContext} */ + const parser = { + constructs, + content: create(content), + defined: [], + document: create(document), + flow: create(flow), + lazy: {}, + string: create(string), + text: create(text) + } + + return parser + + /** + * @param {InitialConstruct} initial + * Construct to start with. + * @returns {Create} + * Create a tokenizer. + */ + function create(initial) { + return creator + /** @type {Create} */ + function creator(from) { + return createTokenizer(parser, initial, from) + } + } +} diff --git a/tools/ui/node_modules/micromark/dev/lib/postprocess.d.ts b/tools/ui/node_modules/micromark/dev/lib/postprocess.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7d60ce81ba7be9bac8b79244e8cb7c4f146387ce --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/postprocess.d.ts @@ -0,0 +1,9 @@ +/** + * @param {Array<Event>} events + * Events. + * @returns {Array<Event>} + * Events. + */ +export function postprocess(events: Array<Event>): Array<Event>; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=postprocess.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/postprocess.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/postprocess.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..298eafee145c0f57d5d1c97be2b4057365b698f7 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/postprocess.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"postprocess.d.ts","sourceRoot":"","sources":["postprocess.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,oCALW,KAAK,CAAC,KAAK,CAAC,GAEV,KAAK,CAAC,KAAK,CAAC,CASxB;2BAjBuB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/postprocess.js b/tools/ui/node_modules/micromark/dev/lib/postprocess.js new file mode 100644 index 0000000000000000000000000000000000000000..06ee80a49d90324cde0d7647a37348556911b104 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/postprocess.js @@ -0,0 +1,19 @@ +/** + * @import {Event} from 'micromark-util-types' + */ + +import {subtokenize} from 'micromark-util-subtokenize' + +/** + * @param {Array<Event>} events + * Events. + * @returns {Array<Event>} + * Events. + */ +export function postprocess(events) { + while (!subtokenize(events)) { + // Empty + } + + return events +} diff --git a/tools/ui/node_modules/micromark/dev/lib/preprocess.d.ts b/tools/ui/node_modules/micromark/dev/lib/preprocess.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..30b7dba7cdbcd6f12b3fa8b108e11dd563295c6a --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/preprocess.d.ts @@ -0,0 +1,13 @@ +/** + * @returns {Preprocessor} + * Preprocess a value. + */ +export function preprocess(): Preprocessor; +/** + * Preprocess a value. + */ +export type Preprocessor = (value: Value, encoding?: Encoding | null | undefined, end?: boolean | null | undefined) => Array<Chunk>; +import type { Value } from 'micromark-util-types'; +import type { Encoding } from 'micromark-util-types'; +import type { Chunk } from 'micromark-util-types'; +//# sourceMappingURL=preprocess.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/preprocess.d.ts.map b/tools/ui/node_modules/micromark/dev/lib/preprocess.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..a916e156f1b758f81de4570424117b7f70218886 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/preprocess.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"preprocess.d.ts","sourceRoot":"","sources":["preprocess.js"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,8BAHa,YAAY,CAsHxB;;;;mCArIU,KAAK,aAEL,QAAQ,GAAG,IAAI,GAAG,SAAS,QAE3B,OAAO,GAAG,IAAI,GAAG,SAAS,KAExB,KAAK,CAAC,KAAK,CAAC;2BAZsB,sBAAsB;8BAAtB,sBAAsB;2BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/lib/preprocess.js b/tools/ui/node_modules/micromark/dev/lib/preprocess.js new file mode 100644 index 0000000000000000000000000000000000000000..2a6556619bd6a00461f40453860d25a1d8bb3cc6 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/lib/preprocess.js @@ -0,0 +1,141 @@ +/** + * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types' + */ + +/** + * @callback Preprocessor + * Preprocess a value. + * @param {Value} value + * Value. + * @param {Encoding | null | undefined} [encoding] + * Encoding when `value` is a typed array (optional). + * @param {boolean | null | undefined} [end=false] + * Whether this is the last chunk (default: `false`). + * @returns {Array<Chunk>} + * Chunks. + */ + +import {codes, constants} from 'micromark-util-symbol' + +const search = /[\0\t\n\r]/g + +/** + * @returns {Preprocessor} + * Preprocess a value. + */ +export function preprocess() { + let column = 1 + let buffer = '' + /** @type {boolean | undefined} */ + let start = true + /** @type {boolean | undefined} */ + let atCarriageReturn + + return preprocessor + + /** @type {Preprocessor} */ + // eslint-disable-next-line complexity + function preprocessor(value, encoding, end) { + /** @type {Array<Chunk>} */ + const chunks = [] + /** @type {RegExpMatchArray | null} */ + let match + /** @type {number} */ + let next + /** @type {number} */ + let startPosition + /** @type {number} */ + let endPosition + /** @type {Code} */ + let code + + value = + buffer + + (typeof value === 'string' + ? value.toString() + : new TextDecoder(encoding || undefined).decode(value)) + + startPosition = 0 + buffer = '' + + if (start) { + // To do: `markdown-rs` actually parses BOMs (byte order mark). + if (value.charCodeAt(0) === codes.byteOrderMarker) { + startPosition++ + } + + start = undefined + } + + while (startPosition < value.length) { + search.lastIndex = startPosition + match = search.exec(value) + endPosition = + match && match.index !== undefined ? match.index : value.length + code = value.charCodeAt(endPosition) + + if (!match) { + buffer = value.slice(startPosition) + break + } + + if ( + code === codes.lf && + startPosition === endPosition && + atCarriageReturn + ) { + chunks.push(codes.carriageReturnLineFeed) + atCarriageReturn = undefined + } else { + if (atCarriageReturn) { + chunks.push(codes.carriageReturn) + atCarriageReturn = undefined + } + + if (startPosition < endPosition) { + chunks.push(value.slice(startPosition, endPosition)) + column += endPosition - startPosition + } + + switch (code) { + case codes.nul: { + chunks.push(codes.replacementCharacter) + column++ + + break + } + + case codes.ht: { + next = Math.ceil(column / constants.tabSize) * constants.tabSize + chunks.push(codes.horizontalTab) + while (column++ < next) chunks.push(codes.virtualSpace) + + break + } + + case codes.lf: { + chunks.push(codes.lineFeed) + column = 1 + + break + } + + default: { + atCarriageReturn = true + column = 1 + } + } + } + + startPosition = endPosition + 1 + } + + if (end) { + if (atCarriageReturn) chunks.push(codes.carriageReturn) + if (buffer) chunks.push(buffer) + chunks.push(codes.eof) + } + + return chunks + } +} diff --git a/tools/ui/node_modules/micromark/dev/stream.d.ts b/tools/ui/node_modules/micromark/dev/stream.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2b05447e816dab4efbeba084a9ad47c37f8d458a --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/stream.d.ts @@ -0,0 +1,35 @@ +/** + * Create a duplex (readable and writable) stream. + * + * Some of the work to parse markdown can be done streaming, but in the + * end buffering is required. + * + * micromark does not handle errors for you, so you must handle errors on whatever + * streams you pipe into it. + * As markdown does not know errors, `micromark` itself does not emit errors. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * @returns {MinimalDuplex} + * Duplex stream. + */ +export function stream(options?: Options | null | undefined): MinimalDuplex; +export type Options = import("micromark-util-types").Options; +/** + * Function called when write was successful. + */ +export type Callback = () => undefined; +/** + * Configuration for piping. + */ +export type PipeOptions = { + /** + * Whether to end the destination stream when the source stream ends. + */ + end?: boolean | null | undefined; +}; +/** + * Duplex stream. + */ +export type MinimalDuplex = Omit<NodeJS.ReadableStream & NodeJS.WritableStream, "isPaused" | "pause" | "read" | "resume" | "setEncoding" | "unpipe" | "unshift" | "wrap">; +//# sourceMappingURL=stream.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/stream.d.ts.map b/tools/ui/node_modules/micromark/dev/stream.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f89c748fa5fb2ff13da0b371e82ea395938d7d71 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/stream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["stream.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;GAcG;AACH,iCALW,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,aAAa,CAoOzB;sBAxQY,OAAO,sBAAsB,EAAE,OAAO;;;;6BAMtC,SAAS;;;;;;;;UAKR,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;4BAG3B,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/dev/stream.js b/tools/ui/node_modules/micromark/dev/stream.js new file mode 100644 index 0000000000000000000000000000000000000000..a72962bcb846991fd2b8e30ddb6e6ca60d9b6c76 --- /dev/null +++ b/tools/ui/node_modules/micromark/dev/stream.js @@ -0,0 +1,270 @@ +/** + * @import {Encoding, Value} from 'micromark-util-types' + */ + +/** + * @typedef {import('micromark-util-types').Options} Options + */ + +/** + * @callback Callback + * Function called when write was successful. + * @returns {undefined} + * Nothing. + * + * @typedef PipeOptions + * Configuration for piping. + * @property {boolean | null | undefined} [end] + * Whether to end the destination stream when the source stream ends. + * + * @typedef {Omit<NodeJS.ReadableStream & NodeJS.WritableStream, 'isPaused' | 'pause' | 'read' | 'resume' | 'setEncoding' | 'unpipe' | 'unshift' | 'wrap'>} MinimalDuplex + * Duplex stream. + */ + +import {EventEmitter} from 'node:events' +import {compile} from './lib/compile.js' +import {parse} from './lib/parse.js' +import {postprocess} from './lib/postprocess.js' +import {preprocess} from './lib/preprocess.js' + +/** + * Create a duplex (readable and writable) stream. + * + * Some of the work to parse markdown can be done streaming, but in the + * end buffering is required. + * + * micromark does not handle errors for you, so you must handle errors on whatever + * streams you pipe into it. + * As markdown does not know errors, `micromark` itself does not emit errors. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * @returns {MinimalDuplex} + * Duplex stream. + */ +export function stream(options) { + const prep = preprocess() + const tokenize = parse(options).document().write + const comp = compile(options) + /** @type {boolean} */ + let ended + + const emitter = /** @type {MinimalDuplex} */ (new EventEmitter()) + // @ts-expect-error: fine. + emitter.end = end + emitter.pipe = pipe + emitter.readable = true + emitter.writable = true + // @ts-expect-error: fine. + emitter.write = write + + return emitter + + /** + * Write a chunk into memory. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + */ + function write(chunk, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = undefined + } + + if (ended) { + throw new Error('Did not expect `write` after `end`') + } + + tokenize(prep(chunk || '', encoding)) + + if (callback) { + callback() + } + + // Signal successful write. + return true + } + + /** + * End the writing. + * + * Passes all arguments as a final `write`. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @param {Callback | Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + */ + function end(chunk, encoding, callback) { + if (typeof chunk === 'function') { + encoding = chunk + chunk = undefined + } + + if (typeof encoding === 'function') { + callback = encoding + encoding = undefined + } + + write(chunk, encoding, callback) + + emitter.emit('data', comp(postprocess(tokenize(prep('', encoding, true))))) + + emitter.emit('end') + ended = true + return true + } + + /** + * Pipe the processor into a writable stream. + * + * Basically `Stream#pipe`, but inlined and simplified to keep the bundled + * size down. + * See: <https://github.com/nodejs/node/blob/43a5170/lib/internal/streams/legacy.js#L13>. + * + * @template {NodeJS.WritableStream} Stream + * Writable stream. + * @param {Stream} destination + * Stream to pipe into. + * @param {PipeOptions | null | undefined} [options] + * Configuration. + * @returns {Stream} + * Destination stream. + */ + function pipe(destination, options) { + emitter.on('data', ondata) + emitter.on('error', onerror) + emitter.on('end', cleanup) + emitter.on('close', cleanup) + + // If the `end` option is not supplied, `destination.end()` will be + // called when the `end` or `close` events are received. + // @ts-expect-error `_isStdio` is available on `std{err,out}` + if (!destination._isStdio && (!options || options.end !== false)) { + emitter.on('end', onend) + } + + destination.on('error', onerror) + destination.on('close', cleanup) + + destination.emit('pipe', emitter) + + return destination + + /** + * End destination stream. + * + * @returns {undefined} + * Nothing. + */ + function onend() { + if (destination.end) { + destination.end() + } + } + + /** + * Handle data. + * + * @param {string} chunk + * Data. + * @returns {undefined} + * Nothing. + */ + function ondata(chunk) { + if (destination.writable) { + destination.write(chunk) + } + } + + /** + * Clean listeners. + * + * @returns {undefined} + * Nothing. + */ + function cleanup() { + emitter.removeListener('data', ondata) + emitter.removeListener('end', onend) + emitter.removeListener('error', onerror) + emitter.removeListener('end', cleanup) + emitter.removeListener('close', cleanup) + + destination.removeListener('error', onerror) + destination.removeListener('close', cleanup) + } + + /** + * Close dangling pipes and handle unheard errors. + * + * @param {Error | null | undefined} [error] + * Error, if any. + * @returns {undefined} + * Nothing. + */ + function onerror(error) { + cleanup() + + if (!emitter.listenerCount('error')) { + throw error // Unhandled stream error in pipe. + } + } + } +} diff --git a/tools/ui/node_modules/micromark/index.d.ts b/tools/ui/node_modules/micromark/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46d294ea1d1cb82ef885834c68917966dc517675 --- /dev/null +++ b/tools/ui/node_modules/micromark/index.d.ts @@ -0,0 +1,82 @@ +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value: Value, encoding: Encoding | null | undefined, options?: Options | null | undefined): string; +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value: Value, options?: Options | null | undefined): string; +export { compile } from "./lib/compile.js"; +export { parse } from "./lib/parse.js"; +export { postprocess } from "./lib/postprocess.js"; +export { preprocess } from "./lib/preprocess.js"; +export type Options = import("micromark-util-types").Options; +import type { Value } from 'micromark-util-types'; +import type { Encoding } from 'micromark-util-types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/index.d.ts.map b/tools/ui/node_modules/micromark/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..be751c4343886457124c00c82ae8c74640b962c9 --- /dev/null +++ b/tools/ui/node_modules/micromark/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG,iCACQ,KAAK,YAEL,QAAQ,GAAG,IAAI,GAAG,SAAS,YAG3B,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAGhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCACQ,KAAK,YAEL,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,MAAM,CAGhB;;;;;sBAvCU,OAAO,sBAAsB,EAAE,OAAO;2BAJjB,sBAAsB;8BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/index.js b/tools/ui/node_modules/micromark/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1977e060adf85e26bc7bb642ad18a02e57ed28f7 --- /dev/null +++ b/tools/ui/node_modules/micromark/index.js @@ -0,0 +1,60 @@ +/** + * @import {Encoding, Value} from 'micromark-util-types' + */ + +/** + * @typedef {import('micromark-util-types').Options} Options + */ + +import { compile } from './lib/compile.js'; +import { parse } from './lib/parse.js'; +import { postprocess } from './lib/postprocess.js'; +import { preprocess } from './lib/preprocess.js'; +export { compile } from './lib/compile.js'; +export { parse } from './lib/parse.js'; +export { postprocess } from './lib/postprocess.js'; +export { preprocess } from './lib/preprocess.js'; + +/** + * Compile markdown to HTML. + * + * > Note: which encodings are supported depends on the engine. + * > For info on Node.js, see: + * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} encoding + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @overload + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + * + * @param {Value} value + * Markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | Options | null | undefined} [encoding] + * Character encoding to understand `value` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Options | null | undefined} [options] + * Configuration. + * @returns {string} + * Compiled HTML. + */ +export function micromark(value, encoding, options) { + if (typeof encoding !== 'string') { + options = encoding; + encoding = undefined; + } + return compile(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true)))); +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/compile.d.ts b/tools/ui/node_modules/micromark/lib/compile.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..819d119153c6f01e4810b2afb1fe92f12b340d35 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/compile.d.ts @@ -0,0 +1,16 @@ +/** + * @param {CompileOptions | null | undefined} [options] + * @returns {Compile} + */ +export function compile(options?: CompileOptions | null | undefined): Compile; +export type Media = { + image?: boolean | undefined; + labelId?: string | undefined; + label?: string | undefined; + referenceId?: string | undefined; + destination?: string | undefined; + title?: string | undefined; +}; +import type { CompileOptions } from 'micromark-util-types'; +import type { Compile } from 'micromark-util-types'; +//# sourceMappingURL=compile.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/compile.d.ts.map b/tools/ui/node_modules/micromark/lib/compile.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e8a8c7fa8874424e500599307d99b2a87347263c --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/compile.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["compile.js"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,kCAHW,cAAc,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,CAgkCnB;;YA/lCa,OAAO,GAAG,SAAS;cACnB,MAAM,GAAG,SAAS;YAClB,MAAM,GAAG,SAAS;kBAClB,MAAM,GAAG,SAAS;kBAClB,MAAM,GAAG,SAAS;YAClB,MAAM,GAAG,SAAS;;oCAVtB,sBAAsB;6BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/compile.js b/tools/ui/node_modules/micromark/lib/compile.js new file mode 100644 index 0000000000000000000000000000000000000000..3d09c8475518626ed2d520f97c29bf14a4c0ee39 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/compile.js @@ -0,0 +1,1060 @@ +/** + * While micromark is a lexer/tokenizer, the common case of going from markdown + * to html is currently built in as this module, even though the parts can be + * used separately to build ASTs, CSTs, or many other output formats. + * + * Having an HTML compiler built in is useful because it allows us to check for + * compliancy to CommonMark, the de facto norm of markdown, specified in roughly + * 600 input/output cases. + * + * This module has an interface that accepts lists of events instead of the + * whole at once, however, because markdown can’t be truly streaming, we buffer + * events before processing and outputting the final result. + */ + +/** + * @import { + * CompileContext, + * CompileData, + * CompileOptions, + * Compile, + * Definition, + * Event, + * Handle, + * HtmlExtension, + * LineEnding, + * NormalizedHtmlExtension, + * Token + * } from 'micromark-util-types' + */ + +/** + * @typedef Media + * @property {boolean | undefined} [image] + * @property {string | undefined} [labelId] + * @property {string | undefined} [label] + * @property {string | undefined} [referenceId] + * @property {string | undefined} [destination] + * @property {string | undefined} [title] + */ + +import { decodeNamedCharacterReference } from 'decode-named-character-reference'; +import { push } from 'micromark-util-chunked'; +import { combineHtmlExtensions } from 'micromark-util-combine-extensions'; +import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference'; +import { encode as _encode } from 'micromark-util-encode'; +import { normalizeIdentifier } from 'micromark-util-normalize-identifier'; +import { sanitizeUri } from 'micromark-util-sanitize-uri'; +const hasOwnProperty = {}.hasOwnProperty; + +/** + * These two are allowlists of safe protocols for full URLs in respectively the + * `href` (on `<a>`) and `src` (on `<img>`) attributes. + * They are based on what is allowed on GitHub, + * <https://github.com/syntax-tree/hast-util-sanitize/blob/9275b21/lib/github.json#L31> + */ +const protocolHref = /^(https?|ircs?|mailto|xmpp)$/i; +const protocolSource = /^https?$/i; + +/** + * @param {CompileOptions | null | undefined} [options] + * @returns {Compile} + */ +export function compile(options) { + const settings = options || {}; + + /** + * Tags is needed because according to markdown, links and emphasis and + * whatnot can exist in images, however, as HTML doesn’t allow content in + * images, the tags are ignored in the `alt` attribute, but the content + * remains. + * + * @type {boolean | undefined} + */ + let tags = true; + + /** + * An object to track identifiers to media (URLs and titles) defined with + * definitions. + * + * @type {Record<string, Definition>} + */ + const definitions = {}; + + /** + * A lot of the handlers need to capture some of the output data, modify it + * somehow, and then deal with it. + * We do that by tracking a stack of buffers, that can be opened (with + * `buffer`) and closed (with `resume`) to access them. + * + * @type {Array<Array<string>>} + */ + const buffers = [[]]; + + /** + * As we can have links in images and the other way around, where the deepest + * ones are closed first, we need to track which one we’re in. + * + * @type {Array<Media>} + */ + const mediaStack = []; + + /** + * Same as `mediaStack` for tightness, which is specific to lists. + * We need to track if we’re currently in a tight or loose container. + * + * @type {Array<boolean>} + */ + const tightStack = []; + + /** @type {HtmlExtension} */ + const defaultHandlers = { + enter: { + blockQuote: onenterblockquote, + codeFenced: onentercodefenced, + codeFencedFenceInfo: buffer, + codeFencedFenceMeta: buffer, + codeIndented: onentercodeindented, + codeText: onentercodetext, + content: onentercontent, + definition: onenterdefinition, + definitionDestinationString: onenterdefinitiondestinationstring, + definitionLabelString: buffer, + definitionTitleString: buffer, + emphasis: onenteremphasis, + htmlFlow: onenterhtmlflow, + htmlText: onenterhtml, + image: onenterimage, + label: buffer, + link: onenterlink, + listItemMarker: onenterlistitemmarker, + listItemValue: onenterlistitemvalue, + listOrdered: onenterlistordered, + listUnordered: onenterlistunordered, + paragraph: onenterparagraph, + reference: buffer, + resource: onenterresource, + resourceDestinationString: onenterresourcedestinationstring, + resourceTitleString: buffer, + setextHeading: onentersetextheading, + strong: onenterstrong + }, + exit: { + atxHeading: onexitatxheading, + atxHeadingSequence: onexitatxheadingsequence, + autolinkEmail: onexitautolinkemail, + autolinkProtocol: onexitautolinkprotocol, + blockQuote: onexitblockquote, + characterEscapeValue: onexitdata, + characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, + characterReferenceMarkerNumeric: onexitcharacterreferencemarker, + characterReferenceValue: onexitcharacterreferencevalue, + codeFenced: onexitflowcode, + codeFencedFence: onexitcodefencedfence, + codeFencedFenceInfo: onexitcodefencedfenceinfo, + codeFencedFenceMeta: onresumedrop, + codeFlowValue: onexitcodeflowvalue, + codeIndented: onexitflowcode, + codeText: onexitcodetext, + codeTextData: onexitdata, + data: onexitdata, + definition: onexitdefinition, + definitionDestinationString: onexitdefinitiondestinationstring, + definitionLabelString: onexitdefinitionlabelstring, + definitionTitleString: onexitdefinitiontitlestring, + emphasis: onexitemphasis, + hardBreakEscape: onexithardbreak, + hardBreakTrailing: onexithardbreak, + htmlFlow: onexithtml, + htmlFlowData: onexitdata, + htmlText: onexithtml, + htmlTextData: onexitdata, + image: onexitmedia, + label: onexitlabel, + labelText: onexitlabeltext, + lineEnding: onexitlineending, + link: onexitmedia, + listOrdered: onexitlistordered, + listUnordered: onexitlistunordered, + paragraph: onexitparagraph, + reference: onresumedrop, + referenceString: onexitreferencestring, + resource: onresumedrop, + resourceDestinationString: onexitresourcedestinationstring, + resourceTitleString: onexitresourcetitlestring, + setextHeading: onexitsetextheading, + setextHeadingLineSequence: onexitsetextheadinglinesequence, + setextHeadingText: onexitsetextheadingtext, + strong: onexitstrong, + thematicBreak: onexitthematicbreak + } + }; + + /** + * Combine the HTML extensions with the default handlers. + * An HTML extension is an object whose fields are either `enter` or `exit` + * (reflecting whether a token is entered or exited). + * The values at such objects are names of tokens mapping to handlers. + * Handlers are called, respectively when a token is opener or closed, with + * that token, and a context as `this`. + */ + const handlers = /** @type {NormalizedHtmlExtension} */ + combineHtmlExtensions([defaultHandlers, ...(settings.htmlExtensions || [])]); + + /** + * Handlers do often need to keep track of some state. + * That state is provided here as a key-value store (an object). + * + * @type {CompileData} + */ + const data = { + definitions, + tightStack + }; + + /** + * The context for handlers references a couple of useful functions. + * In handlers from extensions, those can be accessed at `this`. + * For the handlers here, they can be accessed directly. + * + * @type {Omit<CompileContext, 'sliceSerialize'>} + */ + const context = { + buffer, + encode, + getData, + lineEndingIfNeeded, + options: settings, + raw, + resume, + setData, + tag + }; + + /** + * Generally, micromark copies line endings (`'\r'`, `'\n'`, `'\r\n'`) in the + * markdown document over to the compiled HTML. + * In some cases, such as `> a`, CommonMark requires that extra line endings + * are added: `<blockquote>\n<p>a</p>\n</blockquote>`. + * This variable hold the default line ending when given (or `undefined`), + * and in the latter case will be updated to the first found line ending if + * there is one. + */ + let lineEndingStyle = settings.defaultLineEnding; + + // Return the function that handles a slice of events. + return compile; + + /** + * Deal w/ a slice of events. + * Return either the empty string if there’s nothing of note to return, or the + * result when done. + * + * @param {ReadonlyArray<Event>} events + * @returns {string} + */ + function compile(events) { + let index = -1; + let start = 0; + /** @type {Array<number>} */ + const listStack = []; + // As definitions can come after references, we need to figure out the media + // (urls and titles) defined by them before handling the references. + // So, we do sort of what HTML does: put metadata at the start (in head), and + // then put content after (`body`). + /** @type {Array<Event>} */ + let head = []; + /** @type {Array<Event>} */ + let body = []; + while (++index < events.length) { + // Figure out the line ending style used in the document. + if (!lineEndingStyle && (events[index][1].type === "lineEnding" || events[index][1].type === "lineEndingBlank")) { + lineEndingStyle = /** @type {LineEnding} */ + events[index][2].sliceSerialize(events[index][1]); + } + + // Preprocess lists to infer whether the list is loose or not. + if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") { + if (events[index][0] === 'enter') { + listStack.push(index); + } else { + prepareList(events.slice(listStack.pop(), index)); + } + } + + // Move definitions to the front. + if (events[index][1].type === "definition") { + if (events[index][0] === 'enter') { + body = push(body, events.slice(start, index)); + start = index; + } else { + head = push(head, events.slice(start, index + 1)); + start = index + 1; + } + } + } + head = push(head, body); + head = push(head, events.slice(start)); + index = -1; + const result = head; + + // Handle the start of the document, if defined. + if (handlers.enter.null) { + handlers.enter.null.call(context); + } + + // Handle all events. + while (++index < events.length) { + const handles = handlers[result[index][0]]; + const kind = result[index][1].type; + const handle = handles[kind]; + if (hasOwnProperty.call(handles, kind) && handle) { + handle.call({ + sliceSerialize: result[index][2].sliceSerialize, + ...context + }, result[index][1]); + } + } + + // Handle the end of the document, if defined. + if (handlers.exit.null) { + handlers.exit.null.call(context); + } + return buffers[0].join(''); + } + + /** + * Figure out whether lists are loose or not. + * + * @param {ReadonlyArray<Event>} slice + * @returns {undefined} + */ + function prepareList(slice) { + const length = slice.length; + let index = 0; // Skip open. + let containerBalance = 0; + let loose = false; + /** @type {boolean | undefined} */ + let atMarker; + while (++index < length) { + const event = slice[index]; + if (event[1]._container) { + atMarker = undefined; + if (event[0] === 'enter') { + containerBalance++; + } else { + containerBalance--; + } + } else switch (event[1].type) { + case "listItemPrefix": + { + if (event[0] === 'exit') { + atMarker = true; + } + break; + } + case "linePrefix": + { + // Ignore + + break; + } + case "lineEndingBlank": + { + if (event[0] === 'enter' && !containerBalance) { + if (atMarker) { + atMarker = undefined; + } else { + loose = true; + } + } + break; + } + default: + { + atMarker = undefined; + } + } + } + slice[0][1]._loose = loose; + } + + /** + * @type {CompileContext['setData']} + */ + function setData(key, value) { + // @ts-expect-error: assume `value` is omitted (`undefined` is passed) only + // if allowed. + data[key] = value; + } + + /** + * @type {CompileContext['getData']} + */ + function getData(key) { + return data[key]; + } + + /** @type {CompileContext['buffer']} */ + function buffer() { + buffers.push([]); + } + + /** @type {CompileContext['resume']} */ + function resume() { + const buf = buffers.pop(); + return buf.join(''); + } + + /** @type {CompileContext['tag']} */ + function tag(value) { + if (!tags) return; + setData('lastWasTag', true); + buffers[buffers.length - 1].push(value); + } + + /** @type {CompileContext['raw']} */ + function raw(value) { + setData('lastWasTag'); + buffers[buffers.length - 1].push(value); + } + + /** + * Output an extra line ending. + * + * @returns {undefined} + */ + function lineEnding() { + raw(lineEndingStyle || '\n'); + } + + /** @type {CompileContext['lineEndingIfNeeded']} */ + function lineEndingIfNeeded() { + const buffer = buffers[buffers.length - 1]; + const slice = buffer[buffer.length - 1]; + const previous = slice ? slice.charCodeAt(slice.length - 1) : null; + if (previous === 10 || previous === 13 || previous === null) { + return; + } + lineEnding(); + } + + /** @type {CompileContext['encode']} */ + function encode(value) { + return getData('ignoreEncode') ? value : _encode(value); + } + + // + // Handlers. + // + + /** + * @returns {undefined} + */ + function onresumedrop() { + resume(); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterlistordered(token) { + tightStack.push(!token._loose); + lineEndingIfNeeded(); + tag('<ol'); + setData('expectFirstItem', true); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterlistunordered(token) { + tightStack.push(!token._loose); + lineEndingIfNeeded(); + tag('<ul'); + setData('expectFirstItem', true); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterlistitemvalue(token) { + if (getData('expectFirstItem')) { + const value = Number.parseInt(this.sliceSerialize(token), 10); + if (value !== 1) { + tag(' start="' + encode(String(value)) + '"'); + } + } + } + + /** + * @returns {undefined} + */ + function onenterlistitemmarker() { + if (getData('expectFirstItem')) { + tag('>'); + } else { + onexitlistitem(); + } + lineEndingIfNeeded(); + tag('<li>'); + setData('expectFirstItem'); + // “Hack” to prevent a line ending from showing up if the item is empty. + setData('lastWasTag'); + } + + /** + * @returns {undefined} + */ + function onexitlistordered() { + onexitlistitem(); + tightStack.pop(); + lineEnding(); + tag('</ol>'); + } + + /** + * @returns {undefined} + */ + function onexitlistunordered() { + onexitlistitem(); + tightStack.pop(); + lineEnding(); + tag('</ul>'); + } + + /** + * @returns {undefined} + */ + function onexitlistitem() { + if (getData('lastWasTag') && !getData('slurpAllLineEndings')) { + lineEndingIfNeeded(); + } + tag('</li>'); + setData('slurpAllLineEndings'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterblockquote() { + tightStack.push(false); + lineEndingIfNeeded(); + tag('<blockquote>'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitblockquote() { + tightStack.pop(); + lineEndingIfNeeded(); + tag('</blockquote>'); + setData('slurpAllLineEndings'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterparagraph() { + if (!tightStack[tightStack.length - 1]) { + lineEndingIfNeeded(); + tag('<p>'); + } + setData('slurpAllLineEndings'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitparagraph() { + if (tightStack[tightStack.length - 1]) { + setData('slurpAllLineEndings', true); + } else { + tag('</p>'); + } + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onentercodefenced() { + lineEndingIfNeeded(); + tag('<pre><code'); + setData('fencesCount', 0); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitcodefencedfenceinfo() { + const value = resume(); + tag(' class="language-' + value + '"'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitcodefencedfence() { + const count = getData('fencesCount') || 0; + if (!count) { + tag('>'); + setData('slurpOneLineEnding', true); + } + setData('fencesCount', count + 1); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onentercodeindented() { + lineEndingIfNeeded(); + tag('<pre><code>'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitflowcode() { + const count = getData('fencesCount'); + + // One special case is if we are inside a container, and the fenced code was + // not closed (meaning it runs to the end). + // In that case, the following line ending, is considered *outside* the + // fenced code and block quote by micromark, but CM wants to treat that + // ending as part of the code. + if (count !== undefined && count < 2 && data.tightStack.length > 0 && !getData('lastWasTag')) { + lineEnding(); + } + + // But in most cases, it’s simpler: when we’ve seen some data, emit an extra + // line ending when needed. + if (getData('flowCodeSeenData')) { + lineEndingIfNeeded(); + } + tag('</code></pre>'); + if (count !== undefined && count < 2) lineEndingIfNeeded(); + setData('flowCodeSeenData'); + setData('fencesCount'); + setData('slurpOneLineEnding'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterimage() { + mediaStack.push({ + image: true + }); + tags = undefined; // Disallow tags. + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterlink() { + mediaStack.push({}); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitlabeltext(token) { + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitlabel() { + mediaStack[mediaStack.length - 1].label = resume(); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitreferencestring(token) { + mediaStack[mediaStack.length - 1].referenceId = this.sliceSerialize(token); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterresource() { + buffer(); // We can have line endings in the resource, ignore them. + mediaStack[mediaStack.length - 1].destination = ''; + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterresourcedestinationstring() { + buffer(); + // Ignore encoding the result, as we’ll first percent encode the url and + // encode manually after. + setData('ignoreEncode', true); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitresourcedestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume(); + setData('ignoreEncode'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitresourcetitlestring() { + mediaStack[mediaStack.length - 1].title = resume(); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitmedia() { + let index = mediaStack.length - 1; // Skip current. + const media = mediaStack[index]; + const id = media.referenceId || media.labelId; + const context = media.destination === undefined ? definitions[normalizeIdentifier(id)] : media; + tags = true; + while (index--) { + if (mediaStack[index].image) { + tags = undefined; + break; + } + } + if (media.image) { + tag('<img src="' + sanitizeUri(context.destination, settings.allowDangerousProtocol ? undefined : protocolSource) + '" alt="'); + raw(media.label); + tag('"'); + } else { + tag('<a href="' + sanitizeUri(context.destination, settings.allowDangerousProtocol ? undefined : protocolHref) + '"'); + } + tag(context.title ? ' title="' + context.title + '"' : ''); + if (media.image) { + tag(' />'); + } else { + tag('>'); + raw(media.label); + tag('</a>'); + } + mediaStack.pop(); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterdefinition() { + buffer(); + mediaStack.push({}); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdefinitionlabelstring(token) { + // Discard label, use the source content instead. + resume(); + mediaStack[mediaStack.length - 1].labelId = this.sliceSerialize(token); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onenterdefinitiondestinationstring() { + buffer(); + setData('ignoreEncode', true); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdefinitiondestinationstring() { + mediaStack[mediaStack.length - 1].destination = resume(); + setData('ignoreEncode'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdefinitiontitlestring() { + mediaStack[mediaStack.length - 1].title = resume(); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdefinition() { + const media = mediaStack[mediaStack.length - 1]; + const id = normalizeIdentifier(media.labelId); + resume(); + if (!hasOwnProperty.call(definitions, id)) { + definitions[id] = mediaStack[mediaStack.length - 1]; + } + mediaStack.pop(); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onentercontent() { + setData('slurpAllLineEndings', true); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitatxheadingsequence(token) { + // Exit for further sequences. + if (getData('headingRank')) return; + setData('headingRank', this.sliceSerialize(token).length); + lineEndingIfNeeded(); + tag('<h' + getData('headingRank') + '>'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onentersetextheading() { + buffer(); + setData('slurpAllLineEndings'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitsetextheadingtext() { + setData('slurpAllLineEndings', true); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitatxheading() { + tag('</h' + getData('headingRank') + '>'); + setData('headingRank'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitsetextheadinglinesequence(token) { + setData('headingRank', this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitsetextheading() { + const value = resume(); + lineEndingIfNeeded(); + tag('<h' + getData('headingRank') + '>'); + raw(value); + tag('</h' + getData('headingRank') + '>'); + setData('slurpAllLineEndings'); + setData('headingRank'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitdata(token) { + raw(encode(this.sliceSerialize(token))); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitlineending(token) { + if (getData('slurpAllLineEndings')) { + return; + } + if (getData('slurpOneLineEnding')) { + setData('slurpOneLineEnding'); + return; + } + if (getData('inCodeText')) { + raw(' '); + return; + } + raw(encode(this.sliceSerialize(token))); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitcodeflowvalue(token) { + raw(encode(this.sliceSerialize(token))); + setData('flowCodeSeenData', true); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexithardbreak() { + tag('<br />'); + } + + /** + * @returns {undefined} + */ + function onenterhtmlflow() { + lineEndingIfNeeded(); + onenterhtml(); + } + + /** + * @returns {undefined} + */ + function onexithtml() { + setData('ignoreEncode'); + } + + /** + * @returns {undefined} + */ + function onenterhtml() { + if (settings.allowDangerousHtml) { + setData('ignoreEncode', true); + } + } + + /** + * @returns {undefined} + */ + function onenteremphasis() { + tag('<em>'); + } + + /** + * @returns {undefined} + */ + function onenterstrong() { + tag('<strong>'); + } + + /** + * @returns {undefined} + */ + function onentercodetext() { + setData('inCodeText', true); + tag('<code>'); + } + + /** + * @returns {undefined} + */ + function onexitcodetext() { + setData('inCodeText'); + tag('</code>'); + } + + /** + * @returns {undefined} + */ + function onexitemphasis() { + tag('</em>'); + } + + /** + * @returns {undefined} + */ + function onexitstrong() { + tag('</strong>'); + } + + /** + * @returns {undefined} + */ + function onexitthematicbreak() { + lineEndingIfNeeded(); + tag('<hr />'); + } + + /** + * @this {CompileContext} + * @param {Token} token + * @returns {undefined} + */ + function onexitcharacterreferencemarker(token) { + setData('characterReferenceType', token.type); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitcharacterreferencevalue(token) { + const value = this.sliceSerialize(token); + const decoded = getData('characterReferenceType') ? decodeNumericCharacterReference(value, getData('characterReferenceType') === "characterReferenceMarkerNumeric" ? 10 : 16) : decodeNamedCharacterReference(value); + + // `decodeNamedCharacterReference` can return `false` for invalid named + // character references, + // but everything we’ve tokenized is valid. + raw(encode(/** @type {string} */decoded)); + setData('characterReferenceType'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitautolinkprotocol(token) { + const uri = this.sliceSerialize(token); + tag('<a href="' + sanitizeUri(uri, settings.allowDangerousProtocol ? undefined : protocolHref) + '">'); + raw(encode(uri)); + tag('</a>'); + } + + /** + * @this {CompileContext} + * @type {Handle} + */ + function onexitautolinkemail(token) { + const uri = this.sliceSerialize(token); + tag('<a href="' + sanitizeUri('mailto:' + uri) + '">'); + raw(encode(uri)); + tag('</a>'); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/constructs.d.ts b/tools/ui/node_modules/micromark/lib/constructs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a83c7e0f647fe705024dedb909b034f5316dc27f --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/constructs.d.ts @@ -0,0 +1,73 @@ +/** @satisfies {Extension['document']} */ +export const document: { + 42: import("micromark-util-types").Construct; + 43: import("micromark-util-types").Construct; + 45: import("micromark-util-types").Construct; + 48: import("micromark-util-types").Construct; + 49: import("micromark-util-types").Construct; + 50: import("micromark-util-types").Construct; + 51: import("micromark-util-types").Construct; + 52: import("micromark-util-types").Construct; + 53: import("micromark-util-types").Construct; + 54: import("micromark-util-types").Construct; + 55: import("micromark-util-types").Construct; + 56: import("micromark-util-types").Construct; + 57: import("micromark-util-types").Construct; + 62: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['contentInitial']} */ +export const contentInitial: { + 91: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['flowInitial']} */ +export const flowInitial: { + [-2]: import("micromark-util-types").Construct; + [-1]: import("micromark-util-types").Construct; + 32: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['flow']} */ +export const flow: { + 35: import("micromark-util-types").Construct; + 42: import("micromark-util-types").Construct; + 45: import("micromark-util-types").Construct[]; + 60: import("micromark-util-types").Construct; + 61: import("micromark-util-types").Construct; + 95: import("micromark-util-types").Construct; + 96: import("micromark-util-types").Construct; + 126: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['string']} */ +export const string: { + 38: import("micromark-util-types").Construct; + 92: import("micromark-util-types").Construct; +}; +/** @satisfies {Extension['text']} */ +export const text: { + [-5]: import("micromark-util-types").Construct; + [-4]: import("micromark-util-types").Construct; + [-3]: import("micromark-util-types").Construct; + 33: import("micromark-util-types").Construct; + 38: import("micromark-util-types").Construct; + 42: import("micromark-util-types").Construct; + 60: import("micromark-util-types").Construct[]; + 91: import("micromark-util-types").Construct; + 92: import("micromark-util-types").Construct[]; + 93: import("micromark-util-types").Construct; + 95: import("micromark-util-types").Construct; + 96: import("micromark-util-types").Construct; +}; +export namespace insideSpan { + let _null: (import("micromark-util-types").Construct | { + resolveAll: import("micromark-util-types").Resolver; + })[]; + export { _null as null }; +} +export namespace attentionMarkers { + let _null_1: (42 | 95)[]; + export { _null_1 as null }; +} +export namespace disable { + let _null_2: never[]; + export { _null_2 as null }; +} +//# sourceMappingURL=constructs.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/constructs.d.ts.map b/tools/ui/node_modules/micromark/lib/constructs.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..58fdf52fb128c25f3596b78bafecdc72a77455db --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/constructs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constructs.d.ts","sourceRoot":"","sources":["constructs.js"],"names":[],"mappings":"AA6BA,yCAAyC;AACzC;;;;;;;;;;;;;;;EAeC;AAED,+CAA+C;AAC/C;;EAEC;AAED,4CAA4C;AAC5C;;;;EAIC;AAED,qCAAqC;AACrC;;;;;;;;;EASC;AAED,uCAAuC;AACvC;;;EAGC;AAED,qCAAqC;AACrC;;;;;;;;;;;;;EAaC"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/constructs.js b/tools/ui/node_modules/micromark/lib/constructs.js new file mode 100644 index 0000000000000000000000000000000000000000..135bfbfe74f6670bcea89586414a537d3bb9f2b3 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/constructs.js @@ -0,0 +1,85 @@ +/** + * @import {Extension} from 'micromark-util-types' + */ + +import { attention, autolink, blockQuote, characterEscape, characterReference, codeFenced, codeIndented, codeText, definition, hardBreakEscape, headingAtx, htmlFlow, htmlText, labelEnd, labelStartImage, labelStartLink, lineEnding, list, setextUnderline, thematicBreak } from 'micromark-core-commonmark'; +import { resolver as resolveText } from './initialize/text.js'; + +/** @satisfies {Extension['document']} */ +export const document = { + [42]: list, + [43]: list, + [45]: list, + [48]: list, + [49]: list, + [50]: list, + [51]: list, + [52]: list, + [53]: list, + [54]: list, + [55]: list, + [56]: list, + [57]: list, + [62]: blockQuote +}; + +/** @satisfies {Extension['contentInitial']} */ +export const contentInitial = { + [91]: definition +}; + +/** @satisfies {Extension['flowInitial']} */ +export const flowInitial = { + [-2]: codeIndented, + [-1]: codeIndented, + [32]: codeIndented +}; + +/** @satisfies {Extension['flow']} */ +export const flow = { + [35]: headingAtx, + [42]: thematicBreak, + [45]: [setextUnderline, thematicBreak], + [60]: htmlFlow, + [61]: setextUnderline, + [95]: thematicBreak, + [96]: codeFenced, + [126]: codeFenced +}; + +/** @satisfies {Extension['string']} */ +export const string = { + [38]: characterReference, + [92]: characterEscape +}; + +/** @satisfies {Extension['text']} */ +export const text = { + [-5]: lineEnding, + [-4]: lineEnding, + [-3]: lineEnding, + [33]: labelStartImage, + [38]: characterReference, + [42]: attention, + [60]: [autolink, htmlText], + [91]: labelStartLink, + [92]: [hardBreakEscape, characterEscape], + [93]: labelEnd, + [95]: attention, + [96]: codeText +}; + +/** @satisfies {Extension['insideSpan']} */ +export const insideSpan = { + null: [attention, resolveText] +}; + +/** @satisfies {Extension['attentionMarkers']} */ +export const attentionMarkers = { + null: [42, 95] +}; + +/** @satisfies {Extension['disable']} */ +export const disable = { + null: [] +}; \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/create-tokenizer.d.ts b/tools/ui/node_modules/micromark/lib/create-tokenizer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..989201b5cdced893bc9c34a72917454b5469cc75 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/create-tokenizer.d.ts @@ -0,0 +1,46 @@ +/** + * Create a tokenizer. + * Tokenizers deal with one type of data (e.g., containers, flow, text). + * The parser is the object dealing with it all. + * `initialize` works like other constructs, except that only its `tokenize` + * function is used, in which case it doesn’t receive an `ok` or `nok`. + * `from` can be given to set the point before the first character, although + * when further lines are indented, they must be set with `defineSkip`. + * + * @param {ParseContext} parser + * Parser. + * @param {InitialConstruct} initialize + * Construct. + * @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from] + * Point (optional). + * @returns {TokenizeContext} + * Context. + */ +export function createTokenizer(parser: ParseContext, initialize: InitialConstruct, from?: Omit<Point, "_bufferIndex" | "_index"> | undefined): TokenizeContext; +/** + * Restore the state. + */ +export type Restore = () => undefined; +/** + * Info. + */ +export type Info = { + /** + * Restore. + */ + restore: Restore; + /** + * From. + */ + from: number; +}; +/** + * Handle a successful run. + */ +export type ReturnHandle = (construct: Construct, info: Info) => undefined; +import type { ParseContext } from 'micromark-util-types'; +import type { InitialConstruct } from 'micromark-util-types'; +import type { Point } from 'micromark-util-types'; +import type { TokenizeContext } from 'micromark-util-types'; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=create-tokenizer.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/create-tokenizer.d.ts.map b/tools/ui/node_modules/micromark/lib/create-tokenizer.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c4eeb0ab93579edba93c265f0c66b66d68bbf418 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/create-tokenizer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"create-tokenizer.d.ts","sourceRoot":"","sources":["create-tokenizer.js"],"names":[],"mappings":"AAgDA;;;;;;;;;;;;;;;;;GAiBG;AACH,wCATW,YAAY,cAEZ,gBAAgB,SAEhB,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,QAAQ,CAAC,GAAG,SAAS,GAEhD,eAAe,CAwhB3B;;;;4BApkBY,SAAS;;;;;;;;aAKR,OAAO;;;;UAEP,MAAM;;;;;uCAKT,SAAS,QAET,IAAI,KAEF,SAAS;kCAtBZ,sBAAsB;sCAAtB,sBAAsB;2BAAtB,sBAAsB;qCAAtB,sBAAsB;+BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/create-tokenizer.js b/tools/ui/node_modules/micromark/lib/create-tokenizer.js new file mode 100644 index 0000000000000000000000000000000000000000..50aded8a5da95a3a2dad07427ba60b8ffcf836f1 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/create-tokenizer.js @@ -0,0 +1,611 @@ +/** + * @import { + * Chunk, + * Code, + * ConstructRecord, + * Construct, + * Effects, + * InitialConstruct, + * ParseContext, + * Point, + * State, + * TokenizeContext, + * Token + * } from 'micromark-util-types' + */ + +/** + * @callback Restore + * Restore the state. + * @returns {undefined} + * Nothing. + * + * @typedef Info + * Info. + * @property {Restore} restore + * Restore. + * @property {number} from + * From. + * + * @callback ReturnHandle + * Handle a successful run. + * @param {Construct} construct + * Construct. + * @param {Info} info + * Info. + * @returns {undefined} + * Nothing. + */ + +import { markdownLineEnding } from 'micromark-util-character'; +import { push, splice } from 'micromark-util-chunked'; +import { resolveAll } from 'micromark-util-resolve-all'; +/** + * Create a tokenizer. + * Tokenizers deal with one type of data (e.g., containers, flow, text). + * The parser is the object dealing with it all. + * `initialize` works like other constructs, except that only its `tokenize` + * function is used, in which case it doesn’t receive an `ok` or `nok`. + * `from` can be given to set the point before the first character, although + * when further lines are indented, they must be set with `defineSkip`. + * + * @param {ParseContext} parser + * Parser. + * @param {InitialConstruct} initialize + * Construct. + * @param {Omit<Point, '_bufferIndex' | '_index'> | undefined} [from] + * Point (optional). + * @returns {TokenizeContext} + * Context. + */ +export function createTokenizer(parser, initialize, from) { + /** @type {Point} */ + let point = { + _bufferIndex: -1, + _index: 0, + line: from && from.line || 1, + column: from && from.column || 1, + offset: from && from.offset || 0 + }; + /** @type {Record<string, number>} */ + const columnStart = {}; + /** @type {Array<Construct>} */ + const resolveAllConstructs = []; + /** @type {Array<Chunk>} */ + let chunks = []; + /** @type {Array<Token>} */ + let stack = []; + /** @type {boolean | undefined} */ + let consumed = true; + + /** + * Tools used for tokenizing. + * + * @type {Effects} + */ + const effects = { + attempt: constructFactory(onsuccessfulconstruct), + check: constructFactory(onsuccessfulcheck), + consume, + enter, + exit, + interrupt: constructFactory(onsuccessfulcheck, { + interrupt: true + }) + }; + + /** + * State and tools for resolving and serializing. + * + * @type {TokenizeContext} + */ + const context = { + code: null, + containerState: {}, + defineSkip, + events: [], + now, + parser, + previous: null, + sliceSerialize, + sliceStream, + write + }; + + /** + * The state function. + * + * @type {State | undefined} + */ + let state = initialize.tokenize.call(context, effects); + + /** + * Track which character we expect to be consumed, to catch bugs. + * + * @type {Code} + */ + let expectedCode; + if (initialize.resolveAll) { + resolveAllConstructs.push(initialize); + } + return context; + + /** @type {TokenizeContext['write']} */ + function write(slice) { + chunks = push(chunks, slice); + main(); + + // Exit if we’re not done, resolve might change stuff. + if (chunks[chunks.length - 1] !== null) { + return []; + } + addResult(initialize, 0); + + // Otherwise, resolve, and exit. + context.events = resolveAll(resolveAllConstructs, context.events, context); + return context.events; + } + + // + // Tools. + // + + /** @type {TokenizeContext['sliceSerialize']} */ + function sliceSerialize(token, expandTabs) { + return serializeChunks(sliceStream(token), expandTabs); + } + + /** @type {TokenizeContext['sliceStream']} */ + function sliceStream(token) { + return sliceChunks(chunks, token); + } + + /** @type {TokenizeContext['now']} */ + function now() { + // This is a hot path, so we clone manually instead of `Object.assign({}, point)` + const { + _bufferIndex, + _index, + line, + column, + offset + } = point; + return { + _bufferIndex, + _index, + line, + column, + offset + }; + } + + /** @type {TokenizeContext['defineSkip']} */ + function defineSkip(value) { + columnStart[value.line] = value.column; + accountForPotentialSkip(); + } + + // + // State management. + // + + /** + * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by + * `consume`). + * Here is where we walk through the chunks, which either include strings of + * several characters, or numerical character codes. + * The reason to do this in a loop instead of a call is so the stack can + * drain. + * + * @returns {undefined} + * Nothing. + */ + function main() { + /** @type {number} */ + let chunkIndex; + while (point._index < chunks.length) { + const chunk = chunks[point._index]; + + // If we’re in a buffer chunk, loop through it. + if (typeof chunk === 'string') { + chunkIndex = point._index; + if (point._bufferIndex < 0) { + point._bufferIndex = 0; + } + while (point._index === chunkIndex && point._bufferIndex < chunk.length) { + go(chunk.charCodeAt(point._bufferIndex)); + } + } else { + go(chunk); + } + } + } + + /** + * Deal with one code. + * + * @param {Code} code + * Code. + * @returns {undefined} + * Nothing. + */ + function go(code) { + consumed = undefined; + expectedCode = code; + state = state(code); + } + + /** @type {Effects['consume']} */ + function consume(code) { + if (markdownLineEnding(code)) { + point.line++; + point.column = 1; + point.offset += code === -3 ? 2 : 1; + accountForPotentialSkip(); + } else if (code !== -1) { + point.column++; + point.offset++; + } + + // Not in a string chunk. + if (point._bufferIndex < 0) { + point._index++; + } else { + point._bufferIndex++; + + // At end of string chunk. + if (point._bufferIndex === + // Points w/ non-negative `_bufferIndex` reference + // strings. + /** @type {string} */ + chunks[point._index].length) { + point._bufferIndex = -1; + point._index++; + } + } + + // Expose the previous character. + context.previous = code; + + // Mark as consumed. + consumed = true; + } + + /** @type {Effects['enter']} */ + function enter(type, fields) { + /** @type {Token} */ + // @ts-expect-error Patch instead of assign required fields to help GC. + const token = fields || {}; + token.type = type; + token.start = now(); + context.events.push(['enter', token, context]); + stack.push(token); + return token; + } + + /** @type {Effects['exit']} */ + function exit(type) { + const token = stack.pop(); + token.end = now(); + context.events.push(['exit', token, context]); + return token; + } + + /** + * Use results. + * + * @type {ReturnHandle} + */ + function onsuccessfulconstruct(construct, info) { + addResult(construct, info.from); + } + + /** + * Discard results. + * + * @type {ReturnHandle} + */ + function onsuccessfulcheck(_, info) { + info.restore(); + } + + /** + * Factory to attempt/check/interrupt. + * + * @param {ReturnHandle} onreturn + * Callback. + * @param {{interrupt?: boolean | undefined} | undefined} [fields] + * Fields. + */ + function constructFactory(onreturn, fields) { + return hook; + + /** + * Handle either an object mapping codes to constructs, a list of + * constructs, or a single construct. + * + * @param {Array<Construct> | ConstructRecord | Construct} constructs + * Constructs. + * @param {State} returnState + * State. + * @param {State | undefined} [bogusState] + * State. + * @returns {State} + * State. + */ + function hook(constructs, returnState, bogusState) { + /** @type {ReadonlyArray<Construct>} */ + let listOfConstructs; + /** @type {number} */ + let constructIndex; + /** @type {Construct} */ + let currentConstruct; + /** @type {Info} */ + let info; + return Array.isArray(constructs) ? /* c8 ignore next 1 */ + handleListOfConstructs(constructs) : 'tokenize' in constructs ? + // Looks like a construct. + handleListOfConstructs([(/** @type {Construct} */constructs)]) : handleMapOfConstructs(constructs); + + /** + * Handle a list of construct. + * + * @param {ConstructRecord} map + * Constructs. + * @returns {State} + * State. + */ + function handleMapOfConstructs(map) { + return start; + + /** @type {State} */ + function start(code) { + const left = code !== null && map[code]; + const all = code !== null && map.null; + const list = [ + // To do: add more extension tests. + /* c8 ignore next 2 */ + ...(Array.isArray(left) ? left : left ? [left] : []), ...(Array.isArray(all) ? all : all ? [all] : [])]; + return handleListOfConstructs(list)(code); + } + } + + /** + * Handle a list of construct. + * + * @param {ReadonlyArray<Construct>} list + * Constructs. + * @returns {State} + * State. + */ + function handleListOfConstructs(list) { + listOfConstructs = list; + constructIndex = 0; + if (list.length === 0) { + return bogusState; + } + return handleConstruct(list[constructIndex]); + } + + /** + * Handle a single construct. + * + * @param {Construct} construct + * Construct. + * @returns {State} + * State. + */ + function handleConstruct(construct) { + return start; + + /** @type {State} */ + function start(code) { + // To do: not needed to store if there is no bogus state, probably? + // Currently doesn’t work because `inspect` in document does a check + // w/o a bogus, which doesn’t make sense. But it does seem to help perf + // by not storing. + info = store(); + currentConstruct = construct; + if (!construct.partial) { + context.currentConstruct = construct; + } + + // Always populated by defaults. + + if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) { + return nok(code); + } + return construct.tokenize.call( + // If we do have fields, create an object w/ `context` as its + // prototype. + // This allows a “live binding”, which is needed for `interrupt`. + fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code); + } + } + + /** @type {State} */ + function ok(code) { + consumed = true; + onreturn(currentConstruct, info); + return returnState; + } + + /** @type {State} */ + function nok(code) { + consumed = true; + info.restore(); + if (++constructIndex < listOfConstructs.length) { + return handleConstruct(listOfConstructs[constructIndex]); + } + return bogusState; + } + } + } + + /** + * @param {Construct} construct + * Construct. + * @param {number} from + * From. + * @returns {undefined} + * Nothing. + */ + function addResult(construct, from) { + if (construct.resolveAll && !resolveAllConstructs.includes(construct)) { + resolveAllConstructs.push(construct); + } + if (construct.resolve) { + splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context)); + } + if (construct.resolveTo) { + context.events = construct.resolveTo(context.events, context); + } + } + + /** + * Store state. + * + * @returns {Info} + * Info. + */ + function store() { + const startPoint = now(); + const startPrevious = context.previous; + const startCurrentConstruct = context.currentConstruct; + const startEventsIndex = context.events.length; + const startStack = Array.from(stack); + return { + from: startEventsIndex, + restore + }; + + /** + * Restore state. + * + * @returns {undefined} + * Nothing. + */ + function restore() { + point = startPoint; + context.previous = startPrevious; + context.currentConstruct = startCurrentConstruct; + context.events.length = startEventsIndex; + stack = startStack; + accountForPotentialSkip(); + } + } + + /** + * Move the current point a bit forward in the line when it’s on a column + * skip. + * + * @returns {undefined} + * Nothing. + */ + function accountForPotentialSkip() { + if (point.line in columnStart && point.column < 2) { + point.column = columnStart[point.line]; + point.offset += columnStart[point.line] - 1; + } + } +} + +/** + * Get the chunks from a slice of chunks in the range of a token. + * + * @param {ReadonlyArray<Chunk>} chunks + * Chunks. + * @param {Pick<Token, 'end' | 'start'>} token + * Token. + * @returns {Array<Chunk>} + * Chunks. + */ +function sliceChunks(chunks, token) { + const startIndex = token.start._index; + const startBufferIndex = token.start._bufferIndex; + const endIndex = token.end._index; + const endBufferIndex = token.end._bufferIndex; + /** @type {Array<Chunk>} */ + let view; + if (startIndex === endIndex) { + // @ts-expect-error `_bufferIndex` is used on string chunks. + view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; + } else { + view = chunks.slice(startIndex, endIndex); + if (startBufferIndex > -1) { + const head = view[0]; + if (typeof head === 'string') { + view[0] = head.slice(startBufferIndex); + /* c8 ignore next 4 -- used to be used, no longer */ + } else { + view.shift(); + } + } + if (endBufferIndex > 0) { + // @ts-expect-error `_bufferIndex` is used on string chunks. + view.push(chunks[endIndex].slice(0, endBufferIndex)); + } + } + return view; +} + +/** + * Get the string value of a slice of chunks. + * + * @param {ReadonlyArray<Chunk>} chunks + * Chunks. + * @param {boolean | undefined} [expandTabs=false] + * Whether to expand tabs (default: `false`). + * @returns {string} + * Result. + */ +function serializeChunks(chunks, expandTabs) { + let index = -1; + /** @type {Array<string>} */ + const result = []; + /** @type {boolean | undefined} */ + let atTab; + while (++index < chunks.length) { + const chunk = chunks[index]; + /** @type {string} */ + let value; + if (typeof chunk === 'string') { + value = chunk; + } else switch (chunk) { + case -5: + { + value = "\r"; + break; + } + case -4: + { + value = "\n"; + break; + } + case -3: + { + value = "\r" + "\n"; + break; + } + case -2: + { + value = expandTabs ? " " : "\t"; + break; + } + case -1: + { + if (!expandTabs && atTab) continue; + value = " "; + break; + } + default: + { + // Currently only replacement character. + value = String.fromCharCode(chunk); + } + } + atTab = chunk === -2; + result.push(value); + } + return result.join(''); +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/content.d.ts b/tools/ui/node_modules/micromark/lib/initialize/content.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..11fda4c1407aec4e6a30aeff11870a2bfd9154fa --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/content.d.ts @@ -0,0 +1,4 @@ +/** @type {InitialConstruct} */ +export const content: InitialConstruct; +import type { InitialConstruct } from 'micromark-util-types'; +//# sourceMappingURL=content.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/content.d.ts.map b/tools/ui/node_modules/micromark/lib/initialize/content.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7670bed73fb1e0dbe91716c13f00ffc2a599045c --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/content.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["content.js"],"names":[],"mappings":"AAeA,+BAA+B;AAC/B,sBADW,gBAAgB,CACyB;sCAT1C,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/content.js b/tools/ui/node_modules/micromark/lib/initialize/content.js new file mode 100644 index 0000000000000000000000000000000000000000..1b51584550ab9d6317101b29b63e5f02f35e6536 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/content.js @@ -0,0 +1,79 @@ +/** + * @import { + * InitialConstruct, + * Initializer, + * State, + * TokenizeContext, + * Token + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding } from 'micromark-util-character'; +/** @type {InitialConstruct} */ +export const content = { + tokenize: initializeContent +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Initializer} + * Content. + */ +function initializeContent(effects) { + const contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial); + /** @type {Token} */ + let previous; + return contentStart; + + /** @type {State} */ + function afterContentStartConstruct(code) { + if (code === null) { + effects.consume(code); + return; + } + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return factorySpace(effects, contentStart, "linePrefix"); + } + + /** @type {State} */ + function paragraphInitial(code) { + effects.enter("paragraph"); + return lineStart(code); + } + + /** @type {State} */ + function lineStart(code) { + const token = effects.enter("chunkText", { + contentType: "text", + previous + }); + if (previous) { + previous.next = token; + } + previous = token; + return data(code); + } + + /** @type {State} */ + function data(code) { + if (code === null) { + effects.exit("chunkText"); + effects.exit("paragraph"); + effects.consume(code); + return; + } + if (markdownLineEnding(code)) { + effects.consume(code); + effects.exit("chunkText"); + return lineStart; + } + + // Data. + effects.consume(code); + return data; + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/document.d.ts b/tools/ui/node_modules/micromark/lib/initialize/document.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c35a3f76cf96adf527d76b915c7b7373edd3b557 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/document.d.ts @@ -0,0 +1,10 @@ +/** @type {InitialConstruct} */ +export const document: InitialConstruct; +/** + * Construct and its state. + */ +export type StackItem = [Construct, ContainerState]; +import type { InitialConstruct } from 'micromark-util-types'; +import type { Construct } from 'micromark-util-types'; +import type { ContainerState } from 'micromark-util-types'; +//# sourceMappingURL=document.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/document.d.ts.map b/tools/ui/node_modules/micromark/lib/initialize/document.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..af4d9e823b708790e5bc3456fb18b74587910c5e --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/document.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.js"],"names":[],"mappings":"AAyBA,+BAA+B;AAC/B,uBADW,gBAAgB,CAC2B;;;;wBAXzC,CAAC,SAAS,EAAE,cAAc,CAAC;sCAJ9B,sBAAsB;+BAAtB,sBAAsB;oCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/document.js b/tools/ui/node_modules/micromark/lib/initialize/document.js new file mode 100644 index 0000000000000000000000000000000000000000..75e47495681f63306f98a1146f15b9ff4682a063 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/document.js @@ -0,0 +1,362 @@ +/** + * @import { + * Construct, + * ContainerState, + * InitialConstruct, + * Initializer, + * Point, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +/** + * @typedef {[Construct, ContainerState]} StackItem + * Construct and its state. + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding } from 'micromark-util-character'; +import { splice } from 'micromark-util-chunked'; +/** @type {InitialConstruct} */ +export const document = { + tokenize: initializeDocument +}; + +/** @type {Construct} */ +const containerConstruct = { + tokenize: tokenizeContainer +}; + +/** + * @this {TokenizeContext} + * Self. + * @type {Initializer} + * Initializer. + */ +function initializeDocument(effects) { + const self = this; + /** @type {Array<StackItem>} */ + const stack = []; + let continued = 0; + /** @type {TokenizeContext | undefined} */ + let childFlow; + /** @type {Token | undefined} */ + let childToken; + /** @type {number} */ + let lineStartOffset; + return start; + + /** @type {State} */ + function start(code) { + // First we iterate through the open blocks, starting with the root + // document, and descending through last children down to the last open + // block. + // Each block imposes a condition that the line must satisfy if the block is + // to remain open. + // For example, a block quote requires a `>` character. + // A paragraph requires a non-blank line. + // In this phase we may match all or just some of the open blocks. + // But we cannot close unmatched blocks yet, because we may have a lazy + // continuation line. + if (continued < stack.length) { + const item = stack[continued]; + self.containerState = item[1]; + return effects.attempt(item[0].continuation, documentContinue, checkNewContainers)(code); + } + + // Done. + return checkNewContainers(code); + } + + /** @type {State} */ + function documentContinue(code) { + continued++; + + // Note: this field is called `_closeFlow` but it also closes containers. + // Perhaps a good idea to rename it but it’s already used in the wild by + // extensions. + if (self.containerState._closeFlow) { + self.containerState._closeFlow = undefined; + if (childFlow) { + closeFlow(); + } + + // Note: this algorithm for moving events around is similar to the + // algorithm when dealing with lazy lines in `writeToChild`. + const indexBeforeExits = self.events.length; + let indexBeforeFlow = indexBeforeExits; + /** @type {Point | undefined} */ + let point; + + // Find the flow chunk. + while (indexBeforeFlow--) { + if (self.events[indexBeforeFlow][0] === 'exit' && self.events[indexBeforeFlow][1].type === "chunkFlow") { + point = self.events[indexBeforeFlow][1].end; + break; + } + } + exitContainers(continued); + + // Fix positions. + let index = indexBeforeExits; + while (index < self.events.length) { + self.events[index][1].end = { + ...point + }; + index++; + } + + // Inject the exits earlier (they’re still also at the end). + splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits)); + + // Discard the duplicate exits. + self.events.length = index; + return checkNewContainers(code); + } + return start(code); + } + + /** @type {State} */ + function checkNewContainers(code) { + // Next, after consuming the continuation markers for existing blocks, we + // look for new block starts (e.g. `>` for a block quote). + // If we encounter a new block start, we close any blocks unmatched in + // step 1 before creating the new block as a child of the last matched + // block. + if (continued === stack.length) { + // No need to `check` whether there’s a container, of `exitContainers` + // would be moot. + // We can instead immediately `attempt` to parse one. + if (!childFlow) { + return documentContinued(code); + } + + // If we have concrete content, such as block HTML or fenced code, + // we can’t have containers “pierce” into them, so we can immediately + // start. + if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { + return flowStart(code); + } + + // If we do have flow, it could still be a blank line, + // but we’d be interrupting it w/ a new container if there’s a current + // construct. + // To do: next major: remove `_gfmTableDynamicInterruptHack` (no longer + // needed in micromark-extension-gfm-table@1.0.6). + self.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack); + } + + // Check if there is a new container. + self.containerState = {}; + return effects.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code); + } + + /** @type {State} */ + function thereIsANewContainer(code) { + if (childFlow) closeFlow(); + exitContainers(continued); + return documentContinued(code); + } + + /** @type {State} */ + function thereIsNoNewContainer(code) { + self.parser.lazy[self.now().line] = continued !== stack.length; + lineStartOffset = self.now().offset; + return flowStart(code); + } + + /** @type {State} */ + function documentContinued(code) { + // Try new containers. + self.containerState = {}; + return effects.attempt(containerConstruct, containerContinue, flowStart)(code); + } + + /** @type {State} */ + function containerContinue(code) { + continued++; + stack.push([self.currentConstruct, self.containerState]); + // Try another. + return documentContinued(code); + } + + /** @type {State} */ + function flowStart(code) { + if (code === null) { + if (childFlow) closeFlow(); + exitContainers(0); + effects.consume(code); + return; + } + childFlow = childFlow || self.parser.flow(self.now()); + effects.enter("chunkFlow", { + _tokenizer: childFlow, + contentType: "flow", + previous: childToken + }); + return flowContinue(code); + } + + /** @type {State} */ + function flowContinue(code) { + if (code === null) { + writeToChild(effects.exit("chunkFlow"), true); + exitContainers(0); + effects.consume(code); + return; + } + if (markdownLineEnding(code)) { + effects.consume(code); + writeToChild(effects.exit("chunkFlow")); + // Get ready for the next line. + continued = 0; + self.interrupt = undefined; + return start; + } + effects.consume(code); + return flowContinue; + } + + /** + * @param {Token} token + * Token. + * @param {boolean | undefined} [endOfFile] + * Whether the token is at the end of the file (default: `false`). + * @returns {undefined} + * Nothing. + */ + function writeToChild(token, endOfFile) { + const stream = self.sliceStream(token); + if (endOfFile) stream.push(null); + token.previous = childToken; + if (childToken) childToken.next = token; + childToken = token; + childFlow.defineSkip(token.start); + childFlow.write(stream); + + // Alright, so we just added a lazy line: + // + // ```markdown + // > a + // b. + // + // Or: + // + // > ~~~c + // d + // + // Or: + // + // > | e | + // f + // ``` + // + // The construct in the second example (fenced code) does not accept lazy + // lines, so it marked itself as done at the end of its first line, and + // then the content construct parses `d`. + // Most constructs in markdown match on the first line: if the first line + // forms a construct, a non-lazy line can’t “unmake” it. + // + // The construct in the third example is potentially a GFM table, and + // those are *weird*. + // It *could* be a table, from the first line, if the following line + // matches a condition. + // In this case, that second line is lazy, which “unmakes” the first line + // and turns the whole into one content block. + // + // We’ve now parsed the non-lazy and the lazy line, and can figure out + // whether the lazy line started a new flow block. + // If it did, we exit the current containers between the two flow blocks. + if (self.parser.lazy[token.start.line]) { + let index = childFlow.events.length; + while (index--) { + if ( + // The token starts before the line ending… + childFlow.events[index][1].start.offset < lineStartOffset && ( + // …and either is not ended yet… + !childFlow.events[index][1].end || + // …or ends after it. + childFlow.events[index][1].end.offset > lineStartOffset)) { + // Exit: there’s still something open, which means it’s a lazy line + // part of something. + return; + } + } + + // Note: this algorithm for moving events around is similar to the + // algorithm when closing flow in `documentContinue`. + const indexBeforeExits = self.events.length; + let indexBeforeFlow = indexBeforeExits; + /** @type {boolean | undefined} */ + let seen; + /** @type {Point | undefined} */ + let point; + + // Find the previous chunk (the one before the lazy line). + while (indexBeforeFlow--) { + if (self.events[indexBeforeFlow][0] === 'exit' && self.events[indexBeforeFlow][1].type === "chunkFlow") { + if (seen) { + point = self.events[indexBeforeFlow][1].end; + break; + } + seen = true; + } + } + exitContainers(continued); + + // Fix positions. + index = indexBeforeExits; + while (index < self.events.length) { + self.events[index][1].end = { + ...point + }; + index++; + } + + // Inject the exits earlier (they’re still also at the end). + splice(self.events, indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits)); + + // Discard the duplicate exits. + self.events.length = index; + } + } + + /** + * @param {number} size + * Size. + * @returns {undefined} + * Nothing. + */ + function exitContainers(size) { + let index = stack.length; + + // Exit open containers. + while (index-- > size) { + const entry = stack[index]; + self.containerState = entry[1]; + entry[0].exit.call(self, effects); + } + stack.length = size; + } + function closeFlow() { + childFlow.write([null]); + childToken = undefined; + childFlow = undefined; + self.containerState._closeFlow = undefined; + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + * Tokenizer. + */ +function tokenizeContainer(effects, ok, nok) { + // Always populated by defaults. + + return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok, nok), "linePrefix", this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4); +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/flow.d.ts b/tools/ui/node_modules/micromark/lib/initialize/flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..55097f4622af6c92e393cc006fbe3dbda82be59c --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/flow.d.ts @@ -0,0 +1,4 @@ +/** @type {InitialConstruct} */ +export const flow: InitialConstruct; +import type { InitialConstruct } from 'micromark-util-types'; +//# sourceMappingURL=flow.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/flow.d.ts.map b/tools/ui/node_modules/micromark/lib/initialize/flow.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5cc25eb14fc177e1389996cb0cccb5057b2c2acd --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/flow.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["flow.js"],"names":[],"mappings":"AAeA,+BAA+B;AAC/B,mBADW,gBAAgB,CACmB;sCAVpC,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/flow.js b/tools/ui/node_modules/micromark/lib/initialize/flow.js new file mode 100644 index 0000000000000000000000000000000000000000..1e2c47ddb65f84ecd402bf091bf7033613d19ab0 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/flow.js @@ -0,0 +1,58 @@ +/** + * @import { + * InitialConstruct, + * Initializer, + * State, + * TokenizeContext + * } from 'micromark-util-types' + */ + +import { blankLine, content } from 'micromark-core-commonmark'; +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding } from 'micromark-util-character'; +/** @type {InitialConstruct} */ +export const flow = { + tokenize: initializeFlow +}; + +/** + * @this {TokenizeContext} + * Self. + * @type {Initializer} + * Initializer. + */ +function initializeFlow(effects) { + const self = this; + const initial = effects.attempt( + // Try to parse a blank line. + blankLine, atBlankEnding, + // Try to parse initial flow (essentially, only code). + effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), "linePrefix"))); + return initial; + + /** @type {State} */ + function atBlankEnding(code) { + if (code === null) { + effects.consume(code); + return; + } + effects.enter("lineEndingBlank"); + effects.consume(code); + effects.exit("lineEndingBlank"); + self.currentConstruct = undefined; + return initial; + } + + /** @type {State} */ + function afterConstruct(code) { + if (code === null) { + effects.consume(code); + return; + } + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + self.currentConstruct = undefined; + return initial; + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/text.d.ts b/tools/ui/node_modules/micromark/lib/initialize/text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5f26fc982b334c1137095ac3859a0e7fb96b896f --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/text.d.ts @@ -0,0 +1,8 @@ +export namespace resolver { + let resolveAll: Resolver; +} +export const string: InitialConstruct; +export const text: InitialConstruct; +import type { Resolver } from 'micromark-util-types'; +import type { InitialConstruct } from 'micromark-util-types'; +//# sourceMappingURL=text.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/text.d.ts.map b/tools/ui/node_modules/micromark/lib/initialize/text.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7f359336a64627f914b0a895ea8f4663cf29d76b --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/text.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":";;;AAeA,sCAAiD;AACjD,oCAA6C;8BARnC,sBAAsB;sCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/initialize/text.js b/tools/ui/node_modules/micromark/lib/initialize/text.js new file mode 100644 index 0000000000000000000000000000000000000000..b9383cb721b95c68bd0e684da6cbf441ed82b8eb --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/initialize/text.js @@ -0,0 +1,212 @@ +/** + * @import { + * Code, + * InitialConstruct, + * Initializer, + * Resolver, + * State, + * TokenizeContext + * } from 'micromark-util-types' + */ + +export const resolver = { + resolveAll: createResolver() +}; +export const string = initializeFactory('string'); +export const text = initializeFactory('text'); + +/** + * @param {'string' | 'text'} field + * Field. + * @returns {InitialConstruct} + * Construct. + */ +function initializeFactory(field) { + return { + resolveAll: createResolver(field === 'text' ? resolveAllLineSuffixes : undefined), + tokenize: initializeText + }; + + /** + * @this {TokenizeContext} + * Context. + * @type {Initializer} + */ + function initializeText(effects) { + const self = this; + const constructs = this.parser.constructs[field]; + const text = effects.attempt(constructs, start, notText); + return start; + + /** @type {State} */ + function start(code) { + return atBreak(code) ? text(code) : notText(code); + } + + /** @type {State} */ + function notText(code) { + if (code === null) { + effects.consume(code); + return; + } + effects.enter("data"); + effects.consume(code); + return data; + } + + /** @type {State} */ + function data(code) { + if (atBreak(code)) { + effects.exit("data"); + return text(code); + } + + // Data. + effects.consume(code); + return data; + } + + /** + * @param {Code} code + * Code. + * @returns {boolean} + * Whether the code is a break. + */ + function atBreak(code) { + if (code === null) { + return true; + } + const list = constructs[code]; + let index = -1; + if (list) { + // Always populated by defaults. + + while (++index < list.length) { + const item = list[index]; + if (!item.previous || item.previous.call(self, self.previous)) { + return true; + } + } + } + return false; + } + } +} + +/** + * @param {Resolver | undefined} [extraResolver] + * Resolver. + * @returns {Resolver} + * Resolver. + */ +function createResolver(extraResolver) { + return resolveAllText; + + /** @type {Resolver} */ + function resolveAllText(events, context) { + let index = -1; + /** @type {number | undefined} */ + let enter; + + // A rather boring computation (to merge adjacent `data` events) which + // improves mm performance by 29%. + while (++index <= events.length) { + if (enter === undefined) { + if (events[index] && events[index][1].type === "data") { + enter = index; + index++; + } + } else if (!events[index] || events[index][1].type !== "data") { + // Don’t do anything if there is one data token. + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end; + events.splice(enter + 2, index - enter - 2); + index = enter + 2; + } + enter = undefined; + } + } + return extraResolver ? extraResolver(events, context) : events; + } +} + +/** + * A rather ugly set of instructions which again looks at chunks in the input + * stream. + * The reason to do this here is that it is *much* faster to parse in reverse. + * And that we can’t hook into `null` to split the line suffix before an EOF. + * To do: figure out if we can make this into a clean utility, or even in core. + * As it will be useful for GFMs literal autolink extension (and maybe even + * tables?) + * + * @type {Resolver} + */ +function resolveAllLineSuffixes(events, context) { + let eventIndex = 0; // Skip first. + + while (++eventIndex <= events.length) { + if ((eventIndex === events.length || events[eventIndex][1].type === "lineEnding") && events[eventIndex - 1][1].type === "data") { + const data = events[eventIndex - 1][1]; + const chunks = context.sliceStream(data); + let index = chunks.length; + let bufferIndex = -1; + let size = 0; + /** @type {boolean | undefined} */ + let tabs; + while (index--) { + const chunk = chunks[index]; + if (typeof chunk === 'string') { + bufferIndex = chunk.length; + while (chunk.charCodeAt(bufferIndex - 1) === 32) { + size++; + bufferIndex--; + } + if (bufferIndex) break; + bufferIndex = -1; + } + // Number + else if (chunk === -2) { + tabs = true; + size++; + } else if (chunk === -1) { + // Empty + } else { + // Replacement character, exit. + index++; + break; + } + } + + // Allow final trailing whitespace. + if (context._contentTypeTextTrailing && eventIndex === events.length) { + size = 0; + } + if (size) { + const token = { + type: eventIndex === events.length || tabs || size < 2 ? "lineSuffix" : "hardBreakTrailing", + start: { + _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex, + _index: data.start._index + index, + line: data.end.line, + column: data.end.column - size, + offset: data.end.offset - size + }, + end: { + ...data.end + } + }; + data.end = { + ...token.start + }; + if (data.start.offset === data.end.offset) { + Object.assign(data, token); + } else { + events.splice(eventIndex, 0, ['enter', token, context], ['exit', token, context]); + eventIndex += 2; + } + } + eventIndex++; + } + } + return events; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/parse.d.ts b/tools/ui/node_modules/micromark/lib/parse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5fa972ec59d90764c9e4ddf08f8903f337936e63 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/parse.d.ts @@ -0,0 +1,10 @@ +/** + * @param {ParseOptions | null | undefined} [options] + * Configuration (optional). + * @returns {ParseContext} + * Parser. + */ +export function parse(options?: ParseOptions | null | undefined): ParseContext; +import type { ParseOptions } from 'micromark-util-types'; +import type { ParseContext } from 'micromark-util-types'; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/parse.d.ts.map b/tools/ui/node_modules/micromark/lib/parse.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..6930aeaf3ee65473bfd20731146ac7101fa4b89f --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["parse.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,gCALW,YAAY,GAAG,IAAI,GAAG,SAAS,GAE7B,YAAY,CAoCxB;kCAlDS,sBAAsB;kCAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/parse.js b/tools/ui/node_modules/micromark/lib/parse.js new file mode 100644 index 0000000000000000000000000000000000000000..468231986a450bae77540807dba5b655ab3becfd --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/parse.js @@ -0,0 +1,56 @@ +/** + * @import { + * Create, + * FullNormalizedExtension, + * InitialConstruct, + * ParseContext, + * ParseOptions + * } from 'micromark-util-types' + */ + +import { combineExtensions } from 'micromark-util-combine-extensions'; +import { content } from './initialize/content.js'; +import { document } from './initialize/document.js'; +import { flow } from './initialize/flow.js'; +import { string, text } from './initialize/text.js'; +import * as defaultConstructs from './constructs.js'; +import { createTokenizer } from './create-tokenizer.js'; + +/** + * @param {ParseOptions | null | undefined} [options] + * Configuration (optional). + * @returns {ParseContext} + * Parser. + */ +export function parse(options) { + const settings = options || {}; + const constructs = /** @type {FullNormalizedExtension} */ + combineExtensions([defaultConstructs, ...(settings.extensions || [])]); + + /** @type {ParseContext} */ + const parser = { + constructs, + content: create(content), + defined: [], + document: create(document), + flow: create(flow), + lazy: {}, + string: create(string), + text: create(text) + }; + return parser; + + /** + * @param {InitialConstruct} initial + * Construct to start with. + * @returns {Create} + * Create a tokenizer. + */ + function create(initial) { + return creator; + /** @type {Create} */ + function creator(from) { + return createTokenizer(parser, initial, from); + } + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/postprocess.d.ts b/tools/ui/node_modules/micromark/lib/postprocess.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7d60ce81ba7be9bac8b79244e8cb7c4f146387ce --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/postprocess.d.ts @@ -0,0 +1,9 @@ +/** + * @param {Array<Event>} events + * Events. + * @returns {Array<Event>} + * Events. + */ +export function postprocess(events: Array<Event>): Array<Event>; +import type { Event } from 'micromark-util-types'; +//# sourceMappingURL=postprocess.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/postprocess.d.ts.map b/tools/ui/node_modules/micromark/lib/postprocess.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..298eafee145c0f57d5d1c97be2b4057365b698f7 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/postprocess.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"postprocess.d.ts","sourceRoot":"","sources":["postprocess.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,oCALW,KAAK,CAAC,KAAK,CAAC,GAEV,KAAK,CAAC,KAAK,CAAC,CASxB;2BAjBuB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/postprocess.js b/tools/ui/node_modules/micromark/lib/postprocess.js new file mode 100644 index 0000000000000000000000000000000000000000..a5cdb31e2b5e4d2a045cf733baef659873db7e40 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/postprocess.js @@ -0,0 +1,18 @@ +/** + * @import {Event} from 'micromark-util-types' + */ + +import { subtokenize } from 'micromark-util-subtokenize'; + +/** + * @param {Array<Event>} events + * Events. + * @returns {Array<Event>} + * Events. + */ +export function postprocess(events) { + while (!subtokenize(events)) { + // Empty + } + return events; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/preprocess.d.ts b/tools/ui/node_modules/micromark/lib/preprocess.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..30b7dba7cdbcd6f12b3fa8b108e11dd563295c6a --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/preprocess.d.ts @@ -0,0 +1,13 @@ +/** + * @returns {Preprocessor} + * Preprocess a value. + */ +export function preprocess(): Preprocessor; +/** + * Preprocess a value. + */ +export type Preprocessor = (value: Value, encoding?: Encoding | null | undefined, end?: boolean | null | undefined) => Array<Chunk>; +import type { Value } from 'micromark-util-types'; +import type { Encoding } from 'micromark-util-types'; +import type { Chunk } from 'micromark-util-types'; +//# sourceMappingURL=preprocess.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/preprocess.d.ts.map b/tools/ui/node_modules/micromark/lib/preprocess.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..a916e156f1b758f81de4570424117b7f70218886 --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/preprocess.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"preprocess.d.ts","sourceRoot":"","sources":["preprocess.js"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,8BAHa,YAAY,CAsHxB;;;;mCArIU,KAAK,aAEL,QAAQ,GAAG,IAAI,GAAG,SAAS,QAE3B,OAAO,GAAG,IAAI,GAAG,SAAS,KAExB,KAAK,CAAC,KAAK,CAAC;2BAZsB,sBAAsB;8BAAtB,sBAAsB;2BAAtB,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/lib/preprocess.js b/tools/ui/node_modules/micromark/lib/preprocess.js new file mode 100644 index 0000000000000000000000000000000000000000..2cd2d442ca72df285276bc19d9f8ec7cf915fe4f --- /dev/null +++ b/tools/ui/node_modules/micromark/lib/preprocess.js @@ -0,0 +1,115 @@ +/** + * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types' + */ + +/** + * @callback Preprocessor + * Preprocess a value. + * @param {Value} value + * Value. + * @param {Encoding | null | undefined} [encoding] + * Encoding when `value` is a typed array (optional). + * @param {boolean | null | undefined} [end=false] + * Whether this is the last chunk (default: `false`). + * @returns {Array<Chunk>} + * Chunks. + */ + +const search = /[\0\t\n\r]/g; + +/** + * @returns {Preprocessor} + * Preprocess a value. + */ +export function preprocess() { + let column = 1; + let buffer = ''; + /** @type {boolean | undefined} */ + let start = true; + /** @type {boolean | undefined} */ + let atCarriageReturn; + return preprocessor; + + /** @type {Preprocessor} */ + // eslint-disable-next-line complexity + function preprocessor(value, encoding, end) { + /** @type {Array<Chunk>} */ + const chunks = []; + /** @type {RegExpMatchArray | null} */ + let match; + /** @type {number} */ + let next; + /** @type {number} */ + let startPosition; + /** @type {number} */ + let endPosition; + /** @type {Code} */ + let code; + value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value)); + startPosition = 0; + buffer = ''; + if (start) { + // To do: `markdown-rs` actually parses BOMs (byte order mark). + if (value.charCodeAt(0) === 65279) { + startPosition++; + } + start = undefined; + } + while (startPosition < value.length) { + search.lastIndex = startPosition; + match = search.exec(value); + endPosition = match && match.index !== undefined ? match.index : value.length; + code = value.charCodeAt(endPosition); + if (!match) { + buffer = value.slice(startPosition); + break; + } + if (code === 10 && startPosition === endPosition && atCarriageReturn) { + chunks.push(-3); + atCarriageReturn = undefined; + } else { + if (atCarriageReturn) { + chunks.push(-5); + atCarriageReturn = undefined; + } + if (startPosition < endPosition) { + chunks.push(value.slice(startPosition, endPosition)); + column += endPosition - startPosition; + } + switch (code) { + case 0: + { + chunks.push(65533); + column++; + break; + } + case 9: + { + next = Math.ceil(column / 4) * 4; + chunks.push(-2); + while (column++ < next) chunks.push(-1); + break; + } + case 10: + { + chunks.push(-4); + column = 1; + break; + } + default: + { + atCarriageReturn = true; + column = 1; + } + } + } + startPosition = endPosition + 1; + } + if (end) { + if (atCarriageReturn) chunks.push(-5); + if (buffer) chunks.push(buffer); + chunks.push(null); + } + return chunks; + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/license b/tools/ui/node_modules/micromark/license new file mode 100644 index 0000000000000000000000000000000000000000..bc8f165a62768a19de38901d81ac662c51ff29db --- /dev/null +++ b/tools/ui/node_modules/micromark/license @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) Titus Wormer <tituswormer@gmail.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/micromark/package.json b/tools/ui/node_modules/micromark/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c1c00e880137758d0ba9c2d000182354272366af --- /dev/null +++ b/tools/ui/node_modules/micromark/package.json @@ -0,0 +1,100 @@ +{ + "name": "micromark", + "version": "4.0.2", + "description": "small commonmark compliant markdown parser with positional info and concrete tokens", + "license": "MIT", + "keywords": [ + "commonmark", + "compiler", + "gfm", + "html", + "lexer", + "markdown", + "markup", + "md", + "unified", + "parse", + "parser", + "plugin", + "process", + "remark", + "render", + "renderer", + "token", + "tokenizer" + ], + "repository": "https://github.com/micromark/micromark/tree/main/packages/micromark", + "bugs": "https://github.com/micromark/micromark/issues", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", + "contributors": [ + "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)" + ], + "sideEffects": false, + "type": "module", + "files": [ + "dev/", + "lib/", + "index.d.ts.map", + "index.d.ts", + "index.js", + "stream.d.ts.map", + "stream.d.ts", + "stream.js" + ], + "exports": { + ".": { + "development": "./dev/index.js", + "default": "./index.js" + }, + "./stream": { + "development": "./dev/stream.js", + "default": "./stream.js" + } + }, + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "scripts": { + "build": "micromark-build" + }, + "xo": { + "envs": [ + "shared-node-browser" + ], + "prettier": true, + "rules": { + "logical-assignment-operators": "off", + "max-depth": "off", + "unicorn/no-this-assignment": "off", + "unicorn/prefer-at": "off", + "unicorn/prefer-code-point": "off", + "unicorn/prefer-event-target": "off" + } + } +} diff --git a/tools/ui/node_modules/micromark/readme.md b/tools/ui/node_modules/micromark/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..43ee49383006e71eccf4c482aa1bb31dcd85df8e --- /dev/null +++ b/tools/ui/node_modules/micromark/readme.md @@ -0,0 +1,488 @@ +# micromark + +[![Build][build-badge]][build] +[![Coverage][coverage-badge]][coverage] +[![Downloads][downloads-badge]][downloads] +[![Size][bundle-size-badge]][bundle-size] +[![Sponsors][sponsors-badge]][opencollective] +[![Backers][backers-badge]][opencollective] +[![Chat][chat-badge]][chat] + +Markdown parser. + +> **Note**: this is the `micromark` package from the micromark monorepo. +> See the [monorepo readme][micromark] for more on the project. +> See this readme for how to use it. + +## Feature highlights + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +* [x] **[compliant][commonmark]** (100% to CommonMark) +* [x] **[extensions][]** (100% [GFM][], 100% [MDX.js][mdxjs], [directives][], + [frontmatter][], [math][]) +* [x] **[safe][security]** (by default) +* [x] **[robust][test]** (±2k tests, 100% coverage, fuzz testing) +* [x] **[small][size-debug]** (smallest CM parser at ±14kb) + +## Contents + +* [When should I use this?](#when-should-i-use-this) +* [What is this?](#what-is-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`micromark(value[, encoding][, options])`](#micromarkvalue-encoding-options) + * [`stream(options?)`](#streamoptions) + * [`Options`](#options) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [Sponsor](#sponsor) +* [License](#license) + +## When should I use this? + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +* If you *just* want to turn markdown into HTML (with maybe a few extensions) +* If you want to do *really complex things* with markdown + +See [§ Comparison][comparison] for more info + +## What is this? + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +`micromark` is an open source markdown parser written in JavaScript. +It’s implemented as a state machine that emits concrete tokens, so that every +byte is accounted for, with positional info. +It then compiles those tokens directly to HTML, but other tools can take the +data and for example build an AST which is easier to work with +([`mdast-util-to-markdown`][mdast-util-to-markdown]). + +While most markdown parsers work towards compliancy with CommonMark (or GFM), +this project goes further by following how the reference parsers (`cmark`, +`cmark-gfm`) work, which is confirmed with thousands of extra tests. + +Other than CommonMark and GFM, micromark also supports common extensions to +markdown such as MDX, math, and frontmatter. + +These npm packages have a sibling project in Rust: +[`markdown-rs`][markdown-rs]. + +* to learn markdown, see this [cheatsheet and tutorial][cheat] +* for more about us, see [`unifiedjs.com`][site] +* for questions, see [Discussions][chat] +* to help, see [contribute][] and [sponsor][] below + +## Install + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +This package is [ESM only][esm]. +In Node.js (version 16+), install with [npm][]: + +```sh +npm install micromark +``` + +In Deno with [`esm.sh`][esmsh]: + +```js +import {micromark} from 'https://esm.sh/micromark@3' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html +<script type="module"> + import {micromark} from 'https://esm.sh/micromark@3?bundle' +</script> +``` + +## Use + +<!-- Note: this section has to be in sync with the `micromark` readme. --> + +Typical use (buffering): + +```js +import {micromark} from 'micromark' + +console.log(micromark('## Hello, *world*!')) +``` + +Yields: + +```html +<h2>Hello, <em>world</em>!</h2> +``` + +You can pass extensions (in this case [`micromark-extension-gfm`][gfm]): + +```js +import {micromark} from 'micromark' +import {gfmHtml, gfm} from 'micromark-extension-gfm' + +const value = '* [x] contact@example.com ~~strikethrough~~' + +const result = micromark(value, { + extensions: [gfm()], + htmlExtensions: [gfmHtml()] +}) + +console.log(result) +``` + +Yields: + +```html +<ul> +<li><input checked="" disabled="" type="checkbox"> <a href="mailto:contact@example.com">contact@example.com</a> <del>strikethrough</del></li> +</ul> +``` + +Streaming interface: + +```js +import {createReadStream} from 'node:fs' +import {stream} from 'micromark/stream' + +createReadStream('example.md') + .on('error', handleError) + .pipe(stream()) + .pipe(process.stdout) + +function handleError(error) { + // Handle your error here! + throw error +} +``` + +## API + +`micromark` core has two entries in its export map: `micromark` and +`micromark/stream`. + +`micromark` exports the identifier [`micromark`][api-micromark]. +`micromark/stream` exports the identifier [`stream`][api-stream]. +There are no default exports. + +The export map supports the [`development` condition][development]. +Run `node --conditions development module.js` to get instrumented dev code. +Without this condition, production code is loaded. +See [§ Size & debug][size-debug] for more info. + +### `micromark(value[, encoding][, options])` + +Compile markdown to HTML. + +> Note: which encodings are supported depends on the engine. +> For info on Node.js, see *[WHATWG supported encodings][encoding]*. + +###### Parameters + +* `value` (`string` or [`Uint8Array`][uint8-array]) + — markdown to parse +* `encoding` (`string`, default: `'utf8'`) + — [character encoding][encoding] to understand `value` as when it’s a + [`Uint8Array`][uint8-array] +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Compiled HTML (`string`). + +### `stream(options?)` + +Create a duplex (readable and writable) stream. + +Some of the work to parse markdown can be done streaming, but in the +end buffering is required. + +micromark does not handle errors for you, so you must handle errors on whatever +streams you pipe into it. +As markdown does not know errors, `micromark` itself does not emit errors. + +###### Parameters + +* `options` ([`Options`][api-options], optional) + — configuration + +###### Returns + +Duplex stream. + +### `Options` + +Configuration (TypeScript type). + +##### Fields + +###### `allowDangerousHtml` + +Whether to allow (dangerous) HTML (`boolean`, default: `false`). + +The default is `false`, which still parses the HTML according to `CommonMark` +but shows the HTML as text instead of as elements. + +Pass `true` for trusted content to get actual HTML elements. +See [§ Security][security]. + +###### `allowDangerousProtocol` + +Whether to allow dangerous protocols in links and images (`boolean`, default: +`false`). + +The default is `false`, which drops URLs in links and images that use dangerous +protocols. + +Pass `true` for trusted content to support all protocols. + +URLs that have no protocol (which means it’s relative to the current page, such +as `./some/page.html`) and URLs that have a safe protocol (for images: `http`, +`https`; for links: `http`, `https`, `irc`, `ircs`, `mailto`, `xmpp`), are +safe. +All other URLs are dangerous and dropped. +See [§ Security][security]. + +###### `defaultLineEnding` + +Default line ending to use when compiling to HTML, for line endings not in +`value` (`'\r'`, `'\n'`, or `'\r\n'`; default: first line ending or `'\n'`). + +Generally, `micromark` copies line endings (`\r`, `\n`, `\r\n`) in the markdown +document over to the compiled HTML. +In some cases, such as `> a`, CommonMark requires that extra line endings are +added: `<blockquote>\n<p>a</p>\n</blockquote>`. + +To create that line ending, the document is checked for the first line ending +that is used. +If there is no line ending, `defaultLineEnding` is used. +If that isn’t configured, `\n` is used. + +###### `extensions` + +Array of syntax extensions (`Array<SyntaxExtension>`, default: `[]`). +See [§ Extensions][extensions]. + +###### `htmlExtensions` + +Array of syntax extensions (`Array<HtmlExtension>`, default: `[]`). +See [§ Extensions][extensions]. + +## Types + +This package is fully typed with [TypeScript][]. +It exports the additional type [`Options`][api-options]. + +## Compatibility + +Projects maintained by the unified collective are compatible with maintained +versions of Node.js. + +When we cut a new major release, we drop support for unmaintained versions of +Node. +This means we try to keep the current release line, `micromark@4`, compatible +with Node.js 16. + +## Security + +This package is safe. +See [`security.md`][securitymd] in [`micromark/.github`][health] for how to +submit a security report. + +## Contribute + +See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways +to get started. +See [`support.md`][support] for ways to get help. + +This project has a [code of conduct][coc]. +By interacting with this repository, organisation, or community you agree to +abide by its terms. + +## Sponsor + +<!-- Note: this section has to be in sync with the monorepo readme. --> + +Support this effort and give back by sponsoring on [OpenCollective][]! + +<table> +<tr valign="middle"> +<td width="100%" align="center" colspan="10"> + <br> + <a href="https://www.salesforce.com">Salesforce</a> 🏅<br><br> + <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo/512.png" width="256"></a> +</td> +</tr> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://vercel.com">Vercel</a><br><br> + <a href="https://vercel.com"><img src="https://avatars1.githubusercontent.com/u/14985020?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://motif.land">Motif</a><br><br> + <a href="https://motif.land"><img src="https://avatars1.githubusercontent.com/u/74457950?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.hashicorp.com">HashiCorp</a><br><br> + <a href="https://www.hashicorp.com"><img src="https://avatars1.githubusercontent.com/u/761456?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gitbook.com">GitBook</a><br><br> + <a href="https://www.gitbook.com"><img src="https://avatars1.githubusercontent.com/u/7111340?s=256&v=4" width="128"></a> +</td> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.gatsbyjs.org">Gatsby</a><br><br> + <a href="https://www.gatsbyjs.org"><img src="https://avatars1.githubusercontent.com/u/12551863?s=256&v=4" width="128"></a> +</td> +</tr> +<tr valign="middle"> +</tr> +<tr valign="middle"> +<td width="20%" align="center" rowspan="2" colspan="2"> + <a href="https://www.netlify.com">Netlify</a><br><br> + <!--OC has a sharper image--> + <a href="https://www.netlify.com"><img src="https://images.opencollective.com/netlify/4087de2/logo/256.png" width="128"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.coinbase.com">Coinbase</a><br><br> + <a href="https://www.coinbase.com"><img src="https://avatars1.githubusercontent.com/u/1885080?s=256&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://themeisle.com">ThemeIsle</a><br><br> + <a href="https://themeisle.com"><img src="https://avatars1.githubusercontent.com/u/58979018?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://expo.io">Expo</a><br><br> + <a href="https://expo.io"><img src="https://avatars1.githubusercontent.com/u/12504344?s=128&v=4" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://boostnote.io">Boost Note</a><br><br> + <a href="https://boostnote.io"><img src="https://images.opencollective.com/boosthub/6318083/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://markdown.space">Markdown Space</a><br><br> + <a href="https://markdown.space"><img src="https://images.opencollective.com/markdown-space/e1038ed/logo/128.png" width="64"></a> +</td> +<td width="10%" align="center"> + <a href="https://www.holloway.com">Holloway</a><br><br> + <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a> +</td> +<td width="10%"></td> +<td width="10%"></td> +</tr> +<tr valign="middle"> +<td width="100%" align="center" colspan="8"> + <br> + <a href="https://opencollective.com/unified"><strong>You?</strong></a> + <br><br> +</td> +</tr> +</table> + +## License + +[MIT][license] © [Titus Wormer][author] + +<!-- Definitions --> + +[api-micromark]: #micromarkvalue-encoding-options + +[api-options]: #options + +[api-stream]: #streamoptions + +[author]: https://wooorm.com + +[backers-badge]: https://opencollective.com/unified/backers/badge.svg + +[build]: https://github.com/micromark/micromark/actions + +[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg + +[bundle-size]: https://bundlejs.com/?q=micromark + +[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark + +[chat]: https://github.com/micromark/micromark/discussions + +[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg + +[cheat]: https://commonmark.org/help/ + +[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md + +[commonmark]: https://commonmark.org + +[comparison]: https://github.com/micromark/micromark#comparison + +[contribute]: #contribute + +[contributing]: https://github.com/micromark/.github/blob/main/contributing.md + +[coverage]: https://codecov.io/github/micromark/micromark + +[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg + +[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions + +[directives]: https://github.com/micromark/micromark-extension-directive + +[downloads]: https://www.npmjs.com/package/micromark + +[downloads-badge]: https://img.shields.io/npm/dm/micromark.svg + +[encoding]: https://nodejs.org/api/util.html#whatwg-supported-encodings + +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[esmsh]: https://esm.sh + +[extensions]: https://github.com/micromark/micromark#extensions + +[frontmatter]: https://github.com/micromark/micromark-extension-frontmatter + +[gfm]: https://github.com/micromark/micromark-extension-gfm + +[health]: https://github.com/micromark/.github + +[license]: https://github.com/micromark/micromark/blob/main/license + +[markdown-rs]: https://github.com/wooorm/markdown-rs + +[math]: https://github.com/micromark/micromark-extension-math + +[mdast-util-to-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown + +[mdxjs]: https://github.com/micromark/micromark-extension-mdxjs + +[micromark]: https://github.com/micromark/micromark + +[npm]: https://docs.npmjs.com/cli/install + +[opencollective]: https://opencollective.com/unified + +[security]: #security + +[securitymd]: https://github.com/micromark/.github/blob/main/security.md + +[site]: https://unifiedjs.com + +[size-debug]: https://github.com/micromark/micromark#size--debug + +[sponsor]: #sponsor + +[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg + +[support]: https://github.com/micromark/.github/blob/main/support.md + +[test]: https://github.com/micromark/micromark#test + +[typescript]: https://www.typescriptlang.org + +[uint8-array]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array diff --git a/tools/ui/node_modules/micromark/stream.d.ts b/tools/ui/node_modules/micromark/stream.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2b05447e816dab4efbeba084a9ad47c37f8d458a --- /dev/null +++ b/tools/ui/node_modules/micromark/stream.d.ts @@ -0,0 +1,35 @@ +/** + * Create a duplex (readable and writable) stream. + * + * Some of the work to parse markdown can be done streaming, but in the + * end buffering is required. + * + * micromark does not handle errors for you, so you must handle errors on whatever + * streams you pipe into it. + * As markdown does not know errors, `micromark` itself does not emit errors. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * @returns {MinimalDuplex} + * Duplex stream. + */ +export function stream(options?: Options | null | undefined): MinimalDuplex; +export type Options = import("micromark-util-types").Options; +/** + * Function called when write was successful. + */ +export type Callback = () => undefined; +/** + * Configuration for piping. + */ +export type PipeOptions = { + /** + * Whether to end the destination stream when the source stream ends. + */ + end?: boolean | null | undefined; +}; +/** + * Duplex stream. + */ +export type MinimalDuplex = Omit<NodeJS.ReadableStream & NodeJS.WritableStream, "isPaused" | "pause" | "read" | "resume" | "setEncoding" | "unpipe" | "unshift" | "wrap">; +//# sourceMappingURL=stream.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/stream.d.ts.map b/tools/ui/node_modules/micromark/stream.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f89c748fa5fb2ff13da0b371e82ea395938d7d71 --- /dev/null +++ b/tools/ui/node_modules/micromark/stream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["stream.js"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;GAcG;AACH,iCALW,OAAO,GAAG,IAAI,GAAG,SAAS,GAExB,aAAa,CAoOzB;sBAxQY,OAAO,sBAAsB,EAAE,OAAO;;;;6BAMtC,SAAS;;;;;;;;UAKR,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;4BAG3B,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark/stream.js b/tools/ui/node_modules/micromark/stream.js new file mode 100644 index 0000000000000000000000000000000000000000..7561620013d6f32ca11669362233565ce9dea469 --- /dev/null +++ b/tools/ui/node_modules/micromark/stream.js @@ -0,0 +1,256 @@ +/** + * @import {Encoding, Value} from 'micromark-util-types' + */ + +/** + * @typedef {import('micromark-util-types').Options} Options + */ + +/** + * @callback Callback + * Function called when write was successful. + * @returns {undefined} + * Nothing. + * + * @typedef PipeOptions + * Configuration for piping. + * @property {boolean | null | undefined} [end] + * Whether to end the destination stream when the source stream ends. + * + * @typedef {Omit<NodeJS.ReadableStream & NodeJS.WritableStream, 'isPaused' | 'pause' | 'read' | 'resume' | 'setEncoding' | 'unpipe' | 'unshift' | 'wrap'>} MinimalDuplex + * Duplex stream. + */ + +import { EventEmitter } from 'node:events'; +import { compile } from './lib/compile.js'; +import { parse } from './lib/parse.js'; +import { postprocess } from './lib/postprocess.js'; +import { preprocess } from './lib/preprocess.js'; + +/** + * Create a duplex (readable and writable) stream. + * + * Some of the work to parse markdown can be done streaming, but in the + * end buffering is required. + * + * micromark does not handle errors for you, so you must handle errors on whatever + * streams you pipe into it. + * As markdown does not know errors, `micromark` itself does not emit errors. + * + * @param {Options | null | undefined} [options] + * Configuration (optional). + * @returns {MinimalDuplex} + * Duplex stream. + */ +export function stream(options) { + const prep = preprocess(); + const tokenize = parse(options).document().write; + const comp = compile(options); + /** @type {boolean} */ + let ended; + const emitter = /** @type {MinimalDuplex} */new EventEmitter(); + // @ts-expect-error: fine. + emitter.end = end; + emitter.pipe = pipe; + emitter.readable = true; + emitter.writable = true; + // @ts-expect-error: fine. + emitter.write = write; + return emitter; + + /** + * Write a chunk into memory. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + */ + function write(chunk, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding; + encoding = undefined; + } + if (ended) { + throw new Error('Did not expect `write` after `end`'); + } + tokenize(prep(chunk || '', encoding)); + if (callback) { + callback(); + } + + // Signal successful write. + return true; + } + + /** + * End the writing. + * + * Passes all arguments as a final `write`. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @overload + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + * + * @param {Callback | Value | null | undefined} [chunk] + * Slice of markdown to parse (`string` or `Uint8Array`). + * @param {Callback | Encoding | null | undefined} [encoding] + * Character encoding to understand `chunk` as when it’s a `Uint8Array` + * (`string`, default: `'utf8'`). + * @param {Callback | null | undefined} [callback] + * Function called when write was successful. + * @returns {boolean} + * Whether write was successful. + */ + function end(chunk, encoding, callback) { + if (typeof chunk === 'function') { + encoding = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + callback = encoding; + encoding = undefined; + } + write(chunk, encoding, callback); + emitter.emit('data', comp(postprocess(tokenize(prep('', encoding, true))))); + emitter.emit('end'); + ended = true; + return true; + } + + /** + * Pipe the processor into a writable stream. + * + * Basically `Stream#pipe`, but inlined and simplified to keep the bundled + * size down. + * See: <https://github.com/nodejs/node/blob/43a5170/lib/internal/streams/legacy.js#L13>. + * + * @template {NodeJS.WritableStream} Stream + * Writable stream. + * @param {Stream} destination + * Stream to pipe into. + * @param {PipeOptions | null | undefined} [options] + * Configuration. + * @returns {Stream} + * Destination stream. + */ + function pipe(destination, options) { + emitter.on('data', ondata); + emitter.on('error', onerror); + emitter.on('end', cleanup); + emitter.on('close', cleanup); + + // If the `end` option is not supplied, `destination.end()` will be + // called when the `end` or `close` events are received. + // @ts-expect-error `_isStdio` is available on `std{err,out}` + if (!destination._isStdio && (!options || options.end !== false)) { + emitter.on('end', onend); + } + destination.on('error', onerror); + destination.on('close', cleanup); + destination.emit('pipe', emitter); + return destination; + + /** + * End destination stream. + * + * @returns {undefined} + * Nothing. + */ + function onend() { + if (destination.end) { + destination.end(); + } + } + + /** + * Handle data. + * + * @param {string} chunk + * Data. + * @returns {undefined} + * Nothing. + */ + function ondata(chunk) { + if (destination.writable) { + destination.write(chunk); + } + } + + /** + * Clean listeners. + * + * @returns {undefined} + * Nothing. + */ + function cleanup() { + emitter.removeListener('data', ondata); + emitter.removeListener('end', onend); + emitter.removeListener('error', onerror); + emitter.removeListener('end', cleanup); + emitter.removeListener('close', cleanup); + destination.removeListener('error', onerror); + destination.removeListener('close', cleanup); + } + + /** + * Close dangling pipes and handle unheard errors. + * + * @param {Error | null | undefined} [error] + * Error, if any. + * @returns {undefined} + * Nothing. + */ + function onerror(error) { + cleanup(); + if (!emitter.listenerCount('error')) { + throw error; // Unhandled stream error in pipe. + } + } + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/mime-db/HISTORY.md b/tools/ui/node_modules/mime-db/HISTORY.md new file mode 100644 index 0000000000000000000000000000000000000000..fb35beccad7e990844c8b39305e328db6b904f70 --- /dev/null +++ b/tools/ui/node_modules/mime-db/HISTORY.md @@ -0,0 +1,541 @@ +1.54.0 / 2025-03-17 +=================== + + * Update mime type for DCM format (#362) + * mark application/octet-stream as compressible (#163) + * Fix typo in application/x-zip-compressed mimetype (#359) + * Add mime-type for Jupyter notebooks (#282) + * Add Google Drive MIME types (#311) + * Add .blend file type (#338) + * Add support for the FBX file extension (#342) + * Add Adobe DNG file (#340) + * Add Procreate Brush and Brush Set file Types (#339) + * Add support for Procreate Dreams (#341) + * replace got with undici (#352) + * Added extensions list for model/step (#293) + * Add m4b as a type of audio/mp4 (#357) + * windows 11 application/x-zip-compressed (#346) + * add dotLottie mime type (#351) + * Add some MS-related extensions and types (#336) + +1.53.0 / 2024-07-12 +=================== + + * Add extension `.sql` to `application/sql` + * Add extensions `.aac` and `.adts` to `audio/aac` + * Add extensions `.js` and `.mjs` to `text/javascript` + * Add extensions for `application/mp4` from IANA + * Add extensions from IANA for more MIME types + * Add Microsoft app installer types and extensions + * Add new upstream MIME types + * Fix extensions for `text/markdown` to match IANA + * Remove extension `.mjs` from `application/javascript` + * Remove obsolete MIME types from IANA data + +1.52.0 / 2022-02-21 +=================== + + * Add extensions from IANA for more `image/*` types + * Add extension `.asc` to `application/pgp-keys` + * Add extensions to various XML types + * Add new upstream MIME types + +1.51.0 / 2021-11-08 +=================== + + * Add new upstream MIME types + * Mark `image/vnd.microsoft.icon` as compressible + * Mark `image/vnd.ms-dds` as compressible + +1.50.0 / 2021-09-15 +=================== + + * Add deprecated iWorks mime types and extensions + * Add new upstream MIME types + +1.49.0 / 2021-07-26 +=================== + + * Add extension `.trig` to `application/trig` + * Add new upstream MIME types + +1.48.0 / 2021-05-30 +=================== + + * Add extension `.mvt` to `application/vnd.mapbox-vector-tile` + * Add new upstream MIME types + * Mark `text/yaml` as compressible + +1.47.0 / 2021-04-01 +=================== + + * Add new upstream MIME types + * Remove ambiguous extensions from IANA for `application/*+xml` types + * Update primary extension to `.es` for `application/ecmascript` + +1.46.0 / 2021-02-13 +=================== + + * Add extension `.amr` to `audio/amr` + * Add extension `.m4s` to `video/iso.segment` + * Add extension `.opus` to `audio/ogg` + * Add new upstream MIME types + +1.45.0 / 2020-09-22 +=================== + + * Add `application/ubjson` with extension `.ubj` + * Add `image/avif` with extension `.avif` + * Add `image/ktx2` with extension `.ktx2` + * Add extension `.dbf` to `application/vnd.dbf` + * Add extension `.rar` to `application/vnd.rar` + * Add extension `.td` to `application/urc-targetdesc+xml` + * Add new upstream MIME types + * Fix extension of `application/vnd.apple.keynote` to be `.key` + +1.44.0 / 2020-04-22 +=================== + + * Add charsets from IANA + * Add extension `.cjs` to `application/node` + * Add new upstream MIME types + +1.43.0 / 2020-01-05 +=================== + + * Add `application/x-keepass2` with extension `.kdbx` + * Add extension `.mxmf` to `audio/mobile-xmf` + * Add extensions from IANA for `application/*+xml` types + * Add new upstream MIME types + +1.42.0 / 2019-09-25 +=================== + + * Add `image/vnd.ms-dds` with extension `.dds` + * Add new upstream MIME types + * Remove compressible from `multipart/mixed` + +1.41.0 / 2019-08-30 +=================== + + * Add new upstream MIME types + * Add `application/toml` with extension `.toml` + * Mark `font/ttf` as compressible + +1.40.0 / 2019-04-20 +=================== + + * Add extensions from IANA for `model/*` types + * Add `text/mdx` with extension `.mdx` + +1.39.0 / 2019-04-04 +=================== + + * Add extensions `.siv` and `.sieve` to `application/sieve` + * Add new upstream MIME types + +1.38.0 / 2019-02-04 +=================== + + * Add extension `.nq` to `application/n-quads` + * Add extension `.nt` to `application/n-triples` + * Add new upstream MIME types + * Mark `text/less` as compressible + +1.37.0 / 2018-10-19 +=================== + + * Add extensions to HEIC image types + * Add new upstream MIME types + +1.36.0 / 2018-08-20 +=================== + + * Add Apple file extensions from IANA + * Add extensions from IANA for `image/*` types + * Add new upstream MIME types + +1.35.0 / 2018-07-15 +=================== + + * Add extension `.owl` to `application/rdf+xml` + * Add new upstream MIME types + - Removes extension `.woff` from `application/font-woff` + +1.34.0 / 2018-06-03 +=================== + + * Add extension `.csl` to `application/vnd.citationstyles.style+xml` + * Add extension `.es` to `application/ecmascript` + * Add new upstream MIME types + * Add `UTF-8` as default charset for `text/turtle` + * Mark all XML-derived types as compressible + +1.33.0 / 2018-02-15 +=================== + + * Add extensions from IANA for `message/*` types + * Add new upstream MIME types + * Fix some incorrect OOXML types + * Remove `application/font-woff2` + +1.32.0 / 2017-11-29 +=================== + + * Add new upstream MIME types + * Update `text/hjson` to registered `application/hjson` + * Add `text/shex` with extension `.shex` + +1.31.0 / 2017-10-25 +=================== + + * Add `application/raml+yaml` with extension `.raml` + * Add `application/wasm` with extension `.wasm` + * Add new `font` type from IANA + * Add new upstream font extensions + * Add new upstream MIME types + * Add extensions for JPEG-2000 images + +1.30.0 / 2017-08-27 +=================== + + * Add `application/vnd.ms-outlook` + * Add `application/x-arj` + * Add extension `.mjs` to `application/javascript` + * Add glTF types and extensions + * Add new upstream MIME types + * Add `text/x-org` + * Add VirtualBox MIME types + * Fix `source` records for `video/*` types that are IANA + * Update `font/opentype` to registered `font/otf` + +1.29.0 / 2017-07-10 +=================== + + * Add `application/fido.trusted-apps+json` + * Add extension `.wadl` to `application/vnd.sun.wadl+xml` + * Add new upstream MIME types + * Add `UTF-8` as default charset for `text/css` + +1.28.0 / 2017-05-14 +=================== + + * Add new upstream MIME types + * Add extension `.gz` to `application/gzip` + * Update extensions `.md` and `.markdown` to be `text/markdown` + +1.27.0 / 2017-03-16 +=================== + + * Add new upstream MIME types + * Add `image/apng` with extension `.apng` + +1.26.0 / 2017-01-14 +=================== + + * Add new upstream MIME types + * Add extension `.geojson` to `application/geo+json` + +1.25.0 / 2016-11-11 +=================== + + * Add new upstream MIME types + +1.24.0 / 2016-09-18 +=================== + + * Add `audio/mp3` + * Add new upstream MIME types + +1.23.0 / 2016-05-01 +=================== + + * Add new upstream MIME types + * Add extension `.3gpp` to `audio/3gpp` + +1.22.0 / 2016-02-15 +=================== + + * Add `text/slim` + * Add extension `.rng` to `application/xml` + * Add new upstream MIME types + * Fix extension of `application/dash+xml` to be `.mpd` + * Update primary extension to `.m4a` for `audio/mp4` + +1.21.0 / 2016-01-06 +=================== + + * Add Google document types + * Add new upstream MIME types + +1.20.0 / 2015-11-10 +=================== + + * Add `text/x-suse-ymp` + * Add new upstream MIME types + +1.19.0 / 2015-09-17 +=================== + + * Add `application/vnd.apple.pkpass` + * Add new upstream MIME types + +1.18.0 / 2015-09-03 +=================== + + * Add new upstream MIME types + +1.17.0 / 2015-08-13 +=================== + + * Add `application/x-msdos-program` + * Add `audio/g711-0` + * Add `image/vnd.mozilla.apng` + * Add extension `.exe` to `application/x-msdos-program` + +1.16.0 / 2015-07-29 +=================== + + * Add `application/vnd.uri-map` + +1.15.0 / 2015-07-13 +=================== + + * Add `application/x-httpd-php` + +1.14.0 / 2015-06-25 +=================== + + * Add `application/scim+json` + * Add `application/vnd.3gpp.ussd+xml` + * Add `application/vnd.biopax.rdf+xml` + * Add `text/x-processing` + +1.13.0 / 2015-06-07 +=================== + + * Add nginx as a source + * Add `application/x-cocoa` + * Add `application/x-java-archive-diff` + * Add `application/x-makeself` + * Add `application/x-perl` + * Add `application/x-pilot` + * Add `application/x-redhat-package-manager` + * Add `application/x-sea` + * Add `audio/x-m4a` + * Add `audio/x-realaudio` + * Add `image/x-jng` + * Add `text/mathml` + +1.12.0 / 2015-06-05 +=================== + + * Add `application/bdoc` + * Add `application/vnd.hyperdrive+json` + * Add `application/x-bdoc` + * Add extension `.rtf` to `text/rtf` + +1.11.0 / 2015-05-31 +=================== + + * Add `audio/wav` + * Add `audio/wave` + * Add extension `.litcoffee` to `text/coffeescript` + * Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data` + * Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install` + +1.10.0 / 2015-05-19 +=================== + + * Add `application/vnd.balsamiq.bmpr` + * Add `application/vnd.microsoft.portable-executable` + * Add `application/x-ns-proxy-autoconfig` + +1.9.1 / 2015-04-19 +================== + + * Remove `.json` extension from `application/manifest+json` + - This is causing bugs downstream + +1.9.0 / 2015-04-19 +================== + + * Add `application/manifest+json` + * Add `application/vnd.micro+json` + * Add `image/vnd.zbrush.pcx` + * Add `image/x-ms-bmp` + +1.8.0 / 2015-03-13 +================== + + * Add `application/vnd.citationstyles.style+xml` + * Add `application/vnd.fastcopy-disk-image` + * Add `application/vnd.gov.sk.xmldatacontainer+xml` + * Add extension `.jsonld` to `application/ld+json` + +1.7.0 / 2015-02-08 +================== + + * Add `application/vnd.gerber` + * Add `application/vnd.msa-disk-image` + +1.6.1 / 2015-02-05 +================== + + * Community extensions ownership transferred from `node-mime` + +1.6.0 / 2015-01-29 +================== + + * Add `application/jose` + * Add `application/jose+json` + * Add `application/json-seq` + * Add `application/jwk+json` + * Add `application/jwk-set+json` + * Add `application/jwt` + * Add `application/rdap+json` + * Add `application/vnd.gov.sk.e-form+xml` + * Add `application/vnd.ims.imsccv1p3` + +1.5.0 / 2014-12-30 +================== + + * Add `application/vnd.oracle.resource+json` + * Fix various invalid MIME type entries + - `application/mbox+xml` + - `application/oscp-response` + - `application/vwg-multiplexed` + - `audio/g721` + +1.4.0 / 2014-12-21 +================== + + * Add `application/vnd.ims.imsccv1p2` + * Fix various invalid MIME type entries + - `application/vnd-acucobol` + - `application/vnd-curl` + - `application/vnd-dart` + - `application/vnd-dxr` + - `application/vnd-fdf` + - `application/vnd-mif` + - `application/vnd-sema` + - `application/vnd-wap-wmlc` + - `application/vnd.adobe.flash-movie` + - `application/vnd.dece-zip` + - `application/vnd.dvb_service` + - `application/vnd.micrografx-igx` + - `application/vnd.sealed-doc` + - `application/vnd.sealed-eml` + - `application/vnd.sealed-mht` + - `application/vnd.sealed-ppt` + - `application/vnd.sealed-tiff` + - `application/vnd.sealed-xls` + - `application/vnd.sealedmedia.softseal-html` + - `application/vnd.sealedmedia.softseal-pdf` + - `application/vnd.wap-slc` + - `application/vnd.wap-wbxml` + - `audio/vnd.sealedmedia.softseal-mpeg` + - `image/vnd-djvu` + - `image/vnd-svf` + - `image/vnd-wap-wbmp` + - `image/vnd.sealed-png` + - `image/vnd.sealedmedia.softseal-gif` + - `image/vnd.sealedmedia.softseal-jpg` + - `model/vnd-dwf` + - `model/vnd.parasolid.transmit-binary` + - `model/vnd.parasolid.transmit-text` + - `text/vnd-a` + - `text/vnd-curl` + - `text/vnd.wap-wml` + * Remove example template MIME types + - `application/example` + - `audio/example` + - `image/example` + - `message/example` + - `model/example` + - `multipart/example` + - `text/example` + - `video/example` + +1.3.1 / 2014-12-16 +================== + + * Fix missing extensions + - `application/json5` + - `text/hjson` + +1.3.0 / 2014-12-07 +================== + + * Add `application/a2l` + * Add `application/aml` + * Add `application/atfx` + * Add `application/atxml` + * Add `application/cdfx+xml` + * Add `application/dii` + * Add `application/json5` + * Add `application/lxf` + * Add `application/mf4` + * Add `application/vnd.apache.thrift.compact` + * Add `application/vnd.apache.thrift.json` + * Add `application/vnd.coffeescript` + * Add `application/vnd.enphase.envoy` + * Add `application/vnd.ims.imsccv1p1` + * Add `text/csv-schema` + * Add `text/hjson` + * Add `text/markdown` + * Add `text/yaml` + +1.2.0 / 2014-11-09 +================== + + * Add `application/cea` + * Add `application/dit` + * Add `application/vnd.gov.sk.e-form+zip` + * Add `application/vnd.tmd.mediaflex.api+xml` + * Type `application/epub+zip` is now IANA-registered + +1.1.2 / 2014-10-23 +================== + + * Rebuild database for `application/x-www-form-urlencoded` change + +1.1.1 / 2014-10-20 +================== + + * Mark `application/x-www-form-urlencoded` as compressible. + +1.1.0 / 2014-09-28 +================== + + * Add `application/font-woff2` + +1.0.3 / 2014-09-25 +================== + + * Fix engine requirement in package + +1.0.2 / 2014-09-25 +================== + + * Add `application/coap-group+json` + * Add `application/dcd` + * Add `application/vnd.apache.thrift.binary` + * Add `image/vnd.tencent.tap` + * Mark all JSON-derived types as compressible + * Update `text/vtt` data + +1.0.1 / 2014-08-30 +================== + + * Fix extension ordering + +1.0.0 / 2014-08-30 +================== + + * Add `application/atf` + * Add `application/merge-patch+json` + * Add `multipart/x-mixed-replace` + * Add `source: 'apache'` metadata + * Add `source: 'iana'` metadata + * Remove badly-assumed charset data diff --git a/tools/ui/node_modules/mime-db/LICENSE b/tools/ui/node_modules/mime-db/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..0751cb10e94972be9a07b44cc261447bac726a7f --- /dev/null +++ b/tools/ui/node_modules/mime-db/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com> +Copyright (c) 2015-2022 Douglas Christopher Wilson <doug@somethingdoug.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/mime-db/README.md b/tools/ui/node_modules/mime-db/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ee93fa00ab2fbe05ba2ee0fcdc606d9aad12bd52 --- /dev/null +++ b/tools/ui/node_modules/mime-db/README.md @@ -0,0 +1,109 @@ +# mime-db + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] + +This is a large database of mime types and information about them. +It consists of a single, public JSON file and does not include any logic, +allowing it to remain as un-opinionated as possible with an API. +It aggregates data from the following sources: + +- https://www.iana.org/assignments/media-types/media-types.xhtml +- https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types +- https://hg.nginx.org/nginx/raw-file/default/conf/mime.types + +## Installation + +```bash +npm install mime-db +``` + +### Database Download + +If you intend to use this in a web browser, you can conveniently access the JSON file via [jsDelivr](https://www.jsdelivr.com/), a popular CDN (Content Delivery Network). To ensure stability and compatibility, it is advisable to specify [a release tag](https://github.com/jshttp/mime-db/tags) instead of using the 'master' branch. This is because the JSON file's format might change in future updates, and relying on a specific release tag will prevent potential issues arising from these changes. + +``` +https://cdn.jsdelivr.net/gh/jshttp/mime-db@master/db.json +``` + +## Usage + +```js +var db = require('mime-db') + +// grab data on .js files +var data = db['application/javascript'] +``` + +## Data Structure + +The JSON file is a map lookup for lowercased mime types. +Each mime type has the following properties: + +- `.source` - where the mime type is defined. + If not set, it's probably a custom media type. + - `apache` - [Apache common media types](https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) + - `iana` - [IANA-defined media types](https://www.iana.org/assignments/media-types/media-types.xhtml) + - `nginx` - [nginx media types](https://hg.nginx.org/nginx/raw-file/default/conf/mime.types) +- `.extensions[]` - known extensions associated with this mime type. +- `.compressible` - whether a file of this type can be gzipped. +- `.charset` - the default charset associated with this type, if any. + +If unknown, every property could be `undefined`. + +## Note on MIME Type Data and Semver + +This package considers the programmatic api as the semver compatibility. This means the MIME type resolution is *not* considered +in the semver bumps. This means that if you want to pin your `mime-db` data you will need to do it in your application. While +this expectation was not set in docs until now, it is how the pacakge operated, so we do not feel this is a breaking change. + +## Contributing + +The primary way to contribute to this database is by updating the data in +one of the upstream sources. The database is updated from the upstreams +periodically and will pull in any changes. + +### Registering Media Types + +The best way to get new media types included in this library is to register +them with the IANA. The community registration procedure is outlined in +[RFC 6838 section 5](https://tools.ietf.org/html/rfc6838#section-5). Types +registered with the IANA are automatically pulled into this library. + +### Direct Inclusion + +If that is not possible / feasible, they can be added directly here as a +"custom" type. To do this, it is required to have a primary source that +definitively lists the media type. If an extension is going to be listed as +associated with this media type, the source must definitively link the +media type and extension as well. + +To edit the database, only make PRs against `src/custom-types.json` or +`src/custom-suffix.json`. + +The `src/custom-types.json` file is a JSON object with the MIME type as the +keys and the values being an object with the following keys: + +- `compressible` - leave out if you don't know, otherwise `true`/`false` to + indicate whether the data represented by the type is typically compressible. +- `extensions` - include an array of file extensions that are associated with + the type. +- `notes` - human-readable notes about the type, typically what the type is. +- `sources` - include an array of URLs of where the MIME type and the associated + extensions are sourced from. This needs to be a [primary source](https://en.wikipedia.org/wiki/Primary_source); + links to type aggregating sites and Wikipedia are _not acceptable_. + +To update the build, run `npm run build`. + +[ci-image]: https://badgen.net/github/checks/jshttp/mime-db/master?label=ci +[ci-url]: https://github.com/jshttp/mime-db/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-db/master +[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master +[node-image]: https://badgen.net/npm/node/mime-db +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/mime-db +[npm-url]: https://npmjs.org/package/mime-db +[npm-version-image]: https://badgen.net/npm/v/mime-db diff --git a/tools/ui/node_modules/mime-db/db.json b/tools/ui/node_modules/mime-db/db.json new file mode 100644 index 0000000000000000000000000000000000000000..7e74733026db22005684393bf7a54c895e9f4abe --- /dev/null +++ b/tools/ui/node_modules/mime-db/db.json @@ -0,0 +1,9342 @@ +{ + "application/1d-interleaved-parityfec": { + "source": "iana" + }, + "application/3gpdash-qoe-report+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/3gpp-ims+xml": { + "source": "iana", + "compressible": true + }, + "application/3gpphal+json": { + "source": "iana", + "compressible": true + }, + "application/3gpphalforms+json": { + "source": "iana", + "compressible": true + }, + "application/a2l": { + "source": "iana" + }, + "application/ace+cbor": { + "source": "iana" + }, + "application/ace+json": { + "source": "iana", + "compressible": true + }, + "application/ace-groupcomm+cbor": { + "source": "iana" + }, + "application/ace-trl+cbor": { + "source": "iana" + }, + "application/activemessage": { + "source": "iana" + }, + "application/activity+json": { + "source": "iana", + "compressible": true + }, + "application/aif+cbor": { + "source": "iana" + }, + "application/aif+json": { + "source": "iana", + "compressible": true + }, + "application/alto-cdni+json": { + "source": "iana", + "compressible": true + }, + "application/alto-cdnifilter+json": { + "source": "iana", + "compressible": true + }, + "application/alto-costmap+json": { + "source": "iana", + "compressible": true + }, + "application/alto-costmapfilter+json": { + "source": "iana", + "compressible": true + }, + "application/alto-directory+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointcost+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointcostparams+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointprop+json": { + "source": "iana", + "compressible": true + }, + "application/alto-endpointpropparams+json": { + "source": "iana", + "compressible": true + }, + "application/alto-error+json": { + "source": "iana", + "compressible": true + }, + "application/alto-networkmap+json": { + "source": "iana", + "compressible": true + }, + "application/alto-networkmapfilter+json": { + "source": "iana", + "compressible": true + }, + "application/alto-propmap+json": { + "source": "iana", + "compressible": true + }, + "application/alto-propmapparams+json": { + "source": "iana", + "compressible": true + }, + "application/alto-tips+json": { + "source": "iana", + "compressible": true + }, + "application/alto-tipsparams+json": { + "source": "iana", + "compressible": true + }, + "application/alto-updatestreamcontrol+json": { + "source": "iana", + "compressible": true + }, + "application/alto-updatestreamparams+json": { + "source": "iana", + "compressible": true + }, + "application/aml": { + "source": "iana" + }, + "application/andrew-inset": { + "source": "iana", + "extensions": ["ez"] + }, + "application/appinstaller": { + "compressible": false, + "extensions": ["appinstaller"] + }, + "application/applefile": { + "source": "iana" + }, + "application/applixware": { + "source": "apache", + "extensions": ["aw"] + }, + "application/appx": { + "compressible": false, + "extensions": ["appx"] + }, + "application/appxbundle": { + "compressible": false, + "extensions": ["appxbundle"] + }, + "application/at+jwt": { + "source": "iana" + }, + "application/atf": { + "source": "iana" + }, + "application/atfx": { + "source": "iana" + }, + "application/atom+xml": { + "source": "iana", + "compressible": true, + "extensions": ["atom"] + }, + "application/atomcat+xml": { + "source": "iana", + "compressible": true, + "extensions": ["atomcat"] + }, + "application/atomdeleted+xml": { + "source": "iana", + "compressible": true, + "extensions": ["atomdeleted"] + }, + "application/atomicmail": { + "source": "iana" + }, + "application/atomsvc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["atomsvc"] + }, + "application/atsc-dwd+xml": { + "source": "iana", + "compressible": true, + "extensions": ["dwd"] + }, + "application/atsc-dynamic-event-message": { + "source": "iana" + }, + "application/atsc-held+xml": { + "source": "iana", + "compressible": true, + "extensions": ["held"] + }, + "application/atsc-rdt+json": { + "source": "iana", + "compressible": true + }, + "application/atsc-rsat+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rsat"] + }, + "application/atxml": { + "source": "iana" + }, + "application/auth-policy+xml": { + "source": "iana", + "compressible": true + }, + "application/automationml-aml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["aml"] + }, + "application/automationml-amlx+zip": { + "source": "iana", + "compressible": false, + "extensions": ["amlx"] + }, + "application/bacnet-xdd+zip": { + "source": "iana", + "compressible": false + }, + "application/batch-smtp": { + "source": "iana" + }, + "application/bdoc": { + "compressible": false, + "extensions": ["bdoc"] + }, + "application/beep+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/bufr": { + "source": "iana" + }, + "application/c2pa": { + "source": "iana" + }, + "application/calendar+json": { + "source": "iana", + "compressible": true + }, + "application/calendar+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xcs"] + }, + "application/call-completion": { + "source": "iana" + }, + "application/cals-1840": { + "source": "iana" + }, + "application/captive+json": { + "source": "iana", + "compressible": true + }, + "application/cbor": { + "source": "iana" + }, + "application/cbor-seq": { + "source": "iana" + }, + "application/cccex": { + "source": "iana" + }, + "application/ccmp+xml": { + "source": "iana", + "compressible": true + }, + "application/ccxml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ccxml"] + }, + "application/cda+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/cdfx+xml": { + "source": "iana", + "compressible": true, + "extensions": ["cdfx"] + }, + "application/cdmi-capability": { + "source": "iana", + "extensions": ["cdmia"] + }, + "application/cdmi-container": { + "source": "iana", + "extensions": ["cdmic"] + }, + "application/cdmi-domain": { + "source": "iana", + "extensions": ["cdmid"] + }, + "application/cdmi-object": { + "source": "iana", + "extensions": ["cdmio"] + }, + "application/cdmi-queue": { + "source": "iana", + "extensions": ["cdmiq"] + }, + "application/cdni": { + "source": "iana" + }, + "application/ce+cbor": { + "source": "iana" + }, + "application/cea": { + "source": "iana" + }, + "application/cea-2018+xml": { + "source": "iana", + "compressible": true + }, + "application/cellml+xml": { + "source": "iana", + "compressible": true + }, + "application/cfw": { + "source": "iana" + }, + "application/cid-edhoc+cbor-seq": { + "source": "iana" + }, + "application/city+json": { + "source": "iana", + "compressible": true + }, + "application/city+json-seq": { + "source": "iana" + }, + "application/clr": { + "source": "iana" + }, + "application/clue+xml": { + "source": "iana", + "compressible": true + }, + "application/clue_info+xml": { + "source": "iana", + "compressible": true + }, + "application/cms": { + "source": "iana" + }, + "application/cnrp+xml": { + "source": "iana", + "compressible": true + }, + "application/coap-eap": { + "source": "iana" + }, + "application/coap-group+json": { + "source": "iana", + "compressible": true + }, + "application/coap-payload": { + "source": "iana" + }, + "application/commonground": { + "source": "iana" + }, + "application/concise-problem-details+cbor": { + "source": "iana" + }, + "application/conference-info+xml": { + "source": "iana", + "compressible": true + }, + "application/cose": { + "source": "iana" + }, + "application/cose-key": { + "source": "iana" + }, + "application/cose-key-set": { + "source": "iana" + }, + "application/cose-x509": { + "source": "iana" + }, + "application/cpl+xml": { + "source": "iana", + "compressible": true, + "extensions": ["cpl"] + }, + "application/csrattrs": { + "source": "iana" + }, + "application/csta+xml": { + "source": "iana", + "compressible": true + }, + "application/cstadata+xml": { + "source": "iana", + "compressible": true + }, + "application/csvm+json": { + "source": "iana", + "compressible": true + }, + "application/cu-seeme": { + "source": "apache", + "extensions": ["cu"] + }, + "application/cwl": { + "source": "iana", + "extensions": ["cwl"] + }, + "application/cwl+json": { + "source": "iana", + "compressible": true + }, + "application/cwl+yaml": { + "source": "iana" + }, + "application/cwt": { + "source": "iana" + }, + "application/cybercash": { + "source": "iana" + }, + "application/dart": { + "compressible": true + }, + "application/dash+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mpd"] + }, + "application/dash-patch+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mpp"] + }, + "application/dashdelta": { + "source": "iana" + }, + "application/davmount+xml": { + "source": "iana", + "compressible": true, + "extensions": ["davmount"] + }, + "application/dca-rft": { + "source": "iana" + }, + "application/dcd": { + "source": "iana" + }, + "application/dec-dx": { + "source": "iana" + }, + "application/dialog-info+xml": { + "source": "iana", + "compressible": true + }, + "application/dicom": { + "source": "iana", + "extensions": ["dcm"] + }, + "application/dicom+json": { + "source": "iana", + "compressible": true + }, + "application/dicom+xml": { + "source": "iana", + "compressible": true + }, + "application/dii": { + "source": "iana" + }, + "application/dit": { + "source": "iana" + }, + "application/dns": { + "source": "iana" + }, + "application/dns+json": { + "source": "iana", + "compressible": true + }, + "application/dns-message": { + "source": "iana" + }, + "application/docbook+xml": { + "source": "apache", + "compressible": true, + "extensions": ["dbk"] + }, + "application/dots+cbor": { + "source": "iana" + }, + "application/dpop+jwt": { + "source": "iana" + }, + "application/dskpp+xml": { + "source": "iana", + "compressible": true + }, + "application/dssc+der": { + "source": "iana", + "extensions": ["dssc"] + }, + "application/dssc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xdssc"] + }, + "application/dvcs": { + "source": "iana" + }, + "application/eat+cwt": { + "source": "iana" + }, + "application/eat+jwt": { + "source": "iana" + }, + "application/eat-bun+cbor": { + "source": "iana" + }, + "application/eat-bun+json": { + "source": "iana", + "compressible": true + }, + "application/eat-ucs+cbor": { + "source": "iana" + }, + "application/eat-ucs+json": { + "source": "iana", + "compressible": true + }, + "application/ecmascript": { + "source": "apache", + "compressible": true, + "extensions": ["ecma"] + }, + "application/edhoc+cbor-seq": { + "source": "iana" + }, + "application/edi-consent": { + "source": "iana" + }, + "application/edi-x12": { + "source": "iana", + "compressible": false + }, + "application/edifact": { + "source": "iana", + "compressible": false + }, + "application/efi": { + "source": "iana" + }, + "application/elm+json": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/elm+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.cap+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/emergencycalldata.comment+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.control+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.deviceinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.ecall.msd": { + "source": "iana" + }, + "application/emergencycalldata.legacyesn+json": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.providerinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.serviceinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.subscriberinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/emergencycalldata.veds+xml": { + "source": "iana", + "compressible": true + }, + "application/emma+xml": { + "source": "iana", + "compressible": true, + "extensions": ["emma"] + }, + "application/emotionml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["emotionml"] + }, + "application/encaprtp": { + "source": "iana" + }, + "application/entity-statement+jwt": { + "source": "iana" + }, + "application/epp+xml": { + "source": "iana", + "compressible": true + }, + "application/epub+zip": { + "source": "iana", + "compressible": false, + "extensions": ["epub"] + }, + "application/eshop": { + "source": "iana" + }, + "application/exi": { + "source": "iana", + "extensions": ["exi"] + }, + "application/expect-ct-report+json": { + "source": "iana", + "compressible": true + }, + "application/express": { + "source": "iana", + "extensions": ["exp"] + }, + "application/fastinfoset": { + "source": "iana" + }, + "application/fastsoap": { + "source": "iana" + }, + "application/fdf": { + "source": "iana", + "extensions": ["fdf"] + }, + "application/fdt+xml": { + "source": "iana", + "compressible": true, + "extensions": ["fdt"] + }, + "application/fhir+json": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/fhir+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/fido.trusted-apps+json": { + "compressible": true + }, + "application/fits": { + "source": "iana" + }, + "application/flexfec": { + "source": "iana" + }, + "application/font-sfnt": { + "source": "iana" + }, + "application/font-tdpfr": { + "source": "iana", + "extensions": ["pfr"] + }, + "application/font-woff": { + "source": "iana", + "compressible": false + }, + "application/framework-attributes+xml": { + "source": "iana", + "compressible": true + }, + "application/geo+json": { + "source": "iana", + "compressible": true, + "extensions": ["geojson"] + }, + "application/geo+json-seq": { + "source": "iana" + }, + "application/geopackage+sqlite3": { + "source": "iana" + }, + "application/geopose+json": { + "source": "iana", + "compressible": true + }, + "application/geoxacml+json": { + "source": "iana", + "compressible": true + }, + "application/geoxacml+xml": { + "source": "iana", + "compressible": true + }, + "application/gltf-buffer": { + "source": "iana" + }, + "application/gml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["gml"] + }, + "application/gnap-binding-jws": { + "source": "iana" + }, + "application/gnap-binding-jwsd": { + "source": "iana" + }, + "application/gnap-binding-rotation-jws": { + "source": "iana" + }, + "application/gnap-binding-rotation-jwsd": { + "source": "iana" + }, + "application/gpx+xml": { + "source": "apache", + "compressible": true, + "extensions": ["gpx"] + }, + "application/grib": { + "source": "iana" + }, + "application/gxf": { + "source": "apache", + "extensions": ["gxf"] + }, + "application/gzip": { + "source": "iana", + "compressible": false, + "extensions": ["gz"] + }, + "application/h224": { + "source": "iana" + }, + "application/held+xml": { + "source": "iana", + "compressible": true + }, + "application/hjson": { + "extensions": ["hjson"] + }, + "application/hl7v2+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/http": { + "source": "iana" + }, + "application/hyperstudio": { + "source": "iana", + "extensions": ["stk"] + }, + "application/ibe-key-request+xml": { + "source": "iana", + "compressible": true + }, + "application/ibe-pkg-reply+xml": { + "source": "iana", + "compressible": true + }, + "application/ibe-pp-data": { + "source": "iana" + }, + "application/iges": { + "source": "iana" + }, + "application/im-iscomposing+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/index": { + "source": "iana" + }, + "application/index.cmd": { + "source": "iana" + }, + "application/index.obj": { + "source": "iana" + }, + "application/index.response": { + "source": "iana" + }, + "application/index.vnd": { + "source": "iana" + }, + "application/inkml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ink","inkml"] + }, + "application/iotp": { + "source": "iana" + }, + "application/ipfix": { + "source": "iana", + "extensions": ["ipfix"] + }, + "application/ipp": { + "source": "iana" + }, + "application/isup": { + "source": "iana" + }, + "application/its+xml": { + "source": "iana", + "compressible": true, + "extensions": ["its"] + }, + "application/java-archive": { + "source": "iana", + "compressible": false, + "extensions": ["jar","war","ear"] + }, + "application/java-serialized-object": { + "source": "apache", + "compressible": false, + "extensions": ["ser"] + }, + "application/java-vm": { + "source": "apache", + "compressible": false, + "extensions": ["class"] + }, + "application/javascript": { + "source": "apache", + "charset": "UTF-8", + "compressible": true, + "extensions": ["js"] + }, + "application/jf2feed+json": { + "source": "iana", + "compressible": true + }, + "application/jose": { + "source": "iana" + }, + "application/jose+json": { + "source": "iana", + "compressible": true + }, + "application/jrd+json": { + "source": "iana", + "compressible": true + }, + "application/jscalendar+json": { + "source": "iana", + "compressible": true + }, + "application/jscontact+json": { + "source": "iana", + "compressible": true + }, + "application/json": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["json","map"] + }, + "application/json-patch+json": { + "source": "iana", + "compressible": true + }, + "application/json-seq": { + "source": "iana" + }, + "application/json5": { + "extensions": ["json5"] + }, + "application/jsonml+json": { + "source": "apache", + "compressible": true, + "extensions": ["jsonml"] + }, + "application/jsonpath": { + "source": "iana" + }, + "application/jwk+json": { + "source": "iana", + "compressible": true + }, + "application/jwk-set+json": { + "source": "iana", + "compressible": true + }, + "application/jwk-set+jwt": { + "source": "iana" + }, + "application/jwt": { + "source": "iana" + }, + "application/kpml-request+xml": { + "source": "iana", + "compressible": true + }, + "application/kpml-response+xml": { + "source": "iana", + "compressible": true + }, + "application/ld+json": { + "source": "iana", + "compressible": true, + "extensions": ["jsonld"] + }, + "application/lgr+xml": { + "source": "iana", + "compressible": true, + "extensions": ["lgr"] + }, + "application/link-format": { + "source": "iana" + }, + "application/linkset": { + "source": "iana" + }, + "application/linkset+json": { + "source": "iana", + "compressible": true + }, + "application/load-control+xml": { + "source": "iana", + "compressible": true + }, + "application/logout+jwt": { + "source": "iana" + }, + "application/lost+xml": { + "source": "iana", + "compressible": true, + "extensions": ["lostxml"] + }, + "application/lostsync+xml": { + "source": "iana", + "compressible": true + }, + "application/lpf+zip": { + "source": "iana", + "compressible": false + }, + "application/lxf": { + "source": "iana" + }, + "application/mac-binhex40": { + "source": "iana", + "extensions": ["hqx"] + }, + "application/mac-compactpro": { + "source": "apache", + "extensions": ["cpt"] + }, + "application/macwriteii": { + "source": "iana" + }, + "application/mads+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mads"] + }, + "application/manifest+json": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["webmanifest"] + }, + "application/marc": { + "source": "iana", + "extensions": ["mrc"] + }, + "application/marcxml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mrcx"] + }, + "application/mathematica": { + "source": "iana", + "extensions": ["ma","nb","mb"] + }, + "application/mathml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mathml"] + }, + "application/mathml-content+xml": { + "source": "iana", + "compressible": true + }, + "application/mathml-presentation+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-associated-procedure-description+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-deregister+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-envelope+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-msk+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-msk-response+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-protection-description+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-reception-report+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-register+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-register-response+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-schedule+xml": { + "source": "iana", + "compressible": true + }, + "application/mbms-user-service-description+xml": { + "source": "iana", + "compressible": true + }, + "application/mbox": { + "source": "iana", + "extensions": ["mbox"] + }, + "application/media-policy-dataset+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mpf"] + }, + "application/media_control+xml": { + "source": "iana", + "compressible": true + }, + "application/mediaservercontrol+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mscml"] + }, + "application/merge-patch+json": { + "source": "iana", + "compressible": true + }, + "application/metalink+xml": { + "source": "apache", + "compressible": true, + "extensions": ["metalink"] + }, + "application/metalink4+xml": { + "source": "iana", + "compressible": true, + "extensions": ["meta4"] + }, + "application/mets+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mets"] + }, + "application/mf4": { + "source": "iana" + }, + "application/mikey": { + "source": "iana" + }, + "application/mipc": { + "source": "iana" + }, + "application/missing-blocks+cbor-seq": { + "source": "iana" + }, + "application/mmt-aei+xml": { + "source": "iana", + "compressible": true, + "extensions": ["maei"] + }, + "application/mmt-usd+xml": { + "source": "iana", + "compressible": true, + "extensions": ["musd"] + }, + "application/mods+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mods"] + }, + "application/moss-keys": { + "source": "iana" + }, + "application/moss-signature": { + "source": "iana" + }, + "application/mosskey-data": { + "source": "iana" + }, + "application/mosskey-request": { + "source": "iana" + }, + "application/mp21": { + "source": "iana", + "extensions": ["m21","mp21"] + }, + "application/mp4": { + "source": "iana", + "extensions": ["mp4","mpg4","mp4s","m4p"] + }, + "application/mpeg4-generic": { + "source": "iana" + }, + "application/mpeg4-iod": { + "source": "iana" + }, + "application/mpeg4-iod-xmt": { + "source": "iana" + }, + "application/mrb-consumer+xml": { + "source": "iana", + "compressible": true + }, + "application/mrb-publish+xml": { + "source": "iana", + "compressible": true + }, + "application/msc-ivr+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/msc-mixer+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/msix": { + "compressible": false, + "extensions": ["msix"] + }, + "application/msixbundle": { + "compressible": false, + "extensions": ["msixbundle"] + }, + "application/msword": { + "source": "iana", + "compressible": false, + "extensions": ["doc","dot"] + }, + "application/mud+json": { + "source": "iana", + "compressible": true + }, + "application/multipart-core": { + "source": "iana" + }, + "application/mxf": { + "source": "iana", + "extensions": ["mxf"] + }, + "application/n-quads": { + "source": "iana", + "extensions": ["nq"] + }, + "application/n-triples": { + "source": "iana", + "extensions": ["nt"] + }, + "application/nasdata": { + "source": "iana" + }, + "application/news-checkgroups": { + "source": "iana", + "charset": "US-ASCII" + }, + "application/news-groupinfo": { + "source": "iana", + "charset": "US-ASCII" + }, + "application/news-transmission": { + "source": "iana" + }, + "application/nlsml+xml": { + "source": "iana", + "compressible": true + }, + "application/node": { + "source": "iana", + "extensions": ["cjs"] + }, + "application/nss": { + "source": "iana" + }, + "application/oauth-authz-req+jwt": { + "source": "iana" + }, + "application/oblivious-dns-message": { + "source": "iana" + }, + "application/ocsp-request": { + "source": "iana" + }, + "application/ocsp-response": { + "source": "iana" + }, + "application/octet-stream": { + "source": "iana", + "compressible": true, + "extensions": ["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"] + }, + "application/oda": { + "source": "iana", + "extensions": ["oda"] + }, + "application/odm+xml": { + "source": "iana", + "compressible": true + }, + "application/odx": { + "source": "iana" + }, + "application/oebps-package+xml": { + "source": "iana", + "compressible": true, + "extensions": ["opf"] + }, + "application/ogg": { + "source": "iana", + "compressible": false, + "extensions": ["ogx"] + }, + "application/ohttp-keys": { + "source": "iana" + }, + "application/omdoc+xml": { + "source": "apache", + "compressible": true, + "extensions": ["omdoc"] + }, + "application/onenote": { + "source": "apache", + "extensions": ["onetoc","onetoc2","onetmp","onepkg","one","onea"] + }, + "application/opc-nodeset+xml": { + "source": "iana", + "compressible": true + }, + "application/oscore": { + "source": "iana" + }, + "application/oxps": { + "source": "iana", + "extensions": ["oxps"] + }, + "application/p21": { + "source": "iana" + }, + "application/p21+zip": { + "source": "iana", + "compressible": false + }, + "application/p2p-overlay+xml": { + "source": "iana", + "compressible": true, + "extensions": ["relo"] + }, + "application/parityfec": { + "source": "iana" + }, + "application/passport": { + "source": "iana" + }, + "application/patch-ops-error+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xer"] + }, + "application/pdf": { + "source": "iana", + "compressible": false, + "extensions": ["pdf"] + }, + "application/pdx": { + "source": "iana" + }, + "application/pem-certificate-chain": { + "source": "iana" + }, + "application/pgp-encrypted": { + "source": "iana", + "compressible": false, + "extensions": ["pgp"] + }, + "application/pgp-keys": { + "source": "iana", + "extensions": ["asc"] + }, + "application/pgp-signature": { + "source": "iana", + "extensions": ["sig","asc"] + }, + "application/pics-rules": { + "source": "apache", + "extensions": ["prf"] + }, + "application/pidf+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/pidf-diff+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/pkcs10": { + "source": "iana", + "extensions": ["p10"] + }, + "application/pkcs12": { + "source": "iana" + }, + "application/pkcs7-mime": { + "source": "iana", + "extensions": ["p7m","p7c"] + }, + "application/pkcs7-signature": { + "source": "iana", + "extensions": ["p7s"] + }, + "application/pkcs8": { + "source": "iana", + "extensions": ["p8"] + }, + "application/pkcs8-encrypted": { + "source": "iana" + }, + "application/pkix-attr-cert": { + "source": "iana", + "extensions": ["ac"] + }, + "application/pkix-cert": { + "source": "iana", + "extensions": ["cer"] + }, + "application/pkix-crl": { + "source": "iana", + "extensions": ["crl"] + }, + "application/pkix-pkipath": { + "source": "iana", + "extensions": ["pkipath"] + }, + "application/pkixcmp": { + "source": "iana", + "extensions": ["pki"] + }, + "application/pls+xml": { + "source": "iana", + "compressible": true, + "extensions": ["pls"] + }, + "application/poc-settings+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/postscript": { + "source": "iana", + "compressible": true, + "extensions": ["ai","eps","ps"] + }, + "application/ppsp-tracker+json": { + "source": "iana", + "compressible": true + }, + "application/private-token-issuer-directory": { + "source": "iana" + }, + "application/private-token-request": { + "source": "iana" + }, + "application/private-token-response": { + "source": "iana" + }, + "application/problem+json": { + "source": "iana", + "compressible": true + }, + "application/problem+xml": { + "source": "iana", + "compressible": true + }, + "application/provenance+xml": { + "source": "iana", + "compressible": true, + "extensions": ["provx"] + }, + "application/provided-claims+jwt": { + "source": "iana" + }, + "application/prs.alvestrand.titrax-sheet": { + "source": "iana" + }, + "application/prs.cww": { + "source": "iana", + "extensions": ["cww"] + }, + "application/prs.cyn": { + "source": "iana", + "charset": "7-BIT" + }, + "application/prs.hpub+zip": { + "source": "iana", + "compressible": false + }, + "application/prs.implied-document+xml": { + "source": "iana", + "compressible": true + }, + "application/prs.implied-executable": { + "source": "iana" + }, + "application/prs.implied-object+json": { + "source": "iana", + "compressible": true + }, + "application/prs.implied-object+json-seq": { + "source": "iana" + }, + "application/prs.implied-object+yaml": { + "source": "iana" + }, + "application/prs.implied-structure": { + "source": "iana" + }, + "application/prs.mayfile": { + "source": "iana" + }, + "application/prs.nprend": { + "source": "iana" + }, + "application/prs.plucker": { + "source": "iana" + }, + "application/prs.rdf-xml-crypt": { + "source": "iana" + }, + "application/prs.vcfbzip2": { + "source": "iana" + }, + "application/prs.xsf+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xsf"] + }, + "application/pskc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["pskcxml"] + }, + "application/pvd+json": { + "source": "iana", + "compressible": true + }, + "application/qsig": { + "source": "iana" + }, + "application/raml+yaml": { + "compressible": true, + "extensions": ["raml"] + }, + "application/raptorfec": { + "source": "iana" + }, + "application/rdap+json": { + "source": "iana", + "compressible": true + }, + "application/rdf+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rdf","owl"] + }, + "application/reginfo+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rif"] + }, + "application/relax-ng-compact-syntax": { + "source": "iana", + "extensions": ["rnc"] + }, + "application/remote-printing": { + "source": "apache" + }, + "application/reputon+json": { + "source": "iana", + "compressible": true + }, + "application/resolve-response+jwt": { + "source": "iana" + }, + "application/resource-lists+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rl"] + }, + "application/resource-lists-diff+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rld"] + }, + "application/rfc+xml": { + "source": "iana", + "compressible": true + }, + "application/riscos": { + "source": "iana" + }, + "application/rlmi+xml": { + "source": "iana", + "compressible": true + }, + "application/rls-services+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rs"] + }, + "application/route-apd+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rapd"] + }, + "application/route-s-tsid+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sls"] + }, + "application/route-usd+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rusd"] + }, + "application/rpki-checklist": { + "source": "iana" + }, + "application/rpki-ghostbusters": { + "source": "iana", + "extensions": ["gbr"] + }, + "application/rpki-manifest": { + "source": "iana", + "extensions": ["mft"] + }, + "application/rpki-publication": { + "source": "iana" + }, + "application/rpki-roa": { + "source": "iana", + "extensions": ["roa"] + }, + "application/rpki-signed-tal": { + "source": "iana" + }, + "application/rpki-updown": { + "source": "iana" + }, + "application/rsd+xml": { + "source": "apache", + "compressible": true, + "extensions": ["rsd"] + }, + "application/rss+xml": { + "source": "apache", + "compressible": true, + "extensions": ["rss"] + }, + "application/rtf": { + "source": "iana", + "compressible": true, + "extensions": ["rtf"] + }, + "application/rtploopback": { + "source": "iana" + }, + "application/rtx": { + "source": "iana" + }, + "application/samlassertion+xml": { + "source": "iana", + "compressible": true + }, + "application/samlmetadata+xml": { + "source": "iana", + "compressible": true + }, + "application/sarif+json": { + "source": "iana", + "compressible": true + }, + "application/sarif-external-properties+json": { + "source": "iana", + "compressible": true + }, + "application/sbe": { + "source": "iana" + }, + "application/sbml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sbml"] + }, + "application/scaip+xml": { + "source": "iana", + "compressible": true + }, + "application/scim+json": { + "source": "iana", + "compressible": true + }, + "application/scvp-cv-request": { + "source": "iana", + "extensions": ["scq"] + }, + "application/scvp-cv-response": { + "source": "iana", + "extensions": ["scs"] + }, + "application/scvp-vp-request": { + "source": "iana", + "extensions": ["spq"] + }, + "application/scvp-vp-response": { + "source": "iana", + "extensions": ["spp"] + }, + "application/sdp": { + "source": "iana", + "extensions": ["sdp"] + }, + "application/secevent+jwt": { + "source": "iana" + }, + "application/senml+cbor": { + "source": "iana" + }, + "application/senml+json": { + "source": "iana", + "compressible": true + }, + "application/senml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["senmlx"] + }, + "application/senml-etch+cbor": { + "source": "iana" + }, + "application/senml-etch+json": { + "source": "iana", + "compressible": true + }, + "application/senml-exi": { + "source": "iana" + }, + "application/sensml+cbor": { + "source": "iana" + }, + "application/sensml+json": { + "source": "iana", + "compressible": true + }, + "application/sensml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sensmlx"] + }, + "application/sensml-exi": { + "source": "iana" + }, + "application/sep+xml": { + "source": "iana", + "compressible": true + }, + "application/sep-exi": { + "source": "iana" + }, + "application/session-info": { + "source": "iana" + }, + "application/set-payment": { + "source": "iana" + }, + "application/set-payment-initiation": { + "source": "iana", + "extensions": ["setpay"] + }, + "application/set-registration": { + "source": "iana" + }, + "application/set-registration-initiation": { + "source": "iana", + "extensions": ["setreg"] + }, + "application/sgml": { + "source": "iana" + }, + "application/sgml-open-catalog": { + "source": "iana" + }, + "application/shf+xml": { + "source": "iana", + "compressible": true, + "extensions": ["shf"] + }, + "application/sieve": { + "source": "iana", + "extensions": ["siv","sieve"] + }, + "application/simple-filter+xml": { + "source": "iana", + "compressible": true + }, + "application/simple-message-summary": { + "source": "iana" + }, + "application/simplesymbolcontainer": { + "source": "iana" + }, + "application/sipc": { + "source": "iana" + }, + "application/slate": { + "source": "iana" + }, + "application/smil": { + "source": "apache" + }, + "application/smil+xml": { + "source": "iana", + "compressible": true, + "extensions": ["smi","smil"] + }, + "application/smpte336m": { + "source": "iana" + }, + "application/soap+fastinfoset": { + "source": "iana" + }, + "application/soap+xml": { + "source": "iana", + "compressible": true + }, + "application/sparql-query": { + "source": "iana", + "extensions": ["rq"] + }, + "application/sparql-results+xml": { + "source": "iana", + "compressible": true, + "extensions": ["srx"] + }, + "application/spdx+json": { + "source": "iana", + "compressible": true + }, + "application/spirits-event+xml": { + "source": "iana", + "compressible": true + }, + "application/sql": { + "source": "iana", + "extensions": ["sql"] + }, + "application/srgs": { + "source": "iana", + "extensions": ["gram"] + }, + "application/srgs+xml": { + "source": "iana", + "compressible": true, + "extensions": ["grxml"] + }, + "application/sru+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sru"] + }, + "application/ssdl+xml": { + "source": "apache", + "compressible": true, + "extensions": ["ssdl"] + }, + "application/sslkeylogfile": { + "source": "iana" + }, + "application/ssml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ssml"] + }, + "application/st2110-41": { + "source": "iana" + }, + "application/stix+json": { + "source": "iana", + "compressible": true + }, + "application/stratum": { + "source": "iana" + }, + "application/swid+cbor": { + "source": "iana" + }, + "application/swid+xml": { + "source": "iana", + "compressible": true, + "extensions": ["swidtag"] + }, + "application/tamp-apex-update": { + "source": "iana" + }, + "application/tamp-apex-update-confirm": { + "source": "iana" + }, + "application/tamp-community-update": { + "source": "iana" + }, + "application/tamp-community-update-confirm": { + "source": "iana" + }, + "application/tamp-error": { + "source": "iana" + }, + "application/tamp-sequence-adjust": { + "source": "iana" + }, + "application/tamp-sequence-adjust-confirm": { + "source": "iana" + }, + "application/tamp-status-query": { + "source": "iana" + }, + "application/tamp-status-response": { + "source": "iana" + }, + "application/tamp-update": { + "source": "iana" + }, + "application/tamp-update-confirm": { + "source": "iana" + }, + "application/tar": { + "compressible": true + }, + "application/taxii+json": { + "source": "iana", + "compressible": true + }, + "application/td+json": { + "source": "iana", + "compressible": true + }, + "application/tei+xml": { + "source": "iana", + "compressible": true, + "extensions": ["tei","teicorpus"] + }, + "application/tetra_isi": { + "source": "iana" + }, + "application/thraud+xml": { + "source": "iana", + "compressible": true, + "extensions": ["tfi"] + }, + "application/timestamp-query": { + "source": "iana" + }, + "application/timestamp-reply": { + "source": "iana" + }, + "application/timestamped-data": { + "source": "iana", + "extensions": ["tsd"] + }, + "application/tlsrpt+gzip": { + "source": "iana" + }, + "application/tlsrpt+json": { + "source": "iana", + "compressible": true + }, + "application/tm+json": { + "source": "iana", + "compressible": true + }, + "application/tnauthlist": { + "source": "iana" + }, + "application/toc+cbor": { + "source": "iana" + }, + "application/token-introspection+jwt": { + "source": "iana" + }, + "application/toml": { + "source": "iana", + "compressible": true, + "extensions": ["toml"] + }, + "application/trickle-ice-sdpfrag": { + "source": "iana" + }, + "application/trig": { + "source": "iana", + "extensions": ["trig"] + }, + "application/trust-chain+json": { + "source": "iana", + "compressible": true + }, + "application/trust-mark+jwt": { + "source": "iana" + }, + "application/trust-mark-delegation+jwt": { + "source": "iana" + }, + "application/ttml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ttml"] + }, + "application/tve-trigger": { + "source": "iana" + }, + "application/tzif": { + "source": "iana" + }, + "application/tzif-leap": { + "source": "iana" + }, + "application/ubjson": { + "compressible": false, + "extensions": ["ubj"] + }, + "application/uccs+cbor": { + "source": "iana" + }, + "application/ujcs+json": { + "source": "iana", + "compressible": true + }, + "application/ulpfec": { + "source": "iana" + }, + "application/urc-grpsheet+xml": { + "source": "iana", + "compressible": true + }, + "application/urc-ressheet+xml": { + "source": "iana", + "compressible": true, + "extensions": ["rsheet"] + }, + "application/urc-targetdesc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["td"] + }, + "application/urc-uisocketdesc+xml": { + "source": "iana", + "compressible": true + }, + "application/vc": { + "source": "iana" + }, + "application/vc+cose": { + "source": "iana" + }, + "application/vc+jwt": { + "source": "iana" + }, + "application/vcard+json": { + "source": "iana", + "compressible": true + }, + "application/vcard+xml": { + "source": "iana", + "compressible": true + }, + "application/vemmi": { + "source": "iana" + }, + "application/vividence.scriptfile": { + "source": "apache" + }, + "application/vnd.1000minds.decision-model+xml": { + "source": "iana", + "compressible": true, + "extensions": ["1km"] + }, + "application/vnd.1ob": { + "source": "iana" + }, + "application/vnd.3gpp-prose+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp-prose-pc3a+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp-prose-pc3ach+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp-prose-pc3ch+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp-prose-pc8+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp-v2x-local-service-information": { + "source": "iana" + }, + "application/vnd.3gpp.5gnas": { + "source": "iana" + }, + "application/vnd.3gpp.5gsa2x": { + "source": "iana" + }, + "application/vnd.3gpp.5gsa2x-local-service-information": { + "source": "iana" + }, + "application/vnd.3gpp.5gsv2x": { + "source": "iana" + }, + "application/vnd.3gpp.5gsv2x-local-service-information": { + "source": "iana" + }, + "application/vnd.3gpp.access-transfer-events+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.bsf+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.crs+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.current-location-discovery+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.gmop+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.gtpc": { + "source": "iana" + }, + "application/vnd.3gpp.interworking-data": { + "source": "iana" + }, + "application/vnd.3gpp.lpp": { + "source": "iana" + }, + "application/vnd.3gpp.mc-signalling-ear": { + "source": "iana" + }, + "application/vnd.3gpp.mcdata-affiliation-command+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-msgstore-ctrl-request+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-payload": { + "source": "iana" + }, + "application/vnd.3gpp.mcdata-regroup+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-service-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-signalling": { + "source": "iana" + }, + "application/vnd.3gpp.mcdata-ue-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcdata-user-profile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-affiliation-command+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-floor-request+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-location-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-mbms-usage-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-regroup+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-service-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-signed+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-ue-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-ue-init-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcptt-user-profile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-affiliation-command+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-location-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-mbms-usage-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-regroup+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-service-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-transmission-request+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-ue-config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mcvideo-user-profile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.mid-call+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.ngap": { + "source": "iana" + }, + "application/vnd.3gpp.pfcp": { + "source": "iana" + }, + "application/vnd.3gpp.pic-bw-large": { + "source": "iana", + "extensions": ["plb"] + }, + "application/vnd.3gpp.pic-bw-small": { + "source": "iana", + "extensions": ["psb"] + }, + "application/vnd.3gpp.pic-bw-var": { + "source": "iana", + "extensions": ["pvb"] + }, + "application/vnd.3gpp.pinapp-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.s1ap": { + "source": "iana" + }, + "application/vnd.3gpp.seal-group-doc+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.seal-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.seal-location-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.seal-mbms-usage-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.seal-network-qos-management-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.seal-ue-config-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.seal-unicast-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.seal-user-profile-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.sms": { + "source": "iana" + }, + "application/vnd.3gpp.sms+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.srvcc-ext+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.srvcc-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.state-and-event-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.ussd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp.v2x": { + "source": "iana" + }, + "application/vnd.3gpp.vae-info+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp2.bcmcsinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.3gpp2.sms": { + "source": "iana" + }, + "application/vnd.3gpp2.tcap": { + "source": "iana", + "extensions": ["tcap"] + }, + "application/vnd.3lightssoftware.imagescal": { + "source": "iana" + }, + "application/vnd.3m.post-it-notes": { + "source": "iana", + "extensions": ["pwn"] + }, + "application/vnd.accpac.simply.aso": { + "source": "iana", + "extensions": ["aso"] + }, + "application/vnd.accpac.simply.imp": { + "source": "iana", + "extensions": ["imp"] + }, + "application/vnd.acm.addressxfer+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.acm.chatbot+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.acucobol": { + "source": "iana", + "extensions": ["acu"] + }, + "application/vnd.acucorp": { + "source": "iana", + "extensions": ["atc","acutc"] + }, + "application/vnd.adobe.air-application-installer-package+zip": { + "source": "apache", + "compressible": false, + "extensions": ["air"] + }, + "application/vnd.adobe.flash.movie": { + "source": "iana" + }, + "application/vnd.adobe.formscentral.fcdt": { + "source": "iana", + "extensions": ["fcdt"] + }, + "application/vnd.adobe.fxp": { + "source": "iana", + "extensions": ["fxp","fxpl"] + }, + "application/vnd.adobe.partial-upload": { + "source": "iana" + }, + "application/vnd.adobe.xdp+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xdp"] + }, + "application/vnd.adobe.xfdf": { + "source": "apache", + "extensions": ["xfdf"] + }, + "application/vnd.aether.imp": { + "source": "iana" + }, + "application/vnd.afpc.afplinedata": { + "source": "iana" + }, + "application/vnd.afpc.afplinedata-pagedef": { + "source": "iana" + }, + "application/vnd.afpc.cmoca-cmresource": { + "source": "iana" + }, + "application/vnd.afpc.foca-charset": { + "source": "iana" + }, + "application/vnd.afpc.foca-codedfont": { + "source": "iana" + }, + "application/vnd.afpc.foca-codepage": { + "source": "iana" + }, + "application/vnd.afpc.modca": { + "source": "iana" + }, + "application/vnd.afpc.modca-cmtable": { + "source": "iana" + }, + "application/vnd.afpc.modca-formdef": { + "source": "iana" + }, + "application/vnd.afpc.modca-mediummap": { + "source": "iana" + }, + "application/vnd.afpc.modca-objectcontainer": { + "source": "iana" + }, + "application/vnd.afpc.modca-overlay": { + "source": "iana" + }, + "application/vnd.afpc.modca-pagesegment": { + "source": "iana" + }, + "application/vnd.age": { + "source": "iana", + "extensions": ["age"] + }, + "application/vnd.ah-barcode": { + "source": "apache" + }, + "application/vnd.ahead.space": { + "source": "iana", + "extensions": ["ahead"] + }, + "application/vnd.airzip.filesecure.azf": { + "source": "iana", + "extensions": ["azf"] + }, + "application/vnd.airzip.filesecure.azs": { + "source": "iana", + "extensions": ["azs"] + }, + "application/vnd.amadeus+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.amazon.ebook": { + "source": "apache", + "extensions": ["azw"] + }, + "application/vnd.amazon.mobi8-ebook": { + "source": "iana" + }, + "application/vnd.americandynamics.acc": { + "source": "iana", + "extensions": ["acc"] + }, + "application/vnd.amiga.ami": { + "source": "iana", + "extensions": ["ami"] + }, + "application/vnd.amundsen.maze+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.android.ota": { + "source": "iana" + }, + "application/vnd.android.package-archive": { + "source": "apache", + "compressible": false, + "extensions": ["apk"] + }, + "application/vnd.anki": { + "source": "iana" + }, + "application/vnd.anser-web-certificate-issue-initiation": { + "source": "iana", + "extensions": ["cii"] + }, + "application/vnd.anser-web-funds-transfer-initiation": { + "source": "apache", + "extensions": ["fti"] + }, + "application/vnd.antix.game-component": { + "source": "iana", + "extensions": ["atx"] + }, + "application/vnd.apache.arrow.file": { + "source": "iana" + }, + "application/vnd.apache.arrow.stream": { + "source": "iana" + }, + "application/vnd.apache.parquet": { + "source": "iana" + }, + "application/vnd.apache.thrift.binary": { + "source": "iana" + }, + "application/vnd.apache.thrift.compact": { + "source": "iana" + }, + "application/vnd.apache.thrift.json": { + "source": "iana" + }, + "application/vnd.apexlang": { + "source": "iana" + }, + "application/vnd.api+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.aplextor.warrp+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.apothekende.reservation+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.apple.installer+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mpkg"] + }, + "application/vnd.apple.keynote": { + "source": "iana", + "extensions": ["key"] + }, + "application/vnd.apple.mpegurl": { + "source": "iana", + "extensions": ["m3u8"] + }, + "application/vnd.apple.numbers": { + "source": "iana", + "extensions": ["numbers"] + }, + "application/vnd.apple.pages": { + "source": "iana", + "extensions": ["pages"] + }, + "application/vnd.apple.pkpass": { + "compressible": false, + "extensions": ["pkpass"] + }, + "application/vnd.arastra.swi": { + "source": "apache" + }, + "application/vnd.aristanetworks.swi": { + "source": "iana", + "extensions": ["swi"] + }, + "application/vnd.artisan+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.artsquare": { + "source": "iana" + }, + "application/vnd.astraea-software.iota": { + "source": "iana", + "extensions": ["iota"] + }, + "application/vnd.audiograph": { + "source": "iana", + "extensions": ["aep"] + }, + "application/vnd.autodesk.fbx": { + "extensions": ["fbx"] + }, + "application/vnd.autopackage": { + "source": "iana" + }, + "application/vnd.avalon+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.avistar+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.balsamiq.bmml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["bmml"] + }, + "application/vnd.balsamiq.bmpr": { + "source": "iana" + }, + "application/vnd.banana-accounting": { + "source": "iana" + }, + "application/vnd.bbf.usp.error": { + "source": "iana" + }, + "application/vnd.bbf.usp.msg": { + "source": "iana" + }, + "application/vnd.bbf.usp.msg+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.bekitzur-stech+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.belightsoft.lhzd+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.belightsoft.lhzl+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.bint.med-content": { + "source": "iana" + }, + "application/vnd.biopax.rdf+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.blink-idb-value-wrapper": { + "source": "iana" + }, + "application/vnd.blueice.multipass": { + "source": "iana", + "extensions": ["mpm"] + }, + "application/vnd.bluetooth.ep.oob": { + "source": "iana" + }, + "application/vnd.bluetooth.le.oob": { + "source": "iana" + }, + "application/vnd.bmi": { + "source": "iana", + "extensions": ["bmi"] + }, + "application/vnd.bpf": { + "source": "iana" + }, + "application/vnd.bpf3": { + "source": "iana" + }, + "application/vnd.businessobjects": { + "source": "iana", + "extensions": ["rep"] + }, + "application/vnd.byu.uapi+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.bzip3": { + "source": "iana" + }, + "application/vnd.c3voc.schedule+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.cab-jscript": { + "source": "iana" + }, + "application/vnd.canon-cpdl": { + "source": "iana" + }, + "application/vnd.canon-lips": { + "source": "iana" + }, + "application/vnd.capasystems-pg+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.cendio.thinlinc.clientconf": { + "source": "iana" + }, + "application/vnd.century-systems.tcp_stream": { + "source": "iana" + }, + "application/vnd.chemdraw+xml": { + "source": "iana", + "compressible": true, + "extensions": ["cdxml"] + }, + "application/vnd.chess-pgn": { + "source": "iana" + }, + "application/vnd.chipnuts.karaoke-mmd": { + "source": "iana", + "extensions": ["mmd"] + }, + "application/vnd.ciedi": { + "source": "iana" + }, + "application/vnd.cinderella": { + "source": "iana", + "extensions": ["cdy"] + }, + "application/vnd.cirpack.isdn-ext": { + "source": "iana" + }, + "application/vnd.citationstyles.style+xml": { + "source": "iana", + "compressible": true, + "extensions": ["csl"] + }, + "application/vnd.claymore": { + "source": "iana", + "extensions": ["cla"] + }, + "application/vnd.cloanto.rp9": { + "source": "iana", + "extensions": ["rp9"] + }, + "application/vnd.clonk.c4group": { + "source": "iana", + "extensions": ["c4g","c4d","c4f","c4p","c4u"] + }, + "application/vnd.cluetrust.cartomobile-config": { + "source": "iana", + "extensions": ["c11amc"] + }, + "application/vnd.cluetrust.cartomobile-config-pkg": { + "source": "iana", + "extensions": ["c11amz"] + }, + "application/vnd.cncf.helm.chart.content.v1.tar+gzip": { + "source": "iana" + }, + "application/vnd.cncf.helm.chart.provenance.v1.prov": { + "source": "iana" + }, + "application/vnd.cncf.helm.config.v1+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.coffeescript": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.document": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.document-template": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.presentation": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.presentation-template": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.spreadsheet": { + "source": "iana" + }, + "application/vnd.collabio.xodocuments.spreadsheet-template": { + "source": "iana" + }, + "application/vnd.collection+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.collection.doc+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.collection.next+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.comicbook+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.comicbook-rar": { + "source": "iana" + }, + "application/vnd.commerce-battelle": { + "source": "iana" + }, + "application/vnd.commonspace": { + "source": "iana", + "extensions": ["csp"] + }, + "application/vnd.contact.cmsg": { + "source": "iana", + "extensions": ["cdbcmsg"] + }, + "application/vnd.coreos.ignition+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.cosmocaller": { + "source": "iana", + "extensions": ["cmc"] + }, + "application/vnd.crick.clicker": { + "source": "iana", + "extensions": ["clkx"] + }, + "application/vnd.crick.clicker.keyboard": { + "source": "iana", + "extensions": ["clkk"] + }, + "application/vnd.crick.clicker.palette": { + "source": "iana", + "extensions": ["clkp"] + }, + "application/vnd.crick.clicker.template": { + "source": "iana", + "extensions": ["clkt"] + }, + "application/vnd.crick.clicker.wordbank": { + "source": "iana", + "extensions": ["clkw"] + }, + "application/vnd.criticaltools.wbs+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wbs"] + }, + "application/vnd.cryptii.pipe+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.crypto-shade-file": { + "source": "iana" + }, + "application/vnd.cryptomator.encrypted": { + "source": "iana" + }, + "application/vnd.cryptomator.vault": { + "source": "iana" + }, + "application/vnd.ctc-posml": { + "source": "iana", + "extensions": ["pml"] + }, + "application/vnd.ctct.ws+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.cups-pdf": { + "source": "iana" + }, + "application/vnd.cups-postscript": { + "source": "iana" + }, + "application/vnd.cups-ppd": { + "source": "iana", + "extensions": ["ppd"] + }, + "application/vnd.cups-raster": { + "source": "iana" + }, + "application/vnd.cups-raw": { + "source": "iana" + }, + "application/vnd.curl": { + "source": "iana" + }, + "application/vnd.curl.car": { + "source": "apache", + "extensions": ["car"] + }, + "application/vnd.curl.pcurl": { + "source": "apache", + "extensions": ["pcurl"] + }, + "application/vnd.cyan.dean.root+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.cybank": { + "source": "iana" + }, + "application/vnd.cyclonedx+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.cyclonedx+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.d2l.coursepackage1p0+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.d3m-dataset": { + "source": "iana" + }, + "application/vnd.d3m-problem": { + "source": "iana" + }, + "application/vnd.dart": { + "source": "iana", + "compressible": true, + "extensions": ["dart"] + }, + "application/vnd.data-vision.rdz": { + "source": "iana", + "extensions": ["rdz"] + }, + "application/vnd.datalog": { + "source": "iana" + }, + "application/vnd.datapackage+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.dataresource+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.dbf": { + "source": "iana", + "extensions": ["dbf"] + }, + "application/vnd.dcmp+xml": { + "source": "iana", + "compressible": true, + "extensions": ["dcmp"] + }, + "application/vnd.debian.binary-package": { + "source": "iana" + }, + "application/vnd.dece.data": { + "source": "iana", + "extensions": ["uvf","uvvf","uvd","uvvd"] + }, + "application/vnd.dece.ttml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["uvt","uvvt"] + }, + "application/vnd.dece.unspecified": { + "source": "iana", + "extensions": ["uvx","uvvx"] + }, + "application/vnd.dece.zip": { + "source": "iana", + "extensions": ["uvz","uvvz"] + }, + "application/vnd.denovo.fcselayout-link": { + "source": "iana", + "extensions": ["fe_launch"] + }, + "application/vnd.desmume.movie": { + "source": "iana" + }, + "application/vnd.dir-bi.plate-dl-nosuffix": { + "source": "iana" + }, + "application/vnd.dm.delegation+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dna": { + "source": "iana", + "extensions": ["dna"] + }, + "application/vnd.document+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.dolby.mlp": { + "source": "apache", + "extensions": ["mlp"] + }, + "application/vnd.dolby.mobile.1": { + "source": "iana" + }, + "application/vnd.dolby.mobile.2": { + "source": "iana" + }, + "application/vnd.doremir.scorecloud-binary-document": { + "source": "iana" + }, + "application/vnd.dpgraph": { + "source": "iana", + "extensions": ["dpg"] + }, + "application/vnd.dreamfactory": { + "source": "iana", + "extensions": ["dfac"] + }, + "application/vnd.drive+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ds-keypoint": { + "source": "apache", + "extensions": ["kpxx"] + }, + "application/vnd.dtg.local": { + "source": "iana" + }, + "application/vnd.dtg.local.flash": { + "source": "iana" + }, + "application/vnd.dtg.local.html": { + "source": "iana" + }, + "application/vnd.dvb.ait": { + "source": "iana", + "extensions": ["ait"] + }, + "application/vnd.dvb.dvbisl+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.dvbj": { + "source": "iana" + }, + "application/vnd.dvb.esgcontainer": { + "source": "iana" + }, + "application/vnd.dvb.ipdcdftnotifaccess": { + "source": "iana" + }, + "application/vnd.dvb.ipdcesgaccess": { + "source": "iana" + }, + "application/vnd.dvb.ipdcesgaccess2": { + "source": "iana" + }, + "application/vnd.dvb.ipdcesgpdd": { + "source": "iana" + }, + "application/vnd.dvb.ipdcroaming": { + "source": "iana" + }, + "application/vnd.dvb.iptv.alfec-base": { + "source": "iana" + }, + "application/vnd.dvb.iptv.alfec-enhancement": { + "source": "iana" + }, + "application/vnd.dvb.notif-aggregate-root+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-container+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-generic+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-ia-msglist+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-ia-registration-request+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-ia-registration-response+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.notif-init+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.dvb.pfr": { + "source": "iana" + }, + "application/vnd.dvb.service": { + "source": "iana", + "extensions": ["svc"] + }, + "application/vnd.dxr": { + "source": "iana" + }, + "application/vnd.dynageo": { + "source": "iana", + "extensions": ["geo"] + }, + "application/vnd.dzr": { + "source": "iana" + }, + "application/vnd.easykaraoke.cdgdownload": { + "source": "iana" + }, + "application/vnd.ecdis-update": { + "source": "iana" + }, + "application/vnd.ecip.rlp": { + "source": "iana" + }, + "application/vnd.eclipse.ditto+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ecowin.chart": { + "source": "iana", + "extensions": ["mag"] + }, + "application/vnd.ecowin.filerequest": { + "source": "iana" + }, + "application/vnd.ecowin.fileupdate": { + "source": "iana" + }, + "application/vnd.ecowin.series": { + "source": "iana" + }, + "application/vnd.ecowin.seriesrequest": { + "source": "iana" + }, + "application/vnd.ecowin.seriesupdate": { + "source": "iana" + }, + "application/vnd.efi.img": { + "source": "iana" + }, + "application/vnd.efi.iso": { + "source": "iana" + }, + "application/vnd.eln+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.emclient.accessrequest+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.enliven": { + "source": "iana", + "extensions": ["nml"] + }, + "application/vnd.enphase.envoy": { + "source": "iana" + }, + "application/vnd.eprints.data+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.epson.esf": { + "source": "iana", + "extensions": ["esf"] + }, + "application/vnd.epson.msf": { + "source": "iana", + "extensions": ["msf"] + }, + "application/vnd.epson.quickanime": { + "source": "iana", + "extensions": ["qam"] + }, + "application/vnd.epson.salt": { + "source": "iana", + "extensions": ["slt"] + }, + "application/vnd.epson.ssf": { + "source": "iana", + "extensions": ["ssf"] + }, + "application/vnd.ericsson.quickcall": { + "source": "iana" + }, + "application/vnd.erofs": { + "source": "iana" + }, + "application/vnd.espass-espass+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.eszigno3+xml": { + "source": "iana", + "compressible": true, + "extensions": ["es3","et3"] + }, + "application/vnd.etsi.aoc+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.asic-e+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.etsi.asic-s+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.etsi.cug+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvcommand+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvdiscovery+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvprofile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvsad-bc+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvsad-cod+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvsad-npvr+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvservice+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvsync+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.iptvueprofile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.mcid+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.mheg5": { + "source": "iana" + }, + "application/vnd.etsi.overload-control-policy-dataset+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.pstn+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.sci+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.simservs+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.timestamp-token": { + "source": "iana" + }, + "application/vnd.etsi.tsl+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.etsi.tsl.der": { + "source": "iana" + }, + "application/vnd.eu.kasparian.car+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.eudora.data": { + "source": "iana" + }, + "application/vnd.evolv.ecig.profile": { + "source": "iana" + }, + "application/vnd.evolv.ecig.settings": { + "source": "iana" + }, + "application/vnd.evolv.ecig.theme": { + "source": "iana" + }, + "application/vnd.exstream-empower+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.exstream-package": { + "source": "iana" + }, + "application/vnd.ezpix-album": { + "source": "iana", + "extensions": ["ez2"] + }, + "application/vnd.ezpix-package": { + "source": "iana", + "extensions": ["ez3"] + }, + "application/vnd.f-secure.mobile": { + "source": "iana" + }, + "application/vnd.familysearch.gedcom+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.fastcopy-disk-image": { + "source": "iana" + }, + "application/vnd.fdf": { + "source": "apache", + "extensions": ["fdf"] + }, + "application/vnd.fdsn.mseed": { + "source": "iana", + "extensions": ["mseed"] + }, + "application/vnd.fdsn.seed": { + "source": "iana", + "extensions": ["seed","dataless"] + }, + "application/vnd.fdsn.stationxml+xml": { + "source": "iana", + "charset": "XML-BASED", + "compressible": true + }, + "application/vnd.ffsns": { + "source": "iana" + }, + "application/vnd.ficlab.flb+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.filmit.zfc": { + "source": "iana" + }, + "application/vnd.fints": { + "source": "iana" + }, + "application/vnd.firemonkeys.cloudcell": { + "source": "iana" + }, + "application/vnd.flographit": { + "source": "iana", + "extensions": ["gph"] + }, + "application/vnd.fluxtime.clip": { + "source": "iana", + "extensions": ["ftc"] + }, + "application/vnd.font-fontforge-sfd": { + "source": "iana" + }, + "application/vnd.framemaker": { + "source": "iana", + "extensions": ["fm","frame","maker","book"] + }, + "application/vnd.freelog.comic": { + "source": "iana" + }, + "application/vnd.frogans.fnc": { + "source": "apache", + "extensions": ["fnc"] + }, + "application/vnd.frogans.ltf": { + "source": "apache", + "extensions": ["ltf"] + }, + "application/vnd.fsc.weblaunch": { + "source": "iana", + "extensions": ["fsc"] + }, + "application/vnd.fujifilm.fb.docuworks": { + "source": "iana" + }, + "application/vnd.fujifilm.fb.docuworks.binder": { + "source": "iana" + }, + "application/vnd.fujifilm.fb.docuworks.container": { + "source": "iana" + }, + "application/vnd.fujifilm.fb.jfi+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.fujitsu.oasys": { + "source": "iana", + "extensions": ["oas"] + }, + "application/vnd.fujitsu.oasys2": { + "source": "iana", + "extensions": ["oa2"] + }, + "application/vnd.fujitsu.oasys3": { + "source": "iana", + "extensions": ["oa3"] + }, + "application/vnd.fujitsu.oasysgp": { + "source": "iana", + "extensions": ["fg5"] + }, + "application/vnd.fujitsu.oasysprs": { + "source": "iana", + "extensions": ["bh2"] + }, + "application/vnd.fujixerox.art-ex": { + "source": "iana" + }, + "application/vnd.fujixerox.art4": { + "source": "iana" + }, + "application/vnd.fujixerox.ddd": { + "source": "iana", + "extensions": ["ddd"] + }, + "application/vnd.fujixerox.docuworks": { + "source": "iana", + "extensions": ["xdw"] + }, + "application/vnd.fujixerox.docuworks.binder": { + "source": "iana", + "extensions": ["xbd"] + }, + "application/vnd.fujixerox.docuworks.container": { + "source": "iana" + }, + "application/vnd.fujixerox.hbpl": { + "source": "iana" + }, + "application/vnd.fut-misnet": { + "source": "iana" + }, + "application/vnd.futoin+cbor": { + "source": "iana" + }, + "application/vnd.futoin+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.fuzzysheet": { + "source": "iana", + "extensions": ["fzs"] + }, + "application/vnd.ga4gh.passport+jwt": { + "source": "iana" + }, + "application/vnd.genomatix.tuxedo": { + "source": "iana", + "extensions": ["txd"] + }, + "application/vnd.genozip": { + "source": "iana" + }, + "application/vnd.gentics.grd+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.gentoo.catmetadata+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.gentoo.ebuild": { + "source": "iana" + }, + "application/vnd.gentoo.eclass": { + "source": "iana" + }, + "application/vnd.gentoo.gpkg": { + "source": "iana" + }, + "application/vnd.gentoo.manifest": { + "source": "iana" + }, + "application/vnd.gentoo.pkgmetadata+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.gentoo.xpak": { + "source": "iana" + }, + "application/vnd.geo+json": { + "source": "apache", + "compressible": true + }, + "application/vnd.geocube+xml": { + "source": "apache", + "compressible": true + }, + "application/vnd.geogebra.file": { + "source": "iana", + "extensions": ["ggb"] + }, + "application/vnd.geogebra.pinboard": { + "source": "iana" + }, + "application/vnd.geogebra.slides": { + "source": "iana", + "extensions": ["ggs"] + }, + "application/vnd.geogebra.tool": { + "source": "iana", + "extensions": ["ggt"] + }, + "application/vnd.geometry-explorer": { + "source": "iana", + "extensions": ["gex","gre"] + }, + "application/vnd.geonext": { + "source": "iana", + "extensions": ["gxt"] + }, + "application/vnd.geoplan": { + "source": "iana", + "extensions": ["g2w"] + }, + "application/vnd.geospace": { + "source": "iana", + "extensions": ["g3w"] + }, + "application/vnd.gerber": { + "source": "iana" + }, + "application/vnd.globalplatform.card-content-mgt": { + "source": "iana" + }, + "application/vnd.globalplatform.card-content-mgt-response": { + "source": "iana" + }, + "application/vnd.gmx": { + "source": "iana", + "extensions": ["gmx"] + }, + "application/vnd.gnu.taler.exchange+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.gnu.taler.merchant+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.google-apps.audio": {}, + "application/vnd.google-apps.document": { + "compressible": false, + "extensions": ["gdoc"] + }, + "application/vnd.google-apps.drawing": { + "compressible": false, + "extensions": ["gdraw"] + }, + "application/vnd.google-apps.drive-sdk": { + "compressible": false + }, + "application/vnd.google-apps.file": {}, + "application/vnd.google-apps.folder": { + "compressible": false + }, + "application/vnd.google-apps.form": { + "compressible": false, + "extensions": ["gform"] + }, + "application/vnd.google-apps.fusiontable": {}, + "application/vnd.google-apps.jam": { + "compressible": false, + "extensions": ["gjam"] + }, + "application/vnd.google-apps.mail-layout": {}, + "application/vnd.google-apps.map": { + "compressible": false, + "extensions": ["gmap"] + }, + "application/vnd.google-apps.photo": {}, + "application/vnd.google-apps.presentation": { + "compressible": false, + "extensions": ["gslides"] + }, + "application/vnd.google-apps.script": { + "compressible": false, + "extensions": ["gscript"] + }, + "application/vnd.google-apps.shortcut": {}, + "application/vnd.google-apps.site": { + "compressible": false, + "extensions": ["gsite"] + }, + "application/vnd.google-apps.spreadsheet": { + "compressible": false, + "extensions": ["gsheet"] + }, + "application/vnd.google-apps.unknown": {}, + "application/vnd.google-apps.video": {}, + "application/vnd.google-earth.kml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["kml"] + }, + "application/vnd.google-earth.kmz": { + "source": "iana", + "compressible": false, + "extensions": ["kmz"] + }, + "application/vnd.gov.sk.e-form+xml": { + "source": "apache", + "compressible": true + }, + "application/vnd.gov.sk.e-form+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.gov.sk.xmldatacontainer+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xdcf"] + }, + "application/vnd.gpxsee.map+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.grafeq": { + "source": "iana", + "extensions": ["gqf","gqs"] + }, + "application/vnd.gridmp": { + "source": "iana" + }, + "application/vnd.groove-account": { + "source": "iana", + "extensions": ["gac"] + }, + "application/vnd.groove-help": { + "source": "iana", + "extensions": ["ghf"] + }, + "application/vnd.groove-identity-message": { + "source": "iana", + "extensions": ["gim"] + }, + "application/vnd.groove-injector": { + "source": "iana", + "extensions": ["grv"] + }, + "application/vnd.groove-tool-message": { + "source": "iana", + "extensions": ["gtm"] + }, + "application/vnd.groove-tool-template": { + "source": "iana", + "extensions": ["tpl"] + }, + "application/vnd.groove-vcard": { + "source": "iana", + "extensions": ["vcg"] + }, + "application/vnd.hal+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hal+xml": { + "source": "iana", + "compressible": true, + "extensions": ["hal"] + }, + "application/vnd.handheld-entertainment+xml": { + "source": "iana", + "compressible": true, + "extensions": ["zmm"] + }, + "application/vnd.hbci": { + "source": "iana", + "extensions": ["hbci"] + }, + "application/vnd.hc+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hcl-bireports": { + "source": "iana" + }, + "application/vnd.hdt": { + "source": "iana" + }, + "application/vnd.heroku+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hhe.lesson-player": { + "source": "iana", + "extensions": ["les"] + }, + "application/vnd.hp-hpgl": { + "source": "iana", + "extensions": ["hpgl"] + }, + "application/vnd.hp-hpid": { + "source": "iana", + "extensions": ["hpid"] + }, + "application/vnd.hp-hps": { + "source": "iana", + "extensions": ["hps"] + }, + "application/vnd.hp-jlyt": { + "source": "iana", + "extensions": ["jlt"] + }, + "application/vnd.hp-pcl": { + "source": "iana", + "extensions": ["pcl"] + }, + "application/vnd.hp-pclxl": { + "source": "iana", + "extensions": ["pclxl"] + }, + "application/vnd.hsl": { + "source": "iana" + }, + "application/vnd.httphone": { + "source": "iana" + }, + "application/vnd.hydrostatix.sof-data": { + "source": "iana", + "extensions": ["sfd-hdstx"] + }, + "application/vnd.hyper+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hyper-item+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hyperdrive+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.hzn-3d-crossword": { + "source": "iana" + }, + "application/vnd.ibm.afplinedata": { + "source": "apache" + }, + "application/vnd.ibm.electronic-media": { + "source": "iana" + }, + "application/vnd.ibm.minipay": { + "source": "iana", + "extensions": ["mpy"] + }, + "application/vnd.ibm.modcap": { + "source": "apache", + "extensions": ["afp","listafp","list3820"] + }, + "application/vnd.ibm.rights-management": { + "source": "iana", + "extensions": ["irm"] + }, + "application/vnd.ibm.secure-container": { + "source": "iana", + "extensions": ["sc"] + }, + "application/vnd.iccprofile": { + "source": "iana", + "extensions": ["icc","icm"] + }, + "application/vnd.ieee.1905": { + "source": "iana" + }, + "application/vnd.igloader": { + "source": "iana", + "extensions": ["igl"] + }, + "application/vnd.imagemeter.folder+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.imagemeter.image+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.immervision-ivp": { + "source": "iana", + "extensions": ["ivp"] + }, + "application/vnd.immervision-ivu": { + "source": "iana", + "extensions": ["ivu"] + }, + "application/vnd.ims.imsccv1p1": { + "source": "iana" + }, + "application/vnd.ims.imsccv1p2": { + "source": "iana" + }, + "application/vnd.ims.imsccv1p3": { + "source": "iana" + }, + "application/vnd.ims.lis.v2.result+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolconsumerprofile+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolproxy+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolproxy.id+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolsettings+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.ims.lti.v2.toolsettings.simple+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.informedcontrol.rms+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.informix-visionary": { + "source": "apache" + }, + "application/vnd.infotech.project": { + "source": "iana" + }, + "application/vnd.infotech.project+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.innopath.wamp.notification": { + "source": "iana" + }, + "application/vnd.insors.igm": { + "source": "iana", + "extensions": ["igm"] + }, + "application/vnd.intercon.formnet": { + "source": "iana", + "extensions": ["xpw","xpx"] + }, + "application/vnd.intergeo": { + "source": "iana", + "extensions": ["i2g"] + }, + "application/vnd.intertrust.digibox": { + "source": "iana" + }, + "application/vnd.intertrust.nncp": { + "source": "iana" + }, + "application/vnd.intu.qbo": { + "source": "iana", + "extensions": ["qbo"] + }, + "application/vnd.intu.qfx": { + "source": "iana", + "extensions": ["qfx"] + }, + "application/vnd.ipfs.ipns-record": { + "source": "iana" + }, + "application/vnd.ipld.car": { + "source": "iana" + }, + "application/vnd.ipld.dag-cbor": { + "source": "iana" + }, + "application/vnd.ipld.dag-json": { + "source": "iana" + }, + "application/vnd.ipld.raw": { + "source": "iana" + }, + "application/vnd.iptc.g2.catalogitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.conceptitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.knowledgeitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.newsitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.newsmessage+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.packageitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.iptc.g2.planningitem+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ipunplugged.rcprofile": { + "source": "iana", + "extensions": ["rcprofile"] + }, + "application/vnd.irepository.package+xml": { + "source": "iana", + "compressible": true, + "extensions": ["irp"] + }, + "application/vnd.is-xpr": { + "source": "iana", + "extensions": ["xpr"] + }, + "application/vnd.isac.fcs": { + "source": "iana", + "extensions": ["fcs"] + }, + "application/vnd.iso11783-10+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.jam": { + "source": "iana", + "extensions": ["jam"] + }, + "application/vnd.japannet-directory-service": { + "source": "iana" + }, + "application/vnd.japannet-jpnstore-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-payment-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-registration": { + "source": "iana" + }, + "application/vnd.japannet-registration-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-setstore-wakeup": { + "source": "iana" + }, + "application/vnd.japannet-verification": { + "source": "iana" + }, + "application/vnd.japannet-verification-wakeup": { + "source": "iana" + }, + "application/vnd.jcp.javame.midlet-rms": { + "source": "iana", + "extensions": ["rms"] + }, + "application/vnd.jisp": { + "source": "iana", + "extensions": ["jisp"] + }, + "application/vnd.joost.joda-archive": { + "source": "iana", + "extensions": ["joda"] + }, + "application/vnd.jsk.isdn-ngn": { + "source": "iana" + }, + "application/vnd.kahootz": { + "source": "iana", + "extensions": ["ktz","ktr"] + }, + "application/vnd.kde.karbon": { + "source": "iana", + "extensions": ["karbon"] + }, + "application/vnd.kde.kchart": { + "source": "iana", + "extensions": ["chrt"] + }, + "application/vnd.kde.kformula": { + "source": "iana", + "extensions": ["kfo"] + }, + "application/vnd.kde.kivio": { + "source": "iana", + "extensions": ["flw"] + }, + "application/vnd.kde.kontour": { + "source": "iana", + "extensions": ["kon"] + }, + "application/vnd.kde.kpresenter": { + "source": "iana", + "extensions": ["kpr","kpt"] + }, + "application/vnd.kde.kspread": { + "source": "iana", + "extensions": ["ksp"] + }, + "application/vnd.kde.kword": { + "source": "iana", + "extensions": ["kwd","kwt"] + }, + "application/vnd.kdl": { + "source": "iana" + }, + "application/vnd.kenameaapp": { + "source": "iana", + "extensions": ["htke"] + }, + "application/vnd.keyman.kmp+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.keyman.kmx": { + "source": "iana" + }, + "application/vnd.kidspiration": { + "source": "iana", + "extensions": ["kia"] + }, + "application/vnd.kinar": { + "source": "iana", + "extensions": ["kne","knp"] + }, + "application/vnd.koan": { + "source": "iana", + "extensions": ["skp","skd","skt","skm"] + }, + "application/vnd.kodak-descriptor": { + "source": "iana", + "extensions": ["sse"] + }, + "application/vnd.las": { + "source": "iana" + }, + "application/vnd.las.las+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.las.las+xml": { + "source": "iana", + "compressible": true, + "extensions": ["lasxml"] + }, + "application/vnd.laszip": { + "source": "iana" + }, + "application/vnd.ldev.productlicensing": { + "source": "iana" + }, + "application/vnd.leap+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.liberty-request+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.llamagraphics.life-balance.desktop": { + "source": "iana", + "extensions": ["lbd"] + }, + "application/vnd.llamagraphics.life-balance.exchange+xml": { + "source": "iana", + "compressible": true, + "extensions": ["lbe"] + }, + "application/vnd.logipipe.circuit+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.loom": { + "source": "iana" + }, + "application/vnd.lotus-1-2-3": { + "source": "iana", + "extensions": ["123"] + }, + "application/vnd.lotus-approach": { + "source": "iana", + "extensions": ["apr"] + }, + "application/vnd.lotus-freelance": { + "source": "iana", + "extensions": ["pre"] + }, + "application/vnd.lotus-notes": { + "source": "iana", + "extensions": ["nsf"] + }, + "application/vnd.lotus-organizer": { + "source": "iana", + "extensions": ["org"] + }, + "application/vnd.lotus-screencam": { + "source": "iana", + "extensions": ["scm"] + }, + "application/vnd.lotus-wordpro": { + "source": "iana", + "extensions": ["lwp"] + }, + "application/vnd.macports.portpkg": { + "source": "iana", + "extensions": ["portpkg"] + }, + "application/vnd.mapbox-vector-tile": { + "source": "iana", + "extensions": ["mvt"] + }, + "application/vnd.marlin.drm.actiontoken+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.marlin.drm.conftoken+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.marlin.drm.license+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.marlin.drm.mdcf": { + "source": "iana" + }, + "application/vnd.mason+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.maxar.archive.3tz+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.maxmind.maxmind-db": { + "source": "iana" + }, + "application/vnd.mcd": { + "source": "iana", + "extensions": ["mcd"] + }, + "application/vnd.mdl": { + "source": "iana" + }, + "application/vnd.mdl-mbsdf": { + "source": "iana" + }, + "application/vnd.medcalcdata": { + "source": "iana", + "extensions": ["mc1"] + }, + "application/vnd.mediastation.cdkey": { + "source": "iana", + "extensions": ["cdkey"] + }, + "application/vnd.medicalholodeck.recordxr": { + "source": "iana" + }, + "application/vnd.meridian-slingshot": { + "source": "iana" + }, + "application/vnd.mermaid": { + "source": "iana" + }, + "application/vnd.mfer": { + "source": "iana", + "extensions": ["mwf"] + }, + "application/vnd.mfmp": { + "source": "iana", + "extensions": ["mfm"] + }, + "application/vnd.micro+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.micrografx.flo": { + "source": "iana", + "extensions": ["flo"] + }, + "application/vnd.micrografx.igx": { + "source": "iana", + "extensions": ["igx"] + }, + "application/vnd.microsoft.portable-executable": { + "source": "iana" + }, + "application/vnd.microsoft.windows.thumbnail-cache": { + "source": "iana" + }, + "application/vnd.miele+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.mif": { + "source": "iana", + "extensions": ["mif"] + }, + "application/vnd.minisoft-hp3000-save": { + "source": "iana" + }, + "application/vnd.mitsubishi.misty-guard.trustweb": { + "source": "iana" + }, + "application/vnd.mobius.daf": { + "source": "iana", + "extensions": ["daf"] + }, + "application/vnd.mobius.dis": { + "source": "iana", + "extensions": ["dis"] + }, + "application/vnd.mobius.mbk": { + "source": "iana", + "extensions": ["mbk"] + }, + "application/vnd.mobius.mqy": { + "source": "iana", + "extensions": ["mqy"] + }, + "application/vnd.mobius.msl": { + "source": "iana", + "extensions": ["msl"] + }, + "application/vnd.mobius.plc": { + "source": "iana", + "extensions": ["plc"] + }, + "application/vnd.mobius.txf": { + "source": "iana", + "extensions": ["txf"] + }, + "application/vnd.modl": { + "source": "iana" + }, + "application/vnd.mophun.application": { + "source": "iana", + "extensions": ["mpn"] + }, + "application/vnd.mophun.certificate": { + "source": "iana", + "extensions": ["mpc"] + }, + "application/vnd.motorola.flexsuite": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.adsi": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.fis": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.gotap": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.kmr": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.ttc": { + "source": "iana" + }, + "application/vnd.motorola.flexsuite.wem": { + "source": "iana" + }, + "application/vnd.motorola.iprm": { + "source": "iana" + }, + "application/vnd.mozilla.xul+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xul"] + }, + "application/vnd.ms-3mfdocument": { + "source": "iana" + }, + "application/vnd.ms-artgalry": { + "source": "iana", + "extensions": ["cil"] + }, + "application/vnd.ms-asf": { + "source": "iana" + }, + "application/vnd.ms-cab-compressed": { + "source": "iana", + "extensions": ["cab"] + }, + "application/vnd.ms-color.iccprofile": { + "source": "apache" + }, + "application/vnd.ms-excel": { + "source": "iana", + "compressible": false, + "extensions": ["xls","xlm","xla","xlc","xlt","xlw"] + }, + "application/vnd.ms-excel.addin.macroenabled.12": { + "source": "iana", + "extensions": ["xlam"] + }, + "application/vnd.ms-excel.sheet.binary.macroenabled.12": { + "source": "iana", + "extensions": ["xlsb"] + }, + "application/vnd.ms-excel.sheet.macroenabled.12": { + "source": "iana", + "extensions": ["xlsm"] + }, + "application/vnd.ms-excel.template.macroenabled.12": { + "source": "iana", + "extensions": ["xltm"] + }, + "application/vnd.ms-fontobject": { + "source": "iana", + "compressible": true, + "extensions": ["eot"] + }, + "application/vnd.ms-htmlhelp": { + "source": "iana", + "extensions": ["chm"] + }, + "application/vnd.ms-ims": { + "source": "iana", + "extensions": ["ims"] + }, + "application/vnd.ms-lrm": { + "source": "iana", + "extensions": ["lrm"] + }, + "application/vnd.ms-office.activex+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ms-officetheme": { + "source": "iana", + "extensions": ["thmx"] + }, + "application/vnd.ms-opentype": { + "source": "apache", + "compressible": true + }, + "application/vnd.ms-outlook": { + "compressible": false, + "extensions": ["msg"] + }, + "application/vnd.ms-package.obfuscated-opentype": { + "source": "apache" + }, + "application/vnd.ms-pki.seccat": { + "source": "apache", + "extensions": ["cat"] + }, + "application/vnd.ms-pki.stl": { + "source": "apache", + "extensions": ["stl"] + }, + "application/vnd.ms-playready.initiator+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ms-powerpoint": { + "source": "iana", + "compressible": false, + "extensions": ["ppt","pps","pot"] + }, + "application/vnd.ms-powerpoint.addin.macroenabled.12": { + "source": "iana", + "extensions": ["ppam"] + }, + "application/vnd.ms-powerpoint.presentation.macroenabled.12": { + "source": "iana", + "extensions": ["pptm"] + }, + "application/vnd.ms-powerpoint.slide.macroenabled.12": { + "source": "iana", + "extensions": ["sldm"] + }, + "application/vnd.ms-powerpoint.slideshow.macroenabled.12": { + "source": "iana", + "extensions": ["ppsm"] + }, + "application/vnd.ms-powerpoint.template.macroenabled.12": { + "source": "iana", + "extensions": ["potm"] + }, + "application/vnd.ms-printdevicecapabilities+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ms-printing.printticket+xml": { + "source": "apache", + "compressible": true + }, + "application/vnd.ms-printschematicket+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.ms-project": { + "source": "iana", + "extensions": ["mpp","mpt"] + }, + "application/vnd.ms-tnef": { + "source": "iana" + }, + "application/vnd.ms-visio.viewer": { + "extensions": ["vdx"] + }, + "application/vnd.ms-windows.devicepairing": { + "source": "iana" + }, + "application/vnd.ms-windows.nwprinting.oob": { + "source": "iana" + }, + "application/vnd.ms-windows.printerpairing": { + "source": "iana" + }, + "application/vnd.ms-windows.wsd.oob": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.lic-chlg-req": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.lic-resp": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.meter-chlg-req": { + "source": "iana" + }, + "application/vnd.ms-wmdrm.meter-resp": { + "source": "iana" + }, + "application/vnd.ms-word.document.macroenabled.12": { + "source": "iana", + "extensions": ["docm"] + }, + "application/vnd.ms-word.template.macroenabled.12": { + "source": "iana", + "extensions": ["dotm"] + }, + "application/vnd.ms-works": { + "source": "iana", + "extensions": ["wps","wks","wcm","wdb"] + }, + "application/vnd.ms-wpl": { + "source": "iana", + "extensions": ["wpl"] + }, + "application/vnd.ms-xpsdocument": { + "source": "iana", + "compressible": false, + "extensions": ["xps"] + }, + "application/vnd.msa-disk-image": { + "source": "iana" + }, + "application/vnd.mseq": { + "source": "iana", + "extensions": ["mseq"] + }, + "application/vnd.msgpack": { + "source": "iana" + }, + "application/vnd.msign": { + "source": "iana" + }, + "application/vnd.multiad.creator": { + "source": "iana" + }, + "application/vnd.multiad.creator.cif": { + "source": "iana" + }, + "application/vnd.music-niff": { + "source": "iana" + }, + "application/vnd.musician": { + "source": "iana", + "extensions": ["mus"] + }, + "application/vnd.muvee.style": { + "source": "iana", + "extensions": ["msty"] + }, + "application/vnd.mynfc": { + "source": "iana", + "extensions": ["taglet"] + }, + "application/vnd.nacamar.ybrid+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.nato.bindingdataobject+cbor": { + "source": "iana" + }, + "application/vnd.nato.bindingdataobject+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.nato.bindingdataobject+xml": { + "source": "iana", + "compressible": true, + "extensions": ["bdo"] + }, + "application/vnd.nato.openxmlformats-package.iepd+zip": { + "source": "iana", + "compressible": false + }, + "application/vnd.ncd.control": { + "source": "iana" + }, + "application/vnd.ncd.reference": { + "source": "iana" + }, + "application/vnd.nearst.inv+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.nebumind.line": { + "source": "iana" + }, + "application/vnd.nervana": { + "source": "iana" + }, + "application/vnd.netfpx": { + "source": "iana" + }, + "application/vnd.neurolanguage.nlu": { + "source": "iana", + "extensions": ["nlu"] + }, + "application/vnd.nimn": { + "source": "iana" + }, + "application/vnd.nintendo.nitro.rom": { + "source": "iana" + }, + "application/vnd.nintendo.snes.rom": { + "source": "iana" + }, + "application/vnd.nitf": { + "source": "iana", + "extensions": ["ntf","nitf"] + }, + "application/vnd.noblenet-directory": { + "source": "iana", + "extensions": ["nnd"] + }, + "application/vnd.noblenet-sealer": { + "source": "iana", + "extensions": ["nns"] + }, + "application/vnd.noblenet-web": { + "source": "iana", + "extensions": ["nnw"] + }, + "application/vnd.nokia.catalogs": { + "source": "iana" + }, + "application/vnd.nokia.conml+wbxml": { + "source": "iana" + }, + "application/vnd.nokia.conml+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.iptv.config+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.isds-radio-presets": { + "source": "iana" + }, + "application/vnd.nokia.landmark+wbxml": { + "source": "iana" + }, + "application/vnd.nokia.landmark+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.landmarkcollection+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.n-gage.ac+xml": { + "source": "iana", + "compressible": true, + "extensions": ["ac"] + }, + "application/vnd.nokia.n-gage.data": { + "source": "iana", + "extensions": ["ngdat"] + }, + "application/vnd.nokia.n-gage.symbian.install": { + "source": "apache", + "extensions": ["n-gage"] + }, + "application/vnd.nokia.ncd": { + "source": "iana" + }, + "application/vnd.nokia.pcd+wbxml": { + "source": "iana" + }, + "application/vnd.nokia.pcd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.nokia.radio-preset": { + "source": "iana", + "extensions": ["rpst"] + }, + "application/vnd.nokia.radio-presets": { + "source": "iana", + "extensions": ["rpss"] + }, + "application/vnd.novadigm.edm": { + "source": "iana", + "extensions": ["edm"] + }, + "application/vnd.novadigm.edx": { + "source": "iana", + "extensions": ["edx"] + }, + "application/vnd.novadigm.ext": { + "source": "iana", + "extensions": ["ext"] + }, + "application/vnd.ntt-local.content-share": { + "source": "iana" + }, + "application/vnd.ntt-local.file-transfer": { + "source": "iana" + }, + "application/vnd.ntt-local.ogw_remote-access": { + "source": "iana" + }, + "application/vnd.ntt-local.sip-ta_remote": { + "source": "iana" + }, + "application/vnd.ntt-local.sip-ta_tcp_stream": { + "source": "iana" + }, + "application/vnd.oai.workflows": { + "source": "iana" + }, + "application/vnd.oai.workflows+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.oai.workflows+yaml": { + "source": "iana" + }, + "application/vnd.oasis.opendocument.base": { + "source": "iana" + }, + "application/vnd.oasis.opendocument.chart": { + "source": "iana", + "extensions": ["odc"] + }, + "application/vnd.oasis.opendocument.chart-template": { + "source": "iana", + "extensions": ["otc"] + }, + "application/vnd.oasis.opendocument.database": { + "source": "apache", + "extensions": ["odb"] + }, + "application/vnd.oasis.opendocument.formula": { + "source": "iana", + "extensions": ["odf"] + }, + "application/vnd.oasis.opendocument.formula-template": { + "source": "iana", + "extensions": ["odft"] + }, + "application/vnd.oasis.opendocument.graphics": { + "source": "iana", + "compressible": false, + "extensions": ["odg"] + }, + "application/vnd.oasis.opendocument.graphics-template": { + "source": "iana", + "extensions": ["otg"] + }, + "application/vnd.oasis.opendocument.image": { + "source": "iana", + "extensions": ["odi"] + }, + "application/vnd.oasis.opendocument.image-template": { + "source": "iana", + "extensions": ["oti"] + }, + "application/vnd.oasis.opendocument.presentation": { + "source": "iana", + "compressible": false, + "extensions": ["odp"] + }, + "application/vnd.oasis.opendocument.presentation-template": { + "source": "iana", + "extensions": ["otp"] + }, + "application/vnd.oasis.opendocument.spreadsheet": { + "source": "iana", + "compressible": false, + "extensions": ["ods"] + }, + "application/vnd.oasis.opendocument.spreadsheet-template": { + "source": "iana", + "extensions": ["ots"] + }, + "application/vnd.oasis.opendocument.text": { + "source": "iana", + "compressible": false, + "extensions": ["odt"] + }, + "application/vnd.oasis.opendocument.text-master": { + "source": "iana", + "extensions": ["odm"] + }, + "application/vnd.oasis.opendocument.text-master-template": { + "source": "iana" + }, + "application/vnd.oasis.opendocument.text-template": { + "source": "iana", + "extensions": ["ott"] + }, + "application/vnd.oasis.opendocument.text-web": { + "source": "iana", + "extensions": ["oth"] + }, + "application/vnd.obn": { + "source": "iana" + }, + "application/vnd.ocf+cbor": { + "source": "iana" + }, + "application/vnd.oci.image.manifest.v1+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.oftn.l10n+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.contentaccessdownload+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.contentaccessstreaming+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.cspg-hexbinary": { + "source": "iana" + }, + "application/vnd.oipf.dae.svg+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.dae.xhtml+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.mippvcontrolmessage+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.pae.gem": { + "source": "iana" + }, + "application/vnd.oipf.spdiscovery+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.spdlist+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.ueprofile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oipf.userprofile+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.olpc-sugar": { + "source": "iana", + "extensions": ["xo"] + }, + "application/vnd.oma-scws-config": { + "source": "iana" + }, + "application/vnd.oma-scws-http-request": { + "source": "iana" + }, + "application/vnd.oma-scws-http-response": { + "source": "iana" + }, + "application/vnd.oma.bcast.associated-procedure-parameter+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.drm-trigger+xml": { + "source": "apache", + "compressible": true + }, + "application/vnd.oma.bcast.imd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.ltkm": { + "source": "iana" + }, + "application/vnd.oma.bcast.notification+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.provisioningtrigger": { + "source": "iana" + }, + "application/vnd.oma.bcast.sgboot": { + "source": "iana" + }, + "application/vnd.oma.bcast.sgdd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.sgdu": { + "source": "iana" + }, + "application/vnd.oma.bcast.simple-symbol-container": { + "source": "iana" + }, + "application/vnd.oma.bcast.smartcard-trigger+xml": { + "source": "apache", + "compressible": true + }, + "application/vnd.oma.bcast.sprov+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.bcast.stkm": { + "source": "iana" + }, + "application/vnd.oma.cab-address-book+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.cab-feature-handler+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.cab-pcc+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.cab-subs-invite+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.cab-user-prefs+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.dcd": { + "source": "iana" + }, + "application/vnd.oma.dcdc": { + "source": "iana" + }, + "application/vnd.oma.dd2+xml": { + "source": "iana", + "compressible": true, + "extensions": ["dd2"] + }, + "application/vnd.oma.drm.risd+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.group-usage-list+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.lwm2m+cbor": { + "source": "iana" + }, + "application/vnd.oma.lwm2m+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.lwm2m+tlv": { + "source": "iana" + }, + "application/vnd.oma.pal+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.detailed-progress-report+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.final-report+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.groups+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.invocation-descriptor+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.poc.optimized-progress-report+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.push": { + "source": "iana" + }, + "application/vnd.oma.scidm.messages+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oma.xcap-directory+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.omads-email+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.omads-file+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.omads-folder+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.omaloc-supl-init": { + "source": "iana" + }, + "application/vnd.onepager": { + "source": "iana" + }, + "application/vnd.onepagertamp": { + "source": "iana" + }, + "application/vnd.onepagertamx": { + "source": "iana" + }, + "application/vnd.onepagertat": { + "source": "iana" + }, + "application/vnd.onepagertatp": { + "source": "iana" + }, + "application/vnd.onepagertatx": { + "source": "iana" + }, + "application/vnd.onvif.metadata": { + "source": "iana" + }, + "application/vnd.openblox.game+xml": { + "source": "iana", + "compressible": true, + "extensions": ["obgx"] + }, + "application/vnd.openblox.game-binary": { + "source": "iana" + }, + "application/vnd.openeye.oeb": { + "source": "iana" + }, + "application/vnd.openofficeorg.extension": { + "source": "apache", + "extensions": ["oxt"] + }, + "application/vnd.openstreetmap.data+xml": { + "source": "iana", + "compressible": true, + "extensions": ["osm"] + }, + "application/vnd.opentimestamps.ots": { + "source": "iana" + }, + "application/vnd.openvpi.dspx+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.custom-properties+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.customxmlproperties+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawing+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.extended-properties+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.comments+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.presentation": { + "source": "iana", + "compressible": false, + "extensions": ["pptx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.presprops+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slide": { + "source": "iana", + "extensions": ["sldx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.slide+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideshow": { + "source": "iana", + "extensions": ["ppsx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.tags+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.template": { + "source": "iana", + "extensions": ["potx"] + }, + "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": { + "source": "iana", + "compressible": false, + "extensions": ["xlsx"] + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.template": { + "source": "iana", + "extensions": ["xltx"] + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.theme+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.themeoverride+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.vmldrawing": { + "source": "iana" + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { + "source": "iana", + "compressible": false, + "extensions": ["docx"] + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.template": { + "source": "iana", + "extensions": ["dotx"] + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-package.core-properties+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.openxmlformats-package.relationships+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oracle.resource+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.orange.indata": { + "source": "iana" + }, + "application/vnd.osa.netdeploy": { + "source": "iana" + }, + "application/vnd.osgeo.mapguide.package": { + "source": "iana", + "extensions": ["mgp"] + }, + "application/vnd.osgi.bundle": { + "source": "iana" + }, + "application/vnd.osgi.dp": { + "source": "iana", + "extensions": ["dp"] + }, + "application/vnd.osgi.subsystem": { + "source": "iana", + "extensions": ["esa"] + }, + "application/vnd.otps.ct-kip+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.oxli.countgraph": { + "source": "iana" + }, + "application/vnd.pagerduty+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.palm": { + "source": "iana", + "extensions": ["pdb","pqa","oprc"] + }, + "application/vnd.panoply": { + "source": "iana" + }, + "application/vnd.paos.xml": { + "source": "iana" + }, + "application/vnd.patentdive": { + "source": "iana" + }, + "application/vnd.patientecommsdoc": { + "source": "iana" + }, + "application/vnd.pawaafile": { + "source": "iana", + "extensions": ["paw"] + }, + "application/vnd.pcos": { + "source": "iana" + }, + "application/vnd.pg.format": { + "source": "iana", + "extensions": ["str"] + }, + "application/vnd.pg.osasli": { + "source": "iana", + "extensions": ["ei6"] + }, + "application/vnd.piaccess.application-licence": { + "source": "iana" + }, + "application/vnd.picsel": { + "source": "iana", + "extensions": ["efif"] + }, + "application/vnd.pmi.widget": { + "source": "iana", + "extensions": ["wg"] + }, + "application/vnd.poc.group-advertisement+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.pocketlearn": { + "source": "iana", + "extensions": ["plf"] + }, + "application/vnd.powerbuilder6": { + "source": "iana", + "extensions": ["pbd"] + }, + "application/vnd.powerbuilder6-s": { + "source": "iana" + }, + "application/vnd.powerbuilder7": { + "source": "iana" + }, + "application/vnd.powerbuilder7-s": { + "source": "iana" + }, + "application/vnd.powerbuilder75": { + "source": "iana" + }, + "application/vnd.powerbuilder75-s": { + "source": "iana" + }, + "application/vnd.preminet": { + "source": "iana" + }, + "application/vnd.previewsystems.box": { + "source": "iana", + "extensions": ["box"] + }, + "application/vnd.procrate.brushset": { + "extensions": ["brushset"] + }, + "application/vnd.procreate.brush": { + "extensions": ["brush"] + }, + "application/vnd.procreate.dream": { + "extensions": ["drm"] + }, + "application/vnd.proteus.magazine": { + "source": "iana", + "extensions": ["mgz"] + }, + "application/vnd.psfs": { + "source": "iana" + }, + "application/vnd.pt.mundusmundi": { + "source": "iana" + }, + "application/vnd.publishare-delta-tree": { + "source": "iana", + "extensions": ["qps"] + }, + "application/vnd.pvi.ptid1": { + "source": "iana", + "extensions": ["ptid"] + }, + "application/vnd.pwg-multiplexed": { + "source": "iana" + }, + "application/vnd.pwg-xhtml-print+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xhtm"] + }, + "application/vnd.qualcomm.brew-app-res": { + "source": "iana" + }, + "application/vnd.quarantainenet": { + "source": "iana" + }, + "application/vnd.quark.quarkxpress": { + "source": "iana", + "extensions": ["qxd","qxt","qwd","qwt","qxl","qxb"] + }, + "application/vnd.quobject-quoxdocument": { + "source": "iana" + }, + "application/vnd.radisys.moml+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit-conf+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit-conn+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit-dialog+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-audit-stream+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-conf+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-base+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-fax-detect+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-fax-sendrecv+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-group+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-speech+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.radisys.msml-dialog-transform+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.rainstor.data": { + "source": "iana" + }, + "application/vnd.rapid": { + "source": "iana" + }, + "application/vnd.rar": { + "source": "iana", + "extensions": ["rar"] + }, + "application/vnd.realvnc.bed": { + "source": "iana", + "extensions": ["bed"] + }, + "application/vnd.recordare.musicxml": { + "source": "iana", + "extensions": ["mxl"] + }, + "application/vnd.recordare.musicxml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["musicxml"] + }, + "application/vnd.relpipe": { + "source": "iana" + }, + "application/vnd.renlearn.rlprint": { + "source": "iana" + }, + "application/vnd.resilient.logic": { + "source": "iana" + }, + "application/vnd.restful+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.rig.cryptonote": { + "source": "iana", + "extensions": ["cryptonote"] + }, + "application/vnd.rim.cod": { + "source": "apache", + "extensions": ["cod"] + }, + "application/vnd.rn-realmedia": { + "source": "apache", + "extensions": ["rm"] + }, + "application/vnd.rn-realmedia-vbr": { + "source": "apache", + "extensions": ["rmvb"] + }, + "application/vnd.route66.link66+xml": { + "source": "iana", + "compressible": true, + "extensions": ["link66"] + }, + "application/vnd.rs-274x": { + "source": "iana" + }, + "application/vnd.ruckus.download": { + "source": "iana" + }, + "application/vnd.s3sms": { + "source": "iana" + }, + "application/vnd.sailingtracker.track": { + "source": "iana", + "extensions": ["st"] + }, + "application/vnd.sar": { + "source": "iana" + }, + "application/vnd.sbm.cid": { + "source": "iana" + }, + "application/vnd.sbm.mid2": { + "source": "iana" + }, + "application/vnd.scribus": { + "source": "iana" + }, + "application/vnd.sealed.3df": { + "source": "iana" + }, + "application/vnd.sealed.csf": { + "source": "iana" + }, + "application/vnd.sealed.doc": { + "source": "iana" + }, + "application/vnd.sealed.eml": { + "source": "iana" + }, + "application/vnd.sealed.mht": { + "source": "iana" + }, + "application/vnd.sealed.net": { + "source": "iana" + }, + "application/vnd.sealed.ppt": { + "source": "iana" + }, + "application/vnd.sealed.tiff": { + "source": "iana" + }, + "application/vnd.sealed.xls": { + "source": "iana" + }, + "application/vnd.sealedmedia.softseal.html": { + "source": "iana" + }, + "application/vnd.sealedmedia.softseal.pdf": { + "source": "iana" + }, + "application/vnd.seemail": { + "source": "iana", + "extensions": ["see"] + }, + "application/vnd.seis+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.sema": { + "source": "iana", + "extensions": ["sema"] + }, + "application/vnd.semd": { + "source": "iana", + "extensions": ["semd"] + }, + "application/vnd.semf": { + "source": "iana", + "extensions": ["semf"] + }, + "application/vnd.shade-save-file": { + "source": "iana" + }, + "application/vnd.shana.informed.formdata": { + "source": "iana", + "extensions": ["ifm"] + }, + "application/vnd.shana.informed.formtemplate": { + "source": "iana", + "extensions": ["itp"] + }, + "application/vnd.shana.informed.interchange": { + "source": "iana", + "extensions": ["iif"] + }, + "application/vnd.shana.informed.package": { + "source": "iana", + "extensions": ["ipk"] + }, + "application/vnd.shootproof+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.shopkick+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.shp": { + "source": "iana" + }, + "application/vnd.shx": { + "source": "iana" + }, + "application/vnd.sigrok.session": { + "source": "iana" + }, + "application/vnd.simtech-mindmapper": { + "source": "iana", + "extensions": ["twd","twds"] + }, + "application/vnd.siren+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.sketchometry": { + "source": "iana" + }, + "application/vnd.smaf": { + "source": "iana", + "extensions": ["mmf"] + }, + "application/vnd.smart.notebook": { + "source": "iana" + }, + "application/vnd.smart.teacher": { + "source": "iana", + "extensions": ["teacher"] + }, + "application/vnd.smintio.portals.archive": { + "source": "iana" + }, + "application/vnd.snesdev-page-table": { + "source": "iana" + }, + "application/vnd.software602.filler.form+xml": { + "source": "iana", + "compressible": true, + "extensions": ["fo"] + }, + "application/vnd.software602.filler.form-xml-zip": { + "source": "iana" + }, + "application/vnd.solent.sdkm+xml": { + "source": "iana", + "compressible": true, + "extensions": ["sdkm","sdkd"] + }, + "application/vnd.spotfire.dxp": { + "source": "iana", + "extensions": ["dxp"] + }, + "application/vnd.spotfire.sfs": { + "source": "iana", + "extensions": ["sfs"] + }, + "application/vnd.sqlite3": { + "source": "iana" + }, + "application/vnd.sss-cod": { + "source": "iana" + }, + "application/vnd.sss-dtf": { + "source": "iana" + }, + "application/vnd.sss-ntf": { + "source": "iana" + }, + "application/vnd.stardivision.calc": { + "source": "apache", + "extensions": ["sdc"] + }, + "application/vnd.stardivision.draw": { + "source": "apache", + "extensions": ["sda"] + }, + "application/vnd.stardivision.impress": { + "source": "apache", + "extensions": ["sdd"] + }, + "application/vnd.stardivision.math": { + "source": "apache", + "extensions": ["smf"] + }, + "application/vnd.stardivision.writer": { + "source": "apache", + "extensions": ["sdw","vor"] + }, + "application/vnd.stardivision.writer-global": { + "source": "apache", + "extensions": ["sgl"] + }, + "application/vnd.stepmania.package": { + "source": "iana", + "extensions": ["smzip"] + }, + "application/vnd.stepmania.stepchart": { + "source": "iana", + "extensions": ["sm"] + }, + "application/vnd.street-stream": { + "source": "iana" + }, + "application/vnd.sun.wadl+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wadl"] + }, + "application/vnd.sun.xml.calc": { + "source": "apache", + "extensions": ["sxc"] + }, + "application/vnd.sun.xml.calc.template": { + "source": "apache", + "extensions": ["stc"] + }, + "application/vnd.sun.xml.draw": { + "source": "apache", + "extensions": ["sxd"] + }, + "application/vnd.sun.xml.draw.template": { + "source": "apache", + "extensions": ["std"] + }, + "application/vnd.sun.xml.impress": { + "source": "apache", + "extensions": ["sxi"] + }, + "application/vnd.sun.xml.impress.template": { + "source": "apache", + "extensions": ["sti"] + }, + "application/vnd.sun.xml.math": { + "source": "apache", + "extensions": ["sxm"] + }, + "application/vnd.sun.xml.writer": { + "source": "apache", + "extensions": ["sxw"] + }, + "application/vnd.sun.xml.writer.global": { + "source": "apache", + "extensions": ["sxg"] + }, + "application/vnd.sun.xml.writer.template": { + "source": "apache", + "extensions": ["stw"] + }, + "application/vnd.sus-calendar": { + "source": "iana", + "extensions": ["sus","susp"] + }, + "application/vnd.svd": { + "source": "iana", + "extensions": ["svd"] + }, + "application/vnd.swiftview-ics": { + "source": "iana" + }, + "application/vnd.sybyl.mol2": { + "source": "iana" + }, + "application/vnd.sycle+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.syft+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.symbian.install": { + "source": "apache", + "extensions": ["sis","sisx"] + }, + "application/vnd.syncml+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["xsm"] + }, + "application/vnd.syncml.dm+wbxml": { + "source": "iana", + "charset": "UTF-8", + "extensions": ["bdm"] + }, + "application/vnd.syncml.dm+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["xdm"] + }, + "application/vnd.syncml.dm.notification": { + "source": "iana" + }, + "application/vnd.syncml.dmddf+wbxml": { + "source": "iana" + }, + "application/vnd.syncml.dmddf+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["ddf"] + }, + "application/vnd.syncml.dmtnds+wbxml": { + "source": "iana" + }, + "application/vnd.syncml.dmtnds+xml": { + "source": "iana", + "charset": "UTF-8", + "compressible": true + }, + "application/vnd.syncml.ds.notification": { + "source": "iana" + }, + "application/vnd.tableschema+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.tao.intent-module-archive": { + "source": "iana", + "extensions": ["tao"] + }, + "application/vnd.tcpdump.pcap": { + "source": "iana", + "extensions": ["pcap","cap","dmp"] + }, + "application/vnd.think-cell.ppttc+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.tmd.mediaflex.api+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.tml": { + "source": "iana" + }, + "application/vnd.tmobile-livetv": { + "source": "iana", + "extensions": ["tmo"] + }, + "application/vnd.tri.onesource": { + "source": "iana" + }, + "application/vnd.trid.tpt": { + "source": "iana", + "extensions": ["tpt"] + }, + "application/vnd.triscape.mxs": { + "source": "iana", + "extensions": ["mxs"] + }, + "application/vnd.trueapp": { + "source": "iana", + "extensions": ["tra"] + }, + "application/vnd.truedoc": { + "source": "iana" + }, + "application/vnd.ubisoft.webplayer": { + "source": "iana" + }, + "application/vnd.ufdl": { + "source": "iana", + "extensions": ["ufd","ufdl"] + }, + "application/vnd.uic.osdm+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.uiq.theme": { + "source": "iana", + "extensions": ["utz"] + }, + "application/vnd.umajin": { + "source": "iana", + "extensions": ["umj"] + }, + "application/vnd.unity": { + "source": "iana", + "extensions": ["unityweb"] + }, + "application/vnd.uoml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["uoml","uo"] + }, + "application/vnd.uplanet.alert": { + "source": "iana" + }, + "application/vnd.uplanet.alert-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.bearer-choice": { + "source": "iana" + }, + "application/vnd.uplanet.bearer-choice-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.cacheop": { + "source": "iana" + }, + "application/vnd.uplanet.cacheop-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.channel": { + "source": "iana" + }, + "application/vnd.uplanet.channel-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.list": { + "source": "iana" + }, + "application/vnd.uplanet.list-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.listcmd": { + "source": "iana" + }, + "application/vnd.uplanet.listcmd-wbxml": { + "source": "iana" + }, + "application/vnd.uplanet.signal": { + "source": "iana" + }, + "application/vnd.uri-map": { + "source": "iana" + }, + "application/vnd.valve.source.material": { + "source": "iana" + }, + "application/vnd.vcx": { + "source": "iana", + "extensions": ["vcx"] + }, + "application/vnd.vd-study": { + "source": "iana" + }, + "application/vnd.vectorworks": { + "source": "iana" + }, + "application/vnd.vel+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.veraison.tsm-report+cbor": { + "source": "iana" + }, + "application/vnd.veraison.tsm-report+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.verimatrix.vcas": { + "source": "iana" + }, + "application/vnd.veritone.aion+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.veryant.thin": { + "source": "iana" + }, + "application/vnd.ves.encrypted": { + "source": "iana" + }, + "application/vnd.vidsoft.vidconference": { + "source": "iana" + }, + "application/vnd.visio": { + "source": "iana", + "extensions": ["vsd","vst","vss","vsw","vsdx","vtx"] + }, + "application/vnd.visionary": { + "source": "iana", + "extensions": ["vis"] + }, + "application/vnd.vividence.scriptfile": { + "source": "iana" + }, + "application/vnd.vocalshaper.vsp4": { + "source": "iana" + }, + "application/vnd.vsf": { + "source": "iana", + "extensions": ["vsf"] + }, + "application/vnd.wap.sic": { + "source": "iana" + }, + "application/vnd.wap.slc": { + "source": "iana" + }, + "application/vnd.wap.wbxml": { + "source": "iana", + "charset": "UTF-8", + "extensions": ["wbxml"] + }, + "application/vnd.wap.wmlc": { + "source": "iana", + "extensions": ["wmlc"] + }, + "application/vnd.wap.wmlscriptc": { + "source": "iana", + "extensions": ["wmlsc"] + }, + "application/vnd.wasmflow.wafl": { + "source": "iana" + }, + "application/vnd.webturbo": { + "source": "iana", + "extensions": ["wtb"] + }, + "application/vnd.wfa.dpp": { + "source": "iana" + }, + "application/vnd.wfa.p2p": { + "source": "iana" + }, + "application/vnd.wfa.wsc": { + "source": "iana" + }, + "application/vnd.windows.devicepairing": { + "source": "iana" + }, + "application/vnd.wmc": { + "source": "iana" + }, + "application/vnd.wmf.bootstrap": { + "source": "iana" + }, + "application/vnd.wolfram.mathematica": { + "source": "iana" + }, + "application/vnd.wolfram.mathematica.package": { + "source": "iana" + }, + "application/vnd.wolfram.player": { + "source": "iana", + "extensions": ["nbp"] + }, + "application/vnd.wordlift": { + "source": "iana" + }, + "application/vnd.wordperfect": { + "source": "iana", + "extensions": ["wpd"] + }, + "application/vnd.wqd": { + "source": "iana", + "extensions": ["wqd"] + }, + "application/vnd.wrq-hp3000-labelled": { + "source": "iana" + }, + "application/vnd.wt.stf": { + "source": "iana", + "extensions": ["stf"] + }, + "application/vnd.wv.csp+wbxml": { + "source": "iana" + }, + "application/vnd.wv.csp+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.wv.ssp+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.xacml+json": { + "source": "iana", + "compressible": true + }, + "application/vnd.xara": { + "source": "iana", + "extensions": ["xar"] + }, + "application/vnd.xarin.cpj": { + "source": "iana" + }, + "application/vnd.xecrets-encrypted": { + "source": "iana" + }, + "application/vnd.xfdl": { + "source": "iana", + "extensions": ["xfdl"] + }, + "application/vnd.xfdl.webform": { + "source": "iana" + }, + "application/vnd.xmi+xml": { + "source": "iana", + "compressible": true + }, + "application/vnd.xmpie.cpkg": { + "source": "iana" + }, + "application/vnd.xmpie.dpkg": { + "source": "iana" + }, + "application/vnd.xmpie.plan": { + "source": "iana" + }, + "application/vnd.xmpie.ppkg": { + "source": "iana" + }, + "application/vnd.xmpie.xlim": { + "source": "iana" + }, + "application/vnd.yamaha.hv-dic": { + "source": "iana", + "extensions": ["hvd"] + }, + "application/vnd.yamaha.hv-script": { + "source": "iana", + "extensions": ["hvs"] + }, + "application/vnd.yamaha.hv-voice": { + "source": "iana", + "extensions": ["hvp"] + }, + "application/vnd.yamaha.openscoreformat": { + "source": "iana", + "extensions": ["osf"] + }, + "application/vnd.yamaha.openscoreformat.osfpvg+xml": { + "source": "iana", + "compressible": true, + "extensions": ["osfpvg"] + }, + "application/vnd.yamaha.remote-setup": { + "source": "iana" + }, + "application/vnd.yamaha.smaf-audio": { + "source": "iana", + "extensions": ["saf"] + }, + "application/vnd.yamaha.smaf-phrase": { + "source": "iana", + "extensions": ["spf"] + }, + "application/vnd.yamaha.through-ngn": { + "source": "iana" + }, + "application/vnd.yamaha.tunnel-udpencap": { + "source": "iana" + }, + "application/vnd.yaoweme": { + "source": "iana" + }, + "application/vnd.yellowriver-custom-menu": { + "source": "iana", + "extensions": ["cmp"] + }, + "application/vnd.zul": { + "source": "iana", + "extensions": ["zir","zirz"] + }, + "application/vnd.zzazz.deck+xml": { + "source": "iana", + "compressible": true, + "extensions": ["zaz"] + }, + "application/voicexml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["vxml"] + }, + "application/voucher-cms+json": { + "source": "iana", + "compressible": true + }, + "application/voucher-jws+json": { + "source": "iana", + "compressible": true + }, + "application/vp": { + "source": "iana" + }, + "application/vp+cose": { + "source": "iana" + }, + "application/vp+jwt": { + "source": "iana" + }, + "application/vq-rtcpxr": { + "source": "iana" + }, + "application/wasm": { + "source": "iana", + "compressible": true, + "extensions": ["wasm"] + }, + "application/watcherinfo+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wif"] + }, + "application/webpush-options+json": { + "source": "iana", + "compressible": true + }, + "application/whoispp-query": { + "source": "iana" + }, + "application/whoispp-response": { + "source": "iana" + }, + "application/widget": { + "source": "iana", + "extensions": ["wgt"] + }, + "application/winhlp": { + "source": "apache", + "extensions": ["hlp"] + }, + "application/wita": { + "source": "iana" + }, + "application/wordperfect5.1": { + "source": "iana" + }, + "application/wsdl+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wsdl"] + }, + "application/wspolicy+xml": { + "source": "iana", + "compressible": true, + "extensions": ["wspolicy"] + }, + "application/x-7z-compressed": { + "source": "apache", + "compressible": false, + "extensions": ["7z"] + }, + "application/x-abiword": { + "source": "apache", + "extensions": ["abw"] + }, + "application/x-ace-compressed": { + "source": "apache", + "extensions": ["ace"] + }, + "application/x-amf": { + "source": "apache" + }, + "application/x-apple-diskimage": { + "source": "apache", + "extensions": ["dmg"] + }, + "application/x-arj": { + "compressible": false, + "extensions": ["arj"] + }, + "application/x-authorware-bin": { + "source": "apache", + "extensions": ["aab","x32","u32","vox"] + }, + "application/x-authorware-map": { + "source": "apache", + "extensions": ["aam"] + }, + "application/x-authorware-seg": { + "source": "apache", + "extensions": ["aas"] + }, + "application/x-bcpio": { + "source": "apache", + "extensions": ["bcpio"] + }, + "application/x-bdoc": { + "compressible": false, + "extensions": ["bdoc"] + }, + "application/x-bittorrent": { + "source": "apache", + "extensions": ["torrent"] + }, + "application/x-blender": { + "extensions": ["blend"] + }, + "application/x-blorb": { + "source": "apache", + "extensions": ["blb","blorb"] + }, + "application/x-bzip": { + "source": "apache", + "compressible": false, + "extensions": ["bz"] + }, + "application/x-bzip2": { + "source": "apache", + "compressible": false, + "extensions": ["bz2","boz"] + }, + "application/x-cbr": { + "source": "apache", + "extensions": ["cbr","cba","cbt","cbz","cb7"] + }, + "application/x-cdlink": { + "source": "apache", + "extensions": ["vcd"] + }, + "application/x-cfs-compressed": { + "source": "apache", + "extensions": ["cfs"] + }, + "application/x-chat": { + "source": "apache", + "extensions": ["chat"] + }, + "application/x-chess-pgn": { + "source": "apache", + "extensions": ["pgn"] + }, + "application/x-chrome-extension": { + "extensions": ["crx"] + }, + "application/x-cocoa": { + "source": "nginx", + "extensions": ["cco"] + }, + "application/x-compress": { + "source": "apache" + }, + "application/x-compressed": { + "extensions": ["rar"] + }, + "application/x-conference": { + "source": "apache", + "extensions": ["nsc"] + }, + "application/x-cpio": { + "source": "apache", + "extensions": ["cpio"] + }, + "application/x-csh": { + "source": "apache", + "extensions": ["csh"] + }, + "application/x-deb": { + "compressible": false + }, + "application/x-debian-package": { + "source": "apache", + "extensions": ["deb","udeb"] + }, + "application/x-dgc-compressed": { + "source": "apache", + "extensions": ["dgc"] + }, + "application/x-director": { + "source": "apache", + "extensions": ["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"] + }, + "application/x-doom": { + "source": "apache", + "extensions": ["wad"] + }, + "application/x-dtbncx+xml": { + "source": "apache", + "compressible": true, + "extensions": ["ncx"] + }, + "application/x-dtbook+xml": { + "source": "apache", + "compressible": true, + "extensions": ["dtb"] + }, + "application/x-dtbresource+xml": { + "source": "apache", + "compressible": true, + "extensions": ["res"] + }, + "application/x-dvi": { + "source": "apache", + "compressible": false, + "extensions": ["dvi"] + }, + "application/x-envoy": { + "source": "apache", + "extensions": ["evy"] + }, + "application/x-eva": { + "source": "apache", + "extensions": ["eva"] + }, + "application/x-font-bdf": { + "source": "apache", + "extensions": ["bdf"] + }, + "application/x-font-dos": { + "source": "apache" + }, + "application/x-font-framemaker": { + "source": "apache" + }, + "application/x-font-ghostscript": { + "source": "apache", + "extensions": ["gsf"] + }, + "application/x-font-libgrx": { + "source": "apache" + }, + "application/x-font-linux-psf": { + "source": "apache", + "extensions": ["psf"] + }, + "application/x-font-pcf": { + "source": "apache", + "extensions": ["pcf"] + }, + "application/x-font-snf": { + "source": "apache", + "extensions": ["snf"] + }, + "application/x-font-speedo": { + "source": "apache" + }, + "application/x-font-sunos-news": { + "source": "apache" + }, + "application/x-font-type1": { + "source": "apache", + "extensions": ["pfa","pfb","pfm","afm"] + }, + "application/x-font-vfont": { + "source": "apache" + }, + "application/x-freearc": { + "source": "apache", + "extensions": ["arc"] + }, + "application/x-futuresplash": { + "source": "apache", + "extensions": ["spl"] + }, + "application/x-gca-compressed": { + "source": "apache", + "extensions": ["gca"] + }, + "application/x-glulx": { + "source": "apache", + "extensions": ["ulx"] + }, + "application/x-gnumeric": { + "source": "apache", + "extensions": ["gnumeric"] + }, + "application/x-gramps-xml": { + "source": "apache", + "extensions": ["gramps"] + }, + "application/x-gtar": { + "source": "apache", + "extensions": ["gtar"] + }, + "application/x-gzip": { + "source": "apache" + }, + "application/x-hdf": { + "source": "apache", + "extensions": ["hdf"] + }, + "application/x-httpd-php": { + "compressible": true, + "extensions": ["php"] + }, + "application/x-install-instructions": { + "source": "apache", + "extensions": ["install"] + }, + "application/x-ipynb+json": { + "compressible": true, + "extensions": ["ipynb"] + }, + "application/x-iso9660-image": { + "source": "apache", + "extensions": ["iso"] + }, + "application/x-iwork-keynote-sffkey": { + "extensions": ["key"] + }, + "application/x-iwork-numbers-sffnumbers": { + "extensions": ["numbers"] + }, + "application/x-iwork-pages-sffpages": { + "extensions": ["pages"] + }, + "application/x-java-archive-diff": { + "source": "nginx", + "extensions": ["jardiff"] + }, + "application/x-java-jnlp-file": { + "source": "apache", + "compressible": false, + "extensions": ["jnlp"] + }, + "application/x-javascript": { + "compressible": true + }, + "application/x-keepass2": { + "extensions": ["kdbx"] + }, + "application/x-latex": { + "source": "apache", + "compressible": false, + "extensions": ["latex"] + }, + "application/x-lua-bytecode": { + "extensions": ["luac"] + }, + "application/x-lzh-compressed": { + "source": "apache", + "extensions": ["lzh","lha"] + }, + "application/x-makeself": { + "source": "nginx", + "extensions": ["run"] + }, + "application/x-mie": { + "source": "apache", + "extensions": ["mie"] + }, + "application/x-mobipocket-ebook": { + "source": "apache", + "extensions": ["prc","mobi"] + }, + "application/x-mpegurl": { + "compressible": false + }, + "application/x-ms-application": { + "source": "apache", + "extensions": ["application"] + }, + "application/x-ms-shortcut": { + "source": "apache", + "extensions": ["lnk"] + }, + "application/x-ms-wmd": { + "source": "apache", + "extensions": ["wmd"] + }, + "application/x-ms-wmz": { + "source": "apache", + "extensions": ["wmz"] + }, + "application/x-ms-xbap": { + "source": "apache", + "extensions": ["xbap"] + }, + "application/x-msaccess": { + "source": "apache", + "extensions": ["mdb"] + }, + "application/x-msbinder": { + "source": "apache", + "extensions": ["obd"] + }, + "application/x-mscardfile": { + "source": "apache", + "extensions": ["crd"] + }, + "application/x-msclip": { + "source": "apache", + "extensions": ["clp"] + }, + "application/x-msdos-program": { + "extensions": ["exe"] + }, + "application/x-msdownload": { + "source": "apache", + "extensions": ["exe","dll","com","bat","msi"] + }, + "application/x-msmediaview": { + "source": "apache", + "extensions": ["mvb","m13","m14"] + }, + "application/x-msmetafile": { + "source": "apache", + "extensions": ["wmf","wmz","emf","emz"] + }, + "application/x-msmoney": { + "source": "apache", + "extensions": ["mny"] + }, + "application/x-mspublisher": { + "source": "apache", + "extensions": ["pub"] + }, + "application/x-msschedule": { + "source": "apache", + "extensions": ["scd"] + }, + "application/x-msterminal": { + "source": "apache", + "extensions": ["trm"] + }, + "application/x-mswrite": { + "source": "apache", + "extensions": ["wri"] + }, + "application/x-netcdf": { + "source": "apache", + "extensions": ["nc","cdf"] + }, + "application/x-ns-proxy-autoconfig": { + "compressible": true, + "extensions": ["pac"] + }, + "application/x-nzb": { + "source": "apache", + "extensions": ["nzb"] + }, + "application/x-perl": { + "source": "nginx", + "extensions": ["pl","pm"] + }, + "application/x-pilot": { + "source": "nginx", + "extensions": ["prc","pdb"] + }, + "application/x-pkcs12": { + "source": "apache", + "compressible": false, + "extensions": ["p12","pfx"] + }, + "application/x-pkcs7-certificates": { + "source": "apache", + "extensions": ["p7b","spc"] + }, + "application/x-pkcs7-certreqresp": { + "source": "apache", + "extensions": ["p7r"] + }, + "application/x-pki-message": { + "source": "iana" + }, + "application/x-rar-compressed": { + "source": "apache", + "compressible": false, + "extensions": ["rar"] + }, + "application/x-redhat-package-manager": { + "source": "nginx", + "extensions": ["rpm"] + }, + "application/x-research-info-systems": { + "source": "apache", + "extensions": ["ris"] + }, + "application/x-sea": { + "source": "nginx", + "extensions": ["sea"] + }, + "application/x-sh": { + "source": "apache", + "compressible": true, + "extensions": ["sh"] + }, + "application/x-shar": { + "source": "apache", + "extensions": ["shar"] + }, + "application/x-shockwave-flash": { + "source": "apache", + "compressible": false, + "extensions": ["swf"] + }, + "application/x-silverlight-app": { + "source": "apache", + "extensions": ["xap"] + }, + "application/x-sql": { + "source": "apache", + "extensions": ["sql"] + }, + "application/x-stuffit": { + "source": "apache", + "compressible": false, + "extensions": ["sit"] + }, + "application/x-stuffitx": { + "source": "apache", + "extensions": ["sitx"] + }, + "application/x-subrip": { + "source": "apache", + "extensions": ["srt"] + }, + "application/x-sv4cpio": { + "source": "apache", + "extensions": ["sv4cpio"] + }, + "application/x-sv4crc": { + "source": "apache", + "extensions": ["sv4crc"] + }, + "application/x-t3vm-image": { + "source": "apache", + "extensions": ["t3"] + }, + "application/x-tads": { + "source": "apache", + "extensions": ["gam"] + }, + "application/x-tar": { + "source": "apache", + "compressible": true, + "extensions": ["tar"] + }, + "application/x-tcl": { + "source": "apache", + "extensions": ["tcl","tk"] + }, + "application/x-tex": { + "source": "apache", + "extensions": ["tex"] + }, + "application/x-tex-tfm": { + "source": "apache", + "extensions": ["tfm"] + }, + "application/x-texinfo": { + "source": "apache", + "extensions": ["texinfo","texi"] + }, + "application/x-tgif": { + "source": "apache", + "extensions": ["obj"] + }, + "application/x-ustar": { + "source": "apache", + "extensions": ["ustar"] + }, + "application/x-virtualbox-hdd": { + "compressible": true, + "extensions": ["hdd"] + }, + "application/x-virtualbox-ova": { + "compressible": true, + "extensions": ["ova"] + }, + "application/x-virtualbox-ovf": { + "compressible": true, + "extensions": ["ovf"] + }, + "application/x-virtualbox-vbox": { + "compressible": true, + "extensions": ["vbox"] + }, + "application/x-virtualbox-vbox-extpack": { + "compressible": false, + "extensions": ["vbox-extpack"] + }, + "application/x-virtualbox-vdi": { + "compressible": true, + "extensions": ["vdi"] + }, + "application/x-virtualbox-vhd": { + "compressible": true, + "extensions": ["vhd"] + }, + "application/x-virtualbox-vmdk": { + "compressible": true, + "extensions": ["vmdk"] + }, + "application/x-wais-source": { + "source": "apache", + "extensions": ["src"] + }, + "application/x-web-app-manifest+json": { + "compressible": true, + "extensions": ["webapp"] + }, + "application/x-www-form-urlencoded": { + "source": "iana", + "compressible": true + }, + "application/x-x509-ca-cert": { + "source": "iana", + "extensions": ["der","crt","pem"] + }, + "application/x-x509-ca-ra-cert": { + "source": "iana" + }, + "application/x-x509-next-ca-cert": { + "source": "iana" + }, + "application/x-xfig": { + "source": "apache", + "extensions": ["fig"] + }, + "application/x-xliff+xml": { + "source": "apache", + "compressible": true, + "extensions": ["xlf"] + }, + "application/x-xpinstall": { + "source": "apache", + "compressible": false, + "extensions": ["xpi"] + }, + "application/x-xz": { + "source": "apache", + "extensions": ["xz"] + }, + "application/x-zip-compressed": { + "extensions": ["zip"] + }, + "application/x-zmachine": { + "source": "apache", + "extensions": ["z1","z2","z3","z4","z5","z6","z7","z8"] + }, + "application/x400-bp": { + "source": "iana" + }, + "application/xacml+xml": { + "source": "iana", + "compressible": true + }, + "application/xaml+xml": { + "source": "apache", + "compressible": true, + "extensions": ["xaml"] + }, + "application/xcap-att+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xav"] + }, + "application/xcap-caps+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xca"] + }, + "application/xcap-diff+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xdf"] + }, + "application/xcap-el+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xel"] + }, + "application/xcap-error+xml": { + "source": "iana", + "compressible": true + }, + "application/xcap-ns+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xns"] + }, + "application/xcon-conference-info+xml": { + "source": "iana", + "compressible": true + }, + "application/xcon-conference-info-diff+xml": { + "source": "iana", + "compressible": true + }, + "application/xenc+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xenc"] + }, + "application/xfdf": { + "source": "iana", + "extensions": ["xfdf"] + }, + "application/xhtml+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xhtml","xht"] + }, + "application/xhtml-voice+xml": { + "source": "apache", + "compressible": true + }, + "application/xliff+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xlf"] + }, + "application/xml": { + "source": "iana", + "compressible": true, + "extensions": ["xml","xsl","xsd","rng"] + }, + "application/xml-dtd": { + "source": "iana", + "compressible": true, + "extensions": ["dtd"] + }, + "application/xml-external-parsed-entity": { + "source": "iana" + }, + "application/xml-patch+xml": { + "source": "iana", + "compressible": true + }, + "application/xmpp+xml": { + "source": "iana", + "compressible": true + }, + "application/xop+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xop"] + }, + "application/xproc+xml": { + "source": "apache", + "compressible": true, + "extensions": ["xpl"] + }, + "application/xslt+xml": { + "source": "iana", + "compressible": true, + "extensions": ["xsl","xslt"] + }, + "application/xspf+xml": { + "source": "apache", + "compressible": true, + "extensions": ["xspf"] + }, + "application/xv+xml": { + "source": "iana", + "compressible": true, + "extensions": ["mxml","xhvml","xvml","xvm"] + }, + "application/yaml": { + "source": "iana" + }, + "application/yang": { + "source": "iana", + "extensions": ["yang"] + }, + "application/yang-data+cbor": { + "source": "iana" + }, + "application/yang-data+json": { + "source": "iana", + "compressible": true + }, + "application/yang-data+xml": { + "source": "iana", + "compressible": true + }, + "application/yang-patch+json": { + "source": "iana", + "compressible": true + }, + "application/yang-patch+xml": { + "source": "iana", + "compressible": true + }, + "application/yang-sid+json": { + "source": "iana", + "compressible": true + }, + "application/yin+xml": { + "source": "iana", + "compressible": true, + "extensions": ["yin"] + }, + "application/zip": { + "source": "iana", + "compressible": false, + "extensions": ["zip"] + }, + "application/zip+dotlottie": { + "extensions": ["lottie"] + }, + "application/zlib": { + "source": "iana" + }, + "application/zstd": { + "source": "iana" + }, + "audio/1d-interleaved-parityfec": { + "source": "iana" + }, + "audio/32kadpcm": { + "source": "iana" + }, + "audio/3gpp": { + "source": "iana", + "compressible": false, + "extensions": ["3gpp"] + }, + "audio/3gpp2": { + "source": "iana" + }, + "audio/aac": { + "source": "iana", + "extensions": ["adts","aac"] + }, + "audio/ac3": { + "source": "iana" + }, + "audio/adpcm": { + "source": "apache", + "extensions": ["adp"] + }, + "audio/amr": { + "source": "iana", + "extensions": ["amr"] + }, + "audio/amr-wb": { + "source": "iana" + }, + "audio/amr-wb+": { + "source": "iana" + }, + "audio/aptx": { + "source": "iana" + }, + "audio/asc": { + "source": "iana" + }, + "audio/atrac-advanced-lossless": { + "source": "iana" + }, + "audio/atrac-x": { + "source": "iana" + }, + "audio/atrac3": { + "source": "iana" + }, + "audio/basic": { + "source": "iana", + "compressible": false, + "extensions": ["au","snd"] + }, + "audio/bv16": { + "source": "iana" + }, + "audio/bv32": { + "source": "iana" + }, + "audio/clearmode": { + "source": "iana" + }, + "audio/cn": { + "source": "iana" + }, + "audio/dat12": { + "source": "iana" + }, + "audio/dls": { + "source": "iana" + }, + "audio/dsr-es201108": { + "source": "iana" + }, + "audio/dsr-es202050": { + "source": "iana" + }, + "audio/dsr-es202211": { + "source": "iana" + }, + "audio/dsr-es202212": { + "source": "iana" + }, + "audio/dv": { + "source": "iana" + }, + "audio/dvi4": { + "source": "iana" + }, + "audio/eac3": { + "source": "iana" + }, + "audio/encaprtp": { + "source": "iana" + }, + "audio/evrc": { + "source": "iana" + }, + "audio/evrc-qcp": { + "source": "iana" + }, + "audio/evrc0": { + "source": "iana" + }, + "audio/evrc1": { + "source": "iana" + }, + "audio/evrcb": { + "source": "iana" + }, + "audio/evrcb0": { + "source": "iana" + }, + "audio/evrcb1": { + "source": "iana" + }, + "audio/evrcnw": { + "source": "iana" + }, + "audio/evrcnw0": { + "source": "iana" + }, + "audio/evrcnw1": { + "source": "iana" + }, + "audio/evrcwb": { + "source": "iana" + }, + "audio/evrcwb0": { + "source": "iana" + }, + "audio/evrcwb1": { + "source": "iana" + }, + "audio/evs": { + "source": "iana" + }, + "audio/flac": { + "source": "iana" + }, + "audio/flexfec": { + "source": "iana" + }, + "audio/fwdred": { + "source": "iana" + }, + "audio/g711-0": { + "source": "iana" + }, + "audio/g719": { + "source": "iana" + }, + "audio/g722": { + "source": "iana" + }, + "audio/g7221": { + "source": "iana" + }, + "audio/g723": { + "source": "iana" + }, + "audio/g726-16": { + "source": "iana" + }, + "audio/g726-24": { + "source": "iana" + }, + "audio/g726-32": { + "source": "iana" + }, + "audio/g726-40": { + "source": "iana" + }, + "audio/g728": { + "source": "iana" + }, + "audio/g729": { + "source": "iana" + }, + "audio/g7291": { + "source": "iana" + }, + "audio/g729d": { + "source": "iana" + }, + "audio/g729e": { + "source": "iana" + }, + "audio/gsm": { + "source": "iana" + }, + "audio/gsm-efr": { + "source": "iana" + }, + "audio/gsm-hr-08": { + "source": "iana" + }, + "audio/ilbc": { + "source": "iana" + }, + "audio/ip-mr_v2.5": { + "source": "iana" + }, + "audio/isac": { + "source": "apache" + }, + "audio/l16": { + "source": "iana" + }, + "audio/l20": { + "source": "iana" + }, + "audio/l24": { + "source": "iana", + "compressible": false + }, + "audio/l8": { + "source": "iana" + }, + "audio/lpc": { + "source": "iana" + }, + "audio/matroska": { + "source": "iana" + }, + "audio/melp": { + "source": "iana" + }, + "audio/melp1200": { + "source": "iana" + }, + "audio/melp2400": { + "source": "iana" + }, + "audio/melp600": { + "source": "iana" + }, + "audio/mhas": { + "source": "iana" + }, + "audio/midi": { + "source": "apache", + "extensions": ["mid","midi","kar","rmi"] + }, + "audio/midi-clip": { + "source": "iana" + }, + "audio/mobile-xmf": { + "source": "iana", + "extensions": ["mxmf"] + }, + "audio/mp3": { + "compressible": false, + "extensions": ["mp3"] + }, + "audio/mp4": { + "source": "iana", + "compressible": false, + "extensions": ["m4a","mp4a","m4b"] + }, + "audio/mp4a-latm": { + "source": "iana" + }, + "audio/mpa": { + "source": "iana" + }, + "audio/mpa-robust": { + "source": "iana" + }, + "audio/mpeg": { + "source": "iana", + "compressible": false, + "extensions": ["mpga","mp2","mp2a","mp3","m2a","m3a"] + }, + "audio/mpeg4-generic": { + "source": "iana" + }, + "audio/musepack": { + "source": "apache" + }, + "audio/ogg": { + "source": "iana", + "compressible": false, + "extensions": ["oga","ogg","spx","opus"] + }, + "audio/opus": { + "source": "iana" + }, + "audio/parityfec": { + "source": "iana" + }, + "audio/pcma": { + "source": "iana" + }, + "audio/pcma-wb": { + "source": "iana" + }, + "audio/pcmu": { + "source": "iana" + }, + "audio/pcmu-wb": { + "source": "iana" + }, + "audio/prs.sid": { + "source": "iana" + }, + "audio/qcelp": { + "source": "iana" + }, + "audio/raptorfec": { + "source": "iana" + }, + "audio/red": { + "source": "iana" + }, + "audio/rtp-enc-aescm128": { + "source": "iana" + }, + "audio/rtp-midi": { + "source": "iana" + }, + "audio/rtploopback": { + "source": "iana" + }, + "audio/rtx": { + "source": "iana" + }, + "audio/s3m": { + "source": "apache", + "extensions": ["s3m"] + }, + "audio/scip": { + "source": "iana" + }, + "audio/silk": { + "source": "apache", + "extensions": ["sil"] + }, + "audio/smv": { + "source": "iana" + }, + "audio/smv-qcp": { + "source": "iana" + }, + "audio/smv0": { + "source": "iana" + }, + "audio/sofa": { + "source": "iana" + }, + "audio/sp-midi": { + "source": "iana" + }, + "audio/speex": { + "source": "iana" + }, + "audio/t140c": { + "source": "iana" + }, + "audio/t38": { + "source": "iana" + }, + "audio/telephone-event": { + "source": "iana" + }, + "audio/tetra_acelp": { + "source": "iana" + }, + "audio/tetra_acelp_bb": { + "source": "iana" + }, + "audio/tone": { + "source": "iana" + }, + "audio/tsvcis": { + "source": "iana" + }, + "audio/uemclip": { + "source": "iana" + }, + "audio/ulpfec": { + "source": "iana" + }, + "audio/usac": { + "source": "iana" + }, + "audio/vdvi": { + "source": "iana" + }, + "audio/vmr-wb": { + "source": "iana" + }, + "audio/vnd.3gpp.iufp": { + "source": "iana" + }, + "audio/vnd.4sb": { + "source": "iana" + }, + "audio/vnd.audiokoz": { + "source": "iana" + }, + "audio/vnd.celp": { + "source": "iana" + }, + "audio/vnd.cisco.nse": { + "source": "iana" + }, + "audio/vnd.cmles.radio-events": { + "source": "iana" + }, + "audio/vnd.cns.anp1": { + "source": "iana" + }, + "audio/vnd.cns.inf1": { + "source": "iana" + }, + "audio/vnd.dece.audio": { + "source": "iana", + "extensions": ["uva","uvva"] + }, + "audio/vnd.digital-winds": { + "source": "iana", + "extensions": ["eol"] + }, + "audio/vnd.dlna.adts": { + "source": "iana" + }, + "audio/vnd.dolby.heaac.1": { + "source": "iana" + }, + "audio/vnd.dolby.heaac.2": { + "source": "iana" + }, + "audio/vnd.dolby.mlp": { + "source": "iana" + }, + "audio/vnd.dolby.mps": { + "source": "iana" + }, + "audio/vnd.dolby.pl2": { + "source": "iana" + }, + "audio/vnd.dolby.pl2x": { + "source": "iana" + }, + "audio/vnd.dolby.pl2z": { + "source": "iana" + }, + "audio/vnd.dolby.pulse.1": { + "source": "iana" + }, + "audio/vnd.dra": { + "source": "iana", + "extensions": ["dra"] + }, + "audio/vnd.dts": { + "source": "iana", + "extensions": ["dts"] + }, + "audio/vnd.dts.hd": { + "source": "iana", + "extensions": ["dtshd"] + }, + "audio/vnd.dts.uhd": { + "source": "iana" + }, + "audio/vnd.dvb.file": { + "source": "iana" + }, + "audio/vnd.everad.plj": { + "source": "iana" + }, + "audio/vnd.hns.audio": { + "source": "iana" + }, + "audio/vnd.lucent.voice": { + "source": "iana", + "extensions": ["lvp"] + }, + "audio/vnd.ms-playready.media.pya": { + "source": "iana", + "extensions": ["pya"] + }, + "audio/vnd.nokia.mobile-xmf": { + "source": "iana" + }, + "audio/vnd.nortel.vbk": { + "source": "iana" + }, + "audio/vnd.nuera.ecelp4800": { + "source": "iana", + "extensions": ["ecelp4800"] + }, + "audio/vnd.nuera.ecelp7470": { + "source": "iana", + "extensions": ["ecelp7470"] + }, + "audio/vnd.nuera.ecelp9600": { + "source": "iana", + "extensions": ["ecelp9600"] + }, + "audio/vnd.octel.sbc": { + "source": "iana" + }, + "audio/vnd.presonus.multitrack": { + "source": "iana" + }, + "audio/vnd.qcelp": { + "source": "apache" + }, + "audio/vnd.rhetorex.32kadpcm": { + "source": "iana" + }, + "audio/vnd.rip": { + "source": "iana", + "extensions": ["rip"] + }, + "audio/vnd.rn-realaudio": { + "compressible": false + }, + "audio/vnd.sealedmedia.softseal.mpeg": { + "source": "iana" + }, + "audio/vnd.vmx.cvsd": { + "source": "iana" + }, + "audio/vnd.wave": { + "compressible": false + }, + "audio/vorbis": { + "source": "iana", + "compressible": false + }, + "audio/vorbis-config": { + "source": "iana" + }, + "audio/wav": { + "compressible": false, + "extensions": ["wav"] + }, + "audio/wave": { + "compressible": false, + "extensions": ["wav"] + }, + "audio/webm": { + "source": "apache", + "compressible": false, + "extensions": ["weba"] + }, + "audio/x-aac": { + "source": "apache", + "compressible": false, + "extensions": ["aac"] + }, + "audio/x-aiff": { + "source": "apache", + "extensions": ["aif","aiff","aifc"] + }, + "audio/x-caf": { + "source": "apache", + "compressible": false, + "extensions": ["caf"] + }, + "audio/x-flac": { + "source": "apache", + "extensions": ["flac"] + }, + "audio/x-m4a": { + "source": "nginx", + "extensions": ["m4a"] + }, + "audio/x-matroska": { + "source": "apache", + "extensions": ["mka"] + }, + "audio/x-mpegurl": { + "source": "apache", + "extensions": ["m3u"] + }, + "audio/x-ms-wax": { + "source": "apache", + "extensions": ["wax"] + }, + "audio/x-ms-wma": { + "source": "apache", + "extensions": ["wma"] + }, + "audio/x-pn-realaudio": { + "source": "apache", + "extensions": ["ram","ra"] + }, + "audio/x-pn-realaudio-plugin": { + "source": "apache", + "extensions": ["rmp"] + }, + "audio/x-realaudio": { + "source": "nginx", + "extensions": ["ra"] + }, + "audio/x-tta": { + "source": "apache" + }, + "audio/x-wav": { + "source": "apache", + "extensions": ["wav"] + }, + "audio/xm": { + "source": "apache", + "extensions": ["xm"] + }, + "chemical/x-cdx": { + "source": "apache", + "extensions": ["cdx"] + }, + "chemical/x-cif": { + "source": "apache", + "extensions": ["cif"] + }, + "chemical/x-cmdf": { + "source": "apache", + "extensions": ["cmdf"] + }, + "chemical/x-cml": { + "source": "apache", + "extensions": ["cml"] + }, + "chemical/x-csml": { + "source": "apache", + "extensions": ["csml"] + }, + "chemical/x-pdb": { + "source": "apache" + }, + "chemical/x-xyz": { + "source": "apache", + "extensions": ["xyz"] + }, + "font/collection": { + "source": "iana", + "extensions": ["ttc"] + }, + "font/otf": { + "source": "iana", + "compressible": true, + "extensions": ["otf"] + }, + "font/sfnt": { + "source": "iana" + }, + "font/ttf": { + "source": "iana", + "compressible": true, + "extensions": ["ttf"] + }, + "font/woff": { + "source": "iana", + "extensions": ["woff"] + }, + "font/woff2": { + "source": "iana", + "extensions": ["woff2"] + }, + "image/aces": { + "source": "iana", + "extensions": ["exr"] + }, + "image/apng": { + "source": "iana", + "compressible": false, + "extensions": ["apng"] + }, + "image/avci": { + "source": "iana", + "extensions": ["avci"] + }, + "image/avcs": { + "source": "iana", + "extensions": ["avcs"] + }, + "image/avif": { + "source": "iana", + "compressible": false, + "extensions": ["avif"] + }, + "image/bmp": { + "source": "iana", + "compressible": true, + "extensions": ["bmp","dib"] + }, + "image/cgm": { + "source": "iana", + "extensions": ["cgm"] + }, + "image/dicom-rle": { + "source": "iana", + "extensions": ["drle"] + }, + "image/dpx": { + "source": "iana", + "extensions": ["dpx"] + }, + "image/emf": { + "source": "iana", + "extensions": ["emf"] + }, + "image/fits": { + "source": "iana", + "extensions": ["fits"] + }, + "image/g3fax": { + "source": "iana", + "extensions": ["g3"] + }, + "image/gif": { + "source": "iana", + "compressible": false, + "extensions": ["gif"] + }, + "image/heic": { + "source": "iana", + "extensions": ["heic"] + }, + "image/heic-sequence": { + "source": "iana", + "extensions": ["heics"] + }, + "image/heif": { + "source": "iana", + "extensions": ["heif"] + }, + "image/heif-sequence": { + "source": "iana", + "extensions": ["heifs"] + }, + "image/hej2k": { + "source": "iana", + "extensions": ["hej2"] + }, + "image/ief": { + "source": "iana", + "extensions": ["ief"] + }, + "image/j2c": { + "source": "iana" + }, + "image/jaii": { + "source": "iana", + "extensions": ["jaii"] + }, + "image/jais": { + "source": "iana", + "extensions": ["jais"] + }, + "image/jls": { + "source": "iana", + "extensions": ["jls"] + }, + "image/jp2": { + "source": "iana", + "compressible": false, + "extensions": ["jp2","jpg2"] + }, + "image/jpeg": { + "source": "iana", + "compressible": false, + "extensions": ["jpg","jpeg","jpe"] + }, + "image/jph": { + "source": "iana", + "extensions": ["jph"] + }, + "image/jphc": { + "source": "iana", + "extensions": ["jhc"] + }, + "image/jpm": { + "source": "iana", + "compressible": false, + "extensions": ["jpm","jpgm"] + }, + "image/jpx": { + "source": "iana", + "compressible": false, + "extensions": ["jpx","jpf"] + }, + "image/jxl": { + "source": "iana", + "extensions": ["jxl"] + }, + "image/jxr": { + "source": "iana", + "extensions": ["jxr"] + }, + "image/jxra": { + "source": "iana", + "extensions": ["jxra"] + }, + "image/jxrs": { + "source": "iana", + "extensions": ["jxrs"] + }, + "image/jxs": { + "source": "iana", + "extensions": ["jxs"] + }, + "image/jxsc": { + "source": "iana", + "extensions": ["jxsc"] + }, + "image/jxsi": { + "source": "iana", + "extensions": ["jxsi"] + }, + "image/jxss": { + "source": "iana", + "extensions": ["jxss"] + }, + "image/ktx": { + "source": "iana", + "extensions": ["ktx"] + }, + "image/ktx2": { + "source": "iana", + "extensions": ["ktx2"] + }, + "image/naplps": { + "source": "iana" + }, + "image/pjpeg": { + "compressible": false, + "extensions": ["jfif"] + }, + "image/png": { + "source": "iana", + "compressible": false, + "extensions": ["png"] + }, + "image/prs.btif": { + "source": "iana", + "extensions": ["btif","btf"] + }, + "image/prs.pti": { + "source": "iana", + "extensions": ["pti"] + }, + "image/pwg-raster": { + "source": "iana" + }, + "image/sgi": { + "source": "apache", + "extensions": ["sgi"] + }, + "image/svg+xml": { + "source": "iana", + "compressible": true, + "extensions": ["svg","svgz"] + }, + "image/t38": { + "source": "iana", + "extensions": ["t38"] + }, + "image/tiff": { + "source": "iana", + "compressible": false, + "extensions": ["tif","tiff"] + }, + "image/tiff-fx": { + "source": "iana", + "extensions": ["tfx"] + }, + "image/vnd.adobe.photoshop": { + "source": "iana", + "compressible": true, + "extensions": ["psd"] + }, + "image/vnd.airzip.accelerator.azv": { + "source": "iana", + "extensions": ["azv"] + }, + "image/vnd.clip": { + "source": "iana" + }, + "image/vnd.cns.inf2": { + "source": "iana" + }, + "image/vnd.dece.graphic": { + "source": "iana", + "extensions": ["uvi","uvvi","uvg","uvvg"] + }, + "image/vnd.djvu": { + "source": "iana", + "extensions": ["djvu","djv"] + }, + "image/vnd.dvb.subtitle": { + "source": "iana", + "extensions": ["sub"] + }, + "image/vnd.dwg": { + "source": "iana", + "extensions": ["dwg"] + }, + "image/vnd.dxf": { + "source": "iana", + "extensions": ["dxf"] + }, + "image/vnd.fastbidsheet": { + "source": "iana", + "extensions": ["fbs"] + }, + "image/vnd.fpx": { + "source": "iana", + "extensions": ["fpx"] + }, + "image/vnd.fst": { + "source": "iana", + "extensions": ["fst"] + }, + "image/vnd.fujixerox.edmics-mmr": { + "source": "iana", + "extensions": ["mmr"] + }, + "image/vnd.fujixerox.edmics-rlc": { + "source": "iana", + "extensions": ["rlc"] + }, + "image/vnd.globalgraphics.pgb": { + "source": "iana" + }, + "image/vnd.microsoft.icon": { + "source": "iana", + "compressible": true, + "extensions": ["ico"] + }, + "image/vnd.mix": { + "source": "iana" + }, + "image/vnd.mozilla.apng": { + "source": "iana" + }, + "image/vnd.ms-dds": { + "compressible": true, + "extensions": ["dds"] + }, + "image/vnd.ms-modi": { + "source": "iana", + "extensions": ["mdi"] + }, + "image/vnd.ms-photo": { + "source": "apache", + "extensions": ["wdp"] + }, + "image/vnd.net-fpx": { + "source": "iana", + "extensions": ["npx"] + }, + "image/vnd.pco.b16": { + "source": "iana", + "extensions": ["b16"] + }, + "image/vnd.radiance": { + "source": "iana" + }, + "image/vnd.sealed.png": { + "source": "iana" + }, + "image/vnd.sealedmedia.softseal.gif": { + "source": "iana" + }, + "image/vnd.sealedmedia.softseal.jpg": { + "source": "iana" + }, + "image/vnd.svf": { + "source": "iana" + }, + "image/vnd.tencent.tap": { + "source": "iana", + "extensions": ["tap"] + }, + "image/vnd.valve.source.texture": { + "source": "iana", + "extensions": ["vtf"] + }, + "image/vnd.wap.wbmp": { + "source": "iana", + "extensions": ["wbmp"] + }, + "image/vnd.xiff": { + "source": "iana", + "extensions": ["xif"] + }, + "image/vnd.zbrush.pcx": { + "source": "iana", + "extensions": ["pcx"] + }, + "image/webp": { + "source": "iana", + "extensions": ["webp"] + }, + "image/wmf": { + "source": "iana", + "extensions": ["wmf"] + }, + "image/x-3ds": { + "source": "apache", + "extensions": ["3ds"] + }, + "image/x-adobe-dng": { + "extensions": ["dng"] + }, + "image/x-cmu-raster": { + "source": "apache", + "extensions": ["ras"] + }, + "image/x-cmx": { + "source": "apache", + "extensions": ["cmx"] + }, + "image/x-emf": { + "source": "iana" + }, + "image/x-freehand": { + "source": "apache", + "extensions": ["fh","fhc","fh4","fh5","fh7"] + }, + "image/x-icon": { + "source": "apache", + "compressible": true, + "extensions": ["ico"] + }, + "image/x-jng": { + "source": "nginx", + "extensions": ["jng"] + }, + "image/x-mrsid-image": { + "source": "apache", + "extensions": ["sid"] + }, + "image/x-ms-bmp": { + "source": "nginx", + "compressible": true, + "extensions": ["bmp"] + }, + "image/x-pcx": { + "source": "apache", + "extensions": ["pcx"] + }, + "image/x-pict": { + "source": "apache", + "extensions": ["pic","pct"] + }, + "image/x-portable-anymap": { + "source": "apache", + "extensions": ["pnm"] + }, + "image/x-portable-bitmap": { + "source": "apache", + "extensions": ["pbm"] + }, + "image/x-portable-graymap": { + "source": "apache", + "extensions": ["pgm"] + }, + "image/x-portable-pixmap": { + "source": "apache", + "extensions": ["ppm"] + }, + "image/x-rgb": { + "source": "apache", + "extensions": ["rgb"] + }, + "image/x-tga": { + "source": "apache", + "extensions": ["tga"] + }, + "image/x-wmf": { + "source": "iana" + }, + "image/x-xbitmap": { + "source": "apache", + "extensions": ["xbm"] + }, + "image/x-xcf": { + "compressible": false + }, + "image/x-xpixmap": { + "source": "apache", + "extensions": ["xpm"] + }, + "image/x-xwindowdump": { + "source": "apache", + "extensions": ["xwd"] + }, + "message/bhttp": { + "source": "iana" + }, + "message/cpim": { + "source": "iana" + }, + "message/delivery-status": { + "source": "iana" + }, + "message/disposition-notification": { + "source": "iana", + "extensions": [ + "disposition-notification" + ] + }, + "message/external-body": { + "source": "iana" + }, + "message/feedback-report": { + "source": "iana" + }, + "message/global": { + "source": "iana", + "extensions": ["u8msg"] + }, + "message/global-delivery-status": { + "source": "iana", + "extensions": ["u8dsn"] + }, + "message/global-disposition-notification": { + "source": "iana", + "extensions": ["u8mdn"] + }, + "message/global-headers": { + "source": "iana", + "extensions": ["u8hdr"] + }, + "message/http": { + "source": "iana", + "compressible": false + }, + "message/imdn+xml": { + "source": "iana", + "compressible": true + }, + "message/mls": { + "source": "iana" + }, + "message/news": { + "source": "apache" + }, + "message/ohttp-req": { + "source": "iana" + }, + "message/ohttp-res": { + "source": "iana" + }, + "message/partial": { + "source": "iana", + "compressible": false + }, + "message/rfc822": { + "source": "iana", + "compressible": true, + "extensions": ["eml","mime","mht","mhtml"] + }, + "message/s-http": { + "source": "apache" + }, + "message/sip": { + "source": "iana" + }, + "message/sipfrag": { + "source": "iana" + }, + "message/tracking-status": { + "source": "iana" + }, + "message/vnd.si.simp": { + "source": "apache" + }, + "message/vnd.wfa.wsc": { + "source": "iana", + "extensions": ["wsc"] + }, + "model/3mf": { + "source": "iana", + "extensions": ["3mf"] + }, + "model/e57": { + "source": "iana" + }, + "model/gltf+json": { + "source": "iana", + "compressible": true, + "extensions": ["gltf"] + }, + "model/gltf-binary": { + "source": "iana", + "compressible": true, + "extensions": ["glb"] + }, + "model/iges": { + "source": "iana", + "compressible": false, + "extensions": ["igs","iges"] + }, + "model/jt": { + "source": "iana", + "extensions": ["jt"] + }, + "model/mesh": { + "source": "iana", + "compressible": false, + "extensions": ["msh","mesh","silo"] + }, + "model/mtl": { + "source": "iana", + "extensions": ["mtl"] + }, + "model/obj": { + "source": "iana", + "extensions": ["obj"] + }, + "model/prc": { + "source": "iana", + "extensions": ["prc"] + }, + "model/step": { + "source": "iana", + "extensions": ["step","stp","stpnc","p21","210"] + }, + "model/step+xml": { + "source": "iana", + "compressible": true, + "extensions": ["stpx"] + }, + "model/step+zip": { + "source": "iana", + "compressible": false, + "extensions": ["stpz"] + }, + "model/step-xml+zip": { + "source": "iana", + "compressible": false, + "extensions": ["stpxz"] + }, + "model/stl": { + "source": "iana", + "extensions": ["stl"] + }, + "model/u3d": { + "source": "iana", + "extensions": ["u3d"] + }, + "model/vnd.bary": { + "source": "iana", + "extensions": ["bary"] + }, + "model/vnd.cld": { + "source": "iana", + "extensions": ["cld"] + }, + "model/vnd.collada+xml": { + "source": "iana", + "compressible": true, + "extensions": ["dae"] + }, + "model/vnd.dwf": { + "source": "iana", + "extensions": ["dwf"] + }, + "model/vnd.flatland.3dml": { + "source": "iana" + }, + "model/vnd.gdl": { + "source": "iana", + "extensions": ["gdl"] + }, + "model/vnd.gs-gdl": { + "source": "apache" + }, + "model/vnd.gs.gdl": { + "source": "iana" + }, + "model/vnd.gtw": { + "source": "iana", + "extensions": ["gtw"] + }, + "model/vnd.moml+xml": { + "source": "iana", + "compressible": true + }, + "model/vnd.mts": { + "source": "iana", + "extensions": ["mts"] + }, + "model/vnd.opengex": { + "source": "iana", + "extensions": ["ogex"] + }, + "model/vnd.parasolid.transmit.binary": { + "source": "iana", + "extensions": ["x_b"] + }, + "model/vnd.parasolid.transmit.text": { + "source": "iana", + "extensions": ["x_t"] + }, + "model/vnd.pytha.pyox": { + "source": "iana", + "extensions": ["pyo","pyox"] + }, + "model/vnd.rosette.annotated-data-model": { + "source": "iana" + }, + "model/vnd.sap.vds": { + "source": "iana", + "extensions": ["vds"] + }, + "model/vnd.usda": { + "source": "iana", + "extensions": ["usda"] + }, + "model/vnd.usdz+zip": { + "source": "iana", + "compressible": false, + "extensions": ["usdz"] + }, + "model/vnd.valve.source.compiled-map": { + "source": "iana", + "extensions": ["bsp"] + }, + "model/vnd.vtu": { + "source": "iana", + "extensions": ["vtu"] + }, + "model/vrml": { + "source": "iana", + "compressible": false, + "extensions": ["wrl","vrml"] + }, + "model/x3d+binary": { + "source": "apache", + "compressible": false, + "extensions": ["x3db","x3dbz"] + }, + "model/x3d+fastinfoset": { + "source": "iana", + "extensions": ["x3db"] + }, + "model/x3d+vrml": { + "source": "apache", + "compressible": false, + "extensions": ["x3dv","x3dvz"] + }, + "model/x3d+xml": { + "source": "iana", + "compressible": true, + "extensions": ["x3d","x3dz"] + }, + "model/x3d-vrml": { + "source": "iana", + "extensions": ["x3dv"] + }, + "multipart/alternative": { + "source": "iana", + "compressible": false + }, + "multipart/appledouble": { + "source": "iana" + }, + "multipart/byteranges": { + "source": "iana" + }, + "multipart/digest": { + "source": "iana" + }, + "multipart/encrypted": { + "source": "iana", + "compressible": false + }, + "multipart/form-data": { + "source": "iana", + "compressible": false + }, + "multipart/header-set": { + "source": "iana" + }, + "multipart/mixed": { + "source": "iana" + }, + "multipart/multilingual": { + "source": "iana" + }, + "multipart/parallel": { + "source": "iana" + }, + "multipart/related": { + "source": "iana", + "compressible": false + }, + "multipart/report": { + "source": "iana" + }, + "multipart/signed": { + "source": "iana", + "compressible": false + }, + "multipart/vnd.bint.med-plus": { + "source": "iana" + }, + "multipart/voice-message": { + "source": "iana" + }, + "multipart/x-mixed-replace": { + "source": "iana" + }, + "text/1d-interleaved-parityfec": { + "source": "iana" + }, + "text/cache-manifest": { + "source": "iana", + "compressible": true, + "extensions": ["appcache","manifest"] + }, + "text/calendar": { + "source": "iana", + "extensions": ["ics","ifb"] + }, + "text/calender": { + "compressible": true + }, + "text/cmd": { + "compressible": true + }, + "text/coffeescript": { + "extensions": ["coffee","litcoffee"] + }, + "text/cql": { + "source": "iana" + }, + "text/cql-expression": { + "source": "iana" + }, + "text/cql-identifier": { + "source": "iana" + }, + "text/css": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["css"] + }, + "text/csv": { + "source": "iana", + "compressible": true, + "extensions": ["csv"] + }, + "text/csv-schema": { + "source": "iana" + }, + "text/directory": { + "source": "iana" + }, + "text/dns": { + "source": "iana" + }, + "text/ecmascript": { + "source": "apache" + }, + "text/encaprtp": { + "source": "iana" + }, + "text/enriched": { + "source": "iana" + }, + "text/fhirpath": { + "source": "iana" + }, + "text/flexfec": { + "source": "iana" + }, + "text/fwdred": { + "source": "iana" + }, + "text/gff3": { + "source": "iana" + }, + "text/grammar-ref-list": { + "source": "iana" + }, + "text/hl7v2": { + "source": "iana" + }, + "text/html": { + "source": "iana", + "compressible": true, + "extensions": ["html","htm","shtml"] + }, + "text/jade": { + "extensions": ["jade"] + }, + "text/javascript": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["js","mjs"] + }, + "text/jcr-cnd": { + "source": "iana" + }, + "text/jsx": { + "compressible": true, + "extensions": ["jsx"] + }, + "text/less": { + "compressible": true, + "extensions": ["less"] + }, + "text/markdown": { + "source": "iana", + "compressible": true, + "extensions": ["md","markdown"] + }, + "text/mathml": { + "source": "nginx", + "extensions": ["mml"] + }, + "text/mdx": { + "compressible": true, + "extensions": ["mdx"] + }, + "text/mizar": { + "source": "iana" + }, + "text/n3": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["n3"] + }, + "text/parameters": { + "source": "iana", + "charset": "UTF-8" + }, + "text/parityfec": { + "source": "iana" + }, + "text/plain": { + "source": "iana", + "compressible": true, + "extensions": ["txt","text","conf","def","list","log","in","ini"] + }, + "text/provenance-notation": { + "source": "iana", + "charset": "UTF-8" + }, + "text/prs.fallenstein.rst": { + "source": "iana" + }, + "text/prs.lines.tag": { + "source": "iana", + "extensions": ["dsc"] + }, + "text/prs.prop.logic": { + "source": "iana" + }, + "text/prs.texi": { + "source": "iana" + }, + "text/raptorfec": { + "source": "iana" + }, + "text/red": { + "source": "iana" + }, + "text/rfc822-headers": { + "source": "iana" + }, + "text/richtext": { + "source": "iana", + "compressible": true, + "extensions": ["rtx"] + }, + "text/rtf": { + "source": "iana", + "compressible": true, + "extensions": ["rtf"] + }, + "text/rtp-enc-aescm128": { + "source": "iana" + }, + "text/rtploopback": { + "source": "iana" + }, + "text/rtx": { + "source": "iana" + }, + "text/sgml": { + "source": "iana", + "extensions": ["sgml","sgm"] + }, + "text/shaclc": { + "source": "iana" + }, + "text/shex": { + "source": "iana", + "extensions": ["shex"] + }, + "text/slim": { + "extensions": ["slim","slm"] + }, + "text/spdx": { + "source": "iana", + "extensions": ["spdx"] + }, + "text/strings": { + "source": "iana" + }, + "text/stylus": { + "extensions": ["stylus","styl"] + }, + "text/t140": { + "source": "iana" + }, + "text/tab-separated-values": { + "source": "iana", + "compressible": true, + "extensions": ["tsv"] + }, + "text/troff": { + "source": "iana", + "extensions": ["t","tr","roff","man","me","ms"] + }, + "text/turtle": { + "source": "iana", + "charset": "UTF-8", + "extensions": ["ttl"] + }, + "text/ulpfec": { + "source": "iana" + }, + "text/uri-list": { + "source": "iana", + "compressible": true, + "extensions": ["uri","uris","urls"] + }, + "text/vcard": { + "source": "iana", + "compressible": true, + "extensions": ["vcard"] + }, + "text/vnd.a": { + "source": "iana" + }, + "text/vnd.abc": { + "source": "iana" + }, + "text/vnd.ascii-art": { + "source": "iana" + }, + "text/vnd.curl": { + "source": "iana", + "extensions": ["curl"] + }, + "text/vnd.curl.dcurl": { + "source": "apache", + "extensions": ["dcurl"] + }, + "text/vnd.curl.mcurl": { + "source": "apache", + "extensions": ["mcurl"] + }, + "text/vnd.curl.scurl": { + "source": "apache", + "extensions": ["scurl"] + }, + "text/vnd.debian.copyright": { + "source": "iana", + "charset": "UTF-8" + }, + "text/vnd.dmclientscript": { + "source": "iana" + }, + "text/vnd.dvb.subtitle": { + "source": "iana", + "extensions": ["sub"] + }, + "text/vnd.esmertec.theme-descriptor": { + "source": "iana", + "charset": "UTF-8" + }, + "text/vnd.exchangeable": { + "source": "iana" + }, + "text/vnd.familysearch.gedcom": { + "source": "iana", + "extensions": ["ged"] + }, + "text/vnd.ficlab.flt": { + "source": "iana" + }, + "text/vnd.fly": { + "source": "iana", + "extensions": ["fly"] + }, + "text/vnd.fmi.flexstor": { + "source": "iana", + "extensions": ["flx"] + }, + "text/vnd.gml": { + "source": "iana" + }, + "text/vnd.graphviz": { + "source": "iana", + "extensions": ["gv"] + }, + "text/vnd.hans": { + "source": "iana" + }, + "text/vnd.hgl": { + "source": "iana" + }, + "text/vnd.in3d.3dml": { + "source": "iana", + "extensions": ["3dml"] + }, + "text/vnd.in3d.spot": { + "source": "iana", + "extensions": ["spot"] + }, + "text/vnd.iptc.newsml": { + "source": "iana" + }, + "text/vnd.iptc.nitf": { + "source": "iana" + }, + "text/vnd.latex-z": { + "source": "iana" + }, + "text/vnd.motorola.reflex": { + "source": "iana" + }, + "text/vnd.ms-mediapackage": { + "source": "iana" + }, + "text/vnd.net2phone.commcenter.command": { + "source": "iana" + }, + "text/vnd.radisys.msml-basic-layout": { + "source": "iana" + }, + "text/vnd.senx.warpscript": { + "source": "iana" + }, + "text/vnd.si.uricatalogue": { + "source": "apache" + }, + "text/vnd.sosi": { + "source": "iana" + }, + "text/vnd.sun.j2me.app-descriptor": { + "source": "iana", + "charset": "UTF-8", + "extensions": ["jad"] + }, + "text/vnd.trolltech.linguist": { + "source": "iana", + "charset": "UTF-8" + }, + "text/vnd.vcf": { + "source": "iana" + }, + "text/vnd.wap.si": { + "source": "iana" + }, + "text/vnd.wap.sl": { + "source": "iana" + }, + "text/vnd.wap.wml": { + "source": "iana", + "extensions": ["wml"] + }, + "text/vnd.wap.wmlscript": { + "source": "iana", + "extensions": ["wmls"] + }, + "text/vnd.zoo.kcl": { + "source": "iana" + }, + "text/vtt": { + "source": "iana", + "charset": "UTF-8", + "compressible": true, + "extensions": ["vtt"] + }, + "text/wgsl": { + "source": "iana", + "extensions": ["wgsl"] + }, + "text/x-asm": { + "source": "apache", + "extensions": ["s","asm"] + }, + "text/x-c": { + "source": "apache", + "extensions": ["c","cc","cxx","cpp","h","hh","dic"] + }, + "text/x-component": { + "source": "nginx", + "extensions": ["htc"] + }, + "text/x-fortran": { + "source": "apache", + "extensions": ["f","for","f77","f90"] + }, + "text/x-gwt-rpc": { + "compressible": true + }, + "text/x-handlebars-template": { + "extensions": ["hbs"] + }, + "text/x-java-source": { + "source": "apache", + "extensions": ["java"] + }, + "text/x-jquery-tmpl": { + "compressible": true + }, + "text/x-lua": { + "extensions": ["lua"] + }, + "text/x-markdown": { + "compressible": true, + "extensions": ["mkd"] + }, + "text/x-nfo": { + "source": "apache", + "extensions": ["nfo"] + }, + "text/x-opml": { + "source": "apache", + "extensions": ["opml"] + }, + "text/x-org": { + "compressible": true, + "extensions": ["org"] + }, + "text/x-pascal": { + "source": "apache", + "extensions": ["p","pas"] + }, + "text/x-processing": { + "compressible": true, + "extensions": ["pde"] + }, + "text/x-sass": { + "extensions": ["sass"] + }, + "text/x-scss": { + "extensions": ["scss"] + }, + "text/x-setext": { + "source": "apache", + "extensions": ["etx"] + }, + "text/x-sfv": { + "source": "apache", + "extensions": ["sfv"] + }, + "text/x-suse-ymp": { + "compressible": true, + "extensions": ["ymp"] + }, + "text/x-uuencode": { + "source": "apache", + "extensions": ["uu"] + }, + "text/x-vcalendar": { + "source": "apache", + "extensions": ["vcs"] + }, + "text/x-vcard": { + "source": "apache", + "extensions": ["vcf"] + }, + "text/xml": { + "source": "iana", + "compressible": true, + "extensions": ["xml"] + }, + "text/xml-external-parsed-entity": { + "source": "iana" + }, + "text/yaml": { + "compressible": true, + "extensions": ["yaml","yml"] + }, + "video/1d-interleaved-parityfec": { + "source": "iana" + }, + "video/3gpp": { + "source": "iana", + "extensions": ["3gp","3gpp"] + }, + "video/3gpp-tt": { + "source": "iana" + }, + "video/3gpp2": { + "source": "iana", + "extensions": ["3g2"] + }, + "video/av1": { + "source": "iana" + }, + "video/bmpeg": { + "source": "iana" + }, + "video/bt656": { + "source": "iana" + }, + "video/celb": { + "source": "iana" + }, + "video/dv": { + "source": "iana" + }, + "video/encaprtp": { + "source": "iana" + }, + "video/evc": { + "source": "iana" + }, + "video/ffv1": { + "source": "iana" + }, + "video/flexfec": { + "source": "iana" + }, + "video/h261": { + "source": "iana", + "extensions": ["h261"] + }, + "video/h263": { + "source": "iana", + "extensions": ["h263"] + }, + "video/h263-1998": { + "source": "iana" + }, + "video/h263-2000": { + "source": "iana" + }, + "video/h264": { + "source": "iana", + "extensions": ["h264"] + }, + "video/h264-rcdo": { + "source": "iana" + }, + "video/h264-svc": { + "source": "iana" + }, + "video/h265": { + "source": "iana" + }, + "video/h266": { + "source": "iana" + }, + "video/iso.segment": { + "source": "iana", + "extensions": ["m4s"] + }, + "video/jpeg": { + "source": "iana", + "extensions": ["jpgv"] + }, + "video/jpeg2000": { + "source": "iana" + }, + "video/jpm": { + "source": "apache", + "extensions": ["jpm","jpgm"] + }, + "video/jxsv": { + "source": "iana" + }, + "video/lottie+json": { + "source": "iana", + "compressible": true + }, + "video/matroska": { + "source": "iana" + }, + "video/matroska-3d": { + "source": "iana" + }, + "video/mj2": { + "source": "iana", + "extensions": ["mj2","mjp2"] + }, + "video/mp1s": { + "source": "iana" + }, + "video/mp2p": { + "source": "iana" + }, + "video/mp2t": { + "source": "iana", + "extensions": ["ts","m2t","m2ts","mts"] + }, + "video/mp4": { + "source": "iana", + "compressible": false, + "extensions": ["mp4","mp4v","mpg4"] + }, + "video/mp4v-es": { + "source": "iana" + }, + "video/mpeg": { + "source": "iana", + "compressible": false, + "extensions": ["mpeg","mpg","mpe","m1v","m2v"] + }, + "video/mpeg4-generic": { + "source": "iana" + }, + "video/mpv": { + "source": "iana" + }, + "video/nv": { + "source": "iana" + }, + "video/ogg": { + "source": "iana", + "compressible": false, + "extensions": ["ogv"] + }, + "video/parityfec": { + "source": "iana" + }, + "video/pointer": { + "source": "iana" + }, + "video/quicktime": { + "source": "iana", + "compressible": false, + "extensions": ["qt","mov"] + }, + "video/raptorfec": { + "source": "iana" + }, + "video/raw": { + "source": "iana" + }, + "video/rtp-enc-aescm128": { + "source": "iana" + }, + "video/rtploopback": { + "source": "iana" + }, + "video/rtx": { + "source": "iana" + }, + "video/scip": { + "source": "iana" + }, + "video/smpte291": { + "source": "iana" + }, + "video/smpte292m": { + "source": "iana" + }, + "video/ulpfec": { + "source": "iana" + }, + "video/vc1": { + "source": "iana" + }, + "video/vc2": { + "source": "iana" + }, + "video/vnd.cctv": { + "source": "iana" + }, + "video/vnd.dece.hd": { + "source": "iana", + "extensions": ["uvh","uvvh"] + }, + "video/vnd.dece.mobile": { + "source": "iana", + "extensions": ["uvm","uvvm"] + }, + "video/vnd.dece.mp4": { + "source": "iana" + }, + "video/vnd.dece.pd": { + "source": "iana", + "extensions": ["uvp","uvvp"] + }, + "video/vnd.dece.sd": { + "source": "iana", + "extensions": ["uvs","uvvs"] + }, + "video/vnd.dece.video": { + "source": "iana", + "extensions": ["uvv","uvvv"] + }, + "video/vnd.directv.mpeg": { + "source": "iana" + }, + "video/vnd.directv.mpeg-tts": { + "source": "iana" + }, + "video/vnd.dlna.mpeg-tts": { + "source": "iana" + }, + "video/vnd.dvb.file": { + "source": "iana", + "extensions": ["dvb"] + }, + "video/vnd.fvt": { + "source": "iana", + "extensions": ["fvt"] + }, + "video/vnd.hns.video": { + "source": "iana" + }, + "video/vnd.iptvforum.1dparityfec-1010": { + "source": "iana" + }, + "video/vnd.iptvforum.1dparityfec-2005": { + "source": "iana" + }, + "video/vnd.iptvforum.2dparityfec-1010": { + "source": "iana" + }, + "video/vnd.iptvforum.2dparityfec-2005": { + "source": "iana" + }, + "video/vnd.iptvforum.ttsavc": { + "source": "iana" + }, + "video/vnd.iptvforum.ttsmpeg2": { + "source": "iana" + }, + "video/vnd.motorola.video": { + "source": "iana" + }, + "video/vnd.motorola.videop": { + "source": "iana" + }, + "video/vnd.mpegurl": { + "source": "iana", + "extensions": ["mxu","m4u"] + }, + "video/vnd.ms-playready.media.pyv": { + "source": "iana", + "extensions": ["pyv"] + }, + "video/vnd.nokia.interleaved-multimedia": { + "source": "iana" + }, + "video/vnd.nokia.mp4vr": { + "source": "iana" + }, + "video/vnd.nokia.videovoip": { + "source": "iana" + }, + "video/vnd.objectvideo": { + "source": "iana" + }, + "video/vnd.planar": { + "source": "iana" + }, + "video/vnd.radgamettools.bink": { + "source": "iana" + }, + "video/vnd.radgamettools.smacker": { + "source": "apache" + }, + "video/vnd.sealed.mpeg1": { + "source": "iana" + }, + "video/vnd.sealed.mpeg4": { + "source": "iana" + }, + "video/vnd.sealed.swf": { + "source": "iana" + }, + "video/vnd.sealedmedia.softseal.mov": { + "source": "iana" + }, + "video/vnd.uvvu.mp4": { + "source": "iana", + "extensions": ["uvu","uvvu"] + }, + "video/vnd.vivo": { + "source": "iana", + "extensions": ["viv"] + }, + "video/vnd.youtube.yt": { + "source": "iana" + }, + "video/vp8": { + "source": "iana" + }, + "video/vp9": { + "source": "iana" + }, + "video/webm": { + "source": "apache", + "compressible": false, + "extensions": ["webm"] + }, + "video/x-f4v": { + "source": "apache", + "extensions": ["f4v"] + }, + "video/x-fli": { + "source": "apache", + "extensions": ["fli"] + }, + "video/x-flv": { + "source": "apache", + "compressible": false, + "extensions": ["flv"] + }, + "video/x-m4v": { + "source": "apache", + "extensions": ["m4v"] + }, + "video/x-matroska": { + "source": "apache", + "compressible": false, + "extensions": ["mkv","mk3d","mks"] + }, + "video/x-mng": { + "source": "apache", + "extensions": ["mng"] + }, + "video/x-ms-asf": { + "source": "apache", + "extensions": ["asf","asx"] + }, + "video/x-ms-vob": { + "source": "apache", + "extensions": ["vob"] + }, + "video/x-ms-wm": { + "source": "apache", + "extensions": ["wm"] + }, + "video/x-ms-wmv": { + "source": "apache", + "compressible": false, + "extensions": ["wmv"] + }, + "video/x-ms-wmx": { + "source": "apache", + "extensions": ["wmx"] + }, + "video/x-ms-wvx": { + "source": "apache", + "extensions": ["wvx"] + }, + "video/x-msvideo": { + "source": "apache", + "extensions": ["avi"] + }, + "video/x-sgi-movie": { + "source": "apache", + "extensions": ["movie"] + }, + "video/x-smv": { + "source": "apache", + "extensions": ["smv"] + }, + "x-conference/x-cooltalk": { + "source": "apache", + "extensions": ["ice"] + }, + "x-shader/x-fragment": { + "compressible": true + }, + "x-shader/x-vertex": { + "compressible": true + } +} diff --git a/tools/ui/node_modules/mime-db/index.js b/tools/ui/node_modules/mime-db/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ec2be30de1663c20ea2166f33a583c9c0b84d029 --- /dev/null +++ b/tools/ui/node_modules/mime-db/index.js @@ -0,0 +1,12 @@ +/*! + * mime-db + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Module exports. + */ + +module.exports = require('./db.json') diff --git a/tools/ui/node_modules/mime-db/package.json b/tools/ui/node_modules/mime-db/package.json new file mode 100644 index 0000000000000000000000000000000000000000..289a370c8f644df453d0fb395ba4a5f3fd0d3e27 --- /dev/null +++ b/tools/ui/node_modules/mime-db/package.json @@ -0,0 +1,56 @@ +{ + "name": "mime-db", + "description": "Media Type Database", + "version": "1.54.0", + "contributors": [ + "Douglas Christopher Wilson <doug@somethingdoug.com>", + "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)", + "Robert Kieffer <robert@broofa.com> (http://github.com/broofa)" + ], + "license": "MIT", + "keywords": [ + "mime", + "db", + "type", + "types", + "database", + "charset", + "charsets" + ], + "repository": "jshttp/mime-db", + "devDependencies": { + "csv-parse": "4.16.3", + "eslint": "8.32.0", + "eslint-config-standard": "15.0.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-markdown": "3.0.0", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "media-typer": "1.1.0", + "mocha": "10.2.0", + "nyc": "15.1.0", + "stream-to-array": "2.3.0", + "undici": "7.1.0" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "README.md", + "db.json", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "build": "node scripts/build", + "fetch": "node scripts/fetch-apache && node scripts/fetch-iana && node scripts/fetch-nginx", + "lint": "eslint .", + "test": "mocha --reporter spec --check-leaks test/", + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "update": "npm run fetch && npm run build", + "version": "node scripts/version-history.js && git add HISTORY.md" + } +} diff --git a/tools/ui/node_modules/mime-types/HISTORY.md b/tools/ui/node_modules/mime-types/HISTORY.md new file mode 100644 index 0000000000000000000000000000000000000000..9ba2dc077dd9f5ed292fcf3d7eaa2c396765a9d1 --- /dev/null +++ b/tools/ui/node_modules/mime-types/HISTORY.md @@ -0,0 +1,428 @@ +3.0.2 / 2025-11-20 +=================== + +* Fix: update JSDoc to reflect that functions return only `false` or `string`, not `boolean|string`. +* Fix: refined mime-score logic so `.mp4` resolves correctly +* Fix:reflect the current Node.js version supported to ≥ 18 (See 3.0.0 for more details). + +3.0.1 / 2025-03-26 +=================== + +* deps: mime-db@1.54.0 + +3.0.0 / 2024-08-31 +=================== + +* Drop support for node <18 +* deps: mime-db@1.53.0 +* resolve extension conflicts with mime-score (#119) + * asc -> application/pgp-signature is now application/pgp-keys + * mpp -> application/vnd.ms-project is now application/dash-patch+xml + * ac -> application/vnd.nokia.n-gage.ac+xml is now application/pkix-attr-cert + * bdoc -> application/x-bdoc is now application/bdoc + * wmz -> application/x-msmetafile is now application/x-ms-wmz + * xsl -> application/xslt+xml is now application/xml + * wav -> audio/wave is now audio/wav + * rtf -> text/rtf is now application/rtf + * xml -> text/xml is now application/xml + * mp4 -> video/mp4 is now application/mp4 + * mpg4 -> video/mp4 is now application/mp4 + + +2.1.35 / 2022-03-12 +=================== + + * deps: mime-db@1.52.0 + - Add extensions from IANA for more `image/*` types + - Add extension `.asc` to `application/pgp-keys` + - Add extensions to various XML types + - Add new upstream MIME types + +2.1.34 / 2021-11-08 +=================== + + * deps: mime-db@1.51.0 + - Add new upstream MIME types + +2.1.33 / 2021-10-01 +=================== + + * deps: mime-db@1.50.0 + - Add deprecated iWorks mime types and extensions + - Add new upstream MIME types + +2.1.32 / 2021-07-27 +=================== + + * deps: mime-db@1.49.0 + - Add extension `.trig` to `application/trig` + - Add new upstream MIME types + +2.1.31 / 2021-06-01 +=================== + + * deps: mime-db@1.48.0 + - Add extension `.mvt` to `application/vnd.mapbox-vector-tile` + - Add new upstream MIME types + +2.1.30 / 2021-04-02 +=================== + + * deps: mime-db@1.47.0 + - Add extension `.amr` to `audio/amr` + - Remove ambigious extensions from IANA for `application/*+xml` types + - Update primary extension to `.es` for `application/ecmascript` + +2.1.29 / 2021-02-17 +=================== + + * deps: mime-db@1.46.0 + - Add extension `.amr` to `audio/amr` + - Add extension `.m4s` to `video/iso.segment` + - Add extension `.opus` to `audio/ogg` + - Add new upstream MIME types + +2.1.28 / 2021-01-01 +=================== + + * deps: mime-db@1.45.0 + - Add `application/ubjson` with extension `.ubj` + - Add `image/avif` with extension `.avif` + - Add `image/ktx2` with extension `.ktx2` + - Add extension `.dbf` to `application/vnd.dbf` + - Add extension `.rar` to `application/vnd.rar` + - Add extension `.td` to `application/urc-targetdesc+xml` + - Add new upstream MIME types + - Fix extension of `application/vnd.apple.keynote` to be `.key` + +2.1.27 / 2020-04-23 +=================== + + * deps: mime-db@1.44.0 + - Add charsets from IANA + - Add extension `.cjs` to `application/node` + - Add new upstream MIME types + +2.1.26 / 2020-01-05 +=================== + + * deps: mime-db@1.43.0 + - Add `application/x-keepass2` with extension `.kdbx` + - Add extension `.mxmf` to `audio/mobile-xmf` + - Add extensions from IANA for `application/*+xml` types + - Add new upstream MIME types + +2.1.25 / 2019-11-12 +=================== + + * deps: mime-db@1.42.0 + - Add new upstream MIME types + - Add `application/toml` with extension `.toml` + - Add `image/vnd.ms-dds` with extension `.dds` + +2.1.24 / 2019-04-20 +=================== + + * deps: mime-db@1.40.0 + - Add extensions from IANA for `model/*` types + - Add `text/mdx` with extension `.mdx` + +2.1.23 / 2019-04-17 +=================== + + * deps: mime-db@~1.39.0 + - Add extensions `.siv` and `.sieve` to `application/sieve` + - Add new upstream MIME types + +2.1.22 / 2019-02-14 +=================== + + * deps: mime-db@~1.38.0 + - Add extension `.nq` to `application/n-quads` + - Add extension `.nt` to `application/n-triples` + - Add new upstream MIME types + +2.1.21 / 2018-10-19 +=================== + + * deps: mime-db@~1.37.0 + - Add extensions to HEIC image types + - Add new upstream MIME types + +2.1.20 / 2018-08-26 +=================== + + * deps: mime-db@~1.36.0 + - Add Apple file extensions from IANA + - Add extensions from IANA for `image/*` types + - Add new upstream MIME types + +2.1.19 / 2018-07-17 +=================== + + * deps: mime-db@~1.35.0 + - Add extension `.csl` to `application/vnd.citationstyles.style+xml` + - Add extension `.es` to `application/ecmascript` + - Add extension `.owl` to `application/rdf+xml` + - Add new upstream MIME types + - Add UTF-8 as default charset for `text/turtle` + +2.1.18 / 2018-02-16 +=================== + + * deps: mime-db@~1.33.0 + - Add `application/raml+yaml` with extension `.raml` + - Add `application/wasm` with extension `.wasm` + - Add `text/shex` with extension `.shex` + - Add extensions for JPEG-2000 images + - Add extensions from IANA for `message/*` types + - Add new upstream MIME types + - Update font MIME types + - Update `text/hjson` to registered `application/hjson` + +2.1.17 / 2017-09-01 +=================== + + * deps: mime-db@~1.30.0 + - Add `application/vnd.ms-outlook` + - Add `application/x-arj` + - Add extension `.mjs` to `application/javascript` + - Add glTF types and extensions + - Add new upstream MIME types + - Add `text/x-org` + - Add VirtualBox MIME types + - Fix `source` records for `video/*` types that are IANA + - Update `font/opentype` to registered `font/otf` + +2.1.16 / 2017-07-24 +=================== + + * deps: mime-db@~1.29.0 + - Add `application/fido.trusted-apps+json` + - Add extension `.wadl` to `application/vnd.sun.wadl+xml` + - Add extension `.gz` to `application/gzip` + - Add new upstream MIME types + - Update extensions `.md` and `.markdown` to be `text/markdown` + +2.1.15 / 2017-03-23 +=================== + + * deps: mime-db@~1.27.0 + - Add new mime types + - Add `image/apng` + +2.1.14 / 2017-01-14 +=================== + + * deps: mime-db@~1.26.0 + - Add new mime types + +2.1.13 / 2016-11-18 +=================== + + * deps: mime-db@~1.25.0 + - Add new mime types + +2.1.12 / 2016-09-18 +=================== + + * deps: mime-db@~1.24.0 + - Add new mime types + - Add `audio/mp3` + +2.1.11 / 2016-05-01 +=================== + + * deps: mime-db@~1.23.0 + - Add new mime types + +2.1.10 / 2016-02-15 +=================== + + * deps: mime-db@~1.22.0 + - Add new mime types + - Fix extension of `application/dash+xml` + - Update primary extension for `audio/mp4` + +2.1.9 / 2016-01-06 +================== + + * deps: mime-db@~1.21.0 + - Add new mime types + +2.1.8 / 2015-11-30 +================== + + * deps: mime-db@~1.20.0 + - Add new mime types + +2.1.7 / 2015-09-20 +================== + + * deps: mime-db@~1.19.0 + - Add new mime types + +2.1.6 / 2015-09-03 +================== + + * deps: mime-db@~1.18.0 + - Add new mime types + +2.1.5 / 2015-08-20 +================== + + * deps: mime-db@~1.17.0 + - Add new mime types + +2.1.4 / 2015-07-30 +================== + + * deps: mime-db@~1.16.0 + - Add new mime types + +2.1.3 / 2015-07-13 +================== + + * deps: mime-db@~1.15.0 + - Add new mime types + +2.1.2 / 2015-06-25 +================== + + * deps: mime-db@~1.14.0 + - Add new mime types + +2.1.1 / 2015-06-08 +================== + + * perf: fix deopt during mapping + +2.1.0 / 2015-06-07 +================== + + * Fix incorrectly treating extension-less file name as extension + - i.e. `'path/to/json'` will no longer return `application/json` + * Fix `.charset(type)` to accept parameters + * Fix `.charset(type)` to match case-insensitive + * Improve generation of extension to MIME mapping + * Refactor internals for readability and no argument reassignment + * Prefer `application/*` MIME types from the same source + * Prefer any type over `application/octet-stream` + * deps: mime-db@~1.13.0 + - Add nginx as a source + - Add new mime types + +2.0.14 / 2015-06-06 +=================== + + * deps: mime-db@~1.12.0 + - Add new mime types + +2.0.13 / 2015-05-31 +=================== + + * deps: mime-db@~1.11.0 + - Add new mime types + +2.0.12 / 2015-05-19 +=================== + + * deps: mime-db@~1.10.0 + - Add new mime types + +2.0.11 / 2015-05-05 +=================== + + * deps: mime-db@~1.9.1 + - Add new mime types + +2.0.10 / 2015-03-13 +=================== + + * deps: mime-db@~1.8.0 + - Add new mime types + +2.0.9 / 2015-02-09 +================== + + * deps: mime-db@~1.7.0 + - Add new mime types + - Community extensions ownership transferred from `node-mime` + +2.0.8 / 2015-01-29 +================== + + * deps: mime-db@~1.6.0 + - Add new mime types + +2.0.7 / 2014-12-30 +================== + + * deps: mime-db@~1.5.0 + - Add new mime types + - Fix various invalid MIME type entries + +2.0.6 / 2014-12-30 +================== + + * deps: mime-db@~1.4.0 + - Add new mime types + - Fix various invalid MIME type entries + - Remove example template MIME types + +2.0.5 / 2014-12-29 +================== + + * deps: mime-db@~1.3.1 + - Fix missing extensions + +2.0.4 / 2014-12-10 +================== + + * deps: mime-db@~1.3.0 + - Add new mime types + +2.0.3 / 2014-11-09 +================== + + * deps: mime-db@~1.2.0 + - Add new mime types + +2.0.2 / 2014-09-28 +================== + + * deps: mime-db@~1.1.0 + - Add new mime types + - Update charsets + +2.0.1 / 2014-09-07 +================== + + * Support Node.js 0.6 + +2.0.0 / 2014-09-02 +================== + + * Use `mime-db` + * Remove `.define()` + +1.0.2 / 2014-08-04 +================== + + * Set charset=utf-8 for `text/javascript` + +1.0.1 / 2014-06-24 +================== + + * Add `text/jsx` type + +1.0.0 / 2014-05-12 +================== + + * Return `false` for unknown types + * Set charset=utf-8 for `application/json` + +0.1.0 / 2014-05-02 +================== + + * Initial release diff --git a/tools/ui/node_modules/mime-types/LICENSE b/tools/ui/node_modules/mime-types/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..06166077be4d1f620d89b9eb33c76d89e75857da --- /dev/null +++ b/tools/ui/node_modules/mime-types/LICENSE @@ -0,0 +1,23 @@ +(The MIT License) + +Copyright (c) 2014 Jonathan Ong <me@jongleberry.com> +Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/mime-types/README.md b/tools/ui/node_modules/mime-types/README.md new file mode 100644 index 0000000000000000000000000000000000000000..222d2b58a343a582ba534945387b9106bbd514a4 --- /dev/null +++ b/tools/ui/node_modules/mime-types/README.md @@ -0,0 +1,126 @@ +# mime-types + +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-version-image]][node-version-url] +[![Build Status][ci-image]][ci-url] +[![Test Coverage][coveralls-image]][coveralls-url] + +The ultimate javascript content-type utility. + +Similar to [the `mime@1.x` module](https://www.npmjs.com/package/mime), except: + +- __No fallbacks.__ Instead of naively returning the first available type, + `mime-types` simply returns `false`, so do + `var type = mime.lookup('unrecognized') || 'application/octet-stream'`. +- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`. +- No `.define()` functionality +- Bug fixes for `.lookup(path)` + +Otherwise, the API is compatible with `mime` 1.x. + +## Install + +This is a [Node.js](https://nodejs.org/en/) module available through the +[npm registry](https://www.npmjs.com/). Installation is done using the +[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally): + +```sh +$ npm install mime-types +``` + +## Note on MIME Type Data and Semver + +This package considers the programmatic api as the semver compatibility. Additionally, the package which provides the MIME data +for this package (`mime-db`) *also* considers it's programmatic api as the semver contract. This means the MIME type resolution is *not* considered +in the semver bumps. + +In the past the version of `mime-db` was pinned to give two decision points when adopting MIME data changes. This is no longer true. We still update the +`mime-db` package here as a `minor` release when necessary, but will use a `^` range going forward. This means that if you want to pin your `mime-db` data +you will need to do it in your application. While this expectation was not set in docs until now, it is how the pacakge operated, so we do not feel this is +a breaking change. + +If you wish to pin your `mime-db` version you can do that with overrides via your package manager of choice. See their documentation for how to correctly configure that. + +## Adding Types + +All mime types are based on [mime-db](https://www.npmjs.com/package/mime-db), +so open a PR there if you'd like to add mime types. + +## API + +```js +var mime = require('mime-types') +``` + +All functions return `false` if input is invalid or not found. + +### mime.lookup(path) + +Lookup the content-type associated with a file. + +```js +mime.lookup('json') // 'application/json' +mime.lookup('.md') // 'text/markdown' +mime.lookup('file.html') // 'text/html' +mime.lookup('folder/file.js') // 'application/javascript' +mime.lookup('folder/.htaccess') // false + +mime.lookup('cats') // false +``` + +### mime.contentType(type) + +Create a full content-type header given a content-type or extension. +When given an extension, `mime.lookup` is used to get the matching +content-type, otherwise the given content-type is used. Then if the +content-type does not already have a `charset` parameter, `mime.charset` +is used to get the default charset and add to the returned content-type. + +```js +mime.contentType('markdown') // 'text/x-markdown; charset=utf-8' +mime.contentType('file.json') // 'application/json; charset=utf-8' +mime.contentType('text/html') // 'text/html; charset=utf-8' +mime.contentType('text/html; charset=iso-8859-1') // 'text/html; charset=iso-8859-1' + +// from a full path +mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8' +``` + +### mime.extension(type) + +Get the default extension for a content-type. + +```js +mime.extension('application/octet-stream') // 'bin' +``` + +### mime.charset(type) + +Lookup the implied default charset of a content-type. + +```js +mime.charset('text/markdown') // 'UTF-8' +``` + +### var type = mime.types[extension] + +A map of content-types by extension. + +### [extensions...] = mime.extensions[type] + +A map of extensions by content-type. + +## License + +[MIT](LICENSE) + +[ci-image]: https://badgen.net/github/checks/jshttp/mime-types/master?label=ci +[ci-url]: https://github.com/jshttp/mime-types/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-types/master +[coveralls-url]: https://coveralls.io/r/jshttp/mime-types?branch=master +[node-version-image]: https://badgen.net/npm/node/mime-types +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/mime-types +[npm-url]: https://npmjs.org/package/mime-types +[npm-version-image]: https://badgen.net/npm/v/mime-types diff --git a/tools/ui/node_modules/mime-types/index.js b/tools/ui/node_modules/mime-types/index.js new file mode 100644 index 0000000000000000000000000000000000000000..9725ddf3d42d9a0fccd6c3f7b69a794bf4fb6962 --- /dev/null +++ b/tools/ui/node_modules/mime-types/index.js @@ -0,0 +1,211 @@ +/*! + * mime-types + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + +'use strict' + +/** + * Module dependencies. + * @private + */ + +var db = require('mime-db') +var extname = require('path').extname +var mimeScore = require('./mimeScore') + +/** + * Module variables. + * @private + */ + +var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ +var TEXT_TYPE_REGEXP = /^text\//i + +/** + * Module exports. + * @public + */ + +exports.charset = charset +exports.charsets = { lookup: charset } +exports.contentType = contentType +exports.extension = extension +exports.extensions = Object.create(null) +exports.lookup = lookup +exports.types = Object.create(null) +exports._extensionConflicts = [] + +// Populate the extensions/types maps +populateMaps(exports.extensions, exports.types) + +/** + * Get the default charset for a MIME type. + * + * @param {string} type + * @return {false|string} + */ + +function charset (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + var mime = match && db[match[1].toLowerCase()] + + if (mime && mime.charset) { + return mime.charset + } + + // default text/* to utf-8 + if (match && TEXT_TYPE_REGEXP.test(match[1])) { + return 'UTF-8' + } + + return false +} + +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} str + * @return {false|string} + */ + +function contentType (str) { + // TODO: should this even be in this module? + if (!str || typeof str !== 'string') { + return false + } + + var mime = str.indexOf('/') === -1 ? exports.lookup(str) : str + + if (!mime) { + return false + } + + // TODO: use content-type or other module + if (mime.indexOf('charset') === -1) { + var charset = exports.charset(mime) + if (charset) mime += '; charset=' + charset.toLowerCase() + } + + return mime +} + +/** + * Get the default extension for a MIME type. + * + * @param {string} type + * @return {false|string} + */ + +function extension (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + + // get extensions + var exts = match && exports.extensions[match[1].toLowerCase()] + + if (!exts || !exts.length) { + return false + } + + return exts[0] +} + +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {false|string} + */ + +function lookup (path) { + if (!path || typeof path !== 'string') { + return false + } + + // get the extension ("ext" or ".ext" or full path) + var extension = extname('x.' + path) + .toLowerCase() + .slice(1) + + if (!extension) { + return false + } + + return exports.types[extension] || false +} + +/** + * Populate the extensions and types maps. + * @private + */ + +function populateMaps (extensions, types) { + Object.keys(db).forEach(function forEachMimeType (type) { + var mime = db[type] + var exts = mime.extensions + + if (!exts || !exts.length) { + return + } + + // mime -> extensions + extensions[type] = exts + + // extension -> mime + for (var i = 0; i < exts.length; i++) { + var extension = exts[i] + types[extension] = _preferredType(extension, types[extension], type) + + // DELETE (eventually): Capture extension->type maps that change as a + // result of switching to mime-score. This is just to help make reviewing + // PR #119 easier, and can be removed once that PR is approved. + const legacyType = _preferredTypeLegacy( + extension, + types[extension], + type + ) + if (legacyType !== types[extension]) { + exports._extensionConflicts.push([extension, legacyType, types[extension]]) + } + } + }) +} + +// Resolve type conflict using mime-score +function _preferredType (ext, type0, type1) { + var score0 = type0 ? mimeScore(type0, db[type0].source) : 0 + var score1 = type1 ? mimeScore(type1, db[type1].source) : 0 + + return score0 > score1 ? type0 : type1 +} + +// Resolve type conflict using pre-mime-score logic +function _preferredTypeLegacy (ext, type0, type1) { + var SOURCE_RANK = ['nginx', 'apache', undefined, 'iana'] + + var score0 = type0 ? SOURCE_RANK.indexOf(db[type0].source) : 0 + var score1 = type1 ? SOURCE_RANK.indexOf(db[type1].source) : 0 + + if ( + exports.types[extension] !== 'application/octet-stream' && + (score0 > score1 || + (score0 === score1 && + exports.types[extension]?.slice(0, 12) === 'application/')) + ) { + return type0 + } + + return score0 > score1 ? type0 : type1 +} diff --git a/tools/ui/node_modules/mime-types/mimeScore.js b/tools/ui/node_modules/mime-types/mimeScore.js new file mode 100644 index 0000000000000000000000000000000000000000..fc2e6657aafcc80d2ca56fb9ba362cf949460478 --- /dev/null +++ b/tools/ui/node_modules/mime-types/mimeScore.js @@ -0,0 +1,57 @@ +// 'mime-score' back-ported to CommonJS + +// Score RFC facets (see https://tools.ietf.org/html/rfc6838#section-3) +var FACET_SCORES = { + 'prs.': 100, + 'x-': 200, + 'x.': 300, + 'vnd.': 400, + default: 900 +} + +// Score mime source (Logic originally from `jshttp/mime-types` module) +var SOURCE_SCORES = { + nginx: 10, + apache: 20, + iana: 40, + default: 30 // definitions added by `jshttp/mime-db` project? +} + +var TYPE_SCORES = { + // prefer application/xml over text/xml + // prefer application/rtf over text/rtf + application: 1, + + // prefer font/woff over application/font-woff + font: 2, + + // prefer video/mp4 over audio/mp4 over application/mp4 + // See https://www.rfc-editor.org/rfc/rfc4337.html#section-2 + audio: 2, + video: 3, + + default: 0 +} + +/** + * Get each component of the score for a mime type. The sum of these is the + * total score. The higher the score, the more "official" the type. + */ +module.exports = function mimeScore (mimeType, source = 'default') { + if (mimeType === 'application/octet-stream') { + return 0 + } + + const [type, subtype] = mimeType.split('/') + + const facet = subtype.replace(/(\.|x-).*/, '$1') + + const facetScore = FACET_SCORES[facet] || FACET_SCORES.default + const sourceScore = SOURCE_SCORES[source] || SOURCE_SCORES.default + const typeScore = TYPE_SCORES[type] || TYPE_SCORES.default + + // All else being equal prefer shorter types + const lengthScore = 1 - mimeType.length / 100 + + return facetScore + sourceScore + typeScore + lengthScore +} diff --git a/tools/ui/node_modules/mime-types/package.json b/tools/ui/node_modules/mime-types/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6c58c27afd32c5df6fd5d96dfe833b27f155770b --- /dev/null +++ b/tools/ui/node_modules/mime-types/package.json @@ -0,0 +1,49 @@ +{ + "name": "mime-types", + "description": "The ultimate javascript content-type utility.", + "version": "3.0.2", + "contributors": [ + "Douglas Christopher Wilson <doug@somethingdoug.com>", + "Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)", + "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)" + ], + "license": "MIT", + "keywords": [ + "mime", + "types" + ], + "repository": "jshttp/mime-types", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + }, + "dependencies": { + "mime-db": "^1.54.0" + }, + "devDependencies": { + "eslint": "8.33.0", + "eslint-config-standard": "14.1.1", + "eslint-plugin-import": "2.32.0", + "eslint-plugin-markdown": "3.0.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.6.0", + "eslint-plugin-standard": "4.1.0", + "mocha": "10.8.2", + "nyc": "15.1.0" + }, + "files": [ + "HISTORY.md", + "LICENSE", + "index.js", + "mimeScore.js" + ], + "engines": { + "node": ">=18" + }, + "scripts": { + "lint": "eslint .", + "test": "mocha --reporter spec test/test.js", + "test-ci": "nyc --reporter=lcov --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test" + } +} diff --git a/tools/ui/node_modules/mime/.npmignore b/tools/ui/node_modules/mime/.npmignore new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tools/ui/node_modules/mime/CHANGELOG.md b/tools/ui/node_modules/mime/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..f1275350531d30ca6dd665cbb5fe78fc5e702948 --- /dev/null +++ b/tools/ui/node_modules/mime/CHANGELOG.md @@ -0,0 +1,164 @@ +# Changelog + +## v1.6.0 (24/11/2017) +*No changelog for this release.* + +--- + +## v2.0.4 (24/11/2017) +- [**closed**] Switch to mime-score module for resolving extension contention issues. [#182](https://github.com/broofa/node-mime/issues/182) +- [**closed**] Update mime-db to 1.31.0 in v1.x branch [#181](https://github.com/broofa/node-mime/issues/181) + +--- + +## v1.5.0 (22/11/2017) +- [**closed**] need ES5 version ready in npm package [#179](https://github.com/broofa/node-mime/issues/179) +- [**closed**] mime-db no trace of iWork - pages / numbers / etc. [#178](https://github.com/broofa/node-mime/issues/178) +- [**closed**] How it works in brownser ? [#176](https://github.com/broofa/node-mime/issues/176) +- [**closed**] Missing `./Mime` [#175](https://github.com/broofa/node-mime/issues/175) +- [**closed**] Vulnerable Regular Expression [#167](https://github.com/broofa/node-mime/issues/167) + +--- + +## v2.0.3 (25/09/2017) +*No changelog for this release.* + +--- + +## v1.4.1 (25/09/2017) +- [**closed**] Issue when bundling with webpack [#172](https://github.com/broofa/node-mime/issues/172) + +--- + +## v2.0.2 (15/09/2017) +- [**V2**] fs.readFileSync is not a function [#165](https://github.com/broofa/node-mime/issues/165) +- [**closed**] The extension for video/quicktime should map to .mov, not .qt [#164](https://github.com/broofa/node-mime/issues/164) +- [**V2**] [v2 Feedback request] Mime class API [#163](https://github.com/broofa/node-mime/issues/163) +- [**V2**] [v2 Feedback request] Resolving conflicts over extensions [#162](https://github.com/broofa/node-mime/issues/162) +- [**V2**] Allow callers to load module with official, full, or no defined types. [#161](https://github.com/broofa/node-mime/issues/161) +- [**V2**] Use "facets" to resolve extension conflicts [#160](https://github.com/broofa/node-mime/issues/160) +- [**V2**] Remove fs and path dependencies [#152](https://github.com/broofa/node-mime/issues/152) +- [**V2**] Default content-type should not be application/octet-stream [#139](https://github.com/broofa/node-mime/issues/139) +- [**V2**] reset mime-types [#124](https://github.com/broofa/node-mime/issues/124) +- [**V2**] Extensionless paths should return null or false [#113](https://github.com/broofa/node-mime/issues/113) + +--- + +## v2.0.1 (14/09/2017) +- [**closed**] Changelog for v2.0 does not mention breaking changes [#171](https://github.com/broofa/node-mime/issues/171) +- [**closed**] MIME breaking with 'class' declaration as it is without 'use strict mode' [#170](https://github.com/broofa/node-mime/issues/170) + +--- + +## v2.0.0 (12/09/2017) +- [**closed**] woff and woff2 [#168](https://github.com/broofa/node-mime/issues/168) + +--- + +## v1.4.0 (28/08/2017) +- [**closed**] support for ac3 voc files [#159](https://github.com/broofa/node-mime/issues/159) +- [**closed**] Help understanding change from application/xml to text/xml [#158](https://github.com/broofa/node-mime/issues/158) +- [**closed**] no longer able to override mimetype [#157](https://github.com/broofa/node-mime/issues/157) +- [**closed**] application/vnd.adobe.photoshop [#147](https://github.com/broofa/node-mime/issues/147) +- [**closed**] Directories should appear as something other than application/octet-stream [#135](https://github.com/broofa/node-mime/issues/135) +- [**closed**] requested features [#131](https://github.com/broofa/node-mime/issues/131) +- [**closed**] Make types.json loading optional? [#129](https://github.com/broofa/node-mime/issues/129) +- [**closed**] Cannot find module './types.json' [#120](https://github.com/broofa/node-mime/issues/120) +- [**V2**] .wav files show up as "audio/x-wav" instead of "audio/x-wave" [#118](https://github.com/broofa/node-mime/issues/118) +- [**closed**] Don't be a pain in the ass for node community [#108](https://github.com/broofa/node-mime/issues/108) +- [**closed**] don't make default_type global [#78](https://github.com/broofa/node-mime/issues/78) +- [**closed**] mime.extension() fails if the content-type is parameterized [#74](https://github.com/broofa/node-mime/issues/74) + +--- + +## v1.3.6 (11/05/2017) +- [**closed**] .md should be text/markdown as of March 2016 [#154](https://github.com/broofa/node-mime/issues/154) +- [**closed**] Error while installing mime [#153](https://github.com/broofa/node-mime/issues/153) +- [**closed**] application/manifest+json [#149](https://github.com/broofa/node-mime/issues/149) +- [**closed**] Dynamic adaptive streaming over HTTP (DASH) file extension typo [#141](https://github.com/broofa/node-mime/issues/141) +- [**closed**] charsets image/png undefined [#140](https://github.com/broofa/node-mime/issues/140) +- [**closed**] Mime-db dependency out of date [#130](https://github.com/broofa/node-mime/issues/130) +- [**closed**] how to support plist? [#126](https://github.com/broofa/node-mime/issues/126) +- [**closed**] how does .types file format look like? [#123](https://github.com/broofa/node-mime/issues/123) +- [**closed**] Feature: support for expanding MIME patterns [#121](https://github.com/broofa/node-mime/issues/121) +- [**closed**] DEBUG_MIME doesn't work [#117](https://github.com/broofa/node-mime/issues/117) + +--- + +## v1.3.4 (06/02/2015) +*No changelog for this release.* + +--- + +## v1.3.3 (06/02/2015) +*No changelog for this release.* + +--- + +## v1.3.1 (05/02/2015) +- [**closed**] Consider adding support for Handlebars .hbs file ending [#111](https://github.com/broofa/node-mime/issues/111) +- [**closed**] Consider adding support for hjson. [#110](https://github.com/broofa/node-mime/issues/110) +- [**closed**] Add mime type for Opus audio files [#94](https://github.com/broofa/node-mime/issues/94) +- [**closed**] Consider making the `Requesting New Types` information more visible [#77](https://github.com/broofa/node-mime/issues/77) + +--- + +## v1.3.0 (05/02/2015) +- [**closed**] Add common name? [#114](https://github.com/broofa/node-mime/issues/114) +- [**closed**] application/x-yaml [#104](https://github.com/broofa/node-mime/issues/104) +- [**closed**] Add mime type for WOFF file format 2.0 [#102](https://github.com/broofa/node-mime/issues/102) +- [**closed**] application/x-msi for .msi [#99](https://github.com/broofa/node-mime/issues/99) +- [**closed**] Add mimetype for gettext translation files [#98](https://github.com/broofa/node-mime/issues/98) +- [**closed**] collaborators [#88](https://github.com/broofa/node-mime/issues/88) +- [**closed**] getting errot in installation of mime module...any1 can help? [#87](https://github.com/broofa/node-mime/issues/87) +- [**closed**] should application/json's charset be utf8? [#86](https://github.com/broofa/node-mime/issues/86) +- [**closed**] Add "license" and "licenses" to package.json [#81](https://github.com/broofa/node-mime/issues/81) +- [**closed**] lookup with extension-less file on Windows returns wrong type [#68](https://github.com/broofa/node-mime/issues/68) + +--- + +## v1.2.11 (15/08/2013) +- [**closed**] Update mime.types [#65](https://github.com/broofa/node-mime/issues/65) +- [**closed**] Publish a new version [#63](https://github.com/broofa/node-mime/issues/63) +- [**closed**] README should state upfront that "application/octet-stream" is default for unknown extension [#55](https://github.com/broofa/node-mime/issues/55) +- [**closed**] Suggested improvement to the charset API [#52](https://github.com/broofa/node-mime/issues/52) + +--- + +## v1.2.10 (25/07/2013) +- [**closed**] Mime type for woff files should be application/font-woff and not application/x-font-woff [#62](https://github.com/broofa/node-mime/issues/62) +- [**closed**] node.types in conflict with mime.types [#51](https://github.com/broofa/node-mime/issues/51) + +--- + +## v1.2.9 (17/01/2013) +- [**closed**] Please update "mime" NPM [#49](https://github.com/broofa/node-mime/issues/49) +- [**closed**] Please add semicolon [#46](https://github.com/broofa/node-mime/issues/46) +- [**closed**] parse full mime types [#43](https://github.com/broofa/node-mime/issues/43) + +--- + +## v1.2.8 (10/01/2013) +- [**closed**] /js directory mime is application/javascript. Is it correct? [#47](https://github.com/broofa/node-mime/issues/47) +- [**closed**] Add mime types for lua code. [#45](https://github.com/broofa/node-mime/issues/45) + +--- + +## v1.2.7 (19/10/2012) +- [**closed**] cannot install 1.2.7 via npm [#41](https://github.com/broofa/node-mime/issues/41) +- [**closed**] Transfer ownership to @broofa [#36](https://github.com/broofa/node-mime/issues/36) +- [**closed**] it's wrong to set charset to UTF-8 for text [#30](https://github.com/broofa/node-mime/issues/30) +- [**closed**] Allow multiple instances of MIME types container [#27](https://github.com/broofa/node-mime/issues/27) + +--- + +## v1.2.5 (16/02/2012) +- [**closed**] When looking up a types, check hasOwnProperty [#23](https://github.com/broofa/node-mime/issues/23) +- [**closed**] Bump version to 1.2.2 [#18](https://github.com/broofa/node-mime/issues/18) +- [**closed**] No license [#16](https://github.com/broofa/node-mime/issues/16) +- [**closed**] Some types missing that are used by html5/css3 [#13](https://github.com/broofa/node-mime/issues/13) +- [**closed**] npm install fails for 1.2.1 [#12](https://github.com/broofa/node-mime/issues/12) +- [**closed**] image/pjpeg + image/x-png [#10](https://github.com/broofa/node-mime/issues/10) +- [**closed**] symlink [#8](https://github.com/broofa/node-mime/issues/8) +- [**closed**] gzip [#2](https://github.com/broofa/node-mime/issues/2) +- [**closed**] ALL CAPS filenames return incorrect mime type [#1](https://github.com/broofa/node-mime/issues/1) diff --git a/tools/ui/node_modules/mime/LICENSE b/tools/ui/node_modules/mime/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..d3f46f7e145990dad5954d78c5da9a2c2bdcbe36 --- /dev/null +++ b/tools/ui/node_modules/mime/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2010 Benjamin Thomas, Robert Kieffer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/ui/node_modules/mime/README.md b/tools/ui/node_modules/mime/README.md new file mode 100644 index 0000000000000000000000000000000000000000..506fbe550a8dee9f0bde702fda6a040dfed3aba8 --- /dev/null +++ b/tools/ui/node_modules/mime/README.md @@ -0,0 +1,90 @@ +# mime + +Comprehensive MIME type mapping API based on mime-db module. + +## Install + +Install with [npm](http://github.com/isaacs/npm): + + npm install mime + +## Contributing / Testing + + npm run test + +## Command Line + + mime [path_string] + +E.g. + + > mime scripts/jquery.js + application/javascript + +## API - Queries + +### mime.lookup(path) +Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g. + +```js +var mime = require('mime'); + +mime.lookup('/path/to/file.txt'); // => 'text/plain' +mime.lookup('file.txt'); // => 'text/plain' +mime.lookup('.TXT'); // => 'text/plain' +mime.lookup('htm'); // => 'text/html' +``` + +### mime.default_type +Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.) + +### mime.extension(type) +Get the default extension for `type` + +```js +mime.extension('text/html'); // => 'html' +mime.extension('application/octet-stream'); // => 'bin' +``` + +### mime.charsets.lookup() + +Map mime-type to charset + +```js +mime.charsets.lookup('text/plain'); // => 'UTF-8' +``` + +(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) + +## API - Defining Custom Types + +Custom type mappings can be added on a per-project basis via the following APIs. + +### mime.define() + +Add custom mime/extension mappings + +```js +mime.define({ + 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], + 'application/x-my-type': ['x-mt', 'x-mtt'], + // etc ... +}); + +mime.lookup('x-sft'); // => 'text/x-some-format' +``` + +The first entry in the extensions array is returned by `mime.extension()`. E.g. + +```js +mime.extension('text/x-some-format'); // => 'x-sf' +``` + +### mime.load(filepath) + +Load mappings from an Apache ".types" format file + +```js +mime.load('./my_project.types'); +``` +The .types file format is simple - See the `types` dir for examples. diff --git a/tools/ui/node_modules/mime/cli.js b/tools/ui/node_modules/mime/cli.js new file mode 100644 index 0000000000000000000000000000000000000000..20b1ffeb2f97648e0faa7e022c98ed9e6a8e9a0d --- /dev/null +++ b/tools/ui/node_modules/mime/cli.js @@ -0,0 +1,8 @@ +#!/usr/bin/env node + +var mime = require('./mime.js'); +var file = process.argv[2]; +var type = mime.lookup(file); + +process.stdout.write(type + '\n'); + diff --git a/tools/ui/node_modules/mime/mime.js b/tools/ui/node_modules/mime/mime.js new file mode 100644 index 0000000000000000000000000000000000000000..d7efbde70b8e95fb7f67da9c8cfed11ce8ce4133 --- /dev/null +++ b/tools/ui/node_modules/mime/mime.js @@ -0,0 +1,108 @@ +var path = require('path'); +var fs = require('fs'); + +function Mime() { + // Map of extension -> mime type + this.types = Object.create(null); + + // Map of mime type -> extension + this.extensions = Object.create(null); +} + +/** + * Define mimetype -> extension mappings. Each key is a mime-type that maps + * to an array of extensions associated with the type. The first extension is + * used as the default extension for the type. + * + * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); + * + * @param map (Object) type definitions + */ +Mime.prototype.define = function (map) { + for (var type in map) { + var exts = map[type]; + for (var i = 0; i < exts.length; i++) { + if (process.env.DEBUG_MIME && this.types[exts[i]]) { + console.warn((this._loading || "define()").replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' + + this.types[exts[i]] + ' to ' + type); + } + + this.types[exts[i]] = type; + } + + // Default extension is the first one we encounter + if (!this.extensions[type]) { + this.extensions[type] = exts[0]; + } + } +}; + +/** + * Load an Apache2-style ".types" file + * + * This may be called multiple times (it's expected). Where files declare + * overlapping types/extensions, the last file wins. + * + * @param file (String) path of file to load. + */ +Mime.prototype.load = function(file) { + this._loading = file; + // Read file and split into lines + var map = {}, + content = fs.readFileSync(file, 'ascii'), + lines = content.split(/[\r\n]+/); + + lines.forEach(function(line) { + // Clean up whitespace/comments, and split into fields + var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); + map[fields.shift()] = fields; + }); + + this.define(map); + + this._loading = null; +}; + +/** + * Lookup a mime type based on extension + */ +Mime.prototype.lookup = function(path, fallback) { + var ext = path.replace(/^.*[\.\/\\]/, '').toLowerCase(); + + return this.types[ext] || fallback || this.default_type; +}; + +/** + * Return file extension associated with a mime type + */ +Mime.prototype.extension = function(mimeType) { + var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase(); + return this.extensions[type]; +}; + +// Default instance +var mime = new Mime(); + +// Define built-in types +mime.define(require('./types.json')); + +// Default type +mime.default_type = mime.lookup('bin'); + +// +// Additional API specific to the default instance +// + +mime.Mime = Mime; + +/** + * Lookup a charset based on mime type. + */ +mime.charsets = { + lookup: function(mimeType, fallback) { + // Assume text types are utf8 + return (/^text\/|^application\/(javascript|json)/).test(mimeType) ? 'UTF-8' : fallback; + } +}; + +module.exports = mime; diff --git a/tools/ui/node_modules/mime/package.json b/tools/ui/node_modules/mime/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6bd24bc53c1a7067b60f43e559d1739d138b987f --- /dev/null +++ b/tools/ui/node_modules/mime/package.json @@ -0,0 +1,44 @@ +{ + "author": { + "name": "Robert Kieffer", + "url": "http://github.com/broofa", + "email": "robert@broofa.com" + }, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + }, + "contributors": [ + { + "name": "Benjamin Thomas", + "url": "http://github.com/bentomas", + "email": "benjamin@benjaminthomas.org" + } + ], + "description": "A comprehensive library for mime-type mapping", + "license": "MIT", + "dependencies": {}, + "devDependencies": { + "github-release-notes": "0.13.1", + "mime-db": "1.31.0", + "mime-score": "1.1.0" + }, + "scripts": { + "prepare": "node src/build.js", + "changelog": "gren changelog --tags=all --generate --override", + "test": "node src/test.js" + }, + "keywords": [ + "util", + "mime" + ], + "main": "mime.js", + "name": "mime", + "repository": { + "url": "https://github.com/broofa/node-mime", + "type": "git" + }, + "version": "1.6.0" +} diff --git a/tools/ui/node_modules/mime/src/build.js b/tools/ui/node_modules/mime/src/build.js new file mode 100644 index 0000000000000000000000000000000000000000..4928e48bcd5db783074ca4d842ba24931645e1f6 --- /dev/null +++ b/tools/ui/node_modules/mime/src/build.js @@ -0,0 +1,53 @@ +#!/usr/bin/env node + +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const mimeScore = require('mime-score'); + +let db = require('mime-db'); +let chalk = require('chalk'); + +const STANDARD_FACET_SCORE = 900; + +const byExtension = {}; + +// Clear out any conflict extensions in mime-db +for (let type in db) { + let entry = db[type]; + entry.type = type; + + if (!entry.extensions) continue; + + entry.extensions.forEach(ext => { + if (ext in byExtension) { + const e0 = entry; + const e1 = byExtension[ext]; + e0.pri = mimeScore(e0.type, e0.source); + e1.pri = mimeScore(e1.type, e1.source); + + let drop = e0.pri < e1.pri ? e0 : e1; + let keep = e0.pri >= e1.pri ? e0 : e1; + drop.extensions = drop.extensions.filter(e => e !== ext); + + console.log(`${ext}: Keeping ${chalk.green(keep.type)} (${keep.pri}), dropping ${chalk.red(drop.type)} (${drop.pri})`); + } + byExtension[ext] = entry; + }); +} + +function writeTypesFile(types, path) { + fs.writeFileSync(path, JSON.stringify(types)); +} + +// Segregate into standard and non-standard types based on facet per +// https://tools.ietf.org/html/rfc6838#section-3.1 +const types = {}; + +Object.keys(db).sort().forEach(k => { + const entry = db[k]; + types[entry.type] = entry.extensions; +}); + +writeTypesFile(types, path.join(__dirname, '..', 'types.json')); diff --git a/tools/ui/node_modules/mime/src/test.js b/tools/ui/node_modules/mime/src/test.js new file mode 100644 index 0000000000000000000000000000000000000000..42958a20d5bdbae6a4724c6a8cc99f292b00b265 --- /dev/null +++ b/tools/ui/node_modules/mime/src/test.js @@ -0,0 +1,60 @@ +/** + * Usage: node test.js + */ + +var mime = require('../mime'); +var assert = require('assert'); +var path = require('path'); + +// +// Test mime lookups +// + +assert.equal('text/plain', mime.lookup('text.txt')); // normal file +assert.equal('text/plain', mime.lookup('TEXT.TXT')); // uppercase +assert.equal('text/plain', mime.lookup('dir/text.txt')); // dir + file +assert.equal('text/plain', mime.lookup('.text.txt')); // hidden file +assert.equal('text/plain', mime.lookup('.txt')); // nameless +assert.equal('text/plain', mime.lookup('txt')); // extension-only +assert.equal('text/plain', mime.lookup('/txt')); // extension-less () +assert.equal('text/plain', mime.lookup('\\txt')); // Windows, extension-less +assert.equal('application/octet-stream', mime.lookup('text.nope')); // unrecognized +assert.equal('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default + +// +// Test extensions +// + +assert.equal('txt', mime.extension(mime.types.text)); +assert.equal('html', mime.extension(mime.types.htm)); +assert.equal('bin', mime.extension('application/octet-stream')); +assert.equal('bin', mime.extension('application/octet-stream ')); +assert.equal('html', mime.extension(' text/html; charset=UTF-8')); +assert.equal('html', mime.extension('text/html; charset=UTF-8 ')); +assert.equal('html', mime.extension('text/html; charset=UTF-8')); +assert.equal('html', mime.extension('text/html ; charset=UTF-8')); +assert.equal('html', mime.extension('text/html;charset=UTF-8')); +assert.equal('html', mime.extension('text/Html;charset=UTF-8')); +assert.equal(undefined, mime.extension('unrecognized')); + +// +// Test node.types lookups +// + +assert.equal('font/woff', mime.lookup('file.woff')); +assert.equal('application/octet-stream', mime.lookup('file.buffer')); +// TODO: Uncomment once #157 is resolved +// assert.equal('audio/mp4', mime.lookup('file.m4a')); +assert.equal('font/otf', mime.lookup('file.otf')); + +// +// Test charsets +// + +assert.equal('UTF-8', mime.charsets.lookup('text/plain')); +assert.equal('UTF-8', mime.charsets.lookup(mime.types.js)); +assert.equal('UTF-8', mime.charsets.lookup(mime.types.json)); +assert.equal(undefined, mime.charsets.lookup(mime.types.bin)); +assert.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); + +console.log('\nAll tests passed'); diff --git a/tools/ui/node_modules/mime/types.json b/tools/ui/node_modules/mime/types.json new file mode 100644 index 0000000000000000000000000000000000000000..bec78abd491e093599b2615533687a6b3c360526 --- /dev/null +++ b/tools/ui/node_modules/mime/types.json @@ -0,0 +1 @@ +{"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomsvc+xml":["atomsvc"],"application/bdoc":["bdoc"],"application/ccxml+xml":["ccxml"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/font-tdpfr":["pfr"],"application/font-woff":[],"application/font-woff2":[],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/prs.cww":["cww"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":[],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":[],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":[],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":[],"application/x-msdownload":["com","bat"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["wmf","emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":[],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"application/xaml+xml":["xaml"],"application/xcap-diff+xml":["xdf"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":[],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mp3":[],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/wav":["wav"],"audio/wave":[],"audio/webm":["weba"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":[],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":[],"audio/x-wav":[],"audio/xm":["xm"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/apng":["apng"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/g3fax":["g3"],"image/gif":["gif"],"image/ief":["ief"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/ktx":["ktx"],"image/png":["png"],"image/prs.btif":["btif"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/tiff":["tiff","tif"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":[],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/webp":["webp"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":[],"image/x-pcx":["pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/rfc822":["eml","mime"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.vtu":["vtu"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["x3db","x3dbz"],"model/x3d+vrml":["x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/hjson":["hjson"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/prs.lines.tag":["dsc"],"text/richtext":["rtx"],"text/rtf":[],"text/sgml":["sgml","sgm"],"text/slim":["slim","slm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/vtt":["vtt"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":[],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"text/xml":[],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/webm":["webm"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]} \ No newline at end of file diff --git a/tools/ui/node_modules/min-indent/index.js b/tools/ui/node_modules/min-indent/index.js new file mode 100644 index 0000000000000000000000000000000000000000..77abf19276912fa586a9ac8823e260e3c715dc6d --- /dev/null +++ b/tools/ui/node_modules/min-indent/index.js @@ -0,0 +1,10 @@ +'use strict'; +module.exports = string => { + const match = string.match(/^[ \t]*(?=\S)/gm); + + if (!match) { + return 0; + } + + return match.reduce((r, a) => Math.min(r, a.length), Infinity); +}; diff --git a/tools/ui/node_modules/min-indent/license b/tools/ui/node_modules/min-indent/license new file mode 100644 index 0000000000000000000000000000000000000000..dbe9fdc76405e8bf7d12a6a08776be4441718187 --- /dev/null +++ b/tools/ui/node_modules/min-indent/license @@ -0,0 +1,22 @@ + +The MIT License (MIT) + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com), James Kyle <me@thejameskyle.com> (thejameskyle.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/ui/node_modules/min-indent/package.json b/tools/ui/node_modules/min-indent/package.json new file mode 100644 index 0000000000000000000000000000000000000000..95e5259d90d0ea7d5ff9d131ce4c4176f7eaf2cc --- /dev/null +++ b/tools/ui/node_modules/min-indent/package.json @@ -0,0 +1,38 @@ +{ + "name": "min-indent", + "version": "1.0.1", + "description": "Get the shortest leading whitespace from lines in a string", + "main": "index.js", + "license": "MIT", + "repository": "https://github.com/thejameskyle/min-indent", + "author": { + "name": "James Kyle", + "email": "me@thejameskyle.com", + "url": "thejameskyle.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "indent", + "indentation", + "normalize", + "whitespace", + "space", + "tab", + "string", + "str", + "min", + "minimum" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/tools/ui/node_modules/min-indent/readme.md b/tools/ui/node_modules/min-indent/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..cf573e5f769f44d255cf4224dc27c5feaebe171e --- /dev/null +++ b/tools/ui/node_modules/min-indent/readme.md @@ -0,0 +1,41 @@ +# min-indent [![Build Status](https://travis-ci.org/thejameskyle/min-indent.svg?branch=master)](https://travis-ci.org/thejameskyle/min-indent) + +> Get the shortest leading whitespace from lines in a string + +The line with the least number of leading whitespace, ignoring empty lines, determines the number. + +Useful for removing redundant indentation. + + +## Install + +``` +$ npm install --save min-indent +``` + + +## Usage + +```js +const minIndent = require('min-indent'); + +const str = '\tunicorn\n\t\tcake'; +/* + unicorn + cake +*/ + +minIndent(str); // 1 +``` + + +## Related + +- [strip-indent](https://github.com/sindresorhus/strip-indent) - Strip leading whitespace from each line in a string +- [strip-indent-cli](https://github.com/sindresorhus/strip-indent-cli) - CLI for this module +- [indent-string](https://github.com/sindresorhus/indent-string) - Indent each line in a string + + +## License + +MIT © [James Kyle](https://thejameskyle.com) diff --git a/tools/ui/node_modules/mini-svg-data-uri/LICENSE b/tools/ui/node_modules/mini-svg-data-uri/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..bf23b14f224b19ec50950e90fa81648eda2782d1 --- /dev/null +++ b/tools/ui/node_modules/mini-svg-data-uri/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Taylor Hunt + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/ui/node_modules/mini-svg-data-uri/README.md b/tools/ui/node_modules/mini-svg-data-uri/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c6a109c2dba3bf9a26dcb50788ee01715d49723d --- /dev/null +++ b/tools/ui/node_modules/mini-svg-data-uri/README.md @@ -0,0 +1,109 @@ +Mini SVG `data:` URI +==================== + +This tool converts SVGs into the most compact, compressible `data:` URI that SVG-supporting browsers tolerate. The results look like this (169 bytes): + +```url +data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' +%3e%3cpath d='M22 38V51L32 32l19-19v12C44 26 43 10 38 0 52 15 49 39 22 38z'/%3e +%3c/svg%3e +``` + +Compare to the Base64 version (210 bytes): + +```url +data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIH +ZpZXdCb3g9IjAgMCA1MCA1MCI+PHBhdGggZD0iTTIyIDM4VjUxTDMyIDMybDE5LTE5djEyQzQ0IDI2ID +QzIDEwIDM4IDAgNTIgMTUgNDkgMzkgMjIgMzh6Ii8+PC9zdmc+ +``` + +Or the URL-encoded version other tools produce (256 bytes): + +```url +data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org% +2F2000%2Fsvg%22%20viewBox%3D%220%200%2050%2050%22%3E%3Cpath%20d%3D%22M22%2038V51 +L32%2032l19-19v12C44%2026%2043%2010%2038%200%2052%2015%2049%2039%2022%2038z%22%2 +F%3E%3C%2Fsvg%3E +``` + +For a more realistic example, I inlined the icons from the [Open Iconic](https://useiconic.com/open) project into CSS files with the 3 above methods: + +| Compression | Base64 | Basic %-encoding | `mini-svg-data-uri` | +|-------------|----------:|-----------------:|--------------------:| +| None | 96.459 kB | 103.268 kB | 76.583 kB | +| `gzip -9` | 17.902 kB | 13.780 kB | 12.974 kB | +| `brotli -Z` | 15.797 kB | 11.693 kB | 10.976 kB | + +Roughly 6% smaller compressed, but don't write off the ≈20% uncompressed savings either. [Some browser caches decompress before store](https://blogs.msdn.microsoft.com/ieinternals/2014/10/21/compressing-the-web/), and parsing time/memory usage scale linearly with uncompressed filesize. + + +Usage +----- + +```js +var svgToMiniDataURI = require('mini-svg-data-uri'); + +var svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path d="M22 38V51L32 32l19-19v12C44 26 43 10 38 0 52 15 49 39 22 38z"/></svg>'; + +var optimizedSVGDataURI = svgToMiniDataURI(svg); +// "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3e%3cpath d='M22 38V51L32 32l19-19v12C44 26 43 10 38 0 52 15 49 39 22 38z'/%3e%3c/svg%3e" +``` + +You can also [try it in your browser at RunKit](https://npm.runkit.com/mini-svg-data-uri). + +### CLI + +If you have it installed globally, or as some kind of dependency inside your project’s directory: + +```sh +mini-svg-data-uri file.svg # writes to stdout +mini-svg-data-uri file.svg file.svg.uri # writes to the given output filename +``` + +Use `--help` for more info. + +### Warning + +* This **does not optimize the SVG source file**. You’ll want [svgo](https://github.com/svg/svgo) or its brother [SVGOMG](https://jakearchibald.github.io/svgomg/) for that. + +* The default output **does not work inside `srcset` attributes**. Use the `.toSrcset` method for that: + + ```js + var srcsetExample = html` + <picture> + <source srcset="${svgToMiniDataURI.toSrcset(svg)}"> + <img src="${svgToMiniDataURI(svg)}"> + </picture>`; + ``` + +* The resulting Data URI should be wrapped with double quotes: `url("…")`, `<img src="…">`, etc. + +* This might change or break SVGs that use `"` in character data, like inside `<text>` or `aria-label` or something. Try curly quotes (`“”`) or `&quot;` instead. + + +FAQ +--- + +### Don’t you need a `charset` in the MIME Type? + +`charset` does nothing for Data URIs. The URI can only be the encoding of its parent file — it’s included in it! + +### Why lowercase the URL-encoded hex pairs? + +It compresses slightly better. No, really. Using the same files from earlier: + +| Compression | Uppercase (`%AF`) | Lowercase (`%af`) | +|-------------|------------------:|------------------:| +| `gzip -9` | 12.978 kB | 12.974 kB | +| `brotli -Z` | 10.988 kB | 10.976 kB | + +I did say *slightly*. + + +Browser support +--------------- + +* Internet Explorer 9 and up, including Edge +* Firefox, Safari, Chrome, whatever else uses their engines +* Android WebKit 3+ +* Opera Mini’s server-side Presto diff --git a/tools/ui/node_modules/mini-svg-data-uri/cli.js b/tools/ui/node_modules/mini-svg-data-uri/cli.js new file mode 100644 index 0000000000000000000000000000000000000000..c5a47dd7b44c9606a8985d0ef6fd44999e422a0f --- /dev/null +++ b/tools/ui/node_modules/mini-svg-data-uri/cli.js @@ -0,0 +1,41 @@ +#!/usr/bin/env node + +let help = ` +Usage: mini-svg-data-uri <source> [dest] + +Options: +-v, --version Output the version number +-h, --help Display help for command + +Examples: + mini-svg-data-uri file.svg Write to stdout + mini-svg-data-uri icon.svg icon.uri Write to file +`; + +let [source, dest] = process.argv.slice(2); + +switch (source) { + case '-h': + case '--help': + case undefined: + console.log(help); + process.exit(); + + case '-v': + case '--version': + console.log(require('./package').version); + process.exit(); +} + +const fs = require('fs'); +const svgToMiniDataURI = require('.'); + +fs.readFile(source, 'utf8', (err, data) => { + if (err) { + console.error(err.message); + console.log(help); + process.exit(1); + } + const out = svgToMiniDataURI(data); + dest ? fs.writeFileSync(dest, out) : console.log(out); +}); diff --git a/tools/ui/node_modules/mini-svg-data-uri/index.d.ts b/tools/ui/node_modules/mini-svg-data-uri/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1f268693f2493a2500811103ebc3e078e3776d4 --- /dev/null +++ b/tools/ui/node_modules/mini-svg-data-uri/index.d.ts @@ -0,0 +1,7 @@ +declare function svgToTinyDataUri(svgString: string): string; + +declare namespace svgToTinyDataUri { + function toSrcset(svgString: string): string; +} + +export = svgToTinyDataUri; \ No newline at end of file diff --git a/tools/ui/node_modules/mini-svg-data-uri/index.js b/tools/ui/node_modules/mini-svg-data-uri/index.js new file mode 100644 index 0000000000000000000000000000000000000000..971cc38e33dfe2418fb0b312412007f9593642d6 --- /dev/null +++ b/tools/ui/node_modules/mini-svg-data-uri/index.js @@ -0,0 +1,55 @@ +var shorterNames = require('./shorter-css-color-names'); +var REGEX = { + whitespace: /\s+/g, + urlHexPairs: /%[\dA-F]{2}/g, + quotes: /"/g, +} + +function collapseWhitespace(str) { + return str.trim().replace(REGEX.whitespace, ' '); +} + +function dataURIPayload(string) { + return encodeURIComponent(string) + .replace(REGEX.urlHexPairs, specialHexEncode); +} + +// `#` gets converted to `%23`, so quite a few CSS named colors are shorter than +// their equivalent URL-encoded hex codes. +function colorCodeToShorterNames(string) { + Object.keys(shorterNames).forEach(function(key) { + if (shorterNames[key].test(string)) { + string = string.replace(shorterNames[key], key); + } + }); + + return string; +} + +function specialHexEncode(match) { + switch (match) { // Browsers tolerate these characters, and they're frequent + case '%20': return ' '; + case '%3D': return '='; + case '%3A': return ':'; + case '%2F': return '/'; + default: return match.toLowerCase(); // compresses better + } +} + +function svgToTinyDataUri(svgString) { + if (typeof svgString !== 'string') { + throw new TypeError('Expected a string, but received ' + typeof svgString); + } + // Strip the Byte-Order Mark if the SVG has one + if (svgString.charCodeAt(0) === 0xfeff) { svgString = svgString.slice(1) } + + var body = colorCodeToShorterNames(collapseWhitespace(svgString)) + .replace(REGEX.quotes, "'"); + return 'data:image/svg+xml,' + dataURIPayload(body); +} + +svgToTinyDataUri.toSrcset = function toSrcset(svgString) { + return svgToTinyDataUri(svgString).replace(/ /g, '%20'); +} + +module.exports = svgToTinyDataUri; diff --git a/tools/ui/node_modules/mini-svg-data-uri/index.test-d.ts b/tools/ui/node_modules/mini-svg-data-uri/index.test-d.ts new file mode 100644 index 0000000000000000000000000000000000000000..740b215ead2e9e6f2fd78761fac0cdb45c386b9f --- /dev/null +++ b/tools/ui/node_modules/mini-svg-data-uri/index.test-d.ts @@ -0,0 +1,5 @@ +import svgToTinyDataUri from "."; + +svgToTinyDataUri('xx'); + +svgToTinyDataUri.toSrcset('xxx'); \ No newline at end of file diff --git a/tools/ui/node_modules/mini-svg-data-uri/package.json b/tools/ui/node_modules/mini-svg-data-uri/package.json new file mode 100644 index 0000000000000000000000000000000000000000..da3b9cc70dd9d50e06598af428f6e0dc303ac56d --- /dev/null +++ b/tools/ui/node_modules/mini-svg-data-uri/package.json @@ -0,0 +1,26 @@ +{ + "name": "mini-svg-data-uri", + "version": "1.4.4", + "description": "Small, efficient encoding of SVG data URIs for CSS, HTML, etc.", + "main": "index.js", + "types": "index.d.ts", + "bin": "cli.js", + "repository": { + "type": "git", + "url": "git+https://github.com/tigt/mini-svg-data-uri.git" + }, + "keywords": [ + "svg", + "url", + "data", + "uri", + "minification", + "url encoding" + ], + "author": "Taylor “Tigt” Hunt <holla@ti.gt> (https://ti.gt/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/tigt/mini-svg-data-uri/issues" + }, + "homepage": "https://github.com/tigt/mini-svg-data-uri#readme" +} diff --git a/tools/ui/node_modules/mini-svg-data-uri/shorter-css-color-names.js b/tools/ui/node_modules/mini-svg-data-uri/shorter-css-color-names.js new file mode 100644 index 0000000000000000000000000000000000000000..5e93f5d93844677bf5f60e71a85ea01e32b3e0d2 --- /dev/null +++ b/tools/ui/node_modules/mini-svg-data-uri/shorter-css-color-names.js @@ -0,0 +1,56 @@ +module.exports = { + aqua: /#00ffff(ff)?(?!\w)|#0ff(f)?(?!\w)/gi, + azure: /#f0ffff(ff)?(?!\w)/gi, + beige: /#f5f5dc(ff)?(?!\w)/gi, + bisque: /#ffe4c4(ff)?(?!\w)/gi, + black: /#000000(ff)?(?!\w)|#000(f)?(?!\w)/gi, + blue: /#0000ff(ff)?(?!\w)|#00f(f)?(?!\w)/gi, + brown: /#a52a2a(ff)?(?!\w)/gi, + coral: /#ff7f50(ff)?(?!\w)/gi, + cornsilk: /#fff8dc(ff)?(?!\w)/gi, + crimson: /#dc143c(ff)?(?!\w)/gi, + cyan: /#00ffff(ff)?(?!\w)|#0ff(f)?(?!\w)/gi, + darkblue: /#00008b(ff)?(?!\w)/gi, + darkcyan: /#008b8b(ff)?(?!\w)/gi, + darkgrey: /#a9a9a9(ff)?(?!\w)/gi, + darkred: /#8b0000(ff)?(?!\w)/gi, + deeppink: /#ff1493(ff)?(?!\w)/gi, + dimgrey: /#696969(ff)?(?!\w)/gi, + gold: /#ffd700(ff)?(?!\w)/gi, + green: /#008000(ff)?(?!\w)/gi, + grey: /#808080(ff)?(?!\w)/gi, + honeydew: /#f0fff0(ff)?(?!\w)/gi, + hotpink: /#ff69b4(ff)?(?!\w)/gi, + indigo: /#4b0082(ff)?(?!\w)/gi, + ivory: /#fffff0(ff)?(?!\w)/gi, + khaki: /#f0e68c(ff)?(?!\w)/gi, + lavender: /#e6e6fa(ff)?(?!\w)/gi, + lime: /#00ff00(ff)?(?!\w)|#0f0(f)?(?!\w)/gi, + linen: /#faf0e6(ff)?(?!\w)/gi, + maroon: /#800000(ff)?(?!\w)/gi, + moccasin: /#ffe4b5(ff)?(?!\w)/gi, + navy: /#000080(ff)?(?!\w)/gi, + oldlace: /#fdf5e6(ff)?(?!\w)/gi, + olive: /#808000(ff)?(?!\w)/gi, + orange: /#ffa500(ff)?(?!\w)/gi, + orchid: /#da70d6(ff)?(?!\w)/gi, + peru: /#cd853f(ff)?(?!\w)/gi, + pink: /#ffc0cb(ff)?(?!\w)/gi, + plum: /#dda0dd(ff)?(?!\w)/gi, + purple: /#800080(ff)?(?!\w)/gi, + red: /#ff0000(ff)?(?!\w)|#f00(f)?(?!\w)/gi, + salmon: /#fa8072(ff)?(?!\w)/gi, + seagreen: /#2e8b57(ff)?(?!\w)/gi, + seashell: /#fff5ee(ff)?(?!\w)/gi, + sienna: /#a0522d(ff)?(?!\w)/gi, + silver: /#c0c0c0(ff)?(?!\w)/gi, + skyblue: /#87ceeb(ff)?(?!\w)/gi, + snow: /#fffafa(ff)?(?!\w)/gi, + tan: /#d2b48c(ff)?(?!\w)/gi, + teal: /#008080(ff)?(?!\w)/gi, + thistle: /#d8bfd8(ff)?(?!\w)/gi, + tomato: /#ff6347(ff)?(?!\w)/gi, + violet: /#ee82ee(ff)?(?!\w)/gi, + wheat: /#f5deb3(ff)?(?!\w)/gi, + white: /#ffffff(ff)?(?!\w)|#fff(f)?(?!\w)/gi, +}; diff --git a/tools/ui/node_modules/minimatch/LICENSE b/tools/ui/node_modules/minimatch/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..19129e315fe593965a2fdd50ec0d1253bcbd2ece --- /dev/null +++ b/tools/ui/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/tools/ui/node_modules/minimatch/README.md b/tools/ui/node_modules/minimatch/README.md new file mode 100644 index 0000000000000000000000000000000000000000..60d885028ce51c504d72635b1e6e7714d464a93e --- /dev/null +++ b/tools/ui/node_modules/minimatch/README.md @@ -0,0 +1,267 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://travis-ci.org/isaacs/minimatch.svg?branch=master)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Important Security Consideration! + +> [!WARNING] +> This library uses JavaScript regular expressions. Please read +> the following warning carefully, and be thoughtful about what +> you provide to this library in production systems. + +_Any_ library in JavaScript that deals with matching string +patterns using regular expressions will be subject to +[ReDoS](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS) +if the pattern is generated using untrusted input. + +Efforts have been made to mitigate risk as much as is feasible in +such a library, providing maximum recursion depths and so forth, +but these measures can only ultimately protect against accidents, +not malice. A dedicated attacker can _always_ find patterns that +cannot be defended against by a bash-compatible glob pattern +matching system that uses JavaScript regular expressions. + +To be extremely clear: + +> [!WARNING] +> **If you create a system where you take user input, and use +> that input as the source of a Regular Expression pattern, in +> this or any extant glob matcher in JavaScript, you will be +> pwned.** + +A future version of this library _may_ use a different matching +algorithm which does not exhibit backtracking problems. If and +when that happens, it will likely be a sweeping change, and those +improvements will **not** be backported to legacy versions. + +In the near term, it is not reasonable to continue to play +whack-a-mole with security advisories, and so any future ReDoS +reports will be considered "working as intended", and resolved +entirely by this warning. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + +### partial + +Compare a partial path to a pattern. As long as the parts of the path that +are present are not contradicted by the pattern, it will be treated as a +match. This is useful in applications where you're walking through a +folder structure, and don't yet have the full path, but want to ensure that +you do not walk down paths that can never be a match. + +For example, + +```js +minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d +minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d +minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a +``` + +### allowWindowsEscape + +Windows path separator `\` is by default converted to `/`, which +prohibits the usage of `\` as a escape character. This flag skips that +behavior and allows using the escape character. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/tools/ui/node_modules/minimatch/minimatch.js b/tools/ui/node_modules/minimatch/minimatch.js new file mode 100644 index 0000000000000000000000000000000000000000..2e4a058a130dceebf83a7bd435f5d22b765ac836 --- /dev/null +++ b/tools/ui/node_modules/minimatch/minimatch.js @@ -0,0 +1,1005 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = (function () { try { return require('path') } catch (e) {}}()) || { + sep: '/' +} +minimatch.sep = path.sep + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + b = b || {} + var t = {} + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + m.Minimatch.defaults = function defaults (options) { + return orig.defaults(ext(def, options)).Minimatch + } + + m.filter = function filter (pattern, options) { + return orig.filter(pattern, ext(def, options)) + } + + m.defaults = function defaults (options) { + return orig.defaults(ext(def, options)) + } + + m.makeRe = function makeRe (pattern, options) { + return orig.makeRe(pattern, ext(def, options)) + } + + m.braceExpand = function braceExpand (pattern, options) { + return orig.braceExpand(pattern, ext(def, options)) + } + + m.match = function (list, pattern, options) { + return orig.match(list, pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + assertValidPattern(pattern) + + if (!options) options = {} + + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (!options.allowWindowsEscape && path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.maxGlobstarRecursion = options.maxGlobstarRecursion !== undefined + ? options.maxGlobstarRecursion : 200 + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + assertValidPattern(pattern) + + // Thanks to Yeting Li <https://github.com/yetingli> for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +var MAX_PATTERN_LENGTH = 1024 * 64 +var assertValidPattern = function (pattern) { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') + } + + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + assertValidPattern(pattern) + + var options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + /* istanbul ignore next */ + case '/': { + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + } + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // coalesce consecutive non-globstar * characters + if (c === '*' && stateChar === '*') continue + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:<pattern>)<type> + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '[': case '.': case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = function match (f, partial) { + if (typeof partial === 'undefined') partial = this.partial + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + if (pattern.indexOf(GLOBSTAR) !== -1) { + return this._matchGlobstar(file, pattern, partial, 0, 0) + } + return this._matchOne(file, pattern, partial, 0, 0) +} + +Minimatch.prototype._matchGlobstar = function (file, pattern, partial, fileIndex, patternIndex) { + var i + + // find first globstar from patternIndex + var firstgs = -1 + for (i = patternIndex; i < pattern.length; i++) { + if (pattern[i] === GLOBSTAR) { firstgs = i; break } + } + + // find last globstar + var lastgs = -1 + for (i = pattern.length - 1; i >= 0; i--) { + if (pattern[i] === GLOBSTAR) { lastgs = i; break } + } + + var head = pattern.slice(patternIndex, firstgs) + var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs) + var tail = partial ? [] : pattern.slice(lastgs + 1) + + // check the head + if (head.length) { + var fileHead = file.slice(fileIndex, fileIndex + head.length) + if (!this._matchOne(fileHead, head, partial, 0, 0)) { + return false + } + fileIndex += head.length + } + + // check the tail + var fileTailMatch = 0 + if (tail.length) { + if (tail.length + fileIndex > file.length) return false + + var tailStart = file.length - tail.length + if (this._matchOne(file, tail, partial, tailStart, 0)) { + fileTailMatch = tail.length + } else { + // affordance for stuff like a/**/* matching a/b/ + if (file[file.length - 1] !== '' || + fileIndex + tail.length === file.length) { + return false + } + tailStart-- + if (!this._matchOne(file, tail, partial, tailStart, 0)) { + return false + } + fileTailMatch = tail.length + 1 + } + } + + // if body is empty (single ** between head and tail) + if (!body.length) { + var sawSome = !!fileTailMatch + for (i = fileIndex; i < file.length - fileTailMatch; i++) { + var f = String(file[i]) + sawSome = true + if (f === '.' || f === '..' || + (!this.options.dot && f.charAt(0) === '.')) { + return false + } + } + return partial || sawSome + } + + // split body into segments at each GLOBSTAR + var bodySegments = [[[], 0]] + var currentBody = bodySegments[0] + var nonGsParts = 0 + var nonGsPartsSums = [0] + for (var bi = 0; bi < body.length; bi++) { + var b = body[bi] + if (b === GLOBSTAR) { + nonGsPartsSums.push(nonGsParts) + currentBody = [[], 0] + bodySegments.push(currentBody) + } else { + currentBody[0].push(b) + nonGsParts++ + } + } + + var idx = bodySegments.length - 1 + var fileLength = file.length - fileTailMatch + for (var si = 0; si < bodySegments.length; si++) { + bodySegments[si][1] = fileLength - + (nonGsPartsSums[idx--] + bodySegments[si][0].length) + } + + return !!this._matchGlobStarBodySections( + file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch + ) +} + +// return false for "nope, not matching" +// return null for "not matching, cannot keep trying" +Minimatch.prototype._matchGlobStarBodySections = function ( + file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail +) { + var bs = bodySegments[bodyIndex] + if (!bs) { + // just make sure there are no bad dots + for (var i = fileIndex; i < file.length; i++) { + sawTail = true + var f = file[i] + if (f === '.' || f === '..' || + (!this.options.dot && f.charAt(0) === '.')) { + return false + } + } + return sawTail + } + + var body = bs[0] + var after = bs[1] + while (fileIndex <= after) { + var m = this._matchOne( + file.slice(0, fileIndex + body.length), + body, + partial, + fileIndex, + 0 + ) + // if limit exceeded, no match. intentional false negative, + // acceptable break in correctness for security. + if (m && globStarDepth < this.maxGlobstarRecursion) { + var sub = this._matchGlobStarBodySections( + file, bodySegments, + fileIndex + body.length, bodyIndex + 1, + partial, globStarDepth + 1, sawTail + ) + if (sub !== false) { + return sub + } + } + var f = file[fileIndex] + if (f === '.' || f === '..' || + (!this.options.dot && f.charAt(0) === '.')) { + return false + } + fileIndex++ + } + return partial || null +} + +Minimatch.prototype._matchOne = function (file, pattern, partial, fileIndex, patternIndex) { + var fi, pi, fl, pl + for ( + fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++ + ) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false || p === GLOBSTAR) return false + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/tools/ui/node_modules/minimatch/package.json b/tools/ui/node_modules/minimatch/package.json new file mode 100644 index 0000000000000000000000000000000000000000..563d2184370b69bad91039364f9543c88a64a158 --- /dev/null +++ b/tools/ui/node_modules/minimatch/package.json @@ -0,0 +1,33 @@ +{ + "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)", + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "3.1.5", + "publishConfig": { + "tag": "legacy-v3" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "devDependencies": { + "tap": "^15.1.6" + }, + "license": "ISC", + "files": [ + "minimatch.js" + ] +} diff --git a/tools/ui/node_modules/minimist/.eslintrc b/tools/ui/node_modules/minimist/.eslintrc new file mode 100644 index 0000000000000000000000000000000000000000..bd1a5e046b4148dfc6bfd15c8aa69c81ae809a28 --- /dev/null +++ b/tools/ui/node_modules/minimist/.eslintrc @@ -0,0 +1,29 @@ +{ + "root": true, + + "extends": "@ljharb/eslint-config/node/0.4", + + "rules": { + "array-element-newline": 0, + "complexity": 0, + "func-style": [2, "declaration"], + "max-lines-per-function": 0, + "max-nested-callbacks": 1, + "max-statements-per-line": 1, + "max-statements": 0, + "multiline-comment-style": 0, + "no-continue": 1, + "no-param-reassign": 1, + "no-restricted-syntax": 1, + "object-curly-newline": 0, + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "camelcase": 0, + }, + }, + ] +} diff --git a/tools/ui/node_modules/minimist/.github/FUNDING.yml b/tools/ui/node_modules/minimist/.github/FUNDING.yml new file mode 100644 index 0000000000000000000000000000000000000000..a9366222e92a9f9a7a2a4c4cf7cf0f011510924d --- /dev/null +++ b/tools/ui/node_modules/minimist/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/minimist +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/tools/ui/node_modules/minimist/.nycrc b/tools/ui/node_modules/minimist/.nycrc new file mode 100644 index 0000000000000000000000000000000000000000..55c3d29367a4216abea3dc5eaa48b59826da355b --- /dev/null +++ b/tools/ui/node_modules/minimist/.nycrc @@ -0,0 +1,14 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "example", + "test" + ] +} diff --git a/tools/ui/node_modules/minimist/CHANGELOG.md b/tools/ui/node_modules/minimist/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..c9a1e15e6c2fe73a0ebf35040fef031b46437ba6 --- /dev/null +++ b/tools/ui/node_modules/minimist/CHANGELOG.md @@ -0,0 +1,298 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.8](https://github.com/minimistjs/minimist/compare/v1.2.7...v1.2.8) - 2023-02-09 + +### Merged + +- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17) +- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12) +- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10) + +### Fixed + +- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] Fix long option followed by single dash [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9) +- [Fix] Fix handling of short option with non-trivial equals [`#5`](https://github.com/minimistjs/minimist/issues/5) +- [Tests] Remove duplicate test [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] opt.string works with multiple aliases [`#9`](https://github.com/minimistjs/minimist/issues/9) + +### Commits + +- Merge tag 'v0.2.3' [`a026794`](https://github.com/minimistjs/minimist/commit/a0267947c7870fc5847cf2d437fbe33f392767da) +- [eslint] fix indentation and whitespace [`5368ca4`](https://github.com/minimistjs/minimist/commit/5368ca4147e974138a54cc0dc4cea8f756546b70) +- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7) +- [eslint] more cleanup [`62fde7d`](https://github.com/minimistjs/minimist/commit/62fde7d935f83417fb046741531a9e2346a36976) +- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1) +- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c) +- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91) +- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4) +- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982) +- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0) +- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b) +- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa) +- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e) +- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf) +- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`3124ed3`](https://github.com/minimistjs/minimist/commit/3124ed3e46306301ebb3c834874ce0241555c2c4) +- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6) +- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c) +- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a) +- [actions] Avoid 0.6 tests due to build failures [`ba92fe6`](https://github.com/minimistjs/minimist/commit/ba92fe6ebbdc0431cca9a2ea8f27beb492f5e4ec) +- [Dev Deps] update `tape` [`950eaa7`](https://github.com/minimistjs/minimist/commit/950eaa74f112e04d23e9c606c67472c46739b473) +- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b) +- Merge tag 'v0.2.2' [`980d7ac`](https://github.com/minimistjs/minimist/commit/980d7ac61a0b4bd552711251ac107d506b23e41f) + +## [v1.2.7](https://github.com/minimistjs/minimist/compare/v1.2.6...v1.2.7) - 2022-10-10 + +### Commits + +- [meta] add `auto-changelog` [`0ebf4eb`](https://github.com/minimistjs/minimist/commit/0ebf4ebcd5f7787a5524d31a849ef41316b83c3c) +- [actions] add reusable workflows [`e115b63`](https://github.com/minimistjs/minimist/commit/e115b63fa9d3909f33b00a2db647ff79068388de) +- [eslint] add eslint; rules to enable later are warnings [`f58745b`](https://github.com/minimistjs/minimist/commit/f58745b9bb84348e1be72af7dbba5840c7c13013) +- [Dev Deps] switch from `covert` to `nyc` [`ab03356`](https://github.com/minimistjs/minimist/commit/ab033567b9c8b31117cb026dc7f1e592ce455c65) +- [readme] rename and add badges [`236f4a0`](https://github.com/minimistjs/minimist/commit/236f4a07e4ebe5ee44f1496ec6974991ab293ffd) +- [meta] create FUNDING.yml; add `funding` in package.json [`783a49b`](https://github.com/minimistjs/minimist/commit/783a49bfd47e8335d3098a8cac75662cf71eb32a) +- [meta] use `npmignore` to autogenerate an npmignore file [`f81ece6`](https://github.com/minimistjs/minimist/commit/f81ece6aaec2fa14e69ff4f1e0407a8c4e2635a2) +- Only apps should have lockfiles [`56cad44`](https://github.com/minimistjs/minimist/commit/56cad44c7f879b9bb5ec18fcc349308024a89bfc) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`49c5f9f`](https://github.com/minimistjs/minimist/commit/49c5f9fb7e6a92db9eb340cc679de92fb3aacded) +- [Tests] add `aud` in `posttest` [`228ae93`](https://github.com/minimistjs/minimist/commit/228ae938f3cd9db9dfd8bd7458b076a7b2aef280) +- [meta] add `safe-publish-latest` [`01fc23f`](https://github.com/minimistjs/minimist/commit/01fc23f5104f85c75059972e01dd33796ab529ff) +- [meta] update repo URLs [`6b164c7`](https://github.com/minimistjs/minimist/commit/6b164c7d68e0b6bf32f894699effdfb7c63041dd) + +## [v1.2.6](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.6) - 2022-03-21 + +### Commits + +- test from prototype pollution PR [`bc8ecee`](https://github.com/minimistjs/minimist/commit/bc8ecee43875261f4f17eb20b1243d3ed15e70eb) +- isConstructorOrProto adapted from PR [`c2b9819`](https://github.com/minimistjs/minimist/commit/c2b981977fa834b223b408cfb860f933c9811e4d) +- security notice for additional prototype pollution issue [`ef88b93`](https://github.com/minimistjs/minimist/commit/ef88b9325f77b5ee643ccfc97e2ebda577e4c4e2) + +## [v1.2.5](https://github.com/minimistjs/minimist/compare/v1.2.4...v1.2.5) - 2020-03-12 + +## [v1.2.4](https://github.com/minimistjs/minimist/compare/v1.2.3...v1.2.4) - 2020-03-11 + +### Commits + +- security notice [`4cf1354`](https://github.com/minimistjs/minimist/commit/4cf1354839cb972e38496d35e12f806eea92c11f) +- additional test for constructor prototype pollution [`1043d21`](https://github.com/minimistjs/minimist/commit/1043d212c3caaf871966e710f52cfdf02f9eea4b) + +## [v1.2.3](https://github.com/minimistjs/minimist/compare/v1.2.2...v1.2.3) - 2020-03-10 + +### Commits + +- more failing proto pollution tests [`13c01a5`](https://github.com/minimistjs/minimist/commit/13c01a5327736903704984b7f65616b8476850cc) +- even more aggressive checks for protocol pollution [`38a4d1c`](https://github.com/minimistjs/minimist/commit/38a4d1caead72ef99e824bb420a2528eec03d9ab) + +## [v1.2.2](https://github.com/minimistjs/minimist/compare/v1.2.1...v1.2.2) - 2020-03-10 + +### Commits + +- failing test for protocol pollution [`0efed03`](https://github.com/minimistjs/minimist/commit/0efed0340ec8433638758f7ca0c77cb20a0bfbab) +- cleanup [`67d3722`](https://github.com/minimistjs/minimist/commit/67d3722413448d00a62963d2d30c34656a92d7e2) +- console.dir -&gt; console.log [`47acf72`](https://github.com/minimistjs/minimist/commit/47acf72c715a630bf9ea013867f47f1dd69dfc54) +- don't assign onto __proto__ [`63e7ed0`](https://github.com/minimistjs/minimist/commit/63e7ed05aa4b1889ec2f3b196426db4500cbda94) + +## [v1.2.1](https://github.com/minimistjs/minimist/compare/v1.2.0...v1.2.1) - 2020-03-10 + +### Merged + +- move the `opts['--']` example back where it belongs [`#63`](https://github.com/minimistjs/minimist/pull/63) + +### Commits + +- add test [`6be5dae`](https://github.com/minimistjs/minimist/commit/6be5dae35a32a987bcf4137fcd6c19c5200ee909) +- fix bad boolean regexp [`ac3fc79`](https://github.com/minimistjs/minimist/commit/ac3fc796e63b95128fdbdf67ea7fad71bd59aa76) + +## [v1.2.0](https://github.com/minimistjs/minimist/compare/v1.1.3...v1.2.0) - 2015-08-24 + +### Commits + +- failing -k=v short test [`63416b8`](https://github.com/minimistjs/minimist/commit/63416b8cd1d0d70e4714564cce465a36e4dd26d7) +- kv short fix [`6bbe145`](https://github.com/minimistjs/minimist/commit/6bbe14529166245e86424f220a2321442fe88dc3) +- failing kv short test [`f72ab7f`](https://github.com/minimistjs/minimist/commit/f72ab7f4572adc52902c9b6873cc969192f01b10) +- fixed kv test [`f5a48c3`](https://github.com/minimistjs/minimist/commit/f5a48c3e50e40ca54f00c8e84de4b4d6e9897fa8) +- enforce space between arg key and value [`86b321a`](https://github.com/minimistjs/minimist/commit/86b321affe648a8e016c095a4f0efa9d9074f502) + +## [v1.1.3](https://github.com/minimistjs/minimist/compare/v1.1.2...v1.1.3) - 2015-08-06 + +### Commits + +- add failing test - boolean alias array [`0fa3c5b`](https://github.com/minimistjs/minimist/commit/0fa3c5b3dd98551ddecf5392831b4c21211743fc) +- fix boolean values with multiple aliases [`9c0a6e7`](https://github.com/minimistjs/minimist/commit/9c0a6e7de25a273b11bbf9a7464f0bd833779795) + +## [v1.1.2](https://github.com/minimistjs/minimist/compare/v1.1.1...v1.1.2) - 2015-07-22 + +### Commits + +- Convert boolean arguments to boolean values [`8f3dc27`](https://github.com/minimistjs/minimist/commit/8f3dc27cf833f1d54671b6d0bcb55c2fe19672a9) +- use non-ancient npm, node 0.12 and iojs [`61ed1d0`](https://github.com/minimistjs/minimist/commit/61ed1d034b9ec7282764ce76f3992b1a0b4906ae) +- an older npm for 0.8 [`25cf778`](https://github.com/minimistjs/minimist/commit/25cf778b1220e7838a526832ad6972f75244054f) + +## [v1.1.1](https://github.com/minimistjs/minimist/compare/v1.1.0...v1.1.1) - 2015-03-10 + +### Commits + +- check that they type of a value is a boolean, not just that it is currently set to a boolean [`6863198`](https://github.com/minimistjs/minimist/commit/6863198e36139830ff1f20ffdceaddd93f2c1db9) +- upgrade tape, fix type issues from old tape version [`806712d`](https://github.com/minimistjs/minimist/commit/806712df91604ed02b8e39aa372b84aea659ee34) +- test for setting a boolean to a null default [`8c444fe`](https://github.com/minimistjs/minimist/commit/8c444fe89384ded7d441c120915ea60620b01dd3) +- if the previous value was a boolean, without an default (or with an alias) don't make an array either [`e5f419a`](https://github.com/minimistjs/minimist/commit/e5f419a3b5b3bc3f9e5ac71b7040621af70ed2dd) + +## [v1.1.0](https://github.com/minimistjs/minimist/compare/v1.0.0...v1.1.0) - 2014-08-10 + +### Commits + +- add support for handling "unknown" options not registered with the parser. [`6f3cc5d`](https://github.com/minimistjs/minimist/commit/6f3cc5d4e84524932a6ef2ce3592acc67cdd4383) +- reformat package.json [`02ed371`](https://github.com/minimistjs/minimist/commit/02ed37115194d3697ff358e8e25e5e66bab1d9f8) +- coverage script [`e5531ba`](https://github.com/minimistjs/minimist/commit/e5531ba0479da3b8138d3d8cac545d84ccb1c8df) +- extra fn to get 100% coverage again [`a6972da`](https://github.com/minimistjs/minimist/commit/a6972da89e56bf77642f8ec05a13b6558db93498) + +## [v1.0.0](https://github.com/minimistjs/minimist/compare/v0.2.3...v1.0.0) - 2014-08-10 + +### Commits + +- added stopEarly option [`471c7e4`](https://github.com/minimistjs/minimist/commit/471c7e4a7e910fc7ad8f9df850a186daf32c64e9) +- fix list [`fef6ae7`](https://github.com/minimistjs/minimist/commit/fef6ae79c38b9dc1c49569abb7cd04eb965eac5e) + +## [v0.2.3](https://github.com/minimistjs/minimist/compare/v0.2.2...v0.2.3) - 2023-02-09 + +### Merged + +- [Fix] Fix long option followed by single dash [`#17`](https://github.com/minimistjs/minimist/pull/17) +- [Tests] Remove duplicate test [`#12`](https://github.com/minimistjs/minimist/pull/12) +- [Fix] opt.string works with multiple aliases [`#10`](https://github.com/minimistjs/minimist/pull/10) + +### Fixed + +- [Fix] Fix long option followed by single dash (#17) [`#15`](https://github.com/minimistjs/minimist/issues/15) +- [Tests] Remove duplicate test (#12) [`#8`](https://github.com/minimistjs/minimist/issues/8) +- [Fix] opt.string works with multiple aliases (#10) [`#9`](https://github.com/minimistjs/minimist/issues/9) + +### Commits + +- [eslint] fix indentation and whitespace [`e5f5067`](https://github.com/minimistjs/minimist/commit/e5f5067259ceeaf0b098d14bec910f87e58708c7) +- [eslint] more cleanup [`36ac5d0`](https://github.com/minimistjs/minimist/commit/36ac5d0d95e4947d074e5737d94814034ca335d1) +- [eslint] fix indentation [`34b0f1c`](https://github.com/minimistjs/minimist/commit/34b0f1ccaa45183c3c4f06a91f9b405180a6f982) +- isConstructorOrProto adapted from PR [`ef9153f`](https://github.com/minimistjs/minimist/commit/ef9153fc52b6cea0744b2239921c5dcae4697f11) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`098873c`](https://github.com/minimistjs/minimist/commit/098873c213cdb7c92e55ae1ef5aa1af3a8192a79) +- [Dev Deps] add missing `npmignore` dev dep [`3226afa`](https://github.com/minimistjs/minimist/commit/3226afaf09e9d127ca369742437fe6e88f752d6b) + +## [v0.2.2](https://github.com/minimistjs/minimist/compare/v0.2.1...v0.2.2) - 2022-10-10 + +### Commits + +- [meta] add `auto-changelog` [`73923d2`](https://github.com/minimistjs/minimist/commit/73923d223553fca08b1ba77e3fbc2a492862ae4c) +- [actions] add reusable workflows [`d80727d`](https://github.com/minimistjs/minimist/commit/d80727df77bfa9e631044d7f16368d8f09242c91) +- [eslint] add eslint; rules to enable later are warnings [`48bc06a`](https://github.com/minimistjs/minimist/commit/48bc06a1b41f00e9cdf183db34f7a51ba70e98d4) +- [readme] rename and add badges [`5df0fe4`](https://github.com/minimistjs/minimist/commit/5df0fe49211bd09a3636f8686a7cb3012c3e98f0) +- [Dev Deps] switch from `covert` to `nyc` [`a48b128`](https://github.com/minimistjs/minimist/commit/a48b128fdb8d427dfb20a15273f83e38d97bef07) +- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`f0fb958`](https://github.com/minimistjs/minimist/commit/f0fb958e9a1fe980cdffc436a211b0bda58f621b) +- [meta] create FUNDING.yml; add `funding` in package.json [`3639e0c`](https://github.com/minimistjs/minimist/commit/3639e0c819359a366387e425ab6eabf4c78d3caa) +- [meta] use `npmignore` to autogenerate an npmignore file [`be2e038`](https://github.com/minimistjs/minimist/commit/be2e038c342d8333b32f0fde67a0026b79c8150e) +- Only apps should have lockfiles [`282b570`](https://github.com/minimistjs/minimist/commit/282b570e7489d01b03f2d6d3dabf79cd3e5f84cf) +- [meta] add `safe-publish-latest` [`4b927de`](https://github.com/minimistjs/minimist/commit/4b927de696d561c636b4f43bf49d4597cb36d6d6) +- [Tests] add `aud` in `posttest` [`b32d9bd`](https://github.com/minimistjs/minimist/commit/b32d9bd0ab340f4e9f8c3a97ff2a4424f25fab8c) +- [meta] update repo URLs [`f9fdfc0`](https://github.com/minimistjs/minimist/commit/f9fdfc032c54884d9a9996a390c63cd0719bbe1a) + +## [v0.2.1](https://github.com/minimistjs/minimist/compare/v0.2.0...v0.2.1) - 2020-03-12 + +## [v0.2.0](https://github.com/minimistjs/minimist/compare/v0.1.0...v0.2.0) - 2014-06-19 + +### Commits + +- support all-boolean mode [`450a97f`](https://github.com/minimistjs/minimist/commit/450a97f6e2bc85c7a4a13185c19a818d9a5ebe69) + +## [v0.1.0](https://github.com/minimistjs/minimist/compare/v0.0.10...v0.1.0) - 2014-05-12 + +### Commits + +- Provide a mechanism to segregate -- arguments [`ce4a1e6`](https://github.com/minimistjs/minimist/commit/ce4a1e63a7e8d5ab88d2a3768adefa6af98a445a) +- documented argv['--'] [`14db0e6`](https://github.com/minimistjs/minimist/commit/14db0e6dbc6d2b9e472adaa54dad7004b364634f) +- Adding a test-case for notFlags segregation [`715c1e3`](https://github.com/minimistjs/minimist/commit/715c1e3714be223f998f6c537af6b505f0236c16) + +## [v0.0.10](https://github.com/minimistjs/minimist/compare/v0.0.9...v0.0.10) - 2014-05-11 + +### Commits + +- dedicated boolean test [`46e448f`](https://github.com/minimistjs/minimist/commit/46e448f9f513cfeb2bcc8b688b9b47ba1e515c2b) +- dedicated num test [`9bf2d36`](https://github.com/minimistjs/minimist/commit/9bf2d36f1d3b8795be90b8f7de0a937f098aa394) +- aliased values treated as strings [`1ab743b`](https://github.com/minimistjs/minimist/commit/1ab743bad4484d69f1259bed42f9531de01119de) +- cover the case of already numbers, at 100% coverage [`b2bb044`](https://github.com/minimistjs/minimist/commit/b2bb04436599d77a2ce029e8e555e25b3aa55d13) +- another test for higher coverage [`3662624`](https://github.com/minimistjs/minimist/commit/3662624be976d5489d486a856849c048d13be903) + +## [v0.0.9](https://github.com/minimistjs/minimist/compare/v0.0.8...v0.0.9) - 2014-05-08 + +### Commits + +- Eliminate `longest` fn. [`824f642`](https://github.com/minimistjs/minimist/commit/824f642038d1b02ede68b6261d1d65163390929a) + +## [v0.0.8](https://github.com/minimistjs/minimist/compare/v0.0.7...v0.0.8) - 2014-02-20 + +### Commits + +- return '' if flag is string and empty [`fa63ed4`](https://github.com/minimistjs/minimist/commit/fa63ed4651a4ef4eefddce34188e0d98d745a263) +- handle joined single letters [`66c248f`](https://github.com/minimistjs/minimist/commit/66c248f0241d4d421d193b022e9e365f11178534) + +## [v0.0.7](https://github.com/minimistjs/minimist/compare/v0.0.6...v0.0.7) - 2014-02-08 + +### Commits + +- another swap of .test for .match [`d1da408`](https://github.com/minimistjs/minimist/commit/d1da40819acbe846d89a5c02721211e3c1260dde) + +## [v0.0.6](https://github.com/minimistjs/minimist/compare/v0.0.5...v0.0.6) - 2014-02-08 + +### Commits + +- use .test() instead of .match() to not crash on non-string values in the arguments array [`7e0d1ad`](https://github.com/minimistjs/minimist/commit/7e0d1add8c9e5b9b20a4d3d0f9a94d824c578da1) + +## [v0.0.5](https://github.com/minimistjs/minimist/compare/v0.0.4...v0.0.5) - 2013-09-18 + +### Commits + +- Improve '--' handling. [`b11822c`](https://github.com/minimistjs/minimist/commit/b11822c09cc9d2460f30384d12afc0b953c037a4) + +## [v0.0.4](https://github.com/minimistjs/minimist/compare/v0.0.3...v0.0.4) - 2013-09-17 + +## [v0.0.3](https://github.com/minimistjs/minimist/compare/v0.0.2...v0.0.3) - 2013-09-12 + +### Commits + +- failing test for single dash preceeding a double dash [`b465514`](https://github.com/minimistjs/minimist/commit/b465514b82c9ae28972d714facd951deb2ad762b) +- fix for the dot test [`6a095f1`](https://github.com/minimistjs/minimist/commit/6a095f1d364c8fab2d6753d2291a0649315d297a) + +## [v0.0.2](https://github.com/minimistjs/minimist/compare/v0.0.1...v0.0.2) - 2013-08-28 + +### Commits + +- allow dotted aliases & defaults [`321c33e`](https://github.com/minimistjs/minimist/commit/321c33e755485faaeb44eeb1c05d33b2e0a5a7c4) +- use a better version of ff [`e40f611`](https://github.com/minimistjs/minimist/commit/e40f61114cf7be6f7947f7b3eed345853a67dbbb) + +## [v0.0.1](https://github.com/minimistjs/minimist/compare/v0.0.0...v0.0.1) - 2013-06-25 + +### Commits + +- remove trailing commas [`6ff0fa0`](https://github.com/minimistjs/minimist/commit/6ff0fa055064f15dbe06d50b89d5173a6796e1db) + +## v0.0.0 - 2013-06-25 + +### Commits + +- half of the parse test ported [`3079326`](https://github.com/minimistjs/minimist/commit/307932601325087de6cf94188eb798ffc4f3088a) +- stripped down code and a passing test from optimist [`7cced88`](https://github.com/minimistjs/minimist/commit/7cced88d82e399d1a03ed23eb667f04d3f320d10) +- ported parse tests completely over [`9448754`](https://github.com/minimistjs/minimist/commit/944875452e0820df6830b1408c26a0f7d3e1db04) +- docs, package.json [`a5bf46a`](https://github.com/minimistjs/minimist/commit/a5bf46ac9bb3bd114a9c340276c62c1091e538d5) +- move more short tests into short.js [`503edb5`](https://github.com/minimistjs/minimist/commit/503edb5c41d89c0d40831ee517154fc13b0f18b9) +- default bool test was wrong, not the code [`1b9f5db`](https://github.com/minimistjs/minimist/commit/1b9f5db4741b49962846081b68518de824992097) +- passing long tests ripped out of parse.js [`7972c4a`](https://github.com/minimistjs/minimist/commit/7972c4aff1f4803079e1668006658e2a761a0428) +- badges [`84c0370`](https://github.com/minimistjs/minimist/commit/84c037063664d42878aace715fe6572ce01b6f3b) +- all the tests now ported, some failures [`64239ed`](https://github.com/minimistjs/minimist/commit/64239edfe92c711c4eb0da254fcdfad2a5fdb605) +- failing short test [`f8a5341`](https://github.com/minimistjs/minimist/commit/f8a534112dd1138d2fad722def56a848480c446f) +- fixed the numeric test [`6b034f3`](https://github.com/minimistjs/minimist/commit/6b034f37c79342c60083ed97fd222e16928aac51) diff --git a/tools/ui/node_modules/minimist/LICENSE b/tools/ui/node_modules/minimist/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ee27ba4b4412b0e4a05af5e3d8a005bc6681fdf3 --- /dev/null +++ b/tools/ui/node_modules/minimist/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/minimist/README.md b/tools/ui/node_modules/minimist/README.md new file mode 100644 index 0000000000000000000000000000000000000000..74da3234b4844a2d381a0c6f29f893beee5591bd --- /dev/null +++ b/tools/ui/node_modules/minimist/README.md @@ -0,0 +1,121 @@ +# minimist <sup>[![Version Badge][npm-version-svg]][package-url]</sup> + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +parse argument options + +This module is the guts of optimist's argument parser without all the +fanciful decoration. + +# example + +``` js +var argv = require('minimist')(process.argv.slice(2)); +console.log(argv); +``` + +``` +$ node example/parse.js -a beep -b boop +{ _: [], a: 'beep', b: 'boop' } +``` + +``` +$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz +{ + _: ['foo', 'bar', 'baz'], + x: 3, + y: 4, + n: 5, + a: true, + b: true, + c: true, + beep: 'boop' +} +``` + +# security + +Previous versions had a prototype pollution bug that could cause privilege +escalation in some circumstances when handling untrusted user input. + +Please use version 1.2.6 or later: + +* https://security.snyk.io/vuln/SNYK-JS-MINIMIST-2429795 (version <=1.2.5) +* https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 (version <=1.2.3) + +# methods + +``` js +var parseArgs = require('minimist') +``` + +## var argv = parseArgs(args, opts={}) + +Return an argument object `argv` populated with the array arguments from `args`. + +`argv._` contains all the arguments that didn't have an option associated with +them. + +Numeric-looking arguments will be returned as numbers unless `opts.string` or +`opts.boolean` is set for that argument name. + +Any arguments after `'--'` will not be parsed and will end up in `argv._`. + +options can be: + +* `opts.string` - a string or array of strings argument names to always treat as +strings +* `opts.boolean` - a boolean, string or array of strings to always treat as +booleans. if `true` will treat all double hyphenated arguments without equal signs +as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) +* `opts.alias` - an object mapping string names to strings or arrays of string +argument names to use as aliases +* `opts.default` - an object mapping string argument names to default values +* `opts.stopEarly` - when true, populate `argv._` with everything after the +first non-option +* `opts['--']` - when true, populate `argv._` with everything before the `--` +and `argv['--']` with everything after the `--`. Here's an example: + + ``` + > require('./')('one two three -- four five --six'.split(' '), { '--': true }) + { + _: ['one', 'two', 'three'], + '--': ['four', 'five', '--six'] + } + ``` + + Note that with `opts['--']` set, parsing for arguments still stops after the + `--`. + +* `opts.unknown` - a function which is invoked with a command line parameter not +defined in the `opts` configuration object. If the function returns `false`, the +unknown option is not added to `argv`. + +# install + +With [npm](https://npmjs.org) do: + +``` +npm install minimist +``` + +# license + +MIT + +[package-url]: https://npmjs.org/package/minimist +[npm-version-svg]: https://versionbadg.es/minimistjs/minimist.svg +[npm-badge-png]: https://nodei.co/npm/minimist.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/minimist.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/minimist.svg +[downloads-url]: https://npm-stat.com/charts.html?package=minimist +[codecov-image]: https://codecov.io/gh/minimistjs/minimist/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/minimistjs/minimist/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/minimistjs/minimist +[actions-url]: https://github.com/minimistjs/minimist/actions diff --git a/tools/ui/node_modules/minimist/example/parse.js b/tools/ui/node_modules/minimist/example/parse.js new file mode 100644 index 0000000000000000000000000000000000000000..9d90ffb2642b4caddde1ec6fb0cff2e78192bb09 --- /dev/null +++ b/tools/ui/node_modules/minimist/example/parse.js @@ -0,0 +1,4 @@ +'use strict'; + +var argv = require('../')(process.argv.slice(2)); +console.log(argv); diff --git a/tools/ui/node_modules/minimist/index.js b/tools/ui/node_modules/minimist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f020f3940e129c361dc89226efaf8775a4af8752 --- /dev/null +++ b/tools/ui/node_modules/minimist/index.js @@ -0,0 +1,263 @@ +'use strict'; + +function hasKey(obj, keys) { + var o = obj; + keys.slice(0, -1).forEach(function (key) { + o = o[key] || {}; + }); + + var key = keys[keys.length - 1]; + return key in o; +} + +function isNumber(x) { + if (typeof x === 'number') { return true; } + if ((/^0x[0-9a-f]+$/i).test(x)) { return true; } + return (/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/).test(x); +} + +function isConstructorOrProto(obj, key) { + return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__'; +} + +module.exports = function (args, opts) { + if (!opts) { opts = {}; } + + var flags = { + bools: {}, + strings: {}, + unknownFn: null, + }; + + if (typeof opts.unknown === 'function') { + flags.unknownFn = opts.unknown; + } + + if (typeof opts.boolean === 'boolean' && opts.boolean) { + flags.allBools = true; + } else { + [].concat(opts.boolean).filter(Boolean).forEach(function (key) { + flags.bools[key] = true; + }); + } + + var aliases = {}; + + function aliasIsBoolean(key) { + return aliases[key].some(function (x) { + return flags.bools[x]; + }); + } + + Object.keys(opts.alias || {}).forEach(function (key) { + aliases[key] = [].concat(opts.alias[key]); + aliases[key].forEach(function (x) { + aliases[x] = [key].concat(aliases[key].filter(function (y) { + return x !== y; + })); + }); + }); + + [].concat(opts.string).filter(Boolean).forEach(function (key) { + flags.strings[key] = true; + if (aliases[key]) { + [].concat(aliases[key]).forEach(function (k) { + flags.strings[k] = true; + }); + } + }); + + var defaults = opts.default || {}; + + var argv = { _: [] }; + + function argDefined(key, arg) { + return (flags.allBools && (/^--[^=]+$/).test(arg)) + || flags.strings[key] + || flags.bools[key] + || aliases[key]; + } + + function setKey(obj, keys, value) { + var o = obj; + for (var i = 0; i < keys.length - 1; i++) { + var key = keys[i]; + if (isConstructorOrProto(o, key)) { return; } + if (o[key] === undefined) { o[key] = {}; } + if ( + o[key] === Object.prototype + || o[key] === Number.prototype + || o[key] === String.prototype + ) { + o[key] = {}; + } + if (o[key] === Array.prototype) { o[key] = []; } + o = o[key]; + } + + var lastKey = keys[keys.length - 1]; + if (isConstructorOrProto(o, lastKey)) { return; } + if ( + o === Object.prototype + || o === Number.prototype + || o === String.prototype + ) { + o = {}; + } + if (o === Array.prototype) { o = []; } + if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') { + o[lastKey] = value; + } else if (Array.isArray(o[lastKey])) { + o[lastKey].push(value); + } else { + o[lastKey] = [o[lastKey], value]; + } + } + + function setArg(key, val, arg) { + if (arg && flags.unknownFn && !argDefined(key, arg)) { + if (flags.unknownFn(arg) === false) { return; } + } + + var value = !flags.strings[key] && isNumber(val) + ? Number(val) + : val; + setKey(argv, key.split('.'), value); + + (aliases[key] || []).forEach(function (x) { + setKey(argv, x.split('.'), value); + }); + } + + Object.keys(flags.bools).forEach(function (key) { + setArg(key, defaults[key] === undefined ? false : defaults[key]); + }); + + var notFlags = []; + + if (args.indexOf('--') !== -1) { + notFlags = args.slice(args.indexOf('--') + 1); + args = args.slice(0, args.indexOf('--')); + } + + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + var key; + var next; + + if ((/^--.+=/).test(arg)) { + // Using [\s\S] instead of . because js doesn't support the + // 'dotall' regex modifier. See: + // http://stackoverflow.com/a/1068308/13216 + var m = arg.match(/^--([^=]+)=([\s\S]*)$/); + key = m[1]; + var value = m[2]; + if (flags.bools[key]) { + value = value !== 'false'; + } + setArg(key, value, arg); + } else if ((/^--no-.+/).test(arg)) { + key = arg.match(/^--no-(.+)/)[1]; + setArg(key, false, arg); + } else if ((/^--.+/).test(arg)) { + key = arg.match(/^--(.+)/)[1]; + next = args[i + 1]; + if ( + next !== undefined + && !(/^(-|--)[^-]/).test(next) + && !flags.bools[key] + && !flags.allBools + && (aliases[key] ? !aliasIsBoolean(key) : true) + ) { + setArg(key, next, arg); + i += 1; + } else if ((/^(true|false)$/).test(next)) { + setArg(key, next === 'true', arg); + i += 1; + } else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } else if ((/^-[^-]+/).test(arg)) { + var letters = arg.slice(1, -1).split(''); + + var broken = false; + for (var j = 0; j < letters.length; j++) { + next = arg.slice(j + 2); + + if (next === '-') { + setArg(letters[j], next, arg); + continue; + } + + if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') { + setArg(letters[j], next.slice(1), arg); + broken = true; + break; + } + + if ( + (/[A-Za-z]/).test(letters[j]) + && (/-?\d+(\.\d*)?(e-?\d+)?$/).test(next) + ) { + setArg(letters[j], next, arg); + broken = true; + break; + } + + if (letters[j + 1] && letters[j + 1].match(/\W/)) { + setArg(letters[j], arg.slice(j + 2), arg); + broken = true; + break; + } else { + setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); + } + } + + key = arg.slice(-1)[0]; + if (!broken && key !== '-') { + if ( + args[i + 1] + && !(/^(-|--)[^-]/).test(args[i + 1]) + && !flags.bools[key] + && (aliases[key] ? !aliasIsBoolean(key) : true) + ) { + setArg(key, args[i + 1], arg); + i += 1; + } else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) { + setArg(key, args[i + 1] === 'true', arg); + i += 1; + } else { + setArg(key, flags.strings[key] ? '' : true, arg); + } + } + } else { + if (!flags.unknownFn || flags.unknownFn(arg) !== false) { + argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg)); + } + if (opts.stopEarly) { + argv._.push.apply(argv._, args.slice(i + 1)); + break; + } + } + } + + Object.keys(defaults).forEach(function (k) { + if (!hasKey(argv, k.split('.'))) { + setKey(argv, k.split('.'), defaults[k]); + + (aliases[k] || []).forEach(function (x) { + setKey(argv, x.split('.'), defaults[k]); + }); + } + }); + + if (opts['--']) { + argv['--'] = notFlags.slice(); + } else { + notFlags.forEach(function (k) { + argv._.push(k); + }); + } + + return argv; +}; diff --git a/tools/ui/node_modules/minimist/package.json b/tools/ui/node_modules/minimist/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c10a3344411197a716883caad07f0319f5d69b89 --- /dev/null +++ b/tools/ui/node_modules/minimist/package.json @@ -0,0 +1,75 @@ +{ + "name": "minimist", + "version": "1.2.8", + "description": "parse argument options", + "main": "index.js", + "devDependencies": { + "@ljharb/eslint-config": "^21.0.1", + "aud": "^2.0.2", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.6.3" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=auto", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/6..latest", + "ff/5", + "firefox/latest", + "chrome/10", + "chrome/latest", + "safari/5.1", + "safari/latest", + "opera/12" + ] + }, + "repository": { + "type": "git", + "url": "git://github.com/minimistjs/minimist.git" + }, + "homepage": "https://github.com/minimistjs/minimist", + "keywords": [ + "argv", + "getopt", + "parser", + "optimist" + ], + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/tools/ui/node_modules/minimist/test/all_bool.js b/tools/ui/node_modules/minimist/test/all_bool.js new file mode 100644 index 0000000000000000000000000000000000000000..befa0c99769080972260dac9e4a77630857000f2 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/all_bool.js @@ -0,0 +1,34 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('flag boolean true (default all --args to boolean)', function (t) { + var argv = parse(['moo', '--honk', 'cow'], { + boolean: true, + }); + + t.deepEqual(argv, { + honk: true, + _: ['moo', 'cow'], + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); + +test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { + var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { + boolean: true, + }); + + t.deepEqual(argv, { + honk: true, + tacos: 'good', + p: 55, + _: ['moo', 'cow'], + }); + + t.deepEqual(typeof argv.honk, 'boolean'); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/bool.js b/tools/ui/node_modules/minimist/test/bool.js new file mode 100644 index 0000000000000000000000000000000000000000..e58d47e442ce127bfe5703b6b64d14c3e4511223 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/bool.js @@ -0,0 +1,177 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('flag boolean default false', function (t) { + var argv = parse(['moo'], { + boolean: ['t', 'verbose'], + default: { verbose: false, t: false }, + }); + + t.deepEqual(argv, { + verbose: false, + t: false, + _: ['moo'], + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); + +}); + +test('boolean groups', function (t) { + var argv = parse(['-x', '-z', 'one', 'two', 'three'], { + boolean: ['x', 'y', 'z'], + }); + + t.deepEqual(argv, { + x: true, + y: false, + z: true, + _: ['one', 'two', 'three'], + }); + + t.deepEqual(typeof argv.x, 'boolean'); + t.deepEqual(typeof argv.y, 'boolean'); + t.deepEqual(typeof argv.z, 'boolean'); + t.end(); +}); +test('boolean and alias with chainable api', function (t) { + var aliased = ['-h', 'derp']; + var regular = ['--herp', 'derp']; + var aliasedArgv = parse(aliased, { + boolean: 'herp', + alias: { h: 'herp' }, + }); + var propertyArgv = parse(regular, { + boolean: 'herp', + alias: { h: 'herp' }, + }); + var expected = { + herp: true, + h: true, + _: ['derp'], + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias with options hash', function (t) { + var aliased = ['-h', 'derp']; + var regular = ['--herp', 'derp']; + var opts = { + alias: { h: 'herp' }, + boolean: 'herp', + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + _: ['derp'], + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +test('boolean and alias array with options hash', function (t) { + var aliased = ['-h', 'derp']; + var regular = ['--herp', 'derp']; + var alt = ['--harp', 'derp']; + var opts = { + alias: { h: ['herp', 'harp'] }, + boolean: 'h', + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var altPropertyArgv = parse(alt, opts); + var expected = { + harp: true, + herp: true, + h: true, + _: ['derp'], + }; + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.same(altPropertyArgv, expected); + t.end(); +}); + +test('boolean and alias using explicit true', function (t) { + var aliased = ['-h', 'true']; + var regular = ['--herp', 'true']; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + }; + var aliasedArgv = parse(aliased, opts); + var propertyArgv = parse(regular, opts); + var expected = { + herp: true, + h: true, + _: [], + }; + + t.same(aliasedArgv, expected); + t.same(propertyArgv, expected); + t.end(); +}); + +// regression, see https://github.com/substack/node-optimist/issues/71 +test('boolean and --x=true', function (t) { + var parsed = parse(['--boool', '--other=true'], { + boolean: 'boool', + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'true'); + + parsed = parse(['--boool', '--other=false'], { + boolean: 'boool', + }); + + t.same(parsed.boool, true); + t.same(parsed.other, 'false'); + t.end(); +}); + +test('boolean --boool=true', function (t) { + var parsed = parse(['--boool=true'], { + default: { + boool: false, + }, + boolean: ['boool'], + }); + + t.same(parsed.boool, true); + t.end(); +}); + +test('boolean --boool=false', function (t) { + var parsed = parse(['--boool=false'], { + default: { + boool: true, + }, + boolean: ['boool'], + }); + + t.same(parsed.boool, false); + t.end(); +}); + +test('boolean using something similar to true', function (t) { + var opts = { boolean: 'h' }; + var result = parse(['-h', 'true.txt'], opts); + var expected = { + h: true, + _: ['true.txt'], + }; + + t.same(result, expected); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/dash.js b/tools/ui/node_modules/minimist/test/dash.js new file mode 100644 index 0000000000000000000000000000000000000000..707881771e275240a0e0d6d4d2fb8d31a564d74f --- /dev/null +++ b/tools/ui/node_modules/minimist/test/dash.js @@ -0,0 +1,43 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('-', function (t) { + t.plan(6); + t.deepEqual(parse(['-n', '-']), { n: '-', _: [] }); + t.deepEqual(parse(['--nnn', '-']), { nnn: '-', _: [] }); + t.deepEqual(parse(['-']), { _: ['-'] }); + t.deepEqual(parse(['-f-']), { f: '-', _: [] }); + t.deepEqual( + parse(['-b', '-'], { boolean: 'b' }), + { b: true, _: ['-'] } + ); + t.deepEqual( + parse(['-s', '-'], { string: 's' }), + { s: '-', _: [] } + ); +}); + +test('-a -- b', function (t) { + t.plan(2); + t.deepEqual(parse(['-a', '--', 'b']), { a: true, _: ['b'] }); + t.deepEqual(parse(['--a', '--', 'b']), { a: true, _: ['b'] }); +}); + +test('move arguments after the -- into their own `--` array', function (t) { + t.plan(1); + t.deepEqual( + parse(['--name', 'John', 'before', '--', 'after'], { '--': true }), + { name: 'John', _: ['before'], '--': ['after'] } + ); +}); + +test('--- option value', function (t) { + // A multi-dash value is largely an edge case, but check the behaviour is as expected, + // and in particular the same for short option and long option (as made consistent in Jan 2023). + t.plan(2); + t.deepEqual(parse(['-n', '---']), { n: '---', _: [] }); + t.deepEqual(parse(['--nnn', '---']), { nnn: '---', _: [] }); +}); + diff --git a/tools/ui/node_modules/minimist/test/default_bool.js b/tools/ui/node_modules/minimist/test/default_bool.js new file mode 100644 index 0000000000000000000000000000000000000000..4e9f6250f08ea8e005b66729630660a3db195566 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/default_bool.js @@ -0,0 +1,37 @@ +'use strict'; + +var test = require('tape'); +var parse = require('../'); + +test('boolean default true', function (t) { + var argv = parse([], { + boolean: 'sometrue', + default: { sometrue: true }, + }); + t.equal(argv.sometrue, true); + t.end(); +}); + +test('boolean default false', function (t) { + var argv = parse([], { + boolean: 'somefalse', + default: { somefalse: false }, + }); + t.equal(argv.somefalse, false); + t.end(); +}); + +test('boolean default to null', function (t) { + var argv = parse([], { + boolean: 'maybe', + default: { maybe: null }, + }); + t.equal(argv.maybe, null); + + var argvLong = parse(['--maybe'], { + boolean: 'maybe', + default: { maybe: null }, + }); + t.equal(argvLong.maybe, true); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/dotted.js b/tools/ui/node_modules/minimist/test/dotted.js new file mode 100644 index 0000000000000000000000000000000000000000..126ff033b4237334be18dafed9f2b4636f684d2d --- /dev/null +++ b/tools/ui/node_modules/minimist/test/dotted.js @@ -0,0 +1,24 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('dotted alias', function (t) { + var argv = parse(['--a.b', '22'], { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } }); + t.equal(argv.a.b, 22); + t.equal(argv.aa.bb, 22); + t.end(); +}); + +test('dotted default', function (t) { + var argv = parse('', { default: { 'a.b': 11 }, alias: { 'a.b': 'aa.bb' } }); + t.equal(argv.a.b, 11); + t.equal(argv.aa.bb, 11); + t.end(); +}); + +test('dotted default with no alias', function (t) { + var argv = parse('', { default: { 'a.b': 11 } }); + t.equal(argv.a.b, 11); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/kv_short.js b/tools/ui/node_modules/minimist/test/kv_short.js new file mode 100644 index 0000000000000000000000000000000000000000..6d1b53a7a7ee1fcbeb9b12c9804f83ff90f46ccd --- /dev/null +++ b/tools/ui/node_modules/minimist/test/kv_short.js @@ -0,0 +1,32 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('short -k=v', function (t) { + t.plan(1); + + var argv = parse(['-b=123']); + t.deepEqual(argv, { b: 123, _: [] }); +}); + +test('multi short -k=v', function (t) { + t.plan(1); + + var argv = parse(['-a=whatever', '-b=robots']); + t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); +}); + +test('short with embedded equals -k=a=b', function (t) { + t.plan(1); + + var argv = parse(['-k=a=b']); + t.deepEqual(argv, { k: 'a=b', _: [] }); +}); + +test('short with later equals like -ab=c', function (t) { + t.plan(1); + + var argv = parse(['-ab=c']); + t.deepEqual(argv, { a: true, b: 'c', _: [] }); +}); diff --git a/tools/ui/node_modules/minimist/test/long.js b/tools/ui/node_modules/minimist/test/long.js new file mode 100644 index 0000000000000000000000000000000000000000..9fef51f1fa8d9bf8ef9e92ad2ce5742f009ab941 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/long.js @@ -0,0 +1,33 @@ +'use strict'; + +var test = require('tape'); +var parse = require('../'); + +test('long opts', function (t) { + t.deepEqual( + parse(['--bool']), + { bool: true, _: [] }, + 'long boolean' + ); + t.deepEqual( + parse(['--pow', 'xixxle']), + { pow: 'xixxle', _: [] }, + 'long capture sp' + ); + t.deepEqual( + parse(['--pow=xixxle']), + { pow: 'xixxle', _: [] }, + 'long capture eq' + ); + t.deepEqual( + parse(['--host', 'localhost', '--port', '555']), + { host: 'localhost', port: 555, _: [] }, + 'long captures sp' + ); + t.deepEqual( + parse(['--host=localhost', '--port=555']), + { host: 'localhost', port: 555, _: [] }, + 'long captures eq' + ); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/num.js b/tools/ui/node_modules/minimist/test/num.js new file mode 100644 index 0000000000000000000000000000000000000000..074393ecaf1705b9a6170c35ad23d55df943f306 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/num.js @@ -0,0 +1,38 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('nums', function (t) { + var argv = parse([ + '-x', '1234', + '-y', '5.67', + '-z', '1e7', + '-w', '10f', + '--hex', '0xdeadbeef', + '789', + ]); + t.deepEqual(argv, { + x: 1234, + y: 5.67, + z: 1e7, + w: '10f', + hex: 0xdeadbeef, + _: [789], + }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv.y, 'number'); + t.deepEqual(typeof argv.z, 'number'); + t.deepEqual(typeof argv.w, 'string'); + t.deepEqual(typeof argv.hex, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); + +test('already a number', function (t) { + var argv = parse(['-x', 1234, 789]); + t.deepEqual(argv, { x: 1234, _: [789] }); + t.deepEqual(typeof argv.x, 'number'); + t.deepEqual(typeof argv._[0], 'number'); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/parse.js b/tools/ui/node_modules/minimist/test/parse.js new file mode 100644 index 0000000000000000000000000000000000000000..65d9d90927b91baa152a32e1485479307f1acf44 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/parse.js @@ -0,0 +1,209 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('parse args', function (t) { + t.deepEqual( + parse(['--no-moo']), + { moo: false, _: [] }, + 'no' + ); + t.deepEqual( + parse(['-v', 'a', '-v', 'b', '-v', 'c']), + { v: ['a', 'b', 'c'], _: [] }, + 'multi' + ); + t.end(); +}); + +test('comprehensive', function (t) { + t.deepEqual( + parse([ + '--name=meowmers', 'bare', '-cats', 'woo', + '-h', 'awesome', '--multi=quux', + '--key', 'value', + '-b', '--bool', '--no-meep', '--multi=baz', + '--', '--not-a-flag', 'eek', + ]), + { + c: true, + a: true, + t: true, + s: 'woo', + h: 'awesome', + b: true, + bool: true, + key: 'value', + multi: ['quux', 'baz'], + meep: false, + name: 'meowmers', + _: ['bare', '--not-a-flag', 'eek'], + } + ); + t.end(); +}); + +test('flag boolean', function (t) { + var argv = parse(['-t', 'moo'], { boolean: 't' }); + t.deepEqual(argv, { t: true, _: ['moo'] }); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('flag boolean value', function (t) { + var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { + boolean: ['t', 'verbose'], + default: { verbose: true }, + }); + + t.deepEqual(argv, { + verbose: false, + t: true, + _: ['moo'], + }); + + t.deepEqual(typeof argv.verbose, 'boolean'); + t.deepEqual(typeof argv.t, 'boolean'); + t.end(); +}); + +test('newlines in params', function (t) { + var args = parse(['-s', 'X\nX']); + t.deepEqual(args, { _: [], s: 'X\nX' }); + + // reproduce in bash: + // VALUE="new + // line" + // node program.js --s="$VALUE" + args = parse(['--s=X\nX']); + t.deepEqual(args, { _: [], s: 'X\nX' }); + t.end(); +}); + +test('strings', function (t) { + var s = parse(['-s', '0001234'], { string: 's' }).s; + t.equal(s, '0001234'); + t.equal(typeof s, 'string'); + + var x = parse(['-x', '56'], { string: 'x' }).x; + t.equal(x, '56'); + t.equal(typeof x, 'string'); + t.end(); +}); + +test('stringArgs', function (t) { + var s = parse([' ', ' '], { string: '_' })._; + t.same(s.length, 2); + t.same(typeof s[0], 'string'); + t.same(s[0], ' '); + t.same(typeof s[1], 'string'); + t.same(s[1], ' '); + t.end(); +}); + +test('empty strings', function (t) { + var s = parse(['-s'], { string: 's' }).s; + t.equal(s, ''); + t.equal(typeof s, 'string'); + + var str = parse(['--str'], { string: 'str' }).str; + t.equal(str, ''); + t.equal(typeof str, 'string'); + + var letters = parse(['-art'], { + string: ['a', 't'], + }); + + t.equal(letters.a, ''); + t.equal(letters.r, true); + t.equal(letters.t, ''); + + t.end(); +}); + +test('string and alias', function (t) { + var x = parse(['--str', '000123'], { + string: 's', + alias: { s: 'str' }, + }); + + t.equal(x.str, '000123'); + t.equal(typeof x.str, 'string'); + t.equal(x.s, '000123'); + t.equal(typeof x.s, 'string'); + + var y = parse(['-s', '000123'], { + string: 'str', + alias: { str: 's' }, + }); + + t.equal(y.str, '000123'); + t.equal(typeof y.str, 'string'); + t.equal(y.s, '000123'); + t.equal(typeof y.s, 'string'); + + var z = parse(['-s123'], { + alias: { str: ['s', 'S'] }, + string: ['str'], + }); + + t.deepEqual( + z, + { _: [], s: '123', S: '123', str: '123' }, + 'opt.string works with multiple aliases' + ); + t.end(); +}); + +test('slashBreak', function (t) { + t.same( + parse(['-I/foo/bar/baz']), + { I: '/foo/bar/baz', _: [] } + ); + t.same( + parse(['-xyz/foo/bar/baz']), + { x: true, y: true, z: '/foo/bar/baz', _: [] } + ); + t.end(); +}); + +test('alias', function (t) { + var argv = parse(['-f', '11', '--zoom', '55'], { + alias: { z: 'zoom' }, + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.f, 11); + t.end(); +}); + +test('multiAlias', function (t) { + var argv = parse(['-f', '11', '--zoom', '55'], { + alias: { z: ['zm', 'zoom'] }, + }); + t.equal(argv.zoom, 55); + t.equal(argv.z, argv.zoom); + t.equal(argv.z, argv.zm); + t.equal(argv.f, 11); + t.end(); +}); + +test('nested dotted objects', function (t) { + var argv = parse([ + '--foo.bar', '3', '--foo.baz', '4', + '--foo.quux.quibble', '5', '--foo.quux.o_O', + '--beep.boop', + ]); + + t.same(argv.foo, { + bar: 3, + baz: 4, + quux: { + quibble: 5, + o_O: true, + }, + }); + t.same(argv.beep, { boop: true }); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/parse_modified.js b/tools/ui/node_modules/minimist/test/parse_modified.js new file mode 100644 index 0000000000000000000000000000000000000000..32965d130fbd4f59b9a6e12488cf18901004d1f8 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/parse_modified.js @@ -0,0 +1,11 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('parse with modifier functions', function (t) { + t.plan(1); + + var argv = parse(['-b', '123'], { boolean: 'b' }); + t.deepEqual(argv, { b: true, _: [123] }); +}); diff --git a/tools/ui/node_modules/minimist/test/proto.js b/tools/ui/node_modules/minimist/test/proto.js new file mode 100644 index 0000000000000000000000000000000000000000..6e629dd34ef0942c19c4d124542f5f030c228ae4 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/proto.js @@ -0,0 +1,64 @@ +'use strict'; + +/* eslint no-proto: 0 */ + +var parse = require('../'); +var test = require('tape'); + +test('proto pollution', function (t) { + var argv = parse(['--__proto__.x', '123']); + t.equal({}.x, undefined); + t.equal(argv.__proto__.x, undefined); + t.equal(argv.x, undefined); + t.end(); +}); + +test('proto pollution (array)', function (t) { + var argv = parse(['--x', '4', '--x', '5', '--x.__proto__.z', '789']); + t.equal({}.z, undefined); + t.deepEqual(argv.x, [4, 5]); + t.equal(argv.x.z, undefined); + t.equal(argv.x.__proto__.z, undefined); + t.end(); +}); + +test('proto pollution (number)', function (t) { + var argv = parse(['--x', '5', '--x.__proto__.z', '100']); + t.equal({}.z, undefined); + t.equal((4).z, undefined); + t.equal(argv.x, 5); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (string)', function (t) { + var argv = parse(['--x', 'abc', '--x.__proto__.z', 'def']); + t.equal({}.z, undefined); + t.equal('...'.z, undefined); + t.equal(argv.x, 'abc'); + t.equal(argv.x.z, undefined); + t.end(); +}); + +test('proto pollution (constructor)', function (t) { + var argv = parse(['--constructor.prototype.y', '123']); + t.equal({}.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); + +test('proto pollution (constructor function)', function (t) { + var argv = parse(['--_.concat.constructor.prototype.y', '123']); + function fnToBeTested() {} + t.equal(fnToBeTested.y, undefined); + t.equal(argv.y, undefined); + t.end(); +}); + +// powered by snyk - https://github.com/backstage/backstage/issues/10343 +test('proto pollution (constructor function) snyk', function (t) { + var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' ')); + t.equal(function () {}.foo, undefined); + t.equal(argv.y, undefined); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/short.js b/tools/ui/node_modules/minimist/test/short.js new file mode 100644 index 0000000000000000000000000000000000000000..4a7b84385bbfdc74314f5e8f7cc4c36afd52b8bd --- /dev/null +++ b/tools/ui/node_modules/minimist/test/short.js @@ -0,0 +1,69 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('numeric short args', function (t) { + t.plan(2); + t.deepEqual(parse(['-n123']), { n: 123, _: [] }); + t.deepEqual( + parse(['-123', '456']), + { 1: true, 2: true, 3: 456, _: [] } + ); +}); + +test('short', function (t) { + t.deepEqual( + parse(['-b']), + { b: true, _: [] }, + 'short boolean' + ); + t.deepEqual( + parse(['foo', 'bar', 'baz']), + { _: ['foo', 'bar', 'baz'] }, + 'bare' + ); + t.deepEqual( + parse(['-cats']), + { c: true, a: true, t: true, s: true, _: [] }, + 'group' + ); + t.deepEqual( + parse(['-cats', 'meow']), + { c: true, a: true, t: true, s: 'meow', _: [] }, + 'short group next' + ); + t.deepEqual( + parse(['-h', 'localhost']), + { h: 'localhost', _: [] }, + 'short capture' + ); + t.deepEqual( + parse(['-h', 'localhost', '-p', '555']), + { h: 'localhost', p: 555, _: [] }, + 'short captures' + ); + t.end(); +}); + +test('mixed short bool and capture', function (t) { + t.same( + parse(['-h', 'localhost', '-fp', '555', 'script.js']), + { + f: true, p: 555, h: 'localhost', + _: ['script.js'], + } + ); + t.end(); +}); + +test('short and long', function (t) { + t.deepEqual( + parse(['-h', 'localhost', '-fp', '555', 'script.js']), + { + f: true, p: 555, h: 'localhost', + _: ['script.js'], + } + ); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/stop_early.js b/tools/ui/node_modules/minimist/test/stop_early.js new file mode 100644 index 0000000000000000000000000000000000000000..52a6a91903028d5230729df63afcdb80d79b0c68 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/stop_early.js @@ -0,0 +1,17 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('stops parsing on the first non-option when stopEarly is set', function (t) { + var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { + stopEarly: true, + }); + + t.deepEqual(argv, { + aaa: 'bbb', + _: ['ccc', '--ddd'], + }); + + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/unknown.js b/tools/ui/node_modules/minimist/test/unknown.js new file mode 100644 index 0000000000000000000000000000000000000000..4f2e0ca447f4ccc2fb7ba4df3876bf45d3f0423a --- /dev/null +++ b/tools/ui/node_modules/minimist/test/unknown.js @@ -0,0 +1,104 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('boolean and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['-h', 'true', '--derp', 'true']; + var regular = ['--herp', 'true', '-d', 'true']; + var opts = { + alias: { h: 'herp' }, + boolean: 'h', + unknown: unknownFn, + }; + parse(aliased, opts); + parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('flag boolean true any double hyphen argument is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { + boolean: true, + unknown: unknownFn, + }); + t.same(unknown, ['--tacos=good', 'cow', '-p']); + t.same(argv, { + honk: true, + _: [], + }); + t.end(); +}); + +test('string and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['-h', 'hello', '--derp', 'goodbye']; + var regular = ['--herp', 'hello', '-d', 'moon']; + var opts = { + alias: { h: 'herp' }, + string: 'h', + unknown: unknownFn, + }; + parse(aliased, opts); + parse(regular, opts); + + t.same(unknown, ['--derp', '-d']); + t.end(); +}); + +test('default and alias is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['-h', 'hello']; + var regular = ['--herp', 'hello']; + var opts = { + default: { h: 'bar' }, + alias: { h: 'herp' }, + unknown: unknownFn, + }; + parse(aliased, opts); + parse(regular, opts); + + t.same(unknown, []); + t.end(); + unknownFn(); // exercise fn for 100% coverage +}); + +test('value following -- is not unknown', function (t) { + var unknown = []; + function unknownFn(arg) { + unknown.push(arg); + return false; + } + var aliased = ['--bad', '--', 'good', 'arg']; + var opts = { + '--': true, + unknown: unknownFn, + }; + var argv = parse(aliased, opts); + + t.same(unknown, ['--bad']); + t.same(argv, { + '--': ['good', 'arg'], + _: [], + }); + t.end(); +}); diff --git a/tools/ui/node_modules/minimist/test/whitespace.js b/tools/ui/node_modules/minimist/test/whitespace.js new file mode 100644 index 0000000000000000000000000000000000000000..4fdaf1d3943f5a16b9d76af9cd7bbc82f2f54b54 --- /dev/null +++ b/tools/ui/node_modules/minimist/test/whitespace.js @@ -0,0 +1,10 @@ +'use strict'; + +var parse = require('../'); +var test = require('tape'); + +test('whitespace should be whitespace', function (t) { + t.plan(1); + var x = parse(['-x', '\t']).x; + t.equal(x, '\t'); +}); diff --git a/tools/ui/node_modules/minipass/LICENSE.md b/tools/ui/node_modules/minipass/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..c5402b9577a8cdd966c0974e5b74cc7b85f536c5 --- /dev/null +++ b/tools/ui/node_modules/minipass/LICENSE.md @@ -0,0 +1,55 @@ +# Blue Oak Model License + +Version 1.0.0 + +## Purpose + +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +## Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +## Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +## Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +<https://blueoakcouncil.org/license/1.0.0>. + +## Excuse + +If anyone notifies you in writing that you have not +complied with [Notices](#notices), you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +## Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +## Reliability + +No contributor can revoke this license. + +## No Liability + +***As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim.*** diff --git a/tools/ui/node_modules/minipass/README.md b/tools/ui/node_modules/minipass/README.md new file mode 100644 index 0000000000000000000000000000000000000000..1126330582d8ab634134195f893780437760ce59 --- /dev/null +++ b/tools/ui/node_modules/minipass/README.md @@ -0,0 +1,825 @@ +# minipass + +A _very_ minimal implementation of a [PassThrough +stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough) + +[It's very +fast](https://docs.google.com/spreadsheets/d/1K_HR5oh3r80b8WVMWCPPjfuWXUgfkmhlX7FGI6JJ8tY/edit?usp=sharing) +for objects, strings, and buffers. + +Supports `pipe()`ing (including multi-`pipe()` and backpressure +transmission), buffering data until either a `data` event handler +or `pipe()` is added (so you don't lose the first chunk), and +most other cases where PassThrough is a good idea. + +There is a `read()` method, but it's much more efficient to +consume data from this stream via `'data'` events or by calling +`pipe()` into some other stream. Calling `read()` requires the +buffer to be flattened in some cases, which requires copying +memory. + +If you set `objectMode: true` in the options, then whatever is +written will be emitted. Otherwise, it'll do a minimal amount of +Buffer copying to ensure proper Streams semantics when `read(n)` +is called. + +`objectMode` can only be set at instantiation. Attempting to +write something other than a String or Buffer without having set +`objectMode` in the options will throw an error. + +This is not a `through` or `through2` stream. It doesn't +transform the data, it just passes it right through. If you want +to transform the data, extend the class, and override the +`write()` method. Once you're done transforming the data however +you want, call `super.write()` with the transform output. + +For some examples of streams that extend Minipass in various +ways, check out: + +- [minizlib](http://npm.im/minizlib) +- [fs-minipass](http://npm.im/fs-minipass) +- [tar](http://npm.im/tar) +- [minipass-collect](http://npm.im/minipass-collect) +- [minipass-flush](http://npm.im/minipass-flush) +- [minipass-pipeline](http://npm.im/minipass-pipeline) +- [tap](http://npm.im/tap) +- [tap-parser](http://npm.im/tap-parser) +- [treport](http://npm.im/treport) +- [minipass-fetch](http://npm.im/minipass-fetch) +- [pacote](http://npm.im/pacote) +- [make-fetch-happen](http://npm.im/make-fetch-happen) +- [cacache](http://npm.im/cacache) +- [ssri](http://npm.im/ssri) +- [npm-registry-fetch](http://npm.im/npm-registry-fetch) +- [minipass-json-stream](http://npm.im/minipass-json-stream) +- [minipass-sized](http://npm.im/minipass-sized) + +## Usage in TypeScript + +The `Minipass` class takes three type template definitions: + +- `RType` the type being read, which defaults to `Buffer`. If + `RType` is `string`, then the constructor _must_ get an options + object specifying either an `encoding` or `objectMode: true`. + If it's anything other than `string` or `Buffer`, then it + _must_ get an options object specifying `objectMode: true`. +- `WType` the type being written. If `RType` is `Buffer` or + `string`, then this defaults to `ContiguousData` (Buffer, + string, ArrayBuffer, or ArrayBufferView). Otherwise, it + defaults to `RType`. +- `Events` type mapping event names to the arguments emitted + with that event, which extends `Minipass.Events`. + +To declare types for custom events in subclasses, extend the +third parameter with your own event signatures. For example: + +```js +import { Minipass } from 'minipass' + +// a NDJSON stream that emits 'jsonError' when it can't stringify +export interface Events extends Minipass.Events { + jsonError: [e: Error] +} + +export class NDJSONStream extends Minipass<string, any, Events> { + constructor() { + super({ objectMode: true }) + } + + // data is type `any` because that's WType + write(data, encoding, cb) { + try { + const json = JSON.stringify(data) + return super.write(json + '\n', encoding, cb) + } catch (er) { + if (!er instanceof Error) { + er = Object.assign(new Error('json stringify failed'), { + cause: er, + }) + } + // trying to emit with something OTHER than an error will + // fail, because we declared the event arguments type. + this.emit('jsonError', er) + } + } +} + +const s = new NDJSONStream() +s.on('jsonError', e => { + // here, TS knows that e is an Error +}) +``` + +Emitting/handling events that aren't declared in this way is +fine, but the arguments will be typed as `unknown`. + +## Differences from Node.js Streams + +There are several things that make Minipass streams different +from (and in some ways superior to) Node.js core streams. + +Please read these caveats if you are familiar with node-core +streams and intend to use Minipass streams in your programs. + +You can avoid most of these differences entirely (for a very +small performance penalty) by setting `{async: true}` in the +constructor options. + +### Timing + +Minipass streams are designed to support synchronous use-cases. +Thus, data is emitted as soon as it is available, always. It is +buffered until read, but no longer. Another way to look at it is +that Minipass streams are exactly as synchronous as the logic +that writes into them. + +This can be surprising if your code relies on +`PassThrough.write()` always providing data on the next tick +rather than the current one, or being able to call `resume()` and +not have the entire buffer disappear immediately. + +However, without this synchronicity guarantee, there would be no +way for Minipass to achieve the speeds it does, or support the +synchronous use cases that it does. Simply put, waiting takes +time. + +This non-deferring approach makes Minipass streams much easier to +reason about, especially in the context of Promises and other +flow-control mechanisms. + +Example: + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const stream = new Minipass() +stream.on('data', () => console.log('data event')) +console.log('before write') +stream.write('hello') +console.log('after write') +// output: +// before write +// data event +// after write +``` + +### Exception: Async Opt-In + +If you wish to have a Minipass stream with behavior that more +closely mimics Node.js core streams, you can set the stream in +async mode either by setting `async: true` in the constructor +options, or by setting `stream.async = true` later on. + +```js +// hybrid module, either works +import { Minipass } from 'minipass' +// or: +const { Minipass } = require('minipass') + +const asyncStream = new Minipass({ async: true }) +asyncStream.on('data', () => console.log('data event')) +console.log('before write') +asyncStream.write('hello') +console.log('after write') +// output: +// before write +// after write +// data event <-- this is deferred until the next tick +``` + +Switching _out_ of async mode is unsafe, as it could cause data +corruption, and so is not enabled. Example: + +```js +import { Minipass } from 'minipass' +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +setStreamSyncAgainSomehow(stream) // <-- this doesn't actually exist! +stream.write('world') +console.log('after writes') +// hypothetical output would be: +// before writes +// world +// after writes +// hello +// NOT GOOD! +``` + +To avoid this problem, once set into async mode, any attempt to +make the stream sync again will be ignored. + +```js +const { Minipass } = require('minipass') +const stream = new Minipass({ encoding: 'utf8' }) +stream.on('data', chunk => console.log(chunk)) +stream.async = true +console.log('before writes') +stream.write('hello') +stream.async = false // <-- no-op, stream already async +stream.write('world') +console.log('after writes') +// actual output: +// before writes +// after writes +// hello +// world +``` + +### No High/Low Water Marks + +Node.js core streams will optimistically fill up a buffer, +returning `true` on all writes until the limit is hit, even if +the data has nowhere to go. Then, they will not attempt to draw +more data in until the buffer size dips below a minimum value. + +Minipass streams are much simpler. The `write()` method will +return `true` if the data has somewhere to go (which is to say, +given the timing guarantees, that the data is already there by +the time `write()` returns). + +If the data has nowhere to go, then `write()` returns false, and +the data sits in a buffer, to be drained out immediately as soon +as anyone consumes it. + +Since nothing is ever buffered unnecessarily, there is much less +copying data, and less bookkeeping about buffer capacity levels. + +### Hazards of Buffering (or: Why Minipass Is So Fast) + +Since data written to a Minipass stream is immediately written +all the way through the pipeline, and `write()` always returns +true/false based on whether the data was fully flushed, +backpressure is communicated immediately to the upstream caller. +This minimizes buffering. + +Consider this case: + +```js +const { PassThrough } = require('stream') +const p1 = new PassThrough({ highWaterMark: 1024 }) +const p2 = new PassThrough({ highWaterMark: 1024 }) +const p3 = new PassThrough({ highWaterMark: 1024 }) +const p4 = new PassThrough({ highWaterMark: 1024 }) + +p1.pipe(p2).pipe(p3).pipe(p4) +p4.on('data', () => console.log('made it through')) + +// this returns false and buffers, then writes to p2 on next tick (1) +// p2 returns false and buffers, pausing p1, then writes to p3 on next tick (2) +// p3 returns false and buffers, pausing p2, then writes to p4 on next tick (3) +// p4 returns false and buffers, pausing p3, then emits 'data' and 'drain' +// on next tick (4) +// p3 sees p4's 'drain' event, and calls resume(), emitting 'resume' and +// 'drain' on next tick (5) +// p2 sees p3's 'drain', calls resume(), emits 'resume' and 'drain' on next tick (6) +// p1 sees p2's 'drain', calls resume(), emits 'resume' and 'drain' on next +// tick (7) + +p1.write(Buffer.alloc(2048)) // returns false +``` + +Along the way, the data was buffered and deferred at each stage, +and multiple event deferrals happened, for an unblocked pipeline +where it was perfectly safe to write all the way through! + +Furthermore, setting a `highWaterMark` of `1024` might lead +someone reading the code to think an advisory maximum of 1KiB is +being set for the pipeline. However, the actual advisory +buffering level is the _sum_ of `highWaterMark` values, since +each one has its own bucket. + +Consider the Minipass case: + +```js +const m1 = new Minipass() +const m2 = new Minipass() +const m3 = new Minipass() +const m4 = new Minipass() + +m1.pipe(m2).pipe(m3).pipe(m4) +m4.on('data', () => console.log('made it through')) + +// m1 is flowing, so it writes the data to m2 immediately +// m2 is flowing, so it writes the data to m3 immediately +// m3 is flowing, so it writes the data to m4 immediately +// m4 is flowing, so it fires the 'data' event immediately, returns true +// m4's write returned true, so m3 is still flowing, returns true +// m3's write returned true, so m2 is still flowing, returns true +// m2's write returned true, so m1 is still flowing, returns true +// No event deferrals or buffering along the way! + +m1.write(Buffer.alloc(2048)) // returns true +``` + +It is extremely unlikely that you _don't_ want to buffer any data +written, or _ever_ buffer data that can be flushed all the way +through. Neither node-core streams nor Minipass ever fail to +buffer written data, but node-core streams do a lot of +unnecessary buffering and pausing. + +As always, the faster implementation is the one that does less +stuff and waits less time to do it. + +### Immediately emit `end` for empty streams (when not paused) + +If a stream is not paused, and `end()` is called before writing +any data into it, then it will emit `end` immediately. + +If you have logic that occurs on the `end` event which you don't +want to potentially happen immediately (for example, closing file +descriptors, moving on to the next entry in an archive parse +stream, etc.) then be sure to call `stream.pause()` on creation, +and then `stream.resume()` once you are ready to respond to the +`end` event. + +However, this is _usually_ not a problem because: + +### Emit `end` When Asked + +One hazard of immediately emitting `'end'` is that you may not +yet have had a chance to add a listener. In order to avoid this +hazard, Minipass streams safely re-emit the `'end'` event if a +new listener is added after `'end'` has been emitted. + +Ie, if you do `stream.on('end', someFunction)`, and the stream +has already emitted `end`, then it will call the handler right +away. (You can think of this somewhat like attaching a new +`.then(fn)` to a previously-resolved Promise.) + +To prevent calling handlers multiple times who would not expect +multiple ends to occur, all listeners are removed from the +`'end'` event whenever it is emitted. + +### Emit `error` When Asked + +The most recent error object passed to the `'error'` event is +stored on the stream. If a new `'error'` event handler is added, +and an error was previously emitted, then the event handler will +be called immediately (or on `process.nextTick` in the case of +async streams). + +This makes it much more difficult to end up trying to interact +with a broken stream, if the error handler is added after an +error was previously emitted. + +### Impact of "immediate flow" on Tee-streams + +A "tee stream" is a stream piping to multiple destinations: + +```js +const tee = new Minipass() +t.pipe(dest1) +t.pipe(dest2) +t.write('foo') // goes to both destinations +``` + +Since Minipass streams _immediately_ process any pending data +through the pipeline when a new pipe destination is added, this +can have surprising effects, especially when a stream comes in +from some other function and may or may not have data in its +buffer. + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.pipe(dest1) // 'foo' chunk flows to dest1 immediately, and is gone +src.pipe(dest2) // gets nothing! +``` + +One solution is to create a dedicated tee-stream junction that +pipes to both locations, and then pipe to _that_ instead. + +```js +// Safe example: tee to both places +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.pipe(dest1) +tee.pipe(dest2) +src.pipe(tee) // tee gets 'foo', pipes to both locations +``` + +The same caveat applies to `on('data')` event listeners. The +first one added will _immediately_ receive all of the data, +leaving nothing for the second: + +```js +// WARNING! WILL LOSE DATA! +const src = new Minipass() +src.write('foo') +src.on('data', handler1) // receives 'foo' right away +src.on('data', handler2) // nothing to see here! +``` + +Using a dedicated tee-stream can be used in this case as well: + +```js +// Safe example: tee to both data handlers +const src = new Minipass() +src.write('foo') +const tee = new Minipass() +tee.on('data', handler1) +tee.on('data', handler2) +src.pipe(tee) +``` + +All of the hazards in this section are avoided by setting `{ +async: true }` in the Minipass constructor, or by setting +`stream.async = true` afterwards. Note that this does add some +overhead, so should only be done in cases where you are willing +to lose a bit of performance in order to avoid having to refactor +program logic. + +## USAGE + +It's a stream! Use it like a stream and it'll most likely do what +you want. + +```js +import { Minipass } from 'minipass' +const mp = new Minipass(options) // options is optional +mp.write('foo') +mp.pipe(someOtherStream) +mp.end('bar') +``` + +### OPTIONS + +- `encoding` How would you like the data coming _out_ of the + stream to be encoded? Accepts any values that can be passed to + `Buffer.toString()`. +- `objectMode` Emit data exactly as it comes in. This will be + flipped on by default if you write() something other than a + string or Buffer at any point. Setting `objectMode: true` will + prevent setting any encoding value. +- `async` Defaults to `false`. Set to `true` to defer data + emission until next tick. This reduces performance slightly, + but makes Minipass streams use timing behavior closer to Node + core streams. See [Timing](#timing) for more details. +- `signal` An `AbortSignal` that will cause the stream to unhook + itself from everything and become as inert as possible. Note + that providing a `signal` parameter will make `'error'` events + no longer throw if they are unhandled, but they will still be + emitted to handlers if any are attached. + +### API + +Implements the user-facing portions of Node.js's `Readable` and +`Writable` streams. + +### Methods + +- `write(chunk, [encoding], [callback])` - Put data in. (Note + that, in the base Minipass class, the same data will come out.) + Returns `false` if the stream will buffer the next write, or + true if it's still in "flowing" mode. +- `end([chunk, [encoding]], [callback])` - Signal that you have + no more data to write. This will queue an `end` event to be + fired when all the data has been consumed. +- `pause()` - No more data for a while, please. This also + prevents `end` from being emitted for empty streams until the + stream is resumed. +- `resume()` - Resume the stream. If there's data in the buffer, + it is all discarded. Any buffered events are immediately + emitted. +- `pipe(dest)` - Send all output to the stream provided. When + data is emitted, it is immediately written to any and all pipe + destinations. (Or written on next tick in `async` mode.) +- `unpipe(dest)` - Stop piping to the destination stream. This is + immediate, meaning that any asynchronously queued data will + _not_ make it to the destination when running in `async` mode. + - `options.end` - Boolean, end the destination stream when the + source stream ends. Default `true`. + - `options.proxyErrors` - Boolean, proxy `error` events from + the source stream to the destination stream. Note that errors + are _not_ proxied after the pipeline terminates, either due + to the source emitting `'end'` or manually unpiping with + `src.unpipe(dest)`. Default `false`. +- `on(ev, fn)`, `emit(ev, fn)` - Minipass streams are + EventEmitters. Some events are given special treatment, + however. (See below under "events".) +- `promise()` - Returns a Promise that resolves when the stream + emits `end`, or rejects if the stream emits `error`. +- `collect()` - Return a Promise that resolves on `end` with an + array containing each chunk of data that was emitted, or + rejects if the stream emits `error`. Note that this consumes + the stream data. +- `concat()` - Same as `collect()`, but concatenates the data + into a single Buffer object. Will reject the returned promise + if the stream is in objectMode, or if it goes into objectMode + by the end of the data. +- `read(n)` - Consume `n` bytes of data out of the buffer. If `n` + is not provided, then consume all of it. If `n` bytes are not + available, then it returns null. **Note** consuming streams in + this way is less efficient, and can lead to unnecessary Buffer + copying. +- `destroy([er])` - Destroy the stream. If an error is provided, + then an `'error'` event is emitted. If the stream has a + `close()` method, and has not emitted a `'close'` event yet, + then `stream.close()` will be called. Any Promises returned by + `.promise()`, `.collect()` or `.concat()` will be rejected. + After being destroyed, writing to the stream will emit an + error. No more data will be emitted if the stream is destroyed, + even if it was previously buffered. + +### Properties + +- `bufferLength` Read-only. Total number of bytes buffered, or in + the case of objectMode, the total number of objects. +- `encoding` Read-only. The encoding that has been set. +- `flowing` Read-only. Boolean indicating whether a chunk written + to the stream will be immediately emitted. +- `emittedEnd` Read-only. Boolean indicating whether the end-ish + events (ie, `end`, `prefinish`, `finish`) have been emitted. + Note that listening on any end-ish event will immediateyl + re-emit it if it has already been emitted. +- `writable` Whether the stream is writable. Default `true`. Set + to `false` when `end()` +- `readable` Whether the stream is readable. Default `true`. +- `pipes` An array of Pipe objects referencing streams that this + stream is piping into. +- `destroyed` A getter that indicates whether the stream was + destroyed. +- `paused` True if the stream has been explicitly paused, + otherwise false. +- `objectMode` Indicates whether the stream is in `objectMode`. +- `aborted` Readonly property set when the `AbortSignal` + dispatches an `abort` event. + +### Events + +- `data` Emitted when there's data to read. Argument is the data + to read. This is never emitted while not flowing. If a listener + is attached, that will resume the stream. +- `end` Emitted when there's no more data to read. This will be + emitted immediately for empty streams when `end()` is called. + If a listener is attached, and `end` was already emitted, then + it will be emitted again. All listeners are removed when `end` + is emitted. +- `prefinish` An end-ish event that follows the same logic as + `end` and is emitted in the same conditions where `end` is + emitted. Emitted after `'end'`. +- `finish` An end-ish event that follows the same logic as `end` + and is emitted in the same conditions where `end` is emitted. + Emitted after `'prefinish'`. +- `close` An indication that an underlying resource has been + released. Minipass does not emit this event, but will defer it + until after `end` has been emitted, since it throws off some + stream libraries otherwise. +- `drain` Emitted when the internal buffer empties, and it is + again suitable to `write()` into the stream. +- `readable` Emitted when data is buffered and ready to be read + by a consumer. +- `resume` Emitted when stream changes state from buffering to + flowing mode. (Ie, when `resume` is called, `pipe` is called, + or a `data` event listener is added.) + +### Static Methods + +- `Minipass.isStream(stream)` Returns `true` if the argument is a + stream, and false otherwise. To be considered a stream, the + object must be either an instance of Minipass, or an + EventEmitter that has either a `pipe()` method, or both + `write()` and `end()` methods. (Pretty much any stream in + node-land will return `true` for this.) + +## EXAMPLES + +Here are some examples of things you can do with Minipass +streams. + +### simple "are you done yet" promise + +```js +mp.promise().then( + () => { + // stream is finished + }, + er => { + // stream emitted an error + } +) +``` + +### collecting + +```js +mp.collect().then(all => { + // all is an array of all the data emitted + // encoding is supported in this case, so + // so the result will be a collection of strings if + // an encoding is specified, or buffers/objects if not. + // + // In an async function, you may do + // const data = await stream.collect() +}) +``` + +### collecting into a single blob + +This is a bit slower because it concatenates the data into one +chunk for you, but if you're going to do it yourself anyway, it's +convenient this way: + +```js +mp.concat().then(onebigchunk => { + // onebigchunk is a string if the stream + // had an encoding set, or a buffer otherwise. +}) +``` + +### iteration + +You can iterate over streams synchronously or asynchronously in +platforms that support it. + +Synchronous iteration will end when the currently available data +is consumed, even if the `end` event has not been reached. In +string and buffer mode, the data is concatenated, so unless +multiple writes are occurring in the same tick as the `read()`, +sync iteration loops will generally only have a single iteration. + +To consume chunks in this way exactly as they have been written, +with no flattening, create the stream with the `{ objectMode: +true }` option. + +```js +const mp = new Minipass({ objectMode: true }) +mp.write('a') +mp.write('b') +for (let letter of mp) { + console.log(letter) // a, b +} +mp.write('c') +mp.write('d') +for (let letter of mp) { + console.log(letter) // c, d +} +mp.write('e') +mp.end() +for (let letter of mp) { + console.log(letter) // e +} +for (let letter of mp) { + console.log(letter) // nothing +} +``` + +Asynchronous iteration will continue until the end event is reached, +consuming all of the data. + +```js +const mp = new Minipass({ encoding: 'utf8' }) + +// some source of some data +let i = 5 +const inter = setInterval(() => { + if (i-- > 0) mp.write(Buffer.from('foo\n', 'utf8')) + else { + mp.end() + clearInterval(inter) + } +}, 100) + +// consume the data with asynchronous iteration +async function consume() { + for await (let chunk of mp) { + console.log(chunk) + } + return 'ok' +} + +consume().then(res => console.log(res)) +// logs `foo\n` 5 times, and then `ok` +``` + +### subclass that `console.log()`s everything written into it + +```js +class Logger extends Minipass { + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } +} + +someSource.pipe(new Logger()).pipe(someDest) +``` + +### same thing, but using an inline anonymous class + +```js +// js classes are fun +someSource + .pipe( + new (class extends Minipass { + emit(ev, ...data) { + // let's also log events, because debugging some weird thing + console.log('EMIT', ev) + return super.emit(ev, ...data) + } + write(chunk, encoding, callback) { + console.log('WRITE', chunk, encoding) + return super.write(chunk, encoding, callback) + } + end(chunk, encoding, callback) { + console.log('END', chunk, encoding) + return super.end(chunk, encoding, callback) + } + })() + ) + .pipe(someDest) +``` + +### subclass that defers 'end' for some reason + +```js +class SlowEnd extends Minipass { + emit(ev, ...args) { + if (ev === 'end') { + console.log('going to end, hold on a sec') + setTimeout(() => { + console.log('ok, ready to end now') + super.emit('end', ...args) + }, 100) + return true + } else { + return super.emit(ev, ...args) + } + } +} +``` + +### transform that creates newline-delimited JSON + +```js +class NDJSONEncode extends Minipass { + write(obj, cb) { + try { + // JSON.stringify can throw, emit an error on that + return super.write(JSON.stringify(obj) + '\n', 'utf8', cb) + } catch (er) { + this.emit('error', er) + } + } + end(obj, cb) { + if (typeof obj === 'function') { + cb = obj + obj = undefined + } + if (obj !== undefined) { + this.write(obj) + } + return super.end(cb) + } +} +``` + +### transform that parses newline-delimited JSON + +```js +class NDJSONDecode extends Minipass { + constructor(options) { + // always be in object mode, as far as Minipass is concerned + super({ objectMode: true }) + this._jsonBuffer = '' + } + write(chunk, encoding, cb) { + if ( + typeof chunk === 'string' && + typeof encoding === 'string' && + encoding !== 'utf8' + ) { + chunk = Buffer.from(chunk, encoding).toString() + } else if (Buffer.isBuffer(chunk)) { + chunk = chunk.toString() + } + if (typeof encoding === 'function') { + cb = encoding + } + const jsonData = (this._jsonBuffer + chunk).split('\n') + this._jsonBuffer = jsonData.pop() + for (let i = 0; i < jsonData.length; i++) { + try { + // JSON.parse can throw, emit an error on that + super.write(JSON.parse(jsonData[i])) + } catch (er) { + this.emit('error', er) + continue + } + } + if (cb) cb() + } +} +``` diff --git a/tools/ui/node_modules/minipass/dist/commonjs/index.d.ts b/tools/ui/node_modules/minipass/dist/commonjs/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3e75b578a6e30945efd5c647008798c8758a53ca --- /dev/null +++ b/tools/ui/node_modules/minipass/dist/commonjs/index.d.ts @@ -0,0 +1,545 @@ +import { EventEmitter } from 'node:events'; +import { StringDecoder } from 'node:string_decoder'; +/** + * Same as StringDecoder, but exposing the `lastNeed` flag on the type + */ +type SD = StringDecoder & { + lastNeed: boolean; +}; +export type { SD, Pipe, PipeProxyErrors }; +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +export declare const isStream: (s: any) => s is Minipass<any, any, any> | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter<any> & { + end(): any; + write(chunk: any, ...args: any[]): any; +}) | (EventEmitter<any> & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; +}) | (NodeJS.ReadStream & { + fd: number; +}) | (NodeJS.WriteStream & { + fd: number; +}); +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +export declare const isReadable: (s: any) => s is Minipass.Readable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +export declare const isWritable: (s: any) => s is Minipass.Readable; +declare const EOF: unique symbol; +declare const MAYBE_EMIT_END: unique symbol; +declare const EMITTED_END: unique symbol; +declare const EMITTING_END: unique symbol; +declare const EMITTED_ERROR: unique symbol; +declare const CLOSED: unique symbol; +declare const READ: unique symbol; +declare const FLUSH: unique symbol; +declare const FLUSHCHUNK: unique symbol; +declare const ENCODING: unique symbol; +declare const DECODER: unique symbol; +declare const FLOWING: unique symbol; +declare const PAUSED: unique symbol; +declare const RESUME: unique symbol; +declare const BUFFER: unique symbol; +declare const PIPES: unique symbol; +declare const BUFFERLENGTH: unique symbol; +declare const BUFFERPUSH: unique symbol; +declare const BUFFERSHIFT: unique symbol; +declare const OBJECTMODE: unique symbol; +declare const DESTROYED: unique symbol; +declare const ERROR: unique symbol; +declare const EMITDATA: unique symbol; +declare const EMITEND: unique symbol; +declare const EMITEND2: unique symbol; +declare const ASYNC: unique symbol; +declare const ABORT: unique symbol; +declare const ABORTED: unique symbol; +declare const SIGNAL: unique symbol; +declare const DATALISTENERS: unique symbol; +declare const DISCARDED: unique symbol; +/** + * Options that may be passed to stream.pipe() + */ +export interface PipeOptions { + /** + * end the destination stream when the source stream ends + */ + end?: boolean; + /** + * proxy errors from the source stream to the destination stream + */ + proxyErrors?: boolean; +} +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +declare class Pipe<T extends unknown> { + src: Minipass<T>; + dest: Minipass<any, T>; + opts: PipeOptions; + ondrain: () => any; + constructor(src: Minipass<T>, dest: Minipass.Writable, opts: PipeOptions); + unpipe(): void; + proxyErrors(_er: any): void; + end(): void; +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +declare class PipeProxyErrors<T> extends Pipe<T> { + unpipe(): void; + constructor(src: Minipass<T>, dest: Minipass.Writable, opts: PipeOptions); +} +export declare namespace Minipass { + /** + * Encoding used to create a stream that outputs strings rather than + * Buffer objects. + */ + export type Encoding = BufferEncoding | 'buffer' | null; + /** + * Any stream that Minipass can pipe into + */ + export type Writable = Minipass<any, any, any> | NodeJS.WriteStream | (NodeJS.WriteStream & { + fd: number; + }) | (EventEmitter & { + end(): any; + write(chunk: any, ...args: any[]): any; + }); + /** + * Any stream that can be read from + */ + export type Readable = Minipass<any, any, any> | NodeJS.ReadStream | (NodeJS.ReadStream & { + fd: number; + }) | (EventEmitter & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }); + /** + * Utility type that can be iterated sync or async + */ + export type DualIterable<T> = Iterable<T> & AsyncIterable<T>; + type EventArguments = Record<string | symbol, unknown[]>; + /** + * The listing of events that a Minipass class can emit. + * Extend this when extending the Minipass class, and pass as + * the third template argument. The key is the name of the event, + * and the value is the argument list. + * + * Any undeclared events will still be allowed, but the handler will get + * arguments as `unknown[]`. + */ + export interface Events<RType extends any = Buffer> extends EventArguments { + readable: []; + data: [chunk: RType]; + error: [er: unknown]; + abort: [reason: unknown]; + drain: []; + resume: []; + end: []; + finish: []; + prefinish: []; + close: []; + [DESTROYED]: [er?: unknown]; + [ERROR]: [er: unknown]; + } + /** + * String or buffer-like data that can be joined and sliced + */ + export type ContiguousData = Buffer | ArrayBufferLike | ArrayBufferView | string; + export type BufferOrString = Buffer | string; + /** + * Options passed to the Minipass constructor. + */ + export type SharedOptions = { + /** + * Defer all data emission and other events until the end of the + * current tick, similar to Node core streams + */ + async?: boolean; + /** + * A signal which will abort the stream + */ + signal?: AbortSignal; + /** + * Output string encoding. Set to `null` or `'buffer'` (or omit) to + * emit Buffer objects rather than strings. + * + * Conflicts with `objectMode` + */ + encoding?: BufferEncoding | null | 'buffer'; + /** + * Output data exactly as it was written, supporting non-buffer/string + * data (such as arbitrary objects, falsey values, etc.) + * + * Conflicts with `encoding` + */ + objectMode?: boolean; + }; + /** + * Options for a string encoded output + */ + export type EncodingOptions = SharedOptions & { + encoding: BufferEncoding; + objectMode?: false; + }; + /** + * Options for contiguous data buffer output + */ + export type BufferOptions = SharedOptions & { + encoding?: null | 'buffer'; + objectMode?: false; + }; + /** + * Options for objectMode arbitrary output + */ + export type ObjectModeOptions = SharedOptions & { + objectMode: true; + encoding?: null; + }; + /** + * Utility type to determine allowed options based on read type + */ + export type Options<T> = ObjectModeOptions | (T extends string ? EncodingOptions : T extends Buffer ? BufferOptions : SharedOptions); + export {}; +} +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +export declare class Minipass<RType extends unknown = Buffer, WType extends unknown = RType extends Minipass.BufferOrString ? Minipass.ContiguousData : RType, Events extends Minipass.Events<RType> = Minipass.Events<RType>> extends EventEmitter implements Minipass.DualIterable<RType> { + [FLOWING]: boolean; + [PAUSED]: boolean; + [PIPES]: Pipe<RType>[]; + [BUFFER]: RType[]; + [OBJECTMODE]: boolean; + [ENCODING]: BufferEncoding | null; + [ASYNC]: boolean; + [DECODER]: SD | null; + [EOF]: boolean; + [EMITTED_END]: boolean; + [EMITTING_END]: boolean; + [CLOSED]: boolean; + [EMITTED_ERROR]: unknown; + [BUFFERLENGTH]: number; + [DESTROYED]: boolean; + [SIGNAL]?: AbortSignal; + [ABORTED]: boolean; + [DATALISTENERS]: number; + [DISCARDED]: boolean; + /** + * true if the stream can be written + */ + writable: boolean; + /** + * true if the stream can be read + */ + readable: boolean; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args: [Minipass.ObjectModeOptions] | (RType extends Buffer ? [] | [Minipass.Options<RType>] : [Minipass.Options<RType>])); + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength(): number; + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding(): BufferEncoding | null; + /** + * @deprecated - This is a read only property + */ + set encoding(_enc: BufferEncoding | null); + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc: Minipass.Encoding): void; + /** + * True if this is an objectMode stream + */ + get objectMode(): boolean; + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om: boolean); + /** + * true if this is an async stream + */ + get ['async'](): boolean; + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a: boolean); + [ABORT](): void; + /** + * True if the stream has been aborted. + */ + get aborted(): boolean; + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_: boolean); + /** + * Write data into the stream + * + * If the chunk written is a string, and encoding is not specified, then + * `utf8` will be assumed. If the stream encoding matches the encoding of + * a written string, and the state of the string decoder allows it, then + * the string will be passed through to either the output or the internal + * buffer without any processing. Otherwise, it will be turned into a + * Buffer object for processing into the desired encoding. + * + * If provided, `cb` function is called immediately before return for + * sync streams, or on next tick for async streams, because for this + * base class, a chunk is considered "processed" once it is accepted + * and either emitted or buffered. That is, the callback does not indicate + * that the chunk has been eventually emitted, though of course child + * classes can override this function to do whatever processing is required + * and call `super.write(...)` only once processing is completed. + */ + write(chunk: WType, cb?: () => void): boolean; + write(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): boolean; + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n?: number | null): RType | null; + [READ](n: number | null, chunk: RType): RType; + /** + * End the stream, optionally providing a final write. + * + * See {@link Minipass#write} for argument descriptions + */ + end(cb?: () => void): this; + end(chunk: WType, cb?: () => void): this; + end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this; + [RESUME](): void; + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume(): void; + /** + * Pause the stream + */ + pause(): void; + /** + * true if the stream has been forcibly destroyed + */ + get destroyed(): boolean; + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing(): boolean; + /** + * true if the stream is currently in a paused state + */ + get paused(): boolean; + [BUFFERPUSH](chunk: RType): void; + [BUFFERSHIFT](): RType; + [FLUSH](noDrain?: boolean): void; + [FLUSHCHUNK](chunk: RType): boolean; + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe<W extends Minipass.Writable>(dest: W, opts?: PipeOptions): W; + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe<W extends Minipass.Writable>(dest: W): void; + /** + * Alias for {@link Minipass#on} + */ + addListener<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Alias for {@link Minipass#off} + */ + removeListener<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off<Event extends keyof Events>(ev: Event, handler: (...args: Events[Event]) => any): this; + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners<Event extends keyof Events>(ev?: Event): this; + /** + * true if the 'end' event has been emitted + */ + get emittedEnd(): boolean; + [MAYBE_EMIT_END](): void; + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit<Event extends keyof Events>(ev: Event, ...args: Events[Event]): boolean; + [EMITDATA](data: RType): boolean; + [EMITEND](): boolean; + [EMITEND2](): boolean; + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + collect(): Promise<RType[] & { + dataLength: number; + }>; + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + concat(): Promise<RType>; + /** + * Return a void Promise that resolves once the stream ends. + */ + promise(): Promise<void>; + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator](): AsyncGenerator<RType, void, void>; + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator](): Generator<RType, void, void>; + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er?: unknown): this; + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream(): (s: any) => s is Minipass<any, any, any> | NodeJS.ReadStream | NodeJS.WriteStream | (EventEmitter<any> & { + end(): any; + write(chunk: any, ...args: any[]): any; + }) | (EventEmitter<any> & { + pause(): any; + resume(): any; + pipe(...destArgs: any[]): any; + }) | (NodeJS.ReadStream & { + fd: number; + }) | (NodeJS.WriteStream & { + fd: number; + }); +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/minipass/dist/commonjs/index.d.ts.map b/tools/ui/node_modules/minipass/dist/commonjs/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7bce611bb6e42e8ac462d0c592f313639c7ca721 --- /dev/null +++ b/tools/ui/node_modules/minipass/dist/commonjs/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD;;GAEG;AACH,KAAK,EAAE,GAAG,aAAa,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAA;AAE/C,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;EAQH,CAAA;AAElB;;GAEG;AACH,eAAO,MAAM,UAAU,oCAM2C,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,UAAU,oCAK6B,CAAA;AAEpD,QAAA,MAAM,GAAG,eAAgB,CAAA;AACzB,QAAA,MAAM,cAAc,eAAyB,CAAA;AAC7C,QAAA,MAAM,WAAW,eAAuB,CAAA;AACxC,QAAA,MAAM,YAAY,eAAwB,CAAA;AAC1C,QAAA,MAAM,aAAa,eAAyB,CAAA;AAC5C,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,IAAI,eAAiB,CAAA;AAC3B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,YAAY,eAAyB,CAAA;AAC3C,QAAA,MAAM,UAAU,eAAuB,CAAA;AACvC,QAAA,MAAM,WAAW,eAAwB,CAAA;AACzC,QAAA,MAAM,UAAU,eAAuB,CAAA;AAEvC,QAAA,MAAM,SAAS,eAAsB,CAAA;AAErC,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,QAAQ,eAAqB,CAAA;AACnC,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,KAAK,eAAkB,CAAA;AAC7B,QAAA,MAAM,OAAO,eAAoB,CAAA;AACjC,QAAA,MAAM,MAAM,eAAmB,CAAA;AAC/B,QAAA,MAAM,aAAa,eAA0B,CAAA;AAC7C,QAAA,MAAM,SAAS,eAAsB,CAAA;AAuBrC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;GAIG;AACH,cAAM,IAAI,CAAC,CAAC,SAAS,OAAO;IAC1B,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IAChB,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IACtB,IAAI,EAAE,WAAW,CAAA;IACjB,OAAO,EAAE,MAAM,GAAG,CAAA;IAClB,YACE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,EAChB,IAAI,EAAE,QAAQ,CAAC,QAAQ,EACvB,IAAI,EAAE,WAAW,EAOlB;IACD,MAAM,SAEL;IAGD,WAAW,CAAC,GAAG,EAAE,GAAG,QAAI;IAExB,GAAG,SAGF;CACF;AAED;;;;;GAKG;AACH,cAAM,eAAe,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,CAAC,CAAC;IACtC,MAAM,SAGL;IACD,YACE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,EAChB,IAAI,EAAE,QAAQ,CAAC,QAAQ,EACvB,IAAI,EAAE,WAAW,EAKlB;CACF;AAED,yBAAiB,QAAQ,CAAC,CAAC;IACzB;;;OAGG;IACH,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,QAAQ,GAAG,IAAI,CAAA;IAEvD;;OAEG;IACH,MAAM,MAAM,QAAQ,GAChB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACvB,MAAM,CAAC,WAAW,GAClB,CAAC,MAAM,CAAC,WAAW,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,GACrC,CAAC,YAAY,GAAG;QACd,GAAG,IAAI,GAAG,CAAA;QACV,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;KACvC,CAAC,CAAA;IAEN;;OAEG;IACH,MAAM,MAAM,QAAQ,GAChB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACvB,MAAM,CAAC,UAAU,GACjB,CAAC,MAAM,CAAC,UAAU,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,GACpC,CAAC,YAAY,GAAG;QACd,KAAK,IAAI,GAAG,CAAA;QACZ,MAAM,IAAI,GAAG,CAAA;QACb,IAAI,CAAC,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;KAC9B,CAAC,CAAA;IAEN;;OAEG;IACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;IAE5D,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;IAExD;;;;;;;;OAQG;IACH,MAAM,WAAW,MAAM,CAAC,KAAK,SAAS,GAAG,GAAG,MAAM,CAChD,SAAQ,cAAc;QACtB,QAAQ,EAAE,EAAE,CAAA;QACZ,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QACpB,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;QACpB,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QACxB,KAAK,EAAE,EAAE,CAAA;QACT,MAAM,EAAE,EAAE,CAAA;QACV,GAAG,EAAE,EAAE,CAAA;QACP,MAAM,EAAE,EAAE,CAAA;QACV,SAAS,EAAE,EAAE,CAAA;QACb,KAAK,EAAE,EAAE,CAAA;QACT,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAA;QAC3B,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;KACvB;IAED;;OAEG;IACH,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,eAAe,GACf,eAAe,GACf,MAAM,CAAA;IACV,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAA;IAE5C;;OAEG;IACH,MAAM,MAAM,aAAa,GAAG;QAC1B;;;WAGG;QACH,KAAK,CAAC,EAAE,OAAO,CAAA;QACf;;WAEG;QACH,MAAM,CAAC,EAAE,WAAW,CAAA;QACpB;;;;;WAKG;QACH,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,QAAQ,CAAA;QAC3C;;;;;WAKG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;KACrB,CAAA;IAED;;OAEG;IACH,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG;QAC5C,QAAQ,EAAE,cAAc,CAAA;QACxB,UAAU,CAAC,EAAE,KAAK,CAAA;KACnB,CAAA;IAED;;OAEG;IACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;QAC1C,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAA;QAC1B,UAAU,CAAC,EAAE,KAAK,CAAA;KACnB,CAAA;IAED;;OAEG;IACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;QAC9C,UAAU,EAAE,IAAI,CAAA;QAChB,QAAQ,CAAC,EAAE,IAAI,CAAA;KAChB,CAAA;IAED;;OAEG;IACH,MAAM,MAAM,OAAO,CAAC,CAAC,IACjB,iBAAiB,GACjB,CAAC,CAAC,SAAS,MAAM,GACb,eAAe,GACf,CAAC,SAAS,MAAM,GAChB,aAAa,GACb,aAAa,CAAC,CAAA;;CACvB;AAWD;;;;;;;;;;GAUG;AACH,qBAAa,QAAQ,CACjB,KAAK,SAAS,OAAO,GAAG,MAAM,EAC9B,KAAK,SAAS,OAAO,GAAG,KAAK,SAAS,QAAQ,CAAC,cAAc,GACzD,QAAQ,CAAC,cAAc,GACvB,KAAK,EACT,MAAM,SAAS,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAEhE,SAAQ,YACR,YAAW,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;IAEvC,CAAC,OAAO,CAAC,EAAE,OAAO,CAAS;IAC3B,CAAC,MAAM,CAAC,EAAE,OAAO,CAAS;IAC1B,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAM;IAC5B,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAM;IACvB,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IACtB,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAClC,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACjB,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;IACrB,CAAC,GAAG,CAAC,EAAE,OAAO,CAAS;IACvB,CAAC,WAAW,CAAC,EAAE,OAAO,CAAS;IAC/B,CAAC,YAAY,CAAC,EAAE,OAAO,CAAS;IAChC,CAAC,MAAM,CAAC,EAAE,OAAO,CAAS;IAC1B,CAAC,aAAa,CAAC,EAAE,OAAO,CAAQ;IAChC,CAAC,YAAY,CAAC,EAAE,MAAM,CAAK;IAC3B,CAAC,SAAS,CAAC,EAAE,OAAO,CAAS;IAC7B,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC;IACvB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAS;IAC3B,CAAC,aAAa,CAAC,EAAE,MAAM,CAAK;IAC5B,CAAC,SAAS,CAAC,EAAE,OAAO,CAAQ;IAE5B;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAO;IACxB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAO;IAExB;;;;;OAKG;IACH,YACE,GAAG,IAAI,EACH,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GAC5B,CAAC,KAAK,SAAS,MAAM,GACjB,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAC9B,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EA2CnC;IAED;;;;;;;;OAQG;IACH,IAAI,YAAY,WAEf;IAED;;OAEG;IACH,IAAI,QAAQ,0BAEX;IAED;;OAEG;IACH,IAAI,QAAQ,CAAC,IAAI,uBAAA,EAEhB;IAED;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,QAElC;IAED;;OAEG;IACH,IAAI,UAAU,YAEb;IAED;;OAEG;IACH,IAAI,UAAU,CAAC,GAAG,SAAA,EAEjB;IAED;;OAEG;IACH,IAAI,CAAC,OAAO,CAAC,IAAI,OAAO,CAEvB;IACD;;;;;;OAMG;IACH,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAEvB;IAGD,CAAC,KAAK,CAAC,SAIN;IAED;;OAEG;IACH,IAAI,OAAO,YAEV;IACD;;;OAGG;IACH,IAAI,OAAO,CAAC,CAAC,SAAA,EAAI;IAEjB;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAA;IAC7C,KAAK,CACH,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,EAC5B,EAAE,CAAC,EAAE,MAAM,IAAI,GACd,OAAO,CAAA;IA0GV;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CA+BpC;IAED,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,SAqBpC;IAED;;;;OAIG;IACH,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;IAC1B,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;IACxC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;IA4BtE,CAAC,MAAM,CAAC,SAYP;IAED;;;;;;;;OAQG;IACH,MAAM,SAEL;IAED;;OAEG;IACH,KAAK,SAIJ;IAED;;OAEG;IACH,IAAI,SAAS,YAEZ;IAED;;;OAGG;IACH,IAAI,OAAO,YAEV;IAED;;OAEG;IACH,IAAI,MAAM,YAET;IAED,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,QAIxB;IAED,CAAC,WAAW,CAAC,IAAI,KAAK,CAOrB;IAED,CAAC,KAAK,CAAC,CAAC,OAAO,GAAE,OAAe,QAO/B;IAED,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,KAAK,WAGxB;IAED;;;;OAIG;IACH,IAAI,CAAC,CAAC,SAAS,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,CAAC,CA0BhE;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,CAAC,SAAS,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,QAW1C;IAED;;OAEG;IACH,WAAW,CAAC,KAAK,SAAS,MAAM,MAAM,EACpC,EAAE,EAAE,KAAK,EACT,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,GACvC,IAAI,CAEN;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,EAAE,CAAC,KAAK,SAAS,MAAM,MAAM,EAC3B,EAAE,EAAE,KAAK,EACT,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,GACvC,IAAI,CAsBN;IAED;;OAEG;IACH,cAAc,CAAC,KAAK,SAAS,MAAM,MAAM,EACvC,EAAE,EAAE,KAAK,EACT,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,QAGzC;IAED;;;;;;;OAOG;IACH,GAAG,CAAC,KAAK,SAAS,MAAM,MAAM,EAC5B,EAAE,EAAE,KAAK,EACT,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,QAoBzC;IAED;;;;;;;OAOG;IACH,kBAAkB,CAAC,KAAK,SAAS,MAAM,MAAM,EAAE,EAAE,CAAC,EAAE,KAAK,QASxD;IAED;;OAEG;IACH,IAAI,UAAU,YAEb;IAED,CAAC,cAAc,CAAC,SAef;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CAAC,KAAK,SAAS,MAAM,MAAM,EAC7B,EAAE,EAAE,KAAK,EACT,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GACrB,OAAO,CAgDT;IAED,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,WAOrB;IAED,CAAC,OAAO,CAAC,YAQR;IAED,CAAC,QAAQ,CAAC,YAiBT;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAezD;IAED;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAU7B;IAED;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAM7B;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CA4D1D;IAED;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAiChD;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,QAwBnB;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ;;;;;;;;;;;OAElB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe<T extends unknown> {\n src: Minipass<T>\n dest: Minipass<any, T>\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass<T>,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass<any, T>\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors<T> extends Pipe<T> {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass<T>,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass<any, any, any>\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass<any, any, any>\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable<T> = Iterable<T> & AsyncIterable<T>\n\n type EventArguments = Record<string | symbol, unknown[]>\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events<RType extends any = Buffer>\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options<T> =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events<RType> = Minipass.Events<RType>\n >\n extends EventEmitter\n implements Minipass.DualIterable<RType>\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe<RType>[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options<RType>]\n : [Minipass.Options<RType>])\n ) {\n const options: Minipass.Options<RType> = (args[0] ||\n {}) as Minipass.Options<RType>\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe<W extends Minipass.Writable>(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe<RType>(this as Minipass<RType>, dest, opts)\n : new PipeProxyErrors<RType>(this as Minipass<RType>, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe<W extends Minipass.Writable>(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners<Event extends keyof Events>(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit<Event extends keyof Events>(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise<RType[] & { dataLength: number }> {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise<RType> {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator<RType, void, void> {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise<IteratorReturnResult<void>> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise<IteratorResult<RType, void>> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult<RType>) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise<IteratorResult<RType>>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator<RType, void, void> {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult<void> => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult<RType, void> => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass<RType, WType, Events> & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file diff --git a/tools/ui/node_modules/minipass/dist/commonjs/index.js b/tools/ui/node_modules/minipass/dist/commonjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..91f3a5cfc7a0b93eaa9e2b1c85a72ab5de993e11 --- /dev/null +++ b/tools/ui/node_modules/minipass/dist/commonjs/index.js @@ -0,0 +1,1038 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Minipass = exports.isWritable = exports.isReadable = exports.isStream = void 0; +const proc = typeof process === 'object' && process + ? process + : { + stdout: null, + stderr: null, + }; +const node_events_1 = require("node:events"); +const node_stream_1 = __importDefault(require("node:stream")); +const node_string_decoder_1 = require("node:string_decoder"); +/** + * Return true if the argument is a Minipass stream, Node stream, or something + * else that Minipass can interact with. + */ +const isStream = (s) => !!s && + typeof s === 'object' && + (s instanceof Minipass || + s instanceof node_stream_1.default || + (0, exports.isReadable)(s) || + (0, exports.isWritable)(s)) +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +; +exports.isStream = isStream; +/** + * Return true if the argument is a valid {@link Minipass.Readable} + */ +const isReadable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.pipe === 'function' && + // node core Writable streams have a pipe() method, but it throws + s.pipe !== node_stream_1.default.Writable.prototype.pipe +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +; +exports.isReadable = isReadable; +/** + * Return true if the argument is a valid {@link Minipass.Writable} + */ +const isWritable = (s) => !!s && + typeof s === 'object' && + s instanceof node_events_1.EventEmitter && + typeof s.write === 'function' && + typeof s.end === 'function'; +exports.isWritable = isWritable; +const EOF = Symbol('EOF'); +const MAYBE_EMIT_END = Symbol('maybeEmitEnd'); +const EMITTED_END = Symbol('emittedEnd'); +const EMITTING_END = Symbol('emittingEnd'); +const EMITTED_ERROR = Symbol('emittedError'); +const CLOSED = Symbol('closed'); +const READ = Symbol('read'); +const FLUSH = Symbol('flush'); +const FLUSHCHUNK = Symbol('flushChunk'); +const ENCODING = Symbol('encoding'); +const DECODER = Symbol('decoder'); +const FLOWING = Symbol('flowing'); +const PAUSED = Symbol('paused'); +const RESUME = Symbol('resume'); +const BUFFER = Symbol('buffer'); +const PIPES = Symbol('pipes'); +const BUFFERLENGTH = Symbol('bufferLength'); +const BUFFERPUSH = Symbol('bufferPush'); +const BUFFERSHIFT = Symbol('bufferShift'); +const OBJECTMODE = Symbol('objectMode'); +// internal event when stream is destroyed +const DESTROYED = Symbol('destroyed'); +// internal event when stream has an error +const ERROR = Symbol('error'); +const EMITDATA = Symbol('emitData'); +const EMITEND = Symbol('emitEnd'); +const EMITEND2 = Symbol('emitEnd2'); +const ASYNC = Symbol('async'); +const ABORT = Symbol('abort'); +const ABORTED = Symbol('aborted'); +const SIGNAL = Symbol('signal'); +const DATALISTENERS = Symbol('dataListeners'); +const DISCARDED = Symbol('discarded'); +const defer = (fn) => Promise.resolve().then(fn); +const nodefer = (fn) => fn(); +const isEndish = (ev) => ev === 'end' || ev === 'finish' || ev === 'prefinish'; +const isArrayBufferLike = (b) => b instanceof ArrayBuffer || + (!!b && + typeof b === 'object' && + b.constructor && + b.constructor.name === 'ArrayBuffer' && + b.byteLength >= 0); +const isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); +/** + * Internal class representing a pipe to a destination stream. + * + * @internal + */ +class Pipe { + src; + dest; + opts; + ondrain; + constructor(src, dest, opts) { + this.src = src; + this.dest = dest; + this.opts = opts; + this.ondrain = () => src[RESUME](); + this.dest.on('drain', this.ondrain); + } + unpipe() { + this.dest.removeListener('drain', this.ondrain); + } + // only here for the prototype + /* c8 ignore start */ + proxyErrors(_er) { } + /* c8 ignore stop */ + end() { + this.unpipe(); + if (this.opts.end) + this.dest.end(); + } +} +/** + * Internal class representing a pipe to a destination stream where + * errors are proxied. + * + * @internal + */ +class PipeProxyErrors extends Pipe { + unpipe() { + this.src.removeListener('error', this.proxyErrors); + super.unpipe(); + } + constructor(src, dest, opts) { + super(src, dest, opts); + this.proxyErrors = (er) => this.dest.emit('error', er); + src.on('error', this.proxyErrors); + } +} +const isObjectModeOptions = (o) => !!o.objectMode; +const isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== 'buffer'; +/** + * Main export, the Minipass class + * + * `RType` is the type of data emitted, defaults to Buffer + * + * `WType` is the type of data to be written, if RType is buffer or string, + * then any {@link Minipass.ContiguousData} is allowed. + * + * `Events` is the set of event handler signatures that this object + * will emit, see {@link Minipass.Events} + */ +class Minipass extends node_events_1.EventEmitter { + [FLOWING] = false; + [PAUSED] = false; + [PIPES] = []; + [BUFFER] = []; + [OBJECTMODE]; + [ENCODING]; + [ASYNC]; + [DECODER]; + [EOF] = false; + [EMITTED_END] = false; + [EMITTING_END] = false; + [CLOSED] = false; + [EMITTED_ERROR] = null; + [BUFFERLENGTH] = 0; + [DESTROYED] = false; + [SIGNAL]; + [ABORTED] = false; + [DATALISTENERS] = 0; + [DISCARDED] = false; + /** + * true if the stream can be written + */ + writable = true; + /** + * true if the stream can be read + */ + readable = true; + /** + * If `RType` is Buffer, then options do not need to be provided. + * Otherwise, an options object must be provided to specify either + * {@link Minipass.SharedOptions.objectMode} or + * {@link Minipass.SharedOptions.encoding}, as appropriate. + */ + constructor(...args) { + const options = (args[0] || + {}); + super(); + if (options.objectMode && typeof options.encoding === 'string') { + throw new TypeError('Encoding and objectMode may not be used together'); + } + if (isObjectModeOptions(options)) { + this[OBJECTMODE] = true; + this[ENCODING] = null; + } + else if (isEncodingOptions(options)) { + this[ENCODING] = options.encoding; + this[OBJECTMODE] = false; + } + else { + this[OBJECTMODE] = false; + this[ENCODING] = null; + } + this[ASYNC] = !!options.async; + this[DECODER] = this[ENCODING] + ? new node_string_decoder_1.StringDecoder(this[ENCODING]) + : null; + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposeBuffer === true) { + Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] }); + } + //@ts-ignore - private option for debugging and testing + if (options && options.debugExposePipes === true) { + Object.defineProperty(this, 'pipes', { get: () => this[PIPES] }); + } + const { signal } = options; + if (signal) { + this[SIGNAL] = signal; + if (signal.aborted) { + this[ABORT](); + } + else { + signal.addEventListener('abort', () => this[ABORT]()); + } + } + } + /** + * The amount of data stored in the buffer waiting to be read. + * + * For Buffer strings, this will be the total byte length. + * For string encoding streams, this will be the string character length, + * according to JavaScript's `string.length` logic. + * For objectMode streams, this is a count of the items waiting to be + * emitted. + */ + get bufferLength() { + return this[BUFFERLENGTH]; + } + /** + * The `BufferEncoding` currently in use, or `null` + */ + get encoding() { + return this[ENCODING]; + } + /** + * @deprecated - This is a read only property + */ + set encoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * @deprecated - Encoding may only be set at instantiation time + */ + setEncoding(_enc) { + throw new Error('Encoding must be set at instantiation time'); + } + /** + * True if this is an objectMode stream + */ + get objectMode() { + return this[OBJECTMODE]; + } + /** + * @deprecated - This is a read-only property + */ + set objectMode(_om) { + throw new Error('objectMode must be set at instantiation time'); + } + /** + * true if this is an async stream + */ + get ['async']() { + return this[ASYNC]; + } + /** + * Set to true to make this stream async. + * + * Once set, it cannot be unset, as this would potentially cause incorrect + * behavior. Ie, a sync stream can be made async, but an async stream + * cannot be safely made sync. + */ + set ['async'](a) { + this[ASYNC] = this[ASYNC] || !!a; + } + // drop everything and get out of the flow completely + [ABORT]() { + this[ABORTED] = true; + this.emit('abort', this[SIGNAL]?.reason); + this.destroy(this[SIGNAL]?.reason); + } + /** + * True if the stream has been aborted. + */ + get aborted() { + return this[ABORTED]; + } + /** + * No-op setter. Stream aborted status is set via the AbortSignal provided + * in the constructor options. + */ + set aborted(_) { } + write(chunk, encoding, cb) { + if (this[ABORTED]) + return false; + if (this[EOF]) + throw new Error('write after end'); + if (this[DESTROYED]) { + this.emit('error', Object.assign(new Error('Cannot call write after a stream was destroyed'), { code: 'ERR_STREAM_DESTROYED' })); + return true; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (!encoding) + encoding = 'utf8'; + const fn = this[ASYNC] ? defer : nodefer; + // convert array buffers and typed array views into buffers + // at some point in the future, we may want to do the opposite! + // leave strings and buffers as-is + // anything is only allowed if in object mode, so throw + if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { + if (isArrayBufferView(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); + } + else if (isArrayBufferLike(chunk)) { + //@ts-ignore - sinful unsafe type changing + chunk = Buffer.from(chunk); + } + else if (typeof chunk !== 'string') { + throw new Error('Non-contiguous data written to non-objectMode stream'); + } + } + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + // maybe impossible? + /* c8 ignore start */ + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + /* c8 ignore stop */ + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // at this point the chunk is a buffer or string + // don't buffer it up or send it to the decoder + if (!chunk.length) { + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + // fast-path writing strings of same encoding to a stream with + // an empty buffer, skipping the buffer/decoder dance + if (typeof chunk === 'string' && + // unless it is a string already ready for us to use + !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { + //@ts-ignore - sinful unsafe type change + chunk = Buffer.from(chunk, encoding); + } + if (Buffer.isBuffer(chunk) && this[ENCODING]) { + //@ts-ignore - sinful unsafe type change + chunk = this[DECODER].write(chunk); + } + // Note: flushing CAN potentially switch us into not-flowing mode + if (this[FLOWING] && this[BUFFERLENGTH] !== 0) + this[FLUSH](true); + if (this[FLOWING]) + this.emit('data', chunk); + else + this[BUFFERPUSH](chunk); + if (this[BUFFERLENGTH] !== 0) + this.emit('readable'); + if (cb) + fn(cb); + return this[FLOWING]; + } + /** + * Low-level explicit read method. + * + * In objectMode, the argument is ignored, and one item is returned if + * available. + * + * `n` is the number of bytes (or in the case of encoding streams, + * characters) to consume. If `n` is not provided, then the entire buffer + * is returned, or `null` is returned if no data is available. + * + * If `n` is greater that the amount of data in the internal buffer, + * then `null` is returned. + */ + read(n) { + if (this[DESTROYED]) + return null; + this[DISCARDED] = false; + if (this[BUFFERLENGTH] === 0 || + n === 0 || + (n && n > this[BUFFERLENGTH])) { + this[MAYBE_EMIT_END](); + return null; + } + if (this[OBJECTMODE]) + n = null; + if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { + // not object mode, so if we have an encoding, then RType is string + // otherwise, must be Buffer + this[BUFFER] = [ + (this[ENCODING] + ? this[BUFFER].join('') + : Buffer.concat(this[BUFFER], this[BUFFERLENGTH])), + ]; + } + const ret = this[READ](n || null, this[BUFFER][0]); + this[MAYBE_EMIT_END](); + return ret; + } + [READ](n, chunk) { + if (this[OBJECTMODE]) + this[BUFFERSHIFT](); + else { + const c = chunk; + if (n === c.length || n === null) + this[BUFFERSHIFT](); + else if (typeof c === 'string') { + this[BUFFER][0] = c.slice(n); + chunk = c.slice(0, n); + this[BUFFERLENGTH] -= n; + } + else { + this[BUFFER][0] = c.subarray(n); + chunk = c.subarray(0, n); + this[BUFFERLENGTH] -= n; + } + } + this.emit('data', chunk); + if (!this[BUFFER].length && !this[EOF]) + this.emit('drain'); + return chunk; + } + end(chunk, encoding, cb) { + if (typeof chunk === 'function') { + cb = chunk; + chunk = undefined; + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = 'utf8'; + } + if (chunk !== undefined) + this.write(chunk, encoding); + if (cb) + this.once('end', cb); + this[EOF] = true; + this.writable = false; + // if we haven't written anything, then go ahead and emit, + // even if we're not reading. + // we'll re-emit if a new 'end' listener is added anyway. + // This makes MP more suitable to write-only use cases. + if (this[FLOWING] || !this[PAUSED]) + this[MAYBE_EMIT_END](); + return this; + } + // don't let the internal resume be overwritten + [RESUME]() { + if (this[DESTROYED]) + return; + if (!this[DATALISTENERS] && !this[PIPES].length) { + this[DISCARDED] = true; + } + this[PAUSED] = false; + this[FLOWING] = true; + this.emit('resume'); + if (this[BUFFER].length) + this[FLUSH](); + else if (this[EOF]) + this[MAYBE_EMIT_END](); + else + this.emit('drain'); + } + /** + * Resume the stream if it is currently in a paused state + * + * If called when there are no pipe destinations or `data` event listeners, + * this will place the stream in a "discarded" state, where all data will + * be thrown away. The discarded state is removed if a pipe destination or + * data handler is added, if pause() is called, or if any synchronous or + * asynchronous iteration is started. + */ + resume() { + return this[RESUME](); + } + /** + * Pause the stream + */ + pause() { + this[FLOWING] = false; + this[PAUSED] = true; + this[DISCARDED] = false; + } + /** + * true if the stream has been forcibly destroyed + */ + get destroyed() { + return this[DESTROYED]; + } + /** + * true if the stream is currently in a flowing state, meaning that + * any writes will be immediately emitted. + */ + get flowing() { + return this[FLOWING]; + } + /** + * true if the stream is currently in a paused state + */ + get paused() { + return this[PAUSED]; + } + [BUFFERPUSH](chunk) { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] += 1; + else + this[BUFFERLENGTH] += chunk.length; + this[BUFFER].push(chunk); + } + [BUFFERSHIFT]() { + if (this[OBJECTMODE]) + this[BUFFERLENGTH] -= 1; + else + this[BUFFERLENGTH] -= this[BUFFER][0].length; + return this[BUFFER].shift(); + } + [FLUSH](noDrain = false) { + do { } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && + this[BUFFER].length); + if (!noDrain && !this[BUFFER].length && !this[EOF]) + this.emit('drain'); + } + [FLUSHCHUNK](chunk) { + this.emit('data', chunk); + return this[FLOWING]; + } + /** + * Pipe all data emitted by this stream into the destination provided. + * + * Triggers the flow of data. + */ + pipe(dest, opts) { + if (this[DESTROYED]) + return dest; + this[DISCARDED] = false; + const ended = this[EMITTED_END]; + opts = opts || {}; + if (dest === proc.stdout || dest === proc.stderr) + opts.end = false; + else + opts.end = opts.end !== false; + opts.proxyErrors = !!opts.proxyErrors; + // piping an ended stream ends immediately + if (ended) { + if (opts.end) + dest.end(); + } + else { + // "as" here just ignores the WType, which pipes don't care about, + // since they're only consuming from us, and writing to the dest + this[PIPES].push(!opts.proxyErrors + ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)); + if (this[ASYNC]) + defer(() => this[RESUME]()); + else + this[RESUME](); + } + return dest; + } + /** + * Fully unhook a piped destination stream. + * + * If the destination stream was the only consumer of this stream (ie, + * there are no other piped destinations or `'data'` event listeners) + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + unpipe(dest) { + const p = this[PIPES].find(p => p.dest === dest); + if (p) { + if (this[PIPES].length === 1) { + if (this[FLOWING] && this[DATALISTENERS] === 0) { + this[FLOWING] = false; + } + this[PIPES] = []; + } + else + this[PIPES].splice(this[PIPES].indexOf(p), 1); + p.unpipe(); + } + } + /** + * Alias for {@link Minipass#on} + */ + addListener(ev, handler) { + return this.on(ev, handler); + } + /** + * Mostly identical to `EventEmitter.on`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * - Adding a 'data' event handler will trigger the flow of data + * + * - Adding a 'readable' event handler when there is data waiting to be read + * will cause 'readable' to be emitted immediately. + * + * - Adding an 'endish' event handler ('end', 'finish', etc.) which has + * already passed will cause the event to be emitted immediately and all + * handlers removed. + * + * - Adding an 'error' event handler after an error has been emitted will + * cause the event to be re-emitted immediately with the error previously + * raised. + */ + on(ev, handler) { + const ret = super.on(ev, handler); + if (ev === 'data') { + this[DISCARDED] = false; + this[DATALISTENERS]++; + if (!this[PIPES].length && !this[FLOWING]) { + this[RESUME](); + } + } + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) { + super.emit('readable'); + } + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev); + this.removeAllListeners(ev); + } + else if (ev === 'error' && this[EMITTED_ERROR]) { + const h = handler; + if (this[ASYNC]) + defer(() => h.call(this, this[EMITTED_ERROR])); + else + h.call(this, this[EMITTED_ERROR]); + } + return ret; + } + /** + * Alias for {@link Minipass#off} + */ + removeListener(ev, handler) { + return this.off(ev, handler); + } + /** + * Mostly identical to `EventEmitter.off` + * + * If a 'data' event handler is removed, and it was the last consumer + * (ie, there are no pipe destinations or other 'data' event listeners), + * then the flow of data will stop until there is another consumer or + * {@link Minipass#resume} is explicitly called. + */ + off(ev, handler) { + const ret = super.off(ev, handler); + // if we previously had listeners, and now we don't, and we don't + // have any pipes, then stop the flow, unless it's been explicitly + // put in a discarded flowing state via stream.resume(). + if (ev === 'data') { + this[DATALISTENERS] = this.listeners('data').length; + if (this[DATALISTENERS] === 0 && + !this[DISCARDED] && + !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * Mostly identical to `EventEmitter.removeAllListeners` + * + * If all 'data' event handlers are removed, and they were the last consumer + * (ie, there are no pipe destinations), then the flow of data will stop + * until there is another consumer or {@link Minipass#resume} is explicitly + * called. + */ + removeAllListeners(ev) { + const ret = super.removeAllListeners(ev); + if (ev === 'data' || ev === undefined) { + this[DATALISTENERS] = 0; + if (!this[DISCARDED] && !this[PIPES].length) { + this[FLOWING] = false; + } + } + return ret; + } + /** + * true if the 'end' event has been emitted + */ + get emittedEnd() { + return this[EMITTED_END]; + } + [MAYBE_EMIT_END]() { + if (!this[EMITTING_END] && + !this[EMITTED_END] && + !this[DESTROYED] && + this[BUFFER].length === 0 && + this[EOF]) { + this[EMITTING_END] = true; + this.emit('end'); + this.emit('prefinish'); + this.emit('finish'); + if (this[CLOSED]) + this.emit('close'); + this[EMITTING_END] = false; + } + } + /** + * Mostly identical to `EventEmitter.emit`, with the following + * behavior differences to prevent data loss and unnecessary hangs: + * + * If the stream has been destroyed, and the event is something other + * than 'close' or 'error', then `false` is returned and no handlers + * are called. + * + * If the event is 'end', and has already been emitted, then the event + * is ignored. If the stream is in a paused or non-flowing state, then + * the event will be deferred until data flow resumes. If the stream is + * async, then handlers will be called on the next tick rather than + * immediately. + * + * If the event is 'close', and 'end' has not yet been emitted, then + * the event will be deferred until after 'end' is emitted. + * + * If the event is 'error', and an AbortSignal was provided for the stream, + * and there are no listeners, then the event is ignored, matching the + * behavior of node core streams in the presense of an AbortSignal. + * + * If the event is 'finish' or 'prefinish', then all listeners will be + * removed after emitting the event, to prevent double-firing. + */ + emit(ev, ...args) { + const data = args[0]; + // error and close are only events allowed after calling destroy() + if (ev !== 'error' && + ev !== 'close' && + ev !== DESTROYED && + this[DESTROYED]) { + return false; + } + else if (ev === 'data') { + return !this[OBJECTMODE] && !data + ? false + : this[ASYNC] + ? (defer(() => this[EMITDATA](data)), true) + : this[EMITDATA](data); + } + else if (ev === 'end') { + return this[EMITEND](); + } + else if (ev === 'close') { + this[CLOSED] = true; + // don't emit close before 'end' and 'finish' + if (!this[EMITTED_END] && !this[DESTROYED]) + return false; + const ret = super.emit('close'); + this.removeAllListeners('close'); + return ret; + } + else if (ev === 'error') { + this[EMITTED_ERROR] = data; + super.emit(ERROR, data); + const ret = !this[SIGNAL] || this.listeners('error').length + ? super.emit('error', data) + : false; + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'resume') { + const ret = super.emit('resume'); + this[MAYBE_EMIT_END](); + return ret; + } + else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev); + this.removeAllListeners(ev); + return ret; + } + // Some other unknown event + const ret = super.emit(ev, ...args); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITDATA](data) { + for (const p of this[PIPES]) { + if (p.dest.write(data) === false) + this.pause(); + } + const ret = this[DISCARDED] ? false : super.emit('data', data); + this[MAYBE_EMIT_END](); + return ret; + } + [EMITEND]() { + if (this[EMITTED_END]) + return false; + this[EMITTED_END] = true; + this.readable = false; + return this[ASYNC] + ? (defer(() => this[EMITEND2]()), true) + : this[EMITEND2](); + } + [EMITEND2]() { + if (this[DECODER]) { + const data = this[DECODER].end(); + if (data) { + for (const p of this[PIPES]) { + p.dest.write(data); + } + if (!this[DISCARDED]) + super.emit('data', data); + } + } + for (const p of this[PIPES]) { + p.end(); + } + const ret = super.emit('end'); + this.removeAllListeners('end'); + return ret; + } + /** + * Return a Promise that resolves to an array of all emitted data once + * the stream ends. + */ + async collect() { + const buf = Object.assign([], { + dataLength: 0, + }); + if (!this[OBJECTMODE]) + buf.dataLength = 0; + // set the promise first, in case an error is raised + // by triggering the flow here. + const p = this.promise(); + this.on('data', c => { + buf.push(c); + if (!this[OBJECTMODE]) + buf.dataLength += c.length; + }); + await p; + return buf; + } + /** + * Return a Promise that resolves to the concatenation of all emitted data + * once the stream ends. + * + * Not allowed on objectMode streams. + */ + async concat() { + if (this[OBJECTMODE]) { + throw new Error('cannot concat in objectMode'); + } + const buf = await this.collect(); + return (this[ENCODING] + ? buf.join('') + : Buffer.concat(buf, buf.dataLength)); + } + /** + * Return a void Promise that resolves once the stream ends. + */ + async promise() { + return new Promise((resolve, reject) => { + this.on(DESTROYED, () => reject(new Error('stream destroyed'))); + this.on('error', er => reject(er)); + this.on('end', () => resolve()); + }); + } + /** + * Asynchronous `for await of` iteration. + * + * This will continue emitting all chunks until the stream terminates. + */ + [Symbol.asyncIterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = async () => { + this.pause(); + stopped = true; + return { value: undefined, done: true }; + }; + const next = () => { + if (stopped) + return stop(); + const res = this.read(); + if (res !== null) + return Promise.resolve({ done: false, value: res }); + if (this[EOF]) + return stop(); + let resolve; + let reject; + const onerr = (er) => { + this.off('data', ondata); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + stop(); + reject(er); + }; + const ondata = (value) => { + this.off('error', onerr); + this.off('end', onend); + this.off(DESTROYED, ondestroy); + this.pause(); + resolve({ value, done: !!this[EOF] }); + }; + const onend = () => { + this.off('error', onerr); + this.off('data', ondata); + this.off(DESTROYED, ondestroy); + stop(); + resolve({ done: true, value: undefined }); + }; + const ondestroy = () => onerr(new Error('stream destroyed')); + return new Promise((res, rej) => { + reject = rej; + resolve = res; + this.once(DESTROYED, ondestroy); + this.once('error', onerr); + this.once('end', onend); + this.once('data', ondata); + }); + }; + return { + next, + throw: stop, + return: stop, + [Symbol.asyncIterator]() { + return this; + }, + [Symbol.asyncDispose]: async () => { }, + }; + } + /** + * Synchronous `for of` iteration. + * + * The iteration will terminate when the internal buffer runs out, even + * if the stream has not yet terminated. + */ + [Symbol.iterator]() { + // set this up front, in case the consumer doesn't call next() + // right away. + this[DISCARDED] = false; + let stopped = false; + const stop = () => { + this.pause(); + this.off(ERROR, stop); + this.off(DESTROYED, stop); + this.off('end', stop); + stopped = true; + return { done: true, value: undefined }; + }; + const next = () => { + if (stopped) + return stop(); + const value = this.read(); + return value === null ? stop() : { done: false, value }; + }; + this.once('end', stop); + this.once(ERROR, stop); + this.once(DESTROYED, stop); + return { + next, + throw: stop, + return: stop, + [Symbol.iterator]() { + return this; + }, + [Symbol.dispose]: () => { }, + }; + } + /** + * Destroy a stream, preventing it from being used for any further purpose. + * + * If the stream has a `close()` method, then it will be called on + * destruction. + * + * After destruction, any attempt to write data, read data, or emit most + * events will be ignored. + * + * If an error argument is provided, then it will be emitted in an + * 'error' event. + */ + destroy(er) { + if (this[DESTROYED]) { + if (er) + this.emit('error', er); + else + this.emit(DESTROYED); + return this; + } + this[DESTROYED] = true; + this[DISCARDED] = true; + // throw away all buffered data, it's never coming out + this[BUFFER].length = 0; + this[BUFFERLENGTH] = 0; + const wc = this; + if (typeof wc.close === 'function' && !this[CLOSED]) + wc.close(); + if (er) + this.emit('error', er); + // if no error to emit, still reject pending promises + else + this.emit(DESTROYED); + return this; + } + /** + * Alias for {@link isStream} + * + * Former export location, maintained for backwards compatibility. + * + * @deprecated + */ + static get isStream() { + return exports.isStream; + } +} +exports.Minipass = Minipass; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/minipass/dist/commonjs/index.js.map b/tools/ui/node_modules/minipass/dist/commonjs/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1687b4c9c1361edc4adb4f183586eb0275d6f829 --- /dev/null +++ b/tools/ui/node_modules/minipass/dist/commonjs/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;IACpC,CAAC,CAAC,OAAO;IACT,CAAC,CAAC;QACE,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;KACb,CAAA;AACP,6CAA0C;AAC1C,8DAAgC;AAChC,6DAAmD;AASnD;;;GAGG;AACI,MAAM,QAAQ,GAAG,CACtB,CAAM,EACsC,EAAE,CAC9C,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,CAAC,YAAY,QAAQ;QACpB,CAAC,YAAY,qBAAM;QACnB,IAAA,QAAA,UAAU,EAAC,CAAC,CAAC;QACb,IAAA,QAAA,UAAU,EAAC,CAAC,CAAC,CAAC;AAElB;;GAEG;AAJe,CAAA;AARL,QAAA,QAAQ,GAAR,QAAQ,CAQH;AAElB;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,0BAAY;IACzB,OAAQ,CAAuB,CAAC,IAAI,KAAK,UAAU;IACnD,iEAAiE;IAChE,CAAuB,CAAC,IAAI,KAAK,qBAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI;AAElE;;GAEG;AAJ+D,CAAA;AANrD,QAAA,UAAU,GAAV,UAAU,CAM2C;AAElE;;GAEG;AACI,MAAM,UAAU,GAAG,CAAC,CAAM,EAA0B,EAAE,CAC3D,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,QAAQ;IACrB,CAAC,YAAY,0BAAY;IACzB,OAAQ,CAAuB,CAAC,KAAK,KAAK,UAAU;IACpD,OAAQ,CAAuB,CAAC,GAAG,KAAK,UAAU,CAAA;AALvC,QAAA,UAAU,GAAV,UAAU,CAK6B;AAEpD,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACzB,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAC7C,MAAM,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACxC,MAAM,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;AAC1C,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;AAC3C,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;AACzC,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACvC,0CAA0C;AAC1C,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AACrC,0CAA0C;AAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AACnC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AACjC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC/B,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAA;AAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;AAErC,MAAM,KAAK,GAAG,CAAC,EAAwB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACtE,MAAM,OAAO,GAAG,CAAC,EAAwB,EAAE,EAAE,CAAC,EAAE,EAAE,CAAA;AAMlD,MAAM,QAAQ,GAAG,CAAC,EAAO,EAAqB,EAAE,CAC9C,EAAE,KAAK,KAAK,IAAI,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,WAAW,CAAA;AAEvD,MAAM,iBAAiB,GAAG,CAAC,CAAM,EAAwB,EAAE,CACzD,CAAC,YAAY,WAAW;IACxB,CAAC,CAAC,CAAC,CAAC;QACF,OAAO,CAAC,KAAK,QAAQ;QACrB,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,WAAW,CAAC,IAAI,KAAK,aAAa;QACpC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,CAAA;AAEtB,MAAM,iBAAiB,GAAG,CAAC,CAAM,EAAwB,EAAE,CACzD,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAgB9C;;;;GAIG;AACH,MAAM,IAAI;IACR,GAAG,CAAa;IAChB,IAAI,CAAkB;IACtB,IAAI,CAAa;IACjB,OAAO,CAAW;IAClB,YACE,GAAgB,EAChB,IAAuB,EACvB,IAAiB,EACjB;QACA,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAwB,CAAA;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;QAClC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAAA,CACpC;IACD,MAAM,GAAG;QACP,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAAA,CAChD;IACD,8BAA8B;IAC9B,qBAAqB;IACrB,WAAW,CAAC,GAAQ,EAAE,EAAC,CAAC;IACxB,oBAAoB;IACpB,GAAG,GAAG;QACJ,IAAI,CAAC,MAAM,EAAE,CAAA;QACb,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG;YAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;IAAA,CACnC;CACF;AAED;;;;;GAKG;AACH,MAAM,eAAmB,SAAQ,IAAO;IACtC,MAAM,GAAG;QACP,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;QAClD,KAAK,CAAC,MAAM,EAAE,CAAA;IAAA,CACf;IACD,YACE,GAAgB,EAChB,IAAuB,EACvB,IAAiB,EACjB;QACA,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,CAAC,EAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC7D,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IAAA,CAClC;CACF;AA6ID,MAAM,mBAAmB,GAAG,CAC1B,CAAyB,EACQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAA;AAEpD,MAAM,iBAAiB,GAAG,CACxB,CAAyB,EACM,EAAE,CACjC,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAA;AAE1D;;;;;;;;;;GAUG;AACH,cAOE,SAAQ,0BAAY;IAGpB,CAAC,OAAO,CAAC,GAAY,KAAK,CAAC;IAC3B,CAAC,MAAM,CAAC,GAAY,KAAK,CAAC;IAC1B,CAAC,KAAK,CAAC,GAAkB,EAAE,CAAC;IAC5B,CAAC,MAAM,CAAC,GAAY,EAAE,CAAC;IACvB,CAAC,UAAU,CAAC,CAAU;IACtB,CAAC,QAAQ,CAAC,CAAwB;IAClC,CAAC,KAAK,CAAC,CAAU;IACjB,CAAC,OAAO,CAAC,CAAY;IACrB,CAAC,GAAG,CAAC,GAAY,KAAK,CAAC;IACvB,CAAC,WAAW,CAAC,GAAY,KAAK,CAAC;IAC/B,CAAC,YAAY,CAAC,GAAY,KAAK,CAAC;IAChC,CAAC,MAAM,CAAC,GAAY,KAAK,CAAC;IAC1B,CAAC,aAAa,CAAC,GAAY,IAAI,CAAC;IAChC,CAAC,YAAY,CAAC,GAAW,CAAC,CAAC;IAC3B,CAAC,SAAS,CAAC,GAAY,KAAK,CAAC;IAC7B,CAAC,MAAM,CAAC,CAAe;IACvB,CAAC,OAAO,CAAC,GAAY,KAAK,CAAC;IAC3B,CAAC,aAAa,CAAC,GAAW,CAAC,CAAC;IAC5B,CAAC,SAAS,CAAC,GAAY,KAAK,CAAA;IAE5B;;OAEG;IACH,QAAQ,GAAY,IAAI,CAAA;IACxB;;OAEG;IACH,QAAQ,GAAY,IAAI,CAAA;IAExB;;;;;OAKG;IACH,YACE,GAAG,IAI+B,EAClC;QACA,MAAM,OAAO,GAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/C,EAAE,CAA4B,CAAA;QAChC,KAAK,EAAE,CAAA;QACP,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC/D,MAAM,IAAI,SAAS,CACjB,kDAAkD,CACnD,CAAA;QACH,CAAC;QACD,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAA;YACvB,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;QACvB,CAAC;aAAM,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAA;YACjC,IAAI,CAAC,UAAU,CAAC,GAAG,KAAK,CAAA;QAC1B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,CAAC,GAAG,KAAK,CAAA;YACxB,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;QACvB,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,CAAA;QAC7B,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;YAC5B,CAAC,CAAE,IAAI,mCAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAQ;YAC3C,CAAC,CAAC,IAAI,CAAA;QAER,uDAAuD;QACvD,IAAI,OAAO,IAAI,OAAO,CAAC,iBAAiB,KAAK,IAAI,EAAE,CAAC;YAClD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QACpE,CAAC;QACD,uDAAuD;QACvD,IAAI,OAAO,IAAI,OAAO,CAAC,gBAAgB,KAAK,IAAI,EAAE,CAAC;YACjD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAClE,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;QAC1B,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;YACrB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;YACf,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YACvD,CAAC;QACH,CAAC;IAAA,CACF;IAED;;;;;;;;OAQG;IACH,IAAI,YAAY,GAAG;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,CAAA;IAAA,CAC1B;IAED;;OAEG;IACH,IAAI,QAAQ,GAAG;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAA;IAAA,CACtB;IAED;;OAEG;IACH,IAAI,QAAQ,CAAC,IAAI,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;IAAA,CAC9D;IAED;;OAEG;IACH,WAAW,CAAC,IAAuB,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;IAAA,CAC9D;IAED;;OAEG;IACH,IAAI,UAAU,GAAG;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,CAAA;IAAA,CACxB;IAED;;OAEG;IACH,IAAI,UAAU,CAAC,GAAG,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;IAAA,CAChE;IAED;;OAEG;IACH,IAAI,CAAC,OAAO,CAAC,GAAY;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAA;IAAA,CACnB;IACD;;;;;;OAMG;IACH,IAAI,CAAC,OAAO,CAAC,CAAC,CAAU,EAAE;QACxB,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAAA,CACjC;IAED,qDAAqD;IACrD,CAAC,KAAK,CAAC,GAAG;QACR,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;QACpB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;QACxC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;IAAA,CACnC;IAED;;OAEG;IACH,IAAI,OAAO,GAAG;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;IAAA,CACrB;IACD;;;OAGG;IACH,IAAI,OAAO,CAAC,CAAC,EAAE,EAAC,CAAC;IA0BjB,KAAK,CACH,KAAY,EACZ,QAA2C,EAC3C,EAAe,EACN;QACT,IAAI,IAAI,CAAC,OAAO,CAAC;YAAE,OAAO,KAAK,CAAA;QAC/B,IAAI,IAAI,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QAEjD,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CACP,OAAO,EACP,MAAM,CAAC,MAAM,CACX,IAAI,KAAK,CAAC,gDAAgD,CAAC,EAC3D,EAAE,IAAI,EAAE,sBAAsB,EAAE,CACjC,CACF,CAAA;YACD,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACnC,EAAE,GAAG,QAAQ,CAAA;YACb,QAAQ,GAAG,MAAM,CAAA;QACnB,CAAC;QAED,IAAI,CAAC,QAAQ;YAAE,QAAQ,GAAG,MAAM,CAAA;QAEhC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;QAExC,2DAA2D;QAC3D,+DAA+D;QAC/D,kCAAkC;QAClC,uDAAuD;QACvD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,0CAA0C;gBAC1C,KAAK,GAAG,MAAM,CAAC,IAAI,CACjB,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,CACjB,CAAA;YACH,CAAC;iBAAM,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpC,0CAA0C;gBAC1C,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAC5B,CAAC;iBAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACrC,MAAM,IAAI,KAAK,CACb,sDAAsD,CACvD,CAAA;YACH,CAAC;QACH,CAAC;QAED,kDAAkD;QAClD,sDAAsD;QACtD,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACrB,oBAAoB;YACpB,qBAAqB;YACrB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;gBAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;YAChE,oBAAoB;YAEpB,IAAI,IAAI,CAAC,OAAO,CAAC;gBAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAyB,CAAC,CAAA;;gBAC1D,IAAI,CAAC,UAAU,CAAC,CAAC,KAAyB,CAAC,CAAA;YAEhD,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;gBAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YAEnD,IAAI,EAAE;gBAAE,EAAE,CAAC,EAAE,CAAC,CAAA;YAEd,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;QACtB,CAAC;QAED,gDAAgD;QAChD,+CAA+C;QAC/C,IAAI,CAAE,KAAiC,CAAC,MAAM,EAAE,CAAC;YAC/C,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;gBAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YACnD,IAAI,EAAE;gBAAE,EAAE,CAAC,EAAE,CAAC,CAAA;YACd,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;QACtB,CAAC;QAED,8DAA8D;QAC9D,qDAAqD;QACrD,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,oDAAoD;YACpD,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,EAC1D,CAAC;YACD,wCAAwC;YACxC,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QACtC,CAAC;QAED,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7C,wCAAwC;YACxC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpC,CAAC;QAED,iEAAiE;QACjE,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;QAEhE,IAAI,IAAI,CAAC,OAAO,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAyB,CAAC,CAAA;;YAC1D,IAAI,CAAC,UAAU,CAAC,CAAC,KAAyB,CAAC,CAAA;QAEhD,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAEnD,IAAI,EAAE;YAAE,EAAE,CAAC,EAAE,CAAC,CAAA;QAEd,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;IAAA,CACrB;IAED;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,CAAiB,EAAgB;QACpC,IAAI,IAAI,CAAC,SAAS,CAAC;YAAE,OAAO,IAAI,CAAA;QAChC,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;QAEvB,IACE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;YACxB,CAAC,KAAK,CAAC;YACP,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,EAC7B,CAAC;YACD,IAAI,CAAC,cAAc,CAAC,EAAE,CAAA;YACtB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,CAAC;YAAE,CAAC,GAAG,IAAI,CAAA;QAE9B,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACjD,mEAAmE;YACnE,4BAA4B;YAC5B,IAAI,CAAC,MAAM,CAAC,GAAG;gBACb,CAAC,IAAI,CAAC,QAAQ,CAAC;oBACb,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;oBACvB,CAAC,CAAC,MAAM,CAAC,MAAM,CACX,IAAI,CAAC,MAAM,CAAa,EACxB,IAAI,CAAC,YAAY,CAAC,CACnB,CAAU;aAChB,CAAA;QACH,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAU,CAAC,CAAA;QAC3D,IAAI,CAAC,cAAc,CAAC,EAAE,CAAA;QACtB,OAAO,GAAG,CAAA;IAAA,CACX;IAED,CAAC,IAAI,CAAC,CAAC,CAAgB,EAAE,KAAY,EAAE;QACrC,IAAI,IAAI,CAAC,UAAU,CAAC;YAAE,IAAI,CAAC,WAAW,CAAC,EAAE,CAAA;aACpC,CAAC;YACJ,MAAM,CAAC,GAAG,KAAgC,CAAA;YAC1C,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,IAAI;gBAAE,IAAI,CAAC,WAAW,CAAC,EAAE,CAAA;iBAChD,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC/B,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAU,CAAA;gBACrC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAU,CAAA;gBAC9B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;YACzB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAU,CAAA;gBACxC,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAU,CAAA;gBACjC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;YACzB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QAExB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAE1D,OAAO,KAAK,CAAA;IAAA,CACb;IAUD,GAAG,CACD,KAA4B,EAC5B,QAA2C,EAC3C,EAAe,EACT;QACN,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,EAAE,GAAG,KAAmB,CAAA;YACxB,KAAK,GAAG,SAAS,CAAA;QACnB,CAAC;QACD,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACnC,EAAE,GAAG,QAAQ,CAAA;YACb,QAAQ,GAAG,MAAM,CAAA;QACnB,CAAC;QACD,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QACpD,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;QAErB,0DAA0D;QAC1D,6BAA6B;QAC7B,yDAAyD;QACzD,uDAAuD;QACvD,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,cAAc,CAAC,EAAE,CAAA;QAC1D,OAAO,IAAI,CAAA;IAAA,CACZ;IAED,+CAA+C;IAC/C,CAAC,MAAM,CAAC,GAAG;QACT,IAAI,IAAI,CAAC,SAAS,CAAC;YAAE,OAAM;QAE3B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;YAChD,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QACxB,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACnB,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;YAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAA;aACjC,IAAI,IAAI,CAAC,GAAG,CAAC;YAAE,IAAI,CAAC,cAAc,CAAC,EAAE,CAAA;;YACrC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAAA,CACxB;IAED;;;;;;;;OAQG;IACH,MAAM,GAAG;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;IAAA,CACtB;IAED;;OAEG;IACH,KAAK,GAAG;QACN,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAA;QACrB,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;IAAA,CACxB;IAED;;OAEG;IACH,IAAI,SAAS,GAAG;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,CAAA;IAAA,CACvB;IAED;;;OAGG;IACH,IAAI,OAAO,GAAG;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;IAAA,CACrB;IAED;;OAEG;IACH,IAAI,MAAM,GAAG;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,CAAA;IAAA,CACpB;IAED,CAAC,UAAU,CAAC,CAAC,KAAY,EAAE;QACzB,IAAI,IAAI,CAAC,UAAU,CAAC;YAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;;YACxC,IAAI,CAAC,YAAY,CAAC,IAAK,KAAiC,CAAC,MAAM,CAAA;QACpE,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAAA,CACzB;IAED,CAAC,WAAW,CAAC,GAAU;QACrB,IAAI,IAAI,CAAC,UAAU,CAAC;YAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;;YAE3C,IAAI,CAAC,YAAY,CAAC,IAChB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CACf,CAAC,MAAM,CAAA;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAW,CAAA;IAAA,CACrC;IAED,CAAC,KAAK,CAAC,CAAC,OAAO,GAAY,KAAK,EAAE;QAChC,GAAG,CAAC,CAAA,CAAC,QACH,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,EACpB;QAED,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAAA,CACvE;IAED,CAAC,UAAU,CAAC,CAAC,KAAY,EAAE;QACzB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;IAAA,CACrB;IAED;;;;OAIG;IACH,IAAI,CAA8B,IAAO,EAAE,IAAkB,EAAK;QAChE,IAAI,IAAI,CAAC,SAAS,CAAC;YAAE,OAAO,IAAI,CAAA;QAChC,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;QAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,CAAA;QAC/B,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;QACjB,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM;YAAE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAA;;YAC7D,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,KAAK,KAAK,CAAA;QAClC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAA;QAErC,0CAA0C;QAC1C,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,IAAI,CAAC,GAAG;gBAAE,IAAI,CAAC,GAAG,EAAE,CAAA;QAC1B,CAAC;aAAM,CAAC;YACN,kEAAkE;YAClE,gEAAgE;YAChE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CACd,CAAC,IAAI,CAAC,WAAW;gBACf,CAAC,CAAC,IAAI,IAAI,CAAQ,IAAuB,EAAE,IAAI,EAAE,IAAI,CAAC;gBACtD,CAAC,CAAC,IAAI,eAAe,CAAQ,IAAuB,EAAE,IAAI,EAAE,IAAI,CAAC,CACpE,CAAA;YACD,IAAI,IAAI,CAAC,KAAK,CAAC;gBAAE,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;;gBACvC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;QACrB,CAAC;QAED,OAAO,IAAI,CAAA;IAAA,CACZ;IAED;;;;;;;OAOG;IACH,MAAM,CAA8B,IAAO,EAAE;QAC3C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;QAChD,IAAI,CAAC,EAAE,CAAC;YACN,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC7B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC/C,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAA;gBACvB,CAAC;gBACD,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAA;YAClB,CAAC;;gBAAM,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YACpD,CAAC,CAAC,MAAM,EAAE,CAAA;QACZ,CAAC;IAAA,CACF;IAED;;OAEG;IACH,WAAW,CACT,EAAS,EACT,OAAwC,EAClC;QACN,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAAA,CAC5B;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,EAAE,CACA,EAAS,EACT,OAAwC,EAClC;QACN,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,CAClB,EAAqB,EACrB,OAA+B,CAChC,CAAA;QACD,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;YAClB,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;YACvB,IAAI,CAAC,aAAa,CAAC,EAAE,CAAA;YACrB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC1C,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;YAChB,CAAC;QACH,CAAC;aAAM,IAAI,EAAE,KAAK,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YACzD,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACxB,CAAC;aAAM,IAAI,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACd,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;QAC7B,CAAC;aAAM,IAAI,EAAE,KAAK,OAAO,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;YACjD,MAAM,CAAC,GAAG,OAAyC,CAAA;YACnD,IAAI,IAAI,CAAC,KAAK,CAAC;gBAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;;gBAC1D,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;QACxC,CAAC;QACD,OAAO,GAAG,CAAA;IAAA,CACX;IAED;;OAEG;IACH,cAAc,CACZ,EAAS,EACT,OAAwC,EACxC;QACA,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAAA,CAC7B;IAED;;;;;;;OAOG;IACH,GAAG,CACD,EAAS,EACT,OAAwC,EACxC;QACA,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CACnB,EAAqB,EACrB,OAA+B,CAChC,CAAA;QACD,iEAAiE;QACjE,kEAAkE;QAClE,wDAAwD;QACxD,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;YAClB,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAA;YACnD,IACE,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;gBACzB,CAAC,IAAI,CAAC,SAAS,CAAC;gBAChB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EACnB,CAAC;gBACD,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAA;YACvB,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAA;IAAA,CACX;IAED;;;;;;;OAOG;IACH,kBAAkB,CAA6B,EAAU,EAAE;QACzD,MAAM,GAAG,GAAG,KAAK,CAAC,kBAAkB,CAAC,EAAiC,CAAC,CAAA;QACvE,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YACtC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;YACvB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;gBAC5C,IAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAA;YACvB,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAA;IAAA,CACX;IAED;;OAEG;IACH,IAAI,UAAU,GAAG;QACf,OAAO,IAAI,CAAC,WAAW,CAAC,CAAA;IAAA,CACzB;IAED,CAAC,cAAc,CAAC,GAAG;QACjB,IACE,CAAC,IAAI,CAAC,YAAY,CAAC;YACnB,CAAC,IAAI,CAAC,WAAW,CAAC;YAClB,CAAC,IAAI,CAAC,SAAS,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;YACzB,IAAI,CAAC,GAAG,CAAC,EACT,CAAC;YACD,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAA;YACzB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAChB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YACtB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACnB,IAAI,IAAI,CAAC,MAAM,CAAC;gBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YACpC,IAAI,CAAC,YAAY,CAAC,GAAG,KAAK,CAAA;QAC5B,CAAC;IAAA,CACF;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CACF,EAAS,EACT,GAAG,IAAmB,EACb;QACT,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACpB,kEAAkE;QAClE,IACE,EAAE,KAAK,OAAO;YACd,EAAE,KAAK,OAAO;YACd,EAAE,KAAK,SAAS;YAChB,IAAI,CAAC,SAAS,CAAC,EACf,CAAC;YACD,OAAO,KAAK,CAAA;QACd,CAAC;aAAM,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI;gBAC/B,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;oBACb,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAa,CAAC,CAAC,EAAE,IAAI,CAAC;oBACpD,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAa,CAAC,CAAA;QACnC,CAAC;aAAM,IAAI,EAAE,KAAK,KAAK,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACxB,CAAC;aAAM,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;YACnB,6CAA6C;YAC7C,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;gBAAE,OAAO,KAAK,CAAA;YACxD,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC/B,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;YAChC,OAAO,GAAG,CAAA;QACZ,CAAC;aAAM,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAA;YAC1B,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YACvB,MAAM,GAAG,GACP,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM;gBAC7C,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;gBAC3B,CAAC,CAAC,KAAK,CAAA;YACX,IAAI,CAAC,cAAc,CAAC,EAAE,CAAA;YACtB,OAAO,GAAG,CAAA;QACZ,CAAC;aAAM,IAAI,EAAE,KAAK,QAAQ,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAChC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAA;YACtB,OAAO,GAAG,CAAA;QACZ,CAAC;aAAM,IAAI,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,WAAW,EAAE,CAAC;YACjD,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAC1B,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAA;YAC3B,OAAO,GAAG,CAAA;QACZ,CAAC;QAED,2BAA2B;QAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,EAAY,EAAE,GAAG,IAAI,CAAC,CAAA;QAC7C,IAAI,CAAC,cAAc,CAAC,EAAE,CAAA;QACtB,OAAO,GAAG,CAAA;IAAA,CACX;IAED,CAAC,QAAQ,CAAC,CAAC,IAAW,EAAE;QACtB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAa,CAAC,KAAK,KAAK;gBAAE,IAAI,CAAC,KAAK,EAAE,CAAA;QACzD,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAC9D,IAAI,CAAC,cAAc,CAAC,EAAE,CAAA;QACtB,OAAO,GAAG,CAAA;IAAA,CACX;IAED,CAAC,OAAO,CAAC,GAAG;QACV,IAAI,IAAI,CAAC,WAAW,CAAC;YAAE,OAAO,KAAK,CAAA;QAEnC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC;YAChB,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC;YACvC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;IAAA,CACrB;IAED,CAAC,QAAQ,CAAC,GAAG;QACX,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAClB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAA;YAChC,IAAI,IAAI,EAAE,CAAC;gBACT,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC5B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAa,CAAC,CAAA;gBAC7B,CAAC;gBACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;oBAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YAChD,CAAC;QACH,CAAC;QAED,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,CAAC,CAAC,GAAG,EAAE,CAAA;QACT,CAAC;QACD,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC7B,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;QAC9B,OAAO,GAAG,CAAA;IAAA,CACX;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,GAA8C;QACzD,MAAM,GAAG,GAAqC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE;YAC9D,UAAU,EAAE,CAAC;SACd,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;YAAE,GAAG,CAAC,UAAU,GAAG,CAAC,CAAA;QACzC,oDAAoD;QACpD,+BAA+B;QAC/B,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;QACxB,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;YACnB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACX,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;gBACnB,GAAG,CAAC,UAAU,IAAK,CAA6B,CAAC,MAAM,CAAA;QAAA,CAC1D,CAAC,CAAA;QACF,MAAM,CAAC,CAAA;QACP,OAAO,GAAG,CAAA;IAAA,CACX;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,GAAmB;QAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;QAChD,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;QAChC,OAAO,CACL,IAAI,CAAC,QAAQ,CAAC;YACZ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACd,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,GAAe,EAAE,GAAG,CAAC,UAAU,CAAC,CAC1C,CAAA;IAAA,CACX;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,GAAkB;QAC7B,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;YAC5C,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAA;YAC/D,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;YAClC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAA;QAAA,CAChC,CAAC,CAAA;IAAA,CACH;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,aAAa,CAAC,GAAsC;QAC1D,8DAA8D;QAC9D,cAAc;QACd,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;QACvB,IAAI,OAAO,GAAG,KAAK,CAAA;QACnB,MAAM,IAAI,GAAG,KAAK,IAAyC,EAAE,CAAC;YAC5D,IAAI,CAAC,KAAK,EAAE,CAAA;YACZ,OAAO,GAAG,IAAI,CAAA;YACd,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QAAA,CACxC,CAAA;QACD,MAAM,IAAI,GAAG,GAAyC,EAAE,CAAC;YACvD,IAAI,OAAO;gBAAE,OAAO,IAAI,EAAE,CAAA;YAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;YACvB,IAAI,GAAG,KAAK,IAAI;gBAAE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;YAErE,IAAI,IAAI,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,EAAE,CAAA;YAE5B,IAAI,OAA8C,CAAA;YAClD,IAAI,MAA8B,CAAA;YAClC,MAAM,KAAK,GAAG,CAAC,EAAW,EAAE,EAAE,CAAC;gBAC7B,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBACxB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;gBACtB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;gBAC9B,IAAI,EAAE,CAAA;gBACN,MAAM,CAAC,EAAE,CAAC,CAAA;YAAA,CACX,CAAA;YACD,MAAM,MAAM,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC;gBAC/B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;gBACxB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;gBACtB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;gBAC9B,IAAI,CAAC,KAAK,EAAE,CAAA;gBACZ,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;YAAA,CACtC,CAAA;YACD,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC;gBAClB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;gBACxB,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBACxB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;gBAC9B,IAAI,EAAE,CAAA;gBACN,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;YAAA,CAC1C,CAAA;YACD,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAA;YAC5D,OAAO,IAAI,OAAO,CAAwB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;gBACtD,MAAM,GAAG,GAAG,CAAA;gBACZ,OAAO,GAAG,GAAG,CAAA;gBACb,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;gBAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;gBACzB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;gBACvB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;YAAA,CAC1B,CAAC,CAAA;QAAA,CACH,CAAA;QAED,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;YACZ,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG;gBACvB,OAAO,IAAI,CAAA;YAAA,CACZ;YACD,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC,EAAC,CAAC;SACtC,CAAA;IAAA,CACF;IAED;;;;;OAKG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAiC;QAChD,8DAA8D;QAC9D,cAAc;QACd,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;QACvB,IAAI,OAAO,GAAG,KAAK,CAAA;QACnB,MAAM,IAAI,GAAG,GAA+B,EAAE,CAAC;YAC7C,IAAI,CAAC,KAAK,EAAE,CAAA;YACZ,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YACrB,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;YACzB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YACrB,OAAO,GAAG,IAAI,CAAA;YACd,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;QAAA,CACxC,CAAA;QAED,MAAM,IAAI,GAAG,GAAgC,EAAE,CAAC;YAC9C,IAAI,OAAO;gBAAE,OAAO,IAAI,EAAE,CAAA;YAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;YACzB,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;QAAA,CACxD,CAAA;QAED,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QACtB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QAE1B,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;YACZ,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG;gBAClB,OAAO,IAAI,CAAA;YAAA,CACZ;YACD,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC;SAC3B,CAAA;IAAA,CACF;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAY,EAAE;QACpB,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACpB,IAAI,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;;gBACzB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACzB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;QAEtB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAEtB,MAAM,EAAE,GAAG,IAEV,CAAA;QACD,IAAI,OAAO,EAAE,CAAC,KAAK,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,EAAE,CAAC,KAAK,EAAE,CAAA;QAE/D,IAAI,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;QAC9B,qDAAqD;;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAEzB,OAAO,IAAI,CAAA;IAAA,CACZ;IAED;;;;;;OAMG;IACH,MAAM,KAAK,QAAQ,GAAG;QACpB,OAAO,QAAA,QAAQ,CAAA;IAAA,CAChB;CACF","sourcesContent":["const proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nimport { EventEmitter } from 'node:events'\nimport Stream from 'node:stream'\nimport { StringDecoder } from 'node:string_decoder'\n\n/**\n * Same as StringDecoder, but exposing the `lastNeed` flag on the type\n */\ntype SD = StringDecoder & { lastNeed: boolean }\n\nexport type { SD, Pipe, PipeProxyErrors }\n\n/**\n * Return true if the argument is a Minipass stream, Node stream, or something\n * else that Minipass can interact with.\n */\nexport const isStream = (\n s: any\n): s is Minipass.Readable | Minipass.Writable =>\n !!s &&\n typeof s === 'object' &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n isReadable(s) ||\n isWritable(s))\n\n/**\n * Return true if the argument is a valid {@link Minipass.Readable}\n */\nexport const isReadable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Readable).pipe === 'function' &&\n // node core Writable streams have a pipe() method, but it throws\n (s as Minipass.Readable).pipe !== Stream.Writable.prototype.pipe\n\n/**\n * Return true if the argument is a valid {@link Minipass.Writable}\n */\nexport const isWritable = (s: any): s is Minipass.Readable =>\n !!s &&\n typeof s === 'object' &&\n s instanceof EventEmitter &&\n typeof (s as Minipass.Writable).write === 'function' &&\n typeof (s as Minipass.Writable).end === 'function'\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\nconst DATALISTENERS = Symbol('dataListeners')\nconst DISCARDED = Symbol('discarded')\n\nconst defer = (fn: (...a: any[]) => any) => Promise.resolve().then(fn)\nconst nodefer = (fn: (...a: any[]) => any) => fn()\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\ntype EndishEvent = 'end' | 'finish' | 'prefinish'\nconst isEndish = (ev: any): ev is EndishEvent =>\n ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBufferLike = (b: any): b is ArrayBufferLike =>\n b instanceof ArrayBuffer ||\n (!!b &&\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = (b: any): b is ArrayBufferView =>\n !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\n/**\n * Options that may be passed to stream.pipe()\n */\nexport interface PipeOptions {\n /**\n * end the destination stream when the source stream ends\n */\n end?: boolean\n /**\n * proxy errors from the source stream to the destination stream\n */\n proxyErrors?: boolean\n}\n\n/**\n * Internal class representing a pipe to a destination stream.\n *\n * @internal\n */\nclass Pipe<T extends unknown> {\n src: Minipass<T>\n dest: Minipass<any, T>\n opts: PipeOptions\n ondrain: () => any\n constructor(\n src: Minipass<T>,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n this.src = src\n this.dest = dest as Minipass<any, T>\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n this.dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // only here for the prototype\n /* c8 ignore start */\n proxyErrors(_er: any) {}\n /* c8 ignore stop */\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\n/**\n * Internal class representing a pipe to a destination stream where\n * errors are proxied.\n *\n * @internal\n */\nclass PipeProxyErrors<T> extends Pipe<T> {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(\n src: Minipass<T>,\n dest: Minipass.Writable,\n opts: PipeOptions\n ) {\n super(src, dest, opts)\n this.proxyErrors = (er: Error) => this.dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nexport namespace Minipass {\n /**\n * Encoding used to create a stream that outputs strings rather than\n * Buffer objects.\n */\n export type Encoding = BufferEncoding | 'buffer' | null\n\n /**\n * Any stream that Minipass can pipe into\n */\n export type Writable =\n | Minipass<any, any, any>\n | NodeJS.WriteStream\n | (NodeJS.WriteStream & { fd: number })\n | (EventEmitter & {\n end(): any\n write(chunk: any, ...args: any[]): any\n })\n\n /**\n * Any stream that can be read from\n */\n export type Readable =\n | Minipass<any, any, any>\n | NodeJS.ReadStream\n | (NodeJS.ReadStream & { fd: number })\n | (EventEmitter & {\n pause(): any\n resume(): any\n pipe(...destArgs: any[]): any\n })\n\n /**\n * Utility type that can be iterated sync or async\n */\n export type DualIterable<T> = Iterable<T> & AsyncIterable<T>\n\n type EventArguments = Record<string | symbol, unknown[]>\n\n /**\n * The listing of events that a Minipass class can emit.\n * Extend this when extending the Minipass class, and pass as\n * the third template argument. The key is the name of the event,\n * and the value is the argument list.\n *\n * Any undeclared events will still be allowed, but the handler will get\n * arguments as `unknown[]`.\n */\n export interface Events<RType extends any = Buffer>\n extends EventArguments {\n readable: []\n data: [chunk: RType]\n error: [er: unknown]\n abort: [reason: unknown]\n drain: []\n resume: []\n end: []\n finish: []\n prefinish: []\n close: []\n [DESTROYED]: [er?: unknown]\n [ERROR]: [er: unknown]\n }\n\n /**\n * String or buffer-like data that can be joined and sliced\n */\n export type ContiguousData =\n | Buffer\n | ArrayBufferLike\n | ArrayBufferView\n | string\n export type BufferOrString = Buffer | string\n\n /**\n * Options passed to the Minipass constructor.\n */\n export type SharedOptions = {\n /**\n * Defer all data emission and other events until the end of the\n * current tick, similar to Node core streams\n */\n async?: boolean\n /**\n * A signal which will abort the stream\n */\n signal?: AbortSignal\n /**\n * Output string encoding. Set to `null` or `'buffer'` (or omit) to\n * emit Buffer objects rather than strings.\n *\n * Conflicts with `objectMode`\n */\n encoding?: BufferEncoding | null | 'buffer'\n /**\n * Output data exactly as it was written, supporting non-buffer/string\n * data (such as arbitrary objects, falsey values, etc.)\n *\n * Conflicts with `encoding`\n */\n objectMode?: boolean\n }\n\n /**\n * Options for a string encoded output\n */\n export type EncodingOptions = SharedOptions & {\n encoding: BufferEncoding\n objectMode?: false\n }\n\n /**\n * Options for contiguous data buffer output\n */\n export type BufferOptions = SharedOptions & {\n encoding?: null | 'buffer'\n objectMode?: false\n }\n\n /**\n * Options for objectMode arbitrary output\n */\n export type ObjectModeOptions = SharedOptions & {\n objectMode: true\n encoding?: null\n }\n\n /**\n * Utility type to determine allowed options based on read type\n */\n export type Options<T> =\n | ObjectModeOptions\n | (T extends string\n ? EncodingOptions\n : T extends Buffer\n ? BufferOptions\n : SharedOptions)\n}\n\nconst isObjectModeOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.ObjectModeOptions => !!o.objectMode\n\nconst isEncodingOptions = (\n o: Minipass.SharedOptions\n): o is Minipass.EncodingOptions =>\n !o.objectMode && !!o.encoding && o.encoding !== 'buffer'\n\n/**\n * Main export, the Minipass class\n *\n * `RType` is the type of data emitted, defaults to Buffer\n *\n * `WType` is the type of data to be written, if RType is buffer or string,\n * then any {@link Minipass.ContiguousData} is allowed.\n *\n * `Events` is the set of event handler signatures that this object\n * will emit, see {@link Minipass.Events}\n */\nexport class Minipass<\n RType extends unknown = Buffer,\n WType extends unknown = RType extends Minipass.BufferOrString\n ? Minipass.ContiguousData\n : RType,\n Events extends Minipass.Events<RType> = Minipass.Events<RType>\n >\n extends EventEmitter\n implements Minipass.DualIterable<RType>\n{\n [FLOWING]: boolean = false;\n [PAUSED]: boolean = false;\n [PIPES]: Pipe<RType>[] = [];\n [BUFFER]: RType[] = [];\n [OBJECTMODE]: boolean;\n [ENCODING]: BufferEncoding | null;\n [ASYNC]: boolean;\n [DECODER]: SD | null;\n [EOF]: boolean = false;\n [EMITTED_END]: boolean = false;\n [EMITTING_END]: boolean = false;\n [CLOSED]: boolean = false;\n [EMITTED_ERROR]: unknown = null;\n [BUFFERLENGTH]: number = 0;\n [DESTROYED]: boolean = false;\n [SIGNAL]?: AbortSignal;\n [ABORTED]: boolean = false;\n [DATALISTENERS]: number = 0;\n [DISCARDED]: boolean = false\n\n /**\n * true if the stream can be written\n */\n writable: boolean = true\n /**\n * true if the stream can be read\n */\n readable: boolean = true\n\n /**\n * If `RType` is Buffer, then options do not need to be provided.\n * Otherwise, an options object must be provided to specify either\n * {@link Minipass.SharedOptions.objectMode} or\n * {@link Minipass.SharedOptions.encoding}, as appropriate.\n */\n constructor(\n ...args:\n | [Minipass.ObjectModeOptions]\n | (RType extends Buffer\n ? [] | [Minipass.Options<RType>]\n : [Minipass.Options<RType>])\n ) {\n const options: Minipass.Options<RType> = (args[0] ||\n {}) as Minipass.Options<RType>\n super()\n if (options.objectMode && typeof options.encoding === 'string') {\n throw new TypeError(\n 'Encoding and objectMode may not be used together'\n )\n }\n if (isObjectModeOptions(options)) {\n this[OBJECTMODE] = true\n this[ENCODING] = null\n } else if (isEncodingOptions(options)) {\n this[ENCODING] = options.encoding\n this[OBJECTMODE] = false\n } else {\n this[OBJECTMODE] = false\n this[ENCODING] = null\n }\n this[ASYNC] = !!options.async\n this[DECODER] = this[ENCODING]\n ? (new StringDecoder(this[ENCODING]) as SD)\n : null\n\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n //@ts-ignore - private option for debugging and testing\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n\n const { signal } = options\n if (signal) {\n this[SIGNAL] = signal\n if (signal.aborted) {\n this[ABORT]()\n } else {\n signal.addEventListener('abort', () => this[ABORT]())\n }\n }\n }\n\n /**\n * The amount of data stored in the buffer waiting to be read.\n *\n * For Buffer strings, this will be the total byte length.\n * For string encoding streams, this will be the string character length,\n * according to JavaScript's `string.length` logic.\n * For objectMode streams, this is a count of the items waiting to be\n * emitted.\n */\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n /**\n * The `BufferEncoding` currently in use, or `null`\n */\n get encoding() {\n return this[ENCODING]\n }\n\n /**\n * @deprecated - This is a read only property\n */\n set encoding(_enc) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * @deprecated - Encoding may only be set at instantiation time\n */\n setEncoding(_enc: Minipass.Encoding) {\n throw new Error('Encoding must be set at instantiation time')\n }\n\n /**\n * True if this is an objectMode stream\n */\n get objectMode() {\n return this[OBJECTMODE]\n }\n\n /**\n * @deprecated - This is a read-only property\n */\n set objectMode(_om) {\n throw new Error('objectMode must be set at instantiation time')\n }\n\n /**\n * true if this is an async stream\n */\n get ['async'](): boolean {\n return this[ASYNC]\n }\n /**\n * Set to true to make this stream async.\n *\n * Once set, it cannot be unset, as this would potentially cause incorrect\n * behavior. Ie, a sync stream can be made async, but an async stream\n * cannot be safely made sync.\n */\n set ['async'](a: boolean) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL]?.reason)\n this.destroy(this[SIGNAL]?.reason)\n }\n\n /**\n * True if the stream has been aborted.\n */\n get aborted() {\n return this[ABORTED]\n }\n /**\n * No-op setter. Stream aborted status is set via the AbortSignal provided\n * in the constructor options.\n */\n set aborted(_) {}\n\n /**\n * Write data into the stream\n *\n * If the chunk written is a string, and encoding is not specified, then\n * `utf8` will be assumed. If the stream encoding matches the encoding of\n * a written string, and the state of the string decoder allows it, then\n * the string will be passed through to either the output or the internal\n * buffer without any processing. Otherwise, it will be turned into a\n * Buffer object for processing into the desired encoding.\n *\n * If provided, `cb` function is called immediately before return for\n * sync streams, or on next tick for async streams, because for this\n * base class, a chunk is considered \"processed\" once it is accepted\n * and either emitted or buffered. That is, the callback does not indicate\n * that the chunk has been eventually emitted, though of course child\n * classes can override this function to do whatever processing is required\n * and call `super.write(...)` only once processing is completed.\n */\n write(chunk: WType, cb?: () => void): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding,\n cb?: () => void\n ): boolean\n write(\n chunk: WType,\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): boolean {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : nodefer\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything is only allowed if in object mode, so throw\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(\n chunk.buffer,\n chunk.byteOffset,\n chunk.byteLength\n )\n } else if (isArrayBufferLike(chunk)) {\n //@ts-ignore - sinful unsafe type changing\n chunk = Buffer.from(chunk)\n } else if (typeof chunk !== 'string') {\n throw new Error(\n 'Non-contiguous data written to non-objectMode stream'\n )\n }\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n // maybe impossible?\n /* c8 ignore start */\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n /* c8 ignore stop */\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!(chunk as Minipass.BufferOrString).length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this[FLOWING]\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)\n ) {\n //@ts-ignore - sinful unsafe type change\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING]) {\n //@ts-ignore - sinful unsafe type change\n chunk = this[DECODER].write(chunk)\n }\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this[FLOWING] && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this[FLOWING]) this.emit('data', chunk as unknown as RType)\n else this[BUFFERPUSH](chunk as unknown as RType)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this[FLOWING]\n }\n\n /**\n * Low-level explicit read method.\n *\n * In objectMode, the argument is ignored, and one item is returned if\n * available.\n *\n * `n` is the number of bytes (or in the case of encoding streams,\n * characters) to consume. If `n` is not provided, then the entire buffer\n * is returned, or `null` is returned if no data is available.\n *\n * If `n` is greater that the amount of data in the internal buffer,\n * then `null` is returned.\n */\n read(n?: number | null): RType | null {\n if (this[DESTROYED]) return null\n this[DISCARDED] = false\n\n if (\n this[BUFFERLENGTH] === 0 ||\n n === 0 ||\n (n && n > this[BUFFERLENGTH])\n ) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n // not object mode, so if we have an encoding, then RType is string\n // otherwise, must be Buffer\n this[BUFFER] = [\n (this[ENCODING]\n ? this[BUFFER].join('')\n : Buffer.concat(\n this[BUFFER] as Buffer[],\n this[BUFFERLENGTH]\n )) as RType,\n ]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0] as RType)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n: number | null, chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERSHIFT]()\n else {\n const c = chunk as Minipass.BufferOrString\n if (n === c.length || n === null) this[BUFFERSHIFT]()\n else if (typeof c === 'string') {\n this[BUFFER][0] = c.slice(n) as RType\n chunk = c.slice(0, n) as RType\n this[BUFFERLENGTH] -= n\n } else {\n this[BUFFER][0] = c.subarray(n) as RType\n chunk = c.subarray(0, n) as RType\n this[BUFFERLENGTH] -= n\n }\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n /**\n * End the stream, optionally providing a final write.\n *\n * See {@link Minipass#write} for argument descriptions\n */\n end(cb?: () => void): this\n end(chunk: WType, cb?: () => void): this\n end(chunk: WType, encoding?: Minipass.Encoding, cb?: () => void): this\n end(\n chunk?: WType | (() => void),\n encoding?: Minipass.Encoding | (() => void),\n cb?: () => void\n ): this {\n if (typeof chunk === 'function') {\n cb = chunk as () => void\n chunk = undefined\n }\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = 'utf8'\n }\n if (chunk !== undefined) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this[FLOWING] || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n if (!this[DATALISTENERS] && !this[PIPES].length) {\n this[DISCARDED] = true\n }\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n /**\n * Resume the stream if it is currently in a paused state\n *\n * If called when there are no pipe destinations or `data` event listeners,\n * this will place the stream in a \"discarded\" state, where all data will\n * be thrown away. The discarded state is removed if a pipe destination or\n * data handler is added, if pause() is called, or if any synchronous or\n * asynchronous iteration is started.\n */\n resume() {\n return this[RESUME]()\n }\n\n /**\n * Pause the stream\n */\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n this[DISCARDED] = false\n }\n\n /**\n * true if the stream has been forcibly destroyed\n */\n get destroyed() {\n return this[DESTROYED]\n }\n\n /**\n * true if the stream is currently in a flowing state, meaning that\n * any writes will be immediately emitted.\n */\n get flowing() {\n return this[FLOWING]\n }\n\n /**\n * true if the stream is currently in a paused state\n */\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk: RType) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += (chunk as Minipass.BufferOrString).length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT](): RType {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= (\n this[BUFFER][0] as Minipass.BufferOrString\n ).length\n return this[BUFFER].shift() as RType\n }\n\n [FLUSH](noDrain: boolean = false) {\n do {} while (\n this[FLUSHCHUNK](this[BUFFERSHIFT]()) &&\n this[BUFFER].length\n )\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk: RType) {\n this.emit('data', chunk)\n return this[FLOWING]\n }\n\n /**\n * Pipe all data emitted by this stream into the destination provided.\n *\n * Triggers the flow of data.\n */\n pipe<W extends Minipass.Writable>(dest: W, opts?: PipeOptions): W {\n if (this[DESTROYED]) return dest\n this[DISCARDED] = false\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n // \"as\" here just ignores the WType, which pipes don't care about,\n // since they're only consuming from us, and writing to the dest\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe<RType>(this as Minipass<RType>, dest, opts)\n : new PipeProxyErrors<RType>(this as Minipass<RType>, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n /**\n * Fully unhook a piped destination stream.\n *\n * If the destination stream was the only consumer of this stream (ie,\n * there are no other piped destinations or `'data'` event listeners)\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n unpipe<W extends Minipass.Writable>(dest: W) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n if (this[PIPES].length === 1) {\n if (this[FLOWING] && this[DATALISTENERS] === 0) {\n this[FLOWING] = false\n }\n this[PIPES] = []\n } else this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n /**\n * Alias for {@link Minipass#on}\n */\n addListener<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n return this.on(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.on`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * - Adding a 'data' event handler will trigger the flow of data\n *\n * - Adding a 'readable' event handler when there is data waiting to be read\n * will cause 'readable' to be emitted immediately.\n *\n * - Adding an 'endish' event handler ('end', 'finish', etc.) which has\n * already passed will cause the event to be emitted immediately and all\n * handlers removed.\n *\n * - Adding an 'error' event handler after an error has been emitted will\n * cause the event to be re-emitted immediately with the error previously\n * raised.\n */\n on<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ): this {\n const ret = super.on(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n if (ev === 'data') {\n this[DISCARDED] = false\n this[DATALISTENERS]++\n if (!this[PIPES].length && !this[FLOWING]) {\n this[RESUME]()\n }\n } else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) {\n super.emit('readable')\n } else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n const h = handler as (...a: Events['error']) => any\n if (this[ASYNC]) defer(() => h.call(this, this[EMITTED_ERROR]))\n else h.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n /**\n * Alias for {@link Minipass#off}\n */\n removeListener<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n return this.off(ev, handler)\n }\n\n /**\n * Mostly identical to `EventEmitter.off`\n *\n * If a 'data' event handler is removed, and it was the last consumer\n * (ie, there are no pipe destinations or other 'data' event listeners),\n * then the flow of data will stop until there is another consumer or\n * {@link Minipass#resume} is explicitly called.\n */\n off<Event extends keyof Events>(\n ev: Event,\n handler: (...args: Events[Event]) => any\n ) {\n const ret = super.off(\n ev as string | symbol,\n handler as (...a: any[]) => any\n )\n // if we previously had listeners, and now we don't, and we don't\n // have any pipes, then stop the flow, unless it's been explicitly\n // put in a discarded flowing state via stream.resume().\n if (ev === 'data') {\n this[DATALISTENERS] = this.listeners('data').length\n if (\n this[DATALISTENERS] === 0 &&\n !this[DISCARDED] &&\n !this[PIPES].length\n ) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * Mostly identical to `EventEmitter.removeAllListeners`\n *\n * If all 'data' event handlers are removed, and they were the last consumer\n * (ie, there are no pipe destinations), then the flow of data will stop\n * until there is another consumer or {@link Minipass#resume} is explicitly\n * called.\n */\n removeAllListeners<Event extends keyof Events>(ev?: Event) {\n const ret = super.removeAllListeners(ev as string | symbol | undefined)\n if (ev === 'data' || ev === undefined) {\n this[DATALISTENERS] = 0\n if (!this[DISCARDED] && !this[PIPES].length) {\n this[FLOWING] = false\n }\n }\n return ret\n }\n\n /**\n * true if the 'end' event has been emitted\n */\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n /**\n * Mostly identical to `EventEmitter.emit`, with the following\n * behavior differences to prevent data loss and unnecessary hangs:\n *\n * If the stream has been destroyed, and the event is something other\n * than 'close' or 'error', then `false` is returned and no handlers\n * are called.\n *\n * If the event is 'end', and has already been emitted, then the event\n * is ignored. If the stream is in a paused or non-flowing state, then\n * the event will be deferred until data flow resumes. If the stream is\n * async, then handlers will be called on the next tick rather than\n * immediately.\n *\n * If the event is 'close', and 'end' has not yet been emitted, then\n * the event will be deferred until after 'end' is emitted.\n *\n * If the event is 'error', and an AbortSignal was provided for the stream,\n * and there are no listeners, then the event is ignored, matching the\n * behavior of node core streams in the presense of an AbortSignal.\n *\n * If the event is 'finish' or 'prefinish', then all listeners will be\n * removed after emitting the event, to prevent double-firing.\n */\n emit<Event extends keyof Events>(\n ev: Event,\n ...args: Events[Event]\n ): boolean {\n const data = args[0]\n // error and close are only events allowed after calling destroy()\n if (\n ev !== 'error' &&\n ev !== 'close' &&\n ev !== DESTROYED &&\n this[DESTROYED]\n ) {\n return false\n } else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? (defer(() => this[EMITDATA](data as RType)), true)\n : this[EMITDATA](data as RType)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return false\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev as string, ...args)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data: RType) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data as RType) === false) this.pause()\n }\n const ret = this[DISCARDED] ? false : super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return false\n\n this[EMITTED_END] = true\n this.readable = false\n return this[ASYNC]\n ? (defer(() => this[EMITEND2]()), true)\n : this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data as RType)\n }\n if (!this[DISCARDED]) super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n /**\n * Return a Promise that resolves to an array of all emitted data once\n * the stream ends.\n */\n async collect(): Promise<RType[] & { dataLength: number }> {\n const buf: RType[] & { dataLength: number } = Object.assign([], {\n dataLength: 0,\n })\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += (c as Minipass.BufferOrString).length\n })\n await p\n return buf\n }\n\n /**\n * Return a Promise that resolves to the concatenation of all emitted data\n * once the stream ends.\n *\n * Not allowed on objectMode streams.\n */\n async concat(): Promise<RType> {\n if (this[OBJECTMODE]) {\n throw new Error('cannot concat in objectMode')\n }\n const buf = await this.collect()\n return (\n this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf as Buffer[], buf.dataLength)\n ) as RType\n }\n\n /**\n * Return a void Promise that resolves once the stream ends.\n */\n async promise(): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n /**\n * Asynchronous `for await of` iteration.\n *\n * This will continue emitting all chunks until the stream terminates.\n */\n [Symbol.asyncIterator](): AsyncGenerator<RType, void, void> {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = async (): Promise<IteratorReturnResult<void>> => {\n this.pause()\n stopped = true\n return { value: undefined, done: true }\n }\n const next = (): Promise<IteratorResult<RType, void>> => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve!: (res: IteratorResult<RType>) => void\n let reject!: (er: unknown) => void\n const onerr = (er: unknown) => {\n this.off('data', ondata)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = (value: RType) => {\n this.off('error', onerr)\n this.off('end', onend)\n this.off(DESTROYED, ondestroy)\n this.pause()\n resolve({ value, done: !!this[EOF] })\n }\n const onend = () => {\n this.off('error', onerr)\n this.off('data', ondata)\n this.off(DESTROYED, ondestroy)\n stop()\n resolve({ done: true, value: undefined })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise<IteratorResult<RType>>((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.asyncIterator]() {\n return this\n },\n [Symbol.asyncDispose]: async () => {},\n }\n }\n\n /**\n * Synchronous `for of` iteration.\n *\n * The iteration will terminate when the internal buffer runs out, even\n * if the stream has not yet terminated.\n */\n [Symbol.iterator](): Generator<RType, void, void> {\n // set this up front, in case the consumer doesn't call next()\n // right away.\n this[DISCARDED] = false\n let stopped = false\n const stop = (): IteratorReturnResult<void> => {\n this.pause()\n this.off(ERROR, stop)\n this.off(DESTROYED, stop)\n this.off('end', stop)\n stopped = true\n return { done: true, value: undefined }\n }\n\n const next = (): IteratorResult<RType, void> => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { done: false, value }\n }\n\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [Symbol.iterator]() {\n return this\n },\n [Symbol.dispose]: () => {},\n }\n }\n\n /**\n * Destroy a stream, preventing it from being used for any further purpose.\n *\n * If the stream has a `close()` method, then it will be called on\n * destruction.\n *\n * After destruction, any attempt to write data, read data, or emit most\n * events will be ignored.\n *\n * If an error argument is provided, then it will be emitted in an\n * 'error' event.\n */\n destroy(er?: unknown) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n this[DISCARDED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n const wc = this as Minipass<RType, WType, Events> & {\n close?: () => void\n }\n if (typeof wc.close === 'function' && !this[CLOSED]) wc.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n /**\n * Alias for {@link isStream}\n *\n * Former export location, maintained for backwards compatibility.\n *\n * @deprecated\n */\n static get isStream() {\n return isStream\n }\n}\n"]} \ No newline at end of file

    !^a

    + *

    !^a

    + * ``` + * + * @type {State} + */ + function after(code) { + // To do: use a new field to do this, this is still needed for + // `micromark-extension-gfm-footnote`, but the `label-start-link` + // behavior isn’t. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + return code === codes.caret && + '_hiddenFootnoteSupport' in self.parser.constructs + ? nok(code) + : ok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..955c873ff3dcafb631cec59cf7b54512272d4aba --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const labelStartLink: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=label-start-link.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b242831ba15fac1a3725811dea1e9d32d39b02d7 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"label-start-link.d.ts","sourceRoot":"","sources":["label-start-link.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,6BADW,SAAS,CAKnB;+BAZS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js new file mode 100644 index 0000000000000000000000000000000000000000..91039bf029cfc535197fa731da60cc57d258b031 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js @@ -0,0 +1,62 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {codes, types} from 'micromark-util-symbol' +import {labelEnd} from './label-end.js' + +/** @type {Construct} */ +export const labelStartLink = { + name: 'labelStartLink', + resolveAll: labelEnd.resolveAll, + tokenize: tokenizeLabelStartLink +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeLabelStartLink(effects, ok, nok) { + const self = this + + return start + + /** + * Start of label (link) start. + * + * ```markdown + * > | a [b] c + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + assert(code === codes.leftSquareBracket, 'expected `[`') + effects.enter(types.labelLink) + effects.enter(types.labelMarker) + effects.consume(code) + effects.exit(types.labelMarker) + effects.exit(types.labelLink) + return after + } + + /** @type {State} */ + function after(code) { + // To do: this isn’t needed in `micromark-extension-gfm-footnote`, + // remove. + // Hidden footnotes hook. + /* c8 ignore next 3 */ + return code === codes.caret && + '_hiddenFootnoteSupport' in self.parser.constructs + ? nok(code) + : ok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3eb4a88afb8ec44f64729914b561e9fc5eb38d02 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const lineEnding: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=line-ending.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..22bb64a5bed6c25aded0771488c316b138f07c05 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/line-ending.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"line-ending.d.ts","sourceRoot":"","sources":["line-ending.js"],"names":[],"mappings":"AAcA,wBAAwB;AACxB,yBADW,SAAS,CACwD;+BATlE,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/line-ending.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/line-ending.js new file mode 100644 index 0000000000000000000000000000000000000000..a58d9e330bca739035e41ef3c42e33bd4cdf48bd --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/line-ending.js @@ -0,0 +1,34 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding} from 'micromark-util-character' +import {types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const lineEnding = {name: 'lineEnding', tokenize: tokenizeLineEnding} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeLineEnding(effects, ok) { + return start + + /** @type {State} */ + function start(code) { + assert(markdownLineEnding(code), 'expected eol') + effects.enter(types.lineEnding) + effects.consume(code) + effects.exit(types.lineEnding) + return factorySpace(effects, ok, types.linePrefix) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/list.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/list.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ebecfda629530ee4e2f129755d795c8111ee5879 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/list.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const list: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=list.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/list.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/list.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8731fa642c91a3f999c2781be6c26ce41e253ba3 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/list.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.js"],"names":[],"mappings":"AAkBA,wBAAwB;AACxB,mBADW,SAAS,CAMnB;+BAhBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/list.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/list.js new file mode 100644 index 0000000000000000000000000000000000000000..55671e12ec43194115cecf4e58c23bc4b2e5fcb5 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/list.js @@ -0,0 +1,306 @@ +/** + * @import { + * Code, + * Construct, + * Exiter, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {asciiDigit, markdownSpace} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' +import {blankLine} from './blank-line.js' +import {thematicBreak} from './thematic-break.js' + +/** @type {Construct} */ +export const list = { + continuation: {tokenize: tokenizeListContinuation}, + exit: tokenizeListEnd, + name: 'list', + tokenize: tokenizeListStart +} + +/** @type {Construct} */ +const listItemPrefixWhitespaceConstruct = { + partial: true, + tokenize: tokenizeListItemPrefixWhitespace +} + +/** @type {Construct} */ +const indentConstruct = {partial: true, tokenize: tokenizeIndent} + +// To do: `markdown-rs` parses list items on their own and later stitches them +// together. + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeListStart(effects, ok, nok) { + const self = this + const tail = self.events[self.events.length - 1] + let initialSize = + tail && tail[1].type === types.linePrefix + ? tail[2].sliceSerialize(tail[1], true).length + : 0 + let size = 0 + + return start + + /** @type {State} */ + function start(code) { + assert(self.containerState, 'expected state') + const kind = + self.containerState.type || + (code === codes.asterisk || code === codes.plusSign || code === codes.dash + ? types.listUnordered + : types.listOrdered) + + if ( + kind === types.listUnordered + ? !self.containerState.marker || code === self.containerState.marker + : asciiDigit(code) + ) { + if (!self.containerState.type) { + self.containerState.type = kind + effects.enter(kind, {_container: true}) + } + + if (kind === types.listUnordered) { + effects.enter(types.listItemPrefix) + return code === codes.asterisk || code === codes.dash + ? effects.check(thematicBreak, nok, atMarker)(code) + : atMarker(code) + } + + if (!self.interrupt || code === codes.digit1) { + effects.enter(types.listItemPrefix) + effects.enter(types.listItemValue) + return inside(code) + } + } + + return nok(code) + } + + /** @type {State} */ + function inside(code) { + assert(self.containerState, 'expected state') + if (asciiDigit(code) && ++size < constants.listItemValueSizeMax) { + effects.consume(code) + return inside + } + + if ( + (!self.interrupt || size < 2) && + (self.containerState.marker + ? code === self.containerState.marker + : code === codes.rightParenthesis || code === codes.dot) + ) { + effects.exit(types.listItemValue) + return atMarker(code) + } + + return nok(code) + } + + /** + * @type {State} + **/ + function atMarker(code) { + assert(self.containerState, 'expected state') + assert(code !== codes.eof, 'eof (`null`) is not a marker') + effects.enter(types.listItemMarker) + effects.consume(code) + effects.exit(types.listItemMarker) + self.containerState.marker = self.containerState.marker || code + return effects.check( + blankLine, + // Can’t be empty when interrupting. + self.interrupt ? nok : onBlank, + effects.attempt( + listItemPrefixWhitespaceConstruct, + endOfPrefix, + otherPrefix + ) + ) + } + + /** @type {State} */ + function onBlank(code) { + assert(self.containerState, 'expected state') + self.containerState.initialBlankLine = true + initialSize++ + return endOfPrefix(code) + } + + /** @type {State} */ + function otherPrefix(code) { + if (markdownSpace(code)) { + effects.enter(types.listItemPrefixWhitespace) + effects.consume(code) + effects.exit(types.listItemPrefixWhitespace) + return endOfPrefix + } + + return nok(code) + } + + /** @type {State} */ + function endOfPrefix(code) { + assert(self.containerState, 'expected state') + self.containerState.size = + initialSize + + self.sliceSerialize(effects.exit(types.listItemPrefix), true).length + return ok(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeListContinuation(effects, ok, nok) { + const self = this + + assert(self.containerState, 'expected state') + self.containerState._closeFlow = undefined + + return effects.check(blankLine, onBlank, notBlank) + + /** @type {State} */ + function onBlank(code) { + assert(self.containerState, 'expected state') + assert(typeof self.containerState.size === 'number', 'expected size') + self.containerState.furtherBlankLines = + self.containerState.furtherBlankLines || + self.containerState.initialBlankLine + + // We have a blank line. + // Still, try to consume at most the items size. + return factorySpace( + effects, + ok, + types.listItemIndent, + self.containerState.size + 1 + )(code) + } + + /** @type {State} */ + function notBlank(code) { + assert(self.containerState, 'expected state') + if (self.containerState.furtherBlankLines || !markdownSpace(code)) { + self.containerState.furtherBlankLines = undefined + self.containerState.initialBlankLine = undefined + return notInCurrentItem(code) + } + + self.containerState.furtherBlankLines = undefined + self.containerState.initialBlankLine = undefined + return effects.attempt(indentConstruct, ok, notInCurrentItem)(code) + } + + /** @type {State} */ + function notInCurrentItem(code) { + assert(self.containerState, 'expected state') + // While we do continue, we signal that the flow should be closed. + self.containerState._closeFlow = true + // As we’re closing flow, we’re no longer interrupting. + self.interrupt = undefined + // Always populated by defaults. + assert( + self.parser.constructs.disable.null, + 'expected `disable.null` to be populated' + ) + return factorySpace( + effects, + effects.attempt(list, ok, nok), + types.linePrefix, + self.parser.constructs.disable.null.includes('codeIndented') + ? undefined + : constants.tabSize + )(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeIndent(effects, ok, nok) { + const self = this + + assert(self.containerState, 'expected state') + assert(typeof self.containerState.size === 'number', 'expected size') + + return factorySpace( + effects, + afterPrefix, + types.listItemIndent, + self.containerState.size + 1 + ) + + /** @type {State} */ + function afterPrefix(code) { + assert(self.containerState, 'expected state') + const tail = self.events[self.events.length - 1] + return tail && + tail[1].type === types.listItemIndent && + tail[2].sliceSerialize(tail[1], true).length === self.containerState.size + ? ok(code) + : nok(code) + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Exiter} + */ +function tokenizeListEnd(effects) { + assert(this.containerState, 'expected state') + assert(typeof this.containerState.type === 'string', 'expected type') + effects.exit(this.containerState.type) +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeListItemPrefixWhitespace(effects, ok, nok) { + const self = this + + // Always populated by defaults. + assert( + self.parser.constructs.disable.null, + 'expected `disable.null` to be populated' + ) + + return factorySpace( + effects, + afterPrefix, + types.listItemPrefixWhitespace, + self.parser.constructs.disable.null.includes('codeIndented') + ? undefined + : constants.tabSize + 1 + ) + + /** @type {State} */ + function afterPrefix(code) { + const tail = self.events[self.events.length - 1] + + return !markdownSpace(code) && + tail && + tail[1].type === types.listItemPrefixWhitespace + ? ok(code) + : nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d7ca340f4f659fa79d6438660bcdd3a0c8583a21 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const setextUnderline: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=setext-underline.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..296f7c681e31b0a670a4a5091c194be9a77d82ae --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"setext-underline.d.ts","sourceRoot":"","sources":["setext-underline.js"],"names":[],"mappings":"AAgBA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAbS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js new file mode 100644 index 0000000000000000000000000000000000000000..9379f906c4c0608167e2791372afebee290decea --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js @@ -0,0 +1,210 @@ +/** + * @import { + * Code, + * Construct, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding, markdownSpace} from 'micromark-util-character' +import {codes, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const setextUnderline = { + name: 'setextUnderline', + resolveTo: resolveToSetextUnderline, + tokenize: tokenizeSetextUnderline +} + +/** @type {Resolver} */ +function resolveToSetextUnderline(events, context) { + // To do: resolve like `markdown-rs`. + let index = events.length + /** @type {number | undefined} */ + let content + /** @type {number | undefined} */ + let text + /** @type {number | undefined} */ + let definition + + // Find the opening of the content. + // It’ll always exist: we don’t tokenize if it isn’t there. + while (index--) { + if (events[index][0] === 'enter') { + if (events[index][1].type === types.content) { + content = index + break + } + + if (events[index][1].type === types.paragraph) { + text = index + } + } + // Exit + else { + if (events[index][1].type === types.content) { + // Remove the content end (if needed we’ll add it later) + events.splice(index, 1) + } + + if (!definition && events[index][1].type === types.definition) { + definition = index + } + } + } + + assert(text !== undefined, 'expected a `text` index to be found') + assert(content !== undefined, 'expected a `text` index to be found') + assert(events[content][2] === context, 'enter context should be same') + assert( + events[events.length - 1][2] === context, + 'enter context should be same' + ) + const heading = { + type: types.setextHeading, + start: {...events[content][1].start}, + end: {...events[events.length - 1][1].end} + } + + // Change the paragraph to setext heading text. + events[text][1].type = types.setextHeadingText + + // If we have definitions in the content, we’ll keep on having content, + // but we need move it. + if (definition) { + events.splice(text, 0, ['enter', heading, context]) + events.splice(definition + 1, 0, ['exit', events[content][1], context]) + events[content][1].end = {...events[definition][1].end} + } else { + events[content][1] = heading + } + + // Add the heading exit at the end. + events.push(['exit', heading, context]) + + return events +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeSetextUnderline(effects, ok, nok) { + const self = this + /** @type {NonNullable} */ + let marker + + return start + + /** + * At start of heading (setext) underline. + * + * ```markdown + * | aa + * > | == + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + let index = self.events.length + /** @type {boolean | undefined} */ + let paragraph + + assert( + code === codes.dash || code === codes.equalsTo, + 'expected `=` or `-`' + ) + + // Find an opening. + while (index--) { + // Skip enter/exit of line ending, line prefix, and content. + // We can now either have a definition or a paragraph. + if ( + self.events[index][1].type !== types.lineEnding && + self.events[index][1].type !== types.linePrefix && + self.events[index][1].type !== types.content + ) { + paragraph = self.events[index][1].type === types.paragraph + break + } + } + + // To do: handle lazy/pierce like `markdown-rs`. + // To do: parse indent like `markdown-rs`. + if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) { + effects.enter(types.setextHeadingLine) + marker = code + return before(code) + } + + return nok(code) + } + + /** + * After optional whitespace, at `-` or `=`. + * + * ```markdown + * | aa + * > | == + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + effects.enter(types.setextHeadingLineSequence) + return inside(code) + } + + /** + * In sequence. + * + * ```markdown + * | aa + * > | == + * ^ + * ``` + * + * @type {State} + */ + function inside(code) { + if (code === marker) { + effects.consume(code) + return inside + } + + effects.exit(types.setextHeadingLineSequence) + + return markdownSpace(code) + ? factorySpace(effects, after, types.lineSuffix)(code) + : after(code) + } + + /** + * After sequence, after optional whitespace. + * + * ```markdown + * | aa + * > | == + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + if (code === codes.eof || markdownLineEnding(code)) { + effects.exit(types.setextHeadingLine) + return ok(code) + } + + return nok(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..51e9e97c650792cb0bc40c6e7065c1705796c4ac --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const thematicBreak: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=thematic-break.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d10a65bbc279681c956eddb067552b05eb8ba5a3 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/thematic-break.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"thematic-break.d.ts","sourceRoot":"","sources":["thematic-break.js"],"names":[],"mappings":"AAeA,wBAAwB;AACxB,4BADW,SAAS,CAInB;+BAZS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/dev/lib/thematic-break.js b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/thematic-break.js new file mode 100644 index 0000000000000000000000000000000000000000..355dd6afd991c52871c0c2048cd8f262e51d776c --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/dev/lib/thematic-break.js @@ -0,0 +1,120 @@ +/** + * @import { + * Code, + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import {ok as assert} from 'devlop' +import {factorySpace} from 'micromark-factory-space' +import {markdownLineEnding, markdownSpace} from 'micromark-util-character' +import {codes, constants, types} from 'micromark-util-symbol' + +/** @type {Construct} */ +export const thematicBreak = { + name: 'thematicBreak', + tokenize: tokenizeThematicBreak +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeThematicBreak(effects, ok, nok) { + let size = 0 + /** @type {NonNullable} */ + let marker + + return start + + /** + * Start of thematic break. + * + * ```markdown + * > | *** + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter(types.thematicBreak) + // To do: parse indent like `markdown-rs`. + return before(code) + } + + /** + * After optional whitespace, at marker. + * + * ```markdown + * > | *** + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + assert( + code === codes.asterisk || + code === codes.dash || + code === codes.underscore, + 'expected `*`, `-`, or `_`' + ) + marker = code + return atBreak(code) + } + + /** + * After something, before something else. + * + * ```markdown + * > | *** + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === marker) { + effects.enter(types.thematicBreakSequence) + return sequence(code) + } + + if ( + size >= constants.thematicBreakMarkerCountMin && + (code === codes.eof || markdownLineEnding(code)) + ) { + effects.exit(types.thematicBreak) + return ok(code) + } + + return nok(code) + } + + /** + * In sequence. + * + * ```markdown + * > | *** + * ^ + * ``` + * + * @type {State} + */ + function sequence(code) { + if (code === marker) { + effects.consume(code) + size++ + return sequence + } + + effects.exit(types.thematicBreakSequence) + return markdownSpace(code) + ? factorySpace(effects, atBreak, types.whitespace)(code) + : atBreak(code) + } +} diff --git a/tools/ui/node_modules/micromark-core-commonmark/index.d.ts b/tools/ui/node_modules/micromark-core-commonmark/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bd832f665cfdf802955e1fb1663357efe8d03eff --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/index.d.ts @@ -0,0 +1,23 @@ +export { attention } from "./lib/attention.js"; +export { autolink } from "./lib/autolink.js"; +export { blankLine } from "./lib/blank-line.js"; +export { blockQuote } from "./lib/block-quote.js"; +export { characterEscape } from "./lib/character-escape.js"; +export { characterReference } from "./lib/character-reference.js"; +export { codeFenced } from "./lib/code-fenced.js"; +export { codeIndented } from "./lib/code-indented.js"; +export { codeText } from "./lib/code-text.js"; +export { content } from "./lib/content.js"; +export { definition } from "./lib/definition.js"; +export { hardBreakEscape } from "./lib/hard-break-escape.js"; +export { headingAtx } from "./lib/heading-atx.js"; +export { htmlFlow } from "./lib/html-flow.js"; +export { htmlText } from "./lib/html-text.js"; +export { labelEnd } from "./lib/label-end.js"; +export { labelStartImage } from "./lib/label-start-image.js"; +export { labelStartLink } from "./lib/label-start-link.js"; +export { lineEnding } from "./lib/line-ending.js"; +export { list } from "./lib/list.js"; +export { setextUnderline } from "./lib/setext-underline.js"; +export { thematicBreak } from "./lib/thematic-break.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/index.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..ca7a93a9a2807d2076f2cc871f10d62d40e1265d --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/index.js b/tools/ui/node_modules/micromark-core-commonmark/index.js new file mode 100644 index 0000000000000000000000000000000000000000..969b1cdf1228636c4ceccc85cea270ad47c3471f --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/index.js @@ -0,0 +1,22 @@ +export { attention } from './lib/attention.js'; +export { autolink } from './lib/autolink.js'; +export { blankLine } from './lib/blank-line.js'; +export { blockQuote } from './lib/block-quote.js'; +export { characterEscape } from './lib/character-escape.js'; +export { characterReference } from './lib/character-reference.js'; +export { codeFenced } from './lib/code-fenced.js'; +export { codeIndented } from './lib/code-indented.js'; +export { codeText } from './lib/code-text.js'; +export { content } from './lib/content.js'; +export { definition } from './lib/definition.js'; +export { hardBreakEscape } from './lib/hard-break-escape.js'; +export { headingAtx } from './lib/heading-atx.js'; +export { htmlFlow } from './lib/html-flow.js'; +export { htmlText } from './lib/html-text.js'; +export { labelEnd } from './lib/label-end.js'; +export { labelStartImage } from './lib/label-start-image.js'; +export { labelStartLink } from './lib/label-start-link.js'; +export { lineEnding } from './lib/line-ending.js'; +export { list } from './lib/list.js'; +export { setextUnderline } from './lib/setext-underline.js'; +export { thematicBreak } from './lib/thematic-break.js'; \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/attention.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/attention.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c8a1747cd541882f27256474956bf083271d56d --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/attention.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const attention: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=attention.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/attention.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/attention.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..a903a8668f8add6b01762fe3636413a980b97d87 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/attention.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"attention.d.ts","sourceRoot":"","sources":["attention.js"],"names":[],"mappings":"AAoBA,wBAAwB;AACxB,wBADW,SAAS,CAKnB;+BAdS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/attention.js b/tools/ui/node_modules/micromark-core-commonmark/lib/attention.js new file mode 100644 index 0000000000000000000000000000000000000000..1040eb0498e88cae2a24997296689f56add69a0c --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/attention.js @@ -0,0 +1,241 @@ +/** + * @import { + * Code, + * Construct, + * Event, + * Point, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import { push, splice } from 'micromark-util-chunked'; +import { classifyCharacter } from 'micromark-util-classify-character'; +import { resolveAll } from 'micromark-util-resolve-all'; +/** @type {Construct} */ +export const attention = { + name: 'attention', + resolveAll: resolveAllAttention, + tokenize: tokenizeAttention +}; + +/** + * Take all events and resolve attention to emphasis or strong. + * + * @type {Resolver} + */ +// eslint-disable-next-line complexity +function resolveAllAttention(events, context) { + let index = -1; + /** @type {number} */ + let open; + /** @type {Token} */ + let group; + /** @type {Token} */ + let text; + /** @type {Token} */ + let openingSequence; + /** @type {Token} */ + let closingSequence; + /** @type {number} */ + let use; + /** @type {Array} */ + let nextEvents; + /** @type {number} */ + let offset; + + // Walk through all events. + // + // Note: performance of this is fine on an mb of normal markdown, but it’s + // a bottleneck for malicious stuff. + while (++index < events.length) { + // Find a token that can close. + if (events[index][0] === 'enter' && events[index][1].type === 'attentionSequence' && events[index][1]._close) { + open = index; + + // Now walk back to find an opener. + while (open--) { + // Find a token that can open the closer. + if (events[open][0] === 'exit' && events[open][1].type === 'attentionSequence' && events[open][1]._open && + // If the markers are the same: + context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) { + // If the opening can close or the closing can open, + // and the close size *is not* a multiple of three, + // but the sum of the opening and closing size *is* multiple of three, + // then don’t match. + if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) { + continue; + } + + // Number of markers to use from the sequence. + use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1; + const start = { + ...events[open][1].end + }; + const end = { + ...events[index][1].start + }; + movePoint(start, -use); + movePoint(end, use); + openingSequence = { + type: use > 1 ? "strongSequence" : "emphasisSequence", + start, + end: { + ...events[open][1].end + } + }; + closingSequence = { + type: use > 1 ? "strongSequence" : "emphasisSequence", + start: { + ...events[index][1].start + }, + end + }; + text = { + type: use > 1 ? "strongText" : "emphasisText", + start: { + ...events[open][1].end + }, + end: { + ...events[index][1].start + } + }; + group = { + type: use > 1 ? "strong" : "emphasis", + start: { + ...openingSequence.start + }, + end: { + ...closingSequence.end + } + }; + events[open][1].end = { + ...openingSequence.start + }; + events[index][1].start = { + ...closingSequence.end + }; + nextEvents = []; + + // If there are more markers in the opening, add them before. + if (events[open][1].end.offset - events[open][1].start.offset) { + nextEvents = push(nextEvents, [['enter', events[open][1], context], ['exit', events[open][1], context]]); + } + + // Opening. + nextEvents = push(nextEvents, [['enter', group, context], ['enter', openingSequence, context], ['exit', openingSequence, context], ['enter', text, context]]); + + // Always populated by defaults. + + // Between. + nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context)); + + // Closing. + nextEvents = push(nextEvents, [['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], ['exit', group, context]]); + + // If there are more markers in the closing, add them after. + if (events[index][1].end.offset - events[index][1].start.offset) { + offset = 2; + nextEvents = push(nextEvents, [['enter', events[index][1], context], ['exit', events[index][1], context]]); + } else { + offset = 0; + } + splice(events, open - 1, index - open + 3, nextEvents); + index = open + nextEvents.length - offset - 2; + break; + } + } + } + } + + // Remove remaining sequences. + index = -1; + while (++index < events.length) { + if (events[index][1].type === 'attentionSequence') { + events[index][1].type = 'data'; + } + } + return events; +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeAttention(effects, ok) { + const attentionMarkers = this.parser.constructs.attentionMarkers.null; + const previous = this.previous; + const before = classifyCharacter(previous); + + /** @type {NonNullable} */ + let marker; + return start; + + /** + * Before a sequence. + * + * ```markdown + * > | ** + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + marker = code; + effects.enter('attentionSequence'); + return inside(code); + } + + /** + * In a sequence. + * + * ```markdown + * > | ** + * ^^ + * ``` + * + * @type {State} + */ + function inside(code) { + if (code === marker) { + effects.consume(code); + return inside; + } + const token = effects.exit('attentionSequence'); + + // To do: next major: move this to resolver, just like `markdown-rs`. + const after = classifyCharacter(code); + + // Always populated by defaults. + + const open = !after || after === 2 && before || attentionMarkers.includes(code); + const close = !before || before === 2 && after || attentionMarkers.includes(previous); + token._open = Boolean(marker === 42 ? open : open && (before || !close)); + token._close = Boolean(marker === 42 ? close : close && (after || !open)); + return ok(code); + } +} + +/** + * Move a point a bit. + * + * Note: `move` only works inside lines! It’s not possible to move past other + * chunks (replacement characters, tabs, or line endings). + * + * @param {Point} point + * Point. + * @param {number} offset + * Amount to move. + * @returns {undefined} + * Nothing. + */ +function movePoint(point, offset) { + point.column += offset; + point.offset += offset; + point._bufferIndex += offset; +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/autolink.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/autolink.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a69457b269fcc1d83c432756ca186d793bac5395 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/autolink.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const autolink: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=autolink.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/autolink.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/autolink.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7b0216b0a09072c2df4bee60f469f5ff8750c413 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/autolink.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"autolink.d.ts","sourceRoot":"","sources":["autolink.js"],"names":[],"mappings":"AAkBA,wBAAwB;AACxB,uBADW,SAAS,CACkD;+BAb5D,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/autolink.js b/tools/ui/node_modules/micromark-core-commonmark/lib/autolink.js new file mode 100644 index 0000000000000000000000000000000000000000..a73d2b5c6582704ae5e5f1120fa793769df0771b --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/autolink.js @@ -0,0 +1,233 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { asciiAlphanumeric, asciiAlpha, asciiAtext, asciiControl } from 'micromark-util-character'; +/** @type {Construct} */ +export const autolink = { + name: 'autolink', + tokenize: tokenizeAutolink +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeAutolink(effects, ok, nok) { + let size = 0; + return start; + + /** + * Start of an autolink. + * + * ```markdown + * > | ab + * ^ + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("autolink"); + effects.enter("autolinkMarker"); + effects.consume(code); + effects.exit("autolinkMarker"); + effects.enter("autolinkProtocol"); + return open; + } + + /** + * After `<`, at protocol or atext. + * + * ```markdown + * > | ab + * ^ + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (asciiAlpha(code)) { + effects.consume(code); + return schemeOrEmailAtext; + } + if (code === 64) { + return nok(code); + } + return emailAtext(code); + } + + /** + * At second byte of protocol or atext. + * + * ```markdown + * > | ab + * ^ + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function schemeOrEmailAtext(code) { + // ASCII alphanumeric and `+`, `-`, and `.`. + if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) { + // Count the previous alphabetical from `open` too. + size = 1; + return schemeInsideOrEmailAtext(code); + } + return emailAtext(code); + } + + /** + * In ambiguous protocol or atext. + * + * ```markdown + * > | ab + * ^ + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function schemeInsideOrEmailAtext(code) { + if (code === 58) { + effects.consume(code); + size = 0; + return urlInside; + } + + // ASCII alphanumeric and `+`, `-`, and `.`. + if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) { + effects.consume(code); + return schemeInsideOrEmailAtext; + } + size = 0; + return emailAtext(code); + } + + /** + * After protocol, in URL. + * + * ```markdown + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function urlInside(code) { + if (code === 62) { + effects.exit("autolinkProtocol"); + effects.enter("autolinkMarker"); + effects.consume(code); + effects.exit("autolinkMarker"); + effects.exit("autolink"); + return ok; + } + + // ASCII control, space, or `<`. + if (code === null || code === 32 || code === 60 || asciiControl(code)) { + return nok(code); + } + effects.consume(code); + return urlInside; + } + + /** + * In email atext. + * + * ```markdown + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function emailAtext(code) { + if (code === 64) { + effects.consume(code); + return emailAtSignOrDot; + } + if (asciiAtext(code)) { + effects.consume(code); + return emailAtext; + } + return nok(code); + } + + /** + * In label, after at-sign or dot. + * + * ```markdown + * > | ab + * ^ ^ + * ``` + * + * @type {State} + */ + function emailAtSignOrDot(code) { + return asciiAlphanumeric(code) ? emailLabel(code) : nok(code); + } + + /** + * In label, where `.` and `>` are allowed. + * + * ```markdown + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function emailLabel(code) { + if (code === 46) { + effects.consume(code); + size = 0; + return emailAtSignOrDot; + } + if (code === 62) { + // Exit, then change the token type. + effects.exit("autolinkProtocol").type = "autolinkEmail"; + effects.enter("autolinkMarker"); + effects.consume(code); + effects.exit("autolinkMarker"); + effects.exit("autolink"); + return ok; + } + return emailValue(code); + } + + /** + * In label, where `.` and `>` are *not* allowed. + * + * Though, this is also used in `emailLabel` to parse other values. + * + * ```markdown + * > | ab + * ^ + * ``` + * + * @type {State} + */ + function emailValue(code) { + // ASCII alphanumeric or `-`. + if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { + const next = code === 45 ? emailValue : emailLabel; + effects.consume(code); + return next; + } + return nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/blank-line.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/blank-line.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a8deca617ee590e8028a5a3caec897d6c5b44d6 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/blank-line.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const blankLine: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=blank-line.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/blank-line.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/blank-line.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f12302d76e6834ec78fb367b18810cba19273ce7 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/blank-line.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"blank-line.d.ts","sourceRoot":"","sources":["blank-line.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,wBADW,SAAS,CACiD;+BAR3D,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/blank-line.js b/tools/ui/node_modules/micromark-core-commonmark/lib/blank-line.js new file mode 100644 index 0000000000000000000000000000000000000000..93a7eaa428f124698c08e8bdbf555d49147351a2 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/blank-line.js @@ -0,0 +1,61 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** @type {Construct} */ +export const blankLine = { + partial: true, + tokenize: tokenizeBlankLine +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeBlankLine(effects, ok, nok) { + return start; + + /** + * Start of blank line. + * + * > 👉 **Note**: `␠` represents a space character. + * + * ```markdown + * > | ␠␠␊ + * ^ + * > | ␊ + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + return markdownSpace(code) ? factorySpace(effects, after, "linePrefix")(code) : after(code); + } + + /** + * At eof/eol, after optional whitespace. + * + * > 👉 **Note**: `␠` represents a space character. + * + * ```markdown + * > | ␠␠␊ + * ^ + * > | ␊ + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + return code === null || markdownLineEnding(code) ? ok(code) : nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/block-quote.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/block-quote.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..bf91ff18e8eb3339cbeeda55b8e3a1a2875cddfa --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/block-quote.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const blockQuote: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=block-quote.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/block-quote.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/block-quote.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b19ef02032e9d309cd3b3b73a696e968e77f916e --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/block-quote.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"block-quote.d.ts","sourceRoot":"","sources":["block-quote.js"],"names":[],"mappings":"AAeA,wBAAwB;AACxB,yBADW,SAAS,CAMnB;+BAdS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/block-quote.js b/tools/ui/node_modules/micromark-core-commonmark/lib/block-quote.js new file mode 100644 index 0000000000000000000000000000000000000000..57af7cccd48f4a7c59fc95e40e766d257590664b --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/block-quote.js @@ -0,0 +1,143 @@ +/** + * @import { + * Construct, + * Exiter, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownSpace } from 'micromark-util-character'; +/** @type {Construct} */ +export const blockQuote = { + continuation: { + tokenize: tokenizeBlockQuoteContinuation + }, + exit, + name: 'blockQuote', + tokenize: tokenizeBlockQuoteStart +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeBlockQuoteStart(effects, ok, nok) { + const self = this; + return start; + + /** + * Start of block quote. + * + * ```markdown + * > | > a + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + if (code === 62) { + const state = self.containerState; + if (!state.open) { + effects.enter("blockQuote", { + _container: true + }); + state.open = true; + } + effects.enter("blockQuotePrefix"); + effects.enter("blockQuoteMarker"); + effects.consume(code); + effects.exit("blockQuoteMarker"); + return after; + } + return nok(code); + } + + /** + * After `>`, before optional whitespace. + * + * ```markdown + * > | > a + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + if (markdownSpace(code)) { + effects.enter("blockQuotePrefixWhitespace"); + effects.consume(code); + effects.exit("blockQuotePrefixWhitespace"); + effects.exit("blockQuotePrefix"); + return ok; + } + effects.exit("blockQuotePrefix"); + return ok(code); + } +} + +/** + * Start of block quote continuation. + * + * ```markdown + * | > a + * > | > b + * ^ + * ``` + * + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeBlockQuoteContinuation(effects, ok, nok) { + const self = this; + return contStart; + + /** + * Start of block quote continuation. + * + * Also used to parse the first block quote opening. + * + * ```markdown + * | > a + * > | > b + * ^ + * ``` + * + * @type {State} + */ + function contStart(code) { + if (markdownSpace(code)) { + // Always populated by defaults. + + return factorySpace(effects, contBefore, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code); + } + return contBefore(code); + } + + /** + * At `>`, after optional whitespace. + * + * Also used to parse the first block quote opening. + * + * ```markdown + * | > a + * > | > b + * ^ + * ``` + * + * @type {State} + */ + function contBefore(code) { + return effects.attempt(blockQuote, ok, nok)(code); + } +} + +/** @type {Exiter} */ +function exit(effects) { + effects.exit("blockQuote"); +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/character-escape.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/character-escape.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c61455e85f343e3acf8814d17091943e638f33d5 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/character-escape.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const characterEscape: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=character-escape.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/character-escape.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/character-escape.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e5ec56e148a65da3a2eae240e2502f900ec3e33b --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/character-escape.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"character-escape.d.ts","sourceRoot":"","sources":["character-escape.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,8BADW,SAAS,CAInB;+BAXS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/character-escape.js b/tools/ui/node_modules/micromark-core-commonmark/lib/character-escape.js new file mode 100644 index 0000000000000000000000000000000000000000..36fca818cf816ae7413707616e7d047bccb7218b --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/character-escape.js @@ -0,0 +1,64 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { asciiPunctuation } from 'micromark-util-character'; +/** @type {Construct} */ +export const characterEscape = { + name: 'characterEscape', + tokenize: tokenizeCharacterEscape +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCharacterEscape(effects, ok, nok) { + return start; + + /** + * Start of character escape. + * + * ```markdown + * > | a\*b + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("characterEscape"); + effects.enter("escapeMarker"); + effects.consume(code); + effects.exit("escapeMarker"); + return inside; + } + + /** + * After `\`, at punctuation. + * + * ```markdown + * > | a\*b + * ^ + * ``` + * + * @type {State} + */ + function inside(code) { + // ASCII punctuation. + if (asciiPunctuation(code)) { + effects.enter("characterEscapeValue"); + effects.consume(code); + effects.exit("characterEscapeValue"); + effects.exit("characterEscape"); + return ok; + } + return nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/character-reference.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/character-reference.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..554fe30dbbb2ccee8dfeb83680019154a5f2ac99 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/character-reference.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const characterReference: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=character-reference.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/character-reference.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/character-reference.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..dd03537d5ff767aaa06234517251c6d536c2f057 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/character-reference.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"character-reference.d.ts","sourceRoot":"","sources":["character-reference.js"],"names":[],"mappings":"AAmBA,wBAAwB;AACxB,iCADW,SAAS,CAInB;+BAhBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/character-reference.js b/tools/ui/node_modules/micromark-core-commonmark/lib/character-reference.js new file mode 100644 index 0000000000000000000000000000000000000000..e2d889e90038ea670104b6e136896172ef981692 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/character-reference.js @@ -0,0 +1,149 @@ +/** + * @import { + * Code, + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { decodeNamedCharacterReference } from 'decode-named-character-reference'; +import { asciiAlphanumeric, asciiDigit, asciiHexDigit } from 'micromark-util-character'; +/** @type {Construct} */ +export const characterReference = { + name: 'characterReference', + tokenize: tokenizeCharacterReference +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCharacterReference(effects, ok, nok) { + const self = this; + let size = 0; + /** @type {number} */ + let max; + /** @type {(code: Code) => boolean} */ + let test; + return start; + + /** + * Start of character reference. + * + * ```markdown + * > | a&b + * ^ + * > | a{b + * ^ + * > | a b + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("characterReference"); + effects.enter("characterReferenceMarker"); + effects.consume(code); + effects.exit("characterReferenceMarker"); + return open; + } + + /** + * After `&`, at `#` for numeric references or alphanumeric for named + * references. + * + * ```markdown + * > | a&b + * ^ + * > | a{b + * ^ + * > | a b + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (code === 35) { + effects.enter("characterReferenceMarkerNumeric"); + effects.consume(code); + effects.exit("characterReferenceMarkerNumeric"); + return numeric; + } + effects.enter("characterReferenceValue"); + max = 31; + test = asciiAlphanumeric; + return value(code); + } + + /** + * After `#`, at `x` for hexadecimals or digit for decimals. + * + * ```markdown + * > | a{b + * ^ + * > | a b + * ^ + * ``` + * + * @type {State} + */ + function numeric(code) { + if (code === 88 || code === 120) { + effects.enter("characterReferenceMarkerHexadecimal"); + effects.consume(code); + effects.exit("characterReferenceMarkerHexadecimal"); + effects.enter("characterReferenceValue"); + max = 6; + test = asciiHexDigit; + return value; + } + effects.enter("characterReferenceValue"); + max = 7; + test = asciiDigit; + return value(code); + } + + /** + * After markers (`&#x`, `&#`, or `&`), in value, before `;`. + * + * The character reference kind defines what and how many characters are + * allowed. + * + * ```markdown + * > | a&b + * ^^^ + * > | a{b + * ^^^ + * > | a b + * ^ + * ``` + * + * @type {State} + */ + function value(code) { + if (code === 59 && size) { + const token = effects.exit("characterReferenceValue"); + if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) { + return nok(code); + } + + // To do: `markdown-rs` uses a different name: + // `CharacterReferenceMarkerSemi`. + effects.enter("characterReferenceMarker"); + effects.consume(code); + effects.exit("characterReferenceMarker"); + effects.exit("characterReference"); + return ok; + } + if (test(code) && size++ < max) { + effects.consume(code); + return value; + } + return nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d5f5320e90c09fc3b7e2a2b3c8748a7434aa64d --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const codeFenced: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=code-fenced.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b0c28b2d96aa42605169d38e45403610eedd7f50 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"code-fenced.d.ts","sourceRoot":"","sources":["code-fenced.js"],"names":[],"mappings":"AAqBA,wBAAwB;AACxB,yBADW,SAAS,CAKnB;+BAnBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/code-fenced.js b/tools/ui/node_modules/micromark-core-commonmark/lib/code-fenced.js new file mode 100644 index 0000000000000000000000000000000000000000..3fe1407189a12674ef4b110312130e1624b7e746 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/code-fenced.js @@ -0,0 +1,460 @@ +/** + * @import { + * Code, + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** @type {Construct} */ +const nonLazyContinuation = { + partial: true, + tokenize: tokenizeNonLazyContinuation +}; + +/** @type {Construct} */ +export const codeFenced = { + concrete: true, + name: 'codeFenced', + tokenize: tokenizeCodeFenced +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCodeFenced(effects, ok, nok) { + const self = this; + /** @type {Construct} */ + const closeStart = { + partial: true, + tokenize: tokenizeCloseStart + }; + let initialPrefix = 0; + let sizeOpen = 0; + /** @type {NonNullable} */ + let marker; + return start; + + /** + * Start of code. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function start(code) { + // To do: parse whitespace like `markdown-rs`. + return beforeSequenceOpen(code); + } + + /** + * In opening fence, after prefix, at sequence. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function beforeSequenceOpen(code) { + const tail = self.events[self.events.length - 1]; + initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; + marker = code; + effects.enter("codeFenced"); + effects.enter("codeFencedFence"); + effects.enter("codeFencedFenceSequence"); + return sequenceOpen(code); + } + + /** + * In opening fence sequence. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function sequenceOpen(code) { + if (code === marker) { + sizeOpen++; + effects.consume(code); + return sequenceOpen; + } + if (sizeOpen < 3) { + return nok(code); + } + effects.exit("codeFencedFenceSequence"); + return markdownSpace(code) ? factorySpace(effects, infoBefore, "whitespace")(code) : infoBefore(code); + } + + /** + * In opening fence, after the sequence (and optional whitespace), before info. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function infoBefore(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("codeFencedFence"); + return self.interrupt ? ok(code) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); + } + effects.enter("codeFencedFenceInfo"); + effects.enter("chunkString", { + contentType: "string" + }); + return info(code); + } + + /** + * In info. + * + * ```markdown + * > | ~~~js + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function info(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceInfo"); + return infoBefore(code); + } + if (markdownSpace(code)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceInfo"); + return factorySpace(effects, metaBefore, "whitespace")(code); + } + if (code === 96 && code === marker) { + return nok(code); + } + effects.consume(code); + return info; + } + + /** + * In opening fence, after info and whitespace, before meta. + * + * ```markdown + * > | ~~~js eval + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function metaBefore(code) { + if (code === null || markdownLineEnding(code)) { + return infoBefore(code); + } + effects.enter("codeFencedFenceMeta"); + effects.enter("chunkString", { + contentType: "string" + }); + return meta(code); + } + + /** + * In meta. + * + * ```markdown + * > | ~~~js eval + * ^ + * | alert(1) + * | ~~~ + * ``` + * + * @type {State} + */ + function meta(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("chunkString"); + effects.exit("codeFencedFenceMeta"); + return infoBefore(code); + } + if (code === 96 && code === marker) { + return nok(code); + } + effects.consume(code); + return meta; + } + + /** + * At eol/eof in code, before a non-lazy closing fence or content. + * + * ```markdown + * > | ~~~js + * ^ + * > | alert(1) + * ^ + * | ~~~ + * ``` + * + * @type {State} + */ + function atNonLazyBreak(code) { + return effects.attempt(closeStart, after, contentBefore)(code); + } + + /** + * Before code content, not a closing fence, at eol. + * + * ```markdown + * | ~~~js + * > | alert(1) + * ^ + * | ~~~ + * ``` + * + * @type {State} + */ + function contentBefore(code) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return contentStart; + } + + /** + * Before code content, not a closing fence. + * + * ```markdown + * | ~~~js + * > | alert(1) + * ^ + * | ~~~ + * ``` + * + * @type {State} + */ + function contentStart(code) { + return initialPrefix > 0 && markdownSpace(code) ? factorySpace(effects, beforeContentChunk, "linePrefix", initialPrefix + 1)(code) : beforeContentChunk(code); + } + + /** + * Before code content, after optional prefix. + * + * ```markdown + * | ~~~js + * > | alert(1) + * ^ + * | ~~~ + * ``` + * + * @type {State} + */ + function beforeContentChunk(code) { + if (code === null || markdownLineEnding(code)) { + return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); + } + effects.enter("codeFlowValue"); + return contentChunk(code); + } + + /** + * In code content. + * + * ```markdown + * | ~~~js + * > | alert(1) + * ^^^^^^^^ + * | ~~~ + * ``` + * + * @type {State} + */ + function contentChunk(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("codeFlowValue"); + return beforeContentChunk(code); + } + effects.consume(code); + return contentChunk; + } + + /** + * After code. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + effects.exit("codeFenced"); + return ok(code); + } + + /** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ + function tokenizeCloseStart(effects, ok, nok) { + let size = 0; + return startBefore; + + /** + * + * + * @type {State} + */ + function startBefore(code) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return start; + } + + /** + * Before closing fence, at optional whitespace. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // Always populated by defaults. + + // To do: `enter` here or in next state? + effects.enter("codeFencedFence"); + return markdownSpace(code) ? factorySpace(effects, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : beforeSequenceClose(code); + } + + /** + * In closing fence, after optional whitespace, at sequence. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function beforeSequenceClose(code) { + if (code === marker) { + effects.enter("codeFencedFenceSequence"); + return sequenceClose(code); + } + return nok(code); + } + + /** + * In closing fence sequence. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function sequenceClose(code) { + if (code === marker) { + size++; + effects.consume(code); + return sequenceClose; + } + if (size >= sizeOpen) { + effects.exit("codeFencedFenceSequence"); + return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, "whitespace")(code) : sequenceCloseAfter(code); + } + return nok(code); + } + + /** + * After closing fence sequence, after optional whitespace. + * + * ```markdown + * | ~~~js + * | alert(1) + * > | ~~~ + * ^ + * ``` + * + * @type {State} + */ + function sequenceCloseAfter(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("codeFencedFence"); + return ok(code); + } + return nok(code); + } + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeNonLazyContinuation(effects, ok, nok) { + const self = this; + return start; + + /** + * + * + * @type {State} + */ + function start(code) { + if (code === null) { + return nok(code); + } + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return lineStart; + } + + /** + * + * + * @type {State} + */ + function lineStart(code) { + return self.parser.lazy[self.now().line] ? nok(code) : ok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/code-indented.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/code-indented.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3c06578bab6c0f9f73a7b88e3ee260db52ca5fa4 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/code-indented.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const codeIndented: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=code-indented.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/code-indented.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/code-indented.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..099be93959e1da2e65f4924ed2b38877c736b22a --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/code-indented.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"code-indented.d.ts","sourceRoot":"","sources":["code-indented.js"],"names":[],"mappings":"AAcA,wBAAwB;AACxB,2BADW,SAAS,CAInB;+BAZS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/code-indented.js b/tools/ui/node_modules/micromark-core-commonmark/lib/code-indented.js new file mode 100644 index 0000000000000000000000000000000000000000..cde9a8719de9da36184814c48376496d512e2496 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/code-indented.js @@ -0,0 +1,177 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding, markdownSpace } from 'micromark-util-character'; +/** @type {Construct} */ +export const codeIndented = { + name: 'codeIndented', + tokenize: tokenizeCodeIndented +}; + +/** @type {Construct} */ +const furtherStart = { + partial: true, + tokenize: tokenizeFurtherStart +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCodeIndented(effects, ok, nok) { + const self = this; + return start; + + /** + * Start of code (indented). + * + * > **Parsing note**: it is not needed to check if this first line is a + * > filled line (that it has a non-whitespace character), because blank lines + * > are parsed already, so we never run into that. + * + * ```markdown + * > | aaa + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // To do: manually check if interrupting like `markdown-rs`. + + effects.enter("codeIndented"); + // To do: use an improved `space_or_tab` function like `markdown-rs`, + // so that we can drop the next state. + return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code); + } + + /** + * At start, after 1 or 4 spaces. + * + * ```markdown + * > | aaa + * ^ + * ``` + * + * @type {State} + */ + function afterPrefix(code) { + const tail = self.events[self.events.length - 1]; + return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code); + } + + /** + * At a break. + * + * ```markdown + * > | aaa + * ^ ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === null) { + return after(code); + } + if (markdownLineEnding(code)) { + return effects.attempt(furtherStart, atBreak, after)(code); + } + effects.enter("codeFlowValue"); + return inside(code); + } + + /** + * In code content. + * + * ```markdown + * > | aaa + * ^^^^ + * ``` + * + * @type {State} + */ + function inside(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("codeFlowValue"); + return atBreak(code); + } + effects.consume(code); + return inside; + } + + /** @type {State} */ + function after(code) { + effects.exit("codeIndented"); + // To do: allow interrupting like `markdown-rs`. + // Feel free to interrupt. + // tokenizer.interrupt = false + return ok(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeFurtherStart(effects, ok, nok) { + const self = this; + return furtherStart; + + /** + * At eol, trying to parse another indent. + * + * ```markdown + * > | aaa + * ^ + * | bbb + * ``` + * + * @type {State} + */ + function furtherStart(code) { + // To do: improve `lazy` / `pierce` handling. + // If this is a lazy line, it can’t be code. + if (self.parser.lazy[self.now().line]) { + return nok(code); + } + if (markdownLineEnding(code)) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return furtherStart; + } + + // To do: the code here in `micromark-js` is a bit different from + // `markdown-rs` because there it can attempt spaces. + // We can’t yet. + // + // To do: use an improved `space_or_tab` function like `markdown-rs`, + // so that we can drop the next state. + return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code); + } + + /** + * At start, after 1 or 4 spaces. + * + * ```markdown + * > | aaa + * ^ + * ``` + * + * @type {State} + */ + function afterPrefix(code) { + const tail = self.events[self.events.length - 1]; + return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/code-text.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/code-text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8047b2c2204dcc2fc21094b69a06ba36881fc3fb --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/code-text.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const codeText: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=code-text.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/code-text.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/code-text.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d5558209fb9b70b3beeee714341631158163311a --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/code-text.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"code-text.d.ts","sourceRoot":"","sources":["code-text.js"],"names":[],"mappings":"AAgBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BAbS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/code-text.js b/tools/ui/node_modules/micromark-core-commonmark/lib/code-text.js new file mode 100644 index 0000000000000000000000000000000000000000..c31568e892015ff204b81f0693506bd1a20069c6 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/code-text.js @@ -0,0 +1,225 @@ +/** + * @import { + * Construct, + * Previous, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import { markdownLineEnding } from 'micromark-util-character'; +/** @type {Construct} */ +export const codeText = { + name: 'codeText', + previous, + resolve: resolveCodeText, + tokenize: tokenizeCodeText +}; + +// To do: next major: don’t resolve, like `markdown-rs`. +/** @type {Resolver} */ +function resolveCodeText(events) { + let tailExitIndex = events.length - 4; + let headEnterIndex = 3; + /** @type {number} */ + let index; + /** @type {number | undefined} */ + let enter; + + // If we start and end with an EOL or a space. + if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === 'space')) { + index = headEnterIndex; + + // And we have data. + while (++index < tailExitIndex) { + if (events[index][1].type === "codeTextData") { + // Then we have padding. + events[headEnterIndex][1].type = "codeTextPadding"; + events[tailExitIndex][1].type = "codeTextPadding"; + headEnterIndex += 2; + tailExitIndex -= 2; + break; + } + } + } + + // Merge adjacent spaces and data. + index = headEnterIndex - 1; + tailExitIndex++; + while (++index <= tailExitIndex) { + if (enter === undefined) { + if (index !== tailExitIndex && events[index][1].type !== "lineEnding") { + enter = index; + } + } else if (index === tailExitIndex || events[index][1].type === "lineEnding") { + events[enter][1].type = "codeTextData"; + if (index !== enter + 2) { + events[enter][1].end = events[index - 1][1].end; + events.splice(enter + 2, index - enter - 2); + tailExitIndex -= index - enter - 2; + index = enter + 2; + } + enter = undefined; + } + } + return events; +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Previous} + */ +function previous(code) { + // If there is a previous code, there will always be a tail. + return code !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeCodeText(effects, ok, nok) { + const self = this; + let sizeOpen = 0; + /** @type {number} */ + let size; + /** @type {Token} */ + let token; + return start; + + /** + * Start of code (text). + * + * ```markdown + * > | `a` + * ^ + * > | \`a` + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("codeText"); + effects.enter("codeTextSequence"); + return sequenceOpen(code); + } + + /** + * In opening sequence. + * + * ```markdown + * > | `a` + * ^ + * ``` + * + * @type {State} + */ + function sequenceOpen(code) { + if (code === 96) { + effects.consume(code); + sizeOpen++; + return sequenceOpen; + } + effects.exit("codeTextSequence"); + return between(code); + } + + /** + * Between something and something else. + * + * ```markdown + * > | `a` + * ^^ + * ``` + * + * @type {State} + */ + function between(code) { + // EOF. + if (code === null) { + return nok(code); + } + + // To do: next major: don’t do spaces in resolve, but when compiling, + // like `markdown-rs`. + // Tabs don’t work, and virtual spaces don’t make sense. + if (code === 32) { + effects.enter('space'); + effects.consume(code); + effects.exit('space'); + return between; + } + + // Closing fence? Could also be data. + if (code === 96) { + token = effects.enter("codeTextSequence"); + size = 0; + return sequenceClose(code); + } + if (markdownLineEnding(code)) { + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return between; + } + + // Data. + effects.enter("codeTextData"); + return data(code); + } + + /** + * In data. + * + * ```markdown + * > | `a` + * ^ + * ``` + * + * @type {State} + */ + function data(code) { + if (code === null || code === 32 || code === 96 || markdownLineEnding(code)) { + effects.exit("codeTextData"); + return between(code); + } + effects.consume(code); + return data; + } + + /** + * In closing sequence. + * + * ```markdown + * > | `a` + * ^ + * ``` + * + * @type {State} + */ + function sequenceClose(code) { + // More. + if (code === 96) { + effects.consume(code); + size++; + return sequenceClose; + } + + // Done! + if (size === sizeOpen) { + effects.exit("codeTextSequence"); + effects.exit("codeText"); + return ok(code); + } + + // More or less accents: mark as data. + token.type = "codeTextData"; + return data(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/content.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/content.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eec537f9fdae61cfeefbff08e8211eed56228381 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/content.d.ts @@ -0,0 +1,7 @@ +/** + * No name because it must not be turned off. + * @type {Construct} + */ +export const content: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=content.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/content.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/content.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..04ed7089749a041b50aa38f1ab4e94589ebed860 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/content.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["content.js"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,sBAFU,SAAS,CAEwD;+BAbjE,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/content.js b/tools/ui/node_modules/micromark-core-commonmark/lib/content.js new file mode 100644 index 0000000000000000000000000000000000000000..507bdb49e1ae551f8b774bdd80a4405ab0a07d0f --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/content.js @@ -0,0 +1,163 @@ +/** + * @import { + * Construct, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEnding } from 'micromark-util-character'; +import { subtokenize } from 'micromark-util-subtokenize'; +/** + * No name because it must not be turned off. + * @type {Construct} + */ +export const content = { + resolve: resolveContent, + tokenize: tokenizeContent +}; + +/** @type {Construct} */ +const continuationConstruct = { + partial: true, + tokenize: tokenizeContinuation +}; + +/** + * Content is transparent: it’s parsed right now. That way, definitions are also + * parsed right now: before text in paragraphs (specifically, media) are parsed. + * + * @type {Resolver} + */ +function resolveContent(events) { + subtokenize(events); + return events; +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeContent(effects, ok) { + /** @type {Token | undefined} */ + let previous; + return chunkStart; + + /** + * Before a content chunk. + * + * ```markdown + * > | abc + * ^ + * ``` + * + * @type {State} + */ + function chunkStart(code) { + effects.enter("content"); + previous = effects.enter("chunkContent", { + contentType: "content" + }); + return chunkInside(code); + } + + /** + * In a content chunk. + * + * ```markdown + * > | abc + * ^^^ + * ``` + * + * @type {State} + */ + function chunkInside(code) { + if (code === null) { + return contentEnd(code); + } + + // To do: in `markdown-rs`, each line is parsed on its own, and everything + // is stitched together resolving. + if (markdownLineEnding(code)) { + return effects.check(continuationConstruct, contentContinue, contentEnd)(code); + } + + // Data. + effects.consume(code); + return chunkInside; + } + + /** + * + * + * @type {State} + */ + function contentEnd(code) { + effects.exit("chunkContent"); + effects.exit("content"); + return ok(code); + } + + /** + * + * + * @type {State} + */ + function contentContinue(code) { + effects.consume(code); + effects.exit("chunkContent"); + previous.next = effects.enter("chunkContent", { + contentType: "content", + previous + }); + previous = previous.next; + return chunkInside; + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeContinuation(effects, ok, nok) { + const self = this; + return startLookahead; + + /** + * + * + * @type {State} + */ + function startLookahead(code) { + effects.exit("chunkContent"); + effects.enter("lineEnding"); + effects.consume(code); + effects.exit("lineEnding"); + return factorySpace(effects, prefixed, "linePrefix"); + } + + /** + * + * + * @type {State} + */ + function prefixed(code) { + if (code === null || markdownLineEnding(code)) { + return nok(code); + } + + // Always populated by defaults. + + const tail = self.events[self.events.length - 1]; + if (!self.parser.constructs.disable.null.includes('codeIndented') && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) { + return ok(code); + } + return effects.interrupt(self.parser.constructs.flow, nok, ok)(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/definition.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/definition.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f5a46930596f28abf7c913481080928e132a4ae0 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/definition.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const definition: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=definition.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/definition.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/definition.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..46a16d3ad245346b876d819a8c326ce0d6da5d43 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/definition.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["definition.js"],"names":[],"mappings":"AAuBA,wBAAwB;AACxB,yBADW,SAAS,CACwD;+BAlBlE,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/definition.js b/tools/ui/node_modules/micromark-core-commonmark/lib/definition.js new file mode 100644 index 0000000000000000000000000000000000000000..5c74e9723835696280876a877d8664bca2cfbc6a --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/definition.js @@ -0,0 +1,254 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { factoryDestination } from 'micromark-factory-destination'; +import { factoryLabel } from 'micromark-factory-label'; +import { factorySpace } from 'micromark-factory-space'; +import { factoryTitle } from 'micromark-factory-title'; +import { factoryWhitespace } from 'micromark-factory-whitespace'; +import { markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character'; +import { normalizeIdentifier } from 'micromark-util-normalize-identifier'; +/** @type {Construct} */ +export const definition = { + name: 'definition', + tokenize: tokenizeDefinition +}; + +/** @type {Construct} */ +const titleBefore = { + partial: true, + tokenize: tokenizeTitleBefore +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeDefinition(effects, ok, nok) { + const self = this; + /** @type {string} */ + let identifier; + return start; + + /** + * At start of a definition. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // Do not interrupt paragraphs (but do follow definitions). + // To do: do `interrupt` the way `markdown-rs` does. + // To do: parse whitespace the way `markdown-rs` does. + effects.enter("definition"); + return before(code); + } + + /** + * After optional whitespace, at `[`. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + // To do: parse whitespace the way `markdown-rs` does. + + return factoryLabel.call(self, effects, labelAfter, + // Note: we don’t need to reset the way `markdown-rs` does. + nok, "definitionLabel", "definitionLabelMarker", "definitionLabelString")(code); + } + + /** + * After label. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function labelAfter(code) { + identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)); + if (code === 58) { + effects.enter("definitionMarker"); + effects.consume(code); + effects.exit("definitionMarker"); + return markerAfter; + } + return nok(code); + } + + /** + * After marker. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function markerAfter(code) { + // Note: whitespace is optional. + return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, destinationBefore)(code) : destinationBefore(code); + } + + /** + * Before destination. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function destinationBefore(code) { + return factoryDestination(effects, destinationAfter, + // Note: we don’t need to reset the way `markdown-rs` does. + nok, "definitionDestination", "definitionDestinationLiteral", "definitionDestinationLiteralMarker", "definitionDestinationRaw", "definitionDestinationString")(code); + } + + /** + * After destination. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function destinationAfter(code) { + return effects.attempt(titleBefore, after, after)(code); + } + + /** + * After definition. + * + * ```markdown + * > | [a]: b + * ^ + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function after(code) { + return markdownSpace(code) ? factorySpace(effects, afterWhitespace, "whitespace")(code) : afterWhitespace(code); + } + + /** + * After definition, after optional whitespace. + * + * ```markdown + * > | [a]: b + * ^ + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function afterWhitespace(code) { + if (code === null || markdownLineEnding(code)) { + effects.exit("definition"); + + // Note: we don’t care about uniqueness. + // It’s likely that that doesn’t happen very frequently. + // It is more likely that it wastes precious time. + self.parser.defined.push(identifier); + + // To do: `markdown-rs` interrupt. + // // You’d be interrupting. + // tokenizer.interrupt = true + return ok(code); + } + return nok(code); + } +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeTitleBefore(effects, ok, nok) { + return titleBefore; + + /** + * After destination, at whitespace. + * + * ```markdown + * > | [a]: b + * ^ + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function titleBefore(code) { + return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code); + } + + /** + * At title. + * + * ```markdown + * | [a]: b + * > | "c" + * ^ + * ``` + * + * @type {State} + */ + function beforeMarker(code) { + return factoryTitle(effects, titleAfter, nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(code); + } + + /** + * After title. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function titleAfter(code) { + return markdownSpace(code) ? factorySpace(effects, titleAfterOptionalWhitespace, "whitespace")(code) : titleAfterOptionalWhitespace(code); + } + + /** + * After title, after optional whitespace. + * + * ```markdown + * > | [a]: b "c" + * ^ + * ``` + * + * @type {State} + */ + function titleAfterOptionalWhitespace(code) { + return code === null || markdownLineEnding(code) ? ok(code) : nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..eff01b324e2a82400b61eaecc7c842f6f8765865 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const hardBreakEscape: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=hard-break-escape.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..923753ce13d86326b96e42e9de1a5674fbad0deb --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/hard-break-escape.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hard-break-escape.d.ts","sourceRoot":"","sources":["hard-break-escape.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,8BADW,SAAS,CAInB;+BAXS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/hard-break-escape.js b/tools/ui/node_modules/micromark-core-commonmark/lib/hard-break-escape.js new file mode 100644 index 0000000000000000000000000000000000000000..530ade444940b25445aa831a8161a7d5ae6cb079 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/hard-break-escape.js @@ -0,0 +1,60 @@ +/** + * @import { + * Construct, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { markdownLineEnding } from 'micromark-util-character'; +/** @type {Construct} */ +export const hardBreakEscape = { + name: 'hardBreakEscape', + tokenize: tokenizeHardBreakEscape +}; + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeHardBreakEscape(effects, ok, nok) { + return start; + + /** + * Start of a hard break (escape). + * + * ```markdown + * > | a\ + * ^ + * | b + * ``` + * + * @type {State} + */ + function start(code) { + effects.enter("hardBreakEscape"); + effects.consume(code); + return after; + } + + /** + * After `\`, at eol. + * + * ```markdown + * > | a\ + * ^ + * | b + * ``` + * + * @type {State} + */ + function after(code) { + if (markdownLineEnding(code)) { + effects.exit("hardBreakEscape"); + return ok(code); + } + return nok(code); + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a08353b6c5f1798ffd4e7ea29705a9b07d5ca9db --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const headingAtx: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=heading-atx.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..8c8eebf31f2cfe32ca43e83fba9fc5d24bf786ea --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/heading-atx.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"heading-atx.d.ts","sourceRoot":"","sources":["heading-atx.js"],"names":[],"mappings":"AAqBA,wBAAwB;AACxB,yBADW,SAAS,CAKnB;+BAlBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/heading-atx.js b/tools/ui/node_modules/micromark-core-commonmark/lib/heading-atx.js new file mode 100644 index 0000000000000000000000000000000000000000..39db4a4555261a8c991789d8f529d4b3ce482809 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/heading-atx.js @@ -0,0 +1,195 @@ +/** + * @import { + * Construct, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer, + * Token + * } from 'micromark-util-types' + */ + +import { factorySpace } from 'micromark-factory-space'; +import { markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character'; +import { splice } from 'micromark-util-chunked'; +/** @type {Construct} */ +export const headingAtx = { + name: 'headingAtx', + resolve: resolveHeadingAtx, + tokenize: tokenizeHeadingAtx +}; + +/** @type {Resolver} */ +function resolveHeadingAtx(events, context) { + let contentEnd = events.length - 2; + let contentStart = 3; + /** @type {Token} */ + let content; + /** @type {Token} */ + let text; + + // Prefix whitespace, part of the opening. + if (events[contentStart][1].type === "whitespace") { + contentStart += 2; + } + + // Suffix whitespace, part of the closing. + if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") { + contentEnd -= 2; + } + if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) { + contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; + } + if (contentEnd > contentStart) { + content = { + type: "atxHeadingText", + start: events[contentStart][1].start, + end: events[contentEnd][1].end + }; + text = { + type: "chunkText", + start: events[contentStart][1].start, + end: events[contentEnd][1].end, + contentType: "text" + }; + splice(events, contentStart, contentEnd - contentStart + 1, [['enter', content, context], ['enter', text, context], ['exit', text, context], ['exit', content, context]]); + } + return events; +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeHeadingAtx(effects, ok, nok) { + let size = 0; + return start; + + /** + * Start of a heading (atx). + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // To do: parse indent like `markdown-rs`. + effects.enter("atxHeading"); + return before(code); + } + + /** + * After optional whitespace, at `#`. + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + effects.enter("atxHeadingSequence"); + return sequenceOpen(code); + } + + /** + * In opening sequence. + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function sequenceOpen(code) { + if (code === 35 && size++ < 6) { + effects.consume(code); + return sequenceOpen; + } + + // Always at least one `#`. + if (code === null || markdownLineEndingOrSpace(code)) { + effects.exit("atxHeadingSequence"); + return atBreak(code); + } + return nok(code); + } + + /** + * After something, before something else. + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function atBreak(code) { + if (code === 35) { + effects.enter("atxHeadingSequence"); + return sequenceFurther(code); + } + if (code === null || markdownLineEnding(code)) { + effects.exit("atxHeading"); + // To do: interrupt like `markdown-rs`. + // // Feel free to interrupt. + // tokenizer.interrupt = false + return ok(code); + } + if (markdownSpace(code)) { + return factorySpace(effects, atBreak, "whitespace")(code); + } + + // To do: generate `data` tokens, add the `text` token later. + // Needs edit map, see: `markdown.rs`. + effects.enter("atxHeadingText"); + return data(code); + } + + /** + * In further sequence (after whitespace). + * + * Could be normal “visible” hashes in the heading or a final sequence. + * + * ```markdown + * > | ## aa ## + * ^ + * ``` + * + * @type {State} + */ + function sequenceFurther(code) { + if (code === 35) { + effects.consume(code); + return sequenceFurther; + } + effects.exit("atxHeadingSequence"); + return atBreak(code); + } + + /** + * In text. + * + * ```markdown + * > | ## aa + * ^ + * ``` + * + * @type {State} + */ + function data(code) { + if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { + effects.exit("atxHeadingText"); + return atBreak(code); + } + effects.consume(code); + return data; + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/html-flow.d.ts b/tools/ui/node_modules/micromark-core-commonmark/lib/html-flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..83fa70cd1b092c05d7d32527bc43aef4b7c4baa3 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/html-flow.d.ts @@ -0,0 +1,4 @@ +/** @type {Construct} */ +export const htmlFlow: Construct; +import type { Construct } from 'micromark-util-types'; +//# sourceMappingURL=html-flow.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map b/tools/ui/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1a23a6fde0f60733d2f8ab684f91172a97f1a661 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"html-flow.d.ts","sourceRoot":"","sources":["html-flow.js"],"names":[],"mappings":"AAuBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BArBS,sBAAsB"} \ No newline at end of file diff --git a/tools/ui/node_modules/micromark-core-commonmark/lib/html-flow.js b/tools/ui/node_modules/micromark-core-commonmark/lib/html-flow.js new file mode 100644 index 0000000000000000000000000000000000000000..2d4b5f39f127fc23a8803bface2f309eddb19231 --- /dev/null +++ b/tools/ui/node_modules/micromark-core-commonmark/lib/html-flow.js @@ -0,0 +1,876 @@ +/** + * @import { + * Code, + * Construct, + * Resolver, + * State, + * TokenizeContext, + * Tokenizer + * } from 'micromark-util-types' + */ + +import { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character'; +import { htmlBlockNames, htmlRawNames } from 'micromark-util-html-tag-name'; +import { blankLine } from './blank-line.js'; + +/** @type {Construct} */ +export const htmlFlow = { + concrete: true, + name: 'htmlFlow', + resolveTo: resolveToHtmlFlow, + tokenize: tokenizeHtmlFlow +}; + +/** @type {Construct} */ +const blankLineBefore = { + partial: true, + tokenize: tokenizeBlankLineBefore +}; +const nonLazyContinuationStart = { + partial: true, + tokenize: tokenizeNonLazyContinuationStart +}; + +/** @type {Resolver} */ +function resolveToHtmlFlow(events) { + let index = events.length; + while (index--) { + if (events[index][0] === 'enter' && events[index][1].type === "htmlFlow") { + break; + } + } + if (index > 1 && events[index - 2][1].type === "linePrefix") { + // Add the prefix start to the HTML token. + events[index][1].start = events[index - 2][1].start; + // Add the prefix start to the HTML line token. + events[index + 1][1].start = events[index - 2][1].start; + // Remove the line prefix. + events.splice(index - 2, 2); + } + return events; +} + +/** + * @this {TokenizeContext} + * Context. + * @type {Tokenizer} + */ +function tokenizeHtmlFlow(effects, ok, nok) { + const self = this; + /** @type {number} */ + let marker; + /** @type {boolean} */ + let closingTag; + /** @type {string} */ + let buffer; + /** @type {number} */ + let index; + /** @type {Code} */ + let markerB; + return start; + + /** + * Start of HTML (flow). + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function start(code) { + // To do: parse indent like `markdown-rs`. + return before(code); + } + + /** + * At `<`, after optional whitespace. + * + * ```markdown + * > | + * ^ + * ``` + * + * @type {State} + */ + function before(code) { + effects.enter("htmlFlow"); + effects.enter("htmlFlowData"); + effects.consume(code); + return open; + } + + /** + * After `<`, at tag name or other stuff. + * + * ```markdown + * > | + * ^ + * > | + * ^ + * > | + * ^ + * ``` + * + * @type {State} + */ + function open(code) { + if (code === 33) { + effects.consume(code); + return declarationOpen; + } + if (code === 47) { + effects.consume(code); + closingTag = true; + return tagCloseStart; + } + if (code === 63) { + effects.consume(code); + marker = 3; + // To do: + // tokenizer.concrete = true + // To do: use `markdown-rs` style interrupt. + // While we’re in an instruction instead of a declaration, we’re on a `?` + // right now, so we do need to search for `>`, similar to declarations. + return self.interrupt ? ok : continuationDeclarationInside; + } + + // ASCII alphabetical. + if (asciiAlpha(code)) { + // Always the case. + effects.consume(code); + buffer = String.fromCharCode(code); + return tagName; + } + return nok(code); + } + + /** + * After ` | + * ^ + * > | + * ^ + * > | &<]]> + * ^ + * ``` + * + * @type {State} + */ + function declarationOpen(code) { + if (code === 45) { + effects.consume(code); + marker = 2; + return commentOpenInside; + } + if (code === 91) { + effects.consume(code); + marker = 5; + index = 0; + return cdataOpenInside; + } + + // ASCII alphabetical. + if (asciiAlpha(code)) { + effects.consume(code); + marker = 4; + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok : continuationDeclarationInside; + } + return nok(code); + } + + /** + * After ` | + * ^ + * ``` + * + * @type {State} + */ + function commentOpenInside(code) { + if (code === 45) { + effects.consume(code); + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok : continuationDeclarationInside; + } + return nok(code); + } + + /** + * After ` | &<]]> + * ^^^^^^ + * ``` + * + * @type {State} + */ + function cdataOpenInside(code) { + const value = "CDATA["; + if (code === value.charCodeAt(index++)) { + effects.consume(code); + if (index === value.length) { + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok : continuation; + } + return cdataOpenInside; + } + return nok(code); + } + + /** + * After ` | + * ^ + * ``` + * + * @type {State} + */ + function tagCloseStart(code) { + if (asciiAlpha(code)) { + // Always the case. + effects.consume(code); + buffer = String.fromCharCode(code); + return tagName; + } + return nok(code); + } + + /** + * In tag name. + * + * ```markdown + * > | + * ^^ + * > | + * ^^ + * ``` + * + * @type {State} + */ + function tagName(code) { + if (code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { + const slash = code === 47; + const name = buffer.toLowerCase(); + if (!slash && !closingTag && htmlRawNames.includes(name)) { + marker = 1; + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok(code) : continuation(code); + } + if (htmlBlockNames.includes(buffer.toLowerCase())) { + marker = 6; + if (slash) { + effects.consume(code); + return basicSelfClosing; + } + + // // Do not form containers. + // tokenizer.concrete = true + return self.interrupt ? ok(code) : continuation(code); + } + marker = 7; + // Do not support complete HTML when interrupting. + return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : closingTag ? completeClosingTagAfter(code) : completeAttributeNameBefore(code); + } + + // ASCII alphanumerical and `-`. + if (code === 45 || asciiAlphanumeric(code)) { + effects.consume(code); + buffer += String.fromCharCode(code); + return tagName; + } + return nok(code); + } + + /** + * After closing slash of a basic tag name. + * + * ```markdown + * > |